@zonos/elements 1.2.4-alpha.10 → 1.2.4-alpha.12
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-90f7c8c0.js → cart-963ffc24.js} +1 -1
- package/dist/cjs/index.cjs.js +2 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{localization-9caf3397.js → localization-994933ce.js} +1 -1
- package/dist/cjs/{submitGtag-b141b45d.js → submitGtag-e047f309.js} +1 -1
- package/dist/cjs/zonos-address_2.cjs.entry.js +2 -2
- package/dist/cjs/zonos-cart-items_10.cjs.entry.js +3 -3
- package/dist/cjs/zonos-checkout.cjs.entry.js +3 -3
- package/dist/cjs/zonos-controller.cjs.entry.js +8 -2
- package/dist/cjs/zonos-country-flag_4.cjs.entry.js +1 -1
- package/dist/cjs/zonos-elements.cjs.js +1 -1
- package/dist/cjs/zonos-hello-dialog.cjs.entry.js +1 -1
- package/dist/cjs/zonos-hello.cjs.entry.js +1 -1
- package/dist/cjs/zonos-payment.cjs.entry.js +2 -2
- package/dist/collection/components/main/zonos-controller.js +27 -0
- package/dist/collection/components/utils/handleFetch.js +1 -1
- package/dist/collection/scripts/zonos.js +4 -0
- package/dist/components/localization.js +1 -1
- package/dist/components/zonos-controller.js +8 -1
- package/dist/esm/{cart-b439be00.js → cart-c5236eec.js} +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{localization-a51ccbc2.js → localization-3cb32a71.js} +1 -1
- package/dist/esm/{submitGtag-521826a2.js → submitGtag-9de4957f.js} +1 -1
- package/dist/esm/zonos-address_2.entry.js +2 -2
- package/dist/esm/zonos-cart-items_10.entry.js +3 -3
- package/dist/esm/zonos-checkout.entry.js +3 -3
- package/dist/esm/zonos-controller.entry.js +8 -2
- package/dist/esm/zonos-country-flag_4.entry.js +1 -1
- package/dist/esm/zonos-elements.js +1 -1
- package/dist/esm/zonos-hello-dialog.entry.js +1 -1
- package/dist/esm/zonos-hello.entry.js +1 -1
- package/dist/esm/zonos-payment.entry.js +2 -2
- package/dist/esm-es5/{cart-b439be00.js → cart-c5236eec.js} +1 -1
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/{submitGtag-521826a2.js → submitGtag-9de4957f.js} +1 -1
- package/dist/esm-es5/zonos-address_2.entry.js +1 -1
- package/dist/esm-es5/zonos-cart-items_10.entry.js +1 -1
- package/dist/esm-es5/zonos-checkout.entry.js +1 -1
- package/dist/esm-es5/zonos-controller.entry.js +1 -1
- package/dist/esm-es5/zonos-country-flag_4.entry.js +1 -1
- package/dist/esm-es5/zonos-elements.js +1 -1
- package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
- package/dist/esm-es5/zonos-hello.entry.js +1 -1
- package/dist/esm-es5/zonos-payment.entry.js +1 -1
- package/dist/scripts/loadZonos.js +7 -3
- package/dist/scripts/zonos.js +7 -3
- package/dist/types/components/main/zonos-controller.d.ts +4 -0
- package/dist/types/components.d.ts +4 -0
- package/dist/types/scripts/zonos.d.ts +2 -0
- package/dist/zonos-elements/assets/RemoveIcon.svg +1 -1
- package/dist/zonos-elements/index.esm.js +1 -1
- package/dist/zonos-elements/{p-b6148206.entry.js → p-07ebdfd9.entry.js} +1 -1
- package/dist/zonos-elements/{p-a0e36ed3.entry.js → p-0d536271.entry.js} +1 -1
- package/dist/zonos-elements/p-24fbe845.system.js +1 -1
- package/dist/zonos-elements/{p-494c77a7.entry.js → p-39013804.entry.js} +1 -1
- package/dist/zonos-elements/{p-e9b832c5.entry.js → p-3e70063e.entry.js} +1 -1
- package/dist/zonos-elements/{p-4846796a.js → p-425996c1.js} +1 -1
- package/dist/zonos-elements/{p-a504f64f.system.js → p-509eb1de.system.js} +1 -1
- package/dist/zonos-elements/{p-f141519c.system.entry.js → p-510d3aa3.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-4a15c5c7.system.entry.js → p-5554ff33.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-4bee0bff.system.entry.js → p-65749745.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-3cea383b.system.entry.js → p-6aa44c88.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-8c48b75e.system.js → p-6d4232a6.system.js} +1 -1
- package/dist/zonos-elements/{p-67aec665.entry.js → p-6f8da71e.entry.js} +1 -1
- package/dist/zonos-elements/{p-b4601210.system.entry.js → p-7fdc8b27.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-639396bb.entry.js → p-83c7c3f4.entry.js} +1 -1
- package/dist/zonos-elements/{p-afe26069.entry.js → p-8cefaae6.entry.js} +1 -1
- package/dist/zonos-elements/{p-2a307c55.system.entry.js → p-8e4794fe.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-4ed71bd7.entry.js → p-bb24e583.entry.js} +1 -1
- package/dist/zonos-elements/{p-8c5595d9.system.entry.js → p-e06711b8.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-06fb9d1f.system.entry.js → p-e100f180.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-1685c8df.js → p-e2c2584c.js} +1 -1
- package/dist/zonos-elements/{p-d2217f09.system.js → p-f33e1ffb.system.js} +1 -1
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/package.json +3 -2
- /package/dist/esm-es5/{localization-a51ccbc2.js → localization-3cb32a71.js} +0 -0
- /package/dist/zonos-elements/{p-b51de536.system.js → p-8a8b08e9.system.js} +0 -0
- /package/dist/zonos-elements/{p-3c6988d7.js → p-bbb154a9.js} +0 -0
package/dist/scripts/zonos.js
CHANGED
|
@@ -218,8 +218,8 @@ const zonosQaUrl = (() => {
|
|
|
218
218
|
});
|
|
219
219
|
return fullUrl;
|
|
220
220
|
})();
|
|
221
|
-
const ZONOS_URL = zonosQaUrl || "https://v1.2.4-alpha.
|
|
222
|
-
const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.2.4-alpha.
|
|
221
|
+
const ZONOS_URL = zonosQaUrl || "https://v1.2.4-alpha.12.js.zonos.com";
|
|
222
|
+
const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.2.4-alpha.12";
|
|
223
223
|
const INTER_FONT_URL = 'https://rsms.me';
|
|
224
224
|
const GOOGLE_FONT_URL = 'https://fonts.googleapis.com';
|
|
225
225
|
const INTER_FONT_REGEX = /^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;
|
|
@@ -232,7 +232,7 @@ Zonos.debug = !!window.location.search.match(/\?.*(&*)zonosDebug=1/);
|
|
|
232
232
|
Zonos.isBigCommerce = false;
|
|
233
233
|
Zonos.internationalHideSelector = '';
|
|
234
234
|
Zonos.zonosQaUrl = zonosQaUrl;
|
|
235
|
-
Zonos.version = `v${"1.2.4-alpha.
|
|
235
|
+
Zonos.version = `v${"1.2.4-alpha.12"}`;
|
|
236
236
|
Zonos.modeAlerted = false;
|
|
237
237
|
Zonos.getCurrentTimestamp = () => new Date().getTime();
|
|
238
238
|
Zonos.zonosController = null;
|
|
@@ -278,6 +278,10 @@ Zonos.showNotification = (notification) => {
|
|
|
278
278
|
var _b;
|
|
279
279
|
void ((_b = _a.zonosController) === null || _b === void 0 ? void 0 : _b.showNotification(notification));
|
|
280
280
|
};
|
|
281
|
+
Zonos.updateOrganizationName = (organizationName) => {
|
|
282
|
+
var _b;
|
|
283
|
+
void ((_b = _a.zonosController) === null || _b === void 0 ? void 0 : _b.updateOrganizationName(organizationName));
|
|
284
|
+
};
|
|
281
285
|
Zonos.disablePlaceOrderButtons = ({ autoEnable = true, disable, placeOrderButtonSelector, }) => {
|
|
282
286
|
// if placeOrderAnchor is passed in the config for checkoutSettings, disable the place order button until zonos is initialized
|
|
283
287
|
if (placeOrderButtonSelector) {
|
|
@@ -50,5 +50,9 @@ export declare class ZonosController {
|
|
|
50
50
|
* Get appearance from setting
|
|
51
51
|
*/
|
|
52
52
|
getAppearanceSetting(): Promise<AppearanceConfig>;
|
|
53
|
+
/**
|
|
54
|
+
* Update the organizationName
|
|
55
|
+
*/
|
|
56
|
+
updateOrganizationName(organizationName: string): Promise<void>;
|
|
53
57
|
render(): any;
|
|
54
58
|
}
|
|
@@ -327,6 +327,10 @@ export namespace Components {
|
|
|
327
327
|
* Show notification
|
|
328
328
|
*/
|
|
329
329
|
"showNotification": (notification: NotificationInit) => Promise<void>;
|
|
330
|
+
/**
|
|
331
|
+
* Update the organizationName
|
|
332
|
+
*/
|
|
333
|
+
"updateOrganizationName": (organizationName: string) => Promise<void>;
|
|
330
334
|
/**
|
|
331
335
|
* The zonos api key
|
|
332
336
|
*/
|
|
@@ -35,6 +35,7 @@ export interface Zonos {
|
|
|
35
35
|
injectSupportGoogleFont: (fontUrl: string) => void;
|
|
36
36
|
setupGoogleFont: (fontFamily: string) => void;
|
|
37
37
|
showNotification: (props: NotificationInit) => void;
|
|
38
|
+
updateOrganizationName: (organizationName: string) => void;
|
|
38
39
|
}
|
|
39
40
|
export declare abstract class Zonos {
|
|
40
41
|
static zonosApiKey: string;
|
|
@@ -51,6 +52,7 @@ export declare abstract class Zonos {
|
|
|
51
52
|
static init: ({ appearance, checkoutSettings, currencyConverter, helloSettings, zonosApiKey, }: LoadZonosParams) => Promise<void>;
|
|
52
53
|
static displayCurrency: () => void;
|
|
53
54
|
static showNotification: (notification: NotificationInit) => void;
|
|
55
|
+
static updateOrganizationName: (organizationName: string) => void;
|
|
54
56
|
private static disablePlaceOrderButtons;
|
|
55
57
|
private static injectController;
|
|
56
58
|
private static injectSentryScript;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<svg color="var(--amino-
|
|
1
|
+
<svg color="var(--amino-red-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="https://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Z" data-is-secondary-color="true" fill="var(--amino-red-200)" fill-rule="evenodd"></path><path clip-rule="evenodd" d="M8.293 8.293a1 1 0 0 1 1.414 0L12 10.586l2.293-2.293a1 1 0 1 1 1.414 1.414L13.414 12l2.293 2.293a1 1 0 0 1-1.414 1.414L12 13.414l-2.293 2.293a1 1 0 0 1-1.414-1.414L10.586 12 8.293 9.707a1 1 0 0 1 0-1.414Z" fill="currentColor" fill-rule="evenodd"></path></svg>
|
|
@@ -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"./p-
|
|
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"./p-425996c1.js";import"./p-089ba905.js";import"./p-956efa27.js";import"./p-bbb154a9.js";import"./p-55f49f1e.js";import"./p-ff95f098.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as s,h as o,H as n,d as t}from"./p-956efa27.js";import{s as i,m as a}from"./p-
|
|
1
|
+
import{r as s,h as o,H as n,d as t}from"./p-956efa27.js";import{s as i,m as a}from"./p-425996c1.js";import{b as e,a as c}from"./p-bbb154a9.js";import"./p-089ba905.js";import"./p-55f49f1e.js";import"./p-ff95f098.js";const h=class{constructor(o){s(this,o),this.type=void 0,this.titleText=void 0,this.defaultAddress=null,this.stripe=window.Zonos.stripe}async watchInitStripe(){var s,o;if(this.stripe=window.Zonos.stripe,!this.stripe||!i.stripeElements)return void e("Stripe is not initialized. Couldn't load stripe element.");(null===(s=this.defaultAddress)||void 0===s?void 0:s.phone)||null===(o=this.defaultAddress)||void 0===o||delete o.phone;const n=c.shippingZoneCountries,t=i.stripeAddressElement||i.stripeElements.create("address",{allowedCountries:n?Object.values(n).map((s=>s.code)):[],contacts:this.defaultAddress?[this.defaultAddress]:void 0,defaultValues:{address:{country:c.selectedCountryCode||"AL"}},display:{name:"split"},fields:{phone:"always"},mode:this.type,validation:{phone:{required:"always"}}});t.mount(this.el.querySelector(".zonos--address-component")),t.on("change",(s=>{const o=s.value;i.stripeAddressEventData=Object.assign(Object.assign({},s),{elementMode:"shipping",elementType:"address",empty:!1,value:Object.assign(Object.assign({},o),{firstName:o.firstName||o.name.split(" ")[0],lastName:o.lastName||o.name.split(" ").pop()})}),a()})),i.stripeAddressElement=t}componentDidLoad(){this.watchInitStripe()}render(){return o(n,{class:"zonos--address zonos--elements"},o("zonos-text",{class:"zonos--title",type:"semiBoldLabel"},this.titleText),o("div",{class:"zonos--address-component"}))}get el(){return t(this)}static get watchers(){return{stripe:["watchInitStripe"]}}};h.style=".sc-zonos-address-h{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-address-h *.sc-zonos-address{font-family:var(--font-family, Inter), Inter}.sc-zonos-address-h img.sc-zonos-address{max-width:100%}.sc-zonos-address-h dl.sc-zonos-address,.sc-zonos-address-h dd.sc-zonos-address,.sc-zonos-address-h h1.sc-zonos-address,.sc-zonos-address-h h2.sc-zonos-address,.sc-zonos-address-h h3.sc-zonos-address,.sc-zonos-address-h h4.sc-zonos-address,.sc-zonos-address-h h5.sc-zonos-address,.sc-zonos-address-h h6.sc-zonos-address,.sc-zonos-address-h hr.sc-zonos-address,.sc-zonos-address-h figure.sc-zonos-address,.sc-zonos-address-h p.sc-zonos-address,.sc-zonos-address-h pre.sc-zonos-address{margin:0}.sc-zonos-address-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-address-h .zonos--title.sc-zonos-address{margin-bottom:var(--amino-space-16)}";const d=class{constructor(o){s(this,o),this.titleText=void 0,this.stripe=i.stripe}watchInitStripe(){if(!this.stripe||!i.stripeElements)return;const s=i.stripeLinkElement||i.stripeElements.create("linkAuthentication"),o=this.el.querySelector(".zonos--link-authentication-component");o?(s.mount(o),s.on("change",(s=>{i.stripeLinkEventData=s,a()})),i.stripeLinkElement=s):console.error("Cannot find container element for linkAuthenticationElement")}componentDidLoad(){this.watchInitStripe()}render(){return o(n,{class:"zonos--link-authentication zonos--elements"},o("zonos-text",{class:"zonos--title",type:"semiBoldLabel"},this.titleText),o("div",{class:"zonos--link-authentication-component"}))}get el(){return t(this)}static get watchers(){return{stripe:["watchInitStripe"]}}};d.style=".sc-zonos-link-authentication-h{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-link-authentication-h *.sc-zonos-link-authentication{font-family:var(--font-family, Inter), Inter}.sc-zonos-link-authentication-h img.sc-zonos-link-authentication{max-width:100%}.sc-zonos-link-authentication-h dl.sc-zonos-link-authentication,.sc-zonos-link-authentication-h dd.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h1.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h2.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h3.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h4.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h5.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h6.sc-zonos-link-authentication,.sc-zonos-link-authentication-h hr.sc-zonos-link-authentication,.sc-zonos-link-authentication-h figure.sc-zonos-link-authentication,.sc-zonos-link-authentication-h p.sc-zonos-link-authentication,.sc-zonos-link-authentication-h pre.sc-zonos-link-authentication{margin:0}.sc-zonos-link-authentication-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-link-authentication-h .zonos--title.sc-zonos-link-authentication{margin-bottom:var(--amino-space-16)}";export{h as zonos_address,d as zonos_link_authentication}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as o,c as t,h as e,H as s}from"./p-956efa27.js";import{k as i,a as n,t as l}from"./p-3c6988d7.js";import{z as a}from"./p-089ba905.js";import{c as r}from"./p-b4b7f705.js";import{g as h}from"./p-5883217a.js";const d=class{constructor(e){o(this,e),this.closeDialog=t(this,"closeDialog",7),this.clickOutsideDialogHandler=o=>{!o.composedPath().includes(this.dialogRef)&&this.isOpen&&this.setIsOpen(!1)},this.getCurrentPageEnum=()=>{switch(a.currentHelloPage){case"home":return"hello_homepage";case"cart":return"hello_cart";case"productList":return"hello_item_list";case"productDetail":return"hello_item_details";default:return null}},this.setShowCountrySelect=async o=>{this.showCountrySelect=o},this.isOpen=!1,this.setIsOpen=()=>{},this.mobileLocationOverride=void 0,this.animateFromLeftOverride=void 0,this.appearanceSettings=void 0,this.restrictedItems=[],this.welcomeMessage="Welcome to our Demo App!",this.showCountrySelect=!1}globalClickHandler(o){this.clickOutsideDialogHandler(o)}isOpenHandler(o){o||this.setShowCountrySelect(!1)}render(){var o;const{countryLandedCost:t,selectedCountryCode:d}=n,c=(null==t?void 0:t.dutyDeminimus)?i(t.dutyDeminimus):null,m="CA"===n.selectedCountryCode?i(40):c,g=m?`${l("Spend")} ${m} ${l("duty free")}`:l("Duties will apply to all orders"),f=(null==t?void 0:t.vatTaxDeminimus)?i(t.vatTaxDeminimus):null,u="CA"===n.selectedCountryCode?i(150):f,p=u?`${l("Spend")} ${u} ${l("tax free")}`:l("Taxes will apply to all orders"),b=this.animateFromLeftOverride||this.dialogRef&&h(this.dialogRef),w=this.dialogRef&&(()=>{const o=this.dialogRef.getBoundingClientRect();return o.top>=window.innerHeight-o.bottom})(),{customMessages:z}=n,v=`${l("Welcome to")} ${a.organizationName}!`,C=(null===(o=z.find((o=>"hello_default"===o.pageName)))||void 0===o?void 0:o.message)||l("Know about duties and taxes before you buy. Shop with confidence!"),x=this.getCurrentPageEnum(),k=z.filter((o=>o.pageName===x));return e(s,{class:"zonos--elements"},e("div",{"aria-hidden":"true",class:r(["zonos--hello-dialog",b&&"zonos--hello-dialog-animate-from-left",w&&"zonos--hello-dialog-animate-from-bottom",!!this.mobileLocationOverride&&"zonos--hello-dialog-mobile-override",this.isOpen&&"zonos--hello-dialog-open"]),ref:o=>o&&(this.dialogRef=o)},e("div",{class:"zonos--hello-dialog-content"},e("zonos-button",{class:"zonos--close-button",icon:e("zonos-icon",{content:'<svg xmlns="https://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path fill="#C5C6CA" fill-rule="evenodd" d="M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Z" clip-rule="evenodd"/><path fill="#4D505A" fill-rule="evenodd" d="M8.293 8.293a1 1 0 0 1 1.414 0L12 10.586l2.293-2.293a1 1 0 1 1 1.414 1.414L13.414 12l2.293 2.293a1 1 0 0 1-1.414 1.414L12 13.414l-2.293 2.293a1 1 0 0 1-1.414-1.414L10.586 12 8.293 9.707a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"/></svg>'}),noBackground:!0,onClick:()=>this.setIsOpen(!1)}),e("div",null,this.showCountrySelect?e("zonos-country-select",{closeCountrySelect:()=>this.setShowCountrySelect(!1)}):e("zonos-v-stack",{spacing:24},e("zonos-country-flag",{class:"zonos--hello-country-flag",countryCode:d}),e("zonos-v-stack",{class:"zonos--hello-dialog-header",spacing:4},e("zonos-text",{type:"boldSubheader"},v),e("zonos-text",{color:"gray-800"},C)),e("zonos-v-stack",{spacing:8},this.restrictedItems.map((o=>{var t;return o&&e("zonos-banner",{bannerTitle:o.name,intent:"error"},null===(t=o.itemRestrictions)||void 0===t?void 0:t.map((o=>e("zonos-text",{color:"red-800"},null==o?void 0:o.note))))})),e("zonos-card",{spacing:"12px"},e("zonos-v-stack",{spacing:12},e("div",{class:"zonos--flex-message"},e("zonos-icon",{content:'<svg width="21" height="20" viewBox="0 0 21 20" fill="none" xmlns="https://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M9.66666 4.16667C9.20642 4.16667 8.83333 4.53976 8.83333 5V5.83333H12.1667V5C12.1667 4.53976 11.7936 4.16667 11.3333 4.16667H9.66666ZM13.8333 5.83333V5C13.8333 3.61929 12.714 2.5 11.3333 2.5H9.66666C8.28595 2.5 7.16666 3.61929 7.16666 5V5.83333H6.77759C5.44832 5.83333 4.35149 6.87354 4.2811 8.20094L3.92756 14.8676C3.85169 16.2983 4.99133 17.5 6.42405 17.5H14.5759C16.0087 17.5 17.1483 16.2983 17.0724 14.8676L16.7189 8.20094C16.6485 6.87354 15.5517 5.83333 14.2224 5.83333H13.8333ZM12.1667 7.5V8.33333C12.1667 8.79357 12.5398 9.16667 13 9.16667C13.4602 9.16667 13.8333 8.79357 13.8333 8.33333V7.5H14.2224C14.6655 7.5 15.0311 7.84674 15.0546 8.2892L15.4081 14.9559C15.4334 15.4328 15.0535 15.8333 14.5759 15.8333H6.42405C5.94648 15.8333 5.5666 15.4328 5.59189 14.9559L5.94542 8.2892C5.96889 7.84674 6.3345 7.5 6.77759 7.5H7.16666V8.33333C7.16666 8.79357 7.53976 9.16667 7.99999 9.16667C8.46023 9.16667 8.83333 8.79357 8.83333 8.33333V7.5H12.1667Z" fill="#4D505A"/>\n</svg>\n'}),e("zonos-text",null,g)),e("div",{class:"zonos--flex-message"},e("zonos-icon",{content:'<svg width="21" height="20" viewBox="0 0 21 20" fill="none" xmlns="https://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M2.16666 5.83301C2.16666 4.4523 3.28594 3.33301 4.66666 3.33301H16.3333C17.714 3.33301 18.8333 4.4523 18.8333 5.83301V14.1663C18.8333 15.5471 17.714 16.6663 16.3333 16.6663H4.66666C3.28594 16.6663 2.16666 15.5471 2.16666 14.1663V5.83301ZM4.66666 4.99967C4.20642 4.99967 3.83332 5.37277 3.83332 5.83301V14.1663C3.83332 14.6266 4.20642 14.9997 4.66666 14.9997H16.3333C16.7936 14.9997 17.1667 14.6266 17.1667 14.1663V5.83301C17.1667 5.37277 16.7936 4.99967 16.3333 4.99967H4.66666ZM6.33332 8.33301C6.79356 8.33301 7.16666 8.7061 7.16666 9.16634V10.833C7.16666 11.2932 6.79356 11.6663 6.33332 11.6663C5.87309 11.6663 5.49999 11.2932 5.49999 10.833V9.16634C5.49999 8.7061 5.87309 8.33301 6.33332 8.33301ZM8.83332 9.99967C8.83332 9.0792 9.57952 8.33301 10.5 8.33301C11.4205 8.33301 12.1667 9.0792 12.1667 9.99967C12.1667 10.9201 11.4205 11.6663 10.5 11.6663C9.57952 11.6663 8.83332 10.9201 8.83332 9.99967ZM14.6667 8.33301C15.1269 8.33301 15.5 8.7061 15.5 9.16634V10.833C15.5 11.2932 15.1269 11.6663 14.6667 11.6663C14.2064 11.6663 13.8333 11.2932 13.8333 10.833V9.16634C13.8333 8.7061 14.2064 8.33301 14.6667 8.33301Z" fill="#4D505A"/>\n</svg>\n'}),e("zonos-text",null,p)))),k.map((o=>e("zonos-custom-message",{icon:'<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="https://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M2.25 4.5C2.25 3.25736 3.25736 2.25 4.5 2.25H13.5C14.7426 2.25 15.75 3.25736 15.75 4.5V10.5C15.75 11.7426 14.7426 12.75 13.5 12.75H8.25C8.01393 12.75 7.79164 12.8611 7.65 13.05L6.3 14.85C5.87508 15.4166 5.2082 15.75 4.5 15.75C3.25736 15.75 2.25 14.7426 2.25 13.5V4.5ZM4.5 3.75C4.08579 3.75 3.75 4.08579 3.75 4.5V13.5C3.75 13.9142 4.08579 14.25 4.5 14.25C4.73607 14.25 4.95836 14.1389 5.1 13.95L6.45 12.15C6.87492 11.5834 7.5418 11.25 8.25 11.25H13.5C13.9142 11.25 14.25 10.9142 14.25 10.5V4.5C14.25 4.08579 13.9142 3.75 13.5 3.75H4.5ZM5.25 6C5.25 5.58579 5.58579 5.25 6 5.25H12C12.4142 5.25 12.75 5.58579 12.75 6C12.75 6.41421 12.4142 6.75 12 6.75H6C5.58579 6.75 5.25 6.41421 5.25 6ZM5.25 9C5.25 8.58579 5.58579 8.25 6 8.25H8.25C8.66421 8.25 9 8.58579 9 9C9 9.41421 8.66421 9.75 8.25 9.75H6C5.58579 9.75 5.25 9.41421 5.25 9Z" fill="#4D505A"/>\n</svg>\n',message:o.message}))))))),!this.showCountrySelect&&e("zonos-hello-dialog-footer",{appearanceSettings:this.appearanceSettings,setShowCountrySelect:o=>this.setShowCountrySelect(o)})))}static get assetsDirs(){return["assets"]}static get watchers(){return{isOpen:["isOpenHandler"]}}};d.style=":host{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--font-family, Inter), Inter}: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--hello-country-flag{height:18px;width:18px;position:relative;overflow:hidden;border-radius:30px;-webkit-box-shadow:var(--amino-v3-shadow-medium);box-shadow:var(--amino-v3-shadow-medium);z-index:10;justify-self:center}:host .zonos--hello-dialog{position:absolute;background:var(--amino-surface-color);width:100vw;max-width:430px;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;max-height:600px;border-radius:var(--amino-radius-12);outline:none;-webkit-box-shadow:var(--amino-v3-shadow-xxl);box-shadow:var(--amino-v3-shadow-xxl);overflow-y:auto;top:-2px;right:-2px;opacity:0;-webkit-transition:opacity 0.3s ease-in-out, -webkit-transform 0.3s ease-in-out;transition:opacity 0.3s ease-in-out, -webkit-transform 0.3s ease-in-out;transition:opacity 0.3s ease-in-out, transform 0.3s ease-in-out;transition:opacity 0.3s ease-in-out, transform 0.3s ease-in-out, -webkit-transform 0.3s ease-in-out;-webkit-transform:scale(0);transform:scale(0);-webkit-transform-origin:top right;transform-origin:top right;z-index:1001}:host .zonos--hello-dialog .zonos--hello-dialog-header{text-align:center}:host .zonos--hello-dialog.zonos--hello-dialog-animate-from-left{-webkit-transform-origin:top left;transform-origin:top left;right:unset;left:-2px}:host .zonos--hello-dialog.zonos--hello-dialog-animate-from-bottom{-webkit-transform-origin:bottom right;transform-origin:bottom right;bottom:calc(100% - 32px);top:unset}:host .zonos--hello-dialog.zonos--hello-dialog-animate-from-bottom.zonos--hello-dialog-animate-from-left{-webkit-transform-origin:bottom left;transform-origin:bottom left}:host .zonos--hello-dialog::-webkit-scrollbar{width:12px;height:12px}:host .zonos--hello-dialog::-webkit-scrollbar-track{background:#f5f5f5;border-top-right-radius:var(--amino-radius-12);border-bottom-right-radius:var(--amino-radius-12)}:host .zonos--hello-dialog::-webkit-scrollbar-thumb{border-radius:10px;background:#ccc;border:4px solid transparent;background-clip:content-box}:host .zonos--hello-dialog::-webkit-scrollbar-thumb:hover{background:#999}:host .zonos--hello-dialog .zonos--animate-content{opacity:0;height:0;-webkit-transition:all 0.3s ease-in-out;transition:all 0.3s ease-in-out}:host .zonos--hello-dialog .zonos--show-animate-content{opacity:1;height:100%}:host .zonos--hello-dialog.zonos--hello-dialog-open{opacity:1;-webkit-transform:scale(1);transform:scale(1)}:host .zonos--hello-dialog .zonos--close-button{position:absolute;right:var(--amino-space-8);top:var(--amino-space-8);width:var(--amino-size-md);height:var(--amino-size-md);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;cursor:pointer;z-index:10}:host .zonos--hello-dialog .zonos--close-button:hover{background:var(--amino-hover-color);border-radius:var(--amino-radius-6)}:host .zonos--hello-dialog .zonos--hello-dialog-content{padding:var(--amino-space-16)}:host .zonos--hello-dialog .zonos--hello-dialog-content .zonos--hello-country-flag{border-radius:var(--amino-radius-4);width:32px;height:24px}:host .zonos--hello-dialog .zonos--flex-message{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;gap:var(--amino-space-12)}:host .zonos--hello-dialog.zonos--hello-dialog-mobile-override{position:-webkit-sticky;position:sticky;top:unset;left:unset;right:unset;bottom:0;width:100vw;max-width:100vw;max-height:unset;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;-webkit-transform:scaleY(0);transform:scaleY(0);border-radius:0;-webkit-transform-origin:bottom;transform-origin:bottom}:host .zonos--hello-dialog.zonos--hello-dialog-mobile-override.zonos--hello-dialog-animate-from-left{-webkit-transform-origin:bottom;transform-origin:bottom}:host .zonos--hello-dialog.zonos--hello-dialog-mobile-override.zonos--hello-dialog-open{opacity:1;-webkit-transform:scaleY(1);transform:scaleY(1)}@media (max-width: 768px){:host .zonos--hello-dialog{position:-webkit-sticky;position:sticky;top:unset;left:unset;right:unset;bottom:0;width:100vw;max-width:100vw;max-height:unset;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;-webkit-transform:scaleY(0);transform:scaleY(0);border-radius:0;-webkit-transform-origin:bottom;transform-origin:bottom}:host .zonos--hello-dialog.zonos--hello-dialog-animate-from-left{-webkit-transform-origin:bottom;transform-origin:bottom}:host .zonos--hello-dialog.zonos--hello-dialog-open{opacity:1;-webkit-transform:scaleY(1);transform:scaleY(1)}}";export{d as zonos_hello_dialog}
|
|
1
|
+
import{r as o,c as t,h as e,H as s}from"./p-956efa27.js";import{k as i,a as n,t as l}from"./p-bbb154a9.js";import{z as a}from"./p-089ba905.js";import{c as r}from"./p-b4b7f705.js";import{g as h}from"./p-5883217a.js";const d=class{constructor(e){o(this,e),this.closeDialog=t(this,"closeDialog",7),this.clickOutsideDialogHandler=o=>{!o.composedPath().includes(this.dialogRef)&&this.isOpen&&this.setIsOpen(!1)},this.getCurrentPageEnum=()=>{switch(a.currentHelloPage){case"home":return"hello_homepage";case"cart":return"hello_cart";case"productList":return"hello_item_list";case"productDetail":return"hello_item_details";default:return null}},this.setShowCountrySelect=async o=>{this.showCountrySelect=o},this.isOpen=!1,this.setIsOpen=()=>{},this.mobileLocationOverride=void 0,this.animateFromLeftOverride=void 0,this.appearanceSettings=void 0,this.restrictedItems=[],this.welcomeMessage="Welcome to our Demo App!",this.showCountrySelect=!1}globalClickHandler(o){this.clickOutsideDialogHandler(o)}isOpenHandler(o){o||this.setShowCountrySelect(!1)}render(){var o;const{countryLandedCost:t,selectedCountryCode:d}=n,c=(null==t?void 0:t.dutyDeminimus)?i(t.dutyDeminimus):null,m="CA"===n.selectedCountryCode?i(40):c,g=m?`${l("Spend")} ${m} ${l("duty free")}`:l("Duties will apply to all orders"),f=(null==t?void 0:t.vatTaxDeminimus)?i(t.vatTaxDeminimus):null,u="CA"===n.selectedCountryCode?i(150):f,p=u?`${l("Spend")} ${u} ${l("tax free")}`:l("Taxes will apply to all orders"),b=this.animateFromLeftOverride||this.dialogRef&&h(this.dialogRef),w=this.dialogRef&&(()=>{const o=this.dialogRef.getBoundingClientRect();return o.top>=window.innerHeight-o.bottom})(),{customMessages:z}=n,v=`${l("Welcome to")} ${a.organizationName}!`,C=(null===(o=z.find((o=>"hello_default"===o.pageName)))||void 0===o?void 0:o.message)||l("Know about duties and taxes before you buy. Shop with confidence!"),x=this.getCurrentPageEnum(),k=z.filter((o=>o.pageName===x));return e(s,{class:"zonos--elements"},e("div",{"aria-hidden":"true",class:r(["zonos--hello-dialog",b&&"zonos--hello-dialog-animate-from-left",w&&"zonos--hello-dialog-animate-from-bottom",!!this.mobileLocationOverride&&"zonos--hello-dialog-mobile-override",this.isOpen&&"zonos--hello-dialog-open"]),ref:o=>o&&(this.dialogRef=o)},e("div",{class:"zonos--hello-dialog-content"},e("zonos-button",{class:"zonos--close-button",icon:e("zonos-icon",{content:'<svg xmlns="https://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path fill="#C5C6CA" fill-rule="evenodd" d="M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Z" clip-rule="evenodd"/><path fill="#4D505A" fill-rule="evenodd" d="M8.293 8.293a1 1 0 0 1 1.414 0L12 10.586l2.293-2.293a1 1 0 1 1 1.414 1.414L13.414 12l2.293 2.293a1 1 0 0 1-1.414 1.414L12 13.414l-2.293 2.293a1 1 0 0 1-1.414-1.414L10.586 12 8.293 9.707a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"/></svg>'}),noBackground:!0,onClick:()=>this.setIsOpen(!1)}),e("div",null,this.showCountrySelect?e("zonos-country-select",{closeCountrySelect:()=>this.setShowCountrySelect(!1)}):e("zonos-v-stack",{spacing:24},e("zonos-country-flag",{class:"zonos--hello-country-flag",countryCode:d}),e("zonos-v-stack",{class:"zonos--hello-dialog-header",spacing:4},e("zonos-text",{type:"boldSubheader"},v),e("zonos-text",{color:"gray-800"},C)),e("zonos-v-stack",{spacing:8},this.restrictedItems.map((o=>{var t;return o&&e("zonos-banner",{bannerTitle:o.name,intent:"error"},null===(t=o.itemRestrictions)||void 0===t?void 0:t.map((o=>e("zonos-text",{color:"red-800"},null==o?void 0:o.note))))})),e("zonos-card",{spacing:"12px"},e("zonos-v-stack",{spacing:12},e("div",{class:"zonos--flex-message"},e("zonos-icon",{content:'<svg width="21" height="20" viewBox="0 0 21 20" fill="none" xmlns="https://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M9.66666 4.16667C9.20642 4.16667 8.83333 4.53976 8.83333 5V5.83333H12.1667V5C12.1667 4.53976 11.7936 4.16667 11.3333 4.16667H9.66666ZM13.8333 5.83333V5C13.8333 3.61929 12.714 2.5 11.3333 2.5H9.66666C8.28595 2.5 7.16666 3.61929 7.16666 5V5.83333H6.77759C5.44832 5.83333 4.35149 6.87354 4.2811 8.20094L3.92756 14.8676C3.85169 16.2983 4.99133 17.5 6.42405 17.5H14.5759C16.0087 17.5 17.1483 16.2983 17.0724 14.8676L16.7189 8.20094C16.6485 6.87354 15.5517 5.83333 14.2224 5.83333H13.8333ZM12.1667 7.5V8.33333C12.1667 8.79357 12.5398 9.16667 13 9.16667C13.4602 9.16667 13.8333 8.79357 13.8333 8.33333V7.5H14.2224C14.6655 7.5 15.0311 7.84674 15.0546 8.2892L15.4081 14.9559C15.4334 15.4328 15.0535 15.8333 14.5759 15.8333H6.42405C5.94648 15.8333 5.5666 15.4328 5.59189 14.9559L5.94542 8.2892C5.96889 7.84674 6.3345 7.5 6.77759 7.5H7.16666V8.33333C7.16666 8.79357 7.53976 9.16667 7.99999 9.16667C8.46023 9.16667 8.83333 8.79357 8.83333 8.33333V7.5H12.1667Z" fill="#4D505A"/>\n</svg>\n'}),e("zonos-text",null,g)),e("div",{class:"zonos--flex-message"},e("zonos-icon",{content:'<svg width="21" height="20" viewBox="0 0 21 20" fill="none" xmlns="https://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M2.16666 5.83301C2.16666 4.4523 3.28594 3.33301 4.66666 3.33301H16.3333C17.714 3.33301 18.8333 4.4523 18.8333 5.83301V14.1663C18.8333 15.5471 17.714 16.6663 16.3333 16.6663H4.66666C3.28594 16.6663 2.16666 15.5471 2.16666 14.1663V5.83301ZM4.66666 4.99967C4.20642 4.99967 3.83332 5.37277 3.83332 5.83301V14.1663C3.83332 14.6266 4.20642 14.9997 4.66666 14.9997H16.3333C16.7936 14.9997 17.1667 14.6266 17.1667 14.1663V5.83301C17.1667 5.37277 16.7936 4.99967 16.3333 4.99967H4.66666ZM6.33332 8.33301C6.79356 8.33301 7.16666 8.7061 7.16666 9.16634V10.833C7.16666 11.2932 6.79356 11.6663 6.33332 11.6663C5.87309 11.6663 5.49999 11.2932 5.49999 10.833V9.16634C5.49999 8.7061 5.87309 8.33301 6.33332 8.33301ZM8.83332 9.99967C8.83332 9.0792 9.57952 8.33301 10.5 8.33301C11.4205 8.33301 12.1667 9.0792 12.1667 9.99967C12.1667 10.9201 11.4205 11.6663 10.5 11.6663C9.57952 11.6663 8.83332 10.9201 8.83332 9.99967ZM14.6667 8.33301C15.1269 8.33301 15.5 8.7061 15.5 9.16634V10.833C15.5 11.2932 15.1269 11.6663 14.6667 11.6663C14.2064 11.6663 13.8333 11.2932 13.8333 10.833V9.16634C13.8333 8.7061 14.2064 8.33301 14.6667 8.33301Z" fill="#4D505A"/>\n</svg>\n'}),e("zonos-text",null,p)))),k.map((o=>e("zonos-custom-message",{icon:'<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="https://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M2.25 4.5C2.25 3.25736 3.25736 2.25 4.5 2.25H13.5C14.7426 2.25 15.75 3.25736 15.75 4.5V10.5C15.75 11.7426 14.7426 12.75 13.5 12.75H8.25C8.01393 12.75 7.79164 12.8611 7.65 13.05L6.3 14.85C5.87508 15.4166 5.2082 15.75 4.5 15.75C3.25736 15.75 2.25 14.7426 2.25 13.5V4.5ZM4.5 3.75C4.08579 3.75 3.75 4.08579 3.75 4.5V13.5C3.75 13.9142 4.08579 14.25 4.5 14.25C4.73607 14.25 4.95836 14.1389 5.1 13.95L6.45 12.15C6.87492 11.5834 7.5418 11.25 8.25 11.25H13.5C13.9142 11.25 14.25 10.9142 14.25 10.5V4.5C14.25 4.08579 13.9142 3.75 13.5 3.75H4.5ZM5.25 6C5.25 5.58579 5.58579 5.25 6 5.25H12C12.4142 5.25 12.75 5.58579 12.75 6C12.75 6.41421 12.4142 6.75 12 6.75H6C5.58579 6.75 5.25 6.41421 5.25 6ZM5.25 9C5.25 8.58579 5.58579 8.25 6 8.25H8.25C8.66421 8.25 9 8.58579 9 9C9 9.41421 8.66421 9.75 8.25 9.75H6C5.58579 9.75 5.25 9.41421 5.25 9Z" fill="#4D505A"/>\n</svg>\n',message:o.message}))))))),!this.showCountrySelect&&e("zonos-hello-dialog-footer",{appearanceSettings:this.appearanceSettings,setShowCountrySelect:o=>this.setShowCountrySelect(o)})))}static get assetsDirs(){return["assets"]}static get watchers(){return{isOpen:["isOpenHandler"]}}};d.style=":host{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--font-family, Inter), Inter}: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--hello-country-flag{height:18px;width:18px;position:relative;overflow:hidden;border-radius:30px;-webkit-box-shadow:var(--amino-v3-shadow-medium);box-shadow:var(--amino-v3-shadow-medium);z-index:10;justify-self:center}:host .zonos--hello-dialog{position:absolute;background:var(--amino-surface-color);width:100vw;max-width:430px;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;max-height:600px;border-radius:var(--amino-radius-12);outline:none;-webkit-box-shadow:var(--amino-v3-shadow-xxl);box-shadow:var(--amino-v3-shadow-xxl);overflow-y:auto;top:-2px;right:-2px;opacity:0;-webkit-transition:opacity 0.3s ease-in-out, -webkit-transform 0.3s ease-in-out;transition:opacity 0.3s ease-in-out, -webkit-transform 0.3s ease-in-out;transition:opacity 0.3s ease-in-out, transform 0.3s ease-in-out;transition:opacity 0.3s ease-in-out, transform 0.3s ease-in-out, -webkit-transform 0.3s ease-in-out;-webkit-transform:scale(0);transform:scale(0);-webkit-transform-origin:top right;transform-origin:top right;z-index:1001}:host .zonos--hello-dialog .zonos--hello-dialog-header{text-align:center}:host .zonos--hello-dialog.zonos--hello-dialog-animate-from-left{-webkit-transform-origin:top left;transform-origin:top left;right:unset;left:-2px}:host .zonos--hello-dialog.zonos--hello-dialog-animate-from-bottom{-webkit-transform-origin:bottom right;transform-origin:bottom right;bottom:calc(100% - 32px);top:unset}:host .zonos--hello-dialog.zonos--hello-dialog-animate-from-bottom.zonos--hello-dialog-animate-from-left{-webkit-transform-origin:bottom left;transform-origin:bottom left}:host .zonos--hello-dialog::-webkit-scrollbar{width:12px;height:12px}:host .zonos--hello-dialog::-webkit-scrollbar-track{background:#f5f5f5;border-top-right-radius:var(--amino-radius-12);border-bottom-right-radius:var(--amino-radius-12)}:host .zonos--hello-dialog::-webkit-scrollbar-thumb{border-radius:10px;background:#ccc;border:4px solid transparent;background-clip:content-box}:host .zonos--hello-dialog::-webkit-scrollbar-thumb:hover{background:#999}:host .zonos--hello-dialog .zonos--animate-content{opacity:0;height:0;-webkit-transition:all 0.3s ease-in-out;transition:all 0.3s ease-in-out}:host .zonos--hello-dialog .zonos--show-animate-content{opacity:1;height:100%}:host .zonos--hello-dialog.zonos--hello-dialog-open{opacity:1;-webkit-transform:scale(1);transform:scale(1)}:host .zonos--hello-dialog .zonos--close-button{position:absolute;right:var(--amino-space-8);top:var(--amino-space-8);width:var(--amino-size-md);height:var(--amino-size-md);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;cursor:pointer;z-index:10}:host .zonos--hello-dialog .zonos--close-button:hover{background:var(--amino-hover-color);border-radius:var(--amino-radius-6)}:host .zonos--hello-dialog .zonos--hello-dialog-content{padding:var(--amino-space-16)}:host .zonos--hello-dialog .zonos--hello-dialog-content .zonos--hello-country-flag{border-radius:var(--amino-radius-4);width:32px;height:24px}:host .zonos--hello-dialog .zonos--flex-message{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;gap:var(--amino-space-12)}:host .zonos--hello-dialog.zonos--hello-dialog-mobile-override{position:-webkit-sticky;position:sticky;top:unset;left:unset;right:unset;bottom:0;width:100vw;max-width:100vw;max-height:unset;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;-webkit-transform:scaleY(0);transform:scaleY(0);border-radius:0;-webkit-transform-origin:bottom;transform-origin:bottom}:host .zonos--hello-dialog.zonos--hello-dialog-mobile-override.zonos--hello-dialog-animate-from-left{-webkit-transform-origin:bottom;transform-origin:bottom}:host .zonos--hello-dialog.zonos--hello-dialog-mobile-override.zonos--hello-dialog-open{opacity:1;-webkit-transform:scaleY(1);transform:scaleY(1)}@media (max-width: 768px){:host .zonos--hello-dialog{position:-webkit-sticky;position:sticky;top:unset;left:unset;right:unset;bottom:0;width:100vw;max-width:100vw;max-height:unset;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;-webkit-transform:scaleY(0);transform:scaleY(0);border-radius:0;-webkit-transform-origin:bottom;transform-origin:bottom}:host .zonos--hello-dialog.zonos--hello-dialog-animate-from-left{-webkit-transform-origin:bottom;transform-origin:bottom}:host .zonos--hello-dialog.zonos--hello-dialog-open{opacity:1;-webkit-transform:scaleY(1);transform:scaleY(1)}}";export{d as zonos_hello_dialog}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
System.register(["./p-18904b7c.system.js"],(function(e,o){"use strict";var t,i;return{setters:[function(o){t=o.p;i=o.b;e("setNonce",o.s)}],execute:function(){var e=function(){var e=o.meta.url;var i={};if(e!==""){i.resourcesUrl=new URL(".",e).href}return t(i)};e().then((function(e){return i([["p-f367f2fe.system",[[1,"zonos-text",{class:[1],color:[1],size:[1],type:[1],weight:[2],content:[1],ready:[32]}]]],["p-
|
|
1
|
+
System.register(["./p-18904b7c.system.js"],(function(e,o){"use strict";var t,i;return{setters:[function(o){t=o.p;i=o.b;e("setNonce",o.s)}],execute:function(){var e=function(){var e=o.meta.url;var i={};if(e!==""){i.resourcesUrl=new URL(".",e).href}return t(i)};e().then((function(e){return i([["p-f367f2fe.system",[[1,"zonos-text",{class:[1],color:[1],size:[1],type:[1],weight:[2],content:[1],ready:[32]}]]],["p-510d3aa3.system",[[2,"zonos-checkout",{appearanceSettingsOverride:[16],preview:[4],mobile:[4],defaultAddress:[16],forceDialogOpen:[4,"force-dialog-open"],open:[32],stripe:[32],submitLoading:[32],paymentError:[32],collapseReviewMobile:[32],isAttachError:[32],isMobile:[32],zonosReviewRef:[32],storybookPaymentStatusOverride:[32],closeDialogHandler:[64],init:[64],setToFinishStep:[64]},[[16,"zonos--init-cart-info","initCartInfoHandler"],[9,"resize","handleWindowResize"]],{appearanceSettingsOverride:["appearanceSettingsOverrideChanged"],mobile:["handleMobileChange"]}]]],["p-6aa44c88.system",[[1,"zonos-hello",{mobileLocationOverride:[1,"mobile-location-override"],animateFromLeftOverride:[4,"animate-from-left-override"],appearanceSettingsOverride:[16],showPeekMessage:[32],zonosStoreHelloSettings:[32],showDialog:[32],peekMessage:[32],initialUrl:[32],allRestrictedItems:[32],allFoundProducts:[32],productsOnPage:[32],displayCurrency:[64],convertAndFormat:[64],convert:[64],format:[64]},[[9,"resize","handleResize"]]]]],["p-8e4794fe.system",[[1,"zonos-controller",{config:[16],zonosApiKey:[1,"zonos-api-key"],initCheckoutElement:[64],setupGoogleFont:[64],showNotification:[64],overrideConfig:[64],overrideCountry:[64],getAppearanceSetting:[64],updateOrganizationName:[64]}]]],["p-67154df2.system",[[1,"zonos-component",{first:[1],middle:[1],last:[1]}]]],["p-e06711b8.system",[[1,"zonos-country-select",{closeCountrySelect:[16],inputValue:[32]}],[1,"zonos-hello-dialog-footer",{appearanceSettings:[16],setShowCountrySelect:[16]}],[1,"zonos-custom-message",{icon:[1],message:[1]}],[1,"zonos-country-flag",{class:[1],countryCode:[1,"country-code"],size:[2]}]]],["p-7fdc8b27.system",[[1,"zonos-hello-dialog",{isOpen:[4,"is-open"],setIsOpen:[16],mobileLocationOverride:[1,"mobile-location-override"],animateFromLeftOverride:[4,"animate-from-left-override"],appearanceSettings:[16],restrictedItems:[16],welcomeMessage:[32],showCountrySelect:[32]},[[4,"click","globalClickHandler"]],{isOpen:["isOpenHandler"]}]]],["p-d856a200.system",[[1,"zonos-notification",{class:[1],notificationArray:[32],showNotification:[64]}]]],["p-2f43da39.system",[[1,"zonos-badge",{bold:[4],color:[1],icon:[16],iconRight:[4,"icon-right"],size:[1],rounded:[4],class:[1]}]]],["p-5554ff33.system",[[2,"zonos-payment",{titleText:[1,"title-text"],stripe:[32],stripeElements:[32]},null,{stripeElements:["watchInitStripe"],stripe:["watchInitStripe"]}]]],["p-e98be2d0.system",[[1,"zonos-shipping-rich-radio",{items:[16],borderColor:[1,"border-color"],borderStyle:[1,"border-style"],theme:[1],selectedItem:[32]}]]],["p-65749745.system",[[2,"zonos-address",{type:[1],titleText:[1,"title-text"],defaultAddress:[16],stripe:[32]},null,{stripe:["watchInitStripe"]}],[2,"zonos-link-authentication",{titleText:[1,"title-text"],stripe:[32]},null,{stripe:["watchInitStripe"]}]]],["p-c9348bb0.system",[[1,"zonos-banner",{bannerTitle:[1,"banner-title"],intent:[1],class:[1],hasContent:[32]}]]],["p-560aa686.system",[[1,"zonos-card",{actions:[16],class:[1],footerActions:[16],footerContent:[16],footerHeight:[2,"footer-height"],label:[16],spacing:[1]}],[1,"zonos-v-stack",{spacing:[2],class:[1]}]]],["p-e5ae22a9.system",[[1,"zonos-icon",{autoHeight:[4,"auto-height"],color:[1],content:[1],size:[2]}]]],["p-47390db7.system",[[1,"zonos-button",{class:[1],color:[1],backgroundColor:[1,"background-color"],borderStyle:[1,"border-style"],isDisabled:[4,"is-disabled"],icon:[16],iconRight:[4,"icon-right"],size:[1],variant:[1],noBackground:[4,"no-background"],noPaddingLeft:[4,"no-padding-left"],noPaddingRight:[4,"no-padding-right"],loading:[4],theme:[1],hasIcon:[32],hasContent:[32]},[[2,"click","clickHandler"]],{icon:["iconChangeHandler"]}],[1,"zonos-spinner",{size:[2],color:[1]}]]],["p-e100f180.system",[[2,"zonos-checkout-payment",{paymentError:[4,"payment-error"],submitBtnType:[1,"submit-btn-type"],continueLoading:[4,"continue-loading"],submitBtnColor:[1,"submit-btn-color"],disabled:[32]},null,{disabled:["watchFormComplete"]}],[2,"zonos-customer-info",{continueLoading:[4,"continue-loading"],submitBtnType:[1,"submit-btn-type"],submitBtnColor:[1,"submit-btn-color"],defaultAddress:[16],disabled:[32]},null,{disabled:["watchFormComplete"]}],[2,"zonos-shipping",{continueLoading:[4,"continue-loading"],submitBtnColor:[1,"submit-btn-color"],submitBtnType:[1,"submit-btn-type"],selectedShippingMethod:[32],disabled:[32]},null,{disabled:["watchFormComplete"]}],[1,"zonos-checkout-finish",{borderRadius:[1,"border-radius"],storybookForceStatus:[1,"storybook-force-status"],overrideNotification:[16],isLoading:[32],notificationType:[32],notificationTitle:[32],notificationMessages:[32],order:[32]}],[1,"zonos-cart-subtotal"],[1,"zonos-dialog",{open:[4],headerText:[1,"header-text"],width:[1],height:[1],noHeader:[4,"no-header"],noBodyPadding:[4,"no-body-padding"],noBorder:[4,"no-border"],footerRightAction:[16],borderStyle:[1,"border-style"],noCloseButton:[4,"no-close-button"],noClickOutside:[4,"no-click-outside"],mobile:[4],isLoading:[4,"is-loading"],isMobile:[32]},[[9,"resize","handleWindowResize"]]],[1,"zonos-review",{mobile:[4],collapsed:[4],isMobile:[32]},[[9,"resize","handleWindowResize"]]],[1,"zonos-cart-items",{errorImages:[32]}],[1,"zonos-collapse",{collapsed:[4],collapseSize:[2,"collapse-size"],height:[32]}],[1,"zonos-logo",{theme:[1],width:[1],class:[1]}]]]],e)}))}}}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as o,a as s,h as t,H as n,F as i,c as e,d as a}from"./p-956efa27.js";import{c as r,s as c,p as h,o as l,i as d,b as p}from"./p-4846796a.js";import{t as m,h as u,b as z}from"./p-3c6988d7.js";import{g}from"./p-ff95f098.js";import{s as f,i as y}from"./p-1685c8df.js";import{e as b,z as v}from"./p-089ba905.js";import{c as x}from"./p-b4b7f705.js";import"./p-55f49f1e.js";const w=({amount:o,currency:s,showCurrencyText:t})=>t?`${new Intl.NumberFormat("en-US",{currency:s,style:"currency"}).format(o)} ${s}`:new Intl.NumberFormat("en-US",{currency:s,style:"currency"}).format(o),k=class{constructor(s){o(this,s),this.errorImages=[]}render(){var o;const i=s("./assets/empty-item.jpeg"),e=(null===(o=r.exchangeRate)||void 0===o?void 0:o.rate)||1;return t(n,{class:"zonos--cart-items zonos--elements"},t("table",{class:"zonos--cart-table"},t("tbody",null,r.items.map((o=>{const s=o.imageUrl;return t("tr",{class:"zonos--cart-item"},t("td",{class:"zonos--column zonos--cart-item-image"},s&&!this.errorImages.includes(s)?t("img",{alt:o.name,onError:()=>{this.errorImages=[...this.errorImages,s]},src:o.imageUrl,style:{"min-width":"40px"},width:40}):t("img",{alt:o.name,src:i,width:40})),t("td",{class:"zonos--column zonos--cart-item-name"},t("zonos-text",{type:"label"},o.name)),t("td",{class:"zonos--column zonos--cart-item-price"},t("zonos-text",{type:"semiBoldLabel"},w({amount:o.amount*o.quantity*e,currency:r.currency}))))})))))}static get assetsDirs(){return["assets"]}};k.style=":host{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--font-family, Inter), Inter}: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-8);font-size:var(--amino-font-size-base)}:host .zonos--cart-table .zonos--column:last-child{text-align:right}:host .zonos--cart-table .zonos--column:first-child{width:60px}:host img{min-width:40px}";const C=class{constructor(s){o(this,s)}render(){const o=r.total-r.dutiesTaxFees,s="payment"===r.step||"shipping"===r.step;return t(n,{class:"zonos--cart-subtotal zonos--elements"},t("table",{class:"zonos--cart-table"},t("tr",{class:"zonos--row zonos--cart-subtotal"},t("td",{class:"zonos--column"}),t("td",{class:"zonos--column zonos--cart-subtotal-title"},t("zonos-text",{type:"semiBoldLabel"},m("Cart subtotal"))),t("td",{class:"zonos--column zonos--cart-subtotal-price"},t("zonos-text",{type:"semiBoldLabel"},w({amount:r.subtotal,currency:r.currency})))),t("tr",{class:"zonos--row zonos--cart-shipping"},t("td",{class:"zonos--column"}),t("td",{class:"zonos--column zonos--cart-subtotal-title"},r.selectedShippingOption?t(i,null,t("zonos-text",{class:"zonos--title",type:"semiBoldLabel"},r.selectedShippingOption.displayName),r.selectedShippingOptionTransitTime&&t("zonos-text",{class:"zonos--caption",type:"caption"},r.selectedShippingOptionTransitTime," ",m("business days"))):t(i,null,t("zonos-text",{class:"zonos--title",type:"semiBoldLabel"},m("Shipping")),t("zonos-text",{class:"zonos--caption",type:"caption"},m("No shipping method selected")))),t("td",{class:"zonos--column zonos--cart-subtotal-price"},r.shipping?w({amount:r.shipping,currency:r.currency}):"-")),s&&t("tr",{class:"zonos--row zonos--cart-duties"},t("td",{class:"zonos--column"}),t("td",{class:"zonos--column zonos--cart-subtotal-title"},t("div",{class:"zonos--title-with-icon"},t("zonos-text",{class:"zonos--title",type:"semiBoldLabel"},m("Duties, taxes, and fees")),t("zonos-icon",{content:'<svg viewBox="0 0 17 16" fill="none" xmlns="https://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M1.96704 8.00065C1.96704 4.31875 4.93024 1.33398 8.58554 1.33398C12.2408 1.33398 15.204 4.31875 15.204 8.00065C15.204 11.6826 12.2408 14.6673 8.58554 14.6673C4.93024 14.6673 1.96704 11.6825 1.96704 8.00065Z" fill="#C5C6CA"/>\n<path fill-rule="evenodd" clip-rule="evenodd" d="M8.58543 4.66016C8.95096 4.66016 9.24728 4.95863 9.24728 5.32682V5.33349C9.24728 5.70168 8.95096 6.00016 8.58543 6.00016C8.2199 6.00016 7.92358 5.70168 7.92358 5.33349V5.32682C7.92358 4.95863 8.2199 4.66016 8.58543 4.66016ZM8.58543 7.33349C8.95096 7.33349 9.24728 7.63197 9.24728 8.00016V10.6668C9.24728 11.035 8.95096 11.3335 8.58543 11.3335C8.2199 11.3335 7.92358 11.035 7.92358 10.6668V8.00016C7.92358 7.63197 8.2199 7.33349 8.58543 7.33349Z" fill="#4D505A"/>\n</svg>\n',size:16})),!!r.isSelectedShippingAboveDeminimis&&t("zonos-text",{color:"gray-800",type:"body"},m("Order is over the de minimis threshold for both duty and tax"))),t("td",{class:"zonos--column zonos--cart-subtotal-price"},t("div",{class:"zonos--cart-duty-tax-price"},r.dutiesTaxFees?w({amount:r.dutiesTaxFees,currency:r.currency}):"-",r.isSelectedShippingGuarantee&&t("zonos-badge",null,m("Guaranteed"))))),t("tr",{class:"zonos--row zonos--cart-pay-total"},t("td",{class:"zonos--column"}),t("td",{class:"zonos--column"},t("zonos-text",{class:"zonos--title",type:"semiBoldLabel"},m("Order total"))),t("td",{class:"zonos--column"},t("zonos-text",{type:"semiBoldLabel"},w({amount:"shipping"===r.step?o:r.total,currency:r.currency}))))))}static get assetsDirs(){return["assets"]}};C.style=":host{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--font-family, Inter), Inter}: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}";const I=class{constructor(s){o(this,s),this.closeClick=e(this,"closeClick",7),this.pullOrder=async()=>{var o,s;const t="https://v1.route.js.zonos.com",n=r.checkoutSessionId,{errors:i,json:e}=await u(`${t}/api/zonos-elements/get-order?checkoutSessionId=${n}`);if(i.length||!(null==e?void 0:e.id))return null;if(window.Zonos.isBigCommerce){const n=null==e?void 0:e.id,i=null===(s=null===(o=null==e?void 0:e.metadata)||void 0===o?void 0:o.find((o=>"storeHash"===(null==o?void 0:o.key))))||void 0===s?void 0:s.value;if(!n||!i)return z("Unable to trigger BigCommerce /success: Missing orderId or storeHash");u(`${t}/api/bigcommerce/success?orderId=${n}&storeHash=${i}`)}return e},this.getPullOrder=async(o=0)=>{const s=await this.pullOrder();s?this.order=s:!s&&o<5&&(await new Promise((o=>setTimeout(o,1e3))),await this.getPullOrder(o+1))},this.checkPaymentStatus=async()=>{this.isLoading=!0;const o=new URLSearchParams(window.location.search).get("payment_intent_client_secret")||c.clientSecret;if(o||this.storybookForceStatus){const{error:s,messages:t}=await h({clientSecret:o,storybookForceStatus:this.storybookForceStatus});if(this.notificationType=s?"error":"success",this.notificationMessages=t||[],this.notificationTitle=m(s?"Payment failed":"You're all set!"),s)f("zonos-checkout-payment-fail");else{f("zonos-checkout-success");const o=new CustomEvent("zonos-checkout-success",{detail:{message:"Zonos Checkout successfully processed order"}});document.dispatchEvent(o)}"success"===this.notificationType&&this.getPullOrder()}l(),this.isLoading=!1},this.closeClickHandler=()=>{this.closeClick.emit()},this.borderRadius="ROUNDED",this.storybookForceStatus=void 0,this.overrideNotification=void 0,this.isLoading=!0,this.notificationType="success",this.notificationTitle="",this.notificationMessages=[],this.order=null}componentDidLoad(){if(this.overrideNotification)return this.notificationType=this.overrideNotification.type,this.notificationTitle=this.overrideNotification.title,this.notificationMessages=this.overrideNotification.messages,void(this.isLoading=!1);this.checkPaymentStatus()}render(){return t(n,{class:"zonos--checkout-finish zonos--elements",style:{"--border-radius":g(this.borderRadius)}},this.isLoading&&t("div",{class:"loading-wrapper"},t("zonos-spinner",null)),!this.isLoading&&t(i,null,t("div",{class:"zonos--group"},t("zonos-icon","success"===this.notificationType?{color:"blue-800",content:'<svg color="var(--amino-blue-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="https://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M2 12C2 6.477 6.477 2 12 2s10 4.477 10 10-4.477 10-10 10S2 17.523 2 12Z" data-is-secondary-color="true" fill="var(--amino-blue-100)" fill-rule="evenodd"></path><path clip-rule="evenodd" d="M15.707 9.293a1 1 0 0 1 0 1.414l-3.646 3.647a1.5 1.5 0 0 1-2.122 0l-1.646-1.647a1 1 0 1 1 1.414-1.414L11 12.586l3.293-3.293a1 1 0 0 1 1.414 0Z" fill="currentColor" fill-rule="evenodd"></path></svg>',size:50}:{color:"red-800",content:'<svg color="var(--amino-red-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="https://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Z" data-is-secondary-color="true" fill="var(--amino-red-200)" fill-rule="evenodd"></path><path clip-rule="evenodd" d="M8.293 8.293a1 1 0 0 1 1.414 0L12 10.586l2.293-2.293a1 1 0 1 1 1.414 1.414L13.414 12l2.293 2.293a1 1 0 0 1-1.414 1.414L12 13.414l-2.293 2.293a1 1 0 0 1-1.414-1.414L10.586 12 8.293 9.707a1 1 0 0 1 0-1.414Z" fill="currentColor" fill-rule="evenodd"></path></svg>',size:50}),t("zonos-text",{class:"zonos--title",type:"semiBoldSubheader"},this.notificationTitle),t("zonos-text",null,this.notificationMessages.map((o=>t(i,null,o,t("br",null))))),t("zonos-button",{onClick:()=>this.closeClickHandler(),size:"md",variant:"primary"},m("Keep shopping")))))}static get assetsDirs(){return["assets"]}};I.style=":host{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--font-family, Inter), Inter}: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 .zonos--group{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;margin-bottom:var(--amino-space-24);border-radius:var(--border-radius, 10px);gap:var(--amino-space-24);max-width:360px;width:auto;margin:auto;margin-top:var(--amino-space-24);background-color:var(--amino-gray-50);padding:var(--amino-space-20)}:host zonos-button{width:100%}:host .loading-wrapper{min-height:300px;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center}";const L=class{constructor(s){o(this,s),this.continueClicked=e(this,"continueClicked",7),this.continueClickHandler=()=>{this.continueClicked.emit()},this.paymentError=!1,this.submitBtnType=void 0,this.continueLoading=!1,this.submitBtnColor=void 0,this.disabled=!0}watchFormComplete(){this.disabled||f("zonos-checkout-payment-info")}render(){var o;return c.stripeElements?(this.disabled=!(null===(o=c.stripePaymentEventData)||void 0===o?void 0:o.complete),t(n,{class:"zonos--checkout-payment zonos--elements"},t("div",{class:"zonos--group"},t("zonos-text",{class:"zonos--title",type:"semiBoldSubheader"},m("Payment method")),this.paymentError&&t("zonos-banner",{class:"zonos--payment-error-banner",intent:"error"},m("We couldn't complete your payment. Please verify the payment details and try again.")),t("zonos-payment",null)),t("div",{class:"zonos--group-btn"},t("zonos-button",{backgroundColor:this.submitBtnColor,"is-disabled":this.disabled,loading:this.continueLoading,onClick:()=>this.continueClickHandler(),size:"lg",variant:this.submitBtnType},"Pay"," ",w({amount:r.total,currency:r.currency}))))):null}static get watchers(){return{disabled:["watchFormComplete"]}}};L.style=".sc-zonos-checkout-payment-h{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-checkout-payment-h *.sc-zonos-checkout-payment{font-family:var(--font-family, Inter), Inter}.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)}";const j=class{constructor(s){o(this,s),this.collapsed=!1,this.collapseSize=0,this.height=this.el.scrollHeight}getElementHeight(){return this.collapsed?`${this.collapseSize}px`:`${this.height}px`}componentDidLoad(){this.height=this.el.scrollHeight}componentDidRender(){var o,s,t;null===(t=null===(s=null===(o=this.el.shadowRoot)||void 0===o?void 0:o.querySelector("iframe"))||void 0===s?void 0:s.contentWindow)||void 0===t||t.addEventListener("resize",(()=>{this.height=this.el.scrollHeight}))}render(){return this.height=this.el.scrollHeight,t(n,{class:"zonos--elements zonos--collapse",style:{"--font-family":b(),height:this.getElementHeight()}},t("div",null,t("iframe",{class:"height-change-listener",tabindex:"-1",title:"collapse-height-change-listener"}),t("slot",null)))}get el(){return a(this)}};j.style=":host{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--font-family, Inter), Inter}: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{-webkit-transition:all 0.3s ease-in-out;transition:all 0.3s ease-in-out;overflow:hidden}:host div{position:relative}:host iframe{width:0;height:100%;position:absolute;top:0;border:0}";const B=class{constructor(s){o(this,s),this.continueClicked=e(this,"continueClicked",7),this.continueClickHandler=()=>{this.continueClicked.emit()},this.continueLoading=!1,this.submitBtnType=void 0,this.submitBtnColor=void 0,this.defaultAddress=null,this.disabled=!0}watchFormComplete(){this.disabled||f("zonos-checkout-customer-info")}render(){var o,s;return c.stripeElements?(this.disabled=!(null===(o=c.stripeAddressEventData)||void 0===o?void 0:o.complete)||!(null===(s=c.stripeLinkEventData)||void 0===s?void 0:s.complete),t(n,{class:"zonos--customer-info zonos--elements"},t("div",{class:"zonos--group"},t("zonos-text",{class:"zonos--title",type:"semiBoldSubheader"},m("Customer information")),t("zonos-link-authentication",{titleText:m("Contact")}),t("zonos-address",{defaultAddress:this.defaultAddress,titleText:m("Address"),type:"shipping"})),t("div",{class:"zonos--group-btn"},t("zonos-button",{backgroundColor:this.submitBtnColor,isDisabled:this.disabled,loading:this.continueLoading,onClick:()=>this.continueClickHandler(),size:"lg",variant:this.submitBtnType},m("Continue to shipping"))))):null}static get watchers(){return{disabled:["watchFormComplete"]}}};B.style=".sc-zonos-customer-info-h{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-customer-info-h *.sc-zonos-customer-info{font-family:var(--font-family, Inter), Inter}.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)}";const D=class{constructor(s){o(this,s),this.closeDialog=e(this,"closeDialog",7),this.isMobileMode=()=>this.mobile||window.innerWidth<=768,this.closeButtonHandler=()=>{this.closeDialog.emit()},this.clickOutsideDialogHandler=o=>{o.target!==o.currentTarget||this.noClickOutside||this.closeDialog.emit()},this.open=!1,this.headerText="",this.width="460px",this.height=void 0,this.noHeader=!1,this.noBodyPadding=!1,this.noBorder=!1,this.footerRightAction=null,this.borderStyle=void 0,this.noCloseButton=!1,this.noClickOutside=!1,this.mobile=!1,this.isLoading=!0,this.isMobile=!1}handleWindowResize(){this.isMobile=this.isMobileMode()}componentDidLoad(){this.isMobile=this.isMobileMode()}render(){document.body.style.overflow=this.open?"hidden":"auto";const o=g(this.borderStyle);return t(n,{class:x(["zonos--elements",this.open&&"open",this.isLoading&&"is-loading",this.noBorder&&"no-border",this.isMobile&&"mobile"]),style:{"--border-radius":o,"--font-family":b(),"--height":this.height||"initial","--width":this.width}},t("div",{class:"zonos--backdrop"}),t("div",{"aria-hidden":"true",class:"zonos--dialog-layout",onClick:this.clickOutsideDialogHandler},t("div",{class:"zonos--dialog"},this.isLoading&&t("div",{class:"zonos--loading"},t("zonos-spinner",{size:30})),(this.headerText||!this.noCloseButton)&&t("div",{class:"zonos--header"},this.headerText&&t("h3",{class:"zonos--header-text"},this.headerText),!this.noCloseButton&&t("zonos-button",{class:"zonos--close-button",icon:t("zonos-icon",{content:'<svg xmlns="https://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path fill="#C5C6CA" fill-rule="evenodd" d="M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Z" clip-rule="evenodd"/><path fill="#4D505A" fill-rule="evenodd" d="M8.293 8.293a1 1 0 0 1 1.414 0L12 10.586l2.293-2.293a1 1 0 1 1 1.414 1.414L13.414 12l2.293 2.293a1 1 0 0 1-1.414 1.414L12 13.414l-2.293 2.293a1 1 0 0 1-1.414-1.414L10.586 12 8.293 9.707a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"/></svg>'}),noBackground:!0,onClick:this.closeButtonHandler})),t("div",{class:x(["zonos--body",this.noBodyPadding&&"zonos--no-body-padding"])},t("slot",null)),this.footerRightAction&&t("div",{class:"zonos--footer"},t("div",{class:"zonos--footer-right-action"},this.footerRightAction)))))}static get assetsDirs(){return["assets"]}};D.style=":host{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--font-family, Inter), Inter}: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--backdrop,:host .zonos--dialog-layout{opacity:0;z-index:-999;visibility:hidden;-webkit-transition:0.3s all ease;transition:0.3s all ease}:host .zonos--backdrop{width:100vw;height:100vh;left:0px;top:0px;background:var(--amino-backdrop-color);z-index:-999;opacity:0;visibility:hidden;position:fixed}:host .zonos--loading{position:absolute;left:0;right:0;bottom:0;top:0;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;z-index:1002;background:white}:host .zonos--dialog-layout{width:100vw;height:100vh;left:0;top:0;position:fixed;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;color:var(--amino-text-color);visibility:hidden}:host .zonos--dialog{position:relative;z-index:1001;background:var(--amino-gray-0);max-width:90vw;max-height:90vh;min-height:500px;height:var(--height, auto);width:var(--width, auto);border-radius:var(--border-radius, var(--amino-radius-10));outline:none;-webkit-box-shadow:var(--amino-v3-shadow-xxl);box-shadow:var(--amino-v3-shadow-xxl);border:var(--amino-border);overflow:hidden;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}:host .zonos--header{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;-ms-flex-pack:justify;justify-content:space-between;padding:var(--amino-space-16) var(--amino-space-24)}:host .zonos--header .-zonos-stencil-library--header-text{-ms-flex-positive:1;flex-grow:1}:host .zonos--header .zonos--close-button{width:var(--amino-size-md);height:var(--amino-size-md);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;cursor:pointer;border-radius:var(--amino-radius-10)}:host .zonos--header .zonos--close-button:hover{background:var(--amino-hover-color)}:host .zonos--body{padding:var(--amino-space-8) var(--amino-space-24);max-height:100%;height:100%;overflow:auto}:host .zonos--body.zonos--no-body-padding{padding:0}:host .zonos--footer{padding:var(--amino-space-16) var(--amino-space-24)}:host(.open) .zonos--dialog-layout,:host(.open) .zonos--backdrop{visibility:visible}:host(.open) .zonos--backdrop{z-index:1001;opacity:0.65}:host(.open) .zonos--dialog-layout{opacity:1;z-index:1002;-webkit-transform:scale(1);transform:scale(1)}:host(.no-border) .zonos--dialog{border:none}:host(.mobile) .zonos--dialog{max-width:100vw;max-height:100vh;height:100%;width:100%;border-radius:0;-webkit-box-shadow:none;box-shadow:none;border:none}";const S=class{constructor(s){o(this,s),this.theme="LIGHT",this.width="auto",this.class=""}render(){const o="DARK"===this.theme?"invert(100%) sepia(100%) saturate(0%) hue-rotate(288deg) brightness(102%) contrast(102%)":"whiteinvert(0%) sepia(100%) saturate(32%) hue-rotate(92deg) brightness(107%) contrast(107%)";return t(n,{class:x(["zonos--elements zonos--logo",this.class]),style:{"--filter-color":o,"--font-family":b(),"--width":this.width}},t("img",{alt:"Zonos Logo",src:s("./assets/ZonosLogo.png")}))}static get assetsDirs(){return["assets"]}};S.style=":host{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--font-family, Inter), Inter}: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 img{-webkit-filter:var(--filter-color);filter:var(--filter-color);width:var(--width)}";const _=class{constructor(s){o(this,s),this.mobile=!1,this.collapsed=!1,this.isMobile=!1}handleWindowResize(){this.isMobile=y(this.mobile)}componentWillLoad(){this.isMobile=y(this.mobile)}render(){const o=this.isMobile?"boldSubheader":"semiBoldLabel",s=this.isMobile?"boldSubheader":"secondaryPageHeader",i=this.isMobile?"gray-1200":"gray-800",e=r.total-r.dutiesTaxFees;return t(n,{class:x(["zonos--review zonos--elements",this.isMobile&&"mobile"])},t("div",{class:"zonos--title"},t("zonos-text",{color:i,type:o},m("Pay")," ",v.organizationName),(()=>this.isMobile?t("zonos-icon",this.collapsed?{color:"gray-1200",content:'<svg color="var(--amino-gray-400)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="https://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M17.707 14.707a1 1 0 0 1-1.414 0L12 10.414l-4.293 4.293a1 1 0 0 1-1.414-1.414l4.93-4.93a1.1 1.1 0 0 1 1.555 0l4.93 4.93a1 1 0 0 1 0 1.414Z" fill="currentColor" fill-rule="evenodd"></path></svg>'}:{color:"gray-1200",content:'<svg color="var(--amino-gray-400)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="https://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M6.293 9.293a1 1 0 0 1 1.414 0L12 13.586l4.293-4.293a1 1 0 0 1 1.414 1.414l-4.93 4.93a1.1 1.1 0 0 1-1.555 0l-4.93-4.93a1 1 0 0 1 0-1.414Z" fill="currentColor" fill-rule="evenodd"></path></svg>'}):null)()),t("div",{class:"zonos--total-pay"},t("zonos-text",{type:s},w({amount:"shipping"===r.step?e:r.total,currency:r.currency}))))}static get assetsDirs(){return["assets"]}};_.style=":host{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--font-family, Inter), Inter}: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--total-pay{margin:var(--amino-space-16) 0 var(--amino-space-32)}:host(.mobile){display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;gap:var(--amino-space-24);-ms-flex-pack:justify;justify-content:space-between;padding:var(--amino-space-4) 0;margin-bottom:var(--amino-space-8)}:host(.mobile) .zonos--title{display:-ms-flexbox;display:flex;-ms-flex-item-align:center;align-self:center;gap:var(--amino-space-8)}:host(.mobile) .zonos--total-pay{margin:0}";const Z=class{constructor(s){o(this,s),this.continueClicked=e(this,"continueClicked",7),this.handleRadioSelected=async o=>{var s;if(this.selectedShippingMethod=o.detail,!this.selectedShippingMethod)return;const t=(null===(s=r.shippingData)||void 0===s?void 0:s.find((o=>{var s;return o.id===(null===(s=this.selectedShippingMethod)||void 0===s?void 0:s.value)})))||null;t&&await d(t)&&(this.disabled=!1)},this.continueClickHandler=()=>{this.continueClicked.emit()},this.continueLoading=!1,this.submitBtnColor=void 0,this.submitBtnType=void 0,this.selectedShippingMethod=null,this.disabled=!0}watchFormComplete(){this.disabled||f("zonos-checkout-shipping-info")}render(){var o;const s=null===(o=r.shippingData)||void 0===o?void 0:o.flatMap((o=>{var s,t;const{expectedDate:n,maxTransit:i,minTransit:e}=p(o),a=n?`${m("Expected delivery")} ${n}`:"",c=e&&i?`(${e}-${i} ${m("business days")})`:"",h=(null===(t=null===(s=r.landedCostData)||void 0===s?void 0:s.find((s=>{var t;return(null===(t=s.landedCost)||void 0===t?void 0:t.shipmentRating.id)===o.id})))||void 0===t?void 0:t.subtotals.shipping)||0;return{caption:c,label:o.displayName,price:w({amount:h,currency:r.currency}),sublabel:a,value:o.id}}));return t(n,{class:"zonos--shipping zonos--elements"},t("div",{class:"zonos--group"},t("zonos-text",{class:"zonos--title",type:"semiBoldSubheader"},m("Shipping information")),t("zonos-text",{class:"zonos--shipping-method-title",type:"semiBoldLabel"},m("Shipping method")),(null==s?void 0:s.length)?t("zonos-shipping-rich-radio",{items:s||[],onRadioSelected:o=>this.handleRadioSelected(o)}):t("zonos-banner",{bannerTitle:"No shipping methods found - try editing your address or contacting support if the error persists",intent:"error"})),t("zonos-button",{backgroundColor:this.submitBtnColor,"is-disabled":this.disabled,loading:this.continueLoading,onClick:()=>this.continueClickHandler(),size:"lg",variant:this.submitBtnType},m("Go to payment")))}static get watchers(){return{disabled:["watchFormComplete"]}}};Z.style=".sc-zonos-shipping-h{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-shipping-h *.sc-zonos-shipping{font-family:var(--font-family, Inter), Inter}.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)}";export{k as zonos_cart_items,C as zonos_cart_subtotal,I as zonos_checkout_finish,L as zonos_checkout_payment,j as zonos_collapse,B as zonos_customer_info,D as zonos_dialog,S as zonos_logo,_ as zonos_review,Z as zonos_shipping}
|
|
1
|
+
import{r as o,a as s,h as t,H as n,F as i,c as e,d as a}from"./p-956efa27.js";import{c as r,s as c,p as h,o as l,i as d,b as p}from"./p-425996c1.js";import{t as m,h as u,b as z}from"./p-bbb154a9.js";import{g}from"./p-ff95f098.js";import{s as f,i as y}from"./p-e2c2584c.js";import{e as b,z as v}from"./p-089ba905.js";import{c as x}from"./p-b4b7f705.js";import"./p-55f49f1e.js";const w=({amount:o,currency:s,showCurrencyText:t})=>t?`${new Intl.NumberFormat("en-US",{currency:s,style:"currency"}).format(o)} ${s}`:new Intl.NumberFormat("en-US",{currency:s,style:"currency"}).format(o),k=class{constructor(s){o(this,s),this.errorImages=[]}render(){var o;const i=s("./assets/empty-item.jpeg"),e=(null===(o=r.exchangeRate)||void 0===o?void 0:o.rate)||1;return t(n,{class:"zonos--cart-items zonos--elements"},t("table",{class:"zonos--cart-table"},t("tbody",null,r.items.map((o=>{const s=o.imageUrl;return t("tr",{class:"zonos--cart-item"},t("td",{class:"zonos--column zonos--cart-item-image"},s&&!this.errorImages.includes(s)?t("img",{alt:o.name,onError:()=>{this.errorImages=[...this.errorImages,s]},src:o.imageUrl,style:{"min-width":"40px"},width:40}):t("img",{alt:o.name,src:i,width:40})),t("td",{class:"zonos--column zonos--cart-item-name"},t("zonos-text",{type:"label"},o.name)),t("td",{class:"zonos--column zonos--cart-item-price"},t("zonos-text",{type:"semiBoldLabel"},w({amount:o.amount*o.quantity*e,currency:r.currency}))))})))))}static get assetsDirs(){return["assets"]}};k.style=":host{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--font-family, Inter), Inter}: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-8);font-size:var(--amino-font-size-base)}:host .zonos--cart-table .zonos--column:last-child{text-align:right}:host .zonos--cart-table .zonos--column:first-child{width:60px}:host img{min-width:40px}";const C=class{constructor(s){o(this,s)}render(){const o=r.total-r.dutiesTaxFees,s="payment"===r.step||"shipping"===r.step;return t(n,{class:"zonos--cart-subtotal zonos--elements"},t("table",{class:"zonos--cart-table"},t("tr",{class:"zonos--row zonos--cart-subtotal"},t("td",{class:"zonos--column"}),t("td",{class:"zonos--column zonos--cart-subtotal-title"},t("zonos-text",{type:"semiBoldLabel"},m("Cart subtotal"))),t("td",{class:"zonos--column zonos--cart-subtotal-price"},t("zonos-text",{type:"semiBoldLabel"},w({amount:r.subtotal,currency:r.currency})))),t("tr",{class:"zonos--row zonos--cart-shipping"},t("td",{class:"zonos--column"}),t("td",{class:"zonos--column zonos--cart-subtotal-title"},r.selectedShippingOption?t(i,null,t("zonos-text",{class:"zonos--title",type:"semiBoldLabel"},r.selectedShippingOption.displayName),r.selectedShippingOptionTransitTime&&t("zonos-text",{class:"zonos--caption",type:"caption"},r.selectedShippingOptionTransitTime," ",m("business days"))):t(i,null,t("zonos-text",{class:"zonos--title",type:"semiBoldLabel"},m("Shipping")),t("zonos-text",{class:"zonos--caption",type:"caption"},m("No shipping method selected")))),t("td",{class:"zonos--column zonos--cart-subtotal-price"},r.shipping?w({amount:r.shipping,currency:r.currency}):"-")),s&&t("tr",{class:"zonos--row zonos--cart-duties"},t("td",{class:"zonos--column"}),t("td",{class:"zonos--column zonos--cart-subtotal-title"},t("div",{class:"zonos--title-with-icon"},t("zonos-text",{class:"zonos--title",type:"semiBoldLabel"},m("Duties, taxes, and fees")),t("zonos-icon",{content:'<svg viewBox="0 0 17 16" fill="none" xmlns="https://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M1.96704 8.00065C1.96704 4.31875 4.93024 1.33398 8.58554 1.33398C12.2408 1.33398 15.204 4.31875 15.204 8.00065C15.204 11.6826 12.2408 14.6673 8.58554 14.6673C4.93024 14.6673 1.96704 11.6825 1.96704 8.00065Z" fill="#C5C6CA"/>\n<path fill-rule="evenodd" clip-rule="evenodd" d="M8.58543 4.66016C8.95096 4.66016 9.24728 4.95863 9.24728 5.32682V5.33349C9.24728 5.70168 8.95096 6.00016 8.58543 6.00016C8.2199 6.00016 7.92358 5.70168 7.92358 5.33349V5.32682C7.92358 4.95863 8.2199 4.66016 8.58543 4.66016ZM8.58543 7.33349C8.95096 7.33349 9.24728 7.63197 9.24728 8.00016V10.6668C9.24728 11.035 8.95096 11.3335 8.58543 11.3335C8.2199 11.3335 7.92358 11.035 7.92358 10.6668V8.00016C7.92358 7.63197 8.2199 7.33349 8.58543 7.33349Z" fill="#4D505A"/>\n</svg>\n',size:16})),!!r.isSelectedShippingAboveDeminimis&&t("zonos-text",{color:"gray-800",type:"body"},m("Order is over the de minimis threshold for both duty and tax"))),t("td",{class:"zonos--column zonos--cart-subtotal-price"},t("div",{class:"zonos--cart-duty-tax-price"},r.dutiesTaxFees?w({amount:r.dutiesTaxFees,currency:r.currency}):"-",r.isSelectedShippingGuarantee&&t("zonos-badge",null,m("Guaranteed"))))),t("tr",{class:"zonos--row zonos--cart-pay-total"},t("td",{class:"zonos--column"}),t("td",{class:"zonos--column"},t("zonos-text",{class:"zonos--title",type:"semiBoldLabel"},m("Order total"))),t("td",{class:"zonos--column"},t("zonos-text",{type:"semiBoldLabel"},w({amount:"shipping"===r.step?o:r.total,currency:r.currency}))))))}static get assetsDirs(){return["assets"]}};C.style=":host{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--font-family, Inter), Inter}: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}";const I=class{constructor(s){o(this,s),this.closeClick=e(this,"closeClick",7),this.pullOrder=async()=>{var o,s;const t="https://v1.route.js.zonos.com",n=r.checkoutSessionId,{errors:i,json:e}=await u(`${t}/api/zonos-elements/get-order?checkoutSessionId=${n}`);if(i.length||!(null==e?void 0:e.id))return null;if(window.Zonos.isBigCommerce){const n=null==e?void 0:e.id,i=null===(s=null===(o=null==e?void 0:e.metadata)||void 0===o?void 0:o.find((o=>"storeHash"===(null==o?void 0:o.key))))||void 0===s?void 0:s.value;if(!n||!i)return z("Unable to trigger BigCommerce /success: Missing orderId or storeHash");u(`${t}/api/bigcommerce/success?orderId=${n}&storeHash=${i}`)}return e},this.getPullOrder=async(o=0)=>{const s=await this.pullOrder();s?this.order=s:!s&&o<5&&(await new Promise((o=>setTimeout(o,1e3))),await this.getPullOrder(o+1))},this.checkPaymentStatus=async()=>{this.isLoading=!0;const o=new URLSearchParams(window.location.search).get("payment_intent_client_secret")||c.clientSecret;if(o||this.storybookForceStatus){const{error:s,messages:t}=await h({clientSecret:o,storybookForceStatus:this.storybookForceStatus});if(this.notificationType=s?"error":"success",this.notificationMessages=t||[],this.notificationTitle=m(s?"Payment failed":"You're all set!"),s)f("zonos-checkout-payment-fail");else{f("zonos-checkout-success");const o=new CustomEvent("zonos-checkout-success",{detail:{message:"Zonos Checkout successfully processed order"}});document.dispatchEvent(o)}"success"===this.notificationType&&this.getPullOrder()}l(),this.isLoading=!1},this.closeClickHandler=()=>{this.closeClick.emit()},this.borderRadius="ROUNDED",this.storybookForceStatus=void 0,this.overrideNotification=void 0,this.isLoading=!0,this.notificationType="success",this.notificationTitle="",this.notificationMessages=[],this.order=null}componentDidLoad(){if(this.overrideNotification)return this.notificationType=this.overrideNotification.type,this.notificationTitle=this.overrideNotification.title,this.notificationMessages=this.overrideNotification.messages,void(this.isLoading=!1);this.checkPaymentStatus()}render(){return t(n,{class:"zonos--checkout-finish zonos--elements",style:{"--border-radius":g(this.borderRadius)}},this.isLoading&&t("div",{class:"loading-wrapper"},t("zonos-spinner",null)),!this.isLoading&&t(i,null,t("div",{class:"zonos--group"},t("zonos-icon","success"===this.notificationType?{color:"blue-800",content:'<svg color="var(--amino-blue-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="https://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M2 12C2 6.477 6.477 2 12 2s10 4.477 10 10-4.477 10-10 10S2 17.523 2 12Z" data-is-secondary-color="true" fill="var(--amino-blue-100)" fill-rule="evenodd"></path><path clip-rule="evenodd" d="M15.707 9.293a1 1 0 0 1 0 1.414l-3.646 3.647a1.5 1.5 0 0 1-2.122 0l-1.646-1.647a1 1 0 1 1 1.414-1.414L11 12.586l3.293-3.293a1 1 0 0 1 1.414 0Z" fill="currentColor" fill-rule="evenodd"></path></svg>',size:50}:{color:"red-800",content:'<svg color="var(--amino-red-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="https://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Z" data-is-secondary-color="true" fill="var(--amino-red-200)" fill-rule="evenodd"></path><path clip-rule="evenodd" d="M8.293 8.293a1 1 0 0 1 1.414 0L12 10.586l2.293-2.293a1 1 0 1 1 1.414 1.414L13.414 12l2.293 2.293a1 1 0 0 1-1.414 1.414L12 13.414l-2.293 2.293a1 1 0 0 1-1.414-1.414L10.586 12 8.293 9.707a1 1 0 0 1 0-1.414Z" fill="currentColor" fill-rule="evenodd"></path></svg>',size:50}),t("zonos-text",{class:"zonos--title",type:"semiBoldSubheader"},this.notificationTitle),t("zonos-text",null,this.notificationMessages.map((o=>t(i,null,o,t("br",null))))),t("zonos-button",{onClick:()=>this.closeClickHandler(),size:"md",variant:"primary"},m("Keep shopping")))))}static get assetsDirs(){return["assets"]}};I.style=":host{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--font-family, Inter), Inter}: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 .zonos--group{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;margin-bottom:var(--amino-space-24);border-radius:var(--border-radius, 10px);gap:var(--amino-space-24);max-width:360px;width:auto;margin:auto;margin-top:var(--amino-space-24);background-color:var(--amino-gray-50);padding:var(--amino-space-20)}:host zonos-button{width:100%}:host .loading-wrapper{min-height:300px;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center}";const L=class{constructor(s){o(this,s),this.continueClicked=e(this,"continueClicked",7),this.continueClickHandler=()=>{this.continueClicked.emit()},this.paymentError=!1,this.submitBtnType=void 0,this.continueLoading=!1,this.submitBtnColor=void 0,this.disabled=!0}watchFormComplete(){this.disabled||f("zonos-checkout-payment-info")}render(){var o;return c.stripeElements?(this.disabled=!(null===(o=c.stripePaymentEventData)||void 0===o?void 0:o.complete),t(n,{class:"zonos--checkout-payment zonos--elements"},t("div",{class:"zonos--group"},t("zonos-text",{class:"zonos--title",type:"semiBoldSubheader"},m("Payment method")),this.paymentError&&t("zonos-banner",{class:"zonos--payment-error-banner",intent:"error"},m("We couldn't complete your payment. Please verify the payment details and try again.")),t("zonos-payment",null)),t("div",{class:"zonos--group-btn"},t("zonos-button",{backgroundColor:this.submitBtnColor,"is-disabled":this.disabled,loading:this.continueLoading,onClick:()=>this.continueClickHandler(),size:"lg",variant:this.submitBtnType},"Pay"," ",w({amount:r.total,currency:r.currency}))))):null}static get watchers(){return{disabled:["watchFormComplete"]}}};L.style=".sc-zonos-checkout-payment-h{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-checkout-payment-h *.sc-zonos-checkout-payment{font-family:var(--font-family, Inter), Inter}.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)}";const j=class{constructor(s){o(this,s),this.collapsed=!1,this.collapseSize=0,this.height=this.el.scrollHeight}getElementHeight(){return this.collapsed?`${this.collapseSize}px`:`${this.height}px`}componentDidLoad(){this.height=this.el.scrollHeight}componentDidRender(){var o,s,t;null===(t=null===(s=null===(o=this.el.shadowRoot)||void 0===o?void 0:o.querySelector("iframe"))||void 0===s?void 0:s.contentWindow)||void 0===t||t.addEventListener("resize",(()=>{this.height=this.el.scrollHeight}))}render(){return this.height=this.el.scrollHeight,t(n,{class:"zonos--elements zonos--collapse",style:{"--font-family":b(),height:this.getElementHeight()}},t("div",null,t("iframe",{class:"height-change-listener",tabindex:"-1",title:"collapse-height-change-listener"}),t("slot",null)))}get el(){return a(this)}};j.style=":host{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--font-family, Inter), Inter}: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{-webkit-transition:all 0.3s ease-in-out;transition:all 0.3s ease-in-out;overflow:hidden}:host div{position:relative}:host iframe{width:0;height:100%;position:absolute;top:0;border:0}";const B=class{constructor(s){o(this,s),this.continueClicked=e(this,"continueClicked",7),this.continueClickHandler=()=>{this.continueClicked.emit()},this.continueLoading=!1,this.submitBtnType=void 0,this.submitBtnColor=void 0,this.defaultAddress=null,this.disabled=!0}watchFormComplete(){this.disabled||f("zonos-checkout-customer-info")}render(){var o,s;return c.stripeElements?(this.disabled=!(null===(o=c.stripeAddressEventData)||void 0===o?void 0:o.complete)||!(null===(s=c.stripeLinkEventData)||void 0===s?void 0:s.complete),t(n,{class:"zonos--customer-info zonos--elements"},t("div",{class:"zonos--group"},t("zonos-text",{class:"zonos--title",type:"semiBoldSubheader"},m("Customer information")),t("zonos-link-authentication",{titleText:m("Contact")}),t("zonos-address",{defaultAddress:this.defaultAddress,titleText:m("Address"),type:"shipping"})),t("div",{class:"zonos--group-btn"},t("zonos-button",{backgroundColor:this.submitBtnColor,isDisabled:this.disabled,loading:this.continueLoading,onClick:()=>this.continueClickHandler(),size:"lg",variant:this.submitBtnType},m("Continue to shipping"))))):null}static get watchers(){return{disabled:["watchFormComplete"]}}};B.style=".sc-zonos-customer-info-h{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-customer-info-h *.sc-zonos-customer-info{font-family:var(--font-family, Inter), Inter}.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)}";const D=class{constructor(s){o(this,s),this.closeDialog=e(this,"closeDialog",7),this.isMobileMode=()=>this.mobile||window.innerWidth<=768,this.closeButtonHandler=()=>{this.closeDialog.emit()},this.clickOutsideDialogHandler=o=>{o.target!==o.currentTarget||this.noClickOutside||this.closeDialog.emit()},this.open=!1,this.headerText="",this.width="460px",this.height=void 0,this.noHeader=!1,this.noBodyPadding=!1,this.noBorder=!1,this.footerRightAction=null,this.borderStyle=void 0,this.noCloseButton=!1,this.noClickOutside=!1,this.mobile=!1,this.isLoading=!0,this.isMobile=!1}handleWindowResize(){this.isMobile=this.isMobileMode()}componentDidLoad(){this.isMobile=this.isMobileMode()}render(){document.body.style.overflow=this.open?"hidden":"auto";const o=g(this.borderStyle);return t(n,{class:x(["zonos--elements",this.open&&"open",this.isLoading&&"is-loading",this.noBorder&&"no-border",this.isMobile&&"mobile"]),style:{"--border-radius":o,"--font-family":b(),"--height":this.height||"initial","--width":this.width}},t("div",{class:"zonos--backdrop"}),t("div",{"aria-hidden":"true",class:"zonos--dialog-layout",onClick:this.clickOutsideDialogHandler},t("div",{class:"zonos--dialog"},this.isLoading&&t("div",{class:"zonos--loading"},t("zonos-spinner",{size:30})),(this.headerText||!this.noCloseButton)&&t("div",{class:"zonos--header"},this.headerText&&t("h3",{class:"zonos--header-text"},this.headerText),!this.noCloseButton&&t("zonos-button",{class:"zonos--close-button",icon:t("zonos-icon",{content:'<svg xmlns="https://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path fill="#C5C6CA" fill-rule="evenodd" d="M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Z" clip-rule="evenodd"/><path fill="#4D505A" fill-rule="evenodd" d="M8.293 8.293a1 1 0 0 1 1.414 0L12 10.586l2.293-2.293a1 1 0 1 1 1.414 1.414L13.414 12l2.293 2.293a1 1 0 0 1-1.414 1.414L12 13.414l-2.293 2.293a1 1 0 0 1-1.414-1.414L10.586 12 8.293 9.707a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"/></svg>'}),noBackground:!0,onClick:this.closeButtonHandler})),t("div",{class:x(["zonos--body",this.noBodyPadding&&"zonos--no-body-padding"])},t("slot",null)),this.footerRightAction&&t("div",{class:"zonos--footer"},t("div",{class:"zonos--footer-right-action"},this.footerRightAction)))))}static get assetsDirs(){return["assets"]}};D.style=":host{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--font-family, Inter), Inter}: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--backdrop,:host .zonos--dialog-layout{opacity:0;z-index:-999;visibility:hidden;-webkit-transition:0.3s all ease;transition:0.3s all ease}:host .zonos--backdrop{width:100vw;height:100vh;left:0px;top:0px;background:var(--amino-backdrop-color);z-index:-999;opacity:0;visibility:hidden;position:fixed}:host .zonos--loading{position:absolute;left:0;right:0;bottom:0;top:0;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;z-index:1002;background:white}:host .zonos--dialog-layout{width:100vw;height:100vh;left:0;top:0;position:fixed;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;color:var(--amino-text-color);visibility:hidden}:host .zonos--dialog{position:relative;z-index:1001;background:var(--amino-gray-0);max-width:90vw;max-height:90vh;min-height:500px;height:var(--height, auto);width:var(--width, auto);border-radius:var(--border-radius, var(--amino-radius-10));outline:none;-webkit-box-shadow:var(--amino-v3-shadow-xxl);box-shadow:var(--amino-v3-shadow-xxl);border:var(--amino-border);overflow:hidden;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}:host .zonos--header{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;-ms-flex-pack:justify;justify-content:space-between;padding:var(--amino-space-16) var(--amino-space-24)}:host .zonos--header .-zonos-stencil-library--header-text{-ms-flex-positive:1;flex-grow:1}:host .zonos--header .zonos--close-button{width:var(--amino-size-md);height:var(--amino-size-md);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;cursor:pointer;border-radius:var(--amino-radius-10)}:host .zonos--header .zonos--close-button:hover{background:var(--amino-hover-color)}:host .zonos--body{padding:var(--amino-space-8) var(--amino-space-24);max-height:100%;height:100%;overflow:auto}:host .zonos--body.zonos--no-body-padding{padding:0}:host .zonos--footer{padding:var(--amino-space-16) var(--amino-space-24)}:host(.open) .zonos--dialog-layout,:host(.open) .zonos--backdrop{visibility:visible}:host(.open) .zonos--backdrop{z-index:1001;opacity:0.65}:host(.open) .zonos--dialog-layout{opacity:1;z-index:1002;-webkit-transform:scale(1);transform:scale(1)}:host(.no-border) .zonos--dialog{border:none}:host(.mobile) .zonos--dialog{max-width:100vw;max-height:100vh;height:100%;width:100%;border-radius:0;-webkit-box-shadow:none;box-shadow:none;border:none}";const S=class{constructor(s){o(this,s),this.theme="LIGHT",this.width="auto",this.class=""}render(){const o="DARK"===this.theme?"invert(100%) sepia(100%) saturate(0%) hue-rotate(288deg) brightness(102%) contrast(102%)":"whiteinvert(0%) sepia(100%) saturate(32%) hue-rotate(92deg) brightness(107%) contrast(107%)";return t(n,{class:x(["zonos--elements zonos--logo",this.class]),style:{"--filter-color":o,"--font-family":b(),"--width":this.width}},t("img",{alt:"Zonos Logo",src:s("./assets/ZonosLogo.png")}))}static get assetsDirs(){return["assets"]}};S.style=":host{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--font-family, Inter), Inter}: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 img{-webkit-filter:var(--filter-color);filter:var(--filter-color);width:var(--width)}";const _=class{constructor(s){o(this,s),this.mobile=!1,this.collapsed=!1,this.isMobile=!1}handleWindowResize(){this.isMobile=y(this.mobile)}componentWillLoad(){this.isMobile=y(this.mobile)}render(){const o=this.isMobile?"boldSubheader":"semiBoldLabel",s=this.isMobile?"boldSubheader":"secondaryPageHeader",i=this.isMobile?"gray-1200":"gray-800",e=r.total-r.dutiesTaxFees;return t(n,{class:x(["zonos--review zonos--elements",this.isMobile&&"mobile"])},t("div",{class:"zonos--title"},t("zonos-text",{color:i,type:o},m("Pay")," ",v.organizationName),(()=>this.isMobile?t("zonos-icon",this.collapsed?{color:"gray-1200",content:'<svg color="var(--amino-gray-400)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="https://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M17.707 14.707a1 1 0 0 1-1.414 0L12 10.414l-4.293 4.293a1 1 0 0 1-1.414-1.414l4.93-4.93a1.1 1.1 0 0 1 1.555 0l4.93 4.93a1 1 0 0 1 0 1.414Z" fill="currentColor" fill-rule="evenodd"></path></svg>'}:{color:"gray-1200",content:'<svg color="var(--amino-gray-400)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="https://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M6.293 9.293a1 1 0 0 1 1.414 0L12 13.586l4.293-4.293a1 1 0 0 1 1.414 1.414l-4.93 4.93a1.1 1.1 0 0 1-1.555 0l-4.93-4.93a1 1 0 0 1 0-1.414Z" fill="currentColor" fill-rule="evenodd"></path></svg>'}):null)()),t("div",{class:"zonos--total-pay"},t("zonos-text",{type:s},w({amount:"shipping"===r.step?e:r.total,currency:r.currency}))))}static get assetsDirs(){return["assets"]}};_.style=":host{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--font-family, Inter), Inter}: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--total-pay{margin:var(--amino-space-16) 0 var(--amino-space-32)}:host(.mobile){display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;gap:var(--amino-space-24);-ms-flex-pack:justify;justify-content:space-between;padding:var(--amino-space-4) 0;margin-bottom:var(--amino-space-8)}:host(.mobile) .zonos--title{display:-ms-flexbox;display:flex;-ms-flex-item-align:center;align-self:center;gap:var(--amino-space-8)}:host(.mobile) .zonos--total-pay{margin:0}";const Z=class{constructor(s){o(this,s),this.continueClicked=e(this,"continueClicked",7),this.handleRadioSelected=async o=>{var s;if(this.selectedShippingMethod=o.detail,!this.selectedShippingMethod)return;const t=(null===(s=r.shippingData)||void 0===s?void 0:s.find((o=>{var s;return o.id===(null===(s=this.selectedShippingMethod)||void 0===s?void 0:s.value)})))||null;t&&await d(t)&&(this.disabled=!1)},this.continueClickHandler=()=>{this.continueClicked.emit()},this.continueLoading=!1,this.submitBtnColor=void 0,this.submitBtnType=void 0,this.selectedShippingMethod=null,this.disabled=!0}watchFormComplete(){this.disabled||f("zonos-checkout-shipping-info")}render(){var o;const s=null===(o=r.shippingData)||void 0===o?void 0:o.flatMap((o=>{var s,t;const{expectedDate:n,maxTransit:i,minTransit:e}=p(o),a=n?`${m("Expected delivery")} ${n}`:"",c=e&&i?`(${e}-${i} ${m("business days")})`:"",h=(null===(t=null===(s=r.landedCostData)||void 0===s?void 0:s.find((s=>{var t;return(null===(t=s.landedCost)||void 0===t?void 0:t.shipmentRating.id)===o.id})))||void 0===t?void 0:t.subtotals.shipping)||0;return{caption:c,label:o.displayName,price:w({amount:h,currency:r.currency}),sublabel:a,value:o.id}}));return t(n,{class:"zonos--shipping zonos--elements"},t("div",{class:"zonos--group"},t("zonos-text",{class:"zonos--title",type:"semiBoldSubheader"},m("Shipping information")),t("zonos-text",{class:"zonos--shipping-method-title",type:"semiBoldLabel"},m("Shipping method")),(null==s?void 0:s.length)?t("zonos-shipping-rich-radio",{items:s||[],onRadioSelected:o=>this.handleRadioSelected(o)}):t("zonos-banner",{bannerTitle:"No shipping methods found - try editing your address or contacting support if the error persists",intent:"error"})),t("zonos-button",{backgroundColor:this.submitBtnColor,"is-disabled":this.disabled,loading:this.continueLoading,onClick:()=>this.continueClickHandler(),size:"lg",variant:this.submitBtnType},m("Go to payment")))}static get watchers(){return{disabled:["watchFormComplete"]}}};Z.style=".sc-zonos-shipping-h{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-shipping-h *.sc-zonos-shipping{font-family:var(--font-family, Inter), Inter}.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)}";export{k as zonos_cart_items,C as zonos_cart_subtotal,I as zonos_checkout_finish,L as zonos_checkout_payment,j as zonos_collapse,B as zonos_customer_info,D as zonos_dialog,S as zonos_logo,_ as zonos_review,Z as zonos_shipping}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as o,h as e,H as t}from"./p-956efa27.js";import{_ as s,i,f as n,g as r,z as a,m as l}from"./p-089ba905.js";import{h,b as d,a as m,i as c,t as p,g as f,s as g,l as u,e as w,f as z,j as b,k as v}from"./p-3c6988d7.js";import{c as x}from"./p-b4b7f705.js";import{g as y}from"./p-5883217a.js";var k=function(){return s.Date.now()},T=/\s/,E=/^\s+/,L=function(o){return o?o.slice(0,function(o){for(var e=o.length;e--&&T.test(o.charAt(e)););return e}(o)+1).replace(E,""):o},C=/^[-+]0x[0-9a-f]+$/i,j=/^0b[01]+$/i,D=/^0o[0-7]+$/i,I=parseInt,R=function(o){if("number"==typeof o)return o;if(function(o){return"symbol"==typeof o||i(o)&&"[object Symbol]"==n(o)}(o))return NaN;if(r(o)){var e="function"==typeof o.valueOf?o.valueOf():o;o=r(e)?e+"":e}if("string"!=typeof o)return 0===o?o:+o;o=L(o);var t=j.test(o);return t||D.test(o)?I(o.slice(2),t?2:8):C.test(o)?NaN:+o},X=Math.max,S=Math.min,O=function(o,e,t){var s,i,n,a,l,h,d=0,m=!1,c=!1,p=!0;if("function"!=typeof o)throw new TypeError("Expected a function");function f(e){var t=s,n=i;return s=i=void 0,d=e,a=o.apply(n,t)}function g(o){var t=o-h;return void 0===h||t>=e||t<0||c&&o-d>=n}function u(){var o=k();if(g(o))return w(o);l=setTimeout(u,function(o){var t=e-(o-h);return c?S(t,n-(o-d)):t}(o))}function w(o){return l=void 0,p&&s?f(o):(s=i=void 0,a)}function z(){var o=k(),t=g(o);if(s=arguments,i=this,h=o,t){if(void 0===l)return function(o){return d=o,l=setTimeout(u,e),m?f(o):a}(h);if(c)return clearTimeout(l),l=setTimeout(u,e),f(h)}return void 0===l&&(l=setTimeout(u,e)),a}return e=R(e)||0,r(t)&&(m=!!t.leading,n=(c="maxWait"in t)?X(R(t.maxWait)||0,e):n,p="trailing"in t?!!t.trailing:p),z.cancel=function(){void 0!==l&&clearTimeout(l),d=0,s=h=i=l=void 0},z.flush=function(){return void 0===l?a:w(k())},z};const B=()=>{var o,e;const{productAddToCartElementSelector:t,productDescriptionElementSelector:s,productTitleElementSelector:i,restrictionBehavior:n}=a.helloSettings;i&&s||d("Hello Could not check item restrictions - must provide title and description selectors.");const r=i&&c(i)&&document.querySelectorAll(i)||[],l=s&&c(s)&&document.querySelectorAll(s)||[];if(r.length!==l.length)return d("Hello Could not check item restrictions - Title and description selectors do not match"),[];const h="RESTRICT_AND_BLOCK"===n,m=h&&t&&c(t)&&document.querySelectorAll(t)||[];h&&m.length!==l.length&&d('Hello could not disable "Add to cart" buttons - Title and add to cart selectors do not match');const p=[];for(let t=0;t<r.length;t++){const s=r[t],i=l[t];if(s&&i){const n={cartButtonNode:m[t]||null,description:(null===(o=i.textContent)||void 0===o?void 0:o.trim())||"",title:(null===(e=s.textContent)||void 0===e?void 0:e.trim())||""};p.push(n)}}return p},N=class{constructor(e){o(this,e),this.getHelloPeekMessage=()=>{if(("productDetail"===a.currentHelloPage||"productList"===a.currentHelloPage)&&this.allRestrictedItems.length){const o=p("click to learn more");return`${p("productDetail"===a.currentHelloPage?"Restricted item":"Restricted items found")} - ${o}`}switch(a.currentHelloPage){case"cart":return p("Prepay duties and taxes at checkout");case"productList":case"productDetail":return p("See duty and tax thresholds");default:return`${p("Welcome to")} ${a.organizationName}`}},this.enableShowPeekMessage=()=>{this.peekMessage&&(this.showPeekMessage=!0)},this.getNewItemRestrictions=async o=>"productDetail"!==a.currentHelloPage&&"productList"!==a.currentHelloPage||"DISABLED"===a.helloSettings.restrictionBehavior?[]:await(async o=>{if(!o.length)return[];const{selectedCountryCode:e}=m;if(!e)return d("Hello Could not check item restrictions - No country code selected"),[];const t=o.map((o=>({description:o.description,name:o.title})));return(await(async({items:o,shipFrom:e,shipTo:t})=>{var s;const i={items:o,shipFrom:e,shipTo:t},{errors:n,json:r}=await h("https://v1.route.js.zonos.com/api/zonos-elements/check-item-restrictions",{body:i,method:"POST"});return n.length||!r?(d(`Error fetching item restrictions: ${null===(s=n.find(Boolean))||void 0===s?void 0:s.message}`),[]):r.filter(Boolean)})({items:t,shipFrom:"AD",shipTo:e})).map((o=>{var e;const s=(null===(e=t.filter((e=>e.description===o.itemDescription)).find(Boolean))||void 0===e?void 0:e.name)||"";return Object.assign(Object.assign({},o),{name:s})}))})(o),this.triggerShowPeekMessage=()=>{this.peekMessage=this.getHelloPeekMessage();const{peekMessageBehavior:o,peekMessageDelay:e}=a.helloSettings;"ENABLED"===o&&setTimeout((()=>{this.enableShowPeekMessage(),this.allRestrictedItems.some((o=>this.productsOnPage.some((e=>e.description===o.itemDescription))))||setTimeout((()=>{this.showPeekMessage=!1}),3e3)}),1e3*e)},this.disableAddToCartButtons=()=>{this.productsOnPage.length&&this.productsOnPage.forEach((o=>{var e,t;this.allRestrictedItems.some((e=>e.itemDescription===o.description))?null===(e=o.cartButtonNode)||void 0===e||e.setAttribute("disabled","disabled"):null===(t=o.cartButtonNode)||void 0===t||t.removeAttribute("disabled")}))},this.handleItemRestrictions=async()=>{this.productsOnPage=B();const o=this.productsOnPage.filter((o=>!this.allFoundProducts.some((e=>e.title===o.title)))),e=await this.getNewItemRestrictions(o);this.allRestrictedItems.push(...e),this.allFoundProducts.push(...o),this.disableAddToCartButtons()},this.reloadHelloData=async()=>{await this.handleItemRestrictions(),this.triggerShowPeekMessage(),this.displayCurrency()},this.handleProductCountChange=O((()=>{const{productTitleElementSelector:o}=a.helloSettings;if(o){const o=B();if(this.allFoundProducts.length!==o.length&&window.location.href===this.initialUrl){if(!this.allFoundProducts.length)return;this.reloadHelloData()}}}),1e3),this.watchProductCountChange=()=>{new MutationObserver(this.handleProductCountChange).observe(document.body,{childList:!0,subtree:!0})},this.updateHelloOnPageChange=()=>{this.watchProductCountChange(),setInterval((()=>{if(window.location.href!==this.initialUrl){const o=this.initialUrl&&new URL(this.initialUrl);(o&&f(o.searchParams))!==m.selectedCountryCode&&(this.allFoundProducts=[],this.allRestrictedItems=[],this.productsOnPage=[]),this.initialUrl=window.location.href,a.currentHelloPage=(()=>{const{href:o}=window.location,{cartUrlPattern:e,homepageUrlPattern:t,productDetailUrlPattern:s,productListUrlPattern:i}=a.helloSettings;return e&&new RegExp(e).test(o)?"cart":s&&new RegExp(s).test(o)?"productDetail":i&&new RegExp(i).test(o)?"productList":t&&new RegExp(t).test(o)?"home":""})();const e=new URL(window.location.href);if(!f(e.searchParams))return void g(m.selectedCountryCode);this.reloadHelloData()}}),1e3)},this.changeShowDialog=o=>{this.showDialog=o},this.shouldAnimateLeftDesktop=()=>{const o=this.helloRef&&getComputedStyle(this.helloRef).position;if(this.helloRef&&"relative"===o)return y(this.helloRef)},this.isShippableCountry=(o=!0)=>!(!m.localizationLoaded||!m.isShippableCountry&&(o&&u("Hello: not shippable country"),1)),this.mobileLocationOverride=void 0,this.animateFromLeftOverride=void 0,this.appearanceSettingsOverride=void 0,this.showPeekMessage=!1,this.zonosStoreHelloSettings=a.helloSettings,this.showDialog=!1,this.peekMessage="",this.initialUrl="",this.allRestrictedItems=[],this.allFoundProducts=[],this.productsOnPage=[]}componentWillLoad(){const o=setInterval((async()=>{this.helloRef&&a.loadedConfig&&(this.helloRef.setAttribute("data-zonos-hello-loaded",""),this.updateHelloOnPageChange(),clearInterval(o))}),100)}async displayCurrency(){m.exchangeRate?w():console.error("Could not display currency. Exchange rate and format data is not available.")}async convertAndFormat(o){z(o)}async convert(o){b(o)}async format(o){v(o)}handleResize(){O(this.render.bind(this),500)}render(){var o,s;if(null===(o=a.helloSettings.excludedUrlPatterns)||void 0===o?void 0:o.some((o=>new RegExp(o).test(window.location.href))))return u("Hello is excluded on this url","warn"),null;const{selectedCountryCode:i}=m,n=this.mobileLocationOverride||a.helloSettings.mobileLocation,r=window.innerWidth<768,h=this.animateFromLeftOverride||r&&n.includes("LEFT")||this.shouldAnimateLeftDesktop()||!1,d=n.includes("TOP"),c=l(a.appearance,this.appearanceSettingsOverride),{theme:p}=c,f=null===(s=this.allRestrictedItems)||void 0===s?void 0:s.filter((o=>this.productsOnPage.some((e=>e.description===o.itemDescription)))),g=this.isShippableCountry()&&!!i;return e(t,{class:"zonos--hello zonos--elements","data-theme":p},g&&e("div",{class:"zonos--hello-wrapper"},e("button",{class:x(["zonos--hello-widget",this.showPeekMessage&&"zonos--hello-show-peek-message",this.mobileLocationOverride&&"zonos--hello-mobile-override",h&&"zonos--hello-widget-left zonos--hello-widget-animate-from-left",d&&"zonos--hello-widget-top",!!this.allRestrictedItems.length&&"zonos--hello-has-restrictions"]),onClick:()=>{this.changeShowDialog(!this.showDialog)},onMouseEnter:()=>this.enableShowPeekMessage(),onMouseLeave:()=>this.showPeekMessage=!1,ref:o=>o&&(this.helloRef=o)},e("zonos-text",{class:"zonos--hello-message"},this.peekMessage),i&&e("div",{class:"zonos--hello-country-flag-wrapper"},e("zonos-country-flag",{class:"zonos--hello-country-flag",countryCode:i}))),e("div",{class:x(["zonos--hello-dialog-wrapper",this.mobileLocationOverride&&"zonos--hello-dialog-wrapper-mobile-override"]),style:{height:this.showDialog?"fit-content":"0px"}},e("zonos-hello-dialog",{animateFromLeftOverride:this.animateFromLeftOverride,appearanceSettings:c,isOpen:this.showDialog,mobileLocationOverride:this.mobileLocationOverride,restrictedItems:f,setIsOpen:this.changeShowDialog}))))}};N.style=":host{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--font-family, Inter), Inter}: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:inline-block}:host .zonos--hello-wrapper{position:relative}:host .zonos--hello-wrapper .zonos--hello-dialog-wrapper-mobile-override{position:fixed;bottom:0;left:0;width:100vw;z-index:1001;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content}@media (max-width: 768px){:host .zonos--hello-wrapper{position:fixed;bottom:0;left:0;width:100vw;z-index:1001;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content}}:host .zonos--hello-widget{-webkit-transition:all 0.7s cubic-bezier(0.31, -0.02, 0.06, 1.53);transition:all 0.7s cubic-bezier(0.31, -0.02, 0.06, 1.53);padding:6px;border-radius:30px;background:var(--amino-page-background);font-size:var(--amino-font-size-s);border:var(--amino-border);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;cursor:pointer;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;position:relative;z-index:1000}:host .zonos--hello-widget>.zonos--hello-message{-ms-flex-order:0;order:0;max-width:0;height:100%;white-space:nowrap;-webkit-transition:border 0.3s ease-in, all 0.7s cubic-bezier(0.31, -0.02, 0.06, 1.53);transition:border 0.3s ease-in, all 0.7s cubic-bezier(0.31, -0.02, 0.06, 1.53);overflow:hidden;color:var(--amino-text-color);position:absolute;background:var(--amino-page-background);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;border-top-left-radius:30px;border-bottom-left-radius:30px;left:0;-webkit-transform:translateX(calc(-100% + var(--amino-space-16)));transform:translateX(calc(-100% + var(--amino-space-16)));width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;border-top:var(--amino-border);border-bottom:var(--amino-border)}:host .zonos--hello-widget.zonos--hello-has-restrictions{background:var(--amino-red-100);border:1px solid var(--amino-red-200)}:host .zonos--hello-widget.zonos--hello-has-restrictions>.zonos--hello-message{background:var(--amino-red-100);color:var(--amino-red-800);font-weight:500}:host .zonos--hello-widget.zonos--hello-has-restrictions.zonos--hello-show-peek-message>.zonos--hello-message{border:1px solid var(--amino-red-200)}:host .zonos--hello-widget.zonos--hello-show-peek-message{max-width:100vw;width:100%}:host .zonos--hello-widget.zonos--hello-show-peek-message>.zonos--hello-message{max-width:100vw;padding:0 6px;padding-right:var(--amino-space-16);border:var(--amino-border)}:host .zonos--hello-widget.zonos--hello-show-peek-message:not(.zonos--hello-widget-animate-from-left){border-top-left-radius:0;border-bottom-left-radius:0}:host .zonos--hello-widget.zonos--hello-show-peek-message:not(.zonos--hello-widget-animate-from-left)>.zonos--hello-message{border-right:none}:host .zonos--hello-widget.zonos--hello-show-peek-message.zonos--hello-widget-animate-from-left{border-top-right-radius:0;border-bottom-right-radius:0}:host .zonos--hello-widget.zonos--hello-show-peek-message.zonos--hello-widget-animate-from-left>.zonos--hello-message{border-left:0}:host .zonos--hello-widget.zonos--hello-show-peek-message.zonos--hello-widget-animate-from-left>.zonos--hello-message{padding-left:var(--amino-space-16);padding-right:6px;border-left:none}:host .zonos--hello-widget.zonos--hello-widget-animate-from-left>.zonos--hello-message{-ms-flex-order:1;order:1;-webkit-transform:translateX(calc(100% - var(--amino-space-16)));transform:translateX(calc(100% - var(--amino-space-16)));right:0;left:auto;border-top-left-radius:0;border-bottom-left-radius:0;border-top-right-radius:30px;border-bottom-right-radius:30px}:host .zonos--hello-widget .zonos--hello-country-flag-wrapper{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center}:host .zonos--hello-widget .zonos--hello-country-flag-wrapper .zonos--hello-country-flag{height:18px;width:18px;position:relative;overflow:hidden;border-radius:30px;-webkit-box-shadow:var(--amino-v3-shadow-medium);box-shadow:var(--amino-v3-shadow-medium);z-index:10;justify-self:center}@media (max-width: 768px){:host .zonos--hello-widget .zonos--hello-country-flag-wrapper .zonos--hello-country-flag{border-radius:var(--amino-radius-4);width:24px}}@media (max-width: 768px){:host .zonos--hello-widget{position:fixed;bottom:var(--amino-space-32);right:var(--amino-space-32);border-radius:var(--amino-radius-4);padding:var(--amino-space-4);border:1px solid transparent}:host .zonos--hello-widget.zonos--hello-widget-left{left:var(--amino-space-32);right:auto}:host .zonos--hello-widget.zonos--hello-widget-top{bottom:auto;top:var(--amino-space-32)}:host .zonos--hello-widget.zonos--hello-has-restrictions.zonos--hello-show-peek-message>.zonos--hello-message{border:none}:host .zonos--hello-widget>.zonos--hello-message{position:relative;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;border-radius:30px;top:0;bottom:0;left:0;-webkit-transform:translateX(0);transform:translateX(0);width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;border:none}:host .zonos--hello-widget.zonos--hello-widget-animate-from-left>.zonos--hello-message{-webkit-transform:translateX(0);transform:translateX(0)}:host .zonos--hello-widget.zonos--hello-show-peek-message{width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}:host .zonos--hello-widget.zonos--hello-show-peek-message:not(.zonos--hello-widget-animate-from-left){border-top-left-radius:var(--amino-radius-4);border-bottom-left-radius:var(--amino-radius-4)}:host .zonos--hello-widget.zonos--hello-show-peek-message.zonos--hello-widget-animate-from-left{border-top-right-radius:var(--amino-radius-4);border-bottom-right-radius:var(--amino-radius-4)}:host .zonos--hello-widget.zonos--hello-show-peek-message.zonos--hello-widget-animate-from-left>.zonos--hello-message{padding-left:var(--amino-space-8);padding-right:var(--amino-space-4)}:host .zonos--hello-widget.zonos--hello-show-peek-message>.zonos--hello-message{padding:0 var(--amino-radius-4);padding-right:6px;border:none}:host .zonos--hello-widget .zonos--hello-country-flag-wrapper{border-radius:var(--amino-radius-4)}}:host .zonos--hello-mobile-override.zonos--hello-widget{position:fixed;bottom:var(--amino-space-32);right:var(--amino-space-32);border-radius:var(--amino-radius-4);padding:var(--amino-space-4);border:1px solid transparent}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-widget-left{left:var(--amino-space-32);right:auto}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-widget-top{bottom:auto;top:var(--amino-space-32)}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-has-restrictions.zonos--hello-show-peek-message>.zonos--hello-message{border:none}:host .zonos--hello-mobile-override.zonos--hello-widget>.zonos--hello-message{position:relative;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;border-radius:30px;top:0;bottom:0;left:0;-webkit-transform:translateX(0);transform:translateX(0);width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;border:none}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-widget-animate-from-left>.zonos--hello-message{-webkit-transform:translateX(0);transform:translateX(0)}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-show-peek-message{width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-show-peek-message:not(.zonos--hello-widget-animate-from-left){border-top-left-radius:var(--amino-radius-4);border-bottom-left-radius:var(--amino-radius-4)}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-show-peek-message.zonos--hello-widget-animate-from-left{border-top-right-radius:var(--amino-radius-4);border-bottom-right-radius:var(--amino-radius-4)}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-show-peek-message.zonos--hello-widget-animate-from-left>.zonos--hello-message{padding-left:var(--amino-space-8);padding-right:var(--amino-space-4)}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-show-peek-message>.zonos--hello-message{padding:0 var(--amino-radius-4);padding-right:6px;border:none}:host .zonos--hello-mobile-override.zonos--hello-widget .zonos--hello-country-flag-wrapper{border-radius:var(--amino-radius-4)}:host .zonos--hello-mobile-override.zonos--hello-widget .zonos--hello-country-flag{border-radius:var(--amino-radius-4);width:24px}";export{N as zonos_hello}
|
|
1
|
+
import{r as o,h as e,H as t}from"./p-956efa27.js";import{_ as s,i,f as n,g as r,z as a,m as l}from"./p-089ba905.js";import{h,b as d,a as m,i as c,t as p,g as f,s as g,l as u,e as w,f as z,j as b,k as v}from"./p-bbb154a9.js";import{c as x}from"./p-b4b7f705.js";import{g as y}from"./p-5883217a.js";var k=function(){return s.Date.now()},T=/\s/,E=/^\s+/,L=function(o){return o?o.slice(0,function(o){for(var e=o.length;e--&&T.test(o.charAt(e)););return e}(o)+1).replace(E,""):o},C=/^[-+]0x[0-9a-f]+$/i,j=/^0b[01]+$/i,D=/^0o[0-7]+$/i,I=parseInt,R=function(o){if("number"==typeof o)return o;if(function(o){return"symbol"==typeof o||i(o)&&"[object Symbol]"==n(o)}(o))return NaN;if(r(o)){var e="function"==typeof o.valueOf?o.valueOf():o;o=r(e)?e+"":e}if("string"!=typeof o)return 0===o?o:+o;o=L(o);var t=j.test(o);return t||D.test(o)?I(o.slice(2),t?2:8):C.test(o)?NaN:+o},X=Math.max,S=Math.min,O=function(o,e,t){var s,i,n,a,l,h,d=0,m=!1,c=!1,p=!0;if("function"!=typeof o)throw new TypeError("Expected a function");function f(e){var t=s,n=i;return s=i=void 0,d=e,a=o.apply(n,t)}function g(o){var t=o-h;return void 0===h||t>=e||t<0||c&&o-d>=n}function u(){var o=k();if(g(o))return w(o);l=setTimeout(u,function(o){var t=e-(o-h);return c?S(t,n-(o-d)):t}(o))}function w(o){return l=void 0,p&&s?f(o):(s=i=void 0,a)}function z(){var o=k(),t=g(o);if(s=arguments,i=this,h=o,t){if(void 0===l)return function(o){return d=o,l=setTimeout(u,e),m?f(o):a}(h);if(c)return clearTimeout(l),l=setTimeout(u,e),f(h)}return void 0===l&&(l=setTimeout(u,e)),a}return e=R(e)||0,r(t)&&(m=!!t.leading,n=(c="maxWait"in t)?X(R(t.maxWait)||0,e):n,p="trailing"in t?!!t.trailing:p),z.cancel=function(){void 0!==l&&clearTimeout(l),d=0,s=h=i=l=void 0},z.flush=function(){return void 0===l?a:w(k())},z};const B=()=>{var o,e;const{productAddToCartElementSelector:t,productDescriptionElementSelector:s,productTitleElementSelector:i,restrictionBehavior:n}=a.helloSettings;i&&s||d("Hello Could not check item restrictions - must provide title and description selectors.");const r=i&&c(i)&&document.querySelectorAll(i)||[],l=s&&c(s)&&document.querySelectorAll(s)||[];if(r.length!==l.length)return d("Hello Could not check item restrictions - Title and description selectors do not match"),[];const h="RESTRICT_AND_BLOCK"===n,m=h&&t&&c(t)&&document.querySelectorAll(t)||[];h&&m.length!==l.length&&d('Hello could not disable "Add to cart" buttons - Title and add to cart selectors do not match');const p=[];for(let t=0;t<r.length;t++){const s=r[t],i=l[t];if(s&&i){const n={cartButtonNode:m[t]||null,description:(null===(o=i.textContent)||void 0===o?void 0:o.trim())||"",title:(null===(e=s.textContent)||void 0===e?void 0:e.trim())||""};p.push(n)}}return p},N=class{constructor(e){o(this,e),this.getHelloPeekMessage=()=>{if(("productDetail"===a.currentHelloPage||"productList"===a.currentHelloPage)&&this.allRestrictedItems.length){const o=p("click to learn more");return`${p("productDetail"===a.currentHelloPage?"Restricted item":"Restricted items found")} - ${o}`}switch(a.currentHelloPage){case"cart":return p("Prepay duties and taxes at checkout");case"productList":case"productDetail":return p("See duty and tax thresholds");default:return`${p("Welcome to")} ${a.organizationName}`}},this.enableShowPeekMessage=()=>{this.peekMessage&&(this.showPeekMessage=!0)},this.getNewItemRestrictions=async o=>"productDetail"!==a.currentHelloPage&&"productList"!==a.currentHelloPage||"DISABLED"===a.helloSettings.restrictionBehavior?[]:await(async o=>{if(!o.length)return[];const{selectedCountryCode:e}=m;if(!e)return d("Hello Could not check item restrictions - No country code selected"),[];const t=o.map((o=>({description:o.description,name:o.title})));return(await(async({items:o,shipFrom:e,shipTo:t})=>{var s;const i={items:o,shipFrom:e,shipTo:t},{errors:n,json:r}=await h("https://v1.route.js.zonos.com/api/zonos-elements/check-item-restrictions",{body:i,method:"POST"});return n.length||!r?(d(`Error fetching item restrictions: ${null===(s=n.find(Boolean))||void 0===s?void 0:s.message}`),[]):r.filter(Boolean)})({items:t,shipFrom:"AD",shipTo:e})).map((o=>{var e;const s=(null===(e=t.filter((e=>e.description===o.itemDescription)).find(Boolean))||void 0===e?void 0:e.name)||"";return Object.assign(Object.assign({},o),{name:s})}))})(o),this.triggerShowPeekMessage=()=>{this.peekMessage=this.getHelloPeekMessage();const{peekMessageBehavior:o,peekMessageDelay:e}=a.helloSettings;"ENABLED"===o&&setTimeout((()=>{this.enableShowPeekMessage(),this.allRestrictedItems.some((o=>this.productsOnPage.some((e=>e.description===o.itemDescription))))||setTimeout((()=>{this.showPeekMessage=!1}),3e3)}),1e3*e)},this.disableAddToCartButtons=()=>{this.productsOnPage.length&&this.productsOnPage.forEach((o=>{var e,t;this.allRestrictedItems.some((e=>e.itemDescription===o.description))?null===(e=o.cartButtonNode)||void 0===e||e.setAttribute("disabled","disabled"):null===(t=o.cartButtonNode)||void 0===t||t.removeAttribute("disabled")}))},this.handleItemRestrictions=async()=>{this.productsOnPage=B();const o=this.productsOnPage.filter((o=>!this.allFoundProducts.some((e=>e.title===o.title)))),e=await this.getNewItemRestrictions(o);this.allRestrictedItems.push(...e),this.allFoundProducts.push(...o),this.disableAddToCartButtons()},this.reloadHelloData=async()=>{await this.handleItemRestrictions(),this.triggerShowPeekMessage(),this.displayCurrency()},this.handleProductCountChange=O((()=>{const{productTitleElementSelector:o}=a.helloSettings;if(o){const o=B();if(this.allFoundProducts.length!==o.length&&window.location.href===this.initialUrl){if(!this.allFoundProducts.length)return;this.reloadHelloData()}}}),1e3),this.watchProductCountChange=()=>{new MutationObserver(this.handleProductCountChange).observe(document.body,{childList:!0,subtree:!0})},this.updateHelloOnPageChange=()=>{this.watchProductCountChange(),setInterval((()=>{if(window.location.href!==this.initialUrl){const o=this.initialUrl&&new URL(this.initialUrl);(o&&f(o.searchParams))!==m.selectedCountryCode&&(this.allFoundProducts=[],this.allRestrictedItems=[],this.productsOnPage=[]),this.initialUrl=window.location.href,a.currentHelloPage=(()=>{const{href:o}=window.location,{cartUrlPattern:e,homepageUrlPattern:t,productDetailUrlPattern:s,productListUrlPattern:i}=a.helloSettings;return e&&new RegExp(e).test(o)?"cart":s&&new RegExp(s).test(o)?"productDetail":i&&new RegExp(i).test(o)?"productList":t&&new RegExp(t).test(o)?"home":""})();const e=new URL(window.location.href);if(!f(e.searchParams))return void g(m.selectedCountryCode);this.reloadHelloData()}}),1e3)},this.changeShowDialog=o=>{this.showDialog=o},this.shouldAnimateLeftDesktop=()=>{const o=this.helloRef&&getComputedStyle(this.helloRef).position;if(this.helloRef&&"relative"===o)return y(this.helloRef)},this.isShippableCountry=(o=!0)=>!(!m.localizationLoaded||!m.isShippableCountry&&(o&&u("Hello: not shippable country"),1)),this.mobileLocationOverride=void 0,this.animateFromLeftOverride=void 0,this.appearanceSettingsOverride=void 0,this.showPeekMessage=!1,this.zonosStoreHelloSettings=a.helloSettings,this.showDialog=!1,this.peekMessage="",this.initialUrl="",this.allRestrictedItems=[],this.allFoundProducts=[],this.productsOnPage=[]}componentWillLoad(){const o=setInterval((async()=>{this.helloRef&&a.loadedConfig&&(this.helloRef.setAttribute("data-zonos-hello-loaded",""),this.updateHelloOnPageChange(),clearInterval(o))}),100)}async displayCurrency(){m.exchangeRate?w():console.error("Could not display currency. Exchange rate and format data is not available.")}async convertAndFormat(o){z(o)}async convert(o){b(o)}async format(o){v(o)}handleResize(){O(this.render.bind(this),500)}render(){var o,s;if(null===(o=a.helloSettings.excludedUrlPatterns)||void 0===o?void 0:o.some((o=>new RegExp(o).test(window.location.href))))return u("Hello is excluded on this url","warn"),null;const{selectedCountryCode:i}=m,n=this.mobileLocationOverride||a.helloSettings.mobileLocation,r=window.innerWidth<768,h=this.animateFromLeftOverride||r&&n.includes("LEFT")||this.shouldAnimateLeftDesktop()||!1,d=n.includes("TOP"),c=l(a.appearance,this.appearanceSettingsOverride),{theme:p}=c,f=null===(s=this.allRestrictedItems)||void 0===s?void 0:s.filter((o=>this.productsOnPage.some((e=>e.description===o.itemDescription)))),g=this.isShippableCountry()&&!!i;return e(t,{class:"zonos--hello zonos--elements","data-theme":p},g&&e("div",{class:"zonos--hello-wrapper"},e("button",{class:x(["zonos--hello-widget",this.showPeekMessage&&"zonos--hello-show-peek-message",this.mobileLocationOverride&&"zonos--hello-mobile-override",h&&"zonos--hello-widget-left zonos--hello-widget-animate-from-left",d&&"zonos--hello-widget-top",!!this.allRestrictedItems.length&&"zonos--hello-has-restrictions"]),onClick:()=>{this.changeShowDialog(!this.showDialog)},onMouseEnter:()=>this.enableShowPeekMessage(),onMouseLeave:()=>this.showPeekMessage=!1,ref:o=>o&&(this.helloRef=o)},e("zonos-text",{class:"zonos--hello-message"},this.peekMessage),i&&e("div",{class:"zonos--hello-country-flag-wrapper"},e("zonos-country-flag",{class:"zonos--hello-country-flag",countryCode:i}))),e("div",{class:x(["zonos--hello-dialog-wrapper",this.mobileLocationOverride&&"zonos--hello-dialog-wrapper-mobile-override"]),style:{height:this.showDialog?"fit-content":"0px"}},e("zonos-hello-dialog",{animateFromLeftOverride:this.animateFromLeftOverride,appearanceSettings:c,isOpen:this.showDialog,mobileLocationOverride:this.mobileLocationOverride,restrictedItems:f,setIsOpen:this.changeShowDialog}))))}};N.style=":host{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--font-family, Inter), Inter}: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:inline-block}:host .zonos--hello-wrapper{position:relative}:host .zonos--hello-wrapper .zonos--hello-dialog-wrapper-mobile-override{position:fixed;bottom:0;left:0;width:100vw;z-index:1001;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content}@media (max-width: 768px){:host .zonos--hello-wrapper{position:fixed;bottom:0;left:0;width:100vw;z-index:1001;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content}}:host .zonos--hello-widget{-webkit-transition:all 0.7s cubic-bezier(0.31, -0.02, 0.06, 1.53);transition:all 0.7s cubic-bezier(0.31, -0.02, 0.06, 1.53);padding:6px;border-radius:30px;background:var(--amino-page-background);font-size:var(--amino-font-size-s);border:var(--amino-border);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;cursor:pointer;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;position:relative;z-index:1000}:host .zonos--hello-widget>.zonos--hello-message{-ms-flex-order:0;order:0;max-width:0;height:100%;white-space:nowrap;-webkit-transition:border 0.3s ease-in, all 0.7s cubic-bezier(0.31, -0.02, 0.06, 1.53);transition:border 0.3s ease-in, all 0.7s cubic-bezier(0.31, -0.02, 0.06, 1.53);overflow:hidden;color:var(--amino-text-color);position:absolute;background:var(--amino-page-background);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;border-top-left-radius:30px;border-bottom-left-radius:30px;left:0;-webkit-transform:translateX(calc(-100% + var(--amino-space-16)));transform:translateX(calc(-100% + var(--amino-space-16)));width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;border-top:var(--amino-border);border-bottom:var(--amino-border)}:host .zonos--hello-widget.zonos--hello-has-restrictions{background:var(--amino-red-100);border:1px solid var(--amino-red-200)}:host .zonos--hello-widget.zonos--hello-has-restrictions>.zonos--hello-message{background:var(--amino-red-100);color:var(--amino-red-800);font-weight:500}:host .zonos--hello-widget.zonos--hello-has-restrictions.zonos--hello-show-peek-message>.zonos--hello-message{border:1px solid var(--amino-red-200)}:host .zonos--hello-widget.zonos--hello-show-peek-message{max-width:100vw;width:100%}:host .zonos--hello-widget.zonos--hello-show-peek-message>.zonos--hello-message{max-width:100vw;padding:0 6px;padding-right:var(--amino-space-16);border:var(--amino-border)}:host .zonos--hello-widget.zonos--hello-show-peek-message:not(.zonos--hello-widget-animate-from-left){border-top-left-radius:0;border-bottom-left-radius:0}:host .zonos--hello-widget.zonos--hello-show-peek-message:not(.zonos--hello-widget-animate-from-left)>.zonos--hello-message{border-right:none}:host .zonos--hello-widget.zonos--hello-show-peek-message.zonos--hello-widget-animate-from-left{border-top-right-radius:0;border-bottom-right-radius:0}:host .zonos--hello-widget.zonos--hello-show-peek-message.zonos--hello-widget-animate-from-left>.zonos--hello-message{border-left:0}:host .zonos--hello-widget.zonos--hello-show-peek-message.zonos--hello-widget-animate-from-left>.zonos--hello-message{padding-left:var(--amino-space-16);padding-right:6px;border-left:none}:host .zonos--hello-widget.zonos--hello-widget-animate-from-left>.zonos--hello-message{-ms-flex-order:1;order:1;-webkit-transform:translateX(calc(100% - var(--amino-space-16)));transform:translateX(calc(100% - var(--amino-space-16)));right:0;left:auto;border-top-left-radius:0;border-bottom-left-radius:0;border-top-right-radius:30px;border-bottom-right-radius:30px}:host .zonos--hello-widget .zonos--hello-country-flag-wrapper{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center}:host .zonos--hello-widget .zonos--hello-country-flag-wrapper .zonos--hello-country-flag{height:18px;width:18px;position:relative;overflow:hidden;border-radius:30px;-webkit-box-shadow:var(--amino-v3-shadow-medium);box-shadow:var(--amino-v3-shadow-medium);z-index:10;justify-self:center}@media (max-width: 768px){:host .zonos--hello-widget .zonos--hello-country-flag-wrapper .zonos--hello-country-flag{border-radius:var(--amino-radius-4);width:24px}}@media (max-width: 768px){:host .zonos--hello-widget{position:fixed;bottom:var(--amino-space-32);right:var(--amino-space-32);border-radius:var(--amino-radius-4);padding:var(--amino-space-4);border:1px solid transparent}:host .zonos--hello-widget.zonos--hello-widget-left{left:var(--amino-space-32);right:auto}:host .zonos--hello-widget.zonos--hello-widget-top{bottom:auto;top:var(--amino-space-32)}:host .zonos--hello-widget.zonos--hello-has-restrictions.zonos--hello-show-peek-message>.zonos--hello-message{border:none}:host .zonos--hello-widget>.zonos--hello-message{position:relative;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;border-radius:30px;top:0;bottom:0;left:0;-webkit-transform:translateX(0);transform:translateX(0);width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;border:none}:host .zonos--hello-widget.zonos--hello-widget-animate-from-left>.zonos--hello-message{-webkit-transform:translateX(0);transform:translateX(0)}:host .zonos--hello-widget.zonos--hello-show-peek-message{width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}:host .zonos--hello-widget.zonos--hello-show-peek-message:not(.zonos--hello-widget-animate-from-left){border-top-left-radius:var(--amino-radius-4);border-bottom-left-radius:var(--amino-radius-4)}:host .zonos--hello-widget.zonos--hello-show-peek-message.zonos--hello-widget-animate-from-left{border-top-right-radius:var(--amino-radius-4);border-bottom-right-radius:var(--amino-radius-4)}:host .zonos--hello-widget.zonos--hello-show-peek-message.zonos--hello-widget-animate-from-left>.zonos--hello-message{padding-left:var(--amino-space-8);padding-right:var(--amino-space-4)}:host .zonos--hello-widget.zonos--hello-show-peek-message>.zonos--hello-message{padding:0 var(--amino-radius-4);padding-right:6px;border:none}:host .zonos--hello-widget .zonos--hello-country-flag-wrapper{border-radius:var(--amino-radius-4)}}:host .zonos--hello-mobile-override.zonos--hello-widget{position:fixed;bottom:var(--amino-space-32);right:var(--amino-space-32);border-radius:var(--amino-radius-4);padding:var(--amino-space-4);border:1px solid transparent}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-widget-left{left:var(--amino-space-32);right:auto}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-widget-top{bottom:auto;top:var(--amino-space-32)}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-has-restrictions.zonos--hello-show-peek-message>.zonos--hello-message{border:none}:host .zonos--hello-mobile-override.zonos--hello-widget>.zonos--hello-message{position:relative;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;border-radius:30px;top:0;bottom:0;left:0;-webkit-transform:translateX(0);transform:translateX(0);width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;border:none}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-widget-animate-from-left>.zonos--hello-message{-webkit-transform:translateX(0);transform:translateX(0)}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-show-peek-message{width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-show-peek-message:not(.zonos--hello-widget-animate-from-left){border-top-left-radius:var(--amino-radius-4);border-bottom-left-radius:var(--amino-radius-4)}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-show-peek-message.zonos--hello-widget-animate-from-left{border-top-right-radius:var(--amino-radius-4);border-bottom-right-radius:var(--amino-radius-4)}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-show-peek-message.zonos--hello-widget-animate-from-left>.zonos--hello-message{padding-left:var(--amino-space-8);padding-right:var(--amino-space-4)}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-show-peek-message>.zonos--hello-message{padding:0 var(--amino-radius-4);padding-right:6px;border:none}:host .zonos--hello-mobile-override.zonos--hello-widget .zonos--hello-country-flag-wrapper{border-radius:var(--amino-radius-4)}:host .zonos--hello-mobile-override.zonos--hello-widget .zonos--hello-country-flag{border-radius:var(--amino-radius-4);width:24px}";export{N as zonos_hello}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z as e,c as t}from"./p-089ba905.js";import{h as n,l as o,a as s,b as r,t as i}from"./p-3c6988d7.js";import{i as a}from"./p-55f49f1e.js";import{g as l}from"./p-ff95f098.js";const d=()=>{const e=m.stripeLinkEventData,t=m.stripeAddressEventData;if(!t||!t.complete)throw new Error("Missing stripe address data");return{checkoutSessionId:E.checkoutSessionId||"",contact:{email:(null==e?void 0:e.value.email)||"",firstName:t.value.firstName||"",lastName:t.value.lastName||"",phone:t.value.phone||""},items:E.items.map((e=>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}}},c=({borderStyle:e,theme:t})=>"DARK"===t?{borderRadius:l(e),colorBackground:"#101117",colorBackgroundText:"#C5C6CA",colorText:"#C5C6CA",colorTextPlaceholder:"#C5C6CA"}:{borderRadius:l(e)},{onChange:u,reset:p,state:m}=t((()=>({clientSecret:sessionStorage.getItem("zonos--client-secret")||null,fetchingLandedCostAbordController:null,isFetchingLandedCost:!1,isFetchingSession:!1,stripe:null,stripeAddressElement:null,stripeAddressEventData:null,stripeAddressUsedWhenFetchingLC:null,stripeBillingAddressElement:null,stripeElements:null,stripeElementsOptions:null,stripeLinkElement:null,stripeLinkEventData:null,stripeLinkUsedWhenFetchingLC:null,stripePaymentElement:null,stripePaymentEventData:null}))),h=async t=>{var n;const r=m.clientSecret;if(m.stripe){if(r){const i=(({clientSecret:t,overrideBorderRaidus:n,overridePrimaryColor:o,overrideTheme:r})=>{const i=o||e.appearance.colorPrimary,l=i&&a(i)?"night":"flat",d="DARK"===r?"night":"flat";return{appearance:{labels:"floating",rules:Object.assign({},{".Input":{padding:"0",paddingBottom:"8px",paddingLeft:"16px",paddingRight:"8px",paddingTop:"6px"}}),theme:r?d:l,variables:Object.assign({},c({borderStyle:n,theme:"LIGHT"}))},clientSecret:t,locale:s.selectedLocale}})({clientSecret:r,overrideBorderRaidus:null==t?void 0:t.overrideBorderRaidus,overridePrimaryColor:null==t?void 0:t.overridePrimaryColor,overrideTheme:null==t?void 0:t.overrideTheme}),l=JSON.stringify(i)===JSON.stringify(m.stripeElementsOptions);if(!m.stripeElements)return m.stripeElements=null===(n=m.stripe)||void 0===n?void 0:n.elements(i),m.stripeElementsOptions=i,void o("Stripe elements initialized");l||(m.stripeElements.update(i),m.stripeElementsOptions=i),o("Stripe elements initialized")}}else o("Skip. Stripe is not initialized")},v=()=>{sessionStorage.removeItem("zonos--client-secret"),p(),m.stripe=window.Zonos.stripe},g=async()=>{var t,o,s,i;const a=!!(null===(t=m.stripeAddressEventData)||void 0===t?void 0:t.complete),l=!!(null===(o=m.stripeLinkEventData)||void 0===o?void 0:o.complete),c=(()=>{var e,t,n,o;if(!m.fetchingLandedCostAbordController)return!1;const s=JSON.stringify(null===(e=m.stripeLinkUsedWhenFetchingLC)||void 0===e?void 0:e.value)!==JSON.stringify(null===(t=m.stripeLinkEventData)||void 0===t?void 0:t.value),r=JSON.stringify(null===(n=m.stripeAddressUsedWhenFetchingLC)||void 0===n?void 0:n.value)!==JSON.stringify(null===(o=m.stripeAddressEventData)||void 0===o?void 0:o.value);return s||r})();if(c&&(null===(s=m.fetchingLandedCostAbordController)||void 0===s||s.abort(),m.fetchingLandedCostAbordController=null),a&&l&&(c||!m.isFetchingLandedCost)){m.isFetchingLandedCost=!0,m.stripeAddressEventData&&(m.stripeAddressUsedWhenFetchingLC=Object.assign({},m.stripeAddressEventData)),m.stripeLinkEventData&&(m.stripeLinkUsedWhenFetchingLC=Object.assign({},m.stripeLinkEventData));try{const t=new AbortController;m.fetchingLandedCostAbordController=t;const{checkoutSessionWorkflow:o,shipmentRatingCalculateWorkflow:s}=await(async t=>{const o=e.checkoutSettings.buildLandedCost;if(o){const e=await(async e=>{var t;const o=d(),s=await e(o.checkoutSessionId,o.contact,o.shippingAddress);if(!s)throw new Error("Failed to build landed cost");const{errors:r,json:i}=await n("https://v1.route.js.zonos.com/api/zonos-elements/validate-landed-cost",{body:s,headers:{"Content-Type":"application/json"},method:"POST"});if(!i||r.length)throw new Error(`Invalid landed cost object: ${(null===(t=r.find(Boolean))||void 0===t?void 0:t.message)||"Unknown error"}`);return s})(o);return e}const{errors:s,json:r}=await n("https://v1.route.js.zonos.com/api/zonos-elements/calculate-landed-cost",{body:d(),method:"POST",signal:null==t?void 0:t.signal});if(s.length||!r)throw new Error("Failed to calculate landed cost");return r})(t);m.fetchingLandedCostAbordController=null,E.landedCostData=(null==o?void 0:o.filter(Boolean))||null,E.shippingData=(null==s?void 0:s.filter(Boolean))||null;const r=null===(i=E.landedCostData)||void 0===i?void 0:i.find(Boolean),a=r?r.subtotals:null;a&&A({exchangeRate:a.exchangeRate,items:a.items,landedCostTotal:0,presentmentCurrencyCode:a.presentmentCurrencyCode,shipping:0,total:a.items})}catch(e){r(e)}m.isFetchingLandedCost=!1}},y=e=>{let t=[],n=!0;switch(e){case"succeeded":t=[i("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."),"","",i("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.")],n=!1;break;case"requires_capture":case"processing":t=[i("Payment processing. We'll update you when payment is received.")],n=!1;break;case"requires_payment_method":t=[i("Payment failed. Please try another payment method.")];break;default:t=[i("Something went wrong.")]}return{isError:n,messages:t}},f=async({clientSecret:e,storybookForceStatus:t})=>{if(t){const{isError:e,messages:n}=y(t);return{error:e,messages:n}}const n=e||m.clientSecret;if(!m.stripe||!n)return r("Failed to retrieve payment intent. Stripe is not initialized"),{error:!0,message:[i("Something went wrong.")]};const{paymentIntent:o}=await m.stripe.retrievePaymentIntent(n),s=null==o?void 0:o.status,{isError:a,messages:l}=y(s);return{error:a,messages:l}},w=async()=>{var e,t,n;const o=!!(null===(e=m.stripePaymentEventData)||void 0===e?void 0:e.complete),s=m.stripeElements,r=m.stripe;if(r&&s&&o&&m.clientSecret){const{error:e}=await r.confirmPayment({confirmParams:{receipt_email:null===(n=null===(t=m.stripeLinkEventData)||void 0===t?void 0:t.value)||void 0===n?void 0:n.email,return_url:window.location.href},elements:s,redirect:"if_required"});if(e){if("card_error"===e.type||"validation_error"===e.type)throw new Error(e.message);if("invalid_request_error"===e.type&&"payment_intent_unexpected_state"===e.code)return;throw new Error("An unexpected error occurred.")}}},S=async()=>{var e;const t=E.items.reduce(((e,t)=>e+t.amount*t.quantity),0);if(!t||!s.targetCurrency)return r("Fail to create checkout session - invalid total or currency"),!1;m.isFetchingSession=!0;const{errors:i,json:a}=await n("https://v1.route.js.zonos.com/api/zonos-elements/create-checkout-session",{body:{currency:(null===(e=E.items.find(Boolean))||void 0===e?void 0:e.currencyCode)||"",itemsAmount:t,presentmentCountryCode:s.selectedCountryCode||null},method:"POST"});if(m.isFetchingSession=!1,i.length||!a)return r("Error occurs when creating checkout session",JSON.stringify(i,null,2)),!1;const l=a.checkoutSessionCreate;return m.clientSecret=l.clientSecret,E.checkoutSessionId=l.id,A(Object.assign(Object.assign({},l.subtotals),{landedCostTotal:0,shipping:0,total:l.subtotals.items})),o("Exchange rate updated for cart items (checkout session create)","info",E.exchangeRate),o("done-init-checkout-session"),!0};u("clientSecret",(e=>{e&&m.stripe&&sessionStorage.setItem("zonos--client-secret",e),e||sessionStorage.removeItem("zonos--client-secret")}));const C=e=>{const t=new Date,n=e.getTime()-t.getTime();return Math.floor(n/864e5)},{onChange:k,reset:b,state:E}=t((()=>({checkoutSessionId:sessionStorage.getItem("zonos--checkout-session-id")||null,currency:"USD",dutiesTaxFees:0,error:null,exchangeRate:null,isSelectedShippingAboveDeminimis:!1,isSelectedShippingGuarantee:!1,items:[],landedCostData:null,selectedLandedCost:null,selectedShippingOption:null,selectedShippingOptionExpectedDate:"",selectedShippingOptionTransitTime:"",shipping:0,shippingData:null,step:"customer-info",subtotal:0,total:0}))),O=e=>{const t=e.minTransitAt?C(new Date(e.minTransitAt)):"",n=e.maxTransitAt?C(new Date(e.maxTransitAt)):"";return{expectedDate:e.minTransitAt?(({date:e,formatOptions:t={day:"numeric",weekday:"long",year:"numeric"}})=>new Intl.DateTimeFormat("en-US",t).format(e))({date:new Date(e.minTransitAt)}):"",maxTransit:n,minTransit:t}},j=()=>{sessionStorage.removeItem("zonos--checkout-session-id"),b()},T=({messages:e,title:t})=>{E.step="error",E.error={messages:e,title:t}},A=e=>{E.exchangeRate=e.exchangeRate,E.dutiesTaxFees=e.landedCostTotal,E.subtotal=e.items,E.total=e.total,E.currency=e.presentmentCurrencyCode},x=async({currency:e,itemsAmount:t,landedCostId:a})=>{if(a&&E.selectedLandedCost&&(A(E.selectedLandedCost.subtotals),o("Exchange rate updated for cart items (landed cost subtotal)","info",E.exchangeRate)),!E.checkoutSessionId)return r("Could not update cart total without checkout session id"),!1;const{json:l}=await(async({currency:e,id:t,itemsAmount:o,landedCostId:s,presentmentCountryCode:i})=>{const{errors:a,json:l}=await n("https://v1.route.js.zonos.com/api/zonos-elements/update-checkout-session",{body:{currency:e,id:t,itemsAmount:o,landedCostId:s,presentmentCountryCode:i},method:"POST"});return a.length||!l?(r("Error occurs when updating checkout session",JSON.stringify(a,null,2)),{errors:a,json:l}):{errors:[],json:l}})({currency:e,id:E.checkoutSessionId,itemsAmount:t,landedCostId:a,presentmentCountryCode:s.selectedCountryCode});return l?(a||(A(l.checkoutSessionUpdate.subtotals),o("Exchange rate updated for cart items (checkout session update)","info",E.exchangeRate)),!0):(r("Error occurs when updating checkout session"),T({messages:[i("There's been an error updating your checkout session. Please reload and try again or contact support if the error persists")],title:i("Error updating Checkout")}),!1)},z=async e=>{var t,n,o,s,r;E.selectedShippingOption=e;const{expectedDate:i,maxTransit:a,minTransit:l}=O(E.selectedShippingOption);E.selectedShippingOptionExpectedDate=i,E.selectedShippingOptionTransitTime=l&&a?`${l}-${a}`:`${l||a}`;const d=null===(t=E.landedCostData)||void 0===t?void 0:t.find((e=>{var t,n,o;return(null===(n=null===(t=e.landedCost)||void 0===t?void 0:t.shipmentRating)||void 0===n?void 0:n.id)===(null===(o=E.selectedShippingOption)||void 0===o?void 0:o.id)}));if(E.selectedLandedCost=d||null,!d)return!1;E.shipping=d.subtotals.shipping;const c="ZONOS"===(null===(n=null==d?void 0:d.landedCost)||void 0===n?void 0:n.landedCostGuaranteeCode),u=!!(null===(s=null===(o=null==d?void 0:d.landedCost)||void 0===o?void 0:o.deMinimis)||void 0===s?void 0:s.find((e=>["DUTY","TAX"].includes(e.type)&&"ABOVE"===e.threshold)));return E.isSelectedShippingAboveDeminimis=u,E.isSelectedShippingGuarantee=c,await x({landedCostId:null===(r=d.landedCost)||void 0===r?void 0:r.id})};k("checkoutSessionId",(()=>{E.checkoutSessionId?sessionStorage.setItem("zonos--checkout-session-id",E.checkoutSessionId):sessionStorage.removeItem("zonos--checkout-session-id")}));const D=async e=>{var t;E.items=e;const n=null===(t=e.find(Boolean))||void 0===t?void 0:t.currencyCode,o=e.reduce(((e,t)=>e+t.amount*t.quantity),0);n&&o&&(E.currency=n,m.isFetchingSession=!0,await x({currency:n,itemsAmount:o}),m.isFetchingSession=!1)},P=()=>{"customer-info"===E.step?E.step="shipping":"shipping"===E.step?E.step="payment":"payment"===E.step&&(E.step="finish")},B=()=>{"payment"===E.step?E.step="shipping":"shipping"===E.step&&(E.step="customer-info",E.selectedShippingOption=null,E.isSelectedShippingAboveDeminimis=!1,E.isSelectedShippingGuarantee=!1,E.selectedShippingOptionExpectedDate="",E.selectedShippingOptionTransitTime="",E.shipping=0)};export{A as a,O as b,E as c,P as d,B as e,x as f,j as g,D as h,z as i,T as j,h as k,S as l,g as m,w as n,v as o,f as p,m as s}
|
|
1
|
+
import{z as e,c as t}from"./p-089ba905.js";import{h as n,l as o,a as s,b as r,t as i}from"./p-bbb154a9.js";import{i as a}from"./p-55f49f1e.js";import{g as l}from"./p-ff95f098.js";const d=()=>{const e=m.stripeLinkEventData,t=m.stripeAddressEventData;if(!t||!t.complete)throw new Error("Missing stripe address data");return{checkoutSessionId:E.checkoutSessionId||"",contact:{email:(null==e?void 0:e.value.email)||"",firstName:t.value.firstName||"",lastName:t.value.lastName||"",phone:t.value.phone||""},items:E.items.map((e=>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}}},c=({borderStyle:e,theme:t})=>"DARK"===t?{borderRadius:l(e),colorBackground:"#101117",colorBackgroundText:"#C5C6CA",colorText:"#C5C6CA",colorTextPlaceholder:"#C5C6CA"}:{borderRadius:l(e)},{onChange:u,reset:p,state:m}=t((()=>({clientSecret:sessionStorage.getItem("zonos--client-secret")||null,fetchingLandedCostAbordController:null,isFetchingLandedCost:!1,isFetchingSession:!1,stripe:null,stripeAddressElement:null,stripeAddressEventData:null,stripeAddressUsedWhenFetchingLC:null,stripeBillingAddressElement:null,stripeElements:null,stripeElementsOptions:null,stripeLinkElement:null,stripeLinkEventData:null,stripeLinkUsedWhenFetchingLC:null,stripePaymentElement:null,stripePaymentEventData:null}))),h=async t=>{var n;const r=m.clientSecret;if(m.stripe){if(r){const i=(({clientSecret:t,overrideBorderRaidus:n,overridePrimaryColor:o,overrideTheme:r})=>{const i=o||e.appearance.colorPrimary,l=i&&a(i)?"night":"flat",d="DARK"===r?"night":"flat";return{appearance:{labels:"floating",rules:Object.assign({},{".Input":{padding:"0",paddingBottom:"8px",paddingLeft:"16px",paddingRight:"8px",paddingTop:"6px"}}),theme:r?d:l,variables:Object.assign({},c({borderStyle:n,theme:"LIGHT"}))},clientSecret:t,locale:s.selectedLocale}})({clientSecret:r,overrideBorderRaidus:null==t?void 0:t.overrideBorderRaidus,overridePrimaryColor:null==t?void 0:t.overridePrimaryColor,overrideTheme:null==t?void 0:t.overrideTheme}),l=JSON.stringify(i)===JSON.stringify(m.stripeElementsOptions);if(!m.stripeElements)return m.stripeElements=null===(n=m.stripe)||void 0===n?void 0:n.elements(i),m.stripeElementsOptions=i,void o("Stripe elements initialized");l||(m.stripeElements.update(i),m.stripeElementsOptions=i),o("Stripe elements initialized")}}else o("Skip. Stripe is not initialized")},v=()=>{sessionStorage.removeItem("zonos--client-secret"),p(),m.stripe=window.Zonos.stripe},g=async()=>{var t,o,s,i;const a=!!(null===(t=m.stripeAddressEventData)||void 0===t?void 0:t.complete),l=!!(null===(o=m.stripeLinkEventData)||void 0===o?void 0:o.complete),c=(()=>{var e,t,n,o;if(!m.fetchingLandedCostAbordController)return!1;const s=JSON.stringify(null===(e=m.stripeLinkUsedWhenFetchingLC)||void 0===e?void 0:e.value)!==JSON.stringify(null===(t=m.stripeLinkEventData)||void 0===t?void 0:t.value),r=JSON.stringify(null===(n=m.stripeAddressUsedWhenFetchingLC)||void 0===n?void 0:n.value)!==JSON.stringify(null===(o=m.stripeAddressEventData)||void 0===o?void 0:o.value);return s||r})();if(c&&(null===(s=m.fetchingLandedCostAbordController)||void 0===s||s.abort(),m.fetchingLandedCostAbordController=null),a&&l&&(c||!m.isFetchingLandedCost)){m.isFetchingLandedCost=!0,m.stripeAddressEventData&&(m.stripeAddressUsedWhenFetchingLC=Object.assign({},m.stripeAddressEventData)),m.stripeLinkEventData&&(m.stripeLinkUsedWhenFetchingLC=Object.assign({},m.stripeLinkEventData));try{const t=new AbortController;m.fetchingLandedCostAbordController=t;const{checkoutSessionWorkflow:o,shipmentRatingCalculateWorkflow:s}=await(async t=>{const o=e.checkoutSettings.buildLandedCost;if(o){const e=await(async e=>{var t;const o=d(),s=await e(o.checkoutSessionId,o.contact,o.shippingAddress);if(!s)throw new Error("Failed to build landed cost");const{errors:r,json:i}=await n("https://v1.route.js.zonos.com/api/zonos-elements/validate-landed-cost",{body:s,headers:{"Content-Type":"application/json"},method:"POST"});if(!i||r.length)throw new Error(`Invalid landed cost object: ${(null===(t=r.find(Boolean))||void 0===t?void 0:t.message)||"Unknown error"}`);return s})(o);return e}const{errors:s,json:r}=await n("https://v1.route.js.zonos.com/api/zonos-elements/calculate-landed-cost",{body:d(),method:"POST",signal:null==t?void 0:t.signal});if(s.length||!r)throw new Error("Failed to calculate landed cost");return r})(t);m.fetchingLandedCostAbordController=null,E.landedCostData=(null==o?void 0:o.filter(Boolean))||null,E.shippingData=(null==s?void 0:s.filter(Boolean))||null;const r=null===(i=E.landedCostData)||void 0===i?void 0:i.find(Boolean),a=r?r.subtotals:null;a&&A({exchangeRate:a.exchangeRate,items:a.items,landedCostTotal:0,presentmentCurrencyCode:a.presentmentCurrencyCode,shipping:0,total:a.items})}catch(e){r(e)}m.isFetchingLandedCost=!1}},y=e=>{let t=[],n=!0;switch(e){case"succeeded":t=[i("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."),"","",i("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.")],n=!1;break;case"requires_capture":case"processing":t=[i("Payment processing. We'll update you when payment is received.")],n=!1;break;case"requires_payment_method":t=[i("Payment failed. Please try another payment method.")];break;default:t=[i("Something went wrong.")]}return{isError:n,messages:t}},f=async({clientSecret:e,storybookForceStatus:t})=>{if(t){const{isError:e,messages:n}=y(t);return{error:e,messages:n}}const n=e||m.clientSecret;if(!m.stripe||!n)return r("Failed to retrieve payment intent. Stripe is not initialized"),{error:!0,message:[i("Something went wrong.")]};const{paymentIntent:o}=await m.stripe.retrievePaymentIntent(n),s=null==o?void 0:o.status,{isError:a,messages:l}=y(s);return{error:a,messages:l}},w=async()=>{var e,t,n;const o=!!(null===(e=m.stripePaymentEventData)||void 0===e?void 0:e.complete),s=m.stripeElements,r=m.stripe;if(r&&s&&o&&m.clientSecret){const{error:e}=await r.confirmPayment({confirmParams:{receipt_email:null===(n=null===(t=m.stripeLinkEventData)||void 0===t?void 0:t.value)||void 0===n?void 0:n.email,return_url:window.location.href},elements:s,redirect:"if_required"});if(e){if("card_error"===e.type||"validation_error"===e.type)throw new Error(e.message);if("invalid_request_error"===e.type&&"payment_intent_unexpected_state"===e.code)return;throw new Error("An unexpected error occurred.")}}},S=async()=>{var e;const t=E.items.reduce(((e,t)=>e+t.amount*t.quantity),0);if(!t||!s.targetCurrency)return r("Fail to create checkout session - invalid total or currency"),!1;m.isFetchingSession=!0;const{errors:i,json:a}=await n("https://v1.route.js.zonos.com/api/zonos-elements/create-checkout-session",{body:{currency:(null===(e=E.items.find(Boolean))||void 0===e?void 0:e.currencyCode)||"",itemsAmount:t,presentmentCountryCode:s.selectedCountryCode||null},method:"POST"});if(m.isFetchingSession=!1,i.length||!a)return r("Error occurs when creating checkout session",JSON.stringify(i,null,2)),!1;const l=a.checkoutSessionCreate;return m.clientSecret=l.clientSecret,E.checkoutSessionId=l.id,A(Object.assign(Object.assign({},l.subtotals),{landedCostTotal:0,shipping:0,total:l.subtotals.items})),o("Exchange rate updated for cart items (checkout session create)","info",E.exchangeRate),o("done-init-checkout-session"),!0};u("clientSecret",(e=>{e&&m.stripe&&sessionStorage.setItem("zonos--client-secret",e),e||sessionStorage.removeItem("zonos--client-secret")}));const C=e=>{const t=new Date,n=e.getTime()-t.getTime();return Math.floor(n/864e5)},{onChange:k,reset:b,state:E}=t((()=>({checkoutSessionId:sessionStorage.getItem("zonos--checkout-session-id")||null,currency:"USD",dutiesTaxFees:0,error:null,exchangeRate:null,isSelectedShippingAboveDeminimis:!1,isSelectedShippingGuarantee:!1,items:[],landedCostData:null,selectedLandedCost:null,selectedShippingOption:null,selectedShippingOptionExpectedDate:"",selectedShippingOptionTransitTime:"",shipping:0,shippingData:null,step:"customer-info",subtotal:0,total:0}))),O=e=>{const t=e.minTransitAt?C(new Date(e.minTransitAt)):"",n=e.maxTransitAt?C(new Date(e.maxTransitAt)):"";return{expectedDate:e.minTransitAt?(({date:e,formatOptions:t={day:"numeric",weekday:"long",year:"numeric"}})=>new Intl.DateTimeFormat("en-US",t).format(e))({date:new Date(e.minTransitAt)}):"",maxTransit:n,minTransit:t}},j=()=>{sessionStorage.removeItem("zonos--checkout-session-id"),b()},T=({messages:e,title:t})=>{E.step="error",E.error={messages:e,title:t}},A=e=>{E.exchangeRate=e.exchangeRate,E.dutiesTaxFees=e.landedCostTotal,E.subtotal=e.items,E.total=e.total,E.currency=e.presentmentCurrencyCode},x=async({currency:e,itemsAmount:t,landedCostId:a})=>{if(a&&E.selectedLandedCost&&(A(E.selectedLandedCost.subtotals),o("Exchange rate updated for cart items (landed cost subtotal)","info",E.exchangeRate)),!E.checkoutSessionId)return r("Could not update cart total without checkout session id"),!1;const{json:l}=await(async({currency:e,id:t,itemsAmount:o,landedCostId:s,presentmentCountryCode:i})=>{const{errors:a,json:l}=await n("https://v1.route.js.zonos.com/api/zonos-elements/update-checkout-session",{body:{currency:e,id:t,itemsAmount:o,landedCostId:s,presentmentCountryCode:i},method:"POST"});return a.length||!l?(r("Error occurs when updating checkout session",JSON.stringify(a,null,2)),{errors:a,json:l}):{errors:[],json:l}})({currency:e,id:E.checkoutSessionId,itemsAmount:t,landedCostId:a,presentmentCountryCode:s.selectedCountryCode});return l?(a||(A(l.checkoutSessionUpdate.subtotals),o("Exchange rate updated for cart items (checkout session update)","info",E.exchangeRate)),!0):(r("Error occurs when updating checkout session"),T({messages:[i("There's been an error updating your checkout session. Please reload and try again or contact support if the error persists")],title:i("Error updating Checkout")}),!1)},z=async e=>{var t,n,o,s,r;E.selectedShippingOption=e;const{expectedDate:i,maxTransit:a,minTransit:l}=O(E.selectedShippingOption);E.selectedShippingOptionExpectedDate=i,E.selectedShippingOptionTransitTime=l&&a?`${l}-${a}`:`${l||a}`;const d=null===(t=E.landedCostData)||void 0===t?void 0:t.find((e=>{var t,n,o;return(null===(n=null===(t=e.landedCost)||void 0===t?void 0:t.shipmentRating)||void 0===n?void 0:n.id)===(null===(o=E.selectedShippingOption)||void 0===o?void 0:o.id)}));if(E.selectedLandedCost=d||null,!d)return!1;E.shipping=d.subtotals.shipping;const c="ZONOS"===(null===(n=null==d?void 0:d.landedCost)||void 0===n?void 0:n.landedCostGuaranteeCode),u=!!(null===(s=null===(o=null==d?void 0:d.landedCost)||void 0===o?void 0:o.deMinimis)||void 0===s?void 0:s.find((e=>["DUTY","TAX"].includes(e.type)&&"ABOVE"===e.threshold)));return E.isSelectedShippingAboveDeminimis=u,E.isSelectedShippingGuarantee=c,await x({landedCostId:null===(r=d.landedCost)||void 0===r?void 0:r.id})};k("checkoutSessionId",(()=>{E.checkoutSessionId?sessionStorage.setItem("zonos--checkout-session-id",E.checkoutSessionId):sessionStorage.removeItem("zonos--checkout-session-id")}));const D=async e=>{var t;E.items=e;const n=null===(t=e.find(Boolean))||void 0===t?void 0:t.currencyCode,o=e.reduce(((e,t)=>e+t.amount*t.quantity),0);n&&o&&(E.currency=n,m.isFetchingSession=!0,await x({currency:n,itemsAmount:o}),m.isFetchingSession=!1)},P=()=>{"customer-info"===E.step?E.step="shipping":"shipping"===E.step?E.step="payment":"payment"===E.step&&(E.step="finish")},B=()=>{"payment"===E.step?E.step="shipping":"shipping"===E.step&&(E.step="customer-info",E.selectedShippingOption=null,E.isSelectedShippingAboveDeminimis=!1,E.isSelectedShippingGuarantee=!1,E.selectedShippingOptionExpectedDate="",E.selectedShippingOptionTransitTime="",E.shipping=0)};export{A as a,O as b,E as c,P as d,B as e,x as f,j as g,D as h,z as i,T as j,h as k,S as l,g as m,w as n,v as o,f as p,m as s}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
System.register(["./p-b85be1ab.system.js","./p-
|
|
1
|
+
System.register(["./p-b85be1ab.system.js","./p-8a8b08e9.system.js"],(function(n){"use strict";var t,e;return{setters:[function(n){t=n.z},function(n){e=n.l}],execute:function(){var i=890;var o=n("i",(function(n){return n||window.innerWidth<i}));var u=n("s",(function(n){var i=t.checkoutSettings.analyticsProviders.find((function(n){return n.type==="GOOGLE_ANALYTICS"}));if(!i||(i===null||i===void 0?void 0:i.status)==="DISABLED"){return}if(typeof window.gtag==="function"){e("Zonos submits gtag event","log",n);window.gtag("event",n,{})}}))}}}));
|