@zonos/elements 1.3.210 → 1.3.212

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 (204) hide show
  1. package/dist/cjs/{cart-313bd2ff.js → cart-d04009b9.js} +8 -5
  2. package/dist/cjs/{handleFetch-05227713.js → handleFetch-7cf3752e.js} +5 -2
  3. package/dist/cjs/index.cjs.js +8 -8
  4. package/dist/cjs/loader.cjs.js +1 -1
  5. package/dist/cjs/{localization-9b43376c.js → localization-91bcde0e.js} +12 -11
  6. package/dist/cjs/{paypal-67c96668.js → paypal-3a2d4501.js} +3 -3
  7. package/dist/cjs/{updateCheckoutSessionAttributes-a31bb681.js → updateCheckoutSessionAttributes-047bc0cb.js} +1 -1
  8. package/dist/cjs/zonos-address_11.cjs.entry.js +3 -3
  9. package/dist/cjs/zonos-cart-items_14.cjs.entry.js +5 -5
  10. package/dist/cjs/zonos-checkout.cjs.entry.js +8 -6
  11. package/dist/cjs/zonos-controller.cjs.entry.js +4 -4
  12. package/dist/cjs/zonos-country-flag.cjs.entry.js +2 -2
  13. package/dist/cjs/zonos-country-select_4.cjs.entry.js +2 -2
  14. package/dist/cjs/zonos-elements.cjs.js +1 -1
  15. package/dist/cjs/zonos-empty-state-payment_4.cjs.entry.js +4 -4
  16. package/dist/cjs/zonos-hello-dialog.cjs.entry.js +3 -3
  17. package/dist/cjs/zonos-hello.cjs.entry.js +16 -2
  18. package/dist/cjs/zonos-language-select_2.cjs.entry.js +2 -2
  19. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.css +4 -0
  20. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +2 -0
  21. package/dist/collection/components/hello/zonos-hello/zonos-hello.js +16 -0
  22. package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog.css +1 -1
  23. package/dist/collection/components/main/zonos-controller.js +2 -2
  24. package/dist/collection/components/store/hello/localization.js +11 -10
  25. package/dist/collection/components/utils/api/cartCalculateLandedCost.js +6 -3
  26. package/dist/collection/components/utils/handleFetch.js +5 -2
  27. package/dist/collection/components/utils/hello/initHello.js +1 -1
  28. package/dist/esm/{cart-e0703306.js → cart-f36b8065.js} +11 -8
  29. package/dist/esm/{debounce-0e42da22.js → debounce-c34d1270.js} +1 -1
  30. package/dist/esm/{getBorderRadius-71b3b8ab.js → getBorderRadius-87593ff4.js} +1 -1
  31. package/dist/esm/{handleFetch-7dd4622b.js → handleFetch-dd74bbb1.js} +5 -2
  32. package/dist/esm/{index-5ea9f81d.js → index-55a03023.js} +1 -1
  33. package/dist/esm/index.js +8 -8
  34. package/dist/esm/{isDarkColor-3a9d6108.js → isDarkColor-1f58b6be.js} +1 -1
  35. package/dist/esm/loader.js +3 -3
  36. package/dist/esm/{localization-e17c211b.js → localization-cf31c728.js} +13 -12
  37. package/dist/esm/{paypal-dbaf76fd.js → paypal-4dd540c7.js} +5 -5
  38. package/dist/esm/{updateCheckoutSessionAttributes-5097e715.js → updateCheckoutSessionAttributes-7babf0f2.js} +2 -2
  39. package/dist/esm/zonos-address_11.entry.js +8 -8
  40. package/dist/esm/zonos-badge.entry.js +2 -2
  41. package/dist/esm/zonos-banner.entry.js +2 -2
  42. package/dist/esm/zonos-button_3.entry.js +4 -4
  43. package/dist/esm/zonos-card.entry.js +3 -3
  44. package/dist/esm/zonos-cart-items_14.entry.js +10 -10
  45. package/dist/esm/zonos-checkout.entry.js +13 -11
  46. package/dist/esm/zonos-collapse.entry.js +2 -2
  47. package/dist/esm/zonos-component.entry.js +1 -1
  48. package/dist/esm/zonos-controller.entry.js +8 -8
  49. package/dist/esm/zonos-country-flag.entry.js +4 -4
  50. package/dist/esm/zonos-country-select_4.entry.js +5 -5
  51. package/dist/esm/zonos-elements.js +3 -3
  52. package/dist/esm/zonos-empty-state-payment_4.entry.js +8 -8
  53. package/dist/esm/zonos-hello-dialog.entry.js +5 -5
  54. package/dist/esm/zonos-hello.entry.js +19 -5
  55. package/dist/esm/zonos-input.entry.js +3 -3
  56. package/dist/esm/zonos-language-select_2.entry.js +4 -4
  57. package/dist/esm/zonos-link.entry.js +1 -1
  58. package/dist/esm/zonos-logo.entry.js +2 -2
  59. package/dist/esm/zonos-shipping-rich-radio.entry.js +3 -3
  60. package/dist/esm/zonos-stripe-input.entry.js +4 -4
  61. package/dist/esm/zonos-text.entry.js +2 -2
  62. package/dist/esm/zonos-toggle.entry.js +2 -2
  63. package/dist/esm/zonos-tooltip.entry.js +1 -1
  64. package/dist/esm/zonos-v-stack.entry.js +2 -2
  65. package/dist/esm/{zonosStore-00975763.js → zonosStore-c456b933.js} +1 -1
  66. package/dist/esm-es5/cart-f36b8065.js +1 -0
  67. package/dist/esm-es5/{debounce-0e42da22.js → debounce-c34d1270.js} +1 -1
  68. package/dist/esm-es5/{getBorderRadius-71b3b8ab.js → getBorderRadius-87593ff4.js} +1 -1
  69. package/dist/esm-es5/{handleFetch-7dd4622b.js → handleFetch-dd74bbb1.js} +1 -1
  70. package/dist/esm-es5/{index-5ea9f81d.js → index-55a03023.js} +1 -1
  71. package/dist/esm-es5/index.js +1 -1
  72. package/dist/esm-es5/{isDarkColor-3a9d6108.js → isDarkColor-1f58b6be.js} +1 -1
  73. package/dist/esm-es5/loader.js +1 -1
  74. package/dist/esm-es5/{localization-e17c211b.js → localization-cf31c728.js} +1 -1
  75. package/dist/esm-es5/{paypal-dbaf76fd.js → paypal-4dd540c7.js} +1 -1
  76. package/dist/esm-es5/{updateCheckoutSessionAttributes-5097e715.js → updateCheckoutSessionAttributes-7babf0f2.js} +1 -1
  77. package/dist/esm-es5/zonos-address_11.entry.js +1 -1
  78. package/dist/esm-es5/zonos-badge.entry.js +1 -1
  79. package/dist/esm-es5/zonos-banner.entry.js +1 -1
  80. package/dist/esm-es5/zonos-button_3.entry.js +1 -1
  81. package/dist/esm-es5/zonos-card.entry.js +1 -1
  82. package/dist/esm-es5/zonos-cart-items_14.entry.js +1 -1
  83. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  84. package/dist/esm-es5/zonos-collapse.entry.js +1 -1
  85. package/dist/esm-es5/zonos-component.entry.js +1 -1
  86. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  87. package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
  88. package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
  89. package/dist/esm-es5/zonos-elements.js +1 -1
  90. package/dist/esm-es5/zonos-empty-state-payment_4.entry.js +1 -1
  91. package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
  92. package/dist/esm-es5/zonos-hello.entry.js +1 -1
  93. package/dist/esm-es5/zonos-input.entry.js +1 -1
  94. package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
  95. package/dist/esm-es5/zonos-link.entry.js +1 -1
  96. package/dist/esm-es5/zonos-logo.entry.js +1 -1
  97. package/dist/esm-es5/zonos-shipping-rich-radio.entry.js +1 -1
  98. package/dist/esm-es5/zonos-stripe-input.entry.js +1 -1
  99. package/dist/esm-es5/zonos-text.entry.js +1 -1
  100. package/dist/esm-es5/zonos-toggle.entry.js +1 -1
  101. package/dist/esm-es5/zonos-tooltip.entry.js +1 -1
  102. package/dist/esm-es5/zonos-v-stack.entry.js +1 -1
  103. package/dist/esm-es5/{zonosStore-00975763.js → zonosStore-c456b933.js} +1 -1
  104. package/dist/scripts/index.d.ts +6 -2
  105. package/dist/scripts/index.js +1 -1
  106. package/dist/scripts/loadZonos.js +1 -1
  107. package/dist/scripts/zonos.js +1 -1
  108. package/dist/types/components/hello/zonos-hello/zonos-hello.d.ts +2 -0
  109. package/dist/types/components/store/zonosStore.d.ts +1 -1
  110. package/dist/types/components/utils/api/getLocaleMessages.d.ts +1 -1
  111. package/dist/types/scripts/_zonosBase.d.ts +6 -2
  112. package/dist/types/types/generated/graphql.frontend.types.d.ts +1 -1
  113. package/dist/types/types/generated/graphql.frontend.types.ts +1 -1
  114. package/dist/types/types/generated/graphql.internal.types.d.ts +0 -4
  115. package/dist/types/types/generated/graphql.internal.types.ts +1 -4
  116. package/dist/zonos-elements/assets/RemoveIcon.svg +1 -1
  117. package/dist/zonos-elements/index.esm.js +1 -1
  118. package/dist/zonos-elements/{p-7211cb9f.system.entry.js → p-002b5c5f.system.entry.js} +1 -1
  119. package/dist/zonos-elements/{p-4c70fd75.entry.js → p-003f37f4.entry.js} +1 -1
  120. package/dist/zonos-elements/{p-45a2f9b1.system.entry.js → p-043f57e8.system.entry.js} +1 -1
  121. package/dist/zonos-elements/{p-03c060d3.entry.js → p-0595e3f8.entry.js} +1 -1
  122. package/dist/zonos-elements/p-0707379c.entry.js +1 -0
  123. package/dist/zonos-elements/{p-d6a53ea6.js → p-0ae53ff0.js} +1 -1
  124. package/dist/zonos-elements/{p-1dc78af3.system.entry.js → p-12ce9746.system.entry.js} +1 -1
  125. package/dist/zonos-elements/{p-964e2587.system.entry.js → p-137ee43a.system.entry.js} +1 -1
  126. package/dist/zonos-elements/{p-7234f876.system.entry.js → p-1ac8bfbb.system.entry.js} +1 -1
  127. package/dist/zonos-elements/{p-23fe7661.entry.js → p-1c45cd15.entry.js} +1 -1
  128. package/dist/zonos-elements/{p-bf364990.system.entry.js → p-1cc5b4f7.system.entry.js} +1 -1
  129. package/dist/zonos-elements/{p-37058486.system.entry.js → p-1ed7c17d.system.entry.js} +1 -1
  130. package/dist/zonos-elements/{p-8d0e116f.system.js → p-20584d36.system.js} +1 -1
  131. package/dist/zonos-elements/p-23079911.js +1 -0
  132. package/dist/zonos-elements/{p-7f9bbbb3.system.entry.js → p-236643d0.system.entry.js} +1 -1
  133. package/dist/zonos-elements/{p-7b02b1f6.entry.js → p-24a5352e.entry.js} +1 -1
  134. package/dist/zonos-elements/p-2820aff2.system.js +1 -0
  135. package/dist/zonos-elements/{p-239695e8.system.entry.js → p-288761b1.system.entry.js} +1 -1
  136. package/dist/zonos-elements/{p-207bd04a.js → p-2b9c124d.js} +1 -1
  137. package/dist/zonos-elements/{p-20839c46.js → p-2eec2d7c.js} +1 -1
  138. package/dist/zonos-elements/p-3464e486.system.entry.js +1 -0
  139. package/dist/zonos-elements/{p-8f41d864.system.entry.js → p-3a1513ae.system.entry.js} +1 -1
  140. package/dist/zonos-elements/{p-a8f421ac.entry.js → p-3f31901f.entry.js} +1 -1
  141. package/dist/zonos-elements/{p-0751b878.system.js → p-4444bb4e.system.js} +1 -1
  142. package/dist/zonos-elements/{p-a4686344.system.entry.js → p-47ffacd8.system.entry.js} +1 -1
  143. package/dist/zonos-elements/{p-c345b306.system.entry.js → p-544c173a.system.entry.js} +1 -1
  144. package/dist/zonos-elements/{p-71c6bdc3.js → p-56e0ed65.js} +1 -1
  145. package/dist/zonos-elements/{p-97831744.system.entry.js → p-59eaebe3.system.entry.js} +1 -1
  146. package/dist/zonos-elements/{p-02da743b.system.js → p-5fc34563.system.js} +1 -1
  147. package/dist/zonos-elements/{p-144b5006.entry.js → p-605a21ac.entry.js} +1 -1
  148. package/dist/zonos-elements/{p-77e22be4.entry.js → p-62813488.entry.js} +1 -1
  149. package/dist/zonos-elements/{p-a1137930.entry.js → p-67da7b6d.entry.js} +1 -1
  150. package/dist/zonos-elements/{p-5b7686f8.entry.js → p-6a157c84.entry.js} +1 -1
  151. package/dist/zonos-elements/{p-9d95c896.system.entry.js → p-714c28b1.system.entry.js} +1 -1
  152. package/dist/zonos-elements/p-752220fe.entry.js +1 -0
  153. package/dist/zonos-elements/{p-a411ce2a.system.js → p-755cf8bc.system.js} +1 -1
  154. package/dist/zonos-elements/{p-aa40d402.entry.js → p-77666360.entry.js} +1 -1
  155. package/dist/zonos-elements/{p-74276b82.system.entry.js → p-7ab62a26.system.entry.js} +1 -1
  156. package/dist/zonos-elements/{p-4a3bb31d.entry.js → p-7b5de646.entry.js} +1 -1
  157. package/dist/zonos-elements/{p-6aa728f2.js → p-7ce093aa.js} +1 -1
  158. package/dist/zonos-elements/p-81b357f7.system.js +1 -0
  159. package/dist/zonos-elements/{p-23142862.entry.js → p-8b57a34d.entry.js} +1 -1
  160. package/dist/zonos-elements/{p-d1697144.system.entry.js → p-92cc26b7.system.entry.js} +1 -1
  161. package/dist/zonos-elements/{p-68650f1e.system.js → p-9b2aafa6.system.js} +1 -1
  162. package/dist/zonos-elements/{p-19182dc7.system.js → p-9d863a3b.system.js} +1 -1
  163. package/dist/zonos-elements/p-a1cd5572.system.entry.js +1 -0
  164. package/dist/zonos-elements/{p-a6f77d44.js → p-a45a15a0.js} +1 -1
  165. package/dist/zonos-elements/{p-5956a9e0.entry.js → p-a4efb55c.entry.js} +1 -1
  166. package/dist/zonos-elements/{p-36b686b6.entry.js → p-a98b1e8d.entry.js} +1 -1
  167. package/dist/zonos-elements/p-a9ad60a5.system.entry.js +1 -0
  168. package/dist/zonos-elements/{p-3934b38a.entry.js → p-ad556be6.entry.js} +1 -1
  169. package/dist/zonos-elements/{p-5b3b58ef.js → p-b0643c40.js} +1 -1
  170. package/dist/zonos-elements/{p-695bf400.system.entry.js → p-b22fcbda.system.entry.js} +1 -1
  171. package/dist/zonos-elements/{p-1640d77f.js → p-b30c2ad9.js} +1 -1
  172. package/dist/zonos-elements/p-b6aabc2f.system.js +1 -0
  173. package/dist/zonos-elements/{p-0ca1d6dd.entry.js → p-b9ff6458.entry.js} +1 -1
  174. package/dist/zonos-elements/p-c34645cb.js +1 -0
  175. package/dist/zonos-elements/{p-78dd1c53.entry.js → p-c7d5d45d.entry.js} +1 -1
  176. package/dist/zonos-elements/{p-4a1b4a2d.system.js → p-cd1ebef9.system.js} +1 -1
  177. package/dist/zonos-elements/{p-baa88176.system.entry.js → p-d55aec11.system.entry.js} +1 -1
  178. package/dist/zonos-elements/{p-a24870af.entry.js → p-d6fa2dc2.entry.js} +1 -1
  179. package/dist/zonos-elements/{p-a0f570ea.system.entry.js → p-da4c01da.system.entry.js} +1 -1
  180. package/dist/zonos-elements/{p-20b702a7.system.entry.js → p-dba65101.system.entry.js} +1 -1
  181. package/dist/zonos-elements/{p-738a49c0.system.js → p-e63b8b24.system.js} +1 -1
  182. package/dist/zonos-elements/{p-c988cf84.entry.js → p-e640e8b8.entry.js} +1 -1
  183. package/dist/zonos-elements/{p-63a4dac5.entry.js → p-e7b05da2.entry.js} +1 -1
  184. package/dist/zonos-elements/{p-3633a952.system.js → p-e7f8595f.system.js} +1 -1
  185. package/dist/zonos-elements/{p-e5152c04.entry.js → p-ebaaaee9.entry.js} +1 -1
  186. package/dist/zonos-elements/{p-4dbaa2c2.entry.js → p-edc77ea1.entry.js} +1 -1
  187. package/dist/zonos-elements/{p-b50eaeac.system.entry.js → p-eeb01de6.system.entry.js} +1 -1
  188. package/dist/zonos-elements/{p-bf9cb85f.system.entry.js → p-ef1ce617.system.entry.js} +1 -1
  189. package/dist/zonos-elements/p-f0e8e81e.entry.js +1 -0
  190. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  191. package/dist/zonos-elements/zonos-elements.js +1 -1
  192. package/package.json +1 -1
  193. package/dist/esm-es5/cart-e0703306.js +0 -1
  194. package/dist/zonos-elements/p-2122d2cc.system.entry.js +0 -1
  195. package/dist/zonos-elements/p-2652198d.js +0 -1
  196. package/dist/zonos-elements/p-3ee44728.system.js +0 -1
  197. package/dist/zonos-elements/p-4d62f3de.entry.js +0 -1
  198. package/dist/zonos-elements/p-73ff25d8.entry.js +0 -1
  199. package/dist/zonos-elements/p-7ec1fecb.system.js +0 -1
  200. package/dist/zonos-elements/p-992f0b96.js +0 -1
  201. package/dist/zonos-elements/p-ad1e1dbc.entry.js +0 -1
  202. package/dist/zonos-elements/p-cf999a15.system.entry.js +0 -1
  203. package/dist/zonos-elements/p-eb77c0bf.system.js +0 -1
  204. package/dist/zonos-elements/p-ef1ccec6.system.entry.js +0 -1
