@wix/auto_sdk_ecom_current-cart-v-2 1.0.22 → 1.0.24

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 (35) hide show
  1. package/build/cjs/index.d.ts +28 -16
  2. package/build/cjs/index.js +2 -64
  3. package/build/cjs/index.js.map +1 -1
  4. package/build/cjs/index.typings.js +2 -64
  5. package/build/cjs/index.typings.js.map +1 -1
  6. package/build/cjs/meta.d.ts +22 -19
  7. package/build/cjs/meta.js +0 -64
  8. package/build/cjs/meta.js.map +1 -1
  9. package/build/es/index.d.mts +28 -16
  10. package/build/es/index.mjs +2 -64
  11. package/build/es/index.mjs.map +1 -1
  12. package/build/es/index.typings.mjs +2 -64
  13. package/build/es/index.typings.mjs.map +1 -1
  14. package/build/es/meta.d.mts +22 -19
  15. package/build/es/meta.mjs +0 -64
  16. package/build/es/meta.mjs.map +1 -1
  17. package/build/internal/cjs/index.d.ts +0 -3
  18. package/build/internal/cjs/index.js +2 -64
  19. package/build/internal/cjs/index.js.map +1 -1
  20. package/build/internal/cjs/index.typings.d.ts +28 -19
  21. package/build/internal/cjs/index.typings.js +2 -64
  22. package/build/internal/cjs/index.typings.js.map +1 -1
  23. package/build/internal/cjs/meta.d.ts +22 -19
  24. package/build/internal/cjs/meta.js +0 -64
  25. package/build/internal/cjs/meta.js.map +1 -1
  26. package/build/internal/es/index.d.mts +0 -3
  27. package/build/internal/es/index.mjs +2 -64
  28. package/build/internal/es/index.mjs.map +1 -1
  29. package/build/internal/es/index.typings.d.mts +28 -19
  30. package/build/internal/es/index.typings.mjs +2 -64
  31. package/build/internal/es/index.typings.mjs.map +1 -1
  32. package/build/internal/es/meta.d.mts +22 -19
  33. package/build/internal/es/meta.mjs +0 -64
  34. package/build/internal/es/meta.mjs.map +1 -1
  35. package/package.json +2 -2
