cloudflare-next-intl 0.10.34 → 0.13.0

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.
Files changed (178) hide show
  1. package/README.md +2 -0
  2. package/dist/src/client/components/client_extensions.d.ts +20 -0
  3. package/dist/src/client/components/client_extensions.js +37 -0
  4. package/dist/src/client/components/client_helper_script.d.ts +2 -1
  5. package/dist/src/client/components/client_helper_script.js +2 -15
  6. package/dist/src/client/components/client_provider.d.ts +7 -16
  7. package/dist/src/client/components/client_provider.js +6 -36
  8. package/dist/src/client/components/client_provider_static.d.ts +2 -21
  9. package/dist/src/client/components/client_provider_static.js +2 -26
  10. package/dist/src/client/components/locale_link.d.ts +2 -8
  11. package/dist/src/client/components/locale_link.js +2 -8
  12. package/dist/src/client/components/locale_link_client.d.ts +2 -3
  13. package/dist/src/client/components/locale_link_client.js +2 -30
  14. package/dist/src/client/components/locale_provider.d.ts +2 -13
  15. package/dist/src/client/components/locale_provider.js +2 -8
  16. package/dist/src/client/functions/get_cookie.d.ts +2 -1
  17. package/dist/src/client/functions/get_cookie.js +2 -32
  18. package/dist/src/client/functions/set_cookie.d.ts +2 -5
  19. package/dist/src/client/functions/set_cookie.js +2 -17
  20. package/dist/src/client/hooks/client_hooks.d.ts +1 -3
  21. package/dist/src/client/hooks/client_hooks.js +1 -19
  22. package/dist/src/client/hooks/use_path_name.d.ts +2 -1
  23. package/dist/src/client/hooks/use_path_name.js +2 -17
  24. package/dist/src/client/index.d.ts +7 -3
  25. package/dist/src/client/index.js +7 -3
  26. package/dist/src/client_messages_scan/index.d.ts +1 -3
  27. package/dist/src/client_messages_scan/index.js +1 -3
  28. package/dist/src/client_messages_scan/match_namespace.d.ts +1 -1
  29. package/dist/src/client_messages_scan/match_namespace.js +1 -3
  30. package/dist/src/client_messages_scan/scan_file.d.ts +1 -16
  31. package/dist/src/client_messages_scan/scan_file.js +1 -175
  32. package/dist/src/client_messages_scan/scan_project.d.ts +1 -16
  33. package/dist/src/client_messages_scan/scan_project.js +1 -67
  34. package/dist/src/config/cookie_key.d.ts +2 -5
  35. package/dist/src/config/cookie_key.js +2 -5
  36. package/dist/src/config/init_config.js +13 -31
  37. package/dist/src/config/intl_config.js +12 -7
  38. package/dist/src/config/intl_sitemap.d.ts +2 -8
  39. package/dist/src/config/intl_sitemap.js +2 -28
  40. package/dist/src/config/middleware.d.ts +9 -6
  41. package/dist/src/config/middleware.js +11 -173
  42. package/dist/src/cookie_consent/client/cookie_consent_provider.d.ts +3 -1
  43. package/dist/src/cookie_consent/client/cookie_consent_provider.js +3 -3
  44. package/dist/src/db/resolve_db_config.js +2 -0
  45. package/dist/src/error_handling/clear_client_cache.d.ts +2 -1
  46. package/dist/src/error_handling/clear_client_cache.js +2 -17
  47. package/dist/src/error_handling/create_server_error_action.d.ts +2 -3
  48. package/dist/src/error_handling/create_server_error_action.js +2 -6
  49. package/dist/src/error_handling/default_ignored_console_errors.d.ts +1 -1
  50. package/dist/src/error_handling/default_ignored_console_errors.js +1 -33
  51. package/dist/src/error_handling/format_error_message.d.ts +2 -2
  52. package/dist/src/error_handling/format_error_message.js +2 -16
  53. package/dist/src/error_handling/index.d.ts +1 -13
  54. package/dist/src/error_handling/index.js +1 -10
  55. package/dist/src/error_handling/install_console_error_override.d.ts +2 -3
  56. package/dist/src/error_handling/install_console_error_override.js +2 -39
  57. package/dist/src/error_handling/install_global_error_override.d.ts +2 -2
  58. package/dist/src/error_handling/install_global_error_override.js +2 -30
  59. package/dist/src/error_handling/is_stale_deploy_error.d.ts +2 -4
  60. package/dist/src/error_handling/is_stale_deploy_error.js +2 -51
  61. package/dist/src/error_handling/match_error_message.d.ts +1 -2
  62. package/dist/src/error_handling/match_error_message.js +1 -10
  63. package/dist/src/error_handling/merge_report_params.d.ts +2 -2
  64. package/dist/src/error_handling/merge_report_params.js +2 -9
  65. package/dist/src/error_handling/report_client_error.d.ts +2 -3
  66. package/dist/src/error_handling/report_client_error.js +2 -15
  67. package/dist/src/error_handling/report_client_error_action.d.ts +1 -2
  68. package/dist/src/error_handling/report_client_error_action.js +1 -6
  69. package/dist/src/error_handling/report_client_error_core.d.ts +1 -3
  70. package/dist/src/error_handling/report_client_error_core.js +1 -26
  71. package/dist/src/error_handling/report_error.d.ts +2 -9
  72. package/dist/src/error_handling/report_error.js +2 -73
  73. package/dist/src/error_handling/stringify_unknown.d.ts +2 -5
  74. package/dist/src/error_handling/stringify_unknown.js +2 -57
  75. package/dist/src/error_handling/use_stale_deploy_recovery.d.ts +2 -4
  76. package/dist/src/error_handling/use_stale_deploy_recovery.js +2 -141
  77. package/dist/src/error_handling/with_error_handling.d.ts +2 -9
  78. package/dist/src/error_handling/with_error_handling.js +2 -13
  79. package/dist/src/firebase_auth/client/auth_actions.d.ts +1 -6
  80. package/dist/src/firebase_auth/client/auth_actions.js +1 -93
  81. package/dist/src/firebase_auth/client/auth_user_provider.d.ts +2 -8
  82. package/dist/src/firebase_auth/client/auth_user_provider.js +2 -283
  83. package/dist/src/firebase_auth/client/components/auto_firebase_performance_events.d.ts +2 -1
  84. package/dist/src/firebase_auth/client/components/auto_firebase_performance_events.js +2 -29
  85. package/dist/src/firebase_auth/client/firebase_client.d.ts +1 -33
  86. package/dist/src/firebase_auth/client/firebase_client.js +1 -218
  87. package/dist/src/firebase_auth/client/use_auth_user.d.ts +2 -2
  88. package/dist/src/firebase_auth/client/use_auth_user.js +2 -10
  89. package/dist/src/firebase_auth/index.d.ts +1 -10
  90. package/dist/src/firebase_auth/index.js +1 -8
  91. package/dist/src/firebase_auth/middleware/update_session.d.ts +2 -27
  92. package/dist/src/firebase_auth/middleware/update_session.js +2 -328
  93. package/dist/src/firebase_auth/server/auth_user_server_provider.d.ts +2 -5
  94. package/dist/src/firebase_auth/server/auth_user_server_provider.js +2 -37
  95. package/dist/src/firebase_auth/server/resolve_optional_auth_user.d.ts +2 -7
  96. package/dist/src/firebase_auth/server/resolve_optional_auth_user.js +2 -15
  97. package/dist/src/firebase_auth/server/use_auth_user_server.d.ts +2 -11
  98. package/dist/src/firebase_auth/server/use_auth_user_server.js +2 -9
  99. package/dist/src/firebase_auth/types.d.ts +1 -31
  100. package/dist/src/firebase_auth/types.js +1 -1
  101. package/dist/src/firebase_auth_check/index.d.ts +1 -2
  102. package/dist/src/firebase_auth_check/index.js +1 -2
  103. package/dist/src/general/cache_variables.d.ts +1 -10
  104. package/dist/src/general/cache_variables.js +1 -25
  105. package/dist/src/general/general_functions.d.ts +1 -2
  106. package/dist/src/general/general_functions.js +1 -110
  107. package/dist/src/general/index.d.ts +1 -2
  108. package/dist/src/general/index.js +1 -2
  109. package/dist/src/general/metadata.d.ts +1 -13
  110. package/dist/src/general/metadata.js +1 -29
  111. package/dist/src/general/pick_client_messages.d.ts +2 -2
  112. package/dist/src/general/pick_client_messages.js +2 -17
  113. package/dist/src/image_optimizer/next_image_shim.js +15 -17
  114. package/dist/src/server/components/helper_script.d.ts +4 -2
  115. package/dist/src/server/components/helper_script.js +20 -321
  116. package/dist/src/server/components/link.d.ts +2 -10
  117. package/dist/src/server/components/link.js +2 -143
  118. package/dist/src/server/components/server_provider.d.ts +4 -3
  119. package/dist/src/server/components/server_provider.js +15 -23
  120. package/dist/src/server/components/server_provider_static.d.ts +4 -3
  121. package/dist/src/server/components/server_provider_static.js +12 -24
  122. package/dist/src/server/functions/geo.d.ts +1 -8
  123. package/dist/src/server/functions/geo.js +1 -223
  124. package/dist/src/server/functions/get_user_locale.d.ts +1 -3
  125. package/dist/src/server/functions/get_user_locale.js +1 -38
  126. package/dist/src/server/functions/locale_static_params.d.ts +1 -3
  127. package/dist/src/server/functions/locale_static_params.js +1 -4
  128. package/dist/src/server/functions/server.d.ts +1 -8
  129. package/dist/src/server/functions/server.js +1 -67
  130. package/dist/src/server/functions/use_functions.d.ts +1 -6
  131. package/dist/src/server/functions/use_functions.js +1 -30
  132. package/dist/src/theme_switcher/components/theme_switcher.d.ts +2 -5
  133. package/dist/src/theme_switcher/components/theme_switcher.js +2 -16
  134. package/dist/src/types/index.d.ts +1 -1
  135. package/dist/src/types/index.js +1 -1
  136. package/dist/src/types/types.d.ts +8 -158
  137. package/dist/src/types/types.js +2 -3
  138. package/dist/src/vite/index.d.ts +2 -1
  139. package/dist/src/vite/index.js +2 -1
  140. package/dist/src/vite/plugin.d.ts +1 -0
  141. package/dist/src/vite/plugin.js +4 -0
  142. package/dist/src/vite/tailwind_sources_plugin.d.ts +8 -0
  143. package/dist/src/vite/tailwind_sources_plugin.js +58 -0
  144. package/dist/src/vite/vinext_route_wiring_fix.d.ts +8 -0
  145. package/dist/src/vite/vinext_route_wiring_fix.js +85 -3
  146. package/package.json +10 -3
  147. package/dist/src/firebase_auth/client/auth_user_cache.d.ts +0 -4
  148. package/dist/src/firebase_auth/client/auth_user_cache.js +0 -12
  149. package/dist/src/firebase_auth/client/auth_user_context.d.ts +0 -10
  150. package/dist/src/firebase_auth/client/auth_user_context.js +0 -4
  151. package/dist/src/firebase_auth/decode_jwt_payload.d.ts +0 -5
  152. package/dist/src/firebase_auth/decode_jwt_payload.js +0 -20
  153. package/dist/src/firebase_auth/error_messages/default_messages.en.d.ts +0 -1
  154. package/dist/src/firebase_auth/error_messages/default_messages.en.js +0 -14
  155. package/dist/src/firebase_auth/error_messages/firebase_auth_error_helper.d.ts +0 -1
  156. package/dist/src/firebase_auth/error_messages/firebase_auth_error_helper.js +0 -37
  157. package/dist/src/firebase_auth/is_whitelisted.d.ts +0 -1
  158. package/dist/src/firebase_auth/is_whitelisted.js +0 -5
  159. package/dist/src/firebase_auth/preserve_redirect_query.d.ts +0 -2
  160. package/dist/src/firebase_auth/preserve_redirect_query.js +0 -9
  161. package/dist/src/firebase_auth/require_config.d.ts +0 -2
  162. package/dist/src/firebase_auth/require_config.js +0 -7
  163. package/dist/src/firebase_auth/server/clear_session_action.d.ts +0 -1
  164. package/dist/src/firebase_auth/server/clear_session_action.js +0 -14
  165. package/dist/src/firebase_auth/server/firebase_server.d.ts +0 -6
  166. package/dist/src/firebase_auth/server/firebase_server.js +0 -92
  167. package/dist/src/firebase_auth/server/mint_server_app_check_token.d.ts +0 -5
  168. package/dist/src/firebase_auth/server/mint_server_app_check_token.js +0 -84
  169. package/dist/src/firebase_auth/server/sign_custom_token_remote.d.ts +0 -5
  170. package/dist/src/firebase_auth/server/sign_custom_token_remote.js +0 -26
  171. package/dist/src/firebase_auth_check/check_firebase_auth_config.d.ts +0 -34
  172. package/dist/src/firebase_auth_check/check_firebase_auth_config.js +0 -606
  173. package/dist/src/firebase_auth_check/load_resolved_firebase_auth.d.ts +0 -9
  174. package/dist/src/firebase_auth_check/load_resolved_firebase_auth.js +0 -64
  175. package/dist/src/theme_switcher/components/icons.d.ts +0 -6
  176. package/dist/src/theme_switcher/components/icons.js +0 -7
  177. package/dist/src/theme_switcher/components/theme_switcher_button.d.ts +0 -6
  178. package/dist/src/theme_switcher/components/theme_switcher_button.js +0 -24
