@microsoft/teamsfx 1.1.2-alpha.988c78cba.0 → 1.1.2-alpha.9bd0cb559.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microsoft/teamsfx",
3
- "version": "1.1.2-alpha.988c78cba.0",
3
+ "version": "1.1.2-alpha.9bd0cb559.0",
4
4
  "description": "Microsoft Teams Framework for Node.js and browser.",
5
5
  "main": "dist/index.node.cjs.js",
6
6
  "browser": "dist/index.esm2017.js",
@@ -49,7 +49,7 @@
49
49
  "@azure/identity": "^2.0.1",
50
50
  "@azure/msal-browser": "^2.21.0",
51
51
  "@azure/msal-node": "~1.1.0",
52
- "@microsoft/adaptivecards-tools": "1.0.2-alpha.988c78cba.0",
52
+ "@microsoft/adaptivecards-tools": "1.0.2-alpha.9bd0cb559.0",
53
53
  "@microsoft/microsoft-graph-client": "^3.0.1",
54
54
  "adaptivecards": "^2.10.0",
55
55
  "axios": "^0.27.2",
@@ -129,7 +129,7 @@
129
129
  "webpack": "^5.62.1",
130
130
  "yargs": "^17.2.1"
131
131
  },
132
- "gitHead": "13bcc12655e618b23c410236f0c3b90cc3b15408",
132
+ "gitHead": "3af4b6e0aa2b7bcfbf2dbbf1fccbe4a03ea8a71b",
133
133
  "publishConfig": {
134
134
  "access": "public"
135
135
  },
@@ -1,8 +1,7 @@
1
1
  /// <reference types="node" />
2
2
 
3
3
  import { AccessToken } from '@azure/identity';
4
- import { Activity } from 'botbuilder-core';
5
- import { Activity as Activity_2 } from 'botbuilder';
4
+ import { Activity } from 'botbuilder';
6
5
  import { Attachment } from 'botbuilder';
7
6
  import { AuthenticationProvider } from '@microsoft/microsoft-graph-client';
8
7
  import { AxiosInstance } from 'axios';
@@ -12,26 +11,31 @@ import { CardAction } from 'botbuilder';
12
11
  import { CardImage } from 'botbuilder';
13
12
  import { ChannelInfo } from 'botbuilder';
14
13
  import { Client } from '@microsoft/microsoft-graph-client';
14
+ import { ComponentDialog } from 'botbuilder-dialogs';
15
15
  import { ConnectionConfig } from 'tedious';
16
16
  import { ConversationReference } from 'botbuilder';
17
+ import { ConversationState } from 'botbuilder';
17
18
  import { Dialog } from 'botbuilder-dialogs';
18
19
  import { DialogContext } from 'botbuilder-dialogs';
19
20
  import { DialogTurnResult } from 'botbuilder-dialogs';
20
21
  import { GetTokenOptions } from '@azure/identity';
21
22
  import { HeroCard } from 'botbuilder';
22
23
  import { IAdaptiveCard } from 'adaptivecards';
23
- import { InvokeResponse } from 'botbuilder-core';
24
- import { InvokeResponse as InvokeResponse_2 } from 'botbuilder';
24
+ import { InvokeResponse } from 'botbuilder';
25
25
  import { O365ConnectorCard } from 'botbuilder';
26
26
  import { ReceiptCard } from 'botbuilder';
27
27
  import { SecureContextOptions } from 'tls';
28
+ import { SigninStateVerificationQuery } from 'botbuilder';
29
+ import { StatePropertyAccessor } from 'botbuilder';
28
30
  import { StatusCodes } from 'botbuilder';
31
+ import { Storage as Storage_2 } from 'botbuilder';
32
+ import { TeamsActivityHandler } from 'botbuilder';
29
33
  import { TeamsChannelAccount } from 'botbuilder';
30
34
  import { ThumbnailCard } from 'botbuilder';
31
35
  import { TokenCredential } from '@azure/identity';
32
36
  import { TokenResponse } from 'botframework-schema';
33
- import { TurnContext } from 'botbuilder-core';
34
- import { TurnContext as TurnContext_2 } from 'botbuilder';
37
+ import { TurnContext } from 'botbuilder';
38
+ import { UserState } from 'botbuilder';
35
39
  import { WebRequest } from 'botbuilder';
