@thoughtspot/visual-embed-sdk 1.7.0-alpha.1 → 1.8.0-alpha.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/README.md +1 -1
- package/dist/src/auth.d.ts +3 -5
- package/dist/src/embed/app.d.ts +1 -1
- package/dist/src/embed/liveboard.d.ts +1 -1
- package/dist/src/embed/pinboard.d.ts +85 -0
- package/dist/src/embed/search.d.ts +1 -1
- package/dist/src/embed/ts-embed.d.ts +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/types.d.ts +37 -3
- package/dist/src/utils.d.ts +1 -1
- package/dist/tsembed.es.js +73 -18
- package/dist/tsembed.js +70 -18
- package/lib/package.json +1 -1
- package/lib/src/auth.d.ts +3 -5
- package/lib/src/auth.js +27 -9
- package/lib/src/auth.js.map +1 -1
- package/lib/src/auth.spec.js +2 -2
- package/lib/src/auth.spec.js.map +1 -1
- package/lib/src/config.js +1 -1
- package/lib/src/embed/app.d.ts +1 -1
- package/lib/src/embed/app.js +1 -1
- package/lib/src/embed/base.js +1 -1
- package/lib/src/embed/liveboard.d.ts +1 -1
- package/lib/src/embed/liveboard.js +1 -1
- package/lib/src/embed/pinboard.d.ts +85 -0
- package/lib/src/embed/pinboard.js +107 -0
- package/lib/src/embed/pinboard.js.map +1 -0
- package/lib/src/embed/search.d.ts +1 -1
- package/lib/src/embed/search.js +5 -2
- package/lib/src/embed/search.js.map +1 -1
- package/lib/src/embed/search.spec.js +13 -12
- package/lib/src/embed/search.spec.js.map +1 -1
- package/lib/src/embed/ts-embed.d.ts +1 -1
- package/lib/src/embed/ts-embed.js +1 -1
- package/lib/src/index.d.ts +1 -1
- package/lib/src/index.js +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 +37 -3
- package/lib/src/types.js +35 -1
- package/lib/src/types.js.map +1 -1
- package/lib/src/utils/fetchAnswers.d.ts +3 -0
- package/lib/src/utils/fetchAnswers.js +49 -0
- package/lib/src/utils/fetchAnswers.js.map +1 -0
- package/lib/src/utils.d.ts +1 -1
- package/lib/src/utils.js +1 -1
- package/lib/src/visual-embed-sdk.d.ts +41 -7
- package/package.json +1 -1
- package/src/auth.spec.ts +2 -2
- package/src/auth.ts +37 -9
- package/src/config.ts +1 -1
- package/src/embed/app.ts +1 -1
- package/src/embed/base.ts +1 -1
- package/src/embed/liveboard.ts +1 -1
- package/src/embed/search.spec.ts +13 -12
- package/src/embed/search.ts +5 -2
- package/src/embed/ts-embed.ts +1 -1
- package/src/index.ts +1 -1
- package/src/react/index.spec.tsx +1 -1
- package/src/types.ts +35 -1
- package/src/utils.ts +1 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
declare module '@thoughtspot/visual-embed-sdk' {
|
|
4
4
|
/**
|
|
5
|
-
* Copyright (c)
|
|
5
|
+
* Copyright (c) 2022
|
|
6
6
|
*
|
|
7
7
|
* ThoughtSpot Visual Embed SDK for embedding ThoughtSpot analytics
|
|
8
8
|
* in other web applications.
|
|
@@ -20,7 +20,7 @@ declare module '@thoughtspot/visual-embed-sdk' {
|
|
|
20
20
|
|
|
21
21
|
declare module '@thoughtspot/visual-embed-sdk/embed/app' {
|
|
22
22
|
/**
|
|
23
|
-
* Copyright (c)
|
|
23
|
+
* Copyright (c) 2022
|
|
24
24
|
*
|
|
25
25
|
* Full application embedding
|
|
26
26
|
* https://developers.thoughtspot.com/docs/?pageid=full-embed
|
|
@@ -149,7 +149,7 @@ declare module '@thoughtspot/visual-embed-sdk/embed/base' {
|
|
|
149
149
|
|
|
150
150
|
declare module '@thoughtspot/visual-embed-sdk/embed/liveboard' {
|
|
151
151
|
/**
|
|
152
|
-
* Copyright (c)
|
|
152
|
+
* Copyright (c) 2022
|
|
153
153
|
*
|
|
154
154
|
* Embed a ThoughtSpot Liveboard or visualization
|
|
155
155
|
* https://developers.thoughtspot.com/docs/?pageid=embed-pinboard
|
|
@@ -230,7 +230,7 @@ declare module '@thoughtspot/visual-embed-sdk/embed/liveboard' {
|
|
|
230
230
|
|
|
231
231
|
declare module '@thoughtspot/visual-embed-sdk/embed/search' {
|
|
232
232
|
/**
|
|
233
|
-
* Copyright (c)
|
|
233
|
+
* Copyright (c) 2022
|
|
234
234
|
*
|
|
235
235
|
* Embed ThoughtSpot search or a saved answer
|
|
236
236
|
*
|
|
@@ -336,6 +336,10 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
|
|
|
336
336
|
* SSO using SAML
|
|
337
337
|
*/
|
|
338
338
|
SSO = "SSO_SAML",
|
|
339
|
+
/**
|
|
340
|
+
* SSO using OIDC
|
|
341
|
+
*/
|
|
342
|
+
OIDC = "SSO_OIDC",
|
|
339
343
|
/**
|
|
340
344
|
* Trusted authentication server
|
|
341
345
|
*/
|
|
@@ -648,6 +652,9 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
|
|
|
648
652
|
/**
|
|
649
653
|
* Event types that can be triggered by the host application
|
|
650
654
|
* to the embedded ThoughtSpot app
|
|
655
|
+
*
|
|
656
|
+
* To trigger an event use the corresponding
|
|
657
|
+
* {@link LiveboardEmbed.trigger} or {@link AppEmbed.trigger} or {@link SearchEmbed.trigger} method.
|
|
651
658
|
*/
|
|
652
659
|
export enum HostEvent {
|
|
653
660
|
/**
|
|
@@ -681,7 +688,13 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
|
|
|
681
688
|
* will be hidden.
|
|
682
689
|
* @version 1.6.0 or later
|
|
683
690
|
*/
|
|
684
|
-
SetVisibleVizs = "SetPinboardVisibleVizs"
|
|
691
|
+
SetVisibleVizs = "SetPinboardVisibleVizs",
|
|
692
|
+
/**
|
|
693
|
+
* Update the runtime filters
|
|
694
|
+
* @param - {@link RuntimeFilter}[] an array of {@link RuntimeFilter} Types.
|
|
695
|
+
* @version 1.8.0 or later
|
|
696
|
+
*/
|
|
697
|
+
UpdateRuntimeFilters = "UpdateRuntimeFilters"
|
|
685
698
|
}
|
|
686
699
|
/**
|
|
687
700
|
* The different visual modes that the data sources panel within
|
|
@@ -725,6 +738,7 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
|
|
|
725
738
|
executeSearch = "executeSearch",
|
|
726
739
|
fullHeight = "isFullHeightPinboard",
|
|
727
740
|
livedBoardEmbed = "isLiveboardEmbed",
|
|
741
|
+
searchEmbed = "isSearchEmbed",
|
|
728
742
|
Version = "sdkVersion",
|
|
729
743
|
ViewPortHeight = "viewPortHeight",
|
|
730
744
|
ViewPortWidth = "viewPortWidth",
|
|
@@ -799,7 +813,27 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
|
|
|
799
813
|
Separator = "context-menu-item-separator",
|
|
800
814
|
DrillDown = "DRILL",
|
|
801
815
|
RequestAccess = "requestAccess",
|
|
802
|
-
QueryDetailsButtons = "queryDetailsButtons"
|
|
816
|
+
QueryDetailsButtons = "queryDetailsButtons",
|
|
817
|
+
/**
|
|
818
|
+
* @version SDK: 1.8.0 | ThoughtSpot: 8.1.0.cl
|
|
819
|
+
*/
|
|
820
|
+
Monitor = "createMonitor",
|
|
821
|
+
/**
|
|
822
|
+
* @version SDK: 1.8.0 | ThoughtSpot: 8.1.0.cl
|
|
823
|
+
*/
|
|
824
|
+
AnswerDelete = "onDeleteAnswer",
|
|
825
|
+
/**
|
|
826
|
+
* @version SDK: 1.8.0 | ThoughtSpot: 8.1.0.cl
|
|
827
|
+
*/
|
|
828
|
+
AnswerChartSwitcher = "answerChartSwitcher",
|
|
829
|
+
/**
|
|
830
|
+
* @version SDK: 1.8.0 | ThoughtSpot: 8.1.0.cl
|
|
831
|
+
*/
|
|
832
|
+
AddToFavorites = "addToFavorites",
|
|
833
|
+
/**
|
|
834
|
+
* @version SDK: 1.8.0 | ThoughtSpot: 8.1.0.cl
|
|
835
|
+
*/
|
|
836
|
+
EditDetails = "editDetails"
|
|
803
837
|
}
|
|
804
838
|
export interface SessionInterface {
|
|
805
839
|
sessionId: string;
|
|
@@ -820,7 +854,7 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
|
|
|
820
854
|
|
|
821
855
|
declare module '@thoughtspot/visual-embed-sdk/embed/ts-embed' {
|
|
822
856
|
/**
|
|
823
|
-
* Copyright (c)
|
|
857
|
+
* Copyright (c) 2022
|
|
824
858
|
*
|
|
825
859
|
* Base classes
|
|
826
860
|
*
|
package/package.json
CHANGED
package/src/auth.spec.ts
CHANGED
|
@@ -74,8 +74,8 @@ describe('Unit test for auth', () => {
|
|
|
74
74
|
global.fetch = window.fetch;
|
|
75
75
|
});
|
|
76
76
|
|
|
77
|
-
test('endpoints,
|
|
78
|
-
const ssoTemplateUrl = authInstance.EndPoints.
|
|
77
|
+
test('endpoints, SAML_LOGIN_TEMPLATE', () => {
|
|
78
|
+
const ssoTemplateUrl = authInstance.EndPoints.SAML_LOGIN_TEMPLATE(
|
|
79
79
|
thoughtSpotHost,
|
|
80
80
|
);
|
|
81
81
|
expect(ssoTemplateUrl).toBe(
|
package/src/auth.ts
CHANGED
|
@@ -23,8 +23,10 @@ export const SSO_REDIRECTION_MARKER_GUID =
|
|
|
23
23
|
|
|
24
24
|
export const EndPoints = {
|
|
25
25
|
AUTH_VERIFICATION: '/callosum/v1/session/info',
|
|
26
|
-
|
|
26
|
+
SAML_LOGIN_TEMPLATE: (targetUrl: string) =>
|
|
27
27
|
`/callosum/v1/saml/login?targetURLPath=${targetUrl}`,
|
|
28
|
+
OIDC_LOGIN_TEMPLATE: (targetUrl: string) =>
|
|
29
|
+
`/callosum/v1/oidc/login?targetURLPath=${targetUrl}`,
|
|
28
30
|
TOKEN_LOGIN: '/callosum/v1/session/login/token',
|
|
29
31
|
BASIC_LOGIN: '/callosum/v1/session/login',
|
|
30
32
|
};
|
|
@@ -171,7 +173,10 @@ async function samlPopupFlow(ssoURL: string) {
|
|
|
171
173
|
* Perform SAML authentication
|
|
172
174
|
* @param embedConfig The embed configuration
|
|
173
175
|
*/
|
|
174
|
-
|
|
176
|
+
const doSSOAuth = async (
|
|
177
|
+
embedConfig: EmbedConfig,
|
|
178
|
+
ssoEndPoint: string,
|
|
179
|
+
): Promise<void> => {
|
|
175
180
|
const { thoughtSpotHost } = embedConfig;
|
|
176
181
|
const loggedIn = await isLoggedIn(thoughtSpotHost);
|
|
177
182
|
if (loggedIn) {
|
|
@@ -190,6 +195,17 @@ export const doSamlAuth = async (embedConfig: EmbedConfig): Promise<void> => {
|
|
|
190
195
|
return;
|
|
191
196
|
}
|
|
192
197
|
|
|
198
|
+
const ssoURL = `${thoughtSpotHost}${ssoEndPoint}`;
|
|
199
|
+
if (embedConfig.noRedirect) {
|
|
200
|
+
await samlPopupFlow(ssoURL);
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
window.location.href = ssoURL;
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
export const doSamlAuth = async (embedConfig: EmbedConfig) => {
|
|
208
|
+
const { thoughtSpotHost } = embedConfig;
|
|
193
209
|
// redirect for SSO, when the SSO authentication is done, this page will be loaded
|
|
194
210
|
// again and the same JS will execute again.
|
|
195
211
|
const ssoRedirectUrl = embedConfig.noRedirect
|
|
@@ -197,17 +213,27 @@ export const doSamlAuth = async (embedConfig: EmbedConfig): Promise<void> => {
|
|
|
197
213
|
: appendToUrlHash(window.location.href, SSO_REDIRECTION_MARKER_GUID);
|
|
198
214
|
|
|
199
215
|
// bring back the page to the same URL
|
|
200
|
-
const ssoEndPoint = `${EndPoints.
|
|
216
|
+
const ssoEndPoint = `${EndPoints.SAML_LOGIN_TEMPLATE(
|
|
201
217
|
encodeURIComponent(ssoRedirectUrl),
|
|
202
218
|
)}`;
|
|
203
219
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
await samlPopupFlow(ssoURL);
|
|
207
|
-
return;
|
|
208
|
-
}
|
|
220
|
+
await doSSOAuth(embedConfig, ssoEndPoint);
|
|
221
|
+
};
|
|
209
222
|
|
|
210
|
-
|
|
223
|
+
export const doOIDCAuth = async (embedConfig: EmbedConfig) => {
|
|
224
|
+
const { thoughtSpotHost } = embedConfig;
|
|
225
|
+
// redirect for SSO, when the SSO authentication is done, this page will be loaded
|
|
226
|
+
// again and the same JS will execute again.
|
|
227
|
+
const ssoRedirectUrl = embedConfig.noRedirect
|
|
228
|
+
? `${thoughtSpotHost}/v2/#/embed/saml-complete`
|
|
229
|
+
: appendToUrlHash(window.location.href, SSO_REDIRECTION_MARKER_GUID);
|
|
230
|
+
|
|
231
|
+
// bring back the page to the same URL
|
|
232
|
+
const ssoEndPoint = `${EndPoints.OIDC_LOGIN_TEMPLATE(
|
|
233
|
+
encodeURIComponent(ssoRedirectUrl),
|
|
234
|
+
)}`;
|
|
235
|
+
|
|
236
|
+
await doSSOAuth(embedConfig, ssoEndPoint);
|
|
211
237
|
};
|
|
212
238
|
|
|
213
239
|
/**
|
|
@@ -219,6 +245,8 @@ export const authenticate = async (embedConfig: EmbedConfig): Promise<void> => {
|
|
|
219
245
|
switch (authType) {
|
|
220
246
|
case AuthType.SSO:
|
|
221
247
|
return doSamlAuth(embedConfig);
|
|
248
|
+
case AuthType.OIDC:
|
|
249
|
+
return doOIDCAuth(embedConfig);
|
|
222
250
|
case AuthType.AuthServer:
|
|
223
251
|
return doTokenAuth(embedConfig);
|
|
224
252
|
case AuthType.Basic:
|
package/src/config.ts
CHANGED
package/src/embed/app.ts
CHANGED
package/src/embed/base.ts
CHANGED
package/src/embed/liveboard.ts
CHANGED
package/src/embed/search.spec.ts
CHANGED
|
@@ -23,6 +23,7 @@ const hideBydefault = `&hideAction=${fixedEncodeURI(
|
|
|
23
23
|
JSON.stringify(HiddenActionItemByDefaultForSearchEmbed),
|
|
24
24
|
)}`;
|
|
25
25
|
const defaultParamsWithHiddenActions = defaultParams + hideBydefault;
|
|
26
|
+
const prefixParams = '&isSearchEmbed=true';
|
|
26
27
|
|
|
27
28
|
beforeAll(() => {
|
|
28
29
|
init({
|
|
@@ -41,7 +42,7 @@ describe('Search embed tests', () => {
|
|
|
41
42
|
searchEmbed.render();
|
|
42
43
|
await executeAfterWait(() => {
|
|
43
44
|
expect(getIFrameSrc()).toBe(
|
|
44
|
-
`http://${thoughtSpotHost}/v2/?${defaultParamsWithHiddenActions}&dataSourceMode=expand&useLastSelectedSources=false#/embed/answer`,
|
|
45
|
+
`http://${thoughtSpotHost}/v2/?${defaultParamsWithHiddenActions}&dataSourceMode=expand&useLastSelectedSources=false${prefixParams}#/embed/answer`,
|
|
45
46
|
);
|
|
46
47
|
});
|
|
47
48
|
});
|
|
@@ -55,7 +56,7 @@ describe('Search embed tests', () => {
|
|
|
55
56
|
searchEmbed.render();
|
|
56
57
|
await executeAfterWait(() => {
|
|
57
58
|
expect(getIFrameSrc()).toBe(
|
|
58
|
-
`http://${thoughtSpotHost}/v2/?${defaultParamsWithHiddenActions}&dataSources=[%22data-source-1%22]&dataSourceMode=expand&useLastSelectedSources=false#/embed/answer`,
|
|
59
|
+
`http://${thoughtSpotHost}/v2/?${defaultParamsWithHiddenActions}&dataSources=[%22data-source-1%22]&dataSourceMode=expand&useLastSelectedSources=false${prefixParams}#/embed/answer`,
|
|
59
60
|
);
|
|
60
61
|
});
|
|
61
62
|
});
|
|
@@ -73,7 +74,7 @@ describe('Search embed tests', () => {
|
|
|
73
74
|
searchEmbed.render();
|
|
74
75
|
await executeAfterWait(() => {
|
|
75
76
|
expect(getIFrameSrc()).toBe(
|
|
76
|
-
`http://${thoughtSpotHost}/v2/?${defaultParamsWithHiddenActions}&dataSources=[%22data-source-1%22]&searchTokenString=%5Bcommit%20date%5D%5Brevenue%5D&dataSourceMode=expand&useLastSelectedSources=false#/embed/answer`,
|
|
77
|
+
`http://${thoughtSpotHost}/v2/?${defaultParamsWithHiddenActions}&dataSources=[%22data-source-1%22]&searchTokenString=%5Bcommit%20date%5D%5Brevenue%5D&dataSourceMode=expand&useLastSelectedSources=false${prefixParams}#/embed/answer`,
|
|
77
78
|
);
|
|
78
79
|
});
|
|
79
80
|
});
|
|
@@ -91,7 +92,7 @@ describe('Search embed tests', () => {
|
|
|
91
92
|
searchEmbed.render();
|
|
92
93
|
await executeAfterWait(() => {
|
|
93
94
|
expect(getIFrameSrc()).toBe(
|
|
94
|
-
`http://${thoughtSpotHost}/v2/?${defaultParamsWithHiddenActions}&searchTokenString=%5Bcommit%20date%5D%5Brevenue%5D&dataSourceMode=expand&useLastSelectedSources=false#/embed/answer`,
|
|
95
|
+
`http://${thoughtSpotHost}/v2/?${defaultParamsWithHiddenActions}&searchTokenString=%5Bcommit%20date%5D%5Brevenue%5D&dataSourceMode=expand&useLastSelectedSources=false${prefixParams}#/embed/answer`,
|
|
95
96
|
);
|
|
96
97
|
});
|
|
97
98
|
|
|
@@ -106,7 +107,7 @@ describe('Search embed tests', () => {
|
|
|
106
107
|
searchEmbed.render();
|
|
107
108
|
await executeAfterWait(() => {
|
|
108
109
|
expect(getIFrameSrc()).toBe(
|
|
109
|
-
`http://${thoughtSpotHost}/v2/?${defaultParamsWithHiddenActions}&searchTokenString=%5Bcommit%20date%5D%5Brevenue%5D&executeSearch=true&dataSourceMode=expand&useLastSelectedSources=false#/embed/answer`,
|
|
110
|
+
`http://${thoughtSpotHost}/v2/?${defaultParamsWithHiddenActions}&searchTokenString=%5Bcommit%20date%5D%5Brevenue%5D&executeSearch=true&dataSourceMode=expand&useLastSelectedSources=false${prefixParams}#/embed/answer`,
|
|
110
111
|
);
|
|
111
112
|
});
|
|
112
113
|
});
|
|
@@ -125,7 +126,7 @@ describe('Search embed tests', () => {
|
|
|
125
126
|
searchEmbed.render();
|
|
126
127
|
await executeAfterWait(() => {
|
|
127
128
|
expect(getIFrameSrc()).toBe(
|
|
128
|
-
`http://${thoughtSpotHost}/v2/?${defaultParamsWithHiddenActions}&dataSources=[%22data-source-1%22]&searchTokenString=%5Bcommit%20date%5D%5Brevenue%5D&dataSourceMode=collapse&useLastSelectedSources=false#/embed/answer`,
|
|
129
|
+
`http://${thoughtSpotHost}/v2/?${defaultParamsWithHiddenActions}&dataSources=[%22data-source-1%22]&searchTokenString=%5Bcommit%20date%5D%5Brevenue%5D&dataSourceMode=collapse&useLastSelectedSources=false${prefixParams}#/embed/answer`,
|
|
129
130
|
);
|
|
130
131
|
});
|
|
131
132
|
});
|
|
@@ -144,7 +145,7 @@ describe('Search embed tests', () => {
|
|
|
144
145
|
searchEmbed.render();
|
|
145
146
|
await executeAfterWait(() => {
|
|
146
147
|
expect(getIFrameSrc()).toBe(
|
|
147
|
-
`http://${thoughtSpotHost}/v2/?${defaultParamsWithHiddenActions}&dataSources=[%22data-source-1%22]&searchTokenString=%5Bcommit%20date%5D%5Brevenue%5D&dataSourceMode=hide&useLastSelectedSources=false#/embed/answer`,
|
|
148
|
+
`http://${thoughtSpotHost}/v2/?${defaultParamsWithHiddenActions}&dataSources=[%22data-source-1%22]&searchTokenString=%5Bcommit%20date%5D%5Brevenue%5D&dataSourceMode=hide&useLastSelectedSources=false${prefixParams}#/embed/answer`,
|
|
148
149
|
);
|
|
149
150
|
});
|
|
150
151
|
});
|
|
@@ -164,7 +165,7 @@ describe('Search embed tests', () => {
|
|
|
164
165
|
searchEmbed.render();
|
|
165
166
|
await executeAfterWait(() => {
|
|
166
167
|
expect(getIFrameSrc()).toBe(
|
|
167
|
-
`http://${thoughtSpotHost}/v2/?${defaultParams}&disableAction=[%22download%22,%22edit%22]&disableHint=Permission%20denied${hideBydefault}&dataSources=[%22data-source-1%22]&searchTokenString=%5Bcommit%20date%5D%5Brevenue%5D&dataSourceMode=expand&useLastSelectedSources=false#/embed/answer`,
|
|
168
|
+
`http://${thoughtSpotHost}/v2/?${defaultParams}&disableAction=[%22download%22,%22edit%22]&disableHint=Permission%20denied${hideBydefault}&dataSources=[%22data-source-1%22]&searchTokenString=%5Bcommit%20date%5D%5Brevenue%5D&dataSourceMode=expand&useLastSelectedSources=false${prefixParams}#/embed/answer`,
|
|
168
169
|
);
|
|
169
170
|
});
|
|
170
171
|
});
|
|
@@ -177,7 +178,7 @@ describe('Search embed tests', () => {
|
|
|
177
178
|
searchEmbed.render();
|
|
178
179
|
await executeAfterWait(() => {
|
|
179
180
|
expect(getIFrameSrc()).toBe(
|
|
180
|
-
`http://${thoughtSpotHost}/v2/?${defaultParamsWithHiddenActions}&enableSearchAssist=true&dataSourceMode=expand&useLastSelectedSources=false#/embed/answer`,
|
|
181
|
+
`http://${thoughtSpotHost}/v2/?${defaultParamsWithHiddenActions}&enableSearchAssist=true&dataSourceMode=expand&useLastSelectedSources=false${prefixParams}#/embed/answer`,
|
|
181
182
|
);
|
|
182
183
|
});
|
|
183
184
|
});
|
|
@@ -202,7 +203,7 @@ describe('Search embed tests', () => {
|
|
|
202
203
|
);
|
|
203
204
|
await executeAfterWait(() => {
|
|
204
205
|
expect(getIFrameSrc()).toBe(
|
|
205
|
-
`http://${thoughtSpotHost}/v2/?${defaultParams}&hideAction=${hideActionUrl}&dataSourceMode=expand&useLastSelectedSources=false#/embed/saved-answer/${answerId}`,
|
|
206
|
+
`http://${thoughtSpotHost}/v2/?${defaultParams}&hideAction=${hideActionUrl}&dataSourceMode=expand&useLastSelectedSources=false${prefixParams}#/embed/saved-answer/${answerId}`,
|
|
206
207
|
);
|
|
207
208
|
});
|
|
208
209
|
});
|
|
@@ -225,7 +226,7 @@ describe('Search embed tests', () => {
|
|
|
225
226
|
);
|
|
226
227
|
await executeAfterWait(() => {
|
|
227
228
|
expect(getIFrameSrc()).toBe(
|
|
228
|
-
`http://${thoughtSpotHost}/v2/?${defaultParams}&disableAction=[%22downloadAsXLSX%22]&disableHint=Access%20denied&hideAction=${hideActionUrl}&dataSourceMode=expand&useLastSelectedSources=false#/embed/saved-answer/${answerId}`,
|
|
229
|
+
`http://${thoughtSpotHost}/v2/?${defaultParams}&disableAction=[%22downloadAsXLSX%22]&disableHint=Access%20denied&hideAction=${hideActionUrl}&dataSourceMode=expand&useLastSelectedSources=false${prefixParams}#/embed/saved-answer/${answerId}`,
|
|
229
230
|
);
|
|
230
231
|
});
|
|
231
232
|
});
|
|
@@ -238,7 +239,7 @@ describe('Search embed tests', () => {
|
|
|
238
239
|
searchEmbed.render();
|
|
239
240
|
await executeAfterWait(() => {
|
|
240
241
|
expect(getIFrameSrc()).toBe(
|
|
241
|
-
`http://${thoughtSpotHost}/v2/?${defaultParamsWithHiddenActions}&dataSourceMode=expand&useLastSelectedSources=false#/embed/saved-answer/${answerId}`,
|
|
242
|
+
`http://${thoughtSpotHost}/v2/?${defaultParamsWithHiddenActions}&dataSourceMode=expand&useLastSelectedSources=false${prefixParams}#/embed/saved-answer/${answerId}`,
|
|
242
243
|
);
|
|
243
244
|
});
|
|
244
245
|
});
|
package/src/embed/search.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright (c)
|
|
2
|
+
* Copyright (c) 2022
|
|
3
3
|
*
|
|
4
4
|
* Embed ThoughtSpot search or a saved answer
|
|
5
5
|
*
|
|
@@ -79,8 +79,10 @@ export interface SearchViewConfig extends ViewConfig {
|
|
|
79
79
|
|
|
80
80
|
export const HiddenActionItemByDefaultForSearchEmbed = [
|
|
81
81
|
Action.EditACopy,
|
|
82
|
-
Action.SpotIQAnalyze,
|
|
83
82
|
Action.SaveAsView,
|
|
83
|
+
Action.UpdateTML,
|
|
84
|
+
Action.EditTML,
|
|
85
|
+
Action.AnswerDelete,
|
|
84
86
|
];
|
|
85
87
|
|
|
86
88
|
/**
|
|
@@ -160,6 +162,7 @@ export class SearchEmbed extends TsEmbed {
|
|
|
160
162
|
|
|
161
163
|
queryParams[Param.DataSourceMode] = this.getDataSourceMode();
|
|
162
164
|
queryParams[Param.UseLastSelectedDataSource] = false;
|
|
165
|
+
queryParams[Param.searchEmbed] = true;
|
|
163
166
|
let query = '';
|
|
164
167
|
const queryParamsString = getQueryParamString(queryParams, true);
|
|
165
168
|
if (queryParamsString) {
|
package/src/embed/ts-embed.ts
CHANGED
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,%
|
|
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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright (c)
|
|
2
|
+
* Copyright (c) 2022
|
|
3
3
|
*
|
|
4
4
|
* TypeScript type definitions for ThoughtSpot Visual Embed SDK
|
|
5
5
|
*
|
|
@@ -21,6 +21,10 @@ export enum AuthType {
|
|
|
21
21
|
* SSO using SAML
|
|
22
22
|
*/
|
|
23
23
|
SSO = 'SSO_SAML',
|
|
24
|
+
/**
|
|
25
|
+
* SSO using OIDC
|
|
26
|
+
*/
|
|
27
|
+
OIDC = 'SSO_OIDC',
|
|
24
28
|
/**
|
|
25
29
|
* Trusted authentication server
|
|
26
30
|
*/
|
|
@@ -353,6 +357,9 @@ export enum EmbedEvent {
|
|
|
353
357
|
/**
|
|
354
358
|
* Event types that can be triggered by the host application
|
|
355
359
|
* to the embedded ThoughtSpot app
|
|
360
|
+
*
|
|
361
|
+
* To trigger an event use the corresponding
|
|
362
|
+
* {@link LiveboardEmbed.trigger} or {@link AppEmbed.trigger} or {@link SearchEmbed.trigger} method.
|
|
356
363
|
*/
|
|
357
364
|
// eslint-disable-next-line no-shadow
|
|
358
365
|
export enum HostEvent {
|
|
@@ -388,6 +395,12 @@ export enum HostEvent {
|
|
|
388
395
|
* @version 1.6.0 or later
|
|
389
396
|
*/
|
|
390
397
|
SetVisibleVizs = 'SetPinboardVisibleVizs',
|
|
398
|
+
/**
|
|
399
|
+
* Update the runtime filters
|
|
400
|
+
* @param - {@link RuntimeFilter}[] an array of {@link RuntimeFilter} Types.
|
|
401
|
+
* @version 1.8.0 or later
|
|
402
|
+
*/
|
|
403
|
+
UpdateRuntimeFilters = 'UpdateRuntimeFilters',
|
|
391
404
|
}
|
|
392
405
|
|
|
393
406
|
/**
|
|
@@ -435,6 +448,7 @@ export enum Param {
|
|
|
435
448
|
executeSearch = 'executeSearch',
|
|
436
449
|
fullHeight = 'isFullHeightPinboard',
|
|
437
450
|
livedBoardEmbed = 'isLiveboardEmbed',
|
|
451
|
+
searchEmbed = 'isSearchEmbed',
|
|
438
452
|
Version = 'sdkVersion',
|
|
439
453
|
ViewPortHeight = 'viewPortHeight',
|
|
440
454
|
ViewPortWidth = 'viewPortWidth',
|
|
@@ -512,6 +526,26 @@ export enum Action {
|
|
|
512
526
|
DrillDown = 'DRILL',
|
|
513
527
|
RequestAccess = 'requestAccess',
|
|
514
528
|
QueryDetailsButtons = 'queryDetailsButtons',
|
|
529
|
+
/**
|
|
530
|
+
* @version SDK: 1.8.0 | ThoughtSpot: 8.1.0.cl
|
|
531
|
+
*/
|
|
532
|
+
Monitor = 'createMonitor',
|
|
533
|
+
/**
|
|
534
|
+
* @version SDK: 1.8.0 | ThoughtSpot: 8.1.0.cl
|
|
535
|
+
*/
|
|
536
|
+
AnswerDelete = 'onDeleteAnswer',
|
|
537
|
+
/**
|
|
538
|
+
* @version SDK: 1.8.0 | ThoughtSpot: 8.1.0.cl
|
|
539
|
+
*/
|
|
540
|
+
AnswerChartSwitcher = 'answerChartSwitcher',
|
|
541
|
+
/**
|
|
542
|
+
* @version SDK: 1.8.0 | ThoughtSpot: 8.1.0.cl
|
|
543
|
+
*/
|
|
544
|
+
AddToFavorites = 'addToFavorites',
|
|
545
|
+
/**
|
|
546
|
+
* @version SDK: 1.8.0 | ThoughtSpot: 8.1.0.cl
|
|
547
|
+
*/
|
|
548
|
+
EditDetails = 'editDetails',
|
|
515
549
|
}
|
|
516
550
|
|
|
517
551
|
export interface SessionInterface {
|
package/src/utils.ts
CHANGED