@zonos/elements 1.3.175 → 1.3.176

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 (105) hide show
  1. package/dist/cjs/CheckoutConfig-f1442a60.js +35 -0
  2. package/dist/cjs/{cart-93ed3002.js → cart-e648a65f.js} +11 -5
  3. package/dist/cjs/index.cjs.js +67 -12
  4. package/dist/cjs/{paypal-8b49ef07.js → paypal-2390cfb2.js} +1 -1
  5. package/dist/cjs/zonos-address_7.cjs.entry.js +1 -1
  6. package/dist/cjs/zonos-cart-items_13.cjs.entry.js +2 -2
  7. package/dist/cjs/zonos-checkout.cjs.entry.js +57 -4
  8. package/dist/cjs/zonos-controller.cjs.entry.js +8 -1
  9. package/dist/cjs/zonos-country-flag.cjs.entry.js +1 -1
  10. package/dist/cjs/zonos-country-select_4.cjs.entry.js +1 -1
  11. package/dist/cjs/zonos-empty-state-payment_4.cjs.entry.js +2 -2
  12. package/dist/cjs/zonos-hello-dialog.cjs.entry.js +1 -1
  13. package/dist/cjs/zonos-hello.cjs.entry.js +1 -1
  14. package/dist/cjs/zonos-language-select_2.cjs.entry.js +1 -1
  15. package/dist/collection/components/utils/api/getShippingZones.js +8 -3
  16. package/dist/collection/components/utils/api/getZonosSettings.js +7 -0
  17. package/dist/collection/components/utils/api/trackConversionEvent.js +5 -2
  18. package/dist/collection/scripts/_getCartInfoById.js +29 -0
  19. package/dist/collection/scripts/_zonosBase.js +8 -5
  20. package/dist/collection/scripts/cart/_setupCartDataWithSettings.js +28 -0
  21. package/dist/collection/types/generated/graphql.internal.types.js +3 -0
  22. package/dist/esm/CheckoutConfig-5479d192.js +31 -0
  23. package/dist/esm/{cart-54d84646.js → cart-dc171e7f.js} +12 -6
  24. package/dist/esm/index.js +68 -13
  25. package/dist/esm/{paypal-17a320c8.js → paypal-1beec534.js} +1 -1
  26. package/dist/esm/zonos-address_7.entry.js +1 -1
  27. package/dist/esm/zonos-cart-items_13.entry.js +2 -2
  28. package/dist/esm/zonos-checkout.entry.js +56 -3
  29. package/dist/esm/zonos-controller.entry.js +8 -1
  30. package/dist/esm/zonos-country-flag.entry.js +1 -1
  31. package/dist/esm/zonos-country-select_4.entry.js +1 -1
  32. package/dist/esm/zonos-empty-state-payment_4.entry.js +2 -2
  33. package/dist/esm/zonos-hello-dialog.entry.js +1 -1
  34. package/dist/esm/zonos-hello.entry.js +1 -1
  35. package/dist/esm/zonos-language-select_2.entry.js +1 -1
  36. package/dist/esm-es5/CheckoutConfig-5479d192.js +1 -0
  37. package/dist/esm-es5/cart-dc171e7f.js +1 -0
  38. package/dist/esm-es5/index.js +1 -1
  39. package/dist/esm-es5/{paypal-17a320c8.js → paypal-1beec534.js} +1 -1
  40. package/dist/esm-es5/zonos-address_7.entry.js +1 -1
  41. package/dist/esm-es5/zonos-cart-items_13.entry.js +1 -1
  42. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  43. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  44. package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
  45. package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
  46. package/dist/esm-es5/zonos-empty-state-payment_4.entry.js +1 -1
  47. package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
  48. package/dist/esm-es5/zonos-hello.entry.js +1 -1
  49. package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
  50. package/dist/scripts/index.d.ts +199 -0
  51. package/dist/scripts/index.js +1 -1
  52. package/dist/scripts/loadZonos.js +1 -1
  53. package/dist/scripts/zonos.js +1 -1
  54. package/dist/types/scripts/_getCartInfoById.d.ts +7 -0
  55. package/dist/types/scripts/_zonosBase.d.ts +11 -1
  56. package/dist/types/scripts/cart/_setupCartDataWithSettings.d.ts +166 -0
  57. package/dist/types/types/checkout/api/NormalizedTempCart.d.ts +20 -1
  58. package/dist/types/types/generated/graphql.internal.types.d.ts +155 -0
  59. package/dist/types/types/generated/graphql.internal.types.ts +159 -0
  60. package/dist/types/types/utils/ZonosSettings.d.ts +1 -1
  61. package/dist/zonos-elements/index.esm.js +1 -1
  62. package/dist/zonos-elements/p-007a4d24.entry.js +1 -0
  63. package/dist/zonos-elements/{p-9f8b820e.system.entry.js → p-08fa3875.system.entry.js} +1 -1
  64. package/dist/zonos-elements/{p-3d169241.system.entry.js → p-0a6aa4cf.system.entry.js} +1 -1
  65. package/dist/zonos-elements/{p-d9779ea7.entry.js → p-0ef83bec.entry.js} +1 -1
  66. package/dist/zonos-elements/{p-ed8a8a44.entry.js → p-117eb67d.entry.js} +1 -1
  67. package/dist/zonos-elements/{p-28dcd7bb.entry.js → p-24d4f2ec.entry.js} +1 -1
  68. package/dist/zonos-elements/{p-d22c15be.entry.js → p-30ff0a71.entry.js} +1 -1
  69. package/dist/zonos-elements/p-35bfc9d1.system.entry.js +1 -0
  70. package/dist/zonos-elements/p-40e5359c.system.js +1 -0
  71. package/dist/zonos-elements/p-46f6e5e9.system.js +1 -1
  72. package/dist/zonos-elements/p-5372fed8.system.js +1 -0
  73. package/dist/zonos-elements/{p-c67f6666.system.entry.js → p-60ab9c4c.system.entry.js} +1 -1
  74. package/dist/zonos-elements/p-655bc743.system.entry.js +1 -0
  75. package/dist/zonos-elements/{p-6612e6f9.system.entry.js → p-6ef7451f.system.entry.js} +1 -1
  76. package/dist/zonos-elements/{p-e11eecbf.system.entry.js → p-7dd0d6b4.system.entry.js} +1 -1
  77. package/dist/zonos-elements/p-80dd3fb6.entry.js +1 -0
  78. package/dist/zonos-elements/p-8ee34712.system.js +1 -0
  79. package/dist/zonos-elements/{p-d98fa14c.system.entry.js → p-a334b6d8.system.entry.js} +1 -1
  80. package/dist/zonos-elements/{p-c444f997.system.entry.js → p-a7d2a768.system.entry.js} +1 -1
  81. package/dist/zonos-elements/{p-78a95cee.entry.js → p-aa651c8f.entry.js} +1 -1
  82. package/dist/zonos-elements/{p-8e436df2.system.entry.js → p-bdf93de1.system.entry.js} +1 -1
  83. package/dist/zonos-elements/{p-f80f24a0.js → p-d53968eb.js} +2 -2
  84. package/dist/zonos-elements/p-e3f9a12b.js +1 -0
  85. package/dist/zonos-elements/{p-0ee9b22a.entry.js → p-e9f8edbb.entry.js} +1 -1
  86. package/dist/zonos-elements/{p-8964d8f8.system.js → p-ef7d14a3.system.js} +1 -1
  87. package/dist/zonos-elements/p-f4d9f007.entry.js +1 -0
  88. package/dist/zonos-elements/{p-a450910c.entry.js → p-f4eaf289.entry.js} +1 -1
  89. package/dist/zonos-elements/p-fe253cc1.js +1 -0
  90. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  91. package/package.json +1 -1
  92. package/dist/cjs/CheckoutConfig-fb59baa3.js +0 -90
  93. package/dist/esm/CheckoutConfig-63b3ed06.js +0 -86
  94. package/dist/esm-es5/CheckoutConfig-63b3ed06.js +0 -1
  95. package/dist/esm-es5/cart-54d84646.js +0 -1
  96. package/dist/zonos-elements/p-19ac0f84.system.entry.js +0 -1
  97. package/dist/zonos-elements/p-416ac901.entry.js +0 -1
  98. package/dist/zonos-elements/p-4a87a92c.entry.js +0 -1
  99. package/dist/zonos-elements/p-75b771cf.js +0 -1
  100. package/dist/zonos-elements/p-84dd312c.system.js +0 -1
  101. package/dist/zonos-elements/p-869bbedc.js +0 -1
  102. package/dist/zonos-elements/p-b86b82eb.entry.js +0 -1
  103. package/dist/zonos-elements/p-c10f4e56.system.js +0 -1
  104. package/dist/zonos-elements/p-d74ab632.system.entry.js +0 -1
  105. package/dist/zonos-elements/p-e0d3aeae.system.js +0 -1