36
40
  import { WebResponse } from 'botbuilder';
37
41
 
@@ -271,6 +275,176 @@ export declare class BearerTokenAuthProvider implements AuthProvider {
271
275
  AddAuthenticationInfo(config: AxiosRequestConfig): Promise<AxiosRequestConfig>;
272
276
  }
273
277
 
278
+ /**
279
+ * Interface for SSO configuration for Bot SSO
280
+ */
281
+ export declare interface BotSsoConfig {
282
+ /**
283
+ * aad related configurations
284
+ */
285
+ aad: {
286
+ /**
287
+ * The list of scopes for which the token will have access
288
+ */
289
+ scopes: string[];
290
+ } & AuthenticationConfiguration;
291
+ dialog?: {
292
+ /**
293
+ * Custom sso execution activity handler class which should implement the interface {@link BotSsoExecutionActivityHandler}. If not provided, it will use {@link DefaultBotSsoExecutionActivityHandler} by default
294
+ */
295
+ CustomBotSsoExecutionActivityHandler?: new (ssoConfig: BotSsoConfig) => BotSsoExecutionActivityHandler;
296
+ /**
297
+ * Conversation state for sso command bot, if not provided, it will use internal memory storage to create a new one.
298
+ */
299
+ conversationState?: ConversationState;
300
+ /**
301
+ * User state for sso command bot, if not provided, it will use internal memory storage to create a new one.
302
+ */
303
+ userState?: UserState;
304
+ /**
305
+ * Used by {@link BotSsoExecutionDialog} to remove duplicated messages, if not provided, it will use internal memory storage
306
+ */
307
+ dedupStorage?: Storage_2;
308
+ /**
309
+ * Settings used to configure an teams sso prompt dialog.
310
+ */
311
+ ssoPromptConfig?: {
312
+ /**
313
+ * Number of milliseconds the prompt will wait for the user to authenticate.
314
+ * Defaults to a value `900,000` (15 minutes.)
315
+ */
316
+ timeout?: number;
317
+ /**
318
+ * Value indicating whether the TeamsBotSsoPrompt should end upon receiving an
319
+ * invalid message. Generally the TeamsBotSsoPrompt will end the auth flow when receives user
320
+ * message not related to the auth flow. Setting the flag to false ignores the user's message instead.
321
+ * Defaults to value `true`
322
+ */
323
+ endOnInvalidMessage?: boolean;
324
+ };
325
+ };
326
+ }
327
+
328
+ /**
329
+ * Interface for user to customize SSO execution activity handler
330
+ *
331
+ * @remarks
332
+ * Bot SSO execution activity handler is to handle SSO login process and trigger SSO command using {@link BotSsoExecutionDialog}.
333
+ * You can use this interface to implement your own SSO execution dialog, and pass it to ConversationBot options:
334
+ *
335
+ * ```typescript
336
+ * export const commandBot = new ConversationBot({
337
+ * ...
338
+ * ssoConfig: {
339
+ * ...
340
+ * dialog: {
341
+ * CustomBotSsoExecutionActivityHandler: YourCustomBotSsoExecutionActivityHandler,
342
+ * }
343
+ * },
344
+ * ...
345
+ * });
346
+ * ```
347
+ * For details information about how to implement a BotSsoExecutionActivityHandler, please refer {@link DefaultBotSsoExecutionActivityHandler} class source code.
348
+ */
349
+ export declare interface BotSsoExecutionActivityHandler {
350
+ /**
351
+ * Add {@link TeamsFxBotSsoCommandHandler} instance to {@link BotSsoExecutionDialog}
352
+ * @param handler {@link BotSsoExecutionDialogHandler} callback function
353
+ * @param triggerPatterns The trigger pattern
354
+ *
355
+ * @remarks
356
+ * This function is used to add SSO command to {@link BotSsoExecutionDialog} instance.
357
+ */
358
+ addCommand(handler: BotSsoExecutionDialogHandler, triggerPatterns: TriggerPatterns): void;
359
+ /**
360
+ * Called to initiate the event emission process.
361
+ * @param context The context object for the current turn.
362
+ */
363
+ run(context: TurnContext): Promise<void>;
364
+ /**
365
+ * Receives invoke activities with Activity name of 'signin/verifyState'.
366
+ * @param context A context object for this turn.
367
+ * @param query Signin state (part of signin action auth flow) verification invoke query.
368
+ * @returns A promise that represents the work queued.
369
+ *
370
+ * @remarks
371
+ * It should trigger {@link BotSsoExecutionDialog} instance to handle signin process
372
+ */
373
+ handleTeamsSigninVerifyState(context: TurnContext, query: SigninStateVerificationQuery): Promise<void>;
374
+ /**
375
+ * Receives invoke activities with Activity name of 'signin/tokenExchange'
376
+ * @param context A context object for this turn.
377
+ * @param query Signin state (part of signin action auth flow) verification invoke query
378
+ * @returns A promise that represents the work queued.
379
+ *
380
+ * @remark
381
+ * It should trigger {@link BotSsoExecutionDialog} instance to handle signin process
382
+ */
383
+ handleTeamsSigninTokenExchange(context: TurnContext, query: SigninStateVerificationQuery): Promise<void>;
384
+ }
385
+
386
+ /**
387
+ * Sso execution dialog, use to handle sso command
388
+ */
389
+ export declare class BotSsoExecutionDialog extends ComponentDialog {
390
+ private dedupStorage;
391
+ private dedupStorageKeys;
392
+ private commandMapping;
393
+ /**
394
+ * Creates a new instance of the BotSsoExecutionDialog.
395
+ * @param dedupStorage Helper storage to remove duplicated messages
396
+ * @param settings The list of scopes for which the token will have access
397
+ * @param teamsfx {@link TeamsFx} instance for authentication
398
+ */
399
+ constructor(dedupStorage: Storage_2, ssoPromptSettings: TeamsBotSsoPromptSettings, teamsfx: TeamsFx, dialogName?: string);
400
+ /**
401
+ * Add TeamsFxBotSsoCommandHandler instance
402
+ * @param handler {@link BotSsoExecutionDialogHandler} callback function
403
+ * @param triggerPatterns The trigger pattern
404
+ */
405
+ addCommand(handler: BotSsoExecutionDialogHandler, triggerPatterns: TriggerPatterns): void;
406
+ private getCommandHash;
407
+ /**
408
+ * The run method handles the incoming activity (in the form of a DialogContext) and passes it through the dialog system.
409
+ *
410
+ * @param context The context object for the current turn.
411
+ * @param accessor The instance of StatePropertyAccessor for dialog system.
412
+ */
413
+ run(context: TurnContext, accessor: StatePropertyAccessor): Promise<void>;
414
+ private getActivityText;
415
+ private commandRouteStep;
416
+ private ssoStep;
417
+ private dedupStep;
418
+ /**
419
+ * Called when the component is ending.
420
+ *
421
+ * @param context Context for the current turn of conversation.
422
+ */
423
+ protected onEndDialog(context: TurnContext): Promise<void>;
424
+ /**
425
+ * If a user is signed into multiple Teams clients, the Bot might receive a "signin/tokenExchange" from each client.
426
+ * Each token exchange request for a specific user login will have an identical activity.value.Id.
427
+ * Only one of these token exchange requests should be processed by the bot. For a distributed bot in production,
428
+ * this requires a distributed storage to ensure only one token exchange is processed.
429
+ * @param context Context for the current turn of conversation.
430
+ * @returns boolean value indicate whether the message should be removed
431
+ */
432
+ private shouldDedup;
433
+ private getStorageKey;
434
+ private matchPattern;
435
+ private isPatternMatched;
436
+ private getMatchesCommandId;
437
+ /**
438
+ * Ensure bot is running in MS Teams since TeamsBotSsoPrompt is only supported in MS Teams channel.
439
+ * @param dc dialog context
440
+ * @throws {@link ErrorCode|ChannelNotSupported} if bot channel is not MS Teams
441
+ * @internal
442
+ */
443
+ private ensureMsTeamsChannel;
444
+ }
445
+
446
+ export declare type BotSsoExecutionDialogHandler = (context: TurnContext, tokenResponse: TeamsBotSsoPromptTokenResponse, message: CommandMessage) => Promise<void>;
447
+
274
448
  /**
275
449
  * A card action bot to respond to adaptive card universal actions.
276
450
  */
