@zonos/elements 1.3.214 → 1.3.216

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 (117) hide show
  1. package/dist/cjs/{cart-e0b62259.js → cart-96520eab.js} +51 -22
  2. package/dist/cjs/{handleFetch-7cf3752e.js → handleFetch-b821ed5d.js} +2 -2
  3. package/dist/cjs/index.cjs.js +8 -8
  4. package/dist/cjs/{localization-91bcde0e.js → localization-e241e025.js} +1 -1
  5. package/dist/cjs/{paypal-93e5de01.js → paypal-97ac0999.js} +3 -3
  6. package/dist/cjs/{updateCheckoutSessionAttributes-047bc0cb.js → updateCheckoutSessionAttributes-5f794550.js} +1 -1
  7. package/dist/cjs/zonos-address_11.cjs.entry.js +25 -16
  8. package/dist/cjs/zonos-cart-items_14.cjs.entry.js +27 -19
  9. package/dist/cjs/zonos-checkout.cjs.entry.js +5 -5
  10. package/dist/cjs/zonos-controller.cjs.entry.js +3 -3
  11. package/dist/cjs/zonos-country-flag.cjs.entry.js +2 -2
  12. package/dist/cjs/zonos-country-select_4.cjs.entry.js +25 -8
  13. package/dist/cjs/zonos-empty-state-payment_4.cjs.entry.js +4 -4
  14. package/dist/cjs/zonos-hello-dialog.cjs.entry.js +2 -2
  15. package/dist/cjs/zonos-hello.cjs.entry.js +2 -2
  16. package/dist/cjs/zonos-language-select_2.cjs.entry.js +2 -2
  17. package/dist/collection/components/checkout/zonos-checkout/zonos-address-update-dialog/zonos-address-form/zonos-address-form.js +8 -7
  18. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.js +6 -6
  19. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-footer/assets/zonosIconDark.svg +10 -0
  20. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-footer/assets/zonosIconLight.svg +10 -0
  21. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-footer/zonos-checkout-footer.js +3 -3
  22. package/dist/collection/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.js +6 -2
  23. package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog-footer/assets/zonosIconDark.svg +10 -0
  24. package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog-footer/assets/zonosIconLight.svg +10 -0
  25. package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog-footer/zonos-hello-dialog-footer.js +5 -3
  26. package/dist/collection/components/store/checkout/stripe.js +6 -2
  27. package/dist/collection/components/stripe/zonos-address/zonos-address.js +9 -2
  28. package/dist/collection/components/stripe/zonos-custom-address/zonos-custom-address.js +8 -4
  29. package/dist/collection/components/utils/api/prepCalculateLandedCost.js +13 -8
  30. package/dist/collection/components/utils/checkout/buildTranslateRequest.js +14 -10
  31. package/dist/collection/components/utils/extractName.js +17 -0
  32. package/dist/collection/components/utils/handleFetch.js +2 -2
  33. package/dist/esm/{cart-c3540cd7.js → cart-011aa510.js} +51 -23
  34. package/dist/esm/{handleFetch-dd74bbb1.js → handleFetch-bb221e63.js} +2 -2
  35. package/dist/esm/index.js +8 -8
  36. package/dist/esm/{localization-cf31c728.js → localization-b3bdf691.js} +1 -1
  37. package/dist/esm/{paypal-5963c1ab.js → paypal-8af04edf.js} +3 -3
  38. package/dist/esm/{updateCheckoutSessionAttributes-7babf0f2.js → updateCheckoutSessionAttributes-fa58ba66.js} +1 -1
  39. package/dist/esm/zonos-address_11.entry.js +25 -16
  40. package/dist/esm/zonos-cart-items_14.entry.js +27 -19
  41. package/dist/esm/zonos-checkout.entry.js +5 -5
  42. package/dist/esm/zonos-controller.entry.js +3 -3
  43. package/dist/esm/zonos-country-flag.entry.js +2 -2
  44. package/dist/esm/zonos-country-select_4.entry.js +25 -8
  45. package/dist/esm/zonos-empty-state-payment_4.entry.js +4 -4
  46. package/dist/esm/zonos-hello-dialog.entry.js +2 -2
  47. package/dist/esm/zonos-hello.entry.js +2 -2
  48. package/dist/esm/zonos-language-select_2.entry.js +2 -2
  49. package/dist/esm-es5/cart-011aa510.js +1 -0
  50. package/dist/esm-es5/{handleFetch-dd74bbb1.js → handleFetch-bb221e63.js} +1 -1
  51. package/dist/esm-es5/index.js +1 -1
  52. package/dist/esm-es5/{localization-cf31c728.js → localization-b3bdf691.js} +1 -1
  53. package/dist/esm-es5/{paypal-5963c1ab.js → paypal-8af04edf.js} +1 -1
  54. package/dist/esm-es5/{updateCheckoutSessionAttributes-7babf0f2.js → updateCheckoutSessionAttributes-fa58ba66.js} +1 -1
  55. package/dist/esm-es5/zonos-address_11.entry.js +1 -1
  56. package/dist/esm-es5/zonos-cart-items_14.entry.js +1 -1
  57. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  58. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  59. package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
  60. package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
  61. package/dist/esm-es5/zonos-empty-state-payment_4.entry.js +1 -1
  62. package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
  63. package/dist/esm-es5/zonos-hello.entry.js +1 -1
  64. package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
  65. package/dist/scripts/index.js +1 -1
  66. package/dist/scripts/loadZonos.js +1 -1
  67. package/dist/scripts/zonos.js +1 -1
  68. package/dist/types/components/utils/extractName.d.ts +14 -0
  69. package/dist/zonos-elements/index.esm.js +1 -1
  70. package/dist/zonos-elements/{p-c34645cb.js → p-0627d793.js} +1 -1
  71. package/dist/zonos-elements/{p-6c69c5fa.system.entry.js → p-24043e4f.system.entry.js} +1 -1
  72. package/dist/zonos-elements/{p-e72b61c1.system.entry.js → p-2fa8f2b8.system.entry.js} +1 -1
  73. package/dist/zonos-elements/{p-41ec9531.entry.js → p-3940f15d.entry.js} +1 -1
  74. package/dist/zonos-elements/p-48b2fbb7.entry.js +1 -0
  75. package/dist/zonos-elements/{p-ac784ab8.system.entry.js → p-4ec7abf7.system.entry.js} +1 -1
  76. package/dist/zonos-elements/{p-6e8354c1.system.entry.js → p-4f2994f9.system.entry.js} +1 -1
  77. package/dist/zonos-elements/p-547babdd.entry.js +1 -0
  78. package/dist/zonos-elements/{p-4444bb4e.system.js → p-54fd7799.system.js} +1 -1
  79. package/dist/zonos-elements/{p-755cf8bc.system.js → p-56a2d942.system.js} +1 -1
  80. package/dist/zonos-elements/{p-b22fcbda.system.entry.js → p-573b0565.system.entry.js} +1 -1
  81. package/dist/zonos-elements/{p-8d37bb03.entry.js → p-592cdd54.entry.js} +1 -1
  82. package/dist/zonos-elements/p-5a7130da.entry.js +1 -0
  83. package/dist/zonos-elements/p-62cb568d.system.entry.js +1 -0
  84. package/dist/zonos-elements/p-6cd4160d.system.js +1 -0
  85. package/dist/zonos-elements/{p-fb898c4f.system.js → p-801919e5.system.js} +1 -1
  86. package/dist/zonos-elements/p-8037d54c.entry.js +1 -0
  87. package/dist/zonos-elements/p-81b357f7.system.js +1 -1
  88. package/dist/zonos-elements/{p-1d0e40b7.entry.js → p-8cafb9a4.entry.js} +1 -1
  89. package/dist/zonos-elements/{p-a9b63cdb.system.js → p-9d717d8d.system.js} +1 -1
  90. package/dist/zonos-elements/{p-a1cd5572.system.entry.js → p-a3e6cf3e.system.entry.js} +1 -1
  91. package/dist/zonos-elements/{p-a45a15a0.js → p-b6dfa589.js} +1 -1
  92. package/dist/zonos-elements/{p-137ee43a.system.entry.js → p-c4b7b1a4.system.entry.js} +1 -1
  93. package/dist/zonos-elements/p-cd62465e.system.entry.js +1 -0
  94. package/dist/zonos-elements/{p-c8433f89.js → p-da079b20.js} +1 -1
  95. package/dist/zonos-elements/p-db07e61c.entry.js +1 -0
  96. package/dist/zonos-elements/{p-2eec2d7c.js → p-e4d475c3.js} +1 -1
  97. package/dist/zonos-elements/p-ef76be6f.system.js +1 -0
  98. package/dist/zonos-elements/p-f04bad33.system.entry.js +1 -0
  99. package/dist/zonos-elements/p-f08d180a.js +1 -0
  100. package/dist/zonos-elements/{p-752220fe.entry.js → p-f1ba6a31.entry.js} +1 -1
  101. package/dist/zonos-elements/{p-6a157c84.entry.js → p-f530cb04.entry.js} +1 -1
  102. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  103. package/package.json +1 -1
  104. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-footer/assets/zonosIcon.svg +0 -5
  105. package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog-footer/assets/zonosIcon.svg +0 -5
  106. package/dist/esm-es5/cart-c3540cd7.js +0 -1
  107. package/dist/zonos-elements/p-003f37f4.entry.js +0 -1
  108. package/dist/zonos-elements/p-0707379c.entry.js +0 -1
  109. package/dist/zonos-elements/p-0fd105fa.system.entry.js +0 -1
  110. package/dist/zonos-elements/p-236643d0.system.entry.js +0 -1
  111. package/dist/zonos-elements/p-2820aff2.system.js +0 -1
  112. package/dist/zonos-elements/p-299efbcf.system.entry.js +0 -1
  113. package/dist/zonos-elements/p-6d7e45f3.entry.js +0 -1
  114. package/dist/zonos-elements/p-9004bdda.entry.js +0 -1
  115. package/dist/zonos-elements/p-adbc4643.system.js +0 -1
  116. package/dist/zonos-elements/p-aeae5a7f.entry.js +0 -1
  117. package/dist/zonos-elements/p-f979a131.js +0 -1
