2022-08-17 17:38:21 +00:00
import { TooltipProvider } from "@radix-ui/react-tooltip" ;
2022-01-07 20:23:37 +00:00
import { SessionProvider } from "next-auth/react" ;
2022-07-28 19:58:26 +00:00
import { EventCollectionProvider } from "next-collect/client" ;
2023-02-16 22:39:57 +00:00
import type { SSRConfig } from "next-i18next" ;
import { appWithTranslation } from "next-i18next" ;
2022-07-28 19:58:26 +00:00
import { ThemeProvider } from "next-themes" ;
2022-05-17 19:31:49 +00:00
import type { AppProps as NextAppProps , AppProps as NextJsAppProps } from "next/app" ;
2023-02-16 22:39:57 +00:00
import type { NextRouter } from "next/router" ;
2023-04-05 18:14:46 +00:00
import { useRouter } from "next/router" ;
import type { ComponentProps , PropsWithChildren , ReactNode } from "react" ;
2021-08-27 12:11:24 +00:00
feat: Organizations (#8993)
* Initial commit
* Adding feature flag
* feat: Orgs Schema Changing `scopedMembers` to `orgUsers` (#9209)
* Change scopedMembers to orgMembers
* Change to orgUsers
* Letting duplicate slugs for teams to support orgs
* Covering null on unique clauses
* Supporting having the orgId in the session cookie
* feat: organization event type filter (#9253)
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* Missing changes to support orgs schema changes
* feat: Onboarding process to create an organization (#9184)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* feedback
* Making sure we check requestedSlug now
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* feat: [CAL-1816] Organization subdomain support (#9345)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* Covering users and subteams, excluding non-org users
* Unpublished teams shows correctly
* Create subdomain in Vercel
* feedback
* Renaming Vercel env vars
* Vercel domain check before creation
* Supporting cal-staging.com
* Change to have vercel detect it
* vercel domain check data message error
* Remove check domain
* Making sure we check requestedSlug now
* Feedback and unneeded code
* Reverting unneeded changes
* Unneeded changes
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* Vercel subdomain creation in PROD only
* Making sure we let localhost still work
* Feedback
* Type check fixes
* feat: Organization branding in side menu (#9279)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Org branding provider used in shell sidebar
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Using org avatar (temp)
* Not showing org logo if not set
* User onboarding with org branding (slug)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* feedback
* Feedback
* Org public profile
* Public profiles for team event types
* Added setup profile alert
* Using org avatar on subteams avatar
* Making sure we show the set up profile on org only
* Profile username availability rely on org hook
* Update apps/web/pages/team/[slug].tsx
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* Update apps/web/pages/team/[slug].tsx
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* feat: Organization support for event types page (#9449)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Org branding provider used in shell sidebar
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Using org avatar (temp)
* Not showing org logo if not set
* User onboarding with org branding (slug)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* feedback
* Feedback
* Org public profile
* Public profiles for team event types
* Added setup profile alert
* Using org avatar on subteams avatar
* Processing orgs and children as profile options
* Reverting change not belonging to this PR
* Making sure we show the set up profile on org only
* Removing console.log
* Comparing memberships to choose the highest one
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* Type errors
* Refactor and type fixes
* Update orgDomains.ts
* Feedback
* Reverting
* NIT
* fix issue getting org slug from domain
* Improving orgDomains util
* Host comes with port
* Update useRouterQuery.ts
* Feedback
* Feedback
* Feedback
* Feedback: SSR for user event-types to have org context
* chore: Cache node_modules (#9492)
* Adding check for cache hit
* Adding a separate install step first
* Put the restore cache steps back
* Revert the uses type for restoring cache
* Added step to restore nm cache
* Removed the cache-hit check
* Comments and naming
* Removed extra install command
* Updated the name of the linting step to be more clear
* Removes the need for useEffect here
* Feedback
* Feedback
* Cookie domain needs a dot
* Type fix
* Update apps/web/public/static/locales/en/common.json
Co-authored-by: Omar López <zomars@me.com>
* Update packages/emails/src/templates/OrganizationAccountVerifyEmail.tsx
* Feedback
---------
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
Co-authored-by: Joe Au-Yeung <65426560+joeauyeung@users.noreply.github.com>
Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com>
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
Co-authored-by: zomars <zomars@me.com>
Co-authored-by: Efraín Rochín <roae.85@gmail.com>
Co-authored-by: Keith Williams <keithwillcode@gmail.com>
2023-06-14 21:40:20 +00:00
import { OrgBrandingProvider } from "@calcom/features/ee/organizations/context/provider" ;
import { useOrgBrandingValues } from "@calcom/features/ee/organizations/hooks" ;
2022-07-28 19:58:26 +00:00
import DynamicHelpscoutProvider from "@calcom/features/ee/support/lib/helpscout/providerDynamic" ;
import DynamicIntercomProvider from "@calcom/features/ee/support/lib/intercom/providerDynamic" ;
2023-03-25 00:59:04 +00:00
import { FeatureProvider } from "@calcom/features/flags/context/provider" ;
import { useFlags } from "@calcom/features/flags/hooks" ;
2022-11-10 23:40:01 +00:00
import { trpc } from "@calcom/trpc/react" ;
2022-11-23 02:55:25 +00:00
import { MetaProvider } from "@calcom/ui" ;
2021-09-24 20:02:03 +00:00
2022-02-16 15:26:48 +00:00
import usePublicPage from "@lib/hooks/usePublicPage" ;
2023-02-16 22:39:57 +00:00
import type { WithNonceProps } from "@lib/withNonce" ;
2021-09-22 19:52:38 +00:00
2023-04-27 10:55:26 +00:00
import { useViewerI18n } from "@components/I18nLanguageHandler" ;
2022-11-05 18:00:10 +00:00
const I18nextAdapter = appWithTranslation < NextJsAppProps < SSRConfig > & { children : React.ReactNode } > (
( { children } ) = > < > { children } < / >
) ;
2021-10-14 10:57:49 +00:00
2021-10-20 16:00:11 +00:00
// Workaround for https://github.com/vercel/next.js/issues/8592
2023-05-16 19:41:47 +00:00
export type AppProps = Omit <
NextAppProps < WithNonceProps & { themeBasis ? : string } & Record < string , unknown > > ,
"Component"
> & {
2022-07-28 10:50:25 +00:00
Component : NextAppProps [ "Component" ] & {
requiresLicense? : boolean ;
2023-04-17 12:16:54 +00:00
isThemeSupported? : boolean ;
isBookingPage? : boolean | ( ( arg : { router : NextRouter } ) = > boolean ) ;
2022-09-02 19:00:41 +00:00
getLayout ? : ( page : React.ReactElement , router : NextRouter ) = > ReactNode ;
2023-04-18 18:45:32 +00:00
PageWrapper ? : ( props : AppProps ) = > JSX . Element ;
2022-07-28 10:50:25 +00:00
} ;
2023-02-06 22:50:08 +00:00
2021-10-20 16:00:11 +00:00
/** Will be defined only is there was an error */
err? : Error ;
} ;
type AppPropsWithChildren = AppProps & {
children : ReactNode ;
} ;
2023-07-18 01:02:42 +00:00
const getEmbedNamespace = ( query : ReturnType < typeof useRouter > [ "query" ] ) = > {
// Mostly embed query param should be available on server. Use that there.
// Use the most reliable detection on client
return typeof window !== "undefined" ? window . getEmbedNamespace ( ) : ( query . embed as string ) || null ;
} ;
2023-07-19 09:19:53 +00:00
// We dont need to pass nonce to the i18n provider - this was causing x2-x3 re-renders on a hard refresh
type AppPropsWithoutNonce = Omit < AppPropsWithChildren , " pageProps " > & {
pageProps : Omit < AppPropsWithChildren [ " pageProps " ] , " nonce " > ;
} ;
const CustomI18nextProvider = ( props : AppPropsWithoutNonce ) = > {
2022-07-18 18:59:51 +00:00
/ * *
* i18n should never be clubbed with other queries , so that it ' s caching can be managed independently .
* We intend to not cache i18n query
* * /
2023-04-27 10:55:26 +00:00
const { i18n , locale } = useViewerI18n ( ) . data ? ? {
2021-11-03 14:02:17 +00:00
locale : "en" ,
} ;
2021-10-20 16:00:11 +00:00
2021-10-14 10:57:49 +00:00
const passedProps = {
. . . props ,
2021-10-20 16:00:11 +00:00
pageProps : {
. . . props . pageProps ,
. . . i18n ,
} ,
router : locale ? { locale } : props . router ,
2021-10-14 10:57:49 +00:00
} as unknown as ComponentProps < typeof I18nextAdapter > ;
return < I18nextAdapter { ...passedProps } / > ;
} ;
2023-04-17 12:16:54 +00:00
const enum ThemeSupport {
// e.g. Login Page
None = "none" ,
// Entire App except Booking Pages
App = "systemOnly" ,
// Booking Pages(including Routing Forms)
Booking = "userConfigured" ,
}
2023-05-16 19:41:47 +00:00
type CalcomThemeProps = PropsWithChildren <
Pick < AppProps [ " pageProps " ] , " nonce " | " themeBasis " > &
Pick < AppProps [ " Component " ] , " isBookingPage " | " isThemeSupported " >
> ;
const CalcomThemeProvider = ( props : CalcomThemeProps ) = > {
2023-04-05 18:14:46 +00:00
const router = useRouter ( ) ;
2023-04-17 12:16:54 +00:00
2023-04-05 18:14:46 +00:00
// Use namespace of embed to ensure same namespaced embed are displayed with same theme. This allows different embeds on the same website to be themed differently
// One such example is our Embeds Demo and Testing page at http://localhost:3100
// Having `getEmbedNamespace` defined on window before react initializes the app, ensures that embedNamespace is available on the first mount and can be used as part of storageKey
2023-07-18 01:02:42 +00:00
const embedNamespace = getEmbedNamespace ( router . query ) ;
2023-04-12 11:16:59 +00:00
const isEmbedMode = typeof embedNamespace === "string" ;
2023-04-17 12:16:54 +00:00
2023-04-05 18:14:46 +00:00
return (
2023-05-16 19:41:47 +00:00
< ThemeProvider { ...getThemeProviderProps ( { props , isEmbedMode , embedNamespace , router } ) } >
2023-04-12 11:16:59 +00:00
{ /* Embed Mode can be detected reliably only on client side here as there can be static generated pages as well which can't determine if it's embed mode at backend */ }
{ /* color-scheme makes background:transparent not work in iframe which is required by embed. */ }
{ typeof window !== "undefined" && ! isEmbedMode && (
< style jsx global >
{ `
. dark {
color - scheme : dark ;
}
` }
< / style >
) }
2023-04-05 18:14:46 +00:00
{ props . children }
< / ThemeProvider >
) ;
} ;
2023-05-16 19:41:47 +00:00
/ * *
* The most important job for this fn is to generate correct storageKey for theme persistenc .
* ` storageKey ` is important because that key is listened for changes ( using [ ` storage ` ] ( https : //developer.mozilla.org/en-US/docs/Web/API/Window/storage_event) event) and any pages opened will change it's theme based on that(as part of next-themes implementation).
* Choosing the right storageKey avoids theme flickering caused by another page using different theme
* So , we handle all the cases here namely ,
* - Both Booking Pages , / f r e e / 3 0 m i n a n d / p r o / 3 0 m i n b u t c o n f i g u r e d w i t h d i f f e r e n t t h e m e s b u t b e i n g o p e r a t e d t o g e t h e r .
* - Embeds using different namespace . They can be completely themed different on the same page .
* - Embeds using the same namespace but showing different cal . com links with different themes
* - Embeds using the same namespace and showing same cal . com links with different themes ( Different theme is possible for same cal . com link in case of embed because of theme config available in embed )
* - App has different theme then Booking Pages .
*
* All the above cases have one thing in common , which is the origin and thus localStorage is shared and thus ` storageKey ` is critical to avoid theme flickering .
*
* Some things to note :
* - There is a side effect of so many factors in ` storageKey ` that many localStorage keys will be created if a user goes through all these scenarios ( e . g like booking a lot of different users )
* - Some might recommend disabling localStorage persistence but that doesn 't give good UX as then we would default to light theme always for a few seconds before switching to dark theme(if that' s the user ' s preference ) .
* - We can 't disable [`storage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/storage_event) event handling as well because changing theme in one tab won' t change the theme without refresh in other tabs . That ' s again a bad UX
* - Theme flickering becomes infinitely ongoing in case of embeds because of the browser ' s delay in processing ` storage ` event within iframes . Consider two embeds simulatenously opened with pages A and B . Note the timeline and keep in mind that it happened
* because 'setItem(A)' and 'Receives storageEvent(A)' allowed executing setItem ( B ) in b / w because of the delay .
* - t1 - > setItem ( A ) & Fires storageEvent ( A ) - On Page A ) - Current State ( A )
* - t2 - > setItem ( B ) & Fires storageEvent ( B ) - On Page B ) - Current State ( B )
* - t3 - > Receives storageEvent ( A ) & thus setItem ( A ) & thus fires storageEvent ( A ) ( On Page B ) - Current State ( A )
* - t4 - > Receives storageEvent ( B ) & thus setItem ( B ) & thus fires storageEvent ( B ) ( On Page A ) - Current State ( B )
* - . . . and so on . . .
* /
function getThemeProviderProps ( {
props ,
isEmbedMode ,
embedNamespace ,
router ,
} : {
props : Omit < CalcomThemeProps , " children " > ;
isEmbedMode : boolean ;
embedNamespace : string | null ;
router : NextRouter ;
} ) {
const isBookingPage = ( ( ) = > {
if ( typeof props . isBookingPage === "function" ) {
return props . isBookingPage ( { router : router } ) ;
}
return props . isBookingPage ;
} ) ( ) ;
const themeSupport = isBookingPage
? ThemeSupport . Booking
: // if isThemeSupported is explicitly false, we don't use theme there
props . isThemeSupported === false
? ThemeSupport . None
: ThemeSupport . App ;
2023-07-18 01:02:42 +00:00
const isBookingPageThemeSupportRequired = themeSupport === ThemeSupport . Booking ;
2023-05-16 19:41:47 +00:00
const themeBasis = props . themeBasis ;
2023-07-18 01:02:42 +00:00
if ( ( isBookingPageThemeSupportRequired || isEmbedMode ) && ! themeBasis ) {
2023-05-16 19:41:47 +00:00
console . warn (
"`themeBasis` is required for booking page theme support. Not providing it will cause theme flicker."
) ;
}
const appearanceIdSuffix = themeBasis ? ":" + themeBasis : "" ;
const forcedTheme = themeSupport === ThemeSupport . None ? "light" : undefined ;
let embedExplicitlySetThemeSuffix = "" ;
if ( typeof window !== "undefined" ) {
const embedTheme = window . getEmbedTheme ( ) ;
if ( embedTheme ) {
embedExplicitlySetThemeSuffix = ":" + embedTheme ;
}
}
const storageKey = isEmbedMode
? // Same Namespace, Same Organizer but different themes would still work seamless and not cause theme flicker
// Even though it's recommended to use different namespaces when you want to theme differently on the same page but if the embeds are on different pages, the problem can still arise
` embed-theme- ${ embedNamespace } ${ appearanceIdSuffix } ${ embedExplicitlySetThemeSuffix } `
: themeSupport === ThemeSupport . App
? "app-theme"
2023-07-18 01:02:42 +00:00
: isBookingPageThemeSupportRequired
2023-05-16 19:41:47 +00:00
? ` booking-theme ${ appearanceIdSuffix } `
: undefined ;
return {
storageKey ,
forcedTheme ,
themeSupport ,
nonce : props.nonce ,
enableColorScheme : false ,
enableSystem : themeSupport !== ThemeSupport . None ,
// next-themes doesn't listen to changes on storageKey. So we need to force a re-render when storageKey changes
// This is how login to dashboard soft navigation changes theme from light to dark
key : storageKey ,
attribute : "class" ,
} ;
}
2023-03-25 00:59:04 +00:00
function FeatureFlagsProvider ( { children } : { children : React.ReactNode } ) {
const flags = useFlags ( ) ;
return < FeatureProvider value = { flags } > { children } < / FeatureProvider > ;
}
feat: Organizations (#8993)
* Initial commit
* Adding feature flag
* feat: Orgs Schema Changing `scopedMembers` to `orgUsers` (#9209)
* Change scopedMembers to orgMembers
* Change to orgUsers
* Letting duplicate slugs for teams to support orgs
* Covering null on unique clauses
* Supporting having the orgId in the session cookie
* feat: organization event type filter (#9253)
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* Missing changes to support orgs schema changes
* feat: Onboarding process to create an organization (#9184)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* feedback
* Making sure we check requestedSlug now
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* feat: [CAL-1816] Organization subdomain support (#9345)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* Covering users and subteams, excluding non-org users
* Unpublished teams shows correctly
* Create subdomain in Vercel
* feedback
* Renaming Vercel env vars
* Vercel domain check before creation
* Supporting cal-staging.com
* Change to have vercel detect it
* vercel domain check data message error
* Remove check domain
* Making sure we check requestedSlug now
* Feedback and unneeded code
* Reverting unneeded changes
* Unneeded changes
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* Vercel subdomain creation in PROD only
* Making sure we let localhost still work
* Feedback
* Type check fixes
* feat: Organization branding in side menu (#9279)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Org branding provider used in shell sidebar
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Using org avatar (temp)
* Not showing org logo if not set
* User onboarding with org branding (slug)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* feedback
* Feedback
* Org public profile
* Public profiles for team event types
* Added setup profile alert
* Using org avatar on subteams avatar
* Making sure we show the set up profile on org only
* Profile username availability rely on org hook
* Update apps/web/pages/team/[slug].tsx
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* Update apps/web/pages/team/[slug].tsx
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* feat: Organization support for event types page (#9449)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Org branding provider used in shell sidebar
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Using org avatar (temp)
* Not showing org logo if not set
* User onboarding with org branding (slug)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* feedback
* Feedback
* Org public profile
* Public profiles for team event types
* Added setup profile alert
* Using org avatar on subteams avatar
* Processing orgs and children as profile options
* Reverting change not belonging to this PR
* Making sure we show the set up profile on org only
* Removing console.log
* Comparing memberships to choose the highest one
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* Type errors
* Refactor and type fixes
* Update orgDomains.ts
* Feedback
* Reverting
* NIT
* fix issue getting org slug from domain
* Improving orgDomains util
* Host comes with port
* Update useRouterQuery.ts
* Feedback
* Feedback
* Feedback
* Feedback: SSR for user event-types to have org context
* chore: Cache node_modules (#9492)
* Adding check for cache hit
* Adding a separate install step first
* Put the restore cache steps back
* Revert the uses type for restoring cache
* Added step to restore nm cache
* Removed the cache-hit check
* Comments and naming
* Removed extra install command
* Updated the name of the linting step to be more clear
* Removes the need for useEffect here
* Feedback
* Feedback
* Cookie domain needs a dot
* Type fix
* Update apps/web/public/static/locales/en/common.json
Co-authored-by: Omar López <zomars@me.com>
* Update packages/emails/src/templates/OrganizationAccountVerifyEmail.tsx
* Feedback
---------
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
Co-authored-by: Joe Au-Yeung <65426560+joeauyeung@users.noreply.github.com>
Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com>
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
Co-authored-by: zomars <zomars@me.com>
Co-authored-by: Efraín Rochín <roae.85@gmail.com>
Co-authored-by: Keith Williams <keithwillcode@gmail.com>
2023-06-14 21:40:20 +00:00
function OrgBrandProvider ( { children } : { children : React.ReactNode } ) {
const orgBrand = useOrgBrandingValues ( ) ;
return < OrgBrandingProvider value = { orgBrand } > { children } < / OrgBrandingProvider > ;
}
2021-10-20 16:00:11 +00:00
const AppProviders = ( props : AppPropsWithChildren ) = > {
2022-11-10 23:40:01 +00:00
const session = trpc . viewer . public . session . useQuery ( ) . data ;
2022-02-16 15:26:48 +00:00
// No need to have intercom on public pages - Good for Page Performance
const isPublicPage = usePublicPage ( ) ;
2023-07-19 09:19:53 +00:00
const { pageProps , . . . rest } = props ;
const { _nonce , . . . restPageProps } = pageProps ;
const propsWithoutNonce = {
pageProps : {
. . . restPageProps ,
} ,
. . . rest ,
} ;
2022-07-28 19:58:26 +00:00
2022-02-16 15:26:48 +00:00
const RemainingProviders = (
2022-07-28 19:58:26 +00:00
< EventCollectionProvider options = { { apiPath : "/api/collect-events" } } >
2022-09-02 23:55:12 +00:00
< SessionProvider session = { session || undefined } >
2023-07-19 09:19:53 +00:00
< CustomI18nextProvider { ...propsWithoutNonce } >
2022-09-02 23:55:12 +00:00
< TooltipProvider >
2023-04-19 20:55:40 +00:00
{ /* color-scheme makes background:transparent not work which is required by embed. We need to ensure next-theme adds color-scheme to `body` instead of `html`(https://github.com/pacocoursey/next-themes/blob/main/src/index.tsx#L74). Once that's done we can enable color-scheme support */ }
2023-04-05 18:14:46 +00:00
< CalcomThemeProvider
2023-05-16 19:41:47 +00:00
themeBasis = { props . pageProps . themeBasis }
2023-02-06 22:50:08 +00:00
nonce = { props . pageProps . nonce }
2023-04-17 12:16:54 +00:00
isThemeSupported = { props . Component . isThemeSupported }
isBookingPage = { props . Component . isBookingPage } >
2023-03-25 00:59:04 +00:00
< FeatureFlagsProvider >
feat: Organizations (#8993)
* Initial commit
* Adding feature flag
* feat: Orgs Schema Changing `scopedMembers` to `orgUsers` (#9209)
* Change scopedMembers to orgMembers
* Change to orgUsers
* Letting duplicate slugs for teams to support orgs
* Covering null on unique clauses
* Supporting having the orgId in the session cookie
* feat: organization event type filter (#9253)
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* Missing changes to support orgs schema changes
* feat: Onboarding process to create an organization (#9184)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* feedback
* Making sure we check requestedSlug now
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* feat: [CAL-1816] Organization subdomain support (#9345)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* Covering users and subteams, excluding non-org users
* Unpublished teams shows correctly
* Create subdomain in Vercel
* feedback
* Renaming Vercel env vars
* Vercel domain check before creation
* Supporting cal-staging.com
* Change to have vercel detect it
* vercel domain check data message error
* Remove check domain
* Making sure we check requestedSlug now
* Feedback and unneeded code
* Reverting unneeded changes
* Unneeded changes
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* Vercel subdomain creation in PROD only
* Making sure we let localhost still work
* Feedback
* Type check fixes
* feat: Organization branding in side menu (#9279)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Org branding provider used in shell sidebar
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Using org avatar (temp)
* Not showing org logo if not set
* User onboarding with org branding (slug)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* feedback
* Feedback
* Org public profile
* Public profiles for team event types
* Added setup profile alert
* Using org avatar on subteams avatar
* Making sure we show the set up profile on org only
* Profile username availability rely on org hook
* Update apps/web/pages/team/[slug].tsx
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* Update apps/web/pages/team/[slug].tsx
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* feat: Organization support for event types page (#9449)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Org branding provider used in shell sidebar
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Using org avatar (temp)
* Not showing org logo if not set
* User onboarding with org branding (slug)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* feedback
* Feedback
* Org public profile
* Public profiles for team event types
* Added setup profile alert
* Using org avatar on subteams avatar
* Processing orgs and children as profile options
* Reverting change not belonging to this PR
* Making sure we show the set up profile on org only
* Removing console.log
* Comparing memberships to choose the highest one
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* Type errors
* Refactor and type fixes
* Update orgDomains.ts
* Feedback
* Reverting
* NIT
* fix issue getting org slug from domain
* Improving orgDomains util
* Host comes with port
* Update useRouterQuery.ts
* Feedback
* Feedback
* Feedback
* Feedback: SSR for user event-types to have org context
* chore: Cache node_modules (#9492)
* Adding check for cache hit
* Adding a separate install step first
* Put the restore cache steps back
* Revert the uses type for restoring cache
* Added step to restore nm cache
* Removed the cache-hit check
* Comments and naming
* Removed extra install command
* Updated the name of the linting step to be more clear
* Removes the need for useEffect here
* Feedback
* Feedback
* Cookie domain needs a dot
* Type fix
* Update apps/web/public/static/locales/en/common.json
Co-authored-by: Omar López <zomars@me.com>
* Update packages/emails/src/templates/OrganizationAccountVerifyEmail.tsx
* Feedback
---------
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
Co-authored-by: Joe Au-Yeung <65426560+joeauyeung@users.noreply.github.com>
Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com>
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
Co-authored-by: zomars <zomars@me.com>
Co-authored-by: Efraín Rochín <roae.85@gmail.com>
Co-authored-by: Keith Williams <keithwillcode@gmail.com>
2023-06-14 21:40:20 +00:00
< OrgBrandProvider >
< MetaProvider > { props . children } < / MetaProvider >
< / OrgBrandProvider >
2023-03-25 00:59:04 +00:00
< / FeatureFlagsProvider >
2023-04-05 18:14:46 +00:00
< / CalcomThemeProvider >
2022-09-02 23:55:12 +00:00
< / TooltipProvider >
< / CustomI18nextProvider >
< / SessionProvider >
2022-07-28 19:58:26 +00:00
< / EventCollectionProvider >
2022-02-16 15:26:48 +00:00
) ;
2022-06-02 16:19:01 +00:00
if ( isPublicPage ) {
return RemainingProviders ;
}
2021-08-27 12:11:24 +00:00
return (
2022-06-02 16:19:01 +00:00
< DynamicHelpscoutProvider >
< DynamicIntercomProvider > { RemainingProviders } < / DynamicIntercomProvider >
< / DynamicHelpscoutProvider >
2021-08-27 12:11:24 +00:00
) ;
} ;
2021-09-30 12:28:30 +00:00
export default AppProviders ;