@thoughtspot/visual-embed-sdk 1.49.3 → 1.50.1
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/authToken.spec.js +5 -0
- package/cjs/src/authToken.spec.js.map +1 -1
- package/cjs/src/css-variables.d.ts +59 -0
- package/cjs/src/css-variables.d.ts.map +1 -1
- package/cjs/src/embed/app.d.ts +31 -2
- package/cjs/src/embed/app.d.ts.map +1 -1
- package/cjs/src/embed/app.js +19 -2
- package/cjs/src/embed/app.js.map +1 -1
- package/cjs/src/embed/app.spec.js +112 -2
- package/cjs/src/embed/app.spec.js.map +1 -1
- package/cjs/src/embed/conversation.d.ts +38 -0
- package/cjs/src/embed/conversation.d.ts.map +1 -1
- package/cjs/src/embed/conversation.js +12 -2
- package/cjs/src/embed/conversation.js.map +1 -1
- package/cjs/src/embed/conversation.spec.js +53 -0
- package/cjs/src/embed/conversation.spec.js.map +1 -1
- package/cjs/src/embed/embedConfig.spec.d.ts +2 -0
- package/cjs/src/embed/embedConfig.spec.d.ts.map +1 -0
- package/cjs/src/embed/embedConfig.spec.js +74 -0
- package/cjs/src/embed/embedConfig.spec.js.map +1 -0
- package/cjs/src/embed/events.spec.js +593 -0
- package/cjs/src/embed/events.spec.js.map +1 -1
- package/cjs/src/embed/host-events.spec.d.ts +2 -0
- package/cjs/src/embed/host-events.spec.d.ts.map +1 -0
- package/cjs/src/embed/host-events.spec.js +1325 -0
- package/cjs/src/embed/host-events.spec.js.map +1 -0
- package/cjs/src/embed/hostEventClient/contracts.d.ts +36 -14
- package/cjs/src/embed/hostEventClient/contracts.d.ts.map +1 -1
- package/cjs/src/embed/hostEventClient/contracts.js +10 -1
- package/cjs/src/embed/hostEventClient/contracts.js.map +1 -1
- package/cjs/src/embed/hostEventClient/host-event-client.d.ts +1 -0
- package/cjs/src/embed/hostEventClient/host-event-client.d.ts.map +1 -1
- package/cjs/src/embed/hostEventClient/host-event-client.js +8 -0
- package/cjs/src/embed/hostEventClient/host-event-client.js.map +1 -1
- package/cjs/src/embed/hostEventClient/host-event-client.spec.js +209 -0
- package/cjs/src/embed/hostEventClient/host-event-client.spec.js.map +1 -1
- package/cjs/src/embed/hostEventClient/utils.d.ts +2 -0
- package/cjs/src/embed/hostEventClient/utils.d.ts.map +1 -1
- package/cjs/src/embed/hostEventClient/utils.js +32 -2
- package/cjs/src/embed/hostEventClient/utils.js.map +1 -1
- package/cjs/src/embed/hostEventClient/utils.spec.js +178 -0
- package/cjs/src/embed/hostEventClient/utils.spec.js.map +1 -1
- package/cjs/src/embed/liveboard.d.ts +6 -0
- package/cjs/src/embed/liveboard.d.ts.map +1 -1
- package/cjs/src/embed/liveboard.js.map +1 -1
- package/cjs/src/embed/spotter-viz-utils.d.ts +34 -0
- package/cjs/src/embed/spotter-viz-utils.d.ts.map +1 -1
- package/cjs/src/embed/spotter-viz-utils.js.map +1 -1
- package/cjs/src/embed/spotter-viz-utils.spec.js +17 -0
- package/cjs/src/embed/spotter-viz-utils.spec.js.map +1 -1
- package/cjs/src/embed/ts-embed.d.ts.map +1 -1
- package/cjs/src/embed/ts-embed.js +14 -7
- package/cjs/src/embed/ts-embed.js.map +1 -1
- package/cjs/src/embed/ts-embed.spec.js +146 -0
- package/cjs/src/embed/ts-embed.spec.js.map +1 -1
- package/cjs/src/errors.d.ts +1 -0
- package/cjs/src/errors.d.ts.map +1 -1
- package/cjs/src/errors.js +1 -0
- package/cjs/src/errors.js.map +1 -1
- package/cjs/src/index.d.ts +2 -2
- package/cjs/src/index.d.ts.map +1 -1
- package/cjs/src/index.js +3 -2
- package/cjs/src/index.js.map +1 -1
- package/cjs/src/mixpanel-service.spec.js +14 -0
- package/cjs/src/mixpanel-service.spec.js.map +1 -1
- package/cjs/src/react/util.spec.js +251 -0
- package/cjs/src/react/util.spec.js.map +1 -1
- package/cjs/src/types.d.ts +212 -8
- package/cjs/src/types.d.ts.map +1 -1
- package/cjs/src/types.js +185 -3
- package/cjs/src/types.js.map +1 -1
- package/cjs/src/utils/custom-actions.spec.js +26 -0
- package/cjs/src/utils/custom-actions.spec.js.map +1 -1
- package/cjs/src/utils/processData.spec.js +123 -0
- package/cjs/src/utils/processData.spec.js.map +1 -1
- package/cjs/src/utils/processTrigger.spec.js +61 -0
- package/cjs/src/utils/processTrigger.spec.js.map +1 -1
- package/cjs/src/utils/reporting.spec.js +21 -0
- package/cjs/src/utils/reporting.spec.js.map +1 -1
- package/cjs/src/utils/sessionInfoService.spec.d.ts +2 -0
- package/cjs/src/utils/sessionInfoService.spec.d.ts.map +1 -0
- package/cjs/src/utils/sessionInfoService.spec.js +130 -0
- package/cjs/src/utils/sessionInfoService.spec.js.map +1 -0
- package/cjs/src/utils.spec.js +158 -0
- package/cjs/src/utils.spec.js.map +1 -1
- package/dist/{index-DsSQndIB.js → index-fCne7kmU.js} +1 -1
- package/dist/src/css-variables.d.ts +59 -0
- package/dist/src/css-variables.d.ts.map +1 -1
- package/dist/src/embed/app.d.ts +31 -2
- package/dist/src/embed/app.d.ts.map +1 -1
- package/dist/src/embed/conversation.d.ts +38 -0
- package/dist/src/embed/conversation.d.ts.map +1 -1
- package/dist/src/embed/embedConfig.spec.d.ts +2 -0
- package/dist/src/embed/embedConfig.spec.d.ts.map +1 -0
- package/dist/src/embed/host-events.spec.d.ts +2 -0
- package/dist/src/embed/host-events.spec.d.ts.map +1 -0
- package/dist/src/embed/hostEventClient/contracts.d.ts +36 -14
- package/dist/src/embed/hostEventClient/contracts.d.ts.map +1 -1
- package/dist/src/embed/hostEventClient/host-event-client.d.ts +1 -0
- package/dist/src/embed/hostEventClient/host-event-client.d.ts.map +1 -1
- package/dist/src/embed/hostEventClient/utils.d.ts +2 -0
- package/dist/src/embed/hostEventClient/utils.d.ts.map +1 -1
- package/dist/src/embed/liveboard.d.ts +6 -0
- package/dist/src/embed/liveboard.d.ts.map +1 -1
- package/dist/src/embed/spotter-viz-utils.d.ts +34 -0
- package/dist/src/embed/spotter-viz-utils.d.ts.map +1 -1
- package/dist/src/embed/ts-embed.d.ts.map +1 -1
- package/dist/src/errors.d.ts +1 -0
- package/dist/src/errors.d.ts.map +1 -1
- package/dist/src/index.d.ts +2 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/types.d.ts +212 -8
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/utils/sessionInfoService.spec.d.ts +2 -0
- package/dist/src/utils/sessionInfoService.spec.d.ts.map +1 -0
- package/dist/tsembed-react.es.js +482 -86
- package/dist/tsembed-react.js +481 -85
- package/dist/tsembed.es.js +483 -87
- package/dist/tsembed.js +481 -85
- package/dist/visual-embed-sdk-react-full.d.ts +407 -23
- package/dist/visual-embed-sdk-react.d.ts +407 -23
- package/dist/visual-embed-sdk.d.ts +411 -23
- package/lib/package.json +1 -1
- package/lib/src/authToken.spec.js +5 -0
- package/lib/src/authToken.spec.js.map +1 -1
- package/lib/src/css-variables.d.ts +59 -0
- package/lib/src/css-variables.d.ts.map +1 -1
- package/lib/src/embed/app.d.ts +31 -2
- package/lib/src/embed/app.d.ts.map +1 -1
- package/lib/src/embed/app.js +19 -2
- package/lib/src/embed/app.js.map +1 -1
- package/lib/src/embed/app.spec.js +112 -2
- package/lib/src/embed/app.spec.js.map +1 -1
- package/lib/src/embed/conversation.d.ts +38 -0
- package/lib/src/embed/conversation.d.ts.map +1 -1
- package/lib/src/embed/conversation.js +11 -1
- package/lib/src/embed/conversation.js.map +1 -1
- package/lib/src/embed/conversation.spec.js +54 -1
- package/lib/src/embed/conversation.spec.js.map +1 -1
- package/lib/src/embed/embedConfig.spec.d.ts +2 -0
- package/lib/src/embed/embedConfig.spec.d.ts.map +1 -0
- package/lib/src/embed/embedConfig.spec.js +72 -0
- package/lib/src/embed/embedConfig.spec.js.map +1 -0
- package/lib/src/embed/events.spec.js +593 -0
- package/lib/src/embed/events.spec.js.map +1 -1
- package/lib/src/embed/host-events.spec.d.ts +2 -0
- package/lib/src/embed/host-events.spec.d.ts.map +1 -0
- package/lib/src/embed/host-events.spec.js +1322 -0
- package/lib/src/embed/host-events.spec.js.map +1 -0
- package/lib/src/embed/hostEventClient/contracts.d.ts +36 -14
- package/lib/src/embed/hostEventClient/contracts.d.ts.map +1 -1
- package/lib/src/embed/hostEventClient/contracts.js +9 -0
- package/lib/src/embed/hostEventClient/contracts.js.map +1 -1
- package/lib/src/embed/hostEventClient/host-event-client.d.ts +1 -0
- package/lib/src/embed/hostEventClient/host-event-client.d.ts.map +1 -1
- package/lib/src/embed/hostEventClient/host-event-client.js +9 -1
- package/lib/src/embed/hostEventClient/host-event-client.js.map +1 -1
- package/lib/src/embed/hostEventClient/host-event-client.spec.js +209 -0
- package/lib/src/embed/hostEventClient/host-event-client.spec.js.map +1 -1
- package/lib/src/embed/hostEventClient/utils.d.ts +2 -0
- package/lib/src/embed/hostEventClient/utils.d.ts.map +1 -1
- package/lib/src/embed/hostEventClient/utils.js +28 -1
- package/lib/src/embed/hostEventClient/utils.js.map +1 -1
- package/lib/src/embed/hostEventClient/utils.spec.js +179 -1
- package/lib/src/embed/hostEventClient/utils.spec.js.map +1 -1
- package/lib/src/embed/liveboard.d.ts +6 -0
- package/lib/src/embed/liveboard.d.ts.map +1 -1
- package/lib/src/embed/liveboard.js.map +1 -1
- package/lib/src/embed/spotter-viz-utils.d.ts +34 -0
- package/lib/src/embed/spotter-viz-utils.d.ts.map +1 -1
- package/lib/src/embed/spotter-viz-utils.js.map +1 -1
- package/lib/src/embed/spotter-viz-utils.spec.js +17 -0
- package/lib/src/embed/spotter-viz-utils.spec.js.map +1 -1
- package/lib/src/embed/ts-embed.d.ts.map +1 -1
- package/lib/src/embed/ts-embed.js +14 -7
- package/lib/src/embed/ts-embed.js.map +1 -1
- package/lib/src/embed/ts-embed.spec.js +146 -0
- package/lib/src/embed/ts-embed.spec.js.map +1 -1
- package/lib/src/errors.d.ts +1 -0
- package/lib/src/errors.d.ts.map +1 -1
- package/lib/src/errors.js +1 -0
- package/lib/src/errors.js.map +1 -1
- package/lib/src/index.d.ts +2 -2
- package/lib/src/index.d.ts.map +1 -1
- package/lib/src/index.js +2 -2
- package/lib/src/index.js.map +1 -1
- package/lib/src/mixpanel-service.spec.js +14 -0
- package/lib/src/mixpanel-service.spec.js.map +1 -1
- package/lib/src/react/util.spec.js +251 -0
- package/lib/src/react/util.spec.js.map +1 -1
- package/lib/src/types.d.ts +212 -8
- package/lib/src/types.d.ts.map +1 -1
- package/lib/src/types.js +185 -3
- package/lib/src/types.js.map +1 -1
- package/lib/src/utils/custom-actions.spec.js +26 -0
- package/lib/src/utils/custom-actions.spec.js.map +1 -1
- package/lib/src/utils/processData.spec.js +123 -0
- package/lib/src/utils/processData.spec.js.map +1 -1
- package/lib/src/utils/processTrigger.spec.js +61 -0
- package/lib/src/utils/processTrigger.spec.js.map +1 -1
- package/lib/src/utils/reporting.spec.js +21 -0
- package/lib/src/utils/reporting.spec.js.map +1 -1
- package/lib/src/utils/sessionInfoService.spec.d.ts +2 -0
- package/lib/src/utils/sessionInfoService.spec.d.ts.map +1 -0
- package/lib/src/utils/sessionInfoService.spec.js +127 -0
- package/lib/src/utils/sessionInfoService.spec.js.map +1 -0
- package/lib/src/utils.spec.js +159 -1
- package/lib/src/utils.spec.js.map +1 -1
- package/lib/src/visual-embed-sdk.d.ts +411 -23
- package/package.json +1 -1
- package/src/authToken.spec.ts +6 -0
- package/src/css-variables.ts +73 -0
- package/src/embed/app.spec.ts +155 -2
- package/src/embed/app.ts +44 -2
- package/src/embed/conversation.spec.ts +64 -1
- package/src/embed/conversation.ts +41 -0
- package/src/embed/embedConfig.spec.ts +79 -0
- package/src/embed/events.spec.ts +705 -1
- package/src/embed/host-events.spec.ts +1759 -0
- package/src/embed/hostEventClient/contracts.ts +41 -14
- package/src/embed/hostEventClient/host-event-client.spec.ts +326 -0
- package/src/embed/hostEventClient/host-event-client.ts +15 -0
- package/src/embed/hostEventClient/utils.spec.ts +204 -0
- package/src/embed/hostEventClient/utils.ts +37 -10
- package/src/embed/liveboard.ts +6 -0
- package/src/embed/spotter-viz-utils.spec.ts +17 -0
- package/src/embed/spotter-viz-utils.ts +34 -0
- package/src/embed/ts-embed.spec.ts +186 -0
- package/src/embed/ts-embed.ts +12 -4
- package/src/errors.ts +1 -0
- package/src/index.ts +2 -1
- package/src/mixpanel-service.spec.ts +15 -0
- package/src/react/util.spec.tsx +255 -0
- package/src/types.ts +215 -6
- package/src/utils/custom-actions.spec.ts +28 -0
- package/src/utils/processData.spec.ts +129 -0
- package/src/utils/processTrigger.spec.ts +91 -0
- package/src/utils/reporting.spec.ts +27 -0
- package/src/utils/sessionInfoService.spec.ts +151 -0
- package/src/utils.spec.ts +195 -0
package/src/css-variables.ts
CHANGED
|
@@ -499,6 +499,16 @@ export interface CustomCssVariables {
|
|
|
499
499
|
*/
|
|
500
500
|
'--ts-var-liveboard-tile-background'?: string;
|
|
501
501
|
|
|
502
|
+
/**
|
|
503
|
+
* Font color of the insight tiles in the Liveboard.
|
|
504
|
+
*/
|
|
505
|
+
'--ts-var-liveboard-insight-tile-font-color'?: string;
|
|
506
|
+
|
|
507
|
+
/**
|
|
508
|
+
* Background color of the insight tiles in the Liveboard.
|
|
509
|
+
*/
|
|
510
|
+
'--ts-var-liveboard-insight-tile-background'?: string;
|
|
511
|
+
|
|
502
512
|
/**
|
|
503
513
|
* Border radius of the tiles in the Liveboard.
|
|
504
514
|
*/
|
|
@@ -1166,6 +1176,11 @@ export interface CustomCssVariables {
|
|
|
1166
1176
|
*/
|
|
1167
1177
|
'--ts-var-spotterviz-border-color'?: string;
|
|
1168
1178
|
|
|
1179
|
+
/**
|
|
1180
|
+
* Expanded user chat message bubble border color in SpotterViz.
|
|
1181
|
+
*/
|
|
1182
|
+
'--ts-var-spotterviz-expanded-border-color'?: string;
|
|
1183
|
+
|
|
1169
1184
|
/**
|
|
1170
1185
|
* Background color of the reference-mode toggle button in the SpotterViz
|
|
1171
1186
|
* chat input when it is unselected and the user hovers over it.
|
|
@@ -1185,4 +1200,62 @@ export interface CustomCssVariables {
|
|
|
1185
1200
|
* on each referenced-entity chip in the chat input.
|
|
1186
1201
|
*/
|
|
1187
1202
|
'--ts-var-spotterviz-reference-icon-selected-background'?: string;
|
|
1203
|
+
|
|
1204
|
+
/**
|
|
1205
|
+
* Background color of the shared conversation header (recipient's read-only view).
|
|
1206
|
+
*/
|
|
1207
|
+
'--ts-var-shared-conv-header-background'?: string;
|
|
1208
|
+
|
|
1209
|
+
/**
|
|
1210
|
+
* Border color of the shared conversation header.
|
|
1211
|
+
*/
|
|
1212
|
+
'--ts-var-shared-conv-header-border-color'?: string;
|
|
1213
|
+
|
|
1214
|
+
/**
|
|
1215
|
+
* Font color of the title text in the shared conversation header.
|
|
1216
|
+
*/
|
|
1217
|
+
'--ts-var-shared-conv-title-color'?: string;
|
|
1218
|
+
|
|
1219
|
+
/**
|
|
1220
|
+
* Background gradient color-stop of the share chat header's outer container
|
|
1221
|
+
* (sender's pre-share header). Defaults to transparent.
|
|
1222
|
+
*/
|
|
1223
|
+
'--ts-var-share-chat-header-container-background'?: string;
|
|
1224
|
+
|
|
1225
|
+
/**
|
|
1226
|
+
* Background color of the share chat header's inner title/actions row.
|
|
1227
|
+
* Defaults to transparent.
|
|
1228
|
+
*/
|
|
1229
|
+
'--ts-var-share-chat-header-background'?: string;
|
|
1230
|
+
|
|
1231
|
+
/**
|
|
1232
|
+
* Font color of the title text in the share chat header.
|
|
1233
|
+
*/
|
|
1234
|
+
'--ts-var-share-chat-header-title-color'?: string;
|
|
1235
|
+
|
|
1236
|
+
/**
|
|
1237
|
+
* Font color of the title input field in the share chat header.
|
|
1238
|
+
*/
|
|
1239
|
+
'--ts-var-share-chat-header-input-text-color'?: string;
|
|
1240
|
+
|
|
1241
|
+
/**
|
|
1242
|
+
* Background color of the title input field in the share chat header.
|
|
1243
|
+
*/
|
|
1244
|
+
'--ts-var-share-chat-header-input-background'?: string;
|
|
1245
|
+
|
|
1246
|
+
/**
|
|
1247
|
+
* Border color of the title input field in the share chat header.
|
|
1248
|
+
*/
|
|
1249
|
+
'--ts-var-share-chat-header-input-border-color'?: string;
|
|
1250
|
+
|
|
1251
|
+
/**
|
|
1252
|
+
* Background color of the shimmer loading effect. Also affects the
|
|
1253
|
+
* saved chats sidebar's new-chat shimmer, which shares the same style.
|
|
1254
|
+
*/
|
|
1255
|
+
'--ts-var-shimmer-background'?: string;
|
|
1256
|
+
|
|
1257
|
+
/**
|
|
1258
|
+
* Background color of the shimmer sweep animation's gradient mid-stop.
|
|
1259
|
+
*/
|
|
1260
|
+
'--ts-var-shimmer-sweep-background'?: string;
|
|
1188
1261
|
}
|
package/src/embed/app.spec.ts
CHANGED
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
HomePage,
|
|
9
9
|
ListPage,
|
|
10
10
|
} from './app';
|
|
11
|
+
import { SpotterQueryMode } from './conversation';
|
|
11
12
|
import { init } from '../index';
|
|
12
13
|
import { Action, AuthType, EmbedEvent, HostEvent, RuntimeFilterOp } from '../types';
|
|
13
14
|
import {
|
|
@@ -210,6 +211,7 @@ describe('App embed tests', () => {
|
|
|
210
211
|
[Page.Home]: 'home',
|
|
211
212
|
[Page.SpotIQ]: 'insights/results',
|
|
212
213
|
[Page.Monitor]: 'insights/monitor-alerts',
|
|
214
|
+
[Page.Collections]: 'collections',
|
|
213
215
|
};
|
|
214
216
|
|
|
215
217
|
const pageIds = Object.keys(pageRouteMap);
|
|
@@ -243,6 +245,7 @@ describe('App embed tests', () => {
|
|
|
243
245
|
[Page.Home]: 'home',
|
|
244
246
|
[Page.SpotIQ]: 'home/spotiq-analysis',
|
|
245
247
|
[Page.Monitor]: 'home/monitor-alerts',
|
|
248
|
+
[Page.Collections]: 'collections',
|
|
246
249
|
};
|
|
247
250
|
|
|
248
251
|
const pageIdsForModularHomes = Object.keys(pageRouteMapForModularHome);
|
|
@@ -522,7 +525,7 @@ describe('App embed tests', () => {
|
|
|
522
525
|
});
|
|
523
526
|
});
|
|
524
527
|
|
|
525
|
-
test('Should add homepageVersion=v4 when homePage is Focused to the iframe src', async () => {
|
|
528
|
+
test('Should add homepageVersion=v4 and updatedSpotterChatPrompt=true when homePage is Focused to the iframe src', async () => {
|
|
526
529
|
await testUrlParams(
|
|
527
530
|
{
|
|
528
531
|
...defaultViewConfig,
|
|
@@ -530,7 +533,20 @@ describe('App embed tests', () => {
|
|
|
530
533
|
homePage: HomePage.Focused,
|
|
531
534
|
},
|
|
532
535
|
} as AppViewConfig,
|
|
533
|
-
`http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&modularHomeExperience=false&navigationVersion=v2&homepageVersion=v4${defaultParams}${defaultParamsPost}#/home`,
|
|
536
|
+
`http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&modularHomeExperience=false&navigationVersion=v2&homepageVersion=v4&updatedSpotterChatPrompt=true${defaultParams}${defaultParamsPost}#/home`,
|
|
537
|
+
);
|
|
538
|
+
});
|
|
539
|
+
|
|
540
|
+
test('Should respect explicit updatedSpotterChatPrompt=false even when homePage is Focused', async () => {
|
|
541
|
+
await testUrlParams(
|
|
542
|
+
{
|
|
543
|
+
...defaultViewConfig,
|
|
544
|
+
discoveryExperience: {
|
|
545
|
+
homePage: HomePage.Focused,
|
|
546
|
+
},
|
|
547
|
+
updatedSpotterChatPrompt: false,
|
|
548
|
+
} as AppViewConfig,
|
|
549
|
+
`http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&modularHomeExperience=false&navigationVersion=v2&homepageVersion=v4&updatedSpotterChatPrompt=false${defaultParams}${defaultParamsPost}#/home`,
|
|
534
550
|
);
|
|
535
551
|
});
|
|
536
552
|
|
|
@@ -576,6 +592,33 @@ describe('App embed tests', () => {
|
|
|
576
592
|
});
|
|
577
593
|
});
|
|
578
594
|
|
|
595
|
+
test('should set defaultQueryMode to research in url', async () => {
|
|
596
|
+
const appEmbed = new AppEmbed(getRootEl(), {
|
|
597
|
+
...defaultViewConfig,
|
|
598
|
+
defaultQueryMode: SpotterQueryMode.RESEARCH,
|
|
599
|
+
} as AppViewConfig);
|
|
600
|
+
appEmbed.render();
|
|
601
|
+
await executeAfterWait(() => {
|
|
602
|
+
expectUrlMatchesWithParams(
|
|
603
|
+
getIFrameSrc(),
|
|
604
|
+
`http://${thoughtSpotHost}/?embedApp=true&profileAndHelpInNavBarHidden=false&defaultQueryMode=research${defaultParamsPost}#/home`,
|
|
605
|
+
);
|
|
606
|
+
});
|
|
607
|
+
});
|
|
608
|
+
|
|
609
|
+
test('should not set defaultQueryMode in url when unset', async () => {
|
|
610
|
+
const appEmbed = new AppEmbed(getRootEl(), {
|
|
611
|
+
...defaultViewConfig,
|
|
612
|
+
} as AppViewConfig);
|
|
613
|
+
appEmbed.render();
|
|
614
|
+
await executeAfterWait(() => {
|
|
615
|
+
expectUrlMatchesWithParams(
|
|
616
|
+
getIFrameSrc(),
|
|
617
|
+
`http://${thoughtSpotHost}/?embedApp=true&profileAndHelpInNavBarHidden=false${defaultParamsPost}#/home`,
|
|
618
|
+
);
|
|
619
|
+
});
|
|
620
|
+
});
|
|
621
|
+
|
|
579
622
|
test('should set hideToolResponseCardBranding to true in url via spotterChatConfig', async () => {
|
|
580
623
|
const appEmbed = new AppEmbed(getRootEl(), {
|
|
581
624
|
...defaultViewConfig,
|
|
@@ -1723,6 +1766,116 @@ describe('App embed tests', () => {
|
|
|
1723
1766
|
'Please call render before invoking this method',
|
|
1724
1767
|
);
|
|
1725
1768
|
});
|
|
1769
|
+
|
|
1770
|
+
describe('overrideHistoryState flag', () => {
|
|
1771
|
+
test('navigateToPage with overrideHistoryState=true should trigger HostEvent.Navigate', async () => {
|
|
1772
|
+
mockMessageChannel();
|
|
1773
|
+
const appEmbed = new AppEmbed(getRootEl(), {
|
|
1774
|
+
frameParams: {
|
|
1775
|
+
width: '100%',
|
|
1776
|
+
height: '100%',
|
|
1777
|
+
},
|
|
1778
|
+
overrideHistoryState: true,
|
|
1779
|
+
});
|
|
1780
|
+
await appEmbed.render();
|
|
1781
|
+
|
|
1782
|
+
const iframe = getIFrameEl();
|
|
1783
|
+
iframe.contentWindow.postMessage = jest.fn();
|
|
1784
|
+
appEmbed.navigateToPage(path, false);
|
|
1785
|
+
|
|
1786
|
+
expect(iframe.contentWindow.postMessage).toHaveBeenCalledWith(
|
|
1787
|
+
expect.objectContaining({
|
|
1788
|
+
type: HostEvent.Navigate,
|
|
1789
|
+
data: path,
|
|
1790
|
+
}),
|
|
1791
|
+
`http://${thoughtSpotHost}`,
|
|
1792
|
+
expect.anything(),
|
|
1793
|
+
);
|
|
1794
|
+
});
|
|
1795
|
+
|
|
1796
|
+
test('navigateToPage with overrideHistoryState=true and path as number should trigger HostEvent.Navigate', async () => {
|
|
1797
|
+
mockMessageChannel();
|
|
1798
|
+
const appEmbed = new AppEmbed(getRootEl(), {
|
|
1799
|
+
frameParams: {
|
|
1800
|
+
width: '100%',
|
|
1801
|
+
height: '100%',
|
|
1802
|
+
},
|
|
1803
|
+
overrideHistoryState: true,
|
|
1804
|
+
});
|
|
1805
|
+
await appEmbed.render();
|
|
1806
|
+
|
|
1807
|
+
const iframe = getIFrameEl();
|
|
1808
|
+
iframe.contentWindow.postMessage = jest.fn();
|
|
1809
|
+
appEmbed.navigateToPage(-1, false);
|
|
1810
|
+
|
|
1811
|
+
expect(iframe.contentWindow.postMessage).toHaveBeenCalledWith(
|
|
1812
|
+
expect.objectContaining({
|
|
1813
|
+
type: HostEvent.Navigate,
|
|
1814
|
+
data: -1,
|
|
1815
|
+
}),
|
|
1816
|
+
`http://${thoughtSpotHost}`,
|
|
1817
|
+
expect.anything(),
|
|
1818
|
+
);
|
|
1819
|
+
});
|
|
1820
|
+
|
|
1821
|
+
test('navigateToPage with overrideHistoryState=false and noReload=false should update iframe src', async () => {
|
|
1822
|
+
const appEmbed = new AppEmbed(getRootEl(), {
|
|
1823
|
+
frameParams: {
|
|
1824
|
+
width: '100%',
|
|
1825
|
+
height: '100%',
|
|
1826
|
+
},
|
|
1827
|
+
overrideHistoryState: false,
|
|
1828
|
+
});
|
|
1829
|
+
await appEmbed.render();
|
|
1830
|
+
appEmbed.navigateToPage(path, false);
|
|
1831
|
+
|
|
1832
|
+
expectUrlMatchesWithParams(
|
|
1833
|
+
getIFrameSrc(),
|
|
1834
|
+
`http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&${defaultParamsForPinboardEmbed}${defaultParamsPost}#/${path}`,
|
|
1835
|
+
);
|
|
1836
|
+
});
|
|
1837
|
+
|
|
1838
|
+
test('navigateToPage with overrideHistoryState=undefined and noReload=false should update iframe src', async () => {
|
|
1839
|
+
const appEmbed = new AppEmbed(getRootEl(), {
|
|
1840
|
+
frameParams: {
|
|
1841
|
+
width: '100%',
|
|
1842
|
+
height: '100%',
|
|
1843
|
+
},
|
|
1844
|
+
});
|
|
1845
|
+
await appEmbed.render();
|
|
1846
|
+
appEmbed.navigateToPage(path, false);
|
|
1847
|
+
|
|
1848
|
+
expectUrlMatchesWithParams(
|
|
1849
|
+
getIFrameSrc(),
|
|
1850
|
+
`http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&${defaultParamsForPinboardEmbed}${defaultParamsPost}#/${path}`,
|
|
1851
|
+
);
|
|
1852
|
+
});
|
|
1853
|
+
|
|
1854
|
+
test('navigateToPage respects noReload priority over overrideHistoryState', async () => {
|
|
1855
|
+
mockMessageChannel();
|
|
1856
|
+
const appEmbed = new AppEmbed(getRootEl(), {
|
|
1857
|
+
frameParams: {
|
|
1858
|
+
width: '100%',
|
|
1859
|
+
height: '100%',
|
|
1860
|
+
},
|
|
1861
|
+
overrideHistoryState: false,
|
|
1862
|
+
});
|
|
1863
|
+
await appEmbed.render();
|
|
1864
|
+
|
|
1865
|
+
const iframe = getIFrameEl();
|
|
1866
|
+
iframe.contentWindow.postMessage = jest.fn();
|
|
1867
|
+
appEmbed.navigateToPage(path, true);
|
|
1868
|
+
|
|
1869
|
+
expect(iframe.contentWindow.postMessage).toHaveBeenCalledWith(
|
|
1870
|
+
expect.objectContaining({
|
|
1871
|
+
type: HostEvent.Navigate,
|
|
1872
|
+
data: path,
|
|
1873
|
+
}),
|
|
1874
|
+
`http://${thoughtSpotHost}`,
|
|
1875
|
+
expect.anything(),
|
|
1876
|
+
);
|
|
1877
|
+
});
|
|
1878
|
+
});
|
|
1726
1879
|
});
|
|
1727
1880
|
|
|
1728
1881
|
describe('LazyLoadingForFullHeight functionality', () => {
|
package/src/embed/app.ts
CHANGED
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
SpotterFileUploadFileTypes,
|
|
23
23
|
} from '../types';
|
|
24
24
|
import { V1Embed } from './ts-embed';
|
|
25
|
-
import { SpotterChatViewConfig, SpotterSidebarViewConfig } from './conversation';
|
|
25
|
+
import { SpotterChatViewConfig, SpotterSidebarViewConfig, SpotterQueryMode } from './conversation';
|
|
26
26
|
import { buildSpotterSidebarAppInitData } from './spotter-utils';
|
|
27
27
|
import { SpotterVizConfig, buildSpotterVizAppInitData } from './spotter-viz-utils';
|
|
28
28
|
|
|
@@ -63,6 +63,10 @@ export enum Page {
|
|
|
63
63
|
* Monitor Alerts Page
|
|
64
64
|
*/
|
|
65
65
|
Monitor = 'monitor',
|
|
66
|
+
/**
|
|
67
|
+
* Collections listing page
|
|
68
|
+
*/
|
|
69
|
+
Collections = 'collections',
|
|
66
70
|
}
|
|
67
71
|
|
|
68
72
|
/**
|
|
@@ -733,6 +737,25 @@ export interface AppViewConfig extends AllEmbedViewConfig {
|
|
|
733
737
|
* ```
|
|
734
738
|
*/
|
|
735
739
|
updatedSpotterChatPrompt?: boolean;
|
|
740
|
+
/**
|
|
741
|
+
* Sets the default query mode when Spotter loads — Fast Search or
|
|
742
|
+
* Research Mode. Applies fresh on every new session for this embed
|
|
743
|
+
* instance only; it does not persist as a user preference and does
|
|
744
|
+
* not affect other embeds or native ThoughtSpot usage.
|
|
745
|
+
* Only applicable when navigating to Spotter within the app.
|
|
746
|
+
*
|
|
747
|
+
* Supported embed types: `AppEmbed`
|
|
748
|
+
* @version SDK: 1.52.0 | ThoughtSpot Cloud: 26.9.0.cl
|
|
749
|
+
* @default SpotterQueryMode.FAST_SEARCH
|
|
750
|
+
* @example
|
|
751
|
+
* ```js
|
|
752
|
+
* const embed = new AppEmbed('#tsEmbed', {
|
|
753
|
+
* ... //other embed view config
|
|
754
|
+
* defaultQueryMode: SpotterQueryMode.RESEARCH,
|
|
755
|
+
* })
|
|
756
|
+
* ```
|
|
757
|
+
*/
|
|
758
|
+
defaultQueryMode?: SpotterQueryMode;
|
|
736
759
|
/**
|
|
737
760
|
* Controls the visibility of the past conversations sidebar.
|
|
738
761
|
*
|
|
@@ -805,6 +828,12 @@ export interface AppViewConfig extends AllEmbedViewConfig {
|
|
|
805
828
|
* { label: 'Tip', text: 'try asking about revenue by region' },
|
|
806
829
|
* { label: 'Tip', text: 'use natural language' },
|
|
807
830
|
* ],
|
|
831
|
+
* // liveboardBrandName, spotterBrandName, insightTileBrandName, insightTileViewPlanLabel and insightTileLoaderText require SDK: 1.52.0 | ThoughtSpot Cloud: 26.9.0.cl
|
|
832
|
+
* liveboardBrandName: 'Reports',
|
|
833
|
+
* spotterBrandName: 'Analyst',
|
|
834
|
+
* insightTileBrandName: 'Insight card',
|
|
835
|
+
* insightTileViewPlanLabel: 'View plan',
|
|
836
|
+
* insightTileLoaderText: 'Generating insight',
|
|
808
837
|
* },
|
|
809
838
|
* })
|
|
810
839
|
* ```
|
|
@@ -986,6 +1015,7 @@ export class AppEmbed extends V1Embed {
|
|
|
986
1015
|
isCentralizedLiveboardFilterUXEnabled = false,
|
|
987
1016
|
isLinkParametersEnabled,
|
|
988
1017
|
updatedSpotterChatPrompt,
|
|
1018
|
+
defaultQueryMode,
|
|
989
1019
|
enableStopAnswerGenerationEmbed,
|
|
990
1020
|
spotterChatConfig,
|
|
991
1021
|
minimumHeight,
|
|
@@ -1025,6 +1055,9 @@ export class AppEmbed extends V1Embed {
|
|
|
1025
1055
|
if (!isUndefined(updatedSpotterChatPrompt)) {
|
|
1026
1056
|
params[Param.UpdatedSpotterChatPrompt] = !!updatedSpotterChatPrompt;
|
|
1027
1057
|
}
|
|
1058
|
+
if (!isUndefined(defaultQueryMode)) {
|
|
1059
|
+
params[Param.DefaultQueryMode] = defaultQueryMode;
|
|
1060
|
+
}
|
|
1028
1061
|
if (!isUndefined(enableStopAnswerGenerationEmbed)) {
|
|
1029
1062
|
params[Param.EnableStopAnswerGenerationEmbed] = !!enableStopAnswerGenerationEmbed;
|
|
1030
1063
|
}
|
|
@@ -1218,6 +1251,12 @@ export class AppEmbed extends V1Embed {
|
|
|
1218
1251
|
|
|
1219
1252
|
if (discoveryExperience.homePage === HomePage.Focused) {
|
|
1220
1253
|
params[Param.HomepageVersion] = HomePage.Focused;
|
|
1254
|
+
// The Focused (V4) homepage experience requires the updated
|
|
1255
|
+
// Spotter chat prompt. Enable it automatically unless the
|
|
1256
|
+
// developer has explicitly set updatedSpotterChatPrompt.
|
|
1257
|
+
if (isUndefined(updatedSpotterChatPrompt)) {
|
|
1258
|
+
params[Param.UpdatedSpotterChatPrompt] = true;
|
|
1259
|
+
}
|
|
1221
1260
|
}
|
|
1222
1261
|
}
|
|
1223
1262
|
|
|
@@ -1326,6 +1365,8 @@ export class AppEmbed extends V1Embed {
|
|
|
1326
1365
|
return modularHomeExperience ? 'home/spotiq-analysis' : 'insights/results';
|
|
1327
1366
|
case Page.Monitor:
|
|
1328
1367
|
return modularHomeExperience ? 'home/monitor-alerts' : 'insights/monitor-alerts';
|
|
1368
|
+
case Page.Collections:
|
|
1369
|
+
return 'collections';
|
|
1329
1370
|
case Page.Home:
|
|
1330
1371
|
default:
|
|
1331
1372
|
return 'home';
|
|
@@ -1366,7 +1407,8 @@ export class AppEmbed extends V1Embed {
|
|
|
1366
1407
|
logger.log('Please call render before invoking this method');
|
|
1367
1408
|
return;
|
|
1368
1409
|
}
|
|
1369
|
-
|
|
1410
|
+
const overrideHistoryState = this.viewConfig?.overrideHistoryState;
|
|
1411
|
+
if (noReload || overrideHistoryState) {
|
|
1370
1412
|
this.trigger(HostEvent.Navigate, path);
|
|
1371
1413
|
} else {
|
|
1372
1414
|
if (typeof path !== 'string') {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SpotterEmbed, SpotterEmbedViewConfig, ConversationEmbed } from './conversation';
|
|
1
|
+
import { SpotterEmbed, SpotterEmbedViewConfig, SpotterQueryMode, ConversationEmbed } from './conversation';
|
|
2
2
|
import { TsEmbed } from './ts-embed';
|
|
3
3
|
import * as authInstance from '../auth';
|
|
4
4
|
import { Action, init } from '../index';
|
|
@@ -460,11 +460,48 @@ describe('ConversationEmbed', () => {
|
|
|
460
460
|
);
|
|
461
461
|
});
|
|
462
462
|
|
|
463
|
+
it('should render the conversation embed with default query mode set to research', async () => {
|
|
464
|
+
const viewConfig: SpotterEmbedViewConfig = {
|
|
465
|
+
worksheetId: 'worksheetId',
|
|
466
|
+
searchOptions: {
|
|
467
|
+
searchQuery: 'searchQuery',
|
|
468
|
+
},
|
|
469
|
+
defaultQueryMode: SpotterQueryMode.RESEARCH,
|
|
470
|
+
};
|
|
471
|
+
const conversationEmbed = new SpotterEmbed(getRootEl(), viewConfig);
|
|
472
|
+
await conversationEmbed.render();
|
|
473
|
+
expectUrlMatchesWithParams(
|
|
474
|
+
getIFrameSrc(),
|
|
475
|
+
`http://${thoughtSpotHost}/v2/?${defaultParams}&isSpotterExperienceEnabled=true&defaultQueryMode=research#/embed/insights/conv-assist?worksheet=worksheetId&query=searchQuery`,
|
|
476
|
+
);
|
|
477
|
+
});
|
|
478
|
+
|
|
479
|
+
it('should render the conversation embed without a default query mode param when unset', async () => {
|
|
480
|
+
const viewConfig: SpotterEmbedViewConfig = {
|
|
481
|
+
worksheetId: 'worksheetId',
|
|
482
|
+
searchOptions: {
|
|
483
|
+
searchQuery: 'searchQuery',
|
|
484
|
+
},
|
|
485
|
+
};
|
|
486
|
+
const conversationEmbed = new SpotterEmbed(getRootEl(), viewConfig);
|
|
487
|
+
await conversationEmbed.render();
|
|
488
|
+
expectUrlMatchesWithParams(
|
|
489
|
+
getIFrameSrc(),
|
|
490
|
+
`http://${thoughtSpotHost}/v2/?${defaultParams}&isSpotterExperienceEnabled=true#/embed/insights/conv-assist?worksheet=worksheetId&query=searchQuery`,
|
|
491
|
+
);
|
|
492
|
+
});
|
|
493
|
+
|
|
463
494
|
describe('spotter chat hiddenActions', () => {
|
|
464
495
|
it.each([
|
|
465
496
|
['SpotterChatConnectorResources', Action.SpotterChatConnectorResources],
|
|
466
497
|
['SpotterChatConnectors', Action.SpotterChatConnectors],
|
|
467
498
|
['SpotterChatModeSwitcher', Action.SpotterChatModeSwitcher],
|
|
499
|
+
['SpotterAnalystShare', Action.SpotterAnalystShare],
|
|
500
|
+
['SpotterAnalystEdit', Action.SpotterAnalystEdit],
|
|
501
|
+
['SpotterAnalystCreate', Action.SpotterAnalystCreate],
|
|
502
|
+
['SpotterAnalystDelete', Action.SpotterAnalystDelete],
|
|
503
|
+
['SpotterAnalystMakeACopy', Action.SpotterAnalystMakeACopy],
|
|
504
|
+
['SpotterAnalystSidebar', Action.SpotterAnalystSidebar],
|
|
468
505
|
])('should render with hiddenActions for %s', async (_, action) => {
|
|
469
506
|
const viewConfig: SpotterEmbedViewConfig = {
|
|
470
507
|
worksheetId: 'worksheetId',
|
|
@@ -503,6 +540,12 @@ describe('ConversationEmbed', () => {
|
|
|
503
540
|
['SpotterChatConnectorResources', Action.SpotterChatConnectorResources],
|
|
504
541
|
['SpotterChatConnectors', Action.SpotterChatConnectors],
|
|
505
542
|
['SpotterChatModeSwitcher', Action.SpotterChatModeSwitcher],
|
|
543
|
+
['SpotterAnalystShare', Action.SpotterAnalystShare],
|
|
544
|
+
['SpotterAnalystEdit', Action.SpotterAnalystEdit],
|
|
545
|
+
['SpotterAnalystCreate', Action.SpotterAnalystCreate],
|
|
546
|
+
['SpotterAnalystDelete', Action.SpotterAnalystDelete],
|
|
547
|
+
['SpotterAnalystMakeACopy', Action.SpotterAnalystMakeACopy],
|
|
548
|
+
['SpotterAnalystSidebar', Action.SpotterAnalystSidebar],
|
|
506
549
|
])('should render with disabledActions for %s', async (_, action) => {
|
|
507
550
|
const disabledReason = 'testing disabled reason';
|
|
508
551
|
const viewConfig: SpotterEmbedViewConfig = {
|
|
@@ -612,6 +655,26 @@ describe('SpotterEmbed APP_INIT embedParams', () => {
|
|
|
612
655
|
expect(response.data.embedParams).toBeUndefined();
|
|
613
656
|
});
|
|
614
657
|
|
|
658
|
+
it('should include spotterAnalystLabel in embedParams.spotterSidebarConfig when set', async () => {
|
|
659
|
+
const response = await getAppInitResponse({
|
|
660
|
+
worksheetId: 'ws1',
|
|
661
|
+
spotterSidebarConfig: {
|
|
662
|
+
spotterAnalystLabel: 'My Analyst',
|
|
663
|
+
},
|
|
664
|
+
});
|
|
665
|
+
expect(response.data.embedParams.spotterSidebarConfig.spotterAnalystLabel).toBe('My Analyst');
|
|
666
|
+
});
|
|
667
|
+
|
|
668
|
+
it('should include spotterAnalystsLabel in embedParams.spotterSidebarConfig when set', async () => {
|
|
669
|
+
const response = await getAppInitResponse({
|
|
670
|
+
worksheetId: 'ws1',
|
|
671
|
+
spotterSidebarConfig: {
|
|
672
|
+
spotterAnalystsLabel: 'My Analysts',
|
|
673
|
+
},
|
|
674
|
+
});
|
|
675
|
+
expect(response.data.embedParams.spotterSidebarConfig.spotterAnalystsLabel).toBe('My Analysts');
|
|
676
|
+
});
|
|
677
|
+
|
|
615
678
|
it('should call handleError and exclude spotterDocumentationUrl from embedParams when URL is invalid', async () => {
|
|
616
679
|
const embed = new SpotterEmbed(getRootEl(), {
|
|
617
680
|
worksheetId: 'ws1',
|
|
@@ -15,6 +15,15 @@ export interface SearchOptions {
|
|
|
15
15
|
searchQuery: string;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
* The query mode Spotter uses when answering a question.
|
|
20
|
+
* @version SDK: 1.52.0 | ThoughtSpot Cloud: 26.9.0.cl
|
|
21
|
+
*/
|
|
22
|
+
export enum SpotterQueryMode {
|
|
23
|
+
FAST_SEARCH = 'fastSearch',
|
|
24
|
+
RESEARCH = 'research',
|
|
25
|
+
}
|
|
26
|
+
|
|
18
27
|
/**
|
|
19
28
|
* Configuration for the Spotter sidebar.
|
|
20
29
|
* Can be used in SpotterEmbed and AppEmbed.
|
|
@@ -89,6 +98,18 @@ export interface SpotterSidebarViewConfig {
|
|
|
89
98
|
* @version SDK: 1.47.0 | ThoughtSpot: 26.4.0.cl
|
|
90
99
|
*/
|
|
91
100
|
spotterNewChatButtonTitle?: string;
|
|
101
|
+
/**
|
|
102
|
+
* Custom label text for the Spotter Analyst section in the sidebar.
|
|
103
|
+
* @version SDK: 1.51.0 | ThoughtSpot: 26.8.0.cl
|
|
104
|
+
* @default Analyst
|
|
105
|
+
*/
|
|
106
|
+
spotterAnalystLabel?: string;
|
|
107
|
+
/**
|
|
108
|
+
* Custom label text for the Spotter Analysts section in the sidebar.
|
|
109
|
+
* @version SDK: 1.51.0 | ThoughtSpot: 26.8.0.cl
|
|
110
|
+
* @default Analysts
|
|
111
|
+
*/
|
|
112
|
+
spotterAnalystsLabel?: string;
|
|
92
113
|
}
|
|
93
114
|
|
|
94
115
|
/**
|
|
@@ -307,6 +328,24 @@ export interface SpotterEmbedViewConfig extends Omit<BaseViewConfig, 'primaryAct
|
|
|
307
328
|
* ```
|
|
308
329
|
*/
|
|
309
330
|
updatedSpotterChatPrompt?: boolean;
|
|
331
|
+
/**
|
|
332
|
+
* Sets the default query mode when Spotter loads — Fast Search or
|
|
333
|
+
* Research Mode. Applies fresh on every new session for this embed
|
|
334
|
+
* instance only; it does not persist as a user preference and does
|
|
335
|
+
* not affect other embeds or native ThoughtSpot usage.
|
|
336
|
+
*
|
|
337
|
+
* Supported embed types: `SpotterEmbed`, `AppEmbed`
|
|
338
|
+
* @version SDK: 1.52.0 | ThoughtSpot Cloud: 26.9.0.cl
|
|
339
|
+
* @default SpotterQueryMode.FAST_SEARCH
|
|
340
|
+
* @example
|
|
341
|
+
* ```js
|
|
342
|
+
* const embed = new SpotterEmbed('#tsEmbed', {
|
|
343
|
+
* ... //other embed view config
|
|
344
|
+
* defaultQueryMode: SpotterQueryMode.RESEARCH,
|
|
345
|
+
* })
|
|
346
|
+
* ```
|
|
347
|
+
*/
|
|
348
|
+
defaultQueryMode?: SpotterQueryMode;
|
|
310
349
|
/**
|
|
311
350
|
* Enables the stop answer generation button in the Spotter embed UI,
|
|
312
351
|
* allowing users to interrupt an ongoing answer generation.
|
|
@@ -444,6 +483,7 @@ export class SpotterEmbed extends TsEmbed {
|
|
|
444
483
|
runtimeParameters,
|
|
445
484
|
excludeRuntimeParametersfromURL,
|
|
446
485
|
updatedSpotterChatPrompt,
|
|
486
|
+
defaultQueryMode,
|
|
447
487
|
enableStopAnswerGenerationEmbed,
|
|
448
488
|
spotterChatConfig,
|
|
449
489
|
} = this.viewConfig;
|
|
@@ -466,6 +506,7 @@ export class SpotterEmbed extends TsEmbed {
|
|
|
466
506
|
setParamIfDefined(queryParams, Param.ShowSpotterLimitations, showSpotterLimitations, true);
|
|
467
507
|
setParamIfDefined(queryParams, Param.HideSampleQuestions, hideSampleQuestions, true);
|
|
468
508
|
setParamIfDefined(queryParams, Param.UpdatedSpotterChatPrompt, updatedSpotterChatPrompt, true);
|
|
509
|
+
setParamIfDefined(queryParams, Param.DefaultQueryMode, defaultQueryMode);
|
|
469
510
|
setParamIfDefined(queryParams, Param.EnableStopAnswerGenerationEmbed, enableStopAnswerGenerationEmbed, true);
|
|
470
511
|
|
|
471
512
|
// Handle spotterChatConfig params
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { getEmbedConfig, setEmbedConfig } from './embedConfig';
|
|
2
|
+
import { storeValueInWindow, resetValueFromWindow } from '../utils';
|
|
3
|
+
|
|
4
|
+
describe('embedConfig', () => {
|
|
5
|
+
beforeEach(() => {
|
|
6
|
+
// Ensure the SDK window namespace exists before resetting individual keys
|
|
7
|
+
storeValueInWindow('embedConfig', undefined);
|
|
8
|
+
resetValueFromWindow('embedConfig');
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
describe('getEmbedConfig', () => {
|
|
12
|
+
test('returns empty object when no config has been set', () => {
|
|
13
|
+
expect(getEmbedConfig()).toEqual({});
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
test('returns the config that was previously set', () => {
|
|
17
|
+
const config: any = {
|
|
18
|
+
thoughtSpotHost: 'https://myhost.thoughtspot.com',
|
|
19
|
+
authType: 'None' as any,
|
|
20
|
+
};
|
|
21
|
+
setEmbedConfig(config);
|
|
22
|
+
expect(getEmbedConfig()).toEqual(config);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
test('returns the full config object including nested properties', () => {
|
|
26
|
+
const config: any = {
|
|
27
|
+
thoughtSpotHost: 'https://myhost.thoughtspot.com',
|
|
28
|
+
authType: 'None' as any,
|
|
29
|
+
customizations: {
|
|
30
|
+
style: {
|
|
31
|
+
customCSS: {
|
|
32
|
+
variables: { '--ts-var-root-background': '#fff' },
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
setEmbedConfig(config);
|
|
38
|
+
expect(getEmbedConfig()).toEqual(config);
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
describe('setEmbedConfig', () => {
|
|
43
|
+
test('stores the config and returns it', () => {
|
|
44
|
+
const config: any = {
|
|
45
|
+
thoughtSpotHost: 'https://myhost.thoughtspot.com',
|
|
46
|
+
authType: 'None' as any,
|
|
47
|
+
};
|
|
48
|
+
const result = setEmbedConfig(config);
|
|
49
|
+
expect(result).toEqual(config);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
test('getEmbedConfig reflects the config after setEmbedConfig', () => {
|
|
53
|
+
const config: any = {
|
|
54
|
+
thoughtSpotHost: 'https://updated.thoughtspot.com',
|
|
55
|
+
authType: 'TrustedAuthToken' as any,
|
|
56
|
+
};
|
|
57
|
+
setEmbedConfig(config);
|
|
58
|
+
expect(getEmbedConfig()).toEqual(config);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
test('overwrites a previously stored config', () => {
|
|
62
|
+
const first: any = { thoughtSpotHost: 'https://first.com', authType: 'None' as any };
|
|
63
|
+
const second: any = { thoughtSpotHost: 'https://second.com', authType: 'TrustedAuthToken' as any };
|
|
64
|
+
setEmbedConfig(first);
|
|
65
|
+
setEmbedConfig(second);
|
|
66
|
+
expect(getEmbedConfig()).toEqual(second);
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
test('handles config with disableFullscreenPresentation flag', () => {
|
|
70
|
+
const config: any = {
|
|
71
|
+
thoughtSpotHost: 'https://myhost.thoughtspot.com',
|
|
72
|
+
authType: 'None' as any,
|
|
73
|
+
disableFullscreenPresentation: true,
|
|
74
|
+
};
|
|
75
|
+
setEmbedConfig(config);
|
|
76
|
+
expect(getEmbedConfig().disableFullscreenPresentation).toBe(true);
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
});
|