package/README.md CHANGED
@@ -3,6 +3,8 @@
3
3
  Optimized internationalization (i18n) package specialized for Next.js App Router
4
4
  and Cloudflare environment.
5
5
 
6
+ > **Note**: Core internationalization logic lives in [`cloudflare-next-intl-intl`](https://github.com/demian-ilnytskyi/cloudflare-next-intl/tree/main/packages/intl#readme), and Firebase Auth & App Check logic lives in [`cloudflare-next-intl-auth`](https://github.com/demian-ilnytskyi/cloudflare-next-intl/tree/main/packages/auth#readme). This umbrella package re-exports all primitives with full backward compatibility plus wires optional extensions.
7
+
6
8
  ## Features
7
9
 
8
10
  - **Optimized for Cloudflare**: Designed to work seamlessly with Cloudflare
@@ -0,0 +1,20 @@
1
+ import type { SerializedAuthUser } from '../../firebase_auth/types.js';
2
+ import type { CookieConsentAnalyticsConfig, AutoAnalyticsEventsConfig, CookieConsentRoutingConfig } from '../../types/types.js';
3
+ import type { CookieConsentDialogProps } from '../../cookie_consent/client/components/cookie_consent_dialog.js';
4
+ import type { PrivacyPolicyUpdateDialogProps } from '../../cookie_consent/client/components/privacy_policy_update_dialog.js';
5
+ export interface ClientExtensionsProps {
6
+ initialAuthUser?: SerializedAuthUser | null;
7
+ skipAuthProvider?: boolean;
8
+ hasFirebaseAuth?: boolean;
9
+ enableFirebasePerformance?: boolean;
10
+ hasCookieConsent?: boolean;
11
+ cookieConsentConfig?: CookieConsentRoutingConfig;
12
+ requiresConsent?: boolean;
13
+ autoWireDialogs?: boolean;
14
+ dialogProps?: CookieConsentDialogProps;
15
+ updateDialogProps?: PrivacyPolicyUpdateDialogProps;
16
+ analyticsConfig?: CookieConsentAnalyticsConfig;
17
+ autoAnalyticsEventsConfig?: AutoAnalyticsEventsConfig;
18
+ children: React.ReactNode;
19
+ }
20
+ export default function ClientExtensions({ initialAuthUser, skipAuthProvider, hasFirebaseAuth, enableFirebasePerformance, hasCookieConsent, cookieConsentConfig, requiresConsent, autoWireDialogs, dialogProps, updateDialogProps, analyticsConfig, autoAnalyticsEventsConfig, children, }: ClientExtensionsProps): React.ReactNode;
@@ -0,0 +1,37 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { useEffect, Suspense } from 'react';
4
+ import dynamic from 'next/dynamic.js';
5
+ import CookieConsentProvider from '../../cookie_consent/client/cookie_consent_provider.js';
6
+ import AuthUserProvider from '../../firebase_auth/client/auth_user_provider.js';
7
+ import config from '../../config/intl_config.js';
8
+ import installConsoleErrorOverride from '../../error_handling/install_console_error_override.js';
9
+ import installGlobalErrorOverride from '../../error_handling/install_global_error_override.js';
10
+ import ClientThemeScript from 'cloudflare-next-intl-theme/ClientThemeScript';
11
+ const AutoFirebasePerformanceEvents = dynamic(() => import('../../firebase_auth/client/components/auto_firebase_performance_events.js'));
12
+ const CookieConsentAnalytics = dynamic(() => import('../../cookie_consent/client/components/cookie_consent_analytics.js'));
13
+ const AutoAnalyticsEvents = dynamic(() => import('../../cookie_consent/client/components/auto_analytics_events.js'));
14
+ const loadCookieConsentDialog = () => import('../../cookie_consent/client/components/cookie_consent_dialog.js');
15
+ const CookieConsentDialog = dynamic(loadCookieConsentDialog);
16
+ const PrivacyPolicyUpdateDialog = dynamic(() => import('../../cookie_consent/client/components/privacy_policy_update_dialog.js'));
17
+ export default function ClientExtensions({ initialAuthUser = null, skipAuthProvider = false, hasFirebaseAuth, enableFirebasePerformance, hasCookieConsent, cookieConsentConfig, requiresConsent = true, autoWireDialogs = true, dialogProps, updateDialogProps, analyticsConfig, autoAnalyticsEventsConfig, children, }) {
18
+ installConsoleErrorOverride(config, true);
19
+ installGlobalErrorOverride(config);
20
+ const isConsent = hasCookieConsent ?? Boolean(config.cookieConsent);
21
+ const isAuth = hasFirebaseAuth ?? Boolean(config.firebaseAuth);
22
+ const isPerf = enableFirebasePerformance ?? (config.firebaseAuth?.performance !== false);
23
+ const resolvedConsent = cookieConsentConfig ?? (hasCookieConsent !== undefined ? undefined : config.cookieConsent);
24
+ useEffect(() => {
25
+ if (!isConsent || !autoWireDialogs)
26
+ return;
27
+ loadCookieConsentDialog().catch(() => undefined);
28
+ }, [isConsent, autoWireDialogs]);
29
+ let providedChildren = children;
30
+ if (isAuth && !skipAuthProvider) {
31
+ providedChildren = (_jsxs(AuthUserProvider, { initialUser: initialAuthUser, children: [children, isPerf && (_jsx(Suspense, { fallback: null, children: _jsx(AutoFirebasePerformanceEvents, {}) }))] }));
32
+ }
33
+ if (isConsent) {
34
+ providedChildren = (_jsxs(CookieConsentProvider, { requiresConsent: requiresConsent, cookieConsentConfig: resolvedConsent, children: [providedChildren, analyticsConfig && (_jsx(Suspense, { fallback: null, children: _jsx(CookieConsentAnalytics, { config: analyticsConfig }) })), analyticsConfig && (analyticsConfig.googleAnalyticsId || analyticsConfig.googleAdsId) && (_jsx(Suspense, { fallback: null, children: _jsx(AutoAnalyticsEvents, { config: autoAnalyticsEventsConfig ?? resolvedConsent?.autoAnalyticsEvents }) })), autoWireDialogs && (_jsxs(_Fragment, { children: [_jsx(Suspense, { fallback: null, children: _jsx(CookieConsentDialog, { ...(dialogProps ?? resolvedConsent?.dialogProps) }) }), _jsx(Suspense, { fallback: null, children: _jsx(PrivacyPolicyUpdateDialog, { ...(updateDialogProps ?? resolvedConsent?.updateDialogProps) }) })] }))] }));
35
+ }
36
+ return (_jsxs(_Fragment, { children: [_jsx(ClientThemeScript, {}), providedChildren] }));
37
+ }
@@ -1 +1,2 @@
1
- export default function ClientHelperScript(): null;
1
+ export * from 'cloudflare-next-intl-theme/ClientThemeScript';
2
+ export { default } from 'cloudflare-next-intl-theme/ClientThemeScript';
@@ -1,15 +1,2 @@
1
- 'use client';
2
- import { useEffect } from "react";
3
- import { isDarkCookieKey } from "../../config/index.js";
4
- import getCookie from "../functions/get_cookie.js";
5
- export default function ClientHelperScript() {
6
- useEffect(() => {
7
- const isDark = getCookie(isDarkCookieKey);
8
- const classList = document.documentElement.classList;
9
- const isDarkBool = isDark === 'true';
10
- if (classList.contains('dark') !== isDarkBool) {
11
- classList.toggle('dark', isDarkBool);
12
- }
13
- }, []);
14
- return null;
15
- }
1
+ export * from 'cloudflare-next-intl-theme/ClientThemeScript';
2
+ export { default } from 'cloudflare-next-intl-theme/ClientThemeScript';
@@ -1,20 +1,11 @@
1
- import type { TranslationObject } from "../../types/types.js";
2
- import type { SerializedAuthUser } from "../../firebase_auth/types.js";
3
- import type { CookieConsentAnalyticsConfig, AutoAnalyticsEventsConfig } from "../../types/types.js";
4
- import type { CookieConsentDialogProps } from "../../cookie_consent/client/components/cookie_consent_dialog.js";
5
- import type { PrivacyPolicyUpdateDialogProps } from "../../cookie_consent/client/components/privacy_policy_update_dialog.js";
6
- import { LocaleContext } from "./locale_provider.js";
1
+ import React from 'react';
2
+ import { LocaleContext } from 'cloudflare-next-intl-intl/internal/clientProvider';
3
+ import { type ClientExtensionsProps } from './client_extensions.js';
4
+ import type { TranslationObject } from 'cloudflare-next-intl-intl/types';
7
5
  export { LocaleContext };
8
- export default function LocationzationClientProvider({ language, messages, initialAuthUser, skipAuthProvider, analyticsConfig, autoAnalyticsEventsConfig, requiresConsent, autoWireDialogs, dialogProps, updateDialogProps, children }: {
6
+ export interface LocationzationClientProviderProps extends ClientExtensionsProps {
9
7
  language: string;
10
8
  messages: TranslationObject;
11
- initialAuthUser?: SerializedAuthUser | null;
12
- skipAuthProvider?: boolean;
13
- analyticsConfig?: CookieConsentAnalyticsConfig;
14
- autoAnalyticsEventsConfig?: AutoAnalyticsEventsConfig;
15
- requiresConsent?: boolean;
16
- autoWireDialogs?: boolean;
17
- dialogProps?: CookieConsentDialogProps;
18
- updateDialogProps?: PrivacyPolicyUpdateDialogProps;
19
9
  children: React.ReactNode;
20
- }): Component;
10
+ }
11
+ export default function LocationzationClientProvider({ language, messages, children, ...clientExtensionProps }: LocationzationClientProviderProps): React.JSX.Element;
@@ -1,38 +1,8 @@
1
- "use client";
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { setLocaleCache, setMessageForLocaleCache } from "../../general/cache_variables.js";
4
- import { useEffect, useMemo, Suspense } from "react";
5
- import dynamic from "next/dynamic.js";
6
- import CookieConsentProvider from "../../cookie_consent/client/cookie_consent_provider.js";
7
- import AuthUserProvider from "../../firebase_auth/client/auth_user_provider.js";
8
- import config from "@intl-config";
9
- import installConsoleErrorOverride from "../../error_handling/install_console_error_override.js";
10
- import installGlobalErrorOverride from "../../error_handling/install_global_error_override.js";
11
- import { LocaleContext } from "./locale_provider.js";
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import LocationzationClientProviderCore, { LocaleContext } from 'cloudflare-next-intl-intl/internal/clientProvider';
4
+ import ClientExtensions from './client_extensions.js';
12
5
  export { LocaleContext };
13
- const AutoFirebasePerformanceEvents = dynamic(() => import("../../firebase_auth/client/components/auto_firebase_performance_events.js"));
14
- const CookieConsentAnalytics = dynamic(() => import("../../cookie_consent/client/components/cookie_consent_analytics.js"));
15
- const AutoAnalyticsEvents = dynamic(() => import("../../cookie_consent/client/components/auto_analytics_events.js"));
16
- const loadCookieConsentDialog = () => import("../../cookie_consent/client/components/cookie_consent_dialog.js");
17
- const CookieConsentDialog = dynamic(loadCookieConsentDialog);
18
- const PrivacyPolicyUpdateDialog = dynamic(() => import("../../cookie_consent/client/components/privacy_policy_update_dialog.js"));
19
- export default function LocationzationClientProvider({ language, messages, initialAuthUser = null, skipAuthProvider = false, analyticsConfig, autoAnalyticsEventsConfig, requiresConsent = true, autoWireDialogs = true, dialogProps, updateDialogProps, children }) {
20
- setLocaleCache(language);
21
- setMessageForLocaleCache(language, messages);
22
- installConsoleErrorOverride(config, true);
23
- installGlobalErrorOverride(config);
24
- useEffect(() => {
25
- if (!config.cookieConsent || !autoWireDialogs)
26
- return;
27
- loadCookieConsentDialog().catch(() => undefined);
28
- }, [autoWireDialogs]);
29
- let providedChildren = children;
30
- if (config.firebaseAuth && !skipAuthProvider) {
31
- providedChildren = _jsxs(AuthUserProvider, { initialUser: initialAuthUser, children: [children, config.firebaseAuth.performance !== false && (_jsx(Suspense, { fallback: null, children: _jsx(AutoFirebasePerformanceEvents, {}) }))] });
32
- }
33
- if (config.cookieConsent) {
34
- providedChildren = _jsxs(CookieConsentProvider, { requiresConsent: requiresConsent, children: [providedChildren, analyticsConfig && (_jsx(Suspense, { fallback: null, children: _jsx(CookieConsentAnalytics, { config: analyticsConfig }) })), analyticsConfig && (analyticsConfig.googleAnalyticsId || analyticsConfig.googleAdsId) && (_jsx(Suspense, { fallback: null, children: _jsx(AutoAnalyticsEvents, { config: autoAnalyticsEventsConfig ?? config.cookieConsent?.autoAnalyticsEvents }) })), autoWireDialogs && (_jsx(Suspense, { fallback: null, children: _jsx(CookieConsentDialog, { ...(dialogProps ?? config.cookieConsent?.dialogProps) }) })), autoWireDialogs && (_jsx(Suspense, { fallback: null, children: _jsx(PrivacyPolicyUpdateDialog, { ...(updateDialogProps ?? config.cookieConsent?.updateDialogProps) }) }))] });
35
- }
36
- const contextValue = useMemo(() => ({ language, messages }), [language, messages]);
37
- return _jsx(LocaleContext.Provider, { value: contextValue, children: providedChildren });
6
+ export default function LocationzationClientProvider({ language, messages, children, ...clientExtensionProps }) {
7
+ return (_jsx(LocationzationClientProviderCore, { language: language, messages: messages, children: _jsx(ClientExtensions, { ...clientExtensionProps, children: children }) }));
38
8
  }
@@ -1,21 +1,2 @@
1
- import type { TranslationObject } from "../../types/types.js";
2
- import type { CookieConsentAnalyticsConfig, AutoAnalyticsEventsConfig } from "../../types/types.js";
3
- import type { CookieConsentDialogProps } from "../../cookie_consent/client/components/cookie_consent_dialog.js";
4
- import type { PrivacyPolicyUpdateDialogProps } from "../../cookie_consent/client/components/privacy_policy_update_dialog.js";
5
- interface LocaleContextType {
6
- language: string;
7
- messages: TranslationObject;
8
- }
9
- export declare const LocaleContext: import("react").Context<LocaleContextType | undefined>;
10
- export default function LocationzationClientProvider({ language, messages, analyticsConfig, autoAnalyticsEventsConfig, requiresConsent, autoWireDialogs, dialogProps, updateDialogProps, children }: {
11
- language: string;
12
- messages: TranslationObject;
13
- analyticsConfig?: CookieConsentAnalyticsConfig;
14
- autoAnalyticsEventsConfig?: AutoAnalyticsEventsConfig;
15
- requiresConsent?: boolean;
16
- autoWireDialogs?: boolean;
17
- dialogProps?: CookieConsentDialogProps;
18
- updateDialogProps?: PrivacyPolicyUpdateDialogProps;
19
- children: React.ReactNode;
20
- }): Component;
21
- export {};
1
+ export * from 'cloudflare-next-intl-intl/internal/clientProviderStatic';
2
+ export { default } from 'cloudflare-next-intl-intl/internal/clientProviderStatic';
@@ -1,26 +1,2 @@
1
- "use client";
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { setLocaleCache, setMessageForLocaleCache } from "../../general/cache_variables.js";
4
- import { createContext, useMemo, Suspense } from "react";
5
- import dynamic from "next/dynamic.js";
6
- import CookieConsentProvider from "../../cookie_consent/client/cookie_consent_provider.js";
7
- import config from "@intl-config";
8
- import installConsoleErrorOverride from "../../error_handling/install_console_error_override.js";
9
- import installGlobalErrorOverride from "../../error_handling/install_global_error_override.js";
10
- export const LocaleContext = createContext(undefined);
11
- const CookieConsentAnalytics = dynamic(() => import("../../cookie_consent/client/components/cookie_consent_analytics.js"));
12
- const AutoAnalyticsEvents = dynamic(() => import("../../cookie_consent/client/components/auto_analytics_events.js"));
13
- const CookieConsentDialog = dynamic(() => import("../../cookie_consent/client/components/cookie_consent_dialog.js"));
14
- const PrivacyPolicyUpdateDialog = dynamic(() => import("../../cookie_consent/client/components/privacy_policy_update_dialog.js"));
15
- export default function LocationzationClientProvider({ language, messages, analyticsConfig, autoAnalyticsEventsConfig, requiresConsent = true, autoWireDialogs = true, dialogProps, updateDialogProps, children }) {
16
- setLocaleCache(language);
17
- setMessageForLocaleCache(language, messages);
18
- installConsoleErrorOverride(config, true);
19
- installGlobalErrorOverride(config);
20
- let providedChildren = children;
21
- if (config.cookieConsent) {
22
- providedChildren = _jsxs(CookieConsentProvider, { requiresConsent: requiresConsent, children: [providedChildren, analyticsConfig && (_jsx(Suspense, { fallback: null, children: _jsx(CookieConsentAnalytics, { config: analyticsConfig }) })), analyticsConfig && (analyticsConfig.googleAnalyticsId || analyticsConfig.googleAdsId) && (_jsx(Suspense, { fallback: null, children: _jsx(AutoAnalyticsEvents, { config: autoAnalyticsEventsConfig ?? config.cookieConsent?.autoAnalyticsEvents }) })), autoWireDialogs && (_jsx(Suspense, { fallback: null, children: _jsx(CookieConsentDialog, { ...(dialogProps ?? config.cookieConsent?.dialogProps) }) })), autoWireDialogs && (_jsx(Suspense, { fallback: null, children: _jsx(PrivacyPolicyUpdateDialog, { ...(updateDialogProps ?? config.cookieConsent?.updateDialogProps) }) }))] });
23
- }
24
- const contextValue = useMemo(() => ({ language, messages }), [language, messages]);
25
- return _jsx(LocaleContext.Provider, { value: contextValue, children: providedChildren });
26
- }
1
+ export * from 'cloudflare-next-intl-intl/internal/clientProviderStatic';
2
+ export { default } from 'cloudflare-next-intl-intl/internal/clientProviderStatic';
@@ -1,8 +1,2 @@
1
- import { type LinkProps } from 'next/link.js';
2
- import { type ComponentProps } from 'react';
3
- type NextLinkProps = Omit<ComponentProps<'a'>, keyof LinkProps> & Omit<LinkProps, 'locale' | 'href' | 'prefetch' | 'onNavigate' | 'hrefLang' | 'replace' | 'scroll'>;
4
- export type LocaleLinkProps = NextLinkProps & {
5
- locale: string;
6
- };
7
- declare const LocaleLink: import("react").ForwardRefExoticComponent<Omit<LocaleLinkProps, "ref"> & import("react").RefAttributes<HTMLAnchorElement>>;
8
- export default LocaleLink;
1
+ export * from 'cloudflare-next-intl-intl/LocaleLink';
2
+ export { default } from 'cloudflare-next-intl-intl/LocaleLink';
@@ -1,8 +1,2 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { forwardRef, Suspense, } from 'react';
3
- import LocaleLinkClient from './locale_link_client.js';
4
- function LocaleLinkComponent(params, ref) {
5
- return _jsx(Suspense, { fallback: _jsx("a", { ...params, ref: ref, className: params.className + ' pointer-events-none' }), children: _jsx(LocaleLinkClient, { ref: ref, ...params }) });
6
- }
7
- const LocaleLink = forwardRef(LocaleLinkComponent);
8
- export default LocaleLink;
1
+ export * from 'cloudflare-next-intl-intl/LocaleLink';
2
+ export { default } from 'cloudflare-next-intl-intl/LocaleLink';
@@ -1,3 +1,2 @@
1
- import type { LocaleLinkProps } from './locale_link.js';
2
- declare const LocaleLinkClient: import("react").ForwardRefExoticComponent<Omit<LocaleLinkProps, "ref"> & import("react").RefAttributes<HTMLAnchorElement>>;
3
- export default LocaleLinkClient;
1
+ export * from 'cloudflare-next-intl-intl/internal/localeLinkClient';
2
+ export { default } from 'cloudflare-next-intl-intl/internal/localeLinkClient';
@@ -1,30 +1,2 @@
1
- "use client";
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- import { forwardRef, useEffect, useState, } from 'react';
4
- import config from '../../config/intl_config.js';
5
- import usePathname from '../hooks/use_path_name.js';
6
- import { localeCookieName } from '../../config/cookie_key.js';
7
- import setCookie from '../functions/set_cookie.js';
8
- import { useSearchParams } from 'next/navigation.js';
9
- function ClientLocaleLinkComponent({ locale, className, ...rest }, ref) {
10
- const pathname = usePathname();
11
- const searchParams = useSearchParams();
12
- const [hash, setHash] = useState('');
13
- useEffect(() => {
14
- setHash(window.location.hash);
15
- }, [pathname, searchParams]);
16
- const isDefaultLocale = locale === config.defaultLocale;
17
- const localePrefix = isDefaultLocale ? '' : `/${locale}`;
18
- const search = searchParams.toString();
19
- const newPathname = pathname === '/' && (localePrefix) ? '' : pathname;
20
- const href = `${localePrefix}${newPathname}${search ? `?${search}` : ''}${hash}`;
21
- function handleNavigate(e) {
22
- e.preventDefault();
23
- setCookie({ name: localeCookieName, value: locale });
24
- window.location.replace(href);
25
- }
26
- ;
27
- return _jsx("a", { ref: ref, hrefLang: locale, className: className, ...rest, href: href, onClick: handleNavigate });
28
- }
29
- const LocaleLinkClient = forwardRef(ClientLocaleLinkComponent);
30
- export default LocaleLinkClient;
1
+ export * from 'cloudflare-next-intl-intl/internal/localeLinkClient';
2
+ export { default } from 'cloudflare-next-intl-intl/internal/localeLinkClient';
@@ -1,13 +1,2 @@
1
- import { type ReactNode } from "react";
2
- import type { TranslationObject } from "../../types/types.js";
3
- interface LocaleContextType {
4
- language: string;
5
- messages: TranslationObject;
6
- }
7
- export declare const LocaleContext: import("react").Context<LocaleContextType | undefined>;
8
- export default function LocaleProvider({ language, messages, children }: {
9
- language: string;
10
- messages: TranslationObject;
11
- children: ReactNode;
12
- }): React.JSX.Element;
13
- export {};
1
+ export * from 'cloudflare-next-intl-intl/internal/localeProvider';
2
+ export { default, LocaleContext } from 'cloudflare-next-intl-intl/internal/localeProvider';
@@ -1,8 +1,2 @@
1
- "use client";
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- import { createContext, useMemo } from "react";
4
- export const LocaleContext = createContext(undefined);
5
- export default function LocaleProvider({ language, messages, children }) {
6
- const value = useMemo(() => ({ language, messages }), [language, messages]);
7
- return _jsx(LocaleContext.Provider, { value: value, children: children });
8
- }
1
+ export * from 'cloudflare-next-intl-intl/internal/localeProvider';
2
+ export { default, LocaleContext } from 'cloudflare-next-intl-intl/internal/localeProvider';
@@ -1 +1,2 @@
1
- export default function getCookie(name: string): string | null;
1
+ export * from 'cloudflare-next-intl-intl/getCookieClient';
2
+ export { default } from 'cloudflare-next-intl-intl/getCookieClient';
@@ -1,32 +1,2 @@
1
- "use client";
2
- import reportError from "../../error_handling/report_error.js";
3
- export default function getCookie(name) {
4
- try {
5
- const cookie = document.cookie;
6
- const prefix = `${name}=`;
7
- let start = -1;
8
- if (cookie.startsWith(prefix)) {
9
- start = prefix.length;
10
- }
11
- else {
12
- const idx = cookie.indexOf(`; ${prefix}`);
13
- if (idx !== -1)
14
- start = idx + 2 + prefix.length;
15
- }
16
- if (start === -1)
17
- return null;
18
- const end = cookie.indexOf(';', start);
19
- const value = end === -1 ? cookie.slice(start) : cookie.slice(start, end);
20
- return decodeURIComponent(value);
21
- }
22
- catch (e) {
23
- void reportError(undefined, {
24
- error: e,
25
- classOrMethodName: 'getCookie',
26
- isClient: true,
27
- params: { name },
28
- });
29
- return null;
30
- }
31
- }
32
- ;
1
+ export * from 'cloudflare-next-intl-intl/getCookieClient';
2
+ export { default } from 'cloudflare-next-intl-intl/getCookieClient';
@@ -1,5 +1,2 @@
1
- export default function setCookie({ name, value, maxAge }: {
2
- name: string;
3
- value: string | number | boolean;
4
- maxAge?: number;
5
- }): void;
1
+ export * from 'cloudflare-next-intl-intl/setCookieClient';
2
+ export { default } from 'cloudflare-next-intl-intl/setCookieClient';
@@ -1,17 +1,2 @@
1
- "use client";
2
- import reportError from "../../error_handling/report_error.js";
3
- export default function setCookie({ name, value, maxAge }) {
4
- try {
5
- const cookieString = `${name}=${value}; path=/; max-age=${maxAge ?? 31536000}; SameSite=Lax;`;
6
- document.cookie = cookieString;
7
- }
8
- catch (e) {
9
- void reportError(undefined, {
10
- error: e,
11
- classOrMethodName: 'setCookie',
12
- isClient: true,
13
- params: { name },
14
- });
15
- }
16
- }
17
- ;
1
+ export * from 'cloudflare-next-intl-intl/setCookieClient';
2
+ export { default } from 'cloudflare-next-intl-intl/setCookieClient';
@@ -1,3 +1 @@
1
- import type { TranslatorReturnType } from "../../types/types.js";
2
- export declare function useLocale(): string;
3
- export declare function useTranslations(namespace: string): TranslatorReturnType;
1
+ export * from 'cloudflare-next-intl-intl/internal/clientHooks';
@@ -1,19 +1 @@
1
- "use client";
2
- import { useContext, useMemo } from "react";
3
- import { LocaleContext } from "../components/client_provider.js";
4
- import { getTranslationsImpl } from "../../general/general_functions.js";
5
- export function useLocale() {
6
- const context = useContext(LocaleContext);
7
- if (context === undefined) {
8
- throw new Error('useLocale must be used within an IntlProvider');
9
- }
10
- return context.language;
11
- }
12
- export function useTranslations(namespace) {
13
- const context = useContext(LocaleContext);
14
- if (context === undefined) {
15
- throw new Error('useTranslations must be used within an IntlProvider');
16
- }
17
- const { language, messages } = context;
18
- return useMemo(() => getTranslationsImpl(language, messages, namespace), [language, messages, namespace]);
19
- }
1
+ export * from 'cloudflare-next-intl-intl/internal/clientHooks';
@@ -1 +1,2 @@
1
- export default function usePathname(): string;
1
+ export * from 'cloudflare-next-intl-intl/usePathname';
2
+ export { default, usePathname } from 'cloudflare-next-intl-intl/usePathname';
@@ -1,17 +1,2 @@
1
- "use client";
2
- import { usePathname as nextUsePathname } from "next/navigation.js";
3
- import { useLocale } from "./client_hooks.js";
4
- export default function usePathname() {
5
- const pathname = nextUsePathname();
6
- const locale = useLocale();
7
- if (!pathname) {
8
- return '/';
9
- }
10
- const path = pathname.replace(`/${locale}`, '');
11
- if (path) {
12
- return path;
13
- }
14
- else {
15
- return '/';
16
- }
17
- }
1
+ export * from 'cloudflare-next-intl-intl/usePathname';
2
+ export { default, usePathname } from 'cloudflare-next-intl-intl/usePathname';
@@ -1,4 +1,8 @@
1
+ export { default as LocaleProvider, LocaleContext } from './components/locale_provider.js';
2
+ export { default as LocationzationClientProvider } from './components/client_provider.js';
1
3
  export { default as LocaleLink } from './components/locale_link.js';
2
- export { default as usePathname } from './hooks/use_path_name.js';
3
- export { default as setCookieClient } from './functions/set_cookie.js';
4
- export { default as getCookieClient } from './functions/get_cookie.js';
4
+ export { default as LocaleLinkClient } from './components/locale_link_client.js';
5
+ export { default as getCookie } from './functions/get_cookie.js';
6
+ export { default as setCookie } from './functions/set_cookie.js';
7
+ export { usePathname } from './hooks/use_path_name.js';
8
+ export { useLocale, useTranslations } from './hooks/client_hooks.js';
@@ -1,4 +1,8 @@
1
+ export { default as LocaleProvider, LocaleContext } from './components/locale_provider.js';
2
+ export { default as LocationzationClientProvider } from './components/client_provider.js';
1
3
  export { default as LocaleLink } from './components/locale_link.js';
2
- export { default as usePathname } from './hooks/use_path_name.js';
3
- export { default as setCookieClient } from './functions/set_cookie.js';
4
- export { default as getCookieClient } from './functions/get_cookie.js';
4
+ export { default as LocaleLinkClient } from './components/locale_link_client.js';
5
+ export { default as getCookie } from './functions/get_cookie.js';
6
+ export { default as setCookie } from './functions/set_cookie.js';
7
+ export { usePathname } from './hooks/use_path_name.js';
8
+ export { useLocale, useTranslations } from './hooks/client_hooks.js';
@@ -1,3 +1 @@
1
- export { scanFile, type FileScanResult, type DynamicCall } from "./scan_file.js";
2
- export { matchesNamespacePattern } from "./match_namespace.js";
3
- export { scanProject, type ScanProjectOptions, type ClientMessagesManifest } from "./scan_project.js";
1
+ export * from "cloudflare-next-intl-intl/internal/clientMessagesScan";
@@ -1,3 +1 @@
1
- export { scanFile } from "./scan_file.js";
2
- export { matchesNamespacePattern } from "./match_namespace.js";
3
- export { scanProject } from "./scan_project.js";
1
+ export * from "cloudflare-next-intl-intl/internal/clientMessagesScan";
@@ -1 +1 @@
1
- export declare function matchesNamespacePattern(ns: string, pattern: string): boolean;
1
+ export * from "cloudflare-next-intl-intl/internal/matchNamespace";
@@ -1,3 +1 @@
1
- export function matchesNamespacePattern(ns, pattern) {
2
- return pattern.endsWith("*") ? ns.startsWith(pattern.slice(0, -1)) : ns === pattern;
3
- }
1
+ export * from "cloudflare-next-intl-intl/internal/matchNamespace";
@@ -1,16 +1 @@
1
- export interface DynamicCall {
2
- file: string;
3
- line: number;
4
- text: string;
5
- prop?: {
6
- component: string;
7
- name: string;
8
- };
9
- }
10
- export interface FileScanResult {
11
- namespaces: string[];
12
- dynamicCalls: DynamicCall[];
13
- usesRoot: boolean;
14
- }
15
- export declare function findJsxPropValues(file: string, code: string, component: string, prop: string): string[] | null;
16
- export declare function scanFile(file: string, code: string): FileScanResult;
1
+ export * from "cloudflare-next-intl-intl/internal/scanFile";