@akinon/next 1.93.0-snapshot-ZERO-3574-20250813140510 → 1.93.0

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 (54) hide show
  1. package/CHANGELOG.md +26 -1244
  2. package/__tests__/next-config.test.ts +10 -1
  3. package/bin/pz-prebuild.js +1 -0
  4. package/components/accordion.tsx +5 -20
  5. package/components/file-input.tsx +3 -65
  6. package/components/input.tsx +0 -2
  7. package/components/link.tsx +12 -16
  8. package/components/modal.tsx +16 -32
  9. package/components/plugin-module.tsx +3 -35
  10. package/components/selected-payment-option-view.tsx +0 -11
  11. package/data/client/checkout.ts +4 -25
  12. package/data/server/category.ts +28 -48
  13. package/data/server/flatpage.ts +12 -16
  14. package/data/server/landingpage.ts +12 -16
  15. package/data/server/list.ts +13 -23
  16. package/data/server/product.ts +39 -66
  17. package/data/server/special-page.ts +12 -16
  18. package/data/urls.ts +2 -7
  19. package/hocs/server/with-segment-defaults.tsx +2 -5
  20. package/hooks/use-localization.ts +3 -2
  21. package/instrumentation/node.ts +13 -15
  22. package/jest.config.js +1 -7
  23. package/lib/cache-handler.mjs +52 -35
  24. package/lib/cache.ts +0 -2
  25. package/middlewares/checkout-provider.ts +1 -1
  26. package/middlewares/complete-gpay.ts +2 -6
  27. package/middlewares/complete-masterpass.ts +2 -7
  28. package/middlewares/default.ts +183 -232
  29. package/middlewares/index.ts +1 -3
  30. package/middlewares/locale.ts +1 -9
  31. package/middlewares/redirection-payment.ts +2 -6
  32. package/middlewares/saved-card-redirection.ts +2 -7
  33. package/middlewares/three-d-redirection.ts +2 -7
  34. package/middlewares/url-redirection.ts +15 -9
  35. package/package.json +3 -3
  36. package/plugins.d.ts +0 -10
  37. package/plugins.js +1 -4
  38. package/redux/middlewares/checkout.ts +2 -15
  39. package/redux/reducers/checkout.ts +1 -9
  40. package/sentry/index.ts +17 -54
  41. package/types/commerce/order.ts +0 -1
  42. package/types/index.ts +1 -42
  43. package/utils/app-fetch.ts +2 -7
  44. package/utils/index.ts +10 -34
  45. package/utils/redirect.ts +6 -31
  46. package/with-pz-config.js +5 -1
  47. package/__tests__/redirect.test.ts +0 -319
  48. package/api/image-proxy.ts +0 -75
  49. package/api/similar-product-list.ts +0 -84
  50. package/api/similar-products.ts +0 -120
  51. package/data/server/basket.ts +0 -72
  52. package/hooks/use-loyalty-availability.ts +0 -21
  53. package/middlewares/wallet-complete-redirection.ts +0 -203
  54. package/utils/redirect-ignore.ts +0 -35
