@zonos/elements 1.3.50 → 1.3.52

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 (208) hide show
  1. package/dist/cjs/CheckoutConfig-65376e00.js +40 -0
  2. package/dist/cjs/{cart-688d674d.js → cart-61a8983d.js} +238 -370
  3. package/dist/cjs/{createCustomEvent-01bacaea.js → createCustomEvent-228027b5.js} +3 -2
  4. package/dist/cjs/handleFetch-842c95b0.js +322 -0
  5. package/dist/cjs/index.cjs.js +75 -35
  6. package/dist/cjs/loader.cjs.js +1 -1
  7. package/dist/cjs/{paypal-ce1516ba.js → paypal-f1eb6621.js} +16 -16
  8. package/dist/cjs/zonos-address_8.cjs.entry.js +4 -4
  9. package/dist/cjs/{zonos-cart-items_12.cjs.entry.js → zonos-badge_13.cjs.entry.js} +41 -9
  10. package/dist/cjs/zonos-checkout.cjs.entry.js +75 -174
  11. package/dist/cjs/zonos-controller.cjs.entry.js +27 -25
  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-hello-dialog.cjs.entry.js +2 -2
  16. package/dist/cjs/zonos-hello.cjs.entry.js +11 -11
  17. package/dist/cjs/zonos-language-select_2.cjs.entry.js +2 -2
  18. package/dist/cjs/zonos-notification_3.cjs.entry.js +9 -9
  19. package/dist/cjs/zonos-tooltip.cjs.entry.js +27 -0
  20. package/dist/collection/components/checkout/zonos-checkout/zonos-cart-subtotal/zonos-cart-subtotal.js +5 -2
  21. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +44 -20
  22. package/dist/collection/components/store/checkout/cart.js +14 -2
  23. package/dist/collection/components/store/checkout/stripe.js +9 -4
  24. package/dist/collection/components/store/translationStore/strings.arabic.js +3 -3
  25. package/dist/collection/components/store/translationStore/strings.base.js +3 -3
  26. package/dist/collection/components/store/translationStore/strings.chinese.js +3 -3
  27. package/dist/collection/components/store/translationStore/strings.danish.js +3 -3
  28. package/dist/collection/components/store/translationStore/strings.dutch.js +3 -3
  29. package/dist/collection/components/store/translationStore/strings.french.js +3 -3
  30. package/dist/collection/components/store/translationStore/strings.german.js +3 -3
  31. package/dist/collection/components/store/translationStore/strings.hebrew.js +3 -3
  32. package/dist/collection/components/store/translationStore/strings.indonesian.js +3 -3
  33. package/dist/collection/components/store/translationStore/strings.italian.js +3 -3
  34. package/dist/collection/components/store/translationStore/strings.japanese.js +3 -3
  35. package/dist/collection/components/store/translationStore/strings.korean.js +3 -3
  36. package/dist/collection/components/store/translationStore/strings.norwegian.js +3 -3
  37. package/dist/collection/components/store/translationStore/strings.polish.js +3 -3
  38. package/dist/collection/components/store/translationStore/strings.portuguese.js +3 -3
  39. package/dist/collection/components/store/translationStore/strings.russian.js +3 -3
  40. package/dist/collection/components/store/translationStore/strings.spanish.js +3 -3
  41. package/dist/collection/components/store/translationStore/strings.swedish.js +3 -3
  42. package/dist/collection/components/store/translationStore/strings.turkish.js +3 -3
  43. package/dist/collection/components/store/translationStore/strings.vietnamese.js +3 -3
  44. package/dist/collection/components/utils/api/buildCartItemsByTempCart.js +14 -14
  45. package/dist/collection/components/utils/api/calculateLandedCostNormalized.js +28 -0
  46. package/dist/collection/components/utils/api/cartCalculateLandedCost.js +19 -0
  47. package/dist/collection/components/utils/api/prepCalculateLandedCost.js +65 -0
  48. package/dist/collection/components/utils/api/triggerBuildLandedCost.js +2 -2
  49. package/dist/collection/components/utils/checkout/initCheckout.js +4 -2
  50. package/dist/collection/components/utils/handleFetch.js +6 -1
  51. package/dist/collection/environment.js +1 -1
  52. package/dist/collection/scripts/_getNextFallbackUrl.js +1 -0
  53. package/dist/collection/scripts/_getTempCartById.js +14 -0
  54. package/dist/collection/scripts/_zonosBase.js +39 -10
  55. package/dist/collection/scripts/cart/_getCartIdFromParam.js +9 -0
  56. package/dist/collection/scripts/cart/_setupCartData.js +18 -0
  57. package/dist/collection/types/checkout/CheckoutConfig.js +2 -1
  58. package/dist/collection/types/generated/graphql.customer.types.js +12 -0
  59. package/dist/collection/utils/formattedCloudflareApiUrl.js +8 -2
  60. package/dist/collection/utils/generateCloudflareDeployUrl.js +3 -0
  61. package/dist/esm/CheckoutConfig-57350b28.js +36 -0
  62. package/dist/esm/{cart-4f300fcb.js → cart-45d2861f.js} +194 -323
  63. package/dist/esm/{createCustomEvent-c5ed9070.js → createCustomEvent-3fcc948a.js} +2 -1
  64. package/dist/esm/handleFetch-37cea185.js +315 -0
  65. package/dist/esm/index.js +56 -17
  66. package/dist/esm/loader.js +1 -1
  67. package/dist/esm/{paypal-70caf283.js → paypal-ee310945.js} +2 -2
  68. package/dist/esm/zonos-address_8.entry.js +2 -2
  69. package/dist/esm/{zonos-cart-items_12.entry.js → zonos-badge_13.entry.js} +40 -9
  70. package/dist/esm/zonos-checkout.entry.js +61 -160
  71. package/dist/esm/zonos-controller.entry.js +6 -4
  72. package/dist/esm/zonos-country-flag.entry.js +2 -2
  73. package/dist/esm/zonos-country-select_4.entry.js +2 -2
  74. package/dist/esm/zonos-elements.js +1 -1
  75. package/dist/esm/zonos-hello-dialog.entry.js +2 -2
  76. package/dist/esm/zonos-hello.entry.js +2 -2
  77. package/dist/esm/zonos-language-select_2.entry.js +2 -2
  78. package/dist/esm/zonos-notification_3.entry.js +3 -3
  79. package/dist/esm/zonos-tooltip.entry.js +23 -0
  80. package/dist/esm-es5/CheckoutConfig-57350b28.js +1 -0
  81. package/dist/esm-es5/cart-45d2861f.js +1 -0
  82. package/dist/esm-es5/{createCustomEvent-c5ed9070.js → createCustomEvent-3fcc948a.js} +1 -1
  83. package/dist/esm-es5/handleFetch-37cea185.js +1 -0
  84. package/dist/esm-es5/index.js +1 -1
  85. package/dist/esm-es5/loader.js +1 -1
  86. package/dist/esm-es5/{paypal-70caf283.js → paypal-ee310945.js} +1 -1
  87. package/dist/esm-es5/zonos-address_8.entry.js +1 -1
  88. package/dist/esm-es5/zonos-badge_13.entry.js +1 -0
  89. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  90. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  91. package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
  92. package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
  93. package/dist/esm-es5/zonos-elements.js +1 -1
  94. package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
  95. package/dist/esm-es5/zonos-hello.entry.js +1 -1
  96. package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
  97. package/dist/esm-es5/zonos-notification_3.entry.js +1 -1
  98. package/dist/esm-es5/zonos-tooltip.entry.js +1 -0
  99. package/dist/scripts/index.d.ts +74 -87
  100. package/dist/scripts/index.js +1 -1
  101. package/dist/scripts/loadZonos.js +1 -1
  102. package/dist/scripts/zonos.js +1 -1
  103. package/dist/types/components/checkout/zonos-checkout/zonos-checkout.d.ts +0 -2
  104. package/dist/types/components/store/checkout/cart.d.ts +13 -3
  105. package/dist/types/components/store/checkout/stripe.d.ts +3 -1
  106. package/dist/types/components/store/translationStore/strings.arabic.d.ts +3 -3
  107. package/dist/types/components/store/translationStore/strings.base.d.ts +3 -3
  108. package/dist/types/components/store/translationStore/strings.chinese.d.ts +3 -3
  109. package/dist/types/components/store/translationStore/strings.danish.d.ts +3 -3
  110. package/dist/types/components/store/translationStore/strings.dutch.d.ts +3 -3
  111. package/dist/types/components/store/translationStore/strings.french.d.ts +3 -3
  112. package/dist/types/components/store/translationStore/strings.german.d.ts +3 -3
  113. package/dist/types/components/store/translationStore/strings.hebrew.d.ts +3 -3
  114. package/dist/types/components/store/translationStore/strings.indonesian.d.ts +3 -3
  115. package/dist/types/components/store/translationStore/strings.italian.d.ts +3 -3
  116. package/dist/types/components/store/translationStore/strings.japanese.d.ts +3 -3
  117. package/dist/types/components/store/translationStore/strings.korean.d.ts +3 -3
  118. package/dist/types/components/store/translationStore/strings.norwegian.d.ts +3 -3
  119. package/dist/types/components/store/translationStore/strings.polish.d.ts +3 -3
  120. package/dist/types/components/store/translationStore/strings.portuguese.d.ts +3 -3
  121. package/dist/types/components/store/translationStore/strings.russian.d.ts +3 -3
  122. package/dist/types/components/store/translationStore/strings.spanish.d.ts +3 -3
  123. package/dist/types/components/store/translationStore/strings.swedish.d.ts +3 -3
  124. package/dist/types/components/store/translationStore/strings.turkish.d.ts +3 -3
  125. package/dist/types/components/store/translationStore/strings.vietnamese.d.ts +3 -3
  126. package/dist/types/components/store/translationStore.d.ts +1 -1
  127. package/dist/types/components/utils/api/buildCartItemsByTempCart.d.ts +8 -3
  128. package/dist/types/components/utils/api/calculateLandedCostNormalized.d.ts +2 -0
  129. package/dist/types/components/utils/api/cartCalculateLandedCost.d.ts +5 -0
  130. package/dist/types/components/utils/api/prepCalculateLandedCost.d.ts +5 -1
  131. package/dist/types/components/utils/checkout/getIsTestMode.d.ts +1 -1
  132. package/dist/types/scripts/_getNextFallbackUrl.d.ts +1 -0
  133. package/dist/types/scripts/_getTempCartById.d.ts +8 -0
  134. package/dist/types/scripts/_zonosBase.d.ts +15 -12
  135. package/dist/types/scripts/cart/_getCartIdFromParam.d.ts +4 -0
  136. package/dist/types/scripts/cart/_setupCartData.d.ts +7 -0
  137. package/dist/types/types/checkout/CheckoutConfig.d.ts +18 -3
  138. package/dist/types/types/checkout/api/CalculateLandedCostRequest.d.ts +42 -1
  139. package/dist/types/types/checkout/api/NormalizedTempCart.d.ts +37 -0
  140. package/dist/types/types/generated/graphql.customer.types.d.ts +249 -2
  141. package/dist/types/types/generated/graphql.customer.types.ts +251 -3
  142. package/dist/types/utils/formattedCloudflareApiUrl.d.ts +2 -2
  143. package/dist/zonos-elements/index.esm.js +1 -1
  144. package/dist/zonos-elements/p-042c466d.system.entry.js +1 -0
  145. package/dist/zonos-elements/p-10cb0064.entry.js +1 -0
  146. package/dist/zonos-elements/{p-fe198a6c.entry.js → p-259ccf8d.entry.js} +1 -1
  147. package/dist/zonos-elements/p-2a47d2cc.system.entry.js +1 -0
  148. package/dist/zonos-elements/{p-89b1f4a5.entry.js → p-31eb835c.entry.js} +1 -1
  149. package/dist/zonos-elements/{p-4849604d.entry.js → p-36360905.entry.js} +1 -1
  150. package/dist/zonos-elements/{p-322600aa.system.entry.js → p-3703b814.system.entry.js} +1 -1
  151. package/dist/zonos-elements/p-4146feec.js +1 -0
  152. package/dist/zonos-elements/p-446c8f02.system.entry.js +1 -0
  153. package/dist/zonos-elements/{p-31905b60.system.js → p-5590f90c.system.js} +1 -1
  154. package/dist/zonos-elements/p-588396df.js +1 -0
  155. package/dist/zonos-elements/{p-124e3426.js → p-6e59c6e4.js} +2 -2
  156. package/dist/zonos-elements/p-6eedc3f8.entry.js +1 -0
  157. package/dist/zonos-elements/p-747eed39.entry.js +1 -0
  158. package/dist/zonos-elements/{p-d1cd0a5f.system.entry.js → p-8228e87c.system.entry.js} +1 -1
  159. package/dist/zonos-elements/p-827868e6.entry.js +1 -0
  160. package/dist/zonos-elements/{p-a67578ae.entry.js → p-88005b94.entry.js} +1 -1
  161. package/dist/zonos-elements/p-895fdefb.js +1 -0
  162. package/dist/zonos-elements/p-8f7773b0.system.js +1 -0
  163. package/dist/zonos-elements/{p-480a6094.entry.js → p-8fa49d94.entry.js} +1 -1
  164. package/dist/zonos-elements/p-a74a7afa.system.js +1 -0
  165. package/dist/zonos-elements/p-b1861e64.system.js +1 -0
  166. package/dist/zonos-elements/{p-ec31cd17.system.entry.js → p-b842b96a.system.entry.js} +1 -1
  167. package/dist/zonos-elements/{p-1719bedd.entry.js → p-bb186075.entry.js} +1 -1
  168. package/dist/zonos-elements/{p-8af4a9e7.system.entry.js → p-c008648a.system.entry.js} +1 -1
  169. package/dist/zonos-elements/p-c78dd680.system.js +1 -1
  170. package/dist/zonos-elements/{p-22e8d4ad.system.entry.js → p-cd4ad1be.system.entry.js} +1 -1
  171. package/dist/zonos-elements/{p-e7e73693.system.entry.js → p-d62e6bb0.system.entry.js} +1 -1
  172. package/dist/zonos-elements/{p-40d52dd6.system.entry.js → p-dc12f30a.system.entry.js} +1 -1
  173. package/dist/zonos-elements/p-eb2aedd0.js +1 -0
  174. package/dist/zonos-elements/{p-ceb8b836.system.js → p-f124e459.system.js} +2 -2
  175. package/dist/zonos-elements/p-f527cd5b.entry.js +1 -0
  176. package/dist/zonos-elements/p-f826b979.system.entry.js +1 -0
  177. package/dist/zonos-elements/p-f87a635b.system.js +1 -0
  178. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  179. package/package.json +2 -1
  180. package/dist/cjs/logError-4e2f2020.js +0 -58
  181. package/dist/cjs/zonos-badge_2.cjs.entry.js +0 -57
  182. package/dist/collection/components/utils/api/tempCartItem/getAttributes.js +0 -66
  183. package/dist/collection/components/utils/api/tempCartItem/getMeasurements.js +0 -58
  184. package/dist/esm/logError-c456c092.js +0 -55
  185. package/dist/esm/zonos-badge_2.entry.js +0 -52
  186. package/dist/esm-es5/cart-4f300fcb.js +0 -1
  187. package/dist/esm-es5/logError-c456c092.js +0 -1
  188. package/dist/esm-es5/zonos-badge_2.entry.js +0 -1
  189. package/dist/esm-es5/zonos-cart-items_12.entry.js +0 -1
  190. package/dist/types/components/utils/api/tempCartItem/getAttributes.d.ts +0 -11
  191. package/dist/types/components/utils/api/tempCartItem/getMeasurements.d.ts +0 -7
  192. package/dist/types/types/checkout/api/TempCart.d.ts +0 -80
  193. package/dist/zonos-elements/p-00f219bd.entry.js +0 -1
  194. package/dist/zonos-elements/p-05dff37f.js +0 -1
  195. package/dist/zonos-elements/p-1f2db2ff.entry.js +0 -1
  196. package/dist/zonos-elements/p-2018969a.js +0 -1
  197. package/dist/zonos-elements/p-27f2e8af.system.entry.js +0 -1
  198. package/dist/zonos-elements/p-4452dddc.entry.js +0 -1
  199. package/dist/zonos-elements/p-47c72c50.system.entry.js +0 -1
  200. package/dist/zonos-elements/p-595d406e.entry.js +0 -1
  201. package/dist/zonos-elements/p-5beccdce.system.entry.js +0 -1
  202. package/dist/zonos-elements/p-6013e370.entry.js +0 -1
  203. package/dist/zonos-elements/p-63db40b9.system.js +0 -1
  204. package/dist/zonos-elements/p-6ab615e6.system.js +0 -1
  205. package/dist/zonos-elements/p-81540fd6.system.js +0 -1
  206. package/dist/zonos-elements/p-d709ad28.system.entry.js +0 -1
  207. package/dist/zonos-elements/p-eaa335e1.js +0 -1
  208. /package/dist/collection/types/checkout/api/{TempCart.js → NormalizedTempCart.js} +0 -0
