@microsoft/teams-js 1.6.0-beta.9 → 1.6.0

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.
@@ -2,4 +2,4 @@ declare module '@microsoft/teams-js' {
2
2
  export = microsoftTeams;
3
3
  }
4
4
  declare namespace microsoftTeams {
5
- export const version = "1.4.1";
6
5
  export const validOrigins: string[];
7
6
  export const frameContexts: {
8
7
  settings: string;
9
8
  content: string;
10
9
  authentication: string;
11
10
  remove: string;
12
11
  task: string;
13
12
  };
14
13
  export const validOriginRegExp: RegExp;
15
14
  export class GlobalVars {
16
15
  static initializeCalled: boolean;
17
16
  static initializeCompleted: boolean;
18
17
  static initializeCallbacks: {
19
18
  (): void;
20
19
  }[];
21
20
  static currentWindow: Window | any;
22
21
  static parentWindow: Window | any;
23
22
  static isFramelessWindow: boolean;
24
23
  static parentOrigin: string;
25
24
  static frameContext: string;
26
25
  static childWindow: Window;
27
26
  static childOrigin: string;
28
27
  static parentMessageQueue: MessageRequest[];
29
28
  static childMessageQueue: MessageRequest[];
30
29
  static nextMessageId: number;
31
30
  static handlers: {
32
31
  [func: string]: Function;
33
32
  };
34
33
  static callbacks: {
35
34
  [id: number]: Function;
36
35
  };
37
36
  static hostClientType: string;
38
37
  static printCapabilityEnabled: boolean;
39
38
  static themeChangeHandler: (theme: string) => void;
40
39
  static fullScreenChangeHandler: (isFullScreen: boolean) => void;
41
40
  static backButtonPressHandler: () => boolean;
42
41
  static loadHandler: (context: LoadContext) => void;
43
42
  static beforeUnloadHandler: (readyToUnload: () => void) => boolean;
44
43
  static changeSettingsHandler: () => void;
45
44
  static onStartConversationHandler: (conversationResponse: ConversationResponse) => void;
46
45
  static onCloseConversationHandler: (conversationResponse: ConversationResponse) => void;
47
46
  static getLogHandler: () => string;
48
47
  }
49
48
  /**
50
49
  * @private
51
50
  * Hide from docs
52
51
  * Shim in definitions used for browser-compat
53
52
  */
54
53
  export interface MessageEvent {
55
54
  origin?: any;
56
55
  source?: any;
57
56
  data?: any;
58
57
  originalEvent: MessageEvent;
59
58
  }
60
59
  /**
61
60
  * @private
62
61
  * Hide from docs
63
62
  */
64
63
  export interface TeamsNativeClient {
65
64
  framelessPostMessage(msg: string): void;
66
65
  }
67
66
  /**
68
67
  * @private
69
68
  * Hide from docs
70
69
  */
71
70
  export interface ExtendedWindow extends Window {
72
71
  nativeInterface: TeamsNativeClient;
73
72
  onNativeMessage(evt: MessageEvent): void;
74
73
  }
75
74
  export interface MessageRequest {
76
75
  id: number;
77
76
  func: string;
78
77
  args?: any[];
79
78
  }
80
79
  export interface MessageResponse {
81
80
  id: number;
82
81
  args?: any[];
83
82
  }
84
83
  export function ensureInitialized(...expectedFrameContexts: string[]): void;
85
84
  export function processMessage(evt: MessageEvent): void;
86
85
  export function handleParentMessage(evt: MessageEvent): void;
87
86
  export function waitForMessageQueue(targetWindow: Window, callback: () => void): void;
88
87
  export function sendMessageRequest(targetWindow: Window | any, actionName: string, args?: any[]): number;
89
88
  export function generateRegExpFromUrls(urls: string[]): RegExp;
90
89
  export function getGenericOnCompleteHandler(errorMessage?: string): (success: boolean, reason?: string) => void;
91
90
  /**
92
91
  * @private
93
92
  * Namespace to interact with bots using the SDK.
94
93
  */
95
94
  export namespace bot {
96
95
  /**
97
96
  * @private
98
97
  * Hide from docs until release.
99
98
  * ------
100
99
  * Sends query to bot in order to retrieve data.
101
100
  * @param botRequest query to send to bot.
102
101
  * @param onSuccess callback to invoke when data is retrieved from bot
103
102
  * @param onError callback to invoke should an error occur
104
103
  */
105
104
  function sendQuery(botRequest: QueryRequest, onSuccess?: (data: QueryResponse) => void, onError?: (error: string) => void): void;
106
105
  /**
107
106
  * @private
108
107
  * Hide from docs until release.
109
108
  * -----
110
109
  * Retrieves list of support commands from bot
111
110
  * @param onSuccess callback to invoke when data is retrieved from bot
112
111
  * @param onError callback to invoke should an error occur
113
112
  */
114
113
  function getSupportedCommands(onSuccess?: (response: Command[]) => void, onError?: (error: string) => void): void;
115
114
  /**
116
115
  * @private
117
116
  * Hide from docs until release.
118
117
  * -----
119
118
  * Authenticates a user for json tab
120
119
  * @param authRequest callback to invoke when data is retrieved from bot
121
120
  * @param onSuccess callback to invoke when user is authenticated
122
121
  * @param onError callback to invoke should an error occur
123
122
  */
124
123
  function authenticate(authRequest: AuthQueryRequest, onSuccess?: (results: Results) => void, onError?: (error: string) => void): void;
125
124
  interface QueryRequest {
126
125
  /**
127
126
  * Query to search for
128
127
  */
129
128
  query: string;
130
129
  commandId?: string;
131
130
  option?: {
132
131
  skip: number;
133
132
  count: number;
134
133
  };
135
134
  }
136
135
  interface QueryResponse {
137
136
  data: Results | Auth;
138
137
  type: ResponseType;
139
138
  }
140
139
  interface Results {
141
140
  attachments: Attachment[];
142
141
  layout: any;
143
142
  botId: string;
144
143
  }
145
144
  interface Auth {
146
145
  url: string;
147
146
  title: string;
148
147
  }
149
148
  interface AuthQueryRequest extends QueryRequest {
150
149
  url: string;
151
150
  }
152
151
  interface Attachment {
153
152
  card: any;
154
153
  previewCard: any;
155
154
  previewRawPayload: any;
156
155
  rawPayload: any;
157
156
  }
158
157
  interface Command {
159
158
  title: string;
160
159
  id: string;
161
160
  initialRun: boolean;
162
161
  }
163
162
  enum ResponseType {
164
163
  Results = "Results",
165
164
  Auth = "Auth"
166
165
  }
167
166
  }
168
167
  /**
169
168
  * Namespace to interact with the conversational subEntities inside the tab
170
169
  */
171
170
  export namespace conversations {
172
171
  /**
173
172
  * @private
174
173
  * Hide from docs
175
174
  * --------------
176
175
  * Allows the user to start or continue a conversation with each subentity inside the tab
177
176
  */
178
177
  function openConversation(openConversationRequest: OpenConversationRequest): void;
179
178
  /**
180
179
  * @private
181
180
  * Hide from docs
182
181
  * --------------
183
182
  * Allows the user to close the conversation in the right pane
184
183
  */
185
184
  function closeConversation(): void;
186
185
  }
187
186
  /**
188
187
  * @private
189
188
  * Hide from docs
190
189
  * --------
191
190
  * Information about all members in a chat
192
191
  */
193
192
  export interface ChatMembersInformation {
194
193
  members: ThreadMember[];
195
194
  }
196
195
  /**
197
196
  * @private
198
197
  * Hide from docs
199
198
  * --------
200
199
  * Information about a chat member
201
200
  */
202
201
  export interface ThreadMember {
203
202
  /**
204
203
  * The member's user principal name in the current tenant.
205
204
  */
206
205
  upn: string;
207
206
  }
208
207
  export const enum NotificationTypes {
209
208
  fileDownloadStart = "fileDownloadStart",
210
209
  fileDownloadComplete = "fileDownloadComplete"
211
210
  }
212
211
  export interface ShowNotificationParameters {
213
212
  message: string;
214
213
  notificationType: NotificationTypes;
215
214
  }
216
215
  /**
217
216
  * @private
218
217
  * Hide from docs.
219
218
  * ------
220
219
  */
221
220
  export interface FilePreviewParameters {
222
221
  /**
223
222
  * The developer-defined unique ID for the file.
224
223
  */
225
224
  entityId: string;
226
225
  /**
227
226
  * The display name of the file.
228
227
  */
229
228
  title: string;
230
229
  /**
231
230
  * An optional description of the file.
232
231
  */
233
232
  description?: string;
234
233
  /**
235
234
  * The file extension; e.g. pptx, docx, etc.
236
235
  */
237
236
  type: string;
238
237
  /**
239
238
  * A url to the source of the file, used to open the content in the user's default browser
240
239
  */
241
240
  objectUrl: string;
242
241
  /**
243
242
  * Optional; an alternate self-authenticating url used to preview the file in Mobile clients and offer it for download by the user
244
243
  */
245
244
  downloadUrl?: string;
246
245
  /**
247
246
  * Optional; an alternate url optimized for previewing the file in Teams web and desktop clients
248
247
  */
249
248
  webPreviewUrl?: string;
250
249
  /**
251
250
  * Optional; an alternate url that allows editing of the file in Teams web and desktop clients
252
251
  */
253
252
  webEditUrl?: string;
254
253
  /**
255
254
  * Optional; the base url of the site where the file is hosted
256
255
  */
257
256
  baseUrl?: string;
258
257
  /**
259
258
  * Optional; indicates whether the file should be opened in edit mode
260
259
  */
261
260
  editFile?: boolean;
262
261
  /**
263
262
  * Optional; the developer-defined unique ID for the sub-entity to return to when the file stage closes.
264
263
  * This field should be used to restore to a specific state within an entity, such as scrolling to or activating a specific piece of content.
265
264
  */
266
265
  subEntityId?: string;
267
266
  }
268
267
  /**
269
268
  * @private
270
269
  * Hide from docs
271
270
  * --------
272
271
  * Query parameters used when fetching team information
273
272
  */
274
273
  export interface TeamInstanceParameters {
275
274
  /**
276
275
  * Flag allowing to select favorite teams only
277
276
  */
278
277
  favoriteTeamsOnly?: boolean;
279
278
  }
280
279
  /**
281
280
  * @private
282
281
  * Hide from docs
283
282
  * --------
284
283
  * Information on userJoined Teams
285
284
  */
286
285
  export interface UserJoinedTeamsInformation {
287
286
  /**
288
287
  * List of team information
289
288
  */
290
289
  userJoinedTeams: TeamInformation[];
291
290
  }
292
291
  /**
293
292
  * Namespace to interact with the logging part of the SDK.
294
293
  * This object is used to send the app logs on demand to the host client
295
294
  *
296
295
  * @private
297
296
  * Hide from docs
298
297
  */
299
298
  export namespace logs {
300
299
  /**
301
300
  * @private
302
301
  * Hide from docs
303
302
  * ------
304
303
  * Registers a handler for getting app log
305
304
  * @param handler The handler to invoke to get the app log
306
305
  */
307
306
  function registerGetLogHandler(handler: () => string): void;
308
307
  }
309
308
  /**
310
309
  * Namespace to interact with the menu-specific part of the SDK.
311
310
  * This object is used to show View Configuration, Action Menu and Navigation Bar Menu.
312
311
  *
313
312
  * @private
314
313
  * Hide from docs until feature is complete
315
314
  */
316
315
  export namespace menus {
317
316
  /**
318
317
  * Represents information about item in View Configuration.
319
318
  */
320
319
  interface ViewConfiguration {
321
320
  /**
322
321
  * Unique identifier of view.
323
322
  */
324
323
  id: string;
325
324
  /**
326
325
  * Display title of the view.
327
326
  */
328
327
  title: string;
329
328
  /**
330
329
  * Additional information for accessibility.
331
330
  */
332
331
  contentDescription?: string;
333
332
  }
334
333
  /**
335
334
  * Represents information about menu item for Action Menu and Navigation Bar Menu.
336
335
  */
337
336
  class MenuItem {
338
337
  /**
339
338
  * Unique identifier for the menu item.
340
339
  */
341
340
  id: string;
342
341
  /**
343
342
  * Display title of the menu item.
344
343
  */
345
344
  title: string;
346
345
  /**
347
346
  * Display icon of the menu item. The icon value must be a string having SVG icon content.
348
347
  */
349
348
  icon?: string;
350
349
  /**
351
350
  * Selected state display icon of the menu item. The icon value must be a string having SVG icon content.
352
351
  */
353
352
  iconSelected?: string;
354
353
  /**
355
354
  * Additional information for accessibility.
356
355
  */
357
356
  contentDescription?: string;
358
357
  /**
359
358
  * State of the menu item
360
359
  */
361
360
  enabled: boolean;
362
361
  /**
363
362
  * Interface to show list of items on selection of menu item.
364
363
  */
365
364
  viewData: ViewData;
366
365
  }
367
366
  /**
368
367
  * Represents information about view to show on Navigation Bar Menu item selection
369
368
  */
370
369
  interface ViewData {
371
370
  /**
372
371
  * Display header title of the item list.
373
372
  */
374
373
  listTitle?: string;
375
374
  /**
376
375
  * Type of the menu item.
377
376
  */
378
377
  listType: MenuListType;
379
378
  /**
380
379
  * Array of MenuItem. Icon value will be required for all items in the list.
381
380
  */
382
381
  listItems: MenuItem[];
383
382
  }
384
383
  /**
385
384
  * Represents information about type of list to display in Navigation Bar Menu.
386
385
  */
387
386
  enum MenuListType {
388
387
  dropDown = "dropDown",
389
388
  popOver = "popOver"
390
389
  }
391
390
  /**
392
391
  * Registers list of view configurations and it's handler.
393
392
  * Handler is responsible for listening selection of View Configuration.
394
393
  * @param viewConfig List of view configurations. Minimum 1 value is required.
395
394
  * @param handler The handler to invoke when the user selects view configuration.
396
395
  */
397
396
  function setUpViews(viewConfig: ViewConfiguration[], handler: (id: string) => boolean): void;
398
397
  /**
399
398
  * Used to set menu items on the Navigation Bar. If icon is available, icon will be shown, otherwise title will be shown.
400
399
  * @param items List of MenuItems for Navigation Bar Menu.
401
400
  * @param handler The handler to invoke when the user selects menu item.
402
401
  */
403
402
  function setNavBarMenu(items: MenuItem[], handler: (id: string) => boolean): void;
404
403
  interface ActionMenuParameters {
405
404
  /**
406
405
  * Display title for Action Menu
407
406
  */
408
407
  title: string;
409
408
  /**
410
409
  * List of MenuItems for Action Menu
411
410
  */
412
411
  items: MenuItem[];
413
412
  }
414
413
  /**
415
414
  * Used to show Action Menu.
416
415
  * @param params Parameters for Menu Parameters
417
416
  * @param handler The handler to invoke when the user selects menu item.
418
417
  */
419
418
  function showActionMenu(params: ActionMenuParameters, handler: (id: string) => boolean): void;
420
419
  }
421
420
  /**
422
421
  * @private
423
422
  * Hide from docs
424
423
  * ------
425
424
  * Allows an app to retrieve information of all user joined teams
426
425
  * @param callback The callback to invoke when the {@link TeamInstanceParameters} object is retrieved.
427
426
  * @param teamInstanceParameters OPTIONAL Flags that specify whether to scope call to favorite teams
428
427
  */
429
428
  export function getUserJoinedTeams(callback: (userJoinedTeamsInformation: UserJoinedTeamsInformation) => void, teamInstanceParameters?: TeamInstanceParameters): void;
430
429
  /**
431
430
  * @private
432
431
  * Hide from docs
433
432
  * ------
434
433
  * Place the tab into full-screen mode.
435
434
  */
436
435
  export function enterFullscreen(): void;
437
436
  /**
438
437
  * @private
439
438
  * Hide from docs
440
439
  * ------
441
440
  * Reverts the tab into normal-screen mode.
442
441
  */
443
442
  export function exitFullscreen(): void;
444
443
  /**
445
444
  * @private
446
445
  * Hide from docs.
447
446
  * ------
448
447
  * Opens a client-friendly preview of the specified file.
449
448
  * @param file The file to preview.
450
449
  */
451
450
  export function openFilePreview(filePreviewParameters: FilePreviewParameters): void;
452
451
  /**
453
452
  * @private
454
453
  * Hide from docs.
455
454
  * ------
456
455
  * display notification API.
457
456
  * @param message Notification message.
458
457
  * @param notificationType Notification type
459
458
  */
460
459
  export function showNotification(showNotificationParameters: ShowNotificationParameters): void;
461
460
  /**
462
461
  * @private
463
462
  * Hide from docs.
464
463
  * ------
465
464
  * Upload a custom App manifest directly to both team and personal scopes.
466
465
  * This method works just for the first party Apps.
467
466
  */
468
467
  export function uploadCustomApp(manifestBlob: Blob, onComplete?: (status: boolean, reason?: string) => void): void;
469
468
  /**
470
469
  * @private
471
470
  * Internal use only
472
471
  * Sends a custom action message to Teams.
473
472
  * @param actionName Specifies name of the custom action to be sent
474
473
  * @param args Specifies additional arguments passed to the action
475
474
  * @returns id of sent message
476
475
  */
477
476
  export function sendCustomMessage(actionName: string, args?: any[]): number;
478
477
  /**
479
478
  * @private
480
479
  * Hide from docs
481
480
  * ------
482
481
  * Allows an app to retrieve information of all chat members
483
482
  * Because a malicious party run your content in a browser, this value should
484
483
  * be used only as a hint as to who the members are and never as proof of membership.
485
484
  * @param callback The callback to invoke when the {@link ChatMembersInformation} object is retrieved.
486
485
  */
487
486
  export function getChatMembers(callback: (chatMembersInformation: ChatMembersInformation) => void): void;
488
487
  /**
489
488
  * @private
490
489
  * Hide from docs
491
490
  * ------
492
491
  * Allows an app to get the configuration setting value
493
492
  * @param callback The callback to invoke when the value is retrieved.
494
493
  * @param key The key for the config setting
495
494
  */
496
495
  export function getConfigSetting(callback: (value: string) => void, key: string): void;
497
496
  export namespace appInitialization {
498
497
  /**
499
498
  * To notify app loaded to hide loading indicator
500
499
  */
501
500
  function notifyAppLoaded(): void;
502
501
  /**
503
502
  * To notify app Initialization successs and ready for user interaction
504
503
  */
505
504
  function notifySuccess(): void;
506
505
  /**
507
506
  * To notify app Initialization failed
508
507
  */
509
508
  function notifyFailure(appInitializationFailedRequest: appInitialization.IFailedRequest): void;
510
509
  const enum FailedReason {
511
510
  AuthFailed = "AuthFailed",
512
511
  Timeout = "Timeout",
513
512
  Other = "Other"
514
513
  }
515
514
  interface IFailedRequest {
516
515
  reason: appInitialization.FailedReason;
517
516
  message?: string;
518
517
  }
519
518
  }
520
519
  export interface IAppWindow {
521
520
  postMessage(message: any): void;
522
521
  addEventListener(type: string, listener: Function): void;
523
522
  }
524
523
  export class ChildAppWindow implements IAppWindow {
525
524
  postMessage(message: any, onComplete?: (status: boolean, reason?: string) => void): void;
526
525
  addEventListener(type: string, listener: (message: any) => void): void;
527
526
  }
528
527
  export class ParentAppWindow implements IAppWindow {
529
528
  private static _instance;
530
529
  static readonly Instance: IAppWindow;
531
530
  postMessage(message: any, onComplete?: (status: boolean, reason?: string) => void): void;
532
531
  addEventListener(type: string, listener: (message: any) => void): void;
533
532
  }
534
533
  /**
535
534
  * Namespace to interact with the authentication-specific part of the SDK.
536
535
  * This object is used for starting or completing authentication flows.
537
536
  */
538
537
  export namespace authentication {
539
538
  /**
540
539
  * Registers the authentication GlobalVars.handlers
541
540
  * @param authenticateParameters A set of values that configure the authentication pop-up.
542
541
  */
543
542
  function registerAuthenticationHandlers(authenticateParameters: AuthenticateParameters): void;
544
543
  /**
545
544
  * Initiates an authentication request, which opens a new window with the specified settings.
546
545
  */
547
546
  function authenticate(authenticateParameters?: AuthenticateParameters): void;
548
547
  /**
549
548
  * @private
550
549
  * Hide from docs.
551
550
  * ------
552
551
  * Requests an Azure AD token to be issued on behalf of the app. The token is acquired from the cache
553
552
  * if it is not expired. Otherwise a request is sent to Azure AD to obtain a new token.
554
553
  * @param authTokenRequest A set of values that configure the token request.
555
554
  */
556
555
  function getAuthToken(authTokenRequest: AuthTokenRequest): void;
557
556
  /**
558
557
  * @private
559
558
  * Hide from docs.
560
559
  * ------
561
560
  * Requests the decoded Azure AD user identity on behalf of the app.
562
561
  */
563
562
  function getUser(userRequest: UserRequest): void;
564
563
  /**
565
564
  * Notifies the frame that initiated this authentication request that the request was successful.
566
565
  * This function is usable only on the authentication window.
567
566
  * This call causes the authentication window to be closed.
568
567
  * @param result Specifies a result for the authentication. If specified, the frame that initiated the authentication pop-up receives this value in its callback.
569
568
  * @param callbackUrl Specifies the url to redirect back to if the client is Win32 Outlook.
570
569
  */
571
570
  function notifySuccess(result?: string, callbackUrl?: string): void;
572
571
  /**
573
572
  * Notifies the frame that initiated this authentication request that the request failed.
574
573
  * This function is usable only on the authentication window.
575
574
  * This call causes the authentication window to be closed.
576
575
  * @param result Specifies a result for the authentication. If specified, the frame that initiated the authentication pop-up receives this value in its callback.
577
576
  * @param callbackUrl Specifies the url to redirect back to if the client is Win32 Outlook.
578
577
  */
579
578
  function notifyFailure(reason?: string, callbackUrl?: string): void;
580
579
  interface AuthenticateParameters {
581
580
  /**
582
581
  * The URL for the authentication pop-up.
583
582
  */
584
583
  url: string;
585
584
  /**
586
585
  * The preferred width for the pop-up. This value can be ignored if outside the acceptable bounds.
587
586
  */
588
587
  width?: number;
589
588
  /**
590
589
  * The preferred height for the pop-up. This value can be ignored if outside the acceptable bounds.
591
590
  */
592
591
  height?: number;
593
592
  /**
594
593
  * A function that is called if the authentication succeeds, with the result returned from the authentication pop-up.
595
594
  */
596
595
  successCallback?: (result?: string) => void;
597
596
  /**
598
597
  * A function that is called if the authentication fails, with the reason for the failure returned from the authentication pop-up.
599
598
  */
600
599
  failureCallback?: (reason?: string) => void;
601
600
  }
602
601
  /**
603
602
  * @private
604
603
  * Hide from docs.
605
604
  * ------
606
605
  */
607
606
  interface AuthTokenRequest {
608
607
  /**
609
608
  * An array of resource URIs identifying the target resources for which the token should be requested.
610
609
  */
611
610
  resources: string[];
612
611
  /**
613
612
  * A function that is called if the token request succeeds, with the resulting token.
614
613
  */
615
614
  successCallback?: (token: string) => void;
616
615
  /**
617
616
  * A function that is called if the token request fails, with the reason for the failure.
618
617
  */
619
618
  failureCallback?: (reason: string) => void;
620
619
  }
621
620
  /**
622
621
  * @private
623
622
  * Hide from docs.
624
623
  * ------
625
624
  */
626
625
  interface UserRequest {
627
626
  /**
628
627
  * A function that is called if the token request succeeds, with the resulting token.
629
628
  */
630
629
  successCallback?: (user: UserProfile) => void;
631
630
  /**
632
631
  * A function that is called if the token request fails, with the reason for the failure.
633
632
  */
634
633
  failureCallback?: (reason: string) => void;
635
634
  }
636
635
  /**
637
636
  * @private
638
637
  * Hide from docs.
639
638
  * ------
640
639
  */
641
640
  interface UserProfile {
642
641
  /**
643
642
  * The intended recipient of the token. The application that receives the token must verify that the audience
644
643
  * value is correct and reject any tokens intended for a different audience.
645
644
  */
646
645
  aud: string;
647
646
  /**
648
647
  * Identifies how the subject of the token was authenticated.
649
648
  */
650
649
  amr: string[];
651
650
  /**
652
651
  * Stores the time at which the token was issued. It is often used to measure token freshness.
653
652
  */
654
653
  iat: number;
655
654
  /**
656
655
  * Identifies the security token service (STS) that constructs and returns the token. In the tokens that Azure AD
657
656
  * returns, the issuer is sts.windows.net. The GUID in the issuer claim value is the tenant ID of the Azure AD
658
657
  * directory. The tenant ID is an immutable and reliable identifier of the directory.
659
658
  */
660
659
  iss: string;
661
660
  /**
662
661
  * Provides the last name, surname, or family name of the user as defined in the Azure AD user object.
663
662
  */
664
663
  family_name: string;
665
664
  /**
666
665
  * Provides the first or "given" name of the user, as set on the Azure AD user object.
667
666
  */
668
667
  given_name: string;
669
668
  /**
670
669
  * Provides a human-readable value that identifies the subject of the token. This value is not guaranteed to
671
670
  * be unique within a tenant and is designed to be used only for display purposes.
672
671
  */
673
672
  unique_name: string;
674
673
  /**
675
674
  * Contains a unique identifier of an object in Azure AD. This value is immutable and cannot be reassigned or
676
675
  * reused. Use the object ID to identify an object in queries to Azure AD.
677
676
  */
678
677
  oid: string;
679
678
  /**
680
679
  * Identifies the principal about which the token asserts information, such as the user of an application.
681
680
  * This value is immutable and cannot be reassigned or reused, so it can be used to perform authorization
682
681
  * checks safely. Because the subject is always present in the tokens the Azure AD issues, we recommended
683
682
  * using this value in a general-purpose authorization system.
684
683
  */
685
684
  sub: string;
686
685
  /**
687
686
  * An immutable, non-reusable identifier that identifies the directory tenant that issued the token. You can
688
687
  * use this value to access tenant-specific directory resources in a multitenant application. For example,
689
688
  * you can use this value to identify the tenant in a call to the Graph API.
690
689
  */
691
690
  tid: string;
692
691
  /**
693
692
  * Defines the time interval within which a token is valid. The service that validates the token should verify
694
693
  * that the current date is within the token lifetime; otherwise it should reject the token. The service might
695
694
  * allow for up to five minutes beyond the token lifetime to account for any differences in clock time ("time
696
695
  * skew") between Azure AD and the service.
697
696
  */
698
697
  exp: number;
699
698
  nbf: number;
700
699
  /**
701
700
  * Stores the user name of the user principal.
702
701
  */
703
702
  upn: string;
704
703
  /**
705
704
  * Stores the version number of the token.
706
705
  */
707
706
  ver: string;
708
707
  }
709
708
  }
710
709
  export const enum HostClientType {
711
710
  desktop = "desktop",
712
711
  web = "web",
713
712
  android = "android",
714
713
  ios = "ios",
715
714
  rigel = "rigel"
716
715
  }
717
716
  /**
718
717
  * Indicates the team type, currently used to distinguish between different team
719
718
  * types in Office 365 for Education (team types 1, 2, 3, and 4).
720
719
  */
721
720
  export const enum TeamType {
722
721
  Standard = 0,
723
722
  Edu = 1,
724
723
  Class = 2,
725
724
  Plc = 3,
726
725
  Staff = 4
727
726
  }
728
727
  /**
729
728
  * Indicates the various types of roles of a user in a team.
730
729
  */
731
730
  export const enum UserTeamRole {
732
731
  Admin = 0,
733
732
  User = 1,
734
733
  Guest = 2
735
734
  }
736
735
  export const enum TaskModuleDimension {
737
736
  Large = "large",
738
737
  Medium = "medium",
739
738
  Small = "small"
740
739
  }
741
740
  /**
742
741
  * The type of the channel with which the content is associated.
743
742
  */
744
743
  export const enum ChannelType {
745
744
  Regular = "Regular",
746
745
  Private = "Private"
747
746
  }
748
747
  /**
749
748
  * Represents information about tabs for an app
750
749
  */
751
750
  export interface TabInformation {
752
751
  teamTabs: TabInstance[];
753
752
  }
754
753
  /**
755
754
  * Represents information about a tab instance
756
755
  */
757
756
  export interface TabInstance {
758
757
  /**
759
758
  * The name of the tab
760
759
  */
761
760
  tabName: string;
762
761
  /**
763
762
  * Internal: do not use
764
763
  * @protected
765
764
  */
766
765
  internalTabInstanceId?: string;
767
766
  /**
768
767
  * Last viewed time of this tab. null means unknown
769
768
  */
770
769
  lastViewUnixEpochTime?: string;
771
770
  /**
772
771
  * The developer-defined unique ID for the entity this content points to.
773
772
  */
774
773
  entityId?: string;
775
774
  /**
776
775
  * The Microsoft Teams ID for the channel with which the content is associated.
777
776
  */
778
777
  channelId?: string;
779
778
  /**
780
779
  * The name for the channel with which the content is associated.
781
780
  */
782
781
  channelName?: string;
783
782
  /**
784
783
  * Is this tab in a favorite channel?
785
784
  */
786
785
  channelIsFavorite?: boolean;
787
786
  /**
788
787
  * The Microsoft Teams ID for the team with which the content is associated.
789
788
  */
790
789
  teamId?: string;
791
790
  /**
792
791
  * The name for the team with which the content is associated.
793
792
  */
794
793
  teamName?: string;
795
794
  /**
796
795
  * Is this tab in a favorite team?
797
796
  */
798
797
  teamIsFavorite?: boolean;
799
798
  /**
800
799
  * The Office 365 group ID for the team with which the content is associated.
801
800
  * This field is available only when the identity permission is requested in the manifest.
802
801
  */
803
802
  groupId?: string;
804
803
  /**
805
804
  * Content URL of this tab
806
805
  */
807
806
  url?: string;
808
807
  /**
809
808
  * Website URL of this tab
810
809
  */
811
810
  websiteUrl?: string;
812
811
  }
813
812
  /**
814
813
  * Indicates information about the tab instance for filtering purposes.
815
814
  */
816
815
  export interface TabInstanceParameters {
817
816
  /**
818
817
  * Flag allowing to select favorite channels only
819
818
  */
820
819
  favoriteChannelsOnly?: boolean;
821
820
  /**
822
821
  * Flag allowing to select favorite teams only
823
822
  */
824
823
  favoriteTeamsOnly?: boolean;
825
824
  }
826
825
  /**
827
826
  * Represents Team Information
828
827
  */
829
828
  export interface TeamInformation {
830
829
  /**
831
830
  * Id of the team
832
831
  */
833
832
  teamId: string;
834
833
  /**
835
834
  * Team display name
836
835
  */
837
836
  teamName: string;
838
837
  /**
839
838
  * Team description
840
839
  */
841
840
  teamDescription?: string;
842
841
  /**
843
842
  * Thumbnail Uri
844
843
  */
845
844
  thumbnailUri?: string;
846
845
  /**
847
846
  * The Office 365 group ID for the team with which the content is associated.
848
847
  * This field is available only when the identity permission is requested in the manifest.
849
848
  */
850
849
  groupId?: string;
851
850
  /**
852
851
  * Role of current user in the team
853
852
  */
854
853
  userTeamRole?: UserTeamRole;
855
854
  }
856
855
  export interface Context {
857
856
  /**
858
857
  * The Office 365 group ID for the team with which the content is associated.
859
858
  * This field is available only when the identity permission is requested in the manifest.
860
859
  */
861
860
  groupId?: string;
862
861
  /**
863
862
  * The Microsoft Teams ID for the team with which the content is associated.
864
863
  */
865
864
  teamId?: string;
866
865
  /**
867
866
  * The name for the team with which the content is associated.
868
867
  */
869
868
  teamName?: string;
870
869
  /**
871
870
  * The Microsoft Teams ID for the channel with which the content is associated.
872
871
  */
873
872
  channelId?: string;
874
873
  /**
875
874
  * The name for the channel with which the content is associated.
876
875
  */
877
876
  channelName?: string;
878
877
  /**
879
878
  * The type of the channel with which the content is associated.
880
879
  */
881
880
  channelType?: ChannelType;
882
881
  /**
883
882
  * The developer-defined unique ID for the entity this content points to.
884
883
  */
885
884
  entityId: string;
886
885
  /**
887
886
  * The developer-defined unique ID for the sub-entity this content points to.
888
887
  * This field should be used to restore to a specific state within an entity, such as scrolling to or activating a specific piece of content.
889
888
  */
890
889
  subEntityId?: string;
891
890
  /**
892
891
  * The current locale that the user has configured for the app formatted as
893
892
  * languageId-countryId (for example, en-us).
894
893
  */
895
894
  locale: string;
896
895
  /**
897
896
  * @deprecated Use loginHint or userPrincipalName.
898
897
  * The UPN of the current user.
899
898
  * Because a malicious party can run your content in a browser, this value should
900
899
  * be used only as a hint as to who the user is and never as proof of identity.
901
900
  * This field is available only when the identity permission is requested in the manifest.
902
901
  */
903
902
  upn?: string;
904
903
  /**
905
904
  * The Azure AD tenant ID of the current user.
906
905
  * Because a malicious party can run your content in a browser, this value should
907
906
  * be used only as a hint as to who the user is and never as proof of identity.
908
907
  * This field is available only when the identity permission is requested in the manifest.
909
908
  */
910
909
  tid?: string;
911
910
  /**
912
911
  * The current UI theme.
913
912
  */
914
913
  theme?: string;
915
914
  /**
916
915
  * Indication whether the tab is in full-screen mode.
917
916
  */
918
917
  isFullScreen?: boolean;
919
918
  /**
920
919
  * The type of the team.
921
920
  */
922
921
  teamType?: TeamType;
923
922
  /**
924
923
  * The root SharePoint site associated with the team.
925
924
  */
926
925
  teamSiteUrl?: string;
927
926
  /**
928
927
  * The domain of the root SharePoint site associated with the team.
929
928
  */
930
929
  teamSiteDomain?: string;
931
930
  /**
932
931
  * The relative path to the SharePoint site associated with the team.
933
932
  */
934
933
  teamSitePath?: string;
935
934
  /**
936
935
  * The relative path to the SharePoint folder associated with the channel.
937
936
  */
938
937
  channelRelativeUrl?: string;
939
938
  /**
940
939
  * Unique ID for the current Teams session for use in correlating telemetry data.
941
940
  */
942
941
  sessionId?: string;
943
942
  /**
944
943
  * The user's role in the team.
945
944
  * Because a malicious party can run your content in a browser, this value should
946
945
  * be used only as a hint as to the user's role, and never as proof of her role.
947
946
  */
948
947
  userTeamRole?: UserTeamRole;
949
948
  /**
950
949
  * The Microsoft Teams ID for the chat with which the content is associated.
951
950
  */
952
951
  chatId?: string;
953
952
  /**
954
953
  * A value suitable for use as a login_hint when authenticating with Azure AD.
955
954
  * Because a malicious party can run your content in a browser, this value should
956
955
  * be used only as a hint as to who the user is and never as proof of identity.
957
956
  * This field is available only when the identity permission is requested in the manifest.
958
957
  */
959
958
  loginHint?: string;
960
959
  /**
961
960
  * The UPN of the current user. This may be an externally-authenticated UPN (e.g., guest users).
962
961
  * Because a malicious party run your content in a browser, this value should
963
962
  * be used only as a hint as to who the user is and never as proof of identity.
964
963
  * This field is available only when the identity permission is requested in the manifest.
965
964
  */
966
965
  userPrincipalName?: string;
967
966
  /**
968
967
  * The Azure AD object id of the current user.
969
968
  * Because a malicious party run your content in a browser, this value should
970
969
  * be used only as a hint as to who the user is and never as proof of identity.
971
970
  * This field is available only when the identity permission is requested in the manifest.
972
971
  */
973
972
  userObjectId?: string;
974
973
  /**
975
974
  * Indicates whether team is archived.
976
975
  * Apps should use this as a signal to prevent any changes to content associated with archived teams.
977
976
  */
978
977
  isTeamArchived?: boolean;
979
978
  /**
980
979
  * The type of the host client. Possible values are : android, ios, web, desktop, rigel
981
980
  */
982
981
  hostClientType?: HostClientType;
983
982
  /**
984
983
  * SharePoint context. This is only available when hosted in SharePoint.
985
984
  */
986
985
  sharepoint?: any;
987
986
  /**
988
987
  * The type of license for the current users tenant.
989
988
  */
990
989
  tenantSKU?: string;
991
990
  /**
992
991
  * The license type for the current user.
993
992
  */
994
993
  userLicenseType?: string;
995
994
  /**
996
995
  * The ID of the parent message from which this task module was launched.
997
996
  * This is only available in task modules launched from bot cards.
998
997
  */
999
998
  parentMessageId?: string;
1000
999
  /**
1001
1000
  * Current ring ID
1002
1001
  */
1003
1002
  ringId?: string;
1004
1003
  /**
1005
1004
  * Unique ID for the current session for use in correlating telemetry data.
1006
1005
  */
1007
1006
  appSessionId?: string;
1008
1007
  }
1009
1008
  export interface DeepLinkParameters {
1010
1009
  /**
1011
1010
  * The developer-defined unique ID for the sub-entity to which this deep link points in the current entity.
1012
1011
  * This field should be used to restore to a specific state within an entity, such as scrolling to or activating a specific piece of content.
1013
1012
  */
1014
1013
  subEntityId: string;
1015
1014
  /**
1016
1015
  * The label for the sub-entity that should be displayed when the deep link is rendered in a client.
1017
1016
  */
1018
1017
  subEntityLabel: string;
1019
1018
  /**
1020
1019
  * The fallback URL to which to navigate the user if the client cannot render the page.
1021
1020
  * This URL should lead directly to the sub-entity.
1022
1021
  */
1023
1022
  subEntityWebUrl?: string;
1024
1023
  }
1025
1024
  export interface TaskInfo {
1026
1025
  /**
1027
1026
  * The url to be rendered in the webview/iframe.
1028
1027
  */
1029
1028
  url?: string;
1030
1029
  /**
1031
1030
  * JSON defining an adaptive card.
1032
1031
  */
1033
1032
  card?: string;
1034
1033
  /**
1035
1034
  * The requested height of the webview/iframe.
1036
1035
  */
1037
1036
  height?: TaskModuleDimension | number;
1038
1037
  /**
1039
1038
  * The requested width of the webview/iframe.
1040
1039
  */
1041
1040
  width?: TaskModuleDimension | number;
1042
1041
  /**
1043
1042
  * Title of the task module.
1044
1043
  */
1045
1044
  title?: string;
1046
1045
  /**
1047
1046
  * If client doesnt support the URL, the URL that needs to be opened in the browser.
1048
1047
  */
1049
1048
  fallbackUrl?: string;
1050
1049
  /**
1051
1050
  * Specifies a bot ID to send the result of the user's interaction with the task module.
1052
1051
  * If specified, the bot will receive a task/complete invoke event with a JSON object
1053
1052
  * in the event payload.
1054
1053
  */
1055
1054
  completionBotId?: string;
1056
1055
  }
1057
1056
  /**
1058
1057
  * @private
1059
1058
  * Hide from docs.
1060
1059
  * ------
1061
1060
  */
1062
1061
  export interface OpenConversationRequest {
1063
1062
  /**
1064
1063
  * The Id of the subEntity where the conversation is taking place
1065
1064
  */
1066
1065
  subEntityId: string;
1067
1066
  /**
1068
1067
  * The title of the conversation
1069
1068
  */
1070
1069
  title: string;
1071
1070
  /**
1072
1071
  * The Id of the conversation. This is optional and should be specified whenever a previous conversation about a specific sub-entity has already been started before
1073
1072
  */
1074
1073
  conversationId?: string;
1075
1074
  /**
1076
1075
  * The Id of the channel. This is optional and should be specified whenever a conversation is started or opened in a personal app scope
1077
1076
  */
1078
1077
  channelId?: string;
1079
1078
  /**
1080
1079
  * The entity Id of the tab
1081
1080
  */
1082
1081
  entityId: string;
1083
1082
  /**
1084
1083
  * A function that is called once the conversation Id has been created
1085
1084
  */
1086
1085
  onStartConversation?: (conversationResponse: ConversationResponse) => void;
1087
1086
  /**
1088
1087
  * A function that is called if the pane is closed
1089
1088
  */
1090
1089
  onCloseConversation?: (conversationResponse: ConversationResponse) => void;
1091
1090
  }
1092
1091
  /**
1093
1092
  * @private
1094
1093
  * Hide from docs.
1095
1094
  * ------
1096
1095
  */
1097
1096
  export interface ConversationResponse {
1098
1097
  /**
1099
1098
  * The Id of the subEntity where the conversation is taking place
1100
1099
  */
1101
1100
  subEntityId: string;
1102
1101
  /**
1103
1102
  * The Id of the conversation. This is optional and should be specified whenever a previous conversation about a specific sub-entity has already been started before
1104
1103
  */
1105
1104
  conversationId?: string;
1106
1105
  /**
1107
1106
  * The Id of the channel. This is optional and should be specified whenever a conversation is started or opened in a personal app scope
1108
1107
  */
1109
1108
  channelId?: string;
1110
1109
  /**
1111
1110
  * The entity Id of the tab
1112
1111
  */
1113
1112
  entityId?: string;
1114
1113
  }
1115
1114
  /**
1116
1115
  * @private
1117
1116
  * Hide from docs.
1118
1117
  */
1119
1118
  export interface LoadContext {
1120
1119
  /**
1121
1120
  * The enitity that is requested to be loaded
1122
1121
  */
1123
1122
  entityId: string;
1124
1123
  /**
1125
1124
  * The content URL that is requested to be loaded
1126
1125
  */
1127
1126
  contentUrl: string;
1128
1127
  }
1129
1128
  /**
1130
1129
  * Initializes the library. This must be called before any other SDK calls
1131
1130
  * but after the frame is loaded successfully.
1132
1131
  */
1133
1132
  export function initialize(callback?: () => void): void;
1134
1133
  /**
1135
1134
  * @private
1136
1135
  * Hide from docs.
1137
1136
  * ------
1138
1137
  * Undocumented function used to set a mock window for unit tests
1139
1138
  */
1140
1139
  export function _initialize(hostWindow: any): void;
1141
1140
  /**
1142
1141
  * @private
1143
1142
  * Hide from docs.
1144
1143
  * ------
1145
1144
  * Undocumented function used to clear state between unit tests
1146
1145
  */
1147
1146
  export function _uninitialize(): void;
1148
1147
  /**
1149
1148
  * Enable print capability to support printing page using Ctrl+P and cmd+P
1150
1149
  */
1151
1150
  export function enablePrintCapability(): void;
1152
1151
  /**
1153
1152
  * default print handler
1154
1153
  */
1155
1154
  export function print(): void;
1156
1155
  /**
1157
1156
  * Retrieves the current context the frame is running in.
1158
1157
  * @param callback The callback to invoke when the {@link Context} object is retrieved.
1159
1158
  */
1160
1159
  export function getContext(callback: (context: Context) => void): void;
1161
1160
  /**
1162
1161
  * Registers a handler for theme changes.
1163
1162
  * Only one handler can be registered at a time. A subsequent registration replaces an existing registration.
1164
1163
  * @param handler The handler to invoke when the user changes their theme.
1165
1164
  */
1166
1165
  export function registerOnThemeChangeHandler(handler: (theme: string) => void): void;
1167
1166
  /**
1168
1167
  * Registers a handler for changes from or to full-screen view for a tab.
1169
1168
  * Only one handler can be registered at a time. A subsequent registration replaces an existing registration.
1170
1169
  * @param handler The handler to invoke when the user toggles full-screen view for a tab.
1171
1170
  */
1172
1171
  export function registerFullScreenHandler(handler: (isFullScreen: boolean) => void): void;
1173
1172
  /**
1174
1173
  * Registers a handler for user presses of the Team client's back button. Experiences that maintain an internal
1175
1174
  * navigation stack should use this handler to navigate the user back within their frame. If an app finds
1176
1175
  * that after running its back button handler it cannot handle the event it should call the navigateBack
1177
1176
  * method to ask the Teams client to handle it instead.
1178
1177
  * @param handler The handler to invoke when the user presses their Team client's back button.
1179
1178
  */
1180
1179
  export function registerBackButtonHandler(handler: () => boolean): void;
1181
1180
  /**
1182
1181
  * Navigates back in the Teams client. See registerBackButtonHandler for more information on when
1183
1182
  * it's appropriate to use this method.
1184
1183
  */
1185
1184
  export function navigateBack(onComplete?: (status: boolean, reason?: string) => void): void;
1186
1185
  /**
1187
1186
  * @private
1188
1187
  * Registers a handler to be called when the page has been requested to load.
1189
1188
  * @param handler The handler to invoke when the page is loaded.
1190
1189
  */
1191
1190
  export function registerOnLoadHandler(handler: (context: LoadContext) => void): void;
1192
1191
  /**
1193
1192
  * @private
1194
1193
  * Registers a handler to be called before the page is unloaded.
1195
1194
  * @param handler The handler to invoke before the page is unloaded. If this handler returns true the page should
1196
1195
  * invoke the readyToUnload function provided to it once it's ready to be unloaded.
1197
1196
  */
1198
1197
  export function registerBeforeUnloadHandler(handler: (readyToUnload: () => void) => boolean): void;
1199
1198
  /**
1200
1199
  * Registers a handler for when the user reconfigurated tab
1201
1200
  * @param handler The handler to invoke when the user click on Settings.
1202
1201
  */
1203
1202
  export function registerChangeSettingsHandler(handler: () => void): void;
1204
1203
  /**
1205
1204
  * Navigates the frame to a new cross-domain URL. The domain of this URL must match at least one of the
1206
1205
  * valid domains specified in the validDomains block of the manifest; otherwise, an exception will be
1207
1206
  * thrown. This function needs to be used only when navigating the frame to a URL in a different domain
1208
1207
  * than the current one in a way that keeps the app informed of the change and allows the SDK to
1209
1208
  * continue working.
1210
1209
  * @param url The URL to navigate the frame to.
1211
1210
  */
1212
1211
  export function navigateCrossDomain(url: string, onComplete?: (status: boolean, reason?: string) => void): void;
1213
1212
  /**
1214
1213
  * Allows an app to retrieve for this user tabs that are owned by this app.
1215
1214
  * If no TabInstanceParameters are passed, the app defaults to favorite teams and favorite channels.
1216
1215
  * @param callback The callback to invoke when the {@link TabInstanceParameters} object is retrieved.
1217
1216
  * @param tabInstanceParameters OPTIONAL Flags that specify whether to scope call to favorite teams or channels.
1218
1217
  */
1219
1218
  export function getTabInstances(callback: (tabInfo: TabInformation) => void, tabInstanceParameters?: TabInstanceParameters): void;
1220
1219
  /**
1221
1220
  * Allows an app to retrieve the most recently used tabs for this user.
1222
1221
  * @param callback The callback to invoke when the {@link TabInformation} object is retrieved.
1223
1222
  * @param tabInstanceParameters OPTIONAL Ignored, kept for future use
1224
1223
  */
1225
1224
  export function getMruTabInstances(callback: (tabInfo: TabInformation) => void, tabInstanceParameters?: TabInstanceParameters): void;
1226
1225
  /**
1227
1226
  * Shares a deep link that a user can use to navigate back to a specific state in this page.
1228
1227
  * @param deepLinkParameters ID and label for the link and fallback URL.
1229
1228
  */
1230
1229
  export function shareDeepLink(deepLinkParameters: DeepLinkParameters): void;
1231
1230
  /**
1232
1231
  * execute deep link API.
1233
1232
  * @param deepLink deep link.
1234
1233
  */
1235
1234
  export function executeDeepLink(deepLink: string, onComplete?: (status: boolean, reason?: string) => void): void;
1236
1235
  /**
1237
1236
  * Navigates the Microsoft Teams app to the specified tab instance.
1238
1237
  * @param tabInstance The tab instance to navigate to.
1239
1238
  */
1240
1239
  export function navigateToTab(tabInstance: TabInstance, onComplete?: (status: boolean, reason?: string) => void): void;
1241
1240
  /**
1242
1241
  * Namespace to interact with the settings-specific part of the SDK.
1243
1242
  * This object is usable only on the settings frame.
1244
1243
  */
1245
1244
  export namespace settings {
1246
1245
  /**
1247
1246
  * Sets the validity state for the settings.
1248
1247
  * The initial value is false, so the user cannot save the settings until this is called with true.
1249
1248
  * @param validityState Indicates whether the save or remove button is enabled for the user.
1250
1249
  */
1251
1250
  function setValidityState(validityState: boolean): void;
1252
1251
  /**
1253
1252
  * Gets the settings for the current instance.
1254
1253
  * @param callback The callback to invoke when the {@link Settings} object is retrieved.
1255
1254
  */
1256
1255
  function getSettings(callback: (instanceSettings: Settings) => void): void;
1257
1256
  /**
1258
1257
  * Sets the settings for the current instance.
1259
1258
  * This is an asynchronous operation; calls to getSettings are not guaranteed to reflect the changed state.
1260
1259
  * @param settings The desired settings for this instance.
1261
1260
  */
1262
1261
  function setSettings(instanceSettings: Settings, onComplete?: (status: boolean, reason?: string) => void): void;
1263
1262
  /**
1264
1263
  * Registers a handler for when the user attempts to save the settings. This handler should be used
1265
1264
  * to create or update the underlying resource powering the content.
1266
1265
  * The object passed to the handler must be used to notify whether to proceed with the save.
1267
1266
  * Only one handler can be registered at a time. A subsequent registration replaces an existing registration.
1268
1267
  * @param handler The handler to invoke when the user selects the save button.
1269
1268
  */
1270
1269
  function registerOnSaveHandler(handler: (evt: SaveEvent) => void): void;
1271
1270
  /**
1272
1271
  * Registers a handler for user attempts to remove content. This handler should be used
1273
1272
  * to remove the underlying resource powering the content.
1274
1273
  * The object passed to the handler must be used to indicate whether to proceed with the removal.
1275
1274
  * Only one handler may be registered at a time. Subsequent registrations will override the first.
1276
1275
  * @param handler The handler to invoke when the user selects the remove button.
1277
1276
  */
1278
1277
  function registerOnRemoveHandler(handler: (evt: RemoveEvent) => void): void;
1279
1278
  interface Settings {
1280
1279
  /**
1281
1280
  * A suggested display name for the new content.
1282
1281
  * In the settings for an existing instance being updated, this call has no effect.
1283
1282
  */
1284
1283
  suggestedDisplayName?: string;
1285
1284
  /**
1286
1285
  * Sets the URL to use for the content of this instance.
1287
1286
  */
1288
1287
  contentUrl: string;
1289
1288
  /**
1290
1289
  * Sets the URL for the removal configuration experience.
1291
1290
  */
1292
1291
  removeUrl?: string;
1293
1292
  /**
1294
1293
  * Sets the URL to use for the external link to view the underlying resource in a browser.
1295
1294
  */
1296
1295
  websiteUrl?: string;
1297
1296
  /**
1298
1297
  * The developer-defined unique ID for the entity to which this content points.
1299
1298
  */
1300
1299
  entityId: string;
1301
1300
  }
1302
1301
  interface SaveEvent {
1303
1302
  /**
1304
1303
  * Object containing properties passed as arguments to the settings.save event.
1305
1304
  */
1306
1305
  result: SaveParameters;
1307
1306
  /**
1308
1307
  * Indicates that the underlying resource has been created and the settings can be saved.
1309
1308
  */
1310
1309
  notifySuccess(): void;
1311
1310
  /**
1312
1311
  * Indicates that creation of the underlying resource failed and that the settings cannot be saved.
1313
1312
  * @param reason Specifies a reason for the failure. If provided, this string is displayed to the user; otherwise a generic error is displayed.
1314
1313
  */
1315
1314
  notifyFailure(reason?: string): void;
1316
1315
  }
1317
1316
  interface RemoveEvent {
1318
1317
  /**
1319
1318
  * Indicates that the underlying resource has been removed and the content can be removed.
1320
1319
  */
1321
1320
  notifySuccess(): void;
1322
1321
  /**
1323
1322
  * Indicates that removal of the underlying resource failed and that the content cannot be removed.
1324
1323
  * @param reason Specifies a reason for the failure. If provided, this string is displayed to the user; otherwise a generic error is displayed.
1325
1324
  */
1326
1325
  notifyFailure(reason?: string): void;
1327
1326
  }
1328
1327
  interface SaveParameters {
1329
1328
  /**
1330
1329
  * Connector's webhook Url returned as arguments to settings.save event as part of user clicking on Save
1331
1330
  */
1332
1331
  webhookUrl?: string;
1333
1332
  }
1334
1333
  }
1335
1334
  /**
1336
1335
  * Namespace to interact with the task module-specific part of the SDK.
1337
1336
  * This object is usable only on the content frame.
1338
1337
  */
1339
1338
  export namespace tasks {
1340
1339
  /**
1341
1340
  * Allows an app to open the task module.
1342
1341
  * @param taskInfo An object containing the parameters of the task module
1343
1342
  * @param submitHandler Handler to call when the task module is completed
1344
1343
  */
1345
1344
  function startTask(taskInfo: TaskInfo, submitHandler?: (err: string, result: string) => void): IAppWindow;
1346
1345
  /**
1347
1346
  * Update height/width task info properties.
1348
1347
  * @param taskInfo An object containing width and height properties
1349
1348
  */
1350
1349
  function updateTask(taskInfo: TaskInfo): void;
1351
1350
  /**
1352
1351
  * Submit the task module.
1353
1352
  * @param result Contains the result to be sent to the bot or the app. Typically a JSON object or a serialized version of it
1354
1353
  * @param appIds Helps to validate that the call originates from the same appId as the one that invoked the task module
1355
1354
  */
1356
1355
  function submitTask(result?: string | object, appIds?: string | string[]): void;
1357
1356
  }
1357
+ export const version = "1.6.0";
1358
1358
  export const validOrigins: string[];
1359
1359
  export const frameContexts: {
1360
1360
  settings: string;
1361
1361
  content: string;
1362
1362
  authentication: string;
1363
1363
  remove: string;
1364
1364
  task: string;
1365
1365
  };
1366
1366
  export const validOriginRegExp: RegExp;
1367
1367
  /**
1368
1368
  * USer specified message origins should satisfy this test
1369
1369
  */
1370
1370
  export const userOriginUrlValidationRegExp: RegExp;
1371
1371
  export class GlobalVars {
1372
1372
  static initializeCalled: boolean;
1373
1373
  static initializeCompleted: boolean;
1374
1374
  static additionalValidOrigins: string[];
1375
1375
  static additionalValidOriginsRegexp: RegExp;
1376
1376
  static initializeCallbacks: {
1377
1377
  (): void;
1378
1378
  }[];
1379
1379
  static currentWindow: Window | any;
1380
1380
  static parentWindow: Window | any;
1381
1381
  static isFramelessWindow: boolean;
1382
1382
  static parentOrigin: string;
1383
1383
  static frameContext: string;
1384
1384
  static childWindow: Window;
1385
1385
  static childOrigin: string;
1386
1386
  static parentMessageQueue: MessageRequest[];
1387
1387
  static childMessageQueue: MessageRequest[];
1388
1388
  static nextMessageId: number;
1389
1389
  static handlers: {
1390
1390
  [func: string]: Function;
1391
1391
  };
1392
1392
  static callbacks: {
1393
1393
  [id: number]: Function;
1394
1394
  };
1395
1395
  static hostClientType: string;
1396
1396
  static printCapabilityEnabled: boolean;
1397
1397
  static themeChangeHandler: (theme: string) => void;
1398
1398
  static fullScreenChangeHandler: (isFullScreen: boolean) => void;
1399
1399
  static backButtonPressHandler: () => boolean;
1400
1400
  static loadHandler: (context: LoadContext) => void;
1401
1401
  static beforeUnloadHandler: (readyToUnload: () => void) => boolean;
1402
1402
  static changeSettingsHandler: () => void;
1403
1403
  static onStartConversationHandler: (conversationResponse: ConversationResponse) => void;
1404
1404
  static onCloseConversationHandler: (conversationResponse: ConversationResponse) => void;
1405
1405
  static getLogHandler: () => string;
1406
1406
  }
1407
1407
  /**
1408
1408
  * @private
1409
1409
  * Hide from docs
1410
1410
  * Shim in definitions used for browser-compat
1411
1411
  */
1412
1412
  export interface DOMMessageEvent {
1413
1413
  origin?: any;
1414
1414
  source?: any;
1415
1415
  data?: any;
1416
1416
  originalEvent: DOMMessageEvent;
1417
1417
  }
1418
1418
  /**
1419
1419
  * @private
1420
1420
  * Hide from docs
1421
1421
  */
1422
1422
  export interface TeamsNativeClient {
1423
1423
  framelessPostMessage(msg: string): void;
1424
1424
  }
1425
1425
  /**
1426
1426
  * @private
1427
1427
  * Hide from docs
1428
1428
  */
1429
1429
  export interface ExtendedWindow extends Window {
1430
1430
  nativeInterface: TeamsNativeClient;
1431
1431
  onNativeMessage(evt: DOMMessageEvent): void;
1432
1432
  }
1433
1433
  export interface MessageRequest {
1434
1434
  id?: number;
1435
1435
  func: string;
1436
1436
  args?: any[];
1437
1437
  }
1438
1438
  export interface MessageResponse {
1439
1439
  id: number;
1440
1440
  args?: any[];
1441
1441
  }
1442
1442
  /**
1443
1443
  * Meant for Message objects that are sent to children without id
1444
1444
  */
1445
1445
  export interface DOMMessageEvent {
1446
1446
  func: string;
1447
1447
  args?: any[];
1448
1448
  }
1449
1449
  export function ensureInitialized(...expectedFrameContexts: string[]): void;
1450
1450
  export function processMessage(evt: DOMMessageEvent): void;
1451
1451
  export function handleParentMessage(evt: DOMMessageEvent): void;
1452
1452
  /**
1453
1453
  * Processes the valid origins specifuied by the user, de-duplicates and converts them into a regexp
1454
1454
  * which is used later for message source/origin validation
1455
1455
  */
1456
1456
  export function processAdditionalValidOrigins(validMessageOrigins: string[]): void;
1457
1457
  export function waitForMessageQueue(targetWindow: Window, callback: () => void): void;
1458
1458
  /**
1459
1459
  * Send a message to parent. Uses nativeInterface on mobile to communicate with parent context
1460
1460
  */
1461
1461
  export function sendMessageRequestToParent(actionName: string, args?: any[]): number;
1462
1462
  /**
1463
1463
  * Send a custom message object that can be sent to child window,
1464
1464
  * instead of a response message to a child
1465
1465
  */
1466
1466
  export function sendMessageEventToChild(actionName: string, args?: any[]): void;
1467
1467
  export function generateRegExpFromUrls(urls: string[]): RegExp;
1468
1468
  export function getGenericOnCompleteHandler(errorMessage?: string): (success: boolean, reason?: string) => void;
1469
1469
  /**
1470
1470
  * @private
1471
1471
  * Namespace to interact with bots using the SDK.
1472
1472
  */
1473
1473
  export namespace bot {
1474
1474
  /**
1475
1475
  * @private
1476
1476
  * Hide from docs until release.
1477
1477
  * ------
1478
1478
  * Sends query to bot in order to retrieve data.
1479
1479
  * @param botRequest query to send to bot.
1480
1480
  * @param onSuccess callback to invoke when data is retrieved from bot
1481
1481
  * @param onError callback to invoke should an error occur
1482
1482
  */
1483
1483
  function sendQuery(botRequest: QueryRequest, onSuccess?: (data: QueryResponse) => void, onError?: (error: string) => void): void;
1484
1484
  /**
1485
1485
  * @private
1486
1486
  * Hide from docs until release.
1487
1487
  * -----
1488
1488
  * Retrieves list of support commands from bot
1489
1489
  * @param onSuccess callback to invoke when data is retrieved from bot
1490
1490
  * @param onError callback to invoke should an error occur
1491
1491
  */
1492
1492
  function getSupportedCommands(onSuccess?: (response: Command[]) => void, onError?: (error: string) => void): void;
1493
1493
  /**
1494
1494
  * @private
1495
1495
  * Hide from docs until release.
1496
1496
  * -----
1497
1497
  * Authenticates a user for json tab
1498
1498
  * @param authRequest callback to invoke when data is retrieved from bot
1499
1499
  * @param onSuccess callback to invoke when user is authenticated
1500
1500
  * @param onError callback to invoke should an error occur
1501
1501
  */
1502
1502
  function authenticate(authRequest: AuthQueryRequest, onSuccess?: (results: Results) => void, onError?: (error: string) => void): void;
1503
1503
  interface QueryRequest {
1504
1504
  /**
1505
1505
  * Query to search for
1506
1506
  */
1507
1507
  query: string;
1508
1508
  commandId?: string;
1509
1509
  option?: {
1510
1510
  skip: number;
1511
1511
  count: number;
1512
1512
  };
1513
1513
  }
1514
1514
  interface QueryResponse {
1515
1515
  data: Results | Auth;
1516
1516
  type: ResponseType;
1517
1517
  }
1518
1518
  interface Results {
1519
1519
  attachments: Attachment[];
1520
1520
  layout: any;
1521
1521
  botId: string;
1522
1522
  }
1523
1523
  interface Auth {
1524
1524
  url: string;
1525
1525
  title: string;
1526
1526
  }
1527
1527
  interface AuthQueryRequest extends QueryRequest {
1528
1528
  url: string;
1529
1529
  }
1530
1530
  interface Attachment {
1531
1531
  card: any;
1532
1532
  previewCard: any;
1533
1533
  previewRawPayload: any;
1534
1534
  rawPayload: any;
1535
1535
  }
1536
1536
  interface Command {
1537
1537
  title: string;
1538
1538
  id: string;
1539
1539
  initialRun: boolean;
1540
1540
  }
1541
1541
  enum ResponseType {
1542
1542
  Results = "Results",
1543
1543
  Auth = "Auth"
1544
1544
  }
1545
1545
  }
1546
1546
  /**
1547
1547
  * Namespace to interact with the conversational subEntities inside the tab
1548
1548
  */
1549
1549
  export namespace conversations {
1550
1550
  /**
1551
1551
  * @private
1552
1552
  * Hide from docs
1553
1553
  * --------------
1554
1554
  * Allows the user to start or continue a conversation with each subentity inside the tab
1555
1555
  */
1556
1556
  function openConversation(openConversationRequest: OpenConversationRequest): void;
1557
1557
  /**
1558
1558
  * @private
1559
1559
  * Hide from docs
1560
1560
  * --------------
1561
1561
  * Allows the user to close the conversation in the right pane
1562
1562
  */
1563
1563
  function closeConversation(): void;
1564
1564
  }
1565
1565
  /**
1566
1566
  * @private
1567
1567
  * Hide from docs
1568
1568
  * --------
1569
1569
  * Information about all members in a chat
1570
1570
  */
1571
1571
  export interface ChatMembersInformation {
1572
1572
  members: ThreadMember[];
1573
1573
  }
1574
1574
  /**
1575
1575
  * @private
1576
1576
  * Hide from docs
1577
1577
  * --------
1578
1578
  * Information about a chat member
1579
1579
  */
1580
1580
  export interface ThreadMember {
1581
1581
  /**
1582
1582
  * The member's user principal name in the current tenant.
1583
1583
  */
1584
1584
  upn: string;
1585
1585
  }
1586
1586
  export const enum NotificationTypes {
1587
1587
  fileDownloadStart = "fileDownloadStart",
1588
1588
  fileDownloadComplete = "fileDownloadComplete"
1589
1589
  }
1590
1590
  export interface ShowNotificationParameters {
1591
1591
  message: string;
1592
1592
  notificationType: NotificationTypes;
1593
1593
  }
1594
1594
  /**
1595
1595
  * @private
1596
1596
  * Hide from docs.
1597
1597
  * ------
1598
1598
  */
1599
1599
  export interface FilePreviewParameters {
1600
1600
  /**
1601
1601
  * The developer-defined unique ID for the file.
1602
1602
  */
1603
1603
  entityId: string;
1604
1604
  /**
1605
1605
  * The display name of the file.
1606
1606
  */
1607
1607
  title: string;
1608
1608
  /**
1609
1609
  * An optional description of the file.
1610
1610
  */
1611
1611
  description?: string;
1612
1612
  /**
1613
1613
  * The file extension; e.g. pptx, docx, etc.
1614
1614
  */
1615
1615
  type: string;
1616
1616
  /**
1617
1617
  * A url to the source of the file, used to open the content in the user's default browser
1618
1618
  */
1619
1619
  objectUrl: string;
1620
1620
  /**
1621
1621
  * Optional; an alternate self-authenticating url used to preview the file in Mobile clients and offer it for download by the user
1622
1622
  */
1623
1623
  downloadUrl?: string;
1624
1624
  /**
1625
1625
  * Optional; an alternate url optimized for previewing the file in Teams web and desktop clients
1626
1626
  */
1627
1627
  webPreviewUrl?: string;
1628
1628
  /**
1629
1629
  * Optional; an alternate url that allows editing of the file in Teams web and desktop clients
1630
1630
  */
1631
1631
  webEditUrl?: string;
1632
1632
  /**
1633
1633
  * Optional; the base url of the site where the file is hosted
1634
1634
  */
1635
1635
  baseUrl?: string;
1636
1636
  /**
1637
1637
  * Optional; indicates whether the file should be opened in edit mode
1638
1638
  */
1639
1639
  editFile?: boolean;
1640
1640
  /**
1641
1641
  * Optional; the developer-defined unique ID for the sub-entity to return to when the file stage closes.
1642
1642
  * This field should be used to restore to a specific state within an entity, such as scrolling to or activating a specific piece of content.
1643
1643
  */
1644
1644
  subEntityId?: string;
1645
1645
  }
1646
1646
  /**
1647
1647
  * @private
1648
1648
  * Hide from docs
1649
1649
  * --------
1650
1650
  * Query parameters used when fetching team information
1651
1651
  */
1652
1652
  export interface TeamInstanceParameters {
1653
1653
  /**
1654
1654
  * Flag allowing to select favorite teams only
1655
1655
  */
1656
1656
  favoriteTeamsOnly?: boolean;
1657
1657
  }
1658
1658
  /**
1659
1659
  * @private
1660
1660
  * Hide from docs
1661
1661
  * --------
1662
1662
  * Information on userJoined Teams
1663
1663
  */
1664
1664
  export interface UserJoinedTeamsInformation {
1665
1665
  /**
1666
1666
  * List of team information
1667
1667
  */
1668
1668
  userJoinedTeams: TeamInformation[];
1669
1669
  }
1670
1670
  /**
1671
1671
  * Namespace to interact with the logging part of the SDK.
1672
1672
  * This object is used to send the app logs on demand to the host client
1673
1673
  *
1674
1674
  * @private
1675
1675
  * Hide from docs
1676
1676
  */
1677
1677
  export namespace logs {
1678
1678
  /**
1679
1679
  * @private
1680
1680
  * Hide from docs
1681
1681
  * ------
1682
1682
  * Registers a handler for getting app log
1683
1683
  * @param handler The handler to invoke to get the app log
1684
1684
  */
1685
1685
  function registerGetLogHandler(handler: () => string): void;
1686
1686
  }
1687
1687
  /**
1688
1688
  * Namespace to interact with the menu-specific part of the SDK.
1689
1689
  * This object is used to show View Configuration, Action Menu and Navigation Bar Menu.
1690
1690
  *
1691
1691
  * @private
1692
1692
  * Hide from docs until feature is complete
1693
1693
  */
1694
1694
  export namespace menus {
1695
1695
  /**
1696
1696
  * Represents information about item in View Configuration.
1697
1697
  */
1698
1698
  interface ViewConfiguration {
1699
1699
  /**
1700
1700
  * Unique identifier of view.
1701
1701
  */
1702
1702
  id: string;
1703
1703
  /**
1704
1704
  * Display title of the view.
1705
1705
  */
1706
1706
  title: string;
1707
1707
  /**
1708
1708
  * Additional information for accessibility.
1709
1709
  */
1710
1710
  contentDescription?: string;
1711
1711
  }
1712
1712
  /**
1713
1713
  * Represents information about menu item for Action Menu and Navigation Bar Menu.
1714
1714
  */
1715
1715
  class MenuItem {
1716
1716
  /**
1717
1717
  * Unique identifier for the menu item.
1718
1718
  */
1719
1719
  id: string;
1720
1720
  /**
1721
1721
  * Display title of the menu item.
1722
1722
  */
1723
1723
  title: string;
1724
1724
  /**
1725
1725
  * Display icon of the menu item. The icon value must be a string having SVG icon content.
1726
1726
  */
1727
1727
  icon?: string;
1728
1728
  /**
1729
1729
  * Selected state display icon of the menu item. The icon value must be a string having SVG icon content.
1730
1730
  */
1731
1731
  iconSelected?: string;
1732
1732
  /**
1733
1733
  * Additional information for accessibility.
1734
1734
  */
1735
1735
  contentDescription?: string;
1736
1736
  /**
1737
1737
  * State of the menu item
1738
1738
  */
1739
1739
  enabled: boolean;
1740
1740
  /**
1741
1741
  * Interface to show list of items on selection of menu item.
1742
1742
  */
1743
1743
  viewData: ViewData;
1744
1744
  }
1745
1745
  /**
1746
1746
  * Represents information about view to show on Navigation Bar Menu item selection
1747
1747
  */
1748
1748
  interface ViewData {
1749
1749
  /**
1750
1750
  * Display header title of the item list.
1751
1751
  */
1752
1752
  listTitle?: string;
1753
1753
  /**
1754
1754
  * Type of the menu item.
1755
1755
  */
1756
1756
  listType: MenuListType;
1757
1757
  /**
1758
1758
  * Array of MenuItem. Icon value will be required for all items in the list.
1759
1759
  */
1760
1760
  listItems: MenuItem[];
1761
1761
  }
1762
1762
  /**
1763
1763
  * Represents information about type of list to display in Navigation Bar Menu.
1764
1764
  */
1765
1765
  enum MenuListType {
1766
1766
  dropDown = "dropDown",
1767
1767
  popOver = "popOver"
1768
1768
  }
1769
1769
  /**
1770
1770
  * Registers list of view configurations and it's handler.
1771
1771
  * Handler is responsible for listening selection of View Configuration.
1772
1772
  * @param viewConfig List of view configurations. Minimum 1 value is required.
1773
1773
  * @param handler The handler to invoke when the user selects view configuration.
1774
1774
  */
1775
1775
  function setUpViews(viewConfig: ViewConfiguration[], handler: (id: string) => boolean): void;
1776
1776
  /**
1777
1777
  * Used to set menu items on the Navigation Bar. If icon is available, icon will be shown, otherwise title will be shown.
1778
1778
  * @param items List of MenuItems for Navigation Bar Menu.
1779
1779
  * @param handler The handler to invoke when the user selects menu item.
1780
1780
  */
1781
1781
  function setNavBarMenu(items: MenuItem[], handler: (id: string) => boolean): void;
1782
1782
  interface ActionMenuParameters {
1783
1783
  /**
1784
1784
  * Display title for Action Menu
1785
1785
  */
1786
1786
  title: string;
1787
1787
  /**
1788
1788
  * List of MenuItems for Action Menu
1789
1789
  */
1790
1790
  items: MenuItem[];
1791
1791
  }
1792
1792
  /**
1793
1793
  * Used to show Action Menu.
1794
1794
  * @param params Parameters for Menu Parameters
1795
1795
  * @param handler The handler to invoke when the user selects menu item.
1796
1796
  */
1797
1797
  function showActionMenu(params: ActionMenuParameters, handler: (id: string) => boolean): void;
1798
1798
  }
1799
1799
  /**
1800
1800
  * @private
1801
1801
  * Hide from docs
1802
1802
  * ------
1803
1803
  * Allows an app to retrieve information of all user joined teams
1804
1804
  * @param callback The callback to invoke when the {@link TeamInstanceParameters} object is retrieved.
1805
1805
  * @param teamInstanceParameters OPTIONAL Flags that specify whether to scope call to favorite teams
1806
1806
  */
1807
1807
  export function getUserJoinedTeams(callback: (userJoinedTeamsInformation: UserJoinedTeamsInformation) => void, teamInstanceParameters?: TeamInstanceParameters): void;
1808
1808
  /**
1809
1809
  * @private
1810
1810
  * Hide from docs
1811
1811
  * ------
1812
1812
  * Place the tab into full-screen mode.
1813
1813
  */
1814
1814
  export function enterFullscreen(): void;
1815
1815
  /**
1816
1816
  * @private
1817
1817
  * Hide from docs
1818
1818
  * ------
1819
1819
  * Reverts the tab into normal-screen mode.
1820
1820
  */
1821
1821
  export function exitFullscreen(): void;
1822
1822
  /**
1823
1823
  * @private
1824
1824
  * Hide from docs.
1825
1825
  * ------
1826
1826
  * Opens a client-friendly preview of the specified file.
1827
1827
  * @param file The file to preview.
1828
1828
  */
1829
1829
  export function openFilePreview(filePreviewParameters: FilePreviewParameters): void;
1830
1830
  /**
1831
1831
  * @private
1832
1832
  * Hide from docs.
1833
1833
  * ------
1834
1834
  * display notification API.
1835
1835
  * @param message Notification message.
1836
1836
  * @param notificationType Notification type
1837
1837
  */
1838
1838
  export function showNotification(showNotificationParameters: ShowNotificationParameters): void;
1839
1839
  /**
1840
1840
  * @private
1841
1841
  * Hide from docs.
1842
1842
  * ------
1843
1843
  * Upload a custom App manifest directly to both team and personal scopes.
1844
1844
  * This method works just for the first party Apps.
1845
1845
  */
1846
1846
  export function uploadCustomApp(manifestBlob: Blob, onComplete?: (status: boolean, reason?: string) => void): void;
1847
1847
  /**
1848
1848
  * @private
1849
1849
  * Internal use only
1850
1850
  * Sends a custom action MessageRequest to Teams or parent window
1851
1851
  * @param actionName Specifies name of the custom action to be sent
1852
1852
  * @param args Specifies additional arguments passed to the action
1853
1853
  * @param callback Optionally specify a callback to receive response parameters from the parent
1854
1854
  * @returns id of sent message
1855
1855
  */
1856
1856
  export function sendCustomMessage(actionName: string, args?: any[], callback?: (...args: any[]) => void): number;
1857
1857
  /**
1858
1858
  * @private
1859
1859
  * Internal use only
1860
1860
  * Sends a custom action MessageEvent to a child iframe/window, only if you are not using auth popup.
1861
1861
  * Otherwise it will go to the auth popup (which becomes the child)
1862
1862
  * @param actionName Specifies name of the custom action to be sent
1863
1863
  * @param args Specifies additional arguments passed to the action
1864
1864
  * @returns id of sent message
1865
1865
  */
1866
1866
  export function sendCustomEvent(actionName: string, args?: any[]): void;
1867
1867
  /**
1868
1868
  * @private
1869
1869
  * Internal use only
1870
1870
  * Adds a handler for an action sent by a child window or parent window
1871
1871
  * @param actionName Specifies name of the action message to handle
1872
1872
  * @param customHandler The callback to invoke when the action message is received. The return value is sent to the child
1873
1873
  */
1874
1874
  export function registerCustomHandler(actionName: string, customHandler: (...args: any[]) => any[]): void;
1875
1875
  /**
1876
1876
  * @private
1877
1877
  * Hide from docs
1878
1878
  * ------
1879
1879
  * Allows an app to retrieve information of all chat members
1880
1880
  * Because a malicious party run your content in a browser, this value should
1881
1881
  * be used only as a hint as to who the members are and never as proof of membership.
1882
1882
  * @param callback The callback to invoke when the {@link ChatMembersInformation} object is retrieved.
1883
1883
  */
1884
1884
  export function getChatMembers(callback: (chatMembersInformation: ChatMembersInformation) => void): void;
1885
1885
  /**
1886
1886
  * @private
1887
1887
  * Hide from docs
1888
1888
  * ------
1889
1889
  * Allows an app to get the configuration setting value
1890
1890
  * @param callback The callback to invoke when the value is retrieved.
1891
1891
  * @param key The key for the config setting
1892
1892
  */
1893
1893
  export function getConfigSetting(callback: (value: string) => void, key: string): void;
1894
1894
  export namespace appInitialization {
1895
1895
  /**
1896
1896
  * To notify app loaded to hide loading indicator
1897
1897
  */
1898
1898
  function notifyAppLoaded(): void;
1899
1899
  /**
1900
1900
  * To notify app Initialization successs and ready for user interaction
1901
1901
  */
1902
1902
  function notifySuccess(): void;
1903
1903
  /**
1904
1904
  * To notify app Initialization failed
1905
1905
  */
1906
1906
  function notifyFailure(appInitializationFailedRequest: appInitialization.IFailedRequest): void;
1907
1907
  const enum FailedReason {
1908
1908
  AuthFailed = "AuthFailed",
1909
1909
  Timeout = "Timeout",
1910
1910
  Other = "Other"
1911
1911
  }
1912
1912
  interface IFailedRequest {
1913
1913
  reason: appInitialization.FailedReason;
1914
1914
  message?: string;
1915
1915
  }
1916
1916
  }
1917
1917
  export interface IAppWindow {
1918
1918
  postMessage(message: any): void;
1919
1919
  addEventListener(type: string, listener: Function): void;
1920
1920
  }
1921
1921
  export class ChildAppWindow implements IAppWindow {
1922
1922
  postMessage(message: any, onComplete?: (status: boolean, reason?: string) => void): void;
1923
1923
  addEventListener(type: string, listener: (message: any) => void): void;
1924
1924
  }
1925
1925
  export class ParentAppWindow implements IAppWindow {
1926
1926
  private static _instance;
1927
1927
  static readonly Instance: IAppWindow;
1928
1928
  postMessage(message: any, onComplete?: (status: boolean, reason?: string) => void): void;
1929
1929
  addEventListener(type: string, listener: (message: any) => void): void;
1930
1930
  }
1931
1931
  /**
1932
1932
  * Namespace to interact with the authentication-specific part of the SDK.
1933
1933
  * This object is used for starting or completing authentication flows.
1934
1934
  */
1935
1935
  export namespace authentication {
1936
1936
  /**
1937
1937
  * Registers the authentication GlobalVars.handlers
1938
1938
  * @param authenticateParameters A set of values that configure the authentication pop-up.
1939
1939
  */
1940
1940
  function registerAuthenticationHandlers(authenticateParameters: AuthenticateParameters): void;
1941
1941
  /**
1942
1942
  * Initiates an authentication request, which opens a new window with the specified settings.
1943
1943
  */
1944
1944
  function authenticate(authenticateParameters?: AuthenticateParameters): void;
1945
1945
  /**
1946
1946
  * @private
1947
1947
  * Hide from docs.
1948
1948
  * ------
1949
1949
  * Requests an Azure AD token to be issued on behalf of the app. The token is acquired from the cache
1950
1950
  * if it is not expired. Otherwise a request is sent to Azure AD to obtain a new token.
1951
1951
  * @param authTokenRequest A set of values that configure the token request.
1952
1952
  */
1953
1953
  function getAuthToken(authTokenRequest: AuthTokenRequest): void;
1954
1954
  /**
1955
1955
  * @private
1956
1956
  * Hide from docs.
1957
1957
  * ------
1958
1958
  * Requests the decoded Azure AD user identity on behalf of the app.
1959
1959
  */
1960
1960
  function getUser(userRequest: UserRequest): void;
1961
1961
  /**
1962
1962
  * Notifies the frame that initiated this authentication request that the request was successful.
1963
1963
  * This function is usable only on the authentication window.
1964
1964
  * This call causes the authentication window to be closed.
1965
1965
  * @param result Specifies a result for the authentication. If specified, the frame that initiated the authentication pop-up receives this value in its callback.
1966
1966
  * @param callbackUrl Specifies the url to redirect back to if the client is Win32 Outlook.
1967
1967
  */
1968
1968
  function notifySuccess(result?: string, callbackUrl?: string): void;
1969
1969
  /**
1970
1970
  * Notifies the frame that initiated this authentication request that the request failed.
1971
1971
  * This function is usable only on the authentication window.
1972
1972
  * This call causes the authentication window to be closed.
1973
1973
  * @param result Specifies a result for the authentication. If specified, the frame that initiated the authentication pop-up receives this value in its callback.
1974
1974
  * @param callbackUrl Specifies the url to redirect back to if the client is Win32 Outlook.
1975
1975
  */
1976
1976
  function notifyFailure(reason?: string, callbackUrl?: string): void;
1977
1977
  interface AuthenticateParameters {
1978
1978
  /**
1979
1979
  * The URL for the authentication pop-up.
1980
1980
  */
1981
1981
  url: string;
1982
1982
  /**
1983
1983
  * The preferred width for the pop-up. This value can be ignored if outside the acceptable bounds.
1984
1984
  */
1985
1985
  width?: number;
1986
1986
  /**
1987
1987
  * The preferred height for the pop-up. This value can be ignored if outside the acceptable bounds.
1988
1988
  */
1989
1989
  height?: number;
1990
1990
  /**
1991
1991
  * A function that is called if the authentication succeeds, with the result returned from the authentication pop-up.
1992
1992
  */
1993
1993
  successCallback?: (result?: string) => void;
1994
1994
  /**
1995
1995
  * A function that is called if the authentication fails, with the reason for the failure returned from the authentication pop-up.
1996
1996
  */
1997
1997
  failureCallback?: (reason?: string) => void;
1998
1998
  }
1999
1999
  /**
2000
2000
  * @private
2001
2001
  * Hide from docs.
2002
2002
  * ------
2003
2003
  */
2004
2004
  interface AuthTokenRequest {
2005
2005
  /**
2006
2006
  * An array of resource URIs identifying the target resources for which the token should be requested.
2007
2007
  */
2008
2008
  resources: string[];
2009
2009
  /**
2010
2010
  * A function that is called if the token request succeeds, with the resulting token.
2011
2011
  */
2012
2012
  successCallback?: (token: string) => void;
2013
2013
  /**
2014
2014
  * A function that is called if the token request fails, with the reason for the failure.
2015
2015
  */
2016
2016
  failureCallback?: (reason: string) => void;
2017
2017
  }
2018
2018
  /**
2019
2019
  * @private
2020
2020
  * Hide from docs.
2021
2021
  * ------
2022
2022
  */
2023
2023
  interface UserRequest {
2024
2024
  /**
2025
2025
  * A function that is called if the token request succeeds, with the resulting token.
2026
2026
  */
2027
2027
  successCallback?: (user: UserProfile) => void;
2028
2028
  /**
2029
2029
  * A function that is called if the token request fails, with the reason for the failure.
2030
2030
  */
2031
2031
  failureCallback?: (reason: string) => void;
2032
2032
  }
2033
2033
  /**
2034
2034
  * @private
2035
2035
  * Hide from docs.
2036
2036
  * ------
2037
2037
  */
2038
2038
  interface UserProfile {
2039
2039
  /**
2040
2040
  * The intended recipient of the token. The application that receives the token must verify that the audience
2041
2041
  * value is correct and reject any tokens intended for a different audience.
2042
2042
  */
2043
2043
  aud: string;
2044
2044
  /**
2045
2045
  * Identifies how the subject of the token was authenticated.
2046
2046
  */
2047
2047
  amr: string[];
2048
2048
  /**
2049
2049
  * Stores the time at which the token was issued. It is often used to measure token freshness.
2050
2050
  */
2051
2051
  iat: number;
2052
2052
  /**
2053
2053
  * Identifies the security token service (STS) that constructs and returns the token. In the tokens that Azure AD
2054
2054
  * returns, the issuer is sts.windows.net. The GUID in the issuer claim value is the tenant ID of the Azure AD
2055
2055
  * directory. The tenant ID is an immutable and reliable identifier of the directory.
2056
2056
  */
2057
2057
  iss: string;
2058
2058
  /**
2059
2059
  * Provides the last name, surname, or family name of the user as defined in the Azure AD user object.
2060
2060
  */
2061
2061
  family_name: string;
2062
2062
  /**
2063
2063
  * Provides the first or "given" name of the user, as set on the Azure AD user object.
2064
2064
  */
2065
2065
  given_name: string;
2066
2066
  /**
2067
2067
  * Provides a human-readable value that identifies the subject of the token. This value is not guaranteed to
2068
2068
  * be unique within a tenant and is designed to be used only for display purposes.
2069
2069
  */
2070
2070
  unique_name: string;
2071
2071
  /**
2072
2072
  * Contains a unique identifier of an object in Azure AD. This value is immutable and cannot be reassigned or
2073
2073
  * reused. Use the object ID to identify an object in queries to Azure AD.
2074
2074
  */
2075
2075
  oid: string;
2076
2076
  /**
2077
2077
  * Identifies the principal about which the token asserts information, such as the user of an application.
2078
2078
  * This value is immutable and cannot be reassigned or reused, so it can be used to perform authorization
2079
2079
  * checks safely. Because the subject is always present in the tokens the Azure AD issues, we recommended
2080
2080
  * using this value in a general-purpose authorization system.
2081
2081
  */
2082
2082
  sub: string;
2083
2083
  /**
2084
2084
  * An immutable, non-reusable identifier that identifies the directory tenant that issued the token. You can
2085
2085
  * use this value to access tenant-specific directory resources in a multitenant application. For example,
2086
2086
  * you can use this value to identify the tenant in a call to the Graph API.
2087
2087
  */
2088
2088
  tid: string;
2089
2089
  /**
2090
2090
  * Defines the time interval within which a token is valid. The service that validates the token should verify
2091
2091
  * that the current date is within the token lifetime; otherwise it should reject the token. The service might
2092
2092
  * allow for up to five minutes beyond the token lifetime to account for any differences in clock time ("time
2093
2093
  * skew") between Azure AD and the service.
2094
2094
  */
2095
2095
  exp: number;
2096
2096
  nbf: number;
2097
2097
  /**
2098
2098
  * Stores the user name of the user principal.
2099
2099
  */
2100
2100
  upn: string;
2101
2101
  /**
2102
2102
  * Stores the version number of the token.
2103
2103
  */
2104
2104
  ver: string;
2105
2105
  }
2106
2106
  }
2107
2107
  export const enum HostClientType {
2108
2108
  desktop = "desktop",
2109
2109
  web = "web",
2110
2110
  android = "android",
2111
2111
  ios = "ios",
2112
2112
  rigel = "rigel"
2113
2113
  }
2114
2114
  /**
2115
2115
  * Indicates the team type, currently used to distinguish between different team
2116
2116
  * types in Office 365 for Education (team types 1, 2, 3, and 4).
2117
2117
  */
2118
2118
  export const enum TeamType {
2119
2119
  Standard = 0,
2120
2120
  Edu = 1,
2121
2121
  Class = 2,
2122
2122
  Plc = 3,
2123
2123
  Staff = 4
2124
2124
  }
2125
2125
  /**
2126
2126
  * Indicates the various types of roles of a user in a team.
2127
2127
  */
2128
2128
  export const enum UserTeamRole {
2129
2129
  Admin = 0,
2130
2130
  User = 1,
2131
2131
  Guest = 2
2132
2132
  }
2133
2133
  export const enum TaskModuleDimension {
2134
2134
  Large = "large",
2135
2135
  Medium = "medium",
2136
2136
  Small = "small"
2137
2137
  }
2138
2138
  /**
2139
2139
  * The type of the channel with which the content is associated.
2140
2140
  */
2141
2141
  export const enum ChannelType {
2142
2142
  Regular = "Regular",
2143
2143
  Private = "Private"
2144
2144
  }
2145
2145
  /**
2146
2146
  * Represents information about tabs for an app
2147
2147
  */
2148
2148
  export interface TabInformation {
2149
2149
  teamTabs: TabInstance[];
2150
2150
  }
2151
2151
  /**
2152
2152
  * Represents information about a tab instance
2153
2153
  */
2154
2154
  export interface TabInstance {
2155
2155
  /**
2156
2156
  * The name of the tab
2157
2157
  */
2158
2158
  tabName: string;
2159
2159
  /**
2160
2160
  * Internal: do not use
2161
2161
  * @protected
2162
2162
  */
2163
2163
  internalTabInstanceId?: string;
2164
2164
  /**
2165
2165
  * Last viewed time of this tab. null means unknown
2166
2166
  */
2167
2167
  lastViewUnixEpochTime?: string;
2168
2168
  /**
2169
2169
  * The developer-defined unique ID for the entity this content points to.
2170
2170
  */
2171
2171
  entityId?: string;
2172
2172
  /**
2173
2173
  * The Microsoft Teams ID for the channel with which the content is associated.
2174
2174
  */
2175
2175
  channelId?: string;
2176
2176
  /**
2177
2177
  * The name for the channel with which the content is associated.
2178
2178
  */
2179
2179
  channelName?: string;
2180
2180
  /**
2181
2181
  * Is this tab in a favorite channel?
2182
2182
  */
2183
2183
  channelIsFavorite?: boolean;
2184
2184
  /**
2185
2185
  * The Microsoft Teams ID for the team with which the content is associated.
2186
2186
  */
2187
2187
  teamId?: string;
2188
2188
  /**
2189
2189
  * The name for the team with which the content is associated.
2190
2190
  */
2191
2191
  teamName?: string;
2192
2192
  /**
2193
2193
  * Is this tab in a favorite team?
2194
2194
  */
2195
2195
  teamIsFavorite?: boolean;
2196
2196
  /**
2197
2197
  * The Office 365 group ID for the team with which the content is associated.
2198
2198
  * This field is available only when the identity permission is requested in the manifest.
2199
2199
  */
2200
2200
  groupId?: string;
2201
2201
  /**
2202
2202
  * Content URL of this tab
2203
2203
  */
2204
2204
  url?: string;
2205
2205
  /**
2206
2206
  * Website URL of this tab
2207
2207
  */
2208
2208
  websiteUrl?: string;
2209
2209
  }
2210
2210
  /**
2211
2211
  * Indicates information about the tab instance for filtering purposes.
2212
2212
  */
2213
2213
  export interface TabInstanceParameters {
2214
2214
  /**
2215
2215
  * Flag allowing to select favorite channels only
2216
2216
  */
2217
2217
  favoriteChannelsOnly?: boolean;
2218
2218
  /**
2219
2219
  * Flag allowing to select favorite teams only
2220
2220
  */
2221
2221
  favoriteTeamsOnly?: boolean;
2222
2222
  }
2223
2223
  /**
2224
2224
  * Represents Team Information
2225
2225
  */
2226
2226
  export interface TeamInformation {
2227
2227
  /**
2228
2228
  * Id of the team
2229
2229
  */
2230
2230
  teamId: string;
2231
2231
  /**
2232
2232
  * Team display name
2233
2233
  */
2234
2234
  teamName: string;
2235
2235
  /**
2236
2236
  * Team description
2237
2237
  */
2238
2238
  teamDescription?: string;
2239
2239
  /**
2240
2240
  * Thumbnail Uri
2241
2241
  */
2242
2242
  thumbnailUri?: string;
2243
2243
  /**
2244
2244
  * The Office 365 group ID for the team with which the content is associated.
2245
2245
  * This field is available only when the identity permission is requested in the manifest.
2246
2246
  */
2247
2247
  groupId?: string;
2248
2248
  /**
2249
2249
  * Role of current user in the team
2250
2250
  */
2251
2251
  userTeamRole?: UserTeamRole;
2252
2252
  }
2253
2253
  export interface Context {
2254
2254
  /**
2255
2255
  * The Office 365 group ID for the team with which the content is associated.
2256
2256
  * This field is available only when the identity permission is requested in the manifest.
2257
2257
  */
2258
2258
  groupId?: string;
2259
2259
  /**
2260
2260
  * The Microsoft Teams ID for the team with which the content is associated.
2261
2261
  */
2262
2262
  teamId?: string;
2263
2263
  /**
2264
2264
  * The name for the team with which the content is associated.
2265
2265
  */
2266
2266
  teamName?: string;
2267
2267
  /**
2268
2268
  * The Microsoft Teams ID for the channel with which the content is associated.
2269
2269
  */
2270
2270
  channelId?: string;
2271
2271
  /**
2272
2272
  * The name for the channel with which the content is associated.
2273
2273
  */
2274
2274
  channelName?: string;
2275
2275
  /**
2276
2276
  * The type of the channel with which the content is associated.
2277
2277
  */
2278
2278
  channelType?: ChannelType;
2279
2279
  /**
2280
2280
  * The developer-defined unique ID for the entity this content points to.
2281
2281
  */
2282
2282
  entityId: string;
2283
2283
  /**
2284
2284
  * The developer-defined unique ID for the sub-entity this content points to.
2285
2285
  * This field should be used to restore to a specific state within an entity, such as scrolling to or activating a specific piece of content.
2286
2286
  */
2287
2287
  subEntityId?: string;
2288
2288
  /**
2289
2289
  * The current locale that the user has configured for the app formatted as
2290
2290
  * languageId-countryId (for example, en-us).
2291
2291
  */
2292
2292
  locale: string;
2293
2293
  /**
2294
2294
  * @deprecated Use loginHint or userPrincipalName.
2295
2295
  * The UPN of the current user.
2296
2296
  * Because a malicious party can run your content in a browser, this value should
2297
2297
  * be used only as a hint as to who the user is and never as proof of identity.
2298
2298
  * This field is available only when the identity permission is requested in the manifest.
2299
2299
  */
2300
2300
  upn?: string;
2301
2301
  /**
2302
2302
  * The Azure AD tenant ID of the current user.
2303
2303
  * Because a malicious party can run your content in a browser, this value should
2304
2304
  * be used only as a hint as to who the user is and never as proof of identity.
2305
2305
  * This field is available only when the identity permission is requested in the manifest.
2306
2306
  */
2307
2307
  tid?: string;
2308
2308
  /**
2309
2309
  * The current UI theme.
2310
2310
  */
2311
2311
  theme?: string;
2312
2312
  /**
2313
2313
  * Indication whether the tab is in full-screen mode.
2314
2314
  */
2315
2315
  isFullScreen?: boolean;
2316
2316
  /**
2317
2317
  * The type of the team.
2318
2318
  */
2319
2319
  teamType?: TeamType;
2320
2320
  /**
2321
2321
  * The root SharePoint site associated with the team.
2322
2322
  */
2323
2323
  teamSiteUrl?: string;
2324
2324
  /**
2325
2325
  * The domain of the root SharePoint site associated with the team.
2326
2326
  */
2327
2327
  teamSiteDomain?: string;
2328
2328
  /**
2329
2329
  * The relative path to the SharePoint site associated with the team.
2330
2330
  */
2331
2331
  teamSitePath?: string;
2332
2332
  /**
2333
2333
  * The relative path to the SharePoint folder associated with the channel.
2334
2334
  */
2335
2335
  channelRelativeUrl?: string;
2336
2336
  /**
2337
2337
  * Unique ID for the current Teams session for use in correlating telemetry data.
2338
2338
  */
2339
2339
  sessionId?: string;
2340
2340
  /**
2341
2341
  * The user's role in the team.
2342
2342
  * Because a malicious party can run your content in a browser, this value should
2343
2343
  * be used only as a hint as to the user's role, and never as proof of her role.
2344
2344
  */
2345
2345
  userTeamRole?: UserTeamRole;
2346
2346
  /**
2347
2347
  * The Microsoft Teams ID for the chat with which the content is associated.
2348
2348
  */
2349
2349
  chatId?: string;
2350
2350
  /**
2351
2351
  * A value suitable for use as a login_hint when authenticating with Azure AD.
2352
2352
  * Because a malicious party can run your content in a browser, this value should
2353
2353
  * be used only as a hint as to who the user is and never as proof of identity.
2354
2354
  * This field is available only when the identity permission is requested in the manifest.
2355
2355
  */
2356
2356
  loginHint?: string;
2357
2357
  /**
2358
2358
  * The UPN of the current user. This may be an externally-authenticated UPN (e.g., guest users).
2359
2359
  * Because a malicious party run your content in a browser, this value should
2360
2360
  * be used only as a hint as to who the user is and never as proof of identity.
2361
2361
  * This field is available only when the identity permission is requested in the manifest.
2362
2362
  */
2363
2363
  userPrincipalName?: string;
2364
2364
  /**
2365
2365
  * The Azure AD object id of the current user.
2366
2366
  * Because a malicious party run your content in a browser, this value should
2367
2367
  * be used only as a hint as to who the user is and never as proof of identity.
2368
2368
  * This field is available only when the identity permission is requested in the manifest.
2369
2369
  */
2370
2370
  userObjectId?: string;
2371
2371
  /**
2372
2372
  * Indicates whether team is archived.
2373
2373
  * Apps should use this as a signal to prevent any changes to content associated with archived teams.
2374
2374
  */
2375
2375
  isTeamArchived?: boolean;
2376
2376
  /**
2377
2377
  * The type of the host client. Possible values are : android, ios, web, desktop, rigel
2378
2378
  */
2379
2379
  hostClientType?: HostClientType;
2380
2380
  /**
2381
2381
  * SharePoint context. This is only available when hosted in SharePoint.
2382
2382
  */
2383
2383
  sharepoint?: any;
2384
2384
  /**
2385
2385
  * The type of license for the current users tenant.
2386
2386
  */
2387
2387
  tenantSKU?: string;
2388
2388
  /**
2389
2389
  * The license type for the current user.
2390
2390
  */
2391
2391
  userLicenseType?: string;
2392
2392
  /**
2393
2393
  * The ID of the parent message from which this task module was launched.
2394
2394
  * This is only available in task modules launched from bot cards.
2395
2395
  */
2396
2396
  parentMessageId?: string;
2397
2397
  /**
2398
2398
  * Current ring ID
2399
2399
  */
2400
2400
  ringId?: string;
2401
2401
  /**
2402
2402
  * Unique ID for the current session for use in correlating telemetry data.
2403
2403
  */
2404
2404
  appSessionId?: string;
2405
2405
  /**
2406
2406
  * Represents whether calling is allowed for the current logged in User
2407
2407
  */
2408
2408
  isCallingAllowed?: boolean;
2409
2409
  /**
2410
2410
  * Represents whether PSTN calling is allowed for the current logged in User
2411
2411
  */
2412
2412
  isPSTNCallingAllowed?: boolean;
2413
2413
  /**
2414
2414
  * The OneNote section ID that is linked to the channel.
2415
2415
  */
2416
2416
  defaultOneNoteSectionId?: string;
2417
2417
  }
2418
2418
  export interface DeepLinkParameters {
2419
2419
  /**
2420
2420
  * The developer-defined unique ID for the sub-entity to which this deep link points in the current entity.
2421
2421
  * This field should be used to restore to a specific state within an entity, such as scrolling to or activating a specific piece of content.
2422
2422
  */
2423
2423
  subEntityId: string;
2424
2424
  /**
2425
2425
  * The label for the sub-entity that should be displayed when the deep link is rendered in a client.
2426
2426
  */
2427
2427
  subEntityLabel: string;
2428
2428
  /**
2429
2429
  * The fallback URL to which to navigate the user if the client cannot render the page.
2430
2430
  * This URL should lead directly to the sub-entity.
2431
2431
  */
2432
2432
  subEntityWebUrl?: string;
2433
2433
  }
2434
2434
  export interface TaskInfo {
2435
2435
  /**
2436
2436
  * The url to be rendered in the webview/iframe.
2437
2437
  */
2438
2438
  url?: string;
2439
2439
  /**
2440
2440
  * JSON defining an adaptive card.
2441
2441
  */
2442
2442
  card?: string;
2443
2443
  /**
2444
2444
  * The requested height of the webview/iframe.
2445
2445
  */
2446
2446
  height?: TaskModuleDimension | number;
2447
2447
  /**
2448
2448
  * The requested width of the webview/iframe.
2449
2449
  */
2450
2450
  width?: TaskModuleDimension | number;
2451
2451
  /**
2452
2452
  * Title of the task module.
2453
2453
  */
2454
2454
  title?: string;
2455
2455
  /**
2456
2456
  * If client doesnt support the URL, the URL that needs to be opened in the browser.
2457
2457
  */
2458
2458
  fallbackUrl?: string;
2459
2459
  /**
2460
2460
  * Specifies a bot ID to send the result of the user's interaction with the task module.
2461
2461
  * If specified, the bot will receive a task/complete invoke event with a JSON object
2462
2462
  * in the event payload.
2463
2463
  */
2464
2464
  completionBotId?: string;
2465
2465
  }
2466
2466
  /**
2467
2467
  * @private
2468
2468
  * Hide from docs.
2469
2469
  * ------
2470
2470
  */
2471
2471
  export interface OpenConversationRequest {
2472
2472
  /**
2473
2473
  * The Id of the subEntity where the conversation is taking place
2474
2474
  */
2475
2475
  subEntityId: string;
2476
2476
  /**
2477
2477
  * The title of the conversation
2478
2478
  */
2479
2479
  title: string;
2480
2480
  /**
2481
2481
  * The Id of the conversation. This is optional and should be specified whenever a previous conversation about a specific sub-entity has already been started before
2482
2482
  */
2483
2483
  conversationId?: string;
2484
2484
  /**
2485
2485
  * The Id of the channel. This is optional and should be specified whenever a conversation is started or opened in a personal app scope
2486
2486
  */
2487
2487
  channelId?: string;
2488
2488
  /**
2489
2489
  * The entity Id of the tab
2490
2490
  */
2491
2491
  entityId: string;
2492
2492
  /**
2493
2493
  * A function that is called once the conversation Id has been created
2494
2494
  */
2495
2495
  onStartConversation?: (conversationResponse: ConversationResponse) => void;
2496
2496
  /**
2497
2497
  * A function that is called if the pane is closed
2498
2498
  */
2499
2499
  onCloseConversation?: (conversationResponse: ConversationResponse) => void;
2500
2500
  }
2501
2501
  /**
2502
2502
  * @private
2503
2503
  * Hide from docs.
2504
2504
  * ------
2505
2505
  */
2506
2506
  export interface ConversationResponse {
2507
2507
  /**
2508
2508
  * The Id of the subEntity where the conversation is taking place
2509
2509
  */
2510
2510
  subEntityId: string;
2511
2511
  /**
2512
2512
  * The Id of the conversation. This is optional and should be specified whenever a previous conversation about a specific sub-entity has already been started before
2513
2513
  */
2514
2514
  conversationId?: string;
2515
2515
  /**
2516
2516
  * The Id of the channel. This is optional and should be specified whenever a conversation is started or opened in a personal app scope
2517
2517
  */
2518
2518
  channelId?: string;
2519
2519
  /**
2520
2520
  * The entity Id of the tab
2521
2521
  */
2522
2522
  entityId?: string;
2523
2523
  }
2524
2524
  /**
2525
2525
  * @private
2526
2526
  * Hide from docs.
2527
2527
  */
2528
2528
  export interface LoadContext {
2529
2529
  /**
2530
2530
  * The enitity that is requested to be loaded
2531
2531
  */
2532
2532
  entityId: string;
2533
2533
  /**
2534
2534
  * The content URL that is requested to be loaded
2535
2535
  */
2536
2536
  contentUrl: string;
2537
2537
  }
2538
2538
  export interface FrameContext {
2539
2539
  /**
2540
2540
  * The current URL that needs to be used in the iframe if the tab is reloaded
2541
2541
  */
2542
2542
  contentUrl: string;
2543
2543
  /**
2544
2544
  * The current URL that needs to be used for opening the website when the user clicks on 'Go to website'
2545
2545
  */
2546
2546
  websiteUrl: string;
2547
2547
  }
2548
2548
  /**
2549
2549
  * Initializes the library. This must be called before any other SDK calls
2550
2550
  * but after the frame is loaded successfully.
2551
2551
  * @param callback Optionally specify a callback to invoke when Teams SDK has successfully initialized
2552
2552
  * @param validMessageOrigins Optionally specify a list of cross frame message origins. There must have
2553
2553
  * https: protocol otherwise they will be ignored. Example: https://www.example.com
2554
2554
  */
2555
2555
  export function initialize(callback?: () => void, validMessageOrigins?: string[]): void;
2556
2556
  /**
2557
2557
  * @private
2558
2558
  * Hide from docs.
2559
2559
  * ------
2560
2560
  * Undocumented function used to set a mock window for unit tests
2561
2561
  */
2562
2562
  export function _initialize(hostWindow: any): void;
2563
2563
  /**
2564
2564
  * @private
2565
2565
  * Hide from docs.
2566
2566
  * ------
2567
2567
  * Undocumented function used to clear state between unit tests
2568
2568
  */
2569
2569
  export function _uninitialize(): void;
2570
2570
  /**
2571
2571
  * Enable print capability to support printing page using Ctrl+P and cmd+P
2572
2572
  */
2573
2573
  export function enablePrintCapability(): void;
2574
2574
  /**
2575
2575
  * default print handler
2576
2576
  */
2577
2577
  export function print(): void;
2578
2578
  /**
2579
2579
  * Retrieves the current context the frame is running in.
2580
2580
  * @param callback The callback to invoke when the {@link Context} object is retrieved.
2581
2581
  */
2582
2582
  export function getContext(callback: (context: Context) => void): void;
2583
2583
  /**
2584
2584
  * Registers a handler for theme changes.
2585
2585
  * Only one handler can be registered at a time. A subsequent registration replaces an existing registration.
2586
2586
  * @param handler The handler to invoke when the user changes their theme.
2587
2587
  */
2588
2588
  export function registerOnThemeChangeHandler(handler: (theme: string) => void): void;
2589
2589
  /**
2590
2590
  * Registers a handler for changes from or to full-screen view for a tab.
2591
2591
  * Only one handler can be registered at a time. A subsequent registration replaces an existing registration.
2592
2592
  * @param handler The handler to invoke when the user toggles full-screen view for a tab.
2593
2593
  */
2594
2594
  export function registerFullScreenHandler(handler: (isFullScreen: boolean) => void): void;
2595
2595
  /**
2596
2596
  * Registers a handler for user presses of the Team client's back button. Experiences that maintain an internal
2597
2597
  * navigation stack should use this handler to navigate the user back within their frame. If an app finds
2598
2598
  * that after running its back button handler it cannot handle the event it should call the navigateBack
2599
2599
  * method to ask the Teams client to handle it instead.
2600
2600
  * @param handler The handler to invoke when the user presses their Team client's back button.
2601
2601
  */
2602
2602
  export function registerBackButtonHandler(handler: () => boolean): void;
2603
2603
  /**
2604
2604
  * Navigates back in the Teams client. See registerBackButtonHandler for more information on when
2605
2605
  * it's appropriate to use this method.
2606
2606
  */
2607
2607
  export function navigateBack(onComplete?: (status: boolean, reason?: string) => void): void;
2608
2608
  /**
2609
2609
  * @private
2610
2610
  * Registers a handler to be called when the page has been requested to load.
2611
2611
  * @param handler The handler to invoke when the page is loaded.
2612
2612
  */
2613
2613
  export function registerOnLoadHandler(handler: (context: LoadContext) => void): void;
2614
2614
  /**
2615
2615
  * @private
2616
2616
  * Registers a handler to be called before the page is unloaded.
2617
2617
  * @param handler The handler to invoke before the page is unloaded. If this handler returns true the page should
2618
2618
  * invoke the readyToUnload function provided to it once it's ready to be unloaded.
2619
2619
  */
2620
2620
  export function registerBeforeUnloadHandler(handler: (readyToUnload: () => void) => boolean): void;
2621
2621
  /**
2622
2622
  * Registers a handler for when the user reconfigurated tab
2623
2623
  * @param handler The handler to invoke when the user click on Settings.
2624
2624
  */
2625
2625
  export function registerChangeSettingsHandler(handler: () => void): void;
2626
2626
  /**
2627
2627
  * Navigates the frame to a new cross-domain URL. The domain of this URL must match at least one of the
2628
2628
  * valid domains specified in the validDomains block of the manifest; otherwise, an exception will be
2629
2629
  * thrown. This function needs to be used only when navigating the frame to a URL in a different domain
2630
2630
  * than the current one in a way that keeps the app informed of the change and allows the SDK to
2631
2631
  * continue working.
2632
2632
  * @param url The URL to navigate the frame to.
2633
2633
  */
2634
2634
  export function navigateCrossDomain(url: string, onComplete?: (status: boolean, reason?: string) => void): void;
2635
2635
  /**
2636
2636
  * Allows an app to retrieve for this user tabs that are owned by this app.
2637
2637
  * If no TabInstanceParameters are passed, the app defaults to favorite teams and favorite channels.
2638
2638
  * @param callback The callback to invoke when the {@link TabInstanceParameters} object is retrieved.
2639
2639
  * @param tabInstanceParameters OPTIONAL Flags that specify whether to scope call to favorite teams or channels.
2640
2640
  */
2641
2641
  export function getTabInstances(callback: (tabInfo: TabInformation) => void, tabInstanceParameters?: TabInstanceParameters): void;
2642
2642
  /**
2643
2643
  * Allows an app to retrieve the most recently used tabs for this user.
2644
2644
  * @param callback The callback to invoke when the {@link TabInformation} object is retrieved.
2645
2645
  * @param tabInstanceParameters OPTIONAL Ignored, kept for future use
2646
2646
  */
2647
2647
  export function getMruTabInstances(callback: (tabInfo: TabInformation) => void, tabInstanceParameters?: TabInstanceParameters): void;
2648
2648
  /**
2649
2649
  * Shares a deep link that a user can use to navigate back to a specific state in this page.
2650
2650
  * @param deepLinkParameters ID and label for the link and fallback URL.
2651
2651
  */
2652
2652
  export function shareDeepLink(deepLinkParameters: DeepLinkParameters): void;
2653
2653
  /**
2654
2654
  * execute deep link API.
2655
2655
  * @param deepLink deep link.
2656
2656
  */
2657
2657
  export function executeDeepLink(deepLink: string, onComplete?: (status: boolean, reason?: string) => void): void;
2658
2658
  /**
2659
2659
  * Navigates the Microsoft Teams app to the specified tab instance.
2660
2660
  * @param tabInstance The tab instance to navigate to.
2661
2661
  */
2662
2662
  export function navigateToTab(tabInstance: TabInstance, onComplete?: (status: boolean, reason?: string) => void): void;
2663
2663
  export function setFrameContext(frameContext: FrameContext): void;
2664
2664
  export function initializeWithFrameContext(frameContext: FrameContext, callback?: () => void, validMessageOrigins?: string[]): void;
2665
2665
  /**
2666
2666
  * Namespace to interact with the settings-specific part of the SDK.
2667
2667
  * This object is usable only on the settings frame.
2668
2668
  */
2669
2669
  export namespace settings {
2670
2670
  /**
2671
2671
  * Sets the validity state for the settings.
2672
2672
  * The initial value is false, so the user cannot save the settings until this is called with true.
2673
2673
  * @param validityState Indicates whether the save or remove button is enabled for the user.
2674
2674
  */
2675
2675
  function setValidityState(validityState: boolean): void;
2676
2676
  /**
2677
2677
  * Gets the settings for the current instance.
2678
2678
  * @param callback The callback to invoke when the {@link Settings} object is retrieved.
2679
2679
  */
2680
2680
  function getSettings(callback: (instanceSettings: Settings) => void): void;
2681
2681
  /**
2682
2682
  * Sets the settings for the current instance.
2683
2683
  * This is an asynchronous operation; calls to getSettings are not guaranteed to reflect the changed state.
2684
2684
  * @param settings The desired settings for this instance.
2685
2685
  */
2686
2686
  function setSettings(instanceSettings: Settings, onComplete?: (status: boolean, reason?: string) => void): void;
2687
2687
  /**
2688
2688
  * Registers a handler for when the user attempts to save the settings. This handler should be used
2689
2689
  * to create or update the underlying resource powering the content.
2690
2690
  * The object passed to the handler must be used to notify whether to proceed with the save.
2691
2691
  * Only one handler can be registered at a time. A subsequent registration replaces an existing registration.
2692
2692
  * @param handler The handler to invoke when the user selects the save button.
2693
2693
  */
2694
2694
  function registerOnSaveHandler(handler: (evt: SaveEvent) => void): void;
2695
2695
  /**
2696
2696
  * Registers a handler for user attempts to remove content. This handler should be used
2697
2697
  * to remove the underlying resource powering the content.
2698
2698
  * The object passed to the handler must be used to indicate whether to proceed with the removal.
2699
2699
  * Only one handler may be registered at a time. Subsequent registrations will override the first.
2700
2700
  * @param handler The handler to invoke when the user selects the remove button.
2701
2701
  */
2702
2702
  function registerOnRemoveHandler(handler: (evt: RemoveEvent) => void): void;
2703
2703
  interface Settings {
2704
2704
  /**
2705
2705
  * A suggested display name for the new content.
2706
2706
  * In the settings for an existing instance being updated, this call has no effect.
2707
2707
  */
2708
2708
  suggestedDisplayName?: string;
2709
2709
  /**
2710
2710
  * Sets the URL to use for the content of this instance.
2711
2711
  */
2712
2712
  contentUrl: string;
2713
2713
  /**
2714
2714
  * Sets the URL for the removal configuration experience.
2715
2715
  */
2716
2716
  removeUrl?: string;
2717
2717
  /**
2718
2718
  * Sets the URL to use for the external link to view the underlying resource in a browser.
2719
2719
  */
2720
2720
  websiteUrl?: string;
2721
2721
  /**
2722
2722
  * The developer-defined unique ID for the entity to which this content points.
2723
2723
  */
2724
2724
  entityId: string;
2725
2725
  }
2726
2726
  interface SaveEvent {
2727
2727
  /**
2728
2728
  * Object containing properties passed as arguments to the settings.save event.
2729
2729
  */
2730
2730
  result: SaveParameters;
2731
2731
  /**
2732
2732
  * Indicates that the underlying resource has been created and the settings can be saved.
2733
2733
  */
2734
2734
  notifySuccess(): void;
2735
2735
  /**
2736
2736
  * Indicates that creation of the underlying resource failed and that the settings cannot be saved.
2737
2737
  * @param reason Specifies a reason for the failure. If provided, this string is displayed to the user; otherwise a generic error is displayed.
2738
2738
  */
2739
2739
  notifyFailure(reason?: string): void;
2740
2740
  }
2741
2741
  interface RemoveEvent {
2742
2742
  /**
2743
2743
  * Indicates that the underlying resource has been removed and the content can be removed.
2744
2744
  */
2745
2745
  notifySuccess(): void;
2746
2746
  /**
2747
2747
  * Indicates that removal of the underlying resource failed and that the content cannot be removed.
2748
2748
  * @param reason Specifies a reason for the failure. If provided, this string is displayed to the user; otherwise a generic error is displayed.
2749
2749
  */
2750
2750
  notifyFailure(reason?: string): void;
2751
2751
  }
2752
2752
  interface SaveParameters {
2753
2753
  /**
2754
2754
  * Connector's webhook Url returned as arguments to settings.save event as part of user clicking on Save
2755
2755
  */
2756
2756
  webhookUrl?: string;
2757
2757
  }
2758
2758
  }
2759
2759
  /**
2760
2760
  * Namespace to interact with the task module-specific part of the SDK.
2761
2761
  * This object is usable only on the content frame.
2762
2762
  */
2763
2763
  export namespace tasks {
2764
2764
  /**
2765
2765
  * Allows an app to open the task module.
2766
2766
  * @param taskInfo An object containing the parameters of the task module
2767
2767
  * @param submitHandler Handler to call when the task module is completed
2768
2768
  */
2769
2769
  function startTask(taskInfo: TaskInfo, submitHandler?: (err: string, result: string) => void): IAppWindow;
2770
2770
  /**
2771
2771
  * Update height/width task info properties.
2772
2772
  * @param taskInfo An object containing width and height properties
2773
2773
  */
2774
2774
  function updateTask(taskInfo: TaskInfo): void;
2775
2775
  /**
2776
2776
  * Submit the task module.
2777
2777
  * @param result Contains the result to be sent to the bot or the app. Typically a JSON object or a serialized version of it
2778
2778
  * @param appIds Helps to validate that the call originates from the same appId as the one that invoked the task module
2779
2779
  */
2780
2780
  function submitTask(result?: string | object, appIds?: string | string[]): void;
2781
2781
  }