@@ -24,13 +24,15 @@ interface Cart {
24
24
  revision?: string | null;
25
25
  /**
26
26
  * Line items added to the Cart by the customer.
27
- * This list may include both valid items (in stock) and invalid ones (e.g., out of stock).
28
- * When submitting an order, only valid items will be included in the order.
27
+ * This list may include items in stock and invalid out out stock.
29
28
  * @maxSize 300
30
29
  * @readonly
31
30
  */
32
31
  lineItems?: V2LineItem[];
33
- /** The sum of all line item final prices. */
32
+ /**
33
+ * The sum of all line item final prices.
34
+ * @readonly
35
+ */
34
36
  subtotal?: ConvertedMoney;
35
37
  /**
36
38
  * Optional message left by the customer.
@@ -42,6 +44,7 @@ interface Cart {
42
44
  * List of coupons added to the Cart.
43
45
  * Currently, only one coupon code is supported.
44
46
  * @maxSize 1
47
+ * @readonly
45
48
  */
46
49
  coupons?: Coupon[];
47
50
  /** Information about the source of the Cart, detailing the origin or context in which the Cart was created. */
@@ -226,6 +229,7 @@ interface ConvertedMoney {
226
229
  * Default: `amount`.
227
230
  * @format DECIMAL_VALUE
228
231
  * @decimalValue options { gte:0, lte:999999999, maxScale:3 }
232
+ * @readonly
229
233
  */
230
234
  convertedAmount?: string;
231
235
  }
@@ -2014,7 +2018,6 @@ interface CreateCurrentCartRequest {
2014
2018
  /**
2015
2019
  * Coupons to apply.
2016
2020
  * Currently only one is supported.
2017
- * If the coupon code is invalid, the cart will be created without it.
2018
2021
  * @maxSize 1
2019
2022
  * @minLength 1
2020
2023
  * @maxLength 50
@@ -2023,7 +2026,6 @@ interface CreateCurrentCartRequest {
2023
2026
  /**
2024
2027
  * Gift cards to add.
2025
2028
  * Currently only one is support.
2026
- * If the gift card code is invalid, the cart will be created without it.
2027
2029
  * @maxSize 1
2028
2030
  * @minLength 8
2029
2031
  * @maxLength 20
@@ -2098,18 +2100,14 @@ interface CustomItemPricingInfo {
2098
2100
  /**
2099
2101
  * Sale price of a single item, without modifiers.
2100
2102
  * Includes tax if `tax_info.prices_include_tax` is true.
2101
- * @format DECIMAL_VALUE
2102
- * @decimalValue options { gte:0, lte:1000000000000000, maxScale:3 }
2103
2103
  */
2104
- price?: string;
2104
+ price?: ConvertedMoney;
2105
2105
  /**
2106
2106
  * Full price of a single item before any discounts, without modifiers.
2107
2107
  * Defaults to `price` when not provided.
2108
2108
  * Includes tax if `tax_info.prices_include_tax` is true.
2109
- * @format DECIMAL_VALUE
2110
- * @decimalValue options { gte:0, lte:1000000000000000, maxScale:3 }
2111
2109
  */
2112
- fullPrice?: string | null;
2110
+ fullPrice?: ConvertedMoney;
2113
2111
  /**
2114
2112
  * Additional description for the price.
2115
2113
  * For example, when price is 0 but additional details about the actual price are needed - "Starts at $67".
@@ -2225,6 +2223,12 @@ interface RefreshCurrentCartResponse {
2225
2223
  cart?: Cart;
2226
2224
  }
2227
2225
  interface CalculateCurrentCartRequest {
2226
+ /**
2227
+ * Whether to retrieve the latest item prices, discounts, and inventory data from the catalogs before calculating the cart.
2228
+ *
2229
+ * Default: `false`
2230
+ */
2231
+ refreshCart?: boolean;
2228
2232
  /**
2229
2233
  * Specifies the level of **business validation** to perform during cart calculation,
2230
2234
  * by calling the [Validations service plugin](https://dev.wix.com/api/rest/wix-ecommerce/validations-integration-spi/introduction).
@@ -2547,7 +2551,6 @@ interface CreateCartRequest {
2547
2551
  /**
2548
2552
  * Coupons to apply.
2549
2553
  * Currently only one is supported.
2550
- * If the coupon code is invalid, the cart will be created without it.
2551
2554
  * @maxSize 1
2552
2555
  * @minLength 1
2553
2556
  * @maxLength 50
@@ -2556,7 +2559,6 @@ interface CreateCartRequest {
2556
2559
  /**
2557
2560
  * Gift cards to add.
2558
2561
  * Currently only one is support.
2559
- * If the gift card code is invalid, the cart will be created without it.
2560
2562
  * @maxSize 1
2561
2563
  * @minLength 8
2562
2564
  * @maxLength 20
@@ -2612,6 +2614,12 @@ interface CalculateCartRequest {
2612
2614
  * @format GUID
2613
2615
  */
2614
2616
  cartId?: string;
2617
+ /**
2618
+ * Whether to retrieve the latest item prices, discounts, and inventory data from the catalogs before calculating the cart.
2619
+ *
2620
+ * Default: `false`
2621
+ */
2622
+ refreshCart?: boolean;
2615
2623
  /**
2616
2624
  * Specifies the level of **business validation** to perform during cart calculation,
2617
2625
  * by calling the [Validations service plugin](https://dev.wix.com/api/rest/wix-ecommerce/validations-integration-spi/introduction).
@@ -2715,7 +2723,7 @@ interface PlaceOrderResponse {
2715
2723
  */
2716
2724
  paymentGatewayOrderId?: string | null;
2717
2725
  /** Whether an order was successfully created from this cart and the payment transaction was completed. */
2718
- cartCompleted?: boolean;
2726
+ completed?: boolean;
2719
2727
  }
2720
2728
  interface AddLineItemsRequest {
2721
2729
  /**
@@ -2914,7 +2922,6 @@ interface CreateCurrentCartOptions {
2914
2922
  /**
2915
2923
  * Coupons to apply.
2916
2924
  * Currently only one is supported.
2917
- * If the coupon code is invalid, the cart will be created without it.
2918
2925
  * @maxSize 1
2919
2926
  * @minLength 1
2920
2927
  * @maxLength 50
@@ -2923,7 +2930,6 @@ interface CreateCurrentCartOptions {
2923
2930
  /**
2924
2931
  * Gift cards to add.
2925
2932
  * Currently only one is support.
2926
- * If the gift card code is invalid, the cart will be created without it.
2927
2933
  * @maxSize 1
2928
2934
  * @minLength 8
2929
2935
  * @maxLength 20
@@ -2972,9 +2978,6 @@ declare function refreshCurrentCart(): Promise<NonNullablePaths<RefreshCurrentCa
2972
2978
  /**
2973
2979
  * Calculates the cart based on its current state (line items, discounts, delivery method, etc.)
2974
2980
  * and returns a detailed summary including subtotal, delivery costs, taxes, fees and the total price.
2975
- * Note that discounts are already pre-computed and applied to the Cart.
2976
- *
2977
- * This is a read-only operation that does not modify the cart.
2978
2981
  * @internal
2979
2982
  * @documentationMaturity preview
2980
2983
  * @permissionId ecom:v2:cart:calculate_cart
@@ -2982,6 +2985,12 @@ declare function refreshCurrentCart(): Promise<NonNullablePaths<RefreshCurrentCa
2982
2985
  */
2983
2986
  declare function calculateCurrentCart(options?: CalculateCurrentCartOptions): Promise<NonNullablePaths<CalculateCurrentCartResponse, `cart._id` | `cart.lineItems` | `cart.lineItems.${number}._id` | `cart.lineItems.${number}.name.original` | `cart.lineItems.${number}.quantityInfo.confirmedQuantity` | `cart.lineItems.${number}.quantityInfo.requestedQuantity` | `cart.lineItems.${number}.quantityInfo.fixedQuantity` | `cart.lineItems.${number}.pricing.unitPrice.amount` | `cart.lineItems.${number}.pricing.unitPrice.convertedAmount` | `cart.lineItems.${number}.pricing.priceDescription.original` | `cart.lineItems.${number}.pricing.priceUndetermined` | `cart.lineItems.${number}.source.catalogReference.catalogItemId` | `cart.lineItems.${number}.source.catalogReference.appId` | `cart.lineItems.${number}.attributes.itemType.preset` | `cart.lineItems.${number}.attributes.itemType.custom` | `cart.lineItems.${number}.attributes.physicalProperties.shippable` | `cart.lineItems.${number}.attributes.membersOnly` | `cart.lineItems.${number}.taxConfig.taxableAddress.addressType` | `cart.lineItems.${number}.paymentConfig.savePaymentMethod` | `cart.lineItems.${number}.paymentConfig.selectedMembership._id` | `cart.lineItems.${number}.paymentConfig.selectedMembership.appId` | `cart.lineItems.${number}.paymentConfig.paymentOption` | `cart.lineItems.${number}.status` | `cart.lineItems.${number}.customLineItem` | `cart.coupons` | `cart.coupons.${number}._id` | `cart.coupons.${number}.code` | `cart.source.channelType` | `cart.source.externalReferences` | `cart.source.externalReferences.${number}.appId` | `cart.source.createdBy.visitorId` | `cart.source.createdBy.memberId` | `cart.source.createdBy.userId` | `cart.source.createdBy.appId` | `cart.source.customContentReference.appId` | `cart.source.customContentReference.componentId` | `cart.businessInfo.languageCode` | `cart.businessInfo.currencyCode` | `cart.customerInfo.visitorId` | `cart.customerInfo.memberId` | `cart.customerInfo.userId` | `cart.customerInfo.vatId._id` | `cart.customerInfo.vatId.type` | `cart.customerInfo.languageCode` | `cart.customerInfo.currencyCode` | `cart.deliveryInfo.address.streetAddress.number` | `cart.deliveryInfo.address.streetAddress.name` | `cart.deliveryInfo.method.code` | `cart.deliveryInfo.method.pickup` | `cart.deliveryInfo.weightUnit` | `cart.taxInfo.pricesIncludeTax` | `cart.paymentInfo.giftCards` | `cart.paymentInfo.giftCards.${number}._id` | `cart.paymentInfo.giftCards.${number}.obfuscatedCode` | `cart.paymentInfo.giftCards.${number}.appId` | `cart.paymentInfo.currencyCode` | `cart.orderPlaced` | `cart.settings.lockGiftCard` | `cart.settings.lockCouponCode` | `cart.settings.policyAgreementCheckboxDisabled` | `cart.settings.manualPaymentDisabled` | `summary.cartId` | `summary.lineItems` | `summary.lineItems.${number}.lineItemId` | `summary.lineItems.${number}.quantity` | `summary.lineItems.${number}.unitPrice.amount` | `summary.lineItems.${number}.unitPrice.convertedAmount` | `summary.discounts` | `summary.discounts.${number}.name.original` | `summary.discounts.${number}.source.sourceType` | `summary.discounts.${number}.scope` | `summary.deliverySummary.method.code` | `summary.deliverySummary.method.pickup` | `summary.additionalFees` | `summary.taxSummary.taxes` | `summary.taxSummary.pricesIncludeTax` | `summary.taxSummary.lineItemTaxes` | `summary.taxSummary.lineItemTaxes.${number}.lineItemId` | `summary.taxSummary.additionalFeeTaxes` | `summary.taxSummary.additionalFeeTaxes.${number}.additionalFeeCode` | `summary.paymentSummary.giftCards` | `summary.paymentSummary.giftCards.${number}.giftCardId` | `summary.paymentSummary.memberships` | `summary.paymentSummary.memberships.${number}._id` | `summary.paymentSummary.memberships.${number}.appId` | `summary.paymentSummary.subscriptionCharges` | `summary.paymentSummary.requiresPaymentAfterGiftCard` | `summary.calculationErrors.generalShippingCalculationError.applicationError.code` | `summary.calculationErrors.generalShippingCalculationError.applicationError.description` | `summary.calculationErrors.generalShippingCalculationError.validationError.fieldViolations` | `summary.calculationErrors.generalShippingCalculationError.validationError.fieldViolations.${number}.field` | `summary.calculationErrors.generalShippingCalculationError.validationError.fieldViolations.${number}.description` | `summary.calculationErrors.generalShippingCalculationError.validationError.fieldViolations.${number}.violatedRule` | `summary.calculationErrors.carrierErrors.errors` | `summary.calculationErrors.carrierErrors.errors.${number}.carrierId` | `summary.calculationErrors.orderValidationErrors` | `summary.spiViolations` | `summary.spiViolations.${number}.severity` | `summary.spiViolations.${number}.target.other.name` | `summary.spiViolations.${number}.target.lineItem.name`, 8>>;
2984
2987
  interface CalculateCurrentCartOptions {
2988
+ /**
2989
+ * Whether to retrieve the latest item prices, discounts, and inventory data from the catalogs before calculating the cart.
2990
+ *
2991
+ * Default: `false`
2992
+ */
2993
+ refreshCart?: boolean;
2985
2994
  /**
2986
2995
  * Specifies the level of **business validation** to perform during cart calculation,
2987
2996
  * by calling the [Validations service plugin](https://dev.wix.com/api/rest/wix-ecommerce/validations-integration-spi/introduction).
@@ -166,18 +166,10 @@ function createCurrentCart(payload) {
166
166
  paths: [
167
167
  { path: "cart.createdDate" },
168
168
  { path: "cart.updatedDate" },
169
- {
170
- path: "cart.lineItems.source.catalogOverrideFields.image.urlExpirationDate"
171
- },
172
- { path: "cart.lineItems.attributes.image.urlExpirationDate" },
173
169
  {
174
170
  path: "cart.lineItems.attributes.subscriptionInfo.subscriptionSettings.startDate"
175
171
  },
176
172
  { path: "cart.lineItems.attributes.serviceProperties.scheduledDate" },
177
- {
178
- path: "catalogItems.catalogOverrideFields.image.urlExpirationDate"
179
- },
180
- { path: "customItems.attributes.image.urlExpirationDate" },
181
173
  {
182
174
  path: "customItems.attributes.subscriptionInfo.subscriptionSettings.startDate"
183
175
  },
@@ -222,10 +214,6 @@ function createCurrentCart(payload) {
222
214
  paths: [
223
215
  { path: "cart.createdDate" },
224
216
  { path: "cart.updatedDate" },
225
- {
226
- path: "cart.lineItems.source.catalogOverrideFields.image.urlExpirationDate"
227
- },
228
- { path: "cart.lineItems.attributes.image.urlExpirationDate" },
229
217
  {
230
218
  path: "cart.lineItems.attributes.subscriptionInfo.subscriptionSettings.startDate"
231
219
  },
@@ -275,10 +263,6 @@ function getCurrentCart(payload) {
275
263
  paths: [
276
264
  { path: "cart.createdDate" },
277
265
  { path: "cart.updatedDate" },
278
- {
279
- path: "cart.lineItems.source.catalogOverrideFields.image.urlExpirationDate"
280
- },
281
- { path: "cart.lineItems.attributes.image.urlExpirationDate" },
282
266
  {
283
267
  path: "cart.lineItems.attributes.subscriptionInfo.subscriptionSettings.startDate"
284
268
  },
@@ -318,10 +302,6 @@ function updateCurrentCart(payload) {
318
302
  paths: [
319
303
  { path: "cart.createdDate" },
320
304
  { path: "cart.updatedDate" },
321
- {
322
- path: "cart.lineItems.source.catalogOverrideFields.image.urlExpirationDate"
323
- },
324
- { path: "cart.lineItems.attributes.image.urlExpirationDate" },
325
305
  {
326
306
  path: "cart.lineItems.attributes.subscriptionInfo.subscriptionSettings.startDate"
327
307
  },
@@ -362,10 +342,6 @@ function updateCurrentCart(payload) {
362
342
  paths: [
363
343
  { path: "cart.createdDate" },
364
344
  { path: "cart.updatedDate" },
365
- {
366
- path: "cart.lineItems.source.catalogOverrideFields.image.urlExpirationDate"
367
- },
368
- { path: "cart.lineItems.attributes.image.urlExpirationDate" },
369
345
  {
370
346
  path: "cart.lineItems.attributes.subscriptionInfo.subscriptionSettings.startDate"
371
347
  },
@@ -436,10 +412,6 @@ function refreshCurrentCart(payload) {
436
412
  paths: [
437
413
  { path: "cart.createdDate" },
438
414
  { path: "cart.updatedDate" },
439
- {
440
- path: "cart.lineItems.source.catalogOverrideFields.image.urlExpirationDate"
441
- },
442
- { path: "cart.lineItems.attributes.image.urlExpirationDate" },
443
415
  {
444
416
  path: "cart.lineItems.attributes.subscriptionInfo.subscriptionSettings.startDate"
445
417
  },
@@ -489,10 +461,6 @@ function calculateCurrentCart(payload) {
489
461
  paths: [
490
462
  { path: "cart.createdDate" },
491
463
  { path: "cart.updatedDate" },
492
- {
493
- path: "cart.lineItems.source.catalogOverrideFields.image.urlExpirationDate"
494
- },
495
- { path: "cart.lineItems.attributes.image.urlExpirationDate" },
496
464
  {
497
465
  path: "cart.lineItems.attributes.subscriptionInfo.subscriptionSettings.startDate"
498
466
  },
@@ -538,10 +506,6 @@ function addLineItemsToCurrentCart(payload) {
538
506
  {
539
507
  transformFn: import_timestamp.transformSDKTimestampToRESTTimestamp,
540
508
  paths: [
541
- {
542
- path: "catalogItems.catalogOverrideFields.image.urlExpirationDate"
543
- },
544
- { path: "customItems.attributes.image.urlExpirationDate" },
545
509
  {
546
510
  path: "customItems.attributes.subscriptionInfo.subscriptionSettings.startDate"
547
511
  },
@@ -569,10 +533,6 @@ function addLineItemsToCurrentCart(payload) {
569
533
  paths: [
570
534
  { path: "cart.createdDate" },
571
535
  { path: "cart.updatedDate" },
572
- {
573
- path: "cart.lineItems.source.catalogOverrideFields.image.urlExpirationDate"
574
- },
575
- { path: "cart.lineItems.attributes.image.urlExpirationDate" },
576
536
  {
577
537
  path: "cart.lineItems.attributes.subscriptionInfo.subscriptionSettings.startDate"
578
538
  },
@@ -622,10 +582,6 @@ function removeLineItemsFromCurrentCart(payload) {
622
582
  paths: [
623
583
  { path: "cart.createdDate" },
624
584
  { path: "cart.updatedDate" },
625
- {
626
- path: "cart.lineItems.source.catalogOverrideFields.image.urlExpirationDate"
627
- },
628
- { path: "cart.lineItems.attributes.image.urlExpirationDate" },
629
585
  {
630
586
  path: "cart.lineItems.attributes.subscriptionInfo.subscriptionSettings.startDate"
631
587
  },
@@ -675,10 +631,6 @@ function updateLineItemsInCurrentCart(payload) {
675
631
  paths: [
676
632
  { path: "cart.createdDate" },
677
633
  { path: "cart.updatedDate" },
678
- {
679
- path: "cart.lineItems.source.catalogOverrideFields.image.urlExpirationDate"
680
- },
681
- { path: "cart.lineItems.attributes.image.urlExpirationDate" },
682
634
  {
683
635
  path: "cart.lineItems.attributes.subscriptionInfo.subscriptionSettings.startDate"
684
636
  },
@@ -728,10 +680,6 @@ function addCouponToCurrentCart(payload) {
728
680
  paths: [
729
681
  { path: "cart.createdDate" },
730
682
  { path: "cart.updatedDate" },
731
- {
732
- path: "cart.lineItems.source.catalogOverrideFields.image.urlExpirationDate"
733
- },
734
- { path: "cart.lineItems.attributes.image.urlExpirationDate" },
735
683
  {
736
684
  path: "cart.lineItems.attributes.subscriptionInfo.subscriptionSettings.startDate"
737
685
  },
@@ -781,10 +729,6 @@ function removeCouponFromCurrentCart(payload) {
781
729
  paths: [
782
730
  { path: "cart.createdDate" },
783
731
  { path: "cart.updatedDate" },
784
- {
785
- path: "cart.lineItems.source.catalogOverrideFields.image.urlExpirationDate"
786
- },
787
- { path: "cart.lineItems.attributes.image.urlExpirationDate" },
788
732
  {
789
733
  path: "cart.lineItems.attributes.subscriptionInfo.subscriptionSettings.startDate"
790
734
  },
@@ -834,10 +778,6 @@ function addGiftCardToCurrentCart(payload) {
834
778
  paths: [
835
779
  { path: "cart.createdDate" },
836
780
  { path: "cart.updatedDate" },
837
- {
838
- path: "cart.lineItems.source.catalogOverrideFields.image.urlExpirationDate"
839
- },
840
- { path: "cart.lineItems.attributes.image.urlExpirationDate" },
841
781
  {
842
782
  path: "cart.lineItems.attributes.subscriptionInfo.subscriptionSettings.startDate"
843
783
  },
@@ -887,10 +827,6 @@ function removeGiftCardFromCurrentCart(payload) {
887
827
  paths: [
888
828
  { path: "cart.createdDate" },
889
829
  { path: "cart.updatedDate" },
890
- {
891
- path: "cart.lineItems.source.catalogOverrideFields.image.urlExpirationDate"
892
- },
893
- { path: "cart.lineItems.attributes.image.urlExpirationDate" },
894
830
  {
895
831
  path: "cart.lineItems.attributes.subscriptionInfo.subscriptionSettings.startDate"
896
832
  },
@@ -1346,6 +1282,7 @@ async function refreshCurrentCart2() {
1346
1282
  async function calculateCurrentCart2(options) {
1347
1283
  const { httpClient, sideEffects } = arguments[1];
1348
1284
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
1285
+ refreshCart: options?.refreshCart,
1349
1286
  validationsConfig: options?.validationsConfig,
1350
1287
  customCalculationConfig: options?.customCalculationConfig
1351
1288
  });
@@ -1382,6 +1319,7 @@ async function calculateCurrentCart2(options) {
1382
1319
  {
1383
1320
  spreadPathsToArguments: {},
1384
1321
  explicitPathsToArguments: {
1322
+ refreshCart: "$[0].refreshCart",
1385
1323
  validationsConfig: "$[0].validationsConfig",
1386
1324
  customCalculationConfig: "$[0].customCalculationConfig"
1387
1325
  },