@zonos/elements 1.2.2 → 1.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/dist/cjs/{cart-d4b52ae8.js → cart-55512e32.js} +11 -1
  2. package/dist/cjs/index.cjs.js +1 -1
  3. package/dist/cjs/zonos-address_2.cjs.entry.js +1 -1
  4. package/dist/cjs/zonos-cart-items_10.cjs.entry.js +1 -1
  5. package/dist/cjs/zonos-checkout.cjs.entry.js +5 -1
  6. package/dist/cjs/zonos-controller.cjs.entry.js +48 -2
  7. package/dist/cjs/zonos-payment.cjs.entry.js +1 -1
  8. package/dist/cjs/zonos-shipping-rich-radio.cjs.entry.js +1 -1
  9. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +4 -0
  10. package/dist/collection/components/common/zonos-shipping-rich-radio/zonos-shipping-rich-radio.css +1 -0
  11. package/dist/collection/components/main/zonos-controller.js +46 -0
  12. package/dist/collection/components/store/checkout/stripe.js +11 -1
  13. package/dist/collection/components/utils/checkout/initCheckout.js +1 -1
  14. package/dist/collection/environment.js +22 -13
  15. package/dist/collection/scripts/zonos.js +84 -3
  16. package/dist/collection/utils/generateVercelDeployUrl.js +3 -2
  17. package/dist/components/cart.js +11 -1
  18. package/dist/components/zonos-checkout.js +4 -0
  19. package/dist/components/zonos-controller.js +47 -1
  20. package/dist/components/zonos-shipping-rich-radio2.js +1 -1
  21. package/dist/esm/{cart-e1b93711.js → cart-17650017.js} +11 -1
  22. package/dist/esm/index.js +1 -1
  23. package/dist/esm/zonos-address_2.entry.js +1 -1
  24. package/dist/esm/zonos-cart-items_10.entry.js +1 -1
  25. package/dist/esm/zonos-checkout.entry.js +5 -1
  26. package/dist/esm/zonos-controller.entry.js +48 -2
  27. package/dist/esm/zonos-payment.entry.js +1 -1
  28. package/dist/esm/zonos-shipping-rich-radio.entry.js +1 -1
  29. package/dist/esm-es5/cart-17650017.js +1 -0
  30. package/dist/esm-es5/index.js +1 -1
  31. package/dist/esm-es5/zonos-address_2.entry.js +1 -1
  32. package/dist/esm-es5/zonos-cart-items_10.entry.js +1 -1
  33. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  34. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  35. package/dist/esm-es5/zonos-payment.entry.js +1 -1
  36. package/dist/esm-es5/zonos-shipping-rich-radio.entry.js +1 -1
  37. package/dist/scripts/loadZonos.js +86 -5
  38. package/dist/scripts/zonos.js +86 -5
  39. package/dist/types/components/main/zonos-controller.d.ts +1 -0
  40. package/dist/types/components/store/checkout/stripe.d.ts +2 -1
  41. package/dist/types/components/utils/changeDeepProperty.d.ts +1 -1
  42. package/dist/types/components/utils/changeDeepPropertyAtIndex.d.ts +1 -1
  43. package/dist/types/components/utils/checkout/initCheckout.d.ts +1 -1
  44. package/dist/types/environment.d.ts +6 -1
  45. package/dist/types/scripts/zonos.d.ts +3 -0
  46. package/dist/zonos-elements/assets/RemoveIcon.svg +1 -1
  47. package/dist/zonos-elements/index.esm.js +1 -1
  48. package/dist/zonos-elements/p-0ed3bb9f.system.entry.js +1 -0
  49. package/dist/zonos-elements/{p-a3641931.system.entry.js → p-224125da.system.entry.js} +1 -1
  50. package/dist/zonos-elements/p-3a56c240.entry.js +1 -0
  51. package/dist/zonos-elements/p-8378d94e.js +1 -0
  52. package/dist/zonos-elements/{p-05256415.system.entry.js → p-84b00605.system.entry.js} +1 -1
  53. package/dist/zonos-elements/p-8b415737.system.entry.js +1 -0
  54. package/dist/zonos-elements/{p-40778e43.entry.js → p-9202375f.entry.js} +1 -1
  55. package/dist/zonos-elements/p-a1fa50fb.entry.js +1 -0
  56. package/dist/zonos-elements/{p-60821b2a.entry.js → p-bc2c42f5.entry.js} +1 -1
  57. package/dist/zonos-elements/{p-365970ff.entry.js → p-cd71e41e.entry.js} +1 -1
  58. package/dist/zonos-elements/{p-81c699f7.system.entry.js → p-cf97cc68.system.entry.js} +1 -1
  59. package/dist/zonos-elements/{p-40083e93.system.entry.js → p-d6b8563b.system.entry.js} +1 -1
  60. package/dist/zonos-elements/{p-96a3c767.entry.js → p-e5908de2.entry.js} +1 -1
  61. package/dist/zonos-elements/p-f6add79c.system.js +1 -0
  62. package/dist/zonos-elements/p-f8491335.system.js +1 -1
  63. package/dist/zonos-elements/{p-53649e16.system.js → p-f95ac9ec.system.js} +1 -1
  64. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  65. package/package.json +3 -3
  66. package/dist/esm-es5/cart-e1b93711.js +0 -1
  67. package/dist/zonos-elements/p-25db3885.js +0 -1
  68. package/dist/zonos-elements/p-34a49bce.entry.js +0 -1
  69. package/dist/zonos-elements/p-5d7ffddb.entry.js +0 -1
  70. package/dist/zonos-elements/p-8db8cc05.system.js +0 -1
  71. package/dist/zonos-elements/p-914ce305.system.entry.js +0 -1
  72. package/dist/zonos-elements/p-de9d8a4f.system.entry.js +0 -1
