cloudflare-next-intl 0.10.9 → 0.10.11

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.
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { setLocaleCache, setMessageForLocaleCache } from "../../general/cache_variables.js";
4
- import { createContext, useMemo } from "react";
4
+ import { createContext, useMemo, Suspense } from "react";
5
5
  import dynamic from "next/dynamic.js";
6
6
  import useLazyWrappingProvider from "./use_lazy_wrapping_provider.js";
7
7
  import config from "@intl-config";
@@ -25,10 +25,10 @@ export default function LocationzationClientProvider({ language, messages, initi
25
25
  const { Provider: CookieConsentProvider, isReady: cookieConsentReady } = useLazyWrappingProvider(loadCookieConsentProvider);
26
26
  let providedChildren = children;
27
27
  if (config.firebaseAuth && !skipAuthProvider) {
28
- providedChildren = _jsx(AuthUserPendingProvider, { initialUser: initialAuthUser, children: _jsxs(AuthUserProvider, { initialUser: initialAuthUser, children: [children, config.firebaseAuth.performance !== false && _jsx(AutoFirebasePerformanceEvents, {})] }) });
28
+ providedChildren = _jsx(AuthUserPendingProvider, { initialUser: initialAuthUser, children: _jsxs(AuthUserProvider, { initialUser: initialAuthUser, children: [children, config.firebaseAuth.performance !== false && (_jsx(Suspense, { fallback: null, children: _jsx(AutoFirebasePerformanceEvents, {}) }))] }) });
29
29
  }
30
30
  if (config.cookieConsent) {
31
- providedChildren = _jsxs(CookieConsentProvider, { requiresConsent: requiresConsent, children: [providedChildren, cookieConsentReady && analyticsConfig && _jsx(CookieConsentAnalytics, { config: analyticsConfig }), cookieConsentReady && analyticsConfig && (analyticsConfig.googleAnalyticsId || analyticsConfig.googleAdsId) && _jsx(AutoAnalyticsEvents, { config: autoAnalyticsEventsConfig }), cookieConsentReady && autoWireDialogs && _jsx(CookieConsentDialog, { ...dialogProps }), cookieConsentReady && autoWireDialogs && _jsx(PrivacyPolicyUpdateDialog, { ...updateDialogProps })] });
31
+ providedChildren = _jsxs(CookieConsentProvider, { requiresConsent: requiresConsent, children: [providedChildren, cookieConsentReady && analyticsConfig && (_jsx(Suspense, { fallback: null, children: _jsx(CookieConsentAnalytics, { config: analyticsConfig }) })), cookieConsentReady && analyticsConfig && (analyticsConfig.googleAnalyticsId || analyticsConfig.googleAdsId) && (_jsx(Suspense, { fallback: null, children: _jsx(AutoAnalyticsEvents, { config: autoAnalyticsEventsConfig }) })), cookieConsentReady && autoWireDialogs && (_jsx(Suspense, { fallback: null, children: _jsx(CookieConsentDialog, { ...dialogProps }) })), cookieConsentReady && autoWireDialogs && (_jsx(Suspense, { fallback: null, children: _jsx(PrivacyPolicyUpdateDialog, { ...updateDialogProps }) }))] });
32
32
  }
33
33
  const contextValue = useMemo(() => ({ language, messages }), [language, messages]);
34
34
  return _jsx(LocaleContext.Provider, { value: contextValue, children: providedChildren });
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { setLocaleCache, setMessageForLocaleCache } from "../../general/cache_variables.js";
4
- import { createContext, useMemo } from "react";
4
+ import { createContext, useMemo, Suspense } from "react";
5
5
  import dynamic from "next/dynamic.js";
6
6
  import useLazyWrappingProvider from "./use_lazy_wrapping_provider.js";
7
7
  import config from "@intl-config";
@@ -21,7 +21,7 @@ export default function LocationzationClientProvider({ language, messages, analy
21
21
  const { Provider: CookieConsentProvider, isReady: cookieConsentReady } = useLazyWrappingProvider(loadCookieConsentProvider);
22
22
  let providedChildren = children;
23
23
  if (config.cookieConsent) {
24
- providedChildren = _jsxs(CookieConsentProvider, { requiresConsent: requiresConsent, children: [providedChildren, cookieConsentReady && analyticsConfig && _jsx(CookieConsentAnalytics, { config: analyticsConfig }), cookieConsentReady && analyticsConfig && (analyticsConfig.googleAnalyticsId || analyticsConfig.googleAdsId) && _jsx(AutoAnalyticsEvents, { config: autoAnalyticsEventsConfig }), cookieConsentReady && autoWireDialogs && _jsx(CookieConsentDialog, { ...dialogProps }), cookieConsentReady && autoWireDialogs && _jsx(PrivacyPolicyUpdateDialog, { ...updateDialogProps })] });
24
+ providedChildren = _jsxs(CookieConsentProvider, { requiresConsent: requiresConsent, children: [providedChildren, cookieConsentReady && analyticsConfig && (_jsx(Suspense, { fallback: null, children: _jsx(CookieConsentAnalytics, { config: analyticsConfig }) })), cookieConsentReady && analyticsConfig && (analyticsConfig.googleAnalyticsId || analyticsConfig.googleAdsId) && (_jsx(Suspense, { fallback: null, children: _jsx(AutoAnalyticsEvents, { config: autoAnalyticsEventsConfig }) })), cookieConsentReady && autoWireDialogs && (_jsx(Suspense, { fallback: null, children: _jsx(CookieConsentDialog, { ...dialogProps }) })), cookieConsentReady && autoWireDialogs && (_jsx(Suspense, { fallback: null, children: _jsx(PrivacyPolicyUpdateDialog, { ...updateDialogProps }) }))] });
25
25
  }
26
26
  const contextValue = useMemo(() => ({ language, messages }), [language, messages]);
27
27
  return _jsx(LocaleContext.Provider, { value: contextValue, children: providedChildren });
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useEffect } from 'react';
3
+ import { useEffect, Suspense } from 'react';
4
4
  import dynamic from 'next/dynamic.js';
5
5
  import useCookieConsent from '../use_cookie_consent.js';
6
6
  const ClarityScript = dynamic(() => import('./clarity_script.js'));
@@ -22,7 +22,7 @@ export default function CookieConsentAnalytics({ config }) {
22
22
  });
23
23
  }, [consent, requiresConsent, granted]);
