cloudflare-next-intl 0.6.4 → 0.6.6

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 (154) hide show
  1. package/dist/src/client/components/client_provider.js +2 -0
  2. package/dist/src/error_handling/default_ignored_console_errors.js +6 -0
  3. package/dist/src/error_handling/index.d.ts +1 -0
  4. package/dist/src/error_handling/index.js +1 -0
  5. package/dist/src/error_handling/install_global_error_override.d.ts +20 -0
  6. package/dist/src/error_handling/install_global_error_override.js +44 -0
  7. package/dist/src/error_handling/report_error.d.ts +7 -3
  8. package/dist/src/error_handling/report_error.js +21 -10
  9. package/dist/src/firebase_auth/client/auth_user_provider.js +26 -21
  10. package/dist/src/firebase_auth/index.d.ts +1 -0
  11. package/dist/src/firebase_auth/index.js +1 -0
  12. package/dist/src/firebase_auth/server/clear_session_action.d.ts +7 -0
  13. package/dist/src/firebase_auth/server/clear_session_action.js +20 -0
  14. package/dist/src/types/types.d.ts +28 -3
  15. package/package.json +5 -1
  16. package/dist/types/client/components/client_helper_script.d.ts +0 -1
  17. package/dist/types/client/components/client_provider.d.ts +0 -34
  18. package/dist/types/client/components/locale_link.d.ts +0 -30
  19. package/dist/types/client/components/locale_link_client.d.ts +0 -3
  20. package/dist/types/client/functions/get_cookie.bench.d.ts +0 -1
  21. package/dist/types/client/functions/get_cookie.d.ts +0 -10
  22. package/dist/types/client/functions/get_cookie.test.d.ts +0 -1
  23. package/dist/types/client/functions/set_cookie.bench.d.ts +0 -1
  24. package/dist/types/client/functions/set_cookie.d.ts +0 -21
  25. package/dist/types/client/functions/set_cookie.test.d.ts +0 -1
  26. package/dist/types/client/hooks/client_hooks.bench.d.ts +0 -1
  27. package/dist/types/client/hooks/client_hooks.d.ts +0 -28
  28. package/dist/types/client/hooks/use_path_name.bench.d.ts +0 -1
  29. package/dist/types/client/hooks/use_path_name.d.ts +0 -10
  30. package/dist/types/client/index.d.ts +0 -4
  31. package/dist/types/config/cookie_key.bench.d.ts +0 -1
  32. package/dist/types/config/cookie_key.d.ts +0 -5
  33. package/dist/types/config/cookie_key.test.d.ts +0 -1
  34. package/dist/types/config/index.d.ts +0 -4
  35. package/dist/types/config/init_config.bench.d.ts +0 -1
  36. package/dist/types/config/init_config.d.ts +0 -18
  37. package/dist/types/config/init_config.test.d.ts +0 -1
  38. package/dist/types/config/intl_config.d.ts +0 -3
  39. package/dist/types/config/intl_config.test.d.ts +0 -1
  40. package/dist/types/config/intl_sitemap.bench.d.ts +0 -1
  41. package/dist/types/config/intl_sitemap.d.ts +0 -8
  42. package/dist/types/config/intl_sitemap.test.d.ts +0 -1
  43. package/dist/types/config/middleware.bench.d.ts +0 -1
  44. package/dist/types/config/middleware.d.ts +0 -21
  45. package/dist/types/config/middleware.test.d.ts +0 -1
  46. package/dist/types/cookie_consent/client/components/clarity_script.d.ts +0 -10
  47. package/dist/types/cookie_consent/client/components/cookie_consent_analytics.bench.d.ts +0 -1
  48. package/dist/types/cookie_consent/client/components/cookie_consent_analytics.d.ts +0 -19
  49. package/dist/types/cookie_consent/client/components/cookie_consent_dialog.d.ts +0 -35
  50. package/dist/types/cookie_consent/client/components/default_dialog_styles.d.ts +0 -2
  51. package/dist/types/cookie_consent/client/components/default_dialog_text.d.ts +0 -13
  52. package/dist/types/cookie_consent/client/components/default_privacy_policy_link.d.ts +0 -14
  53. package/dist/types/cookie_consent/client/components/dialog_portal.d.ts +0 -11
  54. package/dist/types/cookie_consent/client/components/privacy_policy_update_dialog.d.ts +0 -31
  55. package/dist/types/cookie_consent/client/cookie_consent_provider.bench.d.ts +0 -1
  56. package/dist/types/cookie_consent/client/cookie_consent_provider.d.ts +0 -39
  57. package/dist/types/cookie_consent/client/use_cookie_consent.d.ts +0 -6
  58. package/dist/types/cookie_consent/gdpr_countries.bench.d.ts +0 -1
  59. package/dist/types/cookie_consent/gdpr_countries.d.ts +0 -18
  60. package/dist/types/cookie_consent/gdpr_countries.perf.test.d.ts +0 -1
  61. package/dist/types/cookie_consent/gdpr_countries.test.d.ts +0 -1
  62. package/dist/types/cookie_consent/index.d.ts +0 -10
  63. package/dist/types/cookie_consent/require_config.d.ts +0 -7
  64. package/dist/types/cookie_consent/require_config.test.d.ts +0 -1
  65. package/dist/types/cookie_consent/types.d.ts +0 -57
  66. package/dist/types/error_handling/create_server_error_action.d.ts +0 -19
  67. package/dist/types/error_handling/create_server_error_action.test.d.ts +0 -1
  68. package/dist/types/error_handling/default_ignored_console_errors.d.ts +0 -13
  69. package/dist/types/error_handling/default_ignored_console_errors.test.d.ts +0 -1
  70. package/dist/types/error_handling/format_error_message.d.ts +0 -9
  71. package/dist/types/error_handling/format_error_message.test.d.ts +0 -1
  72. package/dist/types/error_handling/index.d.ts +0 -9
  73. package/dist/types/error_handling/install_console_error_override.bench.d.ts +0 -1
  74. package/dist/types/error_handling/install_console_error_override.d.ts +0 -29
  75. package/dist/types/error_handling/install_console_error_override.perf.test.d.ts +0 -1
  76. package/dist/types/error_handling/install_console_error_override.test.d.ts +0 -1
  77. package/dist/types/error_handling/report_error.bench.d.ts +0 -1
  78. package/dist/types/error_handling/report_error.d.ts +0 -40
  79. package/dist/types/error_handling/report_error.perf.test.d.ts +0 -1
  80. package/dist/types/error_handling/report_error.test.d.ts +0 -1
  81. package/dist/types/error_handling/stringify_unknown.bench.d.ts +0 -1
  82. package/dist/types/error_handling/stringify_unknown.d.ts +0 -12
  83. package/dist/types/error_handling/stringify_unknown.test.d.ts +0 -1
  84. package/dist/types/error_handling/with_error_handling.d.ts +0 -15
  85. package/dist/types/error_handling/with_error_handling.test.d.ts +0 -1
  86. package/dist/types/firebase_auth/client/auth_actions.bench.d.ts +0 -1
  87. package/dist/types/firebase_auth/client/auth_actions.d.ts +0 -46
  88. package/dist/types/firebase_auth/client/auth_actions.test.d.ts +0 -1
  89. package/dist/types/firebase_auth/client/auth_user_cache.bench.d.ts +0 -1
  90. package/dist/types/firebase_auth/client/auth_user_cache.d.ts +0 -4
  91. package/dist/types/firebase_auth/client/auth_user_cache.test.d.ts +0 -1
  92. package/dist/types/firebase_auth/client/auth_user_provider.d.ts +0 -36
  93. package/dist/types/firebase_auth/client/firebase_client.bench.d.ts +0 -1
  94. package/dist/types/firebase_auth/client/firebase_client.d.ts +0 -20
  95. package/dist/types/firebase_auth/client/firebase_client.test.d.ts +0 -1
  96. package/dist/types/firebase_auth/client/use_auth_user.bench.d.ts +0 -1
  97. package/dist/types/firebase_auth/client/use_auth_user.d.ts +0 -12
  98. package/dist/types/firebase_auth/error_messages/default_messages.en.bench.d.ts +0 -1
  99. package/dist/types/firebase_auth/error_messages/default_messages.en.d.ts +0 -1
  100. package/dist/types/firebase_auth/error_messages/default_messages.en.test.d.ts +0 -1
  101. package/dist/types/firebase_auth/error_messages/firebase_auth_error_helper.bench.d.ts +0 -1
  102. package/dist/types/firebase_auth/error_messages/firebase_auth_error_helper.d.ts +0 -6
  103. package/dist/types/firebase_auth/error_messages/firebase_auth_error_helper.test.d.ts +0 -1
  104. package/dist/types/firebase_auth/index.d.ts +0 -9
  105. package/dist/types/firebase_auth/middleware/update_session.bench.d.ts +0 -1
  106. package/dist/types/firebase_auth/middleware/update_session.d.ts +0 -22
  107. package/dist/types/firebase_auth/middleware/update_session.test.d.ts +0 -1
  108. package/dist/types/firebase_auth/require_config.bench.d.ts +0 -1
  109. package/dist/types/firebase_auth/require_config.d.ts +0 -8
  110. package/dist/types/firebase_auth/require_config.test.d.ts +0 -1
  111. package/dist/types/firebase_auth/server/auth_user_server_provider.d.ts +0 -29
  112. package/dist/types/firebase_auth/server/firebase_server.bench.d.ts +0 -1
  113. package/dist/types/firebase_auth/server/firebase_server.d.ts +0 -15
  114. package/dist/types/firebase_auth/server/firebase_server.perf.test.d.ts +0 -1
  115. package/dist/types/firebase_auth/server/firebase_server.test.d.ts +0 -1
  116. package/dist/types/firebase_auth/server/use_auth_user_server.bench.d.ts +0 -1
  117. package/dist/types/firebase_auth/server/use_auth_user_server.d.ts +0 -39
  118. package/dist/types/firebase_auth/server/use_auth_user_server.test.d.ts +0 -1
  119. package/dist/types/firebase_auth/types.d.ts +0 -22
  120. package/dist/types/general/cache_variables.bench.d.ts +0 -1
  121. package/dist/types/general/cache_variables.d.ts +0 -14
  122. package/dist/types/general/cache_variables.test.d.ts +0 -1
  123. package/dist/types/general/general_functions.bench.d.ts +0 -1
  124. package/dist/types/general/general_functions.d.ts +0 -2
  125. package/dist/types/general/general_functions.test.d.ts +0 -1
  126. package/dist/types/general/index.d.ts +0 -2
  127. package/dist/types/general/metadata.bench.d.ts +0 -1
  128. package/dist/types/general/metadata.d.ts +0 -38
  129. package/dist/types/general/metadata.test.d.ts +0 -1
  130. package/dist/types/index.d.ts +0 -6
  131. package/dist/types/server/components/helper_script.d.ts +0 -20
  132. package/dist/types/server/components/link.d.ts +0 -25
  133. package/dist/types/server/components/server_provider.d.ts +0 -35
  134. package/dist/types/server/functions/get_user_locale.bench.d.ts +0 -1
  135. package/dist/types/server/functions/get_user_locale.d.ts +0 -3
  136. package/dist/types/server/functions/get_user_locale.test.d.ts +0 -1
  137. package/dist/types/server/functions/locale_static_params.d.ts +0 -15
  138. package/dist/types/server/functions/locale_static_params.test.d.ts +0 -1
  139. package/dist/types/server/functions/server.bench.d.ts +0 -1
  140. package/dist/types/server/functions/server.d.ts +0 -67
  141. package/dist/types/server/functions/server.perf.test.d.ts +0 -1
  142. package/dist/types/server/functions/server.test.d.ts +0 -1
  143. package/dist/types/server/functions/use_functions.bench.d.ts +0 -1
  144. package/dist/types/server/functions/use_functions.d.ts +0 -33
  145. package/dist/types/server/functions/use_functions.test.d.ts +0 -1
  146. package/dist/types/server/index.d.ts +0 -5
  147. package/dist/types/test_utils/mock_intl_config.d.ts +0 -3
  148. package/dist/types/test_utils/mock_next_server.d.ts +0 -5
  149. package/dist/types/theme_switcher/components/icons.d.ts +0 -6
  150. package/dist/types/theme_switcher/components/theme_switcher.d.ts +0 -15
  151. package/dist/types/theme_switcher/components/theme_switcher_button.d.ts +0 -6
  152. package/dist/types/theme_switcher/index.d.ts +0 -1
  153. package/dist/types/types/index.d.ts +0 -1
  154. package/dist/types/types/types.d.ts +0 -548
