Skip to content

Commit 1a61268

Browse files
[SCAL-265458] Added flags for enable save chat in spotter embed (#331)
1 parent ecc671e commit 1a61268

File tree

4 files changed

+2509
-2369
lines changed

4 files changed

+2509
-2369
lines changed

src/embed/conversation.spec.ts

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ describe('ConversationEmbed', () => {
148148
searchQuery: 'searchQuery',
149149
},
150150
dataPanelV2: true,
151-
hiddenActions: [Action.InConversationTraining]
151+
hiddenActions: [Action.InConversationTraining],
152152
};
153153

154154
const conversationEmbed = new SpotterEmbed(getRootEl(), viewConfig);
@@ -282,6 +282,40 @@ describe('ConversationEmbed', () => {
282282
);
283283
});
284284

285+
it('should render the conversation embed with past conversations sidebar enabled', async () => {
286+
const viewConfig: SpotterEmbedViewConfig = {
287+
worksheetId: 'worksheetId',
288+
searchOptions: {
289+
searchQuery: 'searchQuery',
290+
},
291+
enablePastConversationsSidebar: true,
292+
};
293+
294+
const conversationEmbed = new SpotterEmbed(getRootEl(), viewConfig);
295+
await conversationEmbed.render();
296+
expectUrlMatchesWithParams(
297+
getIFrameSrc(),
298+
`http://${thoughtSpotHost}/v2/?${defaultParams}&isSpotterExperienceEnabled=true&enablePastConversationsSidebar=true#/embed/insights/conv-assist?worksheet=worksheetId&query=searchQuery`,
299+
);
300+
});
301+
302+
it('should render the conversation embed with past conversations sidebar disabled', async () => {
303+
const viewConfig: SpotterEmbedViewConfig = {
304+
worksheetId: 'worksheetId',
305+
searchOptions: {
306+
searchQuery: 'searchQuery',
307+
},
308+
enablePastConversationsSidebar: false,
309+
};
310+
311+
const conversationEmbed = new SpotterEmbed(getRootEl(), viewConfig);
312+
await conversationEmbed.render();
313+
expectUrlMatchesWithParams(
314+
getIFrameSrc(),
315+
`http://${thoughtSpotHost}/v2/?${defaultParams}&isSpotterExperienceEnabled=true&enablePastConversationsSidebar=false#/embed/insights/conv-assist?worksheet=worksheetId&query=searchQuery`,
316+
);
317+
});
318+
285319
it('should ensure deprecated ConversationEmbed class maintains same functionality as SpotterEmbed', async () => {
286320
const viewConfig: SpotterEmbedViewConfig = {
287321
worksheetId: 'worksheetId',

src/embed/conversation.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,22 @@ export interface SpotterEmbedViewConfig extends Omit<BaseViewConfig, 'primaryAct
164164
* @version SDK: 1.41.0 | ThoughtSpot: 10.13.0.cl
165165
*/
166166
excludeRuntimeParametersfromURL?: boolean;
167+
/**
168+
* enablePastConversationsSidebar : Controls the visibility of the past conversations
169+
* sidebar.
170+
*
171+
* Supported embed types: `SpotterEmbed`
172+
* @default false
173+
* @example
174+
* ```js
175+
* const embed = new SpotterEmbed('#tsEmbed', {
176+
* ... //other embed view config
177+
* enablePastConversationsSidebar : true,
178+
* })
179+
* ```
180+
* @version SDK: 1.43.0 | ThoughtSpot: 10.14.0.cl
181+
*/
182+
enablePastConversationsSidebar?: boolean;
167183
}
168184

169185
/**
@@ -205,6 +221,7 @@ export class SpotterEmbed extends TsEmbed {
205221
dataPanelV2,
206222
showSpotterLimitations,
207223
hideSampleQuestions,
224+
enablePastConversationsSidebar,
208225
runtimeFilters,
209226
excludeRuntimeFiltersfromURL,
210227
runtimeParameters,
@@ -246,10 +263,15 @@ export class SpotterEmbed extends TsEmbed {
246263
excludeRuntimeFiltersfromURL,
247264
runtimeParameters,
248265
excludeRuntimeParametersfromURL,
266+
enablePastConversationsSidebar
249267
} = this.viewConfig;
250268
const path = 'insights/conv-assist';
251269
const queryParams = this.getEmbedParamsObject();
252270

271+
if (!isUndefined(enablePastConversationsSidebar)) {
272+
queryParams[Param.EnablePastConversationsSidebar] = !!enablePastConversationsSidebar;
273+
}
274+
253275
let query = '';
254276
const queryParamsString = getQueryParamString(queryParams, true);
255277
if (queryParamsString) {

src/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4367,6 +4367,7 @@ export enum Param {
43674367
LiveboardXLSXCSVDownload = 'isLiveboardXLSXCSVDownloadEnabled',
43684368
isPNGInScheduledEmailsEnabled = 'isPNGInScheduledEmailsEnabled',
43694369
isLinkParametersEnabled = 'isLinkParametersEnabled',
4370+
EnablePastConversationsSidebar = 'enablePastConversationsSidebar',
43704371
}
43714372

43724373
/**

0 commit comments

Comments
 (0)