@blackbaud/sky-addin-client 1.2.0 → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/CHANGELOG.md +124 -118
  2. package/README.md +470 -470
  3. package/bundles/sky-addin-client.global-es2015.js +914 -851
  4. package/bundles/sky-addin-client.global-es2015.min.js +1 -1
  5. package/bundles/sky-addin-client.global.js +926 -863
  6. package/bundles/sky-addin-client.global.min.js +1 -1
  7. package/bundles/sky-addin-client.umd-es2015.js +914 -851
  8. package/bundles/sky-addin-client.umd-es2015.min.js +1 -1
  9. package/bundles/sky-addin-client.umd.js +926 -863
  10. package/bundles/sky-addin-client.umd.min.js +1 -1
  11. package/index.d.ts +1 -1
  12. package/index.js +17 -17
  13. package/package.json +67 -67
  14. package/src/addin/addin-client.d.ts +277 -277
  15. package/src/addin/addin-client.js +703 -640
  16. package/src/addin/addin-client.js.map +1 -1
  17. package/src/addin/addin-client.spec.d.ts +1 -1
  18. package/src/addin/addin-client.spec.js +1476 -1414
  19. package/src/addin/addin-client.spec.js.map +1 -1
  20. package/src/addin/client-interfaces/addin-action-button-config.d.ts +10 -10
  21. package/src/addin/client-interfaces/addin-action-button-config.js +2 -2
  22. package/src/addin/client-interfaces/addin-button-config.d.ts +10 -10
  23. package/src/addin/client-interfaces/addin-button-config.js +2 -2
  24. package/src/addin/client-interfaces/addin-button-style.d.ts +6 -6
  25. package/src/addin/client-interfaces/addin-button-style.js +17 -17
  26. package/src/addin/client-interfaces/addin-client-args.d.ts +10 -10
  27. package/src/addin/client-interfaces/addin-client-args.js +2 -2
  28. package/src/addin/client-interfaces/addin-client-callbacks.d.ts +40 -40
  29. package/src/addin/client-interfaces/addin-client-callbacks.js +2 -2
  30. package/src/addin/client-interfaces/addin-client-close-modal-args.d.ts +10 -10
  31. package/src/addin/client-interfaces/addin-client-close-modal-args.js +2 -2
  32. package/src/addin/client-interfaces/addin-client-event-args.d.ts +13 -13
  33. package/src/addin/client-interfaces/addin-client-event-args.js +2 -2
  34. package/src/addin/client-interfaces/addin-client-flyout-permalink.d.ts +14 -14
  35. package/src/addin/client-interfaces/addin-client-flyout-permalink.js +2 -2
  36. package/src/addin/client-interfaces/addin-client-init-args.d.ts +28 -28
  37. package/src/addin/client-interfaces/addin-client-init-args.js +2 -2
  38. package/src/addin/client-interfaces/addin-client-navigate-args.d.ts +9 -9
  39. package/src/addin/client-interfaces/addin-client-navigate-args.js +2 -2
  40. package/src/addin/client-interfaces/addin-client-open-help-args.d.ts +10 -10
  41. package/src/addin/client-interfaces/addin-client-open-help-args.js +2 -2
  42. package/src/addin/client-interfaces/addin-client-ready-args.d.ts +39 -39
  43. package/src/addin/client-interfaces/addin-client-ready-args.js +2 -2
  44. package/src/addin/client-interfaces/addin-client-ready-button-config.d.ts +10 -10
  45. package/src/addin/client-interfaces/addin-client-ready-button-config.js +2 -2
  46. package/src/addin/client-interfaces/addin-client-show-confirm-args.d.ts +19 -19
  47. package/src/addin/client-interfaces/addin-client-show-confirm-args.js +2 -2
  48. package/src/addin/client-interfaces/addin-client-show-error-args.d.ts +18 -18
  49. package/src/addin/client-interfaces/addin-client-show-error-args.js +2 -2
  50. package/src/addin/client-interfaces/addin-client-show-flyout-args.d.ts +46 -46
  51. package/src/addin/client-interfaces/addin-client-show-flyout-args.js +2 -2
  52. package/src/addin/client-interfaces/addin-client-show-flyout-result.d.ts +9 -9
  53. package/src/addin/client-interfaces/addin-client-show-flyout-result.js +2 -2
  54. package/src/addin/client-interfaces/addin-client-show-modal-args.d.ts +14 -14
  55. package/src/addin/client-interfaces/addin-client-show-modal-args.js +2 -2
  56. package/src/addin/client-interfaces/addin-client-show-modal-result.d.ts +10 -10
  57. package/src/addin/client-interfaces/addin-client-show-modal-result.js +2 -2
  58. package/src/addin/client-interfaces/addin-client-show-toast-args.d.ts +15 -15
  59. package/src/addin/client-interfaces/addin-client-show-toast-args.js +2 -2
  60. package/src/addin/client-interfaces/addin-client-theme-settings.d.ts +13 -13
  61. package/src/addin/client-interfaces/addin-client-theme-settings.js +2 -2
  62. package/src/addin/client-interfaces/addin-confirm-button-style.d.ts +8 -8
  63. package/src/addin/client-interfaces/addin-confirm-button-style.js +16 -16
  64. package/src/addin/client-interfaces/addin-confirm-button.d.ts +26 -26
  65. package/src/addin/client-interfaces/addin-confirm-button.js +2 -2
  66. package/src/addin/client-interfaces/addin-modal-config.d.ts +12 -12
  67. package/src/addin/client-interfaces/addin-modal-config.js +2 -2
  68. package/src/addin/client-interfaces/addin-tab-config.d.ts +9 -9
  69. package/src/addin/client-interfaces/addin-tab-config.js +2 -2
  70. package/src/addin/client-interfaces/addin-tab-summary-style.d.ts +4 -4
  71. package/src/addin/client-interfaces/addin-tab-summary-style.js +13 -13
  72. package/src/addin/client-interfaces/addin-tile-config.d.ts +32 -32
  73. package/src/addin/client-interfaces/addin-tile-config.js +2 -2
  74. package/src/addin/client-interfaces/addin-tile-summary-style.d.ts +5 -5
  75. package/src/addin/client-interfaces/addin-tile-summary-style.js +15 -15
  76. package/src/addin/client-interfaces/addin-toast-style.d.ts +6 -6
  77. package/src/addin/client-interfaces/addin-toast-style.js +17 -17
  78. package/src/addin/client-interfaces/index.d.ts +27 -27
  79. package/src/addin/client-interfaces/index.js +43 -43
  80. package/src/addin/host-interfaces/addin-host-message-event-data.d.ts +23 -23
  81. package/src/addin/host-interfaces/addin-host-message-event-data.js +2 -2
  82. package/src/addin/host-interfaces/addin-host-message.d.ts +44 -44
  83. package/src/addin/host-interfaces/addin-host-message.js +2 -2
  84. package/src/addin/host-interfaces/index.d.ts +2 -2
  85. package/src/addin/host-interfaces/index.js +18 -18
  86. package/src/addin/index.d.ts +3 -3
  87. package/src/addin/index.js +19 -19
@@ -14,1067 +14,1130 @@ return /******/ (() => { // webpackBootstrap
14
14
  /* 0 */
15
15
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
16
16
 
17
-
18
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
19
- if (k2 === undefined) k2 = k;
20
- var desc = Object.getOwnPropertyDescriptor(m, k);
21
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
22
- desc = { enumerable: true, get: function() { return m[k]; } };
23
- }
24
- Object.defineProperty(o, k2, desc);
25
- }) : (function(o, m, k, k2) {
26
- if (k2 === undefined) k2 = k;
27
- o[k2] = m[k];
28
- }));
29
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
30
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
31
- };
32
- Object.defineProperty(exports, "__esModule", ({ value: true }));
33
- __exportStar(__webpack_require__(1), exports);
17
+
18
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
19
+ if (k2 === undefined) k2 = k;
20
+ var desc = Object.getOwnPropertyDescriptor(m, k);
21
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
22
+ desc = { enumerable: true, get: function() { return m[k]; } };
23
+ }
24
+ Object.defineProperty(o, k2, desc);
25
+ }) : (function(o, m, k, k2) {
26
+ if (k2 === undefined) k2 = k;
27
+ o[k2] = m[k];
28
+ }));
29
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
30
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
31
+ };
32
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
33
+ __exportStar(__webpack_require__(1), exports);
34
34
 
35
35
 
36
36
  /***/ }),
37
37
  /* 1 */
38
38
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
39
39
 
40
-
41
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
42
- if (k2 === undefined) k2 = k;
43
- var desc = Object.getOwnPropertyDescriptor(m, k);
44
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
45
- desc = { enumerable: true, get: function() { return m[k]; } };
46
- }
47
- Object.defineProperty(o, k2, desc);
48
- }) : (function(o, m, k, k2) {
49
- if (k2 === undefined) k2 = k;
50
- o[k2] = m[k];
51
- }));
52
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
53
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
54
- };
55
- Object.defineProperty(exports, "__esModule", ({ value: true }));
56
- __exportStar(__webpack_require__(2), exports);
57
- __exportStar(__webpack_require__(3), exports);
58
- __exportStar(__webpack_require__(31), exports);
40
+
41
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
42
+ if (k2 === undefined) k2 = k;
43
+ var desc = Object.getOwnPropertyDescriptor(m, k);
44
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
45
+ desc = { enumerable: true, get: function() { return m[k]; } };
46
+ }
47
+ Object.defineProperty(o, k2, desc);
48
+ }) : (function(o, m, k, k2) {
49
+ if (k2 === undefined) k2 = k;
50
+ o[k2] = m[k];
51
+ }));
52
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
53
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
54
+ };
55
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
56
+ __exportStar(__webpack_require__(2), exports);
57
+ __exportStar(__webpack_require__(3), exports);
58
+ __exportStar(__webpack_require__(31), exports);
59
59
 
60
60
 
61
61
  /***/ }),
62
62
  /* 2 */
