@thoughtspot/visual-embed-sdk 1.7.0 → 1.8.0-plugins.0
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/liveboard.d.ts +1 -1
- package/dist/src/embed/pinboard.d.ts +91 -0
- package/dist/src/embed/search.d.ts +0 -4
- package/dist/src/embed/ts-embed.d.ts +19 -2
- package/dist/src/types.d.ts +36 -7
- package/dist/src/utils/plugin.d.ts +0 -0
- package/dist/src/v1/api.d.ts +19 -0
- package/dist/tsembed.es.js +49 -9
- package/dist/tsembed.js +49 -9
- package/lib/package.json +2 -3
- package/lib/src/embed/liveboard.d.ts +1 -1
- package/lib/src/embed/pinboard.d.ts +91 -0
- package/lib/src/embed/pinboard.js +110 -0
- package/lib/src/embed/pinboard.js.map +1 -0
- package/lib/src/embed/search.d.ts +0 -4
- package/lib/src/embed/search.js +4 -1
- package/lib/src/embed/search.js.map +1 -1
- package/lib/src/embed/ts-embed.d.ts +19 -2
- package/lib/src/embed/ts-embed.js +17 -1
- package/lib/src/embed/ts-embed.js.map +1 -1
- package/lib/src/embed/ts-embed.spec.js +24 -5
- package/lib/src/embed/ts-embed.spec.js.map +1 -1
- package/lib/src/index.js.map +1 -1
- package/lib/src/react/index.spec.js +1 -1
- package/lib/src/react/index.spec.js.map +1 -1
- package/lib/src/types.d.ts +36 -7
- package/lib/src/types.js +28 -6
- package/lib/src/types.js.map +1 -1
- package/lib/src/utils/plugin.d.ts +0 -0
- package/lib/src/utils/plugin.js +1 -0
- package/lib/src/utils/plugin.js.map +1 -0
- package/lib/src/visual-embed-sdk.d.ts +55 -14
- package/package.json +2 -3
- package/src/embed/liveboard.ts +1 -1
- package/src/embed/search.ts +3 -5
- package/src/embed/ts-embed.spec.ts +29 -6
- package/src/embed/ts-embed.ts +35 -1
- package/src/index.ts +1 -0
- package/src/react/index.spec.tsx +1 -1
- package/src/types.ts +36 -6
- package/src/utils/plugin.ts +2 -0
package/lib/src/types.js
CHANGED
|
@@ -147,6 +147,12 @@ export var EmbedEvent;
|
|
|
147
147
|
* @return dataSourceIds - the list of data sources
|
|
148
148
|
*/
|
|
149
149
|
EmbedEvent["DataSourceSelected"] = "dataSourceSelected";
|
|
150
|
+
/**
|
|
151
|
+
* One or more data columns have been selected.
|
|
152
|
+
* @return columnIds - the list of columns
|
|
153
|
+
* @version SDK: 1.9.0 | ThoughtSpot: 8.2.0.cl
|
|
154
|
+
*/
|
|
155
|
+
EmbedEvent["AddRemoveColumns"] = "addRemoveColumns";
|
|
150
156
|
/**
|
|
151
157
|
* A custom action has been triggered
|
|
152
158
|
* @return actionId - The id of the custom action
|
|
@@ -261,7 +267,8 @@ export var HostEvent;
|
|
|
261
267
|
*/
|
|
262
268
|
HostEvent["SetVisibleVizs"] = "SetPinboardVisibleVizs";
|
|
263
269
|
/**
|
|
264
|
-
* Update the runtime filters
|
|
270
|
+
* Update the runtime filters. The runtime filters passed here are extended
|
|
271
|
+
* on to the existing runtime filters if they exist.
|
|
265
272
|
* @param - {@link RuntimeFilter}[] an array of {@link RuntimeFilter} Types.
|
|
266
273
|
* @version 1.8.0 or later
|
|
267
274
|
*/
|
|
@@ -296,7 +303,6 @@ export var Param;
|
|
|
296
303
|
(function (Param) {
|
|
297
304
|
Param["DataSources"] = "dataSources";
|
|
298
305
|
Param["DataSourceMode"] = "dataSourceMode";
|
|
299
|
-
Param["ExpandAllDataSource"] = "expandAllDataSource";
|
|
300
306
|
Param["DisableActions"] = "disableAction";
|
|
301
307
|
Param["DisableActionReason"] = "disableHint";
|
|
302
308
|
Param["ForceTable"] = "forceTable";
|
|
@@ -373,10 +379,6 @@ export var Action;
|
|
|
373
379
|
Action["PinboardInfo"] = "pinboardInfo";
|
|
374
380
|
Action["LiveboardInfo"] = "pinboardInfo";
|
|
375
381
|
Action["SendAnswerFeedback"] = "sendFeedback";
|
|
376
|
-
/**
|
|
377
|
-
* @deprecated Will be removed in next version
|
|
378
|
-
*/
|
|
379
|
-
Action["CustomAction"] = "customAction";
|
|
380
382
|
Action["DownloadEmbraceQueries"] = "downloadEmbraceQueries";
|
|
381
383
|
Action["Pin"] = "pin";
|
|
382
384
|
Action["AnalysisInfo"] = "analysisInfo";
|
|
@@ -392,6 +394,26 @@ export var Action;
|
|
|
392
394
|
Action["DrillDown"] = "DRILL";
|
|
393
395
|
Action["RequestAccess"] = "requestAccess";
|
|
394
396
|
Action["QueryDetailsButtons"] = "queryDetailsButtons";
|
|
397
|
+
/**
|
|
398
|
+
* @version SDK: 1.8.0 | ThoughtSpot: 8.1.0.cl
|
|
399
|
+
*/
|
|
400
|
+
Action["Monitor"] = "createMonitor";
|
|
401
|
+
/**
|
|
402
|
+
* @version SDK: 1.8.0 | ThoughtSpot: 8.1.0.cl
|
|
403
|
+
*/
|
|
404
|
+
Action["AnswerDelete"] = "onDeleteAnswer";
|
|
405
|
+
/**
|
|
406
|
+
* @version SDK: 1.8.0 | ThoughtSpot: 8.1.0.cl
|
|
407
|
+
*/
|
|
408
|
+
Action["AnswerChartSwitcher"] = "answerChartSwitcher";
|
|
409
|
+
/**
|
|
410
|
+
* @version SDK: 1.8.0 | ThoughtSpot: 8.1.0.cl
|
|
411
|
+
*/
|
|
412
|
+
Action["AddToFavorites"] = "addToFavorites";
|
|
413
|
+
/**
|
|
414
|
+
* @version SDK: 1.8.0 | ThoughtSpot: 8.1.0.cl
|
|
415
|
+
*/
|
|
416
|
+
Action["EditDetails"] = "editDetails";
|
|
395
417
|
})(Action || (Action = {}));
|
|
396
418
|
// eslint-disable-next-line no-shadow
|
|
397
419
|
export var OperationType;
|
package/lib/src/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;GAGG;AACH,qCAAqC;AACrC,MAAM,CAAN,IAAY,QAwBX;AAxBD,WAAY,QAAQ;IAChB;;OAEG;IACH,yBAAa,CAAA;IACb;;OAEG;IACH,4BAAgB,CAAA;IAChB;;OAEG;IACH,6BAAiB,CAAA;IACjB;;OAEG;IACH,qCAAyB,CAAA;IACzB;;;;;OAKG;IACH,2BAAe,CAAA;AACnB,CAAC,EAxBW,QAAQ,KAAR,QAAQ,QAwBnB;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;GAGG;AACH,qCAAqC;AACrC,MAAM,CAAN,IAAY,QAwBX;AAxBD,WAAY,QAAQ;IAChB;;OAEG;IACH,yBAAa,CAAA;IACb;;OAEG;IACH,4BAAgB,CAAA;IAChB;;OAEG;IACH,6BAAiB,CAAA;IACjB;;OAEG;IACH,qCAAyB,CAAA;IACzB;;;;;OAKG;IACH,2BAAe,CAAA;AACnB,CAAC,EAxBW,QAAQ,KAAR,QAAQ,QAwBnB;AAsHD;;GAEG;AACH,qCAAqC;AACrC,MAAM,CAAN,IAAY,eAyDX;AAzDD,WAAY,eAAe;IACvB;;OAEG;IACH,4BAAS,CAAA;IACT;;OAEG;IACH,4BAAS,CAAA;IACT;;OAEG;IACH,4BAAS,CAAA;IACT;;OAEG;IACH,4BAAS,CAAA;IACT;;OAEG;IACH,4BAAS,CAAA;IACT;;OAEG;IACH,4BAAS,CAAA;IACT;;OAEG;IACH,wCAAqB,CAAA;IACrB;;OAEG;IACH,8CAA2B,CAAA;IAC3B;;OAEG;IACH,0CAAuB,CAAA;IACvB;;OAEG;IACH,4CAAyB,CAAA;IACzB;;OAEG;IACH,4CAAyB,CAAA;IACzB;;OAEG;IACH,oCAAiB,CAAA;IACjB;;OAEG;IACH,4BAAS,CAAA;IACT;;OAEG;IACH,4BAAS,CAAA;AACb,CAAC,EAzDW,eAAe,KAAf,eAAe,QAyD1B;AAsBD;;GAEG;AACH,qCAAqC;AACrC,MAAM,CAAN,IAAY,UAsHX;AAtHD,WAAY,UAAU;IAClB;;;OAGG;IACH,2BAAa,CAAA;IACb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{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../../src/utils/plugin.ts"],"names":[],"mappings":""}
|
|
@@ -174,7 +174,7 @@ declare module '@thoughtspot/visual-embed-sdk/embed/liveboard' {
|
|
|
174
174
|
* This is the minimum height(in pixels) for a full height Liveboard.
|
|
175
175
|
* Setting this height helps resolves issues with empty Liveboards and
|
|
176
176
|
* other screens navigable from a Liveboard.
|
|
177
|
-
*
|
|
177
|
+
* @version 1.5.0 or later
|
|
178
178
|
* @default 500
|
|
179
179
|
*/
|
|
180
180
|
defaultHeight?: number;
|
|
@@ -275,10 +275,6 @@ declare module '@thoughtspot/visual-embed-sdk/embed/search' {
|
|
|
275
275
|
* using raw answer data.
|
|
276
276
|
*/
|
|
277
277
|
hideResults?: boolean;
|
|
278
|
-
/**
|
|
279
|
-
* If set to true, expands all the data sources panel.
|
|
280
|
-
*/
|
|
281
|
-
expandAllDataSource?: boolean;
|
|
282
278
|
/**
|
|
283
279
|
* If set to true, the Search Assist feature is enabled.
|
|
284
280
|
*/
|
|
@@ -443,6 +439,7 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
|
|
|
443
439
|
queueMultiRenders?: boolean;
|
|
444
440
|
/**
|
|
445
441
|
* Dynamic CSS Url to be injected in the loaded application.
|
|
442
|
+
* You would also need to set `style-src` in the CSP settings.
|
|
446
443
|
* @version 1.6.0 or later
|
|
447
444
|
* @default ''
|
|
448
445
|
*/
|
|
@@ -582,6 +579,12 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
|
|
|
582
579
|
* @return dataSourceIds - the list of data sources
|
|
583
580
|
*/
|
|
584
581
|
DataSourceSelected = "dataSourceSelected",
|
|
582
|
+
/**
|
|
583
|
+
* One or more data columns have been selected.
|
|
584
|
+
* @return columnIds - the list of columns
|
|
585
|
+
* @version SDK: 1.9.0 | ThoughtSpot: 8.2.0.cl
|
|
586
|
+
*/
|
|
587
|
+
AddRemoveColumns = "addRemoveColumns",
|
|
585
588
|
/**
|
|
586
589
|
* A custom action has been triggered
|
|
587
590
|
* @return actionId - The id of the custom action
|
|
@@ -694,7 +697,8 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
|
|
|
694
697
|
*/
|
|
695
698
|
SetVisibleVizs = "SetPinboardVisibleVizs",
|
|
696
699
|
/**
|
|
697
|
-
* Update the runtime filters
|
|
700
|
+
* Update the runtime filters. The runtime filters passed here are extended
|
|
701
|
+
* on to the existing runtime filters if they exist.
|
|
698
702
|
* @param - {@link RuntimeFilter}[] an array of {@link RuntimeFilter} Types.
|
|
699
703
|
* @version 1.8.0 or later
|
|
700
704
|
*/
|
|
@@ -725,7 +729,6 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
|
|
|
725
729
|
export enum Param {
|
|
726
730
|
DataSources = "dataSources",
|
|
727
731
|
DataSourceMode = "dataSourceMode",
|
|
728
|
-
ExpandAllDataSource = "expandAllDataSource",
|
|
729
732
|
DisableActions = "disableAction",
|
|
730
733
|
DisableActionReason = "disableHint",
|
|
731
734
|
ForceTable = "forceTable",
|
|
@@ -800,10 +803,6 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
|
|
|
800
803
|
PinboardInfo = "pinboardInfo",
|
|
801
804
|
LiveboardInfo = "pinboardInfo",
|
|
802
805
|
SendAnswerFeedback = "sendFeedback",
|
|
803
|
-
/**
|
|
804
|
-
* @deprecated Will be removed in next version
|
|
805
|
-
*/
|
|
806
|
-
CustomAction = "customAction",
|
|
807
806
|
DownloadEmbraceQueries = "downloadEmbraceQueries",
|
|
808
807
|
Pin = "pin",
|
|
809
808
|
AnalysisInfo = "analysisInfo",
|
|
@@ -818,7 +817,27 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
|
|
|
818
817
|
Separator = "context-menu-item-separator",
|
|
819
818
|
DrillDown = "DRILL",
|
|
820
819
|
RequestAccess = "requestAccess",
|
|
821
|
-
QueryDetailsButtons = "queryDetailsButtons"
|
|
820
|
+
QueryDetailsButtons = "queryDetailsButtons",
|
|
821
|
+
/**
|
|
822
|
+
* @version SDK: 1.8.0 | ThoughtSpot: 8.1.0.cl
|
|
823
|
+
*/
|
|
824
|
+
Monitor = "createMonitor",
|
|
825
|
+
/**
|
|
826
|
+
* @version SDK: 1.8.0 | ThoughtSpot: 8.1.0.cl
|
|
827
|
+
*/
|
|
828
|
+
AnswerDelete = "onDeleteAnswer",
|
|
829
|
+
/**
|
|
830
|
+
* @version SDK: 1.8.0 | ThoughtSpot: 8.1.0.cl
|
|
831
|
+
*/
|
|
832
|
+
AnswerChartSwitcher = "answerChartSwitcher",
|
|
833
|
+
/**
|
|
834
|
+
* @version SDK: 1.8.0 | ThoughtSpot: 8.1.0.cl
|
|
835
|
+
*/
|
|
836
|
+
AddToFavorites = "addToFavorites",
|
|
837
|
+
/**
|
|
838
|
+
* @version SDK: 1.8.0 | ThoughtSpot: 8.1.0.cl
|
|
839
|
+
*/
|
|
840
|
+
EditDetails = "editDetails"
|
|
822
841
|
}
|
|
823
842
|
export interface SessionInterface {
|
|
824
843
|
sessionId: string;
|
|
@@ -835,6 +854,12 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
|
|
|
835
854
|
export interface AnswerServiceType {
|
|
836
855
|
getAnswer?: (offset: number, batchSize: number) => any;
|
|
837
856
|
}
|
|
857
|
+
export interface Plugin {
|
|
858
|
+
name: string;
|
|
859
|
+
handlers: {
|
|
860
|
+
[key in EmbedEvent]: (payload: any) => void;
|
|
861
|
+
};
|
|
862
|
+
}
|
|
838
863
|
}
|
|
839
864
|
|
|
840
865
|
declare module '@thoughtspot/visual-embed-sdk/embed/ts-embed' {
|
|
@@ -846,7 +871,7 @@ declare module '@thoughtspot/visual-embed-sdk/embed/ts-embed' {
|
|
|
846
871
|
* @summary Base classes
|
|
847
872
|
* @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
|
|
848
873
|
*/
|
|
849
|
-
import { DOMSelector, HostEvent, EmbedEvent, MessageCallback, Action, RuntimeFilter, EmbedConfig } from '@thoughtspot/visual-embed-sdk/types';
|
|
874
|
+
import { DOMSelector, HostEvent, EmbedEvent, MessageCallback, Action, RuntimeFilter, EmbedConfig, Plugin } from '@thoughtspot/visual-embed-sdk/types';
|
|
850
875
|
export interface LayoutConfig {
|
|
851
876
|
}
|
|
852
877
|
/**
|
|
@@ -899,7 +924,7 @@ declare module '@thoughtspot/visual-embed-sdk/embed/ts-embed' {
|
|
|
899
924
|
/**
|
|
900
925
|
* The list of actions to display from the primary menu, more menu
|
|
901
926
|
* (...), and the contextual menu.
|
|
902
|
-
*
|
|
927
|
+
* @version 1.6.0 or later
|
|
903
928
|
*/
|
|
904
929
|
visibleActions?: Action[];
|
|
905
930
|
/**
|
|
@@ -907,6 +932,22 @@ declare module '@thoughtspot/visual-embed-sdk/embed/ts-embed' {
|
|
|
907
932
|
* visualization, or Liveboard.
|
|
908
933
|
*/
|
|
909
934
|
runtimeFilters?: RuntimeFilter[];
|
|
935
|
+
/**
|
|
936
|
+
* This is an object (key/val) of override flags which will be applied
|
|
937
|
+
* to the internal embedded object. This can be used to add any
|
|
938
|
+
* URL flag.
|
|
939
|
+
* @version 1.8.0
|
|
940
|
+
*/
|
|
941
|
+
additionalFlags?: {
|
|
942
|
+
[key: string]: string | number | boolean;
|
|
943
|
+
};
|
|
944
|
+
/**
|
|
945
|
+
* Provide a list of plugins, the plugins are executed in the order
|
|
946
|
+
* provided below,
|
|
947
|
+
*
|
|
948
|
+
* @version alpha
|
|
949
|
+
*/
|
|
950
|
+
plugins?: Plugin[];
|
|
910
951
|
}
|
|
911
952
|
/**
|
|
912
953
|
* Base class for embedding v2 experience
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thoughtspot/visual-embed-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0-plugins.0",
|
|
4
4
|
"description": "ThoughtSpot Embed SDK",
|
|
5
5
|
"module": "lib/src/index.js",
|
|
6
6
|
"main": "dist/tsembed.js",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"test": "npm run test-sdk && npm run test-docs && npx istanbul-merge --out ./coverage/coverage.json ./coverage/docs/coverage-final.json ./coverage/sdk/coverage-final.json && npx istanbul report --include ./coverage/coverage.json --dir ./coverage lcov",
|
|
35
35
|
"posttest": "cat ./coverage/lcov.info | coveralls",
|
|
36
36
|
"prepublishOnly": "npm run test; npm run tsc; npm run bundle-dts; npm run build",
|
|
37
|
-
"publish-dev": "npm publish --tag
|
|
37
|
+
"publish-dev": "npm publish --tag plugins",
|
|
38
38
|
"publish-prod": "npm publish --tag latest"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
@@ -65,7 +65,6 @@
|
|
|
65
65
|
"asciidoctor": "^2.2.1",
|
|
66
66
|
"babel-jest": "^26.6.3",
|
|
67
67
|
"babel-preset-gatsby": "^1.10.0",
|
|
68
|
-
"classnames": "^2.3.1",
|
|
69
68
|
"command-line-args": "^5.1.1",
|
|
70
69
|
"coveralls": "^3.1.0",
|
|
71
70
|
"dts-bundle": "0.7.3",
|
package/src/embed/liveboard.ts
CHANGED
|
@@ -35,7 +35,7 @@ export interface LiveboardViewConfig extends ViewConfig {
|
|
|
35
35
|
* This is the minimum height(in pixels) for a full height Liveboard.
|
|
36
36
|
* Setting this height helps resolves issues with empty Liveboards and
|
|
37
37
|
* other screens navigable from a Liveboard.
|
|
38
|
-
*
|
|
38
|
+
* @version 1.5.0 or later
|
|
39
39
|
* @default 500
|
|
40
40
|
*/
|
|
41
41
|
defaultHeight?: number;
|
package/src/embed/search.ts
CHANGED
|
@@ -49,10 +49,6 @@ export interface SearchViewConfig extends ViewConfig {
|
|
|
49
49
|
* using raw answer data.
|
|
50
50
|
*/
|
|
51
51
|
hideResults?: boolean;
|
|
52
|
-
/**
|
|
53
|
-
* If set to true, expands all the data sources panel.
|
|
54
|
-
*/
|
|
55
|
-
expandAllDataSource?: boolean;
|
|
56
52
|
/**
|
|
57
53
|
* If set to true, the Search Assist feature is enabled.
|
|
58
54
|
*/
|
|
@@ -84,6 +80,9 @@ export interface SearchViewConfig extends ViewConfig {
|
|
|
84
80
|
export const HiddenActionItemByDefaultForSearchEmbed = [
|
|
85
81
|
Action.EditACopy,
|
|
86
82
|
Action.SaveAsView,
|
|
83
|
+
Action.UpdateTML,
|
|
84
|
+
Action.EditTML,
|
|
85
|
+
Action.AnswerDelete,
|
|
87
86
|
];
|
|
88
87
|
|
|
89
88
|
/**
|
|
@@ -127,7 +126,6 @@ export class SearchEmbed extends TsEmbed {
|
|
|
127
126
|
private getIFrameSrc(answerId: string, dataSources?: string[]) {
|
|
128
127
|
const {
|
|
129
128
|
hideResults,
|
|
130
|
-
expandAllDataSource,
|
|
131
129
|
enableSearchAssist,
|
|
132
130
|
forceTable,
|
|
133
131
|
searchOptions,
|
|
@@ -34,6 +34,9 @@ describe('Unit test case for ts embed', () => {
|
|
|
34
34
|
mixpanelInstance,
|
|
35
35
|
'uploadMixpanelEvent',
|
|
36
36
|
);
|
|
37
|
+
beforeEach(() => {
|
|
38
|
+
document.body.innerHTML = getDocumentBody();
|
|
39
|
+
});
|
|
37
40
|
describe('when thoughtSpotHost have value and authPromise return success response', () => {
|
|
38
41
|
beforeAll(() => {
|
|
39
42
|
init({
|
|
@@ -43,7 +46,6 @@ describe('Unit test case for ts embed', () => {
|
|
|
43
46
|
});
|
|
44
47
|
|
|
45
48
|
beforeEach(() => {
|
|
46
|
-
document.body.innerHTML = getDocumentBody();
|
|
47
49
|
jest.spyOn(window, 'addEventListener').mockImplementationOnce(
|
|
48
50
|
(event, handler, options) => {
|
|
49
51
|
handler({
|
|
@@ -98,7 +100,6 @@ describe('Unit test case for ts embed', () => {
|
|
|
98
100
|
});
|
|
99
101
|
|
|
100
102
|
beforeEach(() => {
|
|
101
|
-
document.body.innerHTML = getDocumentBody();
|
|
102
103
|
jest.spyOn(
|
|
103
104
|
baseInstance,
|
|
104
105
|
'getAuthPromise',
|
|
@@ -206,10 +207,6 @@ describe('Unit test case for ts embed', () => {
|
|
|
206
207
|
});
|
|
207
208
|
});
|
|
208
209
|
|
|
209
|
-
beforeEach(() => {
|
|
210
|
-
document.body.innerHTML = getDocumentBody();
|
|
211
|
-
});
|
|
212
|
-
|
|
213
210
|
test('Error should be true', async () => {
|
|
214
211
|
const tsEmbed = new SearchEmbed(getRootEl(), {});
|
|
215
212
|
tsEmbed.render();
|
|
@@ -300,4 +297,30 @@ describe('Unit test case for ts embed', () => {
|
|
|
300
297
|
);
|
|
301
298
|
});
|
|
302
299
|
});
|
|
300
|
+
|
|
301
|
+
describe('additionalFlags config', () => {
|
|
302
|
+
beforeEach(() => {
|
|
303
|
+
jest.spyOn(config, 'getThoughtSpotHost').mockImplementation(
|
|
304
|
+
() => 'http://tshost',
|
|
305
|
+
);
|
|
306
|
+
});
|
|
307
|
+
it('should set the additional flags correctly on the iframe src', async () => {
|
|
308
|
+
const appEmbed = new AppEmbed(getRootEl(), {
|
|
309
|
+
frameParams: {
|
|
310
|
+
width: '100%',
|
|
311
|
+
height: '100%',
|
|
312
|
+
},
|
|
313
|
+
additionalFlags: {
|
|
314
|
+
foo: 'bar',
|
|
315
|
+
baz: 1,
|
|
316
|
+
bool: true,
|
|
317
|
+
},
|
|
318
|
+
});
|
|
319
|
+
await appEmbed.render();
|
|
320
|
+
expect(getIFrameSrc()).toBe(
|
|
321
|
+
`http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&${defaultParamsForPinboardEmbed}` +
|
|
322
|
+
'&foo=bar&baz=1&bool=true#/home',
|
|
323
|
+
);
|
|
324
|
+
});
|
|
325
|
+
});
|
|
303
326
|
});
|
package/src/embed/ts-embed.ts
CHANGED
|
@@ -28,10 +28,12 @@ import {
|
|
|
28
28
|
RuntimeFilter,
|
|
29
29
|
Param,
|
|
30
30
|
EmbedConfig,
|
|
31
|
+
Plugin,
|
|
31
32
|
} from '../types';
|
|
32
33
|
import { uploadMixpanelEvent, MIXPANEL_EVENT } from '../mixpanel-service';
|
|
33
34
|
import { getProcessData } from '../utils/processData';
|
|
34
35
|
import { processTrigger } from '../utils/processTrigger';
|
|
36
|
+
// eslint-disable-next-line import/no-cycle
|
|
35
37
|
import pkgInfo from '../../package.json';
|
|
36
38
|
import { getAuthPromise, getEmbedConfig, renderInQueue } from './base';
|
|
37
39
|
|
|
@@ -102,7 +104,7 @@ export interface ViewConfig {
|
|
|
102
104
|
/**
|
|
103
105
|
* The list of actions to display from the primary menu, more menu
|
|
104
106
|
* (...), and the contextual menu.
|
|
105
|
-
*
|
|
107
|
+
* @version 1.6.0 or later
|
|
106
108
|
*/
|
|
107
109
|
visibleActions?: Action[];
|
|
108
110
|
/**
|
|
@@ -110,6 +112,20 @@ export interface ViewConfig {
|
|
|
110
112
|
* visualization, or Liveboard.
|
|
111
113
|
*/
|
|
112
114
|
runtimeFilters?: RuntimeFilter[];
|
|
115
|
+
/**
|
|
116
|
+
* This is an object (key/val) of override flags which will be applied
|
|
117
|
+
* to the internal embedded object. This can be used to add any
|
|
118
|
+
* URL flag.
|
|
119
|
+
* @version 1.8.0
|
|
120
|
+
*/
|
|
121
|
+
additionalFlags?: { [key: string]: string | number | boolean };
|
|
122
|
+
/**
|
|
123
|
+
* Provide a list of plugins, the plugins are executed in the order
|
|
124
|
+
* provided below,
|
|
125
|
+
*
|
|
126
|
+
* @version alpha
|
|
127
|
+
*/
|
|
128
|
+
plugins?: Plugin[];
|
|
113
129
|
}
|
|
114
130
|
|
|
115
131
|
/**
|
|
@@ -178,6 +194,8 @@ export class TsEmbed {
|
|
|
178
194
|
this.isError = false;
|
|
179
195
|
this.viewConfig = viewConfig;
|
|
180
196
|
this.shouldEncodeUrlQueryParams = this.embedConfig.shouldEncodeUrlQueryParams;
|
|
197
|
+
this.registerPlugins(viewConfig?.plugins);
|
|
198
|
+
|
|
181
199
|
if (!this.embedConfig.suppressNoCookieAccessAlert) {
|
|
182
200
|
this.on(EmbedEvent.NoCookieAccess, () => {
|
|
183
201
|
// eslint-disable-next-line no-alert
|
|
@@ -188,6 +206,18 @@ export class TsEmbed {
|
|
|
188
206
|
}
|
|
189
207
|
}
|
|
190
208
|
|
|
209
|
+
private registerPlugins(plugins: Plugin[]) {
|
|
210
|
+
if (!plugins) {
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
plugins.forEach((plugin) => {
|
|
214
|
+
Object.keys(plugin.handlers).forEach((eventName: EmbedEvent) => {
|
|
215
|
+
const listener = plugin[eventName];
|
|
216
|
+
this.on(eventName, listener);
|
|
217
|
+
});
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
|
|
191
221
|
/**
|
|
192
222
|
* Gets a reference to the root DOM node where
|
|
193
223
|
* the embedded content will appear.
|
|
@@ -327,6 +357,7 @@ export class TsEmbed {
|
|
|
327
357
|
disabledActionReason,
|
|
328
358
|
hiddenActions,
|
|
329
359
|
visibleActions,
|
|
360
|
+
additionalFlags,
|
|
330
361
|
} = this.viewConfig;
|
|
331
362
|
|
|
332
363
|
if (Array.isArray(visibleActions) && Array.isArray(hiddenActions)) {
|
|
@@ -348,6 +379,9 @@ export class TsEmbed {
|
|
|
348
379
|
if (Array.isArray(visibleActions)) {
|
|
349
380
|
queryParams[Param.VisibleActions] = visibleActions;
|
|
350
381
|
}
|
|
382
|
+
if (additionalFlags && additionalFlags.constructor.name === 'Object') {
|
|
383
|
+
Object.assign(queryParams, additionalFlags);
|
|
384
|
+
}
|
|
351
385
|
return queryParams;
|
|
352
386
|
}
|
|
353
387
|
|
package/src/index.ts
CHANGED
package/src/react/index.spec.tsx
CHANGED
|
@@ -31,7 +31,7 @@ describe('React Components', () => {
|
|
|
31
31
|
await waitFor(() => getIFrameEl(container));
|
|
32
32
|
|
|
33
33
|
expect(getIFrameSrc(container)).toBe(
|
|
34
|
-
`http://${thoughtSpotHost}/?hostAppUrl=local-host&viewPortHeight=768&viewPortWidth=1024&sdkVersion=${version}&hideAction=[%22editACopy%22,%22saveAsView%22]&dataSourceMode=hide&useLastSelectedSources=false&isSearchEmbed=true#/embed/answer`,
|
|
34
|
+
`http://${thoughtSpotHost}/?hostAppUrl=local-host&viewPortHeight=768&viewPortWidth=1024&sdkVersion=${version}&hideAction=[%22editACopy%22,%22saveAsView%22,%22updateTSL%22,%22editTSL%22,%22onDeleteAnswer%22]&dataSourceMode=hide&useLastSelectedSources=false&isSearchEmbed=true#/embed/answer`,
|
|
35
35
|
);
|
|
36
36
|
});
|
|
37
37
|
|
package/src/types.ts
CHANGED
|
@@ -135,6 +135,7 @@ export interface EmbedConfig {
|
|
|
135
135
|
|
|
136
136
|
/**
|
|
137
137
|
* Dynamic CSS Url to be injected in the loaded application.
|
|
138
|
+
* You would also need to set `style-src` in the CSP settings.
|
|
138
139
|
* @version 1.6.0 or later
|
|
139
140
|
* @default ''
|
|
140
141
|
*/
|
|
@@ -282,6 +283,12 @@ export enum EmbedEvent {
|
|
|
282
283
|
* @return dataSourceIds - the list of data sources
|
|
283
284
|
*/
|
|
284
285
|
DataSourceSelected = 'dataSourceSelected',
|
|
286
|
+
/**
|
|
287
|
+
* One or more data columns have been selected.
|
|
288
|
+
* @return columnIds - the list of columns
|
|
289
|
+
* @version SDK: 1.9.0 | ThoughtSpot: 8.2.0.cl
|
|
290
|
+
*/
|
|
291
|
+
AddRemoveColumns = 'addRemoveColumns',
|
|
285
292
|
/**
|
|
286
293
|
* A custom action has been triggered
|
|
287
294
|
* @return actionId - The id of the custom action
|
|
@@ -396,7 +403,8 @@ export enum HostEvent {
|
|
|
396
403
|
*/
|
|
397
404
|
SetVisibleVizs = 'SetPinboardVisibleVizs',
|
|
398
405
|
/**
|
|
399
|
-
* Update the runtime filters
|
|
406
|
+
* Update the runtime filters. The runtime filters passed here are extended
|
|
407
|
+
* on to the existing runtime filters if they exist.
|
|
400
408
|
* @param - {@link RuntimeFilter}[] an array of {@link RuntimeFilter} Types.
|
|
401
409
|
* @version 1.8.0 or later
|
|
402
410
|
*/
|
|
@@ -431,7 +439,6 @@ export enum DataSourceVisualMode {
|
|
|
431
439
|
export enum Param {
|
|
432
440
|
DataSources = 'dataSources',
|
|
433
441
|
DataSourceMode = 'dataSourceMode',
|
|
434
|
-
ExpandAllDataSource = 'expandAllDataSource',
|
|
435
442
|
DisableActions = 'disableAction',
|
|
436
443
|
DisableActionReason = 'disableHint',
|
|
437
444
|
ForceTable = 'forceTable',
|
|
@@ -508,10 +515,6 @@ export enum Action {
|
|
|
508
515
|
PinboardInfo = 'pinboardInfo',
|
|
509
516
|
LiveboardInfo = 'pinboardInfo',
|
|
510
517
|
SendAnswerFeedback = 'sendFeedback',
|
|
511
|
-
/**
|
|
512
|
-
* @deprecated Will be removed in next version
|
|
513
|
-
*/
|
|
514
|
-
CustomAction = 'customAction',
|
|
515
518
|
DownloadEmbraceQueries = 'downloadEmbraceQueries',
|
|
516
519
|
Pin = 'pin',
|
|
517
520
|
AnalysisInfo = 'analysisInfo',
|
|
@@ -527,6 +530,26 @@ export enum Action {
|
|
|
527
530
|
DrillDown = 'DRILL',
|
|
528
531
|
RequestAccess = 'requestAccess',
|
|
529
532
|
QueryDetailsButtons = 'queryDetailsButtons',
|
|
533
|
+
/**
|
|
534
|
+
* @version SDK: 1.8.0 | ThoughtSpot: 8.1.0.cl
|
|
535
|
+
*/
|
|
536
|
+
Monitor = 'createMonitor',
|
|
537
|
+
/**
|
|
538
|
+
* @version SDK: 1.8.0 | ThoughtSpot: 8.1.0.cl
|
|
539
|
+
*/
|
|
540
|
+
AnswerDelete = 'onDeleteAnswer',
|
|
541
|
+
/**
|
|
542
|
+
* @version SDK: 1.8.0 | ThoughtSpot: 8.1.0.cl
|
|
543
|
+
*/
|
|
544
|
+
AnswerChartSwitcher = 'answerChartSwitcher',
|
|
545
|
+
/**
|
|
546
|
+
* @version SDK: 1.8.0 | ThoughtSpot: 8.1.0.cl
|
|
547
|
+
*/
|
|
548
|
+
AddToFavorites = 'addToFavorites',
|
|
549
|
+
/**
|
|
550
|
+
* @version SDK: 1.8.0 | ThoughtSpot: 8.1.0.cl
|
|
551
|
+
*/
|
|
552
|
+
EditDetails = 'editDetails',
|
|
530
553
|
}
|
|
531
554
|
|
|
532
555
|
export interface SessionInterface {
|
|
@@ -544,3 +567,10 @@ export enum OperationType {
|
|
|
544
567
|
export interface AnswerServiceType {
|
|
545
568
|
getAnswer?: (offset: number, batchSize: number) => any;
|
|
546
569
|
}
|
|
570
|
+
|
|
571
|
+
export interface Plugin {
|
|
572
|
+
name: string;
|
|
573
|
+
handlers: {
|
|
574
|
+
[key in EmbedEvent]: (payload: any) => void;
|
|
575
|
+
};
|
|
576
|
+
}
|