@thoughtspot/visual-embed-sdk 1.33.8 → 1.33.10
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 +1 -1
- package/cjs/src/embed/conversation.d.ts +27 -0
- package/cjs/src/embed/conversation.d.ts.map +1 -1
- package/cjs/src/embed/conversation.js +9 -1
- package/cjs/src/embed/conversation.js.map +1 -1
- package/cjs/src/embed/conversation.spec.js +24 -0
- package/cjs/src/embed/conversation.spec.js.map +1 -1
- package/cjs/src/embed/liveboard.d.ts +36 -0
- package/cjs/src/embed/liveboard.d.ts.map +1 -1
- package/cjs/src/embed/liveboard.js +10 -1
- package/cjs/src/embed/liveboard.js.map +1 -1
- package/cjs/src/embed/liveboard.spec.js +13 -0
- package/cjs/src/embed/liveboard.spec.js.map +1 -1
- package/cjs/src/embed/ts-embed.d.ts.map +1 -1
- package/cjs/src/embed/ts-embed.js +5 -2
- package/cjs/src/embed/ts-embed.js.map +1 -1
- package/cjs/src/embed/ts-embed.spec.d.ts +2 -1
- package/cjs/src/embed/ts-embed.spec.d.ts.map +1 -1
- package/cjs/src/embed/ts-embed.spec.js +158 -0
- package/cjs/src/embed/ts-embed.spec.js.map +1 -1
- package/cjs/src/types.d.ts +51 -3
- package/cjs/src/types.d.ts.map +1 -1
- package/cjs/src/types.js +41 -0
- package/cjs/src/types.js.map +1 -1
- package/dist/{index-CHqCPD_I.js → index-HiSgAoIA.js} +1 -1
- package/dist/src/embed/conversation.d.ts +27 -0
- package/dist/src/embed/conversation.d.ts.map +1 -1
- package/dist/src/embed/liveboard.d.ts +36 -0
- package/dist/src/embed/liveboard.d.ts.map +1 -1
- package/dist/src/embed/ts-embed.d.ts.map +1 -1
- package/dist/src/embed/ts-embed.spec.d.ts +2 -1
- package/dist/src/embed/ts-embed.spec.d.ts.map +1 -1
- package/dist/src/types.d.ts +51 -3
- package/dist/src/types.d.ts.map +1 -1
- package/dist/tsembed-react.es.js +94 -12
- package/dist/tsembed-react.js +93 -11
- package/dist/tsembed.es.js +94 -12
- package/dist/tsembed.js +93 -11
- package/dist/visual-embed-sdk-react-full.d.ts +114 -3
- package/dist/visual-embed-sdk-react.d.ts +114 -3
- package/dist/visual-embed-sdk.d.ts +114 -3
- package/lib/package.json +1 -1
- package/lib/src/embed/conversation.d.ts +27 -0
- package/lib/src/embed/conversation.d.ts.map +1 -1
- package/lib/src/embed/conversation.js +8 -1
- package/lib/src/embed/conversation.js.map +1 -1
- package/lib/src/embed/conversation.spec.js +24 -0
- package/lib/src/embed/conversation.spec.js.map +1 -1
- package/lib/src/embed/liveboard.d.ts +36 -0
- package/lib/src/embed/liveboard.d.ts.map +1 -1
- package/lib/src/embed/liveboard.js +10 -1
- package/lib/src/embed/liveboard.js.map +1 -1
- package/lib/src/embed/liveboard.spec.js +13 -0
- package/lib/src/embed/liveboard.spec.js.map +1 -1
- package/lib/src/embed/ts-embed.d.ts.map +1 -1
- package/lib/src/embed/ts-embed.js +5 -2
- package/lib/src/embed/ts-embed.js.map +1 -1
- package/lib/src/embed/ts-embed.spec.d.ts +2 -1
- package/lib/src/embed/ts-embed.spec.d.ts.map +1 -1
- package/lib/src/embed/ts-embed.spec.js +159 -2
- package/lib/src/embed/ts-embed.spec.js.map +1 -1
- package/lib/src/types.d.ts +51 -3
- package/lib/src/types.d.ts.map +1 -1
- package/lib/src/types.js +41 -0
- package/lib/src/types.js.map +1 -1
- package/lib/src/visual-embed-sdk.d.ts +114 -3
- package/package.json +1 -1
- package/src/embed/conversation.spec.ts +34 -0
- package/src/embed/conversation.ts +36 -0
- package/src/embed/liveboard.spec.ts +17 -0
- package/src/embed/liveboard.ts +54 -0
- package/src/embed/ts-embed.spec.ts +219 -0
- package/src/embed/ts-embed.ts +6 -1
- package/src/types.ts +51 -0
|
@@ -989,6 +989,42 @@ declare module '@thoughtspot/visual-embed-sdk/embed/liveboard' {
|
|
|
989
989
|
* ```
|
|
990
990
|
*/
|
|
991
991
|
hideIrrelevantChipsInLiveboardTabs?: boolean;
|
|
992
|
+
/**
|
|
993
|
+
* The Liveboard to run on regular intervals to fetch the cdw token.
|
|
994
|
+
* @hidden
|
|
995
|
+
* @version SDK: 1.35.0 | ThoughtSpot:10.6.0.cl
|
|
996
|
+
* @example
|
|
997
|
+
* ```js
|
|
998
|
+
* const embed = new LiveboardEmbed('#embed-container', {
|
|
999
|
+
* ... // other options
|
|
1000
|
+
* oAuthPollingInterval: value in milliseconds,
|
|
1001
|
+
* })
|
|
1002
|
+
*/
|
|
1003
|
+
oAuthPollingInterval?: number;
|
|
1004
|
+
/**
|
|
1005
|
+
* The Liveboard is set to force a token fetch during the initial load.
|
|
1006
|
+
* @hidden
|
|
1007
|
+
* @version SDK: 1.35.0 | ThoughtSpot:10.6.0.cl
|
|
1008
|
+
* @example
|
|
1009
|
+
* ```js
|
|
1010
|
+
* const embed = new LiveboardEmbed('#embed-container', {
|
|
1011
|
+
* ... // other options
|
|
1012
|
+
* isForceRedirect: false,
|
|
1013
|
+
* })
|
|
1014
|
+
*/
|
|
1015
|
+
isForceRedirect?: boolean;
|
|
1016
|
+
/**
|
|
1017
|
+
* The source connection ID for authentication.
|
|
1018
|
+
* @hidden
|
|
1019
|
+
* @version SDK: 1.35.0 | ThoughtSpot:10.6.0.cl
|
|
1020
|
+
* @example
|
|
1021
|
+
* ```js
|
|
1022
|
+
* const embed = new LiveboardEmbed('#embed-container', {
|
|
1023
|
+
* ... // other options
|
|
1024
|
+
* dataSourceId: '',
|
|
1025
|
+
* })
|
|
1026
|
+
*/
|
|
1027
|
+
dataSourceId?: string;
|
|
992
1028
|
}
|
|
993
1029
|
/**
|
|
994
1030
|
* Embed a ThoughtSpot Liveboard or visualization. When rendered it already
|
|
@@ -1474,6 +1510,33 @@ declare module '@thoughtspot/visual-embed-sdk/embed/conversation' {
|
|
|
1474
1510
|
* Ability to pass a starting search query to the conversation.
|
|
1475
1511
|
*/
|
|
1476
1512
|
searchOptions?: SearchOptions;
|
|
1513
|
+
/**
|
|
1514
|
+
* disableSourceSelection : Disables data source selection
|
|
1515
|
+
* but still display the selected data source.
|
|
1516
|
+
* @example
|
|
1517
|
+
* ```js
|
|
1518
|
+
* const embed = new ConversationEmbed('#tsEmbed', {
|
|
1519
|
+
* ... // other options
|
|
1520
|
+
* disableSourceSelection : true,
|
|
1521
|
+
* })
|
|
1522
|
+
* ```
|
|
1523
|
+
*
|
|
1524
|
+
* @version SDK: 1.36.0 | Thoughtspot: 10.6.0.cl
|
|
1525
|
+
*/
|
|
1526
|
+
disableSourceSelection?: boolean;
|
|
1527
|
+
/**
|
|
1528
|
+
* hideSourceSelection : Hide data source selection
|
|
1529
|
+
* @example
|
|
1530
|
+
* ```js
|
|
1531
|
+
* const embed = new ConversationEmbed('#tsEmbed', {
|
|
1532
|
+
* ... // other options
|
|
1533
|
+
* hideSourceSelection : true,
|
|
1534
|
+
* })
|
|
1535
|
+
* ```
|
|
1536
|
+
*
|
|
1537
|
+
* @version SDK: 1.36.0 | Thoughtspot: 10.6.0.cl
|
|
1538
|
+
*/
|
|
1539
|
+
hideSourceSelection?: boolean;
|
|
1477
1540
|
}
|
|
1478
1541
|
/**
|
|
1479
1542
|
* Embed ThoughtSpot AI Conversation.
|
|
@@ -2808,6 +2871,13 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
|
|
|
2808
2871
|
* @version SDK: 1.35.0 | ThoughtSpot: 10.5.0.cl
|
|
2809
2872
|
*/
|
|
2810
2873
|
overrideOrgId?: number;
|
|
2874
|
+
/**
|
|
2875
|
+
* Flag to control new flip tooltip context menu experience
|
|
2876
|
+
*
|
|
2877
|
+
* @default false
|
|
2878
|
+
* @version SDK: 1.36.0 | Thoughtspot: 10.6.0.cl
|
|
2879
|
+
*/
|
|
2880
|
+
enableFlipTooltipToContextMenu?: boolean;
|
|
2811
2881
|
}
|
|
2812
2882
|
/**
|
|
2813
2883
|
* MessagePayload: Embed event payload: message type, data and status (start/end)
|
|
@@ -4875,7 +4945,15 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
|
|
|
4875
4945
|
*```
|
|
4876
4946
|
* @version SDK: 1.29.0 | Thoughtspot: 10.1.0.cl
|
|
4877
4947
|
*/
|
|
4878
|
-
GetParameters = "GetParameters"
|
|
4948
|
+
GetParameters = "GetParameters",
|
|
4949
|
+
/**
|
|
4950
|
+
* Triggers update of persoanlised view for a liveboard
|
|
4951
|
+
* ```js
|
|
4952
|
+
* liveboardEmbed.trigger(HostEvent.UpdatePersonalisedView, {viewId: '1234'})
|
|
4953
|
+
* ```
|
|
4954
|
+
* @version SDK: 1.36.0 | Thoughtspot: 10.6.0.cl
|
|
4955
|
+
*/
|
|
4956
|
+
UpdatePersonalisedView = "UpdatePersonalisedView"
|
|
4879
4957
|
}
|
|
4880
4958
|
/**
|
|
4881
4959
|
* The different visual modes that the data sources panel within
|
|
@@ -4948,6 +5026,8 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
|
|
|
4948
5026
|
IsSageEmbed = "isSageEmbed",
|
|
4949
5027
|
HideWorksheetSelector = "hideWorksheetSelector",
|
|
4950
5028
|
DisableWorksheetChange = "disableWorksheetChange",
|
|
5029
|
+
HideSourceSelection = "hideSourceSelection",
|
|
5030
|
+
DisableSourceSelection = "disableSourceSelection",
|
|
4951
5031
|
HideEurekaResults = "hideEurekaResults",
|
|
4952
5032
|
HideEurekaSuggestions = "hideEurekaSuggestions",
|
|
4953
5033
|
HideAutocompleteSuggestions = "hideAutocompleteSuggestions",
|
|
@@ -4989,7 +5069,11 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
|
|
|
4989
5069
|
HideIrrelevantFiltersInTab = "hideIrrelevantFiltersAtTabLevel",
|
|
4990
5070
|
SpotterEnabled = "isSpotterExperienceEnabled",
|
|
4991
5071
|
IsUnifiedSearchExperienceEnabled = "isUnifiedSearchExperienceEnabled",
|
|
4992
|
-
OverrideOrgId = "orgId"
|
|
5072
|
+
OverrideOrgId = "orgId",
|
|
5073
|
+
EnableFlipTooltipToContextMenu = "flipTooltipToContextMenuEnabled",
|
|
5074
|
+
OauthPollingInterval = "oAuthPollingInterval",
|
|
5075
|
+
IsForceRedirect = "isForceRedirect",
|
|
5076
|
+
DataSourceId = "dataSourceId"
|
|
4993
5077
|
}
|
|
4994
5078
|
/**
|
|
4995
5079
|
* ThoughtSpot application pages include actions and menu commands
|
|
@@ -6038,7 +6122,34 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
|
|
|
6038
6122
|
* ```
|
|
6039
6123
|
* @version SDK: 1.35.0 | Thoughtspot: 10.5.0.cl
|
|
6040
6124
|
*/
|
|
6041
|
-
ChangeFilterVisibilityInTab = "changeFilterVisibilityInTab"
|
|
6125
|
+
ChangeFilterVisibilityInTab = "changeFilterVisibilityInTab",
|
|
6126
|
+
/**
|
|
6127
|
+
* Action ID for hide/disable Preview data button in spotter
|
|
6128
|
+
* @example
|
|
6129
|
+
* ```js
|
|
6130
|
+
* hiddenAction: [Action.PreviewDataSpotter]
|
|
6131
|
+
* ```
|
|
6132
|
+
* @version SDK: 1.36.0 | Thoughtspot: 10.6.0.cl
|
|
6133
|
+
*/
|
|
6134
|
+
PreviewDataSpotter = "previewDataSpotter",
|
|
6135
|
+
/**
|
|
6136
|
+
* Action ID for hide/disable reset button in spotter
|
|
6137
|
+
* @example
|
|
6138
|
+
* ```js
|
|
6139
|
+
* hiddenAction: [Action.ChangeFilterVisibilityInTab]
|
|
6140
|
+
* ```
|
|
6141
|
+
* @version SDK: 1.36.0 | Thoughtspot: 10.6.0.cl
|
|
6142
|
+
*/
|
|
6143
|
+
ResetSpotterChat = "resetSpotterChat",
|
|
6144
|
+
/**
|
|
6145
|
+
* Action ID for hide/disable feedback in spotter
|
|
6146
|
+
* @example
|
|
6147
|
+
* ```js
|
|
6148
|
+
* hiddenAction: [Action.ChangeFilterVisibilityInTab]
|
|
6149
|
+
* ```
|
|
6150
|
+
* @version SDK: 1.36.0 | Thoughtspot: 10.6.0.cl
|
|
6151
|
+
*/
|
|
6152
|
+
SpotterFeedback = "spotterFeedback"
|
|
6042
6153
|
}
|
|
6043
6154
|
export interface AnswerServiceType {
|
|
6044
6155
|
getAnswer?: (offset: number, batchSize: number) => any;
|
package/package.json
CHANGED
|
@@ -45,6 +45,40 @@ describe('ConversationEmbed', () => {
|
|
|
45
45
|
);
|
|
46
46
|
});
|
|
47
47
|
|
|
48
|
+
it('should render the conversation embed with worksheets disabled', async () => {
|
|
49
|
+
const viewConfig: ConversationViewConfig = {
|
|
50
|
+
worksheetId: 'worksheetId',
|
|
51
|
+
searchOptions: {
|
|
52
|
+
searchQuery: 'searchQuery',
|
|
53
|
+
},
|
|
54
|
+
disableSourceSelection: true,
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const conversationEmbed = new ConversationEmbed(getRootEl(), viewConfig);
|
|
58
|
+
await conversationEmbed.render();
|
|
59
|
+
expectUrlMatchesWithParams(
|
|
60
|
+
getIFrameSrc(),
|
|
61
|
+
`http://${thoughtSpotHost}/v2/?${defaultParams}&isSpotterExperienceEnabled=true&disableSourceSelection=true#/embed/insights/conv-assist?worksheet=worksheetId&query=searchQuery`,
|
|
62
|
+
);
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it('should render the conversation embed with worksheets hidden', async () => {
|
|
66
|
+
const viewConfig: ConversationViewConfig = {
|
|
67
|
+
worksheetId: 'worksheetId',
|
|
68
|
+
searchOptions: {
|
|
69
|
+
searchQuery: 'searchQuery',
|
|
70
|
+
},
|
|
71
|
+
hideSourceSelection: true,
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const conversationEmbed = new ConversationEmbed(getRootEl(), viewConfig);
|
|
75
|
+
await conversationEmbed.render();
|
|
76
|
+
expectUrlMatchesWithParams(
|
|
77
|
+
getIFrameSrc(),
|
|
78
|
+
`http://${thoughtSpotHost}/v2/?${defaultParams}&isSpotterExperienceEnabled=true&hideSourceSelection=true#/embed/insights/conv-assist?worksheet=worksheetId&query=searchQuery`,
|
|
79
|
+
);
|
|
80
|
+
});
|
|
81
|
+
|
|
48
82
|
it('should handle error when worksheetId is not provided', async () => {
|
|
49
83
|
const viewConfig: ConversationViewConfig = {
|
|
50
84
|
worksheetId: '',
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import isUndefined from 'lodash/isUndefined';
|
|
1
2
|
import { ERROR_MESSAGE } from '../errors';
|
|
2
3
|
import { ViewConfig, Param } from '../types';
|
|
3
4
|
import { TsEmbed } from './ts-embed';
|
|
@@ -22,6 +23,33 @@ export interface ConversationViewConfig extends ViewConfig {
|
|
|
22
23
|
* Ability to pass a starting search query to the conversation.
|
|
23
24
|
*/
|
|
24
25
|
searchOptions?: SearchOptions;
|
|
26
|
+
/**
|
|
27
|
+
* disableSourceSelection : Disables data source selection
|
|
28
|
+
* but still display the selected data source.
|
|
29
|
+
* @example
|
|
30
|
+
* ```js
|
|
31
|
+
* const embed = new ConversationEmbed('#tsEmbed', {
|
|
32
|
+
* ... // other options
|
|
33
|
+
* disableSourceSelection : true,
|
|
34
|
+
* })
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* @version SDK: 1.36.0 | Thoughtspot: 10.6.0.cl
|
|
38
|
+
*/
|
|
39
|
+
disableSourceSelection?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* hideSourceSelection : Hide data source selection
|
|
42
|
+
* @example
|
|
43
|
+
* ```js
|
|
44
|
+
* const embed = new ConversationEmbed('#tsEmbed', {
|
|
45
|
+
* ... // other options
|
|
46
|
+
* hideSourceSelection : true,
|
|
47
|
+
* })
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* @version SDK: 1.36.0 | Thoughtspot: 10.6.0.cl
|
|
51
|
+
*/
|
|
52
|
+
hideSourceSelection?: boolean;
|
|
25
53
|
}
|
|
26
54
|
|
|
27
55
|
/**
|
|
@@ -49,6 +77,8 @@ export class ConversationEmbed extends TsEmbed {
|
|
|
49
77
|
const {
|
|
50
78
|
worksheetId,
|
|
51
79
|
searchOptions,
|
|
80
|
+
disableSourceSelection,
|
|
81
|
+
hideSourceSelection,
|
|
52
82
|
} = this.viewConfig;
|
|
53
83
|
const path = 'insights/conv-assist';
|
|
54
84
|
if (!worksheetId) {
|
|
@@ -56,6 +86,12 @@ export class ConversationEmbed extends TsEmbed {
|
|
|
56
86
|
}
|
|
57
87
|
const queryParams = this.getBaseQueryParams();
|
|
58
88
|
queryParams[Param.SpotterEnabled] = true;
|
|
89
|
+
if (!isUndefined(disableSourceSelection)) {
|
|
90
|
+
queryParams[Param.DisableSourceSelection] = !!disableSourceSelection;
|
|
91
|
+
}
|
|
92
|
+
if (!isUndefined(hideSourceSelection)) {
|
|
93
|
+
queryParams[Param.HideSourceSelection] = !!hideSourceSelection;
|
|
94
|
+
}
|
|
59
95
|
|
|
60
96
|
let query = '';
|
|
61
97
|
const queryParamsString = getQueryParamString(queryParams, true);
|
|
@@ -172,6 +172,23 @@ describe('Liveboard/viz embed tests', () => {
|
|
|
172
172
|
});
|
|
173
173
|
});
|
|
174
174
|
|
|
175
|
+
test('should enable viz oAuthPollingInterval true', async () => {
|
|
176
|
+
const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
|
|
177
|
+
oAuthPollingInterval: 1000,
|
|
178
|
+
isForceRedirect: true,
|
|
179
|
+
dataSourceId: '12356',
|
|
180
|
+
...defaultViewConfig,
|
|
181
|
+
liveboardId,
|
|
182
|
+
} as LiveboardViewConfig);
|
|
183
|
+
liveboardEmbed.render();
|
|
184
|
+
await executeAfterWait(() => {
|
|
185
|
+
expectUrlMatchesWithParams(
|
|
186
|
+
getIFrameSrc(),
|
|
187
|
+
`http://${thoughtSpotHost}/?embedApp=true${defaultParams}&oAuthPollingInterval=1000&isForceRedirect=true&dataSourceId=12356${prefixParams}#/embed/viz/${liveboardId}`,
|
|
188
|
+
);
|
|
189
|
+
});
|
|
190
|
+
});
|
|
191
|
+
|
|
175
192
|
test('should disable viz transformations when enableVizTransformations false', async () => {
|
|
176
193
|
const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
|
|
177
194
|
enableVizTransformations: false,
|
package/src/embed/liveboard.ts
CHANGED
|
@@ -338,6 +338,45 @@ export interface LiveboardViewConfig
|
|
|
338
338
|
* ```
|
|
339
339
|
*/
|
|
340
340
|
hideIrrelevantChipsInLiveboardTabs?: boolean;
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* The Liveboard to run on regular intervals to fetch the cdw token.
|
|
344
|
+
* @hidden
|
|
345
|
+
* @version SDK: 1.35.0 | ThoughtSpot:10.6.0.cl
|
|
346
|
+
* @example
|
|
347
|
+
* ```js
|
|
348
|
+
* const embed = new LiveboardEmbed('#embed-container', {
|
|
349
|
+
* ... // other options
|
|
350
|
+
* oAuthPollingInterval: value in milliseconds,
|
|
351
|
+
* })
|
|
352
|
+
*/
|
|
353
|
+
oAuthPollingInterval?: number;
|
|
354
|
+
|
|
355
|
+
/**
|
|
356
|
+
* The Liveboard is set to force a token fetch during the initial load.
|
|
357
|
+
* @hidden
|
|
358
|
+
* @version SDK: 1.35.0 | ThoughtSpot:10.6.0.cl
|
|
359
|
+
* @example
|
|
360
|
+
* ```js
|
|
361
|
+
* const embed = new LiveboardEmbed('#embed-container', {
|
|
362
|
+
* ... // other options
|
|
363
|
+
* isForceRedirect: false,
|
|
364
|
+
* })
|
|
365
|
+
*/
|
|
366
|
+
isForceRedirect?: boolean;
|
|
367
|
+
|
|
368
|
+
/**
|
|
369
|
+
* The source connection ID for authentication.
|
|
370
|
+
* @hidden
|
|
371
|
+
* @version SDK: 1.35.0 | ThoughtSpot:10.6.0.cl
|
|
372
|
+
* @example
|
|
373
|
+
* ```js
|
|
374
|
+
* const embed = new LiveboardEmbed('#embed-container', {
|
|
375
|
+
* ... // other options
|
|
376
|
+
* dataSourceId: '',
|
|
377
|
+
* })
|
|
378
|
+
*/
|
|
379
|
+
dataSourceId?: string;
|
|
341
380
|
}
|
|
342
381
|
|
|
343
382
|
/**
|
|
@@ -399,6 +438,9 @@ export class LiveboardEmbed extends V1Embed {
|
|
|
399
438
|
enable2ColumnLayout,
|
|
400
439
|
dataPanelV2 = false,
|
|
401
440
|
enableCustomColumnGroups = false,
|
|
441
|
+
oAuthPollingInterval,
|
|
442
|
+
isForceRedirect,
|
|
443
|
+
dataSourceId,
|
|
402
444
|
} = this.viewConfig;
|
|
403
445
|
|
|
404
446
|
const preventLiveboardFilterRemoval = this.viewConfig.preventLiveboardFilterRemoval
|
|
@@ -445,6 +487,18 @@ export class LiveboardEmbed extends V1Embed {
|
|
|
445
487
|
params[Param.enableAskSage] = enableAskSage;
|
|
446
488
|
}
|
|
447
489
|
|
|
490
|
+
if (oAuthPollingInterval !== undefined) {
|
|
491
|
+
params[Param.OauthPollingInterval] = oAuthPollingInterval;
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
if (isForceRedirect) {
|
|
495
|
+
params[Param.IsForceRedirect] = isForceRedirect;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
if (dataSourceId !== undefined) {
|
|
499
|
+
params[Param.DataSourceId] = dataSourceId;
|
|
500
|
+
}
|
|
501
|
+
|
|
448
502
|
params[Param.LiveboardHeaderSticky] = isLiveboardHeaderSticky;
|
|
449
503
|
params[Param.LiveboardHeaderV2] = isLiveboardCompactHeaderEnabled;
|
|
450
504
|
params[Param.ShowLiveboardVerifiedBadge] = showLiveboardVerifiedBadge;
|
|
@@ -9,6 +9,12 @@ import {
|
|
|
9
9
|
LiveboardViewConfig,
|
|
10
10
|
AppEmbed,
|
|
11
11
|
LiveboardEmbed,
|
|
12
|
+
AppViewConfig,
|
|
13
|
+
SageEmbed,
|
|
14
|
+
SageViewConfig,
|
|
15
|
+
ConversationViewConfig,
|
|
16
|
+
ConversationEmbed,
|
|
17
|
+
SearchViewConfig,
|
|
12
18
|
} from '../index';
|
|
13
19
|
import {
|
|
14
20
|
Action, HomeLeftNavItem, RuntimeFilter, RuntimeFilterOp, HomepageModule, HostEvent,
|
|
@@ -28,6 +34,8 @@ import {
|
|
|
28
34
|
expectUrlToHaveParamsWithValues,
|
|
29
35
|
mockMessageChannel,
|
|
30
36
|
createRootEleForEmbed,
|
|
37
|
+
expectUrlMatch,
|
|
38
|
+
fixedEncodeURI,
|
|
31
39
|
} from '../test/test-utils';
|
|
32
40
|
import * as config from '../config';
|
|
33
41
|
import * as embedConfig from './embedConfig';
|
|
@@ -38,6 +46,8 @@ import * as baseInstance from './base';
|
|
|
38
46
|
import { MIXPANEL_EVENT } from '../mixpanel-service';
|
|
39
47
|
import * as authService from '../utils/authService/authService';
|
|
40
48
|
import { logger } from '../utils/logger';
|
|
49
|
+
import { version } from '../../package.json';
|
|
50
|
+
import { HiddenActionItemByDefaultForSearchEmbed } from './search';
|
|
41
51
|
|
|
42
52
|
const defaultViewConfig = {
|
|
43
53
|
frameParams: {
|
|
@@ -51,6 +61,12 @@ const tabId1 = 'eca215d4-0d2c-4a55-90e3-d81ef6848ae0';
|
|
|
51
61
|
const tabId2 = 'eca215d4-0d2c-4a55-90e3-d81ef6848ae0';
|
|
52
62
|
const thoughtSpotHost = 'tshost';
|
|
53
63
|
const defaultParamsPost = '';
|
|
64
|
+
export const defaultParamsWithoutHiddenActions = `hostAppUrl=local-host&viewPortHeight=768&viewPortWidth=1024&sdkVersion=${version}&authType=${AuthType.None}&blockNonEmbedFullAppAccess=true`;
|
|
65
|
+
export const defaultParams = `&${defaultParamsWithoutHiddenActions}&hideAction=[%22${Action.ReportError}%22]`;
|
|
66
|
+
const hideBydefault = `&hideAction=${fixedEncodeURI(
|
|
67
|
+
JSON.stringify([Action.ReportError, ...HiddenActionItemByDefaultForSearchEmbed]),
|
|
68
|
+
)}`;
|
|
69
|
+
const defaultParamsWithHiddenActions = defaultParamsWithoutHiddenActions + hideBydefault;
|
|
54
70
|
|
|
55
71
|
beforeAll(() => {
|
|
56
72
|
spyOn(window, 'alert');
|
|
@@ -89,6 +105,29 @@ describe('Unit test case for ts embed', () => {
|
|
|
89
105
|
jest.spyOn(authInstance, 'postLoginService').mockResolvedValue(true);
|
|
90
106
|
});
|
|
91
107
|
|
|
108
|
+
describe('Vaidate iframe properties', () => {
|
|
109
|
+
beforeAll(() => {
|
|
110
|
+
init({
|
|
111
|
+
thoughtSpotHost: 'tshost',
|
|
112
|
+
authType: AuthType.None,
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
test('should set proper allow policies', async () => {
|
|
117
|
+
// we dont have origin specific policies so just checking if
|
|
118
|
+
// policies are ending with ;
|
|
119
|
+
const searchEmbed = new SearchEmbed(getRootEl(), defaultViewConfig);
|
|
120
|
+
searchEmbed.render();
|
|
121
|
+
await executeAfterWait(() => {
|
|
122
|
+
const iframe = getIFrameEl();
|
|
123
|
+
const policiesAdded = iframe.allow.split(' ');
|
|
124
|
+
policiesAdded.forEach((policy) => {
|
|
125
|
+
expect(policy.endsWith(';')).toBe(true);
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
|
|
92
131
|
describe('AuthExpire embedEvent in cookieless authentication authType', () => {
|
|
93
132
|
beforeAll(() => {
|
|
94
133
|
jest.spyOn(authInstance, 'doCookielessTokenAuth').mockResolvedValueOnce(true);
|
|
@@ -1454,6 +1493,186 @@ describe('Unit test case for ts embed', () => {
|
|
|
1454
1493
|
orgId: overrideOrgId,
|
|
1455
1494
|
});
|
|
1456
1495
|
});
|
|
1496
|
+
|
|
1497
|
+
it('AppEmbed: Should add flipTooltipToContextMenuEnabled flag to the iframe src', async () => {
|
|
1498
|
+
const appEmbed = new AppEmbed(getRootEl(), {
|
|
1499
|
+
...defaultViewConfig,
|
|
1500
|
+
enableFlipTooltipToContextMenu: true,
|
|
1501
|
+
} as AppViewConfig);
|
|
1502
|
+
|
|
1503
|
+
appEmbed.render();
|
|
1504
|
+
await executeAfterWait(() => {
|
|
1505
|
+
expectUrlMatchesWithParams(
|
|
1506
|
+
getIFrameSrc(),
|
|
1507
|
+
`http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&flipTooltipToContextMenuEnabled=true${defaultParams}${defaultParamsPost}#/home`,
|
|
1508
|
+
);
|
|
1509
|
+
});
|
|
1510
|
+
});
|
|
1511
|
+
|
|
1512
|
+
it('AppEmbed: Should not add flipTooltipToContextMenuEnabled flag to the iframe src when if false', async () => {
|
|
1513
|
+
const appEmbed = new AppEmbed(getRootEl(), {
|
|
1514
|
+
...defaultViewConfig,
|
|
1515
|
+
enableFlipTooltipToContextMenu: false,
|
|
1516
|
+
} as AppViewConfig);
|
|
1517
|
+
|
|
1518
|
+
appEmbed.render();
|
|
1519
|
+
await executeAfterWait(() => {
|
|
1520
|
+
expectUrlMatchesWithParams(
|
|
1521
|
+
getIFrameSrc(),
|
|
1522
|
+
`http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false${defaultParams}${defaultParamsPost}#/home`,
|
|
1523
|
+
);
|
|
1524
|
+
});
|
|
1525
|
+
});
|
|
1526
|
+
|
|
1527
|
+
it('LiveboardEmbed: Should add flipTooltipToContextMenuEnabled flag to the iframe src', async () => {
|
|
1528
|
+
const appEmbed = new LiveboardEmbed(getRootEl(), {
|
|
1529
|
+
...defaultViewConfig,
|
|
1530
|
+
liveboardId,
|
|
1531
|
+
enableFlipTooltipToContextMenu: true,
|
|
1532
|
+
} as LiveboardViewConfig);
|
|
1533
|
+
|
|
1534
|
+
appEmbed.render();
|
|
1535
|
+
await executeAfterWait(() => {
|
|
1536
|
+
expectUrlMatchesWithParams(
|
|
1537
|
+
getIFrameSrc(),
|
|
1538
|
+
`http://${thoughtSpotHost}/?embedApp=true&flipTooltipToContextMenuEnabled=true${defaultParams}#/embed/viz/${liveboardId}`,
|
|
1539
|
+
);
|
|
1540
|
+
});
|
|
1541
|
+
});
|
|
1542
|
+
|
|
1543
|
+
it('LiveboardEmbed: Should not add flipTooltipToContextMenuEnabled flag to the iframe src when if false', async () => {
|
|
1544
|
+
const appEmbed = new LiveboardEmbed(getRootEl(), {
|
|
1545
|
+
...defaultViewConfig,
|
|
1546
|
+
liveboardId,
|
|
1547
|
+
enableFlipTooltipToContextMenu: false,
|
|
1548
|
+
} as LiveboardViewConfig);
|
|
1549
|
+
|
|
1550
|
+
appEmbed.render();
|
|
1551
|
+
await executeAfterWait(() => {
|
|
1552
|
+
expectUrlMatchesWithParams(
|
|
1553
|
+
getIFrameSrc(),
|
|
1554
|
+
`http://${thoughtSpotHost}/?embedApp=true${defaultParams}#/embed/viz/${liveboardId}`,
|
|
1555
|
+
);
|
|
1556
|
+
});
|
|
1557
|
+
});
|
|
1558
|
+
|
|
1559
|
+
it('SageViewConfig: Should add flipTooltipToContextMenuEnabled flag to the iframe src', async () => {
|
|
1560
|
+
const defaultConfig: SageViewConfig = {
|
|
1561
|
+
disableWorksheetChange: false,
|
|
1562
|
+
hideWorksheetSelector: false,
|
|
1563
|
+
hideSageAnswerHeader: false,
|
|
1564
|
+
hideAutocompleteSuggestions: false,
|
|
1565
|
+
hideSampleQuestions: false,
|
|
1566
|
+
isProductTour: false,
|
|
1567
|
+
dataPanelV2: false,
|
|
1568
|
+
};
|
|
1569
|
+
const appEmbed = new SageEmbed(getRootEl(), {
|
|
1570
|
+
...defaultConfig,
|
|
1571
|
+
enableFlipTooltipToContextMenu: true,
|
|
1572
|
+
} as SageViewConfig);
|
|
1573
|
+
|
|
1574
|
+
appEmbed.render();
|
|
1575
|
+
await executeAfterWait(() => {
|
|
1576
|
+
expectUrlMatch(
|
|
1577
|
+
getIFrameSrc(),
|
|
1578
|
+
`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`,
|
|
1579
|
+
);
|
|
1580
|
+
});
|
|
1581
|
+
});
|
|
1582
|
+
|
|
1583
|
+
it('SageViewConfig: Should not add flipTooltipToContextMenuEnabled flag to the iframe src when if false', async () => {
|
|
1584
|
+
const defaultConfig: SageViewConfig = {
|
|
1585
|
+
disableWorksheetChange: false,
|
|
1586
|
+
hideWorksheetSelector: false,
|
|
1587
|
+
hideSageAnswerHeader: false,
|
|
1588
|
+
hideAutocompleteSuggestions: false,
|
|
1589
|
+
hideSampleQuestions: false,
|
|
1590
|
+
isProductTour: false,
|
|
1591
|
+
dataPanelV2: false,
|
|
1592
|
+
};
|
|
1593
|
+
const appEmbed = new SageEmbed(getRootEl(), {
|
|
1594
|
+
...defaultConfig,
|
|
1595
|
+
enableFlipTooltipToContextMenu: false,
|
|
1596
|
+
} as SageViewConfig);
|
|
1597
|
+
|
|
1598
|
+
appEmbed.render();
|
|
1599
|
+
await executeAfterWait(() => {
|
|
1600
|
+
expectUrlMatch(
|
|
1601
|
+
getIFrameSrc(),
|
|
1602
|
+
`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`,
|
|
1603
|
+
);
|
|
1604
|
+
});
|
|
1605
|
+
});
|
|
1606
|
+
|
|
1607
|
+
it('ConversationEmbed: Should add flipTooltipToContextMenuEnabled flag to the iframe src', async () => {
|
|
1608
|
+
const appEmbed = new ConversationEmbed(getRootEl(), {
|
|
1609
|
+
worksheetId: 'worksheetId',
|
|
1610
|
+
searchOptions: {
|
|
1611
|
+
searchQuery: 'searchQuery',
|
|
1612
|
+
},
|
|
1613
|
+
enableFlipTooltipToContextMenu: true,
|
|
1614
|
+
} as ConversationViewConfig);
|
|
1615
|
+
|
|
1616
|
+
appEmbed.render();
|
|
1617
|
+
await executeAfterWait(() => {
|
|
1618
|
+
expectUrlMatchesWithParams(
|
|
1619
|
+
getIFrameSrc(),
|
|
1620
|
+
`http://${thoughtSpotHost}/v2/?${defaultParams}&isSpotterExperienceEnabled=true&flipTooltipToContextMenuEnabled=true#/embed/insights/conv-assist?worksheet=worksheetId&query=searchQuery`,
|
|
1621
|
+
);
|
|
1622
|
+
});
|
|
1623
|
+
});
|
|
1624
|
+
|
|
1625
|
+
it('ConversationEmbed: Should not add flipTooltipToContextMenuEnabled flag to the iframe src when flag is false', async () => {
|
|
1626
|
+
const appEmbed = new ConversationEmbed(getRootEl(), {
|
|
1627
|
+
worksheetId: 'worksheetId',
|
|
1628
|
+
searchOptions: {
|
|
1629
|
+
searchQuery: 'searchQuery',
|
|
1630
|
+
},
|
|
1631
|
+
enableFlipTooltipToContextMenu: false,
|
|
1632
|
+
} as ConversationViewConfig);
|
|
1633
|
+
|
|
1634
|
+
appEmbed.render();
|
|
1635
|
+
await executeAfterWait(() => {
|
|
1636
|
+
expectUrlMatchesWithParams(
|
|
1637
|
+
getIFrameSrc(),
|
|
1638
|
+
`http://${thoughtSpotHost}/v2/?${defaultParams}&isSpotterExperienceEnabled=true#/embed/insights/conv-assist?worksheet=worksheetId&query=searchQuery`,
|
|
1639
|
+
);
|
|
1640
|
+
});
|
|
1641
|
+
});
|
|
1642
|
+
|
|
1643
|
+
it('SearchEmbed: Should add flipTooltipToContextMenuEnabled flag to the iframe src', async () => {
|
|
1644
|
+
const dataSources = ['data-source-1'];
|
|
1645
|
+
const appEmbed = new SearchEmbed(getRootEl(), {
|
|
1646
|
+
...defaultViewConfig,
|
|
1647
|
+
dataSources,
|
|
1648
|
+
enableFlipTooltipToContextMenu: true,
|
|
1649
|
+
} as SearchViewConfig);
|
|
1650
|
+
|
|
1651
|
+
appEmbed.render();
|
|
1652
|
+
await executeAfterWait(() => {
|
|
1653
|
+
expectUrlMatchesWithParams(
|
|
1654
|
+
getIFrameSrc(),
|
|
1655
|
+
`http://${thoughtSpotHost}/v2/?${defaultParamsWithHiddenActions}&dataSources=[%22data-source-1%22]&dataSourceMode=expand&useLastSelectedSources=false&flipTooltipToContextMenuEnabled=true#/embed/answer`,
|
|
1656
|
+
);
|
|
1657
|
+
});
|
|
1658
|
+
});
|
|
1659
|
+
|
|
1660
|
+
it('SearchEmbed: Should not add flipTooltipToContextMenuEnabled flag to the iframe src when if false', async () => {
|
|
1661
|
+
const dataSources = ['data-source-1'];
|
|
1662
|
+
const appEmbed = new SearchEmbed(getRootEl(), {
|
|
1663
|
+
...defaultViewConfig,
|
|
1664
|
+
dataSources,
|
|
1665
|
+
enableFlipTooltipToContextMenu: false,
|
|
1666
|
+
} as SearchViewConfig);
|
|
1667
|
+
|
|
1668
|
+
appEmbed.render();
|
|
1669
|
+
await executeAfterWait(() => {
|
|
1670
|
+
expectUrlMatchesWithParams(
|
|
1671
|
+
getIFrameSrc(),
|
|
1672
|
+
`http://${thoughtSpotHost}/v2/?${defaultParamsWithHiddenActions}&dataSources=[%22data-source-1%22]&dataSourceMode=expand&useLastSelectedSources=false#/embed/answer`,
|
|
1673
|
+
);
|
|
1674
|
+
});
|
|
1675
|
+
});
|
|
1457
1676
|
});
|
|
1458
1677
|
|
|
1459
1678
|
describe('When destroyed', () => {
|
package/src/embed/ts-embed.ts
CHANGED
|
@@ -446,6 +446,7 @@ export class TsEmbed {
|
|
|
446
446
|
insertInToSlide,
|
|
447
447
|
disableRedirectionLinksInNewTab,
|
|
448
448
|
overrideOrgId,
|
|
449
|
+
enableFlipTooltipToContextMenu = false,
|
|
449
450
|
} = this.viewConfig;
|
|
450
451
|
|
|
451
452
|
const { additionalFlags: additionalFlagsFromInit } = this.embedConfig;
|
|
@@ -455,6 +456,10 @@ export class TsEmbed {
|
|
|
455
456
|
...additionalFlagsFromView,
|
|
456
457
|
};
|
|
457
458
|
|
|
459
|
+
if (enableFlipTooltipToContextMenu) {
|
|
460
|
+
queryParams[Param.EnableFlipTooltipToContextMenu] = enableFlipTooltipToContextMenu;
|
|
461
|
+
}
|
|
462
|
+
|
|
458
463
|
if (Array.isArray(visibleActions) && Array.isArray(hiddenActions)) {
|
|
459
464
|
this.handleError('You cannot have both hidden actions and visible actions');
|
|
460
465
|
return queryParams;
|
|
@@ -576,7 +581,7 @@ export class TsEmbed {
|
|
|
576
581
|
iFrame.mozallowfullscreen = true;
|
|
577
582
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
578
583
|
// @ts-ignore
|
|
579
|
-
iFrame.allow = 'clipboard-read; clipboard-write fullscreen';
|
|
584
|
+
iFrame.allow = 'clipboard-read; clipboard-write; fullscreen;';
|
|
580
585
|
|
|
581
586
|
const {
|
|
582
587
|
height: frameHeight,
|