@wix/pro-gallery 1.0.34 → 1.0.36
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/context.d.ts +1 -1
- package/build/cjs/context.js +1 -1
- package/build/cjs/index.d.ts +1 -1
- package/build/cjs/index.js +1 -1
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/meta.d.ts +1 -1
- package/build/cjs/meta.js +1 -1
- package/build/es/context.d.ts +1 -1
- package/build/es/context.js +1 -1
- package/build/es/index.d.ts +1 -1
- package/build/es/index.js +1 -1
- package/build/es/index.js.map +1 -1
- package/build/es/meta.d.ts +1 -1
- package/build/es/meta.js +1 -1
- package/package.json +11 -9
- package/build/cjs/index.typings.d.ts +0 -1
- package/build/cjs/index.typings.js +0 -28
- package/build/cjs/index.typings.js.map +0 -1
- package/build/cjs/src/pro-gallery-v2-gallery.context.d.ts +0 -12
- package/build/cjs/src/pro-gallery-v2-gallery.context.js +0 -115
- package/build/cjs/src/pro-gallery-v2-gallery.context.js.map +0 -1
- package/build/cjs/src/pro-gallery-v2-gallery.http.d.ts +0 -130
- package/build/cjs/src/pro-gallery-v2-gallery.http.js +0 -823
- package/build/cjs/src/pro-gallery-v2-gallery.http.js.map +0 -1
- package/build/cjs/src/pro-gallery-v2-gallery.meta.d.ts +0 -41
- package/build/cjs/src/pro-gallery-v2-gallery.meta.js +0 -218
- package/build/cjs/src/pro-gallery-v2-gallery.meta.js.map +0 -1
- package/build/cjs/src/pro-gallery-v2-gallery.public.d.ts +0 -120
- package/build/cjs/src/pro-gallery-v2-gallery.public.js +0 -82
- package/build/cjs/src/pro-gallery-v2-gallery.public.js.map +0 -1
- package/build/cjs/src/pro-gallery-v2-gallery.types.d.ts +0 -1768
- package/build/cjs/src/pro-gallery-v2-gallery.types.js +0 -82
- package/build/cjs/src/pro-gallery-v2-gallery.types.js.map +0 -1
- package/build/cjs/src/pro-gallery-v2-gallery.universal.d.ts +0 -1398
- package/build/cjs/src/pro-gallery-v2-gallery.universal.js +0 -887
- package/build/cjs/src/pro-gallery-v2-gallery.universal.js.map +0 -1
- package/build/es/index.typings.d.ts +0 -1
- package/build/es/index.typings.js +0 -2
- package/build/es/index.typings.js.map +0 -1
- package/build/es/src/pro-gallery-v2-gallery.context.d.ts +0 -12
- package/build/es/src/pro-gallery-v2-gallery.context.js +0 -102
- package/build/es/src/pro-gallery-v2-gallery.context.js.map +0 -1
- package/build/es/src/pro-gallery-v2-gallery.http.d.ts +0 -130
- package/build/es/src/pro-gallery-v2-gallery.http.js +0 -810
- package/build/es/src/pro-gallery-v2-gallery.http.js.map +0 -1
- package/build/es/src/pro-gallery-v2-gallery.meta.d.ts +0 -41
- package/build/es/src/pro-gallery-v2-gallery.meta.js +0 -182
- package/build/es/src/pro-gallery-v2-gallery.meta.js.map +0 -1
- package/build/es/src/pro-gallery-v2-gallery.public.d.ts +0 -120
- package/build/es/src/pro-gallery-v2-gallery.public.js +0 -55
- package/build/es/src/pro-gallery-v2-gallery.public.js.map +0 -1
- package/build/es/src/pro-gallery-v2-gallery.types.d.ts +0 -1768
- package/build/es/src/pro-gallery-v2-gallery.types.js +0 -79
- package/build/es/src/pro-gallery-v2-gallery.types.js.map +0 -1
- package/build/es/src/pro-gallery-v2-gallery.universal.d.ts +0 -1398
- package/build/es/src/pro-gallery-v2-gallery.universal.js +0 -851
- package/build/es/src/pro-gallery-v2-gallery.universal.js.map +0 -1
@@ -1,851 +0,0 @@
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
8
|
-
});
|
9
|
-
};
|
10
|
-
import { serializer } from '@wix/metro-runtime/velo';
|
11
|
-
import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';
|
12
|
-
import { EventDefinition } from '@wix/sdk-types';
|
13
|
-
import * as ambassadorWixProGalleryV2Gallery from './pro-gallery-v2-gallery.http';
|
14
|
-
const _toVeloEntity = '$';
|
15
|
-
const _fromVeloEntity = '$';
|
16
|
-
export var LinkType;
|
17
|
-
(function (LinkType) {
|
18
|
-
LinkType["UNDEFINED"] = "UNDEFINED";
|
19
|
-
/** external link */
|
20
|
-
LinkType["EXTERNAL"] = "EXTERNAL";
|
21
|
-
/** for internal usage using wixLinkData */
|
22
|
-
LinkType["INTERNAL"] = "INTERNAL";
|
23
|
-
})(LinkType || (LinkType = {}));
|
24
|
-
/**
|
25
|
-
* The 'rel' attribute of the link. The rel attribute defines the relationship between a linked resource and the current document.
|
26
|
-
* Further reading (also about different possible rel types): https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel
|
27
|
-
* Following are the accepted 'rel' types by Wix applications.
|
28
|
-
*/
|
29
|
-
export var LinkRel;
|
30
|
-
(function (LinkRel) {
|
31
|
-
/** default (not implemented) */
|
32
|
-
LinkRel["unknown_link_rel"] = "unknown_link_rel";
|
33
|
-
/** Indicates that the current document's original author or publisher does not endorse the referenced document. */
|
34
|
-
LinkRel["nofollow"] = "nofollow";
|
35
|
-
/** Instructs the browser to navigate to the target resource without granting the new browsing context access to the document that opened it. */
|
36
|
-
LinkRel["noopener"] = "noopener";
|
37
|
-
/** No Referer header will be included. Additionally, has the same effect as noopener. */
|
38
|
-
LinkRel["noreferrer"] = "noreferrer";
|
39
|
-
/** Indicates a link that resulted from advertisements or paid placements. */
|
40
|
-
LinkRel["sponsored"] = "sponsored";
|
41
|
-
})(LinkRel || (LinkRel = {}));
|
42
|
-
export var Type;
|
43
|
-
(function (Type) {
|
44
|
-
Type["UNDEFINED"] = "UNDEFINED";
|
45
|
-
Type["IMAGE"] = "IMAGE";
|
46
|
-
Type["VIDEO"] = "VIDEO";
|
47
|
-
Type["TEXT"] = "TEXT";
|
48
|
-
})(Type || (Type = {}));
|
49
|
-
export var ImageType;
|
50
|
-
(function (ImageType) {
|
51
|
-
ImageType["UNDEFINED"] = "UNDEFINED";
|
52
|
-
ImageType["WIX_MEDIA"] = "WIX_MEDIA";
|
53
|
-
ImageType["EXTERNAL"] = "EXTERNAL";
|
54
|
-
})(ImageType || (ImageType = {}));
|
55
|
-
export var VideoType;
|
56
|
-
(function (VideoType) {
|
57
|
-
VideoType["UNDEFINED"] = "UNDEFINED";
|
58
|
-
VideoType["WIX_MEDIA"] = "WIX_MEDIA";
|
59
|
-
VideoType["YOUTUBE"] = "YOUTUBE";
|
60
|
-
VideoType["VIMEO"] = "VIMEO";
|
61
|
-
})(VideoType || (VideoType = {}));
|
62
|
-
export var Enum;
|
63
|
-
(function (Enum) {
|
64
|
-
/** Default value. Means that permission not set */
|
65
|
-
Enum["UNKNOWN"] = "UNKNOWN";
|
66
|
-
/** Protected exposure. Exposed to members and owners */
|
67
|
-
Enum["PROTECTED"] = "PROTECTED";
|
68
|
-
/** Private exposure. Exposed to owners */
|
69
|
-
Enum["PRIVATE"] = "PRIVATE";
|
70
|
-
/** Public exposure. Visible to everyone */
|
71
|
-
Enum["PUBLIC"] = "PUBLIC";
|
72
|
-
/** Used for partial updates, to state that exposure is not changing */
|
73
|
-
Enum["UNCHANGED"] = "UNCHANGED";
|
74
|
-
/** Protected to members of permitted groups and owners */
|
75
|
-
Enum["GROUP_PROTECTED"] = "GROUP_PROTECTED";
|
76
|
-
})(Enum || (Enum = {}));
|
77
|
-
export var SearchIndexingNotificationState;
|
78
|
-
(function (SearchIndexingNotificationState) {
|
79
|
-
/** default state */
|
80
|
-
SearchIndexingNotificationState["Unknown"] = "Unknown";
|
81
|
-
/** metasite does not require site search indexing */
|
82
|
-
SearchIndexingNotificationState["Off"] = "Off";
|
83
|
-
/** metasite requires site search indexing */
|
84
|
-
SearchIndexingNotificationState["On"] = "On";
|
85
|
-
})(SearchIndexingNotificationState || (SearchIndexingNotificationState = {}));
|
86
|
-
export var State;
|
87
|
-
(function (State) {
|
88
|
-
State["UNDEFINED"] = "UNDEFINED";
|
89
|
-
/** The gallery in the Editor segment */
|
90
|
-
State["SAVED"] = "SAVED";
|
91
|
-
/** The gallery in the LiveSite segment */
|
92
|
-
State["PUBLISHED"] = "PUBLISHED";
|
93
|
-
})(State || (State = {}));
|
94
|
-
const _createGalleryItemRequest = { item: '_item' };
|
95
|
-
const _createGalleryItemResponse = { item: '_item' };
|
96
|
-
const _createGalleryRequest = { gallery: '_gallery' };
|
97
|
-
const _createGalleryResponse = { gallery: '_gallery' };
|
98
|
-
const _deleteGalleryItemRequest = {};
|
99
|
-
const _deleteGalleryItemResponse = {};
|
100
|
-
const _deleteGalleryRequest = {};
|
101
|
-
const _deleteGalleryResponse = {};
|
102
|
-
const _gallery = { items: '_item' };
|
103
|
-
const _getGalleryItemRequest = {};
|
104
|
-
const _getGalleryItemResponse = { item: '_item' };
|
105
|
-
const _getGalleryRequest = {};
|
106
|
-
const _getGalleryResponse = { gallery: '_gallery' };
|
107
|
-
const _image = { imageInfo: 'wix.common.Image' };
|
108
|
-
const _item = {
|
109
|
-
image: '_image',
|
110
|
-
video: '_video',
|
111
|
-
secondaryMedia: '_secondaryMedia',
|
112
|
-
};
|
113
|
-
const _listGalleriesRequest = {};
|
114
|
-
const _listGalleriesResponse = { galleries: '_gallery' };
|
115
|
-
const _listGalleryItemsRequest = {};
|
116
|
-
const _listGalleryItemsResponse = { items: '_item' };
|
117
|
-
const _secondaryMedia = { image: '_image' };
|
118
|
-
const _updateGalleryItemRequest = { item: '_item' };
|
119
|
-
const _updateGalleryItemResponse = { item: '_item' };
|
120
|
-
const _updateGalleryRequest = { gallery: '_gallery' };
|
121
|
-
const _updateGalleryResponse = { gallery: '_gallery' };
|
122
|
-
const _video = { videoInfo: 'wix.common.VideoV2' };
|
123
|
-
export const onGalleryCreated = EventDefinition('wix.pro_gallery.gallery_v2_created')();
|
124
|
-
export const onGalleryUpdated = EventDefinition('wix.pro_gallery.gallery_v2_updated')();
|
125
|
-
export const onGalleryDeleted = EventDefinition('wix.pro_gallery.gallery_v2_deleted')();
|
126
|
-
export const onGalleryItemCreated = EventDefinition('wix.pro_gallery.gallery_v2_gallery_item_created')();
|
127
|
-
export const onGalleryItemUpdated = EventDefinition('wix.pro_gallery.gallery_v2_gallery_item_updated')();
|
128
|
-
export const onGalleryItemDeleted = EventDefinition('wix.pro_gallery.gallery_v2_gallery_item_deleted')();
|
129
|
-
/**
|
130
|
-
* Retrieves a list of galleries.
|
131
|
-
*
|
132
|
-
* The `listGalleries()` function returns a Promise that resolves to a list of up to 10 galleries at a given time. To list the next 10 galleries in your site's backend, use the `offset` parameter.
|
133
|
-
* @public
|
134
|
-
* @documentationMaturity preview
|
135
|
-
* @param options - Options to use when getting the list of galleries.
|
136
|
-
* @permissionScope Manage Galleries
|
137
|
-
* @permissionScopeId SCOPE.DC-PROGALLERY.MANAGE-GALLERIES
|
138
|
-
* @permissionScope Read Galleries
|
139
|
-
* @permissionScopeId SCOPE.DC-PROGALLERY.READ-GALLERIES
|
140
|
-
* @applicableIdentity APP
|
141
|
-
* @applicableIdentity MEMBER
|
142
|
-
* @applicableIdentity VISITOR
|
143
|
-
*/
|
144
|
-
export function listGalleries(options) {
|
145
|
-
var _a, _b, _c;
|
146
|
-
return __awaiter(this, arguments, void 0, function* () {
|
147
|
-
const requestTransformation = {
|
148
|
-
itemLimit: '$[0].itemLimit',
|
149
|
-
offset: '$[0].offset',
|
150
|
-
limit: '$[0].limit',
|
151
|
-
};
|
152
|
-
const responseTransformation = '$';
|
153
|
-
// @ts-ignore
|
154
|
-
const { httpClient, sideEffects } = arguments[1];
|
155
|
-
const { toAmbassadorRequest } = serializer({
|
156
|
-
rootSchema: _listGalleriesRequest,
|
157
|
-
depSchemas: {},
|
158
|
-
fqdnTransformation: {
|
159
|
-
paths: [],
|
160
|
-
transformation: _fromVeloEntity,
|
161
|
-
},
|
162
|
-
customTransformation: requestTransformation,
|
163
|
-
});
|
164
|
-
const { fromJSON } = serializer({
|
165
|
-
rootSchema: _listGalleriesResponse,
|
166
|
-
depSchemas: { _gallery, _image, _item, _secondaryMedia, _video },
|
167
|
-
fqdnTransformation: {
|
168
|
-
paths: [...['Array#galleries']],
|
169
|
-
transformation: _toVeloEntity,
|
170
|
-
},
|
171
|
-
customTransformation: responseTransformation,
|
172
|
-
});
|
173
|
-
const payload = toAmbassadorRequest([options]);
|
174
|
-
const reqOpts = ambassadorWixProGalleryV2Gallery.listGalleries(payload);
|
175
|
-
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
176
|
-
try {
|
177
|
-
const result = yield httpClient.request(reqOpts);
|
178
|
-
(_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
|
179
|
-
return fromJSON(result.data);
|
180
|
-
}
|
181
|
-
catch (err) {
|
182
|
-
const transformedError = sdkTransformError(err, {
|
183
|
-
spreadPathsToArguments: {},
|
184
|
-
explicitPathsToArguments: {
|
185
|
-
itemLimit: '$[0].itemLimit',
|
186
|
-
offset: '$[0].offset',
|
187
|
-
limit: '$[0].limit',
|
188
|
-
},
|
189
|
-
singleArgumentUnchanged: false,
|
190
|
-
}, ['options']);
|
191
|
-
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
192
|
-
throw transformedError;
|
193
|
-
}
|
194
|
-
});
|
195
|
-
}
|
196
|
-
/**
|
197
|
-
* Gets a gallery by ID.
|
198
|
-
*
|
199
|
-
* The `getGallery()` function returns a Promise that resolves to a gallery whose ID matches the given ID.
|
200
|
-
* @param galleryId - Gallery ID.
|
201
|
-
* @public
|
202
|
-
* @documentationMaturity preview
|
203
|
-
* @requiredField galleryId
|
204
|
-
* @param options - Options to use when getting the gallery.
|
205
|
-
* @permissionScope Manage Galleries
|
206
|
-
* @permissionScopeId SCOPE.DC-PROGALLERY.MANAGE-GALLERIES
|
207
|
-
* @permissionScope Read Galleries
|
208
|
-
* @permissionScopeId SCOPE.DC-PROGALLERY.READ-GALLERIES
|
209
|
-
* @applicableIdentity APP
|
210
|
-
* @applicableIdentity MEMBER
|
211
|
-
* @applicableIdentity VISITOR
|
212
|
-
* @returns Returned gallery.
|
213
|
-
*/
|
214
|
-
export function getGallery(galleryId, options) {
|
215
|
-
var _a, _b, _c;
|
216
|
-
return __awaiter(this, arguments, void 0, function* () {
|
217
|
-
const requestTransformation = {
|
218
|
-
galleryId: '$[0]',
|
219
|
-
itemOffset: '$[1].itemOffset',
|
220
|
-
itemLimit: '$[1].itemLimit',
|
221
|
-
};
|
222
|
-
const responseTransformation = '$.gallery';
|
223
|
-
// @ts-ignore
|
224
|
-
const { httpClient, sideEffects } = arguments[2];
|
225
|
-
const { toAmbassadorRequest } = serializer({
|
226
|
-
rootSchema: _getGalleryRequest,
|
227
|
-
depSchemas: {},
|
228
|
-
fqdnTransformation: {
|
229
|
-
paths: [],
|
230
|
-
transformation: _fromVeloEntity,
|
231
|
-
},
|
232
|
-
customTransformation: requestTransformation,
|
233
|
-
});
|
234
|
-
const { fromJSON } = serializer({
|
235
|
-
rootSchema: _getGalleryResponse,
|
236
|
-
depSchemas: { _gallery, _image, _item, _secondaryMedia, _video },
|
237
|
-
fqdnTransformation: {
|
238
|
-
paths: [...['gallery']],
|
239
|
-
transformation: _toVeloEntity,
|
240
|
-
},
|
241
|
-
customTransformation: responseTransformation,
|
242
|
-
});
|
243
|
-
const payload = toAmbassadorRequest([galleryId, options]);
|
244
|
-
const reqOpts = ambassadorWixProGalleryV2Gallery.getGallery(payload);
|
245
|
-
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
246
|
-
try {
|
247
|
-
const result = yield httpClient.request(reqOpts);
|
248
|
-
(_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
|
249
|
-
return fromJSON(result.data);
|
250
|
-
}
|
251
|
-
catch (err) {
|
252
|
-
const transformedError = sdkTransformError(err, {
|
253
|
-
spreadPathsToArguments: {},
|
254
|
-
explicitPathsToArguments: {
|
255
|
-
galleryId: '$[0]',
|
256
|
-
itemOffset: '$[1].itemOffset',
|
257
|
-
itemLimit: '$[1].itemLimit',
|
258
|
-
},
|
259
|
-
singleArgumentUnchanged: false,
|
260
|
-
}, ['galleryId', 'options']);
|
261
|
-
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
262
|
-
throw transformedError;
|
263
|
-
}
|
264
|
-
});
|
265
|
-
}
|
266
|
-
/**
|
267
|
-
* Retrieves a list of media items in a specified gallery.
|
268
|
-
*
|
269
|
-
* The `listGalleryItems()` function returns a Promise that resolves to a list of up to 100 gallery items. The gallery items are listed by `sortOrder` in descending order.
|
270
|
-
* @param galleryId - Gallery ID.
|
271
|
-
* @public
|
272
|
-
* @documentationMaturity preview
|
273
|
-
* @requiredField galleryId
|
274
|
-
* @param options - Options to use when getting the list of gallery items.
|
275
|
-
* @permissionScope Manage Galleries
|
276
|
-
* @permissionScopeId SCOPE.DC-PROGALLERY.MANAGE-GALLERIES
|
277
|
-
* @permissionScope Read Galleries
|
278
|
-
* @permissionScopeId SCOPE.DC-PROGALLERY.READ-GALLERIES
|
279
|
-
* @applicableIdentity APP
|
280
|
-
* @applicableIdentity MEMBER
|
281
|
-
* @applicableIdentity VISITOR
|
282
|
-
*/
|
283
|
-
export function listGalleryItems(galleryId, options) {
|
284
|
-
var _a, _b, _c;
|
285
|
-
return __awaiter(this, arguments, void 0, function* () {
|
286
|
-
const requestTransformation = {
|
287
|
-
galleryId: '$[0]',
|
288
|
-
itemOffset: '$[1].itemOffset',
|
289
|
-
itemLimit: '$[1].itemLimit',
|
290
|
-
};
|
291
|
-
const responseTransformation = '$';
|
292
|
-
// @ts-ignore
|
293
|
-
const { httpClient, sideEffects } = arguments[2];
|
294
|
-
const { toAmbassadorRequest } = serializer({
|
295
|
-
rootSchema: _listGalleryItemsRequest,
|
296
|
-
depSchemas: {},
|
297
|
-
fqdnTransformation: {
|
298
|
-
paths: [],
|
299
|
-
transformation: _fromVeloEntity,
|
300
|
-
},
|
301
|
-
customTransformation: requestTransformation,
|
302
|
-
});
|
303
|
-
const { fromJSON } = serializer({
|
304
|
-
rootSchema: _listGalleryItemsResponse,
|
305
|
-
depSchemas: { _image, _item, _secondaryMedia, _video },
|
306
|
-
fqdnTransformation: {
|
307
|
-
paths: [],
|
308
|
-
transformation: _toVeloEntity,
|
309
|
-
},
|
310
|
-
customTransformation: responseTransformation,
|
311
|
-
});
|
312
|
-
const payload = toAmbassadorRequest([galleryId, options]);
|
313
|
-
const reqOpts = ambassadorWixProGalleryV2Gallery.listGalleryItems(payload);
|
314
|
-
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
315
|
-
try {
|
316
|
-
const result = yield httpClient.request(reqOpts);
|
317
|
-
(_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
|
318
|
-
return fromJSON(result.data);
|
319
|
-
}
|
320
|
-
catch (err) {
|
321
|
-
const transformedError = sdkTransformError(err, {
|
322
|
-
spreadPathsToArguments: {},
|
323
|
-
explicitPathsToArguments: {
|
324
|
-
galleryId: '$[0]',
|
325
|
-
itemOffset: '$[1].itemOffset',
|
326
|
-
itemLimit: '$[1].itemLimit',
|
327
|
-
},
|
328
|
-
singleArgumentUnchanged: false,
|
329
|
-
}, ['galleryId', 'options']);
|
330
|
-
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
331
|
-
throw transformedError;
|
332
|
-
}
|
333
|
-
});
|
334
|
-
}
|
335
|
-
/**
|
336
|
-
* Gets a gallery item by ID.
|
337
|
-
*
|
338
|
-
* The `getGalleryItem()` function returns a Promise that resolves to a media item in a specified gallery whose ID matches the given ID.
|
339
|
-
* @public
|
340
|
-
* @documentationMaturity preview
|
341
|
-
* @requiredField identifiers
|
342
|
-
* @requiredField identifiers.galleryId
|
343
|
-
* @requiredField identifiers.itemId
|
344
|
-
* @param identifiers - Gallery ID and Item ID.
|
345
|
-
* @permissionScope Manage Galleries
|
346
|
-
* @permissionScopeId SCOPE.DC-PROGALLERY.MANAGE-GALLERIES
|
347
|
-
* @permissionScope Read Galleries
|
348
|
-
* @permissionScopeId SCOPE.DC-PROGALLERY.READ-GALLERIES
|
349
|
-
* @applicableIdentity APP
|
350
|
-
* @applicableIdentity MEMBER
|
351
|
-
* @applicableIdentity VISITOR
|
352
|
-
* @returns Returned media item.
|
353
|
-
*/
|
354
|
-
export function getGalleryItem(identifiers) {
|
355
|
-
var _a, _b, _c;
|
356
|
-
return __awaiter(this, arguments, void 0, function* () {
|
357
|
-
const requestTransformation = {
|
358
|
-
galleryId: '$[0].galleryId',
|
359
|
-
itemId: '$[0].itemId',
|
360
|
-
};
|
361
|
-
const responseTransformation = '$.item';
|
362
|
-
// @ts-ignore
|
363
|
-
const { httpClient, sideEffects } = arguments[1];
|
364
|
-
const { toAmbassadorRequest } = serializer({
|
365
|
-
rootSchema: _getGalleryItemRequest,
|
366
|
-
depSchemas: {},
|
367
|
-
fqdnTransformation: {
|
368
|
-
paths: [],
|
369
|
-
transformation: _fromVeloEntity,
|
370
|
-
},
|
371
|
-
customTransformation: requestTransformation,
|
372
|
-
});
|
373
|
-
const { fromJSON } = serializer({
|
374
|
-
rootSchema: _getGalleryItemResponse,
|
375
|
-
depSchemas: { _image, _item, _secondaryMedia, _video },
|
376
|
-
fqdnTransformation: {
|
377
|
-
paths: [],
|
378
|
-
transformation: _toVeloEntity,
|
379
|
-
},
|
380
|
-
customTransformation: responseTransformation,
|
381
|
-
});
|
382
|
-
const payload = toAmbassadorRequest([identifiers]);
|
383
|
-
const reqOpts = ambassadorWixProGalleryV2Gallery.getGalleryItem(payload);
|
384
|
-
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
385
|
-
try {
|
386
|
-
const result = yield httpClient.request(reqOpts);
|
387
|
-
(_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
|
388
|
-
return fromJSON(result.data);
|
389
|
-
}
|
390
|
-
catch (err) {
|
391
|
-
const transformedError = sdkTransformError(err, {
|
392
|
-
spreadPathsToArguments: {},
|
393
|
-
explicitPathsToArguments: {
|
394
|
-
galleryId: '$[0].galleryId',
|
395
|
-
itemId: '$[0].itemId',
|
396
|
-
},
|
397
|
-
singleArgumentUnchanged: false,
|
398
|
-
}, ['identifiers']);
|
399
|
-
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
400
|
-
throw transformedError;
|
401
|
-
}
|
402
|
-
});
|
403
|
-
}
|
404
|
-
/**
|
405
|
-
* Creates a gallery.
|
406
|
-
*
|
407
|
-
* The `createGallery()` function returns a Promise that resolves to a newly-created gallery after it has successfully been created.
|
408
|
-
*
|
409
|
-
* You can create your own gallery by providing the gallery information, or clone an existing gallery using the ID of that existing gallery. When a gallery is cloned, the newly-created gallery includes the same properties as the existing gallery except for the gallery and item IDs, sort order, and created and updated dates.
|
410
|
-
*
|
411
|
-
* The newly-created gallery is only available on your backend, and doesn't appear on your live site. To display your backend gallery on your live site, you need to connect it to a gallery component on your live site. To do this, import the `createGallery()` function to your page code, and write code to convert the backend gallery object to the frontend gallery component object. Once converted, the newly created backend gallery is visible on your live site. For reference, check out the code example, "Create a gallery and display it on your live site". To learn more, see [Displaying a Pro Gallery on Your Site Using the Pro Gallery Backend API](https://support.wix.com/en/article/velo-tutorial-displaying-a-pro-gallery-on-your-site-using-the-pro-gallery-backend-api).
|
412
|
-
*
|
413
|
-
* <blockquote class="important">
|
414
|
-
*
|
415
|
-
* __Important:__
|
416
|
-
* When creating `image` items in your gallery, the images must be uploaded to the [Wix Media Manager](https://support.wix.com/en/article/wix-media-uploading-media-to-the-media-manager) first as the `imageInfo` parameter currently only supports the Wix media URL.
|
417
|
-
*
|
418
|
-
* </blockquote>
|
419
|
-
*
|
420
|
-
* #### Override permissions
|
421
|
-
* This function is restricted and only runs if you elevate permissions using the `wix-auth` [`elevate()`](https://www.wix.com/velo/reference/wix-auth/elevate) function.
|
422
|
-
* <blockquote class='warning'>
|
423
|
-
* <p><strong>Warning:</strong> Elevating a function allows it to be called by any site visitor. Exercise caution to prevent security vulnerabilities.</p>
|
424
|
-
* </blockquote>
|
425
|
-
* @public
|
426
|
-
* @documentationMaturity preview
|
427
|
-
* @requiredField options.gallery.items.image.imageInfo
|
428
|
-
* @requiredField options.gallery.items.text.html
|
429
|
-
* @requiredField options.gallery.items.video.videoInfo
|
430
|
-
* @param options - Options to use when creating the gallery.
|
431
|
-
* @permissionScope Manage Galleries
|
432
|
-
* @permissionScopeId SCOPE.DC-PROGALLERY.MANAGE-GALLERIES
|
433
|
-
* @applicableIdentity APP
|
434
|
-
* @returns Created gallery.
|
435
|
-
*/
|
436
|
-
export function createGallery(options) {
|
437
|
-
var _a, _b, _c;
|
438
|
-
return __awaiter(this, arguments, void 0, function* () {
|
439
|
-
const requestTransformation = {
|
440
|
-
gallery: '$[0].gallery',
|
441
|
-
cloneFromGalleryId: '$[0].cloneFromGalleryId',
|
442
|
-
};
|
443
|
-
const responseTransformation = '$.gallery';
|
444
|
-
// @ts-ignore
|
445
|
-
const { httpClient, sideEffects } = arguments[1];
|
446
|
-
const { toAmbassadorRequest } = serializer({
|
447
|
-
rootSchema: _createGalleryRequest,
|
448
|
-
depSchemas: { _gallery, _image, _item, _secondaryMedia, _video },
|
449
|
-
fqdnTransformation: {
|
450
|
-
paths: [...['gallery']],
|
451
|
-
transformation: _fromVeloEntity,
|
452
|
-
},
|
453
|
-
customTransformation: requestTransformation,
|
454
|
-
});
|
455
|
-
const { fromJSON } = serializer({
|
456
|
-
rootSchema: _createGalleryResponse,
|
457
|
-
depSchemas: { _gallery, _image, _item, _secondaryMedia, _video },
|
458
|
-
fqdnTransformation: {
|
459
|
-
paths: [...['gallery']],
|
460
|
-
transformation: _toVeloEntity,
|
461
|
-
},
|
462
|
-
customTransformation: responseTransformation,
|
463
|
-
});
|
464
|
-
const payload = toAmbassadorRequest([options]);
|
465
|
-
const reqOpts = ambassadorWixProGalleryV2Gallery.createGallery(payload);
|
466
|
-
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
467
|
-
try {
|
468
|
-
const result = yield httpClient.request(reqOpts);
|
469
|
-
(_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
|
470
|
-
return fromJSON(result.data);
|
471
|
-
}
|
472
|
-
catch (err) {
|
473
|
-
const transformedError = sdkTransformError(err, {
|
474
|
-
spreadPathsToArguments: {},
|
475
|
-
explicitPathsToArguments: {
|
476
|
-
gallery: '$[0].gallery',
|
477
|
-
cloneFromGalleryId: '$[0].cloneFromGalleryId',
|
478
|
-
},
|
479
|
-
singleArgumentUnchanged: false,
|
480
|
-
}, ['options']);
|
481
|
-
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
482
|
-
throw transformedError;
|
483
|
-
}
|
484
|
-
});
|
485
|
-
}
|
486
|
-
/**
|
487
|
-
* Updates a gallery.
|
488
|
-
*
|
489
|
-
* The `updateGallery()` function returns a Promise that resolves to an updated gallery. Only the fields in the `gallery` object parameter can be updated. Specify which fields to update. Unspecified fields remain the same.
|
490
|
-
*
|
491
|
-
* <blockquote class="important">
|
492
|
-
*
|
493
|
-
* __Important:__
|
494
|
-
* When updating `image` items in your gallery, the images must be uploaded to the [Wix Media Manager](https://support.wix.com/en/article/wix-media-uploading-media-to-the-media-manager) first as the `imageInfo` parameter currently only supports the Wix media URL.
|
495
|
-
*
|
496
|
-
* </blockquote>
|
497
|
-
*
|
498
|
-
* #### Override permissions
|
499
|
-
* This function is restricted and only runs if you elevate permissions using the `wix-auth` [`elevate()`](https://www.wix.com/velo/reference/wix-auth/elevate) function.
|
500
|
-
* <blockquote class='warning'>
|
501
|
-
* <p><strong>Warning:</strong> Elevating a function allows it to be called by any site visitor. Exercise caution to prevent security vulnerabilities.</p>
|
502
|
-
* </blockquote>
|
503
|
-
* @public
|
504
|
-
* @documentationMaturity preview
|
505
|
-
* @requiredField _id
|
506
|
-
* @requiredField gallery
|
507
|
-
* @requiredField gallery.items.image.imageInfo
|
508
|
-
* @requiredField gallery.items.text.html
|
509
|
-
* @requiredField gallery.items.video.videoInfo
|
510
|
-
* @param _id - ID of the gallery to update.
|
511
|
-
* @param gallery - The information for the gallery being updated.
|
512
|
-
* @permissionScope Manage Galleries
|
513
|
-
* @permissionScopeId SCOPE.DC-PROGALLERY.MANAGE-GALLERIES
|
514
|
-
* @applicableIdentity APP
|
515
|
-
* @returns Updated gallery.
|
516
|
-
*/
|
517
|
-
export function updateGallery(_id, gallery) {
|
518
|
-
var _a, _b, _c;
|
519
|
-
return __awaiter(this, arguments, void 0, function* () {
|
520
|
-
const requestTransformation = { gallery: { '*': '$[1]', id: '$[0]' } };
|
521
|
-
const responseTransformation = '$.gallery';
|
522
|
-
// @ts-ignore
|
523
|
-
const { httpClient, sideEffects } = arguments[2];
|
524
|
-
const { toAmbassadorRequest } = serializer({
|
525
|
-
rootSchema: _updateGalleryRequest,
|
526
|
-
depSchemas: { _gallery, _image, _item, _secondaryMedia, _video },
|
527
|
-
fqdnTransformation: {
|
528
|
-
paths: [...['gallery']],
|
529
|
-
transformation: _fromVeloEntity,
|
530
|
-
},
|
531
|
-
customTransformation: requestTransformation,
|
532
|
-
});
|
533
|
-
const { fromJSON } = serializer({
|
534
|
-
rootSchema: _updateGalleryResponse,
|
535
|
-
depSchemas: { _gallery, _image, _item, _secondaryMedia, _video },
|
536
|
-
fqdnTransformation: {
|
537
|
-
paths: [...['gallery']],
|
538
|
-
transformation: _toVeloEntity,
|
539
|
-
},
|
540
|
-
customTransformation: responseTransformation,
|
541
|
-
});
|
542
|
-
const payload = toAmbassadorRequest([_id, gallery]);
|
543
|
-
const reqOpts = ambassadorWixProGalleryV2Gallery.updateGallery(payload);
|
544
|
-
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
545
|
-
try {
|
546
|
-
const result = yield httpClient.request(reqOpts);
|
547
|
-
(_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
|
548
|
-
return fromJSON(result.data);
|
549
|
-
}
|
550
|
-
catch (err) {
|
551
|
-
const transformedError = sdkTransformError(err, {
|
552
|
-
spreadPathsToArguments: { gallery: '$[1]' },
|
553
|
-
explicitPathsToArguments: { 'gallery.id': '$[0]' },
|
554
|
-
singleArgumentUnchanged: false,
|
555
|
-
}, ['_id', 'gallery']);
|
556
|
-
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
557
|
-
throw transformedError;
|
558
|
-
}
|
559
|
-
});
|
560
|
-
}
|
561
|
-
/**
|
562
|
-
* Deletes a gallery.
|
563
|
-
*
|
564
|
-
* The `deleteGallery()` function returns a Promise that resolves to the ID of the deleted gallery. When a gallery is deleted, the deleted gallery is no longer returned when calling the [`listGalleries()`](#listgalleries) function.
|
565
|
-
*
|
566
|
-
* #### Override permissions
|
567
|
-
* This function is restricted and only runs if you elevate permissions using the `wix-auth` [`elevate()`](https://www.wix.com/velo/reference/wix-auth/elevate) function.
|
568
|
-
* <blockquote class='warning'>
|
569
|
-
* <p><strong>Warning:</strong> Elevating a function allows it to be called by any site visitor. Exercise caution to prevent security vulnerabilities.</p>
|
570
|
-
* </blockquote>
|
571
|
-
* @param galleryId - ID of the gallery to delete.
|
572
|
-
* @public
|
573
|
-
* @documentationMaturity preview
|
574
|
-
* @requiredField galleryId
|
575
|
-
* @permissionScope Manage Galleries
|
576
|
-
* @permissionScopeId SCOPE.DC-PROGALLERY.MANAGE-GALLERIES
|
577
|
-
* @applicableIdentity APP
|
578
|
-
*/
|
579
|
-
export function deleteGallery(galleryId) {
|
580
|
-
var _a, _b, _c;
|
581
|
-
return __awaiter(this, arguments, void 0, function* () {
|
582
|
-
const requestTransformation = { galleryId: '$[0]' };
|
583
|
-
const responseTransformation = '$';
|
584
|
-
// @ts-ignore
|
585
|
-
const { httpClient, sideEffects } = arguments[1];
|
586
|
-
const { toAmbassadorRequest } = serializer({
|
587
|
-
rootSchema: _deleteGalleryRequest,
|
588
|
-
depSchemas: {},
|
589
|
-
fqdnTransformation: {
|
590
|
-
paths: [],
|
591
|
-
transformation: _fromVeloEntity,
|
592
|
-
},
|
593
|
-
customTransformation: requestTransformation,
|
594
|
-
});
|
595
|
-
const { fromJSON } = serializer({
|
596
|
-
rootSchema: _deleteGalleryResponse,
|
597
|
-
depSchemas: {},
|
598
|
-
fqdnTransformation: {
|
599
|
-
paths: [],
|
600
|
-
transformation: _toVeloEntity,
|
601
|
-
},
|
602
|
-
customTransformation: responseTransformation,
|
603
|
-
});
|
604
|
-
const payload = toAmbassadorRequest([galleryId]);
|
605
|
-
const reqOpts = ambassadorWixProGalleryV2Gallery.deleteGallery(payload);
|
606
|
-
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
607
|
-
try {
|
608
|
-
const result = yield httpClient.request(reqOpts);
|
609
|
-
(_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
|
610
|
-
return fromJSON(result.data);
|
611
|
-
}
|
612
|
-
catch (err) {
|
613
|
-
const transformedError = sdkTransformError(err, {
|
614
|
-
spreadPathsToArguments: {},
|
615
|
-
explicitPathsToArguments: { galleryId: '$[0]' },
|
616
|
-
singleArgumentUnchanged: false,
|
617
|
-
}, ['galleryId']);
|
618
|
-
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
619
|
-
throw transformedError;
|
620
|
-
}
|
621
|
-
});
|
622
|
-
}
|
623
|
-
/**
|
624
|
-
* Creates a media item in a specified gallery.
|
625
|
-
*
|
626
|
-
* The `createGalleryItem()` function returns a Promise that resolves to a newly-created gallery item after it has successfully been created.
|
627
|
-
*
|
628
|
-
* <blockquote class="important">
|
629
|
-
*
|
630
|
-
* __Important:__
|
631
|
-
* When creating `image` items in your gallery, the images must be uploaded to the [Wix Media Manager](https://support.wix.com/en/article/wix-media-uploading-media-to-the-media-manager) first as the `imageInfo` parameter currently only supports the Wix media URL.
|
632
|
-
*
|
633
|
-
* </blockquote>
|
634
|
-
*
|
635
|
-
* #### Override permissions
|
636
|
-
* This function is restricted and only runs if you elevate permissions using the `wix-auth` [`elevate()`](https://www.wix.com/velo/reference/wix-auth/elevate) function.
|
637
|
-
* <blockquote class='warning'>
|
638
|
-
* <p><strong>Warning:</strong> Elevating a function allows it to be called by any site visitor. Exercise caution to prevent security vulnerabilities.</p>
|
639
|
-
* </blockquote>
|
640
|
-
* @param galleryId - Gallery ID.
|
641
|
-
* @param item - Media item to create.
|
642
|
-
* @public
|
643
|
-
* @documentationMaturity preview
|
644
|
-
* @requiredField galleryId
|
645
|
-
* @requiredField item
|
646
|
-
* @requiredField item.image.imageInfo
|
647
|
-
* @requiredField item.text.html
|
648
|
-
* @requiredField item.video.videoInfo
|
649
|
-
* @permissionScope Manage Galleries
|
650
|
-
* @permissionScopeId SCOPE.DC-PROGALLERY.MANAGE-GALLERIES
|
651
|
-
* @applicableIdentity APP
|
652
|
-
* @returns Created media item.
|
653
|
-
*/
|
654
|
-
export function createGalleryItem(galleryId, item) {
|
655
|
-
var _a, _b, _c;
|
656
|
-
return __awaiter(this, arguments, void 0, function* () {
|
657
|
-
const requestTransformation = { galleryId: '$[0]', item: '$[1]' };
|
658
|
-
const responseTransformation = '$.item';
|
659
|
-
// @ts-ignore
|
660
|
-
const { httpClient, sideEffects } = arguments[2];
|
661
|
-
const { toAmbassadorRequest } = serializer({
|
662
|
-
rootSchema: _createGalleryItemRequest,
|
663
|
-
depSchemas: { _image, _item, _secondaryMedia, _video },
|
664
|
-
fqdnTransformation: {
|
665
|
-
paths: [],
|
666
|
-
transformation: _fromVeloEntity,
|
667
|
-
},
|
668
|
-
customTransformation: requestTransformation,
|
669
|
-
});
|
670
|
-
const { fromJSON } = serializer({
|
671
|
-
rootSchema: _createGalleryItemResponse,
|
672
|
-
depSchemas: { _image, _item, _secondaryMedia, _video },
|
673
|
-
fqdnTransformation: {
|
674
|
-
paths: [],
|
675
|
-
transformation: _toVeloEntity,
|
676
|
-
},
|
677
|
-
customTransformation: responseTransformation,
|
678
|
-
});
|
679
|
-
const payload = toAmbassadorRequest([galleryId, item]);
|
680
|
-
const reqOpts = ambassadorWixProGalleryV2Gallery.createGalleryItem(payload);
|
681
|
-
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
682
|
-
try {
|
683
|
-
const result = yield httpClient.request(reqOpts);
|
684
|
-
(_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
|
685
|
-
return fromJSON(result.data);
|
686
|
-
}
|
687
|
-
catch (err) {
|
688
|
-
const transformedError = sdkTransformError(err, {
|
689
|
-
spreadPathsToArguments: {},
|
690
|
-
explicitPathsToArguments: { galleryId: '$[0]', item: '$[1]' },
|
691
|
-
singleArgumentUnchanged: false,
|
692
|
-
}, ['galleryId', 'item']);
|
693
|
-
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
694
|
-
throw transformedError;
|
695
|
-
}
|
696
|
-
});
|
697
|
-
}
|
698
|
-
/**
|
699
|
-
* Updates a media item in a specified gallery.
|
700
|
-
*
|
701
|
-
* The `updateGalleryItem()` function returns a Promise that resolves to an updated gallery item. Only the fields in the `item` object parameter can be updated. Specify which fields to update. Unspecified fields remain the same.
|
702
|
-
*
|
703
|
-
* <blockquote class="important">
|
704
|
-
*
|
705
|
-
* __Important:__
|
706
|
-
* When updating `image` items in your gallery, the images must be uploaded to the [Wix Media Manager](https://support.wix.com/en/article/wix-media-uploading-media-to-the-media-manager) first as the `imageInfo` parameter currently only supports the Wix media URL.
|
707
|
-
*
|
708
|
-
* </blockquote>
|
709
|
-
*
|
710
|
-
* #### Override permissions
|
711
|
-
* This function is restricted and only runs if you elevate permissions using the `wix-auth` [`elevate()`](https://www.wix.com/velo/reference/wix-auth/elevate) function.
|
712
|
-
* <blockquote class='warning'>
|
713
|
-
* <p><strong>Warning:</strong> Elevating a function allows it to be called by any site visitor. Exercise caution to prevent security vulnerabilities.</p>
|
714
|
-
* </blockquote>
|
715
|
-
* @public
|
716
|
-
* @documentationMaturity preview
|
717
|
-
* @requiredField identifiers
|
718
|
-
* @requiredField identifiers.galleryId
|
719
|
-
* @requiredField identifiers.itemId
|
720
|
-
* @requiredField item
|
721
|
-
* @requiredField item.image.imageInfo
|
722
|
-
* @requiredField item.text.html
|
723
|
-
* @requiredField item.video.videoInfo
|
724
|
-
* @param item - The information for the gallery item being updated.
|
725
|
-
* @param identifiers - Gallery ID and Item ID.
|
726
|
-
* @permissionScope Manage Galleries
|
727
|
-
* @permissionScopeId SCOPE.DC-PROGALLERY.MANAGE-GALLERIES
|
728
|
-
* @applicableIdentity APP
|
729
|
-
* @returns Updated media item.
|
730
|
-
*/
|
731
|
-
export function updateGalleryItem(identifiers, item) {
|
732
|
-
var _a, _b, _c;
|
733
|
-
return __awaiter(this, arguments, void 0, function* () {
|
734
|
-
const requestTransformation = {
|
735
|
-
galleryId: '$[0].galleryId',
|
736
|
-
item: { '*': '$[1]', id: '$[0].itemId' },
|
737
|
-
};
|
738
|
-
const responseTransformation = '$.item';
|
739
|
-
// @ts-ignore
|
740
|
-
const { httpClient, sideEffects } = arguments[2];
|
741
|
-
const { toAmbassadorRequest } = serializer({
|
742
|
-
rootSchema: _updateGalleryItemRequest,
|
743
|
-
depSchemas: { _image, _item, _secondaryMedia, _video },
|
744
|
-
fqdnTransformation: {
|
745
|
-
paths: [],
|
746
|
-
transformation: _fromVeloEntity,
|
747
|
-
},
|
748
|
-
customTransformation: requestTransformation,
|
749
|
-
});
|
750
|
-
const { fromJSON } = serializer({
|
751
|
-
rootSchema: _updateGalleryItemResponse,
|
752
|
-
depSchemas: { _image, _item, _secondaryMedia, _video },
|
753
|
-
fqdnTransformation: {
|
754
|
-
paths: [],
|
755
|
-
transformation: _toVeloEntity,
|
756
|
-
},
|
757
|
-
customTransformation: responseTransformation,
|
758
|
-
});
|
759
|
-
const payload = toAmbassadorRequest([identifiers, item]);
|
760
|
-
const reqOpts = ambassadorWixProGalleryV2Gallery.updateGalleryItem(payload);
|
761
|
-
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
762
|
-
try {
|
763
|
-
const result = yield httpClient.request(reqOpts);
|
764
|
-
(_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
|
765
|
-
return fromJSON(result.data);
|
766
|
-
}
|
767
|
-
catch (err) {
|
768
|
-
const transformedError = sdkTransformError(err, {
|
769
|
-
spreadPathsToArguments: { item: '$[1]' },
|
770
|
-
explicitPathsToArguments: {
|
771
|
-
galleryId: '$[0].galleryId',
|
772
|
-
'item.id': '$[0].itemId',
|
773
|
-
},
|
774
|
-
singleArgumentUnchanged: false,
|
775
|
-
}, ['identifiers', 'item']);
|
776
|
-
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
777
|
-
throw transformedError;
|
778
|
-
}
|
779
|
-
});
|
780
|
-
}
|
781
|
-
/**
|
782
|
-
* Deletes a media item from a gallery.
|
783
|
-
*
|
784
|
-
* The `deleteGalleryItem()` function returns a Promise that resolves to the ID of the deleted gallery item. When a gallery item is deleted, the deleted gallery item is no longer returned when calling the [`listGalleryItems()`](#listgalleryitems) function.
|
785
|
-
*
|
786
|
-
* #### Override permissions
|
787
|
-
* This function is restricted and only runs if you elevate permissions using the `wix-auth` [`elevate()`](https://www.wix.com/velo/reference/wix-auth/elevate) function.
|
788
|
-
* <blockquote class='warning'>
|
789
|
-
* <p><strong>Warning:</strong> Elevating a function allows it to be called by any site visitor. Exercise caution to prevent security vulnerabilities.</p>
|
790
|
-
* </blockquote>
|
791
|
-
* @public
|
792
|
-
* @documentationMaturity preview
|
793
|
-
* @requiredField identifiers
|
794
|
-
* @requiredField identifiers.galleryId
|
795
|
-
* @requiredField identifiers.itemId
|
796
|
-
* @param identifiers - Gallery ID and Item ID.
|
797
|
-
* @permissionScope Manage Galleries
|
798
|
-
* @permissionScopeId SCOPE.DC-PROGALLERY.MANAGE-GALLERIES
|
799
|
-
* @applicableIdentity APP
|
800
|
-
*/
|
801
|
-
export function deleteGalleryItem(identifiers) {
|
802
|
-
var _a, _b, _c;
|
803
|
-
return __awaiter(this, arguments, void 0, function* () {
|
804
|
-
const requestTransformation = {
|
805
|
-
galleryId: '$[0].galleryId',
|
806
|
-
itemId: '$[0].itemId',
|
807
|
-
};
|
808
|
-
const responseTransformation = '$';
|
809
|
-
// @ts-ignore
|
810
|
-
const { httpClient, sideEffects } = arguments[1];
|
811
|
-
const { toAmbassadorRequest } = serializer({
|
812
|
-
rootSchema: _deleteGalleryItemRequest,
|
813
|
-
depSchemas: {},
|
814
|
-
fqdnTransformation: {
|
815
|
-
paths: [],
|
816
|
-
transformation: _fromVeloEntity,
|
817
|
-
},
|
818
|
-
customTransformation: requestTransformation,
|
819
|
-
});
|
820
|
-
const { fromJSON } = serializer({
|
821
|
-
rootSchema: _deleteGalleryItemResponse,
|
822
|
-
depSchemas: {},
|
823
|
-
fqdnTransformation: {
|
824
|
-
paths: [],
|
825
|
-
transformation: _toVeloEntity,
|
826
|
-
},
|
827
|
-
customTransformation: responseTransformation,
|
828
|
-
});
|
829
|
-
const payload = toAmbassadorRequest([identifiers]);
|
830
|
-
const reqOpts = ambassadorWixProGalleryV2Gallery.deleteGalleryItem(payload);
|
831
|
-
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
832
|
-
try {
|
833
|
-
const result = yield httpClient.request(reqOpts);
|
834
|
-
(_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
|
835
|
-
return fromJSON(result.data);
|
836
|
-
}
|
837
|
-
catch (err) {
|
838
|
-
const transformedError = sdkTransformError(err, {
|
839
|
-
spreadPathsToArguments: {},
|
840
|
-
explicitPathsToArguments: {
|
841
|
-
galleryId: '$[0].galleryId',
|
842
|
-
itemId: '$[0].itemId',
|
843
|
-
},
|
844
|
-
singleArgumentUnchanged: false,
|
845
|
-
}, ['identifiers']);
|
846
|
-
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
847
|
-
throw transformedError;
|
848
|
-
}
|
849
|
-
});
|
850
|
-
}
|
851
|
-
//# sourceMappingURL=pro-gallery-v2-gallery.universal.js.map
|