@zonos/elements 1.2.0 → 1.2.2

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 (149) hide show
  1. package/dist/cjs/{cart-ac9a3c40.js → cart-d4b52ae8.js} +5 -15
  2. package/dist/cjs/{getBorderRadius-1f9c0fa3.js → getBorderRadius-fdd605c6.js} +1 -1
  3. package/dist/cjs/index.cjs.js +5 -5
  4. package/dist/cjs/{isDarkColor-0651a165.js → isDarkColor-f3446afd.js} +1 -1
  5. package/dist/cjs/{localization-3a4b4a43.js → localization-d7fe7290.js} +41 -14
  6. package/dist/cjs/{submitGtag-9e873a0a.js → submitGtag-d65003f9.js} +2 -2
  7. package/dist/cjs/zonos-address_2.cjs.entry.js +10 -5
  8. package/dist/cjs/zonos-button_2.cjs.entry.js +3 -3
  9. package/dist/cjs/zonos-cart-items_10.cjs.entry.js +20 -20
  10. package/dist/cjs/zonos-checkout.cjs.entry.js +17 -10
  11. package/dist/cjs/zonos-controller.cjs.entry.js +15 -6
  12. package/dist/cjs/zonos-country-flag_4.cjs.entry.js +3 -3
  13. package/dist/cjs/zonos-hello-dialog.cjs.entry.js +16 -8
  14. package/dist/cjs/zonos-hello.cjs.entry.js +17 -3
  15. package/dist/cjs/zonos-payment.cjs.entry.js +5 -5
  16. package/dist/cjs/zonos-shipping-rich-radio.cjs.entry.js +3 -3
  17. package/dist/cjs/{zonosStore-270f79cc.js → zonosStore-a430ec5b.js} +2 -0
  18. package/dist/collection/components/checkout/zonos-checkout/zonos-cart-subtotal/zonos-cart-subtotal.css +6 -0
  19. package/dist/collection/components/checkout/zonos-checkout/zonos-cart-subtotal/zonos-cart-subtotal.js +3 -2
  20. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-payment/zonos-checkout-payment.css +7 -3
  21. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-payment/zonos-checkout-payment.js +2 -2
  22. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.css +2 -2
  23. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +10 -3
  24. package/dist/collection/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.css +6 -2
  25. package/dist/collection/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.js +2 -2
  26. package/dist/collection/components/checkout/zonos-checkout/zonos-shipping/zonos-shipping.css +7 -3
  27. package/dist/collection/components/checkout/zonos-checkout/zonos-shipping/zonos-shipping.js +3 -5
  28. package/dist/collection/components/common/zonos-shipping-rich-radio/zonos-shipping-rich-radio.css +5 -2
  29. package/dist/collection/components/hello/zonos-hello/zonos-hello.js +15 -1
  30. package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog.js +15 -7
  31. package/dist/collection/components/main/zonos-controller.js +10 -1
  32. package/dist/collection/components/store/hello/localization.js +31 -9
  33. package/dist/collection/components/store/zonosStore.js +2 -0
  34. package/dist/collection/components/stripe/zonos-address/zonos-address.js +5 -0
  35. package/dist/collection/components/utils/api/getExchangeRate.js +9 -4
  36. package/dist/collection/components/utils/api/prepCalculateLandedCost.js +1 -11
  37. package/dist/collection/types/generated/graphql.customer.types.js +4 -1
  38. package/dist/components/cart.js +1 -11
  39. package/dist/components/localization.js +40 -13
  40. package/dist/components/zonos-address2.js +5 -0
  41. package/dist/components/zonos-cart-subtotal2.js +4 -3
  42. package/dist/components/zonos-checkout-payment2.js +3 -3
  43. package/dist/components/zonos-checkout.js +11 -4
  44. package/dist/components/zonos-controller.js +10 -1
  45. package/dist/components/zonos-customer-info2.js +3 -3
  46. package/dist/components/zonos-hello-dialog2.js +15 -7
  47. package/dist/components/zonos-hello.js +16 -2
  48. package/dist/components/zonos-shipping-rich-radio2.js +1 -1
  49. package/dist/components/zonos-shipping2.js +5 -6
  50. package/dist/components/zonosStore.js +2 -0
  51. package/dist/esm/{cart-cf46a264.js → cart-e1b93711.js} +5 -15
  52. package/dist/esm/{getBorderRadius-278281bf.js → getBorderRadius-45764ad7.js} +1 -1
  53. package/dist/esm/index.js +5 -5
  54. package/dist/esm/{isDarkColor-8fd3a24e.js → isDarkColor-6fbb9b14.js} +1 -1
  55. package/dist/esm/{localization-add1d9e9.js → localization-f3828793.js} +41 -14
  56. package/dist/esm/{submitGtag-aa5fe441.js → submitGtag-a901ece5.js} +2 -2
  57. package/dist/esm/zonos-address_2.entry.js +10 -5
  58. package/dist/esm/zonos-button_2.entry.js +3 -3
  59. package/dist/esm/zonos-cart-items_10.entry.js +20 -20
  60. package/dist/esm/zonos-checkout.entry.js +17 -10
  61. package/dist/esm/zonos-controller.entry.js +15 -6
  62. package/dist/esm/zonos-country-flag_4.entry.js +3 -3
  63. package/dist/esm/zonos-hello-dialog.entry.js +16 -8
  64. package/dist/esm/zonos-hello.entry.js +17 -3
  65. package/dist/esm/zonos-payment.entry.js +5 -5
  66. package/dist/esm/zonos-shipping-rich-radio.entry.js +3 -3
  67. package/dist/esm/{zonosStore-e5291656.js → zonosStore-05a62104.js} +2 -0
  68. package/dist/esm-es5/cart-e1b93711.js +1 -0
  69. package/dist/esm-es5/{getBorderRadius-278281bf.js → getBorderRadius-45764ad7.js} +1 -1
  70. package/dist/esm-es5/index.js +1 -1
  71. package/dist/esm-es5/{isDarkColor-8fd3a24e.js → isDarkColor-6fbb9b14.js} +1 -1
  72. package/dist/esm-es5/{localization-add1d9e9.js → localization-f3828793.js} +1 -1
  73. package/dist/esm-es5/{submitGtag-aa5fe441.js → submitGtag-a901ece5.js} +1 -1
  74. package/dist/esm-es5/zonos-address_2.entry.js +1 -1
  75. package/dist/esm-es5/zonos-button_2.entry.js +1 -1
  76. package/dist/esm-es5/zonos-cart-items_10.entry.js +1 -1
  77. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  78. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  79. package/dist/esm-es5/zonos-country-flag_4.entry.js +1 -1
  80. package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
  81. package/dist/esm-es5/zonos-hello.entry.js +1 -1
  82. package/dist/esm-es5/zonos-payment.entry.js +1 -1
  83. package/dist/esm-es5/zonos-shipping-rich-radio.entry.js +1 -1
  84. package/dist/esm-es5/{zonosStore-e5291656.js → zonosStore-05a62104.js} +1 -1
  85. package/dist/scripts/loadZonos.js +3 -3
  86. package/dist/scripts/zonos.js +3 -3
  87. package/dist/types/components/hello/zonos-hello/zonos-hello.d.ts +1 -0
  88. package/dist/types/components/store/checkout/cart.d.ts +1 -0
  89. package/dist/types/components/store/hello/localization.d.ts +2 -0
  90. package/dist/types/components/utils/api/getExchangeRate.d.ts +9 -3
  91. package/dist/types/components/utils/changeDeepProperty.d.ts +1 -1
  92. package/dist/types/components/utils/changeDeepPropertyAtIndex.d.ts +1 -1
  93. package/dist/types/types/checkout/CheckoutConfig.d.ts +2 -1
  94. package/dist/types/types/generated/graphql.customer.types.d.ts +37 -8
  95. package/dist/types/types/generated/graphql.customer.types.ts +49 -8
  96. package/dist/types/types/generated/graphql.frontend.types.d.ts +4 -0
  97. package/dist/types/types/generated/graphql.frontend.types.ts +1 -0
  98. package/dist/zonos-elements/assets/RemoveIcon.svg +1 -1
  99. package/dist/zonos-elements/index.esm.js +1 -1
  100. package/dist/zonos-elements/p-05256415.system.entry.js +1 -0
  101. package/dist/zonos-elements/{p-01990dcd.js → p-08695f4e.js} +1 -1
  102. package/dist/zonos-elements/p-0e0b46a5.js +1 -0
  103. package/dist/zonos-elements/{p-0cd4b073.system.js → p-164fae93.system.js} +1 -1
  104. package/dist/zonos-elements/p-25db3885.js +1 -0
  105. package/dist/zonos-elements/p-28681677.entry.js +1 -0
  106. package/dist/zonos-elements/p-34a49bce.entry.js +1 -0
  107. package/dist/zonos-elements/p-365970ff.entry.js +1 -0
  108. package/dist/zonos-elements/p-3f3fbcea.entry.js +1 -0
  109. package/dist/zonos-elements/p-40083e93.system.entry.js +1 -0
  110. package/dist/zonos-elements/{p-8fa1244b.entry.js → p-40778e43.entry.js} +1 -1
  111. package/dist/zonos-elements/{p-6cd7a90e.system.js → p-53649e16.system.js} +1 -1
  112. package/dist/zonos-elements/p-5d7ffddb.entry.js +1 -0
  113. package/dist/zonos-elements/p-60821b2a.entry.js +1 -0
  114. package/dist/zonos-elements/{p-9d06e3a3.system.js → p-6dcd752e.system.js} +1 -1
  115. package/dist/zonos-elements/{p-0f64d234.entry.js → p-6e7cd3f7.entry.js} +1 -1
  116. package/dist/zonos-elements/{p-ee671d13.js → p-770c959e.js} +1 -1
  117. package/dist/zonos-elements/{p-847a1b9a.system.entry.js → p-81c699f7.system.entry.js} +1 -1
  118. package/dist/zonos-elements/{p-18d37ad9.system.js → p-85ab35c9.system.js} +1 -1
  119. package/dist/zonos-elements/{p-ddc11127.system.entry.js → p-8a75b765.system.entry.js} +1 -1
  120. package/dist/zonos-elements/{p-1781245e.system.js → p-8aabbb9b.system.js} +1 -1
  121. package/dist/zonos-elements/{p-1b6d064d.system.js → p-8c867835.system.js} +1 -1
  122. package/dist/zonos-elements/p-8db8cc05.system.js +1 -0
  123. package/dist/zonos-elements/p-914ce305.system.entry.js +1 -0
  124. package/dist/zonos-elements/{p-466bae3a.entry.js → p-96a3c767.entry.js} +1 -1
  125. package/dist/zonos-elements/{p-d0ecfe92.system.entry.js → p-a3641931.system.entry.js} +1 -1
  126. package/dist/zonos-elements/{p-a3f394b7.system.entry.js → p-aca66238.system.entry.js} +1 -1
  127. package/dist/zonos-elements/{p-86825d4a.js → p-bf070bf6.js} +1 -1
  128. package/dist/zonos-elements/{p-083b951d.system.entry.js → p-c8ad044e.system.entry.js} +1 -1
  129. package/dist/zonos-elements/{p-ebb4de4e.entry.js → p-cc070c1c.entry.js} +1 -1
  130. package/dist/zonos-elements/{p-96fbce98.system.entry.js → p-cc1c785c.system.entry.js} +1 -1
  131. package/dist/zonos-elements/p-de9d8a4f.system.entry.js +1 -0
  132. package/dist/zonos-elements/{p-1293796f.js → p-f7875c40.js} +1 -1
  133. package/dist/zonos-elements/p-f8491335.system.js +1 -1
  134. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  135. package/package.json +1 -1
  136. package/dist/esm-es5/cart-cf46a264.js +0 -1
  137. package/dist/zonos-elements/p-0a33b542.system.js +0 -1
  138. package/dist/zonos-elements/p-1835470b.system.entry.js +0 -1
  139. package/dist/zonos-elements/p-6bb67f2e.system.entry.js +0 -1
  140. package/dist/zonos-elements/p-82ab16e2.js +0 -1
  141. package/dist/zonos-elements/p-a014d540.entry.js +0 -1
  142. package/dist/zonos-elements/p-aed841bf.entry.js +0 -1
  143. package/dist/zonos-elements/p-b0a39955.js +0 -1
  144. package/dist/zonos-elements/p-bb35713f.entry.js +0 -1
  145. package/dist/zonos-elements/p-c4eb37b5.entry.js +0 -1
  146. package/dist/zonos-elements/p-de86c2e4.system.entry.js +0 -1
  147. package/dist/zonos-elements/p-e80aae7d.entry.js +0 -1
  148. package/dist/zonos-elements/p-eb6cc449.system.entry.js +0 -1
  149. package/dist/zonos-elements/p-f5392f7e.entry.js +0 -1