@@ -389,25 +563,39 @@ export declare class Channel implements NotificationTarget {
389
563
  export declare class CommandBot {
390
564
  private readonly adapter;
391
565
  private readonly middleware;
566
+ private readonly ssoConfig;
392
567
  /**
393
568
  * Creates a new instance of the `CommandBot`.
394
569
  *
395
570
  * @param adapter The bound `BotFrameworkAdapter`.
396
571
  * @param options - initialize options
397
572
  */
398
- constructor(adapter: BotFrameworkAdapter, options?: CommandOptions);
573
+ constructor(adapter: BotFrameworkAdapter, options?: CommandOptions, ssoCommandActivityHandler?: BotSsoExecutionActivityHandler, ssoConfig?: BotSsoConfig);
399
574
  /**
400
575
  * Registers a command into the command bot.
401
576
  *
402
- * @param command The command to registered.
577
+ * @param command The command to register.
403
578
  */
404
579
  registerCommand(command: TeamsFxBotCommandHandler): void;
405
580
  /**
406
581
  * Registers commands into the command bot.
407
582
  *
408
- * @param commands The command to registered.
583
+ * @param commands The commands to register.
409
584
  */
410
585
  registerCommands(commands: TeamsFxBotCommandHandler[]): void;
586
+ /**
587
+ * Registers a sso command into the command bot.
588
+ *
589
+ * @param command The command to register.
590
+ */
591
+ registerSsoCommand(ssoCommand: TeamsFxBotSsoCommandHandler): void;
592
+ /**
593
+ * Registers commands into the command bot.
594
+ *
595
+ * @param commands The commands to register.
596
+ */
597
+ registerSsoCommands(ssoCommands: TeamsFxBotSsoCommandHandler[]): void;
598
+ private validateSsoActivityHandler;
411
599
  }
412
600
 
413
601
  /**
@@ -432,6 +620,10 @@ export declare interface CommandOptions {
432
620
  * The commands to registered with the command bot. Each command should implement the interface {@link TeamsFxBotCommandHandler} so that it can be correctly handled by this command bot.
433
621
  */
434
622
  commands?: TeamsFxBotCommandHandler[];
623
+ /**
624
+ * The commands to registered with the sso command bot. Each sso command should implement the interface {@link TeamsFxBotSsoCommandHandler} so that it can be correctly handled by this command bot.
625
+ */
626
+ ssoCommands?: TeamsFxBotSsoCommandHandler[];
435
627
  }
