@thoughtspot/visual-embed-sdk 1.42.3 → 1.43.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/api-intercept.d.ts +51 -0
- package/cjs/src/api-intercept.d.ts.map +1 -0
- package/cjs/src/api-intercept.js +180 -0
- package/cjs/src/api-intercept.js.map +1 -0
- package/cjs/src/api-intercept.spec.d.ts +2 -0
- package/cjs/src/api-intercept.spec.d.ts.map +1 -0
- package/cjs/src/api-intercept.spec.js +672 -0
- package/cjs/src/api-intercept.spec.js.map +1 -0
- package/cjs/src/css-variables.d.ts +4 -0
- package/cjs/src/css-variables.d.ts.map +1 -1
- package/cjs/src/embed/app.d.ts +0 -5
- package/cjs/src/embed/app.d.ts.map +1 -1
- package/cjs/src/embed/app.js +4 -5
- package/cjs/src/embed/app.js.map +1 -1
- package/cjs/src/embed/app.spec.js +10 -0
- package/cjs/src/embed/app.spec.js.map +1 -1
- package/cjs/src/embed/conversation.d.ts +2 -2
- package/cjs/src/embed/conversation.js +1 -1
- package/cjs/src/embed/conversation.js.map +1 -1
- package/cjs/src/embed/conversation.spec.js +17 -0
- package/cjs/src/embed/conversation.spec.js.map +1 -1
- package/cjs/src/embed/hostEventClient/contracts.d.ts +11 -1
- package/cjs/src/embed/hostEventClient/contracts.d.ts.map +1 -1
- package/cjs/src/embed/hostEventClient/contracts.js +1 -0
- package/cjs/src/embed/hostEventClient/contracts.js.map +1 -1
- package/cjs/src/embed/liveboard.d.ts.map +1 -1
- package/cjs/src/embed/liveboard.js +4 -2
- package/cjs/src/embed/liveboard.js.map +1 -1
- package/cjs/src/embed/liveboard.spec.js +11 -0
- package/cjs/src/embed/liveboard.spec.js.map +1 -1
- package/cjs/src/embed/search.d.ts +0 -7
- package/cjs/src/embed/search.d.ts.map +1 -1
- package/cjs/src/embed/search.js +1 -4
- package/cjs/src/embed/search.js.map +1 -1
- package/cjs/src/embed/ts-embed.d.ts +10 -0
- package/cjs/src/embed/ts-embed.d.ts.map +1 -1
- package/cjs/src/embed/ts-embed.js +56 -15
- package/cjs/src/embed/ts-embed.js.map +1 -1
- package/cjs/src/embed/ts-embed.spec.d.ts.map +1 -1
- package/cjs/src/embed/ts-embed.spec.js +412 -238
- 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 +2 -1
- package/cjs/src/index.js.map +1 -1
- package/cjs/src/react/all-types-export.d.ts +1 -1
- package/cjs/src/react/all-types-export.d.ts.map +1 -1
- package/cjs/src/react/all-types-export.js +2 -1
- package/cjs/src/react/all-types-export.js.map +1 -1
- package/cjs/src/types.d.ts +328 -103
- package/cjs/src/types.d.ts.map +1 -1
- package/cjs/src/types.js +265 -85
- package/cjs/src/types.js.map +1 -1
- package/cjs/src/utils/logger.d.ts.map +1 -1
- package/cjs/src/utils/logger.js +1 -2
- package/cjs/src/utils/logger.js.map +1 -1
- package/cjs/src/utils/processData.d.ts +1 -1
- package/cjs/src/utils/processData.d.ts.map +1 -1
- package/cjs/src/utils/processData.js +8 -8
- package/cjs/src/utils/processData.js.map +1 -1
- package/cjs/src/utils/processData.spec.js.map +1 -1
- package/dist/{index-SVcLgSqi.js → index-CpkMygsc.js} +1 -1
- package/dist/src/api-intercept.d.ts +51 -0
- package/dist/src/api-intercept.d.ts.map +1 -0
- package/dist/src/api-intercept.spec.d.ts +2 -0
- package/dist/src/api-intercept.spec.d.ts.map +1 -0
- package/dist/src/css-variables.d.ts +4 -0
- package/dist/src/css-variables.d.ts.map +1 -1
- package/dist/src/embed/app.d.ts +0 -5
- package/dist/src/embed/app.d.ts.map +1 -1
- package/dist/src/embed/conversation.d.ts +2 -2
- package/dist/src/embed/hostEventClient/contracts.d.ts +11 -1
- package/dist/src/embed/hostEventClient/contracts.d.ts.map +1 -1
- package/dist/src/embed/liveboard.d.ts.map +1 -1
- package/dist/src/embed/search.d.ts +0 -7
- package/dist/src/embed/search.d.ts.map +1 -1
- package/dist/src/embed/ts-embed.d.ts +10 -0
- package/dist/src/embed/ts-embed.d.ts.map +1 -1
- package/dist/src/embed/ts-embed.spec.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 +1 -1
- package/dist/src/react/all-types-export.d.ts.map +1 -1
- package/dist/src/types.d.ts +328 -103
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/utils/logger.d.ts.map +1 -1
- package/dist/src/utils/processData.d.ts +1 -1
- package/dist/src/utils/processData.d.ts.map +1 -1
- package/dist/tsembed-react.es.js +519 -133
- package/dist/tsembed-react.js +518 -132
- package/dist/tsembed.es.js +2642 -2256
- package/dist/tsembed.js +2640 -2254
- package/dist/visual-embed-sdk-react-full.d.ts +355 -118
- package/dist/visual-embed-sdk-react.d.ts +352 -118
- package/dist/visual-embed-sdk.d.ts +355 -118
- package/lib/package.json +1 -1
- package/lib/src/api-intercept.d.ts +51 -0
- package/lib/src/api-intercept.d.ts.map +1 -0
- package/lib/src/api-intercept.js +173 -0
- package/lib/src/api-intercept.js.map +1 -0
- package/lib/src/api-intercept.spec.d.ts +2 -0
- package/lib/src/api-intercept.spec.d.ts.map +1 -0
- package/lib/src/api-intercept.spec.js +669 -0
- package/lib/src/api-intercept.spec.js.map +1 -0
- package/lib/src/css-variables.d.ts +4 -0
- package/lib/src/css-variables.d.ts.map +1 -1
- package/lib/src/embed/app.d.ts +0 -5
- package/lib/src/embed/app.d.ts.map +1 -1
- package/lib/src/embed/app.js +4 -5
- package/lib/src/embed/app.js.map +1 -1
- package/lib/src/embed/app.spec.js +10 -0
- package/lib/src/embed/app.spec.js.map +1 -1
- package/lib/src/embed/conversation.d.ts +2 -2
- package/lib/src/embed/conversation.js +1 -1
- package/lib/src/embed/conversation.js.map +1 -1
- package/lib/src/embed/conversation.spec.js +17 -0
- package/lib/src/embed/conversation.spec.js.map +1 -1
- package/lib/src/embed/hostEventClient/contracts.d.ts +11 -1
- package/lib/src/embed/hostEventClient/contracts.d.ts.map +1 -1
- package/lib/src/embed/hostEventClient/contracts.js +1 -0
- package/lib/src/embed/hostEventClient/contracts.js.map +1 -1
- package/lib/src/embed/liveboard.d.ts.map +1 -1
- package/lib/src/embed/liveboard.js +4 -2
- package/lib/src/embed/liveboard.js.map +1 -1
- package/lib/src/embed/liveboard.spec.js +11 -0
- package/lib/src/embed/liveboard.spec.js.map +1 -1
- package/lib/src/embed/search.d.ts +0 -7
- package/lib/src/embed/search.d.ts.map +1 -1
- package/lib/src/embed/search.js +1 -4
- package/lib/src/embed/search.js.map +1 -1
- package/lib/src/embed/ts-embed.d.ts +10 -0
- package/lib/src/embed/ts-embed.d.ts.map +1 -1
- package/lib/src/embed/ts-embed.js +56 -15
- package/lib/src/embed/ts-embed.js.map +1 -1
- package/lib/src/embed/ts-embed.spec.d.ts.map +1 -1
- package/lib/src/embed/ts-embed.spec.js +412 -238
- 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 +2 -2
- package/lib/src/index.js.map +1 -1
- package/lib/src/react/all-types-export.d.ts +1 -1
- package/lib/src/react/all-types-export.d.ts.map +1 -1
- package/lib/src/react/all-types-export.js +1 -1
- package/lib/src/react/all-types-export.js.map +1 -1
- package/lib/src/types.d.ts +328 -103
- package/lib/src/types.d.ts.map +1 -1
- package/lib/src/types.js +264 -84
- package/lib/src/types.js.map +1 -1
- package/lib/src/utils/logger.d.ts.map +1 -1
- package/lib/src/utils/logger.js +1 -2
- package/lib/src/utils/logger.js.map +1 -1
- package/lib/src/utils/processData.d.ts +1 -1
- package/lib/src/utils/processData.d.ts.map +1 -1
- package/lib/src/utils/processData.js +8 -8
- package/lib/src/utils/processData.js.map +1 -1
- package/lib/src/utils/processData.spec.js.map +1 -1
- package/package.json +1 -1
- package/src/api-intercept.spec.ts +856 -0
- package/src/api-intercept.ts +204 -0
- package/src/css-variables.ts +5 -0
- package/src/embed/app.spec.ts +11 -0
- package/src/embed/app.ts +5 -16
- package/src/embed/conversation.spec.ts +22 -0
- package/src/embed/conversation.ts +3 -3
- package/src/embed/hostEventClient/contracts.ts +10 -0
- package/src/embed/liveboard.spec.ts +12 -0
- package/src/embed/liveboard.ts +6 -2
- package/src/embed/search.ts +1 -14
- package/src/embed/ts-embed.spec.ts +498 -250
- package/src/embed/ts-embed.ts +80 -32
- package/src/index.ts +2 -0
- package/src/react/all-types-export.ts +1 -0
- package/src/types.ts +410 -179
- package/src/utils/logger.ts +1 -2
- package/src/utils/processData.spec.ts +0 -1
- package/src/utils/processData.ts +10 -11
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import { getThoughtSpotHost } from "./config";
|
|
2
|
+
import { getEmbedConfig } from "./embed/embedConfig";
|
|
3
|
+
import { InterceptedApiType, BaseViewConfig, ApiInterceptFlags, EmbedEvent } from "./types";
|
|
4
|
+
import { embedEventStatus } from "./utils";
|
|
5
|
+
import { logger } from "./utils/logger";
|
|
6
|
+
|
|
7
|
+
const DefaultInterceptUrlsMap: Record<Exclude<InterceptedApiType, InterceptedApiType.ALL>, string[]> = {
|
|
8
|
+
[InterceptedApiType.AnswerData]: [
|
|
9
|
+
'/prism/?op=GetChartWithData',
|
|
10
|
+
'/prism/?op=GetTableWithHeadlineData',
|
|
11
|
+
'/prism/?op=GetTableWithData',
|
|
12
|
+
] as string[],
|
|
13
|
+
[InterceptedApiType.LiveboardData]: [
|
|
14
|
+
'/prism/?op=LoadContextBook'
|
|
15
|
+
] as string[],
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const formatInterceptUrl = (url: string) => {
|
|
19
|
+
const host = getThoughtSpotHost(getEmbedConfig());
|
|
20
|
+
if (url.startsWith('/')) return `${host}${url}`;
|
|
21
|
+
return url;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
interface LegacyInterceptFlags {
|
|
25
|
+
isOnBeforeGetVizDataInterceptEnabled: boolean;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Converts user passed url values to proper urls
|
|
29
|
+
* [ANSER_DATA] => ['https://host/pris/op?=op']
|
|
30
|
+
* @param interceptUrls
|
|
31
|
+
* @returns
|
|
32
|
+
*/
|
|
33
|
+
const processInterceptUrls = (interceptUrls: (string | InterceptedApiType)[]) => {
|
|
34
|
+
let processedUrls = [...interceptUrls];
|
|
35
|
+
Object.entries(DefaultInterceptUrlsMap).forEach(([apiType, apiTypeUrls]) => {
|
|
36
|
+
if (!processedUrls.includes(apiType)) return;
|
|
37
|
+
processedUrls = processedUrls.filter(url => url !== apiType);
|
|
38
|
+
processedUrls = [...processedUrls, ...apiTypeUrls];
|
|
39
|
+
})
|
|
40
|
+
return processedUrls.map(url => formatInterceptUrl(url));
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Returns the data to be sent to embed to setup intercepts
|
|
45
|
+
* the urls to intercept, timeout etc
|
|
46
|
+
* @param viewConfig
|
|
47
|
+
* @returns
|
|
48
|
+
*/
|
|
49
|
+
export const getInterceptInitData = (viewConfig: BaseViewConfig): Required<Omit<ApiInterceptFlags, 'isOnBeforeGetVizDataInterceptEnabled'>> => {
|
|
50
|
+
const combinedUrls = [...(viewConfig.interceptUrls || [])];
|
|
51
|
+
|
|
52
|
+
if ((viewConfig as LegacyInterceptFlags).isOnBeforeGetVizDataInterceptEnabled) {
|
|
53
|
+
combinedUrls.push(InterceptedApiType.AnswerData);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const shouldInterceptAll = combinedUrls.includes(InterceptedApiType.ALL);
|
|
57
|
+
const interceptUrls = shouldInterceptAll ? [InterceptedApiType.ALL] : processInterceptUrls(combinedUrls);
|
|
58
|
+
|
|
59
|
+
const interceptTimeout = viewConfig.interceptTimeout;
|
|
60
|
+
|
|
61
|
+
return {
|
|
62
|
+
interceptUrls,
|
|
63
|
+
interceptTimeout,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const parseJson = (jsonString: string): [any, Error | null] => {
|
|
68
|
+
try {
|
|
69
|
+
const json = JSON.parse(jsonString);
|
|
70
|
+
return [json, null];
|
|
71
|
+
} catch (error) {
|
|
72
|
+
return [null, error];
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Parse the api intercept data and return the parsed data and error if any
|
|
78
|
+
* Embed returns the input and init from the fetch call
|
|
79
|
+
*/
|
|
80
|
+
const parseInterceptData = (eventDataString: any) => {
|
|
81
|
+
|
|
82
|
+
try {
|
|
83
|
+
const [parsedData, error] = parseJson(eventDataString);
|
|
84
|
+
if (error) {
|
|
85
|
+
return [null, error];
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const { input, init } = parsedData;
|
|
89
|
+
|
|
90
|
+
const [parsedBody, bodyParseError] = parseJson(init.body);
|
|
91
|
+
if (!bodyParseError) {
|
|
92
|
+
init.body = parsedBody;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const parsedInit = { input, init };
|
|
96
|
+
return [parsedInit, null];
|
|
97
|
+
} catch (error) {
|
|
98
|
+
return [null, error];
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const getUrlType = (url: string) => {
|
|
103
|
+
for (const [apiType, apiTypeUrls] of Object.entries(DefaultInterceptUrlsMap)) {
|
|
104
|
+
if (apiTypeUrls.includes(url)) return apiType as InterceptedApiType;
|
|
105
|
+
}
|
|
106
|
+
// TODO: have a unknown type maybe ??
|
|
107
|
+
return InterceptedApiType.ALL;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Handle Api intercept event and simulate legacy onBeforeGetVizDataIntercept event
|
|
112
|
+
*
|
|
113
|
+
* embed sends -> ApiIntercept -> we send
|
|
114
|
+
* ApiIntercept
|
|
115
|
+
* OnBeforeGetVizDataIntercept (if url is part of DefaultUrlMap.AnswerData)
|
|
116
|
+
*
|
|
117
|
+
* @param params
|
|
118
|
+
* @returns
|
|
119
|
+
*/
|
|
120
|
+
export const handleInterceptEvent = async (params: {
|
|
121
|
+
eventData: any,
|
|
122
|
+
executeEvent: (eventType: EmbedEvent, data: any) => void,
|
|
123
|
+
viewConfig: BaseViewConfig,
|
|
124
|
+
getUnsavedAnswerTml: (props: { sessionId?: string, vizId?: string }) => Promise<{ tml: string }>
|
|
125
|
+
}) => {
|
|
126
|
+
|
|
127
|
+
const { eventData, executeEvent, viewConfig, getUnsavedAnswerTml } = params;
|
|
128
|
+
|
|
129
|
+
const [interceptData, bodyParseError] = parseInterceptData(eventData.data);
|
|
130
|
+
|
|
131
|
+
if (bodyParseError) {
|
|
132
|
+
executeEvent(EmbedEvent.Error, {
|
|
133
|
+
error: 'Error parsing api intercept body',
|
|
134
|
+
});
|
|
135
|
+
logger.error('Error parsing request body', bodyParseError);
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
const { input: requestUrl, init } = interceptData;
|
|
141
|
+
|
|
142
|
+
const sessionId = init?.body?.variables?.session?.sessionId;
|
|
143
|
+
const vizId = init?.body?.variables?.contextBookId;
|
|
144
|
+
|
|
145
|
+
const answerDataUrls = DefaultInterceptUrlsMap[InterceptedApiType.AnswerData];
|
|
146
|
+
const legacyInterceptEnabled = viewConfig.isOnBeforeGetVizDataInterceptEnabled;
|
|
147
|
+
const isAnswerDataUrl = answerDataUrls.includes(requestUrl);
|
|
148
|
+
const sendLegacyIntercept = isAnswerDataUrl && legacyInterceptEnabled;
|
|
149
|
+
if (sendLegacyIntercept) {
|
|
150
|
+
const answerTml = await getUnsavedAnswerTml({ sessionId, vizId });
|
|
151
|
+
// Build the legacy payload for backwards compatibility
|
|
152
|
+
const legacyPayload = {
|
|
153
|
+
data: {
|
|
154
|
+
data: answerTml,
|
|
155
|
+
status: embedEventStatus.END,
|
|
156
|
+
type: EmbedEvent.OnBeforeGetVizDataIntercept
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
executeEvent(EmbedEvent.OnBeforeGetVizDataIntercept, legacyPayload);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
const urlType = getUrlType(requestUrl);
|
|
163
|
+
executeEvent(EmbedEvent.ApiIntercept, { ...interceptData, urlType });
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Support both the legacy and new format of the api intercept response
|
|
168
|
+
* @param payload
|
|
169
|
+
* @returns
|
|
170
|
+
*/
|
|
171
|
+
export const processApiInterceptResponse = (payload: any) => {
|
|
172
|
+
const isLegacyFormat = payload?.data?.error;
|
|
173
|
+
|
|
174
|
+
if (isLegacyFormat) {
|
|
175
|
+
return processLegacyInterceptResponse(payload);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
return payload;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export const processLegacyInterceptResponse = (payload: any) => {
|
|
182
|
+
|
|
183
|
+
const errorText = payload?.data?.error?.errorText;
|
|
184
|
+
const errorDescription = payload?.data?.error?.errorDescription;
|
|
185
|
+
|
|
186
|
+
const payloadToSend = {
|
|
187
|
+
execute: payload?.data?.execute,
|
|
188
|
+
response: {
|
|
189
|
+
body: {
|
|
190
|
+
errors: [
|
|
191
|
+
{
|
|
192
|
+
title: errorText,
|
|
193
|
+
description: errorDescription,
|
|
194
|
+
isUserError: true,
|
|
195
|
+
},
|
|
196
|
+
],
|
|
197
|
+
data: {},
|
|
198
|
+
},
|
|
199
|
+
},
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
return { data: payloadToSend };
|
|
204
|
+
}
|
package/src/css-variables.ts
CHANGED
|
@@ -847,4 +847,9 @@ export interface CustomCssVariables {
|
|
|
847
847
|
* Background color of the summary header in the CCA modal.
|
|
848
848
|
*/
|
|
849
849
|
'--ts-var-cca-modal-summary-header-background'?: string;
|
|
850
|
+
|
|
851
|
+
/**
|
|
852
|
+
* Width of the Spotter chat window.
|
|
853
|
+
*/
|
|
854
|
+
'--ts-var-spotter-chat-width'?: string;
|
|
850
855
|
}
|
package/src/embed/app.spec.ts
CHANGED
|
@@ -414,6 +414,17 @@ describe('App embed tests', () => {
|
|
|
414
414
|
});
|
|
415
415
|
});
|
|
416
416
|
|
|
417
|
+
test('should not set liveboardXLSXCSVDownload in url when undefined', async () => {
|
|
418
|
+
const appEmbed = new AppEmbed(getRootEl(), {
|
|
419
|
+
...defaultViewConfig,
|
|
420
|
+
} as AppViewConfig);
|
|
421
|
+
appEmbed.render();
|
|
422
|
+
await executeAfterWait(() => {
|
|
423
|
+
const iframeSrc = getIFrameSrc();
|
|
424
|
+
expect(iframeSrc).not.toContain('isLiveboardXLSXCSVDownloadEnabled');
|
|
425
|
+
});
|
|
426
|
+
});
|
|
427
|
+
|
|
417
428
|
test('should set isCentralizedLiveboardFilterUXEnabled to true in url', async () => {
|
|
418
429
|
const appEmbed = new AppEmbed(getRootEl(), {
|
|
419
430
|
...defaultViewConfig,
|
package/src/embed/app.ts
CHANGED
|
@@ -512,11 +512,6 @@ export interface AppViewConfig extends AllEmbedViewConfig {
|
|
|
512
512
|
* ```
|
|
513
513
|
*/
|
|
514
514
|
dataPanelCustomGroupsAccordionInitialState?: DataPanelCustomColumnGroupsAccordionState;
|
|
515
|
-
/**
|
|
516
|
-
* Flag that allows using `EmbedEvent.OnBeforeGetVizDataIntercept`.
|
|
517
|
-
* @version SDK : 1.29.0 | ThoughtSpot: 10.1.0.cl
|
|
518
|
-
*/
|
|
519
|
-
isOnBeforeGetVizDataInterceptEnabled?: boolean;
|
|
520
515
|
/**
|
|
521
516
|
* Flag to use home page search bar mode
|
|
522
517
|
*
|
|
@@ -668,8 +663,6 @@ export class AppEmbed extends V1Embed {
|
|
|
668
663
|
collapseSearchBarInitially = false,
|
|
669
664
|
enable2ColumnLayout,
|
|
670
665
|
enableCustomColumnGroups = false,
|
|
671
|
-
isOnBeforeGetVizDataInterceptEnabled = false,
|
|
672
|
-
|
|
673
666
|
dataPanelCustomGroupsAccordionInitialState = DataPanelCustomColumnGroupsAccordionState.EXPAND_ALL,
|
|
674
667
|
collapseSearchBar = true,
|
|
675
668
|
isLiveboardCompactHeaderEnabled = false,
|
|
@@ -682,7 +675,7 @@ export class AppEmbed extends V1Embed {
|
|
|
682
675
|
enablePendoHelp = true,
|
|
683
676
|
discoveryExperience,
|
|
684
677
|
coverAndFilterOptionInPDF = false,
|
|
685
|
-
liveboardXLSXCSVDownload
|
|
678
|
+
liveboardXLSXCSVDownload,
|
|
686
679
|
isLiveboardStylingAndGroupingEnabled,
|
|
687
680
|
isPNGInScheduledEmailsEnabled = false,
|
|
688
681
|
isCentralizedLiveboardFilterUXEnabled = false,
|
|
@@ -706,7 +699,6 @@ export class AppEmbed extends V1Embed {
|
|
|
706
699
|
params[Param.HideIrrelevantFiltersInTab] = hideIrrelevantChipsInLiveboardTabs;
|
|
707
700
|
params[Param.IsUnifiedSearchExperienceEnabled] = isUnifiedSearchExperienceEnabled;
|
|
708
701
|
params[Param.CoverAndFilterOptionInPDF] = !!coverAndFilterOptionInPDF;
|
|
709
|
-
params[Param.LiveboardXLSXCSVDownload] = !!liveboardXLSXCSVDownload;
|
|
710
702
|
|
|
711
703
|
params = this.getBaseQueryParams(params);
|
|
712
704
|
|
|
@@ -752,13 +744,6 @@ export class AppEmbed extends V1Embed {
|
|
|
752
744
|
params[Param.enableAskSage] = enableAskSage;
|
|
753
745
|
}
|
|
754
746
|
|
|
755
|
-
if (isOnBeforeGetVizDataInterceptEnabled) {
|
|
756
|
-
|
|
757
|
-
params[
|
|
758
|
-
Param.IsOnBeforeGetVizDataInterceptEnabled
|
|
759
|
-
] = isOnBeforeGetVizDataInterceptEnabled;
|
|
760
|
-
}
|
|
761
|
-
|
|
762
747
|
if (homePageSearchBarMode) {
|
|
763
748
|
params[Param.HomePageSearchBarMode] = homePageSearchBarMode;
|
|
764
749
|
}
|
|
@@ -771,6 +756,10 @@ export class AppEmbed extends V1Embed {
|
|
|
771
756
|
params[Param.IsLiveboardStylingAndGroupingEnabled] = isLiveboardStylingAndGroupingEnabled;
|
|
772
757
|
}
|
|
773
758
|
|
|
759
|
+
if (liveboardXLSXCSVDownload !== undefined) {
|
|
760
|
+
params[Param.LiveboardXLSXCSVDownload] = !!liveboardXLSXCSVDownload;
|
|
761
|
+
}
|
|
762
|
+
|
|
774
763
|
if (isPNGInScheduledEmailsEnabled !== undefined) {
|
|
775
764
|
params[Param.isPNGInScheduledEmailsEnabled] = isPNGInScheduledEmailsEnabled;
|
|
776
765
|
}
|
|
@@ -316,6 +316,28 @@ describe('ConversationEmbed', () => {
|
|
|
316
316
|
);
|
|
317
317
|
});
|
|
318
318
|
|
|
319
|
+
it('should render the conversation embed with all boolean flags set', async () => {
|
|
320
|
+
const viewConfig: SpotterEmbedViewConfig = {
|
|
321
|
+
worksheetId: 'worksheetId',
|
|
322
|
+
searchOptions: {
|
|
323
|
+
searchQuery: 'searchQuery',
|
|
324
|
+
},
|
|
325
|
+
disableSourceSelection: true,
|
|
326
|
+
hideSourceSelection: true,
|
|
327
|
+
dataPanelV2: true,
|
|
328
|
+
showSpotterLimitations: true,
|
|
329
|
+
hideSampleQuestions: true,
|
|
330
|
+
enablePastConversationsSidebar: true,
|
|
331
|
+
};
|
|
332
|
+
|
|
333
|
+
const conversationEmbed = new SpotterEmbed(getRootEl(), viewConfig);
|
|
334
|
+
await conversationEmbed.render();
|
|
335
|
+
expectUrlMatchesWithParams(
|
|
336
|
+
getIFrameSrc(),
|
|
337
|
+
`http://${thoughtSpotHost}/v2/?${defaultParams}&isSpotterExperienceEnabled=true&disableSourceSelection=true&hideSourceSelection=true&enableDataPanelV2=true&showSpotterLimitations=true&hideSampleQuestions=true&enablePastConversationsSidebar=true#/embed/insights/conv-assist?worksheet=worksheetId&query=searchQuery`,
|
|
338
|
+
);
|
|
339
|
+
});
|
|
340
|
+
|
|
319
341
|
it('should ensure deprecated ConversationEmbed class maintains same functionality as SpotterEmbed', async () => {
|
|
320
342
|
const viewConfig: SpotterEmbedViewConfig = {
|
|
321
343
|
worksheetId: 'worksheetId',
|
|
@@ -62,7 +62,7 @@ export interface SpotterEmbedViewConfig extends Omit<BaseViewConfig, 'primaryAct
|
|
|
62
62
|
*
|
|
63
63
|
* Supported embed types: `SageEmbed`, `AppEmbed`, `SearchBarEmbed`, `LiveboardEmbed`, `SearchEmbed`
|
|
64
64
|
* @default true
|
|
65
|
-
* @version SDK: 1.
|
|
65
|
+
* @version SDK: 1.41.1 | ThoughtSpot Cloud: 10.14.0.cl
|
|
66
66
|
* @example
|
|
67
67
|
* ```js
|
|
68
68
|
* // Replace <EmbedComponent> with embed component name. For example, SageEmbed, AppEmbed, or SearchBarEmbed
|
|
@@ -177,7 +177,7 @@ export interface SpotterEmbedViewConfig extends Omit<BaseViewConfig, 'primaryAct
|
|
|
177
177
|
* enablePastConversationsSidebar : true,
|
|
178
178
|
* })
|
|
179
179
|
* ```
|
|
180
|
-
* @version SDK: 1.
|
|
180
|
+
* @version SDK: 1.45.0 | ThoughtSpot: 26.2.0.cl
|
|
181
181
|
*/
|
|
182
182
|
enablePastConversationsSidebar?: boolean;
|
|
183
183
|
}
|
|
@@ -263,7 +263,7 @@ export class SpotterEmbed extends TsEmbed {
|
|
|
263
263
|
excludeRuntimeFiltersfromURL,
|
|
264
264
|
runtimeParameters,
|
|
265
265
|
excludeRuntimeParametersfromURL,
|
|
266
|
-
enablePastConversationsSidebar
|
|
266
|
+
enablePastConversationsSidebar,
|
|
267
267
|
} = this.viewConfig;
|
|
268
268
|
const path = 'insights/conv-assist';
|
|
269
269
|
const queryParams = this.getEmbedParamsObject();
|
|
@@ -7,6 +7,7 @@ export enum UIPassthroughEvent {
|
|
|
7
7
|
GetAvailableUIPassthroughs = 'getAvailableUiPassthroughs',
|
|
8
8
|
GetAnswerConfig = 'getAnswerPageConfig',
|
|
9
9
|
GetLiveboardConfig = 'getPinboardPageConfig',
|
|
10
|
+
GetUnsavedAnswerTML = 'getUnsavedAnswerTML',
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
// UI Passthrough Contract
|
|
@@ -63,6 +64,15 @@ export type UIPassthroughContractBase = {
|
|
|
63
64
|
request: any;
|
|
64
65
|
response: any;
|
|
65
66
|
};
|
|
67
|
+
[UIPassthroughEvent.GetUnsavedAnswerTML]: {
|
|
68
|
+
request: {
|
|
69
|
+
sessionId?: string;
|
|
70
|
+
vizId?: string;
|
|
71
|
+
};
|
|
72
|
+
response: {
|
|
73
|
+
tml: string;
|
|
74
|
+
};
|
|
75
|
+
};
|
|
66
76
|
};
|
|
67
77
|
|
|
68
78
|
// UI Passthrough Request and Response
|
|
@@ -483,6 +483,18 @@ describe('Liveboard/viz embed tests', () => {
|
|
|
483
483
|
});
|
|
484
484
|
});
|
|
485
485
|
|
|
486
|
+
test('should not add liveboardXLSXCSVDownload flag when undefined', async () => {
|
|
487
|
+
const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
|
|
488
|
+
...defaultViewConfig,
|
|
489
|
+
liveboardId,
|
|
490
|
+
} as LiveboardViewConfig);
|
|
491
|
+
liveboardEmbed.render();
|
|
492
|
+
await executeAfterWait(() => {
|
|
493
|
+
const iframeSrc = getIFrameSrc();
|
|
494
|
+
expect(iframeSrc).not.toContain('isLiveboardXLSXCSVDownloadEnabled');
|
|
495
|
+
});
|
|
496
|
+
});
|
|
497
|
+
|
|
486
498
|
test('should add isCentralizedLiveboardFilterUXEnabled flag and set value to true to the iframe src', async () => {
|
|
487
499
|
const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
|
|
488
500
|
...defaultViewConfig,
|
package/src/embed/liveboard.ts
CHANGED
|
@@ -474,7 +474,7 @@ export class LiveboardEmbed extends V1Embed {
|
|
|
474
474
|
isForceRedirect,
|
|
475
475
|
dataSourceId,
|
|
476
476
|
coverAndFilterOptionInPDF = false,
|
|
477
|
-
liveboardXLSXCSVDownload
|
|
477
|
+
liveboardXLSXCSVDownload,
|
|
478
478
|
isLiveboardStylingAndGroupingEnabled,
|
|
479
479
|
isPNGInScheduledEmailsEnabled = false,
|
|
480
480
|
showSpotterLimitations,
|
|
@@ -574,7 +574,11 @@ export class LiveboardEmbed extends V1Embed {
|
|
|
574
574
|
params[Param.DataPanelV2Enabled] = dataPanelV2;
|
|
575
575
|
params[Param.EnableCustomColumnGroups] = enableCustomColumnGroups;
|
|
576
576
|
params[Param.CoverAndFilterOptionInPDF] = coverAndFilterOptionInPDF;
|
|
577
|
-
|
|
577
|
+
|
|
578
|
+
if (liveboardXLSXCSVDownload !== undefined) {
|
|
579
|
+
params[Param.LiveboardXLSXCSVDownload] = !!liveboardXLSXCSVDownload;
|
|
580
|
+
}
|
|
581
|
+
|
|
578
582
|
const queryParams = getQueryParamString(params, true);
|
|
579
583
|
|
|
580
584
|
return params;
|
package/src/embed/search.ts
CHANGED
|
@@ -26,6 +26,7 @@ import { ERROR_MESSAGE } from '../errors';
|
|
|
26
26
|
import { getAuthPromise } from './base';
|
|
27
27
|
import { getReleaseVersion } from '../auth';
|
|
28
28
|
import { getEmbedConfig } from './embedConfig';
|
|
29
|
+
import { getInterceptInitData } from '../api-intercept';
|
|
29
30
|
|
|
30
31
|
/**
|
|
31
32
|
* Configuration for search options.
|
|
@@ -276,13 +277,6 @@ export interface SearchViewConfig
|
|
|
276
277
|
* @deprecated Use {@link collapseSearchBar} instead
|
|
277
278
|
*/
|
|
278
279
|
collapseSearchBarInitially?: boolean;
|
|
279
|
-
/**
|
|
280
|
-
* Flag to enable onBeforeSearchExecute Embed Event
|
|
281
|
-
*
|
|
282
|
-
* Supported embed types: `SearchEmbed`
|
|
283
|
-
* @version: SDK: 1.29.0 | ThoughtSpot: 10.1.0.cl
|
|
284
|
-
*/
|
|
285
|
-
isOnBeforeGetVizDataInterceptEnabled?: boolean;
|
|
286
280
|
/**
|
|
287
281
|
* This controls the initial behaviour of custom column groups accordion.
|
|
288
282
|
* It takes DataPanelCustomColumnGroupsAccordionState enum values as input.
|
|
@@ -397,8 +391,6 @@ export class SearchEmbed extends TsEmbed {
|
|
|
397
391
|
runtimeParameters,
|
|
398
392
|
collapseSearchBarInitially = false,
|
|
399
393
|
enableCustomColumnGroups = false,
|
|
400
|
-
isOnBeforeGetVizDataInterceptEnabled = false,
|
|
401
|
-
|
|
402
394
|
dataPanelCustomGroupsAccordionInitialState = DataPanelCustomColumnGroupsAccordionState.EXPAND_ALL,
|
|
403
395
|
focusSearchBarOnRender = true,
|
|
404
396
|
excludeRuntimeParametersfromURL,
|
|
@@ -442,11 +434,6 @@ export class SearchEmbed extends TsEmbed {
|
|
|
442
434
|
queryParams[Param.HideSearchBar] = true;
|
|
443
435
|
}
|
|
444
436
|
|
|
445
|
-
if (isOnBeforeGetVizDataInterceptEnabled) {
|
|
446
|
-
|
|
447
|
-
queryParams[Param.IsOnBeforeGetVizDataInterceptEnabled] = isOnBeforeGetVizDataInterceptEnabled;
|
|
448
|
-
}
|
|
449
|
-
|
|
450
437
|
if (!focusSearchBarOnRender) {
|
|
451
438
|
queryParams[Param.FocusSearchBarOnRender] = focusSearchBarOnRender;
|
|
452
439
|
}
|