63
63
  /***/ ((__unused_webpack_module, exports) => {
64
64
 
65
-
66
- Object.defineProperty(exports, "__esModule", ({ value: true }));
67
- exports.AddinClient = void 0;
68
- /**
69
- * Collection of regexs for our whitelist of host origins.
70
- */
71
- var allowedOrigins = [
72
- /^https\:\/\/[\w\-\.]+\.blackbaud\.com$/,
73
- /^https\:\/\/[\w\-\.]+\.blackbaud\-dev\.com$/,
74
- /^http\:\/\/[\w\-\.]+\.blackbaud\-dev\.com$/,
75
- /^https\:\/\/[\w\-\.]+\.blackbaudhosting\.com$/,
76
- /^https\:\/\/[\w\-\.]+\.bbcloudservices\.com$/,
77
- /^https\:\/\/localhost(\:[0-9]+)?$/,
78
- /^https\:\/\/secure[2|3|8]\.convio\.net$/,
79
- /^https\:\/\/testweb\.convio\.com$/,
80
- /^https\:\/\/[\w\-\.]+\.conviocloud\.com$/,
81
- /^https\:\/\/[\w\-\.]+\.blackbaudcloud\.com$/,
82
- /^https\:\/\/[\w\-\.]+\.blackbaudfaith\.com$/,
83
- /^https\:\/\/[\w\-\.]+\.blackbaudportal\.com$/,
84
- /^https\:\/\/[\w\-\.]+\.bbk12\.com$/,
85
- /^https\:\/\/[\w\-\.]+\.mycampus\-app\.com$/,
86
- /^https\:\/\/[\w\-\.]+\.myschoolapp\.com$/,
87
- /^https\:\/\/[\w\-\.]+\.myschoolautomation\.com$/,
88
- /^https\:\/\/[\w\-\.]+\.myschooldemo\.com$/,
89
- /^https\:\/\/[\w\-\.]+\.myschooltraining\.com$/
90
- ];
91
- /**
92
- * Client for interacting with the parent page hosting the add-in.
93
- */
94
- var AddinClient = /** @class */ (function () {
95
- function AddinClient(args) {
96
- var _this = this;
97
- this.args = args;
98
- /**
99
- * Tracks pending request to reeceive an auth-token from the host.
100
- */
101
- this.authTokenRequests = [];
102
- /**
103
- * Counter to provide unique ids for each auth token request.
104
- */
105
- this.lastAuthTokenRequestId = 0;
106
- /**
107
- * Tracks modal add-ins that have been launched from this add-in.
108
- */
109
- this.modalRequests = [];
110
- /**
111
- * Counter to provide unique ids for each modal request.
112
- */
113
- this.lastModalRequestId = 0;
114
- /**
115
- * Stores the registered add-in events.
116
- * Key - the event type.
117
- * Value - The callback function to be executed when the event type occurs.
118
- */
119
- this.registeredAddinEvents = {};
120
- /**
121
- * Stores the add-in events that have been sent to the host page.
122
- * Key - the event request ID.
123
- * Value - The Promise resolve function to be executed when the event is received by the host.
124
- */
125
- this.sentEvents = {};
126
- /**
127
- * Stores the pending add-in events that are queued to be sent to the host page after 200
128
- * milliseconds have expired.
129
- * Key - the event type.
130
- * Value - The Promise reject function to be executed if the event fails to be sent to the host page.
131
- */
132
- this.pendingSentEvents = {};
133
- /**
134
- * The event request ID counter.
135
- * The ID is incremented and assigned to each event that is sent.
136
- */
137
- this.eventRequestId = 0;
138
- /**
139
- * An array of event types that are supported by the host page.
140
- * The add-in client will throw an error if an event is attempted but not one the supported types.
141
- */
142
- this.supportedEventTypes = [];
143
- this.windowMessageHandler = function (event) {
144
- _this.handleMessage(event);
145
- };
146
- // Listen to messages from the host page.
147
- window.addEventListener('message', this.windowMessageHandler);
148
- // Inform the host page that the add-in is loaded and listening for messages.
149
- this.raiseAddinReadyMessage();
150
- }
151
- /* istanbul ignore next */
152
- /**
153
- * @returns {string} Returns the current query string path for the window, prefixed with ?.
154
- */
155
- AddinClient.getQueryString = function () {
156
- return window.location.search;
157
- };
158
- /**
159
- * Cleans up the AddinClient, releasing all resources.
160
- */
161
- AddinClient.prototype.destroy = function () {
162
- window.removeEventListener('message', this.windowMessageHandler);
163
- if (this.heightChangeIntervalId) {
164
- clearInterval(this.heightChangeIntervalId);
165
- }
166
- };
167
- /**
168
- * Requests the host page to navigate.
169
- * @param args Arguments describing the navigation request.
170
- */
171
- AddinClient.prototype.navigate = function (args) {
172
- this.postMessageToHostPage({
173
- message: {
174
- url: args.url
175
- },
176
- messageType: 'navigate'
177
- });
178
- };
179
- /**
180
- * Requests an authentication token for the current user.
181
- * @deprecated Use getUserIdentityToken() instead.
182
- * @returns {Promise<any>} Returns a promise which will resolve with the token value.
183
- */
184
- AddinClient.prototype.getAuthToken = function () {
185
- return this.getUserIdentityToken();
186
- };
187
- /**
188
- * Requests a user identity token for the current user.
189
- * @returns {Promise<any>} Returns a promise which will resolve with the token value.
190
- */
191
- AddinClient.prototype.getUserIdentityToken = function () {
192
- var _this = this;
193
- return new Promise(function (resolve, reject) {
194
- var authTokenRequestId = ++_this.lastAuthTokenRequestId;
195
- _this.authTokenRequests[authTokenRequestId] = {
196
- reject: reject,
197
- resolve: resolve
198
- };
199
- _this.postMessageToHostPage({
200
- message: {
201
- authTokenRequestId: authTokenRequestId
202
- },
203
- messageType: 'get-auth-token'
204
- });
205
- });
206
- };
207
- /**
208
- * Requests the host page to launch a modal add-in.
209
- * @param args Arguments for launching the modal.
210
- * @returns {Promise<any>} Returns a promise that will be resolved when the modal add-in is closed.
211
- * Promise will resolve with context data passed by from the modal add-in's closeModal call.
212
- */
213
- AddinClient.prototype.showModal = function (args) {
214
- var _this = this;
215
- return {
216
- modalClosed: new Promise(function (resolve, reject) {
217
- var modalRequestId = ++_this.lastModalRequestId;
218
- _this.modalRequests[modalRequestId] = {
219
- reject: reject,
220
- resolve: resolve
221
- };
222
- _this.postMessageToHostPage({
223
- message: {
224
- args: args,
225
- modalRequestId: modalRequestId
226
- },
227
- messageType: 'show-modal'
228
- });
229
- })
230
- };
231
- };
232
- /**
233
- * Informs the host to close this modal add-in.
234
- * Should only be used from within the modal add-in and not the parent add-in.
235
- * @param args Arguments to provide a context object back to the parent add-in.
236
- */
237
- AddinClient.prototype.closeModal = function (args) {
238
- this.postMessageToHostPage({
239
- message: args,
240
- messageType: 'close-modal'
241
- });
242
- };
243
- /**
244
- * Informs the host to open the help tab with the specified help key.
245
- * @param args Arguments for launching the help tab.
246
- */
247
- AddinClient.prototype.openHelp = function (args) {
248
- this.postMessageToHostPage({
249
- message: {
250
- helpKey: args.helpKey
251
- },
252
- messageType: 'open-help'
253
- });
254
- };
255
- /**
256
- * Informs the host to show a toast message.
257
- * @param args Arguments for showing a toast.
258
- */
259
- AddinClient.prototype.showToast = function (args) {
260
- this.postMessageToHostPage({
261
- message: args,
262
- messageType: 'show-toast'
263
- });
264
- };
265
- /**
266
- * Requests the host page to launch a flyout add-in.
267
- * @param args Arguments for launching the flyout.
268
- * @returns {Promise<any>} Returns a promise that will be resolved when the flyout add-in is closed.
269
- */
270
- AddinClient.prototype.showFlyout = function (args) {
271
- var _this = this;
272
- return {
273
- flyoutClosed: new Promise(function (resolve, reject) {
274
- // host page will apply default values when not provided
275
- args.defaultWidth = args.defaultWidth;
276
- args.maxWidth = args.maxWidth;
277
- args.minWidth = args.minWidth;
278
- _this.flyoutRequest = {
279
- reject: reject,
280
- resolve: resolve
281
- };
282
- _this.postMessageToHostPage({
283
- message: args,
284
- messageType: 'show-flyout'
285
- });
286
- })
287
- };
288
- };
289
- /**
290
- * Requests the host page to close the flyout add-in.
291
- */
292
- AddinClient.prototype.closeFlyout = function () {
293
- this.postMessageToHostPage({
294
- messageType: 'close-flyout'
295
- });
296
- };
297
- /**
298
- * Requests the host page to show a confirm dialog.
299
- * @param args Arguments for showing a confirm dialog.
300
- * @returns {Promise<string>} Returns a promise that will resolve with the
301
- * confirm action when the dialog is closed.
302
- */
303
- AddinClient.prototype.showConfirm = function (args) {
304
- var _this = this;
305
- return new Promise(function (resolve, reject) {
306
- _this.confirmRequest = {
307
- reject: reject,
308
- resolve: resolve
309
- };
310
- _this.postMessageToHostPage({
311
- message: args,
312
- messageType: 'show-confirm'
313
- });
314
- });
315
- };
316
- /**
317
- * Informs the host to show an error dialog.
318
- * @param args Arguments for showing an error dialog.
319
- */
320
- AddinClient.prototype.showError = function (args) {
321
- this.postMessageToHostPage({
322
- message: args,
323
- messageType: 'show-error'
324
- });
325
- };
326
- /**
327
- * Requests the host page to show the page blocking wait indicator.
328
- */
329
- AddinClient.prototype.showWait = function () {
330
- this.postMessageToHostPage({
331
- messageType: 'show-wait'
332
- });
333
- };
334
- /**
335
- * Requests the host page to hide the page blocking wait indicator.
336
- */
337
- AddinClient.prototype.hideWait = function () {
338
- this.postMessageToHostPage({
339
- messageType: 'hide-wait'
340
- });
341
- };
342
- /**
343
- * Registers a callback to be executed when the specified event type occurs.
344
- * @param eventType The event type to process.
345
- * @param callback The callback to execute when the event occurs.
346
- */
347
- AddinClient.prototype.addEventHandler = function (eventType, callback) {
348
- this.registeredAddinEvents[eventType] = callback;
349
- };
350
- /**
351
- * Sends an event to be handled by the host page.
352
- * @returns {Promise<void>} Returns a Promise which will resolve when the add-in host page receives the message, or
353
- * rejects if a subsequent event occurs, for the same event type, within 200 milliseconds.
354
- * The Promise also rejects if an event type is not one of the supported types from the host page.
355
- * @see AddinClientInitArgs#supportedEventTypes
356
- */
357
- AddinClient.prototype.sendEvent = function (args) {
358
- var _this = this;
359
- return new Promise(function (resolve, reject) {
360
- var eventType = args.type;
361
- if (!_this.supportedEventTypes.includes(eventType)) {
362
- reject('Event type not supported');
363
- }
364
- var pendingEvent = _this.pendingSentEvents[eventType];
365
- if (pendingEvent) {
366
- // cancel and reject pending event
367
- clearTimeout(pendingEvent.timeoutId);
368
- pendingEvent.reject('Event cancelled');
369
- }
370
- var timeoutId = setTimeout(function () {
371
- delete _this.pendingSentEvents[eventType];
372
- _this.postMessageToHostPage({
373
- message: {
374
- event: args,
375
- eventRequestId: _this.eventRequestId
376
- },
377
- messageType: 'client-event'
378
- });
379
- _this.sentEvents[_this.eventRequestId] = resolve;
380
- _this.eventRequestId++;
381
- }, 200);
382
- _this.pendingSentEvents[eventType] = {
383
- reject: reject,
384
- timeoutId: timeoutId
385
- };
386
- });
387
- };
388
- /**
389
- * Post a message to the host page informing it that the add-in is
390
- * now started and listening for messages from the host.
391
- */
392
- AddinClient.prototype.raiseAddinReadyMessage = function () {
393
- // No sensitive data should be provided with this message! This is the initial
394
- // message posted to the host page to establish whether the host origin is a
395
- // trusted origin and therefore will post to any host, trusted or untrusted.
396
- // The host should respond with a host-ready message which will include the origin
397
- // and will be validated against a whitelist of allowed origins so that subsequent
398
- // messages can be posted only to that trusted origin.
399
- this.postMessageToHostPage({
400
- messageType: 'ready'
401
- }, '*');
402
- };
403
- /**
404
- * Handles the modal-closed message from the host.
405
- * This is emitted to add-ins which have previously launched a modal, which is now
406
- * closing.
407
- * @param message The message data, which includes a context object from the closing modal, which should be passed
408
- * to the calling modal in the showModal promise.
409
- */
410
- AddinClient.prototype.handleModalClosedMessage = function (message) {
411
- var modalRequests = this.modalRequests;
412
- var modalRequestId = message.modalRequestId;
413
- var modalRequest = modalRequests[modalRequestId];
414
- modalRequest.resolve(message.context);
415
- modalRequests[modalRequestId] = undefined;
416
- };
417
- /**
418
- * Handles host message responses to a get-auth-token request.
419
- * @param data The message.
420
- */
421
- AddinClient.prototype.handleAuthTokenMessage = function (data) {
422
- var authTokenRequests = this.authTokenRequests;
423
- var authTokenRequestId = data.message.authTokenRequestId;
424
- var authTokenRequest = authTokenRequests[authTokenRequestId];
425
- /* tslint:disable-next-line switch-default */
426
- switch (data.messageType) {
427
- case 'auth-token':
428
- var authToken = data.message.authToken;
429
- authTokenRequest.resolve(authToken);
430
- break;
431
- case 'auth-token-fail':
432
- authTokenRequest.reject(data.message.reason);
433
- break;
434
- }
435
- authTokenRequests[authTokenRequestId] = undefined;
436
- };
437
- /**
438
- * Handles message events received from the add-in host page.
439
- * @param event The event posted from the host.
440
- */
441
- AddinClient.prototype.handleMessage = function (event) {
442
- var _this = this;
443
- var data = event.data;
444
- if (data && data.source === 'bb-addin-host') {
445
- if (data.messageType === 'host-ready') {
446
- // The 'host-ready' message is the only message that's not validated against
447
- // the host origin since that is what's being established in the message.
448
- // This MUST be the first message posted by the host page or all further
449
- // communications with the host page will be blocked.
450
- this.setKnownAllowedHostOrigin(event.origin);
451
- this.trackHeightChangesOfAddinContent();
452
- // set the supported event types
453
- this.supportedEventTypes = data.message.supportedEventTypes;
454
- // Pass key data to the add-in for it to initiailze.
455
- this.args.callbacks.init({
456
- context: data.message.context,
457
- envId: data.message.envId,
458
- ready: function (args) {
459
- // Do an immediate height check since the add-in may render something
460
- // due to the context provided. No need to wait a full second to reflect.
461
- _this.checkForHeightChangesOfAddinContent();
462
- _this.postMessageToHostPage({
463
- message: args,
464
- messageType: 'addin-ready'
465
- });
466
- },
467
- supportedEventTypes: data.message.supportedEventTypes,
468
- themeSettings: data.message.themeSettings
469
- });
470
- }
471
- else if (this.isFromValidOrigin(event)) {
472
- /* tslint:disable-next-line switch-default */
473
- switch (data.messageType) {
474
- case 'auth-token':
475
- case 'auth-token-fail':
476
- this.handleAuthTokenMessage(data);
477
- break;
478
- case 'modal-closed':
479
- this.handleModalClosedMessage(data.message);
480
- break;
481
- case 'button-click':
482
- if (this.args.callbacks.buttonClick) {
483
- this.args.callbacks.buttonClick();
484
- }
485
- break;
486
- case 'update-context':
487
- if (this.args.callbacks.updateContext) {
488
- this.args.callbacks.updateContext(data.message);
489
- }
490
- break;
491
- case 'confirm-closed':
492
- if (this.confirmRequest) {
493
- this.confirmRequest.resolve(data.message.reason);
494
- this.confirmRequest = undefined;
495
- }
496
- break;
497
- case 'flyout-closed':
498
- if (this.flyoutRequest) {
499
- this.flyoutRequest.resolve();
500
- this.flyoutRequest = undefined;
501
- }
502
- break;
503
- case 'flyout-next-click':
504
- if (this.args.callbacks.flyoutNextClick) {
505
- this.args.callbacks.flyoutNextClick();
506
- }
507
- break;
508
- case 'flyout-previous-click':
509
- if (this.args.callbacks.flyoutPreviousClick) {
510
- this.args.callbacks.flyoutPreviousClick();
511
- }
512
- break;
513
- // TODO remove support for this message type when help support is removed in next major release
514
- case 'help-click':
515
- if (this.args.callbacks.helpClick) {
516
- this.args.callbacks.helpClick();
517
- }
518
- break;
519
- case 'settings-click':
520
- if (this.args.callbacks.settingsClick) {
521
- this.args.callbacks.settingsClick();
522
- }
523
- break;
524
- case 'theme-change':
525
- if (this.args.callbacks.themeChange) {
526
- this.args.callbacks.themeChange(data.message.themeSettings);
527
- }
528
- break;
529
- case 'host-event':
530
- this.processHostEvent(data.message);
531
- break;
532
- case 'event-received':
533
- this.resolveClientEvent(data.message);
534
- break;
535
- }
536
- }
537
- else {
538
- this.warnInvalidOrigin();
539
- }
540
- }
541
- };
542
- /**
543
- * Validates and registers a value as the origin of the parent page hosting the add-in.
544
- * If the provided origin matches against our trusted whitelist, then it will be saved.
545
- * Post messages will implicitly go to this origin and received messages will be filtered
546
- * to just messages from this origin.
547
- * @param hostOrigin
548
- */
549
- AddinClient.prototype.setKnownAllowedHostOrigin = function (hostOrigin) {
550
- for (var _i = 0, allowedOrigins_1 = allowedOrigins; _i < allowedOrigins_1.length; _i++) {
551
- var allowedOrigin = allowedOrigins_1[_i];
552
- if (allowedOrigin.test(hostOrigin)) {
553
- this.trustedOrigin = hostOrigin;
554
- return;
555
- }
556
- }
557
- };
558
- /**
559
- * Checks if the height of the iFrame has changed since it was last
560
- * posted to the host page (or if it hasn't been posted yet) and initiates
561
- * a new post if so.
562
- */
563
- AddinClient.prototype.checkForHeightChangesOfAddinContent = function () {
564
- // after some discussion and experimentation, using offsetHeight appears to be sufficient
565
- var newHeight = document.documentElement.offsetHeight;
566
- if (newHeight !== this.lastPostedIframeHeight) {
567
- this.lastPostedIframeHeight = newHeight;
568
- this.postMessageToHostPage({
569
- message: {
570
- height: newHeight + 'px'
571
- },
572
- messageType: 'height-change'
573
- });
574
- }
575
- };
576
- /**
577
- * Starts a timeout interval to watch for height changes
578
- * of the iframe content.
579
- */
580
- AddinClient.prototype.trackHeightChangesOfAddinContent = function () {
581
- var _this = this;
582
- this.heightChangeIntervalId = setInterval(function () {
583
- _this.checkForHeightChangesOfAddinContent();
584
- }, 1000);
585
- };
586
- /**
587
- * Posts a message to the parent window.
588
- * @param message The message content to post.
589
- * @param targetOrigin Optional. If provided, then the message will be posted to this origin.
590
- * If not, then it will post to the pre-determined host page origin.
591
- */
592
- AddinClient.prototype.postMessageToHostPage = function (message, targetOrigin) {
593
- message.source = 'bb-addin-client';
594
- message.addinId = this.getQueryVariable('addinId');
595
- targetOrigin = targetOrigin || this.trustedOrigin;
596
- if (targetOrigin) {
597
- window.parent.postMessage(message, targetOrigin);
598
- }
599
- else {
600
- this.warnInvalidOrigin();
601
- }
602
- };
603
- /**
604
- * Processes an add-in event that occurs from the host and responds
605
- * back to the host with an 'event-received' message.
606
- * @param message The message to process by looking up executing the registered callback
607
- * that matches the event type.
608
- */
609
- AddinClient.prototype.processHostEvent = function (message) {
610
- var _this = this;
611
- var eventArgs = message.context;
612
- var callback = this.registeredAddinEvents[eventArgs.type];
613
- var promise;
614
- if (callback) {
615
- if (this.isBlockingEventType(eventArgs.type)) {
616
- promise = new Promise(function (resolve) {
617
- callback(eventArgs.context, function () {
618
- resolve();
619
- });
620
- });
621
- }
622
- else {
623
- promise = new Promise(function (resolve) {
624
- callback(eventArgs.context);
625
- resolve();
626
- });
627
- }
628
- }
629
- else {
630
- promise = Promise.resolve();
631
- }
632
- promise.then(function () { return _this.postEventReceivedMessage(message.eventRequestId); });
633
- };
634
- /**
635
- * Checks whether an event type is blocking and requires a response from the client
636
- * before responding to the host.
637
- * @param type The event type.
638
- */
639
- AddinClient.prototype.isBlockingEventType = function (type) {
640
- switch (type) {
641
- case 'form-save':
642
- case 'form-cancel':
643
- return true;
644
- default: break;
645
- }
646
- return false;
647
- };
648
- /**
649
- * Posts a message to the host page to indicate that a certain event has been received.
650
- * @param eventRequestId The ID of the event request that was received.
651
- */
652
- AddinClient.prototype.postEventReceivedMessage = function (eventRequestId) {
653
- this.postMessageToHostPage({
654
- message: {
655
- eventRequestId: eventRequestId
656
- },
657
- messageType: 'event-received'
658
- });
659
- };
660
- /**
661
- * Attemps to resolve the Promise for a client event that has been received by the host page.
662
- * @param message Message data that includes the ID of the event that was received.
663
- */
664
- AddinClient.prototype.resolveClientEvent = function (message) {
665
- var requestId = message.eventRequestId;
666
- var promiseResolve = this.sentEvents[requestId];
667
- if (promiseResolve) {
668
- promiseResolve();
669
- delete this.sentEvents[requestId];
670
- }
671
- };
672
- /**
673
- * Checks whether a MessageEvent is from the execetd host origin.
674
- * @param event
675
- */
676
- AddinClient.prototype.isFromValidOrigin = function (event) {
677
- return event.origin === this.trustedOrigin;
678
- };
679
- /**
680
- * Log that a message was received with an invalid origin.
681
- */
682
- AddinClient.prototype.warnInvalidOrigin = function () {
683
- console.warn('The origin is not trusted because the host-ready message has not been ' +
684
- 'sent or because the host origin is not a whitelisted origin.');
685
- };
686
- /**
687
- * Reads a query string value from the current window location.
688
- * @param variable Name of the query string parameter to ready.
689
- * @returns The value of the query string parameter.
690
- */
691
- AddinClient.prototype.getQueryVariable = function (variable) {
692
- var query = AddinClient.getQueryString().substring(1);
693
- var vars = query.split('&');
694
- for (var _i = 0, vars_1 = vars; _i < vars_1.length; _i++) {
695
- var v = vars_1[_i];
696
- var pair = v.split('=');
697
- if (decodeURIComponent(pair[0]) === variable) {
698
- return decodeURIComponent(pair[1]);
699
- }
700
- }
701
- };
702
- return AddinClient;
703
- }());
704
- exports.AddinClient = AddinClient;
65
+
66
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
67
+ exports.AddinClient = void 0;
68
+ /**
69
+ * Collection of regexs for our whitelist of host origins.
70
+ */
71
+ var allowedOrigins = [
72
+ /^https\:\/\/[\w\-\.]+\.blackbaud\.com$/,
73
+ /^https\:\/\/[\w\-\.]+\.blackbaud\-dev\.com$/,
74
+ /^http\:\/\/[\w\-\.]+\.blackbaud\-dev\.com$/,
75
+ /^https\:\/\/[\w\-\.]+\.blackbaudhosting\.com$/,
76
+ /^https\:\/\/[\w\-\.]+\.bbcloudservices\.com$/,
77
+ /^https\:\/\/localhost(\:[0-9]+)?$/,
78
+ /^https\:\/\/secure[2|3|8]\.convio\.net$/,
79
+ /^https\:\/\/testweb\.convio\.com$/,
80
+ /^https\:\/\/[\w\-\.]+\.conviocloud\.com$/,
81
+ /^https\:\/\/[\w\-\.]+\.blackbaudcloud\.com$/,
82
+ /^https\:\/\/[\w\-\.]+\.blackbaudfaith\.com$/,
83
+ /^https\:\/\/[\w\-\.]+\.blackbaudportal\.com$/,
84
+ /^https\:\/\/[\w\-\.]+\.bbk12\.com$/,
85
+ /^https\:\/\/[\w\-\.]+\.mycampus\-app\.com$/,
86
+ /^https\:\/\/[\w\-\.]+\.myschoolapp\.com$/,
87
+ /^https\:\/\/[\w\-\.]+\.myschoolautomation\.com$/,
88
+ /^https\:\/\/[\w\-\.]+\.myschooldemo\.com$/,
89
+ /^https\:\/\/[\w\-\.]+\.myschooltraining\.com$/,
90
+ /^https\:\/\/[\w\-\.]+\.blackbaudwp\.com$/,
91
+ /^https\:\/\/[\w\-\.]+\.carrytheload\.org$/,
92
+ /^https\:\/\/[\w\-\.]+\.ummsfoundation\.org$/,
93
+ /^http\:\/\/[\w\-\.]+\.lcrf\.org$/,
94
+ /^https\:\/\/[\w\-\.]+\.go2\.org$/,
95
+ /^https\:\/\/[\w\-\.]+\.nationwidechildrens\.org$/,
96
+ /^https\:\/\/[\w\-\.]+\.lupus\.org$/,
97
+ /^https\:\/\/[\w\-\.]+\.operationsmile\.ca$/,
98
+ /^https\:\/\/[\w\-\.]+\.convio\.net$/,
99
+ /^https\:\/\/[\w\-\.]+\.ontariospca\.ca$/,
100
+ /^https\:\/\/[\w\-\.]+\.brighamandwomens\.org$/,
101
+ /^https\:\/\/[\w\-\.]+\.northernlighthealth\.org$/,
102
+ /^http\:\/\/[\w\-\.]+\.convio\.net$/,
103
+ /^https\:\/\/[\w\-\.]+\.alpha1\.org$/,
104
+ /^https\:\/\/[\w\-\.]+\.pscpartners\.org$/,
105
+ /^https\:\/\/[\w\-\.]+\.mercyforanimals\.org$/,
106
+ /^https\:\/\/[\w\-\.]+\.braintumor\.org$/,
107
+ /^https\:\/\/[\w\-\.]+\.cancer\.ca$/,
108
+ /^https\:\/\/[\w\-\.]+\.phoenixchildrensfoundation\.org$/,
109
+ /^https\:\/\/[\w\-\.]+\.ocmc\.org$/,
110
+ /^https\:\/\/[\w\-\.]+\.stlouischildrens\.org$/,
111
+ /^https\:\/\/[\w\-\.]+\.choa\.org$/,
112
+ /^https\:\/\/[\w\-\.]+\.acsevents\.org$/,
113
+ /^https\:\/\/[\w\-\.]+\.operationsmile\.org$/,
114
+ /^https\:\/\/[\w\-\.]+\.mdmercy\.com$/,
115
+ /^https\:\/\/[\w\-\.]+\.cookchildrens\.org$/,
116
+ /^https\:\/\/[\w\-\.]+\.chla\.org$/,
117
+ /^https\:\/\/[\w\-\.]+\.nleomf\.org$/,
118
+ /^https\:\/\/[\w\-\.]+\.pwatoronto\.org$/,
119
+ /^https\:\/\/[\w\-\.]+\.jfsla\.org$/,
120
+ /^https\:\/\/[\w\-\.]+\.roswellpark\.org$/,
121
+ /^https\:\/\/[\w\-\.]+\.alsagoldenwest\.org$/,
122
+ /^https\:\/\/[\w\-\.]+\.cancercarefoundation\.ca$/,
123
+ /^https\:\/\/[\w\-\.]+\.alsnc\.org$/,
124
+ /^https\:\/\/[\w\-\.]+\.alsanm\.org$/,
125
+ /^https\:\/\/[\w\-\.]+\.waysidewaifs\.org$/,
126
+ /^https\:\/\/[\w\-\.]+\.bladdercancercanada\.org$/,
127
+ /^https\:\/\/[\w\-\.]+\.jimmyfund\.org$/,
128
+ /^https\:\/\/[\w\-\.]+\.info\-komen\.org$/,
129
+ /^https\:\/\/[\w\-\.]+\.mountsinai\.org$/,
130
+ /^https\:\/\/[\w\-\.]+\.walkforpd\.ca$/,
131
+ /^https\:\/\/[\w\-\.]+\.alsoregon\.org$/,
132
+ /^https\:\/\/[\w\-\.]+\.feedhopenow\.org$/,
133
+ /^https\:\/\/[\w\-\.]+\.trilliumgiving\.ca$/,
134
+ /^https\:\/\/[\w\-\.]+\.swimacrossamerica\.org$/,
135
+ /^https\:\/\/ovariancanada\.org$/,
136
+ /^https\:\/\/[\w\-\.]+\.ovariancanada\.org$/,
137
+ /^https\:\/\/[\w\-\.]+\.alsunitedchicago\.org$/,
138
+ /^https\:\/\/[\w\-\.]+\.fredhutch\.org$/,
139
+ /^https\:\/\/[\w\-\.]+\.hss\.edu$/,
140
+ /^https\:\/\/[\w\-\.]+\.nyghfoundation\.ca$/,
141
+ /^https\:\/\/[\w\-\.]+\.natureconservancy\.ca$/,
142
+ /^https\:\/\/[\w\-\.]+\.llscanada\.org$/,
143
+ /^https\:\/\/[\w\-\.]+\.als\-ny\.org$/,
144
+ /^https\:\/\/[\w\-\.]+\.zerocancer\.org$/,
145
+ /^https\:\/\/[\w\-\.]+\.alsmidatlantic\.org$/,
146
+ /^https\:\/\/[\w\-\.]+\.habitat\.ca$/,
147
+ /^https\:\/\/[\w\-\.]+\.stamfordhospitalfoundation\.org$/,
148
+ /^https\:\/\/[\w\-\.]+\.alsohio\.org$/,
149
+ /^https\:\/\/[\w\-\.]+\.cancercarefdn\.mb\.ca$/,
150
+ /^https\:\/\/[\w\-\.]+\.baycrestfoundation\.org$/,
151
+ /^https\:\/\/[\w\-\.]+\.southlake\.ca$/,
152
+ /^https\:\/\/[\w\-\.]+\.parkinson\.ca$/,
153
+ ];
154
+ /**
155
+ * Client for interacting with the parent page hosting the add-in.
156
+ */
157
+ var AddinClient = /** @class */ (function () {
158
+ function AddinClient(args) {
159
+ var _this = this;
160
+ this.args = args;
161
+ /**
162
+ * Tracks pending request to reeceive an auth-token from the host.
163
+ */
164
+ this.authTokenRequests = [];
165
+ /**
166
+ * Counter to provide unique ids for each auth token request.
167
+ */
168
+ this.lastAuthTokenRequestId = 0;
169
+ /**
170
+ * Tracks modal add-ins that have been launched from this add-in.
171
+ */
172
+ this.modalRequests = [];
173
+ /**
174
+ * Counter to provide unique ids for each modal request.
175
+ */
176
+ this.lastModalRequestId = 0;
177
+ /**
178
+ * Stores the registered add-in events.
179
+ * Key - the event type.
180
+ * Value - The callback function to be executed when the event type occurs.
181
+ */
182
+ this.registeredAddinEvents = {};
183
+ /**
184
+ * Stores the add-in events that have been sent to the host page.
185
+ * Key - the event request ID.
186
+ * Value - The Promise resolve function to be executed when the event is received by the host.
187
+ */
188
+ this.sentEvents = {};
189
+ /**
190
+ * Stores the pending add-in events that are queued to be sent to the host page after 200
191
+ * milliseconds have expired.
192
+ * Key - the event type.
193
+ * Value - The Promise reject function to be executed if the event fails to be sent to the host page.
194
+ */
195
+ this.pendingSentEvents = {};
196
+ /**
197
+ * The event request ID counter.
198
+ * The ID is incremented and assigned to each event that is sent.
199
+ */
200
+ this.eventRequestId = 0;
201
+ /**
202
+ * An array of event types that are supported by the host page.
203
+ * The add-in client will throw an error if an event is attempted but not one the supported types.
204
+ */
205
+ this.supportedEventTypes = [];
206
+ this.windowMessageHandler = function (event) {
207
+ _this.handleMessage(event);
208
+ };
209
+ // Listen to messages from the host page.
210
+ window.addEventListener('message', this.windowMessageHandler);
211
+ // Inform the host page that the add-in is loaded and listening for messages.
212
+ this.raiseAddinReadyMessage();
213
+ }
214
+ /* istanbul ignore next */
215
+ /**
216
+ * @returns {string} Returns the current query string path for the window, prefixed with ?.
217
+ */
218
+ AddinClient.getQueryString = function () {
219
+ return window.location.search;
220
+ };
221
+ /**
222
+ * Cleans up the AddinClient, releasing all resources.
223
+ */
224
+ AddinClient.prototype.destroy = function () {
225
+ window.removeEventListener('message', this.windowMessageHandler);
226
+ if (this.heightChangeIntervalId) {
227
+ clearInterval(this.heightChangeIntervalId);
228
+ }
229
+ };
230
+ /**
231
+ * Requests the host page to navigate.
232
+ * @param args Arguments describing the navigation request.
233
+ */
234
+ AddinClient.prototype.navigate = function (args) {
235
+ this.postMessageToHostPage({
236
+ message: {
237
+ url: args.url
238
+ },
239
+ messageType: 'navigate'
240
+ });
241
+ };
242
+ /**
243
+ * Requests an authentication token for the current user.
244
+ * @deprecated Use getUserIdentityToken() instead.
245
+ * @returns {Promise<any>} Returns a promise which will resolve with the token value.
246
+ */
247
+ AddinClient.prototype.getAuthToken = function () {
248
+ return this.getUserIdentityToken();
249
+ };
250
+ /**
251
+ * Requests a user identity token for the current user.
252
+ * @returns {Promise<any>} Returns a promise which will resolve with the token value.
253
+ */
254
+ AddinClient.prototype.getUserIdentityToken = function () {
255
+ var _this = this;
256
+ return new Promise(function (resolve, reject) {
257
+ var authTokenRequestId = ++_this.lastAuthTokenRequestId;
258
+ _this.authTokenRequests[authTokenRequestId] = {
259
+ reject: reject,
260
+ resolve: resolve
261
+ };
262
+ _this.postMessageToHostPage({
263
+ message: {
264
+ authTokenRequestId: authTokenRequestId
265
+ },
266
+ messageType: 'get-auth-token'
267
+ });
268
+ });
269
+ };
270
+ /**
271
+ * Requests the host page to launch a modal add-in.
272
+ * @param args Arguments for launching the modal.
273
+ * @returns {Promise<any>} Returns a promise that will be resolved when the modal add-in is closed.
274
+ * Promise will resolve with context data passed by from the modal add-in's closeModal call.
275
+ */
276
+ AddinClient.prototype.showModal = function (args) {
277
+ var _this = this;
278
+ return {
279
+ modalClosed: new Promise(function (resolve, reject) {
280
+ var modalRequestId = ++_this.lastModalRequestId;
281
+ _this.modalRequests[modalRequestId] = {
282
+ reject: reject,
283
+ resolve: resolve
284
+ };
285
+ _this.postMessageToHostPage({
286
+ message: {
287
+ args: args,
288
+ modalRequestId: modalRequestId
289
+ },
290
+ messageType: 'show-modal'
291
+ });
292
+ })
293
+ };
294
+ };
295
+ /**
296
+ * Informs the host to close this modal add-in.
297
+ * Should only be used from within the modal add-in and not the parent add-in.
298
+ * @param args Arguments to provide a context object back to the parent add-in.
299
+ */
300
+ AddinClient.prototype.closeModal = function (args) {
301
+ this.postMessageToHostPage({
302
+ message: args,
303
+ messageType: 'close-modal'
304
+ });
305
+ };
306
+ /**
307
+ * Informs the host to open the help tab with the specified help key.
308
+ * @param args Arguments for launching the help tab.
309
+ */
310
+ AddinClient.prototype.openHelp = function (args) {
311
+ this.postMessageToHostPage({
312
+ message: {
313
+ helpKey: args.helpKey
314
+ },
315
+ messageType: 'open-help'
316
+ });
317
+ };
318
+ /**
319
+ * Informs the host to show a toast message.
320
+ * @param args Arguments for showing a toast.
321
+ */
322
+ AddinClient.prototype.showToast = function (args) {
323
+ this.postMessageToHostPage({
324
+ message: args,
325
+ messageType: 'show-toast'
326
+ });
327
+ };
328
+ /**
329
+ * Requests the host page to launch a flyout add-in.
330
+ * @param args Arguments for launching the flyout.
331
+ * @returns {Promise<any>} Returns a promise that will be resolved when the flyout add-in is closed.
332
+ */
333
+ AddinClient.prototype.showFlyout = function (args) {
334
+ var _this = this;
335
+ return {
336
+ flyoutClosed: new Promise(function (resolve, reject) {
337
+ // host page will apply default values when not provided
338
+ args.defaultWidth = args.defaultWidth;
339
+ args.maxWidth = args.maxWidth;
340
+ args.minWidth = args.minWidth;
341
+ _this.flyoutRequest = {
342
+ reject: reject,
343
+ resolve: resolve
344
+ };
345
+ _this.postMessageToHostPage({
346
+ message: args,
347
+ messageType: 'show-flyout'
348
+ });
349
+ })
350
+ };
351
+ };
352
+ /**
353
+ * Requests the host page to close the flyout add-in.
354
+ */
355
+ AddinClient.prototype.closeFlyout = function () {
356
+ this.postMessageToHostPage({
357
+ messageType: 'close-flyout'
358
+ });
359
+ };
360
+ /**
361
+ * Requests the host page to show a confirm dialog.
362
+ * @param args Arguments for showing a confirm dialog.
363
+ * @returns {Promise<string>} Returns a promise that will resolve with the
364
+ * confirm action when the dialog is closed.
365
+ */
366
+ AddinClient.prototype.showConfirm = function (args) {
367
+ var _this = this;
368
+ return new Promise(function (resolve, reject) {
369
+ _this.confirmRequest = {
370
+ reject: reject,
371
+ resolve: resolve
372
+ };
373
+ _this.postMessageToHostPage({
374
+ message: args,
375
+ messageType: 'show-confirm'
376
+ });
377
+ });
378
+ };
379
+ /**
380
+ * Informs the host to show an error dialog.
381
+ * @param args Arguments for showing an error dialog.
382
+ */
383
+ AddinClient.prototype.showError = function (args) {
384
+ this.postMessageToHostPage({
385
+ message: args,
386
+ messageType: 'show-error'
387
+ });
388
+ };
389
+ /**
390
+ * Requests the host page to show the page blocking wait indicator.
391
+ */
392
+ AddinClient.prototype.showWait = function () {
393
+ this.postMessageToHostPage({
394
+ messageType: 'show-wait'
395
+ });
396
+ };
397
+ /**
398
+ * Requests the host page to hide the page blocking wait indicator.
399
+ */
400
+ AddinClient.prototype.hideWait = function () {
401
+ this.postMessageToHostPage({
402
+ messageType: 'hide-wait'
403
+ });
404
+ };
405
+ /**
406
+ * Registers a callback to be executed when the specified event type occurs.
407
+ * @param eventType The event type to process.
408
+ * @param callback The callback to execute when the event occurs.
409
+ */
410
+ AddinClient.prototype.addEventHandler = function (eventType, callback) {
411
+ this.registeredAddinEvents[eventType] = callback;
412
+ };
413
+ /**
414
+ * Sends an event to be handled by the host page.
415
+ * @returns {Promise<void>} Returns a Promise which will resolve when the add-in host page receives the message, or
416
+ * rejects if a subsequent event occurs, for the same event type, within 200 milliseconds.
417
+ * The Promise also rejects if an event type is not one of the supported types from the host page.
418
+ * @see AddinClientInitArgs#supportedEventTypes
419
+ */
420
+ AddinClient.prototype.sendEvent = function (args) {
421
+ var _this = this;
422
+ return new Promise(function (resolve, reject) {
423
+ var eventType = args.type;
424
+ if (!_this.supportedEventTypes.includes(eventType)) {
425
+ reject('Event type not supported');
426
+ }
427
+ var pendingEvent = _this.pendingSentEvents[eventType];
428
+ if (pendingEvent) {
429
+ // cancel and reject pending event
430
+ clearTimeout(pendingEvent.timeoutId);
431
+ pendingEvent.reject('Event cancelled');
432
+ }
433
+ var timeoutId = setTimeout(function () {
434
+ delete _this.pendingSentEvents[eventType];
435
+ _this.postMessageToHostPage({
436
+ message: {
437
+ event: args,
438
+ eventRequestId: _this.eventRequestId
439
+ },
440
+ messageType: 'client-event'
441
+ });
442
+ _this.sentEvents[_this.eventRequestId] = resolve;
443
+ _this.eventRequestId++;
444
+ }, 200);
445
+ _this.pendingSentEvents[eventType] = {
446
+ reject: reject,
447
+ timeoutId: timeoutId
448
+ };
449
+ });
450
+ };
451
+ /**
452
+ * Post a message to the host page informing it that the add-in is
453
+ * now started and listening for messages from the host.
454
+ */
455
+ AddinClient.prototype.raiseAddinReadyMessage = function () {
456
+ // No sensitive data should be provided with this message! This is the initial
457
+ // message posted to the host page to establish whether the host origin is a
458
+ // trusted origin and therefore will post to any host, trusted or untrusted.
459
+ // The host should respond with a host-ready message which will include the origin
460
+ // and will be validated against a whitelist of allowed origins so that subsequent
461
+ // messages can be posted only to that trusted origin.
462
+ this.postMessageToHostPage({
463
+ messageType: 'ready'
464
+ }, '*');
465
+ };
466
+ /**
467
+ * Handles the modal-closed message from the host.
468
+ * This is emitted to add-ins which have previously launched a modal, which is now
469
+ * closing.
470
+ * @param message The message data, which includes a context object from the closing modal, which should be passed
471
+ * to the calling modal in the showModal promise.
472
+ */
473
+ AddinClient.prototype.handleModalClosedMessage = function (message) {
474
+ var modalRequests = this.modalRequests;
475
+ var modalRequestId = message.modalRequestId;
476
+ var modalRequest = modalRequests[modalRequestId];
477
+ modalRequest.resolve(message.context);
478
+ modalRequests[modalRequestId] = undefined;
479
+ };
480
+ /**
481
+ * Handles host message responses to a get-auth-token request.
482
+ * @param data The message.
483
+ */
484
+ AddinClient.prototype.handleAuthTokenMessage = function (data) {
485
+ var authTokenRequests = this.authTokenRequests;
486
+ var authTokenRequestId = data.message.authTokenRequestId;
487
+ var authTokenRequest = authTokenRequests[authTokenRequestId];
488
+ /* tslint:disable-next-line switch-default */
489
+ switch (data.messageType) {
490
+ case 'auth-token':
491
+ var authToken = data.message.authToken;
492
+ authTokenRequest.resolve(authToken);
493
+ break;
494
+ case 'auth-token-fail':
495
+ authTokenRequest.reject(data.message.reason);
496
+ break;
497
+ }
498
+ authTokenRequests[authTokenRequestId] = undefined;
499
+ };
500
+ /**
501
+ * Handles message events received from the add-in host page.
502
+ * @param event The event posted from the host.
503
+ */
504
+ AddinClient.prototype.handleMessage = function (event) {
505
+ var _this = this;
506
+ var data = event.data;
507
+ if (data && data.source === 'bb-addin-host') {
508
+ if (data.messageType === 'host-ready') {
509
+ // The 'host-ready' message is the only message that's not validated against
510
+ // the host origin since that is what's being established in the message.
511
+ // This MUST be the first message posted by the host page or all further
512
+ // communications with the host page will be blocked.
513
+ this.setKnownAllowedHostOrigin(event.origin);
514
+ this.trackHeightChangesOfAddinContent();
515
+ // set the supported event types
516
+ this.supportedEventTypes = data.message.supportedEventTypes;
517
+ // Pass key data to the add-in for it to initiailze.
518
+ this.args.callbacks.init({
519
+ context: data.message.context,
520
+ envId: data.message.envId,
521
+ ready: function (args) {
522
+ // Do an immediate height check since the add-in may render something
523
+ // due to the context provided. No need to wait a full second to reflect.
524
+ _this.checkForHeightChangesOfAddinContent();
525
+ _this.postMessageToHostPage({
526
+ message: args,
527
+ messageType: 'addin-ready'
528
+ });
529
+ },
530
+ supportedEventTypes: data.message.supportedEventTypes,
531
+ themeSettings: data.message.themeSettings
532
+ });
533
+ }
534
+ else if (this.isFromValidOrigin(event)) {
535
+ /* tslint:disable-next-line switch-default */
536
+ switch (data.messageType) {
537
+ case 'auth-token':
538
+ case 'auth-token-fail':
539
+ this.handleAuthTokenMessage(data);
540
+ break;
541
+ case 'modal-closed':
542
+ this.handleModalClosedMessage(data.message);
543
+ break;
544
+ case 'button-click':
545
+ if (this.args.callbacks.buttonClick) {
546
+ this.args.callbacks.buttonClick();
547
+ }
548
+ break;
549
+ case 'update-context':
550
+ if (this.args.callbacks.updateContext) {
551
+ this.args.callbacks.updateContext(data.message);
552
+ }
553
+ break;
554
+ case 'confirm-closed':
555
+ if (this.confirmRequest) {
556
+ this.confirmRequest.resolve(data.message.reason);
557
+ this.confirmRequest = undefined;
558
+ }
559
+ break;
560
+ case 'flyout-closed':
561
+ if (this.flyoutRequest) {
562
+ this.flyoutRequest.resolve();
563
+ this.flyoutRequest = undefined;
564
+ }
565
+ break;
566
+ case 'flyout-next-click':
567
+ if (this.args.callbacks.flyoutNextClick) {
568
+ this.args.callbacks.flyoutNextClick();
569
+ }
570
+ break;
571
+ case 'flyout-previous-click':
572
+ if (this.args.callbacks.flyoutPreviousClick) {
573
+ this.args.callbacks.flyoutPreviousClick();
574
+ }
575
+ break;
576
+ // TODO remove support for this message type when help support is removed in next major release
577
+ case 'help-click':
578
+ if (this.args.callbacks.helpClick) {
579
+ this.args.callbacks.helpClick();
580
+ }
581
+ break;
582
+ case 'settings-click':
583
+ if (this.args.callbacks.settingsClick) {
584
+ this.args.callbacks.settingsClick();
585
+ }
586
+ break;
587
+ case 'theme-change':
588
+ if (this.args.callbacks.themeChange) {
589
+ this.args.callbacks.themeChange(data.message.themeSettings);
590
+ }
591
+ break;
592
+ case 'host-event':
593
+ this.processHostEvent(data.message);
594
+ break;
595
+ case 'event-received':
596
+ this.resolveClientEvent(data.message);
597
+ break;
598
+ }
599
+ }
600
+ else {
601
+ this.warnInvalidOrigin();
602
+ }
603
+ }
604
+ };
605
+ /**
606
+ * Validates and registers a value as the origin of the parent page hosting the add-in.
607
+ * If the provided origin matches against our trusted whitelist, then it will be saved.
608
+ * Post messages will implicitly go to this origin and received messages will be filtered
609
+ * to just messages from this origin.
610
+ * @param hostOrigin
611
+ */
612
+ AddinClient.prototype.setKnownAllowedHostOrigin = function (hostOrigin) {
613
+ for (var _i = 0, allowedOrigins_1 = allowedOrigins; _i < allowedOrigins_1.length; _i++) {
614
+ var allowedOrigin = allowedOrigins_1[_i];
615
+ if (allowedOrigin.test(hostOrigin)) {
616
+ this.trustedOrigin = hostOrigin;
617
+ return;
618
+ }
619
+ }
620
+ };
621
+ /**
622
+ * Checks if the height of the iFrame has changed since it was last
623
+ * posted to the host page (or if it hasn't been posted yet) and initiates
624
+ * a new post if so.
625
+ */
626
+ AddinClient.prototype.checkForHeightChangesOfAddinContent = function () {
627
+ // after some discussion and experimentation, using offsetHeight appears to be sufficient
628
+ var newHeight = document.documentElement.offsetHeight;
629
+ if (newHeight !== this.lastPostedIframeHeight) {
630
+ this.lastPostedIframeHeight = newHeight;
631
+ this.postMessageToHostPage({
632
+ message: {
633
+ height: newHeight + 'px'
634
+ },
635
+ messageType: 'height-change'
636
+ });
637
+ }
638
+ };
639
+ /**
640
+ * Starts a timeout interval to watch for height changes
641
+ * of the iframe content.
642
+ */
643
+ AddinClient.prototype.trackHeightChangesOfAddinContent = function () {
644
+ var _this = this;
645
+ this.heightChangeIntervalId = setInterval(function () {
646
+ _this.checkForHeightChangesOfAddinContent();
647
+ }, 1000);
648
+ };
649
+ /**
650
+ * Posts a message to the parent window.
651
+ * @param message The message content to post.
652
+ * @param targetOrigin Optional. If provided, then the message will be posted to this origin.
653
+ * If not, then it will post to the pre-determined host page origin.
654
+ */
655
+ AddinClient.prototype.postMessageToHostPage = function (message, targetOrigin) {
656
+ message.source = 'bb-addin-client';
657
+ message.addinId = this.getQueryVariable('addinId');
658
+ targetOrigin = targetOrigin || this.trustedOrigin;
659
+ if (targetOrigin) {
660
+ window.parent.postMessage(message, targetOrigin);
661
+ }
662
+ else {
663
+ this.warnInvalidOrigin();
664
+ }
665
+ };
666
+ /**
667
+ * Processes an add-in event that occurs from the host and responds
668
+ * back to the host with an 'event-received' message.
669
+ * @param message The message to process by looking up executing the registered callback
670
+ * that matches the event type.
671
+ */
672
+ AddinClient.prototype.processHostEvent = function (message) {
673
+ var _this = this;
674
+ var eventArgs = message.context;
675
+ var callback = this.registeredAddinEvents[eventArgs.type];
676
+ var promise;
677
+ if (callback) {
678
+ if (this.isBlockingEventType(eventArgs.type)) {
679
+ promise = new Promise(function (resolve) {
680
+ callback(eventArgs.context, function () {
681
+ resolve();
682
+ });
683
+ });
684
+ }
685
+ else {
686
+ promise = new Promise(function (resolve) {
687
+ callback(eventArgs.context);
688
+ resolve();
689
+ });
690
+ }
691
+ }
692
+ else {
693
+ promise = Promise.resolve();
694
+ }
695
+ promise.then(function () { return _this.postEventReceivedMessage(message.eventRequestId); });
696
+ };
697
+ /**
698
+ * Checks whether an event type is blocking and requires a response from the client
699
+ * before responding to the host.
700
+ * @param type The event type.
701
+ */
702
+ AddinClient.prototype.isBlockingEventType = function (type) {
703
+ switch (type) {
704
+ case 'form-save':
705
+ case 'form-cancel':
706
+ return true;
707
+ default: break;
708
+ }
709
+ return false;
710
+ };
711
+ /**
712
+ * Posts a message to the host page to indicate that a certain event has been received.
713
+ * @param eventRequestId The ID of the event request that was received.
714
+ */
715
+ AddinClient.prototype.postEventReceivedMessage = function (eventRequestId) {
716
+ this.postMessageToHostPage({
717
+ message: {
718
+ eventRequestId: eventRequestId
719
+ },
720
+ messageType: 'event-received'
721
+ });
722
+ };
723
+ /**
724
+ * Attemps to resolve the Promise for a client event that has been received by the host page.
725
+ * @param message Message data that includes the ID of the event that was received.
726
+ */
727
+ AddinClient.prototype.resolveClientEvent = function (message) {
728
+ var requestId = message.eventRequestId;
729
+ var promiseResolve = this.sentEvents[requestId];
730
+ if (promiseResolve) {
731
+ promiseResolve();
732
+ delete this.sentEvents[requestId];
733
+ }
734
+ };
735
+ /**
736
+ * Checks whether a MessageEvent is from the execetd host origin.
737
+ * @param event
738
+ */
739
+ AddinClient.prototype.isFromValidOrigin = function (event) {
740
+ return event.origin === this.trustedOrigin;
741
+ };
742
+ /**
743
+ * Log that a message was received with an invalid origin.
744
+ */
745
+ AddinClient.prototype.warnInvalidOrigin = function () {
746
+ console.warn('The origin is not trusted because the host-ready message has not been ' +
747
+ 'sent or because the host origin is not a whitelisted origin.');
748
+ };
749
+ /**
750
+ * Reads a query string value from the current window location.
751
+ * @param variable Name of the query string parameter to ready.
752
+ * @returns The value of the query string parameter.
753
+ */
754
+ AddinClient.prototype.getQueryVariable = function (variable) {
755
+ var query = AddinClient.getQueryString().substring(1);
756
+ var vars = query.split('&');
757
+ for (var _i = 0, vars_1 = vars; _i < vars_1.length; _i++) {
758
+ var v = vars_1[_i];
759
+ var pair = v.split('=');
760
+ if (decodeURIComponent(pair[0]) === variable) {
761
+ return decodeURIComponent(pair[1]);
762
+ }
763
+ }
764
+ };
765
+ return AddinClient;
766
+ }());
767
+ exports.AddinClient = AddinClient;
705
768
 
706
769
 
707
770
  /***/ }),
