@thoughtspot/visual-embed-sdk 1.49.2 → 1.50.0
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 -10
- package/cjs/src/authToken.spec.js +5 -0
- package/cjs/src/authToken.spec.js.map +1 -1
- package/cjs/src/embed/app.d.ts +7 -1
- package/cjs/src/embed/app.d.ts.map +1 -1
- package/cjs/src/embed/app.js +6 -0
- package/cjs/src/embed/app.js.map +1 -1
- package/cjs/src/embed/app.spec.js +11 -2
- package/cjs/src/embed/app.spec.js.map +1 -1
- package/cjs/src/embed/conversation.d.ts +12 -0
- package/cjs/src/embed/conversation.d.ts.map +1 -1
- package/cjs/src/embed/conversation.js.map +1 -1
- package/cjs/src/embed/conversation.spec.js +30 -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/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 +1219 -0
- package/cjs/src/embed/host-events.spec.js.map +1 -0
- 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 +29 -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/index.d.ts +2 -2
- package/cjs/src/index.d.ts.map +1 -1
- 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/types.d.ts +93 -6
- package/cjs/src/types.d.ts.map +1 -1
- package/cjs/src/types.js +88 -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/graphql/answerService/answerService.spec.js +15 -0
- package/cjs/src/utils/graphql/answerService/answerService.spec.js.map +1 -1
- package/cjs/src/utils/processData.spec.js +30 -0
- package/cjs/src/utils/processData.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.js +2 -3
- package/cjs/src/utils.js.map +1 -1
- package/cjs/src/utils.spec.js +158 -0
- package/cjs/src/utils.spec.js.map +1 -1
- package/dist/{index-CS7yJ2Jj.js → index-B5xoN6Cp.js} +303 -187
- package/dist/src/embed/app.d.ts +7 -1
- package/dist/src/embed/app.d.ts.map +1 -1
- package/dist/src/embed/conversation.d.ts +12 -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/liveboard.d.ts +6 -0
- package/dist/src/embed/liveboard.d.ts.map +1 -1
- package/dist/src/embed/spotter-viz-utils.d.ts +29 -0
- package/dist/src/embed/spotter-viz-utils.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 +93 -6
- 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 +126 -18
- package/dist/tsembed-react.js +427 -203
- package/dist/tsembed.es.js +126 -18
- package/dist/tsembed.js +427 -203
- package/dist/visual-embed-sdk-react-full.d.ts +147 -7
- package/dist/visual-embed-sdk-react.d.ts +147 -7
- package/dist/visual-embed-sdk.d.ts +147 -7
- package/lib/package.json +4 -10
- package/lib/src/authToken.spec.js +5 -0
- package/lib/src/authToken.spec.js.map +1 -1
- package/lib/src/embed/app.d.ts +7 -1
- package/lib/src/embed/app.d.ts.map +1 -1
- package/lib/src/embed/app.js +6 -0
- package/lib/src/embed/app.js.map +1 -1
- package/lib/src/embed/app.spec.js +11 -2
- package/lib/src/embed/app.spec.js.map +1 -1
- package/lib/src/embed/conversation.d.ts +12 -0
- package/lib/src/embed/conversation.d.ts.map +1 -1
- package/lib/src/embed/conversation.js.map +1 -1
- package/lib/src/embed/conversation.spec.js +30 -0
- 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/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 +1216 -0
- package/lib/src/embed/host-events.spec.js.map +1 -0
- 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 +29 -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/index.d.ts +2 -2
- package/lib/src/index.d.ts.map +1 -1
- 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/types.d.ts +93 -6
- package/lib/src/types.d.ts.map +1 -1
- package/lib/src/types.js +88 -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/graphql/answerService/answerService.spec.js +15 -0
- package/lib/src/utils/graphql/answerService/answerService.spec.js.map +1 -1
- package/lib/src/utils/processData.spec.js +30 -0
- package/lib/src/utils/processData.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.js +1 -1
- package/lib/src/utils.js.map +1 -1
- 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 +147 -7
- package/package.json +4 -10
- package/src/authToken.spec.ts +6 -0
- package/src/embed/app.spec.ts +15 -2
- package/src/embed/app.ts +13 -1
- package/src/embed/conversation.spec.ts +32 -0
- package/src/embed/conversation.ts +12 -0
- package/src/embed/embedConfig.spec.ts +79 -0
- package/src/embed/host-events.spec.ts +1635 -0
- package/src/embed/liveboard.ts +6 -0
- package/src/embed/spotter-viz-utils.ts +30 -0
- package/src/index.ts +2 -1
- package/src/mixpanel-service.spec.ts +15 -0
- package/src/types.ts +96 -6
- package/src/utils/custom-actions.spec.ts +28 -0
- package/src/utils/graphql/answerService/answerService.spec.ts +18 -0
- package/src/utils/processData.spec.ts +32 -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/utils.ts +1 -1
package/src/embed/app.spec.ts
CHANGED
|
@@ -522,7 +522,7 @@ describe('App embed tests', () => {
|
|
|
522
522
|
});
|
|
523
523
|
});
|
|
524
524
|
|
|
525
|
-
test('Should add homepageVersion=v4 when homePage is Focused to the iframe src', async () => {
|
|
525
|
+
test('Should add homepageVersion=v4 and updatedSpotterChatPrompt=true when homePage is Focused to the iframe src', async () => {
|
|
526
526
|
await testUrlParams(
|
|
527
527
|
{
|
|
528
528
|
...defaultViewConfig,
|
|
@@ -530,7 +530,20 @@ describe('App embed tests', () => {
|
|
|
530
530
|
homePage: HomePage.Focused,
|
|
531
531
|
},
|
|
532
532
|
} as AppViewConfig,
|
|
533
|
-
`http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&modularHomeExperience=false&navigationVersion=v2&homepageVersion=v4${defaultParams}${defaultParamsPost}#/home`,
|
|
533
|
+
`http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&modularHomeExperience=false&navigationVersion=v2&homepageVersion=v4&updatedSpotterChatPrompt=true${defaultParams}${defaultParamsPost}#/home`,
|
|
534
|
+
);
|
|
535
|
+
});
|
|
536
|
+
|
|
537
|
+
test('Should respect explicit updatedSpotterChatPrompt=false even when homePage is Focused', async () => {
|
|
538
|
+
await testUrlParams(
|
|
539
|
+
{
|
|
540
|
+
...defaultViewConfig,
|
|
541
|
+
discoveryExperience: {
|
|
542
|
+
homePage: HomePage.Focused,
|
|
543
|
+
},
|
|
544
|
+
updatedSpotterChatPrompt: false,
|
|
545
|
+
} as AppViewConfig,
|
|
546
|
+
`http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&modularHomeExperience=false&navigationVersion=v2&homepageVersion=v4&updatedSpotterChatPrompt=false${defaultParams}${defaultParamsPost}#/home`,
|
|
534
547
|
);
|
|
535
548
|
});
|
|
536
549
|
|
package/src/embed/app.ts
CHANGED
|
@@ -798,7 +798,13 @@ export interface AppViewConfig extends AllEmbedViewConfig {
|
|
|
798
798
|
* description: 'Ask questions about your data',
|
|
799
799
|
* inputChatPlaceholder: 'Ask a question...',
|
|
800
800
|
* hideStarterPrompts: false,
|
|
801
|
-
* customStarterPrompts: [{ id: '1', displayText: 'Top products', fullPrompt: 'What are the top products by revenue?' }]
|
|
801
|
+
* customStarterPrompts: [{ id: '1', displayText: 'Top products', fullPrompt: 'What are the top products by revenue?' }],
|
|
802
|
+
* // loaderHeadline and loaderTips require SDK: 1.51.0 | ThoughtSpot Cloud: 26.8.0.cl
|
|
803
|
+
* loaderHeadline: 'Crunching the numbers...',
|
|
804
|
+
* loaderTips: [
|
|
805
|
+
* { label: 'Tip', text: 'try asking about revenue by region' },
|
|
806
|
+
* { label: 'Tip', text: 'use natural language' },
|
|
807
|
+
* ],
|
|
802
808
|
* },
|
|
803
809
|
* })
|
|
804
810
|
* ```
|
|
@@ -1212,6 +1218,12 @@ export class AppEmbed extends V1Embed {
|
|
|
1212
1218
|
|
|
1213
1219
|
if (discoveryExperience.homePage === HomePage.Focused) {
|
|
1214
1220
|
params[Param.HomepageVersion] = HomePage.Focused;
|
|
1221
|
+
// The Focused (V4) homepage experience requires the updated
|
|
1222
|
+
// Spotter chat prompt. Enable it automatically unless the
|
|
1223
|
+
// developer has explicitly set updatedSpotterChatPrompt.
|
|
1224
|
+
if (isUndefined(updatedSpotterChatPrompt)) {
|
|
1225
|
+
params[Param.UpdatedSpotterChatPrompt] = true;
|
|
1226
|
+
}
|
|
1215
1227
|
}
|
|
1216
1228
|
}
|
|
1217
1229
|
|
|
@@ -465,6 +465,12 @@ describe('ConversationEmbed', () => {
|
|
|
465
465
|
['SpotterChatConnectorResources', Action.SpotterChatConnectorResources],
|
|
466
466
|
['SpotterChatConnectors', Action.SpotterChatConnectors],
|
|
467
467
|
['SpotterChatModeSwitcher', Action.SpotterChatModeSwitcher],
|
|
468
|
+
['SpotterAnalystShare', Action.SpotterAnalystShare],
|
|
469
|
+
['SpotterAnalystEdit', Action.SpotterAnalystEdit],
|
|
470
|
+
['SpotterAnalystCreate', Action.SpotterAnalystCreate],
|
|
471
|
+
['SpotterAnalystDelete', Action.SpotterAnalystDelete],
|
|
472
|
+
['SpotterAnalystMakeACopy', Action.SpotterAnalystMakeACopy],
|
|
473
|
+
['SpotterAnalystSidebar', Action.SpotterAnalystSidebar],
|
|
468
474
|
])('should render with hiddenActions for %s', async (_, action) => {
|
|
469
475
|
const viewConfig: SpotterEmbedViewConfig = {
|
|
470
476
|
worksheetId: 'worksheetId',
|
|
@@ -503,6 +509,12 @@ describe('ConversationEmbed', () => {
|
|
|
503
509
|
['SpotterChatConnectorResources', Action.SpotterChatConnectorResources],
|
|
504
510
|
['SpotterChatConnectors', Action.SpotterChatConnectors],
|
|
505
511
|
['SpotterChatModeSwitcher', Action.SpotterChatModeSwitcher],
|
|
512
|
+
['SpotterAnalystShare', Action.SpotterAnalystShare],
|
|
513
|
+
['SpotterAnalystEdit', Action.SpotterAnalystEdit],
|
|
514
|
+
['SpotterAnalystCreate', Action.SpotterAnalystCreate],
|
|
515
|
+
['SpotterAnalystDelete', Action.SpotterAnalystDelete],
|
|
516
|
+
['SpotterAnalystMakeACopy', Action.SpotterAnalystMakeACopy],
|
|
517
|
+
['SpotterAnalystSidebar', Action.SpotterAnalystSidebar],
|
|
506
518
|
])('should render with disabledActions for %s', async (_, action) => {
|
|
507
519
|
const disabledReason = 'testing disabled reason';
|
|
508
520
|
const viewConfig: SpotterEmbedViewConfig = {
|
|
@@ -612,6 +624,26 @@ describe('SpotterEmbed APP_INIT embedParams', () => {
|
|
|
612
624
|
expect(response.data.embedParams).toBeUndefined();
|
|
613
625
|
});
|
|
614
626
|
|
|
627
|
+
it('should include spotterAnalystLabel in embedParams.spotterSidebarConfig when set', async () => {
|
|
628
|
+
const response = await getAppInitResponse({
|
|
629
|
+
worksheetId: 'ws1',
|
|
630
|
+
spotterSidebarConfig: {
|
|
631
|
+
spotterAnalystLabel: 'My Analyst',
|
|
632
|
+
},
|
|
633
|
+
});
|
|
634
|
+
expect(response.data.embedParams.spotterSidebarConfig.spotterAnalystLabel).toBe('My Analyst');
|
|
635
|
+
});
|
|
636
|
+
|
|
637
|
+
it('should include spotterAnalystsLabel in embedParams.spotterSidebarConfig when set', async () => {
|
|
638
|
+
const response = await getAppInitResponse({
|
|
639
|
+
worksheetId: 'ws1',
|
|
640
|
+
spotterSidebarConfig: {
|
|
641
|
+
spotterAnalystsLabel: 'My Analysts',
|
|
642
|
+
},
|
|
643
|
+
});
|
|
644
|
+
expect(response.data.embedParams.spotterSidebarConfig.spotterAnalystsLabel).toBe('My Analysts');
|
|
645
|
+
});
|
|
646
|
+
|
|
615
647
|
it('should call handleError and exclude spotterDocumentationUrl from embedParams when URL is invalid', async () => {
|
|
616
648
|
const embed = new SpotterEmbed(getRootEl(), {
|
|
617
649
|
worksheetId: 'ws1',
|
|
@@ -89,6 +89,18 @@ export interface SpotterSidebarViewConfig {
|
|
|
89
89
|
* @version SDK: 1.47.0 | ThoughtSpot: 26.4.0.cl
|
|
90
90
|
*/
|
|
91
91
|
spotterNewChatButtonTitle?: string;
|
|
92
|
+
/**
|
|
93
|
+
* Custom label text for the Spotter Analyst section in the sidebar.
|
|
94
|
+
* @version SDK: 1.51.0 | ThoughtSpot: 26.8.0.cl
|
|
95
|
+
* @default Analyst
|
|
96
|
+
*/
|
|
97
|
+
spotterAnalystLabel?: string;
|
|
98
|
+
/**
|
|
99
|
+
* Custom label text for the Spotter Analysts section in the sidebar.
|
|
100
|
+
* @version SDK: 1.51.0 | ThoughtSpot: 26.8.0.cl
|
|
101
|
+
* @default Analysts
|
|
102
|
+
*/
|
|
103
|
+
spotterAnalystsLabel?: string;
|
|
92
104
|
}
|
|
93
105
|
|
|
94
106
|
/**
|
|
@@ -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
|
+
});
|