@wix/auto_sdk_stores_customizations-v-3 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/index.d.ts +1 -0
- package/build/cjs/index.js +18 -0
- package/build/cjs/index.js.map +1 -0
- package/build/cjs/index.typings.d.ts +1 -0
- package/build/cjs/index.typings.js +18 -0
- package/build/cjs/index.typings.js.map +1 -0
- package/build/cjs/meta.d.ts +1 -0
- package/build/cjs/meta.js +18 -0
- package/build/cjs/meta.js.map +1 -0
- package/build/cjs/src/stores-catalog-v3-customization-customizations-v-3.context.d.ts +31 -0
- package/build/cjs/src/stores-catalog-v3-customization-customizations-v-3.context.js +40 -0
- package/build/cjs/src/stores-catalog-v3-customization-customizations-v-3.context.js.map +1 -0
- package/build/cjs/src/stores-catalog-v3-customization-customizations-v-3.http.d.ts +63 -0
- package/build/cjs/src/stores-catalog-v3-customization-customizations-v-3.http.js +683 -0
- package/build/cjs/src/stores-catalog-v3-customization-customizations-v-3.http.js.map +1 -0
- package/build/cjs/src/stores-catalog-v3-customization-customizations-v-3.meta.d.ts +35 -0
- package/build/cjs/src/stores-catalog-v3-customization-customizations-v-3.meta.js +237 -0
- package/build/cjs/src/stores-catalog-v3-customization-customizations-v-3.meta.js.map +1 -0
- package/build/cjs/src/stores-catalog-v3-customization-customizations-v-3.public.d.ts +130 -0
- package/build/cjs/src/stores-catalog-v3-customization-customizations-v-3.public.js +126 -0
- package/build/cjs/src/stores-catalog-v3-customization-customizations-v-3.public.js.map +1 -0
- package/build/cjs/src/stores-catalog-v3-customization-customizations-v-3.types.d.ts +736 -0
- package/build/cjs/src/stores-catalog-v3-customization-customizations-v-3.types.js +51 -0
- package/build/cjs/src/stores-catalog-v3-customization-customizations-v-3.types.js.map +1 -0
- package/build/cjs/src/stores-catalog-v3-customization-customizations-v-3.universal.d.ts +1281 -0
- package/build/cjs/src/stores-catalog-v3-customization-customizations-v-3.universal.js +764 -0
- package/build/cjs/src/stores-catalog-v3-customization-customizations-v-3.universal.js.map +1 -0
- package/build/es/index.d.ts +1 -0
- package/build/es/index.js +2 -0
- package/build/es/index.js.map +1 -0
- package/build/es/index.typings.d.ts +1 -0
- package/build/es/index.typings.js +2 -0
- package/build/es/index.typings.js.map +1 -0
- package/build/es/meta.d.ts +1 -0
- package/build/es/meta.js +2 -0
- package/build/es/meta.js.map +1 -0
- package/build/es/package.json +3 -0
- package/build/es/src/stores-catalog-v3-customization-customizations-v-3.context.d.ts +31 -0
- package/build/es/src/stores-catalog-v3-customization-customizations-v-3.context.js +31 -0
- package/build/es/src/stores-catalog-v3-customization-customizations-v-3.context.js.map +1 -0
- package/build/es/src/stores-catalog-v3-customization-customizations-v-3.http.d.ts +63 -0
- package/build/es/src/stores-catalog-v3-customization-customizations-v-3.http.js +669 -0
- package/build/es/src/stores-catalog-v3-customization-customizations-v-3.http.js.map +1 -0
- package/build/es/src/stores-catalog-v3-customization-customizations-v-3.meta.d.ts +35 -0
- package/build/es/src/stores-catalog-v3-customization-customizations-v-3.meta.js +200 -0
- package/build/es/src/stores-catalog-v3-customization-customizations-v-3.meta.js.map +1 -0
- package/build/es/src/stores-catalog-v3-customization-customizations-v-3.public.d.ts +130 -0
- package/build/es/src/stores-catalog-v3-customization-customizations-v-3.public.js +106 -0
- package/build/es/src/stores-catalog-v3-customization-customizations-v-3.public.js.map +1 -0
- package/build/es/src/stores-catalog-v3-customization-customizations-v-3.types.d.ts +736 -0
- package/build/es/src/stores-catalog-v3-customization-customizations-v-3.types.js +48 -0
- package/build/es/src/stores-catalog-v3-customization-customizations-v-3.types.js.map +1 -0
- package/build/es/src/stores-catalog-v3-customization-customizations-v-3.universal.d.ts +1281 -0
- package/build/es/src/stores-catalog-v3-customization-customizations-v-3.universal.js +727 -0
- package/build/es/src/stores-catalog-v3-customization-customizations-v-3.universal.js.map +1 -0
- package/build/internal/cjs/index.d.ts +1 -0
- package/build/internal/cjs/index.js +18 -0
- package/build/internal/cjs/index.js.map +1 -0
- package/build/internal/cjs/index.typings.d.ts +1 -0
- package/build/internal/cjs/index.typings.js +18 -0
- package/build/internal/cjs/index.typings.js.map +1 -0
- package/build/internal/cjs/meta.d.ts +1 -0
- package/build/internal/cjs/meta.js +18 -0
- package/build/internal/cjs/meta.js.map +1 -0
- package/build/internal/cjs/src/stores-catalog-v3-customization-customizations-v-3.context.d.ts +31 -0
- package/build/internal/cjs/src/stores-catalog-v3-customization-customizations-v-3.context.js +40 -0
- package/build/internal/cjs/src/stores-catalog-v3-customization-customizations-v-3.context.js.map +1 -0
- package/build/internal/cjs/src/stores-catalog-v3-customization-customizations-v-3.http.d.ts +63 -0
- package/build/internal/cjs/src/stores-catalog-v3-customization-customizations-v-3.http.js +683 -0
- package/build/internal/cjs/src/stores-catalog-v3-customization-customizations-v-3.http.js.map +1 -0
- package/build/internal/cjs/src/stores-catalog-v3-customization-customizations-v-3.meta.d.ts +35 -0
- package/build/internal/cjs/src/stores-catalog-v3-customization-customizations-v-3.meta.js +237 -0
- package/build/internal/cjs/src/stores-catalog-v3-customization-customizations-v-3.meta.js.map +1 -0
- package/build/internal/cjs/src/stores-catalog-v3-customization-customizations-v-3.public.d.ts +130 -0
- package/build/internal/cjs/src/stores-catalog-v3-customization-customizations-v-3.public.js +126 -0
- package/build/internal/cjs/src/stores-catalog-v3-customization-customizations-v-3.public.js.map +1 -0
- package/build/internal/cjs/src/stores-catalog-v3-customization-customizations-v-3.types.d.ts +736 -0
- package/build/internal/cjs/src/stores-catalog-v3-customization-customizations-v-3.types.js +51 -0
- package/build/internal/cjs/src/stores-catalog-v3-customization-customizations-v-3.types.js.map +1 -0
- package/build/internal/cjs/src/stores-catalog-v3-customization-customizations-v-3.universal.d.ts +1281 -0
- package/build/internal/cjs/src/stores-catalog-v3-customization-customizations-v-3.universal.js +764 -0
- package/build/internal/cjs/src/stores-catalog-v3-customization-customizations-v-3.universal.js.map +1 -0
- package/build/internal/es/index.d.ts +1 -0
- package/build/internal/es/index.js +2 -0
- package/build/internal/es/index.js.map +1 -0
- package/build/internal/es/index.typings.d.ts +1 -0
- package/build/internal/es/index.typings.js +2 -0
- package/build/internal/es/index.typings.js.map +1 -0
- package/build/internal/es/meta.d.ts +1 -0
- package/build/internal/es/meta.js +2 -0
- package/build/internal/es/meta.js.map +1 -0
- package/build/internal/es/src/stores-catalog-v3-customization-customizations-v-3.context.d.ts +31 -0
- package/build/internal/es/src/stores-catalog-v3-customization-customizations-v-3.context.js +31 -0
- package/build/internal/es/src/stores-catalog-v3-customization-customizations-v-3.context.js.map +1 -0
- package/build/internal/es/src/stores-catalog-v3-customization-customizations-v-3.http.d.ts +63 -0
- package/build/internal/es/src/stores-catalog-v3-customization-customizations-v-3.http.js +669 -0
- package/build/internal/es/src/stores-catalog-v3-customization-customizations-v-3.http.js.map +1 -0
- package/build/internal/es/src/stores-catalog-v3-customization-customizations-v-3.meta.d.ts +35 -0
- package/build/internal/es/src/stores-catalog-v3-customization-customizations-v-3.meta.js +200 -0
- package/build/internal/es/src/stores-catalog-v3-customization-customizations-v-3.meta.js.map +1 -0
- package/build/internal/es/src/stores-catalog-v3-customization-customizations-v-3.public.d.ts +130 -0
- package/build/internal/es/src/stores-catalog-v3-customization-customizations-v-3.public.js +106 -0
- package/build/internal/es/src/stores-catalog-v3-customization-customizations-v-3.public.js.map +1 -0
- package/build/internal/es/src/stores-catalog-v3-customization-customizations-v-3.types.d.ts +736 -0
- package/build/internal/es/src/stores-catalog-v3-customization-customizations-v-3.types.js +48 -0
- package/build/internal/es/src/stores-catalog-v3-customization-customizations-v-3.types.js.map +1 -0
- package/build/internal/es/src/stores-catalog-v3-customization-customizations-v-3.universal.d.ts +1281 -0
- package/build/internal/es/src/stores-catalog-v3-customization-customizations-v-3.universal.js +727 -0
- package/build/internal/es/src/stores-catalog-v3-customization-customizations-v-3.universal.js.map +1 -0
- package/meta/package.json +3 -0
- package/package.json +52 -0
package/build/internal/cjs/src/stores-catalog-v3-customization-customizations-v-3.universal.js
ADDED
|
@@ -0,0 +1,764 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.bulkUpdateCustomizations = exports.bulkAddCustomizationChoices = exports.removeCustomizationChoices = exports.setCustomizationChoices = exports.addCustomizationChoices = exports.bulkCreateCustomizations = exports.queryCustomizations = exports.deleteCustomization = exports.updateCustomization = exports.getCustomization = exports.createCustomization = exports.WebhookIdentityType = exports.SortOrder = exports.RequestedFields = exports.ChoiceType = exports.CustomizationRenderType = exports.CustomizationType = void 0;
|
|
27
|
+
const transform_error_1 = require("@wix/sdk-runtime/transform-error");
|
|
28
|
+
const query_builder_1 = require("@wix/sdk-runtime/query-builder");
|
|
29
|
+
const rename_all_nested_keys_1 = require("@wix/sdk-runtime/rename-all-nested-keys");
|
|
30
|
+
const ambassadorWixStoresCatalogV3Customization = __importStar(require("./stores-catalog-v3-customization-customizations-v-3.http.js"));
|
|
31
|
+
// @ts-ignore
|
|
32
|
+
const image_1 = require("@wix/sdk-runtime/transformations/image");
|
|
33
|
+
const image_2 = require("@wix/sdk-runtime/transformations/image");
|
|
34
|
+
const transform_paths_1 = require("@wix/sdk-runtime/transformations/transform-paths");
|
|
35
|
+
var CustomizationType;
|
|
36
|
+
(function (CustomizationType) {
|
|
37
|
+
CustomizationType["UNKNOWN_CUSTOMIZATION_TYPE"] = "UNKNOWN_CUSTOMIZATION_TYPE";
|
|
38
|
+
CustomizationType["PRODUCT_OPTION"] = "PRODUCT_OPTION";
|
|
39
|
+
CustomizationType["MODIFIER"] = "MODIFIER";
|
|
40
|
+
})(CustomizationType || (exports.CustomizationType = CustomizationType = {}));
|
|
41
|
+
var CustomizationRenderType;
|
|
42
|
+
(function (CustomizationRenderType) {
|
|
43
|
+
CustomizationRenderType["UNKNOWN_CUSTOMIZATION_RENDER_TYPE"] = "UNKNOWN_CUSTOMIZATION_RENDER_TYPE";
|
|
44
|
+
CustomizationRenderType["FREE_TEXT"] = "FREE_TEXT";
|
|
45
|
+
CustomizationRenderType["TEXT_CHOICES"] = "TEXT_CHOICES";
|
|
46
|
+
CustomizationRenderType["SWATCH_CHOICES"] = "SWATCH_CHOICES";
|
|
47
|
+
})(CustomizationRenderType || (exports.CustomizationRenderType = CustomizationRenderType = {}));
|
|
48
|
+
var ChoiceType;
|
|
49
|
+
(function (ChoiceType) {
|
|
50
|
+
ChoiceType["UNKNOWN_CHOICE_TYPE"] = "UNKNOWN_CHOICE_TYPE";
|
|
51
|
+
/** For a `customizationRenderType` of `TEXT_CHOICES` and `FREE_TEXT`. */
|
|
52
|
+
ChoiceType["CHOICE_TEXT"] = "CHOICE_TEXT";
|
|
53
|
+
/** For `customizationRenderType: SWATCH_CHOICES`. */
|
|
54
|
+
ChoiceType["ONE_COLOR"] = "ONE_COLOR";
|
|
55
|
+
/** For `customizationRenderType: SWATCH_CHOICES`. */
|
|
56
|
+
ChoiceType["MULTIPLE_COLORS"] = "MULTIPLE_COLORS";
|
|
57
|
+
/** For `customizationRenderType: SWATCH_CHOICES`. */
|
|
58
|
+
ChoiceType["IMAGE"] = "IMAGE";
|
|
59
|
+
})(ChoiceType || (exports.ChoiceType = ChoiceType = {}));
|
|
60
|
+
var RequestedFields;
|
|
61
|
+
(function (RequestedFields) {
|
|
62
|
+
/** Unknown requested field. */
|
|
63
|
+
RequestedFields["UNKNOWN_REQUESTED_FIELD"] = "UNKNOWN_REQUESTED_FIELD";
|
|
64
|
+
/** Assigned products count. */
|
|
65
|
+
RequestedFields["ASSIGNED_PRODUCTS_COUNT"] = "ASSIGNED_PRODUCTS_COUNT";
|
|
66
|
+
})(RequestedFields || (exports.RequestedFields = RequestedFields = {}));
|
|
67
|
+
var SortOrder;
|
|
68
|
+
(function (SortOrder) {
|
|
69
|
+
/** Ascending order. */
|
|
70
|
+
SortOrder["ASC"] = "ASC";
|
|
71
|
+
/** Descending order. */
|
|
72
|
+
SortOrder["DESC"] = "DESC";
|
|
73
|
+
})(SortOrder || (exports.SortOrder = SortOrder = {}));
|
|
74
|
+
var WebhookIdentityType;
|
|
75
|
+
(function (WebhookIdentityType) {
|
|
76
|
+
WebhookIdentityType["UNKNOWN"] = "UNKNOWN";
|
|
77
|
+
WebhookIdentityType["ANONYMOUS_VISITOR"] = "ANONYMOUS_VISITOR";
|
|
78
|
+
WebhookIdentityType["MEMBER"] = "MEMBER";
|
|
79
|
+
WebhookIdentityType["WIX_USER"] = "WIX_USER";
|
|
80
|
+
WebhookIdentityType["APP"] = "APP";
|
|
81
|
+
})(WebhookIdentityType || (exports.WebhookIdentityType = WebhookIdentityType = {}));
|
|
82
|
+
/**
|
|
83
|
+
* Creates a customization.
|
|
84
|
+
* @param customization - Customization to create.
|
|
85
|
+
* @public
|
|
86
|
+
* @documentationMaturity preview
|
|
87
|
+
* @requiredField customization
|
|
88
|
+
* @requiredField customization.choicesSettings.choices
|
|
89
|
+
* @requiredField customization.customizationRenderType
|
|
90
|
+
* @requiredField customization.customizationType
|
|
91
|
+
* @requiredField customization.freeTextInput.title
|
|
92
|
+
* @requiredField customization.name
|
|
93
|
+
* @permissionId WIX_STORES.CUSTOMIZATION_CREATE
|
|
94
|
+
* @permissionScope Customization write in v3 catalog
|
|
95
|
+
* @permissionScopeId SCOPE.STORES.CUSTOMIZATION_WRITE
|
|
96
|
+
* @permissionScope Manage Products
|
|
97
|
+
* @permissionScopeId SCOPE.DC-STORES.MANAGE-PRODUCTS
|
|
98
|
+
* @permissionScope Product write in v3 catalog
|
|
99
|
+
* @permissionScopeId SCOPE.STORES.PRODUCT_WRITE
|
|
100
|
+
* @permissionScope Manage v3 catalog
|
|
101
|
+
* @permissionScopeId SCOPE.STORES.CATALOG_WRITE
|
|
102
|
+
* @applicableIdentity APP
|
|
103
|
+
* @returns Created customization.
|
|
104
|
+
* @fqn wix.stores.catalog.customization.v3.CustomizationService.CreateCustomization
|
|
105
|
+
*/
|
|
106
|
+
async function createCustomization(customization) {
|
|
107
|
+
// @ts-ignore
|
|
108
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
109
|
+
const payload = (0, transform_paths_1.transformPaths)((0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({ customization: customization }), [
|
|
110
|
+
{
|
|
111
|
+
transformFn: image_1.transformSDKImageToRESTImage,
|
|
112
|
+
paths: [{ path: 'customization.choicesSettings.choices.image' }],
|
|
113
|
+
},
|
|
114
|
+
]);
|
|
115
|
+
const reqOpts = ambassadorWixStoresCatalogV3Customization.createCustomization(payload);
|
|
116
|
+
sideEffects?.onSiteCall?.();
|
|
117
|
+
try {
|
|
118
|
+
const result = await httpClient.request(reqOpts);
|
|
119
|
+
sideEffects?.onSuccess?.(result);
|
|
120
|
+
return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)((0, transform_paths_1.transformPaths)(result.data, [
|
|
121
|
+
{
|
|
122
|
+
transformFn: image_2.transformRESTImageToSDKImage,
|
|
123
|
+
paths: [{ path: 'customization.choicesSettings.choices.image' }],
|
|
124
|
+
},
|
|
125
|
+
]))?.customization;
|
|
126
|
+
}
|
|
127
|
+
catch (err) {
|
|
128
|
+
const transformedError = (0, transform_error_1.transformError)(err, {
|
|
129
|
+
spreadPathsToArguments: {},
|
|
130
|
+
explicitPathsToArguments: { customization: '$[0]' },
|
|
131
|
+
singleArgumentUnchanged: false,
|
|
132
|
+
}, ['customization']);
|
|
133
|
+
sideEffects?.onError?.(err);
|
|
134
|
+
throw transformedError;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
exports.createCustomization = createCustomization;
|
|
138
|
+
/**
|
|
139
|
+
* Retrieves a customization.
|
|
140
|
+
* @param customizationId - Customization ID.
|
|
141
|
+
* @public
|
|
142
|
+
* @documentationMaturity preview
|
|
143
|
+
* @requiredField customizationId
|
|
144
|
+
* @permissionId WIX_STORES.CUSTOMIZATION_READ
|
|
145
|
+
* @permissionScope Read v3 catalog
|
|
146
|
+
* @permissionScopeId SCOPE.STORES.CATALOG_READ
|
|
147
|
+
* @permissionScope Manage Products
|
|
148
|
+
* @permissionScopeId SCOPE.DC-STORES.MANAGE-PRODUCTS
|
|
149
|
+
* @permissionScope Read Products
|
|
150
|
+
* @permissionScopeId SCOPE.DC-STORES.READ-PRODUCTS
|
|
151
|
+
* @permissionScope Product write in v3 catalog
|
|
152
|
+
* @permissionScopeId SCOPE.STORES.PRODUCT_WRITE
|
|
153
|
+
* @permissionScope Read customizations in v3 catalog
|
|
154
|
+
* @permissionScopeId SCOPE.STORES.CUSTOMIZATION_READ
|
|
155
|
+
* @permissionScope Manage v3 catalog
|
|
156
|
+
* @permissionScopeId SCOPE.STORES.CATALOG_WRITE
|
|
157
|
+
* @permissionScope Manage Orders
|
|
158
|
+
* @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
|
|
159
|
+
* @applicableIdentity APP
|
|
160
|
+
* @applicableIdentity VISITOR
|
|
161
|
+
* @returns Customization.
|
|
162
|
+
* @fqn wix.stores.catalog.customization.v3.CustomizationService.GetCustomization
|
|
163
|
+
*/
|
|
164
|
+
async function getCustomization(customizationId, options) {
|
|
165
|
+
// @ts-ignore
|
|
166
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
167
|
+
const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
|
|
168
|
+
customizationId: customizationId,
|
|
169
|
+
fields: options?.fields,
|
|
170
|
+
});
|
|
171
|
+
const reqOpts = ambassadorWixStoresCatalogV3Customization.getCustomization(payload);
|
|
172
|
+
sideEffects?.onSiteCall?.();
|
|
173
|
+
try {
|
|
174
|
+
const result = await httpClient.request(reqOpts);
|
|
175
|
+
sideEffects?.onSuccess?.(result);
|
|
176
|
+
return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)((0, transform_paths_1.transformPaths)(result.data, [
|
|
177
|
+
{
|
|
178
|
+
transformFn: image_2.transformRESTImageToSDKImage,
|
|
179
|
+
paths: [{ path: 'customization.choicesSettings.choices.image' }],
|
|
180
|
+
},
|
|
181
|
+
]))?.customization;
|
|
182
|
+
}
|
|
183
|
+
catch (err) {
|
|
184
|
+
const transformedError = (0, transform_error_1.transformError)(err, {
|
|
185
|
+
spreadPathsToArguments: {},
|
|
186
|
+
explicitPathsToArguments: {
|
|
187
|
+
customizationId: '$[0]',
|
|
188
|
+
fields: '$[1].fields',
|
|
189
|
+
},
|
|
190
|
+
singleArgumentUnchanged: false,
|
|
191
|
+
}, ['customizationId', 'options']);
|
|
192
|
+
sideEffects?.onError?.(err);
|
|
193
|
+
throw transformedError;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
exports.getCustomization = getCustomization;
|
|
197
|
+
/**
|
|
198
|
+
* Updates a customization.
|
|
199
|
+
*
|
|
200
|
+
* Each time the customization is updated, `revision` increments by 1.
|
|
201
|
+
* The current `revision` must be passed when updating the customization.
|
|
202
|
+
* This ensures you're working with the latest customization and prevents unintended overwrites.
|
|
203
|
+
* @param _id - Customization ID.
|
|
204
|
+
* @public
|
|
205
|
+
* @documentationMaturity preview
|
|
206
|
+
* @requiredField _id
|
|
207
|
+
* @requiredField customization
|
|
208
|
+
* @requiredField customization.revision
|
|
209
|
+
* @permissionId WIX_STORES.CUSTOMIZATION_UPDATE
|
|
210
|
+
* @permissionScope Customization write in v3 catalog
|
|
211
|
+
* @permissionScopeId SCOPE.STORES.CUSTOMIZATION_WRITE
|
|
212
|
+
* @permissionScope Manage Products
|
|
213
|
+
* @permissionScopeId SCOPE.DC-STORES.MANAGE-PRODUCTS
|
|
214
|
+
* @permissionScope Product write in v3 catalog
|
|
215
|
+
* @permissionScopeId SCOPE.STORES.PRODUCT_WRITE
|
|
216
|
+
* @permissionScope Manage v3 catalog
|
|
217
|
+
* @permissionScopeId SCOPE.STORES.CATALOG_WRITE
|
|
218
|
+
* @applicableIdentity APP
|
|
219
|
+
* @returns Updated customization.
|
|
220
|
+
* @fqn wix.stores.catalog.customization.v3.CustomizationService.UpdateCustomization
|
|
221
|
+
*/
|
|
222
|
+
async function updateCustomization(_id, customization, options) {
|
|
223
|
+
// @ts-ignore
|
|
224
|
+
const { httpClient, sideEffects } = arguments[3];
|
|
225
|
+
const payload = (0, transform_paths_1.transformPaths)((0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
|
|
226
|
+
customization: { ...customization, id: _id },
|
|
227
|
+
fields: options?.fields,
|
|
228
|
+
}), [
|
|
229
|
+
{
|
|
230
|
+
transformFn: image_1.transformSDKImageToRESTImage,
|
|
231
|
+
paths: [{ path: 'customization.choicesSettings.choices.image' }],
|
|
232
|
+
},
|
|
233
|
+
]);
|
|
234
|
+
const reqOpts = ambassadorWixStoresCatalogV3Customization.updateCustomization(payload);
|
|
235
|
+
sideEffects?.onSiteCall?.();
|
|
236
|
+
try {
|
|
237
|
+
const result = await httpClient.request(reqOpts);
|
|
238
|
+
sideEffects?.onSuccess?.(result);
|
|
239
|
+
return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)((0, transform_paths_1.transformPaths)(result.data, [
|
|
240
|
+
{
|
|
241
|
+
transformFn: image_2.transformRESTImageToSDKImage,
|
|
242
|
+
paths: [{ path: 'customization.choicesSettings.choices.image' }],
|
|
243
|
+
},
|
|
244
|
+
]))?.customization;
|
|
245
|
+
}
|
|
246
|
+
catch (err) {
|
|
247
|
+
const transformedError = (0, transform_error_1.transformError)(err, {
|
|
248
|
+
spreadPathsToArguments: { customization: '$[1]' },
|
|
249
|
+
explicitPathsToArguments: {
|
|
250
|
+
'customization.id': '$[0]',
|
|
251
|
+
fields: '$[2].fields',
|
|
252
|
+
},
|
|
253
|
+
singleArgumentUnchanged: false,
|
|
254
|
+
}, ['_id', 'customization', 'options']);
|
|
255
|
+
sideEffects?.onError?.(err);
|
|
256
|
+
throw transformedError;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
exports.updateCustomization = updateCustomization;
|
|
260
|
+
/**
|
|
261
|
+
* Deletes a customization.
|
|
262
|
+
*
|
|
263
|
+
* > **Note:** A customization cannot be deleted if it is assigned to one or more products.
|
|
264
|
+
* @param customizationId - Customization ID.
|
|
265
|
+
* @public
|
|
266
|
+
* @documentationMaturity preview
|
|
267
|
+
* @requiredField customizationId
|
|
268
|
+
* @permissionId WIX_STORES.CUSTOMIZATION_DELETE
|
|
269
|
+
* @permissionScope Customization write in v3 catalog
|
|
270
|
+
* @permissionScopeId SCOPE.STORES.CUSTOMIZATION_WRITE
|
|
271
|
+
* @permissionScope Manage Products
|
|
272
|
+
* @permissionScopeId SCOPE.DC-STORES.MANAGE-PRODUCTS
|
|
273
|
+
* @permissionScope Product write in v3 catalog
|
|
274
|
+
* @permissionScopeId SCOPE.STORES.PRODUCT_WRITE
|
|
275
|
+
* @permissionScope Manage v3 catalog
|
|
276
|
+
* @permissionScopeId SCOPE.STORES.CATALOG_WRITE
|
|
277
|
+
* @applicableIdentity APP
|
|
278
|
+
* @fqn wix.stores.catalog.customization.v3.CustomizationService.DeleteCustomization
|
|
279
|
+
*/
|
|
280
|
+
async function deleteCustomization(customizationId) {
|
|
281
|
+
// @ts-ignore
|
|
282
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
283
|
+
const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
|
|
284
|
+
customizationId: customizationId,
|
|
285
|
+
});
|
|
286
|
+
const reqOpts = ambassadorWixStoresCatalogV3Customization.deleteCustomization(payload);
|
|
287
|
+
sideEffects?.onSiteCall?.();
|
|
288
|
+
try {
|
|
289
|
+
const result = await httpClient.request(reqOpts);
|
|
290
|
+
sideEffects?.onSuccess?.(result);
|
|
291
|
+
}
|
|
292
|
+
catch (err) {
|
|
293
|
+
const transformedError = (0, transform_error_1.transformError)(err, {
|
|
294
|
+
spreadPathsToArguments: {},
|
|
295
|
+
explicitPathsToArguments: { customizationId: '$[0]' },
|
|
296
|
+
singleArgumentUnchanged: false,
|
|
297
|
+
}, ['customizationId']);
|
|
298
|
+
sideEffects?.onError?.(err);
|
|
299
|
+
throw transformedError;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
exports.deleteCustomization = deleteCustomization;
|
|
303
|
+
/**
|
|
304
|
+
* Retrieves a list of up to 100 customizations, given the provided filtering, sorting, and cursor paging.
|
|
305
|
+
* Pass supported values to the `fields` array in the request to include those fields in the response.
|
|
306
|
+
*
|
|
307
|
+
*
|
|
308
|
+
* Query Customizations runs with these defaults, which you can override:
|
|
309
|
+
*
|
|
310
|
+
* - `createdDate` is sorted in `DESC` order
|
|
311
|
+
* - `cursorPaging.limit` is `100`
|
|
312
|
+
*
|
|
313
|
+
* For field support for filters and sorting,
|
|
314
|
+
* see [Customizations: Supported Filters and Sorting](https://dev.wix.com/docs/rest/business-solutions/stores/catalog-v3/customizations-v3/supported-filters-and-sorting).
|
|
315
|
+
*
|
|
316
|
+
* To learn about working with _Query_ endpoints, see
|
|
317
|
+
* [API Query Language](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language),
|
|
318
|
+
* and [Sorting and Paging](https://dev.wix.com/docs/rest/articles/getting-started/sorting-and-paging).
|
|
319
|
+
* @public
|
|
320
|
+
* @documentationMaturity preview
|
|
321
|
+
* @permissionScope Read v3 catalog
|
|
322
|
+
* @permissionScopeId SCOPE.STORES.CATALOG_READ
|
|
323
|
+
* @permissionScope Manage Products
|
|
324
|
+
* @permissionScopeId SCOPE.DC-STORES.MANAGE-PRODUCTS
|
|
325
|
+
* @permissionScope Read Products
|
|
326
|
+
* @permissionScopeId SCOPE.DC-STORES.READ-PRODUCTS
|
|
327
|
+
* @permissionScope Product write in v3 catalog
|
|
328
|
+
* @permissionScopeId SCOPE.STORES.PRODUCT_WRITE
|
|
329
|
+
* @permissionScope Read customizations in v3 catalog
|
|
330
|
+
* @permissionScopeId SCOPE.STORES.CUSTOMIZATION_READ
|
|
331
|
+
* @permissionScope Manage v3 catalog
|
|
332
|
+
* @permissionScopeId SCOPE.STORES.CATALOG_WRITE
|
|
333
|
+
* @permissionScope Manage Orders
|
|
334
|
+
* @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
|
|
335
|
+
* @permissionId WIX_STORES.CUSTOMIZATION_READ
|
|
336
|
+
* @applicableIdentity APP
|
|
337
|
+
* @applicableIdentity VISITOR
|
|
338
|
+
* @fqn wix.stores.catalog.customization.v3.CustomizationService.QueryCustomizations
|
|
339
|
+
*/
|
|
340
|
+
function queryCustomizations(options) {
|
|
341
|
+
// @ts-ignore
|
|
342
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
343
|
+
return (0, query_builder_1.queryBuilder)({
|
|
344
|
+
func: async (payload) => {
|
|
345
|
+
const reqOpts = ambassadorWixStoresCatalogV3Customization.queryCustomizations({
|
|
346
|
+
...payload,
|
|
347
|
+
...(options ?? {}),
|
|
348
|
+
});
|
|
349
|
+
sideEffects?.onSiteCall?.();
|
|
350
|
+
try {
|
|
351
|
+
const result = await httpClient.request(reqOpts);
|
|
352
|
+
sideEffects?.onSuccess?.(result);
|
|
353
|
+
return result;
|
|
354
|
+
}
|
|
355
|
+
catch (err) {
|
|
356
|
+
sideEffects?.onError?.(err);
|
|
357
|
+
throw err;
|
|
358
|
+
}
|
|
359
|
+
},
|
|
360
|
+
requestTransformer: (query) => {
|
|
361
|
+
const args = [query, options];
|
|
362
|
+
return (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
|
|
363
|
+
...args?.[1],
|
|
364
|
+
query: args?.[0],
|
|
365
|
+
});
|
|
366
|
+
},
|
|
367
|
+
responseTransformer: ({ data, }) => {
|
|
368
|
+
const transformedData = (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)((0, transform_paths_1.transformPaths)(data, [
|
|
369
|
+
{
|
|
370
|
+
transformFn: image_2.transformRESTImageToSDKImage,
|
|
371
|
+
paths: [{ path: 'customizations.choicesSettings.choices.image' }],
|
|
372
|
+
},
|
|
373
|
+
]));
|
|
374
|
+
return {
|
|
375
|
+
items: transformedData?.customizations,
|
|
376
|
+
pagingMetadata: transformedData?.pagingMetadata,
|
|
377
|
+
};
|
|
378
|
+
},
|
|
379
|
+
errorTransformer: (err) => {
|
|
380
|
+
const transformedError = (0, transform_error_1.transformError)(err, {
|
|
381
|
+
spreadPathsToArguments: {},
|
|
382
|
+
explicitPathsToArguments: { query: '$[0]' },
|
|
383
|
+
singleArgumentUnchanged: false,
|
|
384
|
+
});
|
|
385
|
+
throw transformedError;
|
|
386
|
+
},
|
|
387
|
+
pagingMethod: 'CURSOR',
|
|
388
|
+
transformationPaths: {},
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
exports.queryCustomizations = queryCustomizations;
|
|
392
|
+
/**
|
|
393
|
+
* Creates multiple brands.
|
|
394
|
+
* @param customizations - Customizations to create.
|
|
395
|
+
* @public
|
|
396
|
+
* @documentationMaturity preview
|
|
397
|
+
* @requiredField customizations
|
|
398
|
+
* @permissionId WIX_STORES.CUSTOMIZATION_CREATE
|
|
399
|
+
* @permissionScope Customization write in v3 catalog
|
|
400
|
+
* @permissionScopeId SCOPE.STORES.CUSTOMIZATION_WRITE
|
|
401
|
+
* @permissionScope Manage Products
|
|
402
|
+
* @permissionScopeId SCOPE.DC-STORES.MANAGE-PRODUCTS
|
|
403
|
+
* @permissionScope Product write in v3 catalog
|
|
404
|
+
* @permissionScopeId SCOPE.STORES.PRODUCT_WRITE
|
|
405
|
+
* @permissionScope Manage v3 catalog
|
|
406
|
+
* @permissionScopeId SCOPE.STORES.CATALOG_WRITE
|
|
407
|
+
* @applicableIdentity APP
|
|
408
|
+
* @fqn wix.stores.catalog.customization.v3.CustomizationService.BulkCreateCustomizations
|
|
409
|
+
*/
|
|
410
|
+
async function bulkCreateCustomizations(customizations, options) {
|
|
411
|
+
// @ts-ignore
|
|
412
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
413
|
+
const payload = (0, transform_paths_1.transformPaths)((0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
|
|
414
|
+
customizations: customizations,
|
|
415
|
+
returnEntity: options?.returnEntity,
|
|
416
|
+
}), [
|
|
417
|
+
{
|
|
418
|
+
transformFn: image_1.transformSDKImageToRESTImage,
|
|
419
|
+
paths: [{ path: 'customizations.choicesSettings.choices.image' }],
|
|
420
|
+
},
|
|
421
|
+
]);
|
|
422
|
+
const reqOpts = ambassadorWixStoresCatalogV3Customization.bulkCreateCustomizations(payload);
|
|
423
|
+
sideEffects?.onSiteCall?.();
|
|
424
|
+
try {
|
|
425
|
+
const result = await httpClient.request(reqOpts);
|
|
426
|
+
sideEffects?.onSuccess?.(result);
|
|
427
|
+
return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)((0, transform_paths_1.transformPaths)(result.data, [
|
|
428
|
+
{
|
|
429
|
+
transformFn: image_2.transformRESTImageToSDKImage,
|
|
430
|
+
paths: [
|
|
431
|
+
{ path: 'results.customization.choicesSettings.choices.image' },
|
|
432
|
+
],
|
|
433
|
+
},
|
|
434
|
+
]));
|
|
435
|
+
}
|
|
436
|
+
catch (err) {
|
|
437
|
+
const transformedError = (0, transform_error_1.transformError)(err, {
|
|
438
|
+
spreadPathsToArguments: {},
|
|
439
|
+
explicitPathsToArguments: {
|
|
440
|
+
customizations: '$[0]',
|
|
441
|
+
returnEntity: '$[1].returnEntity',
|
|
442
|
+
},
|
|
443
|
+
singleArgumentUnchanged: false,
|
|
444
|
+
}, ['customizations', 'options']);
|
|
445
|
+
sideEffects?.onError?.(err);
|
|
446
|
+
throw transformedError;
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
exports.bulkCreateCustomizations = bulkCreateCustomizations;
|
|
450
|
+
/**
|
|
451
|
+
* Adds choices to a customization.
|
|
452
|
+
* @param customizationId - Customization ID.
|
|
453
|
+
* @param choices - Choices to add.
|
|
454
|
+
* @public
|
|
455
|
+
* @documentationMaturity preview
|
|
456
|
+
* @requiredField choices
|
|
457
|
+
* @requiredField customizationId
|
|
458
|
+
* @permissionId WIX_STORES.CUSTOMIZATION_UPDATE
|
|
459
|
+
* @permissionScope Customization write in v3 catalog
|
|
460
|
+
* @permissionScopeId SCOPE.STORES.CUSTOMIZATION_WRITE
|
|
461
|
+
* @permissionScope Manage Products
|
|
462
|
+
* @permissionScopeId SCOPE.DC-STORES.MANAGE-PRODUCTS
|
|
463
|
+
* @permissionScope Product write in v3 catalog
|
|
464
|
+
* @permissionScopeId SCOPE.STORES.PRODUCT_WRITE
|
|
465
|
+
* @permissionScope Manage v3 catalog
|
|
466
|
+
* @permissionScopeId SCOPE.STORES.CATALOG_WRITE
|
|
467
|
+
* @applicableIdentity APP
|
|
468
|
+
* @fqn wix.stores.catalog.customization.v3.CustomizationService.AddCustomizationChoices
|
|
469
|
+
*/
|
|
470
|
+
async function addCustomizationChoices(customizationId, choices, options) {
|
|
471
|
+
// @ts-ignore
|
|
472
|
+
const { httpClient, sideEffects } = arguments[3];
|
|
473
|
+
const payload = (0, transform_paths_1.transformPaths)((0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
|
|
474
|
+
customizationId: customizationId,
|
|
475
|
+
choices: choices,
|
|
476
|
+
fields: options?.fields,
|
|
477
|
+
}), [
|
|
478
|
+
{
|
|
479
|
+
transformFn: image_1.transformSDKImageToRESTImage,
|
|
480
|
+
paths: [{ path: 'choices.image' }],
|
|
481
|
+
},
|
|
482
|
+
]);
|
|
483
|
+
const reqOpts = ambassadorWixStoresCatalogV3Customization.addCustomizationChoices(payload);
|
|
484
|
+
sideEffects?.onSiteCall?.();
|
|
485
|
+
try {
|
|
486
|
+
const result = await httpClient.request(reqOpts);
|
|
487
|
+
sideEffects?.onSuccess?.(result);
|
|
488
|
+
return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)((0, transform_paths_1.transformPaths)(result.data, [
|
|
489
|
+
{
|
|
490
|
+
transformFn: image_2.transformRESTImageToSDKImage,
|
|
491
|
+
paths: [{ path: 'customization.choicesSettings.choices.image' }],
|
|
492
|
+
},
|
|
493
|
+
]));
|
|
494
|
+
}
|
|
495
|
+
catch (err) {
|
|
496
|
+
const transformedError = (0, transform_error_1.transformError)(err, {
|
|
497
|
+
spreadPathsToArguments: {},
|
|
498
|
+
explicitPathsToArguments: {
|
|
499
|
+
customizationId: '$[0]',
|
|
500
|
+
choices: '$[1]',
|
|
501
|
+
fields: '$[2].fields',
|
|
502
|
+
},
|
|
503
|
+
singleArgumentUnchanged: false,
|
|
504
|
+
}, ['customizationId', 'choices', 'options']);
|
|
505
|
+
sideEffects?.onError?.(err);
|
|
506
|
+
throw transformedError;
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
exports.addCustomizationChoices = addCustomizationChoices;
|
|
510
|
+
/**
|
|
511
|
+
* Sets a customization's choices. Any and all existing choices will be overridden.
|
|
512
|
+
*
|
|
513
|
+
* > **Note:** A choice cannot be overridden if it is assigned to one or more products.
|
|
514
|
+
* @param customizationId - Customization ID.
|
|
515
|
+
* @param choices - Choices to set.
|
|
516
|
+
* @public
|
|
517
|
+
* @documentationMaturity preview
|
|
518
|
+
* @requiredField choices
|
|
519
|
+
* @requiredField customizationId
|
|
520
|
+
* @permissionId WIX_STORES.CUSTOMIZATION_UPDATE
|
|
521
|
+
* @permissionScope Customization write in v3 catalog
|
|
522
|
+
* @permissionScopeId SCOPE.STORES.CUSTOMIZATION_WRITE
|
|
523
|
+
* @permissionScope Manage Products
|
|
524
|
+
* @permissionScopeId SCOPE.DC-STORES.MANAGE-PRODUCTS
|
|
525
|
+
* @permissionScope Product write in v3 catalog
|
|
526
|
+
* @permissionScopeId SCOPE.STORES.PRODUCT_WRITE
|
|
527
|
+
* @permissionScope Manage v3 catalog
|
|
528
|
+
* @permissionScopeId SCOPE.STORES.CATALOG_WRITE
|
|
529
|
+
* @applicableIdentity APP
|
|
530
|
+
* @fqn wix.stores.catalog.customization.v3.CustomizationService.SetCustomizationChoices
|
|
531
|
+
*/
|
|
532
|
+
async function setCustomizationChoices(customizationId, choices, options) {
|
|
533
|
+
// @ts-ignore
|
|
534
|
+
const { httpClient, sideEffects } = arguments[3];
|
|
535
|
+
const payload = (0, transform_paths_1.transformPaths)((0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
|
|
536
|
+
customizationId: customizationId,
|
|
537
|
+
choices: choices,
|
|
538
|
+
fields: options?.fields,
|
|
539
|
+
}), [
|
|
540
|
+
{
|
|
541
|
+
transformFn: image_1.transformSDKImageToRESTImage,
|
|
542
|
+
paths: [{ path: 'choices.image' }],
|
|
543
|
+
},
|
|
544
|
+
]);
|
|
545
|
+
const reqOpts = ambassadorWixStoresCatalogV3Customization.setCustomizationChoices(payload);
|
|
546
|
+
sideEffects?.onSiteCall?.();
|
|
547
|
+
try {
|
|
548
|
+
const result = await httpClient.request(reqOpts);
|
|
549
|
+
sideEffects?.onSuccess?.(result);
|
|
550
|
+
return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)((0, transform_paths_1.transformPaths)(result.data, [
|
|
551
|
+
{
|
|
552
|
+
transformFn: image_2.transformRESTImageToSDKImage,
|
|
553
|
+
paths: [{ path: 'customization.choicesSettings.choices.image' }],
|
|
554
|
+
},
|
|
555
|
+
]));
|
|
556
|
+
}
|
|
557
|
+
catch (err) {
|
|
558
|
+
const transformedError = (0, transform_error_1.transformError)(err, {
|
|
559
|
+
spreadPathsToArguments: {},
|
|
560
|
+
explicitPathsToArguments: {
|
|
561
|
+
customizationId: '$[0]',
|
|
562
|
+
choices: '$[1]',
|
|
563
|
+
fields: '$[2].fields',
|
|
564
|
+
},
|
|
565
|
+
singleArgumentUnchanged: false,
|
|
566
|
+
}, ['customizationId', 'choices', 'options']);
|
|
567
|
+
sideEffects?.onError?.(err);
|
|
568
|
+
throw transformedError;
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
exports.setCustomizationChoices = setCustomizationChoices;
|
|
572
|
+
/**
|
|
573
|
+
* Removes choices from a customization.
|
|
574
|
+
*
|
|
575
|
+
* +> **Note:** A choice cannot be removed if it is assigned to one or more products.
|
|
576
|
+
* @param customizationId - Customization ID.
|
|
577
|
+
* @param choiceIds - IDs of choices to remove.
|
|
578
|
+
* @public
|
|
579
|
+
* @documentationMaturity preview
|
|
580
|
+
* @requiredField choiceIds
|
|
581
|
+
* @requiredField customizationId
|
|
582
|
+
* @permissionId WIX_STORES.CUSTOMIZATION_UPDATE
|
|
583
|
+
* @permissionScope Customization write in v3 catalog
|
|
584
|
+
* @permissionScopeId SCOPE.STORES.CUSTOMIZATION_WRITE
|
|
585
|
+
* @permissionScope Manage Products
|
|
586
|
+
* @permissionScopeId SCOPE.DC-STORES.MANAGE-PRODUCTS
|
|
587
|
+
* @permissionScope Product write in v3 catalog
|
|
588
|
+
* @permissionScopeId SCOPE.STORES.PRODUCT_WRITE
|
|
589
|
+
* @permissionScope Manage v3 catalog
|
|
590
|
+
* @permissionScopeId SCOPE.STORES.CATALOG_WRITE
|
|
591
|
+
* @applicableIdentity APP
|
|
592
|
+
* @fqn wix.stores.catalog.customization.v3.CustomizationService.RemoveCustomizationChoices
|
|
593
|
+
*/
|
|
594
|
+
async function removeCustomizationChoices(customizationId, choiceIds, options) {
|
|
595
|
+
// @ts-ignore
|
|
596
|
+
const { httpClient, sideEffects } = arguments[3];
|
|
597
|
+
const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
|
|
598
|
+
customizationId: customizationId,
|
|
599
|
+
choiceIds: choiceIds,
|
|
600
|
+
revision: options?.revision,
|
|
601
|
+
fields: options?.fields,
|
|
602
|
+
});
|
|
603
|
+
const reqOpts = ambassadorWixStoresCatalogV3Customization.removeCustomizationChoices(payload);
|
|
604
|
+
sideEffects?.onSiteCall?.();
|
|
605
|
+
try {
|
|
606
|
+
const result = await httpClient.request(reqOpts);
|
|
607
|
+
sideEffects?.onSuccess?.(result);
|
|
608
|
+
return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)((0, transform_paths_1.transformPaths)(result.data, [
|
|
609
|
+
{
|
|
610
|
+
transformFn: image_2.transformRESTImageToSDKImage,
|
|
611
|
+
paths: [{ path: 'customization.choicesSettings.choices.image' }],
|
|
612
|
+
},
|
|
613
|
+
]));
|
|
614
|
+
}
|
|
615
|
+
catch (err) {
|
|
616
|
+
const transformedError = (0, transform_error_1.transformError)(err, {
|
|
617
|
+
spreadPathsToArguments: {},
|
|
618
|
+
explicitPathsToArguments: {
|
|
619
|
+
customizationId: '$[0]',
|
|
620
|
+
choiceIds: '$[1]',
|
|
621
|
+
revision: '$[2].revision',
|
|
622
|
+
fields: '$[2].fields',
|
|
623
|
+
},
|
|
624
|
+
singleArgumentUnchanged: false,
|
|
625
|
+
}, ['customizationId', 'choiceIds', 'options']);
|
|
626
|
+
sideEffects?.onError?.(err);
|
|
627
|
+
throw transformedError;
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
exports.removeCustomizationChoices = removeCustomizationChoices;
|
|
631
|
+
/**
|
|
632
|
+
* Adds choices to multiple customizations.
|
|
633
|
+
* @param customizationsChoices - List of customization IDs and choices.
|
|
634
|
+
* @public
|
|
635
|
+
* @documentationMaturity preview
|
|
636
|
+
* @requiredField customizationsChoices
|
|
637
|
+
* @requiredField customizationsChoices.choices
|
|
638
|
+
* @requiredField customizationsChoices.customizationId
|
|
639
|
+
* @permissionId WIX_STORES.CUSTOMIZATION_UPDATE
|
|
640
|
+
* @permissionScope Customization write in v3 catalog
|
|
641
|
+
* @permissionScopeId SCOPE.STORES.CUSTOMIZATION_WRITE
|
|
642
|
+
* @permissionScope Manage Products
|
|
643
|
+
* @permissionScopeId SCOPE.DC-STORES.MANAGE-PRODUCTS
|
|
644
|
+
* @permissionScope Product write in v3 catalog
|
|
645
|
+
* @permissionScopeId SCOPE.STORES.PRODUCT_WRITE
|
|
646
|
+
* @permissionScope Manage v3 catalog
|
|
647
|
+
* @permissionScopeId SCOPE.STORES.CATALOG_WRITE
|
|
648
|
+
* @applicableIdentity APP
|
|
649
|
+
* @fqn wix.stores.catalog.customization.v3.CustomizationService.BulkAddCustomizationChoices
|
|
650
|
+
*/
|
|
651
|
+
async function bulkAddCustomizationChoices(customizationsChoices, options) {
|
|
652
|
+
// @ts-ignore
|
|
653
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
654
|
+
const payload = (0, transform_paths_1.transformPaths)((0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
|
|
655
|
+
customizationsChoices: customizationsChoices,
|
|
656
|
+
returnEntity: options?.returnEntity,
|
|
657
|
+
fields: options?.fields,
|
|
658
|
+
}), [
|
|
659
|
+
{
|
|
660
|
+
transformFn: image_1.transformSDKImageToRESTImage,
|
|
661
|
+
paths: [{ path: 'customizationsChoices.choices.image' }],
|
|
662
|
+
},
|
|
663
|
+
]);
|
|
664
|
+
const reqOpts = ambassadorWixStoresCatalogV3Customization.bulkAddCustomizationChoices(payload);
|
|
665
|
+
sideEffects?.onSiteCall?.();
|
|
666
|
+
try {
|
|
667
|
+
const result = await httpClient.request(reqOpts);
|
|
668
|
+
sideEffects?.onSuccess?.(result);
|
|
669
|
+
return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)((0, transform_paths_1.transformPaths)(result.data, [
|
|
670
|
+
{
|
|
671
|
+
transformFn: image_2.transformRESTImageToSDKImage,
|
|
672
|
+
paths: [
|
|
673
|
+
{ path: 'results.customization.choicesSettings.choices.image' },
|
|
674
|
+
],
|
|
675
|
+
},
|
|
676
|
+
]));
|
|
677
|
+
}
|
|
678
|
+
catch (err) {
|
|
679
|
+
const transformedError = (0, transform_error_1.transformError)(err, {
|
|
680
|
+
spreadPathsToArguments: {},
|
|
681
|
+
explicitPathsToArguments: {
|
|
682
|
+
customizationsChoices: '$[0]',
|
|
683
|
+
returnEntity: '$[1].returnEntity',
|
|
684
|
+
fields: '$[1].fields',
|
|
685
|
+
},
|
|
686
|
+
singleArgumentUnchanged: false,
|
|
687
|
+
}, ['customizationsChoices', 'options']);
|
|
688
|
+
sideEffects?.onError?.(err);
|
|
689
|
+
throw transformedError;
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
exports.bulkAddCustomizationChoices = bulkAddCustomizationChoices;
|
|
693
|
+
/**
|
|
694
|
+
* Updates multiple customizations.
|
|
695
|
+
*
|
|
696
|
+
* Each time the customization is updated, `revision` increments by 1.
|
|
697
|
+
* The current `revision` must be passed when updating the customization.
|
|
698
|
+
* This ensures you're working with the latest customization and prevents unintended overwrites.
|
|
699
|
+
* @param customizations - List of customizations to update.
|
|
700
|
+
* @public
|
|
701
|
+
* @documentationMaturity preview
|
|
702
|
+
* @requiredField customizations
|
|
703
|
+
* @requiredField customizations.customization._id
|
|
704
|
+
* @requiredField customizations.customization.name
|
|
705
|
+
* @requiredField customizations.customization.revision
|
|
706
|
+
* @permissionId WIX_STORES.CUSTOMIZATION_UPDATE
|
|
707
|
+
* @permissionScope Customization write in v3 catalog
|
|
708
|
+
* @permissionScopeId SCOPE.STORES.CUSTOMIZATION_WRITE
|
|
709
|
+
* @permissionScope Manage Products
|
|
710
|
+
* @permissionScopeId SCOPE.DC-STORES.MANAGE-PRODUCTS
|
|
711
|
+
* @permissionScope Product write in v3 catalog
|
|
712
|
+
* @permissionScopeId SCOPE.STORES.PRODUCT_WRITE
|
|
713
|
+
* @permissionScope Manage v3 catalog
|
|
714
|
+
* @permissionScopeId SCOPE.STORES.CATALOG_WRITE
|
|
715
|
+
* @applicableIdentity APP
|
|
716
|
+
* @fqn wix.stores.catalog.customization.v3.CustomizationService.BulkUpdateCustomizations
|
|
717
|
+
*/
|
|
718
|
+
async function bulkUpdateCustomizations(customizations, options) {
|
|
719
|
+
// @ts-ignore
|
|
720
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
721
|
+
const payload = (0, transform_paths_1.transformPaths)((0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
|
|
722
|
+
customizations: customizations,
|
|
723
|
+
returnEntity: options?.returnEntity,
|
|
724
|
+
fields: options?.fields,
|
|
725
|
+
}), [
|
|
726
|
+
{
|
|
727
|
+
transformFn: image_1.transformSDKImageToRESTImage,
|
|
728
|
+
paths: [
|
|
729
|
+
{
|
|
730
|
+
path: 'customizations.customization.choicesSettings.choices.image',
|
|
731
|
+
},
|
|
732
|
+
],
|
|
733
|
+
},
|
|
734
|
+
]);
|
|
735
|
+
const reqOpts = ambassadorWixStoresCatalogV3Customization.bulkUpdateCustomizations(payload);
|
|
736
|
+
sideEffects?.onSiteCall?.();
|
|
737
|
+
try {
|
|
738
|
+
const result = await httpClient.request(reqOpts);
|
|
739
|
+
sideEffects?.onSuccess?.(result);
|
|
740
|
+
return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)((0, transform_paths_1.transformPaths)(result.data, [
|
|
741
|
+
{
|
|
742
|
+
transformFn: image_2.transformRESTImageToSDKImage,
|
|
743
|
+
paths: [
|
|
744
|
+
{ path: 'results.customization.choicesSettings.choices.image' },
|
|
745
|
+
],
|
|
746
|
+
},
|
|
747
|
+
]));
|
|
748
|
+
}
|
|
749
|
+
catch (err) {
|
|
750
|
+
const transformedError = (0, transform_error_1.transformError)(err, {
|
|
751
|
+
spreadPathsToArguments: {},
|
|
752
|
+
explicitPathsToArguments: {
|
|
753
|
+
customizations: '$[0]',
|
|
754
|
+
returnEntity: '$[1].returnEntity',
|
|
755
|
+
fields: '$[1].fields',
|
|
756
|
+
},
|
|
757
|
+
singleArgumentUnchanged: false,
|
|
758
|
+
}, ['customizations', 'options']);
|
|
759
|
+
sideEffects?.onError?.(err);
|
|
760
|
+
throw transformedError;
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
exports.bulkUpdateCustomizations = bulkUpdateCustomizations;
|
|
764
|
+
//# sourceMappingURL=stores-catalog-v3-customization-customizations-v-3.universal.js.map
|