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