diff --git a/src/embed/app.spec.ts b/src/embed/app.spec.ts index 64e860da..645bde85 100644 --- a/src/embed/app.spec.ts +++ b/src/embed/app.spec.ts @@ -530,7 +530,7 @@ describe('App embed tests', () => { homePage: HomePage.Focused, }, } as AppViewConfig, - `http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&modularHomeExperience=false&navigationVersion=v2&homepageVersion=v4${defaultParams}${defaultParamsPost}#/home`, + `http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&homepageVersion=v4${defaultParams}${defaultParamsPost}#/home`, ); }); @@ -1110,7 +1110,7 @@ describe('App embed tests', () => { await executeAfterWait(() => { expectUrlMatchesWithParams( getIFrameSrc(), - `http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&modularHomeExperience=false&hideHomepageLeftNav=false${defaultParams}${defaultParamsPost}#/home`, + `http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&hideHomepageLeftNav=false${defaultParams}${defaultParamsPost}#/home`, ); }); }); @@ -1127,7 +1127,7 @@ describe('App embed tests', () => { await executeAfterWait(() => { expectUrlMatchesWithParams( getIFrameSrc(), - `http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&modularHomeExperience=false&hideHamburger=true&hideObjectSearch=true&hideNotification=true${defaultParams}${defaultParamsPost}#/home`, + `http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&hideHamburger=true&hideObjectSearch=true&hideNotification=true${defaultParams}${defaultParamsPost}#/home`, ); }); }); @@ -1144,93 +1144,18 @@ describe('App embed tests', () => { await executeAfterWait(() => { expectUrlMatchesWithParams( getIFrameSrc(), - `http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&modularHomeExperience=false${defaultParams}${defaultParamsPost}#/home`, + `http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false${defaultParams}${defaultParamsPost}#/home`, ); }); }); - test('Should add navigationVersion=v3 when primaryNavbarVersion is Sliding to the iframe src', async () => { - await testUrlParams( - { - ...defaultViewConfig, - discoveryExperience: { - primaryNavbarVersion: PrimaryNavbarVersion.Sliding, - homePage: HomePage.Modular, - }, - } as AppViewConfig, - `http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&modularHomeExperience=true&navigationVersion=v3${defaultParams}${defaultParamsPost}#/home` - ); - }); - - test('Should not add navigationVersion=v3 when primaryNavbarVersion is not added to the iframe src', async () => { - await testUrlParams( - { - ...defaultViewConfig, - discoveryExperience: { - homePage: HomePage.Modular, - }, - } as AppViewConfig, - `http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&modularHomeExperience=true${defaultParams}${defaultParamsPost}#/home` - ); - }); - - test('Should add navigationVersion=v3 & modularHomeExperience=true when primaryNavbarVersion is Sliding to the iframe src', async () => { - await testUrlParams( - { - ...defaultViewConfig, - // homePage v2 config not included under discoveryExperience - discoveryExperience: { - primaryNavbarVersion: PrimaryNavbarVersion.Sliding, - }, - } as AppViewConfig, - `http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&modularHomeExperience=true&navigationVersion=v3${defaultParams}${defaultParamsPost}#/home` - ); - }); - - test('Should add homepageVersion=v3 & navigationVersion=v3 & modularHomeExperience=true when Sliding and ModularWithStylingChanges configured in the iframe src', async () => { - await testUrlParams( - { - ...defaultViewConfig, - discoveryExperience: { - primaryNavbarVersion: PrimaryNavbarVersion.Sliding, - homePage: HomePage.ModularWithStylingChanges, - }, - } as AppViewConfig, - `http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&modularHomeExperience=true&navigationVersion=v3&homepageVersion=v3${defaultParams}${defaultParamsPost}#/home` - ); - }); - - test('Should add homepageVersion=v3 & navigationVersion=v3 & modularHomeExperience=true when homePage is ModularWithStylingChanges to the iframe src', async () => { - await testUrlParams( - { - ...defaultViewConfig, - // primaryNavbarVersion is not included under - // discoveryExperience, then it set navigationVersion=v2 and - // modularHomeExperience=false. - discoveryExperience: { - homePage: HomePage.ModularWithStylingChanges, - }, - } as AppViewConfig, - `http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&modularHomeExperience=false&navigationVersion=v2&homepageVersion=v3${defaultParams}${defaultParamsPost}#/home` - ); - }); - - test('Should add navigationVersion=v2 when primaryNavbarVersion is not added to the iframe src', async () => { - await testUrlParams( - { - ...defaultViewConfig, - } as AppViewConfig, - `http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&modularHomeExperience=false&navigationVersion=v2${defaultParams}${defaultParamsPost}#/home` - ); - }); - test('Should add enableAskSage flag to the iframe src', async () => { await testUrlParams( { ...defaultViewConfig, enableAskSage: true, } as AppViewConfig, - `http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&modularHomeExperience=false&enableAskSage=true${defaultParams}${defaultParamsPost}#/home` + `http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&enableAskSage=true${defaultParams}${defaultParamsPost}#/home` ); }); @@ -1242,7 +1167,7 @@ describe('App embed tests', () => { listPageVersion: ListPage.ListWithUXChanges, }, } as AppViewConfig, - `http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&modularHomeExperience=false&listpageVersion=v3${defaultParams}${defaultParamsPost}#/home` + `http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&listpageVersion=v3${defaultParams}${defaultParamsPost}#/home` ); }); @@ -1251,7 +1176,7 @@ describe('App embed tests', () => { { ...defaultViewConfig, } as AppViewConfig, - `http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&modularHomeExperience=false&navigationVersion=v2${defaultParams}${defaultParamsPost}#/home` + `http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false${defaultParams}${defaultParamsPost}#/home` ); }); @@ -1264,7 +1189,7 @@ describe('App embed tests', () => { homePage: HomePage.Modular, }, } as AppViewConfig, - `http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&modularHomeExperience=true&navigationVersion=v3${defaultParams}${defaultParamsPost}#/home` + `http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false${defaultParams}${defaultParamsPost}#/home` ); }); @@ -1279,7 +1204,7 @@ describe('App embed tests', () => { listPageVersion: ListPage.ListWithUXChanges, }, } as AppViewConfig, - `http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&modularHomeExperience=true&navigationVersion=v3&listpageVersion=v3${defaultParams}${defaultParamsPost}#/home` + `http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&listpageVersion=v3${defaultParams}${defaultParamsPost}#/home` ); }); @@ -1292,7 +1217,7 @@ describe('App embed tests', () => { await executeAfterWait(() => { expectUrlMatchesWithParams( getIFrameSrc(), - `http://${thoughtSpotHost}/?enablePendoHelp=true&embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&modularHomeExperience=false${defaultParams}${defaultParamsPost}#/home`, + `http://${thoughtSpotHost}/?enablePendoHelp=true&embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false${defaultParams}${defaultParamsPost}#/home`, ); }); @@ -1305,7 +1230,7 @@ describe('App embed tests', () => { await executeAfterWait(() => { expectUrlMatchesWithParams( getIFrameSrc(), - `http://${thoughtSpotHost}/?enablePendoHelp=false&embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&modularHomeExperience=false${defaultParams}${defaultParamsPost}#/home`, + `http://${thoughtSpotHost}/?enablePendoHelp=false&embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false${defaultParams}${defaultParamsPost}#/home`, ); }); }); @@ -1358,7 +1283,7 @@ describe('App embed tests', () => { await executeAfterWait(() => { expectUrlMatchesWithParams( getIFrameSrc(), - `http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&modularHomeExperience=false&homePageSearchBarMode=objectSearch${defaultParams}${defaultParamsPost}#/home`, + `http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&homePageSearchBarMode=objectSearch${defaultParams}${defaultParamsPost}#/home`, ); }); }); @@ -1373,7 +1298,7 @@ describe('App embed tests', () => { await executeAfterWait(() => { expectUrlMatchesWithParams( getIFrameSrc(), - `http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&modularHomeExperience=false&homePageSearchBarMode=aiAnswer${defaultParams}${defaultParamsPost}#/home`, + `http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&homePageSearchBarMode=aiAnswer${defaultParams}${defaultParamsPost}#/home`, ); }); }); @@ -1388,7 +1313,7 @@ describe('App embed tests', () => { await executeAfterWait(() => { expectUrlMatchesWithParams( getIFrameSrc(), - `http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&modularHomeExperience=false&homePageSearchBarMode=none${defaultParams}${defaultParamsPost}#/home`, + `http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&homePageSearchBarMode=none${defaultParams}${defaultParamsPost}#/home`, ); }); }); @@ -1405,7 +1330,7 @@ describe('App embed tests', () => { await executeAfterWait(() => { expectUrlMatchesWithParams( getIFrameSrc(), - `http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&modularHomeExperience=false&dataPanelCustomGroupsAccordionInitialState=EXPAND_FIRST${defaultParams}${defaultParamsPost}#/home`, + `http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&dataPanelCustomGroupsAccordionInitialState=EXPAND_FIRST${defaultParams}${defaultParamsPost}#/home`, ); }); }); diff --git a/src/embed/app.ts b/src/embed/app.ts index 935813df..304bcf89 100644 --- a/src/embed/app.ts +++ b/src/embed/app.ts @@ -110,6 +110,9 @@ export enum HomePage { /** * Modular (v2) introduces the updated Modular Home Experience. * It serves as the foundational version of the home page. + * Use {@link HomePage.ModularWithStylingChanges} (v3) or + * {@link HomePage.Focused} (v4) instead. + * @deprecated v1 and v2 home page experiences are deprecated. */ Modular = 'v2', /** @@ -119,7 +122,7 @@ export enum HomePage { ModularWithStylingChanges = 'v3', /** * Focused (v4) introduces the V4 homepage experience - * in which Watchlist and recents and incorporated together + * in which Watchlist and recents and incorporated together * to form a more focused homepage. * Pre-requisite : spotter enablement * @version SDK: 1.50.0 | ThoughtSpot Cloud: 26.7.0.cl @@ -186,13 +189,14 @@ export interface AppViewConfig extends AllEmbedViewConfig { showPrimaryNavbar?: boolean; /** * Control the visibility of the left navigation panel on the home page - * in the V2 and V3 navigation and home page experience. + * in the V3 and V4 navigation and home page experience. * If `showPrimaryNavbar` is true, that is, if the Global and Homepage * navigation bars are visible, this flag will only hide the left navigation bar * on the home page. * The `showPrimaryNavbar` flag takes precedence over the `hideHomepageLeftNav`. * - * **Note**: This attribute is not supported in the classic (V1) experience. + * **Note**: The classic (V1) and Modular (V2) home page experiences are + * deprecated. This attribute applies to v3 and v4 home page experiences. * * Supported embed types: `AppEmbed` * @version SDK: 1.28.0 | ThoughtSpot: 9.12.5.cl @@ -258,11 +262,10 @@ export interface AppViewConfig extends AllEmbedViewConfig { hideHamburger?: boolean; /** * Control the visibility of the object search - * on the top navigation bar in the - * V2 and V3 navigation experience. + * on the top navigation bar in the V3 navigation experience. * - * **Note**: This attribute is not supported - * in the classic (V1) experience. + * **Note**: The classic (V1) and V2 navigation experiences are + * deprecated. This attribute applies to the V3 navigation experience. * * Supported embed types: `AppEmbed` * @version SDK: 1.40.0 | ThoughtSpot: 10.11.0.cl @@ -280,8 +283,8 @@ export interface AppViewConfig extends AllEmbedViewConfig { * Control the visibility of the notification icon * on the top navigation bar in V3 navigation experience. * - * **Note**: This attribute is not supported - * in the classic (V1) and V2 experience modes. + * **Note**: The classic (V1) and V2 experience modes are deprecated. + * This attribute applies to the V3 experience. * * Supported embed types: `AppEmbed` * @version SDK: 1.40.0 | ThoughtSpot: 10.11.0.cl @@ -296,14 +299,14 @@ export interface AppViewConfig extends AllEmbedViewConfig { */ hideNotification?: boolean; /** - * Control the visibility of the application selection menu - * in the top navigation bar in the V2 experience. + * Control the visibility of the application selection menu. * In the V3 experience, it shows or hides application selection * icons on the left navigation panel. * By default, the application selection menu and icons are * shown in the UI. * - * **Note**: This attribute is not supported in the classic (V1) experience. + * **Note**: The classic (V1) and V2 experiences are deprecated. + * This attribute applies to the V3 experience. * * Supported embed types: `AppEmbed` * @version SDK: 1.28.0 | ThoughtSpot: 9.12.5.cl @@ -321,7 +324,8 @@ export interface AppViewConfig extends AllEmbedViewConfig { * Control the visibility of the Org switcher button on the nav-bar. * By default, the Org switcher button is shown. * - * **Note**: This attribute is not supported in the classic (V1) experience. + * **Note**: The classic (V1) experience is deprecated. This attribute + * applies to V2 (deprecated), V3 and V4 experiences. * * Supported embed types: `AppEmbed` * @version SDK: 1.28.0 | ThoughtSpot: 9.12.5.cl @@ -480,6 +484,10 @@ export interface AppViewConfig extends AllEmbedViewConfig { * Supported embed types: `AppEmbed` * @version SDK: 1.28.0 | ThoughtSpot: 9.12.5.cl * @default false + * Use the discoveryExperience.homePage option with + * {@link HomePage.ModularWithStylingChanges} (v3) or + * {@link HomePage.Focused} (v4) instead. + * @deprecated The V1 and V2 home page experiences are deprecated. * @example * ```js * const embed = new AppEmbed('#tsEmbed', { @@ -893,7 +901,7 @@ export class AppEmbed extends V1Embed { isLiveboardMasterpiecesEnabled = false, newChartsLibrary, hideHomepageLeftNav = false, - modularHomeExperience = false, + modularHomeExperience, isLiveboardHeaderSticky = true, enableAskSage, collapseSearchBarInitially = false, @@ -1084,7 +1092,6 @@ export class AppEmbed extends V1Embed { params[Param.DataPanelV2Enabled] = dataPanelV2; params[Param.HideHomepageLeftNav] = hideHomepageLeftNav; - params[Param.ModularHomeExperienceEnabled] = modularHomeExperience; params[Param.CollapseSearchBarInitially] = collapseSearchBarInitially || collapseSearchBar; params[Param.EnableCustomColumnGroups] = enableCustomColumnGroups; if (dataPanelCustomGroupsAccordionInitialState @@ -1105,36 +1112,10 @@ export class AppEmbed extends V1Embed { params[Param.ModularHomeExperienceEnabled] = modularHomeExperience; } - // Set navigation to v2 by default to avoid problems like the app - // switcher (9-dot menu) not showing when v3 navigation is turned on - // at the cluster level. - // To use v3 navigation, we must manually set the discoveryExperience - // settings. - params[Param.NavigationVersion] = 'v2'; - // Set homePageVersion to v2 by default to reset the LD flag value - // for the homepageVersion. - params[Param.HomepageVersion] = 'v2'; + // Navigation v1/v2 and home page v1/v2 are deprecated. v3 is the + // default so navigationVersion and homepageVersion need to be + // sent by default. if (discoveryExperience) { - // primaryNavbarVersion v3 will enabled the new left navigation - if (discoveryExperience.primaryNavbarVersion === PrimaryNavbarVersion.Sliding) { - params[Param.NavigationVersion] = discoveryExperience.primaryNavbarVersion; - // Enable the modularHomeExperience when Sliding is enabled. - params[Param.ModularHomeExperienceEnabled] = true; - } - - // homePage v2 will enable the modular home page - // and it will override the modularHomeExperience value - if (discoveryExperience.homePage === HomePage.Modular) { - params[Param.ModularHomeExperienceEnabled] = true; - } - - // ModularWithStylingChanges (v3) introduces the styling changes - // to the Modular Homepage. - // v3 will be the base version of homePageVersion. - if (discoveryExperience.homePage === HomePage.ModularWithStylingChanges) { - params[Param.HomepageVersion] = HomePage.ModularWithStylingChanges; - } - // listPageVersion can be changed to v2 or v3 if (discoveryExperience.listPageVersion !== undefined) { params[Param.ListPageVersion] = discoveryExperience.listPageVersion; diff --git a/src/types.ts b/src/types.ts index 1bf46c2f..d1b83cb5 100644 --- a/src/types.ts +++ b/src/types.ts @@ -176,7 +176,9 @@ export enum AuthType { } /** * - * **Note**: This attribute is not supported in the classic (V1) homepage experience. + * **Note**: The classic (V1) and Modular (V2) home page experiences are + * deprecated. This attribute applies to v3 (ModularWithStylingChanges) and + * v4 (Focused) home page experiences. * */ @@ -1512,7 +1514,9 @@ export interface HomePageConfig { * To specify the modules, import the `HomepageModule` enum. * For example: `hiddenHomepageModules = [HomepageModule.MyLibrary]` * - * **Note**: This attribute is not supported in the classic (v1) experience. + * **Note**: The classic (v1) and Modular (v2) home page experiences are + * deprecated. This attribute applies to v3 (ModularWithStylingChanges) + * and v4 (Focused) home page experiences. * * Supported embed types: `AppEmbed` * @version SDK: 1.28.0 | ThoughtSpot: 9.12.5.cl, 10.1.0.sw @@ -1521,7 +1525,7 @@ export interface HomePageConfig { * import { HomepageModule } from '@thoughtspot/visual-embed-sdk'; * * const embed = new AppEmbed('#tsEmbed', { - * ... // V2/V3 navigation and home page experience attributes + * ... // V3 navigation and home page experience attributes * hiddenHomepageModules : [HomepageModule.Favorite,HomepageModule.Learning], * //...other embed view configuration attributes * }) @@ -1532,8 +1536,11 @@ export interface HomePageConfig { * Reorder home page modules. * To specify the modules, import the `HomepageModule` enum. * For example: `reorderedHomepageModules = [HomepageModule.MyLibrary, - * HomepageModule.Watchlist]` **Note**: This attribute is not supported in the - * classic (v1) homepage. + * HomepageModule.Watchlist]` + * + * **Note**: The classic (v1) and Modular (v2) home page experiences are + * deprecated. This attribute applies to v3 (ModularWithStylingChanges) + * and v4 (Focused) home page experiences. * * Supported embed types: `AppEmbed` * @version SDK: 1.28.0 | ThoughtSpot: 9.12.5.cl, 10.1.0.sw @@ -1542,7 +1549,7 @@ export interface HomePageConfig { * import { HomepageModule } from '@thoughtspot/visual-embed-sdk'; * * const embed = new AppEmbed('#tsEmbed', { - * ...//V2/V3 navigation and home page experience attributes + * ...//V3 navigation and home page experience attributes * reorderedHomepageModules:[HomepageModule.Favorite,HomepageModule.MyLibrary], * //... other embed view configuration attributes * }) @@ -1554,7 +1561,9 @@ export interface HomePageConfig { * on the home page left navigation panel. * To specify the menu items, import the `HomeLeftNavItem` enum. * - * **Note**: This attribute is not supported in the classic (v1) homepage. + * **Note**: The classic (v1) and Modular (v2) home page experiences are + * deprecated. This attribute applies to v3 (ModularWithStylingChanges) + * and v4 (Focused) home page experiences. * * Supported embed types: `AppEmbed` * @version SDK: 1.28.0 | ThoughtSpot: 9.12.5.cl, 10.1.0.sw @@ -2148,7 +2157,9 @@ export enum RuntimeFilterOp { * via `hiddenHomepageModules` and reordered via * `reorderedHomepageModules`. * - * **Note**: This option is not supported in the classic (v1) experience. + * **Note**: The classic (v1) and Modular (v2) home page experiences are + * deprecated. These modules apply to v3 (ModularWithStylingChanges) and + * v4 (Focused) home page experiences. * @version SDK: 1.28.0 | ThoughtSpot: 9.12.5.cl, 10.1.0.sw */