436
628
 
437
629
  /**
@@ -533,7 +725,7 @@ export declare class ConversationBot {
533
725
  * });
534
726
  * ```
535
727
  */
536
- requestHandler(req: WebRequest, res: WebResponse, logic?: (context: TurnContext_2) => Promise<any>): Promise<void>;
728
+ requestHandler(req: WebRequest, res: WebResponse, logic?: (context: TurnContext) => Promise<any>): Promise<void>;
537
729
  }
538
730
 
539
731
  /**
@@ -558,6 +750,10 @@ export declare interface ConversationOptions {
558
750
  adapterConfig?: {
559
751
  [key: string]: unknown;
560
752
  };
753
+ /**
754
+ * Configurations for sso command bot
755
+ */
756
+ ssoConfig?: BotSsoConfig;
561
757
  /**
562
758
  * The command part.
563
759
  */
@@ -684,6 +880,59 @@ export declare function createPfxCertOption(pfx: string | Buffer, options?: {
684
880
  passphrase?: string;
685
881
  }): SecureContextOptions;
686
882
 
883
+ /**
884
+ * Default SSO execution activity handler
885
+ */
886
+ export declare class DefaultBotSsoExecutionActivityHandler extends TeamsActivityHandler implements BotSsoExecutionActivityHandler {
887
+ private ssoExecutionDialog;
888
+ private userState;
889
+ private conversationState;
890
+ private dialogState;
891
+ /**
892
+ * Creates a new instance of the DefaultBotSsoExecutionActivityHandler.
893
+ * @param ssoConfig configuration for SSO command bot
894
+ *
895
+ * @remarks
896
+ * In the constructor, it uses BotSsoConfig parameter which from {@link ConversationBot} options to initialize {@link BotSsoExecutionDialog}.
897
+ * It also need to register an event handler for the message event which trigger {@link BotSsoExecutionDialog} instance.
898
+ */
899
+ constructor(ssoConfig: BotSsoConfig);
900
+ /**
901
+ * Add TeamsFxBotSsoCommandHandler instance to SSO execution dialog
902
+ * @param handler {@link BotSsoExecutionDialogHandler} callback function
903
+ * @param triggerPatterns The trigger pattern
904
+ *
905
+ * @remarks
906
+ * This function is used to add SSO command to {@link BotSsoExecutionDialog} instance.
907
+ */
908
+ addCommand(handler: BotSsoExecutionDialogHandler, triggerPatterns: TriggerPatterns): void;
909
+ /**
910
+ * Called to initiate the event emission process.
911
+ * @param context The context object for the current turn.
912
+ */
913
+ run(context: TurnContext): Promise<void>;
914
+ /**
915
+ * Receives invoke activities with Activity name of 'signin/verifyState'.
916
+ * @param context A context object for this turn.
917
+ * @param query Signin state (part of signin action auth flow) verification invoke query.
918
+ * @returns A promise that represents the work queued.
919
+ *
920
+ * @remarks
921
+ * It should trigger {@link BotSsoExecutionDialog} instance to handle signin process
922
+ */
923
+ handleTeamsSigninVerifyState(context: TurnContext, query: SigninStateVerificationQuery): Promise<void>;
924
+ /**
925
+ * Receives invoke activities with Activity name of 'signin/tokenExchange'
926
+ * @param context A context object for this turn.
927
+ * @param query Signin state (part of signin action auth flow) verification invoke query
928
+ * @returns A promise that represents the work queued.
929
+ *
930
+ * @remark
931
+ * It should trigger {@link BotSsoExecutionDialog} instance to handle signin process
932
+ */
933
+ handleTeamsSigninTokenExchange(context: TurnContext, query: SigninStateVerificationQuery): Promise<void>;
934
+ }
935
+
687
936
  /**
688
937
  * Error code to trace the error types.
689
938
  */
