@zonos/elements 1.3.27 → 1.3.29

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 (130) hide show
  1. package/dist/cjs/{cart-61caeb84.js → cart-62ff7ee7.js} +40 -40
  2. package/dist/cjs/index.cjs.js +3 -3
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/cjs/{submitGtag-d3898668.js → submitGtag-a5f8eaab.js} +1 -1
  5. package/dist/cjs/zonos-address_8.cjs.entry.js +1 -1
  6. package/dist/cjs/zonos-card_2.cjs.entry.js +1 -1
  7. package/dist/cjs/zonos-cart-items_12.cjs.entry.js +2 -2
  8. package/dist/cjs/zonos-checkout.cjs.entry.js +2 -2
  9. package/dist/cjs/zonos-controller.cjs.entry.js +1 -1
  10. package/dist/cjs/zonos-country-flag.cjs.entry.js +1 -1
  11. package/dist/cjs/zonos-country-select_3.cjs.entry.js +1 -1
  12. package/dist/cjs/zonos-elements.cjs.js +1 -1
  13. package/dist/cjs/zonos-hello-dialog.cjs.entry.js +6 -6
  14. package/dist/cjs/zonos-hello.cjs.entry.js +30 -3
  15. package/dist/cjs/zonos-payment.cjs.entry.js +1 -1
  16. package/dist/collection/components/hello/zonos-hello/zonos-hello.js +31 -3
  17. package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog.js +5 -5
  18. package/dist/collection/components/store/translationStore/strings.arabic.js +2 -2
  19. package/dist/collection/components/store/translationStore/strings.base.js +2 -2
  20. package/dist/collection/components/store/translationStore/strings.chinese.js +2 -2
  21. package/dist/collection/components/store/translationStore/strings.danish.js +2 -2
  22. package/dist/collection/components/store/translationStore/strings.dutch.js +2 -2
  23. package/dist/collection/components/store/translationStore/strings.french.js +2 -2
  24. package/dist/collection/components/store/translationStore/strings.german.js +2 -2
  25. package/dist/collection/components/store/translationStore/strings.hebrew.js +2 -2
  26. package/dist/collection/components/store/translationStore/strings.indonesian.js +2 -2
  27. package/dist/collection/components/store/translationStore/strings.italian.js +2 -2
  28. package/dist/collection/components/store/translationStore/strings.japanese.js +2 -2
  29. package/dist/collection/components/store/translationStore/strings.korean.js +2 -2
  30. package/dist/collection/components/store/translationStore/strings.norwegian.js +2 -2
  31. package/dist/collection/components/store/translationStore/strings.polish.js +2 -2
  32. package/dist/collection/components/store/translationStore/strings.portuguese.js +2 -2
  33. package/dist/collection/components/store/translationStore/strings.russian.js +2 -2
  34. package/dist/collection/components/store/translationStore/strings.spanish.js +2 -2
  35. package/dist/collection/components/store/translationStore/strings.swedish.js +2 -2
  36. package/dist/collection/components/store/translationStore/strings.turkish.js +2 -2
  37. package/dist/collection/components/store/translationStore/strings.vietnamese.js +2 -2
  38. package/dist/esm/{cart-530a8750.js → cart-b96aaa4f.js} +40 -40
  39. package/dist/esm/index.js +3 -3
  40. package/dist/esm/loader.js +1 -1
  41. package/dist/esm/{submitGtag-44ba0846.js → submitGtag-6e271d76.js} +1 -1
  42. package/dist/esm/zonos-address_8.entry.js +1 -1
  43. package/dist/esm/zonos-card_2.entry.js +1 -1
  44. package/dist/esm/zonos-cart-items_12.entry.js +2 -2
  45. package/dist/esm/zonos-checkout.entry.js +2 -2
  46. package/dist/esm/zonos-controller.entry.js +1 -1
  47. package/dist/esm/zonos-country-flag.entry.js +1 -1
  48. package/dist/esm/zonos-country-select_3.entry.js +1 -1
  49. package/dist/esm/zonos-elements.js +1 -1
  50. package/dist/esm/zonos-hello-dialog.entry.js +6 -6
  51. package/dist/esm/zonos-hello.entry.js +30 -3
  52. package/dist/esm/zonos-payment.entry.js +1 -1
  53. package/dist/esm-es5/cart-b96aaa4f.js +1 -0
  54. package/dist/esm-es5/index.js +1 -1
  55. package/dist/esm-es5/loader.js +1 -1
  56. package/dist/esm-es5/{submitGtag-44ba0846.js → submitGtag-6e271d76.js} +1 -1
  57. package/dist/esm-es5/zonos-address_8.entry.js +1 -1
  58. package/dist/esm-es5/zonos-card_2.entry.js +1 -1
  59. package/dist/esm-es5/zonos-cart-items_12.entry.js +1 -1
  60. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  61. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  62. package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
  63. package/dist/esm-es5/zonos-country-select_3.entry.js +1 -1
  64. package/dist/esm-es5/zonos-elements.js +1 -1
  65. package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
  66. package/dist/esm-es5/zonos-hello.entry.js +1 -1
  67. package/dist/esm-es5/zonos-payment.entry.js +1 -1
  68. package/dist/scripts/index.d.ts +11 -2
  69. package/dist/scripts/index.js +1 -1
  70. package/dist/scripts/loadZonos.js +1 -1
  71. package/dist/scripts/zonos.js +1 -1
  72. package/dist/types/components/hello/zonos-hello/zonos-hello.d.ts +8 -0
  73. package/dist/types/components/store/translationStore/strings.arabic.d.ts +1 -1
  74. package/dist/types/components/store/translationStore/strings.base.d.ts +1 -1
  75. package/dist/types/components/store/translationStore/strings.chinese.d.ts +1 -1
  76. package/dist/types/components/store/translationStore/strings.danish.d.ts +1 -1
  77. package/dist/types/components/store/translationStore/strings.dutch.d.ts +1 -1
  78. package/dist/types/components/store/translationStore/strings.french.d.ts +1 -1
  79. package/dist/types/components/store/translationStore/strings.german.d.ts +1 -1
  80. package/dist/types/components/store/translationStore/strings.hebrew.d.ts +1 -1
  81. package/dist/types/components/store/translationStore/strings.indonesian.d.ts +1 -1
  82. package/dist/types/components/store/translationStore/strings.italian.d.ts +1 -1
  83. package/dist/types/components/store/translationStore/strings.japanese.d.ts +1 -1
  84. package/dist/types/components/store/translationStore/strings.korean.d.ts +1 -1
  85. package/dist/types/components/store/translationStore/strings.norwegian.d.ts +1 -1
  86. package/dist/types/components/store/translationStore/strings.polish.d.ts +1 -1
  87. package/dist/types/components/store/translationStore/strings.portuguese.d.ts +1 -1
  88. package/dist/types/components/store/translationStore/strings.russian.d.ts +1 -1
  89. package/dist/types/components/store/translationStore/strings.spanish.d.ts +1 -1
  90. package/dist/types/components/store/translationStore/strings.swedish.d.ts +1 -1
  91. package/dist/types/components/store/translationStore/strings.turkish.d.ts +1 -1
  92. package/dist/types/components/store/translationStore/strings.vietnamese.d.ts +1 -1
  93. package/dist/types/components/store/translationStore.d.ts +1 -1
  94. package/dist/types/types/checkout/CheckoutConfig.d.ts +2 -2
  95. package/dist/types/types/hello/HelloConfig.d.ts +10 -1
  96. package/dist/zonos-elements/assets/RemoveIcon.svg +1 -1
  97. package/dist/zonos-elements/index.esm.js +1 -1
  98. package/dist/zonos-elements/{p-5f580c9b.system.entry.js → p-087c83a5.system.entry.js} +1 -1
  99. package/dist/zonos-elements/{p-5d006b02.system.js → p-0e6f0bac.system.js} +1 -1
  100. package/dist/zonos-elements/{p-84f7a3a2.system.entry.js → p-10b9a681.system.entry.js} +1 -1
  101. package/dist/zonos-elements/p-1a40aaf4.system.js +1 -0
  102. package/dist/zonos-elements/{p-a5704be4.system.entry.js → p-2613b5d3.system.entry.js} +1 -1
  103. package/dist/zonos-elements/{p-094bfe56.system.entry.js → p-2cb880e7.system.entry.js} +1 -1
  104. package/dist/zonos-elements/{p-2a5a0bae.entry.js → p-4a0cf47b.entry.js} +1 -1
  105. package/dist/zonos-elements/{p-cbed004d.system.entry.js → p-4e01d1ab.system.entry.js} +1 -1
  106. package/dist/zonos-elements/{p-4eaae82e.entry.js → p-5b4c1c09.entry.js} +1 -1
  107. package/dist/zonos-elements/p-5d53f9a4.js +1 -0
  108. package/dist/zonos-elements/{p-e15ef12e.system.entry.js → p-666d1605.system.entry.js} +1 -1
  109. package/dist/zonos-elements/{p-11f87d7d.entry.js → p-692816a7.entry.js} +1 -1
  110. package/dist/zonos-elements/p-725c2d57.entry.js +1 -0
  111. package/dist/zonos-elements/{p-35d00c30.entry.js → p-7664dec5.entry.js} +1 -1
  112. package/dist/zonos-elements/{p-e3978982.entry.js → p-78a839b8.entry.js} +1 -1
  113. package/dist/zonos-elements/{p-37685139.entry.js → p-8c9e7980.entry.js} +1 -1
  114. package/dist/zonos-elements/{p-c4154737.system.js → p-9b0aa65c.system.js} +1 -1
  115. package/dist/zonos-elements/p-9c32b924.entry.js +1 -0
  116. package/dist/zonos-elements/{p-ecd994c8.system.entry.js → p-9cdfb51b.system.entry.js} +1 -1
  117. package/dist/zonos-elements/{p-687dbccc.entry.js → p-9f7c0472.entry.js} +1 -1
  118. package/dist/zonos-elements/{p-7b5a0a18.system.entry.js → p-b208fec6.system.entry.js} +1 -1
  119. package/dist/zonos-elements/{p-bb032c2f.js → p-b468f941.js} +1 -1
  120. package/dist/zonos-elements/{p-099e229a.entry.js → p-c63a7dde.entry.js} +1 -1
  121. package/dist/zonos-elements/{p-18d04e89.system.entry.js → p-d8027710.system.entry.js} +1 -1
  122. package/dist/zonos-elements/p-e0bf9666.system.js +1 -1
  123. package/dist/zonos-elements/{p-68dfcd25.system.entry.js → p-f69f1ec6.system.entry.js} +1 -1
  124. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  125. package/package.json +1 -1
  126. package/dist/esm-es5/cart-530a8750.js +0 -1
  127. package/dist/zonos-elements/p-6fe27968.entry.js +0 -1
  128. package/dist/zonos-elements/p-b4ccc72c.js +0 -1
  129. package/dist/zonos-elements/p-fb1120a2.system.js +0 -1
  130. package/dist/zonos-elements/p-fb1b98a8.entry.js +0 -1
