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