@zonos/elements 1.2.4-alpha.2 → 1.2.4-alpha.3
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-4ddc2af5.js → cart-3ff38a09.js} +1 -1
- package/dist/cjs/index.cjs.js +2 -2
- package/dist/cjs/{localization-11360fed.js → localization-dcd11e9d.js} +19 -1
- package/dist/cjs/{submitGtag-bb093547.js → submitGtag-08527ddb.js} +1 -1
- package/dist/cjs/zonos-address_2.cjs.entry.js +2 -2
- package/dist/cjs/zonos-cart-items_10.cjs.entry.js +3 -3
- package/dist/cjs/zonos-checkout.cjs.entry.js +3 -3
- package/dist/cjs/zonos-controller.cjs.entry.js +2 -2
- package/dist/cjs/zonos-country-flag_4.cjs.entry.js +1 -1
- package/dist/cjs/zonos-hello-dialog.cjs.entry.js +1 -1
- package/dist/cjs/zonos-hello.cjs.entry.js +1 -1
- package/dist/cjs/zonos-payment.cjs.entry.js +2 -2
- package/dist/collection/components/utils/handleFetch.js +19 -1
- package/dist/components/localization.js +19 -1
- package/dist/esm/{cart-cd87f476.js → cart-54eab7ab.js} +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/{localization-f573428e.js → localization-9c80f0f5.js} +19 -1
- package/dist/esm/{submitGtag-75af52be.js → submitGtag-7affec95.js} +1 -1
- package/dist/esm/zonos-address_2.entry.js +2 -2
- package/dist/esm/zonos-cart-items_10.entry.js +3 -3
- package/dist/esm/zonos-checkout.entry.js +3 -3
- package/dist/esm/zonos-controller.entry.js +2 -2
- package/dist/esm/zonos-country-flag_4.entry.js +1 -1
- package/dist/esm/zonos-hello-dialog.entry.js +1 -1
- package/dist/esm/zonos-hello.entry.js +1 -1
- package/dist/esm/zonos-payment.entry.js +2 -2
- package/dist/esm-es5/{cart-cd87f476.js → cart-54eab7ab.js} +1 -1
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/{localization-f573428e.js → localization-9c80f0f5.js} +1 -1
- package/dist/esm-es5/{submitGtag-75af52be.js → submitGtag-7affec95.js} +1 -1
- package/dist/esm-es5/zonos-address_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-controller.entry.js +1 -1
- package/dist/esm-es5/zonos-country-flag_4.entry.js +1 -1
- package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
- package/dist/esm-es5/zonos-hello.entry.js +1 -1
- package/dist/esm-es5/zonos-payment.entry.js +1 -1
- package/dist/scripts/loadZonos.js +3 -3
- package/dist/scripts/zonos.js +3 -3
- package/dist/zonos-elements/index.esm.js +1 -1
- package/dist/zonos-elements/{p-83d100b8.entry.js → p-07b4af6f.entry.js} +1 -1
- package/dist/zonos-elements/{p-39a5e8e0.js → p-17bc1266.js} +1 -1
- package/dist/zonos-elements/{p-ec26fe57.entry.js → p-1cca9bc9.entry.js} +1 -1
- package/dist/zonos-elements/{p-534dcbd4.system.js → p-1d4b6d59.system.js} +1 -1
- package/dist/zonos-elements/{p-44ddebe4.system.entry.js → p-20ce8825.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-c299049e.js → p-3379ee13.js} +1 -1
- package/dist/zonos-elements/{p-7a15d841.entry.js → p-398e0bf5.entry.js} +1 -1
- package/dist/zonos-elements/{p-dc9b318c.system.entry.js → p-3b23bc47.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-779621e4.system.js → p-46d935ea.system.js} +1 -1
- package/dist/zonos-elements/{p-cd4f8e13.system.entry.js → p-610527cb.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-ceb2cd7b.system.entry.js → p-68c6c8cd.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-dcf64928.system.entry.js → p-6caef7fd.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-72ea628d.system.js → p-7aab4cf0.system.js} +1 -1
- package/dist/zonos-elements/{p-7a81ccb5.system.entry.js → p-82cff2da.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-2a32dc0a.system.entry.js → p-86372180.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-0175125e.system.js → p-9232db22.system.js} +1 -1
- package/dist/zonos-elements/{p-660a588b.entry.js → p-a2ec3620.entry.js} +1 -1
- package/dist/zonos-elements/{p-9ef86de7.entry.js → p-ab393d48.entry.js} +1 -1
- package/dist/zonos-elements/{p-2466df77.entry.js → p-bbb30a7e.entry.js} +1 -1
- package/dist/zonos-elements/p-bec21999.system.js +1 -1
- package/dist/zonos-elements/{p-fcd4fc66.system.entry.js → p-c56f51bc.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-e694312d.entry.js → p-d0bd2caf.entry.js} +1 -1
- package/dist/zonos-elements/{p-62ccb686.entry.js → p-d94c94ce.entry.js} +1 -1
- package/dist/zonos-elements/{p-1f8b684a.js → p-e3c617a4.js} +1 -1
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const zonosStore = require('./zonosStore-a0fa5b77.js');
|
|
4
|
-
const localization = require('./localization-
|
|
4
|
+
const localization = require('./localization-dcd11e9d.js');
|
|
5
5
|
const isDarkColor = require('./isDarkColor-261fcf3d.js');
|
|
6
6
|
const getBorderRadius = require('./getBorderRadius-a97a5f75.js');
|
|
7
7
|
|
package/dist/cjs/index.cjs.js
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const cart = require('./cart-
|
|
5
|
+
const cart = require('./cart-3ff38a09.js');
|
|
6
6
|
require('./zonosStore-a0fa5b77.js');
|
|
7
7
|
require('./index-20cb112f.js');
|
|
8
|
-
require('./localization-
|
|
8
|
+
require('./localization-dcd11e9d.js');
|
|
9
9
|
require('./isDarkColor-261fcf3d.js');
|
|
10
10
|
require('./getBorderRadius-a97a5f75.js');
|
|
11
11
|
|
|
@@ -3163,15 +3163,33 @@ const handleRequest = async (url, options) => {
|
|
|
3163
3163
|
};
|
|
3164
3164
|
}
|
|
3165
3165
|
};
|
|
3166
|
+
function encodeString(text) {
|
|
3167
|
+
try {
|
|
3168
|
+
// encode the string, remove the "=" at the end of the encoded string
|
|
3169
|
+
const encodedString = btoa(text).replace(/=/g, '');
|
|
3170
|
+
return encodedString;
|
|
3171
|
+
}
|
|
3172
|
+
catch (error) {
|
|
3173
|
+
// return the reverse string if the encoding failed
|
|
3174
|
+
return text
|
|
3175
|
+
.replace(/[^A-Za-z0-9]/g, '')
|
|
3176
|
+
.split('')
|
|
3177
|
+
.reverse()
|
|
3178
|
+
.join('');
|
|
3179
|
+
}
|
|
3180
|
+
}
|
|
3166
3181
|
const handleFetch = async (url, _opts) => {
|
|
3167
3182
|
const opts = __rest(_opts || {}, []);
|
|
3168
3183
|
const body = opts.body ? JSON.stringify(opts.body) : undefined;
|
|
3169
3184
|
const method = opts.method || 'GET';
|
|
3185
|
+
// adding credentialtoken to the url so that the request will be cached differently for each store
|
|
3186
|
+
const modifiedUrl = new URL(url);
|
|
3187
|
+
modifiedUrl.searchParams.set('zToken', encodeString(window.location.hostname));
|
|
3170
3188
|
// headers content type
|
|
3171
3189
|
const headers = 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 }, opts.headers);
|
|
3172
3190
|
const options = Object.assign(Object.assign({}, opts), { body: method === 'GET' ? undefined : body, headers,
|
|
3173
3191
|
method });
|
|
3174
|
-
return handleRequest(
|
|
3192
|
+
return handleRequest(modifiedUrl.toString(), options);
|
|
3175
3193
|
};
|
|
3176
3194
|
|
|
3177
3195
|
const getCountries = async () => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const zonosStore = require('./zonosStore-a0fa5b77.js');
|
|
4
|
-
const localization = require('./localization-
|
|
4
|
+
const localization = require('./localization-dcd11e9d.js');
|
|
5
5
|
|
|
6
6
|
const checkoutBreakpoint = 890;
|
|
7
7
|
const isCheckoutMobile = (isMobile) => {
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-20cb112f.js');
|
|
6
|
-
const cart = require('./cart-
|
|
7
|
-
const localization = require('./localization-
|
|
6
|
+
const cart = require('./cart-3ff38a09.js');
|
|
7
|
+
const localization = require('./localization-dcd11e9d.js');
|
|
8
8
|
require('./zonosStore-a0fa5b77.js');
|
|
9
9
|
require('./isDarkColor-261fcf3d.js');
|
|
10
10
|
require('./getBorderRadius-a97a5f75.js');
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-20cb112f.js');
|
|
6
|
-
const cart = require('./cart-
|
|
7
|
-
const localization = require('./localization-
|
|
6
|
+
const cart = require('./cart-3ff38a09.js');
|
|
7
|
+
const localization = require('./localization-dcd11e9d.js');
|
|
8
8
|
const getBorderRadius = require('./getBorderRadius-a97a5f75.js');
|
|
9
|
-
const submitGtag = require('./submitGtag-
|
|
9
|
+
const submitGtag = require('./submitGtag-08527ddb.js');
|
|
10
10
|
const zonosStore = require('./zonosStore-a0fa5b77.js');
|
|
11
11
|
const classes = require('./classes-b7918f56.js');
|
|
12
12
|
require('./isDarkColor-261fcf3d.js');
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-20cb112f.js');
|
|
6
|
-
const cart = require('./cart-
|
|
7
|
-
const localization = require('./localization-
|
|
6
|
+
const cart = require('./cart-3ff38a09.js');
|
|
7
|
+
const localization = require('./localization-dcd11e9d.js');
|
|
8
8
|
const zonosStore = require('./zonosStore-a0fa5b77.js');
|
|
9
|
-
const submitGtag = require('./submitGtag-
|
|
9
|
+
const submitGtag = require('./submitGtag-08527ddb.js');
|
|
10
10
|
const classes = require('./classes-b7918f56.js');
|
|
11
11
|
const getBorderRadius = require('./getBorderRadius-a97a5f75.js');
|
|
12
12
|
const isDarkColor = require('./isDarkColor-261fcf3d.js');
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-20cb112f.js');
|
|
6
|
-
const cart = require('./cart-
|
|
7
|
-
const localization = require('./localization-
|
|
6
|
+
const cart = require('./cart-3ff38a09.js');
|
|
7
|
+
const localization = require('./localization-dcd11e9d.js');
|
|
8
8
|
const zonosStore = require('./zonosStore-a0fa5b77.js');
|
|
9
9
|
require('./isDarkColor-261fcf3d.js');
|
|
10
10
|
require('./getBorderRadius-a97a5f75.js');
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-20cb112f.js');
|
|
6
|
-
const localization = require('./localization-
|
|
6
|
+
const localization = require('./localization-dcd11e9d.js');
|
|
7
7
|
const zonosStore = require('./zonosStore-a0fa5b77.js');
|
|
8
8
|
const classes = require('./classes-b7918f56.js');
|
|
9
9
|
const isDarkColor = require('./isDarkColor-261fcf3d.js');
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-20cb112f.js');
|
|
6
|
-
const localization = require('./localization-
|
|
6
|
+
const localization = require('./localization-dcd11e9d.js');
|
|
7
7
|
const zonosStore = require('./zonosStore-a0fa5b77.js');
|
|
8
8
|
const classes = require('./classes-b7918f56.js');
|
|
9
9
|
const getHasMoreSpaceOnRight = require('./getHasMoreSpaceOnRight-4c94667f.js');
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const index = require('./index-20cb112f.js');
|
|
6
6
|
const zonosStore = require('./zonosStore-a0fa5b77.js');
|
|
7
|
-
const localization = require('./localization-
|
|
7
|
+
const localization = require('./localization-dcd11e9d.js');
|
|
8
8
|
const classes = require('./classes-b7918f56.js');
|
|
9
9
|
const getHasMoreSpaceOnRight = require('./getHasMoreSpaceOnRight-4c94667f.js');
|
|
10
10
|
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-20cb112f.js');
|
|
6
|
-
const cart = require('./cart-
|
|
6
|
+
const cart = require('./cart-3ff38a09.js');
|
|
7
7
|
require('./zonosStore-a0fa5b77.js');
|
|
8
|
-
require('./localization-
|
|
8
|
+
require('./localization-dcd11e9d.js');
|
|
9
9
|
require('./isDarkColor-261fcf3d.js');
|
|
10
10
|
require('./getBorderRadius-a97a5f75.js');
|
|
11
11
|
|
|
@@ -88,13 +88,31 @@ const handleRequest = async (url, options) => {
|
|
|
88
88
|
};
|
|
89
89
|
}
|
|
90
90
|
};
|
|
91
|
+
function encodeString(text) {
|
|
92
|
+
try {
|
|
93
|
+
// encode the string, remove the "=" at the end of the encoded string
|
|
94
|
+
const encodedString = btoa(text).replace(/=/g, '');
|
|
95
|
+
return encodedString;
|
|
96
|
+
}
|
|
97
|
+
catch (error) {
|
|
98
|
+
// return the reverse string if the encoding failed
|
|
99
|
+
return text
|
|
100
|
+
.replace(/[^A-Za-z0-9]/g, '')
|
|
101
|
+
.split('')
|
|
102
|
+
.reverse()
|
|
103
|
+
.join('');
|
|
104
|
+
}
|
|
105
|
+
}
|
|
91
106
|
export const handleFetch = async (url, _opts) => {
|
|
92
107
|
const opts = __rest(_opts || {}, []);
|
|
93
108
|
const body = opts.body ? JSON.stringify(opts.body) : undefined;
|
|
94
109
|
const method = opts.method || 'GET';
|
|
110
|
+
// adding credentialtoken to the url so that the request will be cached differently for each store
|
|
111
|
+
const modifiedUrl = new URL(url);
|
|
112
|
+
modifiedUrl.searchParams.set('zToken', encodeString(window.location.hostname));
|
|
95
113
|
// headers content type
|
|
96
114
|
const headers = 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 }, opts.headers);
|
|
97
115
|
const options = Object.assign(Object.assign({}, opts), { body: method === 'GET' ? undefined : body, headers,
|
|
98
116
|
method });
|
|
99
|
-
return handleRequest(
|
|
117
|
+
return handleRequest(modifiedUrl.toString(), options);
|
|
100
118
|
};
|
|
@@ -3161,15 +3161,33 @@ const handleRequest = async (url, options) => {
|
|
|
3161
3161
|
};
|
|
3162
3162
|
}
|
|
3163
3163
|
};
|
|
3164
|
+
function encodeString(text) {
|
|
3165
|
+
try {
|
|
3166
|
+
// encode the string, remove the "=" at the end of the encoded string
|
|
3167
|
+
const encodedString = btoa(text).replace(/=/g, '');
|
|
3168
|
+
return encodedString;
|
|
3169
|
+
}
|
|
3170
|
+
catch (error) {
|
|
3171
|
+
// return the reverse string if the encoding failed
|
|
3172
|
+
return text
|
|
3173
|
+
.replace(/[^A-Za-z0-9]/g, '')
|
|
3174
|
+
.split('')
|
|
3175
|
+
.reverse()
|
|
3176
|
+
.join('');
|
|
3177
|
+
}
|
|
3178
|
+
}
|
|
3164
3179
|
const handleFetch = async (url, _opts) => {
|
|
3165
3180
|
const opts = __rest(_opts || {}, []);
|
|
3166
3181
|
const body = opts.body ? JSON.stringify(opts.body) : undefined;
|
|
3167
3182
|
const method = opts.method || 'GET';
|
|
3183
|
+
// adding credentialtoken to the url so that the request will be cached differently for each store
|
|
3184
|
+
const modifiedUrl = new URL(url);
|
|
3185
|
+
modifiedUrl.searchParams.set('zToken', encodeString(window.location.hostname));
|
|
3168
3186
|
// headers content type
|
|
3169
3187
|
const headers = 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 }, opts.headers);
|
|
3170
3188
|
const options = Object.assign(Object.assign({}, opts), { body: method === 'GET' ? undefined : body, headers,
|
|
3171
3189
|
method });
|
|
3172
|
-
return handleRequest(
|
|
3190
|
+
return handleRequest(modifiedUrl.toString(), options);
|
|
3173
3191
|
};
|
|
3174
3192
|
|
|
3175
3193
|
const getCountries = async () => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { c as createStore, z as zonosStore } from './zonosStore-e0b7a5cf.js';
|
|
2
|
-
import { h as handleFetch, l as log, a as localizationStore, b as logError, t as translate } from './localization-
|
|
2
|
+
import { h as handleFetch, l as log, a as localizationStore, b as logError, t as translate } from './localization-9c80f0f5.js';
|
|
3
3
|
import { i as isDarkColor } from './isDarkColor-44e9e451.js';
|
|
4
4
|
import { g as getBorderRadius } from './getBorderRadius-35e8acce.js';
|
|
5
5
|
|
package/dist/esm/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { c as cartStore, a as cartStoreApplySubtotals, b as cartStoreGetShippingTransitInfo, d as cartStoreNextStep, e as cartStorePreviousStep, f as cartStoreReCalculateTotal, g as cartStoreReset, h as cartStoreUpdateItems, i as cartStoreUpdateSelectedShippingOption, j as cartStoreUpdateToErrorState } from './cart-
|
|
1
|
+
export { c as cartStore, a as cartStoreApplySubtotals, b as cartStoreGetShippingTransitInfo, d as cartStoreNextStep, e as cartStorePreviousStep, f as cartStoreReCalculateTotal, g as cartStoreReset, h as cartStoreUpdateItems, i as cartStoreUpdateSelectedShippingOption, j as cartStoreUpdateToErrorState } from './cart-54eab7ab.js';
|
|
2
2
|
import './zonosStore-e0b7a5cf.js';
|
|
3
3
|
import './index-3617e24c.js';
|
|
4
|
-
import './localization-
|
|
4
|
+
import './localization-9c80f0f5.js';
|
|
5
5
|
import './isDarkColor-44e9e451.js';
|
|
6
6
|
import './getBorderRadius-35e8acce.js';
|
|
@@ -3161,15 +3161,33 @@ const handleRequest = async (url, options) => {
|
|
|
3161
3161
|
};
|
|
3162
3162
|
}
|
|
3163
3163
|
};
|
|
3164
|
+
function encodeString(text) {
|
|
3165
|
+
try {
|
|
3166
|
+
// encode the string, remove the "=" at the end of the encoded string
|
|
3167
|
+
const encodedString = btoa(text).replace(/=/g, '');
|
|
3168
|
+
return encodedString;
|
|
3169
|
+
}
|
|
3170
|
+
catch (error) {
|
|
3171
|
+
// return the reverse string if the encoding failed
|
|
3172
|
+
return text
|
|
3173
|
+
.replace(/[^A-Za-z0-9]/g, '')
|
|
3174
|
+
.split('')
|
|
3175
|
+
.reverse()
|
|
3176
|
+
.join('');
|
|
3177
|
+
}
|
|
3178
|
+
}
|
|
3164
3179
|
const handleFetch = async (url, _opts) => {
|
|
3165
3180
|
const opts = __rest(_opts || {}, []);
|
|
3166
3181
|
const body = opts.body ? JSON.stringify(opts.body) : undefined;
|
|
3167
3182
|
const method = opts.method || 'GET';
|
|
3183
|
+
// adding credentialtoken to the url so that the request will be cached differently for each store
|
|
3184
|
+
const modifiedUrl = new URL(url);
|
|
3185
|
+
modifiedUrl.searchParams.set('zToken', encodeString(window.location.hostname));
|
|
3168
3186
|
// headers content type
|
|
3169
3187
|
const headers = 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 }, opts.headers);
|
|
3170
3188
|
const options = Object.assign(Object.assign({}, opts), { body: method === 'GET' ? undefined : body, headers,
|
|
3171
3189
|
method });
|
|
3172
|
-
return handleRequest(
|
|
3190
|
+
return handleRequest(modifiedUrl.toString(), options);
|
|
3173
3191
|
};
|
|
3174
3192
|
|
|
3175
3193
|
const getCountries = async () => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as registerInstance, h, H as Host, d as getElement } from './index-3617e24c.js';
|
|
2
|
-
import { s as stripeStore, m as stripeStorePrefetchLandedCost } from './cart-
|
|
3
|
-
import { b as logError, a as localizationStore } from './localization-
|
|
2
|
+
import { s as stripeStore, m as stripeStorePrefetchLandedCost } from './cart-54eab7ab.js';
|
|
3
|
+
import { b as logError, a as localizationStore } from './localization-9c80f0f5.js';
|
|
4
4
|
import './zonosStore-e0b7a5cf.js';
|
|
5
5
|
import './isDarkColor-44e9e451.js';
|
|
6
6
|
import './getBorderRadius-35e8acce.js';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { r as registerInstance, a as getAssetPath, h, H as Host, F as Fragment, c as createEvent, d as getElement } from './index-3617e24c.js';
|
|
2
|
-
import { c as cartStore, s as stripeStore, p as stripeStoreRetrievePayment, o as stripeStoreReset, i as cartStoreUpdateSelectedShippingOption, b as cartStoreGetShippingTransitInfo } from './cart-
|
|
3
|
-
import { t as translate } from './localization-
|
|
2
|
+
import { c as cartStore, s as stripeStore, p as stripeStoreRetrievePayment, o as stripeStoreReset, i as cartStoreUpdateSelectedShippingOption, b as cartStoreGetShippingTransitInfo } from './cart-54eab7ab.js';
|
|
3
|
+
import { t as translate } from './localization-9c80f0f5.js';
|
|
4
4
|
import { g as getBorderRadius } from './getBorderRadius-35e8acce.js';
|
|
5
|
-
import { s as submitGtag, i as isCheckoutMobile } from './submitGtag-
|
|
5
|
+
import { s as submitGtag, i as isCheckoutMobile } from './submitGtag-7affec95.js';
|
|
6
6
|
import { e as zonosStoreFontFamily, z as zonosStore } from './zonosStore-e0b7a5cf.js';
|
|
7
7
|
import { c as classes } from './classes-0d95c529.js';
|
|
8
8
|
import './isDarkColor-44e9e451.js';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { r as registerInstance, h, F as Fragment, H as Host } from './index-3617e24c.js';
|
|
2
|
-
import { k as initStripeElements, c as cartStore, h as cartStoreUpdateItems, g as cartStoreReset, s as stripeStore, l as stripeStoreInitCheckoutSession, j as cartStoreUpdateToErrorState, m as stripeStorePrefetchLandedCost, d as cartStoreNextStep, n as stripeStoreConfirmPayment, o as stripeStoreReset, e as cartStorePreviousStep } from './cart-
|
|
3
|
-
import { a as localizationStore, l as log, t as translate } from './localization-
|
|
2
|
+
import { k as initStripeElements, c as cartStore, h as cartStoreUpdateItems, g as cartStoreReset, s as stripeStore, l as stripeStoreInitCheckoutSession, j as cartStoreUpdateToErrorState, m as stripeStorePrefetchLandedCost, d as cartStoreNextStep, n as stripeStoreConfirmPayment, o as stripeStoreReset, e as cartStorePreviousStep } from './cart-54eab7ab.js';
|
|
3
|
+
import { a as localizationStore, l as log, t as translate } from './localization-9c80f0f5.js';
|
|
4
4
|
import { z as zonosStore, m as mergeConfig } from './zonosStore-e0b7a5cf.js';
|
|
5
|
-
import { s as submitGtag, i as isCheckoutMobile } from './submitGtag-
|
|
5
|
+
import { s as submitGtag, i as isCheckoutMobile } from './submitGtag-7affec95.js';
|
|
6
6
|
import { c as classes } from './classes-0d95c529.js';
|
|
7
7
|
import { g as getBorderRadius } from './getBorderRadius-35e8acce.js';
|
|
8
8
|
import { i as isDarkColor } from './isDarkColor-44e9e451.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, H as Host } from './index-3617e24c.js';
|
|
2
|
-
import { s as stripeStore } from './cart-
|
|
3
|
-
import { h as handleFetch, b as logError, i as isValidSelector, l as log, c as initLocalizationStore, d as localizationStoreUpdateSelectedCountryCode } from './localization-
|
|
2
|
+
import { s as stripeStore } from './cart-54eab7ab.js';
|
|
3
|
+
import { h as handleFetch, b as logError, i as isValidSelector, l as log, c as initLocalizationStore, d as localizationStoreUpdateSelectedCountryCode } from './localization-9c80f0f5.js';
|
|
4
4
|
import { z as zonosStore, d as zonosStoreInitSetting, e as zonosStoreFontFamily } from './zonosStore-e0b7a5cf.js';
|
|
5
5
|
import './isDarkColor-44e9e451.js';
|
|
6
6
|
import './getBorderRadius-35e8acce.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as registerInstance, h, H as Host, d as getElement } from './index-3617e24c.js';
|
|
2
|
-
import { a as localizationStore, d as localizationStoreUpdateSelectedCountryCode, t as translate } from './localization-
|
|
2
|
+
import { a as localizationStore, d as localizationStoreUpdateSelectedCountryCode, t as translate } from './localization-9c80f0f5.js';
|
|
3
3
|
import { e as zonosStoreFontFamily } from './zonosStore-e0b7a5cf.js';
|
|
4
4
|
import { c as classes } from './classes-0d95c529.js';
|
|
5
5
|
import { i as isDarkColor } from './isDarkColor-44e9e451.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, H as Host } from './index-3617e24c.js';
|
|
2
|
-
import { k as currencyFormat, a as localizationStore, t as translate } from './localization-
|
|
2
|
+
import { k as currencyFormat, a as localizationStore, t as translate } from './localization-9c80f0f5.js';
|
|
3
3
|
import { z as zonosStore } from './zonosStore-e0b7a5cf.js';
|
|
4
4
|
import { c as classes } from './classes-0d95c529.js';
|
|
5
5
|
import { g as getHasMoreSpaceOnRight } from './getHasMoreSpaceOnRight-70eb913a.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as registerInstance, h, H as Host } from './index-3617e24c.js';
|
|
2
2
|
import { _ as _root, i as isObjectLike_1, f as _baseGetTag, g as isObject_1, z as zonosStore, m as mergeConfig } from './zonosStore-e0b7a5cf.js';
|
|
3
|
-
import { h as handleFetch, b as logError, a as localizationStore, i as isValidSelector, t as translate, g as getZCountryUrlParam, s as setZCountryUrlParam, l as log, e as currencyDisplay, f as currencyConvertAndFormat, j as currencyConvert, k as currencyFormat } from './localization-
|
|
3
|
+
import { h as handleFetch, b as logError, a as localizationStore, i as isValidSelector, t as translate, g as getZCountryUrlParam, s as setZCountryUrlParam, l as log, e as currencyDisplay, f as currencyConvertAndFormat, j as currencyConvert, k as currencyFormat } from './localization-9c80f0f5.js';
|
|
4
4
|
import { c as classes } from './classes-0d95c529.js';
|
|
5
5
|
import { g as getHasMoreSpaceOnRight } from './getHasMoreSpaceOnRight-70eb913a.js';
|
|
6
6
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { r as registerInstance, h, H as Host, d as getElement } from './index-3617e24c.js';
|
|
2
|
-
import { s as stripeStore } from './cart-
|
|
2
|
+
import { s as stripeStore } from './cart-54eab7ab.js';
|
|
3
3
|
import './zonosStore-e0b7a5cf.js';
|
|
4
|
-
import './localization-
|
|
4
|
+
import './localization-9c80f0f5.js';
|
|
5
5
|
import './isDarkColor-44e9e451.js';
|
|
6
6
|
import './getBorderRadius-35e8acce.js';
|
|
7
7
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var __awaiter=this&&this.__awaiter||function(e,t,r,o){function n(e){return e instanceof r?e:new r((function(t){t(e)}))}return new(r||(r=Promise))((function(r,i){function a(e){try{c(o.next(e))}catch(e){i(e)}}function s(e){try{c(o["throw"](e))}catch(e){i(e)}}function c(e){e.done?r(e.value):n(e.value).then(a,s)}c((o=o.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},o,n,i,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(e){return function(t){return c([e,t])}}function c(s){if(o)throw new TypeError("Generator is already executing.");while(a&&(a=0,s[0]&&(r=0)),r)try{if(o=1,n&&(i=s[0]&2?n["return"]:s[0]?n["throw"]||((i=n["return"])&&i.call(n),0):n.next)&&!(i=i.call(n,s[1])).done)return i;if(n=0,i)s=[s[0]&2,i.value];switch(s[0]){case 0:case 1:i=s;break;case 4:r.label++;return{value:s[1],done:false};case 5:r.label++;n=s[1];s=[0];continue;case 7:s=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(s[0]===6||s[0]===2)){r=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){r.label=s[1];break}if(s[0]===6&&r.label<i[1]){r.label=i[1];i=s;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(s);break}if(i[2])r.ops.pop();r.trys.pop();continue}s=t.call(e,r)}catch(e){s=[6,e];n=0}finally{o=i=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};import{c as createStore,z as zonosStore}from"./zonosStore-e0b7a5cf.js";import{h as handleFetch,l as log,a as localizationStore,b as logError,t as translate}from"./localization-f573428e.js";import{i as isDarkColor}from"./isDarkColor-44e9e451.js";import{g as getBorderRadius}from"./getBorderRadius-35e8acce.js";var prepCalculateLandedCost=function(){var e=stripeStore.stripeLinkEventData;var t=stripeStore.stripeAddressEventData;if(!t||!t.complete){throw new Error("Missing stripe address data")}return{checkoutSessionId:cartStore.checkoutSessionId||"",contact:{email:(e===null||e===void 0?void 0:e.value.email)||"",firstName:t.value.firstName||"",lastName:t.value.lastName||"",phone:t.value.phone||""},items:cartStore.items.map((function(e){return e})),shippingAddress:{addressLine1:t.value.address.line1,addressLine2:t.value.address.line2||"",city:t.value.address.city,country:t.value.address.country,postalCode:t.value.address.postal_code,state:t.value.address.state}}};var calculateLandedCost=function(e){return __awaiter(void 0,void 0,void 0,(function(){var t,r,o,n;return __generator(this,(function(i){switch(i.label){case 0:t="".concat("https://v1.route.js.zonos.com","/api/calculate-landed-cost");return[4,handleFetch(t,{body:prepCalculateLandedCost(),method:"POST",signal:e===null||e===void 0?void 0:e.signal})];case 1:r=i.sent(),o=r.errors,n=r.json;if(o.length||!n){throw new Error("Failed to calculate landed cost")}return[2,n]}}))}))};var addressRuleStyle=function(e){var t=e.theme;switch(t){default:return{".Input":{padding:"0",paddingBottom:"8px",paddingLeft:"16px",paddingRight:"8px",paddingTop:"6px"}}}};var defaultVariable=function(e){var t=e.borderStyle,r=e.theme;switch(r){case"DARK":return{borderRadius:getBorderRadius(t),colorBackground:"#101117",colorBackgroundText:"#C5C6CA",colorText:"#C5C6CA",colorTextPlaceholder:"#C5C6CA"};default:return{borderRadius:getBorderRadius(t)}}};var _f=createStore((function(){return{clientSecret:sessionStorage.getItem("zonos--client-secret")||null,fetchingLandedCostAbordController:null,isFetchingLandedCost:false,isFetchingSession:false,stripe:null,stripeAddressElement:null,stripeAddressEventData:null,stripeAddressUsedWhenFetchingLC:null,stripeElements:null,stripeElementsOptions:null,stripeLinkElement:null,stripeLinkEventData:null,stripeLinkUsedWhenFetchingLC:null,stripePaymentElement:null,stripePaymentEventData:null}})),onChange$1=_f.onChange,reset$1=_f.reset,stripeStore=_f.state;var getStripeOptions=function(e){var t=e.clientSecret,r=e.overrideBorderRaidus,o=e.overridePrimaryColor,n=e.overrideTheme;var i=o||zonosStore.appearance.colorPrimary;var a=i&&isDarkColor(i)?"night":"flat";var s=n==="DARK"?"night":"flat";return{appearance:{labels:"floating",rules:Object.assign({},addressRuleStyle({theme:"LIGHT"})),theme:n?s:a,variables:Object.assign({},defaultVariable({borderStyle:r,theme:"LIGHT"}))},clientSecret:t,locale:localizationStore.selectedLocale}};var initStripeElements=function(e){return __awaiter(void 0,void 0,void 0,(function(){var t,r,o,n;return __generator(this,(function(i){r=stripeStore.clientSecret;if(!stripeStore.stripe){log("Skip. Stripe is not initialized");return[2]}if(r){o=getStripeOptions({clientSecret:r,overrideBorderRaidus:e===null||e===void 0?void 0:e.overrideBorderRaidus,overridePrimaryColor:e===null||e===void 0?void 0:e.overridePrimaryColor,overrideTheme:e===null||e===void 0?void 0:e.overrideTheme});n=JSON.stringify(o)===JSON.stringify(stripeStore.stripeElementsOptions);if(!stripeStore.stripeElements){stripeStore.stripeElements=(t=stripeStore.stripe)===null||t===void 0?void 0:t.elements(o);stripeStore.stripeElementsOptions=o;log("Stripe elements initialized");return[2]}if(!n){stripeStore.stripeElements.update(o);stripeStore.stripeElementsOptions=o}log("Stripe elements initialized")}return[2]}))}))};var stripeStoreReset=function(){sessionStorage.removeItem("zonos--client-secret");reset$1();stripeStore.stripe=window.Zonos.stripe};var isPrefetchInfoOutdated=function(){var e,t,r,o;var n=stripeStore.fetchingLandedCostAbordController;if(!n){return false}var i=JSON.stringify((e=stripeStore.stripeLinkUsedWhenFetchingLC)===null||e===void 0?void 0:e.value)!==JSON.stringify((t=stripeStore.stripeLinkEventData)===null||t===void 0?void 0:t.value);var a=JSON.stringify((r=stripeStore.stripeAddressUsedWhenFetchingLC)===null||r===void 0?void 0:r.value)!==JSON.stringify((o=stripeStore.stripeAddressEventData)===null||o===void 0?void 0:o.value);return i||a};var stripeStorePrefetchLandedCost=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,t,r,o,n,i,a,s,c,u,l,d,S,p;return __generator(this,(function(f){switch(f.label){case 0:n=!!((e=stripeStore.stripeAddressEventData)===null||e===void 0?void 0:e.complete);i=!!((t=stripeStore.stripeLinkEventData)===null||t===void 0?void 0:t.complete);a=isPrefetchInfoOutdated();if(a){(r=stripeStore.fetchingLandedCostAbordController)===null||r===void 0?void 0:r.abort();stripeStore.fetchingLandedCostAbordController=null}if(!(n&&i&&(a||!stripeStore.isFetchingLandedCost)))return[3,5];stripeStore.isFetchingLandedCost=true;if(stripeStore.stripeAddressEventData){stripeStore.stripeAddressUsedWhenFetchingLC=Object.assign({},stripeStore.stripeAddressEventData)}if(stripeStore.stripeLinkEventData){stripeStore.stripeLinkUsedWhenFetchingLC=Object.assign({},stripeStore.stripeLinkEventData)}f.label=1;case 1:f.trys.push([1,3,,4]);s=new AbortController;stripeStore.fetchingLandedCostAbordController=s;return[4,calculateLandedCost(s)];case 2:c=f.sent(),u=c.checkoutSessionWorkflow,l=c.shipmentRatingCalculateWorkflow;stripeStore.fetchingLandedCostAbordController=null;cartStore.landedCostData=(u===null||u===void 0?void 0:u.filter(Boolean))||null;cartStore.shippingData=(l===null||l===void 0?void 0:l.filter(Boolean))||null;d=(o=cartStore.landedCostData)===null||o===void 0?void 0:o.find(Boolean);S=!!d?d.subtotals:null;if(S){cartStoreApplySubtotals({exchangeRate:S.exchangeRate,items:S.items,landedCostTotal:0,presentmentCurrencyCode:S.presentmentCurrencyCode,shipping:0,total:S.items})}return[3,4];case 3:p=f.sent();logError(p);return[3,4];case 4:stripeStore.isFetchingLandedCost=false;f.label=5;case 5:return[2]}}))}))};var getStripeMessageBasedOnStatus=function(e){var t=[];var r=true;switch(e){case"succeeded":{t=[translate("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."),"","",translate("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.")];r=false;break}case"requires_capture":case"processing":{t=[translate("Payment processing. We'll update you when payment is received.")];r=false;break}case"requires_payment_method":{t=[translate("Payment failed. Please try another payment method.")];break}default:{t=[translate("Something went wrong.")];break}}return{isError:r,messages:t}};var stripeStoreRetrievePayment=function(e){var t=e.clientSecret,r=e.storybookForceStatus;return __awaiter(void 0,void 0,void 0,(function(){var e,o,n,i,a,s,c,u,l;return __generator(this,(function(d){switch(d.label){case 0:if(r){e=getStripeMessageBasedOnStatus(r),o=e.isError,n=e.messages;return[2,{error:o,messages:n}]}i=t||stripeStore.clientSecret;if(!stripeStore.stripe||!i){logError("Failed to retrieve payment intent. Stripe is not initialized");return[2,{error:true,message:[translate("Something went wrong.")]}]}return[4,stripeStore.stripe.retrievePaymentIntent(i)];case 1:a=d.sent().paymentIntent;s=a===null||a===void 0?void 0:a.status;c=getStripeMessageBasedOnStatus(s),u=c.isError,l=c.messages;return[2,{error:u,messages:l}]}}))}))};var stripeStoreConfirmPayment=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,t,r,o,n,i,a,s;return __generator(this,(function(c){switch(c.label){case 0:o=!!((e=stripeStore.stripePaymentEventData)===null||e===void 0?void 0:e.complete);n=stripeStore.stripeElements;i=stripeStore.stripe;a=stripeStore.clientSecret;if(!(i&&n&&o&&a))return[3,2];return[4,i.confirmPayment({confirmParams:{receipt_email:(r=(t=stripeStore.stripeLinkEventData)===null||t===void 0?void 0:t.value)===null||r===void 0?void 0:r.email,return_url:window.location.href},elements:n,redirect:"if_required"})];case 1:s=c.sent().error;if(s){if(s.type==="card_error"||s.type==="validation_error"){throw new Error(s.message)}if(s.type==="invalid_request_error"){if(s.code==="payment_intent_unexpected_state"){return[2]}}throw new Error("An unexpected error occurred.")}c.label=2;case 2:return[2]}}))}))};var stripeStoreInitCheckoutSession=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,t,r,o,n,i;return __generator(this,(function(a){switch(a.label){case 0:t=cartStore.items.reduce((function(e,t){return e+t.amount*t.quantity}),0);if(!t||!localizationStore.targetCurrency){logError("Fail to create checkout session - invalid total or currency");return[2,false]}stripeStore.isFetchingSession=true;return[4,handleFetch("".concat("https://v1.route.js.zonos.com","/api/create-checkout-session"),{body:{currency:((e=cartStore.items.find(Boolean))===null||e===void 0?void 0:e.currencyCode)||"",itemsAmount:t,presentmentCountryCode:localizationStore.selectedCountryCode||null},method:"POST"})];case 1:r=a.sent(),o=r.errors,n=r.json;stripeStore.isFetchingSession=false;if(o.length||!n){logError("Error occurs when creating checkout session",JSON.stringify(o,null,2));return[2,false]}i=n.checkoutSessionCreate;stripeStore.clientSecret=i.clientSecret;cartStore.checkoutSessionId=i.id;cartStoreApplySubtotals(Object.assign(Object.assign({},i.subtotals),{landedCostTotal:0,shipping:0,total:i.subtotals.items}));log("Exchange rate updated for cart items (checkout session create)","info",cartStore.exchangeRate);log("done-init-checkout-session");return[2,true]}}))}))};var stripeStoreUpdateCheckoutSession=function(e){var t=e.currency,r=e.id,o=e.itemsAmount,n=e.landedCostId,i=e.presentmentCountryCode;return __awaiter(void 0,void 0,void 0,(function(){var e,a,s;return __generator(this,(function(c){switch(c.label){case 0:return[4,handleFetch("".concat("https://v1.route.js.zonos.com","/api/update-checkout-session"),{body:{currency:t,id:r,itemsAmount:o,landedCostId:n,presentmentCountryCode:i},method:"POST"})];case 1:e=c.sent(),a=e.errors,s=e.json;if(a.length||!s){logError("Error occurs when updating checkout session",JSON.stringify(a,null,2));return[2,{errors:a,json:s}]}return[2,{errors:[],json:s}]}}))}))};onChange$1("clientSecret",(function(e){if(e&&stripeStore.stripe){sessionStorage.setItem("zonos--client-secret",e)}if(!e){sessionStorage.removeItem("zonos--client-secret")}}));var formatDate=function(e){var t=e.date,r=e.formatOptions,o=r===void 0?{day:"numeric",weekday:"long",year:"numeric"}:r;return new Intl.DateTimeFormat("en-US",o).format(t)};var getDaysDifference=function(e){var t=new Date;var r=e.getTime()-t.getTime();var o=Math.floor(r/(1e3*60*60*24));return o};var _g=createStore((function(){return{checkoutSessionId:sessionStorage.getItem("zonos--checkout-session-id")||null,currency:"USD",dutiesTaxFees:0,error:null,exchangeRate:null,isSelectedShippingAboveDeminimis:false,isSelectedShippingGuarantee:false,items:[],landedCostData:null,selectedLandedCost:null,selectedShippingOption:null,selectedShippingOptionExpectedDate:"",selectedShippingOptionTransitTime:"",shipping:0,shippingData:null,step:"customer-info",subtotal:0,total:0}})),onChange=_g.onChange,reset=_g.reset,cartStore=_g.state;var cartStoreGetShippingTransitInfo=function(e){var t=e.minTransitAt?getDaysDifference(new Date(e.minTransitAt)):"";var r=e.maxTransitAt?getDaysDifference(new Date(e.maxTransitAt)):"";var o=e.minTransitAt?formatDate({date:new Date(e.minTransitAt)}):"";return{expectedDate:o,maxTransit:r,minTransit:t}};var cartStoreReset=function(){sessionStorage.removeItem("zonos--checkout-session-id");reset()};var cartStoreUpdateToErrorState=function(e){var t=e.messages,r=e.title;cartStore.step="error";cartStore.error={messages:t,title:r}};var cartStoreApplySubtotals=function(e){cartStore.exchangeRate=e.exchangeRate;cartStore.dutiesTaxFees=e.landedCostTotal;cartStore.subtotal=e.items;cartStore.total=e.total;cartStore.currency=e.presentmentCurrencyCode};var cartStoreReCalculateTotal=function(e){var t=e.currency,r=e.itemsAmount,o=e.landedCostId;return __awaiter(void 0,void 0,void 0,(function(){var e,n;return __generator(this,(function(i){switch(i.label){case 0:if(o&&cartStore.selectedLandedCost){e=cartStore.selectedLandedCost.subtotals;cartStoreApplySubtotals(e);log("Exchange rate updated for cart items (landed cost subtotal)","info",cartStore.exchangeRate)}if(!cartStore.checkoutSessionId){logError("Could update cart total without checkout session id");return[2,false]}return[4,stripeStoreUpdateCheckoutSession({currency:t,id:cartStore.checkoutSessionId,itemsAmount:r,landedCostId:o,presentmentCountryCode:localizationStore.selectedCountryCode})];case 1:n=i.sent().json;if(!n){logError("Error occurs when updating checkout session");cartStoreUpdateToErrorState({messages:[translate("There's been an error updating your checkout session. Please reload and try again or contact support if the error persists")],title:translate("Error updating Checkout")});return[2,false]}if(!o){cartStoreApplySubtotals(n.checkoutSessionUpdate.subtotals);log("Exchange rate updated for cart items (checkout session update)","info",cartStore.exchangeRate)}return[2,true]}}))}))};var cartStoreUpdateSelectedShippingOption=function(e){return __awaiter(void 0,void 0,void 0,(function(){var t,r,o,n,i,a,s,c,u,l,d,S,p;return __generator(this,(function(f){switch(f.label){case 0:cartStore.selectedShippingOption=e;a=cartStoreGetShippingTransitInfo(cartStore.selectedShippingOption),s=a.expectedDate,c=a.maxTransit,u=a.minTransit;cartStore.selectedShippingOptionExpectedDate=s;cartStore.selectedShippingOptionTransitTime=u&&c?"".concat(u,"-").concat(c):"".concat(u||c);l=(t=cartStore.landedCostData)===null||t===void 0?void 0:t.find((function(e){var t,r,o;return((r=(t=e.landedCost)===null||t===void 0?void 0:t.shipmentRating)===null||r===void 0?void 0:r.id)===((o=cartStore.selectedShippingOption)===null||o===void 0?void 0:o.id)}));cartStore.selectedLandedCost=l||null;if(!l){return[2,false]}cartStore.shipping=l.subtotals.shipping;d=((r=l===null||l===void 0?void 0:l.landedCost)===null||r===void 0?void 0:r.landedCostGuaranteeCode)==="ZONOS";S=!!((n=(o=l===null||l===void 0?void 0:l.landedCost)===null||o===void 0?void 0:o.deMinimis)===null||n===void 0?void 0:n.find((function(e){return["DUTY","TAX"].includes(e.type)&&e.threshold==="ABOVE"})));cartStore.isSelectedShippingAboveDeminimis=S;cartStore.isSelectedShippingGuarantee=d;return[4,cartStoreReCalculateTotal({landedCostId:(i=l.landedCost)===null||i===void 0?void 0:i.id})];case 1:p=f.sent();return[2,p]}}))}))};onChange("checkoutSessionId",(function(){if(!cartStore.checkoutSessionId){sessionStorage.removeItem("zonos--checkout-session-id");return}sessionStorage.setItem("zonos--checkout-session-id",cartStore.checkoutSessionId)}));var cartStoreUpdateItems=function(e){return __awaiter(void 0,void 0,void 0,(function(){var t,r,o;return __generator(this,(function(n){switch(n.label){case 0:cartStore.items=e;r=(t=e.find(Boolean))===null||t===void 0?void 0:t.currencyCode;o=e.reduce((function(e,t){return e+t.amount*t.quantity}),0);if(!r||!o){return[2]}cartStore.currency=r;stripeStore.isFetchingSession=true;return[4,cartStoreReCalculateTotal({currency:r,itemsAmount:o})];case 1:n.sent();stripeStore.isFetchingSession=false;return[2]}}))}))};var cartStoreResetSelectedShippingOption=function(){cartStore.selectedShippingOption=null;cartStore.isSelectedShippingAboveDeminimis=false;cartStore.isSelectedShippingGuarantee=false;cartStore.selectedShippingOptionExpectedDate="";cartStore.selectedShippingOptionTransitTime="";cartStore.shipping=0};var cartStoreNextStep=function(){if(cartStore.step==="customer-info"){cartStore.step="shipping"}else if(cartStore.step==="shipping"){cartStore.step="payment"}else if(cartStore.step==="payment"){cartStore.step="finish"}};var cartStorePreviousStep=function(){if(cartStore.step==="payment"){cartStore.step="shipping"}else if(cartStore.step==="shipping"){cartStore.step="customer-info";cartStoreResetSelectedShippingOption()}};export{cartStoreApplySubtotals as a,cartStoreGetShippingTransitInfo as b,cartStore as c,cartStoreNextStep as d,cartStorePreviousStep as e,cartStoreReCalculateTotal as f,cartStoreReset as g,cartStoreUpdateItems as h,cartStoreUpdateSelectedShippingOption as i,cartStoreUpdateToErrorState as j,initStripeElements as k,stripeStoreInitCheckoutSession as l,stripeStorePrefetchLandedCost as m,stripeStoreConfirmPayment as n,stripeStoreReset as o,stripeStoreRetrievePayment as p,stripeStore as s};
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(e,t,r,o){function n(e){return e instanceof r?e:new r((function(t){t(e)}))}return new(r||(r=Promise))((function(r,i){function a(e){try{c(o.next(e))}catch(e){i(e)}}function s(e){try{c(o["throw"](e))}catch(e){i(e)}}function c(e){e.done?r(e.value):n(e.value).then(a,s)}c((o=o.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},o,n,i,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(e){return function(t){return c([e,t])}}function c(s){if(o)throw new TypeError("Generator is already executing.");while(a&&(a=0,s[0]&&(r=0)),r)try{if(o=1,n&&(i=s[0]&2?n["return"]:s[0]?n["throw"]||((i=n["return"])&&i.call(n),0):n.next)&&!(i=i.call(n,s[1])).done)return i;if(n=0,i)s=[s[0]&2,i.value];switch(s[0]){case 0:case 1:i=s;break;case 4:r.label++;return{value:s[1],done:false};case 5:r.label++;n=s[1];s=[0];continue;case 7:s=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(s[0]===6||s[0]===2)){r=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){r.label=s[1];break}if(s[0]===6&&r.label<i[1]){r.label=i[1];i=s;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(s);break}if(i[2])r.ops.pop();r.trys.pop();continue}s=t.call(e,r)}catch(e){s=[6,e];n=0}finally{o=i=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};import{c as createStore,z as zonosStore}from"./zonosStore-e0b7a5cf.js";import{h as handleFetch,l as log,a as localizationStore,b as logError,t as translate}from"./localization-9c80f0f5.js";import{i as isDarkColor}from"./isDarkColor-44e9e451.js";import{g as getBorderRadius}from"./getBorderRadius-35e8acce.js";var prepCalculateLandedCost=function(){var e=stripeStore.stripeLinkEventData;var t=stripeStore.stripeAddressEventData;if(!t||!t.complete){throw new Error("Missing stripe address data")}return{checkoutSessionId:cartStore.checkoutSessionId||"",contact:{email:(e===null||e===void 0?void 0:e.value.email)||"",firstName:t.value.firstName||"",lastName:t.value.lastName||"",phone:t.value.phone||""},items:cartStore.items.map((function(e){return e})),shippingAddress:{addressLine1:t.value.address.line1,addressLine2:t.value.address.line2||"",city:t.value.address.city,country:t.value.address.country,postalCode:t.value.address.postal_code,state:t.value.address.state}}};var calculateLandedCost=function(e){return __awaiter(void 0,void 0,void 0,(function(){var t,r,o,n;return __generator(this,(function(i){switch(i.label){case 0:t="".concat("https://v1.route.js.zonos.com","/api/calculate-landed-cost");return[4,handleFetch(t,{body:prepCalculateLandedCost(),method:"POST",signal:e===null||e===void 0?void 0:e.signal})];case 1:r=i.sent(),o=r.errors,n=r.json;if(o.length||!n){throw new Error("Failed to calculate landed cost")}return[2,n]}}))}))};var addressRuleStyle=function(e){var t=e.theme;switch(t){default:return{".Input":{padding:"0",paddingBottom:"8px",paddingLeft:"16px",paddingRight:"8px",paddingTop:"6px"}}}};var defaultVariable=function(e){var t=e.borderStyle,r=e.theme;switch(r){case"DARK":return{borderRadius:getBorderRadius(t),colorBackground:"#101117",colorBackgroundText:"#C5C6CA",colorText:"#C5C6CA",colorTextPlaceholder:"#C5C6CA"};default:return{borderRadius:getBorderRadius(t)}}};var _f=createStore((function(){return{clientSecret:sessionStorage.getItem("zonos--client-secret")||null,fetchingLandedCostAbordController:null,isFetchingLandedCost:false,isFetchingSession:false,stripe:null,stripeAddressElement:null,stripeAddressEventData:null,stripeAddressUsedWhenFetchingLC:null,stripeElements:null,stripeElementsOptions:null,stripeLinkElement:null,stripeLinkEventData:null,stripeLinkUsedWhenFetchingLC:null,stripePaymentElement:null,stripePaymentEventData:null}})),onChange$1=_f.onChange,reset$1=_f.reset,stripeStore=_f.state;var getStripeOptions=function(e){var t=e.clientSecret,r=e.overrideBorderRaidus,o=e.overridePrimaryColor,n=e.overrideTheme;var i=o||zonosStore.appearance.colorPrimary;var a=i&&isDarkColor(i)?"night":"flat";var s=n==="DARK"?"night":"flat";return{appearance:{labels:"floating",rules:Object.assign({},addressRuleStyle({theme:"LIGHT"})),theme:n?s:a,variables:Object.assign({},defaultVariable({borderStyle:r,theme:"LIGHT"}))},clientSecret:t,locale:localizationStore.selectedLocale}};var initStripeElements=function(e){return __awaiter(void 0,void 0,void 0,(function(){var t,r,o,n;return __generator(this,(function(i){r=stripeStore.clientSecret;if(!stripeStore.stripe){log("Skip. Stripe is not initialized");return[2]}if(r){o=getStripeOptions({clientSecret:r,overrideBorderRaidus:e===null||e===void 0?void 0:e.overrideBorderRaidus,overridePrimaryColor:e===null||e===void 0?void 0:e.overridePrimaryColor,overrideTheme:e===null||e===void 0?void 0:e.overrideTheme});n=JSON.stringify(o)===JSON.stringify(stripeStore.stripeElementsOptions);if(!stripeStore.stripeElements){stripeStore.stripeElements=(t=stripeStore.stripe)===null||t===void 0?void 0:t.elements(o);stripeStore.stripeElementsOptions=o;log("Stripe elements initialized");return[2]}if(!n){stripeStore.stripeElements.update(o);stripeStore.stripeElementsOptions=o}log("Stripe elements initialized")}return[2]}))}))};var stripeStoreReset=function(){sessionStorage.removeItem("zonos--client-secret");reset$1();stripeStore.stripe=window.Zonos.stripe};var isPrefetchInfoOutdated=function(){var e,t,r,o;var n=stripeStore.fetchingLandedCostAbordController;if(!n){return false}var i=JSON.stringify((e=stripeStore.stripeLinkUsedWhenFetchingLC)===null||e===void 0?void 0:e.value)!==JSON.stringify((t=stripeStore.stripeLinkEventData)===null||t===void 0?void 0:t.value);var a=JSON.stringify((r=stripeStore.stripeAddressUsedWhenFetchingLC)===null||r===void 0?void 0:r.value)!==JSON.stringify((o=stripeStore.stripeAddressEventData)===null||o===void 0?void 0:o.value);return i||a};var stripeStorePrefetchLandedCost=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,t,r,o,n,i,a,s,c,u,l,d,S,p;return __generator(this,(function(f){switch(f.label){case 0:n=!!((e=stripeStore.stripeAddressEventData)===null||e===void 0?void 0:e.complete);i=!!((t=stripeStore.stripeLinkEventData)===null||t===void 0?void 0:t.complete);a=isPrefetchInfoOutdated();if(a){(r=stripeStore.fetchingLandedCostAbordController)===null||r===void 0?void 0:r.abort();stripeStore.fetchingLandedCostAbordController=null}if(!(n&&i&&(a||!stripeStore.isFetchingLandedCost)))return[3,5];stripeStore.isFetchingLandedCost=true;if(stripeStore.stripeAddressEventData){stripeStore.stripeAddressUsedWhenFetchingLC=Object.assign({},stripeStore.stripeAddressEventData)}if(stripeStore.stripeLinkEventData){stripeStore.stripeLinkUsedWhenFetchingLC=Object.assign({},stripeStore.stripeLinkEventData)}f.label=1;case 1:f.trys.push([1,3,,4]);s=new AbortController;stripeStore.fetchingLandedCostAbordController=s;return[4,calculateLandedCost(s)];case 2:c=f.sent(),u=c.checkoutSessionWorkflow,l=c.shipmentRatingCalculateWorkflow;stripeStore.fetchingLandedCostAbordController=null;cartStore.landedCostData=(u===null||u===void 0?void 0:u.filter(Boolean))||null;cartStore.shippingData=(l===null||l===void 0?void 0:l.filter(Boolean))||null;d=(o=cartStore.landedCostData)===null||o===void 0?void 0:o.find(Boolean);S=!!d?d.subtotals:null;if(S){cartStoreApplySubtotals({exchangeRate:S.exchangeRate,items:S.items,landedCostTotal:0,presentmentCurrencyCode:S.presentmentCurrencyCode,shipping:0,total:S.items})}return[3,4];case 3:p=f.sent();logError(p);return[3,4];case 4:stripeStore.isFetchingLandedCost=false;f.label=5;case 5:return[2]}}))}))};var getStripeMessageBasedOnStatus=function(e){var t=[];var r=true;switch(e){case"succeeded":{t=[translate("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."),"","",translate("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.")];r=false;break}case"requires_capture":case"processing":{t=[translate("Payment processing. We'll update you when payment is received.")];r=false;break}case"requires_payment_method":{t=[translate("Payment failed. Please try another payment method.")];break}default:{t=[translate("Something went wrong.")];break}}return{isError:r,messages:t}};var stripeStoreRetrievePayment=function(e){var t=e.clientSecret,r=e.storybookForceStatus;return __awaiter(void 0,void 0,void 0,(function(){var e,o,n,i,a,s,c,u,l;return __generator(this,(function(d){switch(d.label){case 0:if(r){e=getStripeMessageBasedOnStatus(r),o=e.isError,n=e.messages;return[2,{error:o,messages:n}]}i=t||stripeStore.clientSecret;if(!stripeStore.stripe||!i){logError("Failed to retrieve payment intent. Stripe is not initialized");return[2,{error:true,message:[translate("Something went wrong.")]}]}return[4,stripeStore.stripe.retrievePaymentIntent(i)];case 1:a=d.sent().paymentIntent;s=a===null||a===void 0?void 0:a.status;c=getStripeMessageBasedOnStatus(s),u=c.isError,l=c.messages;return[2,{error:u,messages:l}]}}))}))};var stripeStoreConfirmPayment=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,t,r,o,n,i,a,s;return __generator(this,(function(c){switch(c.label){case 0:o=!!((e=stripeStore.stripePaymentEventData)===null||e===void 0?void 0:e.complete);n=stripeStore.stripeElements;i=stripeStore.stripe;a=stripeStore.clientSecret;if(!(i&&n&&o&&a))return[3,2];return[4,i.confirmPayment({confirmParams:{receipt_email:(r=(t=stripeStore.stripeLinkEventData)===null||t===void 0?void 0:t.value)===null||r===void 0?void 0:r.email,return_url:window.location.href},elements:n,redirect:"if_required"})];case 1:s=c.sent().error;if(s){if(s.type==="card_error"||s.type==="validation_error"){throw new Error(s.message)}if(s.type==="invalid_request_error"){if(s.code==="payment_intent_unexpected_state"){return[2]}}throw new Error("An unexpected error occurred.")}c.label=2;case 2:return[2]}}))}))};var stripeStoreInitCheckoutSession=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,t,r,o,n,i;return __generator(this,(function(a){switch(a.label){case 0:t=cartStore.items.reduce((function(e,t){return e+t.amount*t.quantity}),0);if(!t||!localizationStore.targetCurrency){logError("Fail to create checkout session - invalid total or currency");return[2,false]}stripeStore.isFetchingSession=true;return[4,handleFetch("".concat("https://v1.route.js.zonos.com","/api/create-checkout-session"),{body:{currency:((e=cartStore.items.find(Boolean))===null||e===void 0?void 0:e.currencyCode)||"",itemsAmount:t,presentmentCountryCode:localizationStore.selectedCountryCode||null},method:"POST"})];case 1:r=a.sent(),o=r.errors,n=r.json;stripeStore.isFetchingSession=false;if(o.length||!n){logError("Error occurs when creating checkout session",JSON.stringify(o,null,2));return[2,false]}i=n.checkoutSessionCreate;stripeStore.clientSecret=i.clientSecret;cartStore.checkoutSessionId=i.id;cartStoreApplySubtotals(Object.assign(Object.assign({},i.subtotals),{landedCostTotal:0,shipping:0,total:i.subtotals.items}));log("Exchange rate updated for cart items (checkout session create)","info",cartStore.exchangeRate);log("done-init-checkout-session");return[2,true]}}))}))};var stripeStoreUpdateCheckoutSession=function(e){var t=e.currency,r=e.id,o=e.itemsAmount,n=e.landedCostId,i=e.presentmentCountryCode;return __awaiter(void 0,void 0,void 0,(function(){var e,a,s;return __generator(this,(function(c){switch(c.label){case 0:return[4,handleFetch("".concat("https://v1.route.js.zonos.com","/api/update-checkout-session"),{body:{currency:t,id:r,itemsAmount:o,landedCostId:n,presentmentCountryCode:i},method:"POST"})];case 1:e=c.sent(),a=e.errors,s=e.json;if(a.length||!s){logError("Error occurs when updating checkout session",JSON.stringify(a,null,2));return[2,{errors:a,json:s}]}return[2,{errors:[],json:s}]}}))}))};onChange$1("clientSecret",(function(e){if(e&&stripeStore.stripe){sessionStorage.setItem("zonos--client-secret",e)}if(!e){sessionStorage.removeItem("zonos--client-secret")}}));var formatDate=function(e){var t=e.date,r=e.formatOptions,o=r===void 0?{day:"numeric",weekday:"long",year:"numeric"}:r;return new Intl.DateTimeFormat("en-US",o).format(t)};var getDaysDifference=function(e){var t=new Date;var r=e.getTime()-t.getTime();var o=Math.floor(r/(1e3*60*60*24));return o};var _g=createStore((function(){return{checkoutSessionId:sessionStorage.getItem("zonos--checkout-session-id")||null,currency:"USD",dutiesTaxFees:0,error:null,exchangeRate:null,isSelectedShippingAboveDeminimis:false,isSelectedShippingGuarantee:false,items:[],landedCostData:null,selectedLandedCost:null,selectedShippingOption:null,selectedShippingOptionExpectedDate:"",selectedShippingOptionTransitTime:"",shipping:0,shippingData:null,step:"customer-info",subtotal:0,total:0}})),onChange=_g.onChange,reset=_g.reset,cartStore=_g.state;var cartStoreGetShippingTransitInfo=function(e){var t=e.minTransitAt?getDaysDifference(new Date(e.minTransitAt)):"";var r=e.maxTransitAt?getDaysDifference(new Date(e.maxTransitAt)):"";var o=e.minTransitAt?formatDate({date:new Date(e.minTransitAt)}):"";return{expectedDate:o,maxTransit:r,minTransit:t}};var cartStoreReset=function(){sessionStorage.removeItem("zonos--checkout-session-id");reset()};var cartStoreUpdateToErrorState=function(e){var t=e.messages,r=e.title;cartStore.step="error";cartStore.error={messages:t,title:r}};var cartStoreApplySubtotals=function(e){cartStore.exchangeRate=e.exchangeRate;cartStore.dutiesTaxFees=e.landedCostTotal;cartStore.subtotal=e.items;cartStore.total=e.total;cartStore.currency=e.presentmentCurrencyCode};var cartStoreReCalculateTotal=function(e){var t=e.currency,r=e.itemsAmount,o=e.landedCostId;return __awaiter(void 0,void 0,void 0,(function(){var e,n;return __generator(this,(function(i){switch(i.label){case 0:if(o&&cartStore.selectedLandedCost){e=cartStore.selectedLandedCost.subtotals;cartStoreApplySubtotals(e);log("Exchange rate updated for cart items (landed cost subtotal)","info",cartStore.exchangeRate)}if(!cartStore.checkoutSessionId){logError("Could update cart total without checkout session id");return[2,false]}return[4,stripeStoreUpdateCheckoutSession({currency:t,id:cartStore.checkoutSessionId,itemsAmount:r,landedCostId:o,presentmentCountryCode:localizationStore.selectedCountryCode})];case 1:n=i.sent().json;if(!n){logError("Error occurs when updating checkout session");cartStoreUpdateToErrorState({messages:[translate("There's been an error updating your checkout session. Please reload and try again or contact support if the error persists")],title:translate("Error updating Checkout")});return[2,false]}if(!o){cartStoreApplySubtotals(n.checkoutSessionUpdate.subtotals);log("Exchange rate updated for cart items (checkout session update)","info",cartStore.exchangeRate)}return[2,true]}}))}))};var cartStoreUpdateSelectedShippingOption=function(e){return __awaiter(void 0,void 0,void 0,(function(){var t,r,o,n,i,a,s,c,u,l,d,S,p;return __generator(this,(function(f){switch(f.label){case 0:cartStore.selectedShippingOption=e;a=cartStoreGetShippingTransitInfo(cartStore.selectedShippingOption),s=a.expectedDate,c=a.maxTransit,u=a.minTransit;cartStore.selectedShippingOptionExpectedDate=s;cartStore.selectedShippingOptionTransitTime=u&&c?"".concat(u,"-").concat(c):"".concat(u||c);l=(t=cartStore.landedCostData)===null||t===void 0?void 0:t.find((function(e){var t,r,o;return((r=(t=e.landedCost)===null||t===void 0?void 0:t.shipmentRating)===null||r===void 0?void 0:r.id)===((o=cartStore.selectedShippingOption)===null||o===void 0?void 0:o.id)}));cartStore.selectedLandedCost=l||null;if(!l){return[2,false]}cartStore.shipping=l.subtotals.shipping;d=((r=l===null||l===void 0?void 0:l.landedCost)===null||r===void 0?void 0:r.landedCostGuaranteeCode)==="ZONOS";S=!!((n=(o=l===null||l===void 0?void 0:l.landedCost)===null||o===void 0?void 0:o.deMinimis)===null||n===void 0?void 0:n.find((function(e){return["DUTY","TAX"].includes(e.type)&&e.threshold==="ABOVE"})));cartStore.isSelectedShippingAboveDeminimis=S;cartStore.isSelectedShippingGuarantee=d;return[4,cartStoreReCalculateTotal({landedCostId:(i=l.landedCost)===null||i===void 0?void 0:i.id})];case 1:p=f.sent();return[2,p]}}))}))};onChange("checkoutSessionId",(function(){if(!cartStore.checkoutSessionId){sessionStorage.removeItem("zonos--checkout-session-id");return}sessionStorage.setItem("zonos--checkout-session-id",cartStore.checkoutSessionId)}));var cartStoreUpdateItems=function(e){return __awaiter(void 0,void 0,void 0,(function(){var t,r,o;return __generator(this,(function(n){switch(n.label){case 0:cartStore.items=e;r=(t=e.find(Boolean))===null||t===void 0?void 0:t.currencyCode;o=e.reduce((function(e,t){return e+t.amount*t.quantity}),0);if(!r||!o){return[2]}cartStore.currency=r;stripeStore.isFetchingSession=true;return[4,cartStoreReCalculateTotal({currency:r,itemsAmount:o})];case 1:n.sent();stripeStore.isFetchingSession=false;return[2]}}))}))};var cartStoreResetSelectedShippingOption=function(){cartStore.selectedShippingOption=null;cartStore.isSelectedShippingAboveDeminimis=false;cartStore.isSelectedShippingGuarantee=false;cartStore.selectedShippingOptionExpectedDate="";cartStore.selectedShippingOptionTransitTime="";cartStore.shipping=0};var cartStoreNextStep=function(){if(cartStore.step==="customer-info"){cartStore.step="shipping"}else if(cartStore.step==="shipping"){cartStore.step="payment"}else if(cartStore.step==="payment"){cartStore.step="finish"}};var cartStorePreviousStep=function(){if(cartStore.step==="payment"){cartStore.step="shipping"}else if(cartStore.step==="shipping"){cartStore.step="customer-info";cartStoreResetSelectedShippingOption()}};export{cartStoreApplySubtotals as a,cartStoreGetShippingTransitInfo as b,cartStore as c,cartStoreNextStep as d,cartStorePreviousStep as e,cartStoreReCalculateTotal as f,cartStoreReset as g,cartStoreUpdateItems as h,cartStoreUpdateSelectedShippingOption as i,cartStoreUpdateToErrorState as j,initStripeElements as k,stripeStoreInitCheckoutSession as l,stripeStorePrefetchLandedCost as m,stripeStoreConfirmPayment as n,stripeStoreReset as o,stripeStoreRetrievePayment as p,stripeStore as s};
|
package/dist/esm-es5/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{c as cartStore,a as cartStoreApplySubtotals,b as cartStoreGetShippingTransitInfo,d as cartStoreNextStep,e as cartStorePreviousStep,f as cartStoreReCalculateTotal,g as cartStoreReset,h as cartStoreUpdateItems,i as cartStoreUpdateSelectedShippingOption,j as cartStoreUpdateToErrorState}from"./cart-
|
|
1
|
+
export{c as cartStore,a as cartStoreApplySubtotals,b as cartStoreGetShippingTransitInfo,d as cartStoreNextStep,e as cartStorePreviousStep,f as cartStoreReCalculateTotal,g as cartStoreReset,h as cartStoreUpdateItems,i as cartStoreUpdateSelectedShippingOption,j as cartStoreUpdateToErrorState}from"./cart-54eab7ab.js";import"./zonosStore-e0b7a5cf.js";import"./index-3617e24c.js";import"./localization-9c80f0f5.js";import"./isDarkColor-44e9e451.js";import"./getBorderRadius-35e8acce.js";
|