@wix/auto_sdk_ecom_cart 1.0.0

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 (111) hide show
  1. package/build/cjs/index.d.ts +1 -0
  2. package/build/cjs/index.js +18 -0
  3. package/build/cjs/index.js.map +1 -0
  4. package/build/cjs/index.typings.d.ts +1 -0
  5. package/build/cjs/index.typings.js +18 -0
  6. package/build/cjs/index.typings.js.map +1 -0
  7. package/build/cjs/meta.d.ts +1 -0
  8. package/build/cjs/meta.js +18 -0
  9. package/build/cjs/meta.js.map +1 -0
  10. package/build/cjs/src/ecom-v1-cart-cart.context.d.ts +30 -0
  11. package/build/cjs/src/ecom-v1-cart-cart.context.js +58 -0
  12. package/build/cjs/src/ecom-v1-cart-cart.context.js.map +1 -0
  13. package/build/cjs/src/ecom-v1-cart-cart.http.d.ts +92 -0
  14. package/build/cjs/src/ecom-v1-cart-cart.http.js +844 -0
  15. package/build/cjs/src/ecom-v1-cart-cart.http.js.map +1 -0
  16. package/build/cjs/src/ecom-v1-cart-cart.meta.d.ts +46 -0
  17. package/build/cjs/src/ecom-v1-cart-cart.meta.js +256 -0
  18. package/build/cjs/src/ecom-v1-cart-cart.meta.js.map +1 -0
  19. package/build/cjs/src/ecom-v1-cart-cart.public.d.ts +152 -0
  20. package/build/cjs/src/ecom-v1-cart-cart.public.js +228 -0
  21. package/build/cjs/src/ecom-v1-cart-cart.public.js.map +1 -0
  22. package/build/cjs/src/ecom-v1-cart-cart.types.d.ts +2506 -0
  23. package/build/cjs/src/ecom-v1-cart-cart.types.js +255 -0
  24. package/build/cjs/src/ecom-v1-cart-cart.types.js.map +1 -0
  25. package/build/cjs/src/ecom-v1-cart-cart.universal.d.ts +2996 -0
  26. package/build/cjs/src/ecom-v1-cart-cart.universal.js +1169 -0
  27. package/build/cjs/src/ecom-v1-cart-cart.universal.js.map +1 -0
  28. package/build/es/index.d.ts +1 -0
  29. package/build/es/index.js +2 -0
  30. package/build/es/index.js.map +1 -0
  31. package/build/es/index.typings.d.ts +1 -0
  32. package/build/es/index.typings.js +2 -0
  33. package/build/es/index.typings.js.map +1 -0
  34. package/build/es/meta.d.ts +1 -0
  35. package/build/es/meta.js +2 -0
  36. package/build/es/meta.js.map +1 -0
  37. package/build/es/package.json +3 -0
  38. package/build/es/src/ecom-v1-cart-cart.context.d.ts +30 -0
  39. package/build/es/src/ecom-v1-cart-cart.context.js +30 -0
  40. package/build/es/src/ecom-v1-cart-cart.context.js.map +1 -0
  41. package/build/es/src/ecom-v1-cart-cart.http.d.ts +92 -0
  42. package/build/es/src/ecom-v1-cart-cart.http.js +829 -0
  43. package/build/es/src/ecom-v1-cart-cart.http.js.map +1 -0
  44. package/build/es/src/ecom-v1-cart-cart.meta.d.ts +46 -0
  45. package/build/es/src/ecom-v1-cart-cart.meta.js +218 -0
  46. package/build/es/src/ecom-v1-cart-cart.meta.js.map +1 -0
  47. package/build/es/src/ecom-v1-cart-cart.public.d.ts +152 -0
  48. package/build/es/src/ecom-v1-cart-cart.public.js +188 -0
  49. package/build/es/src/ecom-v1-cart-cart.public.js.map +1 -0
  50. package/build/es/src/ecom-v1-cart-cart.types.d.ts +2506 -0
  51. package/build/es/src/ecom-v1-cart-cart.types.js +252 -0
  52. package/build/es/src/ecom-v1-cart-cart.types.js.map +1 -0
  53. package/build/es/src/ecom-v1-cart-cart.universal.d.ts +2996 -0
  54. package/build/es/src/ecom-v1-cart-cart.universal.js +1131 -0
  55. package/build/es/src/ecom-v1-cart-cart.universal.js.map +1 -0
  56. package/build/internal/cjs/index.d.ts +1 -0
  57. package/build/internal/cjs/index.js +18 -0
  58. package/build/internal/cjs/index.js.map +1 -0
  59. package/build/internal/cjs/index.typings.d.ts +1 -0
  60. package/build/internal/cjs/index.typings.js +18 -0
  61. package/build/internal/cjs/index.typings.js.map +1 -0
  62. package/build/internal/cjs/meta.d.ts +1 -0
  63. package/build/internal/cjs/meta.js +18 -0
  64. package/build/internal/cjs/meta.js.map +1 -0
  65. package/build/internal/cjs/src/ecom-v1-cart-cart.context.d.ts +30 -0
  66. package/build/internal/cjs/src/ecom-v1-cart-cart.context.js +58 -0
  67. package/build/internal/cjs/src/ecom-v1-cart-cart.context.js.map +1 -0
  68. package/build/internal/cjs/src/ecom-v1-cart-cart.http.d.ts +92 -0
  69. package/build/internal/cjs/src/ecom-v1-cart-cart.http.js +844 -0
  70. package/build/internal/cjs/src/ecom-v1-cart-cart.http.js.map +1 -0
  71. package/build/internal/cjs/src/ecom-v1-cart-cart.meta.d.ts +46 -0
  72. package/build/internal/cjs/src/ecom-v1-cart-cart.meta.js +256 -0
  73. package/build/internal/cjs/src/ecom-v1-cart-cart.meta.js.map +1 -0
  74. package/build/internal/cjs/src/ecom-v1-cart-cart.public.d.ts +170 -0
  75. package/build/internal/cjs/src/ecom-v1-cart-cart.public.js +228 -0
  76. package/build/internal/cjs/src/ecom-v1-cart-cart.public.js.map +1 -0
  77. package/build/internal/cjs/src/ecom-v1-cart-cart.types.d.ts +2565 -0
  78. package/build/internal/cjs/src/ecom-v1-cart-cart.types.js +255 -0
  79. package/build/internal/cjs/src/ecom-v1-cart-cart.types.js.map +1 -0
  80. package/build/internal/cjs/src/ecom-v1-cart-cart.universal.d.ts +3261 -0
  81. package/build/internal/cjs/src/ecom-v1-cart-cart.universal.js +1169 -0
  82. package/build/internal/cjs/src/ecom-v1-cart-cart.universal.js.map +1 -0
  83. package/build/internal/es/index.d.ts +1 -0
  84. package/build/internal/es/index.js +2 -0
  85. package/build/internal/es/index.js.map +1 -0
  86. package/build/internal/es/index.typings.d.ts +1 -0
  87. package/build/internal/es/index.typings.js +2 -0
  88. package/build/internal/es/index.typings.js.map +1 -0
  89. package/build/internal/es/meta.d.ts +1 -0
  90. package/build/internal/es/meta.js +2 -0
  91. package/build/internal/es/meta.js.map +1 -0
  92. package/build/internal/es/src/ecom-v1-cart-cart.context.d.ts +30 -0
  93. package/build/internal/es/src/ecom-v1-cart-cart.context.js +30 -0
  94. package/build/internal/es/src/ecom-v1-cart-cart.context.js.map +1 -0
  95. package/build/internal/es/src/ecom-v1-cart-cart.http.d.ts +92 -0
  96. package/build/internal/es/src/ecom-v1-cart-cart.http.js +829 -0
  97. package/build/internal/es/src/ecom-v1-cart-cart.http.js.map +1 -0
  98. package/build/internal/es/src/ecom-v1-cart-cart.meta.d.ts +46 -0
  99. package/build/internal/es/src/ecom-v1-cart-cart.meta.js +218 -0
  100. package/build/internal/es/src/ecom-v1-cart-cart.meta.js.map +1 -0
  101. package/build/internal/es/src/ecom-v1-cart-cart.public.d.ts +170 -0
  102. package/build/internal/es/src/ecom-v1-cart-cart.public.js +188 -0
  103. package/build/internal/es/src/ecom-v1-cart-cart.public.js.map +1 -0
  104. package/build/internal/es/src/ecom-v1-cart-cart.types.d.ts +2565 -0
  105. package/build/internal/es/src/ecom-v1-cart-cart.types.js +252 -0
  106. package/build/internal/es/src/ecom-v1-cart-cart.types.js.map +1 -0
  107. package/build/internal/es/src/ecom-v1-cart-cart.universal.d.ts +3261 -0
  108. package/build/internal/es/src/ecom-v1-cart-cart.universal.js +1131 -0
  109. package/build/internal/es/src/ecom-v1-cart-cart.universal.js.map +1 -0
  110. package/meta/package.json +3 -0
  111. package/package.json +52 -0
