@microsoft/teams-js 2.7.2-beta.0 → 2.8.0-beta.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.
package/README.md CHANGED
@@ -61,9 +61,9 @@ Reference the library inside of your `.html` page using:
61
61
 
62
62
  Teams client library depends on [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) type. If you support older browsers and devices which may not yet provide it natively (e.g. IE 11), you need to provide a global polyfill, such as [es6-promise](https://www.npmjs.com/package/es6-promise), in your bundled application. If you're using a script tag to reference the Teams client library, you need to make sure the polyfill is included and initialized before the Teams client library is initialized.
63
63
 
64
- ## Examples
64
+ ## Full Documentation and Examples
65
65
 
66
- Stay tuned for examples coming soon.
66
+ While each interface, class, function, etc. includes compact developer documentation, full documentation about library usage, including examples, can be found [here](https://learn.microsoft.com/en-us/javascript/api/overview/msteams-client?view=msteams-client-js-latest).
67
67
 
68
68
  ## Testing
69
69
 
@@ -2220,6 +2220,9 @@ export namespace authentication {
2220
2220
  /**
2221
2221
  * Initiates an authentication request, which opens a new window with the specified settings.
2222
2222
  *
2223
+ * @remarks
2224
+ * The authentication flow must start and end from the same domain, otherwise success and failure messages won't be returned to the window that initiated the call.
2225
+ *
2223
2226
  * @param authenticateParameters - The parameters for the authentication request. It is a required parameter since v2 upgrade
2224
2227
  *
2225
2228
  * @returns Promise that will be fulfilled with the result from the authentication pop-up if successful.
@@ -2234,6 +2237,9 @@ export namespace authentication {
2234
2237
  *
2235
2238
  * Initiates an authentication request, which opens a new window with the specified settings.
2236
2239
  *
2240
+ * @remarks
2241
+ * The authentication flow must start and end from the same domain, otherwise success and failure messages won't be returned to the window that initiated the call.
2242
+ *
2237
2243
  * @param authenticateParameters - The parameters for the authentication request.
2238
2244
  *
2239
2245
  */
@@ -2647,6 +2653,12 @@ export enum ChannelType {
2647
2653
  Shared = "Shared"
2648
2654
  }
2649
2655
  export const errorNotSupportedOnPlatform: SdkError;
2656
+ /**
2657
+ * @hidden
2658
+ *
2659
+ * Minimum Adaptive Card version supported by the host.
2660
+ */
2661
+ export const minAdaptiveCardVersion: AdaptiveCardVersion;
2650
2662
 
2651
2663
  /**
2652
2664
  * Represents information about tabs for an app
@@ -3302,6 +3314,37 @@ export interface DeepLinkParameters {
3302
3314
  */
3303
3315
  subEntityWebUrl?: string;
3304
3316
  }
3317
+ /**
3318
+ * @hidden
3319
+ * Shared Dialog Properties
3320
+ */
3321
+ export interface BaseDialogInfo {
3322
+ size: DialogSize;
3323
+ /**
3324
+ * Title of the dialog module.
3325
+ */
3326
+ title?: string;
3327
+ }
3328
+ /**
3329
+ * Data structure to describe dialog information needed to open an Adaptive Card-based dialog.
3330
+ */
3331
+ export interface AdaptiveCardDialogInfo extends BaseDialogInfo {
3332
+ /**
3333
+ * JSON defining an Adaptive Card.
3334
+ */
3335
+ card: string;
3336
+ }
3337
+ /**
3338
+ * Data structure to describe dialog information needed to open a bot-based Adaptive Card-based dialog.
3339
+ */
3340
+ export interface BotAdaptiveCardDialogInfo extends AdaptiveCardDialogInfo {
3341
+ /**
3342
+ * Specifies a bot ID to send the result of the user's interaction with the dialog module.
3343
+ * The bot will receive a task/complete invoke event with a JSON object
3344
+ * in the event payload.
3345
+ */
3346
+ completionBotId: string;
3347
+ }
3305
3348
  /**
3306
3349
  * Data structure to represent the size of a dialog
3307
3350
  */
@@ -3316,9 +3359,9 @@ export interface DialogSize {
3316
3359
  width: DialogDimension | number;
3317
3360
  }
3318
3361
  /**
3319
- * Data structure to describe dialog information needed to open a url based dialog.
3362
+ * Data structure to describe dialog information needed to open a url-based dialog.
3320
3363
  */
3321
- export interface UrlDialogInfo {
3364
+ export interface UrlDialogInfo extends BaseDialogInfo {
3322
3365
  /**
3323
3366
  * The url to be rendered in the webview/iframe.
3324
3367
  *
@@ -3327,11 +3370,6 @@ export interface UrlDialogInfo {
3327
3370
  * valid domains specified in the validDomains block of the manifest
3328
3371
  */
3329
3372
  url: string;
3330
- size: DialogSize;
3331
- /**
3332
- * Title of the task module.
3333
- */
3334
- title?: string;
3335
3373
  /**
3336
3374
  * If client doesnt support the URL, the URL that needs to be opened in the browser.
3337
3375
  */
@@ -3508,6 +3546,17 @@ export enum DevicePermission {
3508
3546
  GeoLocation = "geolocation",
3509
3547
  Media = "media"
3510
3548
  }
3549
+ /** @hidden */
3550
+ export interface HostVersionsInfo {
3551
+ adaptiveCardSchemaVersion?: AdaptiveCardVersion;
3552
+ }
3553
+ /**
3554
+ * Represents the major and minor versions of the Adaptive Card schema in the current host
3555
+ */
3556
+ export interface AdaptiveCardVersion {
3557
+ majorVersion: number;
3558
+ minorVersion: number;
3559
+ }
3511
3560
 
3512
3561
  /**
3513
3562
  * Namespace to interact with app initialization and lifecycle.
@@ -4196,68 +4245,127 @@ export namespace dialog {
4196
4245
  * @beta
4197
4246
  */
4198
4247
  function initialize(): void;
4199
- /**
4200
- * Allows app to open a url based dialog.
4201
- *
4202
- * @remarks
4203
- * This function cannot be called from inside of a dialog
4204
- *
4205
- * @param urlDialogInfo - An object containing the parameters of the dialog module.
4206
- * @param submitHandler - Handler that triggers when a dialog calls the {@linkcode submit} function or when the user closes the dialog.
4207
- * @param messageFromChildHandler - Handler that triggers if dialog sends a message to the app.
4208
- *
4209
- * @returns a function that can be used to send messages to the dialog.
4210
- *
4211
- * @beta
4212
- */
4213
- function open(urlDialogInfo: UrlDialogInfo, submitHandler?: DialogSubmitHandler, messageFromChildHandler?: PostMessageChannel): void;
4214
- /**
4215
- * Submit the dialog module and close the dialog
4216
- *
4217
- * @param result - The result to be sent to the bot or the app. Typically a JSON object or a serialized version of it,
4218
- * If this function is called from a dialog while {@link M365ContentAction} is set in the context object by the host, result will be ignored
4219
- *
4220
- * @param appIds - Valid application(s) that can receive the result of the submitted dialogs. Specifying this parameter helps prevent malicious apps from retrieving the dialog result. Multiple app IDs can be specified because a web app from a single underlying domain can power multiple apps across different environments and branding schemes.
4221
- *
4222
- * @beta
4223
- */
4224
- function submit(result?: string | object, appIds?: string | string[]): void;
4225
- /**
4226
- * Send message to the parent from dialog
4227
- *
4228
- * @remarks
4229
- * This function is only called from inside of a dialog
4230
- *
4231
- * @param message - The message to send to the parent
4232
- *
4233
- * @beta
4234
- */
4235
- function sendMessageToParentFromDialog(message: any): void;
4236
- /**
4237
- * Send message to the dialog from the parent
4238
- *
4239
- * @param message - The message to send
4240
- *
4241
- * @beta
4242
- */
4243
- function sendMessageToDialog(message: any): void;
4244
- /**
4245
- * Register a listener that will be triggered when a message is received from the app that opened the dialog.
4246
- *
4247
- * @remarks
4248
- * This function is only called from inside of a dialog.
4249
- *
4250
- * @param listener - The listener that will be triggered.
4251
- *
4252
- * @beta
4253
- */
4254
- function registerOnMessageFromParent(listener: PostMessageChannel): void;
4248
+ namespace url {
4249
+ /**
4250
+ * Allows app to open a url based dialog.
4251
+ *
4252
+ * @remarks
4253
+ * This function cannot be called from inside of a dialog
4254
+ *
4255
+ * @param urlDialogInfo - An object containing the parameters of the dialog module.
4256
+ * @param submitHandler - Handler that triggers when a dialog calls the {@linkcode submit} function or when the user closes the dialog.
4257
+ * @param messageFromChildHandler - Handler that triggers if dialog sends a message to the app.
4258
+ *
4259
+ * @beta
4260
+ */
4261
+ function open(urlDialogInfo: UrlDialogInfo, submitHandler?: DialogSubmitHandler, messageFromChildHandler?: PostMessageChannel): void;
4262
+ /**
4263
+ * Submit the dialog module and close the dialog
4264
+ *
4265
+ * @param result - The result to be sent to the bot or the app. Typically a JSON object or a serialized version of it,
4266
+ * If this function is called from a dialog while {@link M365ContentAction} is set in the context object by the host, result will be ignored
4267
+ *
4268
+ * @param appIds - Valid application(s) that can receive the result of the submitted dialogs. Specifying this parameter helps prevent malicious apps from retrieving the dialog result. Multiple app IDs can be specified because a web app from a single underlying domain can power multiple apps across different environments and branding schemes.
4269
+ *
4270
+ * @beta
4271
+ */
4272
+ function submit(result?: string | object, appIds?: string | string[]): void;
4273
+ /**
4274
+ * Send message to the parent from dialog
4275
+ *
4276
+ * @remarks
4277
+ * This function is only called from inside of a dialog
4278
+ *
4279
+ * @param message - The message to send to the parent
4280
+ *
4281
+ * @beta
4282
+ */
4283
+ function sendMessageToParentFromDialog(message: any): void;
4284
+ /**
4285
+ * Send message to the dialog from the parent
4286
+ *
4287
+ * @param message - The message to send
4288
+ *
4289
+ * @beta
4290
+ */
4291
+ function sendMessageToDialog(message: any): void;
4292
+ /**
4293
+ * Register a listener that will be triggered when a message is received from the app that opened the dialog.
4294
+ *
4295
+ * @remarks
4296
+ * This function is only called from inside of a dialog.
4297
+ *
4298
+ * @param listener - The listener that will be triggered.
4299
+ *
4300
+ * @beta
4301
+ */
4302
+ function registerOnMessageFromParent(listener: PostMessageChannel): void;
4303
+ /**
4304
+ * Checks if dialog.url module is supported by the host
4305
+ *
4306
+ * @returns boolean to represent whether dialog.url module is supported
4307
+ *
4308
+ * @throws Error if {@linkcode app.initialize} has not successfully completed
4309
+ *
4310
+ * @beta
4311
+ */
4312
+ function isSupported(): boolean;
4313
+ /**
4314
+ * Namespace to open a dialog that sends results to the bot framework
4315
+ *
4316
+ * @beta
4317
+ */
4318
+ namespace bot {
4319
+ /**
4320
+ * Allows an app to open the dialog module using bot.
4321
+ *
4322
+ * @param botUrlDialogInfo - An object containing the parameters of the dialog module including completionBotId.
4323
+ * @param submitHandler - Handler that triggers when the dialog has been submitted or closed.
4324
+ * @param messageFromChildHandler - Handler that triggers if dialog sends a message to the app.
4325
+ *
4326
+ * @returns a function that can be used to send messages to the dialog.
4327
+ *
4328
+ * @beta
4329
+ */
4330
+ function open(botUrlDialogInfo: BotUrlDialogInfo, submitHandler?: DialogSubmitHandler, messageFromChildHandler?: PostMessageChannel): void;
4331
+ /**
4332
+ * Checks if dialog.url.bot capability is supported by the host
4333
+ *
4334
+ * @returns boolean to represent whether dialog.url.bot is supported
4335
+ *
4336
+ * @throws Error if {@linkcode app.initialize} has not successfully completed
4337
+ *
4338
+ * @beta
4339
+ */
4340
+ function isSupported(): boolean;
4341
+ }
4342
+ /**
4343
+ * @hidden
4344
+ *
4345
+ * Convert UrlDialogInfo to DialogInfo to send the information to host in {@linkcode open} API.
4346
+ *
4347
+ * @internal
4348
+ * Limited to Microsoft-internal use
4349
+ */
4350
+ function getDialogInfoFromUrlDialogInfo(urlDialogInfo: UrlDialogInfo): DialogInfo;
4351
+ /**
4352
+ * @hidden
4353
+ *
4354
+ * Convert BotUrlDialogInfo to DialogInfo to send the information to host in {@linkcode bot.open} API.
4355
+ *
4356
+ * @internal
4357
+ * Limited to Microsoft-internal use
4358
+ */
4359
+ function getDialogInfoFromBotUrlDialogInfo(botUrlDialogInfo: BotUrlDialogInfo): DialogInfo;
4360
+ }
4255
4361
  /**
4256
4362
  * Checks if dialog capability is supported by the host
4257
4363
  * @returns boolean to represent whether dialog capabilty is supported
4258
4364
  *
4259
4365
  * @throws Error if {@linkcode app.initialize} has not successfully completed
4260
4366
  *
4367
+ * @throws Error if {@linkcode app.initialize} has not successfully completed
4368
+ *
4261
4369
  * @beta
4262
4370
  */
4263
4371
  function isSupported(): boolean;
@@ -4286,55 +4394,91 @@ export namespace dialog {
4286
4394
  function isSupported(): boolean;
4287
4395
  }
4288
4396
  /**
4289
- * Namespace to open a dialog that sends results to the bot framework
4290
- *
4397
+ * Subcapability for interacting with adaptive card dialogs
4291
4398
  * @beta
4292
4399
  */
4293
- namespace bot {
4400
+ namespace adaptiveCard {
4294
4401
  /**
4295
- * Allows an app to open the dialog module using bot.
4402
+ * Allows app to open an adaptive card based dialog.
4296
4403
  *
4297
- * @param botUrlDialogInfo - An object containing the parameters of the dialog module including completionBotId.
4298
- * @param submitHandler - Handler that triggers when the dialog has been submitted or closed.
4299
- * @param messageFromChildHandler - Handler that triggers if dialog sends a message to the app.
4404
+ * @remarks
4405
+ * This function cannot be called from inside of a dialog
4300
4406
  *
4301
- * @returns a function that can be used to send messages to the dialog.
4407
+ * @param adaptiveCardDialogInfo - An object containing the parameters of the dialog module {@link AdaptiveCardDialogInfo}.
4408
+ * @param submitHandler - Handler that triggers when a dialog calls the {@linkcode submit} function or when the user closes the dialog.
4302
4409
  *
4303
4410
  * @beta
4304
4411
  */
4305
- function open(botUrlDialogInfo: BotUrlDialogInfo, submitHandler?: DialogSubmitHandler, messageFromChildHandler?: PostMessageChannel): void;
4412
+ function open(adaptiveCardDialogInfo: AdaptiveCardDialogInfo, submitHandler?: DialogSubmitHandler): void;
4306
4413
  /**
4307
- * Checks if dialog.bot capability is supported by the host
4308
- * @returns boolean to represent whether dialog.bot is supported
4414
+ * Checks if dialog.adaptiveCard module is supported by the host
4415
+ *
4416
+ * @returns boolean to represent whether dialog.adaptiveCard module is supported
4309
4417
  *
4310
4418
  * @throws Error if {@linkcode app.initialize} has not successfully completed
4311
4419
  *
4312
4420
  * @beta
4313
4421
  */
4314
4422
  function isSupported(): boolean;
4423
+ /**
4424
+ * Namespace for interaction with adaptive card dialogs that need to communicate with the bot framework
4425
+ *
4426
+ * @beta
4427
+ */
4428
+ namespace bot {
4429
+ /**
4430
+ * Allows an app to open an adaptive card-based dialog module using bot.
4431
+ *
4432
+ * @param botAdaptiveCardDialogInfo - An object containing the parameters of the dialog module including completionBotId.
4433
+ * @param submitHandler - Handler that triggers when the dialog has been submitted or closed.
4434
+ *
4435
+ * @beta
4436
+ */
4437
+ function open(botAdaptiveCardDialogInfo: BotAdaptiveCardDialogInfo, submitHandler?: DialogSubmitHandler): void;
4438
+ /**
4439
+ * Checks if dialog.adaptiveCard.bot capability is supported by the host
4440
+ *
4441
+ * @returns boolean to represent whether dialog.adaptiveCard.bot is supported
4442
+ *
4443
+ * @throws Error if {@linkcode app.initialize} has not successfully completed
4444
+ *
4445
+ * @beta
4446
+ */
4447
+ function isSupported(): boolean;
4448
+ }
4449
+ /**
4450
+ * @hidden
4451
+ * Hide from docs
4452
+ * --------
4453
+ * Convert AdaptiveCardDialogInfo to DialogInfo to send the information to host in {@linkcode adaptiveCard.open} API.
4454
+ *
4455
+ * @internal
4456
+ */
4457
+ function getDialogInfoFromAdaptiveCardDialogInfo(adaptiveCardDialogInfo: AdaptiveCardDialogInfo): DialogInfo;
4458
+ /**
4459
+ * @hidden
4460
+ * Hide from docs
4461
+ * --------
4462
+ * Convert BotAdaptiveCardDialogInfo to DialogInfo to send the information to host in {@linkcode adaptiveCard.open} API.
4463
+ *
4464
+ * @internal
4465
+ */
4466
+ function getDialogInfoFromBotAdaptiveCardDialogInfo(botAdaptiveCardDialogInfo: BotAdaptiveCardDialogInfo): DialogInfo;
4467
+ /**
4468
+ * @hidden
4469
+ * Converts {@link TaskInfo} to {@link AdaptiveCardDialogInfo}
4470
+ * @param taskInfo - TaskInfo object to convert
4471
+ * @returns - converted AdaptiveCardDialogInfo
4472
+ */
4473
+ function getAdaptiveCardDialogInfoFromTaskInfo(taskInfo: TaskInfo): AdaptiveCardDialogInfo;
4474
+ /**
4475
+ * @hidden
4476
+ * Converts {@link TaskInfo} to {@link BotAdaptiveCardDialogInfo}
4477
+ * @param taskInfo - TaskInfo object to convert
4478
+ * @returns - converted BotAdaptiveCardDialogInfo
4479
+ */
4480
+ function getBotAdaptiveCardDialogInfoFromTaskInfo(taskInfo: TaskInfo): BotAdaptiveCardDialogInfo;
4315
4481
  }
4316
- /**
4317
- * @hidden
4318
- *
4319
- * Convert UrlDialogInfo to DialogInfo to send the information to host in {@linkcode open} API.
4320
- *
4321
- * @internal
4322
- * Limited to Microsoft-internal use
4323
- *
4324
- * @beta
4325
- */
4326
- function getDialogInfoFromUrlDialogInfo(urlDialogInfo: UrlDialogInfo): DialogInfo;
4327
- /**
4328
- * @hidden
4329
- *
4330
- * Convert BotUrlDialogInfo to DialogInfo to send the information to host in {@linkcode bot.open} API.
4331
- *
4332
- * @internal
4333
- * Limited to Microsoft-internal use
4334
- *
4335
- * @beta
4336
- */
4337
- function getDialogInfoFromBotUrlDialogInfo(botUrlDialogInfo: BotUrlDialogInfo): DialogInfo;
4338
4482
  }
4339
4483
 
4340
4484
  /**
@@ -4438,6 +4582,12 @@ export namespace geoLocation {
4438
4582
  }
4439
4583
  }
4440
4584
 
4585
+ /**
4586
+ * @returns The {@linkcode: AdaptiveCardVersion} representing the Adaptive Card schema
4587
+ * version supported by the host, or undefined if the host does not support Adaptive Cards
4588
+ */
4589
+ export function getAdaptiveCardSchemaVersion(): AdaptiveCardVersion | undefined;
4590
+
4441
4591
  /**
4442
4592
  * Navigation-specific part of the SDK.
4443
4593
  */
@@ -7119,9 +7269,9 @@ export namespace settings {
7119
7269
  export namespace tasks {
7120
7270
  /**
7121
7271
  * @deprecated
7122
- * As of 2.0.0, please use {@link dialog.open dialog.open(urlDialogInfo: UrlDialogInfo, submitHandler?: DialogSubmitHandler, messageFromChildHandler?: PostMessageChannel): void} for url based dialogs
7123
- * and {@link dialog.bot.open dialog.bot.open(botUrlDialogInfo: BotUrlDialogInfo, submitHandler?: DialogSubmitHandler, messageFromChildHandler?: PostMessageChannel): void} for bot based dialogs. In Teams,
7124
- * this function can be used for adaptive card based dialogs. Support for adaptive card based dialogs is coming to other hosts in the future.
7272
+ * As of 2.0.0, please use {@link dialog.url.open dialog.url.open(urlDialogInfo: UrlDialogInfo, submitHandler?: DialogSubmitHandler, messageFromChildHandler?: PostMessageChannel): void} for url based dialogs
7273
+ * and {@link dialog.url.bot.open dialog.url.bot.open(botUrlDialogInfo: BotUrlDialogInfo, submitHandler?: DialogSubmitHandler, messageFromChildHandler?: PostMessageChannel): void} for bot-based dialogs. In Teams,
7274
+ * this function can be used for Adaptive Card-based dialogs. Support for Adaptive Card-based dialogs is coming to other hosts in the future.
7125
7275
  *
7126
7276
  * Allows an app to open the task module.
7127
7277
  *