@zonos/elements 1.2.0 → 1.2.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-ac9a3c40.js → cart-7b70853c.js} +5 -15
- package/dist/cjs/{getBorderRadius-1f9c0fa3.js → getBorderRadius-fdd605c6.js} +1 -1
- package/dist/cjs/index.cjs.js +5 -5
- package/dist/cjs/{isDarkColor-0651a165.js → isDarkColor-f3446afd.js} +1 -1
- package/dist/cjs/{localization-3a4b4a43.js → localization-387a8a65.js} +1 -1
- package/dist/cjs/{submitGtag-9e873a0a.js → submitGtag-bf6e7c5e.js} +2 -2
- package/dist/cjs/zonos-address_2.cjs.entry.js +5 -5
- package/dist/cjs/zonos-button_2.cjs.entry.js +3 -3
- package/dist/cjs/zonos-cart-items_10.cjs.entry.js +17 -16
- package/dist/cjs/zonos-checkout.cjs.entry.js +16 -9
- package/dist/cjs/zonos-controller.cjs.entry.js +15 -6
- package/dist/cjs/zonos-country-flag_4.cjs.entry.js +3 -3
- package/dist/cjs/zonos-hello-dialog.cjs.entry.js +2 -2
- package/dist/cjs/zonos-hello.cjs.entry.js +17 -3
- package/dist/cjs/zonos-payment.cjs.entry.js +5 -5
- package/dist/cjs/zonos-shipping-rich-radio.cjs.entry.js +3 -3
- package/dist/cjs/{zonosStore-270f79cc.js → zonosStore-a430ec5b.js} +2 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-cart-subtotal/zonos-cart-subtotal.css +6 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-cart-subtotal/zonos-cart-subtotal.js +3 -2
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-payment/zonos-checkout-payment.css +7 -3
- 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.js +10 -3
- package/dist/collection/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.css +6 -2
- package/dist/collection/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.js +2 -2
- package/dist/collection/components/checkout/zonos-checkout/zonos-shipping/zonos-shipping.css +7 -3
- package/dist/collection/components/common/zonos-shipping-rich-radio/zonos-shipping-rich-radio.css +5 -2
- package/dist/collection/components/hello/zonos-hello/zonos-hello.js +15 -1
- package/dist/collection/components/main/zonos-controller.js +10 -1
- package/dist/collection/components/store/zonosStore.js +2 -0
- package/dist/collection/components/utils/api/prepCalculateLandedCost.js +1 -11
- package/dist/collection/types/generated/graphql.customer.types.js +4 -1
- package/dist/components/cart.js +1 -11
- package/dist/components/zonos-cart-subtotal2.js +4 -3
- package/dist/components/zonos-checkout-payment2.js +3 -3
- package/dist/components/zonos-checkout.js +10 -3
- package/dist/components/zonos-controller.js +10 -1
- package/dist/components/zonos-customer-info2.js +3 -3
- package/dist/components/zonos-hello.js +16 -2
- package/dist/components/zonos-shipping-rich-radio2.js +1 -1
- package/dist/components/zonos-shipping2.js +1 -1
- package/dist/components/zonosStore.js +2 -0
- package/dist/esm/{cart-cf46a264.js → cart-07091d2a.js} +5 -15
- package/dist/esm/{getBorderRadius-278281bf.js → getBorderRadius-45764ad7.js} +1 -1
- package/dist/esm/index.js +5 -5
- package/dist/esm/{isDarkColor-8fd3a24e.js → isDarkColor-6fbb9b14.js} +1 -1
- package/dist/esm/{localization-add1d9e9.js → localization-b3c2a9a9.js} +1 -1
- package/dist/esm/{submitGtag-aa5fe441.js → submitGtag-c0b655ad.js} +2 -2
- package/dist/esm/zonos-address_2.entry.js +5 -5
- package/dist/esm/zonos-button_2.entry.js +3 -3
- package/dist/esm/zonos-cart-items_10.entry.js +17 -16
- package/dist/esm/zonos-checkout.entry.js +16 -9
- package/dist/esm/zonos-controller.entry.js +15 -6
- package/dist/esm/zonos-country-flag_4.entry.js +3 -3
- package/dist/esm/zonos-hello-dialog.entry.js +2 -2
- package/dist/esm/zonos-hello.entry.js +17 -3
- package/dist/esm/zonos-payment.entry.js +5 -5
- package/dist/esm/zonos-shipping-rich-radio.entry.js +3 -3
- package/dist/esm/{zonosStore-e5291656.js → zonosStore-05a62104.js} +2 -0
- package/dist/esm-es5/cart-07091d2a.js +1 -0
- package/dist/esm-es5/{getBorderRadius-278281bf.js → getBorderRadius-45764ad7.js} +1 -1
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/{isDarkColor-8fd3a24e.js → isDarkColor-6fbb9b14.js} +1 -1
- package/dist/esm-es5/{localization-add1d9e9.js → localization-b3c2a9a9.js} +1 -1
- package/dist/esm-es5/{submitGtag-aa5fe441.js → submitGtag-c0b655ad.js} +1 -1
- 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-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/esm-es5/zonos-shipping-rich-radio.entry.js +1 -1
- package/dist/esm-es5/{zonosStore-e5291656.js → zonosStore-05a62104.js} +1 -1
- package/dist/scripts/loadZonos.js +3 -3
- package/dist/scripts/zonos.js +3 -3
- package/dist/types/components/hello/zonos-hello/zonos-hello.d.ts +1 -0
- package/dist/types/components/store/checkout/cart.d.ts +1 -0
- package/dist/types/types/checkout/CheckoutConfig.d.ts +2 -1
- package/dist/types/types/generated/graphql.customer.types.d.ts +36 -8
- package/dist/types/types/generated/graphql.customer.types.ts +48 -8
- package/dist/types/types/generated/graphql.frontend.types.d.ts +4 -0
- package/dist/types/types/generated/graphql.frontend.types.ts +1 -0
- package/dist/zonos-elements/index.esm.js +1 -1
- package/dist/zonos-elements/{p-01990dcd.js → p-08695f4e.js} +1 -1
- package/dist/zonos-elements/p-0a788f68.entry.js +1 -0
- package/dist/zonos-elements/p-0e0b46a5.js +1 -0
- package/dist/zonos-elements/{p-847a1b9a.system.entry.js → p-0f7233fd.system.entry.js} +1 -1
- package/dist/zonos-elements/p-23b0b4a2.system.entry.js +1 -0
- package/dist/zonos-elements/{p-bb35713f.entry.js → p-2c20c082.entry.js} +1 -1
- package/dist/zonos-elements/p-30fd29fb.js +1 -0
- package/dist/zonos-elements/{p-ebb4de4e.entry.js → p-343071d5.entry.js} +1 -1
- package/dist/zonos-elements/p-37db3842.system.entry.js +1 -0
- package/dist/zonos-elements/{p-f5392f7e.entry.js → p-37fc9f6b.entry.js} +1 -1
- package/dist/zonos-elements/{p-0cd4b073.system.js → p-42ba069d.system.js} +1 -1
- package/dist/zonos-elements/{p-96fbce98.system.entry.js → p-4524a84f.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-9d06e3a3.system.js → p-6dcd752e.system.js} +1 -1
- package/dist/zonos-elements/{p-1293796f.js → p-6df1eaee.js} +1 -1
- package/dist/zonos-elements/{p-0f64d234.entry.js → p-6e7cd3f7.entry.js} +1 -1
- package/dist/zonos-elements/p-79f9e330.system.js +1 -0
- package/dist/zonos-elements/{p-18d37ad9.system.js → p-85ab35c9.system.js} +1 -1
- package/dist/zonos-elements/p-87f324c5.entry.js +1 -0
- package/dist/zonos-elements/{p-ddc11127.system.entry.js → p-8a75b765.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-1b6d064d.system.js → p-8c867835.system.js} +1 -1
- package/dist/zonos-elements/p-914ce305.system.entry.js +1 -0
- package/dist/zonos-elements/{p-466bae3a.entry.js → p-96a3c767.entry.js} +1 -1
- package/dist/zonos-elements/{p-8fa1244b.entry.js → p-98105ede.entry.js} +1 -1
- package/dist/zonos-elements/{p-6bb67f2e.system.entry.js → p-9adf546f.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-d0ecfe92.system.entry.js → p-9b86e655.system.entry.js} +1 -1
- package/dist/zonos-elements/p-9dc9cbc8.entry.js +1 -0
- package/dist/zonos-elements/{p-a3f394b7.system.entry.js → p-a20b97e9.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-6cd7a90e.system.js → p-b64bbf38.system.js} +1 -1
- package/dist/zonos-elements/{p-ee671d13.js → p-bb36a9f8.js} +1 -1
- package/dist/zonos-elements/{p-86825d4a.js → p-bf070bf6.js} +1 -1
- package/dist/zonos-elements/{p-083b951d.system.entry.js → p-c28157ec.system.entry.js} +1 -1
- package/dist/zonos-elements/p-d43749bd.entry.js +1 -0
- package/dist/zonos-elements/{p-1781245e.system.js → p-f23749e4.system.js} +1 -1
- package/dist/zonos-elements/p-f8491335.system.js +1 -1
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/package.json +1 -1
- package/dist/esm-es5/cart-cf46a264.js +0 -1
- package/dist/zonos-elements/p-0a33b542.system.js +0 -1
- package/dist/zonos-elements/p-1835470b.system.entry.js +0 -1
- package/dist/zonos-elements/p-82ab16e2.js +0 -1
- package/dist/zonos-elements/p-a014d540.entry.js +0 -1
- package/dist/zonos-elements/p-aed841bf.entry.js +0 -1
- package/dist/zonos-elements/p-b0a39955.js +0 -1
- package/dist/zonos-elements/p-c4eb37b5.entry.js +0 -1
- package/dist/zonos-elements/p-de86c2e4.system.entry.js +0 -1
- package/dist/zonos-elements/p-e80aae7d.entry.js +0 -1
- package/dist/zonos-elements/p-eb6cc449.system.entry.js +0 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { r as registerInstance, a as getAssetPath, h, H as Host, F as Fragment, c as createEvent, d as getElement } from './index-d1aa9293.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-
|
|
4
|
-
import { g as getBorderRadius } from './getBorderRadius-
|
|
5
|
-
import { s as submitGtag, i as isCheckoutMobile } from './submitGtag-
|
|
2
|
+
import { c as cartStore, s as stripeStore, p as stripeStoreRetrievePayment, o as stripeStoreReset, i as cartStoreUpdateSelectedShippingOption, b as cartStoreGetShippingTransitInfo } from './cart-07091d2a.js';
|
|
3
|
+
import { t as translate } from './localization-b3c2a9a9.js';
|
|
4
|
+
import { g as getBorderRadius } from './getBorderRadius-45764ad7.js';
|
|
5
|
+
import { s as submitGtag, i as isCheckoutMobile } from './submitGtag-c0b655ad.js';
|
|
6
6
|
import { c as classes } from './classes-0d95c529.js';
|
|
7
|
-
import { z as zonosStore } from './zonosStore-
|
|
8
|
-
import './isDarkColor-
|
|
7
|
+
import { z as zonosStore } from './zonosStore-05a62104.js';
|
|
8
|
+
import './isDarkColor-6fbb9b14.js';
|
|
9
9
|
|
|
10
10
|
const formatCurrency = ({ amount, currency, showCurrencyText, }) => showCurrencyText
|
|
11
11
|
? `${new Intl.NumberFormat('en-US', {
|
|
@@ -50,7 +50,7 @@ const InfoIcon = `<svg viewBox="0 0 17 16" fill="none" xmlns="https://www.w3.org
|
|
|
50
50
|
</svg>
|
|
51
51
|
`;
|
|
52
52
|
|
|
53
|
-
const zonosCartSubtotalCss = ":host{font-family:Inter;display:block}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host .zonos--cart-table{width:100%;border:none;border-collapse:collapse;overflow:auto;font-size:var(--amino-font-size-base)}:host .zonos--cart-table .zonos--column{padding:var(--amino-space-20) var(--amino-space-8);vertical-align:top}:host .zonos--cart-table .zonos--column:last-child{text-align:right}:host .zonos--cart-table .zonos--column:first-child{width:60px}:host .zonos--title-with-icon{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;gap:var(--amino-space-8)}:host .zonos--cart-subtotal-title,:host .zonos--cart-subtotal-price{border-bottom:1px solid var(--amino-gray-200)}:host .zonos--cart-subtotal-price{text-align:right}";
|
|
53
|
+
const zonosCartSubtotalCss = ":host{font-family:Inter;display:block}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host .zonos--cart-table{width:100%;border:none;border-collapse:collapse;overflow:auto;font-size:var(--amino-font-size-base)}:host .zonos--cart-table .zonos--column{padding:var(--amino-space-20) var(--amino-space-8);vertical-align:top}:host .zonos--cart-table .zonos--column:last-child{text-align:right}:host .zonos--cart-table .zonos--column:first-child{width:60px}:host .zonos--title-with-icon{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;gap:var(--amino-space-8)}:host .zonos--cart-subtotal-title,:host .zonos--cart-subtotal-price{border-bottom:1px solid var(--amino-gray-200)}:host .zonos--cart-duty-tax-price{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-align:end;align-items:flex-end;gap:5px}:host .zonos--cart-subtotal-price{text-align:right}";
|
|
54
54
|
|
|
55
55
|
const ZonosCartSubtotal = class {
|
|
56
56
|
constructor(hostRef) {
|
|
@@ -58,6 +58,7 @@ const ZonosCartSubtotal = class {
|
|
|
58
58
|
}
|
|
59
59
|
render() {
|
|
60
60
|
const totalWithoutTaxes = cartStore.total - cartStore.dutiesTaxFees;
|
|
61
|
+
const showDutyTaxesInfo = cartStore.step === 'payment' || cartStore.step === 'shipping';
|
|
61
62
|
const renderShippingInfo = () => {
|
|
62
63
|
if (!cartStore.selectedShippingOption) {
|
|
63
64
|
return (h(Fragment, null, h("zonos-text", { class: "zonos--title", type: "semiBoldLabel" }, translate('Shipping')), h("zonos-text", { class: "zonos--caption", type: "caption" }, translate('No shipping method selected'))));
|
|
@@ -72,12 +73,12 @@ const ZonosCartSubtotal = class {
|
|
|
72
73
|
amount: cartStore.shipping,
|
|
73
74
|
currency: cartStore.currency,
|
|
74
75
|
})
|
|
75
|
-
: '-')),
|
|
76
|
+
: '-')), showDutyTaxesInfo && (h("tr", { class: "zonos--row zonos--cart-duties" }, h("td", { class: "zonos--column" }), h("td", { class: "zonos--column zonos--cart-subtotal-title" }, h("div", { class: "zonos--title-with-icon" }, h("zonos-text", { class: "zonos--title", type: "semiBoldLabel" }, translate('Duties, taxes, and fees')), h("zonos-icon", { content: InfoIcon, size: 16 })), !!cartStore.isSelectedShippingAboveDeminimis && (h("zonos-text", { color: "gray-800", type: "body" }, translate('Order is over the de minimis threshold for both duty and tax')))), h("td", { class: "zonos--column zonos--cart-subtotal-price" }, h("div", { class: "zonos--cart-duty-tax-price" }, cartStore.dutiesTaxFees
|
|
76
77
|
? formatCurrency({
|
|
77
78
|
amount: cartStore.dutiesTaxFees,
|
|
78
79
|
currency: cartStore.currency,
|
|
79
80
|
})
|
|
80
|
-
: '-', cartStore.isSelectedShippingGuarantee && (h("zonos-badge", null, translate('Guaranteed')))))), h("tr", { class: "zonos--row zonos--cart-pay-total" }, h("td", { class: "zonos--column" }), h("td", { class: "zonos--column" }, h("zonos-text", { class: "zonos--title", type: "semiBoldLabel" }, translate('Order total'))), h("td", { class: "zonos--column" }, h("zonos-text", { type: "semiBoldLabel" }, formatCurrency({
|
|
81
|
+
: '-', cartStore.isSelectedShippingGuarantee && (h("zonos-badge", null, translate('Guaranteed'))))))), h("tr", { class: "zonos--row zonos--cart-pay-total" }, h("td", { class: "zonos--column" }), h("td", { class: "zonos--column" }, h("zonos-text", { class: "zonos--title", type: "semiBoldLabel" }, translate('Order total'))), h("td", { class: "zonos--column" }, h("zonos-text", { type: "semiBoldLabel" }, formatCurrency({
|
|
81
82
|
amount:
|
|
82
83
|
// show total without taxes when step is shipping, show total with taxes when step is payment
|
|
83
84
|
cartStore.step === 'shipping'
|
|
@@ -160,7 +161,7 @@ const ZonosCheckoutFinish = class {
|
|
|
160
161
|
};
|
|
161
162
|
ZonosCheckoutFinish.style = zonosCheckoutFinishCss;
|
|
162
163
|
|
|
163
|
-
const zonosCheckoutPaymentCss = ".sc-zonos-checkout-payment-h{font-family:Inter;display:block}.sc-zonos-checkout-payment-h img.sc-zonos-checkout-payment{max-width:100%}.sc-zonos-checkout-payment-h dl.sc-zonos-checkout-payment,.sc-zonos-checkout-payment-h dd.sc-zonos-checkout-payment,.sc-zonos-checkout-payment-h h1.sc-zonos-checkout-payment,.sc-zonos-checkout-payment-h h2.sc-zonos-checkout-payment,.sc-zonos-checkout-payment-h h3.sc-zonos-checkout-payment,.sc-zonos-checkout-payment-h h4.sc-zonos-checkout-payment,.sc-zonos-checkout-payment-h h5.sc-zonos-checkout-payment,.sc-zonos-checkout-payment-h h6.sc-zonos-checkout-payment,.sc-zonos-checkout-payment-h hr.sc-zonos-checkout-payment,.sc-zonos-checkout-payment-h figure.sc-zonos-checkout-payment,.sc-zonos-checkout-payment-h p.sc-zonos-checkout-payment,.sc-zonos-checkout-payment-h pre.sc-zonos-checkout-payment{margin:0}.sc-zonos-checkout-payment-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-checkout-payment-h{overflow:hidden;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}.sc-zonos-checkout-payment-h .zonos--title.sc-zonos-checkout-payment{margin-bottom:var(--amino-space-24)}.sc-zonos-checkout-payment-h .zonos--group.sc-zonos-checkout-payment{margin-bottom:var(--amino-space-20);overflow:auto;padding:
|
|
164
|
+
const zonosCheckoutPaymentCss = ".sc-zonos-checkout-payment-h{font-family:Inter;display:block}.sc-zonos-checkout-payment-h img.sc-zonos-checkout-payment{max-width:100%}.sc-zonos-checkout-payment-h dl.sc-zonos-checkout-payment,.sc-zonos-checkout-payment-h dd.sc-zonos-checkout-payment,.sc-zonos-checkout-payment-h h1.sc-zonos-checkout-payment,.sc-zonos-checkout-payment-h h2.sc-zonos-checkout-payment,.sc-zonos-checkout-payment-h h3.sc-zonos-checkout-payment,.sc-zonos-checkout-payment-h h4.sc-zonos-checkout-payment,.sc-zonos-checkout-payment-h h5.sc-zonos-checkout-payment,.sc-zonos-checkout-payment-h h6.sc-zonos-checkout-payment,.sc-zonos-checkout-payment-h hr.sc-zonos-checkout-payment,.sc-zonos-checkout-payment-h figure.sc-zonos-checkout-payment,.sc-zonos-checkout-payment-h p.sc-zonos-checkout-payment,.sc-zonos-checkout-payment-h pre.sc-zonos-checkout-payment{margin:0}.sc-zonos-checkout-payment-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-checkout-payment-h{overflow:hidden;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}.sc-zonos-checkout-payment-h .zonos--title.sc-zonos-checkout-payment{margin-bottom:var(--amino-space-24)}.sc-zonos-checkout-payment-h .zonos--group.sc-zonos-checkout-payment{margin-bottom:var(--amino-space-20);overflow:auto;padding:5px}.sc-zonos-checkout-payment-h .zonos--group.sc-zonos-checkout-payment::-webkit-scrollbar{width:10px}.sc-zonos-checkout-payment-h .zonos--group.sc-zonos-checkout-payment::-webkit-scrollbar-track{background:var(--amino-gray-50)}.sc-zonos-checkout-payment-h .zonos--group.sc-zonos-checkout-payment::-webkit-scrollbar-thumb{border-radius:10px;background:#cccccc;border:3px solid transparent;background-clip:content-box}.sc-zonos-checkout-payment-h .zonos--group.sc-zonos-checkout-payment::-webkit-scrollbar-thumb:hover{background:#d6d6d6}.sc-zonos-checkout-payment-h .zonos--payment-error-banner.sc-zonos-checkout-payment{margin-bottom:var(--amino-space-8)}.sc-zonos-checkout-payment-h .zonos--group-btn.sc-zonos-checkout-payment{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center}.sc-zonos-checkout-payment-h .zonos--group-btn.sc-zonos-checkout-payment zonos-button.sc-zonos-checkout-payment{width:calc(100% - 10px)}";
|
|
164
165
|
|
|
165
166
|
const ZonosCheckoutPayment = class {
|
|
166
167
|
constructor(hostRef) {
|
|
@@ -190,12 +191,12 @@ const ZonosCheckoutPayment = class {
|
|
|
190
191
|
return null;
|
|
191
192
|
}
|
|
192
193
|
this.disabled = !((_a = stripeStore.stripePaymentEventData) === null || _a === void 0 ? void 0 : _a.complete);
|
|
193
|
-
return (h(Host, { class: "zonos--checkout-payment zonos--elements" }, h("div", { class: "zonos--group" }, h("zonos-text", { class: "zonos--title", type: "semiBoldSubheader" }, translate('Payment method')), this.paymentError && (h("zonos-banner", { class: "zonos--payment-error-banner", intent: "error" }, translate("We couldn't complete your payment. Please verify the payment details and try again."))), h("zonos-payment", null)), h("zonos-button", { backgroundColor: this.submitBtnColor, "is-disabled": this.disabled, loading: this.continueLoading, onClick: () => this.continueClickHandler(), size: "lg",
|
|
194
|
+
return (h(Host, { class: "zonos--checkout-payment zonos--elements" }, h("div", { class: "zonos--group" }, h("zonos-text", { class: "zonos--title", type: "semiBoldSubheader" }, translate('Payment method')), this.paymentError && (h("zonos-banner", { class: "zonos--payment-error-banner", intent: "error" }, translate("We couldn't complete your payment. Please verify the payment details and try again."))), h("zonos-payment", null)), h("div", { class: "zonos--group-btn" }, h("zonos-button", { backgroundColor: this.submitBtnColor, "is-disabled": this.disabled, loading: this.continueLoading, onClick: () => this.continueClickHandler(), size: "lg",
|
|
194
195
|
// use primary type when on mobile mode
|
|
195
196
|
variant: this.submitBtnType }, "Pay", ' ', formatCurrency({
|
|
196
197
|
amount: cartStore.total,
|
|
197
198
|
currency: cartStore.currency,
|
|
198
|
-
}))));
|
|
199
|
+
})))));
|
|
199
200
|
}
|
|
200
201
|
static get watchers() { return {
|
|
201
202
|
"disabled": ["watchFormComplete"]
|
|
@@ -236,7 +237,7 @@ const ZonosCollapse = class {
|
|
|
236
237
|
};
|
|
237
238
|
ZonosCollapse.style = zonosCollapseCss;
|
|
238
239
|
|
|
239
|
-
const zonosCustomerInfoCss = ".sc-zonos-customer-info-h{font-family:Inter;display:block}.sc-zonos-customer-info-h img.sc-zonos-customer-info{max-width:100%}.sc-zonos-customer-info-h dl.sc-zonos-customer-info,.sc-zonos-customer-info-h dd.sc-zonos-customer-info,.sc-zonos-customer-info-h h1.sc-zonos-customer-info,.sc-zonos-customer-info-h h2.sc-zonos-customer-info,.sc-zonos-customer-info-h h3.sc-zonos-customer-info,.sc-zonos-customer-info-h h4.sc-zonos-customer-info,.sc-zonos-customer-info-h h5.sc-zonos-customer-info,.sc-zonos-customer-info-h h6.sc-zonos-customer-info,.sc-zonos-customer-info-h hr.sc-zonos-customer-info,.sc-zonos-customer-info-h figure.sc-zonos-customer-info,.sc-zonos-customer-info-h p.sc-zonos-customer-info,.sc-zonos-customer-info-h pre.sc-zonos-customer-info{margin:0}.sc-zonos-customer-info-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-customer-info-h{overflow:hidden;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}.sc-zonos-customer-info-h .zonos--title.sc-zonos-customer-info{margin-bottom:var(--amino-space-20)}.sc-zonos-customer-info-h .zonos--link-authentication.sc-zonos-customer-info{margin-bottom:var(--amino-space-32)}.sc-zonos-customer-info-h .zonos--group.sc-zonos-customer-info{margin-bottom:var(--amino-space-20);overflow:auto;padding:5px}.sc-zonos-customer-info-h .zonos--group.sc-zonos-customer-info::-webkit-scrollbar{width:10px}.sc-zonos-customer-info-h .zonos--group.sc-zonos-customer-info::-webkit-scrollbar-track{background:var(--amino-gray-50)}.sc-zonos-customer-info-h .zonos--group.sc-zonos-customer-info::-webkit-scrollbar-thumb{border-radius:10px;background:#cccccc;border:3px solid transparent;background-clip:content-box}.sc-zonos-customer-info-h .zonos--group.sc-zonos-customer-info::-webkit-scrollbar-thumb:hover{background:#d6d6d6}.sc-zonos-customer-info-h zonos-button.sc-zonos-customer-info{width:100%}";
|
|
240
|
+
const zonosCustomerInfoCss = ".sc-zonos-customer-info-h{font-family:Inter;display:block}.sc-zonos-customer-info-h img.sc-zonos-customer-info{max-width:100%}.sc-zonos-customer-info-h dl.sc-zonos-customer-info,.sc-zonos-customer-info-h dd.sc-zonos-customer-info,.sc-zonos-customer-info-h h1.sc-zonos-customer-info,.sc-zonos-customer-info-h h2.sc-zonos-customer-info,.sc-zonos-customer-info-h h3.sc-zonos-customer-info,.sc-zonos-customer-info-h h4.sc-zonos-customer-info,.sc-zonos-customer-info-h h5.sc-zonos-customer-info,.sc-zonos-customer-info-h h6.sc-zonos-customer-info,.sc-zonos-customer-info-h hr.sc-zonos-customer-info,.sc-zonos-customer-info-h figure.sc-zonos-customer-info,.sc-zonos-customer-info-h p.sc-zonos-customer-info,.sc-zonos-customer-info-h pre.sc-zonos-customer-info{margin:0}.sc-zonos-customer-info-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-customer-info-h{overflow:hidden;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}.sc-zonos-customer-info-h .zonos--title.sc-zonos-customer-info{margin-bottom:var(--amino-space-20)}.sc-zonos-customer-info-h .zonos--link-authentication.sc-zonos-customer-info{margin-bottom:var(--amino-space-32)}.sc-zonos-customer-info-h .zonos--group.sc-zonos-customer-info{margin-bottom:var(--amino-space-20);overflow:auto;padding:5px}.sc-zonos-customer-info-h .zonos--group.sc-zonos-customer-info::-webkit-scrollbar{width:10px}.sc-zonos-customer-info-h .zonos--group.sc-zonos-customer-info::-webkit-scrollbar-track{background:var(--amino-gray-50)}.sc-zonos-customer-info-h .zonos--group.sc-zonos-customer-info::-webkit-scrollbar-thumb{border-radius:10px;background:#cccccc;border:3px solid transparent;background-clip:content-box}.sc-zonos-customer-info-h .zonos--group.sc-zonos-customer-info::-webkit-scrollbar-thumb:hover{background:#d6d6d6}.sc-zonos-customer-info-h .zonos--group-btn.sc-zonos-customer-info{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center}.sc-zonos-customer-info-h .zonos--group-btn.sc-zonos-customer-info zonos-button.sc-zonos-customer-info{width:calc(100% - 10px)}";
|
|
240
241
|
|
|
241
242
|
const ZonosCustomerInfo = class {
|
|
242
243
|
constructor(hostRef) {
|
|
@@ -269,9 +270,9 @@ const ZonosCustomerInfo = class {
|
|
|
269
270
|
this.disabled =
|
|
270
271
|
!((_a = stripeStore.stripeAddressEventData) === null || _a === void 0 ? void 0 : _a.complete) ||
|
|
271
272
|
!((_b = stripeStore.stripeLinkEventData) === null || _b === void 0 ? void 0 : _b.complete);
|
|
272
|
-
return (h(Host, { class: "zonos--customer-info zonos--elements" }, h("div", { class: "zonos--group" }, h("zonos-text", { class: "zonos--title", type: "semiBoldSubheader" }, translate('Customer information')), h("zonos-link-authentication", { titleText: translate('Contact') }), h("zonos-address", { defaultAddress: this.defaultAddress, titleText: translate('Address'), type: "shipping" })), h("zonos-button", { backgroundColor: this.submitBtnColor, isDisabled: this.disabled, loading: this.continueLoading, onClick: () => this.continueClickHandler(), size: "lg",
|
|
273
|
+
return (h(Host, { class: "zonos--customer-info zonos--elements" }, h("div", { class: "zonos--group" }, h("zonos-text", { class: "zonos--title", type: "semiBoldSubheader" }, translate('Customer information')), h("zonos-link-authentication", { titleText: translate('Contact') }), h("zonos-address", { defaultAddress: this.defaultAddress, titleText: translate('Address'), type: "shipping" })), h("div", { class: "zonos--group-btn" }, h("zonos-button", { backgroundColor: this.submitBtnColor, isDisabled: this.disabled, loading: this.continueLoading, onClick: () => this.continueClickHandler(), size: "lg",
|
|
273
274
|
// use primary type when on mobile mode
|
|
274
|
-
variant: this.submitBtnType }, translate('Continue to shipping'))));
|
|
275
|
+
variant: this.submitBtnType }, translate('Continue to shipping')))));
|
|
275
276
|
}
|
|
276
277
|
static get watchers() { return {
|
|
277
278
|
"disabled": ["watchFormComplete"]
|
|
@@ -421,7 +422,7 @@ const ZonosReview = class {
|
|
|
421
422
|
};
|
|
422
423
|
ZonosReview.style = zonosReviewCss;
|
|
423
424
|
|
|
424
|
-
const zonosShippingCss = ".sc-zonos-shipping-h{font-family:Inter;display:block}.sc-zonos-shipping-h img.sc-zonos-shipping{max-width:100%}.sc-zonos-shipping-h dl.sc-zonos-shipping,.sc-zonos-shipping-h dd.sc-zonos-shipping,.sc-zonos-shipping-h h1.sc-zonos-shipping,.sc-zonos-shipping-h h2.sc-zonos-shipping,.sc-zonos-shipping-h h3.sc-zonos-shipping,.sc-zonos-shipping-h h4.sc-zonos-shipping,.sc-zonos-shipping-h h5.sc-zonos-shipping,.sc-zonos-shipping-h h6.sc-zonos-shipping,.sc-zonos-shipping-h hr.sc-zonos-shipping,.sc-zonos-shipping-h figure.sc-zonos-shipping,.sc-zonos-shipping-h p.sc-zonos-shipping,.sc-zonos-shipping-h pre.sc-zonos-shipping{margin:0}.sc-zonos-shipping-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-shipping-h{overflow:hidden;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}.sc-zonos-shipping-h .zonos--title.sc-zonos-shipping{margin-bottom:var(--amino-space-24)}.sc-zonos-shipping-h .zonos--shipping-method-title.sc-zonos-shipping{margin-bottom:var(--amino-space-16)}.sc-zonos-shipping-h .zonos-shipping-rich-radio.sc-zonos-shipping{margin-bottom:var(--amino-space-24)}.sc-zonos-shipping-h .zonos--group.sc-zonos-shipping{margin-bottom:var(--amino-space-20);overflow:auto;padding
|
|
425
|
+
const zonosShippingCss = ".sc-zonos-shipping-h{font-family:Inter;display:block}.sc-zonos-shipping-h img.sc-zonos-shipping{max-width:100%}.sc-zonos-shipping-h dl.sc-zonos-shipping,.sc-zonos-shipping-h dd.sc-zonos-shipping,.sc-zonos-shipping-h h1.sc-zonos-shipping,.sc-zonos-shipping-h h2.sc-zonos-shipping,.sc-zonos-shipping-h h3.sc-zonos-shipping,.sc-zonos-shipping-h h4.sc-zonos-shipping,.sc-zonos-shipping-h h5.sc-zonos-shipping,.sc-zonos-shipping-h h6.sc-zonos-shipping,.sc-zonos-shipping-h hr.sc-zonos-shipping,.sc-zonos-shipping-h figure.sc-zonos-shipping,.sc-zonos-shipping-h p.sc-zonos-shipping,.sc-zonos-shipping-h pre.sc-zonos-shipping{margin:0}.sc-zonos-shipping-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-shipping-h{overflow:hidden;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}.sc-zonos-shipping-h .zonos--title.sc-zonos-shipping{margin-bottom:var(--amino-space-24)}.sc-zonos-shipping-h .zonos--shipping-method-title.sc-zonos-shipping{margin-bottom:var(--amino-space-16)}.sc-zonos-shipping-h .zonos-shipping-rich-radio.sc-zonos-shipping{margin-bottom:var(--amino-space-24)}.sc-zonos-shipping-h .zonos--group.sc-zonos-shipping{margin-bottom:var(--amino-space-20);overflow:auto;padding:5px}.sc-zonos-shipping-h .zonos--group.sc-zonos-shipping::-webkit-scrollbar{width:10px}.sc-zonos-shipping-h .zonos--group.sc-zonos-shipping::-webkit-scrollbar-track{background:var(--amino-gray-50)}.sc-zonos-shipping-h .zonos--group.sc-zonos-shipping::-webkit-scrollbar-thumb{border-radius:10px;background:#cccccc;border:3px solid transparent;background-clip:content-box}.sc-zonos-shipping-h .zonos--group.sc-zonos-shipping::-webkit-scrollbar-thumb:hover{background:#d6d6d6}.sc-zonos-shipping-h .zonos--group-btn.sc-zonos-shipping{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center}.sc-zonos-shipping-h .zonos--group-btn.sc-zonos-shipping zonos-button.sc-zonos-shipping{width:calc(100% - 10px)}.sc-zonos-shipping-h zonos-banner.sc-zonos-shipping{margin-top:var(--amino-space-24)}";
|
|
425
426
|
|
|
426
427
|
const ZonosShipping = class {
|
|
427
428
|
constructor(hostRef) {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { r as registerInstance, h, F as Fragment, H as Host } from './index-d1aa9293.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-
|
|
4
|
-
import { z as zonosStore, m as mergeConfig } from './zonosStore-
|
|
5
|
-
import { s as submitGtag, i as isCheckoutMobile } from './submitGtag-
|
|
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-07091d2a.js';
|
|
3
|
+
import { a as localizationStore, l as log, t as translate } from './localization-b3c2a9a9.js';
|
|
4
|
+
import { z as zonosStore, m as mergeConfig } from './zonosStore-05a62104.js';
|
|
5
|
+
import { s as submitGtag, i as isCheckoutMobile } from './submitGtag-c0b655ad.js';
|
|
6
6
|
import { c as classes } from './classes-0d95c529.js';
|
|
7
|
-
import { g as getBorderRadius } from './getBorderRadius-
|
|
8
|
-
import { i as isDarkColor } from './isDarkColor-
|
|
7
|
+
import { g as getBorderRadius } from './getBorderRadius-45764ad7.js';
|
|
8
|
+
import { i as isDarkColor } from './isDarkColor-6fbb9b14.js';
|
|
9
9
|
|
|
10
10
|
const LeftArrow = `<svg color="var(--amino-gray-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="https://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M9.707 16.707a1 1 0 0 1-1.414 0l-3.647-3.646a1.5 1.5 0 0 1 0-2.122l3.647-3.646a1 1 0 0 1 1.414 1.414L7.414 11H19a1 1 0 1 1 0 2H7.414l2.293 2.293a1 1 0 0 1 0 1.414Z" fill="currentColor" fill-rule="evenodd"></path></svg>`;
|
|
11
11
|
|
|
@@ -38,7 +38,7 @@ const ZonosCheckout = class {
|
|
|
38
38
|
// if localization is loaded and the localization is not a shippable country, keep the original click event
|
|
39
39
|
if (!localizationStore.isShippableCountry) {
|
|
40
40
|
if (showLog) {
|
|
41
|
-
log(`not shippable country`);
|
|
41
|
+
log(`Checkout: not shippable country`);
|
|
42
42
|
}
|
|
43
43
|
return false;
|
|
44
44
|
}
|
|
@@ -179,7 +179,8 @@ const ZonosCheckout = class {
|
|
|
179
179
|
// show the selector when it's domestic
|
|
180
180
|
selector === null || selector === void 0 ? void 0 : selector.forEach(el => {
|
|
181
181
|
const element = el;
|
|
182
|
-
const display = element.getAttribute('data-zonos-checkout-original-display')
|
|
182
|
+
const display = element.getAttribute('data-zonos-checkout-original-display') ||
|
|
183
|
+
getComputedStyle(element).display;
|
|
183
184
|
// fallback to initial (browser value) if "display" is not found
|
|
184
185
|
element.style.display = display || 'initial';
|
|
185
186
|
});
|
|
@@ -353,7 +354,13 @@ const ZonosCheckout = class {
|
|
|
353
354
|
'--border-radius': getBorderRadius(style),
|
|
354
355
|
} }, cartStore.step !== 'finish' && cartStore.step !== 'error' && (h(Fragment, null, h("div", { class: "zonos--left", "data-theme": leftSideTheme, style: {
|
|
355
356
|
'--primary-color': !this.isMobile ? colorPrimary : '',
|
|
356
|
-
} }, !this.isMobile && renderTopHeader(), cartStore.step === 'customer-info' && (h("zonos-customer-info", { continueLoading: this.submitLoading, defaultAddress: this.defaultAddress, onContinueClicked: () => this.handleCustomerInfoContinue(), submitBtnColor: submitButtonColor, submitBtnType: submitBtnType })), cartStore.step === 'shipping' && (h("zonos-shipping", { continueLoading: this.submitLoading, onContinueClicked: () => this.handleShippingContinue(), submitBtnColor: submitButtonColor, submitBtnType: submitBtnType })), cartStore.step === 'payment' && (h("zonos-checkout-payment", { continueLoading: this.submitLoading, onContinueClicked: () => this.handleCheckoutPaymentContinue(), paymentError: this.paymentError, submitBtnColor: submitButtonColor, submitBtnType: submitBtnType }))), h("div", { class: "zonos--right", "data-theme": rightSideTheme }, this.isMobile && renderTopHeader(), !this.isMobile && (h("zonos-button", { class: "zonos--close-button", icon: h("zonos-icon", { content: RemoveIcon }), noBackground: true, onClick: () => this.closeDialogHandler() })), h("div", { class: "flex--wrapper" }, h("div", { class: "zonos--wrapper" }, h("zonos-collapse", { collapseSize: reviewElementSize,
|
|
357
|
+
} }, !this.isMobile && renderTopHeader(), cartStore.step === 'customer-info' && (h("zonos-customer-info", { continueLoading: this.submitLoading, defaultAddress: this.defaultAddress, onContinueClicked: () => this.handleCustomerInfoContinue(), submitBtnColor: submitButtonColor, submitBtnType: submitBtnType })), cartStore.step === 'shipping' && (h("zonos-shipping", { continueLoading: this.submitLoading, onContinueClicked: () => this.handleShippingContinue(), submitBtnColor: submitButtonColor, submitBtnType: submitBtnType })), cartStore.step === 'payment' && (h("zonos-checkout-payment", { continueLoading: this.submitLoading, onContinueClicked: () => this.handleCheckoutPaymentContinue(), paymentError: this.paymentError, submitBtnColor: submitButtonColor, submitBtnType: submitBtnType }))), h("div", { class: "zonos--right", "data-theme": rightSideTheme }, this.isMobile && renderTopHeader(), !this.isMobile && (h("zonos-button", { class: "zonos--close-button", icon: h("zonos-icon", { content: RemoveIcon }), noBackground: true, onClick: () => this.closeDialogHandler() })), h("div", { class: "flex--wrapper" }, h("div", { class: "zonos--wrapper" }, h("zonos-collapse", { collapseSize: reviewElementSize,
|
|
358
|
+
// only collapse on mobile
|
|
359
|
+
collapsed: this.collapseReviewMobile && this.isMobile }, h("zonos-review", { collapsed: this.collapseReviewMobile, mobile: this.isMobile, onClick: () => {
|
|
360
|
+
// do nothing if it's not mobile
|
|
361
|
+
if (!this.isMobile) {
|
|
362
|
+
return;
|
|
363
|
+
}
|
|
357
364
|
this.collapseReviewMobile =
|
|
358
365
|
!this.collapseReviewMobile;
|
|
359
366
|
}, ref: el => (this.zonosReviewRef = el) }), h("zonos-cart-items", null))), h("zonos-v-stack", { spacing: 16 }, h("zonos-cart-subtotal", null), h("zonos-custom-message", { class: "zonos--checkout-default-message", icon: MessageIcon, message: defaultMessage }))), !this.isMobile && renderFooter()), this.isMobile && renderFooter())), (cartStore.step === 'finish' || cartStore.step === 'error') && (h("div", { class: "zonos--done", "data-theme": rightSideTheme }, h("div", { class: "zonos--header" }, renderLogo(), h("zonos-button", { class: "zonos--close-button", icon: h("zonos-icon", { content: RemoveIcon }), noBackground: true, onClick: () => this.handleFinishClick(), theme: rightSideTheme })), h("zonos-checkout-finish", { borderRadius: style, onCloseClick: () => this.handleFinishClick(), overrideNotification: cartStore.step === 'error' && !!cartStore.error
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, H as Host } from './index-d1aa9293.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-
|
|
4
|
-
import { z as zonosStore, d as zonosStoreInitSetting } from './zonosStore-
|
|
5
|
-
import './isDarkColor-
|
|
6
|
-
import './getBorderRadius-
|
|
2
|
+
import { s as stripeStore } from './cart-07091d2a.js';
|
|
3
|
+
import { h as handleFetch, b as logError, i as isValidSelector, l as log, c as initLocalizationStore, d as localizationStoreUpdateSelectedCountryCode } from './localization-b3c2a9a9.js';
|
|
4
|
+
import { z as zonosStore, d as zonosStoreInitSetting } from './zonosStore-05a62104.js';
|
|
5
|
+
import './isDarkColor-6fbb9b14.js';
|
|
6
|
+
import './getBorderRadius-45764ad7.js';
|
|
7
7
|
|
|
8
8
|
const getZonosSetting = async () => {
|
|
9
9
|
const url = `${"https://v1.route.js.zonos.com"}/api/zonos-setting`;
|
|
@@ -117,11 +117,20 @@ const ZonosController = class {
|
|
|
117
117
|
log('Checkout failed to load -- missing publishable key', 'warn');
|
|
118
118
|
return;
|
|
119
119
|
}
|
|
120
|
+
if (zonosStore.checkoutSettings.subscriptionStatus === 'INACTIVE') {
|
|
121
|
+
log('=== Checkout subscription is "INACTIVE" - Cancel initializing for Checkout ===', 'warn');
|
|
122
|
+
log('zonos controller loaded');
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
if (zonosStore.checkoutSettings.visibilityStatus === 'DISABLED') {
|
|
126
|
+
log('=== Checkout is disabled by store owner ===', 'warn');
|
|
127
|
+
log('zonos controller loaded');
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
120
130
|
// send publishable key out to load stripe
|
|
121
131
|
this.stripeInitEvent.emit({
|
|
122
132
|
publishableKey: publishableKey.token,
|
|
123
133
|
});
|
|
124
|
-
// eslint-disable-next-line no-console
|
|
125
134
|
log('zonos controller loaded');
|
|
126
135
|
})();
|
|
127
136
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { r as registerInstance, h, H as Host, d as getElement } from './index-d1aa9293.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-b3c2a9a9.js';
|
|
3
3
|
import { c as classes } from './classes-0d95c529.js';
|
|
4
|
-
import { i as isDarkColor } from './isDarkColor-
|
|
5
|
-
import './zonosStore-
|
|
4
|
+
import { i as isDarkColor } from './isDarkColor-6fbb9b14.js';
|
|
5
|
+
import './zonosStore-05a62104.js';
|
|
6
6
|
|
|
7
7
|
const zonosCountryFlagCss = ":host{font-family:Inter;display:block}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:-ms-inline-flexbox;display:inline-flex}:host .flag-container{position:relative;overflow:hidden;width:100%;height:100%}:host .flag-icon{position:absolute;top:0;left:0;width:100%;height:100%;background-position:center;background-repeat:no-repeat;background-size:cover}";
|
|
8
8
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, H as Host } from './index-d1aa9293.js';
|
|
2
|
-
import { f as currencyConvertAndFormat, t as translate, a as localizationStore } from './localization-
|
|
3
|
-
import { z as zonosStore } from './zonosStore-
|
|
2
|
+
import { f as currencyConvertAndFormat, t as translate, a as localizationStore } from './localization-b3c2a9a9.js';
|
|
3
|
+
import { z as zonosStore } from './zonosStore-05a62104.js';
|
|
4
4
|
import { c as classes } from './classes-0d95c529.js';
|
|
5
5
|
import { g as getHasMoreSpaceOnRight } from './getHasMoreSpaceOnRight-feba1ae2.js';
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as registerInstance, h, H as Host } from './index-d1aa9293.js';
|
|
2
|
-
import { _ as _root, i as isObjectLike_1, e as _baseGetTag, f as isObject_1, z as zonosStore, m as mergeConfig } from './zonosStore-
|
|
3
|
-
import { h as handleFetch, b as logError, a as localizationStore, i as isValidSelector, t as translate, s as setZonosCountryUrlParam, e as currencyDisplay, f as currencyConvertAndFormat, g as currencyConvert, j as currencyFormat
|
|
2
|
+
import { _ as _root, i as isObjectLike_1, e as _baseGetTag, f as isObject_1, z as zonosStore, m as mergeConfig } from './zonosStore-05a62104.js';
|
|
3
|
+
import { h as handleFetch, b as logError, a as localizationStore, i as isValidSelector, t as translate, s as setZonosCountryUrlParam, l as log, e as currencyDisplay, f as currencyConvertAndFormat, g as currencyConvert, j as currencyFormat } from './localization-b3c2a9a9.js';
|
|
4
4
|
import { c as classes } from './classes-0d95c529.js';
|
|
5
5
|
import { g as getHasMoreSpaceOnRight } from './getHasMoreSpaceOnRight-feba1ae2.js';
|
|
6
6
|
|
|
@@ -597,6 +597,19 @@ const ZonosHello = class {
|
|
|
597
597
|
return hasMoreSpaceOnRight;
|
|
598
598
|
}
|
|
599
599
|
};
|
|
600
|
+
this.isShippableCountry = (showLog = true) => {
|
|
601
|
+
if (!localizationStore.localizationLoaded) {
|
|
602
|
+
return false;
|
|
603
|
+
}
|
|
604
|
+
// if localization is loaded and the localization is not a shippable country, keep the original click event
|
|
605
|
+
if (!localizationStore.isShippableCountry) {
|
|
606
|
+
if (showLog) {
|
|
607
|
+
log(`Hello: not shippable country`);
|
|
608
|
+
}
|
|
609
|
+
return false;
|
|
610
|
+
}
|
|
611
|
+
return true;
|
|
612
|
+
};
|
|
600
613
|
this.mobileLocationOverride = undefined;
|
|
601
614
|
this.animateFromLeftOverride = undefined;
|
|
602
615
|
this.appearanceSettingsOverride = undefined;
|
|
@@ -675,7 +688,8 @@ const ZonosHello = class {
|
|
|
675
688
|
const appearanceSettings = mergeConfig(zonosStore.appearance, this.appearanceSettingsOverride);
|
|
676
689
|
const { theme } = appearanceSettings;
|
|
677
690
|
const restrictedItemsOnPage = (_b = this.allRestrictedItems) === null || _b === void 0 ? void 0 : _b.filter(product => this.productsOnPage.some(restriction => restriction.description === product.itemDescription));
|
|
678
|
-
|
|
691
|
+
const showHello = this.isShippableCountry() && !!selectedCountryCode;
|
|
692
|
+
return (h(Host, { class: "zonos--hello zonos--elements", "data-theme": theme }, showHello && (h("div", { class: "zonos--hello-wrapper" }, h("button", { class: classes([
|
|
679
693
|
'zonos--hello-widget',
|
|
680
694
|
this.showPeekMessage && 'zonos--hello-show-peek-message',
|
|
681
695
|
this.mobileLocationOverride && 'zonos--hello-mobile-override',
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { r as registerInstance, h, H as Host, d as getElement } from './index-d1aa9293.js';
|
|
2
|
-
import { s as stripeStore } from './cart-
|
|
3
|
-
import './zonosStore-
|
|
4
|
-
import './localization-
|
|
5
|
-
import './isDarkColor-
|
|
6
|
-
import './getBorderRadius-
|
|
2
|
+
import { s as stripeStore } from './cart-07091d2a.js';
|
|
3
|
+
import './zonosStore-05a62104.js';
|
|
4
|
+
import './localization-b3c2a9a9.js';
|
|
5
|
+
import './isDarkColor-6fbb9b14.js';
|
|
6
|
+
import './getBorderRadius-45764ad7.js';
|
|
7
7
|
|
|
8
8
|
const zonosPaymentCss = ".sc-zonos-payment-h{font-family:Inter;display:block}.sc-zonos-payment-h img.sc-zonos-payment{max-width:100%}.sc-zonos-payment-h dl.sc-zonos-payment,.sc-zonos-payment-h dd.sc-zonos-payment,.sc-zonos-payment-h h1.sc-zonos-payment,.sc-zonos-payment-h h2.sc-zonos-payment,.sc-zonos-payment-h h3.sc-zonos-payment,.sc-zonos-payment-h h4.sc-zonos-payment,.sc-zonos-payment-h h5.sc-zonos-payment,.sc-zonos-payment-h h6.sc-zonos-payment,.sc-zonos-payment-h hr.sc-zonos-payment,.sc-zonos-payment-h figure.sc-zonos-payment,.sc-zonos-payment-h p.sc-zonos-payment,.sc-zonos-payment-h pre.sc-zonos-payment{margin:0}.sc-zonos-payment-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-payment-h .zonos--title.sc-zonos-payment{margin-bottom:var(--amino-space-16)}";
|
|
9
9
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, H as Host } from './index-d1aa9293.js';
|
|
2
|
-
import { z as zonosStore } from './zonosStore-
|
|
2
|
+
import { z as zonosStore } from './zonosStore-05a62104.js';
|
|
3
3
|
import { c as classes } from './classes-0d95c529.js';
|
|
4
|
-
import { g as getBorderRadius } from './getBorderRadius-
|
|
4
|
+
import { g as getBorderRadius } from './getBorderRadius-45764ad7.js';
|
|
5
5
|
import { i as isColorVariable } from './isColorVariable-4cda28c9.js';
|
|
6
6
|
|
|
7
|
-
const zonosShippingRichRadioCss = ":host{font-family:Inter;display:block}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}:host input{margin:0;accent-color:var(--selected-border-color, var(--amino-blue-600))}:host .zonos--shipping-rich-radio-item{display:-ms-flexbox;display:flex;-ms-flex:1;flex:1;padding:var(--amino-space-16);-ms-flex-align:center;align-items:center;gap:var(--amino-space-16);cursor:pointer;border:1px solid var(--amino-gray-200)}:host .zonos--shipping-rich-radio-item:first-child{border-top-left-radius:var(--border-radius, var(--amino-radius-10));border-top-right-radius:var(--border-radius, var(--amino-radius-10))}:host .zonos--shipping-rich-radio-item:last-child{border-bottom-
|
|
7
|
+
const zonosShippingRichRadioCss = ":host{font-family:Inter;display:block}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}:host input{margin:0;accent-color:var(--selected-border-color, var(--amino-blue-600))}:host .zonos--shipping-rich-radio-item{display:-ms-flexbox;display:flex;-ms-flex:1;flex:1;padding:var(--amino-space-16);-ms-flex-align:center;align-items:center;gap:var(--amino-space-16);cursor:pointer;border:1px solid var(--amino-gray-200)}:host .zonos--shipping-rich-radio-item:first-child{border-top-left-radius:var(--border-radius, var(--amino-radius-10));border-top-right-radius:var(--border-radius, var(--amino-radius-10))}:host .zonos--shipping-rich-radio-item:last-child{border-bottom-right-radius:var(--border-radius, var(--amino-radius-10))}:host .zonos--shipping-rich-radio-item:not(:last-child){border-bottom:none}:host .zonos--shipping-rich-radio-item.selected{outline:1px solid var(--selected-border-color, var(--amino-blue-600));outline-offset:-1px}:host .zonos--shipping-info{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex:1;flex:1}:host .zonos--shipping-detail{-ms-flex:1;flex:1}:host .zonos--sub-detail{display:-ms-inline-flexbox;display:inline-flex;gap:8px;-ms-flex-wrap:wrap;flex-wrap:wrap}";
|
|
8
8
|
|
|
9
9
|
const ZonosShippingRichRadio = class {
|
|
10
10
|
constructor(hostRef) {
|
|
@@ -2553,6 +2553,8 @@ const { reset, state: zonosStore } = createStore(() => ({
|
|
|
2553
2553
|
},
|
|
2554
2554
|
organization: '',
|
|
2555
2555
|
placeOrderButtonSelector: null,
|
|
2556
|
+
// default inactive for subscription
|
|
2557
|
+
subscriptionStatus: 'INACTIVE',
|
|
2556
2558
|
successBehavior: 'REDIRECT_TO_SUCCESS_PAGE',
|
|
2557
2559
|
successRedirectUrl: '',
|
|
2558
2560
|
visibilityStatus: 'ENABLED',
|
|
@@ -0,0 +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-05a62104.js";import{h as handleFetch,l as log,a as localizationStore,b as logError,t as translate}from"./localization-b3c2a9a9.js";import{i as isDarkColor}from"./isDarkColor-6fbb9b14.js";import{g as getBorderRadius}from"./getBorderRadius-45764ad7.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,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;return __generator(this,(function(n){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});if(!stripeStore.stripeElements){stripeStore.stripeElements=(t=stripeStore.stripe)===null||t===void 0?void 0:t.elements(o)}else{stripeStore.stripeElements.update(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,l,d,u,p,S;return __generator(this,(function(v){switch(v.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)}v.label=1;case 1:v.trys.push([1,3,,4]);s=new AbortController;stripeStore.fetchingLandedCostAbordController=s;return[4,calculateLandedCost(s)];case 2:c=v.sent(),l=c.checkoutSessionWorkflow,d=c.shipmentRatingCalculateWorkflow;stripeStore.fetchingLandedCostAbordController=null;cartStore.landedCostData=(l===null||l===void 0?void 0:l.filter(Boolean))||null;cartStore.shippingData=(d===null||d===void 0?void 0:d.filter(Boolean))||null;u=(o=cartStore.landedCostData)===null||o===void 0?void 0:o.find(Boolean);p=!!u?u.subtotals:null;if(p){cartStoreApplySubtotals({exchangeRate:p.exchangeRate,items:p.items,landedCostTotal:0,presentmentCurrencyCode:p.presentmentCurrencyCode,shipping:0,total:p.items})}return[3,4];case 3:S=v.sent();logError(S);return[3,4];case 4:stripeStore.isFetchingLandedCost=false;v.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,l,d;return __generator(this,(function(u){switch(u.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=u.sent().paymentIntent;s=a===null||a===void 0?void 0:a.status;c=getStripeMessageBasedOnStatus(s),l=c.isError,d=c.messages;return[2,{error:l,messages:d}]}}))}))};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,l,d,u,p,S;return __generator(this,(function(v){switch(v.label){case 0:cartStore.selectedShippingOption=e;a=cartStoreGetShippingTransitInfo(cartStore.selectedShippingOption),s=a.expectedDate,c=a.maxTransit,l=a.minTransit;cartStore.selectedShippingOptionExpectedDate=s;cartStore.selectedShippingOptionTransitTime=l&&c?"".concat(l,"-").concat(c):"".concat(l||c);d=(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=d||null;if(!d){return[2,false]}cartStore.shipping=d.subtotals.shipping;u=((r=d===null||d===void 0?void 0:d.landedCost)===null||r===void 0?void 0:r.landedCostGuaranteeCode)==="ZONOS";p=!!((n=(o=d===null||d===void 0?void 0:d.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=p;cartStore.isSelectedShippingGuarantee=u;return[4,cartStoreReCalculateTotal({landedCostId:(i=d.landedCost)===null||i===void 0?void 0:i.id})];case 1:S=v.sent();return[2,S]}}))}))};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 +1 @@
|
|
|
1
|
-
import{z as zonosStore}from"./zonosStore-
|
|
1
|
+
import{z as zonosStore}from"./zonosStore-05a62104.js";var getBorderRadius=function(r){if(r){return r==="SHARP"?"0px":"10px"}return zonosStore.appearance.style==="SHARP"?"0px":"10px"};export{getBorderRadius as g};
|
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-07091d2a.js";import"./zonosStore-05a62104.js";import"./index-d1aa9293.js";import"./localization-b3c2a9a9.js";import"./isDarkColor-6fbb9b14.js";import"./getBorderRadius-45764ad7.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as createCommonjsModule,b as commonjsGlobal}from"./zonosStore-e5291656.js";var tinycolor=createCommonjsModule((function(t,r){(function(r,e){t.exports=e()})(commonjsGlobal,(function(){function t(r){"@babel/helpers - typeof";return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(r)}var r=/^\s+/;var e=/\s+$/;function a(t,r){t=t?t:"";r=r||{};if(t instanceof a){return t}if(!(this instanceof a)){return new a(t,r)}var e=n(t);this._originalInput=t,this._r=e.r,this._g=e.g,this._b=e.b,this._a=e.a,this._roundA=Math.round(100*this._a)/100,this._format=r.format||e.format;this._gradientType=r.gradientType;if(this._r<1)this._r=Math.round(this._r);if(this._g<1)this._g=Math.round(this._g);if(this._b<1)this._b=Math.round(this._b);this._ok=e.ok}a.prototype={isDark:function t(){return this.getBrightness()<128},isLight:function t(){return!this.isDark()},isValid:function t(){return this._ok},getOriginalInput:function t(){return this._originalInput},getFormat:function t(){return this._format},getAlpha:function t(){return this._a},getBrightness:function t(){var r=this.toRgb();return(r.r*299+r.g*587+r.b*114)/1e3},getLuminance:function t(){var r=this.toRgb();var e,a,n,i,o,f;e=r.r/255;a=r.g/255;n=r.b/255;if(e<=.03928)i=e/12.92;else i=Math.pow((e+.055)/1.055,2.4);if(a<=.03928)o=a/12.92;else o=Math.pow((a+.055)/1.055,2.4);if(n<=.03928)f=n/12.92;else f=Math.pow((n+.055)/1.055,2.4);return.2126*i+.7152*o+.0722*f},setAlpha:function t(r){this._a=R(r);this._roundA=Math.round(100*this._a)/100;return this},toHsv:function t(){var r=s(this._r,this._g,this._b);return{h:r.h*360,s:r.s,v:r.v,a:this._a}},toHsvString:function t(){var r=s(this._r,this._g,this._b);var e=Math.round(r.h*360),a=Math.round(r.s*100),n=Math.round(r.v*100);return this._a==1?"hsv("+e+", "+a+"%, "+n+"%)":"hsva("+e+", "+a+"%, "+n+"%, "+this._roundA+")"},toHsl:function t(){var r=o(this._r,this._g,this._b);return{h:r.h*360,s:r.s,l:r.l,a:this._a}},toHslString:function t(){var r=o(this._r,this._g,this._b);var e=Math.round(r.h*360),a=Math.round(r.s*100),n=Math.round(r.l*100);return this._a==1?"hsl("+e+", "+a+"%, "+n+"%)":"hsla("+e+", "+a+"%, "+n+"%, "+this._roundA+")"},toHex:function t(r){return u(this._r,this._g,this._b,r)},toHexString:function t(r){return"#"+this.toHex(r)},toHex8:function t(r){return l(this._r,this._g,this._b,this._a,r)},toHex8String:function t(r){return"#"+this.toHex8(r)},toRgb:function t(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function t(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function t(){return{r:Math.round(F(this._r,255)*100)+"%",g:Math.round(F(this._g,255)*100)+"%",b:Math.round(F(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function t(){return this._a==1?"rgb("+Math.round(F(this._r,255)*100)+"%, "+Math.round(F(this._g,255)*100)+"%, "+Math.round(F(this._b,255)*100)+"%)":"rgba("+Math.round(F(this._r,255)*100)+"%, "+Math.round(F(this._g,255)*100)+"%, "+Math.round(F(this._b,255)*100)+"%, "+this._roundA+")"},toName:function t(){if(this._a===0){return"transparent"}if(this._a<1){return false}return S[u(this._r,this._g,this._b,true)]||false},toFilter:function t(r){var e="#"+c(this._r,this._g,this._b,this._a);var n=e;var i=this._gradientType?"GradientType = 1, ":"";if(r){var o=a(r);n="#"+c(o._r,o._g,o._b,o._a)}return"progid:DXImageTransform.Microsoft.gradient("+i+"startColorstr="+e+",endColorstr="+n+")"},toString:function t(r){var e=!!r;r=r||this._format;var a=false;var n=this._a<1&&this._a>=0;var i=!e&&n&&(r==="hex"||r==="hex6"||r==="hex3"||r==="hex4"||r==="hex8"||r==="name");if(i){if(r==="name"&&this._a===0){return this.toName()}return this.toRgbString()}if(r==="rgb"){a=this.toRgbString()}if(r==="prgb"){a=this.toPercentageRgbString()}if(r==="hex"||r==="hex6"){a=this.toHexString()}if(r==="hex3"){a=this.toHexString(true)}if(r==="hex4"){a=this.toHex8String(true)}if(r==="hex8"){a=this.toHex8String()}if(r==="name"){a=this.toName()}if(r==="hsl"){a=this.toHslString()}if(r==="hsv"){a=this.toHsvString()}return a||this.toHexString()},clone:function t(){return a(this.toString())},_applyModification:function t(r,e){var a=r.apply(null,[this].concat([].slice.call(e)));this._r=a._r;this._g=a._g;this._b=a._b;this.setAlpha(a._a);return this},lighten:function t(){return this._applyModification(m,arguments)},brighten:function t(){return this._applyModification(v,arguments)},darken:function t(){return this._applyModification(p,arguments)},desaturate:function t(){return this._applyModification(d,arguments)},saturate:function t(){return this._applyModification(g,arguments)},greyscale:function t(){return this._applyModification(b,arguments)},spin:function t(){return this._applyModification(_,arguments)},_applyCombination:function t(r,e){return r.apply(null,[this].concat([].slice.call(e)))},analogous:function t(){return this._applyCombination(A,arguments)},complement:function t(){return this._applyCombination(y,arguments)},monochromatic:function t(){return this._applyCombination(k,arguments)},splitcomplement:function t(){return this._applyCombination(x,arguments)},triad:function t(){return this._applyCombination(M,[3])},tetrad:function t(){return this._applyCombination(M,[4])}};a.fromRatio=function(r,e){if(t(r)=="object"){var n={};for(var i in r){if(r.hasOwnProperty(i)){if(i==="a"){n[i]=r[i]}else{n[i]=E(r[i])}}}r=n}return a(r,e)};function n(r){var e={r:0,g:0,b:0};var a=1;var n=null;var o=null;var s=null;var u=false;var l=false;if(typeof r=="string"){r=O(r)}if(t(r)=="object"){if(D(r.r)&&D(r.g)&&D(r.b)){e=i(r.r,r.g,r.b);u=true;l=String(r.r).substr(-1)==="%"?"prgb":"rgb"}else if(D(r.h)&&D(r.s)&&D(r.v)){n=E(r.s);o=E(r.v);e=h(r.h,n,o);u=true;l="hsv"}else if(D(r.h)&&D(r.s)&&D(r.l)){n=E(r.s);s=E(r.l);e=f(r.h,n,s);u=true;l="hsl"}if(r.hasOwnProperty("a")){a=r.a}}a=R(a);return{ok:u,format:r.format||l,r:Math.min(255,Math.max(e.r,0)),g:Math.min(255,Math.max(e.g,0)),b:Math.min(255,Math.max(e.b,0)),a:a}}function i(t,r,e){return{r:F(t,255)*255,g:F(r,255)*255,b:F(e,255)*255}}function o(t,r,e){t=F(t,255);r=F(r,255);e=F(e,255);var a=Math.max(t,r,e),n=Math.min(t,r,e);var i,o,f=(a+n)/2;if(a==n){i=o=0}else{var s=a-n;o=f>.5?s/(2-a-n):s/(a+n);switch(a){case t:i=(r-e)/s+(r<e?6:0);break;case r:i=(e-t)/s+2;break;case e:i=(t-r)/s+4;break}i/=6}return{h:i,s:o,l:f}}function f(t,r,e){var a,n,i;t=F(t,360);r=F(r,100);e=F(e,100);function o(t,r,e){if(e<0)e+=1;if(e>1)e-=1;if(e<1/6)return t+(r-t)*6*e;if(e<1/2)return r;if(e<2/3)return t+(r-t)*(2/3-e)*6;return t}if(r===0){a=n=i=e}else{var f=e<.5?e*(1+r):e+r-e*r;var s=2*e-f;a=o(s,f,t+1/3);n=o(s,f,t);i=o(s,f,t-1/3)}return{r:a*255,g:n*255,b:i*255}}function s(t,r,e){t=F(t,255);r=F(r,255);e=F(e,255);var a=Math.max(t,r,e),n=Math.min(t,r,e);var i,o,f=a;var s=a-n;o=a===0?0:s/a;if(a==n){i=0}else{switch(a){case t:i=(r-e)/s+(r<e?6:0);break;case r:i=(e-t)/s+2;break;case e:i=(t-r)/s+4;break}i/=6}return{h:i,s:o,v:f}}function h(t,r,e){t=F(t,360)*6;r=F(r,100);e=F(e,100);var a=Math.floor(t),n=t-a,i=e*(1-r),o=e*(1-n*r),f=e*(1-(1-n)*r),s=a%6,h=[e,o,i,i,f,e][s],u=[f,e,e,o,i,i][s],l=[i,i,f,e,e,o][s];return{r:h*255,g:u*255,b:l*255}}function u(t,r,e,a){var n=[z(Math.round(t).toString(16)),z(Math.round(r).toString(16)),z(Math.round(e).toString(16))];if(a&&n[0].charAt(0)==n[0].charAt(1)&&n[1].charAt(0)==n[1].charAt(1)&&n[2].charAt(0)==n[2].charAt(1)){return n[0].charAt(0)+n[1].charAt(0)+n[2].charAt(0)}return n.join("")}function l(t,r,e,a,n){var i=[z(Math.round(t).toString(16)),z(Math.round(r).toString(16)),z(Math.round(e).toString(16)),z(I(a))];if(n&&i[0].charAt(0)==i[0].charAt(1)&&i[1].charAt(0)==i[1].charAt(1)&&i[2].charAt(0)==i[2].charAt(1)&&i[3].charAt(0)==i[3].charAt(1)){return i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0)+i[3].charAt(0)}return i.join("")}function c(t,r,e,a){var n=[z(I(a)),z(Math.round(t).toString(16)),z(Math.round(r).toString(16)),z(Math.round(e).toString(16))];return n.join("")}a.equals=function(t,r){if(!t||!r)return false;return a(t).toRgbString()==a(r).toRgbString()};a.random=function(){return a.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function d(t,r){r=r===0?0:r||10;var e=a(t).toHsl();e.s-=r/100;e.s=C(e.s);return a(e)}function g(t,r){r=r===0?0:r||10;var e=a(t).toHsl();e.s+=r/100;e.s=C(e.s);return a(e)}function b(t){return a(t).desaturate(100)}function m(t,r){r=r===0?0:r||10;var e=a(t).toHsl();e.l+=r/100;e.l=C(e.l);return a(e)}function v(t,r){r=r===0?0:r||10;var e=a(t).toRgb();e.r=Math.max(0,Math.min(255,e.r-Math.round(255*-(r/100))));e.g=Math.max(0,Math.min(255,e.g-Math.round(255*-(r/100))));e.b=Math.max(0,Math.min(255,e.b-Math.round(255*-(r/100))));return a(e)}function p(t,r){r=r===0?0:r||10;var e=a(t).toHsl();e.l-=r/100;e.l=C(e.l);return a(e)}function _(t,r){var e=a(t).toHsl();var n=(e.h+r)%360;e.h=n<0?360+n:n;return a(e)}function y(t){var r=a(t).toHsl();r.h=(r.h+180)%360;return a(r)}function M(t,r){if(isNaN(r)||r<=0){throw new Error("Argument to polyad must be a positive number")}var e=a(t).toHsl();var n=[a(t)];var i=360/r;for(var o=1;o<r;o++){n.push(a({h:(e.h+o*i)%360,s:e.s,l:e.l}))}return n}function x(t){var r=a(t).toHsl();var e=r.h;return[a(t),a({h:(e+72)%360,s:r.s,l:r.l}),a({h:(e+216)%360,s:r.s,l:r.l})]}function A(t,r,e){r=r||6;e=e||30;var n=a(t).toHsl();var i=360/e;var o=[a(t)];for(n.h=(n.h-(i*r>>1)+720)%360;--r;){n.h=(n.h+i)%360;o.push(a(n))}return o}function k(t,r){r=r||6;var e=a(t).toHsv();var n=e.h,i=e.s,o=e.v;var f=[];var s=1/r;while(r--){f.push(a({h:n,s:i,v:o}));o=(o+s)%1}return f}a.mix=function(t,r,e){e=e===0?0:e||50;var n=a(t).toRgb();var i=a(r).toRgb();var o=e/100;var f={r:(i.r-n.r)*o+n.r,g:(i.g-n.g)*o+n.g,b:(i.b-n.b)*o+n.b,a:(i.a-n.a)*o+n.a};return a(f)};a.readability=function(t,r){var e=a(t);var n=a(r);return(Math.max(e.getLuminance(),n.getLuminance())+.05)/(Math.min(e.getLuminance(),n.getLuminance())+.05)};a.isReadable=function(t,r,e){var n=a.readability(t,r);var i,o;o=false;i=P(e);switch(i.level+i.size){case"AAsmall":case"AAAlarge":o=n>=4.5;break;case"AAlarge":o=n>=3;break;case"AAAsmall":o=n>=7;break}return o};a.mostReadable=function(t,r,e){var n=null;var i=0;var o;var f,s,h;e=e||{};f=e.includeFallbackColors;s=e.level;h=e.size;for(var u=0;u<r.length;u++){o=a.readability(t,r[u]);if(o>i){i=o;n=a(r[u])}}if(a.isReadable(t,n,{level:s,size:h})||!f){return n}else{e.includeFallbackColors=false;return a.mostReadable(t,["#fff","#000"],e)}};var w=a.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"};var S=a.hexNames=H(w);function H(t){var r={};for(var e in t){if(t.hasOwnProperty(e)){r[t[e]]=e}}return r}function R(t){t=parseFloat(t);if(isNaN(t)||t<0||t>1){t=1}return t}function F(t,r){if(q(t))t="100%";var e=N(t);t=Math.min(r,Math.max(0,parseFloat(t)));if(e){t=parseInt(t*r,10)/100}if(Math.abs(t-r)<1e-6){return 1}return t%r/parseFloat(r)}function C(t){return Math.min(1,Math.max(0,t))}function j(t){return parseInt(t,16)}function q(t){return typeof t=="string"&&t.indexOf(".")!=-1&&parseFloat(t)===1}function N(t){return typeof t==="string"&&t.indexOf("%")!=-1}function z(t){return t.length==1?"0"+t:""+t}function E(t){if(t<=1){t=t*100+"%"}return t}function I(t){return Math.round(parseFloat(t)*255).toString(16)}function L(t){return j(t)/255}var T=function(){var t="[-\\+]?\\d+%?";var r="[-\\+]?\\d*\\.\\d+%?";var e="(?:"+r+")|(?:"+t+")";var a="[\\s|\\(]+("+e+")[,|\\s]+("+e+")[,|\\s]+("+e+")\\s*\\)?";var n="[\\s|\\(]+("+e+")[,|\\s]+("+e+")[,|\\s]+("+e+")[,|\\s]+("+e+")\\s*\\)?";return{CSS_UNIT:new RegExp(e),rgb:new RegExp("rgb"+a),rgba:new RegExp("rgba"+n),hsl:new RegExp("hsl"+a),hsla:new RegExp("hsla"+n),hsv:new RegExp("hsv"+a),hsva:new RegExp("hsva"+n),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function D(t){return!!T.CSS_UNIT.exec(t)}function O(t){t=t.replace(r,"").replace(e,"").toLowerCase();var a=false;if(w[t]){t=w[t];a=true}else if(t=="transparent"){return{r:0,g:0,b:0,a:0,format:"name"}}var n;if(n=T.rgb.exec(t)){return{r:n[1],g:n[2],b:n[3]}}if(n=T.rgba.exec(t)){return{r:n[1],g:n[2],b:n[3],a:n[4]}}if(n=T.hsl.exec(t)){return{h:n[1],s:n[2],l:n[3]}}if(n=T.hsla.exec(t)){return{h:n[1],s:n[2],l:n[3],a:n[4]}}if(n=T.hsv.exec(t)){return{h:n[1],s:n[2],v:n[3]}}if(n=T.hsva.exec(t)){return{h:n[1],s:n[2],v:n[3],a:n[4]}}if(n=T.hex8.exec(t)){return{r:j(n[1]),g:j(n[2]),b:j(n[3]),a:L(n[4]),format:a?"name":"hex8"}}if(n=T.hex6.exec(t)){return{r:j(n[1]),g:j(n[2]),b:j(n[3]),format:a?"name":"hex"}}if(n=T.hex4.exec(t)){return{r:j(n[1]+""+n[1]),g:j(n[2]+""+n[2]),b:j(n[3]+""+n[3]),a:L(n[4]+""+n[4]),format:a?"name":"hex8"}}if(n=T.hex3.exec(t)){return{r:j(n[1]+""+n[1]),g:j(n[2]+""+n[2]),b:j(n[3]+""+n[3]),format:a?"name":"hex"}}return false}function P(t){var r,e;t=t||{level:"AA",size:"small"};r=(t.level||"AA").toUpperCase();e=(t.size||"small").toLowerCase();if(r!=="AA"&&r!=="AAA"){r="AA"}if(e!=="small"&&e!=="large"){e="small"}return{level:r,size:e}}return a}))}));var isDarkColor=function(t){return tinycolor(t).isDark()};export{isDarkColor as i};
|
|
1
|
+
import{a as createCommonjsModule,b as commonjsGlobal}from"./zonosStore-05a62104.js";var tinycolor=createCommonjsModule((function(t,r){(function(r,e){t.exports=e()})(commonjsGlobal,(function(){function t(r){"@babel/helpers - typeof";return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(r)}var r=/^\s+/;var e=/\s+$/;function a(t,r){t=t?t:"";r=r||{};if(t instanceof a){return t}if(!(this instanceof a)){return new a(t,r)}var e=n(t);this._originalInput=t,this._r=e.r,this._g=e.g,this._b=e.b,this._a=e.a,this._roundA=Math.round(100*this._a)/100,this._format=r.format||e.format;this._gradientType=r.gradientType;if(this._r<1)this._r=Math.round(this._r);if(this._g<1)this._g=Math.round(this._g);if(this._b<1)this._b=Math.round(this._b);this._ok=e.ok}a.prototype={isDark:function t(){return this.getBrightness()<128},isLight:function t(){return!this.isDark()},isValid:function t(){return this._ok},getOriginalInput:function t(){return this._originalInput},getFormat:function t(){return this._format},getAlpha:function t(){return this._a},getBrightness:function t(){var r=this.toRgb();return(r.r*299+r.g*587+r.b*114)/1e3},getLuminance:function t(){var r=this.toRgb();var e,a,n,i,o,f;e=r.r/255;a=r.g/255;n=r.b/255;if(e<=.03928)i=e/12.92;else i=Math.pow((e+.055)/1.055,2.4);if(a<=.03928)o=a/12.92;else o=Math.pow((a+.055)/1.055,2.4);if(n<=.03928)f=n/12.92;else f=Math.pow((n+.055)/1.055,2.4);return.2126*i+.7152*o+.0722*f},setAlpha:function t(r){this._a=R(r);this._roundA=Math.round(100*this._a)/100;return this},toHsv:function t(){var r=s(this._r,this._g,this._b);return{h:r.h*360,s:r.s,v:r.v,a:this._a}},toHsvString:function t(){var r=s(this._r,this._g,this._b);var e=Math.round(r.h*360),a=Math.round(r.s*100),n=Math.round(r.v*100);return this._a==1?"hsv("+e+", "+a+"%, "+n+"%)":"hsva("+e+", "+a+"%, "+n+"%, "+this._roundA+")"},toHsl:function t(){var r=o(this._r,this._g,this._b);return{h:r.h*360,s:r.s,l:r.l,a:this._a}},toHslString:function t(){var r=o(this._r,this._g,this._b);var e=Math.round(r.h*360),a=Math.round(r.s*100),n=Math.round(r.l*100);return this._a==1?"hsl("+e+", "+a+"%, "+n+"%)":"hsla("+e+", "+a+"%, "+n+"%, "+this._roundA+")"},toHex:function t(r){return u(this._r,this._g,this._b,r)},toHexString:function t(r){return"#"+this.toHex(r)},toHex8:function t(r){return l(this._r,this._g,this._b,this._a,r)},toHex8String:function t(r){return"#"+this.toHex8(r)},toRgb:function t(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function t(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function t(){return{r:Math.round(F(this._r,255)*100)+"%",g:Math.round(F(this._g,255)*100)+"%",b:Math.round(F(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function t(){return this._a==1?"rgb("+Math.round(F(this._r,255)*100)+"%, "+Math.round(F(this._g,255)*100)+"%, "+Math.round(F(this._b,255)*100)+"%)":"rgba("+Math.round(F(this._r,255)*100)+"%, "+Math.round(F(this._g,255)*100)+"%, "+Math.round(F(this._b,255)*100)+"%, "+this._roundA+")"},toName:function t(){if(this._a===0){return"transparent"}if(this._a<1){return false}return S[u(this._r,this._g,this._b,true)]||false},toFilter:function t(r){var e="#"+c(this._r,this._g,this._b,this._a);var n=e;var i=this._gradientType?"GradientType = 1, ":"";if(r){var o=a(r);n="#"+c(o._r,o._g,o._b,o._a)}return"progid:DXImageTransform.Microsoft.gradient("+i+"startColorstr="+e+",endColorstr="+n+")"},toString:function t(r){var e=!!r;r=r||this._format;var a=false;var n=this._a<1&&this._a>=0;var i=!e&&n&&(r==="hex"||r==="hex6"||r==="hex3"||r==="hex4"||r==="hex8"||r==="name");if(i){if(r==="name"&&this._a===0){return this.toName()}return this.toRgbString()}if(r==="rgb"){a=this.toRgbString()}if(r==="prgb"){a=this.toPercentageRgbString()}if(r==="hex"||r==="hex6"){a=this.toHexString()}if(r==="hex3"){a=this.toHexString(true)}if(r==="hex4"){a=this.toHex8String(true)}if(r==="hex8"){a=this.toHex8String()}if(r==="name"){a=this.toName()}if(r==="hsl"){a=this.toHslString()}if(r==="hsv"){a=this.toHsvString()}return a||this.toHexString()},clone:function t(){return a(this.toString())},_applyModification:function t(r,e){var a=r.apply(null,[this].concat([].slice.call(e)));this._r=a._r;this._g=a._g;this._b=a._b;this.setAlpha(a._a);return this},lighten:function t(){return this._applyModification(m,arguments)},brighten:function t(){return this._applyModification(v,arguments)},darken:function t(){return this._applyModification(p,arguments)},desaturate:function t(){return this._applyModification(d,arguments)},saturate:function t(){return this._applyModification(g,arguments)},greyscale:function t(){return this._applyModification(b,arguments)},spin:function t(){return this._applyModification(_,arguments)},_applyCombination:function t(r,e){return r.apply(null,[this].concat([].slice.call(e)))},analogous:function t(){return this._applyCombination(A,arguments)},complement:function t(){return this._applyCombination(y,arguments)},monochromatic:function t(){return this._applyCombination(k,arguments)},splitcomplement:function t(){return this._applyCombination(x,arguments)},triad:function t(){return this._applyCombination(M,[3])},tetrad:function t(){return this._applyCombination(M,[4])}};a.fromRatio=function(r,e){if(t(r)=="object"){var n={};for(var i in r){if(r.hasOwnProperty(i)){if(i==="a"){n[i]=r[i]}else{n[i]=E(r[i])}}}r=n}return a(r,e)};function n(r){var e={r:0,g:0,b:0};var a=1;var n=null;var o=null;var s=null;var u=false;var l=false;if(typeof r=="string"){r=O(r)}if(t(r)=="object"){if(D(r.r)&&D(r.g)&&D(r.b)){e=i(r.r,r.g,r.b);u=true;l=String(r.r).substr(-1)==="%"?"prgb":"rgb"}else if(D(r.h)&&D(r.s)&&D(r.v)){n=E(r.s);o=E(r.v);e=h(r.h,n,o);u=true;l="hsv"}else if(D(r.h)&&D(r.s)&&D(r.l)){n=E(r.s);s=E(r.l);e=f(r.h,n,s);u=true;l="hsl"}if(r.hasOwnProperty("a")){a=r.a}}a=R(a);return{ok:u,format:r.format||l,r:Math.min(255,Math.max(e.r,0)),g:Math.min(255,Math.max(e.g,0)),b:Math.min(255,Math.max(e.b,0)),a:a}}function i(t,r,e){return{r:F(t,255)*255,g:F(r,255)*255,b:F(e,255)*255}}function o(t,r,e){t=F(t,255);r=F(r,255);e=F(e,255);var a=Math.max(t,r,e),n=Math.min(t,r,e);var i,o,f=(a+n)/2;if(a==n){i=o=0}else{var s=a-n;o=f>.5?s/(2-a-n):s/(a+n);switch(a){case t:i=(r-e)/s+(r<e?6:0);break;case r:i=(e-t)/s+2;break;case e:i=(t-r)/s+4;break}i/=6}return{h:i,s:o,l:f}}function f(t,r,e){var a,n,i;t=F(t,360);r=F(r,100);e=F(e,100);function o(t,r,e){if(e<0)e+=1;if(e>1)e-=1;if(e<1/6)return t+(r-t)*6*e;if(e<1/2)return r;if(e<2/3)return t+(r-t)*(2/3-e)*6;return t}if(r===0){a=n=i=e}else{var f=e<.5?e*(1+r):e+r-e*r;var s=2*e-f;a=o(s,f,t+1/3);n=o(s,f,t);i=o(s,f,t-1/3)}return{r:a*255,g:n*255,b:i*255}}function s(t,r,e){t=F(t,255);r=F(r,255);e=F(e,255);var a=Math.max(t,r,e),n=Math.min(t,r,e);var i,o,f=a;var s=a-n;o=a===0?0:s/a;if(a==n){i=0}else{switch(a){case t:i=(r-e)/s+(r<e?6:0);break;case r:i=(e-t)/s+2;break;case e:i=(t-r)/s+4;break}i/=6}return{h:i,s:o,v:f}}function h(t,r,e){t=F(t,360)*6;r=F(r,100);e=F(e,100);var a=Math.floor(t),n=t-a,i=e*(1-r),o=e*(1-n*r),f=e*(1-(1-n)*r),s=a%6,h=[e,o,i,i,f,e][s],u=[f,e,e,o,i,i][s],l=[i,i,f,e,e,o][s];return{r:h*255,g:u*255,b:l*255}}function u(t,r,e,a){var n=[z(Math.round(t).toString(16)),z(Math.round(r).toString(16)),z(Math.round(e).toString(16))];if(a&&n[0].charAt(0)==n[0].charAt(1)&&n[1].charAt(0)==n[1].charAt(1)&&n[2].charAt(0)==n[2].charAt(1)){return n[0].charAt(0)+n[1].charAt(0)+n[2].charAt(0)}return n.join("")}function l(t,r,e,a,n){var i=[z(Math.round(t).toString(16)),z(Math.round(r).toString(16)),z(Math.round(e).toString(16)),z(I(a))];if(n&&i[0].charAt(0)==i[0].charAt(1)&&i[1].charAt(0)==i[1].charAt(1)&&i[2].charAt(0)==i[2].charAt(1)&&i[3].charAt(0)==i[3].charAt(1)){return i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0)+i[3].charAt(0)}return i.join("")}function c(t,r,e,a){var n=[z(I(a)),z(Math.round(t).toString(16)),z(Math.round(r).toString(16)),z(Math.round(e).toString(16))];return n.join("")}a.equals=function(t,r){if(!t||!r)return false;return a(t).toRgbString()==a(r).toRgbString()};a.random=function(){return a.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function d(t,r){r=r===0?0:r||10;var e=a(t).toHsl();e.s-=r/100;e.s=C(e.s);return a(e)}function g(t,r){r=r===0?0:r||10;var e=a(t).toHsl();e.s+=r/100;e.s=C(e.s);return a(e)}function b(t){return a(t).desaturate(100)}function m(t,r){r=r===0?0:r||10;var e=a(t).toHsl();e.l+=r/100;e.l=C(e.l);return a(e)}function v(t,r){r=r===0?0:r||10;var e=a(t).toRgb();e.r=Math.max(0,Math.min(255,e.r-Math.round(255*-(r/100))));e.g=Math.max(0,Math.min(255,e.g-Math.round(255*-(r/100))));e.b=Math.max(0,Math.min(255,e.b-Math.round(255*-(r/100))));return a(e)}function p(t,r){r=r===0?0:r||10;var e=a(t).toHsl();e.l-=r/100;e.l=C(e.l);return a(e)}function _(t,r){var e=a(t).toHsl();var n=(e.h+r)%360;e.h=n<0?360+n:n;return a(e)}function y(t){var r=a(t).toHsl();r.h=(r.h+180)%360;return a(r)}function M(t,r){if(isNaN(r)||r<=0){throw new Error("Argument to polyad must be a positive number")}var e=a(t).toHsl();var n=[a(t)];var i=360/r;for(var o=1;o<r;o++){n.push(a({h:(e.h+o*i)%360,s:e.s,l:e.l}))}return n}function x(t){var r=a(t).toHsl();var e=r.h;return[a(t),a({h:(e+72)%360,s:r.s,l:r.l}),a({h:(e+216)%360,s:r.s,l:r.l})]}function A(t,r,e){r=r||6;e=e||30;var n=a(t).toHsl();var i=360/e;var o=[a(t)];for(n.h=(n.h-(i*r>>1)+720)%360;--r;){n.h=(n.h+i)%360;o.push(a(n))}return o}function k(t,r){r=r||6;var e=a(t).toHsv();var n=e.h,i=e.s,o=e.v;var f=[];var s=1/r;while(r--){f.push(a({h:n,s:i,v:o}));o=(o+s)%1}return f}a.mix=function(t,r,e){e=e===0?0:e||50;var n=a(t).toRgb();var i=a(r).toRgb();var o=e/100;var f={r:(i.r-n.r)*o+n.r,g:(i.g-n.g)*o+n.g,b:(i.b-n.b)*o+n.b,a:(i.a-n.a)*o+n.a};return a(f)};a.readability=function(t,r){var e=a(t);var n=a(r);return(Math.max(e.getLuminance(),n.getLuminance())+.05)/(Math.min(e.getLuminance(),n.getLuminance())+.05)};a.isReadable=function(t,r,e){var n=a.readability(t,r);var i,o;o=false;i=P(e);switch(i.level+i.size){case"AAsmall":case"AAAlarge":o=n>=4.5;break;case"AAlarge":o=n>=3;break;case"AAAsmall":o=n>=7;break}return o};a.mostReadable=function(t,r,e){var n=null;var i=0;var o;var f,s,h;e=e||{};f=e.includeFallbackColors;s=e.level;h=e.size;for(var u=0;u<r.length;u++){o=a.readability(t,r[u]);if(o>i){i=o;n=a(r[u])}}if(a.isReadable(t,n,{level:s,size:h})||!f){return n}else{e.includeFallbackColors=false;return a.mostReadable(t,["#fff","#000"],e)}};var w=a.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"};var S=a.hexNames=H(w);function H(t){var r={};for(var e in t){if(t.hasOwnProperty(e)){r[t[e]]=e}}return r}function R(t){t=parseFloat(t);if(isNaN(t)||t<0||t>1){t=1}return t}function F(t,r){if(q(t))t="100%";var e=N(t);t=Math.min(r,Math.max(0,parseFloat(t)));if(e){t=parseInt(t*r,10)/100}if(Math.abs(t-r)<1e-6){return 1}return t%r/parseFloat(r)}function C(t){return Math.min(1,Math.max(0,t))}function j(t){return parseInt(t,16)}function q(t){return typeof t=="string"&&t.indexOf(".")!=-1&&parseFloat(t)===1}function N(t){return typeof t==="string"&&t.indexOf("%")!=-1}function z(t){return t.length==1?"0"+t:""+t}function E(t){if(t<=1){t=t*100+"%"}return t}function I(t){return Math.round(parseFloat(t)*255).toString(16)}function L(t){return j(t)/255}var T=function(){var t="[-\\+]?\\d+%?";var r="[-\\+]?\\d*\\.\\d+%?";var e="(?:"+r+")|(?:"+t+")";var a="[\\s|\\(]+("+e+")[,|\\s]+("+e+")[,|\\s]+("+e+")\\s*\\)?";var n="[\\s|\\(]+("+e+")[,|\\s]+("+e+")[,|\\s]+("+e+")[,|\\s]+("+e+")\\s*\\)?";return{CSS_UNIT:new RegExp(e),rgb:new RegExp("rgb"+a),rgba:new RegExp("rgba"+n),hsl:new RegExp("hsl"+a),hsla:new RegExp("hsla"+n),hsv:new RegExp("hsv"+a),hsva:new RegExp("hsva"+n),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function D(t){return!!T.CSS_UNIT.exec(t)}function O(t){t=t.replace(r,"").replace(e,"").toLowerCase();var a=false;if(w[t]){t=w[t];a=true}else if(t=="transparent"){return{r:0,g:0,b:0,a:0,format:"name"}}var n;if(n=T.rgb.exec(t)){return{r:n[1],g:n[2],b:n[3]}}if(n=T.rgba.exec(t)){return{r:n[1],g:n[2],b:n[3],a:n[4]}}if(n=T.hsl.exec(t)){return{h:n[1],s:n[2],l:n[3]}}if(n=T.hsla.exec(t)){return{h:n[1],s:n[2],l:n[3],a:n[4]}}if(n=T.hsv.exec(t)){return{h:n[1],s:n[2],v:n[3]}}if(n=T.hsva.exec(t)){return{h:n[1],s:n[2],v:n[3],a:n[4]}}if(n=T.hex8.exec(t)){return{r:j(n[1]),g:j(n[2]),b:j(n[3]),a:L(n[4]),format:a?"name":"hex8"}}if(n=T.hex6.exec(t)){return{r:j(n[1]),g:j(n[2]),b:j(n[3]),format:a?"name":"hex"}}if(n=T.hex4.exec(t)){return{r:j(n[1]+""+n[1]),g:j(n[2]+""+n[2]),b:j(n[3]+""+n[3]),a:L(n[4]+""+n[4]),format:a?"name":"hex8"}}if(n=T.hex3.exec(t)){return{r:j(n[1]+""+n[1]),g:j(n[2]+""+n[2]),b:j(n[3]+""+n[3]),format:a?"name":"hex"}}return false}function P(t){var r,e;t=t||{level:"AA",size:"small"};r=(t.level||"AA").toUpperCase();e=(t.size||"small").toLowerCase();if(r!=="AA"&&r!=="AAA"){r="AA"}if(e!=="small"&&e!=="large"){e="small"}return{level:r,size:e}}return a}))}));var isDarkColor=function(t){return tinycolor(t).isDark()};export{isDarkColor as i};
|