@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).
@@ -112,18 +112,10 @@ function createCurrentCart(payload) {
112
112
  paths: [
113
113
  { path: "cart.createdDate" },
114
114
  { path: "cart.updatedDate" },
115
- {
116
- path: "cart.lineItems.source.catalogOverrideFields.image.urlExpirationDate"
117
- },
118
- { path: "cart.lineItems.attributes.image.urlExpirationDate" },
119
115
  {
120
116
  path: "cart.lineItems.attributes.subscriptionInfo.subscriptionSettings.startDate"
121
117
  },
122
118
  { path: "cart.lineItems.attributes.serviceProperties.scheduledDate" },
123
- {
124
- path: "catalogItems.catalogOverrideFields.image.urlExpirationDate"
125
- },
126
- { path: "customItems.attributes.image.urlExpirationDate" },
127
119
  {
128
120
  path: "customItems.attributes.subscriptionInfo.subscriptionSettings.startDate"
129
121
  },
@@ -168,10 +160,6 @@ function createCurrentCart(payload) {
168
160
  paths: [
169
161
  { path: "cart.createdDate" },
170
162
  { path: "cart.updatedDate" },
171
- {
172
- path: "cart.lineItems.source.catalogOverrideFields.image.urlExpirationDate"
173
- },
174
- { path: "cart.lineItems.attributes.image.urlExpirationDate" },
175
163
  {
176
164
  path: "cart.lineItems.attributes.subscriptionInfo.subscriptionSettings.startDate"
177
165
  },
@@ -221,10 +209,6 @@ function getCurrentCart(payload) {
221
209
  paths: [
222
210
  { path: "cart.createdDate" },
223
211
  { path: "cart.updatedDate" },
224
- {
225
- path: "cart.lineItems.source.catalogOverrideFields.image.urlExpirationDate"
226
- },
227
- { path: "cart.lineItems.attributes.image.urlExpirationDate" },
228
212
  {
229
213
  path: "cart.lineItems.attributes.subscriptionInfo.subscriptionSettings.startDate"
230
214
  },
@@ -264,10 +248,6 @@ function updateCurrentCart(payload) {
264
248
  paths: [
265
249
  { path: "cart.createdDate" },
266
250
  { path: "cart.updatedDate" },
267
- {
268
- path: "cart.lineItems.source.catalogOverrideFields.image.urlExpirationDate"
269
- },
270
- { path: "cart.lineItems.attributes.image.urlExpirationDate" },
271
251
  {
272
252
  path: "cart.lineItems.attributes.subscriptionInfo.subscriptionSettings.startDate"
273
253
  },
@@ -308,10 +288,6 @@ function updateCurrentCart(payload) {
308
288
  paths: [
309
289
  { path: "cart.createdDate" },
310
290
  { path: "cart.updatedDate" },
311
- {
312
- path: "cart.lineItems.source.catalogOverrideFields.image.urlExpirationDate"
313
- },
314
- { path: "cart.lineItems.attributes.image.urlExpirationDate" },
315
291
  {
316
292
  path: "cart.lineItems.attributes.subscriptionInfo.subscriptionSettings.startDate"
317
293
  },
@@ -382,10 +358,6 @@ function refreshCurrentCart(payload) {
382
358
  paths: [
383
359
  { path: "cart.createdDate" },
384
360
  { path: "cart.updatedDate" },
385
- {
386
- path: "cart.lineItems.source.catalogOverrideFields.image.urlExpirationDate"
387
- },
388
- { path: "cart.lineItems.attributes.image.urlExpirationDate" },
389
361
  {
390
362
  path: "cart.lineItems.attributes.subscriptionInfo.subscriptionSettings.startDate"
391
363
  },
@@ -435,10 +407,6 @@ function calculateCurrentCart(payload) {
435
407
  paths: [
436
408
  { path: "cart.createdDate" },
437
409
  { path: "cart.updatedDate" },
438
- {
439
- path: "cart.lineItems.source.catalogOverrideFields.image.urlExpirationDate"
440
- },
441
- { path: "cart.lineItems.attributes.image.urlExpirationDate" },
442
410
  {
443
411
  path: "cart.lineItems.attributes.subscriptionInfo.subscriptionSettings.startDate"
444
412
  },
@@ -484,10 +452,6 @@ function addLineItemsToCurrentCart(payload) {
484
452
  {
485
453
  transformFn: transformSDKTimestampToRESTTimestamp,
486
454
  paths: [
487
- {
488
- path: "catalogItems.catalogOverrideFields.image.urlExpirationDate"
489
- },
490
- { path: "customItems.attributes.image.urlExpirationDate" },
491
455
  {
492
456
  path: "customItems.attributes.subscriptionInfo.subscriptionSettings.startDate"
493
457
  },
@@ -515,10 +479,6 @@ function addLineItemsToCurrentCart(payload) {
515
479
  paths: [
516
480
  { path: "cart.createdDate" },
517
481
  { path: "cart.updatedDate" },
518
- {
519
- path: "cart.lineItems.source.catalogOverrideFields.image.urlExpirationDate"
520
- },
521
- { path: "cart.lineItems.attributes.image.urlExpirationDate" },
522
482
  {
523
483
  path: "cart.lineItems.attributes.subscriptionInfo.subscriptionSettings.startDate"
524
484
  },
@@ -568,10 +528,6 @@ function removeLineItemsFromCurrentCart(payload) {
568
528
  paths: [
569
529
  { path: "cart.createdDate" },
570
530
  { path: "cart.updatedDate" },
571
- {
572
- path: "cart.lineItems.source.catalogOverrideFields.image.urlExpirationDate"
573
- },
574
- { path: "cart.lineItems.attributes.image.urlExpirationDate" },
575
531
  {
576
532
  path: "cart.lineItems.attributes.subscriptionInfo.subscriptionSettings.startDate"
577
533
  },
@@ -621,10 +577,6 @@ function updateLineItemsInCurrentCart(payload) {
621
577
  paths: [
622
578
  { path: "cart.createdDate" },
623
579
  { path: "cart.updatedDate" },
624
- {
625
- path: "cart.lineItems.source.catalogOverrideFields.image.urlExpirationDate"
626
- },
627
- { path: "cart.lineItems.attributes.image.urlExpirationDate" },
628
580
  {
629
581
  path: "cart.lineItems.attributes.subscriptionInfo.subscriptionSettings.startDate"
630
582
  },
@@ -674,10 +626,6 @@ function addCouponToCurrentCart(payload) {
674
626
  paths: [
675
627
  { path: "cart.createdDate" },
676
628
  { path: "cart.updatedDate" },
677
- {
678
- path: "cart.lineItems.source.catalogOverrideFields.image.urlExpirationDate"
679
- },
680
- { path: "cart.lineItems.attributes.image.urlExpirationDate" },
681
629
  {
682
630
  path: "cart.lineItems.attributes.subscriptionInfo.subscriptionSettings.startDate"
683
631
  },
@@ -727,10 +675,6 @@ function removeCouponFromCurrentCart(payload) {
727
675
  paths: [
728
676
  { path: "cart.createdDate" },
729
677
  { path: "cart.updatedDate" },
730
- {
731
- path: "cart.lineItems.source.catalogOverrideFields.image.urlExpirationDate"
732
- },
733
- { path: "cart.lineItems.attributes.image.urlExpirationDate" },
734
678
  {
735
679
  path: "cart.lineItems.attributes.subscriptionInfo.subscriptionSettings.startDate"
736
680
  },
@@ -780,10 +724,6 @@ function addGiftCardToCurrentCart(payload) {
780
724
  paths: [
781
725
  { path: "cart.createdDate" },
782
726
  { path: "cart.updatedDate" },
783
- {
784
- path: "cart.lineItems.source.catalogOverrideFields.image.urlExpirationDate"
785
- },
786
- { path: "cart.lineItems.attributes.image.urlExpirationDate" },
787
727
  {
788
728
  path: "cart.lineItems.attributes.subscriptionInfo.subscriptionSettings.startDate"
789
729
  },
@@ -833,10 +773,6 @@ function removeGiftCardFromCurrentCart(payload) {
833
773
  paths: [
834
774
  { path: "cart.createdDate" },
835
775
  { path: "cart.updatedDate" },
836
- {
837
- path: "cart.lineItems.source.catalogOverrideFields.image.urlExpirationDate"
838
- },
839
- { path: "cart.lineItems.attributes.image.urlExpirationDate" },
840
776
  {
841
777
  path: "cart.lineItems.attributes.subscriptionInfo.subscriptionSettings.startDate"
842
778
  },
@@ -1292,6 +1228,7 @@ async function refreshCurrentCart2() {
1292
1228
  async function calculateCurrentCart2(options) {
1293
1229
  const { httpClient, sideEffects } = arguments[1];
1294
1230
  const payload = renameKeysFromSDKRequestToRESTRequest({
1231
+ refreshCart: options?.refreshCart,
1295
1232
  validationsConfig: options?.validationsConfig,
1296
1233
  customCalculationConfig: options?.customCalculationConfig
1297
1234
  });
@@ -1328,6 +1265,7 @@ async function calculateCurrentCart2(options) {
1328
1265
  {
1329
1266
  spreadPathsToArguments: {},
1330
1267
  explicitPathsToArguments: {
1268
+ refreshCart: "$[0].refreshCart",
1331
1269
  validationsConfig: "$[0].validationsConfig",
1332
1270
  customCalculationConfig: "$[0].customCalculationConfig"
1333
1271
  },