@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,14 +1,14 @@
|
|
|
1
1
|
import { HostEvent } from '../../types';
|
|
2
|
-
export declare enum
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
export declare enum UIPassthroughEvent {
|
|
3
|
+
PinAnswerToLiveboard = "addVizToPinboard",
|
|
4
|
+
SaveAnswer = "saveAnswer",
|
|
5
|
+
GetDiscoverabilityStatus = "getDiscoverabilityStatus",
|
|
6
|
+
GetAvailableUIPassthroughs = "getAvailableUIPassthroughs",
|
|
7
|
+
GetAnswerConfig = "getAnswerPageConfig",
|
|
8
|
+
GetLiveboardConfig = "getPinboardPageConfig"
|
|
9
9
|
}
|
|
10
|
-
export type
|
|
11
|
-
[
|
|
10
|
+
export type UIPassthroughContractBase = {
|
|
11
|
+
[UIPassthroughEvent.PinAnswerToLiveboard]: {
|
|
12
12
|
request: {
|
|
13
13
|
vizId?: string;
|
|
14
14
|
newVizName: string;
|
|
@@ -24,60 +24,56 @@ export type UiPassthroughContractBase = {
|
|
|
24
24
|
vizId: string;
|
|
25
25
|
};
|
|
26
26
|
};
|
|
27
|
-
[
|
|
27
|
+
[UIPassthroughEvent.SaveAnswer]: {
|
|
28
28
|
request: {
|
|
29
29
|
name: string;
|
|
30
30
|
description: string;
|
|
31
|
-
vizId
|
|
31
|
+
vizId?: string;
|
|
32
32
|
isDiscoverable?: boolean;
|
|
33
33
|
};
|
|
34
34
|
response: {
|
|
35
35
|
answerId: string;
|
|
36
|
-
saveResponse
|
|
36
|
+
saveResponse?: any;
|
|
37
37
|
shareResponse?: any;
|
|
38
|
-
errors?: any;
|
|
39
38
|
};
|
|
40
39
|
};
|
|
41
|
-
[
|
|
40
|
+
[UIPassthroughEvent.GetDiscoverabilityStatus]: {
|
|
42
41
|
request: any;
|
|
43
42
|
response: {
|
|
44
43
|
shouldShowDiscoverability: boolean;
|
|
45
44
|
isDiscoverabilityCheckboxUnselectedPerOrg: boolean;
|
|
46
45
|
};
|
|
47
46
|
};
|
|
48
|
-
[
|
|
47
|
+
[UIPassthroughEvent.GetAvailableUIPassthroughs]: {
|
|
49
48
|
request: any;
|
|
50
49
|
response: {
|
|
51
50
|
keys: string[];
|
|
52
51
|
};
|
|
53
52
|
};
|
|
54
|
-
[
|
|
53
|
+
[UIPassthroughEvent.GetAnswerConfig]: {
|
|
55
54
|
request: {
|
|
56
55
|
vizId?: string;
|
|
57
56
|
};
|
|
58
57
|
response: any;
|
|
59
58
|
};
|
|
60
|
-
[
|
|
59
|
+
[UIPassthroughEvent.GetLiveboardConfig]: {
|
|
61
60
|
request: any;
|
|
62
61
|
response: any;
|
|
63
62
|
};
|
|
64
63
|
};
|
|
65
|
-
export type
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
export type UiPassthroughRequest<T extends keyof UiPassthroughContractBase> = FlattenType<UiPassthroughContractBase[T]['request']>;
|
|
69
|
-
export type UiPassthroughResponse<T extends keyof UiPassthroughContractBase> = FlattenType<UiPassthroughContractBase[T]['response']>;
|
|
70
|
-
export type UiPassthroughArrayResponse<ApiName extends keyof UiPassthroughContractBase> = Promise<Array<{
|
|
64
|
+
export type UIPassthroughRequest<T extends keyof UIPassthroughContractBase> = UIPassthroughContractBase[T]['request'];
|
|
65
|
+
export type UIPassthroughResponse<T extends keyof UIPassthroughContractBase> = UIPassthroughContractBase[T]['response'];
|
|
66
|
+
export type UIPassthroughArrayResponse<ApiName extends keyof UIPassthroughContractBase> = Array<{
|
|
71
67
|
redId?: string;
|
|
72
|
-
value?:
|
|
68
|
+
value?: UIPassthroughResponse<ApiName>;
|
|
73
69
|
error?: any;
|
|
74
|
-
}
|
|
70
|
+
}>;
|
|
75
71
|
export type EmbedApiHostEventMapping = {
|
|
76
|
-
[HostEvent.Pin]:
|
|
77
|
-
[HostEvent.SaveAnswer]:
|
|
72
|
+
[HostEvent.Pin]: UIPassthroughEvent.PinAnswerToLiveboard;
|
|
73
|
+
[HostEvent.SaveAnswer]: UIPassthroughEvent.SaveAnswer;
|
|
78
74
|
};
|
|
79
|
-
export type HostEventRequest<HostEventT extends HostEvent> = HostEventT extends keyof EmbedApiHostEventMapping ?
|
|
80
|
-
export type HostEventResponse<HostEventT extends HostEvent> = HostEventT extends keyof EmbedApiHostEventMapping ?
|
|
81
|
-
|
|
82
|
-
|
|
75
|
+
export type HostEventRequest<HostEventT extends HostEvent> = HostEventT extends keyof EmbedApiHostEventMapping ? UIPassthroughRequest<EmbedApiHostEventMapping[HostEventT]> : any;
|
|
76
|
+
export type HostEventResponse<HostEventT extends HostEvent> = HostEventT extends keyof EmbedApiHostEventMapping ? UIPassthroughResponse<EmbedApiHostEventMapping[HostEventT]> : any;
|
|
77
|
+
export type TriggerPayload<PayloadT, HostEventT extends HostEvent> = PayloadT | HostEventRequest<HostEventT>;
|
|
78
|
+
export type TriggerResponse<PayloadT, HostEventT extends HostEvent> = PayloadT extends HostEventRequest<HostEventT> ? HostEventResponse<HostEventT> : any;
|
|
83
79
|
//# sourceMappingURL=contracts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["contracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,oBAAY,kBAAkB;IAC5B,
|
|
1
|
+
{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["contracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,oBAAY,kBAAkB;IAC5B,oBAAoB,qBAAqB;IACzC,UAAU,eAAe;IACzB,wBAAwB,6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,GAAG,CAAC;AAGV,MAAM,MAAM,cAAc,CAAC,QAAQ,EAAE,UAAU,SAAS,SAAS,IAC/D,QAAQ,GAAG,gBAAgB,CAAC,UAAU,CAAC,CAAC;AAC1C,MAAM,MAAM,eAAe,CAAC,QAAQ,EAAE,UAAU,SAAS,SAAS,IAChE,QAAQ,SAAS,gBAAgB,CAAC,UAAU,CAAC,GAAG,iBAAiB,CAAC,UAAU,CAAC,GAAG,GAAG,CAAC"}
|
|
@@ -1,11 +1,25 @@
|
|
|
1
1
|
import { HostEvent } from '../../types';
|
|
2
|
-
import {
|
|
2
|
+
import { UIPassthroughArrayResponse, UIPassthroughEvent, HostEventRequest, HostEventResponse, UIPassthroughRequest, UIPassthroughResponse, TriggerPayload, TriggerResponse } from './contracts';
|
|
3
3
|
export declare class HostEventClient {
|
|
4
|
-
|
|
5
|
-
constructor(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
iFrame: HTMLIFrameElement;
|
|
5
|
+
constructor(iFrame?: HTMLIFrameElement);
|
|
6
|
+
/**
|
|
7
|
+
* A wrapper over process trigger to
|
|
8
|
+
* @param {HostEvent} message Host event to send
|
|
9
|
+
* @param {any} data Data to send with the host event
|
|
10
|
+
* @returns {Promise<any>} - the response from the process trigger
|
|
11
|
+
*/
|
|
12
|
+
protected processTrigger(message: HostEvent, data: any): Promise<any>;
|
|
13
|
+
handleHostEventWithParam<UIPassthroughEventT extends UIPassthroughEvent>(apiName: UIPassthroughEventT, parameters: UIPassthroughRequest<UIPassthroughEventT>): Promise<UIPassthroughResponse<UIPassthroughEventT>>;
|
|
14
|
+
hostEventFallback(hostEvent: HostEvent, data: any): Promise<any>;
|
|
15
|
+
/**
|
|
16
|
+
* Setter for the iframe element used for host events
|
|
17
|
+
* @param {HTMLIFrameElement} iFrame - the iframe element to set
|
|
18
|
+
*/
|
|
19
|
+
setIframeElement(iFrame: HTMLIFrameElement): void;
|
|
20
|
+
triggerUIPassthroughApi<UIPassthroughEventT extends UIPassthroughEvent>(apiName: UIPassthroughEventT, parameters: UIPassthroughRequest<UIPassthroughEventT>): Promise<UIPassthroughArrayResponse<UIPassthroughEventT>>;
|
|
21
|
+
protected handlePinEvent(payload: HostEventRequest<HostEvent.Pin>): Promise<HostEventResponse<HostEvent.Pin>>;
|
|
22
|
+
protected handleSaveAnswerEvent(payload: HostEventRequest<HostEvent.SaveAnswer>): Promise<any>;
|
|
23
|
+
triggerHostEvent<HostEventT extends HostEvent, PayloadT>(hostEvent: HostEventT, payload?: TriggerPayload<PayloadT, HostEventT>): Promise<TriggerResponse<PayloadT, HostEventT>>;
|
|
10
24
|
}
|
|
11
25
|
//# sourceMappingURL=host-event-client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host-event-client.d.ts","sourceRoot":"","sources":["host-event-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"host-event-client.d.ts","sourceRoot":"","sources":["host-event-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,OAAO,EACH,0BAA0B,EAC1B,kBAAkB,EAAE,gBAAgB,EAAE,iBAAiB,EACvD,oBAAoB,EACpB,qBAAqB,EACrB,cAAc,EACd,eAAe,EAClB,MAAM,aAAa,CAAC;AAOrB,qBAAa,eAAe;IAC1B,MAAM,EAAE,iBAAiB,CAAC;gBAEd,MAAM,CAAC,EAAE,iBAAiB;IAItC;;;;;OAKG;cACa,cAAc,CAAC,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IAc9D,wBAAwB,CAAC,mBAAmB,SAAS,kBAAkB,EAChF,OAAO,EAAE,mBAAmB,EAC5B,UAAU,EAAE,oBAAoB,CAAC,mBAAmB,CAAC,GACtD,OAAO,CAAC,qBAAqB,CAAC,mBAAmB,CAAC,CAAC;IAsBzC,iBAAiB,CAC1B,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,GAAG,GACV,OAAO,CAAC,GAAG,CAAC;IAIf;;;OAGG;IACI,gBAAgB,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI;IAI3C,uBAAuB,CAAC,mBAAmB,SAAS,kBAAkB,EAC/E,OAAO,EAAE,mBAAmB,EAC5B,UAAU,EAAE,oBAAoB,CAAC,mBAAmB,CAAC,GACtD,OAAO,CAAC,0BAA0B,CAAC,mBAAmB,CAAC,CAAC;cAS3C,cAAc,CAC1B,OAAO,EAAE,gBAAgB,CAAC,SAAS,CAAC,GAAG,CAAC,GACzC,OAAO,CAAC,iBAAiB,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;cAU5B,qBAAqB,CACjC,OAAO,EAAE,gBAAgB,CAAC,SAAS,CAAC,UAAU,CAAC,GAChD,OAAO,CAAC,GAAG,CAAC;IAeF,gBAAgB,CAC3B,UAAU,SAAS,SAAS,EAC5B,QAAQ,EAEN,SAAS,EAAE,UAAU,EACrB,OAAO,CAAC,EAAE,cAAc,CAAC,QAAQ,EAAE,UAAU,CAAC,GAC/C,OAAO,CAAC,eAAe,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;CAYlD"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @summary Base classes
|
|
6
6
|
* @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
|
|
7
7
|
*/
|
|
8
|
-
import {
|
|
8
|
+
import { TriggerPayload, TriggerResponse, UIPassthroughArrayResponse, UIPassthroughEvent, UIPassthroughRequest } from './hostEventClient/contracts';
|
|
9
9
|
import { AnswerService } from '../utils/graphql/answerService/answerService';
|
|
10
10
|
import { DOMSelector, HostEvent, EmbedEvent, MessageCallback, EmbedConfig, MessageOptions, ViewConfig } from '../types';
|
|
11
11
|
import { HostEventClient } from './hostEventClient/host-event-client';
|
|
@@ -40,6 +40,11 @@ export declare class TsEmbed {
|
|
|
40
40
|
* will be rendered.
|
|
41
41
|
*/
|
|
42
42
|
protected iFrame: HTMLIFrameElement;
|
|
43
|
+
/**
|
|
44
|
+
* Setter for the iframe element
|
|
45
|
+
* @param {HTMLIFrameElement} iFrame HTMLIFrameElement
|
|
46
|
+
*/
|
|
47
|
+
protected setIframeElement(iFrame: HTMLIFrameElement): void;
|
|
43
48
|
protected viewConfig: ViewConfig;
|
|
44
49
|
protected embedConfig: EmbedConfig;
|
|
45
50
|
/**
|
|
@@ -252,19 +257,19 @@ export declare class TsEmbed {
|
|
|
252
257
|
private triggerEventOnPort;
|
|
253
258
|
/**
|
|
254
259
|
* Triggers an event to the embedded app
|
|
255
|
-
* @param messageType The event type
|
|
256
|
-
* @param data The payload to send with the message
|
|
260
|
+
* @param {HostEvent} messageType The event type
|
|
261
|
+
* @param {any} data The payload to send with the message
|
|
257
262
|
* @returns A promise that resolves with the response from the embedded app
|
|
258
263
|
*/
|
|
259
|
-
trigger<HostEventT extends HostEvent>(messageType: HostEventT, data?:
|
|
264
|
+
trigger<HostEventT extends HostEvent, PayloadT>(messageType: HostEventT, data?: TriggerPayload<PayloadT, HostEventT>): Promise<TriggerResponse<PayloadT, HostEventT>>;
|
|
260
265
|
/**
|
|
261
266
|
* Triggers an event to the embedded app, skipping the UI flow.
|
|
262
|
-
* @param {
|
|
263
|
-
* @param {
|
|
264
|
-
* @returns {Promise<
|
|
267
|
+
* @param {UIPassthroughEvent} apiName - The name of the API to be triggered.
|
|
268
|
+
* @param {UIPassthroughRequest} parameters - The parameters to be passed to the API.
|
|
269
|
+
* @returns {Promise<UIPassthroughRequest>} - A promise that resolves with the response
|
|
265
270
|
* from the embedded app.
|
|
266
271
|
*/
|
|
267
|
-
|
|
272
|
+
triggerUIPassThrough<UIPassthroughEventT extends UIPassthroughEvent>(apiName: UIPassthroughEventT, parameters: UIPassthroughRequest<UIPassthroughEventT>): Promise<UIPassthroughArrayResponse<UIPassthroughEventT>>;
|
|
268
273
|
/**
|
|
269
274
|
* Marks the ThoughtSpot object to have been rendered
|
|
270
275
|
* Needs to be overridden by subclasses to do the actual
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ts-embed.d.ts","sourceRoot":"","sources":["ts-embed.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,
|
|
1
|
+
{"version":3,"file":"ts-embed.d.ts","sourceRoot":"","sources":["ts-embed.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,EAGH,cAAc,EACd,eAAe,EACf,0BAA0B,EAC1B,kBAAkB,EAClB,oBAAoB,EACvB,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EAAE,aAAa,EAAE,MAAM,8CAA8C,CAAC;AAwB7E,OAAO,EAEH,WAAW,EACX,SAAS,EACT,UAAU,EACV,eAAe,EAGf,WAAW,EACX,cAAc,EAGd,UAAU,EAIb,MAAM,UAAU,CAAC;AAWlB,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAItE;;GAEG;AACH,eAAO,MAAM,wBAAwB,QAAQ,CAAC;AAW9C;;;;GAIG;AACH,qBAAa,OAAO;IAChB;;;;;OAKG;IACH,SAAS,CAAC,aAAa,EAAE,IAAI,CAAC;IAE9B;;OAEG;IACH,SAAS,CAAC,EAAE,EAAE,WAAW,CAAC;IAE1B;;OAEG;IACH,SAAS,CAAC,YAAY,SAAe;IAErC,SAAS,CAAC,gBAAgB,UAAS;IAEnC;;;OAGG;IACH,SAAS,CAAC,MAAM,EAAE,iBAAiB,CAAC;IAEpC;;;OAGG;IACH,SAAS,CAAC,gBAAgB,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI;IAK3D,SAAS,CAAC,UAAU,EAAE,UAAU,CAAC;IAEjC,SAAS,CAAC,WAAW,EAAE,WAAW,CAAC;IAEnC;;OAEG;IACH,SAAS,CAAC,eAAe,EAAE,MAAM,CAAC;IAKlC,SAAS,CAAC,iBAAiB,EAAE,MAAM,CAAC;IAEpC;;;;OAIG;IACH,OA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AMG;IACI,eAAe;;;;IAOtB;;;;;OAKG;IACU,gBAAgB,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;CAIxE;AAED;;;;;GAKG;AACH,qBAAa,OAAQ,SAAQ,OAAO;IAChC,SAAS,CAAC,UAAU,EAAE,UAAU,CAAC;gBAErB,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU;IAK5D;;;OAGG;IACH,SAAS,CAAC,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAIxD,SAAS,CAAC,gBAAgB,IAAI,MAAM;IAqBpC;;;;;;;;;;;;;;;;OAgBG;IACI,EAAE,CACL,WAAW,EAAE,UAAU,EACvB,QAAQ,EAAE,eAAe,EACzB,OAAO,GAAE,cAAiC,GAC3C,OAAO,OAAO,CAAC,SAAS;IAK3B;;;OAGG;IAEI,sBAAsB,6EAAyB;CACzD"}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ import { uploadMixpanelEvent, MIXPANEL_EVENT } from './mixpanel-service';
|
|
|
24
24
|
import { tokenizedFetch } from './tokenizedFetch';
|
|
25
25
|
import { getAnswerFromQuery } from './utils/graphql/nlsService/nls-answer-service';
|
|
26
26
|
import { createLiveboardWithAnswers } from './utils/liveboardService/liveboardService';
|
|
27
|
-
import {
|
|
28
|
-
export { init, logout, prefetch, executeTML, exportTML, executeTMLInput, exportTMLInput, getEmbedConfig as getInitConfig, getSessionInfo, tokenizedFetch, getAnswerFromQuery, createLiveboardWithAnswers, SearchEmbed, SearchBarEmbed, PinboardEmbed, LiveboardEmbed, SageEmbed, AppEmbed, BodylessConversation, BodylessConversationViewConfig, ConversationEmbed, ConversationViewConfig, AuthFailureType, AuthStatus, AuthEvent, AuthEventEmitter, AnswerService, SessionInterface, UnderlyingDataPoint, Page, AuthType, RuntimeFilter, RuntimeFilterOp, EmbedEvent, HostEvent, DataSourceVisualMode, Action, ContextMenuTriggerOptions, EmbedConfig, SearchViewConfig, SearchBarViewConfig, LiveboardViewConfig, SageViewConfig, AppViewConfig, PrefetchFeatures, FrameParams, HomeLeftNavItem, HomepageModule, DOMSelector, MessageOptions, MessageCallback, MessagePayload, CustomisationsInterface, CustomStyles, customCssInterface, CustomCssVariables, RuntimeParameter, LogLevel, uploadMixpanelEvent, MIXPANEL_EVENT, HomePageSearchBarMode, VizPoint, CustomActionPayload,
|
|
27
|
+
import { UIPassthroughEvent } from './embed/hostEventClient/contracts';
|
|
28
|
+
export { init, logout, prefetch, executeTML, exportTML, executeTMLInput, exportTMLInput, getEmbedConfig as getInitConfig, getSessionInfo, tokenizedFetch, getAnswerFromQuery, createLiveboardWithAnswers, SearchEmbed, SearchBarEmbed, PinboardEmbed, LiveboardEmbed, SageEmbed, AppEmbed, BodylessConversation, BodylessConversationViewConfig, ConversationEmbed, ConversationViewConfig, AuthFailureType, AuthStatus, AuthEvent, AuthEventEmitter, AnswerService, SessionInterface, UnderlyingDataPoint, Page, AuthType, RuntimeFilter, RuntimeFilterOp, EmbedEvent, HostEvent, DataSourceVisualMode, Action, ContextMenuTriggerOptions, EmbedConfig, SearchViewConfig, SearchBarViewConfig, LiveboardViewConfig, SageViewConfig, AppViewConfig, PrefetchFeatures, FrameParams, HomeLeftNavItem, HomepageModule, DOMSelector, MessageOptions, MessageCallback, MessagePayload, CustomisationsInterface, CustomStyles, customCssInterface, CustomCssVariables, RuntimeParameter, LogLevel, uploadMixpanelEvent, MIXPANEL_EVENT, HomePageSearchBarMode, VizPoint, CustomActionPayload, UIPassthroughEvent, };
|
|
29
29
|
export { resetCachedAuthToken } from './authToken';
|
|
30
30
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { SearchEmbed, PreRenderedSearchEmbed, LiveboardEmbed, PreRenderedLiveboardEmbed, SearchBarEmbed, PreRenderedSearchBarEmbed, AppEmbed, PreRenderedAppEmbed, SageEmbed, PreRenderedSageEmbed, useEmbedRef, } from './index';
|
|
2
|
-
export { init, logout, prefetch, getInitConfig, getSessionInfo, uploadMixpanelEvent, PinboardEmbed, AuthFailureType, AuthStatus, AuthEvent, AuthEventEmitter, Page, AuthType, RuntimeFilter, RuntimeFilterOp, EmbedEvent, HostEvent, DataSourceVisualMode, Action, EmbedConfig, SearchViewConfig, SearchBarViewConfig, LiveboardViewConfig, SageViewConfig, AppViewConfig, PrefetchFeatures, FrameParams, DOMSelector, MessageOptions, MessageCallback, MessagePayload, CustomisationsInterface, CustomStyles, customCssInterface, CustomCssVariables, RuntimeParameter, resetCachedAuthToken,
|
|
2
|
+
export { init, logout, prefetch, getInitConfig, getSessionInfo, uploadMixpanelEvent, PinboardEmbed, AuthFailureType, AuthStatus, AuthEvent, AuthEventEmitter, Page, AuthType, RuntimeFilter, RuntimeFilterOp, EmbedEvent, HostEvent, DataSourceVisualMode, Action, EmbedConfig, SearchViewConfig, SearchBarViewConfig, LiveboardViewConfig, SageViewConfig, AppViewConfig, PrefetchFeatures, FrameParams, DOMSelector, MessageOptions, MessageCallback, MessagePayload, CustomisationsInterface, CustomStyles, customCssInterface, CustomCssVariables, RuntimeParameter, resetCachedAuthToken, UIPassthroughEvent, } from '../index';
|
|
3
3
|
//# sourceMappingURL=all-types-export.d.ts.map
|
package/dist/src/types.d.ts
CHANGED
package/dist/tsembed-react.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* @thoughtspot/visual-embed-sdk version 1.35.5-hostEvent.
|
|
1
|
+
/* @thoughtspot/visual-embed-sdk version 1.35.5-hostEvent.7 */
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import React__default from 'react';
|
|
4
4
|
|
|
@@ -2672,7 +2672,7 @@ var HostEvent;
|
|
|
2672
2672
|
* EmbedApi
|
|
2673
2673
|
* @hidden
|
|
2674
2674
|
*/
|
|
2675
|
-
HostEvent["
|
|
2675
|
+
HostEvent["UIPassthrough"] = "UiPassthrough";
|
|
2676
2676
|
})(HostEvent || (HostEvent = {}));
|
|
2677
2677
|
/**
|
|
2678
2678
|
* The different visual modes that the data sources panel within
|
|
@@ -7160,7 +7160,7 @@ class AnswerService {
|
|
|
7160
7160
|
async getTML() {
|
|
7161
7161
|
const { object } = await this.executeQuery(getAnswerTML, {});
|
|
7162
7162
|
const edoc = object[0].edoc;
|
|
7163
|
-
const YAML = await import('./index-
|
|
7163
|
+
const YAML = await import('./index-DaLHJaLd.js');
|
|
7164
7164
|
const parsedDoc = YAML.parse(edoc);
|
|
7165
7165
|
return {
|
|
7166
7166
|
answer: {
|
|
@@ -14503,7 +14503,7 @@ function processEventData(type, e, thoughtSpotHost, containerEl) {
|
|
|
14503
14503
|
return e;
|
|
14504
14504
|
}
|
|
14505
14505
|
|
|
14506
|
-
var name="@thoughtspot/visual-embed-sdk";var version$1="1.35.5-hostEvent.
|
|
14506
|
+
var name="@thoughtspot/visual-embed-sdk";var version$1="1.35.5-hostEvent.7";var description="ThoughtSpot Embed SDK";var module="lib/src/index.js";var main="dist/tsembed.js";var types="lib/src/index.d.ts";var files=["dist/**","lib/**","src/**","cjs/**"];var exports={".":{"import":"./lib/src/index.js",require:"./cjs/src/index.js",types:"./lib/src/index.d.ts"},"./react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"},"./lib/src/react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"}};var typesVersions={"*":{react:["./lib/src/react/all-types-export.d.ts"]}};var scripts={lint:"eslint 'src/**'","lint:fix":"eslint 'src/**/*.*' --fix",tsc:"tsc -p . --incremental false; tsc -p . --incremental false --module commonjs --outDir cjs","build-and-publish":"npm run build:gatsby && npm run publish","bundle-dts-file":"dts-bundle --name @thoughtspot/visual-embed-sdk --out visual-embed-sdk.d.ts --main lib/src/index.d.ts","bundle-dts":"dts-bundle --name ../../dist/visual-embed-sdk --main lib/src/index.d.ts --outputAsModuleFolder=true","bundle-dts-react":"dts-bundle --name ../../../dist/visual-embed-sdk-react --main lib/src/react/index.d.ts --outputAsModuleFolder=true","bundle-dts-react-full":"dts-bundle --name ../../../dist/visual-embed-sdk-react-full --main lib/src/react/all-types-export.d.ts --outputAsModuleFolder=true",build:"rollup -c",watch:"rollup -cw",docgen:"typedoc --tsconfig tsconfig.json --theme typedoc-theme --json static/typedoc/typedoc.json --disableOutputCheck","test-sdk":"jest -c jest.config.sdk.js --runInBand",test:"npm run test-sdk",posttest:"cat ./coverage/sdk/lcov.info | coveralls","is-publish-allowed":"node scripts/is-publish-allowed.js",prepublishOnly:"npm run is-publish-allowed && npm run test && npm run tsc && npm run bundle-dts-file && npm run bundle-dts && npm run bundle-dts-react && npm run bundle-dts-react-full && npm run build","check-size":"npm run build && size-limit","publish-dev":"npm publish --tag dev","publish-prod":"npm publish --tag latest",dev:"vite -c vite.local.config.ts"};var peerDependencies={react:"> 16.8.0","react-dom":"> 16.8.0"};var dependencies={algoliasearch:"^4.10.5",classnames:"^2.3.1",dompurify:"^2.3.4",eventemitter3:"^4.0.7","gatsby-plugin-vercel":"^1.0.3","html-react-parser":"^1.4.12",lodash:"^4.17.21","mixpanel-browser":"2.47.0","ts-deepmerge":"^6.0.2",tslib:"^2.5.3","use-deep-compare-effect":"^1.8.1",yaml:"^2.5.1"};var devDependencies={"@mdx-js/mdx":"^1.6.22","@mdx-js/react":"^1.6.22","@react-icons/all-files":"^4.1.0","@rollup/plugin-commonjs":"^18.0.0","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^11.2.1","@rollup/plugin-replace":"^5.0.2","@size-limit/preset-big-lib":"^8.2.6","@testing-library/dom":"^7.31.0","@testing-library/jest-dom":"^5.14.1","@testing-library/react":"^11.2.7","@testing-library/user-event":"^13.1.8","@types/jest":"^22.2.3","@types/lodash":"^4.17.0","@types/mixpanel-browser":"^2.35.6","@types/react-test-renderer":"^17.0.1","@typescript-eslint/eslint-plugin":"^4.6.0","@typescript-eslint/parser":"^4.6.0",asciidoctor:"^2.2.1","babel-jest":"^26.6.3","babel-preset-gatsby":"^1.10.0","command-line-args":"^5.1.1",coveralls:"^3.1.0",crypto:"^1.0.1","current-git-branch":"^1.1.0","dts-bundle":"^0.7.3",eslint:"^7.12.1","eslint-config-airbnb-base":"^14.2.0","eslint-config-prettier":"^6.15.0","eslint-import-resolver-typescript":"^2.3.0","eslint-plugin-import":"^2.22.1","eslint-plugin-prettier":"^3.1.4","eslint-plugin-react-hooks":"^4.2.0","eslint-plugin-comment-length":"1.7.3","eslint-plugin-jsdoc":"^46.9.0","fs-extra":"^10.0.0","gh-pages":"^3.1.0","highlight.js":"^10.6.0","html-to-text":"^8.0.0","identity-obj-proxy":"^3.0.0","istanbul-merge":"^1.1.1",jest:"^26.6.3","jest-fetch-mock":"^3.0.3",jsdom:"^17.0.0","node-sass":"^8.0.0",prettier:"2.1.2",react:"^16.14.0","react-dom":"^16.14.0","react-resizable":"^1.11.0","react-resize-detector":"^6.6.0","react-test-renderer":"^17.0.2","react-use-flexsearch":"^0.1.1",rollup:"4.24.0","rollup-plugin-typescript2":"0.27.3","ts-jest":"^26.5.5","ts-loader":"8.0.4",typedoc:"0.21.6","typedoc-plugin-toc-group":"thoughtspot/typedoc-plugin-toc-group",typescript:"^4.9.4","url-search-params-polyfill":"^8.1.0",util:"^0.12.4",vite:"^5.3.4"};var author="ThoughtSpot";var email="support@thoughtspot.com";var license="ThoughtSpot Development Tools End User License Agreement";var directories={lib:"lib"};var repository={type:"git",url:"git+https://github.com/thoughtspot/visual-embed-sdk.git"};var publishConfig={registry:"https://registry.npmjs.org"};var keywords=["thoughtspot","everywhere","embedded","embed","sdk","analytics"];var bugs={url:"https://github.com/thoughtspot/visual-embed-sdk/issues"};var homepage="https://github.com/thoughtspot/visual-embed-sdk#readme";var globals={window:{}};var pkgInfo = {name:name,version:version$1,description:description,module:module,main:main,types:types,files:files,exports:exports,typesVersions:typesVersions,"size-limit":[{path:"dist/tsembed.es.js",limit:"31 kB"}],scripts:scripts,peerDependencies:peerDependencies,dependencies:dependencies,devDependencies:devDependencies,author:author,email:email,license:license,directories:directories,repository:repository,publishConfig:publishConfig,keywords:keywords,bugs:bugs,homepage:homepage,globals:globals};
|
|
14507
14507
|
|
|
14508
14508
|
/**
|
|
14509
14509
|
* Reloads the ThoughtSpot iframe.
|
|
@@ -14563,61 +14563,94 @@ function processTrigger(iFrame, messageType, thoughtSpotHost, data) {
|
|
|
14563
14563
|
});
|
|
14564
14564
|
}
|
|
14565
14565
|
|
|
14566
|
-
var
|
|
14567
|
-
(function (
|
|
14568
|
-
|
|
14569
|
-
|
|
14570
|
-
|
|
14571
|
-
|
|
14572
|
-
|
|
14573
|
-
|
|
14574
|
-
})(
|
|
14566
|
+
var UIPassthroughEvent;
|
|
14567
|
+
(function (UIPassthroughEvent) {
|
|
14568
|
+
UIPassthroughEvent["PinAnswerToLiveboard"] = "addVizToPinboard";
|
|
14569
|
+
UIPassthroughEvent["SaveAnswer"] = "saveAnswer";
|
|
14570
|
+
UIPassthroughEvent["GetDiscoverabilityStatus"] = "getDiscoverabilityStatus";
|
|
14571
|
+
UIPassthroughEvent["GetAvailableUIPassthroughs"] = "getAvailableUIPassthroughs";
|
|
14572
|
+
UIPassthroughEvent["GetAnswerConfig"] = "getAnswerPageConfig";
|
|
14573
|
+
UIPassthroughEvent["GetLiveboardConfig"] = "getPinboardPageConfig";
|
|
14574
|
+
})(UIPassthroughEvent || (UIPassthroughEvent = {}));
|
|
14575
14575
|
|
|
14576
14576
|
class HostEventClient {
|
|
14577
|
-
constructor(
|
|
14578
|
-
this.
|
|
14577
|
+
constructor(iFrame) {
|
|
14578
|
+
this.iFrame = iFrame;
|
|
14579
14579
|
}
|
|
14580
|
-
|
|
14581
|
-
|
|
14582
|
-
|
|
14583
|
-
|
|
14584
|
-
|
|
14585
|
-
|
|
14580
|
+
/**
|
|
14581
|
+
* A wrapper over process trigger to
|
|
14582
|
+
* @param {HostEvent} message Host event to send
|
|
14583
|
+
* @param {any} data Data to send with the host event
|
|
14584
|
+
* @returns {Promise<any>} - the response from the process trigger
|
|
14585
|
+
*/
|
|
14586
|
+
async processTrigger(message, data) {
|
|
14587
|
+
if (!this.iFrame) {
|
|
14588
|
+
throw new Error('Iframe element is not set');
|
|
14589
|
+
}
|
|
14590
|
+
const thoughtspotHost = getEmbedConfig().thoughtSpotHost;
|
|
14591
|
+
return processTrigger(this.iFrame, message, thoughtspotHost, data);
|
|
14586
14592
|
}
|
|
14587
|
-
async
|
|
14588
|
-
var _a, _b, _c;
|
|
14589
|
-
const response = (_b = (_a = (await this.
|
|
14593
|
+
async handleHostEventWithParam(apiName, parameters) {
|
|
14594
|
+
var _a, _b, _c, _d;
|
|
14595
|
+
const response = (_b = (_a = (await this.triggerUIPassthroughApi(apiName, parameters))) === null || _a === void 0 ? void 0 : _a.filter) === null || _b === void 0 ? void 0 : _b.call(_a, (r) => r.error || r.value)[0];
|
|
14590
14596
|
if (!response) {
|
|
14591
14597
|
const error = `No answer found${parameters.vizId ? ` for vizId: ${parameters.vizId}` : ''}.`;
|
|
14592
14598
|
// eslint-disable-next-line no-throw-literal
|
|
14593
14599
|
throw { error };
|
|
14594
14600
|
}
|
|
14595
|
-
const errors = response.error
|
|
14601
|
+
const errors = response.error
|
|
14602
|
+
|| ((_c = response.value) === null || _c === void 0 ? void 0 : _c.errors)
|
|
14603
|
+
|| ((_d = response.value) === null || _d === void 0 ? void 0 : _d.error);
|
|
14596
14604
|
if (errors) {
|
|
14597
14605
|
// eslint-disable-next-line no-throw-literal
|
|
14598
14606
|
throw { error: response.error };
|
|
14599
14607
|
}
|
|
14600
14608
|
return { ...response.value };
|
|
14601
14609
|
}
|
|
14602
|
-
async hostEventFallback(
|
|
14603
|
-
return processTrigger(
|
|
14610
|
+
async hostEventFallback(hostEvent, data) {
|
|
14611
|
+
return this.processTrigger(hostEvent, data);
|
|
14612
|
+
}
|
|
14613
|
+
/**
|
|
14614
|
+
* Setter for the iframe element used for host events
|
|
14615
|
+
* @param {HTMLIFrameElement} iFrame - the iframe element to set
|
|
14616
|
+
*/
|
|
14617
|
+
setIframeElement(iFrame) {
|
|
14618
|
+
this.iFrame = iFrame;
|
|
14619
|
+
}
|
|
14620
|
+
async triggerUIPassthroughApi(apiName, parameters) {
|
|
14621
|
+
const res = await this.processTrigger(HostEvent.UIPassthrough, {
|
|
14622
|
+
type: apiName,
|
|
14623
|
+
parameters,
|
|
14624
|
+
});
|
|
14625
|
+
return res;
|
|
14626
|
+
}
|
|
14627
|
+
async handlePinEvent(payload) {
|
|
14628
|
+
if (!payload || !('newVizName' in payload)) {
|
|
14629
|
+
return this.hostEventFallback(HostEvent.Pin, payload);
|
|
14630
|
+
}
|
|
14631
|
+
return this.handleHostEventWithParam(UIPassthroughEvent.PinAnswerToLiveboard, payload);
|
|
14604
14632
|
}
|
|
14605
|
-
async
|
|
14633
|
+
async handleSaveAnswerEvent(payload) {
|
|
14606
14634
|
var _a, _b, _c, _d;
|
|
14607
|
-
if (
|
|
14608
|
-
|
|
14635
|
+
if (!payload || !('name' in payload) || !('description' in payload)) {
|
|
14636
|
+
// Save is the fallback for SaveAnswer
|
|
14637
|
+
return this.hostEventFallback(HostEvent.Save, payload);
|
|
14609
14638
|
}
|
|
14610
|
-
|
|
14611
|
-
|
|
14612
|
-
|
|
14613
|
-
|
|
14614
|
-
|
|
14615
|
-
|
|
14639
|
+
const data = await this.handleHostEventWithParam(UIPassthroughEvent.SaveAnswer, payload);
|
|
14640
|
+
return {
|
|
14641
|
+
...data,
|
|
14642
|
+
answerId: (_d = (_c = (_b = (_a = data === null || data === void 0 ? void 0 : data.saveResponse) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.Answer__save) === null || _c === void 0 ? void 0 : _c.answer) === null || _d === void 0 ? void 0 : _d.id,
|
|
14643
|
+
};
|
|
14644
|
+
}
|
|
14645
|
+
async triggerHostEvent(hostEvent, payload) {
|
|
14646
|
+
switch (hostEvent) {
|
|
14647
|
+
case HostEvent.Pin:
|
|
14648
|
+
return this.handlePinEvent(payload);
|
|
14649
|
+
case HostEvent.SaveAnswer:
|
|
14650
|
+
return this.handleSaveAnswerEvent(payload);
|
|
14651
|
+
default:
|
|
14652
|
+
return this.hostEventFallback(hostEvent, payload);
|
|
14616
14653
|
}
|
|
14617
|
-
// fallback for save answer is Save
|
|
14618
|
-
if (hostEvent === HostEvent.SaveAnswer)
|
|
14619
|
-
hostEvent = HostEvent.Save;
|
|
14620
|
-
return this.hostEventFallback(iFrame, hostEvent, payload);
|
|
14621
14654
|
}
|
|
14622
14655
|
}
|
|
14623
14656
|
|
|
@@ -14647,6 +14680,14 @@ const V1EventMap = {};
|
|
|
14647
14680
|
* React+GraphQL
|
|
14648
14681
|
*/
|
|
14649
14682
|
class TsEmbed {
|
|
14683
|
+
/**
|
|
14684
|
+
* Setter for the iframe element
|
|
14685
|
+
* @param {HTMLIFrameElement} iFrame HTMLIFrameElement
|
|
14686
|
+
*/
|
|
14687
|
+
setIframeElement(iFrame) {
|
|
14688
|
+
this.iFrame = iFrame;
|
|
14689
|
+
this.hostEventClient.setIframeElement(iFrame);
|
|
14690
|
+
}
|
|
14650
14691
|
constructor(domSelector, viewConfig) {
|
|
14651
14692
|
/**
|
|
14652
14693
|
* The key to store the embed instance in the DOM node
|
|
@@ -14775,7 +14816,7 @@ class TsEmbed {
|
|
|
14775
14816
|
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_EMBED_CREATE, {
|
|
14776
14817
|
...viewConfig,
|
|
14777
14818
|
});
|
|
14778
|
-
this.hostEventClient = new HostEventClient(this.
|
|
14819
|
+
this.hostEventClient = new HostEventClient(this.iFrame);
|
|
14779
14820
|
}
|
|
14780
14821
|
/**
|
|
14781
14822
|
* Throws error encountered during initialization.
|
|
@@ -15096,7 +15137,7 @@ class TsEmbed {
|
|
|
15096
15137
|
this.handleInsertionIntoDOM(this.embedConfig.loginFailedMessage);
|
|
15097
15138
|
return;
|
|
15098
15139
|
}
|
|
15099
|
-
this.
|
|
15140
|
+
this.setIframeElement(this.iFrame || this.createIframeEl(url));
|
|
15100
15141
|
this.iFrame.addEventListener('load', () => {
|
|
15101
15142
|
nextInQueue();
|
|
15102
15143
|
const loadTimestamp = Date.now();
|
|
@@ -15155,7 +15196,7 @@ class TsEmbed {
|
|
|
15155
15196
|
if (this.preRenderWrapper && this.preRenderChild) {
|
|
15156
15197
|
this.isPreRendered = true;
|
|
15157
15198
|
if (this.preRenderChild instanceof HTMLIFrameElement) {
|
|
15158
|
-
this.
|
|
15199
|
+
this.setIframeElement(this.preRenderChild);
|
|
15159
15200
|
}
|
|
15160
15201
|
this.insertedDomEl = this.preRenderWrapper;
|
|
15161
15202
|
this.isRendered = true;
|
|
@@ -15193,7 +15234,7 @@ class TsEmbed {
|
|
|
15193
15234
|
this.preRenderChild = preRenderChild;
|
|
15194
15235
|
this.preRenderWrapper = preRenderWrapper;
|
|
15195
15236
|
if (preRenderChild instanceof HTMLIFrameElement) {
|
|
15196
|
-
this.
|
|
15237
|
+
this.setIframeElement(preRenderChild);
|
|
15197
15238
|
}
|
|
15198
15239
|
this.insertedDomEl = preRenderWrapper;
|
|
15199
15240
|
if (this.showPreRenderByDefault) {
|
|
@@ -15392,11 +15433,11 @@ class TsEmbed {
|
|
|
15392
15433
|
}
|
|
15393
15434
|
/**
|
|
15394
15435
|
* Triggers an event to the embedded app
|
|
15395
|
-
* @param messageType The event type
|
|
15396
|
-
* @param data The payload to send with the message
|
|
15436
|
+
* @param {HostEvent} messageType The event type
|
|
15437
|
+
* @param {any} data The payload to send with the message
|
|
15397
15438
|
* @returns A promise that resolves with the response from the embedded app
|
|
15398
15439
|
*/
|
|
15399
|
-
trigger(messageType, data) {
|
|
15440
|
+
async trigger(messageType, data) {
|
|
15400
15441
|
uploadMixpanelEvent(`${MIXPANEL_EVENT.VISUAL_SDK_TRIGGER}-${messageType}`);
|
|
15401
15442
|
if (!this.isRendered) {
|
|
15402
15443
|
this.handleError('Please call render before triggering events');
|
|
@@ -15406,18 +15447,18 @@ class TsEmbed {
|
|
|
15406
15447
|
this.handleError('Host event type is undefined');
|
|
15407
15448
|
return null;
|
|
15408
15449
|
}
|
|
15409
|
-
return this.hostEventClient.
|
|
15450
|
+
return this.hostEventClient.triggerHostEvent(messageType, data);
|
|
15410
15451
|
}
|
|
15411
15452
|
/**
|
|
15412
15453
|
* Triggers an event to the embedded app, skipping the UI flow.
|
|
15413
|
-
* @param {
|
|
15414
|
-
* @param {
|
|
15415
|
-
* @returns {Promise<
|
|
15454
|
+
* @param {UIPassthroughEvent} apiName - The name of the API to be triggered.
|
|
15455
|
+
* @param {UIPassthroughRequest} parameters - The parameters to be passed to the API.
|
|
15456
|
+
* @returns {Promise<UIPassthroughRequest>} - A promise that resolves with the response
|
|
15416
15457
|
* from the embedded app.
|
|
15417
15458
|
*/
|
|
15418
|
-
|
|
15419
|
-
|
|
15420
|
-
return
|
|
15459
|
+
async triggerUIPassThrough(apiName, parameters) {
|
|
15460
|
+
const response = this.hostEventClient.triggerUIPassthroughApi(apiName, parameters);
|
|
15461
|
+
return response;
|
|
15421
15462
|
}
|
|
15422
15463
|
/**
|
|
15423
15464
|
* Marks the ThoughtSpot object to have been rendered
|