@zonos/elements 1.3.171 → 1.3.172
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/{CheckoutConfig-f5e68e14.js → CheckoutConfig-c5943bbf.js} +1 -1
- package/dist/cjs/{cart-36799bbe.js → cart-d91d9507.js} +13 -8
- package/dist/cjs/{handleFetch-7b7f9f7c.js → handleFetch-ff25db40.js} +10 -6
- package/dist/cjs/index.cjs.js +9 -9
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{paypal-3eae38bd.js → paypal-82841277.js} +2 -2
- package/dist/cjs/zonos-address_7.cjs.entry.js +51 -18
- package/dist/cjs/zonos-cart-items_13.cjs.entry.js +10 -6
- package/dist/cjs/zonos-checkout.cjs.entry.js +104 -34
- package/dist/cjs/zonos-controller.cjs.entry.js +2 -2
- package/dist/cjs/zonos-country-flag.cjs.entry.js +2 -2
- package/dist/cjs/zonos-country-select_4.cjs.entry.js +2 -2
- package/dist/cjs/zonos-elements.cjs.js +1 -1
- package/dist/cjs/zonos-empty-state-payment_4.cjs.entry.js +3 -3
- package/dist/cjs/zonos-hello-dialog.cjs.entry.js +2 -2
- package/dist/cjs/zonos-hello.cjs.entry.js +2 -2
- package/dist/cjs/zonos-language-select_2.cjs.entry.js +2 -2
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +112 -35
- package/dist/collection/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.js +10 -6
- package/dist/collection/components/store/checkout/cart.js +5 -0
- package/dist/collection/components/store/checkout/stripe.js +5 -7
- package/dist/collection/components/stripe/zonos-address/zonos-address.js +26 -15
- package/dist/collection/components/stripe/zonos-link-authentication/zonos-link-authentication.js +27 -4
- package/dist/collection/components/utils/handleFetch.js +9 -6
- package/dist/collection/components/utils/logging/getAdditionalLogMetadata.js +1 -0
- package/dist/collection/styles/stripe/defaultVariable.js +2 -0
- package/dist/collection/types/generated/graphql.internal.types.js +7 -0
- package/dist/esm/{CheckoutConfig-2994efd9.js → CheckoutConfig-75af3742.js} +1 -1
- package/dist/esm/{cart-b2e57589.js → cart-52e208cc.js} +13 -8
- package/dist/esm/{handleFetch-8d72c8cd.js → handleFetch-0109fb78.js} +10 -6
- package/dist/esm/index.js +10 -10
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{paypal-38da5d52.js → paypal-2e1c560e.js} +2 -2
- package/dist/esm/zonos-address_7.entry.js +51 -18
- package/dist/esm/zonos-cart-items_13.entry.js +10 -6
- package/dist/esm/zonos-checkout.entry.js +104 -34
- package/dist/esm/zonos-controller.entry.js +2 -2
- package/dist/esm/zonos-country-flag.entry.js +2 -2
- package/dist/esm/zonos-country-select_4.entry.js +2 -2
- package/dist/esm/zonos-elements.js +1 -1
- package/dist/esm/zonos-empty-state-payment_4.entry.js +3 -3
- package/dist/esm/zonos-hello-dialog.entry.js +2 -2
- package/dist/esm/zonos-hello.entry.js +2 -2
- package/dist/esm/zonos-language-select_2.entry.js +2 -2
- package/dist/esm-es5/{CheckoutConfig-2994efd9.js → CheckoutConfig-75af3742.js} +1 -1
- package/dist/esm-es5/{cart-b2e57589.js → cart-52e208cc.js} +1 -1
- package/dist/esm-es5/handleFetch-0109fb78.js +1 -0
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/{paypal-38da5d52.js → paypal-2e1c560e.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-empty-state-payment_4.entry.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/scripts/index.d.ts +25 -6
- 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.d.ts +17 -3
- package/dist/types/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.d.ts +1 -1
- package/dist/types/components/store/checkout/cart.d.ts +4 -0
- package/dist/types/components/store/checkout/stripe.d.ts +10 -1
- package/dist/types/components/stripe/zonos-address/zonos-address.d.ts +2 -2
- package/dist/types/components/stripe/zonos-link-authentication/zonos-link-authentication.d.ts +1 -1
- package/dist/types/components/utils/api/getLocaleMessages.d.ts +1 -1
- package/dist/types/components/utils/logging/getAdditionalLogMetadata.d.ts +1 -0
- package/dist/types/components.d.ts +8 -6
- package/dist/types/types/checkout/CheckoutConfig.d.ts +1 -0
- package/dist/types/types/checkout/api/CheckoutSession.d.ts +8 -0
- package/dist/types/types/generated/graphql.frontend.types.d.ts +1 -1
- package/dist/types/types/generated/graphql.frontend.types.ts +1 -1
- package/dist/types/types/generated/graphql.internal.types.d.ts +92 -0
- package/dist/types/types/generated/graphql.internal.types.ts +105 -0
- package/dist/zonos-elements/assets/RemoveIcon.svg +1 -1
- package/dist/zonos-elements/index.esm.js +1 -1
- package/dist/zonos-elements/{p-56a8b1f6.system.entry.js → p-048e4b38.system.entry.js} +1 -1
- package/dist/zonos-elements/p-04c38987.system.js +1 -0
- package/dist/zonos-elements/{p-bf113a46.system.js → p-0ee42be2.system.js} +1 -1
- package/dist/zonos-elements/{p-ff1c6d9a.entry.js → p-10a9edf6.entry.js} +1 -1
- package/dist/zonos-elements/{p-864c7c7d.entry.js → p-14bd4766.entry.js} +1 -1
- package/dist/zonos-elements/{p-47f79a6d.js → p-1c488ecf.js} +1 -1
- package/dist/zonos-elements/{p-cb52cfdf.entry.js → p-1e3e4e22.entry.js} +1 -1
- package/dist/zonos-elements/p-221d4f15.system.entry.js +1 -0
- package/dist/zonos-elements/{p-e09cea9c.entry.js → p-246c3b28.entry.js} +1 -1
- package/dist/zonos-elements/p-2b8c5669.system.entry.js +1 -0
- package/dist/zonos-elements/{p-dd0259f4.js → p-2d2c70a3.js} +1 -1
- package/dist/zonos-elements/{p-c5c2976f.system.js → p-2ebb4fa7.system.js} +1 -1
- package/dist/zonos-elements/{p-a3888f1d.system.js → p-36c35a07.system.js} +1 -1
- package/dist/zonos-elements/p-46f6e5e9.system.js +1 -1
- package/dist/zonos-elements/{p-00ad3c73.entry.js → p-588ac238.entry.js} +1 -1
- package/dist/zonos-elements/{p-b0c39400.entry.js → p-68304407.entry.js} +1 -1
- package/dist/zonos-elements/{p-ecd4ec15.system.js → p-7de48475.system.js} +1 -1
- package/dist/zonos-elements/p-839448c3.js +1 -0
- package/dist/zonos-elements/{p-53cb8867.system.entry.js → p-85d2da79.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-1a20922f.system.entry.js → p-91a7ca64.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-0bfca3a9.system.entry.js → p-9a10a63b.system.entry.js} +1 -1
- package/dist/zonos-elements/p-a08fad84.entry.js +1 -0
- package/dist/zonos-elements/{p-bfa028a2.entry.js → p-a61ef92f.entry.js} +1 -1
- package/dist/zonos-elements/{p-0def1397.system.entry.js → p-aa754137.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-c82f488b.system.entry.js → p-aea22783.system.entry.js} +1 -1
- package/dist/zonos-elements/p-ba604bc4.entry.js +1 -0
- package/dist/zonos-elements/{p-48173901.js → p-bbf9dbe4.js} +1 -1
- package/dist/zonos-elements/{p-461ca324.entry.js → p-c719434a.entry.js} +1 -1
- package/dist/zonos-elements/{p-56758218.system.entry.js → p-e34c0f83.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-1edbfb1f.system.entry.js → p-eb716dcc.system.entry.js} +1 -1
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/package.json +1 -1
- package/dist/esm-es5/handleFetch-8d72c8cd.js +0 -1
- package/dist/zonos-elements/p-173d1fcd.system.entry.js +0 -1
- package/dist/zonos-elements/p-71539c8a.js +0 -1
- package/dist/zonos-elements/p-9261869c.system.js +0 -1
- package/dist/zonos-elements/p-934164df.entry.js +0 -1
- package/dist/zonos-elements/p-9f9e4f74.entry.js +0 -1
- package/dist/zonos-elements/p-fd352222.system.entry.js +0 -1
|
@@ -180,13 +180,30 @@ export class ZonosCheckout {
|
|
|
180
180
|
settlementAmount: total,
|
|
181
181
|
};
|
|
182
182
|
};
|
|
183
|
+
this.getDefaultAddress = () => {
|
|
184
|
+
// If checkout customer is authenticated, use the address from the customer profile
|
|
185
|
+
if (this.defaultCustomerProfileAddress.length) {
|
|
186
|
+
return this.defaultCustomerProfileAddress;
|
|
187
|
+
}
|
|
188
|
+
// If default address is provided directly from the component, use it
|
|
189
|
+
if (Array.isArray(this.defaultAddress) && this.defaultAddress.length) {
|
|
190
|
+
return this.defaultAddress;
|
|
191
|
+
}
|
|
192
|
+
if (!Array.isArray(this.defaultAddress) &&
|
|
193
|
+
typeof this.defaultAddress === 'object') {
|
|
194
|
+
return [this.defaultAddress];
|
|
195
|
+
}
|
|
196
|
+
return this.defaultAddressParams;
|
|
197
|
+
};
|
|
183
198
|
this.appearanceSettingsOverride = undefined;
|
|
184
199
|
this.preview = false;
|
|
185
200
|
this.mobile = false;
|
|
186
201
|
this.overrideStagingMode = undefined;
|
|
187
|
-
this.defaultAddress =
|
|
202
|
+
this.defaultAddress = [];
|
|
188
203
|
this.forceDialogOpen = false;
|
|
189
|
-
this.defaultAddressParams =
|
|
204
|
+
this.defaultAddressParams = [];
|
|
205
|
+
this.defaultCustomerProfileAddress = [];
|
|
206
|
+
this.customerProfile = null;
|
|
190
207
|
this.open = this.forceDialogOpen;
|
|
191
208
|
this.stripe = window.Zonos.stripe;
|
|
192
209
|
this.submitLoading = false;
|
|
@@ -203,6 +220,7 @@ export class ZonosCheckout {
|
|
|
203
220
|
this.inventoryCheckErrorMessage = null;
|
|
204
221
|
this.placedOrderInfo = null;
|
|
205
222
|
this.clientSecret = stripeStore.clientSecret;
|
|
223
|
+
this.stripeCustomerSessionClientSecret = stripeStore.stripeCustomerSessionClientSecret;
|
|
206
224
|
}
|
|
207
225
|
/**
|
|
208
226
|
* Init cart info handler event
|
|
@@ -263,6 +281,8 @@ export class ZonosCheckout {
|
|
|
263
281
|
cartId = cartIdResult.cartId;
|
|
264
282
|
// set prefill address if provided in createCartId callback result
|
|
265
283
|
this.useShippingDataFromCreateCartId(cartIdResult.shippingData);
|
|
284
|
+
cartStore.customerAuthenticationToken =
|
|
285
|
+
cartIdResult.customerAuthenticationToken || null;
|
|
266
286
|
}
|
|
267
287
|
else {
|
|
268
288
|
cartId = cartIdResult;
|
|
@@ -621,7 +641,6 @@ export class ZonosCheckout {
|
|
|
621
641
|
const phone = address.customerPhone || '';
|
|
622
642
|
const postal_code = address.customerZip || '';
|
|
623
643
|
const state = address.customerState || '';
|
|
624
|
-
const countryCode = country === 'UK' ? 'GB' : country;
|
|
625
644
|
/**
|
|
626
645
|
* If one of the value is null, no need to preset the default address.
|
|
627
646
|
* City and state are optional (they are not always provided for example Puerto Rico)
|
|
@@ -637,19 +656,27 @@ export class ZonosCheckout {
|
|
|
637
656
|
.join(', '));
|
|
638
657
|
return;
|
|
639
658
|
}
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
659
|
+
if (country &&
|
|
660
|
+
localizationStore.shippingZoneCountries &&
|
|
661
|
+
!(country in localizationStore.shippingZoneCountries)) {
|
|
662
|
+
log(`Country "${country}" is not in the shipping zone, so it can not be prefilled`, 'warn');
|
|
663
|
+
return;
|
|
664
|
+
}
|
|
665
|
+
this.defaultAddressParams = [
|
|
666
|
+
{
|
|
667
|
+
address: {
|
|
668
|
+
city: city || '',
|
|
669
|
+
country,
|
|
670
|
+
line1,
|
|
671
|
+
line2,
|
|
672
|
+
postal_code,
|
|
673
|
+
state,
|
|
674
|
+
},
|
|
675
|
+
email,
|
|
676
|
+
name,
|
|
677
|
+
phone,
|
|
648
678
|
},
|
|
649
|
-
|
|
650
|
-
name,
|
|
651
|
-
phone,
|
|
652
|
-
};
|
|
679
|
+
];
|
|
653
680
|
log('Prefill address applied', 'info', {
|
|
654
681
|
prefillAddress: this.defaultAddressParams,
|
|
655
682
|
providedAddress: address,
|
|
@@ -675,19 +702,21 @@ export class ZonosCheckout {
|
|
|
675
702
|
domesticRedirectedBtnSelector: domesticRedirectedBtnSelector,
|
|
676
703
|
onShippingAddressSessionFound: shippingAddressSession => {
|
|
677
704
|
// prefilled the default address if shipping address session is found for checkout on open
|
|
678
|
-
this.defaultAddress =
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
705
|
+
this.defaultAddress = [
|
|
706
|
+
{
|
|
707
|
+
address: {
|
|
708
|
+
city: shippingAddressSession.city,
|
|
709
|
+
country: shippingAddressSession.countryCode,
|
|
710
|
+
line1: shippingAddressSession.address1,
|
|
711
|
+
line2: shippingAddressSession.address2,
|
|
712
|
+
postal_code: shippingAddressSession.postalCode,
|
|
713
|
+
state: shippingAddressSession.state,
|
|
714
|
+
},
|
|
715
|
+
email: '',
|
|
716
|
+
name: `${shippingAddressSession.firstName} ${shippingAddressSession.lastName}`,
|
|
717
|
+
phone: shippingAddressSession.phone,
|
|
686
718
|
},
|
|
687
|
-
|
|
688
|
-
name: `${shippingAddressSession.firstName} ${shippingAddressSession.lastName}`,
|
|
689
|
-
phone: shippingAddressSession.phone,
|
|
690
|
-
};
|
|
719
|
+
];
|
|
691
720
|
},
|
|
692
721
|
});
|
|
693
722
|
/**
|
|
@@ -930,9 +959,39 @@ export class ZonosCheckout {
|
|
|
930
959
|
handleAddressChange() {
|
|
931
960
|
stripeStoreReset();
|
|
932
961
|
}
|
|
962
|
+
handleCustomerProfileChange() {
|
|
963
|
+
var _a, _b;
|
|
964
|
+
if (!this.customerProfile) {
|
|
965
|
+
log('No customer profile', 'info');
|
|
966
|
+
this.defaultCustomerProfileAddress = [];
|
|
967
|
+
return;
|
|
968
|
+
}
|
|
969
|
+
log('Customer profile found', 'info', {
|
|
970
|
+
customerProfile: this.customerProfile,
|
|
971
|
+
});
|
|
972
|
+
// Build and set saved locations from checkout customers
|
|
973
|
+
this.defaultCustomerProfileAddress =
|
|
974
|
+
((_b = (_a = stripeStore.customerProfile) === null || _a === void 0 ? void 0 : _a.locations) === null || _b === void 0 ? void 0 : _b.map(location => {
|
|
975
|
+
var _a;
|
|
976
|
+
return {
|
|
977
|
+
address: {
|
|
978
|
+
city: location.locality,
|
|
979
|
+
country: location.countryCode,
|
|
980
|
+
line1: location.line1,
|
|
981
|
+
line2: location.line2 || '',
|
|
982
|
+
postal_code: location.postalCode,
|
|
983
|
+
state: location.administrativeArea,
|
|
984
|
+
},
|
|
985
|
+
email: location.email || ((_a = stripeStore.customerProfile) === null || _a === void 0 ? void 0 : _a.email) || '',
|
|
986
|
+
name: location.name || '',
|
|
987
|
+
phone: location.phone || '',
|
|
988
|
+
};
|
|
989
|
+
})) || [];
|
|
990
|
+
}
|
|
933
991
|
handleClientSecretChange() {
|
|
934
|
-
log('
|
|
935
|
-
clientSecret:
|
|
992
|
+
log('==== Client secret changed', 'info', {
|
|
993
|
+
clientSecret: this.clientSecret,
|
|
994
|
+
stripeCustomerSessionClientSecret: this.stripeCustomerSessionClientSecret,
|
|
936
995
|
});
|
|
937
996
|
// apply theme to stripe elements
|
|
938
997
|
void this.applyStripeTheme();
|
|
@@ -954,6 +1013,8 @@ export class ZonosCheckout {
|
|
|
954
1013
|
html.style.overflow = 'hidden';
|
|
955
1014
|
}
|
|
956
1015
|
else {
|
|
1016
|
+
// Should reset stripeCustomerSessionClientSecret state when dialog is closed since merchant would need to re-authenticate, get an OTP again and we will get a new customer session.
|
|
1017
|
+
this.stripeCustomerSessionClientSecret = null;
|
|
957
1018
|
const bodyOverflow = body.getAttribute(overflowAttrKey);
|
|
958
1019
|
const htmlOverflow = html.getAttribute(overflowAttrKey);
|
|
959
1020
|
// reset overflow state to original state
|
|
@@ -1001,8 +1062,15 @@ export class ZonosCheckout {
|
|
|
1001
1062
|
}
|
|
1002
1063
|
render() {
|
|
1003
1064
|
var _a, _b, _c, _d;
|
|
1065
|
+
this.customerProfile = stripeStore.customerProfile;
|
|
1004
1066
|
// Set client secret so that we can add this to @Watch listener
|
|
1005
1067
|
this.clientSecret = stripeStore.clientSecret;
|
|
1068
|
+
// Only set and update stripeCustomerSession state if it's available, since it would only be available at the time checkout session is created, afterward access checkout session the value would be `null`.
|
|
1069
|
+
if (stripeStore.stripeCustomerSessionClientSecret) {
|
|
1070
|
+
// Set stripe customer session client secret so that we can add this to @Watch listener
|
|
1071
|
+
this.stripeCustomerSessionClientSecret =
|
|
1072
|
+
stripeStore.stripeCustomerSessionClientSecret;
|
|
1073
|
+
}
|
|
1006
1074
|
const dialogLoading =
|
|
1007
1075
|
// if it's last step, don't need to check stripe elements
|
|
1008
1076
|
(cartStore.step !== 'finish' &&
|
|
@@ -1055,7 +1123,7 @@ export class ZonosCheckout {
|
|
|
1055
1123
|
'--zonos--primary-color': !this.isMobile
|
|
1056
1124
|
? colorPrimary
|
|
1057
1125
|
: undefined,
|
|
1058
|
-
}) }, !this.isMobile && renderTopHeader(), cartStore.step === 'customer-info' && (h("zonos-customer-info", { continueLoading: this.submitLoading, defaultAddress: this.
|
|
1126
|
+
}) }, !this.isMobile && renderTopHeader(), cartStore.step === 'customer-info' && (h("zonos-customer-info", { continueLoading: this.submitLoading, defaultAddress: this.getDefaultAddress(), 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, isMobile: this.isMobile, onContinueClicked: async () => {
|
|
1059
1127
|
await this.handleStripePaymentContinue();
|
|
1060
1128
|
}, 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: () => {
|
|
1061
1129
|
// do nothing if it's not mobile
|
|
@@ -1233,8 +1301,8 @@ export class ZonosCheckout {
|
|
|
1233
1301
|
"type": "unknown",
|
|
1234
1302
|
"mutable": false,
|
|
1235
1303
|
"complexType": {
|
|
1236
|
-
"original": "StripeStoreContactOption
|
|
1237
|
-
"resolved": "
|
|
1304
|
+
"original": "| StripeStoreContactOption[]\n | StripeStoreContactOption",
|
|
1305
|
+
"resolved": "StripeStoreContactOption[] | { address: { city: string; country: string; line1: string; line2?: string | undefined; postal_code: string; state: string; }; email: string; name: string; phone?: string | undefined; }",
|
|
1238
1306
|
"references": {
|
|
1239
1307
|
"StripeStoreContactOption": {
|
|
1240
1308
|
"location": "import",
|
|
@@ -1251,7 +1319,7 @@ export class ZonosCheckout {
|
|
|
1251
1319
|
},
|
|
1252
1320
|
"getter": false,
|
|
1253
1321
|
"setter": false,
|
|
1254
|
-
"defaultValue": "
|
|
1322
|
+
"defaultValue": "[]"
|
|
1255
1323
|
},
|
|
1256
1324
|
"forceDialogOpen": {
|
|
1257
1325
|
"type": "boolean",
|
|
@@ -1278,6 +1346,8 @@ export class ZonosCheckout {
|
|
|
1278
1346
|
static get states() {
|
|
1279
1347
|
return {
|
|
1280
1348
|
"defaultAddressParams": {},
|
|
1349
|
+
"defaultCustomerProfileAddress": {},
|
|
1350
|
+
"customerProfile": {},
|
|
1281
1351
|
"open": {},
|
|
1282
1352
|
"stripe": {},
|
|
1283
1353
|
"submitLoading": {},
|
|
@@ -1293,7 +1363,8 @@ export class ZonosCheckout {
|
|
|
1293
1363
|
"payInUsdConfirmDialogOpen": {},
|
|
1294
1364
|
"inventoryCheckErrorMessage": {},
|
|
1295
1365
|
"placedOrderInfo": {},
|
|
1296
|
-
"clientSecret": {}
|
|
1366
|
+
"clientSecret": {},
|
|
1367
|
+
"stripeCustomerSessionClientSecret": {}
|
|
1297
1368
|
};
|
|
1298
1369
|
}
|
|
1299
1370
|
static get methods() {
|
|
@@ -1367,7 +1438,7 @@ export class ZonosCheckout {
|
|
|
1367
1438
|
"signature": "(session: CheckoutSessionDetailsFragment) => Promise<void>",
|
|
1368
1439
|
"parameters": [{
|
|
1369
1440
|
"name": "session",
|
|
1370
|
-
"type": "{ cartId: string | null; clientSecret: string; id: string; landedCost: { amountSubtotals: { discounts: number | null; duties: number; fees: number; items: number; landedCostTotal: number; shipping: number; taxes: number; } | null; id: string; landedCostGuaranteeCode: LandedCostGuaranteeCode; method: IncotermCode; shipmentRating: { displayName: string; }; } | null; metadata: ({ key: string; value: string; } | null)[] | null; organizationId: string; subtotals: { adjustments: number; duties: number; exchangeRate: { id: string; rate: number; sourceCurrencyCode: CurrencyCode; targetCurrencyCode: CurrencyCode; type: ExchangeRateType; }; fees: number; items: number; landedCostTotal: number; presentmentCurrencyCode: CurrencyCode; shipping: number; taxes: number; total: number; }; }",
|
|
1441
|
+
"type": "{ cartId: string | null; clientSecret: string; customerProfile: { email: string | null; locations: { administrativeArea: string; countryCode: CountryCode; email: string | null; line1: string; line2: string | null; locality: string; name: string | null; phone: string | null; postalCode: string; }[] | null; name: string | null; } | null; customerSessionClientSecret: string | null; id: string; landedCost: { amountSubtotals: { discounts: number | null; duties: number; fees: number; items: number; landedCostTotal: number; shipping: number; taxes: number; } | null; id: string; landedCostGuaranteeCode: LandedCostGuaranteeCode; method: IncotermCode; shipmentRating: { displayName: string; }; } | null; metadata: ({ key: string; value: string; } | null)[] | null; organizationId: string; subtotals: { adjustments: number; duties: number; exchangeRate: { id: string; rate: number; sourceCurrencyCode: CurrencyCode; targetCurrencyCode: CurrencyCode; type: ExchangeRateType; }; fees: number; items: number; landedCostTotal: number; presentmentCurrencyCode: CurrencyCode; shipping: number; taxes: number; total: number; }; }",
|
|
1371
1442
|
"docs": ""
|
|
1372
1443
|
}],
|
|
1373
1444
|
"references": {
|
|
@@ -1406,9 +1477,15 @@ export class ZonosCheckout {
|
|
|
1406
1477
|
}, {
|
|
1407
1478
|
"propName": "defaultAddress",
|
|
1408
1479
|
"methodName": "handleAddressChange"
|
|
1480
|
+
}, {
|
|
1481
|
+
"propName": "customerProfile",
|
|
1482
|
+
"methodName": "handleCustomerProfileChange"
|
|
1409
1483
|
}, {
|
|
1410
1484
|
"propName": "clientSecret",
|
|
1411
1485
|
"methodName": "handleClientSecretChange"
|
|
1486
|
+
}, {
|
|
1487
|
+
"propName": "stripeCustomerSessionClientSecret",
|
|
1488
|
+
"methodName": "handleClientSecretChange"
|
|
1412
1489
|
}, {
|
|
1413
1490
|
"propName": "open",
|
|
1414
1491
|
"methodName": "handleOpenChange"
|
|
@@ -148,7 +148,7 @@ export class ZonosCustomerInfo {
|
|
|
148
148
|
this.submitBtnType = undefined;
|
|
149
149
|
this.submitBtnColor = undefined;
|
|
150
150
|
this.isMobile = false;
|
|
151
|
-
this.defaultAddress =
|
|
151
|
+
this.defaultAddress = [];
|
|
152
152
|
this.showErrorBanner = false;
|
|
153
153
|
this.shippingCountry = '';
|
|
154
154
|
this.isCheckingForRestrictedItems = false;
|
|
@@ -205,7 +205,7 @@ export class ZonosCustomerInfo {
|
|
|
205
205
|
} }), this.isTaxIdError && (h("zonos-text", { textColor: 'red-600', type: "caption" }, translate('Tax id is required')))));
|
|
206
206
|
}
|
|
207
207
|
render() {
|
|
208
|
-
var _a, _b;
|
|
208
|
+
var _a, _b, _c, _d, _e, _f;
|
|
209
209
|
if (!stripeStore.stripeElements) {
|
|
210
210
|
return null;
|
|
211
211
|
}
|
|
@@ -224,11 +224,15 @@ export class ZonosCustomerInfo {
|
|
|
224
224
|
const showBilling = !stripeStore.stripeShippingSameAsBilling;
|
|
225
225
|
// Get theme for the update dialog, inherit from the theme, no from this component theme
|
|
226
226
|
const theme = getZonosStoreTheme(zonosStore.appearance.theme);
|
|
227
|
+
// Attempt to get the email from email from customer profile's locations, if not provided, just use the email from root customer profile
|
|
228
|
+
const defaultEmail = ((_b = this.defaultAddress.find(Boolean)) === null || _b === void 0 ? void 0 : _b.email) ||
|
|
229
|
+
((_e = (_d = (_c = stripeStore.customerProfile) === null || _c === void 0 ? void 0 : _c.locations) === null || _d === void 0 ? void 0 : _d.find(Boolean)) === null || _e === void 0 ? void 0 : _e.email) ||
|
|
230
|
+
((_f = stripeStore.customerProfile) === null || _f === void 0 ? void 0 : _f.email);
|
|
227
231
|
// start validate on typing after error banner is shown, and hide it if the form is complete
|
|
228
232
|
if (this.showErrorBanner) {
|
|
229
233
|
this.showErrorBanner = !this.handleValidate();
|
|
230
234
|
}
|
|
231
|
-
return (h(Host, { class: "zonos--customer-info zonos--elements" }, h("div", { class: "zonos--group" }, h("zonos-text", { class: "zonos--title", type: "semiBoldSubheader" }, translate('Customer information')), this.showErrorBanner && (h("zonos-banner", { class: "zonos--error-banner", intent: "error" }, translate('Missing required fields. Make sure all fields are completed.'))), h("zonos-link-authentication", { defaultEmail:
|
|
235
|
+
return (h(Host, { class: "zonos--customer-info zonos--elements" }, h("div", { class: "zonos--group" }, h("zonos-text", { class: "zonos--title", type: "semiBoldSubheader" }, translate('Customer information')), this.showErrorBanner && (h("zonos-banner", { class: "zonos--error-banner", intent: "error" }, translate('Missing required fields. Make sure all fields are completed.'))), h("zonos-link-authentication", { defaultEmail: defaultEmail, isEmailError: this.isEmailError, onLinkAuthenticationChange: this.handleEmailValidation, titleText: translate('Contact') }), h("zonos-address", { defaultAddress: this.defaultAddress, titleText: translate('Address'), type: "shipping" }), this.renderTaxIdInput(this.shippingCountry), h("zonos-checkbox", { class: "zonos--shipping-same-as-billing-cbx", isChecked: stripeStore.stripeShippingSameAsBilling, label: translate('Shipping address same as billing'), onCheckboxSelected: e => {
|
|
232
236
|
stripeStore.stripeShippingSameAsBilling = e.detail;
|
|
233
237
|
} }), h("zonos-collapse", { collapsed: !showBilling }, h("zonos-address", { defaultAddress: this.defaultAddress, titleText: translate('Billing address'), type: "billing" })), h("div", { class: "zonos--group-btn" }, h("zonos-button", { backgroundColor: this.submitBtnColor, bold: true, loading: this.continueLoading, onClick: () => this.continueClickHandler(), size: "lg",
|
|
234
238
|
// use primary type when on mobile mode
|
|
@@ -348,8 +352,8 @@ export class ZonosCustomerInfo {
|
|
|
348
352
|
"type": "unknown",
|
|
349
353
|
"mutable": false,
|
|
350
354
|
"complexType": {
|
|
351
|
-
"original": "StripeStoreContactOption
|
|
352
|
-
"resolved": "
|
|
355
|
+
"original": "StripeStoreContactOption[]",
|
|
356
|
+
"resolved": "StripeStoreContactOption[]",
|
|
353
357
|
"references": {
|
|
354
358
|
"StripeStoreContactOption": {
|
|
355
359
|
"location": "import",
|
|
@@ -366,7 +370,7 @@ export class ZonosCustomerInfo {
|
|
|
366
370
|
},
|
|
367
371
|
"getter": false,
|
|
368
372
|
"setter": false,
|
|
369
|
-
"defaultValue": "
|
|
373
|
+
"defaultValue": "[]"
|
|
370
374
|
}
|
|
371
375
|
};
|
|
372
376
|
}
|
|
@@ -15,6 +15,7 @@ const { onChange, reset, state: cartStore, } = createStore(() => ({
|
|
|
15
15
|
checkoutTimeoutInterval: null,
|
|
16
16
|
currency: 'USD',
|
|
17
17
|
customQuotingError: null,
|
|
18
|
+
customerAuthenticationToken: null,
|
|
18
19
|
displayBaseCurrency: false,
|
|
19
20
|
dutiesTaxesFees: null,
|
|
20
21
|
dutiesTaxesFeesEstimate: null,
|
|
@@ -167,7 +168,11 @@ const cartStoreHasOneEligibleItem = () => {
|
|
|
167
168
|
};
|
|
168
169
|
const cartStoreSetCheckoutSession = (checkoutSession) => {
|
|
169
170
|
var _a, _b, _c, _d, _e;
|
|
171
|
+
// update stripe store with updated information
|
|
170
172
|
stripeStore.clientSecret = checkoutSession.clientSecret;
|
|
173
|
+
stripeStore.stripeCustomerSessionClientSecret =
|
|
174
|
+
checkoutSession.customerSessionClientSecret;
|
|
175
|
+
stripeStore.customerProfile = checkoutSession.customerProfile;
|
|
171
176
|
cartStore.checkoutSession = checkoutSession;
|
|
172
177
|
cartStore.checkoutSessionId = checkoutSession.id;
|
|
173
178
|
// Check if there is a redirect URL in the metadata to override
|
|
@@ -21,6 +21,7 @@ const { onChange, reset, state: stripeStore, } = createStore(() => ({
|
|
|
21
21
|
clientSecret: sessionStorage.getItem('zonos--client-secret') || '',
|
|
22
22
|
companyName: '',
|
|
23
23
|
customErrorMessage: null,
|
|
24
|
+
customerProfile: null,
|
|
24
25
|
fetchingLandedCostAbortController: null,
|
|
25
26
|
hasPaymentError: false,
|
|
26
27
|
isFetchingLandedCost: false,
|
|
@@ -43,6 +44,7 @@ const { onChange, reset, state: stripeStore, } = createStore(() => ({
|
|
|
43
44
|
stripeBillingAddressEventData: null,
|
|
44
45
|
stripeBillingAddressUsedWhenFetchingLC: null,
|
|
45
46
|
stripeBillingAddressUsedWhenValidatingAddress: null,
|
|
47
|
+
stripeCustomerSessionClientSecret: null,
|
|
46
48
|
stripeElements: null,
|
|
47
49
|
stripeElementsForBillingAddress: null,
|
|
48
50
|
stripeElementsOptions: null,
|
|
@@ -85,6 +87,7 @@ const getStripeOptions = ({ clientSecret, overrideBorderRadius, overridePrimaryC
|
|
|
85
87
|
},
|
|
86
88
|
// Client secret can be undefined since we will load other elements that doesn't require client secret first, then load client secret and render one that requires it later
|
|
87
89
|
clientSecret: clientSecret || undefined,
|
|
90
|
+
customerSessionClientSecret: stripeStore.stripeCustomerSessionClientSecret || undefined,
|
|
88
91
|
externalPaymentMethodTypes: [...paypalPaymentType],
|
|
89
92
|
locale: localizationStore.selectedLocale,
|
|
90
93
|
};
|
|
@@ -540,6 +543,7 @@ export const getCheckoutSessionBody = () => {
|
|
|
540
543
|
adjustmentsAmount: cartStore.adjustments.reduce((prev, adj) => prev + adj.amount, 0),
|
|
541
544
|
cartId: window.Zonos.cartId,
|
|
542
545
|
currency: ((_a = cartStore.items.find(Boolean)) === null || _a === void 0 ? void 0 : _a.currencyCode) || '',
|
|
546
|
+
customerAuthenticationToken: cartStore.customerAuthenticationToken || undefined,
|
|
543
547
|
itemsAmount: total,
|
|
544
548
|
metadata: [
|
|
545
549
|
{
|
|
@@ -566,10 +570,6 @@ export const getCheckoutSessionBody = () => {
|
|
|
566
570
|
};
|
|
567
571
|
const stripeStoreGetPaymentIntent = async () => {
|
|
568
572
|
var _a;
|
|
569
|
-
if (stripeStore.clientSecret) {
|
|
570
|
-
log('Payment intent already exists, skipping fetching payment intent');
|
|
571
|
-
return;
|
|
572
|
-
}
|
|
573
573
|
if (!cartStore.checkoutSessionId) {
|
|
574
574
|
// We want to log the error anytime we fail to create a checkout session
|
|
575
575
|
void sendErrorLog({
|
|
@@ -616,9 +616,6 @@ const stripeStoreGetPaymentIntent = async () => {
|
|
|
616
616
|
});
|
|
617
617
|
return;
|
|
618
618
|
}
|
|
619
|
-
// update stripe store with updated information
|
|
620
|
-
stripeStore.clientSecret =
|
|
621
|
-
json.checkoutSessionPaymentIntentCreate.clientSecret;
|
|
622
619
|
// update cart store checkout session with updated from checkout session payment intent creation call so the checkout session and payment intent are in sync
|
|
623
620
|
cartStoreSetCheckoutSession(json.checkoutSessionPaymentIntentCreate);
|
|
624
621
|
};
|
|
@@ -695,6 +692,7 @@ const stripeStoreUpdateCheckoutSession = async ({ adjustmentsAmount, cartId, cur
|
|
|
695
692
|
adjustmentsAmount,
|
|
696
693
|
cartId,
|
|
697
694
|
currency,
|
|
695
|
+
customerAuthenticationToken: cartStore.customerAuthenticationToken || undefined,
|
|
698
696
|
id,
|
|
699
697
|
itemsAmount,
|
|
700
698
|
landedCostId,
|
|
@@ -17,7 +17,7 @@ export class ZonosAddress {
|
|
|
17
17
|
this.isAutoCompleteAdjusted = false;
|
|
18
18
|
this.type = undefined;
|
|
19
19
|
this.titleText = undefined;
|
|
20
|
-
this.defaultAddress =
|
|
20
|
+
this.defaultAddress = [];
|
|
21
21
|
this.stripe = window.Zonos.stripe;
|
|
22
22
|
this.isDirtyAddress = false;
|
|
23
23
|
}
|
|
@@ -53,19 +53,15 @@ export class ZonosAddress {
|
|
|
53
53
|
stripeStore.stripeBillingAddressElement = stripeAddressElement;
|
|
54
54
|
}
|
|
55
55
|
async watchInitStripe() {
|
|
56
|
-
var _a, _b;
|
|
57
56
|
this.stripe = window.Zonos.stripe;
|
|
58
57
|
const { stripeAddressEventData, stripeElements } = this.getStripeAddressInstance();
|
|
59
58
|
if (!this.stripe || !stripeElements) {
|
|
60
59
|
logError("Stripe is not initialized. Couldn't load stripe element.");
|
|
61
60
|
return;
|
|
62
61
|
}
|
|
63
|
-
|
|
64
|
-
if
|
|
65
|
-
|
|
66
|
-
// will throw error if key phone exist and its value is empty or 'undefined'.
|
|
67
|
-
(_b = this.defaultAddress) === null || _b === void 0 ? true : delete _b.phone;
|
|
68
|
-
}
|
|
62
|
+
// remove phone from default address if it's not provided, stripe
|
|
63
|
+
// will throw error if key phone exist and its value is empty or 'undefined'.
|
|
64
|
+
const defaultAddress = this.defaultAddress.map(address => (Object.assign(Object.assign({}, address), { name: address.name, phone: address.phone || undefined })));
|
|
69
65
|
const shippableCountries = localizationStore.shippingZoneCountries;
|
|
70
66
|
const shippingZone = shippableCountries
|
|
71
67
|
? Object.values(shippableCountries).map(country => country.code)
|
|
@@ -79,8 +75,8 @@ export class ZonosAddress {
|
|
|
79
75
|
const addressElement = stripeElements.create('address', {
|
|
80
76
|
allowedCountries: checkoutAllCountries ? [] : allowedCountries,
|
|
81
77
|
// only show the default address if stripeAddressEventData is not provided
|
|
82
|
-
contacts:
|
|
83
|
-
?
|
|
78
|
+
contacts: defaultAddress.length && !stripeAddressEventData
|
|
79
|
+
? this.defaultAddress
|
|
84
80
|
: [],
|
|
85
81
|
defaultValues: {
|
|
86
82
|
address: Object.assign(Object.assign({}, stripeAddressEventData === null || stripeAddressEventData === void 0 ? void 0 : stripeAddressEventData.value.address), { country: defaultAddressCountry }),
|
|
@@ -138,12 +134,27 @@ export class ZonosAddress {
|
|
|
138
134
|
type: this.type,
|
|
139
135
|
});
|
|
140
136
|
}
|
|
141
|
-
defaultAddressChanged() {
|
|
137
|
+
defaultAddressChanged(oldAddress, newAddress) {
|
|
138
|
+
// check if stringified json of oldAddress is different from newAddress
|
|
139
|
+
const oldAddressString = JSON.stringify(oldAddress);
|
|
140
|
+
const newAddressString = JSON.stringify(newAddress);
|
|
141
|
+
// No need to reset address element if the default address is the same
|
|
142
|
+
if (oldAddressString === newAddressString) {
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
142
145
|
log('Reset address element when default address property is changed', 'info', {
|
|
143
146
|
defaultAddress: this.defaultAddress,
|
|
144
147
|
});
|
|
145
148
|
const stripeElement = this.getStripeAddressInstance().stripeAddressElement;
|
|
149
|
+
stripeElement === null || stripeElement === void 0 ? void 0 : stripeElement.clear();
|
|
146
150
|
stripeElement === null || stripeElement === void 0 ? void 0 : stripeElement.destroy();
|
|
151
|
+
// Reset stripe address event data
|
|
152
|
+
if (this.type === 'shipping') {
|
|
153
|
+
stripeStore.stripeAddressEventData = null;
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
stripeStore.stripeBillingAddressEventData = null;
|
|
157
|
+
}
|
|
147
158
|
void this.watchInitStripe();
|
|
148
159
|
}
|
|
149
160
|
renderCompanyNameInput() {
|
|
@@ -177,7 +188,7 @@ export class ZonosAddress {
|
|
|
177
188
|
}
|
|
178
189
|
render() {
|
|
179
190
|
// this component loads iframe from the stripe elements and puts here, so we don't need to do anything here
|
|
180
|
-
return (h(Host, { key: '
|
|
191
|
+
return (h(Host, { key: '455356fe5ca9910fe34df12eb02b499316167bc7', class: "zonos--address zonos--elements" }, h("zonos-text", { key: '44ae4b872ca4aea9e9d8e1cfa0de5e421e4ea524', class: "zonos--title", type: "semiBoldLabel" }, this.titleText), this.renderCompanyNameInput(), h("div", { key: '188976d8eef8c23b41c1b82fc7d5c4d2069fc92b', class: "zonos--address-component" })));
|
|
181
192
|
}
|
|
182
193
|
static get is() { return "zonos-address"; }
|
|
183
194
|
static get encapsulation() { return "scoped"; }
|
|
@@ -235,8 +246,8 @@ export class ZonosAddress {
|
|
|
235
246
|
"type": "unknown",
|
|
236
247
|
"mutable": false,
|
|
237
248
|
"complexType": {
|
|
238
|
-
"original": "ContactOption
|
|
239
|
-
"resolved": "ContactOption
|
|
249
|
+
"original": "ContactOption[]",
|
|
250
|
+
"resolved": "ContactOption[]",
|
|
240
251
|
"references": {
|
|
241
252
|
"ContactOption": {
|
|
242
253
|
"location": "import",
|
|
@@ -253,7 +264,7 @@ export class ZonosAddress {
|
|
|
253
264
|
},
|
|
254
265
|
"getter": false,
|
|
255
266
|
"setter": false,
|
|
256
|
-
"defaultValue": "
|
|
267
|
+
"defaultValue": "[]"
|
|
257
268
|
}
|
|
258
269
|
};
|
|
259
270
|
}
|
package/dist/collection/components/stripe/zonos-link-authentication/zonos-link-authentication.js
CHANGED
|
@@ -4,6 +4,7 @@ import { cartStore } from "../../store/checkout/cart";
|
|
|
4
4
|
import { stripeStore } from "../../store/checkout/stripe";
|
|
5
5
|
import { translate } from "../../store/translationStore";
|
|
6
6
|
import { getBorderRadius } from "../../utils/getBorderRadius";
|
|
7
|
+
import { log } from "../../utils/logging/log";
|
|
7
8
|
import { logError } from "../../utils/logging/logError";
|
|
8
9
|
import { validateEmailValue } from "../../utils/validateEmailValue";
|
|
9
10
|
/**
|
|
@@ -59,7 +60,7 @@ export class ZonosLinkAuthentication {
|
|
|
59
60
|
// Create and mount the Authentication Element in ${type} mode
|
|
60
61
|
const linkAuthenticationElement = stripeStore.stripeLinkElement ||
|
|
61
62
|
stripeStore.stripeElements.create('linkAuthentication', {
|
|
62
|
-
defaultValues: defaultValues
|
|
63
|
+
defaultValues: defaultValues,
|
|
63
64
|
});
|
|
64
65
|
const linkAuthenticationElementContainer = this.el.querySelector('.zonos--link-authentication-component');
|
|
65
66
|
if (!linkAuthenticationElementContainer) {
|
|
@@ -74,11 +75,33 @@ export class ZonosLinkAuthentication {
|
|
|
74
75
|
});
|
|
75
76
|
stripeStore.stripeLinkElement = linkAuthenticationElement;
|
|
76
77
|
}
|
|
77
|
-
watchDefaultEmail() {
|
|
78
|
-
|
|
78
|
+
watchDefaultEmail(newDefaultEmail, oldDefaultEmail) {
|
|
79
|
+
var _a, _b;
|
|
80
|
+
log('Default email is changed', 'info', {
|
|
81
|
+
newDefaultEmail,
|
|
82
|
+
oldDefaultEmail,
|
|
83
|
+
});
|
|
84
|
+
if (oldDefaultEmail === newDefaultEmail) {
|
|
79
85
|
return;
|
|
80
86
|
}
|
|
81
|
-
|
|
87
|
+
if (!newDefaultEmail) {
|
|
88
|
+
stripeStore.stripeLinkEventData = null;
|
|
89
|
+
}
|
|
90
|
+
// Only set value for Stripe input input to stripeLinkEventData when checkout is in staging mode
|
|
91
|
+
if (cartStore.isStagingMode) {
|
|
92
|
+
this.setCustomEmailInputToLinkEvent(newDefaultEmail || '');
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
(_a = stripeStore.stripeLinkElement) === null || _a === void 0 ? void 0 : _a.clear();
|
|
96
|
+
(_b = stripeStore.stripeLinkElement) === null || _b === void 0 ? void 0 : _b.destroy();
|
|
97
|
+
stripeStore.stripeLinkElement = null;
|
|
98
|
+
stripeStore.stripeLinkEventData = null;
|
|
99
|
+
log('Reset stripe link element when default email is changed', 'info', {
|
|
100
|
+
defaultEmail: newDefaultEmail,
|
|
101
|
+
});
|
|
102
|
+
setTimeout(() => {
|
|
103
|
+
void this.watchInitStripe();
|
|
104
|
+
}, 5);
|
|
82
105
|
}
|
|
83
106
|
componentDidLoad() {
|
|
84
107
|
// @Watch doesn't get trigger on initial load
|
|
@@ -165,12 +165,15 @@ const handleRequestWithFallback = async ({ basePathType: _basePathType, options,
|
|
|
165
165
|
log(`${path} (${duration.toFixed(2)}ms)`, 'info');
|
|
166
166
|
// No need to send the load time api log for the log-script-load endpoint
|
|
167
167
|
const internalDuration = response === null || response === void 0 ? void 0 : response.headers.get('Zonos-Duration');
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
168
|
+
// Only record if the response status is 200, some endpoint will return 200 with error
|
|
169
|
+
if ((response === null || response === void 0 ? void 0 : response.status) === 200) {
|
|
170
|
+
prepLoadTimeApiLog({
|
|
171
|
+
apiPath: path,
|
|
172
|
+
apiType: basePathType,
|
|
173
|
+
loadTimeInternal: internalDuration ? Number(internalDuration) : 0,
|
|
174
|
+
loadTimeTotal: duration,
|
|
175
|
+
});
|
|
176
|
+
}
|
|
174
177
|
const nextFallbackApiType = getNextFallbackApiType(basePathType);
|
|
175
178
|
const unknownError = errors.find(({ type }) => type === 'unknown');
|
|
176
179
|
const isUnknownError = !!unknownError || (response === null || response === void 0 ? void 0 : response.status) === 404;
|
|
@@ -10,6 +10,7 @@ export const getAdditionalLogMetadata = () => {
|
|
|
10
10
|
connectionEffectiveType: baseConnection === null || baseConnection === void 0 ? void 0 : baseConnection.effectiveType,
|
|
11
11
|
connectionRtt: baseConnection === null || baseConnection === void 0 ? void 0 : baseConnection.rtt,
|
|
12
12
|
connectionSaveData: baseConnection === null || baseConnection === void 0 ? void 0 : baseConnection.saveData,
|
|
13
|
+
isHostedCheckout: window.Zonos.isLegacyCheckout,
|
|
13
14
|
screenHeight: window.screen.height,
|
|
14
15
|
screenWidth: window.screen.width,
|
|
15
16
|
userAgent: userAgentData && userAgentData.brands.length > 0
|
|
@@ -1753,6 +1753,8 @@ export const landedCostFeeType = {
|
|
|
1753
1753
|
DdpServiceFee: 'DDP_SERVICE_FEE',
|
|
1754
1754
|
Discount: 'DISCOUNT',
|
|
1755
1755
|
Duty: 'DUTY',
|
|
1756
|
+
GuaranteeOrder: 'GUARANTEE_ORDER',
|
|
1757
|
+
GuaranteePercent: 'GUARANTEE_PERCENT',
|
|
1756
1758
|
InclusivePriceAdjustment: 'INCLUSIVE_PRICE_ADJUSTMENT',
|
|
1757
1759
|
InclusivePricing: 'INCLUSIVE_PRICING',
|
|
1758
1760
|
Item: 'ITEM',
|
|
@@ -2621,6 +2623,8 @@ export const webhookStatus = {
|
|
|
2621
2623
|
};
|
|
2622
2624
|
export const webhookType = {
|
|
2623
2625
|
InclusivePriceSyncReady: 'INCLUSIVE_PRICE_SYNC_READY',
|
|
2626
|
+
InventoryCheck: 'INVENTORY_CHECK',
|
|
2627
|
+
InventoryRefund: 'INVENTORY_REFUND',
|
|
2624
2628
|
IpSettingStatusChanged: 'IP_SETTING_STATUS_CHANGED',
|
|
2625
2629
|
OrderCanceled: 'ORDER_CANCELED',
|
|
2626
2630
|
OrderCreated: 'ORDER_CREATED',
|
|
@@ -2671,6 +2675,9 @@ export function getSdk(client, withWrapper = defaultWrapper) {
|
|
|
2671
2675
|
checkItemRestrictions(variables, requestHeaders) {
|
|
2672
2676
|
return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'checkItemRestrictions', 'mutation');
|
|
2673
2677
|
},
|
|
2678
|
+
checkoutCustomerProfileAuthenticate(variables, requestHeaders) {
|
|
2679
|
+
return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'checkoutCustomerProfileAuthenticate', 'mutation');
|
|
2680
|
+
},
|
|
2674
2681
|
checkoutSessionBaseCurrencyUpdate(variables, requestHeaders) {
|
|
2675
2682
|
return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'checkoutSessionBaseCurrencyUpdate', 'mutation');
|
|
2676
2683
|
},
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as getIsTestMode, h as handleFetch, l as log, b as logError } from './handleFetch-
|
|
1
|
+
import { g as getIsTestMode, h as handleFetch, l as log, b as logError } from './handleFetch-0109fb78.js';
|
|
2
2
|
|
|
3
3
|
const getTempCartById = async ({ cartId, retries, }) => {
|
|
4
4
|
const isTestMode = getIsTestMode();
|