@@ -708,6 +957,30 @@ export declare enum ErrorCode {
708
957
  * Channel is not supported error.
709
958
  */
710
959
  ChannelNotSupported = "ChannelNotSupported",
960
+ /**
961
+ * Failed to retrieve sso token
962
+ */
963
+ FailedToRetrieveSsoToken = "FailedToRetrieveSsoToken",
964
+ /**
965
+ * Failed to process sso handler
966
+ */
967
+ FailedToProcessSsoHandler = "FailedToProcessSsoHandler",
968
+ /**
969
+ * Cannot find command
970
+ */
971
+ CannotFindCommand = "CannotFindCommand",
972
+ /**
973
+ * Failed to run sso step
974
+ */
975
+ FailedToRunSsoStep = "FailedToRunSsoStep",
976
+ /**
977
+ * Failed to run dedup step
978
+ */
979
+ FailedToRunDedupStep = "FailedToRunDedupStep",
980
+ /**
981
+ * Sso activity handler is undefined
982
+ */
983
+ SsoActivityHandlerIsUndefined = "SsoActivityHandlerIsUndefined",
711
984
  /**
712
985
  * Runtime is not supported error.
713
986
  */
@@ -772,6 +1045,10 @@ export declare class ErrorWithCode extends Error {
772
1045
  */
773
1046
  export declare function getLogLevel(): LogLevel | undefined;
774
1047
 
1048
+ export declare interface GetTeamsUserTokenOptions extends GetTokenOptions {
1049
+ resources?: string[];
1050
+ }
1051
+
775
1052
  /**
776
1053
  * Generate connection configuration consumed by tedious.
777
1054
  *
@@ -853,7 +1130,7 @@ export declare class InvokeResponseFactory {
853
1130
  *
854
1131
  * @returns {InvokeResponse} An InvokeResponse object.
855
1132
  */
856
- static textMessage(message: string): InvokeResponse_2;
1133
+ static textMessage(message: string): InvokeResponse;
857
1134
  /**
858
1135
  * Create an invoke response from an adaptive card.
859
1136
  *
@@ -865,7 +1142,7 @@ export declare class InvokeResponseFactory {
865
1142
  *
866
1143
  * @returns {InvokeResponse} An InvokeResponse object.
867
1144
  */
868
- static adaptiveCard(card: IAdaptiveCard): InvokeResponse_2;
1145
+ static adaptiveCard(card: IAdaptiveCard): InvokeResponse;
869
1146
  /**
870
1147
  * Create an invoke response with error code and message.
871
1148
  *
@@ -879,7 +1156,7 @@ export declare class InvokeResponseFactory {
879
1156
  *
880
1157
  * @returns {InvokeResponse} An InvokeResponse object.
881
1158
  */
882
- static errorResponse(errorCode: InvokeResponseErrorCode, errorMessage: string): InvokeResponse_2;
1159
+ static errorResponse(errorCode: InvokeResponseErrorCode, errorMessage: string): InvokeResponse;
883
1160
  /**
884
1161
  * Create an invoke response with status code and response value.
885
1162
  * @param statusCode The status code.
@@ -887,7 +1164,7 @@ export declare class InvokeResponseFactory {
887
1164
  *
888
1165
  * @returns {InvokeResponse} An InvokeResponse object.
889
1166
  */
890
- static createInvokeResponse(statusCode: StatusCodes, body?: unknown): InvokeResponse_2;
1167
+ static createInvokeResponse(statusCode: StatusCodes, body?: unknown): InvokeResponse;
891
1168
  }
892
1169
 
893
1170
  /**
@@ -1028,14 +1305,14 @@ export declare class MessageBuilder {
1028
1305
  * });
1029
1306
  * ```
1030
1307
  */
1031
- static attachAdaptiveCard<TData extends object>(cardTemplate: unknown, data: TData): Partial<Activity_2>;
1308
+ static attachAdaptiveCard<TData extends object>(cardTemplate: unknown, data: TData): Partial<Activity>;
1032
1309
  /**
1033
1310
  * Build a bot message activity attached with an adaptive card.
1034
1311
  *
1035
1312
  * @param card The adaptive card content.
1036
1313
  * @returns A bot message activity attached with an adaptive card.
1037
1314
  */
1038
- static attachAdaptiveCardWithoutData(card: unknown): Partial<Activity_2>;
1315
+ static attachAdaptiveCardWithoutData(card: unknown): Partial<Activity>;
1039
1316
  /**
1040
1317
  * Build a bot message activity attached with an hero card.
1041
1318
  *
@@ -1056,7 +1333,7 @@ export declare class MessageBuilder {
1056
1333
  * );
1057
1334
  * ```
1058
1335
  */
1059
- static attachHeroCard(title: string, images?: (CardImage | string)[], buttons?: (CardAction | string)[], other?: Partial<HeroCard>): Partial<Activity_2>;
1336
+ static attachHeroCard(title: string, images?: (CardImage | string)[], buttons?: (CardAction | string)[], other?: Partial<HeroCard>): Partial<Activity>;
1060
1337
  /**
1061
1338
  * Returns an attachment for a sign-in card.
1062
1339
  *
@@ -1069,20 +1346,20 @@ export declare class MessageBuilder {
1069
1346
  * @remarks
1070
1347
  * For channels that don't natively support sign-in cards, an alternative message is rendered.
1071
1348
  */
1072
- static attachSigninCard(title: string, url: string, text?: string): Partial<Activity_2>;
1349
+ static attachSigninCard(title: string, url: string, text?: string): Partial<Activity>;
1073
1350
  /**
1074
1351
  * Build a bot message activity attached with an Office 365 connector card.
1075
1352
  *
1076
1353
  * @param card A description of the Office 365 connector card.
1077
1354
  * @returns A bot message activity attached with an Office 365 connector card.
1078
1355
  */
1079
- static attachO365ConnectorCard(card: O365ConnectorCard): Partial<Activity_2>;
1356
+ static attachO365ConnectorCard(card: O365ConnectorCard): Partial<Activity>;
1080
1357
  /**
1081
1358
  * Build a message activity attached with a receipt card.
1082
1359
  * @param card A description of the receipt card.
1083
1360
  * @returns A message activity attached with a receipt card.
1084
1361
  */
1085
- static AttachReceiptCard(card: ReceiptCard): Partial<Activity_2>;
1362
+ static AttachReceiptCard(card: ReceiptCard): Partial<Activity>;
1086
1363
  /**
1087
1364
  *
1088
1365
  * @param title The card title.
@@ -1092,13 +1369,13 @@ export declare class MessageBuilder {
1092
1369
  * @param other Optional. Any additional properties to include on the card.
1093
1370
  * @returns A message activity attached with a thumbnail card
1094
1371
  */
1095
- static attachThumbnailCard(title: string, images?: (CardImage | string)[], buttons?: (CardAction | string)[], other?: Partial<ThumbnailCard>): Partial<Activity_2>;
1372
+ static attachThumbnailCard(title: string, images?: (CardImage | string)[], buttons?: (CardAction | string)[], other?: Partial<ThumbnailCard>): Partial<Activity>;
1096
1373
  /**
1097
1374
  * Add an attachement to a bot activity.
1098
1375
  * @param attachement The attachment object to attach.
1099
1376
  * @returns A message activity with an attachment.
1100
1377
  */
1101
- static attachContent(attachement: Attachment): Partial<Activity_2>;
1378
+ static attachContent(attachement: Attachment): Partial<Activity>;
1102
1379
  }
