cloudflare-next-intl 0.8.31 → 0.8.32

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.
@@ -62,7 +62,7 @@ export async function getFirebaseAuthClient() {
62
62
  measurementId: fa.measurementId,
63
63
  };
64
64
  const app = getApps().length ? getApp() : initializeApp(firebaseConfig);
65
- if (fa.appCheck) {
65
+ if (fa.appCheck && typeof window !== 'undefined') {
66
66
  cachedAppCheck = await initializeFirebaseAppCheck(app, fa.appCheck);
67
67
  }
68
68
  if (perfModule) {
@@ -243,7 +243,11 @@ export default async function updateSession(request, baseResponse, locale, rebui
243
243
  const mode = request.nextUrl.searchParams.get('mode');
244
244
  if (mode) {
245
245
  let target = resolveActionModePaths(fa)[mode];
246
- if (fa.followSameOriginContinueUrl !== false) {
246
+ // Already on the page this mode routes to: the link has arrived.
247
+ // Following `continueUrl` from here would send it back to the
248
+ // action URL, which forwards to this same target again — an
249
+ // endless 307 ping-pong.
250
+ if (fa.followSameOriginContinueUrl !== false && target !== path) {
247
251
  const continueUrl = request.nextUrl.searchParams.get('continueUrl');
248
252
  if (continueUrl) {
249
253
  try {
@@ -291,6 +295,15 @@ export default async function updateSession(request, baseResponse, locale, rebui
291
295
  if (target && target !== path) {
292
296
  const url = localeUrl(target);
293
297
  url.search = request.nextUrl.search;
298
+ // Staying on this origin: only `oobCode` (plus anything the app
299
+ // put there itself) is still needed. Dropping Firebase's own
300
+ // routing params keeps the landed URL clean and makes a second
301
+ // forwarding pass impossible.
302
+ if (fa.stripActionLinkQuery !== false) {
303
+ for (const key of ['mode', 'apiKey', 'lang', 'continueUrl']) {
304
+ url.searchParams.delete(key);
305
+ }
306
+ }
294
307
  return buildRedirect(baseResponse, url);
295
308
  }
296
309
  }
@@ -546,14 +546,24 @@ export interface FirebaseAuthRoutingConfig {
546
546
  * auto-corrects a missing leading slash with a warning.
547
547
  */
548
548
  actionLinkPath?: string;
549
+ /**
550
+ * Whether a same-origin emailed-action-link forward strips Firebase's own
551
+ * `mode`/`apiKey`/`lang`/`continueUrl` params, landing the user on a clean
552
+ * `?oobCode=` URL. Defaults to `true`. Set `false` to keep the full query
553
+ * when the destination page reads those params itself. Cross-origin
554
+ * redirects always keep the full query.
555
+ */
556
+ stripActionLinkQuery?: boolean;
549
557
  /**
550
558
  * Whether the middleware's own redirects (`redirectAuthPath`, `homePath`,
551
559
  * `verifyEmailPath`) carry over the original request's query string —
552
560
  * e.g. `/login?ref=abc` stays `/login?ref=abc` after redirecting to
553
561
  * `homePath` for a signed-in user, instead of dropping to `/`. Defaults
554
562
  * to `true`. The emailed-action-link forward (see
555
- * {@link resetPasswordPath}) always preserves its query string
556
- * regardless of this setting, since `oobCode` must survive that hop.
563
+ * {@link resetPasswordPath}) always preserves `oobCode` regardless of
564
+ * this setting, since it must survive that hop; when the forward stays on
565
+ * this origin it drops Firebase's own `mode`/`apiKey`/`lang`/`continueUrl`
566
+ * params, which the destination page no longer needs.
557
567
  */
558
568
  preserveRedirectQuery?: boolean;
559
569
  /** Returns true if the given (locale-stripped) path is an auth page (login/signup/etc). */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloudflare-next-intl",
3
- "version": "0.8.31",
3
+ "version": "0.8.32",
4
4
  "description": "Optimized Next Intl Package Special for App Router and Cloudflare",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",