@zonos/elements 1.3.51 → 1.3.52

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 (207) hide show
  1. package/dist/cjs/CheckoutConfig-65376e00.js +40 -0
  2. package/dist/cjs/{cart-546d1602.js → cart-61a8983d.js} +238 -375
  3. package/dist/cjs/{createCustomEvent-9b91480b.js → createCustomEvent-228027b5.js} +3 -2
  4. package/dist/cjs/handleFetch-842c95b0.js +322 -0
  5. package/dist/cjs/index.cjs.js +75 -35
  6. package/dist/cjs/loader.cjs.js +1 -1
  7. package/dist/cjs/{paypal-83f49f9a.js → paypal-f1eb6621.js} +16 -16
  8. package/dist/cjs/zonos-address_8.cjs.entry.js +4 -4
  9. package/dist/cjs/{zonos-cart-items_12.cjs.entry.js → zonos-badge_13.cjs.entry.js} +41 -9
  10. package/dist/cjs/zonos-checkout.cjs.entry.js +75 -174
  11. package/dist/cjs/zonos-controller.cjs.entry.js +27 -25
  12. package/dist/cjs/zonos-country-flag.cjs.entry.js +2 -2
  13. package/dist/cjs/zonos-country-select_4.cjs.entry.js +2 -2
  14. package/dist/cjs/zonos-elements.cjs.js +1 -1
  15. package/dist/cjs/zonos-hello-dialog.cjs.entry.js +2 -2
  16. package/dist/cjs/zonos-hello.cjs.entry.js +11 -11
  17. package/dist/cjs/zonos-language-select_2.cjs.entry.js +2 -2
  18. package/dist/cjs/zonos-notification_3.cjs.entry.js +9 -9
  19. package/dist/cjs/zonos-tooltip.cjs.entry.js +27 -0
  20. package/dist/collection/components/checkout/zonos-checkout/zonos-cart-subtotal/zonos-cart-subtotal.js +5 -2
  21. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +44 -20
  22. package/dist/collection/components/store/checkout/cart.js +14 -2
  23. package/dist/collection/components/store/checkout/stripe.js +9 -4
  24. package/dist/collection/components/store/translationStore/strings.arabic.js +3 -3
  25. package/dist/collection/components/store/translationStore/strings.base.js +3 -3
  26. package/dist/collection/components/store/translationStore/strings.chinese.js +3 -3
  27. package/dist/collection/components/store/translationStore/strings.danish.js +3 -3
  28. package/dist/collection/components/store/translationStore/strings.dutch.js +3 -3
  29. package/dist/collection/components/store/translationStore/strings.french.js +3 -3
  30. package/dist/collection/components/store/translationStore/strings.german.js +3 -3
  31. package/dist/collection/components/store/translationStore/strings.hebrew.js +3 -3
  32. package/dist/collection/components/store/translationStore/strings.indonesian.js +3 -3
  33. package/dist/collection/components/store/translationStore/strings.italian.js +3 -3
  34. package/dist/collection/components/store/translationStore/strings.japanese.js +3 -3
  35. package/dist/collection/components/store/translationStore/strings.korean.js +3 -3
  36. package/dist/collection/components/store/translationStore/strings.norwegian.js +3 -3
  37. package/dist/collection/components/store/translationStore/strings.polish.js +3 -3
  38. package/dist/collection/components/store/translationStore/strings.portuguese.js +3 -3
  39. package/dist/collection/components/store/translationStore/strings.russian.js +3 -3
  40. package/dist/collection/components/store/translationStore/strings.spanish.js +3 -3
  41. package/dist/collection/components/store/translationStore/strings.swedish.js +3 -3
  42. package/dist/collection/components/store/translationStore/strings.turkish.js +3 -3
  43. package/dist/collection/components/store/translationStore/strings.vietnamese.js +3 -3
  44. package/dist/collection/components/utils/api/buildCartItemsByTempCart.js +14 -14
  45. package/dist/collection/components/utils/api/calculateLandedCostNormalized.js +28 -0
  46. package/dist/collection/components/utils/api/cartCalculateLandedCost.js +19 -0
  47. package/dist/collection/components/utils/api/prepCalculateLandedCost.js +65 -0
  48. package/dist/collection/components/utils/checkout/initCheckout.js +4 -2
  49. package/dist/collection/environment.js +1 -1
  50. package/dist/collection/scripts/_getNextFallbackUrl.js +1 -0
  51. package/dist/collection/scripts/_getTempCartById.js +14 -0
  52. package/dist/collection/scripts/_zonosBase.js +39 -10
  53. package/dist/collection/scripts/cart/_getCartIdFromParam.js +9 -0
  54. package/dist/collection/scripts/cart/_setupCartData.js +18 -0
  55. package/dist/collection/types/checkout/CheckoutConfig.js +2 -1
  56. package/dist/collection/types/generated/graphql.customer.types.js +12 -0
  57. package/dist/collection/utils/formattedCloudflareApiUrl.js +8 -2
  58. package/dist/collection/utils/generateCloudflareDeployUrl.js +3 -0
  59. package/dist/esm/CheckoutConfig-57350b28.js +36 -0
  60. package/dist/esm/{cart-51529af2.js → cart-45d2861f.js} +193 -327
  61. package/dist/esm/{createCustomEvent-b8bbdf5e.js → createCustomEvent-3fcc948a.js} +2 -1
  62. package/dist/esm/handleFetch-37cea185.js +315 -0
  63. package/dist/esm/index.js +56 -17
  64. package/dist/esm/loader.js +1 -1
  65. package/dist/esm/{paypal-905325d0.js → paypal-ee310945.js} +2 -2
  66. package/dist/esm/zonos-address_8.entry.js +2 -2
  67. package/dist/esm/{zonos-cart-items_12.entry.js → zonos-badge_13.entry.js} +40 -9
  68. package/dist/esm/zonos-checkout.entry.js +61 -160
  69. package/dist/esm/zonos-controller.entry.js +6 -4
  70. package/dist/esm/zonos-country-flag.entry.js +2 -2
  71. package/dist/esm/zonos-country-select_4.entry.js +2 -2
  72. package/dist/esm/zonos-elements.js +1 -1
  73. package/dist/esm/zonos-hello-dialog.entry.js +2 -2
  74. package/dist/esm/zonos-hello.entry.js +2 -2
  75. package/dist/esm/zonos-language-select_2.entry.js +2 -2
  76. package/dist/esm/zonos-notification_3.entry.js +3 -3
  77. package/dist/esm/zonos-tooltip.entry.js +23 -0
  78. package/dist/esm-es5/CheckoutConfig-57350b28.js +1 -0
  79. package/dist/esm-es5/cart-45d2861f.js +1 -0
  80. package/dist/esm-es5/{createCustomEvent-b8bbdf5e.js → createCustomEvent-3fcc948a.js} +1 -1
  81. package/dist/esm-es5/handleFetch-37cea185.js +1 -0
  82. package/dist/esm-es5/index.js +1 -1
  83. package/dist/esm-es5/loader.js +1 -1
  84. package/dist/esm-es5/{paypal-905325d0.js → paypal-ee310945.js} +1 -1
  85. package/dist/esm-es5/zonos-address_8.entry.js +1 -1
  86. package/dist/esm-es5/zonos-badge_13.entry.js +1 -0
  87. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  88. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  89. package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
  90. package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
  91. package/dist/esm-es5/zonos-elements.js +1 -1
  92. package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
  93. package/dist/esm-es5/zonos-hello.entry.js +1 -1
  94. package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
  95. package/dist/esm-es5/zonos-notification_3.entry.js +1 -1
  96. package/dist/esm-es5/zonos-tooltip.entry.js +1 -0
  97. package/dist/scripts/index.d.ts +74 -87
  98. package/dist/scripts/index.js +1 -1
  99. package/dist/scripts/loadZonos.js +1 -1
  100. package/dist/scripts/zonos.js +1 -1
  101. package/dist/types/components/checkout/zonos-checkout/zonos-checkout.d.ts +0 -2
  102. package/dist/types/components/store/checkout/cart.d.ts +13 -3
  103. package/dist/types/components/store/checkout/stripe.d.ts +3 -1
  104. package/dist/types/components/store/translationStore/strings.arabic.d.ts +3 -3
  105. package/dist/types/components/store/translationStore/strings.base.d.ts +3 -3
  106. package/dist/types/components/store/translationStore/strings.chinese.d.ts +3 -3
  107. package/dist/types/components/store/translationStore/strings.danish.d.ts +3 -3
  108. package/dist/types/components/store/translationStore/strings.dutch.d.ts +3 -3
  109. package/dist/types/components/store/translationStore/strings.french.d.ts +3 -3
  110. package/dist/types/components/store/translationStore/strings.german.d.ts +3 -3
  111. package/dist/types/components/store/translationStore/strings.hebrew.d.ts +3 -3
  112. package/dist/types/components/store/translationStore/strings.indonesian.d.ts +3 -3
  113. package/dist/types/components/store/translationStore/strings.italian.d.ts +3 -3
  114. package/dist/types/components/store/translationStore/strings.japanese.d.ts +3 -3
  115. package/dist/types/components/store/translationStore/strings.korean.d.ts +3 -3
  116. package/dist/types/components/store/translationStore/strings.norwegian.d.ts +3 -3
  117. package/dist/types/components/store/translationStore/strings.polish.d.ts +3 -3
  118. package/dist/types/components/store/translationStore/strings.portuguese.d.ts +3 -3
  119. package/dist/types/components/store/translationStore/strings.russian.d.ts +3 -3
  120. package/dist/types/components/store/translationStore/strings.spanish.d.ts +3 -3
  121. package/dist/types/components/store/translationStore/strings.swedish.d.ts +3 -3
  122. package/dist/types/components/store/translationStore/strings.turkish.d.ts +3 -3
  123. package/dist/types/components/store/translationStore/strings.vietnamese.d.ts +3 -3
  124. package/dist/types/components/store/translationStore.d.ts +1 -1
  125. package/dist/types/components/utils/api/buildCartItemsByTempCart.d.ts +8 -3
  126. package/dist/types/components/utils/api/calculateLandedCostNormalized.d.ts +2 -0
  127. package/dist/types/components/utils/api/cartCalculateLandedCost.d.ts +5 -0
  128. package/dist/types/components/utils/api/prepCalculateLandedCost.d.ts +5 -1
  129. package/dist/types/components/utils/checkout/getIsTestMode.d.ts +1 -1
  130. package/dist/types/scripts/_getNextFallbackUrl.d.ts +1 -0
  131. package/dist/types/scripts/_getTempCartById.d.ts +8 -0
  132. package/dist/types/scripts/_zonosBase.d.ts +15 -12
  133. package/dist/types/scripts/cart/_getCartIdFromParam.d.ts +4 -0
  134. package/dist/types/scripts/cart/_setupCartData.d.ts +7 -0
  135. package/dist/types/types/checkout/CheckoutConfig.d.ts +18 -3
  136. package/dist/types/types/checkout/api/CalculateLandedCostRequest.d.ts +42 -1
  137. package/dist/types/types/checkout/api/NormalizedTempCart.d.ts +37 -0
  138. package/dist/types/types/generated/graphql.customer.types.d.ts +249 -2
  139. package/dist/types/types/generated/graphql.customer.types.ts +251 -3
  140. package/dist/types/utils/formattedCloudflareApiUrl.d.ts +2 -2
  141. package/dist/zonos-elements/assets/RemoveIcon.svg +1 -1
  142. package/dist/zonos-elements/index.esm.js +1 -1
  143. package/dist/zonos-elements/p-042c466d.system.entry.js +1 -0
  144. package/dist/zonos-elements/p-10cb0064.entry.js +1 -0
  145. package/dist/zonos-elements/{p-5e56828a.entry.js → p-259ccf8d.entry.js} +1 -1
  146. package/dist/zonos-elements/p-2a47d2cc.system.entry.js +1 -0
  147. package/dist/zonos-elements/{p-ffd76226.entry.js → p-31eb835c.entry.js} +1 -1
  148. package/dist/zonos-elements/{p-58d9803d.entry.js → p-36360905.entry.js} +1 -1
  149. package/dist/zonos-elements/{p-1828a4ff.system.entry.js → p-3703b814.system.entry.js} +1 -1
  150. package/dist/zonos-elements/p-4146feec.js +1 -0
  151. package/dist/zonos-elements/p-446c8f02.system.entry.js +1 -0
  152. package/dist/zonos-elements/{p-2c323311.system.js → p-5590f90c.system.js} +1 -1
  153. package/dist/zonos-elements/p-588396df.js +1 -0
  154. package/dist/zonos-elements/{p-aa5d669b.js → p-6e59c6e4.js} +2 -2
  155. package/dist/zonos-elements/p-6eedc3f8.entry.js +1 -0
  156. package/dist/zonos-elements/p-747eed39.entry.js +1 -0
  157. package/dist/zonos-elements/{p-00100b17.system.entry.js → p-8228e87c.system.entry.js} +1 -1
  158. package/dist/zonos-elements/p-827868e6.entry.js +1 -0
  159. package/dist/zonos-elements/{p-cc7a4fca.entry.js → p-88005b94.entry.js} +1 -1
  160. package/dist/zonos-elements/p-895fdefb.js +1 -0
  161. package/dist/zonos-elements/p-8f7773b0.system.js +1 -0
  162. package/dist/zonos-elements/{p-9a0401fd.entry.js → p-8fa49d94.entry.js} +1 -1
  163. package/dist/zonos-elements/p-a74a7afa.system.js +1 -0
  164. package/dist/zonos-elements/p-b1861e64.system.js +1 -0
  165. package/dist/zonos-elements/{p-8473f99a.system.entry.js → p-b842b96a.system.entry.js} +1 -1
  166. package/dist/zonos-elements/{p-9e976332.entry.js → p-bb186075.entry.js} +1 -1
  167. package/dist/zonos-elements/{p-b1a8b874.system.entry.js → p-c008648a.system.entry.js} +1 -1
  168. package/dist/zonos-elements/p-c78dd680.system.js +1 -1
  169. package/dist/zonos-elements/{p-6b42fa1b.system.entry.js → p-cd4ad1be.system.entry.js} +1 -1
  170. package/dist/zonos-elements/{p-59e85369.system.entry.js → p-d62e6bb0.system.entry.js} +1 -1
  171. package/dist/zonos-elements/{p-496e040f.system.entry.js → p-dc12f30a.system.entry.js} +1 -1
  172. package/dist/zonos-elements/p-eb2aedd0.js +1 -0
  173. package/dist/zonos-elements/{p-c89859cf.system.js → p-f124e459.system.js} +2 -2
  174. package/dist/zonos-elements/p-f527cd5b.entry.js +1 -0
  175. package/dist/zonos-elements/p-f826b979.system.entry.js +1 -0
  176. package/dist/zonos-elements/p-f87a635b.system.js +1 -0
  177. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  178. package/package.json +1 -1
  179. package/dist/cjs/logError-4e2f2020.js +0 -58
  180. package/dist/cjs/zonos-badge_2.cjs.entry.js +0 -57
  181. package/dist/collection/components/utils/api/tempCartItem/getAttributes.js +0 -66
  182. package/dist/collection/components/utils/api/tempCartItem/getMeasurements.js +0 -58
  183. package/dist/esm/logError-c456c092.js +0 -55
  184. package/dist/esm/zonos-badge_2.entry.js +0 -52
  185. package/dist/esm-es5/cart-51529af2.js +0 -1
  186. package/dist/esm-es5/logError-c456c092.js +0 -1
  187. package/dist/esm-es5/zonos-badge_2.entry.js +0 -1
  188. package/dist/esm-es5/zonos-cart-items_12.entry.js +0 -1
  189. package/dist/types/components/utils/api/tempCartItem/getAttributes.d.ts +0 -11
  190. package/dist/types/components/utils/api/tempCartItem/getMeasurements.d.ts +0 -7
  191. package/dist/types/types/checkout/api/TempCart.d.ts +0 -80
  192. package/dist/zonos-elements/p-101c41bf.entry.js +0 -1
  193. package/dist/zonos-elements/p-3c4eec63.system.entry.js +0 -1
  194. package/dist/zonos-elements/p-47945026.system.entry.js +0 -1
  195. package/dist/zonos-elements/p-47c72c50.system.entry.js +0 -1
  196. package/dist/zonos-elements/p-4e77ed65.system.entry.js +0 -1
  197. package/dist/zonos-elements/p-6013e370.entry.js +0 -1
  198. package/dist/zonos-elements/p-63db40b9.system.js +0 -1
  199. package/dist/zonos-elements/p-8b8ef484.entry.js +0 -1
  200. package/dist/zonos-elements/p-b57d24f2.entry.js +0 -1
  201. package/dist/zonos-elements/p-ba0289f9.entry.js +0 -1
  202. package/dist/zonos-elements/p-c8a3303b.js +0 -1
  203. package/dist/zonos-elements/p-d413cd13.js +0 -1
  204. package/dist/zonos-elements/p-e758ec31.system.js +0 -1
  205. package/dist/zonos-elements/p-eaa335e1.js +0 -1
  206. package/dist/zonos-elements/p-fcfde531.system.js +0 -1
  207. /package/dist/collection/types/checkout/api/{TempCart.js → NormalizedTempCart.js} +0 -0
