@zonos/elements 1.2.4-alpha.8 → 1.3.3-alpha.0

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 (175) hide show
  1. package/README.md +80 -1
  2. package/dist/cjs/{cart-90f7c8c0.js → cart-cfa5d5fd.js} +4 -4
  3. package/dist/cjs/{getBorderRadius-bf4a4276.js → getBorderRadius-c3c63ee6.js} +1 -1
  4. package/dist/cjs/index.cjs.js +5 -5
  5. package/dist/cjs/{isDarkColor-ff6ff183.js → isDarkColor-fc8c294a.js} +1 -1
  6. package/dist/cjs/loader.cjs.js +1 -1
  7. package/dist/cjs/{localization-9caf3397.js → localization-4746acf7.js} +2 -2
  8. package/dist/cjs/{submitGtag-b141b45d.js → submitGtag-ca175427.js} +2 -2
  9. package/dist/cjs/zonos-address_2.cjs.entry.js +5 -5
  10. package/dist/cjs/zonos-badge.cjs.entry.js +1 -1
  11. package/dist/cjs/zonos-banner.cjs.entry.js +1 -1
  12. package/dist/cjs/zonos-button_2.cjs.entry.js +3 -3
  13. package/dist/cjs/zonos-card_2.cjs.entry.js +1 -1
  14. package/dist/cjs/zonos-cart-items_10.cjs.entry.js +45 -16
  15. package/dist/cjs/zonos-checkout.cjs.entry.js +14 -9
  16. package/dist/cjs/zonos-controller.cjs.entry.js +14 -54
  17. package/dist/cjs/zonos-country-flag_4.cjs.entry.js +3 -3
  18. package/dist/cjs/zonos-elements.cjs.js +1 -1
  19. package/dist/cjs/zonos-hello-dialog.cjs.entry.js +2 -2
  20. package/dist/cjs/zonos-hello.cjs.entry.js +8 -5
  21. package/dist/cjs/zonos-icon.cjs.entry.js +1 -1
  22. package/dist/cjs/zonos-notification.cjs.entry.js +1 -1
  23. package/dist/cjs/zonos-payment.cjs.entry.js +5 -5
  24. package/dist/cjs/zonos-shipping-rich-radio.cjs.entry.js +2 -2
  25. package/dist/cjs/zonos-text.cjs.entry.js +1 -1
  26. package/dist/cjs/{zonosStore-b43ef5db.js → zonosStore-10d1d6ff.js} +0 -8
  27. package/dist/collection/__tests__/build-utils/urlCheckOne.js +4 -1
  28. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.js +43 -10
  29. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +8 -3
  30. package/dist/collection/components/common/zonos-dialog/zonos-dialog.css +4 -4
  31. package/dist/collection/components/hello/zonos-hello/zonos-hello.js +6 -3
  32. package/dist/collection/components/main/zonos-controller.js +35 -54
  33. package/dist/collection/components/store/zonosStore.js +0 -8
  34. package/dist/collection/components/utils/api/{getZonosSetting.js → getZonosSettings.js} +2 -2
  35. package/dist/collection/components/utils/handleFetch.js +1 -1
  36. package/dist/collection/environment.js +14 -3
  37. package/dist/collection/scripts/{zonos.js → zonosBase.js} +23 -19
  38. package/dist/collection/types/generated/graphql.customer.types.js +65 -0
  39. package/dist/collection/types/generated/graphql.frontend.types.js +9 -0
  40. package/dist/components/localization.js +1 -1
  41. package/dist/components/zonos-checkout-finish2.js +40 -10
  42. package/dist/components/zonos-checkout.js +8 -3
  43. package/dist/components/zonos-controller.js +11 -50
  44. package/dist/components/zonos-dialog2.js +1 -1
  45. package/dist/components/zonos-hello.js +6 -3
  46. package/dist/components/zonosStore.js +0 -8
  47. package/dist/esm/{cart-b439be00.js → cart-d81b92ea.js} +4 -4
  48. package/dist/esm/{getBorderRadius-178a0a05.js → getBorderRadius-77e97943.js} +1 -1
  49. package/dist/esm/index.js +5 -5
  50. package/dist/esm/{isDarkColor-416d6047.js → isDarkColor-69090b29.js} +1 -1
  51. package/dist/esm/loader.js +1 -1
  52. package/dist/esm/{localization-a51ccbc2.js → localization-0c5b29fd.js} +2 -2
  53. package/dist/esm/{submitGtag-521826a2.js → submitGtag-8a0fbd41.js} +2 -2
  54. package/dist/esm/zonos-address_2.entry.js +5 -5
  55. package/dist/esm/zonos-badge.entry.js +1 -1
  56. package/dist/esm/zonos-banner.entry.js +1 -1
  57. package/dist/esm/zonos-button_2.entry.js +3 -3
  58. package/dist/esm/zonos-card_2.entry.js +1 -1
  59. package/dist/esm/zonos-cart-items_10.entry.js +45 -16
  60. package/dist/esm/zonos-checkout.entry.js +14 -9
  61. package/dist/esm/zonos-controller.entry.js +14 -54
  62. package/dist/esm/zonos-country-flag_4.entry.js +3 -3
  63. package/dist/esm/zonos-elements.js +1 -1
  64. package/dist/esm/zonos-hello-dialog.entry.js +2 -2
  65. package/dist/esm/zonos-hello.entry.js +8 -5
  66. package/dist/esm/zonos-icon.entry.js +1 -1
  67. package/dist/esm/zonos-notification.entry.js +1 -1
  68. package/dist/esm/zonos-payment.entry.js +5 -5
  69. package/dist/esm/zonos-shipping-rich-radio.entry.js +2 -2
  70. package/dist/esm/zonos-text.entry.js +1 -1
  71. package/dist/esm/{zonosStore-61e74f58.js → zonosStore-34f07ee8.js} +0 -8
  72. package/dist/esm-es5/{cart-b439be00.js → cart-d81b92ea.js} +1 -1
  73. package/dist/esm-es5/{getBorderRadius-178a0a05.js → getBorderRadius-77e97943.js} +1 -1
  74. package/dist/esm-es5/index.js +1 -1
  75. package/dist/esm-es5/{isDarkColor-416d6047.js → isDarkColor-69090b29.js} +1 -1
  76. package/dist/esm-es5/loader.js +1 -1
  77. package/dist/esm-es5/{localization-a51ccbc2.js → localization-0c5b29fd.js} +1 -1
  78. package/dist/esm-es5/{submitGtag-521826a2.js → submitGtag-8a0fbd41.js} +1 -1
  79. package/dist/esm-es5/zonos-address_2.entry.js +1 -1
  80. package/dist/esm-es5/zonos-badge.entry.js +1 -1
  81. package/dist/esm-es5/zonos-banner.entry.js +1 -1
  82. package/dist/esm-es5/zonos-button_2.entry.js +1 -1
  83. package/dist/esm-es5/zonos-card_2.entry.js +1 -1
  84. package/dist/esm-es5/zonos-cart-items_10.entry.js +1 -1
  85. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  86. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  87. package/dist/esm-es5/zonos-country-flag_4.entry.js +1 -1
  88. package/dist/esm-es5/zonos-elements.js +1 -1
  89. package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
  90. package/dist/esm-es5/zonos-hello.entry.js +1 -1
  91. package/dist/esm-es5/zonos-icon.entry.js +1 -1
  92. package/dist/esm-es5/zonos-notification.entry.js +1 -1
  93. package/dist/esm-es5/zonos-payment.entry.js +1 -1
  94. package/dist/esm-es5/zonos-shipping-rich-radio.entry.js +1 -1
  95. package/dist/esm-es5/zonos-text.entry.js +1 -1
  96. package/dist/esm-es5/{zonosStore-61e74f58.js → zonosStore-34f07ee8.js} +1 -1
  97. package/dist/scripts/extractZonosQaUrl.js +1 -30
  98. package/dist/scripts/loadStripe.js +1 -118
  99. package/dist/scripts/loadZonos.js +1 -565
  100. package/dist/scripts/stripe.js +1 -126
  101. package/dist/scripts/zonos.js +1 -565
  102. package/dist/scripts/zonosBase.js +1 -0
  103. package/dist/types/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.d.ts +3 -3
  104. package/dist/types/components/main/zonos-controller.d.ts +5 -2
  105. package/dist/types/components/store/zonosStore.d.ts +1 -3
  106. package/dist/types/components/utils/api/{getZonosSetting.d.ts → getZonosSettings.d.ts} +1 -1
  107. package/dist/types/components.d.ts +6 -2
  108. package/dist/types/scripts/{zonos.d.ts → zonosBase.d.ts} +6 -3
  109. package/dist/types/types/LogErrorRequestBody.d.ts +5 -0
  110. package/dist/types/types/checkout/CheckoutConfig.d.ts +3 -2
  111. package/dist/types/types/generated/graphql.customer.types.d.ts +80 -0
  112. package/dist/types/types/generated/graphql.customer.types.ts +114 -0
  113. package/dist/types/types/generated/graphql.frontend.types.d.ts +33 -0
  114. package/dist/types/types/generated/graphql.frontend.types.ts +68 -0
  115. package/dist/types/types/global.d.ts +10 -2
  116. package/dist/types/types/hello/HelloConfig.d.ts +0 -1
  117. package/dist/zonos-elements/index.esm.js +1 -1
  118. package/dist/zonos-elements/p-02175f85.entry.js +1 -0
  119. package/dist/zonos-elements/{p-1685c8df.js → p-06a332cd.js} +1 -1
  120. package/dist/zonos-elements/{p-4ed71bd7.entry.js → p-124857ae.entry.js} +1 -1
  121. package/dist/zonos-elements/p-17ef815f.entry.js +1 -0
  122. package/dist/zonos-elements/{p-e98be2d0.system.entry.js → p-1f494581.system.entry.js} +1 -1
  123. package/dist/zonos-elements/p-24fbe845.system.js +1 -1
  124. package/dist/zonos-elements/{p-4846796a.js → p-2b41549a.js} +1 -1
  125. package/dist/zonos-elements/p-2e1e9074.js +1 -0
  126. package/dist/zonos-elements/{p-2801d868.entry.js → p-3509ffaa.entry.js} +1 -1
  127. package/dist/zonos-elements/{p-1d4a970b.entry.js → p-3c8763a7.entry.js} +1 -1
  128. package/dist/zonos-elements/{p-49f09b91.entry.js → p-3e7444c6.entry.js} +1 -1
  129. package/dist/zonos-elements/{p-55f49f1e.js → p-4b3baf99.js} +1 -1
  130. package/dist/zonos-elements/{p-a504f64f.system.js → p-5066955b.system.js} +1 -1
  131. package/dist/zonos-elements/{p-e5ae22a9.system.entry.js → p-53ea93c2.system.entry.js} +1 -1
  132. package/dist/zonos-elements/{p-f367f2fe.system.entry.js → p-5bada106.system.entry.js} +1 -1
  133. package/dist/zonos-elements/{p-f141519c.system.entry.js → p-72cfaee2.system.entry.js} +1 -1
  134. package/dist/zonos-elements/{p-b85be1ab.system.js → p-7730250d.system.js} +1 -1
  135. package/dist/zonos-elements/p-80748529.system.entry.js +1 -0
  136. package/dist/zonos-elements/{p-089ba905.js → p-86f22026.js} +1 -1
  137. package/dist/zonos-elements/{p-a0e36ed3.entry.js → p-88600956.entry.js} +1 -1
  138. package/dist/zonos-elements/{p-89c210d6.entry.js → p-8b1cb8a4.entry.js} +1 -1
  139. package/dist/zonos-elements/p-8bd04aaa.entry.js +1 -0
  140. package/dist/zonos-elements/{p-47390db7.system.entry.js → p-935fa685.system.entry.js} +1 -1
  141. package/dist/zonos-elements/{p-639396bb.entry.js → p-9c1f19b6.entry.js} +1 -1
  142. package/dist/zonos-elements/{p-4d93275c.entry.js → p-a063c4b7.entry.js} +1 -1
  143. package/dist/zonos-elements/p-a174d834.system.js +1 -0
  144. package/dist/zonos-elements/{p-3c6988d7.js → p-a244579e.js} +1 -1
  145. package/dist/zonos-elements/{p-24eed2a8.system.js → p-a54d8db3.system.js} +1 -1
  146. package/dist/zonos-elements/{p-e1f6ab97.entry.js → p-ab00288a.entry.js} +1 -1
  147. package/dist/zonos-elements/{p-b51de536.system.js → p-ab179c88.system.js} +1 -1
  148. package/dist/zonos-elements/{p-4bee0bff.system.entry.js → p-b3a71ae4.system.entry.js} +1 -1
  149. package/dist/zonos-elements/{p-d856a200.system.entry.js → p-b3e034bb.system.entry.js} +1 -1
  150. package/dist/zonos-elements/{p-3cea383b.system.entry.js → p-bb7de2c4.system.entry.js} +1 -1
  151. package/dist/zonos-elements/p-c0494ed6.entry.js +1 -0
  152. package/dist/zonos-elements/{p-da060b1c.system.js → p-c1665c4f.system.js} +1 -1
  153. package/dist/zonos-elements/{p-2f43da39.system.entry.js → p-c1e298d5.system.entry.js} +1 -1
  154. package/dist/zonos-elements/{p-8c5595d9.system.entry.js → p-c520d819.system.entry.js} +1 -1
  155. package/dist/zonos-elements/{p-c9348bb0.system.entry.js → p-ca875e60.system.entry.js} +1 -1
  156. package/dist/zonos-elements/{p-b4601210.system.entry.js → p-ccd1794a.system.entry.js} +1 -1
  157. package/dist/zonos-elements/p-e2c7adaa.system.entry.js +1 -0
  158. package/dist/zonos-elements/{p-b6148206.entry.js → p-e3bca405.entry.js} +1 -1
  159. package/dist/zonos-elements/{p-a376a37f.entry.js → p-e58cc024.entry.js} +1 -1
  160. package/dist/zonos-elements/{p-938803f4.entry.js → p-e6556b0d.entry.js} +1 -1
  161. package/dist/zonos-elements/{p-d2217f09.system.js → p-ed074fbf.system.js} +1 -1
  162. package/dist/zonos-elements/{p-560aa686.system.entry.js → p-f1e9b431.system.entry.js} +1 -1
  163. package/dist/zonos-elements/{p-4a15c5c7.system.entry.js → p-fbc09dae.system.entry.js} +1 -1
  164. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  165. package/package.json +9 -6
  166. package/dist/types/types/online-store/OnlineStoreConfig.d.ts +0 -3
  167. package/dist/zonos-elements/p-06fb9d1f.system.entry.js +0 -1
  168. package/dist/zonos-elements/p-19942abb.system.entry.js +0 -1
  169. package/dist/zonos-elements/p-494c77a7.entry.js +0 -1
  170. package/dist/zonos-elements/p-8c48b75e.system.js +0 -1
  171. package/dist/zonos-elements/p-a3a8b5e7.entry.js +0 -1
  172. package/dist/zonos-elements/p-afe26069.entry.js +0 -1
  173. package/dist/zonos-elements/p-e9b832c5.entry.js +0 -1
  174. package/dist/zonos-elements/p-ff95f098.js +0 -1
  175. /package/dist/collection/types/{online-store/OnlineStoreConfig.js → LogErrorRequestBody.js} +0 -0
