diff --git a/change/@microsoft-teams-js-136faa15-4005-4e32-8931-382db3d3ab0f.json b/change/@microsoft-teams-js-136faa15-4005-4e32-8931-382db3d3ab0f.json new file mode 100644 index 0000000000..972ef2c366 --- /dev/null +++ b/change/@microsoft-teams-js-136faa15-4005-4e32-8931-382db3d3ab0f.json @@ -0,0 +1,7 @@ +{ + "type": "minor", + "comment": "Added the new parameters to `app.getContext` named `appId` and `manifestVersion`", + "packageName": "@microsoft/teams-js", + "email": "maggiegong@microsoft.com", + "dependentChangeType": "patch" +} diff --git a/packages/teams-js/src/public/app/app.ts b/packages/teams-js/src/public/app/app.ts index 3d6b2ad3f2..8605221415 100644 --- a/packages/teams-js/src/public/app/app.ts +++ b/packages/teams-js/src/public/app/app.ts @@ -16,6 +16,7 @@ import { ApiName, ApiVersionNumber, getApiVersionTag, getLogger } from '../../in import { inServerSideRenderingEnvironment } from '../../internal/utils'; import { prefetchOriginsFromCDN } from '../../internal/validOrigins'; import * as messageChannels from '../../private/messageChannels/messageChannels'; +import { AppId } from '../appId'; import { ChannelType, FrameContexts, HostClientType, HostName, TeamType, UserTeamRole } from '../constants'; import { ActionInfo, @@ -186,6 +187,16 @@ export interface AppInfo { * ID for the current visible app which is different for across cached sessions. Used for correlating telemetry data. */ appLaunchId?: string; + + /** + * This ID is the unique identifier assigned to the app after deployment and is critical for ensuring the correct app instance is recognized across hosts. + */ + appId?: AppId; + + /** + * The version of the manifest that the app is running. + */ + manifestVersion?: string; } /** @@ -807,6 +818,8 @@ function transformLegacyContextToAppContext(legacyContext: LegacyContext): Conte ringId: legacyContext.ringId, }, appLaunchId: legacyContext.appLaunchId, + appId: legacyContext.appId ? new AppId(legacyContext.appId) : undefined, + manifestVersion: legacyContext.manifestVersion, }, page: { id: legacyContext.entityId, diff --git a/packages/teams-js/src/public/interfaces.ts b/packages/teams-js/src/public/interfaces.ts index 8f10629bb5..2326e805d0 100644 --- a/packages/teams-js/src/public/interfaces.ts +++ b/packages/teams-js/src/public/interfaces.ts @@ -780,6 +780,22 @@ export interface Context { * They help pre-fill the dialog with necessary information (`dialogParameters`) along with other details. */ dialogParameters?: Record; + + /** + * @deprecated + * As of TeamsJS v2.0.0, please use {@link app.AppInfo.appId | app.Context.app.appId} instead + * + * This ID is the unique identifier assigned to the app after deployment and is critical for ensuring the correct app instance is recognized across hosts. + */ + appId?: string; + + /** + * @deprecated + * As of TeamsJS v2.0.0, please use {@link app.AppInfo.manifestVersion | app.Context.app.manifestVersion} instead + * + * The version of the manifest that the app is running. + */ + manifestVersion?: string; } /** Represents the parameters used to share a deep link. */