@zonos/elements 1.3.144 → 1.3.146

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 (90) hide show
  1. package/dist/cjs/{cart-2398abd4.js → cart-a262c92c.js} +6 -4
  2. package/dist/cjs/index.cjs.js +7 -7
  3. package/dist/cjs/{paypal-7ed9dfb7.js → paypal-0895372a.js} +1 -1
  4. package/dist/cjs/zonos-address_8.cjs.entry.js +2 -2
  5. package/dist/cjs/zonos-cart-items_13.cjs.entry.js +3 -3
  6. package/dist/cjs/zonos-checkout.cjs.entry.js +80 -24
  7. package/dist/cjs/zonos-controller.cjs.entry.js +31 -4
  8. package/dist/cjs/zonos-country-flag.cjs.entry.js +1 -1
  9. package/dist/cjs/zonos-country-select_4.cjs.entry.js +1 -1
  10. package/dist/cjs/zonos-empty-state-payment_4.cjs.entry.js +2 -2
  11. package/dist/cjs/zonos-hello-dialog.cjs.entry.js +1 -1
  12. package/dist/cjs/zonos-hello.cjs.entry.js +1 -1
  13. package/dist/cjs/zonos-language-select_2.cjs.entry.js +1 -1
  14. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +78 -22
  15. package/dist/collection/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.css +1 -0
  16. package/dist/collection/components/main/zonos-controller.js +30 -3
  17. package/dist/collection/components/store/translationStore/strings.danish.js +1 -1
  18. package/dist/collection/components/store/translationStore/strings.korean.js +1 -1
  19. package/dist/collection/components/store/translationStore/strings.russian.js +1 -1
  20. package/dist/collection/components/stripe/zonos-link-authentication/zonos-link-authentication.js +1 -1
  21. package/dist/collection/components/utils/hello/getZCountryUrlParam.js +3 -1
  22. package/dist/esm/{cart-3427ee25.js → cart-a0b95207.js} +6 -4
  23. package/dist/esm/index.js +7 -7
  24. package/dist/esm/{paypal-4e2f9753.js → paypal-f1005b82.js} +1 -1
  25. package/dist/esm/zonos-address_8.entry.js +2 -2
  26. package/dist/esm/zonos-cart-items_13.entry.js +3 -3
  27. package/dist/esm/zonos-checkout.entry.js +80 -24
  28. package/dist/esm/zonos-controller.entry.js +31 -4
  29. package/dist/esm/zonos-country-flag.entry.js +1 -1
  30. package/dist/esm/zonos-country-select_4.entry.js +1 -1
  31. package/dist/esm/zonos-empty-state-payment_4.entry.js +2 -2
  32. package/dist/esm/zonos-hello-dialog.entry.js +1 -1
  33. package/dist/esm/zonos-hello.entry.js +1 -1
  34. package/dist/esm/zonos-language-select_2.entry.js +1 -1
  35. package/dist/esm-es5/{cart-3427ee25.js → cart-a0b95207.js} +1 -1
  36. package/dist/esm-es5/index.js +1 -1
  37. package/dist/esm-es5/{paypal-4e2f9753.js → paypal-f1005b82.js} +1 -1
  38. package/dist/esm-es5/zonos-address_8.entry.js +1 -1
  39. package/dist/esm-es5/zonos-cart-items_13.entry.js +1 -1
  40. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  41. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  42. package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
  43. package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
  44. package/dist/esm-es5/zonos-empty-state-payment_4.entry.js +1 -1
  45. package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
  46. package/dist/esm-es5/zonos-hello.entry.js +1 -1
  47. package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
  48. package/dist/scripts/index.d.ts +20 -1
  49. package/dist/scripts/index.js +1 -1
  50. package/dist/scripts/loadZonos.js +1 -1
  51. package/dist/scripts/zonos.js +1 -1
  52. package/dist/types/components/checkout/zonos-checkout/zonos-checkout.d.ts +2 -0
  53. package/dist/types/components/main/zonos-controller.d.ts +1 -0
  54. package/dist/types/types/checkout/CheckoutConfig.d.ts +20 -1
  55. package/dist/types/types/generated/graphql.internal.types.d.ts +12 -10
  56. package/dist/types/types/generated/graphql.internal.types.ts +12 -10
  57. package/dist/zonos-elements/assets/RemoveIcon.svg +1 -1
  58. package/dist/zonos-elements/index.esm.js +1 -1
  59. package/dist/zonos-elements/{p-0e6a3cd2.system.js → p-0101da8c.system.js} +1 -1
  60. package/dist/zonos-elements/{p-e2f1fa53.entry.js → p-07a8a124.entry.js} +1 -1
  61. package/dist/zonos-elements/{p-485d89a4.js → p-0ab922d1.js} +1 -1
  62. package/dist/zonos-elements/{p-9e05e259.system.entry.js → p-0f02083d.system.entry.js} +1 -1
  63. package/dist/zonos-elements/{p-ea35b237.system.entry.js → p-23ea1883.system.entry.js} +1 -1
  64. package/dist/zonos-elements/{p-f3b0a097.system.js → p-2d152241.system.js} +1 -1
  65. package/dist/zonos-elements/{p-e01ccb27.entry.js → p-2d450227.entry.js} +1 -1
  66. package/dist/zonos-elements/p-4456cc80.entry.js +1 -0
  67. package/dist/zonos-elements/{p-7e47f6cf.entry.js → p-469dd116.entry.js} +1 -1
  68. package/dist/zonos-elements/p-46f6e5e9.system.js +1 -1
  69. package/dist/zonos-elements/{p-50896f89.entry.js → p-576f95f8.entry.js} +1 -1
  70. package/dist/zonos-elements/p-60ea5e25.system.entry.js +1 -0
  71. package/dist/zonos-elements/{p-d6061c79.entry.js → p-68f80c51.entry.js} +1 -1
  72. package/dist/zonos-elements/{p-bb92882d.system.entry.js → p-6ad1541e.system.entry.js} +1 -1
  73. package/dist/zonos-elements/p-89dcf124.system.entry.js +1 -0
  74. package/dist/zonos-elements/{p-5834c218.system.js → p-931d7fb7.system.js} +1 -1
  75. package/dist/zonos-elements/{p-7302a081.system.entry.js → p-9e934cc7.system.entry.js} +1 -1
  76. package/dist/zonos-elements/{p-2deae669.entry.js → p-ae95877a.entry.js} +1 -1
  77. package/dist/zonos-elements/p-badca4a1.entry.js +1 -0
  78. package/dist/zonos-elements/{p-48bca3d4.system.entry.js → p-bcc65b55.system.entry.js} +1 -1
  79. package/dist/zonos-elements/{p-1423ebbe.js → p-c23e256e.js} +1 -1
  80. package/dist/zonos-elements/{p-a8cf3542.system.entry.js → p-d2214283.system.entry.js} +1 -1
  81. package/dist/zonos-elements/{p-84e5fc0b.entry.js → p-d2477bcf.entry.js} +1 -1
  82. package/dist/zonos-elements/{p-c8b0bc02.system.entry.js → p-d787a694.system.entry.js} +1 -1
  83. package/dist/zonos-elements/{p-463e44b6.system.entry.js → p-e619ff1e.system.entry.js} +1 -1
  84. package/dist/zonos-elements/{p-00136c20.entry.js → p-ff8d0109.entry.js} +1 -1
  85. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  86. package/package.json +1 -1
  87. package/dist/zonos-elements/p-515e3606.system.entry.js +0 -1
  88. package/dist/zonos-elements/p-9951462e.entry.js +0 -1
  89. package/dist/zonos-elements/p-b262b93e.entry.js +0 -1
  90. package/dist/zonos-elements/p-da6a29e4.system.entry.js +0 -1