@@ -3,8 +3,8 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-9542d2e7.js');
6
- const zonosStore = require('./zonosStore-270f79cc.js');
7
- const localization = require('./localization-3a4b4a43.js');
6
+ const zonosStore = require('./zonosStore-a430ec5b.js');
7
+ const localization = require('./localization-d7fe7290.js');
8
8
  const classes = require('./classes-b7918f56.js');
9
9
  const getHasMoreSpaceOnRight = require('./getHasMoreSpaceOnRight-2855491b.js');
10
10
 
@@ -601,6 +601,19 @@ const ZonosHello = class {
601
601
  return hasMoreSpaceOnRight;
602
602
  }
603
603
  };
604
+ this.isShippableCountry = (showLog = true) => {
605
+ if (!localization.localizationStore.localizationLoaded) {
606
+ return false;
607
+ }
608
+ // if localization is loaded and the localization is not a shippable country, keep the original click event
609
+ if (!localization.localizationStore.isShippableCountry) {
610
+ if (showLog) {
611
+ localization.log(`Hello: not shippable country`);
612
+ }
613
+ return false;
614
+ }
615
+ return true;
616
+ };
604
617
  this.mobileLocationOverride = undefined;
605
618
  this.animateFromLeftOverride = undefined;
606
619
  this.appearanceSettingsOverride = undefined;
