diff --git a/apps/teams-test-app/e2e-test-data/externalAppCardActionsForCEA.json b/apps/teams-test-app/e2e-test-data/externalAppCardActionsForCEA.json new file mode 100644 index 0000000000..f6c1dfdf46 --- /dev/null +++ b/apps/teams-test-app/e2e-test-data/externalAppCardActionsForCEA.json @@ -0,0 +1,13 @@ +{ + "name": "ExternalAppCardActionsForCEA", + "version": ">=2.29.0", + "platform": "Web", + "testCases": [ + { + "title": "checkExternalAppCardActionsForCEACapability API Call - Success", + "type": "callResponse", + "boxSelector": "#box_checkExternalAppCardActionsForCEACapability", + "expectedTestAppValue": "External App Card Actions For CEA module is supported" + } + ] +} diff --git a/apps/teams-test-app/src/components/privateApis/ExternalAppCardActionsForCEAAPIs.tsx b/apps/teams-test-app/src/components/privateApis/ExternalAppCardActionsForCEAAPIs.tsx index 282fc84f7f..f82468b6e1 100644 --- a/apps/teams-test-app/src/components/privateApis/ExternalAppCardActionsForCEAAPIs.tsx +++ b/apps/teams-test-app/src/components/privateApis/ExternalAppCardActionsForCEAAPIs.tsx @@ -14,9 +14,9 @@ const CheckExternalAppCardActionsForCEACapability = (): React.ReactElement => } supported`, }); -const CECProcessActionSubmit = (): React.ReactElement => +const ProcessActionSubmitForCEA = (): React.ReactElement => ApiWithTextInput<{ - appId: AppId; + appId: string; conversationId: string; actionSubmitPayload: IAdaptiveCardActionSubmit; }>({ @@ -27,13 +27,16 @@ const CECProcessActionSubmit = (): React.ReactElement => if (!input.appId) { throw new Error('appId is required'); } + if (!input.conversationId) { + throw new Error('conversationId is required'); + } if (!input.actionSubmitPayload) { throw new Error('actionSubmitPayload is required'); } }, submit: async (input) => { await externalAppCardActionsForCEA.processActionSubmit( - input.appId, + new AppId(input.appId), input.conversationId, input.actionSubmitPayload, ); @@ -42,6 +45,7 @@ const CECProcessActionSubmit = (): React.ReactElement => }, defaultInput: JSON.stringify({ appId: 'b7f8c0a0-6c1d-4a9a-9c0a-2c3f1c0a3b0a', + conversationId: 'conversationId', actionSubmitPayload: { id: 'submitId', data: 'data1', @@ -49,9 +53,9 @@ const CECProcessActionSubmit = (): React.ReactElement => }), }); -const CECProcessActionOpenUrl = (): React.ReactElement => +const ProcessActionOpenUrlForCEA = (): React.ReactElement => ApiWithTextInput<{ - appId: AppId; + appId: string; conversationId: string; url: string; }>({ @@ -62,13 +66,16 @@ const CECProcessActionOpenUrl = (): React.ReactElement => if (!input.appId) { throw new Error('appId is required'); } + if (!input.conversationId) { + throw new Error('conversationId is required'); + } if (!input.url) { throw new Error('url is required'); } }, submit: async (input) => { const result = await externalAppCardActionsForCEA.processActionOpenUrl( - input.appId, + new AppId(input.appId), input.conversationId, new URL(input.url), ); @@ -77,6 +84,7 @@ const CECProcessActionOpenUrl = (): React.ReactElement => }, defaultInput: JSON.stringify({ appId: 'b7f8c0a0-6c1d-4a9a-9c0a-2c3f1c0a3b0a', + conversationId: 'conversationID', url: 'https://www.example.com', }), }); @@ -84,8 +92,8 @@ const CECProcessActionOpenUrl = (): React.ReactElement => const ExternalAppCardActionsForCEAAPIs = (): React.ReactElement => ( - - + + ); diff --git a/change/@microsoft-teams-js-04213847-0138-4547-976c-ae02297702f0.json b/change/@microsoft-teams-js-04213847-0138-4547-976c-ae02297702f0.json new file mode 100644 index 0000000000..ad77d943d6 --- /dev/null +++ b/change/@microsoft-teams-js-04213847-0138-4547-976c-ae02297702f0.json @@ -0,0 +1,7 @@ +{ + "type": "patch", + "comment": "Updated types for `externalAppCardActionsForCEA` capability.", + "packageName": "@microsoft/teams-js", + "email": "maggiegong@microsoft.com", + "dependentChangeType": "patch" +} diff --git a/packages/teams-js/src/private/externalAppCardActionsForCEA.ts b/packages/teams-js/src/private/externalAppCardActionsForCEA.ts index eea0d73ce8..57c1644069 100644 --- a/packages/teams-js/src/private/externalAppCardActionsForCEA.ts +++ b/packages/teams-js/src/private/externalAppCardActionsForCEA.ts @@ -47,7 +47,7 @@ export namespace externalAppCardActionsForCEA { ApiName.ExternalAppCardActionsForCEA_ProcessActionOpenUrl, ), ApiName.ExternalAppCardActionsForCEA_ProcessActionOpenUrl, - [appId, url.href, conversationId], + [appId.toString(), conversationId, url.href], ); if (error) { throw error; @@ -84,7 +84,9 @@ export namespace externalAppCardActionsForCEA { ApiName.ExternalAppCardActionsForCEA_ProcessActionSubmit, ), ApiName.ExternalAppCardActionsForCEA_ProcessActionSubmit, - [appId, conversationId, actionSubmitPayload], + appId.toString(), + conversationId, + actionSubmitPayload, ); if (error) { throw error; diff --git a/packages/teams-js/test/private/externalAppCardActionsForCEA.spec.ts b/packages/teams-js/test/private/externalAppCardActionsForCEA.spec.ts index 2bd9e42196..db8520e0d9 100644 --- a/packages/teams-js/test/private/externalAppCardActionsForCEA.spec.ts +++ b/packages/teams-js/test/private/externalAppCardActionsForCEA.spec.ts @@ -75,7 +75,7 @@ describe('externalAppCardActionsForCEA', () => { const message = utils.findMessageByFunc(ApiName.ExternalAppCardActionsForCEA_ProcessActionSubmit); if (message && message.args) { expect(message).not.toBeNull(); - expect(message.args[0]).toEqual([testAppId, testConversationId, testActionSubmitPayload]); + expect(message.args).toEqual([testAppId.toString(), testConversationId, testActionSubmitPayload]); utils.respondToMessage(message, undefined); } @@ -94,7 +94,7 @@ describe('externalAppCardActionsForCEA', () => { const message = utils.findMessageByFunc(ApiName.ExternalAppCardActionsForCEA_ProcessActionSubmit); if (message && message.args) { expect(message).not.toBeNull(); - expect(message.args[0]).toEqual([testAppId, testConversationId, testActionSubmitPayload]); + expect(message.args).toEqual([testAppId.toString(), testConversationId, testActionSubmitPayload]); utils.respondToMessage(message, testError); } await expect(promise).rejects.toEqual(testError); @@ -161,7 +161,7 @@ describe('externalAppCardActionsForCEA', () => { const message = utils.findMessageByFunc(ApiName.ExternalAppCardActionsForCEA_ProcessActionOpenUrl); if (message && message.args) { expect(message).not.toBeNull(); - expect(message.args).toEqual([testAppId, testUrl.href, testConversationId]); + expect(message.args).toEqual([testAppId.toString(), testConversationId, testUrl.href]); utils.respondToMessage(message, null, testResponse); } @@ -178,7 +178,7 @@ describe('externalAppCardActionsForCEA', () => { const message = utils.findMessageByFunc(ApiName.ExternalAppCardActionsForCEA_ProcessActionOpenUrl); if (message && message.args) { expect(message).not.toBeNull(); - expect(message.args).toEqual([testAppId, testUrl.href, testConversationId]); + expect(message.args).toEqual([testAppId.toString(), testConversationId, testUrl.href]); utils.respondToMessage(message, testError, null); }