@@ -1 +1 @@
1
- import{r as registerInstance,h,H as Host}from"./index-86b8247e.js";import{N as localizationStoreUpdateSelectedLocale,t as translate,l as localizationStore}from"./cart-4f300fcb.js";import{d as zonosStoreFontFamily}from"./zonosStore-473f4654.js";import{l as languages}from"./ILanguage-cd6acb72.js";import"./logError-c456c092.js";import"./isDarkColor-c927f77d.js";import"./getBorderRadius-23398fc6.js";var GreenCheckDuotoneIcon='<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M7.99996 2.6665C5.05444 2.6665 2.66663 5.05432 2.66663 7.99984C2.66663 10.9454 5.05444 13.3332 7.99996 13.3332C10.9455 13.3332 13.3333 10.9454 13.3333 7.99984C13.3333 5.05432 10.9455 2.6665 7.99996 2.6665Z" fill="#AFF8C3"/>\n<path fill-rule="evenodd" clip-rule="evenodd" d="M10.1403 6.10535C10.3582 6.27488 10.3975 6.58902 10.228 6.80699L8.01055 9.65797C7.76436 9.97449 7.29646 10.0036 7.01291 9.72008L5.81307 8.52024C5.61781 8.32498 5.61781 8.0084 5.81307 7.81314C6.00833 7.61787 6.32492 7.61787 6.52018 7.81314L7.45301 8.74597L9.43862 6.19305C9.60815 5.97508 9.92229 5.93581 10.1403 6.10535Z" fill="#246627"/>\n</svg>\n';var zonosLanguageSelectCss=":host{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host .zonos--language-select{width:100%}:host .zonos--language-select .zonos--language-select-content{display:grid;grid-template-columns:repeat(3, minmax(-webkit-max-content, 1fr));grid-template-columns:repeat(3, minmax(max-content, 1fr));padding:16px;padding-top:0px}:host .zonos--language-select .zonos--language-select-content .zonos--language-select-button{display:-ms-flexbox;display:flex;padding:8px;gap:4px;-ms-flex-align:center;align-items:center;border-radius:var(--zonos-elements-radius-4);cursor:pointer;width:100%;border:none;background:none}:host .zonos--language-select .zonos--language-select-content .zonos--language-select-button:hover{background:var(--zonos-elements-gray-100)}@media (max-width: 400px){:host .zonos--language-select .zonos--language-select-content{grid-template-columns:1fr 1fr}}";var ZonosLanguageSelectStyle0=zonosLanguageSelectCss;var ZonosLanguageSelect=function(){function e(e){var o=this;registerInstance(this,e);this.languageSelected=function(e){void localizationStoreUpdateSelectedLocale(e);o.handleOnClose()};this.handleOnClose=function(){}}e.prototype.render=function(){var e=this;var o=localizationStore.selectedLocale;return h(Host,{key:"448f89b5870956b6e9455968134b94c9409a983d",class:"zonos--elements",style:{"--font-family":zonosStoreFontFamily()}},h("div",{key:"23841aa801d68da4b537cfaab5ea89405ec66a9f",class:"zonos--language-select"},h("zonos-select-dialog-header",{key:"5fc1b45aa0cb27c94163c2dace5ce4ad63215dfc",handleOnClose:function(){return e.handleOnClose()},label:translate("Select a language")}),h("div",{key:"7030fb276a05eea0e7333add3219b5316495662c",class:"zonos--language-select-content"},languages.map((function(t){return h("button",{class:"zonos--language-select-button",onClick:function(){return e.languageSelected(t.code)}},h("zonos-text",{textColor:"gray-800"},t.translatedLabel),t.code===o&&h("zonos-icon",{content:GreenCheckDuotoneIcon,size:16}))})))))};return e}();ZonosLanguageSelect.style=ZonosLanguageSelectStyle0;var RemoveIcon='<svg xmlns="https://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path fill="#C5C6CA" fill-rule="evenodd" d="M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Z" clip-rule="evenodd"/><path fill="#4D505A" fill-rule="evenodd" d="M8.293 8.293a1 1 0 0 1 1.414 0L12 10.586l2.293-2.293a1 1 0 1 1 1.414 1.414L13.414 12l2.293 2.293a1 1 0 0 1-1.414 1.414L12 13.414l-2.293 2.293a1 1 0 0 1-1.414-1.414L10.586 12 8.293 9.707a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"/></svg>';var zonosSelectDialogHeaderCss=":host{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host .zonos--select-dialog-header-wrapper{position:-webkit-sticky;position:sticky;top:0;background:var(--zonos-elements-surface-color);padding:16px}:host .zonos--select-dialog-header-wrapper .zonos--select-dialog-header{position:relative;-ms-flex-pack:justify;justify-content:space-between;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}";var ZonosSelectDialogHeaderStyle0=zonosSelectDialogHeaderCss;var ZonosSelectDialogHeader=function(){function e(e){registerInstance(this,e);this.handleOnClose=function(){};this.label=""}e.prototype.render=function(){var e=this;return h(Host,{key:"8ac4e1bcd64f6a2073e1161fec76c9b117345ada",class:"zonos--elements",style:{"--font-family":zonosStoreFontFamily()}},h("zonos-v-stack",{key:"fe4a184a8bed7aceb4c3f8d341fed50380587c77",class:"zonos--select-dialog-header-wrapper",spacing:8},h("div",{key:"2176069a11ba20c7408ef898044f2ba68eea4a80",class:"zonos--select-dialog-header"},h("zonos-text",{key:"45b9d890484881a15c4fa7a7e4028f9887cc942e",type:"boldLabel"},this.label),h("zonos-button",{key:"65f0d9ea7b6dee35d23aa6fca19fd686190b667f",class:"zonos--close-button",icon:h("zonos-icon",{"aria-label":"Close select dialog",content:RemoveIcon,size:20}),noBackground:true,onClick:function(){return e.handleOnClose()}})),h("slot",{key:"758fce95d668ad755745687d3fcf1a6a307061bc"})))};return e}();ZonosSelectDialogHeader.style=ZonosSelectDialogHeaderStyle0;export{ZonosLanguageSelect as zonos_language_select,ZonosSelectDialogHeader as zonos_select_dialog_header};
1
+ import{r as registerInstance,h,H as Host}from"./index-86b8247e.js";import{K as localizationStoreUpdateSelectedLocale,t as translate,l as localizationStore}from"./cart-45d2861f.js";import{d as zonosStoreFontFamily}from"./zonosStore-473f4654.js";import{l as languages}from"./ILanguage-cd6acb72.js";import"./handleFetch-37cea185.js";import"./isDarkColor-c927f77d.js";import"./getBorderRadius-23398fc6.js";var GreenCheckDuotoneIcon='<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M7.99996 2.6665C5.05444 2.6665 2.66663 5.05432 2.66663 7.99984C2.66663 10.9454 5.05444 13.3332 7.99996 13.3332C10.9455 13.3332 13.3333 10.9454 13.3333 7.99984C13.3333 5.05432 10.9455 2.6665 7.99996 2.6665Z" fill="#AFF8C3"/>\n<path fill-rule="evenodd" clip-rule="evenodd" d="M10.1403 6.10535C10.3582 6.27488 10.3975 6.58902 10.228 6.80699L8.01055 9.65797C7.76436 9.97449 7.29646 10.0036 7.01291 9.72008L5.81307 8.52024C5.61781 8.32498 5.61781 8.0084 5.81307 7.81314C6.00833 7.61787 6.32492 7.61787 6.52018 7.81314L7.45301 8.74597L9.43862 6.19305C9.60815 5.97508 9.92229 5.93581 10.1403 6.10535Z" fill="#246627"/>\n</svg>\n';var zonosLanguageSelectCss=":host{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host .zonos--language-select{width:100%}:host .zonos--language-select .zonos--language-select-content{display:grid;grid-template-columns:repeat(3, minmax(-webkit-max-content, 1fr));grid-template-columns:repeat(3, minmax(max-content, 1fr));padding:16px;padding-top:0px}:host .zonos--language-select .zonos--language-select-content .zonos--language-select-button{display:-ms-flexbox;display:flex;padding:8px;gap:4px;-ms-flex-align:center;align-items:center;border-radius:var(--zonos-elements-radius-4);cursor:pointer;width:100%;border:none;background:none}:host .zonos--language-select .zonos--language-select-content .zonos--language-select-button:hover{background:var(--zonos-elements-gray-100)}@media (max-width: 400px){:host .zonos--language-select .zonos--language-select-content{grid-template-columns:1fr 1fr}}";var ZonosLanguageSelectStyle0=zonosLanguageSelectCss;var ZonosLanguageSelect=function(){function e(e){var o=this;registerInstance(this,e);this.languageSelected=function(e){void localizationStoreUpdateSelectedLocale(e);o.handleOnClose()};this.handleOnClose=function(){}}e.prototype.render=function(){var e=this;var o=localizationStore.selectedLocale;return h(Host,{key:"448f89b5870956b6e9455968134b94c9409a983d",class:"zonos--elements",style:{"--font-family":zonosStoreFontFamily()}},h("div",{key:"23841aa801d68da4b537cfaab5ea89405ec66a9f",class:"zonos--language-select"},h("zonos-select-dialog-header",{key:"5fc1b45aa0cb27c94163c2dace5ce4ad63215dfc",handleOnClose:function(){return e.handleOnClose()},label:translate("Select a language")}),h("div",{key:"7030fb276a05eea0e7333add3219b5316495662c",class:"zonos--language-select-content"},languages.map((function(t){return h("button",{class:"zonos--language-select-button",onClick:function(){return e.languageSelected(t.code)}},h("zonos-text",{textColor:"gray-800"},t.translatedLabel),t.code===o&&h("zonos-icon",{content:GreenCheckDuotoneIcon,size:16}))})))))};return e}();ZonosLanguageSelect.style=ZonosLanguageSelectStyle0;var RemoveIcon='<svg xmlns="https://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path fill="#C5C6CA" fill-rule="evenodd" d="M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Z" clip-rule="evenodd"/><path fill="#4D505A" fill-rule="evenodd" d="M8.293 8.293a1 1 0 0 1 1.414 0L12 10.586l2.293-2.293a1 1 0 1 1 1.414 1.414L13.414 12l2.293 2.293a1 1 0 0 1-1.414 1.414L12 13.414l-2.293 2.293a1 1 0 0 1-1.414-1.414L10.586 12 8.293 9.707a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"/></svg>';var zonosSelectDialogHeaderCss=":host{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host .zonos--select-dialog-header-wrapper{position:-webkit-sticky;position:sticky;top:0;background:var(--zonos-elements-surface-color);padding:16px}:host .zonos--select-dialog-header-wrapper .zonos--select-dialog-header{position:relative;-ms-flex-pack:justify;justify-content:space-between;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}";var ZonosSelectDialogHeaderStyle0=zonosSelectDialogHeaderCss;var ZonosSelectDialogHeader=function(){function e(e){registerInstance(this,e);this.handleOnClose=function(){};this.label=""}e.prototype.render=function(){var e=this;return h(Host,{key:"8ac4e1bcd64f6a2073e1161fec76c9b117345ada",class:"zonos--elements",style:{"--font-family":zonosStoreFontFamily()}},h("zonos-v-stack",{key:"fe4a184a8bed7aceb4c3f8d341fed50380587c77",class:"zonos--select-dialog-header-wrapper",spacing:8},h("div",{key:"2176069a11ba20c7408ef898044f2ba68eea4a80",class:"zonos--select-dialog-header"},h("zonos-text",{key:"45b9d890484881a15c4fa7a7e4028f9887cc942e",type:"boldLabel"},this.label),h("zonos-button",{key:"65f0d9ea7b6dee35d23aa6fca19fd686190b667f",class:"zonos--close-button",icon:h("zonos-icon",{"aria-label":"Close select dialog",content:RemoveIcon,size:20}),noBackground:true,onClick:function(){return e.handleOnClose()}})),h("slot",{key:"758fce95d668ad755745687d3fcf1a6a307061bc"})))};return e}();ZonosSelectDialogHeader.style=ZonosSelectDialogHeaderStyle0;export{ZonosLanguageSelect as zonos_language_select,ZonosSelectDialogHeader as zonos_select_dialog_header};
@@ -1 +1 @@
1
- var __awaiter=this&&this.__awaiter||function(n,o,t,a){function e(n){return n instanceof t?n:new t((function(o){o(n)}))}return new(t||(t=Promise))((function(t,s){function i(n){try{c(a.next(n))}catch(n){s(n)}}function r(n){try{c(a["throw"](n))}catch(n){s(n)}}function c(n){n.done?t(n.value):e(n.value).then(i,r)}c((a=a.apply(n,o||[])).next())}))};var __generator=this&&this.__generator||function(n,o){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},a,e,s,i;return i={next:r(0),throw:r(1),return:r(2)},typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function r(n){return function(o){return c([n,o])}}function c(r){if(a)throw new TypeError("Generator is already executing.");while(i&&(i=0,r[0]&&(t=0)),t)try{if(a=1,e&&(s=r[0]&2?e["return"]:r[0]?e["throw"]||((s=e["return"])&&s.call(e),0):e.next)&&!(s=s.call(e,r[1])).done)return s;if(e=0,s)r=[r[0]&2,s.value];switch(r[0]){case 0:case 1:s=r;break;case 4:t.label++;return{value:r[1],done:false};case 5:t.label++;e=r[1];r=[0];continue;case 7:r=t.ops.pop();t.trys.pop();continue;default:if(!(s=t.trys,s=s.length>0&&s[s.length-1])&&(r[0]===6||r[0]===2)){t=0;continue}if(r[0]===3&&(!s||r[1]>s[0]&&r[1]<s[3])){t.label=r[1];break}if(r[0]===6&&t.label<s[1]){t.label=s[1];s=r;break}if(s&&t.label<s[2]){t.label=s[2];t.ops.push(r);break}if(s[2])t.ops.pop();t.trys.pop();continue}r=o.call(n,t)}catch(n){r=[6,n];e=0}finally{a=s=0}if(r[0]&5)throw r[1];return{value:r[0]?r[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(n,o,t){if(t||arguments.length===2)for(var a=0,e=o.length,s;a<e;a++){if(s||!(a in o)){if(!s)s=Array.prototype.slice.call(o,0,a);s[a]=o[a]}}return n.concat(s||Array.prototype.slice.call(o))};import{r as registerInstance,h,H as Host,d as getElement,c as createEvent}from"./index-86b8247e.js";import{d as zonosStoreFontFamily}from"./zonosStore-473f4654.js";import{c as classes}from"./classes-0d95c529.js";import{k as stripeStore}from"./cart-4f300fcb.js";import{a as logError,l as log}from"./logError-c456c092.js";import{d as paypalStoreInitButtons}from"./paypal-70caf283.js";import"./isDarkColor-c927f77d.js";import"./getBorderRadius-23398fc6.js";var zonosNotificationCss=":host{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center}:host .zonos--notification-items{position:fixed;z-index:9999999999;bottom:24px;gap:8px;display:-ms-inline-flexbox;display:inline-flex;-ms-flex-direction:column;flex-direction:column}:host .zonos--notification-item{cursor:pointer;-webkit-transition:all 0.3s ease;transition:all 0.3s ease;padding:8px;border-radius:var(--border-radius, var(--zonos-elements-radius-6));opacity:0;-ms-flex-negative:0.0001;flex-shrink:0.0001;-webkit-transform:translateY(100%);transform:translateY(100%)}:host .zonos--notification-item+:host .zonos--notification-item{margin-top:8px}:host .zonos--notification-item.show{opacity:1;-webkit-transform:translateY(0);transform:translateY(0);-ms-flex-positive:1000;flex-grow:1000}:host .zonos--notification-item.success{background-color:var(--zonos-elements-green-700)}:host .zonos--notification-item.error{background-color:var(--zonos-elements-red-700)}:host .zonos--notification-item.warning{background-color:var(--zonos-elements-orange-700)}";var ZonosNotificationStyle0=zonosNotificationCss;var ZonosNotification=function(){function n(n){registerInstance(this,n);this.notificationArray=[]}n.prototype.showNotification=function(n){return __awaiter(this,void 0,void 0,(function(){var o,t;var a=this;return __generator(this,(function(e){o="id-".concat(Math.random().toString(36).substring(2,9));t=Object.assign(Object.assign({},n),{id:o,timeout:n.timeout||5e3,transitionClass:"",type:n.type||"success"});this.notificationArray=__spreadArray(__spreadArray([],this.notificationArray,true),[t],false);setTimeout((function(){a.updateTransitionClass({id:o,transitionClass:"show"})}),50);setTimeout((function(){a.removeNotification(o)}),t.timeout);return[2]}))}))};n.prototype.updateTransitionClass=function(n){var o=n.id,t=n.transitionClass;this.notificationArray=this.notificationArray.map((function(n){if(n.id===o){return Object.assign(Object.assign({},n),{transitionClass:t})}return n}))};n.prototype.removeNotification=function(n){var o=this;this.updateTransitionClass({id:n,transitionClass:""});setTimeout((function(){o.notificationArray=o.notificationArray.filter((function(o){return o.id!==n}))}),300)};n.prototype.render=function(){var n=this;return h(Host,{key:"17c08c90c6c1dfade4e43451c196127a0f53429e",class:classes(["zonos--elements zonos--notification"]),style:{"--font-family":zonosStoreFontFamily()}},h("div",{key:"6624419d86a5c7518539069dbc5c9d7c08262c75",class:"zonos--notification-items"},this.notificationArray.map((function(o){return h("div",{"aria-hidden":"true",class:classes(["zonos--notification-item",o.type,o.transitionClass]),key:o.id,onClick:function(){n.removeNotification(o.id)}},h("zonos-text",{textColor:"gray-0"},o.message))}))))};return n}();ZonosNotification.style=ZonosNotificationStyle0;var zonosPaymentCss=".sc-zonos-payment-h{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-payment-h *.sc-zonos-payment{font-family:var(--font-family, Inter), Inter}.sc-zonos-payment-h img.sc-zonos-payment{max-width:100%}.sc-zonos-payment-h dl.sc-zonos-payment,.sc-zonos-payment-h dd.sc-zonos-payment,.sc-zonos-payment-h h1.sc-zonos-payment,.sc-zonos-payment-h h2.sc-zonos-payment,.sc-zonos-payment-h h3.sc-zonos-payment,.sc-zonos-payment-h h4.sc-zonos-payment,.sc-zonos-payment-h h5.sc-zonos-payment,.sc-zonos-payment-h h6.sc-zonos-payment,.sc-zonos-payment-h hr.sc-zonos-payment,.sc-zonos-payment-h figure.sc-zonos-payment,.sc-zonos-payment-h p.sc-zonos-payment,.sc-zonos-payment-h pre.sc-zonos-payment{margin:0}.sc-zonos-payment-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-payment-h .zonos--title.sc-zonos-payment{margin-bottom:16px}";var ZonosPaymentStyle0=zonosPaymentCss;var ZonosPayment=function(){function n(n){registerInstance(this,n);this.titleText=undefined;this.stripe=stripeStore.stripe;this.stripeElements=stripeStore.stripeElements}n.prototype.watchInitStripe=function(){if(!this.stripeElements){return}var n=stripeStore.stripePaymentElement||this.stripeElements.create("payment",{layout:"accordion"});var o=this.el.querySelector(".zonos--payment-component");if(!o){logError("Cannot find container element for paymentElement");return}n.mount(o);n.on("change",(function(n){stripeStore.stripePaymentEventData=n}));stripeStore.stripePaymentElement=n};n.prototype.componentDidLoad=function(){this.watchInitStripe()};n.prototype.render=function(){return h(Host,{key:"ab601d9a0cc6fe2fee19f45d6321dcc81b418cff",class:"zonos--payment zonos--elements"},this.titleText&&h("zonos-text",{key:"27857c99c59e4913fa403ef5b23b5b7d7f32bd45",class:"zonos--title",type:"semiBoldLabel"},this.titleText),h("div",{key:"329b5a5617f0c5942b209df1ccf3bfcb4ddabb0c",class:"zonos--payment-component"}),h("div",{key:"7abb08922e9f607314713fc9fa762a3bb8a35b13",class:"zonos--payment-paypal-container"}))};Object.defineProperty(n.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(n,"watchers",{get:function(){return{stripeElements:["watchInitStripe"],stripe:["watchInitStripe"]}},enumerable:false,configurable:true});return n}();ZonosPayment.style=ZonosPaymentStyle0;var zonosPaypalPaymentCss=".sc-zonos-paypal-payment-h{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-paypal-payment-h *.sc-zonos-paypal-payment{font-family:var(--font-family, Inter), Inter}.sc-zonos-paypal-payment-h img.sc-zonos-paypal-payment{max-width:100%}.sc-zonos-paypal-payment-h dl.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h dd.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h1.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h2.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h3.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h4.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h5.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h6.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h hr.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h figure.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h p.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h pre.sc-zonos-paypal-payment{margin:0}.sc-zonos-paypal-payment-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-paypal-payment-h{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-direction:column;flex-direction:column}";var ZonosPaypalPaymentStyle0=zonosPaypalPaymentCss;var ZonosPaypalPayment=function(){function n(n){registerInstance(this,n);this.paypalSessionDone=createEvent(this,"paypalSessionDone",7);this.paypalSessionFail=createEvent(this,"paypalSessionFail",7)}n.prototype.loadPaypal=function(){return __awaiter(this,void 0,void 0,(function(){var n,o;var t=this;return __generator(this,(function(a){if(!window.Zonos.paypal){log("Paypal is not available");return[2]}n=paypalStoreInitButtons({onPaypalFail:function(){log("onPaypalFail");t.paypalSessionFail.emit()},onPaypalSessionDone:function(n){var o=n.orderId;log("onPaypalSessionDone","info",{orderId:o});t.paypalSessionDone.emit({orderId:o})}});if(!(n===null||n===void 0?void 0:n.length)){log("There are no paypal buttons available");return[2]}o=this.el.querySelector(".zonos--payment-paypal-container");if(!o){log("Cannot find container element for paypal buttons");return[2]}n.forEach((function(n){return __awaiter(t,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:return[4,n.render(o)];case 1:t.sent();return[2]}}))}))}));return[2]}))}))};n.prototype.componentDidLoad=function(){void this.loadPaypal()};n.prototype.render=function(){return h(Host,{key:"a09fe5b66b1ac971c10529ecb6213479f2870f08",class:"zonos--paypal-payment zonos--elements"},h("div",{key:"6ba337785b8a90965e0cba05fd62681bc92633fe",class:"zonos--payment-paypal-container"}))};Object.defineProperty(n.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});return n}();ZonosPaypalPayment.style=ZonosPaypalPaymentStyle0;export{ZonosNotification as zonos_notification,ZonosPayment as zonos_payment,ZonosPaypalPayment as zonos_paypal_payment};
1
+ var __awaiter=this&&this.__awaiter||function(n,o,t,a){function e(n){return n instanceof t?n:new t((function(o){o(n)}))}return new(t||(t=Promise))((function(t,s){function i(n){try{c(a.next(n))}catch(n){s(n)}}function r(n){try{c(a["throw"](n))}catch(n){s(n)}}function c(n){n.done?t(n.value):e(n.value).then(i,r)}c((a=a.apply(n,o||[])).next())}))};var __generator=this&&this.__generator||function(n,o){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},a,e,s,i;return i={next:r(0),throw:r(1),return:r(2)},typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function r(n){return function(o){return c([n,o])}}function c(r){if(a)throw new TypeError("Generator is already executing.");while(i&&(i=0,r[0]&&(t=0)),t)try{if(a=1,e&&(s=r[0]&2?e["return"]:r[0]?e["throw"]||((s=e["return"])&&s.call(e),0):e.next)&&!(s=s.call(e,r[1])).done)return s;if(e=0,s)r=[r[0]&2,s.value];switch(r[0]){case 0:case 1:s=r;break;case 4:t.label++;return{value:r[1],done:false};case 5:t.label++;e=r[1];r=[0];continue;case 7:r=t.ops.pop();t.trys.pop();continue;default:if(!(s=t.trys,s=s.length>0&&s[s.length-1])&&(r[0]===6||r[0]===2)){t=0;continue}if(r[0]===3&&(!s||r[1]>s[0]&&r[1]<s[3])){t.label=r[1];break}if(r[0]===6&&t.label<s[1]){t.label=s[1];s=r;break}if(s&&t.label<s[2]){t.label=s[2];t.ops.push(r);break}if(s[2])t.ops.pop();t.trys.pop();continue}r=o.call(n,t)}catch(n){r=[6,n];e=0}finally{a=s=0}if(r[0]&5)throw r[1];return{value:r[0]?r[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(n,o,t){if(t||arguments.length===2)for(var a=0,e=o.length,s;a<e;a++){if(s||!(a in o)){if(!s)s=Array.prototype.slice.call(o,0,a);s[a]=o[a]}}return n.concat(s||Array.prototype.slice.call(o))};import{r as registerInstance,h,H as Host,d as getElement,c as createEvent}from"./index-86b8247e.js";import{d as zonosStoreFontFamily}from"./zonosStore-473f4654.js";import{c as classes}from"./classes-0d95c529.js";import{j as stripeStore}from"./cart-45d2861f.js";import{a as logError,l as log}from"./handleFetch-37cea185.js";import{d as paypalStoreInitButtons}from"./paypal-ee310945.js";import"./isDarkColor-c927f77d.js";import"./getBorderRadius-23398fc6.js";var zonosNotificationCss=":host{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center}:host .zonos--notification-items{position:fixed;z-index:9999999999;bottom:24px;gap:8px;display:-ms-inline-flexbox;display:inline-flex;-ms-flex-direction:column;flex-direction:column}:host .zonos--notification-item{cursor:pointer;-webkit-transition:all 0.3s ease;transition:all 0.3s ease;padding:8px;border-radius:var(--border-radius, var(--zonos-elements-radius-6));opacity:0;-ms-flex-negative:0.0001;flex-shrink:0.0001;-webkit-transform:translateY(100%);transform:translateY(100%)}:host .zonos--notification-item+:host .zonos--notification-item{margin-top:8px}:host .zonos--notification-item.show{opacity:1;-webkit-transform:translateY(0);transform:translateY(0);-ms-flex-positive:1000;flex-grow:1000}:host .zonos--notification-item.success{background-color:var(--zonos-elements-green-700)}:host .zonos--notification-item.error{background-color:var(--zonos-elements-red-700)}:host .zonos--notification-item.warning{background-color:var(--zonos-elements-orange-700)}";var ZonosNotificationStyle0=zonosNotificationCss;var ZonosNotification=function(){function n(n){registerInstance(this,n);this.notificationArray=[]}n.prototype.showNotification=function(n){return __awaiter(this,void 0,void 0,(function(){var o,t;var a=this;return __generator(this,(function(e){o="id-".concat(Math.random().toString(36).substring(2,9));t=Object.assign(Object.assign({},n),{id:o,timeout:n.timeout||5e3,transitionClass:"",type:n.type||"success"});this.notificationArray=__spreadArray(__spreadArray([],this.notificationArray,true),[t],false);setTimeout((function(){a.updateTransitionClass({id:o,transitionClass:"show"})}),50);setTimeout((function(){a.removeNotification(o)}),t.timeout);return[2]}))}))};n.prototype.updateTransitionClass=function(n){var o=n.id,t=n.transitionClass;this.notificationArray=this.notificationArray.map((function(n){if(n.id===o){return Object.assign(Object.assign({},n),{transitionClass:t})}return n}))};n.prototype.removeNotification=function(n){var o=this;this.updateTransitionClass({id:n,transitionClass:""});setTimeout((function(){o.notificationArray=o.notificationArray.filter((function(o){return o.id!==n}))}),300)};n.prototype.render=function(){var n=this;return h(Host,{key:"17c08c90c6c1dfade4e43451c196127a0f53429e",class:classes(["zonos--elements zonos--notification"]),style:{"--font-family":zonosStoreFontFamily()}},h("div",{key:"6624419d86a5c7518539069dbc5c9d7c08262c75",class:"zonos--notification-items"},this.notificationArray.map((function(o){return h("div",{"aria-hidden":"true",class:classes(["zonos--notification-item",o.type,o.transitionClass]),key:o.id,onClick:function(){n.removeNotification(o.id)}},h("zonos-text",{textColor:"gray-0"},o.message))}))))};return n}();ZonosNotification.style=ZonosNotificationStyle0;var zonosPaymentCss=".sc-zonos-payment-h{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-payment-h *.sc-zonos-payment{font-family:var(--font-family, Inter), Inter}.sc-zonos-payment-h img.sc-zonos-payment{max-width:100%}.sc-zonos-payment-h dl.sc-zonos-payment,.sc-zonos-payment-h dd.sc-zonos-payment,.sc-zonos-payment-h h1.sc-zonos-payment,.sc-zonos-payment-h h2.sc-zonos-payment,.sc-zonos-payment-h h3.sc-zonos-payment,.sc-zonos-payment-h h4.sc-zonos-payment,.sc-zonos-payment-h h5.sc-zonos-payment,.sc-zonos-payment-h h6.sc-zonos-payment,.sc-zonos-payment-h hr.sc-zonos-payment,.sc-zonos-payment-h figure.sc-zonos-payment,.sc-zonos-payment-h p.sc-zonos-payment,.sc-zonos-payment-h pre.sc-zonos-payment{margin:0}.sc-zonos-payment-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-payment-h .zonos--title.sc-zonos-payment{margin-bottom:16px}";var ZonosPaymentStyle0=zonosPaymentCss;var ZonosPayment=function(){function n(n){registerInstance(this,n);this.titleText=undefined;this.stripe=stripeStore.stripe;this.stripeElements=stripeStore.stripeElements}n.prototype.watchInitStripe=function(){if(!this.stripeElements){return}var n=stripeStore.stripePaymentElement||this.stripeElements.create("payment",{layout:"accordion"});var o=this.el.querySelector(".zonos--payment-component");if(!o){logError("Cannot find container element for paymentElement");return}n.mount(o);n.on("change",(function(n){stripeStore.stripePaymentEventData=n}));stripeStore.stripePaymentElement=n};n.prototype.componentDidLoad=function(){this.watchInitStripe()};n.prototype.render=function(){return h(Host,{key:"ab601d9a0cc6fe2fee19f45d6321dcc81b418cff",class:"zonos--payment zonos--elements"},this.titleText&&h("zonos-text",{key:"27857c99c59e4913fa403ef5b23b5b7d7f32bd45",class:"zonos--title",type:"semiBoldLabel"},this.titleText),h("div",{key:"329b5a5617f0c5942b209df1ccf3bfcb4ddabb0c",class:"zonos--payment-component"}),h("div",{key:"7abb08922e9f607314713fc9fa762a3bb8a35b13",class:"zonos--payment-paypal-container"}))};Object.defineProperty(n.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(n,"watchers",{get:function(){return{stripeElements:["watchInitStripe"],stripe:["watchInitStripe"]}},enumerable:false,configurable:true});return n}();ZonosPayment.style=ZonosPaymentStyle0;var zonosPaypalPaymentCss=".sc-zonos-paypal-payment-h{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-paypal-payment-h *.sc-zonos-paypal-payment{font-family:var(--font-family, Inter), Inter}.sc-zonos-paypal-payment-h img.sc-zonos-paypal-payment{max-width:100%}.sc-zonos-paypal-payment-h dl.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h dd.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h1.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h2.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h3.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h4.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h5.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h6.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h hr.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h figure.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h p.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h pre.sc-zonos-paypal-payment{margin:0}.sc-zonos-paypal-payment-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-paypal-payment-h{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-direction:column;flex-direction:column}";var ZonosPaypalPaymentStyle0=zonosPaypalPaymentCss;var ZonosPaypalPayment=function(){function n(n){registerInstance(this,n);this.paypalSessionDone=createEvent(this,"paypalSessionDone",7);this.paypalSessionFail=createEvent(this,"paypalSessionFail",7)}n.prototype.loadPaypal=function(){return __awaiter(this,void 0,void 0,(function(){var n,o;var t=this;return __generator(this,(function(a){if(!window.Zonos.paypal){log("Paypal is not available");return[2]}n=paypalStoreInitButtons({onPaypalFail:function(){log("onPaypalFail");t.paypalSessionFail.emit()},onPaypalSessionDone:function(n){var o=n.orderId;log("onPaypalSessionDone","info",{orderId:o});t.paypalSessionDone.emit({orderId:o})}});if(!(n===null||n===void 0?void 0:n.length)){log("There are no paypal buttons available");return[2]}o=this.el.querySelector(".zonos--payment-paypal-container");if(!o){log("Cannot find container element for paypal buttons");return[2]}n.forEach((function(n){return __awaiter(t,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:return[4,n.render(o)];case 1:t.sent();return[2]}}))}))}));return[2]}))}))};n.prototype.componentDidLoad=function(){void this.loadPaypal()};n.prototype.render=function(){return h(Host,{key:"a09fe5b66b1ac971c10529ecb6213479f2870f08",class:"zonos--paypal-payment zonos--elements"},h("div",{key:"6ba337785b8a90965e0cba05fd62681bc92633fe",class:"zonos--payment-paypal-container"}))};Object.defineProperty(n.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});return n}();ZonosPaypalPayment.style=ZonosPaypalPaymentStyle0;export{ZonosNotification as zonos_notification,ZonosPayment as zonos_payment,ZonosPaypalPayment as zonos_paypal_payment};
@@ -0,0 +1 @@
1
+ import{r as registerInstance,h,H as Host}from"./index-86b8247e.js";import{c as classes}from"./classes-0d95c529.js";var zonosTooltipCss=":host{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host .zonos--tooltip{position:relative}:host .zonos--tooltip .zonos--tooltip-content{position:absolute;bottom:100%;left:0;width:-webkit-max-content;width:-moz-max-content;width:max-content;padding:12px;background-color:var(--zonos-elements-gray-1200);opacity:0;-webkit-transform:scale(0);transform:scale(0);-webkit-transition:all 0.2s ease-in-out;transition:all 0.2s ease-in-out;-webkit-transform-origin:bottom left;transform-origin:bottom left;border-radius:var(--zonos-elements-radius-4);z-index:100;-webkit-box-shadow:var(--zonos-elements-v3-shadow-large);box-shadow:var(--zonos-elements-v3-shadow-large)}:host .zonos--tooltip .zonos--tooltip-content.zonos--show-tooltip{opacity:1;-webkit-transform:scale(1);transform:scale(1)}";var ZonosTooltipStyle0=zonosTooltipCss;var ZonosTooltip=function(){function o(o){registerInstance(this,o);this.label="";this.subtitle="";this.showTooltip=false}o.prototype.render=function(){var o=this;return h(Host,{key:"24f3b1f73cc320540ab3700213004c267ea04658",class:"zonos--elements"},h("div",{key:"7f52acf90cb5b9f1fd5efdc4fedc4d61a893a646",class:"zonos--tooltip",onMouseEnter:function(){return o.showTooltip=true},onMouseLeave:function(){return o.showTooltip=false}},h("slot",{key:"1871529e8b75c44a71bf1f5bc9e60b81bbc598d2"}),h("div",{key:"c0b9c9c1b3fef5f766d2bad4c5bea48f3d6bbb6f",class:classes([this.showTooltip&&"zonos--show-tooltip","zonos--tooltip-content"])},h("zonos-text",{key:"3b106cb439877dffa101f15fb01aff980a64c7cb",size:"s",textColor:"gray-0",type:"boldLabel"},this.label),h("zonos-text",{key:"c0005051e6e1b614b7739718e1a262f6043d56f5",size:"xs",textColor:"gray-0"},this.subtitle))))};return o}();ZonosTooltip.style=ZonosTooltipStyle0;export{ZonosTooltip as zonos_tooltip};
@@ -14,6 +14,12 @@ declare const analyticsProviderType: {
14
14
  readonly GoogleAnalytics: "GOOGLE_ANALYTICS";
15
15
  };
