@zonos/elements 1.3.40 → 1.3.42
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-99a1ed87.js} +67 -10
- 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 +21 -7
- 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-5509a76f.js} +3 -3
- package/dist/cjs/{sendErrorLog-7818b288.js → sendErrorLog-21996939.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/zonos-hello.js +6 -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/collection/components/utils/handleFetch.js +0 -6
- package/dist/collection/components/utils/hello/currencyConversion/defaultCurrencyConverter.js +4 -1
- package/dist/collection/environment.js +6 -0
- package/dist/collection/scripts/_getNextFallbackUrl.js +1 -1
- package/dist/collection/scripts/_getZonosQaUrl.js +12 -1
- package/dist/collection/scripts/_zonosBase.js +4 -1
- package/dist/esm/{cart-e9cd8286.js → cart-bc217300.js} +67 -10
- 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 +21 -7
- 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-fa96e7c3.js} +3 -3
- package/dist/esm/{sendErrorLog-2fcf78a2.js → sendErrorLog-c40b553a.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-bc217300.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-fa96e7c3.js} +1 -1
- package/dist/esm-es5/{sendErrorLog-2fcf78a2.js → sendErrorLog-c40b553a.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 +141 -52
- 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/hello/zonos-hello/zonos-hello.d.ts +2 -1
- 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 +82 -1
- package/dist/types/environment.d.ts +4 -0
- package/dist/types/scripts/_getNextFallbackUrl.d.ts +3 -3
- package/dist/types/types/LogLoadScriptRequestBody.d.ts +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-1041cbd0.js} +1 -1
- package/dist/zonos-elements/{p-2c03ac78.system.entry.js → p-14067782.system.entry.js} +1 -1
- package/dist/zonos-elements/p-16dd23e1.entry.js +1 -0
- package/dist/zonos-elements/{p-1daa3b1e.system.entry.js → p-1e4f7997.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-3d98f422.system.entry.js → p-211e3529.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-dc6a17fe.system.entry.js → p-23748211.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-6897be29.entry.js → p-23fd4673.entry.js} +1 -1
- package/dist/zonos-elements/{p-efdc7748.entry.js → p-25633055.entry.js} +1 -1
- package/dist/zonos-elements/{p-916adba7.entry.js → p-29ed14b8.entry.js} +1 -1
- package/dist/zonos-elements/{p-36df9785.entry.js → p-2cc469c3.entry.js} +1 -1
- package/dist/zonos-elements/{p-fa02dd07.system.entry.js → p-35679ed2.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-c5a5512a.system.entry.js → p-3b1ea7c8.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-b2007124.system.js → p-40c21634.system.js} +1 -1
- package/dist/zonos-elements/{p-e6efc2e1.system.entry.js → p-4f454a91.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-bfa5ec2b.entry.js → p-5230520c.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-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-558486eb.entry.js} +1 -1
- package/dist/zonos-elements/p-5b7da777.js +2 -0
- package/dist/zonos-elements/{p-54971a77.system.js → p-668fb530.system.js} +1 -1
- package/dist/zonos-elements/p-68bb8de4.entry.js +1 -0
- 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-d9d5ee2f.entry.js → p-6de38759.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-14b53e8f.system.entry.js → p-7338ea95.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-ca58f16e.system.entry.js → p-73c56565.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-8d149b99.entry.js → p-7a902328.entry.js} +1 -1
- package/dist/zonos-elements/{p-c55a5fe4.system.entry.js → p-7d67bbb8.system.entry.js} +1 -1
- 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-90f517f5.js +1 -0
- 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-98a0fda1.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-a0581551.system.js +1 -0
- package/dist/zonos-elements/{p-70b024ad.system.entry.js → p-a3e2592b.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-3447ef24.system.js → p-a8a94872.system.js} +1 -1
- package/dist/zonos-elements/{p-e252d86f.entry.js → p-a9ae78e3.entry.js} +1 -1
- package/dist/zonos-elements/{p-445fb353.system.entry.js → p-c0aec0ca.system.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-d27489bb.system.entry.js +1 -0
- package/dist/zonos-elements/{p-7f96d3b4.entry.js → p-dc368ad5.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-c87113fb.system.entry.js → p-f59666e6.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-d6135575.js → p-f97ffbfb.js} +1 -1
- package/dist/zonos-elements/{p-3b6a7200.entry.js → p-fc2676e3.entry.js} +1 -1
- package/dist/zonos-elements/{p-b55b557a.system.js → p-fd061229.system.js} +2 -2
- package/dist/zonos-elements/zonos-elements.css +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-3996d025.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
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { h, Host } from "@stencil/core";
|
|
2
|
+
/**
|
|
3
|
+
* The idea is from
|
|
4
|
+
* @ref https://github.com/beenotung/stencil-virtual-scroll/blob/master/src/components/virtual-scroll-list/virtual-scroll-list.scss
|
|
5
|
+
* @ref https://github.dev/ionic-team/ionic-framework/blob/v6.7.5/core/src/components/virtual-scroll/virtual-scroll.tsx
|
|
6
|
+
*/
|
|
7
|
+
export class ZonosVirtualScroll {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.scrollListener = (_ev) => {
|
|
10
|
+
this.scrollTop = this.ele.scrollTop;
|
|
11
|
+
};
|
|
12
|
+
this.container = undefined;
|
|
13
|
+
this.renderItem = undefined;
|
|
14
|
+
this.itemWidth = undefined;
|
|
15
|
+
this.fallbackItemHeight = undefined;
|
|
16
|
+
this.itemHeights = undefined;
|
|
17
|
+
this.scrollTop = 0;
|
|
18
|
+
this.totalHeight = 1;
|
|
19
|
+
}
|
|
20
|
+
updateTotalHeight() {
|
|
21
|
+
this.totalHeight = this.itemHeights.reduce((acc, height) => acc + (height || this.fallbackItemHeight), 0);
|
|
22
|
+
}
|
|
23
|
+
connectedCallback() {
|
|
24
|
+
this.ele.addEventListener('scroll', this.scrollListener);
|
|
25
|
+
this.updateTotalHeight();
|
|
26
|
+
}
|
|
27
|
+
disconnectedCallback() {
|
|
28
|
+
this.ele.removeEventListener('scroll', this.scrollListener);
|
|
29
|
+
}
|
|
30
|
+
render() {
|
|
31
|
+
const W = this.ele.clientWidth;
|
|
32
|
+
const H = this.ele.clientHeight;
|
|
33
|
+
const heights = this.itemHeights;
|
|
34
|
+
const fallbackItemHeight = this.fallbackItemHeight;
|
|
35
|
+
const N = this.itemHeights.length;
|
|
36
|
+
const scrollTop = this.scrollTop;
|
|
37
|
+
const children = [];
|
|
38
|
+
let accHeight = 0;
|
|
39
|
+
// buffer for pre-rendering for item outside of viewport
|
|
40
|
+
const buffer = 100;
|
|
41
|
+
for (let i = 0; i < N; i++) {
|
|
42
|
+
const itemHeight = heights[i] || fallbackItemHeight;
|
|
43
|
+
if (scrollTop > accHeight + itemHeight + buffer) {
|
|
44
|
+
accHeight += itemHeight;
|
|
45
|
+
continue; // this item is above the viewport
|
|
46
|
+
}
|
|
47
|
+
if (scrollTop + H < accHeight - buffer) {
|
|
48
|
+
break; // this item is below the viewport
|
|
49
|
+
}
|
|
50
|
+
const x = 0;
|
|
51
|
+
const y = accHeight;
|
|
52
|
+
children.push(h("div", { class: "item", style: {
|
|
53
|
+
height: `${itemHeight}px`,
|
|
54
|
+
transform: `translate(${x}px,${y}px)`,
|
|
55
|
+
width: this.itemWidth ? `${this.itemWidth}px` : `${W}px`,
|
|
56
|
+
} }, this.renderItem(i)));
|
|
57
|
+
accHeight += itemHeight;
|
|
58
|
+
}
|
|
59
|
+
return (h(Host, { key: '6faa73cacfefee42781f87e6f697980941139d12' }, h("div", { key: '5411c13934b8b997f68bc6678e6e1c475d6d453c',
|
|
60
|
+
// to capture scroll action
|
|
61
|
+
class: "scroller", style: {
|
|
62
|
+
height: `${this.totalHeight}px`,
|
|
63
|
+
width: `${W}px`,
|
|
64
|
+
} }), h("div", { key: '46c402a5a0df3242b9022e16b15d5e348210bc32',
|
|
65
|
+
// to display items
|
|
66
|
+
class: "item-container", ref: el => (this.container = el), style: {
|
|
67
|
+
height: `${this.totalHeight}px`,
|
|
68
|
+
left: `${-W}px`,
|
|
69
|
+
} }, children)));
|
|
70
|
+
}
|
|
71
|
+
static get is() { return "zonos-virtual-scroll"; }
|
|
72
|
+
static get encapsulation() { return "scoped"; }
|
|
73
|
+
static get originalStyleUrls() {
|
|
74
|
+
return {
|
|
75
|
+
"$": ["zonos-virtual-scroll.scss"]
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
static get styleUrls() {
|
|
79
|
+
return {
|
|
80
|
+
"$": ["zonos-virtual-scroll.css"]
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
static get properties() {
|
|
84
|
+
return {
|
|
85
|
+
"renderItem": {
|
|
86
|
+
"type": "unknown",
|
|
87
|
+
"mutable": false,
|
|
88
|
+
"complexType": {
|
|
89
|
+
"original": "(\n itemIndex: number,\n ) =>\n | HTMLElement\n | Promise<HTMLElement>\n | HTMLElement[]\n | Promise<HTMLElement[]>\n | Promise<HTMLElement>[]",
|
|
90
|
+
"resolved": "(itemIndex: number) => HTMLElement | HTMLElement[] | Promise<HTMLElement> | Promise<HTMLElement[]> | Promise<HTMLElement>[]",
|
|
91
|
+
"references": {
|
|
92
|
+
"HTMLElement": {
|
|
93
|
+
"location": "global",
|
|
94
|
+
"id": "global::HTMLElement"
|
|
95
|
+
},
|
|
96
|
+
"Promise": {
|
|
97
|
+
"location": "global",
|
|
98
|
+
"id": "global::Promise"
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
"required": true,
|
|
103
|
+
"optional": false,
|
|
104
|
+
"docs": {
|
|
105
|
+
"tags": [],
|
|
106
|
+
"text": "Render item"
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
"itemWidth": {
|
|
110
|
+
"type": "number",
|
|
111
|
+
"mutable": false,
|
|
112
|
+
"complexType": {
|
|
113
|
+
"original": "number",
|
|
114
|
+
"resolved": "number | undefined",
|
|
115
|
+
"references": {}
|
|
116
|
+
},
|
|
117
|
+
"required": false,
|
|
118
|
+
"optional": true,
|
|
119
|
+
"docs": {
|
|
120
|
+
"tags": [],
|
|
121
|
+
"text": "Width of each item"
|
|
122
|
+
},
|
|
123
|
+
"attribute": "item-width",
|
|
124
|
+
"reflect": false
|
|
125
|
+
},
|
|
126
|
+
"fallbackItemHeight": {
|
|
127
|
+
"type": "number",
|
|
128
|
+
"mutable": false,
|
|
129
|
+
"complexType": {
|
|
130
|
+
"original": "number",
|
|
131
|
+
"resolved": "number",
|
|
132
|
+
"references": {}
|
|
133
|
+
},
|
|
134
|
+
"required": true,
|
|
135
|
+
"optional": false,
|
|
136
|
+
"docs": {
|
|
137
|
+
"tags": [],
|
|
138
|
+
"text": "Height that is used as a fallback if height is not provided"
|
|
139
|
+
},
|
|
140
|
+
"attribute": "fallback-item-height",
|
|
141
|
+
"reflect": false
|
|
142
|
+
},
|
|
143
|
+
"itemHeights": {
|
|
144
|
+
"type": "unknown",
|
|
145
|
+
"mutable": false,
|
|
146
|
+
"complexType": {
|
|
147
|
+
"original": "number[]",
|
|
148
|
+
"resolved": "number[]",
|
|
149
|
+
"references": {}
|
|
150
|
+
},
|
|
151
|
+
"required": true,
|
|
152
|
+
"optional": false,
|
|
153
|
+
"docs": {
|
|
154
|
+
"tags": [],
|
|
155
|
+
"text": "Heights list of each item"
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
static get states() {
|
|
161
|
+
return {
|
|
162
|
+
"container": {},
|
|
163
|
+
"scrollTop": {},
|
|
164
|
+
"totalHeight": {}
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
static get elementRef() { return "ele"; }
|
|
168
|
+
static get watchers() {
|
|
169
|
+
return [{
|
|
170
|
+
"propName": "itemHeights",
|
|
171
|
+
"methodName": "updateTotalHeight"
|
|
172
|
+
}, {
|
|
173
|
+
"propName": "fallbackItemHeight",
|
|
174
|
+
"methodName": "updateTotalHeight"
|
|
175
|
+
}];
|
|
176
|
+
}
|
|
177
|
+
}
|
|
@@ -10,7 +10,7 @@ export class ZonosComponent {
|
|
|
10
10
|
return format(this.first, this.middle, this.last);
|
|
11
11
|
}
|
|
12
12
|
render() {
|
|
13
|
-
return h("div", { key: '
|
|
13
|
+
return h("div", { key: 'ece01ba1df61d0c15e60d2cf9fffbf4c01268612' }, "Hello, World! I'm ", this.getText());
|
|
14
14
|
}
|
|
15
15
|
static get is() { return "zonos-component"; }
|
|
16
16
|
static get encapsulation() { return "shadow"; }
|
|
@@ -447,12 +447,17 @@ export class ZonosHello {
|
|
|
447
447
|
return {
|
|
448
448
|
"getCountryList": {
|
|
449
449
|
"complexType": {
|
|
450
|
-
"signature": "() => Promise<
|
|
450
|
+
"signature": "() => Promise<ICountryJson | null>",
|
|
451
451
|
"parameters": [],
|
|
452
452
|
"references": {
|
|
453
453
|
"Promise": {
|
|
454
454
|
"location": "global",
|
|
455
455
|
"id": "global::Promise"
|
|
456
|
+
},
|
|
457
|
+
"ICountryJson": {
|
|
458
|
+
"location": "import",
|
|
459
|
+
"path": "src/types/ICountryJson",
|
|
460
|
+
"id": "src/types/ICountryJson.ts::ICountryJson"
|
|
456
461
|
}
|
|
457
462
|
},
|
|
458
463
|
"return": "Promise<ICountryJson | null>"
|
|
@@ -18,9 +18,9 @@ export class ZonosHelloDialogFooter {
|
|
|
18
18
|
const language = (_b = languages.find(x => x.code === localizationStore.selectedLocale)) === null || _b === void 0 ? void 0 : _b.translatedLabel;
|
|
19
19
|
// Only use gray-0 (white) when the background color is dark (apply inverted color if the element is using dark theme variable)
|
|
20
20
|
const mainColor = primaryColor && isDarkColor(primaryColor) ? 'white' : 'black';
|
|
21
|
-
return (h(Host, { key: '
|
|
21
|
+
return (h(Host, { key: 'a9b52a67a2db1967fe6fde4f19dc8d2785469f8a', class: "zonos--elements" }, h("div", { key: '1b36f45f0f00fe2b6494fb04373b12b4848b9484', class: "zonos--hello-dialog-footer", style: {
|
|
22
22
|
'--primary-color': primaryColor,
|
|
23
|
-
} }, h("a", { key: '
|
|
23
|
+
} }, h("a", { key: '7ca110d30f9266d021069af41766588ffce3d2ad', href: "https://zonos.com", target: "_blank", title: "Zonos website" }, h("zonos-icon", { key: 'f9f4866c18bc75577e5a3961ffdd67f48977fd68', "aria-label": "Zonos Logo", autoHeight: true, content: ZonosIcon, iconColor: mainColor, size: 108 })), h("div", { key: '2bacafbd2c2d9c79935b7a2c69ae9fd3e1ede48a', class: "zonos--hello-locale-wrapper" }, h("zonos-button", { key: 'a223f6706d319da505e8f013bff6863a433effd3', buttonColor: mainColor, icon: h("zonos-icon", { "aria-label": "Open language select", content: Globe, iconColor: mainColor }), onClick: () => this.setShowLanguageSelect(true), variant: "subtle" }, language), h("zonos-button", { key: 'aa94f1e06b80f6bec8433c3c8a7b066f0d91df08', buttonColor: mainColor, icon: h("zonos-country-flag", { "aria-label": "Open country select", class: "zonos--footer-country-flag", countryCode: localizationStore.selectedCountryCode }), onClick: () => this.setShowCountrySelect(true), variant: "subtle" }, localizationStore.selectedCountryCode)))));
|
|
24
24
|
}
|
|
25
25
|
static get is() { return "zonos-hello-dialog-footer"; }
|
|
26
26
|
static get encapsulation() { return "shadow"; }
|
|
@@ -198,18 +198,18 @@ export class ZonosHelloDialog {
|
|
|
198
198
|
const defaultMessage = formatStringWithLinks(defaultMessageStr);
|
|
199
199
|
const currentPage = this.getCurrentPageEnum();
|
|
200
200
|
const filteredMessages = customMessages.filter(x => x.pageName === currentPage);
|
|
201
|
-
return (h(Host, { key: '
|
|
201
|
+
return (h(Host, { key: '7dec47839d142b9d3580dffda8b8eea28af9974f', class: "zonos--elements" }, h("div", { key: 'ea71e8885de2be45be5a2dcc9dbe44ef99261102', class: classes([
|
|
202
202
|
'zonos--hello-dialog',
|
|
203
203
|
animateLeft && 'zonos--hello-dialog-animate-from-left',
|
|
204
204
|
animateFromBottom && 'zonos--hello-dialog-animate-from-bottom',
|
|
205
205
|
!!this.mobileLocationOverride &&
|
|
206
206
|
'zonos--hello-dialog-mobile-override',
|
|
207
207
|
this.isOpen && 'zonos--hello-dialog-open',
|
|
208
|
-
]), inert: !this.isOpen, ref: el => el && (this.dialogRef = el) }, !this.showCountrySelect && !this.showLanguageSelect && (h("div", { key: '
|
|
208
|
+
]), inert: !this.isOpen, ref: el => el && (this.dialogRef = el) }, !this.showCountrySelect && !this.showLanguageSelect && (h("div", { key: '2e66e1610e534de2fd4f4f5bce29e899f6c65877' }, h("div", { key: '598ffd431b5fcab10f7a7cb3c453fd959abdd881', class: "zonos--hello-dialog-content" }, h("zonos-button", { key: '68998e9634998a6b6d244540776c2bc18fb54c27', class: "zonos--close-button", icon: h("zonos-icon", { "aria-label": "Close Zonos Hello dialog", content: RemoveIcon }), noBackground: true, onClick: () => this.setIsOpen(false) }), h("zonos-v-stack", { key: '660c8ae672b70185a046280d9e27b3fce8ad3e00', spacing: 24 }, h("zonos-country-flag", { key: '46f9733add5cf8038944e2c7c48a14f6f39f831a', class: "zonos--hello-country-flag", countryCode: selectedCountryCode }), h("zonos-v-stack", { key: 'e0571eae7cfd1a6555b16dd3ac450a8545095231', class: "zonos--hello-dialog-header", spacing: 4 }, h("zonos-text", { key: 'fffa08e2519973aafc2813246b7df2f9e4895a0d', type: "boldSubheader" }, welcomeMessage), h("zonos-text", { key: 'ef78eead5a3fd2ce7ad881deb6472ca70e18032d', innerHTML: defaultMessage, textColor: "gray-800" })), h("zonos-v-stack", { key: 'cd2632bb7a2655a240715601c32df6c807c283a1', spacing: 8 }, this.restrictedItems.map(item => {
|
|
209
209
|
var _a;
|
|
210
210
|
return item && (h("zonos-banner", { bannerTitle: item.name, intent: "error" }, (_a = item.itemRestrictions) === null || _a === void 0 ? void 0 : _a.map(x => (h("zonos-text", { textColor: "red-800" }, x === null || x === void 0 ? void 0 : x.note)))));
|
|
211
|
-
}), h("zonos-card", { key: '
|
|
212
|
-
additionalInformation.map(info => (h("div", { class: "zonos--flex-message" }, h("zonos-icon", { "aria-label": "Additional information for buying goods from selected country", content: BagIcon }), h("zonos-text", { innerHTML: info })))))), filteredMessages.map(x => (h("zonos-custom-message", { icon: MessageIcon, message: x.message })))))), h("zonos-hello-dialog-footer", { key: '
|
|
211
|
+
}), h("zonos-card", { key: 'ad5f69b84e2fd80864a6772216aa28b6558f12c4', spacing: "12px" }, h("zonos-v-stack", { key: '86b8c89c17b9b1348bf56c9a6fa2be3de11cb841', spacing: 12 }, hasInclusivePrices ? (h("div", { class: "zonos--flex-message" }, h("zonos-icon", { "aria-label": "Duty de minimis", content: InclusivePricingIcon }), h("zonos-text", null, inclusivePriceMessage))) : (h(Fragment, null, h("div", { class: "zonos--flex-message" }, h("zonos-icon", { "aria-label": "Duty de minimis", content: ImportIcon }), h("zonos-text", null, dutyDeMinimisMessage)), h("div", { class: "zonos--flex-message" }, h("zonos-icon", { "aria-label": "Tax de minimis", content: MoneyIcon }), h("zonos-text", null, taxDeMinimisMessage)))), additionalInformation === null || additionalInformation === void 0 ? void 0 :
|
|
212
|
+
additionalInformation.map(info => (h("div", { class: "zonos--flex-message" }, h("zonos-icon", { "aria-label": "Additional information for buying goods from selected country", content: BagIcon }), h("zonos-text", { innerHTML: info })))))), filteredMessages.map(x => (h("zonos-custom-message", { icon: MessageIcon, message: x.message })))))), h("zonos-hello-dialog-footer", { key: '2dc162a5dc40d781009379ef8276ebcd38a26494', appearanceSettings: this.appearanceSettings, setShowCountrySelect: value => this.setShowCountrySelect(value), setShowLanguageSelect: value => this.setShowLanguageSelect(value) }))), this.showCountrySelect && (h("div", { key: 'a86eaaa8536432db2d4e63c3d3b4122349edeba6' }, h("zonos-country-select", { key: '2d0ec209c2500763b1656f07f8685818ee329e1e', handleOnClose: () => this.setShowCountrySelect(false) }))), this.showLanguageSelect && (h("div", { key: 'd1c7f801e301635028dd2f6a478a93d72fc968f7' }, h("zonos-language-select", { key: '95e40b3c1e44d437d466fbc704c7e95ebdf8ec3c', handleOnClose: () => this.setShowLanguageSelect(false) }))))));
|
|
213
213
|
}
|
|
214
214
|
static get is() { return "zonos-hello-dialog"; }
|
|
215
215
|
static get encapsulation() { return "shadow"; }
|
|
@@ -186,7 +186,7 @@ export class ZonosController {
|
|
|
186
186
|
zonosStore.organizationName = organizationName;
|
|
187
187
|
}
|
|
188
188
|
render() {
|
|
189
|
-
return h(Host, { key: '
|
|
189
|
+
return h(Host, { key: '8738fa5324977321764af1c89181550d948955a6', class: "zonos--elements" });
|
|
190
190
|
}
|
|
191
191
|
static get is() { return "zonos-controller"; }
|
|
192
192
|
static get encapsulation() { return "shadow"; }
|
|
@@ -41,7 +41,7 @@ export class ZonosPaypalPayment {
|
|
|
41
41
|
void this.loadPaypal();
|
|
42
42
|
}
|
|
43
43
|
render() {
|
|
44
|
-
return (h(Host, { key: '
|
|
44
|
+
return (h(Host, { key: 'a09fe5b66b1ac971c10529ecb6213479f2870f08', class: "zonos--paypal-payment zonos--elements" }, h("div", { key: '6ba337785b8a90965e0cba05fd62681bc92633fe', class: "zonos--payment-paypal-container" })));
|
|
45
45
|
}
|
|
46
46
|
static get is() { return "zonos-paypal-payment"; }
|
|
47
47
|
static get encapsulation() { return "scoped"; }
|
|
@@ -131,6 +131,9 @@ export const stringsIndonesian = {
|
|
|
131
131
|
Name: {
|
|
132
132
|
value: 'Nama',
|
|
133
133
|
},
|
|
134
|
+
'No countries found': {
|
|
135
|
+
value: 'Tidak ada negara yang ditemukan',
|
|
136
|
+
},
|
|
134
137
|
'No shipping method selected': {
|
|
135
138
|
value: 'Tidak ada metode pengiriman yang dipilih',
|
|
136
139
|
},
|
|
@@ -135,7 +135,7 @@ export class ZonosAddress {
|
|
|
135
135
|
}
|
|
136
136
|
render() {
|
|
137
137
|
// this component loads iframe from the stripe elements and puts here, so we don't need to do anything here
|
|
138
|
-
return (h(Host, { key: '
|
|
138
|
+
return (h(Host, { key: '2cecb49ed22bd0d5ce22c4f2110b37ecf7935cca', class: "zonos--address zonos--elements" }, h("zonos-text", { key: '101635210ab6cb3b9a44b47eec101187d1c3a4ac', class: "zonos--title", type: "semiBoldLabel" }, this.titleText), h("div", { key: '049f2b86986471d45bd413813307ec489d9f1993', class: "zonos--address-component" })));
|
|
139
139
|
}
|
|
140
140
|
static get is() { return "zonos-address"; }
|
|
141
141
|
static get encapsulation() { return "scoped"; }
|
package/dist/collection/components/stripe/zonos-link-authentication/zonos-link-authentication.js
CHANGED
|
@@ -42,7 +42,7 @@ export class ZonosLinkAuthentication {
|
|
|
42
42
|
}
|
|
43
43
|
render() {
|
|
44
44
|
// this component loads iframe from the stripe elements and puts here, so we don't need to do anything here
|
|
45
|
-
return (h(Host, { key: '
|
|
45
|
+
return (h(Host, { key: 'f0b26abf99ef99c6665dabdddebc9ff086b6816c', class: "zonos--link-authentication zonos--elements" }, h("zonos-text", { key: '898dbdffac06fe2a68af90610a22044bb72391ce', class: "zonos--title", type: "semiBoldLabel" }, this.titleText), h("div", { key: 'e2ec9abb0cf76a39a1262e1366e375dd898450cd', class: "zonos--link-authentication-component" })));
|
|
46
46
|
}
|
|
47
47
|
static get is() { return "zonos-link-authentication"; }
|
|
48
48
|
static get encapsulation() { return "scoped"; }
|
|
@@ -36,7 +36,7 @@ export class ZonosPayment {
|
|
|
36
36
|
}
|
|
37
37
|
render() {
|
|
38
38
|
// this component loads iframe from the stripe elements and puts here, so we don't need to do anything here
|
|
39
|
-
return (h(Host, { key: '
|
|
39
|
+
return (h(Host, { key: 'ab601d9a0cc6fe2fee19f45d6321dcc81b418cff', class: "zonos--payment zonos--elements" }, this.titleText && (h("zonos-text", { key: '27857c99c59e4913fa403ef5b23b5b7d7f32bd45', class: "zonos--title", type: "semiBoldLabel" }, this.titleText)), h("div", { key: '329b5a5617f0c5942b209df1ccf3bfcb4ddabb0c', class: "zonos--payment-component" }), h("div", { key: '7abb08922e9f607314713fc9fa762a3bb8a35b13', class: "zonos--payment-paypal-container" })));
|
|
40
40
|
}
|
|
41
41
|
static get is() { return "zonos-payment"; }
|
|
42
42
|
static get encapsulation() { return "scoped"; }
|
|
@@ -52,12 +52,6 @@ const handleRequest = async (url, options) => {
|
|
|
52
52
|
const usingZonosPreview = window.Zonos.zonosQaUrl;
|
|
53
53
|
// We only want to alert once if the user is in preview mode and it's also using production environment
|
|
54
54
|
if (!window.Zonos.modeAlerted && zonosMode && usingZonosPreview) {
|
|
55
|
-
if (zonosMode === 'production') {
|
|
56
|
-
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!`);
|
|
57
|
-
}
|
|
58
|
-
if (zonosMode === 'test') {
|
|
59
|
-
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`);
|
|
60
|
-
}
|
|
61
55
|
window.Zonos.modeAlerted = true;
|
|
62
56
|
}
|
|
63
57
|
if (response.ok) {
|
package/dist/collection/components/utils/hello/currencyConversion/defaultCurrencyConverter.js
CHANGED
|
@@ -40,7 +40,10 @@ const convertCurrency = (element) => {
|
|
|
40
40
|
});
|
|
41
41
|
// default to the currencyConvertAndFormat if the currencyConverter function does not return a value, or invalid value. This is to make sure we don't break the merchant's price.
|
|
42
42
|
const observedFormattedValue = customizedCurrencyFormat || currencyConvertAndFormat(amount);
|
|
43
|
-
element.textContent
|
|
43
|
+
if (observedFormattedValue !== element.textContent) {
|
|
44
|
+
// Only set textContent if the value has changed, this is to prevent it redrawing the element if the value is the same
|
|
45
|
+
element.textContent = observedFormattedValue;
|
|
46
|
+
}
|
|
44
47
|
// save the new rate to the data-zrate attribute
|
|
45
48
|
element.setAttribute('data-zrate', rate.toString());
|
|
46
49
|
// save the new value to the data-zintl attribute
|
|
@@ -21,6 +21,10 @@ const JS_DELIVR_ZONOS_URL = `https://cdn.jsdelivr.net/npm/@zonos/elements@${pack
|
|
|
21
21
|
* @example https://unpkg.com/@zonos/elements@1.3.15/dist/scripts/zonos.js
|
|
22
22
|
*/
|
|
23
23
|
const UNPKG_ZONOS_URL = `https://unpkg.com/@zonos/elements@${packageVersion}`;
|
|
24
|
+
/**
|
|
25
|
+
* @example https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.41/dist/scripts/loadZonos.js
|
|
26
|
+
*/
|
|
27
|
+
const CDNJS_ZONOS_URL = `https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/${packageVersion}`;
|
|
24
28
|
const currentBranch = process.env.VERCEL_GIT_COMMIT_REF || process.env.BRANCH_NAME;
|
|
25
29
|
export const formattedUrl = ({ branchName, inCI: _inCI, inVercel: _inVercel, isVercelPreview: _isVercelPreview, packageVersion: _packageVersion, type = 'full', url, }) => {
|
|
26
30
|
if (!url) {
|
|
@@ -121,6 +125,7 @@ else {
|
|
|
121
125
|
const envClient = {
|
|
122
126
|
NEXT_PUBLIC_FLAG_URL: z.string(),
|
|
123
127
|
NEXT_PUBLIC_ZONOS_API_KEY: z.string(),
|
|
128
|
+
NEXT_PUBLIC_ZONOS_CDNJS_CDN_URL: z.string(),
|
|
124
129
|
NEXT_PUBLIC_ZONOS_CDN_URL: z.string(),
|
|
125
130
|
NEXT_PUBLIC_ZONOS_JS_DELIVR_CDN_URL: z.string(),
|
|
126
131
|
NEXT_PUBLIC_ZONOS_PACKAGE_VERSION: z.string(),
|
|
@@ -145,6 +150,7 @@ export const env = createEnv({
|
|
|
145
150
|
runtimeEnvStrict: {
|
|
146
151
|
NEXT_PUBLIC_FLAG_URL: process.env.NEXT_PUBLIC_FLAG_URL,
|
|
147
152
|
NEXT_PUBLIC_ZONOS_API_KEY: process.env.NEXT_PUBLIC_ZONOS_API_KEY,
|
|
153
|
+
NEXT_PUBLIC_ZONOS_CDNJS_CDN_URL: CDNJS_ZONOS_URL,
|
|
148
154
|
/**
|
|
149
155
|
* Versioning url for production environment
|
|
150
156
|
* @example v1.2.3.js.zonos.com
|
|
@@ -4,10 +4,21 @@ import { extractZonosQaUrl } from "./_extractZonosQaUrl";
|
|
|
4
4
|
* Get the Zonos QA URL and return it. Will remove `zonosQaUrl` from the url query if it doesn't exists.
|
|
5
5
|
*/
|
|
6
6
|
export const getZonosQaUrl = () => {
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* This is flag to force load cdn for testing purpose
|
|
9
|
+
* When developing, if the script load is from `dev.elements.zonos.com`,
|
|
10
|
+
* it would load script from that same domain instead of loading from cdn
|
|
11
|
+
*/
|
|
12
|
+
const shoudForceLoadCdn = window && window.location.href.includes('forceLoadCdn');
|
|
13
|
+
if (typeof window === 'undefined' || shoudForceLoadCdn) {
|
|
8
14
|
return null;
|
|
9
15
|
}
|
|
10
16
|
const qaUrl = extractZonosQaUrl(window.location.href);
|
|
17
|
+
const cdnUrl = process.env.NEXT_PUBLIC_ZONOS_CDN_URL;
|
|
18
|
+
// when the qaUrl is not set and the built URL is from the test domain, use the test domain for testing
|
|
19
|
+
if (!qaUrl && cdnUrl.includes('test.')) {
|
|
20
|
+
return cdnUrl;
|
|
21
|
+
}
|
|
11
22
|
// when local demo app is running, it needs to use the local dev script unless the qaUrl is set
|
|
12
23
|
if (!qaUrl && window.location.hostname === 'dev.demo.elements.zonos.com') {
|
|
13
24
|
return 'https://dev.elements.zonos.com';
|