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