@thoughtspot/visual-embed-sdk 1.35.5-hostEvent.5 → 1.35.5-hostEvent.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 +1 -1
- package/cjs/src/embed/hostEventClient/contracts.d.ts +27 -31
- package/cjs/src/embed/hostEventClient/contracts.d.ts.map +1 -1
- package/cjs/src/embed/hostEventClient/contracts.js +10 -10
- package/cjs/src/embed/hostEventClient/contracts.js.map +1 -1
- package/cjs/src/embed/hostEventClient/host-event-client.d.ts +21 -7
- package/cjs/src/embed/hostEventClient/host-event-client.d.ts.map +1 -1
- package/cjs/src/embed/hostEventClient/host-event-client.js +61 -27
- package/cjs/src/embed/hostEventClient/host-event-client.js.map +1 -1
- package/cjs/src/embed/hostEventClient/host-event-client.spec.js +43 -39
- package/cjs/src/embed/hostEventClient/host-event-client.spec.js.map +1 -1
- package/cjs/src/embed/liveboard.spec.js +4 -2
- package/cjs/src/embed/liveboard.spec.js.map +1 -1
- package/cjs/src/embed/ts-embed.d.ts +13 -8
- package/cjs/src/embed/ts-embed.d.ts.map +1 -1
- package/cjs/src/embed/ts-embed.js +22 -14
- package/cjs/src/embed/ts-embed.js.map +1 -1
- package/cjs/src/embed/ts-embed.spec.js +4 -4
- package/cjs/src/embed/ts-embed.spec.js.map +1 -1
- package/cjs/src/index.d.ts +2 -2
- package/cjs/src/index.js +2 -2
- package/cjs/src/react/all-types-export.d.ts +1 -1
- package/cjs/src/react/all-types-export.js +2 -2
- package/cjs/src/types.d.ts +1 -1
- package/cjs/src/types.js +1 -1
- package/dist/index-DOIjN0N_.js +7370 -0
- package/dist/index-DaLHJaLd.js +7370 -0
- package/dist/src/embed/hostEventClient/contracts.d.ts +27 -31
- package/dist/src/embed/hostEventClient/contracts.d.ts.map +1 -1
- package/dist/src/embed/hostEventClient/host-event-client.d.ts +21 -7
- package/dist/src/embed/hostEventClient/host-event-client.d.ts.map +1 -1
- package/dist/src/embed/ts-embed.d.ts +13 -8
- package/dist/src/embed/ts-embed.d.ts.map +1 -1
- package/dist/src/index.d.ts +2 -2
- package/dist/src/react/all-types-export.d.ts +1 -1
- package/dist/src/types.d.ts +1 -1
- package/dist/tsembed-react.es.js +95 -54
- package/dist/tsembed-react.js +94 -53
- package/dist/tsembed.es.js +96 -55
- package/dist/tsembed.js +94 -53
- package/dist/visual-embed-sdk-react-full.d.ts +61 -46
- package/dist/visual-embed-sdk-react.d.ts +61 -46
- package/dist/visual-embed-sdk.d.ts +61 -46
- package/lib/package.json +1 -1
- package/lib/src/embed/hostEventClient/contracts.d.ts +27 -31
- package/lib/src/embed/hostEventClient/contracts.d.ts.map +1 -1
- package/lib/src/embed/hostEventClient/contracts.js +9 -9
- package/lib/src/embed/hostEventClient/contracts.js.map +1 -1
- package/lib/src/embed/hostEventClient/host-event-client.d.ts +21 -7
- package/lib/src/embed/hostEventClient/host-event-client.d.ts.map +1 -1
- package/lib/src/embed/hostEventClient/host-event-client.js +63 -29
- package/lib/src/embed/hostEventClient/host-event-client.js.map +1 -1
- package/lib/src/embed/hostEventClient/host-event-client.spec.js +43 -40
- package/lib/src/embed/hostEventClient/host-event-client.spec.js.map +1 -1
- package/lib/src/embed/liveboard.spec.js +4 -2
- package/lib/src/embed/liveboard.spec.js.map +1 -1
- package/lib/src/embed/ts-embed.d.ts +13 -8
- package/lib/src/embed/ts-embed.d.ts.map +1 -1
- package/lib/src/embed/ts-embed.js +22 -14
- package/lib/src/embed/ts-embed.js.map +1 -1
- package/lib/src/embed/ts-embed.spec.js +5 -5
- package/lib/src/embed/ts-embed.spec.js.map +1 -1
- package/lib/src/index.d.ts +2 -2
- package/lib/src/index.js +2 -2
- package/lib/src/react/all-types-export.d.ts +1 -1
- package/lib/src/react/all-types-export.js +1 -1
- package/lib/src/types.d.ts +1 -1
- package/lib/src/types.js +1 -1
- package/lib/src/visual-embed-sdk.d.ts +64 -49
- package/package.json +1 -1
- package/src/embed/hostEventClient/contracts.ts +44 -33
- package/src/embed/hostEventClient/host-event-client.spec.ts +58 -54
- package/src/embed/hostEventClient/host-event-client.ts +109 -47
- package/src/embed/liveboard.spec.ts +4 -2
- package/src/embed/ts-embed.spec.ts +6 -6
- package/src/embed/ts-embed.ts +38 -27
- package/src/index.ts +2 -2
- package/src/react/all-types-export.ts +1 -1
- package/src/types.ts +1 -1
|
@@ -1,38 +1,52 @@
|
|
|
1
1
|
import { HostEvent } from '../../types';
|
|
2
|
-
import { processTrigger } from '../../utils/processTrigger';
|
|
2
|
+
import { processTrigger as processTriggerService } from '../../utils/processTrigger';
|
|
3
|
+
import { getEmbedConfig } from '../embedConfig';
|
|
3
4
|
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
UIPassthroughArrayResponse,
|
|
6
|
+
UIPassthroughEvent, HostEventRequest, HostEventResponse,
|
|
7
|
+
UIPassthroughRequest,
|
|
8
|
+
UIPassthroughResponse,
|
|
9
|
+
TriggerPayload,
|
|
10
|
+
TriggerResponse,
|
|
8
11
|
} from './contracts';
|
|
9
12
|
|
|
13
|
+
// Define a type for the eventHandlerMap
|
|
14
|
+
type EventHandlerMap = {
|
|
15
|
+
[K in HostEvent]: any;
|
|
16
|
+
};
|
|
17
|
+
|
|
10
18
|
export class HostEventClient {
|
|
11
|
-
|
|
19
|
+
iFrame: HTMLIFrameElement;
|
|
12
20
|
|
|
13
|
-
constructor(
|
|
14
|
-
this.
|
|
21
|
+
constructor(iFrame?: HTMLIFrameElement) {
|
|
22
|
+
this.iFrame = iFrame;
|
|
15
23
|
}
|
|
16
24
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
/**
|
|
26
|
+
* A wrapper over process trigger to
|
|
27
|
+
* @param {HostEvent} message Host event to send
|
|
28
|
+
* @param {any} data Data to send with the host event
|
|
29
|
+
* @returns {Promise<any>} - the response from the process trigger
|
|
30
|
+
*/
|
|
31
|
+
protected async processTrigger(message: HostEvent, data: any): Promise<any> {
|
|
32
|
+
if (!this.iFrame) {
|
|
33
|
+
throw new Error('Iframe element is not set');
|
|
34
|
+
}
|
|
26
35
|
|
|
27
|
-
|
|
36
|
+
const thoughtspotHost = getEmbedConfig().thoughtSpotHost;
|
|
37
|
+
return processTriggerService(
|
|
38
|
+
this.iFrame,
|
|
39
|
+
message,
|
|
40
|
+
thoughtspotHost,
|
|
41
|
+
data,
|
|
42
|
+
);
|
|
28
43
|
}
|
|
29
44
|
|
|
30
|
-
public async
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
const response = (await this.executeUiPassthroughApi(iFrame, apiName, parameters))
|
|
45
|
+
public async handleHostEventWithParam<UIPassthroughEventT extends UIPassthroughEvent>(
|
|
46
|
+
apiName: UIPassthroughEventT,
|
|
47
|
+
parameters: UIPassthroughRequest<UIPassthroughEventT>,
|
|
48
|
+
): Promise<UIPassthroughResponse<UIPassthroughEventT>> {
|
|
49
|
+
const response = (await this.triggerUIPassthroughApi(apiName, parameters))
|
|
36
50
|
?.filter?.((r) => r.error || r.value)[0];
|
|
37
51
|
|
|
38
52
|
if (!response) {
|
|
@@ -41,7 +55,10 @@ export class HostEventClient {
|
|
|
41
55
|
throw { error };
|
|
42
56
|
}
|
|
43
57
|
|
|
44
|
-
const errors = response.error
|
|
58
|
+
const errors = response.error
|
|
59
|
+
|| (response.value as any)?.errors
|
|
60
|
+
|| (response.value as any)?.error;
|
|
61
|
+
|
|
45
62
|
if (errors) {
|
|
46
63
|
// eslint-disable-next-line no-throw-literal
|
|
47
64
|
throw { error: response.error };
|
|
@@ -51,32 +68,77 @@ export class HostEventClient {
|
|
|
51
68
|
}
|
|
52
69
|
|
|
53
70
|
public async hostEventFallback(
|
|
54
|
-
|
|
71
|
+
hostEvent: HostEvent,
|
|
72
|
+
data: any,
|
|
55
73
|
): Promise<any> {
|
|
56
|
-
return processTrigger(
|
|
74
|
+
return this.processTrigger(hostEvent, data);
|
|
57
75
|
}
|
|
58
76
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
):
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
77
|
+
/**
|
|
78
|
+
* Setter for the iframe element used for host events
|
|
79
|
+
* @param {HTMLIFrameElement} iFrame - the iframe element to set
|
|
80
|
+
*/
|
|
81
|
+
public setIframeElement(iFrame: HTMLIFrameElement): void {
|
|
82
|
+
this.iFrame = iFrame;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
public async triggerUIPassthroughApi<UIPassthroughEventT extends UIPassthroughEvent>(
|
|
86
|
+
apiName: UIPassthroughEventT,
|
|
87
|
+
parameters: UIPassthroughRequest<UIPassthroughEventT>,
|
|
88
|
+
): Promise<UIPassthroughArrayResponse<UIPassthroughEventT>> {
|
|
89
|
+
const res = await this.processTrigger(HostEvent.UIPassthrough, {
|
|
90
|
+
type: apiName,
|
|
91
|
+
parameters,
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
return res;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
protected async handlePinEvent(
|
|
98
|
+
payload: HostEventRequest<HostEvent.Pin>,
|
|
99
|
+
): Promise<HostEventResponse<HostEvent.Pin>> {
|
|
100
|
+
if (!payload || !('newVizName' in payload)) {
|
|
101
|
+
return this.hostEventFallback(HostEvent.Pin, payload);
|
|
68
102
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
103
|
+
|
|
104
|
+
return this.handleHostEventWithParam(
|
|
105
|
+
UIPassthroughEvent.PinAnswerToLiveboard, payload,
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
protected async handleSaveAnswerEvent(
|
|
110
|
+
payload: HostEventRequest<HostEvent.SaveAnswer>,
|
|
111
|
+
): Promise<any> {
|
|
112
|
+
if (!payload || !('name' in payload) || !('description' in payload)) {
|
|
113
|
+
// Save is the fallback for SaveAnswer
|
|
114
|
+
return this.hostEventFallback(HostEvent.Save, payload);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const data = await this.handleHostEventWithParam(
|
|
118
|
+
UIPassthroughEvent.SaveAnswer, payload,
|
|
119
|
+
);
|
|
120
|
+
return {
|
|
121
|
+
...data,
|
|
122
|
+
answerId: data?.saveResponse?.data?.Answer__save?.answer?.id,
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
public async triggerHostEvent<
|
|
127
|
+
HostEventT extends HostEvent,
|
|
128
|
+
PayloadT,
|
|
129
|
+
>(
|
|
130
|
+
hostEvent: HostEventT,
|
|
131
|
+
payload?: TriggerPayload<PayloadT, HostEventT>,
|
|
132
|
+
): Promise<TriggerResponse<PayloadT, HostEventT>> {
|
|
133
|
+
switch (hostEvent) {
|
|
134
|
+
case HostEvent.Pin:
|
|
135
|
+
return this.handlePinEvent(payload as HostEventRequest<HostEvent.Pin>) as any;
|
|
136
|
+
case HostEvent.SaveAnswer:
|
|
137
|
+
return this.handleSaveAnswerEvent(
|
|
138
|
+
payload as HostEventRequest<HostEvent.SaveAnswer>,
|
|
139
|
+
) as any;
|
|
140
|
+
default:
|
|
141
|
+
return this.hostEventFallback(hostEvent, payload);
|
|
77
142
|
}
|
|
78
|
-
// fallback for save answer is Save
|
|
79
|
-
if (hostEvent === HostEvent.SaveAnswer) hostEvent = HostEvent.Save;
|
|
80
|
-
return this.hostEventFallback(iFrame, hostEvent, payload);
|
|
81
143
|
}
|
|
82
144
|
}
|
|
@@ -484,8 +484,10 @@ describe('Liveboard/viz embed tests', () => {
|
|
|
484
484
|
liveboardId,
|
|
485
485
|
} as LiveboardViewConfig);
|
|
486
486
|
liveboardEmbed.render();
|
|
487
|
-
|
|
488
|
-
|
|
487
|
+
await executeAfterWait(async () => {
|
|
488
|
+
await liveboardEmbed.trigger(HostEvent.Pin);
|
|
489
|
+
expect(mockProcessTrigger).toBeCalled();
|
|
490
|
+
});
|
|
489
491
|
});
|
|
490
492
|
|
|
491
493
|
test('should render active tab when activeTab present', async () => {
|
|
@@ -50,7 +50,7 @@ import { logger } from '../utils/logger';
|
|
|
50
50
|
import { version } from '../../package.json';
|
|
51
51
|
import { HiddenActionItemByDefaultForSearchEmbed } from './search';
|
|
52
52
|
import { processTrigger } from '../utils/processTrigger';
|
|
53
|
-
import {
|
|
53
|
+
import { UIPassthroughEvent } from './hostEventClient/contracts';
|
|
54
54
|
|
|
55
55
|
jest.mock('../utils/processTrigger');
|
|
56
56
|
|
|
@@ -142,25 +142,25 @@ describe('Unit test case for ts embed', () => {
|
|
|
142
142
|
});
|
|
143
143
|
});
|
|
144
144
|
|
|
145
|
-
test('
|
|
145
|
+
test('triggerUIPassThrough with params', async () => {
|
|
146
146
|
const searchEmbed = new SearchEmbed(getRootEl(), defaultViewConfig);
|
|
147
147
|
searchEmbed.render();
|
|
148
148
|
mockProcessTrigger.mockResolvedValue({ session: 'test' });
|
|
149
149
|
await executeAfterWait(async () => {
|
|
150
150
|
const payload = { newVizName: 'test' };
|
|
151
151
|
expect(
|
|
152
|
-
await searchEmbed.
|
|
153
|
-
|
|
152
|
+
await searchEmbed.triggerUIPassThrough(
|
|
153
|
+
UIPassthroughEvent.PinAnswerToLiveboard,
|
|
154
154
|
payload,
|
|
155
155
|
),
|
|
156
156
|
);
|
|
157
157
|
expect(mockProcessTrigger).toHaveBeenCalledWith(
|
|
158
158
|
getIFrameEl(),
|
|
159
|
-
HostEvent.
|
|
159
|
+
HostEvent.UIPassthrough,
|
|
160
160
|
'http://tshost',
|
|
161
161
|
{
|
|
162
162
|
parameters: payload,
|
|
163
|
-
type:
|
|
163
|
+
type: UIPassthroughEvent.PinAnswerToLiveboard,
|
|
164
164
|
},
|
|
165
165
|
);
|
|
166
166
|
});
|
package/src/embed/ts-embed.ts
CHANGED
|
@@ -12,9 +12,11 @@ import isObject from 'lodash/isObject';
|
|
|
12
12
|
import {
|
|
13
13
|
HostEventRequest,
|
|
14
14
|
HostEventResponse,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
TriggerPayload,
|
|
16
|
+
TriggerResponse,
|
|
17
|
+
UIPassthroughArrayResponse,
|
|
18
|
+
UIPassthroughEvent,
|
|
19
|
+
UIPassthroughRequest,
|
|
18
20
|
} from './hostEventClient/contracts';
|
|
19
21
|
import { logger } from '../utils/logger';
|
|
20
22
|
import { getAuthenticationToken } from '../authToken';
|
|
@@ -85,7 +87,7 @@ const TS_EMBED_ID = '_thoughtspot-embed';
|
|
|
85
87
|
* We cannot rename v1 event types to maintain backward compatibility
|
|
86
88
|
* @internal
|
|
87
89
|
*/
|
|
88
|
-
const V1EventMap = {};
|
|
90
|
+
const V1EventMap: Record<string, any> = {};
|
|
89
91
|
|
|
90
92
|
/**
|
|
91
93
|
* Base class for embedding v2 experience
|
|
@@ -119,6 +121,15 @@ export class TsEmbed {
|
|
|
119
121
|
*/
|
|
120
122
|
protected iFrame: HTMLIFrameElement;
|
|
121
123
|
|
|
124
|
+
/**
|
|
125
|
+
* Setter for the iframe element
|
|
126
|
+
* @param {HTMLIFrameElement} iFrame HTMLIFrameElement
|
|
127
|
+
*/
|
|
128
|
+
protected setIframeElement(iFrame: HTMLIFrameElement): void {
|
|
129
|
+
this.iFrame = iFrame;
|
|
130
|
+
this.hostEventClient.setIframeElement(iFrame);
|
|
131
|
+
}
|
|
132
|
+
|
|
122
133
|
protected viewConfig: ViewConfig;
|
|
123
134
|
|
|
124
135
|
protected embedConfig: EmbedConfig;
|
|
@@ -190,7 +201,7 @@ export class TsEmbed {
|
|
|
190
201
|
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_EMBED_CREATE, {
|
|
191
202
|
...viewConfig,
|
|
192
203
|
});
|
|
193
|
-
this.hostEventClient = new HostEventClient(this.
|
|
204
|
+
this.hostEventClient = new HostEventClient(this.iFrame);
|
|
194
205
|
}
|
|
195
206
|
|
|
196
207
|
/**
|
|
@@ -252,7 +263,7 @@ export class TsEmbed {
|
|
|
252
263
|
return eventData;
|
|
253
264
|
}
|
|
254
265
|
|
|
255
|
-
private subscribedListeners = {};
|
|
266
|
+
private subscribedListeners: Record<string, any> = {};
|
|
256
267
|
|
|
257
268
|
/**
|
|
258
269
|
* Adds a global event listener to window for "message" events.
|
|
@@ -620,7 +631,7 @@ export class TsEmbed {
|
|
|
620
631
|
this.insertIntoDOM(child);
|
|
621
632
|
}
|
|
622
633
|
if (this.insertedDomEl instanceof Node) {
|
|
623
|
-
this.insertedDomEl[this.embedNodeKey] = this;
|
|
634
|
+
(this.insertedDomEl as any)[this.embedNodeKey] = this;
|
|
624
635
|
}
|
|
625
636
|
}
|
|
626
637
|
|
|
@@ -658,7 +669,7 @@ export class TsEmbed {
|
|
|
658
669
|
return;
|
|
659
670
|
}
|
|
660
671
|
|
|
661
|
-
this.
|
|
672
|
+
this.setIframeElement(this.iFrame || this.createIframeEl(url));
|
|
662
673
|
this.iFrame.addEventListener('load', () => {
|
|
663
674
|
nextInQueue();
|
|
664
675
|
const loadTimestamp = Date.now();
|
|
@@ -728,7 +739,7 @@ export class TsEmbed {
|
|
|
728
739
|
if (this.preRenderWrapper && this.preRenderChild) {
|
|
729
740
|
this.isPreRendered = true;
|
|
730
741
|
if (this.preRenderChild instanceof HTMLIFrameElement) {
|
|
731
|
-
this.
|
|
742
|
+
this.setIframeElement(this.preRenderChild);
|
|
732
743
|
}
|
|
733
744
|
this.insertedDomEl = this.preRenderWrapper;
|
|
734
745
|
this.isRendered = true;
|
|
@@ -777,7 +788,7 @@ export class TsEmbed {
|
|
|
777
788
|
this.preRenderWrapper = preRenderWrapper;
|
|
778
789
|
|
|
779
790
|
if (preRenderChild instanceof HTMLIFrameElement) {
|
|
780
|
-
this.
|
|
791
|
+
this.setIframeElement(preRenderChild);
|
|
781
792
|
}
|
|
782
793
|
this.insertedDomEl = preRenderWrapper;
|
|
783
794
|
|
|
@@ -994,14 +1005,14 @@ export class TsEmbed {
|
|
|
994
1005
|
|
|
995
1006
|
/**
|
|
996
1007
|
* Triggers an event to the embedded app
|
|
997
|
-
* @param messageType The event type
|
|
998
|
-
* @param data The payload to send with the message
|
|
1008
|
+
* @param {HostEvent} messageType The event type
|
|
1009
|
+
* @param {any} data The payload to send with the message
|
|
999
1010
|
* @returns A promise that resolves with the response from the embedded app
|
|
1000
1011
|
*/
|
|
1001
|
-
public trigger<HostEventT extends HostEvent>(
|
|
1012
|
+
public async trigger<HostEventT extends HostEvent, PayloadT>(
|
|
1002
1013
|
messageType: HostEventT,
|
|
1003
|
-
data?:
|
|
1004
|
-
): Promise<
|
|
1014
|
+
data?: TriggerPayload<PayloadT, HostEventT>,
|
|
1015
|
+
): Promise<TriggerResponse<PayloadT, HostEventT>> {
|
|
1005
1016
|
uploadMixpanelEvent(`${MIXPANEL_EVENT.VISUAL_SDK_TRIGGER}-${messageType}`);
|
|
1006
1017
|
|
|
1007
1018
|
if (!this.isRendered) {
|
|
@@ -1014,22 +1025,22 @@ export class TsEmbed {
|
|
|
1014
1025
|
return null;
|
|
1015
1026
|
}
|
|
1016
1027
|
|
|
1017
|
-
return this.hostEventClient.
|
|
1028
|
+
return this.hostEventClient.triggerHostEvent(messageType, data);
|
|
1018
1029
|
}
|
|
1019
1030
|
|
|
1020
1031
|
/**
|
|
1021
1032
|
* Triggers an event to the embedded app, skipping the UI flow.
|
|
1022
|
-
* @param {
|
|
1023
|
-
* @param {
|
|
1024
|
-
* @returns {Promise<
|
|
1033
|
+
* @param {UIPassthroughEvent} apiName - The name of the API to be triggered.
|
|
1034
|
+
* @param {UIPassthroughRequest} parameters - The parameters to be passed to the API.
|
|
1035
|
+
* @returns {Promise<UIPassthroughRequest>} - A promise that resolves with the response
|
|
1025
1036
|
* from the embedded app.
|
|
1026
1037
|
*/
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
return
|
|
1038
|
+
public async triggerUIPassThrough<UIPassthroughEventT extends UIPassthroughEvent>(
|
|
1039
|
+
apiName: UIPassthroughEventT,
|
|
1040
|
+
parameters: UIPassthroughRequest<UIPassthroughEventT>,
|
|
1041
|
+
): Promise<UIPassthroughArrayResponse<UIPassthroughEventT>> {
|
|
1042
|
+
const response = this.hostEventClient.triggerUIPassthroughApi(apiName, parameters);
|
|
1043
|
+
return response;
|
|
1033
1044
|
}
|
|
1034
1045
|
|
|
1035
1046
|
/**
|
|
@@ -1135,14 +1146,14 @@ export class TsEmbed {
|
|
|
1135
1146
|
|
|
1136
1147
|
private validatePreRenderViewConfig = (viewConfig: ViewConfig) => {
|
|
1137
1148
|
const preRenderAllowedKeys = ['preRenderId', 'vizId', 'liveboardId'];
|
|
1138
|
-
const preRenderedObject = this.insertedDomEl?.[this.embedNodeKey] as TsEmbed;
|
|
1149
|
+
const preRenderedObject = (this.insertedDomEl as any)?.[this.embedNodeKey] as TsEmbed;
|
|
1139
1150
|
if (!preRenderedObject) return;
|
|
1140
1151
|
if (viewConfig.preRenderId) {
|
|
1141
1152
|
const allOtherKeys = Object.keys(viewConfig).filter(
|
|
1142
1153
|
(key) => !preRenderAllowedKeys.includes(key) && !key.startsWith('on'),
|
|
1143
1154
|
);
|
|
1144
1155
|
|
|
1145
|
-
allOtherKeys.forEach((key) => {
|
|
1156
|
+
allOtherKeys.forEach((key: keyof ViewConfig) => {
|
|
1146
1157
|
if (
|
|
1147
1158
|
!isUndefined(viewConfig[key])
|
|
1148
1159
|
&& !isEqual(viewConfig[key], preRenderedObject.viewConfig[key])
|
package/src/index.ts
CHANGED
|
@@ -61,7 +61,7 @@ import { uploadMixpanelEvent, MIXPANEL_EVENT } from './mixpanel-service';
|
|
|
61
61
|
import { tokenizedFetch } from './tokenizedFetch';
|
|
62
62
|
import { getAnswerFromQuery } from './utils/graphql/nlsService/nls-answer-service';
|
|
63
63
|
import { createLiveboardWithAnswers } from './utils/liveboardService/liveboardService';
|
|
64
|
-
import {
|
|
64
|
+
import { UIPassthroughEvent } from './embed/hostEventClient/contracts';
|
|
65
65
|
|
|
66
66
|
export {
|
|
67
67
|
init,
|
|
@@ -128,7 +128,7 @@ export {
|
|
|
128
128
|
HomePageSearchBarMode,
|
|
129
129
|
VizPoint,
|
|
130
130
|
CustomActionPayload,
|
|
131
|
-
|
|
131
|
+
UIPassthroughEvent,
|
|
132
132
|
};
|
|
133
133
|
|
|
134
134
|
export { resetCachedAuthToken } from './authToken';
|