@@ -1 +0,0 @@
1
- var __awaiter=this&&this.__awaiter||function(e,o,t,i){function n(e){return e instanceof t?e:new t((function(o){o(e)}))}return new(t||(t=Promise))((function(t,r){function s(e){try{l(i.next(e))}catch(e){r(e)}}function a(e){try{l(i["throw"](e))}catch(e){r(e)}}function l(e){e.done?t(e.value):n(e.value).then(s,a)}l((i=i.apply(e,o||[])).next())}))};var __generator=this&&this.__generator||function(e,o){var t={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},i,n,r,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(e){return function(o){return l([e,o])}}function l(a){if(i)throw new TypeError("Generator is already executing.");while(s&&(s=0,a[0]&&(t=0)),t)try{if(i=1,n&&(r=a[0]&2?n["return"]:a[0]?n["throw"]||((r=n["return"])&&r.call(n),0):n.next)&&!(r=r.call(n,a[1])).done)return r;if(n=0,r)a=[a[0]&2,r.value];switch(a[0]){case 0:case 1:r=a;break;case 4:t.label++;return{value:a[1],done:false};case 5:t.label++;n=a[1];a=[0];continue;case 7:a=t.ops.pop();t.trys.pop();continue;default:if(!(r=t.trys,r=r.length>0&&r[r.length-1])&&(a[0]===6||a[0]===2)){t=0;continue}if(a[0]===3&&(!r||a[1]>r[0]&&a[1]<r[3])){t.label=a[1];break}if(a[0]===6&&t.label<r[1]){t.label=r[1];r=a;break}if(r&&t.label<r[2]){t.label=r[2];t.ops.push(a);break}if(r[2])t.ops.pop();t.trys.pop();continue}a=o.call(e,t)}catch(e){a=[6,e];n=0}finally{i=r=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};System.register(["./p-02da743b.system.js","./p-56ba5cbf.system.js"],(function(e,o){"use strict";var t,i,n;return{setters:[function(o){t=o.p;i=o.b;e("setNonce",o.s)},function(e){n=e.g}],execute:function(){var e=this;var r=function(){var e=o.meta.url;var i={};if(e!==""){i.resourcesUrl=new URL(".",e).href}return t(i)};r().then((function(o){return __awaiter(e,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:return[4,n()];case 1:e.sent();return[2,i(JSON.parse('[["p-cf999a15.system",[[2,"zonos-checkout",{"appearanceSettingsOverride":[16],"preview":[4],"hiddenMode":[4,"hidden-mode"],"mobile":[4],"overrideStagingMode":[4,"override-staging-mode"],"defaultAddress":[16],"forceDialogOpen":[4,"force-dialog-open"],"defaultAddressParams":[32],"defaultCustomerProfileAddress":[32],"customerProfile":[32],"open":[32],"isOverlayLoading":[32],"stripe":[32],"submitLoading":[32],"collapseReviewMobile":[32],"isAttachError":[32],"isMobile":[32],"isIframed":[32],"zonosReviewRef":[32],"storybookPaymentStatusOverride":[32],"isLegacyCheckout":[32],"confirmDialogOpen":[32],"isCartExpired":[32],"payInUsdConfirmDialogOpen":[32],"inventoryCheckErrorMessage":[32],"placedOrderInfo":[32],"clientSecret":[32],"stripeCustomerSessionClientSecret":[32],"closeDialogHandler":[64],"init":[64],"setToFinishStep":[64],"mockCheckoutSession":[64],"triggerCheckoutInternational":[64]},[[16,"zonos--init-cart-info","initCartInfoHandler"],[4,"keydown","handleKeyPress"],[9,"resize","handleWindowResize"]],{"appearanceSettingsOverride":["appearanceSettingsOverrideChanged","handleAppearanceSettingsOverrideChange"],"overrideStagingMode":["overrideStagingModeChanged"],"mobile":["handleMobileChange"],"defaultAddress":["handleAddressChange"],"customerProfile":["handleCustomerProfileChange"],"clientSecret":["handleClientSecretChange"],"stripeCustomerSessionClientSecret":["handleClientSecretChange"],"open":["handleOpenChange"]}]]],["p-2122d2cc.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],"isHelloWidgetRendered":[32],"isMobile":[32],"getCountryList":[64],"displayCurrency":[64],"convertAndFormat":[64],"convert":[64],"format":[64],"openHelloDialog":[64]},[[9,"resize","handleResize"]],{"appearanceSettingsOverride":["handleAppearanceSettingsOverrideChange"]}]]],["p-bf364990.system",[[1,"zonos-controller",{"config":[16],"zonosApiKey":[1,"zonos-api-key"],"initCheckoutElement":[64],"setupGoogleFont":[64],"showNotification":[64],"reset":[64],"overrideConfig":[64],"overrideCountry":[64],"getAppearanceSetting":[64],"updateOrganizationName":[64]},[[8,"locationchange","handleLocationChange"]]]]],["p-7234f876.system",[[1,"zonos-tooltip",{"label":[1],"subtitle":[1],"showTooltip":[32]}]]],["p-a0f570ea.system",[[1,"zonos-component",{"first":[1],"middle":[1],"last":[1]}]]],["p-b50eaeac.system",[[1,"zonos-link",{"href":[1],"rel":[1],"target":[1],"linkTitle":[1,"link-title"]}]]],["p-239695e8.system",[[1,"zonos-logo",{"theme":[1],"width":[1]}]]],["p-8f41d864.system",[[1,"zonos-text",{"textColor":[1,"text-color"],"size":[1],"type":[1],"weight":[2],"ready":[32]}]]],["p-ef1ccec6.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],"showLanguageSelect":[32]},[[4,"click","globalClickHandler"]],{"isOpen":["isOpenHandler"]}]]],["p-d1697144.system",[[1,"zonos-badge",{"bold":[4],"badgeColor":[1,"badge-color"],"icon":[16],"iconRight":[4,"icon-right"],"size":[1],"rounded":[4],"loading":[4],"dismissHandler":[16]}]]],["p-1dc78af3.system",[[1,"zonos-shipping-rich-radio",{"items":[16],"borderColor":[1,"border-color"],"borderStyle":[1,"border-style"],"theme":[1],"selectedItem":[16]}]]],["p-74276b82.system",[[1,"zonos-toggle",{"options":[16],"value":[1]}]]],["p-97831744.system",[[1,"zonos-collapse",{"collapsed":[4],"collapseSize":[2,"collapse-size"],"height":[32],"iframe":[32]}]]],["p-bf9cb85f.system",[[1,"zonos-card",{"actions":[16],"backgroundColor":[1,"background-color"],"borderRadius":[2,"border-radius"],"footerActions":[16],"footerContent":[16],"footerHeight":[2,"footer-height"],"label":[16],"spacing":[1]}]]],["p-c345b306.system",[[2,"zonos-stripe-input",{"name":[1],"autoComplete":[1,"auto-complete"],"inputValue":[1,"input-value"],"inputLabel":[1,"input-label"],"overridePrimaryColor":[1,"override-primary-color"],"overrideSecondaryColor":[1,"override-secondary-color"],"isDisabled":[4,"is-disabled"],"isError":[4,"is-error"],"error":[1],"inputPlaceholder":[1,"input-placeholder"],"value":[1025],"required":[4],"internalValue":[32]},null,{"inputValue":["onInputValueChange"],"value":["onValueChange"]}]]],["p-9d95c896.system",[[1,"zonos-input",{"inputValue":[1,"input-value"],"inputLabel":[1,"input-label"],"inputSize":[1,"input-size"],"isDisabled":[4,"is-disabled"],"isError":[4,"is-error"],"inputPlaceholder":[1,"input-placeholder"],"value":[32]},null,{"inputValue":["onInputValueChange"]}]]],["p-45a2f9b1.system",[[1,"zonos-banner",{"bannerTitle":[1,"banner-title"],"intent":[1],"hasContent":[32]}]]],["p-baa88176.system",[[1,"zonos-v-stack",{"spacing":[2]}]]],["p-7211cb9f.system",[[1,"zonos-empty-state-payment",{"emptyStateText":[1,"empty-state-text"],"theme":[1]}],[2,"zonos-payment",{"titleText":[1,"title-text"],"stripe":[32],"stripeElements":[32],"isPaymentInfoFilled":[32]},null,{"isPaymentInfoFilled":["watchIsPaymentInfoFilled"],"stripeElements":["watchInitStripe"],"stripe":["watchInitStripe"]}],[2,"zonos-paypal-payment"],[1,"zonos-notification",{"notificationArray":[32],"showNotification":[64]}]]],["p-695bf400.system",[[1,"zonos-language-select",{"handleOnClose":[16]}],[1,"zonos-select-dialog-header",{"handleOnClose":[16],"label":[1]}]]],["p-964e2587.system",[[1,"zonos-country-flag",{"countryCode":[1,"country-code"],"size":[2]}]]],["p-a4686344.system",[[17,"zonos-button",{"buttonColor":[1,"button-color"],"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"],"withBoxShadow":[4,"with-box-shadow"],"noPaddingLeft":[4,"no-padding-left"],"noPaddingRight":[4,"no-padding-right"],"loading":[4],"justifyContent":[1,"justify-content"],"bold":[4],"theme":[1],"hasIcon":[32],"hasContent":[32]},[[2,"click","clickHandler"]],{"icon":["iconChangeHandler"]}],[1,"zonos-spinner",{"size":[2],"spinnerColor":[1,"spinner-color"]}],[1,"zonos-icon",{"autoHeight":[4,"auto-height"],"iconColor":[1,"icon-color"],"content":[1],"size":[2]}]]],["p-7f9bbbb3.system",[[1,"zonos-country-select",{"handleOnClose":[16],"inputValue":[32]}],[1,"zonos-hello-dialog-footer",{"appearanceSettings":[16],"setShowCountrySelect":[16],"setShowLanguageSelect":[16]}],[1,"zonos-custom-message",{"icon":[1],"message":[1]}],[2,"zonos-virtual-scroll",{"renderItem":[16],"itemWidth":[2,"item-width"],"fallbackItemHeight":[2,"fallback-item-height"],"itemHeights":[16],"buffer":[2],"scrollTop":[32],"totalHeight":[32],"containerDimensions":[32]},null,{"itemHeights":["updateTotalHeight"],"fallbackItemHeight":["updateTotalHeight"]}]]],["p-20b702a7.system",[[1,"zonos-address-update-dialog",{"continueLoading":[4,"continue-loading"],"dialogLoading":[4,"dialog-loading"],"dialogOpen":[4,"dialog-open"],"submitBtnType":[1,"submit-btn-type"],"submitBtnColor":[1,"submit-btn-color"],"isMobile":[4,"is-mobile"],"shippingAddress":[16],"billingAddress":[16],"translatedShippingAddress":[16],"translatedBillingAddress":[16],"showErrorBanner":[32],"translatedShippingAddressState":[32],"translatedBillingAddressState":[32]},null,{"translatedShippingAddress":["watchTranslatedShippingAddress"],"translatedBillingAddress":["watchTranslatedBillingAddress"]}],[2,"zonos-custom-address",{"type":[1],"titleText":[1,"title-text"],"defaultAddress":[16],"taxIdErrorMessage":[1,"tax-id-error-message"],"stripe":[32],"isDirtyAddress":[32],"isAddressFilled":[32],"isAddressLine1Entered":[32],"addressSuggestions":[32],"countryField":[32],"startGooglePlaceSuggestions":[32],"shipToCountries":[32],"shippingZones":[32],"city":[32],"country":[32],"firstName":[32],"lastName":[32],"line1":[32],"line2":[32],"phone":[32],"postalCode":[32],"state":[32],"cityError":[32],"stateError":[32],"postalCodeError":[32],"phoneError":[32],"firstNameError":[32],"lastNameError":[32],"isFirstInitialization":[32],"addressService":[32],"checkoutSessionId":[32]},null,{"checkoutSessionId":["isAddressFilledChanged"],"isAddressFilled":["isAddressFilledChanged"],"defaultAddress":["defaultAddressChanged"],"line1":["line1Changed"],"city":["formFieldsChanged"],"country":["formFieldsChanged","countryChanged"],"firstName":["formFieldsChanged"],"lastName":["formFieldsChanged"],"line2":["formFieldsChanged"],"phone":["formFieldsChanged"],"postalCode":["formFieldsChanged"],"state":["formFieldsChanged"],"addressService":["shouldEnabledCustomAddressChanged"],"shippingZones":["shippingZonesChanged"]}],[2,"zonos-address",{"type":[1],"titleText":[1,"title-text"],"defaultAddress":[16],"taxIdErrorMessage":[1,"tax-id-error-message"],"stripe":[32],"isDirtyAddress":[32],"isAddressFilled":[32],"checkoutSessionId":[32],"prevCountry":[32],"prevPostalCode":[32]},null,{"checkoutSessionId":["isAddressFilledChanged"],"isAddressFilled":["isAddressFilledChanged"],"stripe":["watchInitStripe"],"defaultAddress":["defaultAddressChanged"]}],[2,"zonos-link-authentication",{"titleText":[1,"title-text"],"defaultEmail":[1,"default-email"],"isEmailError":[4,"is-email-error"],"stripe":[32],"isStagingMode":[32],"clientSecret":[32]},null,{"isStagingMode":["watchIsStagingMode"],"stripe":["watchInitStripe"],"clientSecret":["watchInitStripe"],"defaultEmail":["watchDefaultEmail"]}],[1,"zonos-checkbox",{"backgroundColor":[1,"background-color"],"label":[1],"isChecked":[4,"is-checked"],"isDisabled":[4,"is-disabled"],"size":[2],"fontSize":[1,"font-size"],"borderStyle":[1,"border-style"]},[[1,"click","onClick"]]],[1,"zonos-address-suggestions",{"type":[1],"suggestions":[16],"selectedSuggestionId":[32],"localSuggestions":[32],"lastHoveredSuggestionId":[32]},null,{"suggestions":["suggestionsChanged"]}],[1,"zonos-dialog",{"open":[4],"headerText":[1,"header-text"],"width":[1],"height":[1],"minHeight":[1,"min-height"],"noHeader":[4,"no-header"],"noBodyPadding":[4,"no-body-padding"],"noBorder":[4,"no-border"],"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"],[4,"keydown","handleKeyDown"]]],[2,"zonos-stripe-phone-input",{"autoComplete":[1,"auto-complete"],"countryOptions":[16],"disabled":[4],"error":[1],"inputLabel":[1,"input-label"],"overridePrimaryColor":[1,"override-primary-color"],"overrideSecondaryColor":[1,"override-secondary-color"],"inputValue":[1,"input-value"],"countryCode":[1,"country-code"],"minWidth":[1,"min-width"],"selectedCountry":[32],"phoneNumber":[32],"isFocused":[32],"isSelectOpen":[32]},null,{"countryOptions":["onCountryOptionsChange"],"selectedCountry":["onSelectedCountryChange"],"inputValue":["onPhoneNumberChange"]}],[1,"zonos-address-display",{"currentAddress":[16],"addressType":[1,"address-type"]}],[1,"zonos-address-form",{"currentAddress":[16],"translatedAddress":[16],"addressType":[1,"address-type"],"localAddress":[32]},null,{"translatedAddress":["watchCurrentAddress"]}],[1,"zonos-stripe-select",{"name":[1],"selectedValue":[1,"selected-value"],"selectLabel":[1,"select-label"],"overridePrimaryColor":[1,"override-primary-color"],"overrideSecondaryColor":[1,"override-secondary-color"],"isDisabled":[4,"is-disabled"],"isError":[4,"is-error"],"error":[1],"selectPlaceholder":[1,"select-placeholder"],"options":[16],"autoComplete":[1,"auto-complete"],"value":[1025],"required":[4],"isClearable":[4,"is-clearable"],"minWidth":[1,"min-width"],"internalValue":[32],"internalOptions":[32]},null,{"options":["onOptionsChange"],"selectedValue":["onSelectedValueChange"],"value":["onValueChange"]}]]],["p-37058486.system",[[2,"zonos-customer-info",{"continueLoading":[4,"continue-loading"],"submitBtnType":[1,"submit-btn-type"],"submitBtnColor":[1,"submit-btn-color"],"isMobile":[4,"is-mobile"],"defaultAddress":[16],"shouldUseCustomAddressFormOverride":[4,"should-use-custom-address-form-override"],"showErrorBanner":[32],"shippingCountry":[32],"isCheckingForRestrictedItems":[32],"isValidatingAddress":[32],"taxIdErrorMessage":[32],"invalidShippingCharacterList":[32],"invalidBillingCharacterList":[32],"openAddressValidationDialog":[32],"isEmailError":[32],"recordedFormTypeUsed":[32],"selectedCountryCode":[32],"genericSettings":[32],"addressFormRenderType":[32]},null,{"showErrorBanner":["watchShowErrorBanner"],"shouldUseCustomAddressFormOverride":["watchShouldEnabledCustomAddress"],"genericSettings":["watchShouldEnabledCustomAddress"],"selectedCountryCode":["watchShouldEnabledCustomAddress"]}],[2,"zonos-checkout-payment",{"submitBtnType":[1,"submit-btn-type"],"continueLoading":[4,"continue-loading"],"submitBtnColor":[1,"submit-btn-color"],"isMobile":[4,"is-mobile"],"overridePrimaryColor":[1,"override-primary-color"],"showErrorBanner":[32],"hasStripePaymentError":[32],"stagingOrderCreateErrorMessage":[32],"internalContinueLoading":[32]},null,{"continueLoading":["continueLoadingWatcher"],"hasStripePaymentError":["stripePaymentErrorWatcher"]}],[1,"zonos-checkout-footer",{"mobile":[4],"dataTheme":[1,"data-theme"],"showLanguageDialog":[32],"isMobile":[32]},[[4,"click","handleGlobalClick"]],{"mobile":["handleMobileChange"]}],[2,"zonos-shipping",{"continueLoading":[4,"continue-loading"],"submitBtnColor":[1,"submit-btn-color"],"submitBtnType":[1,"submit-btn-type"],"selectedShippingMethod":[32],"collapsedDAPOptions":[32],"isSelecting":[32],"showErrorBanner":[32],"serviceLevelsDDP":[32],"serviceLevelsDAP":[32],"serviceLevelsOther":[32],"serviceLevelsAll":[32],"displayBaseCurrency":[32],"shippingData":[32]}],[1,"zonos-cart-subtotal",{"submitBtnType":[1,"submit-btn-type"],"submitBtnColor":[1,"submit-btn-color"],"loading":[32]}],[1,"zonos-cart-restricted-items",{"hide":[4],"errorImages":[32],"internalCollapsed":[32],"firstRender":[32]}],[1,"zonos-checkout-finish",{"borderRadius":[1,"border-radius"],"storybookForceStatus":[1,"storybook-force-status"],"overrideNotification":[16],"isLoading":[32],"notificationType":[32],"notificationTitle":[32],"notificationMessages":[32],"notificationActionText":[32],"order":[32],"isWaitingToRedirect":[32]}],[1,"zonos-confirm-dialog",{"dialogTitle":[1,"dialog-title"],"dialogIntent":[1,"dialog-intent"],"dialogSubtitle":[1,"dialog-subtitle"],"submitBtnColor":[1,"submit-btn-color"],"dialogConfirmBtnText":[1,"dialog-confirm-btn-text"],"dialogWidth":[2,"dialog-width"],"dialogCancelBtnText":[1,"dialog-cancel-btn-text"],"dialogType":[1,"dialog-type"],"isMobile":[4,"is-mobile"],"dialogOpen":[4,"dialog-open"],"noClickOutside":[4,"no-click-outside"]},[[4,"keydown","handleKeyDown"]]],[1,"zonos-checkout-progress-tabs",{"tabColor":[1,"tab-color"],"backgroundColor":[1,"background-color"],"setTabItems":[64],"setTabSelected":[64]}],[1,"zonos-review",{"mobile":[4],"collapsed":[4],"isMobile":[32]},[[9,"resize","handleWindowResize"]]],[1,"zonos-cart-items",{"errorImages":[32]}],[1,"zonos-currency-toggle",{"errorImages":[32]}],[1,"zonos-loading-overlay",{"open":[4],"spinnerColor":[1,"spinner-color"],"size":[2]}],[1,"zonos-rest-state",{"restStateSubtitle":[1,"rest-state-subtitle"],"restStateTitle":[1,"rest-state-title"],"restStateType":[1,"rest-state-type"],"isErrorImageLoad":[32]}]]]]'),o)]}}))}))}))}}}));
@@ -1 +0,0 @@
1
- import{r as o,h as s,H as t,d as i}from"./p-1640d77f.js";import{l as a}from"./p-a6f77d44.js";import{f as n}from"./p-6aa728f2.js";import{c as e}from"./p-b4b7f705.js";import"./p-20839c46.js";import"./p-04a01cb1.js";const h=class{constructor(s){o(this,s),this.countryCode=a.selectedCountryCode}render(){if(!this.el.shadowRoot||!this.countryCode)return null;const o=`https://zonos-store-assets.s3.amazonaws.com/images/elements-flags/${this.countryCode}.svg`,i=n();return s(t,{class:"zonos--elements",style:this.size?{"--zonos--font-family":i,height:`${this.size}px`,width:`${this.size}px`}:{"--zonos--font-family":i}},s("div",{class:e(["flag-container"])},s("div",{class:"flag-icon",style:{backgroundImage:`url(${o})`}})))}get el(){return i(this)}};h.style=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:-ms-inline-flexbox;display:inline-flex}:host .flag-container{position:relative;overflow:hidden;width:100%;height:100%}:host .flag-icon{position:absolute;top:0;left:0;width:100%;height:100%;background-position:center;background-repeat:no-repeat;background-size:cover}";export{h as zonos_country_flag}
@@ -1 +0,0 @@
1
- import{r as t,c as e,h as o,H as i}from"./p-1640d77f.js";import{c as n}from"./p-992f0b96.js";import{i as s,e as r,s as c,a as l}from"./p-a6f77d44.js";import{z as a,e as d,f as h}from"./p-6aa728f2.js";import{g as u,i as p,a as f}from"./p-e7b0c156.js";import{h as m,b as v,l as g}from"./p-20839c46.js";import"./p-71c6bdc3.js";import"./p-207bd04a.js";import"./p-04a01cb1.js";const w=t=>{const e=document.querySelector(t);if(!document.querySelector("zonos-hello")&&e){const t=document.createElement("zonos-hello");return e.appendChild(t),!0}return!1},y=t=>{switch(t){case"BOTTOM_RIGHT":default:return"bottom-right";case"BOTTOM_LEFT":return"bottom-left";case"TOP_LEFT":return"top-left";case"TOP_RIGHT":return"top-right"}},S=({position:t="bottom-right"})=>{const e=".zonos--hello-mobile-wrapper";if(document.querySelector(e))return e;const o=document.createElement("div");return o.className="zonos--hello-mobile-wrapper",o.style.position="fixed","top-right"===t&&(o.style.top="72px",o.style.right="24px"),"top-left"===t&&(o.style.top="72px",o.style.left="24px"),"bottom-right"===t&&(o.style.bottom="72px",o.style.right="24px"),"bottom-left"===t&&(o.style.bottom="72px",o.style.left="24px"),o.style.zIndex="2147483007",document.body.appendChild(o),e},b=async t=>{if(window.Zonos.isLegacyCheckout)return void g("Hello is disabled when isLegacyCheckout","info");const{anchorElementSelector:e}=t;let o=e;if(!t.anchorElementSelector&&t.desktopLocation){const t=S({position:"bottom-right"});o=t}if(o&&s(o)){if(g("Hello init complete"),!w(o)){const e=new MutationObserver((()=>{w(o)&&e.disconnect()}));e.observe(document.body,{childList:!0,subtree:!0}),setTimeout((()=>{w(o)}),1e3),setTimeout((()=>{if(t.notFoundElementFallback){g(`Hello anchor selector ${t.anchorElementSelector} not found after 3 seconds, falling back to 'notFoundElementFallback': ${t.notFoundElementFallback}`,"info");const e=S({position:y(t.notFoundElementFallback)});w(e)}}),3e3)}}else v(`Selector anchorElementSelector "${t.anchorElementSelector}" is not a valid selector.`)};class z{constructor(t,e){this.targetId=t,this.allowedEvents=e,this.listeners=new Map,this.handleMessage=t=>{var e,o,i;const n=t.data,s=(null===(e=this.iframe)||void 0===e?void 0:e.contentWindow)||(null===(i=null===(o=this.iframe)||void 0===o?void 0:o.contentDocument)||void 0===i?void 0:i.defaultView);if(t.source!==s)return;if(!this.isValidMessage(n))return;const r=this.listeners.get(n.type);null==r||r.forEach((t=>{try{t(n.payload)}catch(t){v("Error in event listener:",t)}}))},this.initializeEventListeners(),this.iframe=document.getElementById(this.targetId)}initializeEventListeners(){window.addEventListener("message",this.handleMessage)}isValidMessage(t){if(!t||"object"!=typeof t)return!1;const e=t;return e.id===this.targetId&&"string"==typeof e.type&&this.allowedEvents.includes(e.type)&&void 0!==e.payload}on(t,e){this.listeners.has(t)||this.listeners.set(t,new Set),g(`[CheckoutAddressService] listening to ${t}`,"info");const o=e,i=this.listeners.get(t);return i&&i.add(o),()=>{const e=this.listeners.get(t);e&&e.delete(o)}}destroy(){window.removeEventListener("message",this.handleMessage),this.listeners.clear()}}class I extends z{constructor(){g("=== [Google Places Service] Initializing","info"),super(p.GOOGLE_PLACES,["fetchAutocompleteSuggestions","initializeGooglePlacesService","placeSelected","onFetchAutocompleteSuggestions","onInitializeGooglePlacesService","onPlaceSelected"])}sendMessage(t,e){var o;if(!(null===(o=this.iframe)||void 0===o?void 0:o.contentWindow))return;const i={id:this.targetId,logType:window.Zonos.iframeLogType,payload:e,type:t};g(`GooglePlacesService] parent --\x3e ${t}`,"info",e),this.iframe.contentWindow.postMessage(i,"*")}initialize(){this.sendMessage("initializeGooglePlacesService",{})}fetchSuggestions({country:t,query:e,type:o}){t&&this.sendMessage("fetchAutocompleteSuggestions",{request:{includedRegionCodes:[t],input:e},type:o})}selectPlace({placeId:t,type:e}){this.sendMessage("placeSelected",{placeId:t,type:e})}}class j{constructor(){this.googlePlaceInitialized=!1,g("=== [CheckoutAddressService] Initializing","info"),this.googlePlaces=new I,this.googlePlaces.on("onInitializeGooglePlacesService",(()=>{g("=== [CheckoutAddressService] parent <-- onInitializeGooglePlacesService","info"),this.googlePlaceInitialized=!0})),this.initialize()}initialize(){this.googlePlaces.initialize()}onInitializeGooglePlacesService(t){return this.googlePlaces.on("onInitializeGooglePlacesService",(()=>{g("[CheckoutAddressService] parent <-- onInitializeGooglePlacesService"),t()}))}isGooglePlaceInitialized(){return this.googlePlaceInitialized}onAddressSuggestions(t){return this.suggestionsCallback=t,this.googlePlaces.on("onFetchAutocompleteSuggestions",((...e)=>{g(`[CheckoutAddressService] parent <-- onFetchAutocompleteSuggestions ${e[0].type}`,"info",...e),t(...e)}))}onAddressSelected(t){return this.placeSelectedCallback=t,this.googlePlaces.on("onPlaceSelected",((...e)=>{g(`[CheckoutAddressService] parent <-- onPlaceSelected ${e[0].type}`,"info",...e),t(...e)}))}getAddressSuggestions({country:t,query:e,type:o}){this.googlePlaceInitialized&&this.googlePlaces.fetchSuggestions({country:t,query:e,type:o})}selectAddress({placeId:t,type:e}){this.googlePlaces.selectPlace({placeId:t,type:e})}destroy(){this.googlePlaces.destroy(),this.suggestionsCallback&&(this.suggestionsCallback=void 0),this.placeSelectedCallback&&(this.placeSelectedCallback=void 0)}}const k=class{constructor(o){t(this,o),this.paypalInitEvent=e(this,"paypalInitEvent",7),this.stripeInitEvent=e(this,"stripeInitEvent",7)}async initCheckoutElement(t){var e;t?(n.stripe=t,((e=a.checkoutSettings).placeOrderButtonSelector||e.alwaysTriggerInternationalCheckoutSelector||window.Zonos.cartData)&&(!e.placeOrderButtonSelector||s(e.placeOrderButtonSelector)?!e.alwaysTriggerInternationalCheckoutSelector||s(e.alwaysTriggerInternationalCheckoutSelector)?(()=>{if(!document.querySelector("zonos-checkout")){const t=document.createElement("zonos-checkout");document.body.appendChild(t)}})():v(`Selector alwaysTriggerInternationalCheckoutSelector "${e.alwaysTriggerInternationalCheckoutSelector}" is not a valid selector`):v(`Selector checkoutButtonAnchor "${e.placeOrderButtonSelector}" is not a valid selector`)),g("init checkout element")):g("Stripe is not loaded yet - cannot init checkout element","warn")}initZonosNotification(){if(document.querySelector("zonos-notification"))return;const t=document.createElement("zonos-notification");document.body.appendChild(t)}async setupGoogleFont(t){var e,o;const i=t||h();if("Inter"===i){if(!t)return;g("[FONT] Just applied Inter , but no need to inject since we already inject Inter on start","warn"),a.appearance=Object.assign(Object.assign({},a.appearance),{fontFamily:t})}const n=new URLSearchParams;n.set("family",i);const{errors:s,json:r}=await m(`/api/zonos-elements/get-font-detail?${n.toString()}`);if(s.length>0)return g(`Failed to load font ${i}`,"warn"),void(a.appearance=Object.assign(Object.assign({},a.appearance),{fontFamily:"Inter"}));const c=null==r?void 0:r.fontUrl;c&&(null===(o=(e=window.Zonos).injectSupportGoogleFont)||void 0===o||o.call(e,c)),t&&(g(`[FONT] ${t} font override applied`),a.appearance=Object.assign(Object.assign({},a.appearance),{fontFamily:t}))}handleLocationChange(){b(a.helloSettings)}initHistoryListener(){const t=history.pushState;history.pushState=function(){return window.dispatchEvent(new window.Event("pushstate")),window.dispatchEvent(new window.Event("locationchange")),t.apply(this,arguments)};const e=history.replaceState;history.replaceState=function(){return window.dispatchEvent(new window.Event("replacestate")),window.dispatchEvent(new window.Event("locationchange")),e.apply(this,arguments)}}injectCustomHTML(t){if(!t)return;if(!window.Zonos.isLegacyCheckout)return void g("=== Skip injecting custom HTML for hosted checkout","info");g("=== Injecting custom HTML for hosted checkout");const e=document.createElement("template");e.innerHTML=t,e.content.querySelectorAll("script").forEach((t=>{const e=document.createElement("script");t.src?(e.src=t.src,e.async=t.async):e.textContent=t.innerHTML,document.body.appendChild(e)}))}async initGooglePlacesService(t){const e=null==t?void 0:t.genericSettings;if(!e)return;const o=e.signedTokenGooglePlaces;o&&f({id:p.GOOGLE_PLACES,onload:()=>{a.checkoutAddressService=new j},src:`https://route.elements.zonos.com/iframe/google-maps?signedToken=${o}`})}async componentWillLoad(){this.initHistoryListener(),a.zonosApiKey=this.zonosApiKey,(async()=>{var t,e,o,i,n,s;const{errors:c,json:l,zonosMode:h}=await(async()=>{if(window.Zonos.cartSettings)return{errors:[],json:window.Zonos.cartSettings,zonosMode:window.Zonos.zonosMode};const t=u(),e=new URLSearchParams;t.overrideShouldEnabledCustomAddress&&e.set("overrideShouldEnabledCustomAddress",t.overrideShouldEnabledCustomAddress);const{errors:o,json:i,zonosMode:n}=await m(`/api/zonos-elements/zonos-settings?${e.toString()}`);return o.length?(v("Error occurred when getting zonos settings. If this is not an unauthorized error, it will use user settings or default settings"),{errors:o,json:null,zonosMode:n}):{errors:[],json:i,zonosMode:n}})();if("403"===(null===(e=null===(t=c[0])||void 0===t?void 0:t.type)||void 0===e?void 0:e.toString()))return void g("Failed to load zonos settings. This domain may not have access","warn");const p=(null===(o=null==l?void 0:l.checkoutSettings)||void 0===o?void 0:o.customHTML)||"";this.injectCustomHTML(p),this.initZonosNotification();const f=window.Zonos.isLegacyCheckout&&!!window.Zonos.cartData&&"CLOSE_MODAL"===(null===(i=this.config.checkoutSettings)||void 0===i?void 0:i.successBehavior),w=Object.assign(Object.assign({},this.config),{appearance:Object.assign(Object.assign({},this.config.appearance),{logoUrl:(()=>{var t,e,o;return window.Zonos.isLegacyCheckout?(null===(t=null==l?void 0:l.appearanceSettings)||void 0===t?void 0:t.logoUrl)||(null===(e=this.config.appearance)||void 0===e?void 0:e.logoUrl):null===(o=this.config.appearance)||void 0===o?void 0:o.logoUrl})()}),checkoutSettings:this.config.checkoutSettings?Object.assign(Object.assign({},this.config.checkoutSettings),{allowedSettlementCurrencies:void 0,captureDelay:void 0,subscriptionStatus:void 0,successBehavior:f?"ZONOS_SUCCESS_PAGE":this.config.checkoutSettings.successBehavior,successRedirectUrl:f?(null===(n=window.Zonos.cartData)||void 0===n?void 0:n.storeBaseUrl)||(null==l?void 0:l.onlineStoreSettings.url):this.config.checkoutSettings.successRedirectUrl}):void 0});d({overrideSettings:w,zonosSettings:l}),a.zonosMode=h,this.setupGoogleFont(),"DISABLED"===a.helloSettings.visibilityStatus&&g("=== Hello is disabled by store owner ===","warn"),a.helloSettings&&"ENABLED"===a.helloSettings.visibilityStatus&&(g("Initializing hello"),b(a.helloSettings)),await r();const y=(null===(s=null==l?void 0:l.checkoutSettings)||void 0===s?void 0:s.externalServiceTokens.find((t=>"STRIPE_PUBLISHABLE_TOKEN"===t.type)))||null;if(y&&this.stripeInitEvent){if("INACTIVE"===a.checkoutSettings.subscriptionStatus)return g('=== Checkout subscription is "INACTIVE" - Cancel initializing for Checkout ===',"warn"),void g("zonos controller loaded");if("DISABLED"===a.checkoutSettings.visibilityStatus)return g("=== Checkout is disabled by store owner ===","warn"),void g("zonos controller loaded");this.stripeInitEvent.emit({publishableKey:y.token}),this.initGooglePlacesService(l)}else g("Checkout failed to load -- missing publishable key","warn")})()}async showNotification(t){const e=document.querySelector("zonos-notification");e?e.showNotification(t):g("Failed to show notification - zonos-notification not found","warn")}async reset(){c.checkoutSessionId=null,n.clientSecret=""}async overrideConfig(t){d({overrideSettings:t,zonosSettings:null})}async overrideCountry(t){g(`Override country code to ${t}`),l(t)}async getAppearanceSetting(){return a.appearance}async updateOrganizationName(t){a.organizationName=t}render(){return o(i,{key:"62c0b3079d64f05800da24daa19e0e1e3a890bca",class:"zonos--elements"})}};k.style=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{visibility:hidden;opacity:0;height:0}";export{k as zonos_controller}
@@ -1 +0,0 @@
1
- var __awaiter=this&&this.__awaiter||function(e,n,r,t){function o(e){return e instanceof r?e:new r((function(n){n(e)}))}return new(r||(r=Promise))((function(r,i){function a(e){try{d(t.next(e))}catch(e){i(e)}}function s(e){try{d(t["throw"](e))}catch(e){i(e)}}function d(e){e.done?r(e.value):o(e.value).then(a,s)}d((t=t.apply(e,n||[])).next())}))};var __generator=this&&this.__generator||function(e,n){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},t,o,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(n){return d([e,n])}}function d(s){if(t)throw new TypeError("Generator is already executing.");while(a&&(a=0,s[0]&&(r=0)),r)try{if(t=1,o&&(i=s[0]&2?o["return"]:s[0]?o["throw"]||((i=o["return"])&&i.call(o),0):o.next)&&!(i=i.call(o,s[1])).done)return i;if(o=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++;o=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=n.call(e,r)}catch(e){s=[6,e];o=0}finally{t=i=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,n,r){if(r||arguments.length===2)for(var t=0,o=n.length,i;t<o;t++){if(i||!(t in n)){if(!i)i=Array.prototype.slice.call(n,0,t);i[t]=n[t]}}return e.concat(i||Array.prototype.slice.call(n))};System.register(["./p-19182dc7.system.js","./p-0751b878.system.js","./p-a411ce2a.system.js","./p-3633a952.system.js","./p-738a49c0.system.js"],(function(e){"use strict";var n,r,t,o,i,a,s,d,u,l,c,v,f,p,h,m,w,g;return{setters:[function(e){n=e.z;r=e.c},function(e){t=e.s;o=e.l;i=e.t;a=e.f;s=e.b},function(e){d=e.l;u=e.f;l=e.h;c=e.g;v=e.a;f=e.s;p=e.d;h=e.b;m=e.j},function(e){w=e.i},function(e){g=e.g}],execute:function(){var y=this;var b=function(e){var n=e.currentAddress,r=e.translatedAddress;var t,o,i,a,s,d;var u=n.value.address,l=u.city,c=u.country,v=u.line1,f=u.line2,p=u.postal_code,h=u.state;var m=n.value.name||[n.value.firstName,n.value.lastName].join(" ");return{city:((t=r.city)===null||t===void 0?void 0:t[l])||l,country:c,line1:((o=r.line1)===null||o===void 0?void 0:o[v])||v,line2:((i=r.line2)===null||i===void 0?void 0:i[f||""])||f||"",name:((a=r.name)===null||a===void 0?void 0:a[m])||m,phone:n.value.phone||"",postal_code:((s=r.postal_code)===null||s===void 0?void 0:s[p])||p,state:((d=r.state)===null||d===void 0?void 0:d[h])||h}};var _=function(e){var n;var r=new URLSearchParams(window.location.search).get("zonosE2ETest")==="1";var o=B.stripeLinkEventData;var i=B.stripeAddressEventData;var a=B.stripeShippingSameAsBilling?B.stripeAddressEventData:B.stripeBillingAddressEventData;if(!i||!a){throw new Error("Missing stripe address data")}var s=b({currentAddress:i,translatedAddress:B.translatedAddress.address});var d=s.name.split(" ")[0]||"";var u=s.name.split(" ").splice(1).join(" ")||"";var l=b({currentAddress:a,translatedAddress:B.translatedAddress.address});var c=l.name.split(" ")[0]||"";var v=l.name.split(" ").splice(1).join(" ")||"";return{billingAddress:{addressLine1:l.line1,addressLine2:l.line2||"",city:l.city,country:l.country,postalCode:l.postal_code,state:l.state},billingContact:{firstName:c,lastName:v,phone:l.phone},cartCurrencyCode:(n=_e.items[0])===null||n===void 0?void 0:n.currencyCode,cartId:e,checkoutSessionId:t.checkoutSessionId||"",contact:{companyName:B.companyName,email:o===null||o===void 0?void 0:o.value.email,firstName:d,lastName:u,phone:s.phone},isTest:!!r,landedCostAdjustments:_e.promoCode?[{amount:0,productId:null,promoCode:_e.promoCode,sku:null,type:"PROMO_CODE"}]:[],shipToTaxId:B.taxId,shippingAddress:{addressLine1:s.line1,addressLine2:s.line2,city:s.city,country:s.country,postalCode:s.postal_code,state:s.state}}};var S=function(){var e=new URLSearchParams(window.location.search).get("zonosE2ETest")==="1";var n=B.stripeLinkEventData;var r=B.stripeAddressEventData;var o=B.stripeShippingSameAsBilling?B.stripeAddressEventData:B.stripeBillingAddressEventData;d({stripeAddressData:r,stripeBillingAddressData:o},"info");if(!r||!o){throw new Error("Missing stripe address data")}var i=b({currentAddress:r,translatedAddress:B.translatedAddress.address});var a=i.name.split(" ")[0]||"";var s=i.name.split(" ").splice(1).join(" ")||"";var u=b({currentAddress:o,translatedAddress:B.translatedAddress.address});var l=u.name.split(" ")[0]||"";var c=u.name.split(" ").splice(1).join(" ")||"";var v=_e.adjustments.map((function(e){return{amount:e.amount,name:e.description||null,productId:e.productId,sku:e.sku,type:e.type}}));var f=_e.promoCode?__spreadArray([{amount:0,productId:null,promoCode:_e.promoCode,sku:null,type:"PROMO_CODE"}],v,true):v;return{billingAddress:{addressLine1:u.line1,addressLine2:u.line2||"",city:u.city,country:u.country,postalCode:u.postal_code,state:u.state},billingContact:{firstName:l,lastName:c,phone:u.phone},checkoutSessionId:t.checkoutSessionId||"",contact:{companyName:B.companyName,email:n===null||n===void 0?void 0:n.value.email,firstName:a,lastName:s,phone:i.phone},isTest:e,items:_e.items,landedCostAdjustments:f,shipToTaxId:B.taxId,shippingAddress:{addressLine1:i.line1,addressLine2:i.line2,city:i.city,country:i.country,postalCode:i.postal_code,state:i.state}}};var O=function(e){return __awaiter(y,void 0,void 0,(function(){var n,r,t,o,i,a,s,d,c,v;return __generator(this,(function(f){switch(f.label){case 0:a=S();return[4,e({billingAddress:a.billingAddress,billingContact:a.billingContact,checkoutSessionId:a.checkoutSessionId,contact:a.contact,landedCostAdjustments:a.landedCostAdjustments,publicCredential:window.Zonos.zonosApiKey||"",shippingAddress:a.shippingAddress,zonosApiRoute:u["vercel"]})];case 1:s=f.sent();if(!s||!((n=s.checkoutSessionWorkflow)===null||n===void 0?void 0:n.length)&&((r=s.errors)===null||r===void 0?void 0:r.length)){throw new Error("Failed to build landed cost: ".concat(((o=(t=s===null||s===void 0?void 0:s.errors)===null||t===void 0?void 0:t[0])===null||o===void 0?void 0:o.message)||"Unknown error"))}return[4,l("/api/zonos-elements/validate-landed-cost",{body:s,headers:{"Content-Type":"application/json"},method:"POST"})];case 2:d=f.sent(),c=d.errors,v=d.json;if(!v||c.length){throw new Error("Invalid landed cost object: ".concat(((i=c.find(Boolean))===null||i===void 0?void 0:i.message)||"Unknown error"))}return[2,s]}}))}))};var k=function(e){return __awaiter(y,void 0,void 0,(function(){var r,t,o,i,a,s,d;return __generator(this,(function(u){switch(u.label){case 0:t=n.checkoutSettings.buildLandedCost;if(!t)return[3,2];return[4,O(t)];case 1:o=u.sent();return[2,o];case 2:return[4,l("/api/zonos-elements/calculate-landed-cost",{body:S(),method:"POST",signal:e===null||e===void 0?void 0:e.signal})];case 3:i=u.sent(),a=i.errors,s=i.json;if(a.length||!s){d=((r=a[0])===null||r===void 0?void 0:r.message)==="The user aborted a request.";if(d){throw new Error("The landed cost calculation request was aborted to initiate a new one.")}a.forEach((function(e){console.warn("Error calculating landed cost: ".concat(e.message))}));if(!s){throw new Error("Failed to calculate landed cost")}return[2,s]}return[2,s]}}))}))};var C=function(e){return __awaiter(y,[e],void 0,(function(e){var n,r,t,o,i,a,s;var d=e.abortController,u=e.cartId;return __generator(this,(function(e){switch(e.label){case 0:return[4,l("/api/zonos-elements/cart-calculate-landed-cost",{body:_(u),method:"POST",signal:d===null||d===void 0?void 0:d.signal})];case 1:t=e.sent(),o=t.errors,i=t.json;if(o.length||!i){a=((n=o[0])===null||n===void 0?void 0:n.message)==="The user aborted a request."||((r=o[0])===null||r===void 0?void 0:r.message.includes("signal is aborted"));s=a?"The landed cost calculation request was aborted to initiate a new one.":"Failed to calculate landed cost";throw new Error(s)}return[2,i]}}))}))};var A=undefined&&undefined.__rest||function(e,n){var r={};for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&n.indexOf(t)<0)r[t]=e[t];if(e!=null&&typeof Object.getOwnPropertySymbols==="function")for(var o=0,t=Object.getOwnPropertySymbols(e);o<t.length;o++){if(n.indexOf(t[o])<0&&Object.prototype.propertyIsEnumerable.call(e,t[o]))r[t[o]]=e[t[o]]}return r};var I=function(e){return __awaiter(y,void 0,void 0,(function(){var n,r,t,o,i;return __generator(this,(function(a){switch(a.label){case 0:n=window.Zonos.cartId;if(!!n)return[3,2];return[4,k(e)];case 1:r=a.sent();return[2,r];case 2:return[4,C({abortController:e,cartId:n})];case 3:t=a.sent(),o=t.cartWorkflow,i=A(t,["cartWorkflow"]);return[2,Object.assign(Object.assign({},i),{itemCreateWorkflow:o.items})]}}))}))};var T=e("t",(function(e){return __awaiter(y,[e],void 0,(function(e){var r,t,i,a,s,d,u,h,m;var w=e.checkoutSessionId,g=e.eventName,y=e.metadata;return __generator(this,(function(e){switch(e.label){case 0:i=Date.now();a=__spreadArray([],window.Zonos.trackEventLogs,true);window.Zonos.trackEventLogs.push({checkoutSessionId:w,eventCreated:i,eventName:g});s=window.location.href.includes("zonos.com")&&!window.location.href.includes("checkout.zonos.com")||!!((r=window.Zonos)===null||r===void 0?void 0:r.zonosQaUrl)||!!((t=window.Zonos)===null||t===void 0?void 0:t.debug);d=c()||v();if((d||s)&&!window.Zonos.zonosConversionTest){return[2]}u=o.selectedCountryCode;h=n.organizationId;if(!w){void f({endpoint:"trackConversionEventMetric",errors:['Event "'.concat(g,'" - No checkout session id found')],metadata:{allLogs:p,checkoutSessionId:w,eventName:g,metadata:y,organizationId:h,trackEventLogs:a}});return[2]}if(!h){void f({endpoint:"trackConversionEventMetric",errors:['Event "'.concat(g,'" - No organization id found')],metadata:{allLogs:p,checkoutSessionId:w,eventName:g,metadata:y,organizationId:h,trackEventLogs:a}})}m={checkoutSessionId:w,countryCode:u,eventCreated:i,eventName:g,metadata:Object.assign(Object.assign({},y),{trackEventLogs:a}),organizationId:h};return[4,l("/api/zonos-elements/track-conversion-event",{body:m,method:"POST"})];case 1:e.sent();return[2]}}))}))}));var E=function(e){var n=e.address,r=e.invalidAdddressList;if(!n){return}if(!r){return}var t={};if(r.city){t.city=n.city}if(r.line1){t.line1=n.line1}if(r.line2){t.line2=n.line2}if(r.postal_code){t.postal_code=n.postal_code}if(r.state){t.state=n.state}if(r.name){t.name=n.name}return Object.keys(t).length?t:undefined};var j=function(e){var n=e.addressInvalidCharactersList,r=e.billingAddressInvalidCharactersList,t=e.stripeAddressEventData,o=e.stripeBillingAddressEventData,i=e.stripeShippingSameAsBilling;var a,s,d,u;var l=!!(t===null||t===void 0?void 0:t.complete);var c=i?l:!!(o===null||o===void 0?void 0:o.complete);if(!l||!c){return null}if(!n&&!r){return null}var v=t.value;var f=(o===null||o===void 0?void 0:o.value)||null;var p=v.firstName||((a=v.name)===null||a===void 0?void 0:a.split(" ")[0]);var h=v.lastName||((s=v.name)===null||s===void 0?void 0:s.split(" ")[1]);var m="".concat(p," ").concat(h);var w=v.firstName||((d=f===null||f===void 0?void 0:f.name)===null||d===void 0?void 0:d.split(" ")[0]);var g=v.lastName||((u=f===null||f===void 0?void 0:f.name)===null||u===void 0?void 0:u.split(" ")[1]);var y=w&&g?"".concat(w," ").concat(g):"";var b=v.address;var _=f===null||f===void 0?void 0:f.address;return{address:E({address:Object.assign(Object.assign({},b),{name:m}),invalidAdddressList:n}),billingAddress:!i?E({address:_?Object.assign(Object.assign({},_),{name:y}):null,invalidAdddressList:r}):undefined,destinationCountry:b.country}};var N=e("K",(function(e){var n=e.sort((function(e,n){return e.amount-n.amount}));return n}));var P=function(){return __awaiter(y,void 0,void 0,(function(){var e,n,r,o;return __generator(this,(function(i){switch(i.label){case 0:if(!t.checkoutSessionId){return[2,{errors:[{message:"No checkout session id found"}],json:null}]}e=new URLSearchParams;e.set("checkoutSessionId",t.checkoutSessionId);return[4,l("/api/zonos-elements/get-checkout-session?".concat(e.toString()))];case 1:n=i.sent(),r=n.errors,o=n.json;return[2,{errors:r,json:o}]}}))}))};var D=e("z",(function(){return __awaiter(y,void 0,void 0,(function(){var e,n,r,t;return __generator(this,(function(o){switch(o.label){case 0:return[4,P()];case 1:n=o.sent(),r=n.errors,t=n.json;if(r.length||!t){h("Failed to retrieve checkout session info before confirming payment ",r);void f({endpoint:"validateCheckoutSession",errors:r.map((function(e){return e.message})),metadata:{allLogs:p}});return[2,{errorMessage:i("Unable to retrieve the checkout session at the moment. Please try again or contact our support team."),valid:false}]}if(!((e=t.checkoutSession.landedCost)===null||e===void 0?void 0:e.id)){h("Landed cost is not found in the checkout session before confirming payment.");void f({endpoint:"validateCheckoutSession",errors:["No landed cost found before confirming payment"],metadata:{allLogs:p}});return[2,{errorMessage:i('No shipment rating selected. Please go back to the "Shipping" step and select a shipment rating to proceed.'),valid:false}]}return[2,{errorMessage:"",valid:true}]}}))}))}));var L=function(e){var r=e.theme;var t={".AccordionItem":{color:"var(--colorText)"},".AccordionItem--selected":{color:"var(--colorText)"},".Action":{color:"var(--colorText)"},".Input":{boxShadow:"none",fontSize:n.appearance.fontSizeInputValue?"".concat(n.appearance.fontSizeInputValue,"px"):undefined,padding:"0",paddingBottom:"8px",paddingLeft:"16px",paddingRight:"8px",paddingTop:"6px"},".Label--resting":{fontSize:n.appearance.fontSizeInputLabel?"".concat(n.appearance.fontSizeInputLabel,"px"):undefined},".PickerItem--highlight":{boxShadow:"0 0 0 2px var(--colorBackground)"},".PickerItem--highlight:hover":{backgroundColor:"var(--colorBackground)",boxShadow:"none"},".PickerItem--new":{color:"var(--colorText)"},".Tab--selected":{borderStyle:"solid",borderWidth:"1px"}};switch(r){case"DARK":{return Object.assign(Object.assign({},t),{".Action":Object.assign(Object.assign({},t[".Action"]),{color:"white"}),".PickerItem--new":Object.assign(Object.assign({},t[".PickerItem--new"]),{color:"white"})})}default:return t}};var x=function(e){var n=e.borderStyle,r=e.theme;switch(r){case"DARK":return{borderRadius:g({overrideBorderStyle:n}),colorBackground:"#101117",colorBackgroundText:"#C5C6CA",colorText:"#C5C6CA",colorTextPlaceholder:"#C5C6CA"};default:return{borderRadius:g({overrideBorderStyle:n}),iconMenuColor:"var(--colorText)",iconMenuHoverColor:"var(--colorText)"}}};var R=r((function(){return{checkoutSettlementCurrency:"USD",clientSecret:sessionStorage.getItem("zonos--client-secret")||"",companyName:"",companyNameUsedWhenAsyncAddressUpdate:"",customAddressErrors:{city:"",firstName:"",lastName:"",line1:"",phone:"",postalCode:"",showError:false,state:""},customBillingAddressErrors:{city:"",firstName:"",lastName:"",line1:"",phone:"",postalCode:"",showError:false,state:""},customErrorMessage:null,customerProfile:null,fetchingLandedCostAbortController:null,hasPaymentError:false,isFetchingLandedCost:false,isFetchingSession:false,partyBillingId:null,partyShippingId:null,shouldInventoryRefund:false,shouldRenderPayInUsdButton:false,skipPaymentIntent:new URLSearchParams(window.location.search).get("skipPaymentIntent")==="0"?false:true,stripe:null,stripeAddressElement:null,stripeAddressEventData:null,stripeAddressUsedWhenAsyncAddressUpdate:null,stripeAddressUsedWhenFetchingLC:null,stripeAddressUsedWhenValidatingAddress:null,stripeBillingAddressElement:null,stripeBillingAddressEventData:null,stripeBillingAddressUsedWhenAsyncAddressUpdate:null,stripeBillingAddressUsedWhenFetchingLC:null,stripeBillingAddressUsedWhenValidatingAddress:null,stripeCustomerSessionClientSecret:null,stripeElements:null,stripeElementsForBillingAddress:null,stripeElementsOptions:null,stripeLinkElement:null,stripeLinkEventData:null,stripeLinkUsedWhenFetchingLC:null,stripePaymentElement:null,stripePaymentEventData:null,stripeShippingSameAsBilling:true,taxId:"",taxIdUsedWhenAsyncAddressUpdate:"",translatedAddress:{address:{},billingAddress:{},firstName:{},lastName:{},name:{}}}})),z=R.onChange,U=R.reset,B=R.state;e("c",B);var F=function(e){var r=e.clientSecret,t=e.overrideBorderRadius,i=e.overridePrimaryColor,a=e.overrideSecondaryColor,s=e.overrideTheme,d=e.paypalEnabled;var u=i||n.appearance.colorPrimary;var l=a||n.appearance.colorSecondary;var c=u&&w(u)?"night":"flat";var v=s==="DARK"?"night":"flat";var f=d?["external_paypal"]:[];return{appearance:{labels:"floating",rules:Object.assign({},L({theme:s||"LIGHT"})),theme:s?v:c,variables:Object.assign(Object.assign({},x({borderStyle:t,theme:"LIGHT"})),{colorPrimary:l})},clientSecret:r||undefined,customerSessionClientSecret:B.stripeCustomerSessionClientSecret||undefined,externalPaymentMethodTypes:__spreadArray([],f,true),locale:o.selectedLocale}};var J=e("a",(function(){window.sessionStorage.removeItem("zonos--bigcommerce-domestic-checkout-shipping")}));var M=e("b",(function(e){window.sessionStorage.setItem("zonos--bigcommerce-domestic-checkout-shipping",JSON.stringify(e))}));var q=e("s",(function(){var e=window.sessionStorage.getItem("zonos--bigcommerce-domestic-checkout-shipping");return m(e)}));var W=e("i",(function(e){return __awaiter(y,void 0,void 0,(function(){var n,r,t,o,i;return __generator(this,(function(a){t=B.clientSecret;if(!B.stripe){d("Skip. Stripe is not initialized");return[2]}o=F({clientSecret:t,overrideBorderRadius:e===null||e===void 0?void 0:e.overrideBorderRadius,overridePrimaryColor:e===null||e===void 0?void 0:e.overridePrimaryColor,overrideSecondaryColor:e===null||e===void 0?void 0:e.overrideSecondaryColor,overrideTheme:e===null||e===void 0?void 0:e.overrideTheme,paypalEnabled:e===null||e===void 0?void 0:e.paypalEnabled});i=JSON.stringify(o)===JSON.stringify(B.stripeElementsOptions);if(!B.stripeElements||!B.stripeElementsForBillingAddress){B.stripeElements=(n=B.stripe)===null||n===void 0?void 0:n.elements(o);B.stripeElementsOptions=o;d("Stripe elements initialized");B.stripeElementsForBillingAddress=(r=B.stripe)===null||r===void 0?void 0:r.elements(o);d("Stripe elements for billing address initialized");return[2]}if(!i){B.stripeElements.update(o);B.stripeElementsForBillingAddress.update(o);B.stripeElementsOptions=o;void B.stripeElements.fetchUpdates()}d("Stripe elements updated");return[2]}))}))}));var Y=e("y",(function(){sessionStorage.removeItem("zonos--client-secret");U();B.stripe=window.Zonos.stripe}));var H=function(){var e,n,r,t;var o=JSON.stringify((e=B.stripeAddressUsedWhenValidatingAddress)===null||e===void 0?void 0:e.value)!==JSON.stringify((n=B.stripeAddressEventData)===null||n===void 0?void 0:n.value);var i=!B.stripeShippingSameAsBilling&&JSON.stringify((r=B.stripeBillingAddressEventData)===null||r===void 0?void 0:r.value)!==JSON.stringify((t=B.stripeBillingAddressUsedWhenValidatingAddress)===null||t===void 0?void 0:t.value);return o||i};var K=function(){var e,n,r,t,o,i;var a=JSON.stringify((e=B.stripeLinkUsedWhenFetchingLC)===null||e===void 0?void 0:e.value)!==JSON.stringify((n=B.stripeLinkEventData)===null||n===void 0?void 0:n.value);var s=JSON.stringify((r=B.stripeAddressUsedWhenAsyncAddressUpdate)===null||r===void 0?void 0:r.value)!==JSON.stringify((t=B.stripeAddressEventData)===null||t===void 0?void 0:t.value);var d=!B.stripeShippingSameAsBilling&&JSON.stringify((o=B.stripeBillingAddressUsedWhenAsyncAddressUpdate)===null||o===void 0?void 0:o.value)!==JSON.stringify((i=B.stripeBillingAddressEventData)===null||i===void 0?void 0:i.value);var u=B.taxIdUsedWhenAsyncAddressUpdate!==B.taxId;var l=B.companyNameUsedWhenAsyncAddressUpdate!==B.companyName;return a||s||d||u||l};var G=function(e){var n=e.address,r=e.firstName,o=e.lastName,i=e.name,a=e.phone;var s=(i===null||i===void 0?void 0:i.split(" ")[0])||r||"";var d=(i===null||i===void 0?void 0:i.split(" ")[1])||o||"";if(!s||!d){void f({endpoint:"PARTY_CREATE_NO_NAME_FOUND",errors:["No name found"],metadata:{allLogs:p,cartId:window.Zonos.cartId,checkoutSessionId:t.checkoutSessionId,firstName:r,lastName:o,name:i}})}if(!a){void f({endpoint:"PARTY_CREATE_NO_PHONE_FOUND",errors:["No phone found"],metadata:{allLogs:p,cartId:window.Zonos.cartId,checkoutSessionId:t.checkoutSessionId,phone:a}})}return{city:n.city,country:n.country,firstName:s,lastName:d,line1:n.line1,line2:n.line2,phone:a||"",postal_code:n.postal_code,state:n.state}};var V=e("H",(function(){return __awaiter(y,void 0,void 0,(function(){var e,n,r,o,i,a,s,d,u,c,v,m;return __generator(this,(function(w){switch(w.label){case 0:if(!((e=B.stripeAddressEventData)===null||e===void 0?void 0:e.complete)||!B.stripeShippingSameAsBilling&&!((n=B.stripeBillingAddressEventData)===null||n===void 0?void 0:n.complete)||!B.stripeBillingAddressEventData){return[2,{partiesCreated:false}]}if(!_e.landedCostData){return[2,{partiesCreated:false}]}i=(r=_e.landedCostData.find(Boolean))===null||r===void 0?void 0:r.landedCost.rootId;if(!i){void f({endpoint:"PF_NO_SELECTED_LANDED_COST",errors:["No selected landed cost"],metadata:{allLogs:p,cartId:window.Zonos.cartId,checkoutSessionId:t.checkoutSessionId}});return[2,{partiesCreated:false}]}a=K();if(!a){return[2,{partiesCreated:false}]}s=G({address:B.stripeAddressEventData.value.address,firstName:B.stripeAddressEventData.value.firstName,lastName:B.stripeAddressEventData.value.lastName,name:B.stripeAddressEventData.value.name,phone:B.stripeAddressEventData.value.phone});d=B.stripeShippingSameAsBilling?s:G({address:B.stripeBillingAddressEventData.value.address,firstName:B.stripeBillingAddressEventData.value.firstName,lastName:B.stripeBillingAddressEventData.value.lastName,name:B.stripeBillingAddressEventData.value.name,phone:B.stripeBillingAddressEventData.value.phone});u=new URLSearchParams(window.location.search).get("zonosE2ETest")==="1";return[4,l("/api/zonos-elements/create-parties",{body:{address:s,billingAddress:d,companyName:B.companyName,email:((o=B.stripeLinkEventData)===null||o===void 0?void 0:o.value.email)||"",isTest:u,rootId:i,taxId:B.taxId},method:"POST"})];case 1:c=w.sent(),v=c.errors,m=c.json;if(v.length||!m){h("Error occurs when creating parties",JSON.stringify(v,null,2));void f({endpoint:"PF_PARTY_CREATE_FAILED",errors:["Failed to create parties"],metadata:{allLogs:p,cartId:window.Zonos.cartId,checkoutSessionId:t.checkoutSessionId,errors:v,json:m}});return[2,{partiesCreated:false}]}B.companyNameUsedWhenAsyncAddressUpdate=B.companyName;B.stripeAddressUsedWhenAsyncAddressUpdate=B.stripeAddressEventData;B.stripeBillingAddressUsedWhenAsyncAddressUpdate=B.stripeBillingAddressEventData;B.taxIdUsedWhenAsyncAddressUpdate=B.taxId;B.partyBillingId=m.billToPartyId;B.partyShippingId=m.shipToPartyId;return[2,{partiesCreated:true}]}}))}))}));var Z=function(e){return{countryCode:e.address.country,postalCode:e.address.postal_code,state:e.address.state}};var Q=function(){var e,n;var r=JSON.stringify((e=B.stripeLinkUsedWhenFetchingLC)===null||e===void 0?void 0:e.value)!==JSON.stringify((n=B.stripeLinkEventData)===null||n===void 0?void 0:n.value);var t=B.stripeAddressEventData&&JSON.stringify(Z(B.stripeAddressEventData.value))!==JSON.stringify(B.stripeAddressUsedWhenFetchingLC);var o=!B.stripeShippingSameAsBilling&&B.stripeBillingAddressEventData&&JSON.stringify(Z(B.stripeBillingAddressEventData.value))!==JSON.stringify(B.stripeBillingAddressUsedWhenFetchingLC);return r||t||o};var X=function(){var e;var n=_e.landedCostData&&((e=_e.landedCostData.find(Boolean))===null||e===void 0?void 0:e.subtotals.items)!==_e.subtotal;var r=Q();d("isPrefetchInfoOutdated","info",{isAddressOutdated:r});return!_e.landedCostData&&!B.isFetchingLandedCost||r||n};var $=function(e){var r,t;var o=(r=n.genericSettings)===null||r===void 0?void 0:r.countryFields;var i=(t=n.genericSettings)===null||t===void 0?void 0:t.stripeCountryFieldLabels;var a=i&&e in i?i[e]:null;var s=o&&e in o?o[e]:null;if(_e.addressFormRenderType==="stripe"){return a||s}return s};var ee=function(){var e,n,r,t;var o=!!((e=B.stripeLinkEventData)===null||e===void 0?void 0:e.complete);var i=!!((n=B.stripeAddressEventData)===null||n===void 0?void 0:n.complete);var a=B.stripeShippingSameAsBilling?i:!!((r=B.stripeBillingAddressEventData)===null||r===void 0?void 0:r.complete);var s=((t=B.stripeAddressEventData)===null||t===void 0?void 0:t.value.address.country)||"US";var d=$(s);if(i&&a&&o){return true}if(!d||!B.stripeAddressEventData){return i&&a&&o}var u=B.stripeAddressEventData.value.address.line1.length>0;var l=B.stripeAddressEventData.value.firstName&&B.stripeAddressEventData.value.lastName;var c=!d.stateRequired||d.stateRequired&&B.stripeAddressEventData.value.address.state.length>0;var v=!d.zipRequired||d.zipRequired&&B.stripeAddressEventData.value.address.postal_code.length>=3;var f=B.stripeAddressEventData.value.phone&&B.stripeAddressEventData.value.phone.length>0;return o&&l&&u&&c&&v&&f};var ne=function(){return __awaiter(y,void 0,void 0,(function(){var e,n,r,o,i,a,s,d,u,l,c;return __generator(this,(function(v){switch(v.label){case 0:n=new AbortController;B.fetchingLandedCostAbortController=n;ze();return[4,I(n)];case 1:r=v.sent(),o=r.checkoutSessionWorkflow,i=r.errors,a=r.itemCreateWorkflow,s=r.landedCostCalculateWorkflow,d=r.partyCreateWorkflow,u=r.shipmentRatingCalculateWorkflow;_e.customQuotingError=((e=i===null||i===void 0?void 0:i.find((function(e){var n;return((n=e.extensions)===null||n===void 0?void 0:n.ruleMessageType)==="CUSTOM"})))===null||e===void 0?void 0:e.message)||null;_e.shippingData=N((u===null||u===void 0?void 0:u.filter(Boolean))||[]);Ce(a);B.fetchingLandedCostAbortController=null;_e.partiesData=(d===null||d===void 0?void 0:d.filter(Boolean))||[];_e.landedCostData=(o===null||o===void 0?void 0:o.map((function(e){var n=s===null||s===void 0?void 0:s.find((function(n){return(n===null||n===void 0?void 0:n.id)===e.landedCostId}));if(!n){return null}return Object.assign(Object.assign({},e),{landedCost:n})})).filter(Boolean))||[];l=t.checkoutSessionId;if(o===null||o===void 0?void 0:o.length){void T({checkoutSessionId:l,eventName:"checkout_quoteReceived"})}c=_e.promoCodeApplied&&!_e.landedCostData.find((function(e){var n;return(n=e.landedCost.appliedAdjustments)===null||n===void 0?void 0:n.find((function(e){return e.type==="PROMO_CODE"}))}));_e.promoCodeError=c;if(!c){sessionStorage.setItem("zonos--promo-code",_e.promoCode)}return[2]}}))}))};var re=e("q",(function(e){return __awaiter(y,void 0,void 0,(function(){var n,r,t,o,i,a,s,d,u,l,c,v,p,m;return __generator(this,(function(w){switch(w.label){case 0:i=(e===null||e===void 0?void 0:e.retries)||0;a=!!(e===null||e===void 0?void 0:e.applyingPromocode);s=X();d=ee();if(!d){return[2,{isRequestNotReady:true}]}if(s){(n=B.fetchingLandedCostAbortController)===null||n===void 0?void 0:n.abort();B.fetchingLandedCostAbortController=null}if(!s&&!a){return[2,{isRequestNotReady:false}]}if(i){B.isFetchingLandedCost=false;setTimeout((function(){B.isFetchingLandedCost=true}),300)}else{B.isFetchingLandedCost=true}if(B.stripeAddressEventData){B.stripeAddressUsedWhenFetchingLC={countryCode:B.stripeAddressEventData.value.address.country,postalCode:B.stripeAddressEventData.value.address.postal_code,state:B.stripeAddressEventData.value.address.state}}if(B.stripeBillingAddressEventData){B.stripeBillingAddressUsedWhenFetchingLC={countryCode:B.stripeBillingAddressEventData.value.address.country,postalCode:B.stripeBillingAddressEventData.value.address.postal_code,state:B.stripeBillingAddressEventData.value.address.state}}if(B.stripeLinkEventData){B.stripeLinkUsedWhenFetchingLC=Object.assign({},B.stripeLinkEventData)}w.label=1;case 1:w.trys.push([1,3,,7]);ze();return[4,ne()];case 2:w.sent();u=(r=_e.shippingData)===null||r===void 0?void 0:r.find(Boolean);l=(t=_e.landedCostData)===null||t===void 0?void 0:t.find((function(e){return e.landedCost.shipmentRating.id===(u===null||u===void 0?void 0:u.id)}));c=!!l?l.subtotals:null;if(c){Te({method:(l===null||l===void 0?void 0:l.landedCost.method)||"DDP",subtotals:c})}return[3,7];case 3:v=w.sent();_e.landedCostData=[];_e.shippingData=[];p=["The landed cost calculation request was aborted to initiate a new one."];if(!(v instanceof Error&&v.message&&!p.includes(v.message)))return[3,6];if(!(i<1))return[3,5];return[4,re(Object.assign(Object.assign({},e),{retries:(i||0)+1}))];case 4:w.sent();return[2,{isRequestNotReady:false}];case 5:m=(o=B.stripeAddressEventData)===null||o===void 0?void 0:o.value;void f({endpoint:"Failed to fetch landed cost (".concat(i," retries)"),errors:[v.message],metadata:{cartId:window.Zonos.cartId,shipToAddress:m}});w.label=6;case 6:h(v);return[3,7];case 7:B.isFetchingLandedCost=false;return[2,{isRequestNotReady:false}]}}))}))}));var te=e("B",(function(){return __awaiter(y,void 0,void 0,(function(){var e,n,r,t;return __generator(this,(function(o){switch(o.label){case 0:return[4,re({applyingPromocode:true})];case 1:o.sent();if(_e.step==="payment"){Fe()}return[4,V()];case 2:o.sent();r=(e=_e.shippingData)===null||e===void 0?void 0:e.find(Boolean);t=(n=_e.landedCostData)===null||n===void 0?void 0:n.find((function(e){return e.landedCost.id===(r===null||r===void 0?void 0:r.id)}));if(!r||!t){return[2]}return[4,De(r,t.landedCostId)];case 3:o.sent();return[2]}}))}))}));var oe=e("D",(function(){_e.promoCode="";sessionStorage.removeItem("zonos--promo-code");_e.promoCodeError=false;_e.promoCodeApplied=false}));var ie=e("C",(function(){return __awaiter(y,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:if(_e.step==="payment"){Fe()}oe();return[4,te()];case 1:e.sent();return[2]}}))}))}));var ae=e("E",(function(e){var n=[];var r=true;switch(e){case"succeeded":{n=[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.")];r=false;break}case"requires_capture":case"processing":{n=[i("Payment processing. We'll update you when payment is received.")];r=false;break}case"requires_payment_method":{n=[i("Payment failed. Please try another payment method.")];break}case"requires_action":{r=false;n=[i("Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction.")]}default:{n=[i("Something went wrong.")];break}}return{isError:r,messages:n}}));var se=e("v",(function(){return __awaiter(y,void 0,void 0,(function(){var e,r,t,o,a,s,d,u,c,u;return __generator(this,(function(v){switch(v.label){case 0:t=n.checkoutSettings.onInventoryCheck;o=!!((r=(e=window.Zonos.cartData)===null||e===void 0?void 0:e.metadata.find((function(e){return e.key==="referenceId"})))===null||r===void 0?void 0:r.value);if(!(window.Zonos.isLegacyCheckout&&window.Zonos.cartData&&o))return[3,2];return[4,l("/api/zonos-elements/legacy/inventory-check",{body:{cartData:window.Zonos.cartData},method:"POST"})];case 1:a=v.sent(),s=a.errors,d=a.json;if(s.length||!d){h("Error occurs when handling inventory refund","warn",JSON.stringify(s));return[2,null]}if(!d.available||d.status===204){return[2,i("The item you're looking for is currently unavailable in our inventory. Please check back later or contact support for assistance with availability.")]}if(d.available||d.status===200){B.shouldInventoryRefund=true;return[2,null]}return[2,null];case 2:if(typeof t!=="function"){return[2,null]}v.label=3;case 3:v.trys.push([3,5,,6]);return[4,t({items:_e.items})];case 4:u=v.sent();return[2,u];case 5:c=v.sent();u=c instanceof Error?c.message:"Unknown error";void f({endpoint:"onInventoryCheck",errors:["cartId: ".concat(window.Zonos.cartId," - ").concat(u)],metadata:{cartId:window.Zonos.cartId,href:window.location.href,items:_e.items}});throw c;case 6:return[2]}}))}))}));var de=e("x",(function(){return __awaiter(y,void 0,void 0,(function(){var e,n,r;return __generator(this,(function(t){switch(t.label){case 0:r=!!((n=(e=window.Zonos.cartData)===null||e===void 0?void 0:e.metadata.find((function(e){return e.key==="referenceId"})))===null||n===void 0?void 0:n.value);if(!window.Zonos.isLegacyCheckout||!window.Zonos.cartData||!r){return[2]}return[4,l("/api/zonos-elements/legacy/inventory-refund",{body:{cartData:window.Zonos.cartData},method:"POST"})];case 1:t.sent();return[2]}}))}))}));var ue=e("d",(function(e){return __awaiter(y,[e],void 0,(function(e){var n,r,t,o,a,s,d,u,l;var c=e.clientSecret,v=e.storybookForceStatus;return __generator(this,(function(e){switch(e.label){case 0:if(v){n=ae(v),r=n.isError,t=n.messages;return[2,{error:r,messages:t}]}o=c||B.clientSecret;if(!B.stripe||!o){h("Failed to retrieve payment intent. Stripe is not initialized");return[2,{error:true,message:[i("Something went wrong.")]}]}return[4,B.stripe.retrievePaymentIntent(o)];case 1:a=e.sent().paymentIntent;s=a===null||a===void 0?void 0:a.status;d=ae(s),u=d.isError,l=d.messages;return[2,{error:u,messages:l,paymentIntentId:a===null||a===void 0?void 0:a.id,paymentMethod:a===null||a===void 0?void 0:a.payment_method,status:s}]}}))}))}));var le=e("w",(function(){return __awaiter(y,void 0,void 0,(function(){var e,n,r,o,a,s,u,l,c,v,f,p;return __generator(this,(function(h){switch(h.label){case 0:r=!!((e=B.stripePaymentEventData)===null||e===void 0?void 0:e.complete);o=B.stripeElements;a=B.stripe;s=B.clientSecret;B.customErrorMessage=null;if(!((n=_e.selectedLandedCost)===null||n===void 0?void 0:n.landedCost.id)){throw new Error("Attempted to confirm the payment when no landed cost is found in store")}return[4,D()];case 1:u=h.sent();if(!u.valid){B.customErrorMessage=u.errorMessage;throw new Error(u.errorMessage)}l=t.checkoutSessionId;if(!(a&&o&&r&&s&&l))return[3,3];c=new URL(window.location.href);c.searchParams.set("payment_intent_client_secret",s);c.searchParams.set("zonosCheckoutSessionId",l);void T({checkoutSessionId:l,eventName:"checkout_paymentInfoCompleted"});return[4,a.confirmPayment({confirmParams:{return_url:c.toString()},elements:o,redirect:"if_required"})];case 2:v=h.sent(),f=v.error,p=v.paymentIntent;d("Payment intent confirmed","info",{error:f,paymentIntent:p});if((p===null||p===void 0?void 0:p.status)==="requires_action"){throw new Error(i("Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction."))}if(f){if(f.type==="card_error"||f.type==="validation_error"){throw new Error(f.message)}if(f.type==="invalid_request_error"){if(f.code==="payment_intent_unexpected_state"){return[2]}}throw new Error("An unexpected error occurred.")}if(p.status==="requires_payment_method"){throw new Error(i("Payment failed. Please try another payment method."))}h.label=3;case 3:return[2]}}))}))}));var ce=e("n",(function(){var e;var n=_e.items.reduce((function(e,n){return e+n.amount*n.quantity}),0);var r=t.enabledVariantTestKeys||[];var i={adjustmentsAmount:_e.adjustments.reduce((function(e,n){return e+n.amount}),0),cartId:window.Zonos.cartId,currency:((e=_e.items.find(Boolean))===null||e===void 0?void 0:e.currencyCode)||"",customerAuthenticationToken:_e.customerAuthenticationToken||undefined,itemsAmount:n,metadata:[{key:"language",value:o.selectedLocale}],presentmentCountryCode:o.selectedCountryCode,skipPaymentIntent:B.skipPaymentIntent,varianceTestInput:r};return i}));var ve=e("l",(function(){return __awaiter(y,void 0,void 0,(function(){var e,n,r,o,a;return __generator(this,(function(s){switch(s.label){case 0:if(!t.checkoutSessionId){void f({endpoint:"Error creating payment intent",errors:["No checkout session id found when retrieving payment intent"],metadata:{allLogs:p,cartId:window.Zonos.cartId}});Ie({messages:[i("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:i("Error creating Checkout")});return[2]}return[4,l("/api/zonos-elements/create-payment-intent",{body:{checkoutSessionId:t.checkoutSessionId},method:"POST"})];case 1:n=s.sent(),r=n.errors,o=n.json;a=(e=o===null||o===void 0?void 0:o.checkoutSessionPaymentIntentCreate)===null||e===void 0?void 0:e.clientSecret;if(r.length||!a){h("Error occurs when getting payment intent",JSON.stringify(r,null,2));void f({endpoint:"Error creating payment intent",errors:r.map((function(e){return e.message})),metadata:{allLogs:p,cartId:window.Zonos.cartId,checkoutSessionId:t.checkoutSessionId,clientSecret:a}});Ie({messages:[i("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:i("Error creating Checkout")});return[2]}je(o.checkoutSessionPaymentIntentCreate);return[2]}}))}))}));var fe=e("k",(function(){return __awaiter(y,void 0,void 0,(function(){var e,n,r,t,i,a,s,u;return __generator(this,(function(c){switch(c.label){case 0:if(!o.targetCurrency){h("Failed to create checkout session - missing localizationStore.targetCurrency");return[2,false]}B.isFetchingSession=true;r=ce();d("Checkout session body","info",r);return[4,l("/api/zonos-elements/create-checkout-session",{body:r,method:"POST"})];case 1:t=c.sent(),i=t.errors,a=t.json;B.isFetchingSession=false;if(i.length||!a){s=(e=i.find((function(e){return e.message})))===null||e===void 0?void 0:e.message;if(Array.isArray(s)&&s.some((function(e){return e.message==="Cart is expired."}))){throw new Error("Cart is expired.")}h("Error occurred when creating checkout session",JSON.stringify(i,null,2));return[2,false]}u=a.checkoutSessionCreate;je(u);Te({method:((n=u.landedCost)===null||n===void 0?void 0:n.method)||"DDP",subtotals:u.subtotals});d("Exchange rate updated for cart items (checkout session create)","info",_e.exchangeRate);d("done-init-checkout-session");return[2,true]}}))}))}));var pe=e("u",(function(){return __awaiter(y,void 0,void 0,(function(){var e,r,o;return __generator(this,(function(i){switch(i.label){case 0:e=t.checkoutSessionId;if(!e){h("Failed to update checkout session base currency");return[2,false]}if(n.checkoutSettings.allowedSettlementCurrencies==="LOCAL"){d('allowedSettlementCurrencies: "LOCAL". Skip updating checkout session base currency');return[2,true]}return[4,l("/api/zonos-elements/update-checkout-session-base-currency",{body:{checkoutSessionId:e,currencyCode:B.checkoutSettlementCurrency},method:"POST"})];case 1:r=i.sent().json;o=r===null||r===void 0?void 0:r.checkoutSessionBaseCurrencyUpdate.subtotals.presentmentCurrencyCode;if(!r||o!==B.checkoutSettlementCurrency){h("Failed to update checkout session base currency");return[2,false]}d('Updated checkout session to settlement currency "'.concat(o,'".'));return[2,true]}}))}))}));var he=function(e){return __awaiter(y,[e],void 0,(function(e){var n,r,i,a;var s=e.adjustmentsAmount,d=e.cartId,u=e.currency,c=e.id,v=e.itemsAmount,f=e.landedCostId,p=e.presentmentCountryCode;return __generator(this,(function(e){switch(e.label){case 0:n=t.enabledVariantTestKeys||[];return[4,l("/api/zonos-elements/update-checkout-session",{body:{adjustmentsAmount:s,billToPartyId:B.partyBillingId,cartId:d,currency:u,customerAuthenticationToken:_e.customerAuthenticationToken||undefined,id:c,itemsAmount:v,landedCostId:f,metadata:[{key:"language",value:o.selectedLocale}],presentmentCountryCode:p,shipToPartyId:B.partyShippingId,skipPaymentIntent:B.skipPaymentIntent,varianceTestInput:n},method:"POST"})];case 1:r=e.sent(),i=r.errors,a=r.json;if(i.length||!a){h("Error occurs when updating checkout session",JSON.stringify(i,null,2));return[2,{errors:i,json:a}]}return[2,{errors:[],json:a}]}}))}))};var me=function(e){var n,r,t,o,i,a;var s=e.currentAddress,d=e.translatedAddressResult;var u={};if(!d){return u}var l=d.city,c=d.line1,v=d.line2,f=d.name,p=d.postal_code,h=d.state;if(s.city&&l){u.city=(n={},n[s.city]=l,n)}if(s.line1&&c){u.line1=(r={},r[s.line1]=c,r)}if(s.line2&&v){u.line2=(t={},t[s.line2]=v,t)}if(s.postal_code&&p){u.postal_code=(o={},o[s.postal_code]=p,o)}if(s.state&&h){u.state=(i={},i[s.state]=h,i)}if(s.name&&f){u.name=(a={},a[s.name]=f,a)}return u};var we=e("F",(function(e){return __awaiter(y,[e],void 0,(function(e){var n,r,t,o,i,a,s,d,u,c,v;var f=e.addressInvalidCharactersList,p=e.billingAddressInvalidCharactersList;return __generator(this,(function(e){switch(e.label){case 0:i=j({addressInvalidCharactersList:f,billingAddressInvalidCharactersList:p,stripeAddressEventData:B.stripeAddressEventData,stripeBillingAddressEventData:B.stripeBillingAddressEventData,stripeShippingSameAsBilling:B.stripeShippingSameAsBilling});if(!i){B.translatedAddress={address:{},billingAddress:{}};return[2]}a=H();if(!a){return[2]}return[4,l("/api/zonos-elements/validate-address",{body:i,method:"POST"})];case 1:s=e.sent(),d=s.errors,u=s.json;if(d.length||!u){h("Error occurs when translating address to latin",JSON.stringify(d,null,2));B.translatedAddress={address:{},billingAddress:{}};return[2]}B.stripeAddressUsedWhenValidatingAddress=B.stripeAddressEventData;B.stripeBillingAddressUsedWhenValidatingAddress=B.stripeBillingAddressEventData;c=(n=B.stripeAddressEventData)===null||n===void 0?void 0:n.value.address;v=(r=B.stripeBillingAddressEventData)===null||r===void 0?void 0:r.value.address;B.translatedAddress={address:c?me({currentAddress:Object.assign(Object.assign({},c),{name:(t=B.stripeAddressEventData)===null||t===void 0?void 0:t.value.name}),translatedAddressResult:u.address||null}):{},billingAddress:!B.stripeShippingSameAsBilling?me({currentAddress:Object.assign(Object.assign({},v),{name:(o=B.stripeBillingAddressEventData)===null||o===void 0?void 0:o.value.name}),translatedAddressResult:u.billingAddress||null}):{}};return[2]}}))}))}));z("clientSecret",(function(e){if(e&&B.stripe){sessionStorage.setItem("zonos--client-secret",e)}if(!e){sessionStorage.removeItem("zonos--client-secret")}}));var ge=r((function(){return{addressFormRenderType:"stripe",adjustmentTotal:0,adjustments:[],checkoutSession:null,checkoutSessionTimeoutShow:false,checkoutTimeoutInterval:null,currency:"USD",customQuotingError:null,customerAuthenticationToken:null,displayBaseCurrency:false,dutiesTaxesFees:null,dutiesTaxesFeesEstimate:null,error:null,exchangeRate:null,externalConfirmationPageURL:null,inventoryCheckErrorMessage:null,isSelectedShippingAboveDeminimis:false,isSelectedShippingGuarantee:false,isStagingMode:v(),items:[],landedCostData:null,landedCostMethod:"DDP",partiesData:[],promoCode:sessionStorage.getItem("zonos--promo-code")||"",promoCodeApplied:!!sessionStorage.getItem("zonos--promo-code"),promoCodeError:false,restrictedItems:[],selectedLandedCost:null,selectedShippingOption:null,selectedShippingOptionExpectedDate:"",selectedShippingOptionTransitTime:"",shipping:0,shippingData:null,shouldHideDiscountInput:false,step:"customer-info",subtotal:0,tabItems:{"customer-info":{index:1,isDone:false,label:"Customer",value:"customer-info"},shipping:{index:2,isDone:false,label:"Shipping",value:"shipping"},payment:{index:3,isDone:false,label:"Payment",value:"payment"}},total:0}})),ye=ge.onChange,be=ge.reset,_e=ge.state;e({G:ye,e:_e});var Se=function(e){switch(e){case"DAYS":return i("days");case"WEEKS":return i("weeks");case"BUSINESS_DAYS":default:return i("business days")}};var Oe=e("J",(function(e){var n;var r=(n=e.shippingProfile)===null||n===void 0?void 0:n.transitTime;if(!(r===null||r===void 0?void 0:r.min)||!(r===null||r===void 0?void 0:r.max)||!(r===null||r===void 0?void 0:r.type)){return null}return{maxTransit:r.max,minTransit:r.min,unit:Se(r.type)}}));var ke=function(e){var n=e.item1,r=e.item2;if(!n||!r){return false}return r.sku&&n.sku&&n.sku===r.sku||r.description&&n.description&&n.description===r.description||n.name&&r.name&&n.name===r.name};var Ce=function(e){d("Checking item restrictions");var n=e.map((function(e){if(!e.restriction){return null}var n=e.restriction;var r=_e.items.find((function(n){return ke({item1:n,item2:e})}));return Object.assign(Object.assign({matchedItem:r},e),{restriction:n})})).filter(Boolean);_e.restrictedItems=n;_e.items=_e.items.map((function(e){return Object.assign(Object.assign({},e),{isRestricted:!!n.find((function(n){return ke({item1:n,item2:e})}))})}));return{cartItems:_e.items,restrictedItems:n}};var Ae=e("g",(function(){t.checkoutSessionId=null;be()}));var Ie=e("o",(function(e){var n=e.messages,r=e.title;Ae();Y();_e.step="error";_e.error={messages:n,title:r}}));var Te=function(e){var n=e.dutiesTaxesFeesEstimate,r=e.method,t=e.subtotals;_e.exchangeRate=t.exchangeRate;_e.adjustmentTotal=t.adjustments;_e.dutiesTaxesFees=r==="DAP"?null:t.landedCostTotal;_e.subtotal=t.items;_e.total=t.total;_e.currency=t.presentmentCurrencyCode;_e.dutiesTaxesFeesEstimate=n||null};var Ee=e("A",(function(){var e=_e.items.filter((function(e){return e.amount>0}));return!!e.find((function(e){return!e.isRestricted}))}));var je=e("p",(function(e){var n,r,o,i,u;B.clientSecret=e.clientSecret;B.stripeCustomerSessionClientSecret=e.customerSessionClientSecret;B.customerProfile=e.customerProfile;_e.checkoutSession=e;if(!e.id){void f({endpoint:"cartStoreSetCheckoutSession",errors:["Missing checkout session id in checkout session"],metadata:{allLogs:p,checkoutSession:e}})}if(e.id){t.checkoutSessionId=e.id}var l=a(e.varianceTestResults||[]);s(l);var c=((o=(r=(n=_e.checkoutSession)===null||n===void 0?void 0:n.metadata)===null||r===void 0?void 0:r.find((function(e){return(e===null||e===void 0?void 0:e.key)==="externalConfirmationPageURL"})))===null||o===void 0?void 0:o.value)||((u=(i=window.Zonos.cartData)===null||i===void 0?void 0:i.metadata.find((function(e){return(e===null||e===void 0?void 0:e.key)==="externalConfirmationPageURL"})))===null||u===void 0?void 0:u.value)||null;if(c){d("Found externalConfirmationPageURL: ".concat(c));_e.externalConfirmationPageURL=c}}));var Ne=function(e){return __awaiter(y,[e],void 0,(function(e){var n,r,a,s,u,l;var c=e.adjustmentsAmount,v=e.cartId,f=e.currency,p=e.dutiesTaxesFeesEstimate,m=e.itemsAmount,w=e.landedCostId,g=e.shouldInitSessionOnFailure;return __generator(this,(function(e){switch(e.label){case 0:if(w&&_e.selectedLandedCost){r=_e.selectedLandedCost.subtotals;Te({dutiesTaxesFeesEstimate:p,method:_e.landedCostMethod,subtotals:r});d("Exchange rate updated for cart items (landed cost subtotal)","info",_e.exchangeRate)}if(!t.checkoutSessionId){d("Could not update cart total without checkout session id","info");return[2,false]}return[4,he({adjustmentsAmount:c,billToPartyId:B.partyBillingId,cartId:v,currency:f,id:t.checkoutSessionId,itemsAmount:m,landedCostId:w,presentmentCountryCode:o.selectedCountryCode,shipToPartyId:B.partyShippingId,varianceTestInput:t.enabledVariantTestKeys||[]})];case 1:a=e.sent(),s=a.errors,u=a.json;if(!(s.length>0||!u))return[3,4];h("Error occurs when updating checkout session.");if(!g)return[3,3];d("Initiating checkout session on failure","info");return[4,fe()];case 2:l=e.sent();d("stripeStoreInitCheckoutSession: ".concat(l));if(!l){Ie({messages:[i("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:i("Error creating Checkout")});return[2,false]}return[2,true];case 3:return[2,false];case 4:if(!w){Te({method:((n=u.checkoutSessionUpdate.landedCost)===null||n===void 0?void 0:n.method)||"DDP",subtotals:u.checkoutSessionUpdate.subtotals});d("Exchange rate updated for cart items (checkout session update)","info",_e.exchangeRate)}je(u.checkoutSessionUpdate);return[2,true]}}))}))};var Pe=e("L",(function(e){if(e.method==="DAP"&&e.remittance.length&&e.landedCostGuaranteeCode==="ZONOS"){return"DDP"}return e.method}));var De=e("I",(function(e,r){return __awaiter(y,void 0,void 0,(function(){var o,i,a,s,u,l,c,v,f,p,h,m,w,g,y,b,_,S,O,k,C,A,I,T;return __generator(this,(function(E){switch(E.label){case 0:_e.selectedShippingOption=e;m=Oe(_e.selectedShippingOption);if(m){w=m.maxTransit,g=m.minTransit,y=m.unit;_e.selectedShippingOptionTransitTime="".concat(g,"-").concat(w," ").concat(y)}else{_e.selectedShippingOptionTransitTime=""}b=(o=_e.landedCostData)===null||o===void 0?void 0:o.find((function(e){return e.landedCostId===r}));_e.selectedLandedCost=b||null;if(!b){return[2,false]}_=((i=b.landedCost.amountSubtotals)===null||i===void 0?void 0:i.landedCostTotal)||0;S=b.subtotals.exchangeRate.rate;O=_*S;if(O){d("DAP quote, using estimate: ".concat(O),"info")}_e.landedCostMethod=Pe(b.landedCost);_e.shipping=b.subtotals.shipping;k=((a=b===null||b===void 0?void 0:b.landedCost)===null||a===void 0?void 0:a.landedCostGuaranteeCode)==="ZONOS";C=!!((u=(s=b===null||b===void 0?void 0:b.landedCost)===null||s===void 0?void 0:s.deMinimis)===null||u===void 0?void 0:u.find((function(e){return["DUTY","TAX"].includes(e.type)&&e.threshold==="ABOVE"})));_e.isSelectedShippingAboveDeminimis=C;_e.isSelectedShippingGuarantee=k;return[4,Ne({adjustmentsAmount:_e.adjustmentTotal,billToPartyId:B.partyBillingId,cartId:window.Zonos.cartId,dutiesTaxesFeesEstimate:O,landedCostId:(l=b.landedCost)===null||l===void 0?void 0:l.id,shipToPartyId:B.partyShippingId,varianceTestInput:t.enabledVariantTestKeys||[]})];case 1:A=E.sent();I=(c=_e.items.find(Boolean))===null||c===void 0?void 0:c.currencyCode;T=((v=B.stripeAddressEventData)===null||v===void 0?void 0:v.value.address.country)||"US";B.shouldRenderPayInUsdButton=I==="USD"&&n.checkoutSettings.allowedSettlementCurrencies==="LOCAL_AND_USD"&&((f=_e.checkoutSession)===null||f===void 0?void 0:f.subtotals.presentmentCurrencyCode)!=="USD"&&!!((h=(p=n.genericSettings)===null||p===void 0?void 0:p.usdSettlementCountryEnabled)===null||h===void 0?void 0:h.includes(T));return[2,A]}}))}))}));var Le=e("m",(function(e){var n=e.isPreview,r=e.sessionTimeout;if(n){return}var t=new URLSearchParams(window.location.search).get("zonosCheckoutTimeout");var o=t&&!isNaN(parseInt(t,10))?parseInt(t,10):r;d("==START CHECKOUT TIMEOUT - ".concat(o,"=="));_e.checkoutTimeoutInterval=setTimeout((function(){_e.checkoutSessionTimeoutShow=true}),o)}));var xe=e("j",(function(){if(_e.checkoutTimeoutInterval){clearTimeout(_e.checkoutTimeoutInterval);_e.checkoutTimeoutInterval=null}}));var Re=function(e){return e.map((function(e){return Object.assign(Object.assign({},e),{isRestricted:false})}))};var ze=function(){_e.items=_e.items.map((function(e){return Object.assign(Object.assign({},e),{isRestricted:false})}));_e.restrictedItems=[]};var Ue=e("f",(function(e){return __awaiter(y,[e],void 0,(function(e){var n,r,o,i;var a=e.adjustments,s=e.cartItems;return __generator(this,(function(e){switch(e.label){case 0:_e.adjustments=a;_e.items=Re(s);r=(n=s.find(Boolean))===null||n===void 0?void 0:n.currencyCode;o=s.reduce((function(e,n){return e+n.amount*n.quantity}),0);i=a.reduce((function(e,n){return e+n.amount}),0);if(!r||!o){return[2]}_e.currency=r;B.isFetchingSession=true;return[4,Ne({adjustmentsAmount:i,billToPartyId:B.partyBillingId,cartId:window.Zonos.cartId,currency:r,dutiesTaxesFeesEstimate:0,itemsAmount:o,shipToPartyId:B.partyShippingId,shouldInitSessionOnFailure:true,varianceTestInput:t.enabledVariantTestKeys||[]})];case 1:e.sent();B.isFetchingSession=false;return[2]}}))}))}));var Be=function(){_e.selectedShippingOption=null;_e.isSelectedShippingAboveDeminimis=false;_e.isSelectedShippingGuarantee=false;_e.selectedShippingOptionTransitTime="";_e.dutiesTaxesFees=0;_e.dutiesTaxesFeesEstimate=0;_e.shipping=0;_e.total=_e.subtotal};var Fe=function(){if(_e.step==="shipping"){_e.step="customer-info";_e.tabItems=Object.assign(Object.assign({},_e.tabItems),{"customer-info":Object.assign(Object.assign({},_e.tabItems.shipping),{isDone:false})})}else if(_e.step==="payment"){_e.step="shipping";_e.tabItems=Object.assign(Object.assign({},_e.tabItems),{shipping:Object.assign(Object.assign({},_e.tabItems.shipping),{isDone:false})})}else if(_e.step==="finish"){_e.step="payment";_e.tabItems=Object.assign(Object.assign({},_e.tabItems),{payment:Object.assign(Object.assign({},_e.tabItems.payment),{isDone:false})})}};var Je=e("r",(function(){if(_e.step==="customer-info"){_e.step="shipping";_e.tabItems=Object.assign(Object.assign({},_e.tabItems),{"customer-info":Object.assign(Object.assign({},_e.tabItems["customer-info"]),{isDone:true})})}else if(_e.step==="shipping"){_e.step="payment";_e.tabItems=Object.assign(Object.assign({},_e.tabItems),{shipping:Object.assign(Object.assign({},_e.tabItems.shipping),{isDone:true})})}else if(_e.step==="payment"){_e.step="finish"}}));var Me=e("h",(function(){_e.step="customer-info";_e.tabItems=Object.assign(Object.assign({},_e.tabItems),{"customer-info":Object.assign(Object.assign({},_e.tabItems["customer-info"]),{isDone:false}),payment:Object.assign(Object.assign({},_e.tabItems.payment),{isDone:false}),shipping:Object.assign(Object.assign({},_e.tabItems.shipping),{isDone:false})});Be()}))}}}));
@@ -1 +0,0 @@
1
- import{z as e,c as t}from"./p-6aa728f2.js";import{s as o,l as n,t as r,f as s,b as i}from"./p-a6f77d44.js";import{l as a,f as d,h as l,g as c,a as u,s as m,d as v,b as p,j as h}from"./p-20839c46.js";import{i as y}from"./p-71c6bdc3.js";import{g as w}from"./p-207bd04a.js";const g=({currentAddress:e,translatedAddress:t})=>{var o,n,r,s,i,a;const{city:d,country:l,line1:c,line2:u,postal_code:m,state:v}=e.value.address,p=e.value.name||[e.value.firstName,e.value.lastName].join(" ");return{city:(null===(o=t.city)||void 0===o?void 0:o[d])||d,country:l,line1:(null===(n=t.line1)||void 0===n?void 0:n[c])||c,line2:(null===(r=t.line2)||void 0===r?void 0:r[u||""])||u||"",name:(null===(s=t.name)||void 0===s?void 0:s[p])||p,phone:e.value.phone||"",postal_code:(null===(i=t.postal_code)||void 0===i?void 0:i[m])||m,state:(null===(a=t.state)||void 0===a?void 0:a[v])||v}},f=e=>{var t;const n="1"===new URLSearchParams(window.location.search).get("zonosE2ETest"),r=N.stripeLinkEventData,s=N.stripeAddressEventData,i=N.stripeShippingSameAsBilling?N.stripeAddressEventData:N.stripeBillingAddressEventData;if(!s||!i)throw new Error("Missing stripe address data");const a=g({currentAddress:s,translatedAddress:N.translatedAddress.address}),d=a.name.split(" ")[0]||"",l=a.name.split(" ").splice(1).join(" ")||"",c=g({currentAddress:i,translatedAddress:N.translatedAddress.address}),u=c.name.split(" ")[0]||"",m=c.name.split(" ").splice(1).join(" ")||"";return{billingAddress:{addressLine1:c.line1,addressLine2:c.line2||"",city:c.city,country:c.country,postalCode:c.postal_code,state:c.state},billingContact:{firstName:u,lastName:m,phone:c.phone},cartCurrencyCode:null===(t=oe.items[0])||void 0===t?void 0:t.currencyCode,cartId:e,checkoutSessionId:o.checkoutSessionId||"",contact:{companyName:N.companyName,email:null==r?void 0:r.value.email,firstName:d,lastName:l,phone:a.phone},isTest:!!n,landedCostAdjustments:oe.promoCode?[{amount:0,productId:null,promoCode:oe.promoCode,sku:null,type:"PROMO_CODE"}]:[],shipToTaxId:N.taxId,shippingAddress:{addressLine1:a.line1,addressLine2:a.line2,city:a.city,country:a.country,postalCode:a.postal_code,state:a.state}}},b=()=>{const e="1"===new URLSearchParams(window.location.search).get("zonosE2ETest"),t=N.stripeLinkEventData,n=N.stripeAddressEventData,r=N.stripeShippingSameAsBilling?N.stripeAddressEventData:N.stripeBillingAddressEventData;if(a({stripeAddressData:n,stripeBillingAddressData:r},"info"),!n||!r)throw new Error("Missing stripe address data");const s=g({currentAddress:n,translatedAddress:N.translatedAddress.address}),i=s.name.split(" ")[0]||"",d=s.name.split(" ").splice(1).join(" ")||"",l=g({currentAddress:r,translatedAddress:N.translatedAddress.address}),c=l.name.split(" ")[0]||"",u=l.name.split(" ").splice(1).join(" ")||"",m=oe.adjustments.map((e=>({amount:e.amount,name:e.description||null,productId:e.productId,sku:e.sku,type:e.type}))),v=oe.promoCode?[{amount:0,productId:null,promoCode:oe.promoCode,sku:null,type:"PROMO_CODE"},...m]:m;return{billingAddress:{addressLine1:l.line1,addressLine2:l.line2||"",city:l.city,country:l.country,postalCode:l.postal_code,state:l.state},billingContact:{firstName:c,lastName:u,phone:l.phone},checkoutSessionId:o.checkoutSessionId||"",contact:{companyName:N.companyName,email:null==t?void 0:t.value.email,firstName:i,lastName:d,phone:s.phone},isTest:e,items:oe.items,landedCostAdjustments:v,shipToTaxId:N.taxId,shippingAddress:{addressLine1:s.line1,addressLine2:s.line2,city:s.city,country:s.country,postalCode:s.postal_code,state:s.state}}};const S=async t=>{const o=window.Zonos.cartId;if(!o)return await(async t=>{var o;const n=e.checkoutSettings.buildLandedCost;if(n){const e=await(async e=>{var t,o,n,r,s;const i=b(),a=await e({billingAddress:i.billingAddress,billingContact:i.billingContact,checkoutSessionId:i.checkoutSessionId,contact:i.contact,landedCostAdjustments:i.landedCostAdjustments,publicCredential:window.Zonos.zonosApiKey||"",shippingAddress:i.shippingAddress,zonosApiRoute:d.vercel});if(!a||!(null===(t=a.checkoutSessionWorkflow)||void 0===t?void 0:t.length)&&(null===(o=a.errors)||void 0===o?void 0:o.length))throw new Error(`Failed to build landed cost: ${(null===(r=null===(n=null==a?void 0:a.errors)||void 0===n?void 0:n[0])||void 0===r?void 0:r.message)||"Unknown error"}`);const{errors:c,json:u}=await l("/api/zonos-elements/validate-landed-cost",{body:a,headers:{"Content-Type":"application/json"},method:"POST"});if(!u||c.length)throw new Error(`Invalid landed cost object: ${(null===(s=c.find(Boolean))||void 0===s?void 0:s.message)||"Unknown error"}`);return a})(n);return e}const{errors:r,json:s}=await l("/api/zonos-elements/calculate-landed-cost",{body:b(),method:"POST",signal:null==t?void 0:t.signal});if(r.length||!s){if("The user aborted a request."===(null===(o=r[0])||void 0===o?void 0:o.message))throw new Error("The landed cost calculation request was aborted to initiate a new one.");if(r.forEach((e=>{console.warn(`Error calculating landed cost: ${e.message}`)})),!s)throw new Error("Failed to calculate landed cost");return s}return s})(t);const n=await(async({abortController:e,cartId:t})=>{var o,n;const{errors:r,json:s}=await l("/api/zonos-elements/cart-calculate-landed-cost",{body:f(t),method:"POST",signal:null==e?void 0:e.signal});if(r.length||!s){const e="The user aborted a request."===(null===(o=r[0])||void 0===o?void 0:o.message)||(null===(n=r[0])||void 0===n?void 0:n.message.includes("signal is aborted"));throw new Error(e?"The landed cost calculation request was aborted to initiate a new one.":"Failed to calculate landed cost")}return s})({abortController:t,cartId:o}),{cartWorkflow:r}=n,s=function(e,t){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(o[n[r]]=e[n[r]])}return o}(n,["cartWorkflow"]);return Object.assign(Object.assign({},s),{itemCreateWorkflow:r.items})},C=async({checkoutSessionId:t,eventName:o,metadata:r})=>{var s,i;const a=Date.now(),d=[...window.Zonos.trackEventLogs];window.Zonos.trackEventLogs.push({checkoutSessionId:t,eventCreated:a,eventName:o});const p=window.location.href.includes("zonos.com")&&!window.location.href.includes("checkout.zonos.com")||!!(null===(s=window.Zonos)||void 0===s?void 0:s.zonosQaUrl)||!!(null===(i=window.Zonos)||void 0===i?void 0:i.debug);if((c()||u()||p)&&!window.Zonos.zonosConversionTest)return;const h=n.selectedCountryCode,y=e.organizationId;if(!t)return void m({endpoint:"trackConversionEventMetric",errors:[`Event "${o}" - No checkout session id found`],metadata:{allLogs:v,checkoutSessionId:t,eventName:o,metadata:r,organizationId:y,trackEventLogs:d}});y||m({endpoint:"trackConversionEventMetric",errors:[`Event "${o}" - No organization id found`],metadata:{allLogs:v,checkoutSessionId:t,eventName:o,metadata:r,organizationId:y,trackEventLogs:d}});const w={checkoutSessionId:t,countryCode:h,eventCreated:a,eventName:o,metadata:Object.assign(Object.assign({},r),{trackEventLogs:d}),organizationId:y};await l("/api/zonos-elements/track-conversion-event",{body:w,method:"POST"})},O=({address:e,invalidAdddressList:t})=>{if(!e)return;if(!t)return;const o={};return t.city&&(o.city=e.city),t.line1&&(o.line1=e.line1),t.line2&&(o.line2=e.line2),t.postal_code&&(o.postal_code=e.postal_code),t.state&&(o.state=e.state),t.name&&(o.name=e.name),Object.keys(o).length?o:void 0},A=e=>e.sort(((e,t)=>e.amount-t.amount)),k=async()=>{var e;const{errors:t,json:n}=await(async()=>{if(!o.checkoutSessionId)return{errors:[{message:"No checkout session id found"}],json:null};const e=new URLSearchParams;e.set("checkoutSessionId",o.checkoutSessionId);const{errors:t,json:n}=await l(`/api/zonos-elements/get-checkout-session?${e.toString()}`);return{errors:t,json:n}})();return t.length||!n?(p("Failed to retrieve checkout session info before confirming payment ",t),m({endpoint:"validateCheckoutSession",errors:t.map((e=>e.message)),metadata:{allLogs:v}}),{errorMessage:r("Unable to retrieve the checkout session at the moment. Please try again or contact our support team."),valid:!1}):(null===(e=n.checkoutSession.landedCost)||void 0===e?void 0:e.id)?{errorMessage:"",valid:!0}:(p("Landed cost is not found in the checkout session before confirming payment."),m({endpoint:"validateCheckoutSession",errors:["No landed cost found before confirming payment"],metadata:{allLogs:v}}),{errorMessage:r('No shipment rating selected. Please go back to the "Shipping" step and select a shipment rating to proceed.'),valid:!1})},I=({theme:t})=>{const o={".AccordionItem":{color:"var(--colorText)"},".AccordionItem--selected":{color:"var(--colorText)"},".Action":{color:"var(--colorText)"},".Input":{boxShadow:"none",fontSize:e.appearance.fontSizeInputValue?`${e.appearance.fontSizeInputValue}px`:void 0,padding:"0",paddingBottom:"8px",paddingLeft:"16px",paddingRight:"8px",paddingTop:"6px"},".Label--resting":{fontSize:e.appearance.fontSizeInputLabel?`${e.appearance.fontSizeInputLabel}px`:void 0},".PickerItem--highlight":{boxShadow:"0 0 0 2px var(--colorBackground)"},".PickerItem--highlight:hover":{backgroundColor:"var(--colorBackground)",boxShadow:"none"},".PickerItem--new":{color:"var(--colorText)"},".Tab--selected":{borderStyle:"solid",borderWidth:"1px"}};return"DARK"===t?Object.assign(Object.assign({},o),{".Action":Object.assign(Object.assign({},o[".Action"]),{color:"white"}),".PickerItem--new":Object.assign(Object.assign({},o[".PickerItem--new"]),{color:"white"})}):o},j=({borderStyle:e,theme:t})=>"DARK"===t?{borderRadius:w({overrideBorderStyle:e}),colorBackground:"#101117",colorBackgroundText:"#C5C6CA",colorText:"#C5C6CA",colorTextPlaceholder:"#C5C6CA"}:{borderRadius:w({overrideBorderStyle:e}),iconMenuColor:"var(--colorText)",iconMenuHoverColor:"var(--colorText)"},{onChange:T,reset:E,state:N}=t((()=>({checkoutSettlementCurrency:"USD",clientSecret:sessionStorage.getItem("zonos--client-secret")||"",companyName:"",companyNameUsedWhenAsyncAddressUpdate:"",customAddressErrors:{city:"",firstName:"",lastName:"",line1:"",phone:"",postalCode:"",showError:!1,state:""},customBillingAddressErrors:{city:"",firstName:"",lastName:"",line1:"",phone:"",postalCode:"",showError:!1,state:""},customErrorMessage:null,customerProfile:null,fetchingLandedCostAbortController:null,hasPaymentError:!1,isFetchingLandedCost:!1,isFetchingSession:!1,partyBillingId:null,partyShippingId:null,shouldInventoryRefund:!1,shouldRenderPayInUsdButton:!1,skipPaymentIntent:"0"!==new URLSearchParams(window.location.search).get("skipPaymentIntent"),stripe:null,stripeAddressElement:null,stripeAddressEventData:null,stripeAddressUsedWhenAsyncAddressUpdate:null,stripeAddressUsedWhenFetchingLC:null,stripeAddressUsedWhenValidatingAddress:null,stripeBillingAddressElement:null,stripeBillingAddressEventData:null,stripeBillingAddressUsedWhenAsyncAddressUpdate:null,stripeBillingAddressUsedWhenFetchingLC:null,stripeBillingAddressUsedWhenValidatingAddress:null,stripeCustomerSessionClientSecret:null,stripeElements:null,stripeElementsForBillingAddress:null,stripeElementsOptions:null,stripeLinkElement:null,stripeLinkEventData:null,stripeLinkUsedWhenFetchingLC:null,stripePaymentElement:null,stripePaymentEventData:null,stripeShippingSameAsBilling:!0,taxId:"",taxIdUsedWhenAsyncAddressUpdate:"",translatedAddress:{address:{},billingAddress:{},firstName:{},lastName:{},name:{}}}))),P=()=>{window.sessionStorage.removeItem("zonos--bigcommerce-domestic-checkout-shipping")},L=e=>{window.sessionStorage.setItem("zonos--bigcommerce-domestic-checkout-shipping",JSON.stringify(e))},D=()=>{const e=window.sessionStorage.getItem("zonos--bigcommerce-domestic-checkout-shipping");return h(e)},x=async t=>{var o,r;const s=N.clientSecret;if(!N.stripe)return void a("Skip. Stripe is not initialized");const i=(({clientSecret:t,overrideBorderRadius:o,overridePrimaryColor:r,overrideSecondaryColor:s,overrideTheme:i,paypalEnabled:a})=>{const d=r||e.appearance.colorPrimary,l=s||e.appearance.colorSecondary,c=d&&y(d)?"night":"flat",u="DARK"===i?"night":"flat",m=a?["external_paypal"]:[];return{appearance:{labels:"floating",rules:Object.assign({},I({theme:i||"LIGHT"})),theme:i?u:c,variables:Object.assign(Object.assign({},j({borderStyle:o,theme:"LIGHT"})),{colorPrimary:l})},clientSecret:t||void 0,customerSessionClientSecret:N.stripeCustomerSessionClientSecret||void 0,externalPaymentMethodTypes:[...m],locale:n.selectedLocale}})({clientSecret:s,overrideBorderRadius:null==t?void 0:t.overrideBorderRadius,overridePrimaryColor:null==t?void 0:t.overridePrimaryColor,overrideSecondaryColor:null==t?void 0:t.overrideSecondaryColor,overrideTheme:null==t?void 0:t.overrideTheme,paypalEnabled:null==t?void 0:t.paypalEnabled}),d=JSON.stringify(i)===JSON.stringify(N.stripeElementsOptions);if(!N.stripeElements||!N.stripeElementsForBillingAddress)return N.stripeElements=null===(o=N.stripe)||void 0===o?void 0:o.elements(i),N.stripeElementsOptions=i,a("Stripe elements initialized"),N.stripeElementsForBillingAddress=null===(r=N.stripe)||void 0===r?void 0:r.elements(i),void a("Stripe elements for billing address initialized");d||(N.stripeElements.update(i),N.stripeElementsForBillingAddress.update(i),N.stripeElementsOptions=i,N.stripeElements.fetchUpdates()),a("Stripe elements updated")},R=()=>{sessionStorage.removeItem("zonos--client-secret"),E(),N.stripe=window.Zonos.stripe},_=({address:e,firstName:t,lastName:n,name:r,phone:s})=>{const i=(null==r?void 0:r.split(" ")[0])||t||"",a=(null==r?void 0:r.split(" ")[1])||n||"";return i&&a||m({endpoint:"PARTY_CREATE_NO_NAME_FOUND",errors:["No name found"],metadata:{allLogs:v,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId,firstName:t,lastName:n,name:r}}),s||m({endpoint:"PARTY_CREATE_NO_PHONE_FOUND",errors:["No phone found"],metadata:{allLogs:v,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId,phone:s}}),{city:e.city,country:e.country,firstName:i,lastName:a,line1:e.line1,line2:e.line2,phone:s||"",postal_code:e.postal_code,state:e.state}},z=async()=>{var e,t,n,r;if(!(null===(e=N.stripeAddressEventData)||void 0===e?void 0:e.complete)||!N.stripeShippingSameAsBilling&&!(null===(t=N.stripeBillingAddressEventData)||void 0===t?void 0:t.complete)||!N.stripeBillingAddressEventData)return{partiesCreated:!1};if(!oe.landedCostData)return{partiesCreated:!1};const s=null===(n=oe.landedCostData.find(Boolean))||void 0===n?void 0:n.landedCost.rootId;if(!s)return m({endpoint:"PF_NO_SELECTED_LANDED_COST",errors:["No selected landed cost"],metadata:{allLogs:v,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId}}),{partiesCreated:!1};const i=(()=>{var e,t,o,n,r,s;const i=JSON.stringify(null===(e=N.stripeLinkUsedWhenFetchingLC)||void 0===e?void 0:e.value)!==JSON.stringify(null===(t=N.stripeLinkEventData)||void 0===t?void 0:t.value),a=JSON.stringify(null===(o=N.stripeAddressUsedWhenAsyncAddressUpdate)||void 0===o?void 0:o.value)!==JSON.stringify(null===(n=N.stripeAddressEventData)||void 0===n?void 0:n.value),d=!N.stripeShippingSameAsBilling&&JSON.stringify(null===(r=N.stripeBillingAddressUsedWhenAsyncAddressUpdate)||void 0===r?void 0:r.value)!==JSON.stringify(null===(s=N.stripeBillingAddressEventData)||void 0===s?void 0:s.value);return i||a||d||N.taxIdUsedWhenAsyncAddressUpdate!==N.taxId||N.companyNameUsedWhenAsyncAddressUpdate!==N.companyName})();if(!i)return{partiesCreated:!1};const a=_({address:N.stripeAddressEventData.value.address,firstName:N.stripeAddressEventData.value.firstName,lastName:N.stripeAddressEventData.value.lastName,name:N.stripeAddressEventData.value.name,phone:N.stripeAddressEventData.value.phone}),d=N.stripeShippingSameAsBilling?a:_({address:N.stripeBillingAddressEventData.value.address,firstName:N.stripeBillingAddressEventData.value.firstName,lastName:N.stripeBillingAddressEventData.value.lastName,name:N.stripeBillingAddressEventData.value.name,phone:N.stripeBillingAddressEventData.value.phone}),c="1"===new URLSearchParams(window.location.search).get("zonosE2ETest"),{errors:u,json:h}=await l("/api/zonos-elements/create-parties",{body:{address:a,billingAddress:d,companyName:N.companyName,email:(null===(r=N.stripeLinkEventData)||void 0===r?void 0:r.value.email)||"",isTest:c,rootId:s,taxId:N.taxId},method:"POST"});return u.length||!h?(p("Error occurs when creating parties",JSON.stringify(u,null,2)),m({endpoint:"PF_PARTY_CREATE_FAILED",errors:["Failed to create parties"],metadata:{allLogs:v,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId,errors:u,json:h}}),{partiesCreated:!1}):(N.companyNameUsedWhenAsyncAddressUpdate=N.companyName,N.stripeAddressUsedWhenAsyncAddressUpdate=N.stripeAddressEventData,N.stripeBillingAddressUsedWhenAsyncAddressUpdate=N.stripeBillingAddressEventData,N.taxIdUsedWhenAsyncAddressUpdate=N.taxId,N.partyBillingId=h.billToPartyId,N.partyShippingId=h.shipToPartyId,{partiesCreated:!0})},U=e=>({countryCode:e.address.country,postalCode:e.address.postal_code,state:e.address.state}),B=async t=>{var n,r,s,i;const d=(null==t?void 0:t.retries)||0,l=!!(null==t?void 0:t.applyingPromocode),c=(()=>{var e;const t=oe.landedCostData&&(null===(e=oe.landedCostData.find(Boolean))||void 0===e?void 0:e.subtotals.items)!==oe.subtotal,o=(()=>{var e,t;const o=JSON.stringify(null===(e=N.stripeLinkUsedWhenFetchingLC)||void 0===e?void 0:e.value)!==JSON.stringify(null===(t=N.stripeLinkEventData)||void 0===t?void 0:t.value),n=N.stripeAddressEventData&&JSON.stringify(U(N.stripeAddressEventData.value))!==JSON.stringify(N.stripeAddressUsedWhenFetchingLC),r=!N.stripeShippingSameAsBilling&&N.stripeBillingAddressEventData&&JSON.stringify(U(N.stripeBillingAddressEventData.value))!==JSON.stringify(N.stripeBillingAddressUsedWhenFetchingLC);return o||n||r})();return a("isPrefetchInfoOutdated","info",{isAddressOutdated:o}),!oe.landedCostData&&!N.isFetchingLandedCost||o||t})();if(!(()=>{var t,o,n,r;const s=!!(null===(t=N.stripeLinkEventData)||void 0===t?void 0:t.complete),i=!!(null===(o=N.stripeAddressEventData)||void 0===o?void 0:o.complete),a=N.stripeShippingSameAsBilling?i:!!(null===(n=N.stripeBillingAddressEventData)||void 0===n?void 0:n.complete),d=(t=>{var o,n;const r=null===(o=e.genericSettings)||void 0===o?void 0:o.countryFields,s=null===(n=e.genericSettings)||void 0===n?void 0:n.stripeCountryFieldLabels;return"stripe"===oe.addressFormRenderType&&(s&&t in s?s[t]:null)||(r&&t in r?r[t]:null)})((null===(r=N.stripeAddressEventData)||void 0===r?void 0:r.value.address.country)||"US");return!!(i&&a&&s)||(d&&N.stripeAddressEventData?s&&N.stripeAddressEventData.value.firstName&&N.stripeAddressEventData.value.lastName&&N.stripeAddressEventData.value.address.line1.length>0&&(!d.stateRequired||d.stateRequired&&N.stripeAddressEventData.value.address.state.length>0)&&(!d.zipRequired||d.zipRequired&&N.stripeAddressEventData.value.address.postal_code.length>=3)&&N.stripeAddressEventData.value.phone&&N.stripeAddressEventData.value.phone.length>0:i&&a&&s)})())return{isRequestNotReady:!0};if(c&&(null===(n=N.fetchingLandedCostAbortController)||void 0===n||n.abort(),N.fetchingLandedCostAbortController=null),!c&&!l)return{isRequestNotReady:!1};d?(N.isFetchingLandedCost=!1,setTimeout((()=>{N.isFetchingLandedCost=!0}),300)):N.isFetchingLandedCost=!0,N.stripeAddressEventData&&(N.stripeAddressUsedWhenFetchingLC={countryCode:N.stripeAddressEventData.value.address.country,postalCode:N.stripeAddressEventData.value.address.postal_code,state:N.stripeAddressEventData.value.address.state}),N.stripeBillingAddressEventData&&(N.stripeBillingAddressUsedWhenFetchingLC={countryCode:N.stripeBillingAddressEventData.value.address.country,postalCode:N.stripeBillingAddressEventData.value.address.postal_code,state:N.stripeBillingAddressEventData.value.address.state}),N.stripeLinkEventData&&(N.stripeLinkUsedWhenFetchingLC=Object.assign({},N.stripeLinkEventData));try{we(),await(async()=>{var e;const t=new AbortController;N.fetchingLandedCostAbortController=t,we();const{checkoutSessionWorkflow:n,errors:r,itemCreateWorkflow:s,landedCostCalculateWorkflow:i,partyCreateWorkflow:a,shipmentRatingCalculateWorkflow:d}=await S(t);oe.customQuotingError=(null===(e=null==r?void 0:r.find((e=>{var t;return"CUSTOM"===(null===(t=e.extensions)||void 0===t?void 0:t.ruleMessageType)})))||void 0===e?void 0:e.message)||null,oe.shippingData=A((null==d?void 0:d.filter(Boolean))||[]),ie(s),N.fetchingLandedCostAbortController=null,oe.partiesData=(null==a?void 0:a.filter(Boolean))||[],oe.landedCostData=(null==n?void 0:n.map((e=>{const t=null==i?void 0:i.find((t=>(null==t?void 0:t.id)===e.landedCostId));return t?Object.assign(Object.assign({},e),{landedCost:t}):null})).filter(Boolean))||[],(null==n?void 0:n.length)&&C({checkoutSessionId:o.checkoutSessionId,eventName:"checkout_quoteReceived"});const l=oe.promoCodeApplied&&!oe.landedCostData.find((e=>{var t;return null===(t=e.landedCost.appliedAdjustments)||void 0===t?void 0:t.find((e=>"PROMO_CODE"===e.type))}));oe.promoCodeError=l,l||sessionStorage.setItem("zonos--promo-code",oe.promoCode)})();const e=null===(r=oe.shippingData)||void 0===r?void 0:r.find(Boolean),t=null===(s=oe.landedCostData)||void 0===s?void 0:s.find((t=>t.landedCost.shipmentRating.id===(null==e?void 0:e.id))),n=t?t.subtotals:null;n&&le({method:(null==t?void 0:t.landedCost.method)||"DDP",subtotals:n})}catch(e){if(oe.landedCostData=[],oe.shippingData=[],e instanceof Error&&e.message&&!["The landed cost calculation request was aborted to initiate a new one."].includes(e.message)){if(d<1)return await B(Object.assign(Object.assign({},t),{retries:(d||0)+1})),{isRequestNotReady:!1};const o=null===(i=N.stripeAddressEventData)||void 0===i?void 0:i.value;m({endpoint:`Failed to fetch landed cost (${d} retries)`,errors:[e.message],metadata:{cartId:window.Zonos.cartId,shipToAddress:o}})}p(e)}return N.isFetchingLandedCost=!1,{isRequestNotReady:!1}},F=async()=>{var e,t;await B({applyingPromocode:!0}),"payment"===oe.step&&fe(),await z();const o=null===(e=oe.shippingData)||void 0===e?void 0:e.find(Boolean),n=null===(t=oe.landedCostData)||void 0===t?void 0:t.find((e=>e.landedCost.id===(null==o?void 0:o.id)));o&&n&&await pe(o,n.landedCostId)},J=()=>{oe.promoCode="",sessionStorage.removeItem("zonos--promo-code"),oe.promoCodeError=!1,oe.promoCodeApplied=!1},$=async()=>{"payment"===oe.step&&fe(),J(),await F()},M=e=>{let t=[],o=!0;switch(e){case"succeeded":t=[r("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."),"",r("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.")],o=!1;break;case"requires_capture":case"processing":t=[r("Payment processing. We'll update you when payment is received.")],o=!1;break;case"requires_payment_method":t=[r("Payment failed. Please try another payment method.")];break;case"requires_action":o=!1,t=[r("Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction.")];default:t=[r("Something went wrong.")]}return{isError:o,messages:t}},W=async()=>{var t,o;const{onInventoryCheck:n}=e.checkoutSettings,s=!!(null===(o=null===(t=window.Zonos.cartData)||void 0===t?void 0:t.metadata.find((e=>"referenceId"===e.key)))||void 0===o?void 0:o.value);if(window.Zonos.isLegacyCheckout&&window.Zonos.cartData&&s){const{errors:e,json:t}=await l("/api/zonos-elements/legacy/inventory-check",{body:{cartData:window.Zonos.cartData},method:"POST"});return e.length||!t?(p("Error occurs when handling inventory refund","warn",JSON.stringify(e)),null):t.available&&204!==t.status?t.available||200===t.status?(N.shouldInventoryRefund=!0,null):null:r("The item you're looking for is currently unavailable in our inventory. Please check back later or contact support for assistance with availability.")}if("function"!=typeof n)return null;try{return await n({items:oe.items})}catch(e){const t=e instanceof Error?e.message:"Unknown error";throw m({endpoint:"onInventoryCheck",errors:[`cartId: ${window.Zonos.cartId} - ${t}`],metadata:{cartId:window.Zonos.cartId,href:window.location.href,items:oe.items}}),e}},q=async()=>{var e,t;const o=!!(null===(t=null===(e=window.Zonos.cartData)||void 0===e?void 0:e.metadata.find((e=>"referenceId"===e.key)))||void 0===t?void 0:t.value);window.Zonos.isLegacyCheckout&&window.Zonos.cartData&&o&&await l("/api/zonos-elements/legacy/inventory-refund",{body:{cartData:window.Zonos.cartData},method:"POST"})},Y=async({clientSecret:e,storybookForceStatus:t})=>{if(t){const{isError:e,messages:o}=M(t);return{error:e,messages:o}}const o=e||N.clientSecret;if(!N.stripe||!o)return p("Failed to retrieve payment intent. Stripe is not initialized"),{error:!0,message:[r("Something went wrong.")]};const{paymentIntent:n}=await N.stripe.retrievePaymentIntent(o),s=null==n?void 0:n.status,{isError:i,messages:a}=M(s);return{error:i,messages:a,paymentIntentId:null==n?void 0:n.id,paymentMethod:null==n?void 0:n.payment_method,status:s}},H=async()=>{var e,t;const n=!!(null===(e=N.stripePaymentEventData)||void 0===e?void 0:e.complete),s=N.stripeElements,i=N.stripe,d=N.clientSecret;if(N.customErrorMessage=null,!(null===(t=oe.selectedLandedCost)||void 0===t?void 0:t.landedCost.id))throw new Error("Attempted to confirm the payment when no landed cost is found in store");const l=await k();if(!l.valid)throw N.customErrorMessage=l.errorMessage,new Error(l.errorMessage);const c=o.checkoutSessionId;if(i&&s&&n&&d&&c){const e=new URL(window.location.href);e.searchParams.set("payment_intent_client_secret",d),e.searchParams.set("zonosCheckoutSessionId",c),C({checkoutSessionId:c,eventName:"checkout_paymentInfoCompleted"});const{error:t,paymentIntent:o}=await i.confirmPayment({confirmParams:{return_url:e.toString()},elements:s,redirect:"if_required"});if(a("Payment intent confirmed","info",{error:t,paymentIntent:o}),"requires_action"===(null==o?void 0:o.status))throw new Error(r("Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction."));if(t){if("card_error"===t.type||"validation_error"===t.type)throw new Error(t.message);if("invalid_request_error"===t.type&&"payment_intent_unexpected_state"===t.code)return;throw new Error("An unexpected error occurred.")}if("requires_payment_method"===o.status)throw new Error(r("Payment failed. Please try another payment method."))}},K=()=>{var e;const t=oe.items.reduce(((e,t)=>e+t.amount*t.quantity),0),r=o.enabledVariantTestKeys||[];return{adjustmentsAmount:oe.adjustments.reduce(((e,t)=>e+t.amount),0),cartId:window.Zonos.cartId,currency:(null===(e=oe.items.find(Boolean))||void 0===e?void 0:e.currencyCode)||"",customerAuthenticationToken:oe.customerAuthenticationToken||void 0,itemsAmount:t,metadata:[{key:"language",value:n.selectedLocale}],presentmentCountryCode:n.selectedCountryCode,skipPaymentIntent:N.skipPaymentIntent,varianceTestInput:r}},G=async()=>{var e;if(!o.checkoutSessionId)return m({endpoint:"Error creating payment intent",errors:["No checkout session id found when retrieving payment intent"],metadata:{allLogs:v,cartId:window.Zonos.cartId}}),void de({messages:[r("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:r("Error creating Checkout")});const{errors:t,json:n}=await l("/api/zonos-elements/create-payment-intent",{body:{checkoutSessionId:o.checkoutSessionId},method:"POST"}),s=null===(e=null==n?void 0:n.checkoutSessionPaymentIntentCreate)||void 0===e?void 0:e.clientSecret;if(t.length||!s)return p("Error occurs when getting payment intent",JSON.stringify(t,null,2)),m({endpoint:"Error creating payment intent",errors:t.map((e=>e.message)),metadata:{allLogs:v,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId,clientSecret:s}}),void de({messages:[r("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:r("Error creating Checkout")});ue(n.checkoutSessionPaymentIntentCreate)},V=async()=>{var e,t;if(!n.targetCurrency)return p("Failed to create checkout session - missing localizationStore.targetCurrency"),!1;N.isFetchingSession=!0;const o=K();a("Checkout session body","info",o);const{errors:r,json:s}=await l("/api/zonos-elements/create-checkout-session",{body:o,method:"POST"});if(N.isFetchingSession=!1,r.length||!s){const t=null===(e=r.find((e=>e.message)))||void 0===e?void 0:e.message;if(Array.isArray(t)&&t.some((e=>"Cart is expired."===e.message)))throw new Error("Cart is expired.");return p("Error occurred when creating checkout session",JSON.stringify(r,null,2)),!1}const i=s.checkoutSessionCreate;return ue(i),le({method:(null===(t=i.landedCost)||void 0===t?void 0:t.method)||"DDP",subtotals:i.subtotals}),a("Exchange rate updated for cart items (checkout session create)","info",oe.exchangeRate),a("done-init-checkout-session"),!0},Z=async()=>{const t=o.checkoutSessionId;if(!t)return p("Failed to update checkout session base currency"),!1;if("LOCAL"===e.checkoutSettings.allowedSettlementCurrencies)return a('allowedSettlementCurrencies: "LOCAL". Skip updating checkout session base currency'),!0;const{json:n}=await l("/api/zonos-elements/update-checkout-session-base-currency",{body:{checkoutSessionId:t,currencyCode:N.checkoutSettlementCurrency},method:"POST"}),r=null==n?void 0:n.checkoutSessionBaseCurrencyUpdate.subtotals.presentmentCurrencyCode;return n&&r===N.checkoutSettlementCurrency?(a(`Updated checkout session to settlement currency "${r}".`),!0):(p("Failed to update checkout session base currency"),!1)},Q=({currentAddress:e,translatedAddressResult:t})=>{const o={};if(!t)return o;const{city:n,line1:r,line2:s,name:i,postal_code:a,state:d}=t;return e.city&&n&&(o.city={[e.city]:n}),e.line1&&r&&(o.line1={[e.line1]:r}),e.line2&&s&&(o.line2={[e.line2]:s}),e.postal_code&&a&&(o.postal_code={[e.postal_code]:a}),e.state&&d&&(o.state={[e.state]:d}),e.name&&i&&(o.name={[e.name]:i}),o},X=async({addressInvalidCharactersList:e,billingAddressInvalidCharactersList:t})=>{var o,n,r,s;const i=(({addressInvalidCharactersList:e,billingAddressInvalidCharactersList:t,stripeAddressEventData:o,stripeBillingAddressEventData:n,stripeShippingSameAsBilling:r})=>{var s,i,a,d;const l=!!(null==o?void 0:o.complete);if(!l||!(r?l:null==n?void 0:n.complete))return null;if(!e&&!t)return null;const c=o.value,u=(null==n?void 0:n.value)||null,m=`${c.firstName||(null===(s=c.name)||void 0===s?void 0:s.split(" ")[0])} ${c.lastName||(null===(i=c.name)||void 0===i?void 0:i.split(" ")[1])}`,v=c.firstName||(null===(a=null==u?void 0:u.name)||void 0===a?void 0:a.split(" ")[0]),p=c.lastName||(null===(d=null==u?void 0:u.name)||void 0===d?void 0:d.split(" ")[1]),h=v&&p?`${v} ${p}`:"",y=c.address,w=null==u?void 0:u.address;return{address:O({address:Object.assign(Object.assign({},y),{name:m}),invalidAdddressList:e}),billingAddress:r?void 0:O({address:w?Object.assign(Object.assign({},w),{name:h}):null,invalidAdddressList:t}),destinationCountry:y.country}})({addressInvalidCharactersList:e,billingAddressInvalidCharactersList:t,stripeAddressEventData:N.stripeAddressEventData,stripeBillingAddressEventData:N.stripeBillingAddressEventData,stripeShippingSameAsBilling:N.stripeShippingSameAsBilling});if(!i)return void(N.translatedAddress={address:{},billingAddress:{}});const a=(()=>{var e,t,o,n;const r=JSON.stringify(null===(e=N.stripeAddressUsedWhenValidatingAddress)||void 0===e?void 0:e.value)!==JSON.stringify(null===(t=N.stripeAddressEventData)||void 0===t?void 0:t.value),s=!N.stripeShippingSameAsBilling&&JSON.stringify(null===(o=N.stripeBillingAddressEventData)||void 0===o?void 0:o.value)!==JSON.stringify(null===(n=N.stripeBillingAddressUsedWhenValidatingAddress)||void 0===n?void 0:n.value);return r||s})();if(!a)return;const{errors:d,json:c}=await l("/api/zonos-elements/validate-address",{body:i,method:"POST"});if(d.length||!c)return p("Error occurs when translating address to latin",JSON.stringify(d,null,2)),void(N.translatedAddress={address:{},billingAddress:{}});N.stripeAddressUsedWhenValidatingAddress=N.stripeAddressEventData,N.stripeBillingAddressUsedWhenValidatingAddress=N.stripeBillingAddressEventData;const u=null===(o=N.stripeAddressEventData)||void 0===o?void 0:o.value.address,m=null===(n=N.stripeBillingAddressEventData)||void 0===n?void 0:n.value.address;N.translatedAddress={address:u?Q({currentAddress:Object.assign(Object.assign({},u),{name:null===(r=N.stripeAddressEventData)||void 0===r?void 0:r.value.name}),translatedAddressResult:c.address||null}):{},billingAddress:N.stripeShippingSameAsBilling?{}:Q({currentAddress:Object.assign(Object.assign({},m),{name:null===(s=N.stripeBillingAddressEventData)||void 0===s?void 0:s.value.name}),translatedAddressResult:c.billingAddress||null})}};T("clientSecret",(e=>{e&&N.stripe&&sessionStorage.setItem("zonos--client-secret",e),e||sessionStorage.removeItem("zonos--client-secret")}));const{onChange:ee,reset:te,state:oe}=t((()=>({addressFormRenderType:"stripe",adjustmentTotal:0,adjustments:[],checkoutSession:null,checkoutSessionTimeoutShow:!1,checkoutTimeoutInterval:null,currency:"USD",customQuotingError:null,customerAuthenticationToken:null,displayBaseCurrency:!1,dutiesTaxesFees:null,dutiesTaxesFeesEstimate:null,error:null,exchangeRate:null,externalConfirmationPageURL:null,inventoryCheckErrorMessage:null,isSelectedShippingAboveDeminimis:!1,isSelectedShippingGuarantee:!1,isStagingMode:u(),items:[],landedCostData:null,landedCostMethod:"DDP",partiesData:[],promoCode:sessionStorage.getItem("zonos--promo-code")||"",promoCodeApplied:!!sessionStorage.getItem("zonos--promo-code"),promoCodeError:!1,restrictedItems:[],selectedLandedCost:null,selectedShippingOption:null,selectedShippingOptionExpectedDate:"",selectedShippingOptionTransitTime:"",shipping:0,shippingData:null,shouldHideDiscountInput:!1,step:"customer-info",subtotal:0,tabItems:{"customer-info":{index:1,isDone:!1,label:"Customer",value:"customer-info"},shipping:{index:2,isDone:!1,label:"Shipping",value:"shipping"},payment:{index:3,isDone:!1,label:"Payment",value:"payment"}},total:0}))),ne=e=>{switch(e){case"DAYS":return r("days");case"WEEKS":return r("weeks");default:return r("business days")}},re=e=>{var t;const o=null===(t=e.shippingProfile)||void 0===t?void 0:t.transitTime;return(null==o?void 0:o.min)&&(null==o?void 0:o.max)&&(null==o?void 0:o.type)?{maxTransit:o.max,minTransit:o.min,unit:ne(o.type)}:null},se=({item1:e,item2:t})=>!(!e||!t)&&(t.sku&&e.sku&&e.sku===t.sku||t.description&&e.description&&e.description===t.description||e.name&&t.name&&e.name===t.name),ie=e=>{a("Checking item restrictions");const t=e.map((e=>{if(!e.restriction)return null;const{restriction:t}=e,o=oe.items.find((t=>se({item1:t,item2:e})));return Object.assign(Object.assign({matchedItem:o},e),{restriction:t})})).filter(Boolean);return oe.restrictedItems=t,oe.items=oe.items.map((e=>Object.assign(Object.assign({},e),{isRestricted:!!t.find((t=>se({item1:t,item2:e})))}))),{cartItems:oe.items,restrictedItems:t}},ae=()=>{o.checkoutSessionId=null,te()},de=({messages:e,title:t})=>{ae(),R(),oe.step="error",oe.error={messages:e,title:t}},le=({dutiesTaxesFeesEstimate:e,method:t,subtotals:o})=>{oe.exchangeRate=o.exchangeRate,oe.adjustmentTotal=o.adjustments,oe.dutiesTaxesFees="DAP"===t?null:o.landedCostTotal,oe.subtotal=o.items,oe.total=o.total,oe.currency=o.presentmentCurrencyCode,oe.dutiesTaxesFeesEstimate=e||null},ce=()=>!!oe.items.filter((e=>e.amount>0)).find((e=>!e.isRestricted)),ue=e=>{var t,n,r,d,l;N.clientSecret=e.clientSecret,N.stripeCustomerSessionClientSecret=e.customerSessionClientSecret,N.customerProfile=e.customerProfile,oe.checkoutSession=e,e.id||m({endpoint:"cartStoreSetCheckoutSession",errors:["Missing checkout session id in checkout session"],metadata:{allLogs:v,checkoutSession:e}}),e.id&&(o.checkoutSessionId=e.id);const c=s(e.varianceTestResults||[]);i(c);const u=(null===(r=null===(n=null===(t=oe.checkoutSession)||void 0===t?void 0:t.metadata)||void 0===n?void 0:n.find((e=>"externalConfirmationPageURL"===(null==e?void 0:e.key))))||void 0===r?void 0:r.value)||(null===(l=null===(d=window.Zonos.cartData)||void 0===d?void 0:d.metadata.find((e=>"externalConfirmationPageURL"===(null==e?void 0:e.key))))||void 0===l?void 0:l.value)||null;u&&(a(`Found externalConfirmationPageURL: ${u}`),oe.externalConfirmationPageURL=u)},me=async({adjustmentsAmount:e,cartId:t,currency:s,dutiesTaxesFeesEstimate:i,itemsAmount:d,landedCostId:c,shouldInitSessionOnFailure:u})=>{var m;if(c&&oe.selectedLandedCost&&(le({dutiesTaxesFeesEstimate:i,method:oe.landedCostMethod,subtotals:oe.selectedLandedCost.subtotals}),a("Exchange rate updated for cart items (landed cost subtotal)","info",oe.exchangeRate)),!o.checkoutSessionId)return a("Could not update cart total without checkout session id","info"),!1;const{errors:v,json:h}=await(async({adjustmentsAmount:e,cartId:t,currency:r,id:s,itemsAmount:i,landedCostId:a,presentmentCountryCode:d})=>{const c=o.enabledVariantTestKeys||[],{errors:u,json:m}=await l("/api/zonos-elements/update-checkout-session",{body:{adjustmentsAmount:e,billToPartyId:N.partyBillingId,cartId:t,currency:r,customerAuthenticationToken:oe.customerAuthenticationToken||void 0,id:s,itemsAmount:i,landedCostId:a,metadata:[{key:"language",value:n.selectedLocale}],presentmentCountryCode:d,shipToPartyId:N.partyShippingId,skipPaymentIntent:N.skipPaymentIntent,varianceTestInput:c},method:"POST"});return u.length||!m?(p("Error occurs when updating checkout session",JSON.stringify(u,null,2)),{errors:u,json:m}):{errors:[],json:m}})({adjustmentsAmount:e,billToPartyId:N.partyBillingId,cartId:t,currency:s,id:o.checkoutSessionId,itemsAmount:d,landedCostId:c,presentmentCountryCode:n.selectedCountryCode,shipToPartyId:N.partyShippingId,varianceTestInput:o.enabledVariantTestKeys||[]});if(v.length>0||!h){if(p("Error occurs when updating checkout session."),u){a("Initiating checkout session on failure","info");const e=await V();return a(`stripeStoreInitCheckoutSession: ${e}`),!!e||(de({messages:[r("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:r("Error creating Checkout")}),!1)}return!1}return c||(le({method:(null===(m=h.checkoutSessionUpdate.landedCost)||void 0===m?void 0:m.method)||"DDP",subtotals:h.checkoutSessionUpdate.subtotals}),a("Exchange rate updated for cart items (checkout session update)","info",oe.exchangeRate)),ue(h.checkoutSessionUpdate),!0},ve=e=>"DAP"===e.method&&e.remittance.length&&"ZONOS"===e.landedCostGuaranteeCode?"DDP":e.method,pe=async(t,n)=>{var r,s,i,d,l,c,u,m,v,p,h;oe.selectedShippingOption=t;const y=re(oe.selectedShippingOption);if(y){const{maxTransit:e,minTransit:t,unit:o}=y;oe.selectedShippingOptionTransitTime=`${t}-${e} ${o}`}else oe.selectedShippingOptionTransitTime="";const w=null===(r=oe.landedCostData)||void 0===r?void 0:r.find((e=>e.landedCostId===n));if(oe.selectedLandedCost=w||null,!w)return!1;const g=((null===(s=w.landedCost.amountSubtotals)||void 0===s?void 0:s.landedCostTotal)||0)*w.subtotals.exchangeRate.rate;g&&a(`DAP quote, using estimate: ${g}`,"info"),oe.landedCostMethod=ve(w.landedCost),oe.shipping=w.subtotals.shipping;const f="ZONOS"===(null===(i=null==w?void 0:w.landedCost)||void 0===i?void 0:i.landedCostGuaranteeCode),b=!!(null===(l=null===(d=null==w?void 0:w.landedCost)||void 0===d?void 0:d.deMinimis)||void 0===l?void 0:l.find((e=>["DUTY","TAX"].includes(e.type)&&"ABOVE"===e.threshold)));oe.isSelectedShippingAboveDeminimis=b,oe.isSelectedShippingGuarantee=f;const S=await me({adjustmentsAmount:oe.adjustmentTotal,billToPartyId:N.partyBillingId,cartId:window.Zonos.cartId,dutiesTaxesFeesEstimate:g,landedCostId:null===(c=w.landedCost)||void 0===c?void 0:c.id,shipToPartyId:N.partyShippingId,varianceTestInput:o.enabledVariantTestKeys||[]}),C=null===(u=oe.items.find(Boolean))||void 0===u?void 0:u.currencyCode,O=(null===(m=N.stripeAddressEventData)||void 0===m?void 0:m.value.address.country)||"US";return N.shouldRenderPayInUsdButton="USD"===C&&"LOCAL_AND_USD"===e.checkoutSettings.allowedSettlementCurrencies&&"USD"!==(null===(v=oe.checkoutSession)||void 0===v?void 0:v.subtotals.presentmentCurrencyCode)&&!!(null===(h=null===(p=e.genericSettings)||void 0===p?void 0:p.usdSettlementCountryEnabled)||void 0===h?void 0:h.includes(O)),S},he=({isPreview:e,sessionTimeout:t})=>{if(e)return;const o=new URLSearchParams(window.location.search).get("zonosCheckoutTimeout"),n=o&&!isNaN(parseInt(o,10))?parseInt(o,10):t;a(`==START CHECKOUT TIMEOUT - ${n}==`),oe.checkoutTimeoutInterval=setTimeout((()=>{oe.checkoutSessionTimeoutShow=!0}),n)},ye=()=>{oe.checkoutTimeoutInterval&&(clearTimeout(oe.checkoutTimeoutInterval),oe.checkoutTimeoutInterval=null)},we=()=>{oe.items=oe.items.map((e=>Object.assign(Object.assign({},e),{isRestricted:!1}))),oe.restrictedItems=[]},ge=async({adjustments:e,cartItems:t})=>{var n;oe.adjustments=e,oe.items=t.map((e=>Object.assign(Object.assign({},e),{isRestricted:!1})));const r=null===(n=t.find(Boolean))||void 0===n?void 0:n.currencyCode,s=t.reduce(((e,t)=>e+t.amount*t.quantity),0),i=e.reduce(((e,t)=>e+t.amount),0);r&&s&&(oe.currency=r,N.isFetchingSession=!0,await me({adjustmentsAmount:i,billToPartyId:N.partyBillingId,cartId:window.Zonos.cartId,currency:r,dutiesTaxesFeesEstimate:0,itemsAmount:s,shipToPartyId:N.partyShippingId,shouldInitSessionOnFailure:!0,varianceTestInput:o.enabledVariantTestKeys||[]}),N.isFetchingSession=!1)},fe=()=>{"shipping"===oe.step?(oe.step="customer-info",oe.tabItems=Object.assign(Object.assign({},oe.tabItems),{"customer-info":Object.assign(Object.assign({},oe.tabItems.shipping),{isDone:!1})})):"payment"===oe.step?(oe.step="shipping",oe.tabItems=Object.assign(Object.assign({},oe.tabItems),{shipping:Object.assign(Object.assign({},oe.tabItems.shipping),{isDone:!1})})):"finish"===oe.step&&(oe.step="payment",oe.tabItems=Object.assign(Object.assign({},oe.tabItems),{payment:Object.assign(Object.assign({},oe.tabItems.payment),{isDone:!1})}))},be=()=>{"customer-info"===oe.step?(oe.step="shipping",oe.tabItems=Object.assign(Object.assign({},oe.tabItems),{"customer-info":Object.assign(Object.assign({},oe.tabItems["customer-info"]),{isDone:!0})})):"shipping"===oe.step?(oe.step="payment",oe.tabItems=Object.assign(Object.assign({},oe.tabItems),{shipping:Object.assign(Object.assign({},oe.tabItems.shipping),{isDone:!0})})):"payment"===oe.step&&(oe.step="finish")},Se=()=>{oe.step="customer-info",oe.tabItems=Object.assign(Object.assign({},oe.tabItems),{"customer-info":Object.assign(Object.assign({},oe.tabItems["customer-info"]),{isDone:!1}),payment:Object.assign(Object.assign({},oe.tabItems.payment),{isDone:!1}),shipping:Object.assign(Object.assign({},oe.tabItems.shipping),{isDone:!1})}),oe.selectedShippingOption=null,oe.isSelectedShippingAboveDeminimis=!1,oe.isSelectedShippingGuarantee=!1,oe.selectedShippingOptionTransitTime="",oe.dutiesTaxesFees=0,oe.dutiesTaxesFeesEstimate=0,oe.shipping=0,oe.total=oe.subtotal};export{ce as A,F as B,$ as C,J as D,M as E,X as F,ee as G,z as H,pe as I,re as J,A as K,ve as L,P as a,L as b,N as c,Y as d,oe as e,ge as f,ae as g,Se as h,x as i,ye as j,V as k,G as l,he as m,K as n,de as o,ue as p,B as q,be as r,D as s,C as t,Z as u,W as v,H as w,q as x,R as y,k as z}
@@ -1 +0,0 @@
1
- import{r as o,h as e,H as t}from"./p-1640d77f.js";import{d as s}from"./p-d6a53ea6.js";import{l as i,i as n,t as l,g as r,h,j as a,k as d,m as c,d as m}from"./p-a6f77d44.js";import{z as g,g as p,m as w}from"./p-6aa728f2.js";import{c as f}from"./p-b4b7f705.js";import{h as z,b as u,l as b}from"./p-20839c46.js";import{g as v}from"./p-5883217a.js";import"./p-04a01cb1.js";const x=o=>{const e=null==o?void 0:o.replace("www.","").replace("https://","");return e&&new RegExp(e).test(window.location.href)},y=()=>{var o,e;const{productAddToCartElementSelector:t,productDescriptionElementSelector:s,productTitleElementSelector:i,restrictionBehavior:l}=g.helloSettings;i&&s||b("Hello could not check item restrictions - must provide title and description selectors.");const r=i&&n(i)&&document.querySelectorAll(i)||[],h=s&&n(s)&&document.querySelectorAll(s)||[];if(r.length!==h.length)return b("Hello could not check item restrictions - Title and description selectors do not match"),[];const a="RESTRICT_AND_BLOCK"===l,d=a&&t&&n(t)&&document.querySelectorAll(t)||[];a&&d.length!==h.length&&b('Hello could not disable "Add to cart" buttons - Title and add to cart selectors do not match');const c=[];for(let t=0;t<r.length;t++){const s=r[t],i=h[t];if(s&&i){const n={cartButtonNode:d[t]||null,description:(null===(o=i.textContent)||void 0===o?void 0:o.trim())||"",title:(null===(e=s.textContent)||void 0===e?void 0:e.trim())||""};c.push(n)}}return c},k=class{constructor(e){o(this,e),this.showPeekMessage=!1,this.zonosStoreHelloSettings=g.helloSettings,this.showDialog=!1,this.peekMessage="",this.initialUrl="",this.allRestrictedItems=[],this.allFoundProducts=[],this.productsOnPage=[],this.isHelloWidgetRendered=!1,this.isMobile=!1,this.getHelloPeekMessage=o=>{if(("productDetail"===g.currentHelloPage||"productList"===g.currentHelloPage)&&this.allRestrictedItems.length){const o=l("click to learn more");return`${l("productDetail"===g.currentHelloPage?"Restricted item":"Restricted items found")} - ${o}`}switch(g.currentHelloPage){case"cart":return l("Prepay duties and taxes at checkout");case"productList":case"productDetail":return l("See duty and tax thresholds");default:return l("Welcome to [storeName]",{storeName:o})}},this.enableShowPeekMessage=()=>{this.peekMessage&&(this.showPeekMessage=!0)},this.getNewItemRestrictions=async o=>"productDetail"!==g.currentHelloPage&&"productList"!==g.currentHelloPage||"DISABLED"===g.helloSettings.restrictionBehavior?[]:await(async o=>{if(!o.length)return[];const{selectedCountryCode:e}=i;if(!e)return u("Hello could not check item restrictions - No country code selected"),[];const t=o.map((o=>({description:o.description,name:o.title})));return(await(async({items:o,shipFrom:e,shipTo:t})=>{var s;const i={items:o,shipFrom:e,shipTo:t},{errors:n,json:l}=await z("/api/zonos-elements/check-item-restrictions",{body:i,method:"POST"});return n.length||!l?(u(`Error fetching item restrictions: ${null===(s=n.find(Boolean))||void 0===s?void 0:s.message}`),[]):l.filter(Boolean)})({items:t,shipFrom:"AD",shipTo:e})).map((o=>{var e;const s=(null===(e=t.filter((e=>e.description===o.itemDescription)).find(Boolean))||void 0===e?void 0:e.name)||"";return Object.assign(Object.assign({},o),{name:s})}))})(o),this.triggerShowPeekMessage=()=>{this.peekMessage=this.getHelloPeekMessage(g.organizationName);const{peekMessageBehavior:o,peekMessageDelay:e}=g.helloSettings;"ENABLED"===o&&setTimeout((()=>{this.enableShowPeekMessage(),this.allRestrictedItems.some((o=>this.productsOnPage.some((e=>e.description===o.itemDescription))))||setTimeout((()=>{this.showPeekMessage=!1}),3e3)}),1e3*e)},this.disableAddToCartButtons=()=>{this.productsOnPage.length&&this.productsOnPage.forEach((o=>{var e,t;this.allRestrictedItems.some((e=>e.itemDescription===o.description))?null===(e=o.cartButtonNode)||void 0===e||e.setAttribute("disabled","disabled"):null===(t=o.cartButtonNode)||void 0===t||t.removeAttribute("disabled")}))},this.handleItemRestrictions=async()=>{this.productsOnPage=y();const o=this.productsOnPage.filter((o=>!this.allFoundProducts.some((e=>e.title===o.title)))),e=await this.getNewItemRestrictions(o);this.allRestrictedItems.push(...e),this.allFoundProducts.push(...o),this.disableAddToCartButtons()},this.reloadHelloData=async()=>{await this.handleItemRestrictions(),this.triggerShowPeekMessage()},this.handleProductCountChange=s((()=>{const{productTitleElementSelector:o}=g.helloSettings;if(o){const o=y();if(this.allFoundProducts.length!==o.length&&window.location.href===this.initialUrl){if(!this.allFoundProducts.length)return;this.reloadHelloData()}}}),1e3),this.watchProductCountChange=()=>{var o;const e=new MutationObserver(this.handleProductCountChange);e.observe(document.body,{childList:!0,subtree:!0}),null===(o=this.observerWatcher)||void 0===o||o.push(e)},this.watchPriceChange=()=>{var o;const e=new MutationObserver((()=>{this.displayCurrency()}));e.observe(document.body,{attributes:!0,childList:!0,subtree:!0}),null===(o=this.observerWatcher)||void 0===o||o.push(e)},this.updateHelloOnPageChange=()=>{this.watchProductCountChange(),setInterval((()=>{if(window.location.href!==this.initialUrl){const o=this.initialUrl&&new URL(this.initialUrl);(o&&r(o.searchParams))!==i.selectedCountryCode&&(this.allFoundProducts=[],this.allRestrictedItems=[],this.productsOnPage=[]),this.initialUrl=window.location.href,g.currentHelloPage=(()=>{const{cartUrlPattern:o,homepageUrlPattern:e,productDetailUrlPattern:t,productListUrlPattern:s}=g.helloSettings;return x(o)?"cart":x(t)?"productDetail":x(s)?"productList":x(e)?"home":""})();const e=new URL(window.location.href);if(!r(e.searchParams))return void h(i.selectedCountryCode);this.reloadHelloData()}}),1e3)},this.changeShowDialog=o=>{this.showDialog=o},this.shouldAnimateLeftDesktop=()=>{const o=this.helloRef&&getComputedStyle(this.helloRef).position;if(this.helloRef&&"relative"===o)return v(this.helloRef)},this.shouldRenderHello=(o=!0)=>{if(!i.localizationLoaded)return!1;const{showForCountries:e}=g.helloSettings;return o&&(i.isShippableCountry||b(`Hello: not shippable country - Show for countries: ${e}`)),"ONLY_SHIPPABLE"===e?i.isShippableCountry:"ALL"===e||(null==e?void 0:e.includes(i.selectedCountryCode||""))}}async getCountryList(){return i.helloCountryList}componentWillLoad(){const o=setInterval((async()=>{this.helloRef&&g.loadedConfig&&(this.helloRef.setAttribute("data-zonos-hello-loaded",""),this.updateHelloOnPageChange(),this.watchPriceChange(),this.handleAppearanceSettingsOverrideChange(),clearInterval(o))}),100)}disconnectedCallback(){var o;null===(o=this.observerWatcher)||void 0===o||o.forEach((o=>o.disconnect()))}async displayCurrency(){"DISABLED"!==g.helloSettings.currencyBehavior&&(i.exchangeRate?a():b("Could not display currency. Exchange rate and format data is not available.","warn"))}async convertAndFormat(o){return d(o)}async convert(o){return c(o)}async format(o){return m({amount:o})}async openHelloDialog(o){this.changeShowDialog(o)}handleResize(){this.isMobile=window.innerWidth<=768}handleHelloWidgetInitializedState({countryCode:o,currencyCode:e}){var t,s;this.isHelloWidgetRendered||i.selectedCountryCode&&"function"==typeof g.helloSettings.onInitSuccess&&(this.isHelloWidgetRendered=!0,null===(s=(t=g.helloSettings).onInitSuccess)||void 0===s||s.call(t,{countryCode:o,currencyCode:e}))}getHelloLocation(){const o=this.mobileLocationOverride||g.helloSettings.mobileLocation,e=g.helloSettings.desktopLocation,t=this.isMobile;if(!0===t)return{isMobileWindow:t,isOnLeft:this.animateFromLeftOverride||(null==o?void 0:o.includes("LEFT")),isOnTop:null==o?void 0:o.includes("TOP"),shouldFloat:!!o};{const o=!g.helloSettings.anchorElementSelector&&!!e;return{isMobileWindow:t,isOnLeft:this.animateFromLeftOverride||(null==e?void 0:e.includes("LEFT"))||this.shouldAnimateLeftDesktop(),isOnTop:null==e?void 0:e.includes("TOP"),shouldFloat:o}}}handleAppearanceSettingsOverrideChange(){var o;(null===(o=this.appearanceSettingsOverride)||void 0===o?void 0:o.theme)&&(this.appearanceSettingsOverride.theme=p(this.appearanceSettingsOverride.theme))}componentDidLoad(){this.isMobile=window.innerWidth<=768}render(){var o,s;if(null===(o=g.helloSettings.excludedUrlPatterns)||void 0===o?void 0:o.some((o=>o&&new RegExp(o).test(window.location.href))))return b("Hello is excluded on this url","warn"),null;const{selectedCountryCode:n,targetCurrency:l}=i,{isOnLeft:r,isOnTop:h,shouldFloat:a}=this.getHelloLocation(),d=w(g.appearance,this.appearanceSettingsOverride||null),{theme:c}=d,m=null===(s=this.allRestrictedItems)||void 0===s?void 0:s.filter((o=>this.productsOnPage.some((e=>e.description===o.itemDescription))));this.peekMessage=this.getHelloPeekMessage(g.organizationName);const p=this.shouldRenderHello()&&!!n;return p&&!this.isHelloWidgetRendered&&this.handleHelloWidgetInitializedState({countryCode:n,currencyCode:l}),e(t,{class:"zonos--hello zonos--elements","data-theme":c},p&&e("div",{class:f(["zonos--hello-wrapper",a&&"zonos--hello-widget-float"])},e("button",{class:f(["zonos--hello-widget",this.showPeekMessage&&"zonos--hello-show-peek-message",this.mobileLocationOverride&&"zonos--hello-mobile-override",r&&"zonos--hello-widget-left zonos--hello-widget-animate-from-left",h&&"zonos--hello-widget-top",!!this.allRestrictedItems.length&&"zonos--hello-has-restrictions",a&&"zonos--hello-widget-float"]),onClick:()=>{this.changeShowDialog(!this.showDialog)},onMouseEnter:()=>this.enableShowPeekMessage(),onMouseLeave:()=>this.showPeekMessage=!1,ref:o=>o&&(this.helloRef=o),type:"button"},e("zonos-text",{class:"zonos--hello-message"},this.peekMessage),n&&e("div",{class:"zonos--hello-country-flag-wrapper"},e("zonos-country-flag",{class:"zonos--hello-country-flag",countryCode:n}))),e("div",{class:f(["zonos--hello-dialog-wrapper",this.mobileLocationOverride&&"zonos--hello-dialog-wrapper-mobile-override",a&&"zonos--hello-widget-float"]),style:{height:this.showDialog?"fit-content":"0px"}},e("zonos-hello-dialog",{animateFromLeftOverride:this.animateFromLeftOverride,appearanceSettings:d,isOpen:this.showDialog,mobileLocationOverride:this.mobileLocationOverride,restrictedItems:m,setIsOpen:this.changeShowDialog}))))}static get watchers(){return{appearanceSettingsOverride:["handleAppearanceSettingsOverrideChange"]}}};k.style=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:inline-block}:host .zonos--hello-wrapper{position:relative}:host .zonos--hello-wrapper .zonos--hello-dialog-wrapper-mobile-override{position:fixed;bottom:0;left:0;width:100vw;z-index:1001;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content}@media (max-width: 768px){:host .zonos--hello-wrapper .zonos--hello-dialog-wrapper{position:fixed;bottom:0;left:0;width:100vw;z-index:1001;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content}}:host .zonos--hello-widget{-webkit-transition:all 0.7s cubic-bezier(0.31, -0.02, 0.06, 1.53);transition:all 0.7s cubic-bezier(0.31, -0.02, 0.06, 1.53);padding:6px;border-radius:30px;background:var(--zonos-elements-page-background);font-size:var(--zonos-elements-font-size-s);border:var(--zonos-elements-border);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;cursor:pointer;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;position:relative;z-index:1000}:host .zonos--hello-widget>.zonos--hello-message{-ms-flex-order:0;order:0;max-width:0;height:100%;white-space:nowrap;-webkit-transition:border 0.3s ease-in, all 0.7s cubic-bezier(0.31, -0.02, 0.06, 1.53);transition:border 0.3s ease-in, all 0.7s cubic-bezier(0.31, -0.02, 0.06, 1.53);overflow:hidden;color:var(--zonos-elements-text-color);position:absolute;background:var(--zonos-elements-page-background);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;border-top-left-radius:30px;border-bottom-left-radius:30px;left:0;-webkit-transform:translateX(calc(-100% + 16px));transform:translateX(calc(-100% + 16px));width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;border-top:var(--zonos-elements-border);border-bottom:var(--zonos-elements-border)}:host .zonos--hello-widget.zonos--hello-has-restrictions{background:var(--zonos-elements-red-100);border:1px solid var(--zonos-elements-red-200)}:host .zonos--hello-widget.zonos--hello-has-restrictions>.zonos--hello-message{background:var(--zonos-elements-red-100);color:var(--zonos-elements-red-800);font-weight:500}:host .zonos--hello-widget.zonos--hello-has-restrictions.zonos--hello-show-peek-message>.zonos--hello-message{border:1px solid var(--zonos-elements-red-200)}:host .zonos--hello-widget.zonos--hello-show-peek-message{max-width:100vw;width:100%}:host .zonos--hello-widget.zonos--hello-show-peek-message>.zonos--hello-message{max-width:100vw;padding:0 6px;padding-right:16px;border:var(--zonos-elements-border)}:host .zonos--hello-widget.zonos--hello-show-peek-message:not(.zonos--hello-widget-animate-from-left)>.zonos--hello-message{border-right:none}:host .zonos--hello-widget.zonos--hello-show-peek-message.zonos--hello-widget-animate-from-left>.zonos--hello-message{border-left:0}:host .zonos--hello-widget.zonos--hello-show-peek-message.zonos--hello-widget-animate-from-left>.zonos--hello-message{padding-left:16px;padding-right:6px;border-left:none}:host .zonos--hello-widget.zonos--hello-widget-animate-from-left>.zonos--hello-message{-ms-flex-order:1;order:1;-webkit-transform:translateX(calc(100% - 16px));transform:translateX(calc(100% - 16px));right:0;left:auto;border-top-right-radius:30px;border-bottom-right-radius:30px}:host .zonos--hello-widget .zonos--hello-country-flag-wrapper{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center}:host .zonos--hello-widget .zonos--hello-country-flag-wrapper .zonos--hello-country-flag{height:18px;width:18px;position:relative;overflow:hidden;border-radius:30px;-webkit-box-shadow:var(--zonos-elements-v3-shadow-medium);box-shadow:var(--zonos-elements-v3-shadow-medium);z-index:10;justify-self:center}:host .zonos--hello-widget.zonos--hello-widget-float{position:fixed;bottom:72px;right:32px}:host .zonos--hello-widget.zonos--hello-widget-float.zonos--hello-widget-left{left:32px;right:auto}:host .zonos--hello-widget.zonos--hello-widget-float.zonos--hello-widget-top{bottom:auto;top:32px}:host .zonos--hello-widget.zonos--hello-widget-float.zonos--hello-has-restrictions.zonos--hello-show-peek-message>.zonos--hello-message{border:none}:host .zonos--hello-widget.zonos--hello-widget-float>.zonos--hello-message{position:relative;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;border-radius:30px;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;top:0;bottom:0;left:0;-webkit-transform:translateX(0);transform:translateX(0);width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;border:none}:host .zonos--hello-widget.zonos--hello-widget-float.zonos--hello-widget-animate-from-left>.zonos--hello-message{-webkit-transform:translateX(0);transform:translateX(0)}:host .zonos--hello-widget.zonos--hello-widget-float.zonos--hello-show-peek-message{width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}:host .zonos--hello-widget.zonos--hello-widget-float.zonos--hello-show-peek-message.zonos--hello-widget-animate-from-left>.zonos--hello-message{padding-left:8px;padding-right:4px}:host .zonos--hello-widget.zonos--hello-widget-float.zonos--hello-show-peek-message>.zonos--hello-message{padding:0 var(--zonos-elements-radius-4);padding-right:6px;border:none}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-widget-float{position:fixed;bottom:72px;right:32px}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-widget-float.zonos--hello-widget-left{left:32px;right:auto}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-widget-float.zonos--hello-widget-top{bottom:auto;top:32px}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-widget-float.zonos--hello-has-restrictions.zonos--hello-show-peek-message>.zonos--hello-message{border:none}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-widget-float>.zonos--hello-message{position:relative;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;border-radius:30px;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;top:0;bottom:0;left:0;-webkit-transform:translateX(0);transform:translateX(0);width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;border:none}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-widget-float.zonos--hello-widget-animate-from-left>.zonos--hello-message{-webkit-transform:translateX(0);transform:translateX(0)}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-widget-float.zonos--hello-show-peek-message{width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-widget-float.zonos--hello-show-peek-message.zonos--hello-widget-animate-from-left>.zonos--hello-message{padding-left:8px;padding-right:4px}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-widget-float.zonos--hello-show-peek-message>.zonos--hello-message{padding:0 var(--zonos-elements-radius-4);padding-right:6px;border:none}";export{k as zonos_hello}
@@ -1 +0,0 @@
1
- var __awaiter=this&&this.__awaiter||function(e,o,t,n){function r(e){return e instanceof t?e:new t((function(o){o(e)}))}return new(t||(t=Promise))((function(t,i){function s(e){try{a(n.next(e))}catch(e){i(e)}}function c(e){try{a(n["throw"](e))}catch(e){i(e)}}function a(e){e.done?t(e.value):r(e.value).then(s,c)}a((n=n.apply(e,o||[])).next())}))};var __generator=this&&this.__generator||function(e,o){var t={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,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(e){return function(o){return a([e,o])}}function a(c){if(n)throw new TypeError("Generator is already executing.");while(s&&(s=0,c[0]&&(t=0)),t)try{if(n=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:t.label++;return{value:c[1],done:false};case 5:t.label++;r=c[1];c=[0];continue;case 7:c=t.ops.pop();t.trys.pop();continue;default:if(!(i=t.trys,i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){t.label=c[1];break}if(c[0]===6&&t.label<i[1]){t.label=i[1];i=c;break}if(i&&t.label<i[2]){t.label=i[2];t.ops.push(c);break}if(i[2])t.ops.pop();t.trys.pop();continue}c=o.call(e,t)}catch(e){c=[6,e];r=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,o,t){if(t||arguments.length===2)for(var n=0,r=o.length,i;n<r;n++){if(i||!(n in o)){if(!i)i=Array.prototype.slice.call(o,0,n);i[n]=o[n]}}return e.concat(i||Array.prototype.slice.call(o))};System.register(["./p-02da743b.system.js","./p-7ec1fecb.system.js","./p-68650f1e.system.js","./p-0751b878.system.js","./p-19182dc7.system.js","./p-a411ce2a.system.js","./p-eb77c0bf.system.js","./p-40a4c8a2.system.js","./p-23e7c655.system.js","./p-bf37ccc7.system.js","./p-738a49c0.system.js","./p-3633a952.system.js","./p-1aa93d1e.system.js","./p-2770ba48.system.js","./p-5a2dd041.system.js","./p-4a1b4a2d.system.js"],(function(e){"use strict";var o,t,n,r,i,s,c,a,u,d,l,h,f,v,m,p,z,g,w,k,b,y,_,C,x,S,T,O,A,I,E,N,P,j,L,D,U,R,B,H,Z,M,K,F,V,G,W,Y,q,J,Q,X,$,ee,oe,te,ne,re,ie,se,ce,ae,ue,de,le,he,fe,ve,me;return{setters:[function(e){o=e.r;t=e.h;n=e.H;r=e.F},function(e){i=e.s;s=e.a;c=e.b;a=e.c;u=e.i;d=e.d;l=e.e;h=e.f;f=e.g;v=e.h;m=e.j;p=e.k;z=e.l;g=e.m;w=e.t;k=e.n;b=e.o;y=e.p;_=e.q;C=e.r;x=e.u;S=e.v;T=e.w;O=e.x;A=e.y},function(e){I=e.p;E=e.s;N=e.a;P=e.b},function(e){j=e.f;L=e.l;D=e.a;U=e.g;R=e.s;B=e.V;H=e.b;Z=e.t;M=e.c;K=e.d},function(e){F=e.z;V=e.g;G=e.m},function(e){W=e.h;Y=e.l;q=e.b;J=e.s;Q=e.c;X=e.d;$=e.e;ee=e.g;oe=e.j;te=e.a;ne=e.i},function(e){re=e.u},function(e){ie=e._;se=e.c;ce=e.a;ae=e.d;ue=e.g},function(e){de=e.c},function(e){le=e.c},function(e){he=e.g},function(e){fe=e.i},function(e){ve=e.s},function(e){me=e.R},function(){},function(){}],execute:function(){var pe=this;var ze=function(e){var o=e.items.map((function(e){return{amount:e.amount,attributes:e.attributes||[],countryOfOrigin:e.countryOfOrigin||undefined,currencyCode:e.currencyCode,description:e.description||"",imageUrl:e.imageUrl||"",itemType:e.itemType||"PHYSICAL_GOOD",measurements:e.measurements||[],name:e.name||e.description||"",productId:e.productId||"",quantity:e.quantity||0,sku:e.sku||""}}))||[];return{adjustments:e.adjustments,cartItems:o}};var ge=function(){return __awaiter(pe,void 0,void 0,(function(){var e,o,t;return __generator(this,(function(n){switch(n.label){case 0:return[4,W("/api/zonos-elements/get-store-discount-enabled-status")];case 1:e=n.sent(),o=e.errors,t=e.json;if(o.length||!(t===null||t===void 0?void 0:t.enabled)){return[2,{enabled:false}]}return[2,{enabled:true}]}}))}))};var we=function(e){return __awaiter(pe,[e],void 0,(function(e){var o,t,n,r;var i=e.testKeys;return __generator(this,(function(e){switch(e.label){case 0:if(i.length===0){return[2,null]}return[4,W("/api/zonos-elements/select-variance-test",{body:{testKeys:i},method:"POST"})];case 1:o=e.sent(),t=o.errors,n=o.json;if(t.length||!n){return[2,null]}r=j(n);return[2,r]}}))}))};var ke=function(e){var o=e.cartId,t=e.checkoutSessionId,n=e.customerAddress1,r=e.customerAddress2,i=e.customerCity,s=e.customerCountry,c=e.customerEmail,a=e.customerFirstName,u=e.customerLastName,d=e.customerPhone,l=e.customerState,h=e.customerZip,f=e.hostedCheckoutUrl,v=e.isTestMode,m=e.isVariantTest;var p=new URLSearchParams;p.set("tempCartUUID",o);if(a){p.set("customerFirstName",a)}if(u){p.set("customerLastName",u)}if(c){p.set("customerEmail",c)}if(d){p.set("customerPhone",d)}if(h){p.set("customerZip",h)}if(i){p.set("customerCity",i)}if(l){p.set("customerState",l)}if(s){p.set("zCountry",s)}if(n){p.set("customerAddress1",n)}if(r){p.set("customerAddress2",r)}if(v){p.set("zonosTestMode","1")}if(t){p.set("zonosCheckoutSessionId",t)}if(m){p.set("zonosVariantTest","1")}return"".concat(f,"?").concat(p.toString())};var be=function(e){if(e===void 0){e=true}if(!L.localizationLoaded){return true}if(L.isDisabledCountry){if(e){Y("Checkout: disabled country")}return true}return false};var ye=function(e){if(e===void 0){e=true}if(!L.localizationLoaded){return false}if(!L.isShippableCountry){if(e){Y("Checkout: not shippable country")}return false}return true};var _e=function(e){var o=e.domesticRedirectedBtnSelector,t=e.onShippingAddressSessionFound;if(!window.Zonos.isBigCommerce){return}var n=new MutationObserver((function(){return __awaiter(pe,void 0,void 0,(function(){var e,r,a,u,d;var l=this;return __generator(this,(function(h){e=document.querySelector(o);r=i();if(!e&&r){a=document.createElement("button");a.style.display="none";a.id="zonos--domestic-redirected-checkout-button";document.body.appendChild(a);t===null||t===void 0?void 0:t(r);n.disconnect();return[2]}u=document.querySelector('select[name="shippingAddress.countryCode"]');d=document.querySelector("#checkout-shipping-continue");if(!u||!d){return[2]}n.disconnect();d.addEventListener("click",(function(e){return __awaiter(l,void 0,void 0,(function(){var o,t,n,r,i,a,d;return __generator(this,(function(l){n=u.value;if(!n){return[2]}D(n);if(!ye(false)){s();return[2]}r=document.querySelector("form");if(!r){return[2]}i=new FormData(r);a=document.querySelector("input#addressLine1Input");d={address1:(o=i.get("shippingAddress.address1"))!==null&&o!==void 0?o:a&&a.value,address2:i.get("shippingAddress.address2"),city:i.get("shippingAddress.city"),countryCode:i.get("shippingAddress.countryCode"),firstName:i.get("shippingAddress.firstName"),lastName:i.get("shippingAddress.lastName"),phone:i.get("shippingAddress.phone"),postalCode:i.get("shippingAddress.postalCode"),stateOrProvince:(t=i.get("shippingAddress.stateOrProvince"))!==null&&t!==void 0?t:i.get("shippingAddress.stateOrProvinceCode")};if(Object.values(d).some((function(e){return e===undefined||e===null}))){q("One or more shipping address field is missing",Object.entries(d));void J({endpoint:"No endpoint, domestic checkout form missing fields",errors:["Bigcommerce: One or more shipping address field is missing in the domestic checkout form",JSON.stringify(Object.entries(d))],metadata:{storeId:F.storeId}});return[2]}c({address1:d.address1,address2:d.address2,city:d.city,countryCode:d.countryCode,firstName:d.firstName,lastName:d.lastName,phone:d.phone,postalCode:d.postalCode,state:d.stateOrProvince});e.preventDefault();e.stopPropagation();window.location.href="/";return[2]}))}))}));return[2]}))}))}));n.observe(document.body,{childList:true,subtree:true})};var Ce=function(){var e=new URLSearchParams(window.location.search);Y("legacy urlParams","info",Object.fromEntries(e.entries()));var o=function(o){var t=e.get(o);if(!t||t==="undefined"){return""}return t};var t=U(e)||L.selectedCountryCode||"US";var n=o("customerCity");var r=o("customerEmail");var i=o("customerAddress1");var s=o("customerAddress2");var c=o("customerName");var a=o("customerPhone");var u=o("customerZip");var d=o("customerState");var l=o("customerFirstName");var h=o("customerLastName");return{customerAddress1:i,customerAddress2:s,customerCity:n,customerCountry:t,customerEmail:r,customerFirstName:l,customerLastName:h,customerName:c,customerPhone:a,customerState:d,customerZip:u}};var xe=0;var Se=function(){return __awaiter(pe,void 0,void 0,(function(){var e,o;var t;return __generator(this,(function(n){switch(n.label){case 0:if(window.Zonos.loadTimeApiInfoList.length===0){return[2]}Y("Sending bulk load time api log","info",{loadTimeApiInfoList:window.Zonos.loadTimeApiInfoList});e={data:__spreadArray([],window.Zonos.loadTimeApiInfoList,true),storeId:window.Zonos.storeId||0};window.Zonos.loadTimeApiInfoList.length=0;return[4,W("/api/zonos-elements/log-bulk-load-data",{body:e,method:"POST"})];case 1:o=n.sent().errors;if(o.length){(t=window.Zonos.loadTimeApiInfoList).push.apply(t,e.data);xe++;if(xe>5&&window.Zonos.logIntervalId){clearInterval(window.Zonos.logIntervalId)}}return[2]}}))}))};var Te=function(){return __awaiter(pe,void 0,void 0,(function(){var e,o;return __generator(this,(function(t){e=Q().elapsedTime;o={cache:"miss",eventName:"jsdelivr",flag:"LOG_CHECKOUT_FACADE_LOAD",href:window.location.href,loadTime:e,metadata:Object.assign({allLogs:X},$()),scriptLoadUrl:"checkoutFacade",storeId:window.Zonos.storeId};void W("/api/zonos-elements/log-script-load",{body:o,method:"POST"});return[2]}))}))};var Oe=function(e){return __awaiter(pe,[e],void 0,(function(e){var o;var t=e.loadTime;return __generator(this,(function(e){o={cache:"miss",eventName:"jsdelivr",flag:"LOG_NATIVE_CHECKOUT_LOAD",href:window.location.href,loadTime:t,metadata:Object.assign({allLogs:X},$()),scriptLoadUrl:"nativeCheckout",storeId:window.Zonos.storeId};void W("/api/zonos-elements/log-script-load",{body:o,method:"POST"});return[2]}))}))};var Ae=function(e){return(e===null||e===void 0?void 0:e.filter((function(e){if(e.expiresAt&&e.expiresAt<Date.now()||!e.expiresAt){return false}return true})))||[]};var Ie=function(e){var o;var t=(o=R.enabledVariantTestKeys)===null||o===void 0?void 0:o.find((function(o){return o.testKey===e}));return(t===null||t===void 0?void 0:t.selectedVariantKey)||null};var Ee=function(e){return F.enabledVariantTestKeys.includes(e)};var Ne=function(e){var o=e.baseTestObj,t=e.mergeTestObj;return o.map((function(e){var o=e.testKey;var n=t.find((function(e){var t=e.testKey;return t===o}));return{expiresAt:(n===null||n===void 0?void 0:n.expiresAt)||Date.now()+B,selectedVariantKey:(n===null||n===void 0?void 0:n.selectedVariantKey)||null,testKey:o}}))};var Pe=function(e){return __awaiter(pe,[e],void 0,(function(e){var o,t,n,r,i;var s=e.cartId,c=e.retries;return __generator(this,(function(e){switch(e.label){case 0:o=ee();return[4,W("/api/zonos-elements/get-temp-cart",{body:{isTestMode:o,options:{noOnlineStoreSettings:true},tempCartUUID:s},headers:{"Content-Type":"application/json"},method:"POST"})];case 1:t=e.sent(),n=t.errors,r=t.json;i=!r||n.length;if(!(i&&c))return[3,3];Y("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:c});return[4,new Promise((function(e){return setTimeout(e,500)}))];case 2:e.sent();return[2,Pe({cartId:s,retries:c-1})];case 3:if(i){return[2,null]}return[2,r]}}))}))};var je=function(e){return __awaiter(pe,void 0,void 0,(function(){var o,t,n,r;return __generator(this,(function(i){switch(i.label){case 0:o=ie(e),t=o.isDgsCartId,n=o.isLegacyCartId;if(!n&&!t){q("[ZONOS - loadZonos] invalid cart id");return[2,null]}return[4,Pe({cartId:e,retries:5})];case 1:r=i.sent();Y("[ZONOS - loadZonos] getting temp cart data","info",r);if(!r){q("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process.");return[2,null]}window.Zonos.storeId=r.cartData.storeId;window.Zonos.zonosApiKey=r.cartData.credentialToken;return[2,{cartData:r.cartData,storeFavicon:r.storeFaviconUrl,storeId:r.cartData.storeId,storeLogo:r.storeLogoUrl,zonosApiKey:r.cartData.credentialToken}]}}))}))};var Le='<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 De=".sc-zonos-checkout-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-checkout-h *.sc-zonos-checkout{font-family:var(--zonos--font-family, Inter), Inter}.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{-ms-scroll-chaining:none;overscroll-behavior:contain}.sc-zonos-checkout-h *.sc-zonos-checkout::-webkit-scrollbar{width:10px}.sc-zonos-checkout-h *.sc-zonos-checkout::-webkit-scrollbar-track{background:var(--zonos-elements-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(--zonos--border-radius, var(--zonos-elements-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:32px}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout{background-color:var(--zonos--primary-color, var(--zonos-elements-gray-0));border-right:1px solid var(--zonos-elements-gray-200)}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{background-color:var(--zonos-elements-gray-0)}.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(--zonos-elements-gray-0);-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;padding:24px;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--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;position:relative}.sc-zonos-checkout-h .zonos--left.sc-zonos-checkout .zonos--wrapper.sc-zonos-checkout{padding:0 8px 8px}.sc-zonos-checkout-h .zonos--left.sc-zonos-checkout .zonos--payment-error-banner.sc-zonos-checkout{margin-top:24px}.sc-zonos-checkout-h .zonos--right.sc-zonos-checkout{position:relative}.sc-zonos-checkout-h .zonos--right.sc-zonos-checkout .zonos--right-actions.sc-zonos-checkout{position:absolute;right:24px;top:24px;z-index:2;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.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-wrapper.sc-zonos-checkout{display:-ms-flexbox;display:flex;gap:16px;-ms-flex-align:center;align-items:center}.sc-zonos-checkout-h .zonos--logo-wrapper.sc-zonos-checkout>*.sc-zonos-checkout{height:-webkit-fit-content;height:-moz-fit-content;height:fit-content}.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--logo.sc-zonos-checkout img.sc-zonos-checkout{max-height:72px}.sc-zonos-checkout-h .zonos--checkout-default-message.sc-zonos-checkout{margin-left:76px;margin-bottom:8px}.zonos--close-button.sc-zonos-checkout{-ms-flex-item-align:start;align-self:flex-start}.preview.sc-zonos-checkout-h{min-width:500px;margin:auto;position:relative}.preview.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout{border:var(--zonos-elements-border)}.preview.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout{padding:32px}.hidden-mode.sc-zonos-checkout-h{height:0;opacity:0;pointer-events:none;position:absolute;visibility:hidden;width:0;z-index:-1}.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:12px;padding-bottom:76px}@media (max-width: 768px){.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-bottom:0}}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout{-ms-flex-order:2;order:2;border-right:none}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{-ms-flex-order:1;order:1;padding-top:16px}.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;border:var(--zonos-elements-border);border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-10));background-color:var(--zonos-elements-gray-50);padding:12px;margin-top:32px}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout .zonos--review.sc-zonos-checkout{margin-bottom:0}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout .zonos--cart-items.sc-zonos-checkout{margin-top:8px}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout zonos-checkout-footer.sc-zonos-checkout{-ms-flex-order:3;order:3}.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}.iframed.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout{-ms-scroll-chaining:chained;overscroll-behavior:auto}";var Ue=De;var Re=90*60*1e3;var Be=6*60*60*1e3;var He=e("zonos_checkout",function(){function e(e){var t=this;o(this,e);this.onChangeLocaleListener=function(){};this.isRedirectAfterOrder=false;this.preview=false;this.hiddenMode=false;this.mobile=false;this.defaultAddress=[];this.forceDialogOpen=false;this.defaultAddressParams=[];this.defaultCustomerProfileAddress=[];this.customerProfile=null;this.open=this.forceDialogOpen;this.isOverlayLoading=false;this.stripe=window.Zonos.stripe;this.submitLoading=false;this.collapseReviewMobile=true;this.isAttachError=false;this.isMobile=false;this.isIframed=false;this.isLegacyCheckout=window.Zonos.isLegacyCheckout;this.confirmDialogOpen=false;this.isCartExpired=false;this.payInUsdConfirmDialogOpen=false;this.inventoryCheckErrorMessage=null;this.placedOrderInfo=null;this.clientSecret=a.clientSecret;this.stripeCustomerSessionClientSecret=a.stripeCustomerSessionClientSecret;this.applyStripeTheme=function(){return __awaiter(t,void 0,void 0,(function(){var e,o,t,n,r;return __generator(this,(function(i){switch(i.label){case 0:r=((e=this.appearanceSettingsOverride)===null||e===void 0?void 0:e.theme)||F.appearance.theme;return[4,u({overrideBorderRadius:(o=this.appearanceSettingsOverride)===null||o===void 0?void 0:o.style,overridePrimaryColor:(t=this.appearanceSettingsOverride)===null||t===void 0?void 0:t.colorPrimary,overrideSecondaryColor:(n=this.appearanceSettingsOverride)===null||n===void 0?void 0:n.colorSecondary,overrideTheme:this.isMobile?r:undefined,paypalEnabled:I()})];case 1:i.sent();return[2]}}))}))};this.checkStripePaymentIntentStatus=function(e){return __awaiter(t,[e],void 0,(function(e){var o,t,n,r,i,s,c,u,l;var h=e.triggeredButton;return __generator(this,(function(e){switch(e.label){case 0:o=h===null||h===void 0?void 0:h.matches("#".concat(se));t=!!window.Zonos.cartData;n=new URL(window.location.href).searchParams;r=n.get("payment_intent_client_secret");i=n.get("zonosCheckoutSessionId");if(!o){Y("Checkout is triggered by user, no need to check stripe payment intent status");return[2,{shouldAllowOrder:true}]}Y("Payment intent exist, checking stripe payment intent status");if(!r){Y("No stripe client secret found in the URL, proceed to order if cart data is available");return[2,{shouldAllowOrder:t}]}return[4,d({clientSecret:r})];case 1:s=e.sent(),c=s.error,u=s.status;l=new URLSearchParams(window.location.search).get("redirect_status");if(l){if(!c){Y("Payment intent is succeeded or in a good state to move forward, show success screen")}else{Y("Payment intent failed, show status from error")}this.open=true;R.checkoutSessionId=i;a.clientSecret=r;void this.setToFinishStep(u);return[2,{shouldAllowOrder:false}]}if(!t){Y("Cart data is not available, only check payment intent status, skip order.");return[2,{shouldAllowOrder:false}]}Y("Payment intent is not succeeded, proceed to order");return[2,{shouldAllowOrder:true}]}}))}))};this.initializeTestKeys=function(){R.enabledVariantTestKeys=Ae(R.enabledVariantTestKeys||[]);var e=F.enabledVariantTestKeys.map((function(e){var o;var t=(o=R.enabledVariantTestKeys)===null||o===void 0?void 0:o.find((function(o){var t=o.testKey;return t===e}));return{expiresAt:(t===null||t===void 0?void 0:t.expiresAt)||Date.now()+B,selectedVariantKey:(t===null||t===void 0?void 0:t.selectedVariantKey)||null,testKey:e}}));H(e);return{allSelected:false}};this.shouldAllowHostedVsNativeTest=function(){if(typeof F.checkoutSettings.createCartId!=="function"){return false}var e=F.enabledVariantTestKeys.includes("hosted_vs_native");if(!e){return false}return true};this.registerTestHostedVsNative=function(){return __awaiter(t,void 0,void 0,(function(){var e,o,t,n;return __generator(this,(function(r){switch(r.label){case 0:e=this.shouldAllowHostedVsNativeTest();if(!e){return[2]}Y("[TEST] - Registering hosted vs native test");o=Ie("hosted_vs_native");if(o){Y("[TEST] - Hosted vs native test already has variant selected: ".concat(o));return[2]}return[4,we({testKeys:["hosted_vs_native"]})];case 1:t=r.sent();if(!t){Y("[TEST] - Failed to get selection for hosted vs native test");return[2]}n=Ne({baseTestObj:R.enabledVariantTestKeys||[],mergeTestObj:t});H(n);return[2]}}))}))};this.handleHostedVsNative=function(){return __awaiter(t,void 0,void 0,(function(){var e,o,t,n,r,i,s,c;return __generator(this,(function(a){switch(a.label){case 0:o=this.shouldAllowHostedVsNativeTest();if(!o){return[2,{redirected:false}]}t=Ie("hosted_vs_native");Y("[TEST] - hosted_vs_native: ".concat(t));if(typeof F.checkoutSettings.createCartId!=="function"){Y("[TEST] - createCartId is not provided, skipping hosted vs native test");return[2,{redirected:false}]}if(t!=="hosted"){Y("[TEST] - Hosted vs native test is enabled for native, skipping");return[2,{redirected:false}]}if(!((e=F.genericSettings)===null||e===void 0?void 0:e.hostedCheckoutUrl)){Y("[TEST] - Hosted checkout URL is not provided");return[2,{redirected:false}]}Y('"createCartId" is provided, start building cart');return[4,F.checkoutSettings.createCartId()];case 1:n=a.sent();i=null;if(typeof n==="object"){r=n.cartId;i=n.shippingData||null}else{r=n}s=Ce();c=ke(Object.assign(Object.assign({cartId:r,checkoutSessionId:R.checkoutSessionId||undefined,hostedCheckoutUrl:F.genericSettings.hostedCheckoutUrl,isTestMode:ee(),isVariantTest:true},s),i));Y("[TEST] - Redirecting to: ".concat(c));window.open(c,"_blank");return[2,{redirected:true}]}}))}))};this.formatDate=function(e){if(!e){return""}var o=new Date(e);return o.toLocaleDateString()};this.formatTime=function(e){if(!e){return""}var o=new Date(e);return o.toLocaleTimeString()};this.getCurrentLocalePageEnum=function(){switch(l.step){case"customer-info":return"checkout_customer_info";case"shipping":return"checkout_shipping_info";case"payment":return"checkout_payment_info";default:return null}};this.getBaseCurrencySettlementInfo=function(){var e=l.selectedLandedCost;if(!e){return null}var o=e.landedCost.amountSubtotals;if(!o){return null}var t=(o.discounts||0)+o.items+o.landedCostTotal+o.shipping;return{settlementAmount:t}};this.getDefaultAddress=function(){if(t.defaultCustomerProfileAddress.length){return t.defaultCustomerProfileAddress}if(Array.isArray(t.defaultAddress)&&t.defaultAddress.length){return t.defaultAddress}if(!Array.isArray(t.defaultAddress)&&typeof t.defaultAddress==="object"){return[t.defaultAddress]}return t.defaultAddressParams};this.handleHostedOpenWindowCallback=function(e){var o;var t=(o=F.genericSettings)===null||o===void 0?void 0:o.hostedCheckoutUrl;if(!origin){return}var n=["dev.checkout.elements.zonos.com"].some((function(o){return e.origin.includes(o)}));if(e.origin!==t&&!n){return}switch(e.data.type){case"zonos-checkout-session-update":R.checkoutSessionId=e.data.checkoutSessionId;break}};this.captureParamsRedirectedForVariantTest=function(){var e=new URL(window.location.href);var o=e.searchParams.get("zonosVariantTest")==="1";if(!o){return}var t=e.searchParams.get("zonosCheckoutSessionId");if(t){R.checkoutSessionId=t}var n=R.enabledVariantTestKeys||[];if(window.Zonos.isLegacyCheckout){var r=Ie("hosted_vs_native");if(!r){n.push({expiresAt:Date.now()+B,selectedVariantKey:"hosted",testKey:"hosted_vs_native"});H(n)}else{H(n.map((function(e){if(e.testKey==="hosted_vs_native"){return Object.assign(Object.assign({},e),{selectedVariantKey:"hosted"})}return e})))}}e.searchParams.delete("zonosCheckoutSessionId");e.searchParams.delete("zonosVariantTest");window.history.replaceState({},"",e.toString())}}e.prototype.initCartInfoHandler=function(e){return __awaiter(this,void 0,void 0,(function(){var o;return __generator(this,(function(t){o=e.detail;void h({adjustments:l.adjustments,cartItems:o});return[2]}))}))};e.prototype.handleKeyPress=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(o){if(e.key==="Escape"){void this.closeDialogHandler()}return[2]}))}))};e.prototype.closeDialogHandler=function(e){return __awaiter(this,void 0,void 0,(function(){var o,t;return __generator(this,(function(n){if(!this.open){return[2]}if(!(e===null||e===void 0?void 0:e.confirmed)){this.confirmDialogOpen=true;return[2]}this.confirmDialogOpen=false;E("zonos-checkout-close");this.open=this.forceDialogOpen||false;if(!this.preview&&l.step==="finish"){f()}l.step="customer-info";v();m();(t=(o=F.checkoutSettings).onClose)===null||t===void 0?void 0:t.call(o);return[2]}))}))};e.prototype.buildCartAndInit=function(){return __awaiter(this,void 0,void 0,(function(){var e,o,t,n,r,i,s,c,i,s,s,a,u,i,d;return __generator(this,(function(f){switch(f.label){case 0:if(!(typeof F.checkoutSettings.createCartId==="function"))return[3,4];Y('"createCartId" is provided, start building cart');return[4,F.checkoutSettings.createCartId()];case 1:e=f.sent();o=void 0;if(typeof e==="object"){Y("object detected, use cartId and prefill address from createCartId");o=e.cartId;this.useShippingDataFromCreateCartId(e.shippingData);l.customerAuthenticationToken=e.customerAuthenticationToken||null}else{o=e}window.Zonos.cartId=o;return[4,je(o)];case 2:t=f.sent();n=t===null||t===void 0?void 0:t.cartData;if(!n){q("Failed to build cart, please try again.");return[2,false]}window.Zonos.cartData=n;r=ze(n),i=r.adjustments,s=r.cartItems;return[4,h({adjustments:i,cartItems:s})];case 3:f.sent();return[3,9];case 4:if(!window.Zonos.cartData)return[3,6];Y("tempCartUUID is provided, start building cart");c=ze(window.Zonos.cartData),i=c.adjustments,s=c.cartItems;return[4,h({adjustments:i,cartItems:s})];case 5:f.sent();return[3,9];case 6:if(!(F.checkoutSettings.buildCartDetail&&L.selectedCountryCode))return[3,9];Y("build cart detail");return[4,F.checkoutSettings.buildCartDetail({countryCode:L.selectedCountryCode,currencyCode:L.targetCurrency})];case 7:s=f.sent();a=s.filter((function(e){return e.amount>=0}));u=s.filter((function(e){return e.amount<0}));Y("cartItems","info",{cartItems:s});i=u.map((function(e){return{amount:e.amount,currencyCode:e.currencyCode,description:e.name||e.description||"",productId:e.productId||null,sku:e.sku||null,type:"CART_TOTAL"}}));return[4,h({adjustments:i,cartItems:a})];case 8:f.sent();f.label=9;case 9:if(!!R.checkoutSessionId)return[3,11];return[4,p()];case 10:d=f.sent();Y("stripeStoreInitCheckoutSession: ".concat(d));if(!d){return[2,false]}f.label=11;case 11:if(!l.isStagingMode){void z()}return[4,this.applyStripeTheme()];case 12:f.sent();this.isRedirectAfterOrder=F.checkoutSettings.successBehavior==="REDIRECT_TO_SUCCESS_PAGE"||!!l.externalConfirmationPageURL;return[2,true]}}))}))};e.prototype.reloadCheckoutSession=function(){window.location.reload()};e.prototype.handleOrderDuplication=function(){var e=oe(localStorage.getItem("zonos--placed-order-info"));if(!e){localStorage.removeItem("zonos--placed-order-info");return}var o=Date.now()-e.time;Y("=== Existing placed order info: ".concat(e.orderId," - ").concat(this.formatDate(e.time)," - elapsed in hh:ss format: ").concat(new Date(o).toISOString().substring(11,8)),"warn");var t=parseFloat(new URLSearchParams(window.location.search).get("zonosOverrideExpiredDuplication")||"0")||Be;if(o>t){Y("=== Existing placed order info is older than ".concat(t,"ms, cleaning localStorage"),"warn");localStorage.removeItem("zonos--placed-order-info");return}this.placedOrderInfo=e;Y("=== Showing order duplication confirmation","warn")};e.prototype.recordCheckoutInfo=function(){if(!R.checkoutSessionId){return}void re({attributes:[{key:"APP_VERSION",value:window.Zonos.version},{key:"APP_VERSION_NPM_INTEGRATION",value:window.Zonos.isNpm?"1":"0"},{key:"LEGACY_CHECKOUT_FACADE",value:window.Zonos.isLegacyCheckout?"1":"0"}],checkoutSessionId:R.checkoutSessionId})};e.prototype.confirmProceedWithOrderDuplication=function(){this.placedOrderInfo=null;if(!R.checkoutSessionId){return}void re({attributes:[{key:"ORDER_DUPLICATION_CONSENT",value:"1"}],checkoutSessionId:R.checkoutSessionId})};e.prototype.markTheSessionAsAbandonedCart=function(){if(!R.checkoutSessionId){return}void re({attributes:[{key:"WITH_ABANDONED_CART_TOKEN",value:"1"}],checkoutSessionId:R.checkoutSessionId})};e.prototype.handleCancelOrderDuplication=function(){var e;this.placedOrderInfo=null;if(this.isLegacyCheckout){var o=((e=window.Zonos.cartData)===null||e===void 0?void 0:e.storeBaseUrl)||F.onlineStoreSettings.url;if(!o){return}if(window.parent){window.parent.location.href=o}window.location.href=o;return}void this.closeDialogHandler({confirmed:true})};e.prototype.attachCheckout=function(){var e=this;var o=F.checkoutSettings.placeOrderButtonSelector;var t=F.checkoutSettings.alwaysTriggerInternationalCheckoutSelector;Y("attach checkout ".concat(o));Y("attach checkout to always trigger international checkout selector: ".concat(t));if(!o&&!t&&!window.Zonos.cartData){return}var n=[o,t,"#".concat(ae),"#".concat(se),"#".concat(ce)].filter(Boolean);var r=document.querySelectorAll(n.join(","));r.forEach((function(n){var r=n.getAttribute("data-zonos-checkout-attached");if(r){return}Y("attached event to button ".concat(o),"info",{button:n});n.addEventListener("click",(function(o){return __awaiter(e,void 0,void 0,(function(){var e,r,i,s,c,u,d,h,f,v,m,p,z,y,_,C;return __generator(this,(function(x){switch(x.label){case 0:i=performance.now();s=t&&n.matches(t);c=n.matches("#".concat(ce));u=n.matches("#".concat(ae))||n.matches("#".concat(se));if(!window.Zonos.isLegacyCheckout&&(!ye()||be())&&!s&&!c&&!u){return[2]}o.preventDefault();o.stopPropagation();Y("zonos checkout button clicked");return[4,this.checkStripePaymentIntentStatus({triggeredButton:o.target})];case 1:d=x.sent().shouldAllowOrder;if(!d){return[2]}if(!window.Zonos.logIntervalId){window.Zonos.logIntervalId=setInterval((function(){void Se()}),2e3)}if(!Ee("hosted_vs_native"))return[3,4];this.isOverlayLoading=true;return[4,this.registerTestHostedVsNative()];case 2:x.sent();return[4,this.handleHostedVsNative()];case 3:h=x.sent().redirected;this.isOverlayLoading=false;if(h){return[2]}x.label=4;case 4:a.isFetchingSession=true;this.open=true;x.label=5;case 5:x.trys.push([5,8,,9]);return[4,this.buildCartAndInit()];case 6:f=x.sent();if(!f){throw new Error("Error building cart")}(e=window.opener)===null||e===void 0?void 0:e.postMessage({checkoutSessionId:R.checkoutSessionId,type:"zonos-checkout-session-update"},"*");g({isPreview:this.preview,sessionTimeout:Re});E("zonos-checkout-start");v=R.checkoutSessionId;void w({checkoutSessionId:v,eventName:"checkout_open"});return[4,ge()];case 7:m=x.sent().enabled;l.shouldHideDiscountInput=!m;this.handleOrderDuplication();if(window.Zonos.isLegacyCheckout){void Te()}else{p=performance.now();z=p-i;void Oe({loadTime:z})}this.recordCheckoutInfo();y=!!ue();if(y){this.markTheSessionAsAbandonedCart()}return[3,9];case 8:_=x.sent();if(_ instanceof Error){C=_.message;if(C==="Cart is expired."){this.isCartExpired=true}}a.isFetchingSession=false;q(_);if(this.isCartExpired){a.isFetchingSession=true;return[2]}void J({endpoint:"Error creating Checkout",errors:[_ instanceof Error?_.toString():"Unknown error"],metadata:{allLogs:X,cartId:window.Zonos.cartId,checkoutSessionBody:k(),href:window.location.href,storeBaseUrl:((r=window.Zonos.cartData)===null||r===void 0?void 0:r.storeBaseUrl)||F.onlineStoreSettings.url}});b({messages:[Z("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:Z("Error creating Checkout")});return[3,9];case 9:return[2]}}))}))}),{capture:true,passive:false});if(!F.checkoutSettings.disablePlaceOrderButtonActivation){n.removeAttribute("disabled")}n.setAttribute("data-zonos-checkout-attached","true");if(n.matches("#".concat(ae))){n.dispatchEvent(le("click"));s();n.remove()}if(n.matches("#".concat(se))){n.dispatchEvent(le("click"));n.remove()}}))};e.prototype.appearanceSettingsOverrideChanged=function(){if(!this.appearanceSettingsOverride){return}void this.applyStripeTheme()};e.prototype.useShippingDataFromCreateCartId=function(e){if(!e){return}Y("shipping data from createCartId result","info",Object.entries(e));var o=e.customerAddress1,t=e.customerAddress2,n=e.customerCity,r=e.customerCountry,i=e.customerEmail,s=e.customerFirstName,c=e.customerLastName,a=e.customerName,u=e.customerPhone,d=e.customerState,l=e.customerZip;var h=new URLSearchParams(window.location.search);var f=r||U(h)||L.selectedCountryCode;this.applyPrefillAddress({customerAddress1:o,customerAddress2:t,customerCity:n,customerCountry:f,customerEmail:i,customerFirstName:s,customerLastName:c,customerName:a,customerPhone:u,customerState:d,customerZip:l})};e.prototype.useLegacyQueryParams=function(){var e=new URLSearchParams(window.location.search);Y("legacy urlParams","info",Object.fromEntries(e.entries()));var o=function(o){var t=e.get(o);if(!t||t==="undefined"){return null}return t};var t=U(e)||L.selectedCountryCode;var n=o("customerCity");var r=o("customerEmail");var i=o("customerAddress1");var s=o("customerAddress2");var c=o("customerName");var a=o("customerPhone");var u=o("customerZip");var d=o("customerState");this.applyPrefillAddress({customerAddress1:i,customerAddress2:s,customerCity:n,customerCountry:t,customerEmail:r,customerName:c,customerPhone:a,customerState:d,customerZip:u})};e.prototype.applyPrefillAddress=function(e){var o=e.customerAddress1||"";var t=e.customerCountry||"";var n=e.customerAddress2||"";var r=e.customerCity||"";var i=e.customerEmail||"";var s=e.customerFirstName&&e.customerLastName?"".concat(e.customerFirstName," ").concat(e.customerLastName):e.customerName||"";var c=e.customerPhone||"";var a=e.customerZip||"";var u=e.customerState||"";if(!o||!s||!c||!t){Y("Missing required query params so it can not be prefilled","info",[!o&&"line1",!s&&"name",!c&&"phone",!t&&"country"].filter(Boolean).join(", "));return}if(t&&L.shippingZoneCountries&&!(t in L.shippingZoneCountries)){Y('Country "'.concat(t,'" is not in the shipping zone, so it can not be prefilled'),"warn");return}this.defaultAddressParams=[{address:{city:r||"",country:t,line1:o,line2:n,postal_code:a,state:u},email:i,name:s,phone:c}];Y("Prefill address applied","info",{prefillAddress:this.defaultAddressParams,providedAddress:e})};e.prototype.overrideStagingModeChanged=function(){l.isStagingMode=!!this.overrideStagingMode};e.prototype.init=function(){return __awaiter(this,void 0,void 0,(function(){var e;var o=this;return __generator(this,(function(t){a.stripe=window.Zonos.stripe;this.stripe=window.Zonos.stripe;l.isStagingMode=te();if(typeof this.overrideStagingMode!=="undefined"){l.isStagingMode=this.overrideStagingMode}_e({domesticRedirectedBtnSelector:ae,onShippingAddressSessionFound:function(e){o.defaultAddress=[{address:{city:e.city,country:e.countryCode,line1:e.address1,line2:e.address2,postal_code:e.postalCode,state:e.state},email:"",name:"".concat(e.firstName," ").concat(e.lastName),phone:e.phone}]}});if(window.Zonos){this.useLegacyQueryParams()}e=setInterval((function(){a.stripe=window.Zonos.stripe;o.stripe=window.Zonos.stripe;if(!o.stripe){Y("waiting for stripe to be loaded");return}if(o.storybookPaymentStatusOverride){clearInterval(e);return}Y("init checkout");if(o.preview||o.forceDialogOpen){void o.buildCartAndInit()}else if(window.Zonos.isLegacyCheckout){o.attachCheckout()}else if(window){o.attachCheckout();var t=new MutationObserver((function(){o.attachCheckout()}));t.observe(document.body,{childList:true,subtree:true})}clearInterval(e)}),50);setTimeout((function(){clearInterval(e)}),1e4);return[2]}))}))};e.prototype.setToFinishStep=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(o){l.step="finish";this.storybookPaymentStatusOverride=e;return[2]}))}))};e.prototype.mockCheckoutSession=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(o){y(e);return[2]}))}))};e.prototype.triggerCheckoutInternational=function(){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(o){e=document.querySelector("#".concat(ce));if(e){e.dispatchEvent(le("click"))}return[2]}))}))};e.prototype.handleCustomerInfoContinue=function(){return __awaiter(this,void 0,void 0,(function(){var e,o,t,n,r,i,s,c;var u=this;return __generator(this,(function(d){switch(d.label){case 0:E("zonos-checkout-customer-info");r=R.checkoutSessionId;void w({checkoutSessionId:r,eventName:"checkout_customerInfoCompleted"});this.submitLoading=true;return[4,_()];case 1:i=d.sent().isRequestNotReady;if(i&&l.addressFormRenderType==="stripe"){void J({endpoint:"ADDRESS_NOT_READY_AT_CUSTOMER_INFO_CONTINUE",errors:["Address not ready at customer info continue"],metadata:{address:(o=(e=a.stripeAddressEventData)===null||e===void 0?void 0:e.value)===null||o===void 0?void 0:o.address,billingAddress:(n=(t=a.stripeBillingAddressEventData)===null||t===void 0?void 0:t.value)===null||n===void 0?void 0:n.address,cartId:window.Zonos.cartId}})}s=function(e){if(l.step!=="customer-info"){clearInterval(e);return}if(!a.isFetchingLandedCost){if(l.landedCostData){void P({currency:l.currency});C()}u.submitLoading=false;if(e){clearInterval(e)}}};s();c=setInterval((function(){s(c)}),20);setTimeout((function(){clearInterval(c)}),1e4);return[2]}}))}))};e.prototype.handleShippingContinue=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){C();return[2]}))}))};e.prototype.handleInventoryCheckDialogConfirm=function(){l.inventoryCheckErrorMessage=null;if(!this.isLegacyCheckout){void this.closeDialogHandler({confirmed:true})}};e.prototype.handleCartExpiredDialogConfirm=function(){var e;this.isCartExpired=false;if(this.isLegacyCheckout){var o=(e=window.Zonos.cartData)===null||e===void 0?void 0:e.storeBaseUrl;if(!o){return}if(window.parent){window.parent.location.href=o}window.location.href=o;return}if(window.parent){window.parent.location.href=window.location.href}window.location.reload()};e.prototype.handleStripePaymentContinue=function(){return __awaiter(this,void 0,void 0,(function(){var e,o,t,n,r;return __generator(this,(function(i){switch(i.label){case 0:e=a.checkoutSettlementCurrency==="USD";if(e&&a.shouldRenderPayInUsdButton&&!this.payInUsdConfirmDialogOpen){this.payInUsdConfirmDialogOpen=true;return[2]}this.payInUsdConfirmDialogOpen=false;N.paypalErrorMessage=null;a.hasPaymentError=false;this.submitLoading=true;l.inventoryCheckErrorMessage=null;return[4,x()];case 1:o=i.sent();if(!o){a.hasPaymentError=true;a.customErrorMessage=Z("Unable to complete payment in [currency]. Please try again or select a different currency. If the issue persists, contact our support team for assistance.",{currency:a.checkoutSettlementCurrency});this.submitLoading=false;return[2]}i.label=2;case 2:i.trys.push([2,4,,5]);t=l;return[4,S()];case 3:t.inventoryCheckErrorMessage=i.sent();return[3,5];case 4:n=i.sent();l.inventoryCheckErrorMessage=Z("Unable to check inventory. Please try again.");return[3,5];case 5:if(l.inventoryCheckErrorMessage){this.submitLoading=false;return[2]}i.label=6;case 6:i.trys.push([6,8,,9]);return[4,T()];case 7:i.sent();C();m();return[3,9];case 8:r=i.sent();q(r);E("zonos-checkout-payment-fail");a.hasPaymentError=true;if(a.shouldInventoryRefund){void O();a.shouldInventoryRefund=false}return[3,9];case 9:this.submitLoading=false;return[2]}}))}))};e.prototype.handleFinishClick=function(){return __awaiter(this,void 0,void 0,(function(){var e,o,t,n;return __generator(this,(function(r){switch(r.label){case 0:A();if(!this.preview)return[3,2];l.step="customer-info";return[4,this.init()];case 1:r.sent();return[2];case 2:f();if(window.Zonos.isLegacyCheckout&&window.Zonos.cartData){e=window.Zonos.cartData.storeBaseUrl||F.onlineStoreSettings.url;if(window.parent){window.parent.location.href=e}window.location.href=e;return[2]}o=window.location.href;t=o.split("?")[0];this.open=false;n=window.location.hostname.includes("dashboard.zonos.com");if(!n){window.history.replaceState(window.history.state,document.title,t);window.location.reload()}return[2]}}))}))};e.prototype.handleWindowResize=function(){this.isMobile=ne(this.mobile);void this.applyStripeTheme();Y("mobile: ".concat(this.isMobile))};e.prototype.handleMobileChange=function(){this.isMobile=ne(this.mobile);void this.applyStripeTheme();Y("mobile: ".concat(this.isMobile))};e.prototype.handleAppearanceSettingsOverrideChange=function(){var e;if((e=this.appearanceSettingsOverride)===null||e===void 0?void 0:e.theme){this.appearanceSettingsOverride.theme=V(this.appearanceSettingsOverride.theme)}};e.prototype.handleAddressChange=function(){A()};e.prototype.handleCustomerProfileChange=function(){var e,o;if(!this.customerProfile){Y("No customer profile","info");this.defaultCustomerProfileAddress=[];return}Y("Customer profile found","info",{customerProfile:this.customerProfile});this.defaultCustomerProfileAddress=((o=(e=a.customerProfile)===null||e===void 0?void 0:e.locations)===null||o===void 0?void 0:o.map((function(e){var o;return{address:{city:e.locality,country:e.countryCode,line1:e.line1,line2:e.line2||"",postal_code:e.postalCode,state:e.administrativeArea},email:e.email||((o=a.customerProfile)===null||o===void 0?void 0:o.email)||"",name:e.name||"",phone:e.phone||""}})))||[]};e.prototype.handleClientSecretChange=function(){Y("==== Client secret changed","info",{clientSecret:this.clientSecret,stripeCustomerSessionClientSecret:this.stripeCustomerSessionClientSecret});void this.applyStripeTheme()};e.prototype.handleOpenChange=function(){var e="data-zonos-overflow-origin";var o=document.body;var t=document.documentElement;if(this.open){if(o.style.overflow){o.setAttribute(e,o.style.overflow)}o.style.overflow="hidden";if(t.style.overflow){t.setAttribute(e,t.style.overflow)}t.style.overflow="hidden"}else{this.stripeCustomerSessionClientSecret=null;var n=o.getAttribute(e);var r=t.getAttribute(e);if(n){o.removeAttribute(e);o.style.overflow=n}else{o.style.removeProperty("overflow")}if(r){t.removeAttribute(e);t.style.overflow=r}else{t.style.removeProperty("overflow")}}};e.prototype.componentWillLoad=function(){var e=this;void this.init();this.isMobile=ne(this.mobile);this.isIframed=window.self!==window.top;Y("iframed: ".concat(this.isIframed));if(window.Zonos.isLegacyCheckout){this.captureParamsRedirectedForVariantTest()}this.handleAppearanceSettingsOverrideChange();this.onChangeLocaleListener=M("selectedLocale",(function(){void e.applyStripeTheme()}));this.initializeTestKeys();window.addEventListener("message",this.handleHostedOpenWindowCallback);Y("mobile: ".concat(this.isMobile))};e.prototype.disconnectedCallback=function(){A();f();this.onChangeLocaleListener();window.removeEventListener("message",this.handleHostedOpenWindowCallback)};e.prototype.render=function(){var e=this;var o,i,s,c;this.customerProfile=a.customerProfile;this.clientSecret=a.clientSecret;if(a.stripeCustomerSessionClientSecret){this.stripeCustomerSessionClientSecret=a.stripeCustomerSessionClientSecret}var u=l.step!=="finish"&&l.step!=="error"&&!a.stripeElements||a.isFetchingSession;var d=G(F.appearance,this.appearanceSettingsOverride||null),h=d.colorPrimary,f=d.colorSecondary,v=d.logoUrl,m=d.style;var p=F.appearance.zonosAttribution==="ENABLED";var z=F.appearance.theme;var g=h&&fe(h)?"DARK":"LIGHT";var w=this.isMobile?z:g;var k=!this.isMobile?f:undefined;var b=L.customMessages;var y=(o=b.find((function(e){return e.pageName==="checkout_default"})))===null||o===void 0?void 0:o.message;var _=this.getCurrentLocalePageEnum();var C=b.filter((function(e){return e.pageName===_}));var x=this.getBaseCurrencySettlementInfo();var S=function(){var o=e.preview?"".concat(v,"?timestamp=").concat(Date.now()):v;return t("div",{class:"zonos--logo"},o&&t("img",{alt:"".concat(F.organizationName," logo"),src:o}))};var T=ee();var O=function(){var o=new URLSearchParams(window.location.search);var n=o.get("zonosQaUrl");var r=o.get("zonosDebug");var i=o.get("zonosE2ETest");var s=e.overrideStagingMode||te();return t("zonos-v-stack",null,t("div",{class:"zonos--logo-wrapper"},S(),T&&t("zonos-badge",{badgeColor:"orange",size:"small"},Z("Test mode")),s&&t("zonos-badge",{badgeColor:"red",size:"small"},Z("Staging mode")),r==="1"&&t("zonos-badge",{badgeColor:"cyan",size:"small"},"debug"),n&&t("zonos-badge",{badgeColor:"purple",size:"small"},n),i&&t("zonos-badge",{badgeColor:"gray",size:"small"},"E2E Test")),t("zonos-checkout-progress-tabs",{backgroundColor:e.isMobile?"--zonos-elements-gray-0":null}),C.map((function(e){return t("zonos-custom-message",{icon:Le,message:e.message})})))};var A=function(){if(l.checkoutSessionTimeoutShow){return t("zonos-rest-state",{class:"zonos--session-timeout",restStateSubtitle:Z("Your checkout session has expired. Please reload the page to continue."),restStateTitle:Z("Session timed out"),restStateType:"Warning"},t("zonos-button",{onClick:function(){return e.reloadCheckoutSession()},variant:"primary"},Z("Reload")))}return t("div",{class:"zonos--content",style:{"--zonos--border-radius":he({overrideBorderStyle:m})}},l.step!=="finish"&&l.step!=="error"&&t(r,null,t("div",{class:"zonos--left","data-theme":w,style:ve({"--zonos--primary-color":!e.isMobile?h:undefined})},!e.isMobile&&O(),l.step==="customer-info"&&t("zonos-customer-info",{continueLoading:e.submitLoading,defaultAddress:e.getDefaultAddress(),isMobile:e.isMobile,onContinueClicked:function(){return e.handleCustomerInfoContinue()},submitBtnColor:k}),l.step==="shipping"&&t("zonos-shipping",{continueLoading:e.submitLoading,onContinueClicked:function(){return e.handleShippingContinue()},submitBtnColor:k}),l.step==="payment"&&t("zonos-checkout-payment",{continueLoading:e.submitLoading,isMobile:e.isMobile,onContinueClicked:function(){return __awaiter(e,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:return[4,this.handleStripePaymentContinue()];case 1:e.sent();return[2]}}))}))},submitBtnColor:k})),t("div",{class:"zonos--right","data-theme":z},e.isMobile&&O(),t("div",{class:"zonos--right-actions"},window.Zonos.showBaseForeign&&t("zonos-currency-toggle",null),!e.isLegacyCheckout&&t("zonos-button",{class:"zonos--close-button",icon:t("zonos-icon",{"aria-label":"Close checkout dialog",content:me}),noBackground:true,onClick:function(){return e.closeDialogHandler()}})),t("div",{class:"flex--wrapper"},t("div",{class:"zonos--wrapper"},t("zonos-review",{collapsed:e.collapseReviewMobile,mobile:e.isMobile,onClick:function(){if(!e.isMobile){return}e.collapseReviewMobile=!e.collapseReviewMobile}}),t("zonos-collapse",{collapsed:e.collapseReviewMobile&&e.isMobile},t("zonos-cart-items",null),e.isMobile&&t("zonos-v-stack",{spacing:16},t("zonos-cart-subtotal",{submitBtnColor:k}),t("zonos-custom-message",{class:"zonos--checkout-default-message",icon:Le,message:y})))),t("zonos-cart-restricted-items",null),!e.isMobile&&t("zonos-v-stack",{spacing:16},t("zonos-cart-subtotal",null),t("zonos-custom-message",{class:"zonos--checkout-default-message",icon:Le,message:y}))))),(l.step==="finish"||l.step==="error")&&t("div",{class:"zonos--done","data-theme":z},t("div",{class:"zonos--header"},S(),!e.isRedirectAfterOrder&&t("zonos-button",{class:"zonos--close-button",icon:t("zonos-icon",{"aria-label":"Close checkout dialog",content:me}),noBackground:true,onClick:function(){return e.handleFinishClick()},theme:z})),t("zonos-checkout-finish",{borderRadius:m,onCloseClick:function(){return e.handleFinishClick()},overrideNotification:l.step==="error"&&!!l.error?Object.assign(Object.assign({},l.error),{type:"error"}):undefined,storybookForceStatus:e.storybookPaymentStatusOverride})),t("zonos-checkout-footer",{"data-theme":z,mobile:e.isMobile,slot:!e.isMobile?"dialog-footer":undefined}))};return t(n,{class:de(["zonos--checkout zonos--elements",p&&"has-footer",this.preview&&"preview",this.isMobile&&"mobile",this.isIframed&&"iframed",this.hiddenMode&&"hidden-mode"])},this.preview?A():t("zonos-dialog",{borderStyle:m,"data-theme":z,height:"980px",isLoading:u,mobile:this.isMobile,noBodyPadding:true,noBorder:true,noClickOutside:true,noCloseButton:true,onCloseDialog:function(){return e.closeDialogHandler()},open:this.open,width:"1200px"},A()),t("zonos-confirm-dialog",{class:"zonos--close-confirm-dialog",dialogCancelBtnText:Z("Don't close"),dialogConfirmBtnText:Z("Close"),dialogIntent:"warn",dialogOpen:this.confirmDialogOpen,dialogSubtitle:Z("Would you like to close checkout and return to the site?"),dialogTitle:Z("Are you sure?"),onCancelClicked:function(){e.confirmDialogOpen=false},onConfirmClicked:function(){return e.closeDialogHandler({confirmed:true})}}),t("zonos-confirm-dialog",{class:"zonos--order-duplication-dialog",dialogCancelBtnText:Z("Return to merchant site"),dialogConfirmBtnText:Z("Proceed with order"),dialogIntent:"warn",dialogOpen:!!this.placedOrderInfo,dialogSubtitle:((i=this.placedOrderInfo)===null||i===void 0?void 0:i.zonosOrderNumber)?Z("It looks like you placed an order recently ([date] at [time]) under order number #[orderNumber]. Check your email for the order confirmation. Are you sure you want to place another order?",{date:this.formatDate(this.placedOrderInfo.time),orderNumber:this.placedOrderInfo.zonosOrderNumber,time:this.formatTime(this.placedOrderInfo.time)}):Z("It looks like you placed an order recently ([date] at [time]). Check your email for the order confirmation. Are you sure you want to place another one?",{date:this.formatDate(((s=this.placedOrderInfo)===null||s===void 0?void 0:s.time)||null),time:this.formatTime(((c=this.placedOrderInfo)===null||c===void 0?void 0:c.time)||null)}),dialogTitle:Z("Are you sure?"),dialogWidth:530,onCancelClicked:function(){e.handleCancelOrderDuplication()},onConfirmClicked:function(){e.confirmProceedWithOrderDuplication()}}),t("zonos-confirm-dialog",{class:"zonos--inventory-check-failure-dialog",dialogConfirmBtnText:Z("Return to cart"),dialogIntent:"danger",dialogOpen:!!l.inventoryCheckErrorMessage,dialogSubtitle:l.inventoryCheckErrorMessage,dialogTitle:Z("Couldn't place order"),dialogType:"alert",onConfirmClicked:function(){return e.handleInventoryCheckDialogConfirm()}}),x&&t("zonos-confirm-dialog",{class:"zonos--pay-in-usd-dialog",dialogCancelBtnText:Z("Cancel"),dialogConfirmBtnText:Z("Pay [orderTotal]",{orderTotal:K({amount:x.settlementAmount,currency:"USD"})}),dialogIntent:"warn",dialogOpen:this.payInUsdConfirmDialogOpen,dialogSubtitle:Z("By paying in USD, your card will be charged directly with no currency conversion. However, using a non-USD based card may result in additional currency conversion fees at the bank level."),dialogTitle:Z("Pay in USD (United States Dollar)?"),dialogType:"confirm",dialogWidth:480,onCancelClicked:function(){e.payInUsdConfirmDialogOpen=false},onConfirmClicked:function(){return e.handleStripePaymentContinue()}}),t("zonos-confirm-dialog",{class:"zonos--shopping-cart-expired-dialog",dialogConfirmBtnText:Z("OK"),dialogIntent:"danger",dialogOpen:this.isCartExpired,dialogSubtitle:Z("You are being sent back to the shop to re-add items to your cart."),dialogTitle:Z("Shopping cart expired"),dialogType:"alert",onConfirmClicked:function(){return e.handleCartExpiredDialogConfirm()}}),t("zonos-loading-overlay",{open:this.isOverlayLoading}))};Object.defineProperty(e,"assetsDirs",{get:function(){return["assets"]},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{appearanceSettingsOverride:["appearanceSettingsOverrideChanged","handleAppearanceSettingsOverrideChange"],overrideStagingMode:["overrideStagingModeChanged"],mobile:["handleMobileChange"],defaultAddress:["handleAddressChange"],customerProfile:["handleCustomerProfileChange"],clientSecret:["handleClientSecretChange"],stripeCustomerSessionClientSecret:["handleClientSecretChange"],open:["handleOpenChange"]}},enumerable:false,configurable:true});return e}());He.style=Ue}}}));
@@ -1 +0,0 @@
1
- var __awaiter=this&&this.__awaiter||function(t,n,e,r){function i(t){return t instanceof e?t:new e((function(n){n(t)}))}return new(e||(e=Promise))((function(e,u){function o(t){try{c(r.next(t))}catch(t){u(t)}}function a(t){try{c(r["throw"](t))}catch(t){u(t)}}function c(t){t.done?e(t.value):i(t.value).then(o,a)}c((r=r.apply(t,n||[])).next())}))};var __generator=this&&this.__generator||function(t,n){var e={label:0,sent:function(){if(u[0]&1)throw u[1];return u[1]},trys:[],ops:[]},r,i,u,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(t){return function(n){return c([t,n])}}function c(a){if(r)throw new TypeError("Generator is already executing.");while(o&&(o=0,a[0]&&(e=0)),e)try{if(r=1,i&&(u=a[0]&2?i["return"]:a[0]?i["throw"]||((u=i["return"])&&u.call(i),0):i.next)&&!(u=u.call(i,a[1])).done)return u;if(i=0,u)a=[a[0]&2,u.value];switch(a[0]){case 0:case 1:u=a;break;case 4:e.label++;return{value:a[1],done:false};case 5:e.label++;i=a[1];a=[0];continue;case 7:a=e.ops.pop();e.trys.pop();continue;default:if(!(u=e.trys,u=u.length>0&&u[u.length-1])&&(a[0]===6||a[0]===2)){e=0;continue}if(a[0]===3&&(!u||a[1]>u[0]&&a[1]<u[3])){e.label=a[1];break}if(a[0]===6&&e.label<u[1]){e.label=u[1];u=a;break}if(u&&e.label<u[2]){e.label=u[2];e.ops.push(a);break}if(u[2])e.ops.pop();e.trys.pop();continue}a=n.call(t,e)}catch(t){a=[6,t];i=0}finally{r=u=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};System.register(["./p-4a1b4a2d.system.js","./p-a411ce2a.system.js"],(function(t){"use strict";var n,e,r;return{setters:[function(t){n=t.d},function(t){e=t.h;r=t.b}],execute:function(){var i=this;var u={};var o={};var a=function(t){return n((function(){return __awaiter(i,void 0,void 0,(function(){var n,i,o,a,c,s;return __generator(this,(function(f){switch(f.label){case 0:o=Array.from(((n=u[t])===null||n===void 0?void 0:n.entries())||[]).map((function(t){var n=t[0],e=t[1];return{key:n,value:e}}));return[4,e("/api/zonos-elements/update-checkout-session-attributes",{body:{attributes:o,id:t},method:"POST"})];case 1:a=f.sent(),c=a.errors,s=a.json;if(c.length){r("Error updating checkout session attributes",c);return[2,{success:false}]}(i=u[t])===null||i===void 0?void 0:i.clear();return[2,{success:!!(s===null||s===void 0?void 0:s.success)}]}}))}))}),1e3,{maxWait:5e3})};var c=t("u",(function(t){return __awaiter(i,[t],void 0,(function(t){var n=t.attributes,e=t.checkoutSessionId;return __generator(this,(function(t){u[e]||(u[e]=new Map);n.forEach((function(t){var n;if(t.value){(n=u[e])===null||n===void 0?void 0:n.set(t.key,t.value)}}));if(!n.length){return[2]}if(!o[e]){o[e]=a(e)}return[2,o[e]()]}))}))}))}}}));