24
24
  const hasGoogle = Boolean(config.googleAnalyticsId || config.googleAdsId || config.googleAdSenseId);
25
- return (_jsxs(_Fragment, { children: [hasGoogle && (_jsx("script", { id: "cookie-consent-google-consent-mode", dangerouslySetInnerHTML: { __html: googleConsentModeBootstrapScript(config) } })), granted && config.cloudflareBeaconToken && (_jsx("script", { defer: true, src: "https://static.cloudflareinsights.com/beacon.min.js", "data-cf-beacon": config.cloudflareBeaconToken })), granted && config.clarityProjectId && _jsx(ClarityScript, { projectId: config.clarityProjectId })] }));
25
+ return (_jsxs(_Fragment, { children: [hasGoogle && (_jsx("script", { id: "cookie-consent-google-consent-mode", dangerouslySetInnerHTML: { __html: googleConsentModeBootstrapScript(config) } })), granted && config.cloudflareBeaconToken && (_jsx("script", { defer: true, src: "https://static.cloudflareinsights.com/beacon.min.js", "data-cf-beacon": config.cloudflareBeaconToken })), granted && config.clarityProjectId && (_jsx(Suspense, { fallback: null, children: _jsx(ClarityScript, { projectId: config.clarityProjectId }) }))] }));
26
26
  }
27
27
  export function googleConsentModeBootstrapScript(config) {
28
28
  const configCalls = [config.googleAnalyticsId, config.googleAdsId]
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import dynamic from 'next/dynamic.js';
3
+ import { Suspense } from 'react';
3
4
  import { headers } from 'next/headers.js';
4
5
  import { redirect } from 'next/navigation.js';
5
6
  import config from '@intl-config';
@@ -32,5 +33,5 @@ export async function resolveAuthUserAndRedirect() {
32
33
  }
33
34
  export default async function AuthUserServerProvider({ children }) {
34
35
  const initialUser = await resolveAuthUserAndRedirect();
35
- return _jsx(AuthUserProvider, { initialUser: initialUser, children: children });
36
+ return (_jsx(Suspense, { fallback: children, children: _jsx(AuthUserProvider, { initialUser: initialUser, children: children }) }));
36
37
  }
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { setLocaleCache, setMessageForLocaleCache } from "../../general/cache_variables.js";
3
3
  import { getMessage } from "../functions/server.js";
4
+ import { Suspense } from "react";
4
5
  import dynamic from "next/dynamic.js";
5
6
  import { localesSet } from "../../config/middleware.js";
6
7
  import config from "../../config/intl_config.js";
@@ -58,5 +59,5 @@ export default async function LocationzationProvider({ language, messages, stati
58
59
  }
59
60
  }
60
61
  }
