@zonos/elements 1.3.215 → 1.3.217

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 (108) hide show
  1. package/dist/cjs/{cart-e0b62259.js → cart-54ff39d6.js} +51 -22
  2. package/dist/cjs/{handleFetch-7cf3752e.js → handleFetch-0313ebba.js} +3 -3
  3. package/dist/cjs/index.cjs.js +8 -8
  4. package/dist/cjs/{localization-91bcde0e.js → localization-721a5ec3.js} +1 -1
  5. package/dist/cjs/{paypal-93e5de01.js → paypal-e7504122.js} +3 -3
  6. package/dist/cjs/{updateCheckoutSessionAttributes-047bc0cb.js → updateCheckoutSessionAttributes-8db49644.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 +10 -7
  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 +2 -2
  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-customer-info/zonos-customer-info.js +6 -2
  19. package/dist/collection/components/store/checkout/stripe.js +6 -2
  20. package/dist/collection/components/stripe/zonos-address/zonos-address.js +9 -2
  21. package/dist/collection/components/stripe/zonos-custom-address/zonos-custom-address.js +8 -4
  22. package/dist/collection/components/utils/api/prepCalculateLandedCost.js +13 -8
  23. package/dist/collection/components/utils/checkout/buildTranslateRequest.js +14 -10
  24. package/dist/collection/components/utils/extractName.js +17 -0
  25. package/dist/collection/components/utils/getNextFallbackApi.js +1 -1
  26. package/dist/collection/components/utils/handleFetch.js +2 -2
  27. package/dist/esm/{cart-c3540cd7.js → cart-010402f9.js} +51 -23
  28. package/dist/esm/{handleFetch-dd74bbb1.js → handleFetch-fa90f7f6.js} +3 -3
  29. package/dist/esm/index.js +8 -8
  30. package/dist/esm/{localization-cf31c728.js → localization-9db8b6e9.js} +1 -1
  31. package/dist/esm/{paypal-5963c1ab.js → paypal-70b140d9.js} +3 -3
  32. package/dist/esm/{updateCheckoutSessionAttributes-7babf0f2.js → updateCheckoutSessionAttributes-691cdc6d.js} +1 -1
  33. package/dist/esm/zonos-address_11.entry.js +25 -16
  34. package/dist/esm/zonos-cart-items_14.entry.js +10 -7
  35. package/dist/esm/zonos-checkout.entry.js +5 -5
  36. package/dist/esm/zonos-controller.entry.js +3 -3
  37. package/dist/esm/zonos-country-flag.entry.js +2 -2
  38. package/dist/esm/zonos-country-select_4.entry.js +2 -2
  39. package/dist/esm/zonos-empty-state-payment_4.entry.js +4 -4
  40. package/dist/esm/zonos-hello-dialog.entry.js +2 -2
  41. package/dist/esm/zonos-hello.entry.js +2 -2
  42. package/dist/esm/zonos-language-select_2.entry.js +2 -2
  43. package/dist/esm-es5/cart-010402f9.js +1 -0
  44. package/dist/esm-es5/{handleFetch-dd74bbb1.js → handleFetch-fa90f7f6.js} +1 -1
  45. package/dist/esm-es5/index.js +1 -1
  46. package/dist/esm-es5/{localization-cf31c728.js → localization-9db8b6e9.js} +1 -1
  47. package/dist/esm-es5/{paypal-5963c1ab.js → paypal-70b140d9.js} +1 -1
  48. package/dist/esm-es5/{updateCheckoutSessionAttributes-7babf0f2.js → updateCheckoutSessionAttributes-691cdc6d.js} +1 -1
  49. package/dist/esm-es5/zonos-address_11.entry.js +1 -1
  50. package/dist/esm-es5/zonos-cart-items_14.entry.js +1 -1
  51. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  52. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  53. package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
  54. package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
  55. package/dist/esm-es5/zonos-empty-state-payment_4.entry.js +1 -1
  56. package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
  57. package/dist/esm-es5/zonos-hello.entry.js +1 -1
  58. package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
  59. package/dist/scripts/index.d.ts +1 -1
  60. package/dist/scripts/index.js +1 -1
  61. package/dist/scripts/loadZonos.js +1 -1
  62. package/dist/scripts/zonos.js +1 -1
  63. package/dist/types/components/utils/extractName.d.ts +14 -0
  64. package/dist/types/components/utils/getNextFallbackApi.d.ts +2 -2
  65. package/dist/zonos-elements/index.esm.js +1 -1
  66. package/dist/zonos-elements/p-0a7ef032.entry.js +1 -0
  67. package/dist/zonos-elements/p-0e8bdf5c.js +1 -0
  68. package/dist/zonos-elements/p-164ba7ae.system.entry.js +1 -0
  69. package/dist/zonos-elements/{p-2820aff2.system.js → p-1efc348b.system.js} +1 -1
  70. package/dist/zonos-elements/{p-6e8354c1.system.entry.js → p-242dd7ca.system.entry.js} +1 -1
  71. package/dist/zonos-elements/{p-a537a179.system.entry.js → p-300e0d47.system.entry.js} +1 -1
  72. package/dist/zonos-elements/{p-a1cd5572.system.entry.js → p-37aa481c.system.entry.js} +1 -1
  73. package/dist/zonos-elements/{p-c34645cb.js → p-425096c9.js} +1 -1
  74. package/dist/zonos-elements/{p-79a3756e.entry.js → p-4cd33d08.entry.js} +1 -1
  75. package/dist/zonos-elements/{p-e72b61c1.system.entry.js → p-57f391e6.system.entry.js} +1 -1
  76. package/dist/zonos-elements/p-58b3a0fc.entry.js +1 -0
  77. package/dist/zonos-elements/{p-f99c254c.system.js → p-608f965f.system.js} +1 -1
  78. package/dist/zonos-elements/{p-a45a15a0.js → p-65c68531.js} +1 -1
  79. package/dist/zonos-elements/{p-41ec9531.entry.js → p-680149ed.entry.js} +1 -1
  80. package/dist/zonos-elements/p-6d44f441.system.js +1 -0
  81. package/dist/zonos-elements/{p-8d37bb03.entry.js → p-7c88d2ac.entry.js} +1 -1
  82. package/dist/zonos-elements/p-81b357f7.system.js +1 -1
  83. package/dist/zonos-elements/{p-ac784ab8.system.entry.js → p-9ddb4533.system.entry.js} +1 -1
  84. package/dist/zonos-elements/{p-6c69c5fa.system.entry.js → p-a91024b6.system.entry.js} +1 -1
  85. package/dist/zonos-elements/{p-b22fcbda.system.entry.js → p-a9d41e7c.system.entry.js} +1 -1
  86. package/dist/zonos-elements/p-ad8b1fe8.entry.js +1 -0
  87. package/dist/zonos-elements/{p-c8433f89.js → p-afa4b4f0.js} +1 -1
  88. package/dist/zonos-elements/{p-4444bb4e.system.js → p-b83b382e.system.js} +1 -1
  89. package/dist/zonos-elements/{p-755cf8bc.system.js → p-c1d86f32.system.js} +1 -1
  90. package/dist/zonos-elements/{p-2eec2d7c.js → p-d93ecc57.js} +1 -1
  91. package/dist/zonos-elements/{p-752220fe.entry.js → p-dcedcdda.entry.js} +1 -1
  92. package/dist/zonos-elements/p-e11c61a5.entry.js +1 -0
  93. package/dist/zonos-elements/{p-fb898c4f.system.js → p-e17ac0d1.system.js} +1 -1
  94. package/dist/zonos-elements/{p-137ee43a.system.entry.js → p-e1a7a85f.system.entry.js} +1 -1
  95. package/dist/zonos-elements/{p-6a157c84.entry.js → p-ef34e1ce.entry.js} +1 -1
  96. package/dist/zonos-elements/{p-1d0e40b7.entry.js → p-f54123b5.entry.js} +1 -1
  97. package/dist/zonos-elements/p-f7300f5b.system.entry.js +1 -0
  98. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  99. package/package.json +1 -1
  100. package/dist/esm-es5/cart-c3540cd7.js +0 -1
  101. package/dist/zonos-elements/p-0707379c.entry.js +0 -1
  102. package/dist/zonos-elements/p-299efbcf.system.entry.js +0 -1
  103. package/dist/zonos-elements/p-6d7e45f3.entry.js +0 -1
  104. package/dist/zonos-elements/p-9004bdda.entry.js +0 -1
  105. package/dist/zonos-elements/p-9e037920.system.entry.js +0 -1
  106. package/dist/zonos-elements/p-adbc4643.system.js +0 -1
  107. package/dist/zonos-elements/p-c9c96740.entry.js +0 -1
  108. package/dist/zonos-elements/p-f979a131.js +0 -1
@@ -1,11 +1,29 @@
1
1
  'use strict';
2
2
 
3
3
  const zonosStore = require('./zonosStore-f8ee56aa.js');
4
- const localization = require('./localization-91bcde0e.js');
5
- const handleFetch = require('./handleFetch-7cf3752e.js');
4
+ const localization = require('./localization-721a5ec3.js');
5
+ const handleFetch = require('./handleFetch-0313ebba.js');
6
6
  const isDarkColor = require('./isDarkColor-428965f4.js');
7
7
  const getBorderRadius = require('./getBorderRadius-1b5e33cf.js');
8
8
 
9
+ /**
10
+ * Extract first name and last name from the name string
11
+ * If first name and last name are provided, use them
12
+ * If name is provided, extract and return the first and last name from the name string
13
+ * If neither are provided, return an empty object
14
+ */
15
+ const extractName = ({ firstName, lastName, name, }) => {
16
+ var _a;
17
+ if (!name && !firstName && !lastName) {
18
+ return { firstName: '', lastName: '' };
19
+ }
20
+ // Use first name and last name if they are provided
21
+ const nameParts = (name === null || name === void 0 ? void 0 : name.split(/\s+/)) || [];
22
+ const _firstName = (firstName === null || firstName === void 0 ? void 0 : firstName.trim()) || ((_a = nameParts[0]) === null || _a === void 0 ? void 0 : _a.trim()) || '';
23
+ const _lastName = (lastName === null || lastName === void 0 ? void 0 : lastName.trim()) || nameParts.slice(1).join(' ').trim() || '';
24
+ return { firstName: _firstName, lastName: _lastName };
25
+ };
26
+
9
27
  /**
10
28
  * Extract value from translated object
11
29
  */
@@ -45,14 +63,16 @@ const prepCartCalculateLandedCost = (cartId) => {
45
63
  currentAddress: stripeAddressData,
46
64
  translatedAddress: stripeStore.translatedAddress.address,
47
65
  });
