@zonos/elements 1.3.4 → 1.3.5
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-f31374d4.js → cart-c1b0915c.js} +15 -4
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/isCheckoutMobile-f491ca7c.js +8 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{submitGtag-42f29b3a.js → submitGtag-bd6e9b42.js} +0 -6
- package/dist/cjs/zonos-address_2.cjs.entry.js +57 -27
- package/dist/cjs/zonos-button_2.cjs.entry.js +15 -11
- package/dist/cjs/zonos-card_2.cjs.entry.js +2 -2
- package/dist/cjs/zonos-cart-items_10.cjs.entry.js +20 -19
- package/dist/cjs/zonos-checkout.cjs.entry.js +16 -18
- package/dist/cjs/zonos-component.cjs.entry.js +1 -1
- package/dist/cjs/zonos-controller.cjs.entry.js +2 -2
- package/dist/cjs/zonos-country-flag_4.cjs.entry.js +3 -3
- package/dist/cjs/zonos-elements.cjs.js +1 -1
- package/dist/cjs/zonos-hello-dialog.cjs.entry.js +2 -2
- package/dist/cjs/zonos-payment.cjs.entry.js +2 -2
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-payment/zonos-checkout-payment.css +5 -1
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-payment/zonos-checkout-payment.js +2 -2
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.css +6 -2
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +9 -12
- package/dist/collection/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.css +5 -1
- package/dist/collection/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.js +2 -2
- package/dist/collection/components/checkout/zonos-checkout/zonos-review/zonos-review.css +7 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-shipping/zonos-shipping.css +5 -1
- package/dist/collection/components/checkout/zonos-checkout/zonos-shipping/zonos-shipping.js +2 -2
- package/dist/collection/components/common/zonos-button/zonos-button.css +2 -2
- package/dist/collection/components/common/zonos-button/zonos-button.js +13 -9
- package/dist/collection/components/common/zonos-custom-message/zonos-custom-message.js +1 -1
- package/dist/collection/components/common/zonos-dialog/zonos-dialog.js +3 -3
- package/dist/collection/components/common/zonos-logo/zonos-logo.js +2 -2
- package/dist/collection/components/common/zonos-spinner/zonos-spinner.css +41 -35
- package/dist/collection/components/common/zonos-v-stack/zonos-v-stack.js +2 -2
- 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 +2 -2
- package/dist/collection/components/main/zonos-controller.js +1 -1
- package/dist/collection/components/store/checkout/cart.js +3 -1
- package/dist/collection/components/store/checkout/stripe.js +8 -3
- package/dist/collection/components/stripe/zonos-address/zonos-address.js +57 -26
- 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/api/calculateLandedCost.js +6 -1
- package/dist/components/cart.js +15 -4
- package/dist/components/isCheckoutMobile.js +6 -0
- package/dist/components/zonos-address2.js +57 -26
- package/dist/components/zonos-button2.js +14 -10
- package/dist/components/zonos-checkout-payment2.js +3 -3
- package/dist/components/zonos-checkout.js +12 -14
- package/dist/components/zonos-component.js +1 -1
- package/dist/components/zonos-controller.js +1 -1
- package/dist/components/zonos-custom-message2.js +1 -1
- package/dist/components/zonos-customer-info2.js +3 -3
- package/dist/components/zonos-dialog2.js +3 -3
- package/dist/components/zonos-hello-dialog-footer2.js +2 -2
- package/dist/components/zonos-hello-dialog2.js +2 -2
- package/dist/components/zonos-link-authentication2.js +1 -1
- package/dist/components/zonos-logo2.js +2 -2
- package/dist/components/zonos-payment2.js +1 -1
- package/dist/components/zonos-review2.js +3 -7
- package/dist/components/zonos-shipping2.js +3 -3
- package/dist/components/zonos-spinner2.js +1 -1
- package/dist/components/zonos-v-stack2.js +2 -2
- package/dist/esm/{cart-c9124cc3.js → cart-7e7c7585.js} +15 -4
- package/dist/esm/index.js +1 -1
- package/dist/esm/isCheckoutMobile-8846dccb.js +6 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{submitGtag-a7d07aec.js → submitGtag-776c5e10.js} +1 -6
- package/dist/esm/zonos-address_2.entry.js +57 -27
- package/dist/esm/zonos-button_2.entry.js +15 -11
- package/dist/esm/zonos-card_2.entry.js +2 -2
- package/dist/esm/zonos-cart-items_10.entry.js +18 -17
- package/dist/esm/zonos-checkout.entry.js +13 -15
- package/dist/esm/zonos-component.entry.js +1 -1
- package/dist/esm/zonos-controller.entry.js +2 -2
- package/dist/esm/zonos-country-flag_4.entry.js +3 -3
- package/dist/esm/zonos-elements.js +1 -1
- package/dist/esm/zonos-hello-dialog.entry.js +2 -2
- package/dist/esm/zonos-payment.entry.js +2 -2
- package/dist/esm-es5/cart-7e7c7585.js +1 -0
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/isCheckoutMobile-8846dccb.js +1 -0
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/submitGtag-776c5e10.js +1 -0
- package/dist/esm-es5/zonos-address_2.entry.js +1 -1
- package/dist/esm-es5/zonos-button_2.entry.js +1 -1
- package/dist/esm-es5/zonos-card_2.entry.js +1 -1
- package/dist/esm-es5/zonos-cart-items_10.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_4.entry.js +1 -1
- package/dist/esm-es5/zonos-elements.js +1 -1
- package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
- package/dist/esm-es5/zonos-payment.entry.js +1 -1
- package/dist/scripts/loadZonos.js +1 -1
- package/dist/scripts/zonos.js +1 -1
- package/dist/scripts/zonosBase.js +1 -1
- package/dist/types/components/store/checkout/stripe.d.ts +1 -0
- package/dist/types/components/stripe/zonos-address/zonos-address.d.ts +5 -0
- package/dist/types/components/utils/checkout/isCheckoutMobile.d.ts +1 -1
- package/dist/zonos-elements/index.esm.js +1 -1
- package/dist/zonos-elements/p-09c5dc1b.system.entry.js +1 -0
- package/dist/zonos-elements/p-1156ae5d.system.entry.js +1 -0
- package/dist/zonos-elements/{p-7cae86a0.system.entry.js → p-120df5be.system.entry.js} +1 -1
- package/dist/zonos-elements/p-174239da.system.js +1 -0
- package/dist/zonos-elements/{p-f7b1dfd0.system.entry.js → p-18e09138.system.entry.js} +1 -1
- package/dist/zonos-elements/p-2589a038.system.entry.js +1 -0
- package/dist/zonos-elements/{p-ffc91e42.entry.js → p-31fa76da.entry.js} +1 -1
- package/dist/zonos-elements/{p-afed9236.entry.js → p-3319e4db.entry.js} +1 -1
- package/dist/zonos-elements/{p-9f3cad08.entry.js → p-357f0c61.entry.js} +1 -1
- package/dist/zonos-elements/{p-c134eecd.system.js → p-4d0861e9.system.js} +1 -1
- package/dist/zonos-elements/p-54ef8ff3.entry.js +1 -0
- package/dist/zonos-elements/{p-eb96f893.system.entry.js → p-626b5a52.system.entry.js} +1 -1
- package/dist/zonos-elements/p-6444a4b9.entry.js +1 -0
- package/dist/zonos-elements/{p-26edde4d.system.entry.js → p-65f4af1a.system.entry.js} +1 -1
- package/dist/zonos-elements/p-661bc488.entry.js +1 -0
- package/dist/zonos-elements/p-6c47083f.entry.js +1 -0
- package/dist/zonos-elements/p-6d454281.entry.js +1 -0
- package/dist/zonos-elements/p-78886ed6.system.entry.js +1 -0
- package/dist/zonos-elements/p-81a54668.js +1 -0
- package/dist/zonos-elements/{p-5d91e45c.entry.js → p-aca66e4b.entry.js} +1 -1
- package/dist/zonos-elements/p-aed0098c.system.js +1 -0
- package/dist/zonos-elements/p-af910392.js +1 -0
- package/dist/zonos-elements/p-b035f9e5.system.js +1 -1
- package/dist/zonos-elements/{p-43220d68.entry.js → p-b58d2231.entry.js} +1 -1
- package/dist/zonos-elements/p-cfe4a318.js +1 -0
- package/dist/zonos-elements/p-e4a2a1b0.system.entry.js +1 -0
- package/dist/zonos-elements/p-ead79548.system.js +1 -0
- package/dist/zonos-elements/{p-62851827.system.entry.js → p-eb631432.system.entry.js} +1 -1
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/package.json +1 -1
- package/dist/esm-es5/cart-c9124cc3.js +0 -1
- package/dist/esm-es5/submitGtag-a7d07aec.js +0 -1
- package/dist/zonos-elements/p-139fc767.entry.js +0 -1
- package/dist/zonos-elements/p-2ac66cea.system.entry.js +0 -1
- package/dist/zonos-elements/p-39d12bf0.entry.js +0 -1
- package/dist/zonos-elements/p-3d965e88.entry.js +0 -1
- package/dist/zonos-elements/p-51a40ddf.system.js +0 -1
- package/dist/zonos-elements/p-741a1402.system.entry.js +0 -1
- package/dist/zonos-elements/p-83bb8727.system.entry.js +0 -1
- package/dist/zonos-elements/p-97e659b7.entry.js +0 -1
- package/dist/zonos-elements/p-b494d540.entry.js +0 -1
- package/dist/zonos-elements/p-b87fa3a1.js +0 -1
- package/dist/zonos-elements/p-d170748c.system.entry.js +0 -1
- package/dist/zonos-elements/p-e59b6648.js +0 -1
- package/dist/zonos-elements/p-ee8b44c0.system.js +0 -1
- package/dist/zonos-elements/p-efd1544b.system.entry.js +0 -1
|
@@ -11,11 +11,11 @@ export class ZonosLogo {
|
|
|
11
11
|
const filterColor = this.theme === 'DARK'
|
|
12
12
|
? 'invert(100%) sepia(100%) saturate(0%) hue-rotate(288deg) brightness(102%) contrast(102%)'
|
|
13
13
|
: 'whiteinvert(0%) sepia(100%) saturate(32%) hue-rotate(92deg) brightness(107%) contrast(107%)';
|
|
14
|
-
return (h(Host, { key: '
|
|
14
|
+
return (h(Host, { key: '25b7723a73f8f8c7a28e8b2730b88f18d4f11fb7', class: classes(['zonos--elements zonos--logo', this.class]), style: {
|
|
15
15
|
'--filter-color': filterColor,
|
|
16
16
|
'--font-family': zonosStoreFontFamily(),
|
|
17
17
|
'--width': this.width,
|
|
18
|
-
} }, h("img", { key: '
|
|
18
|
+
} }, h("img", { key: 'e7f15f665c2d3c579e8727f1dceefea0fd438d5d', alt: "Zonos Logo", src: getAssetPath('./assets/ZonosLogo.png') })));
|
|
19
19
|
}
|
|
20
20
|
static get is() { return "zonos-logo"; }
|
|
21
21
|
static get encapsulation() { return "shadow"; }
|
|
@@ -47,62 +47,68 @@
|
|
|
47
47
|
:host circle.track {
|
|
48
48
|
stroke: var(--amino-gray-200);
|
|
49
49
|
}
|
|
50
|
-
|
|
50
|
+
@keyframes rotate {
|
|
51
|
+
100% {
|
|
52
|
+
transform: rotate(360deg);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
@keyframes dash {
|
|
56
|
+
0% {
|
|
57
|
+
stroke-dasharray: 1, 150;
|
|
58
|
+
stroke-dashoffset: 0;
|
|
59
|
+
}
|
|
60
|
+
50% {
|
|
61
|
+
stroke-dasharray: 90, 150;
|
|
62
|
+
stroke-dashoffset: -35;
|
|
63
|
+
}
|
|
64
|
+
100% {
|
|
65
|
+
stroke-dasharray: 90, 150;
|
|
66
|
+
stroke-dashoffset: -124;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
:host circle:not(.track) {
|
|
70
|
+
stroke-linecap: round;
|
|
71
|
+
animation: dash 1.5s ease-in-out infinite;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
:host(.black) circle {
|
|
51
75
|
stroke: var(--amino-spinner-stroke-black);
|
|
52
76
|
}
|
|
53
|
-
:host.black circle.track {
|
|
77
|
+
:host(.black) circle.track {
|
|
54
78
|
stroke: var(--amino-spinner-track-black);
|
|
55
79
|
}
|
|
56
|
-
|
|
80
|
+
|
|
81
|
+
:host(.white) circle {
|
|
57
82
|
stroke: var(--amino-spinner-stroke-white);
|
|
58
83
|
}
|
|
59
|
-
:host.white circle.track {
|
|
84
|
+
:host(.white) circle.track {
|
|
60
85
|
stroke: var(--amino-spinner-track-white);
|
|
61
86
|
}
|
|
62
|
-
|
|
87
|
+
|
|
88
|
+
:host(.info) circle {
|
|
63
89
|
stroke: var(--amino-blue-600);
|
|
64
90
|
}
|
|
65
|
-
:host.info circle.track {
|
|
91
|
+
:host(.info) circle.track {
|
|
66
92
|
stroke: var(--amino-blue-100);
|
|
67
93
|
}
|
|
68
|
-
|
|
94
|
+
|
|
95
|
+
:host(.success) circle {
|
|
69
96
|
stroke: var(--amino-green-600);
|
|
70
97
|
}
|
|
71
|
-
:host.success circle.track {
|
|
98
|
+
:host(.success) circle.track {
|
|
72
99
|
stroke: var(--amino-green-100);
|
|
73
100
|
}
|
|
74
|
-
|
|
101
|
+
|
|
102
|
+
:host(.danger) circle {
|
|
75
103
|
stroke: var(--amino-red-600);
|
|
76
104
|
}
|
|
77
|
-
:host.danger circle.track {
|
|
105
|
+
:host(.danger) circle.track {
|
|
78
106
|
stroke: var(--amino-red-100);
|
|
79
107
|
}
|
|
80
|
-
|
|
108
|
+
|
|
109
|
+
:host(.warning) circle {
|
|
81
110
|
stroke: var(--amino-orange-600);
|
|
82
111
|
}
|
|
83
|
-
:host.warning circle.track {
|
|
112
|
+
:host(.warning) circle.track {
|
|
84
113
|
stroke: var(--amino-orange-100);
|
|
85
|
-
}
|
|
86
|
-
@keyframes rotate {
|
|
87
|
-
100% {
|
|
88
|
-
transform: rotate(360deg);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
@keyframes dash {
|
|
92
|
-
0% {
|
|
93
|
-
stroke-dasharray: 1, 150;
|
|
94
|
-
stroke-dashoffset: 0;
|
|
95
|
-
}
|
|
96
|
-
50% {
|
|
97
|
-
stroke-dasharray: 90, 150;
|
|
98
|
-
stroke-dashoffset: -35;
|
|
99
|
-
}
|
|
100
|
-
100% {
|
|
101
|
-
stroke-dasharray: 90, 150;
|
|
102
|
-
stroke-dashoffset: -124;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
:host circle:not(.track) {
|
|
106
|
-
stroke-linecap: round;
|
|
107
|
-
animation: dash 1.5s ease-in-out infinite;
|
|
108
114
|
}
|
|
@@ -8,9 +8,9 @@ export class VStack {
|
|
|
8
8
|
this.class = '';
|
|
9
9
|
}
|
|
10
10
|
render() {
|
|
11
|
-
return (h(Host, { key: '
|
|
11
|
+
return (h(Host, { key: '2bd82aba32704cc02da767522c39853c6e223297', style: {
|
|
12
12
|
'--font-family': zonosStoreFontFamily(),
|
|
13
|
-
} }, h("div", { key: '
|
|
13
|
+
} }, h("div", { key: '22afa237aa1ac8a5ab61adcfa7a0ccabad316b28', class: classes(['vstack', this.class]), style: { 'grid-row-gap': `${this.spacing}px` } }, h("slot", { key: '5f2645af6b1f4178cb87248e03e9bb3d1c8201ee' }))));
|
|
14
14
|
}
|
|
15
15
|
static get is() { return "zonos-v-stack"; }
|
|
16
16
|
static get encapsulation() { return "shadow"; }
|
|
@@ -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: 'a61bec010f8c7a8b9979d4c5ec4a84153b780a7e' }, "Hello, World! I'm ", this.getText());
|
|
14
14
|
}
|
|
15
15
|
static get is() { return "zonos-component"; }
|
|
16
16
|
static get encapsulation() { return "shadow"; }
|
|
@@ -14,9 +14,9 @@ export class ZonosHelloDialogFooter {
|
|
|
14
14
|
var _a, _b;
|
|
15
15
|
const primaryColor = (_a = this.appearanceSettings) === null || _a === void 0 ? void 0 : _a.colorPrimary;
|
|
16
16
|
const footerTheme = primaryColor && isDarkColor(primaryColor) ? 'DARK' : 'LIGHT';
|
|
17
|
-
return (h(Host, { key: '
|
|
17
|
+
return (h(Host, { key: '724259a8adaa1cb5c760f36b14be99c55d6c29e2', class: "zonos--elements" }, h("div", { key: 'cb27d219f7a0f948a939b221143c3f0f252b0eeb', class: "zonos--hello-dialog-footer", "data-theme": footerTheme, style: {
|
|
18
18
|
'--primary-color': (_b = this.appearanceSettings) === null || _b === void 0 ? void 0 : _b.colorPrimary,
|
|
19
|
-
} }, h("a", { key: '
|
|
19
|
+
} }, h("a", { key: 'd04f060e7db6e2c964dc2c4252dbbc7b69fba7db', href: "https://zonos.com", target: "_blank" }, h("zonos-icon", { key: 'ed138c417f139f84a5466a4228925e2aa908cd12', autoHeight: true, color: "gray-1200", content: ZonosIcon, size: 108 })), h("zonos-button", { key: '07b300a1950adfaf154c173a49cec722df74172c', icon: h("zonos-icon", { color: "gray-700", content: ChevronDownIcon }), iconRight: true, onClick: () => this.setShowCountrySelect(true), variant: "outline" }, localizationStore.selectedCountryCode))));
|
|
20
20
|
}
|
|
21
21
|
static get is() { return "zonos-hello-dialog-footer"; }
|
|
22
22
|
static get encapsulation() { return "shadow"; }
|
|
@@ -90,14 +90,14 @@ export class ZonosHelloDialog {
|
|
|
90
90
|
translate('Know about duties and taxes before you buy. Shop with confidence!');
|
|
91
91
|
const currentPage = this.getCurrentPageEnum();
|
|
92
92
|
const filteredMessages = customMessages.filter(x => x.pageName === currentPage);
|
|
93
|
-
return (h(Host, { key: '
|
|
93
|
+
return (h(Host, { key: '56fcc25e2fabf8c2f1edf727a64d213f18729c00', class: "zonos--elements" }, h("div", { key: 'c83e357cd266c605015e136eb23906bd4385e7f5', "aria-hidden": "true", class: classes([
|
|
94
94
|
'zonos--hello-dialog',
|
|
95
95
|
animateLeft && 'zonos--hello-dialog-animate-from-left',
|
|
96
96
|
animateFromBottom && 'zonos--hello-dialog-animate-from-bottom',
|
|
97
97
|
!!this.mobileLocationOverride &&
|
|
98
98
|
'zonos--hello-dialog-mobile-override',
|
|
99
99
|
this.isOpen && 'zonos--hello-dialog-open',
|
|
100
|
-
]), ref: el => el && (this.dialogRef = el) }, h("div", { key: '
|
|
100
|
+
]), ref: el => el && (this.dialogRef = el) }, h("div", { key: '8d5811f45f2cfe8bd1c0ca3131d99ebc69b7b00d', class: "zonos--hello-dialog-content" }, h("zonos-button", { key: '137ea59ae312bee3817292dde42e2e718e70001b', class: "zonos--close-button", icon: h("zonos-icon", { content: RemoveIcon }), noBackground: true, onClick: () => this.setIsOpen(false) }), this.showCountrySelect ? (h("div", null, h("zonos-country-select", { closeCountrySelect: () => this.setShowCountrySelect(false) }))) : (h("div", null, h("zonos-v-stack", { spacing: 24 }, h("zonos-country-flag", { class: "zonos--hello-country-flag", countryCode: selectedCountryCode }), h("zonos-v-stack", { class: "zonos--hello-dialog-header", spacing: 4 }, h("zonos-text", { type: "boldSubheader" }, welcomeMessage), h("zonos-text", { color: "gray-800" }, defaultMessage)), h("zonos-v-stack", { spacing: 8 }, this.restrictedItems.map(item => {
|
|
101
101
|
var _a;
|
|
102
102
|
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", { color: "red-800" }, x === null || x === void 0 ? void 0 : x.note)))));
|
|
103
103
|
}), h("zonos-card", { spacing: "12px" }, h("zonos-v-stack", { spacing: 12 }, h("div", { class: "zonos--flex-message" }, h("zonos-icon", { content: BagIcon }), h("zonos-text", null, dutyDeMinimisMessage)), h("div", { class: "zonos--flex-message" }, h("zonos-icon", { content: MoneyIcon }), h("zonos-text", null, taxDeMinimisMessage)))), filteredMessages.map(x => (h("zonos-custom-message", { icon: MessageIcon, message: x.message })))))))), !this.showCountrySelect && (h("zonos-hello-dialog-footer", { appearanceSettings: this.appearanceSettings, setShowCountrySelect: value => this.setShowCountrySelect(value) })))));
|
|
@@ -153,7 +153,7 @@ export class ZonosController {
|
|
|
153
153
|
zonosStore.organizationName = organizationName;
|
|
154
154
|
}
|
|
155
155
|
render() {
|
|
156
|
-
return h(Host, { key: '
|
|
156
|
+
return h(Host, { key: 'ff6eb2466864a217c485484d381e6f2531631e49', class: "zonos--elements" });
|
|
157
157
|
}
|
|
158
158
|
static get is() { return "zonos-controller"; }
|
|
159
159
|
static get encapsulation() { return "shadow"; }
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createStore } from "@stencil/store";
|
|
2
|
-
import { stripeStore, stripeStoreUpdateCheckoutSession, } from "./stripe";
|
|
2
|
+
import { stripeStore, stripeStoreReset, stripeStoreUpdateCheckoutSession, } from "./stripe";
|
|
3
3
|
import { localizationStore } from "../hello/localization";
|
|
4
4
|
import { translate } from "../translationStore";
|
|
5
5
|
import { formatDate } from "../../utils/formatDate";
|
|
@@ -57,6 +57,8 @@ const cartStoreReset = () => {
|
|
|
57
57
|
reset();
|
|
58
58
|
};
|
|
59
59
|
const cartStoreUpdateToErrorState = ({ messages, title, }) => {
|
|
60
|
+
cartStoreReset();
|
|
61
|
+
stripeStoreReset();
|
|
60
62
|
cartStore.step = 'error';
|
|
61
63
|
cartStore.error = {
|
|
62
64
|
messages,
|
|
@@ -28,8 +28,9 @@ const { onChange, reset, state: stripeStore, } = createStore(() => ({
|
|
|
28
28
|
stripePaymentElement: null,
|
|
29
29
|
stripePaymentEventData: null,
|
|
30
30
|
}));
|
|
31
|
-
const getStripeOptions = ({ clientSecret, overrideBorderRaidus, overridePrimaryColor, overrideTheme, }) => {
|
|
31
|
+
const getStripeOptions = ({ clientSecret, overrideBorderRaidus, overridePrimaryColor, overrideSecondaryColor, overrideTheme, }) => {
|
|
32
32
|
const primaryColor = overridePrimaryColor || zonosStore.appearance.colorPrimary;
|
|
33
|
+
const secondaryColor = overrideSecondaryColor || zonosStore.appearance.colorSecondary;
|
|
33
34
|
const themeBasedColor = primaryColor && isDarkColor(primaryColor) ? 'night' : 'flat';
|
|
34
35
|
// if overrideTheme is provided, use it. Otherwise, use theme based on primary color
|
|
35
36
|
const theme = overrideTheme === 'DARK' ? 'night' : 'flat';
|
|
@@ -39,10 +40,13 @@ const getStripeOptions = ({ clientSecret, overrideBorderRaidus, overridePrimaryC
|
|
|
39
40
|
rules: Object.assign({}, addressRuleStyle({ theme: 'LIGHT' })),
|
|
40
41
|
// get contrast theme color base on primary color
|
|
41
42
|
theme: overrideTheme ? theme : themeBasedColor,
|
|
42
|
-
variables: Object.assign({}, defaultVariable({
|
|
43
|
+
variables: Object.assign(Object.assign({}, defaultVariable({
|
|
43
44
|
borderStyle: overrideBorderRaidus,
|
|
44
45
|
theme: 'LIGHT',
|
|
45
|
-
})),
|
|
46
|
+
})), {
|
|
47
|
+
// use the button background color for input glow color
|
|
48
|
+
colorPrimary: secondaryColor
|
|
49
|
+
}),
|
|
46
50
|
},
|
|
47
51
|
clientSecret,
|
|
48
52
|
locale: localizationStore.selectedLocale,
|
|
@@ -60,6 +64,7 @@ const initStripeElements = async (props) => {
|
|
|
60
64
|
clientSecret,
|
|
61
65
|
overrideBorderRaidus: props === null || props === void 0 ? void 0 : props.overrideBorderRaidus,
|
|
62
66
|
overridePrimaryColor: props === null || props === void 0 ? void 0 : props.overridePrimaryColor,
|
|
67
|
+
overrideSecondaryColor: props === null || props === void 0 ? void 0 : props.overrideSecondaryColor,
|
|
63
68
|
overrideTheme: props === null || props === void 0 ? void 0 : props.overrideTheme,
|
|
64
69
|
});
|
|
65
70
|
// compare with the previous options to see if we need to update
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { h, Host } from "@stencil/core";
|
|
3
3
|
import { stripeStore, stripeStorePrefetchLandedCost, } from "../../store/checkout/stripe";
|
|
4
4
|
import { localizationStore } from "../../store/hello/localization";
|
|
5
|
+
import { isCheckoutMobile } from "../../utils/checkout/isCheckoutMobile";
|
|
5
6
|
import { logError } from "../../utils/logging/logError";
|
|
6
7
|
/**
|
|
7
8
|
* This component is a wrapper for the stripe address element that would render default style object
|
|
@@ -12,9 +13,11 @@ export class ZonosAddress {
|
|
|
12
13
|
this.titleText = undefined;
|
|
13
14
|
this.defaultAddress = null;
|
|
14
15
|
this.stripe = window.Zonos.stripe;
|
|
16
|
+
this.isDirtyAddress = !!stripeStore.stripeAddressEventData &&
|
|
17
|
+
stripeStore.stripeAddressEventData.value.address.line1.length > 0;
|
|
15
18
|
}
|
|
16
19
|
async watchInitStripe() {
|
|
17
|
-
var _a, _b;
|
|
20
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
18
21
|
this.stripe = window.Zonos.stripe;
|
|
19
22
|
if (!this.stripe || !stripeStore.stripeElements) {
|
|
20
23
|
logError("Stripe is not initialized. Couldn't load stripe element.");
|
|
@@ -27,46 +30,73 @@ export class ZonosAddress {
|
|
|
27
30
|
(_b = this.defaultAddress) === null || _b === void 0 ? true : delete _b.phone;
|
|
28
31
|
}
|
|
29
32
|
const shippableCountries = localizationStore.shippingZoneCountries;
|
|
30
|
-
const addressElement = stripeStore.
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
33
|
+
const addressElement = stripeStore.stripeElements.create('address', {
|
|
34
|
+
allowedCountries: shippableCountries
|
|
35
|
+
? Object.values(shippableCountries).map(country => country.code)
|
|
36
|
+
: [],
|
|
37
|
+
autocomplete: {
|
|
38
|
+
mode: 'automatic',
|
|
39
|
+
},
|
|
40
|
+
contacts: this.defaultAddress ? [this.defaultAddress] : [],
|
|
41
|
+
defaultValues: {
|
|
42
|
+
address: Object.assign(Object.assign({}, (_c = stripeStore.stripeAddressEventData) === null || _c === void 0 ? void 0 : _c.value.address), { country: ((_d = stripeStore.stripeAddressEventData) === null || _d === void 0 ? void 0 : _d.value.address.country) ||
|
|
43
|
+
localizationStore.selectedCountryCode ||
|
|
44
|
+
'AL' }),
|
|
45
|
+
firstName: (_e = stripeStore.stripeAddressEventData) === null || _e === void 0 ? void 0 : _e.value.firstName,
|
|
46
|
+
lastName: (_f = stripeStore.stripeAddressEventData) === null || _f === void 0 ? void 0 : _f.value.lastName,
|
|
47
|
+
phone: (_g = stripeStore.stripeAddressEventData) === null || _g === void 0 ? void 0 : _g.value.phone,
|
|
48
|
+
},
|
|
49
|
+
display: {
|
|
50
|
+
name: 'split',
|
|
51
|
+
},
|
|
52
|
+
fields: {
|
|
53
|
+
phone: 'always',
|
|
54
|
+
},
|
|
55
|
+
mode: this.type,
|
|
56
|
+
validation: {
|
|
57
|
+
phone: {
|
|
58
|
+
required: 'always',
|
|
52
59
|
},
|
|
53
|
-
}
|
|
60
|
+
},
|
|
61
|
+
});
|
|
54
62
|
addressElement.mount(this.el.querySelector('.zonos--address-component'));
|
|
55
63
|
addressElement.on('change', event => {
|
|
56
64
|
const eventValue = event.value;
|
|
65
|
+
if (!this.isDirtyAddress && eventValue.address.line1.length >= 3) {
|
|
66
|
+
this.isDirtyAddress = true;
|
|
67
|
+
// stripe element started with just address line 1, so scroll bar is not yet available. Wait for a moment before scrolling
|
|
68
|
+
setTimeout(() => {
|
|
69
|
+
// scroll directly into view if it's mobile
|
|
70
|
+
if (isCheckoutMobile()) {
|
|
71
|
+
this.el.scrollIntoView({ behavior: 'smooth', block: 'end' });
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
// scroll into the end of the page so the address placeholder won't be hidden
|
|
75
|
+
const yOffset = 100;
|
|
76
|
+
const parentWrapper = this.el.closest('.zonos--group');
|
|
77
|
+
const y = this.el.getBoundingClientRect().top + yOffset;
|
|
78
|
+
parentWrapper === null || parentWrapper === void 0 ? void 0 : parentWrapper.scrollTo({ behavior: 'smooth', top: y });
|
|
79
|
+
}
|
|
80
|
+
}, 400);
|
|
81
|
+
}
|
|
57
82
|
stripeStore.stripeAddressEventData = Object.assign(Object.assign({}, event), { elementMode: 'shipping', elementType: 'address', empty: false, value: Object.assign(Object.assign({}, eventValue), { firstName: eventValue.firstName || eventValue.name.split(' ')[0], lastName: eventValue.lastName || eventValue.name.split(' ').pop() }) });
|
|
58
83
|
// run prefetch landed cost when address is changed
|
|
59
84
|
void stripeStorePrefetchLandedCost();
|
|
60
85
|
});
|
|
61
86
|
stripeStore.stripeAddressElement = addressElement;
|
|
62
87
|
}
|
|
88
|
+
disconnectedCallback() {
|
|
89
|
+
var _a;
|
|
90
|
+
// destroy the stripe element when this component is removed from the DOM, so that we can re-create the new one with previous value
|
|
91
|
+
(_a = stripeStore.stripeAddressElement) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
92
|
+
}
|
|
63
93
|
componentDidLoad() {
|
|
64
94
|
// @Watch doesn't get trigger on initial load
|
|
65
95
|
void this.watchInitStripe();
|
|
66
96
|
}
|
|
67
97
|
render() {
|
|
68
98
|
// this component loads iframe from the stripe elements and puts here, so we don't need to do anything here
|
|
69
|
-
return (h(Host, { key: '
|
|
99
|
+
return (h(Host, { key: '41014c1af1c8f8f5bb37caf358a6cec124e66f30', class: "zonos--address zonos--elements" }, h("zonos-text", { key: '5d8dcc4b44f7fe7b089b630ec6ca7b2177fef371', class: "zonos--title", type: "semiBoldLabel" }, this.titleText), h("div", { key: 'da0fe9760d7ca8dbc089481ac1dcb7c0a7c6553f', class: "zonos--address-component" })));
|
|
70
100
|
}
|
|
71
101
|
static get is() { return "zonos-address"; }
|
|
72
102
|
static get encapsulation() { return "scoped"; }
|
|
@@ -142,7 +172,8 @@ export class ZonosAddress {
|
|
|
142
172
|
}
|
|
143
173
|
static get states() {
|
|
144
174
|
return {
|
|
145
|
-
"stripe": {}
|
|
175
|
+
"stripe": {},
|
|
176
|
+
"isDirtyAddress": {}
|
|
146
177
|
};
|
|
147
178
|
}
|
|
148
179
|
static get elementRef() { return "el"; }
|
package/dist/collection/components/stripe/zonos-link-authentication/zonos-link-authentication.js
CHANGED
|
@@ -36,7 +36,7 @@ export class ZonosLinkAuthentication {
|
|
|
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: '5d02895b441a5713b83e7b3c4b784ab4b6743f54', class: "zonos--link-authentication zonos--elements" }, h("zonos-text", { key: '5bd33edd16f1511111bfcb497e0767f938172b05', class: "zonos--title", type: "semiBoldLabel" }, this.titleText), h("div", { key: 'd5a90ce88adaed9f2369af4692506d5d072c021d', class: "zonos--link-authentication-component" })));
|
|
40
40
|
}
|
|
41
41
|
static get is() { return "zonos-link-authentication"; }
|
|
42
42
|
static get encapsulation() { return "scoped"; }
|
|
@@ -37,7 +37,7 @@ export class ZonosPayment {
|
|
|
37
37
|
}
|
|
38
38
|
render() {
|
|
39
39
|
// this component loads iframe from the stripe elements and puts here, so we don't need to do anything here
|
|
40
|
-
return (h(Host, { key: '
|
|
40
|
+
return (h(Host, { key: '365e346a6cda504bdbc825ff8e25b7492bf1d19b', class: "zonos--payment zonos--elements" }, this.titleText && (h("zonos-text", { class: "zonos--title", type: "semiBoldLabel" }, this.titleText)), h("div", { key: 'f76c3b4ef941ecc8cb99ac3593b9d902eda5b1e7', class: "zonos--payment-component" })));
|
|
41
41
|
}
|
|
42
42
|
static get is() { return "zonos-payment"; }
|
|
43
43
|
static get encapsulation() { return "scoped"; }
|
|
@@ -3,6 +3,7 @@ import { prepCalculateLandedCost } from "./prepCalculateLandedCost";
|
|
|
3
3
|
import { triggerBuildLandedCost } from "./triggerBuildLandedCost";
|
|
4
4
|
import { handleFetch } from "../handleFetch";
|
|
5
5
|
export const calculateLandedCost = async (abortController) => {
|
|
6
|
+
var _a;
|
|
6
7
|
// If buildLandedCost callback is supplied, use that instead of our regular request to '/calculate-landed-cost'
|
|
7
8
|
const buildLandedCost = zonosStore.checkoutSettings.buildLandedCost;
|
|
8
9
|
if (buildLandedCost) {
|
|
@@ -17,7 +18,11 @@ export const calculateLandedCost = async (abortController) => {
|
|
|
17
18
|
signal: abortController === null || abortController === void 0 ? void 0 : abortController.signal,
|
|
18
19
|
});
|
|
19
20
|
if (errors.length || !json) {
|
|
20
|
-
|
|
21
|
+
const isAbortedRequest = ((_a = errors[0]) === null || _a === void 0 ? void 0 : _a.message) === 'The user aborted a request.';
|
|
22
|
+
const errorMessage = isAbortedRequest
|
|
23
|
+
? 'The landed cost calculation request was aborted to initiate a new one.'
|
|
24
|
+
: 'Failed to calculate landed cost';
|
|
25
|
+
throw new Error(errorMessage);
|
|
21
26
|
}
|
|
22
27
|
return json;
|
|
23
28
|
};
|
package/dist/components/cart.js
CHANGED
|
@@ -54,6 +54,7 @@ const triggerBuildLandedCost = async (buildLandedCost) => {
|
|
|
54
54
|
};
|
|
55
55
|
|
|
56
56
|
const calculateLandedCost = async (abortController) => {
|
|
57
|
+
var _a;
|
|
57
58
|
// If buildLandedCost callback is supplied, use that instead of our regular request to '/calculate-landed-cost'
|
|
58
59
|
const buildLandedCost = zonosStore.checkoutSettings.buildLandedCost;
|
|
59
60
|
if (buildLandedCost) {
|
|
@@ -68,7 +69,11 @@ const calculateLandedCost = async (abortController) => {
|
|
|
68
69
|
signal: abortController === null || abortController === void 0 ? void 0 : abortController.signal,
|
|
69
70
|
});
|
|
70
71
|
if (errors.length || !json) {
|
|
71
|
-
|
|
72
|
+
const isAbortedRequest = ((_a = errors[0]) === null || _a === void 0 ? void 0 : _a.message) === 'The user aborted a request.';
|
|
73
|
+
const errorMessage = isAbortedRequest
|
|
74
|
+
? 'The landed cost calculation request was aborted to initiate a new one.'
|
|
75
|
+
: 'Failed to calculate landed cost';
|
|
76
|
+
throw new Error(errorMessage);
|
|
72
77
|
}
|
|
73
78
|
return json;
|
|
74
79
|
};
|
|
@@ -125,8 +130,9 @@ const { onChange: onChange$1, reset: reset$1, state: stripeStore, } = createStor
|
|
|
125
130
|
stripePaymentElement: null,
|
|
126
131
|
stripePaymentEventData: null,
|
|
127
132
|
}));
|
|
128
|
-
const getStripeOptions = ({ clientSecret, overrideBorderRaidus, overridePrimaryColor, overrideTheme, }) => {
|
|
133
|
+
const getStripeOptions = ({ clientSecret, overrideBorderRaidus, overridePrimaryColor, overrideSecondaryColor, overrideTheme, }) => {
|
|
129
134
|
const primaryColor = overridePrimaryColor || zonosStore.appearance.colorPrimary;
|
|
135
|
+
const secondaryColor = overrideSecondaryColor || zonosStore.appearance.colorSecondary;
|
|
130
136
|
const themeBasedColor = primaryColor && isDarkColor(primaryColor) ? 'night' : 'flat';
|
|
131
137
|
// if overrideTheme is provided, use it. Otherwise, use theme based on primary color
|
|
132
138
|
const theme = overrideTheme === 'DARK' ? 'night' : 'flat';
|
|
@@ -136,10 +142,12 @@ const getStripeOptions = ({ clientSecret, overrideBorderRaidus, overridePrimaryC
|
|
|
136
142
|
rules: Object.assign({}, addressRuleStyle({ theme: 'LIGHT' })),
|
|
137
143
|
// get contrast theme color base on primary color
|
|
138
144
|
theme: overrideTheme ? theme : themeBasedColor,
|
|
139
|
-
variables: Object.assign({}, defaultVariable({
|
|
145
|
+
variables: Object.assign(Object.assign({}, defaultVariable({
|
|
140
146
|
borderStyle: overrideBorderRaidus,
|
|
141
147
|
theme: 'LIGHT',
|
|
142
|
-
})),
|
|
148
|
+
})), {
|
|
149
|
+
// use the button background color for input glow color
|
|
150
|
+
colorPrimary: secondaryColor }),
|
|
143
151
|
},
|
|
144
152
|
clientSecret,
|
|
145
153
|
locale: localizationStore.selectedLocale,
|
|
@@ -157,6 +165,7 @@ const initStripeElements = async (props) => {
|
|
|
157
165
|
clientSecret,
|
|
158
166
|
overrideBorderRaidus: props === null || props === void 0 ? void 0 : props.overrideBorderRaidus,
|
|
159
167
|
overridePrimaryColor: props === null || props === void 0 ? void 0 : props.overridePrimaryColor,
|
|
168
|
+
overrideSecondaryColor: props === null || props === void 0 ? void 0 : props.overrideSecondaryColor,
|
|
160
169
|
overrideTheme: props === null || props === void 0 ? void 0 : props.overrideTheme,
|
|
161
170
|
});
|
|
162
171
|
// compare with the previous options to see if we need to update
|
|
@@ -479,6 +488,8 @@ const cartStoreReset = () => {
|
|
|
479
488
|
reset();
|
|
480
489
|
};
|
|
481
490
|
const cartStoreUpdateToErrorState = ({ messages, title, }) => {
|
|
491
|
+
cartStoreReset();
|
|
492
|
+
stripeStoreReset();
|
|
482
493
|
cartStore.step = 'error';
|
|
483
494
|
cartStore.error = {
|
|
484
495
|
messages,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
2
2
|
import { s as stripeStore, k as stripeStorePrefetchLandedCost } from './cart.js';
|
|
3
3
|
import { l as logError, b as localizationStore } from './localization.js';
|
|
4
|
+
import { i as isCheckoutMobile } from './isCheckoutMobile.js';
|
|
4
5
|
import { d as defineCustomElement$1 } from './zonos-text2.js';
|
|
5
6
|
|
|
6
7
|
const zonosAddressCss = ".sc-zonos-address-h{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-address-h *.sc-zonos-address{font-family:var(--font-family, Inter), Inter}.sc-zonos-address-h img.sc-zonos-address{max-width:100%}.sc-zonos-address-h dl.sc-zonos-address,.sc-zonos-address-h dd.sc-zonos-address,.sc-zonos-address-h h1.sc-zonos-address,.sc-zonos-address-h h2.sc-zonos-address,.sc-zonos-address-h h3.sc-zonos-address,.sc-zonos-address-h h4.sc-zonos-address,.sc-zonos-address-h h5.sc-zonos-address,.sc-zonos-address-h h6.sc-zonos-address,.sc-zonos-address-h hr.sc-zonos-address,.sc-zonos-address-h figure.sc-zonos-address,.sc-zonos-address-h p.sc-zonos-address,.sc-zonos-address-h pre.sc-zonos-address{margin:0}.sc-zonos-address-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-address-h .zonos--title.sc-zonos-address{margin-bottom:var(--amino-space-16)}";
|
|
@@ -14,9 +15,11 @@ const ZonosAddress = /*@__PURE__*/ proxyCustomElement(class ZonosAddress extends
|
|
|
14
15
|
this.titleText = undefined;
|
|
15
16
|
this.defaultAddress = null;
|
|
16
17
|
this.stripe = window.Zonos.stripe;
|
|
18
|
+
this.isDirtyAddress = !!stripeStore.stripeAddressEventData &&
|
|
19
|
+
stripeStore.stripeAddressEventData.value.address.line1.length > 0;
|
|
17
20
|
}
|
|
18
21
|
async watchInitStripe() {
|
|
19
|
-
var _a, _b;
|
|
22
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
20
23
|
this.stripe = window.Zonos.stripe;
|
|
21
24
|
if (!this.stripe || !stripeStore.stripeElements) {
|
|
22
25
|
logError("Stripe is not initialized. Couldn't load stripe element.");
|
|
@@ -29,46 +32,73 @@ const ZonosAddress = /*@__PURE__*/ proxyCustomElement(class ZonosAddress extends
|
|
|
29
32
|
(_b = this.defaultAddress) === null || _b === void 0 ? true : delete _b.phone;
|
|
30
33
|
}
|
|
31
34
|
const shippableCountries = localizationStore.shippingZoneCountries;
|
|
32
|
-
const addressElement = stripeStore.
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
35
|
+
const addressElement = stripeStore.stripeElements.create('address', {
|
|
36
|
+
allowedCountries: shippableCountries
|
|
37
|
+
? Object.values(shippableCountries).map(country => country.code)
|
|
38
|
+
: [],
|
|
39
|
+
autocomplete: {
|
|
40
|
+
mode: 'automatic',
|
|
41
|
+
},
|
|
42
|
+
contacts: this.defaultAddress ? [this.defaultAddress] : [],
|
|
43
|
+
defaultValues: {
|
|
44
|
+
address: Object.assign(Object.assign({}, (_c = stripeStore.stripeAddressEventData) === null || _c === void 0 ? void 0 : _c.value.address), { country: ((_d = stripeStore.stripeAddressEventData) === null || _d === void 0 ? void 0 : _d.value.address.country) ||
|
|
45
|
+
localizationStore.selectedCountryCode ||
|
|
46
|
+
'AL' }),
|
|
47
|
+
firstName: (_e = stripeStore.stripeAddressEventData) === null || _e === void 0 ? void 0 : _e.value.firstName,
|
|
48
|
+
lastName: (_f = stripeStore.stripeAddressEventData) === null || _f === void 0 ? void 0 : _f.value.lastName,
|
|
49
|
+
phone: (_g = stripeStore.stripeAddressEventData) === null || _g === void 0 ? void 0 : _g.value.phone,
|
|
50
|
+
},
|
|
51
|
+
display: {
|
|
52
|
+
name: 'split',
|
|
53
|
+
},
|
|
54
|
+
fields: {
|
|
55
|
+
phone: 'always',
|
|
56
|
+
},
|
|
57
|
+
mode: this.type,
|
|
58
|
+
validation: {
|
|
59
|
+
phone: {
|
|
60
|
+
required: 'always',
|
|
42
61
|
},
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
},
|
|
46
|
-
fields: {
|
|
47
|
-
phone: 'always',
|
|
48
|
-
},
|
|
49
|
-
mode: this.type,
|
|
50
|
-
validation: {
|
|
51
|
-
phone: {
|
|
52
|
-
required: 'always',
|
|
53
|
-
},
|
|
54
|
-
},
|
|
55
|
-
});
|
|
62
|
+
},
|
|
63
|
+
});
|
|
56
64
|
addressElement.mount(this.el.querySelector('.zonos--address-component'));
|
|
57
65
|
addressElement.on('change', event => {
|
|
58
66
|
const eventValue = event.value;
|
|
67
|
+
if (!this.isDirtyAddress && eventValue.address.line1.length >= 3) {
|
|
68
|
+
this.isDirtyAddress = true;
|
|
69
|
+
// stripe element started with just address line 1, so scroll bar is not yet available. Wait for a moment before scrolling
|
|
70
|
+
setTimeout(() => {
|
|
71
|
+
// scroll directly into view if it's mobile
|
|
72
|
+
if (isCheckoutMobile()) {
|
|
73
|
+
this.el.scrollIntoView({ behavior: 'smooth', block: 'end' });
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
// scroll into the end of the page so the address placeholder won't be hidden
|
|
77
|
+
const yOffset = 100;
|
|
78
|
+
const parentWrapper = this.el.closest('.zonos--group');
|
|
79
|
+
const y = this.el.getBoundingClientRect().top + yOffset;
|
|
80
|
+
parentWrapper === null || parentWrapper === void 0 ? void 0 : parentWrapper.scrollTo({ behavior: 'smooth', top: y });
|
|
81
|
+
}
|
|
82
|
+
}, 400);
|
|
83
|
+
}
|
|
59
84
|
stripeStore.stripeAddressEventData = Object.assign(Object.assign({}, event), { elementMode: 'shipping', elementType: 'address', empty: false, value: Object.assign(Object.assign({}, eventValue), { firstName: eventValue.firstName || eventValue.name.split(' ')[0], lastName: eventValue.lastName || eventValue.name.split(' ').pop() }) });
|
|
60
85
|
// run prefetch landed cost when address is changed
|
|
61
86
|
void stripeStorePrefetchLandedCost();
|
|
62
87
|
});
|
|
63
88
|
stripeStore.stripeAddressElement = addressElement;
|
|
64
89
|
}
|
|
90
|
+
disconnectedCallback() {
|
|
91
|
+
var _a;
|
|
92
|
+
// destroy the stripe element when this component is removed from the DOM, so that we can re-create the new one with previous value
|
|
93
|
+
(_a = stripeStore.stripeAddressElement) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
94
|
+
}
|
|
65
95
|
componentDidLoad() {
|
|
66
96
|
// @Watch doesn't get trigger on initial load
|
|
67
97
|
void this.watchInitStripe();
|
|
68
98
|
}
|
|
69
99
|
render() {
|
|
70
100
|
// this component loads iframe from the stripe elements and puts here, so we don't need to do anything here
|
|
71
|
-
return (h(Host, { key: '
|
|
101
|
+
return (h(Host, { key: '41014c1af1c8f8f5bb37caf358a6cec124e66f30', class: "zonos--address zonos--elements" }, h("zonos-text", { key: '5d8dcc4b44f7fe7b089b630ec6ca7b2177fef371', class: "zonos--title", type: "semiBoldLabel" }, this.titleText), h("div", { key: 'da0fe9760d7ca8dbc089481ac1dcb7c0a7c6553f', class: "zonos--address-component" })));
|
|
72
102
|
}
|
|
73
103
|
get el() { return this; }
|
|
74
104
|
static get watchers() { return {
|
|
@@ -79,7 +109,8 @@ const ZonosAddress = /*@__PURE__*/ proxyCustomElement(class ZonosAddress extends
|
|
|
79
109
|
"type": [1],
|
|
80
110
|
"titleText": [1, "title-text"],
|
|
81
111
|
"defaultAddress": [16],
|
|
82
|
-
"stripe": [32]
|
|
112
|
+
"stripe": [32],
|
|
113
|
+
"isDirtyAddress": [32]
|
|
83
114
|
}, undefined, {
|
|
84
115
|
"stripe": ["watchInitStripe"]
|
|
85
116
|
}]);
|