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