@zonos/elements 1.3.172 → 1.3.174

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 (129) hide show
  1. package/dist/cjs/{CheckoutConfig-c5943bbf.js → CheckoutConfig-fb59baa3.js} +1 -1
  2. package/dist/cjs/{cart-d91d9507.js → cart-93ed3002.js} +9 -1
  3. package/dist/cjs/{handleFetch-ff25db40.js → handleFetch-969d05d8.js} +36 -13
  4. package/dist/cjs/index.cjs.js +9 -9
  5. package/dist/cjs/loader.cjs.js +1 -1
  6. package/dist/cjs/{paypal-82841277.js → paypal-8b49ef07.js} +6 -2
  7. package/dist/cjs/zonos-address_7.cjs.entry.js +14 -6
  8. package/dist/cjs/zonos-cart-items_13.cjs.entry.js +17 -14
  9. package/dist/cjs/zonos-checkout.cjs.entry.js +15 -13
  10. package/dist/cjs/zonos-controller.cjs.entry.js +2 -2
  11. package/dist/cjs/zonos-country-flag.cjs.entry.js +2 -2
  12. package/dist/cjs/zonos-country-select_4.cjs.entry.js +2 -2
  13. package/dist/cjs/zonos-elements.cjs.js +1 -1
  14. package/dist/cjs/zonos-empty-state-payment_4.cjs.entry.js +20 -4
  15. package/dist/cjs/zonos-hello-dialog.cjs.entry.js +2 -2
  16. package/dist/cjs/zonos-hello.cjs.entry.js +2 -2
  17. package/dist/cjs/zonos-language-select_2.cjs.entry.js +2 -2
  18. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.js +10 -6
  19. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +2 -2
  20. package/dist/collection/components/store/checkout/paypal.js +5 -0
  21. package/dist/collection/components/store/checkout/stripe.js +7 -0
  22. package/dist/collection/components/stripe/zonos-address/zonos-address.js +12 -2
  23. package/dist/collection/components/stripe/zonos-payment/zonos-payment.js +22 -2
  24. package/dist/collection/components/utils/api/trackConversionEvent.js +1 -0
  25. package/dist/collection/components/utils/logging/getAdditionalLogMetadata.js +1 -1
  26. package/dist/collection/components/utils/logging/prepLoadTimeApiLog.js +30 -12
  27. package/dist/collection/components/utils/logging/sendBulkLoadTimeApiLog.js +6 -3
  28. package/dist/collection/types/generated/graphql.frontend.types.js +3 -0
  29. package/dist/collection/types/generated/graphql.internal.types.js +4 -0
  30. package/dist/esm/{CheckoutConfig-75af3742.js → CheckoutConfig-63b3ed06.js} +1 -1
  31. package/dist/esm/{cart-52e208cc.js → cart-54d84646.js} +9 -1
  32. package/dist/esm/{handleFetch-0109fb78.js → handleFetch-621e45bc.js} +36 -14
  33. package/dist/esm/index.js +10 -10
  34. package/dist/esm/loader.js +1 -1
  35. package/dist/esm/{paypal-2e1c560e.js → paypal-17a320c8.js} +6 -2
  36. package/dist/esm/zonos-address_7.entry.js +13 -5
  37. package/dist/esm/zonos-cart-items_13.entry.js +13 -10
  38. package/dist/esm/zonos-checkout.entry.js +12 -10
  39. package/dist/esm/zonos-controller.entry.js +2 -2
  40. package/dist/esm/zonos-country-flag.entry.js +2 -2
  41. package/dist/esm/zonos-country-select_4.entry.js +2 -2
  42. package/dist/esm/zonos-elements.js +1 -1
  43. package/dist/esm/zonos-empty-state-payment_4.entry.js +20 -4
  44. package/dist/esm/zonos-hello-dialog.entry.js +2 -2
  45. package/dist/esm/zonos-hello.entry.js +2 -2
  46. package/dist/esm/zonos-language-select_2.entry.js +2 -2
  47. package/dist/esm-es5/{CheckoutConfig-75af3742.js → CheckoutConfig-63b3ed06.js} +1 -1
  48. package/dist/esm-es5/{cart-52e208cc.js → cart-54d84646.js} +1 -1
  49. package/dist/esm-es5/handleFetch-621e45bc.js +1 -0
  50. package/dist/esm-es5/index.js +1 -1
  51. package/dist/esm-es5/loader.js +1 -1
  52. package/dist/esm-es5/{paypal-2e1c560e.js → paypal-17a320c8.js} +2 -2
  53. package/dist/esm-es5/zonos-address_7.entry.js +1 -1
  54. package/dist/esm-es5/zonos-cart-items_13.entry.js +1 -1
  55. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  56. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  57. package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
  58. package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
  59. package/dist/esm-es5/zonos-elements.js +1 -1
  60. package/dist/esm-es5/zonos-empty-state-payment_4.entry.js +1 -1
  61. package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
  62. package/dist/esm-es5/zonos-hello.entry.js +1 -1
  63. package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
  64. package/dist/scripts/index.d.ts +21 -12
  65. package/dist/scripts/index.js +1 -1
  66. package/dist/scripts/loadZonos.js +1 -1
  67. package/dist/scripts/zonos.js +1 -1
  68. package/dist/types/components/stripe/zonos-address/zonos-address.d.ts +4 -0
  69. package/dist/types/components/stripe/zonos-payment/zonos-payment.d.ts +3 -0
  70. package/dist/types/components/utils/api/getLocaleMessages.d.ts +1 -1
  71. package/dist/types/components/utils/logging/getAdditionalLogMetadata.d.ts +4 -1
  72. package/dist/types/components/utils/logging/prepLoadTimeApiLog.d.ts +2 -4
  73. package/dist/types/types/ConversionEvent.d.ts +2 -1
  74. package/dist/types/types/LogLoadScript.d.ts +22 -1
  75. package/dist/types/types/generated/graphql.frontend.types.d.ts +13 -2
  76. package/dist/types/types/generated/graphql.frontend.types.ts +23 -2
  77. package/dist/types/types/generated/graphql.internal.types.d.ts +4 -0
  78. package/dist/types/types/generated/graphql.internal.types.ts +4 -0
  79. package/dist/zonos-elements/index.esm.js +1 -1
  80. package/dist/zonos-elements/{p-1e3e4e22.entry.js → p-0ee9b22a.entry.js} +1 -1
  81. package/dist/zonos-elements/p-0fc02cde.js +1 -0
  82. package/dist/zonos-elements/{p-aa754137.system.entry.js → p-19ac0f84.system.entry.js} +1 -1
  83. package/dist/zonos-elements/{p-eb716dcc.system.entry.js → p-1b6d0895.system.entry.js} +1 -1
  84. package/dist/zonos-elements/p-1b75aa35.system.js +1 -0
  85. package/dist/zonos-elements/p-28dcd7bb.entry.js +1 -0
  86. package/dist/zonos-elements/{p-aea22783.system.entry.js → p-3d169241.system.entry.js} +1 -1
  87. package/dist/zonos-elements/p-416ac901.entry.js +1 -0
  88. package/dist/zonos-elements/p-46f6e5e9.system.js +1 -1
  89. package/dist/zonos-elements/{p-a61ef92f.entry.js → p-4a87a92c.entry.js} +1 -1
  90. package/dist/zonos-elements/{p-10a9edf6.entry.js → p-4c6dfe2e.entry.js} +1 -1
  91. package/dist/zonos-elements/p-6612e6f9.system.entry.js +1 -0
  92. package/dist/zonos-elements/{p-2d2c70a3.js → p-75b771cf.js} +1 -1
  93. package/dist/zonos-elements/{p-14bd4766.entry.js → p-78a95cee.entry.js} +1 -1
  94. package/dist/zonos-elements/{p-36c35a07.system.js → p-84dd312c.system.js} +1 -1
  95. package/dist/zonos-elements/{p-1c488ecf.js → p-869bbedc.js} +1 -1
  96. package/dist/zonos-elements/p-8964d8f8.system.js +17 -0
  97. package/dist/zonos-elements/p-8e436df2.system.entry.js +1 -0
  98. package/dist/zonos-elements/{p-91a7ca64.system.entry.js → p-9f8b820e.system.entry.js} +1 -1
  99. package/dist/zonos-elements/{p-7de48475.system.js → p-a1d54022.system.js} +1 -1
  100. package/dist/zonos-elements/p-b86b82eb.entry.js +1 -0
  101. package/dist/zonos-elements/p-c67f6666.system.entry.js +1 -0
  102. package/dist/zonos-elements/p-d22c15be.entry.js +1 -0
  103. package/dist/zonos-elements/p-d74ab632.system.entry.js +1 -0
  104. package/dist/zonos-elements/{p-c719434a.entry.js → p-d9779ea7.entry.js} +1 -1
  105. package/dist/zonos-elements/{p-048e4b38.system.entry.js → p-d98fa14c.system.entry.js} +1 -1
  106. package/dist/zonos-elements/{p-2ebb4fa7.system.js → p-e0d3aeae.system.js} +1 -1
  107. package/dist/zonos-elements/{p-9a10a63b.system.entry.js → p-e11eecbf.system.entry.js} +1 -1
  108. package/dist/zonos-elements/{p-68304407.entry.js → p-ed8a8a44.entry.js} +1 -1
  109. package/dist/zonos-elements/p-f80f24a0.js +17 -0
  110. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  111. package/package.json +1 -1
  112. package/dist/cjs/isCheckoutMobile-f491ca7c.js +0 -8
  113. package/dist/esm/isCheckoutMobile-8846dccb.js +0 -6
  114. package/dist/esm-es5/handleFetch-0109fb78.js +0 -1
  115. package/dist/esm-es5/isCheckoutMobile-8846dccb.js +0 -1
  116. package/dist/zonos-elements/p-04c38987.system.js +0 -1
  117. package/dist/zonos-elements/p-0ee42be2.system.js +0 -17
  118. package/dist/zonos-elements/p-221d4f15.system.entry.js +0 -1
  119. package/dist/zonos-elements/p-246c3b28.entry.js +0 -1
  120. package/dist/zonos-elements/p-2b8c5669.system.entry.js +0 -1
  121. package/dist/zonos-elements/p-588ac238.entry.js +0 -1
  122. package/dist/zonos-elements/p-81a54668.js +0 -1
  123. package/dist/zonos-elements/p-839448c3.js +0 -1
  124. package/dist/zonos-elements/p-85d2da79.system.entry.js +0 -1
  125. package/dist/zonos-elements/p-a08fad84.entry.js +0 -1
  126. package/dist/zonos-elements/p-aed0098c.system.js +0 -1
  127. package/dist/zonos-elements/p-ba604bc4.entry.js +0 -1
  128. package/dist/zonos-elements/p-bbf9dbe4.js +0 -17
  129. package/dist/zonos-elements/p-e34c0f83.system.entry.js +0 -1
