2022-08-17 14:38:21 -03:00
import { TooltipProvider } from "@radix-ui/react-tooltip" ;
2023-10-16 13:29:35 -03:00
import { dir } from "i18next" ;
2023-08-07 18:19:14 -03:00
import type { Session } from "next-auth" ;
2023-08-18 21:46:17 -03:00
import { SessionProvider , useSession } from "next-auth/react" ;
2022-07-28 16:58:26 -03:00
import { EventCollectionProvider } from "next-collect/client" ;
2023-02-16 19:39:57 -03:00
import type { SSRConfig } from "next-i18next" ;
import { appWithTranslation } from "next-i18next" ;
2022-07-28 16:58:26 -03:00
import { ThemeProvider } from "next-themes" ;
2022-05-17 16:31:49 -03:00
import type { AppProps as NextAppProps , AppProps as NextJsAppProps } from "next/app" ;
2023-08-02 06:35:48 -03:00
import type { ParsedUrlQuery } from "querystring" ;
2023-10-10 13:36:28 -03:00
import type { PropsWithChildren , ReactNode } from "react" ;
2023-10-13 14:27:10 -03:00
import { useEffect } from "react" ;
2021-08-27 09:11:24 -03: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 18:40:20 -03:00
import { OrgBrandingProvider } from "@calcom/features/ee/organizations/context/provider" ;
2022-07-28 16:58:26 -03:00
import DynamicHelpscoutProvider from "@calcom/features/ee/support/lib/helpscout/providerDynamic" ;
import DynamicIntercomProvider from "@calcom/features/ee/support/lib/intercom/providerDynamic" ;
2023-03-24 21:59:04 -03:00
import { FeatureProvider } from "@calcom/features/flags/context/provider" ;
import { useFlags } from "@calcom/features/flags/hooks" ;
2022-11-22 23:55:25 -03:00
import { MetaProvider } from "@calcom/ui" ;
2021-09-24 17:02:03 -03:00
2023-08-09 05:55:27 -03:00
import useIsBookingPage from "@lib/hooks/useIsBookingPage" ;
2023-10-10 13:36:28 -03:00
import type { WithLocaleProps } from "@lib/withLocale" ;
2023-02-16 19:39:57 -03:00
import type { WithNonceProps } from "@lib/withNonce" ;
2021-09-22 16:52:38 -03:00
2023-10-10 13:36:28 -03:00
import { useViewerI18n } from "@components/I18nLanguageHandler" ;
2023-04-27 07:55:26 -03:00
2023-08-02 06:35:48 -03:00
const I18nextAdapter = appWithTranslation <
NextJsAppProps < SSRConfig > & {
children : React.ReactNode ;
}
> ( ( { children } ) = > < > { children } < / > ) ;
2021-10-14 07:57:49 -03:00
2021-10-20 13:00:11 -03:00
// Workaround for https://github.com/vercel/next.js/issues/8592
2023-05-16 16:41:47 -03:00
export type AppProps = Omit <
2023-08-02 06:35:48 -03:00
NextAppProps <
2023-10-10 13:36:28 -03:00
WithLocaleProps <
WithNonceProps < {
themeBasis? : string ;
session : Session ;
} >
>
2023-08-02 06:35:48 -03:00
> ,
2023-05-16 16:41:47 -03:00
"Component"
> & {
2022-07-28 07:50:25 -03:00
Component : NextAppProps [ "Component" ] & {
requiresLicense? : boolean ;
2023-04-17 09:16:54 -03:00
isThemeSupported? : boolean ;
2023-08-02 06:35:48 -03:00
isBookingPage? : boolean | ( ( arg : { router : NextAppProps [ "router" ] } ) = > boolean ) ;
getLayout ? : ( page : React.ReactElement , router : NextAppProps [ "router" ] ) = > ReactNode ;
2023-04-18 15:45:32 -03:00
PageWrapper ? : ( props : AppProps ) = > JSX . Element ;
2022-07-28 07:50:25 -03:00
} ;
2023-02-06 19:50:08 -03:00
2021-10-20 13:00:11 -03:00
/** Will be defined only is there was an error */
err? : Error ;
} ;
type AppPropsWithChildren = AppProps & {
children : ReactNode ;
} ;
2023-08-02 06:35:48 -03:00
const getEmbedNamespace = ( query : ParsedUrlQuery ) = > {
2023-07-17 22:02:42 -03:00
// 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 06:19:53 -03: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 15:59:51 -03:00
/ * *
* i18n should never be clubbed with other queries , so that it ' s caching can be managed independently .
* * /
2023-10-11 12:15:11 -03:00
const session = useSession ( ) ;
const locale = session ? . data ? . user . locale ? ? props . pageProps . newLocale ;
2023-10-13 14:27:10 -03:00
useEffect ( ( ) = > {
try {
2023-10-16 13:29:35 -03:00
// @ts-expect-error TS2790: The operand of a 'delete' operator must be optional.
delete window . document . documentElement [ "lang" ] ;
window . document . documentElement . lang = locale ;
// Next.js writes the locale to the same attribute
// https://github.com/vercel/next.js/blob/1609da2d9552fed48ab45969bdc5631230c6d356/packages/next/src/shared/lib/router/router.ts#L1786
// which can result in a race condition
// this property descriptor ensures this never happens
Object . defineProperty ( window . document . documentElement , "lang" , {
configurable : true ,
// value: locale,
set : function ( this ) {
// empty setter on purpose
} ,
get : function ( ) {
return locale ;
} ,
} ) ;
2023-10-13 14:27:10 -03:00
} catch ( error ) {
console . error ( error ) ;
2023-10-16 13:29:35 -03:00
window . document . documentElement . lang = locale ;
2023-10-13 14:27:10 -03:00
}
2023-10-16 13:29:35 -03:00
window . document . dir = dir ( locale ) ;
2023-10-13 14:27:10 -03:00
} , [ locale ] ) ;
2023-10-11 12:15:11 -03:00
const clientViewerI18n = useViewerI18n ( locale ) ;
2023-10-10 13:36:28 -03:00
const i18n = clientViewerI18n . data ? . i18n ;
2021-10-20 13:00:11 -03:00
2021-10-14 07:57:49 -03:00
const passedProps = {
. . . props ,
2021-10-20 13:00:11 -03:00
pageProps : {
. . . props . pageProps ,
2023-10-13 14:27:10 -03:00
2021-10-20 13:00:11 -03:00
. . . i18n ,
} ,
2023-10-10 13:36:28 -03:00
} ;
2023-08-07 18:19:14 -03:00
2021-10-14 07:57:49 -03:00
return < I18nextAdapter { ...passedProps } / > ;
} ;
2023-04-17 09:16:54 -03: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 16:41:47 -03:00
type CalcomThemeProps = PropsWithChildren <
2023-08-02 06:35:48 -03:00
Pick < AppProps , " router " > &
Pick < AppProps [ " pageProps " ] , " nonce " | " themeBasis " > &
2023-05-16 16:41:47 -03:00
Pick < AppProps [ " Component " ] , " isBookingPage " | " isThemeSupported " >
> ;
const CalcomThemeProvider = ( props : CalcomThemeProps ) = > {
2023-04-05 15:14:46 -03: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-08-02 06:35:48 -03:00
const embedNamespace = getEmbedNamespace ( props . router . query ) ;
2023-04-12 08:16:59 -03:00
const isEmbedMode = typeof embedNamespace === "string" ;
2023-04-17 09:16:54 -03:00
2023-04-05 15:14:46 -03:00
return (
2023-08-02 06:35:48 -03:00
< ThemeProvider { ...getThemeProviderProps ( { props , isEmbedMode , embedNamespace } ) } >
2023-04-12 08:16:59 -03: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 15:14:46 -03:00
{ props . children }
< / ThemeProvider >
) ;
} ;
2023-05-16 16:41:47 -03: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 ,
} : {
props : Omit < CalcomThemeProps , " children " > ;
isEmbedMode : boolean ;
embedNamespace : string | null ;
} ) {
const isBookingPage = ( ( ) = > {
if ( typeof props . isBookingPage === "function" ) {
2023-08-02 06:35:48 -03:00
return props . isBookingPage ( { router : props.router } ) ;
2023-05-16 16:41:47 -03:00
}
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-17 22:02:42 -03:00
const isBookingPageThemeSupportRequired = themeSupport === ThemeSupport . Booking ;
2023-05-16 16:41:47 -03:00
const themeBasis = props . themeBasis ;
2023-07-17 22:02:42 -03:00
if ( ( isBookingPageThemeSupportRequired || isEmbedMode ) && ! themeBasis ) {
2023-05-16 16:41:47 -03:00
console . warn (
"`themeBasis` is required for booking page theme support. Not providing it will cause theme flicker."
) ;
}
2023-10-03 15:52:19 -03:00
const appearanceIdSuffix = themeBasis ? ` : ${ themeBasis } ` : "" ;
2023-05-16 16:41:47 -03:00
const forcedTheme = themeSupport === ThemeSupport . None ? "light" : undefined ;
let embedExplicitlySetThemeSuffix = "" ;
if ( typeof window !== "undefined" ) {
const embedTheme = window . getEmbedTheme ( ) ;
if ( embedTheme ) {
2023-10-03 15:52:19 -03:00
embedExplicitlySetThemeSuffix = ` : ${ embedTheme } ` ;
2023-05-16 16:41:47 -03:00
}
}
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-17 22:02:42 -03:00
: isBookingPageThemeSupportRequired
2023-05-16 16:41:47 -03: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-24 21:59:04 -03:00
function FeatureFlagsProvider ( { children } : { children : React.ReactNode } ) {
const flags = useFlags ( ) ;
return < FeatureProvider value = { flags } > { children } < / FeatureProvider > ;
}
2023-07-24 07:25:55 -03:00
function useOrgBrandingValues() {
const session = useSession ( ) ;
2023-09-07 21:21:04 -03:00
return session ? . data ? . user . org ;
2023-07-24 07:25:55 -03: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 18:40:20 -03:00
function OrgBrandProvider ( { children } : { children : React.ReactNode } ) {
const orgBrand = useOrgBrandingValues ( ) ;
2023-07-24 07:25:55 -03:00
return < OrgBrandingProvider value = { { orgBrand } } > { children } < / OrgBrandingProvider > ;
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 18:40:20 -03:00
}
2021-10-20 13:00:11 -03:00
const AppProviders = ( props : AppPropsWithChildren ) = > {
2022-02-16 12:26:48 -03:00
// No need to have intercom on public pages - Good for Page Performance
2023-08-09 05:55:27 -03:00
const isBookingPage = useIsBookingPage ( ) ;
2023-07-19 06:19:53 -03:00
const { pageProps , . . . rest } = props ;
2023-10-10 13:36:28 -03:00
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { nonce , . . . restPageProps } = pageProps ;
2023-07-19 06:19:53 -03:00
const propsWithoutNonce = {
pageProps : {
. . . restPageProps ,
} ,
. . . rest ,
} ;
2022-07-28 16:58:26 -03:00
2022-02-16 12:26:48 -03:00
const RemainingProviders = (
2022-07-28 16:58:26 -03:00
< EventCollectionProvider options = { { apiPath : "/api/collect-events" } } >
2023-10-11 12:15:11 -03:00
< SessionProvider session = { pageProps . session ? ? undefined } >
< CustomI18nextProvider { ...propsWithoutNonce } >
2022-09-02 20:55:12 -03:00
< TooltipProvider >
2023-04-19 17:55:40 -03: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 15:14:46 -03:00
< CalcomThemeProvider
2023-05-16 16:41:47 -03:00
themeBasis = { props . pageProps . themeBasis }
2023-02-06 19:50:08 -03:00
nonce = { props . pageProps . nonce }
2023-04-17 09:16:54 -03:00
isThemeSupported = { props . Component . isThemeSupported }
2023-08-09 05:55:27 -03:00
isBookingPage = { props . Component . isBookingPage || isBookingPage }
2023-08-02 06:35:48 -03:00
router = { props . router } >
2023-03-24 21:59:04 -03: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 18:40:20 -03:00
< OrgBrandProvider >
< MetaProvider > { props . children } < / MetaProvider >
< / OrgBrandProvider >
2023-03-24 21:59:04 -03:00
< / FeatureFlagsProvider >
2023-04-05 15:14:46 -03:00
< / CalcomThemeProvider >
2022-09-02 20:55:12 -03:00
< / TooltipProvider >
2023-10-11 12:15:11 -03:00
< / CustomI18nextProvider >
< / SessionProvider >
2022-07-28 16:58:26 -03:00
< / EventCollectionProvider >
2022-02-16 12:26:48 -03:00
) ;
2022-06-02 13:19:01 -03:00
2023-08-09 05:55:27 -03:00
if ( isBookingPage ) {
2022-06-02 13:19:01 -03:00
return RemainingProviders ;
}
2021-08-27 09:11:24 -03:00
return (
2022-06-02 13:19:01 -03:00
< DynamicHelpscoutProvider >
< DynamicIntercomProvider > { RemainingProviders } < / DynamicIntercomProvider >
< / DynamicHelpscoutProvider >
2021-08-27 09:11:24 -03:00
) ;
} ;
2021-09-30 09:28:30 -03:00
export default AppProviders ;