Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Task] Programmatically access the "real" App ID and Manifest Version #2694

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "minor",
"comment": "Added the new parameters to `app.getContext` named `appId` and `manifestVersion`",
"packageName": "@microsoft/teams-js",
"email": "[email protected]",
"dependentChangeType": "patch"
}
13 changes: 13 additions & 0 deletions packages/teams-js/src/public/app/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
AE-MS marked this conversation as resolved.
Show resolved Hide resolved

/**
* The version of the manifest that the app is running.
*/
manifestVersion?: string;
}

/**
Expand Down Expand Up @@ -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,
Expand Down
16 changes: 16 additions & 0 deletions packages/teams-js/src/public/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -780,6 +780,22 @@ export interface Context {
* They help pre-fill the dialog with necessary information (`dialogParameters`) along with other details.
*/
dialogParameters?: Record<string, string>;

/**
* @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. */
Expand Down
Loading