@@ -1576,7 +1576,7 @@ const stringsDanish = {
1576
1576
  value: 'Ingen lande fundet',
1577
1577
  },
1578
1578
  'No payment method needed for staging': {
1579
- value: 'Ingen betalingsmetode nødvendig for iscenesættelse',
1579
+ value: 'Ingen betalingsmetode nødvendig til iscenesættelse',
1580
1580
  },
1581
1581
  'No shipment rating selected. Please go back to the "Shipping" step and select a shipment rating to proceed.': {
1582
1582
  value: 'Ingen forsendelsesvurdering valgt. Gå venligst tilbage til "Forsendelse"-trinnet og vælg en forsendelsesvurdering for at fortsætte.',
@@ -5296,7 +5296,7 @@ const stringsKorean = {
5296
5296
  value: '국가를 찾을 수 없습니다',
5297
5297
  },
5298
5298
  'No payment method needed for staging': {
5299
- value: '스테이징에 결제 방법이 필요하지 않습니다',
5299
+ value: '스테이징에 결제 수단이 필요하지 않습니다',
5300
5300
  },
5301
5301
  'No shipment rating selected. Please go back to the "Shipping" step and select a shipment rating to proceed.': {
5302
5302
  value: '배송 등급이 선택되지 않았습니다. "배송" 단계로 돌아가서 배송 등급을 선택하여 진행하세요.',
@@ -7156,7 +7156,7 @@ const stringsRussian = {
7156
7156
  value: 'Страны не найдены',
7157
7157
  },
7158
7158
  'No payment method needed for staging': {
7159
- value: 'Способ оплаты не требуется для постановки',
7159
+ value: 'Для постановки не требуется способ оплаты',
7160
7160
  },
7161
7161
  'No shipment rating selected. Please go back to the "Shipping" step and select a shipment rating to proceed.': {
7162
7162
  value: 'Не выбран рейтинг доставки. Пожалуйста, вернитесь к шагу "Доставка" и выберите рейтинг доставки, чтобы продолжить.',
@@ -9508,7 +9508,9 @@ const getZCountryUrlParam = (urlParams) => {
9508
9508
  const zCountry = getCountryParam('zCountry');
9509
9509
  // Fallback to legacy 'country'
9510
9510
  const fallback = getCountryParam('country');
9511
- return zCountry || fallback;
9511
+ // Fallback to customerCountry
9512
+ const secondFallback = getCountryParam('customerCountry');
9513
+ return zCountry || fallback || secondFallback;
9512
9514
  };
9513
9515
 
9514
9516
  const getLocalization = async () => {
@@ -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.144.js.zonos.com";
132
+ const cdnUrl = "https://v1.3.146.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.') ||
@@ -313,10 +313,10 @@ const zonosLoadUrl = (() => {
313
313
  }
314
314
  return null;
315
315
  })();
316
- const ZONOS_URL = "https://v1.3.144.js.zonos.com";
317
- const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.144";
318
- const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.144";
319
- const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.144";
316
+ const ZONOS_URL = "https://v1.3.146.js.zonos.com";
317
+ const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.146";
318
+ const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.146";
319
+ const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.146";
320
320
  const GOOGLE_FONT_URL = 'https://fonts.googleapis.com';
321
321
  const GOOGLE_FONT_REGEX = /^https:\/\/fonts\.googleapis\.com/;
322
322
  class Zonos {
@@ -330,7 +330,7 @@ Zonos.zonosConversionTest = typeof window !== 'undefined' &&
330
330
  !!window.location.search.match(/\?.*(&*)zonosConversionTest/);
331
331
  Zonos._paypalMockResponse = null;
332
332
  Zonos.isBigCommerce = false;
333
- Zonos.releaseDate = "1735934720716";
333
+ Zonos.releaseDate = "1736455756547";
334
334
  Zonos.isLegacyCheckout = false;
335
335
  Zonos.domain = typeof window !== 'undefined'
336
336
  ? // domain that embeds the iframe
@@ -346,7 +346,7 @@ Zonos.showBaseForeign = typeof window !== 'undefined' &&
346
346
  Zonos.isNpm = true;
347
347
  Zonos.zonosQaUrl = null;
348
348
  Zonos.zonosQaUrlApi = null;
349
- Zonos.version = `v${"1.3.144"}`;
349
+ Zonos.version = `v${"1.3.146"}`;
350
350
  Zonos.modeAlerted = false;
351
351
  Zonos.cartData = null;
352
352
  Zonos.paypal = null;
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  const zonosStore = require('./zonosStore-46809186.js');
4
- const cart = require('./cart-2398abd4.js');
4
+ const cart = require('./cart-a262c92c.js');
5
5
  const handleFetch = require('./handleFetch-3673a0c2.js');
6
6
  const isDarkColor = require('./isDarkColor-2acf30d1.js');
7
7
 
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-2f90486e.js');
6
- const cart = require('./cart-2398abd4.js');
6
+ const cart = require('./cart-a262c92c.js');
7
7
  const isCheckoutMobile = require('./isCheckoutMobile-f491ca7c.js');
8
8
  const handleFetch = require('./handleFetch-3673a0c2.js');
9
9
  const containsNonLatinChars = require('./containsNonLatinChars-2be5129b.js');
@@ -585,7 +585,7 @@ const ZonosLinkAuthentication = class {
585
585
  return;
586
586
  }
587
587
  // No need to initialize link if this is staging mode since we will render the email input field
588
- if (cart.cartStore.isStagingMode) {
588
+ if (cart.cartStore.isStagingMode || !this.clientSecret) {
589
589
  return;
590
590
  }
591
591
  const defaultValues = this.defaultEmail
@@ -3,9 +3,9 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-2f90486e.js');
6
- const cart = require('./cart-2398abd4.js');
6
+ const cart = require('./cart-a262c92c.js');
7
7
  const classes = require('./classes-b7918f56.js');
8
- const paypal = require('./paypal-7ed9dfb7.js');
8
+ const paypal = require('./paypal-0895372a.js');
9
9
  const zonosStore = require('./zonosStore-46809186.js');
10
10
  const handleFetch = require('./handleFetch-3673a0c2.js');
11
11
  const createCustomEvent = require('./createCustomEvent-7b6fad95.js');
@@ -2133,7 +2133,7 @@ const ZonosCurrencyToggle = class {
2133
2133
  static get assetsDirs() { return ["assets"]; }
2134
2134
  };
2135
2135
 
2136
- const zonosCustomerInfoCss = ".sc-zonos-customer-info-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-customer-info-h *.sc-zonos-customer-info{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-customer-info-h img.sc-zonos-customer-info{max-width:100%}.sc-zonos-customer-info-h dl.sc-zonos-customer-info,.sc-zonos-customer-info-h dd.sc-zonos-customer-info,.sc-zonos-customer-info-h h1.sc-zonos-customer-info,.sc-zonos-customer-info-h h2.sc-zonos-customer-info,.sc-zonos-customer-info-h h3.sc-zonos-customer-info,.sc-zonos-customer-info-h h4.sc-zonos-customer-info,.sc-zonos-customer-info-h h5.sc-zonos-customer-info,.sc-zonos-customer-info-h h6.sc-zonos-customer-info,.sc-zonos-customer-info-h hr.sc-zonos-customer-info,.sc-zonos-customer-info-h figure.sc-zonos-customer-info,.sc-zonos-customer-info-h p.sc-zonos-customer-info,.sc-zonos-customer-info-h pre.sc-zonos-customer-info{margin:0}.sc-zonos-customer-info-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-customer-info-h{overflow:hidden;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}.sc-zonos-customer-info-h .zonos--title.sc-zonos-customer-info{margin-bottom:20px}.sc-zonos-customer-info-h .zonos--link-authentication.sc-zonos-customer-info{margin-bottom:32px}.sc-zonos-customer-info-h .zonos--address.sc-zonos-customer-info{margin-bottom:16px}.sc-zonos-customer-info-h .zonos--checkbox.sc-zonos-customer-info{margin-bottom:16px}.sc-zonos-customer-info-h .zonos--checkbox.sc-zonos-customer-info+.zonos--address.sc-zonos-customer-info{margin-bottom:0}.sc-zonos-customer-info-h zonos-button.sc-zonos-customer-info{-webkit-box-shadow:0 0 1px 0 var(--zonos-elements-gray-600);box-shadow:0 0 1px 0 var(--zonos-elements-gray-600)}.sc-zonos-customer-info-h .zonos--error-banner.sc-zonos-customer-info{margin-bottom:16px}.sc-zonos-customer-info-h .zonos--tax-id-input.sc-zonos-customer-info{margin-bottom:16px}.sc-zonos-customer-info-h .zonos--group.sc-zonos-customer-info{margin-bottom:20px;overflow:auto;padding:5px;-ms-scroll-chaining:none;overscroll-behavior:contain}.sc-zonos-customer-info-h .zonos--group.sc-zonos-customer-info::-webkit-scrollbar{width:10px}.sc-zonos-customer-info-h .zonos--group.sc-zonos-customer-info::-webkit-scrollbar-track{background:var(--zonos-elements-gray-50)}.sc-zonos-customer-info-h .zonos--group.sc-zonos-customer-info::-webkit-scrollbar-thumb{border-radius:10px;background:#cccccc;border:3px solid transparent;background-clip:content-box}.sc-zonos-customer-info-h .zonos--group.sc-zonos-customer-info::-webkit-scrollbar-thumb:hover{background:#d6d6d6}.sc-zonos-customer-info-h .zonos--group-btn.sc-zonos-customer-info{position:-webkit-sticky;position:sticky;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;bottom:-5px;padding-top:8px;margin-top:12px;background:var(--zonos--primary-color, var(--zonos-elements-gray-0))}.sc-zonos-customer-info-h .zonos--group-btn.sc-zonos-customer-info zonos-button.sc-zonos-customer-info{width:100%}";
2136
+ const zonosCustomerInfoCss = ".sc-zonos-customer-info-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-customer-info-h *.sc-zonos-customer-info{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-customer-info-h img.sc-zonos-customer-info{max-width:100%}.sc-zonos-customer-info-h dl.sc-zonos-customer-info,.sc-zonos-customer-info-h dd.sc-zonos-customer-info,.sc-zonos-customer-info-h h1.sc-zonos-customer-info,.sc-zonos-customer-info-h h2.sc-zonos-customer-info,.sc-zonos-customer-info-h h3.sc-zonos-customer-info,.sc-zonos-customer-info-h h4.sc-zonos-customer-info,.sc-zonos-customer-info-h h5.sc-zonos-customer-info,.sc-zonos-customer-info-h h6.sc-zonos-customer-info,.sc-zonos-customer-info-h hr.sc-zonos-customer-info,.sc-zonos-customer-info-h figure.sc-zonos-customer-info,.sc-zonos-customer-info-h p.sc-zonos-customer-info,.sc-zonos-customer-info-h pre.sc-zonos-customer-info{margin:0}.sc-zonos-customer-info-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-customer-info-h{overflow:hidden;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}.sc-zonos-customer-info-h .zonos--title.sc-zonos-customer-info{margin-bottom:20px}.sc-zonos-customer-info-h .zonos--link-authentication.sc-zonos-customer-info{margin-bottom:32px}.sc-zonos-customer-info-h .zonos--address.sc-zonos-customer-info{margin-bottom:16px}.sc-zonos-customer-info-h .zonos--checkbox.sc-zonos-customer-info{margin-bottom:16px}.sc-zonos-customer-info-h .zonos--checkbox.sc-zonos-customer-info+.zonos--address.sc-zonos-customer-info{margin-bottom:0}.sc-zonos-customer-info-h zonos-button.sc-zonos-customer-info{-webkit-box-shadow:0 0 1px 0 var(--zonos-elements-gray-600);box-shadow:0 0 1px 0 var(--zonos-elements-gray-600)}.sc-zonos-customer-info-h .zonos--error-banner.sc-zonos-customer-info{margin-bottom:16px}.sc-zonos-customer-info-h .zonos--tax-id-input.sc-zonos-customer-info{margin-bottom:16px}.sc-zonos-customer-info-h .zonos--group.sc-zonos-customer-info{margin-bottom:20px;overflow:auto;padding:5px;-ms-scroll-chaining:none;overscroll-behavior:contain}.sc-zonos-customer-info-h .zonos--group.sc-zonos-customer-info::-webkit-scrollbar{width:10px}.sc-zonos-customer-info-h .zonos--group.sc-zonos-customer-info::-webkit-scrollbar-track{background:var(--zonos-elements-gray-50)}.sc-zonos-customer-info-h .zonos--group.sc-zonos-customer-info::-webkit-scrollbar-thumb{border-radius:10px;background:#cccccc;border:3px solid transparent;background-clip:content-box}.sc-zonos-customer-info-h .zonos--group.sc-zonos-customer-info::-webkit-scrollbar-thumb:hover{background:#d6d6d6}.sc-zonos-customer-info-h .zonos--group-btn.sc-zonos-customer-info{position:-webkit-sticky;position:sticky;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;bottom:-5px;padding-top:8px;margin-top:12px;background:var(--zonos--primary-color, var(--zonos-elements-gray-0));z-index:1}.sc-zonos-customer-info-h .zonos--group-btn.sc-zonos-customer-info zonos-button.sc-zonos-customer-info{width:100%}";
2137
2137
  const ZonosCustomerInfoStyle0 = zonosCustomerInfoCss;
2138
2138
 
2139
2139
  const ZonosCustomerInfo = class {
@@ -3,8 +3,8 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-2f90486e.js');
6
- const cart = require('./cart-2398abd4.js');
7
- const paypal = require('./paypal-7ed9dfb7.js');
6
+ const cart = require('./cart-a262c92c.js');
7
+ const paypal = require('./paypal-0895372a.js');
8
8
  const zonosStore = require('./zonosStore-46809186.js');
9
9
  const handleFetch = require('./handleFetch-3673a0c2.js');
10
10
  const isCheckoutMobile = require('./isCheckoutMobile-f491ca7c.js');
@@ -442,21 +442,20 @@ const ZonosCheckout = class {
442
442
  (_b = (_a = zonosStore.zonosStore.checkoutSettings).onClose) === null || _b === void 0 ? void 0 : _b.call(_a);
443
443
  }
444
444
  async buildCartAndInit() {
445
- // if tempCartUUID is provided, use it instead of buildCartDetail
446
- if (window.Zonos.cartData) {
447
- handleFetch.log('tempCartUUID is provided, start building cart');
448
- const isExpired = this.handleCartExpiredCheck();
449
- if (isExpired) {
450
- // Do not proceed if the cart is expired
451
- return false;
452
- }
453
- const { adjustments, cartItems } = buildCartItemsByTempCart(window.Zonos.cartData);
454
- await cart.cartStoreUpdateItems({ adjustments, cartItems });
455
- }
456
445
  // if createCartId is provided, use it to build cart. Merchant will provide create a cart from their server side and give the cart id to us.
457
- else if (typeof zonosStore.zonosStore.checkoutSettings.createCartId === 'function') {
446
+ if (typeof zonosStore.zonosStore.checkoutSettings.createCartId === 'function') {
458
447
  handleFetch.log('"createCartId" is provided, start building cart');
459
- const cartId = await zonosStore.zonosStore.checkoutSettings.createCartId();
448
+ const cartIdResult = await zonosStore.zonosStore.checkoutSettings.createCartId();
449
+ let cartId;
450
+ if (typeof cartIdResult === 'object') {
451
+ handleFetch.log('object detected, use cartId and prefill address from createCartId');
452
+ cartId = cartIdResult.cartId;
453
+ // set prefill address if provided in createCartId callback result
454
+ this.useShippingDataFromCreateCartId(cartIdResult.shippingData);
455
+ }
456
+ else {
457
+ cartId = cartIdResult;
458
+ }
460
459
  window.Zonos.cartId = cartId;
461
460
  const cartResult = await CheckoutConfig.setupCartData(cartId);
462
461
  const cartData = cartResult === null || cartResult === void 0 ? void 0 : cartResult.cartData;
@@ -473,6 +472,17 @@ const ZonosCheckout = class {
473
472
  const { adjustments, cartItems } = buildCartItemsByTempCart(cartData);
474
473
  await cart.cartStoreUpdateItems({ adjustments, cartItems });
475
474
  }
475
+ // if tempCartUUID is provided, use it instead of buildCartDetail
476
+ else if (window.Zonos.cartData) {
477
+ handleFetch.log('tempCartUUID is provided, start building cart');
478
+ const isExpired = this.handleCartExpiredCheck();
479
+ if (isExpired) {
480
+ // Do not proceed if the cart is expired
481
+ return false;
482
+ }
483
+ const { adjustments, cartItems } = buildCartItemsByTempCart(window.Zonos.cartData);
484
+ await cart.cartStoreUpdateItems({ adjustments, cartItems });
485
+ }
476
486
  else if (zonosStore.zonosStore.checkoutSettings.buildCartDetail &&
477
487
  cart.localizationStore.selectedCountryCode) {
478
488
  handleFetch.log('build cart detail');
@@ -707,6 +717,30 @@ const ZonosCheckout = class {
707
717
  // apply theme to stripe elements
708
718
  void this.applyStripeTheme();
709
719
  }
720
+ useShippingDataFromCreateCartId(prefillAddress) {
721
+ // Do only if prefill address is provided
722
+ if (!prefillAddress) {
723
+ return;
724
+ }
725
+ handleFetch.log('shipping data from createCartId result', 'info', Object.entries(prefillAddress));
726
+ const { customerAddress1, customerAddress2, customerCity, customerCountry, customerEmail, customerName, customerPhone, customerState, customerZip, } = prefillAddress;
727
+ const urlParams = new URLSearchParams(window.location.search);
728
+ const country = // fallback to selected country code if country is not provided
729
+ customerCountry ||
730
+ cart.getZCountryUrlParam(urlParams) ||
731
+ cart.localizationStore.selectedCountryCode;
732
+ this.applyPrefillAddress({
733
+ customerAddress1,
734
+ customerAddress2,
735
+ customerCity,
736
+ customerCountry: country,
737
+ customerEmail,
738
+ customerName,
739
+ customerPhone,
740
+ customerState,
741
+ customerZip,
742
+ });
743
+ }
710
744
  /**
711
745
  * Set default address from query param if it's valid
712
746
  */
@@ -720,17 +754,39 @@ const ZonosCheckout = class {
720
754
  }
721
755
  return value;
722
756
  };
723
- const country =
757
+ const customerCountry =
724
758
  // fallback to selected country code if country is not provided
725
759
  cart.getZCountryUrlParam(urlParams) || cart.localizationStore.selectedCountryCode;
726
- const city = getParam('customerCity');
727
- const email = getParam('customerEmail') || '';
728
- const line1 = getParam('customerAddress1');
729
- const line2 = getParam('customerAddress2') || '';
730
- const name = getParam('customerName');
731
- const phone = getParam('customerPhone');
732
- const postal_code = getParam('customerZip') || '';
733
- const state = getParam('customerState') || '';
760
+ const customerCity = getParam('customerCity');
761
+ const customerEmail = getParam('customerEmail');
762
+ const customerAddress1 = getParam('customerAddress1');
763
+ const customerAddress2 = getParam('customerAddress2');
764
+ const customerName = getParam('customerName');
765
+ const customerPhone = getParam('customerPhone');
766
+ const customerZip = getParam('customerZip');
767
+ const customerState = getParam('customerState');
768
+ this.applyPrefillAddress({
769
+ customerAddress1,
770
+ customerAddress2,
771
+ customerCity,
772
+ customerCountry,
773
+ customerEmail,
774
+ customerName,
775
+ customerPhone,
776
+ customerState,
777
+ customerZip,
778
+ });
779
+ }
780
+ applyPrefillAddress({ customerAddress1, customerAddress2, customerCity, customerCountry, customerEmail, customerName, customerPhone, customerState, customerZip, }) {
781
+ const line1 = customerAddress1 || '';
782
+ const country = customerCountry || '';
783
+ const line2 = customerAddress2 || '';
784
+ const city = customerCity || '';
785
+ const email = customerEmail || '';
786
+ const name = customerName || '';
787
+ const phone = customerPhone || '';
788
+ const postal_code = customerZip || '';
789
+ const state = customerState || '';
734
790
  /**
735
791
  * If one of the value is null, no need to preset the default address.
736
792
  * City and state are optional (they are not always provided for example Puerto Rico)
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-2f90486e.js');
6
- const cart = require('./cart-2398abd4.js');
6
+ const cart = require('./cart-a262c92c.js');
7
7
  const zonosStore = require('./zonosStore-46809186.js');
8
8
  const handleFetch = require('./handleFetch-3673a0c2.js');
9
9
  require('./isDarkColor-2acf30d1.js');
@@ -243,17 +243,44 @@ const ZonosController = class {
243
243
  return oldReplaceState.apply(this, arguments);
244
244
  };
245
245
  }
246
+ injectCustomHTML(htmlString) {
247
+ if (!htmlString) {
248
+ return;
249
+ }
250
+ // Skip injecting custom HTML for legacy checkout
251
+ if (!window.Zonos.isLegacyCheckout) {
252
+ handleFetch.log('=== Skip injecting custom HTML for hosted checkout', 'info');
253
+ return;
254
+ }
255
+ handleFetch.log('=== Injecting custom HTML for hosted checkout');
256
+ const template = document.createElement('template');
257
+ template.innerHTML = htmlString;
258
+ const scripts = template.content.querySelectorAll('script');
259
+ scripts.forEach(script => {
260
+ const scriptToInject = document.createElement('script');
261
+ if (script.src) {
262
+ scriptToInject.src = script.src;
263
+ scriptToInject.async = script.async;
264
+ }
265
+ else {
266
+ scriptToInject.textContent = script.innerHTML;
267
+ }
268
+ document.body.appendChild(scriptToInject);
269
+ });
270
+ }
246
271
  async componentWillLoad() {
247
272
  this.initHistoryListener();
248
273
  zonosStore.zonosStore.zonosApiKey = this.zonosApiKey;
249
274
  // running with scope async function to avoid blocking the main thread
250
275
  (async () => {
251
- var _a, _b;
276
+ var _a, _b, _c;
252
277
  const { errors, json, zonosMode } = await getZonosSettings();
253
278
  if (((_a = errors[0]) === null || _a === void 0 ? void 0 : _a.type.toString()) === '403') {
254
279
  handleFetch.log('Failed to load zonos settings. This domain may not have access', 'warn');
255
280
  return;
256
281
  }
282
+ const customHTML = ((_b = json === null || json === void 0 ? void 0 : json.checkoutSettings) === null || _b === void 0 ? void 0 : _b.customHTML) || '';
283
+ this.injectCustomHTML(customHTML);
257
284
  // init zonos notification
258
285
  this.initZonosNotification();
259
286
  const getLogoUrl = () => {
@@ -288,7 +315,7 @@ const ZonosController = class {
288
315
  // init localization store
289
316
  await cart.initLocalizationStore();
290
317
  // checkout init
291
- const publishableKey = ((_b = json === null || json === void 0 ? void 0 : json.checkoutSettings) === null || _b === void 0 ? void 0 : _b.externalServiceTokens.find(item => item.type === 'STRIPE_PUBLISHABLE_TOKEN')) || null;
318
+ const publishableKey = ((_c = json === null || json === void 0 ? void 0 : json.checkoutSettings) === null || _c === void 0 ? void 0 : _c.externalServiceTokens.find(item => item.type === 'STRIPE_PUBLISHABLE_TOKEN')) || null;
292
319
  if (!publishableKey || !this.stripeInitEvent) {
293
320
  handleFetch.log('Checkout failed to load -- missing publishable key', 'warn');
294
321
  return;
@@ -357,7 +384,7 @@ const ZonosController = class {
357
384
  zonosStore.zonosStore.organizationName = organizationName;
358
385
  }
359
386
  render() {
360
- return index.h(index.Host, { key: 'ab190aefdb7b90e03ec8f4f2da73a05c3416c776', class: "zonos--elements" });
387
+ return index.h(index.Host, { key: '001f728dc41550b734fd1b5c9cf15f43c0c4cbdb', class: "zonos--elements" });
361
388
  }
362
389
  };
363
390
  ZonosController.style = ZonosControllerStyle0;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-2f90486e.js');
6
- const cart = require('./cart-2398abd4.js');
6
+ const cart = require('./cart-a262c92c.js');
7
7
  const zonosStore = require('./zonosStore-46809186.js');
8
8
  const classes = require('./classes-b7918f56.js');
9
9
  require('./handleFetch-3673a0c2.js');
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-2f90486e.js');
6
- const cart = require('./cart-2398abd4.js');
6
+ const cart = require('./cart-a262c92c.js');
7
7
  const zonosStore = require('./zonosStore-46809186.js');
8
8
  const formatStringWithLinks = require('./formatStringWithLinks-52341fc7.js');
9
9
  const isDarkColor = require('./isDarkColor-2acf30d1.js');
@@ -6,9 +6,9 @@ const index = require('./index-2f90486e.js');
6
6
  const zonosStore = require('./zonosStore-46809186.js');
7
7
  const classes = require('./classes-b7918f56.js');
8
8
  const getBorderRadius = require('./getBorderRadius-7d0772bf.js');
9
- const cart = require('./cart-2398abd4.js');
9
+ const cart = require('./cart-a262c92c.js');
10
10
  const handleFetch = require('./handleFetch-3673a0c2.js');
11
- const paypal = require('./paypal-7ed9dfb7.js');
11
+ const paypal = require('./paypal-0895372a.js');
12
12
  require('./isDarkColor-2acf30d1.js');
13
13
 
14
14
  const PaymentEmptyStateDarkIcon = `<svg width="536" height="200" viewBox="0 0 536 200" fill="none" xmlns="http://www.w3.org/2000/svg">
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-2f90486e.js');
6
- const cart = require('./cart-2398abd4.js');
6
+ const cart = require('./cart-a262c92c.js');
7
7
  const zonosStore = require('./zonosStore-46809186.js');
8
8
  const classes = require('./classes-b7918f56.js');
9
9
  const formatStringWithLinks = require('./formatStringWithLinks-52341fc7.js');
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-2f90486e.js');
6
6
  const zonosStore = require('./zonosStore-46809186.js');
7
- const cart = require('./cart-2398abd4.js');
7
+ const cart = require('./cart-a262c92c.js');
8
8
  const classes = require('./classes-b7918f56.js');
9
9
  const handleFetch = require('./handleFetch-3673a0c2.js');
10
10
  const getHasMoreSpaceOnRight = require('./getHasMoreSpaceOnRight-4c94667f.js');
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-2f90486e.js');
6
- const cart = require('./cart-2398abd4.js');
6
+ const cart = require('./cart-a262c92c.js');
7
7
  const zonosStore = require('./zonosStore-46809186.js');
8
8
  const ILanguage = require('./ILanguage-98b04442.js');
9
9
  require('./handleFetch-3673a0c2.js');
@@ -232,21 +232,20 @@ export class ZonosCheckout {
232
232
  (_b = (_a = zonosStore.checkoutSettings).onClose) === null || _b === void 0 ? void 0 : _b.call(_a);
233
233
  }
234
234
  async buildCartAndInit() {
235
- // if tempCartUUID is provided, use it instead of buildCartDetail
236
- if (window.Zonos.cartData) {
237
- log('tempCartUUID is provided, start building cart');
238
- const isExpired = this.handleCartExpiredCheck();
239
- if (isExpired) {
240
- // Do not proceed if the cart is expired
241
- return false;
242
- }
243
- const { adjustments, cartItems } = buildCartItemsByTempCart(window.Zonos.cartData);
244
- await cartStoreUpdateItems({ adjustments, cartItems });
245
- }
246
235
  // if createCartId is provided, use it to build cart. Merchant will provide create a cart from their server side and give the cart id to us.
247
- else if (typeof zonosStore.checkoutSettings.createCartId === 'function') {
236
+ if (typeof zonosStore.checkoutSettings.createCartId === 'function') {
248
237
  log('"createCartId" is provided, start building cart');
249
- const cartId = await zonosStore.checkoutSettings.createCartId();
238
+ const cartIdResult = await zonosStore.checkoutSettings.createCartId();
239
+ let cartId;
240
+ if (typeof cartIdResult === 'object') {
241
+ log('object detected, use cartId and prefill address from createCartId');
242
+ cartId = cartIdResult.cartId;
243
+ // set prefill address if provided in createCartId callback result
244
+ this.useShippingDataFromCreateCartId(cartIdResult.shippingData);
245
+ }
246
+ else {
247
+ cartId = cartIdResult;
248
+ }
250
249
  window.Zonos.cartId = cartId;
251
250
  const cartResult = await setupCartData(cartId);
252
251
  const cartData = cartResult === null || cartResult === void 0 ? void 0 : cartResult.cartData;
@@ -263,6 +262,17 @@ export class ZonosCheckout {
263
262
  const { adjustments, cartItems } = buildCartItemsByTempCart(cartData);
264
263
  await cartStoreUpdateItems({ adjustments, cartItems });
265
264
  }
265
+ // if tempCartUUID is provided, use it instead of buildCartDetail
266
+ else if (window.Zonos.cartData) {
267
+ log('tempCartUUID is provided, start building cart');
268
+ const isExpired = this.handleCartExpiredCheck();
269
+ if (isExpired) {
270
+ // Do not proceed if the cart is expired
271
+ return false;
272
+ }
273
+ const { adjustments, cartItems } = buildCartItemsByTempCart(window.Zonos.cartData);
274
+ await cartStoreUpdateItems({ adjustments, cartItems });
275
+ }
266
276
  else if (zonosStore.checkoutSettings.buildCartDetail &&
267
277
  localizationStore.selectedCountryCode) {
268
278
  log('build cart detail');
@@ -497,6 +507,30 @@ export class ZonosCheckout {
497
507
  // apply theme to stripe elements
498
508
  void this.applyStripeTheme();
499
509
  }
510
+ useShippingDataFromCreateCartId(prefillAddress) {
511
+ // Do only if prefill address is provided
512
+ if (!prefillAddress) {
513
+ return;
514
+ }
515
+ log('shipping data from createCartId result', 'info', Object.entries(prefillAddress));
516
+ const { customerAddress1, customerAddress2, customerCity, customerCountry, customerEmail, customerName, customerPhone, customerState, customerZip, } = prefillAddress;
517
+ const urlParams = new URLSearchParams(window.location.search);
518
+ const country = // fallback to selected country code if country is not provided
519
+ customerCountry ||
520
+ getZCountryUrlParam(urlParams) ||
521
+ localizationStore.selectedCountryCode;
522
+ this.applyPrefillAddress({
523
+ customerAddress1,
524
+ customerAddress2,
525
+ customerCity,
526
+ customerCountry: country,
527
+ customerEmail,
528
+ customerName,
529
+ customerPhone,
530
+ customerState,
531
+ customerZip,
532
+ });
533
+ }
500
534
  /**
501
535
  * Set default address from query param if it's valid
502
536
  */
@@ -510,17 +544,39 @@ export class ZonosCheckout {
510
544
  }
511
545
  return value;
512
546
  };
513
- const country =
547
+ const customerCountry =
514
548
  // fallback to selected country code if country is not provided
515
549
  getZCountryUrlParam(urlParams) || localizationStore.selectedCountryCode;
516
- const city = getParam('customerCity');
517
- const email = getParam('customerEmail') || '';
518
- const line1 = getParam('customerAddress1');
519
- const line2 = getParam('customerAddress2') || '';
520
- const name = getParam('customerName');
521
- const phone = getParam('customerPhone');
522
- const postal_code = getParam('customerZip') || '';
523
- const state = getParam('customerState') || '';
550
+ const customerCity = getParam('customerCity');
551
+ const customerEmail = getParam('customerEmail');
552
+ const customerAddress1 = getParam('customerAddress1');
553
+ const customerAddress2 = getParam('customerAddress2');
554
+ const customerName = getParam('customerName');
555
+ const customerPhone = getParam('customerPhone');
556
+ const customerZip = getParam('customerZip');
557
+ const customerState = getParam('customerState');
558
+ this.applyPrefillAddress({
559
+ customerAddress1,
560
+ customerAddress2,
561
+ customerCity,
562
+ customerCountry,
563
+ customerEmail,
564
+ customerName,
565
+ customerPhone,
566
+ customerState,
567
+ customerZip,
568
+ });
569
+ }
570
+ applyPrefillAddress({ customerAddress1, customerAddress2, customerCity, customerCountry, customerEmail, customerName, customerPhone, customerState, customerZip, }) {
571
+ const line1 = customerAddress1 || '';
572
+ const country = customerCountry || '';
573
+ const line2 = customerAddress2 || '';
574
+ const city = customerCity || '';
575
+ const email = customerEmail || '';
576
+ const name = customerName || '';
577
+ const phone = customerPhone || '';
578
+ const postal_code = customerZip || '';
579
+ const state = customerState || '';
524
580
  /**
525
581
  * If one of the value is null, no need to preset the default address.
526
582
  * City and state are optional (they are not always provided for example Puerto Rico)
@@ -89,6 +89,7 @@
89
89
  padding-top: 8px;
90
90
  margin-top: 12px;
91
91
  background: var(--zonos--primary-color, var(--zonos-elements-gray-0));
92
+ z-index: 1;
92
93
  }
93
94
  :host .zonos--group-btn zonos-button {
94
95
  width: 100%;
@@ -92,17 +92,44 @@ export class ZonosController {
92
92
  return oldReplaceState.apply(this, arguments);
93
93
  };
94
94
  }
95
+ injectCustomHTML(htmlString) {
96
+ if (!htmlString) {
97
+ return;
98
+ }
99
+ // Skip injecting custom HTML for legacy checkout
100
+ if (!window.Zonos.isLegacyCheckout) {
101
+ log('=== Skip injecting custom HTML for hosted checkout', 'info');
102
+ return;
103
+ }
104
+ log('=== Injecting custom HTML for hosted checkout');
105
+ const template = document.createElement('template');
106
+ template.innerHTML = htmlString;
107
+ const scripts = template.content.querySelectorAll('script');
108
+ scripts.forEach(script => {
109
+ const scriptToInject = document.createElement('script');
110
+ if (script.src) {
111
+ scriptToInject.src = script.src;
112
+ scriptToInject.async = script.async;
113
+ }
114
+ else {
115
+ scriptToInject.textContent = script.innerHTML;
116
+ }
117
+ document.body.appendChild(scriptToInject);
118
+ });
119
+ }
95
120
  async componentWillLoad() {
96
121
  this.initHistoryListener();
97
122
  zonosStore.zonosApiKey = this.zonosApiKey;
98
123
  // running with scope async function to avoid blocking the main thread
99
124
  (async () => {
100
- var _a, _b;
125
+ var _a, _b, _c;
101
126
  const { errors, json, zonosMode } = await getZonosSettings();
102
127
  if (((_a = errors[0]) === null || _a === void 0 ? void 0 : _a.type.toString()) === '403') {
103
128
  log('Failed to load zonos settings. This domain may not have access', 'warn');
104
129
  return;
105
130
  }
131
+ const customHTML = ((_b = json === null || json === void 0 ? void 0 : json.checkoutSettings) === null || _b === void 0 ? void 0 : _b.customHTML) || '';
132
+ this.injectCustomHTML(customHTML);
106
133
  // init zonos notification
107
134
  this.initZonosNotification();
108
135
  const getLogoUrl = () => {
@@ -137,7 +164,7 @@ export class ZonosController {
137
164
  // init localization store
138
165
  await initLocalizationStore();
139
166
  // checkout init
140
- const publishableKey = ((_b = json === null || json === void 0 ? void 0 : json.checkoutSettings) === null || _b === void 0 ? void 0 : _b.externalServiceTokens.find(item => item.type === 'STRIPE_PUBLISHABLE_TOKEN')) || null;
167
+ const publishableKey = ((_c = json === null || json === void 0 ? void 0 : json.checkoutSettings) === null || _c === void 0 ? void 0 : _c.externalServiceTokens.find(item => item.type === 'STRIPE_PUBLISHABLE_TOKEN')) || null;
141
168
  if (!publishableKey || !this.stripeInitEvent) {
142
169
  log('Checkout failed to load -- missing publishable key', 'warn');
143
170
  return;
@@ -206,7 +233,7 @@ export class ZonosController {
206
233
  zonosStore.organizationName = organizationName;
207
234
  }
208
235
  render() {
209
- return h(Host, { key: 'ab190aefdb7b90e03ec8f4f2da73a05c3416c776', class: "zonos--elements" });
236
+ return h(Host, { key: '001f728dc41550b734fd1b5c9cf15f43c0c4cbdb', class: "zonos--elements" });
210
237
  }
211
238
  static get is() { return "zonos-controller"; }
212
239
  static get encapsulation() { return "shadow"; }
@@ -174,7 +174,7 @@ export const stringsDanish = {
174
174
  value: 'Ingen lande fundet',
175
175
  },
176
176
  'No payment method needed for staging': {
177
- value: 'Ingen betalingsmetode nødvendig for iscenesættelse',
177
+ value: 'Ingen betalingsmetode nødvendig til iscenesættelse',
178
178
  },
179
179
  'No shipment rating selected. Please go back to the "Shipping" step and select a shipment rating to proceed.': {
180
180
  value: 'Ingen forsendelsesvurdering valgt. Gå venligst tilbage til "Forsendelse"-trinnet og vælg en forsendelsesvurdering for at fortsætte.',
@@ -174,7 +174,7 @@ export const stringsKorean = {
174
174
  value: '국가를 찾을 수 없습니다',
175
175
  },
176
176
  'No payment method needed for staging': {
177
- value: '스테이징에 결제 방법이 필요하지 않습니다',
177
+ value: '스테이징에 결제 수단이 필요하지 않습니다',
178
178
  },
179
179
  'No shipment rating selected. Please go back to the "Shipping" step and select a shipment rating to proceed.': {
180
180
  value: '배송 등급이 선택되지 않았습니다. "배송" 단계로 돌아가서 배송 등급을 선택하여 진행하세요.',