708
771
  /* 3 */
709
772
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
710
773
 
711
-
712
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
713
- if (k2 === undefined) k2 = k;
714
- var desc = Object.getOwnPropertyDescriptor(m, k);
715
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
716
- desc = { enumerable: true, get: function() { return m[k]; } };
717
- }
718
- Object.defineProperty(o, k2, desc);
719
- }) : (function(o, m, k, k2) {
720
- if (k2 === undefined) k2 = k;
721
- o[k2] = m[k];
722
- }));
723
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
724
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
725
- };
726
- Object.defineProperty(exports, "__esModule", ({ value: true }));
727
- __exportStar(__webpack_require__(4), exports);
728
- __exportStar(__webpack_require__(5), exports);
729
- __exportStar(__webpack_require__(6), exports);
730
- __exportStar(__webpack_require__(7), exports);
731
- __exportStar(__webpack_require__(8), exports);
732
- __exportStar(__webpack_require__(9), exports);
733
- __exportStar(__webpack_require__(10), exports);
734
- __exportStar(__webpack_require__(11), exports);
735
- __exportStar(__webpack_require__(12), exports);
736
- __exportStar(__webpack_require__(13), exports);
737
- __exportStar(__webpack_require__(14), exports);
738
- __exportStar(__webpack_require__(15), exports);
739
- __exportStar(__webpack_require__(16), exports);
740
- __exportStar(__webpack_require__(17), exports);
741
- __exportStar(__webpack_require__(18), exports);
742
- __exportStar(__webpack_require__(19), exports);
743
- __exportStar(__webpack_require__(20), exports);
744
- __exportStar(__webpack_require__(21), exports);
745
- __exportStar(__webpack_require__(22), exports);
746
- __exportStar(__webpack_require__(23), exports);
747
- __exportStar(__webpack_require__(24), exports);
748
- __exportStar(__webpack_require__(25), exports);
749
- __exportStar(__webpack_require__(26), exports);
750
- __exportStar(__webpack_require__(27), exports);
751
- __exportStar(__webpack_require__(28), exports);
752
- __exportStar(__webpack_require__(29), exports);
753
- __exportStar(__webpack_require__(30), exports);
774
+
775
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
776
+ if (k2 === undefined) k2 = k;
777
+ var desc = Object.getOwnPropertyDescriptor(m, k);
778
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
779
+ desc = { enumerable: true, get: function() { return m[k]; } };
780
+ }
781
+ Object.defineProperty(o, k2, desc);
782
+ }) : (function(o, m, k, k2) {
783
+ if (k2 === undefined) k2 = k;
784
+ o[k2] = m[k];
785
+ }));
786
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
787
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
788
+ };
789
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
790
+ __exportStar(__webpack_require__(4), exports);
791
+ __exportStar(__webpack_require__(5), exports);
792
+ __exportStar(__webpack_require__(6), exports);
793
+ __exportStar(__webpack_require__(7), exports);
794
+ __exportStar(__webpack_require__(8), exports);
795
+ __exportStar(__webpack_require__(9), exports);
796
+ __exportStar(__webpack_require__(10), exports);
797
+ __exportStar(__webpack_require__(11), exports);
798
+ __exportStar(__webpack_require__(12), exports);
799
+ __exportStar(__webpack_require__(13), exports);
800
+ __exportStar(__webpack_require__(14), exports);
801
+ __exportStar(__webpack_require__(15), exports);
802
+ __exportStar(__webpack_require__(16), exports);
803
+ __exportStar(__webpack_require__(17), exports);
804
+ __exportStar(__webpack_require__(18), exports);
805
+ __exportStar(__webpack_require__(19), exports);
806
+ __exportStar(__webpack_require__(20), exports);
807
+ __exportStar(__webpack_require__(21), exports);
808
+ __exportStar(__webpack_require__(22), exports);
809
+ __exportStar(__webpack_require__(23), exports);
810
+ __exportStar(__webpack_require__(24), exports);
811
+ __exportStar(__webpack_require__(25), exports);
812
+ __exportStar(__webpack_require__(26), exports);
813
+ __exportStar(__webpack_require__(27), exports);
814
+ __exportStar(__webpack_require__(28), exports);
815
+ __exportStar(__webpack_require__(29), exports);
816
+ __exportStar(__webpack_require__(30), exports);
754
817
 