@@ -80,10 +80,21 @@ export const formattedUrl = ({ branchName, inCI: _inCI, inVercel: _inVercel, isV
80
80
  }
81
81
  const version = type === 'major' ? `${_packageVersion === null || _packageVersion === void 0 ? void 0 : _packageVersion.split('.')[0]}` : _packageVersion;
82
82
  const isVersionedUrl = domainOnlyUrl === null || domainOnlyUrl === void 0 ? void 0 : domainOnlyUrl.startsWith('v');
83
+ const shouldAddVersion = (isProdBranch || _inCI) && !isVersionedUrl;
84
+ /**
85
+ * Trimming the `qa` from the domain url only when we add version prefix
86
+ * @reason We've now introduced alpha versioning for the QA branch deployment.
87
+ * However, we've generated the domain as `v1.2.4-alpha.1.js.zonos.com`, while the
88
+ * current CDN URL env uses `qa.js.zonos.com` on qa branch. This discrepancy causes
89
+ * this function to return an invalid alpha domain (v1.2.4-alpha.1.qa.js.zonos.com).
90
+ */
91
+ const trimmedQaUrl = shouldAddVersion
92
+ ? domainOnlyUrl === null || domainOnlyUrl === void 0 ? void 0 : domainOnlyUrl.replace('qa.js.zonos.com', 'js.zonos.com')
93
+ : domainOnlyUrl;
83
94
  // only set version for the url once
84
- return (isProdBranch || _inCI) && !isVersionedUrl
85
- ? `https://v${version}.${domainOnlyUrl}`
86
- : `https://${domainOnlyUrl}`;
95
+ return shouldAddVersion
96
+ ? `https://v${version}.${trimmedQaUrl}`
97
+ : `https://${trimmedQaUrl}`;
87
98
  };
