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