@blackbaud/sky-addin-client 1.2.0 → 1.2.1

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