88
99
  if (typeof window === 'undefined') {
89
100
  // storybook can't access to any "node" modules
@@ -51,7 +51,7 @@ Zonos.version = `v${process.env.NEXT_PUBLIC_ZONOS_PACKAGE_VERSION}`;
51
51
  Zonos.modeAlerted = false;
52
52
  Zonos.getCurrentTimestamp = () => new Date().getTime();
53
53
  Zonos.zonosController = null;
54
- Zonos.init = async ({ appearance, checkoutSettings, currencyConverter, helloSettings, zonosApiKey, }) => {
54
+ Zonos.init = async ({ appearance, checkoutSettings, currencyConverter, helloSettings, storeId, zonosApiKey, }) => {
55
55
  if (_a.doneInit) {
56
56
  // do nothing if zonos is already initializeds
57
57
  return;
@@ -62,6 +62,7 @@ Zonos.init = async ({ appearance, checkoutSettings, currencyConverter, helloSett
62
62
  return;
63
63
  }
64
64
  _a.zonosApiKey = zonosApiKey;
65
+ _a.storeId = storeId;
65
66
  log('init zonos');
66
67
  // add sentry to the project
67
68
  _a.injectSentryScript();
@@ -93,6 +94,10 @@ Zonos.showNotification = (notification) => {
93
94
  var _b;
94
95
  void ((_b = _a.zonosController) === null || _b === void 0 ? void 0 : _b.showNotification(notification));
95
96
  };
97
+ Zonos.updateOrganizationName = (organizationName) => {
98
+ var _b;
99
+ void ((_b = _a.zonosController) === null || _b === void 0 ? void 0 : _b.updateOrganizationName(organizationName));
100
+ };
96
101
  Zonos.disablePlaceOrderButtons = ({ autoEnable = true, disable, placeOrderButtonSelector, }) => {
97
102
  // if placeOrderAnchor is passed in the config for checkoutSettings, disable the place order button until zonos is initialized
98
103
  if (placeOrderButtonSelector) {
@@ -106,6 +111,11 @@ Zonos.disablePlaceOrderButtons = ({ autoEnable = true, disable, placeOrderButton
106
111
  }
107
112
  };
108
113
  placeOrderButton.forEach(button => {
114
+ const isEventAttached = button.getAttribute('data-zonos-checkout-attached');
115
+ if (isEventAttached) {
116
+ // do nothing if event is already attached
117
+ return;
118
+ }
109
119
  if (disable) {
110
120
  button.setAttribute('disabled', 'true');
111
121
  // prevent the selector to perform default action when it's disabled
@@ -142,6 +152,17 @@ Zonos.injectController = ({ config, zonosApiKey, }) => {
142
152
  disable: true,
143
153
  placeOrderButtonSelector,
144
154
  });
155
+ // create a mutation observer to see if any new elements that match our selector is added to the DOM
156
+ const observer = new MutationObserver(() => {
157
+ _a.disablePlaceOrderButtons({
158
+ disable: true,
159
+ placeOrderButtonSelector,
160
+ });
161
+ });
162
+ observer.observe(document.body, {
163
+ childList: true,
164
+ subtree: true,
165
+ });
145
166
  }
146
167
  const zonosController = document.createElement('zonos-controller');
147
168
  zonosController.config = config;
@@ -188,24 +209,7 @@ Zonos.injectSentryScript = () => {
188
209
  script.onload = () => {
189
210
  var _b;
190
211
  (_b = window.Sentry) === null || _b === void 0 ? void 0 : _b.init({
191
- denyUrls: [
192
- // Facebook flakiness
193
- /graph\.facebook\.com/i,
194
- // Facebook blocked
195
- /connect\.facebook\.net\/en_US\/all\.js/i,
196
- // Woopra flakiness
197
- /eatdifferent\.com\.woopra-ns\.com/i,
198
- /static\.woopra\.com\/js\/woopra\.js/i,
199
- // Chrome extensions
200
- /extensions\//i,
201
- /^chrome:\/\//i,
202
- /^chrome-extension:\/\//i,
203
- // Other plugins
204
- /webappstoolbarba\.texthelp\.com\//i,
205
- /metrics\.itunes\.apple\.com\.edgesuite\.net\//i,
206
- /dev.elements.zonos.com/i,
207
- /js.zonos.com/,
208
- ],
212
+ allowUrls: [/js.zonos.com/],
209
213
  dsn: 'https://19168bd05af0e2e0e7520ad58953e4f2@o446983.ingest.sentry.io/4506400622837760',
210
214
  release: `zonos-elements@${_a.version}`,
211
215
  });
@@ -17,6 +17,10 @@ export const addressResult = {
17
17
  Unavailable: 'UNAVAILABLE',
18
18
  Valid: 'VALID',
19
19
  };
20
+ export const alcoholRecipientType = {
21
+ Consumer: 'CONSUMER',
22
+ Licensee: 'LICENSEE',
23
+ };
20
24
  export const analyticsProviderStatus = {
21
25
  Disabled: 'DISABLED',
22
26
  Enabled: 'ENABLED',
@@ -29,6 +33,15 @@ export const bankAccountType = {
29
33
  Checking: 'CHECKING',
30
34
  Savings: 'SAVINGS',
31
35
  };
36
+ export const batteryMaterialType = {
37
+ LithiumIon: 'LITHIUM_ION',
38
+ LithiumMetal: 'LITHIUM_METAL',
39
+ };
40
+ export const batteryPackingType = {
41
+ BatteryInsideEquipment: 'BATTERY_INSIDE_EQUIPMENT',
42
+ BatteryOnly: 'BATTERY_ONLY',
43
+ BatteryPackagedWithEquipment: 'BATTERY_PACKAGED_WITH_EQUIPMENT',
44
+ };
32
45
  export const billingOptionCode = {
33
46
  DdpAndDdu: 'DDP_AND_DDU',
34
47
  ShipperOnly: 'SHIPPER_ONLY',
@@ -51,10 +64,18 @@ export const carrierAccountApiUsage = {
51
64
  Label: 'LABEL',
52
65
  Rating: 'RATING',
53
66
  };
67
+ export const carrierAccountIntegrationType = {
68
+ Rest: 'REST',
69
+ Soap: 'SOAP',
70
+ };
54
71
  export const carrierAccountRateType = {
55
72
  Negotiated: 'NEGOTIATED',
56
73
  Retail: 'RETAIL',
57
74
  };
75
+ export const carrierAccountRegistrationType = {
76
+ Other: 'OTHER',
77
+ Zonos: 'ZONOS',
78
+ };
58
79
  export const carrierAccountUsageCategoryCode = {
59
80
  Shipping: 'SHIPPING',
60
81
  };
@@ -917,6 +938,12 @@ export const deMinimisType = {
917
938
  Fee: 'FEE',
918
939
  Tax: 'TAX',
919
940
  };
941
+ export const deleteJobStatus = {
942
+ Completed: 'COMPLETED',
943
+ Error: 'ERROR',
944
+ Initialized: 'INITIALIZED',
945
+ Processing: 'PROCESSING',
946
+ };
920
947
  export const deliveryType = {
921
948
  Consolidated: 'CONSOLIDATED',
922
949
  Courier: 'COURIER',
@@ -1024,6 +1051,12 @@ export const exchangeRateType = {
1024
1051
  Guaranteed: 'GUARANTEED',
1025
1052
  MidMarket: 'MID_MARKET',
1026
1053
  };
1054
+ export const exportJobStatus = {
1055
+ Completed: 'COMPLETED',
1056
+ Error: 'ERROR',
1057
+ Initialized: 'INITIALIZED',
1058
+ Processing: 'PROCESSING',
1059
+ };
1027
1060
  export const externalServiceTokenType = {
1028
1061
  StripePublishableToken: 'STRIPE_PUBLISHABLE_TOKEN',
1029
1062
  };
@@ -1244,6 +1277,12 @@ export const landedCostAdjustmentType = {
1244
1277
  Item: 'ITEM',
1245
1278
  Shipping: 'SHIPPING',
1246
1279
  };
1280
+ export const landedCostBillingPartyType = {
1281
+ Customer: 'CUSTOMER',
1282
+ Merchant: 'MERCHANT',
1283
+ ThirdParty: 'THIRD_PARTY',
1284
+ Zonos: 'ZONOS',
1285
+ };
1247
1286
  export const landedCostCalculationMethod = {
1248
1287
  Dap: 'DAP',
1249
1288
  Ddp: 'DDP',
@@ -1271,6 +1310,7 @@ export const landedCostFeeType = {
1271
1310
  Item: 'ITEM',
1272
1311
  Other: 'OTHER',
1273
1312
  Shipping: 'SHIPPING',
1313
+ Tax: 'TAX',
1274
1314
  ZonosLandedCostGuarantee: 'ZONOS_LANDED_COST_GUARANTEE',
1275
1315
  };
1276
1316
  export const landedCostGuaranteeCode = {
@@ -1586,6 +1626,7 @@ export const shipmentAmountType = {
1586
1626
  };
1587
1627
  export const shipmentCartonSpecialService = {
1588
1628
  Alcohol: 'ALCOHOL',
1629
+ Battery: 'BATTERY',
1589
1630
  BatteryInsideEquipment: 'BATTERY_INSIDE_EQUIPMENT',
1590
1631
  BatteryOnly: 'BATTERY_ONLY',
1591
1632
  BatteryPackagedWithEquipment: 'BATTERY_PACKAGED_WITH_EQUIPMENT',
@@ -1612,6 +1653,10 @@ export const shipmentStatusType = {
1612
1653
  Created: 'CREATED',
1613
1654
  Voided: 'VOIDED',
1614
1655
  };
1656
+ export const shipmentType = {
1657
+ Domestic: 'DOMESTIC',
1658
+ International: 'INTERNATIONAL',
1659
+ };
1615
1660
  export const shippingPaymentType = {
1616
1661
  Sender: 'SENDER',
1617
1662
  ThirdParty: 'THIRD_PARTY',
@@ -1620,6 +1665,13 @@ export const shippingRateCalculation = {
1620
1665
  Fixed: 'FIXED',
1621
1666
  PerUnit: 'PER_UNIT',
1622
1667
  };
1668
+ export const signatureOptionType = {
1669
+ Adult: 'ADULT',
1670
+ Default: 'DEFAULT',
1671
+ Direct: 'DIRECT',
1672
+ Indirect: 'INDIRECT',
1673
+ None: 'NONE',
1674
+ };
1623
1675
  export const stripeActiveStatus = {
1624
1676
  Active: 'ACTIVE',
1625
1677
  Inactive: 'INACTIVE',
@@ -1758,9 +1810,19 @@ export const wcoVersion = {
1758
1810
  Wco_1997: 'WCO_1997',
1759
1811
  Wco_2002: 'WCO_2002',
1760
1812
  Wco_2007: 'WCO_2007',
1813
+ Wco_2012: 'WCO_2012',
1761
1814
  Wco_2017: 'WCO_2017',
1762
1815
  Wco_2022: 'WCO_2022',
1763
1816
  Wco_2027: 'WCO_2027',
1817
+ Wco_2032: 'WCO_2032',
1818
+ Wco_2037: 'WCO_2037',
1819
+ Wco_2042: 'WCO_2042',
1820
+ Wco_2047: 'WCO_2047',
1821
+ Wco_2052: 'WCO_2052',
1822
+ Wco_2057: 'WCO_2057',
1823
+ Wco_2062: 'WCO_2062',
1824
+ Wco_2067: 'WCO_2067',
1825
+ Wco_2072: 'WCO_2072',
1764
1826
  };
1765
1827
  export const weightUnitCode = {
1766
1828
  Gram: 'GRAM',
@@ -1818,5 +1880,8 @@ export function getSdk(client, withWrapper = defaultWrapper) {
1818
1880
  ZonosSettings(variables, requestHeaders) {
1819
1881
  return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'ZonosSettings', 'query');
1820
1882
  },
1883
+ getCheckoutPlaceOrderButtonSelector(variables, requestHeaders) {
1884
+ return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'getCheckoutPlaceOrderButtonSelector', 'query');
1885
+ },
1821
1886
  };
1822
1887
  }
@@ -459,11 +459,20 @@ export function getSdk(client, withWrapper = defaultWrapper) {
459
459
  LocaleCountryMessages(variables, requestHeaders) {
460
460
  return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'LocaleCountryMessages', 'query');
461
461
  },
462
+ UpdateCacheStoreVersion(variables, requestHeaders) {
463
+ return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'UpdateCacheStoreVersion', 'mutation');
464
+ },
462
465
  UpdateReserveOrder(variables, requestHeaders) {
463
466
  return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'UpdateReserveOrder', 'mutation');
464
467
  },
465
468
  UpsertBigCommerceSettings(variables, requestHeaders) {
466
469
  return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'UpsertBigCommerceSettings', 'mutation');
467
470
  },
471
+ cleanupTestZonosElementSetting(variables, requestHeaders) {
472
+ return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'cleanupTestZonosElementSetting', 'mutation');
473
+ },
474
+ zonosElementsSetting(variables, requestHeaders) {
475
+ return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'zonosElementsSetting', 'query');
476
+ },
468
477
  };
469
478
  }
@@ -3180,7 +3180,7 @@ const handleFetch = async (url, _opts) => {
3180
3180
  const opts = __rest(_opts || {}, []);
3181
3181
  const body = opts.body ? JSON.stringify(opts.body) : undefined;
3182
3182
  const method = opts.method || 'GET';
3183
- // adding credentialtoken to the url so that the request will be cached differently for each store
3183
+ // adding random encoded token to the url so that the request will be cached differently for each store
3184
3184
  const modifiedUrl = new URL(url);
3185
3185
  modifiedUrl.searchParams.set('zToken', encodeString(window.location.hostname));
3186
3186
  // headers content type
@@ -1,6 +1,7 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h, Host, Fragment } from '@stencil/core/internal/client';
2
2
  import { s as stripeStore, p as stripeStoreRetrievePayment, o as stripeStoreReset, c as cartStore } from './cart.js';
3
- import { h as handleFetch, l as logError, t as translate } from './localization.js';
3
+ import { h as handleFetch, t as translate } from './localization.js';
4
+ import { z as zonosStore } from './zonosStore.js';
4
5
  import { g as getBorderRadius } from './getBorderRadius.js';
5
6
  import { s as submitGtag } from './submitGtag.js';
6
7
  import { d as defineCustomElement$4 } from './zonos-button2.js';
@@ -28,27 +29,55 @@ const ZonosCheckoutFinish = /*@__PURE__*/ proxyCustomElement(class ZonosCheckout
28
29
  if (errors.length || !(json === null || json === void 0 ? void 0 : json.id)) {
29
30
  return null;
30
31
  }
31
- // TODO: This method of triggering /success for BigCommerce is for MVP. Remove when eventRegistry is fixed to handle by webhooks
32
- if (window.Zonos.isBigCommerce) {
33
- const orderId = json === null || json === void 0 ? void 0 : json.id;
34
- const storeHash = (_b = (_a = json === null || json === void 0 ? void 0 : json.metadata) === null || _a === void 0 ? void 0 : _a.find(x => (x === null || x === void 0 ? void 0 : x.key) === 'storeHash')) === null || _b === void 0 ? void 0 : _b.value;
35
- if (!orderId || !storeHash) {
36
- return logError('Unable to trigger BigCommerce /success: Missing orderId or storeHash');
37
- }
38
- void handleFetch(`${baseUrl}/api/bigcommerce/success?orderId=${orderId}&storeHash=${storeHash}`);
39
- }
32
+ // onOrderSuccess callback may be provided on Zonos.init
33
+ await ((_b = (_a = zonosStore.checkoutSettings).onOrderSuccess) === null || _b === void 0 ? void 0 : _b.call(_a, json));
40
34
  return json;
41
35
  };
36
+ this.handleSuccessBehavior = (orderId) => {
37
+ const { successBehavior } = zonosStore.checkoutSettings;
38
+ switch (successBehavior) {
39
+ case 'REDIRECT_TO_SUCCESS_PAGE':
40
+ const redirectUrl = zonosStore.checkoutSettings.successRedirectUrl;
41
+ if (redirectUrl) {
42
+ window.location.href = `${redirectUrl}?zOrderNumber=${orderId}`;
43
+ }
44
+ // If no redirect URL, break and display Zonos success page
45
+ break;
46
+ case 'CLOSE_MODAL':
47
+ this.closeClickHandler();
48
+ break;
49
+ }
50
+ };
51
+ // TODO: This method of pulling orders is temporary. Once we have a working event registry system, we will rely on that to tell us when the order is ready to trigger onOrderSuccess
42
52
  this.getPullOrder = async (attempts = 0) => {
43
53
  const order = await this.pullOrder();
44
54
  if (order) {
45
55
  this.order = order;
56
+ this.handleSuccessBehavior(order.id);
57
+ this.isLoading = false;
46
58
  }
47
59
  else if (!order && attempts < 5) {
48
60
  // Wait for 1 second before the next attempt
49
61
  await new Promise(resolve => setTimeout(resolve, 1000));
50
62
  await this.getPullOrder(attempts + 1);
51
63
  }
64
+ else {
65
+ // Set loading to false to display generic success page and log error
66
+ this.isLoading = false;
67
+ const errorObject = {
68
+ endpoint: `${"https://v1.route.js.zonos.com"}/api/zonos-elements/get-order`,
69
+ errors: ['Order not found after multiple attempts'],
70
+ metadata: {
71
+ checkoutSessionId: cartStore.checkoutSessionId || '',
72
+ domain: window.location.hostname,
73
+ storeId: zonosStore.storeId,
74
+ },
75
+ };
76
+ void handleFetch(`${"https://v1.route.js.zonos.com"}/api/zonos-elements/log-error`, {
77
+ body: errorObject,
78
+ method: 'POST',
79
+ });
80
+ }
52
81
  };
53
82
  this.checkPaymentStatus = async () => {
54
83
  this.isLoading = true;
@@ -77,6 +106,7 @@ const ZonosCheckoutFinish = /*@__PURE__*/ proxyCustomElement(class ZonosCheckout
77
106
  }
78
107
  // Attempt to pull the order details from the graph every second on 5 attempts
79
108
  if (this.notificationType === 'success') {
109
+ this.isLoading = true;
80
110
  void this.getPullOrder();
81
111
  }
82
112
  }
@@ -177,6 +177,7 @@ const ZonosCheckout$1 = /*@__PURE__*/ proxyCustomElement(class ZonosCheckout ext
177
177
  });
178
178
  }
179
179
  });
180
+ button.removeAttribute('disabled');
180
181
  button.setAttribute('data-zonos-checkout-attached', 'true');
181
182
  });
182
183
  }
@@ -240,10 +241,14 @@ const ZonosCheckout$1 = /*@__PURE__*/ proxyCustomElement(class ZonosCheckout ext
240
241
  }
241
242
  else {
242
243
  this.attachCheckout();
243
- // keep checking for checkout selector every 50ms just in case the selector is not loaded in the DOM yet
244
- setInterval(() => {
244
+ // create a mutation observer to see if any new elements that match our selector is added to the DOM
245
+ const observer = new MutationObserver(() => {
245
246
  this.attachCheckout();
246
- }, 50);
247
+ });
248
+ observer.observe(document.body, {
249
+ childList: true,
250
+ subtree: true,
251
+ });
247
252
  }
248
253
  clearInterval(interval);
249
254
  }, 50);
