@thoughtspot/visual-embed-sdk 1.42.1-HE2 → 1.42.1-HE2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/package.json +2 -2
- package/cjs/src/embed/conversation.d.ts +2 -0
- package/cjs/src/embed/conversation.d.ts.map +1 -1
- package/cjs/src/embed/conversation.js +4 -0
- package/cjs/src/embed/conversation.js.map +1 -1
- package/cjs/src/embed/hostEventClient/contracts.d.ts +13 -2
- package/cjs/src/embed/hostEventClient/contracts.d.ts.map +1 -1
- package/cjs/src/embed/hostEventClient/contracts.js +14 -1
- package/cjs/src/embed/hostEventClient/contracts.js.map +1 -1
- package/cjs/src/embed/hostEventClient/host-event-client.d.ts +5 -5
- package/cjs/src/embed/hostEventClient/host-event-client.d.ts.map +1 -1
- package/cjs/src/embed/hostEventClient/host-event-client.js.map +1 -1
- package/cjs/src/embed/liveboard.d.ts +4 -2
- package/cjs/src/embed/liveboard.d.ts.map +1 -1
- package/cjs/src/embed/liveboard.js +6 -2
- package/cjs/src/embed/liveboard.js.map +1 -1
- package/cjs/src/embed/sage.d.ts +2 -0
- package/cjs/src/embed/sage.d.ts.map +1 -1
- package/cjs/src/embed/sage.js +4 -0
- package/cjs/src/embed/sage.js.map +1 -1
- package/cjs/src/embed/search-bar.d.ts +2 -0
- package/cjs/src/embed/search-bar.d.ts.map +1 -1
- package/cjs/src/embed/search-bar.js +4 -0
- package/cjs/src/embed/search-bar.js.map +1 -1
- package/cjs/src/embed/search.d.ts +2 -0
- package/cjs/src/embed/search.d.ts.map +1 -1
- package/cjs/src/embed/search.js +4 -0
- package/cjs/src/embed/search.js.map +1 -1
- package/cjs/src/embed/ts-embed.d.ts +3 -2
- package/cjs/src/embed/ts-embed.d.ts.map +1 -1
- package/cjs/src/embed/ts-embed.js +13 -1
- package/cjs/src/embed/ts-embed.js.map +1 -1
- package/cjs/src/types.d.ts +10 -1
- package/cjs/src/types.d.ts.map +1 -1
- package/cjs/src/types.js +9 -0
- package/cjs/src/types.js.map +1 -1
- package/cjs/src/utils/processTrigger.d.ts +2 -1
- package/cjs/src/utils/processTrigger.d.ts.map +1 -1
- package/cjs/src/utils/processTrigger.js.map +1 -1
- package/dist/index-BFdRRz03.js +7371 -0
- package/dist/index-UY-4yjBN.js +7371 -0
- package/dist/src/embed/conversation.d.ts +2 -0
- package/dist/src/embed/conversation.d.ts.map +1 -1
- package/dist/src/embed/hostEventClient/contracts.d.ts +13 -2
- package/dist/src/embed/hostEventClient/contracts.d.ts.map +1 -1
- package/dist/src/embed/hostEventClient/host-event-client.d.ts +5 -5
- package/dist/src/embed/hostEventClient/host-event-client.d.ts.map +1 -1
- package/dist/src/embed/liveboard.d.ts +4 -2
- package/dist/src/embed/liveboard.d.ts.map +1 -1
- package/dist/src/embed/sage.d.ts +2 -0
- package/dist/src/embed/sage.d.ts.map +1 -1
- package/dist/src/embed/search-bar.d.ts +2 -0
- package/dist/src/embed/search-bar.d.ts.map +1 -1
- package/dist/src/embed/search.d.ts +2 -0
- package/dist/src/embed/search.d.ts.map +1 -1
- package/dist/src/embed/ts-embed.d.ts +3 -2
- package/dist/src/embed/ts-embed.d.ts.map +1 -1
- package/dist/src/types.d.ts +10 -1
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/utils/processTrigger.d.ts +2 -1
- package/dist/src/utils/processTrigger.d.ts.map +1 -1
- package/dist/tsembed-react.es.js +69 -16
- package/dist/tsembed-react.js +68 -15
- package/dist/tsembed.es.js +69 -16
- package/dist/tsembed.js +68 -15
- package/dist/visual-embed-sdk-react-full.d.ts +53 -9
- package/dist/visual-embed-sdk-react.d.ts +53 -9
- package/dist/visual-embed-sdk.d.ts +53 -9
- package/lib/package.json +2 -2
- package/lib/src/embed/conversation.d.ts +2 -0
- package/lib/src/embed/conversation.d.ts.map +1 -1
- package/lib/src/embed/conversation.js +4 -0
- package/lib/src/embed/conversation.js.map +1 -1
- package/lib/src/embed/hostEventClient/contracts.d.ts +13 -2
- package/lib/src/embed/hostEventClient/contracts.d.ts.map +1 -1
- package/lib/src/embed/hostEventClient/contracts.js +13 -0
- package/lib/src/embed/hostEventClient/contracts.js.map +1 -1
- package/lib/src/embed/hostEventClient/host-event-client.d.ts +5 -5
- package/lib/src/embed/hostEventClient/host-event-client.d.ts.map +1 -1
- package/lib/src/embed/hostEventClient/host-event-client.js.map +1 -1
- package/lib/src/embed/liveboard.d.ts +4 -2
- package/lib/src/embed/liveboard.d.ts.map +1 -1
- package/lib/src/embed/liveboard.js +6 -2
- package/lib/src/embed/liveboard.js.map +1 -1
- package/lib/src/embed/sage.d.ts +2 -0
- package/lib/src/embed/sage.d.ts.map +1 -1
- package/lib/src/embed/sage.js +4 -0
- package/lib/src/embed/sage.js.map +1 -1
- package/lib/src/embed/search-bar.d.ts +2 -0
- package/lib/src/embed/search-bar.d.ts.map +1 -1
- package/lib/src/embed/search-bar.js +4 -0
- package/lib/src/embed/search-bar.js.map +1 -1
- package/lib/src/embed/search.d.ts +2 -0
- package/lib/src/embed/search.d.ts.map +1 -1
- package/lib/src/embed/search.js +4 -0
- package/lib/src/embed/search.js.map +1 -1
- package/lib/src/embed/ts-embed.d.ts +3 -2
- package/lib/src/embed/ts-embed.d.ts.map +1 -1
- package/lib/src/embed/ts-embed.js +13 -1
- package/lib/src/embed/ts-embed.js.map +1 -1
- package/lib/src/types.d.ts +10 -1
- package/lib/src/types.d.ts.map +1 -1
- package/lib/src/types.js +9 -0
- package/lib/src/types.js.map +1 -1
- package/lib/src/utils/processTrigger.d.ts +2 -1
- package/lib/src/utils/processTrigger.d.ts.map +1 -1
- package/lib/src/utils/processTrigger.js.map +1 -1
- package/package.json +2 -2
- package/src/embed/conversation.ts +7 -0
- package/src/embed/hostEventClient/contracts.ts +16 -3
- package/src/embed/hostEventClient/host-event-client.ts +7 -6
- package/src/embed/liveboard.ts +11 -4
- package/src/embed/sage.ts +6 -0
- package/src/embed/search-bar.tsx +6 -0
- package/src/embed/search.ts +7 -0
- package/src/embed/ts-embed.ts +18 -3
- package/src/types.ts +10 -0
- package/src/utils/processTrigger.ts +2 -1
package/src/embed/liveboard.ts
CHANGED
|
@@ -25,8 +25,9 @@ import { calculateVisibleElementData, getQueryParamString, isUndefined } from '.
|
|
|
25
25
|
import { getAuthPromise } from './base';
|
|
26
26
|
import { TsEmbed, V1Embed } from './ts-embed';
|
|
27
27
|
import { addPreviewStylesIfNotPresent } from '../utils/global-styles';
|
|
28
|
-
import { TriggerPayload, TriggerResponse } from './hostEventClient/contracts';
|
|
28
|
+
import { ContextType, TriggerPayload, TriggerResponse } from './hostEventClient/contracts';
|
|
29
29
|
import { logger } from '../utils/logger';
|
|
30
|
+
import { PageContextOptions } from 'visual-embed-sdk';
|
|
30
31
|
|
|
31
32
|
|
|
32
33
|
/**
|
|
@@ -738,10 +739,11 @@ export class LiveboardEmbed extends V1Embed {
|
|
|
738
739
|
* @param {any} data The payload to send with the message
|
|
739
740
|
* @returns A promise that resolves with the response from the embedded app
|
|
740
741
|
*/
|
|
741
|
-
public trigger<HostEventT extends HostEvent, PayloadT>(
|
|
742
|
+
public trigger<HostEventT extends HostEvent, PayloadT, ContextT extends ContextType>(
|
|
742
743
|
messageType: HostEventT,
|
|
743
744
|
data: TriggerPayload<PayloadT, HostEventT> = ({} as any),
|
|
744
|
-
|
|
745
|
+
context?: ContextT,
|
|
746
|
+
): Promise<TriggerResponse<PayloadT, HostEventT, ContextT>> {
|
|
745
747
|
const dataWithVizId: any = data;
|
|
746
748
|
if (messageType === HostEvent.SetActiveTab) {
|
|
747
749
|
this.setActiveTab(data as { tabId: string });
|
|
@@ -750,7 +752,7 @@ export class LiveboardEmbed extends V1Embed {
|
|
|
750
752
|
if (typeof dataWithVizId === 'object' && this.viewConfig.vizId) {
|
|
751
753
|
dataWithVizId.vizId = this.viewConfig.vizId;
|
|
752
754
|
}
|
|
753
|
-
return super.trigger(messageType, dataWithVizId);
|
|
755
|
+
return super.trigger(messageType, dataWithVizId, context);
|
|
754
756
|
}
|
|
755
757
|
/**
|
|
756
758
|
* Destroys the ThoughtSpot embed, and remove any nodes from the DOM.
|
|
@@ -827,6 +829,11 @@ export class LiveboardEmbed extends V1Embed {
|
|
|
827
829
|
|
|
828
830
|
return url;
|
|
829
831
|
}
|
|
832
|
+
|
|
833
|
+
public async getCurrentContext(): Promise<PageContextOptions> {
|
|
834
|
+
const context = await super.getCurrentContext();
|
|
835
|
+
return context;
|
|
836
|
+
}
|
|
830
837
|
}
|
|
831
838
|
|
|
832
839
|
/**
|
package/src/embed/sage.ts
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* @author Mourya Balabhadra <mourya.balabhadra@thoughtspot.com>
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
+
import { PageContextOptions } from 'visual-embed-sdk';
|
|
9
10
|
import { DOMSelector, Param, BaseViewConfig, SearchLiveboardCommonViewConfig } from '../types';
|
|
10
11
|
import { getQueryParamString } from '../utils';
|
|
11
12
|
import { V1Embed } from './ts-embed';
|
|
@@ -229,4 +230,9 @@ export class SageEmbed extends V1Embed {
|
|
|
229
230
|
|
|
230
231
|
return this;
|
|
231
232
|
}
|
|
233
|
+
|
|
234
|
+
public async getCurrentContext(): Promise<PageContextOptions> {
|
|
235
|
+
const context = await super.getCurrentContext();
|
|
236
|
+
return context;
|
|
237
|
+
}
|
|
232
238
|
}
|
package/src/embed/search-bar.tsx
CHANGED
|
@@ -2,6 +2,7 @@ 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 'visual-embed-sdk';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* @group Embed components
|
|
@@ -198,4 +199,9 @@ export class SearchBarEmbed extends TsEmbed {
|
|
|
198
199
|
const defaultAppInitData = await super.getAppInitData();
|
|
199
200
|
return { ...defaultAppInitData, ...this.getSearchInitData() };
|
|
200
201
|
}
|
|
202
|
+
|
|
203
|
+
public async getCurrentContext(): Promise<PageContextOptions> {
|
|
204
|
+
const context = await super.getCurrentContext();
|
|
205
|
+
return context;
|
|
206
|
+
}
|
|
201
207
|
}
|
package/src/embed/search.ts
CHANGED
|
@@ -26,6 +26,8 @@ import { ERROR_MESSAGE } from '../errors';
|
|
|
26
26
|
import { getAuthPromise } from './base';
|
|
27
27
|
import { getReleaseVersion } from '../auth';
|
|
28
28
|
import { getEmbedConfig } from './embedConfig';
|
|
29
|
+
import { PageContextOptions } from 'visual-embed-sdk';
|
|
30
|
+
import { ContextType, PageType } from './hostEventClient/contracts';
|
|
29
31
|
|
|
30
32
|
/**
|
|
31
33
|
* Configuration for search options.
|
|
@@ -536,4 +538,9 @@ export class SearchEmbed extends TsEmbed {
|
|
|
536
538
|
});
|
|
537
539
|
return this;
|
|
538
540
|
}
|
|
541
|
+
|
|
542
|
+
public async getCurrentContext(): Promise<PageContextOptions> {
|
|
543
|
+
const context = await super.getCurrentContext();
|
|
544
|
+
return context;
|
|
545
|
+
}
|
|
539
546
|
}
|
package/src/embed/ts-embed.ts
CHANGED
|
@@ -10,11 +10,13 @@ import isEqual from 'lodash/isEqual';
|
|
|
10
10
|
import isEmpty from 'lodash/isEmpty';
|
|
11
11
|
import isObject from 'lodash/isObject';
|
|
12
12
|
import {
|
|
13
|
+
ContextType,
|
|
13
14
|
TriggerPayload,
|
|
14
15
|
TriggerResponse,
|
|
15
16
|
UIPassthroughArrayResponse,
|
|
16
17
|
UIPassthroughEvent,
|
|
17
18
|
UIPassthroughRequest,
|
|
19
|
+
PageType,
|
|
18
20
|
} from './hostEventClient/contracts';
|
|
19
21
|
import { logger } from '../utils/logger';
|
|
20
22
|
import { getAuthenticationToken } from '../authToken';
|
|
@@ -71,6 +73,7 @@ import { getEmbedConfig } from './embedConfig';
|
|
|
71
73
|
import { ERROR_MESSAGE } from '../errors';
|
|
72
74
|
import { getPreauthInfo } from '../utils/sessionInfoService';
|
|
73
75
|
import { HostEventClient } from './hostEventClient/host-event-client';
|
|
76
|
+
import { PageContextOptions } from '../../visual-embed-sdk';
|
|
74
77
|
|
|
75
78
|
const { version } = pkgInfo;
|
|
76
79
|
|
|
@@ -1268,11 +1271,11 @@ export class TsEmbed {
|
|
|
1268
1271
|
* @param {any} data The payload to send with the message
|
|
1269
1272
|
* @returns A promise that resolves with the response from the embedded app
|
|
1270
1273
|
*/
|
|
1271
|
-
public async trigger<HostEventT extends HostEvent, PayloadT>(
|
|
1274
|
+
public async trigger<HostEventT extends HostEvent, PayloadT, ContextT extends ContextType>(
|
|
1272
1275
|
messageType: HostEventT,
|
|
1273
1276
|
data: TriggerPayload<PayloadT, HostEventT> = {} as any,
|
|
1274
|
-
context
|
|
1275
|
-
): Promise<TriggerResponse<PayloadT, HostEventT>> {
|
|
1277
|
+
context?: ContextT,
|
|
1278
|
+
): Promise<TriggerResponse<PayloadT, HostEventT, ContextT>> {
|
|
1276
1279
|
uploadMixpanelEvent(`${MIXPANEL_EVENT.VISUAL_SDK_TRIGGER}-${messageType}`);
|
|
1277
1280
|
|
|
1278
1281
|
if (!this.isRendered) {
|
|
@@ -1337,6 +1340,18 @@ export class TsEmbed {
|
|
|
1337
1340
|
return this.render();
|
|
1338
1341
|
}
|
|
1339
1342
|
|
|
1343
|
+
public async getCurrentContext(): Promise<any> {
|
|
1344
|
+
this.executeAfterEmbedContainerLoaded(async () => {
|
|
1345
|
+
const context = await this.trigger(HostEvent.GetPageContext, {});
|
|
1346
|
+
return context;
|
|
1347
|
+
});
|
|
1348
|
+
return {
|
|
1349
|
+
page: ContextType.Default,
|
|
1350
|
+
pageType: PageType.PAGE,
|
|
1351
|
+
objectIds: {},
|
|
1352
|
+
};
|
|
1353
|
+
}
|
|
1354
|
+
|
|
1340
1355
|
/**
|
|
1341
1356
|
* Creates the preRender shell
|
|
1342
1357
|
* @param showPreRenderByDefault - Show the preRender after render, hidden by default
|
package/src/types.ts
CHANGED
|
@@ -4257,6 +4257,16 @@ export enum HostEvent {
|
|
|
4257
4257
|
* ```
|
|
4258
4258
|
*/
|
|
4259
4259
|
UpdateEmbedParams = 'updateEmbedParams',
|
|
4260
|
+
|
|
4261
|
+
/**
|
|
4262
|
+
* @hidden
|
|
4263
|
+
* Triggers the get of the page context.
|
|
4264
|
+
* @example
|
|
4265
|
+
* ```js
|
|
4266
|
+
* liveboardEmbed.trigger(HostEvent.GetPageContext);
|
|
4267
|
+
* ```
|
|
4268
|
+
*/
|
|
4269
|
+
GetPageContext = 'GetPageContext',
|
|
4260
4270
|
}
|
|
4261
4271
|
|
|
4262
4272
|
/**
|
|
@@ -3,6 +3,7 @@ import { HostEvent, MessagePayload } from '../types';
|
|
|
3
3
|
import { logger } from '../utils/logger';
|
|
4
4
|
import { handlePresentEvent } from '../utils';
|
|
5
5
|
import { getEmbedConfig } from '../embed/embedConfig';
|
|
6
|
+
import { ContextType } from 'src/embed/hostEventClient/contracts';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Reloads the ThoughtSpot iframe.
|
|
@@ -50,7 +51,7 @@ export function processTrigger(
|
|
|
50
51
|
messageType: HostEvent,
|
|
51
52
|
thoughtSpotHost: string,
|
|
52
53
|
data: any,
|
|
53
|
-
context?:
|
|
54
|
+
context?: ContextType,
|
|
54
55
|
): Promise<any> {
|
|
55
56
|
return new Promise<any>((res, rej) => {
|
|
56
57
|
if (messageType === HostEvent.Reload) {
|