@wix/stores 1.0.103 → 1.0.104
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 +6 -7
- package/build/cjs/index.js +1 -2
- package/build/cjs/index.js.map +1 -1
- package/build/es/index.d.ts +6 -7
- package/build/es/index.js +6 -7
- package/build/es/index.js.map +1 -1
- package/package.json +2 -2
- package/build/cjs/src/stores-v2-orders.http.d.ts +0 -42
- package/build/cjs/src/stores-v2-orders.http.js +0 -351
- package/build/cjs/src/stores-v2-orders.http.js.map +0 -1
- package/build/cjs/src/stores-v2-orders.public.d.ts +0 -12
- package/build/cjs/src/stores-v2-orders.public.js +0 -67
- package/build/cjs/src/stores-v2-orders.public.js.map +0 -1
- package/build/cjs/src/stores-v2-orders.types.d.ts +0 -1075
- package/build/cjs/src/stores-v2-orders.types.js +0 -168
- package/build/cjs/src/stores-v2-orders.types.js.map +0 -1
- package/build/cjs/src/stores-v2-orders.universal.d.ts +0 -1191
- package/build/cjs/src/stores-v2-orders.universal.js +0 -669
- package/build/cjs/src/stores-v2-orders.universal.js.map +0 -1
- package/build/es/src/stores-v2-orders.http.d.ts +0 -42
- package/build/es/src/stores-v2-orders.http.js +0 -340
- package/build/es/src/stores-v2-orders.http.js.map +0 -1
- package/build/es/src/stores-v2-orders.public.d.ts +0 -12
- package/build/es/src/stores-v2-orders.public.js +0 -43
- package/build/es/src/stores-v2-orders.public.js.map +0 -1
- package/build/es/src/stores-v2-orders.types.d.ts +0 -1075
- package/build/es/src/stores-v2-orders.types.js +0 -165
- package/build/es/src/stores-v2-orders.types.js.map +0 -1
- package/build/es/src/stores-v2-orders.universal.d.ts +0 -1191
- package/build/es/src/stores-v2-orders.universal.js +0 -639
- package/build/es/src/stores-v2-orders.universal.js.map +0 -1
|
@@ -1,669 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
22
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
23
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
24
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
25
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
26
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
27
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
28
|
-
});
|
|
29
|
-
};
|
|
30
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
-
exports.deleteFulfillment = exports.updateFulfillment = exports.createFulfillment = exports.queryOrders = exports.getOrder = exports.updateOrderShippingAddress = exports.updateOrderEmail = exports.createOrder = exports.ShipmentFulfillmentStatus = exports.SubscriptionFrequency = exports.EnteredByIdentityType = exports.ChannelType = exports.InvoiceSource = exports.ActivityType = exports.MediaItemType = exports.LineItemType = exports.FulfillmentStatus = exports.PaymentStatus = exports.VatType = exports.WeightUnit = exports.IdentityType = exports.__debug = void 0;
|
|
32
|
-
const velo_1 = require("@wix/metro-runtime/velo");
|
|
33
|
-
const ambassadorWixStoresV2Orders = __importStar(require("./stores-v2-orders.http"));
|
|
34
|
-
let __verbose = false;
|
|
35
|
-
function __log(...args) {
|
|
36
|
-
__verbose && console.log(...args);
|
|
37
|
-
}
|
|
38
|
-
function __inspect(obj) {
|
|
39
|
-
return obj;
|
|
40
|
-
}
|
|
41
|
-
exports.__debug = {
|
|
42
|
-
verboseLogging: {
|
|
43
|
-
on: () => (__verbose = true),
|
|
44
|
-
off: () => (__verbose = false),
|
|
45
|
-
},
|
|
46
|
-
};
|
|
47
|
-
const _toVeloEntity = '$';
|
|
48
|
-
const _fromVeloEntity = '$';
|
|
49
|
-
var IdentityType;
|
|
50
|
-
(function (IdentityType) {
|
|
51
|
-
IdentityType["UNSPECIFIED_IDENTITY_TYPE"] = "UNSPECIFIED_IDENTITY_TYPE";
|
|
52
|
-
/** Site member */
|
|
53
|
-
IdentityType["MEMBER"] = "MEMBER";
|
|
54
|
-
/** Contact */
|
|
55
|
-
IdentityType["CONTACT"] = "CONTACT";
|
|
56
|
-
})(IdentityType = exports.IdentityType || (exports.IdentityType = {}));
|
|
57
|
-
var WeightUnit;
|
|
58
|
-
(function (WeightUnit) {
|
|
59
|
-
/** Weight unit can't be classified, due to an error */
|
|
60
|
-
WeightUnit["UNSPECIFIED_WEIGHT_UNIT"] = "UNSPECIFIED_WEIGHT_UNIT";
|
|
61
|
-
/** Kilograms */
|
|
62
|
-
WeightUnit["KG"] = "KG";
|
|
63
|
-
/** Pounds */
|
|
64
|
-
WeightUnit["LB"] = "LB";
|
|
65
|
-
})(WeightUnit = exports.WeightUnit || (exports.WeightUnit = {}));
|
|
66
|
-
/** Brazilian tax info types */
|
|
67
|
-
var VatType;
|
|
68
|
-
(function (VatType) {
|
|
69
|
-
/** When the tax info type can't be classified, due to an error */
|
|
70
|
-
VatType["UNSPECIFIED_TAX_TYPE"] = "UNSPECIFIED_TAX_TYPE";
|
|
71
|
-
/** CPF - for individual tax payers */
|
|
72
|
-
VatType["CPF"] = "CPF";
|
|
73
|
-
/** CNPJ - for corporations */
|
|
74
|
-
VatType["CNPJ"] = "CNPJ";
|
|
75
|
-
})(VatType = exports.VatType || (exports.VatType = {}));
|
|
76
|
-
/** This might be extended in the future with pending orders statuses */
|
|
77
|
-
var PaymentStatus;
|
|
78
|
-
(function (PaymentStatus) {
|
|
79
|
-
/** Payment status can't be classified, due to an error */
|
|
80
|
-
PaymentStatus["UNSPECIFIED_PAYMENT_STATUS"] = "UNSPECIFIED_PAYMENT_STATUS";
|
|
81
|
-
/** Order is pending response from the payment provider */
|
|
82
|
-
PaymentStatus["PENDING"] = "PENDING";
|
|
83
|
-
/** Order is marked as not paid, and can be marked as paid later on. This is relevant for POS and offline orders */
|
|
84
|
-
PaymentStatus["NOT_PAID"] = "NOT_PAID";
|
|
85
|
-
/** The order is marked as paid */
|
|
86
|
-
PaymentStatus["PAID"] = "PAID";
|
|
87
|
-
/** Order was refunded, refund amount less than order total price */
|
|
88
|
-
PaymentStatus["PARTIALLY_REFUNDED"] = "PARTIALLY_REFUNDED";
|
|
89
|
-
/** Full order total price was refunded */
|
|
90
|
-
PaymentStatus["FULLY_REFUNDED"] = "FULLY_REFUNDED";
|
|
91
|
-
/** At least one payment was received and approved, covering less than total price amount */
|
|
92
|
-
PaymentStatus["PARTIALLY_PAID"] = "PARTIALLY_PAID";
|
|
93
|
-
})(PaymentStatus = exports.PaymentStatus || (exports.PaymentStatus = {}));
|
|
94
|
-
var FulfillmentStatus;
|
|
95
|
-
(function (FulfillmentStatus) {
|
|
96
|
-
/** None of the order items are fulfilled */
|
|
97
|
-
FulfillmentStatus["NOT_FULFILLED"] = "NOT_FULFILLED";
|
|
98
|
-
/**
|
|
99
|
-
* All of the order items are fulfilled
|
|
100
|
-
* Orders without shipping info are fulfilled automatically
|
|
101
|
-
*/
|
|
102
|
-
FulfillmentStatus["FULFILLED"] = "FULFILLED";
|
|
103
|
-
/** Order is canceled */
|
|
104
|
-
FulfillmentStatus["CANCELED"] = "CANCELED";
|
|
105
|
-
/** Some, but not all of the order items are fulfilled */
|
|
106
|
-
FulfillmentStatus["PARTIALLY_FULFILLED"] = "PARTIALLY_FULFILLED";
|
|
107
|
-
})(FulfillmentStatus = exports.FulfillmentStatus || (exports.FulfillmentStatus = {}));
|
|
108
|
-
var LineItemType;
|
|
109
|
-
(function (LineItemType) {
|
|
110
|
-
/** Line item type can't be classified, due to an error */
|
|
111
|
-
LineItemType["UNSPECIFIED_LINE_ITEM_TYPE"] = "UNSPECIFIED_LINE_ITEM_TYPE";
|
|
112
|
-
/** Physical item type */
|
|
113
|
-
LineItemType["PHYSICAL"] = "PHYSICAL";
|
|
114
|
-
/** Digital item type */
|
|
115
|
-
LineItemType["DIGITAL"] = "DIGITAL";
|
|
116
|
-
/** Custom item price */
|
|
117
|
-
LineItemType["CUSTOM_AMOUNT_ITEM"] = "CUSTOM_AMOUNT_ITEM";
|
|
118
|
-
})(LineItemType = exports.LineItemType || (exports.LineItemType = {}));
|
|
119
|
-
var MediaItemType;
|
|
120
|
-
(function (MediaItemType) {
|
|
121
|
-
/** Media item type can't be classified, due to an error */
|
|
122
|
-
MediaItemType["UNSPECIFIED_MEDIA_TYPE_ITEM"] = "UNSPECIFIED_MEDIA_TYPE_ITEM";
|
|
123
|
-
/** Image item type */
|
|
124
|
-
MediaItemType["IMAGE"] = "IMAGE";
|
|
125
|
-
})(MediaItemType = exports.MediaItemType || (exports.MediaItemType = {}));
|
|
126
|
-
var ActivityType;
|
|
127
|
-
(function (ActivityType) {
|
|
128
|
-
/** Activity item type can't be classified, due to an error */
|
|
129
|
-
ActivityType["UNSPECIFIED_ORDER_HISTORY_ITEM_TYPE"] = "UNSPECIFIED_ORDER_HISTORY_ITEM_TYPE";
|
|
130
|
-
/** Store owner added a comment */
|
|
131
|
-
ActivityType["MERCHANT_COMMENT"] = "MERCHANT_COMMENT";
|
|
132
|
-
/** Order placed */
|
|
133
|
-
ActivityType["ORDER_PLACED"] = "ORDER_PLACED";
|
|
134
|
-
/** Order marked as paid, either by the store owner (for offline orders), or when an online transaction was confirmed */
|
|
135
|
-
ActivityType["ORDER_PAID"] = "ORDER_PAID";
|
|
136
|
-
/** Order shipping status set as fulfilled */
|
|
137
|
-
ActivityType["ORDER_FULFILLED"] = "ORDER_FULFILLED";
|
|
138
|
-
/** Order shipping status set as not fulfilled */
|
|
139
|
-
ActivityType["ORDER_NOT_FULFILLED"] = "ORDER_NOT_FULFILLED";
|
|
140
|
-
/** A download link was sent (relevant for orders with digital line items) */
|
|
141
|
-
ActivityType["DOWNLOAD_LINK_SENT"] = "DOWNLOAD_LINK_SENT";
|
|
142
|
-
/** An email notification for pickup was sent */
|
|
143
|
-
ActivityType["PICKUP_READY_EMAIL_SENT"] = "PICKUP_READY_EMAIL_SENT";
|
|
144
|
-
/** Shipping tracking number was set */
|
|
145
|
-
ActivityType["TRACKING_NUMBER_ADDED"] = "TRACKING_NUMBER_ADDED";
|
|
146
|
-
/** Shipping tracking number was edited */
|
|
147
|
-
ActivityType["TRACKING_NUMBER_EDITED"] = "TRACKING_NUMBER_EDITED";
|
|
148
|
-
/** Shipping tracking link was set */
|
|
149
|
-
ActivityType["TRACKING_LINK_WAS_SET"] = "TRACKING_LINK_WAS_SET";
|
|
150
|
-
/** An email confirmation of order shipment was sent */
|
|
151
|
-
ActivityType["SHIPPING_CONFIRMATION_EMAIL_SENT"] = "SHIPPING_CONFIRMATION_EMAIL_SENT";
|
|
152
|
-
/** Invoice was set in the order */
|
|
153
|
-
ActivityType["INVOICE_WAS_SET"] = "INVOICE_WAS_SET";
|
|
154
|
-
/** Invoice was removed from the order */
|
|
155
|
-
ActivityType["INVOICE_WAS_REMOVED"] = "INVOICE_WAS_REMOVED";
|
|
156
|
-
/** Invoice was sent to customer via email */
|
|
157
|
-
ActivityType["INVOICE_WAS_SENT"] = "INVOICE_WAS_SENT";
|
|
158
|
-
/** Email was sent to fulfiller */
|
|
159
|
-
ActivityType["FULFILLER_EMAIL_SENT"] = "FULFILLER_EMAIL_SENT";
|
|
160
|
-
/** Shipping address was updated */
|
|
161
|
-
ActivityType["SHIPPING_ADDRESS_EDITED"] = "SHIPPING_ADDRESS_EDITED";
|
|
162
|
-
/** Order email was updated */
|
|
163
|
-
ActivityType["EMAIL_EDITED"] = "EMAIL_EDITED";
|
|
164
|
-
/** Order partially paid. During the checkout for orders with deposit items. */
|
|
165
|
-
ActivityType["ORDER_PARTIALLY_PAID"] = "ORDER_PARTIALLY_PAID";
|
|
166
|
-
})(ActivityType = exports.ActivityType || (exports.ActivityType = {}));
|
|
167
|
-
var InvoiceSource;
|
|
168
|
-
(function (InvoiceSource) {
|
|
169
|
-
/** Invoice source can't be classified, due to an error */
|
|
170
|
-
InvoiceSource["UNSPECIFIED_INVOICE_SOURCE"] = "UNSPECIFIED_INVOICE_SOURCE";
|
|
171
|
-
/** Invoice created using the Invoices API */
|
|
172
|
-
InvoiceSource["WIX"] = "WIX";
|
|
173
|
-
})(InvoiceSource = exports.InvoiceSource || (exports.InvoiceSource = {}));
|
|
174
|
-
var ChannelType;
|
|
175
|
-
(function (ChannelType) {
|
|
176
|
-
ChannelType["UNSPECIFIED"] = "UNSPECIFIED";
|
|
177
|
-
ChannelType["WEB"] = "WEB";
|
|
178
|
-
ChannelType["POS"] = "POS";
|
|
179
|
-
ChannelType["EBAY"] = "EBAY";
|
|
180
|
-
ChannelType["AMAZON"] = "AMAZON";
|
|
181
|
-
ChannelType["OTHER_PLATFORM"] = "OTHER_PLATFORM";
|
|
182
|
-
ChannelType["WIX_APP_STORE"] = "WIX_APP_STORE";
|
|
183
|
-
ChannelType["WIX_INVOICES"] = "WIX_INVOICES";
|
|
184
|
-
ChannelType["BACKOFFICE_MERCHANT"] = "BACKOFFICE_MERCHANT";
|
|
185
|
-
ChannelType["WISH"] = "WISH";
|
|
186
|
-
})(ChannelType = exports.ChannelType || (exports.ChannelType = {}));
|
|
187
|
-
var EnteredByIdentityType;
|
|
188
|
-
(function (EnteredByIdentityType) {
|
|
189
|
-
EnteredByIdentityType["USER"] = "USER";
|
|
190
|
-
EnteredByIdentityType["MEMBER"] = "MEMBER";
|
|
191
|
-
EnteredByIdentityType["CONTACT"] = "CONTACT";
|
|
192
|
-
EnteredByIdentityType["APP"] = "APP";
|
|
193
|
-
})(EnteredByIdentityType = exports.EnteredByIdentityType || (exports.EnteredByIdentityType = {}));
|
|
194
|
-
/** Frequency unit of recurring payment */
|
|
195
|
-
var SubscriptionFrequency;
|
|
196
|
-
(function (SubscriptionFrequency) {
|
|
197
|
-
SubscriptionFrequency["UNDEFINED"] = "UNDEFINED";
|
|
198
|
-
SubscriptionFrequency["DAY"] = "DAY";
|
|
199
|
-
SubscriptionFrequency["WEEK"] = "WEEK";
|
|
200
|
-
SubscriptionFrequency["MONTH"] = "MONTH";
|
|
201
|
-
SubscriptionFrequency["YEAR"] = "YEAR";
|
|
202
|
-
})(SubscriptionFrequency = exports.SubscriptionFrequency || (exports.SubscriptionFrequency = {}));
|
|
203
|
-
/** This may be expanded in the future to include partial fulfillments */
|
|
204
|
-
var ShipmentFulfillmentStatus;
|
|
205
|
-
(function (ShipmentFulfillmentStatus) {
|
|
206
|
-
/** Shipment fulfillment status can't be classified, due to an error */
|
|
207
|
-
ShipmentFulfillmentStatus["UNSPECIFIED_SHIPMENT_FULFILLMENT_STATUS"] = "UNSPECIFIED_SHIPMENT_FULFILLMENT_STATUS";
|
|
208
|
-
/** Entire order's shipment is not fulfilled */
|
|
209
|
-
ShipmentFulfillmentStatus["SHIPMENT_NOT_FULFILLED"] = "SHIPMENT_NOT_FULFILLED";
|
|
210
|
-
/** Entire order's shipment is fulfilled */
|
|
211
|
-
ShipmentFulfillmentStatus["SHIPMENT_FULFILLED"] = "SHIPMENT_FULFILLED";
|
|
212
|
-
})(ShipmentFulfillmentStatus = exports.ShipmentFulfillmentStatus || (exports.ShipmentFulfillmentStatus = {}));
|
|
213
|
-
const _createFulfillmentRequest = {};
|
|
214
|
-
const _createFulfillmentResponse = {};
|
|
215
|
-
const _createOrderRequest = {};
|
|
216
|
-
const _createOrderResponse = {};
|
|
217
|
-
const _deleteFulfillmentRequest = {};
|
|
218
|
-
const _deleteFulfillmentResponse = {};
|
|
219
|
-
const _getOrderRequestV2 = {};
|
|
220
|
-
const _getOrderResponseV2 = {};
|
|
221
|
-
const _queryOrdersRequestV2 = {};
|
|
222
|
-
const _queryOrdersResponseV2 = {};
|
|
223
|
-
const _updateFulfillmentRequest = {};
|
|
224
|
-
const _updateFulfillmentResponse = {};
|
|
225
|
-
const _updateOrderEmailRequest = {};
|
|
226
|
-
const _updateOrderEmailResponse = {};
|
|
227
|
-
const _updateOrderShippingAddressRequest = {};
|
|
228
|
-
const _updateOrderShippingAddressResponse = {};
|
|
229
|
-
/**
|
|
230
|
-
* Creates a new order.
|
|
231
|
-
*
|
|
232
|
-
* > **Notes:**
|
|
233
|
-
* > + Only orders with the `paymentStatus` parameter set as `"PAID"` or `"NOT_PAID"` will show up in the site owner's Stores Orders tab in their dashboard.
|
|
234
|
-
* > + The `billingInfo.paymentProviderTransactionId` and `billingInfo.paymentMethod` parameters can only be passed when paymentStatus is PAID.
|
|
235
|
-
* > + The `billingInfo`.address parameter is required unless `channelInfo.type: "POS"`.
|
|
236
|
-
* > + The `shippingInfo.shipmentDetails.address` parameter is required unless one of the following is true:
|
|
237
|
-
* > + The `shippingInfo.pickupDetails` is passed instead
|
|
238
|
-
* > + `channelInfo.type: "POS"`
|
|
239
|
-
* > + All order items are of type digital - `lineItems.lineItemType: "DIGITAL"`.
|
|
240
|
-
* > + When passing `lineItems.variantId`, `lineItems.options` is required.
|
|
241
|
-
* > + When passing `lineItems.productId`, `lineItem.lineItemType` is limited to `"PHYSICAL"`.
|
|
242
|
-
* > + When not passing `lineItems.productId`, `lineItem.lineItemType` is limited to `"CUSTOM_AMOUNT_ITEM"`.
|
|
243
|
-
* @public
|
|
244
|
-
* @documentationMaturity preview
|
|
245
|
-
* @requiredField order
|
|
246
|
-
* @requiredField order.totals
|
|
247
|
-
*/
|
|
248
|
-
function createOrder(order) {
|
|
249
|
-
var _a, _b, _c;
|
|
250
|
-
return __awaiter(this, arguments, void 0, function* () {
|
|
251
|
-
const requestTransformation = { order: '$[0]' };
|
|
252
|
-
const responseTransformation = '$';
|
|
253
|
-
// @ts-ignore
|
|
254
|
-
const { httpClient, sideEffects } = arguments[1];
|
|
255
|
-
const { toAmbassadorRequest } = (0, velo_1.serializer)({
|
|
256
|
-
rootSchema: _createOrderRequest,
|
|
257
|
-
depSchemas: {},
|
|
258
|
-
fqdnTransformation: {
|
|
259
|
-
paths: [...['order']],
|
|
260
|
-
transformation: _fromVeloEntity,
|
|
261
|
-
},
|
|
262
|
-
customTransformation: requestTransformation,
|
|
263
|
-
});
|
|
264
|
-
const { fromJSON } = (0, velo_1.serializer)({
|
|
265
|
-
rootSchema: _createOrderResponse,
|
|
266
|
-
depSchemas: {},
|
|
267
|
-
fqdnTransformation: {
|
|
268
|
-
paths: [...['order']],
|
|
269
|
-
transformation: _toVeloEntity,
|
|
270
|
-
},
|
|
271
|
-
customTransformation: responseTransformation,
|
|
272
|
-
});
|
|
273
|
-
const payload = toAmbassadorRequest([order]);
|
|
274
|
-
const reqOpts = ambassadorWixStoresV2Orders.createOrder(payload);
|
|
275
|
-
__log(`"CreateOrder" sending request with: ${__inspect(reqOpts)}`);
|
|
276
|
-
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
|
277
|
-
try {
|
|
278
|
-
const result = yield httpClient.request(reqOpts);
|
|
279
|
-
(_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
|
|
280
|
-
return fromJSON(result.data);
|
|
281
|
-
}
|
|
282
|
-
catch (err) {
|
|
283
|
-
const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
|
|
284
|
-
'order',
|
|
285
|
-
]);
|
|
286
|
-
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
|
287
|
-
throw transformedError;
|
|
288
|
-
}
|
|
289
|
-
});
|
|
290
|
-
}
|
|
291
|
-
exports.createOrder = createOrder;
|
|
292
|
-
/**
|
|
293
|
-
* Updates the email address of a specified order's billing info.
|
|
294
|
-
* If shipping was selected as the delivery method, shipping info email will also be updated.
|
|
295
|
-
* @param orderId - Order ID.
|
|
296
|
-
* @public
|
|
297
|
-
* @documentationMaturity preview
|
|
298
|
-
* @requiredField orderId
|
|
299
|
-
*/
|
|
300
|
-
function updateOrderEmail(orderId, options) {
|
|
301
|
-
var _a, _b, _c;
|
|
302
|
-
return __awaiter(this, arguments, void 0, function* () {
|
|
303
|
-
const requestTransformation = { orderId: '$[0]', email: '$[1].email' };
|
|
304
|
-
const responseTransformation = '$';
|
|
305
|
-
// @ts-ignore
|
|
306
|
-
const { httpClient, sideEffects } = arguments[2];
|
|
307
|
-
const { toAmbassadorRequest } = (0, velo_1.serializer)({
|
|
308
|
-
rootSchema: _updateOrderEmailRequest,
|
|
309
|
-
depSchemas: {},
|
|
310
|
-
fqdnTransformation: {
|
|
311
|
-
paths: [],
|
|
312
|
-
transformation: _fromVeloEntity,
|
|
313
|
-
},
|
|
314
|
-
customTransformation: requestTransformation,
|
|
315
|
-
});
|
|
316
|
-
const { fromJSON } = (0, velo_1.serializer)({
|
|
317
|
-
rootSchema: _updateOrderEmailResponse,
|
|
318
|
-
depSchemas: {},
|
|
319
|
-
fqdnTransformation: {
|
|
320
|
-
paths: [...['order']],
|
|
321
|
-
transformation: _toVeloEntity,
|
|
322
|
-
},
|
|
323
|
-
customTransformation: responseTransformation,
|
|
324
|
-
});
|
|
325
|
-
const payload = toAmbassadorRequest([orderId, options]);
|
|
326
|
-
const reqOpts = ambassadorWixStoresV2Orders.updateOrderEmail(payload);
|
|
327
|
-
__log(`"UpdateOrderEmail" sending request with: ${__inspect(reqOpts)}`);
|
|
328
|
-
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
|
329
|
-
try {
|
|
330
|
-
const result = yield httpClient.request(reqOpts);
|
|
331
|
-
(_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
|
|
332
|
-
return fromJSON(result.data);
|
|
333
|
-
}
|
|
334
|
-
catch (err) {
|
|
335
|
-
const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
|
|
336
|
-
'orderId',
|
|
337
|
-
'options',
|
|
338
|
-
]);
|
|
339
|
-
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
|
340
|
-
throw transformedError;
|
|
341
|
-
}
|
|
342
|
-
});
|
|
343
|
-
}
|
|
344
|
-
exports.updateOrderEmail = updateOrderEmail;
|
|
345
|
-
/**
|
|
346
|
-
* Updates the shipping address of a specified order.
|
|
347
|
-
* @param orderId - Order ID.
|
|
348
|
-
* @public
|
|
349
|
-
* @documentationMaturity preview
|
|
350
|
-
* @requiredField orderId
|
|
351
|
-
*/
|
|
352
|
-
function updateOrderShippingAddress(orderId, options) {
|
|
353
|
-
var _a, _b, _c;
|
|
354
|
-
return __awaiter(this, arguments, void 0, function* () {
|
|
355
|
-
const requestTransformation = {
|
|
356
|
-
orderId: '$[0]',
|
|
357
|
-
shippingAddress: '$[1].shippingAddress',
|
|
358
|
-
};
|
|
359
|
-
const responseTransformation = '$';
|
|
360
|
-
// @ts-ignore
|
|
361
|
-
const { httpClient, sideEffects } = arguments[2];
|
|
362
|
-
const { toAmbassadorRequest } = (0, velo_1.serializer)({
|
|
363
|
-
rootSchema: _updateOrderShippingAddressRequest,
|
|
364
|
-
depSchemas: {},
|
|
365
|
-
fqdnTransformation: {
|
|
366
|
-
paths: [],
|
|
367
|
-
transformation: _fromVeloEntity,
|
|
368
|
-
},
|
|
369
|
-
customTransformation: requestTransformation,
|
|
370
|
-
});
|
|
371
|
-
const { fromJSON } = (0, velo_1.serializer)({
|
|
372
|
-
rootSchema: _updateOrderShippingAddressResponse,
|
|
373
|
-
depSchemas: {},
|
|
374
|
-
fqdnTransformation: {
|
|
375
|
-
paths: [...['order']],
|
|
376
|
-
transformation: _toVeloEntity,
|
|
377
|
-
},
|
|
378
|
-
customTransformation: responseTransformation,
|
|
379
|
-
});
|
|
380
|
-
const payload = toAmbassadorRequest([orderId, options]);
|
|
381
|
-
const reqOpts = ambassadorWixStoresV2Orders.updateOrderShippingAddress(payload);
|
|
382
|
-
__log(`"UpdateOrderShippingAddress" sending request with: ${__inspect(reqOpts)}`);
|
|
383
|
-
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
|
384
|
-
try {
|
|
385
|
-
const result = yield httpClient.request(reqOpts);
|
|
386
|
-
(_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
|
|
387
|
-
return fromJSON(result.data);
|
|
388
|
-
}
|
|
389
|
-
catch (err) {
|
|
390
|
-
const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
|
|
391
|
-
'orderId',
|
|
392
|
-
'options',
|
|
393
|
-
]);
|
|
394
|
-
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
|
395
|
-
throw transformedError;
|
|
396
|
-
}
|
|
397
|
-
});
|
|
398
|
-
}
|
|
399
|
-
exports.updateOrderShippingAddress = updateOrderShippingAddress;
|
|
400
|
-
/**
|
|
401
|
-
* Returns an order with the provided ID
|
|
402
|
-
* @param _id - Requested order ID
|
|
403
|
-
* @public
|
|
404
|
-
* @documentationMaturity preview
|
|
405
|
-
* @requiredField _id
|
|
406
|
-
*/
|
|
407
|
-
function getOrder(_id) {
|
|
408
|
-
var _a, _b, _c;
|
|
409
|
-
return __awaiter(this, arguments, void 0, function* () {
|
|
410
|
-
const requestTransformation = { id: '$[0]' };
|
|
411
|
-
const responseTransformation = '$';
|
|
412
|
-
// @ts-ignore
|
|
413
|
-
const { httpClient, sideEffects } = arguments[1];
|
|
414
|
-
const { toAmbassadorRequest } = (0, velo_1.serializer)({
|
|
415
|
-
rootSchema: _getOrderRequestV2,
|
|
416
|
-
depSchemas: {},
|
|
417
|
-
fqdnTransformation: {
|
|
418
|
-
paths: [],
|
|
419
|
-
transformation: _fromVeloEntity,
|
|
420
|
-
},
|
|
421
|
-
customTransformation: requestTransformation,
|
|
422
|
-
});
|
|
423
|
-
const { fromJSON } = (0, velo_1.serializer)({
|
|
424
|
-
rootSchema: _getOrderResponseV2,
|
|
425
|
-
depSchemas: {},
|
|
426
|
-
fqdnTransformation: {
|
|
427
|
-
paths: [...['order']],
|
|
428
|
-
transformation: _toVeloEntity,
|
|
429
|
-
},
|
|
430
|
-
customTransformation: responseTransformation,
|
|
431
|
-
});
|
|
432
|
-
const payload = toAmbassadorRequest([_id]);
|
|
433
|
-
const reqOpts = ambassadorWixStoresV2Orders.getOrder(payload);
|
|
434
|
-
__log(`"GetOrder" sending request with: ${__inspect(reqOpts)}`);
|
|
435
|
-
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
|
436
|
-
try {
|
|
437
|
-
const result = yield httpClient.request(reqOpts);
|
|
438
|
-
(_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
|
|
439
|
-
return fromJSON(result.data);
|
|
440
|
-
}
|
|
441
|
-
catch (err) {
|
|
442
|
-
const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
|
|
443
|
-
'_id',
|
|
444
|
-
]);
|
|
445
|
-
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
|
446
|
-
throw transformedError;
|
|
447
|
-
}
|
|
448
|
-
});
|
|
449
|
-
}
|
|
450
|
-
exports.getOrder = getOrder;
|
|
451
|
-
/**
|
|
452
|
-
* Returns a list of up to 100 orders, given the provided paging, sorting and filters.
|
|
453
|
-
* See [Stores Pagination](https://dev.wix.com/api/rest/wix-stores/pagination) for more information.
|
|
454
|
-
* Hidden orders are not returned
|
|
455
|
-
* @public
|
|
456
|
-
* @documentationMaturity preview
|
|
457
|
-
*/
|
|
458
|
-
function queryOrders(options) {
|
|
459
|
-
var _a, _b, _c;
|
|
460
|
-
return __awaiter(this, arguments, void 0, function* () {
|
|
461
|
-
const requestTransformation = { query: '$[0].query' };
|
|
462
|
-
const responseTransformation = '$';
|
|
463
|
-
// @ts-ignore
|
|
464
|
-
const { httpClient, sideEffects } = arguments[1];
|
|
465
|
-
const { toAmbassadorRequest } = (0, velo_1.serializer)({
|
|
466
|
-
rootSchema: _queryOrdersRequestV2,
|
|
467
|
-
depSchemas: {},
|
|
468
|
-
fqdnTransformation: {
|
|
469
|
-
paths: [],
|
|
470
|
-
transformation: _fromVeloEntity,
|
|
471
|
-
},
|
|
472
|
-
customTransformation: requestTransformation,
|
|
473
|
-
});
|
|
474
|
-
const { fromJSON } = (0, velo_1.serializer)({
|
|
475
|
-
rootSchema: _queryOrdersResponseV2,
|
|
476
|
-
depSchemas: {},
|
|
477
|
-
fqdnTransformation: {
|
|
478
|
-
paths: [...['Array#orders']],
|
|
479
|
-
transformation: _toVeloEntity,
|
|
480
|
-
},
|
|
481
|
-
customTransformation: responseTransformation,
|
|
482
|
-
});
|
|
483
|
-
const payload = toAmbassadorRequest([options]);
|
|
484
|
-
const reqOpts = ambassadorWixStoresV2Orders.queryOrders(payload);
|
|
485
|
-
__log(`"QueryOrders" sending request with: ${__inspect(reqOpts)}`);
|
|
486
|
-
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
|
487
|
-
try {
|
|
488
|
-
const result = yield httpClient.request(reqOpts);
|
|
489
|
-
(_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
|
|
490
|
-
return fromJSON(result.data);
|
|
491
|
-
}
|
|
492
|
-
catch (err) {
|
|
493
|
-
const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
|
|
494
|
-
'options',
|
|
495
|
-
]);
|
|
496
|
-
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
|
497
|
-
throw transformedError;
|
|
498
|
-
}
|
|
499
|
-
});
|
|
500
|
-
}
|
|
501
|
-
exports.queryOrders = queryOrders;
|
|
502
|
-
/**
|
|
503
|
-
* Creates a fulfillment (a subset of an order, with line items that are being shipped together) based on the body parameters passed with the request.
|
|
504
|
-
* If the site owner has requested it, calling this request will trigger an email to the customer (based on the Wix store settings)
|
|
505
|
-
* @param orderId - Order ID (to which the fulfillment will be related).
|
|
506
|
-
* @param fulfillment - Fulfillment info.
|
|
507
|
-
* @public
|
|
508
|
-
* @documentationMaturity preview
|
|
509
|
-
* @requiredField fulfillment
|
|
510
|
-
* @requiredField orderId
|
|
511
|
-
*/
|
|
512
|
-
function createFulfillment(orderId, fulfillment) {
|
|
513
|
-
var _a, _b, _c;
|
|
514
|
-
return __awaiter(this, arguments, void 0, function* () {
|
|
515
|
-
const requestTransformation = { orderId: '$[0]', fulfillment: '$[1]' };
|
|
516
|
-
const responseTransformation = '$';
|
|
517
|
-
// @ts-ignore
|
|
518
|
-
const { httpClient, sideEffects } = arguments[2];
|
|
519
|
-
const { toAmbassadorRequest } = (0, velo_1.serializer)({
|
|
520
|
-
rootSchema: _createFulfillmentRequest,
|
|
521
|
-
depSchemas: {},
|
|
522
|
-
fqdnTransformation: {
|
|
523
|
-
paths: [],
|
|
524
|
-
transformation: _fromVeloEntity,
|
|
525
|
-
},
|
|
526
|
-
customTransformation: requestTransformation,
|
|
527
|
-
});
|
|
528
|
-
const { fromJSON } = (0, velo_1.serializer)({
|
|
529
|
-
rootSchema: _createFulfillmentResponse,
|
|
530
|
-
depSchemas: {},
|
|
531
|
-
fqdnTransformation: {
|
|
532
|
-
paths: [...['order']],
|
|
533
|
-
transformation: _toVeloEntity,
|
|
534
|
-
},
|
|
535
|
-
customTransformation: responseTransformation,
|
|
536
|
-
});
|
|
537
|
-
const payload = toAmbassadorRequest([orderId, fulfillment]);
|
|
538
|
-
const reqOpts = ambassadorWixStoresV2Orders.createFulfillment(payload);
|
|
539
|
-
__log(`"CreateFulfillment" sending request with: ${__inspect(reqOpts)}`);
|
|
540
|
-
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
|
541
|
-
try {
|
|
542
|
-
const result = yield httpClient.request(reqOpts);
|
|
543
|
-
(_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
|
|
544
|
-
return fromJSON(result.data);
|
|
545
|
-
}
|
|
546
|
-
catch (err) {
|
|
547
|
-
const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
|
|
548
|
-
'orderId',
|
|
549
|
-
'fulfillment',
|
|
550
|
-
]);
|
|
551
|
-
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
|
552
|
-
throw transformedError;
|
|
553
|
-
}
|
|
554
|
-
});
|
|
555
|
-
}
|
|
556
|
-
exports.createFulfillment = createFulfillment;
|
|
557
|
-
/**
|
|
558
|
-
* Updates an existing fulfillment
|
|
559
|
-
* @public
|
|
560
|
-
* @documentationMaturity preview
|
|
561
|
-
* @requiredField identifiers
|
|
562
|
-
* @requiredField identifiers.fulfillmentId
|
|
563
|
-
* @requiredField identifiers.orderId
|
|
564
|
-
*/
|
|
565
|
-
function updateFulfillment(identifiers, options) {
|
|
566
|
-
var _a, _b, _c;
|
|
567
|
-
return __awaiter(this, arguments, void 0, function* () {
|
|
568
|
-
const requestTransformation = {
|
|
569
|
-
orderId: '$[0].orderId',
|
|
570
|
-
fulfillmentId: '$[0].fulfillmentId',
|
|
571
|
-
fulfillmentTrackingInfo: '$[1].fulfillmentTrackingInfo',
|
|
572
|
-
};
|
|
573
|
-
const responseTransformation = '$';
|
|
574
|
-
// @ts-ignore
|
|
575
|
-
const { httpClient, sideEffects } = arguments[2];
|
|
576
|
-
const { toAmbassadorRequest } = (0, velo_1.serializer)({
|
|
577
|
-
rootSchema: _updateFulfillmentRequest,
|
|
578
|
-
depSchemas: {},
|
|
579
|
-
fqdnTransformation: {
|
|
580
|
-
paths: [],
|
|
581
|
-
transformation: _fromVeloEntity,
|
|
582
|
-
},
|
|
583
|
-
customTransformation: requestTransformation,
|
|
584
|
-
});
|
|
585
|
-
const { fromJSON } = (0, velo_1.serializer)({
|
|
586
|
-
rootSchema: _updateFulfillmentResponse,
|
|
587
|
-
depSchemas: {},
|
|
588
|
-
fqdnTransformation: {
|
|
589
|
-
paths: [...['order']],
|
|
590
|
-
transformation: _toVeloEntity,
|
|
591
|
-
},
|
|
592
|
-
customTransformation: responseTransformation,
|
|
593
|
-
});
|
|
594
|
-
const payload = toAmbassadorRequest([identifiers, options]);
|
|
595
|
-
const reqOpts = ambassadorWixStoresV2Orders.updateFulfillment(payload);
|
|
596
|
-
__log(`"UpdateFulfillment" sending request with: ${__inspect(reqOpts)}`);
|
|
597
|
-
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
|
598
|
-
try {
|
|
599
|
-
const result = yield httpClient.request(reqOpts);
|
|
600
|
-
(_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
|
|
601
|
-
return fromJSON(result.data);
|
|
602
|
-
}
|
|
603
|
-
catch (err) {
|
|
604
|
-
const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
|
|
605
|
-
'identifiers',
|
|
606
|
-
'options',
|
|
607
|
-
]);
|
|
608
|
-
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
|
609
|
-
throw transformedError;
|
|
610
|
-
}
|
|
611
|
-
});
|
|
612
|
-
}
|
|
613
|
-
exports.updateFulfillment = updateFulfillment;
|
|
614
|
-
/**
|
|
615
|
-
* Deletes an existing fulfillment
|
|
616
|
-
* @public
|
|
617
|
-
* @documentationMaturity preview
|
|
618
|
-
* @requiredField identifiers
|
|
619
|
-
* @requiredField identifiers.fulfillmentId
|
|
620
|
-
* @requiredField identifiers.orderId
|
|
621
|
-
*/
|
|
622
|
-
function deleteFulfillment(identifiers) {
|
|
623
|
-
var _a, _b, _c;
|
|
624
|
-
return __awaiter(this, arguments, void 0, function* () {
|
|
625
|
-
const requestTransformation = {
|
|
626
|
-
orderId: '$[0].orderId',
|
|
627
|
-
fulfillmentId: '$[0].fulfillmentId',
|
|
628
|
-
};
|
|
629
|
-
const responseTransformation = '$';
|
|
630
|
-
// @ts-ignore
|
|
631
|
-
const { httpClient, sideEffects } = arguments[1];
|
|
632
|
-
const { toAmbassadorRequest } = (0, velo_1.serializer)({
|
|
633
|
-
rootSchema: _deleteFulfillmentRequest,
|
|
634
|
-
depSchemas: {},
|
|
635
|
-
fqdnTransformation: {
|
|
636
|
-
paths: [],
|
|
637
|
-
transformation: _fromVeloEntity,
|
|
638
|
-
},
|
|
639
|
-
customTransformation: requestTransformation,
|
|
640
|
-
});
|
|
641
|
-
const { fromJSON } = (0, velo_1.serializer)({
|
|
642
|
-
rootSchema: _deleteFulfillmentResponse,
|
|
643
|
-
depSchemas: {},
|
|
644
|
-
fqdnTransformation: {
|
|
645
|
-
paths: [...['order']],
|
|
646
|
-
transformation: _toVeloEntity,
|
|
647
|
-
},
|
|
648
|
-
customTransformation: responseTransformation,
|
|
649
|
-
});
|
|
650
|
-
const payload = toAmbassadorRequest([identifiers]);
|
|
651
|
-
const reqOpts = ambassadorWixStoresV2Orders.deleteFulfillment(payload);
|
|
652
|
-
__log(`"DeleteFulfillment" sending request with: ${__inspect(reqOpts)}`);
|
|
653
|
-
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
|
654
|
-
try {
|
|
655
|
-
const result = yield httpClient.request(reqOpts);
|
|
656
|
-
(_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
|
|
657
|
-
return fromJSON(result.data);
|
|
658
|
-
}
|
|
659
|
-
catch (err) {
|
|
660
|
-
const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
|
|
661
|
-
'identifiers',
|
|
662
|
-
]);
|
|
663
|
-
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
|
664
|
-
throw transformedError;
|
|
665
|
-
}
|
|
666
|
-
});
|
|
667
|
-
}
|
|
668
|
-
exports.deleteFulfillment = deleteFulfillment;
|
|
669
|
-
//# sourceMappingURL=stores-v2-orders.universal.js.map
|