@zonos/elements 1.3.40 → 1.3.41
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-775440b7.js → cart-497bb434.js} +63 -3
- package/dist/cjs/{getBorderRadius-9ae7890c.js → getBorderRadius-4413e191.js} +1 -1
- package/dist/cjs/{index-ef8b2c76.js → index-d56e0a8b.js} +9 -3
- package/dist/cjs/index.cjs.js +4 -4
- package/dist/cjs/{isDarkColor-5f56770b.js → isDarkColor-4eb96a1e.js} +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{paypal-25c84e33.js → paypal-e65a287a.js} +3 -3
- package/dist/cjs/{sendErrorLog-7818b288.js → sendErrorLog-c3c315a9.js} +2 -2
- package/dist/cjs/zonos-address_8.cjs.entry.js +10 -10
- package/dist/cjs/zonos-badge_2.cjs.entry.js +4 -4
- package/dist/cjs/zonos-banner.cjs.entry.js +2 -2
- package/dist/cjs/zonos-button_3.cjs.entry.js +4 -4
- package/dist/cjs/zonos-card.cjs.entry.js +3 -3
- package/dist/cjs/zonos-cart-items_12.cjs.entry.js +10 -10
- package/dist/cjs/zonos-checkout.cjs.entry.js +7 -7
- package/dist/cjs/zonos-component.cjs.entry.js +2 -2
- package/dist/cjs/zonos-controller.cjs.entry.js +6 -6
- package/dist/cjs/zonos-country-flag.cjs.entry.js +5 -5
- package/dist/cjs/{zonos-country-select_3.cjs.entry.js → zonos-country-select_4.cjs.entry.js} +100 -14
- package/dist/cjs/zonos-elements.cjs.js +2 -2
- package/dist/cjs/zonos-hello-dialog.cjs.entry.js +9 -9
- package/dist/cjs/zonos-hello.cjs.entry.js +5 -5
- package/dist/cjs/zonos-input.cjs.entry.js +7 -7
- package/dist/cjs/zonos-language-select_2.cjs.entry.js +9 -9
- package/dist/cjs/zonos-link.cjs.entry.js +2 -2
- package/dist/cjs/zonos-logo.cjs.entry.js +4 -4
- package/dist/cjs/zonos-notification_3.cjs.entry.js +8 -8
- package/dist/cjs/zonos-shipping-rich-radio.cjs.entry.js +3 -3
- package/dist/cjs/zonos-text.cjs.entry.js +2 -2
- package/dist/cjs/zonos-v-stack.cjs.entry.js +4 -4
- package/dist/cjs/{zonosStore-b6c72408.js → zonosStore-56401fdb.js} +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/common/zonos-country-select/zonos-country-select.css +8 -0
- package/dist/collection/components/common/zonos-country-select/zonos-country-select.js +14 -4
- package/dist/collection/components/common/zonos-custom-message/zonos-custom-message.js +2 -2
- package/dist/collection/components/common/zonos-dialog/zonos-dialog.js +3 -3
- package/dist/collection/components/common/zonos-input/zonos-input.js +4 -4
- package/dist/collection/components/common/zonos-language-select/zonos-language-select.js +2 -2
- package/dist/collection/components/common/zonos-link/zonos-link.js +1 -1
- package/dist/collection/components/common/zonos-logo/zonos-logo.js +2 -2
- package/dist/collection/components/common/zonos-rest-state/zonos-rest-state.js +3 -3
- package/dist/collection/components/common/zonos-select-dialog-header/zonos-select-dialog-header.js +2 -2
- package/dist/collection/components/common/zonos-tooltip/zonos-tooltip.js +2 -2
- package/dist/collection/components/common/zonos-v-stack/zonos-v-stack.js +2 -2
- package/dist/collection/components/common/zonos-virtual-scroll/zonos-virtual-scroll.css +46 -0
- package/dist/collection/components/common/zonos-virtual-scroll/zonos-virtual-scroll.js +177 -0
- package/dist/collection/components/component-template/zonos-component/zonos-component.js +1 -1
- package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog-footer/zonos-hello-dialog-footer.js +2 -2
- package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog.js +4 -4
- package/dist/collection/components/main/zonos-controller.js +1 -1
- package/dist/collection/components/paypal/zonos-paypal-payment.js +1 -1
- 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/components/stripe/zonos-address/zonos-address.js +1 -1
- package/dist/collection/components/stripe/zonos-link-authentication/zonos-link-authentication.js +1 -1
- package/dist/collection/components/stripe/zonos-payment/zonos-payment.js +1 -1
- package/dist/esm/{cart-e9cd8286.js → cart-f53c9f90.js} +63 -3
- package/dist/esm/{getBorderRadius-3c75c4c1.js → getBorderRadius-3ba98361.js} +1 -1
- package/dist/esm/{index-5a37ccde.js → index-86b8247e.js} +9 -3
- package/dist/esm/index.js +4 -4
- package/dist/esm/{isDarkColor-3eb31a6d.js → isDarkColor-3119e351.js} +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{paypal-da2b3db1.js → paypal-72296ae6.js} +3 -3
- package/dist/esm/{sendErrorLog-2fcf78a2.js → sendErrorLog-f8d3ec4b.js} +2 -2
- package/dist/esm/zonos-address_8.entry.js +10 -10
- package/dist/esm/zonos-badge_2.entry.js +4 -4
- package/dist/esm/zonos-banner.entry.js +2 -2
- package/dist/esm/zonos-button_3.entry.js +4 -4
- package/dist/esm/zonos-card.entry.js +3 -3
- package/dist/esm/zonos-cart-items_12.entry.js +10 -10
- package/dist/esm/zonos-checkout.entry.js +7 -7
- package/dist/esm/zonos-component.entry.js +2 -2
- package/dist/esm/zonos-controller.entry.js +6 -6
- package/dist/esm/zonos-country-flag.entry.js +5 -5
- package/dist/esm/{zonos-country-select_3.entry.js → zonos-country-select_4.entry.js} +100 -15
- package/dist/esm/zonos-elements.js +3 -3
- package/dist/esm/zonos-hello-dialog.entry.js +9 -9
- package/dist/esm/zonos-hello.entry.js +5 -5
- package/dist/esm/zonos-input.entry.js +7 -7
- package/dist/esm/zonos-language-select_2.entry.js +9 -9
- package/dist/esm/zonos-link.entry.js +2 -2
- package/dist/esm/zonos-logo.entry.js +4 -4
- package/dist/esm/zonos-notification_3.entry.js +8 -8
- package/dist/esm/zonos-shipping-rich-radio.entry.js +3 -3
- package/dist/esm/zonos-text.entry.js +2 -2
- package/dist/esm/zonos-v-stack.entry.js +4 -4
- package/dist/esm/{zonosStore-425abc1b.js → zonosStore-8fc9ceb2.js} +1 -1
- package/dist/esm-es5/cart-f53c9f90.js +1 -0
- package/dist/esm-es5/{getBorderRadius-3c75c4c1.js → getBorderRadius-3ba98361.js} +1 -1
- package/dist/esm-es5/{index-5a37ccde.js → index-86b8247e.js} +2 -2
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/{isDarkColor-3eb31a6d.js → isDarkColor-3119e351.js} +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/{paypal-da2b3db1.js → paypal-72296ae6.js} +1 -1
- package/dist/esm-es5/{sendErrorLog-2fcf78a2.js → sendErrorLog-f8d3ec4b.js} +1 -1
- package/dist/esm-es5/zonos-address_8.entry.js +1 -1
- package/dist/esm-es5/zonos-badge_2.entry.js +1 -1
- package/dist/esm-es5/zonos-banner.entry.js +1 -1
- package/dist/esm-es5/zonos-button_3.entry.js +1 -1
- package/dist/esm-es5/zonos-card.entry.js +1 -1
- package/dist/esm-es5/zonos-cart-items_12.entry.js +1 -1
- package/dist/esm-es5/zonos-checkout.entry.js +1 -1
- package/dist/esm-es5/zonos-component.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 -0
- 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-input.entry.js +1 -1
- package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
- package/dist/esm-es5/zonos-link.entry.js +1 -1
- package/dist/esm-es5/zonos-logo.entry.js +1 -1
- package/dist/esm-es5/zonos-notification_3.entry.js +1 -1
- package/dist/esm-es5/zonos-shipping-rich-radio.entry.js +1 -1
- package/dist/esm-es5/zonos-text.entry.js +1 -1
- package/dist/esm-es5/zonos-v-stack.entry.js +1 -1
- package/dist/esm-es5/{zonosStore-425abc1b.js → zonosStore-8fc9ceb2.js} +1 -1
- package/dist/scripts/index.d.ts +79 -0
- 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/common/zonos-virtual-scroll/zonos-virtual-scroll.d.ts +32 -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.d.ts +79 -0
- package/dist/zonos-elements/assets/RemoveIcon.svg +1 -1
- package/dist/zonos-elements/index.esm.js +1 -1
- package/dist/zonos-elements/{p-5f68f356.system.entry.js → p-0229282c.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-92bebe7a.js → p-04054425.js} +1 -1
- package/dist/zonos-elements/{p-f98f7066.js → p-05cdd3b4.js} +1 -1
- package/dist/zonos-elements/p-0f9804e3.entry.js +1 -0
- package/dist/zonos-elements/{p-d6135575.js → p-12266c9e.js} +1 -1
- package/dist/zonos-elements/{p-2c03ac78.system.entry.js → p-14067782.system.entry.js} +1 -1
- package/dist/zonos-elements/p-1a89c54a.js +1 -0
- package/dist/zonos-elements/{p-1daa3b1e.system.entry.js → p-1e4f7997.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-c87113fb.system.entry.js → p-1ee2fa70.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-efdc7748.entry.js → p-25633055.entry.js} +1 -1
- package/dist/zonos-elements/{p-b2007124.system.js → p-40c21634.system.js} +1 -1
- package/dist/zonos-elements/p-4db5be24.system.entry.js +1 -0
- package/dist/zonos-elements/{p-e6efc2e1.system.entry.js → p-4f454a91.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-da15b587.system.entry.js → p-52947dab.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-8d149b99.entry.js → p-52fa9aab.entry.js} +1 -1
- package/dist/zonos-elements/{p-3da1bc42.js → p-52fb6876.js} +1 -1
- package/dist/zonos-elements/{p-d95cb86a.system.js → p-539974db.system.js} +1 -1
- package/dist/zonos-elements/{p-15ecad81.entry.js → p-5922c099.entry.js} +1 -1
- package/dist/zonos-elements/p-5b7da777.js +2 -0
- package/dist/zonos-elements/{p-ca58f16e.system.entry.js → p-5fe10991.system.entry.js} +1 -1
- package/dist/zonos-elements/p-678f1888.entry.js +1 -0
- package/dist/zonos-elements/{p-c5a5512a.system.entry.js → p-67f22fbf.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-890f5788.js → p-6ac72711.js} +1 -1
- package/dist/zonos-elements/{p-01bd2187.system.entry.js → p-6bb0b7d2.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-e252d86f.entry.js → p-6de1c78a.entry.js} +1 -1
- package/dist/zonos-elements/{p-d9d5ee2f.entry.js → p-6de38759.entry.js} +1 -1
- package/dist/zonos-elements/{p-445fb353.system.entry.js → p-6fbb4565.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-d46fa40a.entry.js → p-706d2bad.entry.js} +1 -1
- package/dist/zonos-elements/{p-61842b4f.system.entry.js → p-717028a2.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-dc6a17fe.system.entry.js → p-7833fa53.system.entry.js} +1 -1
- package/dist/zonos-elements/p-79fd4f3c.system.js +1 -0
- package/dist/zonos-elements/{p-1b499bcc.system.js → p-8809964a.system.js} +1 -1
- package/dist/zonos-elements/{p-54101ed6.entry.js → p-8b01aafb.entry.js} +1 -1
- package/dist/zonos-elements/{p-f643035f.entry.js → p-9220f63d.entry.js} +1 -1
- package/dist/zonos-elements/{p-3496183d.entry.js → p-9420f9db.entry.js} +1 -1
- package/dist/zonos-elements/p-9525cc44.system.js +1 -0
- package/dist/zonos-elements/{p-5e55dcbc.entry.js → p-9a319774.entry.js} +1 -1
- package/dist/zonos-elements/{p-657be9e9.entry.js → p-9d1f13c2.entry.js} +1 -1
- package/dist/zonos-elements/{p-5a5d1a12.system.entry.js → p-9eadd9a7.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-70b024ad.system.entry.js → p-a3e2592b.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-14b53e8f.system.entry.js → p-ab11cca6.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-3447ef24.system.js → p-b3e825dc.system.js} +1 -1
- package/dist/zonos-elements/{p-fa02dd07.system.entry.js → p-b689309d.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-3996d025.system.js → p-c460665d.system.js} +1 -1
- package/dist/zonos-elements/{p-6897be29.entry.js → p-c4617501.entry.js} +1 -1
- package/dist/zonos-elements/{p-97dadd90.system.entry.js → p-c4bb2949.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-fa95c3dc.entry.js → p-c7301a88.entry.js} +1 -1
- package/dist/zonos-elements/p-c78dd680.system.js +1 -0
- package/dist/zonos-elements/{p-3b6a7200.entry.js → p-d86c89e3.entry.js} +1 -1
- package/dist/zonos-elements/{p-7f96d3b4.entry.js → p-dc368ad5.entry.js} +1 -1
- package/dist/zonos-elements/{p-bfa5ec2b.entry.js → p-de53d9c3.entry.js} +1 -1
- package/dist/zonos-elements/{p-c55a5fe4.system.entry.js → p-df69fa38.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-71037fe5.entry.js → p-e07bf9ea.entry.js} +1 -1
- package/dist/zonos-elements/{p-2bfb5e4b.system.entry.js → p-e8f7fb29.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-36df9785.entry.js → p-f35ee203.entry.js} +1 -1
- package/dist/zonos-elements/{p-b55b557a.system.js → p-fd061229.system.js} +2 -2
- package/dist/zonos-elements/{p-3d98f422.system.entry.js → p-fd54fbb9.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-916adba7.entry.js → p-fdb4347f.entry.js} +1 -1
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/dist/zonos-elements/zonos-elements.js +1 -1
- package/package.json +1 -1
- package/dist/esm-es5/cart-e9cd8286.js +0 -1
- package/dist/esm-es5/zonos-country-select_3.entry.js +0 -1
- package/dist/zonos-elements/p-1debb7b2.entry.js +0 -1
- package/dist/zonos-elements/p-54971a77.system.js +0 -1
- package/dist/zonos-elements/p-6f39051c.system.entry.js +0 -1
- package/dist/zonos-elements/p-7dd54a63.entry.js +0 -1
- package/dist/zonos-elements/p-800db524.system.js +0 -1
- package/dist/zonos-elements/p-94279862.system.js +0 -1
- package/dist/zonos-elements/p-dd61b7a0.js +0 -2
- package/dist/zonos-elements/p-fb63bd03.js +0 -1
package/dist/scripts/index.d.ts
CHANGED
|
@@ -2084,6 +2084,36 @@ declare namespace Components {
|
|
|
2084
2084
|
*/
|
|
2085
2085
|
"spacing": GridSpacing;
|
|
2086
2086
|
}
|
|
2087
|
+
/**
|
|
2088
|
+
* The idea is from
|
|
2089
|
+
* @ref https://github.com/beenotung/stencil-virtual-scroll/blob/master/src/components/virtual-scroll-list/virtual-scroll-list.scss
|
|
2090
|
+
* @ref https://github.dev/ionic-team/ionic-framework/blob/v6.7.5/core/src/components/virtual-scroll/virtual-scroll.tsx
|
|
2091
|
+
*/
|
|
2092
|
+
interface ZonosVirtualScroll {
|
|
2093
|
+
/**
|
|
2094
|
+
* Height that is used as a fallback if height is not provided
|
|
2095
|
+
*/
|
|
2096
|
+
"fallbackItemHeight": number;
|
|
2097
|
+
/**
|
|
2098
|
+
* Heights list of each item
|
|
2099
|
+
*/
|
|
2100
|
+
"itemHeights": number[];
|
|
2101
|
+
/**
|
|
2102
|
+
* Width of each item
|
|
2103
|
+
*/
|
|
2104
|
+
"itemWidth"?: number;
|
|
2105
|
+
/**
|
|
2106
|
+
* Render item
|
|
2107
|
+
*/
|
|
2108
|
+
"renderItem": (
|
|
2109
|
+
itemIndex: number,
|
|
2110
|
+
) =>
|
|
2111
|
+
| HTMLElement
|
|
2112
|
+
| Promise<HTMLElement>
|
|
2113
|
+
| HTMLElement[]
|
|
2114
|
+
| Promise<HTMLElement[]>
|
|
2115
|
+
| Promise<HTMLElement>[];
|
|
2116
|
+
}
|
|
2087
2117
|
}
|
|
2088
2118
|
interface ZonosAddressCustomEvent<T> extends CustomEvent<T> {
|
|
2089
2119
|
detail: T;
|
|
@@ -2599,6 +2629,17 @@ declare global {
|
|
|
2599
2629
|
prototype: HTMLZonosVStackElement;
|
|
2600
2630
|
new (): HTMLZonosVStackElement;
|
|
2601
2631
|
};
|
|
2632
|
+
/**
|
|
2633
|
+
* The idea is from
|
|
2634
|
+
* @ref https://github.com/beenotung/stencil-virtual-scroll/blob/master/src/components/virtual-scroll-list/virtual-scroll-list.scss
|
|
2635
|
+
* @ref https://github.dev/ionic-team/ionic-framework/blob/v6.7.5/core/src/components/virtual-scroll/virtual-scroll.tsx
|
|
2636
|
+
*/
|
|
2637
|
+
interface HTMLZonosVirtualScrollElement extends Components.ZonosVirtualScroll, HTMLStencilElement {
|
|
2638
|
+
}
|
|
2639
|
+
var HTMLZonosVirtualScrollElement: {
|
|
2640
|
+
prototype: HTMLZonosVirtualScrollElement;
|
|
2641
|
+
new (): HTMLZonosVirtualScrollElement;
|
|
2642
|
+
};
|
|
2602
2643
|
interface HTMLElementTagNameMap {
|
|
2603
2644
|
"zonos-address": HTMLZonosAddressElement;
|
|
2604
2645
|
"zonos-address-display": HTMLZonosAddressDisplayElement;
|
|
@@ -2647,6 +2688,7 @@ declare global {
|
|
|
2647
2688
|
"zonos-text": HTMLZonosTextElement;
|
|
2648
2689
|
"zonos-tooltip": HTMLZonosTooltipElement;
|
|
2649
2690
|
"zonos-v-stack": HTMLZonosVStackElement;
|
|
2691
|
+
"zonos-virtual-scroll": HTMLZonosVirtualScrollElement;
|
|
2650
2692
|
}
|
|
2651
2693
|
}
|
|
2652
2694
|
declare namespace LocalJSX {
|
|
@@ -3563,6 +3605,36 @@ declare namespace LocalJSX {
|
|
|
3563
3605
|
*/
|
|
3564
3606
|
"spacing"?: GridSpacing;
|
|
3565
3607
|
}
|
|
3608
|
+
/**
|
|
3609
|
+
* The idea is from
|
|
3610
|
+
* @ref https://github.com/beenotung/stencil-virtual-scroll/blob/master/src/components/virtual-scroll-list/virtual-scroll-list.scss
|
|
3611
|
+
* @ref https://github.dev/ionic-team/ionic-framework/blob/v6.7.5/core/src/components/virtual-scroll/virtual-scroll.tsx
|
|
3612
|
+
*/
|
|
3613
|
+
interface ZonosVirtualScroll {
|
|
3614
|
+
/**
|
|
3615
|
+
* Height that is used as a fallback if height is not provided
|
|
3616
|
+
*/
|
|
3617
|
+
"fallbackItemHeight": number;
|
|
3618
|
+
/**
|
|
3619
|
+
* Heights list of each item
|
|
3620
|
+
*/
|
|
3621
|
+
"itemHeights": number[];
|
|
3622
|
+
/**
|
|
3623
|
+
* Width of each item
|
|
3624
|
+
*/
|
|
3625
|
+
"itemWidth"?: number;
|
|
3626
|
+
/**
|
|
3627
|
+
* Render item
|
|
3628
|
+
*/
|
|
3629
|
+
"renderItem": (
|
|
3630
|
+
itemIndex: number,
|
|
3631
|
+
) =>
|
|
3632
|
+
| HTMLElement
|
|
3633
|
+
| Promise<HTMLElement>
|
|
3634
|
+
| HTMLElement[]
|
|
3635
|
+
| Promise<HTMLElement[]>
|
|
3636
|
+
| Promise<HTMLElement>[];
|
|
3637
|
+
}
|
|
3566
3638
|
interface IntrinsicElements {
|
|
3567
3639
|
"zonos-address": ZonosAddress;
|
|
3568
3640
|
"zonos-address-display": ZonosAddressDisplay;
|
|
@@ -3611,6 +3683,7 @@ declare namespace LocalJSX {
|
|
|
3611
3683
|
"zonos-text": ZonosText;
|
|
3612
3684
|
"zonos-tooltip": ZonosTooltip;
|
|
3613
3685
|
"zonos-v-stack": ZonosVStack;
|
|
3686
|
+
"zonos-virtual-scroll": ZonosVirtualScroll;
|
|
3614
3687
|
}
|
|
3615
3688
|
}
|
|
3616
3689
|
|
|
@@ -3664,6 +3737,12 @@ declare module "@stencil/core" {
|
|
|
3664
3737
|
"zonos-text": LocalJSX.ZonosText & JSXBase.HTMLAttributes<HTMLZonosTextElement>;
|
|
3665
3738
|
"zonos-tooltip": LocalJSX.ZonosTooltip & JSXBase.HTMLAttributes<HTMLZonosTooltipElement>;
|
|
3666
3739
|
"zonos-v-stack": LocalJSX.ZonosVStack & JSXBase.HTMLAttributes<HTMLZonosVStackElement>;
|
|
3740
|
+
/**
|
|
3741
|
+
* The idea is from
|
|
3742
|
+
* @ref https://github.com/beenotung/stencil-virtual-scroll/blob/master/src/components/virtual-scroll-list/virtual-scroll-list.scss
|
|
3743
|
+
* @ref https://github.dev/ionic-team/ionic-framework/blob/v6.7.5/core/src/components/virtual-scroll/virtual-scroll.tsx
|
|
3744
|
+
*/
|
|
3745
|
+
"zonos-virtual-scroll": LocalJSX.ZonosVirtualScroll & JSXBase.HTMLAttributes<HTMLZonosVirtualScrollElement>;
|
|
3667
3746
|
}
|
|
3668
3747
|
}
|
|
3669
3748
|
}
|
package/dist/scripts/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";const e=(e,t,...n)=>{var o,r;if(!(!!(null===(o=window.Zonos)||void 0===o?void 0:o.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===t&&console.error(e,...n));let s=document.querySelector("iframe#zonos---debug-logging-iframe");s||(s=document.createElement("iframe"),s.id="zonos---debug-logging-iframe",s.style.display="none",s.style.opacity="0",s.style.position="absolute",s.style.top="-9999px",s.style.left="-9999px",s.style.width="1px",s.style.height="1px",s.style.border="none",s.style.overflow="hidden",s.style.visibility="hidden",document.body.appendChild(s));const i=(null===(r=s.contentWindow)||void 0===r?void 0:r.window.console)||window.console;switch(t){case"warn":i.warn(e,...n);break;case"info":i.info(e,...n);break;case"error":i.error(e,...n);break;default:i.groupCollapsed(e,...n),i.trace(),i.groupEnd()}},t=(t,...n)=>{e(t,"error",...n)},n=["jsdelivr","unpkg","vercel"],o=e=>{const t=n.indexOf(e);return n[t+1]||null},r=()=>{if("undefined"==typeof window)return null;const t=(e=>{if(!e)return null;const t=new URL(e).searchParams.get("zonosQaUrl");return t?/[^a-zA-Z0-9-_]+/.test(t)?null:t:null})(window.location.href);if(!t&&"dev.demo.elements.zonos.com"===window.location.hostname)return"https://dev.elements.zonos.com";if(!t)return null;if("dev-elements"===t)return"https://dev.elements.zonos.com";const n=`https://${t}.preview.js.zonos.com`;return e(`[ZONOS-WARNING] using '${n}' for loading script`,"warn"),fetch(n).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${n}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:t}=window.location,o=`${t}?${e.toString()}`;return window.history.replaceState(window.history.state,"",o),window.location.reload(),null})),n},s="https://js.stripe.com/v3",i=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,l="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let c=null;const d=e=>(null!==c||(c=new Promise(((n,o)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(l),window.Stripe)n(window.Stripe);else try{let r=(()=>{const e=document.querySelectorAll(`script[src^="${s}"]`);for(let t=0;t<e.length;t++){const n=e[t];if(n&&i.test(n.src))return n}return null})();r&&e?console.warn(l):r||(r=(e=>{const n=document.createElement("script");n.src=`${s}`;const o=document.head||document.body;return o?(o.appendChild(n),n):(t("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==r||r.addEventListener("load",(()=>{window.Stripe?n(window.Stripe):o(new Error("Stripe.js not available"))})),null==r||r.addEventListener("error",(()=>{o(new Error("Failed to load Stripe.js"))}))}catch(e){return void o(e)}else n(null)}))),c),a=Promise.resolve().then((()=>d(null)));let u=!1;a.catch((e=>{u||console.warn(e)}));var p;const m=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:t,isWhiteListed:n}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const t=new URL(e).origin,n=["dev.elements.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>t.includes(e))),o=["qa.js.zonos.com"].some((e=>t.includes(e)));return{currentLoadScriptUrl:t,isForceLoadVersionDomain:o,isWhiteListed:n}})({loadScriptSrc:null==e?void 0:e.src});return n?t:null})(),h="https://v1.3.
|
|
1
|
+
(function(){"use strict";const e=(e,t,...n)=>{var o,r;if(!(!!(null===(o=window.Zonos)||void 0===o?void 0:o.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===t&&console.error(e,...n));let s=document.querySelector("iframe#zonos---debug-logging-iframe");s||(s=document.createElement("iframe"),s.id="zonos---debug-logging-iframe",s.style.display="none",s.style.opacity="0",s.style.position="absolute",s.style.top="-9999px",s.style.left="-9999px",s.style.width="1px",s.style.height="1px",s.style.border="none",s.style.overflow="hidden",s.style.visibility="hidden",document.body.appendChild(s));const i=(null===(r=s.contentWindow)||void 0===r?void 0:r.window.console)||window.console;switch(t){case"warn":i.warn(e,...n);break;case"info":i.info(e,...n);break;case"error":i.error(e,...n);break;default:i.groupCollapsed(e,...n),i.trace(),i.groupEnd()}},t=(t,...n)=>{e(t,"error",...n)},n=["jsdelivr","unpkg","vercel"],o=e=>{const t=n.indexOf(e);return n[t+1]||null},r=()=>{if("undefined"==typeof window)return null;const t=(e=>{if(!e)return null;const t=new URL(e).searchParams.get("zonosQaUrl");return t?/[^a-zA-Z0-9-_]+/.test(t)?null:t:null})(window.location.href);if(!t&&"dev.demo.elements.zonos.com"===window.location.hostname)return"https://dev.elements.zonos.com";if(!t)return null;if("dev-elements"===t)return"https://dev.elements.zonos.com";const n=`https://${t}.preview.js.zonos.com`;return e(`[ZONOS-WARNING] using '${n}' for loading script`,"warn"),fetch(n).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${n}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:t}=window.location,o=`${t}?${e.toString()}`;return window.history.replaceState(window.history.state,"",o),window.location.reload(),null})),n},s="https://js.stripe.com/v3",i=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,l="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let c=null;const d=e=>(null!==c||(c=new Promise(((n,o)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(l),window.Stripe)n(window.Stripe);else try{let r=(()=>{const e=document.querySelectorAll(`script[src^="${s}"]`);for(let t=0;t<e.length;t++){const n=e[t];if(n&&i.test(n.src))return n}return null})();r&&e?console.warn(l):r||(r=(e=>{const n=document.createElement("script");n.src=`${s}`;const o=document.head||document.body;return o?(o.appendChild(n),n):(t("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==r||r.addEventListener("load",(()=>{window.Stripe?n(window.Stripe):o(new Error("Stripe.js not available"))})),null==r||r.addEventListener("error",(()=>{o(new Error("Failed to load Stripe.js"))}))}catch(e){return void o(e)}else n(null)}))),c),a=Promise.resolve().then((()=>d(null)));let u=!1;a.catch((e=>{u||console.warn(e)}));var p;const m=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:t,isWhiteListed:n}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const t=new URL(e).origin,n=["dev.elements.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>t.includes(e))),o=["qa.js.zonos.com"].some((e=>t.includes(e)));return{currentLoadScriptUrl:t,isForceLoadVersionDomain:o,isWhiteListed:n}})({loadScriptSrc:null==e?void 0:e.src});return n?t:null})(),h="https://v1.3.41.js.zonos.com",y=m||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.41",w="jsdelivr",f="https://rsms.me",v="https://fonts.googleapis.com",g=/^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;class S{}p=S,S.doneInit=!1,S.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),S.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),S._paypalMockResponse=null,S.isBigCommerce=!1,S.isNpm=!0,S.zonosQaUrl=null,S.version="v1.3.41",S.modeAlerted=!1,S.tempCartData=null,S.paypal=null,S.getCurrentTimestamp=()=>(new Date).getTime(),S.zonosController=null,S.init=async({appearance:n,checkoutSettings:o,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:l,storeId:c,zonosApiKey:d})=>{p.doneInit||(e(`====== ZONOS DEBUG MODE: on (${p.version}) ======`),d?(p.zonosApiKey=d,p.storeId=c,e("init zonos"),p.injectZonosCdn(),p.injectZonosCss(),p.injectFonts(),p.injectController({config:{appearance:n,checkoutSettings:o,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:l},zonosApiKey:d}),p.doneInit=!0):t("Missing Zonos API key"))},S.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},S.openHelloDialog=e=>{const t=document.querySelector("zonos-hello");t&&t.openHelloDialog(null==e||e)},S.showNotification=e=>{var t;null===(t=p.zonosController)||void 0===t||t.showNotification(e)},S.updateOrganizationName=e=>{var t;null===(t=p.zonosController)||void 0===t||t.updateOrganizationName(e)},S.disablePlaceOrderButtons=({autoEnable:e=!0,config:t,disable:n,placeOrderButtonSelector:o})=>{var r;if(!(null===(r=t.checkoutSettings)||void 0===r?void 0:r.disablePlaceOrderButtonActivation)&&o){const t=document.querySelectorAll(o),r=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};t.forEach((e=>{e.getAttribute("data-zonos-checkout-attached")||(n?(e.setAttribute("disabled","true"),e.addEventListener("click",r)):(e.removeAttribute("disabled"),e.removeEventListener("click",r)))})),e&&n&&setTimeout((()=>{t.forEach((e=>{e.removeAttribute("disabled"),e.removeEventListener("click",r)}))}),5e3)}},S.injectController=({config:n,zonosApiKey:o})=>{var r;if(document.querySelector("zonos-controller"))return;if(null===(r=n.checkoutSettings)||void 0===r?void 0:r.placeOrderButtonSelector){const e=n.checkoutSettings.placeOrderButtonSelector;p.disablePlaceOrderButtons({config:n,disable:!0,placeOrderButtonSelector:e});new MutationObserver((()=>{p.disablePlaceOrderButtons({config:n,disable:!0,placeOrderButtonSelector:e})})).observe(document.body,{childList:!0,subtree:!0})}const s=document.createElement("zonos-controller");s.config=n,s.zonosApiKey=o,s.addEventListener("stripeInitEvent",(async n=>{const{detail:o}=n;e("loading Stripe");const r=await(async(...e)=>{u=!0;const t=Date.now();return a.then((n=>((e,t,n)=>{if(null===e)return null;const o=e.apply(void 0,t);return((e,t)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:t})})(o,n),o})(n,e,t)))})(o.publishableKey);r?(window.Zonos.stripe=r,s.initCheckoutElement(r)):t("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(s),p.zonosController=s,e("Zonos controller injected!")},S.injectScript=({cdnType:n,isModule:r,theRestUrl:s})=>{const i=`${p.getZonosUrl(n)}/${s}`;if(document.querySelector(`script[src="${i}"]`))return void e(`Zonos script "${i}" already exists in the document`,"warn");const l=document.head||document.body,c=document.createElement("script");r?c.type="module":c.noModule=!0,c.src=i,c.crossOrigin="anonymous",c.onerror=()=>{t(`Failed to load ${c.src}`);const e=o(n);e&&p.injectScript({cdnType:e,isModule:r,theRestUrl:s})},l.appendChild(c)},S.getZonosUrl=e=>{const t=()=>{switch(e){case"jsdelivr":return y;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.41";default:return h}};if(p.isNpm){return r()||t()}return t()},S.injectZonosCdn=()=>{p.injectScript({cdnType:w,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),p.injectScript({cdnType:w,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),e("Zonos cdn script injected!")},S.injectStylesheet=({cdnType:e,theRestUrl:n})=>{const r=p.getZonosUrl(e),s=document.head||document.body,i=document.createElement("link");i.rel="preconnect",i.href=`${h}/`,s.appendChild(i);const l=document.createElement("link");l.rel="stylesheet",l.href=`${r}/${n}`,l.onerror=()=>{t(`Failed to load ${l.href}`);const r=o(e);r&&p.injectStylesheet({cdnType:r,theRestUrl:n})},s.appendChild(l)},S.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?e("Zonos style links already injected","warn"):(p.injectStylesheet({cdnType:w,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),e("Zonos style css injected!"))},S.injectFonts=()=>{if((()=>{const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${f}"]`);for(let t=0;t<e.length;t++){const n=e[t];if(n&&!g.test(n.href))return n}return null})())return void e("Inter font already injected","warn");const t=document.head||document.body,n=document.createElement("link");n.rel="preconnect",n.href=f,t.appendChild(n);const o=document.createElement("link");o.rel="stylesheet",o.href=`${f}/inter/inter.css`,t.appendChild(o),e("Zonos font injected!")},S.setupGoogleFont=e=>{var t;null===(t=p.zonosController)||void 0===t||t.setupGoogleFont(e)},S.injectSupportGoogleFont=t=>{var n;e(`[FONT] injecting ${t}`);const o=null===(n=t.match(/family=(.*?):/))||void 0===n?void 0:n[1],r=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${v}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=v,r.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${t}"]`))return void e(`[FONT] ${o} font already injected`,"warn");const s=document.createElement("link");s.rel="stylesheet",s.href=t,r.appendChild(s),e(`[FONT] ${o} font injected!`)},exports.Zonos=S})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";"function"==typeof SuppressedError&&SuppressedError;const e=async({response:e,shouldLog:o=!0,shouldThrow:t=!1})=>{try{return await e.json()}catch(e){if(t)throw e;return o&&console.error(e),null}};const o=async(o,t)=>{const n=(function(e,o){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&o.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)o.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(t[n[r]]=e[n[r]])}return t})(t||{},[]),r=n.body?JSON.stringify(n.body):void 0,s=n.method||"GET",i=new URL(o);i.searchParams.set("zToken",(function(e){try{return btoa(e).replace(/=/g,"")}catch(o){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(window.location.hostname));const a=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},n.headers),l=Object.assign(Object.assign({},n),{body:"GET"===s?void 0:r,headers:a,method:s});return(async(o,t)=>{let n;try{n=await fetch(o,t)}catch(e){return e instanceof Error?{errors:[{message:e.message,type:"unknown"}],json:null,response:null,zonosMode:null}:{errors:[{message:"Fail to fetch",type:"unknown"}],json:null,response:null,zonosMode:null}}const r=n.headers.get("Zonos-Mode"),s=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&r&&s&&("production"===r&&alert("Please be aware that you are currently operating in the production environment. Any interactions with the customer store, including payments, will be processed as real transactions!"),"test"===r&&alert("For testing payments, you can utilize the test payment information provided at this link: https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=elements#web-test-the-integration"),window.Zonos.modeAlerted=!0),n.ok)return{errors:[],json:await e({response:n}),response:n,zonosMode:r};const i=n.status.toString();try{const o=await e({response:n,shouldThrow:!0});return{errors:[{message:JSON.stringify(o),type:i}],json:null,response:n,zonosMode:r}}catch(e){return{errors:[{message:`${i}: Unknown error`,type:i}],json:null,response:null,zonosMode:r}}})(i.toString(),l)},t=(e,o,...t)=>{var n,r;if(!(!!(null===(n=window.Zonos)||void 0===n?void 0:n.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===o&&console.error(e,...t));let s=document.querySelector("iframe#zonos---debug-logging-iframe");s||(s=document.createElement("iframe"),s.id="zonos---debug-logging-iframe",s.style.display="none",s.style.opacity="0",s.style.position="absolute",s.style.top="-9999px",s.style.left="-9999px",s.style.width="1px",s.style.height="1px",s.style.border="none",s.style.overflow="hidden",s.style.visibility="hidden",document.body.appendChild(s));const i=(null===(r=s.contentWindow)||void 0===r?void 0:r.window.console)||window.console;switch(o){case"warn":i.warn(e,...t);break;case"info":i.info(e,...t);break;case"error":i.error(e,...t);break;default:i.groupCollapsed(e,...t),i.trace(),i.groupEnd()}},n=(e,...o)=>{t(e,"error",...o)},r=async({endpoint:e,errors:t,metadata:n})=>{const r="userAgentData"in window.navigator?window.navigator.userAgentData:null,s={endpoint:e,errors:t,metadata:Object.assign({href:window.location.href,userAgent:r&&r.brands.length>0?r:window.navigator.userAgent},n)};o("https://v1.route.js.zonos.com/api/zonos-elements/log-error",{body:s,method:"POST"})},s=({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const o=new URL(e).origin,t=["dev.elements.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>o.includes(e))),n=["qa.js.zonos.com"].some((e=>o.includes(e)));return{currentLoadScriptUrl:o,isForceLoadVersionDomain:n,isWhiteListed:t}},i=["jsdelivr","unpkg","vercel"],a=e=>{const o=i.indexOf(e);return i[o+1]||null},l=()=>{if("undefined"==typeof window)return null;const e=(e=>{if(!e)return null;const o=new URL(e).searchParams.get("zonosQaUrl");return o?/[^a-zA-Z0-9-_]+/.test(o)?null:o:null})(window.location.href);if(!e&&"dev.demo.elements.zonos.com"===window.location.hostname)return"https://dev.elements.zonos.com";if(!e)return null;if("dev-elements"===e)return"https://dev.elements.zonos.com";const o=`https://${e}.preview.js.zonos.com`;return t(`[ZONOS-WARNING] using '${o}' for loading script`,"warn"),fetch(o).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${o}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:t}=window.location,n=`${t}?${e.toString()}`;return window.history.replaceState(window.history.state,"",n),window.location.reload(),null})),o},c="https://js.stripe.com/v3",d=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,p="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let u=null;const m=e=>(null!==u||(u=new Promise(((o,t)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(p),window.Stripe)o(window.Stripe);else try{let r=(()=>{const e=document.querySelectorAll(`script[src^="${c}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&d.test(t.src))return t}return null})();r&&e?console.warn(p):r||(r=(e=>{const o=document.createElement("script");o.src=`${c}`;const t=document.head||document.body;return t?(t.appendChild(o),o):(n("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==r||r.addEventListener("load",(()=>{window.Stripe?o(window.Stripe):t(new Error("Stripe.js not available"))})),null==r||r.addEventListener("error",(()=>{t(new Error("Failed to load Stripe.js"))}))}catch(e){return void t(e)}else o(null)}))),u),h=Promise.resolve().then((()=>m(null)));let y=!1;h.catch((e=>{y||console.warn(e)}));var g;const w=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:o,isWhiteListed:t}=s({loadScriptSrc:null==e?void 0:e.src});return t?o:null})(),f="https://v1.3.40.js.zonos.com",v=w||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.40",S="jsdelivr",z="https://rsms.me",b="https://fonts.googleapis.com",C=/^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;let j=class{};var L;g=j,j.doneInit=!1,j.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),j.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),j._paypalMockResponse=null,j.isBigCommerce=!1,j.isNpm=!0,j.zonosQaUrl=null,j.version="v1.3.40",j.modeAlerted=!1,j.tempCartData=null,j.paypal=null,j.getCurrentTimestamp=()=>(new Date).getTime(),j.zonosController=null,j.init=async({appearance:e,checkoutSettings:o,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:a,storeId:l,zonosApiKey:c})=>{g.doneInit||(t(`====== ZONOS DEBUG MODE: on (${g.version}) ======`),c?(g.zonosApiKey=c,g.storeId=l,t("init zonos"),g.injectZonosCdn(),g.injectZonosCss(),g.injectFonts(),g.injectController({config:{appearance:e,checkoutSettings:o,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:a},zonosApiKey:c}),g.doneInit=!0):n("Missing Zonos API key"))},j.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},j.openHelloDialog=e=>{const o=document.querySelector("zonos-hello");o&&o.openHelloDialog(null==e||e)},j.showNotification=e=>{var o;null===(o=g.zonosController)||void 0===o||o.showNotification(e)},j.updateOrganizationName=e=>{var o;null===(o=g.zonosController)||void 0===o||o.updateOrganizationName(e)},j.disablePlaceOrderButtons=({autoEnable:e=!0,config:o,disable:t,placeOrderButtonSelector:n})=>{var r;if(!(null===(r=o.checkoutSettings)||void 0===r?void 0:r.disablePlaceOrderButtonActivation)&&n){const o=document.querySelectorAll(n),r=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};o.forEach((e=>{e.getAttribute("data-zonos-checkout-attached")||(t?(e.setAttribute("disabled","true"),e.addEventListener("click",r)):(e.removeAttribute("disabled"),e.removeEventListener("click",r)))})),e&&t&&setTimeout((()=>{o.forEach((e=>{e.removeAttribute("disabled"),e.removeEventListener("click",r)}))}),5e3)}},j.injectController=({config:e,zonosApiKey:o})=>{var r;if(document.querySelector("zonos-controller"))return;if(null===(r=e.checkoutSettings)||void 0===r?void 0:r.placeOrderButtonSelector){const o=e.checkoutSettings.placeOrderButtonSelector;g.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o});new MutationObserver((()=>{g.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o})})).observe(document.body,{childList:!0,subtree:!0})}const s=document.createElement("zonos-controller");s.config=e,s.zonosApiKey=o,s.addEventListener("stripeInitEvent",(async e=>{const{detail:o}=e;t("loading Stripe");const r=await(async(...e)=>{y=!0;const o=Date.now();return h.then((t=>((e,o,t)=>{if(null===e)return null;const n=e.apply(void 0,o);return((e,o)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:o})})(n,t),n})(t,e,o)))})(o.publishableKey);r?(window.Zonos.stripe=r,s.initCheckoutElement(r)):n("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(s),g.zonosController=s,t("Zonos controller injected!")},j.injectScript=({cdnType:e,isModule:o,theRestUrl:r})=>{const s=`${g.getZonosUrl(e)}/${r}`;if(document.querySelector(`script[src="${s}"]`))return void t(`Zonos script "${s}" already exists in the document`,"warn");const i=document.head||document.body,l=document.createElement("script");o?l.type="module":l.noModule=!0,l.src=s,l.crossOrigin="anonymous",l.onerror=()=>{n(`Failed to load ${l.src}`);const t=a(e);t&&g.injectScript({cdnType:t,isModule:o,theRestUrl:r})},i.appendChild(l)},j.getZonosUrl=e=>{const o=()=>{switch(e){case"jsdelivr":return v;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.40";default:return f}};if(g.isNpm){return l()||o()}return o()},j.injectZonosCdn=()=>{g.injectScript({cdnType:S,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),g.injectScript({cdnType:S,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),t("Zonos cdn script injected!")},j.injectStylesheet=({cdnType:e,theRestUrl:o})=>{const t=g.getZonosUrl(e),r=document.head||document.body,s=document.createElement("link");s.rel="preconnect",s.href=`${f}/`,r.appendChild(s);const i=document.createElement("link");i.rel="stylesheet",i.href=`${t}/${o}`,i.onerror=()=>{n(`Failed to load ${i.href}`);const t=a(e);t&&g.injectStylesheet({cdnType:t,theRestUrl:o})},r.appendChild(i)},j.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?t("Zonos style links already injected","warn"):(g.injectStylesheet({cdnType:S,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),t("Zonos style css injected!"))},j.injectFonts=()=>{if((()=>{const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${z}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&!C.test(t.href))return t}return null})())return void t("Inter font already injected","warn");const e=document.head||document.body,o=document.createElement("link");o.rel="preconnect",o.href=z,e.appendChild(o);const n=document.createElement("link");n.rel="stylesheet",n.href=`${z}/inter/inter.css`,e.appendChild(n),t("Zonos font injected!")},j.setupGoogleFont=e=>{var o;null===(o=g.zonosController)||void 0===o||o.setupGoogleFont(e)},j.injectSupportGoogleFont=e=>{var o;t(`[FONT] injecting ${e}`);const n=null===(o=e.match(/family=(.*?):/))||void 0===o?void 0:o[1],r=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${b}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=b,r.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${e}"]`))return void t(`[FONT] ${n} font already injected`,"warn");const s=document.createElement("link");s.rel="stylesheet",s.href=e,r.appendChild(s),t(`[FONT] ${n} font injected!`)};const O=l();class U{static get isNpm(){return!1}}L=U,U.isBigCommerce=!1,U.requested=!1,U.zonosQaUrl=null,U.tempCartData=null,U.zonosApiKey=null,U.isLegacyCheckout=!1,U.legacyStoreLogo=null,U.legacyStoreFavicon=null,U.parallelLoadTimes=[],U.paralellLoadState="off",U.loadScriptLogHandler=async({cdnLoadTime:e,fallbackLoadTime:o,isError:t,metadata:n,scriptLoadUrl:r,storeId:s,type:i})=>{try{const e=window.performance.getEntriesByType("resource").find((e=>{const o=e;return o.name.includes(r)&&"script"===o.initiatorType}));null==e||e.transferSize;(async e=>{})((e&&(null==e?void 0:e.duration)>0?parseFloat(e.duration.toFixed(2)):parseFloat(o.toFixed(2)),Object.assign({decodedBodySize:null==e?void 0:e.decodedBodySize,encodedBodySize:null==e?void 0:e.encodedBodySize,fallbackLoadTime:o,isError:!!t},n)))}catch(e){}},U.loadScriptLogParallelHandler=async e=>{try{if(L.parallelLoadTimes.push(e),2===L.parallelLoadTimes.length){const e=L.parallelLoadTimes.find((e=>"vercel"===e.type)),o=L.parallelLoadTimes.find((e=>"jsdelivr"===e.type));if(!e||!o)return;if(e.isError&&o.isError)return void r({endpoint:`<${e.scriptLoadUrl}> <${o.scriptLoadUrl}>`,errors:["Failed to fetch both Vercel and jsdelivr CDN. Perhaps network issue on customer site."],metadata:{cdnLoadTime:o.fallbackLoadTime,cdnType:o.type,vercelLoadTime:e.fallbackLoadTime}});L.loadScriptLogHandler({cdnLoadTime:o.fallbackLoadTime,fallbackLoadTime:e.fallbackLoadTime,isError:e.isError,metadata:{cdnScriptFallbackTime:o.fallbackLoadTime,cdnScriptIsError:!!o.isError,cdnScriptLoadUrl:o.scriptLoadUrl,cdnScriptType:o.type},scriptLoadUrl:e.scriptLoadUrl,storeId:e.storeId,type:e.type})}}catch(e){}},U.legacyCheckoutErrorHandler=({message:e,tempCartUUID:o})=>{n(`[ZONOS - loadZonos] ${e}`),r({endpoint:"LegacyCheckoutInit",errors:[e],metadata:{tempCartUUID:o}}),document.dispatchEvent(new CustomEvent("legacyCheckoutError",{detail:e}))},U.getGithubCdn=({type:e,version:o})=>{let t="https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.40";"unpkg"===e&&(t="https://unpkg.com/@zonos/elements@1.3.40");return o&&"alpha"!==o?t.replace(/@zonos\/elements@(.+)/,`@zonos/elements@${o}`):t},U.injectZonos=({cdnType:e=S,initConfig:o,parallelLoaded:n,vercelUrl:s,version:l})=>{var c;const d="vercel"===e?s:L.getGithubCdn({type:e,version:l}),p=O||d,u=p.replace("https://","").replace("http://",""),m=document.createElement("script"),h=l&&l<"1.2.5"?"loadZonos.js":"zonos.js";m.src=`https://${u}/dist/scripts/${h}`,t(`[ZONOS - loadZonos] Injecting "${h}" from "${u}"`,"info");const y="4g"===(null===(c=(()=>{const e="connection"in window.navigator?window.navigator.connection:null,o="mozConnection"in window.navigator?window.navigator.mozConnection:null,t="webkitConnection"in window.navigator?window.navigator.webkitConnection:null;return e||o||t})())||void 0===c?void 0:c.effectiveType),g=["dev.elements.zonos.com","zonos.com"].some((e=>window.location.href.includes(e))),w=i[0]===e,f=i[1],v="on"===L.paralellLoadState&&y&&w&&f&&!g;v&&L.injectZonos({cdnType:f,initConfig:o,parallelLoaded:!0,vercelUrl:s,version:l});const z=performance.now();m.addEventListener("load",(()=>{if(v||n?L.loadScriptLogParallelHandler({fallbackLoadTime:performance.now()-z,scriptLoadUrl:m.src,storeId:L.storeId,type:e}):L.loadScriptLogHandler({fallbackLoadTime:performance.now()-z,scriptLoadUrl:m.src,storeId:L.storeId,type:e}),L.isBigCommerce||(L.isBigCommerce=!!window.stencilBootstrap||!!window.bcConfig||!!document.querySelector('script[src*="bigcommerce.com"]')),window.Zonos.isNpm=!1,window.Zonos.zonosQaUrl=O,window.Zonos.isBigCommerce=L.isBigCommerce,L.isLegacyCheckout){if(!L.zonosApiKey)throw L.legacyCheckoutErrorHandler({message:"zonosApiKey is required for legacy checkout",tempCartUUID:o.tempCartUUID}),new Error("zonosApiKey is required for legacy checkout");if(!L.tempCartData)throw L.legacyCheckoutErrorHandler({message:"tempCartData is required for legacy checkout",tempCartUUID:o.tempCartUUID}),new Error("zonosApiKey is required for legacy checkout");if(L.legacyStoreFavicon){const e=document.createElement("link");e.rel="shortcut icon",e.type="image/x-icon",e.href=L.legacyStoreFavicon,document.head.appendChild(e)}window.Zonos.tempCartData=L.tempCartData;const e=Object.assign(Object.assign({},o),{appearance:Object.assign(Object.assign({},o.appearance),{logoUrl:L.legacyStoreLogo||""}),checkoutSettings:Object.assign(Object.assign({},o.checkoutSettings),{successBehavior:"ZONOS_SUCCESS_PAGE",successRedirectUrl:L.tempCartData.contShoppingURL}),zonosApiKey:L.zonosApiKey});o=e}window.Zonos.version&&(t(`[ZONOS - loadZonos] Execute "Zonos.init" from "${h}" from "${u}"`,"info"),window.Zonos.init(o))})),m.addEventListener("error",(async()=>{if(!v&&!n){const t=a(e);if(!t)return;L.injectZonos({cdnType:t,initConfig:o,vercelUrl:s,version:l})}if(["localhost",".zonos.com"].some((e=>window.location.href.includes(e)))||O)return;if(v||n)return void L.loadScriptLogParallelHandler({fallbackLoadTime:performance.now()-z,isError:!0,scriptLoadUrl:m.src,storeId:L.storeId,type:e});["unpkg","vercel"].includes(e)?r({endpoint:m.src,errors:[`zonos.js - Failed to fetch ${e} CDN.`],metadata:{cdnLoadTime:performance.now()-z,cdnType:e,loadUrl:p,version:l}}):r({endpoint:m.src,errors:["[Info] Using alternative CDN. Failed to fetch script"],metadata:{cdnType:e,vercelLoadTime:performance.now()-z}})})),document.head.appendChild(m)},U.setupCartData=async e=>{const r=await(async e=>{const{errors:t,json:n}=await o("https://v1.route.js.zonos.com/api/bigcommerce/legacy-migration/get-temp-cart",{body:{tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"});return!n||t.length?null:n})(e);if(t("[ZONOS - loadZonos] getting temp cart data","info",r),!r)throw n("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),L.legacyCheckoutErrorHandler({message:"Error getting temp cart data",tempCartUUID:e}),new Error("Error getting temp cart data");return L.tempCartData=r.tempCart,L.legacyStoreLogo=r.storeLogoUrl,L.legacyStoreFavicon=r.storeFaviconUrl,{storeId:r.tempCart.storeId,zonosApiKey:r.zonosApiKey}},U.init=async e=>{var r;const i="https://v1.3.40.js.zonos.com",a=document.querySelector('script[src*="/zonos.js"]'),l=null===(r=document.querySelector("script[src*='/loadZonos.js']"))||void 0===r?void 0:r.src,c=null==l?void 0:l.includes("timestamp=");if(!(L.isNpm||l&&c))return void n("[ZONOS - loadZonos] A timestamp is required as a query parameter in the loadZonos.js script source. This timestamp ensures that you are loading the most recent version of the script, avoiding any cached versions.");if(a||!l||L.requested)return void t("[ZONOS - loadZonos] script is already loaded or requested","info");L.requested=!0;let d=e.storeId;if(e.tempCartUUID){const o=await L.setupCartData(e.tempCartUUID);d=o.storeId,L.zonosApiKey=o.zonosApiKey,L.isLegacyCheckout=!0}if(!d)return t("[ZONOS - loadZonos] loading latest script since storeId is not provided."),void L.injectZonos({initConfig:e,vercelUrl:i,version:null});L.storeId=d;const p=new URL("https://v1.route.js.zonos.com/api/get-store-version");p.searchParams.set("storeId",e.storeId.toString());const{errors:u,json:m}=await o(p.toString());if(u.length||!m)return t("[ZONOS - loadZonos] Error getting store version, loading the latest version.","error"),void L.injectZonos({initConfig:e,vercelUrl:i,version:null});const{version:h}=m;if(!a){const{currentLoadScriptUrl:o,isForceLoadVersionDomain:n,isWhiteListed:r}=s({loadScriptSrc:l}),i=r&&!n?o:`${"alpha"===h?"alpha":`v${h}`}.js.zonos.com`,a=r&&!n?null:h;t("[ZONOS - loadZonos] injecting zonos script","info",{currentLoadScriptUrl:o,isForceLoadVersionDomain:n,isWhiteListed:r,loadUrl:i,loadVersion:a,version:h}),L.injectZonos({initConfig:e,vercelUrl:i,version:a})}},void 0===window.Zonos&&(window.Zonos=U)})();
|
|
1
|
+
(function(){"use strict";"function"==typeof SuppressedError&&SuppressedError;const e=async({response:e,shouldLog:o=!0,shouldThrow:t=!1})=>{try{return await e.json()}catch(e){if(t)throw e;return o&&console.error(e),null}};const o=async(o,t)=>{const n=(function(e,o){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&o.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)o.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(t[n[r]]=e[n[r]])}return t})(t||{},[]),r=n.body?JSON.stringify(n.body):void 0,s=n.method||"GET",i=new URL(o);i.searchParams.set("zToken",(function(e){try{return btoa(e).replace(/=/g,"")}catch(o){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(window.location.hostname));const a=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},n.headers),l=Object.assign(Object.assign({},n),{body:"GET"===s?void 0:r,headers:a,method:s});return(async(o,t)=>{let n;try{n=await fetch(o,t)}catch(e){return e instanceof Error?{errors:[{message:e.message,type:"unknown"}],json:null,response:null,zonosMode:null}:{errors:[{message:"Fail to fetch",type:"unknown"}],json:null,response:null,zonosMode:null}}const r=n.headers.get("Zonos-Mode"),s=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&r&&s&&("production"===r&&alert("Please be aware that you are currently operating in the production environment. Any interactions with the customer store, including payments, will be processed as real transactions!"),"test"===r&&alert("For testing payments, you can utilize the test payment information provided at this link: https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=elements#web-test-the-integration"),window.Zonos.modeAlerted=!0),n.ok)return{errors:[],json:await e({response:n}),response:n,zonosMode:r};const i=n.status.toString();try{const o=await e({response:n,shouldThrow:!0});return{errors:[{message:JSON.stringify(o),type:i}],json:null,response:n,zonosMode:r}}catch(e){return{errors:[{message:`${i}: Unknown error`,type:i}],json:null,response:null,zonosMode:r}}})(i.toString(),l)},t=(e,o,...t)=>{var n,r;if(!(!!(null===(n=window.Zonos)||void 0===n?void 0:n.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===o&&console.error(e,...t));let s=document.querySelector("iframe#zonos---debug-logging-iframe");s||(s=document.createElement("iframe"),s.id="zonos---debug-logging-iframe",s.style.display="none",s.style.opacity="0",s.style.position="absolute",s.style.top="-9999px",s.style.left="-9999px",s.style.width="1px",s.style.height="1px",s.style.border="none",s.style.overflow="hidden",s.style.visibility="hidden",document.body.appendChild(s));const i=(null===(r=s.contentWindow)||void 0===r?void 0:r.window.console)||window.console;switch(o){case"warn":i.warn(e,...t);break;case"info":i.info(e,...t);break;case"error":i.error(e,...t);break;default:i.groupCollapsed(e,...t),i.trace(),i.groupEnd()}},n=(e,...o)=>{t(e,"error",...o)},r=async({endpoint:e,errors:t,metadata:n})=>{const r="userAgentData"in window.navigator?window.navigator.userAgentData:null,s={endpoint:e,errors:t,metadata:Object.assign({href:window.location.href,userAgent:r&&r.brands.length>0?r:window.navigator.userAgent},n)};o("https://v1.route.js.zonos.com/api/zonos-elements/log-error",{body:s,method:"POST"})},s=({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const o=new URL(e).origin,t=["dev.elements.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>o.includes(e))),n=["qa.js.zonos.com"].some((e=>o.includes(e)));return{currentLoadScriptUrl:o,isForceLoadVersionDomain:n,isWhiteListed:t}},i=["jsdelivr","unpkg","vercel"],a=e=>{const o=i.indexOf(e);return i[o+1]||null},l=()=>{if("undefined"==typeof window)return null;const e=(e=>{if(!e)return null;const o=new URL(e).searchParams.get("zonosQaUrl");return o?/[^a-zA-Z0-9-_]+/.test(o)?null:o:null})(window.location.href);if(!e&&"dev.demo.elements.zonos.com"===window.location.hostname)return"https://dev.elements.zonos.com";if(!e)return null;if("dev-elements"===e)return"https://dev.elements.zonos.com";const o=`https://${e}.preview.js.zonos.com`;return t(`[ZONOS-WARNING] using '${o}' for loading script`,"warn"),fetch(o).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${o}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:t}=window.location,n=`${t}?${e.toString()}`;return window.history.replaceState(window.history.state,"",n),window.location.reload(),null})),o},c="https://js.stripe.com/v3",d=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,p="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let u=null;const m=e=>(null!==u||(u=new Promise(((o,t)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(p),window.Stripe)o(window.Stripe);else try{let r=(()=>{const e=document.querySelectorAll(`script[src^="${c}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&d.test(t.src))return t}return null})();r&&e?console.warn(p):r||(r=(e=>{const o=document.createElement("script");o.src=`${c}`;const t=document.head||document.body;return t?(t.appendChild(o),o):(n("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==r||r.addEventListener("load",(()=>{window.Stripe?o(window.Stripe):t(new Error("Stripe.js not available"))})),null==r||r.addEventListener("error",(()=>{t(new Error("Failed to load Stripe.js"))}))}catch(e){return void t(e)}else o(null)}))),u),h=Promise.resolve().then((()=>m(null)));let y=!1;h.catch((e=>{y||console.warn(e)}));var g;const w=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:o,isWhiteListed:t}=s({loadScriptSrc:null==e?void 0:e.src});return t?o:null})(),f="https://v1.3.41.js.zonos.com",v=w||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.41",S="jsdelivr",z="https://rsms.me",b="https://fonts.googleapis.com",C=/^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;let j=class{};var L;g=j,j.doneInit=!1,j.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),j.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),j._paypalMockResponse=null,j.isBigCommerce=!1,j.isNpm=!0,j.zonosQaUrl=null,j.version="v1.3.41",j.modeAlerted=!1,j.tempCartData=null,j.paypal=null,j.getCurrentTimestamp=()=>(new Date).getTime(),j.zonosController=null,j.init=async({appearance:e,checkoutSettings:o,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:a,storeId:l,zonosApiKey:c})=>{g.doneInit||(t(`====== ZONOS DEBUG MODE: on (${g.version}) ======`),c?(g.zonosApiKey=c,g.storeId=l,t("init zonos"),g.injectZonosCdn(),g.injectZonosCss(),g.injectFonts(),g.injectController({config:{appearance:e,checkoutSettings:o,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:a},zonosApiKey:c}),g.doneInit=!0):n("Missing Zonos API key"))},j.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},j.openHelloDialog=e=>{const o=document.querySelector("zonos-hello");o&&o.openHelloDialog(null==e||e)},j.showNotification=e=>{var o;null===(o=g.zonosController)||void 0===o||o.showNotification(e)},j.updateOrganizationName=e=>{var o;null===(o=g.zonosController)||void 0===o||o.updateOrganizationName(e)},j.disablePlaceOrderButtons=({autoEnable:e=!0,config:o,disable:t,placeOrderButtonSelector:n})=>{var r;if(!(null===(r=o.checkoutSettings)||void 0===r?void 0:r.disablePlaceOrderButtonActivation)&&n){const o=document.querySelectorAll(n),r=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};o.forEach((e=>{e.getAttribute("data-zonos-checkout-attached")||(t?(e.setAttribute("disabled","true"),e.addEventListener("click",r)):(e.removeAttribute("disabled"),e.removeEventListener("click",r)))})),e&&t&&setTimeout((()=>{o.forEach((e=>{e.removeAttribute("disabled"),e.removeEventListener("click",r)}))}),5e3)}},j.injectController=({config:e,zonosApiKey:o})=>{var r;if(document.querySelector("zonos-controller"))return;if(null===(r=e.checkoutSettings)||void 0===r?void 0:r.placeOrderButtonSelector){const o=e.checkoutSettings.placeOrderButtonSelector;g.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o});new MutationObserver((()=>{g.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o})})).observe(document.body,{childList:!0,subtree:!0})}const s=document.createElement("zonos-controller");s.config=e,s.zonosApiKey=o,s.addEventListener("stripeInitEvent",(async e=>{const{detail:o}=e;t("loading Stripe");const r=await(async(...e)=>{y=!0;const o=Date.now();return h.then((t=>((e,o,t)=>{if(null===e)return null;const n=e.apply(void 0,o);return((e,o)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:o})})(n,t),n})(t,e,o)))})(o.publishableKey);r?(window.Zonos.stripe=r,s.initCheckoutElement(r)):n("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(s),g.zonosController=s,t("Zonos controller injected!")},j.injectScript=({cdnType:e,isModule:o,theRestUrl:r})=>{const s=`${g.getZonosUrl(e)}/${r}`;if(document.querySelector(`script[src="${s}"]`))return void t(`Zonos script "${s}" already exists in the document`,"warn");const i=document.head||document.body,l=document.createElement("script");o?l.type="module":l.noModule=!0,l.src=s,l.crossOrigin="anonymous",l.onerror=()=>{n(`Failed to load ${l.src}`);const t=a(e);t&&g.injectScript({cdnType:t,isModule:o,theRestUrl:r})},i.appendChild(l)},j.getZonosUrl=e=>{const o=()=>{switch(e){case"jsdelivr":return v;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.41";default:return f}};if(g.isNpm){return l()||o()}return o()},j.injectZonosCdn=()=>{g.injectScript({cdnType:S,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),g.injectScript({cdnType:S,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),t("Zonos cdn script injected!")},j.injectStylesheet=({cdnType:e,theRestUrl:o})=>{const t=g.getZonosUrl(e),r=document.head||document.body,s=document.createElement("link");s.rel="preconnect",s.href=`${f}/`,r.appendChild(s);const i=document.createElement("link");i.rel="stylesheet",i.href=`${t}/${o}`,i.onerror=()=>{n(`Failed to load ${i.href}`);const t=a(e);t&&g.injectStylesheet({cdnType:t,theRestUrl:o})},r.appendChild(i)},j.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?t("Zonos style links already injected","warn"):(g.injectStylesheet({cdnType:S,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),t("Zonos style css injected!"))},j.injectFonts=()=>{if((()=>{const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${z}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&!C.test(t.href))return t}return null})())return void t("Inter font already injected","warn");const e=document.head||document.body,o=document.createElement("link");o.rel="preconnect",o.href=z,e.appendChild(o);const n=document.createElement("link");n.rel="stylesheet",n.href=`${z}/inter/inter.css`,e.appendChild(n),t("Zonos font injected!")},j.setupGoogleFont=e=>{var o;null===(o=g.zonosController)||void 0===o||o.setupGoogleFont(e)},j.injectSupportGoogleFont=e=>{var o;t(`[FONT] injecting ${e}`);const n=null===(o=e.match(/family=(.*?):/))||void 0===o?void 0:o[1],r=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${b}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=b,r.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${e}"]`))return void t(`[FONT] ${n} font already injected`,"warn");const s=document.createElement("link");s.rel="stylesheet",s.href=e,r.appendChild(s),t(`[FONT] ${n} font injected!`)};const O=l();class U{static get isNpm(){return!1}}L=U,U.isBigCommerce=!1,U.requested=!1,U.zonosQaUrl=null,U.tempCartData=null,U.zonosApiKey=null,U.isLegacyCheckout=!1,U.legacyStoreLogo=null,U.legacyStoreFavicon=null,U.parallelLoadTimes=[],U.paralellLoadState="off",U.loadScriptLogHandler=async({cdnLoadTime:e,fallbackLoadTime:o,isError:t,metadata:n,scriptLoadUrl:r,storeId:s,type:i})=>{try{const e=window.performance.getEntriesByType("resource").find((e=>{const o=e;return o.name.includes(r)&&"script"===o.initiatorType}));null==e||e.transferSize;(async e=>{})((e&&(null==e?void 0:e.duration)>0?parseFloat(e.duration.toFixed(2)):parseFloat(o.toFixed(2)),Object.assign({decodedBodySize:null==e?void 0:e.decodedBodySize,encodedBodySize:null==e?void 0:e.encodedBodySize,fallbackLoadTime:o,isError:!!t},n)))}catch(e){}},U.loadScriptLogParallelHandler=async e=>{try{if(L.parallelLoadTimes.push(e),2===L.parallelLoadTimes.length){const e=L.parallelLoadTimes.find((e=>"vercel"===e.type)),o=L.parallelLoadTimes.find((e=>"jsdelivr"===e.type));if(!e||!o)return;if(e.isError&&o.isError)return void r({endpoint:`<${e.scriptLoadUrl}> <${o.scriptLoadUrl}>`,errors:["Failed to fetch both Vercel and jsdelivr CDN. Perhaps network issue on customer site."],metadata:{cdnLoadTime:o.fallbackLoadTime,cdnType:o.type,vercelLoadTime:e.fallbackLoadTime}});L.loadScriptLogHandler({cdnLoadTime:o.fallbackLoadTime,fallbackLoadTime:e.fallbackLoadTime,isError:e.isError,metadata:{cdnScriptFallbackTime:o.fallbackLoadTime,cdnScriptIsError:!!o.isError,cdnScriptLoadUrl:o.scriptLoadUrl,cdnScriptType:o.type},scriptLoadUrl:e.scriptLoadUrl,storeId:e.storeId,type:e.type})}}catch(e){}},U.legacyCheckoutErrorHandler=({message:e,tempCartUUID:o})=>{n(`[ZONOS - loadZonos] ${e}`),r({endpoint:"LegacyCheckoutInit",errors:[e],metadata:{tempCartUUID:o}}),document.dispatchEvent(new CustomEvent("legacyCheckoutError",{detail:e}))},U.getGithubCdn=({type:e,version:o})=>{let t="https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.41";"unpkg"===e&&(t="https://unpkg.com/@zonos/elements@1.3.41");return o&&"alpha"!==o?t.replace(/@zonos\/elements@(.+)/,`@zonos/elements@${o}`):t},U.injectZonos=({cdnType:e=S,initConfig:o,parallelLoaded:n,vercelUrl:s,version:l})=>{var c;const d="vercel"===e?s:L.getGithubCdn({type:e,version:l}),p=O||d,u=p.replace("https://","").replace("http://",""),m=document.createElement("script"),h=l&&l<"1.2.5"?"loadZonos.js":"zonos.js";m.src=`https://${u}/dist/scripts/${h}`,t(`[ZONOS - loadZonos] Injecting "${h}" from "${u}"`,"info");const y="4g"===(null===(c=(()=>{const e="connection"in window.navigator?window.navigator.connection:null,o="mozConnection"in window.navigator?window.navigator.mozConnection:null,t="webkitConnection"in window.navigator?window.navigator.webkitConnection:null;return e||o||t})())||void 0===c?void 0:c.effectiveType),g=["dev.elements.zonos.com","zonos.com"].some((e=>window.location.href.includes(e))),w=i[0]===e,f=i[1],v="on"===L.paralellLoadState&&y&&w&&f&&!g;v&&L.injectZonos({cdnType:f,initConfig:o,parallelLoaded:!0,vercelUrl:s,version:l});const z=performance.now();m.addEventListener("load",(()=>{if(v||n?L.loadScriptLogParallelHandler({fallbackLoadTime:performance.now()-z,scriptLoadUrl:m.src,storeId:L.storeId,type:e}):L.loadScriptLogHandler({fallbackLoadTime:performance.now()-z,scriptLoadUrl:m.src,storeId:L.storeId,type:e}),L.isBigCommerce||(L.isBigCommerce=!!window.stencilBootstrap||!!window.bcConfig||!!document.querySelector('script[src*="bigcommerce.com"]')),window.Zonos.isNpm=!1,window.Zonos.zonosQaUrl=O,window.Zonos.isBigCommerce=L.isBigCommerce,L.isLegacyCheckout){if(!L.zonosApiKey)throw L.legacyCheckoutErrorHandler({message:"zonosApiKey is required for legacy checkout",tempCartUUID:o.tempCartUUID}),new Error("zonosApiKey is required for legacy checkout");if(!L.tempCartData)throw L.legacyCheckoutErrorHandler({message:"tempCartData is required for legacy checkout",tempCartUUID:o.tempCartUUID}),new Error("zonosApiKey is required for legacy checkout");if(L.legacyStoreFavicon){const e=document.createElement("link");e.rel="shortcut icon",e.type="image/x-icon",e.href=L.legacyStoreFavicon,document.head.appendChild(e)}window.Zonos.tempCartData=L.tempCartData;const e=Object.assign(Object.assign({},o),{appearance:Object.assign(Object.assign({},o.appearance),{logoUrl:L.legacyStoreLogo||""}),checkoutSettings:Object.assign(Object.assign({},o.checkoutSettings),{successBehavior:"ZONOS_SUCCESS_PAGE",successRedirectUrl:L.tempCartData.contShoppingURL}),zonosApiKey:L.zonosApiKey});o=e}window.Zonos.version&&(t(`[ZONOS - loadZonos] Execute "Zonos.init" from "${h}" from "${u}"`,"info"),window.Zonos.init(o))})),m.addEventListener("error",(async()=>{if(!v&&!n){const t=a(e);if(!t)return;L.injectZonos({cdnType:t,initConfig:o,vercelUrl:s,version:l})}if(["localhost",".zonos.com"].some((e=>window.location.href.includes(e)))||O)return;if(v||n)return void L.loadScriptLogParallelHandler({fallbackLoadTime:performance.now()-z,isError:!0,scriptLoadUrl:m.src,storeId:L.storeId,type:e});["unpkg","vercel"].includes(e)?r({endpoint:m.src,errors:[`zonos.js - Failed to fetch ${e} CDN.`],metadata:{cdnLoadTime:performance.now()-z,cdnType:e,loadUrl:p,version:l}}):r({endpoint:m.src,errors:["[Info] Using alternative CDN. Failed to fetch script"],metadata:{cdnType:e,vercelLoadTime:performance.now()-z}})})),document.head.appendChild(m)},U.setupCartData=async e=>{const r=await(async e=>{const{errors:t,json:n}=await o("https://v1.route.js.zonos.com/api/bigcommerce/legacy-migration/get-temp-cart",{body:{tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"});return!n||t.length?null:n})(e);if(t("[ZONOS - loadZonos] getting temp cart data","info",r),!r)throw n("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),L.legacyCheckoutErrorHandler({message:"Error getting temp cart data",tempCartUUID:e}),new Error("Error getting temp cart data");return L.tempCartData=r.tempCart,L.legacyStoreLogo=r.storeLogoUrl,L.legacyStoreFavicon=r.storeFaviconUrl,{storeId:r.tempCart.storeId,zonosApiKey:r.zonosApiKey}},U.init=async e=>{var r;const i="https://v1.3.41.js.zonos.com",a=document.querySelector('script[src*="/zonos.js"]'),l=null===(r=document.querySelector("script[src*='/loadZonos.js']"))||void 0===r?void 0:r.src,c=null==l?void 0:l.includes("timestamp=");if(!(L.isNpm||l&&c))return void n("[ZONOS - loadZonos] A timestamp is required as a query parameter in the loadZonos.js script source. This timestamp ensures that you are loading the most recent version of the script, avoiding any cached versions.");if(a||!l||L.requested)return void t("[ZONOS - loadZonos] script is already loaded or requested","info");L.requested=!0;let d=e.storeId;if(e.tempCartUUID){const o=await L.setupCartData(e.tempCartUUID);d=o.storeId,L.zonosApiKey=o.zonosApiKey,L.isLegacyCheckout=!0}if(!d)return t("[ZONOS - loadZonos] loading latest script since storeId is not provided."),void L.injectZonos({initConfig:e,vercelUrl:i,version:null});L.storeId=d;const p=new URL("https://v1.route.js.zonos.com/api/get-store-version");p.searchParams.set("storeId",e.storeId.toString());const{errors:u,json:m}=await o(p.toString());if(u.length||!m)return t("[ZONOS - loadZonos] Error getting store version, loading the latest version.","error"),void L.injectZonos({initConfig:e,vercelUrl:i,version:null});const{version:h}=m;if(!a){const{currentLoadScriptUrl:o,isForceLoadVersionDomain:n,isWhiteListed:r}=s({loadScriptSrc:l}),i=r&&!n?o:`${"alpha"===h?"alpha":`v${h}`}.js.zonos.com`,a=r&&!n?null:h;t("[ZONOS - loadZonos] injecting zonos script","info",{currentLoadScriptUrl:o,isForceLoadVersionDomain:n,isWhiteListed:r,loadUrl:i,loadVersion:a,version:h}),L.injectZonos({initConfig:e,vercelUrl:i,version:a})}},void 0===window.Zonos&&(window.Zonos=U)})();
|
package/dist/scripts/zonos.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";const e=(e,t,...n)=>{var o,r;if(!(!!(null===(o=window.Zonos)||void 0===o?void 0:o.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===t&&console.error(e,...n));let s=document.querySelector("iframe#zonos---debug-logging-iframe");s||(s=document.createElement("iframe"),s.id="zonos---debug-logging-iframe",s.style.display="none",s.style.opacity="0",s.style.position="absolute",s.style.top="-9999px",s.style.left="-9999px",s.style.width="1px",s.style.height="1px",s.style.border="none",s.style.overflow="hidden",s.style.visibility="hidden",document.body.appendChild(s));const i=(null===(r=s.contentWindow)||void 0===r?void 0:r.window.console)||window.console;switch(t){case"warn":i.warn(e,...n);break;case"info":i.info(e,...n);break;case"error":i.error(e,...n);break;default:i.groupCollapsed(e,...n),i.trace(),i.groupEnd()}},t=(t,...n)=>{e(t,"error",...n)},n=["jsdelivr","unpkg","vercel"],o=e=>{const t=n.indexOf(e);return n[t+1]||null},r=()=>{if("undefined"==typeof window)return null;const t=(e=>{if(!e)return null;const t=new URL(e).searchParams.get("zonosQaUrl");return t?/[^a-zA-Z0-9-_]+/.test(t)?null:t:null})(window.location.href);if(!t&&"dev.demo.elements.zonos.com"===window.location.hostname)return"https://dev.elements.zonos.com";if(!t)return null;if("dev-elements"===t)return"https://dev.elements.zonos.com";const n=`https://${t}.preview.js.zonos.com`;return e(`[ZONOS-WARNING] using '${n}' for loading script`,"warn"),fetch(n).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${n}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:t}=window.location,o=`${t}?${e.toString()}`;return window.history.replaceState(window.history.state,"",o),window.location.reload(),null})),n},s="https://js.stripe.com/v3",i=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,l="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let c=null;const d=e=>(null!==c||(c=new Promise(((n,o)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(l),window.Stripe)n(window.Stripe);else try{let r=(()=>{const e=document.querySelectorAll(`script[src^="${s}"]`);for(let t=0;t<e.length;t++){const n=e[t];if(n&&i.test(n.src))return n}return null})();r&&e?console.warn(l):r||(r=(e=>{const n=document.createElement("script");n.src=`${s}`;const o=document.head||document.body;return o?(o.appendChild(n),n):(t("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==r||r.addEventListener("load",(()=>{window.Stripe?n(window.Stripe):o(new Error("Stripe.js not available"))})),null==r||r.addEventListener("error",(()=>{o(new Error("Failed to load Stripe.js"))}))}catch(e){return void o(e)}else n(null)}))),c),a=Promise.resolve().then((()=>d(null)));let u=!1;a.catch((e=>{u||console.warn(e)}));var p;const m=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:t,isWhiteListed:n}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const t=new URL(e).origin,n=["dev.elements.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>t.includes(e))),o=["qa.js.zonos.com"].some((e=>t.includes(e)));return{currentLoadScriptUrl:t,isForceLoadVersionDomain:o,isWhiteListed:n}})({loadScriptSrc:null==e?void 0:e.src});return n?t:null})(),h="https://v1.3.
|
|
1
|
+
(function(){"use strict";const e=(e,t,...n)=>{var o,r;if(!(!!(null===(o=window.Zonos)||void 0===o?void 0:o.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===t&&console.error(e,...n));let s=document.querySelector("iframe#zonos---debug-logging-iframe");s||(s=document.createElement("iframe"),s.id="zonos---debug-logging-iframe",s.style.display="none",s.style.opacity="0",s.style.position="absolute",s.style.top="-9999px",s.style.left="-9999px",s.style.width="1px",s.style.height="1px",s.style.border="none",s.style.overflow="hidden",s.style.visibility="hidden",document.body.appendChild(s));const i=(null===(r=s.contentWindow)||void 0===r?void 0:r.window.console)||window.console;switch(t){case"warn":i.warn(e,...n);break;case"info":i.info(e,...n);break;case"error":i.error(e,...n);break;default:i.groupCollapsed(e,...n),i.trace(),i.groupEnd()}},t=(t,...n)=>{e(t,"error",...n)},n=["jsdelivr","unpkg","vercel"],o=e=>{const t=n.indexOf(e);return n[t+1]||null},r=()=>{if("undefined"==typeof window)return null;const t=(e=>{if(!e)return null;const t=new URL(e).searchParams.get("zonosQaUrl");return t?/[^a-zA-Z0-9-_]+/.test(t)?null:t:null})(window.location.href);if(!t&&"dev.demo.elements.zonos.com"===window.location.hostname)return"https://dev.elements.zonos.com";if(!t)return null;if("dev-elements"===t)return"https://dev.elements.zonos.com";const n=`https://${t}.preview.js.zonos.com`;return e(`[ZONOS-WARNING] using '${n}' for loading script`,"warn"),fetch(n).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${n}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:t}=window.location,o=`${t}?${e.toString()}`;return window.history.replaceState(window.history.state,"",o),window.location.reload(),null})),n},s="https://js.stripe.com/v3",i=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,l="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let c=null;const d=e=>(null!==c||(c=new Promise(((n,o)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(l),window.Stripe)n(window.Stripe);else try{let r=(()=>{const e=document.querySelectorAll(`script[src^="${s}"]`);for(let t=0;t<e.length;t++){const n=e[t];if(n&&i.test(n.src))return n}return null})();r&&e?console.warn(l):r||(r=(e=>{const n=document.createElement("script");n.src=`${s}`;const o=document.head||document.body;return o?(o.appendChild(n),n):(t("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==r||r.addEventListener("load",(()=>{window.Stripe?n(window.Stripe):o(new Error("Stripe.js not available"))})),null==r||r.addEventListener("error",(()=>{o(new Error("Failed to load Stripe.js"))}))}catch(e){return void o(e)}else n(null)}))),c),a=Promise.resolve().then((()=>d(null)));let u=!1;a.catch((e=>{u||console.warn(e)}));var p;const m=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:t,isWhiteListed:n}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const t=new URL(e).origin,n=["dev.elements.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>t.includes(e))),o=["qa.js.zonos.com"].some((e=>t.includes(e)));return{currentLoadScriptUrl:t,isForceLoadVersionDomain:o,isWhiteListed:n}})({loadScriptSrc:null==e?void 0:e.src});return n?t:null})(),h="https://v1.3.41.js.zonos.com",y=m||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.41",w="jsdelivr",f="https://rsms.me",v="https://fonts.googleapis.com",g=/^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;class S{}p=S,S.doneInit=!1,S.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),S.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),S._paypalMockResponse=null,S.isBigCommerce=!1,S.isNpm=!0,S.zonosQaUrl=null,S.version="v1.3.41",S.modeAlerted=!1,S.tempCartData=null,S.paypal=null,S.getCurrentTimestamp=()=>(new Date).getTime(),S.zonosController=null,S.init=async({appearance:n,checkoutSettings:o,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:l,storeId:c,zonosApiKey:d})=>{p.doneInit||(e(`====== ZONOS DEBUG MODE: on (${p.version}) ======`),d?(p.zonosApiKey=d,p.storeId=c,e("init zonos"),p.injectZonosCdn(),p.injectZonosCss(),p.injectFonts(),p.injectController({config:{appearance:n,checkoutSettings:o,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:l},zonosApiKey:d}),p.doneInit=!0):t("Missing Zonos API key"))},S.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},S.openHelloDialog=e=>{const t=document.querySelector("zonos-hello");t&&t.openHelloDialog(null==e||e)},S.showNotification=e=>{var t;null===(t=p.zonosController)||void 0===t||t.showNotification(e)},S.updateOrganizationName=e=>{var t;null===(t=p.zonosController)||void 0===t||t.updateOrganizationName(e)},S.disablePlaceOrderButtons=({autoEnable:e=!0,config:t,disable:n,placeOrderButtonSelector:o})=>{var r;if(!(null===(r=t.checkoutSettings)||void 0===r?void 0:r.disablePlaceOrderButtonActivation)&&o){const t=document.querySelectorAll(o),r=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};t.forEach((e=>{e.getAttribute("data-zonos-checkout-attached")||(n?(e.setAttribute("disabled","true"),e.addEventListener("click",r)):(e.removeAttribute("disabled"),e.removeEventListener("click",r)))})),e&&n&&setTimeout((()=>{t.forEach((e=>{e.removeAttribute("disabled"),e.removeEventListener("click",r)}))}),5e3)}},S.injectController=({config:n,zonosApiKey:o})=>{var r;if(document.querySelector("zonos-controller"))return;if(null===(r=n.checkoutSettings)||void 0===r?void 0:r.placeOrderButtonSelector){const e=n.checkoutSettings.placeOrderButtonSelector;p.disablePlaceOrderButtons({config:n,disable:!0,placeOrderButtonSelector:e});new MutationObserver((()=>{p.disablePlaceOrderButtons({config:n,disable:!0,placeOrderButtonSelector:e})})).observe(document.body,{childList:!0,subtree:!0})}const s=document.createElement("zonos-controller");s.config=n,s.zonosApiKey=o,s.addEventListener("stripeInitEvent",(async n=>{const{detail:o}=n;e("loading Stripe");const r=await(async(...e)=>{u=!0;const t=Date.now();return a.then((n=>((e,t,n)=>{if(null===e)return null;const o=e.apply(void 0,t);return((e,t)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:t})})(o,n),o})(n,e,t)))})(o.publishableKey);r?(window.Zonos.stripe=r,s.initCheckoutElement(r)):t("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(s),p.zonosController=s,e("Zonos controller injected!")},S.injectScript=({cdnType:n,isModule:r,theRestUrl:s})=>{const i=`${p.getZonosUrl(n)}/${s}`;if(document.querySelector(`script[src="${i}"]`))return void e(`Zonos script "${i}" already exists in the document`,"warn");const l=document.head||document.body,c=document.createElement("script");r?c.type="module":c.noModule=!0,c.src=i,c.crossOrigin="anonymous",c.onerror=()=>{t(`Failed to load ${c.src}`);const e=o(n);e&&p.injectScript({cdnType:e,isModule:r,theRestUrl:s})},l.appendChild(c)},S.getZonosUrl=e=>{const t=()=>{switch(e){case"jsdelivr":return y;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.41";default:return h}};if(p.isNpm){return r()||t()}return t()},S.injectZonosCdn=()=>{p.injectScript({cdnType:w,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),p.injectScript({cdnType:w,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),e("Zonos cdn script injected!")},S.injectStylesheet=({cdnType:e,theRestUrl:n})=>{const r=p.getZonosUrl(e),s=document.head||document.body,i=document.createElement("link");i.rel="preconnect",i.href=`${h}/`,s.appendChild(i);const l=document.createElement("link");l.rel="stylesheet",l.href=`${r}/${n}`,l.onerror=()=>{t(`Failed to load ${l.href}`);const r=o(e);r&&p.injectStylesheet({cdnType:r,theRestUrl:n})},s.appendChild(l)},S.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?e("Zonos style links already injected","warn"):(p.injectStylesheet({cdnType:w,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),e("Zonos style css injected!"))},S.injectFonts=()=>{if((()=>{const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${f}"]`);for(let t=0;t<e.length;t++){const n=e[t];if(n&&!g.test(n.href))return n}return null})())return void e("Inter font already injected","warn");const t=document.head||document.body,n=document.createElement("link");n.rel="preconnect",n.href=f,t.appendChild(n);const o=document.createElement("link");o.rel="stylesheet",o.href=`${f}/inter/inter.css`,t.appendChild(o),e("Zonos font injected!")},S.setupGoogleFont=e=>{var t;null===(t=p.zonosController)||void 0===t||t.setupGoogleFont(e)},S.injectSupportGoogleFont=t=>{var n;e(`[FONT] injecting ${t}`);const o=null===(n=t.match(/family=(.*?):/))||void 0===n?void 0:n[1],r=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${v}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=v,r.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${t}"]`))return void e(`[FONT] ${o} font already injected`,"warn");const s=document.createElement("link");s.rel="stylesheet",s.href=t,r.appendChild(s),e(`[FONT] ${o} font injected!`)},window.Zonos&&window.Zonos.doneInit||(window.Zonos=S)})();
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The idea is from
|
|
3
|
+
* @ref https://github.com/beenotung/stencil-virtual-scroll/blob/master/src/components/virtual-scroll-list/virtual-scroll-list.scss
|
|
4
|
+
* @ref https://github.dev/ionic-team/ionic-framework/blob/v6.7.5/core/src/components/virtual-scroll/virtual-scroll.tsx
|
|
5
|
+
*/
|
|
6
|
+
export declare class ZonosVirtualScroll {
|
|
7
|
+
ele: HTMLZonosVirtualScrollElement;
|
|
8
|
+
container?: HTMLElement;
|
|
9
|
+
/**
|
|
10
|
+
* Render item
|
|
11
|
+
*/
|
|
12
|
+
renderItem: (itemIndex: number) => HTMLElement | Promise<HTMLElement> | HTMLElement[] | Promise<HTMLElement[]> | Promise<HTMLElement>[];
|
|
13
|
+
/**
|
|
14
|
+
* Width of each item
|
|
15
|
+
*/
|
|
16
|
+
itemWidth?: number;
|
|
17
|
+
/**
|
|
18
|
+
* Height that is used as a fallback if height is not provided
|
|
19
|
+
*/
|
|
20
|
+
fallbackItemHeight: number;
|
|
21
|
+
/**
|
|
22
|
+
* Heights list of each item
|
|
23
|
+
*/
|
|
24
|
+
itemHeights: number[];
|
|
25
|
+
scrollTop: number;
|
|
26
|
+
totalHeight: number;
|
|
27
|
+
updateTotalHeight(): void;
|
|
28
|
+
private scrollListener;
|
|
29
|
+
connectedCallback(): void;
|
|
30
|
+
disconnectedCallback(): void;
|
|
31
|
+
render(): any;
|
|
32
|
+
}
|
|
@@ -30,5 +30,5 @@ type TranslateParams<T extends string> = ExtractVariables<T> extends never ? [T,
|
|
|
30
30
|
* // No variables:
|
|
31
31
|
* translate('Above de minimis threshold for')
|
|
32
32
|
*/
|
|
33
|
-
declare const translate: <T extends "Shipping" | "Email" | "Name" | "Guaranteed" | "Customer" | "Country" | "Failure" | "Success" | "Hide" | "or" | "Delivery" | "Payment" | "Above de minimis threshold for" | "Address" | "Address line 1" | "Address line 2" | "An unexpected error occurred when processing PayPal order." | "Are you sure?" | "Back" | "Billing" | "Billing address" | "Cancel" | "Card number copied to clipboard" | "Cart subtotal" | "City" | "Click to copy the card number. Use any future expiration date and three number CVC." | "Close" | "Contact" | "Continue to shipping" | "Couldn't place order" | "Customer information" | "Delivery options" | "Don't close" | "Duties & taxes in Australia, VAT or GST is [percentage] and is due on all orders." | "Duties and taxes will be applied to items and shipping." | "Duties will apply to all orders." | "Duties, taxes, and fees" | "Error creating Checkout" | "Error updating Checkout" | "Expected delivery" | "Failed to create PayPal order. Please try again, or consider using an alternative method." | "First name" | "Go to payment" | "Keep shopping" | "Know about duties and taxes before you buy. Shop with confidence!" | "Last name" | "Learn more." | "Missing required fields. Make sure all fields are completed." | "No shipping method selected" | "No shipping methods found - please review and update your address details by selecting the \"Customer\" tab above. If you continue to encounter issues, contact our support team for assistance." | "No shipping methods found - try editing your address or contacting support if the error persists" | "Nothing due at the door" | "Order is over the de minimis threshold for both duty and tax" | "Order total" | "Orders to [countryName] must be over [threshold] to ship." | "Pay [orderTotal]" | "Pay [organizationName]" | "Payment failed" | "Payment failed. Please try another payment method." | "Payment method" | "Payment processing. We'll update you when payment is received." | "Phone number" | "Please ensure your text uses the Latin alphabet only (A-Z, a-z)." | "Postal code" | "Powered by" | "Prepay duties and taxes at checkout" | "Product prices already include duties, taxes, and fees. No additional duties or taxes will be added at checkout, with rare exceptions." | "Reload" | "Restricted item" | "Restricted items found" | "Return to cart" | "Search countries" | "See duty and tax thresholds" | "Select a country" | "Select a language" | "Session timed out" | "Shipping address same as billing" | "Shipping method" | "Show" | "Something went wrong." | "Spend [threshold] duty free." | "Spend [threshold] tax free." | "State" | "State/Province" | "Taxes will apply to all orders." | "Test cards" | "Test mode" | "The following items are unable to be shipped to your country and are not included in your cart total." | "The low-value GST law passed July 1st, 2018 applies to this retailer." | "There's been an error creating your checkout session. Please reload and try again or contact support if the error persists" | "There's been an error updating your checkout session. Please reload and try again or contact support if the error persists" | "To ensure delivery all address details must be in Latin characters." | "Translated address" | "Unable to check inventory. Please try again." | "Update address" | "Update your address" | "We couldn't complete your payment. Please verify the payment details and try again." | "We've sent an email confirmation of the order details for your review. And our team is carefully preparing your order so it arrives on time." | "Welcome to [storeName]" | "Welcome!" | "What you entered" | "Would you like to close checkout and return to the site?" | "You're all set!" | "Your checkout session has expired. Please reload the page to continue." | "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." | "[percentage] GST due on any order above [threshold] along with an import entry transaction fee and MPI levy." | "[percentage] GST due on any order above [threshold]." | "business days" | "click to learn more" | "restricted items">(...[key, replacement]: TranslateParams<T>) => string;
|
|
33
|
+
declare const translate: <T extends "Shipping" | "Email" | "Name" | "Guaranteed" | "Customer" | "Country" | "Failure" | "Success" | "Hide" | "or" | "Delivery" | "Payment" | "Above de minimis threshold for" | "Address" | "Address line 1" | "Address line 2" | "An unexpected error occurred when processing PayPal order." | "Are you sure?" | "Back" | "Billing" | "Billing address" | "Cancel" | "Card number copied to clipboard" | "Cart subtotal" | "City" | "Click to copy the card number. Use any future expiration date and three number CVC." | "Close" | "Contact" | "Continue to shipping" | "Couldn't place order" | "Customer information" | "Delivery options" | "Don't close" | "Duties & taxes in Australia, VAT or GST is [percentage] and is due on all orders." | "Duties and taxes will be applied to items and shipping." | "Duties will apply to all orders." | "Duties, taxes, and fees" | "Error creating Checkout" | "Error updating Checkout" | "Expected delivery" | "Failed to create PayPal order. Please try again, or consider using an alternative method." | "First name" | "Go to payment" | "Keep shopping" | "Know about duties and taxes before you buy. Shop with confidence!" | "Last name" | "Learn more." | "Missing required fields. Make sure all fields are completed." | "No countries found" | "No shipping method selected" | "No shipping methods found - please review and update your address details by selecting the \"Customer\" tab above. If you continue to encounter issues, contact our support team for assistance." | "No shipping methods found - try editing your address or contacting support if the error persists" | "Nothing due at the door" | "Order is over the de minimis threshold for both duty and tax" | "Order total" | "Orders to [countryName] must be over [threshold] to ship." | "Pay [orderTotal]" | "Pay [organizationName]" | "Payment failed" | "Payment failed. Please try another payment method." | "Payment method" | "Payment processing. We'll update you when payment is received." | "Phone number" | "Please ensure your text uses the Latin alphabet only (A-Z, a-z)." | "Postal code" | "Powered by" | "Prepay duties and taxes at checkout" | "Product prices already include duties, taxes, and fees. No additional duties or taxes will be added at checkout, with rare exceptions." | "Reload" | "Restricted item" | "Restricted items found" | "Return to cart" | "Search countries" | "See duty and tax thresholds" | "Select a country" | "Select a language" | "Session timed out" | "Shipping address same as billing" | "Shipping method" | "Show" | "Something went wrong." | "Spend [threshold] duty free." | "Spend [threshold] tax free." | "State" | "State/Province" | "Taxes will apply to all orders." | "Test cards" | "Test mode" | "The following items are unable to be shipped to your country and are not included in your cart total." | "The low-value GST law passed July 1st, 2018 applies to this retailer." | "There's been an error creating your checkout session. Please reload and try again or contact support if the error persists" | "There's been an error updating your checkout session. Please reload and try again or contact support if the error persists" | "To ensure delivery all address details must be in Latin characters." | "Translated address" | "Unable to check inventory. Please try again." | "Update address" | "Update your address" | "We couldn't complete your payment. Please verify the payment details and try again." | "We've sent an email confirmation of the order details for your review. And our team is carefully preparing your order so it arrives on time." | "Welcome to [storeName]" | "Welcome!" | "What you entered" | "Would you like to close checkout and return to the site?" | "You're all set!" | "Your checkout session has expired. Please reload the page to continue." | "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." | "[percentage] GST due on any order above [threshold] along with an import entry transaction fee and MPI levy." | "[percentage] GST due on any order above [threshold]." | "business days" | "click to learn more" | "restricted items">(...[key, replacement]: TranslateParams<T>) => string;
|
|
34
34
|
export { translate, translationStore, translationStoreUpdateLanguage };
|