@@ -2,9 +2,9 @@ import { r as registerInstance, h, H as Host, d as getElement, c as createEvent
2
2
  import { d as zonosStoreFontFamily } from './zonosStore-d3c5a0a5.js';
3
3
  import { c as classes } from './classes-0d95c529.js';
4
4
  import { g as getBorderRadius } from './getBorderRadius-ada3ccad.js';
5
- import { f as stripeStore } from './cart-52e208cc.js';
6
- import { b as logError, l as log } from './handleFetch-0109fb78.js';
7
- import { d as paypalStoreInitButtons } from './paypal-2e1c560e.js';
5
+ import { f as stripeStore, t as trackConversionEvent } from './cart-54d84646.js';
6
+ import { b as logError, l as log } from './handleFetch-621e45bc.js';
7
+ import { d as paypalStoreInitButtons } from './paypal-17a320c8.js';
8
8
  import './isDarkColor-446fccb7.js';
9
9
 
10
10
  const PaymentEmptyStateDarkIcon = `<svg width="536" height="200" viewBox="0 0 536 200" fill="none" xmlns="http://www.w3.org/2000/svg">
@@ -154,9 +154,21 @@ const ZonosPaymentStyle0 = zonosPaymentCss;
154
154
  const ZonosPayment = class {
155
155
  constructor(hostRef) {
156
156
  registerInstance(this, hostRef);
157
+ this.trackingSent = false;
157
158
  this.titleText = undefined;
158
159
  this.stripe = stripeStore.stripe;
159
160
  this.stripeElements = stripeStore.stripeElements;
161
+ this.isPaymentInfoFilled = false;
162
+ }
163
+ watchIsPaymentInfoFilled() {
164
+ var _a;
165
+ // Only send event once when payment info is filled
166
+ if (this.isPaymentInfoFilled && !this.trackingSent) {
167
+ void trackConversionEvent('checkout_paymentInfoFilled', {
168
+ paymentMethod: (_a = stripeStore.stripePaymentEventData) === null || _a === void 0 ? void 0 : _a.value.type,
169
+ });
170
+ this.trackingSent = true;
171
+ }
160
172
  }
161
173
  watchInitStripe() {
162
174
  if (!this.stripeElements) {
@@ -174,6 +186,9 @@ const ZonosPayment = class {
174
186
  }
175
187
  paymentElement.mount(paymentElementContainer);
176
188
  paymentElement.on('change', event => {
189
+ if (event.complete) {
190
+ this.isPaymentInfoFilled = true;
191
+ }
177
192
  stripeStore.stripePaymentEventData = event;
178
193
  });
179
194
  stripeStore.stripePaymentElement = paymentElement;
@@ -184,10 +199,11 @@ const ZonosPayment = class {
184
199
  }
185
200
  render() {
186
201
  // this component loads iframe from the stripe elements and puts here, so we don't need to do anything here
187
- return (h(Host, { key: '2d664521944c4f02f34fe3130f8ebb853e562476', class: "zonos--payment zonos--elements" }, this.titleText && (h("zonos-text", { key: '11f683a0f6094d801103a9f04054d038b405718f', class: "zonos--title", type: "semiBoldLabel" }, this.titleText)), h("div", { key: '0c962441697499b3a7eb279175ce025d76d4c0fa', class: "zonos--payment-component" }), h("div", { key: 'a96af74f05521fcccc1912c0ec1dcbe64cfc1ae7', class: "zonos--payment-paypal-container" })));
202
+ return (h(Host, { key: '3e9f3439e139f6d040bcf8fc101f19d011debdc8', class: "zonos--payment zonos--elements" }, this.titleText && (h("zonos-text", { key: '2f22806f4f9380e610899a997ce9ed2bfe997be4', class: "zonos--title", type: "semiBoldLabel" }, this.titleText)), h("div", { key: '4d5dbd7828b3037d69adb50d4fee4ea9abf3b59b', class: "zonos--payment-component" }), h("div", { key: '32ee62f62a028da8481d95781a7368c60ae42614', class: "zonos--payment-paypal-container" })));
188
203
  }
189
204
  get el() { return getElement(this); }
190
205
  static get watchers() { return {
206
+ "isPaymentInfoFilled": ["watchIsPaymentInfoFilled"],
191
207
  "stripeElements": ["watchInitStripe"],
192
208
  "stripe": ["watchInitStripe"]
193
209
  }; }
@@ -1,10 +1,10 @@
1
1
  import { r as registerInstance, c as createEvent, h, F as Fragment, H as Host } from './index-d82f06f2.js';
2
- import { r as translate, l as localizationStore, E as currencyFormat } from './cart-52e208cc.js';
2
+ import { r as translate, l as localizationStore, E as currencyFormat } from './cart-54d84646.js';
3
3
  import { z as zonosStore } from './zonosStore-d3c5a0a5.js';
4
4
  import { c as classes } from './classes-0d95c529.js';
5
5
  import { f as formatStringWithLinks } from './formatStringWithLinks-9e819405.js';
6
6
  import { g as getHasMoreSpaceOnRight } from './getHasMoreSpaceOnRight-70eb913a.js';
7
- import './handleFetch-0109fb78.js';
7
+ import './handleFetch-621e45bc.js';
8
8
  import './isDarkColor-446fccb7.js';
9
9
  import './getBorderRadius-ada3ccad.js';
10
10
 
@@ -1,8 +1,8 @@
1
1
  import { r as registerInstance, h, H as Host } from './index-d82f06f2.js';
2
2
  import { _ as _root, e as _baseGetTag, i as isObjectLike_1, f as isObject_1, z as zonosStore, g as getZonosStoreTheme, m as mergeConfig } from './zonosStore-d3c5a0a5.js';
3
- import { l as localizationStore, G as isValidSelector, r as translate, u as getZCountryUrlParam, I as setZCountryUrlParam, J as currencyDisplay, K as currencyConvertAndFormat, L as currencyConvert, E as currencyFormat } from './cart-52e208cc.js';
3
+ import { l as localizationStore, G as isValidSelector, r as translate, u as getZCountryUrlParam, I as setZCountryUrlParam, J as currencyDisplay, K as currencyConvertAndFormat, L as currencyConvert, E as currencyFormat } from './cart-54d84646.js';
4
4
  import { c as classes } from './classes-0d95c529.js';
5
- import { h as handleFetch, b as logError, l as log } from './handleFetch-0109fb78.js';
5
+ import { h as handleFetch, b as logError, l as log } from './handleFetch-621e45bc.js';
6
6
  import { g as getHasMoreSpaceOnRight } from './getHasMoreSpaceOnRight-70eb913a.js';
7
7
  import './isDarkColor-446fccb7.js';
8
8
  import './getBorderRadius-ada3ccad.js';
@@ -1,8 +1,8 @@
1
1
  import { r as registerInstance, h, H as Host } from './index-d82f06f2.js';
2
- import { W as localizationStoreUpdateSelectedLocale, r as translate, l as localizationStore } from './cart-52e208cc.js';
2
+ import { W as localizationStoreUpdateSelectedLocale, r as translate, l as localizationStore } from './cart-54d84646.js';
3
3
  import { d as zonosStoreFontFamily } from './zonosStore-d3c5a0a5.js';
4
4
  import { l as languages } from './ILanguage-cd6acb72.js';
5
- import './handleFetch-0109fb78.js';
5
+ import './handleFetch-621e45bc.js';
6
6
  import './isDarkColor-446fccb7.js';
7
7
  import './getBorderRadius-ada3ccad.js';
8
8
 
@@ -1 +1 @@
1
- var __awaiter=this&&this.__awaiter||function(e,t,r,n){function a(e){return e instanceof r?e:new r((function(t){t(e)}))}return new(r||(r=Promise))((function(r,i){function o(e){try{c(n.next(e))}catch(e){i(e)}}function s(e){try{c(n["throw"](e))}catch(e){i(e)}}function c(e){e.done?r(e.value):a(e.value).then(o,s)}c((n=n.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,a,i,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function s(e){return function(t){return c([e,t])}}function c(s){if(n)throw new TypeError("Generator is already executing.");while(o&&(o=0,s[0]&&(r=0)),r)try{if(n=1,a&&(i=s[0]&2?a["return"]:s[0]?a["throw"]||((i=a["return"])&&i.call(a),0):a.next)&&!(i=i.call(a,s[1])).done)return i;if(a=0,i)s=[s[0]&2,i.value];switch(s[0]){case 0:case 1:i=s;break;case 4:r.label++;return{value:s[1],done:false};case 5:r.label++;a=s[1];s=[0];continue;case 7:s=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(s[0]===6||s[0]===2)){r=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){r.label=s[1];break}if(s[0]===6&&r.label<i[1]){r.label=i[1];i=s;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(s);break}if(i[2])r.ops.pop();r.trys.pop();continue}s=t.call(e,r)}catch(e){s=[6,e];a=0}finally{n=i=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};import{g as getIsTestMode,h as handleFetch,l as log,b as logError}from"./handleFetch-0109fb78.js";var getTempCartById=function(e){return __awaiter(void 0,[e],void 0,(function(e){var t,r,n,a,i;var o=e.cartId,s=e.retries;return __generator(this,(function(e){switch(e.label){case 0:t=getIsTestMode();return[4,handleFetch("/api/zonos-elements/get-temp-cart",{body:{isTestMode:t,options:{noOnlineStoreSettings:true},tempCartUUID:o},headers:{"Content-Type":"application/json"},method:"POST"})];case 1:r=e.sent(),n=r.errors,a=r.json;i=!a||n.length;if(!(i&&s))return[3,3];log("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:s});return[4,new Promise((function(e){return setTimeout(e,500)}))];case 2:e.sent();return[2,getTempCartById({cartId:o,retries:s-1})];case 3:if(i){return[2,null]}return[2,a]}}))}))};var baseRe=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/;var uuidRe=new RegExp("^".concat(baseRe.source,"$"));var cartUuidRe=new RegExp("^cart_".concat(baseRe.source,"$"));var tsidRe=/^[a-zA-Z0-9]{2,}$/;var cartTsidRe=/^cart_[a-zA-Z0-9]{2,}$/;var _getIsValidCartId=function(e){if(!e){return{isDgsCartId:false,isLegacyCartId:false}}if(e.includes("undefined")){return{isDgsCartId:false,isLegacyCartId:false}}if(cartTsidRe.test(e)){return{isDgsCartId:true,isLegacyCartId:false}}if(tsidRe.test(e)){return{isDgsCartId:false,isLegacyCartId:true}}if(cartUuidRe.test(e)){return{isDgsCartId:true,isLegacyCartId:false}}if(uuidRe.test(e)){return{isDgsCartId:false,isLegacyCartId:true}}return{isDgsCartId:false,isLegacyCartId:false}};var setupCartData=function(e){return __awaiter(void 0,void 0,void 0,(function(){var t,r,n,a;return __generator(this,(function(i){switch(i.label){case 0:t=_getIsValidCartId(e),r=t.isDgsCartId,n=t.isLegacyCartId;if(!n&&!r){logError("[ZONOS - loadZonos] invalid cart id");return[2,null]}return[4,getTempCartById({cartId:e,retries:5})];case 1:a=i.sent();log("[ZONOS - loadZonos] getting temp cart data","info",a);if(!a){logError("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process.");return[2,null]}window.Zonos.storeId=a.cartData.storeId;window.Zonos.zonosApiKey=a.cartData.credentialToken;return[2,{cartData:a.cartData,storeFavicon:a.storeFaviconUrl,storeId:a.cartData.storeId,storeLogo:a.storeLogoUrl,zonosApiKey:a.cartData.credentialToken}]}}))}))};var checkoutHiddenBtnSelector="zonos--checkout-hidden-button";var domesticRedirectedBtnSelector="zonos--domestic-redirected-checkout-button";export{checkoutHiddenBtnSelector as c,domesticRedirectedBtnSelector as d,setupCartData as s};
1
+ var __awaiter=this&&this.__awaiter||function(e,t,r,n){function a(e){return e instanceof r?e:new r((function(t){t(e)}))}return new(r||(r=Promise))((function(r,i){function o(e){try{c(n.next(e))}catch(e){i(e)}}function s(e){try{c(n["throw"](e))}catch(e){i(e)}}function c(e){e.done?r(e.value):a(e.value).then(o,s)}c((n=n.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,a,i,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function s(e){return function(t){return c([e,t])}}function c(s){if(n)throw new TypeError("Generator is already executing.");while(o&&(o=0,s[0]&&(r=0)),r)try{if(n=1,a&&(i=s[0]&2?a["return"]:s[0]?a["throw"]||((i=a["return"])&&i.call(a),0):a.next)&&!(i=i.call(a,s[1])).done)return i;if(a=0,i)s=[s[0]&2,i.value];switch(s[0]){case 0:case 1:i=s;break;case 4:r.label++;return{value:s[1],done:false};case 5:r.label++;a=s[1];s=[0];continue;case 7:s=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(s[0]===6||s[0]===2)){r=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){r.label=s[1];break}if(s[0]===6&&r.label<i[1]){r.label=i[1];i=s;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(s);break}if(i[2])r.ops.pop();r.trys.pop();continue}s=t.call(e,r)}catch(e){s=[6,e];a=0}finally{n=i=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};import{g as getIsTestMode,h as handleFetch,l as log,b as logError}from"./handleFetch-621e45bc.js";var getTempCartById=function(e){return __awaiter(void 0,[e],void 0,(function(e){var t,r,n,a,i;var o=e.cartId,s=e.retries;return __generator(this,(function(e){switch(e.label){case 0:t=getIsTestMode();return[4,handleFetch("/api/zonos-elements/get-temp-cart",{body:{isTestMode:t,options:{noOnlineStoreSettings:true},tempCartUUID:o},headers:{"Content-Type":"application/json"},method:"POST"})];case 1:r=e.sent(),n=r.errors,a=r.json;i=!a||n.length;if(!(i&&s))return[3,3];log("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:s});return[4,new Promise((function(e){return setTimeout(e,500)}))];case 2:e.sent();return[2,getTempCartById({cartId:o,retries:s-1})];case 3:if(i){return[2,null]}return[2,a]}}))}))};var baseRe=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/;var uuidRe=new RegExp("^".concat(baseRe.source,"$"));var cartUuidRe=new RegExp("^cart_".concat(baseRe.source,"$"));var tsidRe=/^[a-zA-Z0-9]{2,}$/;var cartTsidRe=/^cart_[a-zA-Z0-9]{2,}$/;var _getIsValidCartId=function(e){if(!e){return{isDgsCartId:false,isLegacyCartId:false}}if(e.includes("undefined")){return{isDgsCartId:false,isLegacyCartId:false}}if(cartTsidRe.test(e)){return{isDgsCartId:true,isLegacyCartId:false}}if(tsidRe.test(e)){return{isDgsCartId:false,isLegacyCartId:true}}if(cartUuidRe.test(e)){return{isDgsCartId:true,isLegacyCartId:false}}if(uuidRe.test(e)){return{isDgsCartId:false,isLegacyCartId:true}}return{isDgsCartId:false,isLegacyCartId:false}};var setupCartData=function(e){return __awaiter(void 0,void 0,void 0,(function(){var t,r,n,a;return __generator(this,(function(i){switch(i.label){case 0:t=_getIsValidCartId(e),r=t.isDgsCartId,n=t.isLegacyCartId;if(!n&&!r){logError("[ZONOS - loadZonos] invalid cart id");return[2,null]}return[4,getTempCartById({cartId:e,retries:5})];case 1:a=i.sent();log("[ZONOS - loadZonos] getting temp cart data","info",a);if(!a){logError("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process.");return[2,null]}window.Zonos.storeId=a.cartData.storeId;window.Zonos.zonosApiKey=a.cartData.credentialToken;return[2,{cartData:a.cartData,storeFavicon:a.storeFaviconUrl,storeId:a.cartData.storeId,storeLogo:a.storeLogoUrl,zonosApiKey:a.cartData.credentialToken}]}}))}))};var checkoutHiddenBtnSelector="zonos--checkout-hidden-button";var domesticRedirectedBtnSelector="zonos--domestic-redirected-checkout-button";export{checkoutHiddenBtnSelector as c,domesticRedirectedBtnSelector as d,setupCartData as s};