@blackbaud/sky-addin-client 1.1.5 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/CHANGELOG.md +121 -114
  2. package/README.md +470 -470
  3. package/bundles/sky-addin-client.global-es2015.js +1094 -0
  4. package/bundles/sky-addin-client.global-es2015.min.js +1 -0
  5. package/bundles/sky-addin-client.global.js +1106 -0
  6. package/bundles/sky-addin-client.global.min.js +1 -0
  7. package/bundles/sky-addin-client.umd-es2015.js +1105 -0
  8. package/bundles/sky-addin-client.umd-es2015.min.js +1 -0
  9. package/bundles/sky-addin-client.umd.js +1117 -1
  10. package/bundles/sky-addin-client.umd.min.js +1 -1
  11. package/index.d.ts +1 -1
  12. package/index.js +17 -6
  13. package/index.js.map +1 -1
  14. package/package.json +67 -70
  15. package/src/addin/addin-client.d.ts +277 -277
  16. package/src/addin/addin-client.js +640 -640
  17. package/src/addin/addin-client.js.map +1 -1
  18. package/src/addin/addin-client.spec.d.ts +1 -0
  19. package/src/addin/addin-client.spec.js +1415 -0
  20. package/src/addin/addin-client.spec.js.map +1 -0
  21. package/src/addin/client-interfaces/addin-action-button-config.d.ts +10 -10
  22. package/src/addin/client-interfaces/addin-action-button-config.js +2 -2
  23. package/src/addin/client-interfaces/addin-button-config.d.ts +10 -10
  24. package/src/addin/client-interfaces/addin-button-config.js +2 -2
  25. package/src/addin/client-interfaces/addin-button-style.d.ts +6 -6
  26. package/src/addin/client-interfaces/addin-button-style.js +17 -16
  27. package/src/addin/client-interfaces/addin-button-style.js.map +1 -1
  28. package/src/addin/client-interfaces/addin-client-args.d.ts +10 -10
  29. package/src/addin/client-interfaces/addin-client-args.js +2 -2
  30. package/src/addin/client-interfaces/addin-client-callbacks.d.ts +40 -40
  31. package/src/addin/client-interfaces/addin-client-callbacks.js +2 -2
  32. package/src/addin/client-interfaces/addin-client-close-modal-args.d.ts +10 -10
  33. package/src/addin/client-interfaces/addin-client-close-modal-args.js +2 -2
  34. package/src/addin/client-interfaces/addin-client-event-args.d.ts +13 -13
  35. package/src/addin/client-interfaces/addin-client-event-args.js +2 -2
  36. package/src/addin/client-interfaces/addin-client-flyout-permalink.d.ts +14 -14
  37. package/src/addin/client-interfaces/addin-client-flyout-permalink.js +2 -2
  38. package/src/addin/client-interfaces/addin-client-init-args.d.ts +28 -28
  39. package/src/addin/client-interfaces/addin-client-init-args.js +2 -2
  40. package/src/addin/client-interfaces/addin-client-navigate-args.d.ts +9 -9
  41. package/src/addin/client-interfaces/addin-client-navigate-args.js +2 -2
  42. package/src/addin/client-interfaces/addin-client-open-help-args.d.ts +10 -10
  43. package/src/addin/client-interfaces/addin-client-open-help-args.js +2 -2
  44. package/src/addin/client-interfaces/addin-client-ready-args.d.ts +39 -39
  45. package/src/addin/client-interfaces/addin-client-ready-args.js +2 -2
  46. package/src/addin/client-interfaces/addin-client-ready-button-config.d.ts +10 -10
  47. package/src/addin/client-interfaces/addin-client-ready-button-config.js +2 -2
  48. package/src/addin/client-interfaces/addin-client-show-confirm-args.d.ts +19 -19
  49. package/src/addin/client-interfaces/addin-client-show-confirm-args.js +2 -2
  50. package/src/addin/client-interfaces/addin-client-show-error-args.d.ts +18 -18
  51. package/src/addin/client-interfaces/addin-client-show-error-args.js +2 -2
  52. package/src/addin/client-interfaces/addin-client-show-flyout-args.d.ts +46 -46
  53. package/src/addin/client-interfaces/addin-client-show-flyout-args.js +2 -2
  54. package/src/addin/client-interfaces/addin-client-show-flyout-result.d.ts +9 -9
  55. package/src/addin/client-interfaces/addin-client-show-flyout-result.js +2 -2
  56. package/src/addin/client-interfaces/addin-client-show-modal-args.d.ts +14 -14
  57. package/src/addin/client-interfaces/addin-client-show-modal-args.js +2 -2
  58. package/src/addin/client-interfaces/addin-client-show-modal-result.d.ts +10 -10
  59. package/src/addin/client-interfaces/addin-client-show-modal-result.js +2 -2
  60. package/src/addin/client-interfaces/addin-client-show-toast-args.d.ts +15 -15
  61. package/src/addin/client-interfaces/addin-client-show-toast-args.js +2 -2
  62. package/src/addin/client-interfaces/addin-client-theme-settings.d.ts +13 -13
  63. package/src/addin/client-interfaces/addin-client-theme-settings.js +2 -2
  64. package/src/addin/client-interfaces/addin-confirm-button-style.d.ts +8 -8
  65. package/src/addin/client-interfaces/addin-confirm-button-style.js +16 -15
  66. package/src/addin/client-interfaces/addin-confirm-button-style.js.map +1 -1
  67. package/src/addin/client-interfaces/addin-confirm-button.d.ts +26 -26
  68. package/src/addin/client-interfaces/addin-confirm-button.js +2 -2
  69. package/src/addin/client-interfaces/addin-modal-config.d.ts +12 -12
  70. package/src/addin/client-interfaces/addin-modal-config.js +2 -2
  71. package/src/addin/client-interfaces/addin-tab-config.d.ts +9 -9
  72. package/src/addin/client-interfaces/addin-tab-config.js +2 -2
  73. package/src/addin/client-interfaces/addin-tab-summary-style.d.ts +4 -4
  74. package/src/addin/client-interfaces/addin-tab-summary-style.js +13 -12
  75. package/src/addin/client-interfaces/addin-tab-summary-style.js.map +1 -1
  76. package/src/addin/client-interfaces/addin-tile-config.d.ts +32 -32
  77. package/src/addin/client-interfaces/addin-tile-config.js +2 -2
  78. package/src/addin/client-interfaces/addin-tile-summary-style.d.ts +5 -5
  79. package/src/addin/client-interfaces/addin-tile-summary-style.js +15 -14
  80. package/src/addin/client-interfaces/addin-tile-summary-style.js.map +1 -1
  81. package/src/addin/client-interfaces/addin-toast-style.d.ts +6 -6
  82. package/src/addin/client-interfaces/addin-toast-style.js +17 -16
  83. package/src/addin/client-interfaces/addin-toast-style.js.map +1 -1
  84. package/src/addin/client-interfaces/index.d.ts +27 -27
  85. package/src/addin/client-interfaces/index.js +43 -10
  86. package/src/addin/client-interfaces/index.js.map +1 -1
  87. package/src/addin/host-interfaces/addin-host-message-event-data.d.ts +23 -23
  88. package/src/addin/host-interfaces/addin-host-message-event-data.js +2 -2
  89. package/src/addin/host-interfaces/addin-host-message.d.ts +44 -44
  90. package/src/addin/host-interfaces/addin-host-message.js +2 -2
  91. package/src/addin/host-interfaces/index.d.ts +2 -2
  92. package/src/addin/host-interfaces/index.js +18 -2
  93. package/src/addin/host-interfaces/index.js.map +1 -1
  94. package/src/addin/index.d.ts +3 -3
  95. package/src/addin/index.js +19 -7
  96. package/src/addin/index.js.map +1 -1
