@akinon/next 1.116.0-snapshot-ZERO-3959-20260106131052 → 1.117.0-rc.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.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,26 @@
1
1
  # @akinon/next
2
2
 
3
- ## 1.116.0-snapshot-ZERO-3959-20260106131052
3
+ ## 1.117.0-rc.0
4
+
5
+ ### Minor Changes
6
+
7
+ - d2c0e759: ZERO-3684: Handle cross-origin iframe access in iframeURLChange function
8
+ - b55acb76: ZERO-2577: Fix pagination bug and update usePagination hook and ensure pagination controls rendering correctly
9
+ - 143be2b9: ZERO-3457: Crop styles are customizable and logic improved for rendering similar products modal
10
+ - 9f8cd3bc: ZERO-3449: AI Search Active Filters & Crop Style changes have been implemented
11
+ - 729fe756: ZERO-3895: improve non-3D payment handling and error display
12
+ - d99a6a7d: ZERO-3457_1: Fixed the settings prop and made sure everything is customizable.
13
+ - d7e5178b: ZERO-3985: Add query string handling for orders redirection in middleware
14
+ - 4de5303c: ZERO-2504: add cookie filter to api client request
15
+ - 95b139dc: ZERO-3795: Remove duplicate entry for SavedCard in PluginComponents map
16
+ - 3909d322: Edit the duplicate Plugin.SimilarProducts in the plugin-module.
17
+
18
+ ## 1.116.0
19
+
20
+ ### Minor Changes
21
+
22
+ - d7ec6b08: ZERO-3988: Add Google Pay option to plugin selection
23
+ - 726491df: ZERO-3988: Add google pay integration
4
24
 
5
25
  ## 1.115.0
6
26
 
@@ -26,7 +26,8 @@ enum Plugin {
26
26
  Hepsipay = 'pz-hepsipay',
27
27
  MasterpassRest = 'pz-masterpass-rest',
28
28
  SimilarProducts = 'pz-similar-products',
29
- Haso = 'pz-haso'
29
+ Haso = 'pz-haso',
30
+ GooglePay = 'pz-google-pay'
30
31
  }
31
32
 
