diff --git a/apps/teams-test-app/e2e-test-data/store.json b/apps/teams-test-app/e2e-test-data/store.json index 43a1531629..6fc21c8360 100644 --- a/apps/teams-test-app/e2e-test-data/store.json +++ b/apps/teams-test-app/e2e-test-data/store.json @@ -123,7 +123,7 @@ "expectedTestAppValue": "Error: Error: 500, message: App does not have the required permissions for this operation" }, { - "title": "openStoreExperience API Call With Invalid Dialog Width Size - Fail", + "title": "openStoreExperience API Call With Invalid Dialog Size - Fail", "type": "callResponse", "boxSelector": "#box_storeOpen", "inputValue": { @@ -136,7 +136,7 @@ "expectedTestAppValue": "Error: Error: Invalid store dialog size" }, { - "title": "openStoreExperience API Call With Invalid Dialog Height Size - Fail", + "title": "openStoreExperience API Call With Invalid Dialog Size - Fail", "type": "callResponse", "boxSelector": "#box_storeOpen", "inputValue": { @@ -147,6 +147,37 @@ } }, "expectedTestAppValue": "Error: Error: Invalid store dialog size" + }, + { + "title": "openStoreExperience API Call InContextStore with Filters - Success", + "type": "callResponse", + "boxSelector": "#box_storeOpen", + "inputValue": { + "dialogType": "ics", + "appCapability": "Bot", + "appMetaCapabilities": ["copilotplugins", "copilotExtensions"], + "installationScope": "Team", + "filteredOutAppIds": ["123"], + "size": { + "width": "large", + "height": "large" + } + }, + "expectedAlertValue": "openStoreExperience called with ##JSON_INPUT_VALUE##" + }, + { + "title": "openStoreExperience API Call InContextStore with Filters - Invalid Params - Fail", + "type": "callResponse", + "boxSelector": "#box_storeOpen", + "inputValue": { + "dialogType": "ics", + "size": { + "width": "large", + "height": "large" + }, + "appCapability": 1234 + }, + "expectedTestAppValue": "Error: Error: 4000, message: appCapability must be a string" } ] } diff --git a/apps/teams-test-app/src/components/StoreApis.tsx b/apps/teams-test-app/src/components/StoreApis.tsx index c717f9a234..d1ed10f021 100644 --- a/apps/teams-test-app/src/components/StoreApis.tsx +++ b/apps/teams-test-app/src/components/StoreApis.tsx @@ -20,7 +20,16 @@ const StoreAPIs = (): ReactElement => { }); const OpenStore = (): ReactElement => - ApiWithTextInput<{ dialogType: string; appId?: string; collectionId?: string; size?: DialogSize }>({ + ApiWithTextInput<{ + dialogType: string; + appId?: string; + collectionId?: string; + size?: DialogSize; + appCapability?: string; + appMetaCapabilities?: string[]; + installationScope?: string; + filteredOutAppIds?: string[]; + }>({ name: 'storeOpen', title: 'Store Open', onClick: { @@ -36,6 +45,10 @@ const StoreAPIs = (): ReactElement => { appId: appId, collectionId: input.collectionId, size: input.size, + appCapability: input.appCapability, + appMetaCapabilities: input.appMetaCapabilities, + installationScope: input.installationScope, + filteredOutAppIds: input.filteredOutAppIds, }; // eslint-disable-next-line no-useless-catch try { diff --git a/packages/teams-js/src/private/store.ts b/packages/teams-js/src/private/store.ts index 9571b1b6f3..a201e32198 100644 --- a/packages/teams-js/src/private/store.ts +++ b/packages/teams-js/src/private/store.ts @@ -57,16 +57,53 @@ export interface StoreSizeInfo { /** * @beta * @hidden - * Interface of open full store, copilot store and in-context-store function parameter + * Interface for opening the full store function parameters * @internal * Limited to Microsoft-internal use */ -export interface OpenFullStoreAndICSParams extends StoreSizeInfo { +export interface OpenFullStoreParams extends StoreSizeInfo { /** - * the store dialog type, defined by {@link StoreDialogType} + * The store dialog type, specifically the full store, defined by {@link StoreDialogType} */ - dialogType: StoreDialogType.FullStore | StoreDialogType.InContextStore; + dialogType: StoreDialogType.FullStore; } + +/** + * @beta + * @hidden + * Interface for opening the in-context store function parameters + * @internal + * Limited to Microsoft-internal use + */ +export interface OpenInContextStoreParams extends StoreSizeInfo { + /** + * The store dialog type, specifically the in-context store, defined by {@link StoreDialogType} + */ + dialogType: StoreDialogType.InContextStore; + + /** + * The application capability (e.g., "Tab", "Bot", "Messaging", "Connector", "CUSTOMBOT"). + * Defaults to "Bot". + */ + appCapability?: string; + + /** + * The application meta capabilities (e.g., ["copilotPlugins", "copilotExtensions"]). + */ + appMetaCapabilities?: string[]; + + /** + * The installation scope (e.g., "Personal" | "Team"). + * Defaults to "Personal". + */ + installationScope?: string; + + /** + * A list of app IDs to be filtered out. + */ + filteredOutAppIds?: string[]; +} + /** * @beta * @hidden @@ -84,6 +121,7 @@ export interface OpenAppDetailParams extends StoreSizeInfo { */ appId: AppId; } + /** * @beta * @hidden @@ -101,14 +139,24 @@ export interface OpenSpecificStoreParams extends StoreSizeInfo { */ collectionId: string; } + /** * @beta * @hidden - * Interface of open store function parameters, including OpenFullStoreAndICSParams, OpenAppDetailParams, OpenSpecificStoreParams + * Interface of open store function parameters, including: + * - `OpenAppDetailParams` + * - `OpenFullStoreParams` + * - `OpenInContextStoreParams` + * - `OpenSpecificStoreParams` + * * @internal * Limited to Microsoft-internal use */ -export type OpenStoreParams = OpenFullStoreAndICSParams | OpenAppDetailParams | OpenSpecificStoreParams; +export type OpenStoreParams = + | OpenAppDetailParams + | OpenFullStoreParams + | OpenInContextStoreParams + | OpenSpecificStoreParams; /** * @beta @@ -178,6 +226,17 @@ export async function openStoreExperience(openStoreParams: OpenStoreParams): Pro throw new Error(errorInvalidDialogSize); } } + + const inContextStoreFilters = + dialogType === StoreDialogType.InContextStore + ? JSON.stringify({ + appCapability: openStoreParams.appCapability, + appMetaCapabilities: openStoreParams.appMetaCapabilities, + installationScope: openStoreParams.installationScope, + filteredOutAppIds: openStoreParams.filteredOutAppIds, + }) + : undefined; + return callFunctionInHost( ApiName.Store_Open, [ @@ -185,6 +244,7 @@ export async function openStoreExperience(openStoreParams: OpenStoreParams): Pro (openStoreParams as OpenAppDetailParams).appId, (openStoreParams as OpenSpecificStoreParams).collectionId, JSON.stringify(openStoreParams.size), + inContextStoreFilters, ], getApiVersionTag(StoreVersionTagNum, ApiName.Store_Open), ); diff --git a/packages/teams-js/test/private/store.spec.ts b/packages/teams-js/test/private/store.spec.ts index 356a311ae4..6293c48614 100644 --- a/packages/teams-js/test/private/store.spec.ts +++ b/packages/teams-js/test/private/store.spec.ts @@ -23,7 +23,7 @@ describe('store', () => { }); describe('openStoreExperience', () => { - const paramFullStore: store.OpenFullStoreAndICSParams = { + const paramFullStore: store.OpenFullStoreParams = { dialogType: store.StoreDialogType.FullStore, }; const paramAppDetail: store.OpenAppDetailParams = {