@@ -679,7 +692,8 @@ const ZonosHello = class {
679
692
  const appearanceSettings = zonosStore.mergeConfig(zonosStore.zonosStore.appearance, this.appearanceSettingsOverride);
680
693
  const { theme } = appearanceSettings;
681
694
  const restrictedItemsOnPage = (_b = this.allRestrictedItems) === null || _b === void 0 ? void 0 : _b.filter(product => this.productsOnPage.some(restriction => restriction.description === product.itemDescription));
682
- return (index.h(index.Host, { class: "zonos--hello zonos--elements", "data-theme": theme }, selectedCountryCode && (index.h("div", { class: "zonos--hello-wrapper" }, index.h("button", { class: classes.classes([
695
+ const showHello = this.isShippableCountry() && !!selectedCountryCode;
696
+ return (index.h(index.Host, { class: "zonos--hello zonos--elements", "data-theme": theme }, showHello && (index.h("div", { class: "zonos--hello-wrapper" }, index.h("button", { class: classes.classes([
683
697
  'zonos--hello-widget',
684
698
  this.showPeekMessage && 'zonos--hello-show-peek-message',
685
699
  this.mobileLocationOverride && 'zonos--hello-mobile-override',
@@ -3,11 +3,11 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-9542d2e7.js');
6
- const cart = require('./cart-ac9a3c40.js');
7
- require('./zonosStore-270f79cc.js');
8
- require('./localization-3a4b4a43.js');
9
- require('./isDarkColor-0651a165.js');
10
- require('./getBorderRadius-1f9c0fa3.js');
6
+ const cart = require('./cart-d4b52ae8.js');
7
+ require('./zonosStore-a430ec5b.js');
8
+ require('./localization-d7fe7290.js');
9
+ require('./isDarkColor-f3446afd.js');
10
+ require('./getBorderRadius-fdd605c6.js');
11
11
 
12
12
  const zonosPaymentCss = ".sc-zonos-payment-h{font-family:Inter;display:block}.sc-zonos-payment-h img.sc-zonos-payment{max-width:100%}.sc-zonos-payment-h dl.sc-zonos-payment,.sc-zonos-payment-h dd.sc-zonos-payment,.sc-zonos-payment-h h1.sc-zonos-payment,.sc-zonos-payment-h h2.sc-zonos-payment,.sc-zonos-payment-h h3.sc-zonos-payment,.sc-zonos-payment-h h4.sc-zonos-payment,.sc-zonos-payment-h h5.sc-zonos-payment,.sc-zonos-payment-h h6.sc-zonos-payment,.sc-zonos-payment-h hr.sc-zonos-payment,.sc-zonos-payment-h figure.sc-zonos-payment,.sc-zonos-payment-h p.sc-zonos-payment,.sc-zonos-payment-h pre.sc-zonos-payment{margin:0}.sc-zonos-payment-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-payment-h .zonos--title.sc-zonos-payment{margin-bottom:var(--amino-space-16)}";
13
13
 
@@ -3,12 +3,12 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-9542d2e7.js');
6
- const zonosStore = require('./zonosStore-270f79cc.js');
6
+ const zonosStore = require('./zonosStore-a430ec5b.js');
7
7
  const classes = require('./classes-b7918f56.js');
8
- const getBorderRadius = require('./getBorderRadius-1f9c0fa3.js');
8
+ const getBorderRadius = require('./getBorderRadius-fdd605c6.js');
9
9
  const isColorVariable = require('./isColorVariable-c1ed7303.js');
10
10
 
11
- const zonosShippingRichRadioCss = ":host{font-family:Inter;display:block}: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-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}:host input{margin:0;accent-color:var(--selected-border-color, var(--amino-blue-600))}:host .zonos--shipping-rich-radio-item{display:-ms-flexbox;display:flex;-ms-flex:1;flex:1;padding:var(--amino-space-16);-ms-flex-align:center;align-items:center;gap:var(--amino-space-16);cursor:pointer;border:1px solid var(--amino-gray-200)}:host .zonos--shipping-rich-radio-item:first-child{border-top-left-radius:var(--border-radius, var(--amino-radius-10));border-top-right-radius:var(--border-radius, var(--amino-radius-10))}:host .zonos--shipping-rich-radio-item:last-child{border-bottom-left-radius:var(--border-radius, var(--amino-radius-10));border-bottom-right-radius:var(--border-radius, var(--amino-radius-10))}:host .zonos--shipping-rich-radio-item.selected{border-color:var(--selected-border-color, var(--amino-blue-600))}:host .zonos--shipping-info{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex:1;flex:1}:host .zonos--shipping-detail{-ms-flex:1;flex:1}:host .zonos--sub-detail{display:-ms-inline-flexbox;display:inline-flex;gap:8px;-ms-flex-wrap:wrap;flex-wrap:wrap}";
11
+ const zonosShippingRichRadioCss = ":host{font-family:Inter;display:block}: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-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}:host input{margin:0;accent-color:var(--selected-border-color, var(--amino-blue-600))}:host .zonos--shipping-rich-radio-item{display:-ms-flexbox;display:flex;-ms-flex:1;flex:1;padding:var(--amino-space-16);-ms-flex-align:center;align-items:center;gap:var(--amino-space-16);cursor:pointer;border:1px solid var(--amino-gray-200)}:host .zonos--shipping-rich-radio-item:first-child{border-top-left-radius:var(--border-radius, var(--amino-radius-10));border-top-right-radius:var(--border-radius, var(--amino-radius-10))}:host .zonos--shipping-rich-radio-item:last-child{border-bottom-right-radius:var(--border-radius, var(--amino-radius-10))}:host .zonos--shipping-rich-radio-item:not(:last-child){border-bottom:none}:host .zonos--shipping-rich-radio-item.selected{outline:1px solid var(--selected-border-color, var(--amino-blue-600));outline-offset:-1px}:host .zonos--shipping-info{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex:1;flex:1}:host .zonos--shipping-detail{-ms-flex:1;flex:1}:host .zonos--sub-detail{display:-ms-inline-flexbox;display:inline-flex;gap:8px;-ms-flex-wrap:wrap;flex-wrap:wrap}";
12
12
 
13
13
  const ZonosShippingRichRadio = class {
14
14
  constructor(hostRef) {
@@ -2555,6 +2555,8 @@ const { reset, state: zonosStore } = createStore(() => ({
2555
2555
  },
2556
2556
  organization: '',
2557
2557
  placeOrderButtonSelector: null,
2558
+ // default inactive for subscription
2559
+ subscriptionStatus: 'INACTIVE',
2558
2560
  successBehavior: 'REDIRECT_TO_SUCCESS_PAGE',
2559
2561
  successRedirectUrl: '',
2560
2562
  visibilityStatus: 'ENABLED',
@@ -53,6 +53,12 @@
53
53
  :host .zonos--cart-subtotal-price {
54
54
  border-bottom: 1px solid var(--amino-gray-200);
55
55
  }
56
+ :host .zonos--cart-duty-tax-price {
57
+ display: flex;
58
+ flex-direction: column;
59
+ align-items: flex-end;
60
+ gap: 5px;
61
+ }
56
62
  :host .zonos--cart-subtotal-price {
57
63
  text-align: right;
58
64
  }
@@ -8,6 +8,7 @@ import InfoIcon from "./assets/InfoIcon.svg";
8
8
  export class ZonosCartSubtotal {
9
9
  render() {
10
10
  const totalWithoutTaxes = cartStore.total - cartStore.dutiesTaxFees;
11
+ const showDutyTaxesInfo = cartStore.step === 'payment' || cartStore.step === 'shipping';
11
12
  const renderShippingInfo = () => {
12
13
  if (!cartStore.selectedShippingOption) {
13
14
  return (h(Fragment, null, h("zonos-text", { class: "zonos--title", type: "semiBoldLabel" }, translate('Shipping')), h("zonos-text", { class: "zonos--caption", type: "caption" }, translate('No shipping method selected'))));
@@ -22,12 +23,12 @@ export class ZonosCartSubtotal {
22
23
  amount: cartStore.shipping,
23
24
  currency: cartStore.currency,
24
25
  })
25
- : '-')), cartStore.step === 'payment' && (h("tr", { class: "zonos--row zonos--cart-duties" }, h("td", { class: "zonos--column" }), h("td", { class: "zonos--column zonos--cart-subtotal-title" }, h("div", { class: "zonos--title-with-icon" }, h("zonos-text", { class: "zonos--title", type: "semiBoldLabel" }, translate('Duties, taxes, and fees')), h("zonos-icon", { content: InfoIcon, size: 16 })), !!cartStore.isSelectedShippingAboveDeminimis && (h("zonos-text", { color: "gray-800", type: "body" }, translate('Order is over the de minimis threshold for both duty and tax')))), h("td", { class: "zonos--column zonos--cart-subtotal-price" }, cartStore.dutiesTaxFees
26
+ : '-')), showDutyTaxesInfo && (h("tr", { class: "zonos--row zonos--cart-duties" }, h("td", { class: "zonos--column" }), h("td", { class: "zonos--column zonos--cart-subtotal-title" }, h("div", { class: "zonos--title-with-icon" }, h("zonos-text", { class: "zonos--title", type: "semiBoldLabel" }, translate('Duties, taxes, and fees')), h("zonos-icon", { content: InfoIcon, size: 16 })), !!cartStore.isSelectedShippingAboveDeminimis && (h("zonos-text", { color: "gray-800", type: "body" }, translate('Order is over the de minimis threshold for both duty and tax')))), h("td", { class: "zonos--column zonos--cart-subtotal-price" }, h("div", { class: "zonos--cart-duty-tax-price" }, cartStore.dutiesTaxFees
26
27
  ? formatCurrency({
27
28
  amount: cartStore.dutiesTaxFees,
28
29
  currency: cartStore.currency,
29
30
  })
30
- : '-', cartStore.isSelectedShippingGuarantee && (h("zonos-badge", null, translate('Guaranteed')))))), h("tr", { class: "zonos--row zonos--cart-pay-total" }, h("td", { class: "zonos--column" }), h("td", { class: "zonos--column" }, h("zonos-text", { class: "zonos--title", type: "semiBoldLabel" }, translate('Order total'))), h("td", { class: "zonos--column" }, h("zonos-text", { type: "semiBoldLabel" }, formatCurrency({
31
+ : '-', cartStore.isSelectedShippingGuarantee && (h("zonos-badge", null, translate('Guaranteed'))))))), h("tr", { class: "zonos--row zonos--cart-pay-total" }, h("td", { class: "zonos--column" }), h("td", { class: "zonos--column" }, h("zonos-text", { class: "zonos--title", type: "semiBoldLabel" }, translate('Order total'))), h("td", { class: "zonos--column" }, h("zonos-text", { type: "semiBoldLabel" }, formatCurrency({
31
32
  amount:
32
33
  // show total without taxes when step is shipping, show total with taxes when step is payment
33
34
  cartStore.step === 'shipping'
@@ -38,7 +38,7 @@
38
38
  :host .zonos--group {
39
39
  margin-bottom: var(--amino-space-20);
40
40
  overflow: auto;
41
- padding: 0 5px;
41
+ padding: 5px;
42
42
  }
43
43
  :host .zonos--group::-webkit-scrollbar {
44
44
  width: 10px;
@@ -58,6 +58,10 @@
58
58
  :host .zonos--payment-error-banner {
59
59
  margin-bottom: var(--amino-space-8);
60
60
  }
61
- :host zonos-button {
62
- width: 100%;
61
+ :host .zonos--group-btn {
62
+ display: flex;
63
+ justify-content: center;
64
+ }
65
+ :host .zonos--group-btn zonos-button {
66
+ width: calc(100% - 10px);
63
67
  }
@@ -30,12 +30,12 @@ export class ZonosCheckoutPayment {
30
30
  return null;
31
31
  }
32
32
  this.disabled = !((_a = stripeStore.stripePaymentEventData) === null || _a === void 0 ? void 0 : _a.complete);
33
- return (h(Host, { class: "zonos--checkout-payment zonos--elements" }, h("div", { class: "zonos--group" }, h("zonos-text", { class: "zonos--title", type: "semiBoldSubheader" }, translate('Payment method')), this.paymentError && (h("zonos-banner", { class: "zonos--payment-error-banner", intent: "error" }, translate("We couldn't complete your payment. Please verify the payment details and try again."))), h("zonos-payment", null)), h("zonos-button", { backgroundColor: this.submitBtnColor, "is-disabled": this.disabled, loading: this.continueLoading, onClick: () => this.continueClickHandler(), size: "lg",
33
+ return (h(Host, { class: "zonos--checkout-payment zonos--elements" }, h("div", { class: "zonos--group" }, h("zonos-text", { class: "zonos--title", type: "semiBoldSubheader" }, translate('Payment method')), this.paymentError && (h("zonos-banner", { class: "zonos--payment-error-banner", intent: "error" }, translate("We couldn't complete your payment. Please verify the payment details and try again."))), h("zonos-payment", null)), h("div", { class: "zonos--group-btn" }, h("zonos-button", { backgroundColor: this.submitBtnColor, "is-disabled": this.disabled, loading: this.continueLoading, onClick: () => this.continueClickHandler(), size: "lg",
34
34
  // use primary type when on mobile mode
35
35
  variant: this.submitBtnType }, "Pay", ' ', formatCurrency({
36
36
  amount: cartStore.total,
37
37
  currency: cartStore.currency,
38
- }))));
38
+ })))));
39
39
  }
40
40
  static get is() { return "zonos-checkout-payment"; }
41
41
  static get encapsulation() { return "scoped"; }
@@ -107,8 +107,8 @@
107
107
  }
108
108
  :host .zonos--right .zonos--close-button {
109
109
  position: absolute;
110
- right: var(--amino-space-32);
111
- top: var(--amino-space-32);
110
+ right: var(--amino-space-24);
111
+ top: var(--amino-space-24);
112
112
  }
113
113
  :host .zonos--footer {
114
114
  display: flex;
@@ -37,7 +37,7 @@ export class ZonosCheckout {
37
37
  // if localization is loaded and the localization is not a shippable country, keep the original click event
38
38
  if (!localizationStore.isShippableCountry) {
39
39
  if (showLog) {
40
- log(`not shippable country`);
40
+ log(`Checkout: not shippable country`);
41
41
  }
42
42
  return false;
43
43
  }
@@ -178,7 +178,8 @@ export class ZonosCheckout {
178
178
  // show the selector when it's domestic
179
179
  selector === null || selector === void 0 ? void 0 : selector.forEach(el => {
180
180
  const element = el;
181
- const display = element.getAttribute('data-zonos-checkout-original-display');
181
+ const display = element.getAttribute('data-zonos-checkout-original-display') ||
182
+ getComputedStyle(element).display;
182
183
  // fallback to initial (browser value) if "display" is not found
183
184
  element.style.display = display || 'initial';
184
185
  });
@@ -352,7 +353,13 @@ export class ZonosCheckout {
352
353
  '--border-radius': getBorderRadius(style),
353
354
  } }, cartStore.step !== 'finish' && cartStore.step !== 'error' && (h(Fragment, null, h("div", { class: "zonos--left", "data-theme": leftSideTheme, style: {
354
355
  '--primary-color': !this.isMobile ? colorPrimary : '',
355
- } }, !this.isMobile && renderTopHeader(), cartStore.step === 'customer-info' && (h("zonos-customer-info", { continueLoading: this.submitLoading, defaultAddress: this.defaultAddress, onContinueClicked: () => this.handleCustomerInfoContinue(), submitBtnColor: submitButtonColor, submitBtnType: submitBtnType })), cartStore.step === 'shipping' && (h("zonos-shipping", { continueLoading: this.submitLoading, onContinueClicked: () => this.handleShippingContinue(), submitBtnColor: submitButtonColor, submitBtnType: submitBtnType })), cartStore.step === 'payment' && (h("zonos-checkout-payment", { continueLoading: this.submitLoading, onContinueClicked: () => this.handleCheckoutPaymentContinue(), paymentError: this.paymentError, submitBtnColor: submitButtonColor, submitBtnType: submitBtnType }))), h("div", { class: "zonos--right", "data-theme": rightSideTheme }, this.isMobile && renderTopHeader(), !this.isMobile && (h("zonos-button", { class: "zonos--close-button", icon: h("zonos-icon", { content: RemoveIcon }), noBackground: true, onClick: () => this.closeDialogHandler() })), h("div", { class: "flex--wrapper" }, h("div", { class: "zonos--wrapper" }, h("zonos-collapse", { collapseSize: reviewElementSize, collapsed: this.collapseReviewMobile }, h("zonos-review", { collapsed: this.collapseReviewMobile, mobile: this.isMobile, onClick: () => {
356
+ } }, !this.isMobile && renderTopHeader(), cartStore.step === 'customer-info' && (h("zonos-customer-info", { continueLoading: this.submitLoading, defaultAddress: this.defaultAddress, onContinueClicked: () => this.handleCustomerInfoContinue(), submitBtnColor: submitButtonColor, submitBtnType: submitBtnType })), cartStore.step === 'shipping' && (h("zonos-shipping", { continueLoading: this.submitLoading, onContinueClicked: () => this.handleShippingContinue(), submitBtnColor: submitButtonColor, submitBtnType: submitBtnType })), cartStore.step === 'payment' && (h("zonos-checkout-payment", { continueLoading: this.submitLoading, onContinueClicked: () => this.handleCheckoutPaymentContinue(), paymentError: this.paymentError, submitBtnColor: submitButtonColor, submitBtnType: submitBtnType }))), h("div", { class: "zonos--right", "data-theme": rightSideTheme }, this.isMobile && renderTopHeader(), !this.isMobile && (h("zonos-button", { class: "zonos--close-button", icon: h("zonos-icon", { content: RemoveIcon }), noBackground: true, onClick: () => this.closeDialogHandler() })), h("div", { class: "flex--wrapper" }, h("div", { class: "zonos--wrapper" }, h("zonos-collapse", { collapseSize: reviewElementSize,
357
+ // only collapse on mobile
358
+ collapsed: this.collapseReviewMobile && this.isMobile }, h("zonos-review", { collapsed: this.collapseReviewMobile, mobile: this.isMobile, onClick: () => {
359
+ // do nothing if it's not mobile
360
+ if (!this.isMobile) {
361
+ return;
362
+ }
356
363
  this.collapseReviewMobile =
357
364
  !this.collapseReviewMobile;
358
365
  }, ref: el => (this.zonosReviewRef = el) }), h("zonos-cart-items", null))), h("zonos-v-stack", { spacing: 16 }, h("zonos-cart-subtotal", null), h("zonos-custom-message", { class: "zonos--checkout-default-message", icon: MessageIcon, message: defaultMessage }))), !this.isMobile && renderFooter()), this.isMobile && renderFooter())), (cartStore.step === 'finish' || cartStore.step === 'error') && (h("div", { class: "zonos--done", "data-theme": rightSideTheme }, h("div", { class: "zonos--header" }, renderLogo(), h("zonos-button", { class: "zonos--close-button", icon: h("zonos-icon", { content: RemoveIcon }), noBackground: true, onClick: () => this.handleFinishClick(), theme: rightSideTheme })), h("zonos-checkout-finish", { borderRadius: style, onCloseClick: () => this.handleFinishClick(), overrideNotification: cartStore.step === 'error' && !!cartStore.error
@@ -58,6 +58,10 @@
58
58
  :host .zonos--group::-webkit-scrollbar-thumb:hover {
59
59
  background: #d6d6d6;
60
60
  }
61
- :host zonos-button {
62
- width: 100%;
61
+ :host .zonos--group-btn {
62
+ display: flex;
63
+ justify-content: center;
64
+ }
65
+ :host .zonos--group-btn zonos-button {
66
+ width: calc(100% - 10px);
63
67
  }
@@ -31,9 +31,9 @@ export class ZonosCustomerInfo {
31
31
  this.disabled =
32
32
  !((_a = stripeStore.stripeAddressEventData) === null || _a === void 0 ? void 0 : _a.complete) ||
33
33
  !((_b = stripeStore.stripeLinkEventData) === null || _b === void 0 ? void 0 : _b.complete);
34
- return (h(Host, { class: "zonos--customer-info zonos--elements" }, h("div", { class: "zonos--group" }, h("zonos-text", { class: "zonos--title", type: "semiBoldSubheader" }, translate('Customer information')), h("zonos-link-authentication", { titleText: translate('Contact') }), h("zonos-address", { defaultAddress: this.defaultAddress, titleText: translate('Address'), type: "shipping" })), h("zonos-button", { backgroundColor: this.submitBtnColor, isDisabled: this.disabled, loading: this.continueLoading, onClick: () => this.continueClickHandler(), size: "lg",
34
+ return (h(Host, { class: "zonos--customer-info zonos--elements" }, h("div", { class: "zonos--group" }, h("zonos-text", { class: "zonos--title", type: "semiBoldSubheader" }, translate('Customer information')), h("zonos-link-authentication", { titleText: translate('Contact') }), h("zonos-address", { defaultAddress: this.defaultAddress, titleText: translate('Address'), type: "shipping" })), h("div", { class: "zonos--group-btn" }, h("zonos-button", { backgroundColor: this.submitBtnColor, isDisabled: this.disabled, loading: this.continueLoading, onClick: () => this.continueClickHandler(), size: "lg",
35
35
  // use primary type when on mobile mode
36
- variant: this.submitBtnType }, translate('Continue to shipping'))));
36
+ variant: this.submitBtnType }, translate('Continue to shipping')))));
37
37
  }
38
38
  static get is() { return "zonos-customer-info"; }
39
39
  static get encapsulation() { return "scoped"; }
@@ -44,7 +44,7 @@
44
44
  :host .zonos--group {
45
45
  margin-bottom: var(--amino-space-20);
46
46
  overflow: auto;
47
- padding-right: 5px;
47
+ padding: 5px;
48
48
  }
49
49
  :host .zonos--group::-webkit-scrollbar {
50
50
  width: 10px;
@@ -61,8 +61,12 @@
61
61
  :host .zonos--group::-webkit-scrollbar-thumb:hover {
62
62
  background: #d6d6d6;
63
63
  }
64
- :host zonos-button {
65
- width: 100%;
64
+ :host .zonos--group-btn {
65
+ display: flex;
66
+ justify-content: center;
67
+ }
68
+ :host .zonos--group-btn zonos-button {
69
+ width: calc(100% - 10px);
66
70
  }
67
71
  :host zonos-banner {
68
72
  margin-top: var(--amino-space-24);
@@ -1,6 +1,5 @@
1
1
  import { h, Host, } from "@stencil/core";
2
2
  import { cartStore, cartStoreGetShippingTransitInfo, cartStoreUpdateSelectedShippingOption, } from "../../../store/checkout/cart";
3
- import { stripeStore } from "../../../store/checkout/stripe";
4
3
  import { translate } from "../../../store/translationStore";
5
4
  import { formatCurrency } from "../../../utils/formatCurrency";
6
5
  import { submitGtag } from "../../../utils/submitGtag";
@@ -42,9 +41,8 @@ export class ZonosShipping {
42
41
  }
43
42
  }
44
43
  render() {
45
- var _a, _b;
46
- const shipToCountry = (_a = stripeStore.stripeAddressEventData) === null || _a === void 0 ? void 0 : _a.value.address.country;
47
- const serviceLevels = (_b = cartStore.shippingData) === null || _b === void 0 ? void 0 : _b.flatMap((item) => {
44
+ var _a;
45
+ const serviceLevels = (_a = cartStore.shippingData) === null || _a === void 0 ? void 0 : _a.flatMap((item) => {
48
46
  var _a, _b;
49
47
  const { expectedDate, maxTransit, minTransit } = cartStoreGetShippingTransitInfo(item);
50
48
  const sublabel = expectedDate
@@ -65,7 +63,7 @@ export class ZonosShipping {
65
63
  value: item.id,
66
64
  };
67
65
  });
68
- return (h(Host, { class: "zonos--shipping zonos--elements" }, h("div", { class: "zonos--group" }, h("zonos-text", { class: "zonos--title", type: "semiBoldSubheader" }, translate('Shipping information')), h("zonos-text", { class: "zonos--shipping-method-title", type: "semiBoldLabel" }, translate('Shipping method')), !(serviceLevels === null || serviceLevels === void 0 ? void 0 : serviceLevels.length) ? (h("zonos-banner", { bannerTitle: "No shipping methods found - try editing your address or contacting support if the error persists", intent: "error" })) : (h("zonos-shipping-rich-radio", { items: serviceLevels || [], onRadioSelected: e => this.handleRadioSelected(e) })), cartStore.isSelectedShippingAboveDeminimis && (h("zonos-banner", { intent: "warning" }, translate('Above de minimis threshold for'), " ", shipToCountry, ".", ' ', translate('Duties and taxes will be applied to items and shipping.')))), h("zonos-button", { backgroundColor: this.submitBtnColor, "is-disabled": this.disabled, loading: this.continueLoading, onClick: () => this.continueClickHandler(), size: "lg",
66
+ return (h(Host, { class: "zonos--shipping zonos--elements" }, h("div", { class: "zonos--group" }, h("zonos-text", { class: "zonos--title", type: "semiBoldSubheader" }, translate('Shipping information')), h("zonos-text", { class: "zonos--shipping-method-title", type: "semiBoldLabel" }, translate('Shipping method')), !(serviceLevels === null || serviceLevels === void 0 ? void 0 : serviceLevels.length) ? (h("zonos-banner", { bannerTitle: "No shipping methods found - try editing your address or contacting support if the error persists", intent: "error" })) : (h("zonos-shipping-rich-radio", { items: serviceLevels || [], onRadioSelected: e => this.handleRadioSelected(e) }))), h("zonos-button", { backgroundColor: this.submitBtnColor, "is-disabled": this.disabled, loading: this.continueLoading, onClick: () => this.continueClickHandler(), size: "lg",
69
67
  // use primary type when on mobile mode
70
68
  variant: this.submitBtnType }, translate('Go to payment'))));
71
69
  }
@@ -49,11 +49,14 @@
49
49
  border-top-right-radius: var(--border-radius, var(--amino-radius-10));
50
50
  }
51
51
  :host .zonos--shipping-rich-radio-item:last-child {
52
- border-bottom-left-radius: var(--border-radius, var(--amino-radius-10));
53
52
  border-bottom-right-radius: var(--border-radius, var(--amino-radius-10));
54
53
  }
54
+ :host .zonos--shipping-rich-radio-item:not(:last-child) {
55
+ border-bottom: none;
56
+ }
55
57
  :host .zonos--shipping-rich-radio-item.selected {
56
- border-color: var(--selected-border-color, var(--amino-blue-600));
58
+ outline: 1px solid var(--selected-border-color, var(--amino-blue-600));
59
+ outline-offset: -1px;
57
60
  }
58
61
  :host .zonos--shipping-info {
59
62
  display: flex;
@@ -161,6 +161,19 @@ export class ZonosHello {
161
161
  return hasMoreSpaceOnRight;
162
162
  }
163
163
  };
164
+ this.isShippableCountry = (showLog = true) => {
165
+ if (!localizationStore.localizationLoaded) {
166
+ return false;
167
+ }
168
+ // if localization is loaded and the localization is not a shippable country, keep the original click event
169
+ if (!localizationStore.isShippableCountry) {
170
+ if (showLog) {
171
+ log(`Hello: not shippable country`);
172
+ }
173
+ return false;
174
+ }
175
+ return true;
176
+ };
164
177
  this.mobileLocationOverride = undefined;
165
178
  this.animateFromLeftOverride = undefined;
166
179
  this.appearanceSettingsOverride = undefined;
@@ -239,7 +252,8 @@ export class ZonosHello {
239
252
  const appearanceSettings = mergeConfig(zonosStore.appearance, this.appearanceSettingsOverride);
240
253
  const { theme } = appearanceSettings;
241
254
  const restrictedItemsOnPage = (_b = this.allRestrictedItems) === null || _b === void 0 ? void 0 : _b.filter(product => this.productsOnPage.some(restriction => restriction.description === product.itemDescription));
242
- return (h(Host, { class: "zonos--hello zonos--elements", "data-theme": theme }, selectedCountryCode && (h("div", { class: "zonos--hello-wrapper" }, h("button", { class: classes([
255
+ const showHello = this.isShippableCountry() && !!selectedCountryCode;
256
+ return (h(Host, { class: "zonos--hello zonos--elements", "data-theme": theme }, showHello && (h("div", { class: "zonos--hello-wrapper" }, h("button", { class: classes([
243
257
  'zonos--hello-widget',
244
258
  this.showPeekMessage && 'zonos--hello-show-peek-message',
245
259
  this.mobileLocationOverride && 'zonos--hello-mobile-override',
@@ -3,7 +3,7 @@ import { localizationStore } from "../../store/hello/localization";
3
3
  import { translate } from "../../store/translationStore";
4
4
  import { zonosStore } from "../../store/zonosStore";
5
5
  import { classes } from "../../utils/classes";
6
- import { currencyConvertAndFormat } from "../../utils/hello/currencyConversion/currencyConvertAndFormat";
6
+ import { currencyFormat } from "../../utils/hello/currencyConversion/currencyFormat";
7
7
  import { getHasMoreSpaceAbove } from "../../utils/hello/getHasMoreSpaceAbove";
8
8
  import { getHasMoreSpaceOnRight } from "../../utils/hello/getHasMoreSpaceOnRight";
9
9
  // eslint-disable-next-line no-relative-import-paths/no-relative-import-paths
@@ -60,18 +60,26 @@ export class ZonosHelloDialog {
60
60
  const { countryLandedCost, selectedCountryCode } = localizationStore;
61
61
  // Our Robby API spells deminimis wrong here
62
62
  const dutyDeminimis = (countryLandedCost === null || countryLandedCost === void 0 ? void 0 : countryLandedCost.dutyDeminimus)
63
- ? currencyConvertAndFormat(countryLandedCost.dutyDeminimus)
63
+ ? currencyFormat(countryLandedCost.dutyDeminimus)
64
64
  : null;
65
+ // If Canada, use 40 CAD (courier duty de minimis)
66
+ const dutyDeminimisToUse = localizationStore.selectedCountryCode === 'CA'
67
+ ? currencyFormat(40)
68
+ : dutyDeminimis;
65
69
  // If deminimis is undefined or null, assume it's $0
66
- const dutyDeMinimisMessage = dutyDeminimis
67
- ? `${translate('Spend')} ${dutyDeminimis} ${translate('duty free')}`
70
+ const dutyDeMinimisMessage = dutyDeminimisToUse
71
+ ? `${translate('Spend')} ${dutyDeminimisToUse} ${translate('duty free')}`
68
72
  : translate('Duties will apply to all orders');
69
73
  // Our Robby API spells deminimis wrong here
70
74
  const taxDeminimis = (countryLandedCost === null || countryLandedCost === void 0 ? void 0 : countryLandedCost.vatTaxDeminimus)
71
- ? currencyConvertAndFormat(countryLandedCost.vatTaxDeminimus)
75
+ ? currencyFormat(countryLandedCost.vatTaxDeminimus)
72
76
  : null;
73
- const taxDeMinimisMessage = taxDeminimis
74
- ? `${translate('Spend')} ${taxDeminimis} ${translate('tax free')}`
77
+ // If Canada, use 150 CAD (courier tax de minimis)
78
+ const taxDeminimisToUse = localizationStore.selectedCountryCode === 'CA'
79
+ ? currencyFormat(150)
80
+ : taxDeminimis;
81
+ const taxDeMinimisMessage = taxDeminimisToUse
82
+ ? `${translate('Spend')} ${taxDeminimisToUse} ${translate('tax free')}`
75
83
  : translate('Taxes will apply to all orders');
76
84
  const animateLeft = this.animateFromLeftOverride ||
77
85
  (this.dialogRef && getHasMoreSpaceOnRight(this.dialogRef));
@@ -63,11 +63,20 @@ export class ZonosController {
63
63
  log('Checkout failed to load -- missing publishable key', 'warn');
64
64
  return;
65
65
  }
66
+ if (zonosStore.checkoutSettings.subscriptionStatus === 'INACTIVE') {
67
+ log('=== Checkout subscription is "INACTIVE" - Cancel initializing for Checkout ===', 'warn');
68
+ log('zonos controller loaded');
69
+ return;
70
+ }
71
+ if (zonosStore.checkoutSettings.visibilityStatus === 'DISABLED') {
72
+ log('=== Checkout is disabled by store owner ===', 'warn');
73
+ log('zonos controller loaded');
74
+ return;
75
+ }
66
76
  // send publishable key out to load stripe
67
77
  this.stripeInitEvent.emit({
68
78
  publishableKey: publishableKey.token,
69
79
  });
70
- // eslint-disable-next-line no-console
71
80
  log('zonos controller loaded');
72
81
  })();
73
82
  }
@@ -22,23 +22,45 @@ const { state: localizationStore } = createStore({
22
22
  shippingZoneCountries: null,
23
23
  targetCurrency: 'USD',
24
24
  });
25
+ const triggerGetExchangeRate = async (isGuaranteed) => {
26
+ const { exchangeRate, maxAge } = await getExchangeRate({
27
+ country: localizationStore.selectedCountryCode,
28
+ isGuaranteed,
29
+ sourceCurrency: zonosStore.sourceCurrency,
30
+ targetCurrency: localizationStore.targetCurrency,
31
+ });
32
+ if (exchangeRate) {
33
+ localizationStore.exchangeRate = exchangeRate;
34
+ currencyDisplay();
35
+ }
36
+ return { maxAge };
37
+ };
38
+ // This recursive function is for users who step away from their computer and come back needing a new exchange rate
39
+ const startExchangeRateTimeout = ({ isGuaranteed, maxAge, }) => {
40
+ if (localizationStore.exchangeRateTimeout) {
41
+ clearTimeout(localizationStore.exchangeRateTimeout);
42
+ }
43
+ // maxAge comes in seconds, convert to milliseconds
44
+ const defaultMaxAge = 5 * 60;
45
+ const maxAgeToUse = maxAge || defaultMaxAge;
46
+ // Recursively set timeouts to get new exchange rates when the current one expires
47
+ localizationStore.exchangeRateTimeout = setTimeout(async () => {
48
+ const { maxAge: newMaxAge } = await triggerGetExchangeRate(isGuaranteed);
49
+ startExchangeRateTimeout({ isGuaranteed, maxAge: newMaxAge });
50
+ }, maxAgeToUse * 1000);
51
+ };
25
52
  const getNewLocalization = async () => {
26
53
  log('get new localization store');
27
54
  const { isShippableCountry, selectedCountryCode } = localizationStore;
28
- const isGuaranteed = zonosStore.checkoutSettings.visibilityStatus === 'ENABLED';
29
55
  if (zonosStore.helloSettings.currencyBehavior === 'DISABLED' ||
30
56
  !isShippableCountry ||
31
57
  !selectedCountryCode) {
32
58
  return;
33
59
  }
34
- localizationStore.exchangeRate = await getExchangeRate({
35
- country: localizationStore.selectedCountryCode,
36
- isGuaranteed,
37
- sourceCurrency: zonosStore.sourceCurrency,
38
- targetCurrency: localizationStore.targetCurrency,
39
- });
40
- if (localizationStore.exchangeRate) {
41
- currencyDisplay();
60
+ if (zonosStore.sourceCurrency !== localizationStore.targetCurrency) {
61
+ const isGuaranteed = zonosStore.checkoutSettings.visibilityStatus === 'ENABLED';
62
+ const { maxAge } = await triggerGetExchangeRate(isGuaranteed);
63
+ startExchangeRateTimeout({ isGuaranteed, maxAge });
42
64
  }
43
65
  localizationStore.countryLandedCost = await getCountryLandedCost(localizationStore.selectedCountryCode);
44
66
  };
@@ -36,6 +36,8 @@ const { reset, state: zonosStore } = createStore(() => ({
36
36
  },
37
37
  organization: '',
38
38
  placeOrderButtonSelector: null,
39
+ // default inactive for subscription
40
+ subscriptionStatus: 'INACTIVE',
39
41
  successBehavior: 'REDIRECT_TO_SUCCESS_PAGE',
40
42
  successRedirectUrl: '',
41
43
  visibilityStatus: 'ENABLED',
@@ -33,6 +33,11 @@ export class ZonosAddress {
33
33
  ? Object.values(shippableCountries).map(country => country.code)
34
34
  : [],
35
35
  contacts: this.defaultAddress ? [this.defaultAddress] : undefined,
36
+ defaultValues: {
37
+ address: {
38
+ country: localizationStore.selectedCountryCode || 'AL',
39
+ },
40
+ },
36
41
  display: {
37
42
  name: 'split',
38
43
  },
@@ -2,16 +2,21 @@ import { handleFetch } from "../handleFetch";
2
2
  import { logError } from "../logging/logError";
3
3
  export const getExchangeRate = async ({ country, isGuaranteed, sourceCurrency, targetCurrency, }) => {
4
4
  var _a;
5
+ // If source currency matches target currency (US -> US) and is not a guaranteed rate, return null
6
+ if (sourceCurrency === targetCurrency && !isGuaranteed) {
7
+ return { exchangeRate: null, maxAge: null };
8
+ }
5
9
  const url = `${process.env.NEXT_PUBLIC_ZONOS_ROUTE_URL}/api/exchange-rates?sourceCurrency=${sourceCurrency}&targetCurrency=${targetCurrency}&isGuaranteed=${isGuaranteed}&country=${country}}`;
6
10
  const { errors, json } = await handleFetch(url);
7
11
  if (errors.length || !json) {
8
12
  logError(`Error fetching country landed cost: ${(_a = errors.find(Boolean)) === null || _a === void 0 ? void 0 : _a.message}`);
9
- return null;
13
+ return { exchangeRate: null, maxAge: null };
10
14
  }
11
- const { rate, targetFormat } = json.exchangeRateCreate;
15
+ const { maxAge, rate, targetFormat } = json.exchangeRateCreate;
12
16
  if (rate) {
13
17
  sessionStorage.setItem(country + '_rate', JSON.stringify(rate));
14
- return { rate, targetFormat };
18
+ const exchangeRate = { rate, targetFormat };
19
+ return { exchangeRate, maxAge };
15
20
  }
16
- return null;
21
+ return { exchangeRate: null, maxAge: null };
17
22
  };
@@ -17,17 +17,7 @@ export const prepCalculateLandedCost = () => {
17
17
  lastName: stripeAddressData.value.lastName || '',
18
18
  phone: stripeAddressData.value.phone || '',
19
19
  },
20
- items: cartStore.items.map(item => ({
21
- amount: item.amount,
22
- countryOfOrigin: item.countryOfOrigin,
23
- currencyCode: item.currencyCode,
24
- imageUrl: item.imageUrl,
25
- measurements: item.measurements,
26
- metadata: item.metadata,
27
- name: item.name,
28
- productId: item.productId,
29
- quantity: item.quantity,
30
- })),
20
+ items: cartStore.items.map(item => item),
31
21
  shippingAddress: {
32
22
  addressLine1: stripeAddressData.value.address.line1,
33
23
  addressLine2: stripeAddressData.value.address.line2 || '',
@@ -134,9 +134,9 @@ export const checkoutVisibilityStatus = {
134
134
  Enabled: 'ENABLED',
135
135
  };
136
136
  export const classificationBulkJobStatus = {
137
+ Classified: 'CLASSIFIED',
137
138
  Completed: 'COMPLETED',
138
139
  Error: 'ERROR',
139
- FileSaved: 'FILE_SAVED',
140
140
  Initialized: 'INITIALIZED',
141
141
  Processing: 'PROCESSING',
142
142
  };
@@ -1717,6 +1717,9 @@ export function getSdk(client, withWrapper = defaultWrapper) {
1717
1717
  ExchangeRateCreate(variables, requestHeaders) {
1718
1718
  return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'ExchangeRateCreate', 'mutation');
1719
1719
  },
1720
+ FulfillmentCenter(variables, requestHeaders) {
1721
+ return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'FulfillmentCenter', 'query');
1722
+ },
1720
1723
  OnlineStoreSettings(variables, requestHeaders) {
1721
1724
  return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'OnlineStoreSettings', 'query');
1722
1725
  },
@@ -20,17 +20,7 @@ const prepCalculateLandedCost = () => {
20
20
  lastName: stripeAddressData.value.lastName || '',
21
21
  phone: stripeAddressData.value.phone || '',
22
22
  },
23
- items: cartStore.items.map(item => ({
24
- amount: item.amount,
25
- countryOfOrigin: item.countryOfOrigin,
26
- currencyCode: item.currencyCode,
27
- imageUrl: item.imageUrl,
28
- measurements: item.measurements,
29
- metadata: item.metadata,
30
- name: item.name,
31
- productId: item.productId,
32
- quantity: item.quantity,
33
- })),
23
+ items: cartStore.items.map(item => item),
34
24
  shippingAddress: {
35
25
  addressLine1: stripeAddressData.value.address.line1,
36
26
  addressLine2: stripeAddressData.value.address.line2 || '',