@thoughtspot/visual-embed-sdk 1.32.0 → 1.32.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/package.json +4 -22
- package/cjs/src/auth.d.ts.map +1 -1
- package/cjs/src/auth.js +6 -5
- package/cjs/src/auth.js.map +1 -1
- package/cjs/src/authToken.d.ts.map +1 -1
- package/cjs/src/authToken.js +5 -7
- package/cjs/src/authToken.js.map +1 -1
- package/cjs/src/css-variables.d.ts +28 -0
- package/cjs/src/css-variables.d.ts.map +1 -1
- package/cjs/src/embed/app.d.ts +16 -14
- package/cjs/src/embed/app.d.ts.map +1 -1
- package/cjs/src/embed/app.js +19 -4
- package/cjs/src/embed/app.js.map +1 -1
- package/cjs/src/embed/app.spec.js +32 -0
- package/cjs/src/embed/app.spec.js.map +1 -1
- package/cjs/src/embed/base.d.ts.map +1 -1
- package/cjs/src/embed/base.js +2 -0
- package/cjs/src/embed/base.js.map +1 -1
- package/cjs/src/embed/liveboard.d.ts.map +1 -1
- package/cjs/src/embed/liveboard.js +2 -1
- package/cjs/src/embed/liveboard.js.map +1 -1
- package/cjs/src/embed/liveboard.spec.js +10 -0
- package/cjs/src/embed/liveboard.spec.js.map +1 -1
- package/cjs/src/embed/search.d.ts +14 -13
- package/cjs/src/embed/search.d.ts.map +1 -1
- package/cjs/src/embed/search.js +6 -4
- package/cjs/src/embed/search.js.map +1 -1
- package/cjs/src/embed/search.spec.js +9 -9
- package/cjs/src/embed/search.spec.js.map +1 -1
- package/cjs/src/embed/ts-embed.d.ts +1 -1
- package/cjs/src/embed/ts-embed.d.ts.map +1 -1
- package/cjs/src/embed/ts-embed.js +10 -6
- package/cjs/src/embed/ts-embed.js.map +1 -1
- package/cjs/src/errors.d.ts +11 -0
- package/cjs/src/errors.d.ts.map +1 -1
- package/cjs/src/errors.js +11 -0
- package/cjs/src/errors.js.map +1 -1
- package/cjs/src/mixpanel-service.d.ts +4 -0
- package/cjs/src/mixpanel-service.d.ts.map +1 -1
- package/cjs/src/mixpanel-service.js +6 -1
- package/cjs/src/mixpanel-service.js.map +1 -1
- package/cjs/src/react/index.spec.js +1 -1
- package/cjs/src/react/index.spec.js.map +1 -1
- package/cjs/src/types.d.ts +178 -6
- package/cjs/src/types.d.ts.map +1 -1
- package/cjs/src/types.js +138 -3
- package/cjs/src/types.js.map +1 -1
- package/cjs/src/utils/processData.d.ts.map +1 -1
- package/cjs/src/utils/processData.js +2 -1
- package/cjs/src/utils/processData.js.map +1 -1
- package/cjs/src/utils/reporting.d.ts +16 -0
- package/cjs/src/utils/reporting.d.ts.map +1 -0
- package/cjs/src/utils/reporting.js +68 -0
- package/cjs/src/utils/reporting.js.map +1 -0
- package/cjs/src/utils/reporting.spec.d.ts +2 -0
- package/cjs/src/utils/reporting.spec.d.ts.map +1 -0
- package/cjs/src/utils/reporting.spec.js +76 -0
- package/cjs/src/utils/reporting.spec.js.map +1 -0
- package/dist/src/auth.d.ts.map +1 -1
- package/dist/src/authToken.d.ts.map +1 -1
- package/dist/src/css-variables.d.ts +28 -0
- package/dist/src/css-variables.d.ts.map +1 -1
- package/dist/src/embed/app.d.ts +16 -14
- package/dist/src/embed/app.d.ts.map +1 -1
- package/dist/src/embed/base.d.ts.map +1 -1
- package/dist/src/embed/liveboard.d.ts.map +1 -1
- package/dist/src/embed/search.d.ts +14 -13
- package/dist/src/embed/search.d.ts.map +1 -1
- package/dist/src/embed/ts-embed.d.ts +1 -1
- package/dist/src/embed/ts-embed.d.ts.map +1 -1
- package/dist/src/errors.d.ts +11 -0
- package/dist/src/errors.d.ts.map +1 -1
- package/dist/src/mixpanel-service.d.ts +4 -0
- package/dist/src/mixpanel-service.d.ts.map +1 -1
- package/dist/src/types.d.ts +178 -6
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/utils/processData.d.ts.map +1 -1
- package/dist/src/utils/reporting.d.ts +16 -0
- package/dist/src/utils/reporting.d.ts.map +1 -0
- package/dist/src/utils/reporting.spec.d.ts +2 -0
- package/dist/src/utils/reporting.spec.d.ts.map +1 -0
- package/dist/tsembed-react.es.js +214 -39
- package/dist/tsembed-react.js +214 -39
- package/dist/tsembed.es.js +261 -40
- package/dist/tsembed.js +261 -40
- package/dist/visual-embed-sdk-react-full.d.ts +241 -34
- package/dist/visual-embed-sdk-react.d.ts +241 -34
- package/dist/visual-embed-sdk.d.ts +241 -34
- package/lib/package.json +4 -22
- package/lib/src/auth.d.ts.map +1 -1
- package/lib/src/auth.js +6 -5
- package/lib/src/auth.js.map +1 -1
- package/lib/src/authToken.d.ts.map +1 -1
- package/lib/src/authToken.js +5 -7
- package/lib/src/authToken.js.map +1 -1
- package/lib/src/css-variables.d.ts +28 -0
- package/lib/src/css-variables.d.ts.map +1 -1
- package/lib/src/embed/app.d.ts +16 -14
- package/lib/src/embed/app.d.ts.map +1 -1
- package/lib/src/embed/app.js +18 -3
- package/lib/src/embed/app.js.map +1 -1
- package/lib/src/embed/app.spec.js +33 -1
- package/lib/src/embed/app.spec.js.map +1 -1
- package/lib/src/embed/base.d.ts.map +1 -1
- package/lib/src/embed/base.js +2 -0
- package/lib/src/embed/base.js.map +1 -1
- package/lib/src/embed/liveboard.d.ts.map +1 -1
- package/lib/src/embed/liveboard.js +2 -1
- package/lib/src/embed/liveboard.js.map +1 -1
- package/lib/src/embed/liveboard.spec.js +10 -0
- package/lib/src/embed/liveboard.spec.js.map +1 -1
- package/lib/src/embed/search.d.ts +14 -13
- package/lib/src/embed/search.d.ts.map +1 -1
- package/lib/src/embed/search.js +6 -4
- package/lib/src/embed/search.js.map +1 -1
- package/lib/src/embed/search.spec.js +9 -9
- package/lib/src/embed/search.spec.js.map +1 -1
- package/lib/src/embed/ts-embed.d.ts +1 -1
- package/lib/src/embed/ts-embed.d.ts.map +1 -1
- package/lib/src/embed/ts-embed.js +10 -6
- package/lib/src/embed/ts-embed.js.map +1 -1
- package/lib/src/errors.d.ts +11 -0
- package/lib/src/errors.d.ts.map +1 -1
- package/lib/src/errors.js +11 -0
- package/lib/src/errors.js.map +1 -1
- package/lib/src/mixpanel-service.d.ts +4 -0
- package/lib/src/mixpanel-service.d.ts.map +1 -1
- package/lib/src/mixpanel-service.js +6 -1
- package/lib/src/mixpanel-service.js.map +1 -1
- package/lib/src/react/index.spec.js +1 -1
- package/lib/src/react/index.spec.js.map +1 -1
- package/lib/src/types.d.ts +178 -6
- package/lib/src/types.d.ts.map +1 -1
- package/lib/src/types.js +138 -3
- package/lib/src/types.js.map +1 -1
- package/lib/src/utils/processData.d.ts.map +1 -1
- package/lib/src/utils/processData.js +2 -1
- package/lib/src/utils/processData.js.map +1 -1
- package/lib/src/utils/reporting.d.ts +16 -0
- package/lib/src/utils/reporting.d.ts.map +1 -0
- package/lib/src/utils/reporting.js +62 -0
- package/lib/src/utils/reporting.js.map +1 -0
- package/lib/src/utils/reporting.spec.d.ts +2 -0
- package/lib/src/utils/reporting.spec.d.ts.map +1 -0
- package/lib/src/utils/reporting.spec.js +74 -0
- package/lib/src/utils/reporting.spec.js.map +1 -0
- package/lib/src/visual-embed-sdk.d.ts +241 -34
- package/package.json +4 -22
- package/src/auth.ts +6 -5
- package/src/authToken.ts +5 -9
- package/src/css-variables.ts +28 -0
- package/src/embed/app.spec.ts +48 -0
- package/src/embed/app.ts +25 -15
- package/src/embed/base.ts +3 -1
- package/src/embed/liveboard.spec.ts +14 -0
- package/src/embed/liveboard.ts +2 -0
- package/src/embed/search.spec.ts +9 -9
- package/src/embed/search.ts +20 -16
- package/src/embed/ts-embed.ts +13 -6
- package/src/errors.ts +11 -0
- package/src/mixpanel-service.ts +6 -1
- package/src/react/index.spec.tsx +1 -1
- package/src/types.ts +192 -13
- package/src/utils/processData.ts +2 -3
- package/src/utils/reporting.spec.ts +91 -0
- package/src/utils/reporting.ts +71 -0
package/src/embed/app.spec.ts
CHANGED
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
AppViewConfig,
|
|
4
4
|
DataPanelCustomColumnGroupsAccordionState,
|
|
5
5
|
Page,
|
|
6
|
+
HomePageSearchBarMode,
|
|
6
7
|
} from './app';
|
|
7
8
|
import { init } from '../index';
|
|
8
9
|
import {
|
|
@@ -137,6 +138,7 @@ describe('App embed tests', () => {
|
|
|
137
138
|
[Page.Data]: 'data/tables',
|
|
138
139
|
[Page.Home]: 'home',
|
|
139
140
|
[Page.SpotIQ]: 'insights/results',
|
|
141
|
+
[Page.Monitor]: 'insights/monitor-alerts',
|
|
140
142
|
};
|
|
141
143
|
|
|
142
144
|
const pageIds = Object.keys(pageRouteMap);
|
|
@@ -169,6 +171,7 @@ describe('App embed tests', () => {
|
|
|
169
171
|
[Page.Data]: 'data/tables',
|
|
170
172
|
[Page.Home]: 'home',
|
|
171
173
|
[Page.SpotIQ]: 'home/spotiq-analysis',
|
|
174
|
+
[Page.Monitor]: 'home/monitor-alerts',
|
|
172
175
|
};
|
|
173
176
|
|
|
174
177
|
const pageIdsForModularHomes = Object.keys(pageRouteMapForModularHome);
|
|
@@ -431,6 +434,51 @@ describe('App embed tests', () => {
|
|
|
431
434
|
});
|
|
432
435
|
});
|
|
433
436
|
|
|
437
|
+
test('Should add HomePageSearchBarMode flag with object search to the iframe src', async () => {
|
|
438
|
+
const appEmbed = new AppEmbed(getRootEl(), {
|
|
439
|
+
...defaultViewConfig,
|
|
440
|
+
homePageSearchBarMode: HomePageSearchBarMode.OBJECT_SEARCH,
|
|
441
|
+
} as AppViewConfig);
|
|
442
|
+
|
|
443
|
+
await appEmbed.render();
|
|
444
|
+
await executeAfterWait(() => {
|
|
445
|
+
expectUrlMatchesWithParams(
|
|
446
|
+
getIFrameSrc(),
|
|
447
|
+
`http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&modularHomeExperience=false&homePageSearchBarMode=objectSearch${defaultParams}${defaultParamsPost}#/home`,
|
|
448
|
+
);
|
|
449
|
+
});
|
|
450
|
+
});
|
|
451
|
+
|
|
452
|
+
test('Should add HomePageSearchBarMode flag with ai answer to the iframe src', async () => {
|
|
453
|
+
const appEmbed = new AppEmbed(getRootEl(), {
|
|
454
|
+
...defaultViewConfig,
|
|
455
|
+
homePageSearchBarMode: HomePageSearchBarMode.AI_ANSWER,
|
|
456
|
+
} as AppViewConfig);
|
|
457
|
+
|
|
458
|
+
await appEmbed.render();
|
|
459
|
+
await executeAfterWait(() => {
|
|
460
|
+
expectUrlMatchesWithParams(
|
|
461
|
+
getIFrameSrc(),
|
|
462
|
+
`http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&modularHomeExperience=false&homePageSearchBarMode=aiAnswer${defaultParams}${defaultParamsPost}#/home`,
|
|
463
|
+
);
|
|
464
|
+
});
|
|
465
|
+
});
|
|
466
|
+
|
|
467
|
+
test('Should add HomePageSearchBarMode flag with none to the iframe src', async () => {
|
|
468
|
+
const appEmbed = new AppEmbed(getRootEl(), {
|
|
469
|
+
...defaultViewConfig,
|
|
470
|
+
homePageSearchBarMode: HomePageSearchBarMode.NONE,
|
|
471
|
+
} as AppViewConfig);
|
|
472
|
+
|
|
473
|
+
await appEmbed.render();
|
|
474
|
+
await executeAfterWait(() => {
|
|
475
|
+
expectUrlMatchesWithParams(
|
|
476
|
+
getIFrameSrc(),
|
|
477
|
+
`http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&modularHomeExperience=false&homePageSearchBarMode=none${defaultParams}${defaultParamsPost}#/home`,
|
|
478
|
+
);
|
|
479
|
+
});
|
|
480
|
+
});
|
|
481
|
+
|
|
434
482
|
test('Should add dataPanelCustomGroupsAccordionInitialState flag to the iframe src', async () => {
|
|
435
483
|
const appEmbed = new AppEmbed(getRootEl(), {
|
|
436
484
|
...defaultViewConfig,
|
package/src/embed/app.ts
CHANGED
|
@@ -53,6 +53,10 @@ export enum Page {
|
|
|
53
53
|
* SpotIQ listing page
|
|
54
54
|
*/
|
|
55
55
|
SpotIQ = 'insights',
|
|
56
|
+
/**
|
|
57
|
+
* Monitor Alerts Page
|
|
58
|
+
*/
|
|
59
|
+
Monitor = 'monitor'
|
|
56
60
|
}
|
|
57
61
|
|
|
58
62
|
/**
|
|
@@ -74,6 +78,11 @@ export enum DataPanelCustomColumnGroupsAccordionState {
|
|
|
74
78
|
EXPAND_FIRST = 'EXPAND_FIRST',
|
|
75
79
|
}
|
|
76
80
|
|
|
81
|
+
export enum HomePageSearchBarMode {
|
|
82
|
+
OBJECT_SEARCH = 'objectSearch',
|
|
83
|
+
AI_ANSWER = 'aiAnswer',
|
|
84
|
+
NONE = 'none'
|
|
85
|
+
}
|
|
77
86
|
/**
|
|
78
87
|
* The view configuration for full app embedding.
|
|
79
88
|
* @group Embed components
|
|
@@ -260,19 +269,6 @@ export interface AppViewConfig extends Omit<ViewConfig, 'visibleTabs'> {
|
|
|
260
269
|
* ```
|
|
261
270
|
*/
|
|
262
271
|
fullHeight?: boolean;
|
|
263
|
-
/**
|
|
264
|
-
* Flag to control Data panel experience
|
|
265
|
-
* @default false
|
|
266
|
-
* @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl
|
|
267
|
-
* @example
|
|
268
|
-
* ```js
|
|
269
|
-
* const embed = new AppEmbed('#tsEmbed', {
|
|
270
|
-
* ... // other options
|
|
271
|
-
* dataPanelV2: true,
|
|
272
|
-
* })
|
|
273
|
-
* ```
|
|
274
|
-
*/
|
|
275
|
-
dataPanelV2?: boolean;
|
|
276
272
|
/**
|
|
277
273
|
* Show or hide Liveboard header
|
|
278
274
|
* @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl
|
|
@@ -347,6 +343,7 @@ export interface AppViewConfig extends Omit<ViewConfig, 'visibleTabs'> {
|
|
|
347
343
|
* To set the initial state of the search bar in case of saved-answers.
|
|
348
344
|
* @version SDK: 1.32.0 | Thoughtspot: 10.0.0.cl
|
|
349
345
|
* @default false
|
|
346
|
+
* @deprecated Use {@link collapseSearchBar} instead
|
|
350
347
|
*/
|
|
351
348
|
collapseSearchBarInitially?: boolean;
|
|
352
349
|
/**
|
|
@@ -400,6 +397,11 @@ export interface AppViewConfig extends Omit<ViewConfig, 'visibleTabs'> {
|
|
|
400
397
|
* @version SDK : 1.29.0 | Thoughtspot : 10.1.0.cl
|
|
401
398
|
*/
|
|
402
399
|
isOnBeforeGetVizDataInterceptEnabled?: boolean;
|
|
400
|
+
/**
|
|
401
|
+
* Flag to use home page search bar mode
|
|
402
|
+
* @version SDK : 1.33.0 | Thoughtspot : 10.2.0.cl
|
|
403
|
+
*/
|
|
404
|
+
homePageSearchBarMode?: HomePageSearchBarMode;
|
|
403
405
|
}
|
|
404
406
|
|
|
405
407
|
/**
|
|
@@ -437,7 +439,7 @@ export class AppEmbed extends V1Embed {
|
|
|
437
439
|
hideOrgSwitcher,
|
|
438
440
|
enableSearchAssist,
|
|
439
441
|
fullHeight,
|
|
440
|
-
dataPanelV2 =
|
|
442
|
+
dataPanelV2 = true,
|
|
441
443
|
hideLiveboardHeader = false,
|
|
442
444
|
showLiveboardTitle = true,
|
|
443
445
|
showLiveboardDescription = true,
|
|
@@ -451,6 +453,8 @@ export class AppEmbed extends V1Embed {
|
|
|
451
453
|
isOnBeforeGetVizDataInterceptEnabled = false,
|
|
452
454
|
/* eslint-disable-next-line max-len */
|
|
453
455
|
dataPanelCustomGroupsAccordionInitialState = DataPanelCustomColumnGroupsAccordionState.EXPAND_ALL,
|
|
456
|
+
collapseSearchBar = true,
|
|
457
|
+
homePageSearchBarMode,
|
|
454
458
|
} = this.viewConfig;
|
|
455
459
|
|
|
456
460
|
let params = {};
|
|
@@ -500,10 +504,14 @@ export class AppEmbed extends V1Embed {
|
|
|
500
504
|
] = isOnBeforeGetVizDataInterceptEnabled;
|
|
501
505
|
}
|
|
502
506
|
|
|
507
|
+
if (homePageSearchBarMode) {
|
|
508
|
+
params[Param.HomePageSearchBarMode] = homePageSearchBarMode;
|
|
509
|
+
}
|
|
510
|
+
|
|
503
511
|
params[Param.DataPanelV2Enabled] = dataPanelV2;
|
|
504
512
|
params[Param.HideHomepageLeftNav] = hideHomepageLeftNav;
|
|
505
513
|
params[Param.ModularHomeExperienceEnabled] = modularHomeExperience;
|
|
506
|
-
params[Param.CollapseSearchBarInitially] = collapseSearchBarInitially;
|
|
514
|
+
params[Param.CollapseSearchBarInitially] = collapseSearchBarInitially || collapseSearchBar;
|
|
507
515
|
params[Param.EnableCustomColumnGroups] = enableCustomColumnGroups;
|
|
508
516
|
if (dataPanelCustomGroupsAccordionInitialState
|
|
509
517
|
=== DataPanelCustomColumnGroupsAccordionState.COLLAPSE_ALL
|
|
@@ -578,6 +586,8 @@ export class AppEmbed extends V1Embed {
|
|
|
578
586
|
return 'data/tables';
|
|
579
587
|
case Page.SpotIQ:
|
|
580
588
|
return modularHomeExperience ? 'home/spotiq-analysis' : 'insights/results';
|
|
589
|
+
case Page.Monitor:
|
|
590
|
+
return modularHomeExperience ? 'home/monitor-alerts' : 'insights/monitor-alerts';
|
|
581
591
|
case Page.Home:
|
|
582
592
|
default:
|
|
583
593
|
return 'home';
|
package/src/embed/base.ts
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
|
|
9
9
|
*/
|
|
10
10
|
import EventEmitter from 'eventemitter3';
|
|
11
|
+
import { registerReportingObserver } from '../utils/reporting';
|
|
11
12
|
import { resetCachedAuthToken } from '../authToken';
|
|
12
13
|
import { logger, setGlobalLogLevelOverride } from '../utils/logger';
|
|
13
14
|
import { tokenizedFetch } from '../tokenizedFetch';
|
|
@@ -188,6 +189,7 @@ export const init = (embedConfig: EmbedConfig): AuthEventEmitter => {
|
|
|
188
189
|
);
|
|
189
190
|
|
|
190
191
|
setGlobalLogLevelOverride(embedConfig.logLevel);
|
|
192
|
+
registerReportingObserver();
|
|
191
193
|
|
|
192
194
|
const authEE = new EventEmitter<AuthStatus | AuthEvent>();
|
|
193
195
|
setAuthEE(authEE);
|
|
@@ -252,7 +254,7 @@ export const renderInQueue = (fn: (next?: (val?: any) => void) => Promise<any>):
|
|
|
252
254
|
return renderQueue;
|
|
253
255
|
}
|
|
254
256
|
// Sending an empty function to keep it consistent with the above usage.
|
|
255
|
-
return fn(() => {
|
|
257
|
+
return fn(() => {}); // eslint-disable-line @typescript-eslint/no-empty-function
|
|
256
258
|
};
|
|
257
259
|
|
|
258
260
|
/**
|
|
@@ -67,6 +67,20 @@ describe('Liveboard/viz embed tests', () => {
|
|
|
67
67
|
});
|
|
68
68
|
});
|
|
69
69
|
|
|
70
|
+
test('should render liveboard with data panel v2 flag set to true by default', async () => {
|
|
71
|
+
const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
|
|
72
|
+
...defaultViewConfig,
|
|
73
|
+
liveboardId,
|
|
74
|
+
} as LiveboardViewConfig);
|
|
75
|
+
liveboardEmbed.render();
|
|
76
|
+
await executeAfterWait(() => {
|
|
77
|
+
expectUrlMatchesWithParams(
|
|
78
|
+
getIFrameSrc(),
|
|
79
|
+
`http://${thoughtSpotHost}/?embedApp=true${defaultParams}${prefixParams}&enableDataPanelV2=true#/embed/viz/${liveboardId}`,
|
|
80
|
+
);
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
|
|
70
84
|
test('should set disabled actions', async () => {
|
|
71
85
|
const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
|
|
72
86
|
disabledActions: [Action.DownloadAsCsv, Action.DownloadAsPdf, Action.DownloadAsXlsx],
|
package/src/embed/liveboard.ts
CHANGED
|
@@ -340,6 +340,7 @@ export class LiveboardEmbed extends V1Embed {
|
|
|
340
340
|
isLiveboardHeaderSticky = true,
|
|
341
341
|
enableAskSage,
|
|
342
342
|
enable2ColumnLayout,
|
|
343
|
+
dataPanelV2 = true,
|
|
343
344
|
} = this.viewConfig;
|
|
344
345
|
|
|
345
346
|
const preventLiveboardFilterRemoval = this.viewConfig.preventLiveboardFilterRemoval
|
|
@@ -388,6 +389,7 @@ export class LiveboardEmbed extends V1Embed {
|
|
|
388
389
|
|
|
389
390
|
params[Param.LiveboardHeaderSticky] = isLiveboardHeaderSticky;
|
|
390
391
|
|
|
392
|
+
params[Param.DataPanelV2Enabled] = dataPanelV2;
|
|
391
393
|
const queryParams = getQueryParamString(params, true);
|
|
392
394
|
|
|
393
395
|
return queryParams;
|
package/src/embed/search.spec.ts
CHANGED
|
@@ -52,7 +52,7 @@ describe('Search embed tests', () => {
|
|
|
52
52
|
await executeAfterWait(() => {
|
|
53
53
|
expectUrlMatchesWithParams(
|
|
54
54
|
getIFrameSrc(),
|
|
55
|
-
`http://${thoughtSpotHost}/v2/?${defaultParamsWithHiddenActions}&enableDataPanelV2=
|
|
55
|
+
`http://${thoughtSpotHost}/v2/?${defaultParamsWithHiddenActions}&enableDataPanelV2=true&dataSourceMode=expand&useLastSelectedSources=false${prefixParams}#/embed/answer`,
|
|
56
56
|
);
|
|
57
57
|
});
|
|
58
58
|
});
|
|
@@ -416,16 +416,16 @@ describe('Search embed tests', () => {
|
|
|
416
416
|
});
|
|
417
417
|
});
|
|
418
418
|
|
|
419
|
-
test('should set enableDataPanelV2 to
|
|
419
|
+
test('should set enableDataPanelV2 to false if data panel v2 flag is false', async () => {
|
|
420
420
|
const searchEmbed = new SearchEmbed(getRootEl(), {
|
|
421
421
|
...defaultViewConfig,
|
|
422
|
-
dataPanelV2:
|
|
422
|
+
dataPanelV2: false,
|
|
423
423
|
});
|
|
424
424
|
searchEmbed.render();
|
|
425
425
|
await executeAfterWait(() => {
|
|
426
426
|
expectUrlMatchesWithParams(
|
|
427
427
|
getIFrameSrc(),
|
|
428
|
-
`http://${thoughtSpotHost}/v2/?${defaultParamsWithHiddenActions}&dataSourceMode=expand&enableDataPanelV2=
|
|
428
|
+
`http://${thoughtSpotHost}/v2/?${defaultParamsWithHiddenActions}&dataSourceMode=expand&enableDataPanelV2=false&useLastSelectedSources=false${prefixParams}#/embed/saved-answer/${answerId}`,
|
|
429
429
|
);
|
|
430
430
|
});
|
|
431
431
|
});
|
|
@@ -438,7 +438,7 @@ describe('Search embed tests', () => {
|
|
|
438
438
|
await executeAfterWait(() => {
|
|
439
439
|
expectUrlMatchesWithParams(
|
|
440
440
|
getIFrameSrc(),
|
|
441
|
-
`http://${thoughtSpotHost}/v2/?${defaultParamsWithHiddenActions}&dataSourceMode=expand&enableDataPanelV2=
|
|
441
|
+
`http://${thoughtSpotHost}/v2/?${defaultParamsWithHiddenActions}&dataSourceMode=expand&enableDataPanelV2=true&useLastSelectedSources=true${prefixParams}#/embed/saved-answer/${answerId}`,
|
|
442
442
|
);
|
|
443
443
|
});
|
|
444
444
|
});
|
|
@@ -453,7 +453,7 @@ describe('Search embed tests', () => {
|
|
|
453
453
|
await executeAfterWait(() => {
|
|
454
454
|
expectUrlMatchesWithParams(
|
|
455
455
|
getIFrameSrc(),
|
|
456
|
-
`http://${thoughtSpotHost}/v2/?${defaultParamsWithHiddenActions}&dataSources=[%22data-source-1%22]&dataSourceMode=expand&enableDataPanelV2=
|
|
456
|
+
`http://${thoughtSpotHost}/v2/?${defaultParamsWithHiddenActions}&dataSources=[%22data-source-1%22]&dataSourceMode=expand&enableDataPanelV2=true&useLastSelectedSources=false${prefixParams}#/embed/saved-answer/${answerId}`,
|
|
457
457
|
);
|
|
458
458
|
});
|
|
459
459
|
});
|
|
@@ -468,7 +468,7 @@ describe('Search embed tests', () => {
|
|
|
468
468
|
await executeAfterWait(() => {
|
|
469
469
|
expectUrlMatchesWithParams(
|
|
470
470
|
getIFrameSrc(),
|
|
471
|
-
`http://${thoughtSpotHost}/v2/?${defaultParamsWithHiddenActions}&dataSources=[%22data-source-1%22]&dataSourceMode=expand&enableDataPanelV2=
|
|
471
|
+
`http://${thoughtSpotHost}/v2/?${defaultParamsWithHiddenActions}&dataSources=[%22data-source-1%22]&dataSourceMode=expand&enableDataPanelV2=true&useLastSelectedSources=false${prefixParams}#/embed/saved-answer/${answerId}`,
|
|
472
472
|
);
|
|
473
473
|
});
|
|
474
474
|
});
|
|
@@ -499,7 +499,7 @@ describe('Search embed tests', () => {
|
|
|
499
499
|
await executeAfterWait(() => {
|
|
500
500
|
expectUrlMatchesWithParams(
|
|
501
501
|
getIFrameSrc(),
|
|
502
|
-
`http://${thoughtSpotHost}/v2/?${defaultParamsWithHiddenActions}&dataSourceMode=expand&enableDataPanelV2=
|
|
502
|
+
`http://${thoughtSpotHost}/v2/?${defaultParamsWithHiddenActions}&dataSourceMode=expand&enableDataPanelV2=true&useLastSelectedSources=false&hideSearchBar=true${prefixParams}#/embed/saved-answer/${answerId}`,
|
|
503
503
|
);
|
|
504
504
|
});
|
|
505
505
|
});
|
|
@@ -514,7 +514,7 @@ describe('Search embed tests', () => {
|
|
|
514
514
|
await executeAfterWait(() => {
|
|
515
515
|
expectUrlMatchesWithParams(
|
|
516
516
|
getIFrameSrc(),
|
|
517
|
-
`http://${thoughtSpotHost}/v2/?${defaultParamsWithHiddenActions}&dataSourceMode=expand&enableDataPanelV2=
|
|
517
|
+
`http://${thoughtSpotHost}/v2/?${defaultParamsWithHiddenActions}&dataSourceMode=expand&enableDataPanelV2=true&useLastSelectedSources=false&dataPanelCustomGroupsAccordionInitialState=EXPAND_FIRST${prefixParams}#/embed/saved-answer/${answerId}`,
|
|
518
518
|
);
|
|
519
519
|
});
|
|
520
520
|
});
|
package/src/embed/search.ts
CHANGED
|
@@ -88,6 +88,19 @@ export interface SearchViewConfig
|
|
|
88
88
|
* ```
|
|
89
89
|
*/
|
|
90
90
|
collapseDataSources?: boolean;
|
|
91
|
+
/**
|
|
92
|
+
* If set to true, the data panel is collapsed on load,
|
|
93
|
+
* but can be expanded manually.
|
|
94
|
+
* @version: SDK: 1.34.0 | ThoughtSpot: 10.3.0.cl
|
|
95
|
+
* @example
|
|
96
|
+
* ```js
|
|
97
|
+
* const embed = new SearchEmbed('#tsEmbed', {
|
|
98
|
+
* ... // other options
|
|
99
|
+
* collapseDataPanel:true,
|
|
100
|
+
* })
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
collapseDataPanel?: boolean;
|
|
91
104
|
/**
|
|
92
105
|
* Show or hide the data sources panel.
|
|
93
106
|
* @version: SDK: 1.2.0 | ThoughtSpot: 9.1.0.sw
|
|
@@ -214,19 +227,6 @@ export interface SearchViewConfig
|
|
|
214
227
|
* ```
|
|
215
228
|
*/
|
|
216
229
|
hideSearchBar?: boolean;
|
|
217
|
-
/**
|
|
218
|
-
* Flag to control Data panel experience
|
|
219
|
-
* @default false
|
|
220
|
-
* @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl
|
|
221
|
-
* @example
|
|
222
|
-
* ```js
|
|
223
|
-
* const embed = new SearchEmbed('#tsEmbed', {
|
|
224
|
-
* ... // other options
|
|
225
|
-
* dataPanelV2:false,
|
|
226
|
-
* })
|
|
227
|
-
* ```
|
|
228
|
-
*/
|
|
229
|
-
dataPanelV2?: boolean;
|
|
230
230
|
/**
|
|
231
231
|
* Flag to set if last selected dataSource should be used
|
|
232
232
|
* @version: SDK: 1.24.0
|
|
@@ -236,6 +236,7 @@ export interface SearchViewConfig
|
|
|
236
236
|
* To set the initial state of the search bar in case of saved-answers.
|
|
237
237
|
* @default false
|
|
238
238
|
* @version SDK: 1.32.0 | Thoughtspot: 10.0.0.cl
|
|
239
|
+
* @deprecated Use {@link collapseSearchBar} instead
|
|
239
240
|
*/
|
|
240
241
|
collapseSearchBarInitially?: boolean;
|
|
241
242
|
/**
|
|
@@ -320,7 +321,8 @@ export class SearchEmbed extends TsEmbed {
|
|
|
320
321
|
*/
|
|
321
322
|
private getDataSourceMode() {
|
|
322
323
|
let dataSourceMode = DataSourceVisualMode.Expanded;
|
|
323
|
-
if (this.viewConfig.collapseDataSources === true
|
|
324
|
+
if (this.viewConfig.collapseDataSources === true
|
|
325
|
+
|| this.viewConfig.collapseDataPanel === true) {
|
|
324
326
|
dataSourceMode = DataSourceVisualMode.Collapsed;
|
|
325
327
|
}
|
|
326
328
|
if (this.viewConfig.hideDataSources === true) {
|
|
@@ -341,7 +343,7 @@ export class SearchEmbed extends TsEmbed {
|
|
|
341
343
|
dataSources,
|
|
342
344
|
excludeRuntimeFiltersfromURL,
|
|
343
345
|
hideSearchBar,
|
|
344
|
-
dataPanelV2 =
|
|
346
|
+
dataPanelV2 = true,
|
|
345
347
|
useLastSelectedSources = false,
|
|
346
348
|
runtimeParameters,
|
|
347
349
|
collapseSearchBarInitially = false,
|
|
@@ -351,6 +353,7 @@ export class SearchEmbed extends TsEmbed {
|
|
|
351
353
|
dataPanelCustomGroupsAccordionInitialState = DataPanelCustomColumnGroupsAccordionState.EXPAND_ALL,
|
|
352
354
|
focusSearchBarOnRender = true,
|
|
353
355
|
excludeRuntimeParametersfromURL,
|
|
356
|
+
collapseSearchBar = true,
|
|
354
357
|
} = this.viewConfig;
|
|
355
358
|
const queryParams = this.getBaseQueryParams();
|
|
356
359
|
|
|
@@ -406,7 +409,8 @@ export class SearchEmbed extends TsEmbed {
|
|
|
406
409
|
}
|
|
407
410
|
|
|
408
411
|
queryParams[Param.searchEmbed] = true;
|
|
409
|
-
|
|
412
|
+
/* eslint-disable-next-line max-len */
|
|
413
|
+
queryParams[Param.CollapseSearchBarInitially] = collapseSearchBarInitially || collapseSearchBar;
|
|
410
414
|
queryParams[Param.EnableCustomColumnGroups] = enableCustomColumnGroups;
|
|
411
415
|
if (dataPanelCustomGroupsAccordionInitialState
|
|
412
416
|
=== DataPanelCustomColumnGroupsAccordionState.COLLAPSE_ALL
|
package/src/embed/ts-embed.ts
CHANGED
|
@@ -59,6 +59,7 @@ import {
|
|
|
59
59
|
} from './base';
|
|
60
60
|
import { AuthFailureType } from '../auth';
|
|
61
61
|
import { getEmbedConfig } from './embedConfig';
|
|
62
|
+
import { ERROR_MESSAGE } from '../errors';
|
|
62
63
|
|
|
63
64
|
const { version } = pkgInfo;
|
|
64
65
|
|
|
@@ -347,7 +348,7 @@ export class TsEmbed {
|
|
|
347
348
|
data: { authToken },
|
|
348
349
|
});
|
|
349
350
|
} catch (e) {
|
|
350
|
-
logger.error(
|
|
351
|
+
logger.error(`${ERROR_MESSAGE.INVALID_TOKEN_ERROR} Error : ${e?.message}`);
|
|
351
352
|
processAuthFailure(e, this.isPreRendered ? this.preRenderWrapper : this.el);
|
|
352
353
|
}
|
|
353
354
|
} else if (autoLogin) {
|
|
@@ -387,7 +388,9 @@ export class TsEmbed {
|
|
|
387
388
|
* @param queryParams
|
|
388
389
|
* @returns queryParams
|
|
389
390
|
*/
|
|
390
|
-
protected getBaseQueryParams(
|
|
391
|
+
protected getBaseQueryParams(
|
|
392
|
+
queryParams: Record<any, any> = {},
|
|
393
|
+
) {
|
|
391
394
|
let hostAppUrl = window?.location?.host || '';
|
|
392
395
|
|
|
393
396
|
// The below check is needed because TS Cloud firewall, blocks
|
|
@@ -438,6 +441,7 @@ export class TsEmbed {
|
|
|
438
441
|
contextMenuTrigger,
|
|
439
442
|
linkOverride,
|
|
440
443
|
insertInToSlide,
|
|
444
|
+
disableRedirectionLinksInNewTab,
|
|
441
445
|
} = this.viewConfig;
|
|
442
446
|
|
|
443
447
|
if (Array.isArray(visibleActions) && Array.isArray(hiddenActions)) {
|
|
@@ -505,6 +509,9 @@ export class TsEmbed {
|
|
|
505
509
|
if (insertInToSlide) {
|
|
506
510
|
queryParams[Param.ShowInsertToSlide] = insertInToSlide;
|
|
507
511
|
}
|
|
512
|
+
if (disableRedirectionLinksInNewTab) {
|
|
513
|
+
queryParams[Param.DisableRedirectionLinksInNewTab] = disableRedirectionLinksInNewTab;
|
|
514
|
+
}
|
|
508
515
|
|
|
509
516
|
queryParams[Param.OverrideNativeConsole] = true;
|
|
510
517
|
queryParams[Param.ClientLogLevel] = this.embedConfig.logLevel;
|
|
@@ -557,7 +564,7 @@ export class TsEmbed {
|
|
|
557
564
|
iFrame.mozallowfullscreen = true;
|
|
558
565
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
559
566
|
// @ts-ignore
|
|
560
|
-
iFrame.allow = 'clipboard-read; clipboard-write';
|
|
567
|
+
iFrame.allow = 'clipboard-read; clipboard-write fullscreen';
|
|
561
568
|
|
|
562
569
|
const {
|
|
563
570
|
height: frameHeight,
|
|
@@ -1000,7 +1007,7 @@ export class TsEmbed {
|
|
|
1000
1007
|
*/
|
|
1001
1008
|
public preRender(showPreRenderByDefault = false): TsEmbed {
|
|
1002
1009
|
if (!this.viewConfig.preRenderId) {
|
|
1003
|
-
logger.error(
|
|
1010
|
+
logger.error(ERROR_MESSAGE.PRERENDER_ID_MISSING);
|
|
1004
1011
|
return this;
|
|
1005
1012
|
}
|
|
1006
1013
|
this.isPreRendered = true;
|
|
@@ -1107,7 +1114,7 @@ export class TsEmbed {
|
|
|
1107
1114
|
*/
|
|
1108
1115
|
public showPreRender(): void {
|
|
1109
1116
|
if (!this.viewConfig.preRenderId) {
|
|
1110
|
-
logger.error(
|
|
1117
|
+
logger.error(ERROR_MESSAGE.PRERENDER_ID_MISSING);
|
|
1111
1118
|
return;
|
|
1112
1119
|
}
|
|
1113
1120
|
if (!this.isPreRenderAvailable()) {
|
|
@@ -1155,7 +1162,7 @@ export class TsEmbed {
|
|
|
1155
1162
|
*/
|
|
1156
1163
|
public syncPreRenderStyle(): void {
|
|
1157
1164
|
if (!this.isPreRenderAvailable() || !this.el) {
|
|
1158
|
-
logger.error(
|
|
1165
|
+
logger.error(ERROR_MESSAGE.SYNC_STYLE_CALLED_BEFORE_RENDER);
|
|
1159
1166
|
return;
|
|
1160
1167
|
}
|
|
1161
1168
|
const elBoundingClient = this.el.getBoundingClientRect();
|
package/src/errors.ts
CHANGED
|
@@ -4,4 +4,15 @@ export const ERROR_MESSAGE = {
|
|
|
4
4
|
TRIGGER_TIMED_OUT: 'Trigger timedout in getting response',
|
|
5
5
|
SEARCHEMBED_BETA_WRANING_MESSAGE: 'Search Embed is in Beta in this release.',
|
|
6
6
|
SAGE_EMBED_BETA_WARNING_MESSAGE: 'Sage Embed is in Beta in this release.',
|
|
7
|
+
THIRD_PARTY_COOKIE_BLOCKED_ALERT: 'Third party cookie access is blocked on this browser, please allow third party cookies for this to work properly. \nYou can use `suppressNoCookieAccessAlert` to suppress this message.',
|
|
8
|
+
DUPLICATE_TOKEN_ERR: 'Duplicate token, please issue a new token every time getAuthToken callback is called. See https://developers.thoughtspot.com/docs/?pageid=embed-auth#trusted-auth-embed for more details.',
|
|
9
|
+
SDK_NOT_INITIALIZED: 'SDK not initialized',
|
|
10
|
+
SESSION_INFO_FAILED: 'Failed to get session info',
|
|
11
|
+
INVALID_TOKEN_ERROR: 'Received invalid token from getAuthToken callback or authToken endpoint.',
|
|
12
|
+
MIXPANEL_TOKEN_NOT_FOUND: 'Mixpanel token not found in session info',
|
|
13
|
+
PRERENDER_ID_MISSING: 'PreRender id is required for preRender',
|
|
14
|
+
SYNC_STYLE_CALLED_BEFORE_RENDER: 'PreRender should be called before using syncPreRenderStyle',
|
|
15
|
+
CSP_VIOLATION_ALERT: 'CSP violation detected. Please check the console errors for more details.',
|
|
16
|
+
CSP_FRAME_HOST_VIOLATION_LOG_MESSAGE: 'Please setup CSP Correctly for the Application to start working. You can know more about setting CSP Correctly here: https://developers.thoughtspot.com/docs/security-settings#csp-viz-embed-hosts. \n In case you are still facing error, please read: https://developers.thoughtspot.com/docs/security-settings#csp-viz-embed-hosts',
|
|
17
|
+
MISSING_REPORTING_OBSERVER: 'ReportingObserver not supported',
|
|
7
18
|
};
|
package/src/mixpanel-service.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as mixpanel from 'mixpanel-browser';
|
|
2
2
|
import { logger } from './utils/logger';
|
|
3
3
|
import { SessionInfo } from './utils/sessionInfoService';
|
|
4
|
+
import { ERROR_MESSAGE } from './errors';
|
|
4
5
|
|
|
5
6
|
export const EndPoints = {
|
|
6
7
|
CONFIG: '/callosum/v1/system/config',
|
|
@@ -10,6 +11,10 @@ export const EndPoints = {
|
|
|
10
11
|
const mixpanelLib = mixpanel.default || mixpanel;
|
|
11
12
|
let mixpanelInstance: mixpanel.Mixpanel;
|
|
12
13
|
|
|
14
|
+
/**
|
|
15
|
+
* Enum of mixpanel events
|
|
16
|
+
* @hidden
|
|
17
|
+
*/
|
|
13
18
|
export const MIXPANEL_EVENT = {
|
|
14
19
|
VISUAL_SDK_RENDER_START: 'visual-sdk-render-start',
|
|
15
20
|
VISUAL_SDK_CALLED_INIT: 'visual-sdk-called-init',
|
|
@@ -57,7 +62,7 @@ function emptyQueue() {
|
|
|
57
62
|
*/
|
|
58
63
|
export function initMixpanel(sessionInfo: SessionInfo): void {
|
|
59
64
|
if (!sessionInfo || !sessionInfo.mixpanelToken) {
|
|
60
|
-
logger.error(
|
|
65
|
+
logger.error(ERROR_MESSAGE.MIXPANEL_TOKEN_NOT_FOUND);
|
|
61
66
|
return;
|
|
62
67
|
}
|
|
63
68
|
// On a public cluster the user is anonymous, so don't set the identify to
|
package/src/react/index.spec.tsx
CHANGED
|
@@ -56,7 +56,7 @@ describe('React Components', () => {
|
|
|
56
56
|
),
|
|
57
57
|
).toBe(true);
|
|
58
58
|
expect(getIFrameSrc(container)).toBe(
|
|
59
|
-
`http://${thoughtSpotHost}/?hostAppUrl=local-host&viewPortHeight=768&viewPortWidth=1024&sdkVersion=${version}&authType=None&blockNonEmbedFullAppAccess=true&hideAction=[%22${Action.ReportError}%22,%22editACopy%22,%22saveAsView%22,%22updateTSL%22,%22editTSL%22,%22onDeleteAnswer%22]&overrideConsoleLogs=true&clientLogLevel=ERROR&enableDataPanelV2=
|
|
59
|
+
`http://${thoughtSpotHost}/?hostAppUrl=local-host&viewPortHeight=768&viewPortWidth=1024&sdkVersion=${version}&authType=None&blockNonEmbedFullAppAccess=true&hideAction=[%22${Action.ReportError}%22,%22editACopy%22,%22saveAsView%22,%22updateTSL%22,%22editTSL%22,%22onDeleteAnswer%22]&overrideConsoleLogs=true&clientLogLevel=ERROR&enableDataPanelV2=true&dataSourceMode=hide&useLastSelectedSources=false&isSearchEmbed=true&collapseSearchBarInitially=true&enableCustomColumnGroups=false&dataPanelCustomGroupsAccordionInitialState=EXPAND_ALL#/embed/answer`,
|
|
60
60
|
);
|
|
61
61
|
});
|
|
62
62
|
|