@@ -1 +1 @@
1
- var __awaiter=this&&this.__awaiter||function(o,e,t,n){function a(o){return o instanceof t?o:new t((function(e){e(o)}))}return new(t||(t=Promise))((function(t,i){function s(o){try{l(n.next(o))}catch(o){i(o)}}function r(o){try{l(n["throw"](o))}catch(o){i(o)}}function l(o){o.done?t(o.value):a(o.value).then(s,r)}l((n=n.apply(o,e||[])).next())}))};var __generator=this&&this.__generator||function(o,e){var t={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,a,i,s;return s={next:r(0),throw:r(1),return:r(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function r(o){return function(e){return l([o,e])}}function l(r){if(n)throw new TypeError("Generator is already executing.");while(s&&(s=0,r[0]&&(t=0)),t)try{if(n=1,a&&(i=r[0]&2?a["return"]:r[0]?a["throw"]||((i=a["return"])&&i.call(a),0):a.next)&&!(i=i.call(a,r[1])).done)return i;if(a=0,i)r=[r[0]&2,i.value];switch(r[0]){case 0:case 1:i=r;break;case 4:t.label++;return{value:r[1],done:false};case 5:t.label++;a=r[1];r=[0];continue;case 7:r=t.ops.pop();t.trys.pop();continue;default:if(!(i=t.trys,i=i.length>0&&i[i.length-1])&&(r[0]===6||r[0]===2)){t=0;continue}if(r[0]===3&&(!i||r[1]>i[0]&&r[1]<i[3])){t.label=r[1];break}if(r[0]===6&&t.label<i[1]){t.label=i[1];i=r;break}if(i&&t.label<i[2]){t.label=i[2];t.ops.push(r);break}if(i[2])t.ops.pop();t.trys.pop();continue}r=e.call(o,t)}catch(o){r=[6,o];a=0}finally{n=i=0}if(r[0]&5)throw r[1];return{value:r[0]?r[1]:void 0,done:true}}};import{r as registerInstance,c as createEvent,h,H as Host}from"./index-3b46f3c3.js";import{l as localizationStore,B as currencyFormat,t as translate}from"./cart-530a8750.js";import{z as zonosStore}from"./zonosStore-ba9e541e.js";import{c as classes}from"./classes-0d95c529.js";import{f as formatStringWithLinks}from"./formatStringWithLinks-9e819405.js";import{g as getHasMoreSpaceOnRight}from"./getHasMoreSpaceOnRight-70eb913a.js";import"./logError-c456c092.js";import"./isDarkColor-f8324c10.js";import"./getBorderRadius-947c24de.js";var getHasMoreSpaceAbove=function(o){var e=o.getBoundingClientRect();var t=e.top;var n=window.innerHeight-e.bottom;return t>=n};var wrapStringWithLink=function(o){var e=o.href,t=o.text;return'<zonos-link href="'.concat(e,'" target="_blank" rel="noopener noreferrer">').concat(t,"</zonos-link>")};var BagIcon='<svg width="21" height="20" viewBox="0 0 21 20" fill="none" xmlns="https://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M9.66666 4.16667C9.20642 4.16667 8.83333 4.53976 8.83333 5V5.83333H12.1667V5C12.1667 4.53976 11.7936 4.16667 11.3333 4.16667H9.66666ZM13.8333 5.83333V5C13.8333 3.61929 12.714 2.5 11.3333 2.5H9.66666C8.28595 2.5 7.16666 3.61929 7.16666 5V5.83333H6.77759C5.44832 5.83333 4.35149 6.87354 4.2811 8.20094L3.92756 14.8676C3.85169 16.2983 4.99133 17.5 6.42405 17.5H14.5759C16.0087 17.5 17.1483 16.2983 17.0724 14.8676L16.7189 8.20094C16.6485 6.87354 15.5517 5.83333 14.2224 5.83333H13.8333ZM12.1667 7.5V8.33333C12.1667 8.79357 12.5398 9.16667 13 9.16667C13.4602 9.16667 13.8333 8.79357 13.8333 8.33333V7.5H14.2224C14.6655 7.5 15.0311 7.84674 15.0546 8.2892L15.4081 14.9559C15.4334 15.4328 15.0535 15.8333 14.5759 15.8333H6.42405C5.94648 15.8333 5.5666 15.4328 5.59189 14.9559L5.94542 8.2892C5.96889 7.84674 6.3345 7.5 6.77759 7.5H7.16666V8.33333C7.16666 8.79357 7.53976 9.16667 7.99999 9.16667C8.46023 9.16667 8.83333 8.79357 8.83333 8.33333V7.5H12.1667Z" fill="#4D505A"/>\n</svg>\n';var ImportIcon='<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M9.35028 11.5744C9.05738 11.2815 8.58251 11.2815 8.28962 11.5744C7.99672 11.8673 7.99672 12.3422 8.28962 12.635L11.2917 15.6372C11.6823 16.0277 12.3154 16.0277 12.7059 15.6372L15.708 12.6351C16.0009 12.3422 16.0009 11.8674 15.708 11.5745C15.4151 11.2816 14.9402 11.2816 14.6473 11.5745L12.7488 13.4729V4.68005C12.7488 4.26584 12.413 3.93005 11.9988 3.93005C11.5846 3.93005 11.2488 4.26584 11.2488 4.68005L11.2488 13.4729L9.35028 11.5744Z" fill="#4D505A"/>\n<path d="M20 14C20 13.5858 19.6642 13.25 19.25 13.25C18.8358 13.25 18.5 13.5858 18.5 14L18.5 17.25C18.5 17.9404 17.9404 18.5 17.25 18.5L6.75 18.5C6.05964 18.5 5.5 17.9404 5.5 17.25L5.5 14C5.5 13.5858 5.16421 13.25 4.75 13.25C4.33579 13.25 4 13.5858 4 14V17.25C4 18.7688 5.23122 20 6.75 20H17.25C18.7688 20 20 18.7688 20 17.25L20 14Z" fill="#4D505A"/>\n</svg>\n';var MessageIcon='<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="https://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M2.25 4.5C2.25 3.25736 3.25736 2.25 4.5 2.25H13.5C14.7426 2.25 15.75 3.25736 15.75 4.5V10.5C15.75 11.7426 14.7426 12.75 13.5 12.75H8.25C8.01393 12.75 7.79164 12.8611 7.65 13.05L6.3 14.85C5.87508 15.4166 5.2082 15.75 4.5 15.75C3.25736 15.75 2.25 14.7426 2.25 13.5V4.5ZM4.5 3.75C4.08579 3.75 3.75 4.08579 3.75 4.5V13.5C3.75 13.9142 4.08579 14.25 4.5 14.25C4.73607 14.25 4.95836 14.1389 5.1 13.95L6.45 12.15C6.87492 11.5834 7.5418 11.25 8.25 11.25H13.5C13.9142 11.25 14.25 10.9142 14.25 10.5V4.5C14.25 4.08579 13.9142 3.75 13.5 3.75H4.5ZM5.25 6C5.25 5.58579 5.58579 5.25 6 5.25H12C12.4142 5.25 12.75 5.58579 12.75 6C12.75 6.41421 12.4142 6.75 12 6.75H6C5.58579 6.75 5.25 6.41421 5.25 6ZM5.25 9C5.25 8.58579 5.58579 8.25 6 8.25H8.25C8.66421 8.25 9 8.58579 9 9C9 9.41421 8.66421 9.75 8.25 9.75H6C5.58579 9.75 5.25 9.41421 5.25 9Z" fill="#4D505A"/>\n</svg>\n';var MoneyIcon='<svg width="21" height="20" viewBox="0 0 21 20" fill="none" xmlns="https://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M2.16666 5.83301C2.16666 4.4523 3.28594 3.33301 4.66666 3.33301H16.3333C17.714 3.33301 18.8333 4.4523 18.8333 5.83301V14.1663C18.8333 15.5471 17.714 16.6663 16.3333 16.6663H4.66666C3.28594 16.6663 2.16666 15.5471 2.16666 14.1663V5.83301ZM4.66666 4.99967C4.20642 4.99967 3.83332 5.37277 3.83332 5.83301V14.1663C3.83332 14.6266 4.20642 14.9997 4.66666 14.9997H16.3333C16.7936 14.9997 17.1667 14.6266 17.1667 14.1663V5.83301C17.1667 5.37277 16.7936 4.99967 16.3333 4.99967H4.66666ZM6.33332 8.33301C6.79356 8.33301 7.16666 8.7061 7.16666 9.16634V10.833C7.16666 11.2932 6.79356 11.6663 6.33332 11.6663C5.87309 11.6663 5.49999 11.2932 5.49999 10.833V9.16634C5.49999 8.7061 5.87309 8.33301 6.33332 8.33301ZM8.83332 9.99967C8.83332 9.0792 9.57952 8.33301 10.5 8.33301C11.4205 8.33301 12.1667 9.0792 12.1667 9.99967C12.1667 10.9201 11.4205 11.6663 10.5 11.6663C9.57952 11.6663 8.83332 10.9201 8.83332 9.99967ZM14.6667 8.33301C15.1269 8.33301 15.5 8.7061 15.5 9.16634V10.833C15.5 11.2932 15.1269 11.6663 14.6667 11.6663C14.2064 11.6663 13.8333 11.2932 13.8333 10.833V9.16634C13.8333 8.7061 14.2064 8.33301 14.6667 8.33301Z" fill="#4D505A"/>\n</svg>\n';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 zonosHelloDialogCss=":host{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host .zonos--hello-country-flag{height:18px;width:18px;position:relative;overflow:hidden;border-radius:30px;-webkit-box-shadow:var(--zonos-elements-v3-shadow-medium);box-shadow:var(--zonos-elements-v3-shadow-medium);z-index:10;justify-self:center}:host .zonos--hello-dialog{position:absolute;background:var(--zonos-elements-surface-color);width:100vw;max-width:430px;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;max-height:600px;border-radius:var(--zonos-elements-radius-12);outline:none;-webkit-box-shadow:var(--zonos-elements-v3-shadow-xxl);box-shadow:var(--zonos-elements-v3-shadow-xxl);overflow-y:auto;top:-2px;right:-2px;opacity:0;-webkit-transition:opacity 0.3s ease-in-out, -webkit-transform 0.3s ease-in-out;transition:opacity 0.3s ease-in-out, -webkit-transform 0.3s ease-in-out;transition:opacity 0.3s ease-in-out, transform 0.3s ease-in-out;transition:opacity 0.3s ease-in-out, transform 0.3s ease-in-out, -webkit-transform 0.3s ease-in-out;-webkit-transform:scale(0);transform:scale(0);-webkit-transform-origin:top right;transform-origin:top right;z-index:1001}:host .zonos--hello-dialog .zonos--hello-dialog-header{text-align:center}:host .zonos--hello-dialog.zonos--hello-dialog-animate-from-left{-webkit-transform-origin:top left;transform-origin:top left;right:unset;left:-2px}:host .zonos--hello-dialog.zonos--hello-dialog-animate-from-bottom{-webkit-transform-origin:bottom right;transform-origin:bottom right;bottom:calc(100% - 32px);top:unset}:host .zonos--hello-dialog.zonos--hello-dialog-animate-from-bottom.zonos--hello-dialog-animate-from-left{-webkit-transform-origin:bottom left;transform-origin:bottom left}:host .zonos--hello-dialog::-webkit-scrollbar{width:12px;height:12px}:host .zonos--hello-dialog::-webkit-scrollbar-track{background:#f5f5f5;border-top-right-radius:var(--zonos-elements-radius-12);border-bottom-right-radius:var(--zonos-elements-radius-12)}:host .zonos--hello-dialog::-webkit-scrollbar-thumb{border-radius:10px;background:#ccc;border:4px solid transparent;background-clip:content-box}:host .zonos--hello-dialog::-webkit-scrollbar-thumb:hover{background:#999}:host .zonos--hello-dialog .zonos--animate-content{opacity:0;height:0;-webkit-transition:all 0.3s ease-in-out;transition:all 0.3s ease-in-out}:host .zonos--hello-dialog .zonos--show-animate-content{opacity:1;height:100%}:host .zonos--hello-dialog.zonos--hello-dialog-open{opacity:1;-webkit-transform:scale(1);transform:scale(1)}:host .zonos--hello-dialog .zonos--close-button{position:absolute;right:8px;top:8px;width:var(--zonos-elements-size-md);height:var(--zonos-elements-size-md);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;cursor:pointer;z-index:10}:host .zonos--hello-dialog .zonos--close-button:hover{background:var(--zonos-elements-hover-color);border-radius:var(--zonos-elements-radius-6)}:host .zonos--hello-dialog .zonos--hello-dialog-content{padding:16px}:host .zonos--hello-dialog .zonos--hello-dialog-content .zonos--hello-country-flag{border-radius:var(--zonos-elements-radius-4);width:32px;height:24px}:host .zonos--hello-dialog .zonos--flex-message{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;gap:12px}:host .zonos--hello-dialog.zonos--hello-dialog-mobile-override{position:-webkit-sticky;position:sticky;top:unset;left:unset;right:unset;bottom:0;width:100vw;max-width:100vw;max-height:500px;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;-webkit-transform:scaleY(0);transform:scaleY(0);border-radius:0;-webkit-transform-origin:bottom;transform-origin:bottom}@media (max-height: 600px){:host .zonos--hello-dialog.zonos--hello-dialog-mobile-override{max-height:80vh}}:host .zonos--hello-dialog.zonos--hello-dialog-mobile-override.zonos--hello-dialog-animate-from-left{-webkit-transform-origin:bottom;transform-origin:bottom}:host .zonos--hello-dialog.zonos--hello-dialog-mobile-override.zonos--hello-dialog-open{opacity:1;-webkit-transform:scaleY(1);transform:scaleY(1)}@media (max-width: 768px){:host .zonos--hello-dialog{position:-webkit-sticky;position:sticky;top:unset;left:unset;right:unset;bottom:0;width:100vw;max-width:100vw;max-height:500px;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;-webkit-transform:scaleY(0);transform:scaleY(0);border-radius:0;-webkit-transform-origin:bottom;transform-origin:bottom}}@media (max-width: 768px) and (max-height: 600px){:host .zonos--hello-dialog{max-height:80vh}}@media (max-width: 768px){:host .zonos--hello-dialog.zonos--hello-dialog-animate-from-left{-webkit-transform-origin:bottom;transform-origin:bottom}}@media (max-width: 768px){:host .zonos--hello-dialog.zonos--hello-dialog-open{opacity:1;-webkit-transform:scaleY(1);transform:scaleY(1)}}";var ZonosHelloDialogStyle0=zonosHelloDialogCss;var ZonosHelloDialog=function(){function o(o){var e=this;registerInstance(this,o);this.closeDialog=createEvent(this,"closeDialog",7);this.clickOutsideDialogHandler=function(o){if(!o.composedPath().includes(e.dialogRef)&&e.isOpen){e.setIsOpen(false)}};this.getCurrentPageEnum=function(){switch(zonosStore.currentHelloPage){case"home":return"hello_homepage";case"cart":return"hello_cart";case"productList":return"hello_item_list";case"productDetail":return"hello_item_details";default:return null}};this.setShowCountrySelect=function(o){return __awaiter(e,void 0,void 0,(function(){return __generator(this,(function(e){this.showCountrySelect=o;return[2]}))}))};this.setShowLanguageSelect=function(o){return __awaiter(e,void 0,void 0,(function(){return __generator(this,(function(e){this.showLanguageSelect=o;return[2]}))}))};this.hasTaxId=function(){var o;return(o=localizationStore.countryLandedCost)===null||o===void 0?void 0:o.hasTaxId};this.isNoThresholdCountry=function(o){if(!o||!e.hasTaxId()){return false}return["AU"].includes(o)};this.getDutyMessage=function(){var o=localizationStore.countryLandedCost;var t=(o===null||o===void 0?void 0:o.dutyDeminimus)?currencyFormat({amount:o.dutyDeminimus}):null;return t&&!e.isNoThresholdCountry(o===null||o===void 0?void 0:o.countryCode)?translate("Spend [threshold] duty free",{threshold:t}):translate("Duties will apply to all orders")};this.getTaxMessage=function(){var o=localizationStore.countryLandedCost;var t=(o===null||o===void 0?void 0:o.vatTaxDeminimus)?currencyFormat({amount:o.vatTaxDeminimus}):null;return t&&!e.isNoThresholdCountry(o===null||o===void 0?void 0:o.countryCode)?translate("Spend [threshold] tax free",{threshold:t}):translate("Taxes will apply to all orders")};this.getUkDutyTaxMessage=function(o){if(o.allowLowValueOrders){return null}var e=o.dutyDeminimus;return[translate("Orders to [countryName] must be over [threshold] to ship.",{countryName:"United Kingdom",threshold:currencyFormat({amount:e})})]};this.getAustraliaDutyTaxMessage=function(o){return[translate("Duties & taxes in Australia, VAT or GST is [percentage] and is due on all orders",{percentage:"".concat(o.vatTaxRate*100,"%")}),"".concat(translate("The low-value GST law passed July 1st, 2018 applies to this retailer.")," ").concat(wrapStringWithLink({href:"https://zonos.com/docs/global-ecommerce/landed-cost/tax-remittance/australia-gst",text:translate("Learn more.")}))]};this.getNewZealandDutyTaxMessge=function(o){return[translate("[percentage] GST due on any order above [threshold] along with an import entry transaction fee and MPI levy.",{percentage:"".concat(o.vatTaxRate*100,"%"),threshold:currencyFormat({amount:o.vatTaxDeminimus})})]};this.getAdditionalDutyTaxMessage=function(){if(!localizationStore.countryLandedCost){return null}if(!e.hasTaxId()){return null}switch(localizationStore.countryLandedCost.countryCode){case"GB":return e.getUkDutyTaxMessage(localizationStore.countryLandedCost);case"AU":return e.getAustraliaDutyTaxMessage(localizationStore.countryLandedCost);case"NZ":return e.getNewZealandDutyTaxMessge(localizationStore.countryLandedCost);default:return null}};this.isOpen=false;this.setIsOpen=function(){};this.mobileLocationOverride=undefined;this.animateFromLeftOverride=undefined;this.appearanceSettings=undefined;this.restrictedItems=[];this.welcomeMessage="Welcome to our Demo App!";this.showCountrySelect=false;this.showLanguageSelect=false}o.prototype.globalClickHandler=function(o){this.clickOutsideDialogHandler(o)};o.prototype.isOpenHandler=function(o){if(!o){void this.setShowCountrySelect(false);void this.setShowLanguageSelect(false)}};o.prototype.render=function(){var o=this;var e;var t=localizationStore.selectedCountryCode;var n=this.getDutyMessage();var a=this.getTaxMessage();var i=this.getAdditionalDutyTaxMessage();var s=this.animateFromLeftOverride||this.dialogRef&&getHasMoreSpaceOnRight(this.dialogRef);var r=this.dialogRef&&getHasMoreSpaceAbove(this.dialogRef);var l=localizationStore.customMessages;var c=translate("Welcome to [storeName]!",{storeName:zonosStore.organizationName});var d=((e=l.find((function(o){return o.pageName==="hello_default"})))===null||e===void 0?void 0:e.message)||translate("Know about duties and taxes before you buy. Shop with confidence!");var f=formatStringWithLinks(d);var u=this.getCurrentPageEnum();var g=l.filter((function(o){return o.pageName===u}));return h(Host,{key:"bb2b080aaba7b85599b7e6bcb7cabee70863070f",class:"zonos--elements"},h("div",{key:"aabdbd8c4b47f759396d1a56fac426570385768d","aria-hidden":"true",class:classes(["zonos--hello-dialog",s&&"zonos--hello-dialog-animate-from-left",r&&"zonos--hello-dialog-animate-from-bottom",!!this.mobileLocationOverride&&"zonos--hello-dialog-mobile-override",this.isOpen&&"zonos--hello-dialog-open"]),ref:function(e){return e&&(o.dialogRef=e)}},!this.showCountrySelect&&!this.showLanguageSelect&&h("div",{key:"d9189f1ced79d3d3fd11c99ea1407e7b83a2573b"},h("div",{key:"83ac2ab3583935ececea8be98ab64559d802725a",class:"zonos--hello-dialog-content"},h("zonos-button",{key:"4f36dea145e751d63a2d0df3f472ffe674fbb580",class:"zonos--close-button",icon:h("zonos-icon",{"aria-label":"Close Zonos Hello dialog",content:RemoveIcon}),noBackground:true,onClick:function(){return o.setIsOpen(false)}}),h("zonos-v-stack",{key:"e8a7cebe4ca88da80b974e3a3536714fe4da47c1",spacing:24},h("zonos-country-flag",{key:"e02c72135b9c7e9e533fc46c8f4b286ba1cb1b63",class:"zonos--hello-country-flag",countryCode:t}),h("zonos-v-stack",{key:"7d199c0a5f465fe1640e690d2712f11a80e1f378",class:"zonos--hello-dialog-header",spacing:4},h("zonos-text",{key:"97bf6611bd485ace8ad9b94c3520148ae0d1eab0",type:"boldSubheader"},c),h("zonos-text",{key:"c1e524bf689f34aed978f350676ffa957724176f",innerHTML:f,textColor:"gray-800"})),h("zonos-v-stack",{key:"81a2fabb2f6c2d853f2f6619f7c6829754d80a59",spacing:8},this.restrictedItems.map((function(o){var e;return o&&h("zonos-banner",{bannerTitle:o.name,intent:"error"},(e=o.itemRestrictions)===null||e===void 0?void 0:e.map((function(o){return h("zonos-text",{textColor:"red-800"},o===null||o===void 0?void 0:o.note)})))})),h("zonos-card",{key:"29ba8b81746a696ca43b88daa89a7c85af5a2b34",spacing:"12px"},h("zonos-v-stack",{key:"8f4e79efe07a4c7c1b493178c952bfe61a151f0c",spacing:12},h("div",{key:"a17eda2b103d376f7ca8a9b528d613195b3a1fe7",class:"zonos--flex-message"},h("zonos-icon",{key:"13c828d956198211a1fbda77840f8b91692d1582","aria-label":"Duty de minimis",content:ImportIcon}),h("zonos-text",{key:"c38511e16905f169b821d0cd8d98dee80a7c1de1"},n)),h("div",{key:"9b3165d870419732d4be1421336326f8d4e98547",class:"zonos--flex-message"},h("zonos-icon",{key:"46248b95b97a3ec74ffc038dda29ca74a1e700c2","aria-label":"Tax de minimis",content:MoneyIcon}),h("zonos-text",{key:"1d698d83f9fa43746de870553d1ba1c09389aefb"},a)),i===null||i===void 0?void 0:i.map((function(o){return h("div",{class:"zonos--flex-message"},h("zonos-icon",{"aria-label":"Additional information for buying goods from selected country",content:BagIcon}),h("zonos-text",{innerHTML:o}))})))),g.map((function(o){return h("zonos-custom-message",{icon:MessageIcon,message:o.message})}))))),h("zonos-hello-dialog-footer",{key:"fcc21cc1e8b3de45af03c64ffc95dc2ab6f57bf3",appearanceSettings:this.appearanceSettings,setShowCountrySelect:function(e){return o.setShowCountrySelect(e)},setShowLanguageSelect:function(e){return o.setShowLanguageSelect(e)}})),this.showCountrySelect&&h("div",{key:"bbf019b27e6da7aa3256f14bf928aae26ca92f54"},h("zonos-country-select",{key:"a70d55e1872ec626e8446866dbad3aafca69790c",handleOnClose:function(){return o.setShowCountrySelect(false)}})),this.showLanguageSelect&&h("div",{key:"77f63941fcbb3bc0c668a61aa48ca2e60b8addeb"},h("zonos-language-select",{key:"57a4d06c098662b00c3587f3b2290552dc04f2fe",handleOnClose:function(){return o.setShowLanguageSelect(false)}}))))};Object.defineProperty(o,"assetsDirs",{get:function(){return["assets"]},enumerable:false,configurable:true});Object.defineProperty(o,"watchers",{get:function(){return{isOpen:["isOpenHandler"]}},enumerable:false,configurable:true});return o}();ZonosHelloDialog.style=ZonosHelloDialogStyle0;export{ZonosHelloDialog as zonos_hello_dialog};
1
+ var __awaiter=this&&this.__awaiter||function(o,e,t,n){function i(o){return o instanceof t?o:new t((function(e){e(o)}))}return new(t||(t=Promise))((function(t,a){function s(o){try{l(n.next(o))}catch(o){a(o)}}function r(o){try{l(n["throw"](o))}catch(o){a(o)}}function l(o){o.done?t(o.value):i(o.value).then(s,r)}l((n=n.apply(o,e||[])).next())}))};var __generator=this&&this.__generator||function(o,e){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,i,a,s;return s={next:r(0),throw:r(1),return:r(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function r(o){return function(e){return l([o,e])}}function l(r){if(n)throw new TypeError("Generator is already executing.");while(s&&(s=0,r[0]&&(t=0)),t)try{if(n=1,i&&(a=r[0]&2?i["return"]:r[0]?i["throw"]||((a=i["return"])&&a.call(i),0):i.next)&&!(a=a.call(i,r[1])).done)return a;if(i=0,a)r=[r[0]&2,a.value];switch(r[0]){case 0:case 1:a=r;break;case 4:t.label++;return{value:r[1],done:false};case 5:t.label++;i=r[1];r=[0];continue;case 7:r=t.ops.pop();t.trys.pop();continue;default:if(!(a=t.trys,a=a.length>0&&a[a.length-1])&&(r[0]===6||r[0]===2)){t=0;continue}if(r[0]===3&&(!a||r[1]>a[0]&&r[1]<a[3])){t.label=r[1];break}if(r[0]===6&&t.label<a[1]){t.label=a[1];a=r;break}if(a&&t.label<a[2]){t.label=a[2];t.ops.push(r);break}if(a[2])t.ops.pop();t.trys.pop();continue}r=e.call(o,t)}catch(o){r=[6,o];i=0}finally{n=a=0}if(r[0]&5)throw r[1];return{value:r[0]?r[1]:void 0,done:true}}};import{r as registerInstance,c as createEvent,h,H as Host}from"./index-3b46f3c3.js";import{l as localizationStore,B as currencyFormat,t as translate}from"./cart-b96aaa4f.js";import{z as zonosStore}from"./zonosStore-ba9e541e.js";import{c as classes}from"./classes-0d95c529.js";import{f as formatStringWithLinks}from"./formatStringWithLinks-9e819405.js";import{g as getHasMoreSpaceOnRight}from"./getHasMoreSpaceOnRight-70eb913a.js";import"./logError-c456c092.js";import"./isDarkColor-f8324c10.js";import"./getBorderRadius-947c24de.js";var getHasMoreSpaceAbove=function(o){var e=o.getBoundingClientRect();var t=e.top;var n=window.innerHeight-e.bottom;return t>=n};var wrapStringWithLink=function(o){var e=o.href,t=o.text;return'<zonos-link href="'.concat(e,'" target="_blank" rel="noopener noreferrer">').concat(t,"</zonos-link>")};var BagIcon='<svg width="21" height="20" viewBox="0 0 21 20" fill="none" xmlns="https://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M9.66666 4.16667C9.20642 4.16667 8.83333 4.53976 8.83333 5V5.83333H12.1667V5C12.1667 4.53976 11.7936 4.16667 11.3333 4.16667H9.66666ZM13.8333 5.83333V5C13.8333 3.61929 12.714 2.5 11.3333 2.5H9.66666C8.28595 2.5 7.16666 3.61929 7.16666 5V5.83333H6.77759C5.44832 5.83333 4.35149 6.87354 4.2811 8.20094L3.92756 14.8676C3.85169 16.2983 4.99133 17.5 6.42405 17.5H14.5759C16.0087 17.5 17.1483 16.2983 17.0724 14.8676L16.7189 8.20094C16.6485 6.87354 15.5517 5.83333 14.2224 5.83333H13.8333ZM12.1667 7.5V8.33333C12.1667 8.79357 12.5398 9.16667 13 9.16667C13.4602 9.16667 13.8333 8.79357 13.8333 8.33333V7.5H14.2224C14.6655 7.5 15.0311 7.84674 15.0546 8.2892L15.4081 14.9559C15.4334 15.4328 15.0535 15.8333 14.5759 15.8333H6.42405C5.94648 15.8333 5.5666 15.4328 5.59189 14.9559L5.94542 8.2892C5.96889 7.84674 6.3345 7.5 6.77759 7.5H7.16666V8.33333C7.16666 8.79357 7.53976 9.16667 7.99999 9.16667C8.46023 9.16667 8.83333 8.79357 8.83333 8.33333V7.5H12.1667Z" fill="#4D505A"/>\n</svg>\n';var ImportIcon='<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M9.35028 11.5744C9.05738 11.2815 8.58251 11.2815 8.28962 11.5744C7.99672 11.8673 7.99672 12.3422 8.28962 12.635L11.2917 15.6372C11.6823 16.0277 12.3154 16.0277 12.7059 15.6372L15.708 12.6351C16.0009 12.3422 16.0009 11.8674 15.708 11.5745C15.4151 11.2816 14.9402 11.2816 14.6473 11.5745L12.7488 13.4729V4.68005C12.7488 4.26584 12.413 3.93005 11.9988 3.93005C11.5846 3.93005 11.2488 4.26584 11.2488 4.68005L11.2488 13.4729L9.35028 11.5744Z" fill="#4D505A"/>\n<path d="M20 14C20 13.5858 19.6642 13.25 19.25 13.25C18.8358 13.25 18.5 13.5858 18.5 14L18.5 17.25C18.5 17.9404 17.9404 18.5 17.25 18.5L6.75 18.5C6.05964 18.5 5.5 17.9404 5.5 17.25L5.5 14C5.5 13.5858 5.16421 13.25 4.75 13.25C4.33579 13.25 4 13.5858 4 14V17.25C4 18.7688 5.23122 20 6.75 20H17.25C18.7688 20 20 18.7688 20 17.25L20 14Z" fill="#4D505A"/>\n</svg>\n';var MessageIcon='<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="https://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M2.25 4.5C2.25 3.25736 3.25736 2.25 4.5 2.25H13.5C14.7426 2.25 15.75 3.25736 15.75 4.5V10.5C15.75 11.7426 14.7426 12.75 13.5 12.75H8.25C8.01393 12.75 7.79164 12.8611 7.65 13.05L6.3 14.85C5.87508 15.4166 5.2082 15.75 4.5 15.75C3.25736 15.75 2.25 14.7426 2.25 13.5V4.5ZM4.5 3.75C4.08579 3.75 3.75 4.08579 3.75 4.5V13.5C3.75 13.9142 4.08579 14.25 4.5 14.25C4.73607 14.25 4.95836 14.1389 5.1 13.95L6.45 12.15C6.87492 11.5834 7.5418 11.25 8.25 11.25H13.5C13.9142 11.25 14.25 10.9142 14.25 10.5V4.5C14.25 4.08579 13.9142 3.75 13.5 3.75H4.5ZM5.25 6C5.25 5.58579 5.58579 5.25 6 5.25H12C12.4142 5.25 12.75 5.58579 12.75 6C12.75 6.41421 12.4142 6.75 12 6.75H6C5.58579 6.75 5.25 6.41421 5.25 6ZM5.25 9C5.25 8.58579 5.58579 8.25 6 8.25H8.25C8.66421 8.25 9 8.58579 9 9C9 9.41421 8.66421 9.75 8.25 9.75H6C5.58579 9.75 5.25 9.41421 5.25 9Z" fill="#4D505A"/>\n</svg>\n';var MoneyIcon='<svg width="21" height="20" viewBox="0 0 21 20" fill="none" xmlns="https://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M2.16666 5.83301C2.16666 4.4523 3.28594 3.33301 4.66666 3.33301H16.3333C17.714 3.33301 18.8333 4.4523 18.8333 5.83301V14.1663C18.8333 15.5471 17.714 16.6663 16.3333 16.6663H4.66666C3.28594 16.6663 2.16666 15.5471 2.16666 14.1663V5.83301ZM4.66666 4.99967C4.20642 4.99967 3.83332 5.37277 3.83332 5.83301V14.1663C3.83332 14.6266 4.20642 14.9997 4.66666 14.9997H16.3333C16.7936 14.9997 17.1667 14.6266 17.1667 14.1663V5.83301C17.1667 5.37277 16.7936 4.99967 16.3333 4.99967H4.66666ZM6.33332 8.33301C6.79356 8.33301 7.16666 8.7061 7.16666 9.16634V10.833C7.16666 11.2932 6.79356 11.6663 6.33332 11.6663C5.87309 11.6663 5.49999 11.2932 5.49999 10.833V9.16634C5.49999 8.7061 5.87309 8.33301 6.33332 8.33301ZM8.83332 9.99967C8.83332 9.0792 9.57952 8.33301 10.5 8.33301C11.4205 8.33301 12.1667 9.0792 12.1667 9.99967C12.1667 10.9201 11.4205 11.6663 10.5 11.6663C9.57952 11.6663 8.83332 10.9201 8.83332 9.99967ZM14.6667 8.33301C15.1269 8.33301 15.5 8.7061 15.5 9.16634V10.833C15.5 11.2932 15.1269 11.6663 14.6667 11.6663C14.2064 11.6663 13.8333 11.2932 13.8333 10.833V9.16634C13.8333 8.7061 14.2064 8.33301 14.6667 8.33301Z" fill="#4D505A"/>\n</svg>\n';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 zonosHelloDialogCss=":host{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host .zonos--hello-country-flag{height:18px;width:18px;position:relative;overflow:hidden;border-radius:30px;-webkit-box-shadow:var(--zonos-elements-v3-shadow-medium);box-shadow:var(--zonos-elements-v3-shadow-medium);z-index:10;justify-self:center}:host .zonos--hello-dialog{position:absolute;background:var(--zonos-elements-surface-color);width:100vw;max-width:430px;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;max-height:600px;border-radius:var(--zonos-elements-radius-12);outline:none;-webkit-box-shadow:var(--zonos-elements-v3-shadow-xxl);box-shadow:var(--zonos-elements-v3-shadow-xxl);overflow-y:auto;top:-2px;right:-2px;opacity:0;-webkit-transition:opacity 0.3s ease-in-out, -webkit-transform 0.3s ease-in-out;transition:opacity 0.3s ease-in-out, -webkit-transform 0.3s ease-in-out;transition:opacity 0.3s ease-in-out, transform 0.3s ease-in-out;transition:opacity 0.3s ease-in-out, transform 0.3s ease-in-out, -webkit-transform 0.3s ease-in-out;-webkit-transform:scale(0);transform:scale(0);-webkit-transform-origin:top right;transform-origin:top right;z-index:1001}:host .zonos--hello-dialog .zonos--hello-dialog-header{text-align:center}:host .zonos--hello-dialog.zonos--hello-dialog-animate-from-left{-webkit-transform-origin:top left;transform-origin:top left;right:unset;left:-2px}:host .zonos--hello-dialog.zonos--hello-dialog-animate-from-bottom{-webkit-transform-origin:bottom right;transform-origin:bottom right;bottom:calc(100% - 32px);top:unset}:host .zonos--hello-dialog.zonos--hello-dialog-animate-from-bottom.zonos--hello-dialog-animate-from-left{-webkit-transform-origin:bottom left;transform-origin:bottom left}:host .zonos--hello-dialog::-webkit-scrollbar{width:12px;height:12px}:host .zonos--hello-dialog::-webkit-scrollbar-track{background:#f5f5f5;border-top-right-radius:var(--zonos-elements-radius-12);border-bottom-right-radius:var(--zonos-elements-radius-12)}:host .zonos--hello-dialog::-webkit-scrollbar-thumb{border-radius:10px;background:#ccc;border:4px solid transparent;background-clip:content-box}:host .zonos--hello-dialog::-webkit-scrollbar-thumb:hover{background:#999}:host .zonos--hello-dialog .zonos--animate-content{opacity:0;height:0;-webkit-transition:all 0.3s ease-in-out;transition:all 0.3s ease-in-out}:host .zonos--hello-dialog .zonos--show-animate-content{opacity:1;height:100%}:host .zonos--hello-dialog.zonos--hello-dialog-open{opacity:1;-webkit-transform:scale(1);transform:scale(1)}:host .zonos--hello-dialog .zonos--close-button{position:absolute;right:8px;top:8px;width:var(--zonos-elements-size-md);height:var(--zonos-elements-size-md);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;cursor:pointer;z-index:10}:host .zonos--hello-dialog .zonos--close-button:hover{background:var(--zonos-elements-hover-color);border-radius:var(--zonos-elements-radius-6)}:host .zonos--hello-dialog .zonos--hello-dialog-content{padding:16px}:host .zonos--hello-dialog .zonos--hello-dialog-content .zonos--hello-country-flag{border-radius:var(--zonos-elements-radius-4);width:32px;height:24px}:host .zonos--hello-dialog .zonos--flex-message{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;gap:12px}:host .zonos--hello-dialog.zonos--hello-dialog-mobile-override{position:-webkit-sticky;position:sticky;top:unset;left:unset;right:unset;bottom:0;width:100vw;max-width:100vw;max-height:500px;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;-webkit-transform:scaleY(0);transform:scaleY(0);border-radius:0;-webkit-transform-origin:bottom;transform-origin:bottom}@media (max-height: 600px){:host .zonos--hello-dialog.zonos--hello-dialog-mobile-override{max-height:80vh}}:host .zonos--hello-dialog.zonos--hello-dialog-mobile-override.zonos--hello-dialog-animate-from-left{-webkit-transform-origin:bottom;transform-origin:bottom}:host .zonos--hello-dialog.zonos--hello-dialog-mobile-override.zonos--hello-dialog-open{opacity:1;-webkit-transform:scaleY(1);transform:scaleY(1)}@media (max-width: 768px){:host .zonos--hello-dialog{position:-webkit-sticky;position:sticky;top:unset;left:unset;right:unset;bottom:0;width:100vw;max-width:100vw;max-height:500px;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;-webkit-transform:scaleY(0);transform:scaleY(0);border-radius:0;-webkit-transform-origin:bottom;transform-origin:bottom}}@media (max-width: 768px) and (max-height: 600px){:host .zonos--hello-dialog{max-height:80vh}}@media (max-width: 768px){:host .zonos--hello-dialog.zonos--hello-dialog-animate-from-left{-webkit-transform-origin:bottom;transform-origin:bottom}}@media (max-width: 768px){:host .zonos--hello-dialog.zonos--hello-dialog-open{opacity:1;-webkit-transform:scaleY(1);transform:scaleY(1)}}";var ZonosHelloDialogStyle0=zonosHelloDialogCss;var ZonosHelloDialog=function(){function o(o){var e=this;registerInstance(this,o);this.closeDialog=createEvent(this,"closeDialog",7);this.clickOutsideDialogHandler=function(o){if(!o.composedPath().includes(e.dialogRef)&&e.isOpen){e.setIsOpen(false)}};this.getCurrentPageEnum=function(){switch(zonosStore.currentHelloPage){case"home":return"hello_homepage";case"cart":return"hello_cart";case"productList":return"hello_item_list";case"productDetail":return"hello_item_details";default:return null}};this.setShowCountrySelect=function(o){return __awaiter(e,void 0,void 0,(function(){return __generator(this,(function(e){this.showCountrySelect=o;return[2]}))}))};this.setShowLanguageSelect=function(o){return __awaiter(e,void 0,void 0,(function(){return __generator(this,(function(e){this.showLanguageSelect=o;return[2]}))}))};this.hasTaxId=function(){var o;return(o=localizationStore.countryLandedCost)===null||o===void 0?void 0:o.hasTaxId};this.isNoThresholdCountry=function(o){if(!o||!e.hasTaxId()){return false}return["AU"].includes(o)};this.getDutyMessage=function(){var o=localizationStore.countryLandedCost;var t=(o===null||o===void 0?void 0:o.dutyDeminimus)?currencyFormat({amount:o.dutyDeminimus}):null;return t&&!e.isNoThresholdCountry(o===null||o===void 0?void 0:o.countryCode)?translate("Spend [threshold] duty free",{threshold:t}):translate("Duties will apply to all orders")};this.getTaxMessage=function(){var o=localizationStore.countryLandedCost;var t=(o===null||o===void 0?void 0:o.vatTaxDeminimus)?currencyFormat({amount:o.vatTaxDeminimus}):null;return t&&!e.isNoThresholdCountry(o===null||o===void 0?void 0:o.countryCode)?translate("Spend [threshold] tax free",{threshold:t}):translate("Taxes will apply to all orders")};this.getUkDutyTaxMessage=function(o){if(o.allowLowValueOrders){return null}var e=o.dutyDeminimus;return[translate("Orders to [countryName] must be over [threshold] to ship.",{countryName:"United Kingdom",threshold:currencyFormat({amount:e})})]};this.getAustraliaDutyTaxMessage=function(o){return[translate("Duties & taxes in Australia, VAT or GST is [percentage] and is due on all orders",{percentage:"".concat(o.vatTaxRate*100,"%")}),"".concat(translate("The low-value GST law passed July 1st, 2018 applies to this retailer.")," ").concat(wrapStringWithLink({href:"https://zonos.com/docs/global-ecommerce/landed-cost/tax-remittance/australia-gst",text:translate("Learn more.")}))]};this.getNewZealandDutyTaxMessge=function(o){return[translate("[percentage] GST due on any order above [threshold] along with an import entry transaction fee and MPI levy.",{percentage:"".concat(o.vatTaxRate*100,"%"),threshold:currencyFormat({amount:o.vatTaxDeminimus})})]};this.getAdditionalDutyTaxMessage=function(){if(!localizationStore.countryLandedCost){return null}if(!e.hasTaxId()){return null}switch(localizationStore.countryLandedCost.countryCode){case"GB":return e.getUkDutyTaxMessage(localizationStore.countryLandedCost);case"AU":return e.getAustraliaDutyTaxMessage(localizationStore.countryLandedCost);case"NZ":return e.getNewZealandDutyTaxMessge(localizationStore.countryLandedCost);default:return null}};this.isOpen=false;this.setIsOpen=function(){};this.mobileLocationOverride=undefined;this.animateFromLeftOverride=undefined;this.appearanceSettings=undefined;this.restrictedItems=[];this.welcomeMessage="Welcome to our Demo App!";this.showCountrySelect=false;this.showLanguageSelect=false}o.prototype.globalClickHandler=function(o){this.clickOutsideDialogHandler(o)};o.prototype.isOpenHandler=function(o){if(!o){void this.setShowCountrySelect(false);void this.setShowLanguageSelect(false)}};o.prototype.render=function(){var o=this;var e;var t=localizationStore.selectedCountryCode;var n=this.getDutyMessage();var i=this.getTaxMessage();var a=this.getAdditionalDutyTaxMessage();var s=this.animateFromLeftOverride||this.dialogRef&&getHasMoreSpaceOnRight(this.dialogRef);var r=this.dialogRef&&getHasMoreSpaceAbove(this.dialogRef);var l=localizationStore.customMessages;var c=translate("Welcome to [storeName]",{storeName:zonosStore.organizationName});var d=((e=l.find((function(o){return o.pageName==="hello_default"})))===null||e===void 0?void 0:e.message)||translate("Know about duties and taxes before you buy. Shop with confidence!");var f=formatStringWithLinks(d);var u=this.getCurrentPageEnum();var g=l.filter((function(o){return o.pageName===u}));return h(Host,{key:"1194b1466981cf8ba04d726eff3ba34b19510258",class:"zonos--elements"},h("div",{key:"ffea099f72ff3f42ddbd5b5947a5b8ca0f3d206d","aria-hidden":"true",class:classes(["zonos--hello-dialog",s&&"zonos--hello-dialog-animate-from-left",r&&"zonos--hello-dialog-animate-from-bottom",!!this.mobileLocationOverride&&"zonos--hello-dialog-mobile-override",this.isOpen&&"zonos--hello-dialog-open"]),ref:function(e){return e&&(o.dialogRef=e)}},!this.showCountrySelect&&!this.showLanguageSelect&&h("div",{key:"7396d7cd91c69f77d5f2f4ae9a088b1a763c6988"},h("div",{key:"aedfda83797a58fc2a0432a89503cbc7774d5c8b",class:"zonos--hello-dialog-content"},h("zonos-button",{key:"0c9ad53d902ce7c45cdf9192dbe8ea7f9f46f7d4",class:"zonos--close-button",icon:h("zonos-icon",{"aria-label":"Close Zonos Hello dialog",content:RemoveIcon}),noBackground:true,onClick:function(){return o.setIsOpen(false)}}),h("zonos-v-stack",{key:"9a359684275e946fc26bdc6ea7b8a371bf49dea5",spacing:24},h("zonos-country-flag",{key:"ca230fb4426ecb39febb0972d9a6ce15435c4e1d",class:"zonos--hello-country-flag",countryCode:t}),h("zonos-v-stack",{key:"17bbc6a70143a9165b8f088b5b2ea1e6e69622ed",class:"zonos--hello-dialog-header",spacing:4},h("zonos-text",{key:"33c66273d9fd8330ee4cf2bfcdf5b454a89e0ae0",type:"boldSubheader"},c),h("zonos-text",{key:"57cfdcd587ab62fad99016a389771d3a169ad297",innerHTML:f,textColor:"gray-800"})),h("zonos-v-stack",{key:"28b9b9e7967e81ca50bc4d0cfe45c9545a8b9dde",spacing:8},this.restrictedItems.map((function(o){var e;return o&&h("zonos-banner",{bannerTitle:o.name,intent:"error"},(e=o.itemRestrictions)===null||e===void 0?void 0:e.map((function(o){return h("zonos-text",{textColor:"red-800"},o===null||o===void 0?void 0:o.note)})))})),h("zonos-card",{key:"94ef9064b4e523c3f0fc9cd50142da36f003006d",spacing:"12px"},h("zonos-v-stack",{key:"01b3550b5b080d106eaecedf78b13275e01ae159",spacing:12},h("div",{key:"19b1ba3e12dab87250d3ad19a5dc8e13b6f871d6",class:"zonos--flex-message"},h("zonos-icon",{key:"9773bf4ad57752437a367c2093de0737693bf588","aria-label":"Duty de minimis",content:ImportIcon}),h("zonos-text",{key:"4c75d971f37db399e6f4332a6c92b53758629b6b"},n)),h("div",{key:"52640f51d3664582d7bb3c26f2d2d17d82ad856e",class:"zonos--flex-message"},h("zonos-icon",{key:"9afe9273e6b19aada01018152a64973449b87094","aria-label":"Tax de minimis",content:MoneyIcon}),h("zonos-text",{key:"b2481af13570471cc2907c48b54c7039ec31e92c"},i)),a===null||a===void 0?void 0:a.map((function(o){return h("div",{class:"zonos--flex-message"},h("zonos-icon",{"aria-label":"Additional information for buying goods from selected country",content:BagIcon}),h("zonos-text",{innerHTML:o}))})))),g.map((function(o){return h("zonos-custom-message",{icon:MessageIcon,message:o.message})}))))),h("zonos-hello-dialog-footer",{key:"a6b2d31ee922db13cf9987a823e99d6088c392b0",appearanceSettings:this.appearanceSettings,setShowCountrySelect:function(e){return o.setShowCountrySelect(e)},setShowLanguageSelect:function(e){return o.setShowLanguageSelect(e)}})),this.showCountrySelect&&h("div",{key:"21d187502c3f0ccef0c351f09aa943566228944f"},h("zonos-country-select",{key:"3dbd522e8a5004c2a1ed766ba92c9d0387f845d8",handleOnClose:function(){return o.setShowCountrySelect(false)}})),this.showLanguageSelect&&h("div",{key:"686d8bba48fefd49bf2bf15dc295fb79b9cd5299"},h("zonos-language-select",{key:"22ba1b42ec7ba1808fd806ad3529a377d34b4ac8",handleOnClose:function(){return o.setShowLanguageSelect(false)}}))))};Object.defineProperty(o,"assetsDirs",{get:function(){return["assets"]},enumerable:false,configurable:true});Object.defineProperty(o,"watchers",{get:function(){return{isOpen:["isOpenHandler"]}},enumerable:false,configurable:true});return o}();ZonosHelloDialog.style=ZonosHelloDialogStyle0;export{ZonosHelloDialog as zonos_hello_dialog};
@@ -1 +1 @@
1
- var __awaiter=this&&this.__awaiter||function(e,o,t,r){function n(e){return e instanceof t?e:new t((function(o){o(e)}))}return new(t||(t=Promise))((function(t,i){function s(e){try{l(r.next(e))}catch(e){i(e)}}function a(e){try{l(r["throw"](e))}catch(e){i(e)}}function l(e){e.done?t(e.value):n(e.value).then(s,a)}l((r=r.apply(e,o||[])).next())}))};var __generator=this&&this.__generator||function(e,o){var t={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,n,i,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(e){return function(o){return l([e,o])}}function l(a){if(r)throw new TypeError("Generator is already executing.");while(s&&(s=0,a[0]&&(t=0)),t)try{if(r=1,n&&(i=a[0]&2?n["return"]:a[0]?n["throw"]||((i=n["return"])&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;if(n=0,i)a=[a[0]&2,i.value];switch(a[0]){case 0:case 1:i=a;break;case 4:t.label++;return{value:a[1],done:false};case 5:t.label++;n=a[1];a=[0];continue;case 7:a=t.ops.pop();t.trys.pop();continue;default:if(!(i=t.trys,i=i.length>0&&i[i.length-1])&&(a[0]===6||a[0]===2)){t=0;continue}if(a[0]===3&&(!i||a[1]>i[0]&&a[1]<i[3])){t.label=a[1];break}if(a[0]===6&&t.label<i[1]){t.label=i[1];i=a;break}if(i&&t.label<i[2]){t.label=i[2];t.ops.push(a);break}if(i[2])t.ops.pop();t.trys.pop();continue}a=o.call(e,t)}catch(e){a=[6,e];n=0}finally{r=i=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};import{r as registerInstance,h,H as Host}from"./index-3b46f3c3.js";import{_ as _root,e as _baseGetTag,i as isObjectLike_1,f as isObject_1,z as zonosStore,g as getZonosStoreTheme,m as mergeConfig}from"./zonosStore-ba9e541e.js";import{r as handleFetch,l as localizationStore,u as isValidSelector,t as translate,w as getZCountryUrlParam,x as setZCountryUrlParam,y as currencyDisplay,z as currencyConvertAndFormat,A as currencyConvert,B as currencyFormat}from"./cart-530a8750.js";import{c as classes}from"./classes-0d95c529.js";import{a as logError,l as log}from"./logError-c456c092.js";import{g as getHasMoreSpaceOnRight}from"./getHasMoreSpaceOnRight-70eb913a.js";import"./isDarkColor-f8324c10.js";import"./getBorderRadius-947c24de.js";var root=_root;var now$1=function(){return root.Date.now()};var now_1=now$1;var reWhitespace=/\s/;function trimmedEndIndex$1(e){var o=e.length;while(o--&&reWhitespace.test(e.charAt(o))){}return o}var _trimmedEndIndex=trimmedEndIndex$1;var trimmedEndIndex=_trimmedEndIndex;var reTrimStart=/^\s+/;function baseTrim$1(e){return e?e.slice(0,trimmedEndIndex(e)+1).replace(reTrimStart,""):e}var _baseTrim=baseTrim$1;var baseGetTag=_baseGetTag,isObjectLike=isObjectLike_1;var symbolTag="[object Symbol]";function isSymbol$1(e){return typeof e=="symbol"||isObjectLike(e)&&baseGetTag(e)==symbolTag}var isSymbol_1=isSymbol$1;var baseTrim=_baseTrim,isObject$1=isObject_1,isSymbol=isSymbol_1;var NAN=0/0;var reIsBadHex=/^[-+]0x[0-9a-f]+$/i;var reIsBinary=/^0b[01]+$/i;var reIsOctal=/^0o[0-7]+$/i;var freeParseInt=parseInt;function toNumber$1(e){if(typeof e=="number"){return e}if(isSymbol(e)){return NAN}if(isObject$1(e)){var o=typeof e.valueOf=="function"?e.valueOf():e;e=isObject$1(o)?o+"":o}if(typeof e!="string"){return e===0?e:+e}e=baseTrim(e);var t=reIsBinary.test(e);return t||reIsOctal.test(e)?freeParseInt(e.slice(2),t?2:8):reIsBadHex.test(e)?NAN:+e}var toNumber_1=toNumber$1;var isObject=isObject_1,now=now_1,toNumber=toNumber_1;var FUNC_ERROR_TEXT="Expected a function";var nativeMax=Math.max,nativeMin=Math.min;function debounce(e,o,t){var r,n,i,s,a,l,d=0,h=false,u=false,c=true;if(typeof e!="function"){throw new TypeError(FUNC_ERROR_TEXT)}o=toNumber(o)||0;if(isObject(t)){h=!!t.leading;u="maxWait"in t;i=u?nativeMax(toNumber(t.maxWait)||0,o):i;c="trailing"in t?!!t.trailing:c}function f(o){var t=r,i=n;r=n=undefined;d=o;s=e.apply(i,t);return s}function m(e){d=e;a=setTimeout(z,o);return h?f(e):s}function g(e){var t=e-l,r=e-d,n=o-t;return u?nativeMin(n,i-r):n}function v(e){var t=e-l,r=e-d;return l===undefined||t>=o||t<0||u&&r>=i}function z(){var e=now();if(v(e)){return w(e)}a=setTimeout(z,g(e))}function w(e){a=undefined;if(c&&r){return f(e)}r=n=undefined;return s}function p(){if(a!==undefined){clearTimeout(a)}d=0;r=l=n=a=undefined}function b(){return a===undefined?s:w(now())}function x(){var e=now(),t=v(e);r=arguments;n=this;l=e;if(t){if(a===undefined){return m(l)}if(u){clearTimeout(a);a=setTimeout(z,o);return f(l)}}if(a===undefined){a=setTimeout(z,o)}return s}x.cancel=p;x.flush=b;return x}var debounce_1=debounce;var checkItemRestrictions=function(e){return __awaiter(void 0,[e],void 0,(function(e){var o,t,r,n,i,s;var a=e.items,l=e.shipFrom,d=e.shipTo;return __generator(this,(function(e){switch(e.label){case 0:t="".concat("https://v1.route.js.zonos.com","/api/zonos-elements/check-item-restrictions");r={items:a,shipFrom:l,shipTo:d};return[4,handleFetch(t,{body:r,method:"POST"})];case 1:n=e.sent(),i=n.errors,s=n.json;if(i.length||!s){logError("Error fetching item restrictions: ".concat((o=i.find(Boolean))===null||o===void 0?void 0:o.message));return[2,[]]}return[2,s.filter(Boolean)]}}))}))};var detectItemRestrictions=function(e){return __awaiter(void 0,void 0,void 0,(function(){var o,t,r,n;return __generator(this,(function(i){switch(i.label){case 0:if(!e.length){return[2,[]]}o=localizationStore.selectedCountryCode;if(!o){logError("Hello Could not check item restrictions - No country code selected");return[2,[]]}t=e.map((function(e){return{description:e.description,name:e.title}}));return[4,checkItemRestrictions({items:t,shipFrom:"AD",shipTo:o})];case 1:r=i.sent();n=r.map((function(e){var o;var r=((o=t.filter((function(o){return o.description===e.itemDescription})).find(Boolean))===null||o===void 0?void 0:o.name)||"";return Object.assign(Object.assign({},e),{name:r})}));return[2,n]}}))}))};var matchUrlPattern=function(e){var o=e===null||e===void 0?void 0:e.replace("www.","").replace("https://","");return o&&new RegExp(o).test(window.location.href)};var getCurrentHelloLocalePage=function(){var e=zonosStore.helloSettings,o=e.cartUrlPattern,t=e.homepageUrlPattern,r=e.productDetailUrlPattern,n=e.productListUrlPattern;if(matchUrlPattern(o)){return"cart"}if(matchUrlPattern(r)){return"productDetail"}if(matchUrlPattern(n)){return"productList"}if(matchUrlPattern(t)){return"home"}return""};var getProductsOnPage=function(){var e,o;var t=zonosStore.helloSettings,r=t.productAddToCartElementSelector,n=t.productDescriptionElementSelector,i=t.productTitleElementSelector,s=t.restrictionBehavior;if(!i||!n){logError("Hello Could not check item restrictions - must provide title and description selectors.")}var a=i&&isValidSelector(i)&&document.querySelectorAll(i)||[];var l=n&&isValidSelector(n)&&document.querySelectorAll(n)||[];if(a.length!==l.length){logError("Hello Could not check item restrictions - Title and description selectors do not match");return[]}var d=s==="RESTRICT_AND_BLOCK";var h=d&&r&&isValidSelector(r)&&document.querySelectorAll(r)||[];if(d&&h.length!==l.length){logError('Hello could not disable "Add to cart" buttons - Title and add to cart selectors do not match')}var u=[];for(var c=0;c<a.length;c++){var f=a[c];var m=l[c];var g=h[c];if(f&&m){var v={cartButtonNode:g||null,description:((e=m.textContent)===null||e===void 0?void 0:e.trim())||"",title:((o=f.textContent)===null||o===void 0?void 0:o.trim())||""};u.push(v)}}return u};var zonosHelloCss=":host{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:inline-block}:host .zonos--hello-wrapper{position:relative}:host .zonos--hello-wrapper .zonos--hello-dialog-wrapper-mobile-override{position:fixed;bottom:0;left:0;width:100vw;z-index:1001;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content}@media (max-width: 768px){:host .zonos--hello-wrapper{position:fixed;bottom:0;left:0;width:100vw;z-index:1001;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content}}:host .zonos--hello-widget{-webkit-transition:all 0.7s cubic-bezier(0.31, -0.02, 0.06, 1.53);transition:all 0.7s cubic-bezier(0.31, -0.02, 0.06, 1.53);padding:6px;border-radius:30px;background:var(--zonos-elements-page-background);font-size:var(--zonos-elements-font-size-s);border:var(--zonos-elements-border);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;cursor:pointer;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;position:relative;z-index:1000}:host .zonos--hello-widget>.zonos--hello-message{-ms-flex-order:0;order:0;max-width:0;height:100%;white-space:nowrap;-webkit-transition:border 0.3s ease-in, all 0.7s cubic-bezier(0.31, -0.02, 0.06, 1.53);transition:border 0.3s ease-in, all 0.7s cubic-bezier(0.31, -0.02, 0.06, 1.53);overflow:hidden;color:var(--zonos-elements-text-color);position:absolute;background:var(--zonos-elements-page-background);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;border-top-left-radius:30px;border-bottom-left-radius:30px;left:0;-webkit-transform:translateX(calc(-100% + 16px));transform:translateX(calc(-100% + 16px));width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;border-top:var(--zonos-elements-border);border-bottom:var(--zonos-elements-border)}:host .zonos--hello-widget.zonos--hello-has-restrictions{background:var(--zonos-elements-red-100);border:1px solid var(--zonos-elements-red-200)}:host .zonos--hello-widget.zonos--hello-has-restrictions>.zonos--hello-message{background:var(--zonos-elements-red-100);color:var(--zonos-elements-red-800);font-weight:500}:host .zonos--hello-widget.zonos--hello-has-restrictions.zonos--hello-show-peek-message>.zonos--hello-message{border:1px solid var(--zonos-elements-red-200)}:host .zonos--hello-widget.zonos--hello-show-peek-message{max-width:100vw;width:100%}:host .zonos--hello-widget.zonos--hello-show-peek-message>.zonos--hello-message{max-width:100vw;padding:0 6px;padding-right:16px;border:var(--zonos-elements-border)}:host .zonos--hello-widget.zonos--hello-show-peek-message:not(.zonos--hello-widget-animate-from-left){border-top-left-radius:0;border-bottom-left-radius:0}:host .zonos--hello-widget.zonos--hello-show-peek-message:not(.zonos--hello-widget-animate-from-left)>.zonos--hello-message{border-right:none}:host .zonos--hello-widget.zonos--hello-show-peek-message.zonos--hello-widget-animate-from-left{border-top-right-radius:0;border-bottom-right-radius:0}:host .zonos--hello-widget.zonos--hello-show-peek-message.zonos--hello-widget-animate-from-left>.zonos--hello-message{border-left:0}:host .zonos--hello-widget.zonos--hello-show-peek-message.zonos--hello-widget-animate-from-left>.zonos--hello-message{padding-left:16px;padding-right:6px;border-left:none}:host .zonos--hello-widget.zonos--hello-widget-animate-from-left>.zonos--hello-message{-ms-flex-order:1;order:1;-webkit-transform:translateX(calc(100% - 16px));transform:translateX(calc(100% - 16px));right:0;left:auto;border-top-left-radius:0;border-bottom-left-radius:0;border-top-right-radius:30px;border-bottom-right-radius:30px}:host .zonos--hello-widget .zonos--hello-country-flag-wrapper{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center}:host .zonos--hello-widget .zonos--hello-country-flag-wrapper .zonos--hello-country-flag{height:18px;width:18px;position:relative;overflow:hidden;border-radius:30px;-webkit-box-shadow:var(--zonos-elements-v3-shadow-medium);box-shadow:var(--zonos-elements-v3-shadow-medium);z-index:10;justify-self:center}@media (max-width: 768px){:host .zonos--hello-widget .zonos--hello-country-flag-wrapper .zonos--hello-country-flag{border-radius:var(--zonos-elements-radius-4);width:24px}}@media (max-width: 768px){:host .zonos--hello-widget{position:fixed;bottom:32px;right:32px;border-radius:var(--zonos-elements-radius-4);padding:4px;border:1px solid transparent}:host .zonos--hello-widget.zonos--hello-widget-left{left:32px;right:auto}:host .zonos--hello-widget.zonos--hello-widget-top{bottom:auto;top:32px}:host .zonos--hello-widget.zonos--hello-has-restrictions.zonos--hello-show-peek-message>.zonos--hello-message{border:none}:host .zonos--hello-widget>.zonos--hello-message{position:relative;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;border-radius:30px;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;top:0;bottom:0;left:0;-webkit-transform:translateX(0);transform:translateX(0);width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;border:none}:host .zonos--hello-widget.zonos--hello-widget-animate-from-left>.zonos--hello-message{-webkit-transform:translateX(0);transform:translateX(0)}:host .zonos--hello-widget.zonos--hello-show-peek-message{width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}:host .zonos--hello-widget.zonos--hello-show-peek-message:not(.zonos--hello-widget-animate-from-left){border-top-left-radius:var(--zonos-elements-radius-4);border-bottom-left-radius:var(--zonos-elements-radius-4)}:host .zonos--hello-widget.zonos--hello-show-peek-message.zonos--hello-widget-animate-from-left{border-top-right-radius:var(--zonos-elements-radius-4);border-bottom-right-radius:var(--zonos-elements-radius-4)}:host .zonos--hello-widget.zonos--hello-show-peek-message.zonos--hello-widget-animate-from-left>.zonos--hello-message{padding-left:8px;padding-right:4px}:host .zonos--hello-widget.zonos--hello-show-peek-message>.zonos--hello-message{padding:0 var(--zonos-elements-radius-4);padding-right:6px;border:none}:host .zonos--hello-widget .zonos--hello-country-flag-wrapper{border-radius:var(--zonos-elements-radius-4)}}:host .zonos--hello-mobile-override.zonos--hello-widget{position:fixed;bottom:32px;right:32px;border-radius:var(--zonos-elements-radius-4);padding:4px;border:1px solid transparent}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-widget-left{left:32px;right:auto}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-widget-top{bottom:auto;top:32px}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-has-restrictions.zonos--hello-show-peek-message>.zonos--hello-message{border:none}:host .zonos--hello-mobile-override.zonos--hello-widget>.zonos--hello-message{position:relative;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;border-radius:30px;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;top:0;bottom:0;left:0;-webkit-transform:translateX(0);transform:translateX(0);width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;border:none}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-widget-animate-from-left>.zonos--hello-message{-webkit-transform:translateX(0);transform:translateX(0)}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-show-peek-message{width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-show-peek-message:not(.zonos--hello-widget-animate-from-left){border-top-left-radius:var(--zonos-elements-radius-4);border-bottom-left-radius:var(--zonos-elements-radius-4)}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-show-peek-message.zonos--hello-widget-animate-from-left{border-top-right-radius:var(--zonos-elements-radius-4);border-bottom-right-radius:var(--zonos-elements-radius-4)}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-show-peek-message.zonos--hello-widget-animate-from-left>.zonos--hello-message{padding-left:8px;padding-right:4px}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-show-peek-message>.zonos--hello-message{padding:0 var(--zonos-elements-radius-4);padding-right:6px;border:none}:host .zonos--hello-mobile-override.zonos--hello-widget .zonos--hello-country-flag-wrapper{border-radius:var(--zonos-elements-radius-4)}:host .zonos--hello-mobile-override.zonos--hello-widget .zonos--hello-country-flag{border-radius:var(--zonos-elements-radius-4);width:24px}";var ZonosHelloStyle0=zonosHelloCss;var PEEK_MESSAGE_CLOSE_DELAY_MS=3e3;var RESIZE_DEBOUNCE_DELAY_MS=500;var ZonosHello=function(){function e(e){var o=this;registerInstance(this,e);this.getHelloPeekMessage=function(e){var t=zonosStore.currentHelloPage==="productDetail"||zonosStore.currentHelloPage==="productList";if(t&&o.allRestrictedItems.length){var r=translate("click to learn more");var n=zonosStore.currentHelloPage==="productDetail"?translate("Restricted item"):translate("Restricted items found");return"".concat(n," - ").concat(r)}switch(zonosStore.currentHelloPage){case"cart":return translate("Prepay duties and taxes at checkout");case"productList":case"productDetail":return translate("See duty and tax thresholds");default:return translate("Welcome to [storeName]!",{storeName:e})}};this.enableShowPeekMessage=function(){if(o.peekMessage){o.showPeekMessage=true}};this.getNewItemRestrictions=function(e){return __awaiter(o,void 0,void 0,(function(){var o,t;return __generator(this,(function(r){switch(r.label){case 0:o=zonosStore.currentHelloPage==="productDetail"||zonosStore.currentHelloPage==="productList";if(!o||zonosStore.helloSettings.restrictionBehavior==="DISABLED"){return[2,[]]}return[4,detectItemRestrictions(e)];case 1:t=r.sent();return[2,t]}}))}))};this.triggerShowPeekMessage=function(){o.peekMessage=o.getHelloPeekMessage(zonosStore.organizationName);var e=zonosStore.helloSettings,t=e.peekMessageBehavior,r=e.peekMessageDelay;var n=r*1e3;if(t==="ENABLED"){setTimeout((function(){o.enableShowPeekMessage();var e=o.allRestrictedItems.some((function(e){return o.productsOnPage.some((function(o){return o.description===e.itemDescription}))}));if(!e){setTimeout((function(){o.showPeekMessage=false}),PEEK_MESSAGE_CLOSE_DELAY_MS)}}),n)}};this.disableAddToCartButtons=function(){if(o.productsOnPage.length){o.productsOnPage.forEach((function(e){var t,r;var n=o.allRestrictedItems.some((function(o){return o.itemDescription===e.description}));if(n){(t=e.cartButtonNode)===null||t===void 0?void 0:t.setAttribute("disabled","disabled")}else{(r=e.cartButtonNode)===null||r===void 0?void 0:r.removeAttribute("disabled")}}))}};this.handleItemRestrictions=function(){return __awaiter(o,void 0,void 0,(function(){var e,o;var t,r;var n=this;return __generator(this,(function(i){switch(i.label){case 0:this.productsOnPage=getProductsOnPage();e=this.productsOnPage.filter((function(e){return!n.allFoundProducts.some((function(o){return o.title===e.title}))}));return[4,this.getNewItemRestrictions(e)];case 1:o=i.sent();(t=this.allRestrictedItems).push.apply(t,o);(r=this.allFoundProducts).push.apply(r,e);this.disableAddToCartButtons();return[2]}}))}))};this.reloadHelloData=function(){return __awaiter(o,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:return[4,this.handleItemRestrictions()];case 1:e.sent();this.triggerShowPeekMessage();return[2]}}))}))};this.handleProductCountChange=debounce_1((function(){var e=zonosStore.helloSettings.productTitleElementSelector;if(e){var t=getProductsOnPage();if(o.allFoundProducts.length!==t.length&&window.location.href===o.initialUrl){if(!o.allFoundProducts.length){return}void o.reloadHelloData()}}}),1e3);this.watchProductCountChange=function(){var e=new MutationObserver(o.handleProductCountChange);e.observe(document.body,{childList:true,subtree:true})};this.watchPriceChange=function(){var e=new MutationObserver((function(){return void o.displayCurrency()}));e.observe(document.body,{attributes:true,childList:true,subtree:true})};this.updateHelloOnPageChange=function(){o.watchProductCountChange();setInterval((function(){if(window.location.href!==o.initialUrl){var e=o.initialUrl&&new URL(o.initialUrl);var t=e&&getZCountryUrlParam(e.searchParams);if(t!==localizationStore.selectedCountryCode){o.allFoundProducts=[];o.allRestrictedItems=[];o.productsOnPage=[]}o.initialUrl=window.location.href;zonosStore.currentHelloPage=getCurrentHelloLocalePage();var r=new URL(window.location.href);var n=getZCountryUrlParam(r.searchParams);if(!n){setZCountryUrlParam(localizationStore.selectedCountryCode);return}void o.reloadHelloData()}}),1e3)};this.changeShowDialog=function(e){o.showDialog=e};this.shouldAnimateLeftDesktop=function(){var e=o.helloRef&&getComputedStyle(o.helloRef).position;if(o.helloRef&&e==="relative"){var t=getHasMoreSpaceOnRight(o.helloRef);return t}};this.shouldRenderHello=function(e){if(e===void 0){e=true}if(!localizationStore.localizationLoaded){return false}var o=zonosStore.helloSettings.showForCountries;if(e){if(!localizationStore.isShippableCountry){log("Hello: not shippable country - Show for countries: ".concat(o))}}if(o==="ONLY_SHIPPABLE"){return localizationStore.isShippableCountry}if(o==="ALL"){return true}return o===null||o===void 0?void 0:o.includes(localizationStore.selectedCountryCode||"")};this.mobileLocationOverride=undefined;this.animateFromLeftOverride=undefined;this.appearanceSettingsOverride=undefined;this.showPeekMessage=false;this.zonosStoreHelloSettings=zonosStore.helloSettings;this.showDialog=false;this.peekMessage="";this.initialUrl="";this.allRestrictedItems=[];this.allFoundProducts=[];this.productsOnPage=[]}e.prototype.componentWillLoad=function(){var e=this;var o=setInterval((function(){return __awaiter(e,void 0,void 0,(function(){return __generator(this,(function(e){if(!this.helloRef){return[2]}if(zonosStore.loadedConfig){this.helloRef.setAttribute("data-zonos-hello-loaded","");this.updateHelloOnPageChange();this.watchPriceChange();this.handleAppearanceSettingsOverrideChange();clearInterval(o)}return[2]}))}))}),100)};e.prototype.displayCurrency=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){if(zonosStore.helloSettings.currencyBehavior==="DISABLED"){return[2]}if(!localizationStore.exchangeRate){log("Could not display currency. Exchange rate and format data is not available.","warn");return[2]}currencyDisplay();return[2]}))}))};e.prototype.convertAndFormat=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(o){return[2,currencyConvertAndFormat(e)]}))}))};e.prototype.convert=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(o){return[2,currencyConvert(e)]}))}))};e.prototype.format=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(o){return[2,currencyFormat({amount:e})]}))}))};e.prototype.openHelloDialog=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(o){this.changeShowDialog(e);return[2]}))}))};e.prototype.handleResize=function(){debounce_1(this.render.bind(this),RESIZE_DEBOUNCE_DELAY_MS)};e.prototype.handleAppearanceSettingsOverrideChange=function(){var e;if((e=this.appearanceSettingsOverride)===null||e===void 0?void 0:e.theme){this.appearanceSettingsOverride.theme=getZonosStoreTheme(this.appearanceSettingsOverride.theme)}};e.prototype.render=function(){var e=this;var o,t;var r=(o=zonosStore.helloSettings.excludedUrlPatterns)===null||o===void 0?void 0:o.some((function(e){return new RegExp(e).test(window.location.href)}));if(r){log("Hello is excluded on this url","warn");return null}var n=localizationStore.selectedCountryCode;var i=this.mobileLocationOverride||zonosStore.helloSettings.mobileLocation;var s=window.innerWidth<768;var a=this.animateFromLeftOverride||s&&i.includes("LEFT")||this.shouldAnimateLeftDesktop()||false;var l=i.includes("TOP");var d=mergeConfig(zonosStore.appearance,this.appearanceSettingsOverride);var u=d.theme;var c=(t=this.allRestrictedItems)===null||t===void 0?void 0:t.filter((function(o){return e.productsOnPage.some((function(e){return e.description===o.itemDescription}))}));this.peekMessage=this.getHelloPeekMessage(zonosStore.organizationName);var f=this.shouldRenderHello()&&!!n;return h(Host,{class:"zonos--hello zonos--elements","data-theme":u},f&&h("div",{class:"zonos--hello-wrapper"},h("button",{class:classes(["zonos--hello-widget",this.showPeekMessage&&"zonos--hello-show-peek-message",this.mobileLocationOverride&&"zonos--hello-mobile-override",a&&"zonos--hello-widget-left zonos--hello-widget-animate-from-left",l&&"zonos--hello-widget-top",!!this.allRestrictedItems.length&&"zonos--hello-has-restrictions"]),onClick:function(){void e.changeShowDialog(!e.showDialog)},onMouseEnter:function(){return e.enableShowPeekMessage()},onMouseLeave:function(){return e.showPeekMessage=false},ref:function(o){return o&&(e.helloRef=o)}},h("zonos-text",{class:"zonos--hello-message"},this.peekMessage),n&&h("div",{class:"zonos--hello-country-flag-wrapper"},h("zonos-country-flag",{class:"zonos--hello-country-flag",countryCode:n}))),h("div",{class:classes(["zonos--hello-dialog-wrapper",this.mobileLocationOverride&&"zonos--hello-dialog-wrapper-mobile-override"]),style:{height:this.showDialog?"fit-content":"0px"}},h("zonos-hello-dialog",{animateFromLeftOverride:this.animateFromLeftOverride,appearanceSettings:d,isOpen:this.showDialog,mobileLocationOverride:this.mobileLocationOverride,restrictedItems:c,setIsOpen:this.changeShowDialog}))))};Object.defineProperty(e,"watchers",{get:function(){return{appearanceSettingsOverride:["handleAppearanceSettingsOverrideChange"]}},enumerable:false,configurable:true});return e}();ZonosHello.style=ZonosHelloStyle0;export{ZonosHello as zonos_hello};
1
+ var __awaiter=this&&this.__awaiter||function(e,o,t,r){function n(e){return e instanceof t?e:new t((function(o){o(e)}))}return new(t||(t=Promise))((function(t,i){function s(e){try{l(r.next(e))}catch(e){i(e)}}function a(e){try{l(r["throw"](e))}catch(e){i(e)}}function l(e){e.done?t(e.value):n(e.value).then(s,a)}l((r=r.apply(e,o||[])).next())}))};var __generator=this&&this.__generator||function(e,o){var t={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,n,i,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(e){return function(o){return l([e,o])}}function l(a){if(r)throw new TypeError("Generator is already executing.");while(s&&(s=0,a[0]&&(t=0)),t)try{if(r=1,n&&(i=a[0]&2?n["return"]:a[0]?n["throw"]||((i=n["return"])&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;if(n=0,i)a=[a[0]&2,i.value];switch(a[0]){case 0:case 1:i=a;break;case 4:t.label++;return{value:a[1],done:false};case 5:t.label++;n=a[1];a=[0];continue;case 7:a=t.ops.pop();t.trys.pop();continue;default:if(!(i=t.trys,i=i.length>0&&i[i.length-1])&&(a[0]===6||a[0]===2)){t=0;continue}if(a[0]===3&&(!i||a[1]>i[0]&&a[1]<i[3])){t.label=a[1];break}if(a[0]===6&&t.label<i[1]){t.label=i[1];i=a;break}if(i&&t.label<i[2]){t.label=i[2];t.ops.push(a);break}if(i[2])t.ops.pop();t.trys.pop();continue}a=o.call(e,t)}catch(e){a=[6,e];n=0}finally{r=i=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};import{r as registerInstance,h,H as Host}from"./index-3b46f3c3.js";import{_ as _root,e as _baseGetTag,i as isObjectLike_1,f as isObject_1,z as zonosStore,g as getZonosStoreTheme,m as mergeConfig}from"./zonosStore-ba9e541e.js";import{r as handleFetch,l as localizationStore,u as isValidSelector,t as translate,w as getZCountryUrlParam,x as setZCountryUrlParam,y as currencyDisplay,z as currencyConvertAndFormat,A as currencyConvert,B as currencyFormat}from"./cart-b96aaa4f.js";import{c as classes}from"./classes-0d95c529.js";import{a as logError,l as log}from"./logError-c456c092.js";import{g as getHasMoreSpaceOnRight}from"./getHasMoreSpaceOnRight-70eb913a.js";import"./isDarkColor-f8324c10.js";import"./getBorderRadius-947c24de.js";var root=_root;var now$1=function(){return root.Date.now()};var now_1=now$1;var reWhitespace=/\s/;function trimmedEndIndex$1(e){var o=e.length;while(o--&&reWhitespace.test(e.charAt(o))){}return o}var _trimmedEndIndex=trimmedEndIndex$1;var trimmedEndIndex=_trimmedEndIndex;var reTrimStart=/^\s+/;function baseTrim$1(e){return e?e.slice(0,trimmedEndIndex(e)+1).replace(reTrimStart,""):e}var _baseTrim=baseTrim$1;var baseGetTag=_baseGetTag,isObjectLike=isObjectLike_1;var symbolTag="[object Symbol]";function isSymbol$1(e){return typeof e=="symbol"||isObjectLike(e)&&baseGetTag(e)==symbolTag}var isSymbol_1=isSymbol$1;var baseTrim=_baseTrim,isObject$1=isObject_1,isSymbol=isSymbol_1;var NAN=0/0;var reIsBadHex=/^[-+]0x[0-9a-f]+$/i;var reIsBinary=/^0b[01]+$/i;var reIsOctal=/^0o[0-7]+$/i;var freeParseInt=parseInt;function toNumber$1(e){if(typeof e=="number"){return e}if(isSymbol(e)){return NAN}if(isObject$1(e)){var o=typeof e.valueOf=="function"?e.valueOf():e;e=isObject$1(o)?o+"":o}if(typeof e!="string"){return e===0?e:+e}e=baseTrim(e);var t=reIsBinary.test(e);return t||reIsOctal.test(e)?freeParseInt(e.slice(2),t?2:8):reIsBadHex.test(e)?NAN:+e}var toNumber_1=toNumber$1;var isObject=isObject_1,now=now_1,toNumber=toNumber_1;var FUNC_ERROR_TEXT="Expected a function";var nativeMax=Math.max,nativeMin=Math.min;function debounce(e,o,t){var r,n,i,s,a,l,d=0,h=false,u=false,c=true;if(typeof e!="function"){throw new TypeError(FUNC_ERROR_TEXT)}o=toNumber(o)||0;if(isObject(t)){h=!!t.leading;u="maxWait"in t;i=u?nativeMax(toNumber(t.maxWait)||0,o):i;c="trailing"in t?!!t.trailing:c}function f(o){var t=r,i=n;r=n=undefined;d=o;s=e.apply(i,t);return s}function m(e){d=e;a=setTimeout(z,o);return h?f(e):s}function g(e){var t=e-l,r=e-d,n=o-t;return u?nativeMin(n,i-r):n}function v(e){var t=e-l,r=e-d;return l===undefined||t>=o||t<0||u&&r>=i}function z(){var e=now();if(v(e)){return w(e)}a=setTimeout(z,g(e))}function w(e){a=undefined;if(c&&r){return f(e)}r=n=undefined;return s}function p(){if(a!==undefined){clearTimeout(a)}d=0;r=l=n=a=undefined}function b(){return a===undefined?s:w(now())}function x(){var e=now(),t=v(e);r=arguments;n=this;l=e;if(t){if(a===undefined){return m(l)}if(u){clearTimeout(a);a=setTimeout(z,o);return f(l)}}if(a===undefined){a=setTimeout(z,o)}return s}x.cancel=p;x.flush=b;return x}var debounce_1=debounce;var checkItemRestrictions=function(e){return __awaiter(void 0,[e],void 0,(function(e){var o,t,r,n,i,s;var a=e.items,l=e.shipFrom,d=e.shipTo;return __generator(this,(function(e){switch(e.label){case 0:t="".concat("https://v1.route.js.zonos.com","/api/zonos-elements/check-item-restrictions");r={items:a,shipFrom:l,shipTo:d};return[4,handleFetch(t,{body:r,method:"POST"})];case 1:n=e.sent(),i=n.errors,s=n.json;if(i.length||!s){logError("Error fetching item restrictions: ".concat((o=i.find(Boolean))===null||o===void 0?void 0:o.message));return[2,[]]}return[2,s.filter(Boolean)]}}))}))};var detectItemRestrictions=function(e){return __awaiter(void 0,void 0,void 0,(function(){var o,t,r,n;return __generator(this,(function(i){switch(i.label){case 0:if(!e.length){return[2,[]]}o=localizationStore.selectedCountryCode;if(!o){logError("Hello Could not check item restrictions - No country code selected");return[2,[]]}t=e.map((function(e){return{description:e.description,name:e.title}}));return[4,checkItemRestrictions({items:t,shipFrom:"AD",shipTo:o})];case 1:r=i.sent();n=r.map((function(e){var o;var r=((o=t.filter((function(o){return o.description===e.itemDescription})).find(Boolean))===null||o===void 0?void 0:o.name)||"";return Object.assign(Object.assign({},e),{name:r})}));return[2,n]}}))}))};var matchUrlPattern=function(e){var o=e===null||e===void 0?void 0:e.replace("www.","").replace("https://","");return o&&new RegExp(o).test(window.location.href)};var getCurrentHelloLocalePage=function(){var e=zonosStore.helloSettings,o=e.cartUrlPattern,t=e.homepageUrlPattern,r=e.productDetailUrlPattern,n=e.productListUrlPattern;if(matchUrlPattern(o)){return"cart"}if(matchUrlPattern(r)){return"productDetail"}if(matchUrlPattern(n)){return"productList"}if(matchUrlPattern(t)){return"home"}return""};var getProductsOnPage=function(){var e,o;var t=zonosStore.helloSettings,r=t.productAddToCartElementSelector,n=t.productDescriptionElementSelector,i=t.productTitleElementSelector,s=t.restrictionBehavior;if(!i||!n){logError("Hello Could not check item restrictions - must provide title and description selectors.")}var a=i&&isValidSelector(i)&&document.querySelectorAll(i)||[];var l=n&&isValidSelector(n)&&document.querySelectorAll(n)||[];if(a.length!==l.length){logError("Hello Could not check item restrictions - Title and description selectors do not match");return[]}var d=s==="RESTRICT_AND_BLOCK";var h=d&&r&&isValidSelector(r)&&document.querySelectorAll(r)||[];if(d&&h.length!==l.length){logError('Hello could not disable "Add to cart" buttons - Title and add to cart selectors do not match')}var u=[];for(var c=0;c<a.length;c++){var f=a[c];var m=l[c];var g=h[c];if(f&&m){var v={cartButtonNode:g||null,description:((e=m.textContent)===null||e===void 0?void 0:e.trim())||"",title:((o=f.textContent)===null||o===void 0?void 0:o.trim())||""};u.push(v)}}return u};var zonosHelloCss=":host{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:inline-block}:host .zonos--hello-wrapper{position:relative}:host .zonos--hello-wrapper .zonos--hello-dialog-wrapper-mobile-override{position:fixed;bottom:0;left:0;width:100vw;z-index:1001;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content}@media (max-width: 768px){:host .zonos--hello-wrapper{position:fixed;bottom:0;left:0;width:100vw;z-index:1001;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content}}:host .zonos--hello-widget{-webkit-transition:all 0.7s cubic-bezier(0.31, -0.02, 0.06, 1.53);transition:all 0.7s cubic-bezier(0.31, -0.02, 0.06, 1.53);padding:6px;border-radius:30px;background:var(--zonos-elements-page-background);font-size:var(--zonos-elements-font-size-s);border:var(--zonos-elements-border);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;cursor:pointer;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;position:relative;z-index:1000}:host .zonos--hello-widget>.zonos--hello-message{-ms-flex-order:0;order:0;max-width:0;height:100%;white-space:nowrap;-webkit-transition:border 0.3s ease-in, all 0.7s cubic-bezier(0.31, -0.02, 0.06, 1.53);transition:border 0.3s ease-in, all 0.7s cubic-bezier(0.31, -0.02, 0.06, 1.53);overflow:hidden;color:var(--zonos-elements-text-color);position:absolute;background:var(--zonos-elements-page-background);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;border-top-left-radius:30px;border-bottom-left-radius:30px;left:0;-webkit-transform:translateX(calc(-100% + 16px));transform:translateX(calc(-100% + 16px));width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;border-top:var(--zonos-elements-border);border-bottom:var(--zonos-elements-border)}:host .zonos--hello-widget.zonos--hello-has-restrictions{background:var(--zonos-elements-red-100);border:1px solid var(--zonos-elements-red-200)}:host .zonos--hello-widget.zonos--hello-has-restrictions>.zonos--hello-message{background:var(--zonos-elements-red-100);color:var(--zonos-elements-red-800);font-weight:500}:host .zonos--hello-widget.zonos--hello-has-restrictions.zonos--hello-show-peek-message>.zonos--hello-message{border:1px solid var(--zonos-elements-red-200)}:host .zonos--hello-widget.zonos--hello-show-peek-message{max-width:100vw;width:100%}:host .zonos--hello-widget.zonos--hello-show-peek-message>.zonos--hello-message{max-width:100vw;padding:0 6px;padding-right:16px;border:var(--zonos-elements-border)}:host .zonos--hello-widget.zonos--hello-show-peek-message:not(.zonos--hello-widget-animate-from-left){border-top-left-radius:0;border-bottom-left-radius:0}:host .zonos--hello-widget.zonos--hello-show-peek-message:not(.zonos--hello-widget-animate-from-left)>.zonos--hello-message{border-right:none}:host .zonos--hello-widget.zonos--hello-show-peek-message.zonos--hello-widget-animate-from-left{border-top-right-radius:0;border-bottom-right-radius:0}:host .zonos--hello-widget.zonos--hello-show-peek-message.zonos--hello-widget-animate-from-left>.zonos--hello-message{border-left:0}:host .zonos--hello-widget.zonos--hello-show-peek-message.zonos--hello-widget-animate-from-left>.zonos--hello-message{padding-left:16px;padding-right:6px;border-left:none}:host .zonos--hello-widget.zonos--hello-widget-animate-from-left>.zonos--hello-message{-ms-flex-order:1;order:1;-webkit-transform:translateX(calc(100% - 16px));transform:translateX(calc(100% - 16px));right:0;left:auto;border-top-left-radius:0;border-bottom-left-radius:0;border-top-right-radius:30px;border-bottom-right-radius:30px}:host .zonos--hello-widget .zonos--hello-country-flag-wrapper{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center}:host .zonos--hello-widget .zonos--hello-country-flag-wrapper .zonos--hello-country-flag{height:18px;width:18px;position:relative;overflow:hidden;border-radius:30px;-webkit-box-shadow:var(--zonos-elements-v3-shadow-medium);box-shadow:var(--zonos-elements-v3-shadow-medium);z-index:10;justify-self:center}@media (max-width: 768px){:host .zonos--hello-widget .zonos--hello-country-flag-wrapper .zonos--hello-country-flag{border-radius:var(--zonos-elements-radius-4);width:24px}}@media (max-width: 768px){:host .zonos--hello-widget{position:fixed;bottom:32px;right:32px;border-radius:var(--zonos-elements-radius-4);padding:4px;border:1px solid transparent}:host .zonos--hello-widget.zonos--hello-widget-left{left:32px;right:auto}:host .zonos--hello-widget.zonos--hello-widget-top{bottom:auto;top:32px}:host .zonos--hello-widget.zonos--hello-has-restrictions.zonos--hello-show-peek-message>.zonos--hello-message{border:none}:host .zonos--hello-widget>.zonos--hello-message{position:relative;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;border-radius:30px;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;top:0;bottom:0;left:0;-webkit-transform:translateX(0);transform:translateX(0);width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;border:none}:host .zonos--hello-widget.zonos--hello-widget-animate-from-left>.zonos--hello-message{-webkit-transform:translateX(0);transform:translateX(0)}:host .zonos--hello-widget.zonos--hello-show-peek-message{width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}:host .zonos--hello-widget.zonos--hello-show-peek-message:not(.zonos--hello-widget-animate-from-left){border-top-left-radius:var(--zonos-elements-radius-4);border-bottom-left-radius:var(--zonos-elements-radius-4)}:host .zonos--hello-widget.zonos--hello-show-peek-message.zonos--hello-widget-animate-from-left{border-top-right-radius:var(--zonos-elements-radius-4);border-bottom-right-radius:var(--zonos-elements-radius-4)}:host .zonos--hello-widget.zonos--hello-show-peek-message.zonos--hello-widget-animate-from-left>.zonos--hello-message{padding-left:8px;padding-right:4px}:host .zonos--hello-widget.zonos--hello-show-peek-message>.zonos--hello-message{padding:0 var(--zonos-elements-radius-4);padding-right:6px;border:none}:host .zonos--hello-widget .zonos--hello-country-flag-wrapper{border-radius:var(--zonos-elements-radius-4)}}:host .zonos--hello-mobile-override.zonos--hello-widget{position:fixed;bottom:32px;right:32px;border-radius:var(--zonos-elements-radius-4);padding:4px;border:1px solid transparent}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-widget-left{left:32px;right:auto}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-widget-top{bottom:auto;top:32px}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-has-restrictions.zonos--hello-show-peek-message>.zonos--hello-message{border:none}:host .zonos--hello-mobile-override.zonos--hello-widget>.zonos--hello-message{position:relative;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;border-radius:30px;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;top:0;bottom:0;left:0;-webkit-transform:translateX(0);transform:translateX(0);width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;border:none}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-widget-animate-from-left>.zonos--hello-message{-webkit-transform:translateX(0);transform:translateX(0)}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-show-peek-message{width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-show-peek-message:not(.zonos--hello-widget-animate-from-left){border-top-left-radius:var(--zonos-elements-radius-4);border-bottom-left-radius:var(--zonos-elements-radius-4)}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-show-peek-message.zonos--hello-widget-animate-from-left{border-top-right-radius:var(--zonos-elements-radius-4);border-bottom-right-radius:var(--zonos-elements-radius-4)}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-show-peek-message.zonos--hello-widget-animate-from-left>.zonos--hello-message{padding-left:8px;padding-right:4px}:host .zonos--hello-mobile-override.zonos--hello-widget.zonos--hello-show-peek-message>.zonos--hello-message{padding:0 var(--zonos-elements-radius-4);padding-right:6px;border:none}:host .zonos--hello-mobile-override.zonos--hello-widget .zonos--hello-country-flag-wrapper{border-radius:var(--zonos-elements-radius-4)}:host .zonos--hello-mobile-override.zonos--hello-widget .zonos--hello-country-flag{border-radius:var(--zonos-elements-radius-4);width:24px}";var ZonosHelloStyle0=zonosHelloCss;var PEEK_MESSAGE_CLOSE_DELAY_MS=3e3;var RESIZE_DEBOUNCE_DELAY_MS=500;var ZonosHello=function(){function e(e){var o=this;registerInstance(this,e);this.getHelloPeekMessage=function(e){var t=zonosStore.currentHelloPage==="productDetail"||zonosStore.currentHelloPage==="productList";if(t&&o.allRestrictedItems.length){var r=translate("click to learn more");var n=zonosStore.currentHelloPage==="productDetail"?translate("Restricted item"):translate("Restricted items found");return"".concat(n," - ").concat(r)}switch(zonosStore.currentHelloPage){case"cart":return translate("Prepay duties and taxes at checkout");case"productList":case"productDetail":return translate("See duty and tax thresholds");default:return translate("Welcome to [storeName]",{storeName:e})}};this.enableShowPeekMessage=function(){if(o.peekMessage){o.showPeekMessage=true}};this.getNewItemRestrictions=function(e){return __awaiter(o,void 0,void 0,(function(){var o,t;return __generator(this,(function(r){switch(r.label){case 0:o=zonosStore.currentHelloPage==="productDetail"||zonosStore.currentHelloPage==="productList";if(!o||zonosStore.helloSettings.restrictionBehavior==="DISABLED"){return[2,[]]}return[4,detectItemRestrictions(e)];case 1:t=r.sent();return[2,t]}}))}))};this.triggerShowPeekMessage=function(){o.peekMessage=o.getHelloPeekMessage(zonosStore.organizationName);var e=zonosStore.helloSettings,t=e.peekMessageBehavior,r=e.peekMessageDelay;var n=r*1e3;if(t==="ENABLED"){setTimeout((function(){o.enableShowPeekMessage();var e=o.allRestrictedItems.some((function(e){return o.productsOnPage.some((function(o){return o.description===e.itemDescription}))}));if(!e){setTimeout((function(){o.showPeekMessage=false}),PEEK_MESSAGE_CLOSE_DELAY_MS)}}),n)}};this.disableAddToCartButtons=function(){if(o.productsOnPage.length){o.productsOnPage.forEach((function(e){var t,r;var n=o.allRestrictedItems.some((function(o){return o.itemDescription===e.description}));if(n){(t=e.cartButtonNode)===null||t===void 0?void 0:t.setAttribute("disabled","disabled")}else{(r=e.cartButtonNode)===null||r===void 0?void 0:r.removeAttribute("disabled")}}))}};this.handleItemRestrictions=function(){return __awaiter(o,void 0,void 0,(function(){var e,o;var t,r;var n=this;return __generator(this,(function(i){switch(i.label){case 0:this.productsOnPage=getProductsOnPage();e=this.productsOnPage.filter((function(e){return!n.allFoundProducts.some((function(o){return o.title===e.title}))}));return[4,this.getNewItemRestrictions(e)];case 1:o=i.sent();(t=this.allRestrictedItems).push.apply(t,o);(r=this.allFoundProducts).push.apply(r,e);this.disableAddToCartButtons();return[2]}}))}))};this.reloadHelloData=function(){return __awaiter(o,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:return[4,this.handleItemRestrictions()];case 1:e.sent();this.triggerShowPeekMessage();return[2]}}))}))};this.handleProductCountChange=debounce_1((function(){var e=zonosStore.helloSettings.productTitleElementSelector;if(e){var t=getProductsOnPage();if(o.allFoundProducts.length!==t.length&&window.location.href===o.initialUrl){if(!o.allFoundProducts.length){return}void o.reloadHelloData()}}}),1e3);this.watchProductCountChange=function(){var e=new MutationObserver(o.handleProductCountChange);e.observe(document.body,{childList:true,subtree:true})};this.watchPriceChange=function(){var e=new MutationObserver((function(){return void o.displayCurrency()}));e.observe(document.body,{attributes:true,childList:true,subtree:true})};this.updateHelloOnPageChange=function(){o.watchProductCountChange();setInterval((function(){if(window.location.href!==o.initialUrl){var e=o.initialUrl&&new URL(o.initialUrl);var t=e&&getZCountryUrlParam(e.searchParams);if(t!==localizationStore.selectedCountryCode){o.allFoundProducts=[];o.allRestrictedItems=[];o.productsOnPage=[]}o.initialUrl=window.location.href;zonosStore.currentHelloPage=getCurrentHelloLocalePage();var r=new URL(window.location.href);var n=getZCountryUrlParam(r.searchParams);if(!n){setZCountryUrlParam(localizationStore.selectedCountryCode);return}void o.reloadHelloData()}}),1e3)};this.changeShowDialog=function(e){o.showDialog=e};this.shouldAnimateLeftDesktop=function(){var e=o.helloRef&&getComputedStyle(o.helloRef).position;if(o.helloRef&&e==="relative"){var t=getHasMoreSpaceOnRight(o.helloRef);return t}};this.shouldRenderHello=function(e){if(e===void 0){e=true}if(!localizationStore.localizationLoaded){return false}var o=zonosStore.helloSettings.showForCountries;if(e){if(!localizationStore.isShippableCountry){log("Hello: not shippable country - Show for countries: ".concat(o))}}if(o==="ONLY_SHIPPABLE"){return localizationStore.isShippableCountry}if(o==="ALL"){return true}return o===null||o===void 0?void 0:o.includes(localizationStore.selectedCountryCode||"")};this.mobileLocationOverride=undefined;this.animateFromLeftOverride=undefined;this.appearanceSettingsOverride=undefined;this.showPeekMessage=false;this.zonosStoreHelloSettings=zonosStore.helloSettings;this.showDialog=false;this.peekMessage="";this.initialUrl="";this.allRestrictedItems=[];this.allFoundProducts=[];this.productsOnPage=[];this.isHelloWidgetRendered=false}e.prototype.componentWillLoad=function(){var e=this;var o=setInterval((function(){return __awaiter(e,void 0,void 0,(function(){return __generator(this,(function(e){if(!this.helloRef){return[2]}if(zonosStore.loadedConfig){this.helloRef.setAttribute("data-zonos-hello-loaded","");this.updateHelloOnPageChange();this.watchPriceChange();this.handleAppearanceSettingsOverrideChange();clearInterval(o)}return[2]}))}))}),100)};e.prototype.displayCurrency=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){if(zonosStore.helloSettings.currencyBehavior==="DISABLED"){return[2]}if(!localizationStore.exchangeRate){log("Could not display currency. Exchange rate and format data is not available.","warn");return[2]}currencyDisplay();return[2]}))}))};e.prototype.convertAndFormat=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(o){return[2,currencyConvertAndFormat(e)]}))}))};e.prototype.convert=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(o){return[2,currencyConvert(e)]}))}))};e.prototype.format=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(o){return[2,currencyFormat({amount:e})]}))}))};e.prototype.openHelloDialog=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(o){this.changeShowDialog(e);return[2]}))}))};e.prototype.handleResize=function(){debounce_1(this.render.bind(this),RESIZE_DEBOUNCE_DELAY_MS)};e.prototype.handleHelloWidgetInitializedState=function(e){var o=e.countryCode,t=e.currencyCode;var r,n;if(this.isHelloWidgetRendered){return}if(localizationStore.selectedCountryCode&&typeof zonosStore.helloSettings.onInitSuccess==="function"){this.isHelloWidgetRendered=true;void((n=(r=zonosStore.helloSettings).onInitSuccess)===null||n===void 0?void 0:n.call(r,{countryCode:o,currencyCode:t}))}};e.prototype.handleAppearanceSettingsOverrideChange=function(){var e;if((e=this.appearanceSettingsOverride)===null||e===void 0?void 0:e.theme){this.appearanceSettingsOverride.theme=getZonosStoreTheme(this.appearanceSettingsOverride.theme)}};e.prototype.render=function(){var e=this;var o,t;var r=(o=zonosStore.helloSettings.excludedUrlPatterns)===null||o===void 0?void 0:o.some((function(e){return new RegExp(e).test(window.location.href)}));if(r){log("Hello is excluded on this url","warn");return null}var n=localizationStore.selectedCountryCode,i=localizationStore.targetCurrency;var s=this.mobileLocationOverride||zonosStore.helloSettings.mobileLocation;var a=window.innerWidth<768;var l=this.animateFromLeftOverride||a&&s.includes("LEFT")||this.shouldAnimateLeftDesktop()||false;var d=s.includes("TOP");var u=mergeConfig(zonosStore.appearance,this.appearanceSettingsOverride);var c=u.theme;var f=(t=this.allRestrictedItems)===null||t===void 0?void 0:t.filter((function(o){return e.productsOnPage.some((function(e){return e.description===o.itemDescription}))}));this.peekMessage=this.getHelloPeekMessage(zonosStore.organizationName);var m=this.shouldRenderHello()&&!!n;if(m&&!this.isHelloWidgetRendered){this.handleHelloWidgetInitializedState({countryCode:n,currencyCode:i})}return h(Host,{class:"zonos--hello zonos--elements","data-theme":c},m&&h("div",{class:"zonos--hello-wrapper"},h("button",{class:classes(["zonos--hello-widget",this.showPeekMessage&&"zonos--hello-show-peek-message",this.mobileLocationOverride&&"zonos--hello-mobile-override",l&&"zonos--hello-widget-left zonos--hello-widget-animate-from-left",d&&"zonos--hello-widget-top",!!this.allRestrictedItems.length&&"zonos--hello-has-restrictions"]),onClick:function(){void e.changeShowDialog(!e.showDialog)},onMouseEnter:function(){return e.enableShowPeekMessage()},onMouseLeave:function(){return e.showPeekMessage=false},ref:function(o){return o&&(e.helloRef=o)}},h("zonos-text",{class:"zonos--hello-message"},this.peekMessage),n&&h("div",{class:"zonos--hello-country-flag-wrapper"},h("zonos-country-flag",{class:"zonos--hello-country-flag",countryCode:n}))),h("div",{class:classes(["zonos--hello-dialog-wrapper",this.mobileLocationOverride&&"zonos--hello-dialog-wrapper-mobile-override"]),style:{height:this.showDialog?"fit-content":"0px"}},h("zonos-hello-dialog",{animateFromLeftOverride:this.animateFromLeftOverride,appearanceSettings:u,isOpen:this.showDialog,mobileLocationOverride:this.mobileLocationOverride,restrictedItems:f,setIsOpen:this.changeShowDialog}))))};Object.defineProperty(e,"watchers",{get:function(){return{appearanceSettingsOverride:["handleAppearanceSettingsOverrideChange"]}},enumerable:false,configurable:true});return e}();ZonosHello.style=ZonosHelloStyle0;export{ZonosHello as zonos_hello};
@@ -1 +1 @@
1
- import{r as registerInstance,h,H as Host,d as getElement}from"./index-3b46f3c3.js";import{h as stripeStore}from"./cart-530a8750.js";import{a as logError}from"./logError-c456c092.js";import"./zonosStore-ba9e541e.js";import"./isDarkColor-f8324c10.js";import"./getBorderRadius-947c24de.js";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:"tabs"});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:"abebca876eac8bd507fcbdb1c029d2ed0f3b749a",class:"zonos--payment zonos--elements"},this.titleText&&h("zonos-text",{key:"142257f2052337206dbb70e70c87b5207f2bd97a",class:"zonos--title",type:"semiBoldLabel"},this.titleText),h("div",{key:"c55bbaea79a291e45d8ed37d556529365de89e9f",class:"zonos--payment-component"}))};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;export{ZonosPayment as zonos_payment};
1
+ import{r as registerInstance,h,H as Host,d as getElement}from"./index-3b46f3c3.js";import{h as stripeStore}from"./cart-b96aaa4f.js";import{a as logError}from"./logError-c456c092.js";import"./zonosStore-ba9e541e.js";import"./isDarkColor-f8324c10.js";import"./getBorderRadius-947c24de.js";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:"tabs"});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:"abebca876eac8bd507fcbdb1c029d2ed0f3b749a",class:"zonos--payment zonos--elements"},this.titleText&&h("zonos-text",{key:"142257f2052337206dbb70e70c87b5207f2bd97a",class:"zonos--title",type:"semiBoldLabel"},this.titleText),h("div",{key:"c55bbaea79a291e45d8ed37d556529365de89e9f",class:"zonos--payment-component"}))};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;export{ZonosPayment as zonos_payment};
@@ -3589,6 +3589,15 @@ type HelloConfig = {
3589
3589
  * @default ONLY_SHIPPABLE
3590
3590
  */
3591
3591
  showForCountries?: ShowForCountries;
3592
+ /**
3593
+ * Callback function to run after the Hello widget has been initialized. This should be triggered only once when hello is attached to the DOM.
3594
+ * **Note**: If hello is detached from the DOM and reattached, this callback will be called again.
3595
+ * @param params - The parameters containing the country code and currency code that hello is initialized with.
3596
+ */
3597
+ onInitSuccess?: (params: {
3598
+ countryCode: CountryCode;
3599
+ currencyCode: CurrencyCode;
3600
+ }) => Promise<void>;
3592
3601
  };
