From 1199c21b6dfd0aeafea860b403882e0780409e7e Mon Sep 17 00:00:00 2001 From: Maggie Gong Date: Thu, 19 Sep 2024 11:28:18 -0700 Subject: [PATCH] rename CEC to CEA --- ...x => ExternalAppCardActionsForCEAAPIs.tsx} | 24 ++++---- apps/teams-test-app/src/pages/TestApp.tsx | 4 +- ...-75e3c524-ba26-4b6a-b01b-9a1f0e315d91.json | 2 +- packages/teams-js/src/internal/telemetry.ts | 4 +- .../src/private/externalAppCardActions.ts | 40 +++++++++++++ ...CEC.ts => externalAppCardActionsForCEA.ts} | 44 ++++++++++++-- packages/teams-js/src/private/index.ts | 2 +- packages/teams-js/src/private/interfaces.ts | 27 +++++++++ packages/teams-js/src/public/runtime.ts | 2 +- ...s => externalAppCardActionsForCEA.spec.ts} | 60 +++++++++---------- 10 files changed, 154 insertions(+), 55 deletions(-) rename apps/teams-test-app/src/components/privateApis/{ExternalAppCardActionsForCECAPIs.tsx => ExternalAppCardActionsForCEAAPIs.tsx} (75%) rename packages/teams-js/src/private/{externalAppCardActionsForCEC.ts => externalAppCardActionsForCEA.ts} (56%) rename packages/teams-js/test/private/{externalAppCardActionsForCEC.spec.ts => externalAppCardActionsForCEA.spec.ts} (82%) diff --git a/apps/teams-test-app/src/components/privateApis/ExternalAppCardActionsForCECAPIs.tsx b/apps/teams-test-app/src/components/privateApis/ExternalAppCardActionsForCEAAPIs.tsx similarity index 75% rename from apps/teams-test-app/src/components/privateApis/ExternalAppCardActionsForCECAPIs.tsx rename to apps/teams-test-app/src/components/privateApis/ExternalAppCardActionsForCEAAPIs.tsx index 8483ae1153..4538d37c9a 100644 --- a/apps/teams-test-app/src/components/privateApis/ExternalAppCardActionsForCECAPIs.tsx +++ b/apps/teams-test-app/src/components/privateApis/ExternalAppCardActionsForCEAAPIs.tsx @@ -4,12 +4,12 @@ import React from 'react'; import { ApiWithoutInput, ApiWithTextInput } from '../utils'; import { ModuleWrapper } from '../utils/ModuleWrapper'; -const CheckExternalAppCardActionsForCECCapability = (): React.ReactElement => +const CheckExternalAppCardActionsForCEACapability = (): React.ReactElement => ApiWithoutInput({ - name: 'checkExternalAppCardActionsForCECCapability', - title: 'Check External App Card Actions For CEC Capability', + name: 'checkExternalAppCardActionsForCEACapability', + title: 'Check External App Card Actions For CEA Capability', onClick: async () => - `External App Card Actions For CEC module ${externalAppCardActions.isSupported() ? 'is' : 'is not'} supported`, + `External App Card Actions For CEA module ${externalAppCardActions.isSupported() ? 'is' : 'is not'} supported`, }); const CECProcessActionSubmit = (): React.ReactElement => @@ -17,8 +17,8 @@ const CECProcessActionSubmit = (): React.ReactElement => appId: string; actionSubmitPayload: IAdaptiveCardActionSubmit; }>({ - name: 'processActionSubmitForCEC', - title: 'Process Action Submit For CEC', + name: 'processActionSubmitForCEA', + title: 'Process Action Submit For CEA', onClick: { validateInput: (input) => { if (!input.appId) { @@ -48,8 +48,8 @@ const CECProcessActionOpenUrl = (): React.ReactElement => url: string; fromElement?: { name: 'composeExtensions' | 'plugins' }; }>({ - name: 'processActionOpenUrlForCEC', - title: 'Process Action Open Url For CEC', + name: 'processActionOpenUrlForCEA', + title: 'Process Action Open Url For CEA', onClick: { validateInput: (input) => { if (!input.appId) { @@ -74,12 +74,12 @@ const CECProcessActionOpenUrl = (): React.ReactElement => }), }); -const ExternalAppCardActionsForCECAPIs = (): React.ReactElement => ( - - +const ExternalAppCardActionsForCEAAPIs = (): React.ReactElement => ( + + ); -export default ExternalAppCardActionsForCECAPIs; +export default ExternalAppCardActionsForCEAAPIs; diff --git a/apps/teams-test-app/src/pages/TestApp.tsx b/apps/teams-test-app/src/pages/TestApp.tsx index 98ba9219e1..f8264834ae 100644 --- a/apps/teams-test-app/src/pages/TestApp.tsx +++ b/apps/teams-test-app/src/pages/TestApp.tsx @@ -41,7 +41,7 @@ import ChatAPIs from '../components/privateApis/ChatAPIs'; import CopilotAPIs from '../components/privateApis/CopilotAPIs'; import ExternalAppAuthenticationAPIs from '../components/privateApis/ExternalAppAuthenticationAPIs'; import ExternalAppCardActionsAPIs from '../components/privateApis/ExternalAppCardActionsAPIs'; -import ExternalAppCardActionsForCECAPIs from '../components/privateApis/ExternalAppCardActionsForCECAPIs'; +import ExternalAppCardActionsForCEAAPIs from '../components/privateApis/ExternalAppCardActionsForCEAAPIs'; import ExternalAppCommandsAPIs from '../components/privateApis/ExternalAppCommandsAPIs'; import FilesAPIs from '../components/privateApis/FilesAPIs'; import FullTrustAPIs from '../components/privateApis/FullTrustAPIs'; @@ -115,7 +115,7 @@ export const TestApp: React.FC = () => { - + diff --git a/change/@microsoft-teams-js-75e3c524-ba26-4b6a-b01b-9a1f0e315d91.json b/change/@microsoft-teams-js-75e3c524-ba26-4b6a-b01b-9a1f0e315d91.json index 30849a886b..87f7e233e0 100644 --- a/change/@microsoft-teams-js-75e3c524-ba26-4b6a-b01b-9a1f0e315d91.json +++ b/change/@microsoft-teams-js-75e3c524-ba26-4b6a-b01b-9a1f0e315d91.json @@ -1,6 +1,6 @@ { "type": "minor", - "comment": "Added APIs for externalAppCardActionForCEC capability.", + "comment": "Added APIs for externalAppCardActionForCEA capability.", "packageName": "@microsoft/teams-js", "email": "maggiegong@microsoft.com", "dependentChangeType": "patch" diff --git a/packages/teams-js/src/internal/telemetry.ts b/packages/teams-js/src/internal/telemetry.ts index d9a8c73df7..fb1ff8a32b 100644 --- a/packages/teams-js/src/internal/telemetry.ts +++ b/packages/teams-js/src/internal/telemetry.ts @@ -113,8 +113,8 @@ export const enum ApiName { ExternalAppAuthentication_AuthenticateWithPowerPlatformConnectorPlugins = 'externalAppAuthentication.authenticateWithPowerPlatformConnectorPlugins', ExternalAppCardActions_ProcessActionOpenUrl = 'externalAppCardActions.processActionOpenUrl', ExternalAppCardActions_ProcessActionSubmit = 'externalAppCardActions.processActionSubmit', - ExternalAppCardActionsForCEC_ProcessActionOpenUrl = 'externalAppCardActions.cec.processActionOpenUrl', - ExternalAppCardActionsForCEC_ProcessActionSubmit = 'externalAppCardActions.cec.processActionSubmit', + ExternalAppCardActionsForCEA_ProcessActionOpenUrl = 'externalAppCardActionsForCEA.processActionOpenUrl', + ExternalAppCardActionsForCEA_ProcessActionSubmit = 'externalAppCardActionsForCEA.processActionSubmit', ExternalAppCommands_ProcessActionCommands = 'externalAppCommands.processActionCommand', Files_AddCloudStorageFolder = 'files.addCloudStorageFolder', Files_AddCloudStorageProvider = 'files.addCloudStorageProvider', diff --git a/packages/teams-js/src/private/externalAppCardActions.ts b/packages/teams-js/src/private/externalAppCardActions.ts index c286d1f8ae..1cfc879878 100644 --- a/packages/teams-js/src/private/externalAppCardActions.ts +++ b/packages/teams-js/src/private/externalAppCardActions.ts @@ -18,6 +18,12 @@ const externalAppCardActionsTelemetryVersionNumber: ApiVersionNumber = ApiVersio * Limited to Microsoft-internal use */ export namespace externalAppCardActions { + /** + * @hidden + * The type of deeplink action that was executed by the host + * @internal + * Limited to Microsoft-internal use + */ export enum ActionOpenUrlType { DeepLinkDialog = 'DeepLinkDialog', DeepLinkOther = 'DeepLinkOther', @@ -25,6 +31,17 @@ export namespace externalAppCardActions { GenericUrl = 'GenericUrl', } + /** + * @beta + * @hidden + * Delegates an Adaptive Card Action.Submit request to the host for the application with the provided app ID + * @internal + * Limited to Microsoft-internal use + * @param appId ID of the application the request is intended for. This must be a UUID + * @param actionSubmitPayload The Adaptive Card Action.Submit payload + * @param cardActionsConfig The card actions configuration. This indicates which subtypes should be handled by this API + * @returns Promise that resolves when the request is completed and rejects with ActionSubmitError if the request fails + */ export function processActionSubmit(appId: string, actionSubmitPayload: IAdaptiveCardActionSubmit): Promise { ensureInitialized(runtime, FrameContexts.content); @@ -47,6 +64,19 @@ export namespace externalAppCardActions { }); } + /** + * @beta + * @hidden + * Delegates an Adaptive Card Action.OpenUrl request to the host for the application with the provided app ID. + * If `fromElement` is not provided, the information from the manifest is used to determine whether the URL can + * be processed by the host. Deep link URLs for plugins are not supported and will result in an error. + * @internal + * Limited to Microsoft-internal use + * @param appId ID of the application the request is intended for. This must be a UUID + * @param url The URL to open + * @param fromElement The element on behalf of which the M365 app is making the request. + * @returns Promise that resolves to ActionOpenUrlType indicating the type of URL that was opened on success and rejects with ActionOpenUrlError if the request fails + */ export function processActionOpenUrl( appId: string, url: URL, @@ -74,6 +104,16 @@ export namespace externalAppCardActions { }); } + /** + * @hidden + * Checks if the externalAppCardActions capability is supported by the host + * @returns boolean to represent whether externalAppCardActions capability is supported + * + * @throws Error if {@linkcode app.initialize} has not successfully completed + * + * @internal + * Limited to Microsoft-internal use + */ export function isSupported(): boolean { return ensureInitialized(runtime) && runtime.supports.externalAppCardActions ? true : false; } diff --git a/packages/teams-js/src/private/externalAppCardActionsForCEC.ts b/packages/teams-js/src/private/externalAppCardActionsForCEA.ts similarity index 56% rename from packages/teams-js/src/private/externalAppCardActionsForCEC.ts rename to packages/teams-js/src/private/externalAppCardActionsForCEA.ts index f40dba3fa6..7fdadc3acb 100644 --- a/packages/teams-js/src/private/externalAppCardActionsForCEC.ts +++ b/packages/teams-js/src/private/externalAppCardActionsForCEA.ts @@ -10,7 +10,18 @@ import { ActionOpenUrlError, ActionOpenUrlType, ActionSubmitError, IAdaptiveCard * Updated to constants file: v2 APIs telemetry file: All of APIs in this capability file should send out API version v2 ONLY */ const externalAppCardActionsTelemetryVersionNumber: ApiVersionNumber = ApiVersionNumber.V_2; -export namespace externalAppCardActionsForCEC { +export namespace externalAppCardActionsForCEA { + /** + * @beta + * @hidden + * Delegates an Adaptive Card Action.OpenUrl request to the host for the application with the provided app ID. + * @internal + * Limited to Microsoft-internal use + * @param appId ID of the application the request is intended for. This must be a UUID + * @param conversationId To tell the bot what conversation the calls are coming from + * @param url The URL to open + * @returns Promise that resolves to ActionOpenUrlType indicating the type of URL that was opened on success and rejects with ActionOpenUrlError if the request fails + */ export function processActionOpenUrl(appId: string, conversationId: string, url: URL): Promise { ensureInitialized(runtime, FrameContexts.content); @@ -22,9 +33,9 @@ export namespace externalAppCardActionsForCEC { return sendMessageToParentAsync<[ActionOpenUrlError, ActionOpenUrlType]>( getApiVersionTag( externalAppCardActionsTelemetryVersionNumber, - ApiName.ExternalAppCardActionsForCEC_ProcessActionOpenUrl, + ApiName.ExternalAppCardActionsForCEA_ProcessActionOpenUrl, ), - 'externalAppCardActionsForCEC.processActionOpenUrl', + 'externalAppCardActionsForCEA.processActionOpenUrl', [appId, url.href, conversationId], ).then(([error, response]: [ActionOpenUrlError, ActionOpenUrlType]) => { if (error) { @@ -35,6 +46,17 @@ export namespace externalAppCardActionsForCEC { }); } + /** + * @beta + * @hidden + * Delegates an Adaptive Card Action.Submit request to the host for the application with the provided app ID + * @internal + * Limited to Microsoft-internal use + * @param appId ID of the application the request is intended for. This must be a UUID + * @param conversationId To tell the bot what conversation the calls are coming from + * @param actionSubmitPayload The Adaptive Card Action.Submit payload + * @returns Promise that resolves when the request is completed and rejects with ActionSubmitError if the request fails + */ export function processActionSubmit( appId: string, conversationId: string, @@ -50,9 +72,9 @@ export namespace externalAppCardActionsForCEC { return sendMessageToParentAsync<[boolean, ActionSubmitError]>( getApiVersionTag( externalAppCardActionsTelemetryVersionNumber, - ApiName.ExternalAppCardActionsForCEC_ProcessActionSubmit, + ApiName.ExternalAppCardActionsForCEA_ProcessActionSubmit, ), - 'externalAppCardActionsForCEC.processActionSubmit', + 'externalAppCardActionsForCEA.processActionSubmit', [appId, conversationId, actionSubmitPayload], ).then(([wasSuccessful, error]: [boolean, ActionSubmitError]) => { if (!wasSuccessful) { @@ -61,7 +83,17 @@ export namespace externalAppCardActionsForCEC { }); } + /** + * @hidden + * Checks if the externalAppCardActionsForCEA capability is supported by the host + * @returns boolean to represent whether externalAppCardActions capability is supported + * + * @throws Error if {@linkcode app.initialize} has not successfully completed + * + * @internal + * Limited to Microsoft-internal use + */ export function isSupported(): boolean { - return ensureInitialized(runtime) && runtime.supports.externalAppCardActionsForCEC ? true : false; + return ensureInitialized(runtime) && runtime.supports.externalAppCardActionsForCEA ? true : false; } } diff --git a/packages/teams-js/src/private/index.ts b/packages/teams-js/src/private/index.ts index b8248182ee..64aeb871a3 100644 --- a/packages/teams-js/src/private/index.ts +++ b/packages/teams-js/src/private/index.ts @@ -22,7 +22,7 @@ export { conversations } from './conversations'; export { copilot } from './copilot'; export { externalAppAuthentication } from './externalAppAuthentication'; export { externalAppCardActions } from './externalAppCardActions'; -export { externalAppCardActionsForCEC } from './externalAppCardActionsForCEC'; +export { externalAppCardActionsForCEA } from './externalAppCardActionsForCEA'; export { externalAppCommands } from './externalAppCommands'; export { files } from './files'; export { meetingRoom } from './meetingRoom'; diff --git a/packages/teams-js/src/private/interfaces.ts b/packages/teams-js/src/private/interfaces.ts index 4483b9081a..93eca0dffb 100644 --- a/packages/teams-js/src/private/interfaces.ts +++ b/packages/teams-js/src/private/interfaces.ts @@ -282,22 +282,49 @@ export enum ActionOpenUrlType { GenericUrl = 'GenericUrl', } +/** + * @hidden + * Error that can be thrown from IExternalAppCardActionService.handleActionOpenUrl + * + * @internal + * Limited to Microsoft-internal use + */ export interface ActionOpenUrlError { errorCode: ActionOpenUrlErrorCode; message?: string; } +/** + * @hidden + * Error codes that can be thrown from IExternalAppCardActionService.handleActionOpenUrl + * @internal + * Limited to Microsoft-internal use + */ export enum ActionOpenUrlErrorCode { INTERNAL_ERROR = 'INTERNAL_ERROR', // Generic error INVALID_LINK = 'INVALID_LINK', // Deep link is invalid NOT_SUPPORTED = 'NOT_SUPPORTED', // Deep link is not supported } +/** + * @hidden + * The payload that is used when executing an Adaptive Card Action.Submit + * @internal + * Limited to Microsoft-internal use + */ export interface IAdaptiveCardActionSubmit { id: string; data: string | Record; } +/** + * + * @hidden + * Error that can be thrown from IExternalAppCardActionService.handleActionSubmit + * + * @internal + * Limited to Microsoft-internal use + */ export interface ActionSubmitError { errorCode: ExternalAppErrorCode; message?: string; diff --git a/packages/teams-js/src/public/runtime.ts b/packages/teams-js/src/public/runtime.ts index 5c6000e445..4aa5e93815 100644 --- a/packages/teams-js/src/public/runtime.ts +++ b/packages/teams-js/src/public/runtime.ts @@ -243,7 +243,7 @@ interface IRuntimeV4 extends IBaseRuntime { }; readonly externalAppAuthentication?: {}; readonly externalAppCardActions?: {}; - readonly externalAppCardActionsForCEC?: {}; + readonly externalAppCardActionsForCEA?: {}; readonly externalAppCommands?: {}; readonly geoLocation?: { readonly map?: {}; diff --git a/packages/teams-js/test/private/externalAppCardActionsForCEC.spec.ts b/packages/teams-js/test/private/externalAppCardActionsForCEA.spec.ts similarity index 82% rename from packages/teams-js/test/private/externalAppCardActionsForCEC.spec.ts rename to packages/teams-js/test/private/externalAppCardActionsForCEA.spec.ts index c4161a5412..45a0137122 100644 --- a/packages/teams-js/test/private/externalAppCardActionsForCEC.spec.ts +++ b/packages/teams-js/test/private/externalAppCardActionsForCEA.spec.ts @@ -1,14 +1,14 @@ import { errorLibraryNotInitialized } from '../../src/internal/constants'; import { GlobalVars } from '../../src/internal/globalVars'; import { ExternalAppErrorCode } from '../../src/private/constants'; -import { externalAppCardActionsForCEC } from '../../src/private/externalAppCardActionsForCEC'; +import { externalAppCardActionsForCEA } from '../../src/private/externalAppCardActionsForCEA'; import { ActionOpenUrlErrorCode, ActionOpenUrlType } from '../../src/private/interfaces'; import { FrameContexts } from '../../src/public'; import { app } from '../../src/public/app'; import { errorNotSupportedOnPlatform } from '../../src/public/constants'; import { Utils } from '../utils'; -describe('externalAppCardActionsForCEC', () => { +describe('externalAppCardActionsForCEA', () => { let utils = new Utils(); // This ID was randomly generated for the purpose of these tests @@ -39,15 +39,15 @@ describe('externalAppCardActionsForCEC', () => { }; it('should not allow calls before initialization', async () => { return expect(() => - externalAppCardActionsForCEC.processActionSubmit(testAppId, testConversationId, testActionSubmitPayload), + externalAppCardActionsForCEA.processActionSubmit(testAppId, testConversationId, testActionSubmitPayload), ).toThrowError(new Error(errorLibraryNotInitialized)); }); - it('should throw error when externalAppCardActionsForCEC capability is not supported', async () => { + it('should throw error when externalAppCardActionsForCEA capability is not supported', async () => { expect.assertions(1); await utils.initializeWithContext(FrameContexts.content); utils.setRuntimeConfig({ apiVersion: 2, supports: {} }); try { - await externalAppCardActionsForCEC.processActionSubmit(testAppId, testConversationId, testActionSubmitPayload); + await externalAppCardActionsForCEA.processActionSubmit(testAppId, testConversationId, testActionSubmitPayload); } catch (e) { expect(e).toEqual(errorNotSupportedOnPlatform); } @@ -57,13 +57,13 @@ describe('externalAppCardActionsForCEC', () => { it(`should resolve when called from context - ${frameContext}`, async () => { expect.assertions(3); await utils.initializeWithContext(frameContext); - utils.setRuntimeConfig({ apiVersion: 2, supports: { externalAppCardActionsForCEC: {} } }); - const promise = externalAppCardActionsForCEC.processActionSubmit( + utils.setRuntimeConfig({ apiVersion: 2, supports: { externalAppCardActionsForCEA: {} } }); + const promise = externalAppCardActionsForCEA.processActionSubmit( testAppId, testConversationId, testActionSubmitPayload, ); - const message = utils.findMessageByFunc('externalAppCardActionsForCEC.processActionSubmit'); + const message = utils.findMessageByFunc('externalAppCardActionsForCEA.processActionSubmit'); if (message && message.args) { expect(message).not.toBeNull(); expect(message.args).toEqual([testAppId, testConversationId, testActionSubmitPayload]); @@ -74,13 +74,13 @@ describe('externalAppCardActionsForCEC', () => { it(`should throw error from host when called from context - ${frameContext}`, async () => { expect.assertions(3); await utils.initializeWithContext(frameContext); - utils.setRuntimeConfig({ apiVersion: 2, supports: { externalAppCardActionsForCEC: {} } }); - const promise = externalAppCardActionsForCEC.processActionSubmit( + utils.setRuntimeConfig({ apiVersion: 2, supports: { externalAppCardActionsForCEA: {} } }); + const promise = externalAppCardActionsForCEA.processActionSubmit( testAppId, testConversationId, testActionSubmitPayload, ); - const message = utils.findMessageByFunc('externalAppCardActionsForCEC.processActionSubmit'); + const message = utils.findMessageByFunc('externalAppCardActionsForCEA.processActionSubmit'); if (message && message.args) { expect(message).not.toBeNull(); expect(message.args).toEqual([testAppId, testConversationId, testActionSubmitPayload]); @@ -92,9 +92,9 @@ describe('externalAppCardActionsForCEC', () => { it(`should not allow calls from ${frameContext} context`, async () => { expect.assertions(1); await utils.initializeWithContext(frameContext); - utils.setRuntimeConfig({ apiVersion: 2, supports: { externalAppCardActionsForCEC: {} } }); + utils.setRuntimeConfig({ apiVersion: 2, supports: { externalAppCardActionsForCEA: {} } }); return expect(() => - externalAppCardActionsForCEC.processActionSubmit(testAppId, testConversationId, testActionSubmitPayload), + externalAppCardActionsForCEA.processActionSubmit(testAppId, testConversationId, testActionSubmitPayload), ).toThrowError( new Error( `This call is only allowed in following contexts: ${JSON.stringify(allowedFrameContexts)}. ` + @@ -116,15 +116,15 @@ describe('externalAppCardActionsForCEC', () => { const testResponse = ActionOpenUrlType.DeepLinkDialog; it('should not allow calls before initialization', async () => { return expect(() => - externalAppCardActionsForCEC.processActionOpenUrl(testAppId, testConversationId, testUrl), + externalAppCardActionsForCEA.processActionOpenUrl(testAppId, testConversationId, testUrl), ).toThrowError(new Error(errorLibraryNotInitialized)); }); - it('should throw error when externalAppCardActionsForCEC capability is not supported', async () => { + it('should throw error when externalAppCardActionsForCEA capability is not supported', async () => { expect.assertions(1); await utils.initializeWithContext(FrameContexts.content); utils.setRuntimeConfig({ apiVersion: 2, supports: {} }); try { - await externalAppCardActionsForCEC.processActionOpenUrl(testAppId, testConversationId, testUrl); + await externalAppCardActionsForCEA.processActionOpenUrl(testAppId, testConversationId, testUrl); } catch (e) { expect(e).toEqual(errorNotSupportedOnPlatform); } @@ -134,9 +134,9 @@ describe('externalAppCardActionsForCEC', () => { it(`should resolve when called from context - ${frameContext}`, async () => { expect.assertions(3); await utils.initializeWithContext(frameContext); - utils.setRuntimeConfig({ apiVersion: 2, supports: { externalAppCardActionsForCEC: {} } }); - const promise = externalAppCardActionsForCEC.processActionOpenUrl(testAppId, testConversationId, testUrl); - const message = utils.findMessageByFunc('externalAppCardActionsForCEC.processActionOpenUrl'); + utils.setRuntimeConfig({ apiVersion: 2, supports: { externalAppCardActionsForCEA: {} } }); + const promise = externalAppCardActionsForCEA.processActionOpenUrl(testAppId, testConversationId, testUrl); + const message = utils.findMessageByFunc('externalAppCardActionsForCEA.processActionOpenUrl'); if (message && message.args) { expect(message).not.toBeNull(); expect(message.args).toEqual([testAppId, testUrl.href, testConversationId]); @@ -147,9 +147,9 @@ describe('externalAppCardActionsForCEC', () => { it(`should throw error from host when called from context - ${frameContext}`, async () => { expect.assertions(3); await utils.initializeWithContext(frameContext); - utils.setRuntimeConfig({ apiVersion: 2, supports: { externalAppCardActionsForCEC: {} } }); - const promise = externalAppCardActionsForCEC.processActionOpenUrl(testAppId, testConversationId, testUrl); - const message = utils.findMessageByFunc('externalAppCardActionsForCEC.processActionOpenUrl'); + utils.setRuntimeConfig({ apiVersion: 2, supports: { externalAppCardActionsForCEA: {} } }); + const promise = externalAppCardActionsForCEA.processActionOpenUrl(testAppId, testConversationId, testUrl); + const message = utils.findMessageByFunc('externalAppCardActionsForCEA.processActionOpenUrl'); if (message && message.args) { expect(message).not.toBeNull(); expect(message.args).toEqual([testAppId, testUrl.href, testConversationId]); @@ -161,9 +161,9 @@ describe('externalAppCardActionsForCEC', () => { it(`should not allow calls from ${frameContext} context`, async () => { expect.assertions(1); await utils.initializeWithContext(frameContext); - utils.setRuntimeConfig({ apiVersion: 2, supports: { externalAppCardActionsForCEC: {} } }); + utils.setRuntimeConfig({ apiVersion: 2, supports: { externalAppCardActionsForCEA: {} } }); return expect(() => - externalAppCardActionsForCEC.processActionOpenUrl(testAppId, testConversationId, testUrl), + externalAppCardActionsForCEA.processActionOpenUrl(testAppId, testConversationId, testUrl), ).toThrowError( new Error( `This call is only allowed in following contexts: ${JSON.stringify(allowedFrameContexts)}. ` + @@ -177,21 +177,21 @@ describe('externalAppCardActionsForCEC', () => { describe('isSupported', () => { it('should throw when library is not initialized', () => { - return expect(() => externalAppCardActionsForCEC.isSupported()).toThrowError( + return expect(() => externalAppCardActionsForCEA.isSupported()).toThrowError( new Error(errorLibraryNotInitialized), ); }); - it('should return true when externalAppCardActionsForCEC capability is supported', async () => { + it('should return true when externalAppCardActionsForCEA capability is supported', async () => { expect.assertions(1); await utils.initializeWithContext(FrameContexts.content); - utils.setRuntimeConfig({ apiVersion: 2, supports: { externalAppCardActionsForCEC: {} } }); - return expect(externalAppCardActionsForCEC.isSupported()).toEqual(true); + utils.setRuntimeConfig({ apiVersion: 2, supports: { externalAppCardActionsForCEA: {} } }); + return expect(externalAppCardActionsForCEA.isSupported()).toEqual(true); }); - it('should return false when externalAppCardActionsForCEC capability is not supported', async () => { + it('should return false when externalAppCardActionsForCEA capability is not supported', async () => { expect.assertions(1); await utils.initializeWithContext(FrameContexts.content); utils.setRuntimeConfig({ apiVersion: 2, supports: {} }); - return expect(externalAppCardActionsForCEC.isSupported()).toEqual(false); + return expect(externalAppCardActionsForCEA.isSupported()).toEqual(false); }); }); });