@@ -1,277 +1,277 @@
1
- import { AddinClientArgs } from './client-interfaces/addin-client-args';
2
- import { AddinClientCloseModalArgs } from './client-interfaces/addin-client-close-modal-args';
3
- import { AddinClientEventArgs } from './client-interfaces/addin-client-event-args';
4
- import { AddinClientNavigateArgs } from './client-interfaces/addin-client-navigate-args';
5
- import { AddinClientOpenHelpArgs } from './client-interfaces/addin-client-open-help-args';
6
- import { AddinClientShowConfirmArgs } from './client-interfaces/addin-client-show-confirm-args';
7
- import { AddinClientShowErrorArgs } from './client-interfaces/addin-client-show-error-args';
8
- import { AddinClientShowFlyoutArgs } from './client-interfaces/addin-client-show-flyout-args';
9
- import { AddinClientShowFlyoutResult } from './client-interfaces/addin-client-show-flyout-result';
10
- import { AddinClientShowModalArgs } from './client-interfaces/addin-client-show-modal-args';
11
- import { AddinClientShowModalResult } from './client-interfaces/addin-client-show-modal-result';
12
- import { AddinClientShowToastArgs } from './client-interfaces/addin-client-show-toast-args';
13
- /**
14
- * Callback function to execute when an add-in event occurs.
15
- * @param context Abitrary context object passed to the event callback.
16
- * @param done Optional callback function to be executed when the client is done
17
- * processing the event.
18
- *
19
- * The following event types require the 'done' callback to be provided:
20
- * - 'form-save'
21
- * - 'form-cancel'
22
- */
23
- export declare type AddinEventCallback = (context: any, done?: () => void) => void;
24
- /**
25
- * Client for interacting with the parent page hosting the add-in.
26
- */
27
- export declare class AddinClient {
28
- private args;
29
- /**
30
- * Tracks pending request to reeceive an auth-token from the host.
31
- */
32
- private authTokenRequests;
33
- /**
34
- * Counter to provide unique ids for each auth token request.
35
- */
36
- private lastAuthTokenRequestId;
37
- /**
38
- * Tracks modal add-ins that have been launched from this add-in.
39
- */
40
- private modalRequests;
41
- /**
42
- * Counter to provide unique ids for each modal request.
43
- */
44
- private lastModalRequestId;
45
- /**
46
- * Tracks the current flyout add-in that has been launched from this add-in.
47
- */
48
- private flyoutRequest;
49
- /**
50
- * Tracks the current confirm dialog that has been launched from this add-in.
51
- */
52
- private confirmRequest;
53
- /**
54
- * The origin of the host page.
55
- */
56
- private trustedOrigin;
57
- /**
58
- * A message handler listening to post-message events from the host page.
59
- */
60
- private windowMessageHandler;
61
- /**
62
- * setInterval id for tracking height changes of the iframe.
63
- */
64
- private heightChangeIntervalId;
65
- /**
66
- * Tracks the last height posted to the host page.
67
- */
68
- private lastPostedIframeHeight;
69
- /**
70
- * Stores the registered add-in events.
71
- * Key - the event type.
72
- * Value - The callback function to be executed when the event type occurs.
73
- */
74
- private registeredAddinEvents;
75
- /**
76
- * Stores the add-in events that have been sent to the host page.
77
- * Key - the event request ID.
78
- * Value - The Promise resolve function to be executed when the event is received by the host.
79
- */
80
- private sentEvents;
81
- /**
82
- * Stores the pending add-in events that are queued to be sent to the host page after 200
83
- * milliseconds have expired.
84
- * Key - the event type.
85
- * Value - The Promise reject function to be executed if the event fails to be sent to the host page.
86
- */
87
- private pendingSentEvents;
88
- /**
89
- * The event request ID counter.
90
- * The ID is incremented and assigned to each event that is sent.
91
- */
92
- private eventRequestId;
93
- /**
94
- * An array of event types that are supported by the host page.
95
- * The add-in client will throw an error if an event is attempted but not one the supported types.
96
- */
97
- private supportedEventTypes;
98
- /**
99
- * @returns {string} Returns the current query string path for the window, prefixed with ?.
100
- */
101
- private static getQueryString;
102
- constructor(args: AddinClientArgs);
103
- /**
104
- * Cleans up the AddinClient, releasing all resources.
105
- */
106
- destroy(): void;
107
- /**
108
- * Requests the host page to navigate.
109
- * @param args Arguments describing the navigation request.
110
- */
111
- navigate(args: AddinClientNavigateArgs): void;
112
- /**
113
- * Requests an authentication token for the current user.
114
- * @deprecated Use getUserIdentityToken() instead.
115
- * @returns {Promise<any>} Returns a promise which will resolve with the token value.
116
- */
117
- getAuthToken(): Promise<string>;
118
- /**
119
- * Requests a user identity token for the current user.
120
- * @returns {Promise<any>} Returns a promise which will resolve with the token value.
121
- */
122
- getUserIdentityToken(): Promise<string>;
123
- /**
124
- * Requests the host page to launch a modal add-in.
125
- * @param args Arguments for launching the modal.
126
- * @returns {Promise<any>} Returns a promise that will be resolved when the modal add-in is closed.
127
- * Promise will resolve with context data passed by from the modal add-in's closeModal call.
128
- */
129
- showModal(args: AddinClientShowModalArgs): AddinClientShowModalResult;
130
- /**
131
- * Informs the host to close this modal add-in.
132
- * Should only be used from within the modal add-in and not the parent add-in.
133
- * @param args Arguments to provide a context object back to the parent add-in.
134
- */
135
- closeModal(args: AddinClientCloseModalArgs): void;
136
- /**
137
- * Informs the host to open the help tab with the specified help key.
138
- * @param args Arguments for launching the help tab.
139
- */
140
- openHelp(args: AddinClientOpenHelpArgs): void;
141
- /**
142
- * Informs the host to show a toast message.
143
- * @param args Arguments for showing a toast.
144
- */
145
- showToast(args: AddinClientShowToastArgs): void;
146
- /**
147
- * Requests the host page to launch a flyout add-in.
148
- * @param args Arguments for launching the flyout.
149
- * @returns {Promise<any>} Returns a promise that will be resolved when the flyout add-in is closed.
150
- */
151
- showFlyout(args: AddinClientShowFlyoutArgs): AddinClientShowFlyoutResult;
152
- /**
153
- * Requests the host page to close the flyout add-in.
154
- */
155
- closeFlyout(): void;
156
- /**
157
- * Requests the host page to show a confirm dialog.
158
- * @param args Arguments for showing a confirm dialog.
159
- * @returns {Promise<string>} Returns a promise that will resolve with the
160
- * confirm action when the dialog is closed.
161
- */
162
- showConfirm(args: AddinClientShowConfirmArgs): Promise<string>;
163
- /**
164
- * Informs the host to show an error dialog.
165
- * @param args Arguments for showing an error dialog.
166
- */
167
- showError(args: AddinClientShowErrorArgs): void;
168
- /**
169
- * Requests the host page to show the page blocking wait indicator.
170
- */
171
- showWait(): void;
172
- /**
173
- * Requests the host page to hide the page blocking wait indicator.
174
- */
175
- hideWait(): void;
176
- /**
177
- * Registers a callback to be executed when the specified event type occurs.
178
- * @param eventType The event type to process.
179
- * @param callback The callback to execute when the event occurs.
180
- */
181
- addEventHandler(eventType: string, callback: AddinEventCallback): void;
182
- /**
183
- * Sends an event to be handled by the host page.
184
- * @returns {Promise<void>} Returns a Promise which will resolve when the add-in host page receives the message, or
185
- * rejects if a subsequent event occurs, for the same event type, within 200 milliseconds.
186
- * The Promise also rejects if an event type is not one of the supported types from the host page.
187
- * @see AddinClientInitArgs#supportedEventTypes
188
- */
189
- sendEvent(args: AddinClientEventArgs): Promise<void>;
190
- /**
191
- * Post a message to the host page informing it that the add-in is
192
- * now started and listening for messages from the host.
193
- */
194
- private raiseAddinReadyMessage;
195
- /**
196
- * Handles the modal-closed message from the host.
197
- * This is emitted to add-ins which have previously launched a modal, which is now
198
- * closing.
199
- * @param message The message data, which includes a context object from the closing modal, which should be passed
200
- * to the calling modal in the showModal promise.
201
- */
202
- private handleModalClosedMessage;
203
- /**
204
- * Handles host message responses to a get-auth-token request.
205
- * @param data The message.
206
- */
207
- private handleAuthTokenMessage;
208
- /**
209
- * Handles message events received from the add-in host page.
210
- * @param event The event posted from the host.
211
- */
212
- private handleMessage;
213
- /**
214
- * Validates and registers a value as the origin of the parent page hosting the add-in.
215
- * If the provided origin matches against our trusted whitelist, then it will be saved.
216
- * Post messages will implicitly go to this origin and received messages will be filtered
217
- * to just messages from this origin.
218
- * @param hostOrigin
219
- */
220
- private setKnownAllowedHostOrigin;
221
- /**
222
- * Checks if the height of the iFrame has changed since it was last
223
- * posted to the host page (or if it hasn't been posted yet) and initiates
224
- * a new post if so.
225
- */
226
- private checkForHeightChangesOfAddinContent;
227
- /**
228
- * Starts a timeout interval to watch for height changes
229
- * of the iframe content.
230
- */
231
- private trackHeightChangesOfAddinContent;
232
- /**
233
- * Posts a message to the parent window.
234
- * @param message The message content to post.
235
- * @param targetOrigin Optional. If provided, then the message will be posted to this origin.
236
- * If not, then it will post to the pre-determined host page origin.
237
- */
238
- private postMessageToHostPage;
239
- /**
240
- * Processes an add-in event that occurs from the host and responds
241
- * back to the host with an 'event-received' message.
242
- * @param message The message to process by looking up executing the registered callback
243
- * that matches the event type.
244
- */
245
- private processHostEvent;
246
- /**
247
- * Checks whether an event type is blocking and requires a response from the client
248
- * before responding to the host.
249
- * @param type The event type.
250
- */
251
- private isBlockingEventType;
252
- /**
253
- * Posts a message to the host page to indicate that a certain event has been received.
254
- * @param eventRequestId The ID of the event request that was received.
255
- */
256
- private postEventReceivedMessage;
257
- /**
258
- * Attemps to resolve the Promise for a client event that has been received by the host page.
259
- * @param message Message data that includes the ID of the event that was received.
260
- */
261
- private resolveClientEvent;
262
- /**
263
- * Checks whether a MessageEvent is from the execetd host origin.
264
- * @param event
265
- */
266
- private isFromValidOrigin;
267
- /**
268
- * Log that a message was received with an invalid origin.
269
- */
270
- private warnInvalidOrigin;
271
- /**
272
- * Reads a query string value from the current window location.
273
- * @param variable Name of the query string parameter to ready.
274
- * @returns The value of the query string parameter.
275
- */
276
- private getQueryVariable;
277
- }
1
+ import { AddinClientArgs } from './client-interfaces/addin-client-args';
2
+ import { AddinClientCloseModalArgs } from './client-interfaces/addin-client-close-modal-args';
3
+ import { AddinClientEventArgs } from './client-interfaces/addin-client-event-args';
4
+ import { AddinClientNavigateArgs } from './client-interfaces/addin-client-navigate-args';
5
+ import { AddinClientOpenHelpArgs } from './client-interfaces/addin-client-open-help-args';
6
+ import { AddinClientShowConfirmArgs } from './client-interfaces/addin-client-show-confirm-args';
7
+ import { AddinClientShowErrorArgs } from './client-interfaces/addin-client-show-error-args';
8
+ import { AddinClientShowFlyoutArgs } from './client-interfaces/addin-client-show-flyout-args';
9
+ import { AddinClientShowFlyoutResult } from './client-interfaces/addin-client-show-flyout-result';
10
+ import { AddinClientShowModalArgs } from './client-interfaces/addin-client-show-modal-args';
11
+ import { AddinClientShowModalResult } from './client-interfaces/addin-client-show-modal-result';
12
+ import { AddinClientShowToastArgs } from './client-interfaces/addin-client-show-toast-args';
13
+ /**
14
+ * Callback function to execute when an add-in event occurs.
15
+ * @param context Abitrary context object passed to the event callback.
16
+ * @param done Optional callback function to be executed when the client is done
17
+ * processing the event.
18
+ *
19
+ * The following event types require the 'done' callback to be provided:
20
+ * - 'form-save'
21
+ * - 'form-cancel'
22
+ */
23
+ export type AddinEventCallback = (context: any, done?: () => void) => void;
24
+ /**
25
+ * Client for interacting with the parent page hosting the add-in.
26
+ */
27
+ export declare class AddinClient {
28
+ private args;
29
+ /**
30
+ * Tracks pending request to reeceive an auth-token from the host.
31
+ */
32
+ private authTokenRequests;
33
+ /**
34
+ * Counter to provide unique ids for each auth token request.
35
+ */
36
+ private lastAuthTokenRequestId;
37
+ /**
38
+ * Tracks modal add-ins that have been launched from this add-in.
39
+ */
40
+ private modalRequests;
41
+ /**
42
+ * Counter to provide unique ids for each modal request.
43
+ */
44
+ private lastModalRequestId;
45
+ /**
46
+ * Tracks the current flyout add-in that has been launched from this add-in.
47
+ */
48
+ private flyoutRequest;
49
+ /**
50
+ * Tracks the current confirm dialog that has been launched from this add-in.
51
+ */
52
+ private confirmRequest;
53
+ /**
54
+ * The origin of the host page.
55
+ */
56
+ private trustedOrigin;
57
+ /**
58
+ * A message handler listening to post-message events from the host page.
59
+ */
60
+ private windowMessageHandler;
61
+ /**
62
+ * setInterval id for tracking height changes of the iframe.
63
+ */
64
+ private heightChangeIntervalId;
65
+ /**
66
+ * Tracks the last height posted to the host page.
67
+ */
68
+ private lastPostedIframeHeight;
69
+ /**
70
+ * Stores the registered add-in events.
71
+ * Key - the event type.
72
+ * Value - The callback function to be executed when the event type occurs.
73
+ */
74
+ private registeredAddinEvents;
75
+ /**
76
+ * Stores the add-in events that have been sent to the host page.
77
+ * Key - the event request ID.
78
+ * Value - The Promise resolve function to be executed when the event is received by the host.
79
+ */
80
+ private sentEvents;
81
+ /**
82
+ * Stores the pending add-in events that are queued to be sent to the host page after 200
83
+ * milliseconds have expired.
84
+ * Key - the event type.
85
+ * Value - The Promise reject function to be executed if the event fails to be sent to the host page.
86
+ */
87
+ private pendingSentEvents;
88
+ /**
89
+ * The event request ID counter.
90
+ * The ID is incremented and assigned to each event that is sent.
91
+ */
92
+ private eventRequestId;
93
+ /**
94
+ * An array of event types that are supported by the host page.
95
+ * The add-in client will throw an error if an event is attempted but not one the supported types.
96
+ */
97
+ private supportedEventTypes;
98
+ /**
99
+ * @returns {string} Returns the current query string path for the window, prefixed with ?.
100
+ */
101
+ private static getQueryString;
102
+ constructor(args: AddinClientArgs);
103
+ /**
104
+ * Cleans up the AddinClient, releasing all resources.
105
+ */
106
+ destroy(): void;
107
+ /**
108
+ * Requests the host page to navigate.
109
+ * @param args Arguments describing the navigation request.
110
+ */
111
+ navigate(args: AddinClientNavigateArgs): void;
112
+ /**
113
+ * Requests an authentication token for the current user.
114
+ * @deprecated Use getUserIdentityToken() instead.
115
+ * @returns {Promise<any>} Returns a promise which will resolve with the token value.
116
+ */
117
+ getAuthToken(): Promise<string>;
118
+ /**
119
+ * Requests a user identity token for the current user.
120
+ * @returns {Promise<any>} Returns a promise which will resolve with the token value.
121
+ */
122
+ getUserIdentityToken(): Promise<string>;
123
+ /**
124
+ * Requests the host page to launch a modal add-in.
125
+ * @param args Arguments for launching the modal.
126
+ * @returns {Promise<any>} Returns a promise that will be resolved when the modal add-in is closed.
127
+ * Promise will resolve with context data passed by from the modal add-in's closeModal call.
128
+ */
129
+ showModal(args: AddinClientShowModalArgs): AddinClientShowModalResult;
130
+ /**
131
+ * Informs the host to close this modal add-in.
132
+ * Should only be used from within the modal add-in and not the parent add-in.
133
+ * @param args Arguments to provide a context object back to the parent add-in.
134
+ */
135
+ closeModal(args: AddinClientCloseModalArgs): void;
136
+ /**
137
+ * Informs the host to open the help tab with the specified help key.
138
+ * @param args Arguments for launching the help tab.
139
+ */
140
+ openHelp(args: AddinClientOpenHelpArgs): void;
141
+ /**
142
+ * Informs the host to show a toast message.
143
+ * @param args Arguments for showing a toast.
144
+ */
145
+ showToast(args: AddinClientShowToastArgs): void;
146
+ /**
147
+ * Requests the host page to launch a flyout add-in.
148
+ * @param args Arguments for launching the flyout.
149
+ * @returns {Promise<any>} Returns a promise that will be resolved when the flyout add-in is closed.
150
+ */
151
+ showFlyout(args: AddinClientShowFlyoutArgs): AddinClientShowFlyoutResult;
152
+ /**
153
+ * Requests the host page to close the flyout add-in.
154
+ */
155
+ closeFlyout(): void;
156
+ /**
157
+ * Requests the host page to show a confirm dialog.
158
+ * @param args Arguments for showing a confirm dialog.
159
+ * @returns {Promise<string>} Returns a promise that will resolve with the
160
+ * confirm action when the dialog is closed.
161
+ */
162
+ showConfirm(args: AddinClientShowConfirmArgs): Promise<string>;
163
+ /**
164
+ * Informs the host to show an error dialog.
165
+ * @param args Arguments for showing an error dialog.
166
+ */
167
+ showError(args: AddinClientShowErrorArgs): void;
168
+ /**
169
+ * Requests the host page to show the page blocking wait indicator.
170
+ */
171
+ showWait(): void;
172
+ /**
173
+ * Requests the host page to hide the page blocking wait indicator.
174
+ */
175
+ hideWait(): void;
176
+ /**
177
+ * Registers a callback to be executed when the specified event type occurs.
178
+ * @param eventType The event type to process.
179
+ * @param callback The callback to execute when the event occurs.
180
+ */
181
+ addEventHandler(eventType: string, callback: AddinEventCallback): void;
182
+ /**
183
+ * Sends an event to be handled by the host page.
184
+ * @returns {Promise<void>} Returns a Promise which will resolve when the add-in host page receives the message, or
185
+ * rejects if a subsequent event occurs, for the same event type, within 200 milliseconds.
186
+ * The Promise also rejects if an event type is not one of the supported types from the host page.
187
+ * @see AddinClientInitArgs#supportedEventTypes
188
+ */
189
+ sendEvent(args: AddinClientEventArgs): Promise<void>;
190
+ /**
191
+ * Post a message to the host page informing it that the add-in is
192
+ * now started and listening for messages from the host.
193
+ */
194
+ private raiseAddinReadyMessage;
195
+ /**
196
+ * Handles the modal-closed message from the host.
197
+ * This is emitted to add-ins which have previously launched a modal, which is now
198
+ * closing.
199
+ * @param message The message data, which includes a context object from the closing modal, which should be passed
200
+ * to the calling modal in the showModal promise.
201
+ */
202
+ private handleModalClosedMessage;
203
+ /**
204
+ * Handles host message responses to a get-auth-token request.
205
+ * @param data The message.
206
+ */
207
+ private handleAuthTokenMessage;
208
+ /**
209
+ * Handles message events received from the add-in host page.
210
+ * @param event The event posted from the host.
211
+ */
212
+ private handleMessage;
213
+ /**
214
+ * Validates and registers a value as the origin of the parent page hosting the add-in.
215
+ * If the provided origin matches against our trusted whitelist, then it will be saved.
216
+ * Post messages will implicitly go to this origin and received messages will be filtered
217
+ * to just messages from this origin.
218
+ * @param hostOrigin
219
+ */
220
+ private setKnownAllowedHostOrigin;
221
+ /**
222
+ * Checks if the height of the iFrame has changed since it was last
223
+ * posted to the host page (or if it hasn't been posted yet) and initiates
224
+ * a new post if so.
225
+ */
226
+ private checkForHeightChangesOfAddinContent;
227
+ /**
228
+ * Starts a timeout interval to watch for height changes
229
+ * of the iframe content.
230
+ */
231
+ private trackHeightChangesOfAddinContent;
232
+ /**
233
+ * Posts a message to the parent window.
234
+ * @param message The message content to post.
235
+ * @param targetOrigin Optional. If provided, then the message will be posted to this origin.
236
+ * If not, then it will post to the pre-determined host page origin.
237
+ */
238
+ private postMessageToHostPage;
239
+ /**
240
+ * Processes an add-in event that occurs from the host and responds
241
+ * back to the host with an 'event-received' message.
242
+ * @param message The message to process by looking up executing the registered callback
243
+ * that matches the event type.
244
+ */
245
+ private processHostEvent;
246
+ /**
247
+ * Checks whether an event type is blocking and requires a response from the client
248
+ * before responding to the host.
249
+ * @param type The event type.
250
+ */
251
+ private isBlockingEventType;
252
+ /**
253
+ * Posts a message to the host page to indicate that a certain event has been received.
254
+ * @param eventRequestId The ID of the event request that was received.
255
+ */
256
+ private postEventReceivedMessage;
257
+ /**
258
+ * Attemps to resolve the Promise for a client event that has been received by the host page.
259
+ * @param message Message data that includes the ID of the event that was received.
260
+ */
261
+ private resolveClientEvent;
262
+ /**
263
+ * Checks whether a MessageEvent is from the execetd host origin.
264
+ * @param event
265
+ */
266
+ private isFromValidOrigin;
267
+ /**
268
+ * Log that a message was received with an invalid origin.
269
+ */
270
+ private warnInvalidOrigin;
271
+ /**
272
+ * Reads a query string value from the current window location.
273
+ * @param variable Name of the query string parameter to ready.
274
+ * @returns The value of the query string parameter.
275
+ */
276
+ private getQueryVariable;
277
+ }