@@ -35,84 +35,57 @@ const getProductDataHandler = ({
35
35
  .join('&');
36
36
  }
37
37
 
38
- let data: ProductResult;
39
-
40
- try {
41
- data = await appFetch<ProductResult>({
42
- url,
43
- locale,
44
- currency,
45
- init: {
46
- headers: {
47
- Accept: 'application/json',
48
- 'Content-Type': 'application/json',
49
- ...(headers ?? {})
50
- }
38
+ const data = await appFetch<ProductResult>({
39
+ url,
40
+ locale,
41
+ currency,
42
+ init: {
43
+ headers: {
44
+ Accept: 'application/json',
45
+ 'Content-Type': 'application/json',
46
+ ...(headers ?? {})
51
47
  }
52
- });
53
- } catch (error) {
54
- logger.error('Failed to fetch product data', {
55
- handler: 'getProductDataHandler',
56
- pk,
57
- error: error.message,
58
- url
59
- });
60
- return null;
61
- }
48
+ }
49
+ });
62
50
 
63
51
  const categoryUrl = product.categoryUrl(data.product.pk);
64
52
 
65
- let productCategoryData: ProductCategoryResult;
66
- let breadcrumbData: { menu?: unknown } = {};
67
-
68
- try {
69
- productCategoryData = await appFetch<ProductCategoryResult>({
70
- url: categoryUrl,
71
- locale,
72
- currency,
73
- init: {
74
- headers: {
75
- Accept: 'application/json',
76
- 'Content-Type': 'application/json'
77
- }
53
+ const productCategoryData = await appFetch<ProductCategoryResult>({
54
+ url: categoryUrl,
55
+ locale,
56
+ currency,
57
+ init: {
58
+ headers: {
59
+ Accept: 'application/json',
60
+ 'Content-Type': 'application/json'
78
61
  }
79
- });
80
-
81
- const menuItemModel = productCategoryData?.results[0]?.menuitemmodel;
82
-
83
- if (!menuItemModel) {
84
- logger.warn(
85
- 'menuItemModel is undefined, skipping breadcrumbData fetch',
86
- {
87
- handler: 'getProductDataHandler',
88
- pk
89
- }
90
- );
91
- return { data, breadcrumbData: undefined };
92
62
  }
63
+ });
93
64
 
94
- const breadcrumbUrl = product.breadcrumbUrl(menuItemModel);
65
+ const menuItemModel = productCategoryData?.results[0]?.menuitemmodel;
95
66
 
96
- breadcrumbData = await appFetch<{ menu?: unknown }>({
97
- url: breadcrumbUrl,
98
- locale,
99
- currency,
100
- init: {
101
- headers: {
102
- Accept: 'application/json',
103
- 'Content-Type': 'application/json'
104
- }
105
- }
106
- });
107
- } catch (error) {
108
- logger.warn('Failed to fetch breadcrumb data', {
67
+ if (!menuItemModel) {
68
+ logger.warn('menuItemModel is undefined, skipping breadcrumbData fetch', {
109
69
  handler: 'getProductDataHandler',
110
- pk,
111
- error: error.message
70
+ pk
112
71
  });
113
- // Continue without breadcrumb data
72
+ return { data, breadcrumbData: undefined };
114
73
  }
115
74
 
75
+ const breadcrumbUrl = product.breadcrumbUrl(menuItemModel);
76
+
77
+ const breadcrumbData = await appFetch<any>({
78
+ url: breadcrumbUrl,
79
+ locale,
80
+ currency,
81
+ init: {
82
+ headers: {
83
+ Accept: 'application/json',
84
+ 'Content-Type': 'application/json'
85
+ }
86
+ }
87
+ });
88
+
116
89
  return {
117
90
  data,
118
91
  breadcrumbData: breadcrumbData?.menu
@@ -15,24 +15,20 @@ const getSpecialPageDataHandler = (
15
15
  return async function () {
16
16
  const params = generateCommerceSearchParams(searchParams);
17
17
 
18
- try {
19
- const data: GetCategoryResponse = await appFetch({
20
- url: `${category.getSpecialPageByPk(pk)}${params}`,
21
- locale,
22
- currency,
23
- init: {
24
- headers: {
25
- Accept: 'application/json',
26
- 'Content-Type': 'application/json',
27
- ...(headers ?? {})
28
- }
18
+ const data: GetCategoryResponse = await appFetch({
19
+ url: `${category.getSpecialPageByPk(pk)}${params}`,
20
+ locale,
21
+ currency,
22
+ init: {
23
+ headers: {
24
+ Accept: 'application/json',
25
+ 'Content-Type': 'application/json',
26
+ ...(headers ?? {})
29
27
  }
30
- });
28
+ }
29
+ });
31
30
 
32
- return data;
33
- } catch (error) {
34
- return null;
35
- }
31
+ return data;
36
32
  };
37
33
  };
38
34
 
package/data/urls.ts CHANGED
@@ -142,8 +142,7 @@ export const checkout = {
142
142
  setOrderSelectionPage: '/orders/checkout/?page=OrderSelectionPage',
143
143
  loyaltyCardPage: '/orders/checkout/?page=LoyaltyCardPage',
144
144
  sendSmsPage: '/orders/checkout/?page=SendSmsPage',
145
- verifySmsPage: '/orders/checkout/?page=VerifySmsPage',
146
- saveSampleProducts: '/orders/checkout/?page=SampleProductPage'
145
+ verifySmsPage: '/orders/checkout/?page=VerifySmsPage'
147
146
  };
148
147
 
149
148
  export const flatpage = {
@@ -183,11 +182,7 @@ export const product = {
183
182
  breadcrumbUrl: (menuitemmodel: string) =>
184
183
  `/menus/generate_breadcrumb/?item=${menuitemmodel}&generator_name=menu_item`,
185
184
  bundleProduct: (productPk: string, queryString: string) =>
186
- `/bundle-product/${productPk}/?${queryString}`,
187
- similarProducts: (params?: string) =>
188
- `/similar-products${params ? `?${params}` : ''}`,
189
- similarProductsList: (params?: string) =>
190
- `/similar-product-list${params ? `?${params}` : ''}`
185
+ `/bundle-product/${productPk}/?${queryString}`
191
186
  };
192
187
 
193
188
  export const wishlist = {
@@ -72,13 +72,10 @@ const addRootLayoutProps = async (componentProps: RootLayoutProps) => {
72
72
  const checkRedisVariables = () => {
73
73
  const requiredVariableValues = [
74
74
  process.env.CACHE_HOST,
75
- process.env.CACHE_PORT
75
+ process.env.CACHE_PORT,
76
+ process.env.CACHE_SECRET
76
77
  ];
77
78
 
78
- if (!settings.usePrettyUrlRoute) {
79
- requiredVariableValues.push(process.env.CACHE_SECRET);
80
- }
81
-
82
79
  if (
83
80
  !requiredVariableValues.every((v) => v) &&
84
81
  process.env.NODE_ENV === 'production'
@@ -4,6 +4,7 @@ import { LocalizationContext } from '../localization/provider';
4
4
  import { useContext } from 'react';
5
5
  import { setCookie, urlLocaleMatcherRegex } from '../utils';
6
6
  import { LocaleUrlStrategy } from '../localization';
7
+ import { useRouter } from 'next/navigation';
7
8
 
8
9
  export const useLocalization = () => {
9
10
  const {
@@ -17,6 +18,8 @@ export const useLocalization = () => {
17
18
  localeUrlStrategy
18
19
  } = useContext(LocalizationContext);
19
20
 
21
+ const router = useRouter();
22
+
20
23
  /**
21
24
  * Sets the locale in the URL.
22
25
  * @param locale Locale value defined in the settings.
@@ -27,8 +30,6 @@ export const useLocalization = () => {
27
30
 
28
31
  let targetUrl;
29
32
 
30
- setCookie('pz-locale', locale);
31
-
32
33
  if (localeUrlStrategy === LocaleUrlStrategy.Subdomain) {
33
34
  const hostParts = hostname.split('.');
34
35
  const subDomain = hostParts[0];
@@ -4,19 +4,17 @@ import { Resource } from '@opentelemetry/resources';
4
4
  import { SemanticResourceAttributes } from '@opentelemetry/semantic-conventions';
5
5
  import { SimpleSpanProcessor } from '@opentelemetry/sdk-trace-node';
6
6
 
7
- if (process.env.NODE_ENV === 'development') {
8
- const sdk = new NodeSDK({
9
- resource: new Resource({
10
- [SemanticResourceAttributes.SERVICE_NAME]: 'pz-next-app'
11
- }),
12
- spanProcessor: new SimpleSpanProcessor(
13
- new OTLPTraceExporter({
14
- url: `${
15
- process.env.PZ_DASHBOARD_URL ?? 'http://localhost:3005'
16
- }/api/traces`
17
- })
18
- )
19
- });
7
+ const sdk = new NodeSDK({
8
+ resource: new Resource({
9
+ [SemanticResourceAttributes.SERVICE_NAME]: 'pz-next-app'
10
+ }),
11
+ spanProcessor: new SimpleSpanProcessor(
12
+ new OTLPTraceExporter({
13
+ url: `${
14
+ process.env.PZ_DASHBOARD_URL ?? 'http://localhost:3005'
15
+ }/api/traces`
16
+ })
17
+ )
18
+ });
20
19
 
21
- sdk.start();
22
- }
20
+ sdk.start();
package/jest.config.js CHANGED
@@ -1,19 +1,13 @@
1
1
  const path = require('path');
2
- const findBaseDir = require('./utils/find-base-dir');
3
-
4
- const baseDir = findBaseDir();
5
2
 
6
3
  module.exports = {
7
4
  preset: 'ts-jest',
8
5
  testEnvironment: 'node',
9
6
  rootDir: path.resolve(__dirname),
7
+ roots: [],
10
8
  testMatch: ['**/*.test.ts'],
11
9
  testPathIgnorePatterns: [],
12
- roots: [path.resolve(__dirname)],
13
10
  transformIgnorePatterns: [],
14
- moduleNameMapper: {
15
- '^settings$': path.resolve(baseDir, 'src/settings.js')
16
- },
17
11
  transform: {
18
12
  '^.+\\.(tsx?|jsx?|mjs?)$': [
19
13
  'ts-jest',
@@ -2,7 +2,6 @@ import { CacheHandler } from '@neshca/cache-handler';
2
2
  import createLruHandler from '@neshca/cache-handler/local-lru';
3
3
  import createRedisHandler from '@neshca/cache-handler/redis-strings';
4
4
  import { createClient } from 'redis';
5
- import logger from '../utils/log';
6
5
 
7
6
  // Cache configuration
8
7
  const CACHE_CONFIG = {
@@ -32,10 +31,22 @@ if (!globalForRedis.redisClient) {
32
31
  globalForRedis.connectionAttempts = 0;
33
32
  }
34
33
 
34
+ // Logging configuration
35
+ const debugValue = process.env.NEXT_PRIVATE_DEBUG_CACHE;
36
+ const debug = debugValue === 'true' || debugValue === '1';
37
+
38
+ let console_log;
39
+ if (debug) {
40
+ // eslint-disable-next-line no-console
41
+ console_log = (...args) => console.log('[Cache Handler]', ...args);
42
+ } else {
43
+ console_log = () => {};
44
+ }
45
+
35
46
  async function getRedisClient() {
36
47
  // If client exists and is ready, return it
37
48
  if (globalForRedis.redisClient?.isReady) {
38
- logger.trace('Reusing existing Redis connection');
49
+ console_log('Reusing existing Redis connection');
39
50
  return globalForRedis.redisClient;
40
51
  }
41
52
 
@@ -53,7 +64,7 @@ async function getRedisClient() {
53
64
  const redisUrl = `redis://${CACHE_CONFIG.host}:${CACHE_CONFIG.port}/${CACHE_CONFIG.bucket}`;
54
65
 
55
66
  if (globalForRedis.connectionAttempts === 1) {
56
- logger.debug('Creating Redis connection', { url: redisUrl });
67
+ console_log('Creating Redis connection:', redisUrl);
57
68
  }
58
69
 
59
70
  const redisClient = createClient({
@@ -62,8 +73,8 @@ async function getRedisClient() {
62
73
  reconnectStrategy: (retries) => {
63
74
  if (retries > CACHE_CONFIG.redis.reconnectStrategy.maxRetries) {
64
75
  if (!globalForRedis.hasLoggedConnectionError) {
65
- logger.debug(
66
- 'Redis is not available, falling back to local cache only'
76
+ console.warn(
77
+ '[Cache Handler] Redis is not available, falling back to local cache only'
67
78
  );
68
79
  globalForRedis.hasLoggedConnectionError = true;
69
80
  }
@@ -79,23 +90,23 @@ async function getRedisClient() {
79
90
  // Only log the first connection error to avoid spam
80
91
  if (!globalForRedis.hasLoggedConnectionError) {
81
92
  if (error.code === 'ECONNREFUSED') {
82
- logger.debug(
83
- 'Redis connection refused. Is Redis running? Falling back to local cache.'
93
+ console.warn(
94
+ '[Cache Handler] Redis connection refused. Is Redis running? Falling back to local cache.'
84
95
  );
85
96
  } else {
86
- logger.warn('Redis client error', { error: error.message });
97
+ console.error('[Cache Handler] Redis client error:', error.message);
87
98
  }
88
99
  globalForRedis.hasLoggedConnectionError = true;
89
100
  }
90
101
  });
91
102
 
92
103
  redisClient.on('connect', () => {
93
- logger.debug('Redis connected');
104
+ console_log('Redis connected');
94
105
  globalForRedis.hasLoggedConnectionError = false;
95
106
  });
96
107
 
97
108
  redisClient.on('ready', () => {
98
- logger.debug('Redis ready');
109
+ console_log('Redis ready');
99
110
  globalForRedis.hasLoggedConnectionError = false;
100
111
  });
101
112
 
@@ -105,9 +116,14 @@ async function getRedisClient() {
105
116
  } catch (error) {
106
117
  if (!globalForRedis.hasLoggedConnectionError) {
107
118
  if (error.code === 'ECONNREFUSED') {
108
- logger.debug('Could not connect to Redis - using local cache only');
119
+ console.warn(
120
+ '[Cache Handler] Could not connect to Redis - using local cache only'
121
+ );
109
122
  } else {
110
- logger.error('Failed to connect to Redis', { error: error.message });
123
+ console.error(
124
+ '[Cache Handler] Failed to connect to Redis:',
125
+ error.message
126
+ );
111
127
  }
112
128
  globalForRedis.hasLoggedConnectionError = true;
113
129
  }
@@ -119,7 +135,7 @@ async function getRedisClient() {
119
135
  }
120
136
 
121
137
  CacheHandler.onCreation(async () => {
122
- logger.debug('Initializing cache handlers...');
138
+ console_log('Initializing cache handlers...');
123
139
 
124
140
  let client;
125
141
  try {
@@ -163,68 +179,69 @@ CacheHandler.onCreation(async () => {
163
179
  name: 'custom-local-then-redis',
164
180
  get: async (key, context) => {
165
181
  const vKey = versionKey(key);
166
- logger.trace('GET called for key', {
167
- key: typeof vKey === 'string' ? vKey : vKey?.key
168
- });
182
+ console_log(
183
+ 'GET called for key:',
184
+ typeof vKey === 'string' ? vKey : vKey?.key
185
+ );
169
186
 
170
187
  // Check local cache first
171
- logger.trace('Checking local cache...');
188
+ console_log('Checking local cache...');
172
189
  const localResult = await localHandler.get(vKey, context);
173
190
 
174
191
  if (localResult) {
175
- logger.trace('Found in local cache');
192
+ console_log('Found in local cache');
176
193
  return localResult;
177
194
  }
178
195
 
179
- logger.trace('Not found in local, checking Redis...');
196
+ console_log('Not found in local, checking Redis...');
180
197
  try {
181
198
  const redisResult = await redisHandler.get(vKey, context);
182
199
 
183
200
  if (redisResult) {
184
- logger.trace('Found in Redis');
201
+ console_log('Found in Redis');
185
202
  // Sync back to local cache for faster future access
186
203
  try {
187
204
  await localHandler.set(vKey, redisResult, context);
188
- logger.trace('Synced to local cache');
205
+ console_log('Synced to local cache');
189
206
  } catch (error) {
190
- logger.debug('Failed to sync to local', { error: error.message });
207
+ console_log('Failed to sync to local:', error.message);
191
208
  }
192
209
  return redisResult;
193
210
  }
194
211
  } catch (error) {
195
- logger.warn('Redis GET operation failed', { error: error.message });
212
+ console_log('Redis error:', error.message);
196
213
  }
197
214
 
198
- logger.trace('Not found in any cache');
215
+ console_log('Not found in any cache');
199
216
  return undefined;
200
217
  },
201
218
  set: async (key, value, context) => {
202
219
  const vKey = versionKey(key);
203
- logger.trace('SET called for key', {
204
- key: typeof vKey === 'string' ? vKey : vKey?.key
205
- });
220
+ console_log(
221
+ 'SET called for key:',
222
+ typeof vKey === 'string' ? vKey : vKey?.key
223
+ );
206
224
  // Set to both caches
207
225
  await Promise.allSettled([
208
226
  localHandler.set(vKey, value, context),
209
227
  redisHandler
210
228
  .set(vKey, value, context)
211
- .catch((error) =>
212
- logger.warn('Redis SET operation failed', { error: error.message })
213
- )
229
+ .catch((error) => console_log('Redis SET error:', error.message))
214
230
  ]);
215
231
  },
216
232
  delete: async (key, context) => {
217
233
  const vKey = versionKey(key);
218
- logger.trace('DELETE called for key', {
219
- key: typeof vKey === 'string' ? vKey : vKey?.key
220
- });
234
+ console_log(
235
+ 'DELETE called for key:',
236
+ typeof vKey === 'string' ? vKey : vKey?.key
237
+ );
221
238
  await Promise.allSettled([
222
239
  localHandler.delete?.(vKey, context),
223
240
  redisHandler.delete?.(vKey, context)
224
241
  ]);
225
242
  },
226
243
  revalidateTag: async (tags, context) => {
227
- logger.debug('REVALIDATE_TAG called for tags', { tags });
244
+ console_log('REVALIDATE_TAG called for tags:', tags);
228
245
  await Promise.allSettled([
229
246
  localHandler.revalidateTag?.(tags, context),
230
247
  redisHandler.revalidateTag?.(tags, context)
@@ -232,7 +249,7 @@ CacheHandler.onCreation(async () => {
232
249
  }
233
250
  };
234
251
 
235
- logger.info('Cache handlers initialized successfully');
252
+ console_log('[Cache Handler] Handlers initialized successfully');
236
253
 
237
254
  return {
238
255
  handlers: [customHandler]
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,
@@ -64,7 +64,7 @@ const withCheckoutProvider =
64
64
  const location = request.headers.get('location');
65
65
  const redirectUrl = new URL(
66
66
  request.headers.get('location'),
67
- location.startsWith('http') ? '' : url.origin
67
+ location.startsWith('http') ? '' : process.env.NEXT_PUBLIC_URL
68
68
  );
69
69
 
70
70
  redirectUrl.pathname = getUrlPathWithLocale(
@@ -34,7 +34,6 @@ const withCompleteGpay =
34
34
  const url = req.nextUrl.clone();
35
35
  const ip = req.headers.get('x-forwarded-for') ?? '';
36
36
  const sessionId = req.cookies.get('osessionid');
37
- const currentLocale = req.middlewareParams?.rewrites?.locale;
38
37
 
39
38
  if (url.search.indexOf('GPayCompletePage') === -1) {
40
39
  return middleware(req, event);
@@ -46,9 +45,7 @@ const withCompleteGpay =
46
45
  'Content-Type': 'application/x-www-form-urlencoded',
47
46
  Cookie: req.headers.get('cookie') ?? '',
48
47
  'x-currency': req.cookies.get('pz-currency')?.value ?? '',
49
- 'x-forwarded-for': ip,
50
- 'Accept-Language':
51
- currentLocale ?? req.cookies.get('pz-locale')?.value ?? ''
48
+ 'x-forwarded-for': ip
52
49
  };
53
50
 
54
51
  try {
@@ -148,8 +145,7 @@ const withCompleteGpay =
148
145
  logger.info('Redirecting to order success page', {
149
146
  middleware: 'complete-gpay',
150
147
  redirectUrlWithLocale,
151
- ip,
152
- setCookie: request.headers.get('set-cookie')
148
+ ip
153
149
  });
154
150
 
155
151
  // Using POST method while redirecting causes an error,
@@ -4,7 +4,6 @@ import { Buffer } from 'buffer';
4
4
  import logger from '../utils/log';
5
5
  import { getUrlPathWithLocale } from '../utils/localization';
6
6
  import { PzNextRequest } from '.';
7
- import { ServerVariables } from '../utils/server-variables';
8
7
 
9
8
  const streamToString = async (stream: ReadableStream<Uint8Array> | null) => {
10
9
  if (stream) {
@@ -35,7 +34,6 @@ const withCompleteMasterpass =
35
34
  const url = req.nextUrl.clone();
36
35
  const ip = req.headers.get('x-forwarded-for') ?? '';
37
36
  const sessionId = req.cookies.get('osessionid');
38
- const currentLocale = req.middlewareParams?.rewrites?.locale;
39
37
 
40
38
  if (url.search.indexOf('MasterpassCompletePage') === -1) {
41
39
  return middleware(req, event);
@@ -47,9 +45,7 @@ const withCompleteMasterpass =
47
45
  'Content-Type': 'application/x-www-form-urlencoded',
48
46
  Cookie: req.headers.get('cookie') ?? '',
49
47
  'x-currency': req.cookies.get('pz-currency')?.value ?? '',
50
- 'x-forwarded-for': ip,
51
- 'Accept-Language':
52
- currentLocale ?? req.cookies.get('pz-locale')?.value ?? ''
48
+ 'x-forwarded-for': ip
53
49
  };
54
50
 
55
51
  try {
@@ -149,8 +145,7 @@ const withCompleteMasterpass =
149
145
  logger.info('Redirecting to order success page', {
150
146
  middleware: 'complete-masterpass',
151
147
  redirectUrlWithLocale,
152
- ip,
153
- setCookie: request.headers.get('set-cookie')
148
+ ip
154
149
  });
155
150
 
156
151
  // Using POST method while redirecting causes an error,