755
818
 
756
819
  /***/ }),
757
820
  /* 4 */
758
821
  /***/ ((__unused_webpack_module, exports) => {
759
822
 
760
-
761
- Object.defineProperty(exports, "__esModule", ({ value: true }));
823
+
824
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
762
825
 
763
826
 
764
827
  /***/ }),
765
828
  /* 5 */
766
829
  /***/ ((__unused_webpack_module, exports) => {
767
830
 
768
-
769
- Object.defineProperty(exports, "__esModule", ({ value: true }));
770
- exports.AddinButtonStyle = void 0;
771
- /*
772
- * Defines the style of the button
773
- */
774
- var AddinButtonStyle;
775
- (function (AddinButtonStyle) {
776
- // No style (default)
777
- AddinButtonStyle[AddinButtonStyle["None"] = 0] = "None";
778
- // The button represents an "add" operation
779
- AddinButtonStyle[AddinButtonStyle["Add"] = 1] = "Add";
780
- // The button represents an "edit" operation
781
- AddinButtonStyle[AddinButtonStyle["Edit"] = 2] = "Edit";
782
- // The button represents a "delete" operation
783
- AddinButtonStyle[AddinButtonStyle["Delete"] = 3] = "Delete";
784
- })(AddinButtonStyle = exports.AddinButtonStyle || (exports.AddinButtonStyle = {}));
831
+
832
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
833
+ exports.AddinButtonStyle = void 0;
834
+ /*
835
+ * Defines the style of the button
836
+ */
837
+ var AddinButtonStyle;
838
+ (function (AddinButtonStyle) {
839
+ // No style (default)
840
+ AddinButtonStyle[AddinButtonStyle["None"] = 0] = "None";
841
+ // The button represents an "add" operation
842
+ AddinButtonStyle[AddinButtonStyle["Add"] = 1] = "Add";
843
+ // The button represents an "edit" operation
844
+ AddinButtonStyle[AddinButtonStyle["Edit"] = 2] = "Edit";
845
+ // The button represents a "delete" operation
846
+ AddinButtonStyle[AddinButtonStyle["Delete"] = 3] = "Delete";
847
+ })(AddinButtonStyle = exports.AddinButtonStyle || (exports.AddinButtonStyle = {}));
785
848
 
786
849
 
787
850
  /***/ }),
