@wix/auto_sdk_ecom_cart-v-2 1.0.15 → 1.0.17

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 (37) hide show
  1. package/build/cjs/index.d.ts +68 -38
  2. package/build/cjs/index.js +53 -17
  3. package/build/cjs/index.js.map +1 -1
  4. package/build/cjs/index.typings.d.ts +1 -1
  5. package/build/cjs/index.typings.js +53 -17
  6. package/build/cjs/index.typings.js.map +1 -1
  7. package/build/cjs/meta.d.ts +155 -33
  8. package/build/cjs/meta.js +51 -0
  9. package/build/cjs/meta.js.map +1 -1
  10. package/build/es/index.d.mts +68 -38
  11. package/build/es/index.mjs +53 -15
  12. package/build/es/index.mjs.map +1 -1
  13. package/build/es/index.typings.d.mts +1 -1
  14. package/build/es/index.typings.mjs +53 -15
  15. package/build/es/index.typings.mjs.map +1 -1
  16. package/build/es/meta.d.mts +155 -33
  17. package/build/es/meta.mjs +51 -0
  18. package/build/es/meta.mjs.map +1 -1
  19. package/build/internal/cjs/index.d.ts +2 -2
  20. package/build/internal/cjs/index.js +53 -17
  21. package/build/internal/cjs/index.js.map +1 -1
  22. package/build/internal/cjs/index.typings.d.ts +69 -39
  23. package/build/internal/cjs/index.typings.js +53 -17
  24. package/build/internal/cjs/index.typings.js.map +1 -1
  25. package/build/internal/cjs/meta.d.ts +155 -33
  26. package/build/internal/cjs/meta.js +51 -0
  27. package/build/internal/cjs/meta.js.map +1 -1
  28. package/build/internal/es/index.d.mts +2 -2
  29. package/build/internal/es/index.mjs +53 -15
  30. package/build/internal/es/index.mjs.map +1 -1
  31. package/build/internal/es/index.typings.d.mts +69 -39
  32. package/build/internal/es/index.typings.mjs +53 -15
  33. package/build/internal/es/index.typings.mjs.map +1 -1
  34. package/build/internal/es/meta.d.mts +155 -33
  35. package/build/internal/es/meta.mjs +51 -0
  36. package/build/internal/es/meta.mjs.map +1 -1
  37. package/package.json +2 -2
@@ -126,7 +126,7 @@ interface V2LineItem {
126
126
  /**
127
127
  * Custom extended fields for the line item object.
128
128
  *
129
- * [Extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields) must be configured in the app dashboard before they can be accessed with API calls.
129
+ * [Extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields) must be configured using the 'Checkout & Orders - Line Items Schema Plugin' in the app dashboard before they can be accessed with API calls.
130
130
  */
131
131
  extendedFields?: ExtendedFields;
132
132
  /**
@@ -1461,16 +1461,6 @@ interface CartSummary {
1461
1461
  priceSummary?: PriceSummary;
1462
1462
  /** Payment details summarizing how the customer will pay for the order. */
1463
1463
  paymentSummary?: PaymentSummary;
1464
- /**
1465
- * List of errors that occurred during the calculation process.
1466
- * @maxSize 100
1467
- */
1468
- errors?: CalculationError[];
1469
- /**
1470
- * List of business violations raised by the Validations service plugin ([SDK](https://dev.wix.com/docs/sdk/backend-modules/ecom/service-plugins/validations/introduction) | [REST](https://dev.wix.com/docs/rest/business-solutions/e-commerce/service-plugins/validations-integration-service-plugin/introduction)).
1471
- * @maxSize 100
1472
- */
1473
- violations?: Violation[];
1474
1464
  /**
1475
1465
  * A token representing the Cart's calculated prices.
1476
1466
  *
@@ -1487,6 +1477,17 @@ interface CartSummary {
1487
1477
  * @maxLength 1024
1488
1478
  */
1489
1479
  priceVerificationToken?: string | null;
1480
+ /**
1481
+ * List of errors that occurred during the calculation process, returned by Totals Calculator.
1482
+ * TODO: Temporary field for backward compatibility; will be removed once we introduce the unified 'violations' model.
1483
+ */
1484
+ calculationErrors?: CalculationErrors;
1485
+ /**
1486
+ * List of business violations raised by the Validations service plugin ([SDK](https://dev.wix.com/docs/sdk/backend-modules/ecom/service-plugins/validations/introduction) | [REST](https://dev.wix.com/docs/rest/business-solutions/e-commerce/service-plugins/validations-integration-service-plugin/introduction)).
1487
+ * TODO: Temporary field for backward compatibility; will be removed once we introduce the unified 'violations' model.
1488
+ * @maxSize 100
1489
+ */
1490
+ spiViolations?: Violation[];
1490
1491
  }
