@wix/stores 1.0.67 → 1.0.69
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/src/stores-catalog-v1-product.http.d.ts +9 -15
- package/build/cjs/src/stores-catalog-v1-product.http.js +9 -63
- package/build/cjs/src/stores-catalog-v1-product.http.js.map +1 -1
- package/build/cjs/src/stores-catalog-v1-product.public.d.ts +14 -16
- package/build/cjs/src/stores-catalog-v1-product.public.js +20 -32
- package/build/cjs/src/stores-catalog-v1-product.public.js.map +1 -1
- package/build/cjs/src/stores-catalog-v1-product.types.d.ts +38 -24
- package/build/cjs/src/stores-catalog-v1-product.types.js.map +1 -1
- package/build/cjs/src/stores-catalog-v1-product.universal.d.ts +141 -148
- package/build/cjs/src/stores-catalog-v1-product.universal.js +122 -186
- package/build/cjs/src/stores-catalog-v1-product.universal.js.map +1 -1
- package/build/es/src/stores-catalog-v1-product.http.d.ts +9 -15
- package/build/es/src/stores-catalog-v1-product.http.js +8 -60
- package/build/es/src/stores-catalog-v1-product.http.js.map +1 -1
- package/build/es/src/stores-catalog-v1-product.public.d.ts +14 -16
- package/build/es/src/stores-catalog-v1-product.public.js +16 -26
- package/build/es/src/stores-catalog-v1-product.public.js.map +1 -1
- package/build/es/src/stores-catalog-v1-product.types.d.ts +38 -24
- package/build/es/src/stores-catalog-v1-product.types.js.map +1 -1
- package/build/es/src/stores-catalog-v1-product.universal.d.ts +141 -148
- package/build/es/src/stores-catalog-v1-product.universal.js +117 -179
- package/build/es/src/stores-catalog-v1-product.universal.js.map +1 -1
- package/package.json +2 -2
|
@@ -113,8 +113,6 @@ const _deleteProductRequest = {};
|
|
|
113
113
|
const _deleteProductResponse = {};
|
|
114
114
|
const _getCollectionBySlugRequest = {};
|
|
115
115
|
const _getCollectionBySlugResponse = {};
|
|
116
|
-
const _getCollectionRequest = {};
|
|
117
|
-
const _getCollectionResponse = {};
|
|
118
116
|
const _getProductRequest = {};
|
|
119
117
|
const _getProductResponse = {};
|
|
120
118
|
const _getStoreVariantRequest = {};
|
|
@@ -125,8 +123,6 @@ const _platformMedia = {
|
|
|
125
123
|
};
|
|
126
124
|
const _productOptionsAvailabilityRequest = {};
|
|
127
125
|
const _productOptionsAvailabilityResponse = {};
|
|
128
|
-
const _queryCollectionsRequest = {};
|
|
129
|
-
const _queryCollectionsResponse = {};
|
|
130
126
|
const _queryProductsPlatformizedRequest = {};
|
|
131
127
|
const _queryProductsPlatformizedResponse = {};
|
|
132
128
|
const _queryProductVariantsRequest = {};
|
|
@@ -154,17 +150,21 @@ const _updateVariantsRequest = {};
|
|
|
154
150
|
const _updateVariantsResponse = {};
|
|
155
151
|
/**
|
|
156
152
|
* Creates a new product.
|
|
153
|
+
*
|
|
154
|
+
* This function is not a universal function and runs only on the backend.
|
|
155
|
+
* @param product - Product information.
|
|
157
156
|
* @public
|
|
158
157
|
* @documentationMaturity preview
|
|
159
|
-
* @requiredField
|
|
160
|
-
* @requiredField
|
|
161
|
-
* @requiredField
|
|
162
|
-
* @requiredField
|
|
158
|
+
* @requiredField product
|
|
159
|
+
* @requiredField product.costAndProfitData.itemCost
|
|
160
|
+
* @requiredField product.name
|
|
161
|
+
* @requiredField product.priceData
|
|
162
|
+
* @requiredField product.priceData.price
|
|
163
163
|
*/
|
|
164
|
-
export function createProduct(
|
|
164
|
+
export function createProduct(product) {
|
|
165
165
|
var _a, _b, _c;
|
|
166
166
|
return __awaiter(this, arguments, void 0, function* () {
|
|
167
|
-
const requestTransformation = { product: '$[0]
|
|
167
|
+
const requestTransformation = { product: '$[0]' };
|
|
168
168
|
const responseTransformation = '$';
|
|
169
169
|
// @ts-ignore
|
|
170
170
|
const { httpClient, sideEffects } = arguments[1];
|
|
@@ -186,7 +186,7 @@ export function createProduct(options) {
|
|
|
186
186
|
},
|
|
187
187
|
customTransformation: responseTransformation,
|
|
188
188
|
});
|
|
189
|
-
const payload = toAmbassadorRequest([
|
|
189
|
+
const payload = toAmbassadorRequest([product]);
|
|
190
190
|
const reqOpts = ambassadorWixStoresCatalogV1Product.createProduct(payload);
|
|
191
191
|
__log(`"CreateProduct" sending request with: ${__inspect(reqOpts)}`);
|
|
192
192
|
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
|
@@ -197,7 +197,7 @@ export function createProduct(options) {
|
|
|
197
197
|
}
|
|
198
198
|
catch (err) {
|
|
199
199
|
const transformedError = transformError(err, requestTransformation, [
|
|
200
|
-
'
|
|
200
|
+
'product',
|
|
201
201
|
]);
|
|
202
202
|
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
|
203
203
|
throw transformedError;
|
|
@@ -206,11 +206,14 @@ export function createProduct(options) {
|
|
|
206
206
|
}
|
|
207
207
|
/**
|
|
208
208
|
* Updates specified fields in a product.
|
|
209
|
+
*
|
|
210
|
+
* This function is not a universal function and runs only on the backend.
|
|
209
211
|
* @param _id - Product ID (generated automatically by the catalog).
|
|
210
212
|
* @public
|
|
211
213
|
* @documentationMaturity preview
|
|
212
214
|
* @requiredField _id
|
|
213
215
|
* @requiredField product
|
|
216
|
+
* @param product - Product info to update.
|
|
214
217
|
*/
|
|
215
218
|
export function updateProduct(_id, product) {
|
|
216
219
|
var _a, _b, _c;
|
|
@@ -258,9 +261,10 @@ export function updateProduct(_id, product) {
|
|
|
258
261
|
}
|
|
259
262
|
/**
|
|
260
263
|
* Deletes a product.
|
|
261
|
-
*
|
|
264
|
+
*
|
|
265
|
+
* This function is not a universal function and runs only on the backend.
|
|
266
|
+
* @param _id - ID of the product to delete.
|
|
262
267
|
* @public
|
|
263
|
-
* @documentationMaturity preview
|
|
264
268
|
* @requiredField _id
|
|
265
269
|
*/
|
|
266
270
|
export function deleteProduct(_id) {
|
|
@@ -308,15 +312,19 @@ export function deleteProduct(_id) {
|
|
|
308
312
|
}
|
|
309
313
|
/**
|
|
310
314
|
* Updates variants of a specified product.
|
|
315
|
+
*
|
|
316
|
+
* This function is not a universal function and runs only on the backend.
|
|
311
317
|
* @param _id - ID of the product with managed variants.
|
|
318
|
+
* @param variants - Variant info to update.
|
|
312
319
|
* @public
|
|
313
320
|
* @documentationMaturity preview
|
|
314
321
|
* @requiredField _id
|
|
322
|
+
* @requiredField variants
|
|
315
323
|
*/
|
|
316
|
-
export function
|
|
324
|
+
export function updateProductVariants(_id, variants) {
|
|
317
325
|
var _a, _b, _c;
|
|
318
326
|
return __awaiter(this, arguments, void 0, function* () {
|
|
319
|
-
const requestTransformation = { id: '$[0]', variants: '$[1]
|
|
327
|
+
const requestTransformation = { id: '$[0]', variants: '$[1]' };
|
|
320
328
|
const responseTransformation = '$';
|
|
321
329
|
// @ts-ignore
|
|
322
330
|
const { httpClient, sideEffects } = arguments[2];
|
|
@@ -338,7 +346,7 @@ export function updateVariants(_id, options) {
|
|
|
338
346
|
},
|
|
339
347
|
customTransformation: responseTransformation,
|
|
340
348
|
});
|
|
341
|
-
const payload = toAmbassadorRequest([_id,
|
|
349
|
+
const payload = toAmbassadorRequest([_id, variants]);
|
|
342
350
|
const reqOpts = ambassadorWixStoresCatalogV1Product.updateVariants(payload);
|
|
343
351
|
__log(`"UpdateVariants" sending request with: ${__inspect(reqOpts)}`);
|
|
344
352
|
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
|
@@ -350,7 +358,7 @@ export function updateVariants(_id, options) {
|
|
|
350
358
|
catch (err) {
|
|
351
359
|
const transformedError = transformError(err, requestTransformation, [
|
|
352
360
|
'_id',
|
|
353
|
-
'
|
|
361
|
+
'variants',
|
|
354
362
|
]);
|
|
355
363
|
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
|
356
364
|
throw transformedError;
|
|
@@ -358,13 +366,15 @@ export function updateVariants(_id, options) {
|
|
|
358
366
|
});
|
|
359
367
|
}
|
|
360
368
|
/**
|
|
361
|
-
* Resets
|
|
369
|
+
* Resets the data (such as the price and the weight) of all variants for a given product to their default values.
|
|
370
|
+
*
|
|
371
|
+
* This function is not a universal function and runs only on the backend.
|
|
362
372
|
* @param _id - Product ID.
|
|
363
373
|
* @public
|
|
364
374
|
* @documentationMaturity preview
|
|
365
375
|
* @requiredField _id
|
|
366
376
|
*/
|
|
367
|
-
export function
|
|
377
|
+
export function resetAllProductVariantData(_id) {
|
|
368
378
|
var _a, _b, _c;
|
|
369
379
|
return __awaiter(this, arguments, void 0, function* () {
|
|
370
380
|
const requestTransformation = { id: '$[0]' };
|
|
@@ -409,15 +419,18 @@ export function resetAllVariantData(_id) {
|
|
|
409
419
|
}
|
|
410
420
|
/**
|
|
411
421
|
* Adds products to a specified collection.
|
|
422
|
+
*
|
|
423
|
+
* This function is not a universal function and runs only on the backend.
|
|
412
424
|
* @param _id - Collection ID. Cannot be used to add products to All Products
|
|
425
|
+
* @param productIds - IDs of the products to add to the collection, separated by commas.
|
|
413
426
|
* @public
|
|
414
|
-
* @documentationMaturity preview
|
|
415
427
|
* @requiredField _id
|
|
428
|
+
* @requiredField productIds
|
|
416
429
|
*/
|
|
417
|
-
export function addProductsToCollection(_id,
|
|
430
|
+
export function addProductsToCollection(_id, productIds) {
|
|
418
431
|
var _a, _b, _c;
|
|
419
432
|
return __awaiter(this, arguments, void 0, function* () {
|
|
420
|
-
const requestTransformation = { id: '$[0]', productIds: '$[1]
|
|
433
|
+
const requestTransformation = { id: '$[0]', productIds: '$[1]' };
|
|
421
434
|
const responseTransformation = '$';
|
|
422
435
|
// @ts-ignore
|
|
423
436
|
const { httpClient, sideEffects } = arguments[2];
|
|
@@ -439,7 +452,7 @@ export function addProductsToCollection(_id, options) {
|
|
|
439
452
|
},
|
|
440
453
|
customTransformation: responseTransformation,
|
|
441
454
|
});
|
|
442
|
-
const payload = toAmbassadorRequest([_id,
|
|
455
|
+
const payload = toAmbassadorRequest([_id, productIds]);
|
|
443
456
|
const reqOpts = ambassadorWixStoresCatalogV1Product.addProductsToCollection(payload);
|
|
444
457
|
__log(`"AddProductsToCollection" sending request with: ${__inspect(reqOpts)}`);
|
|
445
458
|
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
|
@@ -451,7 +464,7 @@ export function addProductsToCollection(_id, options) {
|
|
|
451
464
|
catch (err) {
|
|
452
465
|
const transformedError = transformError(err, requestTransformation, [
|
|
453
466
|
'_id',
|
|
454
|
-
'
|
|
467
|
+
'productIds',
|
|
455
468
|
]);
|
|
456
469
|
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
|
457
470
|
throw transformedError;
|
|
@@ -460,10 +473,11 @@ export function addProductsToCollection(_id, options) {
|
|
|
460
473
|
}
|
|
461
474
|
/**
|
|
462
475
|
* Deletes products from a specified collection.
|
|
463
|
-
*
|
|
464
|
-
*
|
|
476
|
+
*
|
|
477
|
+
* This function is not a universal function and runs only on the backend.
|
|
478
|
+
* @param _id - ID of the collection from which to remove products.
|
|
479
|
+
* @param productIds - IDs of the products to remove from the collection.
|
|
465
480
|
* @public
|
|
466
|
-
* @documentationMaturity preview
|
|
467
481
|
* @requiredField _id
|
|
468
482
|
* @requiredField productIds
|
|
469
483
|
*/
|
|
@@ -513,15 +527,20 @@ export function removeProductsFromCollection(_id, productIds) {
|
|
|
513
527
|
}
|
|
514
528
|
/**
|
|
515
529
|
* Adds media items to a specified product, either via URL or existing media ID.
|
|
530
|
+
*
|
|
531
|
+
* > **NOTE:** The URL is not validated and no event is triggered to indicate if the media was added successfully.
|
|
532
|
+
*
|
|
533
|
+
* This function is not a universal function and runs only on the backend.
|
|
516
534
|
* @param _id - Product ID.
|
|
535
|
+
* @param media - Sources of media items already uploaded to the Wix site.
|
|
517
536
|
* @public
|
|
518
|
-
* @documentationMaturity preview
|
|
519
537
|
* @requiredField _id
|
|
538
|
+
* @requiredField media
|
|
520
539
|
*/
|
|
521
|
-
export function addProductMedia(_id,
|
|
540
|
+
export function addProductMedia(_id, media) {
|
|
522
541
|
var _a, _b, _c;
|
|
523
542
|
return __awaiter(this, arguments, void 0, function* () {
|
|
524
|
-
const requestTransformation = { id: '$[0]', media: '$[1]
|
|
543
|
+
const requestTransformation = { id: '$[0]', media: '$[1]' };
|
|
525
544
|
const responseTransformation = '$';
|
|
526
545
|
// @ts-ignore
|
|
527
546
|
const { httpClient, sideEffects } = arguments[2];
|
|
@@ -543,7 +562,7 @@ export function addProductMedia(_id, options) {
|
|
|
543
562
|
},
|
|
544
563
|
customTransformation: responseTransformation,
|
|
545
564
|
});
|
|
546
|
-
const payload = toAmbassadorRequest([_id,
|
|
565
|
+
const payload = toAmbassadorRequest([_id, media]);
|
|
547
566
|
const reqOpts = ambassadorWixStoresCatalogV1Product.addProductMedia(payload);
|
|
548
567
|
__log(`"AddProductMedia" sending request with: ${__inspect(reqOpts)}`);
|
|
549
568
|
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
|
@@ -555,7 +574,7 @@ export function addProductMedia(_id, options) {
|
|
|
555
574
|
catch (err) {
|
|
556
575
|
const transformedError = transformError(err, requestTransformation, [
|
|
557
576
|
'_id',
|
|
558
|
-
'
|
|
577
|
+
'media',
|
|
559
578
|
]);
|
|
560
579
|
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
|
561
580
|
throw transformedError;
|
|
@@ -565,15 +584,18 @@ export function addProductMedia(_id, options) {
|
|
|
565
584
|
/**
|
|
566
585
|
* Removes specified media items from a product.
|
|
567
586
|
* Pass an empty array to remove all media items.
|
|
587
|
+
*
|
|
588
|
+
* This function is not a universal function and runs only on the backend.
|
|
568
589
|
* @param _id - Product ID.
|
|
590
|
+
* @param mediaIds - List of media IDs to remove. Pass an empty array to delete all media items for the product.
|
|
569
591
|
* @public
|
|
570
|
-
* @documentationMaturity preview
|
|
571
592
|
* @requiredField _id
|
|
593
|
+
* @requiredField mediaIds
|
|
572
594
|
*/
|
|
573
|
-
export function removeProductMedia(_id,
|
|
595
|
+
export function removeProductMedia(_id, mediaIds) {
|
|
574
596
|
var _a, _b, _c;
|
|
575
597
|
return __awaiter(this, arguments, void 0, function* () {
|
|
576
|
-
const requestTransformation = { id: '$[0]', mediaIds: '$[1]
|
|
598
|
+
const requestTransformation = { id: '$[0]', mediaIds: '$[1]' };
|
|
577
599
|
const responseTransformation = '$';
|
|
578
600
|
// @ts-ignore
|
|
579
601
|
const { httpClient, sideEffects } = arguments[2];
|
|
@@ -595,7 +617,7 @@ export function removeProductMedia(_id, options) {
|
|
|
595
617
|
},
|
|
596
618
|
customTransformation: responseTransformation,
|
|
597
619
|
});
|
|
598
|
-
const payload = toAmbassadorRequest([_id,
|
|
620
|
+
const payload = toAmbassadorRequest([_id, mediaIds]);
|
|
599
621
|
const reqOpts = ambassadorWixStoresCatalogV1Product.removeProductMedia(payload);
|
|
600
622
|
__log(`"RemoveProductMedia" sending request with: ${__inspect(reqOpts)}`);
|
|
601
623
|
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
|
@@ -607,7 +629,7 @@ export function removeProductMedia(_id, options) {
|
|
|
607
629
|
catch (err) {
|
|
608
630
|
const transformedError = transformError(err, requestTransformation, [
|
|
609
631
|
'_id',
|
|
610
|
-
'
|
|
632
|
+
'mediaIds',
|
|
611
633
|
]);
|
|
612
634
|
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
|
613
635
|
throw transformedError;
|
|
@@ -620,17 +642,20 @@ export function removeProductMedia(_id, options) {
|
|
|
620
642
|
* Media items can only be set for choices within one option at a time - e.g., if you set media items for some or all of the choices within the Colors option (blue, green, and red), you won't be able to also assign media items to choices within the Size option (S, M, and L).
|
|
621
643
|
*
|
|
622
644
|
* To remove all existing media items, call the [Remove Product Media From Choices](https://dev.wix.com/api/rest/wix-stores/catalog/products/remove-product-media-from-choices) endpoint.
|
|
645
|
+
*
|
|
646
|
+
* This function is not a universal function and runs only on the backend.
|
|
623
647
|
* @param _id - Product ID.
|
|
648
|
+
* @param media - Product media items and the choices to add the media to.
|
|
624
649
|
* @public
|
|
625
|
-
* @documentationMaturity preview
|
|
626
650
|
* @requiredField _id
|
|
627
|
-
* @requiredField
|
|
628
|
-
* @requiredField
|
|
651
|
+
* @requiredField media
|
|
652
|
+
* @requiredField media.choice
|
|
653
|
+
* @requiredField media.option
|
|
629
654
|
*/
|
|
630
|
-
export function addProductMediaToChoices(_id,
|
|
655
|
+
export function addProductMediaToChoices(_id, media) {
|
|
631
656
|
var _a, _b, _c;
|
|
632
657
|
return __awaiter(this, arguments, void 0, function* () {
|
|
633
|
-
const requestTransformation = { id: '$[0]', media: '$[1]
|
|
658
|
+
const requestTransformation = { id: '$[0]', media: '$[1]' };
|
|
634
659
|
const responseTransformation = '$';
|
|
635
660
|
// @ts-ignore
|
|
636
661
|
const { httpClient, sideEffects } = arguments[2];
|
|
@@ -652,7 +677,7 @@ export function addProductMediaToChoices(_id, options) {
|
|
|
652
677
|
},
|
|
653
678
|
customTransformation: responseTransformation,
|
|
654
679
|
});
|
|
655
|
-
const payload = toAmbassadorRequest([_id,
|
|
680
|
+
const payload = toAmbassadorRequest([_id, media]);
|
|
656
681
|
const reqOpts = ambassadorWixStoresCatalogV1Product.addProductMediaToChoices(payload);
|
|
657
682
|
__log(`"AddProductMediaToChoices" sending request with: ${__inspect(reqOpts)}`);
|
|
658
683
|
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
|
@@ -664,7 +689,7 @@ export function addProductMediaToChoices(_id, options) {
|
|
|
664
689
|
catch (err) {
|
|
665
690
|
const transformedError = transformError(err, requestTransformation, [
|
|
666
691
|
'_id',
|
|
667
|
-
'
|
|
692
|
+
'media',
|
|
668
693
|
]);
|
|
669
694
|
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
|
670
695
|
throw transformedError;
|
|
@@ -674,15 +699,18 @@ export function addProductMediaToChoices(_id, options) {
|
|
|
674
699
|
/**
|
|
675
700
|
* Removes media items from all or some of a product's choices.
|
|
676
701
|
* (Media items can only be set for choices within one option at a time - e.g., if you set media items for some or all of the choices within the Colors option (blue, green, and red), you won't be able to also assign media items to choices within the Size option (S, M, and L).)
|
|
677
|
-
*
|
|
702
|
+
*
|
|
703
|
+
* This function is not a universal function and runs only on the backend.
|
|
704
|
+
* @param _id - Product ID from whose choices to remove media items.
|
|
705
|
+
* @param media - Media to remove from choices. If an empty array is passed, all media will be removed from all choices for the given product.
|
|
678
706
|
* @public
|
|
679
|
-
* @documentationMaturity preview
|
|
680
707
|
* @requiredField _id
|
|
708
|
+
* @requiredField media
|
|
681
709
|
*/
|
|
682
|
-
export function removeProductMediaFromChoices(_id,
|
|
710
|
+
export function removeProductMediaFromChoices(_id, media) {
|
|
683
711
|
var _a, _b, _c;
|
|
684
712
|
return __awaiter(this, arguments, void 0, function* () {
|
|
685
|
-
const requestTransformation = { id: '$[0]', media: '$[1]
|
|
713
|
+
const requestTransformation = { id: '$[0]', media: '$[1]' };
|
|
686
714
|
const responseTransformation = '$';
|
|
687
715
|
// @ts-ignore
|
|
688
716
|
const { httpClient, sideEffects } = arguments[2];
|
|
@@ -704,7 +732,7 @@ export function removeProductMediaFromChoices(_id, options) {
|
|
|
704
732
|
},
|
|
705
733
|
customTransformation: responseTransformation,
|
|
706
734
|
});
|
|
707
|
-
const payload = toAmbassadorRequest([_id,
|
|
735
|
+
const payload = toAmbassadorRequest([_id, media]);
|
|
708
736
|
const reqOpts = ambassadorWixStoresCatalogV1Product.removeProductMediaFromChoices(payload);
|
|
709
737
|
__log(`"RemoveProductMediaFromChoices" sending request with: ${__inspect(reqOpts)}`);
|
|
710
738
|
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
|
@@ -716,7 +744,7 @@ export function removeProductMediaFromChoices(_id, options) {
|
|
|
716
744
|
catch (err) {
|
|
717
745
|
const transformedError = transformError(err, requestTransformation, [
|
|
718
746
|
'_id',
|
|
719
|
-
'
|
|
747
|
+
'media',
|
|
720
748
|
]);
|
|
721
749
|
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
|
722
750
|
throw transformedError;
|
|
@@ -724,10 +752,11 @@ export function removeProductMediaFromChoices(_id, options) {
|
|
|
724
752
|
});
|
|
725
753
|
}
|
|
726
754
|
/**
|
|
727
|
-
* Delete all options from a specific product
|
|
728
|
-
*
|
|
755
|
+
* Delete all options from a specific product. Only available when [variant management](https://support.wix.com/en/article/wix-stores-adding-and-customizing-product-options#setting-different-prices-for-variants) is disabled.
|
|
756
|
+
*
|
|
757
|
+
* This function is not a universal function and runs only on the backend.
|
|
758
|
+
* @param _id - ID of the product with options to delete.
|
|
729
759
|
* @public
|
|
730
|
-
* @documentationMaturity preview
|
|
731
760
|
* @requiredField _id
|
|
732
761
|
*/
|
|
733
762
|
export function deleteProductOptions(_id) {
|
|
@@ -775,6 +804,8 @@ export function deleteProductOptions(_id) {
|
|
|
775
804
|
}
|
|
776
805
|
/**
|
|
777
806
|
* Deletes a product's brand.
|
|
807
|
+
*
|
|
808
|
+
* This function is not a universal function and runs only on the backend.
|
|
778
809
|
* @param _id - Product ID.
|
|
779
810
|
* @public
|
|
780
811
|
* @documentationMaturity preview
|
|
@@ -825,6 +856,8 @@ export function removeBrand(_id) {
|
|
|
825
856
|
}
|
|
826
857
|
/**
|
|
827
858
|
* Creates a new collection.
|
|
859
|
+
*
|
|
860
|
+
* This function is not a universal function and runs only on the backend.
|
|
828
861
|
* @param collection - Collection info.
|
|
829
862
|
* @public
|
|
830
863
|
* @documentationMaturity preview
|
|
@@ -875,13 +908,15 @@ export function createCollection(collection) {
|
|
|
875
908
|
});
|
|
876
909
|
}
|
|
877
910
|
/**
|
|
878
|
-
* Updates specified properties of a collection.
|
|
879
|
-
*
|
|
911
|
+
* Updates specified properties of a collection. To add products to a collection, call the [addProductsToCollection](#addproductstocollection) function.
|
|
912
|
+
*
|
|
913
|
+
* This function is not a universal function and runs only on the backend.
|
|
880
914
|
* @param _id - Collection ID (generated automatically by the catalog).
|
|
881
915
|
* @public
|
|
882
916
|
* @documentationMaturity preview
|
|
883
917
|
* @requiredField _id
|
|
884
918
|
* @requiredField collection
|
|
919
|
+
* @param collection - Collection info to update.
|
|
885
920
|
*/
|
|
886
921
|
export function updateCollection(_id, collection) {
|
|
887
922
|
var _a, _b, _c;
|
|
@@ -929,10 +964,12 @@ export function updateCollection(_id, collection) {
|
|
|
929
964
|
}
|
|
930
965
|
/**
|
|
931
966
|
* Deletes a collection.
|
|
932
|
-
*
|
|
967
|
+
*
|
|
968
|
+
* This function is not a universal function and runs only on the backend.
|
|
933
969
|
* @public
|
|
934
970
|
* @documentationMaturity preview
|
|
935
971
|
* @requiredField _id
|
|
972
|
+
* @param _id - ID of the collection to delete.
|
|
936
973
|
*/
|
|
937
974
|
export function deleteCollection(_id) {
|
|
938
975
|
var _a, _b, _c;
|
|
@@ -979,6 +1016,8 @@ export function deleteCollection(_id) {
|
|
|
979
1016
|
}
|
|
980
1017
|
/**
|
|
981
1018
|
* Deletes a product's ribbon.
|
|
1019
|
+
*
|
|
1020
|
+
* This function is not a universal function and runs only on the backend.
|
|
982
1021
|
* @param _id - Product ID.
|
|
983
1022
|
* @public
|
|
984
1023
|
* @documentationMaturity preview
|
|
@@ -1030,14 +1069,16 @@ export function removeRibbon(_id) {
|
|
|
1030
1069
|
/**
|
|
1031
1070
|
* Updates a specified property for up to 100 products at a time.
|
|
1032
1071
|
* @param ids - Product IDs.
|
|
1072
|
+
* @param set - Field to update.
|
|
1033
1073
|
* @public
|
|
1034
1074
|
* @documentationMaturity preview
|
|
1035
1075
|
* @requiredField ids
|
|
1076
|
+
* @requiredField set
|
|
1036
1077
|
*/
|
|
1037
|
-
export function
|
|
1078
|
+
export function bulkUpdateProductsProperty(ids, set) {
|
|
1038
1079
|
var _a, _b, _c;
|
|
1039
1080
|
return __awaiter(this, arguments, void 0, function* () {
|
|
1040
|
-
const requestTransformation = { ids: '$[0]', set: '$[1]
|
|
1081
|
+
const requestTransformation = { ids: '$[0]', set: '$[1]' };
|
|
1041
1082
|
const responseTransformation = '$';
|
|
1042
1083
|
// @ts-ignore
|
|
1043
1084
|
const { httpClient, sideEffects } = arguments[2];
|
|
@@ -1059,7 +1100,7 @@ export function bulkUpdateProducts(ids, options) {
|
|
|
1059
1100
|
},
|
|
1060
1101
|
customTransformation: responseTransformation,
|
|
1061
1102
|
});
|
|
1062
|
-
const payload = toAmbassadorRequest([ids,
|
|
1103
|
+
const payload = toAmbassadorRequest([ids, set]);
|
|
1063
1104
|
const reqOpts = ambassadorWixStoresCatalogV1Product.bulkUpdateProducts(payload);
|
|
1064
1105
|
__log(`"BulkUpdateProducts" sending request with: ${__inspect(reqOpts)}`);
|
|
1065
1106
|
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
|
@@ -1071,7 +1112,7 @@ export function bulkUpdateProducts(ids, options) {
|
|
|
1071
1112
|
catch (err) {
|
|
1072
1113
|
const transformedError = transformError(err, requestTransformation, [
|
|
1073
1114
|
'ids',
|
|
1074
|
-
'
|
|
1115
|
+
'set',
|
|
1075
1116
|
]);
|
|
1076
1117
|
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
|
1077
1118
|
throw transformedError;
|
|
@@ -1081,15 +1122,17 @@ export function bulkUpdateProducts(ids, options) {
|
|
|
1081
1122
|
/**
|
|
1082
1123
|
* Adjusts a specified numerical property for up to 100 products at a time.
|
|
1083
1124
|
* The property can be increased or decreased either by percentage or amount.
|
|
1125
|
+
* @param adjust - Numerical property to adjust.
|
|
1084
1126
|
* @param ids - Product IDs.
|
|
1085
1127
|
* @public
|
|
1086
1128
|
* @documentationMaturity preview
|
|
1129
|
+
* @requiredField adjust
|
|
1087
1130
|
* @requiredField ids
|
|
1088
1131
|
*/
|
|
1089
|
-
export function
|
|
1132
|
+
export function bulkAdjustProductProperty(adjust, ids) {
|
|
1090
1133
|
var _a, _b, _c;
|
|
1091
1134
|
return __awaiter(this, arguments, void 0, function* () {
|
|
1092
|
-
const requestTransformation = {
|
|
1135
|
+
const requestTransformation = { adjust: '$[0]', ids: '$[1]' };
|
|
1093
1136
|
const responseTransformation = '$';
|
|
1094
1137
|
// @ts-ignore
|
|
1095
1138
|
const { httpClient, sideEffects } = arguments[2];
|
|
@@ -1111,7 +1154,7 @@ export function bulkAdjustProductProperties(ids, options) {
|
|
|
1111
1154
|
},
|
|
1112
1155
|
customTransformation: responseTransformation,
|
|
1113
1156
|
});
|
|
1114
|
-
const payload = toAmbassadorRequest([
|
|
1157
|
+
const payload = toAmbassadorRequest([adjust, ids]);
|
|
1115
1158
|
const reqOpts = ambassadorWixStoresCatalogV1Product.bulkAdjustProductProperties(payload);
|
|
1116
1159
|
__log(`"BulkAdjustProductProperties" sending request with: ${__inspect(reqOpts)}`);
|
|
1117
1160
|
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
|
@@ -1122,8 +1165,8 @@ export function bulkAdjustProductProperties(ids, options) {
|
|
|
1122
1165
|
}
|
|
1123
1166
|
catch (err) {
|
|
1124
1167
|
const transformedError = transformError(err, requestTransformation, [
|
|
1168
|
+
'adjust',
|
|
1125
1169
|
'ids',
|
|
1126
|
-
'options',
|
|
1127
1170
|
]);
|
|
1128
1171
|
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
|
1129
1172
|
throw transformedError;
|
|
@@ -1240,118 +1283,10 @@ export function getProduct(_id, options) {
|
|
|
1240
1283
|
}
|
|
1241
1284
|
});
|
|
1242
1285
|
}
|
|
1243
|
-
/**
|
|
1244
|
-
* Retrieves a list of up to 100 collections, given the provided paging, sorting and filtering.
|
|
1245
|
-
* See [Stores Pagination](https://dev.wix.com/api/rest/wix-stores/pagination) for more information.
|
|
1246
|
-
* @public
|
|
1247
|
-
* @documentationMaturity preview
|
|
1248
|
-
*/
|
|
1249
|
-
export function queryCollections(options) {
|
|
1250
|
-
var _a, _b, _c;
|
|
1251
|
-
return __awaiter(this, arguments, void 0, function* () {
|
|
1252
|
-
const requestTransformation = {
|
|
1253
|
-
query: '$[0].query',
|
|
1254
|
-
includeNumberOfProducts: '$[0].includeNumberOfProducts',
|
|
1255
|
-
includeDescription: '$[0].includeDescription',
|
|
1256
|
-
};
|
|
1257
|
-
const responseTransformation = '$';
|
|
1258
|
-
// @ts-ignore
|
|
1259
|
-
const { httpClient, sideEffects } = arguments[1];
|
|
1260
|
-
const { toAmbassadorRequest } = serializer({
|
|
1261
|
-
rootSchema: _queryCollectionsRequest,
|
|
1262
|
-
depSchemas: {},
|
|
1263
|
-
fqdnTransformation: {
|
|
1264
|
-
paths: [],
|
|
1265
|
-
transformation: _fromVeloEntity,
|
|
1266
|
-
},
|
|
1267
|
-
customTransformation: requestTransformation,
|
|
1268
|
-
});
|
|
1269
|
-
const { fromJSON } = serializer({
|
|
1270
|
-
rootSchema: _queryCollectionsResponse,
|
|
1271
|
-
depSchemas: {},
|
|
1272
|
-
fqdnTransformation: {
|
|
1273
|
-
paths: [],
|
|
1274
|
-
transformation: _toVeloEntity,
|
|
1275
|
-
},
|
|
1276
|
-
customTransformation: responseTransformation,
|
|
1277
|
-
});
|
|
1278
|
-
const payload = toAmbassadorRequest([options]);
|
|
1279
|
-
const reqOpts = ambassadorWixStoresCatalogV1Product.queryCollections(payload);
|
|
1280
|
-
__log(`"QueryCollections" sending request with: ${__inspect(reqOpts)}`);
|
|
1281
|
-
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
|
1282
|
-
try {
|
|
1283
|
-
const result = yield httpClient.request(reqOpts);
|
|
1284
|
-
(_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
|
|
1285
|
-
return fromJSON(result.data);
|
|
1286
|
-
}
|
|
1287
|
-
catch (err) {
|
|
1288
|
-
const transformedError = transformError(err, requestTransformation, [
|
|
1289
|
-
'options',
|
|
1290
|
-
]);
|
|
1291
|
-
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
|
1292
|
-
throw transformedError;
|
|
1293
|
-
}
|
|
1294
|
-
});
|
|
1295
|
-
}
|
|
1296
|
-
/**
|
|
1297
|
-
* Retrieves a collection with the provided ID.
|
|
1298
|
-
* @param _id - Requested collection ID.
|
|
1299
|
-
* @public
|
|
1300
|
-
* @documentationMaturity preview
|
|
1301
|
-
* @requiredField _id
|
|
1302
|
-
*/
|
|
1303
|
-
export function getCollection(_id, options) {
|
|
1304
|
-
var _a, _b, _c;
|
|
1305
|
-
return __awaiter(this, arguments, void 0, function* () {
|
|
1306
|
-
const requestTransformation = {
|
|
1307
|
-
id: '$[0]',
|
|
1308
|
-
includeNumberOfProducts: '$[1].includeNumberOfProducts',
|
|
1309
|
-
};
|
|
1310
|
-
const responseTransformation = '$';
|
|
1311
|
-
// @ts-ignore
|
|
1312
|
-
const { httpClient, sideEffects } = arguments[2];
|
|
1313
|
-
const { toAmbassadorRequest } = serializer({
|
|
1314
|
-
rootSchema: _getCollectionRequest,
|
|
1315
|
-
depSchemas: {},
|
|
1316
|
-
fqdnTransformation: {
|
|
1317
|
-
paths: [],
|
|
1318
|
-
transformation: _fromVeloEntity,
|
|
1319
|
-
},
|
|
1320
|
-
customTransformation: requestTransformation,
|
|
1321
|
-
});
|
|
1322
|
-
const { fromJSON } = serializer({
|
|
1323
|
-
rootSchema: _getCollectionResponse,
|
|
1324
|
-
depSchemas: {},
|
|
1325
|
-
fqdnTransformation: {
|
|
1326
|
-
paths: [],
|
|
1327
|
-
transformation: _toVeloEntity,
|
|
1328
|
-
},
|
|
1329
|
-
customTransformation: responseTransformation,
|
|
1330
|
-
});
|
|
1331
|
-
const payload = toAmbassadorRequest([_id, options]);
|
|
1332
|
-
const reqOpts = ambassadorWixStoresCatalogV1Product.getCollection(payload);
|
|
1333
|
-
__log(`"GetCollection" sending request with: ${__inspect(reqOpts)}`);
|
|
1334
|
-
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
|
1335
|
-
try {
|
|
1336
|
-
const result = yield httpClient.request(reqOpts);
|
|
1337
|
-
(_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
|
|
1338
|
-
return fromJSON(result.data);
|
|
1339
|
-
}
|
|
1340
|
-
catch (err) {
|
|
1341
|
-
const transformedError = transformError(err, requestTransformation, [
|
|
1342
|
-
'_id',
|
|
1343
|
-
'options',
|
|
1344
|
-
]);
|
|
1345
|
-
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
|
1346
|
-
throw transformedError;
|
|
1347
|
-
}
|
|
1348
|
-
});
|
|
1349
|
-
}
|
|
1350
1286
|
/**
|
|
1351
1287
|
* Retrieves a collection with the provided slug.
|
|
1352
1288
|
* @param slug - Slug of the collection to retrieve.
|
|
1353
1289
|
* @public
|
|
1354
|
-
* @documentationMaturity preview
|
|
1355
1290
|
* @requiredField slug
|
|
1356
1291
|
*/
|
|
1357
1292
|
export function getCollectionBySlug(slug) {
|
|
@@ -1400,14 +1335,15 @@ export function getCollectionBySlug(slug) {
|
|
|
1400
1335
|
/**
|
|
1401
1336
|
* Gets the availability of relevant product variants based on the product ID and selections provided. See [Use Cases](https://dev.wix.com/api/rest/wix-stores/catalog/use-cases) for an example.
|
|
1402
1337
|
* @param _id - Requested product ID.
|
|
1338
|
+
* @param options - Set of key-value pairs. Array containing the selected options (e.g, color: Blue, size: Large).
|
|
1403
1339
|
* @public
|
|
1404
|
-
* @documentationMaturity preview
|
|
1405
1340
|
* @requiredField _id
|
|
1341
|
+
* @requiredField options
|
|
1406
1342
|
*/
|
|
1407
1343
|
export function getProductOptionsAvailability(_id, options) {
|
|
1408
1344
|
var _a, _b, _c;
|
|
1409
1345
|
return __awaiter(this, arguments, void 0, function* () {
|
|
1410
|
-
const requestTransformation = { id: '$[0]', options: '$[1]
|
|
1346
|
+
const requestTransformation = { id: '$[0]', options: '$[1]' };
|
|
1411
1347
|
const responseTransformation = '$';
|
|
1412
1348
|
// @ts-ignore
|
|
1413
1349
|
const { httpClient, sideEffects } = arguments[2];
|
|
@@ -1508,13 +1444,15 @@ export function queryProductVariants(_id, options) {
|
|
|
1508
1444
|
}
|
|
1509
1445
|
/**
|
|
1510
1446
|
* Retrieves up to 100 store variants, given the provided paging, filtering, and sorting.
|
|
1447
|
+
* @param query - Query options.
|
|
1511
1448
|
* @public
|
|
1512
1449
|
* @documentationMaturity preview
|
|
1450
|
+
* @requiredField query
|
|
1513
1451
|
*/
|
|
1514
|
-
export function queryStoreVariants(
|
|
1452
|
+
export function queryStoreVariants(query) {
|
|
1515
1453
|
var _a, _b, _c;
|
|
1516
1454
|
return __awaiter(this, arguments, void 0, function* () {
|
|
1517
|
-
const requestTransformation = { query: '$[0]
|
|
1455
|
+
const requestTransformation = { query: '$[0]' };
|
|
1518
1456
|
const responseTransformation = '$';
|
|
1519
1457
|
// @ts-ignore
|
|
1520
1458
|
const { httpClient, sideEffects } = arguments[1];
|
|
@@ -1536,7 +1474,7 @@ export function queryStoreVariants(options) {
|
|
|
1536
1474
|
},
|
|
1537
1475
|
customTransformation: responseTransformation,
|
|
1538
1476
|
});
|
|
1539
|
-
const payload = toAmbassadorRequest([
|
|
1477
|
+
const payload = toAmbassadorRequest([query]);
|
|
1540
1478
|
const reqOpts = ambassadorWixStoresCatalogV1Product.queryStoreVariants(payload);
|
|
1541
1479
|
__log(`"QueryStoreVariants" sending request with: ${__inspect(reqOpts)}`);
|
|
1542
1480
|
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
|
@@ -1547,7 +1485,7 @@ export function queryStoreVariants(options) {
|
|
|
1547
1485
|
}
|
|
1548
1486
|
catch (err) {
|
|
1549
1487
|
const transformedError = transformError(err, requestTransformation, [
|
|
1550
|
-
'
|
|
1488
|
+
'query',
|
|
1551
1489
|
]);
|
|
1552
1490
|
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
|
1553
1491
|
throw transformedError;
|