@@ -1 +1 @@
1
- var __awaiter=this&&this.__awaiter||function(o,e,t,n){function s(o){return o instanceof t?o:new t((function(e){e(o)}))}return new(t||(t=Promise))((function(t,i){function c(o){try{a(n.next(o))}catch(o){i(o)}}function r(o){try{a(n["throw"](o))}catch(o){i(o)}}function a(o){o.done?t(o.value):s(o.value).then(c,r)}a((n=n.apply(o,e||[])).next())}))};var __generator=this&&this.__generator||function(o,e){var t={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,s,i,c;return c={next:r(0),throw:r(1),return:r(2)},typeof Symbol==="function"&&(c[Symbol.iterator]=function(){return this}),c;function r(o){return function(e){return a([o,e])}}function a(r){if(n)throw new TypeError("Generator is already executing.");while(c&&(c=0,r[0]&&(t=0)),t)try{if(n=1,s&&(i=r[0]&2?s["return"]:r[0]?s["throw"]||((i=s["return"])&&i.call(s),0):s.next)&&!(i=i.call(s,r[1])).done)return i;if(s=0,i)r=[r[0]&2,i.value];switch(r[0]){case 0:case 1:i=r;break;case 4:t.label++;return{value:r[1],done:false};case 5:t.label++;s=r[1];r=[0];continue;case 7:r=t.ops.pop();t.trys.pop();continue;default:if(!(i=t.trys,i=i.length>0&&i[i.length-1])&&(r[0]===6||r[0]===2)){t=0;continue}if(r[0]===3&&(!i||r[1]>i[0]&&r[1]<i[3])){t.label=r[1];break}if(r[0]===6&&t.label<i[1]){t.label=i[1];i=r;break}if(i&&t.label<i[2]){t.label=i[2];t.ops.push(r);break}if(i[2])t.ops.pop();t.trys.pop();continue}r=e.call(o,t)}catch(o){r=[6,o];s=0}finally{n=i=0}if(r[0]&5)throw r[1];return{value:r[0]?r[1]:void 0,done:true}}};System.register(["./p-68d06767.system.js","./p-8db8cc05.system.js","./p-164fae93.system.js","./p-6dcd752e.system.js","./p-8aabbb9b.system.js","./p-23e7c655.system.js","./p-8c867835.system.js","./p-85ab35c9.system.js"],(function(o){"use strict";var e,t,n,s,i,c,r,a,u,l,h,d,p,f,m,z,v,k,g,b,y,w,x,C,_,S;return{setters:[function(o){e=o.r;t=o.h;n=o.F;s=o.H},function(o){i=o.k;c=o.c;r=o.h;a=o.g;u=o.s;l=o.l;h=o.j;d=o.m;p=o.d;f=o.n;m=o.o;z=o.e},function(o){v=o.a;k=o.l;g=o.t},function(o){b=o.z;y=o.m},function(o){w=o.s;x=o.i},function(o){C=o.c},function(o){_=o.g},function(o){S=o.i}],execute:function(){var M='<svg color="var(--amino-gray-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="https://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M9.707 16.707a1 1 0 0 1-1.414 0l-3.647-3.646a1.5 1.5 0 0 1 0-2.122l3.647-3.646a1 1 0 0 1 1.414 1.414L7.414 11H19a1 1 0 1 1 0 2H7.414l2.293 2.293a1 1 0 0 1 0 1.414Z" fill="currentColor" fill-rule="evenodd"></path></svg>';var L='<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';var O='<svg color="var(--amino-gray-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="https://www.w3.org/2000/svg"><path clip-rule="evenodd" d="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-gray-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>';var B=".sc-zonos-checkout-h{font-family:Inter;display:block}.sc-zonos-checkout-h img.sc-zonos-checkout{max-width:100%}.sc-zonos-checkout-h dl.sc-zonos-checkout,.sc-zonos-checkout-h dd.sc-zonos-checkout,.sc-zonos-checkout-h h1.sc-zonos-checkout,.sc-zonos-checkout-h h2.sc-zonos-checkout,.sc-zonos-checkout-h h3.sc-zonos-checkout,.sc-zonos-checkout-h h4.sc-zonos-checkout,.sc-zonos-checkout-h h5.sc-zonos-checkout,.sc-zonos-checkout-h h6.sc-zonos-checkout,.sc-zonos-checkout-h hr.sc-zonos-checkout,.sc-zonos-checkout-h figure.sc-zonos-checkout,.sc-zonos-checkout-h p.sc-zonos-checkout,.sc-zonos-checkout-h pre.sc-zonos-checkout{margin:0}.sc-zonos-checkout-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-checkout-h *.sc-zonos-checkout::-webkit-scrollbar{width:10px}.sc-zonos-checkout-h *.sc-zonos-checkout::-webkit-scrollbar-track{background:var(--amino-gray-50)}.sc-zonos-checkout-h *.sc-zonos-checkout::-webkit-scrollbar-thumb{border-radius:10px;background:#cccccc;border:3px solid transparent;background-clip:content-box}.sc-zonos-checkout-h *.sc-zonos-checkout::-webkit-scrollbar-thumb:hover{background:#d6d6d6}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout{display:-ms-flexbox;display:flex;height:100%;overflow:hidden;border-radius:var(--border-radius, var(--amino-radius-10))}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout,.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{-ms-flex:1;flex:1;padding:var(--amino-space-48) var(--amino-space-56)}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout{background-color:var(--primary-color, var(--amino-gray-0));border-right:1px solid var(--amino-gray-200)}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{background-color:var(--amino-gray-0);padding-bottom:var(--amino-space-80)}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout{width:100%;max-height:100%;height:100%;overflow:auto;-ms-flex-direction:column;flex-direction:column;background-color:var(--amino-gray-0);-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;padding:var(--amino-space-24);padding-bottom:50px}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout .zonos--header.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center;width:100%}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout .zonos--header.sc-zonos-checkout img.sc-zonos-checkout{width:150px;min-width:150px}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout .zonos--logo.sc-zonos-checkout{margin-bottom:0}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout zonos-checkout-finish.sc-zonos-checkout{-ms-flex:1;flex:1}.sc-zonos-checkout-h .zonos--left.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}.sc-zonos-checkout-h .zonos--left.sc-zonos-checkout .zonos--back-button.sc-zonos-checkout{margin-bottom:var(--amino-space-24)}.sc-zonos-checkout-h .zonos--left.sc-zonos-checkout .zonos--wrapper.sc-zonos-checkout{padding:0 var(--amino-space-8) var(--amino-space-8)}.sc-zonos-checkout-h .zonos--left.sc-zonos-checkout .zonos--payment-error-banner.sc-zonos-checkout{margin-top:var(--amino-space-24)}.sc-zonos-checkout-h .zonos--right.sc-zonos-checkout{position:relative}.sc-zonos-checkout-h .zonos--right.sc-zonos-checkout .zonos--close-button.sc-zonos-checkout{position:absolute;right:var(--amino-space-24);top:var(--amino-space-24)}.sc-zonos-checkout-h .zonos--footer.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-pack:end;justify-content:flex-end;-ms-flex-align:center;align-items:center;position:absolute;bottom:var(--amino-space-32);right:var(--amino-space-56);gap:var(--amino-space-8)}.sc-zonos-checkout-h .zonos--wrapper.sc-zonos-checkout{overflow:auto;max-height:100%;position:relative}.sc-zonos-checkout-h .flex--wrapper.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;max-height:100%}.sc-zonos-checkout-h .zonos--logo.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.sc-zonos-checkout-h .zonos--checkout-default-message.sc-zonos-checkout{margin-left:var(--amino-space-76);margin-bottom:var(--amino-space-8)}.preview.sc-zonos-checkout-h{min-width:500px;margin:auto}.preview.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout{border:var(--amino-border)}.preview.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout{padding:var(--amino-space-32)}.mobile.sc-zonos-checkout-h{min-width:auto}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;overflow:auto;border-radius:0;max-height:100%;height:100%;border:0}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout,.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{padding:var(--amino-space-12)}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout{-ms-flex-order:2;order:2}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{-ms-flex-order:1;order:1;padding-top:var(--amino-space-16)}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout .zonos--wrapper.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:var(--amino-space-16);margin-top:var(--amino-space-24);border:var(--amino-border);border-radius:var(--border-radius, var(--amino-radius-10));background-color:var(--amino-gray-50);padding:var(--amino-space-12);margin-top:var(--amino-space-32)}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--wrapper.sc-zonos-checkout{max-height:100%}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--footer.sc-zonos-checkout{-ms-flex-order:3;order:3}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout{width:auto}.mobile.sc-zonos-checkout-h .zonos--cart-subtotal.sc-zonos-checkout{margin:0}.mobile.sc-zonos-checkout-h .zonos--footer.sc-zonos-checkout{bottom:0;left:0;padding:var(--amino-space-12);position:relative;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;background-color:var(--amino-gray-0)}";var P=o("zonos_checkout",function(){function o(o){var t=this;e(this,o);this.applyStripeTheme=function(){return __awaiter(t,void 0,void 0,(function(){var o,e,t,n;return __generator(this,(function(s){switch(s.label){case 0:n=((o=this.appearanceSettingsOverride)===null||o===void 0?void 0:o.theme)||b.appearance.theme;return[4,i({overrideBorderRaidus:(e=this.appearanceSettingsOverride)===null||e===void 0?void 0:e.style,overridePrimaryColor:(t=this.appearanceSettingsOverride)===null||t===void 0?void 0:t.colorPrimary,overrideTheme:this.isMobile?n:undefined})];case 1:s.sent();return[2]}}))}))};this.isShippableCountry=function(o){if(o===void 0){o=true}if(!v.localizationLoaded){return false}if(!v.isShippableCountry){if(o){k("Checkout: not shippable country")}return false}return true};this.getCurrentLocalePageEnum=function(){switch(c.step){case"customer-info":return"checkout_customer_info";case"shipping":return"checkout_shipping_info";case"payment":return"checkout_payment_info";default:return null}};this.appearanceSettingsOverride=undefined;this.preview=false;this.mobile=false;this.defaultAddress=null;this.forceDialogOpen=false;this.open=this.forceDialogOpen;this.stripe=window.Zonos.stripe;this.submitLoading=false;this.paymentError=false;this.collapseReviewMobile=false;this.isAttachError=false;this.isMobile=false;this.zonosReviewRef=undefined;this.storybookPaymentStatusOverride=undefined}o.prototype.initCartInfoHandler=function(o){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(t){e=o.detail;void r(e);return[2]}))}))};o.prototype.closeDialogHandler=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(o){w("zonos-checkout-close");this.open=this.forceDialogOpen||false;if(!this.preview&&c.step==="finish"){a()}c.step="customer-info";return[2]}))}))};o.prototype.buildCartAndInit=function(){return __awaiter(this,void 0,void 0,(function(){var o,e;return __generator(this,(function(t){switch(t.label){case 0:if(!b.checkoutSettings.buildCartDetail)return[3,3];k("build cart detail");return[4,b.checkoutSettings.buildCartDetail()];case 1:o=t.sent();return[4,r(o)];case 2:t.sent();t.label=3;case 3:if(!!u.clientSecret)return[3,5];return[4,l()];case 4:e=t.sent();k("stripeStoreInitCheckoutSession: ".concat(e));if(!e){return[2,false]}t.label=5;case 5:return[4,this.applyStripeTheme()];case 6:t.sent();return[2,true]}}))}))};o.prototype.attachCheckout=function(){var o=this;var e=b.checkoutSettings.placeOrderButtonSelector;if(!e){return}var t=document.querySelectorAll(e);t.forEach((function(e){var t=e.getAttribute("data-zonos-checkout-attached");if(t){return}e.addEventListener("click",(function(e){return __awaiter(o,void 0,void 0,(function(){var o,t;return __generator(this,(function(n){switch(n.label){case 0:if(!this.isShippableCountry()){return[2]}e.preventDefault();e.stopPropagation();k("zonos checkout button clicked");this.open=true;n.label=1;case 1:n.trys.push([1,3,,4]);return[4,this.buildCartAndInit()];case 2:o=n.sent();if(!o){throw new Error("Error building cart")}w("zonos-checkout-start");return[3,4];case 3:t=n.sent();h({messages:[g("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:g("Error creating Checkout")});return[3,4];case 4:return[2]}}))}))}));e.setAttribute("data-zonos-checkout-attached","true")}))};o.prototype.appearanceSettingsOverrideChanged=function(){if(!this.appearanceSettingsOverride){return}void this.applyStripeTheme()};o.prototype.init=function(){return __awaiter(this,void 0,void 0,(function(){var o,e;var t=this;return __generator(this,(function(n){u.stripe=window.Zonos.stripe;this.stripe=window.Zonos.stripe;o=setInterval((function(){var e=window.Zonos.internationalHideSelector;if(!e){clearInterval(o);return}var n=t.isShippableCountry(false);var s=document.querySelectorAll(e);if(!n){s===null||s===void 0?void 0:s.forEach((function(o){var e=o;var t=e.getAttribute("data-zonos-checkout-original-display")||getComputedStyle(e).display;e.style.display=t||"initial"}));return}s===null||s===void 0?void 0:s.forEach((function(o){var e=o;var t=e.style.display;e.setAttribute("data-zonos-checkout-original-display",t);e.style.display="none"}))}),100);e=setInterval((function(){u.stripe=window.Zonos.stripe;t.stripe=window.Zonos.stripe;if(!t.stripe){k("waiting for stripe to be loaded");return}if(t.storybookPaymentStatusOverride){clearInterval(e);return}k("init checkout");if(t.preview||t.forceDialogOpen){void t.buildCartAndInit()}else{t.attachCheckout();setInterval((function(){t.attachCheckout()}),50)}clearInterval(e)}),50);setTimeout((function(){clearInterval(e)}),1e4);return[2]}))}))};o.prototype.setToFinishStep=function(o){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){c.step="finish";this.storybookPaymentStatusOverride=o;return[2]}))}))};o.prototype.handleCustomerInfoContinue=function(){return __awaiter(this,void 0,void 0,(function(){var o;var e=this;return __generator(this,(function(t){switch(t.label){case 0:this.submitLoading=true;return[4,d()];case 1:t.sent();o=setInterval((function(){if(c.landedCostData||!u.isFetchingLandedCost){if(c.landedCostData){p()}e.submitLoading=false;clearInterval(o)}}),500);return[2]}}))}))};o.prototype.handleShippingContinue=function(){return __awaiter(this,void 0,void 0,(function(){var o=this;return __generator(this,(function(e){this.submitLoading=true;setTimeout((function(){p();o.submitLoading=false}),500);return[2]}))}))};o.prototype.handleCheckoutPaymentContinue=function(){return __awaiter(this,void 0,void 0,(function(){var o;return __generator(this,(function(e){switch(e.label){case 0:this.paymentError=false;this.submitLoading=true;e.label=1;case 1:e.trys.push([1,3,,4]);return[4,f()];case 2:e.sent();p();return[3,4];case 3:o=e.sent();console.error(o);this.paymentError=true;return[3,4];case 4:this.submitLoading=false;return[2]}}))}))};o.prototype.handleFinishClick=function(){return __awaiter(this,void 0,void 0,(function(){var o,e;return __generator(this,(function(t){switch(t.label){case 0:m();if(!this.preview)return[3,2];c.step="customer-info";return[4,this.init()];case 1:t.sent();return[2];case 2:a();o=window.location.href;e=o.split("?")[0];window.history.replaceState({},document.title,e);this.open=false;return[2]}}))}))};o.prototype.handleBackClick=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(o){switch(o.label){case 0:if(!(c.step==="customer-info"))return[3,2];return[4,this.closeDialogHandler()];case 1:o.sent();return[2];case 2:z();return[2]}}))}))};o.prototype.handleWindowResize=function(){this.isMobile=x(this.mobile);void this.applyStripeTheme();k("mobile: ".concat(this.isMobile))};o.prototype.handleMobileChange=function(){this.isMobile=x(this.mobile);void this.applyStripeTheme();k("mobile: ".concat(this.isMobile))};o.prototype.componentWillLoad=function(){void this.init();this.isMobile=x(this.mobile);k("mobile: ".concat(this.isMobile))};o.prototype.disconnectedCallback=function(){m();a()};o.prototype.render=function(){var o=this;var e;var i=c.step!=="finish"&&c.step!=="error"&&!u.stripeElements||u.isFetchingSession;var r=y(b.appearance,this.appearanceSettingsOverride),a=r.colorPrimary,l=r.colorSecondary,h=r.logoUrl,d=r.style;var p=b.appearance.zonosAttribution==="ENABLED";var f=b.appearance.theme;var m=a&&S(a)?"DARK":"LIGHT";var z=this.isMobile?f:m;var k=!this.isMobile?l:undefined;var w=v.customMessages;var x=((e=w.find((function(o){return o.pageName==="checkout_default"})))===null||e===void 0?void 0:e.message)||"Know about duties and taxes before you buy. Shop with confidence!";var B=this.getCurrentLocalePageEnum();var P=w.filter((function(o){return o.pageName===B}));var E=function(){return t("div",{class:"zonos--logo"},h&&t("img",{alt:"".concat(b.organizationName," logo"),src:h,width:100}))};var H=function(){return t("zonos-v-stack",null,E(),P.map((function(o){return t("zonos-custom-message",{icon:L,message:o.message})})),t("div",null,t("zonos-button",{class:"zonos--back-button",icon:t("zonos-icon",{content:M}),noBackground:true,noPaddingLeft:true,noPaddingRight:true,onClick:function(){return o.handleBackClick()},theme:z},g("Back"))))};var j=function(){return p&&t("div",{class:"zonos--footer","data-theme":f},t("zonos-text",{type:"hintText"},g("Powered by")),t("zonos-logo",{theme:f,width:"100px"}))};var D=function(){var e;var s=o.isMobile?"primary":undefined;var i=(e=o.zonosReviewRef)===null||e===void 0?void 0:e.scrollHeight;return t("div",{class:"zonos--content",style:{"--border-radius":_(d)}},c.step!=="finish"&&c.step!=="error"&&t(n,null,t("div",{class:"zonos--left","data-theme":z,style:{"--primary-color":!o.isMobile?a:""}},!o.isMobile&&H(),c.step==="customer-info"&&t("zonos-customer-info",{continueLoading:o.submitLoading,defaultAddress:o.defaultAddress,onContinueClicked:function(){return o.handleCustomerInfoContinue()},submitBtnColor:k,submitBtnType:s}),c.step==="shipping"&&t("zonos-shipping",{continueLoading:o.submitLoading,onContinueClicked:function(){return o.handleShippingContinue()},submitBtnColor:k,submitBtnType:s}),c.step==="payment"&&t("zonos-checkout-payment",{continueLoading:o.submitLoading,onContinueClicked:function(){return o.handleCheckoutPaymentContinue()},paymentError:o.paymentError,submitBtnColor:k,submitBtnType:s})),t("div",{class:"zonos--right","data-theme":f},o.isMobile&&H(),!o.isMobile&&t("zonos-button",{class:"zonos--close-button",icon:t("zonos-icon",{content:O}),noBackground:true,onClick:function(){return o.closeDialogHandler()}}),t("div",{class:"flex--wrapper"},t("div",{class:"zonos--wrapper"},t("zonos-collapse",{collapseSize:i,collapsed:o.collapseReviewMobile&&o.isMobile},t("zonos-review",{collapsed:o.collapseReviewMobile,mobile:o.isMobile,onClick:function(){if(!o.isMobile){return}o.collapseReviewMobile=!o.collapseReviewMobile},ref:function(e){return o.zonosReviewRef=e}}),t("zonos-cart-items",null))),t("zonos-v-stack",{spacing:16},t("zonos-cart-subtotal",null),t("zonos-custom-message",{class:"zonos--checkout-default-message",icon:L,message:x}))),!o.isMobile&&j()),o.isMobile&&j()),(c.step==="finish"||c.step==="error")&&t("div",{class:"zonos--done","data-theme":f},t("div",{class:"zonos--header"},E(),t("zonos-button",{class:"zonos--close-button",icon:t("zonos-icon",{content:O}),noBackground:true,onClick:function(){return o.handleFinishClick()},theme:f})),t("zonos-checkout-finish",{borderRadius:d,onCloseClick:function(){return o.handleFinishClick()},overrideNotification:c.step==="error"&&!!c.error?Object.assign(Object.assign({},c.error),{type:"error"}):undefined,storybookForceStatus:o.storybookPaymentStatusOverride})))};return t(s,{class:C(["zonos--checkout zonos--elements",p&&"has-footer",this.preview&&"preview",this.isMobile&&"mobile"])},this.preview?D():t("zonos-dialog",{borderStyle:d,"data-theme":f,height:"980px",isLoading:i,mobile:this.isMobile,noBodyPadding:true,noBorder:true,noClickOutside:true,noCloseButton:true,onCloseDialog:function(){return o.closeDialogHandler()},open:this.open,width:"1200px"},D()))};Object.defineProperty(o,"assetsDirs",{get:function(){return["assets"]},enumerable:false,configurable:true});Object.defineProperty(o,"watchers",{get:function(){return{appearanceSettingsOverride:["appearanceSettingsOverrideChanged"],mobile:["handleMobileChange"]}},enumerable:false,configurable:true});return o}());P.style=B}}}));
1
+ var __awaiter=this&&this.__awaiter||function(o,e,t,n){function s(o){return o instanceof t?o:new t((function(e){e(o)}))}return new(t||(t=Promise))((function(t,i){function c(o){try{a(n.next(o))}catch(o){i(o)}}function r(o){try{a(n["throw"](o))}catch(o){i(o)}}function a(o){o.done?t(o.value):s(o.value).then(c,r)}a((n=n.apply(o,e||[])).next())}))};var __generator=this&&this.__generator||function(o,e){var t={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,s,i,c;return c={next:r(0),throw:r(1),return:r(2)},typeof Symbol==="function"&&(c[Symbol.iterator]=function(){return this}),c;function r(o){return function(e){return a([o,e])}}function a(r){if(n)throw new TypeError("Generator is already executing.");while(c&&(c=0,r[0]&&(t=0)),t)try{if(n=1,s&&(i=r[0]&2?s["return"]:r[0]?s["throw"]||((i=s["return"])&&i.call(s),0):s.next)&&!(i=i.call(s,r[1])).done)return i;if(s=0,i)r=[r[0]&2,i.value];switch(r[0]){case 0:case 1:i=r;break;case 4:t.label++;return{value:r[1],done:false};case 5:t.label++;s=r[1];r=[0];continue;case 7:r=t.ops.pop();t.trys.pop();continue;default:if(!(i=t.trys,i=i.length>0&&i[i.length-1])&&(r[0]===6||r[0]===2)){t=0;continue}if(r[0]===3&&(!i||r[1]>i[0]&&r[1]<i[3])){t.label=r[1];break}if(r[0]===6&&t.label<i[1]){t.label=i[1];i=r;break}if(i&&t.label<i[2]){t.label=i[2];t.ops.push(r);break}if(i[2])t.ops.pop();t.trys.pop();continue}r=e.call(o,t)}catch(o){r=[6,o];s=0}finally{n=i=0}if(r[0]&5)throw r[1];return{value:r[0]?r[1]:void 0,done:true}}};System.register(["./p-68d06767.system.js","./p-f6add79c.system.js","./p-164fae93.system.js","./p-6dcd752e.system.js","./p-8aabbb9b.system.js","./p-23e7c655.system.js","./p-8c867835.system.js","./p-85ab35c9.system.js"],(function(o){"use strict";var e,t,n,s,i,c,r,a,u,l,h,d,p,f,m,z,v,k,g,b,y,w,x,C,_,S;return{setters:[function(o){e=o.r;t=o.h;n=o.F;s=o.H},function(o){i=o.k;c=o.c;r=o.h;a=o.g;u=o.s;l=o.l;h=o.j;d=o.m;p=o.d;f=o.n;m=o.o;z=o.e},function(o){v=o.a;k=o.l;g=o.t},function(o){b=o.z;y=o.m},function(o){w=o.s;x=o.i},function(o){C=o.c},function(o){_=o.g},function(o){S=o.i}],execute:function(){var M='<svg color="var(--amino-gray-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="https://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M9.707 16.707a1 1 0 0 1-1.414 0l-3.647-3.646a1.5 1.5 0 0 1 0-2.122l3.647-3.646a1 1 0 0 1 1.414 1.414L7.414 11H19a1 1 0 1 1 0 2H7.414l2.293 2.293a1 1 0 0 1 0 1.414Z" fill="currentColor" fill-rule="evenodd"></path></svg>';var L='<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';var O='<svg color="var(--amino-gray-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="https://www.w3.org/2000/svg"><path clip-rule="evenodd" d="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-gray-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>';var B=".sc-zonos-checkout-h{font-family:Inter;display:block}.sc-zonos-checkout-h img.sc-zonos-checkout{max-width:100%}.sc-zonos-checkout-h dl.sc-zonos-checkout,.sc-zonos-checkout-h dd.sc-zonos-checkout,.sc-zonos-checkout-h h1.sc-zonos-checkout,.sc-zonos-checkout-h h2.sc-zonos-checkout,.sc-zonos-checkout-h h3.sc-zonos-checkout,.sc-zonos-checkout-h h4.sc-zonos-checkout,.sc-zonos-checkout-h h5.sc-zonos-checkout,.sc-zonos-checkout-h h6.sc-zonos-checkout,.sc-zonos-checkout-h hr.sc-zonos-checkout,.sc-zonos-checkout-h figure.sc-zonos-checkout,.sc-zonos-checkout-h p.sc-zonos-checkout,.sc-zonos-checkout-h pre.sc-zonos-checkout{margin:0}.sc-zonos-checkout-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-checkout-h *.sc-zonos-checkout::-webkit-scrollbar{width:10px}.sc-zonos-checkout-h *.sc-zonos-checkout::-webkit-scrollbar-track{background:var(--amino-gray-50)}.sc-zonos-checkout-h *.sc-zonos-checkout::-webkit-scrollbar-thumb{border-radius:10px;background:#cccccc;border:3px solid transparent;background-clip:content-box}.sc-zonos-checkout-h *.sc-zonos-checkout::-webkit-scrollbar-thumb:hover{background:#d6d6d6}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout{display:-ms-flexbox;display:flex;height:100%;overflow:hidden;border-radius:var(--border-radius, var(--amino-radius-10))}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout,.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{-ms-flex:1;flex:1;padding:var(--amino-space-48) var(--amino-space-56)}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout{background-color:var(--primary-color, var(--amino-gray-0));border-right:1px solid var(--amino-gray-200)}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{background-color:var(--amino-gray-0);padding-bottom:var(--amino-space-80)}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout{width:100%;max-height:100%;height:100%;overflow:auto;-ms-flex-direction:column;flex-direction:column;background-color:var(--amino-gray-0);-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;padding:var(--amino-space-24);padding-bottom:50px}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout .zonos--header.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center;width:100%}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout .zonos--header.sc-zonos-checkout img.sc-zonos-checkout{width:150px;min-width:150px}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout .zonos--logo.sc-zonos-checkout{margin-bottom:0}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout zonos-checkout-finish.sc-zonos-checkout{-ms-flex:1;flex:1}.sc-zonos-checkout-h .zonos--left.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}.sc-zonos-checkout-h .zonos--left.sc-zonos-checkout .zonos--back-button.sc-zonos-checkout{margin-bottom:var(--amino-space-24)}.sc-zonos-checkout-h .zonos--left.sc-zonos-checkout .zonos--wrapper.sc-zonos-checkout{padding:0 var(--amino-space-8) var(--amino-space-8)}.sc-zonos-checkout-h .zonos--left.sc-zonos-checkout .zonos--payment-error-banner.sc-zonos-checkout{margin-top:var(--amino-space-24)}.sc-zonos-checkout-h .zonos--right.sc-zonos-checkout{position:relative}.sc-zonos-checkout-h .zonos--right.sc-zonos-checkout .zonos--close-button.sc-zonos-checkout{position:absolute;right:var(--amino-space-24);top:var(--amino-space-24)}.sc-zonos-checkout-h .zonos--footer.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-pack:end;justify-content:flex-end;-ms-flex-align:center;align-items:center;position:absolute;bottom:var(--amino-space-32);right:var(--amino-space-56);gap:var(--amino-space-8)}.sc-zonos-checkout-h .zonos--wrapper.sc-zonos-checkout{overflow:auto;max-height:100%;position:relative}.sc-zonos-checkout-h .flex--wrapper.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;max-height:100%}.sc-zonos-checkout-h .zonos--logo.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.sc-zonos-checkout-h .zonos--checkout-default-message.sc-zonos-checkout{margin-left:var(--amino-space-76);margin-bottom:var(--amino-space-8)}.preview.sc-zonos-checkout-h{min-width:500px;margin:auto}.preview.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout{border:var(--amino-border)}.preview.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout{padding:var(--amino-space-32)}.mobile.sc-zonos-checkout-h{min-width:auto}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;overflow:auto;border-radius:0;max-height:100%;height:100%;border:0}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout,.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{padding:var(--amino-space-12)}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout{-ms-flex-order:2;order:2}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{-ms-flex-order:1;order:1;padding-top:var(--amino-space-16)}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout .zonos--wrapper.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:var(--amino-space-16);margin-top:var(--amino-space-24);border:var(--amino-border);border-radius:var(--border-radius, var(--amino-radius-10));background-color:var(--amino-gray-50);padding:var(--amino-space-12);margin-top:var(--amino-space-32)}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--wrapper.sc-zonos-checkout{max-height:100%}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--footer.sc-zonos-checkout{-ms-flex-order:3;order:3}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout{width:auto}.mobile.sc-zonos-checkout-h .zonos--cart-subtotal.sc-zonos-checkout{margin:0}.mobile.sc-zonos-checkout-h .zonos--footer.sc-zonos-checkout{bottom:0;left:0;padding:var(--amino-space-12);position:relative;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;background-color:var(--amino-gray-0)}";var P=o("zonos_checkout",function(){function o(o){var t=this;e(this,o);this.applyStripeTheme=function(){return __awaiter(t,void 0,void 0,(function(){var o,e,t,n;return __generator(this,(function(s){switch(s.label){case 0:n=((o=this.appearanceSettingsOverride)===null||o===void 0?void 0:o.theme)||b.appearance.theme;return[4,i({overrideBorderRaidus:(e=this.appearanceSettingsOverride)===null||e===void 0?void 0:e.style,overridePrimaryColor:(t=this.appearanceSettingsOverride)===null||t===void 0?void 0:t.colorPrimary,overrideTheme:this.isMobile?n:undefined})];case 1:s.sent();return[2]}}))}))};this.isShippableCountry=function(o){if(o===void 0){o=true}if(!v.localizationLoaded){return false}if(!v.isShippableCountry){if(o){k("Checkout: not shippable country")}return false}return true};this.getCurrentLocalePageEnum=function(){switch(c.step){case"customer-info":return"checkout_customer_info";case"shipping":return"checkout_shipping_info";case"payment":return"checkout_payment_info";default:return null}};this.appearanceSettingsOverride=undefined;this.preview=false;this.mobile=false;this.defaultAddress=null;this.forceDialogOpen=false;this.open=this.forceDialogOpen;this.stripe=window.Zonos.stripe;this.submitLoading=false;this.paymentError=false;this.collapseReviewMobile=false;this.isAttachError=false;this.isMobile=false;this.zonosReviewRef=undefined;this.storybookPaymentStatusOverride=undefined}o.prototype.initCartInfoHandler=function(o){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(t){e=o.detail;void r(e);return[2]}))}))};o.prototype.closeDialogHandler=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(o){w("zonos-checkout-close");this.open=this.forceDialogOpen||false;if(!this.preview&&c.step==="finish"){a()}c.step="customer-info";return[2]}))}))};o.prototype.buildCartAndInit=function(){return __awaiter(this,void 0,void 0,(function(){var o,e;return __generator(this,(function(t){switch(t.label){case 0:if(!b.checkoutSettings.buildCartDetail)return[3,3];k("build cart detail");return[4,b.checkoutSettings.buildCartDetail()];case 1:o=t.sent();return[4,r(o)];case 2:t.sent();t.label=3;case 3:if(!!u.clientSecret)return[3,5];return[4,l()];case 4:e=t.sent();k("stripeStoreInitCheckoutSession: ".concat(e));if(!e){return[2,false]}t.label=5;case 5:return[4,this.applyStripeTheme()];case 6:t.sent();return[2,true]}}))}))};o.prototype.attachCheckout=function(){var o=this;var e=b.checkoutSettings.placeOrderButtonSelector;if(!e){return}var t=document.querySelectorAll(e);t.forEach((function(e){var t=e.getAttribute("data-zonos-checkout-attached");if(t){return}e.addEventListener("click",(function(e){return __awaiter(o,void 0,void 0,(function(){var o,t;return __generator(this,(function(n){switch(n.label){case 0:if(!this.isShippableCountry()){return[2]}e.preventDefault();e.stopPropagation();k("zonos checkout button clicked");u.isFetchingSession=true;this.open=true;n.label=1;case 1:n.trys.push([1,3,,4]);return[4,this.buildCartAndInit()];case 2:o=n.sent();if(!o){throw new Error("Error building cart")}w("zonos-checkout-start");return[3,4];case 3:t=n.sent();u.isFetchingSession=false;h({messages:[g("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:g("Error creating Checkout")});return[3,4];case 4:return[2]}}))}))}));e.setAttribute("data-zonos-checkout-attached","true")}))};o.prototype.appearanceSettingsOverrideChanged=function(){if(!this.appearanceSettingsOverride){return}void this.applyStripeTheme()};o.prototype.init=function(){return __awaiter(this,void 0,void 0,(function(){var o,e;var t=this;return __generator(this,(function(n){u.stripe=window.Zonos.stripe;this.stripe=window.Zonos.stripe;o=setInterval((function(){var e=window.Zonos.internationalHideSelector;if(!e){clearInterval(o);return}var n=t.isShippableCountry(false);var s=document.querySelectorAll(e);if(!n){s===null||s===void 0?void 0:s.forEach((function(o){var e=o;var t=e.getAttribute("data-zonos-checkout-original-display")||getComputedStyle(e).display;e.style.display=t||"initial"}));return}s===null||s===void 0?void 0:s.forEach((function(o){var e=o;var t=e.style.display;e.setAttribute("data-zonos-checkout-original-display",t);e.style.display="none"}))}),100);e=setInterval((function(){u.stripe=window.Zonos.stripe;t.stripe=window.Zonos.stripe;if(!t.stripe){k("waiting for stripe to be loaded");return}if(t.storybookPaymentStatusOverride){clearInterval(e);return}k("init checkout");if(t.preview||t.forceDialogOpen){void t.buildCartAndInit()}else{t.attachCheckout();setInterval((function(){t.attachCheckout()}),50)}clearInterval(e)}),50);setTimeout((function(){clearInterval(e)}),1e4);return[2]}))}))};o.prototype.setToFinishStep=function(o){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){c.step="finish";this.storybookPaymentStatusOverride=o;return[2]}))}))};o.prototype.handleCustomerInfoContinue=function(){return __awaiter(this,void 0,void 0,(function(){var o;var e=this;return __generator(this,(function(t){switch(t.label){case 0:this.submitLoading=true;return[4,d()];case 1:t.sent();o=setInterval((function(){if(c.landedCostData||!u.isFetchingLandedCost){if(c.landedCostData){p()}e.submitLoading=false;clearInterval(o)}}),500);return[2]}}))}))};o.prototype.handleShippingContinue=function(){return __awaiter(this,void 0,void 0,(function(){var o=this;return __generator(this,(function(e){this.submitLoading=true;setTimeout((function(){p();o.submitLoading=false}),500);return[2]}))}))};o.prototype.handleCheckoutPaymentContinue=function(){return __awaiter(this,void 0,void 0,(function(){var o;return __generator(this,(function(e){switch(e.label){case 0:this.paymentError=false;this.submitLoading=true;e.label=1;case 1:e.trys.push([1,3,,4]);return[4,f()];case 2:e.sent();p();return[3,4];case 3:o=e.sent();console.error(o);this.paymentError=true;return[3,4];case 4:this.submitLoading=false;return[2]}}))}))};o.prototype.handleFinishClick=function(){return __awaiter(this,void 0,void 0,(function(){var o,e;return __generator(this,(function(t){switch(t.label){case 0:m();if(!this.preview)return[3,2];c.step="customer-info";return[4,this.init()];case 1:t.sent();return[2];case 2:a();o=window.location.href;e=o.split("?")[0];window.history.replaceState({},document.title,e);this.open=false;return[2]}}))}))};o.prototype.handleBackClick=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(o){switch(o.label){case 0:if(!(c.step==="customer-info"))return[3,2];return[4,this.closeDialogHandler()];case 1:o.sent();return[2];case 2:z();return[2]}}))}))};o.prototype.handleWindowResize=function(){this.isMobile=x(this.mobile);void this.applyStripeTheme();k("mobile: ".concat(this.isMobile))};o.prototype.handleMobileChange=function(){this.isMobile=x(this.mobile);void this.applyStripeTheme();k("mobile: ".concat(this.isMobile))};o.prototype.componentWillLoad=function(){void this.init();this.isMobile=x(this.mobile);k("mobile: ".concat(this.isMobile))};o.prototype.disconnectedCallback=function(){m();a()};o.prototype.render=function(){var o=this;var e;var i=c.step!=="finish"&&c.step!=="error"&&!u.stripeElements||u.isFetchingSession;var r=y(b.appearance,this.appearanceSettingsOverride),a=r.colorPrimary,l=r.colorSecondary,h=r.logoUrl,d=r.style;var p=b.appearance.zonosAttribution==="ENABLED";var f=b.appearance.theme;var m=a&&S(a)?"DARK":"LIGHT";var z=this.isMobile?f:m;var k=!this.isMobile?l:undefined;var w=v.customMessages;var x=((e=w.find((function(o){return o.pageName==="checkout_default"})))===null||e===void 0?void 0:e.message)||"Know about duties and taxes before you buy. Shop with confidence!";var B=this.getCurrentLocalePageEnum();var P=w.filter((function(o){return o.pageName===B}));var E=function(){return t("div",{class:"zonos--logo"},h&&t("img",{alt:"".concat(b.organizationName," logo"),src:h,width:100}))};var H=function(){return t("zonos-v-stack",null,E(),P.map((function(o){return t("zonos-custom-message",{icon:L,message:o.message})})),t("div",null,t("zonos-button",{class:"zonos--back-button",icon:t("zonos-icon",{content:M}),noBackground:true,noPaddingLeft:true,noPaddingRight:true,onClick:function(){return o.handleBackClick()},theme:z},g("Back"))))};var j=function(){return p&&t("div",{class:"zonos--footer","data-theme":f},t("zonos-text",{type:"hintText"},g("Powered by")),t("zonos-logo",{theme:f,width:"100px"}))};var D=function(){var e;var s=o.isMobile?"primary":undefined;var i=(e=o.zonosReviewRef)===null||e===void 0?void 0:e.scrollHeight;return t("div",{class:"zonos--content",style:{"--border-radius":_(d)}},c.step!=="finish"&&c.step!=="error"&&t(n,null,t("div",{class:"zonos--left","data-theme":z,style:{"--primary-color":!o.isMobile?a:""}},!o.isMobile&&H(),c.step==="customer-info"&&t("zonos-customer-info",{continueLoading:o.submitLoading,defaultAddress:o.defaultAddress,onContinueClicked:function(){return o.handleCustomerInfoContinue()},submitBtnColor:k,submitBtnType:s}),c.step==="shipping"&&t("zonos-shipping",{continueLoading:o.submitLoading,onContinueClicked:function(){return o.handleShippingContinue()},submitBtnColor:k,submitBtnType:s}),c.step==="payment"&&t("zonos-checkout-payment",{continueLoading:o.submitLoading,onContinueClicked:function(){return o.handleCheckoutPaymentContinue()},paymentError:o.paymentError,submitBtnColor:k,submitBtnType:s})),t("div",{class:"zonos--right","data-theme":f},o.isMobile&&H(),!o.isMobile&&t("zonos-button",{class:"zonos--close-button",icon:t("zonos-icon",{content:O}),noBackground:true,onClick:function(){return o.closeDialogHandler()}}),t("div",{class:"flex--wrapper"},t("div",{class:"zonos--wrapper"},t("zonos-collapse",{collapseSize:i,collapsed:o.collapseReviewMobile&&o.isMobile},t("zonos-review",{collapsed:o.collapseReviewMobile,mobile:o.isMobile,onClick:function(){if(!o.isMobile){return}o.collapseReviewMobile=!o.collapseReviewMobile},ref:function(e){return o.zonosReviewRef=e}}),t("zonos-cart-items",null))),t("zonos-v-stack",{spacing:16},t("zonos-cart-subtotal",null),t("zonos-custom-message",{class:"zonos--checkout-default-message",icon:L,message:x}))),!o.isMobile&&j()),o.isMobile&&j()),(c.step==="finish"||c.step==="error")&&t("div",{class:"zonos--done","data-theme":f},t("div",{class:"zonos--header"},E(),t("zonos-button",{class:"zonos--close-button",icon:t("zonos-icon",{content:O}),noBackground:true,onClick:function(){return o.handleFinishClick()},theme:f})),t("zonos-checkout-finish",{borderRadius:d,onCloseClick:function(){return o.handleFinishClick()},overrideNotification:c.step==="error"&&!!c.error?Object.assign(Object.assign({},c.error),{type:"error"}):undefined,storybookForceStatus:o.storybookPaymentStatusOverride})))};return t(s,{class:C(["zonos--checkout zonos--elements",p&&"has-footer",this.preview&&"preview",this.isMobile&&"mobile"])},this.preview?D():t("zonos-dialog",{borderStyle:d,"data-theme":f,height:"980px",isLoading:i,mobile:this.isMobile,noBodyPadding:true,noBorder:true,noClickOutside:true,noCloseButton:true,onCloseDialog:function(){return o.closeDialogHandler()},open:this.open,width:"1200px"},D()))};Object.defineProperty(o,"assetsDirs",{get:function(){return["assets"]},enumerable:false,configurable:true});Object.defineProperty(o,"watchers",{get:function(){return{appearanceSettingsOverride:["appearanceSettingsOverrideChanged"],mobile:["handleMobileChange"]}},enumerable:false,configurable:true});return o}());P.style=B}}}));
@@ -1 +1 @@
1
- var __awaiter=this&&this.__awaiter||function(t,n,e,s){function o(t){return t instanceof e?t:new e((function(n){n(t)}))}return new(e||(e=Promise))((function(e,i){function a(t){try{c(s.next(t))}catch(t){i(t)}}function r(t){try{c(s["throw"](t))}catch(t){i(t)}}function c(t){t.done?e(t.value):o(t.value).then(a,r)}c((s=s.apply(t,n||[])).next())}))};var __generator=this&&this.__generator||function(t,n){var e={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},s,o,i,a;return a={next:r(0),throw:r(1),return:r(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function r(t){return function(n){return c([t,n])}}function c(r){if(s)throw new TypeError("Generator is already executing.");while(a&&(a=0,r[0]&&(e=0)),e)try{if(s=1,o&&(i=r[0]&2?o["return"]:r[0]?o["throw"]||((i=o["return"])&&i.call(o),0):o.next)&&!(i=i.call(o,r[1])).done)return i;if(o=0,i)r=[r[0]&2,i.value];switch(r[0]){case 0:case 1:i=r;break;case 4:e.label++;return{value:r[1],done:false};case 5:e.label++;o=r[1];r=[0];continue;case 7:r=e.ops.pop();e.trys.pop();continue;default:if(!(i=e.trys,i=i.length>0&&i[i.length-1])&&(r[0]===6||r[0]===2)){e=0;continue}if(r[0]===3&&(!i||r[1]>i[0]&&r[1]<i[3])){e.label=r[1];break}if(r[0]===6&&e.label<i[1]){e.label=i[1];i=r;break}if(i&&e.label<i[2]){e.label=i[2];e.ops.push(r);break}if(i[2])e.ops.pop();e.trys.pop();continue}r=n.call(t,e)}catch(t){r=[6,t];o=0}finally{s=i=0}if(r[0]&5)throw r[1];return{value:r[0]?r[1]:void 0,done:true}}};System.register(["./p-68d06767.system.js","./p-8db8cc05.system.js","./p-164fae93.system.js","./p-6dcd752e.system.js","./p-85ab35c9.system.js","./p-8c867835.system.js"],(function(t){"use strict";var n,e,s,o,i,a,r,c;return{setters:[function(t){n=t.r;e=t.h;s=t.H;o=t.d},function(t){i=t.s;a=t.m},function(t){r=t.b;c=t.a},function(){},function(){},function(){}],execute:function(){var l=".sc-zonos-address-h{font-family:Inter;display:block}.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)}";var d=t("zonos_address",function(){function t(t){n(this,t);this.type=undefined;this.titleText=undefined;this.defaultAddress=null;this.stripe=window.Zonos.stripe}t.prototype.watchInitStripe=function(){return __awaiter(this,void 0,void 0,(function(){var t,n,e,s,o;return __generator(this,(function(l){this.stripe=window.Zonos.stripe;if(!this.stripe||!i.stripeElements){r("Stripe is not initialized. Couldn't load stripe element.");return[2]}e=(t=this.defaultAddress)===null||t===void 0?void 0:t.phone;if(!e){(n=this.defaultAddress)===null||n===void 0?true:delete n.phone}s=c.shippingZoneCountries;o=i.stripeAddressElement||i.stripeElements.create("address",{allowedCountries:s?Object.values(s).map((function(t){return t.code})):[],contacts:this.defaultAddress?[this.defaultAddress]:undefined,defaultValues:{address:{country:c.selectedCountryCode||"AL"}},display:{name:"split"},fields:{phone:"always"},mode:this.type,validation:{phone:{required:"always"}}});o.mount(this.el.querySelector(".zonos--address-component"));o.on("change",(function(t){var n=t.value;i.stripeAddressEventData=Object.assign(Object.assign({},t),{elementMode:"shipping",elementType:"address",empty:false,value:Object.assign(Object.assign({},n),{firstName:n.firstName||n.name.split(" ")[0],lastName:n.lastName||n.name.split(" ").pop()})});void a()}));i.stripeAddressElement=o;return[2]}))}))};t.prototype.componentDidLoad=function(){void this.watchInitStripe()};t.prototype.render=function(){return e(s,{class:"zonos--address zonos--elements"},e("zonos-text",{class:"zonos--title",type:"semiBoldLabel"},this.titleText),e("div",{class:"zonos--address-component"}))};Object.defineProperty(t.prototype,"el",{get:function(){return o(this)},enumerable:false,configurable:true});Object.defineProperty(t,"watchers",{get:function(){return{stripe:["watchInitStripe"]}},enumerable:false,configurable:true});return t}());d.style=l;var u=".sc-zonos-link-authentication-h{font-family:Inter;display:block}.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)}";var h=t("zonos_link_authentication",function(){function t(t){n(this,t);this.titleText=undefined;this.stripe=i.stripe}t.prototype.watchInitStripe=function(){if(!this.stripe||!i.stripeElements){return}var t=i.stripeLinkElement||i.stripeElements.create("linkAuthentication");var n=this.el.querySelector(".zonos--link-authentication-component");if(!n){console.error("Cannot find container element for linkAuthenticationElement");return}t.mount(n);t.on("change",(function(t){i.stripeLinkEventData=t;void a()}));i.stripeLinkElement=t};t.prototype.componentDidLoad=function(){this.watchInitStripe()};t.prototype.render=function(){return e(s,{class:"zonos--link-authentication zonos--elements"},e("zonos-text",{class:"zonos--title",type:"semiBoldLabel"},this.titleText),e("div",{class:"zonos--link-authentication-component"}))};Object.defineProperty(t.prototype,"el",{get:function(){return o(this)},enumerable:false,configurable:true});Object.defineProperty(t,"watchers",{get:function(){return{stripe:["watchInitStripe"]}},enumerable:false,configurable:true});return t}());h.style=u}}}));
1
+ var __awaiter=this&&this.__awaiter||function(t,n,e,s){function o(t){return t instanceof e?t:new e((function(n){n(t)}))}return new(e||(e=Promise))((function(e,i){function a(t){try{c(s.next(t))}catch(t){i(t)}}function r(t){try{c(s["throw"](t))}catch(t){i(t)}}function c(t){t.done?e(t.value):o(t.value).then(a,r)}c((s=s.apply(t,n||[])).next())}))};var __generator=this&&this.__generator||function(t,n){var e={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},s,o,i,a;return a={next:r(0),throw:r(1),return:r(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function r(t){return function(n){return c([t,n])}}function c(r){if(s)throw new TypeError("Generator is already executing.");while(a&&(a=0,r[0]&&(e=0)),e)try{if(s=1,o&&(i=r[0]&2?o["return"]:r[0]?o["throw"]||((i=o["return"])&&i.call(o),0):o.next)&&!(i=i.call(o,r[1])).done)return i;if(o=0,i)r=[r[0]&2,i.value];switch(r[0]){case 0:case 1:i=r;break;case 4:e.label++;return{value:r[1],done:false};case 5:e.label++;o=r[1];r=[0];continue;case 7:r=e.ops.pop();e.trys.pop();continue;default:if(!(i=e.trys,i=i.length>0&&i[i.length-1])&&(r[0]===6||r[0]===2)){e=0;continue}if(r[0]===3&&(!i||r[1]>i[0]&&r[1]<i[3])){e.label=r[1];break}if(r[0]===6&&e.label<i[1]){e.label=i[1];i=r;break}if(i&&e.label<i[2]){e.label=i[2];e.ops.push(r);break}if(i[2])e.ops.pop();e.trys.pop();continue}r=n.call(t,e)}catch(t){r=[6,t];o=0}finally{s=i=0}if(r[0]&5)throw r[1];return{value:r[0]?r[1]:void 0,done:true}}};System.register(["./p-68d06767.system.js","./p-f6add79c.system.js","./p-164fae93.system.js","./p-6dcd752e.system.js","./p-85ab35c9.system.js","./p-8c867835.system.js"],(function(t){"use strict";var n,e,s,o,i,a,r,c;return{setters:[function(t){n=t.r;e=t.h;s=t.H;o=t.d},function(t){i=t.s;a=t.m},function(t){r=t.b;c=t.a},function(){},function(){},function(){}],execute:function(){var l=".sc-zonos-address-h{font-family:Inter;display:block}.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)}";var d=t("zonos_address",function(){function t(t){n(this,t);this.type=undefined;this.titleText=undefined;this.defaultAddress=null;this.stripe=window.Zonos.stripe}t.prototype.watchInitStripe=function(){return __awaiter(this,void 0,void 0,(function(){var t,n,e,s,o;return __generator(this,(function(l){this.stripe=window.Zonos.stripe;if(!this.stripe||!i.stripeElements){r("Stripe is not initialized. Couldn't load stripe element.");return[2]}e=(t=this.defaultAddress)===null||t===void 0?void 0:t.phone;if(!e){(n=this.defaultAddress)===null||n===void 0?true:delete n.phone}s=c.shippingZoneCountries;o=i.stripeAddressElement||i.stripeElements.create("address",{allowedCountries:s?Object.values(s).map((function(t){return t.code})):[],contacts:this.defaultAddress?[this.defaultAddress]:undefined,defaultValues:{address:{country:c.selectedCountryCode||"AL"}},display:{name:"split"},fields:{phone:"always"},mode:this.type,validation:{phone:{required:"always"}}});o.mount(this.el.querySelector(".zonos--address-component"));o.on("change",(function(t){var n=t.value;i.stripeAddressEventData=Object.assign(Object.assign({},t),{elementMode:"shipping",elementType:"address",empty:false,value:Object.assign(Object.assign({},n),{firstName:n.firstName||n.name.split(" ")[0],lastName:n.lastName||n.name.split(" ").pop()})});void a()}));i.stripeAddressElement=o;return[2]}))}))};t.prototype.componentDidLoad=function(){void this.watchInitStripe()};t.prototype.render=function(){return e(s,{class:"zonos--address zonos--elements"},e("zonos-text",{class:"zonos--title",type:"semiBoldLabel"},this.titleText),e("div",{class:"zonos--address-component"}))};Object.defineProperty(t.prototype,"el",{get:function(){return o(this)},enumerable:false,configurable:true});Object.defineProperty(t,"watchers",{get:function(){return{stripe:["watchInitStripe"]}},enumerable:false,configurable:true});return t}());d.style=l;var u=".sc-zonos-link-authentication-h{font-family:Inter;display:block}.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)}";var h=t("zonos_link_authentication",function(){function t(t){n(this,t);this.titleText=undefined;this.stripe=i.stripe}t.prototype.watchInitStripe=function(){if(!this.stripe||!i.stripeElements){return}var t=i.stripeLinkElement||i.stripeElements.create("linkAuthentication");var n=this.el.querySelector(".zonos--link-authentication-component");if(!n){console.error("Cannot find container element for linkAuthenticationElement");return}t.mount(n);t.on("change",(function(t){i.stripeLinkEventData=t;void a()}));i.stripeLinkElement=t};t.prototype.componentDidLoad=function(){this.watchInitStripe()};t.prototype.render=function(){return e(s,{class:"zonos--link-authentication zonos--elements"},e("zonos-text",{class:"zonos--title",type:"semiBoldLabel"},this.titleText),e("div",{class:"zonos--link-authentication-component"}))};Object.defineProperty(t.prototype,"el",{get:function(){return o(this)},enumerable:false,configurable:true});Object.defineProperty(t,"watchers",{get:function(){return{stripe:["watchInitStripe"]}},enumerable:false,configurable:true});return t}());h.style=u}}}));
@@ -1 +1 @@
1
- import{r as o,c as i,h as s,H as r}from"./p-dc8d7000.js";import{z as t}from"./p-08695f4e.js";import{c as e}from"./p-b4b7f705.js";import{g as a}from"./p-0e0b46a5.js";import{i as n}from"./p-0636859b.js";const l=class{constructor(s){o(this,s),this.radioSelected=i(this,"radioSelected",7),this.handleRichRadioSelect=o=>{var i;this.selectedItem=o,null===(i=this.radioSelected)||void 0===i||i.emit(o)},this.getRadioItemStyleVariables=()=>{const o=this.borderColor||t.appearance.colorSecondary,i=n(o)?`var(--amino-${o})`:o;return{"--border-radius":a(this.borderStyle),"--selected-border-color":i||"unset"}},this.items=void 0,this.borderColor=void 0,this.borderStyle=void 0,this.theme=void 0,this.selectedItem=null}render(){var o;return s(r,{class:"zonos--shipping-rich-radio zonos--elements","data-theme":this.theme,style:this.getRadioItemStyleVariables()},null===(o=this.items)||void 0===o?void 0:o.map((o=>{var i;const r=(null===(i=this.selectedItem)||void 0===i?void 0:i.value)===o.value;return s("div",{"aria-hidden":"true",class:e(["zonos--shipping-rich-radio-item",r&&"selected"]),onClick:()=>this.handleRichRadioSelect(o)},s("input",{checked:r,class:"zonos--shipping-rich-radio-input",name:"zonos--shipping-rich-radio",type:"radio",value:o.value}),s("div",{class:"zonos--shipping-info"},s("div",{class:"zonos--shipping-detail"},s("zonos-text",{class:"zonos--shipping-label",type:"label"},o.label),(o.sublabel||o.caption)&&s("div",{class:"zonos--sub-detail"},o.sublabel&&s("zonos-text",{color:"gray-800"},o.sublabel),o.caption&&s("zonos-text",{color:"gray-400"},o.caption))),s("zonos-text",{type:"semiBoldLabel"},o.price)))})))}};l.style=":host{font-family:Inter;display:block}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}:host input{margin:0;accent-color:var(--selected-border-color, var(--amino-blue-600))}:host .zonos--shipping-rich-radio-item{display:-ms-flexbox;display:flex;-ms-flex:1;flex:1;padding:var(--amino-space-16);-ms-flex-align:center;align-items:center;gap:var(--amino-space-16);cursor:pointer;border:1px solid var(--amino-gray-200)}:host .zonos--shipping-rich-radio-item:first-child{border-top-left-radius:var(--border-radius, var(--amino-radius-10));border-top-right-radius:var(--border-radius, var(--amino-radius-10))}:host .zonos--shipping-rich-radio-item:last-child{border-bottom-right-radius:var(--border-radius, var(--amino-radius-10))}:host .zonos--shipping-rich-radio-item:not(:last-child){border-bottom:none}:host .zonos--shipping-rich-radio-item.selected{outline:1px solid var(--selected-border-color, var(--amino-blue-600));outline-offset:-1px}:host .zonos--shipping-info{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex:1;flex:1}:host .zonos--shipping-detail{-ms-flex:1;flex:1}:host .zonos--sub-detail{display:-ms-inline-flexbox;display:inline-flex;gap:8px;-ms-flex-wrap:wrap;flex-wrap:wrap}";export{l as zonos_shipping_rich_radio}
1
+ import{r as o,c as i,h as s,H as r}from"./p-dc8d7000.js";import{z as t}from"./p-08695f4e.js";import{c as e}from"./p-b4b7f705.js";import{g as a}from"./p-0e0b46a5.js";import{i as n}from"./p-0636859b.js";const l=class{constructor(s){o(this,s),this.radioSelected=i(this,"radioSelected",7),this.handleRichRadioSelect=o=>{var i;this.selectedItem=o,null===(i=this.radioSelected)||void 0===i||i.emit(o)},this.getRadioItemStyleVariables=()=>{const o=this.borderColor||t.appearance.colorSecondary,i=n(o)?`var(--amino-${o})`:o;return{"--border-radius":a(this.borderStyle),"--selected-border-color":i||"unset"}},this.items=void 0,this.borderColor=void 0,this.borderStyle=void 0,this.theme=void 0,this.selectedItem=null}render(){var o;return s(r,{class:"zonos--shipping-rich-radio zonos--elements","data-theme":this.theme,style:this.getRadioItemStyleVariables()},null===(o=this.items)||void 0===o?void 0:o.map((o=>{var i;const r=(null===(i=this.selectedItem)||void 0===i?void 0:i.value)===o.value;return s("div",{"aria-hidden":"true",class:e(["zonos--shipping-rich-radio-item",r&&"selected"]),onClick:()=>this.handleRichRadioSelect(o)},s("input",{checked:r,class:"zonos--shipping-rich-radio-input",name:"zonos--shipping-rich-radio",type:"radio",value:o.value}),s("div",{class:"zonos--shipping-info"},s("div",{class:"zonos--shipping-detail"},s("zonos-text",{class:"zonos--shipping-label",type:"label"},o.label),(o.sublabel||o.caption)&&s("div",{class:"zonos--sub-detail"},o.sublabel&&s("zonos-text",{color:"gray-800"},o.sublabel),o.caption&&s("zonos-text",{color:"gray-400"},o.caption))),s("zonos-text",{type:"semiBoldLabel"},o.price)))})))}};l.style=":host{font-family:Inter;display:block}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}:host input{margin:0;accent-color:var(--selected-border-color, var(--amino-blue-600))}:host .zonos--shipping-rich-radio-item{display:-ms-flexbox;display:flex;-ms-flex:1;flex:1;padding:var(--amino-space-16);-ms-flex-align:center;align-items:center;gap:var(--amino-space-16);cursor:pointer;border:1px solid var(--amino-gray-200)}:host .zonos--shipping-rich-radio-item:first-child{border-top-left-radius:var(--border-radius, var(--amino-radius-10));border-top-right-radius:var(--border-radius, var(--amino-radius-10))}:host .zonos--shipping-rich-radio-item:last-child{border-bottom-right-radius:var(--border-radius, var(--amino-radius-10));border-bottom-left-radius:var(--border-radius, var(--amino-radius-10))}:host .zonos--shipping-rich-radio-item:not(:last-child){border-bottom:none}:host .zonos--shipping-rich-radio-item.selected{outline:1px solid var(--selected-border-color, var(--amino-blue-600));outline-offset:-1px}:host .zonos--shipping-info{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex:1;flex:1}:host .zonos--shipping-detail{-ms-flex:1;flex:1}:host .zonos--sub-detail{display:-ms-inline-flexbox;display:inline-flex;gap:8px;-ms-flex-wrap:wrap;flex-wrap:wrap}";export{l as zonos_shipping_rich_radio}
@@ -0,0 +1 @@
1
+ var __awaiter=this&&this.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r["throw"](e))}catch(e){s(e)}}function l(e){e.done?n(e.value):i(e.value).then(o,a)}l((r=r.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var n={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(e){return function(t){return l([e,t])}}function l(a){if(r)throw new TypeError("Generator is already executing.");while(o&&(o=0,a[0]&&(n=0)),n)try{if(r=1,i&&(s=a[0]&2?i["return"]:a[0]?i["throw"]||((s=i["return"])&&s.call(i),0):i.next)&&!(s=s.call(i,a[1])).done)return s;if(i=0,s)a=[a[0]&2,s.value];switch(a[0]){case 0:case 1:s=a;break;case 4:n.label++;return{value:a[1],done:false};case 5:n.label++;i=a[1];a=[0];continue;case 7:a=n.ops.pop();n.trys.pop();continue;default:if(!(s=n.trys,s=s.length>0&&s[s.length-1])&&(a[0]===6||a[0]===2)){n=0;continue}if(a[0]===3&&(!s||a[1]>s[0]&&a[1]<s[3])){n.label=a[1];break}if(a[0]===6&&n.label<s[1]){n.label=s[1];s=a;break}if(s&&n.label<s[2]){n.label=s[2];n.ops.push(a);break}if(s[2])n.ops.pop();n.trys.pop();continue}a=t.call(e,n)}catch(e){a=[6,e];i=0}finally{r=s=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};System.register(["./p-6dcd752e.system.js","./p-164fae93.system.js","./p-85ab35c9.system.js","./p-8c867835.system.js"],(function(e){"use strict";var t,n,r,i,s,o,a,l,c;return{setters:[function(e){t=e.c;n=e.z},function(e){r=e.h;i=e.l;s=e.a;o=e.b;a=e.t},function(e){l=e.i},function(e){c=e.g}],execute:function(){var u=this;var d=function(){var e=y.stripeLinkEventData;var t=y.stripeAddressEventData;if(!t||!t.complete){throw new Error("Missing stripe address data")}return{checkoutSessionId:j.checkoutSessionId||"",contact:{email:(e===null||e===void 0?void 0:e.value.email)||"",firstName:t.value.firstName||"",lastName:t.value.lastName||"",phone:t.value.phone||""},items:j.items.map((function(e){return e})),shippingAddress:{addressLine1:t.value.address.line1,addressLine2:t.value.address.line2||"",city:t.value.address.city,country:t.value.address.country,postalCode:t.value.address.postal_code,state:t.value.address.state}}};var p=function(e){return __awaiter(u,void 0,void 0,(function(){var t,n,i,s;return __generator(this,(function(o){switch(o.label){case 0:t="".concat("https://v1.route.js.zonos.com","/api/calculate-landed-cost");return[4,r(t,{body:d(),method:"POST",signal:e===null||e===void 0?void 0:e.signal})];case 1:n=o.sent(),i=n.errors,s=n.json;if(i.length||!s){throw new Error("Failed to calculate landed cost")}return[2,s]}}))}))};var v=function(e){var t=e.theme;switch(t){default:return{".Input":{padding:"0",paddingBottom:"8px",paddingLeft:"16px",paddingRight:"8px",paddingTop:"6px"}}}};var f=function(e){var t=e.borderStyle,n=e.theme;switch(n){case"DARK":return{borderRadius:c(t),colorBackground:"#101117",colorBackgroundText:"#C5C6CA",colorText:"#C5C6CA",colorTextPlaceholder:"#C5C6CA"};default:return{borderRadius:c(t)}}};var h=t((function(){return{clientSecret:sessionStorage.getItem("zonos--client-secret")||null,fetchingLandedCostAbordController:null,isFetchingLandedCost:false,isFetchingSession:false,stripe:null,stripeAddressElement:null,stripeAddressEventData:null,stripeAddressUsedWhenFetchingLC:null,stripeElements:null,stripeElementsOptions:null,stripeLinkElement:null,stripeLinkEventData:null,stripeLinkUsedWhenFetchingLC:null,stripePaymentElement:null,stripePaymentEventData:null}})),m=h.onChange,g=h.reset,y=h.state;e("s",y);var S=function(e){var t=e.clientSecret,r=e.overrideBorderRaidus,i=e.overridePrimaryColor,o=e.overrideTheme;var a=i||n.appearance.colorPrimary;var c=a&&l(a)?"night":"flat";var u=o==="DARK"?"night":"flat";return{appearance:{labels:"floating",rules:Object.assign({},v({theme:"LIGHT"})),theme:o?u:c,variables:Object.assign({},f({borderStyle:r,theme:"LIGHT"}))},clientSecret:t,locale:s.selectedLocale}};var C=e("k",(function(e){return __awaiter(u,void 0,void 0,(function(){var t,n,r,s;return __generator(this,(function(o){n=y.clientSecret;if(!y.stripe){i("Skip. Stripe is not initialized");return[2]}if(n){r=S({clientSecret:n,overrideBorderRaidus:e===null||e===void 0?void 0:e.overrideBorderRaidus,overridePrimaryColor:e===null||e===void 0?void 0:e.overridePrimaryColor,overrideTheme:e===null||e===void 0?void 0:e.overrideTheme});s=JSON.stringify(r)===JSON.stringify(y.stripeElementsOptions);if(!y.stripeElements){y.stripeElements=(t=y.stripe)===null||t===void 0?void 0:t.elements(r);y.stripeElementsOptions=r;i("Stripe elements initialized");return[2]}if(!s){y.stripeElements.update(r);y.stripeElementsOptions=r}i("Stripe elements initialized")}return[2]}))}))}));var b=e("o",(function(){sessionStorage.removeItem("zonos--client-secret");g();y.stripe=window.Zonos.stripe}));var w=function(){var e,t,n,r;var i=y.fetchingLandedCostAbordController;if(!i){return false}var s=JSON.stringify((e=y.stripeLinkUsedWhenFetchingLC)===null||e===void 0?void 0:e.value)!==JSON.stringify((t=y.stripeLinkEventData)===null||t===void 0?void 0:t.value);var o=JSON.stringify((n=y.stripeAddressUsedWhenFetchingLC)===null||n===void 0?void 0:n.value)!==JSON.stringify((r=y.stripeAddressEventData)===null||r===void 0?void 0:r.value);return s||o};var _=e("m",(function(){return __awaiter(u,void 0,void 0,(function(){var e,t,n,r,i,s,a,l,c,u,d,v,f,h;return __generator(this,(function(m){switch(m.label){case 0:i=!!((e=y.stripeAddressEventData)===null||e===void 0?void 0:e.complete);s=!!((t=y.stripeLinkEventData)===null||t===void 0?void 0:t.complete);a=w();if(a){(n=y.fetchingLandedCostAbordController)===null||n===void 0?void 0:n.abort();y.fetchingLandedCostAbordController=null}if(!(i&&s&&(a||!y.isFetchingLandedCost)))return[3,5];y.isFetchingLandedCost=true;if(y.stripeAddressEventData){y.stripeAddressUsedWhenFetchingLC=Object.assign({},y.stripeAddressEventData)}if(y.stripeLinkEventData){y.stripeLinkUsedWhenFetchingLC=Object.assign({},y.stripeLinkEventData)}m.label=1;case 1:m.trys.push([1,3,,4]);l=new AbortController;y.fetchingLandedCostAbordController=l;return[4,p(l)];case 2:c=m.sent(),u=c.checkoutSessionWorkflow,d=c.shipmentRatingCalculateWorkflow;y.fetchingLandedCostAbordController=null;j.landedCostData=(u===null||u===void 0?void 0:u.filter(Boolean))||null;j.shippingData=(d===null||d===void 0?void 0:d.filter(Boolean))||null;v=(r=j.landedCostData)===null||r===void 0?void 0:r.find(Boolean);f=!!v?v.subtotals:null;if(f){N({exchangeRate:f.exchangeRate,items:f.items,landedCostTotal:0,presentmentCurrencyCode:f.presentmentCurrencyCode,shipping:0,total:f.items})}return[3,4];case 3:h=m.sent();o(h);return[3,4];case 4:y.isFetchingLandedCost=false;m.label=5;case 5:return[2]}}))}))}));var k=function(e){var t=[];var n=true;switch(e){case"succeeded":{t=[a("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."),"","",a("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=false;break}case"requires_capture":case"processing":{t=[a("Payment processing. We'll update you when payment is received.")];n=false;break}case"requires_payment_method":{t=[a("Payment failed. Please try another payment method.")];break}default:{t=[a("Something went wrong.")];break}}return{isError:n,messages:t}};var E=e("p",(function(e){var t=e.clientSecret,n=e.storybookForceStatus;return __awaiter(u,void 0,void 0,(function(){var e,r,i,s,l,c,u,d,p;return __generator(this,(function(v){switch(v.label){case 0:if(n){e=k(n),r=e.isError,i=e.messages;return[2,{error:r,messages:i}]}s=t||y.clientSecret;if(!y.stripe||!s){o("Failed to retrieve payment intent. Stripe is not initialized");return[2,{error:true,message:[a("Something went wrong.")]}]}return[4,y.stripe.retrievePaymentIntent(s)];case 1:l=v.sent().paymentIntent;c=l===null||l===void 0?void 0:l.status;u=k(c),d=u.isError,p=u.messages;return[2,{error:d,messages:p}]}}))}))}));var A=e("n",(function(){return __awaiter(u,void 0,void 0,(function(){var e,t,n,r,i,s,o,a;return __generator(this,(function(l){switch(l.label){case 0:r=!!((e=y.stripePaymentEventData)===null||e===void 0?void 0:e.complete);i=y.stripeElements;s=y.stripe;o=y.clientSecret;if(!(s&&i&&r&&o))return[3,2];return[4,s.confirmPayment({confirmParams:{receipt_email:(n=(t=y.stripeLinkEventData)===null||t===void 0?void 0:t.value)===null||n===void 0?void 0:n.email,return_url:window.location.href},elements:i,redirect:"if_required"})];case 1:a=l.sent().error;if(a){if(a.type==="card_error"||a.type==="validation_error"){throw new Error(a.message)}if(a.type==="invalid_request_error"){if(a.code==="payment_intent_unexpected_state"){return[2]}}throw new Error("An unexpected error occurred.")}l.label=2;case 2:return[2]}}))}))}));var T=e("l",(function(){return __awaiter(u,void 0,void 0,(function(){var e,t,n,a,l,c;return __generator(this,(function(u){switch(u.label){case 0:t=j.items.reduce((function(e,t){return e+t.amount*t.quantity}),0);if(!t||!s.targetCurrency){o("Fail to create checkout session - invalid total or currency");return[2,false]}y.isFetchingSession=true;return[4,r("".concat("https://v1.route.js.zonos.com","/api/create-checkout-session"),{body:{currency:((e=j.items.find(Boolean))===null||e===void 0?void 0:e.currencyCode)||"",itemsAmount:t,presentmentCountryCode:s.selectedCountryCode||null},method:"POST"})];case 1:n=u.sent(),a=n.errors,l=n.json;y.isFetchingSession=false;if(a.length||!l){o("Error occurs when creating checkout session",JSON.stringify(a,null,2));return[2,false]}c=l.checkoutSessionCreate;y.clientSecret=c.clientSecret;j.checkoutSessionId=c.id;N(Object.assign(Object.assign({},c.subtotals),{landedCostTotal:0,shipping:0,total:c.subtotals.items}));i("Exchange rate updated for cart items (checkout session create)","info",j.exchangeRate);i("done-init-checkout-session");return[2,true]}}))}))}));var x=function(e){var t=e.currency,n=e.id,i=e.itemsAmount,s=e.landedCostId,a=e.presentmentCountryCode;return __awaiter(u,void 0,void 0,(function(){var e,l,c;return __generator(this,(function(u){switch(u.label){case 0:return[4,r("".concat("https://v1.route.js.zonos.com","/api/update-checkout-session"),{body:{currency:t,id:n,itemsAmount:i,landedCostId:s,presentmentCountryCode:a},method:"POST"})];case 1:e=u.sent(),l=e.errors,c=e.json;if(l.length||!c){o("Error occurs when updating checkout session",JSON.stringify(l,null,2));return[2,{errors:l,json:c}]}return[2,{errors:[],json:c}]}}))}))};m("clientSecret",(function(e){if(e&&y.stripe){sessionStorage.setItem("zonos--client-secret",e)}if(!e){sessionStorage.removeItem("zonos--client-secret")}}));var D=function(e){var t=e.date,n=e.formatOptions,r=n===void 0?{day:"numeric",weekday:"long",year:"numeric"}:n;return new Intl.DateTimeFormat("en-US",r).format(t)};var L=function(e){var t=new Date;var n=e.getTime()-t.getTime();var r=Math.floor(n/(1e3*60*60*24));return r};var O=t((function(){return{checkoutSessionId:sessionStorage.getItem("zonos--checkout-session-id")||null,currency:"USD",dutiesTaxFees:0,error:null,exchangeRate:null,isSelectedShippingAboveDeminimis:false,isSelectedShippingGuarantee:false,items:[],landedCostData:null,selectedLandedCost:null,selectedShippingOption:null,selectedShippingOptionExpectedDate:"",selectedShippingOptionTransitTime:"",shipping:0,shippingData:null,step:"customer-info",subtotal:0,total:0}})),I=O.onChange,F=O.reset,j=O.state;e("c",j);var P=e("b",(function(e){var t=e.minTransitAt?L(new Date(e.minTransitAt)):"";var n=e.maxTransitAt?L(new Date(e.maxTransitAt)):"";var r=e.minTransitAt?D({date:new Date(e.minTransitAt)}):"";return{expectedDate:r,maxTransit:n,minTransit:t}}));var R=e("g",(function(){sessionStorage.removeItem("zonos--checkout-session-id");F()}));var z=e("j",(function(e){var t=e.messages,n=e.title;j.step="error";j.error={messages:t,title:n}}));var N=e("a",(function(e){j.exchangeRate=e.exchangeRate;j.dutiesTaxFees=e.landedCostTotal;j.subtotal=e.items;j.total=e.total;j.currency=e.presentmentCurrencyCode}));var B=e("f",(function(e){var t=e.currency,n=e.itemsAmount,r=e.landedCostId;return __awaiter(u,void 0,void 0,(function(){var e,l;return __generator(this,(function(c){switch(c.label){case 0:if(r&&j.selectedLandedCost){e=j.selectedLandedCost.subtotals;N(e);i("Exchange rate updated for cart items (landed cost subtotal)","info",j.exchangeRate)}if(!j.checkoutSessionId){o("Could update cart total without checkout session id");return[2,false]}return[4,x({currency:t,id:j.checkoutSessionId,itemsAmount:n,landedCostId:r,presentmentCountryCode:s.selectedCountryCode})];case 1:l=c.sent().json;if(!l){o("Error occurs when updating checkout session");z({messages:[a("There's been an error updating your checkout session. Please reload and try again or contact support if the error persists")],title:a("Error updating Checkout")});return[2,false]}if(!r){N(l.checkoutSessionUpdate.subtotals);i("Exchange rate updated for cart items (checkout session update)","info",j.exchangeRate)}return[2,true]}}))}))}));var W=e("i",(function(e){return __awaiter(u,void 0,void 0,(function(){var t,n,r,i,s,o,a,l,c,u,d,p,v;return __generator(this,(function(f){switch(f.label){case 0:j.selectedShippingOption=e;o=P(j.selectedShippingOption),a=o.expectedDate,l=o.maxTransit,c=o.minTransit;j.selectedShippingOptionExpectedDate=a;j.selectedShippingOptionTransitTime=c&&l?"".concat(c,"-").concat(l):"".concat(c||l);u=(t=j.landedCostData)===null||t===void 0?void 0:t.find((function(e){var t,n,r;return((n=(t=e.landedCost)===null||t===void 0?void 0:t.shipmentRating)===null||n===void 0?void 0:n.id)===((r=j.selectedShippingOption)===null||r===void 0?void 0:r.id)}));j.selectedLandedCost=u||null;if(!u){return[2,false]}j.shipping=u.subtotals.shipping;d=((n=u===null||u===void 0?void 0:u.landedCost)===null||n===void 0?void 0:n.landedCostGuaranteeCode)==="ZONOS";p=!!((i=(r=u===null||u===void 0?void 0:u.landedCost)===null||r===void 0?void 0:r.deMinimis)===null||i===void 0?void 0:i.find((function(e){return["DUTY","TAX"].includes(e.type)&&e.threshold==="ABOVE"})));j.isSelectedShippingAboveDeminimis=p;j.isSelectedShippingGuarantee=d;return[4,B({landedCostId:(s=u.landedCost)===null||s===void 0?void 0:s.id})];case 1:v=f.sent();return[2,v]}}))}))}));I("checkoutSessionId",(function(){if(!j.checkoutSessionId){sessionStorage.removeItem("zonos--checkout-session-id");return}sessionStorage.setItem("zonos--checkout-session-id",j.checkoutSessionId)}));var U=e("h",(function(e){return __awaiter(u,void 0,void 0,(function(){var t,n,r;return __generator(this,(function(i){switch(i.label){case 0:j.items=e;n=(t=e.find(Boolean))===null||t===void 0?void 0:t.currencyCode;r=e.reduce((function(e,t){return e+t.amount*t.quantity}),0);if(!n||!r){return[2]}j.currency=n;y.isFetchingSession=true;return[4,B({currency:n,itemsAmount:r})];case 1:i.sent();y.isFetchingSession=false;return[2]}}))}))}));var J=function(){j.selectedShippingOption=null;j.isSelectedShippingAboveDeminimis=false;j.isSelectedShippingGuarantee=false;j.selectedShippingOptionExpectedDate="";j.selectedShippingOptionTransitTime="";j.shipping=0};var G=e("d",(function(){if(j.step==="customer-info"){j.step="shipping"}else if(j.step==="shipping"){j.step="payment"}else if(j.step==="payment"){j.step="finish"}}));var q=e("e",(function(){if(j.step==="payment"){j.step="shipping"}else if(j.step==="shipping"){j.step="customer-info";J()}}))}}}));
@@ -1 +1 @@
1
- System.register(["./p-68d06767.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-98a6e093.system",[[1,"zonos-text",{class:[1],color:[1],size:[1],type:[1],weight:[2],content:[1],ready:[32]}]]],["p-81c699f7.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-c8ad044e.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-de9d8a4f.system",[[1,"zonos-controller",{config:[16],zonosApiKey:[1,"zonos-api-key"],initCheckoutElement:[64],showNotification:[64],overrideConfig:[64],overrideCountry:[64]}]]],["p-36425562.system",[[1,"zonos-component",{first:[1],middle:[1],last:[1]}]]],["p-cc1c785c.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-aca66238.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-23204b78.system",[[1,"zonos-notification",{class:[1],notificationArray:[32],showNotification:[64]}]]],["p-a3641931.system",[[2,"zonos-payment",{titleText:[1,"title-text"],stripe:[32],stripeElements:[32]},null,{stripeElements:["watchInitStripe"],stripe:["watchInitStripe"]}]]],["p-914ce305.system",[[1,"zonos-shipping-rich-radio",{items:[16],borderColor:[1,"border-color"],borderStyle:[1,"border-style"],theme:[1],selectedItem:[32]}]]],["p-6d82986c.system",[[1,"zonos-badge",{bold:[4],color:[1],icon:[16],iconRight:[4,"icon-right"],size:[1],rounded:[4],class:[1]}]]],["p-40083e93.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-b75ffe64.system",[[1,"zonos-banner",{bannerTitle:[1,"banner-title"],intent:[1],class:[1],hasContent:[32]}]]],["p-824395fd.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-15b71f0b.system",[[1,"zonos-icon",{autoHeight:[4,"auto-height"],color:[1],content:[1],size:[2]}]]],["p-8a75b765.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-05256415.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]}],[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
+ System.register(["./p-68d06767.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-98a6e093.system",[[1,"zonos-text",{class:[1],color:[1],size:[1],type:[1],weight:[2],content:[1],ready:[32]}]]],["p-cf97cc68.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-c8ad044e.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-0ed3bb9f.system",[[1,"zonos-controller",{config:[16],zonosApiKey:[1,"zonos-api-key"],initCheckoutElement:[64],showNotification:[64],overrideConfig:[64],overrideCountry:[64]}]]],["p-36425562.system",[[1,"zonos-component",{first:[1],middle:[1],last:[1]}]]],["p-cc1c785c.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-aca66238.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-23204b78.system",[[1,"zonos-notification",{class:[1],notificationArray:[32],showNotification:[64]}]]],["p-224125da.system",[[2,"zonos-payment",{titleText:[1,"title-text"],stripe:[32],stripeElements:[32]},null,{stripeElements:["watchInitStripe"],stripe:["watchInitStripe"]}]]],["p-8b415737.system",[[1,"zonos-shipping-rich-radio",{items:[16],borderColor:[1,"border-color"],borderStyle:[1,"border-style"],theme:[1],selectedItem:[32]}]]],["p-6d82986c.system",[[1,"zonos-badge",{bold:[4],color:[1],icon:[16],iconRight:[4,"icon-right"],size:[1],rounded:[4],class:[1]}]]],["p-d6b8563b.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-b75ffe64.system",[[1,"zonos-banner",{bannerTitle:[1,"banner-title"],intent:[1],class:[1],hasContent:[32]}]]],["p-824395fd.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-15b71f0b.system",[[1,"zonos-icon",{autoHeight:[4,"auto-height"],color:[1],content:[1],size:[2]}]]],["p-8a75b765.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-84b00605.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]}],[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
- System.register(["./p-8db8cc05.system.js","./p-6dcd752e.system.js","./p-68d06767.system.js","./p-164fae93.system.js","./p-85ab35c9.system.js","./p-8c867835.system.js"],(function(t){"use strict";return{setters:[function(e){var r={};r.cartStore=e.c;r.cartStoreApplySubtotals=e.a;r.cartStoreGetShippingTransitInfo=e.b;r.cartStoreNextStep=e.d;r.cartStorePreviousStep=e.e;r.cartStoreReCalculateTotal=e.f;r.cartStoreReset=e.g;r.cartStoreUpdateItems=e.h;r.cartStoreUpdateSelectedShippingOption=e.i;r.cartStoreUpdateToErrorState=e.j;t(r)},function(){},function(){},function(){},function(){},function(){}],execute:function(){}}}));
1
+ System.register(["./p-f6add79c.system.js","./p-6dcd752e.system.js","./p-68d06767.system.js","./p-164fae93.system.js","./p-85ab35c9.system.js","./p-8c867835.system.js"],(function(t){"use strict";return{setters:[function(e){var r={};r.cartStore=e.c;r.cartStoreApplySubtotals=e.a;r.cartStoreGetShippingTransitInfo=e.b;r.cartStoreNextStep=e.d;r.cartStorePreviousStep=e.e;r.cartStoreReCalculateTotal=e.f;r.cartStoreReset=e.g;r.cartStoreUpdateItems=e.h;r.cartStoreUpdateSelectedShippingOption=e.i;r.cartStoreUpdateToErrorState=e.j;t(r)},function(){},function(){},function(){},function(){},function(){}],execute:function(){}}}));
@@ -1 +1 @@
1
- import{p as e,b as o}from"./p-dc8d7000.js";export{s as setNonce}from"./p-dc8d7000.js";(()=>{const o=import.meta.url,t={};return""!==o&&(t.resourcesUrl=new URL(".",o).href),e(t)})().then((e=>o([["p-9688bb12",[[1,"zonos-text",{class:[1],color:[1],size:[1],type:[1],weight:[2],content:[1],ready:[32]}]]],["p-34a49bce",[[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-28681677",[[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-5d7ffddb",[[1,"zonos-controller",{config:[16],zonosApiKey:[1,"zonos-api-key"],initCheckoutElement:[64],showNotification:[64],overrideConfig:[64],overrideCountry:[64]}]]],["p-2b6325ab",[[1,"zonos-component",{first:[1],middle:[1],last:[1]}]]],["p-cc070c1c",[[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-3f3fbcea",[[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-43a25dab",[[1,"zonos-notification",{class:[1],notificationArray:[32],showNotification:[64]}]]],["p-40778e43",[[2,"zonos-payment",{titleText:[1,"title-text"],stripe:[32],stripeElements:[32]},null,{stripeElements:["watchInitStripe"],stripe:["watchInitStripe"]}]]],["p-96a3c767",[[1,"zonos-shipping-rich-radio",{items:[16],borderColor:[1,"border-color"],borderStyle:[1,"border-style"],theme:[1],selectedItem:[32]}]]],["p-7bacecf7",[[1,"zonos-badge",{bold:[4],color:[1],icon:[16],iconRight:[4,"icon-right"],size:[1],rounded:[4],class:[1]}]]],["p-365970ff",[[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-0190f7c4",[[1,"zonos-banner",{bannerTitle:[1,"banner-title"],intent:[1],class:[1],hasContent:[32]}]]],["p-f868ed42",[[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-b618cf03",[[1,"zonos-icon",{autoHeight:[4,"auto-height"],color:[1],content:[1],size:[2]}]]],["p-6e7cd3f7",[[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-60821b2a",[[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]}],[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
+ import{p as e,b as o}from"./p-dc8d7000.js";export{s as setNonce}from"./p-dc8d7000.js";(()=>{const o=import.meta.url,t={};return""!==o&&(t.resourcesUrl=new URL(".",o).href),e(t)})().then((e=>o([["p-9688bb12",[[1,"zonos-text",{class:[1],color:[1],size:[1],type:[1],weight:[2],content:[1],ready:[32]}]]],["p-a1fa50fb",[[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-28681677",[[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-3a56c240",[[1,"zonos-controller",{config:[16],zonosApiKey:[1,"zonos-api-key"],initCheckoutElement:[64],showNotification:[64],overrideConfig:[64],overrideCountry:[64]}]]],["p-2b6325ab",[[1,"zonos-component",{first:[1],middle:[1],last:[1]}]]],["p-cc070c1c",[[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-3f3fbcea",[[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-43a25dab",[[1,"zonos-notification",{class:[1],notificationArray:[32],showNotification:[64]}]]],["p-9202375f",[[2,"zonos-payment",{titleText:[1,"title-text"],stripe:[32],stripeElements:[32]},null,{stripeElements:["watchInitStripe"],stripe:["watchInitStripe"]}]]],["p-e5908de2",[[1,"zonos-shipping-rich-radio",{items:[16],borderColor:[1,"border-color"],borderStyle:[1,"border-style"],theme:[1],selectedItem:[32]}]]],["p-7bacecf7",[[1,"zonos-badge",{bold:[4],color:[1],icon:[16],iconRight:[4,"icon-right"],size:[1],rounded:[4],class:[1]}]]],["p-cd71e41e",[[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-0190f7c4",[[1,"zonos-banner",{bannerTitle:[1,"banner-title"],intent:[1],class:[1],hasContent:[32]}]]],["p-f868ed42",[[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-b618cf03",[[1,"zonos-icon",{autoHeight:[4,"auto-height"],color:[1],content:[1],size:[2]}]]],["p-6e7cd3f7",[[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-bc2c42f5",[[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]}],[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)));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zonos/elements",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "description": "Zonos component UI for Stripe elements",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.cjs.js",
@@ -95,7 +95,7 @@
95
95
  "@stripe/stripe-js": "^1.54.1",
96
96
  "@t3-oss/env-core": "^0.6.0",
97
97
  "@total-typescript/ts-reset": "^0.4.2",
98
- "@types/crypto-js": "^4.1.1",
98
+ "@types/crypto-js": "^4.2.1",
99
99
  "@types/jest": "^27.5.2",
100
100
  "@types/lodash": "^4.14.196",
101
101
  "@types/node": "^18.17.1",
@@ -106,7 +106,7 @@
106
106
  "@typescript-eslint/parser": "^6.0.0",
107
107
  "clean-css-cli": "^5.6.2",
108
108
  "concurrently": "^8.2.0",
109
- "crypto-js": "^4.1.1",
109
+ "crypto-js": "^4.2.0",
110
110
  "dotenv": "^16.3.1",
111
111
  "eslint": "^8.45.0",
112
112
  "eslint-config-prettier": "8.7.0",
@@ -1 +0,0 @@
1
- var __awaiter=this&&this.__awaiter||function(e,t,r,o){function n(e){return e instanceof r?e:new r((function(t){t(e)}))}return new(r||(r=Promise))((function(r,i){function a(e){try{c(o.next(e))}catch(e){i(e)}}function s(e){try{c(o["throw"](e))}catch(e){i(e)}}function c(e){e.done?r(e.value):n(e.value).then(a,s)}c((o=o.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},o,n,i,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(e){return function(t){return c([e,t])}}function c(s){if(o)throw new TypeError("Generator is already executing.");while(a&&(a=0,s[0]&&(r=0)),r)try{if(o=1,n&&(i=s[0]&2?n["return"]:s[0]?n["throw"]||((i=n["return"])&&i.call(n),0):n.next)&&!(i=i.call(n,s[1])).done)return i;if(n=0,i)s=[s[0]&2,i.value];switch(s[0]){case 0:case 1:i=s;break;case 4:r.label++;return{value:s[1],done:false};case 5:r.label++;n=s[1];s=[0];continue;case 7:s=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(s[0]===6||s[0]===2)){r=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){r.label=s[1];break}if(s[0]===6&&r.label<i[1]){r.label=i[1];i=s;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(s);break}if(i[2])r.ops.pop();r.trys.pop();continue}s=t.call(e,r)}catch(e){s=[6,e];n=0}finally{o=i=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};import{c as createStore,z as zonosStore}from"./zonosStore-05a62104.js";import{h as handleFetch,l as log,a as localizationStore,b as logError,t as translate}from"./localization-f3828793.js";import{i as isDarkColor}from"./isDarkColor-6fbb9b14.js";import{g as getBorderRadius}from"./getBorderRadius-45764ad7.js";var prepCalculateLandedCost=function(){var e=stripeStore.stripeLinkEventData;var t=stripeStore.stripeAddressEventData;if(!t||!t.complete){throw new Error("Missing stripe address data")}return{checkoutSessionId:cartStore.checkoutSessionId||"",contact:{email:(e===null||e===void 0?void 0:e.value.email)||"",firstName:t.value.firstName||"",lastName:t.value.lastName||"",phone:t.value.phone||""},items:cartStore.items.map((function(e){return e})),shippingAddress:{addressLine1:t.value.address.line1,addressLine2:t.value.address.line2||"",city:t.value.address.city,country:t.value.address.country,postalCode:t.value.address.postal_code,state:t.value.address.state}}};var calculateLandedCost=function(e){return __awaiter(void 0,void 0,void 0,(function(){var t,r,o,n;return __generator(this,(function(i){switch(i.label){case 0:t="".concat("https://v1.route.js.zonos.com","/api/calculate-landed-cost");return[4,handleFetch(t,{body:prepCalculateLandedCost(),method:"POST",signal:e===null||e===void 0?void 0:e.signal})];case 1:r=i.sent(),o=r.errors,n=r.json;if(o.length||!n){throw new Error("Failed to calculate landed cost")}return[2,n]}}))}))};var addressRuleStyle=function(e){var t=e.theme;switch(t){default:return{".Input":{padding:"0",paddingBottom:"8px",paddingLeft:"16px",paddingRight:"8px",paddingTop:"6px"}}}};var defaultVariable=function(e){var t=e.borderStyle,r=e.theme;switch(r){case"DARK":return{borderRadius:getBorderRadius(t),colorBackground:"#101117",colorBackgroundText:"#C5C6CA",colorText:"#C5C6CA",colorTextPlaceholder:"#C5C6CA"};default:return{borderRadius:getBorderRadius(t)}}};var _f=createStore((function(){return{clientSecret:sessionStorage.getItem("zonos--client-secret")||null,fetchingLandedCostAbordController:null,isFetchingLandedCost:false,isFetchingSession:false,stripe:null,stripeAddressElement:null,stripeAddressEventData:null,stripeAddressUsedWhenFetchingLC:null,stripeElements:null,stripeLinkElement:null,stripeLinkEventData:null,stripeLinkUsedWhenFetchingLC:null,stripePaymentElement:null,stripePaymentEventData:null}})),onChange$1=_f.onChange,reset$1=_f.reset,stripeStore=_f.state;var getStripeOptions=function(e){var t=e.clientSecret,r=e.overrideBorderRaidus,o=e.overridePrimaryColor,n=e.overrideTheme;var i=o||zonosStore.appearance.colorPrimary;var a=i&&isDarkColor(i)?"night":"flat";var s=n==="DARK"?"night":"flat";return{appearance:{labels:"floating",rules:Object.assign({},addressRuleStyle({theme:"LIGHT"})),theme:n?s:a,variables:Object.assign({},defaultVariable({borderStyle:r,theme:"LIGHT"}))},clientSecret:t,locale:localizationStore.selectedLocale}};var initStripeElements=function(e){return __awaiter(void 0,void 0,void 0,(function(){var t,r,o;return __generator(this,(function(n){r=stripeStore.clientSecret;if(!stripeStore.stripe){log("Skip. Stripe is not initialized");return[2]}if(r){o=getStripeOptions({clientSecret:r,overrideBorderRaidus:e===null||e===void 0?void 0:e.overrideBorderRaidus,overridePrimaryColor:e===null||e===void 0?void 0:e.overridePrimaryColor,overrideTheme:e===null||e===void 0?void 0:e.overrideTheme});if(!stripeStore.stripeElements){stripeStore.stripeElements=(t=stripeStore.stripe)===null||t===void 0?void 0:t.elements(o)}else{stripeStore.stripeElements.update(o)}log("Stripe elements initialized")}return[2]}))}))};var stripeStoreReset=function(){sessionStorage.removeItem("zonos--client-secret");reset$1();stripeStore.stripe=window.Zonos.stripe};var isPrefetchInfoOutdated=function(){var e,t,r,o;var n=stripeStore.fetchingLandedCostAbordController;if(!n){return false}var i=JSON.stringify((e=stripeStore.stripeLinkUsedWhenFetchingLC)===null||e===void 0?void 0:e.value)!==JSON.stringify((t=stripeStore.stripeLinkEventData)===null||t===void 0?void 0:t.value);var a=JSON.stringify((r=stripeStore.stripeAddressUsedWhenFetchingLC)===null||r===void 0?void 0:r.value)!==JSON.stringify((o=stripeStore.stripeAddressEventData)===null||o===void 0?void 0:o.value);return i||a};var stripeStorePrefetchLandedCost=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,t,r,o,n,i,a,s,c,l,d,u,p,S;return __generator(this,(function(v){switch(v.label){case 0:n=!!((e=stripeStore.stripeAddressEventData)===null||e===void 0?void 0:e.complete);i=!!((t=stripeStore.stripeLinkEventData)===null||t===void 0?void 0:t.complete);a=isPrefetchInfoOutdated();if(a){(r=stripeStore.fetchingLandedCostAbordController)===null||r===void 0?void 0:r.abort();stripeStore.fetchingLandedCostAbordController=null}if(!(n&&i&&(a||!stripeStore.isFetchingLandedCost)))return[3,5];stripeStore.isFetchingLandedCost=true;if(stripeStore.stripeAddressEventData){stripeStore.stripeAddressUsedWhenFetchingLC=Object.assign({},stripeStore.stripeAddressEventData)}if(stripeStore.stripeLinkEventData){stripeStore.stripeLinkUsedWhenFetchingLC=Object.assign({},stripeStore.stripeLinkEventData)}v.label=1;case 1:v.trys.push([1,3,,4]);s=new AbortController;stripeStore.fetchingLandedCostAbordController=s;return[4,calculateLandedCost(s)];case 2:c=v.sent(),l=c.checkoutSessionWorkflow,d=c.shipmentRatingCalculateWorkflow;stripeStore.fetchingLandedCostAbordController=null;cartStore.landedCostData=(l===null||l===void 0?void 0:l.filter(Boolean))||null;cartStore.shippingData=(d===null||d===void 0?void 0:d.filter(Boolean))||null;u=(o=cartStore.landedCostData)===null||o===void 0?void 0:o.find(Boolean);p=!!u?u.subtotals:null;if(p){cartStoreApplySubtotals({exchangeRate:p.exchangeRate,items:p.items,landedCostTotal:0,presentmentCurrencyCode:p.presentmentCurrencyCode,shipping:0,total:p.items})}return[3,4];case 3:S=v.sent();logError(S);return[3,4];case 4:stripeStore.isFetchingLandedCost=false;v.label=5;case 5:return[2]}}))}))};var getStripeMessageBasedOnStatus=function(e){var t=[];var r=true;switch(e){case"succeeded":{t=[translate("Your payment went through successfully! Thank you for shopping with us! We hope you had an enjoyable experience and your support means the world to us."),"","",translate("We've sent an email confirmation of the order details for your review. And our team is carefully preparing your order so it arrives on time.")];r=false;break}case"requires_capture":case"processing":{t=[translate("Payment processing. We'll update you when payment is received.")];r=false;break}case"requires_payment_method":{t=[translate("Payment failed. Please try another payment method.")];break}default:{t=[translate("Something went wrong.")];break}}return{isError:r,messages:t}};var stripeStoreRetrievePayment=function(e){var t=e.clientSecret,r=e.storybookForceStatus;return __awaiter(void 0,void 0,void 0,(function(){var e,o,n,i,a,s,c,l,d;return __generator(this,(function(u){switch(u.label){case 0:if(r){e=getStripeMessageBasedOnStatus(r),o=e.isError,n=e.messages;return[2,{error:o,messages:n}]}i=t||stripeStore.clientSecret;if(!stripeStore.stripe||!i){logError("Failed to retrieve payment intent. Stripe is not initialized");return[2,{error:true,message:[translate("Something went wrong.")]}]}return[4,stripeStore.stripe.retrievePaymentIntent(i)];case 1:a=u.sent().paymentIntent;s=a===null||a===void 0?void 0:a.status;c=getStripeMessageBasedOnStatus(s),l=c.isError,d=c.messages;return[2,{error:l,messages:d}]}}))}))};var stripeStoreConfirmPayment=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,t,r,o,n,i,a,s;return __generator(this,(function(c){switch(c.label){case 0:o=!!((e=stripeStore.stripePaymentEventData)===null||e===void 0?void 0:e.complete);n=stripeStore.stripeElements;i=stripeStore.stripe;a=stripeStore.clientSecret;if(!(i&&n&&o&&a))return[3,2];return[4,i.confirmPayment({confirmParams:{receipt_email:(r=(t=stripeStore.stripeLinkEventData)===null||t===void 0?void 0:t.value)===null||r===void 0?void 0:r.email,return_url:window.location.href},elements:n,redirect:"if_required"})];case 1:s=c.sent().error;if(s){if(s.type==="card_error"||s.type==="validation_error"){throw new Error(s.message)}if(s.type==="invalid_request_error"){if(s.code==="payment_intent_unexpected_state"){return[2]}}throw new Error("An unexpected error occurred.")}c.label=2;case 2:return[2]}}))}))};var stripeStoreInitCheckoutSession=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,t,r,o,n,i;return __generator(this,(function(a){switch(a.label){case 0:t=cartStore.items.reduce((function(e,t){return e+t.amount*t.quantity}),0);if(!t||!localizationStore.targetCurrency){logError("Fail to create checkout session - invalid total or currency");return[2,false]}stripeStore.isFetchingSession=true;return[4,handleFetch("".concat("https://v1.route.js.zonos.com","/api/create-checkout-session"),{body:{currency:((e=cartStore.items.find(Boolean))===null||e===void 0?void 0:e.currencyCode)||"",itemsAmount:t,presentmentCountryCode:localizationStore.selectedCountryCode||null},method:"POST"})];case 1:r=a.sent(),o=r.errors,n=r.json;stripeStore.isFetchingSession=false;if(o.length||!n){logError("Error occurs when creating checkout session",JSON.stringify(o,null,2));return[2,false]}i=n.checkoutSessionCreate;stripeStore.clientSecret=i.clientSecret;cartStore.checkoutSessionId=i.id;cartStoreApplySubtotals(Object.assign(Object.assign({},i.subtotals),{landedCostTotal:0,shipping:0,total:i.subtotals.items}));log("Exchange rate updated for cart items (checkout session create)","info",cartStore.exchangeRate);log("done-init-checkout-session");return[2,true]}}))}))};var stripeStoreUpdateCheckoutSession=function(e){var t=e.currency,r=e.id,o=e.itemsAmount,n=e.landedCostId,i=e.presentmentCountryCode;return __awaiter(void 0,void 0,void 0,(function(){var e,a,s;return __generator(this,(function(c){switch(c.label){case 0:return[4,handleFetch("".concat("https://v1.route.js.zonos.com","/api/update-checkout-session"),{body:{currency:t,id:r,itemsAmount:o,landedCostId:n,presentmentCountryCode:i},method:"POST"})];case 1:e=c.sent(),a=e.errors,s=e.json;if(a.length||!s){logError("Error occurs when updating checkout session",JSON.stringify(a,null,2));return[2,{errors:a,json:s}]}return[2,{errors:[],json:s}]}}))}))};onChange$1("clientSecret",(function(e){if(e&&stripeStore.stripe){sessionStorage.setItem("zonos--client-secret",e)}if(!e){sessionStorage.removeItem("zonos--client-secret")}}));var formatDate=function(e){var t=e.date,r=e.formatOptions,o=r===void 0?{day:"numeric",weekday:"long",year:"numeric"}:r;return new Intl.DateTimeFormat("en-US",o).format(t)};var getDaysDifference=function(e){var t=new Date;var r=e.getTime()-t.getTime();var o=Math.floor(r/(1e3*60*60*24));return o};var _g=createStore((function(){return{checkoutSessionId:sessionStorage.getItem("zonos--checkout-session-id")||null,currency:"USD",dutiesTaxFees:0,error:null,exchangeRate:null,isSelectedShippingAboveDeminimis:false,isSelectedShippingGuarantee:false,items:[],landedCostData:null,selectedLandedCost:null,selectedShippingOption:null,selectedShippingOptionExpectedDate:"",selectedShippingOptionTransitTime:"",shipping:0,shippingData:null,step:"customer-info",subtotal:0,total:0}})),onChange=_g.onChange,reset=_g.reset,cartStore=_g.state;var cartStoreGetShippingTransitInfo=function(e){var t=e.minTransitAt?getDaysDifference(new Date(e.minTransitAt)):"";var r=e.maxTransitAt?getDaysDifference(new Date(e.maxTransitAt)):"";var o=e.minTransitAt?formatDate({date:new Date(e.minTransitAt)}):"";return{expectedDate:o,maxTransit:r,minTransit:t}};var cartStoreReset=function(){sessionStorage.removeItem("zonos--checkout-session-id");reset()};var cartStoreUpdateToErrorState=function(e){var t=e.messages,r=e.title;cartStore.step="error";cartStore.error={messages:t,title:r}};var cartStoreApplySubtotals=function(e){cartStore.exchangeRate=e.exchangeRate;cartStore.dutiesTaxFees=e.landedCostTotal;cartStore.subtotal=e.items;cartStore.total=e.total;cartStore.currency=e.presentmentCurrencyCode};var cartStoreReCalculateTotal=function(e){var t=e.currency,r=e.itemsAmount,o=e.landedCostId;return __awaiter(void 0,void 0,void 0,(function(){var e,n;return __generator(this,(function(i){switch(i.label){case 0:if(o&&cartStore.selectedLandedCost){e=cartStore.selectedLandedCost.subtotals;cartStoreApplySubtotals(e);log("Exchange rate updated for cart items (landed cost subtotal)","info",cartStore.exchangeRate)}if(!cartStore.checkoutSessionId){logError("Could update cart total without checkout session id");return[2,false]}return[4,stripeStoreUpdateCheckoutSession({currency:t,id:cartStore.checkoutSessionId,itemsAmount:r,landedCostId:o,presentmentCountryCode:localizationStore.selectedCountryCode})];case 1:n=i.sent().json;if(!n){logError("Error occurs when updating checkout session");cartStoreUpdateToErrorState({messages:[translate("There's been an error updating your checkout session. Please reload and try again or contact support if the error persists")],title:translate("Error updating Checkout")});return[2,false]}if(!o){cartStoreApplySubtotals(n.checkoutSessionUpdate.subtotals);log("Exchange rate updated for cart items (checkout session update)","info",cartStore.exchangeRate)}return[2,true]}}))}))};var cartStoreUpdateSelectedShippingOption=function(e){return __awaiter(void 0,void 0,void 0,(function(){var t,r,o,n,i,a,s,c,l,d,u,p,S;return __generator(this,(function(v){switch(v.label){case 0:cartStore.selectedShippingOption=e;a=cartStoreGetShippingTransitInfo(cartStore.selectedShippingOption),s=a.expectedDate,c=a.maxTransit,l=a.minTransit;cartStore.selectedShippingOptionExpectedDate=s;cartStore.selectedShippingOptionTransitTime=l&&c?"".concat(l,"-").concat(c):"".concat(l||c);d=(t=cartStore.landedCostData)===null||t===void 0?void 0:t.find((function(e){var t,r,o;return((r=(t=e.landedCost)===null||t===void 0?void 0:t.shipmentRating)===null||r===void 0?void 0:r.id)===((o=cartStore.selectedShippingOption)===null||o===void 0?void 0:o.id)}));cartStore.selectedLandedCost=d||null;if(!d){return[2,false]}cartStore.shipping=d.subtotals.shipping;u=((r=d===null||d===void 0?void 0:d.landedCost)===null||r===void 0?void 0:r.landedCostGuaranteeCode)==="ZONOS";p=!!((n=(o=d===null||d===void 0?void 0:d.landedCost)===null||o===void 0?void 0:o.deMinimis)===null||n===void 0?void 0:n.find((function(e){return["DUTY","TAX"].includes(e.type)&&e.threshold==="ABOVE"})));cartStore.isSelectedShippingAboveDeminimis=p;cartStore.isSelectedShippingGuarantee=u;return[4,cartStoreReCalculateTotal({landedCostId:(i=d.landedCost)===null||i===void 0?void 0:i.id})];case 1:S=v.sent();return[2,S]}}))}))};onChange("checkoutSessionId",(function(){if(!cartStore.checkoutSessionId){sessionStorage.removeItem("zonos--checkout-session-id");return}sessionStorage.setItem("zonos--checkout-session-id",cartStore.checkoutSessionId)}));var cartStoreUpdateItems=function(e){return __awaiter(void 0,void 0,void 0,(function(){var t,r,o;return __generator(this,(function(n){switch(n.label){case 0:cartStore.items=e;r=(t=e.find(Boolean))===null||t===void 0?void 0:t.currencyCode;o=e.reduce((function(e,t){return e+t.amount*t.quantity}),0);if(!r||!o){return[2]}cartStore.currency=r;stripeStore.isFetchingSession=true;return[4,cartStoreReCalculateTotal({currency:r,itemsAmount:o})];case 1:n.sent();stripeStore.isFetchingSession=false;return[2]}}))}))};var cartStoreResetSelectedShippingOption=function(){cartStore.selectedShippingOption=null;cartStore.isSelectedShippingAboveDeminimis=false;cartStore.isSelectedShippingGuarantee=false;cartStore.selectedShippingOptionExpectedDate="";cartStore.selectedShippingOptionTransitTime="";cartStore.shipping=0};var cartStoreNextStep=function(){if(cartStore.step==="customer-info"){cartStore.step="shipping"}else if(cartStore.step==="shipping"){cartStore.step="payment"}else if(cartStore.step==="payment"){cartStore.step="finish"}};var cartStorePreviousStep=function(){if(cartStore.step==="payment"){cartStore.step="shipping"}else if(cartStore.step==="shipping"){cartStore.step="customer-info";cartStoreResetSelectedShippingOption()}};export{cartStoreApplySubtotals as a,cartStoreGetShippingTransitInfo as b,cartStore as c,cartStoreNextStep as d,cartStorePreviousStep as e,cartStoreReCalculateTotal as f,cartStoreReset as g,cartStoreUpdateItems as h,cartStoreUpdateSelectedShippingOption as i,cartStoreUpdateToErrorState as j,initStripeElements as k,stripeStoreInitCheckoutSession as l,stripeStorePrefetchLandedCost as m,stripeStoreConfirmPayment as n,stripeStoreReset as o,stripeStoreRetrievePayment as p,stripeStore as s};
@@ -1 +0,0 @@
1
- import{c as e,z as t}from"./p-08695f4e.js";import{h as n,l as o,a as s,b as r,t as i}from"./p-770c959e.js";import{i as a}from"./p-bf070bf6.js";import{g as l}from"./p-0e0b46a5.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}=e((()=>({clientSecret:sessionStorage.getItem("zonos--client-secret")||null,fetchingLandedCostAbordController:null,isFetchingLandedCost:!1,isFetchingSession:!1,stripe:null,stripeAddressElement:null,stripeAddressEventData:null,stripeAddressUsedWhenFetchingLC:null,stripeElements:null,stripeLinkElement:null,stripeLinkEventData:null,stripeLinkUsedWhenFetchingLC:null,stripePaymentElement:null,stripePaymentEventData:null}))),h=async e=>{var n;const r=m.clientSecret;if(m.stripe){if(r){const i=(({clientSecret:e,overrideBorderRaidus:n,overridePrimaryColor:o,overrideTheme:r})=>{const i=o||t.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:e,locale:s.selectedLocale}})({clientSecret:r,overrideBorderRaidus:null==e?void 0:e.overrideBorderRaidus,overridePrimaryColor:null==e?void 0:e.overridePrimaryColor,overrideTheme:null==e?void 0:e.overrideTheme});m.stripeElements?m.stripeElements.update(i):m.stripeElements=null===(n=m.stripe)||void 0===n?void 0:n.elements(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 e,t,o,s;const i=!!(null===(e=m.stripeAddressEventData)||void 0===e?void 0:e.complete),a=!!(null===(t=m.stripeLinkEventData)||void 0===t?void 0:t.complete),l=(()=>{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(l&&(null===(o=m.fetchingLandedCostAbordController)||void 0===o||o.abort(),m.fetchingLandedCostAbordController=null),i&&a&&(l||!m.isFetchingLandedCost)){m.isFetchingLandedCost=!0,m.stripeAddressEventData&&(m.stripeAddressUsedWhenFetchingLC=Object.assign({},m.stripeAddressEventData)),m.stripeLinkEventData&&(m.stripeLinkUsedWhenFetchingLC=Object.assign({},m.stripeLinkEventData));try{const e=new AbortController;m.fetchingLandedCostAbordController=e;const{checkoutSessionWorkflow:t,shipmentRatingCalculateWorkflow:o}=await(async e=>{const{errors:t,json:o}=await n("https://v1.route.js.zonos.com/api/calculate-landed-cost",{body:d(),method:"POST",signal:null==e?void 0:e.signal});if(t.length||!o)throw new Error("Failed to calculate landed cost");return o})(e);m.fetchingLandedCostAbordController=null,E.landedCostData=(null==t?void 0:t.filter(Boolean))||null,E.shippingData=(null==o?void 0:o.filter(Boolean))||null;const r=null===(s=E.landedCostData)||void 0===s?void 0:s.find(Boolean),i=r?r.subtotals:null;i&&O({exchangeRate:i.exchangeRate,items:i.items,landedCostTotal:0,presentmentCurrencyCode:i.presentmentCurrencyCode,shipping:0,total:i.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}},S=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.")}}},w=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/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,O(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}=e((()=>({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}))),T=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}},x=()=>{sessionStorage.removeItem("zonos--checkout-session-id"),b()},A=({messages:e,title:t})=>{E.step="error",E.error={messages:e,title:t}},O=e=>{E.exchangeRate=e.exchangeRate,E.dutiesTaxFees=e.landedCostTotal,E.subtotal=e.items,E.total=e.total,E.currency=e.presentmentCurrencyCode},j=async({currency:e,itemsAmount:t,landedCostId:a})=>{if(a&&E.selectedLandedCost&&(O(E.selectedLandedCost.subtotals),o("Exchange rate updated for cart items (landed cost subtotal)","info",E.exchangeRate)),!E.checkoutSessionId)return r("Could 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/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||(O(l.checkoutSessionUpdate.subtotals),o("Exchange rate updated for cart items (checkout session update)","info",E.exchangeRate)),!0):(r("Error occurs when updating checkout session"),A({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)},D=async e=>{var t,n,o,s,r;E.selectedShippingOption=e;const{expectedDate:i,maxTransit:a,minTransit:l}=T(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 j({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 z=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 j({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")},_=()=>{"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{O as a,T as b,E as c,P as d,_ as e,j as f,x as g,z as h,D as i,A as j,h as k,w as l,g as m,S as n,v as o,f as p,m as s}
@@ -1 +0,0 @@
1
- import{r as o,h as s,F as c,H as t}from"./p-dc8d7000.js";import{k as e,c as n,h as i,g as a,s as h,l as r,j as l,m as u,d,n as z,o as m,e as k}from"./p-25db3885.js";import{a as p,l as g,t as f}from"./p-770c959e.js";import{z as v,m as b}from"./p-08695f4e.js";import{s as w,i as x}from"./p-f7875c40.js";import{c as y}from"./p-b4b7f705.js";import{g as C}from"./p-0e0b46a5.js";import{i as B}from"./p-bf070bf6.js";const j='<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',L='<svg color="var(--amino-gray-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="https://www.w3.org/2000/svg"><path clip-rule="evenodd" d="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-gray-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>',H=class{constructor(s){o(this,s),this.applyStripeTheme=async()=>{var o,s,c;const t=(null===(o=this.appearanceSettingsOverride)||void 0===o?void 0:o.theme)||v.appearance.theme;await e({overrideBorderRaidus:null===(s=this.appearanceSettingsOverride)||void 0===s?void 0:s.style,overridePrimaryColor:null===(c=this.appearanceSettingsOverride)||void 0===c?void 0:c.colorPrimary,overrideTheme:this.isMobile?t:void 0})},this.isShippableCountry=(o=!0)=>!(!p.localizationLoaded||!p.isShippableCountry&&(o&&g("Checkout: not shippable country"),1)),this.getCurrentLocalePageEnum=()=>{switch(n.step){case"customer-info":return"checkout_customer_info";case"shipping":return"checkout_shipping_info";case"payment":return"checkout_payment_info";default:return null}},this.appearanceSettingsOverride=void 0,this.preview=!1,this.mobile=!1,this.defaultAddress=null,this.forceDialogOpen=!1,this.open=this.forceDialogOpen,this.stripe=window.Zonos.stripe,this.submitLoading=!1,this.paymentError=!1,this.collapseReviewMobile=!1,this.isAttachError=!1,this.isMobile=!1,this.zonosReviewRef=void 0,this.storybookPaymentStatusOverride=void 0}async initCartInfoHandler(o){i(o.detail)}async closeDialogHandler(){w("zonos-checkout-close"),this.open=this.forceDialogOpen||!1,this.preview||"finish"!==n.step||a(),n.step="customer-info"}async buildCartAndInit(){if(v.checkoutSettings.buildCartDetail){g("build cart detail");const o=await v.checkoutSettings.buildCartDetail();await i(o)}if(!h.clientSecret){const o=await r();if(g(`stripeStoreInitCheckoutSession: ${o}`),!o)return!1}return await this.applyStripeTheme(),!0}attachCheckout(){const o=v.checkoutSettings.placeOrderButtonSelector;o&&document.querySelectorAll(o).forEach((o=>{o.getAttribute("data-zonos-checkout-attached")||(o.addEventListener("click",(async o=>{if(this.isShippableCountry()){o.preventDefault(),o.stopPropagation(),g("zonos checkout button clicked"),this.open=!0;try{if(!await this.buildCartAndInit())throw new Error("Error building cart");w("zonos-checkout-start")}catch(o){l({messages:[f("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:f("Error creating Checkout")})}}})),o.setAttribute("data-zonos-checkout-attached","true"))}))}appearanceSettingsOverrideChanged(){this.appearanceSettingsOverride&&this.applyStripeTheme()}async init(){h.stripe=window.Zonos.stripe,this.stripe=window.Zonos.stripe;const o=setInterval((()=>{const s=window.Zonos.internationalHideSelector;if(!s)return void clearInterval(o);const c=this.isShippableCountry(!1),t=document.querySelectorAll(s);c?null==t||t.forEach((o=>{const s=o;s.setAttribute("data-zonos-checkout-original-display",s.style.display),s.style.display="none"})):null==t||t.forEach((o=>{const s=o,c=s.getAttribute("data-zonos-checkout-original-display")||getComputedStyle(s).display;s.style.display=c||"initial"}))}),100),s=setInterval((()=>{h.stripe=window.Zonos.stripe,this.stripe=window.Zonos.stripe,this.stripe?(this.storybookPaymentStatusOverride||(g("init checkout"),this.preview||this.forceDialogOpen?this.buildCartAndInit():(this.attachCheckout(),setInterval((()=>{this.attachCheckout()}),50))),clearInterval(s)):g("waiting for stripe to be loaded")}),50);setTimeout((()=>{clearInterval(s)}),1e4)}async setToFinishStep(o){n.step="finish",this.storybookPaymentStatusOverride=o}async handleCustomerInfoContinue(){this.submitLoading=!0,await u();const o=setInterval((()=>{!n.landedCostData&&h.isFetchingLandedCost||(n.landedCostData&&d(),this.submitLoading=!1,clearInterval(o))}),500)}async handleShippingContinue(){this.submitLoading=!0,setTimeout((()=>{d(),this.submitLoading=!1}),500)}async handleCheckoutPaymentContinue(){this.paymentError=!1,this.submitLoading=!0;try{await z(),d()}catch(o){console.error(o),this.paymentError=!0}this.submitLoading=!1}async handleFinishClick(){if(m(),this.preview)return n.step="customer-info",void await this.init();a();const o=window.location.href.split("?")[0];window.history.replaceState({},document.title,o),this.open=!1}async handleBackClick(){"customer-info"!==n.step?k():await this.closeDialogHandler()}handleWindowResize(){this.isMobile=x(this.mobile),this.applyStripeTheme(),g(`mobile: ${this.isMobile}`)}handleMobileChange(){this.isMobile=x(this.mobile),this.applyStripeTheme(),g(`mobile: ${this.isMobile}`)}componentWillLoad(){this.init(),this.isMobile=x(this.mobile),g(`mobile: ${this.isMobile}`)}disconnectedCallback(){m(),a()}render(){var o;const e="finish"!==n.step&&"error"!==n.step&&!h.stripeElements||h.isFetchingSession,{colorPrimary:i,colorSecondary:a,logoUrl:r,style:l}=b(v.appearance,this.appearanceSettingsOverride),u="ENABLED"===v.appearance.zonosAttribution,d=v.appearance.theme,z=i&&B(i)?"DARK":"LIGHT",m=this.isMobile?d:z,k=this.isMobile?void 0:a,{customMessages:g}=p,w=(null===(o=g.find((o=>"checkout_default"===o.pageName)))||void 0===o?void 0:o.message)||"Know about duties and taxes before you buy. Shop with confidence!",x=this.getCurrentLocalePageEnum(),H=g.filter((o=>o.pageName===x)),I=()=>s("div",{class:"zonos--logo"},r&&s("img",{alt:`${v.organizationName} logo`,src:r,width:100})),S=()=>s("zonos-v-stack",null,I(),H.map((o=>s("zonos-custom-message",{icon:j,message:o.message}))),s("div",null,s("zonos-button",{class:"zonos--back-button",icon:s("zonos-icon",{content:'<svg color="var(--amino-gray-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="https://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M9.707 16.707a1 1 0 0 1-1.414 0l-3.647-3.646a1.5 1.5 0 0 1 0-2.122l3.647-3.646a1 1 0 0 1 1.414 1.414L7.414 11H19a1 1 0 1 1 0 2H7.414l2.293 2.293a1 1 0 0 1 0 1.414Z" fill="currentColor" fill-rule="evenodd"></path></svg>'}),noBackground:!0,noPaddingLeft:!0,noPaddingRight:!0,onClick:()=>this.handleBackClick(),theme:m},f("Back")))),M=()=>u&&s("div",{class:"zonos--footer","data-theme":d},s("zonos-text",{type:"hintText"},f("Powered by")),s("zonos-logo",{theme:d,width:"100px"})),T=()=>{var o;const t=this.isMobile?"primary":void 0,e=null===(o=this.zonosReviewRef)||void 0===o?void 0:o.scrollHeight;return s("div",{class:"zonos--content",style:{"--border-radius":C(l)}},"finish"!==n.step&&"error"!==n.step&&s(c,null,s("div",{class:"zonos--left","data-theme":m,style:{"--primary-color":this.isMobile?"":i}},!this.isMobile&&S(),"customer-info"===n.step&&s("zonos-customer-info",{continueLoading:this.submitLoading,defaultAddress:this.defaultAddress,onContinueClicked:()=>this.handleCustomerInfoContinue(),submitBtnColor:k,submitBtnType:t}),"shipping"===n.step&&s("zonos-shipping",{continueLoading:this.submitLoading,onContinueClicked:()=>this.handleShippingContinue(),submitBtnColor:k,submitBtnType:t}),"payment"===n.step&&s("zonos-checkout-payment",{continueLoading:this.submitLoading,onContinueClicked:()=>this.handleCheckoutPaymentContinue(),paymentError:this.paymentError,submitBtnColor:k,submitBtnType:t})),s("div",{class:"zonos--right","data-theme":d},this.isMobile&&S(),!this.isMobile&&s("zonos-button",{class:"zonos--close-button",icon:s("zonos-icon",{content:L}),noBackground:!0,onClick:()=>this.closeDialogHandler()}),s("div",{class:"flex--wrapper"},s("div",{class:"zonos--wrapper"},s("zonos-collapse",{collapseSize:e,collapsed:this.collapseReviewMobile&&this.isMobile},s("zonos-review",{collapsed:this.collapseReviewMobile,mobile:this.isMobile,onClick:()=>{this.isMobile&&(this.collapseReviewMobile=!this.collapseReviewMobile)},ref:o=>this.zonosReviewRef=o}),s("zonos-cart-items",null))),s("zonos-v-stack",{spacing:16},s("zonos-cart-subtotal",null),s("zonos-custom-message",{class:"zonos--checkout-default-message",icon:j,message:w}))),!this.isMobile&&M()),this.isMobile&&M()),("finish"===n.step||"error"===n.step)&&s("div",{class:"zonos--done","data-theme":d},s("div",{class:"zonos--header"},I(),s("zonos-button",{class:"zonos--close-button",icon:s("zonos-icon",{content:L}),noBackground:!0,onClick:()=>this.handleFinishClick(),theme:d})),s("zonos-checkout-finish",{borderRadius:l,onCloseClick:()=>this.handleFinishClick(),overrideNotification:"error"===n.step&&n.error?Object.assign(Object.assign({},n.error),{type:"error"}):void 0,storybookForceStatus:this.storybookPaymentStatusOverride})))};return s(t,{class:y(["zonos--checkout zonos--elements",u&&"has-footer",this.preview&&"preview",this.isMobile&&"mobile"])},this.preview?T():s("zonos-dialog",{borderStyle:l,"data-theme":d,height:"980px",isLoading:e,mobile:this.isMobile,noBodyPadding:!0,noBorder:!0,noClickOutside:!0,noCloseButton:!0,onCloseDialog:()=>this.closeDialogHandler(),open:this.open,width:"1200px"},T()))}static get assetsDirs(){return["assets"]}static get watchers(){return{appearanceSettingsOverride:["appearanceSettingsOverrideChanged"],mobile:["handleMobileChange"]}}};H.style=".sc-zonos-checkout-h{font-family:Inter;display:block}.sc-zonos-checkout-h img.sc-zonos-checkout{max-width:100%}.sc-zonos-checkout-h dl.sc-zonos-checkout,.sc-zonos-checkout-h dd.sc-zonos-checkout,.sc-zonos-checkout-h h1.sc-zonos-checkout,.sc-zonos-checkout-h h2.sc-zonos-checkout,.sc-zonos-checkout-h h3.sc-zonos-checkout,.sc-zonos-checkout-h h4.sc-zonos-checkout,.sc-zonos-checkout-h h5.sc-zonos-checkout,.sc-zonos-checkout-h h6.sc-zonos-checkout,.sc-zonos-checkout-h hr.sc-zonos-checkout,.sc-zonos-checkout-h figure.sc-zonos-checkout,.sc-zonos-checkout-h p.sc-zonos-checkout,.sc-zonos-checkout-h pre.sc-zonos-checkout{margin:0}.sc-zonos-checkout-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-checkout-h *.sc-zonos-checkout::-webkit-scrollbar{width:10px}.sc-zonos-checkout-h *.sc-zonos-checkout::-webkit-scrollbar-track{background:var(--amino-gray-50)}.sc-zonos-checkout-h *.sc-zonos-checkout::-webkit-scrollbar-thumb{border-radius:10px;background:#cccccc;border:3px solid transparent;background-clip:content-box}.sc-zonos-checkout-h *.sc-zonos-checkout::-webkit-scrollbar-thumb:hover{background:#d6d6d6}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout{display:-ms-flexbox;display:flex;height:100%;overflow:hidden;border-radius:var(--border-radius, var(--amino-radius-10))}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout,.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{-ms-flex:1;flex:1;padding:var(--amino-space-48) var(--amino-space-56)}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout{background-color:var(--primary-color, var(--amino-gray-0));border-right:1px solid var(--amino-gray-200)}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{background-color:var(--amino-gray-0);padding-bottom:var(--amino-space-80)}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout{width:100%;max-height:100%;height:100%;overflow:auto;-ms-flex-direction:column;flex-direction:column;background-color:var(--amino-gray-0);-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;padding:var(--amino-space-24);padding-bottom:50px}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout .zonos--header.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center;width:100%}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout .zonos--header.sc-zonos-checkout img.sc-zonos-checkout{width:150px;min-width:150px}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout .zonos--logo.sc-zonos-checkout{margin-bottom:0}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout zonos-checkout-finish.sc-zonos-checkout{-ms-flex:1;flex:1}.sc-zonos-checkout-h .zonos--left.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}.sc-zonos-checkout-h .zonos--left.sc-zonos-checkout .zonos--back-button.sc-zonos-checkout{margin-bottom:var(--amino-space-24)}.sc-zonos-checkout-h .zonos--left.sc-zonos-checkout .zonos--wrapper.sc-zonos-checkout{padding:0 var(--amino-space-8) var(--amino-space-8)}.sc-zonos-checkout-h .zonos--left.sc-zonos-checkout .zonos--payment-error-banner.sc-zonos-checkout{margin-top:var(--amino-space-24)}.sc-zonos-checkout-h .zonos--right.sc-zonos-checkout{position:relative}.sc-zonos-checkout-h .zonos--right.sc-zonos-checkout .zonos--close-button.sc-zonos-checkout{position:absolute;right:var(--amino-space-24);top:var(--amino-space-24)}.sc-zonos-checkout-h .zonos--footer.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-pack:end;justify-content:flex-end;-ms-flex-align:center;align-items:center;position:absolute;bottom:var(--amino-space-32);right:var(--amino-space-56);gap:var(--amino-space-8)}.sc-zonos-checkout-h .zonos--wrapper.sc-zonos-checkout{overflow:auto;max-height:100%;position:relative}.sc-zonos-checkout-h .flex--wrapper.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;max-height:100%}.sc-zonos-checkout-h .zonos--logo.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.sc-zonos-checkout-h .zonos--checkout-default-message.sc-zonos-checkout{margin-left:var(--amino-space-76);margin-bottom:var(--amino-space-8)}.preview.sc-zonos-checkout-h{min-width:500px;margin:auto}.preview.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout{border:var(--amino-border)}.preview.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout{padding:var(--amino-space-32)}.mobile.sc-zonos-checkout-h{min-width:auto}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;overflow:auto;border-radius:0;max-height:100%;height:100%;border:0}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout,.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{padding:var(--amino-space-12)}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout{-ms-flex-order:2;order:2}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{-ms-flex-order:1;order:1;padding-top:var(--amino-space-16)}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout .zonos--wrapper.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:var(--amino-space-16);margin-top:var(--amino-space-24);border:var(--amino-border);border-radius:var(--border-radius, var(--amino-radius-10));background-color:var(--amino-gray-50);padding:var(--amino-space-12);margin-top:var(--amino-space-32)}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--wrapper.sc-zonos-checkout{max-height:100%}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--footer.sc-zonos-checkout{-ms-flex-order:3;order:3}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout{width:auto}.mobile.sc-zonos-checkout-h .zonos--cart-subtotal.sc-zonos-checkout{margin:0}.mobile.sc-zonos-checkout-h .zonos--footer.sc-zonos-checkout{bottom:0;left:0;padding:var(--amino-space-12);position:relative;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;background-color:var(--amino-gray-0)}";export{H as zonos_checkout}
@@ -1 +0,0 @@
1
- import{r as o,c as t,h as n,H as s}from"./p-dc8d7000.js";import{s as i}from"./p-25db3885.js";import{h as e,b as r,i as a,l as c,c as l,d as h}from"./p-770c959e.js";import{z as d,d as u}from"./p-08695f4e.js";import"./p-bf070bf6.js";import"./p-0e0b46a5.js";const m=class{constructor(n){o(this,n),this.stripeInitEvent=t(this,"stripeInitEvent",7),this.config=void 0,this.zonosApiKey=void 0}async initCheckoutElement(o){o?(i.stripe=o,(async o=>{o.placeOrderButtonSelector&&(a(o.placeOrderButtonSelector)?(()=>{if(!document.querySelector("zonos-checkout")){const o=document.createElement("zonos-checkout");document.body.appendChild(o)}})():r(`Selector checkoutButtonAnchor "${o.placeOrderButtonSelector}" is not a valid selector`))})(d.checkoutSettings),c("init checkout element")):c("Stripe is not loaded yet - cannot init checkout element","warn")}initZonosNotification(){if(document.querySelector("zonos-notification"))return;const o=document.createElement("zonos-notification");document.body.appendChild(o)}async componentWillLoad(){d.zonosApiKey=this.zonosApiKey,(async()=>{var o,t;const{errors:n,json:s}=await(async()=>{const{errors:o,json:t}=await e("https://v1.route.js.zonos.com/api/zonos-setting");return o.length?(r("Error occurs when getting zonos settings. If this is not an unauthorized error, it will use user setting or default setting"),{errors:o,json:null}):{errors:[],json:t}})();if("403"===(null===(o=n[0])||void 0===o?void 0:o.type.toString()))return void c("Failed to load zonos settings. This domain may not have access","warn");this.initZonosNotification(),u({overrideSettings:this.config,zonosSettings:s}),d.helloSettings&&(async o=>{const{anchorElementSelector:t}=o;if(!t||!a(t))return void r(`Selector anchorElementSelector "${o.anchorElementSelector}" is not a valid selector.`);const n=document.querySelector(t);c("Hello init complete"),(o=>{if(!document.querySelector("zonos-hello")&&o){const t=document.createElement("zonos-hello");o.appendChild(t)}})(n)})(d.helloSettings),await l();const i=(null===(t=null==s?void 0:s.checkoutSettings)||void 0===t?void 0:t.externalServiceTokens.find((o=>"STRIPE_PUBLISHABLE_TOKEN"===o.type)))||null;if(i&&this.stripeInitEvent){if("INACTIVE"===d.checkoutSettings.subscriptionStatus)return c('=== Checkout subscription is "INACTIVE" - Cancel initializing for Checkout ===',"warn"),void c("zonos controller loaded");if("DISABLED"===d.checkoutSettings.visibilityStatus)return c("=== Checkout is disabled by store owner ===","warn"),void c("zonos controller loaded");this.stripeInitEvent.emit({publishableKey:i.token}),c("zonos controller loaded")}else c("Checkout failed to load -- missing publishable key","warn")})()}async showNotification(o){const t=document.querySelector("zonos-notification");t?t.showNotification(o):c("Failed to show notification - zonos-notification not found","warn")}async overrideConfig(o){u({overrideSettings:o,zonosSettings:null})}async overrideCountry(o){h(o)}render(){return n(s,{class:"zonos--elements"})}};m.style=":host{font-family:Inter;display:block}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{visibility:hidden;opacity:0;height:0}";export{m as zonos_controller}
@@ -1 +0,0 @@
1
- var __awaiter=this&&this.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r["throw"](e))}catch(e){s(e)}}function l(e){e.done?n(e.value):i(e.value).then(o,a)}l((r=r.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var n={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(e){return function(t){return l([e,t])}}function l(a){if(r)throw new TypeError("Generator is already executing.");while(o&&(o=0,a[0]&&(n=0)),n)try{if(r=1,i&&(s=a[0]&2?i["return"]:a[0]?i["throw"]||((s=i["return"])&&s.call(i),0):i.next)&&!(s=s.call(i,a[1])).done)return s;if(i=0,s)a=[a[0]&2,s.value];switch(a[0]){case 0:case 1:s=a;break;case 4:n.label++;return{value:a[1],done:false};case 5:n.label++;i=a[1];a=[0];continue;case 7:a=n.ops.pop();n.trys.pop();continue;default:if(!(s=n.trys,s=s.length>0&&s[s.length-1])&&(a[0]===6||a[0]===2)){n=0;continue}if(a[0]===3&&(!s||a[1]>s[0]&&a[1]<s[3])){n.label=a[1];break}if(a[0]===6&&n.label<s[1]){n.label=s[1];s=a;break}if(s&&n.label<s[2]){n.label=s[2];n.ops.push(a);break}if(s[2])n.ops.pop();n.trys.pop();continue}a=t.call(e,n)}catch(e){a=[6,e];i=0}finally{r=s=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};System.register(["./p-6dcd752e.system.js","./p-164fae93.system.js","./p-85ab35c9.system.js","./p-8c867835.system.js"],(function(e){"use strict";var t,n,r,i,s,o,a,l,c;return{setters:[function(e){t=e.c;n=e.z},function(e){r=e.h;i=e.l;s=e.a;o=e.b;a=e.t},function(e){l=e.i},function(e){c=e.g}],execute:function(){var u=this;var d=function(){var e=y.stripeLinkEventData;var t=y.stripeAddressEventData;if(!t||!t.complete){throw new Error("Missing stripe address data")}return{checkoutSessionId:j.checkoutSessionId||"",contact:{email:(e===null||e===void 0?void 0:e.value.email)||"",firstName:t.value.firstName||"",lastName:t.value.lastName||"",phone:t.value.phone||""},items:j.items.map((function(e){return e})),shippingAddress:{addressLine1:t.value.address.line1,addressLine2:t.value.address.line2||"",city:t.value.address.city,country:t.value.address.country,postalCode:t.value.address.postal_code,state:t.value.address.state}}};var p=function(e){return __awaiter(u,void 0,void 0,(function(){var t,n,i,s;return __generator(this,(function(o){switch(o.label){case 0:t="".concat("https://v1.route.js.zonos.com","/api/calculate-landed-cost");return[4,r(t,{body:d(),method:"POST",signal:e===null||e===void 0?void 0:e.signal})];case 1:n=o.sent(),i=n.errors,s=n.json;if(i.length||!s){throw new Error("Failed to calculate landed cost")}return[2,s]}}))}))};var v=function(e){var t=e.theme;switch(t){default:return{".Input":{padding:"0",paddingBottom:"8px",paddingLeft:"16px",paddingRight:"8px",paddingTop:"6px"}}}};var f=function(e){var t=e.borderStyle,n=e.theme;switch(n){case"DARK":return{borderRadius:c(t),colorBackground:"#101117",colorBackgroundText:"#C5C6CA",colorText:"#C5C6CA",colorTextPlaceholder:"#C5C6CA"};default:return{borderRadius:c(t)}}};var h=t((function(){return{clientSecret:sessionStorage.getItem("zonos--client-secret")||null,fetchingLandedCostAbordController:null,isFetchingLandedCost:false,isFetchingSession:false,stripe:null,stripeAddressElement:null,stripeAddressEventData:null,stripeAddressUsedWhenFetchingLC:null,stripeElements:null,stripeLinkElement:null,stripeLinkEventData:null,stripeLinkUsedWhenFetchingLC:null,stripePaymentElement:null,stripePaymentEventData:null}})),m=h.onChange,g=h.reset,y=h.state;e("s",y);var C=function(e){var t=e.clientSecret,r=e.overrideBorderRaidus,i=e.overridePrimaryColor,o=e.overrideTheme;var a=i||n.appearance.colorPrimary;var c=a&&l(a)?"night":"flat";var u=o==="DARK"?"night":"flat";return{appearance:{labels:"floating",rules:Object.assign({},v({theme:"LIGHT"})),theme:o?u:c,variables:Object.assign({},f({borderStyle:r,theme:"LIGHT"}))},clientSecret:t,locale:s.selectedLocale}};var S=e("k",(function(e){return __awaiter(u,void 0,void 0,(function(){var t,n,r;return __generator(this,(function(s){n=y.clientSecret;if(!y.stripe){i("Skip. Stripe is not initialized");return[2]}if(n){r=C({clientSecret:n,overrideBorderRaidus:e===null||e===void 0?void 0:e.overrideBorderRaidus,overridePrimaryColor:e===null||e===void 0?void 0:e.overridePrimaryColor,overrideTheme:e===null||e===void 0?void 0:e.overrideTheme});if(!y.stripeElements){y.stripeElements=(t=y.stripe)===null||t===void 0?void 0:t.elements(r)}else{y.stripeElements.update(r)}i("Stripe elements initialized")}return[2]}))}))}));var b=e("o",(function(){sessionStorage.removeItem("zonos--client-secret");g();y.stripe=window.Zonos.stripe}));var w=function(){var e,t,n,r;var i=y.fetchingLandedCostAbordController;if(!i){return false}var s=JSON.stringify((e=y.stripeLinkUsedWhenFetchingLC)===null||e===void 0?void 0:e.value)!==JSON.stringify((t=y.stripeLinkEventData)===null||t===void 0?void 0:t.value);var o=JSON.stringify((n=y.stripeAddressUsedWhenFetchingLC)===null||n===void 0?void 0:n.value)!==JSON.stringify((r=y.stripeAddressEventData)===null||r===void 0?void 0:r.value);return s||o};var _=e("m",(function(){return __awaiter(u,void 0,void 0,(function(){var e,t,n,r,i,s,a,l,c,u,d,v,f,h;return __generator(this,(function(m){switch(m.label){case 0:i=!!((e=y.stripeAddressEventData)===null||e===void 0?void 0:e.complete);s=!!((t=y.stripeLinkEventData)===null||t===void 0?void 0:t.complete);a=w();if(a){(n=y.fetchingLandedCostAbordController)===null||n===void 0?void 0:n.abort();y.fetchingLandedCostAbordController=null}if(!(i&&s&&(a||!y.isFetchingLandedCost)))return[3,5];y.isFetchingLandedCost=true;if(y.stripeAddressEventData){y.stripeAddressUsedWhenFetchingLC=Object.assign({},y.stripeAddressEventData)}if(y.stripeLinkEventData){y.stripeLinkUsedWhenFetchingLC=Object.assign({},y.stripeLinkEventData)}m.label=1;case 1:m.trys.push([1,3,,4]);l=new AbortController;y.fetchingLandedCostAbordController=l;return[4,p(l)];case 2:c=m.sent(),u=c.checkoutSessionWorkflow,d=c.shipmentRatingCalculateWorkflow;y.fetchingLandedCostAbordController=null;j.landedCostData=(u===null||u===void 0?void 0:u.filter(Boolean))||null;j.shippingData=(d===null||d===void 0?void 0:d.filter(Boolean))||null;v=(r=j.landedCostData)===null||r===void 0?void 0:r.find(Boolean);f=!!v?v.subtotals:null;if(f){B({exchangeRate:f.exchangeRate,items:f.items,landedCostTotal:0,presentmentCurrencyCode:f.presentmentCurrencyCode,shipping:0,total:f.items})}return[3,4];case 3:h=m.sent();o(h);return[3,4];case 4:y.isFetchingLandedCost=false;m.label=5;case 5:return[2]}}))}))}));var k=function(e){var t=[];var n=true;switch(e){case"succeeded":{t=[a("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."),"","",a("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=false;break}case"requires_capture":case"processing":{t=[a("Payment processing. We'll update you when payment is received.")];n=false;break}case"requires_payment_method":{t=[a("Payment failed. Please try another payment method.")];break}default:{t=[a("Something went wrong.")];break}}return{isError:n,messages:t}};var A=e("p",(function(e){var t=e.clientSecret,n=e.storybookForceStatus;return __awaiter(u,void 0,void 0,(function(){var e,r,i,s,l,c,u,d,p;return __generator(this,(function(v){switch(v.label){case 0:if(n){e=k(n),r=e.isError,i=e.messages;return[2,{error:r,messages:i}]}s=t||y.clientSecret;if(!y.stripe||!s){o("Failed to retrieve payment intent. Stripe is not initialized");return[2,{error:true,message:[a("Something went wrong.")]}]}return[4,y.stripe.retrievePaymentIntent(s)];case 1:l=v.sent().paymentIntent;c=l===null||l===void 0?void 0:l.status;u=k(c),d=u.isError,p=u.messages;return[2,{error:d,messages:p}]}}))}))}));var E=e("n",(function(){return __awaiter(u,void 0,void 0,(function(){var e,t,n,r,i,s,o,a;return __generator(this,(function(l){switch(l.label){case 0:r=!!((e=y.stripePaymentEventData)===null||e===void 0?void 0:e.complete);i=y.stripeElements;s=y.stripe;o=y.clientSecret;if(!(s&&i&&r&&o))return[3,2];return[4,s.confirmPayment({confirmParams:{receipt_email:(n=(t=y.stripeLinkEventData)===null||t===void 0?void 0:t.value)===null||n===void 0?void 0:n.email,return_url:window.location.href},elements:i,redirect:"if_required"})];case 1:a=l.sent().error;if(a){if(a.type==="card_error"||a.type==="validation_error"){throw new Error(a.message)}if(a.type==="invalid_request_error"){if(a.code==="payment_intent_unexpected_state"){return[2]}}throw new Error("An unexpected error occurred.")}l.label=2;case 2:return[2]}}))}))}));var T=e("l",(function(){return __awaiter(u,void 0,void 0,(function(){var e,t,n,a,l,c;return __generator(this,(function(u){switch(u.label){case 0:t=j.items.reduce((function(e,t){return e+t.amount*t.quantity}),0);if(!t||!s.targetCurrency){o("Fail to create checkout session - invalid total or currency");return[2,false]}y.isFetchingSession=true;return[4,r("".concat("https://v1.route.js.zonos.com","/api/create-checkout-session"),{body:{currency:((e=j.items.find(Boolean))===null||e===void 0?void 0:e.currencyCode)||"",itemsAmount:t,presentmentCountryCode:s.selectedCountryCode||null},method:"POST"})];case 1:n=u.sent(),a=n.errors,l=n.json;y.isFetchingSession=false;if(a.length||!l){o("Error occurs when creating checkout session",JSON.stringify(a,null,2));return[2,false]}c=l.checkoutSessionCreate;y.clientSecret=c.clientSecret;j.checkoutSessionId=c.id;B(Object.assign(Object.assign({},c.subtotals),{landedCostTotal:0,shipping:0,total:c.subtotals.items}));i("Exchange rate updated for cart items (checkout session create)","info",j.exchangeRate);i("done-init-checkout-session");return[2,true]}}))}))}));var x=function(e){var t=e.currency,n=e.id,i=e.itemsAmount,s=e.landedCostId,a=e.presentmentCountryCode;return __awaiter(u,void 0,void 0,(function(){var e,l,c;return __generator(this,(function(u){switch(u.label){case 0:return[4,r("".concat("https://v1.route.js.zonos.com","/api/update-checkout-session"),{body:{currency:t,id:n,itemsAmount:i,landedCostId:s,presentmentCountryCode:a},method:"POST"})];case 1:e=u.sent(),l=e.errors,c=e.json;if(l.length||!c){o("Error occurs when updating checkout session",JSON.stringify(l,null,2));return[2,{errors:l,json:c}]}return[2,{errors:[],json:c}]}}))}))};m("clientSecret",(function(e){if(e&&y.stripe){sessionStorage.setItem("zonos--client-secret",e)}if(!e){sessionStorage.removeItem("zonos--client-secret")}}));var D=function(e){var t=e.date,n=e.formatOptions,r=n===void 0?{day:"numeric",weekday:"long",year:"numeric"}:n;return new Intl.DateTimeFormat("en-US",r).format(t)};var L=function(e){var t=new Date;var n=e.getTime()-t.getTime();var r=Math.floor(n/(1e3*60*60*24));return r};var O=t((function(){return{checkoutSessionId:sessionStorage.getItem("zonos--checkout-session-id")||null,currency:"USD",dutiesTaxFees:0,error:null,exchangeRate:null,isSelectedShippingAboveDeminimis:false,isSelectedShippingGuarantee:false,items:[],landedCostData:null,selectedLandedCost:null,selectedShippingOption:null,selectedShippingOptionExpectedDate:"",selectedShippingOptionTransitTime:"",shipping:0,shippingData:null,step:"customer-info",subtotal:0,total:0}})),I=O.onChange,F=O.reset,j=O.state;e("c",j);var P=e("b",(function(e){var t=e.minTransitAt?L(new Date(e.minTransitAt)):"";var n=e.maxTransitAt?L(new Date(e.maxTransitAt)):"";var r=e.minTransitAt?D({date:new Date(e.minTransitAt)}):"";return{expectedDate:r,maxTransit:n,minTransit:t}}));var R=e("g",(function(){sessionStorage.removeItem("zonos--checkout-session-id");F()}));var z=e("j",(function(e){var t=e.messages,n=e.title;j.step="error";j.error={messages:t,title:n}}));var B=e("a",(function(e){j.exchangeRate=e.exchangeRate;j.dutiesTaxFees=e.landedCostTotal;j.subtotal=e.items;j.total=e.total;j.currency=e.presentmentCurrencyCode}));var N=e("f",(function(e){var t=e.currency,n=e.itemsAmount,r=e.landedCostId;return __awaiter(u,void 0,void 0,(function(){var e,l;return __generator(this,(function(c){switch(c.label){case 0:if(r&&j.selectedLandedCost){e=j.selectedLandedCost.subtotals;B(e);i("Exchange rate updated for cart items (landed cost subtotal)","info",j.exchangeRate)}if(!j.checkoutSessionId){o("Could update cart total without checkout session id");return[2,false]}return[4,x({currency:t,id:j.checkoutSessionId,itemsAmount:n,landedCostId:r,presentmentCountryCode:s.selectedCountryCode})];case 1:l=c.sent().json;if(!l){o("Error occurs when updating checkout session");z({messages:[a("There's been an error updating your checkout session. Please reload and try again or contact support if the error persists")],title:a("Error updating Checkout")});return[2,false]}if(!r){B(l.checkoutSessionUpdate.subtotals);i("Exchange rate updated for cart items (checkout session update)","info",j.exchangeRate)}return[2,true]}}))}))}));var W=e("i",(function(e){return __awaiter(u,void 0,void 0,(function(){var t,n,r,i,s,o,a,l,c,u,d,p,v;return __generator(this,(function(f){switch(f.label){case 0:j.selectedShippingOption=e;o=P(j.selectedShippingOption),a=o.expectedDate,l=o.maxTransit,c=o.minTransit;j.selectedShippingOptionExpectedDate=a;j.selectedShippingOptionTransitTime=c&&l?"".concat(c,"-").concat(l):"".concat(c||l);u=(t=j.landedCostData)===null||t===void 0?void 0:t.find((function(e){var t,n,r;return((n=(t=e.landedCost)===null||t===void 0?void 0:t.shipmentRating)===null||n===void 0?void 0:n.id)===((r=j.selectedShippingOption)===null||r===void 0?void 0:r.id)}));j.selectedLandedCost=u||null;if(!u){return[2,false]}j.shipping=u.subtotals.shipping;d=((n=u===null||u===void 0?void 0:u.landedCost)===null||n===void 0?void 0:n.landedCostGuaranteeCode)==="ZONOS";p=!!((i=(r=u===null||u===void 0?void 0:u.landedCost)===null||r===void 0?void 0:r.deMinimis)===null||i===void 0?void 0:i.find((function(e){return["DUTY","TAX"].includes(e.type)&&e.threshold==="ABOVE"})));j.isSelectedShippingAboveDeminimis=p;j.isSelectedShippingGuarantee=d;return[4,N({landedCostId:(s=u.landedCost)===null||s===void 0?void 0:s.id})];case 1:v=f.sent();return[2,v]}}))}))}));I("checkoutSessionId",(function(){if(!j.checkoutSessionId){sessionStorage.removeItem("zonos--checkout-session-id");return}sessionStorage.setItem("zonos--checkout-session-id",j.checkoutSessionId)}));var U=e("h",(function(e){return __awaiter(u,void 0,void 0,(function(){var t,n,r;return __generator(this,(function(i){switch(i.label){case 0:j.items=e;n=(t=e.find(Boolean))===null||t===void 0?void 0:t.currencyCode;r=e.reduce((function(e,t){return e+t.amount*t.quantity}),0);if(!n||!r){return[2]}j.currency=n;y.isFetchingSession=true;return[4,N({currency:n,itemsAmount:r})];case 1:i.sent();y.isFetchingSession=false;return[2]}}))}))}));var G=function(){j.selectedShippingOption=null;j.isSelectedShippingAboveDeminimis=false;j.isSelectedShippingGuarantee=false;j.selectedShippingOptionExpectedDate="";j.selectedShippingOptionTransitTime="";j.shipping=0};var q=e("d",(function(){if(j.step==="customer-info"){j.step="shipping"}else if(j.step==="shipping"){j.step="payment"}else if(j.step==="payment"){j.step="finish"}}));var J=e("e",(function(){if(j.step==="payment"){j.step="shipping"}else if(j.step==="shipping"){j.step="customer-info";G()}}))}}}));
@@ -1 +0,0 @@
1
- System.register(["./p-68d06767.system.js","./p-6dcd752e.system.js","./p-23e7c655.system.js","./p-8c867835.system.js","./p-64fdb7b6.system.js"],(function(e){"use strict";var i,o,s,t,r,n,a,l;return{setters:[function(e){i=e.r;o=e.c;s=e.h;t=e.H},function(e){r=e.z},function(e){n=e.c},function(e){a=e.g},function(e){l=e.i}],execute:function(){var d=":host{font-family:Inter;display:block}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}:host input{margin:0;accent-color:var(--selected-border-color, var(--amino-blue-600))}:host .zonos--shipping-rich-radio-item{display:-ms-flexbox;display:flex;-ms-flex:1;flex:1;padding:var(--amino-space-16);-ms-flex-align:center;align-items:center;gap:var(--amino-space-16);cursor:pointer;border:1px solid var(--amino-gray-200)}:host .zonos--shipping-rich-radio-item:first-child{border-top-left-radius:var(--border-radius, var(--amino-radius-10));border-top-right-radius:var(--border-radius, var(--amino-radius-10))}:host .zonos--shipping-rich-radio-item:last-child{border-bottom-right-radius:var(--border-radius, var(--amino-radius-10))}:host .zonos--shipping-rich-radio-item:not(:last-child){border-bottom:none}:host .zonos--shipping-rich-radio-item.selected{outline:1px solid var(--selected-border-color, var(--amino-blue-600));outline-offset:-1px}:host .zonos--shipping-info{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex:1;flex:1}:host .zonos--shipping-detail{-ms-flex:1;flex:1}:host .zonos--sub-detail{display:-ms-inline-flexbox;display:inline-flex;gap:8px;-ms-flex-wrap:wrap;flex-wrap:wrap}";var h=e("zonos_shipping_rich_radio",function(){function e(e){var s=this;i(this,e);this.radioSelected=o(this,"radioSelected",7);this.handleRichRadioSelect=function(e){var i;s.selectedItem=e;(i=s.radioSelected)===null||i===void 0?void 0:i.emit(e)};this.getRadioItemStyleVariables=function(){var e=s.borderColor||r.appearance.colorSecondary;var i=l(e)?"var(--amino-".concat(e,")"):e;return{"--border-radius":a(s.borderStyle),"--selected-border-color":i||"unset"}};this.items=undefined;this.borderColor=undefined;this.borderStyle=undefined;this.theme=undefined;this.selectedItem=null}e.prototype.render=function(){var e=this;var i;return s(t,{class:"zonos--shipping-rich-radio zonos--elements","data-theme":this.theme,style:this.getRadioItemStyleVariables()},(i=this.items)===null||i===void 0?void 0:i.map((function(i){var o;var t=((o=e.selectedItem)===null||o===void 0?void 0:o.value)===i.value;return s("div",{"aria-hidden":"true",class:n(["zonos--shipping-rich-radio-item",t&&"selected"]),onClick:function(){return e.handleRichRadioSelect(i)}},s("input",{checked:t,class:"zonos--shipping-rich-radio-input",name:"zonos--shipping-rich-radio",type:"radio",value:i.value}),s("div",{class:"zonos--shipping-info"},s("div",{class:"zonos--shipping-detail"},s("zonos-text",{class:"zonos--shipping-label",type:"label"},i.label),(i.sublabel||i.caption)&&s("div",{class:"zonos--sub-detail"},i.sublabel&&s("zonos-text",{color:"gray-800"},i.sublabel),i.caption&&s("zonos-text",{color:"gray-400"},i.caption))),s("zonos-text",{type:"semiBoldLabel"},i.price)))})))};return e}());h.style=d}}}));
@@ -1 +0,0 @@
1
- var __awaiter=this&&this.__awaiter||function(t,e,n,o){function r(t){return t instanceof n?t:new n((function(e){e(t)}))}return new(n||(n=Promise))((function(n,i){function s(t){try{u(o.next(t))}catch(t){i(t)}}function c(t){try{u(o["throw"](t))}catch(t){i(t)}}function u(t){t.done?n(t.value):r(t.value).then(s,c)}u((o=o.apply(t,e||[])).next())}))};var __generator=this&&this.__generator||function(t,e){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},o,r,i,s;return s={next:c(0),throw:c(1),return:c(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function c(t){return function(e){return u([t,e])}}function u(c){if(o)throw new TypeError("Generator is already executing.");while(s&&(s=0,c[0]&&(n=0)),n)try{if(o=1,r&&(i=c[0]&2?r["return"]:c[0]?r["throw"]||((i=r["return"])&&i.call(r),0):r.next)&&!(i=i.call(r,c[1])).done)return i;if(r=0,i)c=[c[0]&2,i.value];switch(c[0]){case 0:case 1:i=c;break;case 4:n.label++;return{value:c[1],done:false};case 5:n.label++;r=c[1];c=[0];continue;case 7:c=n.ops.pop();n.trys.pop();continue;default:if(!(i=n.trys,i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){n.label=c[1];break}if(c[0]===6&&n.label<i[1]){n.label=i[1];i=c;break}if(i&&n.label<i[2]){n.label=i[2];n.ops.push(c);break}if(i[2])n.ops.pop();n.trys.pop();continue}c=e.call(t,n)}catch(t){c=[6,t];r=0}finally{o=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:true}}};System.register(["./p-68d06767.system.js","./p-8db8cc05.system.js","./p-164fae93.system.js","./p-6dcd752e.system.js","./p-85ab35c9.system.js","./p-8c867835.system.js"],(function(t){"use strict";var e,n,o,r,i,s,c,u,a,l,h,f,d;return{setters:[function(t){e=t.r;n=t.c;o=t.h;r=t.H},function(t){i=t.s},function(t){s=t.h;c=t.b;u=t.i;a=t.l;l=t.c;h=t.d},function(t){f=t.z;d=t.d},function(){},function(){}],execute:function(){var v=this;var p=function(){return __awaiter(v,void 0,void 0,(function(){var t,e,n,o;return __generator(this,(function(r){switch(r.label){case 0:t="".concat("https://v1.route.js.zonos.com","/api/zonos-setting");return[4,s(t)];case 1:e=r.sent(),n=e.errors,o=e.json;if(n.length){c("Error occurs when getting zonos settings. If this is not an unauthorized error, it will use user setting or default setting");return[2,{errors:n,json:null}]}return[2,{errors:[],json:o}]}}))}))};var y=function(){var t=document.querySelector("zonos-checkout");if(!t){var e=document.createElement("zonos-checkout");document.body.appendChild(e)}};var _=function(t){return __awaiter(v,void 0,void 0,(function(){return __generator(this,(function(e){if(!t.placeOrderButtonSelector){return[2]}if(!u(t.placeOrderButtonSelector)){c('Selector checkoutButtonAnchor "'.concat(t.placeOrderButtonSelector,'" is not a valid selector'));return[2]}y();return[2]}))}))};var g=function(t){var e=document.querySelector("zonos-hello");if(!e&&t){var n=document.createElement("zonos-hello");t.appendChild(n)}};var m=function(t){return __awaiter(v,void 0,void 0,(function(){var e,n;return __generator(this,(function(o){e=t.anchorElementSelector;if(!e||!u(e)){c('Selector anchorElementSelector "'.concat(t.anchorElementSelector,'" is not a valid selector.'));return[2]}n=document.querySelector(e);a("Hello init complete");g(n);return[2]}))}))};var w=":host{font-family:Inter;display:block}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{visibility:hidden;opacity:0;height:0}";var S=t("zonos_controller",function(){function t(t){e(this,t);this.stripeInitEvent=n(this,"stripeInitEvent",7);this.config=undefined;this.zonosApiKey=undefined}t.prototype.initCheckoutElement=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){if(!t){a("Stripe is not loaded yet - cannot init checkout element","warn");return[2]}i.stripe=t;void _(f.checkoutSettings);a("init checkout element");return[2]}))}))};t.prototype.initZonosNotification=function(){var t=document.querySelector("zonos-notification");if(t){return}var e=document.createElement("zonos-notification");document.body.appendChild(e)};t.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var t=this;return __generator(this,(function(e){f.zonosApiKey=this.zonosApiKey;(function(){return __awaiter(t,void 0,void 0,(function(){var t,e,n,o,r,i;return __generator(this,(function(s){switch(s.label){case 0:return[4,p()];case 1:n=s.sent(),o=n.errors,r=n.json;if(((t=o[0])===null||t===void 0?void 0:t.type.toString())==="403"){a("Failed to load zonos settings. This domain may not have access","warn");return[2]}this.initZonosNotification();d({overrideSettings:this.config,zonosSettings:r});if(f.helloSettings){void m(f.helloSettings)}return[4,l()];case 2:s.sent();i=((e=r===null||r===void 0?void 0:r.checkoutSettings)===null||e===void 0?void 0:e.externalServiceTokens.find((function(t){return t.type==="STRIPE_PUBLISHABLE_TOKEN"})))||null;if(!i||!this.stripeInitEvent){a("Checkout failed to load -- missing publishable key","warn");return[2]}if(f.checkoutSettings.subscriptionStatus==="INACTIVE"){a('=== Checkout subscription is "INACTIVE" - Cancel initializing for Checkout ===',"warn");a("zonos controller loaded");return[2]}if(f.checkoutSettings.visibilityStatus==="DISABLED"){a("=== Checkout is disabled by store owner ===","warn");a("zonos controller loaded");return[2]}this.stripeInitEvent.emit({publishableKey:i.token});a("zonos controller loaded");return[2]}}))}))})();return[2]}))}))};t.prototype.showNotification=function(t){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(n){e=document.querySelector("zonos-notification");if(!e){a("Failed to show notification - zonos-notification not found","warn");return[2]}void e.showNotification(t);return[2]}))}))};t.prototype.overrideConfig=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){d({overrideSettings:t,zonosSettings:null});return[2]}))}))};t.prototype.overrideCountry=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){void h(t);return[2]}))}))};t.prototype.render=function(){return o(r,{class:"zonos--elements"})};return t}());S.style=w}}}));