diff --git a/src/embed/app.spec.ts b/src/embed/app.spec.ts index a52636c5..43cc8340 100644 --- a/src/embed/app.spec.ts +++ b/src/embed/app.spec.ts @@ -592,6 +592,34 @@ describe('App embed tests', () => { }); }); + test('should set showSpotterRadiance to true in url', async () => { + const appEmbed = new AppEmbed(getRootEl(), { + ...defaultViewConfig, + showSpotterRadiance: true, + } as AppViewConfig); + appEmbed.render(); + await executeAfterWait(() => { + expectUrlMatchesWithParams( + getIFrameSrc(), + `http://${thoughtSpotHost}/?embedApp=true&profileAndHelpInNavBarHidden=false&showSpotterRadiance=true${defaultParamsPost}#/home`, + ); + }); + }); + + test('should set showSpotterRadiance to false in url', async () => { + const appEmbed = new AppEmbed(getRootEl(), { + ...defaultViewConfig, + showSpotterRadiance: false, + } as AppViewConfig); + appEmbed.render(); + await executeAfterWait(() => { + expectUrlMatchesWithParams( + getIFrameSrc(), + `http://${thoughtSpotHost}/?embedApp=true&profileAndHelpInNavBarHidden=false&showSpotterRadiance=false${defaultParamsPost}#/home`, + ); + }); + }); + test('should set defaultQueryMode to research in url', async () => { const appEmbed = new AppEmbed(getRootEl(), { ...defaultViewConfig, diff --git a/src/embed/app.ts b/src/embed/app.ts index e3fe6733..d76102c6 100644 --- a/src/embed/app.ts +++ b/src/embed/app.ts @@ -737,6 +737,21 @@ export interface AppViewConfig extends AllEmbedViewConfig { * ``` */ updatedSpotterChatPrompt?: boolean; + /** + * showSpotterRadiance : Controls the radiance on the Spotter page. + * + * Supported embed types: `AppEmbed` + * @version SDK: 1.52.0 | ThoughtSpot Cloud: 26.9.0.cl + * @default false + * @example + * ```js + * const embed = new AppEmbed('#tsEmbed', { + * ... //other embed view config + * showSpotterRadiance : true, + * }) + * ``` + */ + showSpotterRadiance?: boolean; /** * Sets the default query mode when Spotter loads — Fast Search or * Research Mode. Applies fresh on every new session for this embed @@ -1037,6 +1052,7 @@ export class AppEmbed extends V1Embed { isCentralizedLiveboardFilterUXEnabled = false, isLinkParametersEnabled, updatedSpotterChatPrompt, + showSpotterRadiance, defaultQueryMode, enableStopAnswerGenerationEmbed, spotterChatConfig, @@ -1077,6 +1093,9 @@ export class AppEmbed extends V1Embed { if (!isUndefined(updatedSpotterChatPrompt)) { params[Param.UpdatedSpotterChatPrompt] = !!updatedSpotterChatPrompt; } + if (!isUndefined(showSpotterRadiance)) { + params[Param.ShowSpotterRadiance] = !!showSpotterRadiance; + } if (!isUndefined(defaultQueryMode)) { params[Param.DefaultQueryMode] = defaultQueryMode; } diff --git a/src/embed/conversation.spec.ts b/src/embed/conversation.spec.ts index 8e338b58..22fccfae 100644 --- a/src/embed/conversation.spec.ts +++ b/src/embed/conversation.spec.ts @@ -494,6 +494,38 @@ describe('ConversationEmbed', () => { ); }); + it('should render the conversation embed with spotter radiance', async () => { + const viewConfig: SpotterEmbedViewConfig = { + worksheetId: 'worksheetId', + searchOptions: { + searchQuery: 'searchQuery', + }, + showSpotterRadiance: true, + }; + const conversationEmbed = new SpotterEmbed(getRootEl(), viewConfig); + await conversationEmbed.render(); + expectUrlMatchesWithParams( + getIFrameSrc(), + `http://${thoughtSpotHost}/v2/?${defaultParams}&isSpotterExperienceEnabled=true&showSpotterRadiance=true#/embed/insights/conv-assist?worksheet=worksheetId&query=searchQuery`, + ); + }); + + it('should render the conversation embed with spotter radiance disabled', async () => { + const viewConfig: SpotterEmbedViewConfig = { + worksheetId: 'worksheetId', + searchOptions: { + searchQuery: 'searchQuery', + }, + showSpotterRadiance: false, + }; + const conversationEmbed = new SpotterEmbed(getRootEl(), viewConfig); + await conversationEmbed.render(); + expectUrlMatchesWithParams( + getIFrameSrc(), + `http://${thoughtSpotHost}/v2/?${defaultParams}&isSpotterExperienceEnabled=true&showSpotterRadiance=false#/embed/insights/conv-assist?worksheet=worksheetId&query=searchQuery`, + ); + }); + it('should render the conversation embed with default query mode set to research', async () => { const viewConfig: SpotterEmbedViewConfig = { worksheetId: 'worksheetId', diff --git a/src/embed/conversation.ts b/src/embed/conversation.ts index 33bbc4e7..52f7d5c2 100644 --- a/src/embed/conversation.ts +++ b/src/embed/conversation.ts @@ -462,6 +462,21 @@ export interface SpotterEmbedViewConfig extends Omit { }); }); + test('should render the liveboard embed with showSpotterRadiance', async () => { + const liveboardEmbed = new LiveboardEmbed(getRootEl(), { + ...defaultViewConfig, + liveboardId, + showSpotterRadiance: true, + } as LiveboardViewConfig); + await liveboardEmbed.render(); + await executeAfterWait(() => { + expectUrlMatchesWithParams( + getIFrameSrc(), + `http://${thoughtSpotHost}/?embedApp=true${defaultParams}${prefixParams}&showSpotterRadiance=true#/embed/viz/${liveboardId}`, + ); + }); + }); + test('should render the liveboard embed with showSpotterRadiance disabled', async () => { + const liveboardEmbed = new LiveboardEmbed(getRootEl(), { + ...defaultViewConfig, + liveboardId, + showSpotterRadiance: false, + } as LiveboardViewConfig); + await liveboardEmbed.render(); + await executeAfterWait(() => { + expectUrlMatchesWithParams( + getIFrameSrc(), + `http://${thoughtSpotHost}/?embedApp=true${defaultParams}${prefixParams}&showSpotterRadiance=false#/embed/viz/${liveboardId}`, + ); + }); + }); + test('should set hideToolResponseCardBranding parameter in url params via spotterChatConfig', async () => { const liveboardEmbed = new LiveboardEmbed(getRootEl(), { ...defaultViewConfig, diff --git a/src/embed/liveboard.ts b/src/embed/liveboard.ts index 3bc731cf..bf338743 100644 --- a/src/embed/liveboard.ts +++ b/src/embed/liveboard.ts @@ -529,6 +529,21 @@ export interface LiveboardViewConfig extends BaseViewConfig, LiveboardOtherViewC * ``` */ updatedSpotterChatPrompt?: boolean; + /** + * showSpotterRadiance : Controls the radiance on the Spotter page. + * + * Supported embed types: `LiveboardEmbed` + * @version SDK: 1.52.0 | ThoughtSpot Cloud: 26.9.0.cl + * @default false + * @example + * ```js + * const embed = new LiveboardEmbed('#tsEmbed', { + * ... //other embed view config + * showSpotterRadiance : true, + * }) + * ``` + */ + showSpotterRadiance?: boolean; /** * Enables the stop answer generation button in the Spotter embed UI, * allowing users to interrupt an ongoing answer generation. @@ -703,6 +718,7 @@ export class LiveboardEmbed extends V1Embed { isCentralizedLiveboardFilterUXEnabled = false, isLinkParametersEnabled, updatedSpotterChatPrompt, + showSpotterRadiance, enableStopAnswerGenerationEmbed, spotterChatConfig, isThisPeriodInDateFiltersEnabled, @@ -732,6 +748,9 @@ export class LiveboardEmbed extends V1Embed { if (!isUndefined(updatedSpotterChatPrompt)) { params[Param.UpdatedSpotterChatPrompt] = !!updatedSpotterChatPrompt; } + if (!isUndefined(showSpotterRadiance)) { + params[Param.ShowSpotterRadiance] = !!showSpotterRadiance; + } if (!isUndefined(enableStopAnswerGenerationEmbed)) { params[Param.EnableStopAnswerGenerationEmbed] = !!enableStopAnswerGenerationEmbed; } diff --git a/src/types.ts b/src/types.ts index 678cd0ec..4ffca592 100644 --- a/src/types.ts +++ b/src/types.ts @@ -6547,6 +6547,7 @@ export enum Param { isLinkParametersEnabled = 'isLinkParametersEnabled', EnablePastConversationsSidebar = 'enablePastConversationsSidebar', UpdatedSpotterChatPrompt = 'updatedSpotterChatPrompt', + ShowSpotterRadiance = 'showSpotterRadiance', DefaultQueryMode = 'defaultQueryMode', EnableStopAnswerGenerationEmbed = 'enableStopAnswerGenerationEmbed', SpotterSidebarTitle = 'spotterSidebarTitle',