@wix/stores 1.0.4 → 1.0.6
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 +2 -2
- package/build/cjs/index.js +2 -2
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/src/{stores-poc-v1-collection.http.d.ts → stores-catalog-v1-collection.http.d.ts} +7 -2
- package/build/cjs/src/{stores-poc-v1-collection.http.js → stores-catalog-v1-collection.http.js} +47 -44
- package/build/cjs/src/stores-catalog-v1-collection.http.js.map +1 -0
- package/build/cjs/src/stores-catalog-v1-collection.public.d.ts +5 -0
- package/build/cjs/src/stores-catalog-v1-collection.public.js +20 -0
- package/build/cjs/src/stores-catalog-v1-collection.public.js.map +1 -0
- package/build/cjs/src/{stores-poc-v1-collection.types.d.ts → stores-catalog-v1-collection.types.d.ts} +51 -17
- package/build/cjs/src/{stores-poc-v1-collection.types.js → stores-catalog-v1-collection.types.js} +1 -1
- package/build/cjs/src/stores-catalog-v1-collection.types.js.map +1 -0
- package/build/cjs/src/{stores-poc-v1-collection.universal.d.ts → stores-catalog-v1-collection.universal.d.ts} +63 -38
- package/build/cjs/src/{stores-poc-v1-collection.universal.js → stores-catalog-v1-collection.universal.js} +55 -55
- package/build/cjs/src/stores-catalog-v1-collection.universal.js.map +1 -0
- package/build/cjs/src/stores-catalog-v1-product.http.d.ts +62 -0
- package/build/cjs/src/stores-catalog-v1-product.http.js +775 -0
- package/build/cjs/src/stores-catalog-v1-product.http.js.map +1 -0
- package/build/cjs/src/stores-catalog-v1-product.public.d.ts +25 -0
- package/build/cjs/src/stores-catalog-v1-product.public.js +139 -0
- package/build/cjs/src/stores-catalog-v1-product.public.js.map +1 -0
- package/build/cjs/src/stores-catalog-v1-product.types.d.ts +1371 -0
- package/build/cjs/src/{stores-poc-v1-product.types.js → stores-catalog-v1-product.types.js} +1 -1
- package/build/cjs/src/stores-catalog-v1-product.types.js.map +1 -0
- package/build/cjs/src/stores-catalog-v1-product.universal.d.ts +1744 -0
- package/build/cjs/src/stores-catalog-v1-product.universal.js +1155 -0
- package/build/cjs/src/stores-catalog-v1-product.universal.js.map +1 -0
- package/build/es/index.d.ts +2 -2
- package/build/es/index.js +2 -2
- package/build/es/index.js.map +1 -1
- package/build/es/src/{stores-poc-v1-collection.http.d.ts → stores-catalog-v1-collection.http.d.ts} +7 -2
- package/build/es/src/{stores-poc-v1-collection.http.js → stores-catalog-v1-collection.http.js} +44 -41
- package/build/es/src/stores-catalog-v1-collection.http.js.map +1 -0
- package/build/es/src/stores-catalog-v1-collection.public.d.ts +5 -0
- package/build/es/src/stores-catalog-v1-collection.public.js +13 -0
- package/build/es/src/stores-catalog-v1-collection.public.js.map +1 -0
- package/build/es/src/{stores-poc-v1-collection.types.d.ts → stores-catalog-v1-collection.types.d.ts} +51 -17
- package/build/es/src/{stores-poc-v1-collection.types.js → stores-catalog-v1-collection.types.js} +1 -1
- package/build/es/src/stores-catalog-v1-collection.types.js.map +1 -0
- package/build/es/src/{stores-poc-v1-collection.universal.d.ts → stores-catalog-v1-collection.universal.d.ts} +63 -38
- package/build/es/src/{stores-poc-v1-collection.universal.js → stores-catalog-v1-collection.universal.js} +53 -53
- package/build/es/src/stores-catalog-v1-collection.universal.js.map +1 -0
- package/build/es/src/stores-catalog-v1-product.http.d.ts +62 -0
- package/build/es/src/stores-catalog-v1-product.http.js +751 -0
- package/build/es/src/stores-catalog-v1-product.http.js.map +1 -0
- package/build/es/src/stores-catalog-v1-product.public.d.ts +25 -0
- package/build/es/src/stores-catalog-v1-product.public.js +108 -0
- package/build/es/src/stores-catalog-v1-product.public.js.map +1 -0
- package/build/es/src/stores-catalog-v1-product.types.d.ts +1371 -0
- package/build/es/src/{stores-poc-v1-product.types.js → stores-catalog-v1-product.types.js} +1 -1
- package/build/es/src/stores-catalog-v1-product.types.js.map +1 -0
- package/build/es/src/stores-catalog-v1-product.universal.d.ts +1744 -0
- package/build/es/src/stores-catalog-v1-product.universal.js +1112 -0
- package/build/es/src/stores-catalog-v1-product.universal.js.map +1 -0
- package/package.json +2 -2
- package/build/cjs/src/stores-poc-v1-collection.http.js.map +0 -1
- package/build/cjs/src/stores-poc-v1-collection.public.d.ts +0 -6
- package/build/cjs/src/stores-poc-v1-collection.public.js +0 -20
- package/build/cjs/src/stores-poc-v1-collection.public.js.map +0 -1
- package/build/cjs/src/stores-poc-v1-collection.types.js.map +0 -1
- package/build/cjs/src/stores-poc-v1-collection.universal.js.map +0 -1
- package/build/cjs/src/stores-poc-v1-product.http.d.ts +0 -4
- package/build/cjs/src/stores-poc-v1-product.http.js +0 -143
- package/build/cjs/src/stores-poc-v1-product.http.js.map +0 -1
- package/build/cjs/src/stores-poc-v1-product.public.d.ts +0 -6
- package/build/cjs/src/stores-poc-v1-product.public.js +0 -25
- package/build/cjs/src/stores-poc-v1-product.public.js.map +0 -1
- package/build/cjs/src/stores-poc-v1-product.types.d.ts +0 -470
- package/build/cjs/src/stores-poc-v1-product.types.js.map +0 -1
- package/build/cjs/src/stores-poc-v1-product.universal.d.ts +0 -549
- package/build/cjs/src/stores-poc-v1-product.universal.js +0 -212
- package/build/cjs/src/stores-poc-v1-product.universal.js.map +0 -1
- package/build/es/src/stores-poc-v1-collection.http.js.map +0 -1
- package/build/es/src/stores-poc-v1-collection.public.d.ts +0 -6
- package/build/es/src/stores-poc-v1-collection.public.js +0 -13
- package/build/es/src/stores-poc-v1-collection.public.js.map +0 -1
- package/build/es/src/stores-poc-v1-collection.types.js.map +0 -1
- package/build/es/src/stores-poc-v1-collection.universal.js.map +0 -1
- package/build/es/src/stores-poc-v1-product.http.d.ts +0 -4
- package/build/es/src/stores-poc-v1-product.http.js +0 -138
- package/build/es/src/stores-poc-v1-product.http.js.map +0 -1
- package/build/es/src/stores-poc-v1-product.public.d.ts +0 -6
- package/build/es/src/stores-poc-v1-product.public.js +0 -13
- package/build/es/src/stores-poc-v1-product.public.js.map +0 -1
- package/build/es/src/stores-poc-v1-product.types.d.ts +0 -470
- package/build/es/src/stores-poc-v1-product.types.js.map +0 -1
- package/build/es/src/stores-poc-v1-product.universal.d.ts +0 -549
- package/build/es/src/stores-poc-v1-product.universal.js +0 -188
- package/build/es/src/stores-poc-v1-product.universal.js.map +0 -1
|
@@ -0,0 +1,751 @@
|
|
|
1
|
+
import { toURLSearchParams } from '@wix/metro-runtime';
|
|
2
|
+
import { serializer } from '@wix/metro-runtime/ambassador';
|
|
3
|
+
import { resolveUrl } from '@wix/metro-runtime';
|
|
4
|
+
const _addProductMediaRequest = {};
|
|
5
|
+
const _addProductMediaResponse = {};
|
|
6
|
+
const _addProductMediaToChoicesRequest = {};
|
|
7
|
+
const _addProductMediaToChoicesResponse = {};
|
|
8
|
+
const _addProductsToCollectionRequest = {};
|
|
9
|
+
const _addProductsToCollectionResponse = {};
|
|
10
|
+
const _adjustValue = {
|
|
11
|
+
price: '_propertyAdjustmentData',
|
|
12
|
+
cost: '_propertyAdjustmentData',
|
|
13
|
+
weight: '_propertyAdjustmentData',
|
|
14
|
+
};
|
|
15
|
+
const _bulkAdjustProductPropertiesRequest = { adjust: '_adjustValue' };
|
|
16
|
+
const _bulkAdjustProductPropertiesResponse = {};
|
|
17
|
+
const _bulkUpdateProductsRequest = { set: '_setValue' };
|
|
18
|
+
const _bulkUpdateProductsResponse = {};
|
|
19
|
+
const _costAndProfitData = {
|
|
20
|
+
itemCost: 'google.protobuf.DoubleValue',
|
|
21
|
+
profit: 'DOUBLE',
|
|
22
|
+
profitMargin: 'DOUBLE',
|
|
23
|
+
};
|
|
24
|
+
const _createCollectionRequest = {};
|
|
25
|
+
const _createCollectionResponse = {};
|
|
26
|
+
const _createProductRequest = { product: '_product' };
|
|
27
|
+
const _createProductResponse = { product: '_product' };
|
|
28
|
+
const _deleteCollectionRequest = {};
|
|
29
|
+
const _deleteCollectionResponse = {};
|
|
30
|
+
const _deleteProductOptionsRequest = {};
|
|
31
|
+
const _deleteProductOptionsResponse = {};
|
|
32
|
+
const _deleteProductRequest = {};
|
|
33
|
+
const _deleteProductResponse = {};
|
|
34
|
+
const _discount = { value: 'DOUBLE' };
|
|
35
|
+
const _getProductRequest = {};
|
|
36
|
+
const _getProductResponse = { product: '_product' };
|
|
37
|
+
const _numericPropertyRange = { minValue: 'DOUBLE', maxValue: 'DOUBLE' };
|
|
38
|
+
const _priceData = {
|
|
39
|
+
price: 'google.protobuf.DoubleValue',
|
|
40
|
+
discountedPrice: 'DOUBLE',
|
|
41
|
+
pricePerUnit: 'google.protobuf.DoubleValue',
|
|
42
|
+
};
|
|
43
|
+
const _pricePerUnitData = { totalQuantity: 'DOUBLE', baseQuantity: 'DOUBLE' };
|
|
44
|
+
const _product = {
|
|
45
|
+
weight: 'google.protobuf.DoubleValue',
|
|
46
|
+
lastUpdated: 'google.protobuf.Timestamp',
|
|
47
|
+
createdDate: 'google.protobuf.Timestamp',
|
|
48
|
+
weightRange: '_numericPropertyRange',
|
|
49
|
+
price: '_priceData',
|
|
50
|
+
priceData: '_priceData',
|
|
51
|
+
convertedPriceData: '_priceData',
|
|
52
|
+
priceRange: '_numericPropertyRange',
|
|
53
|
+
costAndProfitData: '_costAndProfitData',
|
|
54
|
+
costRange: '_numericPropertyRange',
|
|
55
|
+
pricePerUnitData: '_pricePerUnitData',
|
|
56
|
+
discount: '_discount',
|
|
57
|
+
variants: '_variant',
|
|
58
|
+
};
|
|
59
|
+
const _propertyAdjustmentData = { amount: 'DOUBLE' };
|
|
60
|
+
const _queryProductsPlatformizedRequest = {};
|
|
61
|
+
const _queryProductsPlatformizedResponse = { products: '_product' };
|
|
62
|
+
const _removeProductBrandRequest = {};
|
|
63
|
+
const _removeProductBrandResponse = {};
|
|
64
|
+
const _removeProductMediaFromChoicesRequest = {};
|
|
65
|
+
const _removeProductMediaFromChoicesResponse = {};
|
|
66
|
+
const _removeProductMediaRequest = {};
|
|
67
|
+
const _removeProductMediaResponse = {};
|
|
68
|
+
const _removeProductRibbonRequest = {};
|
|
69
|
+
const _removeProductRibbonResponse = {};
|
|
70
|
+
const _removeProductsFromCollectionRequest = {};
|
|
71
|
+
const _removeProductsFromCollectionResponse = {};
|
|
72
|
+
const _resetAllVariantDataRequest = {};
|
|
73
|
+
const _resetAllVariantDataResponse = {};
|
|
74
|
+
const _setValue = { price: 'DOUBLE', cost: 'DOUBLE', weight: 'DOUBLE' };
|
|
75
|
+
const _updateCollectionRequest = {};
|
|
76
|
+
const _updateCollectionResponse = {};
|
|
77
|
+
const _updateProductRequest = { product: '_product' };
|
|
78
|
+
const _updateProductResponse = { product: '_product' };
|
|
79
|
+
const _updateVariantsRequest = { variants: '_variantOverride' };
|
|
80
|
+
const _updateVariantsResponse = { variants: '_variant' };
|
|
81
|
+
const _variant = { variant: '_variantDataWithNoStock' };
|
|
82
|
+
const _variantDataWithNoStock = {
|
|
83
|
+
weight: 'DOUBLE',
|
|
84
|
+
priceData: '_priceData',
|
|
85
|
+
convertedPriceData: '_priceData',
|
|
86
|
+
costAndProfitData: '_costAndProfitData',
|
|
87
|
+
};
|
|
88
|
+
const _variantOverride = {
|
|
89
|
+
price: 'google.protobuf.DoubleValue',
|
|
90
|
+
cost: 'google.protobuf.DoubleValue',
|
|
91
|
+
weight: 'google.protobuf.DoubleValue',
|
|
92
|
+
};
|
|
93
|
+
function resolveWixCatalogApiV1CatalogReadApiUrl(opts) {
|
|
94
|
+
const domainToMappings = {
|
|
95
|
+
'api._api_base_domain_': [
|
|
96
|
+
{
|
|
97
|
+
srcPath: '/wix-ecommerce-catalog-reader-web',
|
|
98
|
+
destPath: '',
|
|
99
|
+
},
|
|
100
|
+
],
|
|
101
|
+
'www._base_domain_': [
|
|
102
|
+
{
|
|
103
|
+
srcPath: '/wix-ecommerce-catalog-reader-web',
|
|
104
|
+
destPath: '',
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
srcPath: '/_api/catalog-reader-server',
|
|
108
|
+
destPath: '',
|
|
109
|
+
},
|
|
110
|
+
],
|
|
111
|
+
'*.dev.wix-code.com': [
|
|
112
|
+
{
|
|
113
|
+
srcPath: '/_api/catalog-reader-server',
|
|
114
|
+
destPath: '',
|
|
115
|
+
},
|
|
116
|
+
],
|
|
117
|
+
_: [
|
|
118
|
+
{
|
|
119
|
+
srcPath: '/_api/catalog-reader-server',
|
|
120
|
+
destPath: '',
|
|
121
|
+
},
|
|
122
|
+
],
|
|
123
|
+
'manage._base_domain_': [
|
|
124
|
+
{
|
|
125
|
+
srcPath: '/wix-ecommerce-catalog-reader-web',
|
|
126
|
+
destPath: '',
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
srcPath: '/_api/catalog-reader-server',
|
|
130
|
+
destPath: '',
|
|
131
|
+
},
|
|
132
|
+
],
|
|
133
|
+
};
|
|
134
|
+
return resolveUrl(Object.assign(opts, { domainToMappings }));
|
|
135
|
+
}
|
|
136
|
+
function resolveWixCatalogApiV1CatalogWriteApiUrl(opts) {
|
|
137
|
+
const domainToMappings = {
|
|
138
|
+
'api._api_base_domain_': [
|
|
139
|
+
{
|
|
140
|
+
srcPath: '/wix-ecommerce-catalog-web',
|
|
141
|
+
destPath: '',
|
|
142
|
+
},
|
|
143
|
+
],
|
|
144
|
+
'www._base_domain_': [
|
|
145
|
+
{
|
|
146
|
+
srcPath: '/_api/catalog-server',
|
|
147
|
+
destPath: '',
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
srcPath: '/wix-ecommerce-catalog',
|
|
151
|
+
destPath: '',
|
|
152
|
+
},
|
|
153
|
+
],
|
|
154
|
+
_: [
|
|
155
|
+
{
|
|
156
|
+
srcPath: '/_api/catalog-server',
|
|
157
|
+
destPath: '',
|
|
158
|
+
},
|
|
159
|
+
],
|
|
160
|
+
'ecom._base_domain_': [
|
|
161
|
+
{
|
|
162
|
+
srcPath: '/_api/catalog-server',
|
|
163
|
+
destPath: '',
|
|
164
|
+
},
|
|
165
|
+
],
|
|
166
|
+
'*.dev.wix-code.com': [
|
|
167
|
+
{
|
|
168
|
+
srcPath: '/_api/catalog-server',
|
|
169
|
+
destPath: '',
|
|
170
|
+
},
|
|
171
|
+
],
|
|
172
|
+
'*.pub.wix-code.com': [
|
|
173
|
+
{
|
|
174
|
+
srcPath: '/_api/catalog-server',
|
|
175
|
+
destPath: '',
|
|
176
|
+
},
|
|
177
|
+
],
|
|
178
|
+
'www.wixapis.com': [
|
|
179
|
+
{
|
|
180
|
+
srcPath: '/stores/v1/collections',
|
|
181
|
+
destPath: '/v1/collections',
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
srcPath: '/stores/v1/products',
|
|
185
|
+
destPath: '/v1/products',
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
srcPath: '/stores/v1/inventoryItems',
|
|
189
|
+
destPath: '/v1/inventoryItems',
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
srcPath: '/stores/v2/inventoryItems',
|
|
193
|
+
destPath: '/v2/inventoryItems',
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
srcPath: '/stores/v1/variants',
|
|
197
|
+
destPath: '/v1/variants',
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
srcPath: '/stores/v1/bulk/products',
|
|
201
|
+
destPath: '/v1/bulk/products',
|
|
202
|
+
},
|
|
203
|
+
],
|
|
204
|
+
'manage._base_domain_': [
|
|
205
|
+
{
|
|
206
|
+
srcPath: '/wix-ecommerce-catalog',
|
|
207
|
+
destPath: '',
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
srcPath: '/_api/catalog-server',
|
|
211
|
+
destPath: '',
|
|
212
|
+
},
|
|
213
|
+
],
|
|
214
|
+
'editor.wixapps.net': [
|
|
215
|
+
{
|
|
216
|
+
srcPath: '/_api/catalog-server',
|
|
217
|
+
destPath: '',
|
|
218
|
+
},
|
|
219
|
+
],
|
|
220
|
+
'www.wixgateway.com': [
|
|
221
|
+
{
|
|
222
|
+
srcPath: '/stores/v1/products',
|
|
223
|
+
destPath: '/v1/products',
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
srcPath: '/stores/v1/collections',
|
|
227
|
+
destPath: '/v1/collections',
|
|
228
|
+
},
|
|
229
|
+
],
|
|
230
|
+
};
|
|
231
|
+
return resolveUrl(Object.assign(opts, { domainToMappings }));
|
|
232
|
+
}
|
|
233
|
+
/** Creates a new product. */
|
|
234
|
+
export function createProduct(payload) {
|
|
235
|
+
const { toJSON: toReq, fromJSON: fromReq } = serializer(_createProductRequest, {
|
|
236
|
+
_costAndProfitData,
|
|
237
|
+
_discount,
|
|
238
|
+
_numericPropertyRange,
|
|
239
|
+
_priceData,
|
|
240
|
+
_pricePerUnitData,
|
|
241
|
+
_product,
|
|
242
|
+
_variant,
|
|
243
|
+
_variantDataWithNoStock,
|
|
244
|
+
});
|
|
245
|
+
const { fromJSON: fromRes } = serializer(_createProductResponse, {
|
|
246
|
+
_costAndProfitData,
|
|
247
|
+
_discount,
|
|
248
|
+
_numericPropertyRange,
|
|
249
|
+
_priceData,
|
|
250
|
+
_pricePerUnitData,
|
|
251
|
+
_product,
|
|
252
|
+
_variant,
|
|
253
|
+
_variantDataWithNoStock,
|
|
254
|
+
});
|
|
255
|
+
function __createProduct({ host }) {
|
|
256
|
+
const serializedData = toReq(payload);
|
|
257
|
+
const metadata = {
|
|
258
|
+
method: 'POST',
|
|
259
|
+
url: resolveWixCatalogApiV1CatalogWriteApiUrl({
|
|
260
|
+
protoPath: '/v1/products',
|
|
261
|
+
data: serializedData,
|
|
262
|
+
host,
|
|
263
|
+
}),
|
|
264
|
+
data: serializedData,
|
|
265
|
+
transformResponse: fromRes,
|
|
266
|
+
};
|
|
267
|
+
return metadata;
|
|
268
|
+
}
|
|
269
|
+
__createProduct.fromReq = fromReq;
|
|
270
|
+
return __createProduct;
|
|
271
|
+
}
|
|
272
|
+
/** Updates specified fields in a product. */
|
|
273
|
+
export function updateProduct(payload) {
|
|
274
|
+
const { toJSON: toReq, fromJSON: fromReq } = serializer(_updateProductRequest, {
|
|
275
|
+
_costAndProfitData,
|
|
276
|
+
_discount,
|
|
277
|
+
_numericPropertyRange,
|
|
278
|
+
_priceData,
|
|
279
|
+
_pricePerUnitData,
|
|
280
|
+
_product,
|
|
281
|
+
_variant,
|
|
282
|
+
_variantDataWithNoStock,
|
|
283
|
+
});
|
|
284
|
+
const { fromJSON: fromRes } = serializer(_updateProductResponse, {
|
|
285
|
+
_costAndProfitData,
|
|
286
|
+
_discount,
|
|
287
|
+
_numericPropertyRange,
|
|
288
|
+
_priceData,
|
|
289
|
+
_pricePerUnitData,
|
|
290
|
+
_product,
|
|
291
|
+
_variant,
|
|
292
|
+
_variantDataWithNoStock,
|
|
293
|
+
});
|
|
294
|
+
function __updateProduct({ host }) {
|
|
295
|
+
const serializedData = toReq(payload);
|
|
296
|
+
const metadata = {
|
|
297
|
+
method: 'PATCH',
|
|
298
|
+
url: resolveWixCatalogApiV1CatalogWriteApiUrl({
|
|
299
|
+
protoPath: '/v1/products/{product.id}',
|
|
300
|
+
data: serializedData,
|
|
301
|
+
host,
|
|
302
|
+
}),
|
|
303
|
+
data: serializedData,
|
|
304
|
+
transformResponse: fromRes,
|
|
305
|
+
};
|
|
306
|
+
return metadata;
|
|
307
|
+
}
|
|
308
|
+
__updateProduct.fromReq = fromReq;
|
|
309
|
+
return __updateProduct;
|
|
310
|
+
}
|
|
311
|
+
/** Deletes a product. */
|
|
312
|
+
export function deleteProduct(payload) {
|
|
313
|
+
const { toJSON: toReq, fromJSON: fromReq } = serializer(_deleteProductRequest, {});
|
|
314
|
+
const { fromJSON: fromRes } = serializer(_deleteProductResponse, {});
|
|
315
|
+
function __deleteProduct({ host }) {
|
|
316
|
+
const serializedData = toReq(payload);
|
|
317
|
+
const metadata = {
|
|
318
|
+
method: 'DELETE',
|
|
319
|
+
url: resolveWixCatalogApiV1CatalogWriteApiUrl({
|
|
320
|
+
protoPath: '/v1/products/{id}',
|
|
321
|
+
data: serializedData,
|
|
322
|
+
host,
|
|
323
|
+
}),
|
|
324
|
+
params: toURLSearchParams(serializedData),
|
|
325
|
+
transformResponse: fromRes,
|
|
326
|
+
};
|
|
327
|
+
return metadata;
|
|
328
|
+
}
|
|
329
|
+
__deleteProduct.fromReq = fromReq;
|
|
330
|
+
return __deleteProduct;
|
|
331
|
+
}
|
|
332
|
+
/** Updates variants of a specified product. */
|
|
333
|
+
export function updateVariants(payload) {
|
|
334
|
+
const { toJSON: toReq, fromJSON: fromReq } = serializer(_updateVariantsRequest, { _variantOverride });
|
|
335
|
+
const { fromJSON: fromRes } = serializer(_updateVariantsResponse, {
|
|
336
|
+
_costAndProfitData,
|
|
337
|
+
_priceData,
|
|
338
|
+
_variant,
|
|
339
|
+
_variantDataWithNoStock,
|
|
340
|
+
});
|
|
341
|
+
function __updateVariants({ host }) {
|
|
342
|
+
const serializedData = toReq(payload);
|
|
343
|
+
const metadata = {
|
|
344
|
+
method: 'PATCH',
|
|
345
|
+
url: resolveWixCatalogApiV1CatalogWriteApiUrl({
|
|
346
|
+
protoPath: '/v1/products/{id}/variants',
|
|
347
|
+
data: serializedData,
|
|
348
|
+
host,
|
|
349
|
+
}),
|
|
350
|
+
data: serializedData,
|
|
351
|
+
transformResponse: fromRes,
|
|
352
|
+
};
|
|
353
|
+
return metadata;
|
|
354
|
+
}
|
|
355
|
+
__updateVariants.fromReq = fromReq;
|
|
356
|
+
return __updateVariants;
|
|
357
|
+
}
|
|
358
|
+
/** Resets all variant information to default values (price = current product price; weight = current product weight; SKU = current product SKU; visibility = true). */
|
|
359
|
+
export function resetAllVariantData(payload) {
|
|
360
|
+
const { toJSON: toReq, fromJSON: fromReq } = serializer(_resetAllVariantDataRequest, {});
|
|
361
|
+
const { fromJSON: fromRes } = serializer(_resetAllVariantDataResponse, {});
|
|
362
|
+
function __resetAllVariantData({ host }) {
|
|
363
|
+
const serializedData = toReq(payload);
|
|
364
|
+
const metadata = {
|
|
365
|
+
method: 'POST',
|
|
366
|
+
url: resolveWixCatalogApiV1CatalogWriteApiUrl({
|
|
367
|
+
protoPath: '/v1/products/{id}/variants/resetToDefault',
|
|
368
|
+
data: serializedData,
|
|
369
|
+
host,
|
|
370
|
+
}),
|
|
371
|
+
data: serializedData,
|
|
372
|
+
transformResponse: fromRes,
|
|
373
|
+
};
|
|
374
|
+
return metadata;
|
|
375
|
+
}
|
|
376
|
+
__resetAllVariantData.fromReq = fromReq;
|
|
377
|
+
return __resetAllVariantData;
|
|
378
|
+
}
|
|
379
|
+
/** Adds products to a specified collection. */
|
|
380
|
+
export function addProductsToCollection(payload) {
|
|
381
|
+
const { toJSON: toReq, fromJSON: fromReq } = serializer(_addProductsToCollectionRequest, {});
|
|
382
|
+
const { fromJSON: fromRes } = serializer(_addProductsToCollectionResponse, {});
|
|
383
|
+
function __addProductsToCollection({ host }) {
|
|
384
|
+
const serializedData = toReq(payload);
|
|
385
|
+
const metadata = {
|
|
386
|
+
method: 'POST',
|
|
387
|
+
url: resolveWixCatalogApiV1CatalogWriteApiUrl({
|
|
388
|
+
protoPath: '/v1/collections/{id}/productIds',
|
|
389
|
+
data: serializedData,
|
|
390
|
+
host,
|
|
391
|
+
}),
|
|
392
|
+
data: serializedData,
|
|
393
|
+
transformResponse: fromRes,
|
|
394
|
+
};
|
|
395
|
+
return metadata;
|
|
396
|
+
}
|
|
397
|
+
__addProductsToCollection.fromReq = fromReq;
|
|
398
|
+
return __addProductsToCollection;
|
|
399
|
+
}
|
|
400
|
+
/** Deletes products from a specified collection. */
|
|
401
|
+
export function removeProductsFromCollection(payload) {
|
|
402
|
+
const { toJSON: toReq, fromJSON: fromReq } = serializer(_removeProductsFromCollectionRequest, {});
|
|
403
|
+
const { fromJSON: fromRes } = serializer(_removeProductsFromCollectionResponse, {});
|
|
404
|
+
function __removeProductsFromCollection({ host }) {
|
|
405
|
+
const serializedData = toReq(payload);
|
|
406
|
+
const metadata = {
|
|
407
|
+
method: 'POST',
|
|
408
|
+
url: resolveWixCatalogApiV1CatalogWriteApiUrl({
|
|
409
|
+
protoPath: '/v1/collections/{id}/productIds/delete',
|
|
410
|
+
data: serializedData,
|
|
411
|
+
host,
|
|
412
|
+
}),
|
|
413
|
+
data: serializedData,
|
|
414
|
+
transformResponse: fromRes,
|
|
415
|
+
};
|
|
416
|
+
return metadata;
|
|
417
|
+
}
|
|
418
|
+
__removeProductsFromCollection.fromReq = fromReq;
|
|
419
|
+
return __removeProductsFromCollection;
|
|
420
|
+
}
|
|
421
|
+
/** Adds media items to a specified product, either via URL or existing media ID. */
|
|
422
|
+
export function addProductMedia(payload) {
|
|
423
|
+
const { toJSON: toReq, fromJSON: fromReq } = serializer(_addProductMediaRequest, {});
|
|
424
|
+
const { fromJSON: fromRes } = serializer(_addProductMediaResponse, {});
|
|
425
|
+
function __addProductMedia({ host }) {
|
|
426
|
+
const serializedData = toReq(payload);
|
|
427
|
+
const metadata = {
|
|
428
|
+
method: 'POST',
|
|
429
|
+
url: resolveWixCatalogApiV1CatalogWriteApiUrl({
|
|
430
|
+
protoPath: '/v1/products/{id}/media',
|
|
431
|
+
data: serializedData,
|
|
432
|
+
host,
|
|
433
|
+
}),
|
|
434
|
+
data: serializedData,
|
|
435
|
+
transformResponse: fromRes,
|
|
436
|
+
};
|
|
437
|
+
return metadata;
|
|
438
|
+
}
|
|
439
|
+
__addProductMedia.fromReq = fromReq;
|
|
440
|
+
return __addProductMedia;
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
443
|
+
* Removes specified media items from a product.
|
|
444
|
+
* Pass an empty array to remove all media items.
|
|
445
|
+
*/
|
|
446
|
+
export function removeProductMedia(payload) {
|
|
447
|
+
const { toJSON: toReq, fromJSON: fromReq } = serializer(_removeProductMediaRequest, {});
|
|
448
|
+
const { fromJSON: fromRes } = serializer(_removeProductMediaResponse, {});
|
|
449
|
+
function __removeProductMedia({ host }) {
|
|
450
|
+
const serializedData = toReq(payload);
|
|
451
|
+
const metadata = {
|
|
452
|
+
method: 'POST',
|
|
453
|
+
url: resolveWixCatalogApiV1CatalogWriteApiUrl({
|
|
454
|
+
protoPath: '/v1/products/{id}/media/delete',
|
|
455
|
+
data: serializedData,
|
|
456
|
+
host,
|
|
457
|
+
}),
|
|
458
|
+
data: serializedData,
|
|
459
|
+
transformResponse: fromRes,
|
|
460
|
+
};
|
|
461
|
+
return metadata;
|
|
462
|
+
}
|
|
463
|
+
__removeProductMedia.fromReq = fromReq;
|
|
464
|
+
return __removeProductMedia;
|
|
465
|
+
}
|
|
466
|
+
/**
|
|
467
|
+
* Links media items that are already associated with a specific product to a choice within the same product.
|
|
468
|
+
*
|
|
469
|
+
* 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).
|
|
470
|
+
*
|
|
471
|
+
* 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.
|
|
472
|
+
*/
|
|
473
|
+
export function addProductMediaToChoices(payload) {
|
|
474
|
+
const { toJSON: toReq, fromJSON: fromReq } = serializer(_addProductMediaToChoicesRequest, {});
|
|
475
|
+
const { fromJSON: fromRes } = serializer(_addProductMediaToChoicesResponse, {});
|
|
476
|
+
function __addProductMediaToChoices({ host }) {
|
|
477
|
+
const serializedData = toReq(payload);
|
|
478
|
+
const metadata = {
|
|
479
|
+
method: 'PATCH',
|
|
480
|
+
url: resolveWixCatalogApiV1CatalogWriteApiUrl({
|
|
481
|
+
protoPath: '/v1/products/{id}/choices/media',
|
|
482
|
+
data: serializedData,
|
|
483
|
+
host,
|
|
484
|
+
}),
|
|
485
|
+
data: serializedData,
|
|
486
|
+
transformResponse: fromRes,
|
|
487
|
+
};
|
|
488
|
+
return metadata;
|
|
489
|
+
}
|
|
490
|
+
__addProductMediaToChoices.fromReq = fromReq;
|
|
491
|
+
return __addProductMediaToChoices;
|
|
492
|
+
}
|
|
493
|
+
/**
|
|
494
|
+
* Removes media items from all or some of a product's choices.
|
|
495
|
+
* (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).)
|
|
496
|
+
*/
|
|
497
|
+
export function removeProductMediaFromChoices(payload) {
|
|
498
|
+
const { toJSON: toReq, fromJSON: fromReq } = serializer(_removeProductMediaFromChoicesRequest, {});
|
|
499
|
+
const { fromJSON: fromRes } = serializer(_removeProductMediaFromChoicesResponse, {});
|
|
500
|
+
function __removeProductMediaFromChoices({ host }) {
|
|
501
|
+
const serializedData = toReq(payload);
|
|
502
|
+
const metadata = {
|
|
503
|
+
method: 'POST',
|
|
504
|
+
url: resolveWixCatalogApiV1CatalogWriteApiUrl({
|
|
505
|
+
protoPath: '/v1/products/{id}/choices/media/delete',
|
|
506
|
+
data: serializedData,
|
|
507
|
+
host,
|
|
508
|
+
}),
|
|
509
|
+
data: serializedData,
|
|
510
|
+
transformResponse: fromRes,
|
|
511
|
+
};
|
|
512
|
+
return metadata;
|
|
513
|
+
}
|
|
514
|
+
__removeProductMediaFromChoices.fromReq = fromReq;
|
|
515
|
+
return __removeProductMediaFromChoices;
|
|
516
|
+
}
|
|
517
|
+
/** Delete all options from a specific product (only available when variant management is disabled). */
|
|
518
|
+
export function deleteProductOptions(payload) {
|
|
519
|
+
const { toJSON: toReq, fromJSON: fromReq } = serializer(_deleteProductOptionsRequest, {});
|
|
520
|
+
const { fromJSON: fromRes } = serializer(_deleteProductOptionsResponse, {});
|
|
521
|
+
function __deleteProductOptions({ host }) {
|
|
522
|
+
const serializedData = toReq(payload);
|
|
523
|
+
const metadata = {
|
|
524
|
+
method: 'DELETE',
|
|
525
|
+
url: resolveWixCatalogApiV1CatalogWriteApiUrl({
|
|
526
|
+
protoPath: '/v1/products/{id}/options',
|
|
527
|
+
data: serializedData,
|
|
528
|
+
host,
|
|
529
|
+
}),
|
|
530
|
+
params: toURLSearchParams(serializedData),
|
|
531
|
+
transformResponse: fromRes,
|
|
532
|
+
};
|
|
533
|
+
return metadata;
|
|
534
|
+
}
|
|
535
|
+
__deleteProductOptions.fromReq = fromReq;
|
|
536
|
+
return __deleteProductOptions;
|
|
537
|
+
}
|
|
538
|
+
/** Deletes a product's brand. */
|
|
539
|
+
export function removeBrand(payload) {
|
|
540
|
+
const { toJSON: toReq, fromJSON: fromReq } = serializer(_removeProductBrandRequest, {});
|
|
541
|
+
const { fromJSON: fromRes } = serializer(_removeProductBrandResponse, {});
|
|
542
|
+
function __removeBrand({ host }) {
|
|
543
|
+
const serializedData = toReq(payload);
|
|
544
|
+
const metadata = {
|
|
545
|
+
method: 'POST',
|
|
546
|
+
url: resolveWixCatalogApiV1CatalogWriteApiUrl({
|
|
547
|
+
protoPath: '/v1/products/{id}/remove-brand',
|
|
548
|
+
data: serializedData,
|
|
549
|
+
host,
|
|
550
|
+
}),
|
|
551
|
+
data: serializedData,
|
|
552
|
+
transformResponse: fromRes,
|
|
553
|
+
};
|
|
554
|
+
return metadata;
|
|
555
|
+
}
|
|
556
|
+
__removeBrand.fromReq = fromReq;
|
|
557
|
+
return __removeBrand;
|
|
558
|
+
}
|
|
559
|
+
/** Creates a new collection. */
|
|
560
|
+
export function createCollection(payload) {
|
|
561
|
+
const { toJSON: toReq, fromJSON: fromReq } = serializer(_createCollectionRequest, {});
|
|
562
|
+
const { fromJSON: fromRes } = serializer(_createCollectionResponse, {});
|
|
563
|
+
function __createCollection({ host }) {
|
|
564
|
+
const serializedData = toReq(payload);
|
|
565
|
+
const metadata = {
|
|
566
|
+
method: 'POST',
|
|
567
|
+
url: resolveWixCatalogApiV1CatalogWriteApiUrl({
|
|
568
|
+
protoPath: '/v1/collections',
|
|
569
|
+
data: serializedData,
|
|
570
|
+
host,
|
|
571
|
+
}),
|
|
572
|
+
data: serializedData,
|
|
573
|
+
transformResponse: fromRes,
|
|
574
|
+
};
|
|
575
|
+
return metadata;
|
|
576
|
+
}
|
|
577
|
+
__createCollection.fromReq = fromReq;
|
|
578
|
+
return __createCollection;
|
|
579
|
+
}
|
|
580
|
+
/**
|
|
581
|
+
* Updates specified properties of a collection.
|
|
582
|
+
* To add products to a collection, call the [Add Products to Collection](https://dev.wix.com/api/rest/wix-stores/catalog/collection/add-products-to-collection) endpoint.
|
|
583
|
+
*/
|
|
584
|
+
export function updateCollection(payload) {
|
|
585
|
+
const { toJSON: toReq, fromJSON: fromReq } = serializer(_updateCollectionRequest, {});
|
|
586
|
+
const { fromJSON: fromRes } = serializer(_updateCollectionResponse, {});
|
|
587
|
+
function __updateCollection({ host }) {
|
|
588
|
+
const serializedData = toReq(payload);
|
|
589
|
+
const metadata = {
|
|
590
|
+
method: 'PATCH',
|
|
591
|
+
url: resolveWixCatalogApiV1CatalogWriteApiUrl({
|
|
592
|
+
protoPath: '/v1/collections/{collection.id}',
|
|
593
|
+
data: serializedData,
|
|
594
|
+
host,
|
|
595
|
+
}),
|
|
596
|
+
data: serializedData,
|
|
597
|
+
transformResponse: fromRes,
|
|
598
|
+
};
|
|
599
|
+
return metadata;
|
|
600
|
+
}
|
|
601
|
+
__updateCollection.fromReq = fromReq;
|
|
602
|
+
return __updateCollection;
|
|
603
|
+
}
|
|
604
|
+
/** Deletes a collection. */
|
|
605
|
+
export function deleteCollection(payload) {
|
|
606
|
+
const { toJSON: toReq, fromJSON: fromReq } = serializer(_deleteCollectionRequest, {});
|
|
607
|
+
const { fromJSON: fromRes } = serializer(_deleteCollectionResponse, {});
|
|
608
|
+
function __deleteCollection({ host }) {
|
|
609
|
+
const serializedData = toReq(payload);
|
|
610
|
+
const metadata = {
|
|
611
|
+
method: 'DELETE',
|
|
612
|
+
url: resolveWixCatalogApiV1CatalogWriteApiUrl({
|
|
613
|
+
protoPath: '/v1/collections/{id}',
|
|
614
|
+
data: serializedData,
|
|
615
|
+
host,
|
|
616
|
+
}),
|
|
617
|
+
params: toURLSearchParams(serializedData),
|
|
618
|
+
transformResponse: fromRes,
|
|
619
|
+
};
|
|
620
|
+
return metadata;
|
|
621
|
+
}
|
|
622
|
+
__deleteCollection.fromReq = fromReq;
|
|
623
|
+
return __deleteCollection;
|
|
624
|
+
}
|
|
625
|
+
/** Deletes a product's ribbon. */
|
|
626
|
+
export function removeRibbon(payload) {
|
|
627
|
+
const { toJSON: toReq, fromJSON: fromReq } = serializer(_removeProductRibbonRequest, {});
|
|
628
|
+
const { fromJSON: fromRes } = serializer(_removeProductRibbonResponse, {});
|
|
629
|
+
function __removeRibbon({ host }) {
|
|
630
|
+
const serializedData = toReq(payload);
|
|
631
|
+
const metadata = {
|
|
632
|
+
method: 'POST',
|
|
633
|
+
url: resolveWixCatalogApiV1CatalogWriteApiUrl({
|
|
634
|
+
protoPath: '/v1/products/{id}/remove-ribbon',
|
|
635
|
+
data: serializedData,
|
|
636
|
+
host,
|
|
637
|
+
}),
|
|
638
|
+
data: serializedData,
|
|
639
|
+
transformResponse: fromRes,
|
|
640
|
+
};
|
|
641
|
+
return metadata;
|
|
642
|
+
}
|
|
643
|
+
__removeRibbon.fromReq = fromReq;
|
|
644
|
+
return __removeRibbon;
|
|
645
|
+
}
|
|
646
|
+
/** Updates a specified property for up to 100 products at a time. */
|
|
647
|
+
export function bulkUpdateProducts(payload) {
|
|
648
|
+
const { toJSON: toReq, fromJSON: fromReq } = serializer(_bulkUpdateProductsRequest, { _setValue });
|
|
649
|
+
const { fromJSON: fromRes } = serializer(_bulkUpdateProductsResponse, {});
|
|
650
|
+
function __bulkUpdateProducts({ host }) {
|
|
651
|
+
const serializedData = toReq(payload);
|
|
652
|
+
const metadata = {
|
|
653
|
+
method: 'POST',
|
|
654
|
+
url: resolveWixCatalogApiV1CatalogWriteApiUrl({
|
|
655
|
+
protoPath: '/v1/bulk/products/update',
|
|
656
|
+
data: serializedData,
|
|
657
|
+
host,
|
|
658
|
+
}),
|
|
659
|
+
data: serializedData,
|
|
660
|
+
transformResponse: fromRes,
|
|
661
|
+
};
|
|
662
|
+
return metadata;
|
|
663
|
+
}
|
|
664
|
+
__bulkUpdateProducts.fromReq = fromReq;
|
|
665
|
+
return __bulkUpdateProducts;
|
|
666
|
+
}
|
|
667
|
+
/**
|
|
668
|
+
* Adjusts a specified numerical property for up to 100 products at a time.
|
|
669
|
+
* The property can be increased or decreased either by percentage or amount.
|
|
670
|
+
*/
|
|
671
|
+
export function bulkAdjustProductProperties(payload) {
|
|
672
|
+
const { toJSON: toReq, fromJSON: fromReq } = serializer(_bulkAdjustProductPropertiesRequest, { _adjustValue, _propertyAdjustmentData });
|
|
673
|
+
const { fromJSON: fromRes } = serializer(_bulkAdjustProductPropertiesResponse, {});
|
|
674
|
+
function __bulkAdjustProductProperties({ host }) {
|
|
675
|
+
const serializedData = toReq(payload);
|
|
676
|
+
const metadata = {
|
|
677
|
+
method: 'POST',
|
|
678
|
+
url: resolveWixCatalogApiV1CatalogWriteApiUrl({
|
|
679
|
+
protoPath: '/v1/bulk/products/adjust-properties',
|
|
680
|
+
data: serializedData,
|
|
681
|
+
host,
|
|
682
|
+
}),
|
|
683
|
+
data: serializedData,
|
|
684
|
+
transformResponse: fromRes,
|
|
685
|
+
};
|
|
686
|
+
return metadata;
|
|
687
|
+
}
|
|
688
|
+
__bulkAdjustProductProperties.fromReq = fromReq;
|
|
689
|
+
return __bulkAdjustProductProperties;
|
|
690
|
+
}
|
|
691
|
+
/** Returns a list of up to 100 products, given the provided paging, sorting and filtering. */
|
|
692
|
+
export function queryProductsPlatformized(payload) {
|
|
693
|
+
const { toJSON: toReq, fromJSON: fromReq } = serializer(_queryProductsPlatformizedRequest, {});
|
|
694
|
+
const { fromJSON: fromRes } = serializer(_queryProductsPlatformizedResponse, {
|
|
695
|
+
_costAndProfitData,
|
|
696
|
+
_discount,
|
|
697
|
+
_numericPropertyRange,
|
|
698
|
+
_priceData,
|
|
699
|
+
_pricePerUnitData,
|
|
700
|
+
_product,
|
|
701
|
+
_variant,
|
|
702
|
+
_variantDataWithNoStock,
|
|
703
|
+
});
|
|
704
|
+
function __queryProductsPlatformized({ host }) {
|
|
705
|
+
const serializedData = toReq(payload);
|
|
706
|
+
const metadata = {
|
|
707
|
+
method: 'POST',
|
|
708
|
+
url: resolveWixCatalogApiV1CatalogReadApiUrl({
|
|
709
|
+
protoPath: '/v1/products/query-platformized',
|
|
710
|
+
data: serializedData,
|
|
711
|
+
host,
|
|
712
|
+
}),
|
|
713
|
+
data: serializedData,
|
|
714
|
+
transformResponse: fromRes,
|
|
715
|
+
};
|
|
716
|
+
return metadata;
|
|
717
|
+
}
|
|
718
|
+
__queryProductsPlatformized.fromReq = fromReq;
|
|
719
|
+
return __queryProductsPlatformized;
|
|
720
|
+
}
|
|
721
|
+
/** Retrieves a product with the provided ID. */
|
|
722
|
+
export function getProduct(payload) {
|
|
723
|
+
const { toJSON: toReq, fromJSON: fromReq } = serializer(_getProductRequest, {});
|
|
724
|
+
const { fromJSON: fromRes } = serializer(_getProductResponse, {
|
|
725
|
+
_costAndProfitData,
|
|
726
|
+
_discount,
|
|
727
|
+
_numericPropertyRange,
|
|
728
|
+
_priceData,
|
|
729
|
+
_pricePerUnitData,
|
|
730
|
+
_product,
|
|
731
|
+
_variant,
|
|
732
|
+
_variantDataWithNoStock,
|
|
733
|
+
});
|
|
734
|
+
function __getProduct({ host }) {
|
|
735
|
+
const serializedData = toReq(payload);
|
|
736
|
+
const metadata = {
|
|
737
|
+
method: 'GET',
|
|
738
|
+
url: resolveWixCatalogApiV1CatalogReadApiUrl({
|
|
739
|
+
protoPath: '/v1/products/{id}',
|
|
740
|
+
data: serializedData,
|
|
741
|
+
host,
|
|
742
|
+
}),
|
|
743
|
+
params: toURLSearchParams(serializedData),
|
|
744
|
+
transformResponse: fromRes,
|
|
745
|
+
};
|
|
746
|
+
return metadata;
|
|
747
|
+
}
|
|
748
|
+
__getProduct.fromReq = fromReq;
|
|
749
|
+
return __getProduct;
|
|
750
|
+
}
|
|
751
|
+
//# sourceMappingURL=stores-catalog-v1-product.http.js.map
|