cloudflare-next-intl 0.7.3 → 0.7.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.
package/README.md CHANGED
@@ -253,9 +253,11 @@ Set `firebaseAuth` on your `RoutingConfig` to enable — `IntlProvider` then
253
253
  auto-wires `AuthUserProvider` and server-side `getAuthUser` session validation.
254
254
 
255
255
  Features include:
256
+ - `whiteListPaths`: Array of paths exempt from auth redirects (matches exact path or path-segment prefix, e.g. `/bonds` matches `/bonds/some-slug`).
257
+ - `actionLinkPath`: Pinned route for handling Firebase action links (e.g. `/auth/action`), prioritized during cross-origin action link redirects.
256
258
  - `createForgotPasswordAction(locale, actionCodeSettings?)`: Accepts optional Firebase `AuthActionCodeSettings` (e.g. `url` redirect link).
257
259
  - `sendVerificationEmail(actionCodeSettings?)` on `useAuthUser()`: Custom action email settings when resending email verification.
258
- - `followSameOriginContinueUrl`: Automatically forwards emailed action links with `continueUrl` to the specified path (or external URL) directly from `intlMiddleware` (default `true`; set `false` on `firebaseAuth` config to disable).
260
+ - `followSameOriginContinueUrl`: Automatically forwards emailed action links with `continueUrl` to the specified path (or external URL) directly from `intlMiddleware` (default `true`; set `false` on `firebaseAuth` config to disable). If `continueUrl` points to home root (`/`), it resolves to `actionLinkPath` (if set) or the mode target path (e.g. `/reset-password`).
259
261
 
260
262
  ```tsx
261
263
  import ThemeSwitcher from "cloudflare-next-intl/ThemeSwitcher";
@@ -261,7 +261,14 @@ export default async function updateSession(request, baseResponse, locale, rebui
261
261
  }
262
262
  }
263
263
  else {
264
- // External continueUrl: redirect directly to the full external URL
264
+ if (parsed.pathname === '/') {
265
+ if (fa.actionLinkPath) {
266
+ parsed.pathname = fa.actionLinkPath;
267
+ }
268
+ else if (target) {
269
+ parsed.pathname = `${localePrefix}${target}`;
270
+ }
271
+ }
265
272
  parsed.search = request.nextUrl.search;
266
273
  return buildRedirect(baseResponse, parsed);
267
274
  }
@@ -6,6 +6,7 @@ import config from '@intl-config';
6
6
  import requireFirebaseAuthConfig from '../require_config';
7
7
  import { getAuthenticatedAppForUser } from './firebase_server';
8
8
  import withRedirectQuery from '../preserve_redirect_query';
9
+ import isWhitelisted from '../is_whitelisted';
9
10
  const AuthUserProvider = dynamic(() => import('../client/auth_user_provider'));
10
11
  /**
11
12
  * Resolves the signed-in user from the session cookie and performs the
@@ -29,7 +30,7 @@ export async function resolveAuthUserAndRedirect() {
29
30
  const requestHeaders = await headers();
30
31
  const path = requestHeaders.get('x-pathname') ?? '/';
31
32
  const isAuthPage = fa.isAuthPath(path);
32
- const isWhiteListed = fa.whiteListPaths?.includes(path) ?? false;
33
+ const isWhiteListed = isWhitelisted(path, fa.whiteListPaths);
33
34
  // `x-pathname` is path-only, so the query string comes from `x-search`
34
35
  // (set alongside it by `intlMiddleware`) — `redirect()` takes a plain
35
36
  // string, not a URL.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloudflare-next-intl",
3
- "version": "0.7.3",
3
+ "version": "0.7.6",
4
4
  "description": "Optimized Next Intl Package Special for App Router and Cloudflare",
5
5
 
6
6
  "main": "dist/index.js",