@microsoft/teamsfx 2.3.1 → 2.3.2-alpha.e17ffd4d1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm5.js","sources":["../src/core/errors.ts","../src/util/logger.ts","../src/util/utils.ts","../src/credential/appCredential.browser.ts","../src/credential/onBehalfOfUserCredential.browser.ts","../src/credential/teamsUserCredential.browser.ts","../src/core/msGraphAuthProvider.ts","../src/core/msGraphClientProvider.ts","../src/core/defaultTediousConnectionConfiguration.browser.ts","../src/bot/teamsBotSsoPrompt.browser.ts","../src/apiClient/apiClient.ts","../src/apiClient/bearerTokenAuthProvider.ts","../src/apiClient/basicAuthProvider.browser.ts","../src/apiClient/apiKeyProvider.browser.ts","../src/apiClient/certificateAuthProvider.browser.ts","../src/models/identityType.ts","../src/core/teamsfx.browser.ts","../src/conversation/interface.ts","../src/conversation/conversation.browser.ts","../src/conversation/sso/botSsoExecutionDialog.browser.ts","../src/conversation/notification.browser.ts","../src/conversation/command.browser.ts","../src/conversation/cardAction.browser.ts","../src/messageExtension/executeWithSSO.browser.ts","../src/conversationWithCloudAdapter/conversation.browser.ts","../src/conversationWithCloudAdapter/notification.browser.ts","../src/conversationWithCloudAdapter/command.browser.ts","../src/conversationWithCloudAdapter/cardAction.browser.ts"],"sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * Error code to trace the error types.\n */\nexport enum ErrorCode {\n /**\n * Invalid parameter error.\n */\n InvalidParameter = \"InvalidParameter\",\n\n /**\n * Invalid configuration error.\n */\n InvalidConfiguration = \"InvalidConfiguration\",\n\n /**\n * Invalid certificate error.\n */\n InvalidCertificate = \"InvalidCertificate\",\n\n /**\n * Internal error.\n */\n InternalError = \"InternalError\",\n\n /**\n * Channel is not supported error.\n */\n ChannelNotSupported = \"ChannelNotSupported\",\n\n /**\n * Failed to retrieve sso token\n */\n FailedToRetrieveSsoToken = \"FailedToRetrieveSsoToken\",\n\n /**\n * Failed to process sso handler\n */\n FailedToProcessSsoHandler = \"FailedToProcessSsoHandler\",\n\n /**\n * Cannot find command\n */\n CannotFindCommand = \"CannotFindCommand\",\n\n /**\n * Failed to run sso step\n */\n FailedToRunSsoStep = \"FailedToRunSsoStep\",\n\n /**\n * Failed to run dedup step\n */\n FailedToRunDedupStep = \"FailedToRunDedupStep\",\n\n /**\n * Sso activity handler is undefined\n */\n SsoActivityHandlerIsUndefined = \"SsoActivityHandlerIsUndefined\",\n\n /**\n * Runtime is not supported error.\n */\n RuntimeNotSupported = \"RuntimeNotSupported\",\n\n /**\n * User failed to finish the AAD consent flow failed.\n */\n ConsentFailed = \"ConsentFailed\",\n\n /**\n * The user or administrator has not consented to use the application error.\n */\n UiRequiredError = \"UiRequiredError\",\n\n /**\n * Token is not within its valid time range error.\n */\n TokenExpiredError = \"TokenExpiredError\",\n\n /**\n * Call service (AAD or simple authentication server) failed.\n */\n ServiceError = \"ServiceError\",\n\n /**\n * Operation failed.\n */\n FailedOperation = \"FailedOperation\",\n\n /**\n * Invalid response error.\n */\n InvalidResponse = \"InvalidResponse\",\n\n /**\n * Identity type error.\n */\n IdentityTypeNotSupported = \"IdentityTypeNotSupported\",\n\n /**\n * Authentication info already exists error.\n */\n AuthorizationInfoAlreadyExists = \"AuthorizationInfoAlreadyExists\",\n}\n\n/**\n * @internal\n */\nexport class ErrorMessage {\n // InvalidConfiguration Error\n static readonly InvalidConfiguration = \"{0} in configuration is invalid: {1}.\";\n static readonly ConfigurationNotExists = \"Configuration does not exist. {0}\";\n static readonly ResourceConfigurationNotExists = \"{0} resource configuration does not exist.\";\n static readonly MissingResourceConfiguration =\n \"Missing resource configuration with type: {0}, name: {1}.\";\n static readonly AuthenticationConfigurationNotExists =\n \"Authentication configuration does not exist.\";\n\n // RuntimeNotSupported Error\n static readonly BrowserRuntimeNotSupported = \"{0} is not supported in browser.\";\n static readonly NodejsRuntimeNotSupported = \"{0} is not supported in Node.\";\n\n // Internal Error\n static readonly FailToAcquireTokenOnBehalfOfUser =\n \"Failed to acquire access token on behalf of user: {0}\";\n\n // ChannelNotSupported Error\n static readonly OnlyMSTeamsChannelSupported = \"{0} is only supported in MS Teams Channel\";\n\n static readonly FailedToProcessSsoHandler = \"Failed to process sso handler: {0}\";\n\n // FailedToRetrieveSsoToken Error\n static readonly FailedToRetrieveSsoToken =\n \"Failed to retrieve sso token, user failed to finish the AAD consent flow.\";\n\n // CannotFindCommand Error\n static readonly CannotFindCommand = \"Cannot find command: {0}\";\n\n static readonly FailedToRunSsoStep = \"Failed to run dialog to retrieve sso token: {0}\";\n\n static readonly FailedToRunDedupStep = \"Failed to run dialog to remove duplicated messages: {0}\";\n\n // SsoActivityHandlerIsUndefined Error\n static readonly SsoActivityHandlerIsNull =\n \"Sso command can only be used or added when sso activity handler is not undefined\";\n\n // IdentityTypeNotSupported Error\n static readonly IdentityTypeNotSupported = \"{0} identity is not supported in {1}\";\n\n // AuthorizationInfoError\n static readonly AuthorizationHeaderAlreadyExists = \"Authorization header already exists!\";\n static readonly BasicCredentialAlreadyExists = \"Basic credential already exists!\";\n // InvalidParameter Error\n static readonly EmptyParameter = \"Parameter {0} is empty\";\n static readonly DuplicateHttpsOptionProperty =\n \"Axios HTTPS agent already defined value for property {0}\";\n static readonly DuplicateApiKeyInHeader =\n \"The request already defined api key in request header with name {0}.\";\n static readonly DuplicateApiKeyInQueryParam =\n \"The request already defined api key in query parameter with name {0}.\";\n static readonly OnlySupportInQueryActivity =\n \"The handleMessageExtensionQueryWithToken only support in handleTeamsMessagingExtensionQuery with composeExtension/query type.\";\n static readonly OnlySupportInLinkQueryActivity =\n \"The handleMessageExtensionLinkQueryWithSSO only support in handleTeamsAppBasedLinkQuery with composeExtension/queryLink type.\";\n}\n\n/**\n * Error class with code and message thrown by the SDK.\n */\nexport class ErrorWithCode extends Error {\n /**\n * Error code\n *\n * @readonly\n */\n code: string | undefined;\n\n /**\n * Constructor of ErrorWithCode.\n *\n * @param {string} message - error message.\n * @param {ErrorCode} code - error code.\n */\n constructor(message?: string, code?: ErrorCode) {\n if (!code) {\n super(message);\n return this;\n }\n\n super(message);\n Object.setPrototypeOf(this, ErrorWithCode.prototype);\n this.name = `${new.target.name}.${code}`;\n this.code = code;\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * Interface for customized logger.\n */\nexport interface Logger {\n /**\n * Writes to error level logging or lower.\n */\n error(message: string): void;\n /**\n * Writes to warning level logging or lower.\n */\n warn(message: string): void;\n /**\n * Writes to info level logging or lower.\n */\n info(message: string): void;\n /**\n * Writes to verbose level logging.\n */\n verbose(message: string): void;\n}\n\n/**\n * Log function for customized logging.\n */\nexport type LogFunction = (level: LogLevel, message: string) => void;\n\n/**\n * Log level.\n */\nexport enum LogLevel {\n /**\n * Show verbose, information, warning and error message.\n */\n Verbose,\n /**\n * Show information, warning and error message.\n */\n Info,\n /**\n * Show warning and error message.\n */\n Warn,\n /**\n * Show error message.\n */\n Error,\n}\n\n/**\n * Update log level helper.\n *\n * @param { LogLevel } level - log level in configuration\n */\nexport function setLogLevel(level: LogLevel): void {\n internalLogger.level = level;\n}\n\n/**\n * Get log level.\n *\n * @returns Log level\n */\nexport function getLogLevel(): LogLevel | undefined {\n return internalLogger.level;\n}\n\nexport class InternalLogger implements Logger {\n public name?: string;\n public level?: LogLevel = undefined;\n public customLogger: Logger | undefined;\n public customLogFunction: LogFunction | undefined;\n\n private defaultLogger: Logger = {\n verbose: console.debug,\n info: console.info,\n warn: console.warn,\n error: console.error,\n };\n\n constructor(name?: string, logLevel?: LogLevel) {\n this.name = name;\n this.level = logLevel;\n }\n\n public error(message: string): void {\n this.log(LogLevel.Error, (x: Logger) => x.error, message);\n }\n\n public warn(message: string): void {\n this.log(LogLevel.Warn, (x: Logger) => x.warn, message);\n }\n\n public info(message: string): void {\n this.log(LogLevel.Info, (x: Logger) => x.info, message);\n }\n\n public verbose(message: string): void {\n this.log(LogLevel.Verbose, (x: Logger) => x.verbose, message);\n }\n\n private log(\n logLevel: LogLevel,\n logFunction: (x: Logger) => (message: string) => void,\n message: string\n ): void {\n if (message.trim() === \"\") {\n return;\n }\n const timestamp = new Date().toUTCString();\n let logHeader: string;\n if (this.name) {\n logHeader = `[${timestamp}] : @microsoft/teamsfx - ${this.name} : ${LogLevel[logLevel]} - `;\n } else {\n logHeader = `[${timestamp}] : @microsoft/teamsfx : ${LogLevel[logLevel]} - `;\n }\n const logMessage = `${logHeader}${message}`;\n if (this.level !== undefined && this.level <= logLevel) {\n if (this.customLogger) {\n logFunction(this.customLogger)(logMessage);\n } else if (this.customLogFunction) {\n this.customLogFunction(logLevel, logMessage);\n } else {\n logFunction(this.defaultLogger)(logMessage);\n }\n }\n }\n}\n\n/**\n * Logger instance used internally\n *\n * @internal\n */\nexport const internalLogger: InternalLogger = new InternalLogger();\n\n/**\n * Set custom logger. Use the output functions if it's set. Priority is higher than setLogFunction.\n *\n * @param {Logger} logger - custom logger. If it's undefined, custom logger will be cleared.\n *\n * @example\n * ```typescript\n * setLogger({\n * verbose: console.debug,\n * info: console.info,\n * warn: console.warn,\n * error: console.error,\n * });\n * ```\n */\nexport function setLogger(logger?: Logger): void {\n internalLogger.customLogger = logger;\n}\n\n/**\n * Set custom log function. Use the function if it's set. Priority is lower than setLogger.\n *\n * @param {LogFunction} logFunction - custom log function. If it's undefined, custom log function will be cleared.\n *\n * @example\n * ```typescript\n * setLogFunction((level: LogLevel, message: string) => {\n * if (level === LogLevel.Error) {\n * console.log(message);\n * }\n * });\n * ```\n */\nexport function setLogFunction(logFunction?: LogFunction): void {\n internalLogger.customLogFunction = logFunction;\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\nimport { ErrorWithCode, ErrorCode } from \"../core/errors\";\nimport { SSOTokenInfoBase, SSOTokenV1Info, SSOTokenV2Info } from \"../models/ssoTokenInfo\";\nimport { UserInfo, UserTenantIdAndLoginHint } from \"../models/userinfo\";\nimport jwt_decode from \"jwt-decode\";\nimport { internalLogger } from \"./logger\";\nimport { AccessToken } from \"@azure/identity\";\nimport { AuthenticationResult } from \"@azure/msal-browser\";\n\n/**\n * Parse jwt token payload\n *\n * @param token\n *\n * @returns Payload object\n *\n * @internal\n */\nexport function parseJwt(token: string): SSOTokenInfoBase {\n try {\n const tokenObj: SSOTokenInfoBase = jwt_decode(token);\n if (!tokenObj || !tokenObj.exp) {\n throw new ErrorWithCode(\n \"Decoded token is null or exp claim does not exists.\",\n ErrorCode.InternalError\n );\n }\n\n return tokenObj;\n } catch (err: any) {\n const errorMsg = \"Parse jwt token failed in node env with error: \" + (err.message as string);\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.InternalError);\n }\n}\n\n/**\n * @internal\n */\nexport function getUserInfoFromSsoToken(ssoToken: string): UserInfo {\n if (!ssoToken) {\n const errorMsg = \"SSO token is undefined.\";\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.InvalidParameter);\n }\n const tokenObject = parseJwt(ssoToken) as SSOTokenV1Info | SSOTokenV2Info;\n\n const userInfo: UserInfo = {\n displayName: tokenObject.name,\n objectId: tokenObject.oid,\n tenantId: tokenObject.tid,\n preferredUserName: \"\",\n };\n\n if (tokenObject.ver === \"2.0\") {\n userInfo.preferredUserName = (tokenObject as SSOTokenV2Info).preferred_username;\n } else if (tokenObject.ver === \"1.0\") {\n userInfo.preferredUserName = (tokenObject as SSOTokenV1Info).upn;\n }\n return userInfo;\n}\n\n/**\n * @internal\n */\nexport function getTenantIdAndLoginHintFromSsoToken(ssoToken: string): UserTenantIdAndLoginHint {\n if (!ssoToken) {\n const errorMsg = \"SSO token is undefined.\";\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.InvalidParameter);\n }\n const tokenObject = parseJwt(ssoToken) as SSOTokenV1Info | SSOTokenV2Info;\n\n const userInfo: UserTenantIdAndLoginHint = {\n tid: tokenObject.tid,\n loginHint:\n tokenObject.ver === \"2.0\"\n ? (tokenObject as SSOTokenV2Info).preferred_username\n : (tokenObject as SSOTokenV1Info).upn,\n };\n\n return userInfo;\n}\n\n/**\n * @internal\n */\nexport function parseAccessTokenFromAuthCodeTokenResponse(\n tokenResponse: string | AuthenticationResult\n): AccessToken {\n try {\n const tokenResponseObject =\n typeof tokenResponse == \"string\"\n ? (JSON.parse(tokenResponse) as AuthenticationResult)\n : tokenResponse;\n if (!tokenResponseObject || !tokenResponseObject.accessToken) {\n const errorMsg = \"Get empty access token from Auth Code token response.\";\n\n internalLogger.error(errorMsg);\n throw new Error(errorMsg);\n }\n\n const token = tokenResponseObject.accessToken;\n const tokenObject = parseJwt(token);\n\n if (tokenObject.ver !== \"1.0\" && tokenObject.ver !== \"2.0\") {\n const errorMsg = \"SSO token is not valid with an unknown version: \" + tokenObject.ver;\n internalLogger.error(errorMsg);\n throw new Error(errorMsg);\n }\n\n const accessToken: AccessToken = {\n token: token,\n expiresOnTimestamp: tokenObject.exp * 1000,\n };\n return accessToken;\n } catch (error: any) {\n const errorMsg =\n \"Parse access token failed from Auth Code token response in node env with error: \" +\n (error.message as string);\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.InternalError);\n }\n}\n\n/**\n * Format string template with replacements\n *\n * ```typescript\n * const template = \"{0} and {1} are fruit. {0} is my favorite one.\"\n * const formattedStr = formatString(template, \"apple\", \"pear\"); // formattedStr: \"apple and pear are fruit. apple is my favorite one.\"\n * ```\n *\n * @param str string template\n * @param replacements replacement string array\n * @returns Formatted string\n *\n * @internal\n */\nexport function formatString(str: string, ...replacements: string[]): string {\n const args = replacements;\n return str.replace(/{(\\d+)}/g, function (match, number) {\n return typeof args[number] != \"undefined\" ? args[number] : match;\n });\n}\n\n/**\n * @internal\n */\nexport function validateScopesType(value: any): void {\n // string\n if (typeof value === \"string\" || value instanceof String) {\n return;\n }\n\n // empty array\n if (Array.isArray(value) && value.length === 0) {\n return;\n }\n\n // string array\n if (Array.isArray(value) && value.length > 0 && value.every((item) => typeof item === \"string\")) {\n return;\n }\n\n const errorMsg = \"The type of scopes is not valid, it must be string or string array\";\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.InvalidParameter);\n}\n\n/**\n * @internal\n */\nexport function getScopesArray(scopes: string | string[]): string[] {\n const scopesArray: string[] = typeof scopes === \"string\" ? scopes.split(\" \") : scopes;\n return scopesArray.filter((x) => x !== null && x !== \"\");\n}\n\n/**\n * @internal\n */\nexport function getAuthority(authorityHost: string, tenantId: string): string {\n const normalizedAuthorityHost = authorityHost.replace(/\\/+$/g, \"\");\n return normalizedAuthorityHost + \"/\" + tenantId;\n}\n\n/**\n * @internal\n */\nexport interface ClientCertificate {\n thumbprint: string;\n privateKey: string;\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AccessToken, TokenCredential, GetTokenOptions } from \"@azure/identity\";\nimport { AppCredentialAuthConfig, AuthenticationConfiguration } from \"../models/configuration\";\nimport { formatString } from \"../util/utils\";\nimport { ErrorCode, ErrorMessage, ErrorWithCode } from \"../core/errors\";\n\n/**\n * Represent Microsoft 365 tenant identity, and it is usually used when user is not involved.\n *\n * @remarks\n * Only works in in server side.\n */\nexport class AppCredential implements TokenCredential {\n /**\n * Constructor of AppCredential.\n *\n * @remarks\n * Only works in in server side.\n */\n constructor(authConfig: AppCredentialAuthConfig);\n constructor(authConfig: AuthenticationConfiguration);\n constructor(authConfig: AppCredentialAuthConfig | AuthenticationConfiguration) {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"AppCredential\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Get access token for credential.\n *\n * @remarks\n * Only works in in server side.\n */\n getToken(scopes: string | string[], options?: GetTokenOptions): Promise<AccessToken | null> {\n return Promise.reject(\n new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"AppCredential\"),\n ErrorCode.RuntimeNotSupported\n )\n );\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AccessToken, GetTokenOptions, TokenCredential } from \"@azure/identity\";\nimport { UserInfo } from \"../models/userinfo\";\nimport {\n AuthenticationConfiguration,\n OnBehalfOfCredentialAuthConfig,\n} from \"../models/configuration\";\nimport { formatString } from \"../util/utils\";\nimport { ErrorWithCode, ErrorCode, ErrorMessage } from \"../core/errors\";\n\n/**\n * Represent on-behalf-of flow to get user identity, and it is designed to be used in Azure Function or Bot scenarios.\n *\n * @remarks\n * Can only be used in server side.\n */\nexport class OnBehalfOfUserCredential implements TokenCredential {\n /**\n * Constructor of OnBehalfOfUserCredential\n *\n * @remarks\n * Can Only works in in server side.\n */\n constructor(ssoToken: string, config: OnBehalfOfCredentialAuthConfig);\n constructor(ssoToken: string, config: AuthenticationConfiguration);\n constructor(\n ssoToken: string,\n config: OnBehalfOfCredentialAuthConfig | AuthenticationConfiguration\n ) {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"OnBehalfOfUserCredential\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Get access token from credential.\n * @remarks\n * Can only be used in server side.\n */\n getToken(scopes: string | string[], options?: GetTokenOptions): Promise<AccessToken | null> {\n return Promise.reject(\n new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"OnBehalfOfUserCredential\"),\n ErrorCode.RuntimeNotSupported\n )\n );\n }\n\n /**\n * Get basic user info from SSO token.\n * @remarks\n * Can only be used in server side.\n */\n public getUserInfo(): Promise<UserInfo> {\n return Promise.reject(\n new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"OnBehalfOfUserCredential\"),\n ErrorCode.RuntimeNotSupported\n )\n );\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AccessToken, TokenCredential, GetTokenOptions } from \"@azure/identity\";\nimport { GetTeamsUserTokenOptions } from \"../models/teamsUserTokenOptions\";\nimport { UserInfo } from \"../models/userinfo\";\nimport { ErrorCode, ErrorMessage, ErrorWithCode } from \"../core/errors\";\nimport { app, authentication } from \"@microsoft/teams-js\";\nimport {\n AuthenticationConfiguration,\n TeamsUserCredentialAuthConfig,\n} from \"../models/configuration\";\nimport {\n validateScopesType,\n getUserInfoFromSsoToken,\n parseJwt,\n formatString,\n getTenantIdAndLoginHintFromSsoToken,\n parseAccessTokenFromAuthCodeTokenResponse,\n} from \"../util/utils\";\nimport { internalLogger } from \"../util/logger\";\nimport { PublicClientApplication } from \"@azure/msal-browser\";\n\nconst tokenRefreshTimeSpanInMillisecond = 5 * 60 * 1000;\nconst loginPageWidth = 600;\nconst loginPageHeight = 535;\n\n/**\n * Represent Teams current user's identity, and it is used within Teams tab application.\n *\n * @remarks\n * Can only be used within Teams.\n */\nexport class TeamsUserCredential implements TokenCredential {\n private readonly config: AuthenticationConfiguration;\n private ssoToken: AccessToken | null;\n private initialized: boolean;\n private msalInstance?: PublicClientApplication;\n private tid?: string;\n private loginHint?: string;\n\n // eslint-disable-next-line no-secrets/no-secrets\n /**\n * Constructor of TeamsUserCredential.\n *\n * @example\n * ```typescript\n * const config: TeamsUserCredentialAuthConfig = {\n * initiateLoginEndpoint: \"https://localhost:3000/auth-start.html\",\n * clientId: \"xxx\"\n * }\n * const credential = new TeamsUserCredential(config);\n * ```\n *\n * @param {TeamsUserCredentialAuthConfig} authConfig - The authentication configuration.\n *\n * @throws {@link ErrorCode|InvalidConfiguration} when client id, initiate login endpoint or simple auth endpoint is not found in config.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.\n */\n constructor(authConfig: TeamsUserCredentialAuthConfig);\n // eslint-disable-next-line no-secrets/no-secrets\n /**\n * Constructor of TeamsUserCredential.\n * @deprecated\n * @example\n * ```typescript\n * const config: AuthenticationConfiguration = {\n * initiateLoginEndpoint: \"https://localhost:3000/auth-start.html\",\n * clientId: \"xxx\"\n * }\n * // Use default configuration provided by Teams Toolkit\n * const credential = new TeamsUserCredential();\n * // Use a customized configuration\n * const anotherCredential = new TeamsUserCredential(config);\n * ```\n *\n * @param {TeamsUserCredentialAuthConfig} authConfig - The authentication configuration.\n *\n * @throws {@link ErrorCode|InvalidConfiguration} when client id, initiate login endpoint or simple auth endpoint is not found in config.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.\n */\n constructor(authConfig: AuthenticationConfiguration);\n constructor(authConfig: TeamsUserCredentialAuthConfig | AuthenticationConfiguration) {\n internalLogger.info(\"Create teams user credential\");\n this.config = this.loadAndValidateConfig(authConfig);\n this.ssoToken = null;\n this.initialized = false;\n }\n\n /**\n * Popup login page to get user's access token with specific scopes.\n *\n * @remarks\n * Only works in Teams client APP. User will be redirected to the authorization page to login and consent.\n *\n * @example\n * ```typescript\n * await credential.login([\"https://graph.microsoft.com/User.Read\"]); // single scope using string array\n * await credential.login(\"https://graph.microsoft.com/User.Read\"); // single scopes using string\n * await credential.login([\"https://graph.microsoft.com/User.Read\", \"Calendars.Read\"]); // multiple scopes using string array\n * await credential.login(\"https://graph.microsoft.com/User.Read Calendars.Read\"); // multiple scopes using string\n * ```\n * @param scopes - The list of scopes for which the token will have access, before that, we will request user to consent.\n * @param { string[] } resources - The optional list of resources for full trust Teams apps.\n *\n * @throws {@link ErrorCode|InternalError} when failed to login with unknown error.\n * @throws {@link ErrorCode|ConsentFailed} when user canceled or failed to consent.\n * @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.\n */\n async login(scopes: string | string[], resources?: string[]): Promise<void> {\n validateScopesType(scopes);\n const scopesStr = typeof scopes === \"string\" ? scopes : scopes.join(\" \");\n\n internalLogger.info(`Popup login page to get user's access token with scopes: ${scopesStr}`);\n\n if (!this.initialized) {\n await this.init(resources);\n }\n\n await app.initialize();\n let result: string;\n try {\n const params = {\n url: `${\n this.config.initiateLoginEndpoint ? this.config.initiateLoginEndpoint : \"\"\n }?clientId=${this.config.clientId ? this.config.clientId : \"\"}&scope=${encodeURI(\n scopesStr\n )}&loginHint=${this.loginHint ? this.loginHint : \"\"}`,\n width: loginPageWidth,\n height: loginPageHeight,\n } as authentication.AuthenticatePopUpParameters;\n result = await authentication.authenticate(params);\n if (!result) {\n const errorMsg = \"Get empty authentication result from MSAL\";\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.InternalError);\n }\n } catch (err: unknown) {\n const errorMsg = `Consent failed for the scope ${scopesStr} with error: ${\n (err as Error).message\n }`;\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.ConsentFailed);\n }\n let resultJson: any = {};\n try {\n resultJson = typeof result == \"string\" ? JSON.parse(result) : result;\n } catch (error) {\n // If can not parse result as Json, will throw error.\n const failedToParseResult = \"Failed to parse response to Json.\";\n internalLogger.error(failedToParseResult);\n throw new ErrorWithCode(failedToParseResult, ErrorCode.InvalidResponse);\n }\n\n // If code exists in result, user may using previous auth-start and auth-end page.\n if (resultJson.code) {\n const helpLink = \"https://aka.ms/teamsfx-auth-code-flow\";\n const usingPreviousAuthPage =\n \"Found auth code in response. Auth code is not support for current version of SDK. \" +\n `Please refer to the help link for how to fix the issue: ${helpLink}.`;\n internalLogger.error(usingPreviousAuthPage);\n throw new ErrorWithCode(usingPreviousAuthPage, ErrorCode.InvalidResponse);\n }\n\n // If sessionStorage exists in result, set the values in current session storage.\n if (resultJson.sessionStorage) {\n this.setSessionStorage(resultJson.sessionStorage);\n }\n }\n\n /**\n * Get access token from credential.\n *\n * Important: Access tokens are stored in sessionStorage, read more here: https://aka.ms/teamsfx-session-storage-notice\n * Important: Full trust applications do not read the resource information from the webApplicationInfo section of the app\n * manifest. Instead, this resource (along with any additional resources from which to request tokens) must be provided\n * as a list of resources to the getToken() method through a GetTeamsUserTokenOptions object.\n *\n * @example\n * ```typescript\n * await credential.getToken([]) // Get SSO token using empty string array\n * await credential.getToken(\"\") // Get SSO token using empty string\n * await credential.getToken([\".default\"]) // Get Graph access token with default scope using string array\n * await credential.getToken(\".default\") // Get Graph access token with default scope using string\n * await credential.getToken([\"User.Read\"]) // Get Graph access token for single scope using string array\n * await credential.getToken(\"User.Read\") // Get Graph access token for single scope using string\n * await credential.getToken([\"User.Read\", \"Application.Read.All\"]) // Get Graph access token for multiple scopes using string array\n * await credential.getToken(\"User.Read Application.Read.All\") // Get Graph access token for multiple scopes using space-separated string\n * await credential.getToken(\"https://graph.microsoft.com/User.Read\") // Get Graph access token with full resource URI\n * await credential.getToken([\"https://outlook.office.com/Mail.Read\"]) // Get Outlook access token\n *\n * const options: GetTeamsUserTokenOptions = { resources: [\"https://domain.example.com\"] }; // set up resources for full trust apps.\n * await credential.getToken([], options) // Get sso token from teams client - only use this approach for full trust apps.\n * ```\n *\n * @param {string | string[]} scopes - The list of scopes for which the token will have access.\n * @param {GetTokenOptions} options - The options used to configure any requests this TokenCredential implementation might make.\n *\n * @throws {@link ErrorCode|InternalError} when failed to get access token with unknown error.\n * @throws {@link ErrorCode|UiRequiredError} when need user consent to get access token.\n * @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.\n *\n * @returns User access token of defined scopes.\n * If scopes is empty string or array, it returns SSO token.\n * If scopes is non-empty, it returns access token for target scope.\n * Throw error if get access token failed.\n */\n async getToken(\n scopes: string | string[],\n options?: GetTokenOptions\n ): Promise<AccessToken | null> {\n validateScopesType(scopes);\n const resources = (options as GetTeamsUserTokenOptions)?.resources;\n const ssoToken = await this.getSSOToken(resources);\n\n const scopeStr = typeof scopes === \"string\" ? scopes : scopes.join(\" \");\n if (scopeStr === \"\") {\n internalLogger.info(\"Get SSO token\");\n\n return ssoToken;\n } else {\n internalLogger.info(\"Get access token with scopes: \" + scopeStr);\n\n if (!this.initialized) {\n await this.init(resources);\n }\n\n let tokenResponse;\n const scopesArray = typeof scopes === \"string\" ? scopes.split(\" \") : scopes;\n const domain = window.location.origin;\n\n // First try to get Access Token from cache.\n try {\n const account = this.msalInstance!.getAccountByUsername(this.loginHint!);\n const scopesRequestForAcquireTokenSilent = {\n scopes: scopesArray,\n account: account ?? undefined,\n redirectUri: `${domain}/blank-auth-end.html`,\n };\n tokenResponse = await this.msalInstance!.acquireTokenSilent(\n scopesRequestForAcquireTokenSilent\n );\n } catch (error: any) {\n const acquireTokenSilentFailedMessage = `Failed to call acquireTokenSilent. Reason: ${\n error?.message as string\n }. `;\n internalLogger.verbose(acquireTokenSilentFailedMessage);\n }\n\n if (!tokenResponse) {\n // If fail to get Access Token from cache, try to get Access token by silent login.\n try {\n const scopesRequestForSsoSilent = {\n scopes: scopesArray,\n loginHint: this.loginHint,\n redirectUri: `${domain}/blank-auth-end.html`,\n };\n tokenResponse = await this.msalInstance!.ssoSilent(scopesRequestForSsoSilent);\n } catch (error: any) {\n const ssoSilentFailedMessage = `Failed to call ssoSilent. Reason: ${\n error?.message as string\n }. `;\n internalLogger.verbose(ssoSilentFailedMessage);\n }\n }\n\n if (!tokenResponse) {\n const errorMsg = `Failed to get access token cache silently, please login first: you need login first before get access token.`;\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.UiRequiredError);\n }\n\n const accessToken = parseAccessTokenFromAuthCodeTokenResponse(tokenResponse);\n return accessToken;\n }\n }\n\n /**\n * Get basic user info from SSO token\n *\n * @param {string[]} resources - The optional list of resources for full trust Teams apps.\n *\n * @example\n * ```typescript\n * const currentUser = await credential.getUserInfo();\n * ```\n *\n * @throws {@link ErrorCode|InternalError} when SSO token from Teams client is not valid.\n * @throws {@link ErrorCode|InvalidParameter} when SSO token from Teams client is empty.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.\n *\n * @returns Basic user info with user displayName, objectId and preferredUserName.\n */\n public async getUserInfo(resources?: string[]): Promise<UserInfo> {\n internalLogger.info(\"Get basic user info from SSO token\");\n const ssoToken = await this.getSSOToken(resources);\n return getUserInfoFromSsoToken(ssoToken.token);\n }\n\n private async init(resources?: string[]): Promise<void> {\n const ssoToken = await this.getSSOToken(resources);\n const info = getTenantIdAndLoginHintFromSsoToken(ssoToken.token);\n this.loginHint = info.loginHint;\n this.tid = info.tid;\n\n const msalConfig = {\n auth: {\n clientId: this.config.clientId!,\n authority: `https://login.microsoftonline.com/${this.tid}`,\n },\n cache: {\n cacheLocation: \"sessionStorage\",\n },\n };\n\n this.msalInstance = new PublicClientApplication(msalConfig);\n this.initialized = true;\n }\n\n /**\n * Get SSO token using teams SDK\n * 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\n *\n * @param {string[]} resources - The optional list of resources for full trust Teams apps.\n *\n * @returns SSO token\n */\n private async getSSOToken(resources?: string[]): Promise<AccessToken> {\n if (this.ssoToken) {\n if (this.ssoToken.expiresOnTimestamp - Date.now() > tokenRefreshTimeSpanInMillisecond) {\n internalLogger.verbose(\"Get SSO token from memory cache\");\n return this.ssoToken;\n }\n }\n\n const params = { resources: resources ?? [] } as authentication.AuthTokenRequestParameters;\n let token: string;\n try {\n await app.initialize();\n } catch (err: unknown) {\n const errorMsg = \"Initialize teams sdk failed due to not running inside Teams environment\";\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.InternalError);\n }\n\n try {\n token = await authentication.getAuthToken(params);\n } catch (err: unknown) {\n const errorMsg = \"Get SSO token failed with error: \" + (err as Error).message;\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.InternalError);\n }\n\n if (!token) {\n const errorMsg = \"Get empty SSO token from Teams\";\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.InternalError);\n }\n\n const tokenObject = parseJwt(token);\n if (tokenObject.ver !== \"1.0\" && tokenObject.ver !== \"2.0\") {\n const errorMsg = \"SSO token is not valid with an unknown version: \" + tokenObject.ver;\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.InternalError);\n }\n\n const ssoToken: AccessToken = {\n token,\n expiresOnTimestamp: tokenObject.exp * 1000,\n };\n\n this.ssoToken = ssoToken;\n return ssoToken;\n }\n\n /**\n * Load and validate authentication configuration\n *\n * @param {AuthenticationConfiguration?} config - The authentication configuration. Use environment variables if not provided.\n *\n * @returns Authentication configuration\n */\n private loadAndValidateConfig(\n config: AuthenticationConfiguration | TeamsUserCredentialAuthConfig\n ): AuthenticationConfiguration {\n internalLogger.verbose(\"Validate authentication configuration\");\n if (config.initiateLoginEndpoint && config.clientId) {\n return config;\n }\n\n const missingValues = [];\n if (!config.initiateLoginEndpoint) {\n missingValues.push(\"initiateLoginEndpoint\");\n }\n\n if (!config.clientId) {\n missingValues.push(\"clientId\");\n }\n\n const errorMsg = formatString(\n ErrorMessage.InvalidConfiguration,\n missingValues.join(\", \"),\n \"undefined\"\n );\n\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.InvalidConfiguration);\n }\n\n private setSessionStorage(sessionStorageValues: any): void {\n try {\n const sessionStorageKeys = Object.keys(sessionStorageValues);\n sessionStorageKeys.forEach((key) => {\n sessionStorage.setItem(key, sessionStorageValues[key]);\n });\n } catch (error: any) {\n // Values in result.sessionStorage can not be set into session storage.\n // Throw error since this may block user.\n const errorMessage = `Failed to set values in session storage. Error: ${\n error.message as string\n }`;\n internalLogger.error(errorMessage);\n throw new ErrorWithCode(errorMessage, ErrorCode.InternalError);\n }\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AuthenticationProvider } from \"@microsoft/microsoft-graph-client\";\nimport { ErrorWithCode, ErrorCode } from \"./errors\";\nimport { TeamsFxConfiguration } from \"../models/teamsfxConfiguration\";\nimport { internalLogger } from \"../util/logger\";\nimport { validateScopesType } from \"../util/utils\";\nimport { AccessToken, TokenCredential } from \"@azure/identity\";\n\nconst defaultScope = \"https://graph.microsoft.com/.default\";\n\n// eslint-disable-next-line no-secrets/no-secrets\n/**\n * Microsoft Graph auth provider for Teams Framework\n * @deprecated Use `TokenCredentialAuthenticationProvider` from `@microsoft/microsoft-graph-client/authProviders/azureTokenCredentials` instead.\n */\nexport class MsGraphAuthProvider implements AuthenticationProvider {\n private credentialOrTeamsFx: TokenCredential | TeamsFxConfiguration;\n private scopes: string | string[];\n\n /**\n * Constructor of MsGraphAuthProvider.\n *\n * @param {TeamsFxConfiguration} teamsfx - Used to provide configuration and auth.\n * @param {string | string[]} scopes - The list of scopes for which the token will have access.\n *\n * @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.\n *\n * @returns An instance of MsGraphAuthProvider.\n */\n constructor(teamsfx: TeamsFxConfiguration, scopes?: string | string[]);\n /**\n * Constructor of MsGraphAuthProvider.\n *\n * @param {TokenCredential} credential - credential used to provide configuration and auth.\n * @param {string | string[]} scopes - The list of scopes for which the token will have access.\n *\n * @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.\n *\n * @returns An instance of MsGraphAuthProvider.\n */\n constructor(credential: TokenCredential, scopes?: string | string[]);\n constructor(\n credentialOrTeamsFx: TeamsFxConfiguration | TokenCredential,\n scopes?: string | string[]\n ) {\n this.credentialOrTeamsFx = credentialOrTeamsFx;\n\n let scopesStr = defaultScope;\n if (scopes) {\n validateScopesType(scopes);\n scopesStr = typeof scopes === \"string\" ? scopes : scopes.join(\" \");\n if (scopesStr === \"\") {\n scopesStr = defaultScope;\n }\n }\n\n internalLogger.info(\n `Create Microsoft Graph Authentication Provider with scopes: '${scopesStr}'`\n );\n\n this.scopes = scopesStr;\n }\n\n /**\n * Get access token for Microsoft Graph API requests.\n *\n * @throws {@link ErrorCode|InternalError} when get access token failed due to empty token or unknown other problems.\n * @throws {@link ErrorCode|TokenExpiredError} when SSO token has already expired.\n * @throws {@link ErrorCode|UiRequiredError} when need user consent to get access token.\n * @throws {@link ErrorCode|ServiceError} when failed to get access token from simple auth or AAD server.\n * @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.\n *\n * @returns Access token from the credential.\n *\n */\n public async getAccessToken(): Promise<string> {\n internalLogger.info(`Get Graph Access token with scopes: '${this.scopes.toString()}'`);\n\n let accessToken: AccessToken | null;\n if ((this.credentialOrTeamsFx as TeamsFxConfiguration).getCredential) {\n accessToken = await (this.credentialOrTeamsFx as TeamsFxConfiguration)\n .getCredential()\n .getToken(this.scopes);\n } else {\n accessToken = await (this.credentialOrTeamsFx as TokenCredential).getToken(this.scopes);\n }\n\n return new Promise<string>((resolve, reject) => {\n if (accessToken) {\n resolve(accessToken.token);\n } else {\n const errorMsg = \"Graph access token is undefined or empty\";\n internalLogger.error(errorMsg);\n reject(new ErrorWithCode(errorMsg, ErrorCode.InternalError));\n }\n });\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { Client } from \"@microsoft/microsoft-graph-client\";\nimport { MsGraphAuthProvider } from \"./msGraphAuthProvider\";\nimport { TeamsFxConfiguration } from \"../models/teamsfxConfiguration\";\nimport { internalLogger } from \"../util/logger\";\nimport { TokenCredential } from \"@azure/identity\";\n\n/**\n * Get Microsoft graph client.\n * @deprecated Use `TokenCredentialAuthenticationProvider` and `Client.initWithMiddleware` instead.\n * ```typescript\n * const authProvider = new TokenCredentialAuthenticationProvider(credential, { scopes: scope });\n * const graph = Client.initWithMiddleware({\n * authProvider: authProvider,\n * });\n * ```\n *\n * @example\n * Get Microsoft graph client by TokenCredential\n * ```typescript\n * // Sso token example (Azure Function)\n * const ssoToken = \"YOUR_TOKEN_STRING\";\n * const options = {\"AAD_APP_ID\", \"AAD_APP_SECRET\"};\n * const credential = new OnBehalfOfAADUserCredential(ssoToken, options);\n * const graphClient = await createMicrosoftGraphClient(credential);\n * const profile = await graphClient.api(\"/me\").get();\n *\n * // TeamsBotSsoPrompt example (Bot Application)\n * const requiredScopes = [\"User.Read\"];\n * const config: Configuration = {\n * loginUrl: loginUrl,\n * clientId: clientId,\n * clientSecret: clientSecret,\n * tenantId: tenantId\n * };\n * const prompt = new TeamsBotSsoPrompt(dialogId, {\n * config: config\n * scopes: [\"User.Read\"],\n * });\n * this.addDialog(prompt);\n *\n * const oboCredential = new OnBehalfOfAADUserCredential(\n * getUserId(dialogContext),\n * {\n * clientId: \"AAD_APP_ID\",\n * clientSecret: \"AAD_APP_SECRET\"\n * });\n * try {\n * const graphClient = await createMicrosoftGraphClient(credential);\n * const profile = await graphClient.api(\"/me\").get();\n * } catch (e) {\n * dialogContext.beginDialog(dialogId);\n * return Dialog.endOfTurn();\n * }\n * ```\n *\n * @param {TeamsFx} teamsfx - Used to provide configuration and auth.\n * @param scopes - The array of Microsoft Token scope of access. Default value is `[.default]`.\n *\n * @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.\n *\n * @returns Graph client with specified scopes.\n */\nexport function createMicrosoftGraphClient(\n teamsfx: TeamsFxConfiguration,\n scopes?: string | string[]\n): Client {\n internalLogger.info(\"Create Microsoft Graph Client\");\n const authProvider = new MsGraphAuthProvider(teamsfx, scopes);\n const graphClient = Client.initWithMiddleware({\n authProvider,\n });\n\n return graphClient;\n}\n\n// eslint-disable-next-line no-secrets/no-secrets\n/**\n * Get Microsoft graph client.\n * @deprecated Use `TokenCredentialAuthenticationProvider` and `Client.initWithMiddleware` instead.\n * ```typescript\n * const authProvider = new TokenCredentialAuthenticationProvider(credential, { scopes: scope });\n * const graph = Client.initWithMiddleware({\n * authProvider: authProvider,\n * });\n * ```\n * \n * @example\n * Get Microsoft graph client by TokenCredential\n * ```typescript\n * // In browser: TeamsUserCredential\n * const authConfig: TeamsUserCredentialAuthConfig = {\n * clientId: \"xxx\",\n initiateLoginEndpoint: \"https://xxx/auth-start.html\",\n * };\n\n * const credential = new TeamsUserCredential(authConfig);\n\n * const scope = \"User.Read\";\n * await credential.login(scope);\n\n * const client = createMicrosoftGraphClientWithCredential(credential, scope);\n\n * // In node: OnBehalfOfUserCredential\n * const oboAuthConfig: OnBehalfOfCredentialAuthConfig = {\n * authorityHost: \"xxx\",\n * clientId: \"xxx\",\n * tenantId: \"xxx\",\n * clientSecret: \"xxx\",\n * };\n\n * const oboCredential = new OnBehalfOfUserCredential(ssoToken, oboAuthConfig);\n * const scope = \"User.Read\";\n * const client = createMicrosoftGraphClientWithCredential(oboCredential, scope);\n\n * // In node: AppCredential\n * const appAuthConfig: AppCredentialAuthConfig = {\n * authorityHost: \"xxx\",\n * clientId: \"xxx\",\n * tenantId: \"xxx\",\n * clientSecret: \"xxx\",\n * };\n * const appCredential = new AppCredential(appAuthConfig);\n * const scope = \"User.Read\";\n * const client = createMicrosoftGraphClientWithCredential(appCredential, scope);\n * \n * const profile = await client.api(\"/me\").get();\n * ```\n *\n * @param {TokenCredential} credential - Used to provide configuration and auth.\n * @param scopes - The array of Microsoft Token scope of access. Default value is `[.default]`.\n *\n * @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.\n *\n * @returns Graph client with specified scopes.\n */\nexport function createMicrosoftGraphClientWithCredential(\n credential: TokenCredential,\n scopes?: string | string[]\n): Client {\n internalLogger.info(\"Create Microsoft Graph Client\");\n const authProvider = new MsGraphAuthProvider(credential, scopes);\n const graphClient = Client.initWithMiddleware({\n authProvider,\n });\n return graphClient;\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { ConnectionConfig } from \"tedious\";\nimport { ErrorWithCode, ErrorCode, ErrorMessage } from \"../core/errors\";\nimport { TeamsFx } from \"../core/teamsfx\";\nimport { formatString } from \"../util/utils\";\n\n/**\n * Generate connection configuration consumed by tedious.\n *\n * @deprecated we recommend you compose your own Tedious configuration for better flexibility.\n *\n * @remarks\n * Only works in in server side.\n */\nexport function getTediousConnectionConfig(\n teamsfx: TeamsFx,\n databaseName?: string\n): Promise<ConnectionConfig> {\n return Promise.reject(\n new ErrorWithCode(\n formatString(\n ErrorMessage.BrowserRuntimeNotSupported,\n \"DefaultTediousConnectionConfiguration\"\n ),\n ErrorCode.RuntimeNotSupported\n )\n );\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { DialogContext, DialogTurnResult } from \"botbuilder-dialogs\";\nimport { ErrorWithCode, ErrorCode, ErrorMessage } from \"../core/errors\";\nimport { formatString } from \"../util/utils\";\nimport { TeamsFx } from \"../core/teamsfx\";\n\n/**\n * Settings used to configure an TeamsBotSsoPrompt instance.\n *\n * @remarks\n * Only works in in server side.\n */\nexport interface TeamsBotSsoPromptSettings {\n /**\n * The array of strings that declare the desired permissions and the resources requested.\n */\n scopes: string[];\n\n /**\n * (Optional) number of milliseconds the prompt will wait for the user to authenticate.\n * Defaults to a value `900,000` (15 minutes.)\n */\n timeout?: number;\n\n /**\n * (Optional) value indicating whether the TeamsBotSsoPrompt should end upon receiving an\n * invalid message. Generally the TeamsBotSsoPrompt will end the auth flow when receives user\n * message not related to the auth flow. Setting the flag to false ignores the user's message instead.\n * Defaults to value `true`\n */\n endOnInvalidMessage?: boolean;\n}\n\n/**\n * Creates a new prompt that leverage Teams Single Sign On (SSO) support for bot to automatically sign in user and\n * help receive oauth token, asks the user to consent if needed.\n *\n * @remarks\n * The prompt will attempt to retrieve the users current token of the desired scopes and store it in\n * the token store.\n *\n * User will be automatically signed in leveraging Teams support of Bot Single Sign On(SSO):\n * https://docs.microsoft.com/en-us/microsoftteams/platform/bots/how-to/authentication/auth-aad-sso-bots\n *\n * @example\n * When used with your bots `DialogSet` you can simply add a new instance of the prompt as a named\n * dialog using `DialogSet.add()`. You can then start the prompt from a waterfall step using either\n * `DialogContext.beginDialog()` or `DialogContext.prompt()`. The user will be prompted to sign in as\n * needed and their access token will be passed as an argument to the callers next waterfall step:\n *\n * ```JavaScript\n * const { ConversationState, MemoryStorage } = require('botbuilder');\n * const { DialogSet, WaterfallDialog } = require('botbuilder-dialogs');\n * const { TeamsBotSsoPrompt } = require('@microsoft/teamsfx');\n *\n * const convoState = new ConversationState(new MemoryStorage());\n * const dialogState = convoState.createProperty('dialogState');\n * const dialogs = new DialogSet(dialogState);\n *\n * dialogs.add(new TeamsBotSsoPrompt('TeamsBotSsoPrompt', {\n * scopes: [\"User.Read\"],\n * }));\n *\n * dialogs.add(new WaterfallDialog('taskNeedingLogin', [\n * async (step) => {\n * return await step.beginDialog('TeamsBotSsoPrompt');\n * },\n * async (step) => {\n * const token = step.result;\n * if (token) {\n *\n * // ... continue with task needing access token ...\n *\n * } else {\n * await step.context.sendActivity(`Sorry... We couldn't log you in. Try again later.`);\n * return await step.endDialog();\n * }\n * }\n * ]));\n * ```\n */\nexport class TeamsBotSsoPrompt {\n /**\n * Constructor of TeamsBotSsoPrompt.\n *\n * @param dialogId Unique ID of the dialog within its parent `DialogSet` or `ComponentDialog`.\n * @param settings Settings used to configure the prompt.\n *\n * @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.\n */\n constructor(\n private teamsfx: TeamsFx,\n dialogId: string,\n private settings: TeamsBotSsoPromptSettings\n ) {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"TeamsBotSsoPrompt\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Called when a prompt dialog is pushed onto the dialog stack and is being activated.\n * @remarks\n * If the task is successful, the result indicates whether the prompt is still\n * active after the turn has been processed by the prompt.\n *\n * @param dc The DialogContext for the current turn of the conversation.\n *\n * @throws {@link ErrorCode|InvalidParameter} when timeout property in teams bot sso prompt settings is not number or is not positive.\n * @throws {@link ErrorCode|ChannelNotSupported} when bot channel is not MS Teams.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.\n *\n * @returns A `Promise` representing the asynchronous operation.\n */\n public beginDialog(dc: DialogContext): Promise<DialogTurnResult> {\n return Promise.reject(\n new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"TeamsBotSsoPrompt\"),\n ErrorCode.RuntimeNotSupported\n )\n );\n }\n\n /**\n * Called when a prompt dialog is the active dialog and the user replied with a new activity.\n *\n * @remarks\n * If the task is successful, the result indicates whether the dialog is still\n * active after the turn has been processed by the dialog.\n * The prompt generally continues to receive the user's replies until it accepts the\n * user's reply as valid input for the prompt.\n *\n * @param dc The DialogContext for the current turn of the conversation.\n *\n * @returns A `Promise` representing the asynchronous operation.\n *\n * @throws {@link ErrorCode|ChannelNotSupported} when bot channel is not MS Teams.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.\n */\n public continueDialog(dc: DialogContext): Promise<DialogTurnResult> {\n return Promise.reject(\n new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"TeamsBotSsoPrompt\"),\n ErrorCode.RuntimeNotSupported\n )\n );\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport axios, { AxiosInstance, InternalAxiosRequestConfig } from \"axios\";\nimport { AuthProvider } from \"./authProvider\";\n\n/**\n * Initializes new Axios instance with specific auth provider\n *\n * @param apiEndpoint - Base url of the API\n * @param authProvider - Auth provider that injects authentication info to each request\n * @returns axios instance configured with specfic auth provider\n *\n * @example\n * ```typescript\n * const client = createApiClient(\"https://my-api-endpoint-base-url\", new BasicAuthProvider(\"xxx\",\"xxx\"));\n * ```\n */\nexport function createApiClient(apiEndpoint: string, authProvider: AuthProvider): AxiosInstance {\n // Add a request interceptor\n const instance = axios.create({\n baseURL: apiEndpoint,\n });\n instance.interceptors.request.use(async function (config) {\n return (await authProvider.AddAuthenticationInfo(\n config\n )) as Promise<InternalAxiosRequestConfig>;\n });\n return instance;\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AxiosRequestConfig } from \"axios\";\nimport { ErrorWithCode, ErrorCode, ErrorMessage } from \"../core/errors\";\nimport { AuthProvider } from \"./authProvider\";\n\n/**\n * Provider that handles Bearer Token authentication\n */\nexport class BearerTokenAuthProvider implements AuthProvider {\n private getToken: () => Promise<string>;\n\n /**\n * @param { () => Promise<string> } getToken - Function that returns the content of bearer token used in http request\n */\n constructor(getToken: () => Promise<string>) {\n this.getToken = getToken;\n }\n\n /**\n * Adds authentication info to http requests\n *\n * @param { AxiosRequestConfig } config - Contains all the request information and can be updated to include extra authentication info.\n * Refer https://axios-http.com/docs/req_config for detailed document.\n *\n * @returns Updated axios request config.\n *\n * @throws {@link ErrorCode|AuthorizationInfoAlreadyExists} - when Authorization header already exists in request configuration.\n */\n public async AddAuthenticationInfo(config: AxiosRequestConfig): Promise<AxiosRequestConfig> {\n const token = await this.getToken();\n if (!config.headers) {\n config.headers = {};\n }\n if (config.headers[\"Authorization\"]) {\n throw new ErrorWithCode(\n ErrorMessage.AuthorizationHeaderAlreadyExists,\n ErrorCode.AuthorizationInfoAlreadyExists\n );\n }\n\n config.headers[\"Authorization\"] = `Bearer ${token}`;\n return config;\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AxiosRequestConfig } from \"axios\";\nimport { AuthProvider } from \"./authProvider\";\nimport { ErrorWithCode, ErrorCode, ErrorMessage } from \"../core/errors\";\nimport { formatString } from \"../util/utils\";\n\n/**\n * Provider that handles Basic authentication\n */\nexport class BasicAuthProvider implements AuthProvider {\n private userName: string;\n private password: string;\n\n /**\n *\n * @param { string } userName - Username used in basic auth\n * @param { string } password - Password used in basic auth\n *\n * @throws {@link ErrorCode|InvalidParameter} - when username or password is empty.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.\n */\n constructor(userName: string, password: string) {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"BasicAuthProvider\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Adds authentication info to http requests\n *\n * @param { AxiosRequestConfig } config - Contains all the request information and can be updated to include extra authentication info.\n * Refer https://axios-http.com/docs/req_config for detailed document.\n *\n * @returns Updated axios request config.\n *\n * @throws {@link ErrorCode|AuthorizationInfoAlreadyExists} - when Authorization header or auth property already exists in request configuration.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.\n */\n public AddAuthenticationInfo(config: AxiosRequestConfig): Promise<AxiosRequestConfig> {\n return Promise.reject(\n new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"BasicAuthProvider\"),\n ErrorCode.RuntimeNotSupported\n )\n );\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AxiosRequestConfig } from \"axios\";\nimport { AuthProvider } from \"./authProvider\";\nimport { ErrorWithCode, ErrorCode, ErrorMessage } from \"../core/errors\";\nimport { formatString } from \"../util/utils\";\n\n/**\n * Provider that handles API Key authentication\n */\nexport class ApiKeyProvider implements AuthProvider {\n private keyName: string;\n private keyValue: string;\n private keyLocation: ApiKeyLocation;\n\n /**\n *\n * @param { string } keyName - The name of request header or query parameter that specifies API Key\n * @param { string } keyValue - The value of API Key\n * @param { ApiKeyLocation } keyLocation - The location of API Key: request header or query parameter.\n *\n * @throws {@link ErrorCode|InvalidParameter} - when key name or key value is empty.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.\n */\n constructor(keyName: string, keyValue: string, keyLocation: ApiKeyLocation) {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"ApiKeyProvider\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Adds authentication info to http requests\n *\n * @param { AxiosRequestConfig } config - Contains all the request information and can be updated to include extra authentication info.\n * Refer https://axios-http.com/docs/req_config for detailed document.\n *\n * @returns Updated axios request config.\n *\n * @throws {@link ErrorCode|AuthorizationInfoAlreadyExists} - when API key already exists in request header or url query parameter.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.\n */\n public AddAuthenticationInfo(config: AxiosRequestConfig): Promise<AxiosRequestConfig> {\n return Promise.reject(\n new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"ApiKeyProvider\"),\n ErrorCode.RuntimeNotSupported\n )\n );\n }\n}\n\n/**\n * Define available location for API Key location\n */\nexport enum ApiKeyLocation {\n /**\n * The API Key is placed in request header\n */\n Header,\n /**\n * The API Key is placed in query parameter\n */\n QueryParams,\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AxiosRequestConfig } from \"axios\";\nimport { SecureContextOptions } from \"tls\";\nimport { AuthProvider } from \"./authProvider\";\nimport { ErrorWithCode, ErrorCode, ErrorMessage } from \"../core/errors\";\nimport { formatString } from \"../util/utils\";\n\n/**\n * Provider that handles Certificate authentication\n */\n\nexport class CertificateAuthProvider implements AuthProvider {\n private certOption: SecureContextOptions;\n\n /**\n *\n * @param { SecureContextOptions } certOption - information about the cert used in http requests\n */\n constructor(certOption: SecureContextOptions) {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"CertificateAuthProvider\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Adds authentication info to http requests.\n *\n * @param { AxiosRequestConfig } config - Contains all the request information and can be updated to include extra authentication info.\n * Refer https://axios-http.com/docs/req_config for detailed document.\n *\n * @returns Updated axios request config.\n *\n * @throws {@link ErrorCode|InvalidParameter} - when custom httpsAgent in the request has duplicate properties with certOption provided in constructor.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.\n */\n public AddAuthenticationInfo(config: AxiosRequestConfig): Promise<AxiosRequestConfig> {\n return Promise.reject(\n new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"CertificateAuthProvider\"),\n ErrorCode.RuntimeNotSupported\n )\n );\n }\n}\n\n/**\n * Helper to create SecureContextOptions from PEM format cert\n *\n * @param { string | Buffer } cert - The cert chain in PEM format\n * @param { string | Buffer } key - The private key for the cert chain\n * @param { {passphrase?: string; ca?: string | Buffer} } options - Optional settings when create the cert options.\n *\n * @returns Instance of SecureContextOptions\n *\n * @throws {@link ErrorCode|InvalidParameter} - when any parameter is empty\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.\n *\n */\nexport function createPemCertOption(\n cert: string | Buffer,\n key: string | Buffer,\n options?: {\n passphrase?: string;\n ca?: string | Buffer;\n }\n): SecureContextOptions {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"createPemCertOption\"),\n ErrorCode.RuntimeNotSupported\n );\n}\n\n/**\n * Helper to create SecureContextOptions from PFX format cert\n *\n * @param { string | Buffer } pfx - The content of .pfx file\n * @param { {passphrase?: string} } options - Optional settings when create the cert options.\n *\n * @returns Instance of SecureContextOptions\n *\n * @throws {@link ErrorCode|InvalidParameter} - when any parameter is empty\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.\n *\n */\nexport function createPfxCertOption(\n pfx: string | Buffer,\n options?: {\n passphrase?: string;\n }\n): SecureContextOptions {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"createPfxCertOption\"),\n ErrorCode.RuntimeNotSupported\n );\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * Identity type to use in authentication.\n */\nexport enum IdentityType {\n /**\n * Represents the current user of Teams.\n */\n User = \"User\",\n /**\n * Represents the application itself.\n */\n App = \"Application\",\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { TokenCredential } from \"@azure/identity\";\nimport { TeamsUserCredential } from \"../credential/teamsUserCredential.browser\";\nimport { IdentityType } from \"../models/identityType\";\nimport { UserInfo } from \"../models/userinfo\";\nimport { formatString } from \"../util/utils\";\nimport { ErrorWithCode, ErrorCode, ErrorMessage } from \"../core/errors\";\nimport { internalLogger } from \"../util/logger\";\nimport { TeamsFxConfiguration } from \"../models/teamsfxConfiguration\";\nimport { AuthenticationConfiguration } from \"../models/configuration\";\n\n/**\n * A class providing credential and configuration.\n * @deprecated Please use {@link TeamsUserCredential}\n * in browser environment and {@link OnBehalfOfUserCredential} or {@link AppCredential} in NodeJS.\n */\nexport class TeamsFx implements TeamsFxConfiguration {\n private configuration: Map<string, string | undefined>;\n private teamsUserCredential?: TeamsUserCredential;\n public identityType: IdentityType;\n\n constructor(\n identityType?: IdentityType,\n customConfig?: Record<string, string> | AuthenticationConfiguration\n ) {\n this.identityType = identityType ?? IdentityType.User;\n if (this.identityType !== IdentityType.User) {\n const errorMsg = formatString(\n ErrorMessage.IdentityTypeNotSupported,\n this.identityType.toString(),\n \"TeamsFx\"\n );\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.IdentityTypeNotSupported);\n }\n this.configuration = new Map<string, string>();\n this.loadFromEnv();\n if (customConfig) {\n const myConfig: Record<string, string> = { ...customConfig };\n for (const key of Object.keys(myConfig)) {\n const value = myConfig[key];\n if (value) {\n this.configuration.set(key, value);\n }\n }\n }\n if (this.configuration.size === 0) {\n internalLogger.warn(\n \"No configuration is loaded, please pass required configs to TeamsFx constructor\"\n );\n }\n }\n\n private loadFromEnv(): void {\n if (window && (window as any).__env__) {\n // testing purpose\n const env = (window as any).__env__;\n this.configuration.set(\"authorityHost\", env.REACT_APP_AUTHORITY_HOST);\n this.configuration.set(\"tenantId\", env.REACT_APP_TENANT_ID);\n this.configuration.set(\"clientId\", env.REACT_APP_CLIENT_ID);\n this.configuration.set(\"initiateLoginEndpoint\", env.REACT_APP_START_LOGIN_PAGE_URL);\n this.configuration.set(\"applicationIdUri\", env.M365_APPLICATION_ID_URI);\n this.configuration.set(\"apiEndpoint\", env.REACT_APP_FUNC_ENDPOINT);\n this.configuration.set(\"apiName\", env.REACT_APP_FUNC_NAME);\n } else {\n // TODO: support common environment variable name\n try {\n this.configuration.set(\"authorityHost\", process.env.REACT_APP_AUTHORITY_HOST);\n this.configuration.set(\"tenantId\", process.env.REACT_APP_TENANT_ID);\n this.configuration.set(\"clientId\", process.env.REACT_APP_CLIENT_ID);\n this.configuration.set(\"initiateLoginEndpoint\", process.env.REACT_APP_START_LOGIN_PAGE_URL);\n this.configuration.set(\"applicationIdUri\", process.env.M365_APPLICATION_ID_URI);\n this.configuration.set(\"apiEndpoint\", process.env.REACT_APP_FUNC_ENDPOINT);\n this.configuration.set(\"apiName\", process.env.REACT_APP_FUNC_NAME);\n } catch (_) {\n internalLogger.warn(\n \"Cannot read process.env, please use webpack if you want to use environment variables.\"\n );\n return;\n }\n }\n }\n\n getIdentityType(): IdentityType {\n return this.identityType;\n }\n\n public getCredential(): TokenCredential {\n if (!this.teamsUserCredential) {\n this.teamsUserCredential = new TeamsUserCredential(Object.fromEntries(this.configuration));\n }\n return this.teamsUserCredential;\n }\n\n public async getUserInfo(resources?: string[]): Promise<UserInfo> {\n return await (this.getCredential() as TeamsUserCredential).getUserInfo(resources);\n }\n\n public async login(scopes: string | string[], resources?: string[]): Promise<void> {\n await (this.getCredential() as TeamsUserCredential).login(scopes, resources);\n }\n\n public setSsoToken(ssoToken: string): TeamsFx {\n return this;\n }\n\n public getConfig(key: string): string {\n const value = this.configuration.get(key);\n if (!value) {\n throw new Error();\n }\n return value;\n }\n\n public hasConfig(key: string): boolean {\n const value = this.configuration.get(key);\n return !!value;\n }\n\n public getConfigs(): Record<string, string> {\n const config: Record<string, string> = {};\n for (const key of this.configuration.keys()) {\n const value = this.configuration.get(key);\n if (value) {\n config[key] = value;\n }\n }\n return config;\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n BotFrameworkAdapter,\n ConversationState,\n ConversationReference,\n UserState,\n Activity,\n TurnContext,\n InvokeResponse,\n Storage,\n SigninStateVerificationQuery,\n} from \"botbuilder\";\nimport { TeamsBotSsoPromptTokenResponse } from \"../bot/teamsBotSsoPromptTokenResponse\";\nimport {\n AuthenticationConfiguration,\n OnBehalfOfCredentialAuthConfig,\n} from \"../models/configuration\";\n\n/**\n * The response of a message action, e.g., `sendMessage`, `sendAdaptiveCard`.\n */\nexport interface MessageResponse {\n /**\n * Id of the message.\n */\n id?: string;\n}\n\n/**\n * The target type where the notification will be sent to.\n *\n * @remarks\n * - \"Channel\" means to a team channel. (By default, notification to a team will be sent to its \"General\" channel.)\n * - \"Group\" means to a group chat.\n * - \"Person\" means to a personal chat.\n */\nexport enum NotificationTargetType {\n /**\n * The notification will be sent to a team channel.\n * (By default, notification to a team will be sent to its \"General\" channel.)\n */\n Channel = \"Channel\",\n /**\n * The notification will be sent to a group chat.\n */\n Group = \"Group\",\n /**\n * The notification will be sent to a personal chat.\n */\n Person = \"Person\",\n}\n\n/**\n * Represent a notification target.\n */\nexport interface NotificationTarget {\n /**\n * The type of target, could be \"Channel\" or \"Group\" or \"Person\".\n */\n readonly type?: NotificationTargetType;\n\n /**\n * Send a plain text message.\n *\n * @param text - the plain text message.\n * @param onError - an optional error handler that can catch exceptions during message sending.\n * If not defined, error will be handled by `BotAdapter.onTurnError`.\n *\n * @returns the response of sending message.\n */\n sendMessage(\n text: string,\n onError?: (context: TurnContext, error: Error) => Promise<void>\n ): Promise<MessageResponse>;\n\n /**\n * Send an adaptive card message.\n *\n * @param card - the adaptive card raw JSON.\n * @param onError - an optional error handler that can catch exceptions during adaptive card sending.\n * If not defined, error will be handled by `BotAdapter.onTurnError`.\n *\n * @returns the response of sending adaptive card message.\n */\n sendAdaptiveCard(\n card: unknown,\n onError?: (context: TurnContext, error: Error) => Promise<void>\n ): Promise<MessageResponse>;\n}\n\n/**\n * Interface for a storage provider that stores and retrieves notification target references.\n *\n * @deprecated Use ConversationReferenceStore to customize the way\n * to persist bot notification connections instead.\n */\nexport interface NotificationTargetStorage {\n /**\n * Read one notification target by its key.\n *\n * @param key - the key of a notification target.\n *\n * @returns - the notification target. Or undefined if not found.\n */\n read(key: string): Promise<{ [key: string]: unknown } | undefined>;\n\n /**\n * List all stored notification targets.\n *\n * @returns - an array of notification target. Or an empty array if nothing is stored.\n */\n list(): Promise<{ [key: string]: unknown }[]>;\n\n /**\n * Write one notification target by its key.\n *\n * @param key - the key of a notification target.\n * @param object - the notification target.\n */\n write(key: string, object: { [key: string]: unknown }): Promise<void>;\n\n /**\n * Delete one notification target by its key.\n *\n * @param key - the key of a notification target.\n */\n delete(key: string): Promise<void>;\n}\n\n/**\n * Options to initialize {@link NotificationBot}.\n * @deprecated Please use BotBuilderCloudAdapter.NotificationOptions instead.\n */\nexport interface NotificationOptions {\n /**\n * An optional storage to persist bot notification connections.\n *\n * @remarks\n * If `storage` is not provided, a default local file storage will be used,\n * which stores notification connections into:\n * - \".notification.localstore.json\" if running locally\n * - \"${process.env.TEMP}/.notification.localstore.json\" if `process.env.RUNNING_ON_AZURE` is set to \"1\"\n *\n * It's recommended to use your own shared storage for production environment.\n */\n storage?: NotificationTargetStorage;\n}\n\n/**\n * A store to persist notification target references.\n */\nexport interface ConversationReferenceStore {\n /**\n * Add a conversation reference to the store. If overwrite, update existing one, otherwise add when not exist.\n *\n * @param key the key of the conversation reference.\n * @param reference the conversation reference to add.\n * @param options the options to add the conversation reference.\n *\n * @returns true if added or updated, false if not changed.\n */\n add(\n key: string,\n reference: Partial<ConversationReference>,\n options: ConversationReferenceStoreAddOptions\n ): Promise<boolean>;\n\n /**\n * Remove a conversation reference from the store.\n *\n * @param key the key of the conversation reference.\n * @param reference the conversation reference to remove.\n *\n * @returns true if exist and removed, false if not changed.\n */\n remove(key: string, reference: Partial<ConversationReference>): Promise<boolean>;\n\n /**\n * List stored conversation reference by page.\n *\n * @param pageSize the page size.\n * @param continuationToken the continuation token to get next page.\n *\n * @returns a paged list of conversation references.\n */\n list(\n pageSize?: number,\n continuationToken?: string\n ): Promise<PagedData<Partial<ConversationReference>>>;\n}\n\n/**\n * Options to add a conversation reference to the store.\n */\nexport interface ConversationReferenceStoreAddOptions {\n /**\n * Whether to overwrite the existing conversation reference.\n */\n overwrite?: boolean;\n}\n\n/**\n * Represents a page of data.\n */\nexport interface PagedData<T> {\n /**\n * Page of data.\n */\n data: T[];\n\n /**\n * The Continuation Token to pass to get the next page of results.\n *\n * @remarks\n * Undefined or empty token means the page reaches the end.\n */\n continuationToken?: string;\n}\n\n/**\n * The trigger pattern used to trigger a {@link TeamsFxBotCommandHandler} instance.\n */\nexport type TriggerPatterns = string | RegExp | (string | RegExp)[];\n\n/**\n * Interface for a command message that can handled in a command handler.\n */\nexport interface CommandMessage {\n /**\n * Text of the message sent by the user.\n */\n text: string;\n\n /**\n * The capture groups that matched to the {@link TriggerPatterns} in a {@link TeamsFxBotCommandHandler} instance.\n */\n matches?: RegExpMatchArray;\n}\n\n/**\n * Interface for a command handler that can process command to a TeamsFx bot and return a response.\n */\nexport interface TeamsFxBotCommandHandler {\n /**\n * The string or regular expression patterns that can trigger this handler.\n */\n triggerPatterns: TriggerPatterns;\n\n /**\n * Handles a bot command received activity.\n *\n * @param context The bot context.\n * @param message The command message the user types from Teams.\n * @returns A `Promise` representing an activity or text to send as the command response.\n * Or no return value if developers want to send the response activity by themselves in this method.\n */\n handleCommandReceived(\n context: TurnContext,\n message: CommandMessage\n ): Promise<string | Partial<Activity> | void>;\n}\n\n/**\n * Interface for a command handler that can process sso command to a TeamsFx bot and return a response.\n */\nexport interface TeamsFxBotSsoCommandHandler {\n /**\n * The string or regular expression patterns that can trigger this handler.\n */\n triggerPatterns: TriggerPatterns;\n\n /**\n * Handles a bot command received activity.\n *\n * @param context The bot context.\n * @param message The command message the user types from Teams.\n * @param tokenResponse The tokenResponse which contains sso token that can be used to exchange access token for the bot.\n * @returns A `Promise` representing an activity or text to send as the command response.\n * Or no return value if developers want to send the response activity by themselves in this method.\n */\n handleCommandReceived(\n context: TurnContext,\n message: CommandMessage,\n tokenResponse: TeamsBotSsoPromptTokenResponse\n ): Promise<string | Partial<Activity> | void>;\n}\n\n/**\n * Options to initialize {@link CommandBot}.\n */\nexport interface CommandOptions {\n /**\n * 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.\n */\n commands?: TeamsFxBotCommandHandler[];\n\n /**\n * The commands to registered with the sso command bot. Each sso command should implement the interface {@link TeamsFxBotSsoCommandHandler} so that it can be correctly handled by this command bot.\n */\n ssoCommands?: TeamsFxBotSsoCommandHandler[];\n}\n\n/**\n * Options to initialize {@link CardActionBot}.\n */\nexport interface CardActionOptions {\n /**\n * The action handlers to registered with the action bot. Each command should implement the interface {@link TeamsFxAdaptiveCardActionHandler} so that it can be correctly handled by this bot.\n */\n actions?: TeamsFxAdaptiveCardActionHandler[];\n}\n\n/**\n * Options used to control how the response card will be sent to users.\n */\nexport enum AdaptiveCardResponse {\n /**\n * The response card will be replaced the current one for the interactor who trigger the action.\n */\n ReplaceForInteractor,\n\n /**\n * The response card will be replaced the current one for all users in the chat.\n */\n ReplaceForAll,\n\n /**\n * The response card will be sent as a new message for all users in the chat.\n */\n NewForAll,\n}\n\n/**\n * Status code for an `application/vnd.microsoft.error` invoke response.\n */\nexport enum InvokeResponseErrorCode {\n /**\n * Invalid request.\n */\n BadRequest = 400,\n\n /**\n * Internal server error.\n */\n InternalServerError = 500,\n}\n\n/**\n * Interface for adaptive card action handler that can process card action invoke and return a response.\n */\nexport interface TeamsFxAdaptiveCardActionHandler {\n /**\n * The verb defined in adaptive card action that can trigger this handler.\n * The verb string here is case-insensitive.\n */\n triggerVerb: string;\n\n /**\n * Specify the behavior for how the card response will be sent in Teams conversation.\n * The default value is `AdaptiveCardResponse.ReplaceForInteractor`, which means the card\n * response will replace the current one only for the interactor.\n */\n adaptiveCardResponse?: AdaptiveCardResponse;\n\n /**\n * The handler function that will be invoked when the action is fired.\n * @param context The turn context.\n * @param actionData The contextual data that associated with the action.\n * \n * @returns A `Promise` representing a invoke response for the adaptive card invoke action.\n * You can use the `InvokeResponseFactory` utility class to create an invoke response from\n * - A text message: \n * ```typescript \n * return InvokeResponseFactory.textMessage(\"Action is processed successfully!\");\n * ```\n * - An adaptive card:\n * ```typescript\n * const responseCard = AdaptiveCards.declare(helloWorldCard).render(actionData);\n return InvokeResponseFactory.adaptiveCard(responseCard);\n * ```\n * - An error response:\n * ```typescript\n * return InvokeResponseFactory.errorResponse(InvokeResponseErrorCode.BadRequest, \"Invalid request\");\n * ```\n * \n * @remarks For more details about the invoke response format, refer to https://docs.microsoft.com/en-us/adaptive-cards/authoring-cards/universal-action-model#response-format.\n */\n handleActionInvoked(context: TurnContext, actionData: any): Promise<InvokeResponse>;\n}\n\n/**\n * Interface for SSO configuration for Bot SSO\n */\nexport interface BotSsoConfig {\n /**\n * aad related configurations\n */\n aad: {\n /**\n * The list of scopes for which the token will have access\n */\n scopes: string[];\n } & (\n | (OnBehalfOfCredentialAuthConfig & { initiateLoginEndpoint: string })\n | AuthenticationConfiguration\n );\n\n dialog?: {\n /**\n * Custom sso execution activity handler class which should implement the interface {@link BotSsoExecutionActivityHandler}. If not provided, it will use {@link DefaultBotSsoExecutionActivityHandler} by default\n */\n CustomBotSsoExecutionActivityHandler?: new (\n ssoConfig: BotSsoConfig\n ) => BotSsoExecutionActivityHandler;\n\n /**\n * Conversation state for sso command bot, if not provided, it will use internal memory storage to create a new one.\n */\n conversationState?: ConversationState;\n\n /**\n * User state for sso command bot, if not provided, it will use internal memory storage to create a new one.\n */\n userState?: UserState;\n\n /**\n * Used by {@link BotSsoExecutionDialog} to remove duplicated messages, if not provided, it will use internal memory storage\n */\n dedupStorage?: Storage;\n\n /**\n * Settings used to configure an teams sso prompt dialog.\n */\n ssoPromptConfig?: {\n /**\n * Number of milliseconds the prompt will wait for the user to authenticate.\n * Defaults to a value `900,000` (15 minutes.)\n */\n timeout?: number;\n\n /**\n * Value indicating whether the TeamsBotSsoPrompt should end upon receiving an\n * invalid message. Generally the TeamsBotSsoPrompt will end the auth flow when receives user\n * message not related to the auth flow. Setting the flag to false ignores the user's message instead.\n * Defaults to value `true`\n */\n endOnInvalidMessage?: boolean;\n };\n };\n}\n\n/**\n * Options to initialize {@link ConversationBot}\n * @deprecated Please use BotBuilderCloudAdapter.ConversationOptions instead.\n */\nexport interface ConversationOptions {\n /**\n * The bot adapter. If not provided, a default adapter will be created:\n * - with `adapterConfig` as constructor parameter.\n * - with a default error handler that logs error to console, sends trace activity, and sends error message to user.\n *\n * @remarks\n * If neither `adapter` nor `adapterConfig` is provided, will use BOT_ID and BOT_PASSWORD from environment variables.\n */\n adapter?: BotFrameworkAdapter;\n\n /**\n * If `adapter` is not provided, this `adapterConfig` will be passed to the new `BotFrameworkAdapter` when created internally.\n *\n * @remarks\n * If neither `adapter` nor `adapterConfig` is provided, will use BOT_ID and BOT_PASSWORD from environment variables.\n */\n adapterConfig?: { [key: string]: unknown };\n\n /**\n * Configurations for sso command bot\n */\n ssoConfig?: BotSsoConfig;\n\n /**\n * The command part.\n */\n command?: CommandOptions & {\n /**\n * Whether to enable command or not.\n */\n enabled?: boolean;\n };\n\n /**\n * The notification part.\n */\n notification?: NotificationOptions & {\n /**\n * Whether to enable notification or not.\n */\n enabled?: boolean;\n };\n\n /**\n * The adaptive card action handler part.\n */\n cardAction?: CardActionOptions & {\n /**\n * Whether to enable adaptive card actions or not.\n */\n enabled?: boolean;\n };\n}\n\n/**\n * Interface for user to customize SSO execution activity handler\n *\n * @remarks\n * Bot SSO execution activity handler is to handle SSO login process and trigger SSO command using {@link BotSsoExecutionDialog}.\n * You can use this interface to implement your own SSO execution dialog, and pass it to ConversationBot options:\n *\n * ```typescript\n * export const commandBot = new ConversationBot({\n * ...\n * ssoConfig: {\n * ...\n * dialog: {\n * CustomBotSsoExecutionActivityHandler: YourCustomBotSsoExecutionActivityHandler,\n * }\n * },\n * ...\n * });\n * ```\n * For details information about how to implement a BotSsoExecutionActivityHandler, please refer DefaultBotSsoExecutionActivityHandler class source code: https://aka.ms/teamsfx-default-sso-execution-activity-handler\n */\nexport interface BotSsoExecutionActivityHandler {\n /**\n * Add {@link TeamsFxBotSsoCommandHandler} instance to {@link BotSsoExecutionDialog}\n * @param handler {@link BotSsoExecutionDialogHandler} callback function\n * @param triggerPatterns The trigger pattern\n *\n * @remarks\n * This function is used to add SSO command to {@link BotSsoExecutionDialog} instance.\n */\n addCommand(handler: BotSsoExecutionDialogHandler, triggerPatterns: TriggerPatterns): void;\n\n /**\n * Called to initiate the event emission process.\n * @param context The context object for the current turn.\n */\n run(context: TurnContext): Promise<void>;\n\n /**\n * Receives invoke activities with Activity name of 'signin/verifyState'.\n * @param context A context object for this turn.\n * @param query Signin state (part of signin action auth flow) verification invoke query.\n * @returns A promise that represents the work queued.\n *\n * @remarks\n * It should trigger {@link BotSsoExecutionDialog} instance to handle signin process\n */\n handleTeamsSigninVerifyState(\n context: TurnContext,\n query: SigninStateVerificationQuery\n ): Promise<void>;\n\n /**\n * Receives invoke activities with Activity name of 'signin/tokenExchange'\n * @param context A context object for this turn.\n * @param query Signin state (part of signin action auth flow) verification invoke query\n * @returns A promise that represents the work queued.\n *\n * @remarks\n * It should trigger {@link BotSsoExecutionDialog} instance to handle signin process\n */\n handleTeamsSigninTokenExchange(\n context: TurnContext,\n query: SigninStateVerificationQuery\n ): Promise<void>;\n}\n\nexport type BotSsoExecutionDialogHandler = (\n context: TurnContext,\n tokenResponse: TeamsBotSsoPromptTokenResponse,\n message: CommandMessage\n) => Promise<void>;\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { BotFrameworkAdapter, TurnContext, WebRequest, WebResponse } from \"botbuilder\";\nimport { CommandBot } from \"./command.browser\";\nimport { ConversationOptions } from \"./interface\";\nimport { NotificationBot } from \"./notification.browser\";\nimport { ErrorWithCode, ErrorCode, ErrorMessage } from \"../core/errors\";\nimport { formatString } from \"../util/utils\";\n\n/**\n * Provide utilities for bot conversation, including:\n * - handle command and response.\n * - send notification to varies targets (e.g., member, group, channel).\n *\n * @remarks\n * Only work on server side.\n */\n\n/**\n * @deprecated Use `BotBuilderCloudAdapter.ConversationBot` instead.\n */\nexport class ConversationBot {\n /**\n * The bot adapter.\n *\n * @remarks\n * Only work on server side.\n */\n public readonly adapter: BotFrameworkAdapter;\n\n /**\n * The entrypoint of command and response.\n *\n * @remarks\n * Only work on server side.\n */\n public readonly command?: CommandBot;\n\n /**\n * The entrypoint of notification.\n *\n * @remarks\n * Only work on server side.\n */\n public readonly notification?: NotificationBot;\n\n /**\n * Creates new instance of the `ConversationBot`.\n *\n * @param options - initialize options\n *\n * @remarks\n * Only work on server side.\n */\n public constructor(options: ConversationOptions) {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"ConversationBot\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * The request handler to integrate with web request.\n *\n * @param req - an Express or Restify style request object.\n * @param res - an Express or Restify style response object.\n * @param logic - the additional function to handle bot context.\n *\n * @remarks\n * Only work on server side.\n */\n public requestHandler(\n req: WebRequest,\n res: WebResponse,\n logic?: (context: TurnContext) => Promise<any>\n ): Promise<void> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"ConversationBot\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { formatString } from \"../../util/utils\";\nimport { ErrorWithCode, ErrorCode, ErrorMessage } from \"../../core/errors\";\nimport { TeamsFx } from \"../../core/teamsfx.browser\";\nimport { BotSsoExecutionDialogHandler, TriggerPatterns } from \"../interface\";\nimport { StatePropertyAccessor, TurnContext, Storage } from \"botbuilder\";\nimport { OnBehalfOfCredentialAuthConfig } from \"../../models/configuration\";\nimport { TeamsBotSsoPromptSettings } from \"../../index.browser\";\n/*\n * Sso execution dialog, use to handle sso command\n */\nexport class BotSsoExecutionDialog {\n /**\n * Constructor of BotSsoExecutionDialog\n *\n * @remarks\n * Can Only works in in server side.\n */\n constructor(\n dedupStorage: Storage,\n ssoPromptSettings: TeamsBotSsoPromptSettings,\n teamsfx: TeamsFx,\n dialogName?: string\n );\n constructor(\n dedupStorage: Storage,\n ssoPromptSettings: TeamsBotSsoPromptSettings,\n authConfig: OnBehalfOfCredentialAuthConfig,\n initiateLoginEndpoint: string,\n dialogName?: string\n );\n constructor(\n dedupStorage: Storage,\n ssoPromptSettings: TeamsBotSsoPromptSettings,\n authConfig: TeamsFx | OnBehalfOfCredentialAuthConfig,\n ...args: any\n ) {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"BotSsoExecutionDialog\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Add TeamsFxBotSsoCommandHandler instance\n * @param handler {@link BotSsoExecutionDialogHandler} callback function\n * @param triggerPatterns The trigger pattern\n */\n public addCommand(handler: BotSsoExecutionDialogHandler, triggerPatterns: TriggerPatterns): void {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"BotSsoExecutionDialog\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * The run method handles the incoming activity (in the form of a DialogContext) and passes it through the dialog system.\n *\n * @param context The context object for the current turn.\n * @param accessor The instance of StatePropertyAccessor for dialog system.\n */\n public async run(context: TurnContext, accessor: StatePropertyAccessor) {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"BotSsoExecutionDialog\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Called when the component is ending.\n *\n * @param context Context for the current turn of conversation.\n */\n protected async onEndDialog(context: TurnContext) {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"BotSsoExecutionDialog\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n BotFrameworkAdapter,\n ChannelInfo,\n ConversationReference,\n TeamDetails,\n TeamsChannelAccount,\n TurnContext,\n} from \"botbuilder\";\nimport { ErrorWithCode, ErrorCode, ErrorMessage } from \"../core/errors\";\nimport { formatString } from \"../util/utils\";\nimport { MessageResponse, NotificationTarget, NotificationTargetType } from \"./interface\";\nimport { DefaultConversationReferenceStore } from \"./storage\";\n\n/**\n * Send a plain text message to a notification target.\n *\n * @remarks\n * Only work on server side.\n *\n * @param target - the notification target.\n * @param text - the plain text message.\n * @param onError - an optional error handler that can catch exceptions during message sending.\n * @returns A `Promise` representing the asynchronous operation.\n */\nexport function sendMessage(\n target: NotificationTarget,\n text: string,\n onError?: (context: TurnContext, error: Error) => Promise<void>\n): Promise<void> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"sendMessage\"),\n ErrorCode.RuntimeNotSupported\n );\n}\n\n/**\n * Send an adaptive card message to a notification target.\n *\n * @remarks\n * Only work on server side.\n *\n * @param target - the notification target.\n * @param card - the adaptive card raw JSON.\n * @param onError - an optional error handler that can catch exceptions during adaptive card sending.\n * @returns A `Promise` representing the asynchronous operation.\n */\nexport function sendAdaptiveCard(\n target: NotificationTarget,\n card: unknown,\n onError?: (context: TurnContext, error: Error) => Promise<void>\n): Promise<void> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"sendAdaptiveCard\"),\n ErrorCode.RuntimeNotSupported\n );\n}\n\n/**\n * A {@link NotificationTarget} that represents a team channel.\n *\n * @remarks\n * Only work on server side.\n *\n * It's recommended to get channels from {@link TeamsBotInstallation.channels()}.\n */\nexport class Channel implements NotificationTarget {\n /**\n * The parent {@link TeamsBotInstallation} where this channel is created from.\n *\n * @remarks\n * Only work on server side.\n */\n public readonly parent: TeamsBotInstallation;\n\n /**\n * Detailed channel information.\n *\n * @remarks\n * Only work on server side.\n */\n public readonly info: ChannelInfo;\n\n /**\n * Notification target type. For channel it's always \"Channel\".\n *\n * @remarks\n * Only work on server side.\n */\n public readonly type: NotificationTargetType = NotificationTargetType.Channel;\n\n /**\n * Constructor.\n *\n * @remarks\n * Only work on server side.\n *\n * It's recommended to get channels from {@link TeamsBotInstallation.channels()}, instead of using this constructor.\n *\n * @param parent - The parent {@link TeamsBotInstallation} where this channel is created from.\n * @param info - Detailed channel information.\n */\n constructor(parent: TeamsBotInstallation, info: ChannelInfo) {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"Channel\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Send a plain text message.\n *\n * @remarks\n * Only work on server side.\n *\n * @param text - the plain text message.\n * @param onError - an optional error handler that can catch exceptions during message sending.\n * @returns the response of sending message.\n */\n public sendMessage(\n text: string,\n onError?: (context: TurnContext, error: Error) => Promise<void>\n ): Promise<MessageResponse> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"Channel\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Send an adaptive card message.\n *\n * @remarks\n * Only work on server side.\n *\n * @param card - the adaptive card raw JSON.\n * @param onError - an optional error handler that can catch exceptions during adaptive card sending.\n * @returns the response of sending adaptive card message.\n */\n public sendAdaptiveCard(\n card: unknown,\n onError?: (context: TurnContext, error: Error) => Promise<void>\n ): Promise<MessageResponse> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"Channel\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n}\n\n/**\n * A {@link NotificationTarget} that represents a team member.\n *\n * @remarks\n * Only work on server side.\n *\n * It's recommended to get members from {@link TeamsBotInstallation.members()}.\n */\nexport class Member implements NotificationTarget {\n /**\n * The parent {@link TeamsBotInstallation} where this member is created from.\n *\n * @remarks\n * Only work on server side.\n */\n public readonly parent: TeamsBotInstallation;\n\n /**\n * Detailed member account information.\n *\n * @remarks\n * Only work on server side.\n */\n public readonly account: TeamsChannelAccount;\n\n /**\n * Notification target type. For member it's always \"Person\".\n *\n * @remarks\n * Only work on server side.\n */\n public readonly type: NotificationTargetType = NotificationTargetType.Person;\n\n /**\n * Constructor.\n *\n * @remarks\n * Only work on server side.\n *\n * It's recommended to get members from {@link TeamsBotInstallation.members()}, instead of using this constructor.\n *\n * @param parent - The parent {@link TeamsBotInstallation} where this member is created from.\n * @param account - Detailed member account information.\n */\n constructor(parent: TeamsBotInstallation, account: TeamsChannelAccount) {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"Member\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Send a plain text message.\n *\n * @remarks\n * Only work on server side.\n *\n * @param text - the plain text message.\n * @param onError - an optional error handler that can catch exceptions during message sending.\n * @returns the response of sending message.\n */\n public sendMessage(\n text: string,\n onError?: (context: TurnContext, error: Error) => Promise<void>\n ): Promise<MessageResponse> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"Member\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Send an adaptive card message.\n *\n * @remarks\n * Only work on server side.\n *\n * @param card - the adaptive card raw JSON.\n * @param onError - an optional error handler that can catch exceptions during adaptive card sending.\n * @returns the response of sending adaptive card message.\n */\n public sendAdaptiveCard(\n card: unknown,\n onError?: (context: TurnContext, error: Error) => Promise<void>\n ): Promise<MessageResponse> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"Member\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n}\n\n/**\n * A {@link NotificationTarget} that represents a bot installation. Teams Bot could be installed into\n * - Personal chat\n * - Group chat\n * - Team (by default the `General` channel)\n *\n * @remarks\n * Only work on server side.\n *\n * It's recommended to get bot installations from {@link ConversationBot.installations()}.\n */\n\n/**\n * @deprecated Use `BotBuilderCloudAdapter.TeamsBotInstallation` instead.\n */\nexport class TeamsBotInstallation implements NotificationTarget {\n /**\n * The bound `BotFrameworkAdapter`.\n *\n * @remarks\n * Only work on server side.\n */\n public readonly adapter: BotFrameworkAdapter;\n\n /**\n * The bound `ConversationReference`.\n *\n * @remarks\n * Only work on server side.\n */\n public readonly conversationReference: Partial<ConversationReference>;\n\n /**\n * Notification target type.\n *\n * @remarks\n * Only work on server side.\n * - \"Channel\" means bot is installed into a team and notification will be sent to its \"General\" channel.\n * - \"Group\" means bot is installed into a group chat.\n * - \"Person\" means bot is installed into a personal scope and notification will be sent to personal chat.\n */\n public readonly type?: NotificationTargetType;\n\n /**\n * Constructor\n *\n * @remarks\n * Only work on server side.\n *\n * It's recommended to get bot installations from {@link ConversationBot.installations()}, instead of using this constructor.\n *\n * @param adapter - the bound `BotFrameworkAdapter`.\n * @param conversationReference - the bound `ConversationReference`.\n */\n constructor(adapter: BotFrameworkAdapter, conversationReference: Partial<ConversationReference>) {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"TeamsBotInstallation\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Send a plain text message.\n *\n * @remarks\n * Only work on server side.\n *\n * @param text - the plain text message.\n * @param onError - an optional error handler that can catch exceptions during message sending.\n * @returns the response of sending message.\n */\n public sendMessage(\n text: string,\n onError?: (context: TurnContext, error: Error) => Promise<void>\n ): Promise<MessageResponse> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"TeamsBotInstallation\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Send an adaptive card message.\n *\n * @remarks\n * Only work on server side.\n *\n * @param card - the adaptive card raw JSON.\n * @param onError - an optional error handler that can catch exceptions during adaptive card sending.\n * @returns the response of sending adaptive card message.\n */\n public sendAdaptiveCard(\n card: unknown,\n onError?: (context: TurnContext, error: Error) => Promise<void>\n ): Promise<MessageResponse> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"TeamsBotInstallation\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Get channels from this bot installation.\n *\n * @remarks\n * Only work on server side.\n *\n * @returns an array of channels if bot is installed into a team, otherwise returns an empty array.\n */\n public channels(): Promise<Channel[]> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"TeamsBotInstallation\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Get members from this bot installation.\n *\n * @remarks\n * Only work on server side.\n *\n * @returns an array of members from where the bot is installed.\n */\n public members(): Promise<Member[]> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"TeamsBotInstallation\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Get team details from this bot installation\n *\n * @returns the team details if bot is installed into a team, otherwise returns undefined.\n */\n public getTeamDetails(): Promise<TeamDetails | undefined> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"TeamsBotInstallation\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n}\n\n/**\n * Provide static utilities for bot notification.\n *\n * @remarks\n * Only work on server side.\n *\n * @example\n * Here's an example on how to send notification via Teams Bot.\n * ```typescript\n * // initialize (it's recommended to be called before handling any bot message)\n * const notificationBot = new NotificationBot(adapter);\n *\n * // get all bot installations and send message\n * for (const target of await notificationBot.installations()) {\n * await target.sendMessage(\"Hello Notification\");\n * }\n *\n * // alternative - send message to all members\n * for (const target of await notificationBot.installations()) {\n * for (const member of await target.members()) {\n * await member.sendMessage(\"Hello Notification\");\n * }\n * }\n * ```\n */\n\n/**\n * @deprecated Use `BotBuilderCloudAdapter.NotificationBot` instead.\n */\nexport class NotificationBot {\n private readonly conversationReferenceStore: DefaultConversationReferenceStore;\n private readonly adapter: BotFrameworkAdapter;\n\n /**\n * constructor of the notification bot.\n *\n * @remarks\n * Only work on server side.\n *\n * To ensure accuracy, it's recommended to initialize before handling any message.\n *\n * @param adapter - the bound `BotFrameworkAdapter`\n * @param options - initialize options\n */\n public constructor(adapter: BotFrameworkAdapter, options?: NotificationOptions) {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"NotificationBot\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Get all targets where the bot is installed.\n *\n * @remarks\n * Only work on server side.\n *\n * The result is retrieving from the persisted storage.\n *\n * @returns - an array of {@link TeamsBotInstallation}.\n */\n public static installations(): Promise<TeamsBotInstallation[]> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"NotificationBot\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Returns the first {@link Member} where predicate is true, and undefined otherwise.\n *\n * @remarks\n * Only work on server side.\n *\n * @param predicate find calls predicate once for each member of the installation,\n * until it finds one where predicate returns true. If such a member is found, find\n * immediately returns that member. Otherwise, find returns undefined.\n * @param scope the scope to find members from the installations\n * (personal chat, group chat, Teams channel).\n * @returns the first {@link Member} where predicate is true, and undefined otherwise.\n */\n public findMember(\n predicate: (member: Member) => Promise<boolean>,\n scope?: SearchScope\n ): Promise<Member | undefined> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"NotificationBot\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Returns the first {@link Channel} where predicate is true, and undefined otherwise.\n * (Ensure the bot app is installed into the `General` channel, otherwise undefined will be returned.)\n *\n * @remarks\n * Only work on server side.\n *\n * @param predicate find calls predicate once for each channel of the installation,\n * until it finds one where predicate returns true. If such a channel is found, find\n * immediately returns that channel. Otherwise, find returns undefined.\n * @returns the first {@link Channel} where predicate is true, and undefined otherwise.\n */\n public findChannel(\n predicate: (channel: Channel, teamDetails: TeamDetails | undefined) => Promise<boolean>\n ): Promise<Channel | undefined> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"NotificationBot\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Returns all {@link Member} where predicate is true, and empty array otherwise.\n *\n * @remarks\n * Only work on server side.\n *\n * @param predicate find calls predicate for each member of the installation.\n * @param scope the scope to find members from the installations\n * (personal chat, group chat, Teams channel).\n * @returns an array of {@link Member} where predicate is true, and empty array otherwise.\n */\n public findAllMembers(\n predicate: (member: Member) => Promise<boolean>,\n scope?: SearchScope\n ): Promise<Member[]> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"NotificationBot\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Returns all {@link Channel} where predicate is true, and empty array otherwise.\n * (Ensure the bot app is installed into the `General` channel, otherwise empty array will be returned.)\n *\n * @remarks\n * Only work on server side.\n *\n * @param predicate find calls predicate for each channel of the installation.\n * @returns an array of {@link Channel} where predicate is true, and empty array otherwise.\n */\n public findAllChannels(\n predicate: (channel: Channel, teamDetails: TeamDetails | undefined) => Promise<boolean>\n ): Promise<Channel[]> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"NotificationBot\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n}\n\n/**\n * The search scope when calling {@link NotificationBot.findMember} and {@link NotificationBot.findAllMembers}.\n * The search scope is a flagged enum and it can be combined with `|`.\n * For example, to search from personal chat and group chat, use `SearchScope.Person | SearchScope.Group`.\n */\nexport enum SearchScope {\n /**\n * Search members from the installations in personal chat only.\n */\n Person = 1,\n\n /**\n * Search members from the installations in group chat only.\n */\n Group = 2,\n\n /**\n * Search members from the installations in Teams channel only.\n */\n Channel = 4,\n\n /**\n * Search members from all installations including personal chat, group chat and Teams channel.\n */\n All = Person | Group | Channel,\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { BotFrameworkAdapter } from \"botbuilder\";\nimport { ErrorWithCode, ErrorCode, ErrorMessage } from \"../core/errors\";\nimport { formatString } from \"../util/utils\";\nimport { TeamsFxBotCommandHandler, TeamsFxBotSsoCommandHandler } from \"./interface\";\nimport { CommandResponseMiddleware } from \"./middlewares/commandMiddleware\";\n\n/**\n * A command bot for receiving commands and sending responses in Teams.\n *\n * @remarks\n * Only work on server side.\n */\n\n/**\n * @deprecated Use `BotBuilderCloudAdapter.CommandBot` instead.\n */\nexport class CommandBot {\n private readonly adapter: BotFrameworkAdapter;\n private readonly middleware: CommandResponseMiddleware;\n\n /**\n * Creates a new instance of the `CommandBot`.\n *\n * @param adapter The bound `BotFrameworkAdapter`.\n * @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.\n */\n constructor(adapter: BotFrameworkAdapter, commands?: TeamsFxBotCommandHandler[]) {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"CommandBot\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Registers a command into the command bot.\n *\n * @param command The command to registered.\n *\n * @remarks\n * Only work on server side.\n */\n public registerCommand(command: TeamsFxBotCommandHandler): void {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"CommandBot\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Registers commands into the command bot.\n *\n * @param commands The command to registered.\n *\n * @remarks\n * Only work on server side.\n */\n public registerCommands(commands: TeamsFxBotCommandHandler[]): void {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"CommandBot\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Registers a sso command into the command bot.\n *\n * @param command The command to register.\n */\n public registerSsoCommand(ssoCommand: TeamsFxBotSsoCommandHandler): void {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"CommandBot\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Registers commands into the command bot.\n *\n * @param commands The commands to register.\n */\n public registerSsoCommands(ssoCommands: TeamsFxBotSsoCommandHandler[]): void {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"CommandBot\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n}\n","import { BotFrameworkAdapter } from \"botbuilder\";\nimport { CardActionMiddleware } from \"./middlewares/cardActionMiddleware\";\nimport { CardActionOptions, TeamsFxAdaptiveCardActionHandler } from \"./interface\";\nimport { ErrorWithCode, ErrorCode, ErrorMessage } from \"../core/errors\";\nimport { formatString } from \"../util/utils\";\n\n/**\n * A card action bot to respond to adaptive card universal actions.\n *\n * @remarks\n * Only work on server side.\n */\n\n/**\n * @deprecated Use `BotBuilderCloudAdapter.CardActionBot` instead.\n */\nexport class CardActionBot {\n private readonly adapter: BotFrameworkAdapter;\n private middleware: CardActionMiddleware;\n\n /**\n * Creates a new instance of the `CardActionBot`.\n *\n * @param adapter The bound `BotFrameworkAdapter`.\n * @param options - initialize options\n */\n constructor(adapter: BotFrameworkAdapter, options?: CardActionOptions) {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"CardActionBot\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Registers a card action handler to the bot.\n * @param actionHandler A card action handler to be registered.\n *\n * @remarks\n * Only work on server side.\n */\n registerHandler(actionHandler: TeamsFxAdaptiveCardActionHandler) {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"CardActionBot\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Registers card action handlers to the bot.\n * @param actionHandlers A set of card action handlers to be registered.\n *\n * @remarks\n * Only work on server side.\n */\n registerHandlers(actionHandlers: TeamsFxAdaptiveCardActionHandler[]) {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"CardActionBot\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\nimport { TurnContext, MessagingExtensionResponse } from \"botbuilder\";\nimport {\n AuthenticationConfiguration,\n OnBehalfOfCredentialAuthConfig,\n} from \"../models/configuration\";\nimport { MessageExtensionTokenResponse } from \"./teamsMsgExtTokenResponse\";\nimport { ErrorWithCode, ErrorMessage, ErrorCode } from \"../core/errors\";\nimport { formatString } from \"../util/utils\";\n\n// eslint-disable-next-line no-secrets/no-secrets\n/**\n * Users execute query with SSO or Access Token.\n * @deprecated\n * @remarks\n * Only works in in server side.\n */\nexport function handleMessageExtensionQueryWithToken(\n context: TurnContext,\n config: AuthenticationConfiguration,\n scopes: string | string[],\n logic: (token: MessageExtensionTokenResponse) => Promise<any>\n): Promise<MessagingExtensionResponse | void> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"queryWithToken in message extension\"),\n ErrorCode.RuntimeNotSupported\n );\n}\n\n/**\n * Users execute query with SSO or Access Token.\n * @remarks\n * Only works in in server side.\n */\nexport function handleMessageExtensionQueryWithSSO(\n context: TurnContext,\n config: OnBehalfOfCredentialAuthConfig,\n initiateLoginEndpoint: string,\n scopes: string | string[],\n logic: (token: MessageExtensionTokenResponse) => Promise<any>\n) {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"queryWithToken in message extension\"),\n ErrorCode.RuntimeNotSupported\n );\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { CloudAdapter, TurnContext, Request, Response } from \"botbuilder\";\nimport { CommandBot } from \"./command.browser\";\nimport { ConversationOptions } from \"./interface\";\nimport { NotificationBot } from \"./notification.browser\";\nimport { ErrorWithCode, ErrorCode, ErrorMessage } from \"../core/errors\";\nimport { formatString } from \"../util/utils\";\n\n/**\n * Provide utilities for bot conversation, including:\n * - handle command and response.\n * - send notification to varies targets (e.g., member, group, channel).\n *\n * @remarks\n * Only work on server side.\n */\nexport class ConversationBot {\n /**\n * The bot adapter.\n *\n * @remarks\n * Only work on server side.\n */\n public readonly adapter: CloudAdapter;\n\n /**\n * The entrypoint of command and response.\n *\n * @remarks\n * Only work on server side.\n */\n public readonly command?: CommandBot;\n\n /**\n * The entrypoint of notification.\n *\n * @remarks\n * Only work on server side.\n */\n public readonly notification?: NotificationBot;\n\n /**\n * Create new instance of the `ConversationBot`.\n *\n * @param options - The initialize options.\n *\n * @remarks\n * Only work on server side.\n */\n public constructor(options: ConversationOptions) {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"ConversationBot\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * The request handler to integrate with web request.\n *\n * @param req - An incoming HTTP [Request](xref:botbuilder.Request).\n * @param res - The corresponding HTTP [Response](xref:botbuilder.Response).\n * @param logic - The additional function to handle bot context.\n *\n * @remarks\n * Only work on server side.\n */\n public requestHandler(\n req: Request,\n res: Response,\n logic?: (context: TurnContext) => Promise<any>\n ): Promise<void> {\n return Promise.reject(\n new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"ConversationBot\"),\n ErrorCode.RuntimeNotSupported\n )\n );\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n CloudAdapter,\n ChannelInfo,\n ConversationReference,\n TeamDetails,\n TeamsChannelAccount,\n TurnContext,\n} from \"botbuilder\";\nimport { ErrorWithCode, ErrorCode, ErrorMessage } from \"../core/errors\";\nimport { formatString } from \"../util/utils\";\nimport {\n MessageResponse,\n NotificationTarget,\n NotificationTargetType,\n ConversationReferenceStore,\n} from \"../conversation/interface\";\n\n/**\n * Send a plain text message to a notification target.\n *\n * @remarks\n * Only work on server side.\n *\n * @param target - The notification target.\n * @param text - The plain text message.\n * @param onError - An optional error handler that can catch exceptions during message sending.\n *\n * @returns A `Promise` representing the asynchronous operation.\n */\nexport function sendMessage(\n target: NotificationTarget,\n text: string,\n onError?: (context: TurnContext, error: Error) => Promise<void>\n): Promise<void> {\n return Promise.reject(\n new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"sendMessage\"),\n ErrorCode.RuntimeNotSupported\n )\n );\n}\n\n/**\n * Send an adaptive card message to a notification target.\n *\n * @remarks\n * Only work on server side.\n *\n * @param target - The notification target.\n * @param card - The adaptive card raw JSON.\n * @param onError - An optional error handler that can catch exceptions during adaptive card sending.\n *\n * @returns A `Promise` representing the asynchronous operation.\n */\nexport function sendAdaptiveCard(\n target: NotificationTarget,\n card: unknown,\n onError?: (context: TurnContext, error: Error) => Promise<void>\n): Promise<void> {\n return Promise.reject(\n new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"sendAdaptiveCard\"),\n ErrorCode.RuntimeNotSupported\n )\n );\n}\n\n/**\n * A {@link NotificationTarget} that represents a team channel.\n *\n * @remarks\n * Only work on server side.\n *\n * It's recommended to get channels from {@link TeamsBotInstallation.channels()}.\n */\nexport class Channel implements NotificationTarget {\n /**\n * The parent {@link TeamsBotInstallation} where this channel is created from.\n *\n * @remarks\n * Only work on server side.\n */\n public readonly parent: TeamsBotInstallation;\n\n /**\n * Detailed channel information.\n *\n * @remarks\n * Only work on server side.\n */\n public readonly info: ChannelInfo;\n\n /**\n * Notification target type. For channel it's always \"Channel\".\n *\n * @remarks\n * Only work on server side.\n */\n public readonly type: NotificationTargetType = NotificationTargetType.Channel;\n\n /**\n * Constructor.\n *\n * @remarks\n * Only work on server side.\n *\n * It's recommended to get channels from {@link TeamsBotInstallation.channels()}, instead of using this constructor.\n *\n * @param parent - The parent {@link TeamsBotInstallation} where this channel is created from.\n * @param info - Detailed channel information.\n */\n constructor(parent: TeamsBotInstallation, info: ChannelInfo) {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"Channel\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Send a plain text message.\n *\n * @remarks\n * Only work on server side.\n *\n * @param text - The plain text message.\n * @param onError - An optional error handler that can catch exceptions during message sending.\n *\n * @returns The response of sending message.\n */\n public sendMessage(\n text: string,\n onError?: (context: TurnContext, error: Error) => Promise<void>\n ): Promise<MessageResponse> {\n return Promise.reject(\n new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"Channel\"),\n ErrorCode.RuntimeNotSupported\n )\n );\n }\n\n /**\n * Send an adaptive card message.\n *\n * @remarks\n * Only work on server side.\n *\n * @param card - The adaptive card raw JSON.\n * @param onError - An optional error handler that can catch exceptions during adaptive card sending.\n *\n * @returns The response of sending adaptive card message.\n */\n public sendAdaptiveCard(\n card: unknown,\n onError?: (context: TurnContext, error: Error) => Promise<void>\n ): Promise<MessageResponse> {\n return Promise.reject(\n new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"Channel\"),\n ErrorCode.RuntimeNotSupported\n )\n );\n }\n}\n\n/**\n * A {@link NotificationTarget} that represents a team member.\n *\n * @remarks\n * Only work on server side.\n *\n * It's recommended to get members from {@link TeamsBotInstallation.members()}.\n */\nexport class Member implements NotificationTarget {\n /**\n * The parent {@link TeamsBotInstallation} where this member is created from.\n *\n * @remarks\n * Only work on server side.\n */\n public readonly parent: TeamsBotInstallation;\n\n /**\n * Detailed member account information.\n *\n * @remarks\n * Only work on server side.\n */\n public readonly account: TeamsChannelAccount;\n\n /**\n * Notification target type. For member it's always \"Person\".\n *\n * @remarks\n * Only work on server side.\n */\n public readonly type: NotificationTargetType = NotificationTargetType.Person;\n\n /**\n * Constructor.\n *\n * @remarks\n * Only work on server side.\n *\n * It's recommended to get members from {@link TeamsBotInstallation.members()}, instead of using this constructor.\n *\n * @param parent - The parent {@link TeamsBotInstallation} where this member is created from.\n * @param account - Detailed member account information.\n */\n constructor(parent: TeamsBotInstallation, account: TeamsChannelAccount) {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"Member\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Send a plain text message.\n *\n * @remarks\n * Only work on server side.\n *\n * @param text - The plain text message.\n * @param onError - An optional error handler that can catch exceptions during message sending.\n *\n * @returns The response of sending message.\n */\n public sendMessage(\n text: string,\n onError?: (context: TurnContext, error: Error) => Promise<void>\n ): Promise<MessageResponse> {\n return Promise.reject(\n new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"Member\"),\n ErrorCode.RuntimeNotSupported\n )\n );\n }\n\n /**\n * Send an adaptive card message.\n *\n * @remarks\n * Only work on server side.\n *\n * @param card - The adaptive card raw JSON.\n * @param onError - An optional error handler that can catch exceptions during adaptive card sending.\n *\n * @returns The response of sending adaptive card message.\n */\n public sendAdaptiveCard(\n card: unknown,\n onError?: (context: TurnContext, error: Error) => Promise<void>\n ): Promise<MessageResponse> {\n return Promise.reject(\n Promise.reject(\n new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"Member\"),\n ErrorCode.RuntimeNotSupported\n )\n )\n );\n }\n}\n\n/**\n * A {@link NotificationTarget} that represents a bot installation. Teams Bot could be installed into\n * - Personal chat\n * - Group chat\n * - Team (by default the `General` channel)\n *\n * @remarks\n * Only work on server side.\n *\n * It's recommended to get bot installations from {@link ConversationBot.installations()}.\n */\nexport class TeamsBotInstallation implements NotificationTarget {\n /**\n * The bound `CloudAdapter`.\n *\n * @remarks\n * Only work on server side.\n */\n public readonly adapter: CloudAdapter;\n\n /**\n * The bound `ConversationReference`.\n *\n * @remarks\n * Only work on server side.\n */\n public readonly conversationReference: Partial<ConversationReference>;\n\n /**\n * Notification target type.\n *\n * @remarks\n * Only work on server side.\n * - \"Channel\" means bot is installed into a team and notification will be sent to its \"General\" channel.\n * - \"Group\" means bot is installed into a group chat.\n * - \"Person\" means bot is installed into a personal scope and notification will be sent to personal chat.\n */\n public readonly type?: NotificationTargetType;\n\n /**\n * Constructor\n *\n * @remarks\n * Only work on server side.\n *\n * It's recommended to get bot installations from {@link ConversationBot.installations()}, instead of using this constructor.\n *\n * @param adapter - The bound `CloudAdapter`.\n * @param conversationReference - The bound `ConversationReference`.\n */\n constructor(adapter: CloudAdapter, conversationReference: Partial<ConversationReference>) {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"TeamsBotInstallation\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Send a plain text message.\n *\n * @remarks\n * Only work on server side.\n *\n * @param text - The plain text message.\n * @param onError - An optional error handler that can catch exceptions during message sending.\n *\n * @returns The response of sending message.\n */\n public sendMessage(\n text: string,\n onError?: (context: TurnContext, error: Error) => Promise<void>\n ): Promise<MessageResponse> {\n return Promise.reject(\n new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"TeamsBotInstallation\"),\n ErrorCode.RuntimeNotSupported\n )\n );\n }\n\n /**\n * Send an adaptive card message.\n *\n * @remarks\n * Only work on server side.\n *\n * @param card - The adaptive card raw JSON.\n * @param onError - An optional error handler that can catch exceptions during adaptive card sending.\n *\n * @returns The response of sending adaptive card message.\n */\n public sendAdaptiveCard(\n card: unknown,\n onError?: (context: TurnContext, error: Error) => Promise<void>\n ): Promise<MessageResponse> {\n return Promise.reject(\n new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"TeamsBotInstallation\"),\n ErrorCode.RuntimeNotSupported\n )\n );\n }\n\n /**\n * Get channels from this bot installation.\n *\n * @remarks\n * Only work on server side.\n *\n * @returns An array of channels if bot is installed into a team, otherwise returns an empty array.\n */\n public channels(): Promise<Channel[]> {\n return Promise.reject(\n new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"TeamsBotInstallation\"),\n ErrorCode.RuntimeNotSupported\n )\n );\n }\n\n /**\n * Get members from this bot installation.\n *\n * @remarks\n * Only work on server side.\n *\n * @returns An array of members from where the bot is installed.\n */\n public members(): Promise<Member[]> {\n return Promise.reject(\n new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"TeamsBotInstallation\"),\n ErrorCode.RuntimeNotSupported\n )\n );\n }\n\n /**\n * Get team details from this bot installation\n *\n * @returns The team details if bot is installed into a team, otherwise returns undefined.\n */\n public getTeamDetails(): Promise<TeamDetails | undefined> {\n return Promise.reject(\n new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"TeamsBotInstallation\"),\n ErrorCode.RuntimeNotSupported\n )\n );\n }\n}\n\n/**\n * Provide static utilities for bot notification.\n *\n * @remarks\n * Only work on server side.\n *\n * @example\n * Here's an example on how to send notification via Teams Bot.\n * ```typescript\n * // initialize (it's recommended to be called before handling any bot message)\n * const notificationBot = new NotificationBot(adapter);\n *\n * // get all bot installations and send message\n * for (const target of await notificationBot.installations()) {\n * await target.sendMessage(\"Hello Notification\");\n * }\n *\n * // alternative - send message to all members\n * for (const target of await notificationBot.installations()) {\n * for (const member of await target.members()) {\n * await member.sendMessage(\"Hello Notification\");\n * }\n * }\n * ```\n */\nexport class NotificationBot {\n private readonly conversationReferenceStore: ConversationReferenceStore;\n private readonly adapter: CloudAdapter;\n\n /**\n * Constructor of the notification bot.\n *\n * @remarks\n * Only work on server side.\n *\n * To ensure accuracy, it's recommended to initialize before handling any message.\n *\n * @param adapter - The bound `CloudAdapter`\n * @param options - The initialize options\n */\n public constructor(adapter: CloudAdapter, options?: NotificationOptions) {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"NotificationBot\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Get all targets where the bot is installed.\n *\n * @remarks\n * Only work on server side.\n *\n * The result is retrieving from the persisted storage.\n *\n * @returns An array of {@link TeamsBotInstallation}.\n */\n public static installations(): Promise<TeamsBotInstallation[]> {\n return Promise.reject(\n new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"NotificationBot\"),\n ErrorCode.RuntimeNotSupported\n )\n );\n }\n\n /**\n * Return the first {@link Member} where predicate is true, and undefined otherwise.\n *\n * @remarks\n * Only work on server side.\n *\n * @param predicate find calls predicate once for each member of the installation,\n * until it finds one where predicate returns true. If such a member is found,\n * find immediately returns that member. Otherwise, find returns undefined.\n * @param scope the scope to find members from the installations (personal chat, group chat, Teams channel).\n *\n * @returns The first {@link Member} where predicate is true, and undefined otherwise.\n */\n public findMember(\n predicate: (member: Member) => Promise<boolean>,\n scope?: SearchScope\n ): Promise<Member | undefined> {\n return Promise.reject(\n new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"NotificationBot\"),\n ErrorCode.RuntimeNotSupported\n )\n );\n }\n\n /**\n * Return the first {@link Channel} where predicate is true, and undefined otherwise.\n * (Ensure the bot app is installed into the `General` channel, otherwise undefined will be returned.)\n *\n * @remarks\n * Only work on server side.\n *\n * @param predicate - Find calls predicate once for each channel of the installation,\n * until it finds one where predicate returns true. If such a channel is found, find\n * immediately returns that channel. Otherwise, find returns undefined.\n *\n * @returns The first {@link Channel} where predicate is true, and `undefined` otherwise.\n */\n public findChannel(\n predicate: (channel: Channel, teamDetails: TeamDetails | undefined) => Promise<boolean>\n ): Promise<Channel | undefined> {\n return Promise.reject(\n new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"NotificationBot\"),\n ErrorCode.RuntimeNotSupported\n )\n );\n }\n\n /**\n * Return all {@link Member} where predicate is true, and empty array otherwise.\n *\n * @remarks\n * Only work on server side.\n *\n * @param predicate - Find calls predicate for each member of the installation.\n * @param scope - The scope to find members from the installations.\n * (personal chat, group chat, Teams channel).\n *\n * @returns An array of {@link Member} where predicate is true, and empty array otherwise.\n */\n public findAllMembers(\n predicate: (member: Member) => Promise<boolean>,\n scope?: SearchScope\n ): Promise<Member[]> {\n return Promise.reject(\n new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"NotificationBot\"),\n ErrorCode.RuntimeNotSupported\n )\n );\n }\n\n /**\n * Return all {@link Channel} where predicate is true, and empty array otherwise.\n * (Ensure the bot app is installed into the `General` channel, otherwise empty array will be returned.)\n *\n * @remarks\n * Only work on server side.\n *\n * @param predicate - Find calls predicate for each channel of the installation.\n *\n * @returns An array of {@link Channel} where predicate is true, and empty array otherwise.\n */\n public findAllChannels(\n predicate: (channel: Channel, teamDetails: TeamDetails | undefined) => Promise<boolean>\n ): Promise<Channel[]> {\n return Promise.reject(\n new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"NotificationBot\"),\n ErrorCode.RuntimeNotSupported\n )\n );\n }\n}\n\n/**\n * The search scope when calling {@link NotificationBot.findMember} and {@link NotificationBot.findAllMembers}.\n * The search scope is a flagged enum and it can be combined with `|`.\n * For example, to search from personal chat and group chat, use `SearchScope.Person | SearchScope.Group`.\n */\nexport enum SearchScope {\n /**\n * Search members from the installations in personal chat only.\n */\n Person = 1,\n\n /**\n * Search members from the installations in group chat only.\n */\n Group = 2,\n\n /**\n * Search members from the installations in Teams channel only.\n */\n Channel = 4,\n\n /**\n * Search members from all installations including personal chat, group chat and Teams channel.\n */\n All = Person | Group | Channel,\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { CloudAdapter } from \"botbuilder\";\nimport { ErrorWithCode, ErrorCode, ErrorMessage } from \"../core/errors\";\nimport { formatString } from \"../util/utils\";\nimport { TeamsFxBotCommandHandler, TeamsFxBotSsoCommandHandler } from \"../conversation/interface\";\nimport { CommandResponseMiddleware } from \"../conversation/middlewares/commandMiddleware\";\n\n/**\n * A command bot for receiving commands and sending responses in Teams.\n *\n * @remarks\n * Only work on server side.\n */\nexport class CommandBot {\n private readonly adapter: CloudAdapter;\n private readonly middleware: CommandResponseMiddleware;\n\n /**\n * Create a new instance of the `CommandBot`.\n *\n * @param adapter - The bound `CloudAdapter`.\n * @param commands - The commands to be registered with the command bot. Each command should implement the interface {@link TeamsFxBotCommandHandler} so that it can be correctly handled by this command bot.\n */\n constructor(adapter: CloudAdapter, commands?: TeamsFxBotCommandHandler[]) {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"CommandBot\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Register a command into the command bot.\n *\n * @param command - The command to be registered.\n *\n * @remarks\n * Only work on server side.\n */\n public registerCommand(command: TeamsFxBotCommandHandler): void {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"CommandBot\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Register commands into the command bot.\n *\n * @param commands - The commands to be registered.\n *\n * @remarks\n * Only work on server side.\n */\n public registerCommands(commands: TeamsFxBotCommandHandler[]): void {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"CommandBot\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Register a sso command into the command bot.\n *\n * @param ssoCommand - The sso command to be registered.\n */\n public registerSsoCommand(ssoCommand: TeamsFxBotSsoCommandHandler): void {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"CommandBot\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Register sso commands into the command bot.\n *\n * @param ssoCommands - The sso commands to be registered.\n */\n public registerSsoCommands(ssoCommands: TeamsFxBotSsoCommandHandler[]): void {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"CommandBot\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\nimport { CloudAdapter } from \"botbuilder\";\nimport { CardActionMiddleware } from \"../conversation/middlewares/cardActionMiddleware\";\nimport { CardActionOptions, TeamsFxAdaptiveCardActionHandler } from \"../conversation/interface\";\nimport { ErrorWithCode, ErrorCode, ErrorMessage } from \"../core/errors\";\nimport { formatString } from \"../util/utils\";\n\n/**\n * A card action bot to respond to adaptive card universal actions.\n *\n * @remarks\n * Only work on server side.\n */\nexport class CardActionBot {\n private readonly adapter: CloudAdapter;\n private middleware: CardActionMiddleware;\n\n /**\n * Create a new instance of the `CardActionBot`.\n *\n * @param adapter - The bound `CloudAdapter`.\n * @param options - The initialize options.\n */\n constructor(adapter: CloudAdapter, options?: CardActionOptions) {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"CardActionBot\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Register a card action handler to the bot.\n *\n * @param actionHandler - A card action handler to be registered.\n *\n * @remarks\n * Only work on server side.\n */\n registerHandler(actionHandler: TeamsFxAdaptiveCardActionHandler) {\n return Promise.reject(\n new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"CardActionBot\"),\n ErrorCode.RuntimeNotSupported\n )\n );\n }\n\n /**\n * Register card action handlers to the bot.\n *\n * @param actionHandlers - A set of card action handlers to be registered.\n *\n * @remarks\n * Only work on server side.\n */\n registerHandlers(actionHandlers: TeamsFxAdaptiveCardActionHandler[]) {\n return Promise.reject(\n new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"CardActionBot\"),\n ErrorCode.RuntimeNotSupported\n )\n );\n }\n}\n"],"names":["ConversationBot","sendMessage","sendAd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E,SAAS,CAAC,mBAAmB,CAC9B,CACF,CAAC;KACH;;;;;;;;;IAUD,gBAAgB,CAAC,cAAkD;QACjE,OAAO,OAAO,CAAC,MAAM,CACnB,IAAI,aAAa,CACf,YAAY,CAAC,YAAY,CAAC,0BAA0B,EAAE,eAAe,CAAC,EACtE,SAAS,CAAC,mBAAmB,CAC9B,CACF,CAAC;KACH;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.esm5.js","sources":["../src/core/errors.ts","../src/util/logger.ts","../src/util/utils.ts","../src/credential/appCredential.browser.ts","../src/credential/onBehalfOfUserCredential.browser.ts","../src/credential/teamsUserCredential.browser.ts","../src/core/msGraphAuthProvider.ts","../src/core/msGraphClientProvider.ts","../src/core/defaultTediousConnectionConfiguration.browser.ts","../src/bot/teamsBotSsoPrompt.browser.ts","../src/apiClient/apiClient.ts","../src/apiClient/bearerTokenAuthProvider.ts","../src/apiClient/basicAuthProvider.browser.ts","../src/apiClient/apiKeyProvider.browser.ts","../src/apiClient/certificateAuthProvider.browser.ts","../src/models/identityType.ts","../src/core/teamsfx.browser.ts","../src/conversation/interface.ts","../src/conversation/conversation.browser.ts","../src/conversation/sso/botSsoExecutionDialog.browser.ts","../src/conversation/notification.browser.ts","../src/conversation/command.browser.ts","../src/conversation/cardAction.browser.ts","../src/messageExtension/executeWithSSO.browser.ts","../src/conversationWithCloudAdapter/conversation.browser.ts","../src/conversationWithCloudAdapter/notification.browser.ts","../src/conversationWithCloudAdapter/command.browser.ts","../src/conversationWithCloudAdapter/cardAction.browser.ts"],"sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * Error code to trace the error types.\n */\nexport enum ErrorCode {\n /**\n * Invalid parameter error.\n */\n InvalidParameter = \"InvalidParameter\",\n\n /**\n * Invalid configuration error.\n */\n InvalidConfiguration = \"InvalidConfiguration\",\n\n /**\n * Invalid certificate error.\n */\n InvalidCertificate = \"InvalidCertificate\",\n\n /**\n * Internal error.\n */\n InternalError = \"InternalError\",\n\n /**\n * Channel is not supported error.\n */\n ChannelNotSupported = \"ChannelNotSupported\",\n\n /**\n * Failed to retrieve sso token\n */\n FailedToRetrieveSsoToken = \"FailedToRetrieveSsoToken\",\n\n /**\n * Failed to process sso handler\n */\n FailedToProcessSsoHandler = \"FailedToProcessSsoHandler\",\n\n /**\n * Cannot find command\n */\n CannotFindCommand = \"CannotFindCommand\",\n\n /**\n * Failed to run sso step\n */\n FailedToRunSsoStep = \"FailedToRunSsoStep\",\n\n /**\n * Failed to run dedup step\n */\n FailedToRunDedupStep = \"FailedToRunDedupStep\",\n\n /**\n * Sso activity handler is undefined\n */\n SsoActivityHandlerIsUndefined = \"SsoActivityHandlerIsUndefined\",\n\n /**\n * Runtime is not supported error.\n */\n RuntimeNotSupported = \"RuntimeNotSupported\",\n\n /**\n * User failed to finish the AAD consent flow failed.\n */\n ConsentFailed = \"ConsentFailed\",\n\n /**\n * The user or administrator has not consented to use the application error.\n */\n UiRequiredError = \"UiRequiredError\",\n\n /**\n * Token is not within its valid time range error.\n */\n TokenExpiredError = \"TokenExpiredError\",\n\n /**\n * Call service (AAD or simple authentication server) failed.\n */\n ServiceError = \"ServiceError\",\n\n /**\n * Operation failed.\n */\n FailedOperation = \"FailedOperation\",\n\n /**\n * Invalid response error.\n */\n InvalidResponse = \"InvalidResponse\",\n\n /**\n * Identity type error.\n */\n IdentityTypeNotSupported = \"IdentityTypeNotSupported\",\n\n /**\n * Authentication info already exists error.\n */\n AuthorizationInfoAlreadyExists = \"AuthorizationInfoAlreadyExists\",\n}\n\n/**\n * @internal\n */\nexport class ErrorMessage {\n // InvalidConfiguration Error\n static readonly InvalidConfiguration = \"{0} in configuration is invalid: {1}.\";\n static readonly ConfigurationNotExists = \"Configuration does not exist. {0}\";\n static readonly ResourceConfigurationNotExists = \"{0} resource configuration does not exist.\";\n static readonly MissingResourceConfiguration =\n \"Missing resource configuration with type: {0}, name: {1}.\";\n static readonly AuthenticationConfigurationNotExists =\n \"Authentication configuration does not exist.\";\n\n // RuntimeNotSupported Error\n static readonly BrowserRuntimeNotSupported = \"{0} is not supported in browser.\";\n static readonly NodejsRuntimeNotSupported = \"{0} is not supported in Node.\";\n\n // Internal Error\n static readonly FailToAcquireTokenOnBehalfOfUser =\n \"Failed to acquire access token on behalf of user: {0}\";\n\n // ChannelNotSupported Error\n static readonly OnlyMSTeamsChannelSupported = \"{0} is only supported in MS Teams Channel\";\n\n static readonly FailedToProcessSsoHandler = \"Failed to process sso handler: {0}\";\n\n // FailedToRetrieveSsoToken Error\n static readonly FailedToRetrieveSsoToken =\n \"Failed to retrieve sso token, user failed to finish the AAD consent flow.\";\n\n // CannotFindCommand Error\n static readonly CannotFindCommand = \"Cannot find command: {0}\";\n\n static readonly FailedToRunSsoStep = \"Failed to run dialog to retrieve sso token: {0}\";\n\n static readonly FailedToRunDedupStep = \"Failed to run dialog to remove duplicated messages: {0}\";\n\n // SsoActivityHandlerIsUndefined Error\n static readonly SsoActivityHandlerIsNull =\n \"Sso command can only be used or added when sso activity handler is not undefined\";\n\n // IdentityTypeNotSupported Error\n static readonly IdentityTypeNotSupported = \"{0} identity is not supported in {1}\";\n\n // AuthorizationInfoError\n static readonly AuthorizationHeaderAlreadyExists = \"Authorization header already exists!\";\n static readonly BasicCredentialAlreadyExists = \"Basic credential already exists!\";\n // InvalidParameter Error\n static readonly EmptyParameter = \"Parameter {0} is empty\";\n static readonly DuplicateHttpsOptionProperty =\n \"Axios HTTPS agent already defined value for property {0}\";\n static readonly DuplicateApiKeyInHeader =\n \"The request already defined api key in request header with name {0}.\";\n static readonly DuplicateApiKeyInQueryParam =\n \"The request already defined api key in query parameter with name {0}.\";\n static readonly OnlySupportInQueryActivity =\n \"The handleMessageExtensionQueryWithToken only support in handleTeamsMessagingExtensionQuery with composeExtension/query type.\";\n static readonly OnlySupportInLinkQueryActivity =\n \"The handleMessageExtensionLinkQueryWithSSO only support in handleTeamsAppBasedLinkQuery with composeExtension/queryLink type.\";\n}\n\n/**\n * Error class with code and message thrown by the SDK.\n */\nexport class ErrorWithCode extends Error {\n /**\n * Error code\n *\n * @readonly\n */\n code: string | undefined;\n\n /**\n * Constructor of ErrorWithCode.\n *\n * @param {string} message - error message.\n * @param {ErrorCode} code - error code.\n */\n constructor(message?: string, code?: ErrorCode) {\n if (!code) {\n super(message);\n return this;\n }\n\n super(message);\n Object.setPrototypeOf(this, ErrorWithCode.prototype);\n this.name = `${new.target.name}.${code}`;\n this.code = code;\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * Interface for customized logger.\n */\nexport interface Logger {\n /**\n * Writes to error level logging or lower.\n */\n error(message: string): void;\n /**\n * Writes to warning level logging or lower.\n */\n warn(message: string): void;\n /**\n * Writes to info level logging or lower.\n */\n info(message: string): void;\n /**\n * Writes to verbose level logging.\n */\n verbose(message: string): void;\n}\n\n/**\n * Log function for customized logging.\n */\nexport type LogFunction = (level: LogLevel, message: string) => void;\n\n/**\n * Log level.\n */\nexport enum LogLevel {\n /**\n * Show verbose, information, warning and error message.\n */\n Verbose,\n /**\n * Show information, warning and error message.\n */\n Info,\n /**\n * Show warning and error message.\n */\n Warn,\n /**\n * Show error message.\n */\n Error,\n}\n\n/**\n * Update log level helper.\n *\n * @param { LogLevel } level - log level in configuration\n */\nexport function setLogLevel(level: LogLevel): void {\n internalLogger.level = level;\n}\n\n/**\n * Get log level.\n *\n * @returns Log level\n */\nexport function getLogLevel(): LogLevel | undefined {\n return internalLogger.level;\n}\n\nexport class InternalLogger implements Logger {\n public name?: string;\n public level?: LogLevel = undefined;\n public customLogger: Logger | undefined;\n public customLogFunction: LogFunction | undefined;\n\n private defaultLogger: Logger = {\n verbose: console.debug,\n info: console.info,\n warn: console.warn,\n error: console.error,\n };\n\n constructor(name?: string, logLevel?: LogLevel) {\n this.name = name;\n this.level = logLevel;\n }\n\n public error(message: string): void {\n this.log(LogLevel.Error, (x: Logger) => x.error, message);\n }\n\n public warn(message: string): void {\n this.log(LogLevel.Warn, (x: Logger) => x.warn, message);\n }\n\n public info(message: string): void {\n this.log(LogLevel.Info, (x: Logger) => x.info, message);\n }\n\n public verbose(message: string): void {\n this.log(LogLevel.Verbose, (x: Logger) => x.verbose, message);\n }\n\n private log(\n logLevel: LogLevel,\n logFunction: (x: Logger) => (message: string) => void,\n message: string\n ): void {\n if (message.trim() === \"\") {\n return;\n }\n const timestamp = new Date().toUTCString();\n let logHeader: string;\n if (this.name) {\n logHeader = `[${timestamp}] : @microsoft/teamsfx - ${this.name} : ${LogLevel[logLevel]} - `;\n } else {\n logHeader = `[${timestamp}] : @microsoft/teamsfx : ${LogLevel[logLevel]} - `;\n }\n const logMessage = `${logHeader}${message}`;\n if (this.level !== undefined && this.level <= logLevel) {\n if (this.customLogger) {\n logFunction(this.customLogger)(logMessage);\n } else if (this.customLogFunction) {\n this.customLogFunction(logLevel, logMessage);\n } else {\n logFunction(this.defaultLogger)(logMessage);\n }\n }\n }\n}\n\n/**\n * Logger instance used internally\n *\n * @internal\n */\nexport const internalLogger: InternalLogger = new InternalLogger();\n\n/**\n * Set custom logger. Use the output functions if it's set. Priority is higher than setLogFunction.\n *\n * @param {Logger} logger - custom logger. If it's undefined, custom logger will be cleared.\n *\n * @example\n * ```typescript\n * setLogger({\n * verbose: console.debug,\n * info: console.info,\n * warn: console.warn,\n * error: console.error,\n * });\n * ```\n */\nexport function setLogger(logger?: Logger): void {\n internalLogger.customLogger = logger;\n}\n\n/**\n * Set custom log function. Use the function if it's set. Priority is lower than setLogger.\n *\n * @param {LogFunction} logFunction - custom log function. If it's undefined, custom log function will be cleared.\n *\n * @example\n * ```typescript\n * setLogFunction((level: LogLevel, message: string) => {\n * if (level === LogLevel.Error) {\n * console.log(message);\n * }\n * });\n * ```\n */\nexport function setLogFunction(logFunction?: LogFunction): void {\n internalLogger.customLogFunction = logFunction;\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\nimport { ErrorWithCode, ErrorCode } from \"../core/errors\";\nimport { SSOTokenInfoBase, SSOTokenV1Info, SSOTokenV2Info } from \"../models/ssoTokenInfo\";\nimport { UserInfo, UserTenantIdAndLoginHint } from \"../models/userinfo\";\nimport jwt_decode from \"jwt-decode\";\nimport { internalLogger } from \"./logger\";\nimport { AccessToken } from \"@azure/identity\";\nimport { AuthenticationResult } from \"@azure/msal-browser\";\n\n/**\n * Parse jwt token payload\n *\n * @param token\n *\n * @returns Payload object\n *\n * @internal\n */\nexport function parseJwt(token: string): SSOTokenInfoBase {\n try {\n const tokenObj: SSOTokenInfoBase = jwt_decode(token);\n if (!tokenObj || !tokenObj.exp) {\n throw new ErrorWithCode(\n \"Decoded token is null or exp claim does not exists.\",\n ErrorCode.InternalError\n );\n }\n\n return tokenObj;\n } catch (err: any) {\n const errorMsg = \"Parse jwt token failed in node env with error: \" + (err.message as string);\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.InternalError);\n }\n}\n\n/**\n * @internal\n */\nexport function getUserInfoFromSsoToken(ssoToken: string): UserInfo {\n if (!ssoToken) {\n const errorMsg = \"SSO token is undefined.\";\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.InvalidParameter);\n }\n const tokenObject = parseJwt(ssoToken) as SSOTokenV1Info | SSOTokenV2Info;\n\n const userInfo: UserInfo = {\n displayName: tokenObject.name,\n objectId: tokenObject.oid,\n tenantId: tokenObject.tid,\n preferredUserName: \"\",\n };\n\n if (tokenObject.ver === \"2.0\") {\n userInfo.preferredUserName = (tokenObject as SSOTokenV2Info).preferred_username;\n } else if (tokenObject.ver === \"1.0\") {\n userInfo.preferredUserName = (tokenObject as SSOTokenV1Info).upn;\n }\n return userInfo;\n}\n\n/**\n * @internal\n */\nexport function getTenantIdAndLoginHintFromSsoToken(ssoToken: string): UserTenantIdAndLoginHint {\n if (!ssoToken) {\n const errorMsg = \"SSO token is undefined.\";\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.InvalidParameter);\n }\n const tokenObject = parseJwt(ssoToken) as SSOTokenV1Info | SSOTokenV2Info;\n\n const userInfo: UserTenantIdAndLoginHint = {\n tid: tokenObject.tid,\n loginHint:\n tokenObject.ver === \"2.0\"\n ? (tokenObject as SSOTokenV2Info).preferred_username\n : (tokenObject as SSOTokenV1Info).upn,\n };\n\n return userInfo;\n}\n\n/**\n * @internal\n */\nexport function parseAccessTokenFromAuthCodeTokenResponse(\n tokenResponse: string | AuthenticationResult\n): AccessToken {\n try {\n const tokenResponseObject =\n typeof tokenResponse == \"string\"\n ? (JSON.parse(tokenResponse) as AuthenticationResult)\n : tokenResponse;\n if (!tokenResponseObject || !tokenResponseObject.accessToken) {\n const errorMsg = \"Get empty access token from Auth Code token response.\";\n\n internalLogger.error(errorMsg);\n throw new Error(errorMsg);\n }\n\n const token = tokenResponseObject.accessToken;\n const tokenObject = parseJwt(token);\n\n if (tokenObject.ver !== \"1.0\" && tokenObject.ver !== \"2.0\") {\n const errorMsg = \"SSO token is not valid with an unknown version: \" + tokenObject.ver;\n internalLogger.error(errorMsg);\n throw new Error(errorMsg);\n }\n\n const accessToken: AccessToken = {\n token: token,\n expiresOnTimestamp: tokenObject.exp * 1000,\n };\n return accessToken;\n } catch (error: any) {\n const errorMsg =\n \"Parse access token failed from Auth Code token response in node env with error: \" +\n (error.message as string);\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.InternalError);\n }\n}\n\n/**\n * Format string template with replacements\n *\n * ```typescript\n * const template = \"{0} and {1} are fruit. {0} is my favorite one.\"\n * const formattedStr = formatString(template, \"apple\", \"pear\"); // formattedStr: \"apple and pear are fruit. apple is my favorite one.\"\n * ```\n *\n * @param str string template\n * @param replacements replacement string array\n * @returns Formatted string\n *\n * @internal\n */\nexport function formatString(str: string, ...replacements: string[]): string {\n const args = replacements;\n return str.replace(/{(\\d+)}/g, function (match, number) {\n return typeof args[number] != \"undefined\" ? args[number] : match;\n });\n}\n\n/**\n * @internal\n */\nexport function validateScopesType(value: any): void {\n // string\n if (typeof value === \"string\" || value instanceof String) {\n return;\n }\n\n // empty array\n if (Array.isArray(value) && value.length === 0) {\n return;\n }\n\n // string array\n if (Array.isArray(value) && value.length > 0 && value.every((item) => typeof item === \"string\")) {\n return;\n }\n\n const errorMsg = \"The type of scopes is not valid, it must be string or string array\";\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.InvalidParameter);\n}\n\n/**\n * @internal\n */\nexport function getScopesArray(scopes: string | string[]): string[] {\n const scopesArray: string[] = typeof scopes === \"string\" ? scopes.split(\" \") : scopes;\n return scopesArray.filter((x) => x !== null && x !== \"\");\n}\n\n/**\n * @internal\n */\nexport function getAuthority(authorityHost: string, tenantId: string): string {\n const normalizedAuthorityHost = authorityHost.replace(/\\/+$/g, \"\");\n return normalizedAuthorityHost + \"/\" + tenantId;\n}\n\n/**\n * @internal\n */\nexport interface ClientCertificate {\n thumbprint: string;\n privateKey: string;\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AccessToken, TokenCredential, GetTokenOptions } from \"@azure/identity\";\nimport { AppCredentialAuthConfig, AuthenticationConfiguration } from \"../models/configuration\";\nimport { formatString } from \"../util/utils\";\nimport { ErrorCode, ErrorMessage, ErrorWithCode } from \"../core/errors\";\n\n/**\n * Represent Microsoft 365 tenant identity, and it is usually used when user is not involved.\n *\n * @remarks\n * Only works in in server side.\n */\nexport class AppCredential implements TokenCredential {\n /**\n * Constructor of AppCredential.\n *\n * @remarks\n * Only works in in server side.\n */\n constructor(authConfig: AppCredentialAuthConfig);\n constructor(authConfig: AuthenticationConfiguration);\n constructor(authConfig: AppCredentialAuthConfig | AuthenticationConfiguration) {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"AppCredential\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Get access token for credential.\n *\n * @remarks\n * Only works in in server side.\n */\n getToken(scopes: string | string[], options?: GetTokenOptions): Promise<AccessToken | null> {\n return Promise.reject(\n new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"AppCredential\"),\n ErrorCode.RuntimeNotSupported\n )\n );\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AccessToken, GetTokenOptions, TokenCredential } from \"@azure/identity\";\nimport { UserInfo } from \"../models/userinfo\";\nimport {\n AuthenticationConfiguration,\n OnBehalfOfCredentialAuthConfig,\n} from \"../models/configuration\";\nimport { formatString } from \"../util/utils\";\nimport { ErrorWithCode, ErrorCode, ErrorMessage } from \"../core/errors\";\n\n/**\n * Represent on-behalf-of flow to get user identity, and it is designed to be used in Azure Function or Bot scenarios.\n *\n * @remarks\n * Can only be used in server side.\n */\nexport class OnBehalfOfUserCredential implements TokenCredential {\n /**\n * Constructor of OnBehalfOfUserCredential\n *\n * @remarks\n * Can Only works in in server side.\n */\n constructor(ssoToken: string, config: OnBehalfOfCredentialAuthConfig);\n constructor(ssoToken: string, config: AuthenticationConfiguration);\n constructor(\n ssoToken: string,\n config: OnBehalfOfCredentialAuthConfig | AuthenticationConfiguration\n ) {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"OnBehalfOfUserCredential\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Get access token from credential.\n * @remarks\n * Can only be used in server side.\n */\n getToken(scopes: string | string[], options?: GetTokenOptions): Promise<AccessToken | null> {\n return Promise.reject(\n new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"OnBehalfOfUserCredential\"),\n ErrorCode.RuntimeNotSupported\n )\n );\n }\n\n /**\n * Get basic user info from SSO token.\n * @remarks\n * Can only be used in server side.\n */\n public getUserInfo(): Promise<UserInfo> {\n return Promise.reject(\n new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"OnBehalfOfUserCredential\"),\n ErrorCode.RuntimeNotSupported\n )\n );\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AccessToken, TokenCredential, GetTokenOptions } from \"@azure/identity\";\nimport { GetTeamsUserTokenOptions } from \"../models/teamsUserTokenOptions\";\nimport { UserInfo } from \"../models/userinfo\";\nimport { ErrorCode, ErrorMessage, ErrorWithCode } from \"../core/errors\";\nimport { app, authentication } from \"@microsoft/teams-js\";\nimport {\n AuthenticationConfiguration,\n TeamsUserCredentialAuthConfig,\n} from \"../models/configuration\";\nimport {\n validateScopesType,\n getUserInfoFromSsoToken,\n parseJwt,\n formatString,\n getTenantIdAndLoginHintFromSsoToken,\n parseAccessTokenFromAuthCodeTokenResponse,\n} from \"../util/utils\";\nimport { internalLogger } from \"../util/logger\";\nimport { PublicClientApplication } from \"@azure/msal-browser\";\n\nconst tokenRefreshTimeSpanInMillisecond = 5 * 60 * 1000;\nconst loginPageWidth = 600;\nconst loginPageHeight = 535;\n\n/**\n * Represent Teams current user's identity, and it is used within Teams tab application.\n *\n * @remarks\n * Can only be used within Teams.\n */\nexport class TeamsUserCredential implements TokenCredential {\n private readonly config: AuthenticationConfiguration;\n private ssoToken: AccessToken | null;\n private initialized: boolean;\n private msalInstance?: PublicClientApplication;\n private tid?: string;\n private loginHint?: string;\n\n // eslint-disable-next-line no-secrets/no-secrets\n /**\n * Constructor of TeamsUserCredential.\n *\n * @example\n * ```typescript\n * const config: TeamsUserCredentialAuthConfig = {\n * initiateLoginEndpoint: \"https://localhost:3000/auth-start.html\",\n * clientId: \"xxx\"\n * }\n * const credential = new TeamsUserCredential(config);\n * ```\n *\n * @param {TeamsUserCredentialAuthConfig} authConfig - The authentication configuration.\n *\n * @throws {@link ErrorCode|InvalidConfiguration} when client id, initiate login endpoint or simple auth endpoint is not found in config.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.\n */\n constructor(authConfig: TeamsUserCredentialAuthConfig);\n // eslint-disable-next-line no-secrets/no-secrets\n /**\n * Constructor of TeamsUserCredential.\n * @deprecated\n * @example\n * ```typescript\n * const config: AuthenticationConfiguration = {\n * initiateLoginEndpoint: \"https://localhost:3000/auth-start.html\",\n * clientId: \"xxx\"\n * }\n * // Use default configuration provided by Teams Toolkit\n * const credential = new TeamsUserCredential();\n * // Use a customized configuration\n * const anotherCredential = new TeamsUserCredential(config);\n * ```\n *\n * @param {TeamsUserCredentialAuthConfig} authConfig - The authentication configuration.\n *\n * @throws {@link ErrorCode|InvalidConfiguration} when client id, initiate login endpoint or simple auth endpoint is not found in config.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.\n */\n constructor(authConfig: AuthenticationConfiguration);\n constructor(authConfig: TeamsUserCredentialAuthConfig | AuthenticationConfiguration) {\n internalLogger.info(\"Create teams user credential\");\n this.config = this.loadAndValidateConfig(authConfig);\n this.ssoToken = null;\n this.initialized = false;\n }\n\n /**\n * Popup login page to get user's access token with specific scopes.\n *\n * @remarks\n * Only works in Teams client APP. User will be redirected to the authorization page to login and consent.\n *\n * @example\n * ```typescript\n * await credential.login([\"https://graph.microsoft.com/User.Read\"]); // single scope using string array\n * await credential.login(\"https://graph.microsoft.com/User.Read\"); // single scopes using string\n * await credential.login([\"https://graph.microsoft.com/User.Read\", \"Calendars.Read\"]); // multiple scopes using string array\n * await credential.login(\"https://graph.microsoft.com/User.Read Calendars.Read\"); // multiple scopes using string\n * ```\n * @param scopes - The list of scopes for which the token will have access, before that, we will request user to consent.\n * @param { string[] } resources - The optional list of resources for full trust Teams apps.\n *\n * @throws {@link ErrorCode|InternalError} when failed to login with unknown error.\n * @throws {@link ErrorCode|ConsentFailed} when user canceled or failed to consent.\n * @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.\n */\n async login(scopes: string | string[], resources?: string[]): Promise<void> {\n validateScopesType(scopes);\n const scopesStr = typeof scopes === \"string\" ? scopes : scopes.join(\" \");\n\n internalLogger.info(`Popup login page to get user's access token with scopes: ${scopesStr}`);\n\n if (!this.initialized) {\n await this.init(resources);\n }\n\n await app.initialize();\n let result: string;\n try {\n const params = {\n url: `${\n this.config.initiateLoginEndpoint ? this.config.initiateLoginEndpoint : \"\"\n }?clientId=${this.config.clientId ? this.config.clientId : \"\"}&scope=${encodeURI(\n scopesStr\n )}&loginHint=${this.loginHint ? this.loginHint : \"\"}`,\n width: loginPageWidth,\n height: loginPageHeight,\n } as authentication.AuthenticatePopUpParameters;\n result = await authentication.authenticate(params);\n if (!result) {\n const errorMsg = \"Get empty authentication result from MSAL\";\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.InternalError);\n }\n } catch (err: unknown) {\n const errorMsg = `Consent failed for the scope ${scopesStr} with error: ${\n (err as Error).message\n }`;\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.ConsentFailed);\n }\n let resultJson: any = {};\n try {\n resultJson = typeof result == \"string\" ? JSON.parse(result) : result;\n } catch (error) {\n // If can not parse result as Json, will throw error.\n const failedToParseResult = \"Failed to parse response to Json.\";\n internalLogger.error(failedToParseResult);\n throw new ErrorWithCode(failedToParseResult, ErrorCode.InvalidResponse);\n }\n\n // If code exists in result, user may using previous auth-start and auth-end page.\n if (resultJson.code) {\n const helpLink = \"https://aka.ms/teamsfx-auth-code-flow\";\n const usingPreviousAuthPage =\n \"Found auth code in response. Auth code is not support for current version of SDK. \" +\n `Please refer to the help link for how to fix the issue: ${helpLink}.`;\n internalLogger.error(usingPreviousAuthPage);\n throw new ErrorWithCode(usingPreviousAuthPage, ErrorCode.InvalidResponse);\n }\n\n // If sessionStorage exists in result, set the values in current session storage.\n if (resultJson.sessionStorage) {\n this.setSessionStorage(resultJson.sessionStorage);\n }\n }\n\n /**\n * Get access token from credential.\n *\n * Important: Access tokens are stored in sessionStorage, read more here: https://aka.ms/teamsfx-session-storage-notice\n * Important: Full trust applications do not read the resource information from the webApplicationInfo section of the app\n * manifest. Instead, this resource (along with any additional resources from which to request tokens) must be provided\n * as a list of resources to the getToken() method through a GetTeamsUserTokenOptions object.\n *\n * @example\n * ```typescript\n * await credential.getToken([]) // Get SSO token using empty string array\n * await credential.getToken(\"\") // Get SSO token using empty string\n * await credential.getToken([\".default\"]) // Get Graph access token with default scope using string array\n * await credential.getToken(\".default\") // Get Graph access token with default scope using string\n * await credential.getToken([\"User.Read\"]) // Get Graph access token for single scope using string array\n * await credential.getToken(\"User.Read\") // Get Graph access token for single scope using string\n * await credential.getToken([\"User.Read\", \"Application.Read.All\"]) // Get Graph access token for multiple scopes using string array\n * await credential.getToken(\"User.Read Application.Read.All\") // Get Graph access token for multiple scopes using space-separated string\n * await credential.getToken(\"https://graph.microsoft.com/User.Read\") // Get Graph access token with full resource URI\n * await credential.getToken([\"https://outlook.office.com/Mail.Read\"]) // Get Outlook access token\n *\n * const options: GetTeamsUserTokenOptions = { resources: [\"https://domain.example.com\"] }; // set up resources for full trust apps.\n * await credential.getToken([], options) // Get sso token from teams client - only use this approach for full trust apps.\n * ```\n *\n * @param {string | string[]} scopes - The list of scopes for which the token will have access.\n * @param {GetTokenOptions} options - The options used to configure any requests this TokenCredential implementation might make.\n *\n * @throws {@link ErrorCode|InternalError} when failed to get access token with unknown error.\n * @throws {@link ErrorCode|UiRequiredError} when need user consent to get access token.\n * @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.\n *\n * @returns User access token of defined scopes.\n * If scopes is empty string or array, it returns SSO token.\n * If scopes is non-empty, it returns access token for target scope.\n * Throw error if get access token failed.\n */\n async getToken(\n scopes: string | string[],\n options?: GetTokenOptions\n ): Promise<AccessToken | null> {\n validateScopesType(scopes);\n const resources = (options as GetTeamsUserTokenOptions)?.resources;\n const ssoToken = await this.getSSOToken(resources);\n\n const scopeStr = typeof scopes === \"string\" ? scopes : scopes.join(\" \");\n if (scopeStr === \"\") {\n internalLogger.info(\"Get SSO token\");\n\n return ssoToken;\n } else {\n internalLogger.info(\"Get access token with scopes: \" + scopeStr);\n\n if (!this.initialized) {\n await this.init(resources);\n }\n\n let tokenResponse;\n const scopesArray = typeof scopes === \"string\" ? scopes.split(\" \") : scopes;\n const domain = window.location.origin;\n\n // First try to get Access Token from cache.\n try {\n const account = this.msalInstance!.getAccountByUsername(this.loginHint!);\n const scopesRequestForAcquireTokenSilent = {\n scopes: scopesArray,\n account: account ?? undefined,\n redirectUri: `${domain}/blank-auth-end.html`,\n };\n tokenResponse = await this.msalInstance!.acquireTokenSilent(\n scopesRequestForAcquireTokenSilent\n );\n } catch (error: any) {\n const acquireTokenSilentFailedMessage = `Failed to call acquireTokenSilent. Reason: ${\n error?.message as string\n }. `;\n internalLogger.verbose(acquireTokenSilentFailedMessage);\n }\n\n if (!tokenResponse) {\n // If fail to get Access Token from cache, try to get Access token by silent login.\n try {\n const scopesRequestForSsoSilent = {\n scopes: scopesArray,\n loginHint: this.loginHint,\n redirectUri: `${domain}/blank-auth-end.html`,\n };\n tokenResponse = await this.msalInstance!.ssoSilent(scopesRequestForSsoSilent);\n } catch (error: any) {\n const ssoSilentFailedMessage = `Failed to call ssoSilent. Reason: ${\n error?.message as string\n }. `;\n internalLogger.verbose(ssoSilentFailedMessage);\n }\n }\n\n if (!tokenResponse) {\n const errorMsg = `Failed to get access token cache silently, please login first: you need login first before get access token.`;\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.UiRequiredError);\n }\n\n const accessToken = parseAccessTokenFromAuthCodeTokenResponse(tokenResponse);\n return accessToken;\n }\n }\n\n /**\n * Get basic user info from SSO token\n *\n * @param {string[]} resources - The optional list of resources for full trust Teams apps.\n *\n * @example\n * ```typescript\n * const currentUser = await credential.getUserInfo();\n * ```\n *\n * @throws {@link ErrorCode|InternalError} when SSO token from Teams client is not valid.\n * @throws {@link ErrorCode|InvalidParameter} when SSO token from Teams client is empty.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is nodeJS.\n *\n * @returns Basic user info with user displayName, objectId and preferredUserName.\n */\n public async getUserInfo(resources?: string[]): Promise<UserInfo> {\n internalLogger.info(\"Get basic user info from SSO token\");\n const ssoToken = await this.getSSOToken(resources);\n return getUserInfoFromSsoToken(ssoToken.token);\n }\n\n private async init(resources?: string[]): Promise<void> {\n const ssoToken = await this.getSSOToken(resources);\n const info = getTenantIdAndLoginHintFromSsoToken(ssoToken.token);\n this.loginHint = info.loginHint;\n this.tid = info.tid;\n\n const msalConfig = {\n auth: {\n clientId: this.config.clientId!,\n authority: `https://login.microsoftonline.com/${this.tid}`,\n },\n cache: {\n cacheLocation: \"sessionStorage\",\n },\n };\n\n this.msalInstance = new PublicClientApplication(msalConfig);\n this.initialized = true;\n }\n\n /**\n * Get SSO token using teams SDK\n * 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\n *\n * @param {string[]} resources - The optional list of resources for full trust Teams apps.\n *\n * @returns SSO token\n */\n private async getSSOToken(resources?: string[]): Promise<AccessToken> {\n if (this.ssoToken) {\n if (this.ssoToken.expiresOnTimestamp - Date.now() > tokenRefreshTimeSpanInMillisecond) {\n internalLogger.verbose(\"Get SSO token from memory cache\");\n return this.ssoToken;\n }\n }\n\n const params = { resources: resources ?? [] } as authentication.AuthTokenRequestParameters;\n let token: string;\n try {\n await app.initialize();\n } catch (err: unknown) {\n const errorMsg = \"Initialize teams sdk failed due to not running inside Teams environment\";\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.InternalError);\n }\n\n try {\n token = await authentication.getAuthToken(params);\n } catch (err: unknown) {\n const errorMsg = \"Get SSO token failed with error: \" + (err as Error).message;\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.InternalError);\n }\n\n if (!token) {\n const errorMsg = \"Get empty SSO token from Teams\";\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.InternalError);\n }\n\n const tokenObject = parseJwt(token);\n if (tokenObject.ver !== \"1.0\" && tokenObject.ver !== \"2.0\") {\n const errorMsg = \"SSO token is not valid with an unknown version: \" + tokenObject.ver;\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.InternalError);\n }\n\n const ssoToken: AccessToken = {\n token,\n expiresOnTimestamp: tokenObject.exp * 1000,\n };\n\n this.ssoToken = ssoToken;\n return ssoToken;\n }\n\n /**\n * Load and validate authentication configuration\n *\n * @param {AuthenticationConfiguration?} config - The authentication configuration. Use environment variables if not provided.\n *\n * @returns Authentication configuration\n */\n private loadAndValidateConfig(\n config: AuthenticationConfiguration | TeamsUserCredentialAuthConfig\n ): AuthenticationConfiguration {\n internalLogger.verbose(\"Validate authentication configuration\");\n if (config.initiateLoginEndpoint && config.clientId) {\n return config;\n }\n\n const missingValues = [];\n if (!config.initiateLoginEndpoint) {\n missingValues.push(\"initiateLoginEndpoint\");\n }\n\n if (!config.clientId) {\n missingValues.push(\"clientId\");\n }\n\n const errorMsg = formatString(\n ErrorMessage.InvalidConfiguration,\n missingValues.join(\", \"),\n \"undefined\"\n );\n\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.InvalidConfiguration);\n }\n\n private setSessionStorage(sessionStorageValues: any): void {\n try {\n const sessionStorageKeys = Object.keys(sessionStorageValues);\n sessionStorageKeys.forEach((key) => {\n sessionStorage.setItem(key, sessionStorageValues[key]);\n });\n } catch (error: any) {\n // Values in result.sessionStorage can not be set into session storage.\n // Throw error since this may block user.\n const errorMessage = `Failed to set values in session storage. Error: ${\n error.message as string\n }`;\n internalLogger.error(errorMessage);\n throw new ErrorWithCode(errorMessage, ErrorCode.InternalError);\n }\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AuthenticationProvider } from \"@microsoft/microsoft-graph-client\";\nimport { ErrorWithCode, ErrorCode } from \"./errors\";\nimport { TeamsFxConfiguration } from \"../models/teamsfxConfiguration\";\nimport { internalLogger } from \"../util/logger\";\nimport { validateScopesType } from \"../util/utils\";\nimport { AccessToken, TokenCredential } from \"@azure/identity\";\n\nconst defaultScope = \"https://graph.microsoft.com/.default\";\n\n// eslint-disable-next-line no-secrets/no-secrets\n/**\n * Microsoft Graph auth provider for Teams Framework\n * @deprecated Use `TokenCredentialAuthenticationProvider` from `@microsoft/microsoft-graph-client/authProviders/azureTokenCredentials` instead.\n */\nexport class MsGraphAuthProvider implements AuthenticationProvider {\n private credentialOrTeamsFx: TokenCredential | TeamsFxConfiguration;\n private scopes: string | string[];\n\n /**\n * Constructor of MsGraphAuthProvider.\n *\n * @param {TeamsFxConfiguration} teamsfx - Used to provide configuration and auth.\n * @param {string | string[]} scopes - The list of scopes for which the token will have access.\n *\n * @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.\n *\n * @returns An instance of MsGraphAuthProvider.\n */\n constructor(teamsfx: TeamsFxConfiguration, scopes?: string | string[]);\n /**\n * Constructor of MsGraphAuthProvider.\n *\n * @param {TokenCredential} credential - credential used to provide configuration and auth.\n * @param {string | string[]} scopes - The list of scopes for which the token will have access.\n *\n * @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.\n *\n * @returns An instance of MsGraphAuthProvider.\n */\n constructor(credential: TokenCredential, scopes?: string | string[]);\n constructor(\n credentialOrTeamsFx: TeamsFxConfiguration | TokenCredential,\n scopes?: string | string[]\n ) {\n this.credentialOrTeamsFx = credentialOrTeamsFx;\n\n let scopesStr = defaultScope;\n if (scopes) {\n validateScopesType(scopes);\n scopesStr = typeof scopes === \"string\" ? scopes : scopes.join(\" \");\n if (scopesStr === \"\") {\n scopesStr = defaultScope;\n }\n }\n\n internalLogger.info(\n `Create Microsoft Graph Authentication Provider with scopes: '${scopesStr}'`\n );\n\n this.scopes = scopesStr;\n }\n\n /**\n * Get access token for Microsoft Graph API requests.\n *\n * @throws {@link ErrorCode|InternalError} when get access token failed due to empty token or unknown other problems.\n * @throws {@link ErrorCode|TokenExpiredError} when SSO token has already expired.\n * @throws {@link ErrorCode|UiRequiredError} when need user consent to get access token.\n * @throws {@link ErrorCode|ServiceError} when failed to get access token from simple auth or AAD server.\n * @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.\n *\n * @returns Access token from the credential.\n *\n */\n public async getAccessToken(): Promise<string> {\n internalLogger.info(`Get Graph Access token with scopes: '${this.scopes.toString()}'`);\n\n let accessToken: AccessToken | null;\n if ((this.credentialOrTeamsFx as TeamsFxConfiguration).getCredential) {\n accessToken = await (this.credentialOrTeamsFx as TeamsFxConfiguration)\n .getCredential()\n .getToken(this.scopes);\n } else {\n accessToken = await (this.credentialOrTeamsFx as TokenCredential).getToken(this.scopes);\n }\n\n return new Promise<string>((resolve, reject) => {\n if (accessToken) {\n resolve(accessToken.token);\n } else {\n const errorMsg = \"Graph access token is undefined or empty\";\n internalLogger.error(errorMsg);\n reject(new ErrorWithCode(errorMsg, ErrorCode.InternalError));\n }\n });\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { Client } from \"@microsoft/microsoft-graph-client\";\nimport { MsGraphAuthProvider } from \"./msGraphAuthProvider\";\nimport { TeamsFxConfiguration } from \"../models/teamsfxConfiguration\";\nimport { internalLogger } from \"../util/logger\";\nimport { TokenCredential } from \"@azure/identity\";\n\n/**\n * Get Microsoft graph client.\n * @deprecated Use `TokenCredentialAuthenticationProvider` and `Client.initWithMiddleware` instead.\n * ```typescript\n * const authProvider = new TokenCredentialAuthenticationProvider(credential, { scopes: scope });\n * const graph = Client.initWithMiddleware({\n * authProvider: authProvider,\n * });\n * ```\n *\n * @example\n * Get Microsoft graph client by TokenCredential\n * ```typescript\n * // Sso token example (Azure Function)\n * const ssoToken = \"YOUR_TOKEN_STRING\";\n * const options = {\"AAD_APP_ID\", \"AAD_APP_SECRET\"};\n * const credential = new OnBehalfOfAADUserCredential(ssoToken, options);\n * const graphClient = await createMicrosoftGraphClient(credential);\n * const profile = await graphClient.api(\"/me\").get();\n *\n * // TeamsBotSsoPrompt example (Bot Application)\n * const requiredScopes = [\"User.Read\"];\n * const config: Configuration = {\n * loginUrl: loginUrl,\n * clientId: clientId,\n * clientSecret: clientSecret,\n * tenantId: tenantId\n * };\n * const prompt = new TeamsBotSsoPrompt(dialogId, {\n * config: config\n * scopes: [\"User.Read\"],\n * });\n * this.addDialog(prompt);\n *\n * const oboCredential = new OnBehalfOfAADUserCredential(\n * getUserId(dialogContext),\n * {\n * clientId: \"AAD_APP_ID\",\n * clientSecret: \"AAD_APP_SECRET\"\n * });\n * try {\n * const graphClient = await createMicrosoftGraphClient(credential);\n * const profile = await graphClient.api(\"/me\").get();\n * } catch (e) {\n * dialogContext.beginDialog(dialogId);\n * return Dialog.endOfTurn();\n * }\n * ```\n *\n * @param {TeamsFx} teamsfx - Used to provide configuration and auth.\n * @param scopes - The array of Microsoft Token scope of access. Default value is `[.default]`.\n *\n * @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.\n *\n * @returns Graph client with specified scopes.\n */\nexport function createMicrosoftGraphClient(\n teamsfx: TeamsFxConfiguration,\n scopes?: string | string[]\n): Client {\n internalLogger.info(\"Create Microsoft Graph Client\");\n const authProvider = new MsGraphAuthProvider(teamsfx, scopes);\n const graphClient = Client.initWithMiddleware({\n authProvider,\n });\n\n return graphClient;\n}\n\n// eslint-disable-next-line no-secrets/no-secrets\n/**\n * Get Microsoft graph client.\n * @deprecated Use `TokenCredentialAuthenticationProvider` and `Client.initWithMiddleware` instead.\n * ```typescript\n * const authProvider = new TokenCredentialAuthenticationProvider(credential, { scopes: scope });\n * const graph = Client.initWithMiddleware({\n * authProvider: authProvider,\n * });\n * ```\n * \n * @example\n * Get Microsoft graph client by TokenCredential\n * ```typescript\n * // In browser: TeamsUserCredential\n * const authConfig: TeamsUserCredentialAuthConfig = {\n * clientId: \"xxx\",\n initiateLoginEndpoint: \"https://xxx/auth-start.html\",\n * };\n\n * const credential = new TeamsUserCredential(authConfig);\n\n * const scope = \"User.Read\";\n * await credential.login(scope);\n\n * const client = createMicrosoftGraphClientWithCredential(credential, scope);\n\n * // In node: OnBehalfOfUserCredential\n * const oboAuthConfig: OnBehalfOfCredentialAuthConfig = {\n * authorityHost: \"xxx\",\n * clientId: \"xxx\",\n * tenantId: \"xxx\",\n * clientSecret: \"xxx\",\n * };\n\n * const oboCredential = new OnBehalfOfUserCredential(ssoToken, oboAuthConfig);\n * const scope = \"User.Read\";\n * const client = createMicrosoftGraphClientWithCredential(oboCredential, scope);\n\n * // In node: AppCredential\n * const appAuthConfig: AppCredentialAuthConfig = {\n * authorityHost: \"xxx\",\n * clientId: \"xxx\",\n * tenantId: \"xxx\",\n * clientSecret: \"xxx\",\n * };\n * const appCredential = new AppCredential(appAuthConfig);\n * const scope = \"User.Read\";\n * const client = createMicrosoftGraphClientWithCredential(appCredential, scope);\n * \n * const profile = await client.api(\"/me\").get();\n * ```\n *\n * @param {TokenCredential} credential - Used to provide configuration and auth.\n * @param scopes - The array of Microsoft Token scope of access. Default value is `[.default]`.\n *\n * @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.\n *\n * @returns Graph client with specified scopes.\n */\nexport function createMicrosoftGraphClientWithCredential(\n credential: TokenCredential,\n scopes?: string | string[]\n): Client {\n internalLogger.info(\"Create Microsoft Graph Client\");\n const authProvider = new MsGraphAuthProvider(credential, scopes);\n const graphClient = Client.initWithMiddleware({\n authProvider,\n });\n return graphClient;\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { ConnectionConfig } from \"tedious\";\nimport { ErrorWithCode, ErrorCode, ErrorMessage } from \"../core/errors\";\nimport { TeamsFx } from \"../core/teamsfx\";\nimport { formatString } from \"../util/utils\";\n\n/**\n * Generate connection configuration consumed by tedious.\n *\n * @deprecated we recommend you compose your own Tedious configuration for better flexibility.\n *\n * @remarks\n * Only works in in server side.\n */\nexport function getTediousConnectionConfig(\n teamsfx: TeamsFx,\n databaseName?: string\n): Promise<ConnectionConfig> {\n return Promise.reject(\n new ErrorWithCode(\n formatString(\n ErrorMessage.BrowserRuntimeNotSupported,\n \"DefaultTediousConnectionConfiguration\"\n ),\n ErrorCode.RuntimeNotSupported\n )\n );\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { DialogContext, DialogTurnResult } from \"botbuilder-dialogs\";\nimport { ErrorWithCode, ErrorCode, ErrorMessage } from \"../core/errors\";\nimport { formatString } from \"../util/utils\";\nimport { TeamsFx } from \"../core/teamsfx\";\n\n/**\n * Settings used to configure an TeamsBotSsoPrompt instance.\n *\n * @remarks\n * Only works in in server side.\n */\nexport interface TeamsBotSsoPromptSettings {\n /**\n * The array of strings that declare the desired permissions and the resources requested.\n */\n scopes: string[];\n\n /**\n * (Optional) number of milliseconds the prompt will wait for the user to authenticate.\n * Defaults to a value `900,000` (15 minutes.)\n */\n timeout?: number;\n\n /**\n * (Optional) value indicating whether the TeamsBotSsoPrompt should end upon receiving an\n * invalid message. Generally the TeamsBotSsoPrompt will end the auth flow when receives user\n * message not related to the auth flow. Setting the flag to false ignores the user's message instead.\n * Defaults to value `true`\n */\n endOnInvalidMessage?: boolean;\n}\n\n/**\n * Creates a new prompt that leverage Teams Single Sign On (SSO) support for bot to automatically sign in user and\n * help receive oauth token, asks the user to consent if needed.\n *\n * @remarks\n * The prompt will attempt to retrieve the users current token of the desired scopes and store it in\n * the token store.\n *\n * User will be automatically signed in leveraging Teams support of Bot Single Sign On(SSO):\n * https://docs.microsoft.com/en-us/microsoftteams/platform/bots/how-to/authentication/auth-aad-sso-bots\n *\n * @example\n * When used with your bots `DialogSet` you can simply add a new instance of the prompt as a named\n * dialog using `DialogSet.add()`. You can then start the prompt from a waterfall step using either\n * `DialogContext.beginDialog()` or `DialogContext.prompt()`. The user will be prompted to sign in as\n * needed and their access token will be passed as an argument to the callers next waterfall step:\n *\n * ```JavaScript\n * const { ConversationState, MemoryStorage } = require('botbuilder');\n * const { DialogSet, WaterfallDialog } = require('botbuilder-dialogs');\n * const { TeamsBotSsoPrompt } = require('@microsoft/teamsfx');\n *\n * const convoState = new ConversationState(new MemoryStorage());\n * const dialogState = convoState.createProperty('dialogState');\n * const dialogs = new DialogSet(dialogState);\n *\n * dialogs.add(new TeamsBotSsoPrompt('TeamsBotSsoPrompt', {\n * scopes: [\"User.Read\"],\n * }));\n *\n * dialogs.add(new WaterfallDialog('taskNeedingLogin', [\n * async (step) => {\n * return await step.beginDialog('TeamsBotSsoPrompt');\n * },\n * async (step) => {\n * const token = step.result;\n * if (token) {\n *\n * // ... continue with task needing access token ...\n *\n * } else {\n * await step.context.sendActivity(`Sorry... We couldn't log you in. Try again later.`);\n * return await step.endDialog();\n * }\n * }\n * ]));\n * ```\n */\nexport class TeamsBotSsoPrompt {\n /**\n * Constructor of TeamsBotSsoPrompt.\n *\n * @param dialogId Unique ID of the dialog within its parent `DialogSet` or `ComponentDialog`.\n * @param settings Settings used to configure the prompt.\n *\n * @throws {@link ErrorCode|InvalidParameter} when scopes is not a valid string or string array.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.\n */\n constructor(\n private teamsfx: TeamsFx,\n dialogId: string,\n private settings: TeamsBotSsoPromptSettings\n ) {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"TeamsBotSsoPrompt\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Called when a prompt dialog is pushed onto the dialog stack and is being activated.\n * @remarks\n * If the task is successful, the result indicates whether the prompt is still\n * active after the turn has been processed by the prompt.\n *\n * @param dc The DialogContext for the current turn of the conversation.\n *\n * @throws {@link ErrorCode|InvalidParameter} when timeout property in teams bot sso prompt settings is not number or is not positive.\n * @throws {@link ErrorCode|ChannelNotSupported} when bot channel is not MS Teams.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.\n *\n * @returns A `Promise` representing the asynchronous operation.\n */\n public beginDialog(dc: DialogContext): Promise<DialogTurnResult> {\n return Promise.reject(\n new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"TeamsBotSsoPrompt\"),\n ErrorCode.RuntimeNotSupported\n )\n );\n }\n\n /**\n * Called when a prompt dialog is the active dialog and the user replied with a new activity.\n *\n * @remarks\n * If the task is successful, the result indicates whether the dialog is still\n * active after the turn has been processed by the dialog.\n * The prompt generally continues to receive the user's replies until it accepts the\n * user's reply as valid input for the prompt.\n *\n * @param dc The DialogContext for the current turn of the conversation.\n *\n * @returns A `Promise` representing the asynchronous operation.\n *\n * @throws {@link ErrorCode|ChannelNotSupported} when bot channel is not MS Teams.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.\n */\n public continueDialog(dc: DialogContext): Promise<DialogTurnResult> {\n return Promise.reject(\n new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"TeamsBotSsoPrompt\"),\n ErrorCode.RuntimeNotSupported\n )\n );\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport axios, { AxiosInstance, InternalAxiosRequestConfig } from \"axios\";\nimport { AuthProvider } from \"./authProvider\";\n\n/**\n * Initializes new Axios instance with specific auth provider\n *\n * @param apiEndpoint - Base url of the API\n * @param authProvider - Auth provider that injects authentication info to each request\n * @returns axios instance configured with specfic auth provider\n *\n * @example\n * ```typescript\n * const client = createApiClient(\"https://my-api-endpoint-base-url\", new BasicAuthProvider(\"xxx\",\"xxx\"));\n * ```\n */\nexport function createApiClient(apiEndpoint: string, authProvider: AuthProvider): AxiosInstance {\n // Add a request interceptor\n const instance = axios.create({\n baseURL: apiEndpoint,\n });\n instance.interceptors.request.use(async function (config) {\n return (await authProvider.AddAuthenticationInfo(\n config\n )) as Promise<InternalAxiosRequestConfig>;\n });\n return instance;\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AxiosRequestConfig } from \"axios\";\nimport { ErrorWithCode, ErrorCode, ErrorMessage } from \"../core/errors\";\nimport { AuthProvider } from \"./authProvider\";\n\n/**\n * Provider that handles Bearer Token authentication\n */\nexport class BearerTokenAuthProvider implements AuthProvider {\n private getToken: () => Promise<string>;\n\n /**\n * @param { () => Promise<string> } getToken - Function that returns the content of bearer token used in http request\n */\n constructor(getToken: () => Promise<string>) {\n this.getToken = getToken;\n }\n\n /**\n * Adds authentication info to http requests\n *\n * @param { AxiosRequestConfig } config - Contains all the request information and can be updated to include extra authentication info.\n * Refer https://axios-http.com/docs/req_config for detailed document.\n *\n * @returns Updated axios request config.\n *\n * @throws {@link ErrorCode|AuthorizationInfoAlreadyExists} - when Authorization header already exists in request configuration.\n */\n public async AddAuthenticationInfo(config: AxiosRequestConfig): Promise<AxiosRequestConfig> {\n const token = await this.getToken();\n if (!config.headers) {\n config.headers = {};\n }\n if (config.headers[\"Authorization\"]) {\n throw new ErrorWithCode(\n ErrorMessage.AuthorizationHeaderAlreadyExists,\n ErrorCode.AuthorizationInfoAlreadyExists\n );\n }\n\n config.headers[\"Authorization\"] = `Bearer ${token}`;\n return config;\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AxiosRequestConfig } from \"axios\";\nimport { AuthProvider } from \"./authProvider\";\nimport { ErrorWithCode, ErrorCode, ErrorMessage } from \"../core/errors\";\nimport { formatString } from \"../util/utils\";\n\n/**\n * Provider that handles Basic authentication\n */\nexport class BasicAuthProvider implements AuthProvider {\n private userName: string;\n private password: string;\n\n /**\n *\n * @param { string } userName - Username used in basic auth\n * @param { string } password - Password used in basic auth\n *\n * @throws {@link ErrorCode|InvalidParameter} - when username or password is empty.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.\n */\n constructor(userName: string, password: string) {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"BasicAuthProvider\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Adds authentication info to http requests\n *\n * @param { AxiosRequestConfig } config - Contains all the request information and can be updated to include extra authentication info.\n * Refer https://axios-http.com/docs/req_config for detailed document.\n *\n * @returns Updated axios request config.\n *\n * @throws {@link ErrorCode|AuthorizationInfoAlreadyExists} - when Authorization header or auth property already exists in request configuration.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.\n */\n public AddAuthenticationInfo(config: AxiosRequestConfig): Promise<AxiosRequestConfig> {\n return Promise.reject(\n new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"BasicAuthProvider\"),\n ErrorCode.RuntimeNotSupported\n )\n );\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AxiosRequestConfig } from \"axios\";\nimport { AuthProvider } from \"./authProvider\";\nimport { ErrorWithCode, ErrorCode, ErrorMessage } from \"../core/errors\";\nimport { formatString } from \"../util/utils\";\n\n/**\n * Provider that handles API Key authentication\n */\nexport class ApiKeyProvider implements AuthProvider {\n private keyName: string;\n private keyValue: string;\n private keyLocation: ApiKeyLocation;\n\n /**\n *\n * @param { string } keyName - The name of request header or query parameter that specifies API Key\n * @param { string } keyValue - The value of API Key\n * @param { ApiKeyLocation } keyLocation - The location of API Key: request header or query parameter.\n *\n * @throws {@link ErrorCode|InvalidParameter} - when key name or key value is empty.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.\n */\n constructor(keyName: string, keyValue: string, keyLocation: ApiKeyLocation) {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"ApiKeyProvider\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Adds authentication info to http requests\n *\n * @param { AxiosRequestConfig } config - Contains all the request information and can be updated to include extra authentication info.\n * Refer https://axios-http.com/docs/req_config for detailed document.\n *\n * @returns Updated axios request config.\n *\n * @throws {@link ErrorCode|AuthorizationInfoAlreadyExists} - when API key already exists in request header or url query parameter.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.\n */\n public AddAuthenticationInfo(config: AxiosRequestConfig): Promise<AxiosRequestConfig> {\n return Promise.reject(\n new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"ApiKeyProvider\"),\n ErrorCode.RuntimeNotSupported\n )\n );\n }\n}\n\n/**\n * Define available location for API Key location\n */\nexport enum ApiKeyLocation {\n /**\n * The API Key is placed in request header\n */\n Header,\n /**\n * The API Key is placed in query parameter\n */\n QueryParams,\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AxiosRequestConfig } from \"axios\";\nimport { SecureContextOptions } from \"tls\";\nimport { AuthProvider } from \"./authProvider\";\nimport { ErrorWithCode, ErrorCode, ErrorMessage } from \"../core/errors\";\nimport { formatString } from \"../util/utils\";\n\n/**\n * Provider that handles Certificate authentication\n */\n\nexport class CertificateAuthProvider implements AuthProvider {\n private certOption: SecureContextOptions;\n\n /**\n *\n * @param { SecureContextOptions } certOption - information about the cert used in http requests\n */\n constructor(certOption: SecureContextOptions) {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"CertificateAuthProvider\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Adds authentication info to http requests.\n *\n * @param { AxiosRequestConfig } config - Contains all the request information and can be updated to include extra authentication info.\n * Refer https://axios-http.com/docs/req_config for detailed document.\n *\n * @returns Updated axios request config.\n *\n * @throws {@link ErrorCode|InvalidParameter} - when custom httpsAgent in the request has duplicate properties with certOption provided in constructor.\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.\n */\n public AddAuthenticationInfo(config: AxiosRequestConfig): Promise<AxiosRequestConfig> {\n return Promise.reject(\n new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"CertificateAuthProvider\"),\n ErrorCode.RuntimeNotSupported\n )\n );\n }\n}\n\n/**\n * Helper to create SecureContextOptions from PEM format cert\n *\n * @param { string | Buffer } cert - The cert chain in PEM format\n * @param { string | Buffer } key - The private key for the cert chain\n * @param { {passphrase?: string; ca?: string | Buffer} } options - Optional settings when create the cert options.\n *\n * @returns Instance of SecureContextOptions\n *\n * @throws {@link ErrorCode|InvalidParameter} - when any parameter is empty\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.\n *\n */\nexport function createPemCertOption(\n cert: string | Buffer,\n key: string | Buffer,\n options?: {\n passphrase?: string;\n ca?: string | Buffer;\n }\n): SecureContextOptions {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"createPemCertOption\"),\n ErrorCode.RuntimeNotSupported\n );\n}\n\n/**\n * Helper to create SecureContextOptions from PFX format cert\n *\n * @param { string | Buffer } pfx - The content of .pfx file\n * @param { {passphrase?: string} } options - Optional settings when create the cert options.\n *\n * @returns Instance of SecureContextOptions\n *\n * @throws {@link ErrorCode|InvalidParameter} - when any parameter is empty\n * @throws {@link ErrorCode|RuntimeNotSupported} when runtime is browser.\n *\n */\nexport function createPfxCertOption(\n pfx: string | Buffer,\n options?: {\n passphrase?: string;\n }\n): SecureContextOptions {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"createPfxCertOption\"),\n ErrorCode.RuntimeNotSupported\n );\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * Identity type to use in authentication.\n */\nexport enum IdentityType {\n /**\n * Represents the current user of Teams.\n */\n User = \"User\",\n /**\n * Represents the application itself.\n */\n App = \"Application\",\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { TokenCredential } from \"@azure/identity\";\nimport { TeamsUserCredential } from \"../credential/teamsUserCredential.browser\";\nimport { IdentityType } from \"../models/identityType\";\nimport { UserInfo } from \"../models/userinfo\";\nimport { formatString } from \"../util/utils\";\nimport { ErrorWithCode, ErrorCode, ErrorMessage } from \"../core/errors\";\nimport { internalLogger } from \"../util/logger\";\nimport { TeamsFxConfiguration } from \"../models/teamsfxConfiguration\";\nimport { AuthenticationConfiguration } from \"../models/configuration\";\n\n/**\n * A class providing credential and configuration.\n * @deprecated Please use {@link TeamsUserCredential}\n * in browser environment and {@link OnBehalfOfUserCredential} or {@link AppCredential} in NodeJS.\n */\nexport class TeamsFx implements TeamsFxConfiguration {\n private configuration: Map<string, string | undefined>;\n private teamsUserCredential?: TeamsUserCredential;\n public identityType: IdentityType;\n\n constructor(\n identityType?: IdentityType,\n customConfig?: Record<string, string> | AuthenticationConfiguration\n ) {\n this.identityType = identityType ?? IdentityType.User;\n if (this.identityType !== IdentityType.User) {\n const errorMsg = formatString(\n ErrorMessage.IdentityTypeNotSupported,\n this.identityType.toString(),\n \"TeamsFx\"\n );\n internalLogger.error(errorMsg);\n throw new ErrorWithCode(errorMsg, ErrorCode.IdentityTypeNotSupported);\n }\n this.configuration = new Map<string, string>();\n this.loadFromEnv();\n if (customConfig) {\n const myConfig: Record<string, string> = { ...customConfig };\n for (const key of Object.keys(myConfig)) {\n const value = myConfig[key];\n if (value) {\n this.configuration.set(key, value);\n }\n }\n }\n if (this.configuration.size === 0) {\n internalLogger.warn(\n \"No configuration is loaded, please pass required configs to TeamsFx constructor\"\n );\n }\n }\n\n private loadFromEnv(): void {\n if (window && (window as any).__env__) {\n // testing purpose\n const env = (window as any).__env__;\n this.configuration.set(\"authorityHost\", env.REACT_APP_AUTHORITY_HOST);\n this.configuration.set(\"tenantId\", env.REACT_APP_TENANT_ID);\n this.configuration.set(\"clientId\", env.REACT_APP_CLIENT_ID);\n this.configuration.set(\"initiateLoginEndpoint\", env.REACT_APP_START_LOGIN_PAGE_URL);\n this.configuration.set(\"applicationIdUri\", env.M365_APPLICATION_ID_URI);\n this.configuration.set(\"apiEndpoint\", env.REACT_APP_FUNC_ENDPOINT);\n this.configuration.set(\"apiName\", env.REACT_APP_FUNC_NAME);\n } else {\n // TODO: support common environment variable name\n try {\n this.configuration.set(\"authorityHost\", process.env.REACT_APP_AUTHORITY_HOST);\n this.configuration.set(\"tenantId\", process.env.REACT_APP_TENANT_ID);\n this.configuration.set(\"clientId\", process.env.REACT_APP_CLIENT_ID);\n this.configuration.set(\"initiateLoginEndpoint\", process.env.REACT_APP_START_LOGIN_PAGE_URL);\n this.configuration.set(\"applicationIdUri\", process.env.M365_APPLICATION_ID_URI);\n this.configuration.set(\"apiEndpoint\", process.env.REACT_APP_FUNC_ENDPOINT);\n this.configuration.set(\"apiName\", process.env.REACT_APP_FUNC_NAME);\n } catch (_) {\n internalLogger.warn(\n \"Cannot read process.env, please use webpack if you want to use environment variables.\"\n );\n return;\n }\n }\n }\n\n getIdentityType(): IdentityType {\n return this.identityType;\n }\n\n public getCredential(): TokenCredential {\n if (!this.teamsUserCredential) {\n this.teamsUserCredential = new TeamsUserCredential(Object.fromEntries(this.configuration));\n }\n return this.teamsUserCredential;\n }\n\n public async getUserInfo(resources?: string[]): Promise<UserInfo> {\n return await (this.getCredential() as TeamsUserCredential).getUserInfo(resources);\n }\n\n public async login(scopes: string | string[], resources?: string[]): Promise<void> {\n await (this.getCredential() as TeamsUserCredential).login(scopes, resources);\n }\n\n public setSsoToken(ssoToken: string): TeamsFx {\n return this;\n }\n\n public getConfig(key: string): string {\n const value = this.configuration.get(key);\n if (!value) {\n throw new Error();\n }\n return value;\n }\n\n public hasConfig(key: string): boolean {\n const value = this.configuration.get(key);\n return !!value;\n }\n\n public getConfigs(): Record<string, string> {\n const config: Record<string, string> = {};\n for (const key of this.configuration.keys()) {\n const value = this.configuration.get(key);\n if (value) {\n config[key] = value;\n }\n }\n return config;\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n BotFrameworkAdapter,\n ConversationState,\n ConversationReference,\n UserState,\n Activity,\n TurnContext,\n InvokeResponse,\n Storage,\n SigninStateVerificationQuery,\n} from \"botbuilder\";\nimport { TeamsBotSsoPromptTokenResponse } from \"../bot/teamsBotSsoPromptTokenResponse\";\nimport {\n AuthenticationConfiguration,\n OnBehalfOfCredentialAuthConfig,\n} from \"../models/configuration\";\n\n/**\n * The response of a message action, e.g., `sendMessage`, `sendAdaptiveCard`.\n */\nexport interface MessageResponse {\n /**\n * Id of the message.\n */\n id?: string;\n}\n\n/**\n * The target type where the notification will be sent to.\n *\n * @remarks\n * - \"Channel\" means to a team channel. (By default, notification to a team will be sent to its \"General\" channel.)\n * - \"Group\" means to a group chat.\n * - \"Person\" means to a personal chat.\n */\nexport enum NotificationTargetType {\n /**\n * The notification will be sent to a team channel.\n * (By default, notification to a team will be sent to its \"General\" channel.)\n */\n Channel = \"Channel\",\n /**\n * The notification will be sent to a group chat.\n */\n Group = \"Group\",\n /**\n * The notification will be sent to a personal chat.\n */\n Person = \"Person\",\n}\n\n/**\n * Represent a notification target.\n */\nexport interface NotificationTarget {\n /**\n * The type of target, could be \"Channel\" or \"Group\" or \"Person\".\n */\n readonly type?: NotificationTargetType;\n\n /**\n * Send a plain text message.\n *\n * @param text - the plain text message.\n * @param onError - an optional error handler that can catch exceptions during message sending.\n * If not defined, error will be handled by `BotAdapter.onTurnError`.\n *\n * @returns the response of sending message.\n */\n sendMessage(\n text: string,\n onError?: (context: TurnContext, error: Error) => Promise<void>\n ): Promise<MessageResponse>;\n\n /**\n * Send an adaptive card message.\n *\n * @param card - the adaptive card raw JSON.\n * @param onError - an optional error handler that can catch exceptions during adaptive card sending.\n * If not defined, error will be handled by `BotAdapter.onTurnError`.\n *\n * @returns the response of sending adaptive card message.\n */\n sendAdaptiveCard(\n card: unknown,\n onError?: (context: TurnContext, error: Error) => Promise<void>\n ): Promise<MessageResponse>;\n}\n\n/**\n * Interface for a storage provider that stores and retrieves notification target references.\n *\n * @deprecated Use ConversationReferenceStore to customize the way\n * to persist bot notification connections instead.\n */\nexport interface NotificationTargetStorage {\n /**\n * Read one notification target by its key.\n *\n * @param key - the key of a notification target.\n *\n * @returns - the notification target. Or undefined if not found.\n */\n read(key: string): Promise<{ [key: string]: unknown } | undefined>;\n\n /**\n * List all stored notification targets.\n *\n * @returns - an array of notification target. Or an empty array if nothing is stored.\n */\n list(): Promise<{ [key: string]: unknown }[]>;\n\n /**\n * Write one notification target by its key.\n *\n * @param key - the key of a notification target.\n * @param object - the notification target.\n */\n write(key: string, object: { [key: string]: unknown }): Promise<void>;\n\n /**\n * Delete one notification target by its key.\n *\n * @param key - the key of a notification target.\n */\n delete(key: string): Promise<void>;\n}\n\n/**\n * Options to initialize {@link NotificationBot}.\n * @deprecated Please use BotBuilderCloudAdapter.NotificationOptions instead.\n */\nexport interface NotificationOptions {\n /**\n * An optional storage to persist bot notification connections.\n *\n * @remarks\n * If `storage` is not provided, a default local file storage will be used,\n * which stores notification connections into:\n * - \".notification.localstore.json\" if running locally\n * - \"${process.env.TEMP}/.notification.localstore.json\" if `process.env.RUNNING_ON_AZURE` is set to \"1\"\n *\n * It's recommended to use your own shared storage for production environment.\n */\n storage?: NotificationTargetStorage;\n}\n\n/**\n * A store to persist notification target references.\n */\nexport interface ConversationReferenceStore {\n /**\n * Add a conversation reference to the store. If overwrite, update existing one, otherwise add when not exist.\n *\n * @param key the key of the conversation reference.\n * @param reference the conversation reference to add.\n * @param options the options to add the conversation reference.\n *\n * @returns true if added or updated, false if not changed.\n */\n add(\n key: string,\n reference: Partial<ConversationReference>,\n options: ConversationReferenceStoreAddOptions\n ): Promise<boolean>;\n\n /**\n * Remove a conversation reference from the store.\n *\n * @param key the key of the conversation reference.\n * @param reference the conversation reference to remove.\n *\n * @returns true if exist and removed, false if not changed.\n */\n remove(key: string, reference: Partial<ConversationReference>): Promise<boolean>;\n\n /**\n * List stored conversation reference by page.\n *\n * @param pageSize the page size.\n * @param continuationToken the continuation token to get next page.\n *\n * @returns a paged list of conversation references.\n */\n list(\n pageSize?: number,\n continuationToken?: string\n ): Promise<PagedData<Partial<ConversationReference>>>;\n}\n\n/**\n * Options to add a conversation reference to the store.\n */\nexport interface ConversationReferenceStoreAddOptions {\n /**\n * Whether to overwrite the existing conversation reference.\n */\n overwrite?: boolean;\n}\n\n/**\n * Represents a page of data.\n */\nexport interface PagedData<T> {\n /**\n * Page of data.\n */\n data: T[];\n\n /**\n * The Continuation Token to pass to get the next page of results.\n *\n * @remarks\n * Undefined or empty token means the page reaches the end.\n */\n continuationToken?: string;\n}\n\n/**\n * The trigger pattern used to trigger a {@link TeamsFxBotCommandHandler} instance.\n */\nexport type TriggerPatterns = string | RegExp | (string | RegExp)[];\n\n/**\n * Interface for a command message that can handled in a command handler.\n */\nexport interface CommandMessage {\n /**\n * Text of the message sent by the user.\n */\n text: string;\n\n /**\n * The capture groups that matched to the {@link TriggerPatterns} in a {@link TeamsFxBotCommandHandler} instance.\n */\n matches?: RegExpMatchArray;\n}\n\n/**\n * Interface for a command handler that can process command to a TeamsFx bot and return a response.\n */\nexport interface TeamsFxBotCommandHandler {\n /**\n * The string or regular expression patterns that can trigger this handler.\n */\n triggerPatterns: TriggerPatterns;\n\n /**\n * Handles a bot command received activity.\n *\n * @param context The bot context.\n * @param message The command message the user types from Teams.\n * @returns A `Promise` representing an activity or text to send as the command response.\n * Or no return value if developers want to send the response activity by themselves in this method.\n */\n handleCommandReceived(\n context: TurnContext,\n message: CommandMessage\n ): Promise<string | Partial<Activity> | void>;\n}\n\n/**\n * Interface for a command handler that can process sso command to a TeamsFx bot and return a response.\n */\nexport interface TeamsFxBotSsoCommandHandler {\n /**\n * The string or regular expression patterns that can trigger this handler.\n */\n triggerPatterns: TriggerPatterns;\n\n /**\n * Handles a bot command received activity.\n *\n * @param context The bot context.\n * @param message The command message the user types from Teams.\n * @param tokenResponse The tokenResponse which contains sso token that can be used to exchange access token for the bot.\n * @returns A `Promise` representing an activity or text to send as the command response.\n * Or no return value if developers want to send the response activity by themselves in this method.\n */\n handleCommandReceived(\n context: TurnContext,\n message: CommandMessage,\n tokenResponse: TeamsBotSsoPromptTokenResponse\n ): Promise<string | Partial<Activity> | void>;\n}\n\n/**\n * Options to initialize {@link CommandBot}.\n */\nexport interface CommandOptions {\n /**\n * 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.\n */\n commands?: TeamsFxBotCommandHandler[];\n\n /**\n * The commands to registered with the sso command bot. Each sso command should implement the interface {@link TeamsFxBotSsoCommandHandler} so that it can be correctly handled by this command bot.\n */\n ssoCommands?: TeamsFxBotSsoCommandHandler[];\n}\n\n/**\n * Options to initialize {@link CardActionBot}.\n */\nexport interface CardActionOptions {\n /**\n * The action handlers to registered with the action bot. Each command should implement the interface {@link TeamsFxAdaptiveCardActionHandler} so that it can be correctly handled by this bot.\n */\n actions?: TeamsFxAdaptiveCardActionHandler[];\n}\n\n/**\n * Options used to control how the response card will be sent to users.\n */\nexport enum AdaptiveCardResponse {\n /**\n * The response card will be replaced the current one for the interactor who trigger the action.\n */\n ReplaceForInteractor,\n\n /**\n * The response card will be replaced the current one for all users in the chat.\n */\n ReplaceForAll,\n\n /**\n * The response card will be sent as a new message for all users in the chat.\n */\n NewForAll,\n}\n\n/**\n * Status code for an `application/vnd.microsoft.error` invoke response.\n */\nexport enum InvokeResponseErrorCode {\n /**\n * Invalid request.\n */\n BadRequest = 400,\n\n /**\n * Internal server error.\n */\n InternalServerError = 500,\n}\n\n/**\n * Interface for adaptive card action handler that can process card action invoke and return a response.\n */\nexport interface TeamsFxAdaptiveCardActionHandler {\n /**\n * The verb defined in adaptive card action that can trigger this handler.\n * The verb string here is case-insensitive.\n */\n triggerVerb: string;\n\n /**\n * Specify the behavior for how the card response will be sent in Teams conversation.\n * The default value is `AdaptiveCardResponse.ReplaceForInteractor`, which means the card\n * response will replace the current one only for the interactor.\n */\n adaptiveCardResponse?: AdaptiveCardResponse;\n\n /**\n * The handler function that will be invoked when the action is fired.\n * @param context The turn context.\n * @param actionData The contextual data that associated with the action.\n * \n * @returns A `Promise` representing a invoke response for the adaptive card invoke action.\n * You can use the `InvokeResponseFactory` utility class to create an invoke response from\n * - A text message: \n * ```typescript \n * return InvokeResponseFactory.textMessage(\"Action is processed successfully!\");\n * ```\n * - An adaptive card:\n * ```typescript\n * const responseCard = AdaptiveCards.declare(helloWorldCard).render(actionData);\n return InvokeResponseFactory.adaptiveCard(responseCard);\n * ```\n * - An error response:\n * ```typescript\n * return InvokeResponseFactory.errorResponse(InvokeResponseErrorCode.BadRequest, \"Invalid request\");\n * ```\n * \n * @remarks For more details about the invoke response format, refer to https://docs.microsoft.com/en-us/adaptive-cards/authoring-cards/universal-action-model#response-format.\n */\n handleActionInvoked(context: TurnContext, actionData: any): Promise<InvokeResponse>;\n}\n\n/**\n * Interface for SSO configuration for Bot SSO\n */\nexport interface BotSsoConfig {\n /**\n * aad related configurations\n */\n aad: {\n /**\n * The list of scopes for which the token will have access\n */\n scopes: string[];\n } & (\n | (OnBehalfOfCredentialAuthConfig & { initiateLoginEndpoint: string })\n | AuthenticationConfiguration\n );\n\n dialog?: {\n /**\n * Custom sso execution activity handler class which should implement the interface {@link BotSsoExecutionActivityHandler}. If not provided, it will use {@link DefaultBotSsoExecutionActivityHandler} by default\n */\n CustomBotSsoExecutionActivityHandler?: new (\n ssoConfig: BotSsoConfig\n ) => BotSsoExecutionActivityHandler;\n\n /**\n * Conversation state for sso command bot, if not provided, it will use internal memory storage to create a new one.\n */\n conversationState?: ConversationState;\n\n /**\n * User state for sso command bot, if not provided, it will use internal memory storage to create a new one.\n */\n userState?: UserState;\n\n /**\n * Used by {@link BotSsoExecutionDialog} to remove duplicated messages, if not provided, it will use internal memory storage\n */\n dedupStorage?: Storage;\n\n /**\n * Settings used to configure an teams sso prompt dialog.\n */\n ssoPromptConfig?: {\n /**\n * Number of milliseconds the prompt will wait for the user to authenticate.\n * Defaults to a value `900,000` (15 minutes.)\n */\n timeout?: number;\n\n /**\n * Value indicating whether the TeamsBotSsoPrompt should end upon receiving an\n * invalid message. Generally the TeamsBotSsoPrompt will end the auth flow when receives user\n * message not related to the auth flow. Setting the flag to false ignores the user's message instead.\n * Defaults to value `true`\n */\n endOnInvalidMessage?: boolean;\n };\n };\n}\n\n/**\n * Options to initialize {@link ConversationBot}\n * @deprecated Please use BotBuilderCloudAdapter.ConversationOptions instead.\n */\nexport interface ConversationOptions {\n /**\n * The bot adapter. If not provided, a default adapter will be created:\n * - with `adapterConfig` as constructor parameter.\n * - with a default error handler that logs error to console, sends trace activity, and sends error message to user.\n *\n * @remarks\n * If neither `adapter` nor `adapterConfig` is provided, will use BOT_ID and BOT_PASSWORD from environment variables.\n */\n adapter?: BotFrameworkAdapter;\n\n /**\n * If `adapter` is not provided, this `adapterConfig` will be passed to the new `BotFrameworkAdapter` when created internally.\n *\n * @remarks\n * If neither `adapter` nor `adapterConfig` is provided, will use BOT_ID and BOT_PASSWORD from environment variables.\n */\n adapterConfig?: { [key: string]: unknown };\n\n /**\n * Configurations for sso command bot\n */\n ssoConfig?: BotSsoConfig;\n\n /**\n * The command part.\n */\n command?: CommandOptions & {\n /**\n * Whether to enable command or not.\n */\n enabled?: boolean;\n };\n\n /**\n * The notification part.\n */\n notification?: NotificationOptions & {\n /**\n * Whether to enable notification or not.\n */\n enabled?: boolean;\n };\n\n /**\n * The adaptive card action handler part.\n */\n cardAction?: CardActionOptions & {\n /**\n * Whether to enable adaptive card actions or not.\n */\n enabled?: boolean;\n };\n}\n\n/**\n * Interface for user to customize SSO execution activity handler\n *\n * @remarks\n * Bot SSO execution activity handler is to handle SSO login process and trigger SSO command using {@link BotSsoExecutionDialog}.\n * You can use this interface to implement your own SSO execution dialog, and pass it to ConversationBot options:\n *\n * ```typescript\n * export const commandBot = new ConversationBot({\n * ...\n * ssoConfig: {\n * ...\n * dialog: {\n * CustomBotSsoExecutionActivityHandler: YourCustomBotSsoExecutionActivityHandler,\n * }\n * },\n * ...\n * });\n * ```\n * For details information about how to implement a BotSsoExecutionActivityHandler, please refer DefaultBotSsoExecutionActivityHandler class source code: https://aka.ms/teamsfx-default-sso-execution-activity-handler\n */\nexport interface BotSsoExecutionActivityHandler {\n /**\n * Add {@link TeamsFxBotSsoCommandHandler} instance to {@link BotSsoExecutionDialog}\n * @param handler {@link BotSsoExecutionDialogHandler} callback function\n * @param triggerPatterns The trigger pattern\n *\n * @remarks\n * This function is used to add SSO command to {@link BotSsoExecutionDialog} instance.\n */\n addCommand(handler: BotSsoExecutionDialogHandler, triggerPatterns: TriggerPatterns): void;\n\n /**\n * Called to initiate the event emission process.\n * @param context The context object for the current turn.\n */\n run(context: TurnContext): Promise<void>;\n\n /**\n * Receives invoke activities with Activity name of 'signin/verifyState'.\n * @param context A context object for this turn.\n * @param query Signin state (part of signin action auth flow) verification invoke query.\n * @returns A promise that represents the work queued.\n *\n * @remarks\n * It should trigger {@link BotSsoExecutionDialog} instance to handle signin process\n */\n handleTeamsSigninVerifyState(\n context: TurnContext,\n query: SigninStateVerificationQuery\n ): Promise<void>;\n\n /**\n * Receives invoke activities with Activity name of 'signin/tokenExchange'\n * @param context A context object for this turn.\n * @param query Signin state (part of signin action auth flow) verification invoke query\n * @returns A promise that represents the work queued.\n *\n * @remarks\n * It should trigger {@link BotSsoExecutionDialog} instance to handle signin process\n */\n handleTeamsSigninTokenExchange(\n context: TurnContext,\n query: SigninStateVerificationQuery\n ): Promise<void>;\n}\n\nexport type BotSsoExecutionDialogHandler = (\n context: TurnContext,\n tokenResponse: TeamsBotSsoPromptTokenResponse,\n message: CommandMessage\n) => Promise<void>;\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { BotFrameworkAdapter, TurnContext, WebRequest, WebResponse } from \"botbuilder\";\nimport { CommandBot } from \"./command.browser\";\nimport { ConversationOptions } from \"./interface\";\nimport { NotificationBot } from \"./notification.browser\";\nimport { ErrorWithCode, ErrorCode, ErrorMessage } from \"../core/errors\";\nimport { formatString } from \"../util/utils\";\n\n/**\n * Provide utilities for bot conversation, including:\n * - handle command and response.\n * - send notification to varies targets (e.g., member, group, channel).\n *\n * @remarks\n * Only work on server side.\n */\n\n/**\n * @deprecated Use `BotBuilderCloudAdapter.ConversationBot` instead.\n */\nexport class ConversationBot {\n /**\n * The bot adapter.\n *\n * @remarks\n * Only work on server side.\n */\n public readonly adapter: BotFrameworkAdapter;\n\n /**\n * The entrypoint of command and response.\n *\n * @remarks\n * Only work on server side.\n */\n public readonly command?: CommandBot;\n\n /**\n * The entrypoint of notification.\n *\n * @remarks\n * Only work on server side.\n */\n public readonly notification?: NotificationBot;\n\n /**\n * Creates new instance of the `ConversationBot`.\n *\n * @param options - initialize options\n *\n * @remarks\n * Only work on server side.\n */\n public constructor(options: ConversationOptions) {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"ConversationBot\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * The request handler to integrate with web request.\n *\n * @param req - an Express or Restify style request object.\n * @param res - an Express or Restify style response object.\n * @param logic - the additional function to handle bot context.\n *\n * @remarks\n * Only work on server side.\n */\n public requestHandler(\n req: WebRequest,\n res: WebResponse,\n logic?: (context: TurnContext) => Promise<any>\n ): Promise<void> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"ConversationBot\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { formatString } from \"../../util/utils\";\nimport { ErrorWithCode, ErrorCode, ErrorMessage } from \"../../core/errors\";\nimport { TeamsFx } from \"../../core/teamsfx.browser\";\nimport { BotSsoExecutionDialogHandler, TriggerPatterns } from \"../interface\";\nimport { StatePropertyAccessor, TurnContext, Storage } from \"botbuilder\";\nimport { OnBehalfOfCredentialAuthConfig } from \"../../models/configuration\";\nimport { TeamsBotSsoPromptSettings } from \"../../index.browser\";\n/*\n * Sso execution dialog, use to handle sso command\n */\nexport class BotSsoExecutionDialog {\n /**\n * Constructor of BotSsoExecutionDialog\n *\n * @remarks\n * Can Only works in in server side.\n */\n constructor(\n dedupStorage: Storage,\n ssoPromptSettings: TeamsBotSsoPromptSettings,\n teamsfx: TeamsFx,\n dialogName?: string\n );\n constructor(\n dedupStorage: Storage,\n ssoPromptSettings: TeamsBotSsoPromptSettings,\n authConfig: OnBehalfOfCredentialAuthConfig,\n initiateLoginEndpoint: string,\n dialogName?: string\n );\n constructor(\n dedupStorage: Storage,\n ssoPromptSettings: TeamsBotSsoPromptSettings,\n authConfig: TeamsFx | OnBehalfOfCredentialAuthConfig,\n ...args: any\n ) {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"BotSsoExecutionDialog\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Add TeamsFxBotSsoCommandHandler instance\n * @param handler {@link BotSsoExecutionDialogHandler} callback function\n * @param triggerPatterns The trigger pattern\n */\n public addCommand(handler: BotSsoExecutionDialogHandler, triggerPatterns: TriggerPatterns): void {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"BotSsoExecutionDialog\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * The run method handles the incoming activity (in the form of a DialogContext) and passes it through the dialog system.\n *\n * @param context The context object for the current turn.\n * @param accessor The instance of StatePropertyAccessor for dialog system.\n */\n public async run(context: TurnContext, accessor: StatePropertyAccessor) {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"BotSsoExecutionDialog\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Called when the component is ending.\n *\n * @param context Context for the current turn of conversation.\n */\n protected async onEndDialog(context: TurnContext) {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"BotSsoExecutionDialog\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n BotFrameworkAdapter,\n ChannelInfo,\n ConversationReference,\n TeamDetails,\n TeamsChannelAccount,\n TurnContext,\n} from \"botbuilder\";\nimport { ErrorWithCode, ErrorCode, ErrorMessage } from \"../core/errors\";\nimport { formatString } from \"../util/utils\";\nimport { MessageResponse, NotificationTarget, NotificationTargetType } from \"./interface\";\nimport { DefaultConversationReferenceStore } from \"./storage\";\n\n/**\n * Send a plain text message to a notification target.\n *\n * @remarks\n * Only work on server side.\n *\n * @param target - the notification target.\n * @param text - the plain text message.\n * @param onError - an optional error handler that can catch exceptions during message sending.\n * @returns A `Promise` representing the asynchronous operation.\n */\nexport function sendMessage(\n target: NotificationTarget,\n text: string,\n onError?: (context: TurnContext, error: Error) => Promise<void>\n): Promise<void> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"sendMessage\"),\n ErrorCode.RuntimeNotSupported\n );\n}\n\n/**\n * Send an adaptive card message to a notification target.\n *\n * @remarks\n * Only work on server side.\n *\n * @param target - the notification target.\n * @param card - the adaptive card raw JSON.\n * @param onError - an optional error handler that can catch exceptions during adaptive card sending.\n * @returns A `Promise` representing the asynchronous operation.\n */\nexport function sendAdaptiveCard(\n target: NotificationTarget,\n card: unknown,\n onError?: (context: TurnContext, error: Error) => Promise<void>\n): Promise<void> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"sendAdaptiveCard\"),\n ErrorCode.RuntimeNotSupported\n );\n}\n\n/**\n * A {@link NotificationTarget} that represents a team channel.\n *\n * @remarks\n * Only work on server side.\n *\n * It's recommended to get channels from {@link TeamsBotInstallation.channels()}.\n */\nexport class Channel implements NotificationTarget {\n /**\n * The parent {@link TeamsBotInstallation} where this channel is created from.\n *\n * @remarks\n * Only work on server side.\n */\n public readonly parent: TeamsBotInstallation;\n\n /**\n * Detailed channel information.\n *\n * @remarks\n * Only work on server side.\n */\n public readonly info: ChannelInfo;\n\n /**\n * Notification target type. For channel it's always \"Channel\".\n *\n * @remarks\n * Only work on server side.\n */\n public readonly type: NotificationTargetType = NotificationTargetType.Channel;\n\n /**\n * Constructor.\n *\n * @remarks\n * Only work on server side.\n *\n * It's recommended to get channels from {@link TeamsBotInstallation.channels()}, instead of using this constructor.\n *\n * @param parent - The parent {@link TeamsBotInstallation} where this channel is created from.\n * @param info - Detailed channel information.\n */\n constructor(parent: TeamsBotInstallation, info: ChannelInfo) {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"Channel\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Send a plain text message.\n *\n * @remarks\n * Only work on server side.\n *\n * @param text - the plain text message.\n * @param onError - an optional error handler that can catch exceptions during message sending.\n * @returns the response of sending message.\n */\n public sendMessage(\n text: string,\n onError?: (context: TurnContext, error: Error) => Promise<void>\n ): Promise<MessageResponse> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"Channel\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Send an adaptive card message.\n *\n * @remarks\n * Only work on server side.\n *\n * @param card - the adaptive card raw JSON.\n * @param onError - an optional error handler that can catch exceptions during adaptive card sending.\n * @returns the response of sending adaptive card message.\n */\n public sendAdaptiveCard(\n card: unknown,\n onError?: (context: TurnContext, error: Error) => Promise<void>\n ): Promise<MessageResponse> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"Channel\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n}\n\n/**\n * A {@link NotificationTarget} that represents a team member.\n *\n * @remarks\n * Only work on server side.\n *\n * It's recommended to get members from {@link TeamsBotInstallation.members()}.\n */\nexport class Member implements NotificationTarget {\n /**\n * The parent {@link TeamsBotInstallation} where this member is created from.\n *\n * @remarks\n * Only work on server side.\n */\n public readonly parent: TeamsBotInstallation;\n\n /**\n * Detailed member account information.\n *\n * @remarks\n * Only work on server side.\n */\n public readonly account: TeamsChannelAccount;\n\n /**\n * Notification target type. For member it's always \"Person\".\n *\n * @remarks\n * Only work on server side.\n */\n public readonly type: NotificationTargetType = NotificationTargetType.Person;\n\n /**\n * Constructor.\n *\n * @remarks\n * Only work on server side.\n *\n * It's recommended to get members from {@link TeamsBotInstallation.members()}, instead of using this constructor.\n *\n * @param parent - The parent {@link TeamsBotInstallation} where this member is created from.\n * @param account - Detailed member account information.\n */\n constructor(parent: TeamsBotInstallation, account: TeamsChannelAccount) {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"Member\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Send a plain text message.\n *\n * @remarks\n * Only work on server side.\n *\n * @param text - the plain text message.\n * @param onError - an optional error handler that can catch exceptions during message sending.\n * @returns the response of sending message.\n */\n public sendMessage(\n text: string,\n onError?: (context: TurnContext, error: Error) => Promise<void>\n ): Promise<MessageResponse> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"Member\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Send an adaptive card message.\n *\n * @remarks\n * Only work on server side.\n *\n * @param card - the adaptive card raw JSON.\n * @param onError - an optional error handler that can catch exceptions during adaptive card sending.\n * @returns the response of sending adaptive card message.\n */\n public sendAdaptiveCard(\n card: unknown,\n onError?: (context: TurnContext, error: Error) => Promise<void>\n ): Promise<MessageResponse> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"Member\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n}\n\n/**\n * A {@link NotificationTarget} that represents a bot installation. Teams Bot could be installed into\n * - Personal chat\n * - Group chat\n * - Team (by default the `General` channel)\n *\n * @remarks\n * Only work on server side.\n *\n * It's recommended to get bot installations from {@link ConversationBot.installations()}.\n */\n\n/**\n * @deprecated Use `BotBuilderCloudAdapter.TeamsBotInstallation` instead.\n */\nexport class TeamsBotInstallation implements NotificationTarget {\n /**\n * The bound `BotFrameworkAdapter`.\n *\n * @remarks\n * Only work on server side.\n */\n public readonly adapter: BotFrameworkAdapter;\n\n /**\n * The bound `ConversationReference`.\n *\n * @remarks\n * Only work on server side.\n */\n public readonly conversationReference: Partial<ConversationReference>;\n\n /**\n * Notification target type.\n *\n * @remarks\n * Only work on server side.\n * - \"Channel\" means bot is installed into a team and notification will be sent to its \"General\" channel.\n * - \"Group\" means bot is installed into a group chat.\n * - \"Person\" means bot is installed into a personal scope and notification will be sent to personal chat.\n */\n public readonly type?: NotificationTargetType;\n\n /**\n * Constructor\n *\n * @remarks\n * Only work on server side.\n *\n * It's recommended to get bot installations from {@link ConversationBot.installations()}, instead of using this constructor.\n *\n * @param adapter - the bound `BotFrameworkAdapter`.\n * @param conversationReference - the bound `ConversationReference`.\n */\n constructor(adapter: BotFrameworkAdapter, conversationReference: Partial<ConversationReference>) {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"TeamsBotInstallation\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Send a plain text message.\n *\n * @remarks\n * Only work on server side.\n *\n * @param text - the plain text message.\n * @param onError - an optional error handler that can catch exceptions during message sending.\n * @returns the response of sending message.\n */\n public sendMessage(\n text: string,\n onError?: (context: TurnContext, error: Error) => Promise<void>\n ): Promise<MessageResponse> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"TeamsBotInstallation\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Send an adaptive card message.\n *\n * @remarks\n * Only work on server side.\n *\n * @param card - the adaptive card raw JSON.\n * @param onError - an optional error handler that can catch exceptions during adaptive card sending.\n * @returns the response of sending adaptive card message.\n */\n public sendAdaptiveCard(\n card: unknown,\n onError?: (context: TurnContext, error: Error) => Promise<void>\n ): Promise<MessageResponse> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"TeamsBotInstallation\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Get channels from this bot installation.\n *\n * @remarks\n * Only work on server side.\n *\n * @returns an array of channels if bot is installed into a team, otherwise returns an empty array.\n */\n public channels(): Promise<Channel[]> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"TeamsBotInstallation\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Get members from this bot installation.\n *\n * @remarks\n * Only work on server side.\n *\n * @returns an array of members from where the bot is installed.\n */\n public members(): Promise<Member[]> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"TeamsBotInstallation\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Get team details from this bot installation\n *\n * @returns the team details if bot is installed into a team, otherwise returns undefined.\n */\n public getTeamDetails(): Promise<TeamDetails | undefined> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"TeamsBotInstallation\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n}\n\n/**\n * Provide static utilities for bot notification.\n *\n * @remarks\n * Only work on server side.\n *\n * @example\n * Here's an example on how to send notification via Teams Bot.\n * ```typescript\n * // initialize (it's recommended to be called before handling any bot message)\n * const notificationBot = new NotificationBot(adapter);\n *\n * // get all bot installations and send message\n * for (const target of await notificationBot.installations()) {\n * await target.sendMessage(\"Hello Notification\");\n * }\n *\n * // alternative - send message to all members\n * for (const target of await notificationBot.installations()) {\n * for (const member of await target.members()) {\n * await member.sendMessage(\"Hello Notification\");\n * }\n * }\n * ```\n */\n\n/**\n * @deprecated Use `BotBuilderCloudAdapter.NotificationBot` instead.\n */\nexport class NotificationBot {\n private readonly conversationReferenceStore: DefaultConversationReferenceStore;\n private readonly adapter: BotFrameworkAdapter;\n\n /**\n * constructor of the notification bot.\n *\n * @remarks\n * Only work on server side.\n *\n * To ensure accuracy, it's recommended to initialize before handling any message.\n *\n * @param adapter - the bound `BotFrameworkAdapter`\n * @param options - initialize options\n */\n public constructor(adapter: BotFrameworkAdapter, options?: NotificationOptions) {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"NotificationBot\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Get all targets where the bot is installed.\n *\n * @remarks\n * Only work on server side.\n *\n * The result is retrieving from the persisted storage.\n *\n * @returns - an array of {@link TeamsBotInstallation}.\n */\n public static installations(): Promise<TeamsBotInstallation[]> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"NotificationBot\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Returns the first {@link Member} where predicate is true, and undefined otherwise.\n *\n * @remarks\n * Only work on server side.\n *\n * @param predicate find calls predicate once for each member of the installation,\n * until it finds one where predicate returns true. If such a member is found, find\n * immediately returns that member. Otherwise, find returns undefined.\n * @param scope the scope to find members from the installations\n * (personal chat, group chat, Teams channel).\n * @returns the first {@link Member} where predicate is true, and undefined otherwise.\n */\n public findMember(\n predicate: (member: Member) => Promise<boolean>,\n scope?: SearchScope\n ): Promise<Member | undefined> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"NotificationBot\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Returns the first {@link Channel} where predicate is true, and undefined otherwise.\n * (Ensure the bot app is installed into the `General` channel, otherwise undefined will be returned.)\n *\n * @remarks\n * Only work on server side.\n *\n * @param predicate find calls predicate once for each channel of the installation,\n * until it finds one where predicate returns true. If such a channel is found, find\n * immediately returns that channel. Otherwise, find returns undefined.\n * @returns the first {@link Channel} where predicate is true, and undefined otherwise.\n */\n public findChannel(\n predicate: (channel: Channel, teamDetails: TeamDetails | undefined) => Promise<boolean>\n ): Promise<Channel | undefined> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"NotificationBot\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Returns all {@link Member} where predicate is true, and empty array otherwise.\n *\n * @remarks\n * Only work on server side.\n *\n * @param predicate find calls predicate for each member of the installation.\n * @param scope the scope to find members from the installations\n * (personal chat, group chat, Teams channel).\n * @returns an array of {@link Member} where predicate is true, and empty array otherwise.\n */\n public findAllMembers(\n predicate: (member: Member) => Promise<boolean>,\n scope?: SearchScope\n ): Promise<Member[]> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"NotificationBot\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Returns all {@link Channel} where predicate is true, and empty array otherwise.\n * (Ensure the bot app is installed into the `General` channel, otherwise empty array will be returned.)\n *\n * @remarks\n * Only work on server side.\n *\n * @param predicate find calls predicate for each channel of the installation.\n * @returns an array of {@link Channel} where predicate is true, and empty array otherwise.\n */\n public findAllChannels(\n predicate: (channel: Channel, teamDetails: TeamDetails | undefined) => Promise<boolean>\n ): Promise<Channel[]> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"NotificationBot\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n}\n\n/**\n * The search scope when calling {@link NotificationBot.findMember} and {@link NotificationBot.findAllMembers}.\n * The search scope is a flagged enum and it can be combined with `|`.\n * For example, to search from personal chat and group chat, use `SearchScope.Person | SearchScope.Group`.\n */\nexport enum SearchScope {\n /**\n * Search members from the installations in personal chat only.\n */\n Person = 1,\n\n /**\n * Search members from the installations in group chat only.\n */\n Group = 2,\n\n /**\n * Search members from the installations in Teams channel only.\n */\n Channel = 4,\n\n /**\n * Search members from all installations including personal chat, group chat and Teams channel.\n */\n All = Person | Group | Channel,\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { BotFrameworkAdapter } from \"botbuilder\";\nimport { ErrorWithCode, ErrorCode, ErrorMessage } from \"../core/errors\";\nimport { formatString } from \"../util/utils\";\nimport { TeamsFxBotCommandHandler, TeamsFxBotSsoCommandHandler } from \"./interface\";\nimport { CommandResponseMiddleware } from \"./middlewares/commandMiddleware\";\n\n/**\n * A command bot for receiving commands and sending responses in Teams.\n *\n * @remarks\n * Only work on server side.\n */\n\n/**\n * @deprecated Use `BotBuilderCloudAdapter.CommandBot` instead.\n */\nexport class CommandBot {\n private readonly adapter: BotFrameworkAdapter;\n private readonly middleware: CommandResponseMiddleware;\n\n /**\n * Creates a new instance of the `CommandBot`.\n *\n * @param adapter The bound `BotFrameworkAdapter`.\n * @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.\n */\n constructor(adapter: BotFrameworkAdapter, commands?: TeamsFxBotCommandHandler[]) {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"CommandBot\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Registers a command into the command bot.\n *\n * @param command The command to registered.\n *\n * @remarks\n * Only work on server side.\n */\n public registerCommand(command: TeamsFxBotCommandHandler): void {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"CommandBot\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Registers commands into the command bot.\n *\n * @param commands The command to registered.\n *\n * @remarks\n * Only work on server side.\n */\n public registerCommands(commands: TeamsFxBotCommandHandler[]): void {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"CommandBot\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Registers a sso command into the command bot.\n *\n * @param command The command to register.\n */\n public registerSsoCommand(ssoCommand: TeamsFxBotSsoCommandHandler): void {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"CommandBot\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Registers commands into the command bot.\n *\n * @param commands The commands to register.\n */\n public registerSsoCommands(ssoCommands: TeamsFxBotSsoCommandHandler[]): void {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"CommandBot\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n}\n","import { BotFrameworkAdapter } from \"botbuilder\";\nimport { CardActionMiddleware } from \"./middlewares/cardActionMiddleware\";\nimport { CardActionOptions, TeamsFxAdaptiveCardActionHandler } from \"./interface\";\nimport { ErrorWithCode, ErrorCode, ErrorMessage } from \"../core/errors\";\nimport { formatString } from \"../util/utils\";\n\n/**\n * A card action bot to respond to adaptive card universal actions.\n *\n * @remarks\n * Only work on server side.\n */\n\n/**\n * @deprecated Use `BotBuilderCloudAdapter.CardActionBot` instead.\n */\nexport class CardActionBot {\n private readonly adapter: BotFrameworkAdapter;\n private middleware: CardActionMiddleware;\n\n /**\n * Creates a new instance of the `CardActionBot`.\n *\n * @param adapter The bound `BotFrameworkAdapter`.\n * @param options - initialize options\n */\n constructor(adapter: BotFrameworkAdapter, options?: CardActionOptions) {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"CardActionBot\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Registers a card action handler to the bot.\n * @param actionHandler A card action handler to be registered.\n *\n * @remarks\n * Only work on server side.\n */\n registerHandler(actionHandler: TeamsFxAdaptiveCardActionHandler) {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"CardActionBot\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Registers card action handlers to the bot.\n * @param actionHandlers A set of card action handlers to be registered.\n *\n * @remarks\n * Only work on server side.\n */\n registerHandlers(actionHandlers: TeamsFxAdaptiveCardActionHandler[]) {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"CardActionBot\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\nimport { TurnContext, MessagingExtensionResponse } from \"botbuilder\";\nimport {\n AuthenticationConfiguration,\n OnBehalfOfCredentialAuthConfig,\n} from \"../models/configuration\";\nimport { MessageExtensionTokenResponse } from \"./teamsMsgExtTokenResponse\";\nimport { ErrorWithCode, ErrorMessage, ErrorCode } from \"../core/errors\";\nimport { formatString } from \"../util/utils\";\n\n// eslint-disable-next-line no-secrets/no-secrets\n/**\n * Users execute query with SSO or Access Token.\n * @deprecated\n * @remarks\n * Only works in in server side.\n */\nexport function handleMessageExtensionQueryWithToken(\n context: TurnContext,\n config: AuthenticationConfiguration,\n scopes: string | string[],\n logic: (token: MessageExtensionTokenResponse) => Promise<any>\n): Promise<MessagingExtensionResponse | void> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"queryWithToken in message extension\"),\n ErrorCode.RuntimeNotSupported\n );\n}\n\n/**\n * Users execute query with SSO or Access Token.\n * @remarks\n * Only works in in server side.\n */\nexport function handleMessageExtensionQueryWithSSO(\n context: TurnContext,\n config: OnBehalfOfCredentialAuthConfig,\n initiateLoginEndpoint: string,\n scopes: string | string[],\n logic: (token: MessageExtensionTokenResponse) => Promise<any>\n) {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"queryWithToken in message extension\"),\n ErrorCode.RuntimeNotSupported\n );\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { CloudAdapter, TurnContext, Request, Response } from \"botbuilder\";\nimport { CommandBot } from \"./command.browser\";\nimport { ConversationOptions } from \"./interface\";\nimport { NotificationBot } from \"./notification.browser\";\nimport { ErrorWithCode, ErrorCode, ErrorMessage } from \"../core/errors\";\nimport { formatString } from \"../util/utils\";\n\n/**\n * Provide utilities for bot conversation, including:\n * - handle command and response.\n * - send notification to varies targets (e.g., member, group, channel).\n *\n * @remarks\n * Only work on server side.\n */\nexport class ConversationBot {\n /**\n * The bot adapter.\n *\n * @remarks\n * Only work on server side.\n */\n public readonly adapter: CloudAdapter;\n\n /**\n * The entrypoint of command and response.\n *\n * @remarks\n * Only work on server side.\n */\n public readonly command?: CommandBot;\n\n /**\n * The entrypoint of notification.\n *\n * @remarks\n * Only work on server side.\n */\n public readonly notification?: NotificationBot;\n\n /**\n * Create new instance of the `ConversationBot`.\n *\n * @param options - The initialize options.\n *\n * @remarks\n * Only work on server side.\n */\n public constructor(options: ConversationOptions) {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"ConversationBot\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * The request handler to integrate with web request.\n *\n * @param req - An incoming HTTP [Request](xref:botbuilder.Request).\n * @param res - The corresponding HTTP [Response](xref:botbuilder.Response).\n * @param logic - The additional function to handle bot context.\n *\n * @remarks\n * Only work on server side.\n */\n public requestHandler(\n req: Request,\n res: Response,\n logic?: (context: TurnContext) => Promise<any>\n ): Promise<void> {\n return Promise.reject(\n new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"ConversationBot\"),\n ErrorCode.RuntimeNotSupported\n )\n );\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n CloudAdapter,\n ChannelInfo,\n ConversationReference,\n TeamDetails,\n TeamsChannelAccount,\n TurnContext,\n} from \"botbuilder\";\nimport { ErrorWithCode, ErrorCode, ErrorMessage } from \"../core/errors\";\nimport { formatString } from \"../util/utils\";\nimport {\n MessageResponse,\n NotificationTarget,\n NotificationTargetType,\n ConversationReferenceStore,\n} from \"../conversation/interface\";\n\n/**\n * Send a plain text message to a notification target.\n *\n * @remarks\n * Only work on server side.\n *\n * @param target - The notification target.\n * @param text - The plain text message.\n * @param onError - An optional error handler that can catch exceptions during message sending.\n *\n * @returns A `Promise` representing the asynchronous operation.\n */\nexport function sendMessage(\n target: NotificationTarget,\n text: string,\n onError?: (context: TurnContext, error: Error) => Promise<void>\n): Promise<void> {\n return Promise.reject(\n new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"sendMessage\"),\n ErrorCode.RuntimeNotSupported\n )\n );\n}\n\n/**\n * Send an adaptive card message to a notification target.\n *\n * @remarks\n * Only work on server side.\n *\n * @param target - The notification target.\n * @param card - The adaptive card raw JSON.\n * @param onError - An optional error handler that can catch exceptions during adaptive card sending.\n *\n * @returns A `Promise` representing the asynchronous operation.\n */\nexport function sendAdaptiveCard(\n target: NotificationTarget,\n card: unknown,\n onError?: (context: TurnContext, error: Error) => Promise<void>\n): Promise<void> {\n return Promise.reject(\n new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"sendAdaptiveCard\"),\n ErrorCode.RuntimeNotSupported\n )\n );\n}\n\n/**\n * A {@link NotificationTarget} that represents a team channel.\n *\n * @remarks\n * Only work on server side.\n *\n * It's recommended to get channels from {@link TeamsBotInstallation.channels()}.\n */\nexport class Channel implements NotificationTarget {\n /**\n * The parent {@link TeamsBotInstallation} where this channel is created from.\n *\n * @remarks\n * Only work on server side.\n */\n public readonly parent: TeamsBotInstallation;\n\n /**\n * Detailed channel information.\n *\n * @remarks\n * Only work on server side.\n */\n public readonly info: ChannelInfo;\n\n /**\n * Notification target type. For channel it's always \"Channel\".\n *\n * @remarks\n * Only work on server side.\n */\n public readonly type: NotificationTargetType = NotificationTargetType.Channel;\n\n /**\n * Constructor.\n *\n * @remarks\n * Only work on server side.\n *\n * It's recommended to get channels from {@link TeamsBotInstallation.channels()}, instead of using this constructor.\n *\n * @param parent - The parent {@link TeamsBotInstallation} where this channel is created from.\n * @param info - Detailed channel information.\n */\n constructor(parent: TeamsBotInstallation, info: ChannelInfo) {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"Channel\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Send a plain text message.\n *\n * @remarks\n * Only work on server side.\n *\n * @param text - The plain text message.\n * @param onError - An optional error handler that can catch exceptions during message sending.\n *\n * @returns The response of sending message.\n */\n public sendMessage(\n text: string,\n onError?: (context: TurnContext, error: Error) => Promise<void>\n ): Promise<MessageResponse> {\n return Promise.reject(\n new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"Channel\"),\n ErrorCode.RuntimeNotSupported\n )\n );\n }\n\n /**\n * Send an adaptive card message.\n *\n * @remarks\n * Only work on server side.\n *\n * @param card - The adaptive card raw JSON.\n * @param onError - An optional error handler that can catch exceptions during adaptive card sending.\n *\n * @returns The response of sending adaptive card message.\n */\n public sendAdaptiveCard(\n card: unknown,\n onError?: (context: TurnContext, error: Error) => Promise<void>\n ): Promise<MessageResponse> {\n return Promise.reject(\n new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"Channel\"),\n ErrorCode.RuntimeNotSupported\n )\n );\n }\n}\n\n/**\n * A {@link NotificationTarget} that represents a team member.\n *\n * @remarks\n * Only work on server side.\n *\n * It's recommended to get members from {@link TeamsBotInstallation.members()}.\n */\nexport class Member implements NotificationTarget {\n /**\n * The parent {@link TeamsBotInstallation} where this member is created from.\n *\n * @remarks\n * Only work on server side.\n */\n public readonly parent: TeamsBotInstallation;\n\n /**\n * Detailed member account information.\n *\n * @remarks\n * Only work on server side.\n */\n public readonly account: TeamsChannelAccount;\n\n /**\n * Notification target type. For member it's always \"Person\".\n *\n * @remarks\n * Only work on server side.\n */\n public readonly type: NotificationTargetType = NotificationTargetType.Person;\n\n /**\n * Constructor.\n *\n * @remarks\n * Only work on server side.\n *\n * It's recommended to get members from {@link TeamsBotInstallation.members()}, instead of using this constructor.\n *\n * @param parent - The parent {@link TeamsBotInstallation} where this member is created from.\n * @param account - Detailed member account information.\n */\n constructor(parent: TeamsBotInstallation, account: TeamsChannelAccount) {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"Member\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Send a plain text message.\n *\n * @remarks\n * Only work on server side.\n *\n * @param text - The plain text message.\n * @param onError - An optional error handler that can catch exceptions during message sending.\n *\n * @returns The response of sending message.\n */\n public sendMessage(\n text: string,\n onError?: (context: TurnContext, error: Error) => Promise<void>\n ): Promise<MessageResponse> {\n return Promise.reject(\n new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"Member\"),\n ErrorCode.RuntimeNotSupported\n )\n );\n }\n\n /**\n * Send an adaptive card message.\n *\n * @remarks\n * Only work on server side.\n *\n * @param card - The adaptive card raw JSON.\n * @param onError - An optional error handler that can catch exceptions during adaptive card sending.\n *\n * @returns The response of sending adaptive card message.\n */\n public sendAdaptiveCard(\n card: unknown,\n onError?: (context: TurnContext, error: Error) => Promise<void>\n ): Promise<MessageResponse> {\n return Promise.reject(\n Promise.reject(\n new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"Member\"),\n ErrorCode.RuntimeNotSupported\n )\n )\n );\n }\n}\n\n/**\n * A {@link NotificationTarget} that represents a bot installation. Teams Bot could be installed into\n * - Personal chat\n * - Group chat\n * - Team (by default the `General` channel)\n *\n * @remarks\n * Only work on server side.\n *\n * It's recommended to get bot installations from {@link ConversationBot.installations()}.\n */\nexport class TeamsBotInstallation implements NotificationTarget {\n /**\n * The bound `CloudAdapter`.\n *\n * @remarks\n * Only work on server side.\n */\n public readonly adapter: CloudAdapter;\n\n /**\n * The bound `ConversationReference`.\n *\n * @remarks\n * Only work on server side.\n */\n public readonly conversationReference: Partial<ConversationReference>;\n\n /**\n * Notification target type.\n *\n * @remarks\n * Only work on server side.\n * - \"Channel\" means bot is installed into a team and notification will be sent to its \"General\" channel.\n * - \"Group\" means bot is installed into a group chat.\n * - \"Person\" means bot is installed into a personal scope and notification will be sent to personal chat.\n */\n public readonly type?: NotificationTargetType;\n\n /**\n * Constructor\n *\n * @remarks\n * Only work on server side.\n *\n * It's recommended to get bot installations from {@link ConversationBot.installations()}, instead of using this constructor.\n *\n * @param adapter - The bound `CloudAdapter`.\n * @param conversationReference - The bound `ConversationReference`.\n */\n constructor(adapter: CloudAdapter, conversationReference: Partial<ConversationReference>) {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"TeamsBotInstallation\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Send a plain text message.\n *\n * @remarks\n * Only work on server side.\n *\n * @param text - The plain text message.\n * @param onError - An optional error handler that can catch exceptions during message sending.\n *\n * @returns The response of sending message.\n */\n public sendMessage(\n text: string,\n onError?: (context: TurnContext, error: Error) => Promise<void>\n ): Promise<MessageResponse> {\n return Promise.reject(\n new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"TeamsBotInstallation\"),\n ErrorCode.RuntimeNotSupported\n )\n );\n }\n\n /**\n * Send an adaptive card message.\n *\n * @remarks\n * Only work on server side.\n *\n * @param card - The adaptive card raw JSON.\n * @param onError - An optional error handler that can catch exceptions during adaptive card sending.\n *\n * @returns The response of sending adaptive card message.\n */\n public sendAdaptiveCard(\n card: unknown,\n onError?: (context: TurnContext, error: Error) => Promise<void>\n ): Promise<MessageResponse> {\n return Promise.reject(\n new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"TeamsBotInstallation\"),\n ErrorCode.RuntimeNotSupported\n )\n );\n }\n\n /**\n * Get channels from this bot installation.\n *\n * @remarks\n * Only work on server side.\n *\n * @returns An array of channels if bot is installed into a team, otherwise returns an empty array.\n */\n public channels(): Promise<Channel[]> {\n return Promise.reject(\n new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"TeamsBotInstallation\"),\n ErrorCode.RuntimeNotSupported\n )\n );\n }\n\n /**\n * Get members from this bot installation.\n *\n * @remarks\n * Only work on server side.\n *\n * @returns An array of members from where the bot is installed.\n */\n public members(): Promise<Member[]> {\n return Promise.reject(\n new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"TeamsBotInstallation\"),\n ErrorCode.RuntimeNotSupported\n )\n );\n }\n\n /**\n * Get team details from this bot installation\n *\n * @returns The team details if bot is installed into a team, otherwise returns undefined.\n */\n public getTeamDetails(): Promise<TeamDetails | undefined> {\n return Promise.reject(\n new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"TeamsBotInstallation\"),\n ErrorCode.RuntimeNotSupported\n )\n );\n }\n}\n\n/**\n * Provide static utilities for bot notification.\n *\n * @remarks\n * Only work on server side.\n *\n * @example\n * Here's an example on how to send notification via Teams Bot.\n * ```typescript\n * // initialize (it's recommended to be called before handling any bot message)\n * const notificationBot = new NotificationBot(adapter);\n *\n * // get all bot installations and send message\n * for (const target of await notificationBot.installations()) {\n * await target.sendMessage(\"Hello Notification\");\n * }\n *\n * // alternative - send message to all members\n * for (const target of await notificationBot.installations()) {\n * for (const member of await target.members()) {\n * await member.sendMessage(\"Hello Notification\");\n * }\n * }\n * ```\n */\nexport class NotificationBot {\n private readonly conversationReferenceStore: ConversationReferenceStore;\n private readonly adapter: CloudAdapter;\n\n /**\n * Constructor of the notification bot.\n *\n * @remarks\n * Only work on server side.\n *\n * To ensure accuracy, it's recommended to initialize before handling any message.\n *\n * @param adapter - The bound `CloudAdapter`\n * @param options - The initialize options\n */\n public constructor(adapter: CloudAdapter, options?: NotificationOptions) {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"NotificationBot\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Get all targets where the bot is installed.\n *\n * @remarks\n * Only work on server side.\n *\n * The result is retrieving from the persisted storage.\n *\n * @returns An array of {@link TeamsBotInstallation}.\n */\n public static installations(): Promise<TeamsBotInstallation[]> {\n return Promise.reject(\n new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"NotificationBot\"),\n ErrorCode.RuntimeNotSupported\n )\n );\n }\n\n /**\n * Return the first {@link Member} where predicate is true, and undefined otherwise.\n *\n * @remarks\n * Only work on server side.\n *\n * @param predicate find calls predicate once for each member of the installation,\n * until it finds one where predicate returns true. If such a member is found,\n * find immediately returns that member. Otherwise, find returns undefined.\n * @param scope the scope to find members from the installations (personal chat, group chat, Teams channel).\n *\n * @returns The first {@link Member} where predicate is true, and undefined otherwise.\n */\n public findMember(\n predicate: (member: Member) => Promise<boolean>,\n scope?: SearchScope\n ): Promise<Member | undefined> {\n return Promise.reject(\n new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"NotificationBot\"),\n ErrorCode.RuntimeNotSupported\n )\n );\n }\n\n /**\n * Return the first {@link Channel} where predicate is true, and undefined otherwise.\n * (Ensure the bot app is installed into the `General` channel, otherwise undefined will be returned.)\n *\n * @remarks\n * Only work on server side.\n *\n * @param predicate - Find calls predicate once for each channel of the installation,\n * until it finds one where predicate returns true. If such a channel is found, find\n * immediately returns that channel. Otherwise, find returns undefined.\n *\n * @returns The first {@link Channel} where predicate is true, and `undefined` otherwise.\n */\n public findChannel(\n predicate: (channel: Channel, teamDetails: TeamDetails | undefined) => Promise<boolean>\n ): Promise<Channel | undefined> {\n return Promise.reject(\n new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"NotificationBot\"),\n ErrorCode.RuntimeNotSupported\n )\n );\n }\n\n /**\n * Return all {@link Member} where predicate is true, and empty array otherwise.\n *\n * @remarks\n * Only work on server side.\n *\n * @param predicate - Find calls predicate for each member of the installation.\n * @param scope - The scope to find members from the installations.\n * (personal chat, group chat, Teams channel).\n *\n * @returns An array of {@link Member} where predicate is true, and empty array otherwise.\n */\n public findAllMembers(\n predicate: (member: Member) => Promise<boolean>,\n scope?: SearchScope\n ): Promise<Member[]> {\n return Promise.reject(\n new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"NotificationBot\"),\n ErrorCode.RuntimeNotSupported\n )\n );\n }\n\n /**\n * Return all {@link Channel} where predicate is true, and empty array otherwise.\n * (Ensure the bot app is installed into the `General` channel, otherwise empty array will be returned.)\n *\n * @remarks\n * Only work on server side.\n *\n * @param predicate - Find calls predicate for each channel of the installation.\n *\n * @returns An array of {@link Channel} where predicate is true, and empty array otherwise.\n */\n public findAllChannels(\n predicate: (channel: Channel, teamDetails: TeamDetails | undefined) => Promise<boolean>\n ): Promise<Channel[]> {\n return Promise.reject(\n new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"NotificationBot\"),\n ErrorCode.RuntimeNotSupported\n )\n );\n }\n}\n\n/**\n * The search scope when calling {@link NotificationBot.findMember} and {@link NotificationBot.findAllMembers}.\n * The search scope is a flagged enum and it can be combined with `|`.\n * For example, to search from personal chat and group chat, use `SearchScope.Person | SearchScope.Group`.\n */\nexport enum SearchScope {\n /**\n * Search members from the installations in personal chat only.\n */\n Person = 1,\n\n /**\n * Search members from the installations in group chat only.\n */\n Group = 2,\n\n /**\n * Search members from the installations in Teams channel only.\n */\n Channel = 4,\n\n /**\n * Search members from all installations including personal chat, group chat and Teams channel.\n */\n All = Person | Group | Channel,\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { CloudAdapter } from \"botbuilder\";\nimport { ErrorWithCode, ErrorCode, ErrorMessage } from \"../core/errors\";\nimport { formatString } from \"../util/utils\";\nimport { TeamsFxBotCommandHandler, TeamsFxBotSsoCommandHandler } from \"../conversation/interface\";\nimport { CommandResponseMiddleware } from \"../conversation/middlewares/commandMiddleware\";\n\n/**\n * A command bot for receiving commands and sending responses in Teams.\n *\n * @remarks\n * Only work on server side.\n */\nexport class CommandBot {\n private readonly adapter: CloudAdapter;\n private readonly middleware: CommandResponseMiddleware;\n\n /**\n * Create a new instance of the `CommandBot`.\n *\n * @param adapter - The bound `CloudAdapter`.\n * @param commands - The commands to be registered with the command bot. Each command should implement the interface {@link TeamsFxBotCommandHandler} so that it can be correctly handled by this command bot.\n */\n constructor(adapter: CloudAdapter, commands?: TeamsFxBotCommandHandler[]) {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"CommandBot\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Register a command into the command bot.\n *\n * @param command - The command to be registered.\n *\n * @remarks\n * Only work on server side.\n */\n public registerCommand(command: TeamsFxBotCommandHandler): void {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"CommandBot\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Register commands into the command bot.\n *\n * @param commands - The commands to be registered.\n *\n * @remarks\n * Only work on server side.\n */\n public registerCommands(commands: TeamsFxBotCommandHandler[]): void {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"CommandBot\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Register a sso command into the command bot.\n *\n * @param ssoCommand - The sso command to be registered.\n */\n public registerSsoCommand(ssoCommand: TeamsFxBotSsoCommandHandler): void {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"CommandBot\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Register sso commands into the command bot.\n *\n * @param ssoCommands - The sso commands to be registered.\n */\n public registerSsoCommands(ssoCommands: TeamsFxBotSsoCommandHandler[]): void {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"CommandBot\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\nimport { CloudAdapter } from \"botbuilder\";\nimport { CardActionMiddleware } from \"../conversation/middlewares/cardActionMiddleware\";\nimport { CardActionOptions, TeamsFxAdaptiveCardActionHandler } from \"../conversation/interface\";\nimport { ErrorWithCode, ErrorCode, ErrorMessage } from \"../core/errors\";\nimport { formatString } from \"../util/utils\";\n\n/**\n * A card action bot to respond to adaptive card universal actions.\n *\n * @remarks\n * Only work on server side.\n */\nexport class CardActionBot {\n private readonly adapter: CloudAdapter;\n private middleware: CardActionMiddleware;\n\n /**\n * Create a new instance of the `CardActionBot`.\n *\n * @param adapter - The bound `CloudAdapter`.\n * @param options - The initialize options.\n */\n constructor(adapter: CloudAdapter, options?: CardActionOptions) {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"CardActionBot\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Register a card action handler to the bot.\n *\n * @param actionHandler - A card action handler to be registered.\n *\n * @remarks\n * Only work on server side.\n */\n registerHandler(actionHandler: TeamsFxAdaptiveCardActionHandler) {\n return Promise.reject(\n new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"CardActionBot\"),\n ErrorCode.RuntimeNotSupported\n )\n );\n }\n\n /**\n * Register card action handlers to the bot.\n *\n * @param actionHandlers - A set of card action handlers to be registered.\n *\n * @remarks\n * Only work on server side.\n */\n registerHandlers(actionHandlers: TeamsFxAdaptiveCardActionHandler[]) {\n return Promise.reject(\n new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"CardActionBot\"),\n ErrorCode.RuntimeNotSupported\n )\n );\n }\n}\n"],"names":["ConversationBot","sendMessage","sendAdaptiveCard","Channel","Member","TeamsBotInstallation","NotificationBot","SearchScope","CommandBot","CardActionBot"],"mappings":";;;;;;AAAA;AACA;AAEA;;;IAGY;AAAZ,WAAY,SAAS;;;;IAInB,kDAAqC,CAAA;;;;IAKrC,0DAA6C,CAAA;;;;IAK7C,sDAAyC,CAAA;;;;IAKzC,4CAA+B,CAAA;;;;IAK/B,wDAA2C,CAAA;;;;IAK3C,kEAAqD,CAAA;;;;IAKrD,oEAAuD,CAAA;;;;IAKvD,oDAAuC,CAAA;;;;IAKvC,sDAAyC,CAAA;;;;IAKzC,0DAA6C,CAAA;;;;IAK7C,4EAA+D,CAAA;;;;IAK/D,wDAA2C,CAAA;;;;IAK3C,4CAA+B,CAAA;;;;IAK/B,gDAAmC,CAAA;;;;IAKnC,oDAAuC,CAAA;;;;IAKvC,0CAA6B,CAAA;;;;IAK7B,gDAAmC,CAAA;;;;IAKnC,gDAAmC,CAAA;;;;IAKnC,kEAAqD,CAAA;;;;IAKrD,8EAAiE,CAAA;AACnE,CAAC,EApGW,SAAS,KAAT,SAAS,QAoGpB;AAED;;;MAGa,YAAY;;AACvB;AACgB,iCAAoB,GAAG,uCAAuC,CAAC;AAC/D,mCAAsB,GAAG,mCAAmC,CAAC;AAC7D,2CAA8B,GAAG,4CAA4C,CAAC;AAC9E,yCAA4B,GAC1C,2DAA2D,CAAC;AAC9C,iDAAoC,GAClD,8CAA8C,CAAC;AAEjD;AACgB,uCAA0B,GAAG,kCAAkC,CAAC;AAChE,sCAAyB,GAAG,+BAA+B,CAAC;AAE5E;AACgB,6CAAgC,GAC9C,uDAAuD,CAAC;AAE1D;AACgB,wCAA2B,GAAG,2CAA2C,CAAC;AAE1E,sCAAyB,GAAG,o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