@microsoft/teamsfx 1.0.0 → 2.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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/conversation.browser.ts","../src/conversation/notification.browser.ts","../src/conversation/command.browser.ts"],"sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * Error code to trace the error types.\n * @beta\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 * 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 // 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}\n\n/**\n * Error class with code and message thrown by the SDK.\n *\n * @beta\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 * @beta\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 * @beta\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 *\n * @beta\n */\nexport type LogFunction = (level: LogLevel, message: string) => void;\n\n/**\n * Log level.\n *\n * @beta\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 *\n * @beta\n */\nexport function setLogLevel(level: LogLevel): void {\n internalLogger.level = level;\n}\n\n/**\n * Get log level.\n *\n * @returns Log level\n *\n * @beta\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 *\n * @beta\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 *\n * @beta\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 = jwt_decode(token) as SSOTokenInfoBase;\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;\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 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;\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 { 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 *\n * @beta\n */\nexport class AppCredential implements TokenCredential {\n /**\n * Constructor of AppCredential.\n *\n * @remarks\n * Only works in in server side.\n * @beta\n */\n constructor(authConfig: 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 * @beta\n */\n async getToken(\n scopes: string | string[],\n options?: GetTokenOptions\n ): Promise<AccessToken | null> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"AppCredential\"),\n ErrorCode.RuntimeNotSupported\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 { AuthenticationConfiguration } 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 *\n * @beta\n */\nexport class OnBehalfOfUserCredential implements TokenCredential {\n /**\n * Constructor of OnBehalfOfUserCredential\n *\n * @remarks\n * Can Only works in in server side.\n * @beta\n */\n constructor(ssoToken: string, config: AuthenticationConfiguration) {\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 * @beta\n */\n async getToken(\n scopes: string | string[],\n options?: GetTokenOptions\n ): Promise<AccessToken | null> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"OnBehalfOfUserCredential\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Get basic user info from SSO token.\n * @remarks\n * Can only be used in server side.\n * @beta\n */\n public getUserInfo(): Promise<UserInfo> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"OnBehalfOfUserCredential\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AccessToken, TokenCredential, GetTokenOptions } from \"@azure/identity\";\nimport { UserInfo } from \"../models/userinfo\";\nimport { ErrorCode, ErrorMessage, ErrorWithCode } from \"../core/errors\";\nimport * as microsoftTeams from \"@microsoft/teams-js\";\nimport { AuthenticationConfiguration } 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 *\n * @beta\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 /**\n * Constructor of TeamsUserCredential.\n *\n * @example\n * ```typescript\n * const config = {\n * authentication: {\n * initiateLoginEndpoint: \"https://localhost:3000/auth-start.html\",\n * clientId: \"xxx\"\n * }\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 {AuthenticationConfiguration} authConfig - The authentication configuration. Use environment variables if not provided.\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 * @beta\n */\n constructor(authConfig: 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 *\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 * @beta\n */\n async login(scopes: string | 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();\n }\n\n return new Promise<void>((resolve, reject) => {\n microsoftTeams.initialize(() => {\n microsoftTeams.authentication.authenticate({\n url: `${this.config.initiateLoginEndpoint}?clientId=${\n this.config.clientId\n }&scope=${encodeURI(scopesStr)}&loginHint=${this.loginHint}`,\n width: loginPageWidth,\n height: loginPageHeight,\n successCallback: async (result?: string) => {\n if (!result) {\n const errorMsg = \"Get empty authentication result from MSAL\";\n\n internalLogger.error(errorMsg);\n reject(new ErrorWithCode(errorMsg, ErrorCode.InternalError));\n return;\n }\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 reject(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 reject(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 resolve();\n },\n failureCallback: (reason?: string) => {\n const errorMsg = `Consent failed for the scope ${scopesStr} with error: ${reason}`;\n internalLogger.error(errorMsg);\n reject(new ErrorWithCode(errorMsg, ErrorCode.ConsentFailed));\n },\n });\n });\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 *\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 *\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 * @beta\n */\n async getToken(\n scopes: string | string[],\n options?: GetTokenOptions\n ): Promise<AccessToken | null> {\n validateScopesType(scopes);\n const ssoToken = await this.getSSOToken();\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();\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: ${error?.message}. `;\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: ${error?.message}. `;\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 * @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 * @beta\n */\n public async getUserInfo(): Promise<UserInfo> {\n internalLogger.info(\"Get basic user info from SSO token\");\n const ssoToken = await this.getSSOToken();\n return getUserInfoFromSsoToken(ssoToken.token);\n }\n\n private async init(): Promise<void> {\n const ssoToken = await this.getSSOToken();\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 * @returns SSO token\n */\n private getSSOToken(): Promise<AccessToken> {\n return new Promise<AccessToken>((resolve, reject) => {\n if (this.ssoToken) {\n if (this.ssoToken.expiresOnTimestamp - Date.now() > tokenRefreshTimeSpanInMillisecond) {\n internalLogger.verbose(\"Get SSO token from memory cache\");\n resolve(this.ssoToken);\n return;\n }\n }\n\n if (this.checkInTeams()) {\n microsoftTeams.initialize(() => {\n microsoftTeams.authentication.getAuthToken({\n successCallback: (token: string) => {\n if (!token) {\n const errorMsg = \"Get empty SSO token from Teams\";\n internalLogger.error(errorMsg);\n reject(new ErrorWithCode(errorMsg, ErrorCode.InternalError));\n return;\n }\n\n const tokenObject = parseJwt(token);\n if (tokenObject.ver !== \"1.0\" && tokenObject.ver !== \"2.0\") {\n const errorMsg =\n \"SSO token is not valid with an unknown version: \" + tokenObject.ver;\n internalLogger.error(errorMsg);\n reject(new ErrorWithCode(errorMsg, ErrorCode.InternalError));\n return;\n }\n\n const ssoToken: AccessToken = {\n token,\n expiresOnTimestamp: tokenObject.exp * 1000,\n };\n\n this.ssoToken = ssoToken;\n resolve(ssoToken);\n },\n failureCallback: (errMessage: string) => {\n const errorMsg = \"Get SSO token failed with error: \" + errMessage;\n internalLogger.error(errorMsg);\n reject(new ErrorWithCode(errorMsg, ErrorCode.InternalError));\n },\n resources: [],\n });\n });\n } else {\n const errorMsg = \"Initialize teams sdk failed due to not running inside Teams\";\n internalLogger.error(errorMsg);\n reject(new ErrorWithCode(errorMsg, ErrorCode.InternalError));\n }\n });\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(config: AuthenticationConfiguration): 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: ${error.message}`;\n internalLogger.error(errorMessage);\n throw new ErrorWithCode(errorMessage, ErrorCode.InternalError);\n }\n }\n\n // Come from here: https://github.com/wictorwilen/msteams-react-base-component/blob/master/src/useTeams.ts\n private checkInTeams(): boolean {\n if (\n (window.parent === window.self && (window as any).nativeInterface) ||\n window.navigator.userAgent.includes(\"Teams/\") ||\n window.name === \"embedded-page-container\" ||\n window.name === \"extension-tab-frame\"\n ) {\n return true;\n }\n return false;\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\";\n\nconst defaultScope = \"https://graph.microsoft.com/.default\";\n\n/**\n * Microsoft Graph auth provider for Teams Framework\n *\n * @beta\n */\nexport class MsGraphAuthProvider implements AuthenticationProvider {\n private teamsfx: TeamsFxConfiguration;\n private scopes: string | string[];\n\n /**\n * Constructor of MsGraphAuthProvider.\n *\n * @param {TeamsFx} 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 * @beta\n */\n constructor(teamsfx: TeamsFxConfiguration, scopes?: string | string[]) {\n this.teamsfx = teamsfx;\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}'`);\n const accessToken = await this.teamsfx.getCredential().getToken(this.scopes);\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\";\n\n/**\n * Get Microsoft graph client.\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 *\n * @beta\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","// 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 * @remarks\n * Only works in in server side.\n * @beta\n */\nexport async function getTediousConnectionConfig(\n teamsfx: TeamsFx,\n databaseName?: string\n): Promise<ConnectionConfig> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"DefaultTediousConnectionConfiguration\"),\n ErrorCode.RuntimeNotSupported\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 *\n * @beta\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 *\n * @beta\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 * @beta\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 * @beta\n */\n public async beginDialog(dc: DialogContext): Promise<DialogTurnResult> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"TeamsBotSsoPrompt\"),\n ErrorCode.RuntimeNotSupported\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 * @beta\n */\n public async continueDialog(dc: DialogContext): Promise<DialogTurnResult> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"TeamsBotSsoPrompt\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport axios, { AxiosInstance } 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 *\n * @beta\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(config);\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 *\n * @beta\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 * @beta\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 * @beta\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 *\n * @beta\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 * @beta\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 * @beta\n */\n public async AddAuthenticationInfo(config: AxiosRequestConfig): Promise<AxiosRequestConfig> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"BasicAuthProvider\"),\n ErrorCode.RuntimeNotSupported\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 *\n * @beta\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 * @beta\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 * @beta\n */\n public async AddAuthenticationInfo(config: AxiosRequestConfig): Promise<AxiosRequestConfig> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"ApiKeyProvider\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n}\n\n/**\n * Define available location for API Key location\n *\n * @beta\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 * @beta\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 * @beta\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 * @beta\n */\n public async AddAuthenticationInfo(config: AxiosRequestConfig): Promise<AxiosRequestConfig> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"CertificateAuthProvider\"),\n ErrorCode.RuntimeNotSupported\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 *\n * @beta\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\";\n\n/**\n * A class providing credential and configuration.\n * @beta\n */\nexport class TeamsFx implements TeamsFxConfiguration {\n private configuration: Map<string, string | undefined>;\n private teamsUserCredential?: TeamsUserCredential;\n public identityType: IdentityType;\n\n constructor(identityType?: IdentityType, customConfig?: Record<string, string>) {\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 for (const key of Object.keys(customConfig)) {\n const value = customConfig[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(): Promise<UserInfo> {\n return await (this.getCredential() as TeamsUserCredential).getUserInfo();\n }\n\n public async login(scopes: string | string[]): Promise<void> {\n await (this.getCredential() as TeamsUserCredential).login(scopes);\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 { 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 * @beta\n */\nexport class ConversationBot {\n /**\n * The bot adapter.\n *\n * @remarks\n * Only work on server side.\n *\n * @beta\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 * @beta\n */\n public readonly command?: CommandBot;\n\n /**\n * The entrypoint of notification.\n *\n * @remarks\n * Only work on server side.\n *\n * @beta\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 * @beta\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 * @beta\n */\n public async 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 {\n BotFrameworkAdapter,\n ChannelInfo,\n ConversationReference,\n TeamsChannelAccount,\n} from \"botbuilder\";\nimport { ErrorWithCode, ErrorCode, ErrorMessage } from \"../core/errors\";\nimport { formatString } from \"../util/utils\";\nimport { NotificationTarget, NotificationTargetType } from \"./interface\";\nimport { ConversationReferenceStore } 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 * @returns A `Promise` representing the asynchronous operation.\n *\n * @beta\n */\nexport function sendMessage(target: NotificationTarget, text: string): 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 * @returns A `Promise` representing the asynchronous operation.\n *\n * @beta\n */\nexport function sendAdaptiveCard(target: NotificationTarget, card: unknown): 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 *\n * @beta\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 * @beta\n */\n public readonly parent: TeamsBotInstallation;\n\n /**\n * Detailed channel information.\n *\n * @remarks\n * Only work on server side.\n *\n * @beta\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 * @beta\n */\n public readonly type: 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 * @beta\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 * @returns A `Promise` representing the asynchronous operation.\n *\n * @beta\n */\n public sendMessage(text: string): Promise<void> {\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 * @returns A `Promise` representing the asynchronous operation.\n *\n * @beta\n */\n public async sendAdaptiveCard(card: unknown): Promise<void> {\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 *\n * @beta\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 * @beta\n */\n public readonly parent: TeamsBotInstallation;\n\n /**\n * Detailed member account information.\n *\n * @remarks\n * Only work on server side.\n *\n * @beta\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 * @beta\n */\n public readonly type: 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 * @beta\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 * @returns A `Promise` representing the asynchronous operation.\n *\n * @beta\n */\n public sendMessage(text: string): Promise<void> {\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 * @returns A `Promise` representing the asynchronous operation.\n *\n * @beta\n */\n public async sendAdaptiveCard(card: unknown): Promise<void> {\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 * @beta\n */\nexport class TeamsBotInstallation implements NotificationTarget {\n /**\n * The bound `BotFrameworkAdapter`.\n *\n * @remarks\n * Only work on server side.\n *\n * @beta\n */\n public readonly adapter: BotFrameworkAdapter;\n\n /**\n * The bound `ConversationReference`.\n *\n * @remarks\n * Only work on server side.\n *\n * @beta\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 * @beta\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 * @beta\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 * @returns A `Promise` representing the asynchronous operation.\n *\n * @beta\n */\n public sendMessage(text: string): Promise<void> {\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 * @returns A `Promise` representing the asynchronous operation.\n *\n * @beta\n */\n public sendAdaptiveCard(card: unknown): Promise<void> {\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 * @beta\n */\n public async 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 * @beta\n */\n public async members(): Promise<Member[]> {\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 * @beta\n */\nexport class NotificationBot {\n private readonly conversationReferenceStore: ConversationReferenceStore;\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 * @beta\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 * @beta\n */\n public static async installations(): Promise<TeamsBotInstallation[]> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"NotificationBot\"),\n ErrorCode.RuntimeNotSupported\n );\n }\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 } from \"./interface\";\nimport { CommandResponseMiddleware } from \"./middleware\";\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 * @beta\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 * @beta\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 * @beta\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 * @beta\n */\n public registerCommands(commands: TeamsFxBotCommandHandler[]): void {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"CommandnBot\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n}\n"],"names":[],"mappings":";;;;;;;AAAA;AACA;AAEA;;;;IAIY;AAAZ,WAAY,SAAS;;;;IAInB,kDAAqC,CAAA;;;;IAKrC,0DAA6C,CAAA;;;;IAK7C,sDAAyC,CAAA;;;;IAKzC,4CAA+B,CAAA;;;;IAK/B,wDAA2C,CAAA;;;;IAK3C,wDAA2C,CAAA;;;;IAK3C,4CAA+B,CAAA;;;;IAK/B,gDAAmC,CAAA;;;;IAKnC,oDAAuC,CAAA;;;;IAKvC,0CAA6B,CAAA;;;;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,0BAA0B,EAAE,aAAa,CAAC,EACpE,SAAS,CAAC,mBAAmB,CAC9B,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/conversation.browser.ts","../src/conversation/notification.browser.ts","../src/conversation/command.browser.ts"],"sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * Error code to trace the error types.\n * @beta\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 * 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 // 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}\n\n/**\n * Error class with code and message thrown by the SDK.\n *\n * @beta\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 * @beta\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 * @beta\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 *\n * @beta\n */\nexport type LogFunction = (level: LogLevel, message: string) => void;\n\n/**\n * Log level.\n *\n * @beta\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 *\n * @beta\n */\nexport function setLogLevel(level: LogLevel): void {\n internalLogger.level = level;\n}\n\n/**\n * Get log level.\n *\n * @returns Log level\n *\n * @beta\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 *\n * @beta\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 *\n * @beta\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 = jwt_decode(token) as SSOTokenInfoBase;\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;\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 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;\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 { 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 *\n * @beta\n */\nexport class AppCredential implements TokenCredential {\n /**\n * Constructor of AppCredential.\n *\n * @remarks\n * Only works in in server side.\n * @beta\n */\n constructor(authConfig: 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 * @beta\n */\n async getToken(\n scopes: string | string[],\n options?: GetTokenOptions\n ): Promise<AccessToken | null> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"AppCredential\"),\n ErrorCode.RuntimeNotSupported\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 { AuthenticationConfiguration } 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 *\n * @beta\n */\nexport class OnBehalfOfUserCredential implements TokenCredential {\n /**\n * Constructor of OnBehalfOfUserCredential\n *\n * @remarks\n * Can Only works in in server side.\n * @beta\n */\n constructor(ssoToken: string, config: AuthenticationConfiguration) {\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 * @beta\n */\n async getToken(\n scopes: string | string[],\n options?: GetTokenOptions\n ): Promise<AccessToken | null> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"OnBehalfOfUserCredential\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n\n /**\n * Get basic user info from SSO token.\n * @remarks\n * Can only be used in server side.\n * @beta\n */\n public getUserInfo(): Promise<UserInfo> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"OnBehalfOfUserCredential\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AccessToken, TokenCredential, GetTokenOptions } from \"@azure/identity\";\nimport { UserInfo } from \"../models/userinfo\";\nimport { ErrorCode, ErrorMessage, ErrorWithCode } from \"../core/errors\";\nimport { app, authentication } from \"@microsoft/teams-js\";\nimport { AuthenticationConfiguration } 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 *\n * @beta\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 /**\n * Constructor of TeamsUserCredential.\n *\n * @example\n * ```typescript\n * const config = {\n * authentication: {\n * initiateLoginEndpoint: \"https://localhost:3000/auth-start.html\",\n * clientId: \"xxx\"\n * }\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 {AuthenticationConfiguration} authConfig - The authentication configuration. Use environment variables if not provided.\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 * @beta\n */\n constructor(authConfig: 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 *\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 * @beta\n */\n async login(scopes: string | 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();\n }\n\n await app.initialize();\n let result: string;\n try {\n const params = {\n url: `${this.config.initiateLoginEndpoint}?clientId=${\n this.config.clientId\n }&scope=${encodeURI(scopesStr)}&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 *\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 *\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 * @beta\n */\n async getToken(\n scopes: string | string[],\n options?: GetTokenOptions\n ): Promise<AccessToken | null> {\n validateScopesType(scopes);\n const ssoToken = await this.getSSOToken();\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();\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: ${error?.message}. `;\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: ${error?.message}. `;\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 * @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 * @beta\n */\n public async getUserInfo(): Promise<UserInfo> {\n internalLogger.info(\"Get basic user info from SSO token\");\n const ssoToken = await this.getSSOToken();\n return getUserInfoFromSsoToken(ssoToken.token);\n }\n\n private async init(): Promise<void> {\n const ssoToken = await this.getSSOToken();\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 * @returns SSO token\n */\n private async getSSOToken(): 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 = {} as authentication.AuthTokenRequestParameters;\n let token: string;\n try {\n await app.initialize();\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(config: AuthenticationConfiguration): 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: ${error.message}`;\n internalLogger.error(errorMessage);\n throw new ErrorWithCode(errorMessage, ErrorCode.InternalError);\n }\n }\n\n // Come from here: https://github.com/wictorwilen/msteams-react-base-component/blob/master/src/useTeams.ts\n private checkInTeams(): boolean {\n if (\n (window.parent === window.self && (window as any).nativeInterface) ||\n window.navigator.userAgent.includes(\"Teams/\") ||\n window.name === \"embedded-page-container\" ||\n window.name === \"extension-tab-frame\"\n ) {\n return true;\n }\n return false;\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\";\n\nconst defaultScope = \"https://graph.microsoft.com/.default\";\n\n/**\n * Microsoft Graph auth provider for Teams Framework\n *\n * @beta\n */\nexport class MsGraphAuthProvider implements AuthenticationProvider {\n private teamsfx: TeamsFxConfiguration;\n private scopes: string | string[];\n\n /**\n * Constructor of MsGraphAuthProvider.\n *\n * @param {TeamsFx} 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 * @beta\n */\n constructor(teamsfx: TeamsFxConfiguration, scopes?: string | string[]) {\n this.teamsfx = teamsfx;\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}'`);\n const accessToken = await this.teamsfx.getCredential().getToken(this.scopes);\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\";\n\n/**\n * Get Microsoft graph client.\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 *\n * @beta\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","// 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 * @remarks\n * Only works in in server side.\n * @beta\n */\nexport async function getTediousConnectionConfig(\n teamsfx: TeamsFx,\n databaseName?: string\n): Promise<ConnectionConfig> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"DefaultTediousConnectionConfiguration\"),\n ErrorCode.RuntimeNotSupported\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 *\n * @beta\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 *\n * @beta\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 * @beta\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 * @beta\n */\n public async beginDialog(dc: DialogContext): Promise<DialogTurnResult> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"TeamsBotSsoPrompt\"),\n ErrorCode.RuntimeNotSupported\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 * @beta\n */\n public async continueDialog(dc: DialogContext): Promise<DialogTurnResult> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"TeamsBotSsoPrompt\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport axios, { AxiosInstance } 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 *\n * @beta\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(config);\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 *\n * @beta\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 * @beta\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 * @beta\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 *\n * @beta\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 * @beta\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 * @beta\n */\n public async AddAuthenticationInfo(config: AxiosRequestConfig): Promise<AxiosRequestConfig> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"BasicAuthProvider\"),\n ErrorCode.RuntimeNotSupported\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 *\n * @beta\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 * @beta\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 * @beta\n */\n public async AddAuthenticationInfo(config: AxiosRequestConfig): Promise<AxiosRequestConfig> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"ApiKeyProvider\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n}\n\n/**\n * Define available location for API Key location\n *\n * @beta\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 * @beta\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 * @beta\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 * @beta\n */\n public async AddAuthenticationInfo(config: AxiosRequestConfig): Promise<AxiosRequestConfig> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"CertificateAuthProvider\"),\n ErrorCode.RuntimeNotSupported\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 *\n * @beta\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\";\n\n/**\n * A class providing credential and configuration.\n * @beta\n */\nexport class TeamsFx implements TeamsFxConfiguration {\n private configuration: Map<string, string | undefined>;\n private teamsUserCredential?: TeamsUserCredential;\n public identityType: IdentityType;\n\n constructor(identityType?: IdentityType, customConfig?: Record<string, string>) {\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 for (const key of Object.keys(customConfig)) {\n const value = customConfig[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(): Promise<UserInfo> {\n return await (this.getCredential() as TeamsUserCredential).getUserInfo();\n }\n\n public async login(scopes: string | string[]): Promise<void> {\n await (this.getCredential() as TeamsUserCredential).login(scopes);\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 { 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 * @beta\n */\nexport class ConversationBot {\n /**\n * The bot adapter.\n *\n * @remarks\n * Only work on server side.\n *\n * @beta\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 * @beta\n */\n public readonly command?: CommandBot;\n\n /**\n * The entrypoint of notification.\n *\n * @remarks\n * Only work on server side.\n *\n * @beta\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 * @beta\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 * @beta\n */\n public async 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 {\n BotFrameworkAdapter,\n ChannelInfo,\n ConversationReference,\n TeamsChannelAccount,\n} from \"botbuilder\";\nimport { ErrorWithCode, ErrorCode, ErrorMessage } from \"../core/errors\";\nimport { formatString } from \"../util/utils\";\nimport { NotificationTarget, NotificationTargetType } from \"./interface\";\nimport { ConversationReferenceStore } 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 * @returns A `Promise` representing the asynchronous operation.\n *\n * @beta\n */\nexport function sendMessage(target: NotificationTarget, text: string): 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 * @returns A `Promise` representing the asynchronous operation.\n *\n * @beta\n */\nexport function sendAdaptiveCard(target: NotificationTarget, card: unknown): 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 *\n * @beta\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 * @beta\n */\n public readonly parent: TeamsBotInstallation;\n\n /**\n * Detailed channel information.\n *\n * @remarks\n * Only work on server side.\n *\n * @beta\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 * @beta\n */\n public readonly type: 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 * @beta\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 * @returns A `Promise` representing the asynchronous operation.\n *\n * @beta\n */\n public sendMessage(text: string): Promise<void> {\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 * @returns A `Promise` representing the asynchronous operation.\n *\n * @beta\n */\n public async sendAdaptiveCard(card: unknown): Promise<void> {\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 *\n * @beta\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 * @beta\n */\n public readonly parent: TeamsBotInstallation;\n\n /**\n * Detailed member account information.\n *\n * @remarks\n * Only work on server side.\n *\n * @beta\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 * @beta\n */\n public readonly type: 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 * @beta\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 * @returns A `Promise` representing the asynchronous operation.\n *\n * @beta\n */\n public sendMessage(text: string): Promise<void> {\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 * @returns A `Promise` representing the asynchronous operation.\n *\n * @beta\n */\n public async sendAdaptiveCard(card: unknown): Promise<void> {\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 * @beta\n */\nexport class TeamsBotInstallation implements NotificationTarget {\n /**\n * The bound `BotFrameworkAdapter`.\n *\n * @remarks\n * Only work on server side.\n *\n * @beta\n */\n public readonly adapter: BotFrameworkAdapter;\n\n /**\n * The bound `ConversationReference`.\n *\n * @remarks\n * Only work on server side.\n *\n * @beta\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 * @beta\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 * @beta\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 * @returns A `Promise` representing the asynchronous operation.\n *\n * @beta\n */\n public sendMessage(text: string): Promise<void> {\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 * @returns A `Promise` representing the asynchronous operation.\n *\n * @beta\n */\n public sendAdaptiveCard(card: unknown): Promise<void> {\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 * @beta\n */\n public async 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 * @beta\n */\n public async members(): Promise<Member[]> {\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 * @beta\n */\nexport class NotificationBot {\n private readonly conversationReferenceStore: ConversationReferenceStore;\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 * @beta\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 * @beta\n */\n public static async installations(): Promise<TeamsBotInstallation[]> {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"NotificationBot\"),\n ErrorCode.RuntimeNotSupported\n );\n }\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 } from \"./interface\";\nimport { CommandResponseMiddleware } from \"./middleware\";\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 * @beta\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 * @beta\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 * @beta\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 * @beta\n */\n public registerCommands(commands: TeamsFxBotCommandHandler[]): void {\n throw new ErrorWithCode(\n formatString(ErrorMessage.BrowserRuntimeNotSupported, \"CommandnBot\"),\n ErrorCode.RuntimeNotSupported\n );\n }\n}\n"],"names":[],"mappings":";;;;;;;AAAA;AACA;AAEA;;;;IAIY;AAAZ,WAAY,SAAS;;;;IAInB,kDAAqC,CAAA;;;;IAKrC,0DAA6C,CAAA;;;;IAK7C,sDAAyC,CAAA;;;;IAKzC,4CAA+B,CAAA;;;;IAK/B,wDAA2C,CAAA;;;;IAK3C,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,EAtEW,SAAS,KAAT,SAAS,QAsEpB;AAED;;;MAGa,YAAY;;AACvB;AACgB,iCAAoB,GAAG,uCAAuC,CAAC;AAC/D,mCAAsB,GAAG,mCAAmC,CAAC;AAC7D,2CAA8B,GAAG,4CAA4C,CAAC;AAC9E,yCAA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YAAY,OAA4B,EAAE,QAAqC;QAC7E,MAAM,IAAI,aAAa,CACrB,YAAY,CAAC,YAAY,CAAC,0BAA0B,EAAE,YAAY,CAAC,EACnE,SAAS,CAAC,mBAAmB,CAC9B,CAAC;KACH;;;;;;;;;;;IAYM,eAAe,CAAC,OAAiC;QACtD,MAAM,IAAI,aAAa,CACrB,YAAY,CAAC,YAAY,CAAC,0BAA0B,EAAE,YAAY,CAAC,EACnE,SAAS,CAAC,mBAAmB,CAC9B,CAAC;KACH;;;;;;;;;;;IAYM,gBAAgB,CAAC,QAAoC;QAC1D,MAAM,IAAI,aAAa,CACrB,YAAY,CAAC,YAAY,CAAC,0BAA0B,EAAE,aAAa,CAAC,EACpE,SAAS,CAAC,mBAAmB,CAC9B,CAAC;KACH;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microsoft/teamsfx",
3
- "version": "1.0.0",
3
+ "version": "2.0.0-beta.0",
4
4
  "description": "Microsoft Teams Framework for Node.js and browser.",