@@ -1,8 +0,0 @@
1
- import type { MetadataRoute } from 'next';
2
- import type { IntlSitemap } from '../types/types';
3
- declare function generateIntlSitemapIml({ intlSitemap, url }: {
4
- intlSitemap: IntlSitemap[];
5
- url: string;
6
- }): MetadataRoute.Sitemap;
7
- declare const generateIntlSitemap: typeof generateIntlSitemapIml;
8
- export default generateIntlSitemap;
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,21 +0,0 @@
1
- import type { NextRequest } from 'next/server';
2
- import { NextResponse } from 'next/server';
3
- import type { MiddlewareCustomHandler } from '../types/types';
4
- export declare const localesSet: Set<string>;
5
- /**
6
- * This middleware function runs for every incoming request. Handles locale
7
- * detection/routing, then optionally defers to your own custom logic.
8
- *
9
- * @param request The incoming request (pass through from your `middleware.ts`).
10
- * @param options.middlewareHandler Your own logic (auth, feature flags, etc.),
11
- * run alongside locale routing — see {@link MiddlewareCustomHandler} for the
12
- * full contract (`rewriteUrl` / `redirectUrl` and what to return).
13
- * @param options.runHandlerOnRedirect By default, `middlewareHandler` does
14
- * NOT run for the locale-redirect case (so it never receives a
15
- * `redirectUrl`). Set to `true` to also run it on redirects.
16
- * Defaults to `false`.
17
- */
18
- export default function intlMiddleware(request: NextRequest, options?: {
19
- middlewareHandler?: MiddlewareCustomHandler;
20
- runHandlerOnRedirect?: boolean;
21
- }): Promise<NextResponse<unknown>>;
@@ -1 +0,0 @@
1
- export {};
@@ -1,10 +0,0 @@
1
- /**
2
- * Loads and initializes Microsoft Clarity. Split into its own module and
3
- * loaded via `next/dynamic` from `cookie_consent_analytics.tsx` so it's
4
- * only fetched as a separate chunk once actually rendered (consent granted
5
- * and `analytics.clarityProjectId` set) — `@microsoft/clarity` is a real
6
- * dependency of this package, so it's always installed regardless.
7
- */
8
- export default function ClarityScript({ projectId }: {
9
- projectId: string;
10
- }): null;
@@ -1,19 +0,0 @@
1
- import type { CookieConsentAnalyticsConfig } from '../../../types/types';
2
- /**
3
- * Renders whichever analytics/ads scripts have a resolved secret, gated on
4
- * consent: Google Consent Mode bootstrap always loads (defaults to
5
- * `denied`, only sends `update` once `consent` is decided); Cloudflare Web
6
- * Analytics beacon and Microsoft Clarity only load once `consent === true`.
7
- * Rendered automatically by `IntlProvider` when `cookieConsent.analytics`/
8
- * `getAnalytics` resolves at least one field and `autoWireAnalytics` isn't
9
- * `false` — render manually instead if you set `autoWireAnalytics: false`.
10
- */
11
- export default function CookieConsentAnalytics({ config }: {
12
- config: CookieConsentAnalyticsConfig;
13
- }): React.ReactElement | null;
14
- /**
15
- * Denies storage by default and loads the configured Google tags; the
16
- * effect above sends the `update` once consent is known. Only IDs present
17
- * in `config` are included.
18
- */
19
- export declare function googleConsentModeBootstrapScript(config: CookieConsentAnalyticsConfig): string;
@@ -1,35 +0,0 @@
1
- import type { ConsentValue, CookieDialogClassNames, CookieDialogStyles } from '../../types';
2
- export interface CookieConsentDialogProps {
3
- /** Banner message text. */
4
- message?: React.ReactNode;
5
- /**
6
- * Link element rendered right after `message`. Defaults to a link to
7
- * `cookieConsent.privacyPolicyPath` (`'/privacy-policy'` unless
8
- * configured otherwise) with `privacyPolicyLinkText` as its label. Pass
9
- * `null` to render no link, or your own element to override it.
10
- */
11
- link?: React.ReactNode;
12
- /** Label for the default privacy-policy link. Ignored when `link` is set. */
13
- privacyPolicyLinkText?: string;
14
- acceptText?: string;
15
- declineText?: string;
16
- /** Hides the decline ("necessary only") button, leaving only accept. */
17
- hideDecline?: boolean;
18
- id?: string;
19
- classNames?: CookieDialogClassNames;
20
- styles?: CookieDialogStyles;
21
- /**
22
- * Full custom render — receives the resolved consent state/actions and
23
- * bypasses the default markup entirely. Use for a fully bespoke dialog.
24
- */
25
- render?: (props: {
26
- setConsent: (value: ConsentValue) => void;
27
- }) => React.ReactNode;
28
- }
29
- /**
30
- * Cookie-consent banner. Renders `null` once `consent` is already decided.
31
- * Every visual aspect is overridable via `classNames`/`styles` (per-slot) or
32
- * `render` (full custom markup) — none of it is hardcoded to Tailwind or any
33
- * particular design system.
34
- */
35
- export default function CookieConsentDialog({ message, link, privacyPolicyLinkText, acceptText, declineText, hideDecline, id, classNames, styles, render, }: CookieConsentDialogProps): React.ReactElement | null;
@@ -1,2 +0,0 @@
1
- import type { CookieDialogClassNames } from '../../types';
2
- export declare const defaultCookieDialogClassNames: CookieDialogClassNames;
@@ -1,13 +0,0 @@
1
- export interface CookieConsentDefaultText {
2
- message: string;
3
- privacyPolicyLinkText: string;
4
- acceptText: string;
5
- declineText: string;
6
- }
7
- export interface PrivacyPolicyUpdateDefaultText {
8
- message: string;
9
- privacyPolicyLinkText: string;
10
- closeText: string;
11
- }
12
- export declare const defaultCookieConsentText: Record<string, CookieConsentDefaultText>;
13
- export declare const defaultPrivacyPolicyUpdateText: Record<string, PrivacyPolicyUpdateDefaultText>;
@@ -1,14 +0,0 @@
1
- /**
2
- * Renders the default privacy-policy link used by `CookieConsentDialog`/
3
- * `PrivacyPolicyUpdateDialog` when their `link` prop is omitted. Returns
4
- * `null` when `privacyPolicyPath` is `false` (disabled via
5
- * `cookieConsent.privacyPolicyPath`). Locale-prefixes `privacyPolicyPath`
6
- * the same way the server `Link` component does — reads the locale set by
7
- * `LocationzationClientProvider` on the current render.
8
- */
9
- export default function DefaultPrivacyPolicyLink({ privacyPolicyPath, text, className, style }: {
10
- privacyPolicyPath: string | false;
11
- text: string;
12
- className?: string;
13
- style?: React.CSSProperties;
14
- }): React.ReactElement | null;
@@ -1,11 +0,0 @@
1
- /**
2
- * Renders `children` into `document.body` via a portal, so the default
3
- * dialogs always stack on top of the host app regardless of its own
4
- * stacking contexts (a `z-index` alone can't escape an ancestor with
5
- * `transform`/`filter`/`opacity`/`isolation`, all common in app shells).
6
- * Only called client-side (both dialogs already gate on `isMounted`), so
7
- * `document` is always defined here.
8
- */
9
- export default function DialogPortal({ children }: {
10
- children: React.ReactNode;
11
- }): React.ReactPortal;
@@ -1,31 +0,0 @@
1
- import type { CookieDialogClassNames, CookieDialogStyles } from '../../types';
2
- export interface PrivacyPolicyUpdateDialogProps {
3
- message?: React.ReactNode;
4
- /**
5
- * Link element rendered right after `message`. Defaults to a link to
6
- * `cookieConsent.privacyPolicyPath` (`'/privacy-policy'` unless
7
- * configured otherwise) with `privacyPolicyLinkText` as its label. Pass
8
- * `null` to render no link, or your own element to override it.
9
- */
10
- link?: React.ReactNode;
11
- /** Label for the default privacy-policy link. Ignored when `link` is set. */
12
- privacyPolicyLinkText?: string;
13
- closeText?: string;
14
- id?: string;
15
- classNames?: CookieDialogClassNames;
16
- styles?: CookieDialogStyles;
17
- /**
18
- * Full custom render — receives the acknowledge action and bypasses the
19
- * default markup entirely.
20
- */
21
- render?: (props: {
22
- acknowledge: () => void;
23
- }) => React.ReactNode;
24
- }
25
- /**
26
- * "Privacy policy updated" banner. Auto-enabled only when
27
- * `cookieConsent.privacyPolicyDate` is set on the `RoutingConfig` — renders
28
- * `null` otherwise, or once acknowledged. Every visual aspect is overridable
29
- * via `classNames`/`styles` (per-slot) or `render` (full custom markup).
30
- */
31
- export default function PrivacyPolicyUpdateDialog({ message, link, privacyPolicyLinkText, closeText, id, classNames, styles, render, }: PrivacyPolicyUpdateDialogProps): React.ReactElement | null;
@@ -1,39 +0,0 @@
1
- import type { CookieConsentContextType } from '../types';
2
- export declare const CookieConsentContext: import("react").Context<CookieConsentContextType | null>;
3
- /**
4
- * Provides cookie-consent + privacy-policy-update state to
5
- * `useCookieConsent()` and the default `CookieConsentDialog`/
6
- * `PrivacyPolicyUpdateDialog` components. Requires `cookieConsent` to be set
7
- * on the `RoutingConfig` passed to `setIntlConfig` — throws a descriptive
8
- * error otherwise.
9
- *
10
- * The privacy-policy-update banner turns on automatically, and only when
11
- * `cookieConsent.privacyPolicyDate` is configured: once a visitor has
12
- * consented, if their stored consent date predates `privacyPolicyDate`,
13
- * `privacyPolicyUpdated` becomes `true` until they call
14
- * `acknowledgePrivacyPolicyUpdate()` — or until they navigate to
15
- * `cookieConsent.privacyPolicyPath`, which auto-acknowledges it (visiting
16
- * the page counts as having seen the update; skipped entirely when
17
- * `privacyPolicyPath` is `false`).
18
- *
19
- * @param requiresConsent Resolved server-side from
20
- * `cookieConsent.getCountryCode`/`gdprCountries` — `false` means the
21
- * visitor's country doesn't require the banner at all, so a first-time
22
- * visitor (no stored cookie) gets `consent` seeded to `true` instead of
23
- * `null`, skipping the dialog and unlocking analytics immediately.
24
- * Defaults to `true` (always show the banner) when omitted, e.g. when
25
- * `cookieConsent.getCountryCode` isn't configured.
26
- *
27
- * @example
28
- * ```tsx
29
- * <CookieConsentProvider>
30
- * {children}
31
- * <CookieConsentDialog />
32
- * <PrivacyPolicyUpdateDialog />
33
- * </CookieConsentProvider>
34
- * ```
35
- */
36
- export default function CookieConsentProvider({ requiresConsent, children }: {
37
- requiresConsent?: boolean;
38
- children: React.ReactNode;
39
- }): React.ReactElement;
@@ -1,6 +0,0 @@
1
- import type { CookieConsentContextType } from '../types';
2
- /**
3
- * Reads cookie-consent + privacy-policy-update state. Must be called within
4
- * a `CookieConsentProvider`.
5
- */
6
- export default function useCookieConsent(): CookieConsentContextType;
@@ -1 +0,0 @@
1
- export {};
@@ -1,18 +0,0 @@
1
- import type { CookieConsentGetCloudflareContext, ErrorHandlingRoutingConfig } from '../types/types';
2
- /**
3
- * Default `cookieConsent.gdprCountries` — EU/EEA member states (GDPR),
4
- * Iceland/Liechtenstein/Norway (EEA), the UK (UK-GDPR), and Switzerland
5
- * (nFADP). ISO 3166-1 alpha-2.
6
- */
7
- export declare const defaultGdprCountries: readonly string[];
8
- /**
9
- * Resolves whether the cookie-consent banner is required for a visitor.
10
- *
11
- * - Neither getter set: fail-safe — consent is required by default since
12
- * the visitor's country can't be determined at all.
13
- * - Either getter set: fail-safe — a country that couldn't be resolved
14
- * still requires consent; only a resolved country OUTSIDE
15
- * `gdprCountries` skips the banner. `getCountryCode` takes precedence
16
- * over `getCloudflareContext` when both are set.
17
- */
18
- export default function resolveRequiresConsent(getCountryCode: (() => string | undefined | Promise<string | undefined>) | undefined, getCloudflareContext: CookieConsentGetCloudflareContext | undefined, gdprCountries: readonly string[] | undefined, errorHandlingConfig?: ErrorHandlingRoutingConfig): Promise<boolean>;
@@ -1 +0,0 @@
1
- export {};
@@ -1,10 +0,0 @@
1
- export { default as CookieConsentProvider } from './client/cookie_consent_provider';
2
- export { default as useCookieConsent } from './client/use_cookie_consent';
3
- export { default as CookieConsentDialog } from './client/components/cookie_consent_dialog';
4
- export { default as PrivacyPolicyUpdateDialog } from './client/components/privacy_policy_update_dialog';
5
- export { default as CookieConsentAnalytics } from './client/components/cookie_consent_analytics';
6
- export { defaultGdprCountries } from './gdpr_countries';
7
- export type { CookieConsentContextType, ConsentValue, CookieDialogClassNames, CookieDialogStyles } from './types';
8
- export type { CookieConsentDialogProps } from './client/components/cookie_consent_dialog';
9
- export type { PrivacyPolicyUpdateDialogProps } from './client/components/privacy_policy_update_dialog';
10
- export type { CookieConsentRoutingConfig, CookieConsentAnalyticsConfig, CookieConsentCloudflareContext, CookieConsentGetCloudflareContext, } from '../types/types';
@@ -1,7 +0,0 @@
1
- import type { CookieConsentRoutingConfig } from '../types/types';
2
- /**
3
- * Throws a descriptive error instead of silently no-op'ing when the
4
- * `cookie_consent` submodule is used without `cookieConsent` set on the
5
- * `RoutingConfig` passed to `setIntlConfig`.
6
- */
7
- export default function requireCookieConsentConfig(value: CookieConsentRoutingConfig | undefined): CookieConsentRoutingConfig;
@@ -1 +0,0 @@
1
- export {};
@@ -1,57 +0,0 @@
1
- /** Consent value: `true` accepted, `false` necessary-only, `null` not yet decided. */
2
- export type ConsentValue = boolean | null;
3
- /** Context value returned by `useCookieConsent()`. */
4
- export interface CookieConsentContextType {
5
- /** Current consent value; `null` until the visitor decides. */
6
- consent: ConsentValue;
7
- /**
8
- * `false` until the client has read the stored consent/date cookies once
9
- * (always `false` during SSR and the first client render, to avoid a
10
- * hydration mismatch). The default dialog components render nothing
11
- * until this is `true`, so a returning visitor's decided consent never
12
- * flashes the banner before disappearing.
13
- */
14
- isMounted: boolean;
15
- /**
16
- * `true` once a privacy-policy update has been detected (stored consent
17
- * predates `cookieConsent.privacyPolicyDate`) and hasn't been
18
- * acknowledged yet. Always `false` when `privacyPolicyDate` is unset.
19
- */
20
- privacyPolicyUpdated: boolean;
21
- /**
22
- * Accepts (or rejects, with `false`) cookie consent and persists it.
23
- * Pass `null` to clear the stored decision and reset `consent` back to
24
- * `null`, so the default `CookieConsentDialog` banner reappears (e.g.
25
- * for a "cookie settings" button).
26
- */
27
- setConsent: (value: ConsentValue) => void;
28
- /** Acknowledges the privacy-policy update banner and persists the new date. */
29
- acknowledgePrivacyPolicyUpdate: () => void;
30
- /**
31
- * Resolved from `cookieConsent.privacyPolicyPath` (defaults to
32
- * `'/privacy-policy'`; `false` disables it). Used by the default
33
- * dialog components to render a privacy-policy link automatically
34
- * when their `link` prop is omitted.
35
- */
36
- privacyPolicyPath: string | false;
37
- }
38
- /** Slot-level style/class overrides accepted by the default dialog components. */
39
- export interface CookieDialogClassNames {
40
- root?: string;
41
- message?: string;
42
- link?: string;
43
- actions?: string;
44
- acceptButton?: string;
45
- declineButton?: string;
46
- closeButton?: string;
47
- }
48
- /** Slot-level inline-style overrides accepted by the default dialog components. */
49
- export interface CookieDialogStyles {
50
- root?: React.CSSProperties;
51
- message?: React.CSSProperties;
52
- link?: React.CSSProperties;
53
- actions?: React.CSSProperties;
54
- acceptButton?: React.CSSProperties;
55
- declineButton?: React.CSSProperties;
56
- closeButton?: React.CSSProperties;
57
- }
@@ -1,19 +0,0 @@
1
- import type { ErrorHandlingParams } from '../types/types';
2
- import { type ReportErrorConfig } from './report_error';
3
- /**
4
- * Creates a `"use server"` action that reports a client-originated error via
5
- * `reportError`, so `config` (and anything it closes over — secrets,
6
- * `Secrets.telegramBotToken`-style env reads inside your `onError`) never
7
- * has to be imported into client-side code. Call this once (server-side,
8
- * e.g. next to your `RoutingConfig`) and pass the returned function to
9
- * client components that need to report an error — they only ever handle
10
- * the error value itself, never `config`.
11
- *
12
- * The error is stringified before crossing the client→server action
13
- * boundary (Next.js server actions serialize arguments; an `Error` instance
14
- * doesn't survive that intact) and `isClient: true` is set automatically.
15
- *
16
- * @param config Pass the relevant slices of your `RoutingConfig` directly —
17
- * `{ errorHandling: config.errorHandling, generate: config.generate }`.
18
- */
19
- export default function createServerErrorAction(config: ReportErrorConfig | undefined): (error: unknown, classOrMethodName: string, params?: ErrorHandlingParams["params"]) => Promise<void>;
@@ -1,13 +0,0 @@
1
- /**
2
- * Firebase Auth error codes this package's own `createLoginAction`/
3
- * `createSignUpAction`/`createForgotPasswordAction` already catch and
4
- * translate into a localized message (see
5
- * `firebase_auth/error_messages/firebase_auth_error_helper.ts`) — expected
6
- * user-input failures (wrong password, email already in use, etc.), not
7
- * bugs. They never reach `console.error`/`reportError` through this
8
- * package's own code; this list exists as defense-in-depth for consumers
9
- * whose own code logs one of these codes directly. Passing your own
10
- * `ignoreConsoleError` array replaces this default entirely — pass `[]` to
11
- * report everything.
12
- */
13
- export declare const defaultIgnoredConsoleErrors: readonly string[];
@@ -1,9 +0,0 @@
1
- import type { ErrorHandlingParams } from '../types/types';
2
- /**
3
- * Builds a human-readable one-string summary of an `ErrorHandlingParams` —
4
- * `[classOrMethodName] Error: <message>` followed by non-empty `Params`/
5
- * `IsClient` sections. Never throws (`stringifyUnknown` is safe). Used as
6
- * `ErrorHandlingParams.formattedMessage` — read this instead of `error`/
7
- * `params` directly when you just want something printable.
8
- */
9
- export default function formatErrorMessage(params: ErrorHandlingParams): string;
@@ -1,9 +0,0 @@
1
- export { default as withErrorHandling } from './with_error_handling';
2
- export type { WithErrorHandlingOptions } from './with_error_handling';
3
- export { default as reportError } from './report_error';
4
- export type { ReportErrorConfig } from './report_error';
5
- export { default as installConsoleErrorOverride } from './install_console_error_override';
6
- export { default as stringifyUnknown } from './stringify_unknown';
7
- export { default as formatErrorMessage } from './format_error_message';
8
- export { defaultIgnoredConsoleErrors } from './default_ignored_console_errors';
9
- export type { ErrorHandlingParams, ErrorHandlingRoutingConfig } from '../types/types';
@@ -1,29 +0,0 @@
1
- import { type ReportErrorConfig } from './report_error';
2
- /**
3
- * Replaces the global `console.error` so every `console.error(...)` call is
4
- * also routed through `config.errorHandling.onError`/`reportError` — the
5
- * original `console.error` still runs afterwards, nothing is swallowed.
6
- * Safe to call more than once (a no-op after the first call in this JS
7
- * realm — call it separately on the server and on the client, each has its
8
- * own `console`). Only takes effect when `config.errorHandling.overrideConsoleError`
9
- * is `true`.
10
- *
11
- * A component stuck in a render-error loop calls `console.error` on every
12
- * render — `reportError`'s own dedup/cap (on by default, see
13
- * `errorHandling.dedup`/`maxReports`) is what stops that from reporting
14
- * unboundedly; this function does not duplicate that cap itself.
15
- *
16
- * `config.errorHandling.ignoreConsoleErrors` (default
17
- * `defaultIgnoredConsoleErrors` — this package's own Firebase Auth error
18
- * codes for expected user-input failures) and `ignoreConsoleError` both
19
- * skip reporting a matching call while still logging it normally.
20
- *
21
- * @param config Pass the relevant slices of your `RoutingConfig` directly —
22
- * `{ errorHandling: config.errorHandling, generate: config.generate }`.
23
- * @param isClient Passed through to every report's `ErrorHandlingParams.isClient`
24
- * — set `true` when installing from client-side code (e.g. the client
25
- * `LocationzationClientProvider`), omit/`false` on the server. There's no
26
- * `getCloudflareContext`/`ctx.waitUntil` available in the browser, so
27
- * client-side reports always await `onError` directly.
28
- */
29
- export default function installConsoleErrorOverride(config: ReportErrorConfig | undefined, isClient?: boolean): void;
@@ -1 +0,0 @@
1
- export {};
@@ -1,40 +0,0 @@
1
- import type { ErrorHandlingParams, ErrorHandlingRoutingConfig, GenerateRoutingConfig } from '../types/types';
2
- export interface ReportErrorConfig {
3
- errorHandling?: ErrorHandlingRoutingConfig;
4
- generate?: GenerateRoutingConfig;
5
- }
6
- /**
7
- * Reports `params` via `config.errorHandling.onError` (default
8
- * `console.error(params.formattedMessage)`), unless
9
- * `config.errorHandling.enable === false`, `params.consent` is set and not
10
- * `true` (reporting to a third party without cookie consent can itself be
11
- * GDPR-relevant), or dedup throttles it (on by default — see
12
- * `errorHandling.dedup`/`throttleMs`/`resetDedup`). Never throws — a broken
13
- * reporter must not mask the original error.
14
- *
15
- * Always overwrites `params.formattedMessage` with a fresh
16
- * `formatErrorMessage(params)` before reporting — a human-readable one-line
17
- * summary (`[classOrMethodName] Error: <message>` plus non-empty sections)
18
- * instead of the raw `error`/`params` object, for a default reporter (or a
19
- * simple `onError`) to print directly.
20
- *
21
- * When `config.generate?.getCloudflareContext` is set, `waitUntil` is called
22
- * SYNCHRONOUSLY, in the same tick, with the `callOnError(...)` promise —
23
- * Cloudflare Workers only extends the request's lifetime for work already
24
- * registered with `waitUntil` by the time the handler returns; deferring
25
- * that call through an extra microtask (e.g. `Promise.resolve().then(...)`)
26
- * risks the isolate tearing down the request before `waitUntil` is ever
27
- * actually invoked, silently dropping the report. Falls back to awaiting
28
- * `onError` directly when `getCloudflareContext`/`ctx.waitUntil` is unset or
29
- * unavailable (e.g. outside a Cloudflare Worker).
30
- *
31
- * Passing `params.error` as `null`/`undefined` with `errorHandling.resetDedup: true`
32
- * and nothing else is a valid "reset-only" call: the dedup state clears and
33
- * `reportError` returns immediately, without calling `onError` — useful to
34
- * clear dedup state once at the very start of a request/cron tick, before
35
- * any handler that might call `reportError` for a real error runs.
36
- *
37
- * @param config Pass the relevant slices of your `RoutingConfig` directly —
38
- * `{ errorHandling: config.errorHandling, generate: config.generate }`.
39
- */
40
- export default function reportError(config: ReportErrorConfig | undefined, params: ErrorHandlingParams): Promise<void>;
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,12 +0,0 @@
1
- /**
2
- * Safely converts an `unknown` value (typically `ErrorHandlingParams.error`)
3
- * into a string, for logging/dedup-keying/display — never throws.
4
- *
5
- * @param isClient Skips resolving function-wrapped/lazy error values on the
6
- * client (matches `ErrorHandlingParams.isClient`) — running arbitrary
7
- * caught functions client-side isn't safe the way it is on the server.
8
- * @param isNested Set when stringifying a value nested inside another
9
- * object/array — falls back to a plain `JSON.stringify` (no pretty-print)
10
- * so a single unserializable nested value can't crash the whole report.
11
- */
12
- export default function stringifyUnknown(value: unknown, isClient?: boolean, isNested?: boolean): string;
@@ -1 +0,0 @@
1
- export {};
@@ -1,15 +0,0 @@
1
- import type { ConsentValue } from '../cookie_consent/types';
2
- import { type ReportErrorConfig } from './report_error';
3
- export interface WithErrorHandlingOptions {
4
- /** Pass the relevant slices of your `RoutingConfig` directly — `{ errorHandling: config.errorHandling, generate: config.generate }`. */
5
- config?: ReportErrorConfig;
6
- params?: unknown;
7
- isClient?: boolean;
8
- consent?: ConsentValue;
9
- }
10
- /**
11
- * Wraps `fn`, reporting (via `options.config`) then rethrowing any error it
12
- * throws or rejects with. Never swallows — callers keep their own
13
- * catch/fallback behavior, this only adds reporting on top.
14
- */
15
- export default function withErrorHandling<Args extends unknown[], Result>(fn: (...args: Args) => Result | Promise<Result>, classOrMethodName: string, options?: WithErrorHandlingOptions): (...args: Args) => Promise<Result>;
@@ -1,46 +0,0 @@
1
- import type { AuthActionMessages, AuthFormState } from '../types';
2
- /**
3
- * Builds a login server action for React's `useActionState` form hook.
4
- * The returned function has the `(prevState, formData) => Promise<AuthFormState>`
5
- * shape `useActionState` expects — pass it directly as the action.
6
- *
7
- * `formData` must contain `email` and `password` fields.
8
- *
9
- * @param locale Used to localize the returned error message.
10
- * @param messages Localized action messages (currently unused by this action).
11
- * @returns A form action: `{ success: true }` on success, `{ error }` on failure.
12
- * @example
13
- * const [state, action] = useActionState(createLoginAction(locale, messages), {});
14
- * <form action={action}>...</form>
15
- */
16
- export declare function createLoginAction(locale: string, messages: AuthActionMessages): (_prevState: AuthFormState, formData: FormData) => Promise<AuthFormState>;
17
- /**
18
- * Builds a sign-up server action for React's `useActionState` form hook.
19
- * Same shape as {@link createLoginAction}.
20
- *
21
- * `formData` must contain `email`, `password`, and `confirmPassword` fields.
22
- *
23
- * @param locale Used to localize the returned error message.
24
- * @param messages `messages.mismatch` is returned as the error if
25
- * `password` !== `confirmPassword`; other fields on `AuthActionMessages`
26
- * are not read by this action.
27
- * @returns A form action: `{ success: true }` on success, `{ error }` on failure.
28
- * @example
29
- * const [state, action] = useActionState(createSignUpAction(locale, messages), {});
30
- * <form action={action}>...</form>
31
- */
32
- export declare function createSignUpAction(locale: string, messages: AuthActionMessages): (_prevState: AuthFormState, formData: FormData) => Promise<AuthFormState>;
33
- /**
34
- * Builds a forgot-password server action for React's `useActionState` form
35
- * hook. Same shape as {@link createLoginAction}.
36
- *
37
- * `formData` must contain an `email` field.
38
- *
39
- * @param locale Used to localize the returned error message.
40
- * @param messages Localized action messages (currently unused by this action).
41
- * @returns A form action: `{ success: true }` on success, `{ error }` on failure.
42
- * @example
43
- * const [state, action] = useActionState(createForgotPasswordAction(locale, messages), {});
44
- * <form action={action}>...</form>
45
- */
46
- export declare function createForgotPasswordAction(locale: string, messages: AuthActionMessages): (_prevState: AuthFormState, formData: FormData) => Promise<AuthFormState>;
@@ -1,4 +0,0 @@
1
- import type { AuthUser } from '../types';
2
- export declare function setAuthUserCache(user: AuthUser | null): void;
3
- export declare function getAuthUserCache(): AuthUser | null;
4
- export declare function isAuthUserLoadingCache(): boolean;