@wix/auto_sdk_ecom_current-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 +62 -36
  2. package/build/cjs/index.js +39 -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 +39 -17
  6. package/build/cjs/index.typings.js.map +1 -1
  7. package/build/cjs/meta.d.ts +149 -31
  8. package/build/cjs/meta.js +39 -0
  9. package/build/cjs/meta.js.map +1 -1
  10. package/build/es/index.d.mts +62 -36
  11. package/build/es/index.mjs +39 -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 +39 -15
  15. package/build/es/index.typings.mjs.map +1 -1
  16. package/build/es/meta.d.mts +149 -31
  17. package/build/es/meta.mjs +39 -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 +39 -17
  21. package/build/internal/cjs/index.js.map +1 -1
  22. package/build/internal/cjs/index.typings.d.ts +63 -37
  23. package/build/internal/cjs/index.typings.js +39 -17
  24. package/build/internal/cjs/index.typings.js.map +1 -1
  25. package/build/internal/cjs/meta.d.ts +149 -31
  26. package/build/internal/cjs/meta.js +39 -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 +39 -15
  30. package/build/internal/es/index.mjs.map +1 -1
  31. package/build/internal/es/index.typings.d.mts +63 -37
  32. package/build/internal/es/index.typings.mjs +39 -15
  33. package/build/internal/es/index.typings.mjs.map +1 -1
  34. package/build/internal/es/meta.d.mts +149 -31
  35. package/build/internal/es/meta.mjs +39 -0
  36. package/build/internal/es/meta.mjs.map +1 -1
  37. package/package.json +2 -2
@@ -125,7 +125,7 @@ interface V2LineItem {
125
125
  /**
126
126
  * Custom extended fields for the line item object.
127
127
  *
128
- * [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.
128
+ * [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.
129
129
  */
130
130
  extendedFields?: ExtendedFields;
131
131
  /**
@@ -1460,16 +1460,6 @@ interface CartSummary {
1460
1460
  priceSummary?: PriceSummary;
1461
1461
  /** Payment details summarizing how the customer will pay for the order. */
1462
1462
  paymentSummary?: PaymentSummary;
1463
- /**
1464
- * List of errors that occurred during the calculation process.
1465
- * @maxSize 100
1466
- */
1467
- errors?: CalculationError[];
1468
- /**
1469
- * 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)).
1470
- * @maxSize 100
1471
- */
1472
- violations?: Violation[];
1473
1463
  /**
1474
1464
  * A token representing the Cart's calculated prices.
1475
1465
  *
@@ -1486,6 +1476,17 @@ interface CartSummary {
1486
1476
  * @maxLength 1024
1487
1477
  */
1488
1478
  priceVerificationToken?: string | null;
1479
+ /**
1480
+ * List of errors that occurred during the calculation process, returned by Totals Calculator.
1481
+ * TODO: Temporary field for backward compatibility; will be removed once we introduce the unified 'violations' model.
1482
+ */
1483
+ calculationErrors?: CalculationErrors;
1484
+ /**
1485
+ * 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)).
1486
+ * TODO: Temporary field for backward compatibility; will be removed once we introduce the unified 'violations' model.
1487
+ * @maxSize 100
1488
+ */
1489
+ spiViolations?: Violation[];
1489
1490
  }
1490
1491
  interface LineItemSummary {
1491
1492
  /**
@@ -1730,32 +1731,149 @@ interface Charge {
1730
1731
  /** The billing date from which the charge starts. */
1731
1732
  cycleBillingDate?: Date | null;
1732
1733
  }
