@zonos/elements 1.3.145 → 1.3.146
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-9d5e2816.js → cart-a262c92c.js} +3 -1
- package/dist/cjs/index.cjs.js +7 -7
- package/dist/cjs/{paypal-f9015045.js → paypal-0895372a.js} +1 -1
- package/dist/cjs/zonos-address_8.cjs.entry.js +2 -2
- package/dist/cjs/zonos-cart-items_13.cjs.entry.js +3 -3
- package/dist/cjs/zonos-checkout.cjs.entry.js +68 -12
- package/dist/cjs/zonos-controller.cjs.entry.js +9 -3
- 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-empty-state-payment_4.cjs.entry.js +2 -2
- 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/collection/components/checkout/zonos-checkout/zonos-checkout.js +66 -10
- package/dist/collection/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.css +1 -0
- package/dist/collection/components/main/zonos-controller.js +8 -2
- package/dist/collection/components/stripe/zonos-link-authentication/zonos-link-authentication.js +1 -1
- package/dist/collection/components/utils/hello/getZCountryUrlParam.js +3 -1
- package/dist/esm/{cart-887f7d66.js → cart-a0b95207.js} +3 -1
- package/dist/esm/index.js +7 -7
- package/dist/esm/{paypal-6fd5749b.js → paypal-f1005b82.js} +1 -1
- package/dist/esm/zonos-address_8.entry.js +2 -2
- package/dist/esm/zonos-cart-items_13.entry.js +3 -3
- package/dist/esm/zonos-checkout.entry.js +68 -12
- package/dist/esm/zonos-controller.entry.js +9 -3
- 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-empty-state-payment_4.entry.js +2 -2
- 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-es5/{cart-887f7d66.js → cart-a0b95207.js} +1 -1
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/{paypal-6fd5749b.js → paypal-f1005b82.js} +1 -1
- package/dist/esm-es5/zonos-address_8.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-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 +20 -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.d.ts +2 -0
- package/dist/types/types/checkout/CheckoutConfig.d.ts +20 -1
- package/dist/zonos-elements/assets/RemoveIcon.svg +1 -1
- package/dist/zonos-elements/index.esm.js +1 -1
- package/dist/zonos-elements/{p-826b5d0c.system.js → p-0101da8c.system.js} +1 -1
- package/dist/zonos-elements/{p-1d466ac6.entry.js → p-07a8a124.entry.js} +1 -1
- package/dist/zonos-elements/p-0ab922d1.js +17 -0
- package/dist/zonos-elements/{p-3bd17598.system.entry.js → p-0f02083d.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-0e9826d2.system.entry.js → p-23ea1883.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-b0ced00a.system.js → p-2d152241.system.js} +1 -1
- package/dist/zonos-elements/{p-4d353108.entry.js → p-2d450227.entry.js} +1 -1
- package/dist/zonos-elements/p-4456cc80.entry.js +1 -0
- package/dist/zonos-elements/{p-896dca32.entry.js → p-469dd116.entry.js} +1 -1
- package/dist/zonos-elements/p-46f6e5e9.system.js +1 -1
- package/dist/zonos-elements/{p-9024f5a1.entry.js → p-576f95f8.entry.js} +1 -1
- package/dist/zonos-elements/p-60ea5e25.system.entry.js +1 -0
- package/dist/zonos-elements/{p-5e76c269.entry.js → p-68f80c51.entry.js} +1 -1
- package/dist/zonos-elements/{p-2e6265cc.system.entry.js → p-6ad1541e.system.entry.js} +1 -1
- package/dist/zonos-elements/p-89dcf124.system.entry.js +1 -0
- package/dist/zonos-elements/{p-fdb592a8.system.js → p-931d7fb7.system.js} +1 -1
- package/dist/zonos-elements/{p-fec7bdd4.system.entry.js → p-9e934cc7.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-b4823b13.entry.js → p-ae95877a.entry.js} +1 -1
- package/dist/zonos-elements/{p-98db517b.entry.js → p-badca4a1.entry.js} +1 -1
- package/dist/zonos-elements/{p-e3abf96c.system.entry.js → p-bcc65b55.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-b18c4d1d.js → p-c23e256e.js} +1 -1
- package/dist/zonos-elements/{p-794b2d24.system.entry.js → p-d2214283.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-e4d509be.entry.js → p-d2477bcf.entry.js} +1 -1
- package/dist/zonos-elements/{p-9ae29c27.system.entry.js → p-d787a694.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-b7a40db9.system.entry.js → p-e619ff1e.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-e8926f59.entry.js → p-ff8d0109.entry.js} +1 -1
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/package.json +1 -1
- package/dist/zonos-elements/p-3f282167.system.entry.js +0 -1
- package/dist/zonos-elements/p-49b8760c.system.entry.js +0 -1
- package/dist/zonos-elements/p-5e4b6b77.js +0 -17
- package/dist/zonos-elements/p-f824a75f.entry.js +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as registerInstance, h, H as Host, F as Fragment } from './index-d82f06f2.js';
|
|
2
|
-
import { l as localizationStore, s as stripeStoreGetDomesticShippingSession, a as localizationStoreUpdateSelectedCountryCode, b as stripeStoreCleanupDomesticShippingSession, c as stripeStoreSaveDomesticShippingSession, i as initStripeElements, d as stripeStoreRetrievePayment, e as cartStore, f as stripeStore, g as cartStoreUpdateItems, h as cartStoreReset, j as cartStoreResetTabItems, k as cartStoreClearCheckoutInterval, m as stripeStoreInitCheckoutSession, n as cartStoreStartCheckoutInterval, t as trackConversionEvent, o as getCheckoutSessionBody, p as cartStoreUpdateToErrorState, q as translate, r as getZCountryUrlParam, u as cartStoreSetCheckoutSession, v as stripeStorePrefetchLandedCost, w as cartStoreNextStep, x as stripeStoreHandleInventoryCheck, y as stripeStoreConfirmPayment, z as stripeStoreHandleInventoryRefund, A as stripeStoreReset, B as localizationStoreOnUpdate } from './cart-
|
|
3
|
-
import { p as paypalStoreHasPaypalEnabled, s as submitGtag, a as paypalInitScript, b as paypalStore } from './paypal-
|
|
2
|
+
import { l as localizationStore, s as stripeStoreGetDomesticShippingSession, a as localizationStoreUpdateSelectedCountryCode, b as stripeStoreCleanupDomesticShippingSession, c as stripeStoreSaveDomesticShippingSession, i as initStripeElements, d as stripeStoreRetrievePayment, e as cartStore, f as stripeStore, g as cartStoreUpdateItems, h as cartStoreReset, j as cartStoreResetTabItems, k as cartStoreClearCheckoutInterval, m as stripeStoreInitCheckoutSession, n as cartStoreStartCheckoutInterval, t as trackConversionEvent, o as getCheckoutSessionBody, p as cartStoreUpdateToErrorState, q as translate, r as getZCountryUrlParam, u as cartStoreSetCheckoutSession, v as stripeStorePrefetchLandedCost, w as cartStoreNextStep, x as stripeStoreHandleInventoryCheck, y as stripeStoreConfirmPayment, z as stripeStoreHandleInventoryRefund, A as stripeStoreReset, B as localizationStoreOnUpdate } from './cart-a0b95207.js';
|
|
3
|
+
import { p as paypalStoreHasPaypalEnabled, s as submitGtag, a as paypalInitScript, b as paypalStore } from './paypal-f1005b82.js';
|
|
4
4
|
import { z as zonosStore, g as getZonosStoreTheme, m as mergeConfig } from './zonosStore-44efd080.js';
|
|
5
5
|
import { h as handleFetch, l as log, b as logError, s as sendErrorLog, c as getElapsedTime, d as allLogs, g as getIsTestMode, j as jsonParse, a as getIsStagingMode } from './handleFetch-b4633675.js';
|
|
6
6
|
import { i as isCheckoutMobile } from './isCheckoutMobile-8846dccb.js';
|
|
@@ -441,7 +441,17 @@ const ZonosCheckout = class {
|
|
|
441
441
|
// if createCartId is provided, use it to build cart. Merchant will provide create a cart from their server side and give the cart id to us.
|
|
442
442
|
if (typeof zonosStore.checkoutSettings.createCartId === 'function') {
|
|
443
443
|
log('"createCartId" is provided, start building cart');
|
|
444
|
-
const
|
|
444
|
+
const cartIdResult = await zonosStore.checkoutSettings.createCartId();
|
|
445
|
+
let cartId;
|
|
446
|
+
if (typeof cartIdResult === 'object') {
|
|
447
|
+
log('object detected, use cartId and prefill address from createCartId');
|
|
448
|
+
cartId = cartIdResult.cartId;
|
|
449
|
+
// set prefill address if provided in createCartId callback result
|
|
450
|
+
this.useShippingDataFromCreateCartId(cartIdResult.shippingData);
|
|
451
|
+
}
|
|
452
|
+
else {
|
|
453
|
+
cartId = cartIdResult;
|
|
454
|
+
}
|
|
445
455
|
window.Zonos.cartId = cartId;
|
|
446
456
|
const cartResult = await setupCartData(cartId);
|
|
447
457
|
const cartData = cartResult === null || cartResult === void 0 ? void 0 : cartResult.cartData;
|
|
@@ -703,6 +713,30 @@ const ZonosCheckout = class {
|
|
|
703
713
|
// apply theme to stripe elements
|
|
704
714
|
void this.applyStripeTheme();
|
|
705
715
|
}
|
|
716
|
+
useShippingDataFromCreateCartId(prefillAddress) {
|
|
717
|
+
// Do only if prefill address is provided
|
|
718
|
+
if (!prefillAddress) {
|
|
719
|
+
return;
|
|
720
|
+
}
|
|
721
|
+
log('shipping data from createCartId result', 'info', Object.entries(prefillAddress));
|
|
722
|
+
const { customerAddress1, customerAddress2, customerCity, customerCountry, customerEmail, customerName, customerPhone, customerState, customerZip, } = prefillAddress;
|
|
723
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
724
|
+
const country = // fallback to selected country code if country is not provided
|
|
725
|
+
customerCountry ||
|
|
726
|
+
getZCountryUrlParam(urlParams) ||
|
|
727
|
+
localizationStore.selectedCountryCode;
|
|
728
|
+
this.applyPrefillAddress({
|
|
729
|
+
customerAddress1,
|
|
730
|
+
customerAddress2,
|
|
731
|
+
customerCity,
|
|
732
|
+
customerCountry: country,
|
|
733
|
+
customerEmail,
|
|
734
|
+
customerName,
|
|
735
|
+
customerPhone,
|
|
736
|
+
customerState,
|
|
737
|
+
customerZip,
|
|
738
|
+
});
|
|
739
|
+
}
|
|
706
740
|
/**
|
|
707
741
|
* Set default address from query param if it's valid
|
|
708
742
|
*/
|
|
@@ -716,17 +750,39 @@ const ZonosCheckout = class {
|
|
|
716
750
|
}
|
|
717
751
|
return value;
|
|
718
752
|
};
|
|
719
|
-
const
|
|
753
|
+
const customerCountry =
|
|
720
754
|
// fallback to selected country code if country is not provided
|
|
721
755
|
getZCountryUrlParam(urlParams) || localizationStore.selectedCountryCode;
|
|
722
|
-
const
|
|
723
|
-
const
|
|
724
|
-
const
|
|
725
|
-
const
|
|
726
|
-
const
|
|
727
|
-
const
|
|
728
|
-
const
|
|
729
|
-
const
|
|
756
|
+
const customerCity = getParam('customerCity');
|
|
757
|
+
const customerEmail = getParam('customerEmail');
|
|
758
|
+
const customerAddress1 = getParam('customerAddress1');
|
|
759
|
+
const customerAddress2 = getParam('customerAddress2');
|
|
760
|
+
const customerName = getParam('customerName');
|
|
761
|
+
const customerPhone = getParam('customerPhone');
|
|
762
|
+
const customerZip = getParam('customerZip');
|
|
763
|
+
const customerState = getParam('customerState');
|
|
764
|
+
this.applyPrefillAddress({
|
|
765
|
+
customerAddress1,
|
|
766
|
+
customerAddress2,
|
|
767
|
+
customerCity,
|
|
768
|
+
customerCountry,
|
|
769
|
+
customerEmail,
|
|
770
|
+
customerName,
|
|
771
|
+
customerPhone,
|
|
772
|
+
customerState,
|
|
773
|
+
customerZip,
|
|
774
|
+
});
|
|
775
|
+
}
|
|
776
|
+
applyPrefillAddress({ customerAddress1, customerAddress2, customerCity, customerCountry, customerEmail, customerName, customerPhone, customerState, customerZip, }) {
|
|
777
|
+
const line1 = customerAddress1 || '';
|
|
778
|
+
const country = customerCountry || '';
|
|
779
|
+
const line2 = customerAddress2 || '';
|
|
780
|
+
const city = customerCity || '';
|
|
781
|
+
const email = customerEmail || '';
|
|
782
|
+
const name = customerName || '';
|
|
783
|
+
const phone = customerPhone || '';
|
|
784
|
+
const postal_code = customerZip || '';
|
|
785
|
+
const state = customerState || '';
|
|
730
786
|
/**
|
|
731
787
|
* If one of the value is null, no need to preset the default address.
|
|
732
788
|
* City and state are optional (they are not always provided for example Puerto Rico)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, H as Host } from './index-d82f06f2.js';
|
|
2
|
-
import { D as isValidSelector, f as stripeStore, E as initLocalizationStore, e as cartStore, a as localizationStoreUpdateSelectedCountryCode } from './cart-
|
|
2
|
+
import { D as isValidSelector, f as stripeStore, E as initLocalizationStore, e as cartStore, a as localizationStoreUpdateSelectedCountryCode } from './cart-a0b95207.js';
|
|
3
3
|
import { z as zonosStore, b as zonosStoreInitSetting, d as zonosStoreFontFamily } from './zonosStore-44efd080.js';
|
|
4
4
|
import { h as handleFetch, b as logError, l as log } from './handleFetch-b4633675.js';
|
|
5
5
|
import './isDarkColor-10f38df6.js';
|
|
@@ -254,7 +254,13 @@ const ZonosController = class {
|
|
|
254
254
|
const scripts = template.content.querySelectorAll('script');
|
|
255
255
|
scripts.forEach(script => {
|
|
256
256
|
const scriptToInject = document.createElement('script');
|
|
257
|
-
|
|
257
|
+
if (script.src) {
|
|
258
|
+
scriptToInject.src = script.src;
|
|
259
|
+
scriptToInject.async = script.async;
|
|
260
|
+
}
|
|
261
|
+
else {
|
|
262
|
+
scriptToInject.textContent = script.innerHTML;
|
|
263
|
+
}
|
|
258
264
|
document.body.appendChild(scriptToInject);
|
|
259
265
|
});
|
|
260
266
|
}
|
|
@@ -374,7 +380,7 @@ const ZonosController = class {
|
|
|
374
380
|
zonosStore.organizationName = organizationName;
|
|
375
381
|
}
|
|
376
382
|
render() {
|
|
377
|
-
return h(Host, { key: '
|
|
383
|
+
return h(Host, { key: '001f728dc41550b734fd1b5c9cf15f43c0c4cbdb', class: "zonos--elements" });
|
|
378
384
|
}
|
|
379
385
|
};
|
|
380
386
|
ZonosController.style = ZonosControllerStyle0;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as registerInstance, h, H as Host, d as getElement } from './index-d82f06f2.js';
|
|
2
|
-
import { l as localizationStore } from './cart-
|
|
2
|
+
import { l as localizationStore } from './cart-a0b95207.js';
|
|
3
3
|
import { d as zonosStoreFontFamily } from './zonosStore-44efd080.js';
|
|
4
4
|
import { c as classes } from './classes-0d95c529.js';
|
|
5
5
|
import './handleFetch-b4633675.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as registerInstance, h, H as Host, d as getElement } from './index-d82f06f2.js';
|
|
2
|
-
import { a as localizationStoreUpdateSelectedCountryCode, q as translate, l as localizationStore } from './cart-
|
|
2
|
+
import { a as localizationStoreUpdateSelectedCountryCode, q as translate, l as localizationStore } from './cart-a0b95207.js';
|
|
3
3
|
import { d as zonosStoreFontFamily } from './zonosStore-44efd080.js';
|
|
4
4
|
import { f as formatStringWithLinks } from './formatStringWithLinks-9e819405.js';
|
|
5
5
|
import { i as isDarkColor } from './isDarkColor-10f38df6.js';
|
|
@@ -2,9 +2,9 @@ import { r as registerInstance, h, H as Host, d as getElement, c as createEvent
|
|
|
2
2
|
import { d as zonosStoreFontFamily } from './zonosStore-44efd080.js';
|
|
3
3
|
import { c as classes } from './classes-0d95c529.js';
|
|
4
4
|
import { g as getBorderRadius } from './getBorderRadius-b32d4218.js';
|
|
5
|
-
import { f as stripeStore } from './cart-
|
|
5
|
+
import { f as stripeStore } from './cart-a0b95207.js';
|
|
6
6
|
import { b as logError, l as log } from './handleFetch-b4633675.js';
|
|
7
|
-
import { d as paypalStoreInitButtons } from './paypal-
|
|
7
|
+
import { d as paypalStoreInitButtons } from './paypal-f1005b82.js';
|
|
8
8
|
import './isDarkColor-10f38df6.js';
|
|
9
9
|
|
|
10
10
|
const PaymentEmptyStateDarkIcon = `<svg width="536" height="200" viewBox="0 0 536 200" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, F as Fragment, H as Host } from './index-d82f06f2.js';
|
|
2
|
-
import { q as translate, l as localizationStore, J as currencyFormat } from './cart-
|
|
2
|
+
import { q as translate, l as localizationStore, J as currencyFormat } from './cart-a0b95207.js';
|
|
3
3
|
import { z as zonosStore } from './zonosStore-44efd080.js';
|
|
4
4
|
import { c as classes } from './classes-0d95c529.js';
|
|
5
5
|
import { f as formatStringWithLinks } from './formatStringWithLinks-9e819405.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as registerInstance, h, H as Host } from './index-d82f06f2.js';
|
|
2
2
|
import { _ as _root, e as _baseGetTag, i as isObjectLike_1, f as isObject_1, z as zonosStore, g as getZonosStoreTheme, m as mergeConfig } from './zonosStore-44efd080.js';
|
|
3
|
-
import { l as localizationStore, D as isValidSelector, q as translate, r as getZCountryUrlParam, F as setZCountryUrlParam, G as currencyDisplay, H as currencyConvertAndFormat, I as currencyConvert, J as currencyFormat } from './cart-
|
|
3
|
+
import { l as localizationStore, D as isValidSelector, q as translate, r as getZCountryUrlParam, F as setZCountryUrlParam, G as currencyDisplay, H as currencyConvertAndFormat, I as currencyConvert, J as currencyFormat } from './cart-a0b95207.js';
|
|
4
4
|
import { c as classes } from './classes-0d95c529.js';
|
|
5
5
|
import { h as handleFetch, b as logError, l as log } from './handleFetch-b4633675.js';
|
|
6
6
|
import { g as getHasMoreSpaceOnRight } from './getHasMoreSpaceOnRight-70eb913a.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as registerInstance, h, H as Host } from './index-d82f06f2.js';
|
|
2
|
-
import { U as localizationStoreUpdateSelectedLocale, q as translate, l as localizationStore } from './cart-
|
|
2
|
+
import { U as localizationStoreUpdateSelectedLocale, q as translate, l as localizationStore } from './cart-a0b95207.js';
|
|
3
3
|
import { d as zonosStoreFontFamily } from './zonosStore-44efd080.js';
|
|
4
4
|
import { l as languages } from './ILanguage-cd6acb72.js';
|
|
5
5
|
import './handleFetch-b4633675.js';
|