1103
1380
 
1104
1381
  /**
@@ -1671,7 +1948,7 @@ export declare class TeamsFx implements TeamsFxConfiguration {
1671
1948
  *
1672
1949
  * @throws {@link ErrorCode|IdentityTypeNotSupported} when setting app identity in browser.
1673
1950
  */
1674
- constructor(identityType?: IdentityType, customConfig?: Record<string, string>);
1951
+ constructor(identityType?: IdentityType, customConfig?: Record<string, string> | AuthenticationConfiguration);
1675
1952
  /**
1676
1953
  * Identity type set by user.
1677
1954
  *
@@ -1690,9 +1967,10 @@ export declare class TeamsFx implements TeamsFxConfiguration {
1690
1967
  getCredential(): TokenCredential;
1691
1968
  /**
1692
1969
  * Get user information.
1970
+ * @param {string[]} resources - The optional list of resources for full trust Teams apps.
1693
1971
  * @returns UserInfo object.
1694
1972
  */
1695
- getUserInfo(): Promise<UserInfo>;
1973
+ getUserInfo(resources?: string[]): Promise<UserInfo>;
1696
1974
  /**
1697
1975
  * Popup login page to get user's access token with specific scopes.
1698
1976
  *
@@ -1707,13 +1985,14 @@ export declare class TeamsFx implements TeamsFxConfiguration {
1707
1985
  * await teamsfx.login("https://graph.microsoft.com/User.Read Calendars.Read"); // multiple scopes using string
1708
1986
  * ```
1709
1987
  * @param scopes - The list of scopes for which the token will have access, before that, we will request user to consent.
1988
+ * @param {string[]} resources - The optional list of resources for full trust Teams apps.
1710
1989
  *
1711
1990
  * @throws {@link ErrorCode|InternalError} when failed to login with unknown error.
1712
1991
  * @throws {@link ErrorCode|ConsentFailed} when user canceled or failed to consent.
1713
1992
  * @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.
1714
1993
  * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.
1715
1994
  */
