@akinon/next 1.76.0-rc.0 → 2.0.0-beta.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/api/client.ts CHANGED
@@ -14,6 +14,7 @@ interface RouteParams {
14
14
 
15
15
  async function proxyRequest(...args) {
16
16
  const [req, { params }] = args as [req: Request, params: RouteParams];
17
+ const resolvedParams = await params;
17
18
  const { searchParams } = new URL(req.url);
18
19
  const commerceUrl = settings.commerceUrl;
19
20
 
@@ -32,7 +33,7 @@ async function proxyRequest(...args) {
32
33
  responseType: 'json'
33
34
  };
34
35
 
35
- const slug = `${params.slug.join('/')}/`;
36
+ const slug = `${resolvedParams.slug.join('/')}/`;
36
37
  const options_ = JSON.parse(
37
38
  decodeURIComponent((searchParams.get('options') as string) ?? '{}')
38
39
  );
@@ -85,7 +86,7 @@ async function proxyRequest(...args) {
85
86
  }
86
87
  } as RequestInit;
87
88
 
88
- const nextCookies = cookies();
89
+ const nextCookies = await cookies();
89
90
  const segment = nextCookies.get('pz-segment')?.value;
90
91
  const currency = nextCookies.get('pz-external-currency')?.value;
91
92
 
@@ -1,8 +1,6 @@
1
1
  import clsx from 'clsx';
2
2
  import { forwardRef, FocusEvent, useState, Ref } from 'react';
3
3
  import { Controller } from 'react-hook-form';
4
-
5
- // @ts-ignore
6
4
  import { PatternFormat, PatternFormatProps } from 'react-number-format';
7
5
  import { InputProps } from '../types';
8
6
  import { twMerge } from 'tailwind-merge';
@@ -10,9 +10,7 @@ type LinkProps = Omit<
10
10
  React.AnchorHTMLAttributes<HTMLAnchorElement>,
11
11
  keyof NextLinkProps
12
12
  > &
13
- NextLinkProps & {
14
- href: string;
15
- };
13
+ NextLinkProps;
16
14
 
17
15
  export const Link = ({ children, href, ...rest }: LinkProps) => {
18
16
  const { locale, defaultLocaleValue, localeUrlStrategy } = useLocalization();
@@ -28,21 +26,19 @@ export const Link = ({ children, href, ...rest }: LinkProps) => {
28
26
  return href;
29
27
  }
30
28
 
31
- if (typeof href === 'string' && !href.startsWith('http')) {
32
- const pathnameWithoutLocale = href.replace(urlLocaleMatcherRegex, '');
33
- const hrefWithLocale = `/${locale}${pathnameWithoutLocale}`;
34
-
35
- if (localeUrlStrategy === LocaleUrlStrategy.ShowAllLocales) {
36
- return hrefWithLocale;
37
- } else if (
38
- localeUrlStrategy === LocaleUrlStrategy.HideDefaultLocale &&
39
- locale !== defaultLocaleValue
40
- ) {
41
- return hrefWithLocale;
42
- }
29
+ const pathnameWithoutLocale = href.replace(urlLocaleMatcherRegex, '');
30
+ const hrefWithLocale = `/${locale}${pathnameWithoutLocale}`;
31
+
32
+ if (localeUrlStrategy === LocaleUrlStrategy.ShowAllLocales) {
33
+ return hrefWithLocale;
34
+ } else if (
35
+ localeUrlStrategy === LocaleUrlStrategy.HideDefaultLocale &&
36
+ locale !== defaultLocaleValue
37
+ ) {
38
+ return hrefWithLocale;
43
39
  }
44
40
 
45
- return href;
41
+ return href || '#';
46
42
  }, [href, defaultLocaleValue, locale, localeUrlStrategy]);
47
43
 
48
44
  return (
@@ -14,7 +14,7 @@ export default async function PzRoot({
14
14
  children: React.ReactNode;
15
15
  locale?: string;
16
16
  }) {
17
- const nextCookies = cookies();
17
+ const nextCookies = await cookies();
18
18
  const sessionid = nextCookies.get('osessionid')?.value;
19
19
 
20
20
  if (!translations) {
@@ -7,8 +7,7 @@ import { ServerVariables } from '../../utils/server-variables';
7
7
  const getFlatPageDataHandler = (
8
8
  pk: number,
9
9
  locale: string,
10
- currency: string,
11
- headers?: Record<string, string>
10
+ currency: string
12
11
  ) => {
13
12
  return async function () {
14
13
  const data = await appFetch<FlatPage>({
@@ -18,8 +17,7 @@ const getFlatPageDataHandler = (
18
17
  init: {
19
18
  headers: {
20
19
  Accept: 'application/json',
21
- 'Content-Type': 'application/json',
22
- ...(headers ?? {})
20
+ 'Content-Type': 'application/json'
23
21
  }
24
22
  }
25
23
  });
@@ -31,17 +29,15 @@ const getFlatPageDataHandler = (
31
29
  export const getFlatPageData = ({
32
30
  pk,
33
31
  locale = ServerVariables.locale,
34
- currency = ServerVariables.currency,
35
- headers
32
+ currency = ServerVariables.currency
36
33
  }: {
37
34
  pk: number;
38
35
  locale?: string;
39
36
  currency?: string;
40
- headers?: Record<string, string>;
41
37
  }) => {
42
38
  return Cache.wrap(
43
39
  CacheKey.FlatPage(pk),
44
40
  locale,
45
- getFlatPageDataHandler(pk, locale, currency, headers)
41
+ getFlatPageDataHandler(pk, locale, currency)
46
42
  );
47
43
  };
@@ -5,12 +5,7 @@ import appFetch from '../../utils/app-fetch';
5
5
  import { ServerVariables } from '../../utils/server-variables';
6
6
  import { form } from '../urls';
7
7
 
8
- const getFormDataHandler = (
9
- pk: number,
10
- locale: string,
11
- currency: string,
12
- headers?: Record<string, string>
13
- ) => {
8
+ const getFormDataHandler = (pk: number, locale: string, currency: string) => {
14
9
  return async function () {
15
10
  const data = await appFetch<FormType>({
16
11
  url: form.getForm(pk),
@@ -19,8 +14,7 @@ const getFormDataHandler = (
19
14
  init: {
20
15
  headers: {
21
16
  Accept: 'application/json',
22
- 'Content-Type': 'application/json',
23
- ...(headers ?? {})
17
+ 'Content-Type': 'application/json'
24
18
  }
25
19
  }
26
20
  });
@@ -32,17 +26,15 @@ const getFormDataHandler = (
32
26
  export const getFormData = ({
33
27
  pk,
34
28
  locale = ServerVariables.locale,
35
- currency = ServerVariables.currency,
36
- headers
29
+ currency = ServerVariables.currency
37
30
  }: {
38
31
  pk: number;
39
32
  locale?: string;
40
33
  currency?: string;
41
- headers?: Record<string, string>;
42
34
  }) => {
43
35
  return Cache.wrap(
44
36
  CacheKey.Form(pk),
45
37
  locale,
46
- getFormDataHandler(pk, locale, currency, headers)
38
+ getFormDataHandler(pk, locale, currency)
47
39
  );
48
40
  };
@@ -7,8 +7,7 @@ import { ServerVariables } from '../../utils/server-variables';
7
7
  const getLandingPageHandler = (
8
8
  pk: number,
9
9
  locale: string,
10
- currency: string,
11
- headers?: Record<string, string>
10
+ currency: string
12
11
  ) => {
13
12
  return async function () {
14
13
  const data = await appFetch<LandingPage>({
@@ -18,8 +17,7 @@ const getLandingPageHandler = (
18
17
  init: {
19
18
  headers: {
20
19
  Accept: 'application/json',
21
- 'Content-Type': 'application/json',
22
- ...(headers ?? {})
20
+ 'Content-Type': 'application/json'
23
21
  }
24
22
  }
25
23
  });
@@ -31,17 +29,15 @@ const getLandingPageHandler = (
31
29
  export const getLandingPageData = ({
32
30
  pk,
33
31
  locale = ServerVariables.locale,
34
- currency = ServerVariables.currency,
35
- headers
32
+ currency = ServerVariables.currency
36
33
  }: {
37
34
  pk: number;
38
35
  locale?: string;
39
36
  currency?: string;
40
- headers?: Record<string, string>;
41
37
  }) => {
42
38
  return Cache.wrap(
43
39
  CacheKey.LandingPage(pk),
44
40
  locale,
45
- getLandingPageHandler(pk, locale, currency, headers)
41
+ getLandingPageHandler(pk, locale, currency)
46
42
  );
47
43
  };
@@ -13,7 +13,6 @@ interface MenuHandlerParams {
13
13
  currency?: string;
14
14
  depth?: number;
15
15
  parent?: string;
16
- headers?: Record<string, string>;
17
16
  }
18
17
 
19
18
  const DEFAULT_DEPTH = 3;
@@ -23,17 +22,13 @@ const getMenuHandler =
23
22
  locale = ServerVariables.locale,
24
23
  currency = ServerVariables.currency,
25
24
  depth,
26
- parent,
27
- headers
25
+ parent
28
26
  }: MenuHandlerParams = {}) =>
29
27
  async () => {
30
28
  const response = await appFetch<MenuResponse>({
31
29
  url: misc.menus(depth ?? DEFAULT_DEPTH, parent),
32
30
  locale,
33
- currency,
34
- init: {
35
- headers
36
- }
31
+ currency
37
32
  });
38
33
 
39
34
  return response?.menu;
@@ -11,7 +11,6 @@ type GetProduct = {
11
11
  currency?: string;
12
12
  searchParams?: URLSearchParams;
13
13
  groupProduct?: boolean;
14
- headers?: Record<string, string>;
15
14
  };
16
15
 
17
16
  const getProductDataHandler = ({
@@ -19,8 +18,7 @@ const getProductDataHandler = ({
19
18
  locale,
20
19
  currency,
21
20
  searchParams,
22
- groupProduct,
23
- headers
21
+ groupProduct
24
22
  }: GetProduct) => {
25
23
  return async function () {
26
24
  let url = groupProduct
@@ -42,8 +40,7 @@ const getProductDataHandler = ({
42
40
  init: {
43
41
  headers: {
44
42
  Accept: 'application/json',
45
- 'Content-Type': 'application/json',
46
- ...(headers ?? {})
43
+ 'Content-Type': 'application/json'
47
44
  }
48
45
  }
49
46
  });
@@ -98,8 +95,7 @@ export const getProductData = async ({
98
95
  locale = ServerVariables.locale,
99
96
  currency = ServerVariables.currency,
100
97
  searchParams,
101
- groupProduct,
102
- headers
98
+ groupProduct
103
99
  }: GetProduct) => {
104
100
  return Cache.wrap(
105
101
  CacheKey[groupProduct ? 'GroupProduct' : 'Product'](
@@ -107,14 +103,7 @@ export const getProductData = async ({
107
103
  searchParams ?? new URLSearchParams()
108
104
  ),
109
105
  locale,
110
- getProductDataHandler({
111
- pk,
112
- locale,
113
- currency,
114
- searchParams,
115
- groupProduct,
116
- headers
117
- }),
106
+ getProductDataHandler({ pk, locale, currency, searchParams, groupProduct }),
118
107
  {
119
108
  expire: 300
120
109
  }
@@ -7,10 +7,9 @@ interface SeoDataParams {
7
7
  url: string;
8
8
  locale?: string;
9
9
  currency?: string;
10
- headers?: Record<string, string>;
11
10
  }
12
11
 
13
- function getSeoDataHandler({ url, locale, currency, headers }: SeoDataParams) {
12
+ function getSeoDataHandler({ url, locale, currency }: SeoDataParams) {
14
13
  return async function () {
15
14
  let data = {} as {
16
15
  title: string;
@@ -20,12 +19,7 @@ function getSeoDataHandler({ url, locale, currency, headers }: SeoDataParams) {
20
19
  };
21
20
 
22
21
  try {
23
- data = await appFetch({
24
- url: misc.cmsSeo(url),
25
- locale,
26
- currency,
27
- init: { headers }
28
- });
22
+ data = await appFetch({ url: misc.cmsSeo(url), locale, currency });
29
23
  } catch (error) {
30
24
  // logger.error('Error while fetching seo data', { url, error });
31
25
  }
@@ -37,12 +31,11 @@ function getSeoDataHandler({ url, locale, currency, headers }: SeoDataParams) {
37
31
  export const getSeoData = async (
38
32
  url,
39
33
  locale = ServerVariables.locale,
40
- currency = ServerVariables.currency,
41
- headers?: Record<string, string>
34
+ currency = ServerVariables.currency
42
35
  ) => {
43
36
  return Cache.wrap(
44
37
  CacheKey.Seo(url),
45
38
  locale,
46
- getSeoDataHandler({ url, locale, currency, headers })
39
+ getSeoDataHandler({ url, locale, currency })
47
40
  );
48
41
  };
@@ -6,44 +6,29 @@ import { widgets } from '../urls';
6
6
  import { ServerVariables } from '../../utils/server-variables';
7
7
 
8
8
  const getWidgetDataHandler =
9
- (
10
- slug: string,
11
- locale: string,
12
- currency: string,
13
- headers?: Record<string, string>
14
- ) =>
15
- async () => {
9
+ (slug: string, locale: string, currency: string) => async () => {
16
10
  if (!slug) {
17
11
  return null;
18
12
  }
19
13
 
20
- return await appFetch({
21
- url: widgets.getWidget(slug),
22
- locale,
23
- currency,
24
- init: {
25
- headers
26
- }
27
- });
14
+ return await appFetch({ url: widgets.getWidget(slug), locale, currency });
28
15
  };
29
16
 
30
17
  export const getWidgetData = async <T>({
31
18
  slug,
32
19
  locale = ServerVariables.locale,
33
20
  currency = ServerVariables.currency,
34
- cacheOptions,
35
- headers
21
+ cacheOptions
36
22
  }: {
37
23
  slug: string;
38
24
  locale?: string;
39
25
  currency?: string;
40
26
  cacheOptions?: CacheOptions;
41
- headers?: Record<string, string>;
42
27
  }): Promise<WidgetResultType<T>> => {
43
28
  return Cache.wrap(
44
29
  CacheKey.Widget(slug),
45
30
  locale,
46
- getWidgetDataHandler(slug, locale, currency, headers),
31
+ getWidgetDataHandler(slug, locale, currency),
47
32
  cacheOptions
48
33
  );
49
34
  };
@@ -1,5 +1,5 @@
1
1
  import { LayoutProps, PageProps, RootLayoutProps } from '../../types';
2
- import React from 'react';
2
+ import React, { JSX } from 'react';
3
3
 
4
4
  type SegmentType = 'client-root' | 'layout' | 'page';
5
5
 
@@ -1,4 +1,5 @@
1
1
  import settings from 'settings';
2
+ import { JSX } from 'react';
2
3
  import { LayoutProps, PageProps, RootLayoutProps } from '../../types';
3
4
  import { redirect } from 'next/navigation';
4
5
  import { ServerVariables } from '../../utils/server-variables';
@@ -21,6 +22,8 @@ export const withSegmentDefaults =
21
22
  async (props: T) => {
22
23
  let componentProps = { ...props };
23
24
 
25
+ const { locale, currency } = await props.params;
26
+
24
27
  if (options.segmentType === 'root-layout') {
25
28
  componentProps = (await addRootLayoutProps(
26
29
  componentProps as RootLayoutProps
@@ -29,8 +32,8 @@ export const withSegmentDefaults =
29
32
  checkRedisVariables();
30
33
  }
31
34
 
32
- ServerVariables.locale = props.params.locale;
33
- ServerVariables.currency = props.params.currency;
35
+ ServerVariables.locale = await locale;
36
+ ServerVariables.currency = await currency;
34
37
 
35
38
  return await (
36
39
  <>
@@ -40,7 +43,7 @@ export const withSegmentDefaults =
40
43
  };
41
44
 
42
45
  const addRootLayoutProps = async (componentProps: RootLayoutProps) => {
43
- const params = componentProps.params;
46
+ const params = await componentProps.params;
44
47
 
45
48
  if (
46
49
  params.commerce !== encodeURIComponent(decodeURI(settings.commerceUrl)) ||
@@ -72,13 +75,10 @@ const addRootLayoutProps = async (componentProps: RootLayoutProps) => {
72
75
  const checkRedisVariables = () => {
73
76
  const requiredVariableValues = [
74
77
  process.env.CACHE_HOST,
75
- process.env.CACHE_PORT
78
+ process.env.CACHE_PORT,
79
+ process.env.CACHE_SECRET
76
80
  ];
77
81
 
78
- if (!settings.usePrettyUrlRoute) {
79
- requiredVariableValues.push(process.env.CACHE_SECRET);
80
- }
81
-
82
82
  if (
83
83
  !requiredVariableValues.every((v) => v) &&
84
84
  process.env.NODE_ENV === 'production'
@@ -1,12 +1,5 @@
1
- import { initSentry } from '../sentry';
2
-
3
1
  export async function register() {
4
2
  if (process.env.NEXT_RUNTIME === 'nodejs') {
5
3
  await import('./node');
6
- initSentry('Server');
7
- }
8
-
9
- if (process.env.NEXT_RUNTIME === 'edge') {
10
- initSentry('Edge');
11
4
  }
12
5
  }
@@ -23,10 +23,10 @@ CacheHandler.onCreation(async () => {
23
23
  timeoutMs: 5000
24
24
  });
25
25
 
26
- // const localHandler = createLruHandler();
26
+ const localHandler = createLruHandler();
27
27
 
28
28
  return {
29
- handlers: [redisHandler]
29
+ handlers: [redisHandler, localHandler]
30
30
  };
31
31
  });
32
32
 
package/lib/cache.ts CHANGED
@@ -31,8 +31,6 @@ export const CacheKey = {
31
31
  `category_${pk}_${encodeURIComponent(
32
32
  JSON.stringify(searchParams)
33
33
  )}${hashCacheKey(headers)}`,
34
- Basket: (namespace?: string) => `basket${namespace ? `_${namespace}` : ''}`,
35
- AllBaskets: () => 'all_baskets',
36
34
  CategorySlug: (slug: string) => `category_${slug}`,
37
35
  SpecialPage: (
38
36
  pk: number,
@@ -145,8 +145,7 @@ const withCompleteGpay =
145
145
  logger.info('Redirecting to order success page', {
146
146
  middleware: 'complete-gpay',
147
147
  redirectUrlWithLocale,
148
- ip,
149
- setCookie: request.headers.get('set-cookie')
148
+ ip
150
149
  });
151
150
 
152
151
  // Using POST method while redirecting causes an error,
@@ -145,8 +145,7 @@ const withCompleteMasterpass =
145
145
  logger.info('Redirecting to order success page', {
146
146
  middleware: 'complete-masterpass',
147
147
  redirectUrlWithLocale,
148
- ip,
149
- setCookie: request.headers.get('set-cookie')
148
+ ip
150
149
  });
151
150
 
152
151
  // Using POST method while redirecting causes an error,
@@ -285,9 +285,7 @@ const withPzDefault =
285
285
  url.pathname =
286
286
  url.pathname +
287
287
  (/\/$/.test(url.pathname) ? '' : '/') +
288
- `searchparams|${url.searchParams
289
- .toString()
290
- .replace(/%26/g, '--amp--')}`;
288
+ `searchparams|${url.searchParams.toString()}`;
291
289
  }
292
290
 
293
291
  if (
@@ -146,8 +146,7 @@ const withRedirectionPayment =
146
146
  logger.info('Redirecting to order success page', {
147
147
  middleware: 'redirection-payment',
148
148
  redirectUrlWithLocale,
149
- ip,
150
- setCookie: request.headers.get('set-cookie')
149
+ ip
151
150
  });
152
151
 
153
152
  // Using POST method while redirecting causes an error,
@@ -145,8 +145,7 @@ const withSavedCardRedirection =
145
145
  logger.info('Redirecting to order success page', {
146
146
  middleware: 'saved-card-redirection',
147
147
  redirectUrlWithLocale,
148
- ip,
149
- setCookie: request.headers.get('set-cookie')
148
+ ip
150
149
  });
151
150
 
152
151
  // Using POST method while redirecting causes an error,
@@ -145,8 +145,7 @@ const withThreeDRedirection =
145
145
  logger.info('Redirecting to order success page', {
146
146
  middleware: 'three-d-redirection',
147
147
  redirectUrlWithLocale,
148
- ip,
149
- setCookie: request.headers.get('set-cookie')
148
+ ip
150
149
  });
151
150
 
152
151
  // Using POST method while redirecting causes an error,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@akinon/next",
3
3
  "description": "Core package for Project Zero Next",
4
- "version": "1.76.0-rc.0",
4
+ "version": "2.0.0-beta.1",
5
5
  "private": false,
6
6
  "license": "MIT",
7
7
  "bin": {
@@ -20,7 +20,7 @@
20
20
  "@opentelemetry/sdk-trace-node": "1.19.0",
21
21
  "@opentelemetry/semantic-conventions": "1.19.0",
22
22
  "@reduxjs/toolkit": "1.9.7",
23
- "@neshca/cache-handler": "1.9.0",
23
+ "@neshca/cache-handler": "1.5.1",
24
24
  "cross-spawn": "7.0.3",
25
25
  "generic-pool": "3.9.0",
26
26
  "react-redux": "8.1.3",
@@ -30,13 +30,13 @@
30
30
  "set-cookie-parser": "2.6.0"
31
31
  },
32
32
  "devDependencies": {
33
- "@akinon/eslint-plugin-projectzero": "1.76.0-rc.0",
33
+ "@akinon/eslint-plugin-projectzero": "2.0.0-beta.1",
34
34
  "@types/react-redux": "7.1.30",
35
35
  "@types/set-cookie-parser": "2.4.7",
36
- "@typescript-eslint/eslint-plugin": "6.7.4",
37
- "@typescript-eslint/parser": "6.7.4",
38
- "eslint": "8.56.0",
39
- "eslint-config-next": "14.2.3",
40
- "eslint-config-prettier": "8.5.0"
36
+ "@typescript-eslint/eslint-plugin": "8.18.2",
37
+ "@typescript-eslint/parser": "8.18.2",
38
+ "eslint": "9.17.0",
39
+ "eslint-config-next": "15.1.2",
40
+ "eslint-config-prettier": "9.1.0"
41
41
  }
42
42
  }
@@ -3,6 +3,7 @@ import { Basket } from './basket';
3
3
  import { RetailStore } from './misc';
4
4
  import { PaymentOption } from './order';
5
5
  import { Product } from './product';
6
+ import { JSX } from 'react';
6
7
 
7
8
  export enum CheckoutStep {
8
9
  Shipping = 'shipping',
@@ -114,7 +114,6 @@ export interface Order {
114
114
  pk: number;
115
115
  name: string;
116
116
  slug: string;
117
- logo: string;
118
117
  [key: string]: any;
119
118
  };
120
119
  }
package/types/index.ts CHANGED
@@ -239,8 +239,8 @@ export type ImageOptions = CDNOptions & {
239
239
  export type Translations = { [key: string]: object };
240
240
 
241
241
  export interface PageProps<T = any> {
242
- params: T & { locale: string; currency: string };
243
- searchParams: URLSearchParams;
242
+ params: Promise<T & { locale: string; currency: string }>;
243
+ searchParams: Promise<URLSearchParams>;
244
244
  }
245
245
 
246
246
  export interface LayoutProps<T = any> extends PageProps<T> {
@@ -26,8 +26,8 @@ const appFetch = async <T>({
26
26
  let ip = '';
27
27
 
28
28
  try {
29
- const nextHeaders = headers();
30
- const nextCookies = cookies();
29
+ const nextHeaders = await headers();
30
+ const nextCookies = await cookies();
31
31
  ip = nextHeaders.get('x-forwarded-for') ?? '';
32
32
 
33
33
  const commerceUrl = Settings.commerceUrl;
@@ -43,12 +43,12 @@ const appFetch = async <T>({
43
43
  const requestURL = `${decodeURIComponent(commerceUrl)}${url}`;
44
44
 
45
45
  init.headers = {
46
- cookie: nextCookies.toString(),
47
46
  ...(init.headers ?? {}),
48
47
  ...(ServerVariables.globalHeaders ?? {}),
49
48
  'Accept-Language': currentLocale.apiValue,
50
49
  'x-currency': currency,
51
- 'x-forwarded-for': ip
50
+ 'x-forwarded-for': ip,
51
+ cookie: nextCookies.toString()
52
52
  };
53
53
 
54
54
  init.next = {
package/utils/redirect.ts CHANGED
@@ -4,8 +4,8 @@ import { headers } from 'next/headers';
4
4
  import { ServerVariables } from '@akinon/next/utils/server-variables';
5
5
  import { getUrlPathWithLocale } from '@akinon/next/utils/localization';
6
6
 
7
- export const redirect = (path: string, type?: RedirectType) => {
8
- const nextHeaders = headers();
7
+ export const redirect = async (path: string, type?: RedirectType) => {
8
+ const nextHeaders = await headers();
9
9
  const pageUrl = new URL(
10
10
  nextHeaders.get('pz-url') ?? process.env.NEXT_PUBLIC_URL
11
11
  );
package/with-pz-config.js CHANGED
@@ -64,7 +64,7 @@ const defaultConfig = {
64
64
  },
65
65
  sentry: {
66
66
  hideSourceMaps: true
67
- } // TODO: This section will be reviewed again in the Sentry 8 update.
67
+ }
68
68
  };
69
69
 
70
70
  const withPzConfig = (