@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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zonos/elements",
3
- "version": "1.3.158",
3
+ "version": "1.3.160",
4
4
  "description": "Zonos component UI for Stripe elements",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.cjs.js",
@@ -1,17 +0,0 @@
1
- import{z as o,c as r}from"./p-d29e8aaa.js";import{F as e,f as n,e as t,z as a,r as i,x as s,k as l}from"./p-98fbd95f.js";import{h as c,l as u,b as d,j as p}from"./p-f0c8150e.js";import{t as v}from"./p-05a4d995.js";
2
- /*!
3
- * paypal-js v8.1.0 (2024-06-07T16:55:00.122Z)
4
- * Copyright 2020-present, PayPal, Inc. All rights reserved.
5
- *
6
- * Licensed under the Apache License, Version 2.0 (the "License");
7
- * you may not use this file except in compliance with the License.
8
- * You may obtain a copy of the License at
9
- *
10
- * http://www.apache.org/licenses/LICENSE-2.0
11
- *
12
- * Unless required by applicable law or agreed to in writing, software
13
- * distributed under the License is distributed on an "AS IS" BASIS,
14
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- * See the License for the specific language governing permissions and
16
- * limitations under the License.
17
- */function f(o,r){void 0===r&&(r={});var e=document.createElement("script");return e.src=o,Object.keys(r).forEach((function(o){e.setAttribute(o,r[o]),"data-csp-nonce"===o&&e.setAttribute("nonce",r["data-csp-nonce"])})),e}function y(o){return window[o]}function w(o,r){if("object"!=typeof o||null===o)throw new Error("Expected an options object.");var e=o.environment;if(e&&"production"!==e&&"sandbox"!==e)throw new Error('The `environment` option must be either "production" or "sandbox".');if(void 0!==r&&"function"!=typeof r)throw new Error("Expected PromisePonyfill to be a function.")}const b=({backgroundColor1:o,backgroundColor2:r})=>v.readability(o,r)>2.5,h=r=>{const e=o.checkoutSettings.analyticsProviders.find((o=>"GOOGLE_ANALYTICS"===o.type));e&&"DISABLED"!==(null==e?void 0:e.status)&&"function"==typeof window.gtag&&(u("Zonos submits gtag event","log",r),window.gtag("event",r,{}))},{reset:P,state:m}=r((()=>({orderIdCreated:null,paypalButtons:[],paypalClientId:"",paypalErrorMessage:null}))),k=({checkoutSessionId:r,onPaypalFail:u,onPaypalSessionDone:v,overrideBorderRaidus:f,overridePrimaryColor:y})=>({createOrder:async()=>{const o=await e();if(!o.valid)return m.paypalErrorMessage=o.errorMessage,n.hasPaymentError=!1,n.customErrorMessage=null,null==u||u(),"";try{m.paypalErrorMessage=null,t.inventoryCheckErrorMessage=null;try{t.inventoryCheckErrorMessage=await a()}catch(o){t.inventoryCheckErrorMessage=i("Unable to check inventory. Please try again.")}return t.inventoryCheckErrorMessage?"":await(async({checkoutSessionId:o})=>{var r,e;const{errors:n,json:t}=await(async({checkoutSessionId:o})=>{const{errors:r,json:e}=await c("/api/zonos-elements/create-paypal-order",{body:{checkoutSessionId:o},method:"POST"});return{errors:r,json:e}})({checkoutSessionId:o}),a=null===(r=null==t?void 0:t.paypalOrderCreate)||void 0===r?void 0:r.paypalOrderId;if(n.length||!a)throw new Error((null===(e=n.find(Boolean))||void 0===e?void 0:e.message)||"An unexpected error occurred when creating paypal order.");return a})({checkoutSessionId:r})}catch(o){return d("Failed to create paypal order",o),m.paypalErrorMessage=i("Failed to create PayPal order. Please try again, or consider using an alternative method."),n.hasPaymentError=!1,n.customErrorMessage=null,null==u||u(),""}},onApprove:async()=>{try{m.paypalErrorMessage=null,h("zonos-checkout-payment-info");const o=await(async({checkoutSessionId:o,paypalMockResponse:r})=>{var e,n;const{errors:t,json:a}=await(async({checkoutSessionId:o,paypalMockResponse:r})=>{const{errors:e,json:n}=await c("/api/zonos-elements/capture-paypal-order",{body:{checkoutSessionId:o,paypalMockResponse:r},method:"POST"});return{errors:e,json:n}})({checkoutSessionId:o,paypalMockResponse:r}),s=null===(e=null==a?void 0:a.paypalOrderCapture.order)||void 0===e?void 0:e.id;if(t.length||!s)throw new Error((null===(n=t.find(Boolean))||void 0===n?void 0:n.message)||i("An unexpected error occurred when processing PayPal order."));return s})({checkoutSessionId:r,paypalMockResponse:window.Zonos._paypalMockResponse});m.orderIdCreated=o,null==v||v({orderId:o}),s(),l()}catch(o){if(d("==== Failed to capture paypal order",o),o instanceof Error)return(({error:o})=>{var r;const e=p(o.message),n=null===(r=null==e?void 0:e.errors.find(Boolean))||void 0===r?void 0:r.message,t=(null==n?void 0:n.match(/\[(.*?)\] (.*)/i))||[];t||(m.paypalErrorMessage=i("An unexpected error occurred when processing PayPal order."));const a=t[2]||i("An unexpected error occurred when processing PayPal order.");m.paypalErrorMessage=a})({error:o});null==u||u()}},style:{borderRadius:"SHARP"===f?0:10,color:b({backgroundColor1:"#ffc33a",backgroundColor2:y||o.appearance.colorPrimary||""})?"gold":"blue",shape:"rect"}}),j=async({currency:r})=>{var e;if(!(null===(e=o.checkoutSettings.externalPaymentMethods)||void 0===e?void 0:e.find((o=>"PAYPAL"===o.type&&"ENABLED"===o.status))))return void u("=== Paypal is disabled for this store","warn");const n=o.checkoutSettings.externalServiceTokens.find((o=>"PAYPAL_CLIENT_ID"===o.type));if(!n)return void u("Failed to load paypal -- missing paypal publishable key","warn");const t="production"===o.zonosMode&&"LIVE"===o.checkoutSettings.mode?"production":"sandbox";window.Zonos.paypal=await function(o,r){if(void 0===r&&(r=Promise),w(o,r),"undefined"==typeof document)return r.resolve(null);var e=function(o){var r="sandbox"===o.environment?"https://www.sandbox.paypal.com/sdk/js":"https://www.paypal.com/sdk/js";delete o.environment,o.sdkBaseUrl&&(r=o.sdkBaseUrl,delete o.sdkBaseUrl);var e,n,t=o,a=Object.keys(t).filter((function(o){return null!=t[o]&&""!==t[o]})).reduce((function(o,r){var e=t[r].toString();return"data"===(r=r.replace(/[A-Z]+(?![a-z])|[A-Z]/g,(function(o,r){return(r?"-":"")+o.toLowerCase()}))).substring(0,4)||"crossorigin"===r?o.attributes[r]=e:o.queryParams[r]=e,o}),{queryParams:{},attributes:{}}),i=a.queryParams,s=a.attributes;return i["merchant-id"]&&-1!==i["merchant-id"].indexOf(",")&&(s["data-merchant-id"]=i["merchant-id"],i["merchant-id"]="*"),{url:"".concat(r,"?").concat((e=i,n="",Object.keys(e).forEach((function(o){0!==n.length&&(n+="&"),n+=o+"="+e[o]})),n)),attributes:s}}(o),n=e.url,t=e.attributes,a=t["data-namespace"]||"paypal",i=y(a);return t["data-js-sdk-library"]||(t["data-js-sdk-library"]="paypal-js"),function(o,r){var e=document.querySelector('script[src="'.concat(o,'"]'));if(null===e)return null;var n=f(o,r),t=e.cloneNode();if(delete t.dataset.uidAuto,Object.keys(t.dataset).length!==Object.keys(n.dataset).length)return null;var a=!0;return Object.keys(t.dataset).forEach((function(o){t.dataset[o]!==n.dataset[o]&&(a=!1)})),a?e:null}(n,t)&&i?r.resolve(i):function(o,r){void 0===r&&(r=Promise),w(o,r);var e=o.url,n=o.attributes;if("string"!=typeof e||0===e.length)throw new Error("Invalid url.");if(void 0!==n&&"object"!=typeof n)throw new Error("Expected attributes to be an object.");return new r((function(o,r){if("undefined"==typeof document)return o();!function(o){var r=o.onSuccess,e=o.onError,n=f(o.url,o.attributes);n.onerror=e,n.onload=r,document.head.insertBefore(n,document.head.firstElementChild)}({url:e,attributes:n,onSuccess:function(){return o()},onError:function(){var o=new Error('The script "'.concat(e,'" failed to load. Check the HTTP status code and response body in DevTools to learn more.'));return r(o)}})}))}({url:n,attributes:t},r).then((function(){var o=y(a);if(o)return o;throw new Error("The window.".concat(a," global variable is not available."))}))}({clientId:n.token,currency:r,environment:t}),u("==== Paypal script loaded")},g=o=>{var r;const e=window.Zonos.paypal;if(!e)return u("Paypal is not available"),null;const n=t.checkoutSessionId;if(!n)return u("Paypal is not available due to checkoutSessionId is not available"),null;u("==== Loading Paypal buttons"),m.paypalButtons.length&&(m.paypalButtons.forEach((async o=>{await o.close()})),m.paypalButtons=[]);const a=[null===(r=e.FUNDING)||void 0===r?void 0:r.PAYPAL].filter(Boolean);return m.paypalButtons=a.map((r=>{var t;let a=null;try{a=(null===(t=e.Buttons)||void 0===t?void 0:t.call(e,Object.assign(Object.assign({},k(Object.assign({checkoutSessionId:n,fundingSource:r},o))),{fundingSource:r})))||null}catch(o){u(`===== Failed to load paypal's "${r}" button`,"warn",o)}return(null==a?void 0:a.isEligible())?(u(`==== Paypal button ${r} loaded`),a):null})).filter(Boolean),m.paypalButtons},E=()=>{var r,e;return"ENABLED"===(null===(e=null===(r=o.checkoutSettings.externalPaymentMethods)||void 0===r?void 0:r.find((o=>"PAYPAL"===o.type)))||void 0===e?void 0:e.status)||!!m.paypalButtons.length};export{j as a,m as b,P as c,g as d,b as i,E as p,h as s}
@@ -1 +0,0 @@
1
- System.register(["./p-b4dcb658.system.js"],(function(t){"use strict";var n;return{setters:[function(t){n=t.z}],execute:function(){var r=t("g",(function(t){var r=(t===null||t===void 0?void 0:t.customRoundRadius)||"10px";var e=t===null||t===void 0?void 0:t.overrideBorderStyle;if(e){return e==="SHARP"?"0px":r}return n.appearance.style==="SHARP"?"0px":r}))}}}));
@@ -1 +0,0 @@
1
- import{z as o}from"./p-d29e8aaa.js";const p=p=>{const a=(null==p?void 0:p.customRoundRadius)||"10px",n=null==p?void 0:p.overrideBorderStyle;return n?"SHARP"===n?"0px":a:"SHARP"===o.appearance.style?"0px":a};export{p as g}
@@ -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 a,a as c}from"./p-98fbd95f.js";import{z as l,b as d,d as h}from"./p-d29e8aaa.js";import{h as u,b as f,l as m}from"./p-f0c8150e.js";import"./p-05a4d995.js";import"./p-83c9aae7.js";const w=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},p=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"),!w(n)){const t=new MutationObserver((()=>{w(n)&&t.disconnect()}));t.observe(document.body,{childList:!0,subtree:!0}),setTimeout((()=>{w(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:p(o.notFoundElementFallback)});w(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 a=null==r?void 0:r.fontUrl;a&&(null===(n=(t=window.Zonos).injectSupportGoogleFont)||void 0===n||n.call(t,a)),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;const{errors:s,json:a,zonosMode:c}=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===(o=s[0])||void 0===o?void 0:o.type.toString()))return void m("Failed to load zonos settings. This domain may not have access","warn");const h=(null===(t=null==a?void 0:a.checkoutSettings)||void 0===t?void 0:t.customHTML)||"";this.injectCustomHTML(h),this.initZonosNotification();const w=window.Zonos.isLegacyCheckout&&!!window.Zonos.cartData&&"CLOSE_MODAL"===(null===(n=this.config.checkoutSettings)||void 0===n?void 0:n.successBehavior),p=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,subscriptionStatus:void 0,successBehavior:w?"ZONOS_SUCCESS_PAGE":this.config.checkoutSettings.successBehavior,successRedirectUrl:w?null===(e=window.Zonos.cartData)||void 0===e?void 0:e.storeBaseUrl:this.config.checkoutSettings.successRedirectUrl}):void 0});d({overrideSettings:p,zonosSettings:a}),l.zonosMode=c,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 v=(null===(i=null==a?void 0:a.checkoutSettings)||void 0===i?void 0:i.externalServiceTokens.find((o=>"STRIPE_PUBLISHABLE_TOKEN"===o.type)))||null;if(v&&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:v.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(){a.checkoutSessionId=null,s.clientSecret=""}async overrideConfig(o){d({overrideSettings:o,zonosSettings:null})}async overrideCountry(o){m(`Override country code to ${o}`),c(o)}async getAppearanceSetting(){return l.appearance}async updateOrganizationName(o){l.organizationName=o}render(){return n(e,{key:"031af3ed517512a8f937ac66672f42aa28759826",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}