1716
- login(scopes: string | string[]): Promise<void>;
1995
+ login(scopes: string | string[], resources?: string[]): Promise<void>;
1717
1996
  /**
1718
1997
  * Set SSO token when using user identity in NodeJS.
1719
1998
  * @param {string} ssoToken - used for on behalf of user flow.
@@ -1803,6 +2082,26 @@ export declare interface TeamsFxBotCommandHandler {
1803
2082
  handleCommandReceived(context: TurnContext, message: CommandMessage): Promise<string | Partial<Activity> | void>;
1804
2083
  }
1805
2084
 
2085
+ /**
2086
+ * Interface for a command handler that can process sso command to a TeamsFx bot and return a response.
2087
+ */
2088
+ export declare interface TeamsFxBotSsoCommandHandler {
2089
+ /**
2090
+ * The string or regular expression patterns that can trigger this handler.
2091
+ */
2092
+ triggerPatterns: TriggerPatterns;
2093
+ /**
2094
+ * Handles a bot command received activity.
2095
+ *
2096
+ * @param context The bot context.
2097
+ * @param message The command message the user types from Teams.
2098
+ * @param ssoToken The sso token which can be used to exchange access token for the bot.
2099
+ * @returns A `Promise` representing an activity or text to send as the command response.
2100
+ * Or no return value if developers want to send the response activity by themselves in this method.
2101
+ */
2102
+ handleCommandReceived(context: TurnContext, message: CommandMessage, ssoToken: TeamsBotSsoPromptTokenResponse): Promise<string | Partial<Activity> | void>;
2103
+ }
2104
+
1806
2105
  /**
1807
2106
  * TeamsFx interface that provides credential and configuration.
1808
2107
  */