@@ -1,6 +1,7 @@
1
1
  import { cartStore } from "../../store/checkout/cart";
2
2
  import { stripeStore } from "../../store/checkout/stripe";
3
3
  import { storageStore } from "../../store/storageStore";
4
+ import { extractName } from "../extractName";
4
5
  import { log } from "../logging/log";
5
6
  /**
6
7
  * Extract value from translated object
@@ -41,14 +42,16 @@ export const prepCartCalculateLandedCost = (cartId) => {
41
42
  currentAddress: stripeAddressData,
42
43
  translatedAddress: stripeStore.translatedAddress.address,
43
44
  });
44
- const shippingFirstName = translatedShippingAddress.name.split(' ')[0] || '';
45
- const shippingLastName = translatedShippingAddress.name.split(' ').splice(1).join(' ') || '';
45
+ const { firstName: shippingFirstName, lastName: shippingLastName } = extractName({
46
+ name: translatedShippingAddress.name,
47
+ });
46
48
  const translatedBillingAddress = getTranslatedAddress({
47
49
  currentAddress: stripeBillingAddressData,
48
50
  translatedAddress: stripeStore.translatedAddress.address,
49
51
  });
50
- const billingFirstName = translatedBillingAddress.name.split(' ')[0] || '';
51
- const billingLastName = translatedBillingAddress.name.split(' ').splice(1).join(' ') || '';
52
+ const { firstName: billingFirstName, lastName: billingLastName } = extractName({
53
+ name: translatedBillingAddress.name,
54
+ });
52
55
  return {
53
56
  billingAddress: {
54
57
  addressLine1: translatedBillingAddress.line1,
@@ -118,14 +121,16 @@ export const prepCalculateLandedCost = () => {
118
121
  currentAddress: stripeAddressData,
119
122
  translatedAddress: stripeStore.translatedAddress.address,
120
123
  });
121
- const shippingFirstName = translatedShippingAddress.name.split(' ')[0] || '';
122
- const shippingLastName = translatedShippingAddress.name.split(' ').splice(1).join(' ') || '';
124
+ const { firstName: shippingFirstName, lastName: shippingLastName } = extractName({
125
+ name: translatedShippingAddress.name,
126
+ });
123
127
  const translatedBillingAddress = getTranslatedAddress({
124
128
  currentAddress: stripeBillingAddressData,
125
129
  translatedAddress: stripeStore.translatedAddress.address,
126
130
  });
127
- const billingFirstName = translatedBillingAddress.name.split(' ')[0] || '';
128
- const billingLastName = translatedBillingAddress.name.split(' ').splice(1).join(' ') || '';
131
+ const { firstName: billingFirstName, lastName: billingLastName } = extractName({
132
+ name: translatedBillingAddress.name,
133
+ });
129
134
  const convertedCartAdjuments = cartStore.adjustments.map(adjustment => ({
130
135
  amount: adjustment.amount,
131
136
  name: adjustment.description || null,
@@ -1,3 +1,4 @@
1
+ import { extractName } from "../extractName";
1
2
  /**
2
3
  * This function generates an object that contains the fields of an address that have invalid characters.
3
4
  *
@@ -52,7 +53,6 @@ const getExcludeAddressFieldsObject = ({ address, invalidAdddressList, }) => {
52
53
  * @returns {ValidateAddressRequest | null} - An object that contains the address fields that have invalid characters, the destination country, and the first and last name. If the conditions are not met, the function returns null.
53
54
  */
