Skip to content

Commit e023c71

Browse files
authored
Add messageId to app context (#2865)
* add messageId to context * update unit test * changefile * increase package size limit * Increase package size limit
1 parent 5bda4f2 commit e023c71

File tree

5 files changed

+27
-2
lines changed

5 files changed

+27
-2
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "minor",
3+
"comment": "Added `messageId` to app context.",
4+
"packageName": "@microsoft/teams-js",
5+
"email": "[email protected]",
6+
"dependentChangeType": "patch"
7+
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@
162162
"brotli": false,
163163
"path": "./packages/teams-js/dist/esm/packages/teams-js/src/index.js",
164164
"import": "{ app, authentication, pages }",
165-
"limit": "57.67 KB"
165+
"limit": "57.69 KB"
166166
},
167167
{
168168
"brotli": false,

packages/teams-js/src/public/app/app.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,12 @@ export interface AppInfo {
179179
*/
180180
userClickTimeV2?: number;
181181

182+
/**
183+
* The ID of the message from which this task module was launched.
184+
* This is only available in task modules launched from bot cards.
185+
*/
186+
messageId?: string;
187+
182188
/**
183189
* The ID of the parent message from which this task module was launched.
184190
* This is only available in task modules launched from bot cards.
@@ -819,6 +825,7 @@ function transformLegacyContextToAppContext(legacyContext: LegacyContext): Conte
819825
theme: legacyContext.theme ? legacyContext.theme : 'default',
820826
iconPositionVertical: legacyContext.appIconPosition,
821827
osLocaleInfo: legacyContext.osLocaleInfo,
828+
messageId: legacyContext.messageId,
822829
parentMessageId: legacyContext.parentMessageId,
823830
userClickTime: legacyContext.userClickTime,
824831
userClickTimeV2: legacyContext.userClickTimeV2,

packages/teams-js/src/public/interfaces.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,15 @@ export interface Context {
622622
*/
623623
userLicenseType?: string;
624624

625+
/**
626+
* @deprecated
627+
* As of TeamsJS v2.0.0, please use {@link app.AppInfo.messageId | app.Context.app.messageId} instead
628+
*
629+
* The ID of the message from which this task module was launched.
630+
* This is only available in task modules launched from bot cards.
631+
*/
632+
messageId?: string;
633+
625634
/**
626635
* @deprecated
627636
* As of TeamsJS v2.0.0, please use {@link app.AppInfo.parentMessageId | app.Context.app.parentMessageId} instead

packages/teams-js/test/public/app.spec.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ describe('Testing app capability', () => {
413413
message = utils.findMessageByFunc('getContext');
414414
expect(message).not.toBeNull();
415415
});
416-
416+
417417
Object.values(FrameContexts).forEach((context) => {
418418
it(`app.getContext should successfully get frame context in ${context} context`, async () => {
419419
await utils.initializeWithContext(context);
@@ -538,6 +538,7 @@ describe('Testing app capability', () => {
538538
sharepoint: {},
539539
tenantSKU: 'someTenantSKU',
540540
userLicenseType: 'someUserLicenseType',
541+
messageId: 'someMessageId',
541542
parentMessageId: 'someParentMessageId',
542543
ringId: 'someRingId',
543544
appSessionId: 'appSessionId',
@@ -570,6 +571,7 @@ describe('Testing app capability', () => {
570571
app: {
571572
iconPositionVertical: 5,
572573
locale: 'someLocale',
574+
messageId: 'someMessageId',
573575
parentMessageId: 'someParentMessageId',
574576
sessionId: 'appSessionId',
575577
theme: 'someTheme',

0 commit comments

Comments
 (0)