@enplug/sdk-dashboard 5.4.0-dev.1 → 5.4.1

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/dist/dashboard.js CHANGED
@@ -94,450 +94,561 @@ var enplug =
94
94
  /*! no static exports found */
95
95
  /***/ (function(module, exports, __webpack_require__) {
96
96
 
97
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__, exports, __webpack_require__(/*! ./utils */ "./src/utils.ts"), __webpack_require__(/*! ./internal-types */ "./src/internal-types.ts")], __WEBPACK_AMD_DEFINE_RESULT__ = (function (require, exports, utils_1, internal_types_1) {
98
- "use strict";
99
- Object.defineProperty(exports, "__esModule", { value: true });
100
- exports.Account = void 0;
101
- var Account = /** @class */ (function () {
102
- function Account(bridge) {
103
- this.bridge = bridge;
104
- }
105
- /**
106
- * Loads all information for the current user. App instance ID,
107
- * account type, token, account ID, venue ID, and environment.
108
- *
109
- * Data is passed as the first param to the success callback.
110
- */
111
- Account.prototype.getAccount = function () {
112
- return this.bridge.sendMessage({
113
- namespace: internal_types_1.MessageNamespaces.App,
114
- name: internal_types_1.MessageNames.GetAccount,
115
- });
116
- };
117
- /**
118
- * Loads all information for the current user.
119
- */
120
- Account.prototype.getUser = function () {
121
- return this.bridge.sendMessage({
122
- namespace: internal_types_1.MessageNamespaces.App,
123
- name: internal_types_1.MessageNames.GetUser,
124
- });
125
- };
126
- Account.prototype.getDisplayGroups = function () {
127
- return this.bridge.sendMessage({
128
- namespace: internal_types_1.MessageNamespaces.App,
129
- name: internal_types_1.MessageNames.GetDisplayGroups,
130
- });
131
- };
132
- Account.prototype.getSelectedDisplayId = function () {
133
- return this.bridge.sendMessage({
134
- namespace: internal_types_1.MessageNamespaces.App,
135
- name: internal_types_1.MessageNames.GetSelectedDisplayId,
136
- });
137
- };
138
- /**
139
- * Loads an array of assets for the current app instance.
140
- */
141
- Account.prototype.getAssets = function () {
142
- return this.bridge.sendMessage({
143
- namespace: internal_types_1.MessageNamespaces.App,
144
- name: internal_types_1.MessageNames.GetAssets,
145
- });
146
- };
147
- /**
148
- * Loads an array of assets by Ids.
149
- * @param {string[]} assetsIds An array of ids of the assets that are to be returned.
150
- */
151
- Account.prototype.getAssetsByIds = function (assetsIds) {
152
- utils_1.validateArray(assetsIds, 'You must provide assetIds array to getAssetsByIds call');
153
- return this.bridge.sendMessage({
154
- namespace: internal_types_1.MessageNamespaces.App,
155
- name: internal_types_1.MessageNames.GetAssetsByIds,
156
- params: {
157
- assetsIds: assetsIds,
158
- },
159
- });
160
- };
161
- /**
162
- * Loads an array of assets for a specifig app instance.
163
- * Data is passed as the first param to the success callback.
164
- * @param {string} appId An id of an app.
165
- */
166
- Account.prototype.getAssetsForApp = function (appId) {
167
- utils_1.validateString(appId, 'You must provide appId string to getAssetsForApp call');
168
- return this.bridge.sendMessage({
169
- namespace: internal_types_1.MessageNamespaces.App,
170
- name: internal_types_1.MessageNames.GetAssetsForApp,
171
- appId: appId,
172
- });
173
- };
174
- /**
175
- * Loads an content-approval asset revision.
176
- * Data is passed as the first param to the success callback.
177
- * @param {string} assetId An id of an asset.
178
- * @param {string} version A version of an asset.
179
- */
180
- Account.prototype.getAssetRevision = function (assetId, version) {
181
- utils_1.validateString(assetId, 'You must provide assetId string to getAssetRevision call');
182
- utils_1.validateString(version, 'You must provide version string to getAssetRevision call');
183
- return this.bridge.sendMessage({
184
- namespace: internal_types_1.MessageNamespaces.App,
185
- name: internal_types_1.MessageNames.GetAssetRevision,
186
- params: {
187
- assetId: assetId,
188
- version: version,
189
- },
190
- });
191
- };
192
- /**
193
- * Creates an asset under the current app instance.
194
- * @param {Asset<T>[]} assets An array of asset object to create.
195
- * @param {DeployDialogOptions?} dialogOptions An object with details about displaying a deploy dialog
196
- * and its content after save.
197
- */
198
- Account.prototype.bulkCreateAssets = function (assets, dialogOptions) {
199
- if (dialogOptions === void 0) { dialogOptions = {}; }
200
- utils_1.validateArray(assets, 'You must provide an array of assets when creating new assets.');
201
- utils_1.validateObject(assets[0], 'You must provide an array of assets (objects) when creating new assets.');
202
- if (assets[0]) {
203
- utils_1.validateObject(assets[0].Value, 'You must provide a Value (object) when creating an asset.');
204
- }
205
- return this.bridge.sendMessage({
206
- namespace: internal_types_1.MessageNamespaces.App,
207
- name: internal_types_1.MessageNames.BulkCreateAssets,
208
- params: {
209
- assets: assets,
210
- dialogOptions: dialogOptions,
211
- },
212
- });
213
- };
214
- /**
215
- * Creates an asset under the current app instance.
216
- * @param {Asset<T>[]} assets An array of assets to deploy.
217
- * @param {DeployDialogOptions?} dialogOptions An object with details about displaying a deploy dialog
218
- * and its content after save.
219
- */
220
- Account.prototype.bulkDeployAssets = function (assets, dialogOptions) {
221
- if (dialogOptions === void 0) { dialogOptions = {}; }
222
- utils_1.validateArray(assets, 'You must provide an array of assets when deploying assets.');
223
- utils_1.validateObject(assets[0], 'You must provide an array of assets (objects) when deploying assets.');
224
- if (assets[0]) {
225
- utils_1.validateObject(assets[0].Value, 'You must provide a Value (object) when deploying an asset.');
226
- utils_1.validateString(assets[0].Id, 'You must provide the ID (string) on the asset you want to update.');
227
- }
228
- return this.bridge.sendMessage({
229
- namespace: internal_types_1.MessageNamespaces.App,
230
- name: internal_types_1.MessageNames.BulkDeployAssets,
231
- params: {
232
- assets: assets,
233
- dialogOptions: dialogOptions,
234
- },
235
- });
236
- };
237
- /**
238
- * Saves an asset without showing the deployment dialog.
239
- * @param {Asset<T>} asset An asset to save.
240
- * @param {DeployDialogOptions?} dialogOptions An object with details about displaying a deploy dialog
241
- * and its content after save.
242
- */
243
- Account.prototype.saveAsset = function (asset, dialogOptions) {
244
- if (dialogOptions === void 0) { dialogOptions = {}; }
245
- utils_1.validateObject(asset, 'You must provide an asset object to save.');
246
- return this.bridge.sendMessage({
247
- namespace: internal_types_1.MessageNamespaces.App,
248
- name: internal_types_1.MessageNames.SaveAsset,
249
- params: {
250
- asset: asset,
251
- dialogOptions: dialogOptions,
252
- },
253
- });
254
- };
255
- Account.prototype.saveAssetForApp = function (appId, asset, dialogOptions) {
256
- if (dialogOptions === void 0) { dialogOptions = {}; }
257
- utils_1.validateString(appId, 'You must provide appId');
258
- utils_1.validateObject(asset, 'You must provide an asset to save');
259
- return this.bridge.sendMessage({
260
- namespace: internal_types_1.MessageNamespaces.App,
261
- name: internal_types_1.MessageNames.SaveAsset,
262
- params: {
263
- asset: asset,
264
- appId: appId,
265
- dialogOptions: dialogOptions,
266
- },
267
- });
268
- };
269
- /**
270
- * This is for saving an order of assets if needed for the current app. An array of asset Ids
271
- * is all that is needed, but the implementation also accepts an array of asset objects with "Id" string properties.
272
- * @param {string[] | Asset<any>[]} assets An array of assetIds or assets in order which is to be saved.
273
- */
274
- Account.prototype.updateAssetOrder = function (assets) {
275
- utils_1.validateArray(assets, 'You must provide an array of assets (or asset ids) in the new order.');
276
- return this.bridge.sendMessage({
277
- namespace: internal_types_1.MessageNamespaces.App,
278
- name: internal_types_1.MessageNames.UpdateAssetOrder,
279
- params: {
280
- assets: assets,
281
- },
282
- });
283
- };
284
- /**
285
- * Deletes an asset for the current app instance.
286
- * @param {string|string[]} id Id of an asset to delete.
287
- */
288
- Account.prototype.deleteAsset = function (id) {
289
- if (!Array.isArray(id)) {
290
- utils_1.validateString(id, 'You must provide the ID (string) of the asset to delete.');
291
- id = [id];
292
- }
293
- else {
294
- utils_1.validateArray(id, 'You must pass a single ID (string) or Array of asset IDs to be deleted.');
295
- utils_1.validateString(id[0], 'You must provide at least one Asset ID (string) to be deleted.');
296
- }
297
- return this.bridge.sendMessage({
298
- namespace: internal_types_1.MessageNamespaces.App,
299
- name: internal_types_1.MessageNames.DeleteAsset,
300
- params: {
301
- ids: id,
302
- },
303
- });
304
- };
305
- /**
306
- * Marks asset as recently viewed
307
- */
308
- Account.prototype.touchAsset = function (id) {
309
- utils_1.validateString(id, 'You must provide an id string to touchAsset call');
310
- return this.bridge.sendMessage({
311
- namespace: internal_types_1.MessageNamespaces.App,
312
- name: internal_types_1.MessageNames.TouchAsset,
313
- params: { id: id },
314
- });
315
- };
316
- /**
317
- * Marks asset as recently viewed
318
- */
319
- Account.prototype.getAssetNeedsApproval = function (id) {
320
- utils_1.validateString(id, 'You must provide an id string to getAssetNeedsApproval call');
321
- return this.bridge.sendMessage({
322
- namespace: internal_types_1.MessageNamespaces.App,
323
- name: internal_types_1.MessageNames.GetAssetNeedsApproval,
324
- params: { id: id },
325
- });
326
- };
327
- /**
328
- * Loads an array of default assets for the current instance's app definition.
329
- * Data is passed as the first param to the success callback.
330
- * @param {string} level 'Default', 'Network', 'Account'
331
- * @param {string} levelId NetworkId or AccountId
332
- */
333
- Account.prototype.getDefaultAssets = function (level, levelId) {
334
- if (level === void 0) { level = 'Default'; }
335
- utils_1.validateString(level, 'You must provide a level parameter that is either "Default", "Network", or "Account"');
336
- if (level !== 'Account' && level !== 'Network' && level !== 'Default') {
337
- throw new Error('You must provide a level parameter that is either "Default", "Network", or "Account"');
338
- }
339
- if (level === 'Account' || level === 'Network') {
340
- utils_1.validateString(levelId, 'You must provide relevant id for the "Account" or "Network" level default assets');
341
- }
342
- return this.bridge.sendMessage({
343
- namespace: internal_types_1.MessageNamespaces.App,
344
- name: internal_types_1.MessageNames.GetDefaultAssets,
345
- params: {
346
- level: level,
347
- levelId: levelId,
348
- },
349
- });
350
- };
351
- /**
352
- * Loads list of banner/ticker widget apps
353
- */
354
- Account.prototype.getZoningApps = function () {
355
- return this.bridge.sendMessage({
356
- namespace: internal_types_1.MessageNamespaces.App,
357
- name: internal_types_1.MessageNames.GetZoningApps,
358
- });
359
- };
360
- /**
361
- * Loads widget assets used in a given zoning asset layout
362
- */
363
- Account.prototype.getZoningLayoutAssets = function (assetId) {
364
- return this.bridge.sendMessage({
365
- namespace: internal_types_1.MessageNamespaces.App,
366
- name: internal_types_1.MessageNames.GetZoningLayoutAssets,
367
- params: {
368
- assetId: assetId,
369
- },
370
- });
371
- };
372
- /**
373
- * Shows modal allowing to pick existing widget or create new
374
- */
375
- Account.prototype.acquireZoningWidget = function (zoningAssetId, slotConfig, widgetAppId, usedAssetsIds) {
376
- utils_1.validateString(widgetAppId, 'You must provide an widgetAppId parameter');
377
- utils_1.validateObject(slotConfig, 'You must provide an slotConfig parameter');
378
- return this.bridge.sendMessage({
379
- namespace: internal_types_1.MessageNamespaces.App,
380
- name: internal_types_1.MessageNames.AcquireZoningWidget,
381
- params: {
382
- zoningAssetId: zoningAssetId,
383
- slotConfig: slotConfig,
384
- widgetAppId: widgetAppId,
385
- usedAssetsIds: usedAssetsIds,
386
- },
387
- });
388
- };
389
- /**
390
- * Fetches zoning data available after adding/editing a widget
391
- */
392
- Account.prototype.editZoningWidget = function (zoningAssetId, slotConfig, widgetAppId, widgetAssetId) {
393
- return this.bridge.sendMessage({
394
- namespace: internal_types_1.MessageNamespaces.App,
395
- name: internal_types_1.MessageNames.EditZoningWidget,
396
- params: {
397
- zoningAssetId: zoningAssetId,
398
- slotConfig: slotConfig,
399
- widgetAppId: widgetAppId,
400
- widgetAssetId: widgetAssetId,
401
- },
402
- });
403
- };
404
- /**
405
- * Fetches zoning data available after adding/editing a widget
406
- */
407
- Account.prototype.getZoningData = function () {
408
- return this.bridge.sendMessage({
409
- namespace: internal_types_1.MessageNamespaces.App,
410
- name: internal_types_1.MessageNames.GetZoningData,
411
- });
412
- };
413
- /**
414
- * Loads available fonts for the current app or for specified appId.
415
- * @param {string?} appId
416
- */
417
- Account.prototype.getFonts = function (appId) {
418
- return this.bridge.sendMessage({
419
- namespace: internal_types_1.MessageNamespaces.App,
420
- name: internal_types_1.MessageNames.GetFonts,
421
- params: {
422
- appId: appId,
423
- },
424
- });
425
- };
426
- /**
427
- * Loads available themes for the current app or for specified appId.
428
- * @param {string?} [appId]
429
- */
430
- Account.prototype.getThemes = function (appId) {
431
- return this.bridge.sendMessage({
432
- namespace: internal_types_1.MessageNamespaces.App,
433
- name: internal_types_1.MessageNames.GetThemes,
434
- params: {
435
- appId: appId,
436
- },
437
- }).then(function (_a) {
438
- var themes = _a.themes;
439
- return themes;
440
- });
441
- };
442
- /**
443
- * Loads theme by id.
444
- * @param {string} themeId An id of a theme
445
- */
446
- Account.prototype.getTheme = function (id) {
447
- return this.bridge.sendMessage({
448
- namespace: internal_types_1.MessageNamespaces.App,
449
- name: internal_types_1.MessageNames.GetTheme,
450
- params: {
451
- id: id,
452
- },
453
- });
454
- };
455
- /**
456
- * Creates a new theme under the current app instance app definition.
457
- * The new theme will be available only under the current user's account.
458
- * @param {object} themeDefinition
459
- * @param {object} theme
460
- * @param {string} previewUrl
461
- * @param {Array} previewAsset
462
- * @param {object} layout
463
- * @param {Array} fonts
464
- * @param {object} feedData
465
- * @returns {number} callId
466
- */
467
- Account.prototype.editTheme = function (themeDefinition, theme, previewUrl, previewAsset, layout, fonts, feedData) {
468
- utils_1.validateObject(themeDefinition, 'You must provide the theme definition (object).');
469
- return this.bridge.sendMessage({
470
- namespace: internal_types_1.MessageNamespaces.App,
471
- name: internal_types_1.MessageNames.EditTheme,
472
- params: {
473
- themeDefinition: themeDefinition,
474
- theme: theme,
475
- previewUrl: previewUrl,
476
- previewAsset: previewAsset,
477
- layout: layout,
478
- fonts: fonts,
479
- feedData: feedData,
480
- },
481
- });
482
- };
483
- /**
484
- * Creates a new theme under the current app definition.
485
- * The new theme will be available to all users in the account.
486
- * @param {object} theme
487
- */
488
- Account.prototype.saveTheme = function (theme) {
489
- utils_1.validateObject(theme, 'You must provide the theme (object) to save.');
490
- utils_1.validateObject(theme.Value, 'You must provide the theme.Value (object) to save.');
491
- return this.bridge.sendMessage({
492
- namespace: internal_types_1.MessageNamespaces.App,
493
- name: internal_types_1.MessageNames.SaveTheme,
494
- params: {
495
- theme: theme,
496
- },
497
- });
498
- };
499
- /**
500
- * Deletes a theme from the current user's account for
501
- * the current app definition. Cannot remove default themes.
502
- * @param {string} themeId
503
- */
504
- Account.prototype.deleteTheme = function (themeId) {
505
- utils_1.validateString(themeId, 'You must provide the ID (string) of the theme to remove.');
506
- return this.bridge.sendMessage({
507
- namespace: internal_types_1.MessageNamespaces.App,
508
- name: internal_types_1.MessageNames.DeleteTheme,
509
- params: {
510
- themeId: themeId,
511
- },
512
- });
513
- };
514
- /**
515
- * Returns flag status on account
516
- */
517
- Account.prototype.hasFeatureFlag = function (flagName) {
518
- utils_1.validateString(flagName, 'You must provide the flag name (string).');
519
- return this.bridge.sendMessage({
520
- namespace: internal_types_1.MessageNamespaces.App,
521
- name: internal_types_1.MessageNames.HasFeatureFlag,
522
- params: {
523
- flagName: flagName,
524
- },
525
- });
526
- };
527
- /**
528
- * Retrieve all custom display group properties on an account
529
- */
530
- Account.prototype.getDisplayGroupCustomProperties = function () {
531
- return this.bridge.sendMessage({
532
- namespace: internal_types_1.MessageNamespaces.App,
533
- name: internal_types_1.MessageNames.GetDisplayGroupCustomProperties,
534
- });
535
- };
536
- return Account;
537
- }());
538
- exports.Account = Account;
97
+ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__, exports, __webpack_require__(/*! ./utils */ "./src/utils.ts"), __webpack_require__(/*! ./internal-types */ "./src/internal-types.ts")], __WEBPACK_AMD_DEFINE_RESULT__ = (function (require, exports, utils_1, internal_types_1) {
98
+ "use strict";
99
+ Object.defineProperty(exports, "__esModule", { value: true });
100
+ exports.Account = void 0;
101
+ /**
102
+ * Account API is a part of the Dashboard SDK used for managing assets, and other app, user and account related data.
103
+ * Use global `enplug.account` object to access these methods.
104
+ *
105
+ * ```typescript title="Example usage of the Account API"
106
+ * const assets = await enplug.account.getAssets();
107
+ * ```
108
+ *
109
+ * Among others, this API allows you to fetch and manipulate the assets:
110
+ * - {@link getAssets|`enplug.account.getAssets()`} - fetch the asset list
111
+ * - {@link getAssetsByIds|`enplug.account.getAssetsByIds()`} - fetch provided assets
112
+ * - {@link saveAsset|`enplug.account.saveAsset()`} - creates/updates an asset, can display Deploy Dialog for editing
113
+ * - {@link deleteAsset|`enplug.account.deleteAsset()`} - removes an asset
114
+ * - {@link touchAsset|`enplug.account.touchAsset()`} - marks asset as recently viewed
115
+ *
116
+ * Other useful commands:
117
+ * - {@link getAccount|`enplug.account.getAccount()`} - fetch current account data
118
+ * - {@link getUser|`enplug.account.getUser()`} - fetch current user data
119
+ * - {@link getThemes|`enplug.account.getThemes()`} - fetches list of themes
120
+ * - {@link getTheme|`enplug.account.getTheme()`} - fetches theme
121
+ * - {@link editTheme|`enplug.account.editTheme()`} - edits the theme
122
+ * - {@link deleteTheme|`enplug.account.deleteTheme()`} - deletes the theme
123
+ */
124
+ var Account = /** @class */ (function () {
125
+ /** @internal */
126
+ function Account(bridge) {
127
+ this.bridge = bridge;
128
+ }
129
+ /**
130
+ * Loads all information for the current user. App instance ID,
131
+ * account type, token, account ID, venue ID, and environment.
132
+ */
133
+ Account.prototype.getAccount = function () {
134
+ return this.bridge.sendMessage({
135
+ namespace: internal_types_1.MessageNamespaces.App,
136
+ name: internal_types_1.MessageNames.GetAccount,
137
+ });
138
+ };
139
+ /**
140
+ * Loads all information for the current user.
141
+ */
142
+ Account.prototype.getUser = function () {
143
+ return this.bridge.sendMessage({
144
+ namespace: internal_types_1.MessageNamespaces.App,
145
+ name: internal_types_1.MessageNames.GetUser,
146
+ });
147
+ };
148
+ /**
149
+ * Loads information for the currently selected display group(s).
150
+ *
151
+ * @returns In the account context, it will return all Display Groups in the account;
152
+ * in the Display Group context, it will return only this group’s information.
153
+ */
154
+ Account.prototype.getDisplayGroups = function () {
155
+ return this.bridge.sendMessage({
156
+ namespace: internal_types_1.MessageNamespaces.App,
157
+ name: internal_types_1.MessageNames.GetDisplayGroups,
158
+ });
159
+ };
160
+ Account.prototype.getSelectedDisplayId = function () {
161
+ return this.bridge.sendMessage({
162
+ namespace: internal_types_1.MessageNamespaces.App,
163
+ name: internal_types_1.MessageNames.GetSelectedDisplayId,
164
+ });
165
+ };
166
+ /**
167
+ * Loads an array of assets for the current app instance.
168
+ *
169
+ * The list is also limited to the {@link setDisplaySelectorCallback|Display Group selector} dropdown's choice.
170
+ *
171
+ * @param T - Model of asset's value
172
+ *
173
+ * @returns Array of assets added by current app filtered by the {@link setDisplaySelectorCallback|Display Group selection} if it is set.
174
+ */
175
+ Account.prototype.getAssets = function () {
176
+ return this.bridge.sendMessage({
177
+ namespace: internal_types_1.MessageNamespaces.App,
178
+ name: internal_types_1.MessageNames.GetAssets,
179
+ });
180
+ };
181
+ /**
182
+ * Loads an array of assets by Ids.
183
+ *
184
+ * @param T - Model of asset's value
185
+ * @param assetsIds - An array of ids of the assets that are to be returned.
186
+ *
187
+ * @returns Resolves to an array of requested assets.
188
+ */
189
+ Account.prototype.getAssetsByIds = function (assetsIds) {
190
+ utils_1.validateArray(assetsIds, 'You must provide assetIds array to getAssetsByIds call');
191
+ return this.bridge.sendMessage({
192
+ namespace: internal_types_1.MessageNamespaces.App,
193
+ name: internal_types_1.MessageNames.GetAssetsByIds,
194
+ params: {
195
+ assetsIds: assetsIds,
196
+ },
197
+ });
198
+ };
199
+ /**
200
+ * Loads an array of assets for a specifig app instance.
201
+ * Data is passed as the first param to the success callback.
202
+ *
203
+ * @param T - Model of asset's value
204
+ * @param appId - An id of an app.
205
+ */
206
+ Account.prototype.getAssetsForApp = function (appId) {
207
+ utils_1.validateString(appId, 'You must provide appId string to getAssetsForApp call');
208
+ return this.bridge.sendMessage({
209
+ namespace: internal_types_1.MessageNamespaces.App,
210
+ name: internal_types_1.MessageNames.GetAssetsForApp,
211
+ appId: appId,
212
+ });
213
+ };
214
+ /**
215
+ * Loads a content-approval asset revision.
216
+ *
217
+ * @param T - Model of asset's value
218
+ * @param assetId - ID of an asset
219
+ * @param version - Version of the asset
220
+ *
221
+ * @returns Resolves to the provided revision of the asset.
222
+ */
223
+ Account.prototype.getAssetRevision = function (assetId, version) {
224
+ utils_1.validateString(assetId, 'You must provide assetId string to getAssetRevision call');
225
+ utils_1.validateString(version, 'You must provide version string to getAssetRevision call');
226
+ return this.bridge.sendMessage({
227
+ namespace: internal_types_1.MessageNamespaces.App,
228
+ name: internal_types_1.MessageNames.GetAssetRevision,
229
+ params: {
230
+ assetId: assetId,
231
+ version: version,
232
+ },
233
+ });
234
+ };
235
+ /**
236
+ * Creates an asset under the current app instance.
237
+ * @param assets - An array of assets to create.
238
+ * @param dialogOptions - An object with details about displaying the deploy dialog
239
+ * and its content after save.
240
+ *
241
+ * @returns Resolves to list of saved assets as they came from the server.
242
+ */
243
+ Account.prototype.bulkCreateAssets = function (assets, dialogOptions) {
244
+ if (dialogOptions === void 0) { dialogOptions = {}; }
245
+ utils_1.validateArray(assets, 'You must provide an array of assets when creating new assets.');
246
+ utils_1.validateObject(assets[0], 'You must provide an array of assets (objects) when creating new assets.');
247
+ if (assets[0]) {
248
+ utils_1.validateObject(assets[0].Value, 'You must provide a Value (object) when creating an asset.');
249
+ }
250
+ return this.bridge.sendMessage({
251
+ namespace: internal_types_1.MessageNamespaces.App,
252
+ name: internal_types_1.MessageNames.BulkCreateAssets,
253
+ params: {
254
+ assets: assets,
255
+ dialogOptions: dialogOptions,
256
+ },
257
+ });
258
+ };
259
+ /**
260
+ * Creates an asset under the current app instance.
261
+ * @param assets - An array of assets to deploy.
262
+ * @param dialogOptions - An object with details about displaying the deploy dialog
263
+ * and its content after save.
264
+ *
265
+ * @returns Resolves to list of saved assets as they came from the server.
266
+ */
267
+ Account.prototype.bulkDeployAssets = function (assets, dialogOptions) {
268
+ if (dialogOptions === void 0) { dialogOptions = {}; }
269
+ utils_1.validateArray(assets, 'You must provide an array of assets when deploying assets.');
270
+ utils_1.validateObject(assets[0], 'You must provide an array of assets (objects) when deploying assets.');
271
+ if (assets[0]) {
272
+ utils_1.validateObject(assets[0].Value, 'You must provide a Value (object) when deploying an asset.');
273
+ utils_1.validateString(assets[0].Id, 'You must provide the ID (string) on the asset you want to update.');
274
+ }
275
+ return this.bridge.sendMessage({
276
+ namespace: internal_types_1.MessageNamespaces.App,
277
+ name: internal_types_1.MessageNames.BulkDeployAssets,
278
+ params: {
279
+ assets: assets,
280
+ dialogOptions: dialogOptions,
281
+ },
282
+ });
283
+ };
284
+ /**
285
+ * Creates or updates an asset. Can also be used to present the Deploy Dialog for changing asset's settings,
286
+ * such as assigning to Display Groups or changing the scheduling.
287
+ *
288
+ * When saving a new asset (`asset.Id` not defined) it will open the Deploy Dialog.
289
+ *
290
+ * ![Deploy Dialog](/img/dashboard-sdk/account/save-asset-deploy-dialog.png)<br />
291
+ * *Deploy Dialog*
292
+ *
293
+ * ```typescript title="Saving the asset"
294
+ * const dialogOptions: DeployDialogOptions = {
295
+ * showSchedule: true,
296
+ * scheduleOptions: {
297
+ * showDuration: true
298
+ * }
299
+ * };
300
+ *
301
+ * const savedAsset = await enplug.account.saveAsset(asset, dialogOptions);
302
+ * ```
303
+ *
304
+ * Saving an already existing asset will save it instantly without showing the Deploy Dialog.
305
+ *
306
+ * Another useful scenario is to allow the user to assign an existing asset to Display Groups or change the scheduling.
307
+ * To achieve this, you can force showing the Deploy Dialog for an already saved asset, by adjusting the `dialogOptions`.
308
+ * ```typescript title="Opening the Deploy Dialog to assign existing asset to Display Groups"
309
+ * const dialogOptions: DeployDialogOptions = {
310
+ * showDeployDialog: true, // this forces the Deploy Dialog to appear for an already saved asset
311
+ * showSchedule: true,
312
+ * scheduleOptions: {
313
+ * showDuration: true
314
+ * }
315
+ * };
316
+ *
317
+ * const savedAsset = await enplug.account.saveAsset(asset, dialogOptions);
318
+ * ```
319
+ * *See more: {@link DeployDialogOptions}*
320
+ *
321
+ * @param T - Model of Asset's value
322
+ * @param asset - An asset to save.
323
+ * @param dialogOptions - Used to configure the Deploy Dialog, which can be shown to
324
+ * assign the asset to Display Groups or modify the scheduling options.
325
+ *
326
+ * @returns Promise resolving with the saved asset.
327
+ */
328
+ Account.prototype.saveAsset = function (asset, dialogOptions) {
329
+ if (dialogOptions === void 0) { dialogOptions = {}; }
330
+ utils_1.validateObject(asset, 'You must provide an asset object to save.');
331
+ return this.bridge.sendMessage({
332
+ namespace: internal_types_1.MessageNamespaces.App,
333
+ name: internal_types_1.MessageNames.SaveAsset,
334
+ params: {
335
+ asset: asset,
336
+ dialogOptions: dialogOptions,
337
+ },
338
+ });
339
+ };
340
+ Account.prototype.saveAssetForApp = function (appId, asset, dialogOptions) {
341
+ if (dialogOptions === void 0) { dialogOptions = {}; }
342
+ utils_1.validateString(appId, 'You must provide appId');
343
+ utils_1.validateObject(asset, 'You must provide an asset to save');
344
+ return this.bridge.sendMessage({
345
+ namespace: internal_types_1.MessageNamespaces.App,
346
+ name: internal_types_1.MessageNames.SaveAsset,
347
+ params: {
348
+ asset: asset,
349
+ appId: appId,
350
+ dialogOptions: dialogOptions,
351
+ },
352
+ });
353
+ };
354
+ /**
355
+ * This is for saving an order of assets if needed for the current app. An array of asset IDs
356
+ * is all that is needed, but the implementation also accepts an array of asset objects with `Id` string properties.
357
+ *
358
+ * @param T - Model of asset's value
359
+ * @param assets - An array of assetIds or assets in order which is to be saved
360
+ *
361
+ * @returns Resolves if the order was successfully updated. Rejects otherwise.
362
+ */
363
+ Account.prototype.updateAssetOrder = function (assets) {
364
+ utils_1.validateArray(assets, 'You must provide an array of assets (or asset ids) in the new order.');
365
+ return this.bridge.sendMessage({
366
+ namespace: internal_types_1.MessageNamespaces.App,
367
+ name: internal_types_1.MessageNames.UpdateAssetOrder,
368
+ params: {
369
+ assets: assets,
370
+ },
371
+ });
372
+ };
373
+ /**
374
+ * Deletes one or many assets under the current app instance.
375
+ *
376
+ * @param id - Id of an asset to delete. To delete multiple assets, an array of ids can be passed.
377
+ *
378
+ * @returns Resolves after successfully deleting the assets.
379
+ */
380
+ Account.prototype.deleteAsset = function (id) {
381
+ if (!Array.isArray(id)) {
382
+ utils_1.validateString(id, 'You must provide the ID (string) of the asset to delete.');
383
+ id = [id];
384
+ }
385
+ else {
386
+ utils_1.validateArray(id, 'You must pass a single ID (string) or Array of asset IDs to be deleted.');
387
+ utils_1.validateString(id[0], 'You must provide at least one Asset ID (string) to be deleted.');
388
+ }
389
+ return this.bridge.sendMessage({
390
+ namespace: internal_types_1.MessageNamespaces.App,
391
+ name: internal_types_1.MessageNames.DeleteAsset,
392
+ params: {
393
+ ids: id,
394
+ },
395
+ });
396
+ };
397
+ /**
398
+ * Marks asset as recently viewed.
399
+ */
400
+ Account.prototype.touchAsset = function (id) {
401
+ utils_1.validateString(id, 'You must provide an id string to touchAsset call');
402
+ return this.bridge.sendMessage({
403
+ namespace: internal_types_1.MessageNamespaces.App,
404
+ name: internal_types_1.MessageNames.TouchAsset,
405
+ params: { id: id },
406
+ });
407
+ };
408
+ /**
409
+ * Marks asset as needing approval.
410
+ */
411
+ Account.prototype.getAssetNeedsApproval = function (id) {
412
+ utils_1.validateString(id, 'You must provide an id string to getAssetNeedsApproval call');
413
+ return this.bridge.sendMessage({
414
+ namespace: internal_types_1.MessageNamespaces.App,
415
+ name: internal_types_1.MessageNames.GetAssetNeedsApproval,
416
+ params: { id: id },
417
+ });
418
+ };
419
+ /**
420
+ * Loads an array of default assets for the current instance's app definition.
421
+ *
422
+ * @param T - Model of asset's value
423
+ * @param level - 'Default', 'Network', 'Account'
424
+ * @param levelId - NetworkId or AccountId
425
+ *
426
+ * @returns Resolves to an array of default assets.
427
+ */
428
+ Account.prototype.getDefaultAssets = function (level, levelId) {
429
+ if (level === void 0) { level = 'Default'; }
430
+ utils_1.validateString(level, 'You must provide a level parameter that is either "Default", "Network", or "Account"');
431
+ if (level !== 'Account' && level !== 'Network' && level !== 'Default') {
432
+ throw new Error('You must provide a level parameter that is either "Default", "Network", or "Account"');
433
+ }
434
+ if (level === 'Account' || level === 'Network') {
435
+ utils_1.validateString(levelId, 'You must provide relevant id for the "Account" or "Network" level default assets');
436
+ }
437
+ return this.bridge.sendMessage({
438
+ namespace: internal_types_1.MessageNamespaces.App,
439
+ name: internal_types_1.MessageNames.GetDefaultAssets,
440
+ params: {
441
+ level: level,
442
+ levelId: levelId,
443
+ },
444
+ });
445
+ };
446
+ /**
447
+ * @internal
448
+ * Loads list of banner/ticker widget apps.
449
+ */
450
+ Account.prototype.getZoningApps = function () {
451
+ return this.bridge.sendMessage({
452
+ namespace: internal_types_1.MessageNamespaces.App,
453
+ name: internal_types_1.MessageNames.GetZoningApps,
454
+ });
455
+ };
456
+ /**
457
+ * @internal
458
+ * Loads widget assets used in a given zoning asset layout.
459
+ */
460
+ Account.prototype.getZoningLayoutAssets = function (assetId) {
461
+ return this.bridge.sendMessage({
462
+ namespace: internal_types_1.MessageNamespaces.App,
463
+ name: internal_types_1.MessageNames.GetZoningLayoutAssets,
464
+ params: {
465
+ assetId: assetId,
466
+ },
467
+ });
468
+ };
469
+ /**
470
+ * @internal
471
+ * Shows modal allowing to pick existing widget or create new.
472
+ */
473
+ Account.prototype.acquireZoningWidget = function (zoningAssetId, slotConfig, widgetAppId, usedAssetsIds) {
474
+ utils_1.validateString(widgetAppId, 'You must provide an widgetAppId parameter');
475
+ utils_1.validateObject(slotConfig, 'You must provide an slotConfig parameter');
476
+ return this.bridge.sendMessage({
477
+ namespace: internal_types_1.MessageNamespaces.App,
478
+ name: internal_types_1.MessageNames.AcquireZoningWidget,
479
+ params: {
480
+ zoningAssetId: zoningAssetId,
481
+ slotConfig: slotConfig,
482
+ widgetAppId: widgetAppId,
483
+ usedAssetsIds: usedAssetsIds,
484
+ },
485
+ });
486
+ };
487
+ /**
488
+ * @internal
489
+ * Fetches zoning data available after adding/editing a widget.
490
+ */
491
+ Account.prototype.editZoningWidget = function (zoningAssetId, slotConfig, widgetAppId, widgetAssetId) {
492
+ return this.bridge.sendMessage({
493
+ namespace: internal_types_1.MessageNamespaces.App,
494
+ name: internal_types_1.MessageNames.EditZoningWidget,
495
+ params: {
496
+ zoningAssetId: zoningAssetId,
497
+ slotConfig: slotConfig,
498
+ widgetAppId: widgetAppId,
499
+ widgetAssetId: widgetAssetId,
500
+ },
501
+ });
502
+ };
503
+ /**
504
+ * @internal
505
+ * Fetches zoning data available after adding/editing a widget.
506
+ */
507
+ Account.prototype.getZoningData = function () {
508
+ return this.bridge.sendMessage({
509
+ namespace: internal_types_1.MessageNamespaces.App,
510
+ name: internal_types_1.MessageNames.GetZoningData,
511
+ });
512
+ };
513
+ /**
514
+ * Loads the list of available fonts for the current app or for specified appId.
515
+ *
516
+ * ```typescript title="Loading the list of fonts"
517
+ * const { fonts } = await enplug.account.getFonts();
518
+ * console.log('List of available fonts', fonts);
519
+ * ```
520
+ *
521
+ * @param appId - ID of app for which the font list should be fetched. If not provided, the fonts for current app will be loaded.
522
+ *
523
+ * @returns Resolves to an object: `{ fonts: FontsApiItem[] }`. See: {@link FontsApiItem}.
524
+ */
525
+ Account.prototype.getFonts = function (appId) {
526
+ return this.bridge.sendMessage({
527
+ namespace: internal_types_1.MessageNamespaces.App,
528
+ name: internal_types_1.MessageNames.GetFonts,
529
+ params: {
530
+ appId: appId,
531
+ },
532
+ });
533
+ };
534
+ /**
535
+ * Loads available themes for the current app or for specified appId.
536
+ */
537
+ Account.prototype.getThemes = function (appId) {
538
+ return this.bridge.sendMessage({
539
+ namespace: internal_types_1.MessageNamespaces.App,
540
+ name: internal_types_1.MessageNames.GetThemes,
541
+ params: {
542
+ appId: appId,
543
+ },
544
+ }).then(function (_a) {
545
+ var themes = _a.themes;
546
+ return themes;
547
+ });
548
+ };
549
+ /**
550
+ * Loads theme by id.
551
+ * @param themeId - An id of a theme
552
+ */
553
+ Account.prototype.getTheme = function (id) {
554
+ return this.bridge.sendMessage({
555
+ namespace: internal_types_1.MessageNamespaces.App,
556
+ name: internal_types_1.MessageNames.GetTheme,
557
+ params: {
558
+ id: id,
559
+ },
560
+ });
561
+ };
562
+ /**
563
+ * Creates a new theme under the current app instance app definition.
564
+ * The new theme will be available only under the current user's account.
565
+ * @returns callId
566
+ */
567
+ Account.prototype.editTheme = function (themeDefinition, theme, previewUrl, previewAsset, layout, fonts, feedData) {
568
+ utils_1.validateObject(themeDefinition, 'You must provide the theme definition (object).');
569
+ return this.bridge.sendMessage({
570
+ namespace: internal_types_1.MessageNamespaces.App,
571
+ name: internal_types_1.MessageNames.EditTheme,
572
+ params: {
573
+ themeDefinition: themeDefinition,
574
+ theme: theme,
575
+ previewUrl: previewUrl,
576
+ previewAsset: previewAsset,
577
+ layout: layout,
578
+ fonts: fonts,
579
+ feedData: feedData,
580
+ },
581
+ });
582
+ };
583
+ /**
584
+ * Creates a new theme under the current app definition.
585
+ * The new theme will be available to all users in the account.
586
+ */
587
+ Account.prototype.saveTheme = function (theme) {
588
+ utils_1.validateObject(theme, 'You must provide the theme (object) to save.');
589
+ utils_1.validateObject(theme.Value, 'You must provide the theme.Value (object) to save.');
590
+ return this.bridge.sendMessage({
591
+ namespace: internal_types_1.MessageNamespaces.App,
592
+ name: internal_types_1.MessageNames.SaveTheme,
593
+ params: {
594
+ theme: theme,
595
+ },
596
+ });
597
+ };
598
+ /**
599
+ * Deletes a theme from the current user's account for
600
+ * the current app definition. Cannot remove default themes.
601
+ */
602
+ Account.prototype.deleteTheme = function (themeId) {
603
+ utils_1.validateString(themeId, 'You must provide the ID (string) of the theme to remove.');
604
+ return this.bridge.sendMessage({
605
+ namespace: internal_types_1.MessageNamespaces.App,
606
+ name: internal_types_1.MessageNames.DeleteTheme,
607
+ params: {
608
+ themeId: themeId,
609
+ },
610
+ });
611
+ };
612
+ /**
613
+ * Returns flag status on account.
614
+ */
615
+ Account.prototype.hasFeatureFlag = function (flagName) {
616
+ utils_1.validateString(flagName, 'You must provide the flag name (string).');
617
+ return this.bridge.sendMessage({
618
+ namespace: internal_types_1.MessageNamespaces.App,
619
+ name: internal_types_1.MessageNames.HasFeatureFlag,
620
+ params: {
621
+ flagName: flagName,
622
+ },
623
+ });
624
+ };
625
+ /**
626
+ * Retrieve all custom display group properties on an account.
627
+ */
628
+ Account.prototype.getDisplayGroupCustomProperties = function () {
629
+ return this.bridge.sendMessage({
630
+ namespace: internal_types_1.MessageNamespaces.App,
631
+ name: internal_types_1.MessageNames.GetDisplayGroupCustomProperties,
632
+ });
633
+ };
634
+ /**
635
+ * Returns account info such as network type and billing
636
+ */
637
+ Account.prototype.loadAccount = function (accountId) {
638
+ utils_1.validateString(accountId, 'You must provide the accountId (string).');
639
+ return this.bridge.sendMessage({
640
+ namespace: internal_types_1.MessageNamespaces.App,
641
+ name: internal_types_1.MessageNames.LoadAccount,
642
+ params: {
643
+ accountId: accountId,
644
+ },
645
+ });
646
+ };
647
+ return Account;
648
+ }());
649
+ exports.Account = Account;
539
650
  }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
540
- __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
651
+ __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
541
652
 
542
653
 
543
654
  /***/ }),
@@ -549,84 +660,84 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_
549
660
  /*! no static exports found */
550
661
  /***/ (function(module, exports, __webpack_require__) {
551
662
 
552
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__, exports], __WEBPACK_AMD_DEFINE_RESULT__ = (function (require, exports) {
553
- "use strict";
554
- Object.defineProperty(exports, "__esModule", { value: true });
555
- exports.BridgeBase = void 0;
556
- /**
557
- * Facilitates communication between the dashboard and app's iframe.
558
- */
559
- var TAG = "[Dashboard SDK|Bridge]";
560
- var BridgeBase = /** @class */ (function () {
561
- function BridgeBase(window) {
562
- this.pendingCalls = new Map();
563
- this.callCount = 0;
564
- }
565
- BridgeBase.prototype.sendMessage = function (message, persistentCallback) {
566
- var _this = this;
567
- return new Promise(function (resolve, reject) {
568
- // Increment call count and assign call Id
569
- message.callId = ++_this.callCount;
570
- // Transient requests do not expect a response. In this case we don't store pending call data.
571
- if (!message.transient) {
572
- // Persistent messages will resolve multiple times. Therefore they cannot use promises,
573
- // as promises are single-use. For persistent calls, we pass a callback.
574
- if (message.persistent) {
575
- _this.pendingCalls.set(message.callId, { resolve: persistentCallback, reject: persistentCallback, persistent: message.persistent });
576
- }
577
- else {
578
- _this.pendingCalls.set(message.callId, { resolve: resolve, reject: reject, persistent: message.persistent });
579
- }
580
- }
581
- if (_this.postMessage) {
582
- _this.postMessage(message);
583
- }
584
- });
585
- };
586
- /**
587
- * Receives and parses a message from the dashboard.
588
- * @param {MessageEvent} event An event coming from calling `postMessage` on the App's frame.
589
- * @returns {boolean} Whether to allow the event to ne handled by another event handler.
590
- */
591
- BridgeBase.prototype.receiveMessage = function (event) {
592
- if (event && event.type === 'message' && typeof event.data === 'string') {
593
- try {
594
- var response = JSON.parse(event.data);
595
- return this.dispatchResponse(response);
596
- }
597
- catch (e) {
598
- // ignore
599
- }
600
- }
601
- };
602
- /**
603
- * Decides what to do with an incoming message.
604
- * @param {InboundMessage} response A dashboard's response to App's call.
605
- * @returns {boolean} Whether to allow the event to ne handled by another event handler.
606
- */
607
- BridgeBase.prototype.dispatchResponse = function (response) {
608
- if (response.callId && typeof response.success === 'boolean') {
609
- var _a = this.pendingCalls.get(response.callId), resolve = _a.resolve, reject = _a.reject, persistent = _a.persistent;
610
- if (resolve && reject) {
611
- // If the call is not persistent, delete the pending call info from the map.
612
- if (!persistent) {
613
- this.pendingCalls.delete(response.callId);
614
- }
615
- if (response.success) {
616
- resolve(response.data);
617
- }
618
- else {
619
- reject(response.data);
620
- }
621
- return false;
622
- }
623
- }
624
- };
625
- return BridgeBase;
626
- }());
627
- exports.BridgeBase = BridgeBase;
663
+ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__, exports], __WEBPACK_AMD_DEFINE_RESULT__ = (function (require, exports) {
664
+ "use strict";
665
+ Object.defineProperty(exports, "__esModule", { value: true });
666
+ exports.BridgeBase = void 0;
667
+ /**
668
+ * Facilitates communication between the dashboard and app's iframe.
669
+ */
670
+ var TAG = '[Dashboard SDK|Bridge]';
671
+ var BridgeBase = /** @class */ (function () {
672
+ function BridgeBase(window) {
673
+ this.pendingCalls = new Map();
674
+ this.callCount = 0;
675
+ }
676
+ BridgeBase.prototype.sendMessage = function (message, persistentCallback) {
677
+ var _this = this;
678
+ return new Promise(function (resolve, reject) {
679
+ // Increment call count and assign call Id
680
+ message.callId = ++_this.callCount;
681
+ // Transient requests do not expect a response. In this case we don't store pending call data.
682
+ if (!message.transient) {
683
+ // Persistent messages will resolve multiple times. Therefore they cannot use promises,
684
+ // as promises are single-use. For persistent calls, we pass a callback.
685
+ if (message.persistent) {
686
+ _this.pendingCalls.set(message.callId, { resolve: persistentCallback, reject: persistentCallback, persistent: message.persistent });
687
+ }
688
+ else {
689
+ _this.pendingCalls.set(message.callId, { resolve: resolve, reject: reject, persistent: message.persistent });
690
+ }
691
+ }
692
+ if (_this.postMessage) {
693
+ _this.postMessage(message);
694
+ }
695
+ });
696
+ };
697
+ /**
698
+ * Receives and parses a message from the dashboard.
699
+ * @param event - An event coming from calling `postMessage` on the App's frame.
700
+ * @returns Whether to allow the event to be handled by another event handler.
701
+ */
702
+ BridgeBase.prototype.receiveMessage = function (event) {
703
+ if (event && event.type === 'message' && typeof event.data === 'string') {
704
+ try {
705
+ var response = JSON.parse(event.data);
706
+ return this.dispatchResponse(response);
707
+ }
708
+ catch (e) {
709
+ // ignore
710
+ }
711
+ }
712
+ };
713
+ /**
714
+ * Decides what to do with an incoming message.
715
+ * @param response - A dashboard's response to App's call.
716
+ * @returns Whether to allow the event to ne handled by another event handler.
717
+ */
718
+ BridgeBase.prototype.dispatchResponse = function (response) {
719
+ if (response.callId && typeof response.success === 'boolean') {
720
+ var _a = this.pendingCalls.get(response.callId), resolve = _a.resolve, reject = _a.reject, persistent = _a.persistent;
721
+ if (resolve && reject) {
722
+ // If the call is not persistent, delete the pending call info from the map.
723
+ if (!persistent) {
724
+ this.pendingCalls.delete(response.callId);
725
+ }
726
+ if (response.success) {
727
+ resolve(response.data);
728
+ }
729
+ else {
730
+ reject(response.data);
731
+ }
732
+ return false;
733
+ }
734
+ }
735
+ };
736
+ return BridgeBase;
737
+ }());
738
+ exports.BridgeBase = BridgeBase;
628
739
  }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
629
- __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
740
+ __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
630
741
 
631
742
 
632
743
  /***/ }),
@@ -638,42 +749,42 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_
638
749
  /*! no static exports found */
639
750
  /***/ (function(module, exports, __webpack_require__) {
640
751
 
641
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;var __extends = (this && this.__extends) || (function () {
642
- var extendStatics = function (d, b) {
643
- extendStatics = Object.setPrototypeOf ||
644
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
645
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
646
- return extendStatics(d, b);
647
- };
648
- return function (d, b) {
649
- extendStatics(d, b);
650
- function __() { this.constructor = d; }
651
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
652
- };
653
- })();
654
- !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__, exports, __webpack_require__(/*! ./bridge-base */ "./src/bridge/bridge-base.ts")], __WEBPACK_AMD_DEFINE_RESULT__ = (function (require, exports, bridge_base_1) {
655
- "use strict";
656
- Object.defineProperty(exports, "__esModule", { value: true });
657
- exports.Bridge = void 0;
658
- var TAG = "[Dashboard SDK]";
659
- var Bridge = /** @class */ (function (_super) {
660
- __extends(Bridge, _super);
661
- function Bridge(window) {
662
- var _this = _super.call(this, window) || this;
663
- _this.window = window;
664
- window.addEventListener('message', _this.receiveMessage.bind(_this), false);
665
- _this.postMessage = function (msg) { return window.parent.postMessage(JSON.stringify(msg), '*'); };
666
- console.log(TAG + " Creating Dashboard SDK");
667
- return _this;
668
- }
669
- Bridge.prototype.setWindowEventHandler = function (eventName, handler) {
670
- this.window.addEventListener(eventName, handler);
671
- };
672
- return Bridge;
673
- }(bridge_base_1.BridgeBase));
674
- exports.Bridge = Bridge;
752
+ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;var __extends = (this && this.__extends) || (function () {
753
+ var extendStatics = function (d, b) {
754
+ extendStatics = Object.setPrototypeOf ||
755
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
756
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
757
+ return extendStatics(d, b);
758
+ };
759
+ return function (d, b) {
760
+ extendStatics(d, b);
761
+ function __() { this.constructor = d; }
762
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
763
+ };
764
+ })();
765
+ !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__, exports, __webpack_require__(/*! ./bridge-base */ "./src/bridge/bridge-base.ts")], __WEBPACK_AMD_DEFINE_RESULT__ = (function (require, exports, bridge_base_1) {
766
+ "use strict";
767
+ Object.defineProperty(exports, "__esModule", { value: true });
768
+ exports.Bridge = void 0;
769
+ var TAG = '[Dashboard SDK]';
770
+ var Bridge = /** @class */ (function (_super) {
771
+ __extends(Bridge, _super);
772
+ function Bridge(window) {
773
+ var _this = _super.call(this, window) || this;
774
+ _this.window = window;
775
+ window.addEventListener('message', _this.receiveMessage.bind(_this), false);
776
+ _this.postMessage = function (msg) { return window.parent.postMessage(JSON.stringify(msg), '*'); };
777
+ console.log(TAG + " Creating Dashboard SDK");
778
+ return _this;
779
+ }
780
+ Bridge.prototype.setWindowEventHandler = function (eventName, handler) {
781
+ this.window.addEventListener(eventName, handler);
782
+ };
783
+ return Bridge;
784
+ }(bridge_base_1.BridgeBase));
785
+ exports.Bridge = Bridge;
675
786
  }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
676
- __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
787
+ __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
677
788
 
678
789
 
679
790
  /***/ }),
@@ -685,490 +796,636 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;var __extends =
685
796
  /*! no static exports found */
686
797
  /***/ (function(module, exports, __webpack_require__) {
687
798
 
688
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;var __assign = (this && this.__assign) || function () {
689
- __assign = Object.assign || function(t) {
690
- for (var s, i = 1, n = arguments.length; i < n; i++) {
691
- s = arguments[i];
692
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
693
- t[p] = s[p];
694
- }
695
- return t;
696
- };
697
- return __assign.apply(this, arguments);
698
- };
699
- !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__, exports, __webpack_require__(/*! ./utils */ "./src/utils.ts"), __webpack_require__(/*! ./internal-types */ "./src/internal-types.ts")], __WEBPACK_AMD_DEFINE_RESULT__ = (function (require, exports, utils_1, internal_types_1) {
700
- "use strict";
701
- Object.defineProperty(exports, "__esModule", { value: true });
702
- exports.Dashboard = void 0;
703
- var Dashboard = /** @class */ (function () {
704
- function Dashboard(bridge) {
705
- var _this = this;
706
- this.bridge = bridge;
707
- /**
708
- * The buttons most recently registered with the dashboard header.
709
- * Stored locally so that we can respond to click events
710
- * @type {Button[]}
711
- */
712
- this.currentButtons = {};
713
- /**
714
- * Keeps track of whether the dashboard is loading mode so clients can check.
715
- * @type {boolean}
716
- */
717
- this.isLoadingCache = true;
718
- /**
719
- * The last callback registered with the dashboard title bar.
720
- * @type {DisplaySelectorCallback}
721
- */
722
- this.currentDisplayCallback = function (displayId) { };
723
- this.bridge.setWindowEventHandler('click', function () {
724
- _this.click();
725
- return true;
726
- });
727
- }
728
- /**
729
- * Notifies the parent dashboard of a click in the child iFrame. Used to close
730
- * dropdown windows etc which were opened in parent window and are unable to
731
- * respond to click events in child iFrame.
732
- *
733
- * Event handler is automatically bound when the SDK is created.
734
- */
735
- Dashboard.prototype.click = function () {
736
- this.bridge.sendMessage({
737
- namespace: internal_types_1.MessageNamespaces.Dashboard,
738
- name: internal_types_1.MessageNames.Click,
739
- transient: true,
740
- });
741
- };
742
- /**
743
- * Opens a confirm window asking the user to confirm their unsaved changes.
744
- * If the user clicks the confirm button, the returned promise is resolved.
745
- * Otherwise the error callback is called.
746
- */
747
- Dashboard.prototype.confirmUnsavedChanges = function () {
748
- return this.bridge.sendMessage({
749
- namespace: internal_types_1.MessageNamespaces.Dashboard,
750
- name: internal_types_1.MessageNames.ConfirmUnsavedChanges,
751
- });
752
- };
753
- /**
754
- * Shows the error indicator.
755
- * Should only be used after a call has been made to .loadingIndicator().
756
- * @param {string} message
757
- */
758
- Dashboard.prototype.errorIndicator = function (message) {
759
- utils_1.validateString(message, 'Error indicator requires an error message (string)');
760
- return this.bridge.sendMessage({
761
- namespace: internal_types_1.MessageNamespaces.Dashboard,
762
- name: internal_types_1.MessageNames.ErrorIndicator,
763
- params: message,
764
- });
765
- };
766
- /**
767
- * Synchronously returns the current loading state.
768
- * Updated asynchronously when this sender receives an acknowledgement
769
- * of successful SDK call from the dashboard.
770
- */
771
- Dashboard.prototype.isLoading = function () {
772
- return this.isLoadingCache;
773
- };
774
- /**
775
- * Turns on the progress indicator, typically used during asynchronous actions.
776
- * Note that the progress indicator will continue until a call is made to the
777
- * errorIndicator or successIndicator APIs.
778
- */
779
- Dashboard.prototype.loadingIndicator = function (message) {
780
- utils_1.validateString(message, 'Loading indicator requires a loading message (string)');
781
- return this.bridge.sendMessage({
782
- namespace: internal_types_1.MessageNamespaces.Dashboard,
783
- name: internal_types_1.MessageNames.LoadingIndicator,
784
- params: message,
785
- });
786
- };
787
- /**
788
- * Navigates to url.
789
- * @param {string} url Url to navigate to.
790
- */
791
- Dashboard.prototype.navigate = function (url) {
792
- return this.bridge.sendMessage({
793
- namespace: internal_types_1.MessageNamespaces.Dashboard,
794
- name: internal_types_1.MessageNames.Navigate,
795
- params: {
796
- data: url,
797
- },
798
- });
799
- };
800
- /**
801
- * @deprecated use `navigateToZoning()`
802
- * Navigate back from widget.
803
- * @param {string} assetId Id of an asset to which to go back to.
804
- */
805
- Dashboard.prototype.navigateBack = function (assetId) {
806
- return this.bridge.sendMessage({
807
- namespace: internal_types_1.MessageNamespaces.Dashboard,
808
- name: internal_types_1.MessageNames.NavigateBack,
809
- params: { assetId: assetId },
810
- });
811
- };
812
- /**
813
- * Navigate to given relative dashboard url
814
- */
815
- Dashboard.prototype.navigateToUrl = function (url) {
816
- return this.bridge.sendMessage({
817
- namespace: internal_types_1.MessageNamespaces.Dashboard,
818
- name: internal_types_1.MessageNames.NavigateToUrl,
819
- params: { url: url },
820
- });
821
- };
822
- /**
823
- * Navigate back to zoning from widget.
824
- * assetId is optional, fallback parameter for v1->v2 transition phase
825
- */
826
- Dashboard.prototype.navigateToZoning = function (assetId) {
827
- return this.bridge.sendMessage({
828
- namespace: internal_types_1.MessageNamespaces.Dashboard,
829
- name: internal_types_1.MessageNames.NavigateToZoning,
830
- params: { assetId: assetId },
831
- });
832
- };
833
- /**
834
- * Opens a confirm window with Yes/No buttons and configurable messages.
835
- * If the user clicks the Confirm button, the returned promise is resolved.
836
- * Otherwise the promise is rejected.
837
- * @param {OpenConfirmOpyions} options Confirm dialog options.
838
- */
839
- Dashboard.prototype.openConfirm = function (options) {
840
- utils_1.validateObject(options, 'Confirm box requires options to be set (object).');
841
- if (options) {
842
- utils_1.validateString(options.title, 'Confirm box requires options.title to be set (string).');
843
- utils_1.validateString(options.text, 'Confirm box requires options.text to be set (string).');
844
- }
845
- return this.bridge.sendMessage({
846
- namespace: internal_types_1.MessageNamespaces.Dashboard,
847
- name: internal_types_1.MessageNames.OpenConfirm,
848
- params: options,
849
- });
850
- };
851
- /**
852
- * Puts the page into error state.
853
- */
854
- Dashboard.prototype.pageError = function () {
855
- return this.bridge.sendMessage({
856
- namespace: internal_types_1.MessageNamespaces.Dashboard,
857
- name: internal_types_1.MessageNames.PageError,
858
- });
859
- };
860
- /**
861
- * Controls the loading state for the entire page. Every application starts off in
862
- * loading state, and must set pageLoading(false) to notify the dashboard that it
863
- * has successfully loaded.
864
- *
865
- * Use .isLoading() to synchronously check current loading state.
866
- * @param {boolean} bool Page loading state
867
- */
868
- Dashboard.prototype.pageLoading = function (bool) {
869
- var _this = this;
870
- utils_1.validateBool(bool, 'Page loading status must be a boolean.');
871
- return this.bridge.sendMessage({
872
- namespace: internal_types_1.MessageNamespaces.Dashboard,
873
- name: internal_types_1.MessageNames.PageLoading,
874
- params: bool,
875
- }).then(function (loading) {
876
- _this.isLoadingCache = loading;
877
- return loading;
878
- });
879
- };
880
- /**
881
- * Puts the page into 404 state.
882
- */
883
- Dashboard.prototype.pageNotFound = function () {
884
- return this.bridge.sendMessage({
885
- namespace: internal_types_1.MessageNamespaces.Dashboard,
886
- name: internal_types_1.MessageNames.PageNotFound,
887
- });
888
- };
889
- /**
890
- * @deprecated use `previewAsset()`
891
- * Opens app preview modal.
892
- * @param {string} url
893
- * @param {Asset<AssetValue>} asset
894
- * @param {object} theme
895
- * @param {object} layout
896
- * @param {object} feedData
897
- */
898
- Dashboard.prototype.preview = function (url, asset, theme, layout, feedData) {
899
- return this.bridge.sendMessage({
900
- namespace: internal_types_1.MessageNamespaces.Dashboard,
901
- name: internal_types_1.MessageNames.Preview,
902
- params: {
903
- url: url,
904
- asset: asset,
905
- theme: theme,
906
- layout: layout,
907
- feedData: feedData,
908
- },
909
- });
910
- };
911
- /**
912
- * Opens app asset preview modal.
913
- */
914
- Dashboard.prototype.previewAsset = function (request) {
915
- return this.bridge.sendMessage({
916
- namespace: internal_types_1.MessageNamespaces.Dashboard,
917
- name: internal_types_1.MessageNames.PreviewAsset,
918
- params: __assign({}, request),
919
- });
920
- };
921
- // tslint:disable
922
- /**
923
- * Get preview params for an app asset for custom preview handling
924
- * @param appId
925
- * @param asset
926
- * @param origin (default: true) - custom origin url, when omitted or falsy, `window.location.origin` will be attached
927
- */
928
- // tslint:enable
929
- Dashboard.prototype.getAssetPreviewData = function (appId, asset, origin) {
930
- utils_1.validateString(appId, 'appId must be a string.');
931
- utils_1.validateObject(asset, 'asset must be an instance of Asset<any>.');
932
- utils_1.validateString(origin, 'origin must be a string.');
933
- return this.bridge.sendMessage({
934
- namespace: internal_types_1.MessageNamespaces.Dashboard,
935
- name: internal_types_1.MessageNames.GetAssetPreviewData,
936
- params: {
937
- appId: appId,
938
- asset: asset,
939
- origin: origin,
940
- },
941
- });
942
- };
943
- /**
944
- * Sets the current callback for the title bar breadcrumb display selector dropdown.
945
- * Attaching a callback enables the dropdown, it is disabled by default.
946
- * The title is reset when the dashboard changes routes.
947
- *
948
- * the callback is fired when a display is selected, the callback will get the ID
949
- * value when a single display is fired, or null when the 'All' selection is selected
950
- * @param {DisplaySelectorCallback} callback A function to be called every time a user changes current display
951
- * with display selector
952
- */
953
- Dashboard.prototype.setDisplaySelectorCallback = function (callback) {
954
- var _this = this;
955
- utils_1.validateFunction(callback, 'To enable the display selector in the page title you must supply a callback function.');
956
- this.currentDisplayCallback = callback;
957
- this.bridge.sendMessage({
958
- namespace: internal_types_1.MessageNamespaces.Dashboard,
959
- name: internal_types_1.MessageNames.SetDisplaySelectorCallback,
960
- params: callback,
961
- persistent: true,
962
- }, function (display) {
963
- if (typeof _this.currentDisplayCallback === 'function' && display !== undefined) {
964
- _this.currentDisplayCallback(display);
965
- }
966
- return display;
967
- });
968
- };
969
- /**
970
- * Hides or shows the display dropdown selector in the page title breadcrumb bar.
971
- * Send true to show the selector, false to hide it.
972
- */
973
- Dashboard.prototype.setDisplaySelectorVisibility = function (show) {
974
- utils_1.validateBool(show, 'Setting the display selector visibility requires a boolean argument, true to show or false to hide.');
975
- return this.bridge.sendMessage({
976
- namespace: internal_types_1.MessageNamespaces.Dashboard,
977
- name: internal_types_1.MessageNames.SetDisplaySelectorVisibility,
978
- params: show,
979
- });
980
- };
981
- /**
982
- * Sets the primary action buttons for a page in the titlebar.
983
- *
984
- * Accepts either a single button object, or an array of buttons.
985
- * Each button must have a button.action callback.
986
- * @param {Button[]|Button} buttons A button (single or array) to set on a header.
987
- */
988
- Dashboard.prototype.setHeaderButtons = function (buttons) {
989
- var _this = this;
990
- if (typeof buttons !== 'object') {
991
- throw new Error('Header buttons must be an object (single) or array (multiple).');
992
- }
993
- // Reset current buttons.
994
- this.currentButtons = {};
995
- buttons = Array.isArray(buttons) ? buttons : [buttons];
996
- for (var _i = 0, buttons_1 = buttons; _i < buttons_1.length; _i++) {
997
- var button = buttons_1[_i];
998
- utils_1.validateObject(button, 'Header buttons must be objects.');
999
- if (button) {
1000
- utils_1.validateFunction(button.action, 'Header button must have an action (function).');
1001
- // The button ID is used to identify which button was clicked in this service
1002
- button.id = 'button-' + (Math.round(Math.random() * (10000 - 1) + 1));
1003
- this.currentButtons[button.id] = button;
1004
- }
1005
- }
1006
- this.bridge.sendMessage({
1007
- namespace: internal_types_1.MessageNamespaces.Dashboard,
1008
- name: internal_types_1.MessageNames.SetHeaderButtons,
1009
- params: buttons,
1010
- persistent: true,
1011
- }, function (clicked) {
1012
- if (clicked) {
1013
- var button = _this.currentButtons[clicked.id];
1014
- if (button) {
1015
- button.action();
1016
- }
1017
- else {
1018
- console.warn('Unrecognized button click:', clicked);
1019
- }
1020
- }
1021
- return clicked;
1022
- });
1023
- };
1024
- /**
1025
- * Sets the last part of the title bar breadcrumb.
1026
- * Set an empty title '' to clear the title.
1027
- * Re-setting this value wipes out the old one.
1028
- *
1029
- * The home/default page for an app should have no title set.
1030
- * @param {string} title A title to set.
1031
- */
1032
- Dashboard.prototype.setHeaderTitle = function (title) {
1033
- utils_1.validateString(title, 'Header title must be a string.');
1034
- return this.bridge.sendMessage({
1035
- namespace: internal_types_1.MessageNamespaces.Dashboard,
1036
- name: internal_types_1.MessageNames.SetHeaderTitle,
1037
- params: title,
1038
- });
1039
- };
1040
- /**
1041
- * Shows the success indicator.
1042
- * Should only be used after a call has been made to .loadingIndicator().
1043
- * @param {string} message A message to show in a success toast.
1044
- */
1045
- Dashboard.prototype.successIndicator = function (message) {
1046
- utils_1.validateString(message, 'Success indicator requires a success message (string)');
1047
- return this.bridge.sendMessage({
1048
- namespace: internal_types_1.MessageNamespaces.Dashboard,
1049
- name: internal_types_1.MessageNames.SuccessIndicator,
1050
- params: message,
1051
- });
1052
- };
1053
- /**
1054
- * Switches to account view aka "All" selection of instance selector or DisplayGroup view
1055
- */
1056
- Dashboard.prototype.switchToView = function (displayGroupId, displayGroupName) {
1057
- return this.bridge.sendMessage({
1058
- namespace: internal_types_1.MessageNamespaces.Dashboard,
1059
- name: internal_types_1.MessageNames.SwitchToView,
1060
- params: {
1061
- displayGroupId: displayGroupId,
1062
- displayGroupName: displayGroupName,
1063
- },
1064
- });
1065
- };
1066
- /**
1067
- * Uses upload interface and Enplug encoding service, returns uploaded object
1068
- * @param {UploaderOptions} options Filepicker options
1069
- */
1070
- Dashboard.prototype.upload = function (options) {
1071
- return this.bridge.sendMessage({
1072
- namespace: internal_types_1.MessageNamespaces.Dashboard,
1073
- name: internal_types_1.MessageNames.Upload,
1074
- params: options,
1075
- });
1076
- };
1077
- /**
1078
- * Uses connect data interface, returns connection configuration object
1079
- * @param {ApiDataConnectorOptions} options Api Data Connector configuration options
1080
- */
1081
- Dashboard.prototype.connectData = function (options) {
1082
- return this.bridge.sendMessage({
1083
- namespace: internal_types_1.MessageNamespaces.Dashboard,
1084
- name: internal_types_1.MessageNames.ConnectData,
1085
- params: options,
1086
- });
1087
- };
1088
- /**
1089
- * Creates new assets and begins encoding process
1090
- */
1091
- Dashboard.prototype.processAssetResource = function (accountId, appId, assets) {
1092
- utils_1.validateString(accountId, 'You must provide the accountId (string).');
1093
- utils_1.validateString(appId, 'You must provide the appId (string).');
1094
- utils_1.validateArray(assets, 'You must provide the assets (array).');
1095
- return this.bridge.sendMessage({
1096
- namespace: internal_types_1.MessageNamespaces.Dashboard,
1097
- name: internal_types_1.MessageNames.ProcessAssetResource,
1098
- params: {
1099
- accountId: accountId,
1100
- appId: appId,
1101
- assets: assets,
1102
- },
1103
- });
1104
- };
1105
- /**
1106
- * Returns current encoding status of an asset
1107
- * @deprecated legacy FileStack upload flow
1108
- * @see resourcesEncodingStatus
1109
- */
1110
- Dashboard.prototype.encodeStatus = function (url) {
1111
- utils_1.validateString(url, 'You must provide the url (string).');
1112
- return this.bridge.sendMessage({
1113
- namespace: internal_types_1.MessageNamespaces.Dashboard,
1114
- name: internal_types_1.MessageNames.EncodeStatus,
1115
- params: url,
1116
- });
1117
- };
1118
- /**
1119
- * Returns current encoding statuses of resources or asset ids
1120
- * @param byAssetId if true, the provided ids are interpreted as asset ids, otherwise they are resource ids
1121
- */
1122
- Dashboard.prototype.resourcesEncodingStatus = function (ids, byAssetId) {
1123
- if (byAssetId === void 0) { byAssetId = false; }
1124
- utils_1.validateArray(ids, 'You must provide an array of ids (strings).');
1125
- utils_1.validateBool(byAssetId, 'You must provide the boolean byAssetId. True to interpret the ids as asset ids, when false as resource ids.');
1126
- return this.bridge.sendMessage({
1127
- namespace: internal_types_1.MessageNamespaces.Dashboard,
1128
- name: internal_types_1.MessageNames.ResourcesEncodingStatus,
1129
- params: {
1130
- ids: ids,
1131
- byAssetId: byAssetId,
1132
- },
1133
- });
1134
- };
1135
- /**
1136
- * opens content interval settings dialog for ad-scheduler app
1137
- */
1138
- Dashboard.prototype.openContentIntervalSettingsDialog = function (appName, level, levelId) {
1139
- utils_1.validateString(appName, 'You must provide the appName (string).');
1140
- utils_1.validateString(level, 'You must provide the level (string).');
1141
- utils_1.validateString(levelId, 'You must provide the levelId (string).');
1142
- return this.bridge.sendMessage({
1143
- namespace: internal_types_1.MessageNamespaces.Dashboard,
1144
- name: internal_types_1.MessageNames.OpenContentIntervalSettingsDialog,
1145
- params: {
1146
- appName: appName,
1147
- level: level,
1148
- levelId: levelId,
1149
- },
1150
- });
1151
- };
1152
- /**
1153
- * Lets dashboard know that the state of user changes in the app changed
1154
- * @param {boolean} hasUnsavedChanges Whether the app has unsaved changes.
1155
- */
1156
- Dashboard.prototype.setAppHasUnsavedChanges = function (hasUnsavedChanges) {
1157
- utils_1.validateBool(hasUnsavedChanges, 'To report changes to the dashboard you must supply a value.');
1158
- return this.bridge.sendMessage({
1159
- namespace: internal_types_1.MessageNamespaces.Dashboard,
1160
- name: internal_types_1.MessageNames.SetAppHasUnsavedChanges,
1161
- transient: true,
1162
- params: {
1163
- hasUnsavedChanges: hasUnsavedChanges,
1164
- },
1165
- });
1166
- };
1167
- return Dashboard;
1168
- }());
1169
- exports.Dashboard = Dashboard;
799
+ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;var __assign = (this && this.__assign) || function () {
800
+ __assign = Object.assign || function(t) {
801
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
802
+ s = arguments[i];
803
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
804
+ t[p] = s[p];
805
+ }
806
+ return t;
807
+ };
808
+ return __assign.apply(this, arguments);
809
+ };
810
+ !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__, exports, __webpack_require__(/*! ./utils */ "./src/utils.ts"), __webpack_require__(/*! ./internal-types */ "./src/internal-types.ts")], __WEBPACK_AMD_DEFINE_RESULT__ = (function (require, exports, utils_1, internal_types_1) {
811
+ "use strict";
812
+ Object.defineProperty(exports, "__esModule", { value: true });
813
+ exports.Dashboard = void 0;
814
+ /**
815
+ * Dashboard API is a part of the Dashboard SDK. It can be used to present standardized User Interface elements.
816
+ * Use global `enplug.dashboard` object to access these methods.
817
+ *
818
+ * ```typescript title="Example usage of the Dashboard API"
819
+ * enplug.dashboard.pageLoading(false);
820
+ * ```
821
+ *
822
+ * **Useful commands**
823
+ *
824
+ * Header section:
825
+ * - {@link setHeaderTitle|`enplug.dashboard.setHeaderTitle()`} - sets header title
826
+ * - {@link setHeaderButtons|`enplug.dashboard.setHeaderButtons()`} - sets header buttons
827
+ * - {@link setDisplaySelectorCallback|`enplug.dashboard.setDisplaySelectorCallback()`} - sets Display Group selector callback
828
+ * - {@link setDisplaySelectorVisibility|`enplug.dashboard.setDisplaySelectorVisibility()`} - sets Display Group selector visibility
829
+ *
830
+ * Progress indicator:
831
+ * - {@link pageLoading|`enplug.dashboard.pageLoading()`} - sets the app's loader visibility
832
+ * - {@link loadingIndicator|`enplug.dashboard.loadingIndicator()`} - shows **Loading** indicator
833
+ * - {@link successIndicator|`enplug.dashboard.successIndicator()`} - shows **Success** indicator
834
+ * - {@link errorIndicator|`enplug.dashboard.errorIndicator()`} - shows **Error** indicator
835
+ *
836
+ * Dialogs:
837
+ * - {@link previewAsset|`enplug.dashboard.previewAsset()`} - shows asset preview
838
+ * - {@link upload|`enplug.dashboard.upload()`} - shows upload dialog
839
+ * - {@link openConfirm|`enplug.dashboard.openConfirm()`} - shows custom confirmation dialog
840
+ * - {@link confirmUnsavedChanges|`enplug.dashboard.confirmUnsavedChanges()`} - shows unsaved changes dialog
841
+ * - {@link setAppHasUnsavedChanges|`enplug.dashboard.setAppHasUnsavedChanges()`} - sets dashboard's navigation guard
842
+ */
843
+ var Dashboard = /** @class */ (function () {
844
+ /** @internal */
845
+ function Dashboard(bridge) {
846
+ var _this = this;
847
+ this.bridge = bridge;
848
+ /**
849
+ * The buttons most recently registered with the dashboard header.
850
+ * Stored locally so that we can respond to click events
851
+ */
852
+ this.currentButtons = {};
853
+ /**
854
+ * Keeps track of whether the dashboard is loading mode so clients can check.
855
+ */
856
+ this.isLoadingCache = true;
857
+ /**
858
+ * The last callback registered with the dashboard title bar.
859
+ */
860
+ this.currentDisplayCallback = function (displayId) { };
861
+ this.bridge.setWindowEventHandler('click', function () {
862
+ _this.click();
863
+ return true;
864
+ });
865
+ }
866
+ /**
867
+ * @internal
868
+ * Notifies the parent dashboard of a click in the child iframe. Used to close
869
+ * dropdown windows, etc. which were opened in parent window and are unable to
870
+ * respond to click events in child iframe.
871
+ *
872
+ * Event handler is automatically bound when the SDK is created.
873
+ */
874
+ Dashboard.prototype.click = function () {
875
+ this.bridge.sendMessage({
876
+ namespace: internal_types_1.MessageNamespaces.Dashboard,
877
+ name: internal_types_1.MessageNames.Click,
878
+ transient: true,
879
+ });
880
+ };
881
+ /**
882
+ * Opens a confirm window asking the user to confirm their unsaved changes.
883
+ *
884
+ * ```typescript title="Presenting Unsaved Changes dialog"
885
+ * try {
886
+ * await enplug.dashboard.confirmUnsavedChanges();
887
+ * // user confirmed - take action
888
+ * } catch {
889
+ * // user cancelled
890
+ * }
891
+ * ```
892
+ *
893
+ * ![Unsaved Changes dialog](/img/dashboard-sdk/dashboard/dialog-hasunsavedchanges.png)<br />
894
+ * *Unsaved Changes dialog*
895
+ *
896
+ * @returns Resolves if dialog was confirmed, rejects otherwise.
897
+ */
898
+ Dashboard.prototype.confirmUnsavedChanges = function () {
899
+ return this.bridge.sendMessage({
900
+ namespace: internal_types_1.MessageNamespaces.Dashboard,
901
+ name: internal_types_1.MessageNames.ConfirmUnsavedChanges,
902
+ });
903
+ };
904
+ /**
905
+ * Shows the error indicator.
906
+ *
907
+ * ```typescript title="Presenting the error indicator"
908
+ * enplug.dashboard.errorIndicator('Asset could not be removed');
909
+ * ```
910
+ *
911
+ * ![Error indicator](/img/dashboard-sdk/dashboard/progress-error.png)
912
+ * *Error indicator*
913
+ *
914
+ * @param message - A message to show in the error toast.
915
+ *
916
+ * @returns Resolves after the error indicator shows up on screen.
917
+ */
918
+ Dashboard.prototype.errorIndicator = function (message) {
919
+ utils_1.validateString(message, 'Error indicator requires an error message (string)');
920
+ return this.bridge.sendMessage({
921
+ namespace: internal_types_1.MessageNamespaces.Dashboard,
922
+ name: internal_types_1.MessageNames.ErrorIndicator,
923
+ params: message,
924
+ });
925
+ };
926
+ /**
927
+ * Synchronously returns the current loading state.
928
+ * Updated asynchronously when this sender receives an acknowledgement
929
+ * of successful SDK call from the dashboard.
930
+ *
931
+ * @see {@link pageLoading} to update the page loading state.
932
+ *
933
+ * @returns Current page loading state.
934
+ */
935
+ Dashboard.prototype.isLoading = function () {
936
+ return this.isLoadingCache;
937
+ };
938
+ /**
939
+ * Turns on the progress indicator, typically used during asynchronous actions.
940
+ *
941
+ * :::note
942
+ * Note that the progress indicator will continue until a call is made to the
943
+ * {@link errorIndicator} or {@link successIndicator} APIs.
944
+ * :::
945
+ *
946
+ * ```typescript title="Presenting the loading indicator"
947
+ * enplug.dashboard.loadingIndicator('Removing asset');
948
+ * ```
949
+ *
950
+ * ![Loading indicator](/img/dashboard-sdk/dashboard/progress-loading.png)
951
+ * *Loading indicator*
952
+ *
953
+ * @param message - A message to show in the loading toast.
954
+ *
955
+ * @returns Resolves after the loading indicator shows up on screen.
956
+ */
957
+ Dashboard.prototype.loadingIndicator = function (message) {
958
+ utils_1.validateString(message, 'Loading indicator requires a loading message (string)');
959
+ return this.bridge.sendMessage({
960
+ namespace: internal_types_1.MessageNamespaces.Dashboard,
961
+ name: internal_types_1.MessageNames.LoadingIndicator,
962
+ params: message,
963
+ });
964
+ };
965
+ /**
966
+ * Navigate to given relative dashboard URL.
967
+ */
968
+ Dashboard.prototype.navigateToUrl = function (url) {
969
+ return this.bridge.sendMessage({
970
+ namespace: internal_types_1.MessageNamespaces.Dashboard,
971
+ name: internal_types_1.MessageNames.NavigateToUrl,
972
+ params: { url: url },
973
+ });
974
+ };
975
+ /**
976
+ * Navigate back to zoning from widget.
977
+ * @param assetId - optional, fallback parameter for v1-\>v2 transition phase
978
+ */
979
+ Dashboard.prototype.navigateToZoning = function (assetId) {
980
+ return this.bridge.sendMessage({
981
+ namespace: internal_types_1.MessageNamespaces.Dashboard,
982
+ name: internal_types_1.MessageNames.NavigateToZoning,
983
+ params: { assetId: assetId },
984
+ });
985
+ };
986
+ /**
987
+ * Opens a confirm window with Yes/No buttons and configurable messages.
988
+ *
989
+ * ```typescript title="Presenting confirmation dialog"
990
+ * try {
991
+ * await enplug.dashboard.openConfirm({
992
+ * title: 'Delete asset?',
993
+ * text: 'Are you sure you want to delete this asset? This action cannot be undone.',
994
+ * cancelText: 'Cancel',
995
+ * confirmText: 'Delete',
996
+ * confirmClass: 'btn-danger'
997
+ * });
998
+ *
999
+ * // remove the asset
1000
+ * } catch {
1001
+ * // user cancelled
1002
+ * }
1003
+ * ```
1004
+ *
1005
+ * ![Confirm dialog](/img/dashboard-sdk/dashboard/dialog-confirm.png)<br />
1006
+ * *Confirm dialog*
1007
+ *
1008
+ * @param options - Confirm dialog options.
1009
+ *
1010
+ * @returns Resolves if Confirm button was clicked, rejects otherwise.
1011
+ */
1012
+ Dashboard.prototype.openConfirm = function (options) {
1013
+ utils_1.validateObject(options, 'Confirm box requires options to be set (object).');
1014
+ if (options) {
1015
+ utils_1.validateString(options.title, 'Confirm box requires options.title to be set (string).');
1016
+ utils_1.validateString(options.text, 'Confirm box requires options.text to be set (string).');
1017
+ }
1018
+ return this.bridge.sendMessage({
1019
+ namespace: internal_types_1.MessageNamespaces.Dashboard,
1020
+ name: internal_types_1.MessageNames.OpenConfirm,
1021
+ params: options,
1022
+ });
1023
+ };
1024
+ /**
1025
+ * Puts the page into error state.
1026
+ *
1027
+ * ![Page error](/img/dashboard-sdk/dashboard/page-error.png)<br />
1028
+ * *Page error*
1029
+ *
1030
+ * @returns Resolves after the Dashboard shows the page error.
1031
+ */
1032
+ Dashboard.prototype.pageError = function () {
1033
+ return this.bridge.sendMessage({
1034
+ namespace: internal_types_1.MessageNamespaces.Dashboard,
1035
+ name: internal_types_1.MessageNames.PageError,
1036
+ });
1037
+ };
1038
+ /**
1039
+ * Controls the loading state for the entire page. Every application starts off in
1040
+ * loading state, and must set `pageLoading(false)` to notify the dashboard that it
1041
+ * has successfully loaded.
1042
+ *
1043
+ * ```typescript title="Turning off the loading spinner after app has started"
1044
+ * enplug.dashboard.pageLoading(false);
1045
+ * ```
1046
+ *
1047
+ * ![Page Loading spinner](/img/dashboard-sdk/dashboard/pageloading-spinner.png)<br />
1048
+ * *Page Loading spinner*
1049
+ *
1050
+ * @param isLoading - Page loading state:<br />
1051
+ * `false` - hides the loader and shows the app,<br />
1052
+ * `true` - shows the loader and hides the app.
1053
+ *
1054
+ * @returns Resolves after the loading state has been updated by the Dashboard.
1055
+ */
1056
+ Dashboard.prototype.pageLoading = function (isLoading) {
1057
+ var _this = this;
1058
+ utils_1.validateBool(isLoading, 'Page loading status must be a boolean.');
1059
+ return this.bridge.sendMessage({
1060
+ namespace: internal_types_1.MessageNamespaces.Dashboard,
1061
+ name: internal_types_1.MessageNames.PageLoading,
1062
+ params: isLoading,
1063
+ }).then(function (loading) {
1064
+ _this.isLoadingCache = loading;
1065
+ return loading;
1066
+ });
1067
+ };
1068
+ /**
1069
+ * Puts the page into not found (404) state.
1070
+ *
1071
+ * ![Page not available](/img/dashboard-sdk/dashboard/page-404.png)<br />
1072
+ * *Page not available*
1073
+ *
1074
+ * @returns Resolves when after the Dashboard shows the page not found error.
1075
+ */
1076
+ Dashboard.prototype.pageNotFound = function () {
1077
+ return this.bridge.sendMessage({
1078
+ namespace: internal_types_1.MessageNamespaces.Dashboard,
1079
+ name: internal_types_1.MessageNames.PageNotFound,
1080
+ });
1081
+ };
1082
+ /**
1083
+ * @deprecated use {@link previewAsset}
1084
+ *
1085
+ * Opens app preview modal.
1086
+ */
1087
+ Dashboard.prototype.preview = function (url, asset, theme, layout, feedData) {
1088
+ return this.bridge.sendMessage({
1089
+ namespace: internal_types_1.MessageNamespaces.Dashboard,
1090
+ name: internal_types_1.MessageNames.Preview,
1091
+ params: {
1092
+ url: url,
1093
+ asset: asset,
1094
+ theme: theme,
1095
+ layout: layout,
1096
+ feedData: feedData,
1097
+ },
1098
+ });
1099
+ };
1100
+ /**
1101
+ * Opens asset preview modal.
1102
+ *
1103
+ * ![Asset preview modal](/img/dashboard-sdk/dashboard/previewAsset.png)<br />
1104
+ * *Asset preview modal*
1105
+ *
1106
+ * ```typescript title="Previewing an asset"
1107
+ * function showPreview(asset: Asset<AssetModel>) {
1108
+ * enplug.dashboard.previewAsset({ asset });
1109
+ * }
1110
+ * ```
1111
+ *
1112
+ * The above code opens the preview dialog with provided data.
1113
+ * This method allows many preview customizations, see {@link AssetPreviewRequest}.
1114
+ *
1115
+ * :::note
1116
+ * The app inside of the preview modal is presented in an iframe and the app is provided with basic SDK functionalities
1117
+ * needed to display the asset only. The app's Player URL from app's definition will be used.
1118
+ * The app is not run in a WebPlayer environment, so the behavior might be different.
1119
+ * Most SDK calls will have no effect.
1120
+ * :::
1121
+ *
1122
+ * @param TAssetValue - Model of asset's value
1123
+ * @param TThemeValue - Model of theme's value (optional)
1124
+ * @param TFeedType - Model of the feed (used for social apps)
1125
+ *
1126
+ * @returns Resolves after the preview modal gets closed.
1127
+ */
1128
+ Dashboard.prototype.previewAsset = function (request) {
1129
+ return this.bridge.sendMessage({
1130
+ namespace: internal_types_1.MessageNamespaces.Dashboard,
1131
+ name: internal_types_1.MessageNames.PreviewAsset,
1132
+ params: __assign({}, request),
1133
+ });
1134
+ };
1135
+ /**
1136
+ * @internal
1137
+ * Get preview parameters for an app asset for custom preview handling.
1138
+ * @param origin - (default: true) - custom origin url, when omitted or falsy, `window.location.origin` will be attached
1139
+ */
1140
+ Dashboard.prototype.getAssetPreviewData = function (appId, asset, origin) {
1141
+ utils_1.validateString(appId, 'appId must be a string.');
1142
+ utils_1.validateObject(asset, 'asset must be an instance of Asset<any>.');
1143
+ utils_1.validateString(origin, 'origin must be a string.');
1144
+ return this.bridge.sendMessage({
1145
+ namespace: internal_types_1.MessageNamespaces.Dashboard,
1146
+ name: internal_types_1.MessageNames.GetAssetPreviewData,
1147
+ params: {
1148
+ appId: appId,
1149
+ asset: asset,
1150
+ origin: origin,
1151
+ },
1152
+ });
1153
+ };
1154
+ /**
1155
+ * Sets the current callback for the title bar breadcrumb Display Group selector dropdown.
1156
+ * Attaching a callback enables the dropdown and resets the title.
1157
+ *
1158
+ * The callback is fired when a Display Group is selected from the dropdown, the callback will get the ID
1159
+ * value when a single display is fired, or null when the whole 'Library' selection.
1160
+ *
1161
+ * ```typescript title="Setting up the Display Group selector"
1162
+ * enplug.dashboard.setDisplaySelectorCallback(async () => {
1163
+ * // update your asset list using enplug.account.getAssets() which will return
1164
+ * // the assets assigned to the selected Display Group only
1165
+ * yourAssetList = await enplug.account.getAssets();
1166
+ * });
1167
+ * ```
1168
+ *
1169
+ * ![Display Group selector dropdown](/img/dashboard-sdk/dashboard/display-group-selector-dropdown.png)<br />
1170
+ * *Display Group selector dropdown*
1171
+ *
1172
+ * @param callback - A function to be called every time a user changes current Display Group
1173
+ * with the dropdown selector. The callback should reload the asset list to get the filtered version.
1174
+ *
1175
+ * @returns Promise which resolves after the command gets executed by the Dashboard.
1176
+ */
1177
+ Dashboard.prototype.setDisplaySelectorCallback = function (callback) {
1178
+ var _this = this;
1179
+ utils_1.validateFunction(callback, 'To enable the display selector in the page title you must supply a callback function.');
1180
+ this.currentDisplayCallback = callback;
1181
+ return this.bridge.sendMessage({
1182
+ namespace: internal_types_1.MessageNamespaces.Dashboard,
1183
+ name: internal_types_1.MessageNames.SetDisplaySelectorCallback,
1184
+ params: callback,
1185
+ persistent: true,
1186
+ }, function (display) {
1187
+ if (typeof _this.currentDisplayCallback === 'function' && display !== undefined) {
1188
+ _this.currentDisplayCallback(display);
1189
+ }
1190
+ return display;
1191
+ });
1192
+ };
1193
+ /**
1194
+ * Hides or shows the Display Group dropdown selector in the page title breadcrumb bar.
1195
+ * Send true to show the selector, false to hide it.
1196
+ *
1197
+ * The Display Group selector dropdown can be used to filter assets currently deployed to a specific Display Group.
1198
+ * You can view all the saved assets by account for your app by selecting the 'Library' view from the dropdown on the upper left.
1199
+ *
1200
+ * ![Display Group selector dropdown](/img/dashboard-sdk/dashboard/display-group-selector-dropdown.png)
1201
+ * *Display Group selector dropdown*
1202
+ *
1203
+ * @returns Promise which resolves after the command gets executed by the Dashboard.
1204
+ */
1205
+ Dashboard.prototype.setDisplaySelectorVisibility = function (show) {
1206
+ utils_1.validateBool(show, 'Setting the display selector visibility requires a boolean argument, true to show or false to hide.');
1207
+ return this.bridge.sendMessage({
1208
+ namespace: internal_types_1.MessageNamespaces.Dashboard,
1209
+ name: internal_types_1.MessageNames.SetDisplaySelectorVisibility,
1210
+ params: show,
1211
+ });
1212
+ };
1213
+ /**
1214
+ * Sets the action buttons for a page in the titlebar.
1215
+ *
1216
+ * Accepts either a single button object, or an array of buttons.
1217
+ * Each button must have a button.action callback.
1218
+ *
1219
+ * ```typescript title="Updating the buttons"
1220
+ * function updateButtons(hasUnsavedChanges: boolean) {
1221
+ * enplug.dashboard.setHeaderButtons([{
1222
+ * text: 'My Signs',
1223
+ * action: () => { \/* your code to navigate back to the Asset list *\/ },
1224
+ * class: 'btn-default'
1225
+ * }, {
1226
+ * text: 'Save',
1227
+ * action: () => { \/* your code saving the asset *\/ },
1228
+ * class: 'btn-primary',
1229
+ * disabled: !hasUnsavedChanges // this will disable the button if there are no unsaved changes
1230
+ * }]);
1231
+ * }
1232
+ * ```
1233
+ *
1234
+ * ![Header buttons](/img/dashboard-sdk/dashboard/header-buttons.png)<br />
1235
+ * *Header buttons*
1236
+ *
1237
+ * @param buttons - A button (single or array) to set on a header.
1238
+ *
1239
+ * @returns Resolves after the buttons get updated.
1240
+ */
1241
+ Dashboard.prototype.setHeaderButtons = function (buttons) {
1242
+ var _this = this;
1243
+ if (typeof buttons !== 'object') {
1244
+ throw new Error('Header buttons must be an object (single) or array (multiple).');
1245
+ }
1246
+ // Reset current buttons.
1247
+ this.currentButtons = {};
1248
+ buttons = Array.isArray(buttons) ? buttons : [buttons];
1249
+ for (var _i = 0, buttons_1 = buttons; _i < buttons_1.length; _i++) {
1250
+ var button = buttons_1[_i];
1251
+ utils_1.validateObject(button, 'Header buttons must be objects.');
1252
+ if (button) {
1253
+ utils_1.validateFunction(button.action, 'Header button must have an action (function).');
1254
+ // The button ID is used to identify which button was clicked in this service
1255
+ button.id = 'button-' + (Math.round(Math.random() * (10000 - 1) + 1));
1256
+ this.currentButtons[button.id] = button;
1257
+ }
1258
+ }
1259
+ return this.bridge.sendMessage({
1260
+ namespace: internal_types_1.MessageNamespaces.Dashboard,
1261
+ name: internal_types_1.MessageNames.SetHeaderButtons,
1262
+ params: buttons,
1263
+ persistent: true,
1264
+ }, function (clicked) {
1265
+ if (clicked) {
1266
+ var button = _this.currentButtons[clicked.id];
1267
+ if (button) {
1268
+ button.action();
1269
+ }
1270
+ else {
1271
+ console.warn('Unrecognized button click:', clicked);
1272
+ }
1273
+ }
1274
+ return clicked;
1275
+ });
1276
+ };
1277
+ /**
1278
+ * Sets the last part of the title bar breadcrumb.
1279
+ * Set an empty title '' to clear the title.
1280
+ * Re-setting this value wipes out the old one.
1281
+ *
1282
+ * The home/default page for an app should have no title set.
1283
+ *
1284
+ * ```typescript title="Updating header's title"
1285
+ * enplug.dashboard.setHeaderTitle('Setup');
1286
+ * ```
1287
+ *
1288
+ * ![Header title](/img/dashboard-sdk/dashboard/header-title.png)
1289
+ * *Header title section*
1290
+ *
1291
+ * @param title - A title to set.
1292
+ *
1293
+ * @returns Resolves after the title has been modified.
1294
+ */
1295
+ Dashboard.prototype.setHeaderTitle = function (title) {
1296
+ utils_1.validateString(title, 'Header title must be a string.');
1297
+ return this.bridge.sendMessage({
1298
+ namespace: internal_types_1.MessageNamespaces.Dashboard,
1299
+ name: internal_types_1.MessageNames.SetHeaderTitle,
1300
+ params: title,
1301
+ });
1302
+ };
1303
+ /**
1304
+ * Shows the success indicator.
1305
+ *
1306
+ * ```typescript title="Presenting the success indicator"
1307
+ * enplug.dashboard.successIndicator('Asset removed');
1308
+ * ```
1309
+ *
1310
+ * ![Success indicator](/img/dashboard-sdk/dashboard/progress-success.png)
1311
+ * *Success indicator*
1312
+ *
1313
+ * @param message - A message to show in the success toast.
1314
+ *
1315
+ * @returns Resolves after the success indicator shows up on screen.
1316
+ */
1317
+ Dashboard.prototype.successIndicator = function (message) {
1318
+ utils_1.validateString(message, 'Success indicator requires a success message (string)');
1319
+ return this.bridge.sendMessage({
1320
+ namespace: internal_types_1.MessageNamespaces.Dashboard,
1321
+ name: internal_types_1.MessageNames.SuccessIndicator,
1322
+ params: message,
1323
+ });
1324
+ };
1325
+ /**
1326
+ * Switches to account view "Library"/All selection of instance selector or Display Group view.
1327
+ */
1328
+ Dashboard.prototype.switchToView = function (displayGroupId, displayGroupName) {
1329
+ return this.bridge.sendMessage({
1330
+ namespace: internal_types_1.MessageNamespaces.Dashboard,
1331
+ name: internal_types_1.MessageNames.SwitchToView,
1332
+ params: {
1333
+ displayGroupId: displayGroupId,
1334
+ displayGroupName: displayGroupName,
1335
+ },
1336
+ });
1337
+ };
1338
+ /**
1339
+ * Uses upload interface and Enplug encoding service, returns uploaded object
1340
+ * @param options - Filepicker options
1341
+ */
1342
+ Dashboard.prototype.upload = function (options) {
1343
+ return this.bridge.sendMessage({
1344
+ namespace: internal_types_1.MessageNamespaces.Dashboard,
1345
+ name: internal_types_1.MessageNames.Upload,
1346
+ params: options,
1347
+ });
1348
+ };
1349
+ /**
1350
+ * Uses connect data interface, returns connection configuration object.
1351
+ * @param options - API Data Connector configuration options.
1352
+ */
1353
+ Dashboard.prototype.connectData = function (options) {
1354
+ return this.bridge.sendMessage({
1355
+ namespace: internal_types_1.MessageNamespaces.Dashboard,
1356
+ name: internal_types_1.MessageNames.ConnectData,
1357
+ params: options,
1358
+ });
1359
+ };
1360
+ /**
1361
+ * @internal
1362
+ * Returns current encoding status of an asset.
1363
+ * @deprecated legacy FileStack upload flow
1364
+ * @see resourcesEncodingStatus
1365
+ */
1366
+ Dashboard.prototype.encodeStatus = function (url) {
1367
+ utils_1.validateString(url, 'You must provide the url (string).');
1368
+ return this.bridge.sendMessage({
1369
+ namespace: internal_types_1.MessageNamespaces.Dashboard,
1370
+ name: internal_types_1.MessageNames.EncodeStatus,
1371
+ params: url,
1372
+ });
1373
+ };
1374
+ /**
1375
+ * Returns current encoding statuses of resources or asset IDs.
1376
+ * @param byAssetId - If `true`, the provided IDs are interpreted as asset IDs, otherwise they are resource IDs.
1377
+ */
1378
+ Dashboard.prototype.resourcesEncodingStatus = function (ids, byAssetId) {
1379
+ if (byAssetId === void 0) { byAssetId = false; }
1380
+ utils_1.validateArray(ids, 'You must provide an array of ids (strings).');
1381
+ utils_1.validateBool(byAssetId, 'You must provide the boolean byAssetId. True to interpret the ids as asset ids, when false as resource ids.');
1382
+ return this.bridge.sendMessage({
1383
+ namespace: internal_types_1.MessageNamespaces.Dashboard,
1384
+ name: internal_types_1.MessageNames.ResourcesEncodingStatus,
1385
+ params: {
1386
+ ids: ids,
1387
+ byAssetId: byAssetId,
1388
+ },
1389
+ });
1390
+ };
1391
+ /**
1392
+ * Opens content interval settings dialog for Ad Scheduler app.
1393
+ */
1394
+ Dashboard.prototype.openContentIntervalSettingsDialog = function (appName, level, levelId) {
1395
+ utils_1.validateString(appName, 'You must provide the appName (string).');
1396
+ utils_1.validateString(level, 'You must provide the level (string).');
1397
+ utils_1.validateString(levelId, 'You must provide the levelId (string).');
1398
+ return this.bridge.sendMessage({
1399
+ namespace: internal_types_1.MessageNamespaces.Dashboard,
1400
+ name: internal_types_1.MessageNames.OpenContentIntervalSettingsDialog,
1401
+ params: {
1402
+ appName: appName,
1403
+ level: level,
1404
+ levelId: levelId,
1405
+ },
1406
+ });
1407
+ };
1408
+ /**
1409
+ * Lets dashboard know that the state of user changes in the app changed.
1410
+ *
1411
+ * @param hasUnsavedChanges - Whether the app has unsaved changes.
1412
+ */
1413
+ Dashboard.prototype.setAppHasUnsavedChanges = function (hasUnsavedChanges) {
1414
+ utils_1.validateBool(hasUnsavedChanges, 'To report changes to the dashboard you must supply a value.');
1415
+ return this.bridge.sendMessage({
1416
+ namespace: internal_types_1.MessageNamespaces.Dashboard,
1417
+ name: internal_types_1.MessageNames.SetAppHasUnsavedChanges,
1418
+ transient: true,
1419
+ params: {
1420
+ hasUnsavedChanges: hasUnsavedChanges,
1421
+ },
1422
+ });
1423
+ };
1424
+ return Dashboard;
1425
+ }());
1426
+ exports.Dashboard = Dashboard;
1170
1427
  }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
1171
- __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
1428
+ __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
1172
1429
 
1173
1430
 
1174
1431
  /***/ }),
@@ -1180,22 +1437,22 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;var __assign = (
1180
1437
  /*! no static exports found */
1181
1438
  /***/ (function(module, exports, __webpack_require__) {
1182
1439
 
1183
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__, exports, __webpack_require__(/*! ./account */ "./src/account.ts"), __webpack_require__(/*! ./bridge/bridge */ "./src/bridge/bridge.ts"), __webpack_require__(/*! ./dashboard */ "./src/dashboard.ts"), __webpack_require__(/*! ./social */ "./src/social.ts")], __WEBPACK_AMD_DEFINE_RESULT__ = (function (require, exports, account_1, bridge_1, dashboard_1, social_1) {
1184
- "use strict";
1185
- Object.defineProperty(exports, "__esModule", { value: true });
1186
- function createDashboardSDK() {
1187
- var bridge = new bridge_1.Bridge(window);
1188
- var sdk = {
1189
- account: new account_1.Account(bridge),
1190
- dashboard: new dashboard_1.Dashboard(bridge),
1191
- social: new social_1.Social(bridge),
1192
- };
1193
- window.enplug = sdk;
1194
- return sdk;
1195
- }
1196
- exports.default = createDashboardSDK();
1440
+ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__, exports, __webpack_require__(/*! ./account */ "./src/account.ts"), __webpack_require__(/*! ./bridge/bridge */ "./src/bridge/bridge.ts"), __webpack_require__(/*! ./dashboard */ "./src/dashboard.ts"), __webpack_require__(/*! ./social */ "./src/social.ts")], __WEBPACK_AMD_DEFINE_RESULT__ = (function (require, exports, account_1, bridge_1, dashboard_1, social_1) {
1441
+ "use strict";
1442
+ Object.defineProperty(exports, "__esModule", { value: true });
1443
+ function createDashboardSDK() {
1444
+ var bridge = new bridge_1.Bridge(window);
1445
+ var sdk = {
1446
+ account: new account_1.Account(bridge),
1447
+ dashboard: new dashboard_1.Dashboard(bridge),
1448
+ social: new social_1.Social(bridge),
1449
+ };
1450
+ window.enplug = sdk;
1451
+ return sdk;
1452
+ }
1453
+ exports.default = createDashboardSDK();
1197
1454
  }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
1198
- __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
1455
+ __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
1199
1456
 
1200
1457
 
1201
1458
  /***/ }),
@@ -1207,105 +1464,103 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_
1207
1464
  /*! no static exports found */
1208
1465
  /***/ (function(module, exports, __webpack_require__) {
1209
1466
 
1210
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__, exports], __WEBPACK_AMD_DEFINE_RESULT__ = (function (require, exports) {
1211
- "use strict";
1212
- Object.defineProperty(exports, "__esModule", { value: true });
1213
- exports.MessageNames = exports.MessageNamespaces = void 0;
1214
- var MessageNamespaces;
1215
- (function (MessageNamespaces) {
1216
- MessageNamespaces["App"] = "app";
1217
- MessageNamespaces["Social"] = "social";
1218
- MessageNamespaces["Dashboard"] = "dashboard";
1219
- })(MessageNamespaces = exports.MessageNamespaces || (exports.MessageNamespaces = {}));
1220
- var MessageNames;
1221
- (function (MessageNames) {
1222
- MessageNames["GetAccount"] = "app.getAccount";
1223
- MessageNames["GetUser"] = "app.getUser";
1224
- MessageNames["GetDisplayGroups"] = "app.getDisplays";
1225
- MessageNames["GetSelectedDisplayId"] = "app.getSelectedDisplayId";
1226
- MessageNames["GetAssets"] = "app.getAssets";
1227
- MessageNames["GetAssetsByIds"] = "app.getAssetsByIds";
1228
- MessageNames["GetAssetsForApp"] = "app.getAssetsForApp";
1229
- MessageNames["GetAssetRevision"] = "app.getAssetRevision";
1230
- MessageNames["BulkCreateAssets"] = "app.bulkCreateAssets";
1231
- MessageNames["BulkDeployAssets"] = "app.bulkDeployAssets";
1232
- MessageNames["SaveAsset"] = "app.saveAsset";
1233
- MessageNames["UpdateAssetOrder"] = "app.updateAssetOrder";
1234
- MessageNames["DeleteAsset"] = "app.deleteAsset";
1235
- MessageNames["TouchAsset"] = "app.touchAsset";
1236
- MessageNames["GetAssetNeedsApproval"] = "app.getAssetNeedsApproval";
1237
- MessageNames["GetDefaultAssets"] = "app.getDefaultAssets";
1238
- MessageNames["GetZoningApps"] = "app.getZoningApps";
1239
- MessageNames["AcquireZoningWidget"] = "app.acquireZoningWidget";
1240
- MessageNames["GetZoningData"] = "app.getZoningData";
1241
- MessageNames["EditZoningWidget"] = "app.editZoningWidget";
1242
- MessageNames["GetZoningLayoutAssets"] = "app.getZoningLayoutAssets";
1243
- MessageNames["GetFonts"] = "app.getFonts";
1244
- MessageNames["GetThemes"] = "app.getThemes";
1245
- MessageNames["GetTheme"] = "app.getTheme";
1246
- MessageNames["EditTheme"] = "app.editTheme";
1247
- MessageNames["SaveTheme"] = "app.saveTheme";
1248
- MessageNames["DeleteTheme"] = "app.deleteTheme";
1249
- MessageNames["HasFeatureFlag"] = "app.hasFeatureFlag";
1250
- MessageNames["GetDisplayGroupCustomProperties"] = "app.getDisplayGroupCustomProperties";
1251
- MessageNames["AppUrlChanged"] = "app.appUrlChanged";
1252
- MessageNames["Click"] = "dashboard.click";
1253
- MessageNames["ConfirmUnsavedChanges"] = "dashboard.unsavedChanges";
1254
- MessageNames["ErrorIndicator"] = "dashboard.indicator.error";
1255
- MessageNames["LoadingIndicator"] = "dashboard.indicator.loading";
1256
- MessageNames["Navigate"] = "dashboard.navigate";
1257
- MessageNames["NavigateBack"] = "dashboard.navigateBack";
1258
- MessageNames["NavigateToZoning"] = "dashboard.navigateToZoning";
1259
- MessageNames["NavigateToUrl"] = "dashboard.navigateToUrl";
1260
- MessageNames["OpenConfirm"] = "dashboard.confirm";
1261
- MessageNames["PageError"] = "dashboard.page.error";
1262
- MessageNames["PageLoading"] = "dashboard.page.loading";
1263
- MessageNames["PageNotFound"] = "dashboard.page.notFound";
1264
- MessageNames["Preview"] = "dashboard.preview";
1265
- MessageNames["GetAssetPreviewData"] = "dashboard.getAssetPreviewData";
1266
- MessageNames["PreviewAsset"] = "dashboard.previewAsset";
1267
- MessageNames["SetDisplaySelectorCallback"] = "dashboard.set.selectorCallback";
1268
- MessageNames["SetDisplaySelectorVisibility"] = "dashboard.set.selectorEnabled";
1269
- MessageNames["SetHeaderButtons"] = "dashboard.set.buttons";
1270
- MessageNames["SetHeaderTitle"] = "dashboard.set.title";
1271
- MessageNames["SuccessIndicator"] = "dashboard.indicator.success";
1272
- MessageNames["SwitchToView"] = "dashboard.switchToView";
1273
- MessageNames["Upload"] = "dashboard.upload";
1274
- MessageNames["ConnectData"] = "dashboard.connectData";
1275
- MessageNames["EditDataConnection"] = "dashboard.editDataConnection";
1276
- MessageNames["ProcessAssetResource"] = "dashboard.processAssetResource";
1277
- MessageNames["EncodeStatus"] = "dashboard.encodeStatus";
1278
- MessageNames["ResourcesEncodingStatus"] = "dashboard.resourcesEncodingStatus";
1279
- MessageNames["OpenContentIntervalSettingsDialog"] = "dashboard.openContentIntervalSettingsDialog";
1280
- MessageNames["SetAppHasUnsavedChanges"] = "dashboard.appHasUnsavedChanges";
1281
- MessageNames["ClearQueryString"] = "social.clearQueryString";
1282
- MessageNames["AuthInstagram"] = "social.authInstagram";
1283
- MessageNames["AuthSlack"] = "social.authSlack";
1284
- MessageNames["AuthenticateSlack"] = "social.authenticateSlack";
1285
- MessageNames["AuthenticateTeamsUser"] = "social.authenticateTeamsUser";
1286
- MessageNames["AuthenticateTeamsAdmin"] = "social.authenticateTeamsAdmin";
1287
- MessageNames["GetInstagramAccounts"] = "social.getInstagramAccounts";
1288
- MessageNames["TwitterSubscriptionStatus"] = "social.twitterSubscriptionStatus";
1289
- MessageNames["LookupTwitterId"] = "social.lookupTwitterId";
1290
- MessageNames["GetSlackTeams"] = "social.getSlackTeams";
1291
- MessageNames["GetSlackChannels"] = "social.getSlackChannels";
1292
- MessageNames["GetTeamsChannels"] = "social.getTeamsChannels";
1293
- MessageNames["AddFacebookPage"] = "social.addFacebookPage";
1294
- MessageNames["GetFeeds"] = "social.getFeeds";
1295
- MessageNames["SaveFeed"] = "social.saveFeed";
1296
- MessageNames["DeleteFeed"] = "social.deleteFeed";
1297
- MessageNames["OpenPreapprovalDialog"] = "social.openPreapprovalDialog";
1298
- MessageNames["LoadAllItems"] = "social.loadAllItems";
1299
- MessageNames["ApproveItem"] = "social.approveItem";
1300
- MessageNames["RemoveItem"] = "social.removeItem";
1301
- MessageNames["FavoriteItem"] = "social.favoriteItem";
1302
- MessageNames["UnfavoriteItem"] = "social.unfavoriteItem";
1303
- MessageNames["BanItem"] = "social.banItem";
1304
- MessageNames["LoadBlacklist"] = "social.loadBlacklist";
1305
- MessageNames["UnbanUser"] = "social.unbanUser";
1306
- })(MessageNames = exports.MessageNames || (exports.MessageNames = {}));
1467
+ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__, exports], __WEBPACK_AMD_DEFINE_RESULT__ = (function (require, exports) {
1468
+ "use strict";
1469
+ Object.defineProperty(exports, "__esModule", { value: true });
1470
+ exports.MessageNames = exports.MessageNamespaces = void 0;
1471
+ var MessageNamespaces;
1472
+ (function (MessageNamespaces) {
1473
+ MessageNamespaces["App"] = "app";
1474
+ MessageNamespaces["Social"] = "social";
1475
+ MessageNamespaces["Dashboard"] = "dashboard";
1476
+ })(MessageNamespaces = exports.MessageNamespaces || (exports.MessageNamespaces = {}));
1477
+ var MessageNames;
1478
+ (function (MessageNames) {
1479
+ MessageNames["GetAccount"] = "app.getAccount";
1480
+ MessageNames["GetUser"] = "app.getUser";
1481
+ MessageNames["GetDisplayGroups"] = "app.getDisplays";
1482
+ MessageNames["GetSelectedDisplayId"] = "app.getSelectedDisplayId";
1483
+ MessageNames["GetAssets"] = "app.getAssets";
1484
+ MessageNames["GetAssetsByIds"] = "app.getAssetsByIds";
1485
+ MessageNames["GetAssetsForApp"] = "app.getAssetsForApp";
1486
+ MessageNames["GetAssetRevision"] = "app.getAssetRevision";
1487
+ MessageNames["BulkCreateAssets"] = "app.bulkCreateAssets";
1488
+ MessageNames["BulkDeployAssets"] = "app.bulkDeployAssets";
1489
+ MessageNames["SaveAsset"] = "app.saveAsset";
1490
+ MessageNames["UpdateAssetOrder"] = "app.updateAssetOrder";
1491
+ MessageNames["DeleteAsset"] = "app.deleteAsset";
1492
+ MessageNames["TouchAsset"] = "app.touchAsset";
1493
+ MessageNames["GetAssetNeedsApproval"] = "app.getAssetNeedsApproval";
1494
+ MessageNames["GetDefaultAssets"] = "app.getDefaultAssets";
1495
+ MessageNames["GetZoningApps"] = "app.getZoningApps";
1496
+ MessageNames["AcquireZoningWidget"] = "app.acquireZoningWidget";
1497
+ MessageNames["GetZoningData"] = "app.getZoningData";
1498
+ MessageNames["EditZoningWidget"] = "app.editZoningWidget";
1499
+ MessageNames["GetZoningLayoutAssets"] = "app.getZoningLayoutAssets";
1500
+ MessageNames["GetFonts"] = "app.getFonts";
1501
+ MessageNames["GetThemes"] = "app.getThemes";
1502
+ MessageNames["GetTheme"] = "app.getTheme";
1503
+ MessageNames["EditTheme"] = "app.editTheme";
1504
+ MessageNames["SaveTheme"] = "app.saveTheme";
1505
+ MessageNames["DeleteTheme"] = "app.deleteTheme";
1506
+ MessageNames["HasFeatureFlag"] = "app.hasFeatureFlag";
1507
+ MessageNames["GetDisplayGroupCustomProperties"] = "app.getDisplayGroupCustomProperties";
1508
+ MessageNames["AppUrlChanged"] = "app.appUrlChanged";
1509
+ MessageNames["Click"] = "dashboard.click";
1510
+ MessageNames["ConfirmUnsavedChanges"] = "dashboard.unsavedChanges";
1511
+ MessageNames["ErrorIndicator"] = "dashboard.indicator.error";
1512
+ MessageNames["LoadingIndicator"] = "dashboard.indicator.loading";
1513
+ MessageNames["NavigateToZoning"] = "dashboard.navigateToZoning";
1514
+ MessageNames["NavigateToUrl"] = "dashboard.navigateToUrl";
1515
+ MessageNames["OpenConfirm"] = "dashboard.confirm";
1516
+ MessageNames["PageError"] = "dashboard.page.error";
1517
+ MessageNames["PageLoading"] = "dashboard.page.loading";
1518
+ MessageNames["PageNotFound"] = "dashboard.page.notFound";
1519
+ MessageNames["Preview"] = "dashboard.preview";
1520
+ MessageNames["GetAssetPreviewData"] = "dashboard.getAssetPreviewData";
1521
+ MessageNames["PreviewAsset"] = "dashboard.previewAsset";
1522
+ MessageNames["SetDisplaySelectorCallback"] = "dashboard.set.selectorCallback";
1523
+ MessageNames["SetDisplaySelectorVisibility"] = "dashboard.set.selectorEnabled";
1524
+ MessageNames["SetHeaderButtons"] = "dashboard.set.buttons";
1525
+ MessageNames["SetHeaderTitle"] = "dashboard.set.title";
1526
+ MessageNames["SuccessIndicator"] = "dashboard.indicator.success";
1527
+ MessageNames["SwitchToView"] = "dashboard.switchToView";
1528
+ MessageNames["Upload"] = "dashboard.upload";
1529
+ MessageNames["ConnectData"] = "dashboard.connectData";
1530
+ MessageNames["EditDataConnection"] = "dashboard.editDataConnection";
1531
+ MessageNames["EncodeStatus"] = "dashboard.encodeStatus";
1532
+ MessageNames["ResourcesEncodingStatus"] = "dashboard.resourcesEncodingStatus";
1533
+ MessageNames["OpenContentIntervalSettingsDialog"] = "dashboard.openContentIntervalSettingsDialog";
1534
+ MessageNames["SetAppHasUnsavedChanges"] = "dashboard.appHasUnsavedChanges";
1535
+ MessageNames["ClearQueryString"] = "social.clearQueryString";
1536
+ MessageNames["AuthInstagram"] = "social.authInstagram";
1537
+ MessageNames["AuthSlack"] = "social.authSlack";
1538
+ MessageNames["AuthenticateSlack"] = "social.authenticateSlack";
1539
+ MessageNames["AuthenticateTeamsUser"] = "social.authenticateTeamsUser";
1540
+ MessageNames["AuthenticateTeamsAdmin"] = "social.authenticateTeamsAdmin";
1541
+ MessageNames["GetInstagramAccounts"] = "social.getInstagramAccounts";
1542
+ MessageNames["TwitterSubscriptionStatus"] = "social.twitterSubscriptionStatus";
1543
+ MessageNames["LookupTwitterId"] = "social.lookupTwitterId";
1544
+ MessageNames["GetSlackTeams"] = "social.getSlackTeams";
1545
+ MessageNames["GetSlackChannels"] = "social.getSlackChannels";
1546
+ MessageNames["GetTeamsChannels"] = "social.getTeamsChannels";
1547
+ MessageNames["AddFacebookPage"] = "social.addFacebookPage";
1548
+ MessageNames["GetFeeds"] = "social.getFeeds";
1549
+ MessageNames["SaveFeed"] = "social.saveFeed";
1550
+ MessageNames["DeleteFeed"] = "social.deleteFeed";
1551
+ MessageNames["OpenPreapprovalDialog"] = "social.openPreapprovalDialog";
1552
+ MessageNames["LoadAllItems"] = "social.loadAllItems";
1553
+ MessageNames["ApproveItem"] = "social.approveItem";
1554
+ MessageNames["RemoveItem"] = "social.removeItem";
1555
+ MessageNames["FavoriteItem"] = "social.favoriteItem";
1556
+ MessageNames["UnfavoriteItem"] = "social.unfavoriteItem";
1557
+ MessageNames["BanItem"] = "social.banItem";
1558
+ MessageNames["LoadBlacklist"] = "social.loadBlacklist";
1559
+ MessageNames["UnbanUser"] = "social.unbanUser";
1560
+ MessageNames["LoadAccount"] = "app.loadAccount";
1561
+ })(MessageNames = exports.MessageNames || (exports.MessageNames = {}));
1307
1562
  }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
1308
- __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
1563
+ __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
1309
1564
 
1310
1565
 
1311
1566
  /***/ }),
@@ -1317,284 +1572,289 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_
1317
1572
  /*! no static exports found */
1318
1573
  /***/ (function(module, exports, __webpack_require__) {
1319
1574
 
1320
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__, exports, __webpack_require__(/*! ./internal-types */ "./src/internal-types.ts"), __webpack_require__(/*! ./utils */ "./src/utils.ts")], __WEBPACK_AMD_DEFINE_RESULT__ = (function (require, exports, internal_types_1, utils_1) {
1321
- "use strict";
1322
- Object.defineProperty(exports, "__esModule", { value: true });
1323
- exports.Social = void 0;
1324
- var Social = /** @class */ (function () {
1325
- function Social(bridge) {
1326
- this.bridge = bridge;
1327
- }
1328
- Social.prototype.clearQueryString = function () {
1329
- return this.bridge.sendMessage({
1330
- namespace: internal_types_1.MessageNamespaces.Social,
1331
- name: internal_types_1.MessageNames.ClearQueryString,
1332
- });
1333
- };
1334
- Social.prototype.authInstagram = function (accessToken) {
1335
- utils_1.validateString(accessToken, 'No authCode provided.');
1336
- return this.bridge.sendMessage({
1337
- namespace: internal_types_1.MessageNamespaces.Social,
1338
- name: internal_types_1.MessageNames.AuthInstagram,
1339
- params: {
1340
- accessToken: accessToken,
1341
- },
1342
- });
1343
- };
1344
- /* OBSOLETE. REMOVE AFTER 2020 */
1345
- Social.prototype.authSlack = function (verificationCode, redirectUrl) {
1346
- utils_1.validateString(verificationCode, 'No Slack auth token provided');
1347
- utils_1.validateString(redirectUrl, 'No redirect url provided');
1348
- return this.bridge.sendMessage({
1349
- namespace: internal_types_1.MessageNamespaces.Social,
1350
- name: internal_types_1.MessageNames.AuthSlack,
1351
- params: {
1352
- verificationCode: verificationCode,
1353
- redirectUrl: redirectUrl,
1354
- },
1355
- });
1356
- };
1357
- Social.prototype.authenticateSlack = function (verificationCode, redirectUrl) {
1358
- utils_1.validateString(verificationCode, 'No Slack auth token provided');
1359
- utils_1.validateString(redirectUrl, 'No redirect url provided');
1360
- return this.bridge.sendMessage({
1361
- namespace: internal_types_1.MessageNamespaces.Social,
1362
- name: internal_types_1.MessageNames.AuthenticateSlack,
1363
- params: {
1364
- verificationCode: verificationCode,
1365
- redirectUrl: redirectUrl,
1366
- },
1367
- });
1368
- };
1369
- Social.prototype.authenticateTeamsUser = function (verificationCode, redirectUrl) {
1370
- utils_1.validateString(verificationCode, 'No Teams User auth token provided');
1371
- utils_1.validateString(redirectUrl, 'No redirect url provided');
1372
- return this.bridge.sendMessage({
1373
- namespace: internal_types_1.MessageNamespaces.Social,
1374
- name: internal_types_1.MessageNames.AuthenticateTeamsUser,
1375
- params: {
1376
- verificationCode: verificationCode,
1377
- redirectUrl: redirectUrl,
1378
- },
1379
- });
1380
- };
1381
- /**
1382
- * Saves Teams Admin token to backend.
1383
- * @param tenantId A user id returned from MS Teams after authenticating.
1384
- */
1385
- Social.prototype.authenticateTeamsAdmin = function (tenantId) {
1386
- utils_1.validateString(tenantId, 'No Teams Admin auth token provided');
1387
- return this.bridge.sendMessage({
1388
- namespace: internal_types_1.MessageNamespaces.Social,
1389
- name: internal_types_1.MessageNames.AuthenticateTeamsAdmin,
1390
- params: {
1391
- tenantId: tenantId,
1392
- },
1393
- });
1394
- };
1395
- Social.prototype.getInstagramAccounts = function (userId) {
1396
- utils_1.validateString(userId, 'No Facebook User Id provided');
1397
- return this.bridge.sendMessage({
1398
- namespace: internal_types_1.MessageNamespaces.Social,
1399
- name: internal_types_1.MessageNames.GetInstagramAccounts,
1400
- params: {
1401
- userId: userId,
1402
- },
1403
- });
1404
- };
1405
- Social.prototype.lookupTwitterId = function (username) {
1406
- utils_1.validateString(username, 'No username provided');
1407
- return this.bridge.sendMessage({
1408
- namespace: internal_types_1.MessageNamespaces.Social,
1409
- name: internal_types_1.MessageNames.LookupTwitterId,
1410
- params: username,
1411
- });
1412
- };
1413
- Social.prototype.twitterSubscriptionStatus = function () {
1414
- return this.bridge.sendMessage({
1415
- namespace: internal_types_1.MessageNamespaces.Social,
1416
- name: internal_types_1.MessageNames.TwitterSubscriptionStatus,
1417
- });
1418
- };
1419
- Social.prototype.getSlackTeams = function () {
1420
- return this.bridge.sendMessage({
1421
- namespace: internal_types_1.MessageNamespaces.Social,
1422
- name: internal_types_1.MessageNames.GetSlackTeams,
1423
- });
1424
- };
1425
- Social.prototype.getSlackChannels = function (teamId) {
1426
- utils_1.validateString(teamId, 'No teamId provided');
1427
- return this.bridge.sendMessage({
1428
- namespace: internal_types_1.MessageNamespaces.Social,
1429
- name: internal_types_1.MessageNames.GetSlackChannels,
1430
- params: teamId,
1431
- });
1432
- };
1433
- /**
1434
- * Returns Channels available for a given user id
1435
- * @param tenantId An ID returned after authenticating the user with MS Teams
1436
- */
1437
- Social.prototype.getTeamsChannels = function (tenantId) {
1438
- utils_1.validateString(tenantId, 'No tenantId provided');
1439
- return this.bridge.sendMessage({
1440
- namespace: internal_types_1.MessageNamespaces.Social,
1441
- name: internal_types_1.MessageNames.GetTeamsChannels,
1442
- params: tenantId,
1443
- });
1444
- };
1445
- Social.prototype.addFacebookPage = function (feedId, pageId, accessToken) {
1446
- utils_1.validateString(feedId, 'No feedId provided');
1447
- utils_1.validateString(pageId, 'No pageId provided');
1448
- utils_1.validateString(accessToken, 'No accessToken provided');
1449
- return this.bridge.sendMessage({
1450
- namespace: internal_types_1.MessageNamespaces.Social,
1451
- name: internal_types_1.MessageNames.AddFacebookPage,
1452
- params: {
1453
- feedId: feedId,
1454
- pageId: pageId,
1455
- accessToken: accessToken,
1456
- },
1457
- });
1458
- };
1459
- Social.prototype.getFeeds = function (assetId) {
1460
- utils_1.validateString(assetId, 'No assetid provided.');
1461
- return this.bridge.sendMessage({
1462
- namespace: internal_types_1.MessageNamespaces.Social,
1463
- name: internal_types_1.MessageNames.GetFeeds,
1464
- params: assetId,
1465
- });
1466
- };
1467
- Social.prototype.saveFeed = function (feed) {
1468
- utils_1.validateObject(feed, 'No feed provided.');
1469
- return this.bridge.sendMessage({
1470
- namespace: internal_types_1.MessageNamespaces.Social,
1471
- name: internal_types_1.MessageNames.SaveFeed,
1472
- params: feed,
1473
- });
1474
- };
1475
- Social.prototype.deleteFeed = function (feedId) {
1476
- utils_1.validateString(feedId, 'No feedId provided.');
1477
- return this.bridge.sendMessage({
1478
- namespace: internal_types_1.MessageNamespaces.Social,
1479
- name: internal_types_1.MessageNames.DeleteFeed,
1480
- params: feedId,
1481
- });
1482
- };
1483
- Social.prototype.openPreapprovalDialog = function (feed, iconUrl, options) {
1484
- utils_1.validateObject(feed, 'No feed provided.');
1485
- return this.bridge.sendMessage({
1486
- namespace: internal_types_1.MessageNamespaces.Social,
1487
- name: internal_types_1.MessageNames.OpenPreapprovalDialog,
1488
- params: {
1489
- feed: feed,
1490
- iconUrl: iconUrl,
1491
- options: options,
1492
- },
1493
- });
1494
- };
1495
- Social.prototype.loadAllItems = function (assetId) {
1496
- utils_1.validateString(assetId, 'No assetId provided.');
1497
- return this.bridge.sendMessage({
1498
- namespace: internal_types_1.MessageNamespaces.Social,
1499
- name: internal_types_1.MessageNames.LoadAllItems,
1500
- params: assetId,
1501
- });
1502
- };
1503
- Social.prototype.approveItem = function (itemId, assetId) {
1504
- utils_1.validateString(itemId, 'No itemId provided.');
1505
- utils_1.validateString(assetId, 'No assetId provided.');
1506
- return this.bridge.sendMessage({
1507
- namespace: internal_types_1.MessageNamespaces.Social,
1508
- name: internal_types_1.MessageNames.ApproveItem,
1509
- params: {
1510
- itemId: itemId,
1511
- assetId: assetId,
1512
- },
1513
- });
1514
- };
1515
- Social.prototype.removeItem = function (itemId, assetId) {
1516
- utils_1.validateString(itemId, 'No itemId provided.');
1517
- utils_1.validateString(assetId, 'No assetId provided.');
1518
- return this.bridge.sendMessage({
1519
- namespace: internal_types_1.MessageNamespaces.Social,
1520
- name: internal_types_1.MessageNames.RemoveItem,
1521
- params: {
1522
- itemId: itemId,
1523
- assetId: assetId,
1524
- },
1525
- });
1526
- };
1527
- Social.prototype.favoriteItem = function (itemId, assetId, network) {
1528
- utils_1.validateString(itemId, 'No itemId provided.');
1529
- utils_1.validateString(assetId, 'No assetId provided.');
1530
- utils_1.validateString(network, 'No network provided.');
1531
- return this.bridge.sendMessage({
1532
- namespace: internal_types_1.MessageNamespaces.Social,
1533
- name: internal_types_1.MessageNames.FavoriteItem,
1534
- params: {
1535
- itemId: itemId,
1536
- assetId: assetId,
1537
- network: network,
1538
- },
1539
- });
1540
- };
1541
- Social.prototype.unfavoriteItem = function (itemId, assetId, network) {
1542
- utils_1.validateString(itemId, 'No itemId provided.');
1543
- utils_1.validateString(assetId, 'No assetId provided.');
1544
- utils_1.validateString(network, 'No network provided.');
1545
- return this.bridge.sendMessage({
1546
- namespace: internal_types_1.MessageNamespaces.Social,
1547
- name: internal_types_1.MessageNames.UnfavoriteItem,
1548
- params: {
1549
- itemId: itemId,
1550
- assetId: assetId,
1551
- network: network,
1552
- },
1553
- });
1554
- };
1555
- Social.prototype.banItem = function (itemId, assetId) {
1556
- utils_1.validateString(itemId, 'No itemId provided.');
1557
- utils_1.validateString(assetId, 'No assetId provided.');
1558
- return this.bridge.sendMessage({
1559
- namespace: internal_types_1.MessageNamespaces.Social,
1560
- name: internal_types_1.MessageNames.BanItem,
1561
- params: {
1562
- itemId: itemId,
1563
- assetId: assetId,
1564
- },
1565
- });
1566
- };
1567
- Social.prototype.loadBlacklist = function (accountId, socialNetwork) {
1568
- utils_1.validateString(accountId, 'No accountId provided.');
1569
- utils_1.validateString(socialNetwork, 'No socialNetwork provided.');
1570
- return this.bridge.sendMessage({
1571
- namespace: internal_types_1.MessageNamespaces.Social,
1572
- name: internal_types_1.MessageNames.LoadBlacklist,
1573
- params: {
1574
- accountId: accountId,
1575
- socialNetwork: socialNetwork,
1576
- },
1577
- });
1578
- };
1579
- Social.prototype.unbanUser = function (username, socialNetwork, accountId) {
1580
- utils_1.validateString(username, 'No username provided.');
1581
- utils_1.validateString(socialNetwork, 'No socialNetwork provided.');
1582
- utils_1.validateString(accountId, 'No accountId provided.');
1583
- return this.bridge.sendMessage({
1584
- namespace: internal_types_1.MessageNamespaces.Social,
1585
- name: internal_types_1.MessageNames.UnbanUser,
1586
- params: {
1587
- username: username,
1588
- socialNetwork: socialNetwork,
1589
- accountId: accountId,
1590
- },
1591
- });
1592
- };
1593
- return Social;
1594
- }());
1595
- exports.Social = Social;
1575
+ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__, exports, __webpack_require__(/*! ./internal-types */ "./src/internal-types.ts"), __webpack_require__(/*! ./utils */ "./src/utils.ts")], __WEBPACK_AMD_DEFINE_RESULT__ = (function (require, exports, internal_types_1, utils_1) {
1576
+ "use strict";
1577
+ Object.defineProperty(exports, "__esModule", { value: true });
1578
+ exports.Social = void 0;
1579
+ /**
1580
+ * Social API is a part of the Dashboard SDK used to access social media related data.
1581
+ * Use global `enplug.social` object to access these methods.
1582
+ */
1583
+ var Social = /** @class */ (function () {
1584
+ /** @internal */
1585
+ function Social(bridge) {
1586
+ this.bridge = bridge;
1587
+ }
1588
+ Social.prototype.clearQueryString = function () {
1589
+ return this.bridge.sendMessage({
1590
+ namespace: internal_types_1.MessageNamespaces.Social,
1591
+ name: internal_types_1.MessageNames.ClearQueryString,
1592
+ });
1593
+ };
1594
+ Social.prototype.authInstagram = function (accessToken) {
1595
+ utils_1.validateString(accessToken, 'No authCode provided.');
1596
+ return this.bridge.sendMessage({
1597
+ namespace: internal_types_1.MessageNamespaces.Social,
1598
+ name: internal_types_1.MessageNames.AuthInstagram,
1599
+ params: {
1600
+ accessToken: accessToken,
1601
+ },
1602
+ });
1603
+ };
1604
+ /* OBSOLETE. REMOVE AFTER 2020 */
1605
+ Social.prototype.authSlack = function (verificationCode, redirectUrl) {
1606
+ utils_1.validateString(verificationCode, 'No Slack auth token provided');
1607
+ utils_1.validateString(redirectUrl, 'No redirect url provided');
1608
+ return this.bridge.sendMessage({
1609
+ namespace: internal_types_1.MessageNamespaces.Social,
1610
+ name: internal_types_1.MessageNames.AuthSlack,
1611
+ params: {
1612
+ verificationCode: verificationCode,
1613
+ redirectUrl: redirectUrl,
1614
+ },
1615
+ });
1616
+ };
1617
+ Social.prototype.authenticateSlack = function (verificationCode, redirectUrl) {
1618
+ utils_1.validateString(verificationCode, 'No Slack auth token provided');
1619
+ utils_1.validateString(redirectUrl, 'No redirect url provided');
1620
+ return this.bridge.sendMessage({
1621
+ namespace: internal_types_1.MessageNamespaces.Social,
1622
+ name: internal_types_1.MessageNames.AuthenticateSlack,
1623
+ params: {
1624
+ verificationCode: verificationCode,
1625
+ redirectUrl: redirectUrl,
1626
+ },
1627
+ });
1628
+ };
1629
+ Social.prototype.authenticateTeamsUser = function (verificationCode, redirectUrl) {
1630
+ utils_1.validateString(verificationCode, 'No Teams User auth token provided');
1631
+ utils_1.validateString(redirectUrl, 'No redirect url provided');
1632
+ return this.bridge.sendMessage({
1633
+ namespace: internal_types_1.MessageNamespaces.Social,
1634
+ name: internal_types_1.MessageNames.AuthenticateTeamsUser,
1635
+ params: {
1636
+ verificationCode: verificationCode,
1637
+ redirectUrl: redirectUrl,
1638
+ },
1639
+ });
1640
+ };
1641
+ /**
1642
+ * Saves Teams Admin token to backend.
1643
+ * @param tenantId - A user id returned from MS Teams after authenticating.
1644
+ */
1645
+ Social.prototype.authenticateTeamsAdmin = function (tenantId) {
1646
+ utils_1.validateString(tenantId, 'No Teams Admin auth token provided');
1647
+ return this.bridge.sendMessage({
1648
+ namespace: internal_types_1.MessageNamespaces.Social,
1649
+ name: internal_types_1.MessageNames.AuthenticateTeamsAdmin,
1650
+ params: {
1651
+ tenantId: tenantId,
1652
+ },
1653
+ });
1654
+ };
1655
+ Social.prototype.getInstagramAccounts = function (userId) {
1656
+ utils_1.validateString(userId, 'No Facebook User Id provided');
1657
+ return this.bridge.sendMessage({
1658
+ namespace: internal_types_1.MessageNamespaces.Social,
1659
+ name: internal_types_1.MessageNames.GetInstagramAccounts,
1660
+ params: {
1661
+ userId: userId,
1662
+ },
1663
+ });
1664
+ };
1665
+ Social.prototype.lookupTwitterId = function (username) {
1666
+ utils_1.validateString(username, 'No username provided');
1667
+ return this.bridge.sendMessage({
1668
+ namespace: internal_types_1.MessageNamespaces.Social,
1669
+ name: internal_types_1.MessageNames.LookupTwitterId,
1670
+ params: username,
1671
+ });
1672
+ };
1673
+ Social.prototype.twitterSubscriptionStatus = function () {
1674
+ return this.bridge.sendMessage({
1675
+ namespace: internal_types_1.MessageNamespaces.Social,
1676
+ name: internal_types_1.MessageNames.TwitterSubscriptionStatus,
1677
+ });
1678
+ };
1679
+ Social.prototype.getSlackTeams = function () {
1680
+ return this.bridge.sendMessage({
1681
+ namespace: internal_types_1.MessageNamespaces.Social,
1682
+ name: internal_types_1.MessageNames.GetSlackTeams,
1683
+ });
1684
+ };
1685
+ Social.prototype.getSlackChannels = function (teamId) {
1686
+ utils_1.validateString(teamId, 'No teamId provided');
1687
+ return this.bridge.sendMessage({
1688
+ namespace: internal_types_1.MessageNamespaces.Social,
1689
+ name: internal_types_1.MessageNames.GetSlackChannels,
1690
+ params: teamId,
1691
+ });
1692
+ };
1693
+ /**
1694
+ * Returns Channels available for a given user ID.
1695
+ * @param tenantId - An ID returned after authenticating the user with MS Teams.
1696
+ */
1697
+ Social.prototype.getTeamsChannels = function (tenantId) {
1698
+ utils_1.validateString(tenantId, 'No tenantId provided');
1699
+ return this.bridge.sendMessage({
1700
+ namespace: internal_types_1.MessageNamespaces.Social,
1701
+ name: internal_types_1.MessageNames.GetTeamsChannels,
1702
+ params: tenantId,
1703
+ });
1704
+ };
1705
+ Social.prototype.addFacebookPage = function (feedId, pageId, accessToken) {
1706
+ utils_1.validateString(feedId, 'No feedId provided');
1707
+ utils_1.validateString(pageId, 'No pageId provided');
1708
+ utils_1.validateString(accessToken, 'No accessToken provided');
1709
+ return this.bridge.sendMessage({
1710
+ namespace: internal_types_1.MessageNamespaces.Social,
1711
+ name: internal_types_1.MessageNames.AddFacebookPage,
1712
+ params: {
1713
+ feedId: feedId,
1714
+ pageId: pageId,
1715
+ accessToken: accessToken,
1716
+ },
1717
+ });
1718
+ };
1719
+ Social.prototype.getFeeds = function (assetId) {
1720
+ utils_1.validateString(assetId, 'No assetid provided.');
1721
+ return this.bridge.sendMessage({
1722
+ namespace: internal_types_1.MessageNamespaces.Social,
1723
+ name: internal_types_1.MessageNames.GetFeeds,
1724
+ params: assetId,
1725
+ });
1726
+ };
1727
+ Social.prototype.saveFeed = function (feed) {
1728
+ utils_1.validateObject(feed, 'No feed provided.');
1729
+ return this.bridge.sendMessage({
1730
+ namespace: internal_types_1.MessageNamespaces.Social,
1731
+ name: internal_types_1.MessageNames.SaveFeed,
1732
+ params: feed,
1733
+ });
1734
+ };
1735
+ Social.prototype.deleteFeed = function (feedId) {
1736
+ utils_1.validateString(feedId, 'No feedId provided.');
1737
+ return this.bridge.sendMessage({
1738
+ namespace: internal_types_1.MessageNamespaces.Social,
1739
+ name: internal_types_1.MessageNames.DeleteFeed,
1740
+ params: feedId,
1741
+ });
1742
+ };
1743
+ Social.prototype.openPreapprovalDialog = function (feed, iconUrl, options) {
1744
+ utils_1.validateObject(feed, 'No feed provided.');
1745
+ return this.bridge.sendMessage({
1746
+ namespace: internal_types_1.MessageNamespaces.Social,
1747
+ name: internal_types_1.MessageNames.OpenPreapprovalDialog,
1748
+ params: {
1749
+ feed: feed,
1750
+ iconUrl: iconUrl,
1751
+ options: options,
1752
+ },
1753
+ });
1754
+ };
1755
+ Social.prototype.loadAllItems = function (assetId) {
1756
+ utils_1.validateString(assetId, 'No assetId provided.');
1757
+ return this.bridge.sendMessage({
1758
+ namespace: internal_types_1.MessageNamespaces.Social,
1759
+ name: internal_types_1.MessageNames.LoadAllItems,
1760
+ params: assetId,
1761
+ });
1762
+ };
1763
+ Social.prototype.approveItem = function (itemId, assetId) {
1764
+ utils_1.validateString(itemId, 'No itemId provided.');
1765
+ utils_1.validateString(assetId, 'No assetId provided.');
1766
+ return this.bridge.sendMessage({
1767
+ namespace: internal_types_1.MessageNamespaces.Social,
1768
+ name: internal_types_1.MessageNames.ApproveItem,
1769
+ params: {
1770
+ itemId: itemId,
1771
+ assetId: assetId,
1772
+ },
1773
+ });
1774
+ };
1775
+ Social.prototype.removeItem = function (itemId, assetId) {
1776
+ utils_1.validateString(itemId, 'No itemId provided.');
1777
+ utils_1.validateString(assetId, 'No assetId provided.');
1778
+ return this.bridge.sendMessage({
1779
+ namespace: internal_types_1.MessageNamespaces.Social,
1780
+ name: internal_types_1.MessageNames.RemoveItem,
1781
+ params: {
1782
+ itemId: itemId,
1783
+ assetId: assetId,
1784
+ },
1785
+ });
1786
+ };
1787
+ Social.prototype.favoriteItem = function (itemId, assetId, network) {
1788
+ utils_1.validateString(itemId, 'No itemId provided.');
1789
+ utils_1.validateString(assetId, 'No assetId provided.');
1790
+ utils_1.validateString(network, 'No network provided.');
1791
+ return this.bridge.sendMessage({
1792
+ namespace: internal_types_1.MessageNamespaces.Social,
1793
+ name: internal_types_1.MessageNames.FavoriteItem,
1794
+ params: {
1795
+ itemId: itemId,
1796
+ assetId: assetId,
1797
+ network: network,
1798
+ },
1799
+ });
1800
+ };
1801
+ Social.prototype.unfavoriteItem = function (itemId, assetId, network) {
1802
+ utils_1.validateString(itemId, 'No itemId provided.');
1803
+ utils_1.validateString(assetId, 'No assetId provided.');
1804
+ utils_1.validateString(network, 'No network provided.');
1805
+ return this.bridge.sendMessage({
1806
+ namespace: internal_types_1.MessageNamespaces.Social,
1807
+ name: internal_types_1.MessageNames.UnfavoriteItem,
1808
+ params: {
1809
+ itemId: itemId,
1810
+ assetId: assetId,
1811
+ network: network,
1812
+ },
1813
+ });
1814
+ };
1815
+ Social.prototype.banItem = function (itemId, assetId) {
1816
+ utils_1.validateString(itemId, 'No itemId provided.');
1817
+ utils_1.validateString(assetId, 'No assetId provided.');
1818
+ return this.bridge.sendMessage({
1819
+ namespace: internal_types_1.MessageNamespaces.Social,
1820
+ name: internal_types_1.MessageNames.BanItem,
1821
+ params: {
1822
+ itemId: itemId,
1823
+ assetId: assetId,
1824
+ },
1825
+ });
1826
+ };
1827
+ Social.prototype.loadBlacklist = function (accountId, socialNetwork) {
1828
+ utils_1.validateString(accountId, 'No accountId provided.');
1829
+ utils_1.validateString(socialNetwork, 'No socialNetwork provided.');
1830
+ return this.bridge.sendMessage({
1831
+ namespace: internal_types_1.MessageNamespaces.Social,
1832
+ name: internal_types_1.MessageNames.LoadBlacklist,
1833
+ params: {
1834
+ accountId: accountId,
1835
+ socialNetwork: socialNetwork,
1836
+ },
1837
+ });
1838
+ };
1839
+ Social.prototype.unbanUser = function (username, socialNetwork, accountId) {
1840
+ utils_1.validateString(username, 'No username provided.');
1841
+ utils_1.validateString(socialNetwork, 'No socialNetwork provided.');
1842
+ utils_1.validateString(accountId, 'No accountId provided.');
1843
+ return this.bridge.sendMessage({
1844
+ namespace: internal_types_1.MessageNamespaces.Social,
1845
+ name: internal_types_1.MessageNames.UnbanUser,
1846
+ params: {
1847
+ username: username,
1848
+ socialNetwork: socialNetwork,
1849
+ accountId: accountId,
1850
+ },
1851
+ });
1852
+ };
1853
+ return Social;
1854
+ }());
1855
+ exports.Social = Social;
1596
1856
  }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
1597
- __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
1857
+ __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
1598
1858
 
1599
1859
 
1600
1860
  /***/ }),
@@ -1606,43 +1866,43 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_
1606
1866
  /*! no static exports found */
1607
1867
  /***/ (function(module, exports, __webpack_require__) {
1608
1868
 
1609
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__, exports], __WEBPACK_AMD_DEFINE_RESULT__ = (function (require, exports) {
1610
- "use strict";
1611
- Object.defineProperty(exports, "__esModule", { value: true });
1612
- exports.validateFunction = exports.validateBool = exports.validateObject = exports.validateString = exports.validateArray = void 0;
1613
- var TAG = '[Dashboard SDK]';
1614
- function validateArray(arg, message) {
1615
- if (!Array.isArray(arg)) {
1616
- throw new Error(TAG + " " + message);
1617
- }
1618
- }
1619
- exports.validateArray = validateArray;
1620
- function validateString(arg, message) {
1621
- if (typeof arg !== 'string') {
1622
- throw new Error(TAG + " " + message);
1623
- }
1624
- }
1625
- exports.validateString = validateString;
1626
- function validateObject(arg, message) {
1627
- if (!(arg instanceof Object) || arg instanceof Array) {
1628
- throw new Error(TAG + " " + message);
1629
- }
1630
- }
1631
- exports.validateObject = validateObject;
1632
- function validateBool(arg, message) {
1633
- if (typeof arg !== 'boolean') {
1634
- throw new Error(TAG + " " + message);
1635
- }
1636
- }
1637
- exports.validateBool = validateBool;
1638
- function validateFunction(arg, message) {
1639
- if (typeof arg !== 'function') {
1640
- throw new Error(TAG + " " + message);
1641
- }
1642
- }
1643
- exports.validateFunction = validateFunction;
1869
+ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__, exports], __WEBPACK_AMD_DEFINE_RESULT__ = (function (require, exports) {
1870
+ "use strict";
1871
+ Object.defineProperty(exports, "__esModule", { value: true });
1872
+ exports.validateFunction = exports.validateBool = exports.validateObject = exports.validateString = exports.validateArray = void 0;
1873
+ var TAG = '[Dashboard SDK]';
1874
+ function validateArray(arg, message) {
1875
+ if (!Array.isArray(arg)) {
1876
+ throw new Error(TAG + " " + message);
1877
+ }
1878
+ }
1879
+ exports.validateArray = validateArray;
1880
+ function validateString(arg, message) {
1881
+ if (typeof arg !== 'string') {
1882
+ throw new Error(TAG + " " + message);
1883
+ }
1884
+ }
1885
+ exports.validateString = validateString;
1886
+ function validateObject(arg, message) {
1887
+ if (!(arg instanceof Object) || arg instanceof Array) {
1888
+ throw new Error(TAG + " " + message);
1889
+ }
1890
+ }
1891
+ exports.validateObject = validateObject;
1892
+ function validateBool(arg, message) {
1893
+ if (typeof arg !== 'boolean') {
1894
+ throw new Error(TAG + " " + message);
1895
+ }
1896
+ }
1897
+ exports.validateBool = validateBool;
1898
+ function validateFunction(arg, message) {
1899
+ if (typeof arg !== 'function') {
1900
+ throw new Error(TAG + " " + message);
1901
+ }
1902
+ }
1903
+ exports.validateFunction = validateFunction;
1644
1904
  }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
1645
- __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
1905
+ __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
1646
1906
 
1647
1907
 
1648
1908
  /***/ })