@thoughtspot/visual-embed-sdk 1.44.4-HE-beta.1 → 1.44.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/package.json +1 -1
- package/cjs/src/embed/app.d.ts.map +1 -1
- package/cjs/src/embed/app.js.map +1 -1
- package/cjs/src/embed/conversation.d.ts +0 -7
- package/cjs/src/embed/conversation.d.ts.map +1 -1
- package/cjs/src/embed/conversation.js +0 -9
- package/cjs/src/embed/conversation.js.map +1 -1
- package/cjs/src/embed/hostEventClient/contracts.d.ts +3 -20
- package/cjs/src/embed/hostEventClient/contracts.d.ts.map +1 -1
- package/cjs/src/embed/hostEventClient/contracts.js +1 -6
- package/cjs/src/embed/hostEventClient/contracts.js.map +1 -1
- package/cjs/src/embed/hostEventClient/host-event-client.d.ts +8 -8
- package/cjs/src/embed/hostEventClient/host-event-client.d.ts.map +1 -1
- package/cjs/src/embed/hostEventClient/host-event-client.js +18 -18
- package/cjs/src/embed/hostEventClient/host-event-client.js.map +1 -1
- package/cjs/src/embed/hostEventClient/host-event-client.spec.js +7 -7
- package/cjs/src/embed/hostEventClient/host-event-client.spec.js.map +1 -1
- package/cjs/src/embed/liveboard.d.ts +3 -9
- package/cjs/src/embed/liveboard.d.ts.map +1 -1
- package/cjs/src/embed/liveboard.js +2 -12
- package/cjs/src/embed/liveboard.js.map +1 -1
- package/cjs/src/embed/liveboard.spec.js +1 -1
- package/cjs/src/embed/liveboard.spec.js.map +1 -1
- package/cjs/src/embed/sage.d.ts +0 -7
- package/cjs/src/embed/sage.d.ts.map +1 -1
- package/cjs/src/embed/sage.js +0 -9
- package/cjs/src/embed/sage.js.map +1 -1
- package/cjs/src/embed/search-bar.d.ts +0 -7
- package/cjs/src/embed/search-bar.d.ts.map +1 -1
- package/cjs/src/embed/search-bar.js +0 -9
- package/cjs/src/embed/search-bar.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 +0 -9
- package/cjs/src/embed/search.js.map +1 -1
- package/cjs/src/embed/ts-embed.d.ts +2 -8
- package/cjs/src/embed/ts-embed.d.ts.map +1 -1
- package/cjs/src/embed/ts-embed.js +2 -17
- package/cjs/src/embed/ts-embed.js.map +1 -1
- package/cjs/src/embed/ts-embed.spec.js +16 -16
- 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 -3
- package/cjs/src/index.js.map +1 -1
- package/cjs/src/types.d.ts +1 -42
- package/cjs/src/types.d.ts.map +1 -1
- package/cjs/src/types.js +1 -17
- package/cjs/src/types.js.map +1 -1
- package/cjs/src/utils/logger.spec.d.ts +5 -20
- package/cjs/src/utils/logger.spec.d.ts.map +1 -1
- package/cjs/src/utils/processTrigger.d.ts +2 -3
- package/cjs/src/utils/processTrigger.d.ts.map +1 -1
- package/cjs/src/utils/processTrigger.js +2 -4
- package/cjs/src/utils/processTrigger.js.map +1 -1
- package/cjs/src/utils.d.ts +1 -5
- package/cjs/src/utils.d.ts.map +1 -1
- package/cjs/src/utils.js +1 -8
- package/cjs/src/utils.js.map +1 -1
- package/dist/{index-CWQnMX2L.js → index-C5FAW929.js} +1 -1
- package/dist/src/embed/app.d.ts.map +1 -1
- package/dist/src/embed/conversation.d.ts +0 -7
- package/dist/src/embed/conversation.d.ts.map +1 -1
- package/dist/src/embed/hostEventClient/contracts.d.ts +3 -20
- package/dist/src/embed/hostEventClient/contracts.d.ts.map +1 -1
- package/dist/src/embed/hostEventClient/host-event-client.d.ts +8 -8
- package/dist/src/embed/hostEventClient/host-event-client.d.ts.map +1 -1
- package/dist/src/embed/liveboard.d.ts +3 -9
- package/dist/src/embed/liveboard.d.ts.map +1 -1
- package/dist/src/embed/sage.d.ts +0 -7
- package/dist/src/embed/sage.d.ts.map +1 -1
- package/dist/src/embed/search-bar.d.ts +0 -7
- package/dist/src/embed/search-bar.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 +2 -8
- package/dist/src/embed/ts-embed.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 +1 -42
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/utils/logger.spec.d.ts +5 -20
- package/dist/src/utils/logger.spec.d.ts.map +1 -1
- package/dist/src/utils/processTrigger.d.ts +2 -3
- package/dist/src/utils/processTrigger.d.ts.map +1 -1
- package/dist/src/utils.d.ts +1 -5
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/tsembed-react.es.js +28 -117
- package/dist/tsembed-react.js +27 -116
- package/dist/tsembed.es.js +29 -118
- package/dist/tsembed.js +27 -116
- package/dist/visual-embed-sdk-react-full.d.ts +12 -105
- package/dist/visual-embed-sdk-react.d.ts +12 -105
- package/dist/visual-embed-sdk.d.ts +12 -105
- package/lib/package.json +1 -1
- package/lib/src/embed/app.d.ts.map +1 -1
- package/lib/src/embed/app.js.map +1 -1
- package/lib/src/embed/conversation.d.ts +0 -7
- package/lib/src/embed/conversation.d.ts.map +1 -1
- package/lib/src/embed/conversation.js +0 -9
- package/lib/src/embed/conversation.js.map +1 -1
- package/lib/src/embed/hostEventClient/contracts.d.ts +3 -20
- package/lib/src/embed/hostEventClient/contracts.d.ts.map +1 -1
- package/lib/src/embed/hostEventClient/contracts.js +0 -5
- package/lib/src/embed/hostEventClient/contracts.js.map +1 -1
- package/lib/src/embed/hostEventClient/host-event-client.d.ts +8 -8
- package/lib/src/embed/hostEventClient/host-event-client.d.ts.map +1 -1
- package/lib/src/embed/hostEventClient/host-event-client.js +18 -18
- package/lib/src/embed/hostEventClient/host-event-client.js.map +1 -1
- package/lib/src/embed/hostEventClient/host-event-client.spec.js +7 -7
- package/lib/src/embed/hostEventClient/host-event-client.spec.js.map +1 -1
- package/lib/src/embed/liveboard.d.ts +3 -9
- package/lib/src/embed/liveboard.d.ts.map +1 -1
- package/lib/src/embed/liveboard.js +2 -12
- package/lib/src/embed/liveboard.js.map +1 -1
- package/lib/src/embed/liveboard.spec.js +1 -1
- package/lib/src/embed/liveboard.spec.js.map +1 -1
- package/lib/src/embed/sage.d.ts +0 -7
- package/lib/src/embed/sage.d.ts.map +1 -1
- package/lib/src/embed/sage.js +0 -9
- package/lib/src/embed/sage.js.map +1 -1
- package/lib/src/embed/search-bar.d.ts +0 -7
- package/lib/src/embed/search-bar.d.ts.map +1 -1
- package/lib/src/embed/search-bar.js +0 -9
- package/lib/src/embed/search-bar.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 +0 -9
- package/lib/src/embed/search.js.map +1 -1
- package/lib/src/embed/ts-embed.d.ts +2 -8
- package/lib/src/embed/ts-embed.d.ts.map +1 -1
- package/lib/src/embed/ts-embed.js +2 -17
- package/lib/src/embed/ts-embed.js.map +1 -1
- package/lib/src/embed/ts-embed.spec.js +16 -16
- 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/types.d.ts +1 -42
- package/lib/src/types.d.ts.map +1 -1
- package/lib/src/types.js +0 -16
- package/lib/src/types.js.map +1 -1
- package/lib/src/utils/logger.spec.d.ts +5 -20
- package/lib/src/utils/logger.spec.d.ts.map +1 -1
- package/lib/src/utils/processTrigger.d.ts +2 -3
- package/lib/src/utils/processTrigger.d.ts.map +1 -1
- package/lib/src/utils/processTrigger.js +2 -4
- package/lib/src/utils/processTrigger.js.map +1 -1
- package/lib/src/utils.d.ts +1 -5
- package/lib/src/utils.d.ts.map +1 -1
- package/lib/src/utils.js +0 -6
- package/lib/src/utils.js.map +1 -1
- package/package.json +1 -1
- package/src/embed/app.ts +0 -1
- package/src/embed/conversation.ts +0 -11
- package/src/embed/hostEventClient/contracts.ts +4 -23
- package/src/embed/hostEventClient/host-event-client.spec.ts +1 -7
- package/src/embed/hostEventClient/host-event-client.ts +11 -22
- package/src/embed/liveboard.spec.ts +1 -1
- package/src/embed/liveboard.ts +4 -17
- package/src/embed/sage.ts +0 -11
- package/src/embed/search-bar.tsx +0 -11
- package/src/embed/search.ts +0 -11
- package/src/embed/ts-embed.spec.ts +5 -17
- package/src/embed/ts-embed.ts +3 -21
- package/src/index.ts +0 -2
- package/src/types.ts +0 -46
- package/src/utils/processTrigger.ts +3 -6
- package/src/utils.ts +0 -8
- package/dist/index-BFdRRz03.js +0 -7371
- package/dist/index-BUfrYJ3w.js +0 -7371
- package/dist/index-CI6s4VMY.js +0 -7371
- package/dist/index-CaW-1mu5.js +0 -7371
- package/dist/index-CcSgNJVi.js +0 -7371
- package/dist/index-Djtv-y7A.js +0 -7371
- package/dist/index-UY-4yjBN.js +0 -7371
package/package.json
CHANGED
package/src/embed/app.ts
CHANGED
|
@@ -3,7 +3,6 @@ import { ERROR_MESSAGE } from '../errors';
|
|
|
3
3
|
import { Param, BaseViewConfig, RuntimeFilter, RuntimeParameter, ErrorDetailsTypes, EmbedErrorCodes } from '../types';
|
|
4
4
|
import { TsEmbed } from './ts-embed';
|
|
5
5
|
import { getQueryParamString, getFilterQuery, getRuntimeParameters } from '../utils';
|
|
6
|
-
import { PageContextOptions } from './hostEventClient/contracts';
|
|
7
6
|
|
|
8
7
|
/**
|
|
9
8
|
* Configuration for search options
|
|
@@ -329,16 +328,6 @@ export class SpotterEmbed extends TsEmbed {
|
|
|
329
328
|
await this.renderIFrame(src);
|
|
330
329
|
return this;
|
|
331
330
|
}
|
|
332
|
-
|
|
333
|
-
/**
|
|
334
|
-
* Get the current context of the embedded SpotterEmbed.
|
|
335
|
-
* @returns The current context object containing the page type and object ids.
|
|
336
|
-
* @version SDK: 1.46.0 | ThoughtSpot: 26.3.0.cl
|
|
337
|
-
*/
|
|
338
|
-
public async getCurrentContext(): Promise<PageContextOptions> {
|
|
339
|
-
const context = await super.getCurrentContext();
|
|
340
|
-
return context;
|
|
341
|
-
}
|
|
342
331
|
}
|
|
343
332
|
|
|
344
333
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { HostEvent } from '../../types';
|
|
2
2
|
|
|
3
3
|
export enum UIPassthroughEvent {
|
|
4
4
|
PinAnswerToLiveboard = 'addVizToPinboard',
|
|
@@ -103,7 +103,7 @@ export type HostEventRequest<HostEventT extends HostEvent> =
|
|
|
103
103
|
? UIPassthroughRequest<EmbedApiHostEventMapping[HostEventT]>
|
|
104
104
|
: any;
|
|
105
105
|
|
|
106
|
-
export type HostEventResponse<HostEventT extends HostEvent
|
|
106
|
+
export type HostEventResponse<HostEventT extends HostEvent> =
|
|
107
107
|
HostEventT extends keyof EmbedApiHostEventMapping
|
|
108
108
|
? UIPassthroughResponse<EmbedApiHostEventMapping[HostEventT]>
|
|
109
109
|
: any;
|
|
@@ -111,24 +111,5 @@ export type HostEventResponse<HostEventT extends HostEvent, ContextT extends Con
|
|
|
111
111
|
// trigger response and request
|
|
112
112
|
export type TriggerPayload<PayloadT, HostEventT extends HostEvent> =
|
|
113
113
|
PayloadT | HostEventRequest<HostEventT>;
|
|
114
|
-
export type TriggerResponse<PayloadT, HostEventT extends HostEvent
|
|
115
|
-
PayloadT extends HostEventRequest<HostEventT> ? HostEventResponse<HostEventT
|
|
116
|
-
|
|
117
|
-
export enum PageType {
|
|
118
|
-
PAGE = 'page',
|
|
119
|
-
DIALOG = 'dialog',
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
interface Objects {
|
|
123
|
-
answerId?: string;
|
|
124
|
-
liveboardId?: string;
|
|
125
|
-
vizIds?: string[];
|
|
126
|
-
dataModelIds?: string[];
|
|
127
|
-
modalTitle?: string;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
export interface PageContextOptions {
|
|
131
|
-
page: ContextType;
|
|
132
|
-
pageType: PageType;
|
|
133
|
-
objects: Objects;
|
|
134
|
-
}
|
|
114
|
+
export type TriggerResponse<PayloadT, HostEventT extends HostEvent> =
|
|
115
|
+
PayloadT extends HostEventRequest<HostEventT> ? HostEventResponse<HostEventT> : any;
|
|
@@ -54,7 +54,6 @@ describe('HostEventClient', () => {
|
|
|
54
54
|
type: apiName,
|
|
55
55
|
parameters,
|
|
56
56
|
},
|
|
57
|
-
undefined,
|
|
58
57
|
);
|
|
59
58
|
expect(result).toEqual(await triggerResponse);
|
|
60
59
|
});
|
|
@@ -149,7 +148,6 @@ describe('HostEventClient', () => {
|
|
|
149
148
|
HostEvent.UIPassthrough,
|
|
150
149
|
'http://localhost',
|
|
151
150
|
{ parameters: payload, type: UIPassthroughEvent.PinAnswerToLiveboard },
|
|
152
|
-
undefined,
|
|
153
151
|
);
|
|
154
152
|
expect(result).toEqual(mockResponse.value);
|
|
155
153
|
});
|
|
@@ -187,7 +185,6 @@ describe('HostEventClient', () => {
|
|
|
187
185
|
parameters: payload,
|
|
188
186
|
type: 'saveAnswer',
|
|
189
187
|
},
|
|
190
|
-
undefined,
|
|
191
188
|
);
|
|
192
189
|
expect(result).toEqual({ answerId: 'newAnswer', ...mockResponse[0].value });
|
|
193
190
|
});
|
|
@@ -201,7 +198,7 @@ describe('HostEventClient', () => {
|
|
|
201
198
|
|
|
202
199
|
const result = await client.triggerHostEvent(hostEvent, payload);
|
|
203
200
|
|
|
204
|
-
expect(client.hostEventFallback).toHaveBeenCalledWith(hostEvent, payload
|
|
201
|
+
expect(client.hostEventFallback).toHaveBeenCalledWith(hostEvent, payload);
|
|
205
202
|
expect(result).toEqual(mockResponse);
|
|
206
203
|
});
|
|
207
204
|
|
|
@@ -226,7 +223,6 @@ describe('HostEventClient', () => {
|
|
|
226
223
|
HostEvent.Pin,
|
|
227
224
|
mockThoughtSpotHost,
|
|
228
225
|
{},
|
|
229
|
-
undefined,
|
|
230
226
|
);
|
|
231
227
|
expect(result).toEqual([mockResponse]);
|
|
232
228
|
});
|
|
@@ -252,7 +248,6 @@ describe('HostEventClient', () => {
|
|
|
252
248
|
HostEvent.Save,
|
|
253
249
|
mockThoughtSpotHost,
|
|
254
250
|
{},
|
|
255
|
-
undefined,
|
|
256
251
|
);
|
|
257
252
|
expect(result).toEqual([mockResponse]);
|
|
258
253
|
});
|
|
@@ -308,7 +303,6 @@ describe('HostEventClient', () => {
|
|
|
308
303
|
parameters: { ...payload, pinboardId: 'test', newPinboardName: 'testLiveboard' },
|
|
309
304
|
type: 'addVizToPinboard',
|
|
310
305
|
},
|
|
311
|
-
undefined,
|
|
312
306
|
);
|
|
313
307
|
expect(result).toEqual({
|
|
314
308
|
pinboardId: 'testLiveboard',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { HostEvent } from '../../types';
|
|
2
2
|
import { processTrigger as processTriggerService } from '../../utils/processTrigger';
|
|
3
3
|
import { getEmbedConfig } from '../embedConfig';
|
|
4
4
|
import {
|
|
@@ -23,7 +23,7 @@ export class HostEventClient {
|
|
|
23
23
|
* @param {any} data Data to send with the host event
|
|
24
24
|
* @returns {Promise<any>} - the response from the process trigger
|
|
25
25
|
*/
|
|
26
|
-
protected async processTrigger(message: HostEvent, data: any
|
|
26
|
+
protected async processTrigger(message: HostEvent, data: any): Promise<any> {
|
|
27
27
|
if (!this.iFrame) {
|
|
28
28
|
throw new Error('Iframe element is not set');
|
|
29
29
|
}
|
|
@@ -34,16 +34,14 @@ export class HostEventClient {
|
|
|
34
34
|
message,
|
|
35
35
|
thoughtspotHost,
|
|
36
36
|
data,
|
|
37
|
-
context,
|
|
38
37
|
);
|
|
39
38
|
}
|
|
40
39
|
|
|
41
40
|
public async handleHostEventWithParam<UIPassthroughEventT extends UIPassthroughEvent>(
|
|
42
41
|
apiName: UIPassthroughEventT,
|
|
43
42
|
parameters: UIPassthroughRequest<UIPassthroughEventT>,
|
|
44
|
-
context?: ContextType,
|
|
45
43
|
): Promise<UIPassthroughResponse<UIPassthroughEventT>> {
|
|
46
|
-
const response = (await this.triggerUIPassthroughApi(apiName, parameters
|
|
44
|
+
const response = (await this.triggerUIPassthroughApi(apiName, parameters))
|
|
47
45
|
?.filter?.((r) => r.error || r.value)[0];
|
|
48
46
|
|
|
49
47
|
if (!response) {
|
|
@@ -67,9 +65,8 @@ export class HostEventClient {
|
|
|
67
65
|
public async hostEventFallback(
|
|
68
66
|
hostEvent: HostEvent,
|
|
69
67
|
data: any,
|
|
70
|
-
context?: ContextType,
|
|
71
68
|
): Promise<any> {
|
|
72
|
-
return this.processTrigger(hostEvent, data
|
|
69
|
+
return this.processTrigger(hostEvent, data);
|
|
73
70
|
}
|
|
74
71
|
|
|
75
72
|
/**
|
|
@@ -83,22 +80,20 @@ export class HostEventClient {
|
|
|
83
80
|
public async triggerUIPassthroughApi<UIPassthroughEventT extends UIPassthroughEvent>(
|
|
84
81
|
apiName: UIPassthroughEventT,
|
|
85
82
|
parameters: UIPassthroughRequest<UIPassthroughEventT>,
|
|
86
|
-
context?: ContextType,
|
|
87
83
|
): Promise<UIPassthroughArrayResponse<UIPassthroughEventT>> {
|
|
88
84
|
const res = await this.processTrigger(HostEvent.UIPassthrough, {
|
|
89
85
|
type: apiName,
|
|
90
86
|
parameters,
|
|
91
|
-
}
|
|
87
|
+
});
|
|
92
88
|
|
|
93
89
|
return res;
|
|
94
90
|
}
|
|
95
91
|
|
|
96
92
|
protected async handlePinEvent(
|
|
97
93
|
payload: HostEventRequest<HostEvent.Pin>,
|
|
98
|
-
|
|
99
|
-
): Promise<HostEventResponse<HostEvent.Pin, ContextType>> {
|
|
94
|
+
): Promise<HostEventResponse<HostEvent.Pin>> {
|
|
100
95
|
if (!payload || !('newVizName' in payload)) {
|
|
101
|
-
return this.hostEventFallback(HostEvent.Pin, payload
|
|
96
|
+
return this.hostEventFallback(HostEvent.Pin, payload);
|
|
102
97
|
}
|
|
103
98
|
|
|
104
99
|
const formattedPayload = {
|
|
@@ -109,7 +104,6 @@ export class HostEventClient {
|
|
|
109
104
|
|
|
110
105
|
const data = await this.handleHostEventWithParam(
|
|
111
106
|
UIPassthroughEvent.PinAnswerToLiveboard, formattedPayload,
|
|
112
|
-
context as ContextType,
|
|
113
107
|
);
|
|
114
108
|
|
|
115
109
|
return {
|
|
@@ -120,16 +114,14 @@ export class HostEventClient {
|
|
|
120
114
|
|
|
121
115
|
protected async handleSaveAnswerEvent(
|
|
122
116
|
payload: HostEventRequest<HostEvent.SaveAnswer>,
|
|
123
|
-
context?: ContextType,
|
|
124
117
|
): Promise<any> {
|
|
125
118
|
if (!payload || !('name' in payload) || !('description' in payload)) {
|
|
126
119
|
// Save is the fallback for SaveAnswer
|
|
127
|
-
return this.hostEventFallback(HostEvent.Save, payload
|
|
120
|
+
return this.hostEventFallback(HostEvent.Save, payload);
|
|
128
121
|
}
|
|
129
122
|
|
|
130
123
|
const data = await this.handleHostEventWithParam(
|
|
131
124
|
UIPassthroughEvent.SaveAnswer, payload,
|
|
132
|
-
context as ContextType,
|
|
133
125
|
);
|
|
134
126
|
return {
|
|
135
127
|
...data,
|
|
@@ -140,22 +132,19 @@ export class HostEventClient {
|
|
|
140
132
|
public async triggerHostEvent<
|
|
141
133
|
HostEventT extends HostEvent,
|
|
142
134
|
PayloadT,
|
|
143
|
-
ContextT extends ContextType,
|
|
144
135
|
>(
|
|
145
136
|
hostEvent: HostEventT,
|
|
146
137
|
payload?: TriggerPayload<PayloadT, HostEventT>,
|
|
147
|
-
|
|
148
|
-
): Promise<TriggerResponse<PayloadT, HostEventT, ContextType>> {
|
|
138
|
+
): Promise<TriggerResponse<PayloadT, HostEventT>> {
|
|
149
139
|
switch (hostEvent) {
|
|
150
140
|
case HostEvent.Pin:
|
|
151
|
-
return this.handlePinEvent(payload as HostEventRequest<HostEvent.Pin
|
|
141
|
+
return this.handlePinEvent(payload as HostEventRequest<HostEvent.Pin>) as any;
|
|
152
142
|
case HostEvent.SaveAnswer:
|
|
153
143
|
return this.handleSaveAnswerEvent(
|
|
154
144
|
payload as HostEventRequest<HostEvent.SaveAnswer>,
|
|
155
|
-
context as ContextType,
|
|
156
145
|
) as any;
|
|
157
146
|
default:
|
|
158
|
-
return this.hostEventFallback(hostEvent, payload
|
|
147
|
+
return this.hostEventFallback(hostEvent, payload);
|
|
159
148
|
}
|
|
160
149
|
}
|
|
161
150
|
}
|
|
@@ -1495,7 +1495,7 @@ describe('Liveboard/viz embed tests', () => {
|
|
|
1495
1495
|
await liveboardEmbed.trigger(HostEvent.Save);
|
|
1496
1496
|
expect(mockProcessTrigger).toHaveBeenCalledWith(HostEvent.Save, {
|
|
1497
1497
|
vizId: 'testViz',
|
|
1498
|
-
}
|
|
1498
|
+
});
|
|
1499
1499
|
});
|
|
1500
1500
|
});
|
|
1501
1501
|
});
|
package/src/embed/liveboard.ts
CHANGED
|
@@ -22,13 +22,12 @@ import {
|
|
|
22
22
|
LiveboardAppEmbedViewConfig,
|
|
23
23
|
ErrorDetailsTypes,
|
|
24
24
|
EmbedErrorCodes,
|
|
25
|
-
ContextType,
|
|
26
25
|
} from '../types';
|
|
27
26
|
import { calculateVisibleElementData, getQueryParamString, isUndefined, isValidCssMargin } from '../utils';
|
|
28
27
|
import { getAuthPromise } from './base';
|
|
29
28
|
import { TsEmbed, V1Embed } from './ts-embed';
|
|
30
29
|
import { addPreviewStylesIfNotPresent } from '../utils/global-styles';
|
|
31
|
-
import { TriggerPayload, TriggerResponse
|
|
30
|
+
import { TriggerPayload, TriggerResponse } from './hostEventClient/contracts';
|
|
32
31
|
import { logger } from '../utils/logger';
|
|
33
32
|
|
|
34
33
|
|
|
@@ -643,7 +642,6 @@ export class LiveboardEmbed extends V1Embed {
|
|
|
643
642
|
}
|
|
644
643
|
|
|
645
644
|
private sendFullHeightLazyLoadData = () => {
|
|
646
|
-
console.log('sendFullHeightLazyLoadData', this.iFrame);
|
|
647
645
|
const data = calculateVisibleElementData(this.iFrame);
|
|
648
646
|
this.trigger(HostEvent.VisibleEmbedCoordinates, data);
|
|
649
647
|
}
|
|
@@ -802,11 +800,10 @@ export class LiveboardEmbed extends V1Embed {
|
|
|
802
800
|
* @param {any} data The payload to send with the message
|
|
803
801
|
* @returns A promise that resolves with the response from the embedded app
|
|
804
802
|
*/
|
|
805
|
-
public trigger<HostEventT extends HostEvent, PayloadT
|
|
803
|
+
public trigger<HostEventT extends HostEvent, PayloadT>(
|
|
806
804
|
messageType: HostEventT,
|
|
807
805
|
data: TriggerPayload<PayloadT, HostEventT> = ({} as any),
|
|
808
|
-
|
|
809
|
-
): Promise<TriggerResponse<PayloadT, HostEventT, ContextT>> {
|
|
806
|
+
): Promise<TriggerResponse<PayloadT, HostEventT>> {
|
|
810
807
|
const dataWithVizId: any = data;
|
|
811
808
|
if (messageType === HostEvent.SetActiveTab) {
|
|
812
809
|
this.setActiveTab(data as { tabId: string });
|
|
@@ -815,7 +812,7 @@ export class LiveboardEmbed extends V1Embed {
|
|
|
815
812
|
if (typeof dataWithVizId === 'object' && this.viewConfig.vizId) {
|
|
816
813
|
dataWithVizId.vizId = this.viewConfig.vizId;
|
|
817
814
|
}
|
|
818
|
-
return super.trigger(messageType, dataWithVizId
|
|
815
|
+
return super.trigger(messageType, dataWithVizId);
|
|
819
816
|
}
|
|
820
817
|
/**
|
|
821
818
|
* Destroys the ThoughtSpot embed, and remove any nodes from the DOM.
|
|
@@ -892,16 +889,6 @@ export class LiveboardEmbed extends V1Embed {
|
|
|
892
889
|
|
|
893
890
|
return url;
|
|
894
891
|
}
|
|
895
|
-
|
|
896
|
-
/**
|
|
897
|
-
* Get the current context of the embedded liveboard.
|
|
898
|
-
* @returns The current context object containing the page type and object ids.
|
|
899
|
-
* @version SDK: 1.46.0 | ThoughtSpot: 26.3.0.cl
|
|
900
|
-
*/
|
|
901
|
-
public async getCurrentContext(): Promise<PageContextOptions> {
|
|
902
|
-
const context = await super.getCurrentContext();
|
|
903
|
-
return context;
|
|
904
|
-
}
|
|
905
892
|
}
|
|
906
893
|
|
|
907
894
|
/**
|
package/src/embed/sage.ts
CHANGED
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
* @author Mourya Balabhadra <mourya.balabhadra@thoughtspot.com>
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import { PageContextOptions } from './hostEventClient/contracts';
|
|
10
9
|
import { DOMSelector, Param, BaseViewConfig, SearchLiveboardCommonViewConfig } from '../types';
|
|
11
10
|
import { getQueryParamString } from '../utils';
|
|
12
11
|
import { V1Embed } from './ts-embed';
|
|
@@ -230,14 +229,4 @@ export class SageEmbed extends V1Embed {
|
|
|
230
229
|
|
|
231
230
|
return this;
|
|
232
231
|
}
|
|
233
|
-
|
|
234
|
-
/**
|
|
235
|
-
* Get the current context of the embedded SageEmbed.
|
|
236
|
-
* @returns The current context object containing the page type and object ids.
|
|
237
|
-
* @version SDK: 1.46.0 | ThoughtSpot: 26.3.0.cl
|
|
238
|
-
*/
|
|
239
|
-
public async getCurrentContext(): Promise<PageContextOptions> {
|
|
240
|
-
const context = await super.getCurrentContext();
|
|
241
|
-
return context;
|
|
242
|
-
}
|
|
243
232
|
}
|
package/src/embed/search-bar.tsx
CHANGED
|
@@ -2,7 +2,6 @@ import { SearchLiveboardCommonViewConfig, BaseViewConfig, DefaultAppInitData, Pa
|
|
|
2
2
|
import { getQueryParamString } from '../utils';
|
|
3
3
|
import { TsEmbed } from './ts-embed';
|
|
4
4
|
import { SearchOptions } from './search';
|
|
5
|
-
import { PageContextOptions } from './hostEventClient/contracts';
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* @group Embed components
|
|
@@ -199,14 +198,4 @@ export class SearchBarEmbed extends TsEmbed {
|
|
|
199
198
|
const defaultAppInitData = await super.getAppInitData();
|
|
200
199
|
return { ...defaultAppInitData, ...this.getSearchInitData() };
|
|
201
200
|
}
|
|
202
|
-
|
|
203
|
-
/**
|
|
204
|
-
* Get the current context of the embedded search bar.
|
|
205
|
-
* @returns The current context object containing the page type and object ids.
|
|
206
|
-
* @version SDK: 1.46.0 | ThoughtSpot: 26.3.0.cl
|
|
207
|
-
*/
|
|
208
|
-
public async getCurrentContext(): Promise<PageContextOptions> {
|
|
209
|
-
const context = await super.getCurrentContext();
|
|
210
|
-
return context;
|
|
211
|
-
}
|
|
212
201
|
}
|
package/src/embed/search.ts
CHANGED
|
@@ -27,7 +27,6 @@ import { getAuthPromise } from './base';
|
|
|
27
27
|
import { getReleaseVersion } from '../auth';
|
|
28
28
|
import { getEmbedConfig } from './embedConfig';
|
|
29
29
|
import { getInterceptInitData } from '../api-intercept';
|
|
30
|
-
import { PageContextOptions } from './hostEventClient/contracts';
|
|
31
30
|
|
|
32
31
|
/**
|
|
33
32
|
* Configuration for search options.
|
|
@@ -524,14 +523,4 @@ export class SearchEmbed extends TsEmbed {
|
|
|
524
523
|
});
|
|
525
524
|
return this;
|
|
526
525
|
}
|
|
527
|
-
|
|
528
|
-
/**
|
|
529
|
-
* Get the current context of the embedded search.
|
|
530
|
-
* @returns The current context object containing the page type and object ids.
|
|
531
|
-
* @version SDK: 1.46.0 | ThoughtSpot: 26.3.0.cl
|
|
532
|
-
*/
|
|
533
|
-
public async getCurrentContext(): Promise<PageContextOptions> {
|
|
534
|
-
const context = await super.getCurrentContext();
|
|
535
|
-
return context;
|
|
536
|
-
}
|
|
537
526
|
}
|
|
@@ -204,7 +204,6 @@ describe('Unit test case for ts embed', () => {
|
|
|
204
204
|
parameters: payload,
|
|
205
205
|
type: UIPassthroughEvent.PinAnswerToLiveboard,
|
|
206
206
|
},
|
|
207
|
-
undefined,
|
|
208
207
|
);
|
|
209
208
|
});
|
|
210
209
|
});
|
|
@@ -225,7 +224,6 @@ describe('Unit test case for ts embed', () => {
|
|
|
225
224
|
HostEvent.Save,
|
|
226
225
|
'http://tshost',
|
|
227
226
|
{},
|
|
228
|
-
undefined,
|
|
229
227
|
);
|
|
230
228
|
});
|
|
231
229
|
});
|
|
@@ -247,7 +245,6 @@ describe('Unit test case for ts embed', () => {
|
|
|
247
245
|
HostEvent.Save,
|
|
248
246
|
'http://tshost',
|
|
249
247
|
false,
|
|
250
|
-
undefined,
|
|
251
248
|
);
|
|
252
249
|
});
|
|
253
250
|
});
|
|
@@ -1334,7 +1331,6 @@ describe('Unit test case for ts embed', () => {
|
|
|
1334
1331
|
HostEvent.InfoSuccess,
|
|
1335
1332
|
'http://tshost',
|
|
1336
1333
|
expect.objectContaining({ info: expect.any(Object) }),
|
|
1337
|
-
undefined,
|
|
1338
1334
|
);
|
|
1339
1335
|
});
|
|
1340
1336
|
});
|
|
@@ -1471,7 +1467,6 @@ describe('Unit test case for ts embed', () => {
|
|
|
1471
1467
|
HostEvent.InfoSuccess,
|
|
1472
1468
|
'http://tshost',
|
|
1473
1469
|
expect.objectContaining({ info: expect.any(Object) }),
|
|
1474
|
-
undefined,
|
|
1475
1470
|
);
|
|
1476
1471
|
});
|
|
1477
1472
|
});
|
|
@@ -1486,7 +1481,6 @@ describe('Unit test case for ts embed', () => {
|
|
|
1486
1481
|
HostEvent.InfoSuccess,
|
|
1487
1482
|
'http://tshost',
|
|
1488
1483
|
expect.objectContaining({ info: expect.any(Object) }),
|
|
1489
|
-
undefined,
|
|
1490
1484
|
);
|
|
1491
1485
|
});
|
|
1492
1486
|
});
|
|
@@ -1501,7 +1495,6 @@ describe('Unit test case for ts embed', () => {
|
|
|
1501
1495
|
HostEvent.InfoSuccess,
|
|
1502
1496
|
'http://tshost',
|
|
1503
1497
|
expect.objectContaining({ info: expect.any(Object) }),
|
|
1504
|
-
undefined,
|
|
1505
1498
|
);
|
|
1506
1499
|
});
|
|
1507
1500
|
});
|
|
@@ -1516,7 +1509,6 @@ describe('Unit test case for ts embed', () => {
|
|
|
1516
1509
|
HostEvent.InfoSuccess,
|
|
1517
1510
|
'http://tshost',
|
|
1518
1511
|
expect.objectContaining({ info: expect.any(Object) }),
|
|
1519
|
-
undefined,
|
|
1520
1512
|
);
|
|
1521
1513
|
});
|
|
1522
1514
|
});
|
|
@@ -4063,7 +4055,7 @@ describe('Destroy error handling', () => {
|
|
|
4063
4055
|
}).not.toThrow();
|
|
4064
4056
|
|
|
4065
4057
|
expect(logSpy).toHaveBeenCalledWith('Error destroying TS Embed', expect.any(Error));
|
|
4066
|
-
logSpy.
|
|
4058
|
+
logSpy.mockRestore();
|
|
4067
4059
|
});
|
|
4068
4060
|
});
|
|
4069
4061
|
|
|
@@ -4106,12 +4098,11 @@ describe('Fullscreen change handler behavior', () => {
|
|
|
4106
4098
|
document.dispatchEvent(event);
|
|
4107
4099
|
|
|
4108
4100
|
await executeAfterWait(() => {
|
|
4109
|
-
expect(mockProcessTrigger).
|
|
4101
|
+
expect(mockProcessTrigger).toHaveBeenCalledWith(
|
|
4110
4102
|
expect.any(Object),
|
|
4111
4103
|
HostEvent.ExitPresentMode,
|
|
4112
4104
|
expect.any(String),
|
|
4113
4105
|
expect.any(Object),
|
|
4114
|
-
undefined,
|
|
4115
4106
|
);
|
|
4116
4107
|
});
|
|
4117
4108
|
});
|
|
@@ -4204,14 +4195,13 @@ describe('ShowPreRender with UpdateEmbedParams', () => {
|
|
|
4204
4195
|
embed2.showPreRender();
|
|
4205
4196
|
|
|
4206
4197
|
await executeAfterWait(() => {
|
|
4207
|
-
expect(mockProcessTrigger).
|
|
4198
|
+
expect(mockProcessTrigger).toHaveBeenCalledWith(
|
|
4208
4199
|
expect.any(Object),
|
|
4209
4200
|
HostEvent.UpdateEmbedParams,
|
|
4210
4201
|
expect.any(String),
|
|
4211
4202
|
expect.objectContaining({
|
|
4212
4203
|
liveboardId: 'updated-lb',
|
|
4213
4204
|
}),
|
|
4214
|
-
undefined,
|
|
4215
4205
|
);
|
|
4216
4206
|
});
|
|
4217
4207
|
});
|
|
@@ -4240,7 +4230,7 @@ describe('ShowPreRender with UpdateEmbedParams', () => {
|
|
|
4240
4230
|
embed2.showPreRender();
|
|
4241
4231
|
|
|
4242
4232
|
await executeAfterWait(() => {
|
|
4243
|
-
expect(mockProcessTrigger).
|
|
4233
|
+
expect(mockProcessTrigger).toHaveBeenCalledWith(
|
|
4244
4234
|
expect.any(Object),
|
|
4245
4235
|
HostEvent.UpdateEmbedParams,
|
|
4246
4236
|
expect.any(String),
|
|
@@ -4260,7 +4250,6 @@ describe('ShowPreRender with UpdateEmbedParams', () => {
|
|
|
4260
4250
|
},
|
|
4261
4251
|
],
|
|
4262
4252
|
}),
|
|
4263
|
-
undefined,
|
|
4264
4253
|
);
|
|
4265
4254
|
});
|
|
4266
4255
|
});
|
|
@@ -4293,7 +4282,7 @@ describe('ShowPreRender with UpdateEmbedParams', () => {
|
|
|
4293
4282
|
embed2.showPreRender();
|
|
4294
4283
|
|
|
4295
4284
|
await executeAfterWait(() => {
|
|
4296
|
-
expect(mockProcessTrigger).
|
|
4285
|
+
expect(mockProcessTrigger).toHaveBeenCalledWith(
|
|
4297
4286
|
expect.any(Object),
|
|
4298
4287
|
HostEvent.UpdateEmbedParams,
|
|
4299
4288
|
expect.any(String),
|
|
@@ -4308,7 +4297,6 @@ describe('ShowPreRender with UpdateEmbedParams', () => {
|
|
|
4308
4297
|
},
|
|
4309
4298
|
],
|
|
4310
4299
|
}),
|
|
4311
|
-
undefined,
|
|
4312
4300
|
);
|
|
4313
4301
|
});
|
|
4314
4302
|
});
|
package/src/embed/ts-embed.ts
CHANGED
|
@@ -60,7 +60,6 @@ import {
|
|
|
60
60
|
EmbedErrorDetailsEvent,
|
|
61
61
|
ErrorDetailsTypes,
|
|
62
62
|
EmbedErrorCodes,
|
|
63
|
-
ContextType,
|
|
64
63
|
} from '../types';
|
|
65
64
|
import { uploadMixpanelEvent, MIXPANEL_EVENT } from '../mixpanel-service';
|
|
66
65
|
import { processEventData, processAuthFailure } from '../utils/processData';
|
|
@@ -76,7 +75,6 @@ import { ERROR_MESSAGE } from '../errors';
|
|
|
76
75
|
import { getPreauthInfo } from '../utils/sessionInfoService';
|
|
77
76
|
import { HostEventClient } from './hostEventClient/host-event-client';
|
|
78
77
|
import { getInterceptInitData, handleInterceptEvent, processApiInterceptResponse, processLegacyInterceptResponse } from '../api-intercept';
|
|
79
|
-
import { getHostEventsConfig } from '../utils';
|
|
80
78
|
|
|
81
79
|
const { version } = pkgInfo;
|
|
82
80
|
|
|
@@ -482,7 +480,6 @@ export class TsEmbed {
|
|
|
482
480
|
hiddenListColumns: this.viewConfig.hiddenListColumns || [],
|
|
483
481
|
customActions: customActionsResult.actions,
|
|
484
482
|
...getInterceptInitData(this.viewConfig),
|
|
485
|
-
...getHostEventsConfig(this.viewConfig),
|
|
486
483
|
};
|
|
487
484
|
|
|
488
485
|
return baseInitData;
|
|
@@ -1350,11 +1347,10 @@ export class TsEmbed {
|
|
|
1350
1347
|
* @param {any} data The payload to send with the message
|
|
1351
1348
|
* @returns A promise that resolves with the response from the embedded app
|
|
1352
1349
|
*/
|
|
1353
|
-
public async trigger<HostEventT extends HostEvent, PayloadT
|
|
1350
|
+
public async trigger<HostEventT extends HostEvent, PayloadT>(
|
|
1354
1351
|
messageType: HostEventT,
|
|
1355
1352
|
data: TriggerPayload<PayloadT, HostEventT> = {} as any,
|
|
1356
|
-
|
|
1357
|
-
): Promise<TriggerResponse<PayloadT, HostEventT, ContextT>> {
|
|
1353
|
+
): Promise<TriggerResponse<PayloadT, HostEventT>> {
|
|
1358
1354
|
uploadMixpanelEvent(`${MIXPANEL_EVENT.VISUAL_SDK_TRIGGER}-${messageType}`);
|
|
1359
1355
|
|
|
1360
1356
|
if (!this.isRendered) {
|
|
@@ -1387,7 +1383,7 @@ export class TsEmbed {
|
|
|
1387
1383
|
}
|
|
1388
1384
|
|
|
1389
1385
|
// send an empty object, this is needed for liveboard default handlers
|
|
1390
|
-
return this.hostEventClient.triggerHostEvent(messageType, data
|
|
1386
|
+
return this.hostEventClient.triggerHostEvent(messageType, data);
|
|
1391
1387
|
}
|
|
1392
1388
|
|
|
1393
1389
|
/**
|
|
@@ -1429,20 +1425,6 @@ export class TsEmbed {
|
|
|
1429
1425
|
return this.render();
|
|
1430
1426
|
}
|
|
1431
1427
|
|
|
1432
|
-
/**
|
|
1433
|
-
* Get the current context of the embedded TS component.
|
|
1434
|
-
* @returns The current context object containing the page type and object ids.
|
|
1435
|
-
* @version SDK: 1.46.0 | ThoughtSpot: 26.3.0.cl
|
|
1436
|
-
*/
|
|
1437
|
-
public async getCurrentContext(): Promise<any> {
|
|
1438
|
-
return new Promise((resolve) => {
|
|
1439
|
-
this.executeAfterEmbedContainerLoaded(async () => {
|
|
1440
|
-
const context = await this.trigger(HostEvent.GetPageContext, {});
|
|
1441
|
-
resolve(context);
|
|
1442
|
-
});
|
|
1443
|
-
});
|
|
1444
|
-
}
|
|
1445
|
-
|
|
1446
1428
|
/**
|
|
1447
1429
|
* Creates the preRender shell
|
|
1448
1430
|
* @param showPreRenderByDefault - Show the preRender after render, hidden by default
|
package/src/index.ts
CHANGED
|
@@ -68,7 +68,6 @@ import {
|
|
|
68
68
|
InterceptedApiType,
|
|
69
69
|
EmbedErrorCodes,
|
|
70
70
|
ErrorDetailsTypes,
|
|
71
|
-
ContextType,
|
|
72
71
|
} from './types';
|
|
73
72
|
import { CustomCssVariables } from './css-variables';
|
|
74
73
|
import { SageEmbed, SageViewConfig } from './embed/sage';
|
|
@@ -122,7 +121,6 @@ export {
|
|
|
122
121
|
RuntimeFilterOp,
|
|
123
122
|
EmbedEvent,
|
|
124
123
|
HostEvent,
|
|
125
|
-
ContextType,
|
|
126
124
|
DataSourceVisualMode,
|
|
127
125
|
Action,
|
|
128
126
|
ContextMenuTriggerOptions,
|