@zonos/elements 1.3.158 → 1.3.160

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 (156) hide show
  1. package/dist/cjs/{cart-c6b42ee3.js → cart-934a8aef.js} +12 -8
  2. package/dist/cjs/{getBorderRadius-c4fed939.js → getBorderRadius-d184b623.js} +1 -1
  3. package/dist/cjs/index.cjs.js +7 -7
  4. package/dist/cjs/{isDarkColor-cd98fcb7.js → isDarkColor-08d92ed7.js} +1 -1
  5. package/dist/cjs/{paypal-bc98bcd3.js → paypal-dddeb76e.js} +3 -3
  6. package/dist/cjs/zonos-address_8.cjs.entry.js +4 -4
  7. package/dist/cjs/zonos-badge.cjs.entry.js +1 -1
  8. package/dist/cjs/zonos-banner.cjs.entry.js +1 -1
  9. package/dist/cjs/zonos-button_3.cjs.entry.js +3 -3
  10. package/dist/cjs/zonos-card.cjs.entry.js +2 -2
  11. package/dist/cjs/zonos-cart-items_13.cjs.entry.js +5 -5
  12. package/dist/cjs/zonos-checkout.cjs.entry.js +8 -5
  13. package/dist/cjs/zonos-collapse.cjs.entry.js +1 -1
  14. package/dist/cjs/zonos-controller.cjs.entry.js +4 -4
  15. package/dist/cjs/zonos-country-flag.cjs.entry.js +4 -4
  16. package/dist/cjs/zonos-country-select_4.cjs.entry.js +4 -4
  17. package/dist/cjs/zonos-empty-state-payment_4.cjs.entry.js +5 -5
  18. package/dist/cjs/zonos-hello-dialog.cjs.entry.js +4 -4
  19. package/dist/cjs/zonos-hello.cjs.entry.js +4 -4
  20. package/dist/cjs/zonos-input.cjs.entry.js +2 -2
  21. package/dist/cjs/zonos-language-select_2.cjs.entry.js +4 -4
  22. package/dist/cjs/zonos-logo.cjs.entry.js +1 -1
  23. package/dist/cjs/zonos-shipping-rich-radio.cjs.entry.js +2 -2
  24. package/dist/cjs/zonos-text.cjs.entry.js +1 -1
  25. package/dist/cjs/zonos-toggle.cjs.entry.js +1 -1
  26. package/dist/cjs/zonos-v-stack.cjs.entry.js +1 -1
  27. package/dist/cjs/{zonosStore-188d96be.js → zonosStore-7975e4b6.js} +3 -0
  28. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +3 -0
  29. package/dist/collection/components/store/checkout/cart.js +7 -3
  30. package/dist/collection/components/store/checkout/stripe.js +2 -2
  31. package/dist/collection/components/store/zonosStore.js +3 -0
  32. package/dist/collection/types/index.js +1 -0
  33. package/dist/collection/types/utils/ZonosSettings.js +1 -0
  34. package/dist/esm/{cart-74d92be2.js → cart-41bdd9fb.js} +12 -8
  35. package/dist/esm/{getBorderRadius-d2e68013.js → getBorderRadius-740610fb.js} +1 -1
  36. package/dist/esm/index.js +7 -7
  37. package/dist/esm/{isDarkColor-16e586a1.js → isDarkColor-2f59d721.js} +1 -1
  38. package/dist/esm/{paypal-459383ae.js → paypal-c81fb5ee.js} +3 -3
  39. package/dist/esm/zonos-address_8.entry.js +4 -4
  40. package/dist/esm/zonos-badge.entry.js +1 -1
  41. package/dist/esm/zonos-banner.entry.js +1 -1
  42. package/dist/esm/zonos-button_3.entry.js +3 -3
  43. package/dist/esm/zonos-card.entry.js +2 -2
  44. package/dist/esm/zonos-cart-items_13.entry.js +5 -5
  45. package/dist/esm/zonos-checkout.entry.js +8 -5
  46. package/dist/esm/zonos-collapse.entry.js +1 -1
  47. package/dist/esm/zonos-controller.entry.js +4 -4
  48. package/dist/esm/zonos-country-flag.entry.js +4 -4
  49. package/dist/esm/zonos-country-select_4.entry.js +4 -4
  50. package/dist/esm/zonos-empty-state-payment_4.entry.js +5 -5
  51. package/dist/esm/zonos-hello-dialog.entry.js +4 -4
  52. package/dist/esm/zonos-hello.entry.js +4 -4
  53. package/dist/esm/zonos-input.entry.js +2 -2
  54. package/dist/esm/zonos-language-select_2.entry.js +4 -4
  55. package/dist/esm/zonos-logo.entry.js +1 -1
  56. package/dist/esm/zonos-shipping-rich-radio.entry.js +2 -2
  57. package/dist/esm/zonos-text.entry.js +1 -1
  58. package/dist/esm/zonos-toggle.entry.js +1 -1
  59. package/dist/esm/zonos-v-stack.entry.js +1 -1
  60. package/dist/esm/{zonosStore-4b574fcc.js → zonosStore-71d7e02f.js} +3 -0
  61. package/dist/esm-es5/{cart-74d92be2.js → cart-41bdd9fb.js} +1 -1
  62. package/dist/esm-es5/{getBorderRadius-d2e68013.js → getBorderRadius-740610fb.js} +1 -1
  63. package/dist/esm-es5/index.js +1 -1
  64. package/dist/esm-es5/{isDarkColor-16e586a1.js → isDarkColor-2f59d721.js} +1 -1
  65. package/dist/esm-es5/{paypal-459383ae.js → paypal-c81fb5ee.js} +1 -1
  66. package/dist/esm-es5/zonos-address_8.entry.js +1 -1
  67. package/dist/esm-es5/zonos-badge.entry.js +1 -1
  68. package/dist/esm-es5/zonos-banner.entry.js +1 -1
  69. package/dist/esm-es5/zonos-button_3.entry.js +1 -1
  70. package/dist/esm-es5/zonos-card.entry.js +1 -1
  71. package/dist/esm-es5/zonos-cart-items_13.entry.js +1 -1
  72. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  73. package/dist/esm-es5/zonos-collapse.entry.js +1 -1
  74. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  75. package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
  76. package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
  77. package/dist/esm-es5/zonos-empty-state-payment_4.entry.js +1 -1
  78. package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
  79. package/dist/esm-es5/zonos-hello.entry.js +1 -1
  80. package/dist/esm-es5/zonos-input.entry.js +1 -1
  81. package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
  82. package/dist/esm-es5/zonos-logo.entry.js +1 -1
  83. package/dist/esm-es5/zonos-shipping-rich-radio.entry.js +1 -1
  84. package/dist/esm-es5/zonos-text.entry.js +1 -1
  85. package/dist/esm-es5/zonos-toggle.entry.js +1 -1
  86. package/dist/esm-es5/zonos-v-stack.entry.js +1 -1
  87. package/dist/esm-es5/{zonosStore-4b574fcc.js → zonosStore-71d7e02f.js} +1 -1
  88. package/dist/scripts/index.d.ts +649 -649
  89. package/dist/scripts/index.js +1 -1
  90. package/dist/scripts/loadZonos.js +1 -1
  91. package/dist/scripts/zonos.js +1 -1
  92. package/dist/types/components/store/zonosStore.d.ts +4 -2
  93. package/dist/types/components/utils/api/getZonosSettings.d.ts +3 -3
  94. package/dist/types/types/index.d.ts +1 -0
  95. package/dist/types/types/utils/ZonosSettings.d.ts +10 -0
  96. package/dist/zonos-elements/index.esm.js +1 -1
  97. package/dist/zonos-elements/{p-ca216e7b.entry.js → p-073bc210.entry.js} +1 -1
  98. package/dist/zonos-elements/{p-a25e15a0.system.entry.js → p-09e4f412.system.entry.js} +1 -1
  99. package/dist/zonos-elements/{p-3a5348d9.system.entry.js → p-0febd074.system.entry.js} +1 -1
  100. package/dist/zonos-elements/{p-107bcbf5.entry.js → p-15971b78.entry.js} +1 -1
  101. package/dist/zonos-elements/{p-13070bc0.system.js → p-15d4d606.system.js} +1 -1
  102. package/dist/zonos-elements/{p-42e46be2.system.js → p-165dfe38.system.js} +1 -1
  103. package/dist/zonos-elements/{p-08b4bd71.entry.js → p-1921fe51.entry.js} +1 -1
  104. package/dist/zonos-elements/{p-62a790cb.system.entry.js → p-20ca31fd.system.entry.js} +1 -1
  105. package/dist/zonos-elements/{p-34cd2879.entry.js → p-22e190af.entry.js} +1 -1
  106. package/dist/zonos-elements/p-23021792.js +17 -0
  107. package/dist/zonos-elements/{p-9308d8ad.entry.js → p-2f6bbd3b.entry.js} +1 -1
  108. package/dist/zonos-elements/p-46f6e5e9.system.js +1 -1
  109. package/dist/zonos-elements/{p-25f0a3d0.entry.js → p-4968aa73.entry.js} +1 -1
  110. package/dist/zonos-elements/{p-3a4f77dd.system.entry.js → p-57281d6c.system.entry.js} +1 -1
  111. package/dist/zonos-elements/{p-61272f94.entry.js → p-6549915d.entry.js} +1 -1
  112. package/dist/zonos-elements/p-6658cc02.system.js +1 -0
  113. package/dist/zonos-elements/{p-05a4d995.js → p-672707ce.js} +1 -1
  114. package/dist/zonos-elements/{p-d705a5fb.entry.js → p-72319b4d.entry.js} +1 -1
  115. package/dist/zonos-elements/{p-2cfad1a2.entry.js → p-73e9a8f5.entry.js} +1 -1
  116. package/dist/zonos-elements/{p-b1424255.entry.js → p-75a8e67d.entry.js} +1 -1
  117. package/dist/zonos-elements/{p-43cb3e80.entry.js → p-77581c1c.entry.js} +1 -1
  118. package/dist/zonos-elements/{p-ac6816b3.system.entry.js → p-7b76c844.system.entry.js} +1 -1
  119. package/dist/zonos-elements/{p-536c5a47.entry.js → p-7c028742.entry.js} +1 -1
  120. package/dist/zonos-elements/{p-1448b57a.system.entry.js → p-7c536f5a.system.entry.js} +1 -1
  121. package/dist/zonos-elements/{p-c725a571.entry.js → p-7cb5e4b8.entry.js} +1 -1
  122. package/dist/zonos-elements/{p-dfc11974.system.entry.js → p-82166888.system.entry.js} +1 -1
  123. package/dist/zonos-elements/{p-e295baac.entry.js → p-83645bb4.entry.js} +1 -1
  124. package/dist/zonos-elements/{p-c6efea31.system.entry.js → p-85235fa0.system.entry.js} +1 -1
  125. package/dist/zonos-elements/{p-7534ed11.system.entry.js → p-8addb07b.system.entry.js} +1 -1
  126. package/dist/zonos-elements/{p-290845c4.system.entry.js → p-95aa4518.system.entry.js} +1 -1
  127. package/dist/zonos-elements/{p-40fc4f98.entry.js → p-983c8c5f.entry.js} +1 -1
  128. package/dist/zonos-elements/p-98e9c9cf.js +1 -0
  129. package/dist/zonos-elements/{p-c84eb1e5.system.entry.js → p-9cbe0e06.system.entry.js} +1 -1
  130. package/dist/zonos-elements/{p-98fbd95f.js → p-a0efb02e.js} +1 -1
  131. package/dist/zonos-elements/{p-6b67039a.system.entry.js → p-a23fb562.system.entry.js} +1 -1
  132. package/dist/zonos-elements/{p-28325d38.system.js → p-a9a29cf6.system.js} +1 -1
  133. package/dist/zonos-elements/{p-b4dcb658.system.js → p-a9a95fae.system.js} +1 -1
  134. package/dist/zonos-elements/{p-f674d15a.entry.js → p-acabfba5.entry.js} +1 -1
  135. package/dist/zonos-elements/{p-0e436c9d.system.js → p-b6fdbbf4.system.js} +1 -1
  136. package/dist/zonos-elements/{p-b2f71850.entry.js → p-bbc11b58.entry.js} +1 -1
  137. package/dist/zonos-elements/p-c522ddf2.entry.js +1 -0
  138. package/dist/zonos-elements/{p-423a25ee.system.entry.js → p-c7219337.system.entry.js} +1 -1
  139. package/dist/zonos-elements/{p-2f17dd0a.system.entry.js → p-d8406c80.system.entry.js} +1 -1
  140. package/dist/zonos-elements/{p-0d30b20e.system.entry.js → p-d9940c47.system.entry.js} +1 -1
  141. package/dist/zonos-elements/{p-d68dd730.system.entry.js → p-daa0dcb4.system.entry.js} +1 -1
  142. package/dist/zonos-elements/{p-d29e8aaa.js → p-dd999b44.js} +1 -1
  143. package/dist/zonos-elements/{p-89b50f7d.system.entry.js → p-e174b37b.system.entry.js} +1 -1
  144. package/dist/zonos-elements/{p-ed553eb2.entry.js → p-e300d1ed.entry.js} +1 -1
  145. package/dist/zonos-elements/{p-b0b4afdb.system.entry.js → p-e611b266.system.entry.js} +1 -1
  146. package/dist/zonos-elements/{p-4fb44ae1.system.entry.js → p-e6bbea1e.system.entry.js} +1 -1
  147. package/dist/zonos-elements/{p-767527f6.system.entry.js → p-eb5835d1.system.entry.js} +1 -1
  148. package/dist/zonos-elements/{p-e7def9ea.system.entry.js → p-ed74742d.system.entry.js} +1 -1
  149. package/dist/zonos-elements/{p-e9d7f9e7.entry.js → p-f06559c1.entry.js} +1 -1
  150. package/dist/zonos-elements/{p-dd7a2d62.entry.js → p-fa15b9b5.entry.js} +1 -1
  151. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  152. package/package.json +1 -1
  153. package/dist/zonos-elements/p-000a41ab.js +0 -17
  154. package/dist/zonos-elements/p-82d5803d.system.js +0 -1
  155. package/dist/zonos-elements/p-83c9aae7.js +0 -1
  156. package/dist/zonos-elements/p-dd3201f2.entry.js +0 -1
