@zonos/elements 1.3.269 → 1.3.272

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 (207) hide show
  1. package/dist/cjs/{cart-87fbbb5a.js → cart-f1374a56.js} +1 -1
  2. package/dist/cjs/{hasInclusivePrice-c86ed1f5.js → hasInclusivePrice-2f1232e3.js} +1 -1
  3. package/dist/cjs/index.cjs.js +7 -7
  4. package/dist/cjs/{invoice-952f32c4.js → invoice-3760bec0.js} +2 -2
  5. package/dist/cjs/{isCollectMobileTablet-1cb21c59.js → isCollectMobileTablet-d5c1a9ea.js} +2 -2
  6. package/dist/cjs/{localization-a969f224.js → localization-503c8477.js} +131 -3
  7. package/dist/cjs/{paypal-cfe1e8e9.js → paypal-5e9b8224.js} +2 -2
  8. package/dist/cjs/{placeTestOrder-613878fb.js → placeTestOrder-d1be2c8e.js} +2 -2
  9. package/dist/cjs/{renderCheckoutCurrency-5a333d29.js → renderCheckoutCurrency-4486b06e.js} +2 -2
  10. package/dist/cjs/zonos-address-display_8.cjs.entry.js +2 -2
  11. package/dist/cjs/zonos-address_4.cjs.entry.js +2 -2
  12. package/dist/cjs/zonos-card_5.cjs.entry.js +3 -3
  13. package/dist/cjs/zonos-cart-items_12.cjs.entry.js +117 -7
  14. package/dist/cjs/zonos-checkout.cjs.entry.js +3 -3
  15. package/dist/cjs/zonos-collect-cart-items_3.cjs.entry.js +2 -2
  16. package/dist/cjs/zonos-collect-finish_6.cjs.entry.js +6 -6
  17. package/dist/cjs/zonos-collect.cjs.entry.js +4 -4
  18. package/dist/cjs/zonos-controller.cjs.entry.js +2 -2
  19. package/dist/cjs/zonos-country-flag.cjs.entry.js +1 -1
  20. package/dist/cjs/zonos-country-select_4.cjs.entry.js +1 -1
  21. package/dist/cjs/zonos-hello-dialog.cjs.entry.js +2 -2
  22. package/dist/cjs/zonos-hello.cjs.entry.js +1 -1
  23. package/dist/cjs/zonos-invoice-cart-items_2.cjs.entry.js +4 -4
  24. package/dist/cjs/zonos-invoice-finish_5.cjs.entry.js +6 -6
  25. package/dist/cjs/zonos-invoice.cjs.entry.js +4 -4
  26. package/dist/cjs/zonos-language-select_2.cjs.entry.js +1 -1
  27. package/dist/cjs/zonos-policy-consent_2.cjs.entry.js +3 -3
  28. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-payment/zonos-checkout-payment.js +4 -1
  29. package/dist/collection/components/common/zonos-stripe-phone-input/zonos-stripe-phone-input.js +1 -1
  30. package/dist/collection/components/main/zonos-controller.js +1 -1
  31. package/dist/collection/components/store/checkout/euWithdrawalRate.js +40 -0
  32. package/dist/collection/components/store/hello/localization.js +3 -1
  33. package/dist/collection/components/store/translationStore/strings.arabic.js +6 -0
  34. package/dist/collection/components/store/translationStore/strings.base.js +6 -0
  35. package/dist/collection/components/store/translationStore/strings.chinese.js +6 -0
  36. package/dist/collection/components/store/translationStore/strings.danish.js +6 -0
  37. package/dist/collection/components/store/translationStore/strings.dutch.js +6 -0
  38. package/dist/collection/components/store/translationStore/strings.french.js +6 -0
  39. package/dist/collection/components/store/translationStore/strings.german.js +6 -0
  40. package/dist/collection/components/store/translationStore/strings.hebrew.js +6 -0
  41. package/dist/collection/components/store/translationStore/strings.indonesian.js +6 -0
  42. package/dist/collection/components/store/translationStore/strings.italian.js +6 -0
  43. package/dist/collection/components/store/translationStore/strings.japanese.js +6 -0
  44. package/dist/collection/components/store/translationStore/strings.korean.js +6 -0
  45. package/dist/collection/components/store/translationStore/strings.norwegian.js +6 -0
  46. package/dist/collection/components/store/translationStore/strings.polish.js +6 -0
  47. package/dist/collection/components/store/translationStore/strings.portuguese.js +6 -0
  48. package/dist/collection/components/store/translationStore/strings.russian.js +6 -0
  49. package/dist/collection/components/store/translationStore/strings.spanish.js +6 -0
  50. package/dist/collection/components/store/translationStore/strings.swedish.js +6 -0
  51. package/dist/collection/components/store/translationStore/strings.turkish.js +6 -0
  52. package/dist/collection/components/store/translationStore/strings.vietnamese.js +6 -0
  53. package/dist/collection/components/utils/checkout/euWithdrawalNotice.js +74 -0
  54. package/dist/collection/components/utils/hello/currencyConversion/defaultCurrencyConverter.js +6 -2
  55. package/dist/collection/types/generated/graphql.internal.types.js +315 -182
  56. package/dist/esm/{cart-663ef7d5.js → cart-1415dcf0.js} +1 -1
  57. package/dist/esm/{hasInclusivePrice-f8bd057d.js → hasInclusivePrice-a3b0f71c.js} +1 -1
  58. package/dist/esm/index.js +7 -7
  59. package/dist/esm/{invoice-db7211a6.js → invoice-117efa2c.js} +2 -2
  60. package/dist/esm/{isCollectMobileTablet-24c912b1.js → isCollectMobileTablet-2c62fdaa.js} +2 -2
  61. package/dist/esm/{localization-dc19e8bb.js → localization-29723d89.js} +130 -4
  62. package/dist/esm/{paypal-cdbe69ef.js → paypal-cb5559d4.js} +2 -2
  63. package/dist/esm/{placeTestOrder-ba67e208.js → placeTestOrder-443376eb.js} +2 -2
  64. package/dist/esm/{renderCheckoutCurrency-fb1cbd28.js → renderCheckoutCurrency-8390b5bf.js} +2 -2
  65. package/dist/esm/zonos-address-display_8.entry.js +2 -2
  66. package/dist/esm/zonos-address_4.entry.js +2 -2
  67. package/dist/esm/zonos-card_5.entry.js +3 -3
  68. package/dist/esm/zonos-cart-items_12.entry.js +118 -8
  69. package/dist/esm/zonos-checkout.entry.js +3 -3
  70. package/dist/esm/zonos-collect-cart-items_3.entry.js +2 -2
  71. package/dist/esm/zonos-collect-finish_6.entry.js +6 -6
  72. package/dist/esm/zonos-collect.entry.js +4 -4
  73. package/dist/esm/zonos-controller.entry.js +2 -2
  74. package/dist/esm/zonos-country-flag.entry.js +1 -1
  75. package/dist/esm/zonos-country-select_4.entry.js +1 -1
  76. package/dist/esm/zonos-hello-dialog.entry.js +2 -2
  77. package/dist/esm/zonos-hello.entry.js +1 -1
  78. package/dist/esm/zonos-invoice-cart-items_2.entry.js +4 -4
  79. package/dist/esm/zonos-invoice-finish_5.entry.js +6 -6
  80. package/dist/esm/zonos-invoice.entry.js +4 -4
  81. package/dist/esm/zonos-language-select_2.entry.js +1 -1
  82. package/dist/esm/zonos-policy-consent_2.entry.js +3 -3
  83. package/dist/esm-es5/{cart-663ef7d5.js → cart-1415dcf0.js} +1 -1
  84. package/dist/esm-es5/{hasInclusivePrice-f8bd057d.js → hasInclusivePrice-a3b0f71c.js} +1 -1
  85. package/dist/esm-es5/index.js +1 -1
  86. package/dist/esm-es5/{invoice-db7211a6.js → invoice-117efa2c.js} +1 -1
  87. package/dist/esm-es5/{isCollectMobileTablet-24c912b1.js → isCollectMobileTablet-2c62fdaa.js} +1 -1
  88. package/dist/esm-es5/localization-29723d89.js +1 -0
  89. package/dist/esm-es5/{paypal-cdbe69ef.js → paypal-cb5559d4.js} +1 -1
  90. package/dist/esm-es5/{placeTestOrder-ba67e208.js → placeTestOrder-443376eb.js} +1 -1
  91. package/dist/esm-es5/{renderCheckoutCurrency-fb1cbd28.js → renderCheckoutCurrency-8390b5bf.js} +1 -1
  92. package/dist/esm-es5/zonos-address-display_8.entry.js +1 -1
  93. package/dist/esm-es5/zonos-address_4.entry.js +1 -1
  94. package/dist/esm-es5/zonos-card_5.entry.js +1 -1
  95. package/dist/esm-es5/zonos-cart-items_12.entry.js +1 -1
  96. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  97. package/dist/esm-es5/zonos-collect-cart-items_3.entry.js +1 -1
  98. package/dist/esm-es5/zonos-collect-finish_6.entry.js +1 -1
  99. package/dist/esm-es5/zonos-collect.entry.js +1 -1
  100. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  101. package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
  102. package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
  103. package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
  104. package/dist/esm-es5/zonos-hello.entry.js +1 -1
  105. package/dist/esm-es5/zonos-invoice-cart-items_2.entry.js +1 -1
  106. package/dist/esm-es5/zonos-invoice-finish_5.entry.js +1 -1
  107. package/dist/esm-es5/zonos-invoice.entry.js +1 -1
  108. package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
  109. package/dist/esm-es5/zonos-policy-consent_2.entry.js +1 -1
  110. package/dist/scripts/index.d.ts +38 -3
  111. package/dist/scripts/index.js +1 -1
  112. package/dist/scripts/loadZonos.js +1 -1
  113. package/dist/scripts/zonos.js +1 -1
  114. package/dist/types/components/store/checkout/euWithdrawalRate.d.ts +19 -0
  115. package/dist/types/components/store/translationStore/strings.arabic.d.ts +6 -0
  116. package/dist/types/components/store/translationStore/strings.base.d.ts +6 -0
  117. package/dist/types/components/store/translationStore/strings.chinese.d.ts +6 -0
  118. package/dist/types/components/store/translationStore/strings.danish.d.ts +6 -0
  119. package/dist/types/components/store/translationStore/strings.dutch.d.ts +6 -0
  120. package/dist/types/components/store/translationStore/strings.french.d.ts +6 -0
  121. package/dist/types/components/store/translationStore/strings.german.d.ts +6 -0
  122. package/dist/types/components/store/translationStore/strings.hebrew.d.ts +6 -0
  123. package/dist/types/components/store/translationStore/strings.indonesian.d.ts +6 -0
  124. package/dist/types/components/store/translationStore/strings.italian.d.ts +6 -0
  125. package/dist/types/components/store/translationStore/strings.japanese.d.ts +6 -0
  126. package/dist/types/components/store/translationStore/strings.korean.d.ts +6 -0
  127. package/dist/types/components/store/translationStore/strings.norwegian.d.ts +6 -0
  128. package/dist/types/components/store/translationStore/strings.polish.d.ts +6 -0
  129. package/dist/types/components/store/translationStore/strings.portuguese.d.ts +6 -0
  130. package/dist/types/components/store/translationStore/strings.russian.d.ts +6 -0
  131. package/dist/types/components/store/translationStore/strings.spanish.d.ts +6 -0
  132. package/dist/types/components/store/translationStore/strings.swedish.d.ts +6 -0
  133. package/dist/types/components/store/translationStore/strings.turkish.d.ts +6 -0
  134. package/dist/types/components/store/translationStore/strings.vietnamese.d.ts +6 -0
  135. package/dist/types/components/utils/checkout/euWithdrawalNotice.d.ts +9 -0
  136. package/dist/types/scripts/cart/_setupCartDataWithSettings.d.ts +8 -3
  137. package/dist/types/types/checkout/CheckoutConfig.d.ts +10 -0
  138. package/dist/types/types/generated/graphql.internal.types.d.ts +396 -218
  139. package/dist/types/types/generated/graphql.internal.types.ts +508 -258
  140. package/dist/types/types/utils/ZonosSettings.d.ts +9 -0
  141. package/dist/zonos-elements/index.esm.js +1 -1
  142. package/dist/zonos-elements/p-0fa932e6.system.js +1 -0
  143. package/dist/zonos-elements/{p-680da401.entry.js → p-15c2dfea.entry.js} +1 -1
  144. package/dist/zonos-elements/{p-d932973f.system.js → p-17c7a727.system.js} +1 -1
  145. package/dist/zonos-elements/{p-09d32e53.system.entry.js → p-18c9565b.system.entry.js} +1 -1
  146. package/dist/zonos-elements/p-24aa6708.js +1 -0
  147. package/dist/zonos-elements/{p-a237429e.entry.js → p-2585034d.entry.js} +1 -1
  148. package/dist/zonos-elements/p-29b60bf3.system.js +1 -1
  149. package/dist/zonos-elements/p-2cda42d5.system.js +1 -0
  150. package/dist/zonos-elements/{p-513e8278.entry.js → p-2d1055d5.entry.js} +1 -1
  151. package/dist/zonos-elements/{p-f5684fc2.system.js → p-318e704a.system.js} +1 -1
  152. package/dist/zonos-elements/{p-699276f2.system.js → p-3b600b89.system.js} +1 -1
  153. package/dist/zonos-elements/{p-9092f655.entry.js → p-3efe0875.entry.js} +1 -1
  154. package/dist/zonos-elements/{p-c62293d5.system.entry.js → p-48f3e2d2.system.entry.js} +1 -1
  155. package/dist/zonos-elements/{p-488c1af1.entry.js → p-4c94cfd3.entry.js} +1 -1
  156. package/dist/zonos-elements/{p-243dda5f.js → p-53b65b80.js} +1 -1
  157. package/dist/zonos-elements/{p-be64a52e.entry.js → p-53be08c8.entry.js} +1 -1
  158. package/dist/zonos-elements/{p-0581cfc9.system.entry.js → p-54a9c772.system.entry.js} +1 -1
  159. package/dist/zonos-elements/p-58521b25.js +1 -0
  160. package/dist/zonos-elements/{p-48ec0b61.system.entry.js → p-5bd47a30.system.entry.js} +1 -1
  161. package/dist/zonos-elements/{p-57b55808.entry.js → p-60f0ff42.entry.js} +1 -1
  162. package/dist/zonos-elements/{p-ba127f51.entry.js → p-6609467e.entry.js} +1 -1
  163. package/dist/zonos-elements/{p-9ea67d63.system.entry.js → p-6b87101d.system.entry.js} +1 -1
  164. package/dist/zonos-elements/{p-8f0bdb87.system.entry.js → p-73730eb9.system.entry.js} +1 -1
  165. package/dist/zonos-elements/{p-82ce355d.system.entry.js → p-7536cf94.system.entry.js} +1 -1
  166. package/dist/zonos-elements/{p-263d14da.system.entry.js → p-792fce17.system.entry.js} +1 -1
  167. package/dist/zonos-elements/p-7ce6b8f7.system.entry.js +1 -0
  168. package/dist/zonos-elements/{p-4af88255.entry.js → p-7d859914.entry.js} +1 -1
  169. package/dist/zonos-elements/{p-accccb9c.entry.js → p-831bcfb6.entry.js} +1 -1
  170. package/dist/zonos-elements/{p-0daed059.system.entry.js → p-9259e19b.system.entry.js} +1 -1
  171. package/dist/zonos-elements/p-93324ee5.entry.js +1 -0
  172. package/dist/zonos-elements/p-99ef86c3.js +1 -0
  173. package/dist/zonos-elements/{p-9a509268.entry.js → p-a956e28f.entry.js} +1 -1
  174. package/dist/zonos-elements/{p-bbef037c.js → p-aa3a7538.js} +1 -1
  175. package/dist/zonos-elements/{p-c4ef873a.system.entry.js → p-aafc2155.system.entry.js} +1 -1
  176. package/dist/zonos-elements/{p-9377b5c2.entry.js → p-b1b7d786.entry.js} +1 -1
  177. package/dist/zonos-elements/{p-84d4f04d.entry.js → p-b375372e.entry.js} +1 -1
  178. package/dist/zonos-elements/{p-8f817a47.system.js → p-b453ae2b.system.js} +1 -1
  179. package/dist/zonos-elements/{p-049fc407.entry.js → p-bd2daace.entry.js} +1 -1
  180. package/dist/zonos-elements/{p-9799193c.entry.js → p-c16c7978.entry.js} +1 -1
  181. package/dist/zonos-elements/{p-44147850.js → p-c425d3d9.js} +1 -1
  182. package/dist/zonos-elements/{p-fc270539.system.entry.js → p-c45df586.system.entry.js} +1 -1
  183. package/dist/zonos-elements/p-c935390d.js +1 -0
  184. package/dist/zonos-elements/{p-1bde60d5.system.entry.js → p-ccc8d669.system.entry.js} +1 -1
  185. package/dist/zonos-elements/{p-cd5444b0.js → p-cdea0f7d.js} +1 -1
  186. package/dist/zonos-elements/{p-8a24701c.system.entry.js → p-d2ba9e3c.system.entry.js} +1 -1
  187. package/dist/zonos-elements/{p-c2023a08.system.js → p-e77dd304.system.js} +1 -1
  188. package/dist/zonos-elements/{p-57c3c68f.entry.js → p-ea91600a.entry.js} +1 -1
  189. package/dist/zonos-elements/{p-882fb843.system.entry.js → p-eb254a96.system.entry.js} +1 -1
  190. package/dist/zonos-elements/{p-7662d32a.system.js → p-eb77dd11.system.js} +1 -1
  191. package/dist/zonos-elements/{p-858103a0.entry.js → p-ee00f232.entry.js} +1 -1
  192. package/dist/zonos-elements/{p-b0ed0fe7.system.entry.js → p-f4be6ce5.system.entry.js} +1 -1
  193. package/dist/zonos-elements/{p-df0c8fb6.system.entry.js → p-f5d9e5e5.system.entry.js} +1 -1
  194. package/dist/zonos-elements/{p-71528303.system.entry.js → p-f98cdb98.system.entry.js} +1 -1
  195. package/dist/zonos-elements/p-fd849c69.system.js +1 -0
  196. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  197. package/package.json +1 -1
  198. package/dist/esm-es5/localization-dc19e8bb.js +0 -1
  199. package/dist/zonos-elements/p-097d7819.js +0 -1
  200. package/dist/zonos-elements/p-2be4335f.js +0 -1
  201. package/dist/zonos-elements/p-33a37c42.system.entry.js +0 -1
  202. package/dist/zonos-elements/p-4b6e367d.system.js +0 -1
  203. package/dist/zonos-elements/p-56711a61.js +0 -1
  204. package/dist/zonos-elements/p-a3a79b2f.system.js +0 -1
  205. package/dist/zonos-elements/p-c5caf47b.system.js +0 -1
  206. package/dist/zonos-elements/p-d437bc28.js +0 -1
  207. package/dist/zonos-elements/p-e05e5825.entry.js +0 -1