@@ -1,13 +1,11 @@
1
1
  import type { PayPalNamespace } from '@paypal/paypal-js';
2
2
  import type { Stripe } from '@stripe/stripe-js';
3
3
  import type { AppearanceConfig } from "../components/store/zonosStore";
4
- import { type InjectScriptType } from "./_getNextFallbackUrl";
5
4
  import type { NotificationInit } from "../types/index";
6
- import type { TempCart } from "../types/checkout/api/TempCart";
7
- import type { CheckoutConfig } from "../types/checkout/CheckoutConfig";
5
+ import type { NormalizedTempCart } from "../types/checkout/api/NormalizedTempCart";
6
+ import { type CheckoutConfig } from "../types/checkout/CheckoutConfig";
8
7
  import type { CountryCode, CurrencyCode, PaypalMockResponse } from "../types/generated/graphql.customer.types";
9
8
  import type { HelloConfig } from "../types/hello/HelloConfig";
10
- export declare const MAIN_LOAD_CDN_TYPE: InjectScriptType;
11
9
  /**
12
10
  * Currency converter function to be used in Hello and Checkout
13
11
  * @note don't modify the element directly in this function, otherwise it might cause unexpected behavior like an infinite loop
@@ -173,17 +171,17 @@ export type LoadZonosParamsConfig = {
173
171
  export type LoadZonosParams = LoadZonosParamsConfig & {
174
172
  storeId: number;
175
173
  /**
176
- * Temporary cart UUID to be used for legacy zonos checkout. If this is provided, no need to configure `buildCartDetail`, `buildLandedCost` callback, zonosApiKey or storeId
177
- * @note This would be deprecated in the future when we fully migrate to new zonos checkout
174
+ * If cart id is provided in the url with query param zCartUUID, you don't need to provide zonosApiKey
178
175
  */
