@microsoft/teamsfx 2.0.0-experimental.0 → 2.0.1-alpha.ba6cc7dba.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.
@@ -9,7 +9,6 @@ import axios from 'axios';
9
9
  // Licensed under the MIT license.
10
10
  /**
11
11
  * Error code to trace the error types.
12
- * @beta
13
12
  */
14
13
  var ErrorCode;
15
14
  (function (ErrorCode) {
@@ -33,6 +32,30 @@ var ErrorCode;
33
32
  * Channel is not supported error.
34
33
  */
35
34
  ErrorCode["ChannelNotSupported"] = "ChannelNotSupported";
35
+ /**
36
+ * Failed to retrieve sso token
37
+ */
38
+ ErrorCode["FailedToRetrieveSsoToken"] = "FailedToRetrieveSsoToken";
39
+ /**
40
+ * Failed to process sso handler
41
+ */
42
+ ErrorCode["FailedToProcessSsoHandler"] = "FailedToProcessSsoHandler";
43
+ /**
44
+ * Cannot find command
45
+ */
46
+ ErrorCode["CannotFindCommand"] = "CannotFindCommand";
47
+ /**
48
+ * Failed to run sso step
49
+ */
50
+ ErrorCode["FailedToRunSsoStep"] = "FailedToRunSsoStep";
51
+ /**
52
+ * Failed to run dedup step
53
+ */
54
+ ErrorCode["FailedToRunDedupStep"] = "FailedToRunDedupStep";
55
+ /**
56
+ * Sso activity handler is undefined
57
+ */
58
+ ErrorCode["SsoActivityHandlerIsUndefined"] = "SsoActivityHandlerIsUndefined";
36
59
  /**
37
60
  * Runtime is not supported error.
38
61
  */
@@ -88,6 +111,15 @@ ErrorMessage.NodejsRuntimeNotSupported = "{0} is not supported in Node.";
88
111
  ErrorMessage.FailToAcquireTokenOnBehalfOfUser = "Failed to acquire access token on behalf of user: {0}";
89
112
  // ChannelNotSupported Error
90
113
  ErrorMessage.OnlyMSTeamsChannelSupported = "{0} is only supported in MS Teams Channel";
114
+ ErrorMessage.FailedToProcessSsoHandler = "Failed to process sso handler: {0}";
115
+ // FailedToRetrieveSsoToken Error
116
+ ErrorMessage.FailedToRetrieveSsoToken = "Failed to retrieve sso token, user failed to finish the AAD consent flow.";
117
+ // CannotFindCommand Error
118
+ ErrorMessage.CannotFindCommand = "Cannot find command: {0}";
119
+ ErrorMessage.FailedToRunSsoStep = "Failed to run dialog to retrieve sso token: {0}";
120
+ ErrorMessage.FailedToRunDedupStep = "Failed to run dialog to remove duplicated messages: {0}";
121
+ // SsoActivityHandlerIsUndefined Error
122
+ ErrorMessage.SsoActivityHandlerIsNull = "Sso command can only be used or added when sso activity handler is not undefined";
91
123
  // IdentityTypeNotSupported Error
92
124
  ErrorMessage.IdentityTypeNotSupported = "{0} identity is not supported in {1}";
93
125
  // AuthorizationInfoError
@@ -98,10 +130,9 @@ ErrorMessage.EmptyParameter = "Parameter {0} is empty";
98
130
  ErrorMessage.DuplicateHttpsOptionProperty = "Axios HTTPS agent already defined value for property {0}";
99
131
  ErrorMessage.DuplicateApiKeyInHeader = "The request already defined api key in request header with name {0}.";
100
132
  ErrorMessage.DuplicateApiKeyInQueryParam = "The request already defined api key in query parameter with name {0}.";
133
+ ErrorMessage.OnlySupportInQueryActivity = "The handleMessageExtensionQueryWithToken only support in handleTeamsMessagingExtensionQuery with composeExtension/query type.";
101
134
  /**
102
135
  * Error class with code and message thrown by the SDK.
103
- *
104
- * @beta
105
136
  */
106
137
  class ErrorWithCode extends Error {
107
138
  /**
@@ -109,8 +140,6 @@ class ErrorWithCode extends Error {
109
140
  *
110
141
  * @param {string} message - error message.
111
142
  * @param {ErrorCode} code - error code.
112
- *
113
- * @beta
114
143
  */
115
144
  constructor(message, code) {
116
145
  if (!code) {
@@ -128,8 +157,6 @@ class ErrorWithCode extends Error {
128
157
  // Licensed under the MIT license.
129
158
  /**
130
159
  * Log level.
131
- *
132
- * @beta
133
160
  */
134
161
  var LogLevel;
135
162
  (function (LogLevel) {
@@ -154,8 +181,6 @@ var LogLevel;
154
181
  * Update log level helper.
155
182
  *
156
183
  * @param { LogLevel } level - log level in configuration
157
- *
158
- * @beta
159
184
  */
160
185
  function setLogLevel(level) {
161
186
  internalLogger.level = level;
@@ -164,8 +189,6 @@ function setLogLevel(level) {
164
189
  * Get log level.
165
190
  *
166
191
  * @returns Log level
167
- *
168
- * @beta
169
192
  */
170
193
  function getLogLevel() {
171
194
  return internalLogger.level;
@@ -240,8 +263,6 @@ const internalLogger = new InternalLogger();
240
263
  * error: console.error,
241
264
  * });
242
265
  * ```
243
- *
244
- * @beta
245
266
  */
246
267
  function setLogger(logger) {
247
268
  internalLogger.customLogger = logger;
@@ -259,8 +280,6 @@ function setLogger(logger) {
259
280
  * }
260
281
  * });
261
282
  * ```
262
- *
263
- * @beta
264
283
  */
265
284
  function setLogFunction(logFunction) {
266
285
  internalLogger.customLogFunction = logFunction;
@@ -303,6 +322,7 @@ function getUserInfoFromSsoToken(ssoToken) {
303
322
  const userInfo = {
304
323
  displayName: tokenObject.name,
305
324
  objectId: tokenObject.oid,
325
+ tenantId: tokenObject.tid,
306
326
  preferredUserName: "",
307
327
  };
308
328
  if (tokenObject.ver === "2.0") {
@@ -411,8 +431,6 @@ function validateScopesType(value) {
411
431
  *
412
432
  * @remarks
413
433
  * Only works in in server side.
414
- *
415
- * @beta
416
434
  */
417
435
  class AppCredential {
418
436
  /**
@@ -420,7 +438,6 @@ class AppCredential {
420
438
  *
421
439
  * @remarks
422
440
  * Only works in in server side.
423
- * @beta
424
441
  */
425
442
  constructor(authConfig) {
426
443
  throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "AppCredential"), ErrorCode.RuntimeNotSupported);
@@ -430,7 +447,6 @@ class AppCredential {
430
447
  *
431
448
  * @remarks
432
449
  * Only works in in server side.
433
- * @beta
434
450
  */
435
451
  getToken(scopes, options) {
436
452
  return __awaiter(this, void 0, void 0, function* () {
@@ -445,8 +461,6 @@ class AppCredential {
445
461
  *
446
462
  * @remarks
447
463
  * Can only be used in server side.
448
- *
449
- * @beta
450
464
  */
451
465
  class OnBehalfOfUserCredential {
452
466
  /**
@@ -454,7 +468,6 @@ class OnBehalfOfUserCredential {
454
468
  *
455
469
  * @remarks
456
470
  * Can Only works in in server side.
457
- * @beta
458
471
  */
459
472
  constructor(ssoToken, config) {
460
473
  throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "OnBehalfOfUserCredential"), ErrorCode.RuntimeNotSupported);
@@ -463,7 +476,6 @@ class OnBehalfOfUserCredential {
463
476
  * Get access token from credential.
464
477
  * @remarks
465
478
  * Can only be used in server side.
466
- * @beta
467
479
  */
468
480
  getToken(scopes, options) {
469
481
  return __awaiter(this, void 0, void 0, function* () {
@@ -474,7 +486,6 @@ class OnBehalfOfUserCredential {
474
486
  * Get basic user info from SSO token.
475
487
  * @remarks
476
488
  * Can only be used in server side.
477
- * @beta
478
489
  */
479
490
  getUserInfo() {
480
491
  throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "OnBehalfOfUserCredential"), ErrorCode.RuntimeNotSupported);
@@ -490,8 +501,6 @@ const loginPageHeight = 535;
490
501
  *
491
502
  * @remarks
492
503
  * Can only be used within Teams.
493
- *
494
- * @beta
495
504
  */
496
505
  class TeamsUserCredential {
497
506
  /**
@@ -515,8 +524,6 @@ class TeamsUserCredential {
515
524
  *
516
525
  * @throws {@link ErrorCode|InvalidConfiguration} when client id, initiate login endpoint or simple auth endpoint is not found in config.
517
526
  * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.
518
- *
519
- * @beta
520
527
  */
521
528
  constructor(authConfig) {
522
529
  internalLogger.info("Create teams user credential");
@@ -538,21 +545,20 @@ class TeamsUserCredential {
538
545
  * await credential.login("https://graph.microsoft.com/User.Read Calendars.Read"); // multiple scopes using string
539
546
  * ```
540
547
  * @param scopes - The list of scopes for which the token will have access, before that, we will request user to consent.
548
+ * @param { string[] } resources - The optional list of resources for full trust Teams apps.
541
549
  *
542
550
  * @throws {@link ErrorCode|InternalError} when failed to login with unknown error.
543
551
  * @throws {@link ErrorCode|ConsentFailed} when user canceled or failed to consent.
544
552
  * @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.
545
553
  * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.
546
- *
547
- * @beta
548
554
  */
549
- login(scopes) {
555
+ login(scopes, resources) {
550
556
  return __awaiter(this, void 0, void 0, function* () {
551
557
  validateScopesType(scopes);
552
558
  const scopesStr = typeof scopes === "string" ? scopes : scopes.join(" ");
553
559
  internalLogger.info(`Popup login page to get user's access token with scopes: ${scopesStr}`);
554
560
  if (!this.initialized) {
555
- yield this.init();
561
+ yield this.init(resources);
556
562
  }
557
563
  yield app.initialize();
558
564
  let result;
@@ -602,6 +608,9 @@ class TeamsUserCredential {
602
608
  * Get access token from credential.
603
609
  *
604
610
  * Important: Access tokens are stored in sessionStorage, read more here: https://aka.ms/teamsfx-session-storage-notice
611
+ * Important: Full trust applications do not read the resource information from the webApplicationInfo section of the app
612
+ * manifest. Instead, this resource (along with any additional resources from which to request tokens) must be provided
613
+ * as a list of resources to the getToken() method through a GetTeamsUserTokenOptions object.
605
614
  *
606
615
  * @example
607
616
  * ```typescript
@@ -615,6 +624,9 @@ class TeamsUserCredential {
615
624
  * await credential.getToken("User.Read Application.Read.All") // Get Graph access token for multiple scopes using space-separated string
616
625
  * await credential.getToken("https://graph.microsoft.com/User.Read") // Get Graph access token with full resource URI
617
626
  * await credential.getToken(["https://outlook.office.com/Mail.Read"]) // Get Outlook access token
627
+ *
628
+ * const options: GetTeamsUserTokenOptions = { resources: ["https://domain.example.com"] }; // set up resources for full trust apps.
629
+ * await credential.getToken([], options) // Get sso token from teams client - only use this approach for full trust apps.
618
630
  * ```
619
631
  *
620
632
  * @param {string | string[]} scopes - The list of scopes for which the token will have access.
@@ -629,13 +641,13 @@ class TeamsUserCredential {
629
641
  * If scopes is empty string or array, it returns SSO token.
630
642
  * If scopes is non-empty, it returns access token for target scope.
631
643
  * Throw error if get access token failed.
632
- *
633
- * @beta
634
644
  */
635
645
  getToken(scopes, options) {
646
+ var _a;
636
647
  return __awaiter(this, void 0, void 0, function* () {
637
648
  validateScopesType(scopes);
638
- const ssoToken = yield this.getSSOToken();
649
+ const resources = (_a = options) === null || _a === void 0 ? void 0 : _a.resources;
650
+ const ssoToken = yield this.getSSOToken(resources);
639
651
  const scopeStr = typeof scopes === "string" ? scopes : scopes.join(" ");
640
652
  if (scopeStr === "") {
641
653
  internalLogger.info("Get SSO token");
@@ -644,7 +656,7 @@ class TeamsUserCredential {
644
656
  else {
645
657
  internalLogger.info("Get access token with scopes: " + scopeStr);
646
658
  if (!this.initialized) {
647
- yield this.init();
659
+ yield this.init(resources);
648
660
  }
649
661
  let tokenResponse;
650
662
  const scopesArray = typeof scopes === "string" ? scopes.split(" ") : scopes;
@@ -691,6 +703,8 @@ class TeamsUserCredential {
691
703
  /**
692
704
  * Get basic user info from SSO token
693
705
  *
706
+ * @param {string[]} resources - The optional list of resources for full trust Teams apps.
707
+ *
694
708
  * @example
695
709
  * ```typescript
696
710
  * const currentUser = await credential.getUserInfo();
@@ -701,19 +715,17 @@ class TeamsUserCredential {
701
715
  * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.
702
716
  *
703
717
  * @returns Basic user info with user displayName, objectId and preferredUserName.
704
- *
705
- * @beta
706
718
  */
707
- getUserInfo() {
719
+ getUserInfo(resources) {
708
720
  return __awaiter(this, void 0, void 0, function* () {
709
721
  internalLogger.info("Get basic user info from SSO token");
710
- const ssoToken = yield this.getSSOToken();
722
+ const ssoToken = yield this.getSSOToken(resources);
711
723
  return getUserInfoFromSsoToken(ssoToken.token);
712
724
  });
713
725
  }
714
- init() {
726
+ init(resources) {
715
727
  return __awaiter(this, void 0, void 0, function* () {
716
- const ssoToken = yield this.getSSOToken();
728
+ const ssoToken = yield this.getSSOToken(resources);
717
729
  const info = getTenantIdAndLoginHintFromSsoToken(ssoToken.token);
718
730
  this.loginHint = info.loginHint;
719
731
  this.tid = info.tid;
@@ -733,9 +745,12 @@ class TeamsUserCredential {
733
745
  /**
734
746
  * Get SSO token using teams SDK
735
747
  * 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
748
+ *
749
+ * @param {string[]} resources - The optional list of resources for full trust Teams apps.
750
+ *
736
751
  * @returns SSO token
737
752
  */
738
- getSSOToken() {
753
+ getSSOToken(resources) {
739
754
  return __awaiter(this, void 0, void 0, function* () {
740
755
  if (this.ssoToken) {
741
756
  if (this.ssoToken.expiresOnTimestamp - Date.now() > tokenRefreshTimeSpanInMillisecond) {
@@ -743,10 +758,17 @@ class TeamsUserCredential {
743
758
  return this.ssoToken;
744
759
  }
745
760
  }
746
- const params = {};
761
+ const params = { resources: resources !== null && resources !== void 0 ? resources : [] };
747
762
  let token;
748
763
  try {
749
764
  yield app.initialize();
765
+ }
766
+ catch (err) {
767
+ const errorMsg = "Initialize teams sdk failed due to not running inside Teams environment";
768
+ internalLogger.error(errorMsg);
769
+ throw new ErrorWithCode(errorMsg, ErrorCode.InternalError);
770
+ }
771
+ try {
750
772
  token = yield authentication.getAuthToken(params);
751
773
  }
752
774
  catch (err) {
@@ -811,24 +833,12 @@ class TeamsUserCredential {
811
833
  throw new ErrorWithCode(errorMessage, ErrorCode.InternalError);
812
834
  }
813
835
  }
814
- // Come from here: https://github.com/wictorwilen/msteams-react-base-component/blob/master/src/useTeams.ts
815
- checkInTeams() {
816
- if ((window.parent === window.self && window.nativeInterface) ||
817
- window.navigator.userAgent.includes("Teams/") ||
818
- window.name === "embedded-page-container" ||
819
- window.name === "extension-tab-frame") {
820
- return true;
821
- }
822
- return false;
823
- }
824
836
  }
825
837
 
826
838
  // Copyright (c) Microsoft Corporation.
827
839
  const defaultScope = "https://graph.microsoft.com/.default";
828
840
  /**
829
841
  * Microsoft Graph auth provider for Teams Framework
830
- *
831
- * @beta
832
842
  */
833
843
  class MsGraphAuthProvider {
834
844
  /**
@@ -840,8 +850,6 @@ class MsGraphAuthProvider {
840
850
  * @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.
841
851
  *
842
852
  * @returns An instance of MsGraphAuthProvider.
843
- *
844
- * @beta
845
853
  */
846
854
  constructor(teamsfx, scopes) {
847
855
  this.teamsfx = teamsfx;
@@ -935,8 +943,6 @@ class MsGraphAuthProvider {
935
943
  * @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.
936
944
  *
937
945
  * @returns Graph client with specified scopes.
938
- *
939
- * @beta
940
946
  */
941
947
  function createMicrosoftGraphClient(teamsfx, scopes) {
942
948
  internalLogger.info("Create Microsoft Graph Client");
@@ -952,7 +958,6 @@ function createMicrosoftGraphClient(teamsfx, scopes) {
952
958
  * Generate connection configuration consumed by tedious.
953
959
  * @remarks
954
960
  * Only works in in server side.
955
- * @beta
956
961
  */
957
962
  function getTediousConnectionConfig(teamsfx, databaseName) {
958
963
  return __awaiter(this, void 0, void 0, function* () {
@@ -1008,8 +1013,6 @@ function getTediousConnectionConfig(teamsfx, databaseName) {
1008
1013
  * }
1009
1014
  * ]));
1010
1015
  * ```
1011
- *
1012
- * @beta
1013
1016
  */
1014
1017
  class TeamsBotSsoPrompt {
1015
1018
  /**
@@ -1020,8 +1023,6 @@ class TeamsBotSsoPrompt {
1020
1023
  *
1021
1024
  * @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.
1022
1025
  * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
1023
- *
1024
- * @beta
1025
1026
  */
1026
1027
  constructor(teamsfx, dialogId, settings) {
1027
1028
  this.teamsfx = teamsfx;
@@ -1041,8 +1042,6 @@ class TeamsBotSsoPrompt {
1041
1042
  * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
1042
1043
  *
1043
1044
  * @returns A `Promise` representing the asynchronous operation.
1044
- *
1045
- * @beta
1046
1045
  */
1047
1046
  beginDialog(dc) {
1048
1047
  return __awaiter(this, void 0, void 0, function* () {
@@ -1064,8 +1063,6 @@ class TeamsBotSsoPrompt {
1064
1063
  *
1065
1064
  * @throws {@link ErrorCode|ChannelNotSupported} when bot channel is not MS Teams.
1066
1065
  * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
1067
- *
1068
- * @beta
1069
1066
  */
1070
1067
  continueDialog(dc) {
1071
1068
  return __awaiter(this, void 0, void 0, function* () {
@@ -1086,8 +1083,6 @@ class TeamsBotSsoPrompt {
1086
1083
  * ```typescript
1087
1084
  * const client = createApiClient("https://my-api-endpoint-base-url", new BasicAuthProvider("xxx","xxx"));
1088
1085
  * ```
1089
- *
1090
- * @beta
1091
1086
  */
1092
1087
  function createApiClient(apiEndpoint, authProvider) {
1093
1088
  // Add a request interceptor
@@ -1105,14 +1100,10 @@ function createApiClient(apiEndpoint, authProvider) {
1105
1100
  // Copyright (c) Microsoft Corporation.
1106
1101
  /**
1107
1102
  * Provider that handles Bearer Token authentication
1108
- *
1109
- * @beta
1110
1103
  */
1111
1104
  class BearerTokenAuthProvider {
1112
1105
  /**
1113
1106
  * @param { () => Promise<string> } getToken - Function that returns the content of bearer token used in http request
1114
- *
1115
- * @beta
1116
1107
  */
1117
1108
  constructor(getToken) {
1118
1109
  this.getToken = getToken;
@@ -1126,8 +1117,6 @@ class BearerTokenAuthProvider {
1126
1117
  * @returns Updated axios request config.
1127
1118
  *
1128
1119
  * @throws {@link ErrorCode|AuthorizationInfoAlreadyExists} - when Authorization header already exists in request configuration.
1129
- *
1130
- * @beta
1131
1120
  */
1132
1121
  AddAuthenticationInfo(config) {
1133
1122
  return __awaiter(this, void 0, void 0, function* () {
@@ -1147,8 +1136,6 @@ class BearerTokenAuthProvider {
1147
1136
  // Copyright (c) Microsoft Corporation.
1148
1137
  /**
1149
1138
  * Provider that handles Basic authentication
1150
- *
1151
- * @beta
1152
1139
  */
1153
1140
  class BasicAuthProvider {
1154
1141
  /**
@@ -1158,8 +1145,6 @@ class BasicAuthProvider {
1158
1145
  *
1159
1146
  * @throws {@link ErrorCode|InvalidParameter} - when username or password is empty.
1160
1147
  * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
1161
- *
1162
- * @beta
1163
1148
  */
1164
1149
  constructor(userName, password) {
1165
1150
  throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "BasicAuthProvider"), ErrorCode.RuntimeNotSupported);
@@ -1174,8 +1159,6 @@ class BasicAuthProvider {
1174
1159
  *
1175
1160
  * @throws {@link ErrorCode|AuthorizationInfoAlreadyExists} - when Authorization header or auth property already exists in request configuration.
1176
1161
  * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
1177
- *
1178
- * @beta
1179
1162
  */
1180
1163
  AddAuthenticationInfo(config) {
1181
1164
  return __awaiter(this, void 0, void 0, function* () {
@@ -1187,8 +1170,6 @@ class BasicAuthProvider {
1187
1170
  // Copyright (c) Microsoft Corporation.
1188
1171
  /**
1189
1172
  * Provider that handles API Key authentication
1190
- *
1191
- * @beta
1192
1173
  */
1193
1174
  class ApiKeyProvider {
1194
1175
  /**
@@ -1199,8 +1180,6 @@ class ApiKeyProvider {
1199
1180
  *
1200
1181
  * @throws {@link ErrorCode|InvalidParameter} - when key name or key value is empty.
1201
1182
  * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
1202
- *
1203
- * @beta
1204
1183
  */
1205
1184
  constructor(keyName, keyValue, keyLocation) {
1206
1185
  throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "ApiKeyProvider"), ErrorCode.RuntimeNotSupported);
@@ -1215,8 +1194,6 @@ class ApiKeyProvider {
1215
1194
  *
1216
1195
  * @throws {@link ErrorCode|AuthorizationInfoAlreadyExists} - when API key already exists in request header or url query parameter.
1217
1196
  * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
1218
- *
1219
- * @beta
1220
1197
  */
1221
1198
  AddAuthenticationInfo(config) {
1222
1199
  return __awaiter(this, void 0, void 0, function* () {
@@ -1226,8 +1203,6 @@ class ApiKeyProvider {
1226
1203
  }
1227
1204
  /**
1228
1205
  * Define available location for API Key location
1229
- *
1230
- * @beta
1231
1206
  */
1232
1207
  var ApiKeyLocation;
1233
1208
  (function (ApiKeyLocation) {
@@ -1244,15 +1219,11 @@ var ApiKeyLocation;
1244
1219
  // Copyright (c) Microsoft Corporation.
1245
1220
  /**
1246
1221
  * Provider that handles Certificate authentication
1247
- *
1248
- * @beta
1249
1222
  */
1250
1223
  class CertificateAuthProvider {
1251
1224
  /**
1252
1225
  *
1253
1226
  * @param { SecureContextOptions } certOption - information about the cert used in http requests
1254
- *
1255
- * @beta
1256
1227
  */
1257
1228
  constructor(certOption) {
1258
1229
  throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "CertificateAuthProvider"), ErrorCode.RuntimeNotSupported);
@@ -1267,8 +1238,6 @@ class CertificateAuthProvider {
1267
1238
  *
1268
1239
  * @throws {@link ErrorCode|InvalidParameter} - when custom httpsAgent in the request has duplicate properties with certOption provided in constructor.
1269
1240
  * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.
1270
- *
1271
- * @beta
1272
1241
  */
1273
1242
  AddAuthenticationInfo(config) {
1274
1243
  return __awaiter(this, void 0, void 0, function* () {
@@ -1312,8 +1281,6 @@ function createPfxCertOption(pfx, options) {
1312
1281
  // Licensed under the MIT license.
1313
1282
  /**
1314
1283
  * Identity type to use in authentication.
1315
- *
1316
- * @beta
1317
1284
  */
1318
1285
  var IdentityType;
1319
1286
  (function (IdentityType) {
@@ -1330,7 +1297,6 @@ var IdentityType;
1330
1297
  // Copyright (c) Microsoft Corporation.
1331
1298
  /**
1332
1299
  * A class providing credential and configuration.
1333
- * @beta
1334
1300
  */
1335
1301
  class TeamsFx {
1336
1302
  constructor(identityType, customConfig) {
@@ -1343,8 +1309,9 @@ class TeamsFx {
1343
1309
  this.configuration = new Map();
1344
1310
  this.loadFromEnv();
1345
1311
  if (customConfig) {
1346
- for (const key of Object.keys(customConfig)) {
1347
- const value = customConfig[key];
1312
+ const myConfig = Object.assign({}, customConfig);
1313
+ for (const key of Object.keys(myConfig)) {
1314
+ const value = myConfig[key];
1348
1315
  if (value) {
1349
1316
  this.configuration.set(key, value);
1350
1317
  }
@@ -1392,14 +1359,14 @@ class TeamsFx {
1392
1359
  }
1393
1360
  return this.teamsUserCredential;
1394
1361
  }
1395
- getUserInfo() {
1362
+ getUserInfo(resources) {
1396
1363
  return __awaiter(this, void 0, void 0, function* () {
1397
- return yield this.getCredential().getUserInfo();
1364
+ return yield this.getCredential().getUserInfo(resources);
1398
1365
  });
1399
1366
  }
1400
- login(scopes) {
1367
+ login(scopes, resources) {
1401
1368
  return __awaiter(this, void 0, void 0, function* () {
1402
- yield this.getCredential().login(scopes);
1369
+ yield this.getCredential().login(scopes, resources);
1403
1370
  });
1404
1371
  }
1405
1372
  setSsoToken(ssoToken) {
@@ -1428,6 +1395,65 @@ class TeamsFx {
1428
1395
  }
1429
1396
  }
1430
1397
 
1398
+ // Copyright (c) Microsoft Corporation.
1399
+ // Licensed under the MIT license.
1400
+ /**
1401
+ * The target type where the notification will be sent to.
1402
+ *
1403
+ * @remarks
1404
+ * - "Channel" means to a team channel. (By default, notification to a team will be sent to its "General" channel.)
1405
+ * - "Group" means to a group chat.
1406
+ * - "Person" means to a personal chat.
1407
+ */
1408
+ var NotificationTargetType;
1409
+ (function (NotificationTargetType) {
1410
+ /**
1411
+ * The notification will be sent to a team channel.
1412
+ * (By default, notification to a team will be sent to its "General" channel.)
1413
+ */
1414
+ NotificationTargetType["Channel"] = "Channel";
1415
+ /**
1416
+ * The notification will be sent to a group chat.
1417
+ */
1418
+ NotificationTargetType["Group"] = "Group";
1419
+ /**
1420
+ * The notification will be sent to a personal chat.
1421
+ */
1422
+ NotificationTargetType["Person"] = "Person";
1423
+ })(NotificationTargetType || (NotificationTargetType = {}));
1424
+ /**
1425
+ * Options used to control how the response card will be sent to users.
1426
+ */
1427
+ var AdaptiveCardResponse;
1428
+ (function (AdaptiveCardResponse) {
1429
+ /**
1430
+ * The response card will be replaced the current one for the interactor who trigger the action.
1431
+ */
1432
+ AdaptiveCardResponse[AdaptiveCardResponse["ReplaceForInteractor"] = 0] = "ReplaceForInteractor";
1433
+ /**
1434
+ * The response card will be replaced the current one for all users in the chat.
1435
+ */
1436
+ AdaptiveCardResponse[AdaptiveCardResponse["ReplaceForAll"] = 1] = "ReplaceForAll";
1437
+ /**
1438
+ * The response card will be sent as a new message for all users in the chat.
1439
+ */
1440
+ AdaptiveCardResponse[AdaptiveCardResponse["NewForAll"] = 2] = "NewForAll";
1441
+ })(AdaptiveCardResponse || (AdaptiveCardResponse = {}));
1442
+ /**
1443
+ * Status code for an `application/vnd.microsoft.error` invoke response.
1444
+ */
1445
+ var InvokeResponseErrorCode;
1446
+ (function (InvokeResponseErrorCode) {
1447
+ /**
1448
+ * Invalid request.
1449
+ */
1450
+ InvokeResponseErrorCode[InvokeResponseErrorCode["BadRequest"] = 400] = "BadRequest";
1451
+ /**
1452
+ * Internal server error.
1453
+ */
1454
+ InvokeResponseErrorCode[InvokeResponseErrorCode["InternalServerError"] = 500] = "InternalServerError";
1455
+ })(InvokeResponseErrorCode || (InvokeResponseErrorCode = {}));
1456
+
1431
1457
  // Copyright (c) Microsoft Corporation.
1432
1458
  /**
1433
1459
  * Provide utilities for bot conversation, including:
@@ -1436,8 +1462,6 @@ class TeamsFx {
1436
1462
  *
1437
1463
  * @remarks
1438
1464
  * Only work on server side.
1439
- *
1440
- * @beta
1441
1465
  */
1442
1466
  class ConversationBot {
1443
1467
  /**
@@ -1447,8 +1471,6 @@ class ConversationBot {
1447
1471
  *
1448
1472
  * @remarks
1449
1473
  * Only work on server side.
1450
- *
1451
- * @beta
1452
1474
  */
1453
1475
  constructor(options) {
1454
1476
  throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "ConversationBot"), ErrorCode.RuntimeNotSupported);
@@ -1462,8 +1484,6 @@ class ConversationBot {
1462
1484
  *
1463
1485
  * @remarks
1464
1486
  * Only work on server side.
1465
- *
1466
- * @beta
1467
1487
  */
1468
1488
  requestHandler(req, res, logic) {
1469
1489
  return __awaiter(this, void 0, void 0, function* () {
@@ -1472,6 +1492,51 @@ class ConversationBot {
1472
1492
  }
1473
1493
  }
1474
1494
 
1495
+ // Copyright (c) Microsoft Corporation.
1496
+ /*
1497
+ * Sso execution dialog, use to handle sso command
1498
+ */
1499
+ class BotSsoExecutionDialog {
1500
+ /**
1501
+ * Creates a new instance of the BotSsoExecutionDialog.
1502
+ * @param dedupStorage Helper storage to remove duplicated messages
1503
+ * @param requiredScopes The list of scopes for which the token will have access
1504
+ * @param teamsfx {@link TeamsFx} instance for authentication
1505
+ */
1506
+ constructor(dedupStorage, requiredScopes, teamsfx) {
1507
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "BotSsoExecutionDialog"), ErrorCode.RuntimeNotSupported);
1508
+ }
1509
+ /**
1510
+ * Add TeamsFxBotSsoCommandHandler instance
1511
+ * @param handler {@link BotSsoExecutionDialogHandler} callback function
1512
+ * @param triggerPatterns The trigger pattern
1513
+ */
1514
+ addCommand(handler, triggerPatterns) {
1515
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "BotSsoExecutionDialog"), ErrorCode.RuntimeNotSupported);
1516
+ }
1517
+ /**
1518
+ * The run method handles the incoming activity (in the form of a DialogContext) and passes it through the dialog system.
1519
+ *
1520
+ * @param context The context object for the current turn.
1521
+ * @param accessor The instance of StatePropertyAccessor for dialog system.
1522
+ */
1523
+ run(context, accessor) {
1524
+ return __awaiter(this, void 0, void 0, function* () {
1525
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "BotSsoExecutionDialog"), ErrorCode.RuntimeNotSupported);
1526
+ });
1527
+ }
1528
+ /**
1529
+ * Called when the component is ending.
1530
+ *
1531
+ * @param context Context for the current turn of conversation.
1532
+ */
1533
+ onEndDialog(context) {
1534
+ return __awaiter(this, void 0, void 0, function* () {
1535
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "BotSsoExecutionDialog"), ErrorCode.RuntimeNotSupported);
1536
+ });
1537
+ }
1538
+ }
1539
+
1475
1540
  // Copyright (c) Microsoft Corporation.
1476
1541
  /**
1477
1542
  * Send a plain text message to a notification target.
@@ -1481,11 +1546,10 @@ class ConversationBot {
1481
1546
  *
1482
1547
  * @param target - the notification target.
1483
1548
  * @param text - the plain text message.
1549
+ * @param onError - an optional error handler that can catch exceptions during message sending.
1484
1550
  * @returns A `Promise` representing the asynchronous operation.
1485
- *
1486
- * @beta
1487
1551
  */
1488
- function sendMessage(target, text) {
1552
+ function sendMessage(target, text, onError) {
1489
1553
  throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "sendMessage"), ErrorCode.RuntimeNotSupported);
1490
1554
  }
1491
1555
  /**
@@ -1496,11 +1560,10 @@ function sendMessage(target, text) {
1496
1560
  *
1497
1561
  * @param target - the notification target.
1498
1562
  * @param card - the adaptive card raw JSON.
1563
+ * @param onError - an optional error handler that can catch exceptions during adaptive card sending.
1499
1564
  * @returns A `Promise` representing the asynchronous operation.
1500
- *
1501
- * @beta
1502
1565
  */
1503
- function sendAdaptiveCard(target, card) {
1566
+ function sendAdaptiveCard(target, card, onError) {
1504
1567
  throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "sendAdaptiveCard"), ErrorCode.RuntimeNotSupported);
1505
1568
  }
1506
1569
  /**
@@ -1510,8 +1573,6 @@ function sendAdaptiveCard(target, card) {
1510
1573
  * Only work on server side.
1511
1574
  *
1512
1575
  * It's recommended to get channels from {@link TeamsBotInstallation.channels()}.
1513
- *
1514
- * @beta
1515
1576
  */
1516
1577
  class Channel {
1517
1578
  /**
@@ -1524,8 +1585,6 @@ class Channel {
1524
1585
  *
1525
1586
  * @param parent - The parent {@link TeamsBotInstallation} where this channel is created from.
1526
1587
  * @param info - Detailed channel information.
1527
- *
1528
- * @beta
1529
1588
  */
1530
1589
  constructor(parent, info) {
1531
1590
  /**
@@ -1533,10 +1592,8 @@ class Channel {
1533
1592
  *
1534
1593
  * @remarks
1535
1594
  * Only work on server side.
1536
- *
1537
- * @beta
1538
1595
  */
1539
- this.type = "Channel";
1596
+ this.type = NotificationTargetType.Channel;
1540
1597
  throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "Channel"), ErrorCode.RuntimeNotSupported);
1541
1598
  }
1542
1599
  /**
@@ -1546,11 +1603,10 @@ class Channel {
1546
1603
  * Only work on server side.
1547
1604
  *
1548
1605
  * @param text - the plain text message.
1549
- * @returns A `Promise` representing the asynchronous operation.
1550
- *
1551
- * @beta
1606
+ * @param onError - an optional error handler that can catch exceptions during message sending.
1607
+ * @returns the response of sending message.
1552
1608
  */
1553
- sendMessage(text) {
1609
+ sendMessage(text, onError) {
1554
1610
  throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "Channel"), ErrorCode.RuntimeNotSupported);
1555
1611
  }
1556
1612
  /**
@@ -1560,11 +1616,10 @@ class Channel {
1560
1616
  * Only work on server side.
1561
1617
  *
1562
1618
  * @param card - the adaptive card raw JSON.
1563
- * @returns A `Promise` representing the asynchronous operation.
1564
- *
1565
- * @beta
1619
+ * @param onError - an optional error handler that can catch exceptions during adaptive card sending.
1620
+ * @returns the response of sending adaptive card message.
1566
1621
  */
1567
- sendAdaptiveCard(card) {
1622
+ sendAdaptiveCard(card, onError) {
1568
1623
  return __awaiter(this, void 0, void 0, function* () {
1569
1624
  throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "Channel"), ErrorCode.RuntimeNotSupported);
1570
1625
  });
@@ -1577,8 +1632,6 @@ class Channel {
1577
1632
  * Only work on server side.
1578
1633
  *
1579
1634
  * It's recommended to get members from {@link TeamsBotInstallation.members()}.
1580
- *
1581
- * @beta
1582
1635
  */
1583
1636
  class Member {
1584
1637
  /**
@@ -1591,8 +1644,6 @@ class Member {
1591
1644
  *
1592
1645
  * @param parent - The parent {@link TeamsBotInstallation} where this member is created from.
1593
1646
  * @param account - Detailed member account information.
1594
- *
1595
- * @beta
1596
1647
  */
1597
1648
  constructor(parent, account) {
1598
1649
  /**
@@ -1600,10 +1651,8 @@ class Member {
1600
1651
  *
1601
1652
  * @remarks
1602
1653
  * Only work on server side.
1603
- *
1604
- * @beta
1605
1654
  */
1606
- this.type = "Person";
1655
+ this.type = NotificationTargetType.Person;
1607
1656
  throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "Member"), ErrorCode.RuntimeNotSupported);
1608
1657
  }
1609
1658
  /**
@@ -1613,11 +1662,10 @@ class Member {
1613
1662
  * Only work on server side.
1614
1663
  *
1615
1664
  * @param text - the plain text message.
1616
- * @returns A `Promise` representing the asynchronous operation.
1617
- *
1618
- * @beta
1665
+ * @param onError - an optional error handler that can catch exceptions during message sending.
1666
+ * @returns the response of sending message.
1619
1667
  */
1620
- sendMessage(text) {
1668
+ sendMessage(text, onError) {
1621
1669
  throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "Member"), ErrorCode.RuntimeNotSupported);
1622
1670
  }
1623
1671
  /**
@@ -1627,11 +1675,10 @@ class Member {
1627
1675
  * Only work on server side.
1628
1676
  *
1629
1677
  * @param card - the adaptive card raw JSON.
1630
- * @returns A `Promise` representing the asynchronous operation.
1631
- *
1632
- * @beta
1678
+ * @param onError - an optional error handler that can catch exceptions during adaptive card sending.
1679
+ * @returns the response of sending adaptive card message.
1633
1680
  */
1634
- sendAdaptiveCard(card) {
1681
+ sendAdaptiveCard(card, onError) {
1635
1682
  return __awaiter(this, void 0, void 0, function* () {
1636
1683
  throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "Member"), ErrorCode.RuntimeNotSupported);
1637
1684
  });
@@ -1647,8 +1694,6 @@ class Member {
1647
1694
  * Only work on server side.
1648
1695
  *
1649
1696
  * It's recommended to get bot installations from {@link ConversationBot.installations()}.
1650
- *
1651
- * @beta
1652
1697
  */
1653
1698
  class TeamsBotInstallation {
1654
1699
  /**
@@ -1661,8 +1706,6 @@ class TeamsBotInstallation {
1661
1706
  *
1662
1707
  * @param adapter - the bound `BotFrameworkAdapter`.
1663
1708
  * @param conversationReference - the bound `ConversationReference`.
1664
- *
1665
- * @beta
1666
1709
  */
1667
1710
  constructor(adapter, conversationReference) {
1668
1711
  throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotInstallation"), ErrorCode.RuntimeNotSupported);
@@ -1674,11 +1717,10 @@ class TeamsBotInstallation {
1674
1717
  * Only work on server side.
1675
1718
  *
1676
1719
  * @param text - the plain text message.
1677
- * @returns A `Promise` representing the asynchronous operation.
1678
- *
1679
- * @beta
1720
+ * @param onError - an optional error handler that can catch exceptions during message sending.
1721
+ * @returns the response of sending message.
1680
1722
  */
1681
- sendMessage(text) {
1723
+ sendMessage(text, onError) {
1682
1724
  throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotInstallation"), ErrorCode.RuntimeNotSupported);
1683
1725
  }
1684
1726
  /**
@@ -1688,11 +1730,10 @@ class TeamsBotInstallation {
1688
1730
  * Only work on server side.
1689
1731
  *
1690
1732
  * @param card - the adaptive card raw JSON.
1691
- * @returns A `Promise` representing the asynchronous operation.
1692
- *
1693
- * @beta
1733
+ * @param onError - an optional error handler that can catch exceptions during adaptive card sending.
1734
+ * @returns the response of sending adaptive card message.
1694
1735
  */
1695
- sendAdaptiveCard(card) {
1736
+ sendAdaptiveCard(card, onError) {
1696
1737
  throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotInstallation"), ErrorCode.RuntimeNotSupported);
1697
1738
  }
1698
1739
  /**
@@ -1702,8 +1743,6 @@ class TeamsBotInstallation {
1702
1743
  * Only work on server side.
1703
1744
  *
1704
1745
  * @returns an array of channels if bot is installed into a team, otherwise returns an empty array.
1705
- *
1706
- * @beta
1707
1746
  */
1708
1747
  channels() {
1709
1748
  return __awaiter(this, void 0, void 0, function* () {
@@ -1717,14 +1756,22 @@ class TeamsBotInstallation {
1717
1756
  * Only work on server side.
1718
1757
  *
1719
1758
  * @returns an array of members from where the bot is installed.
1720
- *
1721
- * @beta
1722
1759
  */
1723
1760
  members() {
1724
1761
  return __awaiter(this, void 0, void 0, function* () {
1725
1762
  throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotInstallation"), ErrorCode.RuntimeNotSupported);
1726
1763
  });
1727
1764
  }
1765
+ /**
1766
+ * Get team details from this bot installation
1767
+ *
1768
+ * @returns the team details if bot is installed into a team, otherwise returns undefined.
1769
+ */
1770
+ getTeamDetails() {
1771
+ return __awaiter(this, void 0, void 0, function* () {
1772
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "TeamsBotInstallation"), ErrorCode.RuntimeNotSupported);
1773
+ });
1774
+ }
1728
1775
  }
1729
1776
  /**
1730
1777
  * Provide static utilities for bot notification.
@@ -1750,8 +1797,6 @@ class TeamsBotInstallation {
1750
1797
  * }
1751
1798
  * }
1752
1799
  * ```
1753
- *
1754
- * @beta
1755
1800
  */
1756
1801
  class NotificationBot {
1757
1802
  /**
@@ -1764,8 +1809,6 @@ class NotificationBot {
1764
1809
  *
1765
1810
  * @param adapter - the bound `BotFrameworkAdapter`
1766
1811
  * @param options - initialize options
1767
- *
1768
- * @beta
1769
1812
  */
1770
1813
  constructor(adapter, options) {
1771
1814
  throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported);
@@ -1779,15 +1822,101 @@ class NotificationBot {
1779
1822
  * The result is retrieving from the persisted storage.
1780
1823
  *
1781
1824
  * @returns - an array of {@link TeamsBotInstallation}.
1782
- *
1783
- * @beta
1784
1825
  */
1785
1826
  static installations() {
1786
1827
  return __awaiter(this, void 0, void 0, function* () {
1787
1828
  throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported);
1788
1829
  });
1789
1830
  }
1790
- }
1831
+ /**
1832
+ * Returns the first {@link Member} where predicate is true, and undefined otherwise.
1833
+ *
1834
+ * @remarks
1835
+ * Only work on server side.
1836
+ *
1837
+ * @param predicate find calls predicate once for each member of the installation,
1838
+ * until it finds one where predicate returns true. If such a member is found, find
1839
+ * immediately returns that member. Otherwise, find returns undefined.
1840
+ * @param scope the scope to find members from the installations
1841
+ * (personal chat, group chat, Teams channel).
1842
+ * @returns the first {@link Member} where predicate is true, and undefined otherwise.
1843
+ */
1844
+ findMember(predicate, scope) {
1845
+ return __awaiter(this, void 0, void 0, function* () {
1846
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported);
1847
+ });
1848
+ }
1849
+ /**
1850
+ * Returns the first {@link Channel} where predicate is true, and undefined otherwise.
1851
+ *
1852
+ * @remarks
1853
+ * Only work on server side.
1854
+ *
1855
+ * @param predicate find calls predicate once for each channel of the installation,
1856
+ * until it finds one where predicate returns true. If such a channel is found, find
1857
+ * immediately returns that channel. Otherwise, find returns undefined.
1858
+ * @returns the first {@link Channel} where predicate is true, and undefined otherwise.
1859
+ */
1860
+ findChannel(predicate) {
1861
+ return __awaiter(this, void 0, void 0, function* () {
1862
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported);
1863
+ });
1864
+ }
1865
+ /**
1866
+ * Returns all {@link Member} where predicate is true, and empty array otherwise.
1867
+ *
1868
+ * @remarks
1869
+ * Only work on server side.
1870
+ *
1871
+ * @param predicate find calls predicate for each member of the installation.
1872
+ * @param scope the scope to find members from the installations
1873
+ * (personal chat, group chat, Teams channel).
1874
+ * @returns an array of {@link Member} where predicate is true, and empty array otherwise.
1875
+ */
1876
+ findAllMembers(predicate, scope) {
1877
+ return __awaiter(this, void 0, void 0, function* () {
1878
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported);
1879
+ });
1880
+ }
1881
+ /**
1882
+ * Returns all {@link Channel} where predicate is true, and empty array otherwise.
1883
+ *
1884
+ * @remarks
1885
+ * Only work on server side.
1886
+ *
1887
+ * @param predicate find calls predicate for each channel of the installation.
1888
+ * @returns an array of {@link Channel} where predicate is true, and empty array otherwise.
1889
+ */
1890
+ findAllChannels(predicate) {
1891
+ return __awaiter(this, void 0, void 0, function* () {
1892
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "NotificationBot"), ErrorCode.RuntimeNotSupported);
1893
+ });
1894
+ }
1895
+ }
1896
+ /**
1897
+ * The search scope when calling {@link NotificationBot.findMember} and {@link NotificationBot.findAllMembers}.
1898
+ * The search scope is a flagged enum and it can be combined with `|`.
1899
+ * For example, to search from personal chat and group chat, use `SearchScope.Person | SearchScope.Group`.
1900
+ */
1901
+ var SearchScope;
1902
+ (function (SearchScope) {
1903
+ /**
1904
+ * Search members from the installations in personal chat only.
1905
+ */
1906
+ SearchScope[SearchScope["Person"] = 1] = "Person";
1907
+ /**
1908
+ * Search members from the installations in group chat only.
1909
+ */
1910
+ SearchScope[SearchScope["Group"] = 2] = "Group";
1911
+ /**
1912
+ * Search members from the installations in Teams channel only.
1913
+ */
1914
+ SearchScope[SearchScope["Channel"] = 4] = "Channel";
1915
+ /**
1916
+ * Search members from all installations including personal chat, group chat and Teams channel.
1917
+ */
1918
+ SearchScope[SearchScope["All"] = 7] = "All";
1919
+ })(SearchScope || (SearchScope = {}));
1791
1920
 
1792
1921
  // Copyright (c) Microsoft Corporation.
1793
1922
  /**
@@ -1795,8 +1924,6 @@ class NotificationBot {
1795
1924
  *
1796
1925
  * @remarks
1797
1926
  * Only work on server side.
1798
- *
1799
- * @beta
1800
1927
  */
1801
1928
  class CommandBot {
1802
1929
  /**
@@ -1804,8 +1931,6 @@ class CommandBot {
1804
1931
  *
1805
1932
  * @param adapter The bound `BotFrameworkAdapter`.
1806
1933
  * @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.
1807
- *
1808
- * @beta
1809
1934
  */
1810
1935
  constructor(adapter, commands) {
1811
1936
  throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "CommandBot"), ErrorCode.RuntimeNotSupported);
@@ -1817,8 +1942,6 @@ class CommandBot {
1817
1942
  *
1818
1943
  * @remarks
1819
1944
  * Only work on server side.
1820
- *
1821
- * @beta
1822
1945
  */
1823
1946
  registerCommand(command) {
1824
1947
  throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "CommandBot"), ErrorCode.RuntimeNotSupported);
@@ -1830,13 +1953,76 @@ class CommandBot {
1830
1953
  *
1831
1954
  * @remarks
1832
1955
  * Only work on server side.
1833
- *
1834
- * @beta
1835
1956
  */
1836
1957
  registerCommands(commands) {
1837
- throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "CommandnBot"), ErrorCode.RuntimeNotSupported);
1958
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "CommandBot"), ErrorCode.RuntimeNotSupported);
1959
+ }
1960
+ /**
1961
+ * Registers a sso command into the command bot.
1962
+ *
1963
+ * @param command The command to register.
1964
+ */
1965
+ registerSsoCommand(ssoCommand) {
1966
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "CommandBot"), ErrorCode.RuntimeNotSupported);
1967
+ }
1968
+ /**
1969
+ * Registers commands into the command bot.
1970
+ *
1971
+ * @param commands The commands to register.
1972
+ */
1973
+ registerSsoCommands(ssoCommands) {
1974
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "CommandBot"), ErrorCode.RuntimeNotSupported);
1975
+ }
1976
+ }
1977
+
1978
+ /**
1979
+ * A card action bot to respond to adaptive card universal actions.
1980
+ *
1981
+ * @remarks
1982
+ * Only work on server side.
1983
+ */
1984
+ class CardActionBot {
1985
+ /**
1986
+ * Creates a new instance of the `CardActionBot`.
1987
+ *
1988
+ * @param adapter The bound `BotFrameworkAdapter`.
1989
+ * @param options - initialize options
1990
+ */
1991
+ constructor(adapter, options) {
1992
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "CardActionBot"), ErrorCode.RuntimeNotSupported);
1838
1993
  }
1994
+ /**
1995
+ * Registers a card action handler to the bot.
1996
+ * @param actionHandler A card action handler to be registered.
1997
+ *
1998
+ * @remarks
1999
+ * Only work on server side.
2000
+ */
2001
+ registerHandler(actionHandler) {
2002
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "CardActionBot"), ErrorCode.RuntimeNotSupported);
2003
+ }
2004
+ /**
2005
+ * Registers card action handlers to the bot.
2006
+ * @param actionHandlers A set of card action handlers to be registered.
2007
+ *
2008
+ * @remarks
2009
+ * Only work on server side.
2010
+ */
2011
+ registerHandlers(actionHandlers) {
2012
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "CardActionBot"), ErrorCode.RuntimeNotSupported);
2013
+ }
2014
+ }
2015
+
2016
+ /**
2017
+ * Users execute query with SSO or Access Token.
2018
+ * @remarks
2019
+ * Only works in in server side.
2020
+ */
2021
+ function handleMessageExtensionQueryWithToken(context, config, scopes, logic) {
2022
+ return __awaiter(this, void 0, void 0, function* () {
2023
+ throw new ErrorWithCode(formatString(ErrorMessage.BrowserRuntimeNotSupported, "queryWithToken in message extension"), ErrorCode.RuntimeNotSupported);
2024
+ });
1839
2025
  }
1840
2026
 
1841
- 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 };
2027
+ 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, createPemCertOption, createPfxCertOption, getLogLevel, getTediousConnectionConfig, handleMessageExtensionQueryWithToken, sendAdaptiveCard, sendMessage, setLogFunction, setLogLevel, setLogger };
1842
2028
  //# sourceMappingURL=index.esm5.js.map