1491
1492
  interface LineItemSummary {
1492
1493
  /**
@@ -1731,32 +1732,149 @@ interface Charge {
1731
1732
  /** The billing date from which the charge starts. */
1732
1733
  cycleBillingDate?: Date | null;
1733
1734
  }
1734
- interface CalculationError {
1735
- /** The calculation component that caused the error. */
1736
- component?: CalculationComponentWithLiterals;
1737
- /** Machine-readable error code. */
1738
- code?: ErrorCodeWithLiterals;
1735
+ interface CalculationErrors extends CalculationErrorsShippingCalculationErrorOneOf {
1736
+ /** General shipping calculation error. */
1737
+ generalShippingCalculationError?: Details;
1738
+ /** Carrier errors. */
1739
+ carrierErrors?: CarrierErrors;
1740
+ /** Tax calculation error. */
1741
+ taxCalculationError?: Details;
1742
+ /** Coupon calculation error. */
1743
+ couponCalculationError?: Details;
1744
+ /** Gift card calculation error. */
1745
+ giftCardCalculationError?: Details;
1746
+ /**
1747
+ * Order validation errors.
1748
+ * @maxSize 100
1749
+ */
1750
+ orderValidationErrors?: ApplicationError[];
1739
1751
  /**
1740
- * Human-readable explanation.
1741
- * @maxLength 100
1752
+ * Membership payment methods calculation errors
1753
+ * For example, will indicate that a line item that must be paid with membership payment doesn't have one or selected memberships are invalid
1742
1754
  */
1743
- description?: string | null;
1755
+ membershipError?: Details;
1756
+ /** Discount Rule calculation error. */
1757
+ discountsCalculationError?: Details;
1744
1758
  }
1745
- declare enum CalculationComponent {
1746
- UNKNOWN_CALCULATION_COMPONENT = "UNKNOWN_CALCULATION_COMPONENT",
1747
- DISCOUNTS = "DISCOUNTS",
1748
- DELIVERY = "DELIVERY",
1749
- TAX = "TAX",
1750
- MEMBERSHIPS = "MEMBERSHIPS",
1751
- GIFT_CARDS = "GIFT_CARDS"
1759
+ /** @oneof */
1760
+ interface CalculationErrorsShippingCalculationErrorOneOf {
1761
+ /** General shipping calculation error. */
1762
+ generalShippingCalculationError?: Details;
1763
+ /** Carrier errors. */
1764
+ carrierErrors?: CarrierErrors;
1752
1765
  }
1753
- /** @enumType */
1754
- type CalculationComponentWithLiterals = CalculationComponent | 'UNKNOWN_CALCULATION_COMPONENT' | 'DISCOUNTS' | 'DELIVERY' | 'TAX' | 'MEMBERSHIPS' | 'GIFT_CARDS';
1755
- declare enum ErrorCode {
1756
- UNKNOWN_ERROR_CODE = "UNKNOWN_ERROR_CODE"
1766
+ interface Details extends DetailsKindOneOf {
1767
+ applicationError?: ApplicationError;
1768
+ validationError?: ValidationError;
1769
+ systemError?: SystemError;
1770
+ /**
1771
+ * deprecated in API's - to enable migration from rendering arbitrary tracing to rest response
1772
+ * @deprecated
1773
+ */
1774
+ tracing?: Record<string, string>;
1775
+ }
1776
+ /** @oneof */
1777
+ interface DetailsKindOneOf {
1778
+ applicationError?: ApplicationError;
1779
+ validationError?: ValidationError;
1780
+ systemError?: SystemError;
1781
+ }
1782
+ interface ApplicationError {
1783
+ /** Error code. */
1784
+ code?: string;
1785
+ /** Description of the error. */
1786
+ description?: string;
1787
+ /** Data related to the error. */
1788
+ data?: Record<string, any> | null;
1789
+ }
1790
+ /**
1791
+ * example result:
1792
+ * {
1793
+ * "fieldViolations": [
1794
+ * {
1795
+ * "field": "fieldA",
1796
+ * "description": "invalid music note. supported notes: [do,re,mi,fa,sol,la,ti]",
1797
+ * "violatedRule": "OTHER",
1798
+ * "ruleName": "INVALID_NOTE",
1799
+ * "data": {
1800
+ * "value": "FI"
1801
+ * }
1802
+ * },
1803
+ * {
1804
+ * "field": "fieldB",
1805
+ * "description": "field value out of range. supported range: [0-20]",
1806
+ * "violatedRule": "MAX",
1807
+ * "data": {
1808
+ * "threshold": 20
1809
+ * }
1810
+ * },
1811
+ * {
1812
+ * "field": "fieldC",
1813
+ * "description": "invalid phone number. provide a valid phone number of size: [7-12], supported characters: [0-9, +, -, (, )]",
1814
+ * "violatedRule": "FORMAT",
1815
+ * "data": {
1816
+ * "type": "PHONE"
1817
+ * }
1818
+ * }
1819
+ * ]
1820
+ * }
1821
+ */
1822
+ interface ValidationError {
1823
+ fieldViolations?: FieldViolation[];
1824
+ }
1825
+ declare enum RuleType {
1826
+ VALIDATION = "VALIDATION",
1827
+ OTHER = "OTHER",
1828
+ MAX = "MAX",
1829
+ MIN = "MIN",
1830
+ MAX_LENGTH = "MAX_LENGTH",
1831
+ MIN_LENGTH = "MIN_LENGTH",
1832
+ MAX_SIZE = "MAX_SIZE",
1833
+ MIN_SIZE = "MIN_SIZE",
1834
+ FORMAT = "FORMAT",
1835
+ DECIMAL_LTE = "DECIMAL_LTE",
1836
+ DECIMAL_GTE = "DECIMAL_GTE",
1837
+ DECIMAL_LT = "DECIMAL_LT",
1838
+ DECIMAL_GT = "DECIMAL_GT",
1839
+ DECIMAL_MAX_SCALE = "DECIMAL_MAX_SCALE",
1840
+ INVALID_ENUM_VALUE = "INVALID_ENUM_VALUE",
1841
+ REQUIRED_FIELD = "REQUIRED_FIELD",
1842
+ FIELD_NOT_ALLOWED = "FIELD_NOT_ALLOWED",
1843
+ ONE_OF_ALIGNMENT = "ONE_OF_ALIGNMENT",
1844
+ EXACT_LENGTH = "EXACT_LENGTH",
1845
+ EXACT_SIZE = "EXACT_SIZE",
1846
+ REQUIRED_ONE_OF_FIELD = "REQUIRED_ONE_OF_FIELD"
1757
1847
  }
1758
1848
  /** @enumType */
1759
- type ErrorCodeWithLiterals = ErrorCode | 'UNKNOWN_ERROR_CODE';
1849
+ type RuleTypeWithLiterals = RuleType | 'VALIDATION' | 'OTHER' | 'MAX' | 'MIN' | 'MAX_LENGTH' | 'MIN_LENGTH' | 'MAX_SIZE' | 'MIN_SIZE' | 'FORMAT' | 'DECIMAL_LTE' | 'DECIMAL_GTE' | 'DECIMAL_LT' | 'DECIMAL_GT' | 'DECIMAL_MAX_SCALE' | 'INVALID_ENUM_VALUE' | 'REQUIRED_FIELD' | 'FIELD_NOT_ALLOWED' | 'ONE_OF_ALIGNMENT' | 'EXACT_LENGTH' | 'EXACT_SIZE' | 'REQUIRED_ONE_OF_FIELD';
1850
+ interface FieldViolation {
1851
+ field?: string;
1852
+ description?: string;
1853
+ violatedRule?: RuleTypeWithLiterals;
1854
+ /** applicable when violated_rule=OTHER */
1855
+ ruleName?: string | null;
1856
+ data?: Record<string, any> | null;
1857
+ }
1858
+ interface SystemError {
1859
+ /** Error code. */
1860
+ errorCode?: string | null;
1861
+ }
1862
+ interface CarrierErrors {
1863
+ /**
1864
+ * Carrier errors.
1865
+ * @maxSize 100
1866
+ */
1867
+ errors?: CarrierError[];
1868
+ }
1869
+ interface CarrierError {
1870
+ /**
1871
+ * Carrier ID.
1872
+ * @format GUID
1873
+ */
1874
+ carrierId?: string;
1875
+ /** Error details. */
1876
+ error?: Details;
1877
+ }
1760
1878
  interface Violation {
1761
1879
  /** Severity of the violation. The violations are shown on the cart and checkout pages. A warning is displayed as yellow, and allows a site visitor to proceed with caution. An error is displayed as red, and doesn't allow a site visitor to proceed with the eCommerce flow. */
1762
1880
  severity?: SeverityWithLiterals;
@@ -2176,10 +2294,14 @@ interface PlaceOrderRequest {
2176
2294
  /**
2177
2295
  * The pricing token received from `CalculateCart`'s response.
2178
2296
  * Used to verify that the prices shown to the customer have not changed before completing checkout.
2179
- * @maxLength 1024
2180
- * @readonly
2297
+ * @maxLength 3000
2181
2298
  */
2182
2299
  pricingToken?: string | null;
2300
+ /**
2301
+ * Payment token.
2302
+ * @maxLength 100
2303
+ */
2304
+ paymentToken?: string | null;
2183
2305
  /** Urls to redirect to after payment is made. */
2184
2306
  redirectUrls?: RedirectUrls;
2185
2307
  /** Indicates the payment method should be saved on the order */
@@ -189,6 +189,9 @@ function createCart(payload) {
189
189
  method: "POST",
190
190
  methodFqn: "wix.ecom.cart.v2.CartService.CreateCart",
191
191
  packageName: PACKAGE_NAME,
192
+ migrationOptions: {
193
+ optInTransformResponse: true
194
+ },
192
195
  url: resolveWixEcomCartV2CartServiceUrl({
193
196
  protoPath: "/v2/carts",
194
197
  data: serializedData,
@@ -239,6 +242,9 @@ function getCart(payload) {
239
242
  method: "GET",
240
243
  methodFqn: "wix.ecom.cart.v2.CartService.GetCart",
241
244
  packageName: PACKAGE_NAME,
245
+ migrationOptions: {
246
+ optInTransformResponse: true
247
+ },
242
248
  url: resolveWixEcomCartV2CartServiceUrl({
243
249
  protoPath: "/v2/carts/{cartId}",
244
250
  data: payload,
@@ -323,6 +329,9 @@ function updateCart(payload) {
323
329
  method: "PATCH",
324
330
  methodFqn: "wix.ecom.cart.v2.CartService.UpdateCart",
325
331
  packageName: PACKAGE_NAME,
332
+ migrationOptions: {
333
+ optInTransformResponse: true
334
+ },
326
335
  url: resolveWixEcomCartV2CartServiceUrl({
327
336
  protoPath: "/v2/carts/{cart.id}",
328
337
  data: serializedData,
@@ -373,6 +382,9 @@ function deleteCart(payload) {
373
382
  method: "DELETE",
374
383
  methodFqn: "wix.ecom.cart.v2.CartService.DeleteCart",
375
384
  packageName: PACKAGE_NAME,
385
+ migrationOptions: {
386
+ optInTransformResponse: true
387
+ },
376
388
  url: resolveWixEcomCartV2CartServiceUrl({
377
389
  protoPath: "/v2/carts/{cartId}",
378
390
  data: payload,
@@ -391,6 +403,9 @@ function refreshCart(payload) {
391
403
  method: "POST",
392
404
  methodFqn: "wix.ecom.cart.v2.CartService.RefreshCart",
393
405
  packageName: PACKAGE_NAME,
406
+ migrationOptions: {
407
+ optInTransformResponse: true
408
+ },
394
409
  url: resolveWixEcomCartV2CartServiceUrl({
395
410
  protoPath: "/v2/carts/{cartId}/refresh",
396
411
  data: payload,
@@ -441,6 +456,9 @@ function calculateCart(payload) {
441
456
  method: "POST",
442
457
  methodFqn: "wix.ecom.cart.v2.CartService.CalculateCart",
443
458
  packageName: PACKAGE_NAME,
459
+ migrationOptions: {
460
+ optInTransformResponse: true
461
+ },
444
462
  url: resolveWixEcomCartV2CartServiceUrl({
445
463
  protoPath: "/v2/carts/{cartId}/calculate",
446
464
  data: payload,
@@ -494,6 +512,9 @@ function getCheckoutUrl(payload) {
494
512
  method: "POST",
495
513
  methodFqn: "wix.ecom.cart.v2.CartService.GetCheckoutURL",
496
514
  packageName: PACKAGE_NAME,
515
+ migrationOptions: {
516
+ optInTransformResponse: true
517
+ },
497
518
  url: resolveWixEcomCartV2CartServiceUrl({
498
519
  protoPath: "/v2/carts/{cartId}/get-checkout-url",
499
520
  data: payload,
@@ -512,6 +533,9 @@ function placeOrder(payload) {
512
533
  method: "POST",
513
534
  methodFqn: "wix.ecom.cart.v2.CartService.PlaceOrder",
514
535
  packageName: PACKAGE_NAME,
536
+ migrationOptions: {
537
+ optInTransformResponse: true
538
+ },
515
539
  url: resolveWixEcomCartV2CartServiceUrl({
516
540
  protoPath: "/v2/carts/{cartId}/place-order",
517
541
  data: payload,
@@ -554,6 +578,9 @@ function addLineItems(payload) {
554
578
  method: "POST",
555
579
  methodFqn: "wix.ecom.cart.v2.CartService.AddLineItems",
556
580
  packageName: PACKAGE_NAME,
581
+ migrationOptions: {
582
+ optInTransformResponse: true
583
+ },
557
584
  url: resolveWixEcomCartV2CartServiceUrl({
558
585
  protoPath: "/v2/carts/{cartId}/add-line-items",
559
586
  data: serializedData,
@@ -604,6 +631,9 @@ function removeLineItems(payload) {
604
631
  method: "POST",
605
632
  methodFqn: "wix.ecom.cart.v2.CartService.RemoveLineItems",
606
633
  packageName: PACKAGE_NAME,
634
+ migrationOptions: {
635
+ optInTransformResponse: true
636
+ },
607
637
  url: resolveWixEcomCartV2CartServiceUrl({
608
638
  protoPath: "/v2/carts/{cartId}/remove-line-items",
609
639
  data: payload,
@@ -654,6 +684,9 @@ function updateLineItems(payload) {
654
684
  method: "POST",
655
685
  methodFqn: "wix.ecom.cart.v2.CartService.UpdateLineItems",
656
686
  packageName: PACKAGE_NAME,
687
+ migrationOptions: {
688
+ optInTransformResponse: true
689
+ },
657
690
  url: resolveWixEcomCartV2CartServiceUrl({
658
691
  protoPath: "/v2/carts/{cartId}/update-line-items",
659
692
  data: payload,
@@ -704,6 +737,9 @@ function addCoupon(payload) {
704
737
  method: "POST",
705
738
  methodFqn: "wix.ecom.cart.v2.CartService.AddCoupon",
706
739
  packageName: PACKAGE_NAME,
740
+ migrationOptions: {
741
+ optInTransformResponse: true
742
+ },
707
743
  url: resolveWixEcomCartV2CartServiceUrl({
708
744
  protoPath: "/v2/carts/{cartId}/add-coupon",
709
745
  data: payload,
@@ -754,6 +790,9 @@ function removeCoupon(payload) {
754
790
  method: "POST",
755
791
  methodFqn: "wix.ecom.cart.v2.CartService.RemoveCoupon",
756
792
  packageName: PACKAGE_NAME,
793
+ migrationOptions: {
794
+ optInTransformResponse: true
795
+ },
757
796
  url: resolveWixEcomCartV2CartServiceUrl({
758
797
  protoPath: "/v2/carts/{cartId}/remove-coupon",
759
798
  data: payload,
@@ -804,6 +843,9 @@ function addGiftCard(payload) {
804
843
  method: "POST",
805
844
  methodFqn: "wix.ecom.cart.v2.CartService.AddGiftCard",
806
845
  packageName: PACKAGE_NAME,
846
+ migrationOptions: {
847
+ optInTransformResponse: true
848
+ },
807
849
  url: resolveWixEcomCartV2CartServiceUrl({
808
850
  protoPath: "/v2/carts/{cartId}/add-gift-card",
809
851
  data: payload,
@@ -854,6 +896,9 @@ function removeGiftCard(payload) {
854
896
  method: "POST",
855
897
  methodFqn: "wix.ecom.cart.v2.CartService.RemoveGiftCard",
856
898
  packageName: PACKAGE_NAME,
899
+ migrationOptions: {
900
+ optInTransformResponse: true
901
+ },
857
902
  url: resolveWixEcomCartV2CartServiceUrl({
858
903
  protoPath: "/v2/carts/{cartId}/remove-gift-card",
859
904
  data: payload,
@@ -904,6 +949,9 @@ function markCartAsCompleted(payload) {
904
949
  method: "POST",
905
950
  methodFqn: "wix.ecom.cart.v2.CartService.MarkCartAsCompleted",
906
951
  packageName: PACKAGE_NAME,
952
+ migrationOptions: {
953
+ optInTransformResponse: true
954
+ },
907
955
  url: resolveWixEcomCartV2CartServiceUrl({
908
956
  protoPath: "/v2/carts/{cartId}/mark-cart-as-completed",
909
957
  data: payload,
@@ -954,6 +1002,9 @@ function handleAsyncCheckoutCompletion(payload) {
954
1002
  method: "POST",
955
1003
  methodFqn: "wix.ecom.cart.v2.CartService.HandleAsyncCheckoutCompletion",
956
1004
  packageName: PACKAGE_NAME,
1005
+ migrationOptions: {
1006
+ optInTransformResponse: true
1007
+ },
957
1008
  url: resolveWixEcomCartV2CartServiceUrl({
958
1009
  protoPath: "/v2/carts/handle-async-checkout-completion",
959
1010
  data: payload,