@multiplatform.one/core 7.85.0 → 7.85.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/app/CreateRootLayout.cjs +9 -3
- package/dist/esm/app/CreateRootLayout.mjs +9 -3
- package/dist/esm/app/CreateRootLayout.mjs.map +1 -1
- package/package.json +12 -12
- package/src/app/CreateRootLayout.sentry.spec.tsx +95 -0
- package/src/app/CreateRootLayout.web.tsx +7 -4
- package/src/app/rootLayoutShared.ts +18 -3
- package/types/app/CreateRootLayout.web.d.ts.map +1 -1
- package/types/app/rootLayoutShared.d.ts +18 -3
- package/types/app/rootLayoutShared.d.ts.map +1 -1
|
@@ -63,12 +63,18 @@ function createRootLayout(cfg) {
|
|
|
63
63
|
}
|
|
64
64
|
import_i18next.default.use(import_react_i18next.initReactI18next).init((0, import_i18n.createI18nConfig)(cfg.i18n)).catch(import_logger.logger.error);
|
|
65
65
|
import_i18next.default.changeLanguage(import_platform.config.get("I18N_DEFAULT_LANGUAGE", cfg.i18n.defaultLanguage));
|
|
66
|
-
const
|
|
66
|
+
const sentryConfig = cfg.sentry || {};
|
|
67
|
+
const {
|
|
68
|
+
dsn,
|
|
69
|
+
...sentryOptions
|
|
70
|
+
} = sentryConfig;
|
|
71
|
+
const sentryDsn = cfg.sentry === false ? void 0 : dsn || import_platform.config.get("SENTRY_DSN");
|
|
67
72
|
if (sentryDsn && !import_platform.platform.isServer) {
|
|
68
73
|
import("@sentry/react").then(Sentry => {
|
|
69
74
|
Sentry.init({
|
|
70
|
-
|
|
71
|
-
|
|
75
|
+
enabled: !import_platform.isDev,
|
|
76
|
+
...sentryOptions,
|
|
77
|
+
dsn: sentryDsn
|
|
72
78
|
});
|
|
73
79
|
}).catch(() => {});
|
|
74
80
|
}
|
|
@@ -25,12 +25,18 @@ function createRootLayout(cfg) {
|
|
|
25
25
|
}
|
|
26
26
|
i18n.use(initReactI18next).init(createI18nConfig(cfg.i18n)).catch(logger.error);
|
|
27
27
|
i18n.changeLanguage(config.get("I18N_DEFAULT_LANGUAGE", cfg.i18n.defaultLanguage));
|
|
28
|
-
const
|
|
28
|
+
const sentryConfig = cfg.sentry || {};
|
|
29
|
+
const {
|
|
30
|
+
dsn,
|
|
31
|
+
...sentryOptions
|
|
32
|
+
} = sentryConfig;
|
|
33
|
+
const sentryDsn = cfg.sentry === false ? void 0 : dsn || config.get("SENTRY_DSN");
|
|
29
34
|
if (sentryDsn && !platform.isServer) {
|
|
30
35
|
import("@sentry/react").then(Sentry => {
|
|
31
36
|
Sentry.init({
|
|
32
|
-
|
|
33
|
-
|
|
37
|
+
enabled: !isDev,
|
|
38
|
+
...sentryOptions,
|
|
39
|
+
dsn: sentryDsn
|
|
34
40
|
});
|
|
35
41
|
}).catch(() => {});
|
|
36
42
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["i18n","useDidFinishSSR","LoadProgressBar","SchemeProvider","Slot","setUserScheme","useMatches","useUserScheme","useState","CookiesProvider","Cookies","initReactI18next","config","isDev","platform","createI18nConfig","logger","storage","cookiePreset","scaleAttributeFromCookie","scaleAttributeScript","RuntimePublicConfigScript","Fragment","jsx","jsxs","createRootLayout","cfg","window","storedValue","getItem","stored","use","init","catch","error","changeLanguage","get","defaultLanguage","sentryDsn","sentry","dsn","isServer","then","Sentry","enabled","AppProvider","RootLayout","WebRootProvider","children","value","scheme","hydrated","systemTheme","displayName","Layout","matches","rootLoaderData","loaderData","ssrCookies","cookieHeader","clientScale","presetScale","htmlLang","detectedLanguage","language","interFonts","head","interFontCss","join","lang","suppressHydrationWarning","charSet","dangerouslySetInnerHTML","__html","rel","href","as","type","crossOrigin","precedence","name","content","httpEquiv","title","favicon","cookies","ssrSession","session"],"sources":["CreateRootLayout.mjs"],"sourcesContent":["import i18n from \"i18next\";\nimport { useDidFinishSSR } from \"tamagui\";\nimport {\n LoadProgressBar,\n SchemeProvider,\n Slot,\n setUserScheme,\n useMatches,\n useUserScheme\n} from \"one\";\nimport { useState } from \"react\";\nimport { CookiesProvider, Cookies } from \"react-cookie\";\nimport { initReactI18next } from \"react-i18next\";\nimport { config, isDev, platform } from \"@multiplatform.one/platform\";\nimport { createI18nConfig } from \"@multiplatform.one/i18n\";\nimport { logger } from \"@multiplatform.one/logger\";\nimport { storage } from \"@multiplatform.one/store\";\nimport {\n cookiePreset,\n scaleAttributeFromCookie,\n scaleAttributeScript\n} from \"@multiplatform.one/theme/scale-attribute\";\nimport { RuntimePublicConfigScript } from \"./RuntimePublicConfigScript\";\nimport { Fragment, jsx, jsxs } from \"react/jsx-runtime\";\nfunction createRootLayout(cfg) {\n if (typeof window !== \"undefined\") {\n try {\n const storedValue = storage.getItem(\"vxrn-scheme\");\n const stored = typeof storedValue === \"string\" || storedValue === null ? storedValue : null;\n if (stored === \"light\" || stored === \"dark\" || stored === \"system\") {\n setUserScheme(stored);\n } else {\n setUserScheme(\"system\");\n }\n } catch {\n }\n }\n i18n.use(initReactI18next).init(createI18nConfig(cfg.i18n)).catch(logger.error);\n i18n.changeLanguage(config.get(\"I18N_DEFAULT_LANGUAGE\", cfg.i18n.defaultLanguage));\n const sentryDsn = cfg.sentry?.dsn || config.get(\"SENTRY_DSN\");\n if (sentryDsn && !platform.isServer) {\n import(\"@sentry/react\").then((Sentry) => {\n Sentry.init({\n dsn: sentryDsn,\n enabled: !isDev\n });\n }).catch(() => {\n });\n }\n const { AppProvider, RootLayout } = cfg;\n function WebRootProvider({ children }) {\n const { value: scheme } = useUserScheme();\n const hydrated = useDidFinishSSR();\n return /* @__PURE__ */ jsx(AppProvider, { systemTheme: hydrated ? scheme : \"light\", children });\n }\n WebRootProvider.displayName = \"WebRootProvider\";\n function Layout() {\n const matches = useMatches();\n const rootLoaderData = matches?.[0]?.loaderData;\n const ssrCookies = platform.isServer && rootLoaderData?.cookieHeader ? new Cookies(rootLoaderData.cookieHeader) : void 0;\n const [clientScale] = useState(\n () => platform.isServer ? void 0 : scaleAttributeFromCookie(new Cookies().get(cookiePreset))\n );\n const presetScale = ssrCookies ? scaleAttributeFromCookie(ssrCookies.get(cookiePreset)) : clientScale;\n const htmlLang = rootLoaderData?.detectedLanguage || i18n.language || cfg.i18n.defaultLanguage || \"en\";\n if (platform.isServer && rootLoaderData?.detectedLanguage && i18n.language !== rootLoaderData.detectedLanguage) {\n i18n.changeLanguage(rootLoaderData.detectedLanguage);\n }\n const interFonts = cfg.head?.interFonts !== false;\n const interFontCss = [\n '@font-face{font-family:\"Inter\";font-style:normal;font-weight:400;font-display:optional;src:url(\"/fonts/inter-400.woff2\") format(\"woff2\")}',\n '@font-face{font-family:\"Inter\";font-style:normal;font-weight:500;font-display:optional;src:url(\"/fonts/inter-500.woff2\") format(\"woff2\")}',\n '@font-face{font-family:\"Inter\";font-style:normal;font-weight:600;font-display:optional;src:url(\"/fonts/inter-600.woff2\") format(\"woff2\")}',\n '@font-face{font-family:\"Inter\";font-style:normal;font-weight:700;font-display:optional;src:url(\"/fonts/inter-700.woff2\") format(\"woff2\")}',\n '@font-face{font-family:\"Inter\";font-style:normal;font-weight:800;font-display:optional;src:url(\"/fonts/inter-800.woff2\") format(\"woff2\")}'\n ].join(\"\");\n return /* @__PURE__ */ jsxs(\"html\", { lang: htmlLang, \"data-mp-scale\": presetScale, suppressHydrationWarning: true, children: [\n /* @__PURE__ */ jsxs(\"head\", { children: [\n /* @__PURE__ */ jsx(\"meta\", { charSet: \"utf-8\" }),\n /* @__PURE__ */ jsx(\n \"script\",\n {\n dangerouslySetInnerHTML: { __html: scaleAttributeScript },\n suppressHydrationWarning: true\n }\n ),\n /* @__PURE__ */ jsx(RuntimePublicConfigScript, {}),\n interFonts && /* @__PURE__ */ jsxs(Fragment, { children: [\n /* @__PURE__ */ jsx(\n \"link\",\n {\n rel: \"preload\",\n href: \"/fonts/inter-400.woff2\",\n as: \"font\",\n type: \"font/woff2\",\n crossOrigin: \"\"\n }\n ),\n /* @__PURE__ */ jsx(\n \"link\",\n {\n rel: \"preload\",\n href: \"/fonts/inter-600.woff2\",\n as: \"font\",\n type: \"font/woff2\",\n crossOrigin: \"\"\n }\n ),\n /* @__PURE__ */ jsx(\n \"link\",\n {\n rel: \"preload\",\n href: \"/fonts/inter-700.woff2\",\n as: \"font\",\n type: \"font/woff2\",\n crossOrigin: \"\"\n }\n ),\n /* @__PURE__ */ jsx(\n \"link\",\n {\n rel: \"preload\",\n href: \"/fonts/inter-800.woff2\",\n as: \"font\",\n type: \"font/woff2\",\n crossOrigin: \"\"\n }\n ),\n /* @__PURE__ */ jsx(\"style\", { precedence: \"reset\", href: \"__font_inter\", children: interFontCss })\n ] }),\n /* @__PURE__ */ jsx(\"style\", { precedence: \"reset\", href: \"__critical_reset\", children: [\n \"html{max-width:100vw;color-scheme:light dark}\",\n \"body{overflow-x:hidden;margin:0;display:flex;flex-direction:column;min-width:100%;min-height:100vh}\",\n \"#root,#__next{display:flex;flex-direction:column;min-width:100%;min-height:100vh}\",\n \"*{box-sizing:border-box}\",\n \"a{color:inherit;text-decoration:none}\",\n \"h1,h2,h3,h4,h5,h6{margin:0;padding:0}\",\n \"p,input,textarea,button,ul,ol,li,pre,dialog{all:unset;box-sizing:border-box}\"\n ].join(\"\") }),\n /* @__PURE__ */ jsx(\"meta\", { name: \"viewport\", content: \"width=device-width, initial-scale=1, maximum-scale=5\" }),\n cfg.head && /* @__PURE__ */ jsxs(Fragment, { children: [\n /* @__PURE__ */ jsx(\"meta\", { httpEquiv: \"X-UA-Compatible\", content: \"IE=edge\" }),\n cfg.head.title && /* @__PURE__ */ jsx(\"title\", { children: cfg.head.title }),\n cfg.head.favicon && /* @__PURE__ */ jsx(\"link\", { rel: \"icon\", href: cfg.head.favicon })\n ] })\n ] }),\n /* @__PURE__ */ jsxs(\"body\", { children: [\n /* @__PURE__ */ jsx(LoadProgressBar, {}),\n /* @__PURE__ */ jsx(SchemeProvider, { children: /* @__PURE__ */ jsx(CookiesProvider, { cookies: ssrCookies, children: /* @__PURE__ */ jsx(WebRootProvider, { children: /* @__PURE__ */ jsx(RootLayout, { ssrSession: rootLoaderData?.session, children: /* @__PURE__ */ jsx(Slot, {}) }) }) }) })\n ] })\n ] });\n }\n Layout.displayName = \"RootLayout\";\n return Layout;\n}\nexport {\n createRootLayout\n};\n//# sourceMappingURL=CreateRootLayout.web.js.map\n"],"mappings":"AAAA,OAAOA,IAAI,MAAM,SAAS;AAC1B,SAASC,eAAe,QAAQ,SAAS;AACzC,SACEC,eAAe,EACfC,cAAc,EACdC,IAAI,EACJC,aAAa,EACbC,UAAU,EACVC,aAAa,QACR,KAAK;AACZ,SAASC,QAAQ,QAAQ,OAAO;AAChC,SAASC,eAAe,EAAEC,OAAO,QAAQ,cAAc;AACvD,SAASC,gBAAgB,QAAQ,eAAe;AAChD,SAASC,MAAM,EAAEC,KAAK,EAAEC,QAAQ,QAAQ,6BAA6B;AACrE,SAASC,gBAAgB,QAAQ,yBAAyB;AAC1D,SAASC,MAAM,QAAQ,2BAA2B;AAClD,SAASC,OAAO,QAAQ,0BAA0B;AAClD,SACEC,YAAY,EACZC,wBAAwB,EACxBC,oBAAoB,QACf,0CAA0C;AACjD,SAASC,yBAAyB,QAAQ,iCAA6B;AACvE,SAASC,QAAQ,EAAEC,GAAG,EAAEC,IAAI,QAAQ,mBAAmB;AACvD,SAASC,gBAAgBA,CAACC,GAAG,EAAE;EAC7B,IAAI,OAAOC,MAAM,KAAK,WAAW,EAAE;IACjC,IAAI;MACF,MAAMC,WAAW,GAAGX,OAAO,CAACY,OAAO,CAAC,aAAa,CAAC;MAClD,MAAMC,MAAM,GAAG,OAAOF,WAAW,KAAK,QAAQ,IAAIA,WAAW,KAAK,IAAI,GAAGA,WAAW,GAAG,IAAI;MAC3F,IAAIE,MAAM,KAAK,OAAO,IAAIA,MAAM,KAAK,MAAM,IAAIA,MAAM,KAAK,QAAQ,EAAE;QAClEzB,aAAa,CAACyB,MAAM,CAAC;MACvB,CAAC,MAAM;QACLzB,aAAa,CAAC,QAAQ,CAAC;MACzB;IACF,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,UAAU,EAAE;gBAAEwC,UAAU,EAAE9B,cAAc,EAAE+B,OAAO;gBAAEvC,QAAQ,EAAE,eAAgBzB,GAAG,CAACnB,IAAI,EAAE,CAAC,CAAC;cAAE,CAAC;YAAE,CAAC;UAAE,CAAC;QAAE,CAAC,CAAC;MACjS,CAAC,CAAC;IACJ,CAAC,CAAC;EACN;EACAkD,MAAM,CAACD,WAAW,GAAG,YAAY;EACjC,OAAOC,MAAM;AACf;AACA,SACE7B,gBAAgB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["i18n","useDidFinishSSR","LoadProgressBar","SchemeProvider","Slot","setUserScheme","useMatches","useUserScheme","useState","CookiesProvider","Cookies","initReactI18next","config","isDev","platform","createI18nConfig","logger","storage","cookiePreset","scaleAttributeFromCookie","scaleAttributeScript","RuntimePublicConfigScript","Fragment","jsx","jsxs","createRootLayout","cfg","window","storedValue","getItem","stored","use","init","catch","error","changeLanguage","get","defaultLanguage","sentryConfig","sentry","dsn","sentryOptions","sentryDsn","isServer","then","Sentry","enabled","AppProvider","RootLayout","WebRootProvider","children","value","scheme","hydrated","systemTheme","displayName","Layout","matches","rootLoaderData","loaderData","ssrCookies","cookieHeader","clientScale","presetScale","htmlLang","detectedLanguage","language","interFonts","head","interFontCss","join","lang","suppressHydrationWarning","charSet","dangerouslySetInnerHTML","__html","rel","href","as","type","crossOrigin","precedence","name","content","httpEquiv","title","favicon","cookies","ssrSession","session"],"sources":["CreateRootLayout.mjs"],"sourcesContent":["import i18n from \"i18next\";\nimport { useDidFinishSSR } from \"tamagui\";\nimport {\n LoadProgressBar,\n SchemeProvider,\n Slot,\n setUserScheme,\n useMatches,\n useUserScheme\n} from \"one\";\nimport { useState } from \"react\";\nimport { CookiesProvider, Cookies } from \"react-cookie\";\nimport { initReactI18next } from \"react-i18next\";\nimport { config, isDev, platform } from \"@multiplatform.one/platform\";\nimport { createI18nConfig } from \"@multiplatform.one/i18n\";\nimport { logger } from \"@multiplatform.one/logger\";\nimport { storage } from \"@multiplatform.one/store\";\nimport {\n cookiePreset,\n scaleAttributeFromCookie,\n scaleAttributeScript\n} from \"@multiplatform.one/theme/scale-attribute\";\nimport { RuntimePublicConfigScript } from \"./RuntimePublicConfigScript\";\nimport { Fragment, jsx, jsxs } from \"react/jsx-runtime\";\nfunction createRootLayout(cfg) {\n if (typeof window !== \"undefined\") {\n try {\n const storedValue = storage.getItem(\"vxrn-scheme\");\n const stored = typeof storedValue === \"string\" || storedValue === null ? storedValue : null;\n if (stored === \"light\" || stored === \"dark\" || stored === \"system\") {\n setUserScheme(stored);\n } else {\n setUserScheme(\"system\");\n }\n } catch {\n }\n }\n i18n.use(initReactI18next).init(createI18nConfig(cfg.i18n)).catch(logger.error);\n i18n.changeLanguage(config.get(\"I18N_DEFAULT_LANGUAGE\", cfg.i18n.defaultLanguage));\n const sentryConfig = cfg.sentry || {};\n const { dsn, ...sentryOptions } = sentryConfig;\n const sentryDsn = cfg.sentry === false ? void 0 : dsn || config.get(\"SENTRY_DSN\");\n if (sentryDsn && !platform.isServer) {\n import(\"@sentry/react\").then((Sentry) => {\n Sentry.init({\n enabled: !isDev,\n ...sentryOptions,\n dsn: sentryDsn\n });\n }).catch(() => {\n });\n }\n const { AppProvider, RootLayout } = cfg;\n function WebRootProvider({ children }) {\n const { value: scheme } = useUserScheme();\n const hydrated = useDidFinishSSR();\n return /* @__PURE__ */ jsx(AppProvider, { systemTheme: hydrated ? scheme : \"light\", children });\n }\n WebRootProvider.displayName = \"WebRootProvider\";\n function Layout() {\n const matches = useMatches();\n const rootLoaderData = matches?.[0]?.loaderData;\n const ssrCookies = platform.isServer && rootLoaderData?.cookieHeader ? new Cookies(rootLoaderData.cookieHeader) : void 0;\n const [clientScale] = useState(\n () => platform.isServer ? void 0 : scaleAttributeFromCookie(new Cookies().get(cookiePreset))\n );\n const presetScale = ssrCookies ? scaleAttributeFromCookie(ssrCookies.get(cookiePreset)) : clientScale;\n const htmlLang = rootLoaderData?.detectedLanguage || i18n.language || cfg.i18n.defaultLanguage || \"en\";\n if (platform.isServer && rootLoaderData?.detectedLanguage && i18n.language !== rootLoaderData.detectedLanguage) {\n i18n.changeLanguage(rootLoaderData.detectedLanguage);\n }\n const interFonts = cfg.head?.interFonts !== false;\n const interFontCss = [\n '@font-face{font-family:\"Inter\";font-style:normal;font-weight:400;font-display:optional;src:url(\"/fonts/inter-400.woff2\") format(\"woff2\")}',\n '@font-face{font-family:\"Inter\";font-style:normal;font-weight:500;font-display:optional;src:url(\"/fonts/inter-500.woff2\") format(\"woff2\")}',\n '@font-face{font-family:\"Inter\";font-style:normal;font-weight:600;font-display:optional;src:url(\"/fonts/inter-600.woff2\") format(\"woff2\")}',\n '@font-face{font-family:\"Inter\";font-style:normal;font-weight:700;font-display:optional;src:url(\"/fonts/inter-700.woff2\") format(\"woff2\")}',\n '@font-face{font-family:\"Inter\";font-style:normal;font-weight:800;font-display:optional;src:url(\"/fonts/inter-800.woff2\") format(\"woff2\")}'\n ].join(\"\");\n return /* @__PURE__ */ jsxs(\"html\", { lang: htmlLang, \"data-mp-scale\": presetScale, suppressHydrationWarning: true, children: [\n /* @__PURE__ */ jsxs(\"head\", { children: [\n /* @__PURE__ */ jsx(\"meta\", { charSet: \"utf-8\" }),\n /* @__PURE__ */ jsx(\n \"script\",\n {\n dangerouslySetInnerHTML: { __html: scaleAttributeScript },\n suppressHydrationWarning: true\n }\n ),\n /* @__PURE__ */ jsx(RuntimePublicConfigScript, {}),\n interFonts && /* @__PURE__ */ jsxs(Fragment, { children: [\n /* @__PURE__ */ jsx(\n \"link\",\n {\n rel: \"preload\",\n href: \"/fonts/inter-400.woff2\",\n as: \"font\",\n type: \"font/woff2\",\n crossOrigin: \"\"\n }\n ),\n /* @__PURE__ */ jsx(\n \"link\",\n {\n rel: \"preload\",\n href: \"/fonts/inter-600.woff2\",\n as: \"font\",\n type: \"font/woff2\",\n crossOrigin: \"\"\n }\n ),\n /* @__PURE__ */ jsx(\n \"link\",\n {\n rel: \"preload\",\n href: \"/fonts/inter-700.woff2\",\n as: \"font\",\n type: \"font/woff2\",\n crossOrigin: \"\"\n }\n ),\n /* @__PURE__ */ jsx(\n \"link\",\n {\n rel: \"preload\",\n href: \"/fonts/inter-800.woff2\",\n as: \"font\",\n type: \"font/woff2\",\n crossOrigin: \"\"\n }\n ),\n /* @__PURE__ */ jsx(\"style\", { precedence: \"reset\", href: \"__font_inter\", children: interFontCss })\n ] }),\n /* @__PURE__ */ jsx(\"style\", { precedence: \"reset\", href: \"__critical_reset\", children: [\n \"html{max-width:100vw;color-scheme:light dark}\",\n \"body{overflow-x:hidden;margin:0;display:flex;flex-direction:column;min-width:100%;min-height:100vh}\",\n \"#root,#__next{display:flex;flex-direction:column;min-width:100%;min-height:100vh}\",\n \"*{box-sizing:border-box}\",\n \"a{color:inherit;text-decoration:none}\",\n \"h1,h2,h3,h4,h5,h6{margin:0;padding:0}\",\n \"p,input,textarea,button,ul,ol,li,pre,dialog{all:unset;box-sizing:border-box}\"\n ].join(\"\") }),\n /* @__PURE__ */ jsx(\"meta\", { name: \"viewport\", content: \"width=device-width, initial-scale=1, maximum-scale=5\" }),\n cfg.head && /* @__PURE__ */ jsxs(Fragment, { children: [\n /* @__PURE__ */ jsx(\"meta\", { httpEquiv: \"X-UA-Compatible\", content: \"IE=edge\" }),\n cfg.head.title && /* @__PURE__ */ jsx(\"title\", { children: cfg.head.title }),\n cfg.head.favicon && /* @__PURE__ */ jsx(\"link\", { rel: \"icon\", href: cfg.head.favicon })\n ] })\n ] }),\n /* @__PURE__ */ jsxs(\"body\", { children: [\n /* @__PURE__ */ jsx(LoadProgressBar, {}),\n /* @__PURE__ */ jsx(SchemeProvider, { children: /* @__PURE__ */ jsx(CookiesProvider, { cookies: ssrCookies, children: /* @__PURE__ */ jsx(WebRootProvider, { children: /* @__PURE__ */ jsx(RootLayout, { ssrSession: rootLoaderData?.session, children: /* @__PURE__ */ jsx(Slot, {}) }) }) }) })\n ] })\n ] });\n }\n Layout.displayName = \"RootLayout\";\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0B,eAAe,EAAE;cAAEC,QAAQ,EAAE,eAAgB3B,GAAG,CAACyB,UAAU,EAAE;gBAAEwC,UAAU,EAAE9B,cAAc,EAAE+B,OAAO;gBAAEvC,QAAQ,EAAE,eAAgB3B,GAAG,CAACnB,IAAI,EAAE,CAAC,CAAC;cAAE,CAAC;YAAE,CAAC;UAAE,CAAC;QAAE,CAAC,CAAC;MACjS,CAAC,CAAC;IACJ,CAAC,CAAC;EACN;EACAoD,MAAM,CAACD,WAAW,GAAG,YAAY;EACjC,OAAOC,MAAM;AACf;AACA,SACE/B,gBAAgB","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@multiplatform.one/core",
|
|
3
|
-
"version": "7.85.
|
|
3
|
+
"version": "7.85.1",
|
|
4
4
|
"description": "Core framework shell, provider composition, and layout factories for multiplatform.one",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"app",
|
|
@@ -56,11 +56,11 @@
|
|
|
56
56
|
"access": "public"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@multiplatform.one/i18n": "^7.85.
|
|
60
|
-
"@multiplatform.one/logger": "^7.85.
|
|
61
|
-
"@multiplatform.one/platform": "^7.85.
|
|
62
|
-
"@multiplatform.one/store": "^7.85.
|
|
63
|
-
"@multiplatform.one/theme": "^7.85.
|
|
59
|
+
"@multiplatform.one/i18n": "^7.85.1",
|
|
60
|
+
"@multiplatform.one/logger": "^7.85.1",
|
|
61
|
+
"@multiplatform.one/platform": "^7.85.1",
|
|
62
|
+
"@multiplatform.one/store": "^7.85.1",
|
|
63
|
+
"@multiplatform.one/theme": "^7.85.1",
|
|
64
64
|
"@tanstack/devtools-utils": "^0.4.0",
|
|
65
65
|
"@tanstack/pacer-devtools": "1.6.0",
|
|
66
66
|
"@tanstack/react-devtools": "0.10.13",
|
|
@@ -68,8 +68,8 @@
|
|
|
68
68
|
"react-cookie": "^8.1.2"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
|
-
"@multiplatform.one/frappe": "7.85.
|
|
72
|
-
"@multiplatform.one/web3": "7.85.
|
|
71
|
+
"@multiplatform.one/frappe": "7.85.1",
|
|
72
|
+
"@multiplatform.one/web3": "7.85.1",
|
|
73
73
|
"@sentry/react": "^10.77.1",
|
|
74
74
|
"@tamagui/build": "2.7.6",
|
|
75
75
|
"@tanstack/react-query": "^5.104.3",
|
|
@@ -88,10 +88,10 @@
|
|
|
88
88
|
"vitest": "^4.1.12"
|
|
89
89
|
},
|
|
90
90
|
"peerDependencies": {
|
|
91
|
-
"@multiplatform.one/frappe": "^7.85.
|
|
92
|
-
"@multiplatform.one/frappe-ui": "^7.85.
|
|
93
|
-
"@multiplatform.one/keycloak": "^7.85.
|
|
94
|
-
"@multiplatform.one/web3": "^7.85.
|
|
91
|
+
"@multiplatform.one/frappe": "^7.85.1",
|
|
92
|
+
"@multiplatform.one/frappe-ui": "^7.85.1",
|
|
93
|
+
"@multiplatform.one/keycloak": "^7.85.1",
|
|
94
|
+
"@multiplatform.one/web3": "^7.85.1",
|
|
95
95
|
"@sentry/react": "^9.0.0 || ^10.0.0",
|
|
96
96
|
"@tanstack/react-query": "^5.0.0",
|
|
97
97
|
"@tanstack/react-query-devtools": "^5.0.0",
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
2
|
+
import type { ReactNode } from "react";
|
|
3
|
+
import { createRootLayout } from "./CreateRootLayout.web";
|
|
4
|
+
|
|
5
|
+
const sentryInit = vi.hoisted(() => vi.fn());
|
|
6
|
+
|
|
7
|
+
vi.mock("@sentry/react", () => ({ init: sentryInit }));
|
|
8
|
+
vi.mock("one", () => ({
|
|
9
|
+
LoadProgressBar: () => null,
|
|
10
|
+
Slot: () => null,
|
|
11
|
+
useMatches: vi.fn(() => []),
|
|
12
|
+
SchemeProvider: ({ children }: { children: ReactNode }) => children,
|
|
13
|
+
setUserScheme: vi.fn(),
|
|
14
|
+
useUserScheme: () => ({ value: "light" }),
|
|
15
|
+
}));
|
|
16
|
+
vi.mock("i18next", () => ({
|
|
17
|
+
default: {
|
|
18
|
+
use: () => ({ init: () => Promise.resolve() }),
|
|
19
|
+
changeLanguage: vi.fn(),
|
|
20
|
+
language: "en",
|
|
21
|
+
},
|
|
22
|
+
}));
|
|
23
|
+
vi.mock("react-i18next", () => ({ initReactI18next: {} }));
|
|
24
|
+
vi.mock("@multiplatform.one/platform", () => ({
|
|
25
|
+
config: {
|
|
26
|
+
get: (key: string, fallback?: string) =>
|
|
27
|
+
key === "SENTRY_DSN" ? "https://public@sentry.example/1" : fallback,
|
|
28
|
+
},
|
|
29
|
+
isDev: false,
|
|
30
|
+
platform: { isServer: false },
|
|
31
|
+
}));
|
|
32
|
+
vi.mock("@multiplatform.one/i18n", () => ({ createI18nConfig: () => ({}) }));
|
|
33
|
+
vi.mock("@multiplatform.one/logger", () => ({ logger: { error: vi.fn() } }));
|
|
34
|
+
vi.mock("@multiplatform.one/store", () => ({ storage: { getItem: () => null } }));
|
|
35
|
+
vi.mock("./RuntimePublicConfigScript", () => ({ RuntimePublicConfigScript: () => null }));
|
|
36
|
+
|
|
37
|
+
type Config = Parameters<typeof createRootLayout>[0];
|
|
38
|
+
|
|
39
|
+
function create(sentry: Config["sentry"]) {
|
|
40
|
+
const Wrapper = ({ children }: { children?: ReactNode }) => children;
|
|
41
|
+
createRootLayout({
|
|
42
|
+
AppProvider: Wrapper,
|
|
43
|
+
RootLayout: Wrapper,
|
|
44
|
+
i18n: { defaultLanguage: "en" },
|
|
45
|
+
sentry,
|
|
46
|
+
} as Config);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
async function settleImport() {
|
|
50
|
+
await vi.dynamicImportSettled();
|
|
51
|
+
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
describe("createRootLayout Sentry client (FZ-9010)", () => {
|
|
55
|
+
beforeEach(() => {
|
|
56
|
+
sentryInit.mockClear();
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it("starts the built-in client from SENTRY_DSN when the app says nothing", async () => {
|
|
60
|
+
create(undefined);
|
|
61
|
+
await settleImport();
|
|
62
|
+
expect(sentryInit).toHaveBeenCalledTimes(1);
|
|
63
|
+
expect(sentryInit.mock.calls[0]?.[0]).toMatchObject({
|
|
64
|
+
dsn: "https://public@sentry.example/1",
|
|
65
|
+
enabled: true,
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
it("makes no Sentry.init call with sentry: false, even with SENTRY_DSN published", async () => {
|
|
70
|
+
create(false);
|
|
71
|
+
await settleImport();
|
|
72
|
+
expect(sentryInit).not.toHaveBeenCalled();
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it("passes the app's init options through to Sentry.init unchanged", async () => {
|
|
76
|
+
const beforeSend = vi.fn((event: unknown) => event);
|
|
77
|
+
const beforeBreadcrumb = vi.fn((crumb: unknown) => crumb);
|
|
78
|
+
const dataCollection = { userInfo: false, cookies: false, httpHeaders: false };
|
|
79
|
+
create({ beforeSend, beforeBreadcrumb, dataCollection, enabled: false });
|
|
80
|
+
await settleImport();
|
|
81
|
+
expect(sentryInit).toHaveBeenCalledTimes(1);
|
|
82
|
+
const options = sentryInit.mock.calls[0]?.[0];
|
|
83
|
+
expect(options.dsn).toBe("https://public@sentry.example/1");
|
|
84
|
+
expect(options.beforeSend).toBe(beforeSend);
|
|
85
|
+
expect(options.beforeBreadcrumb).toBe(beforeBreadcrumb);
|
|
86
|
+
expect(options.dataCollection).toBe(dataCollection);
|
|
87
|
+
expect(options.enabled).toBe(false);
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
it("lets the app's own dsn win over SENTRY_DSN", async () => {
|
|
91
|
+
create({ dsn: "https://app@sentry.example/2" });
|
|
92
|
+
await settleImport();
|
|
93
|
+
expect(sentryInit.mock.calls[0]?.[0].dsn).toBe("https://app@sentry.example/2");
|
|
94
|
+
});
|
|
95
|
+
});
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
scaleAttributeScript,
|
|
25
25
|
} from "@multiplatform.one/theme/scale-attribute";
|
|
26
26
|
import { RuntimePublicConfigScript } from "./RuntimePublicConfigScript";
|
|
27
|
-
import type { CreateRootLayoutConfig, RootLoaderData } from "./rootLayoutShared";
|
|
27
|
+
import type { CreateRootLayoutConfig, RootLoaderData, SentryConfig } from "./rootLayoutShared";
|
|
28
28
|
|
|
29
29
|
export type {
|
|
30
30
|
CreateRootLayoutConfig,
|
|
@@ -86,14 +86,17 @@ export function createRootLayout(cfg: CreateRootLayoutConfig): ComponentType {
|
|
|
86
86
|
i18n.use(initReactI18next).init(createI18nConfig(cfg.i18n)).catch(logger.error);
|
|
87
87
|
i18n.changeLanguage(config.get("I18N_DEFAULT_LANGUAGE", cfg.i18n.defaultLanguage));
|
|
88
88
|
|
|
89
|
-
const
|
|
89
|
+
const sentryConfig: SentryConfig = cfg.sentry || {};
|
|
90
|
+
const { dsn, ...sentryOptions } = sentryConfig;
|
|
91
|
+
const sentryDsn = cfg.sentry === false ? undefined : dsn || config.get("SENTRY_DSN");
|
|
90
92
|
if (sentryDsn && !platform.isServer) {
|
|
91
93
|
import("@sentry/react")
|
|
92
94
|
.then((Sentry) => {
|
|
93
95
|
Sentry.init({
|
|
94
|
-
dsn: sentryDsn,
|
|
95
96
|
enabled: !isDev,
|
|
96
|
-
|
|
97
|
+
...sentryOptions,
|
|
98
|
+
dsn: sentryDsn,
|
|
99
|
+
} as Parameters<typeof Sentry.init>[0]);
|
|
97
100
|
})
|
|
98
101
|
.catch(() => {});
|
|
99
102
|
}
|
|
@@ -20,9 +20,20 @@ export interface HeadConfig {
|
|
|
20
20
|
interFonts?: boolean;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
/**
|
|
24
|
+
* The built-in web Sentry client. Every key besides `dsn` goes to
|
|
25
|
+
* `Sentry.init` unchanged, so an app can hand it its own scrubbing
|
|
26
|
+
* (`beforeSend`, `beforeBreadcrumb`, `dataCollection`) and switch.
|
|
27
|
+
*/
|
|
23
28
|
export interface SentryConfig {
|
|
24
|
-
/** Sentry DSN.
|
|
29
|
+
/** Sentry DSN. Falls back to the `SENTRY_DSN` config key. */
|
|
25
30
|
dsn?: string;
|
|
31
|
+
/** Defaults to `!isDev`. */
|
|
32
|
+
enabled?: boolean;
|
|
33
|
+
beforeSend?(event: unknown, hint: unknown): unknown;
|
|
34
|
+
beforeBreadcrumb?(breadcrumb: unknown, hint?: unknown): unknown;
|
|
35
|
+
dataCollection?: unknown;
|
|
36
|
+
[option: string]: unknown;
|
|
26
37
|
}
|
|
27
38
|
|
|
28
39
|
/** Shape of the root layout loader data used by createRootLayout. */
|
|
@@ -62,8 +73,12 @@ export interface CreateRootLayoutConfig {
|
|
|
62
73
|
i18n: I18nConfigOptions;
|
|
63
74
|
/** `<Head>` meta tags for web. Ignored on native. */
|
|
64
75
|
head?: HeadConfig;
|
|
65
|
-
/**
|
|
66
|
-
|
|
76
|
+
/**
|
|
77
|
+
* Sentry error tracking. Initialized on the web client only. Ignored on native.
|
|
78
|
+
* `false` skips the built-in client even when `SENTRY_DSN` is set, for an app
|
|
79
|
+
* that runs its own.
|
|
80
|
+
*/
|
|
81
|
+
sentry?: SentryConfig | false;
|
|
67
82
|
/**
|
|
68
83
|
* Native font map returned by `importFonts()` from `@package/fonts`.
|
|
69
84
|
* Passed to `useFonts()` so custom fonts load before the first render.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreateRootLayout.web.d.ts","sourceRoot":"","sources":["../../src/app/CreateRootLayout.web.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,KAAK,aAAa,EAA4B,MAAM,OAAO,CAAC;AAarE,OAAO,KAAK,EAAE,sBAAsB,
|
|
1
|
+
{"version":3,"file":"CreateRootLayout.web.d.ts","sourceRoot":"","sources":["../../src/app/CreateRootLayout.web.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,KAAK,aAAa,EAA4B,MAAM,OAAO,CAAC;AAarE,OAAO,KAAK,EAAE,sBAAsB,EAAgC,MAAM,oBAAoB,CAAC;AAE/F,YAAY,EACV,sBAAsB,EACtB,UAAU,EACV,eAAe,EACf,cAAc,EACd,YAAY,GACb,MAAM,oBAAoB,CAAC;AAE5B;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,sBAAsB,GAAG,aAAa,CAuN3E"}
|
|
@@ -18,9 +18,20 @@ export interface HeadConfig {
|
|
|
18
18
|
*/
|
|
19
19
|
interFonts?: boolean;
|
|
20
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* The built-in web Sentry client. Every key besides `dsn` goes to
|
|
23
|
+
* `Sentry.init` unchanged, so an app can hand it its own scrubbing
|
|
24
|
+
* (`beforeSend`, `beforeBreadcrumb`, `dataCollection`) and switch.
|
|
25
|
+
*/
|
|
21
26
|
export interface SentryConfig {
|
|
22
|
-
/** Sentry DSN.
|
|
27
|
+
/** Sentry DSN. Falls back to the `SENTRY_DSN` config key. */
|
|
23
28
|
dsn?: string;
|
|
29
|
+
/** Defaults to `!isDev`. */
|
|
30
|
+
enabled?: boolean;
|
|
31
|
+
beforeSend?(event: unknown, hint: unknown): unknown;
|
|
32
|
+
beforeBreadcrumb?(breadcrumb: unknown, hint?: unknown): unknown;
|
|
33
|
+
dataCollection?: unknown;
|
|
34
|
+
[option: string]: unknown;
|
|
24
35
|
}
|
|
25
36
|
/** Shape of the root layout loader data used by createRootLayout. */
|
|
26
37
|
export interface RootLoaderData {
|
|
@@ -57,8 +68,12 @@ export interface CreateRootLayoutConfig {
|
|
|
57
68
|
i18n: I18nConfigOptions;
|
|
58
69
|
/** `<Head>` meta tags for web. Ignored on native. */
|
|
59
70
|
head?: HeadConfig;
|
|
60
|
-
/**
|
|
61
|
-
|
|
71
|
+
/**
|
|
72
|
+
* Sentry error tracking. Initialized on the web client only. Ignored on native.
|
|
73
|
+
* `false` skips the built-in client even when `SENTRY_DSN` is set, for an app
|
|
74
|
+
* that runs its own.
|
|
75
|
+
*/
|
|
76
|
+
sentry?: SentryConfig | false;
|
|
62
77
|
/**
|
|
63
78
|
* Native font map returned by `importFonts()` from `@package/fonts`.
|
|
64
79
|
* Passed to `useFonts()` so custom fonts load before the first render.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rootLayoutShared.d.ts","sourceRoot":"","sources":["../../src/app/rootLayoutShared.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAC9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,MAAM,WAAW,UAAU;IACzB,6CAA6C;IAC7C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,8BAA8B;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;;;;;OASG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,YAAY;IAC3B,
|
|
1
|
+
{"version":3,"file":"rootLayoutShared.d.ts","sourceRoot":"","sources":["../../src/app/rootLayoutShared.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAC9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,MAAM,WAAW,UAAU;IACzB,6CAA6C;IAC7C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,8BAA8B;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;;;;;OASG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;;;GAIG;AACH,MAAM,WAAW,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