@@ -1 +1 @@
1
- (function(){"use strict";const e=performance.now(),o=e=>{if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(o){if(e&&"function"==typeof e.toString){return e.toString()}return"Unable to stringify info"}},t=(t,n,...r)=>{var s,i;const{elapsedTimePretty:a}=(()=>{const o=performance.now()-e,t=o>1e3?`${(o/1e3).toFixed(2)}s`:`${o.toFixed(2)}ms`;return{elapsedTime:o,elapsedTimePretty:t}})(),c=[`(${a})`,...r];c.map(o).join(" ");if(!(!!(null===(s=window.Zonos)||void 0===s?void 0:s.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===n&&console.error(t,...c));let l=document.querySelector("iframe#zonos---debug-logging-iframe");l||(l=document.createElement("iframe"),l.id="zonos---debug-logging-iframe",l.style.display="none",l.style.opacity="0",l.style.position="absolute",l.style.top="-9999px",l.style.left="-9999px",l.style.width="1px",l.style.height="1px",l.style.border="none",l.style.overflow="hidden",l.style.visibility="hidden",document.body.appendChild(l));const d=(null===(i=l.contentWindow)||void 0===i?void 0:i.window.console)||window.console;switch(n){case"warn":d.warn(t,...c);break;case"info":d.info(t,...c);break;case"error":d.error(t,...c);break;default:d.groupCollapsed(t,...c),d.trace(),d.groupEnd()}},n=(e,...o)=>{t(e,"error",...o)},r=["jsdelivr","cdnjs","unpkg","vercel"],s="jsdelivr",i=e=>{const o=r.indexOf(e);return r[o+1]||null},a=()=>window.location.search.includes("zonosStagingMode=1"),c=()=>{var e;return(null===(e=window.Zonos.zonosApiKey)||void 0===e?void 0:e.includes("test"))||window.location.search.includes("zonosTestMode=1")};function l(e,o){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&o.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)o.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(t[n[r]]=e[n[r]])}return t}"function"==typeof SuppressedError&&SuppressedError;const d=["cloudflare","vercel"],u=d[0],p={cloudflare:"https://route.elements.zonos.com",vercel:"https://route.js.zonos.com"},m=p[u],w=(e=u)=>{const o=d.indexOf(e),t=d[o+1];return t||null},h=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},y=async({response:e,shouldLog:o=!0,shouldThrow:t=!1})=>{try{const o=await e.text(),t=h(o);if(!t)throw new Error(`Failed to parse content: ${o}`);return t}catch(e){if(t)throw e;return o&&console.error(e),null}},g=async({basePathType:e,options:o,path:t})=>{let n;const r=window.Zonos.zonosQaUrlApi||p[e]||u,s=new URL(r+t),i=window.Zonos.cartId?`${window.location.hostname}-${window.Zonos.cartId}`:window.location.hostname;s.searchParams.set("zToken",(e=>{try{return btoa(e).replace(/=/g,"")}catch(o){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(i));try{n=await fetch(s.toString(),o)}catch(e){if(e instanceof Error)return{baseUrl:r,errors:[{message:e.message,type:"unknown"}],json:null,response:null,zonosMode:null};return{baseUrl:r,errors:[{message:"Failed to fetch",type:"unknown"}],json:null,response:null,zonosMode:null}}const a=n.headers.get("Zonos-Mode"),c=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&a&&c&&(window.Zonos.modeAlerted=!0),n.ok){return{baseUrl:r,errors:[],json:await y({response:n}),response:n,zonosMode:a}}const l=n.status.toString();try{const e=await y({response:n,shouldThrow:!0});if(e&&"errors"in e&&Array.isArray(e.errors)){const o=e.errors;return{baseUrl:r,errors:o.map((e=>"string"==typeof e?{message:e,type:l}:e)),json:null,response:n,zonosMode:a}}return{baseUrl:r,errors:[{message:JSON.stringify(e),type:l}],json:null,response:n,zonosMode:a}}catch(e){return{baseUrl:r,errors:[{message:`${l}: ${"Unknown error"}`,type:l}],json:null,response:null,zonosMode:a}}},f=async({basePathType:e,options:o,path:n})=>{var r,s;const i=n.startsWith("/api/bigcommerce")?"vercel":e,a=await g({basePathType:i,options:o,path:n}),{errors:c,response:d}=a,u=l(a,["errors","response"]),y=w(i),v=!!c.find((({type:e})=>"unknown"===e))||404===(null==d?void 0:d.status),S=y&&v;return v&&(async({endpoint:e,errors:o,metadata:n,shouldPostReleaseErrorReporting:r})=>{if(t("sendErrorLog","warn",e,n,o),r){const e=Number(window.Zonos.releaseDate);if((new Date).getTime()-e>36e5)return}const s="userAgentData"in window.navigator?window.navigator.userAgentData:null,i={endpoint:e,errors:o,href:window.location.href,metadata:Object.assign({appVersion:window.Zonos.version,domain:window.Zonos.domain,publicCredential:window.Zonos.zonosApiKey,userAgent:s&&s.brands.length>0?s:window.navigator.userAgent},n)};try{fetch(`${m}/api/zonos-elements/log-error`,{body:JSON.stringify(i),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const o=w();if(!o)return;fetch(`${p[o]}/api/zonos-elements/log-error`,{body:JSON.stringify(i),method:"POST"})}})({endpoint:p[i]+n,errors:c.map((({message:e})=>`API: ${e}`)),metadata:{currentBasePath:i,nextFallbackApiType:y,requestHeaders:null==o?void 0:o.headers,requestPayload:h(null===(r=null==o?void 0:o.body)||void 0===r?void 0:r.toString())||(null===(s=null==o?void 0:o.body)||void 0===s?void 0:s.toString()),status:null==d?void 0:d.status,statusText:null==d?void 0:d.statusText},shouldPostReleaseErrorReporting:!0}),S?(t(`=== "${n}" failed to fetch, trying next fallback ${y}`),f({basePathType:y,options:o,path:n})):Object.assign({errors:c,response:d},u)},v=async(e,o)=>{const n=l(o||{},[]),r=n.body?JSON.stringify(n.body):void 0,s=n.method||"GET",i=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Staging-Mode":a()?"1":void 0,"Zonos-Test-Mode":c()?"1":void 0,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},n.headers);Object.keys(i).forEach((e=>void 0===i[e]&&delete i[e]));const d=Object.assign(Object.assign({},n),{body:"GET"===s?void 0:r,headers:i,method:s}),p=new URLSearchParams(window.location.search).get("useFallbackApi");return t(e,"info"),f({basePathType:p||u,options:d,path:e})},S=()=>{const e=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||e)return null;const o=(e=>{if(!e)return null;const o=new URL(e).searchParams.get("zonosQaUrl");return o?/[^a-zA-Z0-9-_]+/.test(o)?null:o:null})(window.location.href),n="https://v1.3.158.js.zonos.com";if(!o&&(n.includes("test.")||n.includes("test-")))return n;if(!o&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!o)return null;if("dev-elements"===o)return"https://dev.elements.zonos.com";const r=`https://${o}.preview.js.zonos.com`;return t(`[ZONOS-WARNING] using '${r}' for loading elements script`,"warn"),fetch(r).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${r}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:o}=window.location,t=`${o}?${e.toString()}`;return window.history.replaceState(window.history.state,"",t),window.location.reload(),null})),r},b="https://js.stripe.com/v3",z=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,C="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let j=null;const O=e=>(null!==j||(j=new Promise(((o,t)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(C),window.Stripe)o(window.Stripe);else try{let r=(()=>{const e=document.querySelectorAll(`script[src^="${b}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&z.test(t.src))return t}return null})();r&&e?console.warn(C):r||(r=(e=>{const o=document.createElement("script");o.src=`${b}`;const t=document.head||document.body;return t?(t.appendChild(o),o):(n("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==r||r.addEventListener("load",(()=>{window.Stripe?o(window.Stripe):t(new Error("Stripe.js not available"))})),null==r||r.addEventListener("error",(()=>{t(new Error("Failed to load Stripe.js"))}))}catch(e){return void t(e)}else o(null)}))),j),Z=Promise.resolve().then((()=>O(null)));let k=!1;Z.catch((e=>{k||console.warn(e)}));const I=async({cartId:e,retries:o})=>{const n=c(),{errors:r,json:s}=await v("/api/zonos-elements/get-temp-cart",{body:{isTestMode:n,options:{noOnlineStoreSettings:!0},tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"}),i=!s||r.length;return i&&o?(t("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:o}),await new Promise((e=>setTimeout(e,500))),I({cartId:e,retries:o-1})):i?null:s},E=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/,A=new RegExp(`^${E.source}$`),L=new RegExp(`^cart_${E.source}$`),$=/^[a-zA-Z0-9]{2,}$/,T=/^cart_[a-zA-Z0-9]{2,}$/,N=async e=>{const{isDgsCartId:o,isLegacyCartId:r}=(e=>e?e.includes("undefined")?{isDgsCartId:!1,isLegacyCartId:!1}:T.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:$.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:L.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:A.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:{isDgsCartId:!1,isLegacyCartId:!1}:{isDgsCartId:!1,isLegacyCartId:!1})(e);if(!r&&!o)return n("[ZONOS - loadZonos] invalid cart id"),null;const s=await I({cartId:e,retries:5});return t("[ZONOS - loadZonos] getting temp cart data","info",s),s?(window.Zonos.storeId=s.cartData.storeId,window.Zonos.zonosApiKey=s.cartData.credentialToken,{cartData:s.cartData,storeFavicon:s.storeFaviconUrl,storeId:s.cartData.storeId,storeLogo:s.storeLogoUrl,zonosApiKey:s.cartData.credentialToken}):(n("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)};var U;const D=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:o,isWhiteListed:t}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const o=new URL(e).origin,t=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>o.includes(e))),n=["qa.js.zonos.com"].some((e=>o.includes(e)));return{currentLoadScriptUrl:o,isForceLoadVersionDomain:n,isWhiteListed:t}})({loadScriptSrc:null==e?void 0:e.src});return t?o:null})(),P="https://v1.3.158.js.zonos.com",F=D||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.158",R="https://fonts.googleapis.com",x=/^https:\/\/fonts\.googleapis\.com/;class M{}U=M,M.doneInit=!1,M.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),M.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),M._paypalMockResponse=null,M.isBigCommerce=!1,M.releaseDate="1739220577125",M.isLegacyCheckout=!1,M.domain="undefined"!=typeof window?window.location!=window.parent.location&&document.referrer||document.location.hostname:"",M.showBaseForeign="undefined"!=typeof window&&window.location.search.includes("zonosShowBaseForeign"),M.isNpm=!0,M.zonosQaUrl=null,M.zonosQaUrlApi=null,M.version="v1.3.158",M.modeAlerted=!1,M.cartData=null,M.paypal=null,M.getCurrentTimestamp=()=>(new Date).getTime(),M.zonosController=null,M.init=async e=>{const{appearance:o,checkoutSettings:r,currencyConverter:s,helloSettings:i,onCountryChange:l,overrideCurrencyFormat:d,storeId:u,zonosApiKey:p}=e;if(U.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),U.doneInit)return;if(t(`====== ZONOS DEBUG MODE: on (${U.version}) ======`),U.zonosApiKey=p,U.storeId=u,U.isNpm){t("====== ZONOS LOADING FROM NPM ======");const o=S();if(o&&!window.isZonosPreview){t(`====== RE-INJECT "zonos.js" FROM PRVIEW: ${o} ======`,"info");const n=document.createElement("script");return n.src=`${o}/dist/scripts/zonos.js`,document.head.appendChild(n),n.addEventListener("load",(()=>{window.Zonos.isNpm=U.isNpm,window.Zonos.isBigCommerce=U.isBigCommerce,window.Zonos.isLegacyCheckout=U.isLegacyCheckout,window.Zonos.init(e)})),n.addEventListener("error",(()=>{alert(`[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: ${o}`)})),void(window.isZonosPreview=!0)}if(!p&&!U.cartId)return void n("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!U.cartData&&U.cartId){t("Initialize cart data");const e=await N(U.cartId);if(!e)return void n("Failed to get cart data");U.cartData=e.cartData,U.zonosApiKey=e.zonosApiKey}const r=await(async()=>{const e=c(),o=a();if(!e&&!o||!window.Zonos.zonosApiKey)return null;if(t("[ZONOS - loadZonos] Attempt test public credential","info"),window.Zonos.zonosApiKey.includes("credential_test"))return t("[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key","info"),null;const{errors:r,json:s}=await v("/api/get-test-public-credential");if(r.length||!s)return n("[ZONOS - loadZonos] Failed to get test public credential. Keep using production key",r),null;const i=s.publicCredential;return i?(t(`[ZONOS - loadZonos] Retrieve new test public token ${i}`,"info"),i):(n("[ZONOS - loadZonos] No test public key credential. Keep using production key"),null)})();r&&(U.zonosApiKey=r)}const m=new URL(window.location.href).searchParams.get("payment_intent_client_secret")||sessionStorage.getItem("zonos--client-secret");if(U.cartId&&U.cartData||!!m){t("Cart data or stripe client secret is available, inject hidden button and trigger checkout");const e=document.createElement("button");e.style.display="none",e.id="zonos--checkout-hidden-button",document.body.appendChild(e)}t("init zonos"),U.injectCustomScriptForHostedCheckout(),U.injectZonosCdn(),U.injectZonosCss(),U.injectFonts(),U.injectController({config:{appearance:o,checkoutSettings:r,currencyConverter:s,helloSettings:i,onCountryChange:l,overrideCurrencyFormat:d}}),U.doneInit=!0},M.injectCustomScriptForHostedCheckout=()=>{const e=U.cartData,o=(null==e?void 0:e.metadata)||[],n=o.find((e=>"customHeaderScript"===e.key)),r=o.find((e=>"customFooterScript"===e.key));if(window.Zonos.isLegacyCheckout&&(n||r)){if(n){t("Injecting custom header script");const e=document.createElement("script");e.textContent=n.value,document.head.appendChild(e)}if(r){t("Injecting custom footer script");const e=document.createElement("script");e.textContent=r.value,document.body.appendChild(e)}}else t("Skip injecting custom script for hosted checkout","info",{footerScript:r,headerScript:n,isLegacyCheckout:window.Zonos.isLegacyCheckout})},M.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},M.openHelloDialog=e=>{const o=document.querySelector("zonos-hello");o&&o.openHelloDialog(null==e||e)},M.showNotification=e=>{var o;null===(o=U.zonosController)||void 0===o||o.showNotification(e)},M.updateOrganizationName=e=>{var o;null===(o=U.zonosController)||void 0===o||o.updateOrganizationName(e)},M.disablePlaceOrderButtons=({autoEnable:e=!0,config:o,disable:t,placeOrderButtonSelector:n})=>{var r;if(!(null===(r=o.checkoutSettings)||void 0===r?void 0:r.disablePlaceOrderButtonActivation)&&n){const o=document.querySelectorAll(n),r=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};o.forEach((e=>{e.getAttribute("data-zonos-checkout-attached")||(t?(e.setAttribute("disabled","true"),e.addEventListener("click",r)):(e.removeAttribute("disabled"),e.removeEventListener("click",r)))})),e&&t&&setTimeout((()=>{o.forEach((e=>{e.removeAttribute("disabled"),e.removeEventListener("click",r)}))}),5e3)}},M.injectController=({config:e})=>{var o;if(document.querySelector("zonos-controller"))return;if(null===(o=e.checkoutSettings)||void 0===o?void 0:o.placeOrderButtonSelector){const o=e.checkoutSettings.placeOrderButtonSelector;U.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o});new MutationObserver((()=>{U.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o})})).observe(document.body,{childList:!0,subtree:!0})}const r=document.createElement("zonos-controller");r.config=e,r.zonosApiKey=U.zonosApiKey||"",r.addEventListener("stripeInitEvent",(async e=>{const{detail:o}=e;t("loading Stripe");const s=await(async(...e)=>{k=!0;const o=Date.now();return Z.then((t=>((e,o,t)=>{if(null===e)return null;const n=e.apply(void 0,o);return((e,o)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:o})})(n,t),n})(t,e,o)))})(o.publishableKey);s?(window.Zonos.stripe=s,r.initCheckoutElement(s)):n("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(r),U.zonosController=r,t("Zonos controller injected!")},M.injectScript=({cdnType:e,isModule:o,theRestUrl:r})=>{const s=`${U.getZonosUrl(e)}/${r}`;if(document.querySelector(`script[src="${s}"]`))return void t(`Zonos script "${s}" already exists in the document`,"warn");const a=document.head||document.body,c=document.createElement("script");o?c.type="module":c.noModule=!0,c.src=s,c.crossOrigin="anonymous",c.onerror=()=>{n(`Failed to load ${c.src}`);const t=i(e);t&&U.injectScript({cdnType:t,isModule:o,theRestUrl:r})},a.appendChild(c)},M.getZonosUrl=e=>{const o=()=>{switch(e){case"jsdelivr":return F;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.158";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.158";case"vercel":return P}};if(U.isNpm){return S()||o()}return o()},M.injectZonosCdn=()=>{U.injectScript({cdnType:s,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),U.injectScript({cdnType:s,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),t("Zonos cdn script injected!")},M.injectStylesheet=({cdnType:e,theRestUrl:o})=>{const t=U.getZonosUrl(e),r=document.head||document.body,s=document.createElement("link");s.rel="preconnect",s.href=`${P}/`,r.appendChild(s);const a=document.createElement("link");a.rel="stylesheet",a.href=`${t}/${o}`,a.onerror=()=>{n(`Failed to load ${a.href}`);const t=i(e);t&&U.injectStylesheet({cdnType:t,theRestUrl:o})},r.appendChild(a)},M.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?t("Zonos style links already injected","warn"):(U.injectStylesheet({cdnType:s,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),t("Zonos style css injected!"))},M.injectFonts=()=>{if((()=>{if(document.fonts.check("1em Inter"))return void t("Inter font already loaded","warn");const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${R}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&!x.test(t.href))return t}return null})())return void t("Inter font already injected","warn");const e=document.head||document.body,o=document.createElement("link");o.rel="preconnect",o.href=R,e.appendChild(o);const n=document.createElement("link");n.rel="stylesheet",n.href=`${R}/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap`,e.appendChild(n),t("Zonos font injected!")},M.setupGoogleFont=e=>{var o;null===(o=U.zonosController)||void 0===o||o.setupGoogleFont(e)},M.injectSupportGoogleFont=e=>{var o;t(`[FONT] injecting ${e}`);const n=null===(o=e.match(/family=(.*?):/))||void 0===o?void 0:o[1],r=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${R}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=R,r.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${e}"]`))return void t(`[FONT] ${n} font already injected`,"warn");const s=document.createElement("link");s.rel="stylesheet",s.href=e,r.appendChild(s),t(`[FONT] ${n} font injected!`)},exports.Zonos=M})();
1
+ (function(){"use strict";const e=performance.now(),o=e=>{if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(o){if(e&&"function"==typeof e.toString){return e.toString()}return"Unable to stringify info"}},t=(t,n,...r)=>{var s,i;const{elapsedTimePretty:a}=(()=>{const o=performance.now()-e,t=o>1e3?`${(o/1e3).toFixed(2)}s`:`${o.toFixed(2)}ms`;return{elapsedTime:o,elapsedTimePretty:t}})(),c=[`(${a})`,...r];c.map(o).join(" ");if(!(!!(null===(s=window.Zonos)||void 0===s?void 0:s.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===n&&console.error(t,...c));let l=document.querySelector("iframe#zonos---debug-logging-iframe");l||(l=document.createElement("iframe"),l.id="zonos---debug-logging-iframe",l.style.display="none",l.style.opacity="0",l.style.position="absolute",l.style.top="-9999px",l.style.left="-9999px",l.style.width="1px",l.style.height="1px",l.style.border="none",l.style.overflow="hidden",l.style.visibility="hidden",document.body.appendChild(l));const d=(null===(i=l.contentWindow)||void 0===i?void 0:i.window.console)||window.console;switch(n){case"warn":d.warn(t,...c);break;case"info":d.info(t,...c);break;case"error":d.error(t,...c);break;default:d.groupCollapsed(t,...c),d.trace(),d.groupEnd()}},n=(e,...o)=>{t(e,"error",...o)},r=["jsdelivr","cdnjs","unpkg","vercel"],s="jsdelivr",i=e=>{const o=r.indexOf(e);return r[o+1]||null},a=()=>window.location.search.includes("zonosStagingMode=1"),c=()=>{var e;return(null===(e=window.Zonos.zonosApiKey)||void 0===e?void 0:e.includes("test"))||window.location.search.includes("zonosTestMode=1")};function l(e,o){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&o.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)o.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(t[n[r]]=e[n[r]])}return t}"function"==typeof SuppressedError&&SuppressedError;const d=["cloudflare","vercel"],u=d[0],p={cloudflare:"https://route.elements.zonos.com",vercel:"https://route.js.zonos.com"},m=p[u],w=(e=u)=>{const o=d.indexOf(e),t=d[o+1];return t||null},h=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},y=async({response:e,shouldLog:o=!0,shouldThrow:t=!1})=>{try{const o=await e.text(),t=h(o);if(!t)throw new Error(`Failed to parse content: ${o}`);return t}catch(e){if(t)throw e;return o&&console.error(e),null}},g=async({basePathType:e,options:o,path:t})=>{let n;const r=window.Zonos.zonosQaUrlApi||p[e]||u,s=new URL(r+t),i=window.Zonos.cartId?`${window.location.hostname}-${window.Zonos.cartId}`:window.location.hostname;s.searchParams.set("zToken",(e=>{try{return btoa(e).replace(/=/g,"")}catch(o){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(i));try{n=await fetch(s.toString(),o)}catch(e){if(e instanceof Error)return{baseUrl:r,errors:[{message:e.message,type:"unknown"}],json:null,response:null,zonosMode:null};return{baseUrl:r,errors:[{message:"Failed to fetch",type:"unknown"}],json:null,response:null,zonosMode:null}}const a=n.headers.get("Zonos-Mode"),c=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&a&&c&&(window.Zonos.modeAlerted=!0),n.ok){return{baseUrl:r,errors:[],json:await y({response:n}),response:n,zonosMode:a}}const l=n.status.toString();try{const e=await y({response:n,shouldThrow:!0});if(e&&"errors"in e&&Array.isArray(e.errors)){const o=e.errors;return{baseUrl:r,errors:o.map((e=>"string"==typeof e?{message:e,type:l}:e)),json:null,response:n,zonosMode:a}}return{baseUrl:r,errors:[{message:JSON.stringify(e),type:l}],json:null,response:n,zonosMode:a}}catch(e){return{baseUrl:r,errors:[{message:`${l}: ${"Unknown error"}`,type:l}],json:null,response:null,zonosMode:a}}},f=async({basePathType:e,options:o,path:n})=>{var r,s;const i=n.startsWith("/api/bigcommerce")?"vercel":e,a=await g({basePathType:i,options:o,path:n}),{errors:c,response:d}=a,u=l(a,["errors","response"]),y=w(i),v=!!c.find((({type:e})=>"unknown"===e))||404===(null==d?void 0:d.status),S=y&&v;return v&&(async({endpoint:e,errors:o,metadata:n,shouldPostReleaseErrorReporting:r})=>{if(t("sendErrorLog","warn",e,n,o),r){const e=Number(window.Zonos.releaseDate);if((new Date).getTime()-e>36e5)return}const s="userAgentData"in window.navigator?window.navigator.userAgentData:null,i={endpoint:e,errors:o,href:window.location.href,metadata:Object.assign({appVersion:window.Zonos.version,domain:window.Zonos.domain,publicCredential:window.Zonos.zonosApiKey,userAgent:s&&s.brands.length>0?s:window.navigator.userAgent},n)};try{fetch(`${m}/api/zonos-elements/log-error`,{body:JSON.stringify(i),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const o=w();if(!o)return;fetch(`${p[o]}/api/zonos-elements/log-error`,{body:JSON.stringify(i),method:"POST"})}})({endpoint:p[i]+n,errors:c.map((({message:e})=>`API: ${e}`)),metadata:{currentBasePath:i,nextFallbackApiType:y,requestHeaders:null==o?void 0:o.headers,requestPayload:h(null===(r=null==o?void 0:o.body)||void 0===r?void 0:r.toString())||(null===(s=null==o?void 0:o.body)||void 0===s?void 0:s.toString()),status:null==d?void 0:d.status,statusText:null==d?void 0:d.statusText},shouldPostReleaseErrorReporting:!0}),S?(t(`=== "${n}" failed to fetch, trying next fallback ${y}`),f({basePathType:y,options:o,path:n})):Object.assign({errors:c,response:d},u)},v=async(e,o)=>{const n=l(o||{},[]),r=n.body?JSON.stringify(n.body):void 0,s=n.method||"GET",i=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Staging-Mode":a()?"1":void 0,"Zonos-Test-Mode":c()?"1":void 0,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},n.headers);Object.keys(i).forEach((e=>void 0===i[e]&&delete i[e]));const d=Object.assign(Object.assign({},n),{body:"GET"===s?void 0:r,headers:i,method:s}),p=new URLSearchParams(window.location.search).get("useFallbackApi");return t(e,"info"),f({basePathType:p||u,options:d,path:e})},S=()=>{const e=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||e)return null;const o=(e=>{if(!e)return null;const o=new URL(e).searchParams.get("zonosQaUrl");return o?/[^a-zA-Z0-9-_]+/.test(o)?null:o:null})(window.location.href),n="https://v1.3.160.js.zonos.com";if(!o&&(n.includes("test.")||n.includes("test-")))return n;if(!o&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!o)return null;if("dev-elements"===o)return"https://dev.elements.zonos.com";const r=`https://${o}.preview.js.zonos.com`;return t(`[ZONOS-WARNING] using '${r}' for loading elements script`,"warn"),fetch(r).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${r}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:o}=window.location,t=`${o}?${e.toString()}`;return window.history.replaceState(window.history.state,"",t),window.location.reload(),null})),r},b="https://js.stripe.com/v3",z=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,C="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let j=null;const O=e=>(null!==j||(j=new Promise(((o,t)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(C),window.Stripe)o(window.Stripe);else try{let r=(()=>{const e=document.querySelectorAll(`script[src^="${b}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&z.test(t.src))return t}return null})();r&&e?console.warn(C):r||(r=(e=>{const o=document.createElement("script");o.src=`${b}`;const t=document.head||document.body;return t?(t.appendChild(o),o):(n("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==r||r.addEventListener("load",(()=>{window.Stripe?o(window.Stripe):t(new Error("Stripe.js not available"))})),null==r||r.addEventListener("error",(()=>{t(new Error("Failed to load Stripe.js"))}))}catch(e){return void t(e)}else o(null)}))),j),Z=Promise.resolve().then((()=>O(null)));let k=!1;Z.catch((e=>{k||console.warn(e)}));const I=async({cartId:e,retries:o})=>{const n=c(),{errors:r,json:s}=await v("/api/zonos-elements/get-temp-cart",{body:{isTestMode:n,options:{noOnlineStoreSettings:!0},tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"}),i=!s||r.length;return i&&o?(t("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:o}),await new Promise((e=>setTimeout(e,500))),I({cartId:e,retries:o-1})):i?null:s},E=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/,A=new RegExp(`^${E.source}$`),L=new RegExp(`^cart_${E.source}$`),$=/^[a-zA-Z0-9]{2,}$/,T=/^cart_[a-zA-Z0-9]{2,}$/,N=async e=>{const{isDgsCartId:o,isLegacyCartId:r}=(e=>e?e.includes("undefined")?{isDgsCartId:!1,isLegacyCartId:!1}:T.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:$.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:L.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:A.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:{isDgsCartId:!1,isLegacyCartId:!1}:{isDgsCartId:!1,isLegacyCartId:!1})(e);if(!r&&!o)return n("[ZONOS - loadZonos] invalid cart id"),null;const s=await I({cartId:e,retries:5});return t("[ZONOS - loadZonos] getting temp cart data","info",s),s?(window.Zonos.storeId=s.cartData.storeId,window.Zonos.zonosApiKey=s.cartData.credentialToken,{cartData:s.cartData,storeFavicon:s.storeFaviconUrl,storeId:s.cartData.storeId,storeLogo:s.storeLogoUrl,zonosApiKey:s.cartData.credentialToken}):(n("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)};var U;const D=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:o,isWhiteListed:t}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const o=new URL(e).origin,t=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>o.includes(e))),n=["qa.js.zonos.com"].some((e=>o.includes(e)));return{currentLoadScriptUrl:o,isForceLoadVersionDomain:n,isWhiteListed:t}})({loadScriptSrc:null==e?void 0:e.src});return t?o:null})(),P="https://v1.3.160.js.zonos.com",F=D||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.160",R="https://fonts.googleapis.com",x=/^https:\/\/fonts\.googleapis\.com/;class M{}U=M,M.doneInit=!1,M.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),M.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),M._paypalMockResponse=null,M.isBigCommerce=!1,M.releaseDate="1739466306623",M.isLegacyCheckout=!1,M.domain="undefined"!=typeof window?window.location!=window.parent.location&&document.referrer||document.location.hostname:"",M.showBaseForeign="undefined"!=typeof window&&window.location.search.includes("zonosShowBaseForeign"),M.isNpm=!0,M.zonosQaUrl=null,M.zonosQaUrlApi=null,M.version="v1.3.160",M.modeAlerted=!1,M.cartData=null,M.paypal=null,M.getCurrentTimestamp=()=>(new Date).getTime(),M.zonosController=null,M.init=async e=>{const{appearance:o,checkoutSettings:r,currencyConverter:s,helloSettings:i,onCountryChange:l,overrideCurrencyFormat:d,storeId:u,zonosApiKey:p}=e;if(U.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),U.doneInit)return;if(t(`====== ZONOS DEBUG MODE: on (${U.version}) ======`),U.zonosApiKey=p,U.storeId=u,U.isNpm){t("====== ZONOS LOADING FROM NPM ======");const o=S();if(o&&!window.isZonosPreview){t(`====== RE-INJECT "zonos.js" FROM PRVIEW: ${o} ======`,"info");const n=document.createElement("script");return n.src=`${o}/dist/scripts/zonos.js`,document.head.appendChild(n),n.addEventListener("load",(()=>{window.Zonos.isNpm=U.isNpm,window.Zonos.isBigCommerce=U.isBigCommerce,window.Zonos.isLegacyCheckout=U.isLegacyCheckout,window.Zonos.init(e)})),n.addEventListener("error",(()=>{alert(`[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: ${o}`)})),void(window.isZonosPreview=!0)}if(!p&&!U.cartId)return void n("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!U.cartData&&U.cartId){t("Initialize cart data");const e=await N(U.cartId);if(!e)return void n("Failed to get cart data");U.cartData=e.cartData,U.zonosApiKey=e.zonosApiKey}const r=await(async()=>{const e=c(),o=a();if(!e&&!o||!window.Zonos.zonosApiKey)return null;if(t("[ZONOS - loadZonos] Attempt test public credential","info"),window.Zonos.zonosApiKey.includes("credential_test"))return t("[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key","info"),null;const{errors:r,json:s}=await v("/api/get-test-public-credential");if(r.length||!s)return n("[ZONOS - loadZonos] Failed to get test public credential. Keep using production key",r),null;const i=s.publicCredential;return i?(t(`[ZONOS - loadZonos] Retrieve new test public token ${i}`,"info"),i):(n("[ZONOS - loadZonos] No test public key credential. Keep using production key"),null)})();r&&(U.zonosApiKey=r)}const m=new URL(window.location.href).searchParams.get("payment_intent_client_secret")||sessionStorage.getItem("zonos--client-secret");if(U.cartId&&U.cartData||!!m){t("Cart data or stripe client secret is available, inject hidden button and trigger checkout");const e=document.createElement("button");e.style.display="none",e.id="zonos--checkout-hidden-button",document.body.appendChild(e)}t("init zonos"),U.injectCustomScriptForHostedCheckout(),U.injectZonosCdn(),U.injectZonosCss(),U.injectFonts(),U.injectController({config:{appearance:o,checkoutSettings:r,currencyConverter:s,helloSettings:i,onCountryChange:l,overrideCurrencyFormat:d}}),U.doneInit=!0},M.injectCustomScriptForHostedCheckout=()=>{const e=U.cartData,o=(null==e?void 0:e.metadata)||[],n=o.find((e=>"customHeaderScript"===e.key)),r=o.find((e=>"customFooterScript"===e.key));if(window.Zonos.isLegacyCheckout&&(n||r)){if(n){t("Injecting custom header script");const e=document.createElement("script");e.textContent=n.value,document.head.appendChild(e)}if(r){t("Injecting custom footer script");const e=document.createElement("script");e.textContent=r.value,document.body.appendChild(e)}}else t("Skip injecting custom script for hosted checkout","info",{footerScript:r,headerScript:n,isLegacyCheckout:window.Zonos.isLegacyCheckout})},M.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},M.openHelloDialog=e=>{const o=document.querySelector("zonos-hello");o&&o.openHelloDialog(null==e||e)},M.showNotification=e=>{var o;null===(o=U.zonosController)||void 0===o||o.showNotification(e)},M.updateOrganizationName=e=>{var o;null===(o=U.zonosController)||void 0===o||o.updateOrganizationName(e)},M.disablePlaceOrderButtons=({autoEnable:e=!0,config:o,disable:t,placeOrderButtonSelector:n})=>{var r;if(!(null===(r=o.checkoutSettings)||void 0===r?void 0:r.disablePlaceOrderButtonActivation)&&n){const o=document.querySelectorAll(n),r=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};o.forEach((e=>{e.getAttribute("data-zonos-checkout-attached")||(t?(e.setAttribute("disabled","true"),e.addEventListener("click",r)):(e.removeAttribute("disabled"),e.removeEventListener("click",r)))})),e&&t&&setTimeout((()=>{o.forEach((e=>{e.removeAttribute("disabled"),e.removeEventListener("click",r)}))}),5e3)}},M.injectController=({config:e})=>{var o;if(document.querySelector("zonos-controller"))return;if(null===(o=e.checkoutSettings)||void 0===o?void 0:o.placeOrderButtonSelector){const o=e.checkoutSettings.placeOrderButtonSelector;U.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o});new MutationObserver((()=>{U.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o})})).observe(document.body,{childList:!0,subtree:!0})}const r=document.createElement("zonos-controller");r.config=e,r.zonosApiKey=U.zonosApiKey||"",r.addEventListener("stripeInitEvent",(async e=>{const{detail:o}=e;t("loading Stripe");const s=await(async(...e)=>{k=!0;const o=Date.now();return Z.then((t=>((e,o,t)=>{if(null===e)return null;const n=e.apply(void 0,o);return((e,o)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:o})})(n,t),n})(t,e,o)))})(o.publishableKey);s?(window.Zonos.stripe=s,r.initCheckoutElement(s)):n("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(r),U.zonosController=r,t("Zonos controller injected!")},M.injectScript=({cdnType:e,isModule:o,theRestUrl:r})=>{const s=`${U.getZonosUrl(e)}/${r}`;if(document.querySelector(`script[src="${s}"]`))return void t(`Zonos script "${s}" already exists in the document`,"warn");const a=document.head||document.body,c=document.createElement("script");o?c.type="module":c.noModule=!0,c.src=s,c.crossOrigin="anonymous",c.onerror=()=>{n(`Failed to load ${c.src}`);const t=i(e);t&&U.injectScript({cdnType:t,isModule:o,theRestUrl:r})},a.appendChild(c)},M.getZonosUrl=e=>{const o=()=>{switch(e){case"jsdelivr":return F;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.160";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.160";case"vercel":return P}};if(U.isNpm){return S()||o()}return o()},M.injectZonosCdn=()=>{U.injectScript({cdnType:s,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),U.injectScript({cdnType:s,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),t("Zonos cdn script injected!")},M.injectStylesheet=({cdnType:e,theRestUrl:o})=>{const t=U.getZonosUrl(e),r=document.head||document.body,s=document.createElement("link");s.rel="preconnect",s.href=`${P}/`,r.appendChild(s);const a=document.createElement("link");a.rel="stylesheet",a.href=`${t}/${o}`,a.onerror=()=>{n(`Failed to load ${a.href}`);const t=i(e);t&&U.injectStylesheet({cdnType:t,theRestUrl:o})},r.appendChild(a)},M.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?t("Zonos style links already injected","warn"):(U.injectStylesheet({cdnType:s,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),t("Zonos style css injected!"))},M.injectFonts=()=>{if((()=>{if(document.fonts.check("1em Inter"))return void t("Inter font already loaded","warn");const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${R}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&!x.test(t.href))return t}return null})())return void t("Inter font already injected","warn");const e=document.head||document.body,o=document.createElement("link");o.rel="preconnect",o.href=R,e.appendChild(o);const n=document.createElement("link");n.rel="stylesheet",n.href=`${R}/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap`,e.appendChild(n),t("Zonos font injected!")},M.setupGoogleFont=e=>{var o;null===(o=U.zonosController)||void 0===o||o.setupGoogleFont(e)},M.injectSupportGoogleFont=e=>{var o;t(`[FONT] injecting ${e}`);const n=null===(o=e.match(/family=(.*?):/))||void 0===o?void 0:o[1],r=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${R}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=R,r.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${e}"]`))return void t(`[FONT] ${n} font already injected`,"warn");const s=document.createElement("link");s.rel="stylesheet",s.href=e,r.appendChild(s),t(`[FONT] ${n} font injected!`)},exports.Zonos=M})();
@@ -1 +1 @@
1
- (function(){"use strict";function o(o,e){var n={};for(var t in o)Object.prototype.hasOwnProperty.call(o,t)&&e.indexOf(t)<0&&(n[t]=o[t]);if(null!=o&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(t=Object.getOwnPropertySymbols(o);r<t.length;r++)e.indexOf(t[r])<0&&Object.prototype.propertyIsEnumerable.call(o,t[r])&&(n[t[r]]=o[t[r]])}return n}"function"==typeof SuppressedError&&SuppressedError;const e=()=>window.location.search.includes("zonosStagingMode=1"),n=()=>{var o;return(null===(o=window.Zonos.zonosApiKey)||void 0===o?void 0:o.includes("test"))||window.location.search.includes("zonosTestMode=1")},t=["cloudflare","vercel"],r=t[0],s={cloudflare:"https://route.elements.zonos.com",vercel:"https://route.js.zonos.com"},i=s[r],a=(o=r)=>{const e=t.indexOf(o),n=t[e+1];return n||null},d=o=>{if("string"==typeof o)try{return JSON.parse(o)}catch(o){return null}return null},c=performance.now(),l=o=>{if("string"==typeof o)return o;try{return JSON.stringify(o)}catch(e){if(o&&"function"==typeof o.toString){return o.toString()}return"Unable to stringify info"}},p=(o,e,...n)=>{var t,r;const{elapsedTimePretty:s}=(()=>{const o=performance.now()-c,e=o>1e3?`${(o/1e3).toFixed(2)}s`:`${o.toFixed(2)}ms`;return{elapsedTime:o,elapsedTimePretty:e}})(),i=[`(${s})`,...n];i.map(l).join(" ");if(!(!!(null===(t=window.Zonos)||void 0===t?void 0:t.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===e&&console.error(o,...i));let a=document.querySelector("iframe#zonos---debug-logging-iframe");a||(a=document.createElement("iframe"),a.id="zonos---debug-logging-iframe",a.style.display="none",a.style.opacity="0",a.style.position="absolute",a.style.top="-9999px",a.style.left="-9999px",a.style.width="1px",a.style.height="1px",a.style.border="none",a.style.overflow="hidden",a.style.visibility="hidden",document.body.appendChild(a));const d=(null===(r=a.contentWindow)||void 0===r?void 0:r.window.console)||window.console;switch(e){case"warn":d.warn(o,...i);break;case"info":d.info(o,...i);break;case"error":d.error(o,...i);break;default:d.groupCollapsed(o,...i),d.trace(),d.groupEnd()}},u=async({endpoint:o,errors:e,metadata:n,shouldPostReleaseErrorReporting:t})=>{if(p("sendErrorLog","warn",o,n,e),t){const o=Number(window.Zonos.releaseDate);if((new Date).getTime()-o>36e5)return}const r="userAgentData"in window.navigator?window.navigator.userAgentData:null,d={endpoint:o,errors:e,href:window.location.href,metadata:Object.assign({appVersion:window.Zonos.version,domain:window.Zonos.domain,publicCredential:window.Zonos.zonosApiKey,userAgent:r&&r.brands.length>0?r:window.navigator.userAgent},n)};try{fetch(`${i}/api/zonos-elements/log-error`,{body:JSON.stringify(d),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(o){const e=a();if(!e)return;fetch(`${s[e]}/api/zonos-elements/log-error`,{body:JSON.stringify(d),method:"POST"})}},m=async({response:o,shouldLog:e=!0,shouldThrow:n=!1})=>{try{const e=await o.text(),n=d(e);if(!n)throw new Error(`Failed to parse content: ${e}`);return n}catch(o){if(n)throw o;return e&&console.error(o),null}},w=async({basePathType:o,options:e,path:n})=>{let t;const i=window.Zonos.zonosQaUrlApi||s[o]||r,a=new URL(i+n),d=window.Zonos.cartId?`${window.location.hostname}-${window.Zonos.cartId}`:window.location.hostname;a.searchParams.set("zToken",(o=>{try{return btoa(o).replace(/=/g,"")}catch(e){return o.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(d));try{t=await fetch(a.toString(),e)}catch(o){if(o instanceof Error)return{baseUrl:i,errors:[{message:o.message,type:"unknown"}],json:null,response:null,zonosMode:null};return{baseUrl:i,errors:[{message:"Failed to fetch",type:"unknown"}],json:null,response:null,zonosMode:null}}const c=t.headers.get("Zonos-Mode"),l=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&c&&l&&(window.Zonos.modeAlerted=!0),t.ok){return{baseUrl:i,errors:[],json:await m({response:t}),response:t,zonosMode:c}}const p=t.status.toString();try{const o=await m({response:t,shouldThrow:!0});if(o&&"errors"in o&&Array.isArray(o.errors)){const e=o.errors;return{baseUrl:i,errors:e.map((o=>"string"==typeof o?{message:o,type:p}:o)),json:null,response:t,zonosMode:c}}return{baseUrl:i,errors:[{message:JSON.stringify(o),type:p}],json:null,response:t,zonosMode:c}}catch(o){return{baseUrl:i,errors:[{message:`${p}: ${"Unknown error"}`,type:p}],json:null,response:null,zonosMode:c}}},g=async({basePathType:e,options:n,path:t})=>{var r,i;const c=t.startsWith("/api/bigcommerce")?"vercel":e,l=await w({basePathType:c,options:n,path:t}),{errors:m,response:f}=l,y=o(l,["errors","response"]),h=a(c),v=!!m.find((({type:o})=>"unknown"===o))||404===(null==f?void 0:f.status),Z=h&&v;return v&&u({endpoint:s[c]+t,errors:m.map((({message:o})=>`API: ${o}`)),metadata:{currentBasePath:c,nextFallbackApiType:h,requestHeaders:null==n?void 0:n.headers,requestPayload:d(null===(r=null==n?void 0:n.body)||void 0===r?void 0:r.toString())||(null===(i=null==n?void 0:n.body)||void 0===i?void 0:i.toString()),status:null==f?void 0:f.status,statusText:null==f?void 0:f.statusText},shouldPostReleaseErrorReporting:!0}),Z?(p(`=== "${t}" failed to fetch, trying next fallback ${h}`),g({basePathType:h,options:n,path:t})):Object.assign({errors:m,response:f},y)},f=async(t,s)=>{const i=o(s||{},[]),a=i.body?JSON.stringify(i.body):void 0,d=i.method||"GET",c=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Staging-Mode":e()?"1":void 0,"Zonos-Test-Mode":n()?"1":void 0,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},i.headers);Object.keys(c).forEach((o=>void 0===c[o]&&delete c[o]));const l=Object.assign(Object.assign({},i),{body:"GET"===d?void 0:a,headers:c,method:d}),u=new URLSearchParams(window.location.search).get("useFallbackApi");return p(t,"info"),g({basePathType:u||r,options:l,path:t})},y=(o,...e)=>{p(o,"error",...e)},h=["jsdelivr","cdnjs","unpkg","vercel"],v=o=>{if(!o)return null;const e=new URL(o).searchParams.get("zonosQaUrl");if(!e)return null;return/[^a-zA-Z0-9-_]+/.test(e)?null:e},Z=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/,S=new RegExp(`^${Z.source}$`),z=new RegExp(`^cart_${Z.source}$`),O=/^[a-zA-Z0-9]{2,}$/,L=/^cart_[a-zA-Z0-9]{2,}$/,b=o=>o?o.includes("undefined")?{isDgsCartId:!1,isLegacyCartId:!1}:L.test(o)?{isDgsCartId:!0,isLegacyCartId:!1}:O.test(o)?{isDgsCartId:!1,isLegacyCartId:!0}:z.test(o)?{isDgsCartId:!0,isLegacyCartId:!1}:S.test(o)?{isDgsCartId:!1,isLegacyCartId:!0}:{isDgsCartId:!1,isLegacyCartId:!1}:{isDgsCartId:!1,isLegacyCartId:!1},I=async({cartId:o,retries:e})=>{const t=n(),{errors:r,json:s}=await f("/api/zonos-elements/get-temp-cart",{body:{isTestMode:t,options:{noOnlineStoreSettings:!0},tempCartUUID:o},headers:{"Content-Type":"application/json"},method:"POST"}),i=!s||r.length;return i&&e?(p("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:e}),await new Promise((o=>setTimeout(o,500))),I({cartId:o,retries:e-1})):i?null:s};var C;const U=(()=>{const o=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||o)return null;const e=v(window.location.href),n="https://v1.3.158.js.zonos.com";if(!e&&(n.includes("test.")||n.includes("test-")))return n;if(!e&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!e)return null;if("dev-elements"===e)return"https://dev.elements.zonos.com";const t=`https://${e}.preview.js.zonos.com`;return p(`[ZONOS-WARNING] using '${t}' for loading elements script`,"warn"),fetch(t).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${t}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const o=new URLSearchParams(window.location.search);o.delete("zonosQaUrl");const{pathname:e}=window.location,n=`${e}?${o.toString()}`;return window.history.replaceState(window.history.state,"",n),window.location.reload(),null})),t})(),j=(()=>{const o=(o=>{if(!o)return null;const e=new URL(o).searchParams.get("zonosQaUrlApi");return e?/[^a-zA-Z0-9-_]+/.test(e)?null:e:null})(window.location.href),e=v(window.location.href),n=o||e;if(!n&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.demo.elements.zonos.com";if(!n)return null;if("dev-elements"===n)return"https://dev.demo.elements.zonos.com";if(!o)return null;const t=`https://${o}.route.js.zonos.com`;return p(`[ZONOS-WARNING] using '${t}' for serverless API`,"warn"),t})();class k{}C=k,k.isNpm=!1,k.isBigCommerce=!1,k.requested=!1,k.cartData=null,k.domain=window.location!=window.parent.location?document.referrer:document.location.hostname,k.version="v1.3.158",k.isLegacyCheckout=!1,k.legacyStoreLogo=null,k.legacyStoreFavicon=null,k.parallelLoadTimes=[],k.parallelLoadState="off",k.releaseDate="1739220577125",k.loadScriptLogHandler=async({cdnLoadTime:o,fallbackLoadTime:e,isError:n,metadata:t,scriptLoadUrl:r,storeId:s,type:i})=>{try{const o=window.performance.getEntriesByType("resource").find((o=>{const e=o;return e.name.includes(r)&&"script"===e.initiatorType}));null==o||o.transferSize;(async o=>{})((o&&(null==o?void 0:o.duration)>0?parseFloat(o.duration.toFixed(2)):parseFloat(e.toFixed(2)),Object.assign({decodedBodySize:null==o?void 0:o.decodedBodySize,encodedBodySize:null==o?void 0:o.encodedBodySize,fallbackLoadTime:e,isError:!!n},t)))}catch(o){}},k.loadScriptLogParallelHandler=async o=>{try{if(C.parallelLoadTimes.push(o),2===C.parallelLoadTimes.length){const o=C.parallelLoadTimes.find((o=>"vercel"===o.type)),e=C.parallelLoadTimes.find((o=>"jsdelivr"===o.type));if(!o||!e)return;if(o.isError&&e.isError)return void u({endpoint:`<${o.scriptLoadUrl}> <${e.scriptLoadUrl}>`,errors:["Failed to fetch both Vercel and jsdelivr CDN. Perhaps network issue on customer site."],metadata:{cdnLoadTime:e.fallbackLoadTime,cdnType:e.type,vercelLoadTime:o.fallbackLoadTime}});C.loadScriptLogHandler({cdnLoadTime:e.fallbackLoadTime,fallbackLoadTime:o.fallbackLoadTime,isError:o.isError,metadata:{cdnScriptFallbackTime:e.fallbackLoadTime,cdnScriptIsError:!!e.isError,cdnScriptLoadUrl:e.scriptLoadUrl,cdnScriptType:e.type},scriptLoadUrl:o.scriptLoadUrl,storeId:o.storeId,type:o.type})}}catch(o){}},k.legacyCheckoutErrorHandler=({message:o,metadata:e})=>{y(`[ZONOS - loadZonos] ${o}`),u({endpoint:"LegacyCheckoutInit",errors:[o],metadata:Object.assign(Object.assign({},e),{tempCartUUID:C.cartId})}),document.dispatchEvent(new CustomEvent("legacyCheckoutError",{detail:o}))},k.getGithubCdn=({type:o,version:e})=>{let n="https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.158";"cdnjs"===o?n="https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.158":"unpkg"===o&&(n="https://unpkg.com/@zonos/elements@1.3.158");return e&&"alpha"!==e?n.replace(/@zonos\/elements@(.+)/,`@zonos/elements@${e}`).replace(/\/zonos-elements\/(.+)/,`/zonos-elements/${e}`):n},k.injectZonos=({cdnType:o="jsdelivr",initConfig:e,parallelLoaded:n,vercelUrl:t,version:r})=>{var s;e=Object.assign(Object.assign({},e),{zonosApiKey:C.zonosApiKey}),r&&(window.Zonos.version=`v${r}`);const i="vercel"===o?t:C.getGithubCdn({type:o,version:r}),a=U||i,d=a.replace("https://","").replace("http://",""),c=document.createElement("script"),l=r&&r<"1.2.5"?"loadZonos.js":"zonos.js";c.src=`https://${d}/dist/scripts/${l}?timestamp=${Date.now()}`,p(`[ZONOS - loadZonos] Injecting "${l}" from "${d}"`,"info");const m="4g"===(null===(s=(()=>{const o="connection"in window.navigator?window.navigator.connection:null,e="mozConnection"in window.navigator?window.navigator.mozConnection:null,n="webkitConnection"in window.navigator?window.navigator.webkitConnection:null;return o||e||n})())||void 0===s?void 0:s.effectiveType),w=["dev.elements.zonos.com","zonos.com"].some((o=>window.location.href.includes(o))),g=h[0]===o,f=h[1],y="on"===C.parallelLoadState&&m&&g&&f&&!w;y&&C.injectZonos({cdnType:f,initConfig:e,parallelLoaded:!0,vercelUrl:t,version:r});const v=performance.now();c.addEventListener("load",(()=>{if(y||n?C.loadScriptLogParallelHandler({fallbackLoadTime:performance.now()-v,scriptLoadUrl:c.src,storeId:C.storeId,type:o}):C.loadScriptLogHandler({fallbackLoadTime:performance.now()-v,scriptLoadUrl:c.src,storeId:C.storeId,type:o}),C.isBigCommerce||(C.isBigCommerce=!!window.stencilBootstrap||!!window.bcConfig||!!document.querySelector('script[src*="bigcommerce.com"]')),window.Zonos.isNpm=!1,window.Zonos.zonosQaUrl=U,window.Zonos.zonosQaUrlApi=j,window.Zonos.isBigCommerce=C.isBigCommerce,C.cartId){if(!C.zonosApiKey)throw C.legacyCheckoutErrorHandler({message:"zonosApiKey is missing to initiate checkout"}),new Error("zonosApiKey is required for legacy checkout");if(!C.cartData)throw C.legacyCheckoutErrorHandler({message:"cartData is missing to initiate legacy checkout"}),new Error("cartData is required for legacy checkout");if(C.legacyStoreFavicon&&C.isLegacyCheckout){const o=document.createElement("link");o.rel="shortcut icon",o.type="image/x-icon",o.href=C.legacyStoreFavicon,document.head.appendChild(o)}window.Zonos.cartData=C.cartData,window.Zonos.isLegacyCheckout=C.isLegacyCheckout;const o=Object.assign(Object.assign({},e),{appearance:Object.assign(Object.assign({},e.appearance),{logoUrl:C.legacyStoreLogo||""}),zonosApiKey:C.zonosApiKey});e=o}window.Zonos.version&&(p(`[ZONOS - loadZonos] Execute "Zonos.init" from "${l}" from "${d}"`,"info"),window.Zonos.init(e))})),c.addEventListener("error",(async()=>{const s=(o=>{const e=h.indexOf(o);return h[e+1]||null})(o);if(!y&&!n){if(!s)return;C.injectZonos({cdnType:s,initConfig:e,vercelUrl:t,version:r})}if(["localhost",".zonos.com"].some((o=>window.location.href.includes(o)))||U)return;if(y||n)return void C.loadScriptLogParallelHandler({fallbackLoadTime:performance.now()-v,isError:!0,scriptLoadUrl:c.src,storeId:C.storeId,type:o});["unpkg","cdnjs","vercel"].includes(o)?u({endpoint:c.src,errors:[`zonos.js - Failed to fetch ${o} CDN.`],metadata:{cdnLoadTime:performance.now()-v,cdnType:o,loadUrl:a,version:r},shouldPostReleaseErrorReporting:!!s}):u({endpoint:c.src,errors:["[Info] Using alternative CDN. Failed to fetch script"],metadata:{cdnType:o,vercelLoadTime:performance.now()-v}})})),document.head.appendChild(c)},k.init=async o=>{var t;if(p("=== Init zonos script release date","info",C.releaseDate),U&&!window.isZonosPreview){p(`[ZONOS - loadZonos] Re-inject "loadZonos.js" from zonosQaUrl: ${U}`,"info");const e=document.createElement("script");return e.src=`${U}/dist/scripts/loadZonos.js?timestamp=${Date.now()}`,document.head.appendChild(e),e.addEventListener("load",(()=>{window.Zonos.isNpm=!1,window.Zonos.isBigCommerce=C.isBigCommerce,window.Zonos.isLegacyCheckout=C.isLegacyCheckout,window.Zonos.init(o)})),e.addEventListener("error",(()=>{alert(`[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: ${U}`)})),void(window.isZonosPreview=!0)}const r=new URLSearchParams(window.location.search).get("tempCartUUID"),{isDgsCartId:s,isLegacyCartId:i}=b(r);if(r&&!i&&!s)return void C.legacyCheckoutErrorHandler({message:`[ZONOS - loadZonos] invalid &tempCartUUID=${r}`,metadata:{invalidCartId:!0}});C.cartId=r;const a="https://v1.3.158.js.zonos.com",d=document.querySelector('script[src*="/zonos.js"]'),c=null===(t=document.querySelector("script[src*='/loadZonos.js']"))||void 0===t?void 0:t.src;p(`[ZONOS - init] first load script src: ${c}`,"info"),window.Zonos.zonosQaUrl=U,window.Zonos.zonosQaUrlApi=j,window.Zonos.zonosQaUrl&&p(`[ZONOS - init] using zonosQaUrl: ${window.Zonos.zonosQaUrl}`,"info"),window.Zonos.zonosQaUrlApi&&p(`[ZONOS - init] using zonosQaUrlApi: ${window.Zonos.zonosQaUrlApi}`,"info");const l=null==c?void 0:c.includes("timestamp=");if(!(C.isNpm||c&&l))return void y("[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(d||!c||C.requested)return void p("[ZONOS - loadZonos] script is already loaded or requested","info");if(!o.zonosApiKey&&!C.cartId)return C.legacyCheckoutErrorHandler({message:"Zonos API key is required unless `tempCartUUID` is provided in url query params."}),void y("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(C.requested=!0,C.zonosApiKey=o.zonosApiKey,C.storeId=o.storeId,C.cartId){const o=await(async o=>{const{isDgsCartId:e,isLegacyCartId:n}=b(o);if(!n&&!e)return y("[ZONOS - loadZonos] invalid cart id"),null;const t=await I({cartId:o,retries:5});return p("[ZONOS - loadZonos] getting temp cart data","info",t),t?(window.Zonos.storeId=t.cartData.storeId,window.Zonos.zonosApiKey=t.cartData.credentialToken,{cartData:t.cartData,storeFavicon:t.storeFaviconUrl,storeId:t.cartData.storeId,storeLogo:t.storeLogoUrl,zonosApiKey:t.cartData.credentialToken}):(y("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)})(C.cartId);if(!o)throw C.legacyCheckoutErrorHandler({message:"Error getting cart data"}),new Error("Error getting cart data");C.cartData=o.cartData,C.legacyStoreLogo=o.storeLogo,C.legacyStoreFavicon=o.storeFavicon,C.storeId=o.storeId,C.zonosApiKey=o.zonosApiKey}if(!C.zonosApiKey)return void y('"zonosApiKey" is required to initialize Zonos');const u=await(async()=>{const o=n(),t=e();if(!o&&!t||!window.Zonos.zonosApiKey)return null;if(p("[ZONOS - loadZonos] Attempt test public credential","info"),window.Zonos.zonosApiKey.includes("credential_test"))return p("[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key","info"),null;const{errors:r,json:s}=await f("/api/get-test-public-credential");if(r.length||!s)return y("[ZONOS - loadZonos] Failed to get test public credential. Keep using production key",r),null;const i=s.publicCredential;return i?(p(`[ZONOS - loadZonos] Retrieve new test public token ${i}`,"info"),i):(y("[ZONOS - loadZonos] No test public key credential. Keep using production key"),null)})();if(u&&(p(`[ZONOS - loadZonos] Using test API key: ${u} for test mode`,"info"),C.zonosApiKey=u),!C.storeId)return p("[ZONOS - loadZonos] loading latest script since storeId is not provided."),void C.injectZonos({initConfig:o,vercelUrl:a,version:null});const m=C.storeId||o.storeId;p(`[ZONOS - loadZonos] Store ID: ${m}`,"info");const w=new URLSearchParams;w.set("storeId",m.toString()),window.location.search.includes("_enableStoreVersionPinned=1")&&w.set("_enableStoreVersionPinned","1");const{errors:g,json:h}=await f(`/api/get-store-version?${w.toString()}`);if(g.length||!h)return p("[ZONOS - loadZonos] Error getting store version, loading the latest version.","error"),void C.injectZonos({initConfig:o,vercelUrl:a,version:null});const{isDifferent:v,source:Z,version:S}=h;if(p(`[ZONOS - loadZonos] Store version: ${S}, source: ${Z}`,"info"),v){p(`[ZONOS - loadZonos] Updating saved store version to ${S}`,"info");const o={storeId:m,version:S};f(`/api/set-store-version?${w.toString()}`,{body:o,method:"POST"}).catch((o=>y("Unable to save store's vesrion",o)))}if(!d){const{currentLoadScriptUrl:e,isForceLoadVersionDomain:n,isWhiteListed:t}=(({loadScriptSrc:o})=>{if(!o)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const e=new URL(o).origin,n=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((o=>e.includes(o))),t=["qa.js.zonos.com"].some((o=>e.includes(o)));return{currentLoadScriptUrl:e,isForceLoadVersionDomain:t,isWhiteListed:n}})({loadScriptSrc:c}),r=t&&!n?e:`${"alpha"===S?"alpha":`v${S}`}.js.zonos.com`,s=t&&!n?null:S;p("[ZONOS - loadZonos] injecting zonos script","info",{currentLoadScriptUrl:e,isForceLoadVersionDomain:n,isWhiteListed:t,loadUrl:r,loadVersion:s,version:S}),C.injectZonos({initConfig:o,vercelUrl:r,version:s})}},(void 0===window.Zonos||window.isZonosPreview)&&(window.Zonos=k)})();
1
+ (function(){"use strict";function o(o,e){var n={};for(var t in o)Object.prototype.hasOwnProperty.call(o,t)&&e.indexOf(t)<0&&(n[t]=o[t]);if(null!=o&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(t=Object.getOwnPropertySymbols(o);r<t.length;r++)e.indexOf(t[r])<0&&Object.prototype.propertyIsEnumerable.call(o,t[r])&&(n[t[r]]=o[t[r]])}return n}"function"==typeof SuppressedError&&SuppressedError;const e=()=>window.location.search.includes("zonosStagingMode=1"),n=()=>{var o;return(null===(o=window.Zonos.zonosApiKey)||void 0===o?void 0:o.includes("test"))||window.location.search.includes("zonosTestMode=1")},t=["cloudflare","vercel"],r=t[0],s={cloudflare:"https://route.elements.zonos.com",vercel:"https://route.js.zonos.com"},i=s[r],a=(o=r)=>{const e=t.indexOf(o),n=t[e+1];return n||null},d=o=>{if("string"==typeof o)try{return JSON.parse(o)}catch(o){return null}return null},c=performance.now(),l=o=>{if("string"==typeof o)return o;try{return JSON.stringify(o)}catch(e){if(o&&"function"==typeof o.toString){return o.toString()}return"Unable to stringify info"}},p=(o,e,...n)=>{var t,r;const{elapsedTimePretty:s}=(()=>{const o=performance.now()-c,e=o>1e3?`${(o/1e3).toFixed(2)}s`:`${o.toFixed(2)}ms`;return{elapsedTime:o,elapsedTimePretty:e}})(),i=[`(${s})`,...n];i.map(l).join(" ");if(!(!!(null===(t=window.Zonos)||void 0===t?void 0:t.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===e&&console.error(o,...i));let a=document.querySelector("iframe#zonos---debug-logging-iframe");a||(a=document.createElement("iframe"),a.id="zonos---debug-logging-iframe",a.style.display="none",a.style.opacity="0",a.style.position="absolute",a.style.top="-9999px",a.style.left="-9999px",a.style.width="1px",a.style.height="1px",a.style.border="none",a.style.overflow="hidden",a.style.visibility="hidden",document.body.appendChild(a));const d=(null===(r=a.contentWindow)||void 0===r?void 0:r.window.console)||window.console;switch(e){case"warn":d.warn(o,...i);break;case"info":d.info(o,...i);break;case"error":d.error(o,...i);break;default:d.groupCollapsed(o,...i),d.trace(),d.groupEnd()}},u=async({endpoint:o,errors:e,metadata:n,shouldPostReleaseErrorReporting:t})=>{if(p("sendErrorLog","warn",o,n,e),t){const o=Number(window.Zonos.releaseDate);if((new Date).getTime()-o>36e5)return}const r="userAgentData"in window.navigator?window.navigator.userAgentData:null,d={endpoint:o,errors:e,href:window.location.href,metadata:Object.assign({appVersion:window.Zonos.version,domain:window.Zonos.domain,publicCredential:window.Zonos.zonosApiKey,userAgent:r&&r.brands.length>0?r:window.navigator.userAgent},n)};try{fetch(`${i}/api/zonos-elements/log-error`,{body:JSON.stringify(d),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(o){const e=a();if(!e)return;fetch(`${s[e]}/api/zonos-elements/log-error`,{body:JSON.stringify(d),method:"POST"})}},m=async({response:o,shouldLog:e=!0,shouldThrow:n=!1})=>{try{const e=await o.text(),n=d(e);if(!n)throw new Error(`Failed to parse content: ${e}`);return n}catch(o){if(n)throw o;return e&&console.error(o),null}},w=async({basePathType:o,options:e,path:n})=>{let t;const i=window.Zonos.zonosQaUrlApi||s[o]||r,a=new URL(i+n),d=window.Zonos.cartId?`${window.location.hostname}-${window.Zonos.cartId}`:window.location.hostname;a.searchParams.set("zToken",(o=>{try{return btoa(o).replace(/=/g,"")}catch(e){return o.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(d));try{t=await fetch(a.toString(),e)}catch(o){if(o instanceof Error)return{baseUrl:i,errors:[{message:o.message,type:"unknown"}],json:null,response:null,zonosMode:null};return{baseUrl:i,errors:[{message:"Failed to fetch",type:"unknown"}],json:null,response:null,zonosMode:null}}const c=t.headers.get("Zonos-Mode"),l=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&c&&l&&(window.Zonos.modeAlerted=!0),t.ok){return{baseUrl:i,errors:[],json:await m({response:t}),response:t,zonosMode:c}}const p=t.status.toString();try{const o=await m({response:t,shouldThrow:!0});if(o&&"errors"in o&&Array.isArray(o.errors)){const e=o.errors;return{baseUrl:i,errors:e.map((o=>"string"==typeof o?{message:o,type:p}:o)),json:null,response:t,zonosMode:c}}return{baseUrl:i,errors:[{message:JSON.stringify(o),type:p}],json:null,response:t,zonosMode:c}}catch(o){return{baseUrl:i,errors:[{message:`${p}: ${"Unknown error"}`,type:p}],json:null,response:null,zonosMode:c}}},g=async({basePathType:e,options:n,path:t})=>{var r,i;const c=t.startsWith("/api/bigcommerce")?"vercel":e,l=await w({basePathType:c,options:n,path:t}),{errors:m,response:f}=l,y=o(l,["errors","response"]),h=a(c),v=!!m.find((({type:o})=>"unknown"===o))||404===(null==f?void 0:f.status),Z=h&&v;return v&&u({endpoint:s[c]+t,errors:m.map((({message:o})=>`API: ${o}`)),metadata:{currentBasePath:c,nextFallbackApiType:h,requestHeaders:null==n?void 0:n.headers,requestPayload:d(null===(r=null==n?void 0:n.body)||void 0===r?void 0:r.toString())||(null===(i=null==n?void 0:n.body)||void 0===i?void 0:i.toString()),status:null==f?void 0:f.status,statusText:null==f?void 0:f.statusText},shouldPostReleaseErrorReporting:!0}),Z?(p(`=== "${t}" failed to fetch, trying next fallback ${h}`),g({basePathType:h,options:n,path:t})):Object.assign({errors:m,response:f},y)},f=async(t,s)=>{const i=o(s||{},[]),a=i.body?JSON.stringify(i.body):void 0,d=i.method||"GET",c=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Staging-Mode":e()?"1":void 0,"Zonos-Test-Mode":n()?"1":void 0,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},i.headers);Object.keys(c).forEach((o=>void 0===c[o]&&delete c[o]));const l=Object.assign(Object.assign({},i),{body:"GET"===d?void 0:a,headers:c,method:d}),u=new URLSearchParams(window.location.search).get("useFallbackApi");return p(t,"info"),g({basePathType:u||r,options:l,path:t})},y=(o,...e)=>{p(o,"error",...e)},h=["jsdelivr","cdnjs","unpkg","vercel"],v=o=>{if(!o)return null;const e=new URL(o).searchParams.get("zonosQaUrl");if(!e)return null;return/[^a-zA-Z0-9-_]+/.test(e)?null:e},Z=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/,S=new RegExp(`^${Z.source}$`),z=new RegExp(`^cart_${Z.source}$`),O=/^[a-zA-Z0-9]{2,}$/,L=/^cart_[a-zA-Z0-9]{2,}$/,b=o=>o?o.includes("undefined")?{isDgsCartId:!1,isLegacyCartId:!1}:L.test(o)?{isDgsCartId:!0,isLegacyCartId:!1}:O.test(o)?{isDgsCartId:!1,isLegacyCartId:!0}:z.test(o)?{isDgsCartId:!0,isLegacyCartId:!1}:S.test(o)?{isDgsCartId:!1,isLegacyCartId:!0}:{isDgsCartId:!1,isLegacyCartId:!1}:{isDgsCartId:!1,isLegacyCartId:!1},I=async({cartId:o,retries:e})=>{const t=n(),{errors:r,json:s}=await f("/api/zonos-elements/get-temp-cart",{body:{isTestMode:t,options:{noOnlineStoreSettings:!0},tempCartUUID:o},headers:{"Content-Type":"application/json"},method:"POST"}),i=!s||r.length;return i&&e?(p("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:e}),await new Promise((o=>setTimeout(o,500))),I({cartId:o,retries:e-1})):i?null:s};var C;const U=(()=>{const o=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||o)return null;const e=v(window.location.href),n="https://v1.3.160.js.zonos.com";if(!e&&(n.includes("test.")||n.includes("test-")))return n;if(!e&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!e)return null;if("dev-elements"===e)return"https://dev.elements.zonos.com";const t=`https://${e}.preview.js.zonos.com`;return p(`[ZONOS-WARNING] using '${t}' for loading elements script`,"warn"),fetch(t).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${t}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const o=new URLSearchParams(window.location.search);o.delete("zonosQaUrl");const{pathname:e}=window.location,n=`${e}?${o.toString()}`;return window.history.replaceState(window.history.state,"",n),window.location.reload(),null})),t})(),j=(()=>{const o=(o=>{if(!o)return null;const e=new URL(o).searchParams.get("zonosQaUrlApi");return e?/[^a-zA-Z0-9-_]+/.test(e)?null:e:null})(window.location.href),e=v(window.location.href),n=o||e;if(!n&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.demo.elements.zonos.com";if(!n)return null;if("dev-elements"===n)return"https://dev.demo.elements.zonos.com";if(!o)return null;const t=`https://${o}.route.js.zonos.com`;return p(`[ZONOS-WARNING] using '${t}' for serverless API`,"warn"),t})();class k{}C=k,k.isNpm=!1,k.isBigCommerce=!1,k.requested=!1,k.cartData=null,k.domain=window.location!=window.parent.location?document.referrer:document.location.hostname,k.version="v1.3.160",k.isLegacyCheckout=!1,k.legacyStoreLogo=null,k.legacyStoreFavicon=null,k.parallelLoadTimes=[],k.parallelLoadState="off",k.releaseDate="1739466306623",k.loadScriptLogHandler=async({cdnLoadTime:o,fallbackLoadTime:e,isError:n,metadata:t,scriptLoadUrl:r,storeId:s,type:i})=>{try{const o=window.performance.getEntriesByType("resource").find((o=>{const e=o;return e.name.includes(r)&&"script"===e.initiatorType}));null==o||o.transferSize;(async o=>{})((o&&(null==o?void 0:o.duration)>0?parseFloat(o.duration.toFixed(2)):parseFloat(e.toFixed(2)),Object.assign({decodedBodySize:null==o?void 0:o.decodedBodySize,encodedBodySize:null==o?void 0:o.encodedBodySize,fallbackLoadTime:e,isError:!!n},t)))}catch(o){}},k.loadScriptLogParallelHandler=async o=>{try{if(C.parallelLoadTimes.push(o),2===C.parallelLoadTimes.length){const o=C.parallelLoadTimes.find((o=>"vercel"===o.type)),e=C.parallelLoadTimes.find((o=>"jsdelivr"===o.type));if(!o||!e)return;if(o.isError&&e.isError)return void u({endpoint:`<${o.scriptLoadUrl}> <${e.scriptLoadUrl}>`,errors:["Failed to fetch both Vercel and jsdelivr CDN. Perhaps network issue on customer site."],metadata:{cdnLoadTime:e.fallbackLoadTime,cdnType:e.type,vercelLoadTime:o.fallbackLoadTime}});C.loadScriptLogHandler({cdnLoadTime:e.fallbackLoadTime,fallbackLoadTime:o.fallbackLoadTime,isError:o.isError,metadata:{cdnScriptFallbackTime:e.fallbackLoadTime,cdnScriptIsError:!!e.isError,cdnScriptLoadUrl:e.scriptLoadUrl,cdnScriptType:e.type},scriptLoadUrl:o.scriptLoadUrl,storeId:o.storeId,type:o.type})}}catch(o){}},k.legacyCheckoutErrorHandler=({message:o,metadata:e})=>{y(`[ZONOS - loadZonos] ${o}`),u({endpoint:"LegacyCheckoutInit",errors:[o],metadata:Object.assign(Object.assign({},e),{tempCartUUID:C.cartId})}),document.dispatchEvent(new CustomEvent("legacyCheckoutError",{detail:o}))},k.getGithubCdn=({type:o,version:e})=>{let n="https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.160";"cdnjs"===o?n="https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.160":"unpkg"===o&&(n="https://unpkg.com/@zonos/elements@1.3.160");return e&&"alpha"!==e?n.replace(/@zonos\/elements@(.+)/,`@zonos/elements@${e}`).replace(/\/zonos-elements\/(.+)/,`/zonos-elements/${e}`):n},k.injectZonos=({cdnType:o="jsdelivr",initConfig:e,parallelLoaded:n,vercelUrl:t,version:r})=>{var s;e=Object.assign(Object.assign({},e),{zonosApiKey:C.zonosApiKey}),r&&(window.Zonos.version=`v${r}`);const i="vercel"===o?t:C.getGithubCdn({type:o,version:r}),a=U||i,d=a.replace("https://","").replace("http://",""),c=document.createElement("script"),l=r&&r<"1.2.5"?"loadZonos.js":"zonos.js";c.src=`https://${d}/dist/scripts/${l}?timestamp=${Date.now()}`,p(`[ZONOS - loadZonos] Injecting "${l}" from "${d}"`,"info");const m="4g"===(null===(s=(()=>{const o="connection"in window.navigator?window.navigator.connection:null,e="mozConnection"in window.navigator?window.navigator.mozConnection:null,n="webkitConnection"in window.navigator?window.navigator.webkitConnection:null;return o||e||n})())||void 0===s?void 0:s.effectiveType),w=["dev.elements.zonos.com","zonos.com"].some((o=>window.location.href.includes(o))),g=h[0]===o,f=h[1],y="on"===C.parallelLoadState&&m&&g&&f&&!w;y&&C.injectZonos({cdnType:f,initConfig:e,parallelLoaded:!0,vercelUrl:t,version:r});const v=performance.now();c.addEventListener("load",(()=>{if(y||n?C.loadScriptLogParallelHandler({fallbackLoadTime:performance.now()-v,scriptLoadUrl:c.src,storeId:C.storeId,type:o}):C.loadScriptLogHandler({fallbackLoadTime:performance.now()-v,scriptLoadUrl:c.src,storeId:C.storeId,type:o}),C.isBigCommerce||(C.isBigCommerce=!!window.stencilBootstrap||!!window.bcConfig||!!document.querySelector('script[src*="bigcommerce.com"]')),window.Zonos.isNpm=!1,window.Zonos.zonosQaUrl=U,window.Zonos.zonosQaUrlApi=j,window.Zonos.isBigCommerce=C.isBigCommerce,C.cartId){if(!C.zonosApiKey)throw C.legacyCheckoutErrorHandler({message:"zonosApiKey is missing to initiate checkout"}),new Error("zonosApiKey is required for legacy checkout");if(!C.cartData)throw C.legacyCheckoutErrorHandler({message:"cartData is missing to initiate legacy checkout"}),new Error("cartData is required for legacy checkout");if(C.legacyStoreFavicon&&C.isLegacyCheckout){const o=document.createElement("link");o.rel="shortcut icon",o.type="image/x-icon",o.href=C.legacyStoreFavicon,document.head.appendChild(o)}window.Zonos.cartData=C.cartData,window.Zonos.isLegacyCheckout=C.isLegacyCheckout;const o=Object.assign(Object.assign({},e),{appearance:Object.assign(Object.assign({},e.appearance),{logoUrl:C.legacyStoreLogo||""}),zonosApiKey:C.zonosApiKey});e=o}window.Zonos.version&&(p(`[ZONOS - loadZonos] Execute "Zonos.init" from "${l}" from "${d}"`,"info"),window.Zonos.init(e))})),c.addEventListener("error",(async()=>{const s=(o=>{const e=h.indexOf(o);return h[e+1]||null})(o);if(!y&&!n){if(!s)return;C.injectZonos({cdnType:s,initConfig:e,vercelUrl:t,version:r})}if(["localhost",".zonos.com"].some((o=>window.location.href.includes(o)))||U)return;if(y||n)return void C.loadScriptLogParallelHandler({fallbackLoadTime:performance.now()-v,isError:!0,scriptLoadUrl:c.src,storeId:C.storeId,type:o});["unpkg","cdnjs","vercel"].includes(o)?u({endpoint:c.src,errors:[`zonos.js - Failed to fetch ${o} CDN.`],metadata:{cdnLoadTime:performance.now()-v,cdnType:o,loadUrl:a,version:r},shouldPostReleaseErrorReporting:!!s}):u({endpoint:c.src,errors:["[Info] Using alternative CDN. Failed to fetch script"],metadata:{cdnType:o,vercelLoadTime:performance.now()-v}})})),document.head.appendChild(c)},k.init=async o=>{var t;if(p("=== Init zonos script release date","info",C.releaseDate),U&&!window.isZonosPreview){p(`[ZONOS - loadZonos] Re-inject "loadZonos.js" from zonosQaUrl: ${U}`,"info");const e=document.createElement("script");return e.src=`${U}/dist/scripts/loadZonos.js?timestamp=${Date.now()}`,document.head.appendChild(e),e.addEventListener("load",(()=>{window.Zonos.isNpm=!1,window.Zonos.isBigCommerce=C.isBigCommerce,window.Zonos.isLegacyCheckout=C.isLegacyCheckout,window.Zonos.init(o)})),e.addEventListener("error",(()=>{alert(`[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: ${U}`)})),void(window.isZonosPreview=!0)}const r=new URLSearchParams(window.location.search).get("tempCartUUID"),{isDgsCartId:s,isLegacyCartId:i}=b(r);if(r&&!i&&!s)return void C.legacyCheckoutErrorHandler({message:`[ZONOS - loadZonos] invalid &tempCartUUID=${r}`,metadata:{invalidCartId:!0}});C.cartId=r;const a="https://v1.3.160.js.zonos.com",d=document.querySelector('script[src*="/zonos.js"]'),c=null===(t=document.querySelector("script[src*='/loadZonos.js']"))||void 0===t?void 0:t.src;p(`[ZONOS - init] first load script src: ${c}`,"info"),window.Zonos.zonosQaUrl=U,window.Zonos.zonosQaUrlApi=j,window.Zonos.zonosQaUrl&&p(`[ZONOS - init] using zonosQaUrl: ${window.Zonos.zonosQaUrl}`,"info"),window.Zonos.zonosQaUrlApi&&p(`[ZONOS - init] using zonosQaUrlApi: ${window.Zonos.zonosQaUrlApi}`,"info");const l=null==c?void 0:c.includes("timestamp=");if(!(C.isNpm||c&&l))return void y("[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(d||!c||C.requested)return void p("[ZONOS - loadZonos] script is already loaded or requested","info");if(!o.zonosApiKey&&!C.cartId)return C.legacyCheckoutErrorHandler({message:"Zonos API key is required unless `tempCartUUID` is provided in url query params."}),void y("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(C.requested=!0,C.zonosApiKey=o.zonosApiKey,C.storeId=o.storeId,C.cartId){const o=await(async o=>{const{isDgsCartId:e,isLegacyCartId:n}=b(o);if(!n&&!e)return y("[ZONOS - loadZonos] invalid cart id"),null;const t=await I({cartId:o,retries:5});return p("[ZONOS - loadZonos] getting temp cart data","info",t),t?(window.Zonos.storeId=t.cartData.storeId,window.Zonos.zonosApiKey=t.cartData.credentialToken,{cartData:t.cartData,storeFavicon:t.storeFaviconUrl,storeId:t.cartData.storeId,storeLogo:t.storeLogoUrl,zonosApiKey:t.cartData.credentialToken}):(y("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)})(C.cartId);if(!o)throw C.legacyCheckoutErrorHandler({message:"Error getting cart data"}),new Error("Error getting cart data");C.cartData=o.cartData,C.legacyStoreLogo=o.storeLogo,C.legacyStoreFavicon=o.storeFavicon,C.storeId=o.storeId,C.zonosApiKey=o.zonosApiKey}if(!C.zonosApiKey)return void y('"zonosApiKey" is required to initialize Zonos');const u=await(async()=>{const o=n(),t=e();if(!o&&!t||!window.Zonos.zonosApiKey)return null;if(p("[ZONOS - loadZonos] Attempt test public credential","info"),window.Zonos.zonosApiKey.includes("credential_test"))return p("[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key","info"),null;const{errors:r,json:s}=await f("/api/get-test-public-credential");if(r.length||!s)return y("[ZONOS - loadZonos] Failed to get test public credential. Keep using production key",r),null;const i=s.publicCredential;return i?(p(`[ZONOS - loadZonos] Retrieve new test public token ${i}`,"info"),i):(y("[ZONOS - loadZonos] No test public key credential. Keep using production key"),null)})();if(u&&(p(`[ZONOS - loadZonos] Using test API key: ${u} for test mode`,"info"),C.zonosApiKey=u),!C.storeId)return p("[ZONOS - loadZonos] loading latest script since storeId is not provided."),void C.injectZonos({initConfig:o,vercelUrl:a,version:null});const m=C.storeId||o.storeId;p(`[ZONOS - loadZonos] Store ID: ${m}`,"info");const w=new URLSearchParams;w.set("storeId",m.toString()),window.location.search.includes("_enableStoreVersionPinned=1")&&w.set("_enableStoreVersionPinned","1");const{errors:g,json:h}=await f(`/api/get-store-version?${w.toString()}`);if(g.length||!h)return p("[ZONOS - loadZonos] Error getting store version, loading the latest version.","error"),void C.injectZonos({initConfig:o,vercelUrl:a,version:null});const{isDifferent:v,source:Z,version:S}=h;if(p(`[ZONOS - loadZonos] Store version: ${S}, source: ${Z}`,"info"),v){p(`[ZONOS - loadZonos] Updating saved store version to ${S}`,"info");const o={storeId:m,version:S};f(`/api/set-store-version?${w.toString()}`,{body:o,method:"POST"}).catch((o=>y("Unable to save store's vesrion",o)))}if(!d){const{currentLoadScriptUrl:e,isForceLoadVersionDomain:n,isWhiteListed:t}=(({loadScriptSrc:o})=>{if(!o)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const e=new URL(o).origin,n=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((o=>e.includes(o))),t=["qa.js.zonos.com"].some((o=>e.includes(o)));return{currentLoadScriptUrl:e,isForceLoadVersionDomain:t,isWhiteListed:n}})({loadScriptSrc:c}),r=t&&!n?e:`${"alpha"===S?"alpha":`v${S}`}.js.zonos.com`,s=t&&!n?null:S;p("[ZONOS - loadZonos] injecting zonos script","info",{currentLoadScriptUrl:e,isForceLoadVersionDomain:n,isWhiteListed:t,loadUrl:r,loadVersion:s,version:S}),C.injectZonos({initConfig:o,vercelUrl:r,version:s})}},(void 0===window.Zonos||window.isZonosPreview)&&(window.Zonos=k)})();
@@ -1 +1 @@
1
- (function(){"use strict";const e=performance.now(),o=e=>{if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(o){if(e&&"function"==typeof e.toString){return e.toString()}return"Unable to stringify info"}},t=(t,n,...r)=>{var s,i;const{elapsedTimePretty:a}=(()=>{const o=performance.now()-e,t=o>1e3?`${(o/1e3).toFixed(2)}s`:`${o.toFixed(2)}ms`;return{elapsedTime:o,elapsedTimePretty:t}})(),c=[`(${a})`,...r];c.map(o).join(" ");if(!(!!(null===(s=window.Zonos)||void 0===s?void 0:s.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===n&&console.error(t,...c));let l=document.querySelector("iframe#zonos---debug-logging-iframe");l||(l=document.createElement("iframe"),l.id="zonos---debug-logging-iframe",l.style.display="none",l.style.opacity="0",l.style.position="absolute",l.style.top="-9999px",l.style.left="-9999px",l.style.width="1px",l.style.height="1px",l.style.border="none",l.style.overflow="hidden",l.style.visibility="hidden",document.body.appendChild(l));const d=(null===(i=l.contentWindow)||void 0===i?void 0:i.window.console)||window.console;switch(n){case"warn":d.warn(t,...c);break;case"info":d.info(t,...c);break;case"error":d.error(t,...c);break;default:d.groupCollapsed(t,...c),d.trace(),d.groupEnd()}},n=(e,...o)=>{t(e,"error",...o)},r=["jsdelivr","cdnjs","unpkg","vercel"],s="jsdelivr",i=e=>{const o=r.indexOf(e);return r[o+1]||null},a=()=>window.location.search.includes("zonosStagingMode=1"),c=()=>{var e;return(null===(e=window.Zonos.zonosApiKey)||void 0===e?void 0:e.includes("test"))||window.location.search.includes("zonosTestMode=1")};function l(e,o){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&o.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)o.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(t[n[r]]=e[n[r]])}return t}"function"==typeof SuppressedError&&SuppressedError;const d=["cloudflare","vercel"],u=d[0],p={cloudflare:"https://route.elements.zonos.com",vercel:"https://route.js.zonos.com"},m=p[u],w=(e=u)=>{const o=d.indexOf(e),t=d[o+1];return t||null},h=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},y=async({response:e,shouldLog:o=!0,shouldThrow:t=!1})=>{try{const o=await e.text(),t=h(o);if(!t)throw new Error(`Failed to parse content: ${o}`);return t}catch(e){if(t)throw e;return o&&console.error(e),null}},g=async({basePathType:e,options:o,path:t})=>{let n;const r=window.Zonos.zonosQaUrlApi||p[e]||u,s=new URL(r+t),i=window.Zonos.cartId?`${window.location.hostname}-${window.Zonos.cartId}`:window.location.hostname;s.searchParams.set("zToken",(e=>{try{return btoa(e).replace(/=/g,"")}catch(o){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(i));try{n=await fetch(s.toString(),o)}catch(e){if(e instanceof Error)return{baseUrl:r,errors:[{message:e.message,type:"unknown"}],json:null,response:null,zonosMode:null};return{baseUrl:r,errors:[{message:"Failed to fetch",type:"unknown"}],json:null,response:null,zonosMode:null}}const a=n.headers.get("Zonos-Mode"),c=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&a&&c&&(window.Zonos.modeAlerted=!0),n.ok){return{baseUrl:r,errors:[],json:await y({response:n}),response:n,zonosMode:a}}const l=n.status.toString();try{const e=await y({response:n,shouldThrow:!0});if(e&&"errors"in e&&Array.isArray(e.errors)){const o=e.errors;return{baseUrl:r,errors:o.map((e=>"string"==typeof e?{message:e,type:l}:e)),json:null,response:n,zonosMode:a}}return{baseUrl:r,errors:[{message:JSON.stringify(e),type:l}],json:null,response:n,zonosMode:a}}catch(e){return{baseUrl:r,errors:[{message:`${l}: ${"Unknown error"}`,type:l}],json:null,response:null,zonosMode:a}}},f=async({basePathType:e,options:o,path:n})=>{var r,s;const i=n.startsWith("/api/bigcommerce")?"vercel":e,a=await g({basePathType:i,options:o,path:n}),{errors:c,response:d}=a,u=l(a,["errors","response"]),y=w(i),v=!!c.find((({type:e})=>"unknown"===e))||404===(null==d?void 0:d.status),S=y&&v;return v&&(async({endpoint:e,errors:o,metadata:n,shouldPostReleaseErrorReporting:r})=>{if(t("sendErrorLog","warn",e,n,o),r){const e=Number(window.Zonos.releaseDate);if((new Date).getTime()-e>36e5)return}const s="userAgentData"in window.navigator?window.navigator.userAgentData:null,i={endpoint:e,errors:o,href:window.location.href,metadata:Object.assign({appVersion:window.Zonos.version,domain:window.Zonos.domain,publicCredential:window.Zonos.zonosApiKey,userAgent:s&&s.brands.length>0?s:window.navigator.userAgent},n)};try{fetch(`${m}/api/zonos-elements/log-error`,{body:JSON.stringify(i),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const o=w();if(!o)return;fetch(`${p[o]}/api/zonos-elements/log-error`,{body:JSON.stringify(i),method:"POST"})}})({endpoint:p[i]+n,errors:c.map((({message:e})=>`API: ${e}`)),metadata:{currentBasePath:i,nextFallbackApiType:y,requestHeaders:null==o?void 0:o.headers,requestPayload:h(null===(r=null==o?void 0:o.body)||void 0===r?void 0:r.toString())||(null===(s=null==o?void 0:o.body)||void 0===s?void 0:s.toString()),status:null==d?void 0:d.status,statusText:null==d?void 0:d.statusText},shouldPostReleaseErrorReporting:!0}),S?(t(`=== "${n}" failed to fetch, trying next fallback ${y}`),f({basePathType:y,options:o,path:n})):Object.assign({errors:c,response:d},u)},v=async(e,o)=>{const n=l(o||{},[]),r=n.body?JSON.stringify(n.body):void 0,s=n.method||"GET",i=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Staging-Mode":a()?"1":void 0,"Zonos-Test-Mode":c()?"1":void 0,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},n.headers);Object.keys(i).forEach((e=>void 0===i[e]&&delete i[e]));const d=Object.assign(Object.assign({},n),{body:"GET"===s?void 0:r,headers:i,method:s}),p=new URLSearchParams(window.location.search).get("useFallbackApi");return t(e,"info"),f({basePathType:p||u,options:d,path:e})},S=()=>{const e=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||e)return null;const o=(e=>{if(!e)return null;const o=new URL(e).searchParams.get("zonosQaUrl");return o?/[^a-zA-Z0-9-_]+/.test(o)?null:o:null})(window.location.href),n="https://v1.3.158.js.zonos.com";if(!o&&(n.includes("test.")||n.includes("test-")))return n;if(!o&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!o)return null;if("dev-elements"===o)return"https://dev.elements.zonos.com";const r=`https://${o}.preview.js.zonos.com`;return t(`[ZONOS-WARNING] using '${r}' for loading elements script`,"warn"),fetch(r).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${r}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:o}=window.location,t=`${o}?${e.toString()}`;return window.history.replaceState(window.history.state,"",t),window.location.reload(),null})),r},b="https://js.stripe.com/v3",z=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,C="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let Z=null;const j=e=>(null!==Z||(Z=new Promise(((o,t)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(C),window.Stripe)o(window.Stripe);else try{let r=(()=>{const e=document.querySelectorAll(`script[src^="${b}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&z.test(t.src))return t}return null})();r&&e?console.warn(C):r||(r=(e=>{const o=document.createElement("script");o.src=`${b}`;const t=document.head||document.body;return t?(t.appendChild(o),o):(n("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==r||r.addEventListener("load",(()=>{window.Stripe?o(window.Stripe):t(new Error("Stripe.js not available"))})),null==r||r.addEventListener("error",(()=>{t(new Error("Failed to load Stripe.js"))}))}catch(e){return void t(e)}else o(null)}))),Z),O=Promise.resolve().then((()=>j(null)));let k=!1;O.catch((e=>{k||console.warn(e)}));const I=async({cartId:e,retries:o})=>{const n=c(),{errors:r,json:s}=await v("/api/zonos-elements/get-temp-cart",{body:{isTestMode:n,options:{noOnlineStoreSettings:!0},tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"}),i=!s||r.length;return i&&o?(t("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:o}),await new Promise((e=>setTimeout(e,500))),I({cartId:e,retries:o-1})):i?null:s},E=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/,A=new RegExp(`^${E.source}$`),L=new RegExp(`^cart_${E.source}$`),$=/^[a-zA-Z0-9]{2,}$/,T=/^cart_[a-zA-Z0-9]{2,}$/,N=async e=>{const{isDgsCartId:o,isLegacyCartId:r}=(e=>e?e.includes("undefined")?{isDgsCartId:!1,isLegacyCartId:!1}:T.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:$.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:L.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:A.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:{isDgsCartId:!1,isLegacyCartId:!1}:{isDgsCartId:!1,isLegacyCartId:!1})(e);if(!r&&!o)return n("[ZONOS - loadZonos] invalid cart id"),null;const s=await I({cartId:e,retries:5});return t("[ZONOS - loadZonos] getting temp cart data","info",s),s?(window.Zonos.storeId=s.cartData.storeId,window.Zonos.zonosApiKey=s.cartData.credentialToken,{cartData:s.cartData,storeFavicon:s.storeFaviconUrl,storeId:s.cartData.storeId,storeLogo:s.storeLogoUrl,zonosApiKey:s.cartData.credentialToken}):(n("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)};var U;const D=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:o,isWhiteListed:t}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const o=new URL(e).origin,t=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>o.includes(e))),n=["qa.js.zonos.com"].some((e=>o.includes(e)));return{currentLoadScriptUrl:o,isForceLoadVersionDomain:n,isWhiteListed:t}})({loadScriptSrc:null==e?void 0:e.src});return t?o:null})(),P="https://v1.3.158.js.zonos.com",F=D||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.158",R="https://fonts.googleapis.com",x=/^https:\/\/fonts\.googleapis\.com/;class M{}U=M,M.doneInit=!1,M.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),M.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),M._paypalMockResponse=null,M.isBigCommerce=!1,M.releaseDate="1739220577125",M.isLegacyCheckout=!1,M.domain="undefined"!=typeof window?window.location!=window.parent.location&&document.referrer||document.location.hostname:"",M.showBaseForeign="undefined"!=typeof window&&window.location.search.includes("zonosShowBaseForeign"),M.isNpm=!0,M.zonosQaUrl=null,M.zonosQaUrlApi=null,M.version="v1.3.158",M.modeAlerted=!1,M.cartData=null,M.paypal=null,M.getCurrentTimestamp=()=>(new Date).getTime(),M.zonosController=null,M.init=async e=>{const{appearance:o,checkoutSettings:r,currencyConverter:s,helloSettings:i,onCountryChange:l,overrideCurrencyFormat:d,storeId:u,zonosApiKey:p}=e;if(U.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),U.doneInit)return;if(t(`====== ZONOS DEBUG MODE: on (${U.version}) ======`),U.zonosApiKey=p,U.storeId=u,U.isNpm){t("====== ZONOS LOADING FROM NPM ======");const o=S();if(o&&!window.isZonosPreview){t(`====== RE-INJECT "zonos.js" FROM PRVIEW: ${o} ======`,"info");const n=document.createElement("script");return n.src=`${o}/dist/scripts/zonos.js`,document.head.appendChild(n),n.addEventListener("load",(()=>{window.Zonos.isNpm=U.isNpm,window.Zonos.isBigCommerce=U.isBigCommerce,window.Zonos.isLegacyCheckout=U.isLegacyCheckout,window.Zonos.init(e)})),n.addEventListener("error",(()=>{alert(`[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: ${o}`)})),void(window.isZonosPreview=!0)}if(!p&&!U.cartId)return void n("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!U.cartData&&U.cartId){t("Initialize cart data");const e=await N(U.cartId);if(!e)return void n("Failed to get cart data");U.cartData=e.cartData,U.zonosApiKey=e.zonosApiKey}const r=await(async()=>{const e=c(),o=a();if(!e&&!o||!window.Zonos.zonosApiKey)return null;if(t("[ZONOS - loadZonos] Attempt test public credential","info"),window.Zonos.zonosApiKey.includes("credential_test"))return t("[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key","info"),null;const{errors:r,json:s}=await v("/api/get-test-public-credential");if(r.length||!s)return n("[ZONOS - loadZonos] Failed to get test public credential. Keep using production key",r),null;const i=s.publicCredential;return i?(t(`[ZONOS - loadZonos] Retrieve new test public token ${i}`,"info"),i):(n("[ZONOS - loadZonos] No test public key credential. Keep using production key"),null)})();r&&(U.zonosApiKey=r)}const m=new URL(window.location.href).searchParams.get("payment_intent_client_secret")||sessionStorage.getItem("zonos--client-secret");if(U.cartId&&U.cartData||!!m){t("Cart data or stripe client secret is available, inject hidden button and trigger checkout");const e=document.createElement("button");e.style.display="none",e.id="zonos--checkout-hidden-button",document.body.appendChild(e)}t("init zonos"),U.injectCustomScriptForHostedCheckout(),U.injectZonosCdn(),U.injectZonosCss(),U.injectFonts(),U.injectController({config:{appearance:o,checkoutSettings:r,currencyConverter:s,helloSettings:i,onCountryChange:l,overrideCurrencyFormat:d}}),U.doneInit=!0},M.injectCustomScriptForHostedCheckout=()=>{const e=U.cartData,o=(null==e?void 0:e.metadata)||[],n=o.find((e=>"customHeaderScript"===e.key)),r=o.find((e=>"customFooterScript"===e.key));if(window.Zonos.isLegacyCheckout&&(n||r)){if(n){t("Injecting custom header script");const e=document.createElement("script");e.textContent=n.value,document.head.appendChild(e)}if(r){t("Injecting custom footer script");const e=document.createElement("script");e.textContent=r.value,document.body.appendChild(e)}}else t("Skip injecting custom script for hosted checkout","info",{footerScript:r,headerScript:n,isLegacyCheckout:window.Zonos.isLegacyCheckout})},M.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},M.openHelloDialog=e=>{const o=document.querySelector("zonos-hello");o&&o.openHelloDialog(null==e||e)},M.showNotification=e=>{var o;null===(o=U.zonosController)||void 0===o||o.showNotification(e)},M.updateOrganizationName=e=>{var o;null===(o=U.zonosController)||void 0===o||o.updateOrganizationName(e)},M.disablePlaceOrderButtons=({autoEnable:e=!0,config:o,disable:t,placeOrderButtonSelector:n})=>{var r;if(!(null===(r=o.checkoutSettings)||void 0===r?void 0:r.disablePlaceOrderButtonActivation)&&n){const o=document.querySelectorAll(n),r=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};o.forEach((e=>{e.getAttribute("data-zonos-checkout-attached")||(t?(e.setAttribute("disabled","true"),e.addEventListener("click",r)):(e.removeAttribute("disabled"),e.removeEventListener("click",r)))})),e&&t&&setTimeout((()=>{o.forEach((e=>{e.removeAttribute("disabled"),e.removeEventListener("click",r)}))}),5e3)}},M.injectController=({config:e})=>{var o;if(document.querySelector("zonos-controller"))return;if(null===(o=e.checkoutSettings)||void 0===o?void 0:o.placeOrderButtonSelector){const o=e.checkoutSettings.placeOrderButtonSelector;U.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o});new MutationObserver((()=>{U.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o})})).observe(document.body,{childList:!0,subtree:!0})}const r=document.createElement("zonos-controller");r.config=e,r.zonosApiKey=U.zonosApiKey||"",r.addEventListener("stripeInitEvent",(async e=>{const{detail:o}=e;t("loading Stripe");const s=await(async(...e)=>{k=!0;const o=Date.now();return O.then((t=>((e,o,t)=>{if(null===e)return null;const n=e.apply(void 0,o);return((e,o)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:o})})(n,t),n})(t,e,o)))})(o.publishableKey);s?(window.Zonos.stripe=s,r.initCheckoutElement(s)):n("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(r),U.zonosController=r,t("Zonos controller injected!")},M.injectScript=({cdnType:e,isModule:o,theRestUrl:r})=>{const s=`${U.getZonosUrl(e)}/${r}`;if(document.querySelector(`script[src="${s}"]`))return void t(`Zonos script "${s}" already exists in the document`,"warn");const a=document.head||document.body,c=document.createElement("script");o?c.type="module":c.noModule=!0,c.src=s,c.crossOrigin="anonymous",c.onerror=()=>{n(`Failed to load ${c.src}`);const t=i(e);t&&U.injectScript({cdnType:t,isModule:o,theRestUrl:r})},a.appendChild(c)},M.getZonosUrl=e=>{const o=()=>{switch(e){case"jsdelivr":return F;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.158";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.158";case"vercel":return P}};if(U.isNpm){return S()||o()}return o()},M.injectZonosCdn=()=>{U.injectScript({cdnType:s,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),U.injectScript({cdnType:s,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),t("Zonos cdn script injected!")},M.injectStylesheet=({cdnType:e,theRestUrl:o})=>{const t=U.getZonosUrl(e),r=document.head||document.body,s=document.createElement("link");s.rel="preconnect",s.href=`${P}/`,r.appendChild(s);const a=document.createElement("link");a.rel="stylesheet",a.href=`${t}/${o}`,a.onerror=()=>{n(`Failed to load ${a.href}`);const t=i(e);t&&U.injectStylesheet({cdnType:t,theRestUrl:o})},r.appendChild(a)},M.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?t("Zonos style links already injected","warn"):(U.injectStylesheet({cdnType:s,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),t("Zonos style css injected!"))},M.injectFonts=()=>{if((()=>{if(document.fonts.check("1em Inter"))return void t("Inter font already loaded","warn");const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${R}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&!x.test(t.href))return t}return null})())return void t("Inter font already injected","warn");const e=document.head||document.body,o=document.createElement("link");o.rel="preconnect",o.href=R,e.appendChild(o);const n=document.createElement("link");n.rel="stylesheet",n.href=`${R}/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap`,e.appendChild(n),t("Zonos font injected!")},M.setupGoogleFont=e=>{var o;null===(o=U.zonosController)||void 0===o||o.setupGoogleFont(e)},M.injectSupportGoogleFont=e=>{var o;t(`[FONT] injecting ${e}`);const n=null===(o=e.match(/family=(.*?):/))||void 0===o?void 0:o[1],r=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${R}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=R,r.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${e}"]`))return void t(`[FONT] ${n} font already injected`,"warn");const s=document.createElement("link");s.rel="stylesheet",s.href=e,r.appendChild(s),t(`[FONT] ${n} font injected!`)},window.Zonos&&window.Zonos.doneInit||(window.Zonos=M)})();
1
+ (function(){"use strict";const e=performance.now(),o=e=>{if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(o){if(e&&"function"==typeof e.toString){return e.toString()}return"Unable to stringify info"}},t=(t,n,...r)=>{var s,i;const{elapsedTimePretty:a}=(()=>{const o=performance.now()-e,t=o>1e3?`${(o/1e3).toFixed(2)}s`:`${o.toFixed(2)}ms`;return{elapsedTime:o,elapsedTimePretty:t}})(),c=[`(${a})`,...r];c.map(o).join(" ");if(!(!!(null===(s=window.Zonos)||void 0===s?void 0:s.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===n&&console.error(t,...c));let l=document.querySelector("iframe#zonos---debug-logging-iframe");l||(l=document.createElement("iframe"),l.id="zonos---debug-logging-iframe",l.style.display="none",l.style.opacity="0",l.style.position="absolute",l.style.top="-9999px",l.style.left="-9999px",l.style.width="1px",l.style.height="1px",l.style.border="none",l.style.overflow="hidden",l.style.visibility="hidden",document.body.appendChild(l));const d=(null===(i=l.contentWindow)||void 0===i?void 0:i.window.console)||window.console;switch(n){case"warn":d.warn(t,...c);break;case"info":d.info(t,...c);break;case"error":d.error(t,...c);break;default:d.groupCollapsed(t,...c),d.trace(),d.groupEnd()}},n=(e,...o)=>{t(e,"error",...o)},r=["jsdelivr","cdnjs","unpkg","vercel"],s="jsdelivr",i=e=>{const o=r.indexOf(e);return r[o+1]||null},a=()=>window.location.search.includes("zonosStagingMode=1"),c=()=>{var e;return(null===(e=window.Zonos.zonosApiKey)||void 0===e?void 0:e.includes("test"))||window.location.search.includes("zonosTestMode=1")};function l(e,o){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&o.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)o.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(t[n[r]]=e[n[r]])}return t}"function"==typeof SuppressedError&&SuppressedError;const d=["cloudflare","vercel"],u=d[0],p={cloudflare:"https://route.elements.zonos.com",vercel:"https://route.js.zonos.com"},m=p[u],w=(e=u)=>{const o=d.indexOf(e),t=d[o+1];return t||null},h=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},y=async({response:e,shouldLog:o=!0,shouldThrow:t=!1})=>{try{const o=await e.text(),t=h(o);if(!t)throw new Error(`Failed to parse content: ${o}`);return t}catch(e){if(t)throw e;return o&&console.error(e),null}},g=async({basePathType:e,options:o,path:t})=>{let n;const r=window.Zonos.zonosQaUrlApi||p[e]||u,s=new URL(r+t),i=window.Zonos.cartId?`${window.location.hostname}-${window.Zonos.cartId}`:window.location.hostname;s.searchParams.set("zToken",(e=>{try{return btoa(e).replace(/=/g,"")}catch(o){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(i));try{n=await fetch(s.toString(),o)}catch(e){if(e instanceof Error)return{baseUrl:r,errors:[{message:e.message,type:"unknown"}],json:null,response:null,zonosMode:null};return{baseUrl:r,errors:[{message:"Failed to fetch",type:"unknown"}],json:null,response:null,zonosMode:null}}const a=n.headers.get("Zonos-Mode"),c=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&a&&c&&(window.Zonos.modeAlerted=!0),n.ok){return{baseUrl:r,errors:[],json:await y({response:n}),response:n,zonosMode:a}}const l=n.status.toString();try{const e=await y({response:n,shouldThrow:!0});if(e&&"errors"in e&&Array.isArray(e.errors)){const o=e.errors;return{baseUrl:r,errors:o.map((e=>"string"==typeof e?{message:e,type:l}:e)),json:null,response:n,zonosMode:a}}return{baseUrl:r,errors:[{message:JSON.stringify(e),type:l}],json:null,response:n,zonosMode:a}}catch(e){return{baseUrl:r,errors:[{message:`${l}: ${"Unknown error"}`,type:l}],json:null,response:null,zonosMode:a}}},f=async({basePathType:e,options:o,path:n})=>{var r,s;const i=n.startsWith("/api/bigcommerce")?"vercel":e,a=await g({basePathType:i,options:o,path:n}),{errors:c,response:d}=a,u=l(a,["errors","response"]),y=w(i),v=!!c.find((({type:e})=>"unknown"===e))||404===(null==d?void 0:d.status),S=y&&v;return v&&(async({endpoint:e,errors:o,metadata:n,shouldPostReleaseErrorReporting:r})=>{if(t("sendErrorLog","warn",e,n,o),r){const e=Number(window.Zonos.releaseDate);if((new Date).getTime()-e>36e5)return}const s="userAgentData"in window.navigator?window.navigator.userAgentData:null,i={endpoint:e,errors:o,href:window.location.href,metadata:Object.assign({appVersion:window.Zonos.version,domain:window.Zonos.domain,publicCredential:window.Zonos.zonosApiKey,userAgent:s&&s.brands.length>0?s:window.navigator.userAgent},n)};try{fetch(`${m}/api/zonos-elements/log-error`,{body:JSON.stringify(i),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const o=w();if(!o)return;fetch(`${p[o]}/api/zonos-elements/log-error`,{body:JSON.stringify(i),method:"POST"})}})({endpoint:p[i]+n,errors:c.map((({message:e})=>`API: ${e}`)),metadata:{currentBasePath:i,nextFallbackApiType:y,requestHeaders:null==o?void 0:o.headers,requestPayload:h(null===(r=null==o?void 0:o.body)||void 0===r?void 0:r.toString())||(null===(s=null==o?void 0:o.body)||void 0===s?void 0:s.toString()),status:null==d?void 0:d.status,statusText:null==d?void 0:d.statusText},shouldPostReleaseErrorReporting:!0}),S?(t(`=== "${n}" failed to fetch, trying next fallback ${y}`),f({basePathType:y,options:o,path:n})):Object.assign({errors:c,response:d},u)},v=async(e,o)=>{const n=l(o||{},[]),r=n.body?JSON.stringify(n.body):void 0,s=n.method||"GET",i=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Staging-Mode":a()?"1":void 0,"Zonos-Test-Mode":c()?"1":void 0,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},n.headers);Object.keys(i).forEach((e=>void 0===i[e]&&delete i[e]));const d=Object.assign(Object.assign({},n),{body:"GET"===s?void 0:r,headers:i,method:s}),p=new URLSearchParams(window.location.search).get("useFallbackApi");return t(e,"info"),f({basePathType:p||u,options:d,path:e})},S=()=>{const e=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||e)return null;const o=(e=>{if(!e)return null;const o=new URL(e).searchParams.get("zonosQaUrl");return o?/[^a-zA-Z0-9-_]+/.test(o)?null:o:null})(window.location.href),n="https://v1.3.160.js.zonos.com";if(!o&&(n.includes("test.")||n.includes("test-")))return n;if(!o&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!o)return null;if("dev-elements"===o)return"https://dev.elements.zonos.com";const r=`https://${o}.preview.js.zonos.com`;return t(`[ZONOS-WARNING] using '${r}' for loading elements script`,"warn"),fetch(r).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${r}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:o}=window.location,t=`${o}?${e.toString()}`;return window.history.replaceState(window.history.state,"",t),window.location.reload(),null})),r},b="https://js.stripe.com/v3",z=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,C="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let Z=null;const j=e=>(null!==Z||(Z=new Promise(((o,t)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(C),window.Stripe)o(window.Stripe);else try{let r=(()=>{const e=document.querySelectorAll(`script[src^="${b}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&z.test(t.src))return t}return null})();r&&e?console.warn(C):r||(r=(e=>{const o=document.createElement("script");o.src=`${b}`;const t=document.head||document.body;return t?(t.appendChild(o),o):(n("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==r||r.addEventListener("load",(()=>{window.Stripe?o(window.Stripe):t(new Error("Stripe.js not available"))})),null==r||r.addEventListener("error",(()=>{t(new Error("Failed to load Stripe.js"))}))}catch(e){return void t(e)}else o(null)}))),Z),O=Promise.resolve().then((()=>j(null)));let k=!1;O.catch((e=>{k||console.warn(e)}));const I=async({cartId:e,retries:o})=>{const n=c(),{errors:r,json:s}=await v("/api/zonos-elements/get-temp-cart",{body:{isTestMode:n,options:{noOnlineStoreSettings:!0},tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"}),i=!s||r.length;return i&&o?(t("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:o}),await new Promise((e=>setTimeout(e,500))),I({cartId:e,retries:o-1})):i?null:s},E=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/,A=new RegExp(`^${E.source}$`),L=new RegExp(`^cart_${E.source}$`),$=/^[a-zA-Z0-9]{2,}$/,T=/^cart_[a-zA-Z0-9]{2,}$/,N=async e=>{const{isDgsCartId:o,isLegacyCartId:r}=(e=>e?e.includes("undefined")?{isDgsCartId:!1,isLegacyCartId:!1}:T.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:$.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:L.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:A.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:{isDgsCartId:!1,isLegacyCartId:!1}:{isDgsCartId:!1,isLegacyCartId:!1})(e);if(!r&&!o)return n("[ZONOS - loadZonos] invalid cart id"),null;const s=await I({cartId:e,retries:5});return t("[ZONOS - loadZonos] getting temp cart data","info",s),s?(window.Zonos.storeId=s.cartData.storeId,window.Zonos.zonosApiKey=s.cartData.credentialToken,{cartData:s.cartData,storeFavicon:s.storeFaviconUrl,storeId:s.cartData.storeId,storeLogo:s.storeLogoUrl,zonosApiKey:s.cartData.credentialToken}):(n("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)};var U;const D=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:o,isWhiteListed:t}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const o=new URL(e).origin,t=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>o.includes(e))),n=["qa.js.zonos.com"].some((e=>o.includes(e)));return{currentLoadScriptUrl:o,isForceLoadVersionDomain:n,isWhiteListed:t}})({loadScriptSrc:null==e?void 0:e.src});return t?o:null})(),P="https://v1.3.160.js.zonos.com",F=D||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.160",R="https://fonts.googleapis.com",x=/^https:\/\/fonts\.googleapis\.com/;class M{}U=M,M.doneInit=!1,M.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),M.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),M._paypalMockResponse=null,M.isBigCommerce=!1,M.releaseDate="1739466306623",M.isLegacyCheckout=!1,M.domain="undefined"!=typeof window?window.location!=window.parent.location&&document.referrer||document.location.hostname:"",M.showBaseForeign="undefined"!=typeof window&&window.location.search.includes("zonosShowBaseForeign"),M.isNpm=!0,M.zonosQaUrl=null,M.zonosQaUrlApi=null,M.version="v1.3.160",M.modeAlerted=!1,M.cartData=null,M.paypal=null,M.getCurrentTimestamp=()=>(new Date).getTime(),M.zonosController=null,M.init=async e=>{const{appearance:o,checkoutSettings:r,currencyConverter:s,helloSettings:i,onCountryChange:l,overrideCurrencyFormat:d,storeId:u,zonosApiKey:p}=e;if(U.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),U.doneInit)return;if(t(`====== ZONOS DEBUG MODE: on (${U.version}) ======`),U.zonosApiKey=p,U.storeId=u,U.isNpm){t("====== ZONOS LOADING FROM NPM ======");const o=S();if(o&&!window.isZonosPreview){t(`====== RE-INJECT "zonos.js" FROM PRVIEW: ${o} ======`,"info");const n=document.createElement("script");return n.src=`${o}/dist/scripts/zonos.js`,document.head.appendChild(n),n.addEventListener("load",(()=>{window.Zonos.isNpm=U.isNpm,window.Zonos.isBigCommerce=U.isBigCommerce,window.Zonos.isLegacyCheckout=U.isLegacyCheckout,window.Zonos.init(e)})),n.addEventListener("error",(()=>{alert(`[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: ${o}`)})),void(window.isZonosPreview=!0)}if(!p&&!U.cartId)return void n("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!U.cartData&&U.cartId){t("Initialize cart data");const e=await N(U.cartId);if(!e)return void n("Failed to get cart data");U.cartData=e.cartData,U.zonosApiKey=e.zonosApiKey}const r=await(async()=>{const e=c(),o=a();if(!e&&!o||!window.Zonos.zonosApiKey)return null;if(t("[ZONOS - loadZonos] Attempt test public credential","info"),window.Zonos.zonosApiKey.includes("credential_test"))return t("[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key","info"),null;const{errors:r,json:s}=await v("/api/get-test-public-credential");if(r.length||!s)return n("[ZONOS - loadZonos] Failed to get test public credential. Keep using production key",r),null;const i=s.publicCredential;return i?(t(`[ZONOS - loadZonos] Retrieve new test public token ${i}`,"info"),i):(n("[ZONOS - loadZonos] No test public key credential. Keep using production key"),null)})();r&&(U.zonosApiKey=r)}const m=new URL(window.location.href).searchParams.get("payment_intent_client_secret")||sessionStorage.getItem("zonos--client-secret");if(U.cartId&&U.cartData||!!m){t("Cart data or stripe client secret is available, inject hidden button and trigger checkout");const e=document.createElement("button");e.style.display="none",e.id="zonos--checkout-hidden-button",document.body.appendChild(e)}t("init zonos"),U.injectCustomScriptForHostedCheckout(),U.injectZonosCdn(),U.injectZonosCss(),U.injectFonts(),U.injectController({config:{appearance:o,checkoutSettings:r,currencyConverter:s,helloSettings:i,onCountryChange:l,overrideCurrencyFormat:d}}),U.doneInit=!0},M.injectCustomScriptForHostedCheckout=()=>{const e=U.cartData,o=(null==e?void 0:e.metadata)||[],n=o.find((e=>"customHeaderScript"===e.key)),r=o.find((e=>"customFooterScript"===e.key));if(window.Zonos.isLegacyCheckout&&(n||r)){if(n){t("Injecting custom header script");const e=document.createElement("script");e.textContent=n.value,document.head.appendChild(e)}if(r){t("Injecting custom footer script");const e=document.createElement("script");e.textContent=r.value,document.body.appendChild(e)}}else t("Skip injecting custom script for hosted checkout","info",{footerScript:r,headerScript:n,isLegacyCheckout:window.Zonos.isLegacyCheckout})},M.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},M.openHelloDialog=e=>{const o=document.querySelector("zonos-hello");o&&o.openHelloDialog(null==e||e)},M.showNotification=e=>{var o;null===(o=U.zonosController)||void 0===o||o.showNotification(e)},M.updateOrganizationName=e=>{var o;null===(o=U.zonosController)||void 0===o||o.updateOrganizationName(e)},M.disablePlaceOrderButtons=({autoEnable:e=!0,config:o,disable:t,placeOrderButtonSelector:n})=>{var r;if(!(null===(r=o.checkoutSettings)||void 0===r?void 0:r.disablePlaceOrderButtonActivation)&&n){const o=document.querySelectorAll(n),r=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};o.forEach((e=>{e.getAttribute("data-zonos-checkout-attached")||(t?(e.setAttribute("disabled","true"),e.addEventListener("click",r)):(e.removeAttribute("disabled"),e.removeEventListener("click",r)))})),e&&t&&setTimeout((()=>{o.forEach((e=>{e.removeAttribute("disabled"),e.removeEventListener("click",r)}))}),5e3)}},M.injectController=({config:e})=>{var o;if(document.querySelector("zonos-controller"))return;if(null===(o=e.checkoutSettings)||void 0===o?void 0:o.placeOrderButtonSelector){const o=e.checkoutSettings.placeOrderButtonSelector;U.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o});new MutationObserver((()=>{U.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o})})).observe(document.body,{childList:!0,subtree:!0})}const r=document.createElement("zonos-controller");r.config=e,r.zonosApiKey=U.zonosApiKey||"",r.addEventListener("stripeInitEvent",(async e=>{const{detail:o}=e;t("loading Stripe");const s=await(async(...e)=>{k=!0;const o=Date.now();return O.then((t=>((e,o,t)=>{if(null===e)return null;const n=e.apply(void 0,o);return((e,o)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:o})})(n,t),n})(t,e,o)))})(o.publishableKey);s?(window.Zonos.stripe=s,r.initCheckoutElement(s)):n("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(r),U.zonosController=r,t("Zonos controller injected!")},M.injectScript=({cdnType:e,isModule:o,theRestUrl:r})=>{const s=`${U.getZonosUrl(e)}/${r}`;if(document.querySelector(`script[src="${s}"]`))return void t(`Zonos script "${s}" already exists in the document`,"warn");const a=document.head||document.body,c=document.createElement("script");o?c.type="module":c.noModule=!0,c.src=s,c.crossOrigin="anonymous",c.onerror=()=>{n(`Failed to load ${c.src}`);const t=i(e);t&&U.injectScript({cdnType:t,isModule:o,theRestUrl:r})},a.appendChild(c)},M.getZonosUrl=e=>{const o=()=>{switch(e){case"jsdelivr":return F;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.160";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.160";case"vercel":return P}};if(U.isNpm){return S()||o()}return o()},M.injectZonosCdn=()=>{U.injectScript({cdnType:s,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),U.injectScript({cdnType:s,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),t("Zonos cdn script injected!")},M.injectStylesheet=({cdnType:e,theRestUrl:o})=>{const t=U.getZonosUrl(e),r=document.head||document.body,s=document.createElement("link");s.rel="preconnect",s.href=`${P}/`,r.appendChild(s);const a=document.createElement("link");a.rel="stylesheet",a.href=`${t}/${o}`,a.onerror=()=>{n(`Failed to load ${a.href}`);const t=i(e);t&&U.injectStylesheet({cdnType:t,theRestUrl:o})},r.appendChild(a)},M.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?t("Zonos style links already injected","warn"):(U.injectStylesheet({cdnType:s,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),t("Zonos style css injected!"))},M.injectFonts=()=>{if((()=>{if(document.fonts.check("1em Inter"))return void t("Inter font already loaded","warn");const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${R}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&!x.test(t.href))return t}return null})())return void t("Inter font already injected","warn");const e=document.head||document.body,o=document.createElement("link");o.rel="preconnect",o.href=R,e.appendChild(o);const n=document.createElement("link");n.rel="stylesheet",n.href=`${R}/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap`,e.appendChild(n),t("Zonos font injected!")},M.setupGoogleFont=e=>{var o;null===(o=U.zonosController)||void 0===o||o.setupGoogleFont(e)},M.injectSupportGoogleFont=e=>{var o;t(`[FONT] injecting ${e}`);const n=null===(o=e.match(/family=(.*?):/))||void 0===o?void 0:o[1],r=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${R}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=R,r.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${e}"]`))return void t(`[FONT] ${n} font already injected`,"warn");const s=document.createElement("link");s.rel="stylesheet",s.href=e,r.appendChild(s),t(`[FONT] ${n} font injected!`)},window.Zonos&&window.Zonos.doneInit||(window.Zonos=M)})();
@@ -1,6 +1,7 @@
1
1
  import type { CurrencyConverter, LoadZonosParamsConfig } from "../../scripts/_zonosBase";
2
+ import type { GenericZonosSettings, ZonosSettings } from "../../types/index";
2
3
  import type { CheckoutConfig } from "../../types/checkout/CheckoutConfig";
3
- import type { CountryCode, ElementsUiStyle, ElementsUiTheme, ZonosAttribution, ZonosSettingsQuery } from "../../types/generated/graphql.internal.types";
4
+ import type { CountryCode, ElementsUiStyle, ElementsUiTheme, ZonosAttribution } from "../../types/generated/graphql.internal.types";
4
5
  import type { HelloConfig } from "../../types/hello/HelloConfig";
5
6
  export type AppearanceConfig = {
6
7
  colorPrimary?: string;
@@ -30,6 +31,7 @@ export type ZonosConfig = {
30
31
  * List of countries that are disabled in the checkout, will also be disabled for hello
31
32
  */
32
33
  disabledCountries: CountryCode[];
34
+ genericSettings?: GenericZonosSettings;
33
35
  helloSettings: HelloConfig;
34
36
  /**
35
37
  * Callback to be called when the country is changed
@@ -71,7 +73,7 @@ declare const getZonosStoreTheme: (theme: ElementsUiTheme) => Exclude<ElementsUi
71
73
  */
72
74
  declare const zonosStoreInitSetting: ({ overrideSettings, zonosSettings, }: {
73
75
  overrideSettings?: LoadZonosParamsConfig;
74
- zonosSettings: ZonosSettingsQuery | null;
76
+ zonosSettings: ZonosSettings | null;
75
77
  }) => void;
76
78
  declare const zonosStoreFontFamily: () => string;
77
79
  export { getZonosStoreTheme, zonosStore, zonosStoreDispose, zonosStoreFontFamily, zonosStoreInitSetting, };
@@ -1,10 +1,10 @@
1
- import type { ZonosSettingsQuery } from "../../../types/generated/graphql.internal.types";
1
+ import type { ZonosSettings } from "../../../types/index";
2
2
  export declare const getZonosSettings: () => Promise<{
3
- errors: import("../../..").JsonError[];
3
+ errors: import("src/types").JsonError[];
4
4
  json: null;
5
5
  zonosMode: "production" | "test" | null;
6
6
  } | {
7
7
  errors: never[];
8
- json: ZonosSettingsQuery | null;
8
+ json: ZonosSettings | null;
9
9
  zonosMode: "production" | "test" | null;
10
10
  }>;
@@ -22,4 +22,5 @@ export * from './TestPublicCredential';
22
22
  export * from './Translation';
23
23
  export * from './utils/deep/IDeepKeyof';
24
24
  export * from './utils/deep/IDeepKeyofAtIndex';
25
+ export * from './utils/ZonosSettings';
25
26
  export * from './Version';
@@ -0,0 +1,10 @@
1
+ import type { CountryCode, ZonosSettingsQuery } from "../generated/graphql.internal.types";
2
+ export type GenericZonosSettings = {
3
+ /**
4
+ * List of countries that are allowed to use USD denominated cards for settlement.
5
+ */
6
+ usdSettlementCountryEnabled?: CountryCode[];
7
+ };
8
+ export type ZonosSettings = ZonosSettingsQuery & {
9
+ genericSettings?: GenericZonosSettings;
10
+ };
@@ -1 +1 @@
1
- import{g as e,a as n,l as t,h as o,b as r}from"./p-f0c8150e.js";import{s as i,c as l}from"./p-c9035262.js";export{c as checkoutHiddenBtnSelector,d as domesticRedirectedBtnSelector}from"./p-c9035262.js";export{c as countryRequireTaxId,s as shipToTaxIdLabels}from"./p-5bd927f2.js";const a=["jsdelivr","cdnjs","unpkg","vercel"],u="jsdelivr",m=e=>{const n=a.indexOf(e);return a[n+1]||null},p=()=>{const e=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||e)return null;const n=(e=>{if(!e)return null;const n=new URL(e).searchParams.get("zonosQaUrl");return n?/[^a-zA-Z0-9-_]+/.test(n)?null:n:null})(window.location.href),o="https://v1.3.158.js.zonos.com";if(!n&&(o.includes("test.")||o.includes("test-")))return o;if(!n&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!n)return null;if("dev-elements"===n)return"https://dev.elements.zonos.com";const s=`https://${n}.preview.js.zonos.com`;return t(`[ZONOS-WARNING] using '${s}' for loading elements script`,"warn"),fetch(s).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${s}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:n}=window.location,t=`${n}?${e.toString()}`;return window.history.replaceState(window.history.state,"",t),window.location.reload(),null})),s},w="https://js.stripe.com/v3",f=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,h="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let v=null;const y=Promise.resolve().then((()=>{return e=null,null!==v||(v=new Promise(((n,t)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(h),window.Stripe)n(window.Stripe);else try{let o=(()=>{const e=document.querySelectorAll(`script[src^="${w}"]`);for(let n=0;n<e.length;n++){const t=e[n];if(t&&f.test(t.src))return t}return null})();o&&e?console.warn(h):o||(o=(e=>{const n=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"",t=document.createElement("script");t.src=`${w}${n}`;const o=document.head||document.body;return o?(o.appendChild(t),t):(r("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})(e)),null==o||o.addEventListener("load",(()=>{window.Stripe?n(window.Stripe):t(new Error("Stripe.js not available"))})),null==o||o.addEventListener("error",(()=>{t(new Error("Failed to load Stripe.js"))}))}catch(e){return void t(e)}else n(null)}))),v;var e}));let z=!1;var g;y.catch((e=>{z||console.warn(e)}));const j=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:n,isWhiteListed:t}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const n=new URL(e).origin,t=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>n.includes(e))),o=["qa.js.zonos.com"].some((e=>n.includes(e)));return{currentLoadScriptUrl:n,isForceLoadVersionDomain:o,isWhiteListed:t}})({loadScriptSrc:null==e?void 0:e.src});return t?n:null})(),S="https://v1.3.158.js.zonos.com",O=j||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.158",k="https://fonts.googleapis.com",b=/^https:\/\/fonts\.googleapis\.com/;class ${}g=$,$.doneInit=!1,$.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),$.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),$._paypalMockResponse=null,$.isBigCommerce=!1,$.releaseDate="1739220533967",$.isLegacyCheckout=!1,$.domain="undefined"!=typeof window?window.location!=window.parent.location&&document.referrer||document.location.hostname:"",$.showBaseForeign="undefined"!=typeof window&&window.location.search.includes("zonosShowBaseForeign"),$.isNpm=!0,$.zonosQaUrl=null,$.zonosQaUrlApi=null,$.version="v1.3.158",$.modeAlerted=!1,$.cartData=null,$.paypal=null,$.getCurrentTimestamp=()=>(new Date).getTime(),$.zonosController=null,$.init=async s=>{const{appearance:c,checkoutSettings:d,currencyConverter:a,helloSettings:u,onCountryChange:m,overrideCurrencyFormat:w,storeId:f,zonosApiKey:h}=s;if(g.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),g.doneInit)return;if(t(`====== ZONOS DEBUG MODE: on (${g.version}) ======`),g.zonosApiKey=h,g.storeId=f,g.isNpm){t("====== ZONOS LOADING FROM NPM ======");const c=p();if(c&&!window.isZonosPreview){t(`====== RE-INJECT "zonos.js" FROM PRVIEW: ${c} ======`,"info");const e=document.createElement("script");return e.src=`${c}/dist/scripts/zonos.js`,document.head.appendChild(e),e.addEventListener("load",(()=>{window.Zonos.isNpm=g.isNpm,window.Zonos.isBigCommerce=g.isBigCommerce,window.Zonos.isLegacyCheckout=g.isLegacyCheckout,window.Zonos.init(s)})),e.addEventListener("error",(()=>{alert(`[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: ${c}`)})),void(window.isZonosPreview=!0)}if(!h&&!g.cartId)return void r("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!g.cartData&&g.cartId){t("Initialize cart data");const e=await i(g.cartId);if(!e)return void r("Failed to get cart data");g.cartData=e.cartData,g.zonosApiKey=e.zonosApiKey}const d=await(async()=>{const s=e(),i=n();if(!s&&!i||!window.Zonos.zonosApiKey)return null;if(t("[ZONOS - loadZonos] Attempt test public credential","info"),window.Zonos.zonosApiKey.includes("credential_test"))return t("[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key","info"),null;const{errors:c,json:d}=await o("/api/get-test-public-credential");if(c.length||!d)return r("[ZONOS - loadZonos] Failed to get test public credential. Keep using production key",c),null;const l=d.publicCredential;return l?(t(`[ZONOS - loadZonos] Retrieve new test public token ${l}`,"info"),l):(r("[ZONOS - loadZonos] No test public key credential. Keep using production key"),null)})();d&&(g.zonosApiKey=d)}const v=new URL(window.location.href).searchParams.get("payment_intent_client_secret")||sessionStorage.getItem("zonos--client-secret");if(g.cartId&&g.cartData||v){t("Cart data or stripe client secret is available, inject hidden button and trigger checkout");const e=document.createElement("button");e.style.display="none",e.id=`${l}`,document.body.appendChild(e)}t("init zonos"),g.injectCustomScriptForHostedCheckout(),g.injectZonosCdn(),g.injectZonosCss(),g.injectFonts(),g.injectController({config:{appearance:c,checkoutSettings:d,currencyConverter:a,helloSettings:u,onCountryChange:m,overrideCurrencyFormat:w}}),g.doneInit=!0},$.injectCustomScriptForHostedCheckout=()=>{const e=g.cartData,n=(null==e?void 0:e.metadata)||[],o=n.find((e=>"customHeaderScript"===e.key)),s=n.find((e=>"customFooterScript"===e.key));if(window.Zonos.isLegacyCheckout&&(o||s)){if(o){t("Injecting custom header script");const e=document.createElement("script");e.textContent=o.value,document.head.appendChild(e)}if(s){t("Injecting custom footer script");const e=document.createElement("script");e.textContent=s.value,document.body.appendChild(e)}}else t("Skip injecting custom script for hosted checkout","info",{footerScript:s,headerScript:o,isLegacyCheckout:window.Zonos.isLegacyCheckout})},$.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},$.openHelloDialog=e=>{const n=document.querySelector("zonos-hello");n&&n.openHelloDialog(null==e||e)},$.showNotification=e=>{var n;null===(n=g.zonosController)||void 0===n||n.showNotification(e)},$.updateOrganizationName=e=>{var n;null===(n=g.zonosController)||void 0===n||n.updateOrganizationName(e)},$.disablePlaceOrderButtons=({autoEnable:e=!0,config:n,disable:t,placeOrderButtonSelector:o})=>{var s;if(!(null===(s=n.checkoutSettings)||void 0===s?void 0:s.disablePlaceOrderButtonActivation)&&o){const n=document.querySelectorAll(o),s=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",s)):(e.removeAttribute("disabled"),e.removeEventListener("click",s)))})),e&&t&&setTimeout((()=>{n.forEach((e=>{e.removeAttribute("disabled"),e.removeEventListener("click",s)}))}),5e3)}},$.injectController=({config:e})=>{var n;if(document.querySelector("zonos-controller"))return;if(null===(n=e.checkoutSettings)||void 0===n?void 0:n.placeOrderButtonSelector){const n=e.checkoutSettings.placeOrderButtonSelector;g.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:n}),new MutationObserver((()=>{g.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:n})})).observe(document.body,{childList:!0,subtree:!0})}const o=document.createElement("zonos-controller");o.config=e,o.zonosApiKey=g.zonosApiKey||"",o.addEventListener("stripeInitEvent",(async e=>{const{detail:n}=e;t("loading Stripe");const s=await(async(...e)=>{z=!0;const n=Date.now();return y.then((t=>((e,n,t)=>{if(null===e)return null;const o=e.apply(void 0,n);return((e,n)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:n})})(o,t),o})(t,e,n)))})(n.publishableKey);s?(window.Zonos.stripe=s,o.initCheckoutElement(s)):r("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(o),g.zonosController=o,t("Zonos controller injected!")},$.injectScript=({cdnType:e,isModule:n,theRestUrl:o})=>{const s=`${g.getZonosUrl(e)}/${o}`;if(document.querySelector(`script[src="${s}"]`))return void t(`Zonos script "${s}" already exists in the document`,"warn");const i=document.head||document.body,c=document.createElement("script");n?c.type="module":c.noModule=!0,c.src=s,c.crossOrigin="anonymous",c.onerror=()=>{r(`Failed to load ${c.src}`);const t=m(e);t&&g.injectScript({cdnType:t,isModule:n,theRestUrl:o})},i.appendChild(c)},$.getZonosUrl=e=>{const n=()=>{switch(e){case"jsdelivr":return O;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.158";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.158";case"vercel":return S}};return g.isNpm&&p()||n()},$.injectZonosCdn=()=>{g.injectScript({cdnType:u,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),g.injectScript({cdnType:u,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),t("Zonos cdn script injected!")},$.injectStylesheet=({cdnType:e,theRestUrl:n})=>{const t=g.getZonosUrl(e),o=document.head||document.body,s=document.createElement("link");s.rel="preconnect",s.href=`${S}/`,o.appendChild(s);const i=document.createElement("link");i.rel="stylesheet",i.href=`${t}/${n}`,i.onerror=()=>{r(`Failed to load ${i.href}`);const t=m(e);t&&g.injectStylesheet({cdnType:t,theRestUrl:n})},o.appendChild(i)},$.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?t("Zonos style links already injected","warn"):(g.injectStylesheet({cdnType:u,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),t("Zonos style css injected!"))},$.injectFonts=()=>{if((()=>{if(document.fonts.check("1em Inter"))return void t("Inter font already loaded","warn");const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${k}"]`);for(let n=0;n<e.length;n++){const t=e[n];if(t&&!b.test(t.href))return t}return null})())return void t("Inter font already injected","warn");const e=document.head||document.body,n=document.createElement("link");n.rel="preconnect",n.href=k,e.appendChild(n);const o=document.createElement("link");o.rel="stylesheet",o.href=`${k}/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap`,e.appendChild(o),t("Zonos font injected!")},$.setupGoogleFont=e=>{var n;null===(n=g.zonosController)||void 0===n||n.setupGoogleFont(e)},$.injectSupportGoogleFont=e=>{var n;t(`[FONT] injecting ${e}`);const o=null===(n=e.match(/family=(.*?):/))||void 0===n?void 0:n[1],s=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${k}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=k,s.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${e}"]`))return void t(`[FONT] ${o} font already injected`,"warn");const r=document.createElement("link");r.rel="stylesheet",r.href=e,s.appendChild(r),t(`[FONT] ${o} font injected!`)};export{$ as Zonos}
1
+ import{g as e,a as n,l as t,h as o,b as r}from"./p-f0c8150e.js";import{s as i,c as l}from"./p-c9035262.js";export{c as checkoutHiddenBtnSelector,d as domesticRedirectedBtnSelector}from"./p-c9035262.js";export{c as countryRequireTaxId,s as shipToTaxIdLabels}from"./p-5bd927f2.js";const a=["jsdelivr","cdnjs","unpkg","vercel"],u="jsdelivr",m=e=>{const n=a.indexOf(e);return a[n+1]||null},p=()=>{const e=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||e)return null;const n=(e=>{if(!e)return null;const n=new URL(e).searchParams.get("zonosQaUrl");return n?/[^a-zA-Z0-9-_]+/.test(n)?null:n:null})(window.location.href),o="https://v1.3.160.js.zonos.com";if(!n&&(o.includes("test.")||o.includes("test-")))return o;if(!n&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!n)return null;if("dev-elements"===n)return"https://dev.elements.zonos.com";const s=`https://${n}.preview.js.zonos.com`;return t(`[ZONOS-WARNING] using '${s}' for loading elements script`,"warn"),fetch(s).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${s}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:n}=window.location,t=`${n}?${e.toString()}`;return window.history.replaceState(window.history.state,"",t),window.location.reload(),null})),s},w="https://js.stripe.com/v3",f=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,h="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let v=null;const y=Promise.resolve().then((()=>{return e=null,null!==v||(v=new Promise(((n,t)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(h),window.Stripe)n(window.Stripe);else try{let o=(()=>{const e=document.querySelectorAll(`script[src^="${w}"]`);for(let n=0;n<e.length;n++){const t=e[n];if(t&&f.test(t.src))return t}return null})();o&&e?console.warn(h):o||(o=(e=>{const n=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"",t=document.createElement("script");t.src=`${w}${n}`;const o=document.head||document.body;return o?(o.appendChild(t),t):(r("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})(e)),null==o||o.addEventListener("load",(()=>{window.Stripe?n(window.Stripe):t(new Error("Stripe.js not available"))})),null==o||o.addEventListener("error",(()=>{t(new Error("Failed to load Stripe.js"))}))}catch(e){return void t(e)}else n(null)}))),v;var e}));let z=!1;var g;y.catch((e=>{z||console.warn(e)}));const j=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:n,isWhiteListed:t}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const n=new URL(e).origin,t=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>n.includes(e))),o=["qa.js.zonos.com"].some((e=>n.includes(e)));return{currentLoadScriptUrl:n,isForceLoadVersionDomain:o,isWhiteListed:t}})({loadScriptSrc:null==e?void 0:e.src});return t?n:null})(),S="https://v1.3.160.js.zonos.com",O=j||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.160",k="https://fonts.googleapis.com",b=/^https:\/\/fonts\.googleapis\.com/;class ${}g=$,$.doneInit=!1,$.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),$.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),$._paypalMockResponse=null,$.isBigCommerce=!1,$.releaseDate="1739466263580",$.isLegacyCheckout=!1,$.domain="undefined"!=typeof window?window.location!=window.parent.location&&document.referrer||document.location.hostname:"",$.showBaseForeign="undefined"!=typeof window&&window.location.search.includes("zonosShowBaseForeign"),$.isNpm=!0,$.zonosQaUrl=null,$.zonosQaUrlApi=null,$.version="v1.3.160",$.modeAlerted=!1,$.cartData=null,$.paypal=null,$.getCurrentTimestamp=()=>(new Date).getTime(),$.zonosController=null,$.init=async s=>{const{appearance:c,checkoutSettings:d,currencyConverter:a,helloSettings:u,onCountryChange:m,overrideCurrencyFormat:w,storeId:f,zonosApiKey:h}=s;if(g.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),g.doneInit)return;if(t(`====== ZONOS DEBUG MODE: on (${g.version}) ======`),g.zonosApiKey=h,g.storeId=f,g.isNpm){t("====== ZONOS LOADING FROM NPM ======");const c=p();if(c&&!window.isZonosPreview){t(`====== RE-INJECT "zonos.js" FROM PRVIEW: ${c} ======`,"info");const e=document.createElement("script");return e.src=`${c}/dist/scripts/zonos.js`,document.head.appendChild(e),e.addEventListener("load",(()=>{window.Zonos.isNpm=g.isNpm,window.Zonos.isBigCommerce=g.isBigCommerce,window.Zonos.isLegacyCheckout=g.isLegacyCheckout,window.Zonos.init(s)})),e.addEventListener("error",(()=>{alert(`[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: ${c}`)})),void(window.isZonosPreview=!0)}if(!h&&!g.cartId)return void r("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!g.cartData&&g.cartId){t("Initialize cart data");const e=await i(g.cartId);if(!e)return void r("Failed to get cart data");g.cartData=e.cartData,g.zonosApiKey=e.zonosApiKey}const d=await(async()=>{const s=e(),i=n();if(!s&&!i||!window.Zonos.zonosApiKey)return null;if(t("[ZONOS - loadZonos] Attempt test public credential","info"),window.Zonos.zonosApiKey.includes("credential_test"))return t("[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key","info"),null;const{errors:c,json:d}=await o("/api/get-test-public-credential");if(c.length||!d)return r("[ZONOS - loadZonos] Failed to get test public credential. Keep using production key",c),null;const l=d.publicCredential;return l?(t(`[ZONOS - loadZonos] Retrieve new test public token ${l}`,"info"),l):(r("[ZONOS - loadZonos] No test public key credential. Keep using production key"),null)})();d&&(g.zonosApiKey=d)}const v=new URL(window.location.href).searchParams.get("payment_intent_client_secret")||sessionStorage.getItem("zonos--client-secret");if(g.cartId&&g.cartData||v){t("Cart data or stripe client secret is available, inject hidden button and trigger checkout");const e=document.createElement("button");e.style.display="none",e.id=`${l}`,document.body.appendChild(e)}t("init zonos"),g.injectCustomScriptForHostedCheckout(),g.injectZonosCdn(),g.injectZonosCss(),g.injectFonts(),g.injectController({config:{appearance:c,checkoutSettings:d,currencyConverter:a,helloSettings:u,onCountryChange:m,overrideCurrencyFormat:w}}),g.doneInit=!0},$.injectCustomScriptForHostedCheckout=()=>{const e=g.cartData,n=(null==e?void 0:e.metadata)||[],o=n.find((e=>"customHeaderScript"===e.key)),s=n.find((e=>"customFooterScript"===e.key));if(window.Zonos.isLegacyCheckout&&(o||s)){if(o){t("Injecting custom header script");const e=document.createElement("script");e.textContent=o.value,document.head.appendChild(e)}if(s){t("Injecting custom footer script");const e=document.createElement("script");e.textContent=s.value,document.body.appendChild(e)}}else t("Skip injecting custom script for hosted checkout","info",{footerScript:s,headerScript:o,isLegacyCheckout:window.Zonos.isLegacyCheckout})},$.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},$.openHelloDialog=e=>{const n=document.querySelector("zonos-hello");n&&n.openHelloDialog(null==e||e)},$.showNotification=e=>{var n;null===(n=g.zonosController)||void 0===n||n.showNotification(e)},$.updateOrganizationName=e=>{var n;null===(n=g.zonosController)||void 0===n||n.updateOrganizationName(e)},$.disablePlaceOrderButtons=({autoEnable:e=!0,config:n,disable:t,placeOrderButtonSelector:o})=>{var s;if(!(null===(s=n.checkoutSettings)||void 0===s?void 0:s.disablePlaceOrderButtonActivation)&&o){const n=document.querySelectorAll(o),s=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",s)):(e.removeAttribute("disabled"),e.removeEventListener("click",s)))})),e&&t&&setTimeout((()=>{n.forEach((e=>{e.removeAttribute("disabled"),e.removeEventListener("click",s)}))}),5e3)}},$.injectController=({config:e})=>{var n;if(document.querySelector("zonos-controller"))return;if(null===(n=e.checkoutSettings)||void 0===n?void 0:n.placeOrderButtonSelector){const n=e.checkoutSettings.placeOrderButtonSelector;g.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:n}),new MutationObserver((()=>{g.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:n})})).observe(document.body,{childList:!0,subtree:!0})}const o=document.createElement("zonos-controller");o.config=e,o.zonosApiKey=g.zonosApiKey||"",o.addEventListener("stripeInitEvent",(async e=>{const{detail:n}=e;t("loading Stripe");const s=await(async(...e)=>{z=!0;const n=Date.now();return y.then((t=>((e,n,t)=>{if(null===e)return null;const o=e.apply(void 0,n);return((e,n)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:n})})(o,t),o})(t,e,n)))})(n.publishableKey);s?(window.Zonos.stripe=s,o.initCheckoutElement(s)):r("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(o),g.zonosController=o,t("Zonos controller injected!")},$.injectScript=({cdnType:e,isModule:n,theRestUrl:o})=>{const s=`${g.getZonosUrl(e)}/${o}`;if(document.querySelector(`script[src="${s}"]`))return void t(`Zonos script "${s}" already exists in the document`,"warn");const i=document.head||document.body,c=document.createElement("script");n?c.type="module":c.noModule=!0,c.src=s,c.crossOrigin="anonymous",c.onerror=()=>{r(`Failed to load ${c.src}`);const t=m(e);t&&g.injectScript({cdnType:t,isModule:n,theRestUrl:o})},i.appendChild(c)},$.getZonosUrl=e=>{const n=()=>{switch(e){case"jsdelivr":return O;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.160";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.160";case"vercel":return S}};return g.isNpm&&p()||n()},$.injectZonosCdn=()=>{g.injectScript({cdnType:u,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),g.injectScript({cdnType:u,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),t("Zonos cdn script injected!")},$.injectStylesheet=({cdnType:e,theRestUrl:n})=>{const t=g.getZonosUrl(e),o=document.head||document.body,s=document.createElement("link");s.rel="preconnect",s.href=`${S}/`,o.appendChild(s);const i=document.createElement("link");i.rel="stylesheet",i.href=`${t}/${n}`,i.onerror=()=>{r(`Failed to load ${i.href}`);const t=m(e);t&&g.injectStylesheet({cdnType:t,theRestUrl:n})},o.appendChild(i)},$.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?t("Zonos style links already injected","warn"):(g.injectStylesheet({cdnType:u,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),t("Zonos style css injected!"))},$.injectFonts=()=>{if((()=>{if(document.fonts.check("1em Inter"))return void t("Inter font already loaded","warn");const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${k}"]`);for(let n=0;n<e.length;n++){const t=e[n];if(t&&!b.test(t.href))return t}return null})())return void t("Inter font already injected","warn");const e=document.head||document.body,n=document.createElement("link");n.rel="preconnect",n.href=k,e.appendChild(n);const o=document.createElement("link");o.rel="stylesheet",o.href=`${k}/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap`,e.appendChild(o),t("Zonos font injected!")},$.setupGoogleFont=e=>{var n;null===(n=g.zonosController)||void 0===n||n.setupGoogleFont(e)},$.injectSupportGoogleFont=e=>{var n;t(`[FONT] injecting ${e}`);const o=null===(n=e.match(/family=(.*?):/))||void 0===n?void 0:n[1],s=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${k}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=k,s.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${e}"]`))return void t(`[FONT] ${o} font already injected`,"warn");const r=document.createElement("link");r.rel="stylesheet",r.href=e,s.appendChild(r),t(`[FONT] ${o} font injected!`)};export{$ as Zonos}
@@ -1 +1 @@
1
- import{r as o,h as e,H as s}from"./p-ab68ad11.js";import{d as r}from"./p-d29e8aaa.js";import{c as t}from"./p-b4b7f705.js";const n=class{constructor(e){o(this,e),this.handleSlotChange=()=>{this.hasContent=!0},this.bannerTitle=void 0,this.intent=void 0,this.hasContent=!1}render(){const o=({color:o})=>{const s=`var(--zonos-elements-${o}-800)`,r=`var(--zonos-elements-${o}-300)`,[n,a]=[this.bannerTitle,e("slot",{onSlotchange:this.handleSlotChange})].filter(Boolean),l="gray"===o?"gray-1000":`${o}-800`;return e("div",{class:t(["zonos--container"])},e("div",{class:"zonos--icon-wrapper"},e("svg",{color:s,fill:"none",height:"20",viewBox:"0 0 24 24",width:"20",xmlns:"https://www.w3.org/2000/svg"},e("path",{"clip-rule":"evenodd",d:"M2 12C2 6.477 6.477 2 12 2s10 4.477 10 10-4.477 10-10 10S2 17.523 2 12Z","data-is-secondary-color":"true",fill:r,"fill-rule":"evenodd"}),e("path",{"clip-rule":"evenodd",d:"M12 6.99a1 1 0 0 1 1 1V8a1 1 0 1 1-2 0v-.01a1 1 0 0 1 1-1ZM12 11a1 1 0 0 1 1 1v4a1 1 0 1 1-2 0v-4a1 1 0 0 1 1-1Z",fill:"currentColor","fill-rule":"evenodd"}))),e("div",{class:"zonos--header-wrapper"},e("zonos-text",{textColor:l,type:"label",weight:600},n)),a&&e("div",{class:"zonos--content-wrapper"},e("zonos-text",{textColor:l},a)))},n=t(["zonos--elements zonos--banner",this.intent]),a=r();switch(this.intent){case"error":return e(s,{class:n,style:{"--zonos--font-family":a}},o({color:"red"}));case"info":return e(s,{class:n,style:{"--zonos--font-family":a}},o({color:"blue"}));case"success":return e(s,{class:n,style:{"--zonos--font-family":a}},o({color:"green"}));case"warning":return e(s,{class:n,style:{"--zonos--font-family":a}},o({color:"orange"}));default:return e(s,{class:n,style:{"--zonos--font-family":a}},o({color:"gray"}))}}};n.style=':host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{border-radius:var(--zonos-elements-radius-10);padding:16px;background:var(--zonos-elements-gray-100)}:host .zonos--container{display:grid;-ms-flex-align:center;align-items:center;grid-template-areas:"icon header" ". content";grid-template-columns:32px auto 0}:host .zonos--icon-wrapper{grid-area:icon;display:-ms-flexbox;display:flex;justify-self:start}:host .zonos--header-wrapper{margin-top:0px;grid-area:header}:host .zonos--content-wrapper{grid-area:content;margin-top:4px}:host(.info){background-color:var(--zonos-elements-blue-100);border:1px solid var(--zonos-elements-blue-200)}:host(.success){background-color:var(--zonos-elements-green-100);border:1px solid var(--zonos-elements-green-200)}:host(.error){background-color:var(--zonos-elements-red-100);border:1px solid var(--zonos-elements-red-200)}:host(.warning){background-color:var(--zonos-elements-orange-100);border:1px solid var(--zonos-elements-orange-200)}';export{n as zonos_banner}
1
+ import{r as o,h as s,H as e}from"./p-ab68ad11.js";import{d as r}from"./p-dd999b44.js";import{c as t}from"./p-b4b7f705.js";const n=class{constructor(s){o(this,s),this.handleSlotChange=()=>{this.hasContent=!0},this.bannerTitle=void 0,this.intent=void 0,this.hasContent=!1}render(){const o=({color:o})=>{const e=`var(--zonos-elements-${o}-800)`,r=`var(--zonos-elements-${o}-300)`,[n,a]=[this.bannerTitle,s("slot",{onSlotchange:this.handleSlotChange})].filter(Boolean),l="gray"===o?"gray-1000":`${o}-800`;return s("div",{class:t(["zonos--container"])},s("div",{class:"zonos--icon-wrapper"},s("svg",{color:e,fill:"none",height:"20",viewBox:"0 0 24 24",width:"20",xmlns:"https://www.w3.org/2000/svg"},s("path",{"clip-rule":"evenodd",d:"M2 12C2 6.477 6.477 2 12 2s10 4.477 10 10-4.477 10-10 10S2 17.523 2 12Z","data-is-secondary-color":"true",fill:r,"fill-rule":"evenodd"}),s("path",{"clip-rule":"evenodd",d:"M12 6.99a1 1 0 0 1 1 1V8a1 1 0 1 1-2 0v-.01a1 1 0 0 1 1-1ZM12 11a1 1 0 0 1 1 1v4a1 1 0 1 1-2 0v-4a1 1 0 0 1 1-1Z",fill:"currentColor","fill-rule":"evenodd"}))),s("div",{class:"zonos--header-wrapper"},s("zonos-text",{textColor:l,type:"label",weight:600},n)),a&&s("div",{class:"zonos--content-wrapper"},s("zonos-text",{textColor:l},a)))},n=t(["zonos--elements zonos--banner",this.intent]),a=r();switch(this.intent){case"error":return s(e,{class:n,style:{"--zonos--font-family":a}},o({color:"red"}));case"info":return s(e,{class:n,style:{"--zonos--font-family":a}},o({color:"blue"}));case"success":return s(e,{class:n,style:{"--zonos--font-family":a}},o({color:"green"}));case"warning":return s(e,{class:n,style:{"--zonos--font-family":a}},o({color:"orange"}));default:return s(e,{class:n,style:{"--zonos--font-family":a}},o({color:"gray"}))}}};n.style=':host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{border-radius:var(--zonos-elements-radius-10);padding:16px;background:var(--zonos-elements-gray-100)}:host .zonos--container{display:grid;-ms-flex-align:center;align-items:center;grid-template-areas:"icon header" ". content";grid-template-columns:32px auto 0}:host .zonos--icon-wrapper{grid-area:icon;display:-ms-flexbox;display:flex;justify-self:start}:host .zonos--header-wrapper{margin-top:0px;grid-area:header}:host .zonos--content-wrapper{grid-area:content;margin-top:4px}:host(.info){background-color:var(--zonos-elements-blue-100);border:1px solid var(--zonos-elements-blue-200)}:host(.success){background-color:var(--zonos-elements-green-100);border:1px solid var(--zonos-elements-green-200)}:host(.error){background-color:var(--zonos-elements-red-100);border:1px solid var(--zonos-elements-red-200)}:host(.warning){background-color:var(--zonos-elements-orange-100);border:1px solid var(--zonos-elements-orange-200)}';export{n as zonos_banner}
@@ -1 +1 @@
1
- System.register(["./p-4caffd96.system.js","./p-b4dcb658.system.js","./p-23e7c655.system.js"],(function(t){"use strict";var o,s,e,n,i,a;return{setters:[function(t){o=t.r;s=t.h;e=t.a;n=t.H},function(t){i=t.d},function(t){a=t.c}],execute:function(){var r=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:-ms-inline-flexbox;display:inline-flex}:host img{-webkit-filter:var(--zonos--filter-color);filter:var(--zonos--filter-color);width:var(--zonos--width)}";var h=r;var f=t("zonos_logo",function(){function t(t){o(this,t);this.theme="LIGHT";this.width="auto"}t.prototype.render=function(){var t=this.theme==="DARK"?"invert(100%) sepia(100%) saturate(0%) hue-rotate(288deg) brightness(102%) contrast(102%)":"whiteinvert(0%) sepia(100%) saturate(32%) hue-rotate(92deg) brightness(107%) contrast(107%)";return s(n,{key:"00a2d8c27b70f329813b6a3c1547c82b2e7cf725",class:a(["zonos--elements zonos--logo"]),style:{"--zonos--filter-color":t,"--zonos--font-family":i(),"--zonos--width":this.width}},s("img",{key:"e994199d3178a1198a1f0a1b132fae75bef47ce7",alt:"Zonos Logo",src:e("./assets/ZonosLogo.png")}))};Object.defineProperty(t,"assetsDirs",{get:function(){return["assets"]},enumerable:false,configurable:true});return t}());f.style=h}}}));
1
+ System.register(["./p-4caffd96.system.js","./p-a9a95fae.system.js","./p-23e7c655.system.js"],(function(t){"use strict";var o,s,e,n,i,a;return{setters:[function(t){o=t.r;s=t.h;e=t.a;n=t.H},function(t){i=t.d},function(t){a=t.c}],execute:function(){var r=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:-ms-inline-flexbox;display:inline-flex}:host img{-webkit-filter:var(--zonos--filter-color);filter:var(--zonos--filter-color);width:var(--zonos--width)}";var h=r;var f=t("zonos_logo",function(){function t(t){o(this,t);this.theme="LIGHT";this.width="auto"}t.prototype.render=function(){var t=this.theme==="DARK"?"invert(100%) sepia(100%) saturate(0%) hue-rotate(288deg) brightness(102%) contrast(102%)":"whiteinvert(0%) sepia(100%) saturate(32%) hue-rotate(92deg) brightness(107%) contrast(107%)";return s(n,{key:"00a2d8c27b70f329813b6a3c1547c82b2e7cf725",class:a(["zonos--elements zonos--logo"]),style:{"--zonos--filter-color":t,"--zonos--font-family":i(),"--zonos--width":this.width}},s("img",{key:"e994199d3178a1198a1f0a1b132fae75bef47ce7",alt:"Zonos Logo",src:e("./assets/ZonosLogo.png")}))};Object.defineProperty(t,"assetsDirs",{get:function(){return["assets"]},enumerable:false,configurable:true});return t}());f.style=h}}}));
@@ -1 +1 @@
1
- System.register(["./p-4caffd96.system.js","./p-b4dcb658.system.js","./p-23e7c655.system.js"],(function(o){"use strict";var e,s,n,r,t;return{setters:[function(o){e=o.r;s=o.h;n=o.H},function(o){r=o.d},function(o){t=o.c}],execute:function(){var a='<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M10.8282 5.17184C11.0235 5.3671 11.0235 5.68368 10.8282 5.87894L8.70688 8.00026L10.8282 10.1216C11.0235 10.3168 11.0235 10.6334 10.8282 10.8287C10.6329 11.024 10.3164 11.024 10.1211 10.8287L7.99978 8.70737L5.87846 10.8287C5.68319 11.024 5.36661 11.024 5.17135 10.8287C4.97609 10.6334 4.97609 10.3168 5.17135 10.1216L7.29267 8.00026L5.17135 5.87894C4.97609 5.68368 4.97609 5.3671 5.17135 5.17184C5.36661 4.97658 5.68319 4.97658 5.87846 5.17184L7.99978 7.29316L10.1211 5.17184C10.3164 4.97658 10.6329 4.97658 10.8282 5.17184Z" fill="var(--zonos-elements-gray-800)"/>\n</svg>\n';var l=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:-ms-inline-flexbox;display:inline-flex}:host .zonos--badge-content{display:-ms-flexbox;display:flex;gap:8px;font-size:var(--zonos-elements-font-size-s);padding:4px 8px;text-align:center;border-radius:var(--zonos-elements-radius-6);background-color:var(--zonos-elements-gray-100);color:var(--zonos-elements-gray-800);-ms-flex-align:center;align-items:center}:host p{font-weight:600;line-height:16px}:host .icon-right svg{-ms-flex-order:2;order:2}:host .small{padding:2px 8px}:host .rounded{border-radius:20px}:host .bold{background-color:var(--zonos-elements-gray-600);color:var(--zonos-elements-gray-100)}:host .blue{background-color:var(--zonos-elements-blue-100);color:var(--zonos-elements-blue-800)}:host .blue.bold{background-color:var(--zonos-elements-blue-600);color:var(--zonos-elements-blue-100)}:host .green{background-color:var(--zonos-elements-green-100);color:var(--zonos-elements-green-800)}:host .green.bold{background-color:var(--zonos-elements-green-600);color:var(--zonos-elements-green-100)}:host .red{background-color:var(--zonos-elements-red-100);color:var(--zonos-elements-red-800)}:host .red.bold{background-color:var(--zonos-elements-red-600);color:var(--zonos-elements-red-100)}:host .orange{background-color:var(--zonos-elements-orange-100);color:var(--zonos-elements-orange-800);border:1px solid var(--zonos-elements-orange-200)}:host .orange.bold{background-color:var(--zonos-elements-orange-600);color:var(--zonos-elements-orange-100)}:host .purple{background-color:var(--zonos-elements-purple-100);color:var(--zonos-elements-purple-800)}:host .purple.bold{background-color:var(--zonos-elements-purple-600);color:var(--zonos-elements-purple-100)}:host .cyan{background-color:var(--zonos-elements-cyan-100);color:var(--zonos-elements-cyan-800)}:host .cyan.bold{background-color:var(--zonos-elements-cyan-600);color:var(--zonos-elements-cyan-100)}:host .transparent{background-color:transparent;border:1px solid var(--zonos-elements-gray-200);color:var(--zonos-elements-gray-800)}:host .transparent.bold{background-color:var(--zonos-elements-glass-600);color:var(--zonos-elements-gray-100)}:host .zonos--badge-dismiss{cursor:pointer}";var c=l;var d=o("zonos_badge",function(){function o(o){e(this,o);this.bold=false;this.badgeColor="gray";this.icon=undefined;this.iconRight=false;this.size="default";this.rounded=false;this.loading=false;this.dismissHandler=undefined}o.prototype.render=function(){var o=this;return s(n,{key:"d8a6a11f10c36a272ecdb52c54919f9ad45e1a9a",class:t(["zonos--elements zonos--badge"]),style:{"--zonos--font-family":r()}},s("div",{key:"c7573446a478f9b9e45a4787593ba9ecaf595fdc",class:t(["zonos--badge-content",this.badgeColor,this.rounded&&"rounded",this.iconRight&&"icon-right",this.size,this.bold&&"bold"])},this.icon,s("zonos-text",{key:"578f7cf2f27be3306fc7c776dc82a7a324a8b3ca",textColor:"".concat(this.badgeColor,"-800")},s("slot",{key:"0b59f674e40454dcf07bea704f38c9df7d68cb43"})),this.dismissHandler&&s("zonos-icon",{key:"ff4e2ee7511940df9ec27830e406502d7acf5209","aria-label":"Remove action",class:"zonos--badge-dismiss",content:a,onClick:function(){var e;return(e=o.dismissHandler)===null||e===void 0?void 0:e.call(o)}})))};return o}());d.style=c}}}));
1
+ System.register(["./p-4caffd96.system.js","./p-a9a95fae.system.js","./p-23e7c655.system.js"],(function(o){"use strict";var e,s,n,r,t;return{setters:[function(o){e=o.r;s=o.h;n=o.H},function(o){r=o.d},function(o){t=o.c}],execute:function(){var a='<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M10.8282 5.17184C11.0235 5.3671 11.0235 5.68368 10.8282 5.87894L8.70688 8.00026L10.8282 10.1216C11.0235 10.3168 11.0235 10.6334 10.8282 10.8287C10.6329 11.024 10.3164 11.024 10.1211 10.8287L7.99978 8.70737L5.87846 10.8287C5.68319 11.024 5.36661 11.024 5.17135 10.8287C4.97609 10.6334 4.97609 10.3168 5.17135 10.1216L7.29267 8.00026L5.17135 5.87894C4.97609 5.68368 4.97609 5.3671 5.17135 5.17184C5.36661 4.97658 5.68319 4.97658 5.87846 5.17184L7.99978 7.29316L10.1211 5.17184C10.3164 4.97658 10.6329 4.97658 10.8282 5.17184Z" fill="var(--zonos-elements-gray-800)"/>\n</svg>\n';var l=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:-ms-inline-flexbox;display:inline-flex}:host .zonos--badge-content{display:-ms-flexbox;display:flex;gap:8px;font-size:var(--zonos-elements-font-size-s);padding:4px 8px;text-align:center;border-radius:var(--zonos-elements-radius-6);background-color:var(--zonos-elements-gray-100);color:var(--zonos-elements-gray-800);-ms-flex-align:center;align-items:center}:host p{font-weight:600;line-height:16px}:host .icon-right svg{-ms-flex-order:2;order:2}:host .small{padding:2px 8px}:host .rounded{border-radius:20px}:host .bold{background-color:var(--zonos-elements-gray-600);color:var(--zonos-elements-gray-100)}:host .blue{background-color:var(--zonos-elements-blue-100);color:var(--zonos-elements-blue-800)}:host .blue.bold{background-color:var(--zonos-elements-blue-600);color:var(--zonos-elements-blue-100)}:host .green{background-color:var(--zonos-elements-green-100);color:var(--zonos-elements-green-800)}:host .green.bold{background-color:var(--zonos-elements-green-600);color:var(--zonos-elements-green-100)}:host .red{background-color:var(--zonos-elements-red-100);color:var(--zonos-elements-red-800)}:host .red.bold{background-color:var(--zonos-elements-red-600);color:var(--zonos-elements-red-100)}:host .orange{background-color:var(--zonos-elements-orange-100);color:var(--zonos-elements-orange-800);border:1px solid var(--zonos-elements-orange-200)}:host .orange.bold{background-color:var(--zonos-elements-orange-600);color:var(--zonos-elements-orange-100)}:host .purple{background-color:var(--zonos-elements-purple-100);color:var(--zonos-elements-purple-800)}:host .purple.bold{background-color:var(--zonos-elements-purple-600);color:var(--zonos-elements-purple-100)}:host .cyan{background-color:var(--zonos-elements-cyan-100);color:var(--zonos-elements-cyan-800)}:host .cyan.bold{background-color:var(--zonos-elements-cyan-600);color:var(--zonos-elements-cyan-100)}:host .transparent{background-color:transparent;border:1px solid var(--zonos-elements-gray-200);color:var(--zonos-elements-gray-800)}:host .transparent.bold{background-color:var(--zonos-elements-glass-600);color:var(--zonos-elements-gray-100)}:host .zonos--badge-dismiss{cursor:pointer}";var c=l;var d=o("zonos_badge",function(){function o(o){e(this,o);this.bold=false;this.badgeColor="gray";this.icon=undefined;this.iconRight=false;this.size="default";this.rounded=false;this.loading=false;this.dismissHandler=undefined}o.prototype.render=function(){var o=this;return s(n,{key:"d8a6a11f10c36a272ecdb52c54919f9ad45e1a9a",class:t(["zonos--elements zonos--badge"]),style:{"--zonos--font-family":r()}},s("div",{key:"c7573446a478f9b9e45a4787593ba9ecaf595fdc",class:t(["zonos--badge-content",this.badgeColor,this.rounded&&"rounded",this.iconRight&&"icon-right",this.size,this.bold&&"bold"])},this.icon,s("zonos-text",{key:"578f7cf2f27be3306fc7c776dc82a7a324a8b3ca",textColor:"".concat(this.badgeColor,"-800")},s("slot",{key:"0b59f674e40454dcf07bea704f38c9df7d68cb43"})),this.dismissHandler&&s("zonos-icon",{key:"ff4e2ee7511940df9ec27830e406502d7acf5209","aria-label":"Remove action",class:"zonos--badge-dismiss",content:a,onClick:function(){var e;return(e=o.dismissHandler)===null||e===void 0?void 0:e.call(o)}})))};return o}());d.style=c}}}));
@@ -1 +1 @@
1
- import{r as o,c as s,h as t,H as e}from"./p-ab68ad11.js";import{d as n}from"./p-d29e8aaa.js";import{c as a}from"./p-b4b7f705.js";const r=class{constructor(t){o(this,t),this.toggleChanged=s(this,"toggleChanged",7),this.options=[],this.value=void 0}render(){return t(e,{key:"01958140c90fdadecbfca64fe65dbf1132af2cc1",class:a(["zonos--elements zonos--toggle"]),style:{"--zonos--font-family":n()}},t("div",{key:"5362589929c25b5ba897d23a308f6dd2759c4ac0",class:"wrapper"},this.options.map((o=>t("button",{class:a(["zonos--option",o.value===this.value&&"selected"]),key:o.value,onClick:()=>{this.toggleChanged.emit(o.value)}},o.label)))))}};r.style=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:-ms-inline-flexbox;display:inline-flex}:host .wrapper{position:relative;border-radius:6px;background-color:var(--zonos-elements-gray-50);display:-ms-flexbox;display:flex}:host .zonos--toggle-selected-slider{z-index:1;position:absolute;background-color:var(--zonos-elements-raised-surface-color);height:100%;-webkit-box-shadow:var(--zonos-elements-shadow-button-standard);box-shadow:var(--zonos-elements-shadow-button-standard);border-radius:6px;-webkit-animation:translate 0.3s ease-in-out;animation:translate 0.3s ease-in-out}:host .zonos--option{background:transparent;border:0;z-index:2;cursor:pointer;padding:4px 12px;border-radius:6px;-webkit-transition:var(--zonos-elements-transition);transition:var(--zonos-elements-transition);font-size:var(--zonos-elements-font-size-base);font-weight:500;color:var(--zonos-elements-text-color-secondary)}:host .zonos--option:focus{outline:none}:host .zonos--option:hover:not(.selected){color:var(--zonos-elements-text-color)}:host .zonos--option.selected{color:var(--zonos-elements-text-color);background-color:var(--zonos-elements-raised-surface-color);height:100%;-webkit-box-shadow:var(--zonos-elements-shadow-button-standard);box-shadow:var(--zonos-elements-shadow-button-standard);border-radius:6px;-webkit-animation:translate 0.3s ease-in-out;animation:translate 0.3s ease-in-out}";export{r as zonos_toggle}
1
+ import{r as o,c as s,h as t,H as e}from"./p-ab68ad11.js";import{d as n}from"./p-dd999b44.js";import{c as a}from"./p-b4b7f705.js";const r=class{constructor(t){o(this,t),this.toggleChanged=s(this,"toggleChanged",7),this.options=[],this.value=void 0}render(){return t(e,{key:"01958140c90fdadecbfca64fe65dbf1132af2cc1",class:a(["zonos--elements zonos--toggle"]),style:{"--zonos--font-family":n()}},t("div",{key:"5362589929c25b5ba897d23a308f6dd2759c4ac0",class:"wrapper"},this.options.map((o=>t("button",{class:a(["zonos--option",o.value===this.value&&"selected"]),key:o.value,onClick:()=>{this.toggleChanged.emit(o.value)}},o.label)))))}};r.style=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:-ms-inline-flexbox;display:inline-flex}:host .wrapper{position:relative;border-radius:6px;background-color:var(--zonos-elements-gray-50);display:-ms-flexbox;display:flex}:host .zonos--toggle-selected-slider{z-index:1;position:absolute;background-color:var(--zonos-elements-raised-surface-color);height:100%;-webkit-box-shadow:var(--zonos-elements-shadow-button-standard);box-shadow:var(--zonos-elements-shadow-button-standard);border-radius:6px;-webkit-animation:translate 0.3s ease-in-out;animation:translate 0.3s ease-in-out}:host .zonos--option{background:transparent;border:0;z-index:2;cursor:pointer;padding:4px 12px;border-radius:6px;-webkit-transition:var(--zonos-elements-transition);transition:var(--zonos-elements-transition);font-size:var(--zonos-elements-font-size-base);font-weight:500;color:var(--zonos-elements-text-color-secondary)}:host .zonos--option:focus{outline:none}:host .zonos--option:hover:not(.selected){color:var(--zonos-elements-text-color)}:host .zonos--option.selected{color:var(--zonos-elements-text-color);background-color:var(--zonos-elements-raised-surface-color);height:100%;-webkit-box-shadow:var(--zonos-elements-shadow-button-standard);box-shadow:var(--zonos-elements-shadow-button-standard);border-radius:6px;-webkit-animation:translate 0.3s ease-in-out;animation:translate 0.3s ease-in-out}";export{r as zonos_toggle}