@@ -0,0 +1,1131 @@
1
+ import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';
2
+ import { renameKeysFromSDKRequestToRESTRequest, renameKeysFromRESTResponseToSDKResponse, } from '@wix/sdk-runtime/rename-all-nested-keys';
3
+ import * as ambassadorWixEcomV1Cart from './ecom-v1-cart-cart.http.js';
4
+ import { transformSDKAddressToRESTAddress } from '@wix/sdk-runtime/transformations/address';
5
+ import { transformRESTAddressToSDKAddress } from '@wix/sdk-runtime/transformations/address';
6
+ import { transformSDKImageToRESTImage } from '@wix/sdk-runtime/transformations/image';
7
+ import { transformRESTImageToSDKImage } from '@wix/sdk-runtime/transformations/image';
8
+ import { transformSDKPageURLV2ToRESTPageURLV2 } from '@wix/sdk-runtime/transformations/page-url-v2';
9
+ import { transformRESTPageURLV2ToSDKPageURLV2 } from '@wix/sdk-runtime/transformations/page-url-v2';
10
+ import { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';
11
+ export var DescriptionLineType;
12
+ (function (DescriptionLineType) {
13
+ /** Unrecognized type. */
14
+ DescriptionLineType["UNRECOGNISED"] = "UNRECOGNISED";
15
+ /** Plain text type. */
16
+ DescriptionLineType["PLAIN_TEXT"] = "PLAIN_TEXT";
17
+ /** Color type. */
18
+ DescriptionLineType["COLOR"] = "COLOR";
19
+ })(DescriptionLineType || (DescriptionLineType = {}));
20
+ export var ItemAvailabilityStatus;
21
+ (function (ItemAvailabilityStatus) {
22
+ ItemAvailabilityStatus["AVAILABLE"] = "AVAILABLE";
23
+ /** Item does not exist */
24
+ ItemAvailabilityStatus["NOT_FOUND"] = "NOT_FOUND";
25
+ /** Item not in stock */
26
+ ItemAvailabilityStatus["NOT_AVAILABLE"] = "NOT_AVAILABLE";
27
+ /** Available quantity is less than requested */
28
+ ItemAvailabilityStatus["PARTIALLY_AVAILABLE"] = "PARTIALLY_AVAILABLE";
29
+ })(ItemAvailabilityStatus || (ItemAvailabilityStatus = {}));
30
+ export var ItemTypeItemType;
31
+ (function (ItemTypeItemType) {
32
+ ItemTypeItemType["UNRECOGNISED"] = "UNRECOGNISED";
33
+ ItemTypeItemType["PHYSICAL"] = "PHYSICAL";
34
+ ItemTypeItemType["DIGITAL"] = "DIGITAL";
35
+ ItemTypeItemType["GIFT_CARD"] = "GIFT_CARD";
36
+ ItemTypeItemType["SERVICE"] = "SERVICE";
37
+ })(ItemTypeItemType || (ItemTypeItemType = {}));
38
+ /** Frequency unit of recurring payment */
39
+ export var SubscriptionFrequency;
40
+ (function (SubscriptionFrequency) {
41
+ SubscriptionFrequency["UNDEFINED"] = "UNDEFINED";
42
+ SubscriptionFrequency["DAY"] = "DAY";
43
+ SubscriptionFrequency["WEEK"] = "WEEK";
44
+ SubscriptionFrequency["MONTH"] = "MONTH";
45
+ SubscriptionFrequency["YEAR"] = "YEAR";
46
+ })(SubscriptionFrequency || (SubscriptionFrequency = {}));
47
+ export var FileType;
48
+ (function (FileType) {
49
+ FileType["UNSPECIFIED"] = "UNSPECIFIED";
50
+ FileType["SECURE_PICTURE"] = "SECURE_PICTURE";
51
+ FileType["SECURE_VIDEO"] = "SECURE_VIDEO";
52
+ FileType["SECURE_DOCUMENT"] = "SECURE_DOCUMENT";
53
+ FileType["SECURE_MUSIC"] = "SECURE_MUSIC";
54
+ FileType["SECURE_ARCHIVE"] = "SECURE_ARCHIVE";
55
+ })(FileType || (FileType = {}));
56
+ /** Type of selected payment option for catalog item */
57
+ export var PaymentOptionType;
58
+ (function (PaymentOptionType) {
59
+ /** The entire payment for this item happens as part of the checkout. */
60
+ PaymentOptionType["FULL_PAYMENT_ONLINE"] = "FULL_PAYMENT_ONLINE";
61
+ /** The entire payment for this item happens after checkout. For example, when using cash, check, or other offline payment methods. */
62
+ PaymentOptionType["FULL_PAYMENT_OFFLINE"] = "FULL_PAYMENT_OFFLINE";
63
+ /** Payment for this item is done by charging a membership. When selected, `price` is `0`. */
64
+ PaymentOptionType["MEMBERSHIP"] = "MEMBERSHIP";
65
+ /** Partial payment to be paid upfront during checkout. The initial amount to be paid for each line item is specified in `depositAmount`. */
66
+ PaymentOptionType["DEPOSIT_ONLINE"] = "DEPOSIT_ONLINE";
67
+ /** Payment for this item can only be done by charging a membership and must be manually redeemed in the dashboard by the site admin. When selected, `price` is `0`. */
68
+ PaymentOptionType["MEMBERSHIP_OFFLINE"] = "MEMBERSHIP_OFFLINE";
69
+ })(PaymentOptionType || (PaymentOptionType = {}));
70
+ export var TaxableAddressType;
71
+ (function (TaxableAddressType) {
72
+ TaxableAddressType["UNKNOWN_TAXABLE_ADDRESS"] = "UNKNOWN_TAXABLE_ADDRESS";
73
+ TaxableAddressType["BUSINESS"] = "BUSINESS";
74
+ TaxableAddressType["BILLING"] = "BILLING";
75
+ TaxableAddressType["SHIPPING"] = "SHIPPING";
76
+ })(TaxableAddressType || (TaxableAddressType = {}));
77
+ export var WeightUnit;
78
+ (function (WeightUnit) {
79
+ /** Weight unit can't be classified, due to an error */
80
+ WeightUnit["UNSPECIFIED_WEIGHT_UNIT"] = "UNSPECIFIED_WEIGHT_UNIT";
81
+ /** Kilograms */
82
+ WeightUnit["KG"] = "KG";
83
+ /** Pounds */
84
+ WeightUnit["LB"] = "LB";
85
+ })(WeightUnit || (WeightUnit = {}));
86
+ export var DiscountType;
87
+ (function (DiscountType) {
88
+ /** "GLOBAL" - discount applies to entire order. */
89
+ DiscountType["GLOBAL"] = "GLOBAL";
90
+ /** "SPECIFIC-ITEMS" - discount applies to specific items. */
91
+ DiscountType["SPECIFIC_ITEMS"] = "SPECIFIC_ITEMS";
92
+ /** "SHIPPING" - discount applies to shipping. For example, free shipping. */
93
+ DiscountType["SHIPPING"] = "SHIPPING";
94
+ })(DiscountType || (DiscountType = {}));
95
+ /** tax info types */
96
+ export var VatType;
97
+ (function (VatType) {
98
+ VatType["UNSPECIFIED"] = "UNSPECIFIED";
99
+ /** CPF - for individual tax payers. */
100
+ VatType["CPF"] = "CPF";
101
+ /** CNPJ - for corporations */
102
+ VatType["CNPJ"] = "CNPJ";
103
+ })(VatType || (VatType = {}));
104
+ /** JurisdictionType represents the type of the jurisdiction in which this tax detail applies (e.g. Country,State,County,City,Special). */
105
+ export var JurisdictionType;
106
+ (function (JurisdictionType) {
107
+ JurisdictionType["UNDEFINED"] = "UNDEFINED";
108
+ JurisdictionType["COUNTRY"] = "COUNTRY";
109
+ JurisdictionType["STATE"] = "STATE";
110
+ JurisdictionType["COUNTY"] = "COUNTY";
111
+ JurisdictionType["CITY"] = "CITY";
112
+ JurisdictionType["SPECIAL"] = "SPECIAL";
113
+ })(JurisdictionType || (JurisdictionType = {}));
114
+ export var RateType;
115
+ (function (RateType) {
116
+ /** no tax being collected for this request due to location of purchase */
117
+ RateType["NO_TAX_COLLECTED"] = "NO_TAX_COLLECTED";
118
+ /** manual rate used for calculation */
119
+ RateType["MANUAL_RATE"] = "MANUAL_RATE";
120
+ /** autotax rate used for calculation */
121
+ RateType["AUTO_RATE"] = "AUTO_RATE";
122
+ /** fallback rate used for calculation */
123
+ RateType["FALLBACK_RATE"] = "FALLBACK_RATE";
124
+ })(RateType || (RateType = {}));
125
+ export var ManualCalculationReason;
126
+ (function (ManualCalculationReason) {
127
+ /** user set calculator in Business Manager to be Manual */
128
+ ManualCalculationReason["GLOBAL_SETTING_TO_MANUAL"] = "GLOBAL_SETTING_TO_MANUAL";
129
+ /** specific region is on manual even though Global setting is Auto-tax */
130
+ ManualCalculationReason["REGION_SETTING_TO_MANUAL"] = "REGION_SETTING_TO_MANUAL";
131
+ })(ManualCalculationReason || (ManualCalculationReason = {}));
132
+ export var FallbackReason;
133
+ (function (FallbackReason) {
134
+ /** auto-tax failed to be calculated */
135
+ FallbackReason["AUTO_TAX_FAILED"] = "AUTO_TAX_FAILED";
136
+ /** auto-tax was temporarily deactivated on a system-level */
137
+ FallbackReason["AUTO_TAX_DEACTIVATED"] = "AUTO_TAX_DEACTIVATED";
138
+ })(FallbackReason || (FallbackReason = {}));
139
+ export var PickupMethod;
140
+ (function (PickupMethod) {
141
+ PickupMethod["UNKNOWN_METHOD"] = "UNKNOWN_METHOD";
142
+ PickupMethod["STORE_PICKUP"] = "STORE_PICKUP";
143
+ PickupMethod["PICKUP_POINT"] = "PICKUP_POINT";
144
+ })(PickupMethod || (PickupMethod = {}));
145
+ export var ChargeType;
146
+ (function (ChargeType) {
147
+ ChargeType["HANDLING_FEE"] = "HANDLING_FEE";
148
+ ChargeType["INSURANCE"] = "INSURANCE";
149
+ })(ChargeType || (ChargeType = {}));
150
+ export var AppliedDiscountDiscountType;
151
+ (function (AppliedDiscountDiscountType) {
152
+ AppliedDiscountDiscountType["GLOBAL"] = "GLOBAL";
153
+ AppliedDiscountDiscountType["SPECIFIC_ITEMS"] = "SPECIFIC_ITEMS";
154
+ AppliedDiscountDiscountType["SHIPPING"] = "SHIPPING";
155
+ })(AppliedDiscountDiscountType || (AppliedDiscountDiscountType = {}));
156
+ export var RuleType;
157
+ (function (RuleType) {
158
+ RuleType["VALIDATION"] = "VALIDATION";
159
+ RuleType["OTHER"] = "OTHER";
160
+ RuleType["MAX"] = "MAX";
161
+ RuleType["MIN"] = "MIN";
162
+ RuleType["MAX_LENGTH"] = "MAX_LENGTH";
163
+ RuleType["MIN_LENGTH"] = "MIN_LENGTH";
164
+ RuleType["MAX_SIZE"] = "MAX_SIZE";
165
+ RuleType["MIN_SIZE"] = "MIN_SIZE";
166
+ RuleType["FORMAT"] = "FORMAT";
167
+ RuleType["DECIMAL_LTE"] = "DECIMAL_LTE";
168
+ RuleType["DECIMAL_GTE"] = "DECIMAL_GTE";
169
+ RuleType["DECIMAL_LT"] = "DECIMAL_LT";
170
+ RuleType["DECIMAL_GT"] = "DECIMAL_GT";
171
+ RuleType["DECIMAL_MAX_SCALE"] = "DECIMAL_MAX_SCALE";
172
+ RuleType["INVALID_ENUM_VALUE"] = "INVALID_ENUM_VALUE";
173
+ RuleType["REQUIRED_FIELD"] = "REQUIRED_FIELD";
174
+ RuleType["FIELD_NOT_ALLOWED"] = "FIELD_NOT_ALLOWED";
175
+ RuleType["ONE_OF_ALIGNMENT"] = "ONE_OF_ALIGNMENT";
176
+ RuleType["EXACT_LENGTH"] = "EXACT_LENGTH";
177
+ RuleType["EXACT_SIZE"] = "EXACT_SIZE";
178
+ RuleType["REQUIRED_ONE_OF_FIELD"] = "REQUIRED_ONE_OF_FIELD";
179
+ })(RuleType || (RuleType = {}));
180
+ export var AdditionalFeeSource;
181
+ (function (AdditionalFeeSource) {
182
+ AdditionalFeeSource["UNKNOWN_ADDITIONAL_FEE_SOURCE"] = "UNKNOWN_ADDITIONAL_FEE_SOURCE";
183
+ /** The additional fee was added by an additional fee service plugin */
184
+ AdditionalFeeSource["SERVICE_PLUGIN"] = "SERVICE_PLUGIN";
185
+ /** The additional fee was added on the item either via the catalog or on custom line item */
186
+ AdditionalFeeSource["ITEM"] = "ITEM";
187
+ /** The additional fee was added manually on the request */
188
+ AdditionalFeeSource["MANUAL"] = "MANUAL";
189
+ })(AdditionalFeeSource || (AdditionalFeeSource = {}));
190
+ export var Severity;
191
+ (function (Severity) {
192
+ /** The user is allowed to move forward in the flow. */
193
+ Severity["WARNING"] = "WARNING";
194
+ /**
195
+ * The user is blocked from moving forward in the flow.
196
+ * For example, if callerContext is CART - moving to checkout is blocked. if callerContext is CHECKOUT, placing an order is blocked.
197
+ */
198
+ Severity["ERROR"] = "ERROR";
199
+ })(Severity || (Severity = {}));
200
+ /** Available locations on the webpage */
201
+ export var NameInOther;
202
+ (function (NameInOther) {
203
+ /** Default location, in case no specific location is specified. */
204
+ NameInOther["OTHER_DEFAULT"] = "OTHER_DEFAULT";
205
+ })(NameInOther || (NameInOther = {}));
206
+ /** Available locations on the line item */
207
+ export var NameInLineItem;
208
+ (function (NameInLineItem) {
209
+ /** Default location, in case no specific location is specified. */
210
+ NameInLineItem["LINE_ITEM_DEFAULT"] = "LINE_ITEM_DEFAULT";
211
+ })(NameInLineItem || (NameInLineItem = {}));
212
+ export var SuggestedFix;
213
+ (function (SuggestedFix) {
214
+ /** No suggested fix is specified. The user should refer to the violation description to resolve the issue. */
215
+ SuggestedFix["UNKNOWN_SUGGESTED_FIX"] = "UNKNOWN_SUGGESTED_FIX";
216
+ /** The line item should be removed from the cart or checkout to resolve the violation. */
217
+ SuggestedFix["REMOVE_LINE_ITEM"] = "REMOVE_LINE_ITEM";
218
+ })(SuggestedFix || (SuggestedFix = {}));
219
+ export var ChannelType;
220
+ (function (ChannelType) {
221
+ /** Unspecified sales channel. This value is not supported. */
222
+ ChannelType["UNSPECIFIED"] = "UNSPECIFIED";
223
+ /** A web client. */
224
+ ChannelType["WEB"] = "WEB";
225
+ /** [Point of sale solutions](https://support.wix.com/en/wix-mobile-pos-2196395). */
226
+ ChannelType["POS"] = "POS";
227
+ /** [eBay shop](https://support.wix.com/en/article/wix-stores-connecting-and-setting-up-an-ebay-shop). */
228
+ ChannelType["EBAY"] = "EBAY";
229
+ /** [Amazon shop](https://support.wix.com/en/article/wix-stores-connecting-and-setting-up-an-amazon-shop). */
230
+ ChannelType["AMAZON"] = "AMAZON";
231
+ /** Other sales platform. */
232
+ ChannelType["OTHER_PLATFORM"] = "OTHER_PLATFORM";
233
+ /** [Wix Owner app](https://support.wix.com/article/wix-owner-app-an-overview). */
234
+ ChannelType["WIX_APP_STORE"] = "WIX_APP_STORE";
235
+ /** Wix Invoices app in [your dashboard](https://www.wix.com/my-account/site-selector/?buttonText=Select%20Site&title=Select%20a%20Site&autoSelectOnSingleSite=true&actionUrl=https:%2F%2Fwww.wix.com%2Fdashboard%2F%7B%7BmetaSiteId%7D%7D%2Finvoices/settings/general-settings) */
236
+ ChannelType["WIX_INVOICES"] = "WIX_INVOICES";
237
+ /** Wix merchant backoffice. */
238
+ ChannelType["BACKOFFICE_MERCHANT"] = "BACKOFFICE_MERCHANT";
239
+ /** Wish sales channel. */
240
+ ChannelType["WISH"] = "WISH";
241
+ /** [ClassPass sales channel](https://support.wix.com/en/article/wix-bookings-letting-clients-book-your-services-with-classpass). */
242
+ ChannelType["CLASS_PASS"] = "CLASS_PASS";
243
+ /** Global-E sales channel. */
244
+ ChannelType["GLOBAL_E"] = "GLOBAL_E";
245
+ /** [Facebook shop](https://support.wix.com/en/article/wix-stores-changes-to-facebook-shops). */
246
+ ChannelType["FACEBOOK"] = "FACEBOOK";
247
+ /** [Etsy sales channel](https://support.wix.com/en/article/wix-stores-request-adding-etsy-as-a-sales-channel). */
248
+ ChannelType["ETSY"] = "ETSY";
249
+ /** [TikTok sales channel](https://support.wix.com/en/article/wix-stores-request-adding-tiktok-as-a-sales-channel). */
250
+ ChannelType["TIKTOK"] = "TIKTOK";
251
+ /** [Faire marketplace integration](https://support.wix.com/en/article/wix-stores-creating-a-faire-store-using-the-faire-integration-app). */
252
+ ChannelType["FAIRE_COM"] = "FAIRE_COM";
253
+ })(ChannelType || (ChannelType = {}));
254
+ export var WebhookIdentityType;
255
+ (function (WebhookIdentityType) {
256
+ WebhookIdentityType["UNKNOWN"] = "UNKNOWN";
257
+ WebhookIdentityType["ANONYMOUS_VISITOR"] = "ANONYMOUS_VISITOR";
258
+ WebhookIdentityType["MEMBER"] = "MEMBER";
259
+ WebhookIdentityType["WIX_USER"] = "WIX_USER";
260
+ WebhookIdentityType["APP"] = "APP";
261
+ })(WebhookIdentityType || (WebhookIdentityType = {}));
262
+ /**
263
+ * Creates a new cart.
264
+ *
265
+ *
266
+ * The `createCart()` function returns a Promise that resolves to the new cart when it's created.
267
+ *
268
+ * > **Note:** When adding catalog items, `options.lineItems.catalogReference` is required.
269
+ * @public
270
+ * @requiredField options.customLineItems.descriptionLines
271
+ * @requiredField options.customLineItems.descriptionLines.name
272
+ * @requiredField options.customLineItems.itemType
273
+ * @requiredField options.customLineItems.price
274
+ * @requiredField options.customLineItems.productName
275
+ * @requiredField options.customLineItems.quantity
276
+ * @requiredField options.lineItems.catalogReference
277
+ * @requiredField options.lineItems.quantity
278
+ * @requiredField options.lineItems.selectedMembership._id
279
+ * @requiredField options.lineItems.selectedMembership.appId
280
+ * @param options - Cart creation options.
281
+ * @permissionId ECOM.MODIFY_CARTS
282
+ * @permissionId ECOM.ADMIN_MODIFY_CARTS
283
+ * @permissionScope Manage Stores - all permissions
284
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
285
+ * @permissionScope Manage eCommerce - all permissions
286
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
287
+ * @permissionScope Manage Stores - all permissions
288
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
289
+ * @permissionScope Manage eCommerce - Admin Permissions
290
+ * @permissionScopeId SCOPE.ECOM.MANAGE-ADMIN
291
+ * @permissionScope Manage eCommerce - all permissions
292
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
293
+ * @applicableIdentity APP
294
+ * @applicableIdentity VISITOR
295
+ * @returns Fulfilled - Cart.
296
+ * @fqn com.wix.ecom.cart.api.v1.CartService.CreateCart
297
+ */
298
+ export async function createCart(options) {
299
+ // @ts-ignore
300
+ const { httpClient, sideEffects } = arguments[1];
301
+ const payload = transformPaths(renameKeysFromSDKRequestToRESTRequest({
302
+ cartInfo: options?.cartInfo,
303
+ couponCode: options?.couponCode,
304
+ merchantDiscounts: options?.merchantDiscounts,
305
+ lineItems: options?.lineItems,
306
+ customLineItems: options?.customLineItems,
307
+ }), [
308
+ {
309
+ transformFn: transformSDKPageURLV2ToRESTPageURLV2,
310
+ paths: [
311
+ { path: 'cartInfo.lineItems.url' },
312
+ { path: 'lineItems.url' },
313
+ { path: 'customLineItems.url' },
314
+ ],
315
+ },
316
+ {
317
+ transformFn: transformSDKImageToRESTImage,
318
+ paths: [
319
+ { path: 'cartInfo.lineItems.image' },
320
+ { path: 'cartInfo.lineItems.catalogOverrideFields.image' },
321
+ { path: 'lineItems.image' },
322
+ { path: 'lineItems.catalogOverrideFields.image' },
323
+ { path: 'customLineItems.media' },
324
+ ],
325
+ },
326
+ {
327
+ transformFn: transformSDKAddressToRESTAddress,
328
+ paths: [{ path: 'cartInfo.contactInfo.address' }],
329
+ },
330
+ ]);
331
+ const reqOpts = ambassadorWixEcomV1Cart.createCart(payload);
332
+ sideEffects?.onSiteCall?.();
333
+ try {
334
+ const result = await httpClient.request(reqOpts);
335
+ sideEffects?.onSuccess?.(result);
336
+ return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
337
+ {
338
+ transformFn: transformRESTPageURLV2ToSDKPageURLV2,
339
+ paths: [{ path: 'cart.lineItems.url' }],
340
+ },
341
+ {
342
+ transformFn: transformRESTImageToSDKImage,
343
+ paths: [
344
+ { path: 'cart.lineItems.image' },
345
+ { path: 'cart.lineItems.catalogOverrideFields.image' },
346
+ ],
347
+ },
348
+ {
349
+ transformFn: transformRESTAddressToSDKAddress,
350
+ paths: [{ path: 'cart.contactInfo.address' }],
351
+ },
352
+ ]))?.cart;
353
+ }
354
+ catch (err) {
355
+ const transformedError = sdkTransformError(err, {
356
+ spreadPathsToArguments: {},
357
+ explicitPathsToArguments: {
358
+ cartInfo: '$[0].cartInfo',
359
+ couponCode: '$[0].couponCode',
360
+ merchantDiscounts: '$[0].merchantDiscounts',
361
+ lineItems: '$[0].lineItems',
362
+ customLineItems: '$[0].customLineItems',
363
+ },
364
+ singleArgumentUnchanged: false,
365
+ }, ['options']);
366
+ sideEffects?.onError?.(err);
367
+ throw transformedError;
368
+ }
369
+ }
370
+ /**
371
+ * Updates a specified cart's properties.
372
+ *
373
+ *
374
+ * The `updateCart()` function returns a Promise that resolves when the specified cart's properties are updated.
375
+ *
376
+ * > **Note:** When updating catalog items, `options.lineItems.catalogReference` is required.
377
+ * @public
378
+ * @requiredField _id
379
+ * @requiredField options.customLineItems.descriptionLines
380
+ * @requiredField options.customLineItems.descriptionLines.name
381
+ * @requiredField options.customLineItems.itemType
382
+ * @requiredField options.customLineItems.productName
383
+ * @requiredField options.lineItems.catalogReference
384
+ * @param options - Available options to use when updating a cart.
385
+ * @param _id - ID of the cart to be updated.
386
+ * @permissionId ECOM.MODIFY_CARTS
387
+ * @permissionId ECOM.ADMIN_MODIFY_CARTS
388
+ * @permissionScope Manage Stores - all permissions
389
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
390
+ * @permissionScope Manage eCommerce - all permissions
391
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
392
+ * @permissionScope Manage Stores - all permissions
393
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
394
+ * @permissionScope Manage eCommerce - Admin Permissions
395
+ * @permissionScopeId SCOPE.ECOM.MANAGE-ADMIN
396
+ * @permissionScope Manage eCommerce - all permissions
397
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
398
+ * @applicableIdentity APP
399
+ * @applicableIdentity VISITOR
400
+ * @returns Fulfilled - Updated cart.
401
+ * @fqn com.wix.ecom.cart.api.v1.CartService.UpdateCart
402
+ */
403
+ export async function updateCart(_id, options) {
404
+ // @ts-ignore
405
+ const { httpClient, sideEffects } = arguments[2];
406
+ const payload = transformPaths(renameKeysFromSDKRequestToRESTRequest({
407
+ cartInfo: { ...options?.cartInfo, id: _id },
408
+ couponCode: options?.couponCode,
409
+ merchantDiscounts: options?.merchantDiscounts,
410
+ lineItems: options?.lineItems,
411
+ customLineItems: options?.customLineItems,
412
+ }), [
413
+ {
414
+ transformFn: transformSDKPageURLV2ToRESTPageURLV2,
415
+ paths: [
416
+ { path: 'cartInfo.lineItems.url' },
417
+ { path: 'lineItems.url' },
418
+ { path: 'customLineItems.url' },
419
+ ],
420
+ },
421
+ {
422
+ transformFn: transformSDKImageToRESTImage,
423
+ paths: [
424
+ { path: 'cartInfo.lineItems.image' },
425
+ { path: 'cartInfo.lineItems.catalogOverrideFields.image' },
426
+ { path: 'lineItems.image' },
427
+ { path: 'lineItems.catalogOverrideFields.image' },
428
+ { path: 'customLineItems.media' },
429
+ ],
430
+ },
431
+ {
432
+ transformFn: transformSDKAddressToRESTAddress,
433
+ paths: [{ path: 'cartInfo.contactInfo.address' }],
434
+ },
435
+ ]);
436
+ const reqOpts = ambassadorWixEcomV1Cart.updateCart(payload);
437
+ sideEffects?.onSiteCall?.();
438
+ try {
439
+ const result = await httpClient.request(reqOpts);
440
+ sideEffects?.onSuccess?.(result);
441
+ return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
442
+ {
443
+ transformFn: transformRESTPageURLV2ToSDKPageURLV2,
444
+ paths: [{ path: 'cart.lineItems.url' }],
445
+ },
446
+ {
447
+ transformFn: transformRESTImageToSDKImage,
448
+ paths: [
449
+ { path: 'cart.lineItems.image' },
450
+ { path: 'cart.lineItems.catalogOverrideFields.image' },
451
+ ],
452
+ },
453
+ {
454
+ transformFn: transformRESTAddressToSDKAddress,
455
+ paths: [{ path: 'cart.contactInfo.address' }],
456
+ },
457
+ ]))?.cart;
458
+ }
459
+ catch (err) {
460
+ const transformedError = sdkTransformError(err, {
461
+ spreadPathsToArguments: { cartInfo: '$[1].cartInfo' },
462
+ explicitPathsToArguments: {
463
+ 'cartInfo.id': '$[0]',
464
+ couponCode: '$[1].couponCode',
465
+ merchantDiscounts: '$[1].merchantDiscounts',
466
+ lineItems: '$[1].lineItems',
467
+ customLineItems: '$[1].customLineItems',
468
+ },
469
+ singleArgumentUnchanged: false,
470
+ }, ['_id', 'options']);
471
+ sideEffects?.onError?.(err);
472
+ throw transformedError;
473
+ }
474
+ }
475
+ /**
476
+ * Retrieves a cart.
477
+ *
478
+ *
479
+ * The `getCart()` function returns a Promise that resolves when the specified cart is retrieved.
480
+ * @param _id - ID of the cart to retrieve.
481
+ * @public
482
+ * @requiredField _id
483
+ * @permissionId ECOM.READ_CARTS
484
+ * @permissionScope Manage Stores - all permissions
485
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
486
+ * @permissionScope Read eCommerce - all read permissions
487
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.READ-ECOM
488
+ * @permissionScope Read Orders
489
+ * @permissionScopeId SCOPE.DC-STORES.READ-ORDERS
490
+ * @permissionScope Read Stores - all read permissions
491
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.READ-STORES
492
+ * @permissionScope Manage Restaurants - all permissions
493
+ * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
494
+ * @permissionScope Manage eCommerce - all permissions
495
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
496
+ * @permissionScope Manage Orders
497
+ * @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
498
+ * @applicableIdentity APP
499
+ * @applicableIdentity VISITOR
500
+ * @returns Fulfilled - The specified cart.
501
+ * @fqn com.wix.ecom.cart.api.v1.CartService.GetCart
502
+ */
503
+ export async function getCart(_id) {
504
+ // @ts-ignore
505
+ const { httpClient, sideEffects } = arguments[1];
506
+ const payload = renameKeysFromSDKRequestToRESTRequest({ id: _id });
507
+ const reqOpts = ambassadorWixEcomV1Cart.getCart(payload);
508
+ sideEffects?.onSiteCall?.();
509
+ try {
510
+ const result = await httpClient.request(reqOpts);
511
+ sideEffects?.onSuccess?.(result);
512
+ return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
513
+ {
514
+ transformFn: transformRESTPageURLV2ToSDKPageURLV2,
515
+ paths: [{ path: 'cart.lineItems.url' }],
516
+ },
517
+ {
518
+ transformFn: transformRESTImageToSDKImage,
519
+ paths: [
520
+ { path: 'cart.lineItems.image' },
521
+ { path: 'cart.lineItems.catalogOverrideFields.image' },
522
+ ],
523
+ },
524
+ {
525
+ transformFn: transformRESTAddressToSDKAddress,
526
+ paths: [{ path: 'cart.contactInfo.address' }],
527
+ },
528
+ ]))?.cart;
529
+ }
530
+ catch (err) {
531
+ const transformedError = sdkTransformError(err, {
532
+ spreadPathsToArguments: {},
533
+ explicitPathsToArguments: { id: '$[0]' },
534
+ singleArgumentUnchanged: false,
535
+ }, ['_id']);
536
+ sideEffects?.onError?.(err);
537
+ throw transformedError;
538
+ }
539
+ }
540
+ /**
541
+ * Retrieves the cart associated with a specified checkout.
542
+ * @param _id - Checkout ID.
543
+ * @internal
544
+ * @documentationMaturity preview
545
+ * @requiredField _id
546
+ * @permissionId ECOM.READ_CARTS
547
+ * @permissionScope Manage Stores - all permissions
548
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
549
+ * @permissionScope Read eCommerce - all read permissions
550
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.READ-ECOM
551
+ * @permissionScope Read Orders
552
+ * @permissionScopeId SCOPE.DC-STORES.READ-ORDERS
553
+ * @permissionScope Read Stores - all read permissions
554
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.READ-STORES
555
+ * @permissionScope Manage Restaurants - all permissions
556
+ * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
557
+ * @permissionScope Manage eCommerce - all permissions
558
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
559
+ * @permissionScope Manage Orders
560
+ * @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
561
+ * @applicableIdentity APP
562
+ * @applicableIdentity VISITOR
563
+ * @fqn com.wix.ecom.cart.api.v1.CartService.GetCartByCheckoutId
564
+ */
565
+ export async function getCartByCheckoutId(_id) {
566
+ // @ts-ignore
567
+ const { httpClient, sideEffects } = arguments[1];
568
+ const payload = renameKeysFromSDKRequestToRESTRequest({ id: _id });
569
+ const reqOpts = ambassadorWixEcomV1Cart.getCartByCheckoutId(payload);
570
+ sideEffects?.onSiteCall?.();
571
+ try {
572
+ const result = await httpClient.request(reqOpts);
573
+ sideEffects?.onSuccess?.(result);
574
+ return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
575
+ {
576
+ transformFn: transformRESTPageURLV2ToSDKPageURLV2,
577
+ paths: [{ path: 'cart.lineItems.url' }],
578
+ },
579
+ {
580
+ transformFn: transformRESTImageToSDKImage,
581
+ paths: [
582
+ { path: 'cart.lineItems.image' },
583
+ { path: 'cart.lineItems.catalogOverrideFields.image' },
584
+ ],
585
+ },
586
+ {
587
+ transformFn: transformRESTAddressToSDKAddress,
588
+ paths: [{ path: 'cart.contactInfo.address' }],
589
+ },
590
+ ]));
591
+ }
592
+ catch (err) {
593
+ const transformedError = sdkTransformError(err, {
594
+ spreadPathsToArguments: {},
595
+ explicitPathsToArguments: { id: '$[0]' },
596
+ singleArgumentUnchanged: false,
597
+ }, ['_id']);
598
+ sideEffects?.onError?.(err);
599
+ throw transformedError;
600
+ }
601
+ }
602
+ /**
603
+ * Adds catalog line items to a cart.
604
+ *
605
+ *
606
+ * The `addToCart()` function returns a Promise that resolves to the updated cart when the specified items have been added.
607
+ *
608
+ * > **Note:** When adding catalog items, `options.lineItems.catalogReference` is required.
609
+ * @param _id - Cart ID.
610
+ * @public
611
+ * @requiredField _id
612
+ * @requiredField options.customLineItems.descriptionLines
613
+ * @requiredField options.customLineItems.descriptionLines.name
614
+ * @requiredField options.customLineItems.itemType
615
+ * @requiredField options.customLineItems.price
616
+ * @requiredField options.customLineItems.productName
617
+ * @requiredField options.customLineItems.quantity
618
+ * @requiredField options.lineItems.catalogReference
619
+ * @requiredField options.lineItems.selectedMembership._id
620
+ * @requiredField options.lineItems.selectedMembership.appId
621
+ * @param options - Items to be added to cart.
622
+ * @permissionId ECOM.MODIFY_CARTS
623
+ * @permissionId ECOM.ADMIN_MODIFY_CARTS
624
+ * @permissionScope Manage Stores - all permissions
625
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
626
+ * @permissionScope Manage eCommerce - all permissions
627
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
628
+ * @permissionScope Manage Stores - all permissions
629
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
630
+ * @permissionScope Manage eCommerce - Admin Permissions
631
+ * @permissionScopeId SCOPE.ECOM.MANAGE-ADMIN
632
+ * @permissionScope Manage eCommerce - all permissions
633
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
634
+ * @applicableIdentity APP
635
+ * @applicableIdentity VISITOR
636
+ * @returns Fulfilled - Cart.
637
+ * @fqn com.wix.ecom.cart.api.v1.CartService.AddToCart
638
+ */
639
+ export async function addToCart(_id, options) {
640
+ // @ts-ignore
641
+ const { httpClient, sideEffects } = arguments[2];
642
+ const payload = transformPaths(renameKeysFromSDKRequestToRESTRequest({
643
+ id: _id,
644
+ lineItems: options?.lineItems,
645
+ customLineItems: options?.customLineItems,
646
+ }), [
647
+ {
648
+ transformFn: transformSDKPageURLV2ToRESTPageURLV2,
649
+ paths: [{ path: 'lineItems.url' }, { path: 'customLineItems.url' }],
650
+ },
651
+ {
652
+ transformFn: transformSDKImageToRESTImage,
653
+ paths: [
654
+ { path: 'lineItems.image' },
655
+ { path: 'lineItems.catalogOverrideFields.image' },
656
+ { path: 'customLineItems.media' },
657
+ ],
658
+ },
659
+ ]);
660
+ const reqOpts = ambassadorWixEcomV1Cart.addToCart(payload);
661
+ sideEffects?.onSiteCall?.();
662
+ try {
663
+ const result = await httpClient.request(reqOpts);
664
+ sideEffects?.onSuccess?.(result);
665
+ return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
666
+ {
667
+ transformFn: transformRESTPageURLV2ToSDKPageURLV2,
668
+ paths: [{ path: 'cart.lineItems.url' }],
669
+ },
670
+ {
671
+ transformFn: transformRESTImageToSDKImage,
672
+ paths: [
673
+ { path: 'cart.lineItems.image' },
674
+ { path: 'cart.lineItems.catalogOverrideFields.image' },
675
+ ],
676
+ },
677
+ {
678
+ transformFn: transformRESTAddressToSDKAddress,
679
+ paths: [{ path: 'cart.contactInfo.address' }],
680
+ },
681
+ ]));
682
+ }
683
+ catch (err) {
684
+ const transformedError = sdkTransformError(err, {
685
+ spreadPathsToArguments: {},
686
+ explicitPathsToArguments: {
687
+ id: '$[0]',
688
+ lineItems: '$[1].lineItems',
689
+ customLineItems: '$[1].customLineItems',
690
+ },
691
+ singleArgumentUnchanged: false,
692
+ }, ['_id', 'options']);
693
+ sideEffects?.onError?.(err);
694
+ throw transformedError;
695
+ }
696
+ }
697
+ /**
698
+ * Removes line items from the specified cart.
699
+ *
700
+ *
701
+ * The `removeLineItems()` function returns a Promise that resolves to the updated cart when the line items are removed from the specified cart.
702
+ * @public
703
+ * @requiredField _id
704
+ * @requiredField lineItemIds
705
+ * @param lineItemIds - IDs of the line items to remove from the cart.
706
+ * @param _id - ID of the cart to remove line items from.
707
+ * @permissionId ECOM.MODIFY_CARTS
708
+ * @permissionScope Manage Stores - all permissions
709
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
710
+ * @permissionScope Manage eCommerce - all permissions
711
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
712
+ * @applicableIdentity APP
713
+ * @applicableIdentity VISITOR
714
+ * @returns Fulfilled - Updated cart.
715
+ * @fqn com.wix.ecom.cart.api.v1.CartService.RemoveLineItems
716
+ */
717
+ export async function removeLineItems(_id, lineItemIds) {
718
+ // @ts-ignore
719
+ const { httpClient, sideEffects } = arguments[2];
720
+ const payload = renameKeysFromSDKRequestToRESTRequest({
721
+ id: _id,
722
+ lineItemIds: lineItemIds,
723
+ });
724
+ const reqOpts = ambassadorWixEcomV1Cart.removeLineItems(payload);
725
+ sideEffects?.onSiteCall?.();
726
+ try {
727
+ const result = await httpClient.request(reqOpts);
728
+ sideEffects?.onSuccess?.(result);
729
+ return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
730
+ {
731
+ transformFn: transformRESTPageURLV2ToSDKPageURLV2,
732
+ paths: [{ path: 'cart.lineItems.url' }],
733
+ },
734
+ {
735
+ transformFn: transformRESTImageToSDKImage,
736
+ paths: [
737
+ { path: 'cart.lineItems.image' },
738
+ { path: 'cart.lineItems.catalogOverrideFields.image' },
739
+ ],
740
+ },
741
+ {
742
+ transformFn: transformRESTAddressToSDKAddress,
743
+ paths: [{ path: 'cart.contactInfo.address' }],
744
+ },
745
+ ]));
746
+ }
747
+ catch (err) {
748
+ const transformedError = sdkTransformError(err, {
749
+ spreadPathsToArguments: {},
750
+ explicitPathsToArguments: { id: '$[0]', lineItemIds: '$[1]' },
751
+ singleArgumentUnchanged: false,
752
+ }, ['_id', 'lineItemIds']);
753
+ sideEffects?.onError?.(err);
754
+ throw transformedError;
755
+ }
756
+ }
757
+ /**
758
+ * Creates a checkout from a cart.
759
+ *
760
+ *
761
+ * The `createCheckout()` function returns a Promise that resolves to the new checkout's ID when it's created.
762
+ *
763
+ * If a checkout was already created from the specified cart, that checkout will be
764
+ * updated with any new information from the cart.
765
+ *
766
+ * > **Note:** `options.channelType` is a required field.
767
+ * @param _id - Cart ID.
768
+ * @public
769
+ * @requiredField _id
770
+ * @param options - Checkout creation options.
771
+ * @permissionId ECOM.CREATE_CHECKOUT_FROM_CART
772
+ * @permissionScope Manage Stores - all permissions
773
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
774
+ * @permissionScope Manage Restaurants - all permissions
775
+ * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
776
+ * @permissionScope Manage eCommerce - all permissions
777
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
778
+ * @permissionScope Manage Orders
779
+ * @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
780
+ * @applicableIdentity APP
781
+ * @applicableIdentity VISITOR
782
+ * @returns Fulfilled - ID of the newly created checkout.
783
+ * @fqn com.wix.ecom.cart.api.v1.CartService.CreateCheckout
784
+ */
785
+ export async function createCheckout(_id, options) {
786
+ // @ts-ignore
787
+ const { httpClient, sideEffects } = arguments[2];
788
+ const payload = transformPaths(renameKeysFromSDKRequestToRESTRequest({
789
+ id: _id,
790
+ channelType: options?.channelType,
791
+ shippingAddress: options?.shippingAddress,
792
+ billingAddress: options?.billingAddress,
793
+ selectedShippingOption: options?.selectedShippingOption,
794
+ email: options?.email,
795
+ }), [
796
+ {
797
+ transformFn: transformSDKAddressToRESTAddress,
798
+ paths: [{ path: 'shippingAddress' }, { path: 'billingAddress' }],
799
+ },
800
+ ]);
801
+ const reqOpts = ambassadorWixEcomV1Cart.createCheckout(payload);
802
+ sideEffects?.onSiteCall?.();
803
+ try {
804
+ const result = await httpClient.request(reqOpts);
805
+ sideEffects?.onSuccess?.(result);
806
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
807
+ }
808
+ catch (err) {
809
+ const transformedError = sdkTransformError(err, {
810
+ spreadPathsToArguments: {},
811
+ explicitPathsToArguments: {
812
+ id: '$[0]',
813
+ channelType: '$[1].channelType',
814
+ shippingAddress: '$[1].shippingAddress',
815
+ billingAddress: '$[1].billingAddress',
816
+ selectedShippingOption: '$[1].selectedShippingOption',
817
+ email: '$[1].email',
818
+ },
819
+ singleArgumentUnchanged: false,
820
+ }, ['_id', 'options']);
821
+ sideEffects?.onError?.(err);
822
+ throw transformedError;
823
+ }
824
+ }
825
+ /**
826
+ * Removes the coupon from a specified cart.
827
+ *
828
+ *
829
+ * The `removeCoupon()` function returns a Promise that resolves to the updated cart when the coupon is removed from the specified cart.
830
+ * @param _id - Cart ID.
831
+ * @public
832
+ * @requiredField _id
833
+ * @permissionId ECOM.MODIFY_CARTS
834
+ * @permissionScope Manage Stores - all permissions
835
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
836
+ * @permissionScope Manage eCommerce - all permissions
837
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
838
+ * @applicableIdentity APP
839
+ * @applicableIdentity VISITOR
840
+ * @returns Fulfilled - Updated cart.
841
+ * @fqn com.wix.ecom.cart.api.v1.CartService.RemoveCoupon
842
+ */
843
+ export async function removeCoupon(_id) {
844
+ // @ts-ignore
845
+ const { httpClient, sideEffects } = arguments[1];
846
+ const payload = renameKeysFromSDKRequestToRESTRequest({ id: _id });
847
+ const reqOpts = ambassadorWixEcomV1Cart.removeCoupon(payload);
848
+ sideEffects?.onSiteCall?.();
849
+ try {
850
+ const result = await httpClient.request(reqOpts);
851
+ sideEffects?.onSuccess?.(result);
852
+ return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
853
+ {
854
+ transformFn: transformRESTPageURLV2ToSDKPageURLV2,
855
+ paths: [{ path: 'cart.lineItems.url' }],
856
+ },
857
+ {
858
+ transformFn: transformRESTImageToSDKImage,
859
+ paths: [
860
+ { path: 'cart.lineItems.image' },
861
+ { path: 'cart.lineItems.catalogOverrideFields.image' },
862
+ ],
863
+ },
864
+ {
865
+ transformFn: transformRESTAddressToSDKAddress,
866
+ paths: [{ path: 'cart.contactInfo.address' }],
867
+ },
868
+ ]));
869
+ }
870
+ catch (err) {
871
+ const transformedError = sdkTransformError(err, {
872
+ spreadPathsToArguments: {},
873
+ explicitPathsToArguments: { id: '$[0]' },
874
+ singleArgumentUnchanged: false,
875
+ }, ['_id']);
876
+ sideEffects?.onError?.(err);
877
+ throw transformedError;
878
+ }
879
+ }
880
+ /**
881
+ * Updates the quantity of one or more line items in a specified cart.
882
+ *
883
+ *
884
+ * The `updateLineItemsQuantity()` function returns a Promise that resolves when the quantities of the specified cart's line items are updated.
885
+ *
886
+ * This endpoint is only for updating the quantity of line items. To entirely remove a line item from the cart, use [`removeLineItems()`](#removelineitems). To add a new line item to the cart, use [`addToCart()`](#addtocart).
887
+ *
888
+ * This endpoint checks the amount of stock remaining for this line item. If the specified `quantity` is greater than the remaining stock, then the `quantity` returned in the response is the total amount of remaining stock.
889
+ * @param _id - Cart ID.
890
+ * @param lineItems - Line item IDs and their new quantity.
891
+ * @public
892
+ * @requiredField _id
893
+ * @requiredField lineItems
894
+ * @permissionId ECOM.MODIFY_CARTS
895
+ * @permissionScope Manage Stores - all permissions
896
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
897
+ * @permissionScope Manage eCommerce - all permissions
898
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
899
+ * @applicableIdentity APP
900
+ * @applicableIdentity VISITOR
901
+ * @returns Fulfilled - Updated cart.
902
+ * @fqn com.wix.ecom.cart.api.v1.CartService.UpdateLineItemsQuantity
903
+ */
904
+ export async function updateLineItemsQuantity(_id, lineItems) {
905
+ // @ts-ignore
906
+ const { httpClient, sideEffects } = arguments[2];
907
+ const payload = renameKeysFromSDKRequestToRESTRequest({
908
+ id: _id,
909
+ lineItems: lineItems,
910
+ });
911
+ const reqOpts = ambassadorWixEcomV1Cart.updateLineItemsQuantity(payload);
912
+ sideEffects?.onSiteCall?.();
913
+ try {
914
+ const result = await httpClient.request(reqOpts);
915
+ sideEffects?.onSuccess?.(result);
916
+ return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
917
+ {
918
+ transformFn: transformRESTPageURLV2ToSDKPageURLV2,
919
+ paths: [{ path: 'cart.lineItems.url' }],
920
+ },
921
+ {
922
+ transformFn: transformRESTImageToSDKImage,
923
+ paths: [
924
+ { path: 'cart.lineItems.image' },
925
+ { path: 'cart.lineItems.catalogOverrideFields.image' },
926
+ ],
927
+ },
928
+ {
929
+ transformFn: transformRESTAddressToSDKAddress,
930
+ paths: [{ path: 'cart.contactInfo.address' }],
931
+ },
932
+ ]));
933
+ }
934
+ catch (err) {
935
+ const transformedError = sdkTransformError(err, {
936
+ spreadPathsToArguments: {},
937
+ explicitPathsToArguments: { id: '$[0]', lineItems: '$[1]' },
938
+ singleArgumentUnchanged: false,
939
+ }, ['_id', 'lineItems']);
940
+ sideEffects?.onError?.(err);
941
+ throw transformedError;
942
+ }
943
+ }
944
+ /**
945
+ * Estimates the subtotal and total for current site visitor’s cart. Totals include tax and are based on the selected carrier service, shipping address, and billing information.
946
+ *
947
+ *
948
+ * The `estimateTotals()` function returns a Promise that resolves when the estimated totals are generated.
949
+ *
950
+ * > **Note:** Not passing any `options` properties will only estimate the cart items price totals.
951
+ * @param _id - Cart ID.
952
+ * @public
953
+ * @requiredField _id
954
+ * @param options - Total estimation options.
955
+ * @permissionId ECOM.READ_CARTS
956
+ * @permissionScope Manage Stores - all permissions
957
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
958
+ * @permissionScope Read eCommerce - all read permissions
959
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.READ-ECOM
960
+ * @permissionScope Read Orders
961
+ * @permissionScopeId SCOPE.DC-STORES.READ-ORDERS
962
+ * @permissionScope Read Stores - all read permissions
963
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.READ-STORES
964
+ * @permissionScope Manage Restaurants - all permissions
965
+ * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
966
+ * @permissionScope Manage eCommerce - all permissions
967
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
968
+ * @permissionScope Manage Orders
969
+ * @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
970
+ * @applicableIdentity APP
971
+ * @applicableIdentity VISITOR
972
+ * @returns Fulfilled - Cart's estimated totals.
973
+ * @fqn com.wix.ecom.cart.api.v1.CartService.EstimateTotals
974
+ */
975
+ export async function estimateTotals(_id, options) {
976
+ // @ts-ignore
977
+ const { httpClient, sideEffects } = arguments[2];
978
+ const payload = transformPaths(renameKeysFromSDKRequestToRESTRequest({
979
+ id: _id,
980
+ selectedShippingOption: options?.selectedShippingOption,
981
+ shippingAddress: options?.shippingAddress,
982
+ billingAddress: options?.billingAddress,
983
+ selectedMemberships: options?.selectedMemberships,
984
+ calculateTax: options?.calculateTax,
985
+ calculateShipping: options?.calculateShipping,
986
+ }), [
987
+ {
988
+ transformFn: transformSDKAddressToRESTAddress,
989
+ paths: [{ path: 'shippingAddress' }, { path: 'billingAddress' }],
990
+ },
991
+ ]);
992
+ const reqOpts = ambassadorWixEcomV1Cart.estimateTotals(payload);
993
+ sideEffects?.onSiteCall?.();
994
+ try {
995
+ const result = await httpClient.request(reqOpts);
996
+ sideEffects?.onSuccess?.(result);
997
+ return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
998
+ {
999
+ transformFn: transformRESTPageURLV2ToSDKPageURLV2,
1000
+ paths: [{ path: 'cart.lineItems.url' }],
1001
+ },
1002
+ {
1003
+ transformFn: transformRESTImageToSDKImage,
1004
+ paths: [
1005
+ { path: 'cart.lineItems.image' },
1006
+ { path: 'cart.lineItems.catalogOverrideFields.image' },
1007
+ ],
1008
+ },
1009
+ {
1010
+ transformFn: transformRESTAddressToSDKAddress,
1011
+ paths: [
1012
+ { path: 'cart.contactInfo.address' },
1013
+ {
1014
+ path: 'shippingInfo.selectedCarrierServiceOption.logistics.pickupDetails.address',
1015
+ },
1016
+ {
1017
+ path: 'shippingInfo.carrierServiceOptions.shippingOptions.logistics.pickupDetails.address',
1018
+ },
1019
+ ],
1020
+ },
1021
+ ]));
1022
+ }
1023
+ catch (err) {
1024
+ const transformedError = sdkTransformError(err, {
1025
+ spreadPathsToArguments: {},
1026
+ explicitPathsToArguments: {
1027
+ id: '$[0]',
1028
+ selectedShippingOption: '$[1].selectedShippingOption',
1029
+ shippingAddress: '$[1].shippingAddress',
1030
+ billingAddress: '$[1].billingAddress',
1031
+ selectedMemberships: '$[1].selectedMemberships',
1032
+ calculateTax: '$[1].calculateTax',
1033
+ calculateShipping: '$[1].calculateShipping',
1034
+ },
1035
+ singleArgumentUnchanged: false,
1036
+ }, ['_id', 'options']);
1037
+ sideEffects?.onError?.(err);
1038
+ throw transformedError;
1039
+ }
1040
+ }
1041
+ /**
1042
+ * Deletes a cart.
1043
+ *
1044
+ *
1045
+ * The `deleteCart()` function returns a Promise that resolves when the specified cart is deleted.
1046
+ * @public
1047
+ * @requiredField _id
1048
+ * @param _id - ID of the cart to delete.
1049
+ * @permissionId ECOM.MODIFY_CARTS
1050
+ * @permissionScope Manage Stores - all permissions
1051
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
1052
+ * @permissionScope Manage eCommerce - all permissions
1053
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
1054
+ * @applicableIdentity APP
1055
+ * @applicableIdentity VISITOR
1056
+ * @returns Fulfilled - When the cart is deleted. Rejected - Error message.
1057
+ * @fqn com.wix.ecom.cart.api.v1.CartService.DeleteCart
1058
+ */
1059
+ export async function deleteCart(_id) {
1060
+ // @ts-ignore
1061
+ const { httpClient, sideEffects } = arguments[1];
1062
+ const payload = renameKeysFromSDKRequestToRESTRequest({ id: _id });
1063
+ const reqOpts = ambassadorWixEcomV1Cart.deleteCart(payload);
1064
+ sideEffects?.onSiteCall?.();
1065
+ try {
1066
+ const result = await httpClient.request(reqOpts);
1067
+ sideEffects?.onSuccess?.(result);
1068
+ }
1069
+ catch (err) {
1070
+ const transformedError = sdkTransformError(err, {
1071
+ spreadPathsToArguments: {},
1072
+ explicitPathsToArguments: { id: '$[0]' },
1073
+ singleArgumentUnchanged: false,
1074
+ }, ['_id']);
1075
+ sideEffects?.onError?.(err);
1076
+ throw transformedError;
1077
+ }
1078
+ }
1079
+ /**
1080
+ * Removes the location associated with a cart.
1081
+ * @param _id - Cart ID.
1082
+ * @internal
1083
+ * @documentationMaturity preview
1084
+ * @requiredField _id
1085
+ * @permissionId ECOM.MODIFY_CARTS
1086
+ * @permissionScope Manage Stores - all permissions
1087
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
1088
+ * @permissionScope Manage eCommerce - all permissions
1089
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
1090
+ * @applicableIdentity APP
1091
+ * @applicableIdentity VISITOR
1092
+ * @fqn com.wix.ecom.cart.api.v1.CartService.RemoveBusinessLocation
1093
+ */
1094
+ export async function removeBusinessLocation(_id) {
1095
+ // @ts-ignore
1096
+ const { httpClient, sideEffects } = arguments[1];
1097
+ const payload = renameKeysFromSDKRequestToRESTRequest({ id: _id });
1098
+ const reqOpts = ambassadorWixEcomV1Cart.removeBusinessLocation(payload);
1099
+ sideEffects?.onSiteCall?.();
1100
+ try {
1101
+ const result = await httpClient.request(reqOpts);
1102
+ sideEffects?.onSuccess?.(result);
1103
+ return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
1104
+ {
1105
+ transformFn: transformRESTPageURLV2ToSDKPageURLV2,
1106
+ paths: [{ path: 'cart.lineItems.url' }],
1107
+ },
1108
+ {
1109
+ transformFn: transformRESTImageToSDKImage,
1110
+ paths: [
1111
+ { path: 'cart.lineItems.image' },
1112
+ { path: 'cart.lineItems.catalogOverrideFields.image' },
1113
+ ],
1114
+ },
1115
+ {
1116
+ transformFn: transformRESTAddressToSDKAddress,
1117
+ paths: [{ path: 'cart.contactInfo.address' }],
1118
+ },
1119
+ ]));
1120
+ }
1121
+ catch (err) {
1122
+ const transformedError = sdkTransformError(err, {
1123
+ spreadPathsToArguments: {},
1124
+ explicitPathsToArguments: { id: '$[0]' },
1125
+ singleArgumentUnchanged: false,
1126
+ }, ['_id']);
1127
+ sideEffects?.onError?.(err);
1128
+ throw transformedError;
1129
+ }
1130
+ }
1131
+ //# sourceMappingURL=ecom-v1-cart-cart.universal.js.map