@wix/stores 1.0.67 → 1.0.68
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 +8 -7
- package/build/cjs/src/stores-catalog-v1-product.http.js +8 -7
- 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 -14
- package/build/cjs/src/stores-catalog-v1-product.public.js +18 -18
- package/build/cjs/src/stores-catalog-v1-product.public.js.map +1 -1
- package/build/cjs/src/stores-catalog-v1-product.types.d.ts +37 -23
- package/build/cjs/src/stores-catalog-v1-product.types.js.map +1 -1
- package/build/cjs/src/stores-catalog-v1-product.universal.d.ts +150 -121
- package/build/cjs/src/stores-catalog-v1-product.universal.js +125 -78
- package/build/cjs/src/stores-catalog-v1-product.universal.js.map +1 -1
- package/build/es/src/stores-catalog-v1-product.http.d.ts +8 -7
- package/build/es/src/stores-catalog-v1-product.http.js +8 -7
- 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 -14
- package/build/es/src/stores-catalog-v1-product.public.js +15 -15
- package/build/es/src/stores-catalog-v1-product.public.js.map +1 -1
- package/build/es/src/stores-catalog-v1-product.types.d.ts +37 -23
- package/build/es/src/stores-catalog-v1-product.types.js.map +1 -1
- package/build/es/src/stores-catalog-v1-product.universal.d.ts +150 -121
- package/build/es/src/stores-catalog-v1-product.universal.js +121 -74
- package/build/es/src/stores-catalog-v1-product.universal.js.map +1 -1
- package/package.json +2 -2
|
@@ -154,17 +154,21 @@ const _updateVariantsRequest = {};
|
|
|
154
154
|
const _updateVariantsResponse = {};
|
|
155
155
|
/**
|
|
156
156
|
* Creates a new product.
|
|
157
|
+
*
|
|
158
|
+
* This function is not a universal function and runs only on the backend.
|
|
159
|
+
* @param product - Product information.
|
|
157
160
|
* @public
|
|
158
161
|
* @documentationMaturity preview
|
|
159
|
-
* @requiredField
|
|
160
|
-
* @requiredField
|
|
161
|
-
* @requiredField
|
|
162
|
-
* @requiredField
|
|
162
|
+
* @requiredField product
|
|
163
|
+
* @requiredField product.costAndProfitData.itemCost
|
|
164
|
+
* @requiredField product.name
|
|
165
|
+
* @requiredField product.priceData
|
|
166
|
+
* @requiredField product.priceData.price
|
|
163
167
|
*/
|
|
164
|
-
export function createProduct(
|
|
168
|
+
export function createProduct(product) {
|
|
165
169
|
var _a, _b, _c;
|
|
166
170
|
return __awaiter(this, arguments, void 0, function* () {
|
|
167
|
-
const requestTransformation = { product: '$[0]
|
|
171
|
+
const requestTransformation = { product: '$[0]' };
|
|
168
172
|
const responseTransformation = '$';
|
|
169
173
|
// @ts-ignore
|
|
170
174
|
const { httpClient, sideEffects } = arguments[1];
|
|
@@ -186,7 +190,7 @@ export function createProduct(options) {
|
|
|
186
190
|
},
|
|
187
191
|
customTransformation: responseTransformation,
|
|
188
192
|
});
|
|
189
|
-
const payload = toAmbassadorRequest([
|
|
193
|
+
const payload = toAmbassadorRequest([product]);
|
|
190
194
|
const reqOpts = ambassadorWixStoresCatalogV1Product.createProduct(payload);
|
|
191
195
|
__log(`"CreateProduct" sending request with: ${__inspect(reqOpts)}`);
|
|
192
196
|
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
|
@@ -197,7 +201,7 @@ export function createProduct(options) {
|
|
|
197
201
|
}
|
|
198
202
|
catch (err) {
|
|
199
203
|
const transformedError = transformError(err, requestTransformation, [
|
|
200
|
-
'
|
|
204
|
+
'product',
|
|
201
205
|
]);
|
|
202
206
|
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
|
203
207
|
throw transformedError;
|
|
@@ -206,11 +210,14 @@ export function createProduct(options) {
|
|
|
206
210
|
}
|
|
207
211
|
/**
|
|
208
212
|
* Updates specified fields in a product.
|
|
213
|
+
*
|
|
214
|
+
* This function is not a universal function and runs only on the backend.
|
|
209
215
|
* @param _id - Product ID (generated automatically by the catalog).
|
|
210
216
|
* @public
|
|
211
217
|
* @documentationMaturity preview
|
|
212
218
|
* @requiredField _id
|
|
213
219
|
* @requiredField product
|
|
220
|
+
* @param product - Product info to update.
|
|
214
221
|
*/
|
|
215
222
|
export function updateProduct(_id, product) {
|
|
216
223
|
var _a, _b, _c;
|
|
@@ -258,9 +265,10 @@ export function updateProduct(_id, product) {
|
|
|
258
265
|
}
|
|
259
266
|
/**
|
|
260
267
|
* Deletes a product.
|
|
261
|
-
*
|
|
268
|
+
*
|
|
269
|
+
* This function is not a universal function and runs only on the backend.
|
|
270
|
+
* @param _id - ID of the product to delete.
|
|
262
271
|
* @public
|
|
263
|
-
* @documentationMaturity preview
|
|
264
272
|
* @requiredField _id
|
|
265
273
|
*/
|
|
266
274
|
export function deleteProduct(_id) {
|
|
@@ -308,15 +316,19 @@ export function deleteProduct(_id) {
|
|
|
308
316
|
}
|
|
309
317
|
/**
|
|
310
318
|
* Updates variants of a specified product.
|
|
319
|
+
*
|
|
320
|
+
* This function is not a universal function and runs only on the backend.
|
|
311
321
|
* @param _id - ID of the product with managed variants.
|
|
322
|
+
* @param variants - Variant info to update.
|
|
312
323
|
* @public
|
|
313
324
|
* @documentationMaturity preview
|
|
314
325
|
* @requiredField _id
|
|
326
|
+
* @requiredField variants
|
|
315
327
|
*/
|
|
316
|
-
export function
|
|
328
|
+
export function updateProductVariants(_id, variants) {
|
|
317
329
|
var _a, _b, _c;
|
|
318
330
|
return __awaiter(this, arguments, void 0, function* () {
|
|
319
|
-
const requestTransformation = { id: '$[0]', variants: '$[1]
|
|
331
|
+
const requestTransformation = { id: '$[0]', variants: '$[1]' };
|
|
320
332
|
const responseTransformation = '$';
|
|
321
333
|
// @ts-ignore
|
|
322
334
|
const { httpClient, sideEffects } = arguments[2];
|
|
@@ -338,7 +350,7 @@ export function updateVariants(_id, options) {
|
|
|
338
350
|
},
|
|
339
351
|
customTransformation: responseTransformation,
|
|
340
352
|
});
|
|
341
|
-
const payload = toAmbassadorRequest([_id,
|
|
353
|
+
const payload = toAmbassadorRequest([_id, variants]);
|
|
342
354
|
const reqOpts = ambassadorWixStoresCatalogV1Product.updateVariants(payload);
|
|
343
355
|
__log(`"UpdateVariants" sending request with: ${__inspect(reqOpts)}`);
|
|
344
356
|
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
|
@@ -350,7 +362,7 @@ export function updateVariants(_id, options) {
|
|
|
350
362
|
catch (err) {
|
|
351
363
|
const transformedError = transformError(err, requestTransformation, [
|
|
352
364
|
'_id',
|
|
353
|
-
'
|
|
365
|
+
'variants',
|
|
354
366
|
]);
|
|
355
367
|
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
|
356
368
|
throw transformedError;
|
|
@@ -358,13 +370,15 @@ export function updateVariants(_id, options) {
|
|
|
358
370
|
});
|
|
359
371
|
}
|
|
360
372
|
/**
|
|
361
|
-
* Resets
|
|
373
|
+
* Resets the data (such as the price and the weight) of all variants for a given product to their default values.
|
|
374
|
+
*
|
|
375
|
+
* This function is not a universal function and runs only on the backend.
|
|
362
376
|
* @param _id - Product ID.
|
|
363
377
|
* @public
|
|
364
378
|
* @documentationMaturity preview
|
|
365
379
|
* @requiredField _id
|
|
366
380
|
*/
|
|
367
|
-
export function
|
|
381
|
+
export function resetAllProductVariantData(_id) {
|
|
368
382
|
var _a, _b, _c;
|
|
369
383
|
return __awaiter(this, arguments, void 0, function* () {
|
|
370
384
|
const requestTransformation = { id: '$[0]' };
|
|
@@ -409,15 +423,18 @@ export function resetAllVariantData(_id) {
|
|
|
409
423
|
}
|
|
410
424
|
/**
|
|
411
425
|
* Adds products to a specified collection.
|
|
426
|
+
*
|
|
427
|
+
* This function is not a universal function and runs only on the backend.
|
|
412
428
|
* @param _id - Collection ID. Cannot be used to add products to All Products
|
|
429
|
+
* @param productIds - IDs of the products to add to the collection, separated by commas.
|
|
413
430
|
* @public
|
|
414
|
-
* @documentationMaturity preview
|
|
415
431
|
* @requiredField _id
|
|
432
|
+
* @requiredField productIds
|
|
416
433
|
*/
|
|
417
|
-
export function addProductsToCollection(_id,
|
|
434
|
+
export function addProductsToCollection(_id, productIds) {
|
|
418
435
|
var _a, _b, _c;
|
|
419
436
|
return __awaiter(this, arguments, void 0, function* () {
|
|
420
|
-
const requestTransformation = { id: '$[0]', productIds: '$[1]
|
|
437
|
+
const requestTransformation = { id: '$[0]', productIds: '$[1]' };
|
|
421
438
|
const responseTransformation = '$';
|
|
422
439
|
// @ts-ignore
|
|
423
440
|
const { httpClient, sideEffects } = arguments[2];
|
|
@@ -439,7 +456,7 @@ export function addProductsToCollection(_id, options) {
|
|
|
439
456
|
},
|
|
440
457
|
customTransformation: responseTransformation,
|
|
441
458
|
});
|
|
442
|
-
const payload = toAmbassadorRequest([_id,
|
|
459
|
+
const payload = toAmbassadorRequest([_id, productIds]);
|
|
443
460
|
const reqOpts = ambassadorWixStoresCatalogV1Product.addProductsToCollection(payload);
|
|
444
461
|
__log(`"AddProductsToCollection" sending request with: ${__inspect(reqOpts)}`);
|
|
445
462
|
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
|
@@ -451,7 +468,7 @@ export function addProductsToCollection(_id, options) {
|
|
|
451
468
|
catch (err) {
|
|
452
469
|
const transformedError = transformError(err, requestTransformation, [
|
|
453
470
|
'_id',
|
|
454
|
-
'
|
|
471
|
+
'productIds',
|
|
455
472
|
]);
|
|
456
473
|
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
|
457
474
|
throw transformedError;
|
|
@@ -460,10 +477,11 @@ export function addProductsToCollection(_id, options) {
|
|
|
460
477
|
}
|
|
461
478
|
/**
|
|
462
479
|
* Deletes products from a specified collection.
|
|
463
|
-
*
|
|
464
|
-
*
|
|
480
|
+
*
|
|
481
|
+
* This function is not a universal function and runs only on the backend.
|
|
482
|
+
* @param _id - ID of the collection from which to remove products.
|
|
483
|
+
* @param productIds - IDs of the products to remove from the collection.
|
|
465
484
|
* @public
|
|
466
|
-
* @documentationMaturity preview
|
|
467
485
|
* @requiredField _id
|
|
468
486
|
* @requiredField productIds
|
|
469
487
|
*/
|
|
@@ -513,15 +531,20 @@ export function removeProductsFromCollection(_id, productIds) {
|
|
|
513
531
|
}
|
|
514
532
|
/**
|
|
515
533
|
* Adds media items to a specified product, either via URL or existing media ID.
|
|
534
|
+
*
|
|
535
|
+
* > **NOTE:** The URL is not validated and no event is triggered to indicate if the media was added successfully.
|
|
536
|
+
*
|
|
537
|
+
* This function is not a universal function and runs only on the backend.
|
|
516
538
|
* @param _id - Product ID.
|
|
539
|
+
* @param media - Sources of media items already uploaded to the Wix site.
|
|
517
540
|
* @public
|
|
518
|
-
* @documentationMaturity preview
|
|
519
541
|
* @requiredField _id
|
|
542
|
+
* @requiredField media
|
|
520
543
|
*/
|
|
521
|
-
export function addProductMedia(_id,
|
|
544
|
+
export function addProductMedia(_id, media) {
|
|
522
545
|
var _a, _b, _c;
|
|
523
546
|
return __awaiter(this, arguments, void 0, function* () {
|
|
524
|
-
const requestTransformation = { id: '$[0]', media: '$[1]
|
|
547
|
+
const requestTransformation = { id: '$[0]', media: '$[1]' };
|
|
525
548
|
const responseTransformation = '$';
|
|
526
549
|
// @ts-ignore
|
|
527
550
|
const { httpClient, sideEffects } = arguments[2];
|
|
@@ -543,7 +566,7 @@ export function addProductMedia(_id, options) {
|
|
|
543
566
|
},
|
|
544
567
|
customTransformation: responseTransformation,
|
|
545
568
|
});
|
|
546
|
-
const payload = toAmbassadorRequest([_id,
|
|
569
|
+
const payload = toAmbassadorRequest([_id, media]);
|
|
547
570
|
const reqOpts = ambassadorWixStoresCatalogV1Product.addProductMedia(payload);
|
|
548
571
|
__log(`"AddProductMedia" sending request with: ${__inspect(reqOpts)}`);
|
|
549
572
|
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
|
@@ -555,7 +578,7 @@ export function addProductMedia(_id, options) {
|
|
|
555
578
|
catch (err) {
|
|
556
579
|
const transformedError = transformError(err, requestTransformation, [
|
|
557
580
|
'_id',
|
|
558
|
-
'
|
|
581
|
+
'media',
|
|
559
582
|
]);
|
|
560
583
|
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
|
561
584
|
throw transformedError;
|
|
@@ -565,15 +588,18 @@ export function addProductMedia(_id, options) {
|
|
|
565
588
|
/**
|
|
566
589
|
* Removes specified media items from a product.
|
|
567
590
|
* Pass an empty array to remove all media items.
|
|
591
|
+
*
|
|
592
|
+
* This function is not a universal function and runs only on the backend.
|
|
568
593
|
* @param _id - Product ID.
|
|
594
|
+
* @param mediaIds - List of media IDs to remove. Pass an empty array to delete all media items for the product.
|
|
569
595
|
* @public
|
|
570
|
-
* @documentationMaturity preview
|
|
571
596
|
* @requiredField _id
|
|
597
|
+
* @requiredField mediaIds
|
|
572
598
|
*/
|
|
573
|
-
export function removeProductMedia(_id,
|
|
599
|
+
export function removeProductMedia(_id, mediaIds) {
|
|
574
600
|
var _a, _b, _c;
|
|
575
601
|
return __awaiter(this, arguments, void 0, function* () {
|
|
576
|
-
const requestTransformation = { id: '$[0]', mediaIds: '$[1]
|
|
602
|
+
const requestTransformation = { id: '$[0]', mediaIds: '$[1]' };
|
|
577
603
|
const responseTransformation = '$';
|
|
578
604
|
// @ts-ignore
|
|
579
605
|
const { httpClient, sideEffects } = arguments[2];
|
|
@@ -595,7 +621,7 @@ export function removeProductMedia(_id, options) {
|
|
|
595
621
|
},
|
|
596
622
|
customTransformation: responseTransformation,
|
|
597
623
|
});
|
|
598
|
-
const payload = toAmbassadorRequest([_id,
|
|
624
|
+
const payload = toAmbassadorRequest([_id, mediaIds]);
|
|
599
625
|
const reqOpts = ambassadorWixStoresCatalogV1Product.removeProductMedia(payload);
|
|
600
626
|
__log(`"RemoveProductMedia" sending request with: ${__inspect(reqOpts)}`);
|
|
601
627
|
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
|
@@ -607,7 +633,7 @@ export function removeProductMedia(_id, options) {
|
|
|
607
633
|
catch (err) {
|
|
608
634
|
const transformedError = transformError(err, requestTransformation, [
|
|
609
635
|
'_id',
|
|
610
|
-
'
|
|
636
|
+
'mediaIds',
|
|
611
637
|
]);
|
|
612
638
|
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
|
613
639
|
throw transformedError;
|
|
@@ -620,17 +646,20 @@ export function removeProductMedia(_id, options) {
|
|
|
620
646
|
* 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
647
|
*
|
|
622
648
|
* 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.
|
|
649
|
+
*
|
|
650
|
+
* This function is not a universal function and runs only on the backend.
|
|
623
651
|
* @param _id - Product ID.
|
|
652
|
+
* @param media - Product media items and the choices to add the media to.
|
|
624
653
|
* @public
|
|
625
|
-
* @documentationMaturity preview
|
|
626
654
|
* @requiredField _id
|
|
627
|
-
* @requiredField
|
|
628
|
-
* @requiredField
|
|
655
|
+
* @requiredField media
|
|
656
|
+
* @requiredField media.choice
|
|
657
|
+
* @requiredField media.option
|
|
629
658
|
*/
|
|
630
|
-
export function addProductMediaToChoices(_id,
|
|
659
|
+
export function addProductMediaToChoices(_id, media) {
|
|
631
660
|
var _a, _b, _c;
|
|
632
661
|
return __awaiter(this, arguments, void 0, function* () {
|
|
633
|
-
const requestTransformation = { id: '$[0]', media: '$[1]
|
|
662
|
+
const requestTransformation = { id: '$[0]', media: '$[1]' };
|
|
634
663
|
const responseTransformation = '$';
|
|
635
664
|
// @ts-ignore
|
|
636
665
|
const { httpClient, sideEffects } = arguments[2];
|
|
@@ -652,7 +681,7 @@ export function addProductMediaToChoices(_id, options) {
|
|
|
652
681
|
},
|
|
653
682
|
customTransformation: responseTransformation,
|
|
654
683
|
});
|
|
655
|
-
const payload = toAmbassadorRequest([_id,
|
|
684
|
+
const payload = toAmbassadorRequest([_id, media]);
|
|
656
685
|
const reqOpts = ambassadorWixStoresCatalogV1Product.addProductMediaToChoices(payload);
|
|
657
686
|
__log(`"AddProductMediaToChoices" sending request with: ${__inspect(reqOpts)}`);
|
|
658
687
|
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
|
@@ -664,7 +693,7 @@ export function addProductMediaToChoices(_id, options) {
|
|
|
664
693
|
catch (err) {
|
|
665
694
|
const transformedError = transformError(err, requestTransformation, [
|
|
666
695
|
'_id',
|
|
667
|
-
'
|
|
696
|
+
'media',
|
|
668
697
|
]);
|
|
669
698
|
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
|
670
699
|
throw transformedError;
|
|
@@ -674,15 +703,18 @@ export function addProductMediaToChoices(_id, options) {
|
|
|
674
703
|
/**
|
|
675
704
|
* Removes media items from all or some of a product's choices.
|
|
676
705
|
* (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
|
-
*
|
|
706
|
+
*
|
|
707
|
+
* This function is not a universal function and runs only on the backend.
|
|
708
|
+
* @param _id - Product ID from whose choices to remove media items.
|
|
709
|
+
* @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
710
|
* @public
|
|
679
|
-
* @documentationMaturity preview
|
|
680
711
|
* @requiredField _id
|
|
712
|
+
* @requiredField media
|
|
681
713
|
*/
|
|
682
|
-
export function removeProductMediaFromChoices(_id,
|
|
714
|
+
export function removeProductMediaFromChoices(_id, media) {
|
|
683
715
|
var _a, _b, _c;
|
|
684
716
|
return __awaiter(this, arguments, void 0, function* () {
|
|
685
|
-
const requestTransformation = { id: '$[0]', media: '$[1]
|
|
717
|
+
const requestTransformation = { id: '$[0]', media: '$[1]' };
|
|
686
718
|
const responseTransformation = '$';
|
|
687
719
|
// @ts-ignore
|
|
688
720
|
const { httpClient, sideEffects } = arguments[2];
|
|
@@ -704,7 +736,7 @@ export function removeProductMediaFromChoices(_id, options) {
|
|
|
704
736
|
},
|
|
705
737
|
customTransformation: responseTransformation,
|
|
706
738
|
});
|
|
707
|
-
const payload = toAmbassadorRequest([_id,
|
|
739
|
+
const payload = toAmbassadorRequest([_id, media]);
|
|
708
740
|
const reqOpts = ambassadorWixStoresCatalogV1Product.removeProductMediaFromChoices(payload);
|
|
709
741
|
__log(`"RemoveProductMediaFromChoices" sending request with: ${__inspect(reqOpts)}`);
|
|
710
742
|
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
|
@@ -716,7 +748,7 @@ export function removeProductMediaFromChoices(_id, options) {
|
|
|
716
748
|
catch (err) {
|
|
717
749
|
const transformedError = transformError(err, requestTransformation, [
|
|
718
750
|
'_id',
|
|
719
|
-
'
|
|
751
|
+
'media',
|
|
720
752
|
]);
|
|
721
753
|
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
|
722
754
|
throw transformedError;
|
|
@@ -724,10 +756,11 @@ export function removeProductMediaFromChoices(_id, options) {
|
|
|
724
756
|
});
|
|
725
757
|
}
|
|
726
758
|
/**
|
|
727
|
-
* Delete all options from a specific product
|
|
728
|
-
*
|
|
759
|
+
* 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.
|
|
760
|
+
*
|
|
761
|
+
* This function is not a universal function and runs only on the backend.
|
|
762
|
+
* @param _id - ID of the product with options to delete.
|
|
729
763
|
* @public
|
|
730
|
-
* @documentationMaturity preview
|
|
731
764
|
* @requiredField _id
|
|
732
765
|
*/
|
|
733
766
|
export function deleteProductOptions(_id) {
|
|
@@ -775,6 +808,8 @@ export function deleteProductOptions(_id) {
|
|
|
775
808
|
}
|
|
776
809
|
/**
|
|
777
810
|
* Deletes a product's brand.
|
|
811
|
+
*
|
|
812
|
+
* This function is not a universal function and runs only on the backend.
|
|
778
813
|
* @param _id - Product ID.
|
|
779
814
|
* @public
|
|
780
815
|
* @documentationMaturity preview
|
|
@@ -825,6 +860,8 @@ export function removeBrand(_id) {
|
|
|
825
860
|
}
|
|
826
861
|
/**
|
|
827
862
|
* Creates a new collection.
|
|
863
|
+
*
|
|
864
|
+
* This function is not a universal function and runs only on the backend.
|
|
828
865
|
* @param collection - Collection info.
|
|
829
866
|
* @public
|
|
830
867
|
* @documentationMaturity preview
|
|
@@ -875,13 +912,15 @@ export function createCollection(collection) {
|
|
|
875
912
|
});
|
|
876
913
|
}
|
|
877
914
|
/**
|
|
878
|
-
* Updates specified properties of a collection.
|
|
879
|
-
*
|
|
915
|
+
* Updates specified properties of a collection. To add products to a collection, call the [addProductsToCollection](#addproductstocollection) function.
|
|
916
|
+
*
|
|
917
|
+
* This function is not a universal function and runs only on the backend.
|
|
880
918
|
* @param _id - Collection ID (generated automatically by the catalog).
|
|
881
919
|
* @public
|
|
882
920
|
* @documentationMaturity preview
|
|
883
921
|
* @requiredField _id
|
|
884
922
|
* @requiredField collection
|
|
923
|
+
* @param collection - Collection info to update.
|
|
885
924
|
*/
|
|
886
925
|
export function updateCollection(_id, collection) {
|
|
887
926
|
var _a, _b, _c;
|
|
@@ -929,10 +968,12 @@ export function updateCollection(_id, collection) {
|
|
|
929
968
|
}
|
|
930
969
|
/**
|
|
931
970
|
* Deletes a collection.
|
|
932
|
-
*
|
|
971
|
+
*
|
|
972
|
+
* This function is not a universal function and runs only on the backend.
|
|
933
973
|
* @public
|
|
934
974
|
* @documentationMaturity preview
|
|
935
975
|
* @requiredField _id
|
|
976
|
+
* @param _id - ID of the collection to delete.
|
|
936
977
|
*/
|
|
937
978
|
export function deleteCollection(_id) {
|
|
938
979
|
var _a, _b, _c;
|
|
@@ -979,6 +1020,8 @@ export function deleteCollection(_id) {
|
|
|
979
1020
|
}
|
|
980
1021
|
/**
|
|
981
1022
|
* Deletes a product's ribbon.
|
|
1023
|
+
*
|
|
1024
|
+
* This function is not a universal function and runs only on the backend.
|
|
982
1025
|
* @param _id - Product ID.
|
|
983
1026
|
* @public
|
|
984
1027
|
* @documentationMaturity preview
|
|
@@ -1029,15 +1072,16 @@ export function removeRibbon(_id) {
|
|
|
1029
1072
|
}
|
|
1030
1073
|
/**
|
|
1031
1074
|
* Updates a specified property for up to 100 products at a time.
|
|
1032
|
-
* @param
|
|
1075
|
+
* @param set - Field to update.
|
|
1033
1076
|
* @public
|
|
1034
|
-
* @
|
|
1035
|
-
* @requiredField ids
|
|
1077
|
+
* @requiredField options
|
|
1078
|
+
* @requiredField options.ids
|
|
1079
|
+
* @requiredField set
|
|
1036
1080
|
*/
|
|
1037
|
-
export function bulkUpdateProducts(
|
|
1081
|
+
export function bulkUpdateProducts(set, options) {
|
|
1038
1082
|
var _a, _b, _c;
|
|
1039
1083
|
return __awaiter(this, arguments, void 0, function* () {
|
|
1040
|
-
const requestTransformation = {
|
|
1084
|
+
const requestTransformation = { set: '$[0]', ids: '$[1].ids' };
|
|
1041
1085
|
const responseTransformation = '$';
|
|
1042
1086
|
// @ts-ignore
|
|
1043
1087
|
const { httpClient, sideEffects } = arguments[2];
|
|
@@ -1059,7 +1103,7 @@ export function bulkUpdateProducts(ids, options) {
|
|
|
1059
1103
|
},
|
|
1060
1104
|
customTransformation: responseTransformation,
|
|
1061
1105
|
});
|
|
1062
|
-
const payload = toAmbassadorRequest([
|
|
1106
|
+
const payload = toAmbassadorRequest([set, options]);
|
|
1063
1107
|
const reqOpts = ambassadorWixStoresCatalogV1Product.bulkUpdateProducts(payload);
|
|
1064
1108
|
__log(`"BulkUpdateProducts" sending request with: ${__inspect(reqOpts)}`);
|
|
1065
1109
|
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
|
@@ -1070,7 +1114,7 @@ export function bulkUpdateProducts(ids, options) {
|
|
|
1070
1114
|
}
|
|
1071
1115
|
catch (err) {
|
|
1072
1116
|
const transformedError = transformError(err, requestTransformation, [
|
|
1073
|
-
'
|
|
1117
|
+
'set',
|
|
1074
1118
|
'options',
|
|
1075
1119
|
]);
|
|
1076
1120
|
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
|
@@ -1081,15 +1125,17 @@ export function bulkUpdateProducts(ids, options) {
|
|
|
1081
1125
|
/**
|
|
1082
1126
|
* Adjusts a specified numerical property for up to 100 products at a time.
|
|
1083
1127
|
* The property can be increased or decreased either by percentage or amount.
|
|
1084
|
-
* @param
|
|
1128
|
+
* @param adjust - Numerical property to adjust.
|
|
1085
1129
|
* @public
|
|
1086
1130
|
* @documentationMaturity preview
|
|
1087
|
-
* @requiredField
|
|
1131
|
+
* @requiredField adjust
|
|
1132
|
+
* @requiredField options
|
|
1133
|
+
* @requiredField options.ids
|
|
1088
1134
|
*/
|
|
1089
|
-
export function
|
|
1135
|
+
export function bulkAdjustProductProperty(adjust, options) {
|
|
1090
1136
|
var _a, _b, _c;
|
|
1091
1137
|
return __awaiter(this, arguments, void 0, function* () {
|
|
1092
|
-
const requestTransformation = {
|
|
1138
|
+
const requestTransformation = { adjust: '$[0]', ids: '$[1].ids' };
|
|
1093
1139
|
const responseTransformation = '$';
|
|
1094
1140
|
// @ts-ignore
|
|
1095
1141
|
const { httpClient, sideEffects } = arguments[2];
|
|
@@ -1111,7 +1157,7 @@ export function bulkAdjustProductProperties(ids, options) {
|
|
|
1111
1157
|
},
|
|
1112
1158
|
customTransformation: responseTransformation,
|
|
1113
1159
|
});
|
|
1114
|
-
const payload = toAmbassadorRequest([
|
|
1160
|
+
const payload = toAmbassadorRequest([adjust, options]);
|
|
1115
1161
|
const reqOpts = ambassadorWixStoresCatalogV1Product.bulkAdjustProductProperties(payload);
|
|
1116
1162
|
__log(`"BulkAdjustProductProperties" sending request with: ${__inspect(reqOpts)}`);
|
|
1117
1163
|
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
|
@@ -1122,7 +1168,7 @@ export function bulkAdjustProductProperties(ids, options) {
|
|
|
1122
1168
|
}
|
|
1123
1169
|
catch (err) {
|
|
1124
1170
|
const transformedError = transformError(err, requestTransformation, [
|
|
1125
|
-
'
|
|
1171
|
+
'adjust',
|
|
1126
1172
|
'options',
|
|
1127
1173
|
]);
|
|
1128
1174
|
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
|
@@ -1297,7 +1343,6 @@ export function queryCollections(options) {
|
|
|
1297
1343
|
* Retrieves a collection with the provided ID.
|
|
1298
1344
|
* @param _id - Requested collection ID.
|
|
1299
1345
|
* @public
|
|
1300
|
-
* @documentationMaturity preview
|
|
1301
1346
|
* @requiredField _id
|
|
1302
1347
|
*/
|
|
1303
1348
|
export function getCollection(_id, options) {
|
|
@@ -1351,7 +1396,6 @@ export function getCollection(_id, options) {
|
|
|
1351
1396
|
* Retrieves a collection with the provided slug.
|
|
1352
1397
|
* @param slug - Slug of the collection to retrieve.
|
|
1353
1398
|
* @public
|
|
1354
|
-
* @documentationMaturity preview
|
|
1355
1399
|
* @requiredField slug
|
|
1356
1400
|
*/
|
|
1357
1401
|
export function getCollectionBySlug(slug) {
|
|
@@ -1400,14 +1444,15 @@ export function getCollectionBySlug(slug) {
|
|
|
1400
1444
|
/**
|
|
1401
1445
|
* 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
1446
|
* @param _id - Requested product ID.
|
|
1447
|
+
* @param options - Set of key-value pairs. Array containing the selected options (e.g, color: Blue, size: Large).
|
|
1403
1448
|
* @public
|
|
1404
|
-
* @documentationMaturity preview
|
|
1405
1449
|
* @requiredField _id
|
|
1450
|
+
* @requiredField options
|
|
1406
1451
|
*/
|
|
1407
1452
|
export function getProductOptionsAvailability(_id, options) {
|
|
1408
1453
|
var _a, _b, _c;
|
|
1409
1454
|
return __awaiter(this, arguments, void 0, function* () {
|
|
1410
|
-
const requestTransformation = { id: '$[0]', options: '$[1]
|
|
1455
|
+
const requestTransformation = { id: '$[0]', options: '$[1]' };
|
|
1411
1456
|
const responseTransformation = '$';
|
|
1412
1457
|
// @ts-ignore
|
|
1413
1458
|
const { httpClient, sideEffects } = arguments[2];
|
|
@@ -1508,13 +1553,15 @@ export function queryProductVariants(_id, options) {
|
|
|
1508
1553
|
}
|
|
1509
1554
|
/**
|
|
1510
1555
|
* Retrieves up to 100 store variants, given the provided paging, filtering, and sorting.
|
|
1556
|
+
* @param query - Query options.
|
|
1511
1557
|
* @public
|
|
1512
1558
|
* @documentationMaturity preview
|
|
1559
|
+
* @requiredField query
|
|
1513
1560
|
*/
|
|
1514
|
-
export function queryStoreVariants(
|
|
1561
|
+
export function queryStoreVariants(query) {
|
|
1515
1562
|
var _a, _b, _c;
|
|
1516
1563
|
return __awaiter(this, arguments, void 0, function* () {
|
|
1517
|
-
const requestTransformation = { query: '$[0]
|
|
1564
|
+
const requestTransformation = { query: '$[0]' };
|
|
1518
1565
|
const responseTransformation = '$';
|
|
1519
1566
|
// @ts-ignore
|
|
1520
1567
|
const { httpClient, sideEffects } = arguments[1];
|
|
@@ -1536,7 +1583,7 @@ export function queryStoreVariants(options) {
|
|
|
1536
1583
|
},
|
|
1537
1584
|
customTransformation: responseTransformation,
|
|
1538
1585
|
});
|
|
1539
|
-
const payload = toAmbassadorRequest([
|
|
1586
|
+
const payload = toAmbassadorRequest([query]);
|
|
1540
1587
|
const reqOpts = ambassadorWixStoresCatalogV1Product.queryStoreVariants(payload);
|
|
1541
1588
|
__log(`"QueryStoreVariants" sending request with: ${__inspect(reqOpts)}`);
|
|
1542
1589
|
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
|
@@ -1547,7 +1594,7 @@ export function queryStoreVariants(options) {
|
|
|
1547
1594
|
}
|
|
1548
1595
|
catch (err) {
|
|
1549
1596
|
const transformedError = transformError(err, requestTransformation, [
|
|
1550
|
-
'
|
|
1597
|
+
'query',
|
|
1551
1598
|
]);
|
|
1552
1599
|
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
|
1553
1600
|
throw transformedError;
|