@akinon/next 1.119.0 → 1.120.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/utils/index.ts CHANGED
@@ -7,6 +7,7 @@ export * from './get-currency';
7
7
  export * from './menu-generator';
8
8
  export * from './generate-commerce-search-params';
9
9
  export * from './get-currency-label';
10
+ export * from './get-checkout-path';
10
11
 
11
12
  export function getCookie(name: string) {
12
13
  if (typeof document === 'undefined') {
@@ -194,7 +195,9 @@ export const urlLocaleMatcherRegex = new RegExp(
194
195
 
195
196
  export const getPosError = () => {
196
197
  const cookieValue = getCookie('pz-pos-error');
197
- const error = JSON.parse(cookieValue ? decodeURIComponent(cookieValue) : '{}');
198
+ const error = JSON.parse(
199
+ cookieValue ? decodeURIComponent(cookieValue) : '{}'
200
+ );
198
201
 
199
202
  // delete 'pz-pos-error' cookie when refreshing or closing page
200
203
  window.addEventListener('beforeunload', () => {
@@ -204,6 +207,23 @@ export const getPosError = () => {
204
207
  return error;
205
208
  };
206
209
 
210
+ export const checkPaymentWillRedirect = (response: {
211
+ context_list?: Array<{
212
+ page_name: string;
213
+ page_context?: { context_data?: { redirect_url?: string } };
214
+ }>;
215
+ redirect_url?: string;
216
+ errors?: unknown;
217
+ }): boolean => {
218
+ if (!response) return false;
219
+
220
+ const hasThankYouPage = response.context_list?.some(
221
+ (c) => c.page_name === 'ThankYouPage'
222
+ );
223
+
224
+ return Boolean(hasThankYouPage || response.redirect_url);
225
+ };
226
+
207
227
  export const urlSchemes = [
208
228
  'http',
209
229
  'tel:',
@@ -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
  });
package/with-pz-config.js CHANGED
@@ -65,10 +65,7 @@ const defaultConfig = {
65
65
  translations: false
66
66
  };
67
67
  return config;
68
- },
69
- sentry: {
70
- hideSourceMaps: true
71
- } // TODO: This section will be reviewed again in the Sentry 8 update.
68
+ }
72
69
  };
73
70
 
74
71
  const withPzConfig = (