@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/CHANGELOG.md +28 -0
- package/api/barcode-search.ts +59 -0
- package/bin/pz-generate-routes.js +10 -1
- package/components/plugin-module.tsx +2 -2
- package/data/client/account.ts +12 -1
- package/data/client/checkout.ts +100 -70
- package/data/urls.ts +5 -1
- package/lib/cache-handler.mjs +8 -2
- package/lib/cache.ts +8 -3
- package/middlewares/bfcache-headers.ts +18 -0
- package/middlewares/complete-gpay.ts +6 -5
- package/middlewares/complete-masterpass.ts +6 -5
- package/middlewares/complete-wallet.ts +6 -5
- package/middlewares/default.ts +62 -19
- package/middlewares/index.ts +3 -1
- package/middlewares/masterpass-rest-callback.ts +13 -8
- package/middlewares/redirection-payment.ts +6 -5
- package/middlewares/saved-card-redirection.ts +6 -5
- package/middlewares/three-d-redirection.ts +6 -5
- package/middlewares/wallet-complete-redirection.ts +6 -5
- package/package.json +2 -2
- package/plugins.d.ts +10 -0
- package/plugins.js +1 -0
- package/redux/middlewares/checkout.ts +11 -1
- package/redux/middlewares/pre-order/installment-option.ts +9 -1
- package/types/index.ts +6 -0
- package/utils/app-fetch.ts +13 -6
- package/utils/get-checkout-path.ts +3 -0
- package/utils/index.ts +21 -1
- package/utils/mobile-3d-iframe.ts +8 -2
- package/utils/redirection-iframe.ts +8 -2
- package/with-pz-config.js +1 -4
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(
|
|
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
|
-
|
|
5
|
-
|
|
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
|
-
|
|
5
|
-
|
|
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