@zonos/elements 1.3.17 → 1.3.18-alpha.1
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-d25723e7.js → cart-95209ae8.js} +308 -8
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{submitGtag-484eaf9d.js → submitGtag-9d60f3bb.js} +1 -1
- package/dist/cjs/zonos-address_8.cjs.entry.js +1 -1
- package/dist/cjs/zonos-card_2.cjs.entry.js +1 -1
- package/dist/cjs/{zonos-cart-items_9.cjs.entry.js → zonos-cart-items_10.cjs.entry.js} +114 -10
- package/dist/cjs/zonos-checkout.cjs.entry.js +4 -4
- package/dist/cjs/zonos-controller.cjs.entry.js +1 -1
- package/dist/cjs/zonos-country-flag.cjs.entry.js +1 -1
- package/dist/cjs/zonos-country-select_3.cjs.entry.js +1 -1
- package/dist/cjs/zonos-elements.cjs.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 +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-cart-items/zonos-cart-items.js +2 -1
- package/dist/collection/components/checkout/zonos-checkout/zonos-cart-restricted-items/assets/ChevronUpIcon.svg +23 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-cart-restricted-items/assets/empty-item.jpeg +0 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-cart-restricted-items/zonos-cart-restricted-items.css +105 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-cart-restricted-items/zonos-cart-restricted-items.js +101 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-cart-subtotal/zonos-cart-subtotal.js +6 -3
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-payment/zonos-checkout-payment.css +3 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.css +1 -1
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +1 -1
- package/dist/collection/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.js +18 -2
- package/dist/collection/components/checkout/zonos-checkout/zonos-review/zonos-review.js +3 -2
- package/dist/collection/components/store/checkout/cart.js +55 -5
- package/dist/collection/components/store/checkout/stripe.js +6 -2
- package/dist/collection/components/store/hello/localization.js +1 -1
- package/dist/collection/components/store/translationStore/strings.arabic.js +12 -0
- package/dist/collection/components/store/translationStore/strings.base.js +12 -0
- package/dist/collection/components/store/translationStore/strings.chinese.js +12 -0
- package/dist/collection/components/store/translationStore/strings.danish.js +12 -0
- package/dist/collection/components/store/translationStore/strings.dutch.js +12 -0
- package/dist/collection/components/store/translationStore/strings.french.js +12 -0
- package/dist/collection/components/store/translationStore/strings.german.js +12 -0
- package/dist/collection/components/store/translationStore/strings.hebrew.js +12 -0
- package/dist/collection/components/store/translationStore/strings.indonesian.js +12 -0
- package/dist/collection/components/store/translationStore/strings.italian.js +12 -0
- package/dist/collection/components/store/translationStore/strings.japanese.js +12 -0
- package/dist/collection/components/store/translationStore/strings.korean.js +12 -0
- package/dist/collection/components/store/translationStore/strings.norwegian.js +12 -0
- package/dist/collection/components/store/translationStore/strings.polish.js +12 -0
- package/dist/collection/components/store/translationStore/strings.portuguese.js +12 -0
- package/dist/collection/components/store/translationStore/strings.russian.js +12 -0
- package/dist/collection/components/store/translationStore/strings.spanish.js +12 -0
- package/dist/collection/components/store/translationStore/strings.swedish.js +12 -0
- package/dist/collection/components/store/translationStore/strings.turkish.js +12 -0
- package/dist/collection/components/store/translationStore/strings.vietnamese.js +12 -0
- package/dist/collection/components/utils/api/prepCalculateLandedCost.js +1 -1
- package/dist/collection/components/utils/hello/currencyConversion/currencyDisplay.js +6 -1
- package/dist/collection/types/checkout/RestrictProduct.js +1 -0
- package/dist/collection/types/generated/graphql.customer.types.js +40 -0
- package/dist/collection/types/generated/graphql.frontend.types.js +1 -0
- package/dist/components/stripe.js +68 -9
- package/dist/components/submitGtag.js +1 -1
- package/dist/components/trackConversionEvent.js +1 -1
- package/dist/components/translationStore.js +240 -0
- package/dist/components/zonos-cart-items2.js +2 -1
- package/dist/components/zonos-cart-restricted-items.d.ts +11 -0
- package/dist/components/zonos-cart-restricted-items.js +6 -0
- package/dist/components/zonos-cart-restricted-items2.js +135 -0
- package/dist/components/zonos-cart-subtotal2.js +6 -3
- package/dist/components/zonos-checkout-finish2.js +1 -1
- package/dist/components/zonos-checkout-payment2.js +1 -1
- package/dist/components/zonos-checkout.js +27 -21
- package/dist/components/zonos-controller.js +1 -1
- package/dist/components/zonos-country-select2.js +1 -1
- package/dist/components/zonos-customer-info2.js +19 -3
- package/dist/components/zonos-hello-dialog2.js +1 -1
- package/dist/components/zonos-hello.js +1 -1
- package/dist/components/zonos-language-select2.js +1 -1
- package/dist/components/zonos-review2.js +3 -2
- package/dist/components/zonos-shipping2.js +1 -1
- package/dist/esm/{cart-02f5c2ea.js → cart-6448e883.js} +308 -9
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{submitGtag-ba38e1ac.js → submitGtag-b7d369cd.js} +1 -1
- package/dist/esm/zonos-address_8.entry.js +1 -1
- package/dist/esm/zonos-card_2.entry.js +1 -1
- package/dist/esm/{zonos-cart-items_9.entry.js → zonos-cart-items_10.entry.js} +114 -11
- package/dist/esm/zonos-checkout.entry.js +4 -4
- package/dist/esm/zonos-controller.entry.js +1 -1
- package/dist/esm/zonos-country-flag.entry.js +1 -1
- package/dist/esm/zonos-country-select_3.entry.js +1 -1
- package/dist/esm/zonos-elements.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 +1 -1
- package/dist/esm-es5/cart-6448e883.js +1 -0
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/{submitGtag-ba38e1ac.js → submitGtag-b7d369cd.js} +1 -1
- package/dist/esm-es5/zonos-address_8.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 -0
- package/dist/esm-es5/zonos-checkout.entry.js +1 -1
- package/dist/esm-es5/zonos-controller.entry.js +1 -1
- package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
- package/dist/esm-es5/zonos-country-select_3.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-hello.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/checkout/zonos-checkout/zonos-cart-restricted-items/zonos-cart-restricted-items.d.ts +14 -0
- package/dist/types/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.d.ts +2 -0
- package/dist/types/components/store/checkout/cart.d.ts +38 -4
- package/dist/types/components/store/translationStore/strings.arabic.d.ts +12 -0
- package/dist/types/components/store/translationStore/strings.base.d.ts +12 -0
- package/dist/types/components/store/translationStore/strings.chinese.d.ts +12 -0
- package/dist/types/components/store/translationStore/strings.danish.d.ts +12 -0
- package/dist/types/components/store/translationStore/strings.dutch.d.ts +12 -0
- package/dist/types/components/store/translationStore/strings.french.d.ts +12 -0
- package/dist/types/components/store/translationStore/strings.german.d.ts +12 -0
- package/dist/types/components/store/translationStore/strings.hebrew.d.ts +12 -0
- package/dist/types/components/store/translationStore/strings.indonesian.d.ts +12 -0
- package/dist/types/components/store/translationStore/strings.italian.d.ts +12 -0
- package/dist/types/components/store/translationStore/strings.japanese.d.ts +12 -0
- package/dist/types/components/store/translationStore/strings.korean.d.ts +12 -0
- package/dist/types/components/store/translationStore/strings.norwegian.d.ts +12 -0
- package/dist/types/components/store/translationStore/strings.polish.d.ts +12 -0
- package/dist/types/components/store/translationStore/strings.portuguese.d.ts +12 -0
- package/dist/types/components/store/translationStore/strings.russian.d.ts +12 -0
- package/dist/types/components/store/translationStore/strings.spanish.d.ts +12 -0
- package/dist/types/components/store/translationStore/strings.swedish.d.ts +12 -0
- package/dist/types/components/store/translationStore/strings.turkish.d.ts +12 -0
- package/dist/types/components/store/translationStore/strings.vietnamese.d.ts +12 -0
- package/dist/types/components/store/translationStore.d.ts +1 -1
- package/dist/types/components/utils/api/getLocaleMessages.d.ts +1 -1
- package/dist/types/components.d.ts +21 -0
- package/dist/types/scripts/zonosBase.d.ts +6 -1
- package/dist/types/types/checkout/RestrictProduct.d.ts +7 -0
- package/dist/types/types/generated/graphql.customer.types.d.ts +54 -0
- package/dist/types/types/generated/graphql.customer.types.ts +66 -1
- package/dist/types/types/generated/graphql.frontend.types.d.ts +2 -1
- package/dist/types/types/generated/graphql.frontend.types.ts +2 -1
- package/dist/zonos-elements/{p-6dec476d.system.entry.js → p-0759a84d.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-47e00966.system.entry.js → p-0ee61fba.system.entry.js} +1 -1
- package/dist/zonos-elements/p-154aaf95.system.js +1 -1
- package/dist/zonos-elements/{p-239cc943.system.entry.js → p-2fc561ac.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-cf0f8e32.entry.js → p-345503b7.entry.js} +1 -1
- package/dist/zonos-elements/{p-6ece23b9.entry.js → p-3be2e469.entry.js} +1 -1
- package/dist/zonos-elements/p-47c75f81.system.entry.js +1 -0
- package/dist/zonos-elements/{p-532995a4.system.entry.js → p-58f8cee7.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-572a4de2.system.entry.js → p-61100d2e.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-905d842b.entry.js → p-6ea746b9.entry.js} +1 -1
- package/dist/zonos-elements/{p-f124e659.system.entry.js → p-70c35519.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-246133d3.entry.js → p-7b19cd96.entry.js} +1 -1
- package/dist/zonos-elements/{p-0265da6f.js → p-7cc730b0.js} +1 -1
- package/dist/zonos-elements/{p-57adc7f8.entry.js → p-7f48fafe.entry.js} +1 -1
- package/dist/zonos-elements/p-9c575a18.system.entry.js +1 -0
- package/dist/zonos-elements/{p-e0e66004.system.js → p-aaf1e517.system.js} +1 -1
- package/dist/zonos-elements/p-aff5f4ca.js +1 -0
- package/dist/zonos-elements/{p-f99eb5e7.entry.js → p-beca252d.entry.js} +1 -1
- package/dist/zonos-elements/{p-1ba4cf64.entry.js → p-c1f4bb4a.entry.js} +1 -1
- package/dist/zonos-elements/{p-5e33aab7.system.entry.js → p-c64eefdd.system.entry.js} +1 -1
- package/dist/zonos-elements/p-ca621143.entry.js +1 -0
- package/dist/zonos-elements/{p-0267a969.entry.js → p-dbee6587.entry.js} +1 -1
- package/dist/zonos-elements/{p-9da0562e.system.entry.js → p-e0706108.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-54a32fd7.entry.js → p-e3335228.entry.js} +1 -1
- package/dist/zonos-elements/p-ef9cbb66.system.js +1 -0
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/package.json +12 -12
- package/dist/esm-es5/cart-02f5c2ea.js +0 -1
- package/dist/esm-es5/zonos-cart-items_9.entry.js +0 -1
- package/dist/zonos-elements/p-168e5b5f.system.js +0 -1
- package/dist/zonos-elements/p-1b8082dd.entry.js +0 -1
- package/dist/zonos-elements/p-5d13795a.system.entry.js +0 -1
- package/dist/zonos-elements/p-981bf71a.js +0 -1
- package/dist/zonos-elements/p-ed7d251d.system.entry.js +0 -1
|
@@ -1191,6 +1191,10 @@ export const hsCodeValidation = {
|
|
|
1191
1191
|
SomewhatCoherent: 'SOMEWHAT_COHERENT',
|
|
1192
1192
|
Valid: 'VALID',
|
|
1193
1193
|
};
|
|
1194
|
+
export const imageFileType = {
|
|
1195
|
+
Letterhead: 'LETTERHEAD',
|
|
1196
|
+
Signature: 'SIGNATURE',
|
|
1197
|
+
};
|
|
1194
1198
|
export const imageSlot = {
|
|
1195
1199
|
Image_1: 'IMAGE_1',
|
|
1196
1200
|
Image_2: 'IMAGE_2',
|
|
@@ -1211,6 +1215,7 @@ export const inclusivePriceCalculateJobType = {
|
|
|
1211
1215
|
export const inclusivePriceCatalogValidationJobCompletionStatus = {
|
|
1212
1216
|
Archived: 'ARCHIVED',
|
|
1213
1217
|
Completed: 'COMPLETED',
|
|
1218
|
+
Error: 'ERROR',
|
|
1214
1219
|
InProgress: 'IN_PROGRESS',
|
|
1215
1220
|
};
|
|
1216
1221
|
export const inclusivePriceCatalogValidationJobComplianceStatus = {
|
|
@@ -1614,10 +1619,38 @@ export const notificationActiveStatus = {
|
|
|
1614
1619
|
Disabled: 'DISABLED',
|
|
1615
1620
|
Enabled: 'ENABLED',
|
|
1616
1621
|
};
|
|
1622
|
+
export const orderBillingAdjustmentFeeType = {
|
|
1623
|
+
AdditionalTariffLines: 'ADDITIONAL_TARIFF_LINES',
|
|
1624
|
+
Adjustment: 'ADJUSTMENT',
|
|
1625
|
+
Advancement: 'ADVANCEMENT',
|
|
1626
|
+
BrokerageFee: 'BROKERAGE_FEE',
|
|
1627
|
+
Buffer: 'BUFFER',
|
|
1628
|
+
Cod: 'COD',
|
|
1629
|
+
Country: 'COUNTRY',
|
|
1630
|
+
CurrencyConversionFee: 'CURRENCY_CONVERSION_FEE',
|
|
1631
|
+
DdpServiceFee: 'DDP_SERVICE_FEE',
|
|
1632
|
+
Duty: 'DUTY',
|
|
1633
|
+
FxFee: 'FX_FEE',
|
|
1634
|
+
FxFeeNonRefundedAmounts: 'FX_FEE_NON_REFUNDED_AMOUNTS',
|
|
1635
|
+
InclusivePriceAdjustment: 'INCLUSIVE_PRICE_ADJUSTMENT',
|
|
1636
|
+
InclusivePricing: 'INCLUSIVE_PRICING',
|
|
1637
|
+
Item: 'ITEM',
|
|
1638
|
+
Other: 'OTHER',
|
|
1639
|
+
Shipping: 'SHIPPING',
|
|
1640
|
+
Tax: 'TAX',
|
|
1641
|
+
ZonosLandedCost: 'ZONOS_LANDED_COST',
|
|
1642
|
+
ZonosMerchantProcessing: 'ZONOS_MERCHANT_PROCESSING',
|
|
1643
|
+
ZonosTransaction: 'ZONOS_TRANSACTION',
|
|
1644
|
+
};
|
|
1617
1645
|
export const orderCompleteBillingMethod = {
|
|
1618
1646
|
BillingDgs: 'BILLING_DGS',
|
|
1619
1647
|
Legacy: 'LEGACY',
|
|
1620
1648
|
};
|
|
1649
|
+
export const orderRefundSubtotalType = {
|
|
1650
|
+
DutyTaxFee: 'DUTY_TAX_FEE',
|
|
1651
|
+
Item: 'ITEM',
|
|
1652
|
+
Shipping: 'SHIPPING',
|
|
1653
|
+
};
|
|
1621
1654
|
export const orderStatus = {
|
|
1622
1655
|
Canceled: 'CANCELED',
|
|
1623
1656
|
Completed: 'COMPLETED',
|
|
@@ -1697,6 +1730,9 @@ export const partyType = {
|
|
|
1697
1730
|
Payee: 'PAYEE',
|
|
1698
1731
|
Payor: 'PAYOR',
|
|
1699
1732
|
};
|
|
1733
|
+
export const paymentProcessorCode = {
|
|
1734
|
+
Stripe: 'STRIPE',
|
|
1735
|
+
};
|
|
1700
1736
|
export const paymentType = {
|
|
1701
1737
|
Card: 'CARD',
|
|
1702
1738
|
UsBankAccount: 'US_BANK_ACCOUNT',
|
|
@@ -1737,6 +1773,10 @@ export const pickupCategory = {
|
|
|
1737
1773
|
SameDay: 'SAME_DAY',
|
|
1738
1774
|
SameDayCity: 'SAME_DAY_CITY',
|
|
1739
1775
|
};
|
|
1776
|
+
export const priceAdjustmentType = {
|
|
1777
|
+
Fixed: 'FIXED',
|
|
1778
|
+
Percentage: 'PERCENTAGE',
|
|
1779
|
+
};
|
|
1740
1780
|
export const processingStatusCode = {
|
|
1741
1781
|
Failed: 'FAILED',
|
|
1742
1782
|
Pending: 'PENDING',
|
|
@@ -23,6 +23,7 @@ export const featureAspectKeyEnum = {
|
|
|
23
23
|
FeatureAspect: 'feature_aspect',
|
|
24
24
|
LocaleMessage: 'locale_message',
|
|
25
25
|
NewCheckoutBeta: 'new_checkout_beta',
|
|
26
|
+
NewPayoutReport: 'new_payout_report',
|
|
26
27
|
PageAuditor: 'page_auditor',
|
|
27
28
|
PromptExplorer: 'prompt_explorer',
|
|
28
29
|
TeamAuditor: 'team_auditor',
|
|
@@ -426,7 +426,12 @@ const currencyDisplay = () => {
|
|
|
426
426
|
}
|
|
427
427
|
const { currencyElementSelector } = zonosStore.helloSettings;
|
|
428
428
|
if (zonosStore.currencyConverter) {
|
|
429
|
-
zonosStore.currencyConverter(
|
|
429
|
+
zonosStore.currencyConverter({
|
|
430
|
+
convert: currencyConvert,
|
|
431
|
+
convertAndFormat: currencyConvertAndFormat,
|
|
432
|
+
format: currencyFormat,
|
|
433
|
+
selector: currencyElementSelector,
|
|
434
|
+
});
|
|
430
435
|
}
|
|
431
436
|
else {
|
|
432
437
|
defaultCurrencyConverter();
|
|
@@ -572,7 +577,7 @@ const initLocalizationStore = async () => {
|
|
|
572
577
|
const overrideLocale = getOverrideLocale();
|
|
573
578
|
localizationStore.selectedLocale = overrideLocale || locale || 'en';
|
|
574
579
|
translationStoreUpdateLanguage(localizationStore.selectedLocale);
|
|
575
|
-
const devSites = ['dev.elements', 'dev.dashboard'];
|
|
580
|
+
const devSites = ['dev.storybook.elements', 'dev.elements', 'dev.dashboard'];
|
|
576
581
|
// If the country code is not set, set it to the US for development (vercel can't get geo country in dev)
|
|
577
582
|
if (!localizationStore.selectedCountryCode &&
|
|
578
583
|
devSites.some(site => window.location.origin.includes(site))) {
|
|
@@ -637,6 +642,7 @@ const { onChange: onChange$1, reset: reset$1, state: cartStore, } = createStore(
|
|
|
637
642
|
isSelectedShippingGuarantee: false,
|
|
638
643
|
items: [],
|
|
639
644
|
landedCostData: null,
|
|
645
|
+
restrictedItems: [],
|
|
640
646
|
selectedLandedCost: null,
|
|
641
647
|
selectedShippingOption: null,
|
|
642
648
|
selectedShippingOptionExpectedDate: '',
|
|
@@ -693,6 +699,39 @@ const cartStoreGetShippingTransitInfo = (item) => {
|
|
|
693
699
|
minTransit,
|
|
694
700
|
};
|
|
695
701
|
};
|
|
702
|
+
const getMatchItem = ({ item1, item2, }) => {
|
|
703
|
+
if (!item1 || !item2) {
|
|
704
|
+
return false;
|
|
705
|
+
}
|
|
706
|
+
return ((item2.sku && item1.sku && item1.sku === item2.sku) ||
|
|
707
|
+
(item2.description &&
|
|
708
|
+
item1.description &&
|
|
709
|
+
item1.description === item2.description) ||
|
|
710
|
+
(item1.name && item2.name && item1.name === item2.name));
|
|
711
|
+
};
|
|
712
|
+
/**
|
|
713
|
+
* Check and set restricted items in cart
|
|
714
|
+
*/
|
|
715
|
+
const cartStoreCheckItemRestrictions = (itemsWorkflow) => {
|
|
716
|
+
log('Checking item restrictions');
|
|
717
|
+
const mappedRestrictedItems = itemsWorkflow
|
|
718
|
+
.map(item => {
|
|
719
|
+
if (!item.restriction) {
|
|
720
|
+
return null;
|
|
721
|
+
}
|
|
722
|
+
const { restriction } = item;
|
|
723
|
+
const matchedItem = cartStore.items.find(x => getMatchItem({ item1: x, item2: item }));
|
|
724
|
+
return Object.assign(Object.assign({ matchedItem }, item), { restriction });
|
|
725
|
+
})
|
|
726
|
+
.filter(Boolean);
|
|
727
|
+
cartStore.restrictedItems = mappedRestrictedItems;
|
|
728
|
+
// remove items that are restricted from cart
|
|
729
|
+
cartStore.items = cartStore.items.map(item => (Object.assign(Object.assign({}, item), { isRestricted: !!mappedRestrictedItems.find(x => getMatchItem({ item1: x, item2: item })) })));
|
|
730
|
+
return {
|
|
731
|
+
cartItems: cartStore.items,
|
|
732
|
+
restrictedItems: mappedRestrictedItems,
|
|
733
|
+
};
|
|
734
|
+
};
|
|
696
735
|
const cartStoreReset = () => {
|
|
697
736
|
sessionStorage.removeItem('zonos--checkout-session-id');
|
|
698
737
|
// reset cart store
|
|
@@ -715,6 +754,16 @@ const cartStoreApplySubtotals = (subtotals) => {
|
|
|
715
754
|
cartStore.total = subtotals.total;
|
|
716
755
|
cartStore.currency = subtotals.presentmentCurrencyCode;
|
|
717
756
|
};
|
|
757
|
+
/**
|
|
758
|
+
* Detect if there are any items in cart that are not restricted and have positive amount, exclude negative amount items
|
|
759
|
+
*/
|
|
760
|
+
const cartStoreHasOneEligibleItem = () => {
|
|
761
|
+
// filter all items with positive amount
|
|
762
|
+
const checkItems = cartStore.items.filter(item => item.amount > 0);
|
|
763
|
+
// only check restricted status for items with positive amount
|
|
764
|
+
// if there is no item restricted found => all items are restricted
|
|
765
|
+
return !!checkItems.find(item => !item.isRestricted);
|
|
766
|
+
};
|
|
718
767
|
const cartStoreReCalculateTotal = async ({ currency, itemsAmount, landedCostId, }) => {
|
|
719
768
|
if (landedCostId && cartStore.selectedLandedCost) {
|
|
720
769
|
// update cart total right away if we have landed cost id to avoid order total flickering
|
|
@@ -795,11 +844,17 @@ onChange$1('checkoutSessionId', () => {
|
|
|
795
844
|
}
|
|
796
845
|
sessionStorage.setItem('zonos--checkout-session-id', cartStore.checkoutSessionId);
|
|
797
846
|
});
|
|
798
|
-
const
|
|
847
|
+
const getCartItemToUse = (items) => items.map(item => (Object.assign(Object.assign({}, item), { isRestricted: false })));
|
|
848
|
+
const cartStoreResetCartItems = () => {
|
|
849
|
+
// mark all items as not restricted
|
|
850
|
+
cartStore.items = cartStore.items.map(item => (Object.assign(Object.assign({}, item), { isRestricted: false })));
|
|
851
|
+
cartStore.restrictedItems = [];
|
|
852
|
+
};
|
|
853
|
+
const cartStoreUpdateItems = async (cartItems) => {
|
|
799
854
|
var _a;
|
|
800
|
-
cartStore.items =
|
|
801
|
-
const currency = (_a =
|
|
802
|
-
const total =
|
|
855
|
+
cartStore.items = getCartItemToUse(cartItems);
|
|
856
|
+
const currency = (_a = cartItems.find(Boolean)) === null || _a === void 0 ? void 0 : _a.currencyCode;
|
|
857
|
+
const total = cartItems.reduce((amt, item) => {
|
|
803
858
|
return amt + item.amount * item.quantity;
|
|
804
859
|
}, 0);
|
|
805
860
|
if (!currency || !total) {
|
|
@@ -882,7 +937,7 @@ const prepCalculateLandedCost = () => {
|
|
|
882
937
|
lastName: stripeAddressData.value.lastName || '',
|
|
883
938
|
phone: stripeAddressData.value.phone || '',
|
|
884
939
|
},
|
|
885
|
-
items: cartStore.items
|
|
940
|
+
items: cartStore.items,
|
|
886
941
|
shippingAddress: {
|
|
887
942
|
addressLine1: stripeAddressData.value.address.line1,
|
|
888
943
|
addressLine2: stripeAddressData.value.address.line2 || '',
|
|
@@ -1292,7 +1347,9 @@ const stripeStorePrefetchLandedCost = async () => {
|
|
|
1292
1347
|
try {
|
|
1293
1348
|
const abortController = new AbortController();
|
|
1294
1349
|
stripeStore.fetchingLandedCostAbordController = abortController;
|
|
1295
|
-
|
|
1350
|
+
// Reset cart items to non-restricted state and restricted item list
|
|
1351
|
+
cartStoreResetCartItems();
|
|
1352
|
+
const { checkoutSessionWorkflow, itemCreateWorkflow, landedCostCalculateWorkflow, shipmentRatingCalculateWorkflow, } = await calculateLandedCost(abortController);
|
|
1296
1353
|
// reset abort controller after we are done
|
|
1297
1354
|
stripeStore.fetchingLandedCostAbordController = null;
|
|
1298
1355
|
// update cart store with landed cost info
|
|
@@ -1311,6 +1368,8 @@ const stripeStorePrefetchLandedCost = async () => {
|
|
|
1311
1368
|
const subtotals = !!firstLandedCostData
|
|
1312
1369
|
? firstLandedCostData.subtotals
|
|
1313
1370
|
: null;
|
|
1371
|
+
// check and update cart items with restrictions
|
|
1372
|
+
cartStoreCheckItemRestrictions(itemCreateWorkflow);
|
|
1314
1373
|
if (subtotals) {
|
|
1315
1374
|
// prefetch landed cost will not update shipping and taxes since we haven't selected shipping method yet
|
|
1316
1375
|
cartStoreApplySubtotals({
|
|
@@ -1619,4 +1678,4 @@ onChange('clientSecret', clientSecret => {
|
|
|
1619
1678
|
}
|
|
1620
1679
|
});
|
|
1621
1680
|
|
|
1622
|
-
export {
|
|
1681
|
+
export { cartStoreGetShippingTransitInfo as A, isValidSelector as B, initLocalizationStore as C, getZCountryUrlParam as D, setZCountryUrlParam as E, currencyDisplay as F, currencyConvertAndFormat as G, currencyConvert as H, currencyFormat as I, localizationStore as a, cartStoreHasOneEligibleItem as b, cartStore as c, log as d, stripeStoreGetDomesticShippingSession as e, localizationStoreUpdateSelectedCountryCode as f, stripeStoreCleanupDomesticShippingSession as g, stripeStoreSaveDomesticShippingSession as h, initStripeElements as i, cartStoreUpdateItems as j, cartStoreReset as k, logError as l, cartStoreResetTabItems as m, stripeStoreInitCheckoutSession as n, cartStoreUpdateToErrorState as o, stripeStorePrefetchLandedCost as p, cartStoreNextStep as q, stripeStoreConfirmPayment as r, stripeStore as s, stripeStoreReset as t, localizationStoreOnUpdate as u, handleFetch as v, stripeStoreRetrievePayment as w, stripeStoreTranslateAddressToLatin as x, localizationStoreUpdateSelectedLocale as y, cartStoreUpdateSelectedShippingOption as z };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { v as handleFetch, c as cartStore, a as localizationStore } from './stripe.js';
|
|
2
2
|
import { z as zonosStore } from './zonosStore.js';
|
|
3
3
|
|
|
4
4
|
const trackConversionEvent = async (eventName, metadata) => {
|