@@ -5,11 +5,11 @@ import { z as zonosStore, e as zonosStoreInitSetting, d as zonosStoreFontFamily
5
5
  import { d as defineCustomElement$3 } from './zonos-notification2.js';
6
6
  import { d as defineCustomElement$2 } from './zonos-text2.js';
7
7
 
8
- const getZonosSetting = async () => {
8
+ const getZonosSettings = async () => {
9
9
  const url = `${"https://v1.route.js.zonos.com"}/api/zonos-elements/zonos-settings`;
10
10
  const { errors, json } = await handleFetch(url);
11
11
  if (errors.length) {
12
- logError(`Error occurs when getting zonos settings. If this is not an unauthorized error, it will use user setting or default setting`);
12
+ logError(`Error occurred when getting zonos settings. If this is not an unauthorized error, it will use user settings or default settings`);
13
13
  return { errors, json: null };
14
14
  }
15
15
  return { errors: [], json };
@@ -64,44 +64,6 @@ const ZonosController$1 = /*@__PURE__*/ proxyCustomElement(class ZonosController
64
64
  this.__registerHost();
65
65
  this.__attachShadow();
66
66
  this.stripeInitEvent = createEvent(this, "stripeInitEvent", 7);
67
- this.disablePlaceOrderButtons = ({ disable }) => {
68
- const placeOrderButtonSelector = zonosStore.checkoutSettings.placeOrderButtonSelector;
69
- if (!placeOrderButtonSelector) {
70
- return;
71
- }
72
- const disableEvent = (e) => {
73
- const target = e.target;
74
- // prevent default and propagation when the item has disabled attribute
75
- if (target.getAttribute('disabled')) {
76
- e.preventDefault();
77
- e.stopPropagation();
78
- }
79
- };
80
- const placeOrderButton = document.querySelectorAll(placeOrderButtonSelector);
81
- placeOrderButton.forEach(button => {
82
- if (disable) {
83
- button.setAttribute('disabled', 'true');
84
- // prevent the selector to perform default action when it's disabled
85
- button.addEventListener('click', disableEvent);
86
- }
87
- else {
88
- button.removeAttribute('disabled');
89
- // clean up the event listener
90
- button.removeEventListener('click', disableEvent);
91
- }
92
- });
93
- // only auto enable if autoEnable is true and the state is enable
94
- if (disable) {
95
- setTimeout(() => {
96
- // release it if zonos is not initialized after 5 seconds (this is to prevent the place order button from being disabled forever due to api)
97
- placeOrderButton.forEach(button => {
98
- button.removeAttribute('disabled');
99
- // clean up the event listener if exists
100
- button.removeEventListener('click', disableEvent);
101
- });
102
- }, 5000);
103
- }
104
- };
105
67
  this.config = undefined;
106
68
  this.zonosApiKey = undefined;
107
69
  }
@@ -117,10 +79,6 @@ const ZonosController$1 = /*@__PURE__*/ proxyCustomElement(class ZonosController
117
79
  stripeStore.stripe = stripe;
118
80
  void initCheckout(zonosStore.checkoutSettings);
119
81
  log('init checkout element');
120
- // enable place order button after checkout is loaded
121
- this.disablePlaceOrderButtons({
122
- disable: false,
123
- });
124
82
  }
125
83
  /**
126
84
  * Init zonos notification
@@ -168,15 +126,11 @@ const ZonosController$1 = /*@__PURE__*/ proxyCustomElement(class ZonosController
168
126
  // running with scope async function to avoid blocking the main thread
169
127
  (async () => {
170
128
  var _a, _b;
171
- const { errors, json } = await getZonosSetting();
129
+ const { errors, json } = await getZonosSettings();
172
130
  if (((_a = errors[0]) === null || _a === void 0 ? void 0 : _a.type.toString()) === '403') {
173
131
  log('Failed to load zonos settings. This domain may not have access', 'warn');
174
132
  return;
175
133
  }
176
- // disable place order button until checkout is loaded
177
- this.disablePlaceOrderButtons({
178
- disable: true,
179
- });
180
134
  // init zonos notification
181
135
  this.initZonosNotification();
182
136
  // load default setting if fail to load user setting
@@ -247,6 +201,12 @@ const ZonosController$1 = /*@__PURE__*/ proxyCustomElement(class ZonosController
247
201
  async getAppearanceSetting() {
248
202
  return zonosStore.appearance;
249
203
  }
204
+ /**
205
+ * Update the organizationName
206
+ */
207
+ async updateOrganizationName(organizationName) {
208
+ zonosStore.organizationName = organizationName;
209
+ }
250
210
  render() {
251
211
  return h(Host, { class: "zonos--elements" });
252
212
  }
@@ -259,7 +219,8 @@ const ZonosController$1 = /*@__PURE__*/ proxyCustomElement(class ZonosController
259
219
  "showNotification": [64],
260
220
  "overrideConfig": [64],
261
221
  "overrideCountry": [64],
262
- "getAppearanceSetting": [64]
222
+ "getAppearanceSetting": [64],
223
+ "updateOrganizationName": [64]
263
224
  }]);
264
225
  function defineCustomElement$1() {
265
226
  if (typeof customElements === "undefined") {
@@ -8,7 +8,7 @@ import { d as defineCustomElement$1 } from './zonos-spinner2.js';
8
8
 
9
9
  const RemoveIcon = `<svg xmlns="https://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path fill="#C5C6CA" fill-rule="evenodd" d="M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Z" clip-rule="evenodd"/><path fill="#4D505A" fill-rule="evenodd" d="M8.293 8.293a1 1 0 0 1 1.414 0L12 10.586l2.293-2.293a1 1 0 1 1 1.414 1.414L13.414 12l2.293 2.293a1 1 0 0 1-1.414 1.414L12 13.414l-2.293 2.293a1 1 0 0 1-1.414-1.414L10.586 12 8.293 9.707a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"/></svg>`;
10
10
 
11
- const zonosDialogCss = ":host{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host .zonos--backdrop,:host .zonos--dialog-layout{opacity:0;z-index:-999;visibility:hidden;-webkit-transition:0.3s all ease;transition:0.3s all ease}:host .zonos--backdrop{width:100vw;height:100vh;left:0px;top:0px;background:var(--amino-backdrop-color);z-index:-999;opacity:0;visibility:hidden;position:fixed}:host .zonos--loading{position:absolute;left:0;right:0;bottom:0;top:0;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;z-index:1002;background:white}:host .zonos--dialog-layout{width:100vw;height:100vh;left:0;top:0;position:fixed;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;color:var(--amino-text-color);visibility:hidden}:host .zonos--dialog{position:relative;z-index:1001;background:var(--amino-gray-0);max-width:90vw;max-height:90vh;min-height:500px;height:var(--height, auto);width:var(--width, auto);border-radius:var(--border-radius, var(--amino-radius-10));outline:none;-webkit-box-shadow:var(--amino-v3-shadow-xxl);box-shadow:var(--amino-v3-shadow-xxl);border:var(--amino-border);overflow:hidden;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}:host .zonos--header{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;-ms-flex-pack:justify;justify-content:space-between;padding:var(--amino-space-16) var(--amino-space-24)}:host .zonos--header .-zonos-stencil-library--header-text{-ms-flex-positive:1;flex-grow:1}:host .zonos--header .zonos--close-button{width:var(--amino-size-md);height:var(--amino-size-md);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;cursor:pointer;border-radius:var(--amino-radius-10)}:host .zonos--header .zonos--close-button:hover{background:var(--amino-hover-color)}:host .zonos--body{padding:var(--amino-space-8) var(--amino-space-24);max-height:100%;height:100%;overflow:auto}:host .zonos--body.zonos--no-body-padding{padding:0}:host .zonos--footer{padding:var(--amino-space-16) var(--amino-space-24)}:host(.open) .zonos--dialog-layout,:host(.open) .zonos--backdrop{visibility:visible}:host(.open) .zonos--backdrop{z-index:1001;opacity:0.65}:host(.open) .zonos--dialog-layout{opacity:1;z-index:1002;-webkit-transform:scale(1);transform:scale(1)}:host(.no-border) .zonos--dialog{border:none}:host(.mobile) .zonos--dialog{max-width:100vw;max-height:100vh;height:100%;width:100%;border-radius:0;-webkit-box-shadow:none;box-shadow:none;border:none}";
11
+ const zonosDialogCss = ":host{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host .zonos--backdrop,:host .zonos--dialog-layout{opacity:0;z-index:-999;visibility:hidden;-webkit-transition:0.3s all ease;transition:0.3s all ease}:host .zonos--backdrop{width:100vw;height:100vh;left:0px;top:0px;background:var(--amino-backdrop-color);z-index:-999;opacity:0;visibility:hidden;position:fixed}:host .zonos--loading{position:absolute;left:0;right:0;bottom:0;top:0;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;z-index:10002;background:white}:host .zonos--dialog-layout{width:100vw;height:100vh;left:0;top:0;position:fixed;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;color:var(--amino-text-color);visibility:hidden}:host .zonos--dialog{position:relative;z-index:10001;background:var(--amino-gray-0);max-width:90vw;max-height:90vh;min-height:500px;height:var(--height, auto);width:var(--width, auto);border-radius:var(--border-radius, var(--amino-radius-10));outline:none;-webkit-box-shadow:var(--amino-v3-shadow-xxl);box-shadow:var(--amino-v3-shadow-xxl);border:var(--amino-border);overflow:hidden;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}:host .zonos--header{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;-ms-flex-pack:justify;justify-content:space-between;padding:var(--amino-space-16) var(--amino-space-24)}:host .zonos--header .-zonos-stencil-library--header-text{-ms-flex-positive:1;flex-grow:1}:host .zonos--header .zonos--close-button{width:var(--amino-size-md);height:var(--amino-size-md);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;cursor:pointer;border-radius:var(--amino-radius-10)}:host .zonos--header .zonos--close-button:hover{background:var(--amino-hover-color)}:host .zonos--body{padding:var(--amino-space-8) var(--amino-space-24);max-height:100%;height:100%;overflow:auto}:host .zonos--body.zonos--no-body-padding{padding:0}:host .zonos--footer{padding:var(--amino-space-16) var(--amino-space-24)}:host(.open) .zonos--dialog-layout,:host(.open) .zonos--backdrop{visibility:visible}:host(.open) .zonos--backdrop{z-index:10001;opacity:0.65}:host(.open) .zonos--dialog-layout{opacity:1;z-index:10002;-webkit-transform:scale(1);transform:scale(1)}:host(.no-border) .zonos--dialog{border:none}:host(.mobile) .zonos--dialog{max-width:100vw;max-height:100vh;height:100%;width:100%;border-radius:0;-webkit-box-shadow:none;box-shadow:none;border:none}";
12
12
 
13
13
  const ZonosDialog = /*@__PURE__*/ proxyCustomElement(class ZonosDialog extends HTMLElement {
14
14
  constructor() {
@@ -468,7 +468,7 @@ const ZonosHello$1 = /*@__PURE__*/ proxyCustomElement(class ZonosHello extends H
468
468
  super();
469
469
  this.__registerHost();
470
470
  this.__attachShadow();
471
- this.getHelloPeekMessage = () => {
471
+ this.getHelloPeekMessage = (organizationName) => {
472
472
  const isRestrictionPage = zonosStore.currentHelloPage === 'productDetail' ||
473
473
  zonosStore.currentHelloPage === 'productList';
474
474
  if (isRestrictionPage && this.allRestrictedItems.length) {
@@ -485,7 +485,7 @@ const ZonosHello$1 = /*@__PURE__*/ proxyCustomElement(class ZonosHello extends H
485
485
  case 'productDetail':
486
486
  return translate(`See duty and tax thresholds`);
487
487
  default:
488
- return `${translate('Welcome to')} ${zonosStore.organizationName}`;
488
+ return `${translate('Welcome to')} ${organizationName}`;
489
489
  }
490
490
  };
491
491
  this.enableShowPeekMessage = () => {
@@ -505,7 +505,7 @@ const ZonosHello$1 = /*@__PURE__*/ proxyCustomElement(class ZonosHello extends H
505
505
  return newRestrictions;
506
506
  };
507
507
  this.triggerShowPeekMessage = () => {
508
- this.peekMessage = this.getHelloPeekMessage();
508
+ this.peekMessage = this.getHelloPeekMessage(zonosStore.organizationName);
509
509
  const { peekMessageBehavior, peekMessageDelay } = zonosStore.helloSettings;
510
510
  // peek message delay is passed in seconds, but setTimeout expects milliseconds
511
511
  const peekMessageDelayToUse = peekMessageDelay * 1000;
@@ -701,6 +701,9 @@ const ZonosHello$1 = /*@__PURE__*/ proxyCustomElement(class ZonosHello extends H
701
701
  const appearanceSettings = mergeConfig(zonosStore.appearance, this.appearanceSettingsOverride);
702
702
  const { theme } = appearanceSettings;
703
703
  const restrictedItemsOnPage = (_b = this.allRestrictedItems) === null || _b === void 0 ? void 0 : _b.filter(product => this.productsOnPage.some(restriction => restriction.description === product.itemDescription));
704
+ // The organization name can be changed after init with the updateOrganizationName method.
705
+ // This will cause the element to rerender with the new org name when it changes. (used for preview on dashboard)
706
+ this.peekMessage = this.getHelloPeekMessage(zonosStore.organizationName);
704
707
  const showHello = this.isShippableCountry() && !!selectedCountryCode;
705
708
  return (h(Host, { class: "zonos--hello zonos--elements", "data-theme": theme }, showHello && (h("div", { class: "zonos--hello-wrapper" }, h("button", { class: classes([
706
709
  'zonos--hello-widget',
@@ -2527,7 +2527,6 @@ const { reset, state: zonosStore } = createStore(() => ({
2527
2527
  zonosAttribution: 'DISABLED',
2528
2528
  },
2529
2529
  checkoutSettings: {
2530
- allowedDomains: [],
2531
2530
  analyticsProviders: [],
2532
2531
  orderNotifications: {
2533
2532
  abandonedCart: {
@@ -2561,7 +2560,6 @@ const { reset, state: zonosStore } = createStore(() => ({
2561
2560
  },
2562
2561
  currentHelloPage: '',
2563
2562
  helloSettings: {
2564
- allowedDomains: [],
2565
2563
  anchorElementSelector: '',
2566
2564
  cartUrlPattern: '',
2567
2565
  currencyBehavior: 'ENABLED',
@@ -2583,9 +2581,6 @@ const { reset, state: zonosStore } = createStore(() => ({
2583
2581
  restrictionBehavior: 'DISABLED',
2584
2582
  },
2585
2583
  loadedConfig: false,
2586
- onlineStoreSettings: {
2587
- allowedDomains: [],
2588
- },
2589
2584
  organizationName: '',
2590
2585
  sourceCurrency: 'USD',
2591
2586
  storeId: null,
@@ -2611,9 +2606,6 @@ const zonosStoreInitSetting = ({ overrideSettings, zonosSettings, }) => {
2611
2606
  (zonosSettings === null || zonosSettings === void 0 ? void 0 : zonosSettings.checkoutSettings) ||
2612
2607
  null, overrideSettings.checkoutSettings);
2613
2608
  zonosStore.helloSettings = mergeConfig(zonosStore.helloSettings, (savedZonosSettings === null || savedZonosSettings === void 0 ? void 0 : savedZonosSettings.helloSettings) || (zonosSettings === null || zonosSettings === void 0 ? void 0 : zonosSettings.helloSettings) || null, overrideSettings.helloSettings);
2614
- zonosStore.onlineStoreSettings = mergeConfig(zonosStore.onlineStoreSettings, (savedZonosSettings === null || savedZonosSettings === void 0 ? void 0 : savedZonosSettings.onlineStoreSettings) ||
2615
- (zonosSettings === null || zonosSettings === void 0 ? void 0 : zonosSettings.onlineStoreSettings) ||
2616
- null, overrideSettings.onlineStoreSettings);
2617
2609
  // set flag to true to indicate that config is ready
2618
2610
  zonosStore.loadedConfig = true;
2619
2611
  zonosStore.organizationName = ((_a = zonosSettings === null || zonosSettings === void 0 ? void 0 : zonosSettings.organization) === null || _a === void 0 ? void 0 : _a.name) || '';
@@ -1,7 +1,7 @@
1
- import { z as zonosStore, c as createStore } from './zonosStore-61e74f58.js';
2
- import { h as handleFetch, l as log, a as localizationStore, b as logError, t as translate } from './localization-a51ccbc2.js';
3
- import { i as isDarkColor } from './isDarkColor-416d6047.js';
4
- import { g as getBorderRadius } from './getBorderRadius-178a0a05.js';
1
+ import { z as zonosStore, c as createStore } from './zonosStore-34f07ee8.js';
2
+ import { h as handleFetch, l as log, a as localizationStore, b as logError, t as translate } from './localization-0c5b29fd.js';
3
+ import { i as isDarkColor } from './isDarkColor-69090b29.js';
4
+ import { g as getBorderRadius } from './getBorderRadius-77e97943.js';
5
5
 
6
6
  const prepCalculateLandedCost = () => {
7
7
  // maybe we don't need email now for prefetch the landed cost
@@ -1,4 +1,4 @@
1
- import { z as zonosStore } from './zonosStore-61e74f58.js';
1
+ import { z as zonosStore } from './zonosStore-34f07ee8.js';
2
2
 
3
3
  /**
4
4
  * Get the border radius for the elements based on the style
package/dist/esm/index.js CHANGED
@@ -1,6 +1,6 @@
1
- export { c as cartStore, a as cartStoreApplySubtotals, b as cartStoreGetShippingTransitInfo, d as cartStoreNextStep, e as cartStorePreviousStep, f as cartStoreReCalculateTotal, g as cartStoreReset, h as cartStoreUpdateItems, i as cartStoreUpdateSelectedShippingOption, j as cartStoreUpdateToErrorState } from './cart-b439be00.js';
2
- import './zonosStore-61e74f58.js';
1
+ export { c as cartStore, a as cartStoreApplySubtotals, b as cartStoreGetShippingTransitInfo, d as cartStoreNextStep, e as cartStorePreviousStep, f as cartStoreReCalculateTotal, g as cartStoreReset, h as cartStoreUpdateItems, i as cartStoreUpdateSelectedShippingOption, j as cartStoreUpdateToErrorState } from './cart-d81b92ea.js';
2
+ import './zonosStore-34f07ee8.js';
3
3
  import './index-36ff6342.js';
4
- import './localization-a51ccbc2.js';
5
- import './isDarkColor-416d6047.js';
6
- import './getBorderRadius-178a0a05.js';
4
+ import './localization-0c5b29fd.js';
5
+ import './isDarkColor-69090b29.js';
6
+ import './getBorderRadius-77e97943.js';
@@ -1,4 +1,4 @@
1
- import { a as createCommonjsModule, b as commonjsGlobal } from './zonosStore-61e74f58.js';
1
+ import { a as createCommonjsModule, b as commonjsGlobal } from './zonosStore-34f07ee8.js';
2
2
 
3
3
  var tinycolor = createCommonjsModule(function (module, exports) {
4
4
  // This file is autogenerated. It's used to publish CJS to npm.