54
55
  export const buildTranslateRequest = ({ addressInvalidCharactersList, billingAddressInvalidCharactersList, stripeAddressEventData, stripeBillingAddressEventData, stripeShippingSameAsBilling, }) => {
55
- var _a, _b, _c, _d;
56
56
  const isStripeAddressReady = !!(stripeAddressEventData === null || stripeAddressEventData === void 0 ? void 0 : stripeAddressEventData.complete);
57
57
  const isStripeBillingAddressReady = stripeShippingSameAsBilling
58
58
  ? isStripeAddressReady
@@ -68,15 +68,19 @@ export const buildTranslateRequest = ({ addressInvalidCharactersList, billingAdd
68
68
  const stripeAddressValue = stripeAddressEventData.value;
69
69
  const stripeBillingAddressValue = (stripeBillingAddressEventData === null || stripeBillingAddressEventData === void 0 ? void 0 : stripeBillingAddressEventData.value) || null;
70
70
  // Returns undefined if the name is Latin so it won't be included in the request body
71
- const firstName = stripeAddressValue.firstName || ((_a = stripeAddressValue.name) === null || _a === void 0 ? void 0 : _a.split(' ')[0]);
72
- const lastName = stripeAddressValue.lastName || ((_b = stripeAddressValue.name) === null || _b === void 0 ? void 0 : _b.split(' ')[1]);
73
- const name = `${firstName} ${lastName}`;
74
- const billingFirstName = stripeAddressValue.firstName ||
75
- ((_c = stripeBillingAddressValue === null || stripeBillingAddressValue === void 0 ? void 0 : stripeBillingAddressValue.name) === null || _c === void 0 ? void 0 : _c.split(' ')[0]);
76
- const billingLastName = stripeAddressValue.lastName ||
77
- ((_d = stripeBillingAddressValue === null || stripeBillingAddressValue === void 0 ? void 0 : stripeBillingAddressValue.name) === null || _d === void 0 ? void 0 : _d.split(' ')[1]);
78
- const billingName = billingFirstName && billingLastName
79
- ? `${billingFirstName} ${billingLastName}`
71
+ const { firstName: stripeShippingFirstName, lastName: stripeShippingLastName, } = extractName({
72
+ firstName: stripeAddressValue.firstName,
73
+ lastName: stripeAddressValue.lastName,
74
+ name: stripeAddressValue.name,
75
+ });
76
+ const name = `${stripeShippingFirstName} ${stripeShippingLastName}`;
77
+ const { firstName: stripeBillingFirstName, lastName: stripeBillingLastName } = extractName({
78
+ firstName: stripeBillingAddressValue === null || stripeBillingAddressValue === void 0 ? void 0 : stripeBillingAddressValue.firstName,
79
+ lastName: stripeBillingAddressValue === null || stripeBillingAddressValue === void 0 ? void 0 : stripeBillingAddressValue.lastName,
80
+ name: (stripeBillingAddressValue === null || stripeBillingAddressValue === void 0 ? void 0 : stripeBillingAddressValue.name) || '',
81
+ });
82
+ const billingName = stripeBillingFirstName && stripeBillingLastName
83
+ ? `${stripeBillingFirstName} ${stripeBillingLastName}`
80
84
  : '';
81
85
  const address = stripeAddressValue.address;
82
86
  const billingAddress = stripeBillingAddressValue === null || stripeBillingAddressValue === void 0 ? void 0 : stripeBillingAddressValue.address;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Extract first name and last name from the name string
3
+ * If first name and last name are provided, use them
4
+ * If name is provided, extract and return the first and last name from the name string
5
+ * If neither are provided, return an empty object
6
+ */
7
+ export const extractName = ({ firstName, lastName, name, }) => {
8
+ var _a;
9
+ if (!name && !firstName && !lastName) {
10
+ return { firstName: '', lastName: '' };
11
+ }
12
+ // Use first name and last name if they are provided
13
+ const nameParts = (name === null || name === void 0 ? void 0 : name.split(/\s+/)) || [];
14
+ const _firstName = (firstName === null || firstName === void 0 ? void 0 : firstName.trim()) || ((_a = nameParts[0]) === null || _a === void 0 ? void 0 : _a.trim()) || '';
15
+ const _lastName = (lastName === null || lastName === void 0 ? void 0 : lastName.trim()) || nameParts.slice(1).join(' ').trim() || '';
16
+ return { firstName: _firstName, lastName: _lastName };
17
+ };
@@ -180,9 +180,9 @@ const handleRequestWithFallback = async ({ basePathType: _basePathType, options,
180
180
  (message.includes('signal is aborted') ||
181
181
  message.includes('The operation was aborted') ||
182
182
  message.includes('Fetch is aborted')));
183
- const isUnknownError = !!unknownError || (response === null || response === void 0 ? void 0 : response.status) === 404;
183
+ const isUnknownError = !!unknownError || (response === null || response === void 0 ? void 0 : response.status) === 404 || (response === null || response === void 0 ? void 0 : response.status) === 500;
184
184
  const shouldCallFallback =
185
- // If next fallback is available, and the error is unknown (Failed to fetch) or 404
185
+ // If next fallback is available, and the error is unknown (Failed to fetch) or 404 or 500 (server error)
186
186
  nextFallbackApiType && isUnknownError;
187
187
  // Should log the error if it's unknown error
188
188
  if (isUnknownError && !isAbortError) {
@@ -1,9 +1,27 @@
1
1
  import { z as zonosStore, c as createStore } from './zonosStore-c456b933.js';
2
- import { s as storageStore, l as localizationStore, t as translate, f as filterValidTests, b as storageStoreSetEnabledVariantTestKeys } from './localization-cf31c728.js';
3
- import { l as log, f as fallbackApiList, h as handleFetch, g as getIsTestMode, a as getIsStagingMode, s as sendErrorLog, d as allLogs, b as logError, j as jsonParse } from './handleFetch-dd74bbb1.js';
2
+ import { s as storageStore, l as localizationStore, t as translate, f as filterValidTests, b as storageStoreSetEnabledVariantTestKeys } from './localization-b3bdf691.js';
3
+ import { l as log, f as fallbackApiList, h as handleFetch, g as getIsTestMode, a as getIsStagingMode, s as sendErrorLog, d as allLogs, b as logError, j as jsonParse } from './handleFetch-bb221e63.js';
4
4
  import { i as isDarkColor } from './isDarkColor-1f58b6be.js';
5
5
  import { g as getBorderRadius } from './getBorderRadius-87593ff4.js';
6
6
 
7
+ /**
8
+ * Extract first name and last name from the name string
9
+ * If first name and last name are provided, use them
10
+ * If name is provided, extract and return the first and last name from the name string
11
+ * If neither are provided, return an empty object
12
+ */
13
+ const extractName = ({ firstName, lastName, name, }) => {
14
+ var _a;
15
+ if (!name && !firstName && !lastName) {
16
+ return { firstName: '', lastName: '' };
17
+ }
18
+ // Use first name and last name if they are provided
19
+ const nameParts = (name === null || name === void 0 ? void 0 : name.split(/\s+/)) || [];
20
+ const _firstName = (firstName === null || firstName === void 0 ? void 0 : firstName.trim()) || ((_a = nameParts[0]) === null || _a === void 0 ? void 0 : _a.trim()) || '';
21
+ const _lastName = (lastName === null || lastName === void 0 ? void 0 : lastName.trim()) || nameParts.slice(1).join(' ').trim() || '';
22
+ return { firstName: _firstName, lastName: _lastName };
23
+ };
24
+
7
25
  /**
8
26
  * Extract value from translated object
9
27
  */
@@ -43,14 +61,16 @@ const prepCartCalculateLandedCost = (cartId) => {
43
61
  currentAddress: stripeAddressData,
44
62
  translatedAddress: stripeStore.translatedAddress.address,
45
63
  });
46
- const shippingFirstName = translatedShippingAddress.name.split(' ')[0] || '';
47
- const shippingLastName = translatedShippingAddress.name.split(' ').splice(1).join(' ') || '';
64
+ const { firstName: shippingFirstName, lastName: shippingLastName } = extractName({
65
+ name: translatedShippingAddress.name,
66
+ });
48
67
  const translatedBillingAddress = getTranslatedAddress({
49
68
  currentAddress: stripeBillingAddressData,
50
69
  translatedAddress: stripeStore.translatedAddress.address,
51
70
  });
52
- const billingFirstName = translatedBillingAddress.name.split(' ')[0] || '';
53
- const billingLastName = translatedBillingAddress.name.split(' ').splice(1).join(' ') || '';
71
+ const { firstName: billingFirstName, lastName: billingLastName } = extractName({
72
+ name: translatedBillingAddress.name,
73
+ });
54
74
  return {
55
75
  billingAddress: {
56
76
  addressLine1: translatedBillingAddress.line1,
@@ -120,14 +140,16 @@ const prepCalculateLandedCost = () => {
120
140
  currentAddress: stripeAddressData,
121
141
  translatedAddress: stripeStore.translatedAddress.address,
122
142
  });
123
- const shippingFirstName = translatedShippingAddress.name.split(' ')[0] || '';
124
- const shippingLastName = translatedShippingAddress.name.split(' ').splice(1).join(' ') || '';
143
+ const { firstName: shippingFirstName, lastName: shippingLastName } = extractName({
144
+ name: translatedShippingAddress.name,
145
+ });
125
146
  const translatedBillingAddress = getTranslatedAddress({
126
147
  currentAddress: stripeBillingAddressData,
127
148
  translatedAddress: stripeStore.translatedAddress.address,
128
149
  });
129
- const billingFirstName = translatedBillingAddress.name.split(' ')[0] || '';
130
- const billingLastName = translatedBillingAddress.name.split(' ').splice(1).join(' ') || '';
150
+ const { firstName: billingFirstName, lastName: billingLastName } = extractName({
151
+ name: translatedBillingAddress.name,
152
+ });
131
153
  const convertedCartAdjuments = cartStore.adjustments.map(adjustment => ({
132
154
  amount: adjustment.amount,
133
155
  name: adjustment.description || null,
@@ -422,7 +444,6 @@ const getExcludeAddressFieldsObject = ({ address, invalidAdddressList, }) => {
422
444
  * @returns {ValidateAddressRequest | null} - An object that contains the address fields that have invalid characters, the destination country, and the first and last name. If the conditions are not met, the function returns null.
423
445
  */
424
446
  const buildTranslateRequest = ({ addressInvalidCharactersList, billingAddressInvalidCharactersList, stripeAddressEventData, stripeBillingAddressEventData, stripeShippingSameAsBilling, }) => {
425
- var _a, _b, _c, _d;
426
447
  const isStripeAddressReady = !!(stripeAddressEventData === null || stripeAddressEventData === void 0 ? void 0 : stripeAddressEventData.complete);
427
448
  const isStripeBillingAddressReady = stripeShippingSameAsBilling
428
449
  ? isStripeAddressReady
@@ -438,15 +459,19 @@ const buildTranslateRequest = ({ addressInvalidCharactersList, billingAddressInv
438
459
  const stripeAddressValue = stripeAddressEventData.value;
439
460
  const stripeBillingAddressValue = (stripeBillingAddressEventData === null || stripeBillingAddressEventData === void 0 ? void 0 : stripeBillingAddressEventData.value) || null;
440
461
  // Returns undefined if the name is Latin so it won't be included in the request body
441
- const firstName = stripeAddressValue.firstName || ((_a = stripeAddressValue.name) === null || _a === void 0 ? void 0 : _a.split(' ')[0]);
442
- const lastName = stripeAddressValue.lastName || ((_b = stripeAddressValue.name) === null || _b === void 0 ? void 0 : _b.split(' ')[1]);
443
- const name = `${firstName} ${lastName}`;
444
- const billingFirstName = stripeAddressValue.firstName ||
445
- ((_c = stripeBillingAddressValue === null || stripeBillingAddressValue === void 0 ? void 0 : stripeBillingAddressValue.name) === null || _c === void 0 ? void 0 : _c.split(' ')[0]);
446
- const billingLastName = stripeAddressValue.lastName ||
447
- ((_d = stripeBillingAddressValue === null || stripeBillingAddressValue === void 0 ? void 0 : stripeBillingAddressValue.name) === null || _d === void 0 ? void 0 : _d.split(' ')[1]);
448
- const billingName = billingFirstName && billingLastName
449
- ? `${billingFirstName} ${billingLastName}`
462
+ const { firstName: stripeShippingFirstName, lastName: stripeShippingLastName, } = extractName({
463
+ firstName: stripeAddressValue.firstName,
464
+ lastName: stripeAddressValue.lastName,
465
+ name: stripeAddressValue.name,
466
+ });
467
+ const name = `${stripeShippingFirstName} ${stripeShippingLastName}`;
468
+ const { firstName: stripeBillingFirstName, lastName: stripeBillingLastName } = extractName({
469
+ firstName: stripeBillingAddressValue === null || stripeBillingAddressValue === void 0 ? void 0 : stripeBillingAddressValue.firstName,
470
+ lastName: stripeBillingAddressValue === null || stripeBillingAddressValue === void 0 ? void 0 : stripeBillingAddressValue.lastName,
471
+ name: (stripeBillingAddressValue === null || stripeBillingAddressValue === void 0 ? void 0 : stripeBillingAddressValue.name) || '',
472
+ });
473
+ const billingName = stripeBillingFirstName && stripeBillingLastName
474
+ ? `${stripeBillingFirstName} ${stripeBillingLastName}`
450
475
  : '';
451
476
  const address = stripeAddressValue.address;
452
477
  const billingAddress = stripeBillingAddressValue === null || stripeBillingAddressValue === void 0 ? void 0 : stripeBillingAddressValue.address;
@@ -783,8 +808,11 @@ const checkIsAddressOutdatedForAsyncAddressUpdate = () => {
783
808
  isCompanyNameDirty);
784
809
  };
785
810
  const buildAddressForPartyCreate = ({ address, firstName, lastName, name, phone, }) => {
786
- const _firstName = (name === null || name === void 0 ? void 0 : name.split(' ')[0]) || firstName || '';
787
- const _lastName = (name === null || name === void 0 ? void 0 : name.split(' ')[1]) || lastName || '';
811
+ const { firstName: _firstName, lastName: _lastName } = extractName({
812
+ firstName,
813
+ lastName,
814
+ name,
815
+ });
788
816
  if (!_firstName || !_lastName) {
789
817
  void sendErrorLog({
790
818
  endpoint: 'PARTY_CREATE_NO_NAME_FOUND',
@@ -2147,4 +2175,4 @@ const cartStoreResetTabItems = () => {
2147
2175
  cartStoreResetSelectedShippingOption();
2148
2176
  };
2149
2177
 
2150
- export { cartStoreHasOneEligibleItem as A, stripeStoreApplyPromoCode as B, stripeStoreRemovePromoCode as C, stripeStoreResetPromoCode as D, stripeStoreMessageBasedOnStatus as E, stripeStoreTranslateAddressToLatin as F, cartStoreOnChange as G, stripeStoreAsyncAddressUpdate as H, cartStoreUpdateSelectedShippingOption as I, cartStoreGetShippingTransitInfo as J, cartStoreGetMethod as K, sortServiceLevelOptionsByAmount as L, stripeStoreCleanupDomesticShippingSession as a, stripeStoreSaveDomesticShippingSession as b, stripeStore as c, stripeStoreRetrievePayment as d, cartStore as e, cartStoreUpdateItems as f, cartStoreReset as g, cartStoreResetTabItems as h, initStripeElements as i, cartStoreClearCheckoutInterval as j, stripeStoreInitCheckoutSession as k, stripeStoreGetPaymentIntent as l, cartStoreStartCheckoutInterval as m, getCheckoutSessionBody as n, cartStoreUpdateToErrorState as o, cartStoreSetCheckoutSession as p, stripeStorePrefetchLandedCost as q, cartStoreNextStep as r, stripeStoreGetDomesticShippingSession as s, trackConversionEvent as t, stripeStoreUpdateCheckoutSessionBaseCurrency as u, stripeStoreHandleInventoryCheck as v, stripeStoreConfirmPayment as w, stripeStoreHandleInventoryRefund as x, stripeStoreReset as y, validateCheckoutSession as z };
2178
+ export { cartStoreHasOneEligibleItem as A, stripeStoreApplyPromoCode as B, stripeStoreRemovePromoCode as C, stripeStoreResetPromoCode as D, stripeStoreMessageBasedOnStatus as E, stripeStoreTranslateAddressToLatin as F, extractName as G, cartStoreOnChange as H, stripeStoreAsyncAddressUpdate as I, cartStoreUpdateSelectedShippingOption as J, cartStoreGetShippingTransitInfo as K, cartStoreGetMethod as L, sortServiceLevelOptionsByAmount as M, stripeStoreCleanupDomesticShippingSession as a, stripeStoreSaveDomesticShippingSession as b, stripeStore as c, stripeStoreRetrievePayment as d, cartStore as e, cartStoreUpdateItems as f, cartStoreReset as g, cartStoreResetTabItems as h, initStripeElements as i, cartStoreClearCheckoutInterval as j, stripeStoreInitCheckoutSession as k, stripeStoreGetPaymentIntent as l, cartStoreStartCheckoutInterval as m, getCheckoutSessionBody as n, cartStoreUpdateToErrorState as o, cartStoreSetCheckoutSession as p, stripeStorePrefetchLandedCost as q, cartStoreNextStep as r, stripeStoreGetDomesticShippingSession as s, trackConversionEvent as t, stripeStoreUpdateCheckoutSessionBaseCurrency as u, stripeStoreHandleInventoryCheck as v, stripeStoreConfirmPayment as w, stripeStoreHandleInventoryRefund as x, stripeStoreReset as y, validateCheckoutSession as z };
@@ -431,9 +431,9 @@ const handleRequestWithFallback = async ({ basePathType: _basePathType, options,
431
431
  (message.includes('signal is aborted') ||
432
432
  message.includes('The operation was aborted') ||
433
433
  message.includes('Fetch is aborted')));
434
- const isUnknownError = !!unknownError || (response === null || response === void 0 ? void 0 : response.status) === 404;
434
+ const isUnknownError = !!unknownError || (response === null || response === void 0 ? void 0 : response.status) === 404 || (response === null || response === void 0 ? void 0 : response.status) === 500;
435
435
  const shouldCallFallback =
436
- // If next fallback is available, and the error is unknown (Failed to fetch) or 404
436
+ // If next fallback is available, and the error is unknown (Failed to fetch) or 404 or 500 (server error)
437
437
  nextFallbackApiType && isUnknownError;
438
438
  // Should log the error if it's unknown error
439
439
  if (isUnknownError && !isAbortError) {
package/dist/esm/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { c as createCustomEvent } from './createCustomEvent-58159025.js';
2
2
  import { g as getGenericSettingsOverride, I as IframeService } from './getGenericSettingsOverride-0bc3e118.js';
3
- import { g as getIsTestMode, a as getIsStagingMode, l as log, h as handleFetch, b as logError } from './handleFetch-dd74bbb1.js';
3
+ import { g as getIsTestMode, a as getIsStagingMode, l as log, h as handleFetch, b as logError } from './handleFetch-bb221e63.js';
4
4
  import { g as getAbandonedCartRenewTokenValue, _ as _getIsValidCartId, c as checkoutHiddenBtnSelector, a as checkoutHiddenInternationalBtnSelector } from './CheckoutConfig-724d7bae.js';
5
5
  export { c as checkoutHiddenBtnSelector, a as checkoutHiddenInternationalBtnSelector, d as domesticRedirectedBtnSelector } from './CheckoutConfig-724d7bae.js';
6
6
  export { a as availableTestKeys } from './VarianceTest-fef2d958.js';
@@ -129,7 +129,7 @@ const getZonosQaUrl = () => {
129
129
  return null;
130
130
  }
131
131
  const qaUrl = extractZonosQaUrl(window.location.href);
132
- const cdnUrl = "https://v1.3.214.js.zonos.com";
132
+ const cdnUrl = "https://v1.3.216.js.zonos.com";
133
133
  // when the qaUrl is not set and the built URL is from the test domain, use the test domain for testing
134
134
  if (!qaUrl &&
135
135
  (cdnUrl.includes('test.') ||
@@ -372,10 +372,10 @@ const zonosLoadUrl = (() => {
372
372
  }
373
373
  return null;
374
374
  })();
375
- const ZONOS_URL = "https://v1.3.214.js.zonos.com";
376
- const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.214";
377
- const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.214";
378
- const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.214";
375
+ const ZONOS_URL = "https://v1.3.216.js.zonos.com";
376
+ const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.216";
377
+ const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.216";
378
+ const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.216";
379
379
  const GOOGLE_FONT_URL = 'https://fonts.googleapis.com';
380
380
  const GOOGLE_FONT_REGEX = /^https:\/\/fonts\.googleapis\.com/;
381
381
  class Zonos {
@@ -393,7 +393,7 @@ Zonos.iframeLogType = typeof window !== 'undefined'
393
393
  ? new URLSearchParams(window.location.search).get('iframeLogType')
394
394
  : null;
395
395
  Zonos.isBigCommerce = false;
396
- Zonos.releaseDate = "1749479724498";
396
+ Zonos.releaseDate = "1749769356368";
397
397
  Zonos.isLegacyCheckout = false;
398
398
  Zonos.domain = typeof window !== 'undefined'
399
399
  ? // domain that embeds the iframe
@@ -411,7 +411,7 @@ Zonos.isNpm = true;
411
411
  Zonos.zonosQaUrl = null;
412
412
  Zonos.zonosQaUrlApi = null;
413
413
  Zonos.trackEventLogs = [];
414
- Zonos.version = `v${"1.3.214"}`;
414
+ Zonos.version = `v${"1.3.216"}`;
415
415
  Zonos.modeAlerted = false;
416
416
  Zonos.cartData = null;
417
417
  Zonos.paypal = null;
@@ -1,5 +1,5 @@
1
1
  import { c as createStore, z as zonosStore } from './zonosStore-c456b933.js';
2
- import { l as log, j as jsonParse, h as handleFetch, b as logError } from './handleFetch-dd74bbb1.js';
2
+ import { l as log, j as jsonParse, h as handleFetch, b as logError } from './handleFetch-bb221e63.js';
3
3
  import { a as availableTestKeys } from './VarianceTest-fef2d958.js';
4
4
 
5
5
  /**
@@ -1,7 +1,7 @@
1
1
  import { z as zonosStore, c as createStore } from './zonosStore-c456b933.js';
2
- import { t as trackConversionEvent, z as validateCheckoutSession, c as stripeStore, e as cartStore, v as stripeStoreHandleInventoryCheck, r as cartStoreNextStep, j as cartStoreClearCheckoutInterval } from './cart-c3540cd7.js';
3
- import { t as translate, s as storageStore } from './localization-cf31c728.js';
4
- import { h as handleFetch, l as log, b as logError, j as jsonParse } from './handleFetch-dd74bbb1.js';
2
+ import { t as trackConversionEvent, z as validateCheckoutSession, c as stripeStore, e as cartStore, v as stripeStoreHandleInventoryCheck, r as cartStoreNextStep, j as cartStoreClearCheckoutInterval } from './cart-011aa510.js';
3
+ import { t as translate, s as storageStore } from './localization-b3bdf691.js';
4
+ import { h as handleFetch, l as log, b as logError, j as jsonParse } from './handleFetch-bb221e63.js';
5
5
  import { t as tinycolor } from './isDarkColor-1f58b6be.js';
6
6
 
7
7
  /*!
@@ -1,5 +1,5 @@
1
1
  import { d as debounce_1 } from './debounce-c34d1270.js';
2
- import { h as handleFetch, b as logError } from './handleFetch-dd74bbb1.js';
2
+ import { h as handleFetch, b as logError } from './handleFetch-bb221e63.js';
3
3
 
4
4
  const attributesToUpdate = {};
5
5
  // Store debounced functions per session to ensure proper debouncing
@@ -1,9 +1,9 @@
1
1
  import { r as registerInstance, c as createEvent, h, H as Host, a as getElement } from './index-55a03023.js';
2
2
  import { d as debounce_1 } from './debounce-c34d1270.js';
3
3
  import { d as isObject_1, z as zonosStore, f as zonosStoreFontFamily } from './zonosStore-c456b933.js';
4
- import { c as stripeStore, t as trackConversionEvent, q as stripeStorePrefetchLandedCost, e as cartStore } from './cart-c3540cd7.js';
5
- import { s as storageStore, n as storageStoreOnChange, o as getFallbackDefaultCountryCode, t as translate, l as localizationStore } from './localization-cf31c728.js';
6
- import { b as logError, l as log, i as isCheckoutMobile } from './handleFetch-dd74bbb1.js';
4
+ import { c as stripeStore, t as trackConversionEvent, G as extractName, q as stripeStorePrefetchLandedCost, e as cartStore } from './cart-011aa510.js';
5
+ import { s as storageStore, n as storageStoreOnChange, o as getFallbackDefaultCountryCode, t as translate, l as localizationStore } from './localization-b3bdf691.js';
6
+ import { b as logError, l as log, i as isCheckoutMobile } from './handleFetch-bb221e63.js';
7
7
  import { s as shouldRenderTaxIdInput, i as isTextContainsNonLatinChars, c as containsNonLatinChars } from './shouldRenderTaxIdInput-8bc112bb.js';
8
8
  import { c as countryRequireTaxId, s as shipToTaxIdLabels } from './TaxId-50d72254.js';
9
9
  import { c as classes } from './classes-0d95c529.js';
@@ -269,8 +269,14 @@ const ZonosAddress$1 = class {
269
269
  }
270
270
  }, 600);
271
271
  }
272
+ const { firstName, lastName } = extractName({
273
+ firstName: eventValue.firstName,
274
+ lastName: eventValue.lastName,
275
+ name: eventValue.name,
276
+ });
272
277
  this.updateAddressEventData({
273
- event: Object.assign(Object.assign({}, event), { elementMode: this.type, elementType: 'address', value: Object.assign(Object.assign({}, eventValue), { firstName: eventValue.firstName || eventValue.name.split(' ')[0], lastName: eventValue.lastName || eventValue.name.split(' ')[1] }) }),
278
+ event: Object.assign(Object.assign({}, event), { elementMode: this.type, elementType: 'address', value: Object.assign(Object.assign({}, eventValue), { firstName,
279
+ lastName }) }),
274
280
  type: this.type,
275
281
  });
276
282
  });
@@ -374,7 +380,7 @@ const ZonosAddress$1 = class {
374
380
  this.isAddressFilled = true;
375
381
  }
376
382
  // this component loads iframe from the stripe elements and puts here, so we don't need to do anything here
377
- return (h(Host, { key: '6cb2f40dc810982251bdb24bd373ef5dc5b26cd2', class: "zonos--address zonos--elements" }, h("zonos-text", { key: 'f7b393a508bc5f1921924090c365cdf41f23f0e7', class: "zonos--title", type: "semiBoldLabel" }, this.titleText), this.renderCompanyNameInput(), this.renderTaxIdInput(), h("div", { key: '9bd11de0b90f7ad7328cf37694c7d4e2a2d73f06', class: "zonos--address-component" })));
383
+ return (h(Host, { key: '13b9fdc214b7ffeacaa180f1ba0d49032b417b6f', class: "zonos--address zonos--elements" }, h("zonos-text", { key: '7a6ec3c462293e85926b0f379860d8d4edfe6120', class: "zonos--title", type: "semiBoldLabel" }, this.titleText), this.renderCompanyNameInput(), this.renderTaxIdInput(), h("div", { key: '36c094186e6ce2ce1d1c4e8f56823fd032b3ad9e', class: "zonos--address-component" })));
378
384
  }
379
385
  get el() { return getElement(this); }
380
386
  static get watchers() { return {
@@ -439,18 +445,18 @@ const ZonosAddressForm = class {
439
445
  }
440
446
  render() {
441
447
  const { city, country, line1, line2, name, phone, postal_code, state } = this.localAddress;
442
- const firstName = name.split(' ')[0] || '';
443
- // get the rest of the name if it exists
444
- const lastName = name.split(' ').slice(1).join(' ') || '';
445
- return (h(Host, { key: '8b578737e33203a23563be7e9be0778deec99bbf', class: "zonos--address-form zonos--elements" }, h("div", { key: '793675a1348547bf3f781788956befe325191011', class: "zonos--title" }, h("zonos-text", { key: '13de35cb0a7c98a48342e3fb86ae3ade9f5b88d9', textColor: "gray-700", type: "smallHeader" }, this.addressType === 'shipping'
448
+ const { firstName, lastName } = extractName({
449
+ name,
450
+ });
451
+ return (h(Host, { key: '22d085e462e69a4100a8cb1763367f53b933ed1d', class: "zonos--address-form zonos--elements" }, h("div", { key: '17d6c92370343ffbd1b4a85b3c49055a5a7f9d72', class: "zonos--title" }, h("zonos-text", { key: 'a4cb01bd8fed154567e0b7ade87777a1552ea815', textColor: "gray-700", type: "smallHeader" }, this.addressType === 'shipping'
446
452
  ? translate('Shipping')
447
- : translate('Billing'))), h("div", { key: '2c5de5b5283fb99ee5f8b61d7a217177986fc2db', class: "zonos--address-group" }, h("div", { key: '23bf3c893071000d5995a5f175867bab11929193', class: "zonos--contact" }, h("zonos-text", { key: '7cdfe2a84ebad89ba5b16498d75def99cf392384', type: "label" }, translate('Contact')), h("zonos-input", { key: '1c39c38767fd306c5eb1164cdc989b8291209cf0', class: "zonos--form-email", inputLabel: translate('Email'), inputValue: this.currentAddress.email, isDisabled: true }), h("div", { key: 'cbdf61217125e22b1a6cec9a340ef0aca2c75670', class: "zonos--name zonos--address-row" }, h("zonos-input", { key: '360c99e7b2c6caa64580d5768b5bb53368927275', class: "zonos--form-first-name", inputLabel: translate('First name'), inputValue: firstName, isError: isTextContainsNonLatinChars(firstName), onInputChange: e => this.onInputChange({
453
+ : translate('Billing'))), h("div", { key: '4a1dddabc011e465d295b5c2994fda3a2531c96e', class: "zonos--address-group" }, h("div", { key: '60df882b5717b2f557a5051f492b2c838f938cd9', class: "zonos--contact" }, h("zonos-text", { key: '90b6613ccf1b2a445baae5f700f392d195924688', type: "label" }, translate('Contact')), h("zonos-input", { key: '125815769a366e113b61d5581578ef6ecbdffa79', class: "zonos--form-email", inputLabel: translate('Email'), inputValue: this.currentAddress.email, isDisabled: true }), h("div", { key: 'd0d331fb33f40243ce23824db5ba9551fd5636f8', class: "zonos--name zonos--address-row" }, h("zonos-input", { key: '46323db8f305e491215df03ef2092e76eec38355', class: "zonos--form-first-name", inputLabel: translate('First name'), inputValue: firstName, isError: isTextContainsNonLatinChars(firstName), onInputChange: e => this.onInputChange({
448
454
  key: 'name',
449
455
  value: `${e.detail} ${lastName}`,
450
- }) }), h("zonos-input", { key: '8ce5fa5c15c6f7928339ea10009ce0e68954a91f', class: "zonos--form-last-name", inputLabel: translate('Last name'), inputValue: lastName, isError: isTextContainsNonLatinChars(lastName), onInputChange: e => this.onInputChange({
456
+ }) }), h("zonos-input", { key: '3c055ee2f1fcaf93ebcbd8f11ad6609cd33e9e14', class: "zonos--form-last-name", inputLabel: translate('Last name'), inputValue: lastName, isError: isTextContainsNonLatinChars(lastName), onInputChange: e => this.onInputChange({
451
457
  key: 'name',
452
458
  value: `${firstName} ${e.detail}`,
453
- }) }))), h("div", { key: '7b4fa2d3baa6cb257e7688e5ba6777123898b3fd', class: "zonos--address" }, h("zonos-text", { key: '9d5782331b2642755a755aeb7f98c9f4d87f9a20', type: "label" }, translate('Address')), h("zonos-input", { key: 'a622025924ca86bdbf1d3c04b79e6dee172b4c42', class: "zonos--form-country", inputLabel: translate('Country'), inputValue: country, isDisabled: true }), h("zonos-input", { key: 'f99b3a74db09ab5730878e80705b9aeac76bf800', class: "zonos--form-line1", inputLabel: translate('Address line 1'), inputValue: line1, isError: isTextContainsNonLatinChars(line1), onInputChange: e => this.onInputChange({ key: 'line1', value: e.detail }) }), h("zonos-input", { key: '5d16aefa45a78045c87d166aaaec0255606e455e', class: "zonos--form-line2", inputLabel: translate('Address line 2'), inputValue: line2, isError: isTextContainsNonLatinChars(line2), onInputChange: e => this.onInputChange({ key: 'line2', value: e.detail }) }), h("div", { key: 'dc166be9381142835d72e731cb38a718522a068a', class: "zonos--address-row" }, h("zonos-input", { key: '4f1a98f9d10ce0cff3ef18a3037a12382552b31d', class: "zonos--form-city", inputLabel: translate('City'), inputValue: city, isError: isTextContainsNonLatinChars(city), onInputChange: e => this.onInputChange({ key: 'city', value: e.detail }) }), h("zonos-input", { key: 'd4f97900b5fe2e1619950a52d1d1f716a8bc19ff', class: "zonos--form-state", inputLabel: translate('State/Province'), inputValue: state, isError: isTextContainsNonLatinChars(state), onInputChange: e => this.onInputChange({ key: 'state', value: e.detail }) })), h("zonos-input", { key: 'cf1eb0ca5cd15c8412a2e1246aaf2e39361dc733', class: "zonos--form-postal-code", inputLabel: translate('Postal code'), inputValue: postal_code, isError: isTextContainsNonLatinChars(postal_code), onInputChange: e => this.onInputChange({ key: 'postal_code', value: e.detail }) }), h("zonos-input", { key: '7421c82847eded6bdbcce49ef8196124d8e50c1d', class: "zonos--form-phone", inputLabel: translate('Phone number'), inputValue: phone, onInputChange: e => this.onInputChange({ key: 'phone', value: e.detail }) })))));
459
+ }) }))), h("div", { key: 'ce30f816d03b497eb4491d2554eb63c0aabf110c', class: "zonos--address" }, h("zonos-text", { key: '304867c5354ac55071c88944a63bba88ea3fb86f', type: "label" }, translate('Address')), h("zonos-input", { key: 'f0efe937603a38761643af1486b53359a19593e5', class: "zonos--form-country", inputLabel: translate('Country'), inputValue: country, isDisabled: true }), h("zonos-input", { key: '8360a4ae65c8963e886a3fb8322e0e539d121142', class: "zonos--form-line1", inputLabel: translate('Address line 1'), inputValue: line1, isError: isTextContainsNonLatinChars(line1), onInputChange: e => this.onInputChange({ key: 'line1', value: e.detail }) }), h("zonos-input", { key: '2c9374917b705c2c9306d3d4d7fc4b4043c2b73b', class: "zonos--form-line2", inputLabel: translate('Address line 2'), inputValue: line2, isError: isTextContainsNonLatinChars(line2), onInputChange: e => this.onInputChange({ key: 'line2', value: e.detail }) }), h("div", { key: 'fd067074070cadba3d895503f35c344ff817fec2', class: "zonos--address-row" }, h("zonos-input", { key: 'a565bee68e2498403df2801eb90005e8cb2d6f44', class: "zonos--form-city", inputLabel: translate('City'), inputValue: city, isError: isTextContainsNonLatinChars(city), onInputChange: e => this.onInputChange({ key: 'city', value: e.detail }) }), h("zonos-input", { key: '89bae75b691aacdd62b624f65eee303bfb3fc811', class: "zonos--form-state", inputLabel: translate('State/Province'), inputValue: state, isError: isTextContainsNonLatinChars(state), onInputChange: e => this.onInputChange({ key: 'state', value: e.detail }) })), h("zonos-input", { key: '9a851b9f449ed135859b7b828bf362168caf76fb', class: "zonos--form-postal-code", inputLabel: translate('Postal code'), inputValue: postal_code, isError: isTextContainsNonLatinChars(postal_code), onInputChange: e => this.onInputChange({ key: 'postal_code', value: e.detail }) }), h("zonos-input", { key: 'a51b8ba1e22d5a12eac9021abe83fdc20f8eb1a6', class: "zonos--form-phone", inputLabel: translate('Phone number'), inputValue: phone, onInputChange: e => this.onInputChange({ key: 'phone', value: e.detail }) })))));
454
460
  }
455
461
  static get watchers() { return {
456
462
  "translatedAddress": ["watchCurrentAddress"]
@@ -1250,14 +1256,17 @@ const ZonosAddress = class {
1250
1256
  // Use data from default address if it's available
1251
1257
  const firstDefaultAddress = this.defaultAddress[0];
1252
1258
  if (firstDefaultAddress) {
1259
+ const { firstName, lastName } = extractName({
1260
+ name: firstDefaultAddress.name,
1261
+ });
1253
1262
  const countryCode = firstDefaultAddress.address.country ||
1254
1263
  localizationStore.selectedCountryCode ||
1255
1264
  'US';
1256
1265
  this.setFormValues({
1257
1266
  city: firstDefaultAddress.address.city,
1258
1267
  country: countryCode,
1259
- firstName: firstDefaultAddress.name.split(' ')[0] || '',
1260
- lastName: firstDefaultAddress.name.split(' ')[1] || '',
1268
+ firstName,
1269
+ lastName,
1261
1270
  line1: firstDefaultAddress.address.line1,
1262
1271
  line2: firstDefaultAddress.address.line2 || '',
1263
1272
  phone: firstDefaultAddress.phone || '',
@@ -1725,10 +1734,10 @@ const ZonosAddress = class {
1725
1734
  this.country = localizationStore.selectedCountryCode;
1726
1735
  }
1727
1736
  // this component loads iframe from the stripe elements and puts here, so we don't need to do anything here
1728
- return (h(Host, { key: '668f481c1b31dd6e756d95b5c382592681cea23d', class: classes([
1737
+ return (h(Host, { key: '9e1d9e1ed3fca30876ba8310510873a5b10c6552', class: classes([
1729
1738
  'zonos--address zonos--elements',
1730
1739
  `zonos--${this.type}-address`,
1731
- ]) }, h("zonos-text", { key: 'a31cd25d43d9262d408e6ced8330cbe1c51bdd47', class: "zonos--title", type: "semiBoldLabel" }, this.titleText), this.renderCompanyNameInput(), this.renderTaxIdInput(), this.renderCustomAddressForm()));
1740
+ ]) }, h("zonos-text", { key: '2356d42946b3ed93c4670fb876101a1371ac5c14', class: "zonos--title", type: "semiBoldLabel" }, this.titleText), this.renderCompanyNameInput(), this.renderTaxIdInput(), this.renderCustomAddressForm()));
1732
1741
  }
1733
1742
  get el() { return getElement(this); }
1734
1743
  static get watchers() { return {