788
851
  /* 6 */
789
852
  /***/ ((__unused_webpack_module, exports) => {
790
853
 
791
-
792
- Object.defineProperty(exports, "__esModule", ({ value: true }));
854
+
855
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
793
856
 
794
857
 
795
858
  /***/ }),
796
859
  /* 7 */
797
860
  /***/ ((__unused_webpack_module, exports) => {
798
861
 
799
-
800
- Object.defineProperty(exports, "__esModule", ({ value: true }));
862
+
863
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
801
864
 
802
865
 
803
866
  /***/ }),
804
867
  /* 8 */
805
868
  /***/ ((__unused_webpack_module, exports) => {
806
869
 
807
-
808
- Object.defineProperty(exports, "__esModule", ({ value: true }));
870
+
871
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
809
872
 
810
873
 
811
874
  /***/ }),
812
875
  /* 9 */
813
876
  /***/ ((__unused_webpack_module, exports) => {
814
877
 
815
-
816
- Object.defineProperty(exports, "__esModule", ({ value: true }));
878
+
879
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
817
880
 
818
881
 
819
882
  /***/ }),
820
883
  /* 10 */
821
884
  /***/ ((__unused_webpack_module, exports) => {
822
885
 
823
-
824
- Object.defineProperty(exports, "__esModule", ({ value: true }));
886
+
887
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
825
888
 
826
889
 
827
890
  /***/ }),
