@blackbaud/sky-addin-client 1.2.0 → 1.2.1

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