@thoughtspot/visual-embed-sdk 1.42.1-alpha.6 → 1.42.1-alpha.7
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 +2 -2
- package/cjs/src/api-intercept.d.ts +1 -1
- package/cjs/src/api-intercept.d.ts.map +1 -1
- package/cjs/src/api-intercept.js +6 -4
- package/cjs/src/api-intercept.js.map +1 -1
- package/cjs/src/embed/ts-embed.spec.js +2 -0
- package/cjs/src/embed/ts-embed.spec.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/react/all-types-export.d.ts +2 -1
- package/cjs/src/react/all-types-export.d.ts.map +1 -1
- package/cjs/src/react/all-types-export.js +2 -3
- package/cjs/src/react/all-types-export.js.map +1 -1
- package/cjs/src/react/all-types-export.spec.js +8 -0
- package/cjs/src/react/all-types-export.spec.js.map +1 -1
- package/cjs/src/react/index.d.ts +2 -1
- package/cjs/src/react/index.d.ts.map +1 -1
- package/cjs/src/react/index.js +1 -2
- package/cjs/src/react/index.js.map +1 -1
- package/dist/index-CqKTa1Fe.js +7447 -0
- package/dist/src/api-intercept.d.ts +1 -1
- package/dist/src/api-intercept.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/react/all-types-export.d.ts +2 -1
- package/dist/src/react/all-types-export.d.ts.map +1 -1
- package/dist/src/react/index.d.ts +2 -1
- package/dist/src/react/index.d.ts.map +1 -1
- package/dist/tsembed-react.es.js +10 -9
- package/dist/tsembed-react.js +9 -8
- package/dist/tsembed.es.js +9 -7
- package/dist/tsembed.js +8 -6
- package/lib/package.json +2 -2
- package/lib/src/api-intercept.d.ts +1 -1
- package/lib/src/api-intercept.d.ts.map +1 -1
- package/lib/src/api-intercept.js +6 -4
- package/lib/src/api-intercept.js.map +1 -1
- package/lib/src/embed/ts-embed.spec.js +2 -0
- package/lib/src/embed/ts-embed.spec.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/react/all-types-export.d.ts +2 -1
- package/lib/src/react/all-types-export.d.ts.map +1 -1
- package/lib/src/react/all-types-export.js +2 -2
- package/lib/src/react/all-types-export.js.map +1 -1
- package/lib/src/react/all-types-export.spec.js +8 -0
- package/lib/src/react/all-types-export.spec.js.map +1 -1
- package/lib/src/react/index.d.ts +2 -1
- package/lib/src/react/index.d.ts.map +1 -1
- package/lib/src/react/index.js +3 -4
- package/lib/src/react/index.js.map +1 -1
- package/package.json +2 -2
- package/src/api-intercept.ts +5 -2
- package/src/embed/ts-embed.spec.ts +2 -0
- package/src/index.ts +2 -3
- package/src/react/all-types-export.spec.ts +9 -1
- package/src/react/all-types-export.ts +10 -7
- package/src/react/index.tsx +155 -130
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/react/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAEnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE3C,OAAO,EAAE,cAAc,IAAI,eAAe,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC7F,OAAO,EAAE,SAAS,IAAI,UAAU,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACxE,OAAO,EAAE,WAAW,IAAI,YAAY,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAChF,OAAO,EAAE,QAAQ,IAAI,SAAS,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,cAAc,IAAI,eAAe,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAE5F,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/react/index.tsx"],"names":[],"mappings":"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O,cAAc,GACrB,OAAO,cAAc,GACrB,OAAO,SAAS,GAChB,OAAO,mBAAmB,GAC1B,OAAO,cAAc,GACrB,OAAO,YAAY,GACnB,OAAO,iBAAiB,CAAC;AAE/B;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,cAAc,KAAK,KAAK,CAAC,gBAAgB,CAC3E,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,CACxB,CAEA;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,OAAO,CAAC,MAAM,EAAE,WAAW,4CAQ1C;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,2BAA2B;yBAgB7C,MAAM;;;;;;;;;;;;;;;;;EAyB3B;AAED,OAAO,EACH,IAAI,EACJ,eAAe,EACf,UAAU,EACV,SAAS,EACT,MAAM,EACN,eAAe,EACf,cAAc,EACd,QAAQ,EACR,cAAc,EACd,eAAe,EACf,qBAAqB,GACxB,MAAM,UAAU,CAAC;AAElB,YAAY,EACR,aAAa,EACb,mBAAmB,EACnB,gBAAgB,EAChB,aAAa,EACb,WAAW,GACd,MAAM,UAAU,CAAC"}
|
package/lib/src/react/index.js
CHANGED
|
@@ -7,9 +7,9 @@ import { SageEmbed as _SageEmbed } from '../embed/sage';
|
|
|
7
7
|
import { SearchEmbed as _SearchEmbed } from '../embed/search';
|
|
8
8
|
import { AppEmbed as _AppEmbed } from '../embed/app';
|
|
9
9
|
import { LiveboardEmbed as _LiveboardEmbed } from '../embed/liveboard';
|
|
10
|
-
import { SpotterAgentEmbed as _SpotterAgentEmbed, ConversationMessage as _ConversationMessage } from '../embed/bodyless-conversation';
|
|
10
|
+
import { SpotterAgentEmbed as _SpotterAgentEmbed, ConversationMessage as _ConversationMessage, } from '../embed/bodyless-conversation';
|
|
11
11
|
import { getViewPropsAndListeners } from './util';
|
|
12
|
-
import { SpotterEmbed as _SpotterEmbed, ConversationEmbed as _ConversationEmbed } from '../embed/conversation';
|
|
12
|
+
import { SpotterEmbed as _SpotterEmbed, ConversationEmbed as _ConversationEmbed, } from '../embed/conversation';
|
|
13
13
|
import { init } from '../embed/base';
|
|
14
14
|
import { ERROR_MESSAGE } from '../errors';
|
|
15
15
|
const componentFactory = (EmbedConstructor,
|
|
@@ -62,7 +62,6 @@ isPreRenderedComponent = false) => React.forwardRef((props, forwardedRef) => {
|
|
|
62
62
|
});
|
|
63
63
|
handleRendering(tsEmbed);
|
|
64
64
|
if (forwardedRef) {
|
|
65
|
-
// eslint-disable-next-line no-param-reassign
|
|
66
65
|
forwardedRef.current = tsEmbed;
|
|
67
66
|
}
|
|
68
67
|
return () => {
|
|
@@ -283,7 +282,7 @@ export const ConversationMessage = componentFactory(_ConversationMessage);
|
|
|
283
282
|
*/
|
|
284
283
|
export const SpotterMessage = React.forwardRef((props, ref) => {
|
|
285
284
|
const { message, query: _, ...otherProps } = props;
|
|
286
|
-
return
|
|
285
|
+
return React.createElement(ConversationMessage, { ref: ref, ...message, ...otherProps });
|
|
287
286
|
});
|
|
288
287
|
/**
|
|
289
288
|
* React component for PreRendered Conversation embed.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/react/index.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,oBAAoB,MAAM,yBAAyB,CAAC;AAE3D,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,cAAc,IAAI,eAAe,EAAuB,MAAM,qBAAqB,CAAC;AAC7F,OAAO,EAAE,SAAS,IAAI,UAAU,EAAkB,MAAM,eAAe,CAAC;AACxE,OAAO,EAAE,WAAW,IAAI,YAAY,EAAoB,MAAM,iBAAiB,CAAC;AAChF,OAAO,EAAE,QAAQ,IAAI,SAAS,EAAiB,MAAM,cAAc,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AAC;IAEb,MAAM,WAAW,GAAG,WAAW,CAC3B,KAAK,EAAE,KAAa,EAAE,EAAE;QACpB,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE;YACrB,OAAO,EAAE,KAAK,EAAE,IAAI,KAAK,CAAC,aAAa,CAAC,6BAA6B,CAAC,EAAE,CAAC;SAC5E;QAED,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;QAE/D,IAAI,MAAM,CAAC,KAAK,EAAE;YACd,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC;SAClC;QAED,OAAO;YACH,KAAK,EAAE,KAAK;YACZ,OAAO,EAAE;gBACL,GAAG,MAAM,CAAC,IAAI;gBACd,WAAW,EAAE,MAAM,CAAC,WAAW;aAClC;SACJ,CAAC;IACN,CAAC,EACD,CAAC,MAAM,CAAC,WAAW,CAAC,CACvB,CAAC;IAEF,OAAO;QACH,WAAW;KACd,CAAC;AACN,CAAC;AAED,OAAO,EACH,IAAI,EACJ,eAAe,EACf,UAAU,EACV,SAAS,EACT,MAAM,EACN,eAAe,EACf,cAAc,EACd,QAAQ,EACR,cAAc,EACd,eAAe,EACf,qBAAqB,GACxB,MAAM,UAAU,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thoughtspot/visual-embed-sdk",
|
|
3
|
-
"version": "1.42.1-alpha.
|
|
3
|
+
"version": "1.42.1-alpha.7",
|
|
4
4
|
"description": "ThoughtSpot Embed SDK",
|
|
5
5
|
"module": "lib/src/index.js",
|
|
6
6
|
"main": "dist/tsembed.js",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"build": "rollup -c",
|
|
54
54
|
"watch": "rollup -cw",
|
|
55
55
|
"docgen": "typedoc --tsconfig tsconfig.build.json --theme typedoc-theme --json static/typedoc/typedoc.json --disableOutputCheck",
|
|
56
|
-
"test-sdk": "jest -c jest.config.sdk.js --runInBand",
|
|
56
|
+
"test-sdk": "NODE_OPTIONS=--max_old_space_size=8192 jest -c jest.config.sdk.js --runInBand --no-cache",
|
|
57
57
|
"test": "npm run test-sdk",
|
|
58
58
|
"posttest": "cat ./coverage/sdk/lcov.info | npx coveralls-next",
|
|
59
59
|
"is-publish-allowed": "node scripts/is-publish-allowed.js",
|
package/src/api-intercept.ts
CHANGED
|
@@ -115,14 +115,17 @@ export const handleInterceptEvent = async (params: { eventData: any, executeEven
|
|
|
115
115
|
|
|
116
116
|
export const processLegacyInterceptResponse = (payload: any) => {
|
|
117
117
|
|
|
118
|
+
const errorText = payload?.data?.errorText || payload?.data?.error?.errorText;
|
|
119
|
+
const errorDescription = payload?.data?.errorDescription || payload?.data?.error?.errorDescription;
|
|
120
|
+
|
|
118
121
|
const payloadToSend = {
|
|
119
122
|
execute: payload?.data?.execute,
|
|
120
123
|
response: {
|
|
121
124
|
body: {
|
|
122
125
|
errors: [
|
|
123
126
|
{
|
|
124
|
-
title:
|
|
125
|
-
|
|
127
|
+
title: errorText,
|
|
128
|
+
description: errorDescription,
|
|
126
129
|
isUserError: true,
|
|
127
130
|
},
|
|
128
131
|
],
|
|
@@ -90,6 +90,7 @@ beforeAll(() => {
|
|
|
90
90
|
const customisations = {
|
|
91
91
|
style: {
|
|
92
92
|
customCSS: {},
|
|
93
|
+
customCSSUrl: undefined as string | undefined,
|
|
93
94
|
},
|
|
94
95
|
content: {},
|
|
95
96
|
};
|
|
@@ -97,6 +98,7 @@ const customisations = {
|
|
|
97
98
|
const customisationsView = {
|
|
98
99
|
style: {
|
|
99
100
|
customCSS: {},
|
|
101
|
+
customCSSUrl: undefined as string | undefined,
|
|
100
102
|
},
|
|
101
103
|
content: {
|
|
102
104
|
strings: {
|
package/src/index.ts
CHANGED
|
@@ -30,10 +30,10 @@ import {
|
|
|
30
30
|
import { PinboardEmbed, LiveboardViewConfig, LiveboardEmbed } from './embed/liveboard';
|
|
31
31
|
import { SearchEmbed, SearchViewConfig } from './embed/search';
|
|
32
32
|
import { SearchBarEmbed, SearchBarViewConfig } from './embed/search-bar';
|
|
33
|
-
import { SpotterAgentEmbed, SpotterAgentEmbedViewConfig, BodylessConversation, BodylessConversationViewConfig} from './embed/bodyless-conversation';
|
|
33
|
+
import { SpotterAgentEmbed, SpotterAgentEmbedViewConfig, BodylessConversation, BodylessConversationViewConfig } from './embed/bodyless-conversation';
|
|
34
34
|
import { SpotterEmbed, SpotterEmbedViewConfig, ConversationEmbed, ConversationViewConfig } from './embed/conversation';
|
|
35
35
|
import {
|
|
36
|
-
AuthFailureType, AuthStatus, AuthEvent,
|
|
36
|
+
AuthFailureType, AuthStatus, AuthEvent,
|
|
37
37
|
} from './auth';
|
|
38
38
|
import { getSessionInfo } from './utils/sessionInfoService';
|
|
39
39
|
import {
|
|
@@ -106,7 +106,6 @@ export {
|
|
|
106
106
|
AuthFailureType,
|
|
107
107
|
AuthStatus,
|
|
108
108
|
AuthEvent,
|
|
109
|
-
AuthEventEmitter,
|
|
110
109
|
AnswerService,
|
|
111
110
|
// types
|
|
112
111
|
SessionInterface,
|
|
@@ -6,6 +6,14 @@ describe('Exports', () => {
|
|
|
6
6
|
});
|
|
7
7
|
|
|
8
8
|
it('should not have undefined exports', () => {
|
|
9
|
-
Object.entries(Exports)
|
|
9
|
+
const undefinedKeys = Object.entries(Exports)
|
|
10
|
+
.filter(([, exportValue]) => !Boolean(exportValue))
|
|
11
|
+
.map(([key]) => key);
|
|
12
|
+
// Helpful log if the expectation fails
|
|
13
|
+
if (undefinedKeys.length) {
|
|
14
|
+
// eslint-disable-next-line no-console
|
|
15
|
+
console.log('Undefined re-exports in all-types-export:', undefinedKeys);
|
|
16
|
+
}
|
|
17
|
+
Object.entries(Exports).forEach(([, exportValue]) => { expect(Boolean(exportValue)).toBe(true); });
|
|
10
18
|
});
|
|
11
19
|
});
|
|
@@ -29,23 +29,29 @@ export {
|
|
|
29
29
|
AuthFailureType,
|
|
30
30
|
AuthStatus,
|
|
31
31
|
AuthEvent,
|
|
32
|
-
|
|
33
|
-
// types
|
|
32
|
+
// value exports
|
|
34
33
|
Page,
|
|
35
34
|
AuthType,
|
|
36
|
-
RuntimeFilter,
|
|
37
35
|
RuntimeFilterOp,
|
|
38
36
|
EmbedEvent,
|
|
39
37
|
HostEvent,
|
|
40
38
|
DataSourceVisualMode,
|
|
41
39
|
Action,
|
|
40
|
+
PrefetchFeatures,
|
|
41
|
+
resetCachedAuthToken,
|
|
42
|
+
DataPanelCustomColumnGroupsAccordionState,
|
|
43
|
+
InterceptedApiType,
|
|
44
|
+
} from '../index';
|
|
45
|
+
|
|
46
|
+
export type {
|
|
47
|
+
// type-only exports
|
|
48
|
+
RuntimeFilter,
|
|
42
49
|
EmbedConfig,
|
|
43
50
|
SearchViewConfig,
|
|
44
51
|
SearchBarViewConfig,
|
|
45
52
|
LiveboardViewConfig,
|
|
46
53
|
SageViewConfig,
|
|
47
54
|
AppViewConfig,
|
|
48
|
-
PrefetchFeatures,
|
|
49
55
|
FrameParams,
|
|
50
56
|
DOMSelector,
|
|
51
57
|
MessageOptions,
|
|
@@ -56,8 +62,5 @@ export {
|
|
|
56
62
|
customCssInterface,
|
|
57
63
|
CustomCssVariables,
|
|
58
64
|
RuntimeParameter,
|
|
59
|
-
resetCachedAuthToken,
|
|
60
65
|
UIPassthroughEvent,
|
|
61
|
-
DataPanelCustomColumnGroupsAccordionState,
|
|
62
|
-
InterceptedApiType,
|
|
63
66
|
} from '../index';
|
package/src/react/index.tsx
CHANGED
|
@@ -10,101 +10,125 @@ import { SearchEmbed as _SearchEmbed, SearchViewConfig } from '../embed/search';
|
|
|
10
10
|
import { AppEmbed as _AppEmbed, AppViewConfig } from '../embed/app';
|
|
11
11
|
import { LiveboardEmbed as _LiveboardEmbed, LiveboardViewConfig } from '../embed/liveboard';
|
|
12
12
|
import { TsEmbed } from '../embed/ts-embed';
|
|
13
|
-
import {
|
|
13
|
+
import {
|
|
14
|
+
SpotterAgentEmbed as _SpotterAgentEmbed,
|
|
15
|
+
SpotterAgentEmbedViewConfig,
|
|
16
|
+
ConversationMessage as _ConversationMessage,
|
|
17
|
+
SpotterAgentMessageViewConfig,
|
|
18
|
+
} from '../embed/bodyless-conversation';
|
|
14
19
|
|
|
15
20
|
import { EmbedConfig, EmbedEvent, AllEmbedViewConfig } from '../types';
|
|
16
21
|
import { EmbedProps, getViewPropsAndListeners } from './util';
|
|
17
|
-
import {
|
|
22
|
+
import {
|
|
23
|
+
SpotterEmbed as _SpotterEmbed,
|
|
24
|
+
SpotterEmbedViewConfig,
|
|
25
|
+
ConversationEmbed as _ConversationEmbed,
|
|
26
|
+
ConversationViewConfig,
|
|
27
|
+
} from '../embed/conversation';
|
|
18
28
|
import { init } from '../embed/base';
|
|
19
29
|
import { ERROR_MESSAGE } from '../errors';
|
|
20
30
|
|
|
21
|
-
const componentFactory = <
|
|
31
|
+
const componentFactory = <
|
|
32
|
+
T extends typeof TsEmbed,
|
|
33
|
+
U extends EmbedProps,
|
|
34
|
+
V extends AllEmbedViewConfig
|
|
35
|
+
>(
|
|
22
36
|
EmbedConstructor: T,
|
|
23
37
|
// isPreRenderedComponent: Specifies whether the component being returned is
|
|
24
38
|
// intended for preRendering. If set to true, the component will call the
|
|
25
39
|
// Embed.preRender() method instead of the usual render method, and it will
|
|
26
40
|
// not be destroyed when the component is unmounted.
|
|
27
41
|
isPreRenderedComponent = false,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
tsEmbed.preRender();
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
const handleDefaultRendering = (tsEmbed: InstanceType<T>) => {
|
|
54
|
-
// if component is connected to a preRendered component
|
|
55
|
-
if (props.preRenderId) {
|
|
56
|
-
tsEmbed.showPreRender();
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
42
|
+
) =>
|
|
43
|
+
React.forwardRef<InstanceType<T>, U>(
|
|
44
|
+
(props: U, forwardedRef: React.MutableRefObject<InstanceType<T>>) => {
|
|
45
|
+
const ref = React.useRef<HTMLDivElement>(null);
|
|
46
|
+
const { className, style, ...embedProps } = props;
|
|
47
|
+
const { viewConfig, listeners } = getViewPropsAndListeners<
|
|
48
|
+
Omit<U, 'className' | 'style'>,
|
|
49
|
+
V
|
|
50
|
+
>(embedProps);
|
|
51
|
+
|
|
52
|
+
const handleDestroy = (tsEmbed: InstanceType<T>) => {
|
|
53
|
+
// do not destroy if it is a preRender component
|
|
54
|
+
if (isPreRenderedComponent) return;
|
|
55
|
+
|
|
56
|
+
// if component is connected to a preRendered component
|
|
57
|
+
if (props.preRenderId) {
|
|
58
|
+
tsEmbed.hidePreRender();
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
tsEmbed.destroy();
|
|
63
|
+
};
|
|
59
64
|
|
|
60
|
-
tsEmbed
|
|
61
|
-
|
|
65
|
+
const handlePreRenderRendering = (tsEmbed: InstanceType<T>) => {
|
|
66
|
+
tsEmbed.preRender();
|
|
67
|
+
};
|
|
62
68
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
};
|
|
69
|
+
const handleDefaultRendering = (tsEmbed: InstanceType<T>) => {
|
|
70
|
+
// if component is connected to a preRendered component
|
|
71
|
+
if (props.preRenderId) {
|
|
72
|
+
tsEmbed.showPreRender();
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
70
75
|
|
|
71
|
-
|
|
72
|
-
const tsEmbed = new EmbedConstructor(
|
|
73
|
-
ref!.current,
|
|
74
|
-
deepMerge(
|
|
75
|
-
{
|
|
76
|
-
insertAsSibling: viewConfig.insertAsSibling,
|
|
77
|
-
frameParams: {
|
|
78
|
-
class: viewConfig.insertAsSibling ? className || '' : '',
|
|
79
|
-
},
|
|
80
|
-
},
|
|
81
|
-
viewConfig,
|
|
82
|
-
),
|
|
83
|
-
) as InstanceType<T>;
|
|
84
|
-
Object.keys(listeners).forEach((eventName) => {
|
|
85
|
-
tsEmbed.on(eventName as EmbedEvent, listeners[eventName as EmbedEvent]);
|
|
86
|
-
});
|
|
87
|
-
handleRendering(tsEmbed);
|
|
88
|
-
if (forwardedRef) {
|
|
89
|
-
// eslint-disable-next-line no-param-reassign
|
|
90
|
-
forwardedRef.current = tsEmbed;
|
|
91
|
-
}
|
|
92
|
-
return () => {
|
|
93
|
-
handleDestroy(tsEmbed);
|
|
76
|
+
tsEmbed.render();
|
|
94
77
|
};
|
|
95
|
-
}, [viewConfig, listeners]);
|
|
96
78
|
|
|
97
|
-
|
|
79
|
+
const handleRendering = (tsEmbed: InstanceType<T>) => {
|
|
80
|
+
if (isPreRenderedComponent) {
|
|
81
|
+
handlePreRenderRendering(tsEmbed);
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
handleDefaultRendering(tsEmbed);
|
|
85
|
+
};
|
|
98
86
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
87
|
+
useDeepCompareEffect(() => {
|
|
88
|
+
const tsEmbed = new EmbedConstructor(
|
|
89
|
+
ref!.current,
|
|
90
|
+
deepMerge(
|
|
91
|
+
{
|
|
92
|
+
insertAsSibling: viewConfig.insertAsSibling,
|
|
93
|
+
frameParams: {
|
|
94
|
+
class: viewConfig.insertAsSibling ? className || '' : '',
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
viewConfig,
|
|
98
|
+
),
|
|
99
|
+
) as InstanceType<T>;
|
|
100
|
+
Object.keys(listeners).forEach((eventName) => {
|
|
101
|
+
tsEmbed.on(eventName as EmbedEvent, listeners[eventName as EmbedEvent]);
|
|
102
|
+
});
|
|
103
|
+
handleRendering(tsEmbed);
|
|
104
|
+
if (forwardedRef) {
|
|
105
|
+
forwardedRef.current = tsEmbed;
|
|
106
|
+
}
|
|
107
|
+
return () => {
|
|
108
|
+
handleDestroy(tsEmbed);
|
|
109
|
+
};
|
|
110
|
+
}, [viewConfig, listeners]);
|
|
111
|
+
|
|
112
|
+
const preRenderStyles = isPreRenderedComponent ? { display: 'none' } : {};
|
|
113
|
+
|
|
114
|
+
return viewConfig.insertAsSibling ? (
|
|
115
|
+
<span
|
|
116
|
+
data-testid="tsEmbed"
|
|
117
|
+
ref={ref}
|
|
118
|
+
style={{ position: 'absolute', ...preRenderStyles }}
|
|
119
|
+
></span>
|
|
120
|
+
) : (
|
|
121
|
+
<div
|
|
122
|
+
data-testid="tsEmbed"
|
|
123
|
+
ref={ref}
|
|
124
|
+
style={{ ...style, ...preRenderStyles }}
|
|
125
|
+
className={`ts-embed-container ${className}`}
|
|
126
|
+
></div>
|
|
127
|
+
);
|
|
128
|
+
},
|
|
129
|
+
);
|
|
106
130
|
|
|
107
|
-
interface SearchProps extends EmbedProps, SearchViewConfig {
|
|
131
|
+
interface SearchProps extends EmbedProps, SearchViewConfig {}
|
|
108
132
|
|
|
109
133
|
interface PreRenderProps {
|
|
110
134
|
/**
|
|
@@ -158,7 +182,7 @@ export const PreRenderedSearchEmbed = componentFactory<
|
|
|
158
182
|
SearchViewConfig
|
|
159
183
|
>(_SearchEmbed, true);
|
|
160
184
|
|
|
161
|
-
interface AppProps extends EmbedProps, AppViewConfig {
|
|
185
|
+
interface AppProps extends EmbedProps, AppViewConfig {}
|
|
162
186
|
|
|
163
187
|
/**
|
|
164
188
|
* React component for Full app Embed.
|
|
@@ -199,7 +223,7 @@ export const PreRenderedAppEmbed = componentFactory<
|
|
|
199
223
|
AppViewConfig
|
|
200
224
|
>(_AppEmbed, true);
|
|
201
225
|
|
|
202
|
-
interface LiveboardProps extends EmbedProps, LiveboardViewConfig {
|
|
226
|
+
interface LiveboardProps extends EmbedProps, LiveboardViewConfig {}
|
|
203
227
|
|
|
204
228
|
/**
|
|
205
229
|
* React component for Liveboard embed.
|
|
@@ -252,7 +276,7 @@ export const PreRenderedLiveboardEmbed = componentFactory<
|
|
|
252
276
|
|
|
253
277
|
export const PreRenderedPinboardEmbed = PreRenderedLiveboardEmbed;
|
|
254
278
|
|
|
255
|
-
interface SearchBarEmbedProps extends EmbedProps, SearchBarViewConfig {
|
|
279
|
+
interface SearchBarEmbedProps extends EmbedProps, SearchBarViewConfig {}
|
|
256
280
|
|
|
257
281
|
/**
|
|
258
282
|
* React component for Search bar embed.
|
|
@@ -296,7 +320,7 @@ export const PreRenderedSearchBarEmbed = componentFactory<
|
|
|
296
320
|
SearchBarViewConfig
|
|
297
321
|
>(_SearchBarEmbed, true);
|
|
298
322
|
|
|
299
|
-
interface SageEmbedProps extends EmbedProps, SageViewConfig {
|
|
323
|
+
interface SageEmbedProps extends EmbedProps, SageViewConfig {}
|
|
300
324
|
|
|
301
325
|
/**
|
|
302
326
|
* React component for LLM based search Sage embed.
|
|
@@ -338,8 +362,8 @@ export const PreRenderedSageEmbed = componentFactory<
|
|
|
338
362
|
SageViewConfig
|
|
339
363
|
>(_SageEmbed, true);
|
|
340
364
|
|
|
341
|
-
interface SpotterEmbedProps extends EmbedProps, SpotterEmbedViewConfig {
|
|
342
|
-
interface ConversationEmbedProps extends EmbedProps, ConversationViewConfig {
|
|
365
|
+
interface SpotterEmbedProps extends EmbedProps, SpotterEmbedViewConfig {}
|
|
366
|
+
interface ConversationEmbedProps extends EmbedProps, ConversationViewConfig {}
|
|
343
367
|
|
|
344
368
|
/**
|
|
345
369
|
* React component for LLM based conversation BI.
|
|
@@ -362,7 +386,6 @@ export const SpotterEmbed = componentFactory<
|
|
|
362
386
|
SpotterEmbedViewConfig
|
|
363
387
|
>(_SpotterEmbed);
|
|
364
388
|
|
|
365
|
-
|
|
366
389
|
/**
|
|
367
390
|
* React component for LLM based conversation BI.
|
|
368
391
|
* @deprecated from SDK: 1.39.0 | ThoughtSpot: 10.10.0.cl
|
|
@@ -402,27 +425,27 @@ export const ConversationMessage = componentFactory<
|
|
|
402
425
|
type SpotterMessageProps = {
|
|
403
426
|
message: SpotterAgentMessageViewConfig;
|
|
404
427
|
query?: string;
|
|
405
|
-
|
|
428
|
+
} & Omit<EmbedProps, keyof SpotterAgentMessageViewConfig>;
|
|
406
429
|
|
|
407
430
|
/**
|
|
408
431
|
* React component for displaying individual conversation messages from SpotterAgent.
|
|
409
|
-
*
|
|
432
|
+
*
|
|
410
433
|
* This component renders a single message response from your ThoughtSpot conversation,
|
|
411
434
|
* showing charts, visualizations, or text responses based on the user's query.
|
|
412
|
-
*
|
|
435
|
+
*
|
|
413
436
|
* @example
|
|
414
437
|
* ```tsx
|
|
415
438
|
* const { sendMessage } = useSpotterAgent({ worksheetId: 'worksheetId' });
|
|
416
439
|
* const result = await sendMessage('show me sales by region');
|
|
417
|
-
*
|
|
440
|
+
*
|
|
418
441
|
* if (!result.error) {
|
|
419
442
|
* // Simple usage - just pass the message data
|
|
420
443
|
* <SpotterMessage message={result.message} />
|
|
421
|
-
*
|
|
444
|
+
*
|
|
422
445
|
* // With optional query for context
|
|
423
|
-
* <SpotterMessage
|
|
424
|
-
* message={result.message}
|
|
425
|
-
* query={result.query}
|
|
446
|
+
* <SpotterMessage
|
|
447
|
+
* message={result.message}
|
|
448
|
+
* query={result.query}
|
|
426
449
|
* />
|
|
427
450
|
* }
|
|
428
451
|
* ```
|
|
@@ -433,14 +456,8 @@ export const SpotterMessage = React.forwardRef<
|
|
|
433
456
|
SpotterMessageProps
|
|
434
457
|
>((props, ref) => {
|
|
435
458
|
const { message, query: _, ...otherProps } = props;
|
|
436
|
-
|
|
437
|
-
return
|
|
438
|
-
<ConversationMessage
|
|
439
|
-
ref={ref}
|
|
440
|
-
{...message}
|
|
441
|
-
{...otherProps}
|
|
442
|
-
/>
|
|
443
|
-
);
|
|
459
|
+
|
|
460
|
+
return <ConversationMessage ref={ref} {...message} {...otherProps} />;
|
|
444
461
|
});
|
|
445
462
|
|
|
446
463
|
/**
|
|
@@ -467,7 +484,8 @@ export const PreRenderedConversationEmbed = componentFactory<
|
|
|
467
484
|
SpotterEmbedViewConfig
|
|
468
485
|
>(_SpotterEmbed, true);
|
|
469
486
|
|
|
470
|
-
type EmbedComponent =
|
|
487
|
+
type EmbedComponent =
|
|
488
|
+
| typeof SearchEmbed
|
|
471
489
|
| typeof AppEmbed
|
|
472
490
|
| typeof LiveboardEmbed
|
|
473
491
|
| typeof SearchBarEmbed
|
|
@@ -493,8 +511,9 @@ type EmbedComponent = typeof SearchEmbed
|
|
|
493
511
|
* ```
|
|
494
512
|
* @returns {React.MutableRefObject<T extends TsEmbed>} ref
|
|
495
513
|
*/
|
|
496
|
-
export function useEmbedRef<T extends EmbedComponent>():
|
|
497
|
-
React.
|
|
514
|
+
export function useEmbedRef<T extends EmbedComponent>(): React.MutableRefObject<
|
|
515
|
+
React.ComponentRef<T>
|
|
516
|
+
> {
|
|
498
517
|
return React.useRef<React.ComponentRef<T>>(null);
|
|
499
518
|
}
|
|
500
519
|
|
|
@@ -523,19 +542,19 @@ export function useInit(config: EmbedConfig) {
|
|
|
523
542
|
|
|
524
543
|
/**
|
|
525
544
|
* React hook for interacting with SpotterAgent AI conversations.
|
|
526
|
-
*
|
|
545
|
+
*
|
|
527
546
|
* This hook provides a sendMessage function that allows you to send natural language
|
|
528
547
|
* queries to your data and get back AI-generated responses with visualizations.
|
|
529
|
-
*
|
|
548
|
+
*
|
|
530
549
|
* @param config - Configuration object containing worksheetId and other options
|
|
531
550
|
* @returns Object with sendMessage function that returns conversation results
|
|
532
551
|
* @example
|
|
533
552
|
* ```tsx
|
|
534
553
|
* const { sendMessage } = useSpotterAgent({ worksheetId: 'worksheetId' });
|
|
535
|
-
*
|
|
554
|
+
*
|
|
536
555
|
* const handleQuery = async () => {
|
|
537
556
|
* const result = await sendMessage('show me sales by region');
|
|
538
|
-
*
|
|
557
|
+
*
|
|
539
558
|
* if (!result.error) {
|
|
540
559
|
* // Display the message response
|
|
541
560
|
* <SpotterMessage message={result.message} />
|
|
@@ -548,38 +567,41 @@ export function useInit(config: EmbedConfig) {
|
|
|
548
567
|
*/
|
|
549
568
|
export function useSpotterAgent(config: SpotterAgentEmbedViewConfig) {
|
|
550
569
|
const serviceRef = useRef<_SpotterAgentEmbed | null>(null);
|
|
551
|
-
|
|
570
|
+
|
|
552
571
|
useDeepCompareEffect(() => {
|
|
553
572
|
if (serviceRef.current) {
|
|
554
573
|
serviceRef.current = null;
|
|
555
574
|
}
|
|
556
|
-
|
|
575
|
+
|
|
557
576
|
serviceRef.current = new _SpotterAgentEmbed(config);
|
|
558
|
-
|
|
577
|
+
|
|
559
578
|
return () => {
|
|
560
579
|
serviceRef.current = null;
|
|
561
580
|
};
|
|
562
581
|
}, [config]);
|
|
563
582
|
|
|
564
|
-
const sendMessage = useCallback(
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
583
|
+
const sendMessage = useCallback(
|
|
584
|
+
async (query: string) => {
|
|
585
|
+
if (!serviceRef.current) {
|
|
586
|
+
return { error: new Error(ERROR_MESSAGE.SPOTTER_AGENT_NOT_INITIALIZED) };
|
|
587
|
+
}
|
|
568
588
|
|
|
569
|
-
|
|
589
|
+
const result = await serviceRef.current.sendMessageData(query);
|
|
570
590
|
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
591
|
+
if (result.error) {
|
|
592
|
+
return { error: result.error };
|
|
593
|
+
}
|
|
574
594
|
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
595
|
+
return {
|
|
596
|
+
query: query,
|
|
597
|
+
message: {
|
|
598
|
+
...result.data,
|
|
599
|
+
worksheetId: config.worksheetId,
|
|
600
|
+
},
|
|
601
|
+
};
|
|
602
|
+
},
|
|
603
|
+
[config.worksheetId],
|
|
604
|
+
);
|
|
583
605
|
|
|
584
606
|
return {
|
|
585
607
|
sendMessage,
|
|
@@ -587,16 +609,11 @@ export function useSpotterAgent(config: SpotterAgentEmbedViewConfig) {
|
|
|
587
609
|
}
|
|
588
610
|
|
|
589
611
|
export {
|
|
590
|
-
LiveboardViewConfig,
|
|
591
|
-
SearchViewConfig,
|
|
592
|
-
AppViewConfig,
|
|
593
612
|
Page,
|
|
594
|
-
RuntimeFilter,
|
|
595
613
|
RuntimeFilterOp,
|
|
596
614
|
EmbedEvent,
|
|
597
615
|
HostEvent,
|
|
598
616
|
Action,
|
|
599
|
-
FrameParams,
|
|
600
617
|
HomeLeftNavItem,
|
|
601
618
|
HomepageModule,
|
|
602
619
|
LogLevel,
|
|
@@ -604,3 +621,11 @@ export {
|
|
|
604
621
|
ListPageColumns,
|
|
605
622
|
CustomActionsPosition,
|
|
606
623
|
} from '../index';
|
|
624
|
+
|
|
625
|
+
export type {
|
|
626
|
+
RuntimeFilter,
|
|
627
|
+
LiveboardViewConfig,
|
|
628
|
+
SearchViewConfig,
|
|
629
|
+
AppViewConfig,
|
|
630
|
+
FrameParams,
|
|
631
|
+
} from '../index';
|