16
16
  type AnalyticsProviderType = (typeof analyticsProviderType)[keyof typeof analyticsProviderType];
17
+ declare const cartAdjustmentType: {
18
+ readonly CartTotal: "CART_TOTAL";
19
+ readonly Item: "ITEM";
20
+ readonly Shipping: "SHIPPING";
21
+ };
22
+ type CartAdjustmentType = (typeof cartAdjustmentType)[keyof typeof cartAdjustmentType];
17
23
  declare const checkoutSubscriptionStatus: {
18
24
  readonly Active: "ACTIVE";
19
25
  readonly Inactive: "INACTIVE";
@@ -662,7 +668,9 @@ type CalculateLandedCostMutation = {
662
668
  landedCost: {
663
669
  id: string;
664
670
  } | null;
671
+ landedCostId: string;
665
672
  subtotals: {
673
+ adjustments: number;
666
674
  duties: number;
667
675
  exchangeRate: {
668
676
  id: string;
@@ -698,6 +706,9 @@ type CalculateLandedCostMutation = {
698
706
  sku: string | null;
699
707
  }>;
700
708
  landedCostCalculateWorkflow: Array<{
709
+ amountSubtotals: {
710
+ discounts: number | null;
711
+ } | null;
701
712
  appliedAdjustments: Array<{
702
713
  amount: number;
703
714
  item: {
@@ -708,8 +719,8 @@ type CalculateLandedCostMutation = {
708
719
  deMinimis: Array<{
709
720
  formula: string;
710
721
  method: IncotermCode;
711
- note: string;
712
722
  threshold: DeMinimisThreshold;
723
+ note: string;
713
724
  type: DeMinimisType;
714
725
  }>;
715
726
  duties: Array<{
@@ -725,8 +736,8 @@ type CalculateLandedCostMutation = {
725
736
  method: IncotermCode;
726
737
  shipmentRating: {
727
738
  amount: number;
728
- displayName: string;
729
739
  currencyCode: CurrencyCode;
740
+ displayName: string;
730
741
  id: string;
731
742
  maxTransitAt: string | null;
732
743
  minTransitAt: string | null;
@@ -3770,6 +3781,8 @@ type CalculateLandedCostRequest = {
3770
3781
  items: CartItem[];
3771
3782
  landedCostAdjustments?: {
3772
3783
  amount: number;
3784
+ productId: string | null;
3785
+ sku: string | null;
3773
3786
  type: LandedCostAdjustmentType;
3774
3787
  }[];
3775
3788
  metadata?: {
@@ -3984,8 +3997,11 @@ type CheckoutConfig = {
3984
3997
  successRedirectUrl: string;
3985
3998
  visibilityStatus: CheckoutVisibilityStatus;
3986
3999
  /**
3987
- * Cart info callback for checkout (optional)
3988
- * @note will use temp cart data if available
4000
+ * Cart info callback for checkout (optional),
4001
+ * @deprecated
4002
+ * @note
4003
+ * This function is deprecated in favor of new API `createCartId`
4004
+ * @note will attempt to use cart data if available
3989
4005
  * User can dispatch an event 'zonos--init-cart-info' to update the cart
3990
4006
  * @example
3991
4007
  * const initEvent = new CustomEvent<CartItem[]>('zonos--init-cart-info', {
@@ -4006,9 +4022,19 @@ type CheckoutConfig = {
4006
4022
  buildCartDetail?: (params: BuildCardDetailParams) => Promise<CartItem[]>;
4007
4023
  /**
4008
4024
  * Calculate landed cost callback for checkout (optional)
4009
- * @note will use temp cart data if available
4025
+ * @deprecated
4026
+ * @note
4027
+ * This function is deprecated in favor of new API `createCartId`
4028
+ * @note will attempt to use cart data if available
4010
4029
  */
4011
4030
  buildLandedCost?: (params: BuildLandedCostParams) => Promise<BuildLandedCostResponse>;
4031
+ /**
4032
+ * Callback that returns the cart id from `cartCreate` mutation.
4033
+ * @note
4034
+ * The mutation `cartCreate` is preferred to be called in the server side
4035
+ * @returns string - Cart ID
4036
+ */
4037
+ createCartId?: () => Promise<string> | string;
4012
4038
  /**
4013
4039
  * Callback trigger when the checkout is closed
4014
4040
  */
@@ -4057,85 +4083,41 @@ type AppearanceConfig = {
4057
4083
  zonosAttribution: ZonosAttribution | null;
4058
4084
  };
4059
4085
 
4060
- type TempCartItem = {
4061
- additionalCharge: boolean;
4062
- boxNumber: number | null;
4063
- countryOfOrigin: string | null;
4086
+ type NormalizedTempCartItem = {
4087
+ amount: number;
4088
+ attributes: {
4089
+ key: string;
4090
+ value: string;
4091
+ }[];
4092
+ countryOfOrigin: CountryCode | null;
4093
+ currencyCode: CurrencyCode;
4064
4094
  description: string | null;
4065
- discount: boolean;
4066
- foreignUnitPrice: number | null;
4067
- giftCard: boolean;
4068
- height: number | null;
4069
- id: number | null;
4070
- imageURL: string | null;
4071
- itemBrand: string | null;
4072
- itemCategory: string | null;
4073
- itemColor: string | null;
4074
- itemCustomization: string | null;
4075
- itemDescriptionDetailed: string | null;
4076
- itemDescriptionLong: string | null;
4077
- itemDiscountAmount: number | null;
4078
- itemDoSell: boolean;
4079
- itemFabricContent: string | null;
4080
- itemForwarded: boolean;
4081
- itemHSCode: string | null;
4082
- itemLtlClass: string | null;
4083
- itemMaterial: string | null;
4084
- itemPickingLocation: string | null;
4085
- itemShipFromLocation: string | null;
4086
- itemShippingAmount: number | null;
4087
- itemSize: string | null;
4088
- itemURL: string | null;
4089
- itemUnitPriceHide: boolean;
4090
- length: number | null;
4091
- nonShippable: boolean;
4095
+ id: string;
4096
+ imageUrl: string | null;
4097
+ itemType: ItemType | null;
4098
+ measurements: {
4099
+ type: ItemMeasurementType;
4100
+ unitOfMeasure: ItemUnitOfMeasure;
4101
+ value: number;
4102
+ }[];
4103
+ name: string | null;
4092
4104
  productId: string | null;
4093
- quantity: number | null;
4105
+ quantity: number;
4094
4106
  sku: string | null;
4095
- status: string | null;
4096
- unitPrice: number | null;
4097
- weight: number | null;
4098
- weightUnits: string | null;
4099
- width: number | null;
4100
4107
  };
4101
- type TempCart = {
4102
- additionalHandling: boolean;
4103
- boxCount: string | null;
4104
- /**
4105
- * @param contShopingUrl should always be set, backend will ensure this. If not set, backend will fallback to the store vendor url
4106
- */
4107
- contShoppingURL: string;
4108
- createdInMillis: number | null;
4109
- customerId: string | null;
4110
- customerNote: string | null;
4111
- discountAmount: number | null;
4112
- domesticShippingCharge: number | null;
4113
- exchangeRate: number | null;
4114
- externalConfirmationPageURL: string | null;
4115
- footerHtml: string | null;
4116
- giftCardDescription: string | null;
4117
- giftCardForeignTotal: number | null;
4118
- giftCardTotal: number | null;
4119
- guid: string;
4120
- iGlobalId: string | null;
4121
- id: number;
4122
- iglobalCheckoutFlags: string | null;
4123
- interpayRateOfferId: string | null;
4124
- items: TempCartItem[] | null;
4125
- message: string | null;
4126
- misc1: string | null;
4127
- misc2: string | null;
4128
- misc3: string | null;
4129
- misc4: string | null;
4130
- misc5: string | null;
4131
- misc6: string | null;
4132
- poAllowed: boolean;
4133
- referenceId: string | null;
4134
- shippingAmountOverride: number | null;
4135
- showForeignCurrency: boolean;
4108
+ type NormalizedTempCart = {
4109
+ adjustments: {
4110
+ amount: number;
4111
+ currencyCode: CurrencyCode;
4112
+ description: string;
4113
+ productId: string | null;
4114
+ sku: string | null;
4115
+ type: CartAdjustmentType;
4116
+ }[];
4117
+ credentialToken: string;
4118
+ items: NormalizedTempCartItem[];
4119
+ storeBaseUrl: string;
4136
4120
  storeId: number;
4137
- usedInMillis: number | null;
4138
- vendorPassedCurrencyCode: string | null;
4139
4121
  };
4140
4122
 
4141
4123
  /**
@@ -4303,17 +4285,17 @@ type LoadZonosParamsConfig = {
4303
4285
  type LoadZonosParams = LoadZonosParamsConfig & {
4304
4286
  storeId: number;
4305
4287
  /**
4306
- * Temporary cart UUID to be used for legacy zonos checkout. If this is provided, no need to configure `buildCartDetail`, `buildLandedCost` callback, zonosApiKey or storeId
4307
- * @note This would be deprecated in the future when we fully migrate to new zonos checkout
4288
+ * If cart id is provided in the url with query param zCartUUID, you don't need to provide zonosApiKey
4308
4289
  */
4309
- tempCartUUID?: string;
4310
- zonosApiKey: string;
4290
+ zonosApiKey?: string;
4311
4291
  };
4312
4292
  interface Zonos {
4313
4293
  /**
4314
4294
  * Mock error response for Paypal. Mainly used for testing purposes
4315
4295
  */
4316
4296
  _paypalMockResponse: PaypalMockResponse | null;
4297
+ cartData: NormalizedTempCart | null;
4298
+ cartId: string | null;
4317
4299
  /**
4318
4300
  * Toggle debug mode (add query param 'zonosDebug=1' to url)
4319
4301
  * @default false
@@ -4321,6 +4303,10 @@ interface Zonos {
4321
4303
  debug?: boolean;
4322
4304
  doneInit: boolean;
4323
4305
  isBigCommerce: boolean;
4306
+ /**
4307
+ * This will be set to true when it's called form legacy checkout
4308
+ */
4309
+ isLegacyCheckout: boolean;
4324
4310
  isNpm: boolean;
4325
4311
  /** Flag if already alerted when preview domain is defined and it's connecting production environment */
4326
4312
  modeAlerted: boolean;
@@ -4332,9 +4318,8 @@ interface Zonos {
4332
4318
  storeId: number;
4333
4319
  /** Stripe instance */
4334
4320
  stripe: Stripe;
4335
- tempCartData: TempCart | null;
4336
4321
  version: string;
4337
- zonosApiKey: string;
4322
+ zonosApiKey?: string;
4338
4323
  /**
4339
4324
  * Flag to send tracking event to api for conversion testing, since we don't send tracking event to api when in debug/development mode
4340
4325
  */
@@ -4350,7 +4335,7 @@ interface Zonos {
4350
4335
  updateOrganizationName: (organizationName: string) => void;
4351
4336
  }
4352
4337
  declare abstract class Zonos {
4353
- static zonosApiKey: string;
4338
+ static zonosApiKey?: string;
4354
4339
  static stripe: Stripe;
4355
4340
  static storeId: number;
4356
4341
  static doneInit: boolean;
@@ -4359,6 +4344,7 @@ declare abstract class Zonos {
4359
4344
  static _paypalMockResponse: PaypalMockResponse | null;
4360
4345
  static isBigCommerce: boolean;
4361
4346
  static releaseDate: string;
4347
+ static isLegacyCheckout: boolean;
4362
4348
  /**
4363
4349
  * By default, the package will load from npm
4364
4350
  */
@@ -4366,9 +4352,10 @@ declare abstract class Zonos {
4366
4352
  static zonosQaUrl: string | null;
4367
4353
  static version: string;
4368
4354
  static modeAlerted: boolean;
4369
- static tempCartData: TempCart | null;
4355
+ static cartData: NormalizedTempCart | null;
4370
4356
  static paypal: PayPalNamespace | null;
4371
4357
  static getCurrentTimestamp: () => number;
4358
+ static cartId: string | null;
4372
4359
  private static zonosController;
4373
4360
  static init: ({ appearance, checkoutSettings, currencyConverter, helloSettings, onCountryChange, overrideCurrencyFormat, storeId, zonosApiKey, }: LoadZonosParams) => Promise<void>;
4374
4361
  static displayCurrency: () => void;
@@ -1 +1 @@
1
- (function(){"use strict";const e=(e,t,...n)=>{var o,r;if(!(!!(null===(o=window.Zonos)||void 0===o?void 0:o.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===t&&console.error(e,...n));let s=document.querySelector("iframe#zonos---debug-logging-iframe");s||(s=document.createElement("iframe"),s.id="zonos---debug-logging-iframe",s.style.display="none",s.style.opacity="0",s.style.position="absolute",s.style.top="-9999px",s.style.left="-9999px",s.style.width="1px",s.style.height="1px",s.style.border="none",s.style.overflow="hidden",s.style.visibility="hidden",document.body.appendChild(s));const i=(null===(r=s.contentWindow)||void 0===r?void 0:r.window.console)||window.console;switch(t){case"warn":i.warn(e,...n);break;case"info":i.info(e,...n);break;case"error":i.error(e,...n);break;default:i.groupCollapsed(e,...n),i.trace(),i.groupEnd()}},t=(t,...n)=>{e(t,"error",...n)},n=["jsdelivr","cdnjs","unpkg","vercel"],o=e=>{const t=n.indexOf(e);return n[t+1]||null},r=()=>{const t=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||t)return null;const n=(e=>{if(!e)return null;const t=new URL(e).searchParams.get("zonosQaUrl");return t?/[^a-zA-Z0-9-_]+/.test(t)?null:t:null})(window.location.href),o="https://v1.3.50.js.zonos.com";if(!n&&(o.includes("test.")||o.includes("test-")))return o;if(!n&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!n)return null;if("dev-elements"===n)return"https://dev.elements.zonos.com";const r=`https://${n}.preview.js.zonos.com`;return e(`[ZONOS-WARNING] using '${r}' for loading script`,"warn"),fetch(r).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${r}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:t}=window.location,n=`${t}?${e.toString()}`;return window.history.replaceState(window.history.state,"",n),window.location.reload(),null})),r},s="https://js.stripe.com/v3",i=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,l="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let c=null;const d=e=>(null!==c||(c=new Promise(((n,o)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(l),window.Stripe)n(window.Stripe);else try{let r=(()=>{const e=document.querySelectorAll(`script[src^="${s}"]`);for(let t=0;t<e.length;t++){const n=e[t];if(n&&i.test(n.src))return n}return null})();r&&e?console.warn(l):r||(r=(e=>{const n=document.createElement("script");n.src=`${s}`;const o=document.head||document.body;return o?(o.appendChild(n),n):(t("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==r||r.addEventListener("load",(()=>{window.Stripe?n(window.Stripe):o(new Error("Stripe.js not available"))})),null==r||r.addEventListener("error",(()=>{o(new Error("Failed to load Stripe.js"))}))}catch(e){return void o(e)}else n(null)}))),c),a=Promise.resolve().then((()=>d(null)));let u=!1;a.catch((e=>{u||console.warn(e)}));var p;const m=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:t,isWhiteListed:n}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const t=new URL(e).origin,n=["dev.elements.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>t.includes(e))),o=["qa.js.zonos.com"].some((e=>t.includes(e)));return{currentLoadScriptUrl:t,isForceLoadVersionDomain:o,isWhiteListed:n}})({loadScriptSrc:null==e?void 0:e.src});return n?t:null})(),h="https://v1.3.50.js.zonos.com",y=m||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.50",w="jsdelivr",f="https://rsms.me",v="https://fonts.googleapis.com",g=/^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;class S{}p=S,S.doneInit=!1,S.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),S.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),S._paypalMockResponse=null,S.isBigCommerce=!1,S.releaseDate="1726504774830",S.isNpm=!0,S.zonosQaUrl=null,S.version="v1.3.50",S.modeAlerted=!1,S.tempCartData=null,S.paypal=null,S.getCurrentTimestamp=()=>(new Date).getTime(),S.zonosController=null,S.init=async({appearance:n,checkoutSettings:o,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:l,storeId:c,zonosApiKey:d})=>{p.doneInit||(e(`====== ZONOS DEBUG MODE: on (${p.version}) ======`),d?(p.zonosApiKey=d,p.storeId=c,e("init zonos"),p.injectZonosCdn(),p.injectZonosCss(),p.injectFonts(),p.injectController({config:{appearance:n,checkoutSettings:o,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:l},zonosApiKey:d}),p.doneInit=!0):t("Missing Zonos API key"))},S.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},S.openHelloDialog=e=>{const t=document.querySelector("zonos-hello");t&&t.openHelloDialog(null==e||e)},S.showNotification=e=>{var t;null===(t=p.zonosController)||void 0===t||t.showNotification(e)},S.updateOrganizationName=e=>{var t;null===(t=p.zonosController)||void 0===t||t.updateOrganizationName(e)},S.disablePlaceOrderButtons=({autoEnable:e=!0,config:t,disable:n,placeOrderButtonSelector:o})=>{var r;if(!(null===(r=t.checkoutSettings)||void 0===r?void 0:r.disablePlaceOrderButtonActivation)&&o){const t=document.querySelectorAll(o),r=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};t.forEach((e=>{e.getAttribute("data-zonos-checkout-attached")||(n?(e.setAttribute("disabled","true"),e.addEventListener("click",r)):(e.removeAttribute("disabled"),e.removeEventListener("click",r)))})),e&&n&&setTimeout((()=>{t.forEach((e=>{e.removeAttribute("disabled"),e.removeEventListener("click",r)}))}),5e3)}},S.injectController=({config:n,zonosApiKey:o})=>{var r;if(document.querySelector("zonos-controller"))return;if(null===(r=n.checkoutSettings)||void 0===r?void 0:r.placeOrderButtonSelector){const e=n.checkoutSettings.placeOrderButtonSelector;p.disablePlaceOrderButtons({config:n,disable:!0,placeOrderButtonSelector:e});new MutationObserver((()=>{p.disablePlaceOrderButtons({config:n,disable:!0,placeOrderButtonSelector:e})})).observe(document.body,{childList:!0,subtree:!0})}const s=document.createElement("zonos-controller");s.config=n,s.zonosApiKey=o,s.addEventListener("stripeInitEvent",(async n=>{const{detail:o}=n;e("loading Stripe");const r=await(async(...e)=>{u=!0;const t=Date.now();return a.then((n=>((e,t,n)=>{if(null===e)return null;const o=e.apply(void 0,t);return((e,t)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:t})})(o,n),o})(n,e,t)))})(o.publishableKey);r?(window.Zonos.stripe=r,s.initCheckoutElement(r)):t("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(s),p.zonosController=s,e("Zonos controller injected!")},S.injectScript=({cdnType:n,isModule:r,theRestUrl:s})=>{const i=`${p.getZonosUrl(n)}/${s}`;if(document.querySelector(`script[src="${i}"]`))return void e(`Zonos script "${i}" already exists in the document`,"warn");const l=document.head||document.body,c=document.createElement("script");r?c.type="module":c.noModule=!0,c.src=i,c.crossOrigin="anonymous",c.onerror=()=>{t(`Failed to load ${c.src}`);const e=o(n);e&&p.injectScript({cdnType:e,isModule:r,theRestUrl:s})},l.appendChild(c)},S.getZonosUrl=e=>{const t=()=>{switch(e){case"jsdelivr":return y;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.50";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.50";case"vercel":return h}};if(p.isNpm){return r()||t()}return t()},S.injectZonosCdn=()=>{p.injectScript({cdnType:w,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),p.injectScript({cdnType:w,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),e("Zonos cdn script injected!")},S.injectStylesheet=({cdnType:e,theRestUrl:n})=>{const r=p.getZonosUrl(e),s=document.head||document.body,i=document.createElement("link");i.rel="preconnect",i.href=`${h}/`,s.appendChild(i);const l=document.createElement("link");l.rel="stylesheet",l.href=`${r}/${n}`,l.onerror=()=>{t(`Failed to load ${l.href}`);const r=o(e);r&&p.injectStylesheet({cdnType:r,theRestUrl:n})},s.appendChild(l)},S.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?e("Zonos style links already injected","warn"):(p.injectStylesheet({cdnType:w,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),e("Zonos style css injected!"))},S.injectFonts=()=>{if((()=>{const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${f}"]`);for(let t=0;t<e.length;t++){const n=e[t];if(n&&!g.test(n.href))return n}return null})())return void e("Inter font already injected","warn");const t=document.head||document.body,n=document.createElement("link");n.rel="preconnect",n.href=f,t.appendChild(n);const o=document.createElement("link");o.rel="stylesheet",o.href=`${f}/inter/inter.css`,t.appendChild(o),e("Zonos font injected!")},S.setupGoogleFont=e=>{var t;null===(t=p.zonosController)||void 0===t||t.setupGoogleFont(e)},S.injectSupportGoogleFont=t=>{var n;e(`[FONT] injecting ${t}`);const o=null===(n=t.match(/family=(.*?):/))||void 0===n?void 0:n[1],r=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${v}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=v,r.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${t}"]`))return void e(`[FONT] ${o} font already injected`,"warn");const s=document.createElement("link");s.rel="stylesheet",s.href=t,r.appendChild(s),e(`[FONT] ${o} font injected!`)},exports.Zonos=S})();
1
+ (function(){"use strict";const e=(e,t,...o)=>{var n,r;if(!(!!(null===(n=window.Zonos)||void 0===n?void 0:n.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===t&&console.error(e,...o));let s=document.querySelector("iframe#zonos---debug-logging-iframe");s||(s=document.createElement("iframe"),s.id="zonos---debug-logging-iframe",s.style.display="none",s.style.opacity="0",s.style.position="absolute",s.style.top="-9999px",s.style.left="-9999px",s.style.width="1px",s.style.height="1px",s.style.border="none",s.style.overflow="hidden",s.style.visibility="hidden",document.body.appendChild(s));const i=(null===(r=s.contentWindow)||void 0===r?void 0:r.window.console)||window.console;switch(t){case"warn":i.warn(e,...o);break;case"info":i.info(e,...o);break;case"error":i.error(e,...o);break;default:i.groupCollapsed(e,...o),i.trace(),i.groupEnd()}},t=(t,...o)=>{e(t,"error",...o)},o=["jsdelivr","cdnjs","unpkg","vercel"],n="jsdelivr",r=e=>{const t=o.indexOf(e);return o[t+1]||null},s=()=>{const t=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||t)return null;const o=(e=>{if(!e)return null;const t=new URL(e).searchParams.get("zonosQaUrl");return t?/[^a-zA-Z0-9-_]+/.test(t)?null:t:null})(window.location.href),n="https://v1.3.52.js.zonos.com";if(!o&&(n.includes("test.")||n.includes("test-")))return n;if(!o&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!o)return null;if("dev-elements"===o)return"https://dev.elements.zonos.com";const r=`https://${o}.preview.js.zonos.com`;return e(`[ZONOS-WARNING] using '${r}' for loading script`,"warn"),fetch(r).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${r}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:t}=window.location,o=`${t}?${e.toString()}`;return window.history.replaceState(window.history.state,"",o),window.location.reload(),null})),r},i="https://js.stripe.com/v3",l=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,a="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let c=null;const d=e=>(null!==c||(c=new Promise(((o,n)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(a),window.Stripe)o(window.Stripe);else try{let r=(()=>{const e=document.querySelectorAll(`script[src^="${i}"]`);for(let t=0;t<e.length;t++){const o=e[t];if(o&&l.test(o.src))return o}return null})();r&&e?console.warn(a):r||(r=(e=>{const o=document.createElement("script");o.src=`${i}`;const n=document.head||document.body;return n?(n.appendChild(o),o):(t("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==r||r.addEventListener("load",(()=>{window.Stripe?o(window.Stripe):n(new Error("Stripe.js not available"))})),null==r||r.addEventListener("error",(()=>{n(new Error("Failed to load Stripe.js"))}))}catch(e){return void n(e)}else o(null)}))),c),u=Promise.resolve().then((()=>d(null)));let p=!1;u.catch((e=>{p||console.warn(e)}));function m(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}"function"==typeof SuppressedError&&SuppressedError;const h=["cloudflare","vercel"],y=h[0],w={cloudflare:"https://route.elements.zonos.com",vercel:"https://v1.route.js.zonos.com"},g=w[y],f=(e=y)=>{const t=h.indexOf(e),o=h[t+1];return o||null},v=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},b=async({response:e,shouldLog:t=!0,shouldThrow:o=!1})=>{try{return await e.json()}catch(e){if(o)throw e;return t&&console.error(e),null}},S=async({basePathType:e,options:t,path:o})=>{let n;const r=w[e]||y,s=new URL(r+o);s.searchParams.set("zToken",(e=>{try{return btoa(e).replace(/=/g,"")}catch(t){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(window.location.hostname));try{n=await fetch(s.toString(),t)}catch(e){if(e instanceof Error)return{baseUrl:r,errors:[{message:e.message,type:"unknown"}],json:null,response:null,zonosMode:null};return{baseUrl:r,errors:[{message:"Fail to fetch",type:"unknown"}],json:null,response:null,zonosMode:null}}const i=n.headers.get("Zonos-Mode"),l=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&i&&l&&(window.Zonos.modeAlerted=!0),n.ok){return{baseUrl:r,errors:[],json:await b({response:n}),response:n,zonosMode:i}}const a=n.status.toString();try{const e=await b({response:n,shouldThrow:!0});return{baseUrl:r,errors:[{message:JSON.stringify(e),type:a}],json:null,response:n,zonosMode:i}}catch(e){return{baseUrl:r,errors:[{message:`${a}: ${"Unknown error"}`,type:a}],json:null,response:null,zonosMode:i}}},z=async({basePathType:t,options:o,path:n})=>{var r,s;const i=n.startsWith("/api/bigcommerce")?"vercel":t,l=await S({basePathType:i,options:o,path:n}),{errors:a,response:c}=l,d=m(l,["errors","response"]),u=f(i),p=!!a.find((({type:e})=>"unknown"===e))||404===(null==c?void 0:c.status),h=u&&p;return p&&(async({endpoint:e,errors:t,metadata:o,shouldPostReleaseErrorReporting:n})=>{if(n){const e=Number(window.Zonos.releaseDate);if((new Date).getTime()-e>36e5)return}const r="userAgentData"in window.navigator?window.navigator.userAgentData:null,s={endpoint:e,errors:t,metadata:Object.assign({href:window.location.href,userAgent:r&&r.brands.length>0?r:window.navigator.userAgent},o)};try{fetch(`${g}/api/zonos-elements/log-error`,{body:JSON.stringify(s),method:"POST"})}catch(e){const t=f();if(!t)return;fetch(`${w[t]}/api/zonos-elements/log-error`,{body:JSON.stringify(s),method:"POST"})}})({endpoint:w[i]+n,errors:a.map((({message:e})=>e)),metadata:{currentBasePath:i,nextFallbackApiType:u,requestHeaders:null==o?void 0:o.headers,requestPayload:v(null===(r=null==o?void 0:o.body)||void 0===r?void 0:r.toString())||(null===(s=null==o?void 0:o.body)||void 0===s?void 0:s.toString()),status:null==c?void 0:c.status,statusText:null==c?void 0:c.statusText},shouldPostReleaseErrorReporting:!0}),h?(e(`=== "${n}" failed to fetch, trying next fallback ${u}`),z({basePathType:u,options:o,path:n})):Object.assign({errors:a,response:c},d)},j=async e=>{const{errors:t,json:o}=await(async(e,t)=>{const o=m(t||{},[]),n=o.body?JSON.stringify(o.body):void 0,r=o.method||"GET",s=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},o.headers),i=Object.assign(Object.assign({},o),{body:"GET"===r?void 0:n,headers:s,method:r}),l=new URLSearchParams(window.location.search).get("useFallbackApi");return z({basePathType:l||y,options:i,path:e})})("/api/zonos-elements/get-temp-cart",{body:{tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"});return!o||t.length?null:o};var O;const C=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:t,isWhiteListed:o}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const t=new URL(e).origin,o=["dev.elements.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>t.includes(e))),n=["qa.js.zonos.com"].some((e=>t.includes(e)));return{currentLoadScriptUrl:t,isForceLoadVersionDomain:n,isWhiteListed:o}})({loadScriptSrc:null==e?void 0:e.src});return o?t:null})(),k="https://v1.3.52.js.zonos.com",E=C||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.52",A="https://rsms.me",U="https://fonts.googleapis.com",Z=/^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;class T{}O=T,T.doneInit=!1,T.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),T.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),T._paypalMockResponse=null,T.isBigCommerce=!1,T.releaseDate="1726602671461",T.isLegacyCheckout=!1,T.isNpm=!0,T.zonosQaUrl=null,T.version="v1.3.52",T.modeAlerted=!1,T.cartData=null,T.paypal=null,T.getCurrentTimestamp=()=>(new Date).getTime(),T.zonosController=null,T.init=async({appearance:o,checkoutSettings:n,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:l,storeId:a,zonosApiKey:c})=>{if(O.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),!O.doneInit){if(e(`====== ZONOS DEBUG MODE: on (${O.version}) ======`),O.zonosApiKey=c,O.storeId=a,O.isNpm){if(e("====== ZONOS LOADING FROM NPM ======"),!c&&!O.cartId)return void t("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!O.cartData&&O.cartId){e("Initialize cart data");const o=await(async o=>{const n=await j(o);return e("[ZONOS - loadZonos] getting temp cart data","info",n),n?{cartData:n.cartData,storeFavicon:n.storeFaviconUrl,storeId:n.cartData.storeId,storeLogo:n.storeLogoUrl,zonosApiKey:n.cartData.credentialToken}:(t("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)})(O.cartId);if(!o)return void t("Failed to get cart data");O.cartData=o.cartData,O.zonosApiKey=o.zonosApiKey}}if(O.cartId&&O.cartData){e("Cart data is available, inject hidden button and trigger checkout");const t=document.createElement("button");t.style.display="none",t.id="zonos--checkout-hidden-button",document.body.appendChild(t)}e("init zonos"),O.injectZonosCdn(),O.injectZonosCss(),O.injectFonts(),O.injectController({config:{appearance:o,checkoutSettings:n,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:l}}),O.doneInit=!0}},T.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},T.openHelloDialog=e=>{const t=document.querySelector("zonos-hello");t&&t.openHelloDialog(null==e||e)},T.showNotification=e=>{var t;null===(t=O.zonosController)||void 0===t||t.showNotification(e)},T.updateOrganizationName=e=>{var t;null===(t=O.zonosController)||void 0===t||t.updateOrganizationName(e)},T.disablePlaceOrderButtons=({autoEnable:e=!0,config:t,disable:o,placeOrderButtonSelector:n})=>{var r;if(!(null===(r=t.checkoutSettings)||void 0===r?void 0:r.disablePlaceOrderButtonActivation)&&n){const t=document.querySelectorAll(n),r=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};t.forEach((e=>{e.getAttribute("data-zonos-checkout-attached")||(o?(e.setAttribute("disabled","true"),e.addEventListener("click",r)):(e.removeAttribute("disabled"),e.removeEventListener("click",r)))})),e&&o&&setTimeout((()=>{t.forEach((e=>{e.removeAttribute("disabled"),e.removeEventListener("click",r)}))}),5e3)}},T.injectController=({config:o})=>{var n;if(document.querySelector("zonos-controller"))return;if(null===(n=o.checkoutSettings)||void 0===n?void 0:n.placeOrderButtonSelector){const e=o.checkoutSettings.placeOrderButtonSelector;O.disablePlaceOrderButtons({config:o,disable:!0,placeOrderButtonSelector:e});new MutationObserver((()=>{O.disablePlaceOrderButtons({config:o,disable:!0,placeOrderButtonSelector:e})})).observe(document.body,{childList:!0,subtree:!0})}const r=document.createElement("zonos-controller");r.config=o,r.zonosApiKey=O.zonosApiKey||"",r.addEventListener("stripeInitEvent",(async o=>{const{detail:n}=o;e("loading Stripe");const s=await(async(...e)=>{p=!0;const t=Date.now();return u.then((o=>((e,t,o)=>{if(null===e)return null;const n=e.apply(void 0,t);return((e,t)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:t})})(n,o),n})(o,e,t)))})(n.publishableKey);s?(window.Zonos.stripe=s,r.initCheckoutElement(s)):t("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(r),O.zonosController=r,e("Zonos controller injected!")},T.injectScript=({cdnType:o,isModule:n,theRestUrl:s})=>{const i=`${O.getZonosUrl(o)}/${s}`;if(document.querySelector(`script[src="${i}"]`))return void e(`Zonos script "${i}" already exists in the document`,"warn");const l=document.head||document.body,a=document.createElement("script");n?a.type="module":a.noModule=!0,a.src=i,a.crossOrigin="anonymous",a.onerror=()=>{t(`Failed to load ${a.src}`);const e=r(o);e&&O.injectScript({cdnType:e,isModule:n,theRestUrl:s})},l.appendChild(a)},T.getZonosUrl=e=>{const t=()=>{switch(e){case"jsdelivr":return E;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.52";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.52";case"vercel":return k}};if(O.isNpm){return s()||t()}return t()},T.injectZonosCdn=()=>{O.injectScript({cdnType:n,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),O.injectScript({cdnType:n,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),e("Zonos cdn script injected!")},T.injectStylesheet=({cdnType:e,theRestUrl:o})=>{const n=O.getZonosUrl(e),s=document.head||document.body,i=document.createElement("link");i.rel="preconnect",i.href=`${k}/`,s.appendChild(i);const l=document.createElement("link");l.rel="stylesheet",l.href=`${n}/${o}`,l.onerror=()=>{t(`Failed to load ${l.href}`);const n=r(e);n&&O.injectStylesheet({cdnType:n,theRestUrl:o})},s.appendChild(l)},T.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?e("Zonos style links already injected","warn"):(O.injectStylesheet({cdnType:n,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),e("Zonos style css injected!"))},T.injectFonts=()=>{if((()=>{const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${A}"]`);for(let t=0;t<e.length;t++){const o=e[t];if(o&&!Z.test(o.href))return o}return null})())return void e("Inter font already injected","warn");const t=document.head||document.body,o=document.createElement("link");o.rel="preconnect",o.href=A,t.appendChild(o);const n=document.createElement("link");n.rel="stylesheet",n.href=`${A}/inter/inter.css`,t.appendChild(n),e("Zonos font injected!")},T.setupGoogleFont=e=>{var t;null===(t=O.zonosController)||void 0===t||t.setupGoogleFont(e)},T.injectSupportGoogleFont=t=>{var o;e(`[FONT] injecting ${t}`);const n=null===(o=t.match(/family=(.*?):/))||void 0===o?void 0:o[1],r=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${U}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=U,r.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${t}"]`))return void e(`[FONT] ${n} font already injected`,"warn");const s=document.createElement("link");s.rel="stylesheet",s.href=t,r.appendChild(s),e(`[FONT] ${n} font injected!`)},exports.Zonos=T})();
@@ -1 +1 @@
1
- (function(){"use strict";function e(e,o){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&o.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)o.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(t[n[r]]=e[n[r]])}return t}"function"==typeof SuppressedError&&SuppressedError;const o=["cloudflare","vercel"],t=o[0],n={cloudflare:"https://route.elements.zonos.com",vercel:"https://v1.route.js.zonos.com"},r=n[t],s=(e=t)=>{const n=o.indexOf(e),r=o[n+1];return r||null},i=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},a=(e,o,...t)=>{var n,r;if(!(!!(null===(n=window.Zonos)||void 0===n?void 0:n.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===o&&console.error(e,...t));let s=document.querySelector("iframe#zonos---debug-logging-iframe");s||(s=document.createElement("iframe"),s.id="zonos---debug-logging-iframe",s.style.display="none",s.style.opacity="0",s.style.position="absolute",s.style.top="-9999px",s.style.left="-9999px",s.style.width="1px",s.style.height="1px",s.style.border="none",s.style.overflow="hidden",s.style.visibility="hidden",document.body.appendChild(s));const i=(null===(r=s.contentWindow)||void 0===r?void 0:r.window.console)||window.console;switch(o){case"warn":i.warn(e,...t);break;case"info":i.info(e,...t);break;case"error":i.error(e,...t);break;default:i.groupCollapsed(e,...t),i.trace(),i.groupEnd()}},l=async({endpoint:e,errors:o,metadata:t,shouldPostReleaseErrorReporting:i})=>{if(i){const e=Number(window.Zonos.releaseDate);if((new Date).getTime()-e>36e5)return}const a="userAgentData"in window.navigator?window.navigator.userAgentData:null,l={endpoint:e,errors:o,metadata:Object.assign({href:window.location.href,userAgent:a&&a.brands.length>0?a:window.navigator.userAgent},t)};try{fetch(`${r}/api/zonos-elements/log-error`,{body:JSON.stringify(l),method:"POST"})}catch(e){const o=s();if(!o)return;fetch(`${n[o]}/api/zonos-elements/log-error`,{body:JSON.stringify(l),method:"POST"})}},c=async({response:e,shouldLog:o=!0,shouldThrow:t=!1})=>{try{return await e.json()}catch(e){if(t)throw e;return o&&console.error(e),null}},d=async({basePathType:e,options:o,path:r})=>{let s;const i=n[e]||t,a=new URL(i+r);a.searchParams.set("zToken",(e=>{try{return btoa(e).replace(/=/g,"")}catch(o){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(window.location.hostname));try{s=await fetch(a.toString(),o)}catch(e){if(e instanceof Error)return{baseUrl:i,errors:[{message:e.message,type:"unknown"}],json:null,response:null,zonosMode:null};return{baseUrl:i,errors:[{message:"Fail to fetch",type:"unknown"}],json:null,response:null,zonosMode:null}}const l=s.headers.get("Zonos-Mode"),d=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&l&&d&&(window.Zonos.modeAlerted=!0),s.ok){return{baseUrl:i,errors:[],json:await c({response:s}),response:s,zonosMode:l}}const p=s.status.toString();try{const e=await c({response:s,shouldThrow:!0});return{baseUrl:i,errors:[{message:JSON.stringify(e),type:p}],json:null,response:s,zonosMode:l}}catch(e){return{baseUrl:i,errors:[{message:`${p}: ${"Unknown error"}`,type:p}],json:null,response:null,zonosMode:l}}},p=async({basePathType:o,options:t,path:r})=>{var c,u;const m=await d({basePathType:o,options:t,path:r}),{errors:h,response:y}=m,g=e(m,["errors","response"]),f=s(o),w=!!h.find((({type:e})=>"unknown"===e))||404===(null==y?void 0:y.status),v=f&&w;return w&&l({endpoint:n[o]+r,errors:h.map((({message:e})=>e)),metadata:{currentBasePath:o,nextFallbackApiType:f,requestHeaders:null==t?void 0:t.headers,requestPayload:i(null===(c=null==t?void 0:t.body)||void 0===c?void 0:c.toString())||(null===(u=null==t?void 0:t.body)||void 0===u?void 0:u.toString()),status:null==y?void 0:y.status,statusText:null==y?void 0:y.statusText},shouldPostReleaseErrorReporting:!0}),v?(a(`=== "${r}" failed to fetch, trying next fallback ${f}`),p({basePathType:f,options:t,path:r})):Object.assign({errors:h,response:y},g)},u=async(o,n)=>{const r=e(n||{},[]),s=r.body?JSON.stringify(r.body):void 0,i=r.method||"GET",a=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},r.headers),l=Object.assign(Object.assign({},r),{body:"GET"===i?void 0:s,headers:a,method:i}),c=new URLSearchParams(window.location.search).get("useFallbackApi");return p({basePathType:c||t,options:l,path:o})},m=(e,...o)=>{a(e,"error",...o)},h=({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const o=new URL(e).origin,t=["dev.elements.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>o.includes(e))),n=["qa.js.zonos.com"].some((e=>o.includes(e)));return{currentLoadScriptUrl:o,isForceLoadVersionDomain:n,isWhiteListed:t}},y=["jsdelivr","cdnjs","unpkg","vercel"],g=e=>{const o=y.indexOf(e);return y[o+1]||null},f=()=>{const e=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||e)return null;const o=(e=>{if(!e)return null;const o=new URL(e).searchParams.get("zonosQaUrl");return o?/[^a-zA-Z0-9-_]+/.test(o)?null:o:null})(window.location.href),t="https://v1.3.50.js.zonos.com";if(!o&&(t.includes("test.")||t.includes("test-")))return t;if(!o&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!o)return null;if("dev-elements"===o)return"https://dev.elements.zonos.com";const n=`https://${o}.preview.js.zonos.com`;return a(`[ZONOS-WARNING] using '${n}' for loading script`,"warn"),fetch(n).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${n}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:o}=window.location,t=`${o}?${e.toString()}`;return window.history.replaceState(window.history.state,"",t),window.location.reload(),null})),n},w="https://js.stripe.com/v3",v=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,S="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let b=null;const z=e=>(null!==b||(b=new Promise(((o,t)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(S),window.Stripe)o(window.Stripe);else try{let n=(()=>{const e=document.querySelectorAll(`script[src^="${w}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&v.test(t.src))return t}return null})();n&&e?console.warn(S):n||(n=(e=>{const o=document.createElement("script");o.src=`${w}`;const t=document.head||document.body;return t?(t.appendChild(o),o):(m("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==n||n.addEventListener("load",(()=>{window.Stripe?o(window.Stripe):t(new Error("Stripe.js not available"))})),null==n||n.addEventListener("error",(()=>{t(new Error("Failed to load Stripe.js"))}))}catch(e){return void t(e)}else o(null)}))),b),j=Promise.resolve().then((()=>z(null)));let C=!1;j.catch((e=>{C||console.warn(e)}));var L;const O=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:o,isWhiteListed:t}=h({loadScriptSrc:null==e?void 0:e.src});return t?o:null})(),U="https://v1.3.50.js.zonos.com",k=O||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.50",E="jsdelivr",Z="https://rsms.me",T="https://fonts.googleapis.com",A=/^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;let I=class{};var $;L=I,I.doneInit=!1,I.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),I.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),I._paypalMockResponse=null,I.isBigCommerce=!1,I.releaseDate="1726504774830",I.isNpm=!0,I.zonosQaUrl=null,I.version="v1.3.50",I.modeAlerted=!1,I.tempCartData=null,I.paypal=null,I.getCurrentTimestamp=()=>(new Date).getTime(),I.zonosController=null,I.init=async({appearance:e,checkoutSettings:o,currencyConverter:t,helloSettings:n,onCountryChange:r,overrideCurrencyFormat:s,storeId:i,zonosApiKey:l})=>{L.doneInit||(a(`====== ZONOS DEBUG MODE: on (${L.version}) ======`),l?(L.zonosApiKey=l,L.storeId=i,a("init zonos"),L.injectZonosCdn(),L.injectZonosCss(),L.injectFonts(),L.injectController({config:{appearance:e,checkoutSettings:o,currencyConverter:t,helloSettings:n,onCountryChange:r,overrideCurrencyFormat:s},zonosApiKey:l}),L.doneInit=!0):m("Missing Zonos API key"))},I.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},I.openHelloDialog=e=>{const o=document.querySelector("zonos-hello");o&&o.openHelloDialog(null==e||e)},I.showNotification=e=>{var o;null===(o=L.zonosController)||void 0===o||o.showNotification(e)},I.updateOrganizationName=e=>{var o;null===(o=L.zonosController)||void 0===o||o.updateOrganizationName(e)},I.disablePlaceOrderButtons=({autoEnable:e=!0,config:o,disable:t,placeOrderButtonSelector:n})=>{var r;if(!(null===(r=o.checkoutSettings)||void 0===r?void 0:r.disablePlaceOrderButtonActivation)&&n){const o=document.querySelectorAll(n),r=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};o.forEach((e=>{e.getAttribute("data-zonos-checkout-attached")||(t?(e.setAttribute("disabled","true"),e.addEventListener("click",r)):(e.removeAttribute("disabled"),e.removeEventListener("click",r)))})),e&&t&&setTimeout((()=>{o.forEach((e=>{e.removeAttribute("disabled"),e.removeEventListener("click",r)}))}),5e3)}},I.injectController=({config:e,zonosApiKey:o})=>{var t;if(document.querySelector("zonos-controller"))return;if(null===(t=e.checkoutSettings)||void 0===t?void 0:t.placeOrderButtonSelector){const o=e.checkoutSettings.placeOrderButtonSelector;L.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o});new MutationObserver((()=>{L.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o})})).observe(document.body,{childList:!0,subtree:!0})}const n=document.createElement("zonos-controller");n.config=e,n.zonosApiKey=o,n.addEventListener("stripeInitEvent",(async e=>{const{detail:o}=e;a("loading Stripe");const t=await(async(...e)=>{C=!0;const o=Date.now();return j.then((t=>((e,o,t)=>{if(null===e)return null;const n=e.apply(void 0,o);return((e,o)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:o})})(n,t),n})(t,e,o)))})(o.publishableKey);t?(window.Zonos.stripe=t,n.initCheckoutElement(t)):m("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(n),L.zonosController=n,a("Zonos controller injected!")},I.injectScript=({cdnType:e,isModule:o,theRestUrl:t})=>{const n=`${L.getZonosUrl(e)}/${t}`;if(document.querySelector(`script[src="${n}"]`))return void a(`Zonos script "${n}" already exists in the document`,"warn");const r=document.head||document.body,s=document.createElement("script");o?s.type="module":s.noModule=!0,s.src=n,s.crossOrigin="anonymous",s.onerror=()=>{m(`Failed to load ${s.src}`);const n=g(e);n&&L.injectScript({cdnType:n,isModule:o,theRestUrl:t})},r.appendChild(s)},I.getZonosUrl=e=>{const o=()=>{switch(e){case"jsdelivr":return k;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.50";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.50";case"vercel":return U}};if(L.isNpm){return f()||o()}return o()},I.injectZonosCdn=()=>{L.injectScript({cdnType:E,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),L.injectScript({cdnType:E,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),a("Zonos cdn script injected!")},I.injectStylesheet=({cdnType:e,theRestUrl:o})=>{const t=L.getZonosUrl(e),n=document.head||document.body,r=document.createElement("link");r.rel="preconnect",r.href=`${U}/`,n.appendChild(r);const s=document.createElement("link");s.rel="stylesheet",s.href=`${t}/${o}`,s.onerror=()=>{m(`Failed to load ${s.href}`);const t=g(e);t&&L.injectStylesheet({cdnType:t,theRestUrl:o})},n.appendChild(s)},I.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?a("Zonos style links already injected","warn"):(L.injectStylesheet({cdnType:E,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),a("Zonos style css injected!"))},I.injectFonts=()=>{if((()=>{const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${Z}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&!A.test(t.href))return t}return null})())return void a("Inter font already injected","warn");const e=document.head||document.body,o=document.createElement("link");o.rel="preconnect",o.href=Z,e.appendChild(o);const t=document.createElement("link");t.rel="stylesheet",t.href=`${Z}/inter/inter.css`,e.appendChild(t),a("Zonos font injected!")},I.setupGoogleFont=e=>{var o;null===(o=L.zonosController)||void 0===o||o.setupGoogleFont(e)},I.injectSupportGoogleFont=e=>{var o;a(`[FONT] injecting ${e}`);const t=null===(o=e.match(/family=(.*?):/))||void 0===o?void 0:o[1],n=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${T}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=T,n.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${e}"]`))return void a(`[FONT] ${t} font already injected`,"warn");const r=document.createElement("link");r.rel="stylesheet",r.href=e,n.appendChild(r),a(`[FONT] ${t} font injected!`)};const D=f();class N{static get isNpm(){return!1}}$=N,N.isBigCommerce=!1,N.requested=!1,N.zonosQaUrl=null,N.tempCartData=null,N.zonosApiKey=null,N.isLegacyCheckout=!1,N.legacyStoreLogo=null,N.legacyStoreFavicon=null,N.parallelLoadTimes=[],N.paralellLoadState="off",N.releaseDate="1726504774830",N.loadScriptLogHandler=async({cdnLoadTime:e,fallbackLoadTime:o,isError:t,metadata:n,scriptLoadUrl:r,storeId:s,type:i})=>{try{const e=window.performance.getEntriesByType("resource").find((e=>{const o=e;return o.name.includes(r)&&"script"===o.initiatorType}));null==e||e.transferSize;(async e=>{})((e&&(null==e?void 0:e.duration)>0?parseFloat(e.duration.toFixed(2)):parseFloat(o.toFixed(2)),Object.assign({decodedBodySize:null==e?void 0:e.decodedBodySize,encodedBodySize:null==e?void 0:e.encodedBodySize,fallbackLoadTime:o,isError:!!t},n)))}catch(e){}},N.loadScriptLogParallelHandler=async e=>{try{if($.parallelLoadTimes.push(e),2===$.parallelLoadTimes.length){const e=$.parallelLoadTimes.find((e=>"vercel"===e.type)),o=$.parallelLoadTimes.find((e=>"jsdelivr"===e.type));if(!e||!o)return;if(e.isError&&o.isError)return void l({endpoint:`<${e.scriptLoadUrl}> <${o.scriptLoadUrl}>`,errors:["Failed to fetch both Vercel and jsdelivr CDN. Perhaps network issue on customer site."],metadata:{cdnLoadTime:o.fallbackLoadTime,cdnType:o.type,vercelLoadTime:e.fallbackLoadTime}});$.loadScriptLogHandler({cdnLoadTime:o.fallbackLoadTime,fallbackLoadTime:e.fallbackLoadTime,isError:e.isError,metadata:{cdnScriptFallbackTime:o.fallbackLoadTime,cdnScriptIsError:!!o.isError,cdnScriptLoadUrl:o.scriptLoadUrl,cdnScriptType:o.type},scriptLoadUrl:e.scriptLoadUrl,storeId:e.storeId,type:e.type})}}catch(e){}},N.legacyCheckoutErrorHandler=({message:e,tempCartUUID:o})=>{m(`[ZONOS - loadZonos] ${e}`),l({endpoint:"LegacyCheckoutInit",errors:[e],metadata:{tempCartUUID:o}}),document.dispatchEvent(new CustomEvent("legacyCheckoutError",{detail:e}))},N.getGithubCdn=({type:e,version:o})=>{let t="https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.50";"cdnjs"===e?t="https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.50":"unpkg"===e&&(t="https://unpkg.com/@zonos/elements@1.3.50");return o&&"alpha"!==o?t.replace(/@zonos\/elements@(.+)/,`@zonos/elements@${o}`).replace(/\/zonos-elements\/(.+)/,`/zonos-elements/${o}`):t},N.injectZonos=({cdnType:e=E,initConfig:o,parallelLoaded:t,vercelUrl:n,version:r})=>{var s;const i="vercel"===e?n:$.getGithubCdn({type:e,version:r}),c=D||i,d=c.replace("https://","").replace("http://",""),p=document.createElement("script"),u=r&&r<"1.2.5"?"loadZonos.js":"zonos.js";p.src=`https://${d}/dist/scripts/${u}`,a(`[ZONOS - loadZonos] Injecting "${u}" from "${d}"`,"info");const m="4g"===(null===(s=(()=>{const e="connection"in window.navigator?window.navigator.connection:null,o="mozConnection"in window.navigator?window.navigator.mozConnection:null,t="webkitConnection"in window.navigator?window.navigator.webkitConnection:null;return e||o||t})())||void 0===s?void 0:s.effectiveType),h=["dev.elements.zonos.com","zonos.com"].some((e=>window.location.href.includes(e))),f=y[0]===e,w=y[1],v="on"===$.paralellLoadState&&m&&f&&w&&!h;v&&$.injectZonos({cdnType:w,initConfig:o,parallelLoaded:!0,vercelUrl:n,version:r});const S=performance.now();p.addEventListener("load",(()=>{if(v||t?$.loadScriptLogParallelHandler({fallbackLoadTime:performance.now()-S,scriptLoadUrl:p.src,storeId:$.storeId,type:e}):$.loadScriptLogHandler({fallbackLoadTime:performance.now()-S,scriptLoadUrl:p.src,storeId:$.storeId,type:e}),$.isBigCommerce||($.isBigCommerce=!!window.stencilBootstrap||!!window.bcConfig||!!document.querySelector('script[src*="bigcommerce.com"]')),window.Zonos.isNpm=!1,window.Zonos.zonosQaUrl=D,window.Zonos.isBigCommerce=$.isBigCommerce,$.isLegacyCheckout){if(!$.zonosApiKey)throw $.legacyCheckoutErrorHandler({message:"zonosApiKey is required for legacy checkout",tempCartUUID:o.tempCartUUID}),new Error("zonosApiKey is required for legacy checkout");if(!$.tempCartData)throw $.legacyCheckoutErrorHandler({message:"tempCartData is required for legacy checkout",tempCartUUID:o.tempCartUUID}),new Error("zonosApiKey is required for legacy checkout");if($.legacyStoreFavicon){const e=document.createElement("link");e.rel="shortcut icon",e.type="image/x-icon",e.href=$.legacyStoreFavicon,document.head.appendChild(e)}window.Zonos.tempCartData=$.tempCartData;const e=Object.assign(Object.assign({},o),{appearance:Object.assign(Object.assign({},o.appearance),{logoUrl:$.legacyStoreLogo||""}),checkoutSettings:Object.assign(Object.assign({},o.checkoutSettings),{successBehavior:"ZONOS_SUCCESS_PAGE",successRedirectUrl:$.tempCartData.contShoppingURL}),zonosApiKey:$.zonosApiKey});o=e}window.Zonos.version&&(a(`[ZONOS - loadZonos] Execute "Zonos.init" from "${u}" from "${d}"`,"info"),window.Zonos.init(o))})),p.addEventListener("error",(async()=>{const s=g(e);if(!v&&!t){if(!s)return;$.injectZonos({cdnType:s,initConfig:o,vercelUrl:n,version:r})}if(["localhost",".zonos.com"].some((e=>window.location.href.includes(e)))||D)return;if(v||t)return void $.loadScriptLogParallelHandler({fallbackLoadTime:performance.now()-S,isError:!0,scriptLoadUrl:p.src,storeId:$.storeId,type:e});["unpkg","cdnjs","vercel"].includes(e)?l({endpoint:p.src,errors:[`zonos.js - Failed to fetch ${e} CDN.`],metadata:{cdnLoadTime:performance.now()-S,cdnType:e,loadUrl:c,version:r},shouldPostReleaseErrorReporting:!!s}):l({endpoint:p.src,errors:["[Info] Using alternative CDN. Failed to fetch script"],metadata:{cdnType:e,vercelLoadTime:performance.now()-S}})})),document.head.appendChild(p)},N.setupCartData=async e=>{const o=await(async e=>{const{errors:o,json:t}=await u("/api/bigcommerce/legacy-migration/get-temp-cart",{body:{tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"});return!t||o.length?null:t})(e);if(a("[ZONOS - loadZonos] getting temp cart data","info",o),!o)throw m("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),$.legacyCheckoutErrorHandler({message:"Error getting temp cart data",tempCartUUID:e}),new Error("Error getting temp cart data");return $.tempCartData=o.tempCart,$.legacyStoreLogo=o.storeLogoUrl,$.legacyStoreFavicon=o.storeFaviconUrl,{storeId:o.tempCart.storeId,zonosApiKey:o.zonosApiKey}},N.init=async e=>{var o;const t="https://v1.3.50.js.zonos.com",n=document.querySelector('script[src*="/zonos.js"]'),r=null===(o=document.querySelector("script[src*='/loadZonos.js']"))||void 0===o?void 0:o.src,s=null==r?void 0:r.includes("timestamp=");if(!($.isNpm||r&&s))return void m("[ZONOS - loadZonos] A timestamp is required as a query parameter in the loadZonos.js script source. This timestamp ensures that you are loading the most recent version of the script, avoiding any cached versions.");if(n||!r||$.requested)return void a("[ZONOS - loadZonos] script is already loaded or requested","info");$.requested=!0;let i=e.storeId;if(e.tempCartUUID){const o=await $.setupCartData(e.tempCartUUID);i=o.storeId,$.zonosApiKey=o.zonosApiKey,$.isLegacyCheckout=!0}if(!i)return a("[ZONOS - loadZonos] loading latest script since storeId is not provided."),void $.injectZonos({initConfig:e,vercelUrl:t,version:null});$.storeId=i;const l=new URLSearchParams;l.set("storeId",e.storeId.toString());const c=`/api/get-store-version?${l.toString()}`,{errors:d,json:p}=await u(c);if(d.length||!p)return a("[ZONOS - loadZonos] Error getting store version, loading the latest version.","error"),void $.injectZonos({initConfig:e,vercelUrl:t,version:null});const{version:y}=p;if(!n){const{currentLoadScriptUrl:o,isForceLoadVersionDomain:t,isWhiteListed:n}=h({loadScriptSrc:r}),s=n&&!t?o:`${"alpha"===y?"alpha":`v${y}`}.js.zonos.com`,i=n&&!t?null:y;a("[ZONOS - loadZonos] injecting zonos script","info",{currentLoadScriptUrl:o,isForceLoadVersionDomain:t,isWhiteListed:n,loadUrl:s,loadVersion:i,version:y}),$.injectZonos({initConfig:e,vercelUrl:s,version:i})}},void 0===window.Zonos&&(window.Zonos=N)})();
1
+ (function(){"use strict";function e(e,o){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&o.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var t=0;for(n=Object.getOwnPropertySymbols(e);t<n.length;t++)o.indexOf(n[t])<0&&Object.prototype.propertyIsEnumerable.call(e,n[t])&&(r[n[t]]=e[n[t]])}return r}"function"==typeof SuppressedError&&SuppressedError;const o=["cloudflare","vercel"],r=o[0],n={cloudflare:"https://route.elements.zonos.com",vercel:"https://v1.route.js.zonos.com"},t=n[r],s=(e=r)=>{const n=o.indexOf(e),t=o[n+1];return t||null},i=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},a=(e,o,...r)=>{var n,t;if(!(!!(null===(n=window.Zonos)||void 0===n?void 0:n.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===o&&console.error(e,...r));let s=document.querySelector("iframe#zonos---debug-logging-iframe");s||(s=document.createElement("iframe"),s.id="zonos---debug-logging-iframe",s.style.display="none",s.style.opacity="0",s.style.position="absolute",s.style.top="-9999px",s.style.left="-9999px",s.style.width="1px",s.style.height="1px",s.style.border="none",s.style.overflow="hidden",s.style.visibility="hidden",document.body.appendChild(s));const i=(null===(t=s.contentWindow)||void 0===t?void 0:t.window.console)||window.console;switch(o){case"warn":i.warn(e,...r);break;case"info":i.info(e,...r);break;case"error":i.error(e,...r);break;default:i.groupCollapsed(e,...r),i.trace(),i.groupEnd()}},c=async({endpoint:e,errors:o,metadata:r,shouldPostReleaseErrorReporting:i})=>{if(i){const e=Number(window.Zonos.releaseDate);if((new Date).getTime()-e>36e5)return}const a="userAgentData"in window.navigator?window.navigator.userAgentData:null,c={endpoint:e,errors:o,metadata:Object.assign({href:window.location.href,userAgent:a&&a.brands.length>0?a:window.navigator.userAgent},r)};try{fetch(`${t}/api/zonos-elements/log-error`,{body:JSON.stringify(c),method:"POST"})}catch(e){const o=s();if(!o)return;fetch(`${n[o]}/api/zonos-elements/log-error`,{body:JSON.stringify(c),method:"POST"})}},l=async({response:e,shouldLog:o=!0,shouldThrow:r=!1})=>{try{return await e.json()}catch(e){if(r)throw e;return o&&console.error(e),null}},d=async({basePathType:e,options:o,path:t})=>{let s;const i=n[e]||r,a=new URL(i+t);a.searchParams.set("zToken",(e=>{try{return btoa(e).replace(/=/g,"")}catch(o){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(window.location.hostname));try{s=await fetch(a.toString(),o)}catch(e){if(e instanceof Error)return{baseUrl:i,errors:[{message:e.message,type:"unknown"}],json:null,response:null,zonosMode:null};return{baseUrl:i,errors:[{message:"Fail to fetch",type:"unknown"}],json:null,response:null,zonosMode:null}}const c=s.headers.get("Zonos-Mode"),d=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&c&&d&&(window.Zonos.modeAlerted=!0),s.ok){return{baseUrl:i,errors:[],json:await l({response:s}),response:s,zonosMode:c}}const p=s.status.toString();try{const e=await l({response:s,shouldThrow:!0});return{baseUrl:i,errors:[{message:JSON.stringify(e),type:p}],json:null,response:s,zonosMode:c}}catch(e){return{baseUrl:i,errors:[{message:`${p}: ${"Unknown error"}`,type:p}],json:null,response:null,zonosMode:c}}},p=async({basePathType:o,options:r,path:t})=>{var l,u;const m=t.startsWith("/api/bigcommerce")?"vercel":o,g=await d({basePathType:m,options:r,path:t}),{errors:y,response:w}=g,h=e(g,["errors","response"]),f=s(m),v=!!y.find((({type:e})=>"unknown"===e))||404===(null==w?void 0:w.status),L=f&&v;return v&&c({endpoint:n[m]+t,errors:y.map((({message:e})=>e)),metadata:{currentBasePath:m,nextFallbackApiType:f,requestHeaders:null==r?void 0:r.headers,requestPayload:i(null===(l=null==r?void 0:r.body)||void 0===l?void 0:l.toString())||(null===(u=null==r?void 0:r.body)||void 0===u?void 0:u.toString()),status:null==w?void 0:w.status,statusText:null==w?void 0:w.statusText},shouldPostReleaseErrorReporting:!0}),L?(a(`=== "${t}" failed to fetch, trying next fallback ${f}`),p({basePathType:f,options:r,path:t})):Object.assign({errors:y,response:w},h)},u=async(o,n)=>{const t=e(n||{},[]),s=t.body?JSON.stringify(t.body):void 0,i=t.method||"GET",a=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},t.headers),c=Object.assign(Object.assign({},t),{body:"GET"===i?void 0:s,headers:a,method:i}),l=new URLSearchParams(window.location.search).get("useFallbackApi");return p({basePathType:l||r,options:c,path:o})},m=(e,...o)=>{a(e,"error",...o)},g=["jsdelivr","cdnjs","unpkg","vercel"],y=async e=>{const o=await(async e=>{const{errors:o,json:r}=await u("/api/zonos-elements/get-temp-cart",{body:{tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"});return!r||o.length?null:r})(e);return a("[ZONOS - loadZonos] getting temp cart data","info",o),o?{cartData:o.cartData,storeFavicon:o.storeFaviconUrl,storeId:o.cartData.storeId,storeLogo:o.storeLogoUrl,zonosApiKey:o.cartData.credentialToken}:(m("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)};var w;const h=(()=>{const e=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||e)return null;const o=(e=>{if(!e)return null;const o=new URL(e).searchParams.get("zonosQaUrl");return o?/[^a-zA-Z0-9-_]+/.test(o)?null:o:null})(window.location.href),r="https://v1.3.52.js.zonos.com";if(!o&&(r.includes("test.")||r.includes("test-")))return r;if(!o&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!o)return null;if("dev-elements"===o)return"https://dev.elements.zonos.com";const n=`https://${o}.preview.js.zonos.com`;return a(`[ZONOS-WARNING] using '${n}' for loading script`,"warn"),fetch(n).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${n}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:o}=window.location,r=`${o}?${e.toString()}`;return window.history.replaceState(window.history.state,"",r),window.location.reload(),null})),n})();class f{static get isNpm(){return!1}}w=f,f.isBigCommerce=!1,f.requested=!1,f.zonosQaUrl=null,f.cartData=null,f.isLegacyCheckout=!1,f.legacyStoreLogo=null,f.legacyStoreFavicon=null,f.parallelLoadTimes=[],f.paralellLoadState="off",f.releaseDate="1726602671461",f.loadScriptLogHandler=async({cdnLoadTime:e,fallbackLoadTime:o,isError:r,metadata:n,scriptLoadUrl:t,storeId:s,type:i})=>{try{const e=window.performance.getEntriesByType("resource").find((e=>{const o=e;return o.name.includes(t)&&"script"===o.initiatorType}));null==e||e.transferSize;(async e=>{})((e&&(null==e?void 0:e.duration)>0?parseFloat(e.duration.toFixed(2)):parseFloat(o.toFixed(2)),Object.assign({decodedBodySize:null==e?void 0:e.decodedBodySize,encodedBodySize:null==e?void 0:e.encodedBodySize,fallbackLoadTime:o,isError:!!r},n)))}catch(e){}},f.loadScriptLogParallelHandler=async e=>{try{if(w.parallelLoadTimes.push(e),2===w.parallelLoadTimes.length){const e=w.parallelLoadTimes.find((e=>"vercel"===e.type)),o=w.parallelLoadTimes.find((e=>"jsdelivr"===e.type));if(!e||!o)return;if(e.isError&&o.isError)return void c({endpoint:`<${e.scriptLoadUrl}> <${o.scriptLoadUrl}>`,errors:["Failed to fetch both Vercel and jsdelivr CDN. Perhaps network issue on customer site."],metadata:{cdnLoadTime:o.fallbackLoadTime,cdnType:o.type,vercelLoadTime:e.fallbackLoadTime}});w.loadScriptLogHandler({cdnLoadTime:o.fallbackLoadTime,fallbackLoadTime:e.fallbackLoadTime,isError:e.isError,metadata:{cdnScriptFallbackTime:o.fallbackLoadTime,cdnScriptIsError:!!o.isError,cdnScriptLoadUrl:o.scriptLoadUrl,cdnScriptType:o.type},scriptLoadUrl:e.scriptLoadUrl,storeId:e.storeId,type:e.type})}}catch(e){}},f.legacyCheckoutErrorHandler=({message:e})=>{m(`[ZONOS - loadZonos] ${e}`),c({endpoint:"LegacyCheckoutInit",errors:[e],metadata:{tempCartUUID:w.cartId}}),document.dispatchEvent(new CustomEvent("legacyCheckoutError",{detail:e}))},f.getGithubCdn=({type:e,version:o})=>{let r="https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.52";"cdnjs"===e?r="https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.52":"unpkg"===e&&(r="https://unpkg.com/@zonos/elements@1.3.52");return o&&"alpha"!==o?r.replace(/@zonos\/elements@(.+)/,`@zonos/elements@${o}`).replace(/\/zonos-elements\/(.+)/,`/zonos-elements/${o}`):r},f.injectZonos=({cdnType:e="jsdelivr",initConfig:o,parallelLoaded:r,vercelUrl:n,version:t})=>{var s;const i="vercel"===e?n:w.getGithubCdn({type:e,version:t}),l=h||i,d=l.replace("https://","").replace("http://",""),p=document.createElement("script"),u=t&&t<"1.2.5"?"loadZonos.js":"zonos.js";p.src=`https://${d}/dist/scripts/${u}`,a(`[ZONOS - loadZonos] Injecting "${u}" from "${d}"`,"info");const m="4g"===(null===(s=(()=>{const e="connection"in window.navigator?window.navigator.connection:null,o="mozConnection"in window.navigator?window.navigator.mozConnection:null,r="webkitConnection"in window.navigator?window.navigator.webkitConnection:null;return e||o||r})())||void 0===s?void 0:s.effectiveType),y=["dev.elements.zonos.com","zonos.com"].some((e=>window.location.href.includes(e))),f=g[0]===e,v=g[1],L="on"===w.paralellLoadState&&m&&f&&v&&!y;L&&w.injectZonos({cdnType:v,initConfig:o,parallelLoaded:!0,vercelUrl:n,version:t});const S=performance.now();p.addEventListener("load",(()=>{if(L||r?w.loadScriptLogParallelHandler({fallbackLoadTime:performance.now()-S,scriptLoadUrl:p.src,storeId:w.storeId,type:e}):w.loadScriptLogHandler({fallbackLoadTime:performance.now()-S,scriptLoadUrl:p.src,storeId:w.storeId,type:e}),w.isBigCommerce||(w.isBigCommerce=!!window.stencilBootstrap||!!window.bcConfig||!!document.querySelector('script[src*="bigcommerce.com"]')),window.Zonos.isNpm=!1,window.Zonos.zonosQaUrl=h,window.Zonos.isBigCommerce=w.isBigCommerce,w.cartId){if(!w.zonosApiKey)throw w.legacyCheckoutErrorHandler({message:"zonosApiKey is missing to initiate checkout"}),new Error("zonosApiKey is required for legacy checkout");if(!w.cartData)throw w.legacyCheckoutErrorHandler({message:"cartData is missing to initiate legacy checkout"}),new Error("cartData is required for legacy checkout");if(w.legacyStoreFavicon&&w.isLegacyCheckout){const e=document.createElement("link");e.rel="shortcut icon",e.type="image/x-icon",e.href=w.legacyStoreFavicon,document.head.appendChild(e)}window.Zonos.cartData=w.cartData,window.Zonos.isLegacyCheckout=w.isLegacyCheckout;const e=Object.assign(Object.assign({},o),{appearance:Object.assign(Object.assign({},o.appearance),{logoUrl:w.legacyStoreLogo||""}),checkoutSettings:Object.assign(Object.assign({},o.checkoutSettings),{successBehavior:w.isLegacyCheckout?"ZONOS_SUCCESS_PAGE":void 0,successRedirectUrl:w.isLegacyCheckout?w.cartData.storeBaseUrl:void 0}),zonosApiKey:w.zonosApiKey});o=e}window.Zonos.version&&(a(`[ZONOS - loadZonos] Execute "Zonos.init" from "${u}" from "${d}"`,"info"),window.Zonos.init(o))})),p.addEventListener("error",(async()=>{const s=(e=>{const o=g.indexOf(e);return g[o+1]||null})(e);if(!L&&!r){if(!s)return;w.injectZonos({cdnType:s,initConfig:o,vercelUrl:n,version:t})}if(["localhost",".zonos.com"].some((e=>window.location.href.includes(e)))||h)return;if(L||r)return void w.loadScriptLogParallelHandler({fallbackLoadTime:performance.now()-S,isError:!0,scriptLoadUrl:p.src,storeId:w.storeId,type:e});["unpkg","cdnjs","vercel"].includes(e)?c({endpoint:p.src,errors:[`zonos.js - Failed to fetch ${e} CDN.`],metadata:{cdnLoadTime:performance.now()-S,cdnType:e,loadUrl:l,version:t},shouldPostReleaseErrorReporting:!!s}):c({endpoint:p.src,errors:["[Info] Using alternative CDN. Failed to fetch script"],metadata:{cdnType:e,vercelLoadTime:performance.now()-S}})})),document.head.appendChild(p)},f.init=async e=>{var o;w.cartId=new URLSearchParams(window.location.search).get("tempCartUUID");const r="https://v1.3.52.js.zonos.com",n=document.querySelector('script[src*="/zonos.js"]'),t=null===(o=document.querySelector("script[src*='/loadZonos.js']"))||void 0===o?void 0:o.src,s=null==t?void 0:t.includes("timestamp=");if(!(w.isNpm||t&&s))return void m("[ZONOS - loadZonos] A timestamp is required as a query parameter in the loadZonos.js script source. This timestamp ensures that you are loading the most recent version of the script, avoiding any cached versions.");if(n||!t||w.requested)return void a("[ZONOS - loadZonos] script is already loaded or requested","info");if(!e.zonosApiKey&&!w.cartId)return w.legacyCheckoutErrorHandler({message:"Zonos API key is required unless `tempCartUUID` is provided in url query params."}),void m("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(w.requested=!0,w.zonosApiKey=e.zonosApiKey,w.storeId=e.storeId,w.cartId){const e=await y(w.cartId);if(!e)throw w.legacyCheckoutErrorHandler({message:"Error getting cart data"}),new Error("Error getting cart data");w.cartData=e.cartData,w.zonosApiKey=e.zonosApiKey,w.legacyStoreLogo=e.storeLogo,w.legacyStoreFavicon=e.storeFavicon,w.storeId=e.storeId,w.zonosApiKey=e.zonosApiKey}if(!w.zonosApiKey)return void m('"zonosApiKey" is required to initialize Zonos');if(!w.storeId)return a("[ZONOS - loadZonos] loading latest script since storeId is not provided."),void w.injectZonos({initConfig:e,vercelUrl:r,version:null});const i=new URLSearchParams;i.set("storeId",e.storeId.toString());const c=`/api/get-store-version?${i.toString()}`,{errors:l,json:d}=await u(c);if(l.length||!d)return a("[ZONOS - loadZonos] Error getting store version, loading the latest version.","error"),void w.injectZonos({initConfig:e,vercelUrl:r,version:null});const{version:p}=d;if(!n){const{currentLoadScriptUrl:o,isForceLoadVersionDomain:r,isWhiteListed:n}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const o=new URL(e).origin,r=["dev.elements.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>o.includes(e))),n=["qa.js.zonos.com"].some((e=>o.includes(e)));return{currentLoadScriptUrl:o,isForceLoadVersionDomain:n,isWhiteListed:r}})({loadScriptSrc:t}),s=n&&!r?o:`${"alpha"===p?"alpha":`v${p}`}.js.zonos.com`,i=n&&!r?null:p;a("[ZONOS - loadZonos] injecting zonos script","info",{currentLoadScriptUrl:o,isForceLoadVersionDomain:r,isWhiteListed:n,loadUrl:s,loadVersion:i,version:p}),w.injectZonos({initConfig:e,vercelUrl:s,version:i})}},void 0===window.Zonos&&(window.Zonos=f)})();
@@ -1 +1 @@
1
- (function(){"use strict";const e=(e,t,...n)=>{var o,r;if(!(!!(null===(o=window.Zonos)||void 0===o?void 0:o.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===t&&console.error(e,...n));let s=document.querySelector("iframe#zonos---debug-logging-iframe");s||(s=document.createElement("iframe"),s.id="zonos---debug-logging-iframe",s.style.display="none",s.style.opacity="0",s.style.position="absolute",s.style.top="-9999px",s.style.left="-9999px",s.style.width="1px",s.style.height="1px",s.style.border="none",s.style.overflow="hidden",s.style.visibility="hidden",document.body.appendChild(s));const i=(null===(r=s.contentWindow)||void 0===r?void 0:r.window.console)||window.console;switch(t){case"warn":i.warn(e,...n);break;case"info":i.info(e,...n);break;case"error":i.error(e,...n);break;default:i.groupCollapsed(e,...n),i.trace(),i.groupEnd()}},t=(t,...n)=>{e(t,"error",...n)},n=["jsdelivr","cdnjs","unpkg","vercel"],o=e=>{const t=n.indexOf(e);return n[t+1]||null},r=()=>{const t=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||t)return null;const n=(e=>{if(!e)return null;const t=new URL(e).searchParams.get("zonosQaUrl");return t?/[^a-zA-Z0-9-_]+/.test(t)?null:t:null})(window.location.href),o="https://v1.3.50.js.zonos.com";if(!n&&(o.includes("test.")||o.includes("test-")))return o;if(!n&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!n)return null;if("dev-elements"===n)return"https://dev.elements.zonos.com";const r=`https://${n}.preview.js.zonos.com`;return e(`[ZONOS-WARNING] using '${r}' for loading script`,"warn"),fetch(r).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${r}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:t}=window.location,n=`${t}?${e.toString()}`;return window.history.replaceState(window.history.state,"",n),window.location.reload(),null})),r},s="https://js.stripe.com/v3",i=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,l="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let c=null;const d=e=>(null!==c||(c=new Promise(((n,o)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(l),window.Stripe)n(window.Stripe);else try{let r=(()=>{const e=document.querySelectorAll(`script[src^="${s}"]`);for(let t=0;t<e.length;t++){const n=e[t];if(n&&i.test(n.src))return n}return null})();r&&e?console.warn(l):r||(r=(e=>{const n=document.createElement("script");n.src=`${s}`;const o=document.head||document.body;return o?(o.appendChild(n),n):(t("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==r||r.addEventListener("load",(()=>{window.Stripe?n(window.Stripe):o(new Error("Stripe.js not available"))})),null==r||r.addEventListener("error",(()=>{o(new Error("Failed to load Stripe.js"))}))}catch(e){return void o(e)}else n(null)}))),c),a=Promise.resolve().then((()=>d(null)));let u=!1;a.catch((e=>{u||console.warn(e)}));var p;const m=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:t,isWhiteListed:n}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const t=new URL(e).origin,n=["dev.elements.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>t.includes(e))),o=["qa.js.zonos.com"].some((e=>t.includes(e)));return{currentLoadScriptUrl:t,isForceLoadVersionDomain:o,isWhiteListed:n}})({loadScriptSrc:null==e?void 0:e.src});return n?t:null})(),h="https://v1.3.50.js.zonos.com",y=m||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.50",w="jsdelivr",f="https://rsms.me",v="https://fonts.googleapis.com",g=/^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;class S{}p=S,S.doneInit=!1,S.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),S.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),S._paypalMockResponse=null,S.isBigCommerce=!1,S.releaseDate="1726504774830",S.isNpm=!0,S.zonosQaUrl=null,S.version="v1.3.50",S.modeAlerted=!1,S.tempCartData=null,S.paypal=null,S.getCurrentTimestamp=()=>(new Date).getTime(),S.zonosController=null,S.init=async({appearance:n,checkoutSettings:o,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:l,storeId:c,zonosApiKey:d})=>{p.doneInit||(e(`====== ZONOS DEBUG MODE: on (${p.version}) ======`),d?(p.zonosApiKey=d,p.storeId=c,e("init zonos"),p.injectZonosCdn(),p.injectZonosCss(),p.injectFonts(),p.injectController({config:{appearance:n,checkoutSettings:o,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:l},zonosApiKey:d}),p.doneInit=!0):t("Missing Zonos API key"))},S.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},S.openHelloDialog=e=>{const t=document.querySelector("zonos-hello");t&&t.openHelloDialog(null==e||e)},S.showNotification=e=>{var t;null===(t=p.zonosController)||void 0===t||t.showNotification(e)},S.updateOrganizationName=e=>{var t;null===(t=p.zonosController)||void 0===t||t.updateOrganizationName(e)},S.disablePlaceOrderButtons=({autoEnable:e=!0,config:t,disable:n,placeOrderButtonSelector:o})=>{var r;if(!(null===(r=t.checkoutSettings)||void 0===r?void 0:r.disablePlaceOrderButtonActivation)&&o){const t=document.querySelectorAll(o),r=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};t.forEach((e=>{e.getAttribute("data-zonos-checkout-attached")||(n?(e.setAttribute("disabled","true"),e.addEventListener("click",r)):(e.removeAttribute("disabled"),e.removeEventListener("click",r)))})),e&&n&&setTimeout((()=>{t.forEach((e=>{e.removeAttribute("disabled"),e.removeEventListener("click",r)}))}),5e3)}},S.injectController=({config:n,zonosApiKey:o})=>{var r;if(document.querySelector("zonos-controller"))return;if(null===(r=n.checkoutSettings)||void 0===r?void 0:r.placeOrderButtonSelector){const e=n.checkoutSettings.placeOrderButtonSelector;p.disablePlaceOrderButtons({config:n,disable:!0,placeOrderButtonSelector:e});new MutationObserver((()=>{p.disablePlaceOrderButtons({config:n,disable:!0,placeOrderButtonSelector:e})})).observe(document.body,{childList:!0,subtree:!0})}const s=document.createElement("zonos-controller");s.config=n,s.zonosApiKey=o,s.addEventListener("stripeInitEvent",(async n=>{const{detail:o}=n;e("loading Stripe");const r=await(async(...e)=>{u=!0;const t=Date.now();return a.then((n=>((e,t,n)=>{if(null===e)return null;const o=e.apply(void 0,t);return((e,t)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:t})})(o,n),o})(n,e,t)))})(o.publishableKey);r?(window.Zonos.stripe=r,s.initCheckoutElement(r)):t("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(s),p.zonosController=s,e("Zonos controller injected!")},S.injectScript=({cdnType:n,isModule:r,theRestUrl:s})=>{const i=`${p.getZonosUrl(n)}/${s}`;if(document.querySelector(`script[src="${i}"]`))return void e(`Zonos script "${i}" already exists in the document`,"warn");const l=document.head||document.body,c=document.createElement("script");r?c.type="module":c.noModule=!0,c.src=i,c.crossOrigin="anonymous",c.onerror=()=>{t(`Failed to load ${c.src}`);const e=o(n);e&&p.injectScript({cdnType:e,isModule:r,theRestUrl:s})},l.appendChild(c)},S.getZonosUrl=e=>{const t=()=>{switch(e){case"jsdelivr":return y;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.50";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.50";case"vercel":return h}};if(p.isNpm){return r()||t()}return t()},S.injectZonosCdn=()=>{p.injectScript({cdnType:w,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),p.injectScript({cdnType:w,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),e("Zonos cdn script injected!")},S.injectStylesheet=({cdnType:e,theRestUrl:n})=>{const r=p.getZonosUrl(e),s=document.head||document.body,i=document.createElement("link");i.rel="preconnect",i.href=`${h}/`,s.appendChild(i);const l=document.createElement("link");l.rel="stylesheet",l.href=`${r}/${n}`,l.onerror=()=>{t(`Failed to load ${l.href}`);const r=o(e);r&&p.injectStylesheet({cdnType:r,theRestUrl:n})},s.appendChild(l)},S.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?e("Zonos style links already injected","warn"):(p.injectStylesheet({cdnType:w,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),e("Zonos style css injected!"))},S.injectFonts=()=>{if((()=>{const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${f}"]`);for(let t=0;t<e.length;t++){const n=e[t];if(n&&!g.test(n.href))return n}return null})())return void e("Inter font already injected","warn");const t=document.head||document.body,n=document.createElement("link");n.rel="preconnect",n.href=f,t.appendChild(n);const o=document.createElement("link");o.rel="stylesheet",o.href=`${f}/inter/inter.css`,t.appendChild(o),e("Zonos font injected!")},S.setupGoogleFont=e=>{var t;null===(t=p.zonosController)||void 0===t||t.setupGoogleFont(e)},S.injectSupportGoogleFont=t=>{var n;e(`[FONT] injecting ${t}`);const o=null===(n=t.match(/family=(.*?):/))||void 0===n?void 0:n[1],r=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${v}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=v,r.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${t}"]`))return void e(`[FONT] ${o} font already injected`,"warn");const s=document.createElement("link");s.rel="stylesheet",s.href=t,r.appendChild(s),e(`[FONT] ${o} font injected!`)},window.Zonos&&window.Zonos.doneInit||(window.Zonos=S)})();
1
+ (function(){"use strict";const e=(e,t,...o)=>{var n,r;if(!(!!(null===(n=window.Zonos)||void 0===n?void 0:n.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===t&&console.error(e,...o));let s=document.querySelector("iframe#zonos---debug-logging-iframe");s||(s=document.createElement("iframe"),s.id="zonos---debug-logging-iframe",s.style.display="none",s.style.opacity="0",s.style.position="absolute",s.style.top="-9999px",s.style.left="-9999px",s.style.width="1px",s.style.height="1px",s.style.border="none",s.style.overflow="hidden",s.style.visibility="hidden",document.body.appendChild(s));const i=(null===(r=s.contentWindow)||void 0===r?void 0:r.window.console)||window.console;switch(t){case"warn":i.warn(e,...o);break;case"info":i.info(e,...o);break;case"error":i.error(e,...o);break;default:i.groupCollapsed(e,...o),i.trace(),i.groupEnd()}},t=(t,...o)=>{e(t,"error",...o)},o=["jsdelivr","cdnjs","unpkg","vercel"],n="jsdelivr",r=e=>{const t=o.indexOf(e);return o[t+1]||null},s=()=>{const t=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||t)return null;const o=(e=>{if(!e)return null;const t=new URL(e).searchParams.get("zonosQaUrl");return t?/[^a-zA-Z0-9-_]+/.test(t)?null:t:null})(window.location.href),n="https://v1.3.52.js.zonos.com";if(!o&&(n.includes("test.")||n.includes("test-")))return n;if(!o&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!o)return null;if("dev-elements"===o)return"https://dev.elements.zonos.com";const r=`https://${o}.preview.js.zonos.com`;return e(`[ZONOS-WARNING] using '${r}' for loading script`,"warn"),fetch(r).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${r}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:t}=window.location,o=`${t}?${e.toString()}`;return window.history.replaceState(window.history.state,"",o),window.location.reload(),null})),r},i="https://js.stripe.com/v3",l=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,a="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let c=null;const d=e=>(null!==c||(c=new Promise(((o,n)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(a),window.Stripe)o(window.Stripe);else try{let r=(()=>{const e=document.querySelectorAll(`script[src^="${i}"]`);for(let t=0;t<e.length;t++){const o=e[t];if(o&&l.test(o.src))return o}return null})();r&&e?console.warn(a):r||(r=(e=>{const o=document.createElement("script");o.src=`${i}`;const n=document.head||document.body;return n?(n.appendChild(o),o):(t("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==r||r.addEventListener("load",(()=>{window.Stripe?o(window.Stripe):n(new Error("Stripe.js not available"))})),null==r||r.addEventListener("error",(()=>{n(new Error("Failed to load Stripe.js"))}))}catch(e){return void n(e)}else o(null)}))),c),u=Promise.resolve().then((()=>d(null)));let p=!1;u.catch((e=>{p||console.warn(e)}));function m(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}"function"==typeof SuppressedError&&SuppressedError;const h=["cloudflare","vercel"],y=h[0],w={cloudflare:"https://route.elements.zonos.com",vercel:"https://v1.route.js.zonos.com"},g=w[y],f=(e=y)=>{const t=h.indexOf(e),o=h[t+1];return o||null},v=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},b=async({response:e,shouldLog:t=!0,shouldThrow:o=!1})=>{try{return await e.json()}catch(e){if(o)throw e;return t&&console.error(e),null}},S=async({basePathType:e,options:t,path:o})=>{let n;const r=w[e]||y,s=new URL(r+o);s.searchParams.set("zToken",(e=>{try{return btoa(e).replace(/=/g,"")}catch(t){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(window.location.hostname));try{n=await fetch(s.toString(),t)}catch(e){if(e instanceof Error)return{baseUrl:r,errors:[{message:e.message,type:"unknown"}],json:null,response:null,zonosMode:null};return{baseUrl:r,errors:[{message:"Fail to fetch",type:"unknown"}],json:null,response:null,zonosMode:null}}const i=n.headers.get("Zonos-Mode"),l=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&i&&l&&(window.Zonos.modeAlerted=!0),n.ok){return{baseUrl:r,errors:[],json:await b({response:n}),response:n,zonosMode:i}}const a=n.status.toString();try{const e=await b({response:n,shouldThrow:!0});return{baseUrl:r,errors:[{message:JSON.stringify(e),type:a}],json:null,response:n,zonosMode:i}}catch(e){return{baseUrl:r,errors:[{message:`${a}: ${"Unknown error"}`,type:a}],json:null,response:null,zonosMode:i}}},z=async({basePathType:t,options:o,path:n})=>{var r,s;const i=n.startsWith("/api/bigcommerce")?"vercel":t,l=await S({basePathType:i,options:o,path:n}),{errors:a,response:c}=l,d=m(l,["errors","response"]),u=f(i),p=!!a.find((({type:e})=>"unknown"===e))||404===(null==c?void 0:c.status),h=u&&p;return p&&(async({endpoint:e,errors:t,metadata:o,shouldPostReleaseErrorReporting:n})=>{if(n){const e=Number(window.Zonos.releaseDate);if((new Date).getTime()-e>36e5)return}const r="userAgentData"in window.navigator?window.navigator.userAgentData:null,s={endpoint:e,errors:t,metadata:Object.assign({href:window.location.href,userAgent:r&&r.brands.length>0?r:window.navigator.userAgent},o)};try{fetch(`${g}/api/zonos-elements/log-error`,{body:JSON.stringify(s),method:"POST"})}catch(e){const t=f();if(!t)return;fetch(`${w[t]}/api/zonos-elements/log-error`,{body:JSON.stringify(s),method:"POST"})}})({endpoint:w[i]+n,errors:a.map((({message:e})=>e)),metadata:{currentBasePath:i,nextFallbackApiType:u,requestHeaders:null==o?void 0:o.headers,requestPayload:v(null===(r=null==o?void 0:o.body)||void 0===r?void 0:r.toString())||(null===(s=null==o?void 0:o.body)||void 0===s?void 0:s.toString()),status:null==c?void 0:c.status,statusText:null==c?void 0:c.statusText},shouldPostReleaseErrorReporting:!0}),h?(e(`=== "${n}" failed to fetch, trying next fallback ${u}`),z({basePathType:u,options:o,path:n})):Object.assign({errors:a,response:c},d)},j=async e=>{const{errors:t,json:o}=await(async(e,t)=>{const o=m(t||{},[]),n=o.body?JSON.stringify(o.body):void 0,r=o.method||"GET",s=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},o.headers),i=Object.assign(Object.assign({},o),{body:"GET"===r?void 0:n,headers:s,method:r}),l=new URLSearchParams(window.location.search).get("useFallbackApi");return z({basePathType:l||y,options:i,path:e})})("/api/zonos-elements/get-temp-cart",{body:{tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"});return!o||t.length?null:o};var O;const C=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:t,isWhiteListed:o}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const t=new URL(e).origin,o=["dev.elements.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>t.includes(e))),n=["qa.js.zonos.com"].some((e=>t.includes(e)));return{currentLoadScriptUrl:t,isForceLoadVersionDomain:n,isWhiteListed:o}})({loadScriptSrc:null==e?void 0:e.src});return o?t:null})(),k="https://v1.3.52.js.zonos.com",E=C||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.52",A="https://rsms.me",Z="https://fonts.googleapis.com",U=/^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;class T{}O=T,T.doneInit=!1,T.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),T.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),T._paypalMockResponse=null,T.isBigCommerce=!1,T.releaseDate="1726602671461",T.isLegacyCheckout=!1,T.isNpm=!0,T.zonosQaUrl=null,T.version="v1.3.52",T.modeAlerted=!1,T.cartData=null,T.paypal=null,T.getCurrentTimestamp=()=>(new Date).getTime(),T.zonosController=null,T.init=async({appearance:o,checkoutSettings:n,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:l,storeId:a,zonosApiKey:c})=>{if(O.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),!O.doneInit){if(e(`====== ZONOS DEBUG MODE: on (${O.version}) ======`),O.zonosApiKey=c,O.storeId=a,O.isNpm){if(e("====== ZONOS LOADING FROM NPM ======"),!c&&!O.cartId)return void t("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!O.cartData&&O.cartId){e("Initialize cart data");const o=await(async o=>{const n=await j(o);return e("[ZONOS - loadZonos] getting temp cart data","info",n),n?{cartData:n.cartData,storeFavicon:n.storeFaviconUrl,storeId:n.cartData.storeId,storeLogo:n.storeLogoUrl,zonosApiKey:n.cartData.credentialToken}:(t("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)})(O.cartId);if(!o)return void t("Failed to get cart data");O.cartData=o.cartData,O.zonosApiKey=o.zonosApiKey}}if(O.cartId&&O.cartData){e("Cart data is available, inject hidden button and trigger checkout");const t=document.createElement("button");t.style.display="none",t.id="zonos--checkout-hidden-button",document.body.appendChild(t)}e("init zonos"),O.injectZonosCdn(),O.injectZonosCss(),O.injectFonts(),O.injectController({config:{appearance:o,checkoutSettings:n,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:l}}),O.doneInit=!0}},T.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},T.openHelloDialog=e=>{const t=document.querySelector("zonos-hello");t&&t.openHelloDialog(null==e||e)},T.showNotification=e=>{var t;null===(t=O.zonosController)||void 0===t||t.showNotification(e)},T.updateOrganizationName=e=>{var t;null===(t=O.zonosController)||void 0===t||t.updateOrganizationName(e)},T.disablePlaceOrderButtons=({autoEnable:e=!0,config:t,disable:o,placeOrderButtonSelector:n})=>{var r;if(!(null===(r=t.checkoutSettings)||void 0===r?void 0:r.disablePlaceOrderButtonActivation)&&n){const t=document.querySelectorAll(n),r=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};t.forEach((e=>{e.getAttribute("data-zonos-checkout-attached")||(o?(e.setAttribute("disabled","true"),e.addEventListener("click",r)):(e.removeAttribute("disabled"),e.removeEventListener("click",r)))})),e&&o&&setTimeout((()=>{t.forEach((e=>{e.removeAttribute("disabled"),e.removeEventListener("click",r)}))}),5e3)}},T.injectController=({config:o})=>{var n;if(document.querySelector("zonos-controller"))return;if(null===(n=o.checkoutSettings)||void 0===n?void 0:n.placeOrderButtonSelector){const e=o.checkoutSettings.placeOrderButtonSelector;O.disablePlaceOrderButtons({config:o,disable:!0,placeOrderButtonSelector:e});new MutationObserver((()=>{O.disablePlaceOrderButtons({config:o,disable:!0,placeOrderButtonSelector:e})})).observe(document.body,{childList:!0,subtree:!0})}const r=document.createElement("zonos-controller");r.config=o,r.zonosApiKey=O.zonosApiKey||"",r.addEventListener("stripeInitEvent",(async o=>{const{detail:n}=o;e("loading Stripe");const s=await(async(...e)=>{p=!0;const t=Date.now();return u.then((o=>((e,t,o)=>{if(null===e)return null;const n=e.apply(void 0,t);return((e,t)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:t})})(n,o),n})(o,e,t)))})(n.publishableKey);s?(window.Zonos.stripe=s,r.initCheckoutElement(s)):t("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(r),O.zonosController=r,e("Zonos controller injected!")},T.injectScript=({cdnType:o,isModule:n,theRestUrl:s})=>{const i=`${O.getZonosUrl(o)}/${s}`;if(document.querySelector(`script[src="${i}"]`))return void e(`Zonos script "${i}" already exists in the document`,"warn");const l=document.head||document.body,a=document.createElement("script");n?a.type="module":a.noModule=!0,a.src=i,a.crossOrigin="anonymous",a.onerror=()=>{t(`Failed to load ${a.src}`);const e=r(o);e&&O.injectScript({cdnType:e,isModule:n,theRestUrl:s})},l.appendChild(a)},T.getZonosUrl=e=>{const t=()=>{switch(e){case"jsdelivr":return E;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.52";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.52";case"vercel":return k}};if(O.isNpm){return s()||t()}return t()},T.injectZonosCdn=()=>{O.injectScript({cdnType:n,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),O.injectScript({cdnType:n,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),e("Zonos cdn script injected!")},T.injectStylesheet=({cdnType:e,theRestUrl:o})=>{const n=O.getZonosUrl(e),s=document.head||document.body,i=document.createElement("link");i.rel="preconnect",i.href=`${k}/`,s.appendChild(i);const l=document.createElement("link");l.rel="stylesheet",l.href=`${n}/${o}`,l.onerror=()=>{t(`Failed to load ${l.href}`);const n=r(e);n&&O.injectStylesheet({cdnType:n,theRestUrl:o})},s.appendChild(l)},T.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?e("Zonos style links already injected","warn"):(O.injectStylesheet({cdnType:n,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),e("Zonos style css injected!"))},T.injectFonts=()=>{if((()=>{const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${A}"]`);for(let t=0;t<e.length;t++){const o=e[t];if(o&&!U.test(o.href))return o}return null})())return void e("Inter font already injected","warn");const t=document.head||document.body,o=document.createElement("link");o.rel="preconnect",o.href=A,t.appendChild(o);const n=document.createElement("link");n.rel="stylesheet",n.href=`${A}/inter/inter.css`,t.appendChild(n),e("Zonos font injected!")},T.setupGoogleFont=e=>{var t;null===(t=O.zonosController)||void 0===t||t.setupGoogleFont(e)},T.injectSupportGoogleFont=t=>{var o;e(`[FONT] injecting ${t}`);const n=null===(o=t.match(/family=(.*?):/))||void 0===o?void 0:o[1],r=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${Z}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=Z,r.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${t}"]`))return void e(`[FONT] ${n} font already injected`,"warn");const s=document.createElement("link");s.rel="stylesheet",s.href=t,r.appendChild(s),e(`[FONT] ${n} font injected!`)},window.Zonos&&window.Zonos.doneInit||(window.Zonos=T)})();