828
891
  /* 11 */
829
892
  /***/ ((__unused_webpack_module, exports) => {
830
893
 
831
-
832
- Object.defineProperty(exports, "__esModule", ({ value: true }));
894
+
895
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
833
896
 
834
897
 
835
898
  /***/ }),
836
899
  /* 12 */
837
900
  /***/ ((__unused_webpack_module, exports) => {
838
901
 
839
-
840
- Object.defineProperty(exports, "__esModule", ({ value: true }));
902
+
903
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
841
904
 
842
905
 
843
906
  /***/ }),
844
907
  /* 13 */
845
908
  /***/ ((__unused_webpack_module, exports) => {
846
909
 
847
-
848
- Object.defineProperty(exports, "__esModule", ({ value: true }));
910
+
911
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
849
912
 
850
913
 
851
914
  /***/ }),
852
915
  /* 14 */
853
916
  /***/ ((__unused_webpack_module, exports) => {
854
917
 
855
-
856
- Object.defineProperty(exports, "__esModule", ({ value: true }));
918
+
919
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
857
920
 
858
921
 
859
922
  /***/ }),
860
923
  /* 15 */
861
924
  /***/ ((__unused_webpack_module, exports) => {
862
925
 
863
-
864
- Object.defineProperty(exports, "__esModule", ({ value: true }));
926
+
927
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
865
928
 
866
929
 
867
930
  /***/ }),