179
- tempCartUUID?: string;
180
- zonosApiKey: string;
176
+ zonosApiKey?: string;
181
177
  };
182
178
  export interface Zonos {
183
179
  /**
184
180
  * Mock error response for Paypal. Mainly used for testing purposes
185
181
  */
186
182
  _paypalMockResponse: PaypalMockResponse | null;
183
+ cartData: NormalizedTempCart | null;
184
+ cartId: string | null;
187
185
  /**
188
186
  * Toggle debug mode (add query param 'zonosDebug=1' to url)
189
187
  * @default false
@@ -191,6 +189,10 @@ export interface Zonos {
191
189
  debug?: boolean;
192
190
  doneInit: boolean;
193
191
  isBigCommerce: boolean;
192
+ /**
193
+ * This will be set to true when it's called form legacy checkout
194
+ */
195
+ isLegacyCheckout: boolean;
194
196
  isNpm: boolean;
195
197
  /** Flag if already alerted when preview domain is defined and it's connecting production environment */
196
198
  modeAlerted: boolean;
@@ -202,9 +204,8 @@ export interface Zonos {
202
204
  storeId: number;
203
205
  /** Stripe instance */
204
206
  stripe: Stripe;
205
- tempCartData: TempCart | null;
206
207
  version: string;
207
- zonosApiKey: string;
208
+ zonosApiKey?: string;
208
209
  /**
209
210
  * Flag to send tracking event to api for conversion testing, since we don't send tracking event to api when in debug/development mode
210
211
  */
@@ -220,7 +221,7 @@ export interface Zonos {
220
221
  updateOrganizationName: (organizationName: string) => void;
221
222
  }
222
223
  export declare abstract class Zonos {
223
- static zonosApiKey: string;
224
+ static zonosApiKey?: string;
224
225
  static stripe: Stripe;
225
226
  static storeId: number;
226
227
  static doneInit: boolean;
@@ -229,6 +230,7 @@ export declare abstract class Zonos {
229
230
  static _paypalMockResponse: PaypalMockResponse | null;
230
231
  static isBigCommerce: boolean;
231
232
  static releaseDate: string;
233
+ static isLegacyCheckout: boolean;
232
234
  /**
233
235
  * By default, the package will load from npm
234
236
  */
@@ -236,9 +238,10 @@ export declare abstract class Zonos {
236
238
  static zonosQaUrl: string | null;
237
239
  static version: string;
238
240
  static modeAlerted: boolean;
239
- static tempCartData: TempCart | null;
241
+ static cartData: NormalizedTempCart | null;
240
242
  static paypal: PayPalNamespace | null;
241
243
  static getCurrentTimestamp: () => number;
244
+ static cartId: string | null;
242
245
  private static zonosController;
243
246
  static init: ({ appearance, checkoutSettings, currencyConverter, helloSettings, onCountryChange, overrideCurrencyFormat, storeId, zonosApiKey, }: LoadZonosParams) => Promise<void>;
244
247
  static displayCurrency: () => void;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Simple function to get the cart id from the query param.
3
+ */
4
+ export declare const getCartIdFromQueryParam: () => string | null;
@@ -0,0 +1,7 @@
1
+ export declare const setupCartData: (cartId: string) => Promise<{
2
+ cartData: import("../../types/checkout/api/NormalizedTempCart").NormalizedTempCart;
3
+ storeFavicon: string;
4
+ storeId: number;
5
+ storeLogo: string;
6
+ zonosApiKey: string;
7
+ } | null>;
@@ -1,6 +1,8 @@
1
1
  import type { CartItem } from "../../components/store/checkout/cart";
2
2
  import type { BuildLandedCostParams, BuildLandedCostResponse } from "../../components/utils/api/triggerBuildLandedCost";
3
3
  import type { AnalyticsProviderStatus, AnalyticsProviderType, CheckoutSubscriptionStatus, CheckoutSuccessBehavior, CheckoutVisibilityStatus, CountryCode, CurrencyCode, ExternalPaymentMethodStatus, ExternalPaymentMethodType, ExternalServiceTokenType, GetOrderQuery, Mode, NotificationActiveStatus } from "../generated/graphql.customer.types";
4
+ export declare const checkoutHiddenBtnSelector = "zonos--checkout-hidden-button";
5
+ export declare const domesticRedirectedBtnSelector = "zonos--domestic-redirected-checkout-button";
4
6
  export type ZonosOrder = GetOrderQuery['order'];
5
7
  export type { BuildLandedCostParams, BuildLandedCostResponse };
6
8
  export type BuildCardDetailParams = {
@@ -84,8 +86,11 @@ export type CheckoutConfig = {
84
86
  successRedirectUrl: string;
85
87
  visibilityStatus: CheckoutVisibilityStatus;
86
88
  /**
87
- * Cart info callback for checkout (optional)
88
- * @note will use temp cart data if available
89
+ * Cart info callback for checkout (optional),
90
+ * @deprecated
91
+ * @note
92
+ * This function is deprecated in favor of new API `createCartId`
93
+ * @note will attempt to use cart data if available
89
94
  * User can dispatch an event 'zonos--init-cart-info' to update the cart
90
95
  * @example
91
96
  * const initEvent = new CustomEvent<CartItem[]>('zonos--init-cart-info', {
@@ -106,9 +111,19 @@ export type CheckoutConfig = {
106
111
  buildCartDetail?: (params: BuildCardDetailParams) => Promise<CartItem[]>;
107
112
  /**
108
113
  * Calculate landed cost callback for checkout (optional)
109
- * @note will use temp cart data if available
114
+ * @deprecated
115
+ * @note
116
+ * This function is deprecated in favor of new API `createCartId`
117
+ * @note will attempt to use cart data if available
110
118
  */
111
119
  buildLandedCost?: (params: BuildLandedCostParams) => Promise<BuildLandedCostResponse>;
120
+ /**
121
+ * Callback that returns the cart id from `cartCreate` mutation.
122
+ * @note
123
+ * The mutation `cartCreate` is preferred to be called in the server side
124
+ * @returns string - Cart ID
125
+ */
126
+ createCartId?: () => Promise<string> | string;
112
127
  /**
113
128
  * Callback trigger when the checkout is closed
114
129
  */
@@ -1,5 +1,5 @@
1
1
  import type { CartItem } from "../../../components/store/checkout/cart";
2
- import type { LandedCostAdjustmentType } from "../../generated/graphql.customer.types";
2
+ import type { CurrencyCode, LandedCostAdjustmentType } from "../../generated/graphql.customer.types";
3
3
  export type CalculateLandedCostRequest = {
4
4
  billingAddress: {
5
5
  addressLine1: string;
@@ -24,6 +24,8 @@ export type CalculateLandedCostRequest = {
24
24
  items: CartItem[];
25
25
  landedCostAdjustments?: {
26
26
  amount: number;
27
+ productId: string | null;
28
+ sku: string | null;
27
29
  type: LandedCostAdjustmentType;
28
30
  }[];
29
31
  metadata?: {
@@ -39,3 +41,42 @@ export type CalculateLandedCostRequest = {
39
41
  state: string;
40
42
  };
41
43
  };
44
+ export type CartCalculateLandedCostRequest = {
45
+ billingAddress: {
46
+ addressLine1: string;
47
+ addressLine2?: string | undefined;
48
+ city: string;
49
+ country: string;
50
+ postalCode: string;
51
+ state: string;
52
+ };
53
+ billingContact: {
54
+ firstName: string;
55
+ lastName: string;
56
+ phone: string;
57
+ };
58
+ /**
59
+ * Currency code of the first item in the cart
60
+ */
61
+ cartCurrencyCode: CurrencyCode;
62
+ cartId: string;
63
+ checkoutSessionId: string;
64
+ contact: {
65
+ email?: string;
66
+ firstName: string;
67
+ lastName: string;
68
+ phone: string;
69
+ };
70
+ metadata?: {
71
+ key: string;
72
+ value: string;
73
+ }[];
74
+ shippingAddress: {
75
+ addressLine1: string;
76
+ addressLine2?: string | undefined;
77
+ city: string;
78
+ country: string;
79
+ postalCode: string;
80
+ state: string;
81
+ };
82
+ };
@@ -0,0 +1,37 @@
1
+ import type { CartAdjustmentType, CountryCode, CurrencyCode, ItemMeasurementType, ItemType, ItemUnitOfMeasure } from "../../generated/graphql.customer.types";
2
+ export type NormalizedTempCartItem = {
3
+ amount: number;
4
+ attributes: {
5
+ key: string;
6
+ value: string;
7
+ }[];
8
+ countryOfOrigin: CountryCode | null;
9
+ currencyCode: CurrencyCode;
10
+ description: string | null;
11
+ id: string;
12
+ imageUrl: string | null;
13
+ itemType: ItemType | null;
14
+ measurements: {
15
+ type: ItemMeasurementType;
16
+ unitOfMeasure: ItemUnitOfMeasure;
17
+ value: number;
18
+ }[];
19
+ name: string | null;
20
+ productId: string | null;
21
+ quantity: number;
22
+ sku: string | null;
23
+ };
24
+ export type NormalizedTempCart = {
25
+ adjustments: {
26
+ amount: number;
27
+ currencyCode: CurrencyCode;
28
+ description: string;
29
+ productId: string | null;
30
+ sku: string | null;
31
+ type: CartAdjustmentType;
32
+ }[];
33
+ credentialToken: string;
34
+ items: NormalizedTempCartItem[];
35
+ storeBaseUrl: string;
36
+ storeId: number;
37
+ };
@@ -2593,6 +2593,116 @@ export declare const zonosAttribution: {
2593
2593
  readonly Enabled: "ENABLED";
2594
2594
  };
2595
2595
  export type ZonosAttribution = (typeof zonosAttribution)[keyof typeof zonosAttribution];
2596
+ export type CartCalculateLandedCostMutation = {
2597
+ cartWorkflow: {
2598
+ id: string;
2599
+ items: Array<{
2600
+ amount: number;
2601
+ attributes: Array<{
2602
+ key: string | null;
2603
+ value: string | null;
2604
+ } | null> | null;
2605
+ description: string | null;
2606
+ id: string;
2607
+ imageUrl: string | null;
2608
+ name: string | null;
2609
+ quantity: number;
2610
+ restriction: {
2611
+ action: RestrictedItemAction;
2612
+ reason: string;
2613
+ } | null;
2614
+ sku: string | null;
2615
+ }>;
2616
+ };
2617
+ cartonizeWorkflow: Array<{
2618
+ id: string;
2619
+ items: Array<{
2620
+ item: {
2621
+ id: string;
2622
+ };
2623
+ }> | null;
2624
+ type: PackagingType;
2625
+ } | null> | null;
2626
+ checkoutSessionWorkflow: Array<{
2627
+ landedCost: {
2628
+ id: string;
2629
+ } | null;
2630
+ landedCostId: string;
2631
+ subtotals: {
2632
+ adjustments: number;
2633
+ duties: number;
2634
+ presentmentCurrencyCode: CurrencyCode;
2635
+ fees: number;
2636
+ items: number;
2637
+ landedCostTotal: number;
2638
+ taxes: number;
2639
+ shipping: number;
2640
+ exchangeRate: {
2641
+ id: string;
2642
+ rate: number;
2643
+ sourceCurrencyCode: CurrencyCode;
2644
+ targetCurrencyCode: CurrencyCode;
2645
+ type: ExchangeRateType;
2646
+ };
2647
+ total: number;
2648
+ };
2649
+ }> | null;
2650
+ landedCostCalculateWorkflow: Array<{
2651
+ amountSubtotals: {
2652
+ discounts: number | null;
2653
+ } | null;
2654
+ landedCostGuaranteeCode: LandedCostGuaranteeCode;
2655
+ deMinimis: Array<{
2656
+ formula: string;
2657
+ threshold: DeMinimisThreshold;
2658
+ method: IncotermCode;
2659
+ note: string;
2660
+ type: DeMinimisType;
2661
+ }>;
2662
+ duties: Array<{
2663
+ amount: number;
2664
+ currencyCode: CurrencyCode;
2665
+ }>;
2666
+ fees: Array<{
2667
+ amount: number;
2668
+ currencyCode: CurrencyCode;
2669
+ }>;
2670
+ id: string;
2671
+ appliedAdjustments: Array<{
2672
+ amount: number;
2673
+ item: {
2674
+ amount: number;
2675
+ } | null;
2676
+ type: LandedCostAdjustmentType | null;
2677
+ }> | null;
2678
+ method: IncotermCode;
2679
+ shipmentRating: {
2680
+ amount: number;
2681
+ currencyCode: CurrencyCode;
2682
+ displayName: string;
2683
+ id: string;
2684
+ maxTransitAt: string | null;
2685
+ minTransitAt: string | null;
2686
+ };
2687
+ taxes: Array<{
2688
+ amount: number;
2689
+ currencyCode: CurrencyCode;
2690
+ }>;
2691
+ } | null> | null;
2692
+ partyCreateWorkflow: Array<{
2693
+ id: string;
2694
+ organization: string;
2695
+ type: PartyType | null;
2696
+ }>;
2697
+ shipmentRatingCalculateWorkflow: Array<{
2698
+ amount: number;
2699
+ currencyCode: CurrencyCode;
2700
+ displayName: string;
2701
+ id: string;
2702
+ maxTransitAt: string | null;
2703
+ minTransitAt: string | null;
2704
+ }>;
2705
+ };
2596
2706
  export type CalculateLandedCostMutation = {
2597
2707
  cartonizeWorkflow: Array<{
2598
2708
  id: string;
@@ -2607,7 +2717,9 @@ export type CalculateLandedCostMutation = {
2607
2717
  landedCost: {
2608
2718
  id: string;
2609
2719
  } | null;
2720
+ landedCostId: string;
2610
2721
  subtotals: {
2722
+ adjustments: number;
2611
2723
  duties: number;
2612
2724
  exchangeRate: {
2613
2725
  id: string;
@@ -2643,6 +2755,9 @@ export type CalculateLandedCostMutation = {
2643
2755
  sku: string | null;
2644
2756
  }>;
2645
2757
  landedCostCalculateWorkflow: Array<{
2758
+ amountSubtotals: {
2759
+ discounts: number | null;
2760
+ } | null;
2646
2761
  appliedAdjustments: Array<{
2647
2762
  amount: number;
2648
2763
  item: {
@@ -2653,8 +2768,8 @@ export type CalculateLandedCostMutation = {
2653
2768
  deMinimis: Array<{
2654
2769
  formula: string;
2655
2770
  method: IncotermCode;
2656
- note: string;
2657
2771
  threshold: DeMinimisThreshold;
2772
+ note: string;
2658
2773
  type: DeMinimisType;
2659
2774
  }>;
2660
2775
  duties: Array<{
@@ -2670,8 +2785,8 @@ export type CalculateLandedCostMutation = {
2670
2785
  method: IncotermCode;
2671
2786
  shipmentRating: {
2672
2787
  amount: number;
2673
- displayName: string;
2674
2788
  currencyCode: CurrencyCode;
2789
+ displayName: string;
2675
2790
  id: string;
2676
2791
  maxTransitAt: string | null;
2677
2792
  minTransitAt: string | null;
@@ -2695,11 +2810,30 @@ export type CalculateLandedCostMutation = {
2695
2810
  minTransitAt: string | null;
2696
2811
  }>;
2697
2812
  };
2813
+ export type CartItemFragmentFragment = {
2814
+ amount: number;
2815
+ attributes: Array<{
2816
+ key: string | null;
2817
+ value: string | null;
2818
+ } | null> | null;
2819
+ description: string | null;
2820
+ id: string;
2821
+ imageUrl: string | null;
2822
+ name: string | null;
2823
+ quantity: number;
2824
+ restriction: {
2825
+ action: RestrictedItemAction;
2826
+ reason: string;
2827
+ } | null;
2828
+ sku: string | null;
2829
+ };
2698
2830
  export type CheckoutPresentmentFragment = {
2699
2831
  landedCost: {
2700
2832
  id: string;
2701
2833
  } | null;
2834
+ landedCostId: string;
2702
2835
  subtotals: {
2836
+ adjustments: number;
2703
2837
  duties: number;
2704
2838
  exchangeRate: {
2705
2839
  id: string;
@@ -2718,6 +2852,9 @@ export type CheckoutPresentmentFragment = {
2718
2852
  };
2719
2853
  };
2720
2854
  export type LandedCostFragment = {
2855
+ amountSubtotals: {
2856
+ discounts: number | null;
2857
+ } | null;
2721
2858
  appliedAdjustments: Array<{
2722
2859
  amount: number;
2723
2860
  item: {
@@ -2835,10 +2972,12 @@ export type GetTaxIdByCountryQuery = {
2835
2972
  };
2836
2973
  export type CheckoutSessionCreateMutation = {
2837
2974
  checkoutSessionCreate: {
2975
+ cartId: string | null;
2838
2976
  clientSecret: string;
2839
2977
  id: string;
2840
2978
  landedCost: {
2841
2979
  amountSubtotals: {
2980
+ discounts: number | null;
2842
2981
  duties: number;
2843
2982
  fees: number;
2844
2983
  items: number;
@@ -2859,6 +2998,7 @@ export type CheckoutSessionCreateMutation = {
2859
2998
  } | null> | null;
2860
2999
  organizationId: string;
2861
3000
  subtotals: {
3001
+ adjustments: number;
2862
3002
  duties: number;
2863
3003
  exchangeRate: {
2864
3004
  id: string;
@@ -2878,10 +3018,12 @@ export type CheckoutSessionCreateMutation = {
2878
3018
  };
2879
3019
  };
2880
3020
  export type CheckoutDetailsFragment = {
3021
+ cartId: string | null;
2881
3022
  clientSecret: string;
2882
3023
  id: string;
2883
3024
  landedCost: {
2884
3025
  amountSubtotals: {
3026
+ discounts: number | null;
2885
3027
  duties: number;
2886
3028
  fees: number;
2887
3029
  items: number;
@@ -2902,6 +3044,7 @@ export type CheckoutDetailsFragment = {
2902
3044
  } | null> | null;
2903
3045
  organizationId: string;
2904
3046
  subtotals: {
3047
+ adjustments: number;
2905
3048
  duties: number;
2906
3049
  exchangeRate: {
2907
3050
  id: string;
@@ -2994,10 +3137,12 @@ export type CheckoutSessionUpdateMetadataMutation = {
2994
3137
  };
2995
3138
  export type CheckoutSessionUpdateMutation = {
2996
3139
  checkoutSessionUpdate: {
3140
+ cartId: string | null;
2997
3141
  clientSecret: string;
2998
3142
  id: string;
2999
3143
  landedCost: {
3000
3144
  amountSubtotals: {
3145
+ discounts: number | null;
3001
3146
  duties: number;
3002
3147
  fees: number;
3003
3148
  items: number;
@@ -3018,6 +3163,7 @@ export type CheckoutSessionUpdateMutation = {
3018
3163
  } | null> | null;
3019
3164
  organizationId: string;
3020
3165
  subtotals: {
3166
+ adjustments: number;
3021
3167
  duties: number;
3022
3168
  exchangeRate: {
3023
3169
  id: string;
@@ -3037,10 +3183,12 @@ export type CheckoutSessionUpdateMutation = {
3037
3183
  };
3038
3184
  };
3039
3185
  export type CheckoutSessionUpdateDetailsFragment = {
3186
+ cartId: string | null;
3040
3187
  clientSecret: string;
3041
3188
  id: string;
3042
3189
  landedCost: {
3043
3190
  amountSubtotals: {
3191
+ discounts: number | null;
3044
3192
  duties: number;
3045
3193
  fees: number;
3046
3194
  items: number;
@@ -3061,6 +3209,7 @@ export type CheckoutSessionUpdateDetailsFragment = {
3061
3209
  } | null> | null;
3062
3210
  organizationId: string;
3063
3211
  subtotals: {
3212
+ adjustments: number;
3064
3213
  duties: number;
3065
3214
  exchangeRate: {
3066
3215
  id: string;
@@ -3175,6 +3324,7 @@ export type ZonosSettingsQuery = {
3175
3324
  } | null;
3176
3325
  onlineStoreSettings: {
3177
3326
  allowedDomains: Array<string>;
3327
+ url: string;
3178
3328
  };
3179
3329
  organization: {
3180
3330
  id: string;
@@ -3468,6 +3618,91 @@ export type RemoveTrackingNumberMutation = {
3468
3618
  trackingNumbers: Array<string | null> | null;
3469
3619
  } | null;
3470
3620
  };
3621
+ export type CartQuery = {
3622
+ cart: {
3623
+ adjustments: Array<{
3624
+ amount: number;
3625
+ currencyCode: CurrencyCode;
3626
+ description: string;
3627
+ productId: string | null;
3628
+ sku: string | null;
3629
+ type: CartAdjustmentType;
3630
+ }>;
3631
+ id: string;
3632
+ items: Array<{
3633
+ amount: number;
3634
+ attributes: Array<{
3635
+ key: string | null;
3636
+ value: string | null;
3637
+ } | null> | null;
3638
+ countryOfOrigin: CountryCode | null;
3639
+ currencyCode: CurrencyCode;
3640
+ description: string | null;
3641
+ id: string;
3642
+ imageUrl: string | null;
3643
+ itemType: ItemType | null;
3644
+ measurements: Array<{
3645
+ type: ItemMeasurementType;
3646
+ unitOfMeasure: ItemUnitOfMeasure;
3647
+ value: number;
3648
+ } | null> | null;
3649
+ name: string | null;
3650
+ productId: string;
3651
+ quantity: number;
3652
+ sku: string | null;
3653
+ }>;
3654
+ metadata: Array<{
3655
+ key: string;
3656
+ value: string;
3657
+ }>;
3658
+ organizationId: string;
3659
+ } | null;
3660
+ };
3661
+ export type GetCartOrganizationInfoQuery = {
3662
+ onlineStoreSettings: {
3663
+ url: string;
3664
+ };
3665
+ organization: {
3666
+ references: {
3667
+ storeId: number | null;
3668
+ } | null;
3669
+ } | null;
3670
+ };
3671
+ export type CartCreateMutation = {
3672
+ cartCreate: {
3673
+ adjustments: Array<{
3674
+ amount: number;
3675
+ currencyCode: CurrencyCode;
3676
+ description: string;
3677
+ productId: string | null;
3678
+ sku: string | null;
3679
+ type: CartAdjustmentType;
3680
+ }>;
3681
+ id: string;
3682
+ items: Array<{
3683
+ amount: number;
3684
+ attributes: Array<{
3685
+ key: string | null;
3686
+ value: string | null;
3687
+ } | null> | null;
3688
+ description: string | null;
3689
+ id: string;
3690
+ imageUrl: string | null;
3691
+ name: string | null;
3692
+ quantity: number;
3693
+ restriction: {
3694
+ action: RestrictedItemAction;
3695
+ reason: string;
3696
+ } | null;
3697
+ sku: string | null;
3698
+ }>;
3699
+ metadata: Array<{
3700
+ key: string;
3701
+ value: string;
3702
+ }>;
3703
+ organizationId: string;
3704
+ };
3705
+ };
3471
3706
  export type SdkFunctionWrapper = <T>(action: (requestHeaders?: Record<string, string>) => Promise<T>, operationName: string, operationType?: string) => Promise<T>;
3472
3707
  export declare function getSdk(client: GraphQLClient, withWrapper?: SdkFunctionWrapper): {
3473
3708
  addTrackingNumber(variables?: {
@@ -3479,6 +3714,15 @@ export declare function getSdk(client: GraphQLClient, withWrapper?: SdkFunctionW
3479
3714
  calculateLandedCost(variables?: {
3480
3715
  [x: string]: never;
3481
3716
  }, requestHeaders?: GraphQLClientRequestHeaders): Promise<CalculateLandedCostMutation>;
3717
+ cart(variables?: {
3718
+ [x: string]: never;
3719
+ }, requestHeaders?: GraphQLClientRequestHeaders): Promise<CartQuery>;
3720
+ cartCalculateLandedCost(variables?: {
3721
+ [x: string]: never;
3722
+ }, requestHeaders?: GraphQLClientRequestHeaders): Promise<CartCalculateLandedCostMutation>;
3723
+ cartCreate(variables?: {
3724
+ [x: string]: never;
3725
+ }, requestHeaders?: GraphQLClientRequestHeaders): Promise<CartCreateMutation>;
3482
3726
  checkItemRestrictions(variables?: {
3483
3727
  [x: string]: never;
3484
3728
  }, requestHeaders?: GraphQLClientRequestHeaders): Promise<CheckItemRestrictionsMutation>;
@@ -3503,6 +3747,9 @@ export declare function getSdk(client: GraphQLClient, withWrapper?: SdkFunctionW
3503
3747
  fulfillmentCenter(variables?: {
3504
3748
  [x: string]: never;
3505
3749
  }, requestHeaders?: GraphQLClientRequestHeaders): Promise<FulfillmentCenterQuery>;
3750
+ getCartOrganizationInfo(variables?: {
3751
+ [x: string]: never;
3752
+ }, requestHeaders?: GraphQLClientRequestHeaders): Promise<GetCartOrganizationInfoQuery>;
3506
3753
  getCheckoutPlaceOrderButtonSelector(variables?: {
3507
3754
  [x: string]: never;
3508
3755
  }, requestHeaders?: GraphQLClientRequestHeaders): Promise<GetCheckoutPlaceOrderButtonSelectorQuery>;