@wix/pro-gallery 1.0.33 → 1.0.35

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