@zonos/elements 1.3.136 → 1.3.137
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/dist/cjs/{cart-0f32f556.js → cart-dea3242e.js} +75 -2
- package/dist/cjs/index.cjs.js +13 -10
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{paypal-fd50c7d5.js → paypal-729f9ed3.js} +1 -1
- package/dist/cjs/zonos-address_7.cjs.entry.js +1 -1
- package/dist/cjs/zonos-cart-items_13.cjs.entry.js +21 -8
- package/dist/cjs/zonos-checkout.cjs.entry.js +76 -9
- package/dist/cjs/zonos-controller.cjs.entry.js +1 -1
- package/dist/cjs/zonos-country-flag.cjs.entry.js +1 -1
- package/dist/cjs/zonos-country-select_4.cjs.entry.js +1 -1
- package/dist/cjs/zonos-elements.cjs.js +1 -1
- package/dist/cjs/zonos-hello-dialog.cjs.entry.js +1 -1
- package/dist/cjs/zonos-hello.cjs.entry.js +1 -1
- package/dist/cjs/zonos-language-select_2.cjs.entry.js +1 -1
- package/dist/cjs/zonos-notification_3.cjs.entry.js +2 -2
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.js +19 -6
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +76 -8
- package/dist/collection/components/store/checkout/stripe.js +15 -2
- package/dist/collection/components/store/translationStore/strings.arabic.js +3 -0
- package/dist/collection/components/store/translationStore/strings.base.js +3 -0
- package/dist/collection/components/store/translationStore/strings.chinese.js +3 -0
- package/dist/collection/components/store/translationStore/strings.danish.js +3 -0
- package/dist/collection/components/store/translationStore/strings.dutch.js +3 -0
- package/dist/collection/components/store/translationStore/strings.french.js +3 -0
- package/dist/collection/components/store/translationStore/strings.german.js +3 -0
- package/dist/collection/components/store/translationStore/strings.hebrew.js +3 -0
- package/dist/collection/components/store/translationStore/strings.indonesian.js +3 -0
- package/dist/collection/components/store/translationStore/strings.italian.js +3 -0
- package/dist/collection/components/store/translationStore/strings.japanese.js +3 -0
- package/dist/collection/components/store/translationStore/strings.korean.js +3 -0
- package/dist/collection/components/store/translationStore/strings.norwegian.js +3 -0
- package/dist/collection/components/store/translationStore/strings.polish.js +3 -0
- package/dist/collection/components/store/translationStore/strings.portuguese.js +3 -0
- package/dist/collection/components/store/translationStore/strings.russian.js +3 -0
- package/dist/collection/components/store/translationStore/strings.spanish.js +3 -0
- package/dist/collection/components/store/translationStore/strings.swedish.js +3 -0
- package/dist/collection/components/store/translationStore/strings.turkish.js +3 -0
- package/dist/collection/components/store/translationStore/strings.vietnamese.js +3 -0
- package/dist/collection/scripts/_zonosBase.js +6 -3
- package/dist/collection/types/generated/graphql.frontend.types.js +2 -3
- package/dist/collection/types/generated/graphql.internal.types.js +1 -0
- package/dist/esm/{cart-3e0e4d5c.js → cart-c15cb7dd.js} +76 -3
- package/dist/esm/index.js +13 -10
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{paypal-b4af6cc0.js → paypal-de439a93.js} +1 -1
- package/dist/esm/zonos-address_7.entry.js +1 -1
- package/dist/esm/zonos-cart-items_13.entry.js +21 -8
- package/dist/esm/zonos-checkout.entry.js +77 -10
- package/dist/esm/zonos-controller.entry.js +1 -1
- package/dist/esm/zonos-country-flag.entry.js +1 -1
- package/dist/esm/zonos-country-select_4.entry.js +1 -1
- package/dist/esm/zonos-elements.js +1 -1
- package/dist/esm/zonos-hello-dialog.entry.js +1 -1
- package/dist/esm/zonos-hello.entry.js +1 -1
- package/dist/esm/zonos-language-select_2.entry.js +1 -1
- package/dist/esm/zonos-notification_3.entry.js +2 -2
- package/dist/esm-es5/cart-c15cb7dd.js +1 -0
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/{paypal-b4af6cc0.js → paypal-de439a93.js} +1 -1
- package/dist/esm-es5/zonos-address_7.entry.js +1 -1
- package/dist/esm-es5/zonos-cart-items_13.entry.js +1 -1
- package/dist/esm-es5/zonos-checkout.entry.js +1 -1
- package/dist/esm-es5/zonos-controller.entry.js +1 -1
- package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
- package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
- package/dist/esm-es5/zonos-elements.js +1 -1
- package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
- package/dist/esm-es5/zonos-hello.entry.js +1 -1
- package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
- package/dist/esm-es5/zonos-notification_3.entry.js +1 -1
- package/dist/scripts/index.js +1 -1
- package/dist/scripts/loadZonos.js +1 -1
- package/dist/scripts/zonos.js +1 -1
- package/dist/types/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.d.ts +1 -1
- package/dist/types/components/checkout/zonos-checkout/zonos-checkout.d.ts +5 -0
- package/dist/types/components/store/translationStore/strings.arabic.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.base.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.chinese.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.danish.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.dutch.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.french.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.german.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.hebrew.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.indonesian.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.italian.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.japanese.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.korean.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.norwegian.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.polish.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.portuguese.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.russian.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.spanish.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.swedish.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.turkish.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.vietnamese.d.ts +3 -0
- package/dist/types/components/store/translationStore.d.ts +1 -1
- package/dist/types/components/utils/api/getLocaleMessages.d.ts +1 -1
- package/dist/types/types/generated/graphql.frontend.types.d.ts +3 -23
- package/dist/types/types/generated/graphql.frontend.types.ts +3 -36
- package/dist/types/types/generated/graphql.internal.types.d.ts +1 -0
- package/dist/types/types/generated/graphql.internal.types.ts +1 -0
- package/dist/zonos-elements/assets/RemoveIcon.svg +1 -1
- package/dist/zonos-elements/index.esm.js +1 -1
- package/dist/zonos-elements/{p-3f2ea446.entry.js → p-0867e94a.entry.js} +1 -1
- package/dist/zonos-elements/p-1af38265.system.js +1 -0
- package/dist/zonos-elements/{p-887b05eb.system.entry.js → p-1faa4294.system.entry.js} +1 -1
- package/dist/zonos-elements/p-2de631c4.system.entry.js +1 -0
- package/dist/zonos-elements/{p-49cecdf9.system.entry.js → p-3039f460.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-3a5fb01a.system.entry.js → p-35ccf9d8.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-c52a8369.system.entry.js → p-374680fd.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-897c809a.entry.js → p-43ac026b.entry.js} +1 -1
- package/dist/zonos-elements/{p-6b8db2d3.entry.js → p-4aecf7fc.entry.js} +1 -1
- package/dist/zonos-elements/{p-37991f24.entry.js → p-51f8719d.entry.js} +1 -1
- package/dist/zonos-elements/{p-b6fea87a.entry.js → p-56e63659.entry.js} +1 -1
- package/dist/zonos-elements/p-611842b5.entry.js +1 -0
- package/dist/zonos-elements/{p-4b680c1e.system.entry.js → p-765ddab5.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-85fbb5f0.entry.js → p-77b2acf4.entry.js} +1 -1
- package/dist/zonos-elements/p-7838aa96.entry.js +1 -0
- package/dist/zonos-elements/p-7c08bf7d.system.js +1 -0
- package/dist/zonos-elements/{p-a28f3298.system.entry.js → p-7eceaa3a.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-05826697.system.entry.js → p-910c1247.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-e1ac8cd8.js → p-938b2b70.js} +1 -1
- package/dist/zonos-elements/p-940e327f.system.entry.js +1 -0
- package/dist/zonos-elements/{p-e9db73d9.entry.js → p-a5d35e84.entry.js} +1 -1
- package/dist/zonos-elements/p-afa5c13c.js +1 -0
- package/dist/zonos-elements/{p-16e5df29.system.entry.js → p-c710bde9.system.entry.js} +1 -1
- package/dist/zonos-elements/p-c78dd680.system.js +1 -1
- package/dist/zonos-elements/{p-bec4d2c7.entry.js → p-cb6baa14.entry.js} +1 -1
- package/dist/zonos-elements/{p-18cb1aee.system.js → p-e9b39df1.system.js} +1 -1
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/package.json +1 -1
- package/dist/esm-es5/cart-3e0e4d5c.js +0 -1
- package/dist/zonos-elements/p-69045ca3.js +0 -1
- package/dist/zonos-elements/p-af3ecd9d.system.entry.js +0 -1
- package/dist/zonos-elements/p-b776e39e.system.js +0 -1
- package/dist/zonos-elements/p-c8927b27.system.entry.js +0 -1
- package/dist/zonos-elements/p-caddd067.entry.js +0 -1
- package/dist/zonos-elements/p-e9862f66.entry.js +0 -1
- package/dist/zonos-elements/p-fa790aaf.system.js +0 -1
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-d56e0a8b.js');
|
|
6
|
-
const cart = require('./cart-
|
|
7
|
-
const paypal = require('./paypal-
|
|
6
|
+
const cart = require('./cart-dea3242e.js');
|
|
7
|
+
const paypal = require('./paypal-729f9ed3.js');
|
|
8
8
|
const zonosStore = require('./zonosStore-293bb3ba.js');
|
|
9
9
|
const handleFetch = require('./handleFetch-4a90f091.js');
|
|
10
10
|
const createCustomEvent = require('./createCustomEvent-3e982e57.js');
|
|
@@ -296,6 +296,52 @@ const ZonosCheckout = class {
|
|
|
296
296
|
}
|
|
297
297
|
return false;
|
|
298
298
|
};
|
|
299
|
+
/**
|
|
300
|
+
* Check if stripe payment intent is succeeded or in a good state to move forward
|
|
301
|
+
*/
|
|
302
|
+
this.checkStripePaymentIntentStatus = async ({ triggeredButton, }) => {
|
|
303
|
+
const isImmediatelyTriggered = triggeredButton === null || triggeredButton === void 0 ? void 0 : triggeredButton.matches(`#${CheckoutConfig.checkoutHiddenBtnSelector}`);
|
|
304
|
+
const isCartDataAvailable = !!window.Zonos.cartData;
|
|
305
|
+
const searchParams = new URL(window.location.href).searchParams;
|
|
306
|
+
const stripeClientSecret = searchParams.get('payment_intent_client_secret');
|
|
307
|
+
const zonosCheckoutSessionId = searchParams.get('zonosCheckoutSessionId');
|
|
308
|
+
// Allow to proceed to order if Checkout is triggered by Checkout button click by user
|
|
309
|
+
if (!isImmediatelyTriggered) {
|
|
310
|
+
handleFetch.log('Checkout is triggered by user, no need to check stripe payment intent status');
|
|
311
|
+
return { shouldAllowOrder: true };
|
|
312
|
+
}
|
|
313
|
+
handleFetch.log('Payment intent exist, checking stripe payment intent status');
|
|
314
|
+
// Allow to proceed to order if there's no stripe client secret and cart data is available
|
|
315
|
+
if (!stripeClientSecret) {
|
|
316
|
+
handleFetch.log('No stripe client secret found in the URL, proceed to order if cart data is available');
|
|
317
|
+
return { shouldAllowOrder: isCartDataAvailable };
|
|
318
|
+
}
|
|
319
|
+
const { error, status } = await cart.stripeStoreRetrievePayment({
|
|
320
|
+
clientSecret: stripeClientSecret,
|
|
321
|
+
});
|
|
322
|
+
// check if this is redirect after order
|
|
323
|
+
const isJustRedirected = new URLSearchParams(window.location.search).get('redirect_status');
|
|
324
|
+
// If just redirected from Payment provider, show the success screen or error screen based on the status
|
|
325
|
+
if (isJustRedirected) {
|
|
326
|
+
if (!error) {
|
|
327
|
+
handleFetch.log('Payment intent is succeeded or in a good state to move forward, show success screen');
|
|
328
|
+
}
|
|
329
|
+
else {
|
|
330
|
+
handleFetch.log('Payment intent failed, show status from error');
|
|
331
|
+
}
|
|
332
|
+
this.open = true;
|
|
333
|
+
cart.cartStore.checkoutSessionId = zonosCheckoutSessionId;
|
|
334
|
+
cart.stripeStore.clientSecret = stripeClientSecret;
|
|
335
|
+
void this.setToFinishStep(status);
|
|
336
|
+
return { shouldAllowOrder: false };
|
|
337
|
+
}
|
|
338
|
+
if (!isCartDataAvailable) {
|
|
339
|
+
handleFetch.log('Cart data is not available, only check payment intent status, skip order.');
|
|
340
|
+
return { shouldAllowOrder: false };
|
|
341
|
+
}
|
|
342
|
+
handleFetch.log('Payment intent is not succeeded, proceed to order');
|
|
343
|
+
return { shouldAllowOrder: true };
|
|
344
|
+
};
|
|
299
345
|
this.formatDate = (timestamp) => {
|
|
300
346
|
if (!timestamp) {
|
|
301
347
|
return '';
|
|
@@ -329,6 +375,7 @@ const ZonosCheckout = class {
|
|
|
329
375
|
this.mobile = false;
|
|
330
376
|
this.defaultAddress = null;
|
|
331
377
|
this.forceDialogOpen = false;
|
|
378
|
+
this.defaultAddressParams = null;
|
|
332
379
|
this.open = this.forceDialogOpen;
|
|
333
380
|
this.stripe = window.Zonos.stripe;
|
|
334
381
|
this.submitLoading = false;
|
|
@@ -534,7 +581,7 @@ const ZonosCheckout = class {
|
|
|
534
581
|
buttonAnchorSelector,
|
|
535
582
|
// hidden button for domestic redirected
|
|
536
583
|
`#${CheckoutConfig.domesticRedirectedBtnSelector}`,
|
|
537
|
-
// hidden button for legacy checkout facade
|
|
584
|
+
// hidden button for legacy checkout facade and when client secret is provided in the query param or session storage when user is redirected from stripe
|
|
538
585
|
`#${CheckoutConfig.checkoutHiddenBtnSelector}`,
|
|
539
586
|
].filter(Boolean);
|
|
540
587
|
// also attach event to hidden button if user was redirected with shipping address session
|
|
@@ -559,6 +606,20 @@ const ZonosCheckout = class {
|
|
|
559
606
|
e.preventDefault();
|
|
560
607
|
e.stopPropagation();
|
|
561
608
|
handleFetch.log('zonos checkout button clicked');
|
|
609
|
+
/**
|
|
610
|
+
* Check to see if there is any payment intent that's succeeded and got reload/redirected to the current on approved or authorized by Stripe
|
|
611
|
+
* User stories:
|
|
612
|
+
* - Some 3DS or "Buy Now Pay Later" payments might need to reload the page or redirect to return_url from Stripe after completing the payment.
|
|
613
|
+
* - `return_url` sometimes has client_secret in the query param, but not always. We need to check the payment intent status to see if it's succeeded or not.
|
|
614
|
+
*
|
|
615
|
+
**/
|
|
616
|
+
const { shouldAllowOrder } = await this.checkStripePaymentIntentStatus({
|
|
617
|
+
triggeredButton: e.target,
|
|
618
|
+
});
|
|
619
|
+
// Only allow order to proceed if payment intent is not succeeded
|
|
620
|
+
if (!shouldAllowOrder) {
|
|
621
|
+
return;
|
|
622
|
+
}
|
|
562
623
|
// start loading
|
|
563
624
|
cart.stripeStore.isFetchingSession = true;
|
|
564
625
|
this.open = true;
|
|
@@ -629,7 +690,7 @@ const ZonosCheckout = class {
|
|
|
629
690
|
// remove the button after it's clicked
|
|
630
691
|
button.remove();
|
|
631
692
|
}
|
|
632
|
-
// For legacy checkout facade and in case the cart is provided in the query param, open Checkout right away
|
|
693
|
+
// For legacy checkout facade and in case the cart or stripe client secret is provided in the query param, open Checkout right away
|
|
633
694
|
if (button.matches(`#${CheckoutConfig.checkoutHiddenBtnSelector}`)) {
|
|
634
695
|
// trigger the click event on the button
|
|
635
696
|
button.dispatchEvent(createCustomEvent.createCustomEvent('click'));
|
|
@@ -683,7 +744,7 @@ const ZonosCheckout = class {
|
|
|
683
744
|
.join(', '));
|
|
684
745
|
return;
|
|
685
746
|
}
|
|
686
|
-
this.
|
|
747
|
+
this.defaultAddressParams = {
|
|
687
748
|
address: {
|
|
688
749
|
city: city || '',
|
|
689
750
|
country,
|
|
@@ -891,6 +952,9 @@ const ZonosCheckout = class {
|
|
|
891
952
|
// redirect to vendor store url if this is legacy checkout.
|
|
892
953
|
if (window.Zonos.isLegacyCheckout && window.Zonos.cartData) {
|
|
893
954
|
const storeBaseUrl = window.Zonos.cartData.storeBaseUrl;
|
|
955
|
+
if (window.parent) {
|
|
956
|
+
window.parent.location.href = storeBaseUrl;
|
|
957
|
+
}
|
|
894
958
|
window.location.href = storeBaseUrl;
|
|
895
959
|
return;
|
|
896
960
|
}
|
|
@@ -898,14 +962,17 @@ const ZonosCheckout = class {
|
|
|
898
962
|
const url = window.location.href;
|
|
899
963
|
// Remove query parameters
|
|
900
964
|
const cleanUrl = url.split('?')[0];
|
|
901
|
-
const isTestMode = createCustomEvent.getIsTestMode();
|
|
902
965
|
this.open = false;
|
|
903
|
-
|
|
966
|
+
const isDashboard = window.location.hostname.includes('dashboard.zonos.com');
|
|
967
|
+
/**
|
|
968
|
+
* Update the URL without query parameters only when checkout is not running in dashboard.zonos.com.
|
|
969
|
+
* We don't want to reload the page when dashboard is running it. Test mode should do what live mode does.
|
|
970
|
+
*/
|
|
904
971
|
/**
|
|
905
972
|
* Setting the state to null in window.history.replaceState can cause issues with rendering when using next/link and pressing the back button.
|
|
906
973
|
* @ref https://github.com/vercel/next.js/issues/33233#issuecomment-1052349396
|
|
907
974
|
**/
|
|
908
|
-
if (!
|
|
975
|
+
if (!isDashboard) {
|
|
909
976
|
window.history.replaceState(window.history.state, document.title, cleanUrl);
|
|
910
977
|
// Reload the page
|
|
911
978
|
window.location.reload();
|
|
@@ -1046,7 +1113,7 @@ const ZonosCheckout = class {
|
|
|
1046
1113
|
'--zonos--primary-color': !this.isMobile
|
|
1047
1114
|
? colorPrimary
|
|
1048
1115
|
: undefined,
|
|
1049
|
-
}) }, !this.isMobile && renderTopHeader(), cart.cartStore.step === 'customer-info' && (index.h("zonos-customer-info", { continueLoading: this.submitLoading, defaultAddress: this.defaultAddress, isMobile: this.isMobile, onContinueClicked: () => this.handleCustomerInfoContinue(), submitBtnColor: submitButtonColor })), cart.cartStore.step === 'shipping' && (index.h("zonos-shipping", { continueLoading: this.submitLoading, onContinueClicked: () => this.handleShippingContinue(), submitBtnColor: submitButtonColor })), cart.cartStore.step === 'payment' && (index.h("zonos-checkout-payment", { continueLoading: this.submitLoading, onContinueClicked: async () => {
|
|
1116
|
+
}) }, !this.isMobile && renderTopHeader(), cart.cartStore.step === 'customer-info' && (index.h("zonos-customer-info", { continueLoading: this.submitLoading, defaultAddress: this.defaultAddress || this.defaultAddressParams, isMobile: this.isMobile, onContinueClicked: () => this.handleCustomerInfoContinue(), submitBtnColor: submitButtonColor })), cart.cartStore.step === 'shipping' && (index.h("zonos-shipping", { continueLoading: this.submitLoading, onContinueClicked: () => this.handleShippingContinue(), submitBtnColor: submitButtonColor })), cart.cartStore.step === 'payment' && (index.h("zonos-checkout-payment", { continueLoading: this.submitLoading, onContinueClicked: async () => {
|
|
1050
1117
|
await this.handleStripePaymentContinue();
|
|
1051
1118
|
}, submitBtnColor: submitButtonColor }))), index.h("div", { class: "zonos--right", "data-theme": rightSideTheme }, this.isMobile && renderTopHeader(), index.h("div", { class: "zonos--right-actions" }, window.Zonos.showBaseForeign && (index.h("zonos-currency-toggle", null)), !this.isLegacyCheckout && (index.h("zonos-button", { class: "zonos--close-button", icon: index.h("zonos-icon", { "aria-label": "Close checkout dialog", content: RemoveIcon.RemoveIcon }), noBackground: true, onClick: () => this.closeDialogHandler() }))), index.h("div", { class: "flex--wrapper" }, index.h("div", { class: "zonos--wrapper" }, index.h("zonos-review", { collapsed: this.collapseReviewMobile, mobile: this.isMobile, onClick: () => {
|
|
1052
1119
|
// do nothing if it's not mobile
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-d56e0a8b.js');
|
|
6
|
-
const cart = require('./cart-
|
|
6
|
+
const cart = require('./cart-dea3242e.js');
|
|
7
7
|
const zonosStore = require('./zonosStore-293bb3ba.js');
|
|
8
8
|
const handleFetch = require('./handleFetch-4a90f091.js');
|
|
9
9
|
require('./isDarkColor-dd6d723b.js');
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-d56e0a8b.js');
|
|
6
|
-
const cart = require('./cart-
|
|
6
|
+
const cart = require('./cart-dea3242e.js');
|
|
7
7
|
const zonosStore = require('./zonosStore-293bb3ba.js');
|
|
8
8
|
const classes = require('./classes-b7918f56.js');
|
|
9
9
|
require('./handleFetch-4a90f091.js');
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-d56e0a8b.js');
|
|
6
|
-
const cart = require('./cart-
|
|
6
|
+
const cart = require('./cart-dea3242e.js');
|
|
7
7
|
const zonosStore = require('./zonosStore-293bb3ba.js');
|
|
8
8
|
const formatStringWithLinks = require('./formatStringWithLinks-52341fc7.js');
|
|
9
9
|
const isDarkColor = require('./isDarkColor-dd6d723b.js');
|
|
@@ -19,7 +19,7 @@ var patchBrowser = () => {
|
|
|
19
19
|
|
|
20
20
|
patchBrowser().then(async (options) => {
|
|
21
21
|
await appGlobals.globalScripts();
|
|
22
|
-
return index.bootstrapLazy(JSON.parse("[[\"zonos-checkout.cjs\",[[2,\"zonos-checkout\",{\"appearanceSettingsOverride\":[16],\"preview\":[4],\"mobile\":[4],\"defaultAddress\":[16],\"forceDialogOpen\":[4,\"force-dialog-open\"],\"open\":[32],\"stripe\":[32],\"submitLoading\":[32],\"collapseReviewMobile\":[32],\"isAttachError\":[32],\"isMobile\":[32],\"isIframed\":[32],\"zonosReviewRef\":[32],\"storybookPaymentStatusOverride\":[32],\"isLegacyCheckout\":[32],\"confirmDialogOpen\":[32],\"isCartExpired\":[32],\"inventoryCheckErrorMessage\":[32],\"placedOrderInfo\":[32],\"closeDialogHandler\":[64],\"init\":[64],\"setToFinishStep\":[64],\"mockCheckoutSession\":[64]},[[16,\"zonos--init-cart-info\",\"initCartInfoHandler\"],[4,\"keydown\",\"handleKeyPress\"],[9,\"resize\",\"handleWindowResize\"]],{\"appearanceSettingsOverride\":[\"appearanceSettingsOverrideChanged\",\"handleAppearanceSettingsOverrideChange\"],\"mobile\":[\"handleMobileChange\"],\"defaultAddress\":[\"handleAddressChange\"],\"open\":[\"handleOpenChange\"]}]]],[\"zonos-hello.cjs\",[[1,\"zonos-hello\",{\"mobileLocationOverride\":[1,\"mobile-location-override\"],\"animateFromLeftOverride\":[4,\"animate-from-left-override\"],\"appearanceSettingsOverride\":[16],\"showPeekMessage\":[32],\"zonosStoreHelloSettings\":[32],\"showDialog\":[32],\"peekMessage\":[32],\"initialUrl\":[32],\"allRestrictedItems\":[32],\"allFoundProducts\":[32],\"productsOnPage\":[32],\"isHelloWidgetRendered\":[32],\"isMobile\":[32],\"getCountryList\":[64],\"displayCurrency\":[64],\"convertAndFormat\":[64],\"convert\":[64],\"format\":[64],\"openHelloDialog\":[64]},[[9,\"resize\",\"handleResize\"]],{\"appearanceSettingsOverride\":[\"handleAppearanceSettingsOverrideChange\"]}]]],[\"zonos-controller.cjs\",[[1,\"zonos-controller\",{\"config\":[16],\"zonosApiKey\":[1,\"zonos-api-key\"],\"initCheckoutElement\":[64],\"setupGoogleFont\":[64],\"showNotification\":[64],\"reset\":[64],\"overrideConfig\":[64],\"overrideCountry\":[64],\"getAppearanceSetting\":[64],\"updateOrganizationName\":[64]},[[8,\"locationchange\",\"handleLocationChange\"]]]]],[\"zonos-tooltip.cjs\",[[1,\"zonos-tooltip\",{\"label\":[1],\"subtitle\":[1],\"showTooltip\":[32]}]]],[\"zonos-component.cjs\",[[1,\"zonos-component\",{\"first\":[1],\"middle\":[1],\"last\":[1]}]]],[\"zonos-link.cjs\",[[1,\"zonos-link\",{\"href\":[1],\"rel\":[1],\"target\":[1],\"linkTitle\":[1,\"link-title\"]}]]],[\"zonos-logo.cjs\",[[1,\"zonos-logo\",{\"theme\":[1],\"width\":[1]}]]],[\"zonos-hello-dialog.cjs\",[[1,\"zonos-hello-dialog\",{\"isOpen\":[4,\"is-open\"],\"setIsOpen\":[16],\"mobileLocationOverride\":[1,\"mobile-location-override\"],\"animateFromLeftOverride\":[4,\"animate-from-left-override\"],\"appearanceSettings\":[16],\"restrictedItems\":[16],\"welcomeMessage\":[32],\"showCountrySelect\":[32],\"showLanguageSelect\":[32]},[[4,\"click\",\"globalClickHandler\"]],{\"isOpen\":[\"isOpenHandler\"]}]]],[\"zonos-badge.cjs\",[[1,\"zonos-badge\",{\"bold\":[4],\"badgeColor\":[1,\"badge-color\"],\"icon\":[16],\"iconRight\":[4,\"icon-right\"],\"size\":[1],\"rounded\":[4],\"loading\":[4],\"dismissHandler\":[16]}]]],[\"zonos-shipping-rich-radio.cjs\",[[1,\"zonos-shipping-rich-radio\",{\"items\":[16],\"borderColor\":[1,\"border-color\"],\"borderStyle\":[1,\"border-style\"],\"theme\":[1],\"selectedItem\":[16]}]]],[\"zonos-toggle.cjs\",[[1,\"zonos-toggle\",{\"options\":[16],\"value\":[1]}]]],[\"zonos-collapse.cjs\",[[1,\"zonos-collapse\",{\"collapsed\":[4],\"collapseSize\":[2,\"collapse-size\"],\"height\":[32],\"iframe\":[32]}]]],[\"zonos-card.cjs\",[[1,\"zonos-card\",{\"actions\":[16],\"backgroundColor\":[1,\"background-color\"],\"borderRadius\":[2,\"border-radius\"],\"footerActions\":[16],\"footerContent\":[16],\"footerHeight\":[2,\"footer-height\"],\"label\":[16],\"spacing\":[1]}]]],[\"zonos-input.cjs\",[[1,\"zonos-input\",{\"inputValue\":[1,\"input-value\"],\"inputLabel\":[1,\"input-label\"],\"inputSize\":[1,\"input-size\"],\"isDisabled\":[4,\"is-disabled\"],\"isError\":[4,\"is-error\"],\"inputPlaceholder\":[1,\"input-placeholder\"],\"value\":[32]},null,{\"inputValue\":[\"onInputValueChange\"]}]]],[\"zonos-notification_3.cjs\",[[2,\"zonos-payment\",{\"titleText\":[1,\"title-text\"],\"stripe\":[32],\"stripeElements\":[32]},null,{\"stripeElements\":[\"watchInitStripe\"],\"stripe\":[\"watchInitStripe\"]}],[2,\"zonos-paypal-payment\"],[1,\"zonos-notification\",{\"notificationArray\":[32],\"showNotification\":[64]}]]],[\"zonos-banner.cjs\",[[1,\"zonos-banner\",{\"bannerTitle\":[1,\"banner-title\"],\"intent\":[1],\"hasContent\":[32]}]]],[\"zonos-country-flag.cjs\",[[1,\"zonos-country-flag\",{\"countryCode\":[1,\"country-code\"],\"size\":[2]}]]],[\"zonos-v-stack.cjs\",[[1,\"zonos-v-stack\",{\"spacing\":[2]}]]],[\"zonos-text.cjs\",[[1,\"zonos-text\",{\"textColor\":[1,\"text-color\"],\"size\":[1],\"type\":[1],\"weight\":[2],\"ready\":[32]}]]],[\"zonos-button_3.cjs\",[[17,\"zonos-button\",{\"buttonColor\":[1,\"button-color\"],\"backgroundColor\":[1,\"background-color\"],\"borderStyle\":[1,\"border-style\"],\"isDisabled\":[4,\"is-disabled\"],\"icon\":[16],\"iconRight\":[4,\"icon-right\"],\"size\":[1],\"variant\":[1],\"noBackground\":[4,\"no-background\"],\"withBoxShadow\":[4,\"with-box-shadow\"],\"noPaddingLeft\":[4,\"no-padding-left\"],\"noPaddingRight\":[4,\"no-padding-right\"],\"loading\":[4],\"justifyContent\":[1,\"justify-content\"],\"theme\":[1],\"hasIcon\":[32],\"hasContent\":[32]},[[2,\"click\",\"clickHandler\"]],{\"icon\":[\"iconChangeHandler\"]}],[1,\"zonos-spinner\",{\"size\":[2],\"spinnerColor\":[1,\"spinner-color\"]}],[1,\"zonos-icon\",{\"autoHeight\":[4,\"auto-height\"],\"iconColor\":[1,\"icon-color\"],\"content\":[1],\"size\":[2]}]]],[\"zonos-language-select_2.cjs\",[[1,\"zonos-language-select\",{\"handleOnClose\":[16]}],[1,\"zonos-select-dialog-header\",{\"handleOnClose\":[16],\"label\":[1]}]]],[\"zonos-country-select_4.cjs\",[[1,\"zonos-country-select\",{\"handleOnClose\":[16],\"inputValue\":[32]}],[1,\"zonos-hello-dialog-footer\",{\"appearanceSettings\":[16],\"setShowCountrySelect\":[16],\"setShowLanguageSelect\":[16]}],[1,\"zonos-custom-message\",{\"icon\":[1],\"message\":[1]}],[2,\"zonos-virtual-scroll\",{\"renderItem\":[16],\"itemWidth\":[2,\"item-width\"],\"fallbackItemHeight\":[2,\"fallback-item-height\"],\"itemHeights\":[16],\"container\":[32],\"scrollTop\":[32],\"totalHeight\":[32]},null,{\"itemHeights\":[\"updateTotalHeight\"],\"fallbackItemHeight\":[\"updateTotalHeight\"]}]]],[\"zonos-address_7.cjs\",[[1,\"zonos-address-update-dialog\",{\"continueLoading\":[4,\"continue-loading\"],\"dialogLoading\":[4,\"dialog-loading\"],\"dialogOpen\":[4,\"dialog-open\"],\"submitBtnType\":[1,\"submit-btn-type\"],\"submitBtnColor\":[1,\"submit-btn-color\"],\"isMobile\":[4,\"is-mobile\"],\"shippingAddress\":[16],\"billingAddress\":[16],\"translatedShippingAddress\":[16],\"translatedBillingAddress\":[16],\"showErrorBanner\":[32],\"translatedShippingAddressState\":[32],\"translatedBillingAddressState\":[32]},null,{\"translatedShippingAddress\":[\"watchTranslatedShippingAddress\"],\"translatedBillingAddress\":[\"watchTranslatedBillingAddress\"]}],[2,\"zonos-address\",{\"type\":[1],\"titleText\":[1,\"title-text\"],\"defaultAddress\":[16],\"stripe\":[32],\"isDirtyAddress\":[32]},null,{\"stripe\":[\"watchInitStripe\"]}],[1,\"zonos-checkbox\",{\"backgroundColor\":[1,\"background-color\"],\"label\":[1],\"isChecked\":[4,\"is-checked\"],\"isDisabled\":[4,\"is-disabled\"],\"size\":[2],\"fontSize\":[1,\"font-size\"],\"borderStyle\":[1,\"border-style\"]},[[1,\"click\",\"onClick\"]]],[2,\"zonos-link-authentication\",{\"titleText\":[1,\"title-text\"],\"defaultEmail\":[1,\"default-email\"],\"isEmailError\":[4,\"is-email-error\"],\"stripe\":[32]},null,{\"stripe\":[\"watchInitStripe\"]}],[1,\"zonos-dialog\",{\"open\":[4],\"headerText\":[1,\"header-text\"],\"width\":[1],\"height\":[1],\"minHeight\":[1,\"min-height\"],\"noHeader\":[4,\"no-header\"],\"noBodyPadding\":[4,\"no-body-padding\"],\"noBorder\":[4,\"no-border\"],\"borderStyle\":[1,\"border-style\"],\"noCloseButton\":[4,\"no-close-button\"],\"noClickOutside\":[4,\"no-click-outside\"],\"mobile\":[4],\"isLoading\":[4,\"is-loading\"],\"isMobile\":[32]},[[9,\"resize\",\"handleWindowResize\"],[4,\"keydown\",\"handleKeyDown\"]]],[1,\"zonos-address-display\",{\"currentAddress\":[16],\"addressType\":[1,\"address-type\"]}],[1,\"zonos-address-form\",{\"currentAddress\":[16],\"translatedAddress\":[16],\"addressType\":[1,\"address-type\"],\"localAddress\":[32]},null,{\"translatedAddress\":[\"watchCurrentAddress\"]}]]],[\"zonos-cart-items_13.cjs\",[[2,\"zonos-customer-info\",{\"continueLoading\":[4,\"continue-loading\"],\"submitBtnType\":[1,\"submit-btn-type\"],\"submitBtnColor\":[1,\"submit-btn-color\"],\"isMobile\":[4,\"is-mobile\"],\"defaultAddress\":[16],\"showErrorBanner\":[32],\"shippingCountry\":[32],\"isCheckingForRestrictedItems\":[32],\"isValidatingAddress\":[32],\"invalidShippingCharacterList\":[32],\"invalidBillingCharacterList\":[32],\"openAddressValidationDialog\":[32],\"isEmailError\":[32]}],[2,\"zonos-checkout-payment\",{\"submitBtnType\":[1,\"submit-btn-type\"],\"continueLoading\":[4,\"continue-loading\"],\"submitBtnColor\":[1,\"submit-btn-color\"],\"showErrorBanner\":[32]}],[1,\"zonos-checkout-footer\",{\"mobile\":[4],\"dataTheme\":[1,\"data-theme\"],\"showLanguageDialog\":[32],\"isMobile\":[32]},[[4,\"click\",\"handleGlobalClick\"]],{\"mobile\":[\"handleMobileChange\"]}],[2,\"zonos-shipping\",{\"continueLoading\":[4,\"continue-loading\"],\"submitBtnColor\":[1,\"submit-btn-color\"],\"submitBtnType\":[1,\"submit-btn-type\"],\"selectedShippingMethod\":[32],\"collapsedDAPOptions\":[32],\"isSelecting\":[32],\"showErrorBanner\":[32],\"serviceLevelsDDP\":[32],\"serviceLevelsDAP\":[32],\"serviceLevelsOther\":[32],\"serviceLevelsAll\":[32],\"displayBaseCurrency\":[32]}],[1,\"zonos-cart-subtotal\",{\"submitBtnType\":[1,\"submit-btn-type\"],\"submitBtnColor\":[1,\"submit-btn-color\"],\"loading\":[32]}],[1,\"zonos-cart-restricted-items\",{\"hide\":[4],\"errorImages\":[32],\"internalCollapsed\":[32],\"firstRender\":[32]}],[1,\"zonos-checkout-finish\",{\"borderRadius\":[1,\"border-radius\"],\"storybookForceStatus\":[1,\"storybook-force-status\"],\"overrideNotification\":[16],\"isLoading\":[32],\"notificationType\":[32],\"notificationTitle\":[32],\"notificationMessages\":[32],\"notificationActionText\":[32],\"order\":[32],\"isWaitingToRedirect\":[32]}],[1,\"zonos-confirm-dialog\",{\"dialogTitle\":[1,\"dialog-title\"],\"dialogIntent\":[1,\"dialog-intent\"],\"dialogSubtitle\":[1,\"dialog-subtitle\"],\"submitBtnColor\":[1,\"submit-btn-color\"],\"dialogConfirmBtnText\":[1,\"dialog-confirm-btn-text\"],\"dialogWidth\":[2,\"dialog-width\"],\"dialogCancelBtnText\":[1,\"dialog-cancel-btn-text\"],\"dialogType\":[1,\"dialog-type\"],\"isMobile\":[4,\"is-mobile\"],\"dialogOpen\":[4,\"dialog-open\"],\"noClickOutside\":[4,\"no-click-outside\"]},[[4,\"keydown\",\"handleKeyDown\"]]],[1,\"zonos-checkout-progress-tabs\",{\"tabColor\":[1,\"tab-color\"],\"backgroundColor\":[1,\"background-color\"],\"setTabItems\":[64],\"setTabSelected\":[64]}],[1,\"zonos-review\",{\"mobile\":[4],\"collapsed\":[4],\"isMobile\":[32]},[[9,\"resize\",\"handleWindowResize\"]]],[1,\"zonos-cart-items\",{\"errorImages\":[32]}],[1,\"zonos-currency-toggle\",{\"errorImages\":[32]}],[1,\"zonos-rest-state\",{\"restStateSubtitle\":[1,\"rest-state-subtitle\"],\"restStateTitle\":[1,\"rest-state-title\"],\"restStateType\":[1,\"rest-state-type\"],\"isErrorImageLoad\":[32]}]]]]"), options);
|
|
22
|
+
return index.bootstrapLazy(JSON.parse("[[\"zonos-checkout.cjs\",[[2,\"zonos-checkout\",{\"appearanceSettingsOverride\":[16],\"preview\":[4],\"mobile\":[4],\"defaultAddress\":[16],\"forceDialogOpen\":[4,\"force-dialog-open\"],\"defaultAddressParams\":[32],\"open\":[32],\"stripe\":[32],\"submitLoading\":[32],\"collapseReviewMobile\":[32],\"isAttachError\":[32],\"isMobile\":[32],\"isIframed\":[32],\"zonosReviewRef\":[32],\"storybookPaymentStatusOverride\":[32],\"isLegacyCheckout\":[32],\"confirmDialogOpen\":[32],\"isCartExpired\":[32],\"inventoryCheckErrorMessage\":[32],\"placedOrderInfo\":[32],\"closeDialogHandler\":[64],\"init\":[64],\"setToFinishStep\":[64],\"mockCheckoutSession\":[64]},[[16,\"zonos--init-cart-info\",\"initCartInfoHandler\"],[4,\"keydown\",\"handleKeyPress\"],[9,\"resize\",\"handleWindowResize\"]],{\"appearanceSettingsOverride\":[\"appearanceSettingsOverrideChanged\",\"handleAppearanceSettingsOverrideChange\"],\"mobile\":[\"handleMobileChange\"],\"defaultAddress\":[\"handleAddressChange\"],\"open\":[\"handleOpenChange\"]}]]],[\"zonos-hello.cjs\",[[1,\"zonos-hello\",{\"mobileLocationOverride\":[1,\"mobile-location-override\"],\"animateFromLeftOverride\":[4,\"animate-from-left-override\"],\"appearanceSettingsOverride\":[16],\"showPeekMessage\":[32],\"zonosStoreHelloSettings\":[32],\"showDialog\":[32],\"peekMessage\":[32],\"initialUrl\":[32],\"allRestrictedItems\":[32],\"allFoundProducts\":[32],\"productsOnPage\":[32],\"isHelloWidgetRendered\":[32],\"isMobile\":[32],\"getCountryList\":[64],\"displayCurrency\":[64],\"convertAndFormat\":[64],\"convert\":[64],\"format\":[64],\"openHelloDialog\":[64]},[[9,\"resize\",\"handleResize\"]],{\"appearanceSettingsOverride\":[\"handleAppearanceSettingsOverrideChange\"]}]]],[\"zonos-controller.cjs\",[[1,\"zonos-controller\",{\"config\":[16],\"zonosApiKey\":[1,\"zonos-api-key\"],\"initCheckoutElement\":[64],\"setupGoogleFont\":[64],\"showNotification\":[64],\"reset\":[64],\"overrideConfig\":[64],\"overrideCountry\":[64],\"getAppearanceSetting\":[64],\"updateOrganizationName\":[64]},[[8,\"locationchange\",\"handleLocationChange\"]]]]],[\"zonos-tooltip.cjs\",[[1,\"zonos-tooltip\",{\"label\":[1],\"subtitle\":[1],\"showTooltip\":[32]}]]],[\"zonos-component.cjs\",[[1,\"zonos-component\",{\"first\":[1],\"middle\":[1],\"last\":[1]}]]],[\"zonos-link.cjs\",[[1,\"zonos-link\",{\"href\":[1],\"rel\":[1],\"target\":[1],\"linkTitle\":[1,\"link-title\"]}]]],[\"zonos-logo.cjs\",[[1,\"zonos-logo\",{\"theme\":[1],\"width\":[1]}]]],[\"zonos-hello-dialog.cjs\",[[1,\"zonos-hello-dialog\",{\"isOpen\":[4,\"is-open\"],\"setIsOpen\":[16],\"mobileLocationOverride\":[1,\"mobile-location-override\"],\"animateFromLeftOverride\":[4,\"animate-from-left-override\"],\"appearanceSettings\":[16],\"restrictedItems\":[16],\"welcomeMessage\":[32],\"showCountrySelect\":[32],\"showLanguageSelect\":[32]},[[4,\"click\",\"globalClickHandler\"]],{\"isOpen\":[\"isOpenHandler\"]}]]],[\"zonos-badge.cjs\",[[1,\"zonos-badge\",{\"bold\":[4],\"badgeColor\":[1,\"badge-color\"],\"icon\":[16],\"iconRight\":[4,\"icon-right\"],\"size\":[1],\"rounded\":[4],\"loading\":[4],\"dismissHandler\":[16]}]]],[\"zonos-shipping-rich-radio.cjs\",[[1,\"zonos-shipping-rich-radio\",{\"items\":[16],\"borderColor\":[1,\"border-color\"],\"borderStyle\":[1,\"border-style\"],\"theme\":[1],\"selectedItem\":[16]}]]],[\"zonos-toggle.cjs\",[[1,\"zonos-toggle\",{\"options\":[16],\"value\":[1]}]]],[\"zonos-collapse.cjs\",[[1,\"zonos-collapse\",{\"collapsed\":[4],\"collapseSize\":[2,\"collapse-size\"],\"height\":[32],\"iframe\":[32]}]]],[\"zonos-card.cjs\",[[1,\"zonos-card\",{\"actions\":[16],\"backgroundColor\":[1,\"background-color\"],\"borderRadius\":[2,\"border-radius\"],\"footerActions\":[16],\"footerContent\":[16],\"footerHeight\":[2,\"footer-height\"],\"label\":[16],\"spacing\":[1]}]]],[\"zonos-input.cjs\",[[1,\"zonos-input\",{\"inputValue\":[1,\"input-value\"],\"inputLabel\":[1,\"input-label\"],\"inputSize\":[1,\"input-size\"],\"isDisabled\":[4,\"is-disabled\"],\"isError\":[4,\"is-error\"],\"inputPlaceholder\":[1,\"input-placeholder\"],\"value\":[32]},null,{\"inputValue\":[\"onInputValueChange\"]}]]],[\"zonos-notification_3.cjs\",[[2,\"zonos-payment\",{\"titleText\":[1,\"title-text\"],\"stripe\":[32],\"stripeElements\":[32]},null,{\"stripeElements\":[\"watchInitStripe\"],\"stripe\":[\"watchInitStripe\"]}],[2,\"zonos-paypal-payment\"],[1,\"zonos-notification\",{\"notificationArray\":[32],\"showNotification\":[64]}]]],[\"zonos-banner.cjs\",[[1,\"zonos-banner\",{\"bannerTitle\":[1,\"banner-title\"],\"intent\":[1],\"hasContent\":[32]}]]],[\"zonos-country-flag.cjs\",[[1,\"zonos-country-flag\",{\"countryCode\":[1,\"country-code\"],\"size\":[2]}]]],[\"zonos-v-stack.cjs\",[[1,\"zonos-v-stack\",{\"spacing\":[2]}]]],[\"zonos-text.cjs\",[[1,\"zonos-text\",{\"textColor\":[1,\"text-color\"],\"size\":[1],\"type\":[1],\"weight\":[2],\"ready\":[32]}]]],[\"zonos-button_3.cjs\",[[17,\"zonos-button\",{\"buttonColor\":[1,\"button-color\"],\"backgroundColor\":[1,\"background-color\"],\"borderStyle\":[1,\"border-style\"],\"isDisabled\":[4,\"is-disabled\"],\"icon\":[16],\"iconRight\":[4,\"icon-right\"],\"size\":[1],\"variant\":[1],\"noBackground\":[4,\"no-background\"],\"withBoxShadow\":[4,\"with-box-shadow\"],\"noPaddingLeft\":[4,\"no-padding-left\"],\"noPaddingRight\":[4,\"no-padding-right\"],\"loading\":[4],\"justifyContent\":[1,\"justify-content\"],\"theme\":[1],\"hasIcon\":[32],\"hasContent\":[32]},[[2,\"click\",\"clickHandler\"]],{\"icon\":[\"iconChangeHandler\"]}],[1,\"zonos-spinner\",{\"size\":[2],\"spinnerColor\":[1,\"spinner-color\"]}],[1,\"zonos-icon\",{\"autoHeight\":[4,\"auto-height\"],\"iconColor\":[1,\"icon-color\"],\"content\":[1],\"size\":[2]}]]],[\"zonos-language-select_2.cjs\",[[1,\"zonos-language-select\",{\"handleOnClose\":[16]}],[1,\"zonos-select-dialog-header\",{\"handleOnClose\":[16],\"label\":[1]}]]],[\"zonos-country-select_4.cjs\",[[1,\"zonos-country-select\",{\"handleOnClose\":[16],\"inputValue\":[32]}],[1,\"zonos-hello-dialog-footer\",{\"appearanceSettings\":[16],\"setShowCountrySelect\":[16],\"setShowLanguageSelect\":[16]}],[1,\"zonos-custom-message\",{\"icon\":[1],\"message\":[1]}],[2,\"zonos-virtual-scroll\",{\"renderItem\":[16],\"itemWidth\":[2,\"item-width\"],\"fallbackItemHeight\":[2,\"fallback-item-height\"],\"itemHeights\":[16],\"container\":[32],\"scrollTop\":[32],\"totalHeight\":[32]},null,{\"itemHeights\":[\"updateTotalHeight\"],\"fallbackItemHeight\":[\"updateTotalHeight\"]}]]],[\"zonos-address_7.cjs\",[[1,\"zonos-address-update-dialog\",{\"continueLoading\":[4,\"continue-loading\"],\"dialogLoading\":[4,\"dialog-loading\"],\"dialogOpen\":[4,\"dialog-open\"],\"submitBtnType\":[1,\"submit-btn-type\"],\"submitBtnColor\":[1,\"submit-btn-color\"],\"isMobile\":[4,\"is-mobile\"],\"shippingAddress\":[16],\"billingAddress\":[16],\"translatedShippingAddress\":[16],\"translatedBillingAddress\":[16],\"showErrorBanner\":[32],\"translatedShippingAddressState\":[32],\"translatedBillingAddressState\":[32]},null,{\"translatedShippingAddress\":[\"watchTranslatedShippingAddress\"],\"translatedBillingAddress\":[\"watchTranslatedBillingAddress\"]}],[2,\"zonos-address\",{\"type\":[1],\"titleText\":[1,\"title-text\"],\"defaultAddress\":[16],\"stripe\":[32],\"isDirtyAddress\":[32]},null,{\"stripe\":[\"watchInitStripe\"]}],[1,\"zonos-checkbox\",{\"backgroundColor\":[1,\"background-color\"],\"label\":[1],\"isChecked\":[4,\"is-checked\"],\"isDisabled\":[4,\"is-disabled\"],\"size\":[2],\"fontSize\":[1,\"font-size\"],\"borderStyle\":[1,\"border-style\"]},[[1,\"click\",\"onClick\"]]],[2,\"zonos-link-authentication\",{\"titleText\":[1,\"title-text\"],\"defaultEmail\":[1,\"default-email\"],\"isEmailError\":[4,\"is-email-error\"],\"stripe\":[32]},null,{\"stripe\":[\"watchInitStripe\"]}],[1,\"zonos-dialog\",{\"open\":[4],\"headerText\":[1,\"header-text\"],\"width\":[1],\"height\":[1],\"minHeight\":[1,\"min-height\"],\"noHeader\":[4,\"no-header\"],\"noBodyPadding\":[4,\"no-body-padding\"],\"noBorder\":[4,\"no-border\"],\"borderStyle\":[1,\"border-style\"],\"noCloseButton\":[4,\"no-close-button\"],\"noClickOutside\":[4,\"no-click-outside\"],\"mobile\":[4],\"isLoading\":[4,\"is-loading\"],\"isMobile\":[32]},[[9,\"resize\",\"handleWindowResize\"],[4,\"keydown\",\"handleKeyDown\"]]],[1,\"zonos-address-display\",{\"currentAddress\":[16],\"addressType\":[1,\"address-type\"]}],[1,\"zonos-address-form\",{\"currentAddress\":[16],\"translatedAddress\":[16],\"addressType\":[1,\"address-type\"],\"localAddress\":[32]},null,{\"translatedAddress\":[\"watchCurrentAddress\"]}]]],[\"zonos-cart-items_13.cjs\",[[2,\"zonos-customer-info\",{\"continueLoading\":[4,\"continue-loading\"],\"submitBtnType\":[1,\"submit-btn-type\"],\"submitBtnColor\":[1,\"submit-btn-color\"],\"isMobile\":[4,\"is-mobile\"],\"defaultAddress\":[16],\"showErrorBanner\":[32],\"shippingCountry\":[32],\"isCheckingForRestrictedItems\":[32],\"isValidatingAddress\":[32],\"invalidShippingCharacterList\":[32],\"invalidBillingCharacterList\":[32],\"openAddressValidationDialog\":[32],\"isEmailError\":[32]}],[2,\"zonos-checkout-payment\",{\"submitBtnType\":[1,\"submit-btn-type\"],\"continueLoading\":[4,\"continue-loading\"],\"submitBtnColor\":[1,\"submit-btn-color\"],\"showErrorBanner\":[32]}],[1,\"zonos-checkout-footer\",{\"mobile\":[4],\"dataTheme\":[1,\"data-theme\"],\"showLanguageDialog\":[32],\"isMobile\":[32]},[[4,\"click\",\"handleGlobalClick\"]],{\"mobile\":[\"handleMobileChange\"]}],[2,\"zonos-shipping\",{\"continueLoading\":[4,\"continue-loading\"],\"submitBtnColor\":[1,\"submit-btn-color\"],\"submitBtnType\":[1,\"submit-btn-type\"],\"selectedShippingMethod\":[32],\"collapsedDAPOptions\":[32],\"isSelecting\":[32],\"showErrorBanner\":[32],\"serviceLevelsDDP\":[32],\"serviceLevelsDAP\":[32],\"serviceLevelsOther\":[32],\"serviceLevelsAll\":[32],\"displayBaseCurrency\":[32]}],[1,\"zonos-cart-subtotal\",{\"submitBtnType\":[1,\"submit-btn-type\"],\"submitBtnColor\":[1,\"submit-btn-color\"],\"loading\":[32]}],[1,\"zonos-cart-restricted-items\",{\"hide\":[4],\"errorImages\":[32],\"internalCollapsed\":[32],\"firstRender\":[32]}],[1,\"zonos-checkout-finish\",{\"borderRadius\":[1,\"border-radius\"],\"storybookForceStatus\":[1,\"storybook-force-status\"],\"overrideNotification\":[16],\"isLoading\":[32],\"notificationType\":[32],\"notificationTitle\":[32],\"notificationMessages\":[32],\"notificationActionText\":[32],\"order\":[32],\"isWaitingToRedirect\":[32]}],[1,\"zonos-confirm-dialog\",{\"dialogTitle\":[1,\"dialog-title\"],\"dialogIntent\":[1,\"dialog-intent\"],\"dialogSubtitle\":[1,\"dialog-subtitle\"],\"submitBtnColor\":[1,\"submit-btn-color\"],\"dialogConfirmBtnText\":[1,\"dialog-confirm-btn-text\"],\"dialogWidth\":[2,\"dialog-width\"],\"dialogCancelBtnText\":[1,\"dialog-cancel-btn-text\"],\"dialogType\":[1,\"dialog-type\"],\"isMobile\":[4,\"is-mobile\"],\"dialogOpen\":[4,\"dialog-open\"],\"noClickOutside\":[4,\"no-click-outside\"]},[[4,\"keydown\",\"handleKeyDown\"]]],[1,\"zonos-checkout-progress-tabs\",{\"tabColor\":[1,\"tab-color\"],\"backgroundColor\":[1,\"background-color\"],\"setTabItems\":[64],\"setTabSelected\":[64]}],[1,\"zonos-review\",{\"mobile\":[4],\"collapsed\":[4],\"isMobile\":[32]},[[9,\"resize\",\"handleWindowResize\"]]],[1,\"zonos-cart-items\",{\"errorImages\":[32]}],[1,\"zonos-currency-toggle\",{\"errorImages\":[32]}],[1,\"zonos-rest-state\",{\"restStateSubtitle\":[1,\"rest-state-subtitle\"],\"restStateTitle\":[1,\"rest-state-title\"],\"restStateType\":[1,\"rest-state-type\"],\"isErrorImageLoad\":[32]}]]]]"), options);
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
exports.setNonce = index.setNonce;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-d56e0a8b.js');
|
|
6
|
-
const cart = require('./cart-
|
|
6
|
+
const cart = require('./cart-dea3242e.js');
|
|
7
7
|
const zonosStore = require('./zonosStore-293bb3ba.js');
|
|
8
8
|
const classes = require('./classes-b7918f56.js');
|
|
9
9
|
const formatStringWithLinks = require('./formatStringWithLinks-52341fc7.js');
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const index = require('./index-d56e0a8b.js');
|
|
6
6
|
const zonosStore = require('./zonosStore-293bb3ba.js');
|
|
7
|
-
const cart = require('./cart-
|
|
7
|
+
const cart = require('./cart-dea3242e.js');
|
|
8
8
|
const classes = require('./classes-b7918f56.js');
|
|
9
9
|
const handleFetch = require('./handleFetch-4a90f091.js');
|
|
10
10
|
const getHasMoreSpaceOnRight = require('./getHasMoreSpaceOnRight-4c94667f.js');
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-d56e0a8b.js');
|
|
6
|
-
const cart = require('./cart-
|
|
6
|
+
const cart = require('./cart-dea3242e.js');
|
|
7
7
|
const zonosStore = require('./zonosStore-293bb3ba.js');
|
|
8
8
|
const ILanguage = require('./ILanguage-98b04442.js');
|
|
9
9
|
require('./handleFetch-4a90f091.js');
|
|
@@ -6,9 +6,9 @@ const index = require('./index-d56e0a8b.js');
|
|
|
6
6
|
const zonosStore = require('./zonosStore-293bb3ba.js');
|
|
7
7
|
const classes = require('./classes-b7918f56.js');
|
|
8
8
|
const getBorderRadius = require('./getBorderRadius-f72d8edf.js');
|
|
9
|
-
const cart = require('./cart-
|
|
9
|
+
const cart = require('./cart-dea3242e.js');
|
|
10
10
|
const handleFetch = require('./handleFetch-4a90f091.js');
|
|
11
|
-
const paypal = require('./paypal-
|
|
11
|
+
const paypal = require('./paypal-729f9ed3.js');
|
|
12
12
|
require('./isDarkColor-dd6d723b.js');
|
|
13
13
|
|
|
14
14
|
const zonosNotificationCss = ":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center}:host .zonos--notification-items{position:fixed;z-index:9999999999;bottom:24px;gap:8px;display:-ms-inline-flexbox;display:inline-flex;-ms-flex-direction:column;flex-direction:column}:host .zonos--notification-item{cursor:pointer;-webkit-transition:all 0.3s ease;transition:all 0.3s ease;padding:8px;border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-6));opacity:0;-ms-flex-negative:0.0001;flex-shrink:0.0001;-webkit-transform:translateY(100%);transform:translateY(100%)}:host .zonos--notification-item+:host .zonos--notification-item{margin-top:8px}:host .zonos--notification-item.show{opacity:1;-webkit-transform:translateY(0);transform:translateY(0);-ms-flex-positive:1000;flex-grow:1000}:host .zonos--notification-item.success{background-color:var(--zonos-elements-green-700)}:host .zonos--notification-item.error{background-color:var(--zonos-elements-red-700)}:host .zonos--notification-item.warning{background-color:var(--zonos-elements-orange-700)}";
|
|
@@ -65,13 +65,13 @@ export class ZonosCheckoutFinish {
|
|
|
65
65
|
* It would make more sense to have keep shopping button if the success behavior is not redirecting to a different page
|
|
66
66
|
*/
|
|
67
67
|
this.shouldRenderKeepShoppingButton = () => {
|
|
68
|
-
return !this.isRedirectBehavior();
|
|
68
|
+
return !this.isRedirectBehavior() && this.notificationType === 'success';
|
|
69
69
|
};
|
|
70
70
|
/**
|
|
71
|
-
* Should render close button for redirect behavior when the success behavior is redirecting to a different page
|
|
71
|
+
* Should render close button for redirect behavior when the success behavior is redirecting to a different page or when it's an error screen
|
|
72
72
|
*/
|
|
73
73
|
this.shouldRenderCloseButtonForRedirectBehavior = () => {
|
|
74
|
-
return this.isRedirectBehavior();
|
|
74
|
+
return this.isRedirectBehavior() || this.notificationType === 'error';
|
|
75
75
|
};
|
|
76
76
|
this.handleSuccessBehavior = async () => {
|
|
77
77
|
var _a, _b;
|
|
@@ -232,6 +232,14 @@ export class ZonosCheckoutFinish {
|
|
|
232
232
|
messages,
|
|
233
233
|
status,
|
|
234
234
|
});
|
|
235
|
+
// remove the client secret from the url
|
|
236
|
+
const url = new URL(window.location.href);
|
|
237
|
+
url.searchParams.delete('payment_intent_client_secret');
|
|
238
|
+
url.searchParams.delete('payment_intent');
|
|
239
|
+
url.searchParams.delete('redirect_status');
|
|
240
|
+
// Clean up the url if it's a redirect behavior
|
|
241
|
+
url.searchParams.delete('zonosCheckoutSessionId');
|
|
242
|
+
window.history.replaceState({}, '', url.toString());
|
|
235
243
|
// Payment doesn't go through
|
|
236
244
|
if (error && (messages === null || messages === void 0 ? void 0 : messages.length)) {
|
|
237
245
|
submitGtag('zonos-checkout-payment-fail');
|
|
@@ -341,12 +349,17 @@ export class ZonosCheckoutFinish {
|
|
|
341
349
|
}
|
|
342
350
|
render() {
|
|
343
351
|
const isTestMode = getIsTestMode();
|
|
344
|
-
return (h(Host, { key: '
|
|
352
|
+
return (h(Host, { key: '7e1b8c53a085ae60d8189aef087a9c458c3dccd0', class: "zonos--checkout-finish zonos--elements", style: {
|
|
345
353
|
'--zonos--border-radius': getBorderRadius({
|
|
346
354
|
overrideBorderStyle: this.borderRadius,
|
|
347
355
|
}),
|
|
348
|
-
} }, !this.isLoading && (h("div", { key: '
|
|
349
|
-
|
|
356
|
+
} }, !this.isLoading && (h("div", { key: 'b31bed34ca67255cdc6ef6b546f5d6a880e4b309', class: "zonos--finish-details" }, h("div", { key: 'e3cb21607b8f1256b3096fe4f21a806a74174f66', class: "zonos--group" }, this.notificationType === 'success' ? (h("zonos-icon", { "aria-label": "Order success", content: SuccessIcon, iconColor: 'blue-800', size: 50 })) : (h("zonos-icon", { "aria-label": "Order failed", content: RemoveIcon, iconColor: 'red-800', size: 50 })), h("zonos-text", { key: 'fac1d2134f1c032cefeb9d36c5c4677767ed0972', class: "zonos--title", type: "semiBoldSubheader" }, this.notificationTitle), h("zonos-text", { key: '94b8da1ca6a391295c22d285e65530f5dfe97a41', class: "zonos--subtitle", textColor: "gray-600" }, this.notificationMessages.map(message => (h(Fragment, null, message, h("br", null))))), this.shouldRenderCloseButtonForRedirectBehavior() && (h("zonos-button", { key: '4ebf2bb81ceb0d27b4fd582400606b238a3dfbae',
|
|
357
|
+
// Only show loading spinner if it's not an error notification
|
|
358
|
+
loading: this.isWaitingToRedirect &&
|
|
359
|
+
this.notificationType !== 'error', onClick: () => this.closeClickHandler(), size: "md", variant: "primary" }, translate('Close'))), !window.Zonos.isLegacyCheckout &&
|
|
360
|
+
this.shouldRenderKeepShoppingButton() && (h("zonos-button", { key: '6548724f163ad59fc3cb502c24d82ae7585c6b7f', onClick: () => this.closeClickHandler(), size: "md", variant: "primary" }, this.notificationActionText))), isTestMode &&
|
|
361
|
+
cartStore.step === 'finish' &&
|
|
362
|
+
this.notificationType === 'success' && (h("div", { key: 'f9aeb5d59dc4b0f163868e5a2358a69a0884bb56', class: "zonos--finish-button-wrapper" }, h("zonos-button", { key: '98ae907d33624e54f84f88519abacd1ea178554c', backgroundColor: "gray-0", buttonColor: "gray-1000", onClick: () => this.closeClickHandler(), size: "lg", variant: "outline" }, "New test cart"), h("zonos-button", { key: '506eeb9eabe16fed59b98b9eef49552542272233', onClick: () => this.redirectToUrl(`/orders/all`), size: "lg", variant: "primary" }, "View order in Dashboard")))))));
|
|
350
363
|
}
|
|
351
364
|
static get is() { return "zonos-checkout-finish"; }
|
|
352
365
|
static get encapsulation() { return "shadow"; }
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Fragment, h, Host, } from "@stencil/core";
|
|
2
2
|
import { cartStore, cartStoreClearCheckoutInterval, cartStoreNextStep, cartStoreReset, cartStoreResetTabItems, cartStoreSetCheckoutSession, cartStoreStartCheckoutInterval, cartStoreUpdateItems, cartStoreUpdateToErrorState, } from "../../store/checkout/cart";
|
|
3
3
|
import { paypalInitScript, paypalStoreHasPaypalEnabled, } from "../../store/checkout/paypal";
|
|
4
|
-
import { getCheckoutSessionBody, initStripeElements, stripeStore, stripeStoreCleanupDomesticShippingSession, stripeStoreConfirmPayment, stripeStoreHandleInventoryCheck, stripeStoreHandleInventoryRefund, stripeStoreInitCheckoutSession, stripeStorePrefetchLandedCost, stripeStoreReset, } from "../../store/checkout/stripe";
|
|
4
|
+
import { getCheckoutSessionBody, initStripeElements, stripeStore, stripeStoreCleanupDomesticShippingSession, stripeStoreConfirmPayment, stripeStoreHandleInventoryCheck, stripeStoreHandleInventoryRefund, stripeStoreInitCheckoutSession, stripeStorePrefetchLandedCost, stripeStoreReset, stripeStoreRetrievePayment, } from "../../store/checkout/stripe";
|
|
5
5
|
import { localizationStore, localizationStoreOnUpdate, } from "../../store/hello/localization";
|
|
6
6
|
import { translate } from "../../store/translationStore";
|
|
7
7
|
import { getZonosStoreTheme, zonosStore, } from "../../store/zonosStore";
|
|
@@ -85,6 +85,52 @@ export class ZonosCheckout {
|
|
|
85
85
|
}
|
|
86
86
|
return false;
|
|
87
87
|
};
|
|
88
|
+
/**
|
|
89
|
+
* Check if stripe payment intent is succeeded or in a good state to move forward
|
|
90
|
+
*/
|
|
91
|
+
this.checkStripePaymentIntentStatus = async ({ triggeredButton, }) => {
|
|
92
|
+
const isImmediatelyTriggered = triggeredButton === null || triggeredButton === void 0 ? void 0 : triggeredButton.matches(`#${checkoutHiddenBtnSelector}`);
|
|
93
|
+
const isCartDataAvailable = !!window.Zonos.cartData;
|
|
94
|
+
const searchParams = new URL(window.location.href).searchParams;
|
|
95
|
+
const stripeClientSecret = searchParams.get('payment_intent_client_secret');
|
|
96
|
+
const zonosCheckoutSessionId = searchParams.get('zonosCheckoutSessionId');
|
|
97
|
+
// Allow to proceed to order if Checkout is triggered by Checkout button click by user
|
|
98
|
+
if (!isImmediatelyTriggered) {
|
|
99
|
+
log('Checkout is triggered by user, no need to check stripe payment intent status');
|
|
100
|
+
return { shouldAllowOrder: true };
|
|
101
|
+
}
|
|
102
|
+
log('Payment intent exist, checking stripe payment intent status');
|
|
103
|
+
// Allow to proceed to order if there's no stripe client secret and cart data is available
|
|
104
|
+
if (!stripeClientSecret) {
|
|
105
|
+
log('No stripe client secret found in the URL, proceed to order if cart data is available');
|
|
106
|
+
return { shouldAllowOrder: isCartDataAvailable };
|
|
107
|
+
}
|
|
108
|
+
const { error, status } = await stripeStoreRetrievePayment({
|
|
109
|
+
clientSecret: stripeClientSecret,
|
|
110
|
+
});
|
|
111
|
+
// check if this is redirect after order
|
|
112
|
+
const isJustRedirected = new URLSearchParams(window.location.search).get('redirect_status');
|
|
113
|
+
// If just redirected from Payment provider, show the success screen or error screen based on the status
|
|
114
|
+
if (isJustRedirected) {
|
|
115
|
+
if (!error) {
|
|
116
|
+
log('Payment intent is succeeded or in a good state to move forward, show success screen');
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
log('Payment intent failed, show status from error');
|
|
120
|
+
}
|
|
121
|
+
this.open = true;
|
|
122
|
+
cartStore.checkoutSessionId = zonosCheckoutSessionId;
|
|
123
|
+
stripeStore.clientSecret = stripeClientSecret;
|
|
124
|
+
void this.setToFinishStep(status);
|
|
125
|
+
return { shouldAllowOrder: false };
|
|
126
|
+
}
|
|
127
|
+
if (!isCartDataAvailable) {
|
|
128
|
+
log('Cart data is not available, only check payment intent status, skip order.');
|
|
129
|
+
return { shouldAllowOrder: false };
|
|
130
|
+
}
|
|
131
|
+
log('Payment intent is not succeeded, proceed to order');
|
|
132
|
+
return { shouldAllowOrder: true };
|
|
133
|
+
};
|
|
88
134
|
this.formatDate = (timestamp) => {
|
|
89
135
|
if (!timestamp) {
|
|
90
136
|
return '';
|
|
@@ -118,6 +164,7 @@ export class ZonosCheckout {
|
|
|
118
164
|
this.mobile = false;
|
|
119
165
|
this.defaultAddress = null;
|
|
120
166
|
this.forceDialogOpen = false;
|
|
167
|
+
this.defaultAddressParams = null;
|
|
121
168
|
this.open = this.forceDialogOpen;
|
|
122
169
|
this.stripe = window.Zonos.stripe;
|
|
123
170
|
this.submitLoading = false;
|
|
@@ -323,7 +370,7 @@ export class ZonosCheckout {
|
|
|
323
370
|
buttonAnchorSelector,
|
|
324
371
|
// hidden button for domestic redirected
|
|
325
372
|
`#${domesticRedirectedBtnSelector}`,
|
|
326
|
-
// hidden button for legacy checkout facade
|
|
373
|
+
// hidden button for legacy checkout facade and when client secret is provided in the query param or session storage when user is redirected from stripe
|
|
327
374
|
`#${checkoutHiddenBtnSelector}`,
|
|
328
375
|
].filter(Boolean);
|
|
329
376
|
// also attach event to hidden button if user was redirected with shipping address session
|
|
@@ -348,6 +395,20 @@ export class ZonosCheckout {
|
|
|
348
395
|
e.preventDefault();
|
|
349
396
|
e.stopPropagation();
|
|
350
397
|
log('zonos checkout button clicked');
|
|
398
|
+
/**
|
|
399
|
+
* Check to see if there is any payment intent that's succeeded and got reload/redirected to the current on approved or authorized by Stripe
|
|
400
|
+
* User stories:
|
|
401
|
+
* - Some 3DS or "Buy Now Pay Later" payments might need to reload the page or redirect to return_url from Stripe after completing the payment.
|
|
402
|
+
* - `return_url` sometimes has client_secret in the query param, but not always. We need to check the payment intent status to see if it's succeeded or not.
|
|
403
|
+
*
|
|
404
|
+
**/
|
|
405
|
+
const { shouldAllowOrder } = await this.checkStripePaymentIntentStatus({
|
|
406
|
+
triggeredButton: e.target,
|
|
407
|
+
});
|
|
408
|
+
// Only allow order to proceed if payment intent is not succeeded
|
|
409
|
+
if (!shouldAllowOrder) {
|
|
410
|
+
return;
|
|
411
|
+
}
|
|
351
412
|
// start loading
|
|
352
413
|
stripeStore.isFetchingSession = true;
|
|
353
414
|
this.open = true;
|
|
@@ -418,7 +479,7 @@ export class ZonosCheckout {
|
|
|
418
479
|
// remove the button after it's clicked
|
|
419
480
|
button.remove();
|
|
420
481
|
}
|
|
421
|
-
// For legacy checkout facade and in case the cart is provided in the query param, open Checkout right away
|
|
482
|
+
// For legacy checkout facade and in case the cart or stripe client secret is provided in the query param, open Checkout right away
|
|
422
483
|
if (button.matches(`#${checkoutHiddenBtnSelector}`)) {
|
|
423
484
|
// trigger the click event on the button
|
|
424
485
|
button.dispatchEvent(createCustomEvent('click'));
|
|
@@ -472,7 +533,7 @@ export class ZonosCheckout {
|
|
|
472
533
|
.join(', '));
|
|
473
534
|
return;
|
|
474
535
|
}
|
|
475
|
-
this.
|
|
536
|
+
this.defaultAddressParams = {
|
|
476
537
|
address: {
|
|
477
538
|
city: city || '',
|
|
478
539
|
country,
|
|
@@ -680,6 +741,9 @@ export class ZonosCheckout {
|
|
|
680
741
|
// redirect to vendor store url if this is legacy checkout.
|
|
681
742
|
if (window.Zonos.isLegacyCheckout && window.Zonos.cartData) {
|
|
682
743
|
const storeBaseUrl = window.Zonos.cartData.storeBaseUrl;
|
|
744
|
+
if (window.parent) {
|
|
745
|
+
window.parent.location.href = storeBaseUrl;
|
|
746
|
+
}
|
|
683
747
|
window.location.href = storeBaseUrl;
|
|
684
748
|
return;
|
|
685
749
|
}
|
|
@@ -687,14 +751,17 @@ export class ZonosCheckout {
|
|
|
687
751
|
const url = window.location.href;
|
|
688
752
|
// Remove query parameters
|
|
689
753
|
const cleanUrl = url.split('?')[0];
|
|
690
|
-
const isTestMode = getIsTestMode();
|
|
691
754
|
this.open = false;
|
|
692
|
-
|
|
755
|
+
const isDashboard = window.location.hostname.includes('dashboard.zonos.com');
|
|
756
|
+
/**
|
|
757
|
+
* Update the URL without query parameters only when checkout is not running in dashboard.zonos.com.
|
|
758
|
+
* We don't want to reload the page when dashboard is running it. Test mode should do what live mode does.
|
|
759
|
+
*/
|
|
693
760
|
/**
|
|
694
761
|
* Setting the state to null in window.history.replaceState can cause issues with rendering when using next/link and pressing the back button.
|
|
695
762
|
* @ref https://github.com/vercel/next.js/issues/33233#issuecomment-1052349396
|
|
696
763
|
**/
|
|
697
|
-
if (!
|
|
764
|
+
if (!isDashboard) {
|
|
698
765
|
window.history.replaceState(window.history.state, document.title, cleanUrl);
|
|
699
766
|
// Reload the page
|
|
700
767
|
window.location.reload();
|
|
@@ -835,7 +902,7 @@ export class ZonosCheckout {
|
|
|
835
902
|
'--zonos--primary-color': !this.isMobile
|
|
836
903
|
? colorPrimary
|
|
837
904
|
: undefined,
|
|
838
|
-
}) }, !this.isMobile && renderTopHeader(), cartStore.step === 'customer-info' && (h("zonos-customer-info", { continueLoading: this.submitLoading, defaultAddress: this.defaultAddress, isMobile: this.isMobile, onContinueClicked: () => this.handleCustomerInfoContinue(), submitBtnColor: submitButtonColor })), cartStore.step === 'shipping' && (h("zonos-shipping", { continueLoading: this.submitLoading, onContinueClicked: () => this.handleShippingContinue(), submitBtnColor: submitButtonColor })), cartStore.step === 'payment' && (h("zonos-checkout-payment", { continueLoading: this.submitLoading, onContinueClicked: async () => {
|
|
905
|
+
}) }, !this.isMobile && renderTopHeader(), cartStore.step === 'customer-info' && (h("zonos-customer-info", { continueLoading: this.submitLoading, defaultAddress: this.defaultAddress || this.defaultAddressParams, isMobile: this.isMobile, onContinueClicked: () => this.handleCustomerInfoContinue(), submitBtnColor: submitButtonColor })), cartStore.step === 'shipping' && (h("zonos-shipping", { continueLoading: this.submitLoading, onContinueClicked: () => this.handleShippingContinue(), submitBtnColor: submitButtonColor })), cartStore.step === 'payment' && (h("zonos-checkout-payment", { continueLoading: this.submitLoading, onContinueClicked: async () => {
|
|
839
906
|
await this.handleStripePaymentContinue();
|
|
840
907
|
}, submitBtnColor: submitButtonColor }))), h("div", { class: "zonos--right", "data-theme": rightSideTheme }, this.isMobile && renderTopHeader(), h("div", { class: "zonos--right-actions" }, window.Zonos.showBaseForeign && (h("zonos-currency-toggle", null)), !this.isLegacyCheckout && (h("zonos-button", { class: "zonos--close-button", icon: h("zonos-icon", { "aria-label": "Close checkout dialog", content: RemoveIcon }), noBackground: true, onClick: () => this.closeDialogHandler() }))), h("div", { class: "flex--wrapper" }, h("div", { class: "zonos--wrapper" }, h("zonos-review", { collapsed: this.collapseReviewMobile, mobile: this.isMobile, onClick: () => {
|
|
841
908
|
// do nothing if it's not mobile
|
|
@@ -1019,6 +1086,7 @@ export class ZonosCheckout {
|
|
|
1019
1086
|
}
|
|
1020
1087
|
static get states() {
|
|
1021
1088
|
return {
|
|
1089
|
+
"defaultAddressParams": {},
|
|
1022
1090
|
"open": {},
|
|
1023
1091
|
"stripe": {},
|
|
1024
1092
|
"submitLoading": {},
|
|
@@ -359,6 +359,12 @@ const stripeStoreMessageBasedOnStatus = (status) => {
|
|
|
359
359
|
];
|
|
360
360
|
break;
|
|
361
361
|
}
|
|
362
|
+
case 'requires_action': {
|
|
363
|
+
isError = false;
|
|
364
|
+
messages = [
|
|
365
|
+
translate('Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction.'),
|
|
366
|
+
];
|
|
367
|
+
}
|
|
362
368
|
default: {
|
|
363
369
|
messages = [translate('Something went wrong.')];
|
|
364
370
|
break;
|
|
@@ -457,10 +463,17 @@ const stripeStoreConfirmPayment = async () => {
|
|
|
457
463
|
if (!((_b = cartStore.selectedLandedCost) === null || _b === void 0 ? void 0 : _b.landedCost.id)) {
|
|
458
464
|
throw new Error('Attempted to confirm the payment when no landed cost is found in store');
|
|
459
465
|
}
|
|
460
|
-
if (stripe &&
|
|
466
|
+
if (stripe &&
|
|
467
|
+
stripeElements &&
|
|
468
|
+
stripePaymentReady &&
|
|
469
|
+
stripeClientSecret &&
|
|
470
|
+
cartStore.checkoutSessionId) {
|
|
471
|
+
const buildUrl = new URL(window.location.href);
|
|
472
|
+
buildUrl.searchParams.set('payment_intent_client_secret', stripeClientSecret);
|
|
473
|
+
buildUrl.searchParams.set('zonosCheckoutSessionId', cartStore.checkoutSessionId);
|
|
461
474
|
const { error, paymentIntent } = await stripe.confirmPayment({
|
|
462
475
|
confirmParams: {
|
|
463
|
-
return_url:
|
|
476
|
+
return_url: buildUrl.toString(),
|
|
464
477
|
},
|
|
465
478
|
elements: stripeElements,
|
|
466
479
|
redirect: 'if_required',
|
|
@@ -407,6 +407,9 @@ export const stringsArabic = {
|
|
|
407
407
|
'Your payment went through successfully! Thank you for shopping with us! We hope you had an enjoyable experience and your support means the world to us.': {
|
|
408
408
|
value: 'تمت عملية الدفع بنجاح! شكرا لتسوقك معنا! نأمل أن تكون قد استمتعت بتجربة رائعة ودعمك يعني لنا الكثير.',
|
|
409
409
|
},
|
|
410
|
+
'Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction.': {
|
|
411
|
+
value: 'طريقة الدفع التي اخترتها تتطلب تحققًا إضافيًا. يرجى اتباع التعليمات المقدمة من مزود الدفع الخاص بك لإكمال المعاملة.',
|
|
412
|
+
},
|
|
410
413
|
'[percentage] GST due on any order above [threshold] along with an import entry transaction fee and MPI levy.': {
|
|
411
414
|
value: '[percentage] ضريبة القيمة المضافة مستحقة على أي طلب يتجاوز [threshold] بالإضافة إلى رسوم معاملة إدخال الاستيراد ورسوم MPI.',
|
|
412
415
|
},
|
|
@@ -407,6 +407,9 @@ export const stringsBase = {
|
|
|
407
407
|
'Your payment went through successfully! Thank you for shopping with us! We hope you had an enjoyable experience and your support means the world to us.': {
|
|
408
408
|
value: 'Your payment went through successfully! Thank you for shopping with us! We hope you had an enjoyable experience and your support means the world to us.',
|
|
409
409
|
},
|
|
410
|
+
'Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction.': {
|
|
411
|
+
value: 'Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction.',
|
|
412
|
+
},
|
|
410
413
|
'[percentage] GST due on any order above [threshold] along with an import entry transaction fee and MPI levy.': {
|
|
411
414
|
value: '[percentage] GST due on any order above [threshold] along with an import entry transaction fee and MPI levy.',
|
|
412
415
|
},
|
|
@@ -407,6 +407,9 @@ export const stringsChinese = {
|
|
|
407
407
|
'Your payment went through successfully! Thank you for shopping with us! We hope you had an enjoyable experience and your support means the world to us.': {
|
|
408
408
|
value: '您的付款已成功完成!感谢您与我们购物!我们希望您拥有愉快的购物体验,您的支持对我们来说意义非凡。',
|
|
409
409
|
},
|
|
410
|
+
'Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction.': {
|
|
411
|
+
value: '您选择的付款方式需要额外验证。请按照您的付款提供商提供的说明完成交易。',
|
|
412
|
+
},
|
|
410
413
|
'[percentage] GST due on any order above [threshold] along with an import entry transaction fee and MPI levy.': {
|
|
411
414
|
value: '任何订单超过[threshold],除了需缴纳[percentage]的商品及服务税外,还包括进口货物申报费和MPI征费。',
|
|
412
415
|
},
|