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

Add userClickTimeV2 context value. #2522

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": "patch",
"comment": "Add userClickTimeV2 new context field.",
"packageName": "@microsoft/teams-js",
"email": "[email protected]",
"dependentChangeType": "patch"
}
6 changes: 6 additions & 0 deletions packages/teams-js/src/public/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,11 @@ export namespace app {
*/
userClickTime?: number;

/**
* Monotonic timer when the user clicked on the tab
*/
userClickTimeV2?: number;

/**
* The ID of the parent message from which this task module was launched.
* This is only available in task modules launched from bot cards.
Expand Down Expand Up @@ -999,6 +1004,7 @@ function transformLegacyContextToAppContext(legacyContext: LegacyContext): app.C
osLocaleInfo: legacyContext.osLocaleInfo,
parentMessageId: legacyContext.parentMessageId,
userClickTime: legacyContext.userClickTime,
userClickTimeV2: legacyContext.userClickTimeV2,
userFileOpenPreference: legacyContext.userFileOpenPreference,
host: {
name: legacyContext.hostName ? legacyContext.hostName : HostName.teams,
Expand Down
10 changes: 9 additions & 1 deletion packages/teams-js/src/public/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,14 @@ export interface Context {
*/
userClickTime?: number;

/**
* @deprecated
* As of TeamsJS v2.0.0, please use {@link app.AppInfo.userClickTimeV2 | app.Context.app.userClickTimeV2} instead
*
* Monotonic timer when the user clicked on the tab
*/
userClickTimeV2?: number;

/**
* @deprecated
* As of TeamsJS v2.0.0, please use {@link app.TeamInfo.templateId | app.Context.team.templateId} instead
Expand Down Expand Up @@ -1008,7 +1016,7 @@ export interface SdkError {
errorCode: ErrorCode;
/**
Optional description for the error. This may contain useful information for web-app developers.
This string will not be localized and is not for end-user consumption.
This string will not be localized and is not for end-user consumption.
App should not depend on the string content. The exact value may change. This is only for debugging purposes.
*/
message?: string;
Expand Down
1 change: 1 addition & 0 deletions packages/teams-js/test/private/privateAPIs.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,7 @@ describe('AppSDK-privateAPIs', () => {
appLaunchId: 'appLaunchId',
sourceOrigin: 'someOrigin',
userClickTime: 1000,
userClickTimeV2: 1001,
teamTemplateId: 'com.microsoft.teams.ManageAProject',
userFileOpenPreference: FileOpenPreference.Web,
};
Expand Down
4 changes: 4 additions & 0 deletions packages/teams-js/test/public/app.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,7 @@ describe('Testing app capability', () => {
sourceOrigin: 'www.origin.com',
teamTemplateId: 'someTeamTemplateId',
userClickTime: 2222,
userClickTimeV2: 3333,
userFileOpenPreference: FileOpenPreference.Inline,
isMultiWindow: true,
isBackgroundLoad: true,
Expand All @@ -574,6 +575,7 @@ describe('Testing app capability', () => {
sessionId: 'appSessionId',
theme: 'someTheme',
userClickTime: 2222,
userClickTimeV2: 3333,
userFileOpenPreference: FileOpenPreference.Inline,
appLaunchId: 'appLaunchId',
host: {
Expand Down Expand Up @@ -1424,6 +1426,7 @@ describe('Testing app capability', () => {
sourceOrigin: 'www.origin.com',
teamTemplateId: 'someTeamTemplateId',
userClickTime: 2222,
userClickTimeV2: 3333,
userFileOpenPreference: FileOpenPreference.Inline,
isMultiWindow: true,
frameContext: context,
Expand All @@ -1441,6 +1444,7 @@ describe('Testing app capability', () => {
osLocaleInfo: undefined,
parentMessageId: 'someParentMessageId',
userClickTime: 2222,
userClickTimeV2: 3333,
userFileOpenPreference: FileOpenPreference.Inline,
host: {
name: HostName.orange,
Expand Down
Loading