5
5
  "main": "dist/index.node.cjs.js",
6
6
  "browser": "dist/index.esm2017.js",
@@ -61,7 +61,7 @@
61
61
  "uuid": "^8.3.2"
62
62
  },
63
63
  "peerDependencies": {
64
- "@microsoft/teams-js": "^1.9.0"
64
+ "@microsoft/teams-js": "^2.0.0"
65
65
  },
66
66
  "devDependencies": {
67
67
  "@azure/arm-sql": "^8.0.0",
@@ -71,7 +71,7 @@
71
71
  "@istanbuljs/nyc-config-typescript": "^1.0.1",
72
72
  "@microsoft/api-documenter": "^7.14.1",
73
73
  "@microsoft/api-extractor": "^7.19.4",
74
- "@microsoft/teams-js": "^1.9.0",
74
+ "@microsoft/teams-js": "^2.0.0",
75
75
  "@rollup/plugin-json": "^4.1.0",
76
76
  "@types/chai": "^4.2.22",
77
77
  "@types/chai-as-promised": "^7.1.4",
@@ -128,7 +128,7 @@
128
128
  "webpack": "^5.62.1",
129
129
  "yargs": "^17.2.1"
130
130
  },
131
- "gitHead": "10357c51900c9974f8f90754f5545541e0ba2a73",
131
+ "gitHead": "7d60c0765c0ea8c023a26c10d1c93001c597afbb",
132
132
  "publishConfig": {
133
133
  "access": "public"
134
134
  },