868
931
  /* 16 */
869
932
  /***/ ((__unused_webpack_module, exports) => {
870
933
 
871
-
872
- Object.defineProperty(exports, "__esModule", ({ value: true }));
934
+
935
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
873
936
 
874
937
 
875
938
  /***/ }),
876
939
  /* 17 */
877
940
  /***/ ((__unused_webpack_module, exports) => {
878
941
 
879
-
880
- Object.defineProperty(exports, "__esModule", ({ value: true }));
942
+
943
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
881
944
 
882
945
 
883
946
  /***/ }),
884
947
  /* 18 */
885
948
  /***/ ((__unused_webpack_module, exports) => {
886
949
 
887
-
888
- Object.defineProperty(exports, "__esModule", ({ value: true }));
950
+
951
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
889
952
 
890
953
 
891
954
  /***/ }),
892
955
  /* 19 */
893
956
  /***/ ((__unused_webpack_module, exports) => {
894
957
 
895
-
896
- Object.defineProperty(exports, "__esModule", ({ value: true }));
958
+
959
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
897
960
 
898
961
 
899
962
  /***/ }),
900
963
  /* 20 */
901
964
  /***/ ((__unused_webpack_module, exports) => {
902
965
 
903
-
904
- Object.defineProperty(exports, "__esModule", ({ value: true }));
966
+
967
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
905
968
 
906
969
 
907
970
  /***/ }),
908
971
  /* 21 */
909
972
  /***/ ((__unused_webpack_module, exports) => {
910
973
 
911
-
912
- Object.defineProperty(exports, "__esModule", ({ value: true }));
974
+
975
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
913
976
 
914
977
 
915
978
  /***/ }),
916
979
  /* 22 */
917
980
  /***/ ((__unused_webpack_module, exports) => {
918
981
 
919
-
920
- Object.defineProperty(exports, "__esModule", ({ value: true }));
982
+
983
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
921
984
 
922
985
 
923
986
  /***/ }),
924
987
  /* 23 */
925
988
  /***/ ((__unused_webpack_module, exports) => {
926
989
 
927
-
928
- Object.defineProperty(exports, "__esModule", ({ value: true }));
990
+
991
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
929
992
 
930
993
 
931
994
  /***/ }),
932
995
  /* 24 */