3593
3602
 
3594
3603
  type StripeStoreContactOption = {
@@ -3756,8 +3765,8 @@ type CheckoutConfig = {
3756
3765
  * @param items - The cart items.
3757
3766
  * @returns {string | null} - The error message to display to the user. If the message is empty or null, the payment will proceed.
3758
3767
  * @example
3759
- * onInventoryCheck: async (items) => {
3760
- * // Check if all items are available from the server.
3768
+ * onInventoryCheck: async ({ items }) => {
3769
+ * // Check if all items are available from the server. If the fetch is throwing an error, we will show a generic error message "Unable to check inventory. Please try again.".
3761
3770
  * const itemsInfo = await fetch('https://yourserver.com/api/get-available-items', {
3762
3771
  * method: 'POST',
3763
3772
  * body: JSON.stringify({ items }),
@@ -1 +1 @@
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=()=>{if("undefined"==typeof window)return null;const t=(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);if(!t)return null;if("dev-elements"===t)return"https://dev.elements.zonos.com";const o=`https://${t}.preview.js.zonos.com`;return e(`[ZONOS-WARNING] using '${o}' for loading script`,"warn"),fetch(o).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${o}' 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})),o},n="https://js.stripe.com/v3",r=/^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 i=null;const l=e=>(null!==i||(i=new Promise(((o,i)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(s),window.Stripe)o(window.Stripe);else try{let l=(()=>{const e=document.querySelectorAll(`script[src^="${n}"]`);for(let t=0;t<e.length;t++){const o=e[t];if(o&&r.test(o.src))return o}return null})();l&&e?console.warn(s):l||(l=(e=>{const o=document.createElement("script");o.src=`${n}`;const r=document.head||document.body;return r?(r.appendChild(o),o):(t("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==l||l.addEventListener("load",(()=>{window.Stripe?o(window.Stripe):i(new Error("Stripe.js not available"))})),null==l||l.addEventListener("error",(()=>{i(new Error("Failed to load Stripe.js"))}))}catch(e){return void i(e)}else o(null)}))),i),c=Promise.resolve().then((()=>l(null)));let d=!1;c.catch((e=>{d||console.warn(e)}));var a;const u=(()=>{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})()||"https://v1.3.27.js.zonos.com",m="https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.27",p="https://rsms.me",h="https://fonts.googleapis.com",y=/^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;class f{}a=f,f.doneInit=!1,f.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),f.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),f.isBigCommerce=!1,f.isNpm=!0,f.zonosQaUrl=null,f.version="v1.3.27",f.modeAlerted=!1,f.tempCartData=null,f.getCurrentTimestamp=()=>(new Date).getTime(),f.zonosController=null,f.init=async({appearance:o,checkoutSettings:n,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:l,storeId:c,zonosApiKey:d})=>{a.doneInit||(e(`====== ZONOS DEBUG MODE: on (${a.version}) ======`),d?(a.zonosApiKey=d,a.storeId=c,e("init zonos"),a.injectZonosCdn(),a.injectZonosCss(),a.injectFonts(),a.injectController({config:{appearance:o,checkoutSettings:n,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:l},zonosApiKey:d}),a.doneInit=!0):t("Missing Zonos API key"))},f.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},f.openHelloDialog=e=>{const t=document.querySelector("zonos-hello");t&&t.openHelloDialog(null==e||e)},f.showNotification=e=>{var t;null===(t=a.zonosController)||void 0===t||t.showNotification(e)},f.updateOrganizationName=e=>{var t;null===(t=a.zonosController)||void 0===t||t.updateOrganizationName(e)},f.disablePlaceOrderButtons=({autoEnable:e=!0,disable:t,placeOrderButtonSelector:o})=>{if(o){const n=document.querySelectorAll(o),r=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};n.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((()=>{n.forEach((e=>{e.removeAttribute("disabled"),e.removeEventListener("click",r)}))}),5e3)}},f.injectController=({config:o,zonosApiKey:n})=>{var r;if(document.querySelector("zonos-controller"))return;if(null===(r=o.checkoutSettings)||void 0===r?void 0:r.placeOrderButtonSelector){const e=o.checkoutSettings.placeOrderButtonSelector;a.disablePlaceOrderButtons({disable:!0,placeOrderButtonSelector:e});new MutationObserver((()=>{a.disablePlaceOrderButtons({disable:!0,placeOrderButtonSelector:e})})).observe(document.body,{childList:!0,subtree:!0})}const s=document.createElement("zonos-controller");s.config=o,s.zonosApiKey=n,s.addEventListener("stripeInitEvent",(async o=>{const{detail:n}=o;e("loading Stripe");const r=await(async(...e)=>{d=!0;const t=Date.now();return c.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);r?(window.Zonos.stripe=r,s.initCheckoutElement(r)):t("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(s),a.zonosController=s,e("Zonos controller injected!")},f.injectScript=({fallBackDomain:o,isModule:n,scriptDomain:r,theRestUrl:s})=>{const i=`${r}/${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");n?c.type="module":c.noModule=!0,c.src=i,c.crossOrigin="anonymous",c.onerror=()=>{/\/\/v\d+\./g.test(r)?(o&&a.injectScript({isModule:n,scriptDomain:o,theRestUrl:s}),t(`Failed to load ${c.src}`)):e("No need to fallback since this is not a versioned domain","warn")},l.appendChild(c)},f.getZonosUrl=()=>{if(a.isNpm){return o()||u}return u},f.injectZonosCdn=()=>{const t=a.getZonosUrl();a.injectScript({fallBackDomain:m,isModule:!0,scriptDomain:t,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),a.injectScript({fallBackDomain:m,isModule:!1,scriptDomain:t,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),e("Zonos cdn script injected!")},f.injectStylesheet=({fallBackDomain:o,stylesheetDomain:n,theRestUrl:r})=>{const s=document.head||document.body,i=document.createElement("link");i.rel="preconnect",i.href=`${u}/`,s.appendChild(i);const l=document.createElement("link");l.rel="stylesheet",l.href=`${n}/${r}`,l.onerror=()=>{const s=/\/\/v\d+\./g.test(n);s?(o&&s&&a.injectStylesheet({stylesheetDomain:o,theRestUrl:r}),t(`Failed to load ${l.href}`)):e("No need to fallback since this is not a versioned domain","warn")},s.appendChild(l)},f.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?e("Zonos style links already injected","warn"):(a.injectStylesheet({fallBackDomain:m,stylesheetDomain:u,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),e("Zonos style css injected!"))},f.injectFonts=()=>{if((()=>{const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${p}"]`);for(let t=0;t<e.length;t++){const o=e[t];if(o&&!y.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=p,t.appendChild(o);const n=document.createElement("link");n.rel="stylesheet",n.href=`${p}/inter/inter.css`,t.appendChild(n),e("Zonos font injected!")},f.setupGoogleFont=e=>{var t;null===(t=a.zonosController)||void 0===t||t.setupGoogleFont(e)},f.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^="${h}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=h,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=f})();
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=()=>{if("undefined"==typeof window)return null;const t=(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);if(!t)return null;if("dev-elements"===t)return"https://dev.elements.zonos.com";const o=`https://${t}.preview.js.zonos.com`;return e(`[ZONOS-WARNING] using '${o}' for loading script`,"warn"),fetch(o).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${o}' 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})),o},n="https://js.stripe.com/v3",r=/^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 i=null;const l=e=>(null!==i||(i=new Promise(((o,i)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(s),window.Stripe)o(window.Stripe);else try{let l=(()=>{const e=document.querySelectorAll(`script[src^="${n}"]`);for(let t=0;t<e.length;t++){const o=e[t];if(o&&r.test(o.src))return o}return null})();l&&e?console.warn(s):l||(l=(e=>{const o=document.createElement("script");o.src=`${n}`;const r=document.head||document.body;return r?(r.appendChild(o),o):(t("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==l||l.addEventListener("load",(()=>{window.Stripe?o(window.Stripe):i(new Error("Stripe.js not available"))})),null==l||l.addEventListener("error",(()=>{i(new Error("Failed to load Stripe.js"))}))}catch(e){return void i(e)}else o(null)}))),i),c=Promise.resolve().then((()=>l(null)));let d=!1;c.catch((e=>{d||console.warn(e)}));var a;const u=(()=>{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})()||"https://v1.3.29.js.zonos.com",m="https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.29",p="https://rsms.me",h="https://fonts.googleapis.com",y=/^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;class f{}a=f,f.doneInit=!1,f.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),f.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),f.isBigCommerce=!1,f.isNpm=!0,f.zonosQaUrl=null,f.version="v1.3.29",f.modeAlerted=!1,f.tempCartData=null,f.getCurrentTimestamp=()=>(new Date).getTime(),f.zonosController=null,f.init=async({appearance:o,checkoutSettings:n,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:l,storeId:c,zonosApiKey:d})=>{a.doneInit||(e(`====== ZONOS DEBUG MODE: on (${a.version}) ======`),d?(a.zonosApiKey=d,a.storeId=c,e("init zonos"),a.injectZonosCdn(),a.injectZonosCss(),a.injectFonts(),a.injectController({config:{appearance:o,checkoutSettings:n,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:l},zonosApiKey:d}),a.doneInit=!0):t("Missing Zonos API key"))},f.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},f.openHelloDialog=e=>{const t=document.querySelector("zonos-hello");t&&t.openHelloDialog(null==e||e)},f.showNotification=e=>{var t;null===(t=a.zonosController)||void 0===t||t.showNotification(e)},f.updateOrganizationName=e=>{var t;null===(t=a.zonosController)||void 0===t||t.updateOrganizationName(e)},f.disablePlaceOrderButtons=({autoEnable:e=!0,disable:t,placeOrderButtonSelector:o})=>{if(o){const n=document.querySelectorAll(o),r=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};n.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((()=>{n.forEach((e=>{e.removeAttribute("disabled"),e.removeEventListener("click",r)}))}),5e3)}},f.injectController=({config:o,zonosApiKey:n})=>{var r;if(document.querySelector("zonos-controller"))return;if(null===(r=o.checkoutSettings)||void 0===r?void 0:r.placeOrderButtonSelector){const e=o.checkoutSettings.placeOrderButtonSelector;a.disablePlaceOrderButtons({disable:!0,placeOrderButtonSelector:e});new MutationObserver((()=>{a.disablePlaceOrderButtons({disable:!0,placeOrderButtonSelector:e})})).observe(document.body,{childList:!0,subtree:!0})}const s=document.createElement("zonos-controller");s.config=o,s.zonosApiKey=n,s.addEventListener("stripeInitEvent",(async o=>{const{detail:n}=o;e("loading Stripe");const r=await(async(...e)=>{d=!0;const t=Date.now();return c.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);r?(window.Zonos.stripe=r,s.initCheckoutElement(r)):t("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(s),a.zonosController=s,e("Zonos controller injected!")},f.injectScript=({fallBackDomain:o,isModule:n,scriptDomain:r,theRestUrl:s})=>{const i=`${r}/${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");n?c.type="module":c.noModule=!0,c.src=i,c.crossOrigin="anonymous",c.onerror=()=>{/\/\/v\d+\./g.test(r)?(o&&a.injectScript({isModule:n,scriptDomain:o,theRestUrl:s}),t(`Failed to load ${c.src}`)):e("No need to fallback since this is not a versioned domain","warn")},l.appendChild(c)},f.getZonosUrl=()=>{if(a.isNpm){return o()||u}return u},f.injectZonosCdn=()=>{const t=a.getZonosUrl();a.injectScript({fallBackDomain:m,isModule:!0,scriptDomain:t,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),a.injectScript({fallBackDomain:m,isModule:!1,scriptDomain:t,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),e("Zonos cdn script injected!")},f.injectStylesheet=({fallBackDomain:o,stylesheetDomain:n,theRestUrl:r})=>{const s=document.head||document.body,i=document.createElement("link");i.rel="preconnect",i.href=`${u}/`,s.appendChild(i);const l=document.createElement("link");l.rel="stylesheet",l.href=`${n}/${r}`,l.onerror=()=>{const s=/\/\/v\d+\./g.test(n);s?(o&&s&&a.injectStylesheet({stylesheetDomain:o,theRestUrl:r}),t(`Failed to load ${l.href}`)):e("No need to fallback since this is not a versioned domain","warn")},s.appendChild(l)},f.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?e("Zonos style links already injected","warn"):(a.injectStylesheet({fallBackDomain:m,stylesheetDomain:u,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),e("Zonos style css injected!"))},f.injectFonts=()=>{if((()=>{const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${p}"]`);for(let t=0;t<e.length;t++){const o=e[t];if(o&&!y.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=p,t.appendChild(o);const n=document.createElement("link");n.rel="stylesheet",n.href=`${p}/inter/inter.css`,t.appendChild(n),e("Zonos font injected!")},f.setupGoogleFont=e=>{var t;null===(t=a.zonosController)||void 0===t||t.setupGoogleFont(e)},f.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^="${h}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=h,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=f})();
@@ -1 +1 @@
1
- (function(){"use strict";"function"==typeof SuppressedError&&SuppressedError;const e=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}};const o=async(o,t)=>{const r=(function(e,o){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&o.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(e);n<r.length;n++)o.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(e,r[n])&&(t[r[n]]=e[r[n]])}return t})(t||{},[]),n=r.body?JSON.stringify(r.body):void 0,s=r.method||"GET",i=new URL(o);i.searchParams.set("zToken",(function(e){try{return btoa(e).replace(/=/g,"")}catch(o){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(window.location.hostname));const 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),c=Object.assign(Object.assign({},r),{body:"GET"===s?void 0:n,headers:a,method:s});return(async(o,t)=>{let r;try{r=await fetch(o,t)}catch(e){return e instanceof Error?{errors:[{message:e.message,type:"unknown"}],json:null,response:null}:{errors:[{message:"Fail to fetch",type:"unknown"}],json:null,response:null}}const n=r.headers.get("Zonos-Mode"),s=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&n&&s&&("production"===n&&alert("Please be aware that you are currently operating in the production environment. Any interactions with the customer store, including payments, will be processed as real transactions!"),"test"===n&&alert("For testing payments, you can utilize the test payment information provided at this link: https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=elements#web-test-the-integration"),window.Zonos.modeAlerted=!0),r.ok)return{errors:[],json:await e({response:r}),response:r};const i=r.status.toString();try{const o=await e({response:r,shouldThrow:!0});return{errors:[{message:`${i}: ${JSON.stringify(o)}`,type:i}],json:null,response:r}}catch(e){return{errors:[{message:`${i}: Unknown error`,type:i}],json:null,response:null}}})(i.toString(),c)},t=(e,o,...t)=>{var r,n;if(!(!!(null===(r=window.Zonos)||void 0===r?void 0:r.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===(n=s.contentWindow)||void 0===n?void 0:n.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()}},r=(e,...o)=>{t(e,"error",...o)},n=async({endpoint:e,errors:t,metadata:r})=>{const n="userAgentData"in window.navigator?window.navigator.userAgentData:null,s={endpoint:e,errors:t,metadata:Object.assign({href:window.location.href,userAgent:n&&n.brands.length>0?n:window.navigator.userAgent},r)};o("https://v1.route.js.zonos.com/api/zonos-elements/log-error",{body:s,method:"POST"})};var s;const i=(()=>{if("undefined"==typeof window)return null;const e=(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);if(!e)return null;if("dev-elements"===e)return"https://dev.elements.zonos.com";const o=`https://${e}.preview.js.zonos.com`;return t(`[ZONOS-WARNING] using '${o}' for loading script`,"warn"),fetch(o).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${o}' 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,r=`${t}?${e.toString()}`;return window.history.replaceState(window.history.state,"",r),window.location.reload(),null})),o})();class a{static get isNpm(){return!1}}s=a,a.isBigCommerce=!1,a.requested=!1,a.zonosQaUrl=null,a.tempCartData=null,a.zonosApiKey=null,a.isLegacyCheckout=!1,a.legacyStoreLogo=null,a.legacyStoreFavicon=null,a.parallelLoadTimes=[],a.paralellLoadState="off",a.loadScriptLogHandler=async({cdnLoadTime:e,fallbackLoadTime:o,isError:t,metadata:r,scriptLoadUrl:n,storeId:s,type:i})=>{try{const e=window.performance.getEntriesByType("resource").find((e=>{const o=e;return o.name.includes(n)&&"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},r)))}catch(e){}},a.loadScriptLogParallelHandler=async e=>{try{if(s.parallelLoadTimes.push(e),2===s.parallelLoadTimes.length){const e=s.parallelLoadTimes.find((e=>"vercel"===e.type)),o=s.parallelLoadTimes.find((e=>"jsdelivr"===e.type));if(!e||!o)return;if(e.isError&&o.isError)return void n({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}});s.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){}},a.legacyCheckoutErrorHandler=({message:e,tempCartUUID:o})=>{r(`[ZONOS - loadZonos] ${e}`),n({endpoint:"LegacyCheckoutInit",errors:[e],metadata:{tempCartUUID:o}}),document.dispatchEvent(new CustomEvent("legacyCheckoutError",{detail:e}))},a.injectZonos=({initConfig:e,isGithubCdn:o=!1,parallelLoaded:r,url:a,version:c})=>{var l;const d=()=>{const e="https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.27";return c?e.replace(/@zonos\/elements@(.+)/,`@zonos/elements@${c}`):e},p=i||a,m=p.replace("https://","").replace("http://",""),u=document.createElement("script"),g=c&&c<"1.2.5"?"loadZonos.js":"zonos.js";u.src=`https://${m}/dist/scripts/${g}`,t(`[ZONOS - loadZonos] Injecting "${g}" from "${m}"`,"info");const w="4g"===(null===(l=(()=>{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===l?void 0:l.effectiveType),y=["dev.elements.zonos.com","zonos.com"].some((e=>window.location.href.includes(e))),h="on"===s.paralellLoadState&&w&&!o&&!y;if(h){const o=d();s.injectZonos({initConfig:e,isGithubCdn:!0,parallelLoaded:!0,url:o,version:c})}const f=performance.now();u.addEventListener("load",(()=>{if(h||r?s.loadScriptLogParallelHandler({fallbackLoadTime:performance.now()-f,scriptLoadUrl:u.src,storeId:s.storeId,type:o?"jsdelivr":"vercel"}):s.loadScriptLogHandler({fallbackLoadTime:performance.now()-f,scriptLoadUrl:u.src,storeId:s.storeId,type:o?"jsdelivr":"vercel"}),s.isBigCommerce||(s.isBigCommerce=!!window.stencilBootstrap||!!window.bcConfig||!!document.querySelector('script[src*="bigcommerce.com"]')),window.Zonos.isNpm=!1,window.Zonos.zonosQaUrl=i,window.Zonos.isBigCommerce=s.isBigCommerce,s.isLegacyCheckout){if(!s.zonosApiKey)throw s.legacyCheckoutErrorHandler({message:"zonosApiKey is required for legacy checkout",tempCartUUID:e.tempCartUUID}),new Error("zonosApiKey is required for legacy checkout");if(!s.tempCartData)throw s.legacyCheckoutErrorHandler({message:"tempCartData is required for legacy checkout",tempCartUUID:e.tempCartUUID}),new Error("zonosApiKey is required for legacy checkout");if(s.legacyStoreFavicon){const e=document.createElement("link");e.rel="shortcut icon",e.type="image/x-icon",e.href=s.legacyStoreFavicon,document.head.appendChild(e)}window.Zonos.tempCartData=s.tempCartData;const o=Object.assign(Object.assign({},e),{appearance:Object.assign(Object.assign({},e.appearance),{logoUrl:s.legacyStoreLogo||""}),checkoutSettings:Object.assign(Object.assign({},e.checkoutSettings),{successBehavior:"ZONOS_SUCCESS_PAGE",successRedirectUrl:s.tempCartData.contShoppingURL}),zonosApiKey:s.zonosApiKey});e=o}window.Zonos.version&&(t(`[ZONOS - loadZonos] Execute "Zonos.init" from "${g}" from "${m}"`,"info"),window.Zonos.init(e))})),u.addEventListener("error",(async()=>{if(!h&&!r){const o=d();s.injectZonos({initConfig:e,isGithubCdn:!0,url:o,version:c})}["localhost",".zonos.com"].some((e=>window.location.href.includes(e)))||i||(h||r?s.loadScriptLogParallelHandler({fallbackLoadTime:performance.now()-f,isError:!0,scriptLoadUrl:u.src,storeId:s.storeId,type:o?"jsdelivr":"vercel"}):n(o?{endpoint:u.src,errors:["zonos.js - Failed to fetch github CDN."],metadata:{cdnLoadTime:performance.now()-f,cdnType:"jsdelivr",loadUrl:p,version:c}}:{endpoint:u.src,errors:["[Info] Using alternative CDN. Failed to fetch script"],metadata:{vercelLoadTime:performance.now()-f}}))})),document.head.appendChild(u)},a.setupCartData=async e=>{const n=await(async e=>{const{errors:t,json:r}=await o("https://v1.route.js.zonos.com/api/bigcommerce/legacy-migration/get-temp-cart",{body:{tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"});return!r||t.length?null:r})(e);if(t("[ZONOS - loadZonos] getting temp cart data","info",n),!n)throw r("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),s.legacyCheckoutErrorHandler({message:"Error getting temp cart data",tempCartUUID:e}),new Error("Error getting temp cart data");return s.tempCartData=n.tempCart,s.legacyStoreLogo=n.storeLogoUrl,s.legacyStoreFavicon=n.storeFaviconUrl,{storeId:n.tempCart.storeId,zonosApiKey:n.zonosApiKey}},a.init=async e=>{var n;const i="https://v1.3.27.js.zonos.com",a=document.querySelector('script[src*="/zonos.js"]'),c=null===(n=document.querySelector("script[src*='/loadZonos.js']"))||void 0===n?void 0:n.src,l=null==c?void 0:c.includes("timestamp=");if(!(s.isNpm||c&&l))return void r("[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(a||!c||s.requested)return void t("[ZONOS - loadZonos] script is already loaded or requested","info");s.requested=!0;let d=e.storeId;if(e.tempCartUUID){const o=await s.setupCartData(e.tempCartUUID);d=o.storeId,s.zonosApiKey=o.zonosApiKey,s.isLegacyCheckout=!0}if(!d)return t("[ZONOS - loadZonos] loading latest script since storeId is not provided."),void s.injectZonos({initConfig:e,url:i,version:null});s.storeId=d;const p=new URL("https://v1.route.js.zonos.com/api/get-store-version");p.searchParams.set("storeId",e.storeId.toString());const{errors:m,json:u}=await o(p.toString());if(m.length||!u)return t("[ZONOS - loadZonos] Error getting store version, loadding the latest version.","error"),void s.injectZonos({initConfig:e,url:i,version:null});const{version:g}=u;if(!a){const{currentLoadScriptUrl:o,isForceLoadVersionDomain:r,isWhiteListed:n}=(({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))),r=["qa.js.zonos.com"].some((e=>o.includes(e)));return{currentLoadScriptUrl:o,isForceLoadVersionDomain:r,isWhiteListed:t}})({loadScriptSrc:c}),i=n&&!r?o:`${"alpha"===g?"alpha":`v${g}`}.js.zonos.com`,a=n&&!r?null:g;t("[ZONOS - loadZonos] injecting zonos script","info",{currentLoadScriptUrl:o,isForceLoadVersionDomain:r,isWhiteListed:n,loadUrl:i,loadVersion:a,version:g}),s.injectZonos({initConfig:e,url:i,version:a})}},void 0===window.Zonos&&(window.Zonos=a)})();
1
+ (function(){"use strict";"function"==typeof SuppressedError&&SuppressedError;const e=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}};const o=async(o,t)=>{const r=(function(e,o){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&o.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(e);n<r.length;n++)o.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(e,r[n])&&(t[r[n]]=e[r[n]])}return t})(t||{},[]),n=r.body?JSON.stringify(r.body):void 0,s=r.method||"GET",i=new URL(o);i.searchParams.set("zToken",(function(e){try{return btoa(e).replace(/=/g,"")}catch(o){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(window.location.hostname));const 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),c=Object.assign(Object.assign({},r),{body:"GET"===s?void 0:n,headers:a,method:s});return(async(o,t)=>{let r;try{r=await fetch(o,t)}catch(e){return e instanceof Error?{errors:[{message:e.message,type:"unknown"}],json:null,response:null}:{errors:[{message:"Fail to fetch",type:"unknown"}],json:null,response:null}}const n=r.headers.get("Zonos-Mode"),s=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&n&&s&&("production"===n&&alert("Please be aware that you are currently operating in the production environment. Any interactions with the customer store, including payments, will be processed as real transactions!"),"test"===n&&alert("For testing payments, you can utilize the test payment information provided at this link: https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=elements#web-test-the-integration"),window.Zonos.modeAlerted=!0),r.ok)return{errors:[],json:await e({response:r}),response:r};const i=r.status.toString();try{const o=await e({response:r,shouldThrow:!0});return{errors:[{message:`${i}: ${JSON.stringify(o)}`,type:i}],json:null,response:r}}catch(e){return{errors:[{message:`${i}: Unknown error`,type:i}],json:null,response:null}}})(i.toString(),c)},t=(e,o,...t)=>{var r,n;if(!(!!(null===(r=window.Zonos)||void 0===r?void 0:r.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===(n=s.contentWindow)||void 0===n?void 0:n.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()}},r=(e,...o)=>{t(e,"error",...o)},n=async({endpoint:e,errors:t,metadata:r})=>{const n="userAgentData"in window.navigator?window.navigator.userAgentData:null,s={endpoint:e,errors:t,metadata:Object.assign({href:window.location.href,userAgent:n&&n.brands.length>0?n:window.navigator.userAgent},r)};o("https://v1.route.js.zonos.com/api/zonos-elements/log-error",{body:s,method:"POST"})};var s;const i=(()=>{if("undefined"==typeof window)return null;const e=(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);if(!e)return null;if("dev-elements"===e)return"https://dev.elements.zonos.com";const o=`https://${e}.preview.js.zonos.com`;return t(`[ZONOS-WARNING] using '${o}' for loading script`,"warn"),fetch(o).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${o}' 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,r=`${t}?${e.toString()}`;return window.history.replaceState(window.history.state,"",r),window.location.reload(),null})),o})();class a{static get isNpm(){return!1}}s=a,a.isBigCommerce=!1,a.requested=!1,a.zonosQaUrl=null,a.tempCartData=null,a.zonosApiKey=null,a.isLegacyCheckout=!1,a.legacyStoreLogo=null,a.legacyStoreFavicon=null,a.parallelLoadTimes=[],a.paralellLoadState="off",a.loadScriptLogHandler=async({cdnLoadTime:e,fallbackLoadTime:o,isError:t,metadata:r,scriptLoadUrl:n,storeId:s,type:i})=>{try{const e=window.performance.getEntriesByType("resource").find((e=>{const o=e;return o.name.includes(n)&&"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},r)))}catch(e){}},a.loadScriptLogParallelHandler=async e=>{try{if(s.parallelLoadTimes.push(e),2===s.parallelLoadTimes.length){const e=s.parallelLoadTimes.find((e=>"vercel"===e.type)),o=s.parallelLoadTimes.find((e=>"jsdelivr"===e.type));if(!e||!o)return;if(e.isError&&o.isError)return void n({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}});s.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){}},a.legacyCheckoutErrorHandler=({message:e,tempCartUUID:o})=>{r(`[ZONOS - loadZonos] ${e}`),n({endpoint:"LegacyCheckoutInit",errors:[e],metadata:{tempCartUUID:o}}),document.dispatchEvent(new CustomEvent("legacyCheckoutError",{detail:e}))},a.injectZonos=({initConfig:e,isGithubCdn:o=!1,parallelLoaded:r,url:a,version:c})=>{var l;const d=()=>{const e="https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.29";return c?e.replace(/@zonos\/elements@(.+)/,`@zonos/elements@${c}`):e},p=i||a,m=p.replace("https://","").replace("http://",""),u=document.createElement("script"),g=c&&c<"1.2.5"?"loadZonos.js":"zonos.js";u.src=`https://${m}/dist/scripts/${g}`,t(`[ZONOS - loadZonos] Injecting "${g}" from "${m}"`,"info");const w="4g"===(null===(l=(()=>{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===l?void 0:l.effectiveType),y=["dev.elements.zonos.com","zonos.com"].some((e=>window.location.href.includes(e))),h="on"===s.paralellLoadState&&w&&!o&&!y;if(h){const o=d();s.injectZonos({initConfig:e,isGithubCdn:!0,parallelLoaded:!0,url:o,version:c})}const f=performance.now();u.addEventListener("load",(()=>{if(h||r?s.loadScriptLogParallelHandler({fallbackLoadTime:performance.now()-f,scriptLoadUrl:u.src,storeId:s.storeId,type:o?"jsdelivr":"vercel"}):s.loadScriptLogHandler({fallbackLoadTime:performance.now()-f,scriptLoadUrl:u.src,storeId:s.storeId,type:o?"jsdelivr":"vercel"}),s.isBigCommerce||(s.isBigCommerce=!!window.stencilBootstrap||!!window.bcConfig||!!document.querySelector('script[src*="bigcommerce.com"]')),window.Zonos.isNpm=!1,window.Zonos.zonosQaUrl=i,window.Zonos.isBigCommerce=s.isBigCommerce,s.isLegacyCheckout){if(!s.zonosApiKey)throw s.legacyCheckoutErrorHandler({message:"zonosApiKey is required for legacy checkout",tempCartUUID:e.tempCartUUID}),new Error("zonosApiKey is required for legacy checkout");if(!s.tempCartData)throw s.legacyCheckoutErrorHandler({message:"tempCartData is required for legacy checkout",tempCartUUID:e.tempCartUUID}),new Error("zonosApiKey is required for legacy checkout");if(s.legacyStoreFavicon){const e=document.createElement("link");e.rel="shortcut icon",e.type="image/x-icon",e.href=s.legacyStoreFavicon,document.head.appendChild(e)}window.Zonos.tempCartData=s.tempCartData;const o=Object.assign(Object.assign({},e),{appearance:Object.assign(Object.assign({},e.appearance),{logoUrl:s.legacyStoreLogo||""}),checkoutSettings:Object.assign(Object.assign({},e.checkoutSettings),{successBehavior:"ZONOS_SUCCESS_PAGE",successRedirectUrl:s.tempCartData.contShoppingURL}),zonosApiKey:s.zonosApiKey});e=o}window.Zonos.version&&(t(`[ZONOS - loadZonos] Execute "Zonos.init" from "${g}" from "${m}"`,"info"),window.Zonos.init(e))})),u.addEventListener("error",(async()=>{if(!h&&!r){const o=d();s.injectZonos({initConfig:e,isGithubCdn:!0,url:o,version:c})}["localhost",".zonos.com"].some((e=>window.location.href.includes(e)))||i||(h||r?s.loadScriptLogParallelHandler({fallbackLoadTime:performance.now()-f,isError:!0,scriptLoadUrl:u.src,storeId:s.storeId,type:o?"jsdelivr":"vercel"}):n(o?{endpoint:u.src,errors:["zonos.js - Failed to fetch github CDN."],metadata:{cdnLoadTime:performance.now()-f,cdnType:"jsdelivr",loadUrl:p,version:c}}:{endpoint:u.src,errors:["[Info] Using alternative CDN. Failed to fetch script"],metadata:{vercelLoadTime:performance.now()-f}}))})),document.head.appendChild(u)},a.setupCartData=async e=>{const n=await(async e=>{const{errors:t,json:r}=await o("https://v1.route.js.zonos.com/api/bigcommerce/legacy-migration/get-temp-cart",{body:{tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"});return!r||t.length?null:r})(e);if(t("[ZONOS - loadZonos] getting temp cart data","info",n),!n)throw r("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),s.legacyCheckoutErrorHandler({message:"Error getting temp cart data",tempCartUUID:e}),new Error("Error getting temp cart data");return s.tempCartData=n.tempCart,s.legacyStoreLogo=n.storeLogoUrl,s.legacyStoreFavicon=n.storeFaviconUrl,{storeId:n.tempCart.storeId,zonosApiKey:n.zonosApiKey}},a.init=async e=>{var n;const i="https://v1.3.29.js.zonos.com",a=document.querySelector('script[src*="/zonos.js"]'),c=null===(n=document.querySelector("script[src*='/loadZonos.js']"))||void 0===n?void 0:n.src,l=null==c?void 0:c.includes("timestamp=");if(!(s.isNpm||c&&l))return void r("[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(a||!c||s.requested)return void t("[ZONOS - loadZonos] script is already loaded or requested","info");s.requested=!0;let d=e.storeId;if(e.tempCartUUID){const o=await s.setupCartData(e.tempCartUUID);d=o.storeId,s.zonosApiKey=o.zonosApiKey,s.isLegacyCheckout=!0}if(!d)return t("[ZONOS - loadZonos] loading latest script since storeId is not provided."),void s.injectZonos({initConfig:e,url:i,version:null});s.storeId=d;const p=new URL("https://v1.route.js.zonos.com/api/get-store-version");p.searchParams.set("storeId",e.storeId.toString());const{errors:m,json:u}=await o(p.toString());if(m.length||!u)return t("[ZONOS - loadZonos] Error getting store version, loadding the latest version.","error"),void s.injectZonos({initConfig:e,url:i,version:null});const{version:g}=u;if(!a){const{currentLoadScriptUrl:o,isForceLoadVersionDomain:r,isWhiteListed:n}=(({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))),r=["qa.js.zonos.com"].some((e=>o.includes(e)));return{currentLoadScriptUrl:o,isForceLoadVersionDomain:r,isWhiteListed:t}})({loadScriptSrc:c}),i=n&&!r?o:`${"alpha"===g?"alpha":`v${g}`}.js.zonos.com`,a=n&&!r?null:g;t("[ZONOS - loadZonos] injecting zonos script","info",{currentLoadScriptUrl:o,isForceLoadVersionDomain:r,isWhiteListed:n,loadUrl:i,loadVersion:a,version:g}),s.injectZonos({initConfig:e,url:i,version:a})}},void 0===window.Zonos&&(window.Zonos=a)})();
@@ -1 +1 @@
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=()=>{if("undefined"==typeof window)return null;const t=(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);if(!t)return null;if("dev-elements"===t)return"https://dev.elements.zonos.com";const o=`https://${t}.preview.js.zonos.com`;return e(`[ZONOS-WARNING] using '${o}' for loading script`,"warn"),fetch(o).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${o}' 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})),o},n="https://js.stripe.com/v3",r=/^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 i=null;const l=e=>(null!==i||(i=new Promise(((o,i)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(s),window.Stripe)o(window.Stripe);else try{let l=(()=>{const e=document.querySelectorAll(`script[src^="${n}"]`);for(let t=0;t<e.length;t++){const o=e[t];if(o&&r.test(o.src))return o}return null})();l&&e?console.warn(s):l||(l=(e=>{const o=document.createElement("script");o.src=`${n}`;const r=document.head||document.body;return r?(r.appendChild(o),o):(t("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==l||l.addEventListener("load",(()=>{window.Stripe?o(window.Stripe):i(new Error("Stripe.js not available"))})),null==l||l.addEventListener("error",(()=>{i(new Error("Failed to load Stripe.js"))}))}catch(e){return void i(e)}else o(null)}))),i),c=Promise.resolve().then((()=>l(null)));let d=!1;c.catch((e=>{d||console.warn(e)}));var a;const u=(()=>{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})()||"https://v1.3.27.js.zonos.com",m="https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.27",p="https://rsms.me",h="https://fonts.googleapis.com",y=/^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;class w{}a=w,w.doneInit=!1,w.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),w.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),w.isBigCommerce=!1,w.isNpm=!0,w.zonosQaUrl=null,w.version="v1.3.27",w.modeAlerted=!1,w.tempCartData=null,w.getCurrentTimestamp=()=>(new Date).getTime(),w.zonosController=null,w.init=async({appearance:o,checkoutSettings:n,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:l,storeId:c,zonosApiKey:d})=>{a.doneInit||(e(`====== ZONOS DEBUG MODE: on (${a.version}) ======`),d?(a.zonosApiKey=d,a.storeId=c,e("init zonos"),a.injectZonosCdn(),a.injectZonosCss(),a.injectFonts(),a.injectController({config:{appearance:o,checkoutSettings:n,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:l},zonosApiKey:d}),a.doneInit=!0):t("Missing Zonos API key"))},w.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},w.openHelloDialog=e=>{const t=document.querySelector("zonos-hello");t&&t.openHelloDialog(null==e||e)},w.showNotification=e=>{var t;null===(t=a.zonosController)||void 0===t||t.showNotification(e)},w.updateOrganizationName=e=>{var t;null===(t=a.zonosController)||void 0===t||t.updateOrganizationName(e)},w.disablePlaceOrderButtons=({autoEnable:e=!0,disable:t,placeOrderButtonSelector:o})=>{if(o){const n=document.querySelectorAll(o),r=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};n.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((()=>{n.forEach((e=>{e.removeAttribute("disabled"),e.removeEventListener("click",r)}))}),5e3)}},w.injectController=({config:o,zonosApiKey:n})=>{var r;if(document.querySelector("zonos-controller"))return;if(null===(r=o.checkoutSettings)||void 0===r?void 0:r.placeOrderButtonSelector){const e=o.checkoutSettings.placeOrderButtonSelector;a.disablePlaceOrderButtons({disable:!0,placeOrderButtonSelector:e});new MutationObserver((()=>{a.disablePlaceOrderButtons({disable:!0,placeOrderButtonSelector:e})})).observe(document.body,{childList:!0,subtree:!0})}const s=document.createElement("zonos-controller");s.config=o,s.zonosApiKey=n,s.addEventListener("stripeInitEvent",(async o=>{const{detail:n}=o;e("loading Stripe");const r=await(async(...e)=>{d=!0;const t=Date.now();return c.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);r?(window.Zonos.stripe=r,s.initCheckoutElement(r)):t("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(s),a.zonosController=s,e("Zonos controller injected!")},w.injectScript=({fallBackDomain:o,isModule:n,scriptDomain:r,theRestUrl:s})=>{const i=`${r}/${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");n?c.type="module":c.noModule=!0,c.src=i,c.crossOrigin="anonymous",c.onerror=()=>{/\/\/v\d+\./g.test(r)?(o&&a.injectScript({isModule:n,scriptDomain:o,theRestUrl:s}),t(`Failed to load ${c.src}`)):e("No need to fallback since this is not a versioned domain","warn")},l.appendChild(c)},w.getZonosUrl=()=>{if(a.isNpm){return o()||u}return u},w.injectZonosCdn=()=>{const t=a.getZonosUrl();a.injectScript({fallBackDomain:m,isModule:!0,scriptDomain:t,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),a.injectScript({fallBackDomain:m,isModule:!1,scriptDomain:t,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),e("Zonos cdn script injected!")},w.injectStylesheet=({fallBackDomain:o,stylesheetDomain:n,theRestUrl:r})=>{const s=document.head||document.body,i=document.createElement("link");i.rel="preconnect",i.href=`${u}/`,s.appendChild(i);const l=document.createElement("link");l.rel="stylesheet",l.href=`${n}/${r}`,l.onerror=()=>{const s=/\/\/v\d+\./g.test(n);s?(o&&s&&a.injectStylesheet({stylesheetDomain:o,theRestUrl:r}),t(`Failed to load ${l.href}`)):e("No need to fallback since this is not a versioned domain","warn")},s.appendChild(l)},w.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?e("Zonos style links already injected","warn"):(a.injectStylesheet({fallBackDomain:m,stylesheetDomain:u,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),e("Zonos style css injected!"))},w.injectFonts=()=>{if((()=>{const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${p}"]`);for(let t=0;t<e.length;t++){const o=e[t];if(o&&!y.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=p,t.appendChild(o);const n=document.createElement("link");n.rel="stylesheet",n.href=`${p}/inter/inter.css`,t.appendChild(n),e("Zonos font injected!")},w.setupGoogleFont=e=>{var t;null===(t=a.zonosController)||void 0===t||t.setupGoogleFont(e)},w.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^="${h}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=h,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=w)})();
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=()=>{if("undefined"==typeof window)return null;const t=(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);if(!t)return null;if("dev-elements"===t)return"https://dev.elements.zonos.com";const o=`https://${t}.preview.js.zonos.com`;return e(`[ZONOS-WARNING] using '${o}' for loading script`,"warn"),fetch(o).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${o}' 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})),o},n="https://js.stripe.com/v3",r=/^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 i=null;const l=e=>(null!==i||(i=new Promise(((o,i)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(s),window.Stripe)o(window.Stripe);else try{let l=(()=>{const e=document.querySelectorAll(`script[src^="${n}"]`);for(let t=0;t<e.length;t++){const o=e[t];if(o&&r.test(o.src))return o}return null})();l&&e?console.warn(s):l||(l=(e=>{const o=document.createElement("script");o.src=`${n}`;const r=document.head||document.body;return r?(r.appendChild(o),o):(t("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==l||l.addEventListener("load",(()=>{window.Stripe?o(window.Stripe):i(new Error("Stripe.js not available"))})),null==l||l.addEventListener("error",(()=>{i(new Error("Failed to load Stripe.js"))}))}catch(e){return void i(e)}else o(null)}))),i),c=Promise.resolve().then((()=>l(null)));let d=!1;c.catch((e=>{d||console.warn(e)}));var a;const u=(()=>{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})()||"https://v1.3.29.js.zonos.com",m="https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.29",p="https://rsms.me",h="https://fonts.googleapis.com",y=/^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;class w{}a=w,w.doneInit=!1,w.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),w.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),w.isBigCommerce=!1,w.isNpm=!0,w.zonosQaUrl=null,w.version="v1.3.29",w.modeAlerted=!1,w.tempCartData=null,w.getCurrentTimestamp=()=>(new Date).getTime(),w.zonosController=null,w.init=async({appearance:o,checkoutSettings:n,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:l,storeId:c,zonosApiKey:d})=>{a.doneInit||(e(`====== ZONOS DEBUG MODE: on (${a.version}) ======`),d?(a.zonosApiKey=d,a.storeId=c,e("init zonos"),a.injectZonosCdn(),a.injectZonosCss(),a.injectFonts(),a.injectController({config:{appearance:o,checkoutSettings:n,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:l},zonosApiKey:d}),a.doneInit=!0):t("Missing Zonos API key"))},w.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},w.openHelloDialog=e=>{const t=document.querySelector("zonos-hello");t&&t.openHelloDialog(null==e||e)},w.showNotification=e=>{var t;null===(t=a.zonosController)||void 0===t||t.showNotification(e)},w.updateOrganizationName=e=>{var t;null===(t=a.zonosController)||void 0===t||t.updateOrganizationName(e)},w.disablePlaceOrderButtons=({autoEnable:e=!0,disable:t,placeOrderButtonSelector:o})=>{if(o){const n=document.querySelectorAll(o),r=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};n.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((()=>{n.forEach((e=>{e.removeAttribute("disabled"),e.removeEventListener("click",r)}))}),5e3)}},w.injectController=({config:o,zonosApiKey:n})=>{var r;if(document.querySelector("zonos-controller"))return;if(null===(r=o.checkoutSettings)||void 0===r?void 0:r.placeOrderButtonSelector){const e=o.checkoutSettings.placeOrderButtonSelector;a.disablePlaceOrderButtons({disable:!0,placeOrderButtonSelector:e});new MutationObserver((()=>{a.disablePlaceOrderButtons({disable:!0,placeOrderButtonSelector:e})})).observe(document.body,{childList:!0,subtree:!0})}const s=document.createElement("zonos-controller");s.config=o,s.zonosApiKey=n,s.addEventListener("stripeInitEvent",(async o=>{const{detail:n}=o;e("loading Stripe");const r=await(async(...e)=>{d=!0;const t=Date.now();return c.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);r?(window.Zonos.stripe=r,s.initCheckoutElement(r)):t("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(s),a.zonosController=s,e("Zonos controller injected!")},w.injectScript=({fallBackDomain:o,isModule:n,scriptDomain:r,theRestUrl:s})=>{const i=`${r}/${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");n?c.type="module":c.noModule=!0,c.src=i,c.crossOrigin="anonymous",c.onerror=()=>{/\/\/v\d+\./g.test(r)?(o&&a.injectScript({isModule:n,scriptDomain:o,theRestUrl:s}),t(`Failed to load ${c.src}`)):e("No need to fallback since this is not a versioned domain","warn")},l.appendChild(c)},w.getZonosUrl=()=>{if(a.isNpm){return o()||u}return u},w.injectZonosCdn=()=>{const t=a.getZonosUrl();a.injectScript({fallBackDomain:m,isModule:!0,scriptDomain:t,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),a.injectScript({fallBackDomain:m,isModule:!1,scriptDomain:t,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),e("Zonos cdn script injected!")},w.injectStylesheet=({fallBackDomain:o,stylesheetDomain:n,theRestUrl:r})=>{const s=document.head||document.body,i=document.createElement("link");i.rel="preconnect",i.href=`${u}/`,s.appendChild(i);const l=document.createElement("link");l.rel="stylesheet",l.href=`${n}/${r}`,l.onerror=()=>{const s=/\/\/v\d+\./g.test(n);s?(o&&s&&a.injectStylesheet({stylesheetDomain:o,theRestUrl:r}),t(`Failed to load ${l.href}`)):e("No need to fallback since this is not a versioned domain","warn")},s.appendChild(l)},w.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?e("Zonos style links already injected","warn"):(a.injectStylesheet({fallBackDomain:m,stylesheetDomain:u,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),e("Zonos style css injected!"))},w.injectFonts=()=>{if((()=>{const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${p}"]`);for(let t=0;t<e.length;t++){const o=e[t];if(o&&!y.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=p,t.appendChild(o);const n=document.createElement("link");n.rel="stylesheet",n.href=`${p}/inter/inter.css`,t.appendChild(n),e("Zonos font injected!")},w.setupGoogleFont=e=>{var t;null===(t=a.zonosController)||void 0===t||t.setupGoogleFont(e)},w.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^="${h}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=h,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=w)})();
@@ -35,6 +35,10 @@ export declare class ZonosHello {
35
35
  * This array will hold all products currently on the page
36
36
  */
37
37
  productsOnPage: Product[];
38
+ /**
39
+ * Hello widget is rendered on the screen, this should only triggered once
40
+ */
41
+ isHelloWidgetRendered: boolean;
38
42
  private getHelloPeekMessage;
39
43
  private enableShowPeekMessage;
40
44
  private getNewItemRestrictions;
@@ -76,6 +80,10 @@ export declare class ZonosHello {
76
80
  private shouldAnimateLeftDesktop;
77
81
  handleResize(): void;
78
82
  private shouldRenderHello;
83
+ /**
84
+ * This method will handle the Hello widget initialized state, should only trigger once
85
+ */
86
+ private handleHelloWidgetInitializedState;
79
87
  handleAppearanceSettingsOverrideChange(): void;
80
88
  render(): any;
81
89
  }
@@ -260,7 +260,7 @@ export declare const stringsArabic: {
260
260
  "We've sent an email confirmation of the order details for your review. And our team is carefully preparing your order so it arrives on time.": {
261
261
  value: string;
262
262
  };
263
- 'Welcome to [storeName]!': {
263
+ 'Welcome to [storeName]': {
264
264
  value: string;
265
265
  };
266
266
  'Welcome!': {
@@ -260,7 +260,7 @@ export declare const stringsBase: {
260
260
  "We've sent an email confirmation of the order details for your review. And our team is carefully preparing your order so it arrives on time.": {
261
261
  value: string;
262
262
  };
263
- 'Welcome to [storeName]!': {
263
+ 'Welcome to [storeName]': {
264
264
  value: string;
265
265
  };
266
266
  'Welcome!': {
@@ -260,7 +260,7 @@ export declare const stringsChinese: {
260
260
  "We've sent an email confirmation of the order details for your review. And our team is carefully preparing your order so it arrives on time.": {
261
261
  value: string;
262
262
  };
263
- 'Welcome to [storeName]!': {
263
+ 'Welcome to [storeName]': {
264
264
  value: string;
265
265
  };
266
266
  'Welcome!': {
@@ -260,7 +260,7 @@ export declare const stringsDanish: {
260
260
  "We've sent an email confirmation of the order details for your review. And our team is carefully preparing your order so it arrives on time.": {
261
261
  value: string;
262
262
  };
263
- 'Welcome to [storeName]!': {
263
+ 'Welcome to [storeName]': {
264
264
  value: string;
265
265
  };
266
266
  'Welcome!': {
@@ -260,7 +260,7 @@ export declare const stringsDutch: {
260
260
  "We've sent an email confirmation of the order details for your review. And our team is carefully preparing your order so it arrives on time.": {
261
261
  value: string;
262
262
  };
263
- 'Welcome to [storeName]!': {
263
+ 'Welcome to [storeName]': {
264
264
  value: string;
265
265
  };
266
266
  'Welcome!': {
@@ -260,7 +260,7 @@ export declare const stringsFrench: {
260
260
  "We've sent an email confirmation of the order details for your review. And our team is carefully preparing your order so it arrives on time.": {
261
261
  value: string;
262
262
  };
263
- 'Welcome to [storeName]!': {
263
+ 'Welcome to [storeName]': {
264
264
  value: string;
265
265
  };
266
266
  'Welcome!': {
@@ -260,7 +260,7 @@ export declare const stringsGerman: {
260
260
  "We've sent an email confirmation of the order details for your review. And our team is carefully preparing your order so it arrives on time.": {
261
261
  value: string;
262
262
  };
263
- 'Welcome to [storeName]!': {
263
+ 'Welcome to [storeName]': {
264
264
  value: string;
265
265
  };
266
266
  'Welcome!': {
@@ -260,7 +260,7 @@ export declare const stringsHebrew: {
260
260
  "We've sent an email confirmation of the order details for your review. And our team is carefully preparing your order so it arrives on time.": {
261
261
  value: string;
262
262
  };
263
- 'Welcome to [storeName]!': {
263
+ 'Welcome to [storeName]': {
264
264
  value: string;
265
265
  };
266
266
  'Welcome!': {
@@ -260,7 +260,7 @@ export declare const stringsIndonesian: {
260
260
  "We've sent an email confirmation of the order details for your review. And our team is carefully preparing your order so it arrives on time.": {
261
261
  value: string;
262
262
  };
263
- 'Welcome to [storeName]!': {
263
+ 'Welcome to [storeName]': {
264
264
  value: string;
265
265
  };
266
266
  'Welcome!': {
@@ -260,7 +260,7 @@ export declare const stringsItalian: {
260
260
  "We've sent an email confirmation of the order details for your review. And our team is carefully preparing your order so it arrives on time.": {
261
261
  value: string;
262
262
  };
263
- 'Welcome to [storeName]!': {
263
+ 'Welcome to [storeName]': {
264
264
  value: string;
265
265
  };
266
266
  'Welcome!': {
@@ -260,7 +260,7 @@ export declare const stringsJapanese: {
260
260
  "We've sent an email confirmation of the order details for your review. And our team is carefully preparing your order so it arrives on time.": {
261
261
  value: string;
262
262
  };
263
- 'Welcome to [storeName]!': {
263
+ 'Welcome to [storeName]': {
264
264
  value: string;
265
265
  };
266
266
  'Welcome!': {