32
33
  export enum Component {
@@ -65,7 +66,8 @@ export enum Component {
65
66
  ProductImageSearchFeature = 'ProductImageSearchFeature',
66
67
  ImageSearchButton = 'ImageSearchButton',
67
68
  HeaderImageSearchFeature = 'HeaderImageSearchFeature',
68
- HasoPaymentGateway = 'HasoPaymentGateway'
69
+ HasoPaymentGateway = 'HasoPaymentGateway',
70
+ GooglePay = 'GooglePay'
69
71
  }
70
72
 
71
73
  const PluginComponents = new Map([
@@ -111,16 +113,15 @@ const PluginComponents = new Map([
111
113
  ]
112
114
  ],
113
115
  [Plugin.SavedCard, [Component.SavedCard, Component.IyzicoSavedCard]],
114
- [Plugin.SavedCard, [Component.SavedCard]],
115
116
  [Plugin.FlowPayment, [Component.FlowPayment]],
116
117
  [
117
118
  Plugin.VirtualTryOn,
118
119
  [Component.VirtualTryOnPlugin, Component.BasketVirtualTryOn]
119
120
  ],
120
121
  [Plugin.Hepsipay, [Component.Hepsipay]],
121
- [Plugin.Hepsipay, [Component.Hepsipay]],
122
122
  [Plugin.MasterpassRest, [Component.MasterpassRest]],
123
- [Plugin.Haso, [Component.HasoPaymentGateway]]
123
+ [Plugin.Haso, [Component.HasoPaymentGateway]],
124
+ [Plugin.GooglePay, [Component.GooglePay]]
124
125
  ]);
125
126
 
126
127
  const getPlugin = (component: Component) => {
@@ -197,6 +198,8 @@ export default function PluginModule({
197
198
  promise = import(`${'@akinon/pz-similar-products'}`);
198
199
  } else if (plugin === Plugin.Haso) {
199
200
  promise = import(`${'@akinon/pz-haso'}`);
201
+ } else if (plugin === Plugin.GooglePay) {
202
+ promise = import(`${'@akinon/pz-google-pay'}`);
200
203
  }
201
204
  } catch (error) {
202
205
  logger.error(error);
package/data/urls.ts CHANGED
@@ -183,7 +183,11 @@ export const product = {
183
183
  breadcrumbUrl: (menuitemmodel: string) =>
184
184
  `/menus/generate_breadcrumb/?item=${menuitemmodel}&generator_name=menu_item`,
185
185
  bundleProduct: (productPk: string, queryString: string) =>
186
- `/bundle-product/${productPk}/?${queryString}`
186
+ `/bundle-product/${productPk}/?${queryString}`,
187
+ similarProducts: (params?: string) =>
188
+ `/similar-products${params ? `?${params}` : ''}`,
189
+ similarProductsList: (params?: string) =>
190
+ `/similar-product-list${params ? `?${params}` : ''}`
187
191
  };
188
192
 
189
193
  export const wishlist = {
@@ -128,8 +128,13 @@ const withPzDefault =
128
128
  }
129
129
 
130
130
  if (req.nextUrl.pathname.startsWith('/orders/redirection/')) {
131
+ const queryString = searchParams.toString();
131
132
  return NextResponse.rewrite(
132
- new URL(`${encodeURI(Settings.commerceUrl)}/orders/redirection/`)
133
+ new URL(
134
+ `${encodeURI(Settings.commerceUrl)}/orders/redirection/${
135
+ queryString ? `?${queryString}` : ''
136
+ }`
137
+ )
133
138
  );
134
139
  }
135
140
 
@@ -9,49 +9,21 @@ const withMasterpassRestCallback =
9
9
  async (req: PzNextRequest, event: NextFetchEvent) => {
10
10
  const url = req.nextUrl.clone();
11
11
  const ip = req.headers.get('x-forwarded-for') ?? '';
12
- const sessionId = req.cookies.get('osessionid');
13
12
 
14
- if (!url.pathname.includes('/orders/masterpass-rest-callback')) {
15
- return middleware(req, event);
16
- }
17
-
18
- if (req.method !== 'POST') {
19
- logger.warn('Invalid request method for masterpass REST callback', {
20
- middleware: 'masterpass-rest-callback',
21
- method: req.method,
22
- ip
23
- });
13
+ const isMasterpassCompletePage =
14
+ url.pathname.includes('/orders/checkout') &&
15
+ url.searchParams.get('page') === 'MasterpassRestCompletePage';
24
16
 
25
- return NextResponse.redirect(
26
- `${url.origin}${getUrlPathWithLocale(
27
- '/orders/checkout/',
28
- req.cookies.get('pz-locale')?.value
29
- )}`,
30
- 303
31
- );
17
+ if (!isMasterpassCompletePage) {
18
+ return middleware(req, event);
32
19
  }
33
20
 
34
- const responseCode = url.searchParams.get('responseCode');
35
- const token = url.searchParams.get('token');
36
-
37
- if (!responseCode || !token) {
38
- logger.warn('Missing required parameters for masterpass REST callback', {
39
- middleware: 'masterpass-rest-callback',
40
- responseCode,
41
- token,
42
- ip
21
+ try {
22
+ const requestUrl = new URL('/orders/checkout/', Settings.commerceUrl);
23
+ url.searchParams.forEach((value, key) => {
24
+ requestUrl.searchParams.set(key, value);
43
25
  });
44
26
 
45
- return NextResponse.redirect(
46
- `${url.origin}${getUrlPathWithLocale(
47
- '/orders/checkout/',
48
- req.cookies.get('pz-locale')?.value
49
- )}`,
50
- 303
51
- );
52
- }
53
-
54
- try {
55
27
  const formData = await req.formData();
56
28
  const body: Record<string, string> = {};
57
29
 
@@ -59,37 +31,6 @@ const withMasterpassRestCallback =
59
31
  body[key] = value.toString();
60
32
  });
61
33
 
62
- if (!sessionId) {
63
- logger.warn(
64
- 'Make sure that the SESSION_COOKIE_SAMESITE environment variable is set to None in Commerce.',
65
- {
66
- middleware: 'masterpass-rest-callback',
67
- ip
68
- }
69
- );
70
-
71
- return NextResponse.redirect(
72
- `${url.origin}${getUrlPathWithLocale(
73
- '/orders/checkout/',
74
- req.cookies.get('pz-locale')?.value
75
- )}`,
76
- 303
77
- );
78
- }
79
-
80
- const requestUrl = new URL('/orders/checkout/', Settings.commerceUrl);
81
- requestUrl.searchParams.set('page', 'MasterpassRestCompletePage');
82
- requestUrl.searchParams.set('responseCode', responseCode);
83
- requestUrl.searchParams.set('token', token);
84
- requestUrl.searchParams.set(
85
- 'three_d_secure',
86
- body.transactionType?.includes('3D') ? 'true' : 'false'
87
- );
88
- requestUrl.searchParams.set(
89
- 'transactionType',
90
- body.transactionType || ''
91
- );
92
-
93
34
  const requestHeaders = {
94
35
  'Content-Type': 'application/x-www-form-urlencoded',
95
36
  'X-Requested-With': 'XMLHttpRequest',
@@ -105,33 +46,13 @@ const withMasterpassRestCallback =
105
46
  body: new URLSearchParams(body)
106
47
  });
107
48
 
108
- logger.info('Masterpass REST callback request', {
109
- requestUrl: requestUrl.toString(),
110
- status: request.status,
111
- requestHeaders,
112
- ip
113
- });
114
-
115
49
  const response = await request.json();
116
-
117
- const { context_list: contextList, errors } = response;
118
-
119
- let redirectUrl = response.redirect_url;
120
-
121
- if (!redirectUrl && contextList && contextList.length > 0) {
122
- for (const context of contextList) {
123
- if (context.page_context && context.page_context.redirect_url) {
124
- redirectUrl = context.page_context.redirect_url;
125
- break;
126
- }
127
- }
128
- }
50
+ const { errors } = response;
129
51
 
130
52
  if (errors && Object.keys(errors).length) {
131
- logger.error('Error while processing masterpass REST callback', {
132
- middleware: 'masterpass-rest-callback',
53
+ logger.error('Error while processing MasterpassRestCompletePage', {
54
+ middleware: 'masterpass-rest-complete',
133
55
  errors,
134
- requestHeaders,
135
56
  ip
136
57
  });
137
58
 
@@ -143,73 +64,36 @@ const withMasterpassRestCallback =
143
64
  {
144
65
  status: 303,
145
66
  headers: {
146
- 'Set-Cookie': `pz-pos-error=${JSON.stringify(errors)}; path=/;`
67
+ 'Set-Cookie': `pz-pos-error=${encodeURIComponent(JSON.stringify(errors))}; path=/;`
147
68
  }
148
69
  }
149
70
  );
150
71
  }
151
72
 
152
- logger.info('Masterpass REST callback response', {
153
- middleware: 'masterpass-rest-callback',
154
- contextList,
155
- redirectUrl,
156
- ip
157
- });
73
+ const redirectUrl =
74
+ response.redirect_url ||
75
+ response.context_list?.[0]?.page_context?.redirect_url;
158
76
 
159
- if (!redirectUrl) {
160
- logger.warn(
161
- 'No redirection url found in response. Redirecting to checkout page.',
162
- {
163
- middleware: 'masterpass-rest-callback',
164
- requestHeaders,
165
- response: JSON.stringify(response),
166
- ip
167
- }
77
+ if (redirectUrl) {
78
+ return NextResponse.redirect(
79
+ `${url.origin}${getUrlPathWithLocale(redirectUrl, req.cookies.get('pz-locale')?.value)}`,
80
+ 303
168
81
  );
169
-
170
- const redirectUrlWithLocale = `${url.origin}${getUrlPathWithLocale(
171
- '/orders/checkout/',
172
- req.cookies.get('pz-locale')?.value
173
- )}`;
174
-
175
- return NextResponse.redirect(redirectUrlWithLocale, 303);
176
82
  }
177
83
 
178
- const redirectUrlWithLocale = `${url.origin}${getUrlPathWithLocale(
179
- redirectUrl,
180
- req.cookies.get('pz-locale')?.value
181
- )}`;
182
-
183
- logger.info('Redirecting after masterpass REST callback', {
184
- middleware: 'masterpass-rest-callback',
185
- redirectUrlWithLocale,
186
- ip
187
- });
188
-
189
- const nextResponse = NextResponse.redirect(redirectUrlWithLocale, 303);
190
-
191
- nextResponse.headers.set(
192
- 'Set-Cookie',
193
- request.headers.get('set-cookie') ?? ''
84
+ return NextResponse.redirect(
85
+ `${url.origin}${getUrlPathWithLocale('/orders/checkout/', req.cookies.get('pz-locale')?.value)}`,
86
+ 303
194
87
  );
195
-
196
- return nextResponse;
197
88
  } catch (error) {
198
- logger.error('Error while processing masterpass REST callback', {
199
- middleware: 'masterpass-rest-callback',
89
+ logger.error('Error while processing MasterpassRestCompletePage', {
90
+ middleware: 'masterpass-rest-complete',
200
91
  error,
201
- requestHeaders: {
202
- Cookie: req.headers.get('cookie') ?? '',
203
- 'x-currency': req.cookies.get('pz-currency')?.value ?? ''
204
- },
205
92
  ip
206
93
  });
207
94
 
208
95
  return NextResponse.redirect(
209
- `${url.origin}${getUrlPathWithLocale(
210
- '/orders/checkout/',
211
- req.cookies.get('pz-locale')?.value
212
- )}`,
96
+ `${url.origin}${getUrlPathWithLocale('/orders/checkout/', req.cookies.get('pz-locale')?.value)}`,
213
97
  303
214
98
  );
215
99
  }
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.116.0-snapshot-ZERO-3959-20260106131052",
4
+ "version": "1.117.0-rc.0",
5
5
  "private": false,
6
6
  "license": "MIT",
7
7
  "bin": {
@@ -35,7 +35,7 @@
35
35
  "set-cookie-parser": "2.6.0"
36
36
  },
37
37
  "devDependencies": {
38
- "@akinon/eslint-plugin-projectzero": "1.116.0-snapshot-ZERO-3959-20260106131052",
38
+ "@akinon/eslint-plugin-projectzero": "1.117.0-rc.0",
39
39
  "@babel/core": "7.26.10",
40
40
  "@babel/preset-env": "7.26.9",
41
41
  "@babel/preset-typescript": "7.27.0",
package/plugins.d.ts CHANGED
@@ -37,6 +37,16 @@ declare module '@akinon/pz-cybersource-uc/src/redux/middleware' {
37
37
  export default middleware as any;
38
38
  }
39
39
 
40
+ declare module '@akinon/pz-apple-pay' {}
41
+
42
+ declare module '@akinon/pz-similar-products' {
43
+ export const SimilarProductsModal: any;
44
+ export const SimilarProductsFilterSidebar: any;
45
+ export const SimilarProductsResultsGrid: any;
46
+ export const SimilarProductsPlugin: any;
47
+ export const SimilarProductsButtonPlugin: any;
48
+ }
49
+
40
50
  declare module '@akinon/pz-cybersource-uc/src/redux/reducer' {
41
51
  export default reducer as any;
42
52
  }
package/plugins.js CHANGED
@@ -16,11 +16,13 @@ module.exports = [
16
16
  'pz-tabby-extension',
17
17
  'pz-apple-pay',
18
18
  'pz-tamara-extension',
19
+ 'pz-similar-products',
19
20
  'pz-cybersource-uc',
20
21
  'pz-hepsipay',
21
22
  'pz-flow-payment',
22
23
  'pz-virtual-try-on',
23
24
  'pz-masterpass-rest',
24
25
  'pz-similar-products',
25
- 'pz-haso'
26
+ 'pz-haso',
27
+ 'pz-google-pay'
26
28
  ];
package/types/index.ts CHANGED
@@ -83,6 +83,12 @@ export interface Settings {
83
83
  };
84
84
  usePrettyUrlRoute?: boolean;
85
85
  commerceUrl: string;
86
+ /**
87
+ * This option allows you to track Sentry events on the client side, in addition to server and edge environments.
88
+ *
89
+ * It overrides process.env.NEXT_PUBLIC_SENTRY_DSN and process.env.SENTRY_DSN.
90
+ */
91
+ sentryDsn?: string;
86
92
  redis: {
87
93
  defaultExpirationTime: number;
88
94
  };
package/utils/index.ts CHANGED
@@ -193,7 +193,8 @@ export const urlLocaleMatcherRegex = new RegExp(
193
193
  );
194
194
 
195
195
  export const getPosError = () => {
196
- const error = JSON.parse(getCookie('pz-pos-error') ?? '{}');
196
+ const cookieValue = getCookie('pz-pos-error');
197
+ const error = JSON.parse(cookieValue ? decodeURIComponent(cookieValue) : '{}');
197
198
 
198
199
  // delete 'pz-pos-error' cookie when refreshing or closing page
199
200
  window.addEventListener('beforeunload', () => {
@@ -1,8 +1,14 @@
1
1
  const iframeURLChange = (iframe, callback) => {
2
2
  iframe.addEventListener('load', () => {
3
3
  setTimeout(() => {
4
- if (iframe?.contentWindow?.location) {
5
- callback(iframe.contentWindow.location);
4
+ try {
5
+ if (iframe?.contentWindow?.location) {
6
+ const iframeLocation = iframe.contentWindow.location;
7
+
8
+ callback(iframeLocation);
9
+ }
10
+ } catch (error) {
11
+ // Expected: browser blocks cross-origin iframe access for security
6
12
  }
7
13
  }, 0);
8
14
  });
@@ -1,8 +1,14 @@
1
1
  const iframeURLChange = (iframe, callback) => {
2
2
  iframe.addEventListener('load', () => {
3
3
  setTimeout(() => {
4
- if (iframe?.contentWindow?.location) {
5
- callback(iframe.contentWindow.location);
4
+ try {
5
+ if (iframe?.contentWindow?.location) {
6
+ const iframeLocation = iframe.contentWindow.location;
7
+
8
+ callback(iframeLocation);
9
+ }
10
+ } catch (error) {
11
+ // Expected: browser blocks cross-origin iframe access for security
6
12
  }
7
13
  }, 0);
8
14
  });