cloudflare-next-intl 0.8.61 → 0.9.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/README.md +55 -7
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/package.json +1 -312
- package/dist/src/client/components/client_helper_script.js +2 -2
- package/dist/src/client/components/client_provider.d.ts +5 -17
- package/dist/src/client/components/client_provider.js +10 -22
- package/dist/src/client/components/client_provider_static.d.ts +4 -15
- package/dist/src/client/components/client_provider_static.js +8 -16
- package/dist/src/client/components/locale_link.d.ts +0 -22
- package/dist/src/client/components/locale_link.js +1 -23
- package/dist/src/client/components/locale_link_client.d.ts +1 -1
- package/dist/src/client/components/locale_link_client.js +4 -5
- package/dist/src/client/functions/get_cookie.d.ts +0 -9
- package/dist/src/client/functions/get_cookie.js +1 -10
- package/dist/src/client/functions/set_cookie.d.ts +0 -16
- package/dist/src/client/functions/set_cookie.js +1 -17
- package/dist/src/client/hooks/client_hooks.d.ts +1 -26
- package/dist/src/client/hooks/client_hooks.js +2 -27
- package/dist/src/client/hooks/use_path_name.d.ts +0 -9
- package/dist/src/client/hooks/use_path_name.js +1 -10
- package/dist/src/client/index.d.ts +4 -4
- package/dist/src/client/index.js +4 -8
- package/dist/src/config/index.d.ts +4 -4
- package/dist/src/config/index.js +4 -4
- package/dist/src/config/init_config.d.ts +1 -22
- package/dist/src/config/init_config.js +1 -31
- package/dist/src/config/intl_config.d.ts +1 -1
- package/dist/src/config/intl_sitemap.d.ts +1 -1
- package/dist/src/config/intl_sitemap.js +2 -2
- package/dist/src/config/middleware.d.ts +1 -14
- package/dist/src/config/middleware.js +11 -48
- package/dist/src/cookie_consent/client/components/auto_analytics_events.d.ts +1 -9
- package/dist/src/cookie_consent/client/components/auto_analytics_events.js +3 -12
- package/dist/src/cookie_consent/client/components/clarity_script.d.ts +0 -7
- package/dist/src/cookie_consent/client/components/clarity_script.js +1 -8
- package/dist/src/cookie_consent/client/components/cookie_consent_analytics.d.ts +1 -15
- package/dist/src/cookie_consent/client/components/cookie_consent_analytics.js +2 -20
- package/dist/src/cookie_consent/client/components/cookie_consent_dialog.d.ts +1 -24
- package/dist/src/cookie_consent/client/components/cookie_consent_dialog.js +6 -12
- package/dist/src/cookie_consent/client/components/default_dialog_styles.d.ts +1 -1
- package/dist/src/cookie_consent/client/components/default_privacy_policy_link.d.ts +0 -8
- package/dist/src/cookie_consent/client/components/default_privacy_policy_link.js +2 -10
- package/dist/src/cookie_consent/client/components/dialog_portal.d.ts +0 -8
- package/dist/src/cookie_consent/client/components/dialog_portal.js +0 -8
- package/dist/src/cookie_consent/client/components/privacy_policy_update_dialog.d.ts +1 -22
- package/dist/src/cookie_consent/client/components/privacy_policy_update_dialog.js +6 -12
- package/dist/src/cookie_consent/client/cookie_consent_provider.d.ts +1 -34
- package/dist/src/cookie_consent/client/cookie_consent_provider.js +8 -60
- package/dist/src/cookie_consent/client/use_cookie_consent.d.ts +1 -5
- package/dist/src/cookie_consent/client/use_cookie_consent.js +1 -5
- package/dist/src/cookie_consent/gdpr_countries.d.ts +1 -6
- package/dist/src/cookie_consent/gdpr_countries.js +2 -17
- package/dist/src/cookie_consent/index.d.ts +10 -10
- package/dist/src/cookie_consent/index.js +6 -6
- package/dist/src/cookie_consent/require_config.d.ts +1 -6
- package/dist/src/cookie_consent/require_config.js +0 -5
- package/dist/src/cookie_consent/types.d.ts +0 -42
- package/dist/src/db/access_token.d.ts +1 -13
- package/dist/src/db/access_token.js +2 -14
- package/dist/src/db/codegen_paths.d.ts +0 -1
- package/dist/src/db/codegen_paths.js +0 -6
- package/dist/src/db/connection.d.ts +7 -33
- package/dist/src/db/connection.js +6 -43
- package/dist/src/db/context.d.ts +4 -27
- package/dist/src/db/context.js +25 -104
- package/dist/src/db/encode_param.d.ts +0 -9
- package/dist/src/db/encode_param.js +0 -11
- package/dist/src/db/eslint_config.d.ts +0 -9
- package/dist/src/db/eslint_config.js +0 -9
- package/dist/src/db/helpers.d.ts +0 -61
- package/dist/src/db/helpers.js +0 -63
- package/dist/src/db/index.d.ts +4 -42
- package/dist/src/db/index.js +2 -40
- package/dist/src/db/inline_params.d.ts +0 -17
- package/dist/src/db/inline_params.js +37 -32
- package/dist/src/db/install_exec.d.ts +0 -14
- package/dist/src/db/install_exec.js +0 -12
- package/dist/src/db/parse_composite.d.ts +0 -16
- package/dist/src/db/parse_composite.js +6 -25
- package/dist/src/db/parse_statement.d.ts +1 -10
- package/dist/src/db/parse_statement.js +3 -16
- package/dist/src/db/parse_where.d.ts +1 -19
- package/dist/src/db/parse_where.js +88 -96
- package/dist/src/db/require_config.d.ts +1 -14
- package/dist/src/db/require_config.js +0 -13
- package/dist/src/db/resolve_config_value.d.ts +1 -11
- package/dist/src/db/resolve_config_value.js +0 -10
- package/dist/src/db/resolve_db_config.d.ts +3 -0
- package/dist/src/db/resolve_db_config.js +11 -0
- package/dist/src/db/resolve_mode.d.ts +1 -28
- package/dist/src/db/resolve_mode.js +1 -21
- package/dist/src/db/resolve_raw_sql.d.ts +0 -16
- package/dist/src/db/resolve_raw_sql.js +0 -16
- package/dist/src/db/rest_client.d.ts +2 -25
- package/dist/src/db/rest_client.js +1 -15
- package/dist/src/db/rest_execute.d.ts +2 -21
- package/dist/src/db/rest_execute.js +2 -21
- package/dist/src/db/rest_filters.d.ts +1 -28
- package/dist/src/db/rest_filters.js +1 -24
- package/dist/src/db/schema.d.ts +0 -6
- package/dist/src/db/schema.js +0 -6
- package/dist/src/db/sql_tokens.d.ts +0 -13
- package/dist/src/db/sql_tokens.js +17 -39
- package/dist/src/db/supabase_config.d.ts +1 -14
- package/dist/src/db/supabase_config.js +1 -11
- package/dist/src/db/supabase_transport.d.ts +1 -42
- package/dist/src/db/supabase_transport.js +6 -48
- package/dist/src/db/testing.d.ts +0 -57
- package/dist/src/db/testing.js +0 -57
- package/dist/src/db/transaction_batch.d.ts +2 -26
- package/dist/src/db/transaction_batch.js +3 -32
- package/dist/src/db/unsupported_sql.d.ts +0 -12
- package/dist/src/db/unsupported_sql.js +0 -11
- package/dist/src/error_handling/clear_client_cache.js +0 -1
- package/dist/src/error_handling/create_server_error_action.d.ts +2 -37
- package/dist/src/error_handling/create_server_error_action.js +2 -44
- package/dist/src/error_handling/default_ignored_console_errors.d.ts +0 -12
- package/dist/src/error_handling/default_ignored_console_errors.js +0 -15
- package/dist/src/error_handling/format_error_message.d.ts +1 -8
- package/dist/src/error_handling/format_error_message.js +1 -8
- package/dist/src/error_handling/index.d.ts +13 -13
- package/dist/src/error_handling/index.js +10 -10
- package/dist/src/error_handling/install_console_error_override.d.ts +1 -56
- package/dist/src/error_handling/install_console_error_override.js +1 -70
- package/dist/src/error_handling/install_global_error_override.d.ts +1 -19
- package/dist/src/error_handling/install_global_error_override.js +2 -20
- package/dist/src/error_handling/is_stale_deploy_error.js +2 -8
- package/dist/src/error_handling/report_error.d.ts +1 -46
- package/dist/src/error_handling/report_error.js +3 -80
- package/dist/src/error_handling/stringify_unknown.d.ts +0 -10
- package/dist/src/error_handling/stringify_unknown.js +0 -12
- package/dist/src/error_handling/use_stale_deploy_recovery.d.ts +0 -16
- package/dist/src/error_handling/use_stale_deploy_recovery.js +8 -28
- package/dist/src/error_handling/with_error_handling.d.ts +2 -8
- package/dist/src/error_handling/with_error_handling.js +1 -6
- package/dist/src/firebase_auth/client/auth_actions.d.ts +2 -79
- package/dist/src/firebase_auth/client/auth_actions.js +4 -81
- package/dist/src/firebase_auth/client/auth_user_cache.d.ts +1 -1
- package/dist/src/firebase_auth/client/auth_user_cache.js +0 -2
- package/dist/src/firebase_auth/client/auth_user_provider.d.ts +2 -25
- package/dist/src/firebase_auth/client/auth_user_provider.js +15 -116
- package/dist/src/firebase_auth/client/components/auto_firebase_performance_events.d.ts +0 -8
- package/dist/src/firebase_auth/client/components/auto_firebase_performance_events.js +3 -17
- package/dist/src/firebase_auth/client/firebase_client.d.ts +5 -14
- package/dist/src/firebase_auth/client/firebase_client.js +9 -49
- package/dist/src/firebase_auth/client/use_auth_user.d.ts +1 -11
- package/dist/src/firebase_auth/client/use_auth_user.js +1 -11
- package/dist/src/firebase_auth/decode_jwt_payload.d.ts +0 -20
- package/dist/src/firebase_auth/decode_jwt_payload.js +2 -22
- package/dist/src/firebase_auth/error_messages/firebase_auth_error_helper.d.ts +0 -5
- package/dist/src/firebase_auth/error_messages/firebase_auth_error_helper.js +3 -12
- package/dist/src/firebase_auth/index.d.ts +10 -10
- package/dist/src/firebase_auth/index.js +8 -14
- package/dist/src/firebase_auth/is_whitelisted.d.ts +0 -7
- package/dist/src/firebase_auth/is_whitelisted.js +1 -8
- package/dist/src/firebase_auth/middleware/update_session.d.ts +0 -32
- package/dist/src/firebase_auth/middleware/update_session.js +21 -225
- package/dist/src/firebase_auth/preserve_redirect_query.d.ts +0 -17
- package/dist/src/firebase_auth/preserve_redirect_query.js +0 -17
- package/dist/src/firebase_auth/require_config.d.ts +1 -7
- package/dist/src/firebase_auth/require_config.js +0 -6
- package/dist/src/firebase_auth/server/auth_user_server_provider.d.ts +2 -26
- package/dist/src/firebase_auth/server/auth_user_server_provider.js +5 -32
- package/dist/src/firebase_auth/server/clear_session_action.d.ts +0 -6
- package/dist/src/firebase_auth/server/clear_session_action.js +1 -7
- package/dist/src/firebase_auth/server/firebase_server.d.ts +2 -12
- package/dist/src/firebase_auth/server/firebase_server.js +6 -71
- package/dist/src/firebase_auth/server/mint_server_app_check_token.d.ts +1 -29
- package/dist/src/firebase_auth/server/mint_server_app_check_token.js +2 -45
- package/dist/src/firebase_auth/server/sign_custom_token_remote.d.ts +0 -13
- package/dist/src/firebase_auth/server/sign_custom_token_remote.js +0 -13
- package/dist/src/firebase_auth/server/use_auth_user_server.d.ts +1 -29
- package/dist/src/firebase_auth/server/use_auth_user_server.js +1 -29
- package/dist/src/firebase_auth/types.d.ts +3 -10
- package/dist/src/general/cache_variables.d.ts +1 -5
- package/dist/src/general/cache_variables.js +1 -6
- package/dist/src/general/general_functions.d.ts +1 -1
- package/dist/src/general/general_functions.js +7 -74
- package/dist/src/general/index.d.ts +2 -2
- package/dist/src/general/index.js +2 -2
- package/dist/src/general/metadata.d.ts +0 -25
- package/dist/src/general/metadata.js +2 -27
- package/dist/src/image_optimizer/manifest.js +0 -1
- package/dist/src/image_optimizer/next_image_shim.js +2 -10
- package/dist/src/image_optimizer/process_image.d.ts +1 -6
- package/dist/src/image_optimizer/process_image.js +45 -38
- package/dist/src/image_optimizer/run.d.ts +1 -5
- package/dist/src/image_optimizer/run.js +24 -15
- package/dist/src/image_optimizer/scan_used.d.ts +0 -15
- package/dist/src/image_optimizer/scan_used.js +0 -17
- package/dist/src/image_optimizer/types.d.ts +6 -32
- package/dist/src/image_optimizer/types.js +8 -1
- package/dist/src/index.d.ts +7 -7
- package/dist/src/index.js +7 -7
- package/dist/src/server/components/helper_script.d.ts +0 -27
- package/dist/src/server/components/helper_script.js +4 -31
- package/dist/src/server/components/link.d.ts +0 -20
- package/dist/src/server/components/link.js +2 -22
- package/dist/src/server/components/server_provider.d.ts +1 -88
- package/dist/src/server/components/server_provider.js +9 -109
- package/dist/src/server/components/server_provider_static.d.ts +1 -48
- package/dist/src/server/components/server_provider_static.js +8 -62
- package/dist/src/server/functions/geo.d.ts +1 -26
- package/dist/src/server/functions/geo.js +1 -35
- package/dist/src/server/functions/get_user_locale.js +3 -7
- package/dist/src/server/functions/locale_static_params.d.ts +0 -12
- package/dist/src/server/functions/locale_static_params.js +1 -13
- package/dist/src/server/functions/server.d.ts +1 -60
- package/dist/src/server/functions/server.js +9 -84
- package/dist/src/server/functions/use_functions.d.ts +1 -28
- package/dist/src/server/functions/use_functions.js +3 -30
- package/dist/src/server/index.d.ts +6 -6
- package/dist/src/server/index.js +6 -10
- package/dist/src/theme_switcher/components/theme_switcher.d.ts +0 -10
- package/dist/src/theme_switcher/components/theme_switcher.js +6 -16
- package/dist/src/theme_switcher/components/theme_switcher_button.js +9 -10
- package/dist/src/theme_switcher/index.d.ts +1 -1
- package/dist/src/theme_switcher/index.js +1 -1
- package/dist/src/types/index.d.ts +1 -1
- package/dist/src/types/types.d.ts +4 -844
- package/dist/src/vite/locale_file_plugin.d.ts +0 -10
- package/dist/src/vite/plugin.d.ts +0 -24
- package/llms.txt +8 -0
- package/package.json +16 -5
- package/dist/src/client/functions/get_cookie.bench.d.ts +0 -1
- package/dist/src/client/functions/get_cookie.bench.js +0 -11
- package/dist/src/client/functions/set_cookie.bench.d.ts +0 -1
- package/dist/src/client/functions/set_cookie.bench.js +0 -10
- package/dist/src/client/hooks/client_hooks.bench.d.ts +0 -1
- package/dist/src/client/hooks/client_hooks.bench.js +0 -19
- package/dist/src/client/hooks/use_path_name.bench.d.ts +0 -1
- package/dist/src/client/hooks/use_path_name.bench.js +0 -16
- package/dist/src/config/cookie_key.bench.d.ts +0 -1
- package/dist/src/config/cookie_key.bench.js +0 -9
- package/dist/src/config/init_config.bench.d.ts +0 -1
- package/dist/src/config/init_config.bench.js +0 -7
- package/dist/src/config/intl_sitemap.bench.d.ts +0 -1
- package/dist/src/config/intl_sitemap.bench.js +0 -18
- package/dist/src/config/middleware.bench.d.ts +0 -1
- package/dist/src/config/middleware.bench.js +0 -34
- package/dist/src/cookie_consent/client/components/cookie_consent_analytics.bench.d.ts +0 -1
- package/dist/src/cookie_consent/client/components/cookie_consent_analytics.bench.js +0 -14
- package/dist/src/cookie_consent/client/cookie_consent_provider.bench.d.ts +0 -1
- package/dist/src/cookie_consent/client/cookie_consent_provider.bench.js +0 -31
- package/dist/src/cookie_consent/gdpr_countries.bench.d.ts +0 -1
- package/dist/src/cookie_consent/gdpr_countries.bench.js +0 -37
- package/dist/src/db/db_performance.bench.d.ts +0 -1
- package/dist/src/db/db_performance.bench.js +0 -116
- package/dist/src/error_handling/install_console_error_override.bench.d.ts +0 -1
- package/dist/src/error_handling/install_console_error_override.bench.js +0 -10
- package/dist/src/error_handling/report_error.bench.d.ts +0 -1
- package/dist/src/error_handling/report_error.bench.js +0 -25
- package/dist/src/error_handling/stringify_unknown.bench.d.ts +0 -1
- package/dist/src/error_handling/stringify_unknown.bench.js +0 -29
- package/dist/src/firebase_auth/client/auth_actions.bench.d.ts +0 -1
- package/dist/src/firebase_auth/client/auth_actions.bench.js +0 -37
- package/dist/src/firebase_auth/client/auth_user_cache.bench.d.ts +0 -1
- package/dist/src/firebase_auth/client/auth_user_cache.bench.js +0 -11
- package/dist/src/firebase_auth/client/firebase_client.bench.d.ts +0 -1
- package/dist/src/firebase_auth/client/firebase_client.bench.js +0 -28
- package/dist/src/firebase_auth/client/use_auth_user.bench.d.ts +0 -1
- package/dist/src/firebase_auth/client/use_auth_user.bench.js +0 -18
- package/dist/src/firebase_auth/decode_jwt_payload.bench.d.ts +0 -1
- package/dist/src/firebase_auth/decode_jwt_payload.bench.js +0 -35
- package/dist/src/firebase_auth/error_messages/default_messages.en.bench.d.ts +0 -1
- package/dist/src/firebase_auth/error_messages/default_messages.en.bench.js +0 -10
- package/dist/src/firebase_auth/error_messages/firebase_auth_error_helper.bench.d.ts +0 -1
- package/dist/src/firebase_auth/error_messages/firebase_auth_error_helper.bench.js +0 -15
- package/dist/src/firebase_auth/middleware/update_session.bench.d.ts +0 -1
- package/dist/src/firebase_auth/middleware/update_session.bench.js +0 -45
- package/dist/src/firebase_auth/require_config.bench.d.ts +0 -1
- package/dist/src/firebase_auth/require_config.bench.js +0 -24
- package/dist/src/firebase_auth/server/firebase_server.bench.d.ts +0 -1
- package/dist/src/firebase_auth/server/firebase_server.bench.js +0 -27
- package/dist/src/firebase_auth/server/use_auth_user_server.bench.d.ts +0 -1
- package/dist/src/firebase_auth/server/use_auth_user_server.bench.js +0 -14
- package/dist/src/general/cache_variables.bench.d.ts +0 -1
- package/dist/src/general/cache_variables.bench.js +0 -21
- package/dist/src/general/general_functions.bench.d.ts +0 -1
- package/dist/src/general/general_functions.bench.js +0 -18
- package/dist/src/general/metadata.bench.d.ts +0 -1
- package/dist/src/general/metadata.bench.js +0 -15
- package/dist/src/image_optimizer/process_image.bench.d.ts +0 -1
- package/dist/src/image_optimizer/process_image.bench.js +0 -68
- package/dist/src/image_optimizer/test_helpers.d.ts +0 -3
- package/dist/src/image_optimizer/test_helpers.js +0 -25
- package/dist/src/server/components/helper_script.bench.d.ts +0 -1
- package/dist/src/server/components/helper_script.bench.js +0 -73
- package/dist/src/server/functions/geo.bench.d.ts +0 -1
- package/dist/src/server/functions/geo.bench.js +0 -14
- package/dist/src/server/functions/get_user_locale.bench.d.ts +0 -1
- package/dist/src/server/functions/get_user_locale.bench.js +0 -13
- package/dist/src/server/functions/server.bench.d.ts +0 -1
- package/dist/src/server/functions/server.bench.js +0 -39
- package/dist/src/server/functions/use_functions.bench.d.ts +0 -1
- package/dist/src/server/functions/use_functions.bench.js +0 -23
- package/dist/src/test_utils/image_optimizer_test_helpers.d.ts +0 -4
- package/dist/src/test_utils/image_optimizer_test_helpers.js +0 -40
- package/dist/src/test_utils/mock_next_server.d.ts +0 -5
- package/dist/src/test_utils/mock_next_server.js +0 -10
- package/dist/vitest.bench.config.d.ts +0 -2
- package/dist/vitest.bench.config.js +0 -18
package/README.md
CHANGED
|
@@ -277,6 +277,8 @@ export default defineConfig({
|
|
|
277
277
|
formats: ["avif", "webp"], // Target sibling formats, in browser-preference order (default: ["webp"], or `false`).
|
|
278
278
|
// Also supports: "png", "jpeg", "gif", "tiff", "heif", "jp2", "jxl"
|
|
279
279
|
quality: 80, // Compression quality (default: 80)
|
|
280
|
+
effort: 4, // Encoder effort 0-9 for avif/webp/png/heif/jxl (default: sharp's own default per format)
|
|
281
|
+
concurrency: 4, // Images processed in parallel (default: cpu count, clamped to 1-8)
|
|
280
282
|
blur: { quality: 70, stdDeviation: 20 }, // Next.js blur placeholder options (or `false`)
|
|
281
283
|
overrides: { // Per-image overrides keyed by public src path (wins over scanned <Image> props)
|
|
282
284
|
"/images/hero.png": { maxWidth: false, formats: ["webp"], blur: { quality: 80 } },
|
|
@@ -308,7 +310,7 @@ import { Image } from "cloudflare-next-intl/image";
|
|
|
308
310
|
<Image src="/images/icon.svg" formats={false} blur={false} maxWidth={false} />
|
|
309
311
|
```
|
|
310
312
|
|
|
311
|
-
Supported props: `formats` (array or `false`), `maxWidth` (number or `false`), `quality` (number), `blur` (`true`, `false`, or `{ size, quality, stdDeviation }`).
|
|
313
|
+
Supported props: `formats` (array or `false`), `maxWidth` (number or `false`), `quality` (number), `blur` (`true`, `false`, or `{ size, quality, stdDeviation }`). `effort` is not scanned from JSX props — set it via the centralized `overrides` config or the global option.
|
|
312
314
|
|
|
313
315
|
##### Multi-Size Variants (Responsive Images)
|
|
314
316
|
|
|
@@ -454,6 +456,17 @@ export async function generateMetadata({ params }) {
|
|
|
454
456
|
Set `firebaseAuth` on your `RoutingConfig` to enable — `IntlProvider` then
|
|
455
457
|
auto-wires `AuthUserProvider` and server-side `getAuthUser` session validation.
|
|
456
458
|
|
|
459
|
+
Requires `firebase` (or the scoped `@firebase/app` + `@firebase/auth` +
|
|
460
|
+
`@firebase/app-check` + `@firebase/performance` packages) as a **peer**
|
|
461
|
+
dependency — `npm install firebase` if you don't already have it. Declared as
|
|
462
|
+
a peer, not a bundled dependency, so your own `firebase` install is the one
|
|
463
|
+
and only copy that gets used: `@firebase/app` keeps its app registry
|
|
464
|
+
(`getApps()`/`initializeApp()`) as module-level state, so a second, separately
|
|
465
|
+
installed copy would silently initialize its own untracked Firebase app
|
|
466
|
+
instead of joining yours. All `firebase_auth*` subpaths load their Firebase
|
|
467
|
+
imports lazily (dynamic `import()`), so nothing is pulled in — installed or
|
|
468
|
+
bundled — for apps that never set `firebaseAuth`.
|
|
469
|
+
|
|
457
470
|
Features include:
|
|
458
471
|
- `whiteListPaths`: Array of paths exempt from auth redirects (matches exact path or path-segment prefix, e.g. `/bonds` matches `/bonds/some-slug`).
|
|
459
472
|
- `actionLinkPath`: Pinned route for handling Firebase action links (e.g. `/auth/action`), prioritized during cross-origin action link redirects.
|
|
@@ -718,6 +731,36 @@ query code is identical either way — switching is a config change only.
|
|
|
718
731
|
A direct connection always wins if both are configured, so adding a `supabase`
|
|
719
732
|
block cannot silently reroute live traffic.
|
|
720
733
|
|
|
734
|
+
#### Standalone usage (no Next.js / `@intl-config`)
|
|
735
|
+
|
|
736
|
+
`withPublicDb`/`withUserDb` normally read their `db` config from
|
|
737
|
+
`@intl-config` (Next.js apps, via `setIntlConfig`). Outside Next.js — Firebase
|
|
738
|
+
Functions, a script, any plain TypeScript project with no bundler alias to
|
|
739
|
+
set up — pass the `db` block directly as the last argument instead:
|
|
740
|
+
|
|
741
|
+
```typescript
|
|
742
|
+
// e.g. firebase/functions/src/index.ts — no @intl-config alias needed
|
|
743
|
+
import { withPublicDb, withUserDb } from "cloudflare-next-intl/db";
|
|
744
|
+
|
|
745
|
+
const rows = await withPublicDb(
|
|
746
|
+
(db) => db.select().from(bonds).limit(10),
|
|
747
|
+
{ connectionString: process.env.DATABASE_URL },
|
|
748
|
+
);
|
|
749
|
+
|
|
750
|
+
const own = await withUserDb(
|
|
751
|
+
(db) => db.select().from(invitations),
|
|
752
|
+
uid,
|
|
753
|
+
{ supabase: { url: process.env.SUPABASE_URL, anonKey: process.env.SUPABASE_ANON_KEY } },
|
|
754
|
+
);
|
|
755
|
+
```
|
|
756
|
+
|
|
757
|
+
Import the whole package (`npm install cloudflare-next-intl`) but only the
|
|
758
|
+
`cloudflare-next-intl/db` subpath — its dynamic `import()`s for `pg`/
|
|
759
|
+
`drizzle-orm`/`@supabase/supabase-js` mean nothing Next.js/React-specific ever
|
|
760
|
+
loads. This is the same `db` export Next.js apps use; the override argument is
|
|
761
|
+
additive; Next.js call sites that omit it keep reading `@intl-config` exactly
|
|
762
|
+
as before.
|
|
763
|
+
|
|
721
764
|
```typescript
|
|
722
765
|
export default setIntlConfig({
|
|
723
766
|
locales: ["en", "uk"] as const,
|
|
@@ -897,12 +940,12 @@ allowed to see the rows; call `.transaction(...)` on the handle either one
|
|
|
897
940
|
hands your callback when a write needs more than one statement to succeed or
|
|
898
941
|
fail together (see [Multi-statement transactions](#multi-statement-transactions-dbtransaction) above):
|
|
899
942
|
|
|
900
|
-
- `withPublicDb(fn)` — runs `fn` as the anonymous role: a pooled
|
|
901
|
-
with no transaction/role switch in connection-string mode, or the
|
|
902
|
-
as the PostgREST bearer token in Supabase mode. No user id is
|
|
903
|
-
either way, so RLS policies that test `auth.jwt()->>'sub'` will
|
|
904
|
-
— use `withUserDb` for user-owned rows.
|
|
905
|
-
- `withUserDb(fn, uid?)` — runs `fn` as the signed-in user. In
|
|
943
|
+
- `withPublicDb(fn, dbOverride?)` — runs `fn` as the anonymous role: a pooled
|
|
944
|
+
connection with no transaction/role switch in connection-string mode, or the
|
|
945
|
+
anon key as the PostgREST bearer token in Supabase mode. No user id is
|
|
946
|
+
attached either way, so RLS policies that test `auth.jwt()->>'sub'` will
|
|
947
|
+
deny access — use `withUserDb` for user-owned rows.
|
|
948
|
+
- `withUserDb(fn, uid?, dbOverride?)` — runs `fn` as the signed-in user. In
|
|
906
949
|
connection-string mode this opens a transaction where Postgres sees the
|
|
907
950
|
resolved user id as `auth.jwt()->>'sub'` under `db.authenticatedRole`; in
|
|
908
951
|
Supabase mode identity instead rides on the JWT from `getAccessToken`/
|
|
@@ -913,6 +956,11 @@ fail together (see [Multi-statement transactions](#multi-statement-transactions-
|
|
|
913
956
|
signed-in Firebase user when `firebaseAuth` is configured — you rarely need
|
|
914
957
|
to pass it explicitly.
|
|
915
958
|
|
|
959
|
+
`dbOverride` — a `db` block (`{ connectionString }` or `{ supabase }`) used
|
|
960
|
+
for that one call instead of `@intl-config`'s. This is what makes `db` usable
|
|
961
|
+
outside Next.js — see [Standalone usage](#standalone-usage-no-nextintl-config)
|
|
962
|
+
below.
|
|
963
|
+
|
|
916
964
|
```typescript
|
|
917
965
|
// anywhere on the server
|
|
918
966
|
import { withPublicDb } from "cloudflare-next-intl/db";
|
package/dist/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './src';
|
|
1
|
+
export * from './src/index.js';
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './src';
|
|
1
|
+
export * from './src/index.js';
|
package/dist/package.json
CHANGED
|
@@ -1,314 +1,3 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
3
|
-
"version": "0.8.53",
|
|
4
|
-
"description": "Optimized Next Intl Package Special for App Router and Cloudflare",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"types": "dist/index.d.ts",
|
|
7
|
-
"sideEffects": false,
|
|
8
|
-
"bin": {
|
|
9
|
-
"cfni-db-codegen": "bin/db_codegen.mjs",
|
|
10
|
-
"cfni-db-install-exec": "bin/db_install_exec.mjs"
|
|
11
|
-
},
|
|
12
|
-
"files": [
|
|
13
|
-
"dist",
|
|
14
|
-
"bin",
|
|
15
|
-
"supabase",
|
|
16
|
-
"LICENSE",
|
|
17
|
-
"README.md",
|
|
18
|
-
"llms.txt"
|
|
19
|
-
],
|
|
20
|
-
"exports": {
|
|
21
|
-
".": {
|
|
22
|
-
"types": "./dist/index.d.ts",
|
|
23
|
-
"import": "./dist/index.js"
|
|
24
|
-
},
|
|
25
|
-
"./client": {
|
|
26
|
-
"types": "./dist/src/client/index.d.ts",
|
|
27
|
-
"import": "./dist/src/client/index.js"
|
|
28
|
-
},
|
|
29
|
-
"./server": {
|
|
30
|
-
"types": "./dist/src/server/index.d.ts",
|
|
31
|
-
"import": "./dist/src/server/index.js"
|
|
32
|
-
},
|
|
33
|
-
"./geo": {
|
|
34
|
-
"types": "./dist/src/server/functions/geo.d.ts",
|
|
35
|
-
"import": "./dist/src/server/functions/geo.js"
|
|
36
|
-
},
|
|
37
|
-
"./getCountry": {
|
|
38
|
-
"types": "./dist/src/server/functions/geo.d.ts",
|
|
39
|
-
"import": "./dist/src/server/functions/geo.js"
|
|
40
|
-
},
|
|
41
|
-
"./getTimezone": {
|
|
42
|
-
"types": "./dist/src/server/functions/geo.d.ts",
|
|
43
|
-
"import": "./dist/src/server/functions/geo.js"
|
|
44
|
-
},
|
|
45
|
-
"./middleware": {
|
|
46
|
-
"types": "./dist/src/config/middleware.d.ts",
|
|
47
|
-
"import": "./dist/src/config/middleware.js"
|
|
48
|
-
},
|
|
49
|
-
"./setIntlConfig": {
|
|
50
|
-
"types": "./dist/src/config/init_config.d.ts",
|
|
51
|
-
"import": "./dist/src/config/init_config.js"
|
|
52
|
-
},
|
|
53
|
-
"./serverProvider": {
|
|
54
|
-
"types": "./dist/src/server/components/server_provider.d.ts",
|
|
55
|
-
"import": "./dist/src/server/components/server_provider.js"
|
|
56
|
-
},
|
|
57
|
-
"./serverProviderStatic": {
|
|
58
|
-
"types": "./dist/src/server/components/server_provider_static.d.ts",
|
|
59
|
-
"import": "./dist/src/server/components/server_provider_static.js"
|
|
60
|
-
},
|
|
61
|
-
"./Link": {
|
|
62
|
-
"types": "./dist/src/server/components/link.d.ts",
|
|
63
|
-
"import": "./dist/src/server/components/link.js"
|
|
64
|
-
},
|
|
65
|
-
"./IntlHelperScript": {
|
|
66
|
-
"types": "./dist/src/server/components/helper_script.d.ts",
|
|
67
|
-
"import": "./dist/src/server/components/helper_script.js"
|
|
68
|
-
},
|
|
69
|
-
"./LocaleLink": {
|
|
70
|
-
"types": "./dist/src/client/components/locale_link.d.ts",
|
|
71
|
-
"import": "./dist/src/client/components/locale_link.js"
|
|
72
|
-
},
|
|
73
|
-
"./usePathname": {
|
|
74
|
-
"types": "./dist/src/client/hooks/use_path_name.d.ts",
|
|
75
|
-
"import": "./dist/src/client/hooks/use_path_name.js"
|
|
76
|
-
},
|
|
77
|
-
"./metadata": {
|
|
78
|
-
"types": "./dist/src/general/metadata.d.ts",
|
|
79
|
-
"import": "./dist/src/general/metadata.js"
|
|
80
|
-
},
|
|
81
|
-
"./setCookieClient": {
|
|
82
|
-
"types": "./dist/src/client/functions/set_cookie.d.ts",
|
|
83
|
-
"import": "./dist/src/client/functions/set_cookie.js"
|
|
84
|
-
},
|
|
85
|
-
"./getCookieClient": {
|
|
86
|
-
"types": "./dist/src/client/functions/get_cookie.d.ts",
|
|
87
|
-
"import": "./dist/src/client/functions/get_cookie.js"
|
|
88
|
-
},
|
|
89
|
-
"./localeStaticParams": {
|
|
90
|
-
"types": "./dist/src/server/functions/locale_static_params.d.ts",
|
|
91
|
-
"import": "./dist/src/server/functions/locale_static_params.js"
|
|
92
|
-
},
|
|
93
|
-
"./use": {
|
|
94
|
-
"react-server": {
|
|
95
|
-
"types": "./dist/src/server/functions/use_functions.d.ts",
|
|
96
|
-
"import": "./dist/src/server/functions/use_functions.js"
|
|
97
|
-
},
|
|
98
|
-
"default": {
|
|
99
|
-
"types": "./dist/src/client/hooks/client_hooks.d.ts",
|
|
100
|
-
"import": "./dist/src/client/hooks/client_hooks.js"
|
|
101
|
-
}
|
|
102
|
-
},
|
|
103
|
-
"./ThemeSwitcher": {
|
|
104
|
-
"types": "./dist/src/theme_switcher/components/theme_switcher.d.ts",
|
|
105
|
-
"import": "./dist/src/theme_switcher/components/theme_switcher.js"
|
|
106
|
-
},
|
|
107
|
-
"./firebaseAuthClient": {
|
|
108
|
-
"types": "./dist/src/firebase_auth/client/firebase_client.d.ts",
|
|
109
|
-
"import": "./dist/src/firebase_auth/client/firebase_client.js"
|
|
110
|
-
},
|
|
111
|
-
"./firebaseAuthClientProvider": {
|
|
112
|
-
"types": "./dist/src/firebase_auth/client/auth_user_provider.d.ts",
|
|
113
|
-
"import": "./dist/src/firebase_auth/client/auth_user_provider.js"
|
|
114
|
-
},
|
|
115
|
-
"./firebaseAuthServerProvider": {
|
|
116
|
-
"types": "./dist/src/firebase_auth/server/auth_user_server_provider.d.ts",
|
|
117
|
-
"import": "./dist/src/firebase_auth/server/auth_user_server_provider.js"
|
|
118
|
-
},
|
|
119
|
-
"./useFirebaseAuthUser": {
|
|
120
|
-
"react-server": {
|
|
121
|
-
"types": "./dist/src/firebase_auth/server/use_auth_user_server.d.ts",
|
|
122
|
-
"import": "./dist/src/firebase_auth/server/use_auth_user_server.js"
|
|
123
|
-
},
|
|
124
|
-
"default": {
|
|
125
|
-
"types": "./dist/src/firebase_auth/client/use_auth_user.d.ts",
|
|
126
|
-
"import": "./dist/src/firebase_auth/client/use_auth_user.js"
|
|
127
|
-
}
|
|
128
|
-
},
|
|
129
|
-
"./getFirebaseAuthUser": {
|
|
130
|
-
"types": "./dist/src/firebase_auth/server/use_auth_user_server.d.ts",
|
|
131
|
-
"import": "./dist/src/firebase_auth/server/use_auth_user_server.js"
|
|
132
|
-
},
|
|
133
|
-
"./firebaseAuthActions": {
|
|
134
|
-
"types": "./dist/src/firebase_auth/client/auth_actions.d.ts",
|
|
135
|
-
"import": "./dist/src/firebase_auth/client/auth_actions.js"
|
|
136
|
-
},
|
|
137
|
-
"./firebaseAuthMiddleware": {
|
|
138
|
-
"types": "./dist/src/firebase_auth/middleware/update_session.d.ts",
|
|
139
|
-
"import": "./dist/src/firebase_auth/middleware/update_session.js"
|
|
140
|
-
},
|
|
141
|
-
"./cookieConsent": {
|
|
142
|
-
"types": "./dist/src/cookie_consent/index.d.ts",
|
|
143
|
-
"import": "./dist/src/cookie_consent/index.js"
|
|
144
|
-
},
|
|
145
|
-
"./CookieConsentProvider": {
|
|
146
|
-
"types": "./dist/src/cookie_consent/client/cookie_consent_provider.d.ts",
|
|
147
|
-
"import": "./dist/src/cookie_consent/client/cookie_consent_provider.js"
|
|
148
|
-
},
|
|
149
|
-
"./useCookieConsent": {
|
|
150
|
-
"types": "./dist/src/cookie_consent/client/use_cookie_consent.d.ts",
|
|
151
|
-
"import": "./dist/src/cookie_consent/client/use_cookie_consent.js"
|
|
152
|
-
},
|
|
153
|
-
"./CookieConsentDialog": {
|
|
154
|
-
"types": "./dist/src/cookie_consent/client/components/cookie_consent_dialog.d.ts",
|
|
155
|
-
"import": "./dist/src/cookie_consent/client/components/cookie_consent_dialog.js"
|
|
156
|
-
},
|
|
157
|
-
"./PrivacyPolicyUpdateDialog": {
|
|
158
|
-
"types": "./dist/src/cookie_consent/client/components/privacy_policy_update_dialog.d.ts",
|
|
159
|
-
"import": "./dist/src/cookie_consent/client/components/privacy_policy_update_dialog.js"
|
|
160
|
-
},
|
|
161
|
-
"./cookieConsentAnalytics": {
|
|
162
|
-
"types": "./dist/src/cookie_consent/client/components/cookie_consent_analytics.d.ts",
|
|
163
|
-
"import": "./dist/src/cookie_consent/client/components/cookie_consent_analytics.js"
|
|
164
|
-
},
|
|
165
|
-
"./errorHandling": {
|
|
166
|
-
"types": "./dist/src/error_handling/index.d.ts",
|
|
167
|
-
"import": "./dist/src/error_handling/index.js"
|
|
168
|
-
},
|
|
169
|
-
"./installConsoleErrorOverride": {
|
|
170
|
-
"types": "./dist/src/error_handling/install_console_error_override.d.ts",
|
|
171
|
-
"import": "./dist/src/error_handling/install_console_error_override.js"
|
|
172
|
-
},
|
|
173
|
-
"./installGlobalErrorOverride": {
|
|
174
|
-
"types": "./dist/src/error_handling/install_global_error_override.d.ts",
|
|
175
|
-
"import": "./dist/src/error_handling/install_global_error_override.js"
|
|
176
|
-
},
|
|
177
|
-
"./stringifyUnknown": {
|
|
178
|
-
"types": "./dist/src/error_handling/stringify_unknown.d.ts",
|
|
179
|
-
"import": "./dist/src/error_handling/stringify_unknown.js"
|
|
180
|
-
},
|
|
181
|
-
"./formatErrorMessage": {
|
|
182
|
-
"types": "./dist/src/error_handling/format_error_message.d.ts",
|
|
183
|
-
"import": "./dist/src/error_handling/format_error_message.js"
|
|
184
|
-
},
|
|
185
|
-
"./defaultIgnoredConsoleErrors": {
|
|
186
|
-
"types": "./dist/src/error_handling/default_ignored_console_errors.d.ts",
|
|
187
|
-
"import": "./dist/src/error_handling/default_ignored_console_errors.js"
|
|
188
|
-
},
|
|
189
|
-
"./createServerErrorAction": {
|
|
190
|
-
"types": "./dist/src/error_handling/create_server_error_action.d.ts",
|
|
191
|
-
"import": "./dist/src/error_handling/create_server_error_action.js"
|
|
192
|
-
},
|
|
193
|
-
"./isStaleDeployError": {
|
|
194
|
-
"types": "./dist/src/error_handling/is_stale_deploy_error.d.ts",
|
|
195
|
-
"import": "./dist/src/error_handling/is_stale_deploy_error.js"
|
|
196
|
-
},
|
|
197
|
-
"./clearClientCache": {
|
|
198
|
-
"types": "./dist/src/error_handling/clear_client_cache.d.ts",
|
|
199
|
-
"import": "./dist/src/error_handling/clear_client_cache.js"
|
|
200
|
-
},
|
|
201
|
-
"./db": {
|
|
202
|
-
"types": "./dist/src/db/index.d.ts",
|
|
203
|
-
"import": "./dist/src/db/index.js"
|
|
204
|
-
},
|
|
205
|
-
"./dbEslint": {
|
|
206
|
-
"types": "./dist/src/db/eslint_config.d.ts",
|
|
207
|
-
"import": "./dist/src/db/eslint_config.js"
|
|
208
|
-
},
|
|
209
|
-
"./dbHelpers": {
|
|
210
|
-
"types": "./dist/src/db/helpers.d.ts",
|
|
211
|
-
"import": "./dist/src/db/helpers.js"
|
|
212
|
-
},
|
|
213
|
-
"./dbTesting": {
|
|
214
|
-
"types": "./dist/src/db/testing.d.ts",
|
|
215
|
-
"import": "./dist/src/db/testing.js"
|
|
216
|
-
},
|
|
217
|
-
"./dbSchema": {
|
|
218
|
-
"types": "./dist/src/db/schema.d.ts",
|
|
219
|
-
"import": "./dist/src/db/schema.js"
|
|
220
|
-
},
|
|
221
|
-
"./vite": {
|
|
222
|
-
"types": "./dist/src/vite/index.d.ts",
|
|
223
|
-
"import": "./dist/src/vite/index.js"
|
|
224
|
-
}
|
|
225
|
-
},
|
|
226
|
-
"scripts": {
|
|
227
|
-
"test": "vitest run --coverage",
|
|
228
|
-
"bench": "vitest bench --run",
|
|
229
|
-
"build": "tsc"
|
|
230
|
-
},
|
|
231
|
-
"repository": {
|
|
232
|
-
"type": "git",
|
|
233
|
-
"url": "git+https://github.com/demian-ilnytskyi/cloudflare-next-intl.git"
|
|
234
|
-
},
|
|
235
|
-
"keywords": [
|
|
236
|
-
"nextjs",
|
|
237
|
-
"i18n",
|
|
238
|
-
"internationalization",
|
|
239
|
-
"localization",
|
|
240
|
-
"multilingual",
|
|
241
|
-
"translation",
|
|
242
|
-
"language",
|
|
243
|
-
"optimized",
|
|
244
|
-
"performance",
|
|
245
|
-
"bundle-size",
|
|
246
|
-
"fast",
|
|
247
|
-
"efficient",
|
|
248
|
-
"app-router",
|
|
249
|
-
"server-components",
|
|
250
|
-
"ssr",
|
|
251
|
-
"ssg",
|
|
252
|
-
"tree-shaking",
|
|
253
|
-
"dynamic-imports",
|
|
254
|
-
"react",
|
|
255
|
-
"next-intl",
|
|
256
|
-
"messages",
|
|
257
|
-
"formatting",
|
|
258
|
-
"icu"
|
|
259
|
-
],
|
|
260
|
-
"author": "Demian Ilnutskyi",
|
|
261
|
-
"license": "MIT",
|
|
262
|
-
"bugs": {
|
|
263
|
-
"url": "https://github.com/demian-ilnytskyi/cloudflare-next-intl/issues"
|
|
264
|
-
},
|
|
265
|
-
"homepage": "https://github.com/demian-ilnytskyi/cloudflare-next-intl#readme",
|
|
266
|
-
"dependencies": {
|
|
267
|
-
"@microsoft/clarity": "^1.0.2",
|
|
268
|
-
"@supabase/supabase-js": "^2.112.3",
|
|
269
|
-
"drizzle-kit": "^0.31.10",
|
|
270
|
-
"drizzle-orm": "^0.45.2",
|
|
271
|
-
"embedded-postgres": "^18.4.0-beta.17",
|
|
272
|
-
"firebase": "^12.17.0",
|
|
273
|
-
"jose": "^6.2.8",
|
|
274
|
-
"pg": "^8.23.0"
|
|
275
|
-
},
|
|
276
|
-
"peerDependencies": {
|
|
277
|
-
"next": ">=12.0.0",
|
|
278
|
-
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || >=19.0.0-rc <19.0.0 || ^19.0.0",
|
|
279
|
-
"typescript": ">=5.0.0",
|
|
280
|
-
"vite": ">=6"
|
|
281
|
-
},
|
|
282
|
-
"peerDependenciesMeta": {
|
|
283
|
-
"typescript": {
|
|
284
|
-
"optional": true
|
|
285
|
-
},
|
|
286
|
-
"vite": {
|
|
287
|
-
"optional": true
|
|
288
|
-
}
|
|
289
|
-
},
|
|
290
|
-
"devDependencies": {
|
|
291
|
-
"@eslint/eslintrc": "^3",
|
|
292
|
-
"@eslint/js": "^9.27.0",
|
|
293
|
-
"@testing-library/dom": "^10.4.1",
|
|
294
|
-
"@testing-library/jest-dom": "^7.0.0",
|
|
295
|
-
"@testing-library/react": "^16.3.2",
|
|
296
|
-
"@types/node": "^20.14.5",
|
|
297
|
-
"@types/pg": "^8.23.1",
|
|
298
|
-
"@types/react": "^19.0.0",
|
|
299
|
-
"@types/react-dom": "^19.0.0",
|
|
300
|
-
"@vitest/coverage-v8": "^3.2.7",
|
|
301
|
-
"eslint": "^9.28.0",
|
|
302
|
-
"eslint-config-next": "15.3.3",
|
|
303
|
-
"eslint-config-prettier": "^10.1.2",
|
|
304
|
-
"jsdom": "^29.1.1",
|
|
305
|
-
"next": "^15.3.0",
|
|
306
|
-
"react": "19.2.0",
|
|
307
|
-
"react-dom": "19.2.0",
|
|
308
|
-
"tsup": "^8.5.1",
|
|
309
|
-
"typescript": "^5.5.3",
|
|
310
|
-
"typescript-eslint": "^8.33.1",
|
|
311
|
-
"vite": "^7.0.0",
|
|
312
|
-
"vitest": "^3.0.8"
|
|
313
|
-
}
|
|
2
|
+
"type": "module"
|
|
314
3
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { useEffect } from "react";
|
|
3
|
-
import { isDarkCookieKey } from "../../config";
|
|
4
|
-
import getCookie from "../functions/get_cookie";
|
|
3
|
+
import { isDarkCookieKey } from "../../config/index.js";
|
|
4
|
+
import getCookie from "../functions/get_cookie.js";
|
|
5
5
|
export default function ClientHelperScript() {
|
|
6
6
|
useEffect(() => {
|
|
7
7
|
const isDark = getCookie(isDarkCookieKey);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { TranslationObject } from "../../types/types";
|
|
2
|
-
import type { SerializedAuthUser } from "../../firebase_auth/types";
|
|
3
|
-
import type { CookieConsentAnalyticsConfig, AutoAnalyticsEventsConfig } from "../../types/types";
|
|
4
|
-
import type { CookieConsentDialogProps } from "../../cookie_consent/client/components/cookie_consent_dialog";
|
|
5
|
-
import type { PrivacyPolicyUpdateDialogProps } from "../../cookie_consent/client/components/privacy_policy_update_dialog";
|
|
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
6
|
interface LocaleContextType {
|
|
7
7
|
language: string;
|
|
8
8
|
messages: TranslationObject;
|
|
@@ -12,24 +12,12 @@ export default function LocationzationClientProvider({ language, messages, initi
|
|
|
12
12
|
language: string;
|
|
13
13
|
messages: TranslationObject;
|
|
14
14
|
initialAuthUser?: SerializedAuthUser | null;
|
|
15
|
-
/** Set when `firebaseAuth.autoWireClientProvider` is `false` — skips wrapping `children` in the client `AuthUserProvider` entirely. */
|
|
16
15
|
skipAuthProvider?: boolean;
|
|
17
|
-
/** Resolved server-side from `cookieConsent.analytics`/`getAnalytics` when `autoWireAnalytics` isn't `false`. */
|
|
18
16
|
analyticsConfig?: CookieConsentAnalyticsConfig;
|
|
19
|
-
/** From `cookieConsent.autoAnalyticsEvents` — forwarded as-is to the auto-wired `AutoAnalyticsEvents`. */
|
|
20
17
|
autoAnalyticsEventsConfig?: AutoAnalyticsEventsConfig;
|
|
21
|
-
/**
|
|
22
|
-
* Resolved server-side from `cookieConsent.getCountryCode`/`gdprCountries`.
|
|
23
|
-
* `false` means the visitor's country doesn't require the consent
|
|
24
|
-
* banner — `CookieConsentProvider` seeds consent as implicitly granted
|
|
25
|
-
* for a first-time visitor instead of `null`.
|
|
26
|
-
*/
|
|
27
18
|
requiresConsent?: boolean;
|
|
28
|
-
/** From `cookieConsent.autoWireDialogs` — renders `CookieConsentDialog`/`PrivacyPolicyUpdateDialog` automatically when `true` (default). */
|
|
29
19
|
autoWireDialogs?: boolean;
|
|
30
|
-
/** From `cookieConsent.dialogProps` — forwarded as-is to the auto-wired `CookieConsentDialog`. */
|
|
31
20
|
dialogProps?: CookieConsentDialogProps;
|
|
32
|
-
/** From `cookieConsent.updateDialogProps` — forwarded as-is to the auto-wired `PrivacyPolicyUpdateDialog`. */
|
|
33
21
|
updateDialogProps?: PrivacyPolicyUpdateDialogProps;
|
|
34
22
|
children: React.ReactNode;
|
|
35
23
|
}): Component;
|
|
@@ -1,36 +1,24 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { setLocaleCache, setMessageForLocaleCache } from "../../general/cache_variables";
|
|
3
|
+
import { setLocaleCache, setMessageForLocaleCache } from "../../general/cache_variables.js";
|
|
4
4
|
import { createContext, useMemo } from "react";
|
|
5
5
|
import dynamic from "next/dynamic";
|
|
6
6
|
import config from "@intl-config";
|
|
7
|
-
import installConsoleErrorOverride from "../../error_handling/install_console_error_override";
|
|
8
|
-
import installGlobalErrorOverride from "../../error_handling/install_global_error_override";
|
|
7
|
+
import installConsoleErrorOverride from "../../error_handling/install_console_error_override.js";
|
|
8
|
+
import installGlobalErrorOverride from "../../error_handling/install_global_error_override.js";
|
|
9
9
|
export const LocaleContext = createContext(undefined);
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const AuthUserProvider = dynamic(() => import("../../firebase_auth/client/auth_user_provider"));
|
|
18
|
-
const AutoFirebasePerformanceEvents = dynamic(() => import("../../firebase_auth/client/components/auto_firebase_performance_events"));
|
|
19
|
-
const CookieConsentProvider = dynamic(() => import("../../cookie_consent/client/cookie_consent_provider"));
|
|
20
|
-
const CookieConsentAnalytics = dynamic(() => import("../../cookie_consent/client/components/cookie_consent_analytics"));
|
|
21
|
-
const AutoAnalyticsEvents = dynamic(() => import("../../cookie_consent/client/components/auto_analytics_events"));
|
|
22
|
-
const CookieConsentDialog = dynamic(() => import("../../cookie_consent/client/components/cookie_consent_dialog"));
|
|
23
|
-
const PrivacyPolicyUpdateDialog = dynamic(() => import("../../cookie_consent/client/components/privacy_policy_update_dialog"));
|
|
10
|
+
const AuthUserProvider = dynamic(() => import("../../firebase_auth/client/auth_user_provider.js"));
|
|
11
|
+
const AutoFirebasePerformanceEvents = dynamic(() => import("../../firebase_auth/client/components/auto_firebase_performance_events.js"));
|
|
12
|
+
const CookieConsentProvider = dynamic(() => import("../../cookie_consent/client/cookie_consent_provider.js"));
|
|
13
|
+
const CookieConsentAnalytics = dynamic(() => import("../../cookie_consent/client/components/cookie_consent_analytics.js"));
|
|
14
|
+
const AutoAnalyticsEvents = dynamic(() => import("../../cookie_consent/client/components/auto_analytics_events.js"));
|
|
15
|
+
const CookieConsentDialog = dynamic(() => import("../../cookie_consent/client/components/cookie_consent_dialog.js"));
|
|
16
|
+
const PrivacyPolicyUpdateDialog = dynamic(() => import("../../cookie_consent/client/components/privacy_policy_update_dialog.js"));
|
|
24
17
|
export default function LocationzationClientProvider({ language, messages, initialAuthUser = null, skipAuthProvider = false, analyticsConfig, autoAnalyticsEventsConfig, requiresConsent = true, autoWireDialogs = true, dialogProps, updateDialogProps, children }) {
|
|
25
18
|
setLocaleCache(language);
|
|
26
19
|
setMessageForLocaleCache(language, messages);
|
|
27
20
|
installConsoleErrorOverride(config, true);
|
|
28
21
|
installGlobalErrorOverride(config);
|
|
29
|
-
// `LocaleContext.Provider` stays the outermost element here — the
|
|
30
|
-
// client `AuthUserProvider` (and its descendants calling
|
|
31
|
-
// usePathname()/useLocale()) must render as a CHILD of it, not a
|
|
32
|
-
// sibling wrapping it, or those hooks would throw for running outside
|
|
33
|
-
// the provider.
|
|
34
22
|
let providedChildren = children;
|
|
35
23
|
if (config.firebaseAuth && !skipAuthProvider) {
|
|
36
24
|
providedChildren = _jsxs(AuthUserProvider, { initialUser: initialAuthUser, children: [children, config.firebaseAuth.performance !== false && _jsx(AutoFirebasePerformanceEvents, {})] });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { TranslationObject } from "../../types/types";
|
|
2
|
-
import type { CookieConsentAnalyticsConfig, AutoAnalyticsEventsConfig } from "../../types/types";
|
|
3
|
-
import type { CookieConsentDialogProps } from "../../cookie_consent/client/components/cookie_consent_dialog";
|
|
4
|
-
import type { PrivacyPolicyUpdateDialogProps } from "../../cookie_consent/client/components/privacy_policy_update_dialog";
|
|
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
5
|
interface LocaleContextType {
|
|
6
6
|
language: string;
|
|
7
7
|
messages: TranslationObject;
|
|
@@ -10,22 +10,11 @@ export declare const LocaleContext: import("react").Context<LocaleContextType |
|
|
|
10
10
|
export default function LocationzationClientProvider({ language, messages, analyticsConfig, autoAnalyticsEventsConfig, requiresConsent, autoWireDialogs, dialogProps, updateDialogProps, children }: {
|
|
11
11
|
language: string;
|
|
12
12
|
messages: TranslationObject;
|
|
13
|
-
/** Resolved server-side from `cookieConsent.analytics`/`getAnalytics` when `autoWireAnalytics` isn't `false`. */
|
|
14
13
|
analyticsConfig?: CookieConsentAnalyticsConfig;
|
|
15
|
-
/** From `cookieConsent.autoAnalyticsEvents` — forwarded as-is to the auto-wired `AutoAnalyticsEvents`. */
|
|
16
14
|
autoAnalyticsEventsConfig?: AutoAnalyticsEventsConfig;
|
|
17
|
-
/**
|
|
18
|
-
* Resolved server-side from `cookieConsent.getCountryCode`/`gdprCountries`.
|
|
19
|
-
* `false` means the visitor's country doesn't require the consent
|
|
20
|
-
* banner — `CookieConsentProvider` seeds consent as implicitly granted
|
|
21
|
-
* for a first-time visitor instead of `null`.
|
|
22
|
-
*/
|
|
23
15
|
requiresConsent?: boolean;
|
|
24
|
-
/** From `cookieConsent.autoWireDialogs` — renders `CookieConsentDialog`/`PrivacyPolicyUpdateDialog` automatically when `true` (default). */
|
|
25
16
|
autoWireDialogs?: boolean;
|
|
26
|
-
/** From `cookieConsent.dialogProps` — forwarded as-is to the auto-wired `CookieConsentDialog`. */
|
|
27
17
|
dialogProps?: CookieConsentDialogProps;
|
|
28
|
-
/** From `cookieConsent.updateDialogProps` — forwarded as-is to the auto-wired `PrivacyPolicyUpdateDialog`. */
|
|
29
18
|
updateDialogProps?: PrivacyPolicyUpdateDialogProps;
|
|
30
19
|
children: React.ReactNode;
|
|
31
20
|
}): Component;
|
|
@@ -1,25 +1,17 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { setLocaleCache, setMessageForLocaleCache } from "../../general/cache_variables";
|
|
3
|
+
import { setLocaleCache, setMessageForLocaleCache } from "../../general/cache_variables.js";
|
|
4
4
|
import { createContext, useMemo } from "react";
|
|
5
5
|
import dynamic from "next/dynamic";
|
|
6
6
|
import config from "@intl-config";
|
|
7
|
-
import installConsoleErrorOverride from "../../error_handling/install_console_error_override";
|
|
8
|
-
import installGlobalErrorOverride from "../../error_handling/install_global_error_override";
|
|
7
|
+
import installConsoleErrorOverride from "../../error_handling/install_console_error_override.js";
|
|
8
|
+
import installGlobalErrorOverride from "../../error_handling/install_global_error_override.js";
|
|
9
9
|
export const LocaleContext = createContext(undefined);
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
// import entirely — not just skipping its use at runtime — is what keeps
|
|
16
|
-
// `output: 'export'` builds from failing. See `server_provider_static.tsx`
|
|
17
|
-
// for the full explanation.
|
|
18
|
-
const CookieConsentProvider = dynamic(() => import("../../cookie_consent/client/cookie_consent_provider"));
|
|
19
|
-
const CookieConsentAnalytics = dynamic(() => import("../../cookie_consent/client/components/cookie_consent_analytics"));
|
|
20
|
-
const AutoAnalyticsEvents = dynamic(() => import("../../cookie_consent/client/components/auto_analytics_events"));
|
|
21
|
-
const CookieConsentDialog = dynamic(() => import("../../cookie_consent/client/components/cookie_consent_dialog"));
|
|
22
|
-
const PrivacyPolicyUpdateDialog = dynamic(() => import("../../cookie_consent/client/components/privacy_policy_update_dialog"));
|
|
10
|
+
const CookieConsentProvider = dynamic(() => import("../../cookie_consent/client/cookie_consent_provider.js"));
|
|
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"));
|
|
23
15
|
export default function LocationzationClientProvider({ language, messages, analyticsConfig, autoAnalyticsEventsConfig, requiresConsent = true, autoWireDialogs = true, dialogProps, updateDialogProps, children }) {
|
|
24
16
|
setLocaleCache(language);
|
|
25
17
|
setMessageForLocaleCache(language, messages);
|
|
@@ -4,27 +4,5 @@ type NextLinkProps = Omit<ComponentProps<'a'>, keyof LinkProps> & Omit<LinkProps
|
|
|
4
4
|
export type LocaleLinkProps = NextLinkProps & {
|
|
5
5
|
locale: string;
|
|
6
6
|
};
|
|
7
|
-
/**
|
|
8
|
-
* Client-only link component for linking to a SPECIFIC locale — e.g. a
|
|
9
|
-
* language switcher. Import from `cloudflare-next-intl/LocaleLink`.
|
|
10
|
-
*
|
|
11
|
-
* For normal in-app navigation that should stay on the current locale, use
|
|
12
|
-
* the server-side `Link` (`cloudflare-next-intl/Link`) instead — it infers
|
|
13
|
-
* the locale automatically and doesn't require `"use client"`.
|
|
14
|
-
*
|
|
15
|
-
* Renders inside a `Suspense` boundary; falls back to a disabled `<a>`
|
|
16
|
-
* (`pointer-events-none`) while resolving.
|
|
17
|
-
*
|
|
18
|
-
* @param locale Required. The locale to link to (e.g. `"de"`), prepended to
|
|
19
|
-
* `href` regardless of the current locale.
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* ```tsx
|
|
23
|
-
* "use client";
|
|
24
|
-
* import LocaleLink from "cloudflare-next-intl/LocaleLink";
|
|
25
|
-
*
|
|
26
|
-
* <LocaleLink href="/about" locale="de">Über uns</LocaleLink> // -> "/de/about"
|
|
27
|
-
* ```
|
|
28
|
-
*/
|
|
29
7
|
declare const LocaleLink: import("react").ForwardRefExoticComponent<Omit<LocaleLinkProps, "ref"> & import("react").RefAttributes<HTMLAnchorElement>>;
|
|
30
8
|
export default LocaleLink;
|