Skip to content
30 changes: 30 additions & 0 deletions src/embed/app.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,36 @@ describe('App embed tests', () => {
});
});

test('Should add flipTooltipToContextMenuEnabled flag to the iframe src', async () => {
const appEmbed = new AppEmbed(getRootEl(), {
...defaultViewConfig,
enableFlipTooltipToContextMenu: true,
} as AppViewConfig);

appEmbed.render();
await executeAfterWait(() => {
expectUrlMatchesWithParams(
getIFrameSrc(),
`http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&flipTooltipToContextMenuEnabled=true${defaultParams}${defaultParamsPost}#/home`,
);
});
});

test('Should not add flipTooltipToContextMenuEnabled flag to the iframe src when if false', async () => {
const appEmbed = new AppEmbed(getRootEl(), {
...defaultViewConfig,
enableFlipTooltipToContextMenu: false,
} as AppViewConfig);

appEmbed.render();
await executeAfterWait(() => {
expectUrlMatchesWithParams(
getIFrameSrc(),
`http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false${defaultParams}${defaultParamsPost}#/home`,
);
});
});

test('Should add hideHomepageLeftNav flag to the iframe src', async () => {
const appEmbed = new AppEmbed(getRootEl(), {
...defaultViewConfig,
Expand Down
5 changes: 5 additions & 0 deletions src/embed/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,7 @@ export class AppEmbed extends V1Embed {
hideIrrelevantChipsInLiveboardTabs = false,
homePageSearchBarMode,
isUnifiedSearchExperienceEnabled = true,
enableFlipTooltipToContextMenu = false,
} = this.viewConfig;

let params = {};
Expand Down Expand Up @@ -574,6 +575,10 @@ export class AppEmbed extends V1Embed {
params[Param.HomePageSearchBarMode] = homePageSearchBarMode;
}

if (enableFlipTooltipToContextMenu) {
params[Param.EnableFlipTooltipToContextMenu] = enableFlipTooltipToContextMenu;
}

params[Param.DataPanelV2Enabled] = dataPanelV2;
params[Param.HideHomepageLeftNav] = hideHomepageLeftNav;
params[Param.ModularHomeExperienceEnabled] = modularHomeExperience;
Expand Down
36 changes: 36 additions & 0 deletions src/embed/conversation.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,42 @@ describe('ConversationEmbed', () => {
);
});

it('Should add flipTooltipToContextMenuEnabled flag to the iframe src', async () => {
const appEmbed = new ConversationEmbed(getRootEl(), {
worksheetId: 'worksheetId',
searchOptions: {
searchQuery: 'searchQuery',
},
enableFlipTooltipToContextMenu: true,
} as ConversationViewConfig);

appEmbed.render();
await executeAfterWait(() => {
expectUrlMatchesWithParams(
getIFrameSrc(),
`http://${thoughtSpotHost}/v2/?${defaultParams}&isSpotterExperienceEnabled=true&flipTooltipToContextMenuEnabled=true#/embed/insights/conv-assist?worksheet=worksheetId&query=searchQuery`,
);
});
});

it('Should not add flipTooltipToContextMenuEnabled flag to the iframe src when flag is false', async () => {
const appEmbed = new ConversationEmbed(getRootEl(), {
worksheetId: 'worksheetId',
searchOptions: {
searchQuery: 'searchQuery',
},
enableFlipTooltipToContextMenu: false,
} as ConversationViewConfig);

appEmbed.render();
await executeAfterWait(() => {
expectUrlMatchesWithParams(
getIFrameSrc(),
`http://${thoughtSpotHost}/v2/?${defaultParams}&isSpotterExperienceEnabled=true#/embed/insights/conv-assist?worksheet=worksheetId&query=searchQuery`,
);
});
});

it('should render the conversation embed with worksheets disabled', async () => {
const viewConfig: ConversationViewConfig = {
worksheetId: 'worksheetId',
Expand Down
4 changes: 4 additions & 0 deletions src/embed/conversation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ export class ConversationEmbed extends TsEmbed {
searchOptions,
disableSourceSelection,
hideSourceSelection,
enableFlipTooltipToContextMenu = false,
} = this.viewConfig;
const path = 'insights/conv-assist';
if (!worksheetId) {
Expand All @@ -92,6 +93,9 @@ export class ConversationEmbed extends TsEmbed {
if (!isUndefined(hideSourceSelection)) {
queryParams[Param.HideSourceSelection] = !!hideSourceSelection;
}
if (enableFlipTooltipToContextMenu) {
queryParams[Param.EnableFlipTooltipToContextMenu] = enableFlipTooltipToContextMenu;
}

let query = '';
const queryParamsString = getQueryParamString(queryParams, true);
Expand Down
32 changes: 32 additions & 0 deletions src/embed/liveboard.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,38 @@ describe('Liveboard/viz embed tests', () => {
});
});

test('Should add flipTooltipToContextMenuEnabled flag to the iframe src', async () => {
const appEmbed = new LiveboardEmbed(getRootEl(), {
...defaultViewConfig,
liveboardId,
enableFlipTooltipToContextMenu: true,
} as LiveboardViewConfig);

appEmbed.render();
await executeAfterWait(() => {
expectUrlMatchesWithParams(
getIFrameSrc(),
`http://${thoughtSpotHost}/?embedApp=true&flipTooltipToContextMenuEnabled=true${defaultParams}${prefixParams}#/embed/viz/${liveboardId}`,
);
});
});

test('Should not add flipTooltipToContextMenuEnabled flag to the iframe src when if false', async () => {
const appEmbed = new LiveboardEmbed(getRootEl(), {
...defaultViewConfig,
liveboardId,
enableFlipTooltipToContextMenu: false,
} as LiveboardViewConfig);

appEmbed.render();
await executeAfterWait(() => {
expectUrlMatchesWithParams(
getIFrameSrc(),
`http://${thoughtSpotHost}/?embedApp=true${defaultParams}${prefixParams}#/embed/viz/${liveboardId}`,
);
});
});

test('should render liveboard with data panel v2 flag set to false by default', async () => {
const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
...defaultViewConfig,
Expand Down
4 changes: 4 additions & 0 deletions src/embed/liveboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,7 @@ export class LiveboardEmbed extends V1Embed {
enable2ColumnLayout,
dataPanelV2 = false,
enableCustomColumnGroups = false,
enableFlipTooltipToContextMenu = false,
} = this.viewConfig;

const preventLiveboardFilterRemoval = this.viewConfig.preventLiveboardFilterRemoval
Expand Down Expand Up @@ -444,6 +445,9 @@ export class LiveboardEmbed extends V1Embed {
if (enableAskSage) {
params[Param.enableAskSage] = enableAskSage;
}
if (enableFlipTooltipToContextMenu) {
params[Param.EnableFlipTooltipToContextMenu] = enableFlipTooltipToContextMenu;
}

params[Param.LiveboardHeaderSticky] = isLiveboardHeaderSticky;
params[Param.LiveboardHeaderV2] = isLiveboardCompactHeaderEnabled;
Expand Down
30 changes: 30 additions & 0 deletions src/embed/sage.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,36 @@ describe('Sage embed tests', () => {
});
});

test('Should add flipTooltipToContextMenuEnabled flag to the iframe src', async () => {
const appEmbed = new SageEmbed(getRootEl(), {
...defaultConfig,
enableFlipTooltipToContextMenu: true,
} as SageViewConfig);

appEmbed.render();
await executeAfterWait(() => {
expectUrlMatch(
getIFrameSrc(),
`http://${thoughtSpotHost}/?embedApp=true&enableDataPanelV2=false&isSageEmbed=true&disableWorksheetChange=false&hideWorksheetSelector=false&hideEurekaSuggestions=false&isProductTour=false&hideSageAnswerHeader=false&hideAction=%5B%22reportError%22%5D&flipTooltipToContextMenuEnabled=true#/embed/eureka`,
);
});
});

test('Should not add flipTooltipToContextMenuEnabled flag to the iframe src when if false', async () => {
const appEmbed = new SageEmbed(getRootEl(), {
...defaultConfig,
enableFlipTooltipToContextMenu: false,
} as SageViewConfig);

appEmbed.render();
await executeAfterWait(() => {
expectUrlMatch(
getIFrameSrc(),
`http://${thoughtSpotHost}/?embedApp=true&enableDataPanelV2=false&isSageEmbed=true&disableWorksheetChange=false&hideWorksheetSelector=false&hideEurekaSuggestions=false&isProductTour=false&hideSageAnswerHeader=false&hideAction=%5B%22reportError%22%5D#/embed/eureka`,
);
});
});

test('should render sage with disable worksheet change flag', async () => {
const sageEmbed = new SageEmbed(getRootEl(), {
...defaultConfig,
Expand Down
4 changes: 4 additions & 0 deletions src/embed/sage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ export class SageEmbed extends V1Embed {
isProductTour,
hideSageAnswerHeader,
hideAutocompleteSuggestions,
enableFlipTooltipToContextMenu = false,
} = this.viewConfig;

const params = this.getBaseQueryParams();
Expand All @@ -168,6 +169,9 @@ export class SageEmbed extends V1Embed {
params[Param.HideEurekaSuggestions] = !showObjectSuggestions;
// support backwards compatibility
}
if (enableFlipTooltipToContextMenu) {
params[Param.EnableFlipTooltipToContextMenu] = enableFlipTooltipToContextMenu;
}
params[Param.HideSampleQuestions] = !!hideSampleQuestions;
params[Param.IsProductTour] = !!isProductTour;
params[Param.HideSageAnswerHeader] = !!hideSageAnswerHeader;
Expand Down
35 changes: 35 additions & 0 deletions src/embed/search.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {
SearchEmbed,
HiddenActionItemByDefaultForSearchEmbed,
DataPanelCustomColumnGroupsAccordionState,
SearchViewConfig,
} from './search';
import * as authInstance from '../auth';
import { init } from '../index';
Expand Down Expand Up @@ -57,6 +58,40 @@ describe('Search embed tests', () => {
});
});

test('Should add flipTooltipToContextMenuEnabled flag to the iframe src', async () => {
const dataSources = ['data-source-1'];
const appEmbed = new SearchEmbed(getRootEl(), {
...defaultViewConfig,
dataSources,
enableFlipTooltipToContextMenu: true,
} as SearchViewConfig);

appEmbed.render();
await executeAfterWait(() => {
expectUrlMatchesWithParams(
getIFrameSrc(),
`http://${thoughtSpotHost}/v2/?${defaultParamsWithHiddenActions}&dataSources=[%22data-source-1%22]&dataSourceMode=expand&useLastSelectedSources=false&flipTooltipToContextMenuEnabled=true${prefixParams}#/embed/answer`,
);
});
});

test('Should not add flipTooltipToContextMenuEnabled flag to the iframe src when if false', async () => {
const dataSources = ['data-source-1'];
const appEmbed = new SearchEmbed(getRootEl(), {
...defaultViewConfig,
dataSources,
enableFlipTooltipToContextMenu: false,
} as SearchViewConfig);

appEmbed.render();
await executeAfterWait(() => {
expectUrlMatchesWithParams(
getIFrameSrc(),
`http://${thoughtSpotHost}/v2/?${defaultParamsWithHiddenActions}&dataSources=[%22data-source-1%22]&dataSourceMode=expand&useLastSelectedSources=false${prefixParams}#/embed/answer`,
);
});
});

test('should pass in data sources', async () => {
const dataSources = ['data-source-1'];
const searchEmbed = new SearchEmbed(getRootEl(), {
Expand Down
5 changes: 5 additions & 0 deletions src/embed/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@ export class SearchEmbed extends TsEmbed {
focusSearchBarOnRender = true,
excludeRuntimeParametersfromURL,
collapseSearchBar = true,
enableFlipTooltipToContextMenu = false,
} = this.viewConfig;
const queryParams = this.getBaseQueryParams();

Expand Down Expand Up @@ -387,6 +388,10 @@ export class SearchEmbed extends TsEmbed {
queryParams[Param.FocusSearchBarOnRender] = focusSearchBarOnRender;
}

if (enableFlipTooltipToContextMenu) {
queryParams[Param.EnableFlipTooltipToContextMenu] = enableFlipTooltipToContextMenu;
}

queryParams[Param.DataPanelV2Enabled] = dataPanelV2;
queryParams[Param.DataSourceMode] = this.getDataSourceMode();

Expand Down
8 changes: 8 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1100,6 +1100,13 @@ export interface ViewConfig {
* @version SDK: 1.35.0 | ThoughtSpot: 10.5.0.cl
*/
overrideOrgId?: number;
/**
* Flag to control new flip tooltip context menu experience
*
* @default false
* @version SDK: 1.36.0 | Thoughtspot: 10.6.0.cl
*/
enableFlipTooltipToContextMenu?: boolean;
}

/**
Expand Down Expand Up @@ -3308,6 +3315,7 @@ export enum Param {
SpotterEnabled = 'isSpotterExperienceEnabled',
IsUnifiedSearchExperienceEnabled = 'isUnifiedSearchExperienceEnabled',
OverrideOrgId = 'orgId',
EnableFlipTooltipToContextMenu = 'flipTooltipToContextMenuEnabled',
}

/**
Expand Down
Loading