@@ -1825,9 +2124,10 @@ declare interface TeamsFxConfiguration {
1825
2124
  getCredential(): TokenCredential;
1826
2125
  /**
1827
2126
  * Get user information.
2127
+ * @param {string[]} resources - The optional list of resources for full trust Teams apps.
1828
2128
  * @returns UserInfo object.
1829
2129
  */
1830
- getUserInfo(): Promise<UserInfo>;
2130
+ getUserInfo(resources?: string[]): Promise<UserInfo>;
1831
2131
  /**
1832
2132
  * Popup login page to get user's access token with specific scopes.
1833
2133
  *
@@ -1842,13 +2142,14 @@ declare interface TeamsFxConfiguration {
1842
2142
  * await teamsfx.login("https://graph.microsoft.com/User.Read Calendars.Read"); // multiple scopes using string
1843
2143
  * ```
1844
2144
  * @param scopes - The list of scopes for which the token will have access, before that, we will request user to consent.
2145
+ * @param {string[]} resources - The optional list of resources for full trust Teams apps.
1845
2146
  *
1846
2147
  * @throws {@link ErrorCode|InternalError} when failed to login with unknown error.
1847
2148
  * @throws {@link ErrorCode|ConsentFailed} when user canceled or failed to consent.
1848
2149
  * @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.
1849
2150
  * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.
1850
2151
  */
1851
- login(scopes: string | string[]): Promise<void>;
2152
+ login(scopes: string | string[], resources?: string[]): Promise<void>;
1852
2153
  /**
1853
2154
  * Set SSO token when using user identity in NodeJS.
1854
2155
  * @param {string} ssoToken - used for on behalf of user flow.
@@ -1889,10 +2190,13 @@ export declare class TeamsUserCredential implements TokenCredential {
1889
2190
  constructor(authConfig: AuthenticationConfiguration);
1890
2191
  /**
1891
2192
  * Popup login page to get user's access token with specific scopes.
2193
+ *
2194
+ * @param {string[]} resources - The optional list of resources for full trust Teams apps.
2195
+ *
1892
2196
  * @remarks
1893
2197
  * Can only be used within Teams.
1894
2198
  */
1895
- login(scopes: string | string[]): Promise<void>;
2199
+ login(scopes: string | string[], resources?: string[]): Promise<void>;
1896
2200
  /**
1897
2201
  * Get access token from credential.
1898
2202
  * @remarks
@@ -1901,10 +2205,13 @@ export declare class TeamsUserCredential implements TokenCredential {
1901
2205
  getToken(scopes: string | string[], options?: GetTokenOptions): Promise<AccessToken | null>;
1902
2206
  /**
1903
2207
  * Get basic user info from SSO token
2208
+ *
2209
+ * @param {string[]} resources - The optional list of resources for full trust Teams apps.
2210
+ *
1904
2211
  * @remarks
1905
2212
  * Can only be used within Teams.
1906
2213
  */
1907
- getUserInfo(): Promise<UserInfo>;
2214
+ getUserInfo(resources?: string[]): Promise<UserInfo>;
1908
2215
  }
1909
2216
 
1910
2217
  /**