1733
- interface CalculationError {
1734
- /** The calculation component that caused the error. */
1735
- component?: CalculationComponentWithLiterals;
1736
- /** Machine-readable error code. */
1737
- code?: ErrorCodeWithLiterals;
1734
+ interface CalculationErrors extends CalculationErrorsShippingCalculationErrorOneOf {
1735
+ /** General shipping calculation error. */
1736
+ generalShippingCalculationError?: Details;
1737
+ /** Carrier errors. */
1738
+ carrierErrors?: CarrierErrors;
1739
+ /** Tax calculation error. */
1740
+ taxCalculationError?: Details;
1741
+ /** Coupon calculation error. */
1742
+ couponCalculationError?: Details;
1743
+ /** Gift card calculation error. */
1744
+ giftCardCalculationError?: Details;
1745
+ /**
1746
+ * Order validation errors.
1747
+ * @maxSize 100
1748
+ */
1749
+ orderValidationErrors?: ApplicationError[];
1738
1750
  /**
1739
- * Human-readable explanation.
1740
- * @maxLength 100
1751
+ * Membership payment methods calculation errors
1752
+ * For example, will indicate that a line item that must be paid with membership payment doesn't have one or selected memberships are invalid
1741
1753
  */
1742
- description?: string | null;
1754
+ membershipError?: Details;
1755
+ /** Discount Rule calculation error. */
1756
+ discountsCalculationError?: Details;
1743
1757
  }
1744
- declare enum CalculationComponent {
1745
- UNKNOWN_CALCULATION_COMPONENT = "UNKNOWN_CALCULATION_COMPONENT",
1746
- DISCOUNTS = "DISCOUNTS",
1747
- DELIVERY = "DELIVERY",
1748
- TAX = "TAX",
1749
- MEMBERSHIPS = "MEMBERSHIPS",
1750
- GIFT_CARDS = "GIFT_CARDS"
1758
+ /** @oneof */
1759
+ interface CalculationErrorsShippingCalculationErrorOneOf {
1760
+ /** General shipping calculation error. */
1761
+ generalShippingCalculationError?: Details;
1762
+ /** Carrier errors. */
1763
+ carrierErrors?: CarrierErrors;
1751
1764
  }
1752
- /** @enumType */
1753
- type CalculationComponentWithLiterals = CalculationComponent | 'UNKNOWN_CALCULATION_COMPONENT' | 'DISCOUNTS' | 'DELIVERY' | 'TAX' | 'MEMBERSHIPS' | 'GIFT_CARDS';
1754
- declare enum ErrorCode {
1755
- UNKNOWN_ERROR_CODE = "UNKNOWN_ERROR_CODE"
1765
+ interface Details extends DetailsKindOneOf {
1766
+ applicationError?: ApplicationError;
1767
+ validationError?: ValidationError;
1768
+ systemError?: SystemError;
1769
+ /**
1770
+ * deprecated in API's - to enable migration from rendering arbitrary tracing to rest response
1771
+ * @deprecated
1772
+ */
1773
+ tracing?: Record<string, string>;
1774
+ }
1775
+ /** @oneof */
1776
+ interface DetailsKindOneOf {
1777
+ applicationError?: ApplicationError;
1778
+ validationError?: ValidationError;
1779
+ systemError?: SystemError;
1780
+ }
1781
+ interface ApplicationError {
1782
+ /** Error code. */
1783
+ code?: string;
1784
+ /** Description of the error. */
1785
+ description?: string;
1786
+ /** Data related to the error. */
1787
+ data?: Record<string, any> | null;
1788
+ }
1789
+ /**
1790
+ * example result:
1791
+ * {
1792
+ * "fieldViolations": [
1793
+ * {
1794
+ * "field": "fieldA",
1795
+ * "description": "invalid music note. supported notes: [do,re,mi,fa,sol,la,ti]",
1796
+ * "violatedRule": "OTHER",
1797
+ * "ruleName": "INVALID_NOTE",
1798
+ * "data": {
1799
+ * "value": "FI"
1800
+ * }
1801
+ * },
1802
+ * {
1803
+ * "field": "fieldB",
1804
+ * "description": "field value out of range. supported range: [0-20]",
1805
+ * "violatedRule": "MAX",
1806
+ * "data": {
1807
+ * "threshold": 20
1808
+ * }
1809
+ * },
1810
+ * {
1811
+ * "field": "fieldC",
1812
+ * "description": "invalid phone number. provide a valid phone number of size: [7-12], supported characters: [0-9, +, -, (, )]",
1813
+ * "violatedRule": "FORMAT",
1814
+ * "data": {
1815
+ * "type": "PHONE"
1816
+ * }
1817
+ * }
1818
+ * ]
1819
+ * }
1820
+ */
1821
+ interface ValidationError {
1822
+ fieldViolations?: FieldViolation[];
1823
+ }
1824
+ declare enum RuleType {
1825
+ VALIDATION = "VALIDATION",
1826
+ OTHER = "OTHER",
1827
+ MAX = "MAX",
1828
+ MIN = "MIN",
1829
+ MAX_LENGTH = "MAX_LENGTH",
1830
+ MIN_LENGTH = "MIN_LENGTH",
1831
+ MAX_SIZE = "MAX_SIZE",
1832
+ MIN_SIZE = "MIN_SIZE",
1833
+ FORMAT = "FORMAT",
1834
+ DECIMAL_LTE = "DECIMAL_LTE",
1835
+ DECIMAL_GTE = "DECIMAL_GTE",
1836
+ DECIMAL_LT = "DECIMAL_LT",
1837
+ DECIMAL_GT = "DECIMAL_GT",
1838
+ DECIMAL_MAX_SCALE = "DECIMAL_MAX_SCALE",
1839
+ INVALID_ENUM_VALUE = "INVALID_ENUM_VALUE",
1840
+ REQUIRED_FIELD = "REQUIRED_FIELD",
1841
+ FIELD_NOT_ALLOWED = "FIELD_NOT_ALLOWED",
1842
+ ONE_OF_ALIGNMENT = "ONE_OF_ALIGNMENT",
1843
+ EXACT_LENGTH = "EXACT_LENGTH",
1844
+ EXACT_SIZE = "EXACT_SIZE",
1845
+ REQUIRED_ONE_OF_FIELD = "REQUIRED_ONE_OF_FIELD"
1756
1846
  }
1757
1847
  /** @enumType */
1758
- type ErrorCodeWithLiterals = ErrorCode | 'UNKNOWN_ERROR_CODE';
1848
+ 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';
1849
+ interface FieldViolation {
1850
+ field?: string;
1851
+ description?: string;
1852
+ violatedRule?: RuleTypeWithLiterals;
1853
+ /** applicable when violated_rule=OTHER */
1854
+ ruleName?: string | null;
1855
+ data?: Record<string, any> | null;
1856
+ }
1857
+ interface SystemError {
1858
+ /** Error code. */
1859
+ errorCode?: string | null;
1860
+ }
1861
+ interface CarrierErrors {
1862
+ /**
1863
+ * Carrier errors.
1864
+ * @maxSize 100
1865
+ */
1866
+ errors?: CarrierError[];
1867
+ }
1868
+ interface CarrierError {
1869
+ /**
1870
+ * Carrier ID.
1871
+ * @format GUID
1872
+ */
1873
+ carrierId?: string;
1874
+ /** Error details. */
1875
+ error?: Details;
1876
+ }
1759
1877
  interface Violation {
1760
1878
  /** 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. */
1761
1879
  severity?: SeverityWithLiterals;
package/build/cjs/meta.js CHANGED
@@ -184,6 +184,9 @@ function createCurrentCart(payload) {
184
184
  method: "POST",
185
185
  methodFqn: "wix.ecom.cart.v2.CurrentCartService.CreateCurrentCart",
186
186
  packageName: PACKAGE_NAME,
187
+ migrationOptions: {
188
+ optInTransformResponse: true
189
+ },
187
190
  url: resolveWixEcomCartV2CurrentCartServiceUrl({
188
191
  protoPath: "/v2/carts/current",
189
192
  data: serializedData,
@@ -234,6 +237,9 @@ function getCurrentCart(payload) {
234
237
  method: "GET",
235
238
  methodFqn: "wix.ecom.cart.v2.CurrentCartService.GetCurrentCart",
236
239
  packageName: PACKAGE_NAME,
240
+ migrationOptions: {
241
+ optInTransformResponse: true
242
+ },
237
243
  url: resolveWixEcomCartV2CurrentCartServiceUrl({
238
244
  protoPath: "/v2/carts/current",
239
245
  data: payload,
@@ -318,6 +324,9 @@ function updateCurrentCart(payload) {
318
324
  method: "PATCH",
319
325
  methodFqn: "wix.ecom.cart.v2.CurrentCartService.UpdateCurrentCart",
320
326
  packageName: PACKAGE_NAME,
327
+ migrationOptions: {
328
+ optInTransformResponse: true
329
+ },
321
330
  url: resolveWixEcomCartV2CurrentCartServiceUrl({
322
331
  protoPath: "/v2/carts/current",
323
332
  data: serializedData,
@@ -368,6 +377,9 @@ function deleteCurrentCart(payload) {
368
377
  method: "DELETE",
369
378
  methodFqn: "wix.ecom.cart.v2.CurrentCartService.DeleteCurrentCart",
370
379
  packageName: PACKAGE_NAME,
380
+ migrationOptions: {
381
+ optInTransformResponse: true
382
+ },
371
383
  url: resolveWixEcomCartV2CurrentCartServiceUrl({
372
384
  protoPath: "/v2/carts/current",
373
385
  data: payload,
@@ -386,6 +398,9 @@ function refreshCurrentCart(payload) {
386
398
  method: "POST",
387
399
  methodFqn: "wix.ecom.cart.v2.CurrentCartService.RefreshCurrentCart",
388
400
  packageName: PACKAGE_NAME,
401
+ migrationOptions: {
402
+ optInTransformResponse: true
403
+ },
389
404
  url: resolveWixEcomCartV2CurrentCartServiceUrl({
390
405
  protoPath: "/v2/carts/current/refresh",
391
406
  data: payload,
@@ -436,6 +451,9 @@ function calculateCurrentCart(payload) {
436
451
  method: "POST",
437
452
  methodFqn: "wix.ecom.cart.v2.CurrentCartService.CalculateCurrentCart",
438
453
  packageName: PACKAGE_NAME,
454
+ migrationOptions: {
455
+ optInTransformResponse: true
456
+ },
439
457
  url: resolveWixEcomCartV2CurrentCartServiceUrl({
440
458
  protoPath: "/v2/carts/current/calculate",
441
459
  data: payload,
@@ -513,6 +531,9 @@ function addLineItemsToCurrentCart(payload) {
513
531
  method: "POST",
514
532
  methodFqn: "wix.ecom.cart.v2.CurrentCartService.AddLineItemsToCurrentCart",
515
533
  packageName: PACKAGE_NAME,
534
+ migrationOptions: {
535
+ optInTransformResponse: true
536
+ },
516
537
  url: resolveWixEcomCartV2CurrentCartServiceUrl({
517
538
  protoPath: "/v2/carts/current/add-line-items",
518
539
  data: serializedData,
@@ -563,6 +584,9 @@ function removeLineItemsFromCurrentCart(payload) {
563
584
  method: "POST",
564
585
  methodFqn: "wix.ecom.cart.v2.CurrentCartService.RemoveLineItemsFromCurrentCart",
565
586
  packageName: PACKAGE_NAME,
587
+ migrationOptions: {
588
+ optInTransformResponse: true
589
+ },
566
590
  url: resolveWixEcomCartV2CurrentCartServiceUrl({
567
591
  protoPath: "/v2/carts/current/remove-line-items",
568
592
  data: payload,
@@ -613,6 +637,9 @@ function updateLineItemsInCurrentCart(payload) {
613
637
  method: "POST",
614
638
  methodFqn: "wix.ecom.cart.v2.CurrentCartService.UpdateLineItemsInCurrentCart",
615
639
  packageName: PACKAGE_NAME,
640
+ migrationOptions: {
641
+ optInTransformResponse: true
642
+ },
616
643
  url: resolveWixEcomCartV2CurrentCartServiceUrl({
617
644
  protoPath: "/v2/carts/current/update-line-items",
618
645
  data: payload,
@@ -663,6 +690,9 @@ function addCouponToCurrentCart(payload) {
663
690
  method: "POST",
664
691
  methodFqn: "wix.ecom.cart.v2.CurrentCartService.AddCouponToCurrentCart",
665
692
  packageName: PACKAGE_NAME,
693
+ migrationOptions: {
694
+ optInTransformResponse: true
695
+ },
666
696
  url: resolveWixEcomCartV2CurrentCartServiceUrl({
667
697
  protoPath: "/v2/carts/current/add-coupon",
668
698
  data: payload,
@@ -713,6 +743,9 @@ function removeCouponFromCurrentCart(payload) {
713
743
  method: "POST",
714
744
  methodFqn: "wix.ecom.cart.v2.CurrentCartService.RemoveCouponFromCurrentCart",
715
745
  packageName: PACKAGE_NAME,
746
+ migrationOptions: {
747
+ optInTransformResponse: true
748
+ },
716
749
  url: resolveWixEcomCartV2CurrentCartServiceUrl({
717
750
  protoPath: "/v2/carts/current/remove-coupon",
718
751
  data: payload,
@@ -763,6 +796,9 @@ function addGiftCardToCurrentCart(payload) {
763
796
  method: "POST",
764
797
  methodFqn: "wix.ecom.cart.v2.CurrentCartService.AddGiftCardToCurrentCart",
765
798
  packageName: PACKAGE_NAME,
799
+ migrationOptions: {
800
+ optInTransformResponse: true
801
+ },
766
802
  url: resolveWixEcomCartV2CurrentCartServiceUrl({
767
803
  protoPath: "/v2/carts/current/add-gift-card",
768
804
  data: payload,
@@ -813,6 +849,9 @@ function removeGiftCardFromCurrentCart(payload) {
813
849
  method: "POST",
814
850
  methodFqn: "wix.ecom.cart.v2.CurrentCartService.RemoveGiftCardFromCurrentCart",
815
851
  packageName: PACKAGE_NAME,
852
+ migrationOptions: {
853
+ optInTransformResponse: true
854
+ },
816
855
  url: resolveWixEcomCartV2CurrentCartServiceUrl({
817
856
  protoPath: "/v2/carts/current/remove-gift-card",
818
857
  data: payload,