@enplug/sdk-dashboard 5.4.0 → 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/README.md +83 -0
- package/dist/dashboard.js +1724 -1464
- package/dist/dashboard.js.map +1 -1
- package/index.d.ts +6 -6
- package/package.json +96 -89
- package/types/account.d.ts +261 -159
- package/types/bridge/bridge-base.d.ts +21 -21
- package/types/dashboard.d.ts +371 -196
- package/types/external-types.d.ts +550 -526
- package/types/index.ts +2 -2
- package/types/internal-types.d.ts +159 -161
- package/types/sdk.d.ts +8 -8
- package/types/social.d.ts +44 -39
- package/types/utils.d.ts +5 -5
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
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
*
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
});
|
|
213
|
-
};
|
|
214
|
-
/**
|
|
215
|
-
*
|
|
216
|
-
*
|
|
217
|
-
* @param
|
|
218
|
-
*
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
*
|
|
239
|
-
*
|
|
240
|
-
*
|
|
241
|
-
*
|
|
242
|
-
*/
|
|
243
|
-
Account.prototype.
|
|
244
|
-
if (dialogOptions === void 0) { dialogOptions = {}; }
|
|
245
|
-
utils_1.
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
},
|
|
282
|
-
});
|
|
283
|
-
};
|
|
284
|
-
/**
|
|
285
|
-
*
|
|
286
|
-
*
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
*
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
*
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
*
|
|
362
|
-
*/
|
|
363
|
-
Account.prototype.
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
*
|
|
458
|
-
*
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
*
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
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
|
+
* <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 =
|
|
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
|
|
589
|
-
* @returns
|
|
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
|
|
605
|
-
* @returns
|
|
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 =
|
|
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
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
this.bridge
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
* @
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
*
|
|
776
|
-
*
|
|
777
|
-
*
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
*
|
|
802
|
-
*
|
|
803
|
-
* @param
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
*
|
|
835
|
-
*
|
|
836
|
-
*
|
|
837
|
-
*
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
*
|
|
866
|
-
* @param
|
|
867
|
-
*/
|
|
868
|
-
Dashboard.prototype.
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
*
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
*
|
|
891
|
-
*
|
|
892
|
-
*
|
|
893
|
-
*
|
|
894
|
-
*
|
|
895
|
-
*
|
|
896
|
-
*
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
});
|
|
1023
|
-
};
|
|
1024
|
-
/**
|
|
1025
|
-
*
|
|
1026
|
-
*
|
|
1027
|
-
*
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
*
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
})
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
*
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
*
|
|
1107
|
-
*
|
|
1108
|
-
*
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
*
|
|
1120
|
-
*
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
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
|
+
* <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
|
+
* 
|
|
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
|
+
* 
|
|
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
|
+
* <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
|
+
* <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
|
+
* <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
|
+
* <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
|
+
* <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
|
+
* <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
|
+
* 
|
|
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
|
+
* <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
|
+
* 
|
|
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
|
+
* 
|
|
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["
|
|
1257
|
-
MessageNames["
|
|
1258
|
-
MessageNames["
|
|
1259
|
-
MessageNames["
|
|
1260
|
-
MessageNames["
|
|
1261
|
-
MessageNames["
|
|
1262
|
-
MessageNames["
|
|
1263
|
-
MessageNames["
|
|
1264
|
-
MessageNames["
|
|
1265
|
-
MessageNames["
|
|
1266
|
-
MessageNames["
|
|
1267
|
-
MessageNames["
|
|
1268
|
-
MessageNames["
|
|
1269
|
-
MessageNames["
|
|
1270
|
-
MessageNames["
|
|
1271
|
-
MessageNames["
|
|
1272
|
-
MessageNames["
|
|
1273
|
-
MessageNames["
|
|
1274
|
-
MessageNames["
|
|
1275
|
-
MessageNames["
|
|
1276
|
-
MessageNames["
|
|
1277
|
-
MessageNames["
|
|
1278
|
-
MessageNames["
|
|
1279
|
-
MessageNames["
|
|
1280
|
-
MessageNames["
|
|
1281
|
-
MessageNames["
|
|
1282
|
-
MessageNames["
|
|
1283
|
-
MessageNames["
|
|
1284
|
-
MessageNames["
|
|
1285
|
-
MessageNames["
|
|
1286
|
-
MessageNames["
|
|
1287
|
-
MessageNames["
|
|
1288
|
-
MessageNames["
|
|
1289
|
-
MessageNames["
|
|
1290
|
-
MessageNames["
|
|
1291
|
-
MessageNames["
|
|
1292
|
-
MessageNames["
|
|
1293
|
-
MessageNames["
|
|
1294
|
-
MessageNames["
|
|
1295
|
-
MessageNames["
|
|
1296
|
-
MessageNames["
|
|
1297
|
-
MessageNames["
|
|
1298
|
-
MessageNames["
|
|
1299
|
-
MessageNames["
|
|
1300
|
-
MessageNames["
|
|
1301
|
-
MessageNames["
|
|
1302
|
-
MessageNames["
|
|
1303
|
-
MessageNames["
|
|
1304
|
-
|
|
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
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
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
|
/***/ })
|