61
- return _jsx(LocationzationClientProvider, { language: language, messages: messagesValue, initialAuthUser: initialAuthUser, skipAuthProvider: !autoWireClientProvider, analyticsConfig: analyticsConfig, autoAnalyticsEventsConfig: config.cookieConsent?.autoAnalyticsEvents, requiresConsent: requiresConsent, autoWireDialogs: config.cookieConsent?.autoWireDialogs !== false, dialogProps: config.cookieConsent?.dialogProps, updateDialogProps: config.cookieConsent?.updateDialogProps, children: children });
62
+ return (_jsx(Suspense, { fallback: children, children: _jsx(LocationzationClientProvider, { language: language, messages: messagesValue, initialAuthUser: initialAuthUser, skipAuthProvider: !autoWireClientProvider, analyticsConfig: analyticsConfig, autoAnalyticsEventsConfig: config.cookieConsent?.autoAnalyticsEvents, requiresConsent: requiresConsent, autoWireDialogs: config.cookieConsent?.autoWireDialogs !== false, dialogProps: config.cookieConsent?.dialogProps, updateDialogProps: config.cookieConsent?.updateDialogProps, children: children }) }));
62
63
  }
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { setLocaleCache, setMessageForLocaleCache } from "../../general/cache_variables.js";
3
3
  import { getMessage } from "../functions/server.js";
4
+ import { Suspense } from "react";
4
5
  import dynamic from "next/dynamic.js";
5
6
  import { localesSet } from "../../config/middleware.js";
6
7
  import config from "../../config/intl_config.js";
@@ -47,5 +48,5 @@ export default async function LocationzationProvider({ language, messages, child
47
48
  }
48
49
  }
49
50
  }
50
- return _jsx(LocationzationClientProvider, { language: language, messages: messagesValue, analyticsConfig: analyticsConfig, autoAnalyticsEventsConfig: config.cookieConsent?.autoAnalyticsEvents, requiresConsent: requiresConsent, autoWireDialogs: config.cookieConsent?.autoWireDialogs !== false, dialogProps: config.cookieConsent?.dialogProps, updateDialogProps: config.cookieConsent?.updateDialogProps, children: children });
51
+ return (_jsx(Suspense, { fallback: children, children: _jsx(LocationzationClientProvider, { language: language, messages: messagesValue, analyticsConfig: analyticsConfig, autoAnalyticsEventsConfig: config.cookieConsent?.autoAnalyticsEvents, requiresConsent: requiresConsent, autoWireDialogs: config.cookieConsent?.autoWireDialogs !== false, dialogProps: config.cookieConsent?.dialogProps, updateDialogProps: config.cookieConsent?.updateDialogProps, children: children }) }));
51
52
  }
@@ -1,12 +1,16 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Suspense } from "react";
2
3
  import { Moon, Sun } from "./icons.js";
3
4
  import ThemeSwticherButton from "./theme_switcher_button.js";
4
5
  export default function ThemeSwticher(params) {
5
- return _jsxs(ThemeSwticherButton, { ...params, children: [_jsx(Sun, { className: "transition-transform duration-500 ease-in-out" +
6
- " rotate-0 scale-100 opacity-100 cursor-pointer" +
7
- " dark:rotate-90 dark:scale-0 dark:opacity-0" +
8
- " dark:w-0 dark:h-0 h-max w-max" }), _jsx(Moon, { className: "transition-transform duration-500 ease-in-out" +
9
- " -rotate-90 scale-0 opacity-0 cursor-pointer" +
10
- " dark:rotate-0 dark:scale-100 dark:opacity-100" +
11
- " w-0 h-0 dark:h-max dark:w-max" })] });
6
+ return (_jsx(Suspense, { fallback: _jsx("div", { "aria-hidden": "true", className: "relative flex items-center justify-center pointer-events-none select-none" +
7
+ " p-2.5 aspect-square h-11.5 rounded-full overflow-hidden" +
8
+ " animate-pulse bg-gray-200 dark:bg-gray-700 " +
9
+ (params.className ?? "") }), children: _jsxs(ThemeSwticherButton, { ...params, children: [_jsx(Sun, { className: "transition-transform duration-500 ease-in-out" +
10
+ " rotate-0 scale-100 opacity-100 cursor-pointer" +
11
+ " dark:rotate-90 dark:scale-0 dark:opacity-0" +
12
+ " dark:w-0 dark:h-0 h-max w-max" }), _jsx(Moon, { className: "transition-transform duration-500 ease-in-out" +
13
+ " -rotate-90 scale-0 opacity-0 cursor-pointer" +
14
+ " dark:rotate-0 dark:scale-100 dark:opacity-100" +
15
+ " w-0 h-0 dark:h-max dark:w-max" })] }) }));
12
16
  }
@@ -67,7 +67,10 @@ export function getReactEvalConfig() {
67
67
  },
68
68
  };
69
69
  return {
70
- optimizeDeps: rolldownConfig,
70
+ optimizeDeps: {
71
+ include: ["buffer", "next/web-vitals"],
72
+ ...rolldownConfig,
73
+ },
71
74
  ssr: {
72
75
  noExternal: ["cloudflare-next-intl", "cloudflare-next-intl-db"],
73
76
  optimizeDeps: rolldownConfig,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloudflare-next-intl",
3
- "version": "0.10.9",
3
+ "version": "0.10.11",
4
4
  "description": "Optimized Next Intl Package Special for App Router and Cloudflare",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",