@@ -832,11 +832,16 @@ declare const landedCostAdjustmentType: {
832
832
  type LandedCostAdjustmentType = (typeof landedCostAdjustmentType)[keyof typeof landedCostAdjustmentType];
833
833
  declare const landedCostGuaranteeCode: {
834
834
  readonly CollectRemittance: "COLLECT_REMITTANCE";
835
+ readonly Guaranteed: "GUARANTEED";
836
+ readonly GuaranteedImport: "GUARANTEED_IMPORT";
837
+ readonly GuaranteedRemit: "GUARANTEED_REMIT";
835
838
  readonly InclusivePrice: "INCLUSIVE_PRICE";
836
839
  readonly NotApplicable: "NOT_APPLICABLE";
837
840
  readonly PostalDdp: "POSTAL_DDP";
838
841
  readonly PostalDdpInclusivePrice: "POSTAL_DDP_INCLUSIVE_PRICE";
839
842
  readonly Zonos: "ZONOS";
843
+ readonly ZonosImport: "ZONOS_IMPORT";
844
+ readonly ZonosRemit: "ZONOS_REMIT";
840
845
  };
841
846
  type LandedCostGuaranteeCode = (typeof landedCostGuaranteeCode)[keyof typeof landedCostGuaranteeCode];
842
847
  declare const landedCostGuaranteeType: {
@@ -1153,19 +1158,24 @@ type CartCheckoutWorkflowQuery = {
1153
1158
  companyFieldsStatus: CheckoutCompanyFieldsStatus;
1154
1159
  createdAt: string;
1155
1160
  merchantPolicyLinks: {
1161
+ euWithdrawalPolicy: {
1162
+ maximumReturnShippingEstimate: number | null;
1163
+ currencyCode: CurrencyCode;
1164
+ status: NotificationActiveStatus | null;
1165
+ } | null;
1156
1166
  privacyPolicy: {
1157
1167
  link: string | null;
1158
1168
  } | null;
1159
- termsAndConditions: {
1169
+ refundPolicy: {
1160
1170
  link: string | null;
1161
1171
  } | null;
1162
1172
  shippingPolicy: {
1163
1173
  link: string | null;
1164
1174
  } | null;
1165
- refundPolicy: {
1175
+ warrantyPolicy: {
1166
1176
  link: string | null;
1167
1177
  } | null;
1168
- warrantyPolicy: {
1178
+ termsAndConditions: {
1169
1179
  link: string | null;
1170
1180
  } | null;
1171
1181
  };
@@ -1968,6 +1978,15 @@ type GenericZonosSettings = {
1968
1978
  * List of countries that are allowed to use USD denominated cards for settlement.
1969
1979
  */
1970
1980
  usdSettlementCountryEnabled?: CountryCode[];
1981
+ /**
1982
+ * Ship-to countries affected by the EU right-of-withdrawal regulation. When the
1983
+ * buyer's destination is in this list (and the merchant has opted into the EU
1984
+ * withdrawal policy), the withdrawal notice is shown above the Pay button.
1985
+ * Sourced from the API so the affected-country list is controlled centrally
1986
+ * rather than hardcoded in the storefront; an absent/empty list shows it for no
1987
+ * country.
1988
+ */
1989
+ withdrawalCountryEnabled?: CountryCode[];
1971
1990
  };
1972
1991
 
1973
1992
  type SelectOption = {
@@ -6690,6 +6709,12 @@ declare const stringsBase: {
6690
6709
  'I agree to the [policies]': {
6691
6710
  value: string;
6692
6711
  };
6712
+ 'If you later choose to exercise your right to withdrawal, you will be responsible for any associated return shipping costs, up to a maximum [amount].': {
6713
+ value: string;
6714
+ };
6715
+ 'If you later choose to exercise your right to withdrawal, you will be responsible for any associated return shipping costs.': {
6716
+ value: string;
6717
+ };
6693
6718
  "If you select FedEx Ground as your shipping option, you'll need to complete a General Agency Agreement (GAA) after placing your order. This form allows FedEx to clear your package through Canadian customs on your behalf. FedEx will contact you directly\u2014usually by email or phone\u2014with instructions on how to complete the GAA. To avoid delays or the return of your package, please respond promptly to their request.": {
6694
6719
  value: string;
6695
6720
  };
@@ -7374,6 +7399,16 @@ type CheckoutConfig = {
7374
7399
  * without breaking existing consumers.
7375
7400
  */
7376
7401
  merchantPolicyLinks: {
7402
+ /**
7403
+ * EU right-of-withdrawal policy. When `status` is ENABLED, EU buyers see a
7404
+ * notice above the Pay button about return shipping costs they may owe.
7405
+ * Optional so configs written before this field existed still type-check.
7406
+ */
7407
+ euWithdrawalPolicy?: {
7408
+ currencyCode: CurrencyCode;
7409
+ maximumReturnShippingEstimate: number | null;
7410
+ status: NotificationActiveStatus | null;
7411
+ } | null;
7377
7412
  privacyPolicy: {
7378
7413
  link: string | null;
7379
7414
  } | null;
@@ -1 +1 @@
1
- (function(){"use strict";const e=({id:e,payload:o,target:t,type:n})=>{var r;t instanceof HTMLIFrameElement?null===(r=t.contentWindow)||void 0===r||r.postMessage({id:e,payload:o,type:n},"*"):t.postMessage({id:e,payload:o,type:n},"*")};class o{constructor(o,t){this.targetElement=o,this.targetId=t,this.sendMessage=(o,t)=>{e({id:this.targetId,payload:t,target:this.targetElement,type:o})}}}o.iframeServices={GOOGLE_PLACES:"zonos--private-iframe-google-places-service-m9bmuh7g"},o.sendMessage=e,o.injectPrivateIframe=({id:e,onload:o,src:t})=>{const n=document.createElement("iframe");return n.src=t,n.id=e,n.style.display="none",n.role="presentation",n.ariaHidden="true",n.tabIndex=-1,n.style.border="none !important",n.style.margin="0px !important",n.style.padding="0px !important",n.style.width="1px !important",n.style.minWidth="100% !important",n.style.overflow="hidden !important",n.style.display="block !important",n.style.visibility="hidden !important",n.style.position="fixed !important",n.style.pointerEvents="none !important",n.style.userSelect="none !important",n.style.height="1px !important",n.onload=()=>o(n),document.body.appendChild(n),n};const t=performance.now(),n=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"}},r=(e,o,...r)=>{var s,i;const{elapsedTimePretty:a}=(()=>{const e=performance.now()-t,o=e>1e3?`${(e/1e3).toFixed(2)}s`:`${e.toFixed(2)}ms`;return{elapsedTime:e,elapsedTimePretty:o}})(),l=[`(${a})`,...r];l.map(n).join(" ");if(!(!!(null===(s=window.Zonos)||void 0===s?void 0:s.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return;let d=document.querySelector("iframe#zonos---debug-logging-iframe");d||(d=document.createElement("iframe"),d.id="zonos---debug-logging-iframe",d.style.display="none",d.style.opacity="0",d.style.position="absolute",d.style.top="-9999px",d.style.left="-9999px",d.style.width="1px",d.style.height="1px",d.style.border="none",d.style.overflow="hidden",d.style.visibility="hidden",document.body.appendChild(d));const c=(null===(i=d.contentWindow)||void 0===i?void 0:i.window.console)||window.console;switch(o){case"warn":c.warn(e,...l);break;case"info":c.info(e,...l);break;case"error":c.error(e,...l);break;default:c.groupCollapsed(e,...l),c.trace(),c.groupEnd()}},s=(e,...o)=>{r(e,"error",...o)},i=["jsdelivr","cdnjs","unpkg","vercel"],a="jsdelivr",l=e=>{const o=i.indexOf(e);return i[o+1]||null},d=()=>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 u(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 p=["cloudflare","vercel"],m=p[0],w={cloudflare:"https://route.elements.zonos.com",vercel:"https://route.js.zonos.com"},h=w[m],y=(e=m)=>{const o=p.indexOf(e),t=p[o+1];return t||null},g=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},f=()=>{const e="userAgentData"in window.navigator?window.navigator.userAgentData:null,o=(()=>{const e="connection"in window.navigator?window.navigator.connection:null,o="mozConnection"in window.navigator?window.navigator.mozConnection:null,t="webkitConnection"in window.navigator?window.navigator.webkitConnection:null;return e||o||t})();return{connectionDownlink:null==o?void 0:o.downlink,connectionEffectiveType:null==o?void 0:o.effectiveType,connectionRtt:null==o?void 0:o.rtt,connectionSaveData:null==o?void 0:o.saveData,isHostedCheckout:window.Zonos.isLegacyCheckout,screenHeight:window.screen.height,screenWidth:window.innerWidth,userAgent:e&&e.brands.length>0?e:window.navigator.userAgent}},v=["/api/zonos-elements/log-script-load","/api/zonos-elements/log-bulk-load-data"],b=async({response:e,shouldLog:o=!0,shouldThrow:t=!1})=>{try{const o=await e.text(),t=g(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}},S=async({basePathType:e,options:o,path:t})=>{let n;const r=window.Zonos.zonosQaUrlApi||w[e]||m,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"),l=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&a&&l&&(window.Zonos.modeAlerted=!0),n.ok){return{baseUrl:r,errors:[],json:await b({response:n}),response:n,zonosMode:a}}const d=n.status.toString();try{const e=await b({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:d}:e)),json:null,response:n,zonosMode:a}}return{baseUrl:r,errors:[{message:JSON.stringify(e),type:d}],json:null,response:n,zonosMode:a}}catch(e){return{baseUrl:r,errors:[{message:`${d}: ${"Unknown error"}`,type:d}],json:null,response:null,zonosMode:a}}},C=async({basePathType:e,options:o,path:t})=>{var n,s;const i=t.startsWith("/api/bigcommerce")?"vercel":e,a=performance.now(),l=await S({basePathType:i,options:o,path:t}),{errors:d,response:c}=l,p=u(l,["errors","response"]),m=performance.now()-a;r(`${t} (${m.toFixed(2)}ms)`,"info");const b=null==c?void 0:c.headers.get("Zonos-Duration");200===(null==c?void 0:c.status)&&(({apiPath:e,apiType:o,loadTimeInternal:t,loadTimeTotal:n})=>{if(v.includes(e))return;const r=n-t;if(r<0)return;const s=e.split("?")[0]||e,i=f(),a="object"==typeof i.userAgent&&i.userAgent.mobile,l={apiType:o,connectionType:i.connectionEffectiveType,href:s,isHostedCheckout:window.Zonos.isLegacyCheckout,isMobile:(d=a,d||window.innerWidth<890),loadTimeBrowserApi:r,loadTimeInternal:t,loadTimeTotal:n,metadata:Object.assign({},i),screenHeight:i.screenHeight,screenWidth:i.screenWidth,userAgent:"string"==typeof i.userAgent?i.userAgent:i.userAgent.brands.map((e=>e.brand)).filter((e=>!/Not.*A.*Brand.*/.test(e))).join(",")};var d;window.Zonos.loadTimeApiInfoList.push(l)})({apiPath:t,apiType:i,loadTimeInternal:b?Number(b):0,loadTimeTotal:m});const z=y(i),k=d.find((({type:e})=>"unknown"===e)),Z=d.find((({message:e})=>"string"==typeof e&&(e.includes("signal is aborted")||e.includes("The operation was aborted")||e.includes("Fetch is aborted")))),j=!!k||404===(null==c?void 0:c.status)||500===(null==c?void 0:c.status),O=z&&j;return j&&!Z&&(async({endpoint:e,errors:o,metadata:t,shouldPostReleaseErrorReporting:n})=>{r("sendErrorLog","warn",e,t,o);{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},t)};try{fetch(`${h}/api/zonos-elements/log-error`,{body:JSON.stringify(i),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const o=y();if(!o)return;fetch(`${w[o]}/api/zonos-elements/log-error`,{body:JSON.stringify(i),method:"POST"})}})({endpoint:w[i]+t,errors:d.map((({message:e})=>`API: ${e}`)),metadata:{currentBasePath:i,nextFallbackApiType:z,requestHeaders:null==o?void 0:o.headers,requestPayload:g(null===(n=null==o?void 0:o.body)||void 0===n?void 0:n.toString())||(null===(s=null==o?void 0:o.body)||void 0===s?void 0:s.toString()),shouldCallFallback:O,status:null==c?void 0:c.status,statusText:null==c?void 0:c.statusText},shouldPostReleaseErrorReporting:!0}),O?(r(`=== "${t}" failed to fetch, trying next fallback ${z}`),C({basePathType:z,options:o,path:t})):Object.assign({errors:d,response:c},p)},z=async(e,o)=>{const t=u(o||{},[]),n=t.body?JSON.stringify(t.body):void 0,r=t.method||"GET",s=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Staging-Mode":d()?"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"},t.headers);Object.keys(s).forEach((e=>void 0===s[e]&&delete s[e]));const i=Object.assign(Object.assign({},t),{body:"GET"===r?void 0:n,headers:s,method:r}),a=new URLSearchParams(window.location.search).get("useFallbackApi");return C({basePathType:a||m,options:i,path:e})},k=()=>{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),t="https://v1.3.269.js.zonos.com";if(!o&&(t.includes("test.")||t.includes("test-")))return t;if(!o&&["dev.demo.elements.zonos.com","dev.checkout.elements.zonos.com","dev.storybook.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 n=`https://${o}.preview.js.zonos.com`;return r(`[ZONOS-WARNING] using '${n}' for loading elements script`,"warn"),fetch(n).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${n}' 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})),n},Z="https://js.stripe.com/v3",j=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;let O=null;const I=e=>(null!==O||(O=new Promise(((o,t)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe)o(window.Stripe);else try{let n=(()=>{const e=document.querySelectorAll(`script[src^="${Z}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&j.test(t.src))return t}return null})();n&&e?console.warn("loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used"):n||(n=(e=>{const o=document.createElement("script");o.src=`${Z}`;const t=document.head||document.body;return t?(t.appendChild(o),o):(s("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==n||n.addEventListener("load",(()=>{window.Stripe?o(window.Stripe):t(new Error("Stripe.js not available"))})),null==n||n.addEventListener("error",(()=>{t(new Error("Failed to load Stripe.js"))}))}catch(e){return void t(e)}else o(null)}))),O),A=Promise.resolve().then((()=>I(null)));let E=!1;A.catch((e=>{E||console.warn(e)}));const T=async({cartId:e,retries:o})=>{const t=c(),n=(()=>{const e=new URLSearchParams(window.location.search);return{overrideShouldEnabledCustomAddress:window.Zonos.overrideUseCustomAddressForm?"1":e.get("overrideShouldEnabledCustomAddress")}})(),s=(()=>{const e=new URLSearchParams(window.location.search).get("validityToken");if(!e||!/^[A-Za-z0-9+/]+={0,2}$/.test(e)||e.length%4!=0)return null;try{return atob(e),e}catch(e){return null}})()||void 0,i=new URLSearchParams;n.overrideShouldEnabledCustomAddress&&i.set("overrideShouldEnabledCustomAddress",n.overrideShouldEnabledCustomAddress);const{errors:a,json:l,zonosMode:d}=await z(`/api/zonos-elements/get-cart?${i.toString()}`,{body:{isTestMode:t,renewCartExpirationToken:s,tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"}),u=!l||a.length;return u&&o?(r("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:o}),await new Promise((e=>setTimeout(e,500))),T({cartId:e,retries:o-1})):u?null:Object.assign(Object.assign({},l),{zonosMode:d})},L=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/,P=new RegExp(`^${L.source}$`),$=new RegExp(`^cart_${L.source}$`),U=/^[a-zA-Z0-9]{2,}$/,N=/^cart_[a-zA-Z0-9]{2,}$/,D=async e=>{const{isDgsCartId:o,isLegacyCartId:t}=(e=>e?e.includes("undefined")?{isDgsCartId:!1,isLegacyCartId:!1}:N.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:U.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:$.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:P.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:{isDgsCartId:!1,isLegacyCartId:!1}:{isDgsCartId:!1,isLegacyCartId:!1})(e);if(!t&&!o)return s("[ZONOS - loadZonos] invalid cart id"),null;const n=await T({cartId:e,retries:5});return r("[ZONOS - loadZonos] getting temp cart data","info",n),n?(window.Zonos.storeId=n.cartData.storeId,window.Zonos.zonosApiKey=n.cartData.credentialToken,window.Zonos.zonosMode=n.zonosMode,{cartData:n.cartData,settings:n.settings,storeFavicon:n.storeFaviconUrl,storeId:n.cartData.storeId,storeLogo:n.storeLogoUrl,zonosApiKey:n.cartData.credentialToken}):(s("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)},R="zonos--checkout-hidden-international-button";var F;const x=(()=>{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})(),M=Date.now(),B="https://v1.3.269.js.zonos.com",q=x||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.269",W="https://fonts.googleapis.com",K=/^https:\/\/fonts\.googleapis\.com/;class G{}F=G,G.doneInit=!1,G.cartSettings=null,G.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),G.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),G._paypalMockResponse=null,G.iframeLogType="undefined"!=typeof window?new URLSearchParams(window.location.search).get("iframeLogType"):null,G.isBigCommerce=!1,G.releaseDate="1781282581347",G.isLegacyCheckout=!1,G.googleAnalyticId=null,G.googleAnalyticReady=!1,G.facebookPixelId=null,G.facebookPixelReady=!1,G.startLoadTime=M,G.domain="undefined"!=typeof window?window.location!=window.parent.location&&document.referrer||document.location.hostname:"",G.showBaseForeign="undefined"!=typeof window&&window.location.search.includes("zonosShowBaseForeign"),G.overrideUseCustomAddressForm=!1,G.isCollect=!1,G.isInvoice=!1,G.isNpm=!0,G.zonosQaUrl=null,G.zonosQaUrlApi=null,G.trackEventLogs=[],G.version="v1.3.269",G.modeAlerted=!1,G.cartData=null,G.paypal=null,G.zonosMode=null,G.IframeService=o,G.getCurrentTimestamp=()=>(new Date).getTime(),G.zonosController=null,G.loadTimeApiInfoList=[],G.logIntervalId=null,G.init=async e=>{const{appearance:o,checkoutSettings:t,currencyConverter:n,helloSettings:i,onCountryChange:a,overrideCurrencyFormat:l,storeId:u,zonosApiKey:p}=e;if(F.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),F.doneInit)return;if(r(`====== ZONOS DEBUG MODE: on (${F.version}) ======`),F.zonosApiKey=p,F.storeId=u,"undefined"!=typeof window&&window.parent===window&&(F.googleAnalyticReady=!0,F.facebookPixelReady=!0),F.isNpm){r("====== ZONOS LOADING FROM NPM ======");const o=k();if(o&&!window.isZonosPreview){r(`====== RE-INJECT "zonos.js" FROM PRVIEW: ${o} ======`,"info");const t=document.createElement("script");return t.src=`${o}/dist/scripts/zonos.js`,document.head.appendChild(t),t.addEventListener("load",(()=>{window.Zonos.isNpm=F.isNpm,window.Zonos.isBigCommerce=F.isBigCommerce,window.Zonos.isLegacyCheckout=F.isLegacyCheckout,window.Zonos.zonosMode=F.zonosMode,window.Zonos.init(e)})),t.addEventListener("error",(()=>{alert(`[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: ${o}`)})),void(window.isZonosPreview=!0)}if(!p&&!F.cartId)return void s("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!F.cartData&&F.cartId){r("Initialize cart data");const e=await D(F.cartId);if(!e)return void s("Failed to get cart data");F.cartData=e.cartData,F.zonosApiKey=e.zonosApiKey,F.cartSettings=e.settings}const t=await(async()=>{const e=c(),o=d();if(!e&&!o||!window.Zonos.zonosApiKey)return null;if(r("[ZONOS - loadZonos] Attempt test public credential","info"),window.Zonos.zonosApiKey.includes("credential_test"))return r("[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key","info"),null;const{errors:t,json:n}=await z("/api/get-test-public-credential");if(t.length||!n)return s("[ZONOS - loadZonos] Failed to get test public credential. Keep using production key",t),null;const i=n.publicCredential;return i?(r(`[ZONOS - loadZonos] Retrieve new test public token ${i}`,"info"),i):(s("[ZONOS - loadZonos] No test public key credential. Keep using production key"),null)})();t&&(F.zonosApiKey=t)}const m=new URL(window.location.href).searchParams.get("payment_intent_client_secret")||sessionStorage.getItem("zonos--client-secret");if(F.cartId&&F.cartData||!!m){r("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)}r("init zonos"),F.restoreNativeBrowserFunctions(),F.injectCustomScriptForHostedCheckout(),F.injectZonosCdn(),F.injectZonosCss(),F.injectFonts(),F.injectCheckoutInternationalButton(),F.injectController({config:{appearance:o,checkoutSettings:t,currencyConverter:n,helloSettings:i,onCountryChange:a,overrideCurrencyFormat:l}}),F.doneInit=!0},G.injectCheckoutInternationalButton=()=>{if(!document.querySelector(`#${R}`)){const e=document.createElement("button");e.id=R,e.style.display="none",document.body.appendChild(e)}},G.injectCustomScriptForHostedCheckout=()=>{const e=F.cartData,o=(null==e?void 0:e.metadata)||[],t=o.find((e=>"customHeaderScript"===e.key)),n=o.find((e=>"customFooterScript"===e.key));if(window.Zonos.isLegacyCheckout&&(t||n)){if(t){r("Injecting custom header script");const e=document.createElement("script");e.textContent=t.value,document.head.appendChild(e)}if(n){r("Injecting custom footer script");const e=document.createElement("script");e.textContent=n.value,document.body.appendChild(e)}}else r("Skip injecting custom script for hosted checkout","info",{footerScript:n,headerScript:t,isLegacyCheckout:window.Zonos.isLegacyCheckout})},G.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},G.triggerCheckoutInternational=async()=>{const e=document.querySelector(`#${R}`);setTimeout((()=>{var o;e&&e.dispatchEvent(new CustomEvent("click",{detail:o}))}),10)},G.openHelloDialog=e=>{const o=document.querySelector("zonos-hello");o&&o.openHelloDialog(null==e||e)},G.showNotification=e=>{var o;null===(o=F.zonosController)||void 0===o||o.showNotification(e)},G.updateOrganizationName=e=>{var o;null===(o=F.zonosController)||void 0===o||o.updateOrganizationName(e)},G.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)}},G.restoreNativeBrowserFunctions=()=>{var e;if("1"===new URL(window.location.href).searchParams.get("useMerchantPolyfill"))return;const o="zonos---native-browser";let t=document.querySelector(`iframe#${o}`);t||(t=document.createElement("iframe"),t.id=o,t.style.display="none",t.style.opacity="0",t.style.position="absolute",t.style.top="-9999px",t.style.left="-9999px",t.style.width="1px",t.style.height="1px",t.style.border="none",t.style.overflow="hidden",t.style.visibility="hidden",document.body.appendChild(t));const n=(null===(e=t.contentWindow)||void 0===e?void 0:e.window.Array.from)||Array.from;Array.from=n,document.body.removeChild(t)},G.injectController=({config:e})=>{var o,t;if(document.querySelector("zonos-controller"))return;if(null===(o=e.checkoutSettings)||void 0===o?void 0:o.placeOrderButtonSelector){const o=e.checkoutSettings.placeOrderButtonSelector;F.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o});new MutationObserver((()=>{F.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o})})).observe(document.body,{childList:!0,subtree:!0})}if(null===(t=e.checkoutSettings)||void 0===t?void 0:t.alwaysTriggerInternationalCheckoutSelector){const o=e.checkoutSettings.alwaysTriggerInternationalCheckoutSelector;F.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o});new MutationObserver((()=>{F.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o})})).observe(document.body,{childList:!0,subtree:!0})}const n=document.createElement("zonos-controller");n.config=e,n.zonosApiKey=F.zonosApiKey||"",n.addEventListener("stripeInitEvent",(async e=>{const{detail:o}=e;r("loading Stripe");const t=await(async(...e)=>{E=!0;const o=Date.now();return A.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);t?(window.Zonos.stripe=t,window.Zonos.isCollect?n.initCollectElement(t):window.Zonos.isInvoice?n.initInvoiceElement(t):n.initCheckoutElement(t)):s("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(n),F.zonosController=n,r("Zonos controller injected!")},G.injectScript=({cdnType:e,isModule:o,theRestUrl:t})=>{const n=`${F.getZonosUrl(e)}/${t}`;if(document.querySelector(`script[src="${n}"]`))return void r(`Zonos script "${n}" already exists in the document`,"warn");const i=document.head||document.body,a=document.createElement("script");o?a.type="module":a.noModule=!0,a.src=n,a.crossOrigin="anonymous",a.onerror=()=>{s(`Failed to load ${a.src}`);const n=l(e);n&&F.injectScript({cdnType:n,isModule:o,theRestUrl:t})},i.appendChild(a)},G.getZonosUrl=e=>{const o=()=>{switch(e){case"jsdelivr":return q;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.269";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.269";case"vercel":return B}};if(F.isNpm){return k()||o()}return o()},G.injectZonosCdn=()=>{F.injectScript({cdnType:a,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),F.injectScript({cdnType:a,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),r("Zonos cdn script injected!")},G.injectStylesheet=({cdnType:e,theRestUrl:o})=>{const t=F.getZonosUrl(e),n=document.head||document.body,r=document.createElement("link");r.rel="preconnect",r.href=`${B}/`,n.appendChild(r);const i=document.createElement("link");i.rel="stylesheet",i.href=`${t}/${o}`,i.onerror=()=>{s(`Failed to load ${i.href}`);const t=l(e);t&&F.injectStylesheet({cdnType:t,theRestUrl:o})},n.appendChild(i)},G.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?r("Zonos style links already injected","warn"):(F.injectStylesheet({cdnType:a,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),r("Zonos style css injected!"))},G.injectFonts=()=>{if((()=>{if(document.fonts.check("1em Inter"))return void r("Inter font already loaded","warn");const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${W}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&!K.test(t.href))return t}return null})())return void r("Inter font already injected","warn");const e=document.head||document.body,o=document.createElement("link");o.rel="preconnect",o.href=W,e.appendChild(o);const t=document.createElement("link");t.rel="stylesheet",t.href=`${W}/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap`,e.appendChild(t),r("Zonos font injected!")},G.setupGoogleFont=e=>{var o;null===(o=F.zonosController)||void 0===o||o.setupGoogleFont(e)},G.injectSupportGoogleFont=e=>{var o;r(`[FONT] injecting ${e}`);const t=null===(o=e.match(/family=(.*?):/))||void 0===o?void 0:o[1],n=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${W}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=W,n.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${e}"]`))return void r(`[FONT] ${t} font already injected`,"warn");const s=document.createElement("link");s.rel="stylesheet",s.href=e,n.appendChild(s),r(`[FONT] ${t} font injected!`)},exports.Zonos=G})();
1
+ (function(){"use strict";const e=({id:e,payload:o,target:t,type:n})=>{var r;t instanceof HTMLIFrameElement?null===(r=t.contentWindow)||void 0===r||r.postMessage({id:e,payload:o,type:n},"*"):t.postMessage({id:e,payload:o,type:n},"*")};class o{constructor(o,t){this.targetElement=o,this.targetId=t,this.sendMessage=(o,t)=>{e({id:this.targetId,payload:t,target:this.targetElement,type:o})}}}o.iframeServices={GOOGLE_PLACES:"zonos--private-iframe-google-places-service-m9bmuh7g"},o.sendMessage=e,o.injectPrivateIframe=({id:e,onload:o,src:t})=>{const n=document.createElement("iframe");return n.src=t,n.id=e,n.style.display="none",n.role="presentation",n.ariaHidden="true",n.tabIndex=-1,n.style.border="none !important",n.style.margin="0px !important",n.style.padding="0px !important",n.style.width="1px !important",n.style.minWidth="100% !important",n.style.overflow="hidden !important",n.style.display="block !important",n.style.visibility="hidden !important",n.style.position="fixed !important",n.style.pointerEvents="none !important",n.style.userSelect="none !important",n.style.height="1px !important",n.onload=()=>o(n),document.body.appendChild(n),n};const t=performance.now(),n=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"}},r=(e,o,...r)=>{var s,i;const{elapsedTimePretty:a}=(()=>{const e=performance.now()-t,o=e>1e3?`${(e/1e3).toFixed(2)}s`:`${e.toFixed(2)}ms`;return{elapsedTime:e,elapsedTimePretty:o}})(),l=[`(${a})`,...r];l.map(n).join(" ");if(!(!!(null===(s=window.Zonos)||void 0===s?void 0:s.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return;let d=document.querySelector("iframe#zonos---debug-logging-iframe");d||(d=document.createElement("iframe"),d.id="zonos---debug-logging-iframe",d.style.display="none",d.style.opacity="0",d.style.position="absolute",d.style.top="-9999px",d.style.left="-9999px",d.style.width="1px",d.style.height="1px",d.style.border="none",d.style.overflow="hidden",d.style.visibility="hidden",document.body.appendChild(d));const c=(null===(i=d.contentWindow)||void 0===i?void 0:i.window.console)||window.console;switch(o){case"warn":c.warn(e,...l);break;case"info":c.info(e,...l);break;case"error":c.error(e,...l);break;default:c.groupCollapsed(e,...l),c.trace(),c.groupEnd()}},s=(e,...o)=>{r(e,"error",...o)},i=["jsdelivr","cdnjs","unpkg","vercel"],a="jsdelivr",l=e=>{const o=i.indexOf(e);return i[o+1]||null},d=()=>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 u(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 p=["cloudflare","vercel"],m=p[0],w={cloudflare:"https://route.elements.zonos.com",vercel:"https://route.js.zonos.com"},h=w[m],y=(e=m)=>{const o=p.indexOf(e),t=p[o+1];return t||null},g=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},f=()=>{const e="userAgentData"in window.navigator?window.navigator.userAgentData:null,o=(()=>{const e="connection"in window.navigator?window.navigator.connection:null,o="mozConnection"in window.navigator?window.navigator.mozConnection:null,t="webkitConnection"in window.navigator?window.navigator.webkitConnection:null;return e||o||t})();return{connectionDownlink:null==o?void 0:o.downlink,connectionEffectiveType:null==o?void 0:o.effectiveType,connectionRtt:null==o?void 0:o.rtt,connectionSaveData:null==o?void 0:o.saveData,isHostedCheckout:window.Zonos.isLegacyCheckout,screenHeight:window.screen.height,screenWidth:window.innerWidth,userAgent:e&&e.brands.length>0?e:window.navigator.userAgent}},v=["/api/zonos-elements/log-script-load","/api/zonos-elements/log-bulk-load-data"],b=async({response:e,shouldLog:o=!0,shouldThrow:t=!1})=>{try{const o=await e.text(),t=g(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}},S=async({basePathType:e,options:o,path:t})=>{let n;const r=window.Zonos.zonosQaUrlApi||w[e]||m,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"),l=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&a&&l&&(window.Zonos.modeAlerted=!0),n.ok){return{baseUrl:r,errors:[],json:await b({response:n}),response:n,zonosMode:a}}const d=n.status.toString();try{const e=await b({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:d}:e)),json:null,response:n,zonosMode:a}}return{baseUrl:r,errors:[{message:JSON.stringify(e),type:d}],json:null,response:n,zonosMode:a}}catch(e){return{baseUrl:r,errors:[{message:`${d}: ${"Unknown error"}`,type:d}],json:null,response:null,zonosMode:a}}},C=async({basePathType:e,options:o,path:t})=>{var n,s;const i=t.startsWith("/api/bigcommerce")?"vercel":e,a=performance.now(),l=await S({basePathType:i,options:o,path:t}),{errors:d,response:c}=l,p=u(l,["errors","response"]),m=performance.now()-a;r(`${t} (${m.toFixed(2)}ms)`,"info");const b=null==c?void 0:c.headers.get("Zonos-Duration");200===(null==c?void 0:c.status)&&(({apiPath:e,apiType:o,loadTimeInternal:t,loadTimeTotal:n})=>{if(v.includes(e))return;const r=n-t;if(r<0)return;const s=e.split("?")[0]||e,i=f(),a="object"==typeof i.userAgent&&i.userAgent.mobile,l={apiType:o,connectionType:i.connectionEffectiveType,href:s,isHostedCheckout:window.Zonos.isLegacyCheckout,isMobile:(d=a,d||window.innerWidth<890),loadTimeBrowserApi:r,loadTimeInternal:t,loadTimeTotal:n,metadata:Object.assign({},i),screenHeight:i.screenHeight,screenWidth:i.screenWidth,userAgent:"string"==typeof i.userAgent?i.userAgent:i.userAgent.brands.map((e=>e.brand)).filter((e=>!/Not.*A.*Brand.*/.test(e))).join(",")};var d;window.Zonos.loadTimeApiInfoList.push(l)})({apiPath:t,apiType:i,loadTimeInternal:b?Number(b):0,loadTimeTotal:m});const z=y(i),k=d.find((({type:e})=>"unknown"===e)),Z=d.find((({message:e})=>"string"==typeof e&&(e.includes("signal is aborted")||e.includes("The operation was aborted")||e.includes("Fetch is aborted")))),j=!!k||404===(null==c?void 0:c.status)||500===(null==c?void 0:c.status),O=z&&j;return j&&!Z&&(async({endpoint:e,errors:o,metadata:t,shouldPostReleaseErrorReporting:n})=>{r("sendErrorLog","warn",e,t,o);{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},t)};try{fetch(`${h}/api/zonos-elements/log-error`,{body:JSON.stringify(i),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const o=y();if(!o)return;fetch(`${w[o]}/api/zonos-elements/log-error`,{body:JSON.stringify(i),method:"POST"})}})({endpoint:w[i]+t,errors:d.map((({message:e})=>`API: ${e}`)),metadata:{currentBasePath:i,nextFallbackApiType:z,requestHeaders:null==o?void 0:o.headers,requestPayload:g(null===(n=null==o?void 0:o.body)||void 0===n?void 0:n.toString())||(null===(s=null==o?void 0:o.body)||void 0===s?void 0:s.toString()),shouldCallFallback:O,status:null==c?void 0:c.status,statusText:null==c?void 0:c.statusText},shouldPostReleaseErrorReporting:!0}),O?(r(`=== "${t}" failed to fetch, trying next fallback ${z}`),C({basePathType:z,options:o,path:t})):Object.assign({errors:d,response:c},p)},z=async(e,o)=>{const t=u(o||{},[]),n=t.body?JSON.stringify(t.body):void 0,r=t.method||"GET",s=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Staging-Mode":d()?"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"},t.headers);Object.keys(s).forEach((e=>void 0===s[e]&&delete s[e]));const i=Object.assign(Object.assign({},t),{body:"GET"===r?void 0:n,headers:s,method:r}),a=new URLSearchParams(window.location.search).get("useFallbackApi");return C({basePathType:a||m,options:i,path:e})},k=()=>{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),t="https://v1.3.272.js.zonos.com";if(!o&&(t.includes("test.")||t.includes("test-")))return t;if(!o&&["dev.demo.elements.zonos.com","dev.checkout.elements.zonos.com","dev.storybook.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 n=`https://${o}.preview.js.zonos.com`;return r(`[ZONOS-WARNING] using '${n}' for loading elements script`,"warn"),fetch(n).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${n}' 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})),n},Z="https://js.stripe.com/v3",j=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;let O=null;const I=e=>(null!==O||(O=new Promise(((o,t)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe)o(window.Stripe);else try{let n=(()=>{const e=document.querySelectorAll(`script[src^="${Z}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&j.test(t.src))return t}return null})();n&&e?console.warn("loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used"):n||(n=(e=>{const o=document.createElement("script");o.src=`${Z}`;const t=document.head||document.body;return t?(t.appendChild(o),o):(s("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==n||n.addEventListener("load",(()=>{window.Stripe?o(window.Stripe):t(new Error("Stripe.js not available"))})),null==n||n.addEventListener("error",(()=>{t(new Error("Failed to load Stripe.js"))}))}catch(e){return void t(e)}else o(null)}))),O),A=Promise.resolve().then((()=>I(null)));let E=!1;A.catch((e=>{E||console.warn(e)}));const T=async({cartId:e,retries:o})=>{const t=c(),n=(()=>{const e=new URLSearchParams(window.location.search);return{overrideShouldEnabledCustomAddress:window.Zonos.overrideUseCustomAddressForm?"1":e.get("overrideShouldEnabledCustomAddress")}})(),s=(()=>{const e=new URLSearchParams(window.location.search).get("validityToken");if(!e||!/^[A-Za-z0-9+/]+={0,2}$/.test(e)||e.length%4!=0)return null;try{return atob(e),e}catch(e){return null}})()||void 0,i=new URLSearchParams;n.overrideShouldEnabledCustomAddress&&i.set("overrideShouldEnabledCustomAddress",n.overrideShouldEnabledCustomAddress);const{errors:a,json:l,zonosMode:d}=await z(`/api/zonos-elements/get-cart?${i.toString()}`,{body:{isTestMode:t,renewCartExpirationToken:s,tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"}),u=!l||a.length;return u&&o?(r("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:o}),await new Promise((e=>setTimeout(e,500))),T({cartId:e,retries:o-1})):u?null:Object.assign(Object.assign({},l),{zonosMode:d})},L=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/,P=new RegExp(`^${L.source}$`),$=new RegExp(`^cart_${L.source}$`),U=/^[a-zA-Z0-9]{2,}$/,N=/^cart_[a-zA-Z0-9]{2,}$/,D=async e=>{const{isDgsCartId:o,isLegacyCartId:t}=(e=>e?e.includes("undefined")?{isDgsCartId:!1,isLegacyCartId:!1}:N.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:U.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:$.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:P.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:{isDgsCartId:!1,isLegacyCartId:!1}:{isDgsCartId:!1,isLegacyCartId:!1})(e);if(!t&&!o)return s("[ZONOS - loadZonos] invalid cart id"),null;const n=await T({cartId:e,retries:5});return r("[ZONOS - loadZonos] getting temp cart data","info",n),n?(window.Zonos.storeId=n.cartData.storeId,window.Zonos.zonosApiKey=n.cartData.credentialToken,window.Zonos.zonosMode=n.zonosMode,{cartData:n.cartData,settings:n.settings,storeFavicon:n.storeFaviconUrl,storeId:n.cartData.storeId,storeLogo:n.storeLogoUrl,zonosApiKey:n.cartData.credentialToken}):(s("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)},R="zonos--checkout-hidden-international-button";var F;const x=(()=>{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})(),M=Date.now(),B="https://v1.3.272.js.zonos.com",q=x||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.272",W="https://fonts.googleapis.com",K=/^https:\/\/fonts\.googleapis\.com/;class G{}F=G,G.doneInit=!1,G.cartSettings=null,G.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),G.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),G._paypalMockResponse=null,G.iframeLogType="undefined"!=typeof window?new URLSearchParams(window.location.search).get("iframeLogType"):null,G.isBigCommerce=!1,G.releaseDate="1782316453940",G.isLegacyCheckout=!1,G.googleAnalyticId=null,G.googleAnalyticReady=!1,G.facebookPixelId=null,G.facebookPixelReady=!1,G.startLoadTime=M,G.domain="undefined"!=typeof window?window.location!=window.parent.location&&document.referrer||document.location.hostname:"",G.showBaseForeign="undefined"!=typeof window&&window.location.search.includes("zonosShowBaseForeign"),G.overrideUseCustomAddressForm=!1,G.isCollect=!1,G.isInvoice=!1,G.isNpm=!0,G.zonosQaUrl=null,G.zonosQaUrlApi=null,G.trackEventLogs=[],G.version="v1.3.272",G.modeAlerted=!1,G.cartData=null,G.paypal=null,G.zonosMode=null,G.IframeService=o,G.getCurrentTimestamp=()=>(new Date).getTime(),G.zonosController=null,G.loadTimeApiInfoList=[],G.logIntervalId=null,G.init=async e=>{const{appearance:o,checkoutSettings:t,currencyConverter:n,helloSettings:i,onCountryChange:a,overrideCurrencyFormat:l,storeId:u,zonosApiKey:p}=e;if(F.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),F.doneInit)return;if(r(`====== ZONOS DEBUG MODE: on (${F.version}) ======`),F.zonosApiKey=p,F.storeId=u,"undefined"!=typeof window&&window.parent===window&&(F.googleAnalyticReady=!0,F.facebookPixelReady=!0),F.isNpm){r("====== ZONOS LOADING FROM NPM ======");const o=k();if(o&&!window.isZonosPreview){r(`====== RE-INJECT "zonos.js" FROM PRVIEW: ${o} ======`,"info");const t=document.createElement("script");return t.src=`${o}/dist/scripts/zonos.js`,document.head.appendChild(t),t.addEventListener("load",(()=>{window.Zonos.isNpm=F.isNpm,window.Zonos.isBigCommerce=F.isBigCommerce,window.Zonos.isLegacyCheckout=F.isLegacyCheckout,window.Zonos.zonosMode=F.zonosMode,window.Zonos.init(e)})),t.addEventListener("error",(()=>{alert(`[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: ${o}`)})),void(window.isZonosPreview=!0)}if(!p&&!F.cartId)return void s("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!F.cartData&&F.cartId){r("Initialize cart data");const e=await D(F.cartId);if(!e)return void s("Failed to get cart data");F.cartData=e.cartData,F.zonosApiKey=e.zonosApiKey,F.cartSettings=e.settings}const t=await(async()=>{const e=c(),o=d();if(!e&&!o||!window.Zonos.zonosApiKey)return null;if(r("[ZONOS - loadZonos] Attempt test public credential","info"),window.Zonos.zonosApiKey.includes("credential_test"))return r("[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key","info"),null;const{errors:t,json:n}=await z("/api/get-test-public-credential");if(t.length||!n)return s("[ZONOS - loadZonos] Failed to get test public credential. Keep using production key",t),null;const i=n.publicCredential;return i?(r(`[ZONOS - loadZonos] Retrieve new test public token ${i}`,"info"),i):(s("[ZONOS - loadZonos] No test public key credential. Keep using production key"),null)})();t&&(F.zonosApiKey=t)}const m=new URL(window.location.href).searchParams.get("payment_intent_client_secret")||sessionStorage.getItem("zonos--client-secret");if(F.cartId&&F.cartData||!!m){r("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)}r("init zonos"),F.restoreNativeBrowserFunctions(),F.injectCustomScriptForHostedCheckout(),F.injectZonosCdn(),F.injectZonosCss(),F.injectFonts(),F.injectCheckoutInternationalButton(),F.injectController({config:{appearance:o,checkoutSettings:t,currencyConverter:n,helloSettings:i,onCountryChange:a,overrideCurrencyFormat:l}}),F.doneInit=!0},G.injectCheckoutInternationalButton=()=>{if(!document.querySelector(`#${R}`)){const e=document.createElement("button");e.id=R,e.style.display="none",document.body.appendChild(e)}},G.injectCustomScriptForHostedCheckout=()=>{const e=F.cartData,o=(null==e?void 0:e.metadata)||[],t=o.find((e=>"customHeaderScript"===e.key)),n=o.find((e=>"customFooterScript"===e.key));if(window.Zonos.isLegacyCheckout&&(t||n)){if(t){r("Injecting custom header script");const e=document.createElement("script");e.textContent=t.value,document.head.appendChild(e)}if(n){r("Injecting custom footer script");const e=document.createElement("script");e.textContent=n.value,document.body.appendChild(e)}}else r("Skip injecting custom script for hosted checkout","info",{footerScript:n,headerScript:t,isLegacyCheckout:window.Zonos.isLegacyCheckout})},G.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},G.triggerCheckoutInternational=async()=>{const e=document.querySelector(`#${R}`);setTimeout((()=>{var o;e&&e.dispatchEvent(new CustomEvent("click",{detail:o}))}),10)},G.openHelloDialog=e=>{const o=document.querySelector("zonos-hello");o&&o.openHelloDialog(null==e||e)},G.showNotification=e=>{var o;null===(o=F.zonosController)||void 0===o||o.showNotification(e)},G.updateOrganizationName=e=>{var o;null===(o=F.zonosController)||void 0===o||o.updateOrganizationName(e)},G.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)}},G.restoreNativeBrowserFunctions=()=>{var e;if("1"===new URL(window.location.href).searchParams.get("useMerchantPolyfill"))return;const o="zonos---native-browser";let t=document.querySelector(`iframe#${o}`);t||(t=document.createElement("iframe"),t.id=o,t.style.display="none",t.style.opacity="0",t.style.position="absolute",t.style.top="-9999px",t.style.left="-9999px",t.style.width="1px",t.style.height="1px",t.style.border="none",t.style.overflow="hidden",t.style.visibility="hidden",document.body.appendChild(t));const n=(null===(e=t.contentWindow)||void 0===e?void 0:e.window.Array.from)||Array.from;Array.from=n,document.body.removeChild(t)},G.injectController=({config:e})=>{var o,t;if(document.querySelector("zonos-controller"))return;if(null===(o=e.checkoutSettings)||void 0===o?void 0:o.placeOrderButtonSelector){const o=e.checkoutSettings.placeOrderButtonSelector;F.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o});new MutationObserver((()=>{F.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o})})).observe(document.body,{childList:!0,subtree:!0})}if(null===(t=e.checkoutSettings)||void 0===t?void 0:t.alwaysTriggerInternationalCheckoutSelector){const o=e.checkoutSettings.alwaysTriggerInternationalCheckoutSelector;F.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o});new MutationObserver((()=>{F.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o})})).observe(document.body,{childList:!0,subtree:!0})}const n=document.createElement("zonos-controller");n.config=e,n.zonosApiKey=F.zonosApiKey||"",n.addEventListener("stripeInitEvent",(async e=>{const{detail:o}=e;r("loading Stripe");const t=await(async(...e)=>{E=!0;const o=Date.now();return A.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);t?(window.Zonos.stripe=t,window.Zonos.isCollect?n.initCollectElement(t):window.Zonos.isInvoice?n.initInvoiceElement(t):n.initCheckoutElement(t)):s("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(n),F.zonosController=n,r("Zonos controller injected!")},G.injectScript=({cdnType:e,isModule:o,theRestUrl:t})=>{const n=`${F.getZonosUrl(e)}/${t}`;if(document.querySelector(`script[src="${n}"]`))return void r(`Zonos script "${n}" already exists in the document`,"warn");const i=document.head||document.body,a=document.createElement("script");o?a.type="module":a.noModule=!0,a.src=n,a.crossOrigin="anonymous",a.onerror=()=>{s(`Failed to load ${a.src}`);const n=l(e);n&&F.injectScript({cdnType:n,isModule:o,theRestUrl:t})},i.appendChild(a)},G.getZonosUrl=e=>{const o=()=>{switch(e){case"jsdelivr":return q;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.272";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.272";case"vercel":return B}};if(F.isNpm){return k()||o()}return o()},G.injectZonosCdn=()=>{F.injectScript({cdnType:a,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),F.injectScript({cdnType:a,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),r("Zonos cdn script injected!")},G.injectStylesheet=({cdnType:e,theRestUrl:o})=>{const t=F.getZonosUrl(e),n=document.head||document.body,r=document.createElement("link");r.rel="preconnect",r.href=`${B}/`,n.appendChild(r);const i=document.createElement("link");i.rel="stylesheet",i.href=`${t}/${o}`,i.onerror=()=>{s(`Failed to load ${i.href}`);const t=l(e);t&&F.injectStylesheet({cdnType:t,theRestUrl:o})},n.appendChild(i)},G.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?r("Zonos style links already injected","warn"):(F.injectStylesheet({cdnType:a,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),r("Zonos style css injected!"))},G.injectFonts=()=>{if((()=>{if(document.fonts.check("1em Inter"))return void r("Inter font already loaded","warn");const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${W}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&!K.test(t.href))return t}return null})())return void r("Inter font already injected","warn");const e=document.head||document.body,o=document.createElement("link");o.rel="preconnect",o.href=W,e.appendChild(o);const t=document.createElement("link");t.rel="stylesheet",t.href=`${W}/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap`,e.appendChild(t),r("Zonos font injected!")},G.setupGoogleFont=e=>{var o;null===(o=F.zonosController)||void 0===o||o.setupGoogleFont(e)},G.injectSupportGoogleFont=e=>{var o;r(`[FONT] injecting ${e}`);const t=null===(o=e.match(/family=(.*?):/))||void 0===o?void 0:o[1],n=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${W}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=W,n.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${e}"]`))return void r(`[FONT] ${t} font already injected`,"warn");const s=document.createElement("link");s.rel="stylesheet",s.href=e,n.appendChild(s),r(`[FONT] ${t} font injected!`)},exports.Zonos=G})();
@@ -1 +1 @@
1
- (function(){"use strict";const e=()=>{const e=new URLSearchParams(window.location.search);return{overrideShouldEnabledCustomAddress:window.Zonos.overrideUseCustomAddressForm?"1":e.get("overrideShouldEnabledCustomAddress")}},o=()=>{const e=new URL(window.location.href),o=window.sessionStorage.getItem("zonos--country");return(e=>{const o=new URLSearchParams(e||window.location.search),n=e=>{return(n=o.get(e))&&/^[A-Z]{2}$/.test(n)?n:null;var n},t=n("zCountry"),r=n("country"),s=n("customerCountry");return t||r||s})(e.searchParams)||o};function n(e,o){var n={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&o.indexOf(t)<0&&(n[t]=e[t]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(t=Object.getOwnPropertySymbols(e);r<t.length;r++)o.indexOf(t[r])<0&&Object.prototype.propertyIsEnumerable.call(e,t[r])&&(n[t[r]]=e[t[r]])}return n}"function"==typeof SuppressedError&&SuppressedError;const t=()=>window.location.search.includes("zonosStagingMode=1"),r=()=>{var e;return(null===(e=window.Zonos.zonosApiKey)||void 0===e?void 0:e.includes("test"))||window.location.search.includes("zonosTestMode=1")},s=["cloudflare","vercel"],i=s[0],a={cloudflare:"https://route.elements.zonos.com",vercel:"https://route.js.zonos.com"},d=a[i],l=(e=i)=>{const o=s.indexOf(e),n=s[o+1];return n||null},c=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},u=performance.now(),p=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"}},w=(e,o,...n)=>{var t,r;const{elapsedTimePretty:s}=(()=>{const e=performance.now()-u,o=e>1e3?`${(e/1e3).toFixed(2)}s`:`${e.toFixed(2)}ms`;return{elapsedTime:e,elapsedTimePretty:o}})(),i=[`(${s})`,...n];i.map(p).join(" ");if(!(!!(null===(t=window.Zonos)||void 0===t?void 0:t.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return;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(o){case"warn":d.warn(e,...i);break;case"info":d.info(e,...i);break;case"error":d.error(e,...i);break;default:d.groupCollapsed(e,...i),d.trace(),d.groupEnd()}},g=()=>{const e="connection"in window.navigator?window.navigator.connection:null,o="mozConnection"in window.navigator?window.navigator.mozConnection:null,n="webkitConnection"in window.navigator?window.navigator.webkitConnection:null;return e||o||n},m=["/api/zonos-elements/log-script-load","/api/zonos-elements/log-bulk-load-data"],y=({apiPath:e,apiType:o,loadTimeInternal:n,loadTimeTotal:t})=>{if(m.includes(e))return;const r=t-n;if(r<0)return;const s=e.split("?")[0]||e,i=(()=>{const e="userAgentData"in window.navigator?window.navigator.userAgentData:null,o=g();return{connectionDownlink:null==o?void 0:o.downlink,connectionEffectiveType:null==o?void 0:o.effectiveType,connectionRtt:null==o?void 0:o.rtt,connectionSaveData:null==o?void 0:o.saveData,isHostedCheckout:window.Zonos.isLegacyCheckout,screenHeight:window.screen.height,screenWidth:window.innerWidth,userAgent:e&&e.brands.length>0?e:window.navigator.userAgent}})(),a="object"==typeof i.userAgent&&i.userAgent.mobile,d={apiType:o,connectionType:i.connectionEffectiveType,href:s,isHostedCheckout:window.Zonos.isLegacyCheckout,isMobile:(l=a,l||window.innerWidth<890),loadTimeBrowserApi:r,loadTimeInternal:n,loadTimeTotal:t,metadata:Object.assign({},i),screenHeight:i.screenHeight,screenWidth:i.screenWidth,userAgent:"string"==typeof i.userAgent?i.userAgent:i.userAgent.brands.map((e=>e.brand)).filter((e=>!/Not.*A.*Brand.*/.test(e))).join(",")};var l;window.Zonos.loadTimeApiInfoList.push(d)},f=async({endpoint:e,errors:o,metadata:n,shouldPostReleaseErrorReporting:t})=>{if(w("sendErrorLog","warn",e,n,o),t){const e=Number(window.Zonos.releaseDate);if((new Date).getTime()-e>36e5)return}const r="userAgentData"in window.navigator?window.navigator.userAgentData:null,s={endpoint:e,errors:o,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(`${d}/api/zonos-elements/log-error`,{body:JSON.stringify(s),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const o=l();if(!o)return;fetch(`${a[o]}/api/zonos-elements/log-error`,{body:JSON.stringify(s),method:"POST"})}},h=async({response:e,shouldLog:o=!0,shouldThrow:n=!1})=>{try{const o=await e.text(),n=c(o);if(!n)throw new Error(`Failed to parse content: ${o}`);return n}catch(e){if(n)throw e;return o&&console.error(e),null}},v=async({basePathType:e,options:o,path:n})=>{let t;const r=window.Zonos.zonosQaUrlApi||a[e]||i,s=new URL(r+n),d=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("")}})(d));try{t=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 l=t.headers.get("Zonos-Mode"),c=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&l&&c&&(window.Zonos.modeAlerted=!0),t.ok){return{baseUrl:r,errors:[],json:await h({response:t}),response:t,zonosMode:l}}const u=t.status.toString();try{const e=await h({response:t,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:u}:e)),json:null,response:t,zonosMode:l}}return{baseUrl:r,errors:[{message:JSON.stringify(e),type:u}],json:null,response:t,zonosMode:l}}catch(e){return{baseUrl:r,errors:[{message:`${u}: ${"Unknown error"}`,type:u}],json:null,response:null,zonosMode:l}}},S=async({basePathType:e,options:o,path:t})=>{var r,s;const i=t.startsWith("/api/bigcommerce")?"vercel":e,d=performance.now(),u=await v({basePathType:i,options:o,path:t}),{errors:p,response:g}=u,m=n(u,["errors","response"]),h=performance.now()-d;w(`${t} (${h.toFixed(2)}ms)`,"info");const z=null==g?void 0:g.headers.get("Zonos-Duration");200===(null==g?void 0:g.status)&&y({apiPath:t,apiType:i,loadTimeInternal:z?Number(z):0,loadTimeTotal:h});const Z=l(i),C=p.find((({type:e})=>"unknown"===e)),b=p.find((({message:e})=>"string"==typeof e&&(e.includes("signal is aborted")||e.includes("The operation was aborted")||e.includes("Fetch is aborted")))),I=!!C||404===(null==g?void 0:g.status)||500===(null==g?void 0:g.status),L=Z&&I;return I&&!b&&f({endpoint:a[i]+t,errors:p.map((({message:e})=>`API: ${e}`)),metadata:{currentBasePath:i,nextFallbackApiType:Z,requestHeaders:null==o?void 0:o.headers,requestPayload:c(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()),shouldCallFallback:L,status:null==g?void 0:g.status,statusText:null==g?void 0:g.statusText},shouldPostReleaseErrorReporting:!0}),L?(w(`=== "${t}" failed to fetch, trying next fallback ${Z}`),S({basePathType:Z,options:o,path:t})):Object.assign({errors:p,response:g},m)},z=async(e,o)=>{const s=n(o||{},[]),a=s.body?JSON.stringify(s.body):void 0,d=s.method||"GET",l=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Staging-Mode":t()?"1":void 0,"Zonos-Test-Mode":r()?"1":void 0,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},s.headers);Object.keys(l).forEach((e=>void 0===l[e]&&delete l[e]));const c=Object.assign(Object.assign({},s),{body:"GET"===d?void 0:a,headers:l,method:d}),u=new URLSearchParams(window.location.search).get("useFallbackApi");return S({basePathType:u||i,options:c,path:e})},Z=(e,...o)=>{w(e,"error",...o)},C=["jsdelivr","cdnjs","unpkg","vercel"],b=e=>{if(!e)return null;const o=new URL(e).searchParams.get("zonosQaUrl");if(!o)return null;return/[^a-zA-Z0-9-_]+/.test(o)?null:o},I=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/,L=new RegExp(`^${I.source}$`),O=new RegExp(`^cart_${I.source}$`),A=/^[a-zA-Z0-9]{2,}$/,T=/^cart_[a-zA-Z0-9]{2,}$/,k=e=>e?e.includes("undefined")?{isDgsCartId:!1,isLegacyCartId:!1}:T.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:A.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:O.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:L.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:{isDgsCartId:!1,isLegacyCartId:!1}:{isDgsCartId:!1,isLegacyCartId:!1},U=async({cartId:o,retries:n})=>{const t=r(),s=e(),i=(()=>{const e=new URLSearchParams(window.location.search).get("validityToken");if(!e||!/^[A-Za-z0-9+/]+={0,2}$/.test(e)||e.length%4!=0)return null;try{return atob(e),e}catch(e){return null}})()||void 0,a=new URLSearchParams;s.overrideShouldEnabledCustomAddress&&a.set("overrideShouldEnabledCustomAddress",s.overrideShouldEnabledCustomAddress);const{errors:d,json:l,zonosMode:c}=await z(`/api/zonos-elements/get-cart?${a.toString()}`,{body:{isTestMode:t,renewCartExpirationToken:i,tempCartUUID:o},headers:{"Content-Type":"application/json"},method:"POST"}),u=!l||d.length;return u&&n?(w("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:n}),await new Promise((e=>setTimeout(e,500))),U({cartId:o,retries:n-1})):u?null:Object.assign(Object.assign({},l),{zonosMode:c})},j="z--blur",E=async()=>{const e=window.zonosBlurCurrencyOnInitIntervalId;if(!e)return;await new Promise((e=>setTimeout(e,500))),clearInterval(e);document.querySelectorAll(`.${j}`).forEach((e=>{e.classList.remove(j)})),window.zonosBlurCurrencyOnInitIntervalId=void 0},$=({currencySelector:e,specificSelector:o})=>{if(e||o)if(o)o.classList.add(j);else{document.querySelectorAll([e].filter(Boolean).join(",")).forEach((e=>{e.classList.add(j)}))}};var P;const N=(()=>{const e=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||e)return null;const o=b(window.location.href),n="https://v1.3.269.js.zonos.com";if(!o&&(n.includes("test.")||n.includes("test-")))return n;if(!o&&["dev.demo.elements.zonos.com","dev.checkout.elements.zonos.com","dev.storybook.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 t=`https://${o}.preview.js.zonos.com`;return w(`[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 e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:o}=window.location,n=`${o}?${e.toString()}`;return window.history.replaceState(window.history.state,"",n),window.location.reload(),null})),t})(),D=(()=>{const e=(e=>{if(!e)return null;const o=new URL(e).searchParams.get("zonosQaUrlApi");return o?/[^a-zA-Z0-9-_]+/.test(o)?null:o:null})(window.location.href),o=b(window.location.href),n=e||o;if(!n&&["dev.demo.elements.zonos.com","dev.checkout.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(!e)return null;const t=`https://${e}.route.js.zonos.com`;return w(`[ZONOS-WARNING] using '${t}' for serverless API`,"warn"),t})(),R=Date.now();class F{}P=F,F.isNpm=!1,F.isBigCommerce=!1,F.googleAnalyticId=null,F.googleAnalyticReady=!1,F.facebookPixelId=null,F.facebookPixelReady=!1,F.requested=!1,F.zonosMode=null,F.cartData=null,F.startLoadTime=R,F.overrideUseCustomAddressForm=!1,F.domain=window.location!=window.parent.location?document.referrer:document.location.hostname,F.version="v1.3.269",F.isLegacyCheckout=!1,F.isCollect=!1,F.isInvoice=!1,F.legacyStoreLogo=null,F.legacyStoreFavicon=null,F.parallelLoadTimes=[],F.parallelLoadState="off",F.releaseDate="1781282581347",F.loadTimeApiInfoList=[],F.cartSettings=null,F.loadScriptLogHandler=async({cdnLoadTime:e,fallbackLoadTime:o,isError:n,metadata:t,scriptLoadUrl:r,storeId:s,type:i})=>{try{const e=window.performance.getEntriesByType("resource").find((e=>{const o=e;return o.name.includes(r)&&"script"===o.initiatorType}));null==e||e.transferSize;(async e=>{})((e&&(null==e?void 0:e.duration)>0?parseFloat(e.duration.toFixed(2)):parseFloat(o.toFixed(2)),Object.assign({decodedBodySize:null==e?void 0:e.decodedBodySize,encodedBodySize:null==e?void 0:e.encodedBodySize,fallbackLoadTime:o,isError:!!n},t)))}catch(e){}},F.loadScriptLogParallelHandler=async e=>{try{if(P.parallelLoadTimes.push(e),2===P.parallelLoadTimes.length){const e=P.parallelLoadTimes.find((e=>"vercel"===e.type)),o=P.parallelLoadTimes.find((e=>"jsdelivr"===e.type));if(!e||!o)return;if(e.isError&&o.isError)return void f({endpoint:`<${e.scriptLoadUrl}> <${o.scriptLoadUrl}>`,errors:["Failed to fetch both Vercel and jsdelivr CDN. Perhaps network issue on customer site."],metadata:{cdnLoadTime:o.fallbackLoadTime,cdnType:o.type,vercelLoadTime:e.fallbackLoadTime}});P.loadScriptLogHandler({cdnLoadTime:o.fallbackLoadTime,fallbackLoadTime:e.fallbackLoadTime,isError:e.isError,metadata:{cdnScriptFallbackTime:o.fallbackLoadTime,cdnScriptIsError:!!o.isError,cdnScriptLoadUrl:o.scriptLoadUrl,cdnScriptType:o.type},scriptLoadUrl:e.scriptLoadUrl,storeId:e.storeId,type:e.type})}}catch(e){}},F.legacyCheckoutErrorHandler=({message:e,metadata:o})=>{Z(`[ZONOS - loadZonos] ${e}`),f({endpoint:"LegacyCheckoutInit",errors:[e],metadata:Object.assign(Object.assign({},o),{tempCartUUID:P.cartId})}),document.dispatchEvent(new CustomEvent("legacyCheckoutError",{detail:e}))},F.getGithubCdn=({type:e,version:o})=>{let n="https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.269";"cdnjs"===e?n="https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.269":"unpkg"===e&&(n="https://unpkg.com/@zonos/elements@1.3.269");return o&&"alpha"!==o?n.replace(/@zonos\/elements@(.+)/,`@zonos/elements@${o}`).replace(/\/zonos-elements\/(.+)/,`/zonos-elements/${o}`):n},F.injectZonos=({cdnType:e="jsdelivr",initConfig:o,parallelLoaded:n,vercelUrl:t,version:r})=>{var s;o=Object.assign(Object.assign({},o),{zonosApiKey:P.zonosApiKey}),r&&(window.Zonos.version=`v${r}`);const i="vercel"===e?t:P.getGithubCdn({type:e,version:r}),a=N||i,d=a.replace("https://","").replace("http://",""),l=document.createElement("script"),c=r&&r<"1.2.5"?"loadZonos.js":"zonos.js";l.src=`https://${d}/dist/scripts/${c}?timestamp=${Date.now()}`,w(`[ZONOS - loadZonos] Injecting "${c}" from "${d}"`,"info");const u="4g"===(null===(s=g())||void 0===s?void 0:s.effectiveType),p=["dev.elements.zonos.com","zonos.com"].some((e=>window.location.href.includes(e))),m=C[0]===e,y=C[1],h="on"===P.parallelLoadState&&u&&m&&y&&!p;h&&P.injectZonos({cdnType:y,initConfig:o,parallelLoaded:!0,vercelUrl:t,version:r});const v=performance.now();l.addEventListener("load",(async()=>{if(h||n?P.loadScriptLogParallelHandler({fallbackLoadTime:performance.now()-v,scriptLoadUrl:l.src,storeId:P.storeId||0,type:e}):P.loadScriptLogHandler({fallbackLoadTime:performance.now()-v,scriptLoadUrl:l.src,storeId:P.storeId||0,type:e}),P.isBigCommerce||(P.isBigCommerce=!!window.stencilBootstrap||!!window.bcConfig||!!document.querySelector('script[src*="bigcommerce.com"]')),window.Zonos.isNpm=!1,window.Zonos.zonosQaUrl=N,window.Zonos.zonosQaUrlApi=D,window.Zonos.zonosMode=P.zonosMode,window.Zonos.isBigCommerce=P.isBigCommerce,window.Zonos.loadTimeApiInfoList=P.loadTimeApiInfoList,window.Zonos.overrideUseCustomAddressForm=P.overrideUseCustomAddressForm,window.Zonos.startLoadTime=P.startLoadTime,P.cartSettings&&(window.Zonos.cartSettings=P.cartSettings),P.cartId){const e=P.isCollect?"Collect":"hosted Checkout";if(!P.zonosApiKey)throw P.legacyCheckoutErrorHandler({message:`zonosApiKey is missing to initiate ${e}`}),new Error(`zonosApiKey is required for ${e}`);if(!P.cartData)throw P.legacyCheckoutErrorHandler({message:`cartData is missing to initiate ${e}`}),new Error(`cartData is required for ${e}`);if(P.legacyStoreFavicon&&P.isLegacyCheckout&&!P.isCollect)try{if(200!==(await fetch(P.legacyStoreFavicon)).status)throw new Error("Custom favicon is not available");const e=document.createElement("link");e.rel="shortcut icon",e.type="image/x-icon",e.href=P.legacyStoreFavicon,document.head.appendChild(e)}catch(e){}window.Zonos.cartData=P.cartData,window.Zonos.isLegacyCheckout=P.isLegacyCheckout,window.Zonos.cartSettings=P.cartSettings,window.Zonos.isCollect=P.isCollect,window.Zonos.isInvoice=P.isInvoice;const n=Object.assign(Object.assign({},o),{appearance:Object.assign(Object.assign({},o.appearance),{logoUrl:P.isLegacyCheckout&&!P.isCollect&&P.legacyStoreLogo?P.legacyStoreLogo:void 0}),zonosApiKey:P.zonosApiKey});o=n}window.Zonos.version&&(w(`[ZONOS - loadZonos] Execute "Zonos.init" from "${c}" from "${d}"`,"info"),window.Zonos.init(o))})),l.addEventListener("error",(async()=>{const s=(e=>{const o=C.indexOf(e);return C[o+1]||null})(e);if(!h&&!n){if(!s)return;P.injectZonos({cdnType:s,initConfig:o,vercelUrl:t,version:r})}if(["localhost",".zonos.com"].some((e=>window.location.href.includes(e)))||N)return;if(h||n)return void P.loadScriptLogParallelHandler({fallbackLoadTime:performance.now()-v,isError:!0,scriptLoadUrl:l.src,storeId:P.storeId||0,type:e});["unpkg","cdnjs","vercel"].includes(e)?f({endpoint:l.src,errors:[`zonos.js - Failed to fetch ${e} CDN.`],metadata:{cdnLoadTime:performance.now()-v,cdnType:e,loadUrl:a,version:r},shouldPostReleaseErrorReporting:!!s}):f({endpoint:l.src,errors:["[Info] Using alternative CDN. Failed to fetch script"],metadata:{cdnType:e,vercelLoadTime:performance.now()-v}})})),document.head.appendChild(l)},F.handlePerformBlurCurrency=()=>{var e,o,n;!(null===(o=null===(e=P.cartSettings)||void 0===e?void 0:e.genericSettings)||void 0===o?void 0:o.blurCurrencyOnInit)?E():(window.zonosBlurCurrencyOnInitCurrencySelector=window.zonosBlurCurrencyOnInitCurrencySelector||(null===(n=P.cartSettings)||void 0===n?void 0:n.helloSettings.currencyElementSelector),(()=>{if("undefined"==typeof window)return;if(window.zonosBlurCurrencyOnInitIntervalId)return;$({currencySelector:window.zonosBlurCurrencyOnInitCurrencySelector});const e=setInterval((()=>{$({currencySelector:window.zonosBlurCurrencyOnInitCurrencySelector})}),10);window.zonosBlurCurrencyOnInitIntervalId=e,setTimeout((()=>{E()}),7e3)})())},F.init=async n=>{var s,i;if(w("=== Init zonos script release date","info",P.releaseDate),N&&!window.isZonosPreview){w(`[ZONOS - loadZonos] Re-inject "loadZonos.js" from zonosQaUrl: ${N}`,"info");const e=document.createElement("script");return e.src=`${N}/dist/scripts/loadZonos.js?timestamp=${Date.now()}`,document.head.appendChild(e),e.addEventListener("load",(()=>{window.Zonos.isNpm=!1,window.Zonos.isBigCommerce=P.isBigCommerce,window.Zonos.isLegacyCheckout=P.isLegacyCheckout,window.Zonos.startLoadTime=P.startLoadTime,window.Zonos.init(n)})),e.addEventListener("error",(()=>{alert(`[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: ${N}`)})),void(window.isZonosPreview=!0)}const a=new URLSearchParams(window.location.search).get("tempCartUUID"),{isDgsCartId:d,isLegacyCartId:l}=k(a);if(a&&!l&&!d)return void P.legacyCheckoutErrorHandler({message:`[ZONOS - loadZonos] invalid &tempCartUUID=${a}`,metadata:{invalidCartId:!0}});P.cartId=a;const c=document.querySelector('script[src*="/zonos.js"]'),u=null===(s=document.querySelector("script[src*='/loadZonos.js']"))||void 0===s?void 0:s.src;w(`[ZONOS - init] first load script src: ${u}`,"info"),window.Zonos.zonosQaUrl=N,window.Zonos.zonosQaUrlApi=D,window.Zonos.zonosQaUrl&&w(`[ZONOS - init] using zonosQaUrl: ${window.Zonos.zonosQaUrl}`,"info"),window.Zonos.zonosQaUrlApi&&w(`[ZONOS - init] using zonosQaUrlApi: ${window.Zonos.zonosQaUrlApi}`,"info");const p=null==u?void 0:u.includes("timestamp=");if(!(P.isNpm||u&&p))return void Z("[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(c||!u||P.requested)return void w("[ZONOS - loadZonos] script is already loaded or requested","info");if(!n.zonosApiKey&&!P.cartId)return P.legacyCheckoutErrorHandler({message:"Zonos API key is required unless `tempCartUUID` is provided in url query params."}),void Z("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(P.requested=!0,P.zonosApiKey=n.zonosApiKey,P.storeId=n.storeId,P.cartId){const e=await(async e=>{const{isDgsCartId:o,isLegacyCartId:n}=k(e);if(!n&&!o)return Z("[ZONOS - loadZonos] invalid cart id"),null;const t=await U({cartId:e,retries:5});return w("[ZONOS - loadZonos] getting temp cart data","info",t),t?(window.Zonos.storeId=t.cartData.storeId,window.Zonos.zonosApiKey=t.cartData.credentialToken,window.Zonos.zonosMode=t.zonosMode,{cartData:t.cartData,settings:t.settings,storeFavicon:t.storeFaviconUrl,storeId:t.cartData.storeId,storeLogo:t.storeLogoUrl,zonosApiKey:t.cartData.credentialToken}):(Z("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)})(P.cartId);if(!e)throw P.legacyCheckoutErrorHandler({message:"Error getting cart data"}),new Error("Error getting cart data");P.cartData=e.cartData,P.cartSettings=e.settings,P.legacyStoreLogo=e.storeLogo,P.legacyStoreFavicon=e.storeFavicon,P.storeId=e.storeId,P.zonosApiKey=e.zonosApiKey,P.isCollect=e.cartData.type.includes("COLLECT"),P.isInvoice="INVOICE"===e.cartData.type}if(!P.zonosApiKey)return void Z('"zonosApiKey" is required to initialize Zonos');const g=await(async()=>{const e=r(),o=t();if(!e&&!o||!window.Zonos.zonosApiKey)return null;if(w("[ZONOS - loadZonos] Attempt test public credential","info"),window.Zonos.zonosApiKey.includes("credential_test"))return w("[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key","info"),null;const{errors:n,json:s}=await z("/api/get-test-public-credential");if(n.length||!s)return Z("[ZONOS - loadZonos] Failed to get test public credential. Keep using production key",n),null;const i=s.publicCredential;return i?(w(`[ZONOS - loadZonos] Retrieve new test public token ${i}`,"info"),i):(Z("[ZONOS - loadZonos] No test public key credential. Keep using production key"),null)})();if(g&&(w(`[ZONOS - loadZonos] Using test API key: ${g} for test mode`,"info"),P.zonosApiKey=g),!P.cartId){const{json:n,zonosMode:t}=await(async()=>{if(window.Zonos.cartSettings)return w("Reusing cached zonos settings"),{errors:[],json:window.Zonos.cartSettings,zonosMode:window.Zonos.zonosMode};const n=e(),t=new URLSearchParams;n.overrideShouldEnabledCustomAddress&&t.set("overrideShouldEnabledCustomAddress",n.overrideShouldEnabledCustomAddress);const r=o();r&&t.set("zCountry",r);const{errors:s,json:i,zonosMode:a}=await z(`/api/zonos-elements/zonos-settings?${t.toString()}`);return s.length?(Z("Error occurred when getting zonos settings. If this is not an unauthorized error, it will use user settings or default settings"),{errors:s,json:null,zonosMode:a}):{errors:[],json:i,zonosMode:a}})();(null==n?void 0:n.appearanceSettings)&&(null==n?void 0:n.checkoutSettings)&&(null==n?void 0:n.helloSettings)&&(null==n?void 0:n.organization)&&(w("[ZONOS - loadZonos] Prefetching zonos settings","info"),P.cartSettings={appearanceSettings:n.appearanceSettings,checkoutSettings:n.checkoutSettings,credentialTokenId:P.zonosApiKey,genericSettings:n.genericSettings,helloSettings:n.helloSettings,inclusivePriceConfigurations:n.inclusivePriceConfigurations,landedCostSettings:n.landedCostSettings,onlineStoreSettings:n.onlineStoreSettings,organization:n.organization,organizationId:(null===(i=n.organization)||void 0===i?void 0:i.id)||"",shippingZones:n.shippingZones},P.zonosMode=t)}P.handlePerformBlurCurrency();const m=P.storeId||n.storeId||0;w(`[ZONOS - loadZonos] Store ID: ${m}`,"info");const y=new URLSearchParams;y.set("storeId",m.toString()),window.location.search.includes("_enableStoreVersionPinned=1")&&y.set("_enableStoreVersionPinned","1");const{errors:f,json:h}=await z(`/api/get-store-version?${y.toString()}`);if(f.length||!h)return w("[ZONOS - loadZonos] Error getting store version, loading the latest version.","error"),void P.injectZonos({initConfig:n,vercelUrl:"https://v1.3.269.js.zonos.com",version:null});const{isDifferent:v,source:S,version:C}=h;if(w(`[ZONOS - loadZonos] Store version: ${C}, source: ${S}`,"info"),v){w(`[ZONOS - loadZonos] Updating saved store version to ${C}`,"info");const e={storeId:m,version:C};z(`/api/set-store-version?${y.toString()}`,{body:e,method:"POST"}).catch((e=>Z("Unable to save store's vesrion",e)))}if(!c){const{currentLoadScriptUrl:e,isForceLoadVersionDomain:o,isWhiteListed:t}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const o=new URL(e).origin,n=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>o.includes(e))),t=["qa.js.zonos.com"].some((e=>o.includes(e)));return{currentLoadScriptUrl:o,isForceLoadVersionDomain:t,isWhiteListed:n}})({loadScriptSrc:u}),r=t&&!o?e:`${"alpha"===C?"alpha":`v${C}`}.js.zonos.com`,s=t&&!o?null:C;w("[ZONOS - loadZonos] injecting zonos script","info",{currentLoadScriptUrl:e,isForceLoadVersionDomain:o,isWhiteListed:t,loadUrl:r,loadVersion:s,version:C}),P.injectZonos({initConfig:n,vercelUrl:r,version:s})}},(void 0===window.Zonos||window.isZonosPreview&&!window.Zonos.doneInit)&&(window.Zonos=F)})();
1
+ (function(){"use strict";const e=()=>{const e=new URLSearchParams(window.location.search);return{overrideShouldEnabledCustomAddress:window.Zonos.overrideUseCustomAddressForm?"1":e.get("overrideShouldEnabledCustomAddress")}},o=()=>{const e=new URL(window.location.href),o=window.sessionStorage.getItem("zonos--country");return(e=>{const o=new URLSearchParams(e||window.location.search),n=e=>{return(n=o.get(e))&&/^[A-Z]{2}$/.test(n)?n:null;var n},t=n("zCountry"),r=n("country"),s=n("customerCountry");return t||r||s})(e.searchParams)||o};function n(e,o){var n={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&o.indexOf(t)<0&&(n[t]=e[t]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(t=Object.getOwnPropertySymbols(e);r<t.length;r++)o.indexOf(t[r])<0&&Object.prototype.propertyIsEnumerable.call(e,t[r])&&(n[t[r]]=e[t[r]])}return n}"function"==typeof SuppressedError&&SuppressedError;const t=()=>window.location.search.includes("zonosStagingMode=1"),r=()=>{var e;return(null===(e=window.Zonos.zonosApiKey)||void 0===e?void 0:e.includes("test"))||window.location.search.includes("zonosTestMode=1")},s=["cloudflare","vercel"],i=s[0],a={cloudflare:"https://route.elements.zonos.com",vercel:"https://route.js.zonos.com"},d=a[i],l=(e=i)=>{const o=s.indexOf(e),n=s[o+1];return n||null},c=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},u=performance.now(),p=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"}},w=(e,o,...n)=>{var t,r;const{elapsedTimePretty:s}=(()=>{const e=performance.now()-u,o=e>1e3?`${(e/1e3).toFixed(2)}s`:`${e.toFixed(2)}ms`;return{elapsedTime:e,elapsedTimePretty:o}})(),i=[`(${s})`,...n];i.map(p).join(" ");if(!(!!(null===(t=window.Zonos)||void 0===t?void 0:t.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return;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(o){case"warn":d.warn(e,...i);break;case"info":d.info(e,...i);break;case"error":d.error(e,...i);break;default:d.groupCollapsed(e,...i),d.trace(),d.groupEnd()}},g=()=>{const e="connection"in window.navigator?window.navigator.connection:null,o="mozConnection"in window.navigator?window.navigator.mozConnection:null,n="webkitConnection"in window.navigator?window.navigator.webkitConnection:null;return e||o||n},m=["/api/zonos-elements/log-script-load","/api/zonos-elements/log-bulk-load-data"],y=({apiPath:e,apiType:o,loadTimeInternal:n,loadTimeTotal:t})=>{if(m.includes(e))return;const r=t-n;if(r<0)return;const s=e.split("?")[0]||e,i=(()=>{const e="userAgentData"in window.navigator?window.navigator.userAgentData:null,o=g();return{connectionDownlink:null==o?void 0:o.downlink,connectionEffectiveType:null==o?void 0:o.effectiveType,connectionRtt:null==o?void 0:o.rtt,connectionSaveData:null==o?void 0:o.saveData,isHostedCheckout:window.Zonos.isLegacyCheckout,screenHeight:window.screen.height,screenWidth:window.innerWidth,userAgent:e&&e.brands.length>0?e:window.navigator.userAgent}})(),a="object"==typeof i.userAgent&&i.userAgent.mobile,d={apiType:o,connectionType:i.connectionEffectiveType,href:s,isHostedCheckout:window.Zonos.isLegacyCheckout,isMobile:(l=a,l||window.innerWidth<890),loadTimeBrowserApi:r,loadTimeInternal:n,loadTimeTotal:t,metadata:Object.assign({},i),screenHeight:i.screenHeight,screenWidth:i.screenWidth,userAgent:"string"==typeof i.userAgent?i.userAgent:i.userAgent.brands.map((e=>e.brand)).filter((e=>!/Not.*A.*Brand.*/.test(e))).join(",")};var l;window.Zonos.loadTimeApiInfoList.push(d)},f=async({endpoint:e,errors:o,metadata:n,shouldPostReleaseErrorReporting:t})=>{if(w("sendErrorLog","warn",e,n,o),t){const e=Number(window.Zonos.releaseDate);if((new Date).getTime()-e>36e5)return}const r="userAgentData"in window.navigator?window.navigator.userAgentData:null,s={endpoint:e,errors:o,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(`${d}/api/zonos-elements/log-error`,{body:JSON.stringify(s),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const o=l();if(!o)return;fetch(`${a[o]}/api/zonos-elements/log-error`,{body:JSON.stringify(s),method:"POST"})}},h=async({response:e,shouldLog:o=!0,shouldThrow:n=!1})=>{try{const o=await e.text(),n=c(o);if(!n)throw new Error(`Failed to parse content: ${o}`);return n}catch(e){if(n)throw e;return o&&console.error(e),null}},v=async({basePathType:e,options:o,path:n})=>{let t;const r=window.Zonos.zonosQaUrlApi||a[e]||i,s=new URL(r+n),d=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("")}})(d));try{t=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 l=t.headers.get("Zonos-Mode"),c=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&l&&c&&(window.Zonos.modeAlerted=!0),t.ok){return{baseUrl:r,errors:[],json:await h({response:t}),response:t,zonosMode:l}}const u=t.status.toString();try{const e=await h({response:t,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:u}:e)),json:null,response:t,zonosMode:l}}return{baseUrl:r,errors:[{message:JSON.stringify(e),type:u}],json:null,response:t,zonosMode:l}}catch(e){return{baseUrl:r,errors:[{message:`${u}: ${"Unknown error"}`,type:u}],json:null,response:null,zonosMode:l}}},S=async({basePathType:e,options:o,path:t})=>{var r,s;const i=t.startsWith("/api/bigcommerce")?"vercel":e,d=performance.now(),u=await v({basePathType:i,options:o,path:t}),{errors:p,response:g}=u,m=n(u,["errors","response"]),h=performance.now()-d;w(`${t} (${h.toFixed(2)}ms)`,"info");const z=null==g?void 0:g.headers.get("Zonos-Duration");200===(null==g?void 0:g.status)&&y({apiPath:t,apiType:i,loadTimeInternal:z?Number(z):0,loadTimeTotal:h});const Z=l(i),C=p.find((({type:e})=>"unknown"===e)),b=p.find((({message:e})=>"string"==typeof e&&(e.includes("signal is aborted")||e.includes("The operation was aborted")||e.includes("Fetch is aborted")))),I=!!C||404===(null==g?void 0:g.status)||500===(null==g?void 0:g.status),L=Z&&I;return I&&!b&&f({endpoint:a[i]+t,errors:p.map((({message:e})=>`API: ${e}`)),metadata:{currentBasePath:i,nextFallbackApiType:Z,requestHeaders:null==o?void 0:o.headers,requestPayload:c(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()),shouldCallFallback:L,status:null==g?void 0:g.status,statusText:null==g?void 0:g.statusText},shouldPostReleaseErrorReporting:!0}),L?(w(`=== "${t}" failed to fetch, trying next fallback ${Z}`),S({basePathType:Z,options:o,path:t})):Object.assign({errors:p,response:g},m)},z=async(e,o)=>{const s=n(o||{},[]),a=s.body?JSON.stringify(s.body):void 0,d=s.method||"GET",l=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Staging-Mode":t()?"1":void 0,"Zonos-Test-Mode":r()?"1":void 0,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},s.headers);Object.keys(l).forEach((e=>void 0===l[e]&&delete l[e]));const c=Object.assign(Object.assign({},s),{body:"GET"===d?void 0:a,headers:l,method:d}),u=new URLSearchParams(window.location.search).get("useFallbackApi");return S({basePathType:u||i,options:c,path:e})},Z=(e,...o)=>{w(e,"error",...o)},C=["jsdelivr","cdnjs","unpkg","vercel"],b=e=>{if(!e)return null;const o=new URL(e).searchParams.get("zonosQaUrl");if(!o)return null;return/[^a-zA-Z0-9-_]+/.test(o)?null:o},I=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/,L=new RegExp(`^${I.source}$`),O=new RegExp(`^cart_${I.source}$`),A=/^[a-zA-Z0-9]{2,}$/,T=/^cart_[a-zA-Z0-9]{2,}$/,k=e=>e?e.includes("undefined")?{isDgsCartId:!1,isLegacyCartId:!1}:T.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:A.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:O.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:L.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:{isDgsCartId:!1,isLegacyCartId:!1}:{isDgsCartId:!1,isLegacyCartId:!1},U=async({cartId:o,retries:n})=>{const t=r(),s=e(),i=(()=>{const e=new URLSearchParams(window.location.search).get("validityToken");if(!e||!/^[A-Za-z0-9+/]+={0,2}$/.test(e)||e.length%4!=0)return null;try{return atob(e),e}catch(e){return null}})()||void 0,a=new URLSearchParams;s.overrideShouldEnabledCustomAddress&&a.set("overrideShouldEnabledCustomAddress",s.overrideShouldEnabledCustomAddress);const{errors:d,json:l,zonosMode:c}=await z(`/api/zonos-elements/get-cart?${a.toString()}`,{body:{isTestMode:t,renewCartExpirationToken:i,tempCartUUID:o},headers:{"Content-Type":"application/json"},method:"POST"}),u=!l||d.length;return u&&n?(w("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:n}),await new Promise((e=>setTimeout(e,500))),U({cartId:o,retries:n-1})):u?null:Object.assign(Object.assign({},l),{zonosMode:c})},j="z--blur",E=async()=>{const e=window.zonosBlurCurrencyOnInitIntervalId;if(!e)return;await new Promise((e=>setTimeout(e,500))),clearInterval(e);document.querySelectorAll(`.${j}`).forEach((e=>{e.classList.remove(j)})),window.zonosBlurCurrencyOnInitIntervalId=void 0},$=({currencySelector:e,specificSelector:o})=>{if(e||o)if(o)o.classList.add(j);else{document.querySelectorAll([e].filter(Boolean).join(",")).forEach((e=>{e.classList.add(j)}))}};var P;const N=(()=>{const e=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||e)return null;const o=b(window.location.href),n="https://v1.3.272.js.zonos.com";if(!o&&(n.includes("test.")||n.includes("test-")))return n;if(!o&&["dev.demo.elements.zonos.com","dev.checkout.elements.zonos.com","dev.storybook.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 t=`https://${o}.preview.js.zonos.com`;return w(`[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 e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:o}=window.location,n=`${o}?${e.toString()}`;return window.history.replaceState(window.history.state,"",n),window.location.reload(),null})),t})(),D=(()=>{const e=(e=>{if(!e)return null;const o=new URL(e).searchParams.get("zonosQaUrlApi");return o?/[^a-zA-Z0-9-_]+/.test(o)?null:o:null})(window.location.href),o=b(window.location.href),n=e||o;if(!n&&["dev.demo.elements.zonos.com","dev.checkout.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(!e)return null;const t=`https://${e}.route.js.zonos.com`;return w(`[ZONOS-WARNING] using '${t}' for serverless API`,"warn"),t})(),R=Date.now();class F{}P=F,F.isNpm=!1,F.isBigCommerce=!1,F.googleAnalyticId=null,F.googleAnalyticReady=!1,F.facebookPixelId=null,F.facebookPixelReady=!1,F.requested=!1,F.zonosMode=null,F.cartData=null,F.startLoadTime=R,F.overrideUseCustomAddressForm=!1,F.domain=window.location!=window.parent.location?document.referrer:document.location.hostname,F.version="v1.3.272",F.isLegacyCheckout=!1,F.isCollect=!1,F.isInvoice=!1,F.legacyStoreLogo=null,F.legacyStoreFavicon=null,F.parallelLoadTimes=[],F.parallelLoadState="off",F.releaseDate="1782316453940",F.loadTimeApiInfoList=[],F.cartSettings=null,F.loadScriptLogHandler=async({cdnLoadTime:e,fallbackLoadTime:o,isError:n,metadata:t,scriptLoadUrl:r,storeId:s,type:i})=>{try{const e=window.performance.getEntriesByType("resource").find((e=>{const o=e;return o.name.includes(r)&&"script"===o.initiatorType}));null==e||e.transferSize;(async e=>{})((e&&(null==e?void 0:e.duration)>0?parseFloat(e.duration.toFixed(2)):parseFloat(o.toFixed(2)),Object.assign({decodedBodySize:null==e?void 0:e.decodedBodySize,encodedBodySize:null==e?void 0:e.encodedBodySize,fallbackLoadTime:o,isError:!!n},t)))}catch(e){}},F.loadScriptLogParallelHandler=async e=>{try{if(P.parallelLoadTimes.push(e),2===P.parallelLoadTimes.length){const e=P.parallelLoadTimes.find((e=>"vercel"===e.type)),o=P.parallelLoadTimes.find((e=>"jsdelivr"===e.type));if(!e||!o)return;if(e.isError&&o.isError)return void f({endpoint:`<${e.scriptLoadUrl}> <${o.scriptLoadUrl}>`,errors:["Failed to fetch both Vercel and jsdelivr CDN. Perhaps network issue on customer site."],metadata:{cdnLoadTime:o.fallbackLoadTime,cdnType:o.type,vercelLoadTime:e.fallbackLoadTime}});P.loadScriptLogHandler({cdnLoadTime:o.fallbackLoadTime,fallbackLoadTime:e.fallbackLoadTime,isError:e.isError,metadata:{cdnScriptFallbackTime:o.fallbackLoadTime,cdnScriptIsError:!!o.isError,cdnScriptLoadUrl:o.scriptLoadUrl,cdnScriptType:o.type},scriptLoadUrl:e.scriptLoadUrl,storeId:e.storeId,type:e.type})}}catch(e){}},F.legacyCheckoutErrorHandler=({message:e,metadata:o})=>{Z(`[ZONOS - loadZonos] ${e}`),f({endpoint:"LegacyCheckoutInit",errors:[e],metadata:Object.assign(Object.assign({},o),{tempCartUUID:P.cartId})}),document.dispatchEvent(new CustomEvent("legacyCheckoutError",{detail:e}))},F.getGithubCdn=({type:e,version:o})=>{let n="https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.272";"cdnjs"===e?n="https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.272":"unpkg"===e&&(n="https://unpkg.com/@zonos/elements@1.3.272");return o&&"alpha"!==o?n.replace(/@zonos\/elements@(.+)/,`@zonos/elements@${o}`).replace(/\/zonos-elements\/(.+)/,`/zonos-elements/${o}`):n},F.injectZonos=({cdnType:e="jsdelivr",initConfig:o,parallelLoaded:n,vercelUrl:t,version:r})=>{var s;o=Object.assign(Object.assign({},o),{zonosApiKey:P.zonosApiKey}),r&&(window.Zonos.version=`v${r}`);const i="vercel"===e?t:P.getGithubCdn({type:e,version:r}),a=N||i,d=a.replace("https://","").replace("http://",""),l=document.createElement("script"),c=r&&r<"1.2.5"?"loadZonos.js":"zonos.js";l.src=`https://${d}/dist/scripts/${c}?timestamp=${Date.now()}`,w(`[ZONOS - loadZonos] Injecting "${c}" from "${d}"`,"info");const u="4g"===(null===(s=g())||void 0===s?void 0:s.effectiveType),p=["dev.elements.zonos.com","zonos.com"].some((e=>window.location.href.includes(e))),m=C[0]===e,y=C[1],h="on"===P.parallelLoadState&&u&&m&&y&&!p;h&&P.injectZonos({cdnType:y,initConfig:o,parallelLoaded:!0,vercelUrl:t,version:r});const v=performance.now();l.addEventListener("load",(async()=>{if(h||n?P.loadScriptLogParallelHandler({fallbackLoadTime:performance.now()-v,scriptLoadUrl:l.src,storeId:P.storeId||0,type:e}):P.loadScriptLogHandler({fallbackLoadTime:performance.now()-v,scriptLoadUrl:l.src,storeId:P.storeId||0,type:e}),P.isBigCommerce||(P.isBigCommerce=!!window.stencilBootstrap||!!window.bcConfig||!!document.querySelector('script[src*="bigcommerce.com"]')),window.Zonos.isNpm=!1,window.Zonos.zonosQaUrl=N,window.Zonos.zonosQaUrlApi=D,window.Zonos.zonosMode=P.zonosMode,window.Zonos.isBigCommerce=P.isBigCommerce,window.Zonos.loadTimeApiInfoList=P.loadTimeApiInfoList,window.Zonos.overrideUseCustomAddressForm=P.overrideUseCustomAddressForm,window.Zonos.startLoadTime=P.startLoadTime,P.cartSettings&&(window.Zonos.cartSettings=P.cartSettings),P.cartId){const e=P.isCollect?"Collect":"hosted Checkout";if(!P.zonosApiKey)throw P.legacyCheckoutErrorHandler({message:`zonosApiKey is missing to initiate ${e}`}),new Error(`zonosApiKey is required for ${e}`);if(!P.cartData)throw P.legacyCheckoutErrorHandler({message:`cartData is missing to initiate ${e}`}),new Error(`cartData is required for ${e}`);if(P.legacyStoreFavicon&&P.isLegacyCheckout&&!P.isCollect)try{if(200!==(await fetch(P.legacyStoreFavicon)).status)throw new Error("Custom favicon is not available");const e=document.createElement("link");e.rel="shortcut icon",e.type="image/x-icon",e.href=P.legacyStoreFavicon,document.head.appendChild(e)}catch(e){}window.Zonos.cartData=P.cartData,window.Zonos.isLegacyCheckout=P.isLegacyCheckout,window.Zonos.cartSettings=P.cartSettings,window.Zonos.isCollect=P.isCollect,window.Zonos.isInvoice=P.isInvoice;const n=Object.assign(Object.assign({},o),{appearance:Object.assign(Object.assign({},o.appearance),{logoUrl:P.isLegacyCheckout&&!P.isCollect&&P.legacyStoreLogo?P.legacyStoreLogo:void 0}),zonosApiKey:P.zonosApiKey});o=n}window.Zonos.version&&(w(`[ZONOS - loadZonos] Execute "Zonos.init" from "${c}" from "${d}"`,"info"),window.Zonos.init(o))})),l.addEventListener("error",(async()=>{const s=(e=>{const o=C.indexOf(e);return C[o+1]||null})(e);if(!h&&!n){if(!s)return;P.injectZonos({cdnType:s,initConfig:o,vercelUrl:t,version:r})}if(["localhost",".zonos.com"].some((e=>window.location.href.includes(e)))||N)return;if(h||n)return void P.loadScriptLogParallelHandler({fallbackLoadTime:performance.now()-v,isError:!0,scriptLoadUrl:l.src,storeId:P.storeId||0,type:e});["unpkg","cdnjs","vercel"].includes(e)?f({endpoint:l.src,errors:[`zonos.js - Failed to fetch ${e} CDN.`],metadata:{cdnLoadTime:performance.now()-v,cdnType:e,loadUrl:a,version:r},shouldPostReleaseErrorReporting:!!s}):f({endpoint:l.src,errors:["[Info] Using alternative CDN. Failed to fetch script"],metadata:{cdnType:e,vercelLoadTime:performance.now()-v}})})),document.head.appendChild(l)},F.handlePerformBlurCurrency=()=>{var e,o,n;!(null===(o=null===(e=P.cartSettings)||void 0===e?void 0:e.genericSettings)||void 0===o?void 0:o.blurCurrencyOnInit)?E():(window.zonosBlurCurrencyOnInitCurrencySelector=window.zonosBlurCurrencyOnInitCurrencySelector||(null===(n=P.cartSettings)||void 0===n?void 0:n.helloSettings.currencyElementSelector),(()=>{if("undefined"==typeof window)return;if(window.zonosBlurCurrencyOnInitIntervalId)return;$({currencySelector:window.zonosBlurCurrencyOnInitCurrencySelector});const e=setInterval((()=>{$({currencySelector:window.zonosBlurCurrencyOnInitCurrencySelector})}),10);window.zonosBlurCurrencyOnInitIntervalId=e,setTimeout((()=>{E()}),7e3)})())},F.init=async n=>{var s,i;if(w("=== Init zonos script release date","info",P.releaseDate),N&&!window.isZonosPreview){w(`[ZONOS - loadZonos] Re-inject "loadZonos.js" from zonosQaUrl: ${N}`,"info");const e=document.createElement("script");return e.src=`${N}/dist/scripts/loadZonos.js?timestamp=${Date.now()}`,document.head.appendChild(e),e.addEventListener("load",(()=>{window.Zonos.isNpm=!1,window.Zonos.isBigCommerce=P.isBigCommerce,window.Zonos.isLegacyCheckout=P.isLegacyCheckout,window.Zonos.startLoadTime=P.startLoadTime,window.Zonos.init(n)})),e.addEventListener("error",(()=>{alert(`[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: ${N}`)})),void(window.isZonosPreview=!0)}const a=new URLSearchParams(window.location.search).get("tempCartUUID"),{isDgsCartId:d,isLegacyCartId:l}=k(a);if(a&&!l&&!d)return void P.legacyCheckoutErrorHandler({message:`[ZONOS - loadZonos] invalid &tempCartUUID=${a}`,metadata:{invalidCartId:!0}});P.cartId=a;const c=document.querySelector('script[src*="/zonos.js"]'),u=null===(s=document.querySelector("script[src*='/loadZonos.js']"))||void 0===s?void 0:s.src;w(`[ZONOS - init] first load script src: ${u}`,"info"),window.Zonos.zonosQaUrl=N,window.Zonos.zonosQaUrlApi=D,window.Zonos.zonosQaUrl&&w(`[ZONOS - init] using zonosQaUrl: ${window.Zonos.zonosQaUrl}`,"info"),window.Zonos.zonosQaUrlApi&&w(`[ZONOS - init] using zonosQaUrlApi: ${window.Zonos.zonosQaUrlApi}`,"info");const p=null==u?void 0:u.includes("timestamp=");if(!(P.isNpm||u&&p))return void Z("[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(c||!u||P.requested)return void w("[ZONOS - loadZonos] script is already loaded or requested","info");if(!n.zonosApiKey&&!P.cartId)return P.legacyCheckoutErrorHandler({message:"Zonos API key is required unless `tempCartUUID` is provided in url query params."}),void Z("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(P.requested=!0,P.zonosApiKey=n.zonosApiKey,P.storeId=n.storeId,P.cartId){const e=await(async e=>{const{isDgsCartId:o,isLegacyCartId:n}=k(e);if(!n&&!o)return Z("[ZONOS - loadZonos] invalid cart id"),null;const t=await U({cartId:e,retries:5});return w("[ZONOS - loadZonos] getting temp cart data","info",t),t?(window.Zonos.storeId=t.cartData.storeId,window.Zonos.zonosApiKey=t.cartData.credentialToken,window.Zonos.zonosMode=t.zonosMode,{cartData:t.cartData,settings:t.settings,storeFavicon:t.storeFaviconUrl,storeId:t.cartData.storeId,storeLogo:t.storeLogoUrl,zonosApiKey:t.cartData.credentialToken}):(Z("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)})(P.cartId);if(!e)throw P.legacyCheckoutErrorHandler({message:"Error getting cart data"}),new Error("Error getting cart data");P.cartData=e.cartData,P.cartSettings=e.settings,P.legacyStoreLogo=e.storeLogo,P.legacyStoreFavicon=e.storeFavicon,P.storeId=e.storeId,P.zonosApiKey=e.zonosApiKey,P.isCollect=e.cartData.type.includes("COLLECT"),P.isInvoice="INVOICE"===e.cartData.type}if(!P.zonosApiKey)return void Z('"zonosApiKey" is required to initialize Zonos');const g=await(async()=>{const e=r(),o=t();if(!e&&!o||!window.Zonos.zonosApiKey)return null;if(w("[ZONOS - loadZonos] Attempt test public credential","info"),window.Zonos.zonosApiKey.includes("credential_test"))return w("[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key","info"),null;const{errors:n,json:s}=await z("/api/get-test-public-credential");if(n.length||!s)return Z("[ZONOS - loadZonos] Failed to get test public credential. Keep using production key",n),null;const i=s.publicCredential;return i?(w(`[ZONOS - loadZonos] Retrieve new test public token ${i}`,"info"),i):(Z("[ZONOS - loadZonos] No test public key credential. Keep using production key"),null)})();if(g&&(w(`[ZONOS - loadZonos] Using test API key: ${g} for test mode`,"info"),P.zonosApiKey=g),!P.cartId){const{json:n,zonosMode:t}=await(async()=>{if(window.Zonos.cartSettings)return w("Reusing cached zonos settings"),{errors:[],json:window.Zonos.cartSettings,zonosMode:window.Zonos.zonosMode};const n=e(),t=new URLSearchParams;n.overrideShouldEnabledCustomAddress&&t.set("overrideShouldEnabledCustomAddress",n.overrideShouldEnabledCustomAddress);const r=o();r&&t.set("zCountry",r);const{errors:s,json:i,zonosMode:a}=await z(`/api/zonos-elements/zonos-settings?${t.toString()}`);return s.length?(Z("Error occurred when getting zonos settings. If this is not an unauthorized error, it will use user settings or default settings"),{errors:s,json:null,zonosMode:a}):{errors:[],json:i,zonosMode:a}})();(null==n?void 0:n.appearanceSettings)&&(null==n?void 0:n.checkoutSettings)&&(null==n?void 0:n.helloSettings)&&(null==n?void 0:n.organization)&&(w("[ZONOS - loadZonos] Prefetching zonos settings","info"),P.cartSettings={appearanceSettings:n.appearanceSettings,checkoutSettings:n.checkoutSettings,credentialTokenId:P.zonosApiKey,genericSettings:n.genericSettings,helloSettings:n.helloSettings,inclusivePriceConfigurations:n.inclusivePriceConfigurations,landedCostSettings:n.landedCostSettings,onlineStoreSettings:n.onlineStoreSettings,organization:n.organization,organizationId:(null===(i=n.organization)||void 0===i?void 0:i.id)||"",shippingZones:n.shippingZones},P.zonosMode=t)}P.handlePerformBlurCurrency();const m=P.storeId||n.storeId||0;w(`[ZONOS - loadZonos] Store ID: ${m}`,"info");const y=new URLSearchParams;y.set("storeId",m.toString()),window.location.search.includes("_enableStoreVersionPinned=1")&&y.set("_enableStoreVersionPinned","1");const{errors:f,json:h}=await z(`/api/get-store-version?${y.toString()}`);if(f.length||!h)return w("[ZONOS - loadZonos] Error getting store version, loading the latest version.","error"),void P.injectZonos({initConfig:n,vercelUrl:"https://v1.3.272.js.zonos.com",version:null});const{isDifferent:v,source:S,version:C}=h;if(w(`[ZONOS - loadZonos] Store version: ${C}, source: ${S}`,"info"),v){w(`[ZONOS - loadZonos] Updating saved store version to ${C}`,"info");const e={storeId:m,version:C};z(`/api/set-store-version?${y.toString()}`,{body:e,method:"POST"}).catch((e=>Z("Unable to save store's vesrion",e)))}if(!c){const{currentLoadScriptUrl:e,isForceLoadVersionDomain:o,isWhiteListed:t}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const o=new URL(e).origin,n=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>o.includes(e))),t=["qa.js.zonos.com"].some((e=>o.includes(e)));return{currentLoadScriptUrl:o,isForceLoadVersionDomain:t,isWhiteListed:n}})({loadScriptSrc:u}),r=t&&!o?e:`${"alpha"===C?"alpha":`v${C}`}.js.zonos.com`,s=t&&!o?null:C;w("[ZONOS - loadZonos] injecting zonos script","info",{currentLoadScriptUrl:e,isForceLoadVersionDomain:o,isWhiteListed:t,loadUrl:r,loadVersion:s,version:C}),P.injectZonos({initConfig:n,vercelUrl:r,version:s})}},(void 0===window.Zonos||window.isZonosPreview&&!window.Zonos.doneInit)&&(window.Zonos=F)})();
@@ -1 +1 @@
1
- (function(){"use strict";const e=({id:e,payload:o,target:t,type:n})=>{var r;t instanceof HTMLIFrameElement?null===(r=t.contentWindow)||void 0===r||r.postMessage({id:e,payload:o,type:n},"*"):t.postMessage({id:e,payload:o,type:n},"*")};class o{constructor(o,t){this.targetElement=o,this.targetId=t,this.sendMessage=(o,t)=>{e({id:this.targetId,payload:t,target:this.targetElement,type:o})}}}o.iframeServices={GOOGLE_PLACES:"zonos--private-iframe-google-places-service-m9bmuh7g"},o.sendMessage=e,o.injectPrivateIframe=({id:e,onload:o,src:t})=>{const n=document.createElement("iframe");return n.src=t,n.id=e,n.style.display="none",n.role="presentation",n.ariaHidden="true",n.tabIndex=-1,n.style.border="none !important",n.style.margin="0px !important",n.style.padding="0px !important",n.style.width="1px !important",n.style.minWidth="100% !important",n.style.overflow="hidden !important",n.style.display="block !important",n.style.visibility="hidden !important",n.style.position="fixed !important",n.style.pointerEvents="none !important",n.style.userSelect="none !important",n.style.height="1px !important",n.onload=()=>o(n),document.body.appendChild(n),n};const t=performance.now(),n=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"}},r=(e,o,...r)=>{var s,i;const{elapsedTimePretty:a}=(()=>{const e=performance.now()-t,o=e>1e3?`${(e/1e3).toFixed(2)}s`:`${e.toFixed(2)}ms`;return{elapsedTime:e,elapsedTimePretty:o}})(),l=[`(${a})`,...r];l.map(n).join(" ");if(!(!!(null===(s=window.Zonos)||void 0===s?void 0:s.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return;let d=document.querySelector("iframe#zonos---debug-logging-iframe");d||(d=document.createElement("iframe"),d.id="zonos---debug-logging-iframe",d.style.display="none",d.style.opacity="0",d.style.position="absolute",d.style.top="-9999px",d.style.left="-9999px",d.style.width="1px",d.style.height="1px",d.style.border="none",d.style.overflow="hidden",d.style.visibility="hidden",document.body.appendChild(d));const c=(null===(i=d.contentWindow)||void 0===i?void 0:i.window.console)||window.console;switch(o){case"warn":c.warn(e,...l);break;case"info":c.info(e,...l);break;case"error":c.error(e,...l);break;default:c.groupCollapsed(e,...l),c.trace(),c.groupEnd()}},s=(e,...o)=>{r(e,"error",...o)},i=["jsdelivr","cdnjs","unpkg","vercel"],a="jsdelivr",l=e=>{const o=i.indexOf(e);return i[o+1]||null},d=()=>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 u(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 p=["cloudflare","vercel"],m=p[0],w={cloudflare:"https://route.elements.zonos.com",vercel:"https://route.js.zonos.com"},h=w[m],y=(e=m)=>{const o=p.indexOf(e),t=p[o+1];return t||null},g=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},f=()=>{const e="userAgentData"in window.navigator?window.navigator.userAgentData:null,o=(()=>{const e="connection"in window.navigator?window.navigator.connection:null,o="mozConnection"in window.navigator?window.navigator.mozConnection:null,t="webkitConnection"in window.navigator?window.navigator.webkitConnection:null;return e||o||t})();return{connectionDownlink:null==o?void 0:o.downlink,connectionEffectiveType:null==o?void 0:o.effectiveType,connectionRtt:null==o?void 0:o.rtt,connectionSaveData:null==o?void 0:o.saveData,isHostedCheckout:window.Zonos.isLegacyCheckout,screenHeight:window.screen.height,screenWidth:window.innerWidth,userAgent:e&&e.brands.length>0?e:window.navigator.userAgent}},v=["/api/zonos-elements/log-script-load","/api/zonos-elements/log-bulk-load-data"],b=async({response:e,shouldLog:o=!0,shouldThrow:t=!1})=>{try{const o=await e.text(),t=g(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}},S=async({basePathType:e,options:o,path:t})=>{let n;const r=window.Zonos.zonosQaUrlApi||w[e]||m,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"),l=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&a&&l&&(window.Zonos.modeAlerted=!0),n.ok){return{baseUrl:r,errors:[],json:await b({response:n}),response:n,zonosMode:a}}const d=n.status.toString();try{const e=await b({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:d}:e)),json:null,response:n,zonosMode:a}}return{baseUrl:r,errors:[{message:JSON.stringify(e),type:d}],json:null,response:n,zonosMode:a}}catch(e){return{baseUrl:r,errors:[{message:`${d}: ${"Unknown error"}`,type:d}],json:null,response:null,zonosMode:a}}},C=async({basePathType:e,options:o,path:t})=>{var n,s;const i=t.startsWith("/api/bigcommerce")?"vercel":e,a=performance.now(),l=await S({basePathType:i,options:o,path:t}),{errors:d,response:c}=l,p=u(l,["errors","response"]),m=performance.now()-a;r(`${t} (${m.toFixed(2)}ms)`,"info");const b=null==c?void 0:c.headers.get("Zonos-Duration");200===(null==c?void 0:c.status)&&(({apiPath:e,apiType:o,loadTimeInternal:t,loadTimeTotal:n})=>{if(v.includes(e))return;const r=n-t;if(r<0)return;const s=e.split("?")[0]||e,i=f(),a="object"==typeof i.userAgent&&i.userAgent.mobile,l={apiType:o,connectionType:i.connectionEffectiveType,href:s,isHostedCheckout:window.Zonos.isLegacyCheckout,isMobile:(d=a,d||window.innerWidth<890),loadTimeBrowserApi:r,loadTimeInternal:t,loadTimeTotal:n,metadata:Object.assign({},i),screenHeight:i.screenHeight,screenWidth:i.screenWidth,userAgent:"string"==typeof i.userAgent?i.userAgent:i.userAgent.brands.map((e=>e.brand)).filter((e=>!/Not.*A.*Brand.*/.test(e))).join(",")};var d;window.Zonos.loadTimeApiInfoList.push(l)})({apiPath:t,apiType:i,loadTimeInternal:b?Number(b):0,loadTimeTotal:m});const z=y(i),k=d.find((({type:e})=>"unknown"===e)),Z=d.find((({message:e})=>"string"==typeof e&&(e.includes("signal is aborted")||e.includes("The operation was aborted")||e.includes("Fetch is aborted")))),j=!!k||404===(null==c?void 0:c.status)||500===(null==c?void 0:c.status),I=z&&j;return j&&!Z&&(async({endpoint:e,errors:o,metadata:t,shouldPostReleaseErrorReporting:n})=>{r("sendErrorLog","warn",e,t,o);{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},t)};try{fetch(`${h}/api/zonos-elements/log-error`,{body:JSON.stringify(i),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const o=y();if(!o)return;fetch(`${w[o]}/api/zonos-elements/log-error`,{body:JSON.stringify(i),method:"POST"})}})({endpoint:w[i]+t,errors:d.map((({message:e})=>`API: ${e}`)),metadata:{currentBasePath:i,nextFallbackApiType:z,requestHeaders:null==o?void 0:o.headers,requestPayload:g(null===(n=null==o?void 0:o.body)||void 0===n?void 0:n.toString())||(null===(s=null==o?void 0:o.body)||void 0===s?void 0:s.toString()),shouldCallFallback:I,status:null==c?void 0:c.status,statusText:null==c?void 0:c.statusText},shouldPostReleaseErrorReporting:!0}),I?(r(`=== "${t}" failed to fetch, trying next fallback ${z}`),C({basePathType:z,options:o,path:t})):Object.assign({errors:d,response:c},p)},z=async(e,o)=>{const t=u(o||{},[]),n=t.body?JSON.stringify(t.body):void 0,r=t.method||"GET",s=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Staging-Mode":d()?"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"},t.headers);Object.keys(s).forEach((e=>void 0===s[e]&&delete s[e]));const i=Object.assign(Object.assign({},t),{body:"GET"===r?void 0:n,headers:s,method:r}),a=new URLSearchParams(window.location.search).get("useFallbackApi");return C({basePathType:a||m,options:i,path:e})},k=()=>{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),t="https://v1.3.269.js.zonos.com";if(!o&&(t.includes("test.")||t.includes("test-")))return t;if(!o&&["dev.demo.elements.zonos.com","dev.checkout.elements.zonos.com","dev.storybook.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 n=`https://${o}.preview.js.zonos.com`;return r(`[ZONOS-WARNING] using '${n}' for loading elements script`,"warn"),fetch(n).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${n}' 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})),n},Z="https://js.stripe.com/v3",j=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;let I=null;const O=e=>(null!==I||(I=new Promise(((o,t)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe)o(window.Stripe);else try{let n=(()=>{const e=document.querySelectorAll(`script[src^="${Z}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&j.test(t.src))return t}return null})();n&&e?console.warn("loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used"):n||(n=(e=>{const o=document.createElement("script");o.src=`${Z}`;const t=document.head||document.body;return t?(t.appendChild(o),o):(s("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==n||n.addEventListener("load",(()=>{window.Stripe?o(window.Stripe):t(new Error("Stripe.js not available"))})),null==n||n.addEventListener("error",(()=>{t(new Error("Failed to load Stripe.js"))}))}catch(e){return void t(e)}else o(null)}))),I),A=Promise.resolve().then((()=>O(null)));let E=!1;A.catch((e=>{E||console.warn(e)}));const T=async({cartId:e,retries:o})=>{const t=c(),n=(()=>{const e=new URLSearchParams(window.location.search);return{overrideShouldEnabledCustomAddress:window.Zonos.overrideUseCustomAddressForm?"1":e.get("overrideShouldEnabledCustomAddress")}})(),s=(()=>{const e=new URLSearchParams(window.location.search).get("validityToken");if(!e||!/^[A-Za-z0-9+/]+={0,2}$/.test(e)||e.length%4!=0)return null;try{return atob(e),e}catch(e){return null}})()||void 0,i=new URLSearchParams;n.overrideShouldEnabledCustomAddress&&i.set("overrideShouldEnabledCustomAddress",n.overrideShouldEnabledCustomAddress);const{errors:a,json:l,zonosMode:d}=await z(`/api/zonos-elements/get-cart?${i.toString()}`,{body:{isTestMode:t,renewCartExpirationToken:s,tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"}),u=!l||a.length;return u&&o?(r("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:o}),await new Promise((e=>setTimeout(e,500))),T({cartId:e,retries:o-1})):u?null:Object.assign(Object.assign({},l),{zonosMode:d})},L=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/,P=new RegExp(`^${L.source}$`),$=new RegExp(`^cart_${L.source}$`),U=/^[a-zA-Z0-9]{2,}$/,N=/^cart_[a-zA-Z0-9]{2,}$/,D=async e=>{const{isDgsCartId:o,isLegacyCartId:t}=(e=>e?e.includes("undefined")?{isDgsCartId:!1,isLegacyCartId:!1}:N.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:U.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:$.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:P.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:{isDgsCartId:!1,isLegacyCartId:!1}:{isDgsCartId:!1,isLegacyCartId:!1})(e);if(!t&&!o)return s("[ZONOS - loadZonos] invalid cart id"),null;const n=await T({cartId:e,retries:5});return r("[ZONOS - loadZonos] getting temp cart data","info",n),n?(window.Zonos.storeId=n.cartData.storeId,window.Zonos.zonosApiKey=n.cartData.credentialToken,window.Zonos.zonosMode=n.zonosMode,{cartData:n.cartData,settings:n.settings,storeFavicon:n.storeFaviconUrl,storeId:n.cartData.storeId,storeLogo:n.storeLogoUrl,zonosApiKey:n.cartData.credentialToken}):(s("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)},R="zonos--checkout-hidden-international-button";var F;const x=(()=>{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})(),M=Date.now(),B="https://v1.3.269.js.zonos.com",q=x||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.269",W="https://fonts.googleapis.com",K=/^https:\/\/fonts\.googleapis\.com/;class G{}F=G,G.doneInit=!1,G.cartSettings=null,G.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),G.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),G._paypalMockResponse=null,G.iframeLogType="undefined"!=typeof window?new URLSearchParams(window.location.search).get("iframeLogType"):null,G.isBigCommerce=!1,G.releaseDate="1781282581347",G.isLegacyCheckout=!1,G.googleAnalyticId=null,G.googleAnalyticReady=!1,G.facebookPixelId=null,G.facebookPixelReady=!1,G.startLoadTime=M,G.domain="undefined"!=typeof window?window.location!=window.parent.location&&document.referrer||document.location.hostname:"",G.showBaseForeign="undefined"!=typeof window&&window.location.search.includes("zonosShowBaseForeign"),G.overrideUseCustomAddressForm=!1,G.isCollect=!1,G.isInvoice=!1,G.isNpm=!0,G.zonosQaUrl=null,G.zonosQaUrlApi=null,G.trackEventLogs=[],G.version="v1.3.269",G.modeAlerted=!1,G.cartData=null,G.paypal=null,G.zonosMode=null,G.IframeService=o,G.getCurrentTimestamp=()=>(new Date).getTime(),G.zonosController=null,G.loadTimeApiInfoList=[],G.logIntervalId=null,G.init=async e=>{const{appearance:o,checkoutSettings:t,currencyConverter:n,helloSettings:i,onCountryChange:a,overrideCurrencyFormat:l,storeId:u,zonosApiKey:p}=e;if(F.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),F.doneInit)return;if(r(`====== ZONOS DEBUG MODE: on (${F.version}) ======`),F.zonosApiKey=p,F.storeId=u,"undefined"!=typeof window&&window.parent===window&&(F.googleAnalyticReady=!0,F.facebookPixelReady=!0),F.isNpm){r("====== ZONOS LOADING FROM NPM ======");const o=k();if(o&&!window.isZonosPreview){r(`====== RE-INJECT "zonos.js" FROM PRVIEW: ${o} ======`,"info");const t=document.createElement("script");return t.src=`${o}/dist/scripts/zonos.js`,document.head.appendChild(t),t.addEventListener("load",(()=>{window.Zonos.isNpm=F.isNpm,window.Zonos.isBigCommerce=F.isBigCommerce,window.Zonos.isLegacyCheckout=F.isLegacyCheckout,window.Zonos.zonosMode=F.zonosMode,window.Zonos.init(e)})),t.addEventListener("error",(()=>{alert(`[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: ${o}`)})),void(window.isZonosPreview=!0)}if(!p&&!F.cartId)return void s("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!F.cartData&&F.cartId){r("Initialize cart data");const e=await D(F.cartId);if(!e)return void s("Failed to get cart data");F.cartData=e.cartData,F.zonosApiKey=e.zonosApiKey,F.cartSettings=e.settings}const t=await(async()=>{const e=c(),o=d();if(!e&&!o||!window.Zonos.zonosApiKey)return null;if(r("[ZONOS - loadZonos] Attempt test public credential","info"),window.Zonos.zonosApiKey.includes("credential_test"))return r("[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key","info"),null;const{errors:t,json:n}=await z("/api/get-test-public-credential");if(t.length||!n)return s("[ZONOS - loadZonos] Failed to get test public credential. Keep using production key",t),null;const i=n.publicCredential;return i?(r(`[ZONOS - loadZonos] Retrieve new test public token ${i}`,"info"),i):(s("[ZONOS - loadZonos] No test public key credential. Keep using production key"),null)})();t&&(F.zonosApiKey=t)}const m=new URL(window.location.href).searchParams.get("payment_intent_client_secret")||sessionStorage.getItem("zonos--client-secret");if(F.cartId&&F.cartData||!!m){r("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)}r("init zonos"),F.restoreNativeBrowserFunctions(),F.injectCustomScriptForHostedCheckout(),F.injectZonosCdn(),F.injectZonosCss(),F.injectFonts(),F.injectCheckoutInternationalButton(),F.injectController({config:{appearance:o,checkoutSettings:t,currencyConverter:n,helloSettings:i,onCountryChange:a,overrideCurrencyFormat:l}}),F.doneInit=!0},G.injectCheckoutInternationalButton=()=>{if(!document.querySelector(`#${R}`)){const e=document.createElement("button");e.id=R,e.style.display="none",document.body.appendChild(e)}},G.injectCustomScriptForHostedCheckout=()=>{const e=F.cartData,o=(null==e?void 0:e.metadata)||[],t=o.find((e=>"customHeaderScript"===e.key)),n=o.find((e=>"customFooterScript"===e.key));if(window.Zonos.isLegacyCheckout&&(t||n)){if(t){r("Injecting custom header script");const e=document.createElement("script");e.textContent=t.value,document.head.appendChild(e)}if(n){r("Injecting custom footer script");const e=document.createElement("script");e.textContent=n.value,document.body.appendChild(e)}}else r("Skip injecting custom script for hosted checkout","info",{footerScript:n,headerScript:t,isLegacyCheckout:window.Zonos.isLegacyCheckout})},G.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},G.triggerCheckoutInternational=async()=>{const e=document.querySelector(`#${R}`);setTimeout((()=>{var o;e&&e.dispatchEvent(new CustomEvent("click",{detail:o}))}),10)},G.openHelloDialog=e=>{const o=document.querySelector("zonos-hello");o&&o.openHelloDialog(null==e||e)},G.showNotification=e=>{var o;null===(o=F.zonosController)||void 0===o||o.showNotification(e)},G.updateOrganizationName=e=>{var o;null===(o=F.zonosController)||void 0===o||o.updateOrganizationName(e)},G.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)}},G.restoreNativeBrowserFunctions=()=>{var e;if("1"===new URL(window.location.href).searchParams.get("useMerchantPolyfill"))return;const o="zonos---native-browser";let t=document.querySelector(`iframe#${o}`);t||(t=document.createElement("iframe"),t.id=o,t.style.display="none",t.style.opacity="0",t.style.position="absolute",t.style.top="-9999px",t.style.left="-9999px",t.style.width="1px",t.style.height="1px",t.style.border="none",t.style.overflow="hidden",t.style.visibility="hidden",document.body.appendChild(t));const n=(null===(e=t.contentWindow)||void 0===e?void 0:e.window.Array.from)||Array.from;Array.from=n,document.body.removeChild(t)},G.injectController=({config:e})=>{var o,t;if(document.querySelector("zonos-controller"))return;if(null===(o=e.checkoutSettings)||void 0===o?void 0:o.placeOrderButtonSelector){const o=e.checkoutSettings.placeOrderButtonSelector;F.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o});new MutationObserver((()=>{F.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o})})).observe(document.body,{childList:!0,subtree:!0})}if(null===(t=e.checkoutSettings)||void 0===t?void 0:t.alwaysTriggerInternationalCheckoutSelector){const o=e.checkoutSettings.alwaysTriggerInternationalCheckoutSelector;F.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o});new MutationObserver((()=>{F.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o})})).observe(document.body,{childList:!0,subtree:!0})}const n=document.createElement("zonos-controller");n.config=e,n.zonosApiKey=F.zonosApiKey||"",n.addEventListener("stripeInitEvent",(async e=>{const{detail:o}=e;r("loading Stripe");const t=await(async(...e)=>{E=!0;const o=Date.now();return A.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);t?(window.Zonos.stripe=t,window.Zonos.isCollect?n.initCollectElement(t):window.Zonos.isInvoice?n.initInvoiceElement(t):n.initCheckoutElement(t)):s("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(n),F.zonosController=n,r("Zonos controller injected!")},G.injectScript=({cdnType:e,isModule:o,theRestUrl:t})=>{const n=`${F.getZonosUrl(e)}/${t}`;if(document.querySelector(`script[src="${n}"]`))return void r(`Zonos script "${n}" already exists in the document`,"warn");const i=document.head||document.body,a=document.createElement("script");o?a.type="module":a.noModule=!0,a.src=n,a.crossOrigin="anonymous",a.onerror=()=>{s(`Failed to load ${a.src}`);const n=l(e);n&&F.injectScript({cdnType:n,isModule:o,theRestUrl:t})},i.appendChild(a)},G.getZonosUrl=e=>{const o=()=>{switch(e){case"jsdelivr":return q;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.269";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.269";case"vercel":return B}};if(F.isNpm){return k()||o()}return o()},G.injectZonosCdn=()=>{F.injectScript({cdnType:a,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),F.injectScript({cdnType:a,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),r("Zonos cdn script injected!")},G.injectStylesheet=({cdnType:e,theRestUrl:o})=>{const t=F.getZonosUrl(e),n=document.head||document.body,r=document.createElement("link");r.rel="preconnect",r.href=`${B}/`,n.appendChild(r);const i=document.createElement("link");i.rel="stylesheet",i.href=`${t}/${o}`,i.onerror=()=>{s(`Failed to load ${i.href}`);const t=l(e);t&&F.injectStylesheet({cdnType:t,theRestUrl:o})},n.appendChild(i)},G.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?r("Zonos style links already injected","warn"):(F.injectStylesheet({cdnType:a,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),r("Zonos style css injected!"))},G.injectFonts=()=>{if((()=>{if(document.fonts.check("1em Inter"))return void r("Inter font already loaded","warn");const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${W}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&!K.test(t.href))return t}return null})())return void r("Inter font already injected","warn");const e=document.head||document.body,o=document.createElement("link");o.rel="preconnect",o.href=W,e.appendChild(o);const t=document.createElement("link");t.rel="stylesheet",t.href=`${W}/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap`,e.appendChild(t),r("Zonos font injected!")},G.setupGoogleFont=e=>{var o;null===(o=F.zonosController)||void 0===o||o.setupGoogleFont(e)},G.injectSupportGoogleFont=e=>{var o;r(`[FONT] injecting ${e}`);const t=null===(o=e.match(/family=(.*?):/))||void 0===o?void 0:o[1],n=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${W}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=W,n.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${e}"]`))return void r(`[FONT] ${t} font already injected`,"warn");const s=document.createElement("link");s.rel="stylesheet",s.href=e,n.appendChild(s),r(`[FONT] ${t} font injected!`)},window.Zonos&&window.Zonos.doneInit||(window.Zonos=G)})();
1
+ (function(){"use strict";const e=({id:e,payload:o,target:t,type:n})=>{var r;t instanceof HTMLIFrameElement?null===(r=t.contentWindow)||void 0===r||r.postMessage({id:e,payload:o,type:n},"*"):t.postMessage({id:e,payload:o,type:n},"*")};class o{constructor(o,t){this.targetElement=o,this.targetId=t,this.sendMessage=(o,t)=>{e({id:this.targetId,payload:t,target:this.targetElement,type:o})}}}o.iframeServices={GOOGLE_PLACES:"zonos--private-iframe-google-places-service-m9bmuh7g"},o.sendMessage=e,o.injectPrivateIframe=({id:e,onload:o,src:t})=>{const n=document.createElement("iframe");return n.src=t,n.id=e,n.style.display="none",n.role="presentation",n.ariaHidden="true",n.tabIndex=-1,n.style.border="none !important",n.style.margin="0px !important",n.style.padding="0px !important",n.style.width="1px !important",n.style.minWidth="100% !important",n.style.overflow="hidden !important",n.style.display="block !important",n.style.visibility="hidden !important",n.style.position="fixed !important",n.style.pointerEvents="none !important",n.style.userSelect="none !important",n.style.height="1px !important",n.onload=()=>o(n),document.body.appendChild(n),n};const t=performance.now(),n=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"}},r=(e,o,...r)=>{var s,i;const{elapsedTimePretty:a}=(()=>{const e=performance.now()-t,o=e>1e3?`${(e/1e3).toFixed(2)}s`:`${e.toFixed(2)}ms`;return{elapsedTime:e,elapsedTimePretty:o}})(),l=[`(${a})`,...r];l.map(n).join(" ");if(!(!!(null===(s=window.Zonos)||void 0===s?void 0:s.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return;let d=document.querySelector("iframe#zonos---debug-logging-iframe");d||(d=document.createElement("iframe"),d.id="zonos---debug-logging-iframe",d.style.display="none",d.style.opacity="0",d.style.position="absolute",d.style.top="-9999px",d.style.left="-9999px",d.style.width="1px",d.style.height="1px",d.style.border="none",d.style.overflow="hidden",d.style.visibility="hidden",document.body.appendChild(d));const c=(null===(i=d.contentWindow)||void 0===i?void 0:i.window.console)||window.console;switch(o){case"warn":c.warn(e,...l);break;case"info":c.info(e,...l);break;case"error":c.error(e,...l);break;default:c.groupCollapsed(e,...l),c.trace(),c.groupEnd()}},s=(e,...o)=>{r(e,"error",...o)},i=["jsdelivr","cdnjs","unpkg","vercel"],a="jsdelivr",l=e=>{const o=i.indexOf(e);return i[o+1]||null},d=()=>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 u(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 p=["cloudflare","vercel"],m=p[0],w={cloudflare:"https://route.elements.zonos.com",vercel:"https://route.js.zonos.com"},h=w[m],y=(e=m)=>{const o=p.indexOf(e),t=p[o+1];return t||null},g=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},f=()=>{const e="userAgentData"in window.navigator?window.navigator.userAgentData:null,o=(()=>{const e="connection"in window.navigator?window.navigator.connection:null,o="mozConnection"in window.navigator?window.navigator.mozConnection:null,t="webkitConnection"in window.navigator?window.navigator.webkitConnection:null;return e||o||t})();return{connectionDownlink:null==o?void 0:o.downlink,connectionEffectiveType:null==o?void 0:o.effectiveType,connectionRtt:null==o?void 0:o.rtt,connectionSaveData:null==o?void 0:o.saveData,isHostedCheckout:window.Zonos.isLegacyCheckout,screenHeight:window.screen.height,screenWidth:window.innerWidth,userAgent:e&&e.brands.length>0?e:window.navigator.userAgent}},v=["/api/zonos-elements/log-script-load","/api/zonos-elements/log-bulk-load-data"],b=async({response:e,shouldLog:o=!0,shouldThrow:t=!1})=>{try{const o=await e.text(),t=g(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}},S=async({basePathType:e,options:o,path:t})=>{let n;const r=window.Zonos.zonosQaUrlApi||w[e]||m,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"),l=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&a&&l&&(window.Zonos.modeAlerted=!0),n.ok){return{baseUrl:r,errors:[],json:await b({response:n}),response:n,zonosMode:a}}const d=n.status.toString();try{const e=await b({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:d}:e)),json:null,response:n,zonosMode:a}}return{baseUrl:r,errors:[{message:JSON.stringify(e),type:d}],json:null,response:n,zonosMode:a}}catch(e){return{baseUrl:r,errors:[{message:`${d}: ${"Unknown error"}`,type:d}],json:null,response:null,zonosMode:a}}},C=async({basePathType:e,options:o,path:t})=>{var n,s;const i=t.startsWith("/api/bigcommerce")?"vercel":e,a=performance.now(),l=await S({basePathType:i,options:o,path:t}),{errors:d,response:c}=l,p=u(l,["errors","response"]),m=performance.now()-a;r(`${t} (${m.toFixed(2)}ms)`,"info");const b=null==c?void 0:c.headers.get("Zonos-Duration");200===(null==c?void 0:c.status)&&(({apiPath:e,apiType:o,loadTimeInternal:t,loadTimeTotal:n})=>{if(v.includes(e))return;const r=n-t;if(r<0)return;const s=e.split("?")[0]||e,i=f(),a="object"==typeof i.userAgent&&i.userAgent.mobile,l={apiType:o,connectionType:i.connectionEffectiveType,href:s,isHostedCheckout:window.Zonos.isLegacyCheckout,isMobile:(d=a,d||window.innerWidth<890),loadTimeBrowserApi:r,loadTimeInternal:t,loadTimeTotal:n,metadata:Object.assign({},i),screenHeight:i.screenHeight,screenWidth:i.screenWidth,userAgent:"string"==typeof i.userAgent?i.userAgent:i.userAgent.brands.map((e=>e.brand)).filter((e=>!/Not.*A.*Brand.*/.test(e))).join(",")};var d;window.Zonos.loadTimeApiInfoList.push(l)})({apiPath:t,apiType:i,loadTimeInternal:b?Number(b):0,loadTimeTotal:m});const z=y(i),k=d.find((({type:e})=>"unknown"===e)),Z=d.find((({message:e})=>"string"==typeof e&&(e.includes("signal is aborted")||e.includes("The operation was aborted")||e.includes("Fetch is aborted")))),j=!!k||404===(null==c?void 0:c.status)||500===(null==c?void 0:c.status),I=z&&j;return j&&!Z&&(async({endpoint:e,errors:o,metadata:t,shouldPostReleaseErrorReporting:n})=>{r("sendErrorLog","warn",e,t,o);{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},t)};try{fetch(`${h}/api/zonos-elements/log-error`,{body:JSON.stringify(i),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const o=y();if(!o)return;fetch(`${w[o]}/api/zonos-elements/log-error`,{body:JSON.stringify(i),method:"POST"})}})({endpoint:w[i]+t,errors:d.map((({message:e})=>`API: ${e}`)),metadata:{currentBasePath:i,nextFallbackApiType:z,requestHeaders:null==o?void 0:o.headers,requestPayload:g(null===(n=null==o?void 0:o.body)||void 0===n?void 0:n.toString())||(null===(s=null==o?void 0:o.body)||void 0===s?void 0:s.toString()),shouldCallFallback:I,status:null==c?void 0:c.status,statusText:null==c?void 0:c.statusText},shouldPostReleaseErrorReporting:!0}),I?(r(`=== "${t}" failed to fetch, trying next fallback ${z}`),C({basePathType:z,options:o,path:t})):Object.assign({errors:d,response:c},p)},z=async(e,o)=>{const t=u(o||{},[]),n=t.body?JSON.stringify(t.body):void 0,r=t.method||"GET",s=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Staging-Mode":d()?"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"},t.headers);Object.keys(s).forEach((e=>void 0===s[e]&&delete s[e]));const i=Object.assign(Object.assign({},t),{body:"GET"===r?void 0:n,headers:s,method:r}),a=new URLSearchParams(window.location.search).get("useFallbackApi");return C({basePathType:a||m,options:i,path:e})},k=()=>{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),t="https://v1.3.272.js.zonos.com";if(!o&&(t.includes("test.")||t.includes("test-")))return t;if(!o&&["dev.demo.elements.zonos.com","dev.checkout.elements.zonos.com","dev.storybook.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 n=`https://${o}.preview.js.zonos.com`;return r(`[ZONOS-WARNING] using '${n}' for loading elements script`,"warn"),fetch(n).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${n}' 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})),n},Z="https://js.stripe.com/v3",j=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;let I=null;const O=e=>(null!==I||(I=new Promise(((o,t)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe)o(window.Stripe);else try{let n=(()=>{const e=document.querySelectorAll(`script[src^="${Z}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&j.test(t.src))return t}return null})();n&&e?console.warn("loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used"):n||(n=(e=>{const o=document.createElement("script");o.src=`${Z}`;const t=document.head||document.body;return t?(t.appendChild(o),o):(s("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==n||n.addEventListener("load",(()=>{window.Stripe?o(window.Stripe):t(new Error("Stripe.js not available"))})),null==n||n.addEventListener("error",(()=>{t(new Error("Failed to load Stripe.js"))}))}catch(e){return void t(e)}else o(null)}))),I),A=Promise.resolve().then((()=>O(null)));let E=!1;A.catch((e=>{E||console.warn(e)}));const T=async({cartId:e,retries:o})=>{const t=c(),n=(()=>{const e=new URLSearchParams(window.location.search);return{overrideShouldEnabledCustomAddress:window.Zonos.overrideUseCustomAddressForm?"1":e.get("overrideShouldEnabledCustomAddress")}})(),s=(()=>{const e=new URLSearchParams(window.location.search).get("validityToken");if(!e||!/^[A-Za-z0-9+/]+={0,2}$/.test(e)||e.length%4!=0)return null;try{return atob(e),e}catch(e){return null}})()||void 0,i=new URLSearchParams;n.overrideShouldEnabledCustomAddress&&i.set("overrideShouldEnabledCustomAddress",n.overrideShouldEnabledCustomAddress);const{errors:a,json:l,zonosMode:d}=await z(`/api/zonos-elements/get-cart?${i.toString()}`,{body:{isTestMode:t,renewCartExpirationToken:s,tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"}),u=!l||a.length;return u&&o?(r("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:o}),await new Promise((e=>setTimeout(e,500))),T({cartId:e,retries:o-1})):u?null:Object.assign(Object.assign({},l),{zonosMode:d})},L=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/,P=new RegExp(`^${L.source}$`),$=new RegExp(`^cart_${L.source}$`),U=/^[a-zA-Z0-9]{2,}$/,N=/^cart_[a-zA-Z0-9]{2,}$/,D=async e=>{const{isDgsCartId:o,isLegacyCartId:t}=(e=>e?e.includes("undefined")?{isDgsCartId:!1,isLegacyCartId:!1}:N.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:U.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:$.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:P.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:{isDgsCartId:!1,isLegacyCartId:!1}:{isDgsCartId:!1,isLegacyCartId:!1})(e);if(!t&&!o)return s("[ZONOS - loadZonos] invalid cart id"),null;const n=await T({cartId:e,retries:5});return r("[ZONOS - loadZonos] getting temp cart data","info",n),n?(window.Zonos.storeId=n.cartData.storeId,window.Zonos.zonosApiKey=n.cartData.credentialToken,window.Zonos.zonosMode=n.zonosMode,{cartData:n.cartData,settings:n.settings,storeFavicon:n.storeFaviconUrl,storeId:n.cartData.storeId,storeLogo:n.storeLogoUrl,zonosApiKey:n.cartData.credentialToken}):(s("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)},R="zonos--checkout-hidden-international-button";var F;const x=(()=>{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})(),M=Date.now(),B="https://v1.3.272.js.zonos.com",q=x||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.272",W="https://fonts.googleapis.com",K=/^https:\/\/fonts\.googleapis\.com/;class G{}F=G,G.doneInit=!1,G.cartSettings=null,G.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),G.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),G._paypalMockResponse=null,G.iframeLogType="undefined"!=typeof window?new URLSearchParams(window.location.search).get("iframeLogType"):null,G.isBigCommerce=!1,G.releaseDate="1782316453940",G.isLegacyCheckout=!1,G.googleAnalyticId=null,G.googleAnalyticReady=!1,G.facebookPixelId=null,G.facebookPixelReady=!1,G.startLoadTime=M,G.domain="undefined"!=typeof window?window.location!=window.parent.location&&document.referrer||document.location.hostname:"",G.showBaseForeign="undefined"!=typeof window&&window.location.search.includes("zonosShowBaseForeign"),G.overrideUseCustomAddressForm=!1,G.isCollect=!1,G.isInvoice=!1,G.isNpm=!0,G.zonosQaUrl=null,G.zonosQaUrlApi=null,G.trackEventLogs=[],G.version="v1.3.272",G.modeAlerted=!1,G.cartData=null,G.paypal=null,G.zonosMode=null,G.IframeService=o,G.getCurrentTimestamp=()=>(new Date).getTime(),G.zonosController=null,G.loadTimeApiInfoList=[],G.logIntervalId=null,G.init=async e=>{const{appearance:o,checkoutSettings:t,currencyConverter:n,helloSettings:i,onCountryChange:a,overrideCurrencyFormat:l,storeId:u,zonosApiKey:p}=e;if(F.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),F.doneInit)return;if(r(`====== ZONOS DEBUG MODE: on (${F.version}) ======`),F.zonosApiKey=p,F.storeId=u,"undefined"!=typeof window&&window.parent===window&&(F.googleAnalyticReady=!0,F.facebookPixelReady=!0),F.isNpm){r("====== ZONOS LOADING FROM NPM ======");const o=k();if(o&&!window.isZonosPreview){r(`====== RE-INJECT "zonos.js" FROM PRVIEW: ${o} ======`,"info");const t=document.createElement("script");return t.src=`${o}/dist/scripts/zonos.js`,document.head.appendChild(t),t.addEventListener("load",(()=>{window.Zonos.isNpm=F.isNpm,window.Zonos.isBigCommerce=F.isBigCommerce,window.Zonos.isLegacyCheckout=F.isLegacyCheckout,window.Zonos.zonosMode=F.zonosMode,window.Zonos.init(e)})),t.addEventListener("error",(()=>{alert(`[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: ${o}`)})),void(window.isZonosPreview=!0)}if(!p&&!F.cartId)return void s("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!F.cartData&&F.cartId){r("Initialize cart data");const e=await D(F.cartId);if(!e)return void s("Failed to get cart data");F.cartData=e.cartData,F.zonosApiKey=e.zonosApiKey,F.cartSettings=e.settings}const t=await(async()=>{const e=c(),o=d();if(!e&&!o||!window.Zonos.zonosApiKey)return null;if(r("[ZONOS - loadZonos] Attempt test public credential","info"),window.Zonos.zonosApiKey.includes("credential_test"))return r("[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key","info"),null;const{errors:t,json:n}=await z("/api/get-test-public-credential");if(t.length||!n)return s("[ZONOS - loadZonos] Failed to get test public credential. Keep using production key",t),null;const i=n.publicCredential;return i?(r(`[ZONOS - loadZonos] Retrieve new test public token ${i}`,"info"),i):(s("[ZONOS - loadZonos] No test public key credential. Keep using production key"),null)})();t&&(F.zonosApiKey=t)}const m=new URL(window.location.href).searchParams.get("payment_intent_client_secret")||sessionStorage.getItem("zonos--client-secret");if(F.cartId&&F.cartData||!!m){r("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)}r("init zonos"),F.restoreNativeBrowserFunctions(),F.injectCustomScriptForHostedCheckout(),F.injectZonosCdn(),F.injectZonosCss(),F.injectFonts(),F.injectCheckoutInternationalButton(),F.injectController({config:{appearance:o,checkoutSettings:t,currencyConverter:n,helloSettings:i,onCountryChange:a,overrideCurrencyFormat:l}}),F.doneInit=!0},G.injectCheckoutInternationalButton=()=>{if(!document.querySelector(`#${R}`)){const e=document.createElement("button");e.id=R,e.style.display="none",document.body.appendChild(e)}},G.injectCustomScriptForHostedCheckout=()=>{const e=F.cartData,o=(null==e?void 0:e.metadata)||[],t=o.find((e=>"customHeaderScript"===e.key)),n=o.find((e=>"customFooterScript"===e.key));if(window.Zonos.isLegacyCheckout&&(t||n)){if(t){r("Injecting custom header script");const e=document.createElement("script");e.textContent=t.value,document.head.appendChild(e)}if(n){r("Injecting custom footer script");const e=document.createElement("script");e.textContent=n.value,document.body.appendChild(e)}}else r("Skip injecting custom script for hosted checkout","info",{footerScript:n,headerScript:t,isLegacyCheckout:window.Zonos.isLegacyCheckout})},G.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},G.triggerCheckoutInternational=async()=>{const e=document.querySelector(`#${R}`);setTimeout((()=>{var o;e&&e.dispatchEvent(new CustomEvent("click",{detail:o}))}),10)},G.openHelloDialog=e=>{const o=document.querySelector("zonos-hello");o&&o.openHelloDialog(null==e||e)},G.showNotification=e=>{var o;null===(o=F.zonosController)||void 0===o||o.showNotification(e)},G.updateOrganizationName=e=>{var o;null===(o=F.zonosController)||void 0===o||o.updateOrganizationName(e)},G.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)}},G.restoreNativeBrowserFunctions=()=>{var e;if("1"===new URL(window.location.href).searchParams.get("useMerchantPolyfill"))return;const o="zonos---native-browser";let t=document.querySelector(`iframe#${o}`);t||(t=document.createElement("iframe"),t.id=o,t.style.display="none",t.style.opacity="0",t.style.position="absolute",t.style.top="-9999px",t.style.left="-9999px",t.style.width="1px",t.style.height="1px",t.style.border="none",t.style.overflow="hidden",t.style.visibility="hidden",document.body.appendChild(t));const n=(null===(e=t.contentWindow)||void 0===e?void 0:e.window.Array.from)||Array.from;Array.from=n,document.body.removeChild(t)},G.injectController=({config:e})=>{var o,t;if(document.querySelector("zonos-controller"))return;if(null===(o=e.checkoutSettings)||void 0===o?void 0:o.placeOrderButtonSelector){const o=e.checkoutSettings.placeOrderButtonSelector;F.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o});new MutationObserver((()=>{F.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o})})).observe(document.body,{childList:!0,subtree:!0})}if(null===(t=e.checkoutSettings)||void 0===t?void 0:t.alwaysTriggerInternationalCheckoutSelector){const o=e.checkoutSettings.alwaysTriggerInternationalCheckoutSelector;F.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o});new MutationObserver((()=>{F.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o})})).observe(document.body,{childList:!0,subtree:!0})}const n=document.createElement("zonos-controller");n.config=e,n.zonosApiKey=F.zonosApiKey||"",n.addEventListener("stripeInitEvent",(async e=>{const{detail:o}=e;r("loading Stripe");const t=await(async(...e)=>{E=!0;const o=Date.now();return A.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);t?(window.Zonos.stripe=t,window.Zonos.isCollect?n.initCollectElement(t):window.Zonos.isInvoice?n.initInvoiceElement(t):n.initCheckoutElement(t)):s("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(n),F.zonosController=n,r("Zonos controller injected!")},G.injectScript=({cdnType:e,isModule:o,theRestUrl:t})=>{const n=`${F.getZonosUrl(e)}/${t}`;if(document.querySelector(`script[src="${n}"]`))return void r(`Zonos script "${n}" already exists in the document`,"warn");const i=document.head||document.body,a=document.createElement("script");o?a.type="module":a.noModule=!0,a.src=n,a.crossOrigin="anonymous",a.onerror=()=>{s(`Failed to load ${a.src}`);const n=l(e);n&&F.injectScript({cdnType:n,isModule:o,theRestUrl:t})},i.appendChild(a)},G.getZonosUrl=e=>{const o=()=>{switch(e){case"jsdelivr":return q;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.272";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.272";case"vercel":return B}};if(F.isNpm){return k()||o()}return o()},G.injectZonosCdn=()=>{F.injectScript({cdnType:a,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),F.injectScript({cdnType:a,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),r("Zonos cdn script injected!")},G.injectStylesheet=({cdnType:e,theRestUrl:o})=>{const t=F.getZonosUrl(e),n=document.head||document.body,r=document.createElement("link");r.rel="preconnect",r.href=`${B}/`,n.appendChild(r);const i=document.createElement("link");i.rel="stylesheet",i.href=`${t}/${o}`,i.onerror=()=>{s(`Failed to load ${i.href}`);const t=l(e);t&&F.injectStylesheet({cdnType:t,theRestUrl:o})},n.appendChild(i)},G.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?r("Zonos style links already injected","warn"):(F.injectStylesheet({cdnType:a,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),r("Zonos style css injected!"))},G.injectFonts=()=>{if((()=>{if(document.fonts.check("1em Inter"))return void r("Inter font already loaded","warn");const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${W}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&!K.test(t.href))return t}return null})())return void r("Inter font already injected","warn");const e=document.head||document.body,o=document.createElement("link");o.rel="preconnect",o.href=W,e.appendChild(o);const t=document.createElement("link");t.rel="stylesheet",t.href=`${W}/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap`,e.appendChild(t),r("Zonos font injected!")},G.setupGoogleFont=e=>{var o;null===(o=F.zonosController)||void 0===o||o.setupGoogleFont(e)},G.injectSupportGoogleFont=e=>{var o;r(`[FONT] injecting ${e}`);const t=null===(o=e.match(/family=(.*?):/))||void 0===o?void 0:o[1],n=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${W}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=W,n.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${e}"]`))return void r(`[FONT] ${t} font already injected`,"warn");const s=document.createElement("link");s.rel="stylesheet",s.href=e,n.appendChild(s),r(`[FONT] ${t} font injected!`)},window.Zonos&&window.Zonos.doneInit||(window.Zonos=G)})();
@@ -0,0 +1,19 @@
1
+ import type { CurrencyCode } from "../../../types/generated/graphql.internal.types";
2
+ /**
3
+ * Caches live "configured currency → presentment currency" rates used to convert
4
+ * the EU withdrawal return-shipping cap into the currency the buyer actually pays
5
+ * in. A @stencil/store so that, when a lazily-fetched rate resolves, components
6
+ * rendering the notice re-render and pick up the converted amount. Keyed by
7
+ * `${sourceCurrency}_${targetCurrency}`; a null value means the lookup failed.
8
+ */
9
+ declare const euWithdrawalRateStore: {
10
+ crossRates: Record<string, number | null>;
11
+ };
12
+ export { euWithdrawalRateStore };
13
+ export declare const euWithdrawalCrossRateKey: (sourceCurrency: CurrencyCode, targetCurrency: CurrencyCode) => string;
14
+ /**
15
+ * Lazily fetch the current configured→presentment rate (fire-and-forget). Guarded
16
+ * so each pair is fetched at most once; the result lands in the reactive store,
17
+ * which triggers a re-render that then shows the presentment estimate.
18
+ */
19
+ export declare const ensureEuWithdrawalCrossRate: (sourceCurrency: CurrencyCode, targetCurrency: CurrencyCode, shipToCountry: string) => void;
@@ -287,6 +287,12 @@ export declare const stringsArabic: {
287
287
  'I agree to the [policies]': {
288
288
  value: string;
289
289
  };
290
+ 'If you later choose to exercise your right to withdrawal, you will be responsible for any associated return shipping costs, up to a maximum [amount].': {
291
+ value: string;
292
+ };
293
+ 'If you later choose to exercise your right to withdrawal, you will be responsible for any associated return shipping costs.': {
294
+ value: string;
295
+ };
290
296
  "If you select FedEx Ground as your shipping option, you'll need to complete a General Agency Agreement (GAA) after placing your order. This form allows FedEx to clear your package through Canadian customs on your behalf. FedEx will contact you directly\u2014usually by email or phone\u2014with instructions on how to complete the GAA. To avoid delays or the return of your package, please respond promptly to their request.": {
291
297
  value: string;
292
298
  };
@@ -287,6 +287,12 @@ export declare const stringsBase: {
287
287
  'I agree to the [policies]': {
288
288
  value: string;
289
289
  };
290
+ 'If you later choose to exercise your right to withdrawal, you will be responsible for any associated return shipping costs, up to a maximum [amount].': {
291
+ value: string;
292
+ };
293
+ 'If you later choose to exercise your right to withdrawal, you will be responsible for any associated return shipping costs.': {
294
+ value: string;
295
+ };
290
296
  "If you select FedEx Ground as your shipping option, you'll need to complete a General Agency Agreement (GAA) after placing your order. This form allows FedEx to clear your package through Canadian customs on your behalf. FedEx will contact you directly\u2014usually by email or phone\u2014with instructions on how to complete the GAA. To avoid delays or the return of your package, please respond promptly to their request.": {
291
297
  value: string;
292
298
  };
@@ -287,6 +287,12 @@ export declare const stringsChinese: {
287
287
  'I agree to the [policies]': {
288
288
  value: string;
289
289
  };
290
+ 'If you later choose to exercise your right to withdrawal, you will be responsible for any associated return shipping costs, up to a maximum [amount].': {
291
+ value: string;
292
+ };
293
+ 'If you later choose to exercise your right to withdrawal, you will be responsible for any associated return shipping costs.': {
294
+ value: string;
295
+ };
290
296
  "If you select FedEx Ground as your shipping option, you'll need to complete a General Agency Agreement (GAA) after placing your order. This form allows FedEx to clear your package through Canadian customs on your behalf. FedEx will contact you directly\u2014usually by email or phone\u2014with instructions on how to complete the GAA. To avoid delays or the return of your package, please respond promptly to their request.": {
291
297
  value: string;
292
298
  };
@@ -287,6 +287,12 @@ export declare const stringsDanish: {
287
287
  'I agree to the [policies]': {
288
288
  value: string;
289
289
  };
290
+ 'If you later choose to exercise your right to withdrawal, you will be responsible for any associated return shipping costs, up to a maximum [amount].': {
291
+ value: string;
292
+ };
293
+ 'If you later choose to exercise your right to withdrawal, you will be responsible for any associated return shipping costs.': {
294
+ value: string;
295
+ };
290
296
  "If you select FedEx Ground as your shipping option, you'll need to complete a General Agency Agreement (GAA) after placing your order. This form allows FedEx to clear your package through Canadian customs on your behalf. FedEx will contact you directly\u2014usually by email or phone\u2014with instructions on how to complete the GAA. To avoid delays or the return of your package, please respond promptly to their request.": {
291
297
  value: string;
292
298
  };
@@ -287,6 +287,12 @@ export declare const stringsDutch: {
287
287
  'I agree to the [policies]': {
288
288
  value: string;
289
289
  };
290
+ 'If you later choose to exercise your right to withdrawal, you will be responsible for any associated return shipping costs, up to a maximum [amount].': {
291
+ value: string;
292
+ };
293
+ 'If you later choose to exercise your right to withdrawal, you will be responsible for any associated return shipping costs.': {
294
+ value: string;
295
+ };
290
296
  "If you select FedEx Ground as your shipping option, you'll need to complete a General Agency Agreement (GAA) after placing your order. This form allows FedEx to clear your package through Canadian customs on your behalf. FedEx will contact you directly\u2014usually by email or phone\u2014with instructions on how to complete the GAA. To avoid delays or the return of your package, please respond promptly to their request.": {
291
297
  value: string;
292
298
  };