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