@thoughtspot/visual-embed-sdk 1.17.0-alpha.4 → 1.17.0-customcss-embed
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/dist/src/embed/search-bar.d.ts +1 -1
- package/dist/src/embed/ts-embed.d.ts +8 -1
- package/dist/src/types.d.ts +104 -12
- package/dist/tsembed.es.js +117 -21
- package/dist/tsembed.js +117 -21
- package/lib/package.json +3 -6
- package/lib/src/embed/base.js +4 -4
- package/lib/src/embed/search-bar.d.ts +1 -1
- package/lib/src/embed/search-bar.js +1 -1
- package/lib/src/embed/ts-embed.d.ts +8 -1
- package/lib/src/embed/ts-embed.js +5 -2
- package/lib/src/embed/ts-embed.js.map +1 -1
- package/lib/src/embed/ts-embed.spec.js +1 -1
- package/lib/src/embed/ts-embed.spec.js.map +1 -1
- package/lib/src/types.d.ts +104 -12
- package/lib/src/types.js +99 -7
- package/lib/src/types.js.map +1 -1
- package/lib/src/utils.js +7 -6
- package/lib/src/utils.js.map +1 -1
- package/lib/src/visual-embed-sdk.d.ts +113 -14
- package/package.json +3 -6
- package/src/embed/base.ts +4 -4
- package/src/embed/search-bar.tsx +1 -1
- package/src/embed/ts-embed.spec.ts +1 -1
- package/src/embed/ts-embed.ts +12 -2
- package/src/types.ts +104 -12
- package/src/utils.ts +8 -6
- package/dist/src/embed/pinboard.d.ts +0 -91
- package/dist/src/utils/plugin.d.ts +0 -0
- package/dist/src/v1/api.d.ts +0 -19
- package/lib/src/embed/pinboard.d.ts +0 -91
- package/lib/src/embed/pinboard.js +0 -110
- package/lib/src/embed/pinboard.js.map +0 -1
- package/lib/src/utils/plugin.d.ts +0 -0
- package/lib/src/utils/plugin.js +0 -1
- package/lib/src/utils/plugin.js.map +0 -1
package/src/embed/search-bar.tsx
CHANGED
|
@@ -22,7 +22,7 @@ export interface SearchBarViewConfig extends ViewConfig {
|
|
|
22
22
|
* Embed ThoughtSpot search bar
|
|
23
23
|
*
|
|
24
24
|
* @Category Search Embed
|
|
25
|
-
* @version: SDK: 1.
|
|
25
|
+
* @version: SDK: 1.18.0 | ThoughtSpot: 8.10.0.cl, 9.0.1-sw
|
|
26
26
|
*/
|
|
27
27
|
export class SearchBarEmbed extends TsEmbed {
|
|
28
28
|
/**
|
package/src/embed/ts-embed.ts
CHANGED
|
@@ -148,6 +148,13 @@ export interface ViewConfig {
|
|
|
148
148
|
* @version SDK: 1.9.0 | ThoughtSpot: 8.1.0.cl, 8.4.1-sw
|
|
149
149
|
*/
|
|
150
150
|
additionalFlags?: { [key: string]: string | number | boolean };
|
|
151
|
+
/**
|
|
152
|
+
* Dynamic CSS Url to be injected in the embedded view.
|
|
153
|
+
* You would also need to set `style-src` in the CSP settings.
|
|
154
|
+
* @version SDK: 1.6.0 | ThoughtSpot: ts8.nov.cl, 8.4.1-sw
|
|
155
|
+
* @default ''
|
|
156
|
+
*/
|
|
157
|
+
customCssUrl?: string;
|
|
151
158
|
}
|
|
152
159
|
|
|
153
160
|
/**
|
|
@@ -385,6 +392,7 @@ export class TsEmbed {
|
|
|
385
392
|
showAlerts,
|
|
386
393
|
additionalFlags,
|
|
387
394
|
locale,
|
|
395
|
+
customCssUrl,
|
|
388
396
|
} = this.viewConfig;
|
|
389
397
|
|
|
390
398
|
if (Array.isArray(visibleActions) && Array.isArray(hiddenActions)) {
|
|
@@ -393,7 +401,9 @@ export class TsEmbed {
|
|
|
393
401
|
);
|
|
394
402
|
return queryParams;
|
|
395
403
|
}
|
|
396
|
-
|
|
404
|
+
if (customCssUrl) {
|
|
405
|
+
queryParams[Param.CustomCSSUrl] = customCssUrl;
|
|
406
|
+
}
|
|
397
407
|
if (disabledActions?.length) {
|
|
398
408
|
queryParams[Param.DisableActions] = disabledActions;
|
|
399
409
|
}
|
|
@@ -719,7 +729,7 @@ export class TsEmbed {
|
|
|
719
729
|
* @param messageType The event type
|
|
720
730
|
* @param data The payload to send with the message
|
|
721
731
|
*/
|
|
722
|
-
public trigger(messageType: HostEvent, data: any): Promise<any> {
|
|
732
|
+
public trigger(messageType: HostEvent, data: any = {}): Promise<any> {
|
|
723
733
|
uploadMixpanelEvent(
|
|
724
734
|
`${MIXPANEL_EVENT.VISUAL_SDK_TRIGGER}-${messageType}`,
|
|
725
735
|
);
|
package/src/types.ts
CHANGED
|
@@ -87,11 +87,11 @@ interface customCssInterface {
|
|
|
87
87
|
}
|
|
88
88
|
interface CustomStyles {
|
|
89
89
|
customCSSUrl?: string;
|
|
90
|
-
|
|
90
|
+
customCSS?: customCssInterface;
|
|
91
91
|
}
|
|
92
92
|
export interface CustomisationsInterface {
|
|
93
|
-
style
|
|
94
|
-
content
|
|
93
|
+
style?: CustomStyles;
|
|
94
|
+
content?: {
|
|
95
95
|
[key: string]: string;
|
|
96
96
|
};
|
|
97
97
|
}
|
|
@@ -244,7 +244,7 @@ export interface EmbedConfig {
|
|
|
244
244
|
*
|
|
245
245
|
* @version SDK: 1.17.0 | ThoughtSpot: 8.9.0.cl
|
|
246
246
|
*/
|
|
247
|
-
|
|
247
|
+
customizations?: CustomisationsInterface;
|
|
248
248
|
/**
|
|
249
249
|
* For noRedirect SSO Auth, we need a button which the user
|
|
250
250
|
* click to trigger the flow. This is the containing element
|
|
@@ -285,7 +285,7 @@ export type MessageOptions = {
|
|
|
285
285
|
export type MessageCallback = (
|
|
286
286
|
/* payload: Message payload contain type, data and status */
|
|
287
287
|
payload: MessagePayload,
|
|
288
|
-
/* responder:
|
|
288
|
+
/* responder: Message callback function triggered when embed event initiated */
|
|
289
289
|
responder?: (data: any) => void,
|
|
290
290
|
) => void;
|
|
291
291
|
/**
|
|
@@ -753,8 +753,8 @@ export enum HostEvent {
|
|
|
753
753
|
* @param - {@link RuntimeFilter}[] an array of {@link RuntimeFilter} Types.
|
|
754
754
|
* @example
|
|
755
755
|
* liveboardEmbed.trigger(HostEvent.UpdateRuntimeFilters, [
|
|
756
|
-
* {columnName: "state",operator:
|
|
757
|
-
* {columnName: "item type",operator:
|
|
756
|
+
* {columnName: "state",operator: RuntimeFilterOp.EQ,values: ["michigan"]},
|
|
757
|
+
* {columnName: "item type",operator: RuntimeFilterOp.EQ,values: ["Jackets"]}
|
|
758
758
|
* ])
|
|
759
759
|
* @version SDK: 1.9.0 | ThoughtSpot: 8.1.0.cl, 8.4.1-sw
|
|
760
760
|
*/
|
|
@@ -777,7 +777,10 @@ export enum HostEvent {
|
|
|
777
777
|
* Triggers the Pin action on an embedded object
|
|
778
778
|
* @param - incase of Liveboard embed, takes in an object with vizId as a key
|
|
779
779
|
* can be left empty for search and visualization embeds
|
|
780
|
-
* @example
|
|
780
|
+
* @example
|
|
781
|
+
* liveboardEmbed.trigger(HostEvent.Pin, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
|
|
782
|
+
* vizEmbed.trigger(HostEvent.Pin)
|
|
783
|
+
* searchEmbed.trigger(HostEvent.Pin)
|
|
781
784
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
782
785
|
*/
|
|
783
786
|
Pin = 'pin',
|
|
@@ -824,8 +827,11 @@ export enum HostEvent {
|
|
|
824
827
|
*/
|
|
825
828
|
DownloadAsPdf = 'downloadAsPdf',
|
|
826
829
|
/**
|
|
827
|
-
* Triggers the Make a copy action on a Liveboard
|
|
828
|
-
* @example
|
|
830
|
+
* Triggers the Make a copy action on a Liveboard, search or visualization
|
|
831
|
+
* @example
|
|
832
|
+
* liveboardEmbed.trigger(HostEvent.MakeACopy, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
|
|
833
|
+
* vizEmbed.trigger(HostEvent.MakeACopy)
|
|
834
|
+
* searchEmbed.trigger(HostEvent.MakeACopy)
|
|
829
835
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
|
|
830
836
|
*/
|
|
831
837
|
MakeACopy = 'makeACopy',
|
|
@@ -892,12 +898,71 @@ export enum HostEvent {
|
|
|
892
898
|
* @version SDK: 1.18.0 | ThoughtSpot: 8.10.0.cl
|
|
893
899
|
*/
|
|
894
900
|
GetTML = 'getTML',
|
|
901
|
+
/**
|
|
902
|
+
* Triggers the ShowUnderlyingData action on visualization or search
|
|
903
|
+
* @param - an object with vizId as a key
|
|
904
|
+
* @example
|
|
905
|
+
* liveboardEmbed.trigger(HostEvent.ShowUnderlyingData, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
|
|
906
|
+
* vizEmbed.trigger(HostEvent.ShowUnderlyingData)
|
|
907
|
+
* searchEmbed.trigger(HostEvent.ShowUnderlyingData)
|
|
908
|
+
* @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
|
|
909
|
+
*/
|
|
910
|
+
ShowUnderlyingData = 'showUnderlyingData',
|
|
911
|
+
/**
|
|
912
|
+
* Triggers the Delete action on visualization or search
|
|
913
|
+
* @param - incase of Liveboard embed, takes in an object with vizId as a key
|
|
914
|
+
* can be left empty for search and visualization embeds
|
|
915
|
+
* @example
|
|
916
|
+
* liveboardEmbed.trigger(HostEvent.Delete, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
|
|
917
|
+
* vizEmbed.trigger(HostEvent.Delete)
|
|
918
|
+
* searchEmbed.trigger(HostEvent.Delete)
|
|
919
|
+
* @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
|
|
920
|
+
*/
|
|
921
|
+
Delete = 'delete',
|
|
922
|
+
/**
|
|
923
|
+
* Triggers the SpotIQAnalyze action on visualization or search
|
|
924
|
+
* @param - incase of Liveboard embed, takes in an object with vizId as a key
|
|
925
|
+
* can be left empty for search and visualization embeds
|
|
926
|
+
* @example
|
|
927
|
+
* liveboardEmbed.trigger(HostEvent.SpotIQAnalyze, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
|
|
928
|
+
* vizEmbed.trigger(HostEvent.SpotIQAnalyze)
|
|
929
|
+
* searchEmbed.trigger(HostEvent.SpotIQAnalyze)
|
|
930
|
+
* @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
|
|
931
|
+
*/
|
|
932
|
+
SpotIQAnalyze = 'spotIQAnalyze',
|
|
933
|
+
/**
|
|
934
|
+
* Triggers the Download action on visualization or search when Displaymode is Chart
|
|
935
|
+
* @example
|
|
936
|
+
* liveboardEmbed.trigger(HostEvent.Download, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
|
|
937
|
+
* vizEmbed.trigger(HostEvent.Download)
|
|
938
|
+
* searchEmbed.trigger(HostEvent.Download)
|
|
939
|
+
* @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
|
|
940
|
+
*/
|
|
941
|
+
Download = 'download',
|
|
942
|
+
/**
|
|
943
|
+
* Triggers the downloadAsCSV action on visualization or search when Displaymode is Table
|
|
944
|
+
* @example
|
|
945
|
+
* liveboardEmbed.trigger(HostEvent.DownloadAsCsv, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
|
|
946
|
+
* vizEmbed.trigger(HostEvent.DownloadAsCsv)
|
|
947
|
+
* searchEmbed.trigger(HostEvent.DownloadAsCsv)
|
|
948
|
+
* @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
|
|
949
|
+
*/
|
|
950
|
+
DownloadAsCsv = 'downloadAsCSV',
|
|
951
|
+
/**
|
|
952
|
+
* Triggers the downloadAsXLSX action on visualization or search when Displaymode is Table
|
|
953
|
+
* @example
|
|
954
|
+
* liveboardEmbed.trigger(HostEvent.DownloadAsXlsx, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
|
|
955
|
+
* vizEmbed.trigger(HostEvent.DownloadAsXlsx)
|
|
956
|
+
* searchEmbed.trigger(HostEvent.DownloadAsXlsx)
|
|
957
|
+
* @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
|
|
958
|
+
*/
|
|
959
|
+
DownloadAsXlsx = 'downloadAsXLSX',
|
|
895
960
|
/**
|
|
896
961
|
* Triggers the Share action on a liveboard or answer
|
|
897
962
|
* @example
|
|
898
963
|
* liveboardEmbed.trigger(HostEvent.Share)
|
|
899
964
|
* searchEmbed.trigger(HostEvent.Share)
|
|
900
|
-
* @version SDK: 1.
|
|
965
|
+
* @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
|
|
901
966
|
*/
|
|
902
967
|
Share = 'share',
|
|
903
968
|
/**
|
|
@@ -905,9 +970,36 @@ export enum HostEvent {
|
|
|
905
970
|
* @example
|
|
906
971
|
* liveboardEmbed.trigger(HostEvent.Save)
|
|
907
972
|
* searchEmbed.trigger(HostEvent.Save)
|
|
908
|
-
* @version SDK: 1.
|
|
973
|
+
* @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
|
|
909
974
|
*/
|
|
910
975
|
Save = 'save',
|
|
976
|
+
/**
|
|
977
|
+
* Triggers the SyncToSheets action on visualization
|
|
978
|
+
* @param - an object with vizId as a key
|
|
979
|
+
* @example
|
|
980
|
+
* liveboardEmbed.trigger(HostEvent.SyncToSheets, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
|
|
981
|
+
* vizEmbed.trigger(HostEvent.SyncToSheets)
|
|
982
|
+
* @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
|
|
983
|
+
*/
|
|
984
|
+
SyncToSheets = 'sync-to-sheets',
|
|
985
|
+
/**
|
|
986
|
+
* Triggers the SyncToOtherApps action on visualization
|
|
987
|
+
* @param - an object with vizId as a key
|
|
988
|
+
* @example
|
|
989
|
+
* liveboardEmbed.trigger(HostEvent.SyncToOtherApps, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
|
|
990
|
+
* vizEmbed.trigger(HostEvent.SyncToOtherApps)
|
|
991
|
+
* @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
|
|
992
|
+
*/
|
|
993
|
+
SyncToOtherApps = 'sync-to-other-apps',
|
|
994
|
+
/**
|
|
995
|
+
* Triggers the ManagePipelines action on visualization
|
|
996
|
+
* @param - an object with vizId as a key
|
|
997
|
+
* @example
|
|
998
|
+
* liveboardEmbed.trigger(HostEvent.ManagePipelines, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
|
|
999
|
+
* vizEmbed.trigger(HostEvent.ManagePipelines)
|
|
1000
|
+
* @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
|
|
1001
|
+
*/
|
|
1002
|
+
ManagePipelines = 'manage-pipeline',
|
|
911
1003
|
}
|
|
912
1004
|
|
|
913
1005
|
/**
|
package/src/utils.ts
CHANGED
|
@@ -181,12 +181,14 @@ export const getCustomisations = (
|
|
|
181
181
|
embedConfig: EmbedConfig,
|
|
182
182
|
): CustomisationsInterface => {
|
|
183
183
|
const { customCssUrl } = embedConfig;
|
|
184
|
-
let
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
184
|
+
let customizations =
|
|
185
|
+
embedConfig.customizations ||
|
|
186
|
+
((embedConfig as any).customisations as CustomisationsInterface);
|
|
187
|
+
customizations = customizations || ({} as CustomisationsInterface);
|
|
188
|
+
customizations.style = customizations.style || {};
|
|
189
|
+
customizations.style.customCSSUrl =
|
|
190
|
+
customizations.style.customCSSUrl || customCssUrl;
|
|
191
|
+
return customizations;
|
|
190
192
|
};
|
|
191
193
|
|
|
192
194
|
/**
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2021
|
|
3
|
-
*
|
|
4
|
-
* Embed a ThoughtSpot pinboard or visualization
|
|
5
|
-
* https://developers.thoughtspot.com/docs/?pageid=embed-pinboard
|
|
6
|
-
* https://developers.thoughtspot.com/docs/?pageid=embed-a-viz
|
|
7
|
-
*
|
|
8
|
-
* @summary Pinboard & visualization embed
|
|
9
|
-
* @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
|
|
10
|
-
*/
|
|
11
|
-
import { DOMSelector } from '../types';
|
|
12
|
-
import { V1Embed, ViewConfig } from './ts-embed';
|
|
13
|
-
/**
|
|
14
|
-
* The configuration for the embedded pinboard or visualization page view.
|
|
15
|
-
* @Category Pinboards and Charts
|
|
16
|
-
*/
|
|
17
|
-
export interface PinboardViewConfig extends ViewConfig {
|
|
18
|
-
/**
|
|
19
|
-
* If set to true, the embedded object container dynamically resizes
|
|
20
|
-
* according to the height of the pinboard.
|
|
21
|
-
*/
|
|
22
|
-
fullHeight?: boolean;
|
|
23
|
-
/**
|
|
24
|
-
* This is the minimum height(in pixels) for a full height pinboard.
|
|
25
|
-
* Setting this height helps resolves issues with empty pinboards and
|
|
26
|
-
* other screens navigable from a pinboard.
|
|
27
|
-
* @default 500
|
|
28
|
-
* * _since 1.5.0_
|
|
29
|
-
*/
|
|
30
|
-
defaultHeight?: number;
|
|
31
|
-
/**
|
|
32
|
-
* If set to true, the context menu in visualizations will be enabled.
|
|
33
|
-
*/
|
|
34
|
-
enableVizTransformations?: boolean;
|
|
35
|
-
/**
|
|
36
|
-
* The pinboard to display in the embedded view.
|
|
37
|
-
*/
|
|
38
|
-
pinboardId: string;
|
|
39
|
-
/**
|
|
40
|
-
* The visualization within the pinboard to display.
|
|
41
|
-
*/
|
|
42
|
-
vizId?: string;
|
|
43
|
-
/**
|
|
44
|
-
* If set to true, all filter chips from a
|
|
45
|
-
* pinboard page will be read-only (no X buttons)
|
|
46
|
-
*/
|
|
47
|
-
preventPinboardFilterRemoval?: boolean;
|
|
48
|
-
/**
|
|
49
|
-
* An array of vizids which should be visible when this pinboard loads.
|
|
50
|
-
* The ids not in this array are hidden from the pinboard.
|
|
51
|
-
* _since: 1.6.0_
|
|
52
|
-
*/
|
|
53
|
-
pinboardVisibleVizs?: string[];
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Embed a ThoughtSpot pinboard or visualization
|
|
57
|
-
* @Category Pinboards and Charts
|
|
58
|
-
*/
|
|
59
|
-
export declare class PinboardEmbed extends V1Embed {
|
|
60
|
-
protected viewConfig: PinboardViewConfig;
|
|
61
|
-
private defaultHeight;
|
|
62
|
-
constructor(domSelector: DOMSelector, viewConfig: PinboardViewConfig);
|
|
63
|
-
/**
|
|
64
|
-
* Construct a map of params to be passed on to the
|
|
65
|
-
* embedded pinboard or visualization.
|
|
66
|
-
*/
|
|
67
|
-
private getEmbedParams;
|
|
68
|
-
/**
|
|
69
|
-
* Construct the URL of the embedded ThoughtSpot pinboard or visualization
|
|
70
|
-
* to be loaded within the iframe.
|
|
71
|
-
* @param pinboardId The GUID of the pinboard.
|
|
72
|
-
* @param vizId The optional GUID of a visualization within the pinboard.
|
|
73
|
-
* @param runtimeFilters A list of runtime filters to be applied to
|
|
74
|
-
* the pinboard or visualization on load.
|
|
75
|
-
*/
|
|
76
|
-
private getIFrameSrc;
|
|
77
|
-
/**
|
|
78
|
-
* Set the iframe height as per the computed height received
|
|
79
|
-
* from the ThoughtSpot app.
|
|
80
|
-
* @param data The event payload
|
|
81
|
-
*/
|
|
82
|
-
private updateIFrameHeight;
|
|
83
|
-
private embedIframeCenter;
|
|
84
|
-
private handleRouteChangeFullHeightPinboard;
|
|
85
|
-
/**
|
|
86
|
-
* Render an embedded ThoughtSpot pinboard or visualization
|
|
87
|
-
* @param renderOptions An object specifying the pinboard ID,
|
|
88
|
-
* visualization ID and the runtime filters.
|
|
89
|
-
*/
|
|
90
|
-
render(): PinboardEmbed;
|
|
91
|
-
}
|
|
File without changes
|
package/dist/src/v1/api.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright: ThoughtSpot Inc. 2012-2016
|
|
3
|
-
* Author: Shashank Singh (sunny@thoughtspot.com)
|
|
4
|
-
*
|
|
5
|
-
* @fileoverview ThoughtSpot Javascript API for use of ThoughtSpot in external webpages.
|
|
6
|
-
*/
|
|
7
|
-
import { AuthType } from '../types';
|
|
8
|
-
export declare enum Events {
|
|
9
|
-
THOUGHTSPOT_AUTH_EXPIRED = "ThoughtspotAuthExpired",
|
|
10
|
-
EXPORT_VIZ_DATA_TO_PARENT = "exportVizDataToParent",
|
|
11
|
-
ALERT = "alert",
|
|
12
|
-
EXPORT_VIZ_DATA_TO_CHILD = "exportVizDataToChild",
|
|
13
|
-
GET_DATA = "getData"
|
|
14
|
-
}
|
|
15
|
-
declare type Callback = (...args: any[]) => void;
|
|
16
|
-
declare function checkIfLoggedIn(tsHost: string, callback: Callback): void;
|
|
17
|
-
declare function initialize(onInitialized: Callback, onAuthExpiration: Callback, _thoughtspotHost: string, authType: AuthType): void;
|
|
18
|
-
declare function notifyOnAuthExpiration(): void;
|
|
19
|
-
export { initialize, checkIfLoggedIn, notifyOnAuthExpiration };
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2021
|
|
3
|
-
*
|
|
4
|
-
* Embed a ThoughtSpot pinboard or visualization
|
|
5
|
-
* https://developers.thoughtspot.com/docs/?pageid=embed-pinboard
|
|
6
|
-
* https://developers.thoughtspot.com/docs/?pageid=embed-a-viz
|
|
7
|
-
*
|
|
8
|
-
* @summary Pinboard & visualization embed
|
|
9
|
-
* @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
|
|
10
|
-
*/
|
|
11
|
-
import { DOMSelector } from '../types';
|
|
12
|
-
import { V1Embed, ViewConfig } from './ts-embed';
|
|
13
|
-
/**
|
|
14
|
-
* The configuration for the embedded pinboard or visualization page view.
|
|
15
|
-
* @Category Pinboards and Charts
|
|
16
|
-
*/
|
|
17
|
-
export interface PinboardViewConfig extends ViewConfig {
|
|
18
|
-
/**
|
|
19
|
-
* If set to true, the embedded object container dynamically resizes
|
|
20
|
-
* according to the height of the pinboard.
|
|
21
|
-
*/
|
|
22
|
-
fullHeight?: boolean;
|
|
23
|
-
/**
|
|
24
|
-
* This is the minimum height(in pixels) for a full height pinboard.
|
|
25
|
-
* Setting this height helps resolves issues with empty pinboards and
|
|
26
|
-
* other screens navigable from a pinboard.
|
|
27
|
-
* @default 500
|
|
28
|
-
* * _since 1.5.0_
|
|
29
|
-
*/
|
|
30
|
-
defaultHeight?: number;
|
|
31
|
-
/**
|
|
32
|
-
* If set to true, the context menu in visualizations will be enabled.
|
|
33
|
-
*/
|
|
34
|
-
enableVizTransformations?: boolean;
|
|
35
|
-
/**
|
|
36
|
-
* The pinboard to display in the embedded view.
|
|
37
|
-
*/
|
|
38
|
-
pinboardId: string;
|
|
39
|
-
/**
|
|
40
|
-
* The visualization within the pinboard to display.
|
|
41
|
-
*/
|
|
42
|
-
vizId?: string;
|
|
43
|
-
/**
|
|
44
|
-
* If set to true, all filter chips from a
|
|
45
|
-
* pinboard page will be read-only (no X buttons)
|
|
46
|
-
*/
|
|
47
|
-
preventPinboardFilterRemoval?: boolean;
|
|
48
|
-
/**
|
|
49
|
-
* An array of vizids which should be visible when this pinboard loads.
|
|
50
|
-
* The ids not in this array are hidden from the pinboard.
|
|
51
|
-
* _since: 1.6.0_
|
|
52
|
-
*/
|
|
53
|
-
pinboardVisibleVizs?: string[];
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Embed a ThoughtSpot pinboard or visualization
|
|
57
|
-
* @Category Pinboards and Charts
|
|
58
|
-
*/
|
|
59
|
-
export declare class PinboardEmbed extends V1Embed {
|
|
60
|
-
protected viewConfig: PinboardViewConfig;
|
|
61
|
-
private defaultHeight;
|
|
62
|
-
constructor(domSelector: DOMSelector, viewConfig: PinboardViewConfig);
|
|
63
|
-
/**
|
|
64
|
-
* Construct a map of params to be passed on to the
|
|
65
|
-
* embedded pinboard or visualization.
|
|
66
|
-
*/
|
|
67
|
-
private getEmbedParams;
|
|
68
|
-
/**
|
|
69
|
-
* Construct the URL of the embedded ThoughtSpot pinboard or visualization
|
|
70
|
-
* to be loaded within the iframe.
|
|
71
|
-
* @param pinboardId The GUID of the pinboard.
|
|
72
|
-
* @param vizId The optional GUID of a visualization within the pinboard.
|
|
73
|
-
* @param runtimeFilters A list of runtime filters to be applied to
|
|
74
|
-
* the pinboard or visualization on load.
|
|
75
|
-
*/
|
|
76
|
-
private getIFrameSrc;
|
|
77
|
-
/**
|
|
78
|
-
* Set the iframe height as per the computed height received
|
|
79
|
-
* from the ThoughtSpot app.
|
|
80
|
-
* @param data The event payload
|
|
81
|
-
*/
|
|
82
|
-
private updateIFrameHeight;
|
|
83
|
-
private embedIframeCenter;
|
|
84
|
-
private handleRouteChangeFullHeightPinboard;
|
|
85
|
-
/**
|
|
86
|
-
* Render an embedded ThoughtSpot pinboard or visualization
|
|
87
|
-
* @param renderOptions An object specifying the pinboard ID,
|
|
88
|
-
* visualization ID and the runtime filters.
|
|
89
|
-
*/
|
|
90
|
-
render(): PinboardEmbed;
|
|
91
|
-
}
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2021
|
|
3
|
-
*
|
|
4
|
-
* Embed a ThoughtSpot pinboard or visualization
|
|
5
|
-
* https://developers.thoughtspot.com/docs/?pageid=embed-pinboard
|
|
6
|
-
* https://developers.thoughtspot.com/docs/?pageid=embed-a-viz
|
|
7
|
-
*
|
|
8
|
-
* @summary Pinboard & visualization embed
|
|
9
|
-
* @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
|
|
10
|
-
*/
|
|
11
|
-
import { ERROR_MESSAGE } from '../errors';
|
|
12
|
-
import { EmbedEvent, Param, } from '../types';
|
|
13
|
-
import { getFilterQuery, getQueryParamString } from '../utils';
|
|
14
|
-
import { V1Embed } from './ts-embed';
|
|
15
|
-
/**
|
|
16
|
-
* Embed a ThoughtSpot pinboard or visualization
|
|
17
|
-
* @Category Pinboards and Charts
|
|
18
|
-
*/
|
|
19
|
-
export class PinboardEmbed extends V1Embed {
|
|
20
|
-
// eslint-disable-next-line no-useless-constructor
|
|
21
|
-
constructor(domSelector, viewConfig) {
|
|
22
|
-
super(domSelector, viewConfig);
|
|
23
|
-
this.defaultHeight = 500;
|
|
24
|
-
/**
|
|
25
|
-
* Set the iframe height as per the computed height received
|
|
26
|
-
* from the ThoughtSpot app.
|
|
27
|
-
* @param data The event payload
|
|
28
|
-
*/
|
|
29
|
-
this.updateIFrameHeight = (data) => {
|
|
30
|
-
this.setIFrameHeight(Math.max(data.data, this.defaultHeight));
|
|
31
|
-
};
|
|
32
|
-
this.embedIframeCenter = (data, responder) => {
|
|
33
|
-
const obj = this.getIframeCenter();
|
|
34
|
-
responder({ type: EmbedEvent.EmbedIframeCenter, data: obj });
|
|
35
|
-
};
|
|
36
|
-
this.handleRouteChangeFullHeightPinboard = (data) => {
|
|
37
|
-
if (data.data.canvasState !== 'EMBED' &&
|
|
38
|
-
data.data.canvasState !== 'pinboard') {
|
|
39
|
-
this.setIFrameHeight(this.defaultHeight);
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Construct a map of params to be passed on to the
|
|
45
|
-
* embedded pinboard or visualization.
|
|
46
|
-
*/
|
|
47
|
-
getEmbedParams() {
|
|
48
|
-
const params = this.getBaseQueryParams();
|
|
49
|
-
const { enableVizTransformations, fullHeight, preventPinboardFilterRemoval, defaultHeight, pinboardVisibleVizs, } = this.viewConfig;
|
|
50
|
-
if (fullHeight === true) {
|
|
51
|
-
params[Param.fullHeight] = true;
|
|
52
|
-
}
|
|
53
|
-
if (defaultHeight) {
|
|
54
|
-
this.defaultHeight = defaultHeight;
|
|
55
|
-
}
|
|
56
|
-
if (enableVizTransformations !== undefined) {
|
|
57
|
-
params[Param.EnableVizTransformations] = enableVizTransformations.toString();
|
|
58
|
-
}
|
|
59
|
-
if (preventPinboardFilterRemoval) {
|
|
60
|
-
params[Param.preventPinboardFilterRemoval] = true;
|
|
61
|
-
}
|
|
62
|
-
if (pinboardVisibleVizs) {
|
|
63
|
-
params[Param.PinboardVisibleVizs] = pinboardVisibleVizs;
|
|
64
|
-
}
|
|
65
|
-
params[Param.livedBoardEmbed] = true;
|
|
66
|
-
const queryParams = getQueryParamString(params, true);
|
|
67
|
-
return queryParams;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Construct the URL of the embedded ThoughtSpot pinboard or visualization
|
|
71
|
-
* to be loaded within the iframe.
|
|
72
|
-
* @param pinboardId The GUID of the pinboard.
|
|
73
|
-
* @param vizId The optional GUID of a visualization within the pinboard.
|
|
74
|
-
* @param runtimeFilters A list of runtime filters to be applied to
|
|
75
|
-
* the pinboard or visualization on load.
|
|
76
|
-
*/
|
|
77
|
-
getIFrameSrc(pinboardId, vizId, runtimeFilters) {
|
|
78
|
-
const filterQuery = getFilterQuery(runtimeFilters || []);
|
|
79
|
-
const queryParams = this.getEmbedParams();
|
|
80
|
-
const queryString = [filterQuery, queryParams]
|
|
81
|
-
.filter(Boolean)
|
|
82
|
-
.join('&');
|
|
83
|
-
let url = `${this.getV1EmbedBasePath(queryString, true, false, false)}/viz/${pinboardId}`;
|
|
84
|
-
if (vizId) {
|
|
85
|
-
url = `${url}/${vizId}`;
|
|
86
|
-
}
|
|
87
|
-
return url;
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Render an embedded ThoughtSpot pinboard or visualization
|
|
91
|
-
* @param renderOptions An object specifying the pinboard ID,
|
|
92
|
-
* visualization ID and the runtime filters.
|
|
93
|
-
*/
|
|
94
|
-
render() {
|
|
95
|
-
const { pinboardId, vizId, runtimeFilters } = this.viewConfig;
|
|
96
|
-
if (!pinboardId && !vizId) {
|
|
97
|
-
this.handleError(ERROR_MESSAGE.PINBOARD_VIZ_ID_VALIDATION);
|
|
98
|
-
}
|
|
99
|
-
if (this.viewConfig.fullHeight === true) {
|
|
100
|
-
this.on(EmbedEvent.RouteChange, this.handleRouteChangeFullHeightPinboard);
|
|
101
|
-
this.on(EmbedEvent.EmbedHeight, this.updateIFrameHeight);
|
|
102
|
-
this.on(EmbedEvent.EmbedIframeCenter, this.embedIframeCenter);
|
|
103
|
-
}
|
|
104
|
-
super.render();
|
|
105
|
-
const src = this.getIFrameSrc(pinboardId, vizId, runtimeFilters);
|
|
106
|
-
this.renderV1Embed(src);
|
|
107
|
-
return this;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
//# sourceMappingURL=pinboard.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pinboard.js","sourceRoot":"","sources":["../../../src/embed/pinboard.ts"],"names":[],"mappings":"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"}
|
|
File without changes
|
package/lib/src/utils/plugin.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=plugin.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../../src/utils/plugin.ts"],"names":[],"mappings":""}
|