From a60ad3b98ed03a7a21c0d16dadf1c2acf7444e9d Mon Sep 17 00:00:00 2001 From: JuanSe Cardenas Rodriguez Date: Mon, 23 Sep 2024 12:51:16 -0500 Subject: [PATCH 1/2] Add userClickTimeV2 context value. --- packages/teams-js/src/public/app.ts | 6 ++++++ packages/teams-js/src/public/interfaces.ts | 10 +++++++++- packages/teams-js/test/private/privateAPIs.spec.ts | 1 + packages/teams-js/test/public/app.spec.ts | 4 ++++ 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/packages/teams-js/src/public/app.ts b/packages/teams-js/src/public/app.ts index 8efd2fa1e9..6972f024e2 100644 --- a/packages/teams-js/src/public/app.ts +++ b/packages/teams-js/src/public/app.ts @@ -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. @@ -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, diff --git a/packages/teams-js/src/public/interfaces.ts b/packages/teams-js/src/public/interfaces.ts index 70ba0427c4..2a984c0d76 100644 --- a/packages/teams-js/src/public/interfaces.ts +++ b/packages/teams-js/src/public/interfaces.ts @@ -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 @@ -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; diff --git a/packages/teams-js/test/private/privateAPIs.spec.ts b/packages/teams-js/test/private/privateAPIs.spec.ts index 3f70758294..17d4d9d09c 100644 --- a/packages/teams-js/test/private/privateAPIs.spec.ts +++ b/packages/teams-js/test/private/privateAPIs.spec.ts @@ -358,6 +358,7 @@ describe('AppSDK-privateAPIs', () => { appLaunchId: 'appLaunchId', sourceOrigin: 'someOrigin', userClickTime: 1000, + userClickTimeV2: 1001, teamTemplateId: 'com.microsoft.teams.ManageAProject', userFileOpenPreference: FileOpenPreference.Web, }; diff --git a/packages/teams-js/test/public/app.spec.ts b/packages/teams-js/test/public/app.spec.ts index 27fc99e6dc..89de8df840 100644 --- a/packages/teams-js/test/public/app.spec.ts +++ b/packages/teams-js/test/public/app.spec.ts @@ -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, @@ -574,6 +575,7 @@ describe('Testing app capability', () => { sessionId: 'appSessionId', theme: 'someTheme', userClickTime: 2222, + userClickTimeV2: 3333, userFileOpenPreference: FileOpenPreference.Inline, appLaunchId: 'appLaunchId', host: { @@ -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, @@ -1441,6 +1444,7 @@ describe('Testing app capability', () => { osLocaleInfo: undefined, parentMessageId: 'someParentMessageId', userClickTime: 2222, + userClickTimeV2: 3333, userFileOpenPreference: FileOpenPreference.Inline, host: { name: HostName.orange, From 33811a025a3343b41812f9827b0131d687343ff4 Mon Sep 17 00:00:00 2001 From: JuanSe Cardenas Rodriguez Date: Mon, 23 Sep 2024 14:54:13 -0500 Subject: [PATCH 2/2] Add changefile. --- ...soft-teams-js-a4e76c3e-7ab3-4dd4-9a24-c0c909040b64.json | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 change/@microsoft-teams-js-a4e76c3e-7ab3-4dd4-9a24-c0c909040b64.json diff --git a/change/@microsoft-teams-js-a4e76c3e-7ab3-4dd4-9a24-c0c909040b64.json b/change/@microsoft-teams-js-a4e76c3e-7ab3-4dd4-9a24-c0c909040b64.json new file mode 100644 index 0000000000..7ea2a228ea --- /dev/null +++ b/change/@microsoft-teams-js-a4e76c3e-7ab3-4dd4-9a24-c0c909040b64.json @@ -0,0 +1,7 @@ +{ + "type": "patch", + "comment": "Add userClickTimeV2 new context field.", + "packageName": "@microsoft/teams-js", + "email": "jcardenasr123@gmail.com", + "dependentChangeType": "patch" +}