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