933
996
  /***/ ((__unused_webpack_module, exports) => {
934
997
 
935
-
936
- Object.defineProperty(exports, "__esModule", ({ value: true }));
998
+
999
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
937
1000
 
938
1001
 
939
1002
  /***/ }),
940
1003
  /* 25 */
941
1004
  /***/ ((__unused_webpack_module, exports) => {
942
1005
 
943
-
944
- Object.defineProperty(exports, "__esModule", ({ value: true }));
945
- exports.AddinConfirmButtonStyle = void 0;
946
- /**
947
- * Defines the style of a confirm dialog button.
948
- */
949
- var AddinConfirmButtonStyle;
950
- (function (AddinConfirmButtonStyle) {
951
- // The button represents a "secondary" action (default)
952
- AddinConfirmButtonStyle[AddinConfirmButtonStyle["Default"] = 0] = "Default";
953
- // The button represents a "primary" action
954
- AddinConfirmButtonStyle[AddinConfirmButtonStyle["Primary"] = 1] = "Primary";
955
- // The button represents a "link" action, often used
956
- // to trigger an action to cancel/close a confirm dialog
957
- AddinConfirmButtonStyle[AddinConfirmButtonStyle["Link"] = 2] = "Link";
958
- })(AddinConfirmButtonStyle = exports.AddinConfirmButtonStyle || (exports.AddinConfirmButtonStyle = {}));
1006
+
1007
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
1008
+ exports.AddinConfirmButtonStyle = void 0;
1009
+ /**
1010
+ * Defines the style of a confirm dialog button.
1011
+ */
1012
+ var AddinConfirmButtonStyle;
1013
+ (function (AddinConfirmButtonStyle) {
1014
+ // The button represents a "secondary" action (default)
1015
+ AddinConfirmButtonStyle[AddinConfirmButtonStyle["Default"] = 0] = "Default";
1016
+ // The button represents a "primary" action
1017
+ AddinConfirmButtonStyle[AddinConfirmButtonStyle["Primary"] = 1] = "Primary";
1018
+ // The button represents a "link" action, often used
1019
+ // to trigger an action to cancel/close a confirm dialog
1020
+ AddinConfirmButtonStyle[AddinConfirmButtonStyle["Link"] = 2] = "Link";
1021
+ })(AddinConfirmButtonStyle = exports.AddinConfirmButtonStyle || (exports.AddinConfirmButtonStyle = {}));
959
1022
 
960
1023
 
961
1024
  /***/ }),
962
1025
  /* 26 */
963
1026
  /***/ ((__unused_webpack_module, exports) => {
964
1027
 
965
-
966
- Object.defineProperty(exports, "__esModule", ({ value: true }));
1028
+
1029
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
967
1030
 
968
1031
 
969
1032
  /***/ }),
970
1033
  /* 27 */
971
1034
  /***/ ((__unused_webpack_module, exports) => {
972
1035
 
973
-
974
- Object.defineProperty(exports, "__esModule", ({ value: true }));
975
- exports.AddinTabSummaryStyle = void 0;
976
- /*
977
- * Defines the style of the tab summary
978
- */
979
- var AddinTabSummaryStyle;
980
- (function (AddinTabSummaryStyle) {
981
- // No style (default)
982
- AddinTabSummaryStyle[AddinTabSummaryStyle["None"] = 0] = "None";
983
- // Show summary text next to the tab caption (the value shown will be the 'summary' property)
984
- AddinTabSummaryStyle[AddinTabSummaryStyle["Text"] = 1] = "Text";
985
- })(AddinTabSummaryStyle = exports.AddinTabSummaryStyle || (exports.AddinTabSummaryStyle = {}));
1036
+
1037
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
1038
+ exports.AddinTabSummaryStyle = void 0;
1039
+ /*
1040
+ * Defines the style of the tab summary
1041
+ */
1042
+ var AddinTabSummaryStyle;
1043
+ (function (AddinTabSummaryStyle) {
1044
+ // No style (default)
1045
+ AddinTabSummaryStyle[AddinTabSummaryStyle["None"] = 0] = "None";
1046
+ // Show summary text next to the tab caption (the value shown will be the 'summary' property)
1047
+ AddinTabSummaryStyle[AddinTabSummaryStyle["Text"] = 1] = "Text";
1048
+ })(AddinTabSummaryStyle = exports.AddinTabSummaryStyle || (exports.AddinTabSummaryStyle = {}));
986
1049
 
987
1050
 
988
1051
  /***/ }),
989
1052
  /* 28 */
990
1053
  /***/ ((__unused_webpack_module, exports) => {
991
1054
 
992
-
993
- Object.defineProperty(exports, "__esModule", ({ value: true }));
1055
+
1056
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
994
1057
 
995
1058
 
996
1059
  /***/ }),
997
1060
  /* 29 */
998
1061
  /***/ ((__unused_webpack_module, exports) => {
999
1062
 
1000
-
1001
- Object.defineProperty(exports, "__esModule", ({ value: true }));
1002
- exports.AddinTileSummaryStyle = void 0;
1003
- /*
1004
- * Defines the style of the tile summary
1005
- */
1006
- var AddinTileSummaryStyle;
1007
- (function (AddinTileSummaryStyle) {
1008
- // No style (default)
1009
- AddinTileSummaryStyle[AddinTileSummaryStyle["None"] = 0] = "None";
1010
- // Show a text summary for the tile (the value to show will be the 'summary' property)
1011
- AddinTileSummaryStyle[AddinTileSummaryStyle["Text"] = 1] = "Text";
1012
- // Show a check summary for the tile (the check will show based on the 'checked' property)
1013
- AddinTileSummaryStyle[AddinTileSummaryStyle["Check"] = 2] = "Check";
1014
- })(AddinTileSummaryStyle = exports.AddinTileSummaryStyle || (exports.AddinTileSummaryStyle = {}));
1063
+
1064
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
1065
+ exports.AddinTileSummaryStyle = void 0;
1066
+ /*
1067
+ * Defines the style of the tile summary
1068
+ */
1069
+ var AddinTileSummaryStyle;
1070
+ (function (AddinTileSummaryStyle) {
1071
+ // No style (default)
1072
+ AddinTileSummaryStyle[AddinTileSummaryStyle["None"] = 0] = "None";
1073
+ // Show a text summary for the tile (the value to show will be the 'summary' property)
1074
+ AddinTileSummaryStyle[AddinTileSummaryStyle["Text"] = 1] = "Text";
1075
+ // Show a check summary for the tile (the check will show based on the 'checked' property)
1076
+ AddinTileSummaryStyle[AddinTileSummaryStyle["Check"] = 2] = "Check";
1077
+ })(AddinTileSummaryStyle = exports.AddinTileSummaryStyle || (exports.AddinTileSummaryStyle = {}));
1015
1078
 
1016
1079
 
1017
1080
  /***/ }),
1018
1081
  /* 30 */
1019
1082
  /***/ ((__unused_webpack_module, exports) => {
1020
1083
 
1021
-
1022
- Object.defineProperty(exports, "__esModule", ({ value: true }));
1023
- exports.AddinToastStyle = void 0;
1024
- /*
1025
- * Defines the style of the toast
1026
- */
1027
- var AddinToastStyle;
1028
- (function (AddinToastStyle) {
1029
- // The toast style for a critical error
1030
- AddinToastStyle[AddinToastStyle["Danger"] = 0] = "Danger";
1031
- // The toast style for informational purposes (default)
1032
- AddinToastStyle[AddinToastStyle["Info"] = 1] = "Info";
1033
- // The toast style for a successful operation
1034
- AddinToastStyle[AddinToastStyle["Success"] = 2] = "Success";
1035
- // The toast style for a non-critical error
1036
- AddinToastStyle[AddinToastStyle["Warning"] = 3] = "Warning";
1037
- })(AddinToastStyle = exports.AddinToastStyle || (exports.AddinToastStyle = {}));
1084
+
1085
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
1086
+ exports.AddinToastStyle = void 0;
1087
+ /*
1088
+ * Defines the style of the toast
1089
+ */
1090
+ var AddinToastStyle;
1091
+ (function (AddinToastStyle) {
1092
+ // The toast style for a critical error
1093
+ AddinToastStyle[AddinToastStyle["Danger"] = 0] = "Danger";
1094
+ // The toast style for informational purposes (default)
1095
+ AddinToastStyle[AddinToastStyle["Info"] = 1] = "Info";
1096
+ // The toast style for a successful operation
1097
+ AddinToastStyle[AddinToastStyle["Success"] = 2] = "Success";
1098
+ // The toast style for a non-critical error
1099
+ AddinToastStyle[AddinToastStyle["Warning"] = 3] = "Warning";
1100
+ })(AddinToastStyle = exports.AddinToastStyle || (exports.AddinToastStyle = {}));
1038
1101
 
1039
1102
 
1040
1103
  /***/ }),
1041
1104
  /* 31 */
1042
1105
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
1043
1106
 
1044
-
1045
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
1046
- if (k2 === undefined) k2 = k;
1047
- var desc = Object.getOwnPropertyDescriptor(m, k);
1048
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
1049
- desc = { enumerable: true, get: function() { return m[k]; } };
1050
- }
1051
- Object.defineProperty(o, k2, desc);
1052
- }) : (function(o, m, k, k2) {
1053
- if (k2 === undefined) k2 = k;
1054
- o[k2] = m[k];
1055
- }));
1056
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
1057
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
1058
- };
1059
- Object.defineProperty(exports, "__esModule", ({ value: true }));
1060
- __exportStar(__webpack_require__(32), exports);
1061
- __exportStar(__webpack_require__(33), exports);
1107
+
1108
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
1109
+ if (k2 === undefined) k2 = k;
1110
+ var desc = Object.getOwnPropertyDescriptor(m, k);
1111
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
1112
+ desc = { enumerable: true, get: function() { return m[k]; } };
1113
+ }
1114
+ Object.defineProperty(o, k2, desc);
1115
+ }) : (function(o, m, k, k2) {
1116
+ if (k2 === undefined) k2 = k;
1117
+ o[k2] = m[k];
1118
+ }));
1119
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
1120
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
1121
+ };
1122
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
1123
+ __exportStar(__webpack_require__(32), exports);
1124
+ __exportStar(__webpack_require__(33), exports);
1062
1125
 
1063
1126
 
1064
1127
  /***/ }),
1065
1128
  /* 32 */
1066
1129
  /***/ ((__unused_webpack_module, exports) => {
1067
1130
 
1068
-
1069
- Object.defineProperty(exports, "__esModule", ({ value: true }));
1131
+
1132
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
1070
1133
 
1071
1134
 
1072
1135
  /***/ }),
1073
1136
  /* 33 */
1074
1137
  /***/ ((__unused_webpack_module, exports) => {
1075
1138
 
1076
-
1077
- Object.defineProperty(exports, "__esModule", ({ value: true }));
1139
+
1140
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
1078
1141
 
1079
1142
 
1080
1143
  /***/ })