48
- const shippingFirstName = translatedShippingAddress.name.split(' ')[0] || '';
49
- const shippingLastName = translatedShippingAddress.name.split(' ').splice(1).join(' ') || '';
66
+ const { firstName: shippingFirstName, lastName: shippingLastName } = extractName({
67
+ name: translatedShippingAddress.name,
68
+ });
50
69
  const translatedBillingAddress = getTranslatedAddress({
51
70
  currentAddress: stripeBillingAddressData,
52
71
  translatedAddress: stripeStore.translatedAddress.address,
53
72
  });
54
- const billingFirstName = translatedBillingAddress.name.split(' ')[0] || '';
55
- const billingLastName = translatedBillingAddress.name.split(' ').splice(1).join(' ') || '';
73
+ const { firstName: billingFirstName, lastName: billingLastName } = extractName({
74
+ name: translatedBillingAddress.name,
75
+ });
56
76
  return {
57
77
  billingAddress: {
58
78
  addressLine1: translatedBillingAddress.line1,
@@ -122,14 +142,16 @@ const prepCalculateLandedCost = () => {
122
142
  currentAddress: stripeAddressData,
123
143
  translatedAddress: stripeStore.translatedAddress.address,
124
144
  });
125
- const shippingFirstName = translatedShippingAddress.name.split(' ')[0] || '';
126
- const shippingLastName = translatedShippingAddress.name.split(' ').splice(1).join(' ') || '';
145
+ const { firstName: shippingFirstName, lastName: shippingLastName } = extractName({
146
+ name: translatedShippingAddress.name,
147
+ });
127
148
  const translatedBillingAddress = getTranslatedAddress({
128
149
  currentAddress: stripeBillingAddressData,
129
150
  translatedAddress: stripeStore.translatedAddress.address,
130
151
  });
131
- const billingFirstName = translatedBillingAddress.name.split(' ')[0] || '';
132
- const billingLastName = translatedBillingAddress.name.split(' ').splice(1).join(' ') || '';
152
+ const { firstName: billingFirstName, lastName: billingLastName } = extractName({
153
+ name: translatedBillingAddress.name,
154
+ });
133
155
  const convertedCartAdjuments = cartStore.adjustments.map(adjustment => ({
134
156
  amount: adjustment.amount,
135
157
  name: adjustment.description || null,
@@ -424,7 +446,6 @@ const getExcludeAddressFieldsObject = ({ address, invalidAdddressList, }) => {
424
446
  * @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.
425
447
  */
426
448
  const buildTranslateRequest = ({ addressInvalidCharactersList, billingAddressInvalidCharactersList, stripeAddressEventData, stripeBillingAddressEventData, stripeShippingSameAsBilling, }) => {
427
- var _a, _b, _c, _d;
428
449
  const isStripeAddressReady = !!(stripeAddressEventData === null || stripeAddressEventData === void 0 ? void 0 : stripeAddressEventData.complete);
429
450
  const isStripeBillingAddressReady = stripeShippingSameAsBilling
430
451
  ? isStripeAddressReady
@@ -440,15 +461,19 @@ const buildTranslateRequest = ({ addressInvalidCharactersList, billingAddressInv
440
461
  const stripeAddressValue = stripeAddressEventData.value;
441
462
  const stripeBillingAddressValue = (stripeBillingAddressEventData === null || stripeBillingAddressEventData === void 0 ? void 0 : stripeBillingAddressEventData.value) || null;
442
463
  // Returns undefined if the name is Latin so it won't be included in the request body
443
- const firstName = stripeAddressValue.firstName || ((_a = stripeAddressValue.name) === null || _a === void 0 ? void 0 : _a.split(' ')[0]);
444
- const lastName = stripeAddressValue.lastName || ((_b = stripeAddressValue.name) === null || _b === void 0 ? void 0 : _b.split(' ')[1]);
445
- const name = `${firstName} ${lastName}`;
446
- const billingFirstName = stripeAddressValue.firstName ||
447
- ((_c = stripeBillingAddressValue === null || stripeBillingAddressValue === void 0 ? void 0 : stripeBillingAddressValue.name) === null || _c === void 0 ? void 0 : _c.split(' ')[0]);
448
- const billingLastName = stripeAddressValue.lastName ||
449
- ((_d = stripeBillingAddressValue === null || stripeBillingAddressValue === void 0 ? void 0 : stripeBillingAddressValue.name) === null || _d === void 0 ? void 0 : _d.split(' ')[1]);
450
- const billingName = billingFirstName && billingLastName
451
- ? `${billingFirstName} ${billingLastName}`
464
+ const { firstName: stripeShippingFirstName, lastName: stripeShippingLastName, } = extractName({
465
+ firstName: stripeAddressValue.firstName,
466
+ lastName: stripeAddressValue.lastName,
467
+ name: stripeAddressValue.name,
468
+ });
469
+ const name = `${stripeShippingFirstName} ${stripeShippingLastName}`;
470
+ const { firstName: stripeBillingFirstName, lastName: stripeBillingLastName } = extractName({
471
+ firstName: stripeBillingAddressValue === null || stripeBillingAddressValue === void 0 ? void 0 : stripeBillingAddressValue.firstName,
472
+ lastName: stripeBillingAddressValue === null || stripeBillingAddressValue === void 0 ? void 0 : stripeBillingAddressValue.lastName,
473
+ name: (stripeBillingAddressValue === null || stripeBillingAddressValue === void 0 ? void 0 : stripeBillingAddressValue.name) || '',
474
+ });
475
+ const billingName = stripeBillingFirstName && stripeBillingLastName
476
+ ? `${stripeBillingFirstName} ${stripeBillingLastName}`
452
477
  : '';
453
478
  const address = stripeAddressValue.address;
454
479
  const billingAddress = stripeBillingAddressValue === null || stripeBillingAddressValue === void 0 ? void 0 : stripeBillingAddressValue.address;
@@ -785,8 +810,11 @@ const checkIsAddressOutdatedForAsyncAddressUpdate = () => {
785
810
  isCompanyNameDirty);
786
811
  };
787
812
  const buildAddressForPartyCreate = ({ address, firstName, lastName, name, phone, }) => {
788
- const _firstName = (name === null || name === void 0 ? void 0 : name.split(' ')[0]) || firstName || '';
789
- const _lastName = (name === null || name === void 0 ? void 0 : name.split(' ')[1]) || lastName || '';
813
+ const { firstName: _firstName, lastName: _lastName } = extractName({
814
+ firstName,
815
+ lastName,
816
+ name,
817
+ });
790
818
  if (!_firstName || !_lastName) {
791
819
  void handleFetch.sendErrorLog({
792
820
  endpoint: 'PARTY_CREATE_NO_NAME_FOUND',
@@ -2163,6 +2191,7 @@ exports.cartStoreStartCheckoutInterval = cartStoreStartCheckoutInterval;
2163
2191
  exports.cartStoreUpdateItems = cartStoreUpdateItems;
2164
2192
  exports.cartStoreUpdateSelectedShippingOption = cartStoreUpdateSelectedShippingOption;
2165
2193
  exports.cartStoreUpdateToErrorState = cartStoreUpdateToErrorState;
2194
+ exports.extractName = extractName;
2166
2195
  exports.getCheckoutSessionBody = getCheckoutSessionBody;
2167
2196
  exports.initStripeElements = initStripeElements;
2168
2197
  exports.sortServiceLevelOptionsByAmount = sortServiceLevelOptionsByAmount;
@@ -88,7 +88,7 @@ const getIsTestMode = () => {
88
88
  window.location.search.includes('zonosTestMode=1');
89
89
  };
90
90
 
91
- const fallbackApiType = ['cloudflare', 'vercel'];
91
+ const fallbackApiType = ['vercel', 'cloudflare'];
92
92
  const MAIN_BASE_API_TYPE = fallbackApiType[0];
93
93
  const fallbackApiList = {
94
94
  cloudflare: "https://route.elements.zonos.com",
@@ -433,9 +433,9 @@ const handleRequestWithFallback = async ({ basePathType: _basePathType, options,
433
433
  (message.includes('signal is aborted') ||
434
434
  message.includes('The operation was aborted') ||
435
435
  message.includes('Fetch is aborted')));
436
- const isUnknownError = !!unknownError || (response === null || response === void 0 ? void 0 : response.status) === 404;
436
+ const isUnknownError = !!unknownError || (response === null || response === void 0 ? void 0 : response.status) === 404 || (response === null || response === void 0 ? void 0 : response.status) === 500;
437
437
  const shouldCallFallback =
438
- // If next fallback is available, and the error is unknown (Failed to fetch) or 404
438
+ // If next fallback is available, and the error is unknown (Failed to fetch) or 404 or 500 (server error)
439
439
  nextFallbackApiType && isUnknownError;
440
440
  // Should log the error if it's unknown error
441
441
  if (isUnknownError && !isAbortError) {
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const createCustomEvent = require('./createCustomEvent-7b6fad95.js');
6
6
  const getGenericSettingsOverride = require('./getGenericSettingsOverride-c0ca32b9.js');
7
- const handleFetch = require('./handleFetch-7cf3752e.js');
7
+ const handleFetch = require('./handleFetch-0313ebba.js');
8
8
  const CheckoutConfig = require('./CheckoutConfig-27c82f94.js');
9
9
  const VarianceTest = require('./VarianceTest-0cb1e118.js');
10
10
  const TaxId = require('./TaxId-12acedde.js');
@@ -132,7 +132,7 @@ const getZonosQaUrl = () => {
132
132
  return null;
133
133
  }
134
134
  const qaUrl = extractZonosQaUrl(window.location.href);
135
- const cdnUrl = "https://v1.3.215.js.zonos.com";
135
+ const cdnUrl = "https://v1.3.217.js.zonos.com";
136
136
  // when the qaUrl is not set and the built URL is from the test domain, use the test domain for testing
137
137
  if (!qaUrl &&
138
138
  (cdnUrl.includes('test.') ||
@@ -375,10 +375,10 @@ const zonosLoadUrl = (() => {
375
375
  }
376
376
  return null;
377
377
  })();
378
- const ZONOS_URL = "https://v1.3.215.js.zonos.com";
379
- const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.215";
380
- const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.215";
381
- const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.215";
378
+ const ZONOS_URL = "https://v1.3.217.js.zonos.com";
379
+ const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.217";
380
+ const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.217";
381
+ const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.217";
382
382
  const GOOGLE_FONT_URL = 'https://fonts.googleapis.com';
383
383
  const GOOGLE_FONT_REGEX = /^https:\/\/fonts\.googleapis\.com/;
384
384
  class Zonos {
@@ -396,7 +396,7 @@ Zonos.iframeLogType = typeof window !== 'undefined'
396
396
  ? new URLSearchParams(window.location.search).get('iframeLogType')
397
397
  : null;
398
398
  Zonos.isBigCommerce = false;
399
- Zonos.releaseDate = "1749655878701";
399
+ Zonos.releaseDate = "1749758631773";
400
400
  Zonos.isLegacyCheckout = false;
401
401
  Zonos.domain = typeof window !== 'undefined'
402
402
  ? // domain that embeds the iframe
@@ -414,7 +414,7 @@ Zonos.isNpm = true;
414
414
  Zonos.zonosQaUrl = null;
415
415
  Zonos.zonosQaUrlApi = null;
416
416
  Zonos.trackEventLogs = [];
417
- Zonos.version = `v${"1.3.215"}`;
417
+ Zonos.version = `v${"1.3.217"}`;
418
418
  Zonos.modeAlerted = false;
419
419
  Zonos.cartData = null;
420
420
  Zonos.paypal = null;
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  const zonosStore = require('./zonosStore-f8ee56aa.js');
4
- const handleFetch = require('./handleFetch-7cf3752e.js');
4
+ const handleFetch = require('./handleFetch-0313ebba.js');
5
5
  const VarianceTest = require('./VarianceTest-0cb1e118.js');
6
6
 
7
7
  /**
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
3
  const zonosStore = require('./zonosStore-f8ee56aa.js');
4
- const cart = require('./cart-e0b62259.js');
5
- const localization = require('./localization-91bcde0e.js');
6
- const handleFetch = require('./handleFetch-7cf3752e.js');
4
+ const cart = require('./cart-54ff39d6.js');
5
+ const localization = require('./localization-721a5ec3.js');
6
+ const handleFetch = require('./handleFetch-0313ebba.js');
7
7
  const isDarkColor = require('./isDarkColor-428965f4.js');
8
8
 
9
9
  /*!
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  const debounce = require('./debounce-465a4328.js');
4
- const handleFetch = require('./handleFetch-7cf3752e.js');
4
+ const handleFetch = require('./handleFetch-0313ebba.js');
5
5
 
6
6
  const attributesToUpdate = {};
7
7
  // Store debounced functions per session to ensure proper debouncing
@@ -5,9 +5,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  const index = require('./index-1c710d00.js');
6
6
  const debounce$1 = require('./debounce-465a4328.js');
7
7
  const zonosStore = require('./zonosStore-f8ee56aa.js');
8
- const cart = require('./cart-e0b62259.js');
9
- const localization = require('./localization-91bcde0e.js');
10
- const handleFetch = require('./handleFetch-7cf3752e.js');
8
+ const cart = require('./cart-54ff39d6.js');
9
+ const localization = require('./localization-721a5ec3.js');
10
+ const handleFetch = require('./handleFetch-0313ebba.js');
11
11
  const shouldRenderTaxIdInput = require('./shouldRenderTaxIdInput-9b8a8de1.js');
12
12
  const TaxId = require('./TaxId-12acedde.js');
13
13
  const classes = require('./classes-b7918f56.js');
@@ -273,8 +273,14 @@ const ZonosAddress$1 = class {
273
273
  }
274
274
  }, 600);
275
275
  }
276
+ const { firstName, lastName } = cart.extractName({
277
+ firstName: eventValue.firstName,
278
+ lastName: eventValue.lastName,
279
+ name: eventValue.name,
280
+ });
276
281
  this.updateAddressEventData({
277
- 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] }) }),
282
+ event: Object.assign(Object.assign({}, event), { elementMode: this.type, elementType: 'address', value: Object.assign(Object.assign({}, eventValue), { firstName,
283
+ lastName }) }),
278
284
  type: this.type,
279
285
  });
280
286
  });
@@ -378,7 +384,7 @@ const ZonosAddress$1 = class {
378
384
  this.isAddressFilled = true;
379
385
  }
380
386
  // this component loads iframe from the stripe elements and puts here, so we don't need to do anything here
381
- return (index.h(index.Host, { key: '6cb2f40dc810982251bdb24bd373ef5dc5b26cd2', class: "zonos--address zonos--elements" }, index.h("zonos-text", { key: 'f7b393a508bc5f1921924090c365cdf41f23f0e7', class: "zonos--title", type: "semiBoldLabel" }, this.titleText), this.renderCompanyNameInput(), this.renderTaxIdInput(), index.h("div", { key: '9bd11de0b90f7ad7328cf37694c7d4e2a2d73f06', class: "zonos--address-component" })));
387
+ return (index.h(index.Host, { key: '13b9fdc214b7ffeacaa180f1ba0d49032b417b6f', class: "zonos--address zonos--elements" }, index.h("zonos-text", { key: '7a6ec3c462293e85926b0f379860d8d4edfe6120', class: "zonos--title", type: "semiBoldLabel" }, this.titleText), this.renderCompanyNameInput(), this.renderTaxIdInput(), index.h("div", { key: '36c094186e6ce2ce1d1c4e8f56823fd032b3ad9e', class: "zonos--address-component" })));
382
388
  }
383
389
  get el() { return index.getElement(this); }
384
390
  static get watchers() { return {
@@ -443,18 +449,18 @@ const ZonosAddressForm = class {
443
449
  }
444
450
  render() {
445
451
  const { city, country, line1, line2, name, phone, postal_code, state } = this.localAddress;
446
- const firstName = name.split(' ')[0] || '';
447
- // get the rest of the name if it exists
448
- const lastName = name.split(' ').slice(1).join(' ') || '';
449
- return (index.h(index.Host, { key: '8b578737e33203a23563be7e9be0778deec99bbf', class: "zonos--address-form zonos--elements" }, index.h("div", { key: '793675a1348547bf3f781788956befe325191011', class: "zonos--title" }, index.h("zonos-text", { key: '13de35cb0a7c98a48342e3fb86ae3ade9f5b88d9', textColor: "gray-700", type: "smallHeader" }, this.addressType === 'shipping'
452
+ const { firstName, lastName } = cart.extractName({
453
+ name,
454
+ });
455
+ return (index.h(index.Host, { key: '22d085e462e69a4100a8cb1763367f53b933ed1d', class: "zonos--address-form zonos--elements" }, index.h("div", { key: '17d6c92370343ffbd1b4a85b3c49055a5a7f9d72', class: "zonos--title" }, index.h("zonos-text", { key: 'a4cb01bd8fed154567e0b7ade87777a1552ea815', textColor: "gray-700", type: "smallHeader" }, this.addressType === 'shipping'
450
456
  ? localization.translate('Shipping')
451
- : localization.translate('Billing'))), index.h("div", { key: '2c5de5b5283fb99ee5f8b61d7a217177986fc2db', class: "zonos--address-group" }, index.h("div", { key: '23bf3c893071000d5995a5f175867bab11929193', class: "zonos--contact" }, index.h("zonos-text", { key: '7cdfe2a84ebad89ba5b16498d75def99cf392384', type: "label" }, localization.translate('Contact')), index.h("zonos-input", { key: '1c39c38767fd306c5eb1164cdc989b8291209cf0', class: "zonos--form-email", inputLabel: localization.translate('Email'), inputValue: this.currentAddress.email, isDisabled: true }), index.h("div", { key: 'cbdf61217125e22b1a6cec9a340ef0aca2c75670', class: "zonos--name zonos--address-row" }, index.h("zonos-input", { key: '360c99e7b2c6caa64580d5768b5bb53368927275', class: "zonos--form-first-name", inputLabel: localization.translate('First name'), inputValue: firstName, isError: shouldRenderTaxIdInput.isTextContainsNonLatinChars(firstName), onInputChange: e => this.onInputChange({
457
+ : localization.translate('Billing'))), index.h("div", { key: '4a1dddabc011e465d295b5c2994fda3a2531c96e', class: "zonos--address-group" }, index.h("div", { key: '60df882b5717b2f557a5051f492b2c838f938cd9', class: "zonos--contact" }, index.h("zonos-text", { key: '90b6613ccf1b2a445baae5f700f392d195924688', type: "label" }, localization.translate('Contact')), index.h("zonos-input", { key: '125815769a366e113b61d5581578ef6ecbdffa79', class: "zonos--form-email", inputLabel: localization.translate('Email'), inputValue: this.currentAddress.email, isDisabled: true }), index.h("div", { key: 'd0d331fb33f40243ce23824db5ba9551fd5636f8', class: "zonos--name zonos--address-row" }, index.h("zonos-input", { key: '46323db8f305e491215df03ef2092e76eec38355', class: "zonos--form-first-name", inputLabel: localization.translate('First name'), inputValue: firstName, isError: shouldRenderTaxIdInput.isTextContainsNonLatinChars(firstName), onInputChange: e => this.onInputChange({
452
458
  key: 'name',
453
459
  value: `${e.detail} ${lastName}`,
454
- }) }), index.h("zonos-input", { key: '8ce5fa5c15c6f7928339ea10009ce0e68954a91f', class: "zonos--form-last-name", inputLabel: localization.translate('Last name'), inputValue: lastName, isError: shouldRenderTaxIdInput.isTextContainsNonLatinChars(lastName), onInputChange: e => this.onInputChange({
460
+ }) }), index.h("zonos-input", { key: '3c055ee2f1fcaf93ebcbd8f11ad6609cd33e9e14', class: "zonos--form-last-name", inputLabel: localization.translate('Last name'), inputValue: lastName, isError: shouldRenderTaxIdInput.isTextContainsNonLatinChars(lastName), onInputChange: e => this.onInputChange({
455
461
  key: 'name',
456
462
  value: `${firstName} ${e.detail}`,
457
- }) }))), index.h("div", { key: '7b4fa2d3baa6cb257e7688e5ba6777123898b3fd', class: "zonos--address" }, index.h("zonos-text", { key: '9d5782331b2642755a755aeb7f98c9f4d87f9a20', type: "label" }, localization.translate('Address')), index.h("zonos-input", { key: 'a622025924ca86bdbf1d3c04b79e6dee172b4c42', class: "zonos--form-country", inputLabel: localization.translate('Country'), inputValue: country, isDisabled: true }), index.h("zonos-input", { key: 'f99b3a74db09ab5730878e80705b9aeac76bf800', class: "zonos--form-line1", inputLabel: localization.translate('Address line 1'), inputValue: line1, isError: shouldRenderTaxIdInput.isTextContainsNonLatinChars(line1), onInputChange: e => this.onInputChange({ key: 'line1', value: e.detail }) }), index.h("zonos-input", { key: '5d16aefa45a78045c87d166aaaec0255606e455e', class: "zonos--form-line2", inputLabel: localization.translate('Address line 2'), inputValue: line2, isError: shouldRenderTaxIdInput.isTextContainsNonLatinChars(line2), onInputChange: e => this.onInputChange({ key: 'line2', value: e.detail }) }), index.h("div", { key: 'dc166be9381142835d72e731cb38a718522a068a', class: "zonos--address-row" }, index.h("zonos-input", { key: '4f1a98f9d10ce0cff3ef18a3037a12382552b31d', class: "zonos--form-city", inputLabel: localization.translate('City'), inputValue: city, isError: shouldRenderTaxIdInput.isTextContainsNonLatinChars(city), onInputChange: e => this.onInputChange({ key: 'city', value: e.detail }) }), index.h("zonos-input", { key: 'd4f97900b5fe2e1619950a52d1d1f716a8bc19ff', class: "zonos--form-state", inputLabel: localization.translate('State/Province'), inputValue: state, isError: shouldRenderTaxIdInput.isTextContainsNonLatinChars(state), onInputChange: e => this.onInputChange({ key: 'state', value: e.detail }) })), index.h("zonos-input", { key: 'cf1eb0ca5cd15c8412a2e1246aaf2e39361dc733', class: "zonos--form-postal-code", inputLabel: localization.translate('Postal code'), inputValue: postal_code, isError: shouldRenderTaxIdInput.isTextContainsNonLatinChars(postal_code), onInputChange: e => this.onInputChange({ key: 'postal_code', value: e.detail }) }), index.h("zonos-input", { key: '7421c82847eded6bdbcce49ef8196124d8e50c1d', class: "zonos--form-phone", inputLabel: localization.translate('Phone number'), inputValue: phone, onInputChange: e => this.onInputChange({ key: 'phone', value: e.detail }) })))));
463
+ }) }))), index.h("div", { key: 'ce30f816d03b497eb4491d2554eb63c0aabf110c', class: "zonos--address" }, index.h("zonos-text", { key: '304867c5354ac55071c88944a63bba88ea3fb86f', type: "label" }, localization.translate('Address')), index.h("zonos-input", { key: 'f0efe937603a38761643af1486b53359a19593e5', class: "zonos--form-country", inputLabel: localization.translate('Country'), inputValue: country, isDisabled: true }), index.h("zonos-input", { key: '8360a4ae65c8963e886a3fb8322e0e539d121142', class: "zonos--form-line1", inputLabel: localization.translate('Address line 1'), inputValue: line1, isError: shouldRenderTaxIdInput.isTextContainsNonLatinChars(line1), onInputChange: e => this.onInputChange({ key: 'line1', value: e.detail }) }), index.h("zonos-input", { key: '2c9374917b705c2c9306d3d4d7fc4b4043c2b73b', class: "zonos--form-line2", inputLabel: localization.translate('Address line 2'), inputValue: line2, isError: shouldRenderTaxIdInput.isTextContainsNonLatinChars(line2), onInputChange: e => this.onInputChange({ key: 'line2', value: e.detail }) }), index.h("div", { key: 'fd067074070cadba3d895503f35c344ff817fec2', class: "zonos--address-row" }, index.h("zonos-input", { key: 'a565bee68e2498403df2801eb90005e8cb2d6f44', class: "zonos--form-city", inputLabel: localization.translate('City'), inputValue: city, isError: shouldRenderTaxIdInput.isTextContainsNonLatinChars(city), onInputChange: e => this.onInputChange({ key: 'city', value: e.detail }) }), index.h("zonos-input", { key: '89bae75b691aacdd62b624f65eee303bfb3fc811', class: "zonos--form-state", inputLabel: localization.translate('State/Province'), inputValue: state, isError: shouldRenderTaxIdInput.isTextContainsNonLatinChars(state), onInputChange: e => this.onInputChange({ key: 'state', value: e.detail }) })), index.h("zonos-input", { key: '9a851b9f449ed135859b7b828bf362168caf76fb', class: "zonos--form-postal-code", inputLabel: localization.translate('Postal code'), inputValue: postal_code, isError: shouldRenderTaxIdInput.isTextContainsNonLatinChars(postal_code), onInputChange: e => this.onInputChange({ key: 'postal_code', value: e.detail }) }), index.h("zonos-input", { key: 'a51b8ba1e22d5a12eac9021abe83fdc20f8eb1a6', class: "zonos--form-phone", inputLabel: localization.translate('Phone number'), inputValue: phone, onInputChange: e => this.onInputChange({ key: 'phone', value: e.detail }) })))));
458
464
  }
459
465
  static get watchers() { return {
460
466
  "translatedAddress": ["watchCurrentAddress"]
@@ -1254,14 +1260,17 @@ const ZonosAddress = class {
1254
1260
  // Use data from default address if it's available
1255
1261
  const firstDefaultAddress = this.defaultAddress[0];
1256
1262
  if (firstDefaultAddress) {
1263
+ const { firstName, lastName } = cart.extractName({
1264
+ name: firstDefaultAddress.name,
1265
+ });
1257
1266
  const countryCode = firstDefaultAddress.address.country ||
1258
1267
  localization.localizationStore.selectedCountryCode ||
1259
1268
  'US';
1260
1269
  this.setFormValues({
1261
1270
  city: firstDefaultAddress.address.city,
1262
1271
  country: countryCode,
1263
- firstName: firstDefaultAddress.name.split(' ')[0] || '',
1264
- lastName: firstDefaultAddress.name.split(' ')[1] || '',
1272
+ firstName,
1273
+ lastName,
1265
1274
  line1: firstDefaultAddress.address.line1,
1266
1275
  line2: firstDefaultAddress.address.line2 || '',
1267
1276
  phone: firstDefaultAddress.phone || '',
@@ -1729,10 +1738,10 @@ const ZonosAddress = class {
1729
1738
  this.country = localization.localizationStore.selectedCountryCode;
1730
1739
  }
1731
1740
  // this component loads iframe from the stripe elements and puts here, so we don't need to do anything here
1732
- return (index.h(index.Host, { key: '668f481c1b31dd6e756d95b5c382592681cea23d', class: classes.classes([
1741
+ return (index.h(index.Host, { key: '9e1d9e1ed3fca30876ba8310510873a5b10c6552', class: classes.classes([
1733
1742
  'zonos--address zonos--elements',
1734
1743
  `zonos--${this.type}-address`,
1735
- ]) }, index.h("zonos-text", { key: 'a31cd25d43d9262d408e6ced8330cbe1c51bdd47', class: "zonos--title", type: "semiBoldLabel" }, this.titleText), this.renderCompanyNameInput(), this.renderTaxIdInput(), this.renderCustomAddressForm()));
1744
+ ]) }, index.h("zonos-text", { key: '2356d42946b3ed93c4670fb876101a1371ac5c14', class: "zonos--title", type: "semiBoldLabel" }, this.titleText), this.renderCompanyNameInput(), this.renderTaxIdInput(), this.renderCustomAddressForm()));
1736
1745
  }
1737
1746
  get el() { return index.getElement(this); }
1738
1747
  static get watchers() { return {
@@ -3,18 +3,18 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-1c710d00.js');
6
- const cart = require('./cart-e0b62259.js');
7
- const localization = require('./localization-91bcde0e.js');
6
+ const cart = require('./cart-54ff39d6.js');
7
+ const localization = require('./localization-721a5ec3.js');
8
8
  const classes = require('./classes-b7918f56.js');
9
9
  const zonosStore = require('./zonosStore-f8ee56aa.js');
10
- const paypal = require('./paypal-93e5de01.js');
11
- const handleFetch = require('./handleFetch-7cf3752e.js');
10
+ const paypal = require('./paypal-e7504122.js');
11
+ const handleFetch = require('./handleFetch-0313ebba.js');
12
12
  const createCustomEvent = require('./createCustomEvent-7b6fad95.js');
13
13
  const getBorderRadius = require('./getBorderRadius-1b5e33cf.js');
14
14
  const ILanguage = require('./ILanguage-98b04442.js');
15
15
  const isDarkColor = require('./isDarkColor-428965f4.js');
16
16
  const isColorVariable = require('./isColorVariable-525dbfa7.js');
17
- const updateCheckoutSessionAttributes = require('./updateCheckoutSessionAttributes-047bc0cb.js');
17
+ const updateCheckoutSessionAttributes = require('./updateCheckoutSessionAttributes-8db49644.js');
18
18
  const shouldRenderTaxIdInput = require('./shouldRenderTaxIdInput-9b8a8de1.js');
19
19
  const TaxId = require('./TaxId-12acedde.js');
20
20
  require('./VarianceTest-0cb1e118.js');
@@ -2448,11 +2448,14 @@ const ZonosCustomerInfo = class {
2448
2448
  if (!stripeEventDataObj || !submitDataByKey) {
2449
2449
  return;
2450
2450
  }
2451
+ const { firstName, lastName } = cart.extractName({
2452
+ name: submitDataByKey.name,
2453
+ });
2451
2454
  const updateData = Object.assign(Object.assign({}, stripeEventDataObj), { complete: true, value: Object.assign(Object.assign({}, stripeEventDataObj === null || stripeEventDataObj === void 0 ? void 0 : stripeEventDataObj.value), { address: Object.assign(Object.assign({}, stripeEventDataObj === null || stripeEventDataObj === void 0 ? void 0 : stripeEventDataObj.value.address), { city: submitDataByKey.city ||
2452
2455
  (stripeEventDataObj === null || stripeEventDataObj === void 0 ? void 0 : stripeEventDataObj.value.address.city) ||
2453
- '', line1: submitDataByKey.line1, line2: submitDataByKey.line2, postal_code: submitDataByKey.postal_code, state: submitDataByKey.state }), firstName: submitDataByKey.name.split(' ')[0],
2456
+ '', line1: submitDataByKey.line1, line2: submitDataByKey.line2, postal_code: submitDataByKey.postal_code, state: submitDataByKey.state }), firstName,
2454
2457
  // get all the names after
2455
- lastName: submitDataByKey.name.split(' ').slice(1).join(' '), name: submitDataByKey.name }) });
2458
+ lastName, name: submitDataByKey.name }) });
2456
2459
  // overwrite the address object with the new data
2457
2460
  if (type === 'shippingAddress') {
2458
2461
  cart.stripeStore.stripeAddressEventData = updateData;
@@ -3,12 +3,12 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-1c710d00.js');
6
- const cart = require('./cart-e0b62259.js');
7
- const paypal = require('./paypal-93e5de01.js');
8
- const localization = require('./localization-91bcde0e.js');
6
+ const cart = require('./cart-54ff39d6.js');
7
+ const paypal = require('./paypal-e7504122.js');
8
+ const localization = require('./localization-721a5ec3.js');
9
9
  const zonosStore = require('./zonosStore-f8ee56aa.js');
10
- const handleFetch = require('./handleFetch-7cf3752e.js');
11
- const updateCheckoutSessionAttributes = require('./updateCheckoutSessionAttributes-047bc0cb.js');
10
+ const handleFetch = require('./handleFetch-0313ebba.js');
11
+ const updateCheckoutSessionAttributes = require('./updateCheckoutSessionAttributes-8db49644.js');
12
12
  const CheckoutConfig = require('./CheckoutConfig-27c82f94.js');
13
13
  const classes = require('./classes-b7918f56.js');
14
14
  const createCustomEvent = require('./createCustomEvent-7b6fad95.js');
@@ -3,11 +3,11 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-1c710d00.js');
6
- const cart = require('./cart-e0b62259.js');
7
- const localization = require('./localization-91bcde0e.js');
6
+ const cart = require('./cart-54ff39d6.js');
7
+ const localization = require('./localization-721a5ec3.js');
8
8
  const zonosStore = require('./zonosStore-f8ee56aa.js');
9
9
  const getGenericSettingsOverride = require('./getGenericSettingsOverride-c0ca32b9.js');
10
- const handleFetch = require('./handleFetch-7cf3752e.js');
10
+ const handleFetch = require('./handleFetch-0313ebba.js');
11
11
  require('./isDarkColor-428965f4.js');
12
12
  require('./getBorderRadius-1b5e33cf.js');
13
13
  require('./VarianceTest-0cb1e118.js');
@@ -3,10 +3,10 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-1c710d00.js');
6
- const localization = require('./localization-91bcde0e.js');
6
+ const localization = require('./localization-721a5ec3.js');
7
7
  const zonosStore = require('./zonosStore-f8ee56aa.js');
8
8
  const classes = require('./classes-b7918f56.js');
9
- require('./handleFetch-7cf3752e.js');
9
+ require('./handleFetch-0313ebba.js');
10
10
  require('./VarianceTest-0cb1e118.js');
11
11
 
12
12
  const zonosCountryFlagCss = ":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:-ms-inline-flexbox;display:inline-flex}:host .flag-container{position:relative;overflow:hidden;width:100%;height:100%}:host .flag-icon{position:absolute;top:0;left:0;width:100%;height:100%;background-position:center;background-repeat:no-repeat;background-size:cover}";
@@ -3,13 +3,13 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-1c710d00.js');
6
- const localization = require('./localization-91bcde0e.js');
6
+ const localization = require('./localization-721a5ec3.js');
7
7
  const zonosStore = require('./zonosStore-f8ee56aa.js');
8
8
  const formatStringWithLinks = require('./formatStringWithLinks-52341fc7.js');
9
9
  const isDarkColor = require('./isDarkColor-428965f4.js');
10
10
  const ILanguage = require('./ILanguage-98b04442.js');
11
11
  const classes = require('./classes-b7918f56.js');
12
- require('./handleFetch-7cf3752e.js');
12
+ require('./handleFetch-0313ebba.js');
13
13
  require('./VarianceTest-0cb1e118.js');
14
14
 
15
15
  /**
@@ -6,10 +6,10 @@ const index = require('./index-1c710d00.js');
6
6
  const zonosStore = require('./zonosStore-f8ee56aa.js');
7
7
  const classes = require('./classes-b7918f56.js');
8
8
  const getBorderRadius = require('./getBorderRadius-1b5e33cf.js');
9
- const cart = require('./cart-e0b62259.js');
10
- const localization = require('./localization-91bcde0e.js');
11
- const handleFetch = require('./handleFetch-7cf3752e.js');
12
- const paypal = require('./paypal-93e5de01.js');
9
+ const cart = require('./cart-54ff39d6.js');
10
+ const localization = require('./localization-721a5ec3.js');
11
+ const handleFetch = require('./handleFetch-0313ebba.js');
12
+ const paypal = require('./paypal-e7504122.js');
13
13
  require('./VarianceTest-0cb1e118.js');
14
14
  require('./isDarkColor-428965f4.js');
15
15
 
@@ -3,13 +3,13 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-1c710d00.js');
6
- const localization = require('./localization-91bcde0e.js');
6
+ const localization = require('./localization-721a5ec3.js');
7
7
  const zonosStore = require('./zonosStore-f8ee56aa.js');
8
8
  const classes = require('./classes-b7918f56.js');
9
9
  const formatStringWithLinks = require('./formatStringWithLinks-52341fc7.js');
10
10
  const getHasMoreSpaceOnRight = require('./getHasMoreSpaceOnRight-4c94667f.js');
11
11
  const TaxId = require('./TaxId-12acedde.js');
12
- require('./handleFetch-7cf3752e.js');
12
+ require('./handleFetch-0313ebba.js');
13
13
  require('./VarianceTest-0cb1e118.js');
14
14
 
15
15
  const getHasMoreSpaceAbove = (ref) => {
@@ -4,10 +4,10 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-1c710d00.js');
6
6
  const debounce = require('./debounce-465a4328.js');
7
- const localization = require('./localization-91bcde0e.js');
7
+ const localization = require('./localization-721a5ec3.js');
8
8
  const zonosStore = require('./zonosStore-f8ee56aa.js');
9
9
  const classes = require('./classes-b7918f56.js');
10
- const handleFetch = require('./handleFetch-7cf3752e.js');
10
+ const handleFetch = require('./handleFetch-0313ebba.js');
11
11
  const getHasMoreSpaceOnRight = require('./getHasMoreSpaceOnRight-4c94667f.js');
12
12
  require('./VarianceTest-0cb1e118.js');
13
13
 
@@ -3,10 +3,10 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-1c710d00.js');
6
- const localization = require('./localization-91bcde0e.js');
6
+ const localization = require('./localization-721a5ec3.js');
7
7
  const zonosStore = require('./zonosStore-f8ee56aa.js');
8
8
  const ILanguage = require('./ILanguage-98b04442.js');
9
- require('./handleFetch-7cf3752e.js');
9
+ require('./handleFetch-0313ebba.js');
10
10
  require('./VarianceTest-0cb1e118.js');
11
11
 
12
12
  const GreenCheckDuotoneIcon = `<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
@@ -1,6 +1,7 @@
1
1
  import { h, Host, } from "@stencil/core";
2
2
  import { translate } from "../../../../store/translationStore";
3
3
  import { isTextContainsNonLatinChars } from "../../../../utils/containsNonLatinChars";
4
+ import { extractName } from "../../../../utils/extractName";
4
5
  export class ZonosAddressForm {
5
6
  constructor() {
6
7
  /**
@@ -23,18 +24,18 @@ export class ZonosAddressForm {
23
24
  }
24
25
  render() {
25
26
  const { city, country, line1, line2, name, phone, postal_code, state } = this.localAddress;
26
- const firstName = name.split(' ')[0] || '';
27
- // get the rest of the name if it exists
28
- const lastName = name.split(' ').slice(1).join(' ') || '';
29
- 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'
27
+ const { firstName, lastName } = extractName({
28
+ name,
29
+ });
30
+ 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'
30
31
  ? translate('Shipping')
31
- : 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({
32
+ : 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({
32
33
  key: 'name',
33
34
  value: `${e.detail} ${lastName}`,
34
- }) }), h("zonos-input", { key: '8ce5fa5c15c6f7928339ea10009ce0e68954a91f', class: "zonos--form-last-name", inputLabel: translate('Last name'), inputValue: lastName, isError: isTextContainsNonLatinChars(lastName), onInputChange: e => this.onInputChange({
35
+ }) }), h("zonos-input", { key: '3c055ee2f1fcaf93ebcbd8f11ad6609cd33e9e14', class: "zonos--form-last-name", inputLabel: translate('Last name'), inputValue: lastName, isError: isTextContainsNonLatinChars(lastName), onInputChange: e => this.onInputChange({
35
36
  key: 'name',
36
37
  value: `${firstName} ${e.detail}`,
37
- }) }))), 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 }) })))));
38
+ }) }))), 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 }) })))));
38
39
  }
39
40
  static get is() { return "zonos-address-form"; }
40
41
  static get encapsulation() { return "shadow"; }
@@ -7,6 +7,7 @@ import { translate } from "../../../store/translationStore";
7
7
  import { getZonosStoreTheme, zonosStore, zonosStoreOnChange, } from "../../../store/zonosStore";
8
8
  import { updateCheckoutSessionAttributes } from "../../../utils/api/updateCheckoutSessionAttributes";
9
9
  import { containsNonLatinChars } from "../../../utils/containsNonLatinChars";
10
+ import { extractName } from "../../../utils/extractName";
10
11
  import { log } from "../../../utils/logging/log";
11
12
  import { sendErrorLog } from "../../../utils/logging/sendErrorLog";
12
13
  import { taxIdValidationResult } from "../../../utils/taxIdValidationResult";
@@ -105,11 +106,14 @@ export class ZonosCustomerInfo {
105
106
  if (!stripeEventDataObj || !submitDataByKey) {
106
107
  return;
107
108
  }
109
+ const { firstName, lastName } = extractName({
110
+ name: submitDataByKey.name,
111
+ });
108
112
  const updateData = Object.assign(Object.assign({}, stripeEventDataObj), { complete: true, value: Object.assign(Object.assign({}, stripeEventDataObj === null || stripeEventDataObj === void 0 ? void 0 : stripeEventDataObj.value), { address: Object.assign(Object.assign({}, stripeEventDataObj === null || stripeEventDataObj === void 0 ? void 0 : stripeEventDataObj.value.address), { city: submitDataByKey.city ||
109
113
  (stripeEventDataObj === null || stripeEventDataObj === void 0 ? void 0 : stripeEventDataObj.value.address.city) ||
110
- '', line1: submitDataByKey.line1, line2: submitDataByKey.line2, postal_code: submitDataByKey.postal_code, state: submitDataByKey.state }), firstName: submitDataByKey.name.split(' ')[0],
114
+ '', line1: submitDataByKey.line1, line2: submitDataByKey.line2, postal_code: submitDataByKey.postal_code, state: submitDataByKey.state }), firstName,
111
115
  // get all the names after
112
- lastName: submitDataByKey.name.split(' ').slice(1).join(' '), name: submitDataByKey.name }) });
116
+ lastName, name: submitDataByKey.name }) });
113
117
  // overwrite the address object with the new data
114
118
  if (type === 'shippingAddress') {
115
119
  stripeStore.stripeAddressEventData = updateData;