Scheduling infrastructure for absolutely everyone.
chore: bump atoms 1.0.35 and wrap context (#14744)
Morgan8fbb1ed42604
diff --git a/packages/platform/atoms/cal-provider/BaseCalProvider.tsx b/packages/platform/atoms/cal-provider/BaseCalProvider.tsxindex ae0aeab6e2f..7e7df6972d7 100644--- a/packages/platform/atoms/cal-provider/BaseCalProvider.tsx+++ b/packages/platform/atoms/cal-provider/BaseCalProvider.tsx@@ -62,6 +62,35 @@ export function BaseCalProvider({clientId,});+ const translations = {+ t: (key: string, values: Record<string, string | number | null | undefined>) => {+ let translation = String(enTranslations[key as translationKeys] ?? "");+ if (!translation) {+ return "";+ }+ if (values) {+ const valueKeys = Object.keys(values) as (keyof typeof values)[];+ if (valueKeys.length) {+ valueKeys.forEach((valueKey) => {+ if (translation)+ translation = translation.replace(+ `{{${String(valueKey)}}}`,+ values[valueKey]?.toString() ?? `{{${String(valueKey)}}}`+ );+ });+ }+ }++ return replaceOccurrences(translation, enTranslations) ?? "";+ },+ i18n: {+ language: "en",+ defaultLocale: "en",+ locales: ["en"],+ exists: (key: translationKeys | string) => Boolean(enTranslations[key as translationKeys]),+ },+ };+return isInit ? (<AtomsContext.Providervalue={{@@ -74,41 +103,29 @@ export function BaseCalProvider({isInit: isInit,isValidClient: Boolean(!error && clientId && isInit),isAuth: Boolean(isInit && !error && clientId && currentAccessToken && http.getAuthorizationHeader()),- t: (key, values) => {- let translation = String(enTranslations[key as translationKeys] ?? "");- if (!translation) {- return "";- }- if (values) {- const valueKeys = Object.keys(values) as (keyof typeof values)[];- if (valueKeys.length) {- valueKeys.forEach((valueKey) => {- if (translation)- translation = translation.replace(- `{{${String(valueKey)}}}`,- values[valueKey]?.toString() ?? `{{${String(valueKey)}}}`- );- });- }- }-- return replaceOccurrences(translation, enTranslations) ?? "";- },- i18n: {- language: "en",- defaultLocale: "en",- locales: ["en"],- exists: (key: translationKeys | string) => Boolean(enTranslations[key as translationKeys]),- },+ ...translations,}}><TooltipProvider>{children}</TooltipProvider><Toaster /></AtomsContext.Provider>) : (- <>- {children}- <Toaster />- </>+ <AtomsContext.Provider+ value={{+ clientId,+ options,+ error,+ getClient: () => http,+ isAuth: false,+ isValidClient: Boolean(!error && clientId),+ isInit: false,+ isRefreshing: false,+ ...translations,+ }}>+ <>+ <TooltipProvider>{children}</TooltipProvider>+ <Toaster />+ </>+ </AtomsContext.Provider>);}diff --git a/packages/platform/atoms/hooks/useAtomsContext.ts b/packages/platform/atoms/hooks/useAtomsContext.tsindex d963230a086..47a9c0d2d9b 100644--- a/packages/platform/atoms/hooks/useAtomsContext.ts+++ b/packages/platform/atoms/hooks/useAtomsContext.ts@@ -25,7 +25,7 @@ export interface IAtomsContext {i18n: {language: string;defaultLocale: string;- locales: [string];+ locales: string[];exists: (key: translationKeys | string) => boolean;};}diff --git a/packages/platform/atoms/package.json b/packages/platform/atoms/package.jsonindex 4bac3b990c0..d13c2c7ddaf 100644--- a/packages/platform/atoms/package.json+++ b/packages/platform/atoms/package.json@@ -4,7 +4,7 @@"type": "module","description": "Customizable UI components to integrate scheduling into your product.","authors": "Cal.com, Inc.",- "version": "1.0.30",+ "version": "1.0.35","scripts": {"dev": "yarn vite build --watch & npx tailwindcss -i ./globals.css -o ./globals.min.css --postcss --minify --watch","build": "yarn vite build && npx tailwindcss -i ./globals.css -o ./globals.min.css --postcss --minify",