@@ -1 +0,0 @@
1
- var __awaiter=this&&this.__awaiter||function(t,n,o,i){function e(t){return t instanceof o?t:new o((function(n){n(t)}))}return new(o||(o=Promise))((function(o,r){function u(t){try{c(i.next(t))}catch(t){r(t)}}function s(t){try{c(i["throw"](t))}catch(t){r(t)}}function c(t){t.done?o(t.value):e(t.value).then(u,s)}c((i=i.apply(t,n||[])).next())}))};var __generator=this&&this.__generator||function(t,n){var o={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},i,e,r,u;return u={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(u[Symbol.iterator]=function(){return this}),u;function s(t){return function(n){return c([t,n])}}function c(s){if(i)throw new TypeError("Generator is already executing.");while(u&&(u=0,s[0]&&(o=0)),o)try{if(i=1,e&&(r=s[0]&2?e["return"]:s[0]?e["throw"]||((r=e["return"])&&r.call(e),0):e.next)&&!(r=r.call(e,s[1])).done)return r;if(e=0,r)s=[s[0]&2,r.value];switch(s[0]){case 0:case 1:r=s;break;case 4:o.label++;return{value:s[1],done:false};case 5:o.label++;e=s[1];s=[0];continue;case 7:s=o.ops.pop();o.trys.pop();continue;default:if(!(r=o.trys,r=r.length>0&&r[r.length-1])&&(s[0]===6||s[0]===2)){o=0;continue}if(s[0]===3&&(!r||s[1]>r[0]&&s[1]<r[3])){o.label=s[1];break}if(s[0]===6&&o.label<r[1]){o.label=r[1];r=s;break}if(r&&o.label<r[2]){o.label=r[2];o.ops.push(s);break}if(r[2])o.ops.pop();o.trys.pop();continue}s=n.call(t,o)}catch(t){s=[6,t];e=0}finally{i=r=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};System.register(["./p-4caffd96.system.js","./p-84dd312c.system.js","./p-5187ba8f.system.js","./p-1b75aa35.system.js","./p-69255ed2.system.js","./p-e4f8114a.system.js"],(function(t){"use strict";var n,o,i,e,r,u,s,c,a,f,d,l,h,v,w;return{setters:[function(t){n=t.r;o=t.c;i=t.h;e=t.H},function(t){r=t.G;u=t.f;s=t.H;c=t.e;a=t.a},function(t){f=t.z;d=t.b;l=t.d},function(t){h=t.h;v=t.b;w=t.l},function(){},function(){}],execute:function(){var m=this;var _=function(){return __awaiter(m,void 0,void 0,(function(){var t,n,o,i;return __generator(this,(function(e){switch(e.label){case 0:return[4,h("/api/zonos-elements/zonos-settings")];case 1:t=e.sent(),n=t.errors,o=t.json,i=t.zonosMode;if(n.length){v("Error occurred when getting zonos settings. If this is not an unauthorized error, it will use user settings or default settings");return[2,{errors:n,json:null,zonosMode:i}]}return[2,{errors:[],json:o,zonosMode:i}]}}))}))};var p=function(){var t=document.querySelector("zonos-checkout");if(!t){var n=document.createElement("zonos-checkout");document.body.appendChild(n)}};var b=function(t){if(!t.placeOrderButtonSelector&&!window.Zonos.cartData){return}if(t.placeOrderButtonSelector&&!r(t.placeOrderButtonSelector)){v('Selector checkoutButtonAnchor "'.concat(t.placeOrderButtonSelector,'" is not a valid selector'));return}p()};var g=function(t){var n=document.querySelector(t);var o=document.querySelector("zonos-hello");if(!o&&n){var i=document.createElement("zonos-hello");n.appendChild(i);return true}return false};var y=function(t){switch(t){case"BOTTOM_RIGHT":return"bottom-right";case"BOTTOM_LEFT":return"bottom-left";case"TOP_LEFT":return"top-left";case"TOP_RIGHT":return"top-right";default:return"bottom-right"}};var z=function(t){var n=t.position,o=n===void 0?"bottom-right":n;var i=".zonos--hello-mobile-wrapper";var e=document.querySelector(i);if(e){return i}var r=document.createElement("div");r.className="zonos--hello-mobile-wrapper";r.style.position="fixed";if(o==="top-right"){r.style.top="72px";r.style.right="24px"}if(o==="top-left"){r.style.top="72px";r.style.left="24px"}if(o==="bottom-right"){r.style.bottom="72px";r.style.right="24px"}if(o==="bottom-left"){r.style.bottom="72px";r.style.left="24px"}r.style.zIndex="2147483007";document.body.appendChild(r);return i};var O=function(t){return __awaiter(m,void 0,void 0,(function(){var n,o,i,e,u;return __generator(this,(function(s){if(window.Zonos.isLegacyCheckout){w("Hello is disabled when isLegacyCheckout","info");return[2]}n=t.anchorElementSelector;o=n;if(!t.anchorElementSelector&&t.desktopLocation){i=z({position:"bottom-right"});o=i}if(!o||!r(o)){v('Selector anchorElementSelector "'.concat(t.anchorElementSelector,'" is not a valid selector.'));return[2]}w("Hello init complete");e=g(o);if(!e){u=new MutationObserver((function(){var t=g(o);if(t){u.disconnect()}}));u.observe(document.body,{childList:true,subtree:true});setTimeout((function(){g(o)}),1e3);setTimeout((function(){if(t.notFoundElementFallback){w("Hello anchor selector ".concat(t.anchorElementSelector," not found after 3 seconds, falling back to 'notFoundElementFallback': ").concat(t.notFoundElementFallback),"info");var n=z({position:y(t.notFoundElementFallback)});g(n)}}),3e3)}return[2]}))}))};var S=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{visibility:hidden;opacity:0;height:0}";var j=S;var k=t("zonos_controller",function(){function t(t){n(this,t);this.paypalInitEvent=o(this,"paypalInitEvent",7);this.stripeInitEvent=o(this,"stripeInitEvent",7);this.config=undefined;this.zonosApiKey=undefined}t.prototype.initCheckoutElement=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(n){if(!t){w("Stripe is not loaded yet - cannot init checkout element","warn");return[2]}u.stripe=t;void b(f.checkoutSettings);w("init checkout element");return[2]}))}))};t.prototype.initZonosNotification=function(){var t=document.querySelector("zonos-notification");if(t){return}var n=document.createElement("zonos-notification");document.body.appendChild(n)};t.prototype.setupGoogleFont=function(t){return __awaiter(this,void 0,void 0,(function(){var n,o,i,e,r,u,s,c;return __generator(this,(function(a){switch(a.label){case 0:i=t||l();if(i==="Inter"){if(!t){return[2]}w("[FONT] Just applied Inter , but no need to inject since we already inject Inter on start","warn");f.appearance=Object.assign(Object.assign({},f.appearance),{fontFamily:t})}e=new URLSearchParams;e.set("family",i);return[4,h("/api/zonos-elements/get-font-detail?".concat(e.toString()))];case 1:r=a.sent(),u=r.errors,s=r.json;if(u.length>0){w("Failed to load font ".concat(i),"warn");f.appearance=Object.assign(Object.assign({},f.appearance),{fontFamily:"Inter"});return[2]}c=s===null||s===void 0?void 0:s.fontUrl;if(c){(o=(n=window.Zonos).injectSupportGoogleFont)===null||o===void 0?void 0:o.call(n,c)}if(!t){return[2]}w("[FONT] ".concat(t," font override applied"));f.appearance=Object.assign(Object.assign({},f.appearance),{fontFamily:t});return[2]}}))}))};t.prototype.handleLocationChange=function(){void O(f.helloSettings)};t.prototype.initHistoryListener=function(){var t=history.pushState;history.pushState=function n(){window.dispatchEvent(new window.Event("pushstate"));window.dispatchEvent(new window.Event("locationchange"));return t.apply(this,arguments)};var n=history.replaceState;history.replaceState=function t(){window.dispatchEvent(new window.Event("replacestate"));window.dispatchEvent(new window.Event("locationchange"));return n.apply(this,arguments)}};t.prototype.injectCustomHTML=function(t){if(!t){return}if(!window.Zonos.isLegacyCheckout){w("=== Skip injecting custom HTML for hosted checkout","info");return}w("=== Injecting custom HTML for hosted checkout");var n=document.createElement("template");n.innerHTML=t;var o=n.content.querySelectorAll("script");o.forEach((function(t){var n=document.createElement("script");if(t.src){n.src=t.src;n.async=t.async}else{n.textContent=t.innerHTML}document.body.appendChild(n)}))};t.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var t=this;return __generator(this,(function(n){this.initHistoryListener();f.zonosApiKey=this.zonosApiKey;(function(){return __awaiter(t,void 0,void 0,(function(){var t,n,o,i,e,r,u,c,a,l,h,v,m,p,b;var g=this;return __generator(this,(function(y){switch(y.label){case 0:return[4,_()];case 1:u=y.sent(),c=u.errors,a=u.json,l=u.zonosMode;if(((n=(t=c[0])===null||t===void 0?void 0:t.type)===null||n===void 0?void 0:n.toString())==="403"){w("Failed to load zonos settings. This domain may not have access","warn");return[2]}h=((o=a===null||a===void 0?void 0:a.checkoutSettings)===null||o===void 0?void 0:o.customHTML)||"";this.injectCustomHTML(h);this.initZonosNotification();v=function(){var t,n,o;if(window.Zonos.isLegacyCheckout){return((t=a===null||a===void 0?void 0:a.appearanceSettings)===null||t===void 0?void 0:t.logoUrl)||((n=g.config.appearance)===null||n===void 0?void 0:n.logoUrl)}return(o=g.config.appearance)===null||o===void 0?void 0:o.logoUrl};m=window.Zonos.isLegacyCheckout&&!!window.Zonos.cartData&&((i=this.config.checkoutSettings)===null||i===void 0?void 0:i.successBehavior)==="CLOSE_MODAL";p=Object.assign(Object.assign({},this.config),{appearance:Object.assign(Object.assign({},this.config.appearance),{logoUrl:v()}),checkoutSettings:this.config.checkoutSettings?Object.assign(Object.assign({},this.config.checkoutSettings),{allowedSettlementCurrencies:undefined,captureDelay:undefined,subscriptionStatus:undefined,successBehavior:m?"ZONOS_SUCCESS_PAGE":this.config.checkoutSettings.successBehavior,successRedirectUrl:m?((e=window.Zonos.cartData)===null||e===void 0?void 0:e.storeBaseUrl)||(a===null||a===void 0?void 0:a.onlineStoreSettings.url):this.config.checkoutSettings.successRedirectUrl}):undefined});d({overrideSettings:p,zonosSettings:a});f.zonosMode=l;void this.setupGoogleFont();if(f.helloSettings.visibilityStatus==="DISABLED"){w("=== Hello is disabled by store owner ===","warn")}if(f.helloSettings&&f.helloSettings.visibilityStatus==="ENABLED"){w("Initializing hello");void O(f.helloSettings)}return[4,s()];case 2:y.sent();b=((r=a===null||a===void 0?void 0:a.checkoutSettings)===null||r===void 0?void 0:r.externalServiceTokens.find((function(t){return t.type==="STRIPE_PUBLISHABLE_TOKEN"})))||null;if(!b||!this.stripeInitEvent){w("Checkout failed to load -- missing publishable key","warn");return[2]}if(f.checkoutSettings.subscriptionStatus==="INACTIVE"){w('=== Checkout subscription is "INACTIVE" - Cancel initializing for Checkout ===',"warn");w("zonos controller loaded");return[2]}if(f.checkoutSettings.visibilityStatus==="DISABLED"){w("=== Checkout is disabled by store owner ===","warn");w("zonos controller loaded");return[2]}this.stripeInitEvent.emit({publishableKey:b.token});return[2]}}))}))})();return[2]}))}))};t.prototype.showNotification=function(t){return __awaiter(this,void 0,void 0,(function(){var n;return __generator(this,(function(o){n=document.querySelector("zonos-notification");if(!n){w("Failed to show notification - zonos-notification not found","warn");return[2]}void n.showNotification(t);return[2]}))}))};t.prototype.reset=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){c.checkoutSessionId=null;u.clientSecret="";return[2]}))}))};t.prototype.overrideConfig=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(n){d({overrideSettings:t,zonosSettings:null});return[2]}))}))};t.prototype.overrideCountry=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(n){w("Override country code to ".concat(t));void a(t);return[2]}))}))};t.prototype.getAppearanceSetting=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){return[2,f.appearance]}))}))};t.prototype.updateOrganizationName=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(n){f.organizationName=t;return[2]}))}))};t.prototype.render=function(){return i(e,{key:"eed6d0d8b034a43bb4bccf5937b8eccc5d5744c9",class:"zonos--elements"})};return t}());k.style=j}}}));
@@ -1 +0,0 @@
1
- import{r as t,h as o,H as s,d as n,c as a}from"./p-ab68ad11.js";import{d as e}from"./p-30fdcbee.js";import{c as i}from"./p-b4b7f705.js";import{g as r}from"./p-a1cfbd0a.js";import{f as p,t as h}from"./p-75b771cf.js";import{b as c,l}from"./p-0fc02cde.js";import{d as y}from"./p-f80f24a0.js";import"./p-98aa88b1.js";const m=class{constructor(o){t(this,o),this.emptyStateText=void 0,this.theme="LIGHT"}render(){return this.el.shadowRoot?(this.el.shadowRoot.innerHTML="DARK"===this.theme?'<svg width="536" height="200" viewBox="0 0 536 200" fill="none" xmlns="http://www.w3.org/2000/svg">\n<mask id="mask0_3739_19124" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="0" y="0" width="536" height="200">\n<rect width="536" height="200" fill="url(#paint0_radial_3739_19124)"/>\n</mask>\n<g mask="url(#mask0_3739_19124)">\n<rect x="0.5" y="0.5" width="117" height="63" rx="9.5" stroke="white" stroke-opacity="0.08"/>\n<rect x="126.5" y="0.5" width="117" height="63" rx="9.5" stroke="white" stroke-opacity="0.08"/>\n<rect x="252.5" y="0.5" width="117" height="63" rx="9.5" stroke="white" stroke-opacity="0.08"/>\n<rect x="378.5" y="0.5" width="117" height="63" rx="9.5" stroke="white" stroke-opacity="0.08"/>\n<rect x="504.5" y="0.5" width="31" height="63" rx="9.5" stroke="white" stroke-opacity="0.08"/>\n<rect y="96" width="124" height="8" rx="4" fill="white" fill-opacity="0.08"/>\n<rect x="0.5" y="112.5" width="535" height="39" rx="7.5" stroke="white" stroke-opacity="0.08"/>\n<rect x="0.5" y="160.5" width="263" height="39" rx="7.5" stroke="white" stroke-opacity="0.08"/>\n<rect x="272.5" y="160.5" width="263" height="39" rx="7.5" stroke="white" stroke-opacity="0.08"/>\n</g>\n<defs>\n<radialGradient id="paint0_radial_3739_19124" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(268 100) rotate(90) scale(100 268)">\n<stop offset="0.25" stop-color="white" stop-opacity="0"/>\n<stop offset="0.75" stop-color="white"/>\n</radialGradient>\n</defs>\n</svg>\n':'<svg width="536" height="200" viewBox="0 0 536 200" fill="none" xmlns="http://www.w3.org/2000/svg">\n<mask id="mask0_3739_19125" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="0" y="0" width="536" height="200">\n<rect width="536" height="200" fill="url(#paint0_radial_3739_19125)"/>\n</mask>\n<g mask="url(#mask0_3739_19125)">\n<rect x="0.5" y="0.5" width="117" height="63" rx="9.5" stroke="black" stroke-opacity="0.08"/>\n<rect x="126.5" y="0.5" width="117" height="63" rx="9.5" stroke="black" stroke-opacity="0.08"/>\n<rect x="252.5" y="0.5" width="117" height="63" rx="9.5" stroke="black" stroke-opacity="0.08"/>\n<rect x="378.5" y="0.5" width="117" height="63" rx="9.5" stroke="black" stroke-opacity="0.08"/>\n<rect x="504.5" y="0.5" width="31" height="63" rx="9.5" stroke="black" stroke-opacity="0.08"/>\n<rect y="96" width="124" height="8" rx="4" fill="black" fill-opacity="0.08"/>\n<rect x="0.5" y="112.5" width="535" height="39" rx="7.5" stroke="black" stroke-opacity="0.08"/>\n<rect x="0.5" y="160.5" width="263" height="39" rx="7.5" stroke="black" stroke-opacity="0.08"/>\n<rect x="272.5" y="160.5" width="263" height="39" rx="7.5" stroke="black" stroke-opacity="0.08"/>\n</g>\n<defs>\n<radialGradient id="paint0_radial_3739_19125" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(268 100) rotate(90) scale(100 268)">\n<stop offset="0.25" stop-color="white" stop-opacity="0"/>\n<stop offset="0.75" stop-color="white"/>\n</radialGradient>\n</defs>\n</svg>\n',o(s,{class:"zonos--elements",style:{"--zonos--font-family":e(),"--zonos--height":"100%","--zonos--width":"100%"}},o("zonos-text",{type:"semiBoldLabel"},this.emptyStateText))):null}get el(){return n(this)}};m.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;position:relative}:host zonos-text{position:absolute;left:0;right:0;bottom:0;top:0;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}:host svg{width:var(--zonos--width);height:var(--zonos--height)}";const d=class{constructor(o){t(this,o),this.notificationArray=[]}async showNotification(t){const o=`id-${Math.random().toString(36).substring(2,9)}`,s=Object.assign(Object.assign({},t),{id:o,timeout:t.timeout||5e3,transitionClass:"",type:t.type||"success"});this.notificationArray=[...this.notificationArray,s],setTimeout((()=>{this.updateTransitionClass({id:o,transitionClass:"show"})}),50),setTimeout((()=>{this.removeNotification(o)}),s.timeout)}updateTransitionClass({id:t,transitionClass:o}){this.notificationArray=this.notificationArray.map((s=>s.id===t?Object.assign(Object.assign({},s),{transitionClass:o}):s))}removeNotification(t){this.updateTransitionClass({id:t,transitionClass:""}),setTimeout((()=>{this.notificationArray=this.notificationArray.filter((o=>o.id!==t))}),300)}render(){return o(s,{key:"6a790a39afc037ae56f8a53dc89c3fa899b2d659",class:i(["zonos--elements zonos--notification"]),style:{"--zonos--border-radius":r(),"--zonos--font-family":e()}},o("div",{key:"32245a784f2322fb69a65b491648a30a84b0b3d3",class:"zonos--notification-items"},this.notificationArray.map((t=>o("div",{"aria-hidden":"true",class:i(["zonos--notification-item",t.type,t.transitionClass]),key:t.id,onClick:()=>{this.removeNotification(t.id)}},o("zonos-text",{textColor:"gray-0"},t.message))))))}};d.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-flexbox;display:flex;-ms-flex-pack:center;justify-content:center}:host .zonos--notification-items{position:fixed;z-index:9999999999;bottom:24px;gap:8px;display:-ms-inline-flexbox;display:inline-flex;-ms-flex-direction:column;flex-direction:column}:host .zonos--notification-item{cursor:pointer;-webkit-transition:all 0.3s ease;transition:all 0.3s ease;padding:8px;border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-6));opacity:0;-ms-flex-negative:0.0001;flex-shrink:0.0001;-webkit-transform:translateY(100%);transform:translateY(100%)}:host .zonos--notification-item+:host .zonos--notification-item{margin-top:8px}:host .zonos--notification-item.show{opacity:1;-webkit-transform:translateY(0);transform:translateY(0);-ms-flex-positive:1000;flex-grow:1000}:host .zonos--notification-item.success{background-color:var(--zonos-elements-green-700)}:host .zonos--notification-item.error{background-color:var(--zonos-elements-red-700)}:host .zonos--notification-item.warning{background-color:var(--zonos-elements-orange-700)}";const f=class{constructor(o){t(this,o),this.trackingSent=!1,this.titleText=void 0,this.stripe=p.stripe,this.stripeElements=p.stripeElements,this.isPaymentInfoFilled=!1}watchIsPaymentInfoFilled(){var t;this.isPaymentInfoFilled&&!this.trackingSent&&(h("checkout_paymentInfoFilled",{paymentMethod:null===(t=p.stripePaymentEventData)||void 0===t?void 0:t.value.type}),this.trackingSent=!0)}watchInitStripe(){if(!this.stripeElements)return;const t=p.stripePaymentElement||this.stripeElements.create("payment",{layout:"tabs"}),o=this.el.querySelector(".zonos--payment-component");o?(t.mount(o),t.on("change",(t=>{t.complete&&(this.isPaymentInfoFilled=!0),p.stripePaymentEventData=t})),p.stripePaymentElement=t):c("Cannot find container element for paymentElement")}componentDidLoad(){this.watchInitStripe()}render(){return o(s,{key:"3e9f3439e139f6d040bcf8fc101f19d011debdc8",class:"zonos--payment zonos--elements"},this.titleText&&o("zonos-text",{key:"2f22806f4f9380e610899a997ce9ed2bfe997be4",class:"zonos--title",type:"semiBoldLabel"},this.titleText),o("div",{key:"4d5dbd7828b3037d69adb50d4fee4ea9abf3b59b",class:"zonos--payment-component"}),o("div",{key:"32ee62f62a028da8481d95781a7368c60ae42614",class:"zonos--payment-paypal-container"}))}get el(){return n(this)}static get watchers(){return{isPaymentInfoFilled:["watchIsPaymentInfoFilled"],stripeElements:["watchInitStripe"],stripe:["watchInitStripe"]}}};f.style=".sc-zonos-payment-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-payment-h *.sc-zonos-payment{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-payment-h img.sc-zonos-payment{max-width:100%}.sc-zonos-payment-h dl.sc-zonos-payment,.sc-zonos-payment-h dd.sc-zonos-payment,.sc-zonos-payment-h h1.sc-zonos-payment,.sc-zonos-payment-h h2.sc-zonos-payment,.sc-zonos-payment-h h3.sc-zonos-payment,.sc-zonos-payment-h h4.sc-zonos-payment,.sc-zonos-payment-h h5.sc-zonos-payment,.sc-zonos-payment-h h6.sc-zonos-payment,.sc-zonos-payment-h hr.sc-zonos-payment,.sc-zonos-payment-h figure.sc-zonos-payment,.sc-zonos-payment-h p.sc-zonos-payment,.sc-zonos-payment-h pre.sc-zonos-payment{margin:0}.sc-zonos-payment-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-payment-h .zonos--title.sc-zonos-payment{margin-bottom:16px}.sc-zonos-payment-h .zonos--payment-component.sc-zonos-payment{margin-bottom:4px}";const z=class{constructor(o){t(this,o),this.paypalSessionDone=a(this,"paypalSessionDone",7),this.paypalSessionFail=a(this,"paypalSessionFail",7)}async loadPaypal(){if(!window.Zonos.paypal)return void l("Paypal is not available");const t=y({onPaypalFail:()=>{l("onPaypalFail"),this.paypalSessionFail.emit()},onPaypalSessionDone:({orderId:t})=>{l("onPaypalSessionDone","info",{orderId:t}),this.paypalSessionDone.emit({orderId:t})}});if(!(null==t?void 0:t.length))return void l("There are no paypal buttons available");const o=this.el.querySelector(".zonos--payment-paypal-container");o?t.forEach((async t=>{await t.render(o)})):l("Cannot find container element for paypal buttons")}componentDidLoad(){this.loadPaypal()}render(){return o(s,{key:"7be3c38f702c8fb105c54e652774f69fbbcfd34c",class:"zonos--paypal-payment zonos--elements"},o("div",{key:"6845b53c2a5d1f2637f3ae9d867d2c6de48ab1b5",class:"zonos--payment-paypal-container"}))}get el(){return n(this)}};z.style=".sc-zonos-paypal-payment-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-paypal-payment-h *.sc-zonos-paypal-payment{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-paypal-payment-h img.sc-zonos-paypal-payment{max-width:100%}.sc-zonos-paypal-payment-h dl.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h dd.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h1.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h2.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h3.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h4.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h5.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h h6.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h hr.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h figure.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h p.sc-zonos-paypal-payment,.sc-zonos-paypal-payment-h pre.sc-zonos-paypal-payment{margin:0}.sc-zonos-paypal-payment-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-paypal-payment-h{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-direction:column;flex-direction:column}";export{m as zonos_empty_state_payment,d as zonos_notification,f as zonos_payment,z as zonos_paypal_payment}
@@ -1 +0,0 @@
1
- import{r as o,c as t,h as n,H as e}from"./p-ab68ad11.js";import{G as i,f as s,H as r,e as c,a}from"./p-75b771cf.js";import{z as l,b as d,d as h}from"./p-30fdcbee.js";import{h as u,b as f,l as m}from"./p-0fc02cde.js";import"./p-98aa88b1.js";import"./p-a1cfbd0a.js";const p=o=>{const t=document.querySelector(o);if(!document.querySelector("zonos-hello")&&t){const o=document.createElement("zonos-hello");return t.appendChild(o),!0}return!1},w=o=>{switch(o){case"BOTTOM_RIGHT":default:return"bottom-right";case"BOTTOM_LEFT":return"bottom-left";case"TOP_LEFT":return"top-left";case"TOP_RIGHT":return"top-right"}},v=({position:o="bottom-right"})=>{const t=".zonos--hello-mobile-wrapper";if(document.querySelector(t))return t;const n=document.createElement("div");return n.className="zonos--hello-mobile-wrapper",n.style.position="fixed","top-right"===o&&(n.style.top="72px",n.style.right="24px"),"top-left"===o&&(n.style.top="72px",n.style.left="24px"),"bottom-right"===o&&(n.style.bottom="72px",n.style.right="24px"),"bottom-left"===o&&(n.style.bottom="72px",n.style.left="24px"),n.style.zIndex="2147483007",document.body.appendChild(n),t},b=async o=>{if(window.Zonos.isLegacyCheckout)return void m("Hello is disabled when isLegacyCheckout","info");const{anchorElementSelector:t}=o;let n=t;if(!o.anchorElementSelector&&o.desktopLocation){const o=v({position:"bottom-right"});n=o}if(n&&i(n)){if(m("Hello init complete"),!p(n)){const t=new MutationObserver((()=>{p(n)&&t.disconnect()}));t.observe(document.body,{childList:!0,subtree:!0}),setTimeout((()=>{p(n)}),1e3),setTimeout((()=>{if(o.notFoundElementFallback){m(`Hello anchor selector ${o.anchorElementSelector} not found after 3 seconds, falling back to 'notFoundElementFallback': ${o.notFoundElementFallback}`,"info");const t=v({position:w(o.notFoundElementFallback)});p(t)}}),3e3)}}else f(`Selector anchorElementSelector "${o.anchorElementSelector}" is not a valid selector.`)},g=class{constructor(n){o(this,n),this.paypalInitEvent=t(this,"paypalInitEvent",7),this.stripeInitEvent=t(this,"stripeInitEvent",7),this.config=void 0,this.zonosApiKey=void 0}async initCheckoutElement(o){var t;o?(s.stripe=o,((t=l.checkoutSettings).placeOrderButtonSelector||window.Zonos.cartData)&&(!t.placeOrderButtonSelector||i(t.placeOrderButtonSelector)?(()=>{if(!document.querySelector("zonos-checkout")){const o=document.createElement("zonos-checkout");document.body.appendChild(o)}})():f(`Selector checkoutButtonAnchor "${t.placeOrderButtonSelector}" is not a valid selector`)),m("init checkout element")):m("Stripe is not loaded yet - cannot init checkout element","warn")}initZonosNotification(){if(document.querySelector("zonos-notification"))return;const o=document.createElement("zonos-notification");document.body.appendChild(o)}async setupGoogleFont(o){var t,n;const e=o||h();if("Inter"===e){if(!o)return;m("[FONT] Just applied Inter , but no need to inject since we already inject Inter on start","warn"),l.appearance=Object.assign(Object.assign({},l.appearance),{fontFamily:o})}const i=new URLSearchParams;i.set("family",e);const{errors:s,json:r}=await u(`/api/zonos-elements/get-font-detail?${i.toString()}`);if(s.length>0)return m(`Failed to load font ${e}`,"warn"),void(l.appearance=Object.assign(Object.assign({},l.appearance),{fontFamily:"Inter"}));const c=null==r?void 0:r.fontUrl;c&&(null===(n=(t=window.Zonos).injectSupportGoogleFont)||void 0===n||n.call(t,c)),o&&(m(`[FONT] ${o} font override applied`),l.appearance=Object.assign(Object.assign({},l.appearance),{fontFamily:o}))}handleLocationChange(){b(l.helloSettings)}initHistoryListener(){const o=history.pushState;history.pushState=function(){return window.dispatchEvent(new window.Event("pushstate")),window.dispatchEvent(new window.Event("locationchange")),o.apply(this,arguments)};const t=history.replaceState;history.replaceState=function(){return window.dispatchEvent(new window.Event("replacestate")),window.dispatchEvent(new window.Event("locationchange")),t.apply(this,arguments)}}injectCustomHTML(o){if(!o)return;if(!window.Zonos.isLegacyCheckout)return void m("=== Skip injecting custom HTML for hosted checkout","info");m("=== Injecting custom HTML for hosted checkout");const t=document.createElement("template");t.innerHTML=o,t.content.querySelectorAll("script").forEach((o=>{const t=document.createElement("script");o.src?(t.src=o.src,t.async=o.async):t.textContent=o.innerHTML,document.body.appendChild(t)}))}async componentWillLoad(){this.initHistoryListener(),l.zonosApiKey=this.zonosApiKey,(async()=>{var o,t,n,e,i,s;const{errors:c,json:a,zonosMode:h}=await(async()=>{const{errors:o,json:t,zonosMode:n}=await u("/api/zonos-elements/zonos-settings");return o.length?(f("Error occurred when getting zonos settings. If this is not an unauthorized error, it will use user settings or default settings"),{errors:o,json:null,zonosMode:n}):{errors:[],json:t,zonosMode:n}})();if("403"===(null===(t=null===(o=c[0])||void 0===o?void 0:o.type)||void 0===t?void 0:t.toString()))return void m("Failed to load zonos settings. This domain may not have access","warn");const p=(null===(n=null==a?void 0:a.checkoutSettings)||void 0===n?void 0:n.customHTML)||"";this.injectCustomHTML(p),this.initZonosNotification();const w=window.Zonos.isLegacyCheckout&&!!window.Zonos.cartData&&"CLOSE_MODAL"===(null===(e=this.config.checkoutSettings)||void 0===e?void 0:e.successBehavior),v=Object.assign(Object.assign({},this.config),{appearance:Object.assign(Object.assign({},this.config.appearance),{logoUrl:(()=>{var o,t,n;return window.Zonos.isLegacyCheckout?(null===(o=null==a?void 0:a.appearanceSettings)||void 0===o?void 0:o.logoUrl)||(null===(t=this.config.appearance)||void 0===t?void 0:t.logoUrl):null===(n=this.config.appearance)||void 0===n?void 0:n.logoUrl})()}),checkoutSettings:this.config.checkoutSettings?Object.assign(Object.assign({},this.config.checkoutSettings),{allowedSettlementCurrencies:void 0,captureDelay:void 0,subscriptionStatus:void 0,successBehavior:w?"ZONOS_SUCCESS_PAGE":this.config.checkoutSettings.successBehavior,successRedirectUrl:w?(null===(i=window.Zonos.cartData)||void 0===i?void 0:i.storeBaseUrl)||(null==a?void 0:a.onlineStoreSettings.url):this.config.checkoutSettings.successRedirectUrl}):void 0});d({overrideSettings:v,zonosSettings:a}),l.zonosMode=h,this.setupGoogleFont(),"DISABLED"===l.helloSettings.visibilityStatus&&m("=== Hello is disabled by store owner ===","warn"),l.helloSettings&&"ENABLED"===l.helloSettings.visibilityStatus&&(m("Initializing hello"),b(l.helloSettings)),await r();const g=(null===(s=null==a?void 0:a.checkoutSettings)||void 0===s?void 0:s.externalServiceTokens.find((o=>"STRIPE_PUBLISHABLE_TOKEN"===o.type)))||null;if(g&&this.stripeInitEvent)return"INACTIVE"===l.checkoutSettings.subscriptionStatus?(m('=== Checkout subscription is "INACTIVE" - Cancel initializing for Checkout ===',"warn"),void m("zonos controller loaded")):"DISABLED"===l.checkoutSettings.visibilityStatus?(m("=== Checkout is disabled by store owner ===","warn"),void m("zonos controller loaded")):void this.stripeInitEvent.emit({publishableKey:g.token});m("Checkout failed to load -- missing publishable key","warn")})()}async showNotification(o){const t=document.querySelector("zonos-notification");t?t.showNotification(o):m("Failed to show notification - zonos-notification not found","warn")}async reset(){c.checkoutSessionId=null,s.clientSecret=""}async overrideConfig(o){d({overrideSettings:o,zonosSettings:null})}async overrideCountry(o){m(`Override country code to ${o}`),a(o)}async getAppearanceSetting(){return l.appearance}async updateOrganizationName(o){l.organizationName=o}render(){return n(e,{key:"eed6d0d8b034a43bb4bccf5937b8eccc5d5744c9",class:"zonos--elements"})}};g.style=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{visibility:hidden;opacity:0;height:0}";export{g as zonos_controller}