@microsoft/teamsfx 2.0.0-experimental.0 → 2.0.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.
@@ -8,7 +8,6 @@ import axios from 'axios';
8
8
  // Licensed under the MIT license.
9
9
  /**
10
10
  * Error code to trace the error types.
11
- * @beta
12
11
  */
13
12
  var ErrorCode;
14
13
  (function (ErrorCode) {
@@ -32,6 +31,30 @@ var ErrorCode;
32
31
  * Channel is not supported error.
33
32
  */
34
33
  ErrorCode["ChannelNotSupported"] = "ChannelNotSupported";
34
+ /**
35
+ * Failed to retrieve sso token
36
+ */
37
+ ErrorCode["FailedToRetrieveSsoToken"] = "FailedToRetrieveSsoToken";
38
+ /**
39
+ * Failed to process sso handler
40
+ */
41
+ ErrorCode["FailedToProcessSsoHandler"] = "FailedToProcessSsoHandler";
42
+ /**
43
+ * Cannot find command
44
+ */
45
+ ErrorCode["CannotFindCommand"] = "CannotFindCommand";
46
+ /**
47
+ * Failed to run sso step
48
+ */
49
+ ErrorCode["FailedToRunSsoStep"] = "FailedToRunSsoStep";
50
+ /**
51
+ * Failed to run dedup step
52
+ */
53
+ ErrorCode["FailedToRunDedupStep"] = "FailedToRunDedupStep";
54
+ /**
55
+ * Sso activity handler is undefined
56
+ */
57
+ ErrorCode["SsoActivityHandlerIsUndefined"] = "SsoActivityHandlerIsUndefined";
35
58
  /**
36
59
  * Runtime is not supported error.
37
60
  */
@@ -87,6 +110,15 @@ ErrorMessage.NodejsRuntimeNotSupported = "{0} is not supported in Node.";
87
110
  ErrorMessage.FailToAcquireTokenOnBehalfOfUser = "Failed to acquire access token on behalf of user: {0}";
88
111
  // ChannelNotSupported Error
89
112
  ErrorMessage.OnlyMSTeamsChannelSupported = "{0} is only supported in MS Teams Channel";
113
+ ErrorMessage.FailedToProcessSsoHandler = "Failed to process sso handler: {0}";
114
+ // FailedToRetrieveSsoToken Error
115
+ ErrorMessage.FailedToRetrieveSsoToken = "Failed to retrieve sso token, user failed to finish the AAD consent flow.";
116
+ // CannotFindCommand Error
117
+ ErrorMessage.CannotFindCommand = "Cannot find command: {0}";
118
+ ErrorMessage.FailedToRunSsoStep = "Failed to run dialog to retrieve sso token: {0}";
119
+ ErrorMessage.FailedToRunDedupStep = "Failed to run dialog to remove duplicated messages: {0}";
120
+ // SsoActivityHandlerIsUndefined Error
121
+ ErrorMessage.SsoActivityHandlerIsNull = "Sso command can only be used or added when sso activity handler is not undefined";
90
122
  // IdentityTypeNotSupported Error
91
123
  ErrorMessage.IdentityTypeNotSupported = "{0} identity is not supported in {1}";
92
124
  // AuthorizationInfoError
@@ -97,10 +129,9 @@ ErrorMessage.EmptyParameter = "Parameter {0} is empty";
97
129
  ErrorMessage.DuplicateHttpsOptionProperty = "Axios HTTPS agent already defined value for property {0}";
98
130
  ErrorMessage.DuplicateApiKeyInHeader = "The request already defined api key in request header with name {0}.";
99
131
  ErrorMessage.DuplicateApiKeyInQueryParam = "The request already defined api key in query parameter with name {0}.";
132
+ ErrorMessage.OnlySupportInQueryActivity = "The handleMessageExtensionQueryWithToken only support in handleTeamsMessagingExtensionQuery with composeExtension/query type.";
100
133
  /**
101
134
  * Error class with code and message thrown by the SDK.
102
- *
103
- * @beta
104
135
  */
105
136
  class ErrorWithCode extends Error {
106
137
  /**
@@ -108,8 +139,6 @@ class ErrorWithCode extends Error {
108
139
  *
109
140
  * @param {string} message - error message.
110
141
  * @param {ErrorCode} code - error code.
111
- *
112
- * @beta
113
142
  */
114
143
  constructor(message, code) {
115
144
  if (!code) {
@@ -127,8 +156,6 @@ class ErrorWithCode extends Error {
127
156
  // Licensed under the MIT license.
128
157
  /**
129
158
  * Log level.
130
- *
131
- * @beta
132
159
  */
133
160
  var LogLevel;
134
161
  (function (LogLevel) {
@@ -153,8 +180,6 @@ var LogLevel;
153
180
  * Update log level helper.
154
181
  *
155
182
  * @param { LogLevel } level - log level in configuration
156
- *
157
- * @beta
158
183
  */
159
184
  function setLogLevel(level) {
160
185
  internalLogger.level = level;
@@ -163,8 +188,6 @@ function setLogLevel(level) {
163
188
  * Get log level.
164
189
  *
165
190
  * @returns Log level
166
- *
167
- * @beta
168
191
  */
169
192
  function getLogLevel() {
170
193
  return internalLogger.level;
@@ -239,8 +262,6 @@ const internalLogger = new InternalLogger();
239
262
  * error: console.error,
240
263
  * });
241
264
  * ```
242
- *
243
- * @beta
244
265
  */
245
266
  function setLogger(logger) {
246
267
  internalLogger.customLogger = logger;
@@ -258,8 +279,6 @@ function setLogger(logger) {
258
279
  * }
259
280
  * });
260
281
  * ```
261
- *
262
- * @beta
263
282
  */
264
283
  function setLogFunction(logFunction) {
265
284
  internalLogger.customLogFunction = logFunction;
@@ -302,6 +321,7 @@ function getUserInfoFromSsoToken(ssoToken) {
302
321
  const userInfo = {
303
322
  displayName: tokenObject.name,
304
323
  objectId: tokenObject.oid,
324
+ tenantId: tokenObject.tid,
305
325
  preferredUserName: "",
306
326
  };
307
327
  if (tokenObject.ver === "2.0") {
@@ -410,17 +430,8 @@ function validateScopesType(value) {
410
430
  *
411
431
  * @remarks
412
432
  * Only works in in server side.
413
- *
414
- * @beta
415
433
  */
416
434
  class AppCredential {
417
- /**
418
- * Constructor of AppCredential.
419
- *
420
- * @remarks
421
- * Only works in in server side.
422
- * @beta
423
- */
424
435
  constructor(authConfig) {
425
436
  throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "AppCredential"), ErrorCode.RuntimeNotSupported);
426
437
  }
@@ -429,7 +440,6 @@ class AppCredential {
429
440
  *
430
441
  * @remarks
431
442
  * Only works in in server side.
432
- * @beta
433
443
  */
434
444
  async getToken(scopes, options) {
435
445
  throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "AppCredential"), ErrorCode.RuntimeNotSupported);
@@ -442,17 +452,8 @@ class AppCredential {
442
452
  *
443
453
  * @remarks
444
454
  * Can only be used in server side.
445
- *
446
- * @beta
447
455
  */
448
456
  class OnBehalfOfUserCredential {
449
- /**
450
- * Constructor of OnBehalfOfUserCredential
451
- *
452
- * @remarks
453
- * Can Only works in in server side.
454
- * @beta
455
- */
456
457
  constructor(ssoToken, config) {
457
458
  throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "OnBehalfOfUserCredential"), ErrorCode.RuntimeNotSupported);
458
459
  }
@@ -460,7 +461,6 @@ class OnBehalfOfUserCredential {
460
461
  * Get access token from credential.
461
462
  * @remarks
462
463
  * Can only be used in server side.
463
- * @beta
464
464
  */
465
465
  async getToken(scopes, options) {
466
466
  throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "OnBehalfOfUserCredential"), ErrorCode.RuntimeNotSupported);
@@ -469,7 +469,6 @@ class OnBehalfOfUserCredential {
469
469
  * Get basic user info from SSO token.
470
470
  * @remarks
471
471
  * Can only be used in server side.
472
- * @beta
473
472
  */
474
473
  getUserInfo() {
475
474
  throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "OnBehalfOfUserCredential"), ErrorCode.RuntimeNotSupported);
@@ -485,34 +484,8 @@ const loginPageHeight = 535;
485
484
  *
486
485
  * @remarks
487
486
  * Can only be used within Teams.
488
- *
489
- * @beta
490
487
  */
491
488
  class TeamsUserCredential {
492
- /**
493
- * Constructor of TeamsUserCredential.
494
- *
495
- * @example
496
- * ```typescript
497
- * const config = {
498
- * authentication: {
499
- * initiateLoginEndpoint: "https://localhost:3000/auth-start.html",
500
- * clientId: "xxx"
501
- * }
502
- * }
503
- * // Use default configuration provided by Teams Toolkit
504
- * const credential = new TeamsUserCredential();
505
- * // Use a customized configuration
506
- * const anotherCredential = new TeamsUserCredential(config);
507
- * ```
508
- *
509
- * @param {AuthenticationConfiguration} authConfig - The authentication configuration. Use environment variables if not provided.
510
- *
511
- * @throws {@link ErrorCode|InvalidConfiguration} when client id, initiate login endpoint or simple auth endpoint is not found in config.
512
- * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.
513
- *
514
- * @beta
515
- */
516
489
  constructor(authConfig) {
517
490
  internalLogger.info("Create teams user credential");
518
491
  this.config = this.loadAndValidateConfig(authConfig);
@@ -533,20 +506,19 @@ class TeamsUserCredential {
533
506
  * await credential.login("https://graph.microsoft.com/User.Read Calendars.Read"); // multiple scopes using string
534
507
  * ```
535
508
  * @param scopes - The list of scopes for which the token will have access, before that, we will request user to consent.
509
+ * @param { string[] } resources - The optional list of resources for full trust Teams apps.
536
510
  *
537
511
  * @throws {@link ErrorCode|InternalError} when failed to login with unknown error.
538
512
  * @throws {@link ErrorCode|ConsentFailed} when user canceled or failed to consent.
539
513
  * @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.
540
514
  * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.
541
- *
542
- * @beta
543
515
  */
544
- async login(scopes) {
516
+ async login(scopes, resources) {
545
517
  validateScopesType(scopes);
546
518
  const scopesStr = typeof scopes === "string" ? scopes : scopes.join(" ");
547
519
  internalLogger.info(`Popup login page to get user's access token with scopes: ${scopesStr}`);
548
520
  if (!this.initialized) {
549
- await this.init();
521
+ await this.init(resources);
550
522
  }
551
523
  await app.initialize();
552
524
  let result;
@@ -595,6 +567,9 @@ class TeamsUserCredential {
595
567
  * Get access token from credential.
596
568
  *
597
569
  * Important: Access tokens are stored in sessionStorage, read more here: https://aka.ms/teamsfx-session-storage-notice
570
+ * Important: Full trust applications do not read the resource information from the webApplicationInfo section of the app
571
+ * manifest. Instead, this resource (along with any additional resources from which to request tokens) must be provided
572
+ * as a list of resources to the getToken() method through a GetTeamsUserTokenOptions object.
598
573
  *
599
574
  * @example
600
575
  * ```typescript
@@ -608,6 +583,9 @@ class TeamsUserCredential {
608
583
  * await credential.getToken("User.Read Application.Read.All") // Get Graph access token for multiple scopes using space-separated string
609
584
  * await credential.getToken("https://graph.microsoft.com/User.Read") // Get Graph access token with full resource URI
610
585
  * await credential.getToken(["https://outlook.office.com/Mail.Read"]) // Get Outlook access token
586
+ *
587
+ * const options: GetTeamsUserTokenOptions = { resources: ["https://domain.example.com"] }; // set up resources for full trust apps.
588
+ * await credential.getToken([], options) // Get sso token from teams client - only use this approach for full trust apps.
611
589
  * ```
612
590
  *
613
591
  * @param {string | string[]} scopes - The list of scopes for which the token will have access.
@@ -622,12 +600,12 @@ class TeamsUserCredential {
622
600
  * If scopes is empty string or array, it returns SSO token.
623
601
  * If scopes is non-empty, it returns access token for target scope.
624
602
  * Throw error if get access token failed.
625
- *
626
- * @beta
627
603
  */
628
604
  async getToken(scopes, options) {
605
+ var _a;
629
606
  validateScopesType(scopes);
630
- const ssoToken = await this.getSSOToken();
607
+ const resources = (_a = options) === null || _a === void 0 ? void 0 : _a.resources;
608
+ const ssoToken = await this.getSSOToken(resources);
631
609
  const scopeStr = typeof scopes === "string" ? scopes : scopes.join(" ");
632
610
  if (scopeStr === "") {
633
611
  internalLogger.info("Get SSO token");
@@ -636,7 +614,7 @@ class TeamsUserCredential {
636
614
  else {
637
615
  internalLogger.info("Get access token with scopes: " + scopeStr);
638
616
  if (!this.initialized) {
639
- await this.init();
617
+ await this.init(resources);
640
618
  }
641
619
  let tokenResponse;
642
620
  const scopesArray = typeof scopes === "string" ? scopes.split(" ") : scopes;
@@ -682,6 +660,8 @@ class TeamsUserCredential {
682
660
  /**
683
661
  * Get basic user info from SSO token
684
662
  *
663
+ * @param {string[]} resources - The optional list of resources for full trust Teams apps.
664
+ *
685
665
  * @example
686
666
  * ```typescript
687
667
  * const currentUser = await credential.getUserInfo();
@@ -692,16 +672,14 @@ class TeamsUserCredential {
692
672
  * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.
693
673
  *
694
674
  * @returns Basic user info with user displayName, objectId and preferredUserName.
695
- *
696
- * @beta
697
675
  */
698
- async getUserInfo() {
676
+ async getUserInfo(resources) {
699
677
  internalLogger.info("Get basic user info from SSO token");
700
- const ssoToken = await this.getSSOToken();
678
+ const ssoToken = await this.getSSOToken(resources);
701
679
  return getUserInfoFromSsoToken(ssoToken.token);
702
680
  }
703
- async init() {
704
- const ssoToken = await this.getSSOToken();
681
+ async init(resources) {
682
+ const ssoToken = await this.getSSOToken(resources);
705
683
  const info = getTenantIdAndLoginHintFromSsoToken(ssoToken.token);
706
684
  this.loginHint = info.loginHint;
707
685
  this.tid = info.tid;
@@ -720,19 +698,29 @@ class TeamsUserCredential {
720
698
  /**
721
699
  * Get SSO token using teams SDK
722
700
  * It will try to get SSO token from memory first, if SSO token doesn't exist or about to expired, then it will using teams SDK to get SSO token
701
+ *
702
+ * @param {string[]} resources - The optional list of resources for full trust Teams apps.
703
+ *
723
704
  * @returns SSO token
724
705
  */
725
- async getSSOToken() {
706
+ async getSSOToken(resources) {
726
707
  if (this.ssoToken) {
727
708
  if (this.ssoToken.expiresOnTimestamp - Date.now() > tokenRefreshTimeSpanInMillisecond) {
728
709
  internalLogger.verbose("Get SSO token from memory cache");
729
710
  return this.ssoToken;
730
711
  }
731
712
  }
732
- const params = {};
713
+ const params = { resources: resources !== null && resources !== void 0 ? resources : [] };
733
714
  let token;
734
715
  try {
735
716
  await app.initialize();
717
+ }
718
+ catch (err) {
719
+ const errorMsg = "Initialize teams sdk failed due to not running inside Teams environment";
720
+ internalLogger.error(errorMsg);
721
+ throw new ErrorWithCode(errorMsg, ErrorCode.InternalError);
722
+ }
723
+ try {
736
724
  token = await authentication.getAuthToken(params);
737
725
  }
738
726
  catch (err) {
@@ -796,40 +784,16 @@ class TeamsUserCredential {
796
784
  throw new ErrorWithCode(errorMessage, ErrorCode.InternalError);
797
785
  }
798
786
  }
799
- // Come from here: https://github.com/wictorwilen/msteams-react-base-component/blob/master/src/useTeams.ts
800
- checkInTeams() {
801
- if ((window.parent === window.self && window.nativeInterface) ||
802
- window.navigator.userAgent.includes("Teams/") ||
803
- window.name === "embedded-page-container" ||
804
- window.name === "extension-tab-frame") {
805
- return true;
806
- }
807
- return false;
808
- }
809
787
  }
810
788
 
811
789
  // Copyright (c) Microsoft Corporation.
812
790
  const defaultScope = "https://graph.microsoft.com/.default";
813
791
  /**
814
792
  * Microsoft Graph auth provider for Teams Framework
815
- *
816
- * @beta
817
793
  */
818
794
  class MsGraphAuthProvider {
819
- /**
820
- * Constructor of MsGraphAuthProvider.
821
- *
822
- * @param {TeamsFx} teamsfx - Used to provide configuration and auth.
823
- * @param {string | string[]} scopes - The list of scopes for which the token will have access.
824
- *
825
- * @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.
826
- *
827
- * @returns An instance of MsGraphAuthProvider.
828
- *
829
- * @beta
830
- */
831
- constructor(teamsfx, scopes) {
832
- this.teamsfx = teamsfx;
795
+ constructor(credentialOrTeamsFx, scopes) {
796
+ this.credentialOrTeamsFx = credentialOrTeamsFx;
833
797
  let scopesStr = defaultScope;
834
798
  if (scopes) {
835
799
  validateScopesType(scopes);
@@ -855,7 +819,15 @@ class MsGraphAuthProvider {
855
819
  */
856
820
  async getAccessToken() {
857
821
  internalLogger.info(`Get Graph Access token with scopes: '${this.scopes}'`);
858
- const accessToken = await this.teamsfx.getCredential().getToken(this.scopes);
822
+ let accessToken;
823
+ if (this.credentialOrTeamsFx.getCredential) {
824
+ accessToken = await this.credentialOrTeamsFx
825
+ .getCredential()
826
+ .getToken(this.scopes);
827
+ }
828
+ else {
829
+ accessToken = await this.credentialOrTeamsFx.getToken(this.scopes);
830
+ }
859
831
  return new Promise((resolve, reject) => {
860
832
  if (accessToken) {
861
833
  resolve(accessToken.token);
@@ -872,7 +844,6 @@ class MsGraphAuthProvider {
872
844
  // Copyright (c) Microsoft Corporation.
873
845
  /**
874
846
  * Get Microsoft graph client.
875
- *
876
847
  * @example
877
848
  * Get Microsoft graph client by TokenCredential
878
849
  * ```typescript
@@ -918,8 +889,6 @@ class MsGraphAuthProvider {
918
889
  * @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.
919
890
  *
920
891
  * @returns Graph client with specified scopes.
921
- *
922
- * @beta
923
892
  */
924
893
  function createMicrosoftGraphClient(teamsfx, scopes) {
925
894
  internalLogger.info("Create Microsoft Graph Client");
@@ -928,14 +897,76 @@ function createMicrosoftGraphClient(teamsfx, scopes) {
928
897
  authProvider,
929
898
  });
930
899
  return graphClient;
900
+ }
901
+ // eslint-disable-next-line no-secrets/no-secrets
902
+ /**
903
+ * Get Microsoft graph client.
904
+ * @example
905
+ * Get Microsoft graph client by TokenCredential
906
+ * ```typescript
907
+ * // In browser: TeamsUserCredential
908
+ * const authConfig: TeamsUserCredentialAuthConfig = {
909
+ * clientId: "xxx",
910
+ initiateLoginEndpoint: "https://xxx/auth-start.html",
911
+ * };
912
+
913
+ * const credential = new TeamsUserCredential(authConfig);
914
+
915
+ * const scope = "User.Read";
916
+ * await credential.login(scope);
917
+
918
+ * const client = createMicrosoftGraphClientWithCredential(credential, scope);
919
+
920
+ * // In node: OnBehalfOfUserCredential
921
+ * const oboAuthConfig: OnBehalfOfCredentialAuthConfig = {
922
+ * authorityHost: "xxx",
923
+ * clientId: "xxx",
924
+ * tenantId: "xxx",
925
+ * clientSecret: "xxx",
926
+ * };
927
+
928
+ * const oboCredential = new OnBehalfOfUserCredential(ssoToken, oboAuthConfig);
929
+ * const scope = "User.Read";
930
+ * const client = createMicrosoftGraphClientWithCredential(oboCredential, scope);
931
+
932
+ * // In node: AppCredential
933
+ * const appAuthConfig: AppCredentialAuthConfig = {
934
+ * authorityHost: "xxx",
935
+ * clientId: "xxx",
936
+ * tenantId: "xxx",
937
+ * clientSecret: "xxx",
938
+ * };
939
+ * const appCredential = new AppCredential(appAuthConfig);
940
+ * const scope = "User.Read";
941
+ * const client = createMicrosoftGraphClientWithCredential(appCredential, scope);
942
+ *
943
+ * const profile = await client.api("/me").get();
944
+ * ```
945
+ *
946
+ * @param {TokenCredential} credential - Used to provide configuration and auth.
947
+ * @param scopes - The array of Microsoft Token scope of access. Default value is `[.default]`.
948
+ *
949
+ * @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.
950
+ *
951
+ * @returns Graph client with specified scopes.
952
+ */
953
+ function createMicrosoftGraphClientWithCredential(credential, scopes) {
954
+ internalLogger.info("Create Microsoft Graph Client");
955
+ const authProvider = new MsGraphAuthProvider(credential, scopes);
956
+ const graphClient = Client.initWithMiddleware({
957
+ authProvider,
958
+ });
959
+ return graphClient;
931
960
  }
932
961
 
933
962
  // Copyright (c) Microsoft Corporation.
934
963
  /**
935
964
  * Generate connection configuration consumed by tedious.
965
+ *
966
+ * @deprecated we recommend you compose your own Tedious configuration for better flexibility.
967
+ *
936
968
  * @remarks
937
969
  * Only works in in server side.
938
- * @beta
939
970
  */
940
971
  async function getTediousConnectionConfig(teamsfx, databaseName) {
941
972
  throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "DefaultTediousConnectionConfiguration"), ErrorCode.RuntimeNotSupported);
@@ -989,8 +1020,6 @@ async function getTediousConnectionConfig(teamsfx, databaseName) {
989
1020
  * }
990
1021
  * ]));
991
1022
  * ```
992
- *
993
- * @beta
994
1023
  */
995
1024
  class TeamsBotSsoPrompt {
996
1025
  /**
@@ -1001,8 +1030,6 @@ class TeamsBotSsoPrompt {
1001
1030
  *
1002
1031
  * @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.
1003
1032
  * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
1004
- *
1005
- * @beta
1006
1033
  */
1007
1034
  constructor(teamsfx, dialogId, settings) {
1008
1035
  this.teamsfx = teamsfx;
@@ -1022,8 +1049,6 @@ class TeamsBotSsoPrompt {
1022
1049
  * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
1023
1050
  *
1024
1051
  * @returns A `Promise` representing the asynchronous operation.
1025
- *
1026
- * @beta
1027
1052
  */
1028
1053
  async beginDialog(dc) {
1029
1054
  throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotSsoPrompt"), ErrorCode.RuntimeNotSupported);
@@ -1043,8 +1068,6 @@ class TeamsBotSsoPrompt {
1043
1068
  *
1044
1069
  * @throws {@link ErrorCode|ChannelNotSupported} when bot channel is not MS Teams.
1045
1070
  * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
1046
- *
1047
- * @beta
1048
1071
  */
1049
1072
  async continueDialog(dc) {
1050
1073
  throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotSsoPrompt"), ErrorCode.RuntimeNotSupported);
@@ -1063,8 +1086,6 @@ class TeamsBotSsoPrompt {
1063
1086
  * ```typescript
1064
1087
  * const client = createApiClient("https://my-api-endpoint-base-url", new BasicAuthProvider("xxx","xxx"));
1065
1088
  * ```
1066
- *
1067
- * @beta
1068
1089
  */
1069
1090
  function createApiClient(apiEndpoint, authProvider) {
1070
1091
  // Add a request interceptor
@@ -1080,14 +1101,10 @@ function createApiClient(apiEndpoint, authProvider) {
1080
1101
  // Copyright (c) Microsoft Corporation.
1081
1102
  /**
1082
1103
  * Provider that handles Bearer Token authentication
1083
- *
1084
- * @beta
1085
1104
  */
1086
1105
  class BearerTokenAuthProvider {
1087
1106
  /**
1088
1107
  * @param { () => Promise<string> } getToken - Function that returns the content of bearer token used in http request
1089
- *
1090
- * @beta
1091
1108
  */
1092
1109
  constructor(getToken) {
1093
1110
  this.getToken = getToken;
@@ -1101,8 +1118,6 @@ class BearerTokenAuthProvider {
1101
1118
  * @returns Updated axios request config.
1102
1119
  *
1103
1120
  * @throws {@link ErrorCode|AuthorizationInfoAlreadyExists} - when Authorization header already exists in request configuration.
1104
- *
1105
- * @beta
1106
1121
  */
1107
1122
  async AddAuthenticationInfo(config) {
1108
1123
  const token = await this.getToken();
@@ -1120,8 +1135,6 @@ class BearerTokenAuthProvider {
1120
1135
  // Copyright (c) Microsoft Corporation.
1121
1136
  /**
1122
1137
  * Provider that handles Basic authentication
1123
- *
1124
- * @beta
1125
1138
  */
1126
1139
  class BasicAuthProvider {
1127
1140
  /**
@@ -1131,8 +1144,6 @@ class BasicAuthProvider {
1131
1144
  *
1132
1145
  * @throws {@link ErrorCode|InvalidParameter} - when username or password is empty.
1133
1146
  * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
1134
- *
1135
- * @beta
1136
1147
  */
1137
1148
  constructor(userName, password) {
1138
1149
  throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "BasicAuthProvider"), ErrorCode.RuntimeNotSupported);
@@ -1147,8 +1158,6 @@ class BasicAuthProvider {
1147
1158
  *
1148
1159
  * @throws {@link ErrorCode|AuthorizationInfoAlreadyExists} - when Authorization header or auth property already exists in request configuration.
1149
1160
  * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
1150
- *
1151
- * @beta
1152
1161
  */
1153
1162
  async AddAuthenticationInfo(config) {
1154
1163
  throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "BasicAuthProvider"), ErrorCode.RuntimeNotSupported);
@@ -1158,8 +1167,6 @@ class BasicAuthProvider {
1158
1167
  // Copyright (c) Microsoft Corporation.
1159
1168
  /**
1160
1169
  * Provider that handles API Key authentication
1161
- *
1162
- * @beta
1163
1170
  */
1164
1171
  class ApiKeyProvider {
1165
1172
  /**
@@ -1170,8 +1177,6 @@ class ApiKeyProvider {
1170
1177
  *
1171
1178
  * @throws {@link ErrorCode|InvalidParameter} - when key name or key value is empty.
1172
1179
  * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
1173
- *
1174
- * @beta
1175
1180
  */
1176
1181
  constructor(keyName, keyValue, keyLocation) {
1177
1182
  throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "ApiKeyProvider"), ErrorCode.RuntimeNotSupported);
@@ -1186,8 +1191,6 @@ class ApiKeyProvider {
1186
1191
  *
1187
1192
  * @throws {@link ErrorCode|AuthorizationInfoAlreadyExists} - when API key already exists in request header or url query parameter.
1188
1193
  * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
1189
- *
1190
- * @beta
1191
1194
  */
1192
1195
  async AddAuthenticationInfo(config) {
1193
1196
  throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "ApiKeyProvider"), ErrorCode.RuntimeNotSupported);
@@ -1195,8 +1198,6 @@ class ApiKeyProvider {
1195
1198
  }
1196
1199
  /**
1197
1200
  * Define available location for API Key location
1198
- *
1199
- * @beta
1200
1201
  */
1201
1202
  var ApiKeyLocation;
1202
1203
  (function (ApiKeyLocation) {
@@ -1213,15 +1214,11 @@ var ApiKeyLocation;
1213
1214
  // Copyright (c) Microsoft Corporation.
1214
1215
  /**
1215
1216
  * Provider that handles Certificate authentication
1216
- *
1217
- * @beta
1218
1217
  */
1219
1218
  class CertificateAuthProvider {
1220
1219
  /**
1221
1220
  *
1222
1221
  * @param { SecureContextOptions } certOption - information about the cert used in http requests
1223
- *
1224
- * @beta
1225
1222
  */
1226
1223
  constructor(certOption) {
1227
1224
  throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "CertificateAuthProvider"), ErrorCode.RuntimeNotSupported);
@@ -1236,8 +1233,6 @@ class CertificateAuthProvider {
1236
1233
  *
1237
1234
  * @throws {@link ErrorCode|InvalidParameter} - when custom httpsAgent in the request has duplicate properties with certOption provided in constructor.
1238
1235
  * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
1239
- *
1240
- * @beta
1241
1236
  */
1242
1237
  async AddAuthenticationInfo(config) {
1243
1238
  throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "CertificateAuthProvider"), ErrorCode.RuntimeNotSupported);
@@ -1279,8 +1274,6 @@ function createPfxCertOption(pfx, options) {
1279
1274
  // Licensed under the MIT license.
1280
1275
  /**
1281
1276
  * Identity type to use in authentication.
1282
- *
1283
- * @beta
1284
1277
  */
1285
1278
  var IdentityType;
1286
1279
  (function (IdentityType) {
@@ -1297,7 +1290,6 @@ var IdentityType;
1297
1290
  // Copyright (c) Microsoft Corporation.
1298
1291
  /**
1299
1292
  * A class providing credential and configuration.
1300
- * @beta
1301
1293
  */
1302
1294
  class TeamsFx {
1303
1295
  constructor(identityType, customConfig) {
@@ -1310,8 +1302,9 @@ class TeamsFx {
1310
1302
  this.configuration = new Map();
1311
1303
  this.loadFromEnv();
1312
1304
  if (customConfig) {
1313
- for (const key of Object.keys(customConfig)) {
1314
- const value = customConfig[key];
1305
+ const myConfig = Object.assign({}, customConfig);
1306
+ for (const key of Object.keys(myConfig)) {
1307
+ const value = myConfig[key];
1315
1308
  if (value) {
1316
1309
  this.configuration.set(key, value);
1317
1310
  }
@@ -1359,11 +1352,11 @@ class TeamsFx {
1359
1352
  }
1360
1353
  return this.teamsUserCredential;
1361
1354
  }
1362
- async getUserInfo() {
1363
- return await this.getCredential().getUserInfo();
1355
+ async getUserInfo(resources) {
1356
+ return await this.getCredential().getUserInfo(resources);
1364
1357
  }
1365
- async login(scopes) {
1366
- await this.getCredential().login(scopes);
1358
+ async login(scopes, resources) {
1359
+ await this.getCredential().login(scopes, resources);
1367
1360
  }
1368
1361
  setSsoToken(ssoToken) {
1369
1362
  return this;
@@ -1391,6 +1384,65 @@ class TeamsFx {
1391
1384
  }
1392
1385
  }
1393
1386
 
1387
+ // Copyright (c) Microsoft Corporation.
1388
+ // Licensed under the MIT license.
1389
+ /**
1390
+ * The target type where the notification will be sent to.
1391
+ *
1392
+ * @remarks
1393
+ * - "Channel" means to a team channel. (By default, notification to a team will be sent to its "General" channel.)
1394
+ * - "Group" means to a group chat.
1395
+ * - "Person" means to a personal chat.
1396
+ */
1397
+ var NotificationTargetType;
1398
+ (function (NotificationTargetType) {
1399
+ /**
1400
+ * The notification will be sent to a team channel.
1401
+ * (By default, notification to a team will be sent to its "General" channel.)
1402
+ */
1403
+ NotificationTargetType["Channel"] = "Channel";
1404
+ /**
1405
+ * The notification will be sent to a group chat.
1406
+ */
1407
+ NotificationTargetType["Group"] = "Group";
1408
+ /**
1409
+ * The notification will be sent to a personal chat.
1410
+ */
1411
+ NotificationTargetType["Person"] = "Person";
1412
+ })(NotificationTargetType || (NotificationTargetType = {}));
1413
+ /**
1414
+ * Options used to control how the response card will be sent to users.
1415
+ */
1416
+ var AdaptiveCardResponse;
1417
+ (function (AdaptiveCardResponse) {
1418
+ /**
1419
+ * The response card will be replaced the current one for the interactor who trigger the action.
1420
+ */
1421
+ AdaptiveCardResponse[AdaptiveCardResponse["ReplaceForInteractor"] = 0] = "ReplaceForInteractor";
1422
+ /**
1423
+ * The response card will be replaced the current one for all users in the chat.
1424
+ */
1425
+ AdaptiveCardResponse[AdaptiveCardResponse["ReplaceForAll"] = 1] = "ReplaceForAll";
1426
+ /**
1427
+ * The response card will be sent as a new message for all users in the chat.
1428
+ */
1429
+ AdaptiveCardResponse[AdaptiveCardResponse["NewForAll"] = 2] = "NewForAll";
1430
+ })(AdaptiveCardResponse || (AdaptiveCardResponse = {}));
1431
+ /**
1432
+ * Status code for an `application/vnd.microsoft.error` invoke response.
1433
+ */
1434
+ var InvokeResponseErrorCode;
1435
+ (function (InvokeResponseErrorCode) {
1436
+ /**
1437
+ * Invalid request.
1438
+ */
1439
+ InvokeResponseErrorCode[InvokeResponseErrorCode["BadRequest"] = 400] = "BadRequest";
1440
+ /**
1441
+ * Internal server error.
1442
+ */
1443
+ InvokeResponseErrorCode[InvokeResponseErrorCode["InternalServerError"] = 500] = "InternalServerError";
1444
+ })(InvokeResponseErrorCode || (InvokeResponseErrorCode = {}));
1445
+
1394
1446
  // Copyright (c) Microsoft Corporation.
1395
1447
  /**
1396
1448
  * Provide utilities for bot conversation, including:
@@ -1399,8 +1451,6 @@ class TeamsFx {
1399
1451
  *
1400
1452
  * @remarks
1401
1453
  * Only work on server side.
1402
- *
1403
- * @beta
1404
1454
  */
1405
1455
  class ConversationBot {
1406
1456
  /**
@@ -1410,8 +1460,6 @@ class ConversationBot {
1410
1460
  *
1411
1461
  * @remarks
1412
1462
  * Only work on server side.
1413
- *
1414
- * @beta
1415
1463
  */
1416
1464
  constructor(options) {
1417
1465
  throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "ConversationBot"), ErrorCode.RuntimeNotSupported);
@@ -1425,14 +1473,47 @@ class ConversationBot {
1425
1473
  *
1426
1474
  * @remarks
1427
1475
  * Only work on server side.
1428
- *
1429
- * @beta
1430
1476
  */
1431
1477
  async requestHandler(req, res, logic) {
1432
1478
  throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "ConversationBot"), ErrorCode.RuntimeNotSupported);
1433
1479
  }
1434
1480
  }
1435
1481
 
1482
+ // Copyright (c) Microsoft Corporation.
1483
+ /*
1484
+ * Sso execution dialog, use to handle sso command
1485
+ */
1486
+ class BotSsoExecutionDialog {
1487
+ constructor(dedupStorage, ssoPromptSettings, authConfig, ...args) {
1488
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "BotSsoExecutionDialog"), ErrorCode.RuntimeNotSupported);
1489
+ }
1490
+ /**
1491
+ * Add TeamsFxBotSsoCommandHandler instance
1492
+ * @param handler {@link BotSsoExecutionDialogHandler} callback function
1493
+ * @param triggerPatterns The trigger pattern
1494
+ */
1495
+ addCommand(handler, triggerPatterns) {
1496
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "BotSsoExecutionDialog"), ErrorCode.RuntimeNotSupported);
1497
+ }
1498
+ /**
1499
+ * The run method handles the incoming activity (in the form of a DialogContext) and passes it through the dialog system.
1500
+ *
1501
+ * @param context The context object for the current turn.
1502
+ * @param accessor The instance of StatePropertyAccessor for dialog system.
1503
+ */
1504
+ async run(context, accessor) {
1505
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "BotSsoExecutionDialog"), ErrorCode.RuntimeNotSupported);
1506
+ }
1507
+ /**
1508
+ * Called when the component is ending.
1509
+ *
1510
+ * @param context Context for the current turn of conversation.
1511
+ */
1512
+ async onEndDialog(context) {
1513
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "BotSsoExecutionDialog"), ErrorCode.RuntimeNotSupported);
1514
+ }
1515
+ }
1516
+
1436
1517
  // Copyright (c) Microsoft Corporation.
1437
1518
  /**
1438
1519
  * Send a plain text message to a notification target.
@@ -1442,11 +1523,10 @@ class ConversationBot {
1442
1523
  *
1443
1524
  * @param target - the notification target.
1444
1525
  * @param text - the plain text message.
1526
+ * @param onError - an optional error handler that can catch exceptions during message sending.
1445
1527
  * @returns A `Promise` representing the asynchronous operation.
1446
- *
1447
- * @beta
1448
1528
  */
1449
- function sendMessage(target, text) {
1529
+ function sendMessage(target, text, onError) {
1450
1530
  throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "sendMessage"), ErrorCode.RuntimeNotSupported);
1451
1531
  }
1452
1532
  /**
@@ -1457,11 +1537,10 @@ function sendMessage(target, text) {
1457
1537
  *
1458
1538
  * @param target - the notification target.
1459
1539
  * @param card - the adaptive card raw JSON.
1540
+ * @param onError - an optional error handler that can catch exceptions during adaptive card sending.
1460
1541
  * @returns A `Promise` representing the asynchronous operation.
1461
- *
1462
- * @beta
1463
1542
  */
1464
- function sendAdaptiveCard(target, card) {
1543
+ function sendAdaptiveCard(target, card, onError) {
1465
1544
  throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "sendAdaptiveCard"), ErrorCode.RuntimeNotSupported);
1466
1545
  }
1467
1546
  /**
@@ -1471,8 +1550,6 @@ function sendAdaptiveCard(target, card) {
1471
1550
  * Only work on server side.
1472
1551
  *
1473
1552
  * It's recommended to get channels from {@link TeamsBotInstallation.channels()}.
1474
- *
1475
- * @beta
1476
1553
  */
1477
1554
  class Channel {
1478
1555
  /**
@@ -1485,8 +1562,6 @@ class Channel {
1485
1562
  *
1486
1563
  * @param parent - The parent {@link TeamsBotInstallation} where this channel is created from.
1487
1564
  * @param info - Detailed channel information.
1488
- *
1489
- * @beta
1490
1565
  */
1491
1566
  constructor(parent, info) {
1492
1567
  /**
@@ -1494,10 +1569,8 @@ class Channel {
1494
1569
  *
1495
1570
  * @remarks
1496
1571
  * Only work on server side.
1497
- *
1498
- * @beta
1499
1572
  */
1500
- this.type = "Channel";
1573
+ this.type = NotificationTargetType.Channel;
1501
1574
  throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "Channel"), ErrorCode.RuntimeNotSupported);
1502
1575
  }
1503
1576
  /**
@@ -1507,11 +1580,10 @@ class Channel {
1507
1580
  * Only work on server side.
1508
1581
  *
1509
1582
  * @param text - the plain text message.
1510
- * @returns A `Promise` representing the asynchronous operation.
1511
- *
1512
- * @beta
1583
+ * @param onError - an optional error handler that can catch exceptions during message sending.
1584
+ * @returns the response of sending message.
1513
1585
  */
1514
- sendMessage(text) {
1586
+ sendMessage(text, onError) {
1515
1587
  throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "Channel"), ErrorCode.RuntimeNotSupported);
1516
1588
  }
1517
1589
  /**
@@ -1521,11 +1593,10 @@ class Channel {
1521
1593
  * Only work on server side.
1522
1594
  *
1523
1595
  * @param card - the adaptive card raw JSON.
1524
- * @returns A `Promise` representing the asynchronous operation.
1525
- *
1526
- * @beta
1596
+ * @param onError - an optional error handler that can catch exceptions during adaptive card sending.
1597
+ * @returns the response of sending adaptive card message.
1527
1598
  */
1528
- async sendAdaptiveCard(card) {
1599
+ async sendAdaptiveCard(card, onError) {
1529
1600
  throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "Channel"), ErrorCode.RuntimeNotSupported);
1530
1601
  }
1531
1602
  }
@@ -1536,8 +1607,6 @@ class Channel {
1536
1607
  * Only work on server side.
1537
1608
  *
1538
1609
  * It's recommended to get members from {@link TeamsBotInstallation.members()}.
1539
- *
1540
- * @beta
1541
1610
  */
1542
1611
  class Member {
1543
1612
  /**
@@ -1550,8 +1619,6 @@ class Member {
1550
1619
  *
1551
1620
  * @param parent - The parent {@link TeamsBotInstallation} where this member is created from.
1552
1621
  * @param account - Detailed member account information.
1553
- *
1554
- * @beta
1555
1622
  */
1556
1623
  constructor(parent, account) {
1557
1624
  /**
@@ -1559,10 +1626,8 @@ class Member {
1559
1626
  *
1560
1627
  * @remarks
1561
1628
  * Only work on server side.
1562
- *
1563
- * @beta
1564
1629
  */
1565
- this.type = "Person";
1630
+ this.type = NotificationTargetType.Person;
1566
1631
  throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "Member"), ErrorCode.RuntimeNotSupported);
1567
1632
  }
1568
1633
  /**
@@ -1572,11 +1637,10 @@ class Member {
1572
1637
  * Only work on server side.
1573
1638
  *
1574
1639
  * @param text - the plain text message.
1575
- * @returns A `Promise` representing the asynchronous operation.
1576
- *
1577
- * @beta
1640
+ * @param onError - an optional error handler that can catch exceptions during message sending.
1641
+ * @returns the response of sending message.
1578
1642
  */
1579
- sendMessage(text) {
1643
+ sendMessage(text, onError) {
1580
1644
  throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "Member"), ErrorCode.RuntimeNotSupported);
1581
1645
  }
1582
1646
  /**
@@ -1586,11 +1650,10 @@ class Member {
1586
1650
  * Only work on server side.
1587
1651
  *
1588
1652
  * @param card - the adaptive card raw JSON.
1589
- * @returns A `Promise` representing the asynchronous operation.
1590
- *
1591
- * @beta
1653
+ * @param onError - an optional error handler that can catch exceptions during adaptive card sending.
1654
+ * @returns the response of sending adaptive card message.
1592
1655
  */
1593
- async sendAdaptiveCard(card) {
1656
+ async sendAdaptiveCard(card, onError) {
1594
1657
  throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "Member"), ErrorCode.RuntimeNotSupported);
1595
1658
  }
1596
1659
  }
@@ -1604,8 +1667,6 @@ class Member {
1604
1667
  * Only work on server side.
1605
1668
  *
1606
1669
  * It's recommended to get bot installations from {@link ConversationBot.installations()}.
1607
- *
1608
- * @beta
1609
1670
  */
1610
1671
  class TeamsBotInstallation {
1611
1672
  /**
@@ -1618,8 +1679,6 @@ class TeamsBotInstallation {
1618
1679
  *
1619
1680
  * @param adapter - the bound `BotFrameworkAdapter`.
1620
1681
  * @param conversationReference - the bound `ConversationReference`.
1621
- *
1622
- * @beta
1623
1682
  */
1624
1683
  constructor(adapter, conversationReference) {
1625
1684
  throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotInstallation"), ErrorCode.RuntimeNotSupported);
@@ -1631,11 +1690,10 @@ class TeamsBotInstallation {
1631
1690
  * Only work on server side.
1632
1691
  *
1633
1692
  * @param text - the plain text message.
1634
- * @returns A `Promise` representing the asynchronous operation.
1635
- *
1636
- * @beta
1693
+ * @param onError - an optional error handler that can catch exceptions during message sending.
1694
+ * @returns the response of sending message.
1637
1695
  */
1638
- sendMessage(text) {
1696
+ sendMessage(text, onError) {
1639
1697
  throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotInstallation"), ErrorCode.RuntimeNotSupported);
1640
1698
  }
1641
1699
  /**
@@ -1645,11 +1703,10 @@ class TeamsBotInstallation {
1645
1703
  * Only work on server side.
1646
1704
  *
1647
1705
  * @param card - the adaptive card raw JSON.
1648
- * @returns A `Promise` representing the asynchronous operation.
1649
- *
1650
- * @beta
1706
+ * @param onError - an optional error handler that can catch exceptions during adaptive card sending.
1707
+ * @returns the response of sending adaptive card message.
1651
1708
  */
1652
- sendAdaptiveCard(card) {
1709
+ sendAdaptiveCard(card, onError) {
1653
1710
  throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotInstallation"), ErrorCode.RuntimeNotSupported);
1654
1711
  }
1655
1712
  /**
@@ -1659,8 +1716,6 @@ class TeamsBotInstallation {
1659
1716
  * Only work on server side.
1660
1717
  *
1661
1718
  * @returns an array of channels if bot is installed into a team, otherwise returns an empty array.
1662
- *
1663
- * @beta
1664
1719
  */
1665
1720
  async channels() {
1666
1721
  throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotInstallation"), ErrorCode.RuntimeNotSupported);
@@ -1672,12 +1727,18 @@ class TeamsBotInstallation {
1672
1727
  * Only work on server side.
1673
1728
  *
1674
1729
  * @returns an array of members from where the bot is installed.
1675
- *
1676
- * @beta
1677
1730
  */
1678
1731
  async members() {
1679
1732
  throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotInstallation"), ErrorCode.RuntimeNotSupported);
1680
1733
  }
1734
+ /**
1735
+ * Get team details from this bot installation
1736
+ *
1737
+ * @returns the team details if bot is installed into a team, otherwise returns undefined.
1738
+ */
1739
+ async getTeamDetails() {
1740
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotInstallation"), ErrorCode.RuntimeNotSupported);
1741
+ }
1681
1742
  }
1682
1743
  /**
1683
1744
  * Provide static utilities for bot notification.
@@ -1703,8 +1764,6 @@ class TeamsBotInstallation {
1703
1764
  * }
1704
1765
  * }
1705
1766
  * ```
1706
- *
1707
- * @beta
1708
1767
  */
1709
1768
  class NotificationBot {
1710
1769
  /**
@@ -1717,8 +1776,6 @@ class NotificationBot {
1717
1776
  *
1718
1777
  * @param adapter - the bound `BotFrameworkAdapter`
1719
1778
  * @param options - initialize options
1720
- *
1721
- * @beta
1722
1779
  */
1723
1780
  constructor(adapter, options) {
1724
1781
  throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported);
@@ -1732,13 +1789,93 @@ class NotificationBot {
1732
1789
  * The result is retrieving from the persisted storage.
1733
1790
  *
1734
1791
  * @returns - an array of {@link TeamsBotInstallation}.
1735
- *
1736
- * @beta
1737
1792
  */
1738
1793
  static async installations() {
1739
1794
  throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported);
1740
1795
  }
1741
- }
1796
+ /**
1797
+ * Returns the first {@link Member} where predicate is true, and undefined otherwise.
1798
+ *
1799
+ * @remarks
1800
+ * Only work on server side.
1801
+ *
1802
+ * @param predicate find calls predicate once for each member of the installation,
1803
+ * until it finds one where predicate returns true. If such a member is found, find
1804
+ * immediately returns that member. Otherwise, find returns undefined.
1805
+ * @param scope the scope to find members from the installations
1806
+ * (personal chat, group chat, Teams channel).
1807
+ * @returns the first {@link Member} where predicate is true, and undefined otherwise.
1808
+ */
1809
+ async findMember(predicate, scope) {
1810
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported);
1811
+ }
1812
+ /**
1813
+ * Returns the first {@link Channel} where predicate is true, and undefined otherwise.
1814
+ * (Ensure the bot app is installed into the `General` channel, otherwise undefined will be returned.)
1815
+ *
1816
+ * @remarks
1817
+ * Only work on server side.
1818
+ *
1819
+ * @param predicate find calls predicate once for each channel of the installation,
1820
+ * until it finds one where predicate returns true. If such a channel is found, find
1821
+ * immediately returns that channel. Otherwise, find returns undefined.
1822
+ * @returns the first {@link Channel} where predicate is true, and undefined otherwise.
1823
+ */
1824
+ async findChannel(predicate) {
1825
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported);
1826
+ }
1827
+ /**
1828
+ * Returns all {@link Member} where predicate is true, and empty array otherwise.
1829
+ *
1830
+ * @remarks
1831
+ * Only work on server side.
1832
+ *
1833
+ * @param predicate find calls predicate for each member of the installation.
1834
+ * @param scope the scope to find members from the installations
1835
+ * (personal chat, group chat, Teams channel).
1836
+ * @returns an array of {@link Member} where predicate is true, and empty array otherwise.
1837
+ */
1838
+ async findAllMembers(predicate, scope) {
1839
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported);
1840
+ }
1841
+ /**
1842
+ * Returns all {@link Channel} where predicate is true, and empty array otherwise.
1843
+ * (Ensure the bot app is installed into the `General` channel, otherwise empty array will be returned.)
1844
+ *
1845
+ * @remarks
1846
+ * Only work on server side.
1847
+ *
1848
+ * @param predicate find calls predicate for each channel of the installation.
1849
+ * @returns an array of {@link Channel} where predicate is true, and empty array otherwise.
1850
+ */
1851
+ async findAllChannels(predicate) {
1852
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported);
1853
+ }
1854
+ }
1855
+ /**
1856
+ * The search scope when calling {@link NotificationBot.findMember} and {@link NotificationBot.findAllMembers}.
1857
+ * The search scope is a flagged enum and it can be combined with `|`.
1858
+ * For example, to search from personal chat and group chat, use `SearchScope.Person | SearchScope.Group`.
1859
+ */
1860
+ var SearchScope;
1861
+ (function (SearchScope) {
1862
+ /**
1863
+ * Search members from the installations in personal chat only.
1864
+ */
1865
+ SearchScope[SearchScope["Person"] = 1] = "Person";
1866
+ /**
1867
+ * Search members from the installations in group chat only.
1868
+ */
1869
+ SearchScope[SearchScope["Group"] = 2] = "Group";
1870
+ /**
1871
+ * Search members from the installations in Teams channel only.
1872
+ */
1873
+ SearchScope[SearchScope["Channel"] = 4] = "Channel";
1874
+ /**
1875
+ * Search members from all installations including personal chat, group chat and Teams channel.
1876
+ */
1877
+ SearchScope[SearchScope["All"] = 7] = "All";
1878
+ })(SearchScope || (SearchScope = {}));
1742
1879
 
1743
1880
  // Copyright (c) Microsoft Corporation.
1744
1881
  /**
@@ -1746,8 +1883,6 @@ class NotificationBot {
1746
1883
  *
1747
1884
  * @remarks
1748
1885
  * Only work on server side.
1749
- *
1750
- * @beta
1751
1886
  */
1752
1887
  class CommandBot {
1753
1888
  /**
@@ -1755,8 +1890,6 @@ class CommandBot {
1755
1890
  *
1756
1891
  * @param adapter The bound `BotFrameworkAdapter`.
1757
1892
  * @param commands 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.
1758
- *
1759
- * @beta
1760
1893
  */
1761
1894
  constructor(adapter, commands) {
1762
1895
  throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "CommandBot"), ErrorCode.RuntimeNotSupported);
@@ -1768,8 +1901,6 @@ class CommandBot {
1768
1901
  *
1769
1902
  * @remarks
1770
1903
  * Only work on server side.
1771
- *
1772
- * @beta
1773
1904
  */
1774
1905
  registerCommand(command) {
1775
1906
  throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "CommandBot"), ErrorCode.RuntimeNotSupported);
@@ -1781,13 +1912,82 @@ class CommandBot {
1781
1912
  *
1782
1913
  * @remarks
1783
1914
  * Only work on server side.
1784
- *
1785
- * @beta
1786
1915
  */
1787
1916
  registerCommands(commands) {
1788
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "CommandnBot"), ErrorCode.RuntimeNotSupported);
1917
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "CommandBot"), ErrorCode.RuntimeNotSupported);
1918
+ }
1919
+ /**
1920
+ * Registers a sso command into the command bot.
1921
+ *
1922
+ * @param command The command to register.
1923
+ */
1924
+ registerSsoCommand(ssoCommand) {
1925
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "CommandBot"), ErrorCode.RuntimeNotSupported);
1926
+ }
1927
+ /**
1928
+ * Registers commands into the command bot.
1929
+ *
1930
+ * @param commands The commands to register.
1931
+ */
1932
+ registerSsoCommands(ssoCommands) {
1933
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "CommandBot"), ErrorCode.RuntimeNotSupported);
1789
1934
  }
1790
1935
  }
1791
1936
 
1792
- export { ApiKeyLocation, ApiKeyProvider, AppCredential, BasicAuthProvider, BearerTokenAuthProvider, CertificateAuthProvider, Channel, CommandBot, ConversationBot, ErrorCode, ErrorWithCode, IdentityType, LogLevel, Member, MsGraphAuthProvider, NotificationBot, OnBehalfOfUserCredential, TeamsBotInstallation, TeamsBotSsoPrompt, TeamsFx, TeamsUserCredential, createApiClient, createMicrosoftGraphClient, createPemCertOption, createPfxCertOption, getLogLevel, getTediousConnectionConfig, sendAdaptiveCard, sendMessage, setLogFunction, setLogLevel, setLogger };
1937
+ /**
1938
+ * A card action bot to respond to adaptive card universal actions.
1939
+ *
1940
+ * @remarks
1941
+ * Only work on server side.
1942
+ */
1943
+ class CardActionBot {
1944
+ /**
1945
+ * Creates a new instance of the `CardActionBot`.
1946
+ *
1947
+ * @param adapter The bound `BotFrameworkAdapter`.
1948
+ * @param options - initialize options
1949
+ */
1950
+ constructor(adapter, options) {
1951
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "CardActionBot"), ErrorCode.RuntimeNotSupported);
1952
+ }
1953
+ /**
1954
+ * Registers a card action handler to the bot.
1955
+ * @param actionHandler A card action handler to be registered.
1956
+ *
1957
+ * @remarks
1958
+ * Only work on server side.
1959
+ */
1960
+ registerHandler(actionHandler) {
1961
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "CardActionBot"), ErrorCode.RuntimeNotSupported);
1962
+ }
1963
+ /**
1964
+ * Registers card action handlers to the bot.
1965
+ * @param actionHandlers A set of card action handlers to be registered.
1966
+ *
1967
+ * @remarks
1968
+ * Only work on server side.
1969
+ */
1970
+ registerHandlers(actionHandlers) {
1971
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "CardActionBot"), ErrorCode.RuntimeNotSupported);
1972
+ }
1973
+ }
1974
+
1975
+ /**
1976
+ * Users execute query with SSO or Access Token.
1977
+ * @remarks
1978
+ * Only works in in server side.
1979
+ */
1980
+ async function handleMessageExtensionQueryWithToken(context, config, scopes, logic) {
1981
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "queryWithToken in message extension"), ErrorCode.RuntimeNotSupported);
1982
+ }
1983
+ /**
1984
+ * Users execute query with SSO or Access Token.
1985
+ * @remarks
1986
+ * Only works in in server side.
1987
+ */
1988
+ async function handleMessageExtensionQueryWithSSO(context, config, initiateLoginEndpoint, scopes, logic) {
1989
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "queryWithToken in message extension"), ErrorCode.RuntimeNotSupported);
1990
+ }
1991
+
1992
+ export { AdaptiveCardResponse, ApiKeyLocation, ApiKeyProvider, AppCredential, BasicAuthProvider, BearerTokenAuthProvider, BotSsoExecutionDialog, CardActionBot, CertificateAuthProvider, Channel, CommandBot, ConversationBot, ErrorCode, ErrorWithCode, IdentityType, InvokeResponseErrorCode, LogLevel, Member, MsGraphAuthProvider, NotificationBot, NotificationTargetType, OnBehalfOfUserCredential, TeamsBotInstallation, TeamsBotSsoPrompt, TeamsFx, TeamsUserCredential, createApiClient, createMicrosoftGraphClient, createMicrosoftGraphClientWithCredential, createPemCertOption, createPfxCertOption, getLogLevel, getTediousConnectionConfig, handleMessageExtensionQueryWithSSO, handleMessageExtensionQueryWithToken, sendAdaptiveCard, sendMessage, setLogFunction, setLogLevel, setLogger };
1793
1993
  //# sourceMappingURL=index.esm2017.js.map