@thoughtspot/visual-embed-sdk 1.29.1 → 1.30.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/cjs/package.json +1 -1
- package/cjs/src/auth.d.ts +15 -0
- package/cjs/src/auth.d.ts.map +1 -1
- package/cjs/src/auth.js +13 -2
- package/cjs/src/auth.js.map +1 -1
- package/cjs/src/authToken.d.ts +2 -1
- package/cjs/src/authToken.d.ts.map +1 -1
- package/cjs/src/authToken.js +2 -1
- package/cjs/src/authToken.js.map +1 -1
- package/cjs/src/config.d.ts +1 -0
- package/cjs/src/config.d.ts.map +1 -1
- package/cjs/src/config.js +2 -0
- package/cjs/src/config.js.map +1 -1
- package/cjs/src/embed/app.d.ts +50 -4
- package/cjs/src/embed/app.d.ts.map +1 -1
- package/cjs/src/embed/app.js +10 -2
- package/cjs/src/embed/app.js.map +1 -1
- package/cjs/src/embed/base.d.ts +7 -1
- package/cjs/src/embed/base.d.ts.map +1 -1
- package/cjs/src/embed/base.js +13 -6
- package/cjs/src/embed/base.js.map +1 -1
- package/cjs/src/embed/base.spec.js +1 -1
- package/cjs/src/embed/base.spec.js.map +1 -1
- package/cjs/src/embed/embedConfig.d.ts +2 -0
- package/cjs/src/embed/embedConfig.d.ts.map +1 -1
- package/cjs/src/embed/embedConfig.js +2 -0
- package/cjs/src/embed/embedConfig.js.map +1 -1
- package/cjs/src/embed/liveboard.d.ts +30 -0
- package/cjs/src/embed/liveboard.d.ts.map +1 -1
- package/cjs/src/embed/liveboard.js +5 -0
- package/cjs/src/embed/liveboard.js.map +1 -1
- package/cjs/src/embed/sage.d.ts +18 -2
- package/cjs/src/embed/sage.d.ts.map +1 -1
- package/cjs/src/embed/sage.js +5 -0
- package/cjs/src/embed/sage.js.map +1 -1
- package/cjs/src/embed/search-bar.d.ts +11 -0
- package/cjs/src/embed/search-bar.d.ts.map +1 -1
- package/cjs/src/embed/search-bar.js +2 -0
- package/cjs/src/embed/search-bar.js.map +1 -1
- package/cjs/src/embed/search.d.ts +34 -5
- package/cjs/src/embed/search.d.ts.map +1 -1
- package/cjs/src/embed/search.js +7 -4
- package/cjs/src/embed/search.js.map +1 -1
- package/cjs/src/embed/search.spec.js.map +1 -1
- package/cjs/src/embed/ts-embed.d.ts +31 -1
- package/cjs/src/embed/ts-embed.d.ts.map +1 -1
- package/cjs/src/embed/ts-embed.js +37 -6
- package/cjs/src/embed/ts-embed.js.map +1 -1
- package/cjs/src/embed/ts-embed.spec.js +9 -18
- package/cjs/src/embed/ts-embed.spec.js.map +1 -1
- package/cjs/src/index.d.ts +1 -0
- package/cjs/src/index.d.ts.map +1 -1
- package/cjs/src/index.js +1 -0
- package/cjs/src/index.js.map +1 -1
- package/cjs/src/mixpanel-service.d.ts +1 -0
- package/cjs/src/mixpanel-service.d.ts.map +1 -1
- package/cjs/src/mixpanel-service.js +1 -0
- package/cjs/src/mixpanel-service.js.map +1 -1
- package/cjs/src/react/index.d.ts +12 -1
- package/cjs/src/react/index.d.ts.map +1 -1
- package/cjs/src/react/index.js +11 -1
- package/cjs/src/react/index.js.map +1 -1
- package/cjs/src/react/index.spec.js +2 -14
- package/cjs/src/react/index.spec.js.map +1 -1
- package/cjs/src/test/test-utils.d.ts +2 -0
- package/cjs/src/test/test-utils.d.ts.map +1 -1
- package/cjs/src/test/test-utils.js +2 -0
- package/cjs/src/test/test-utils.js.map +1 -1
- package/cjs/src/tokenizedFetch.d.ts +1 -0
- package/cjs/src/tokenizedFetch.d.ts.map +1 -1
- package/cjs/src/tokenizedFetch.js +1 -0
- package/cjs/src/tokenizedFetch.js.map +1 -1
- package/cjs/src/types.d.ts +372 -59
- package/cjs/src/types.d.ts.map +1 -1
- package/cjs/src/types.js +297 -51
- package/cjs/src/types.js.map +1 -1
- package/cjs/src/utils/authService/authService.d.ts +1 -0
- package/cjs/src/utils/authService/authService.d.ts.map +1 -1
- package/cjs/src/utils/authService/authService.js +1 -0
- package/cjs/src/utils/authService/authService.js.map +1 -1
- package/cjs/src/utils/graphql/answerService/answerService.d.ts +12 -0
- package/cjs/src/utils/graphql/answerService/answerService.d.ts.map +1 -1
- package/cjs/src/utils/graphql/answerService/answerService.js +12 -0
- package/cjs/src/utils/graphql/answerService/answerService.js.map +1 -1
- package/cjs/src/utils/processTrigger.d.ts +1 -0
- package/cjs/src/utils/processTrigger.d.ts.map +1 -1
- package/cjs/src/utils/processTrigger.js +2 -0
- package/cjs/src/utils/processTrigger.js.map +1 -1
- package/cjs/src/utils.d.ts +9 -0
- package/cjs/src/utils.d.ts.map +1 -1
- package/cjs/src/utils.js +11 -0
- package/cjs/src/utils.js.map +1 -1
- package/dist/src/auth.d.ts +15 -0
- package/dist/src/auth.d.ts.map +1 -1
- package/dist/src/authToken.d.ts +2 -1
- package/dist/src/authToken.d.ts.map +1 -1
- package/dist/src/config.d.ts +1 -0
- package/dist/src/config.d.ts.map +1 -1
- package/dist/src/embed/app.d.ts +50 -4
- package/dist/src/embed/app.d.ts.map +1 -1
- package/dist/src/embed/base.d.ts +7 -1
- package/dist/src/embed/base.d.ts.map +1 -1
- package/dist/src/embed/embedConfig.d.ts +2 -0
- package/dist/src/embed/embedConfig.d.ts.map +1 -1
- package/dist/src/embed/liveboard.d.ts +30 -0
- package/dist/src/embed/liveboard.d.ts.map +1 -1
- package/dist/src/embed/sage.d.ts +18 -2
- package/dist/src/embed/sage.d.ts.map +1 -1
- package/dist/src/embed/search-bar.d.ts +11 -0
- package/dist/src/embed/search-bar.d.ts.map +1 -1
- package/dist/src/embed/search.d.ts +34 -5
- package/dist/src/embed/search.d.ts.map +1 -1
- package/dist/src/embed/ts-embed.d.ts +31 -1
- package/dist/src/embed/ts-embed.d.ts.map +1 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/mixpanel-service.d.ts +1 -0
- package/dist/src/mixpanel-service.d.ts.map +1 -1
- package/dist/src/react/index.d.ts +12 -1
- package/dist/src/react/index.d.ts.map +1 -1
- package/dist/src/test/test-utils.d.ts +2 -0
- package/dist/src/test/test-utils.d.ts.map +1 -1
- package/dist/src/tokenizedFetch.d.ts +1 -0
- package/dist/src/tokenizedFetch.d.ts.map +1 -1
- package/dist/src/types.d.ts +372 -59
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/utils/authService/authService.d.ts +1 -0
- package/dist/src/utils/authService/authService.d.ts.map +1 -1
- package/dist/src/utils/graphql/answerService/answerService.d.ts +12 -0
- package/dist/src/utils/graphql/answerService/answerService.d.ts.map +1 -1
- package/dist/src/utils/processTrigger.d.ts +1 -0
- package/dist/src/utils/processTrigger.d.ts.map +1 -1
- package/dist/src/utils.d.ts +9 -0
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/tsembed-react.es.js +7426 -7073
- package/dist/tsembed-react.js +7441 -7092
- package/dist/tsembed.es.js +8781 -8431
- package/dist/tsembed.js +12901 -12559
- package/dist/visual-embed-sdk-react-full.d.ts +584 -70
- package/dist/visual-embed-sdk-react.d.ts +584 -70
- package/dist/visual-embed-sdk.d.ts +572 -69
- package/lib/package.json +1 -1
- package/lib/src/auth.d.ts +15 -0
- package/lib/src/auth.d.ts.map +1 -1
- package/lib/src/auth.js +14 -3
- package/lib/src/auth.js.map +1 -1
- package/lib/src/authToken.d.ts +2 -1
- package/lib/src/authToken.d.ts.map +1 -1
- package/lib/src/authToken.js +2 -1
- package/lib/src/authToken.js.map +1 -1
- package/lib/src/config.d.ts +1 -0
- package/lib/src/config.d.ts.map +1 -1
- package/lib/src/config.js +2 -0
- package/lib/src/config.js.map +1 -1
- package/lib/src/embed/app.d.ts +50 -4
- package/lib/src/embed/app.d.ts.map +1 -1
- package/lib/src/embed/app.js +10 -2
- package/lib/src/embed/app.js.map +1 -1
- package/lib/src/embed/base.d.ts +7 -1
- package/lib/src/embed/base.d.ts.map +1 -1
- package/lib/src/embed/base.js +12 -5
- package/lib/src/embed/base.js.map +1 -1
- package/lib/src/embed/base.spec.js +2 -2
- package/lib/src/embed/base.spec.js.map +1 -1
- package/lib/src/embed/embedConfig.d.ts +2 -0
- package/lib/src/embed/embedConfig.d.ts.map +1 -1
- package/lib/src/embed/embedConfig.js +2 -0
- package/lib/src/embed/embedConfig.js.map +1 -1
- package/lib/src/embed/liveboard.d.ts +30 -0
- package/lib/src/embed/liveboard.d.ts.map +1 -1
- package/lib/src/embed/liveboard.js +6 -1
- package/lib/src/embed/liveboard.js.map +1 -1
- package/lib/src/embed/sage.d.ts +18 -2
- package/lib/src/embed/sage.d.ts.map +1 -1
- package/lib/src/embed/sage.js +5 -0
- package/lib/src/embed/sage.js.map +1 -1
- package/lib/src/embed/search-bar.d.ts +11 -0
- package/lib/src/embed/search-bar.d.ts.map +1 -1
- package/lib/src/embed/search-bar.js +2 -0
- package/lib/src/embed/search-bar.js.map +1 -1
- package/lib/src/embed/search.d.ts +34 -5
- package/lib/src/embed/search.d.ts.map +1 -1
- package/lib/src/embed/search.js +8 -5
- package/lib/src/embed/search.js.map +1 -1
- package/lib/src/embed/search.spec.js.map +1 -1
- package/lib/src/embed/ts-embed.d.ts +31 -1
- package/lib/src/embed/ts-embed.d.ts.map +1 -1
- package/lib/src/embed/ts-embed.js +40 -9
- package/lib/src/embed/ts-embed.js.map +1 -1
- package/lib/src/embed/ts-embed.spec.js +9 -18
- package/lib/src/embed/ts-embed.spec.js.map +1 -1
- package/lib/src/index.d.ts +1 -0
- package/lib/src/index.d.ts.map +1 -1
- package/lib/src/index.js +1 -0
- package/lib/src/index.js.map +1 -1
- package/lib/src/mixpanel-service.d.ts +1 -0
- package/lib/src/mixpanel-service.d.ts.map +1 -1
- package/lib/src/mixpanel-service.js +1 -0
- package/lib/src/mixpanel-service.js.map +1 -1
- package/lib/src/react/index.d.ts +12 -1
- package/lib/src/react/index.d.ts.map +1 -1
- package/lib/src/react/index.js +11 -1
- package/lib/src/react/index.js.map +1 -1
- package/lib/src/react/index.spec.js +3 -15
- package/lib/src/react/index.spec.js.map +1 -1
- package/lib/src/test/test-utils.d.ts +2 -0
- package/lib/src/test/test-utils.d.ts.map +1 -1
- package/lib/src/test/test-utils.js +2 -0
- package/lib/src/test/test-utils.js.map +1 -1
- package/lib/src/tokenizedFetch.d.ts +1 -0
- package/lib/src/tokenizedFetch.d.ts.map +1 -1
- package/lib/src/tokenizedFetch.js +1 -0
- package/lib/src/tokenizedFetch.js.map +1 -1
- package/lib/src/types.d.ts +372 -59
- package/lib/src/types.d.ts.map +1 -1
- package/lib/src/types.js +297 -51
- package/lib/src/types.js.map +1 -1
- package/lib/src/utils/authService/authService.d.ts +1 -0
- package/lib/src/utils/authService/authService.d.ts.map +1 -1
- package/lib/src/utils/authService/authService.js +1 -0
- package/lib/src/utils/authService/authService.js.map +1 -1
- package/lib/src/utils/authService/authService.spec.js +1 -1
- package/lib/src/utils/authService/authService.spec.js.map +1 -1
- package/lib/src/utils/graphql/answerService/answerService.d.ts +12 -0
- package/lib/src/utils/graphql/answerService/answerService.d.ts.map +1 -1
- package/lib/src/utils/graphql/answerService/answerService.js +12 -0
- package/lib/src/utils/graphql/answerService/answerService.js.map +1 -1
- package/lib/src/utils/processTrigger.d.ts +1 -0
- package/lib/src/utils/processTrigger.d.ts.map +1 -1
- package/lib/src/utils/processTrigger.js +2 -0
- package/lib/src/utils/processTrigger.js.map +1 -1
- package/lib/src/utils.d.ts +9 -0
- package/lib/src/utils.d.ts.map +1 -1
- package/lib/src/utils.js +11 -0
- package/lib/src/utils.js.map +1 -1
- package/lib/src/visual-embed-sdk.d.ts +576 -73
- package/package.json +1 -1
- package/src/auth.ts +23 -6
- package/src/authToken.ts +2 -1
- package/src/config.ts +2 -0
- package/src/embed/app.ts +63 -16
- package/src/embed/base.spec.ts +3 -3
- package/src/embed/base.ts +21 -15
- package/src/embed/embedConfig.ts +2 -0
- package/src/embed/liveboard.ts +38 -1
- package/src/embed/sage.ts +18 -2
- package/src/embed/search-bar.tsx +11 -0
- package/src/embed/search.spec.ts +1 -2
- package/src/embed/search.ts +48 -21
- package/src/embed/ts-embed.spec.ts +24 -37
- package/src/embed/ts-embed.ts +72 -38
- package/src/index.ts +1 -0
- package/src/mixpanel-service.ts +1 -0
- package/src/react/index.spec.tsx +59 -47
- package/src/react/index.tsx +12 -1
- package/src/test/test-utils.ts +2 -0
- package/src/tokenizedFetch.ts +1 -0
- package/src/types.ts +377 -65
- package/src/utils/authService/authService.spec.ts +4 -4
- package/src/utils/authService/authService.ts +1 -0
- package/src/utils/graphql/answerService/answerService.ts +12 -0
- package/src/utils/processTrigger.ts +2 -0
- package/src/utils.ts +11 -0
package/package.json
CHANGED
package/src/auth.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import EventEmitter from 'eventemitter3';
|
|
2
|
-
import { getAuthenticationToken, resetCachedAuthToken } from './authToken';
|
|
3
2
|
import { initMixpanel } from './mixpanel-service';
|
|
4
3
|
import {
|
|
5
|
-
AuthType, DOMSelector, EmbedConfig, EmbedEvent,
|
|
4
|
+
AuthType, DOMSelector, EmbedConfig, EmbedEvent, Param,
|
|
6
5
|
} from './types';
|
|
7
6
|
import { getDOMNode, getRedirectUrl } from './utils';
|
|
8
7
|
import {
|
|
9
|
-
|
|
10
|
-
fetchAuthPostService,
|
|
8
|
+
fetchSessionInfoService,
|
|
11
9
|
fetchAuthService,
|
|
12
10
|
fetchBasicAuthService,
|
|
13
11
|
fetchLogoutService,
|
|
14
|
-
|
|
12
|
+
fetchAuthPostService,
|
|
13
|
+
EndPoints,
|
|
15
14
|
} from './utils/authService';
|
|
15
|
+
import { getAuthenticationToken, resetCachedAuthToken } from './authToken';
|
|
16
16
|
import { logger } from './utils/logger';
|
|
17
17
|
import { getEmbedConfig } from './embed/embedConfig';
|
|
18
18
|
|
|
@@ -41,6 +41,7 @@ interface sessionInfoInterface {
|
|
|
41
41
|
/**
|
|
42
42
|
* Enum for auth failure types. This is the parameter passed to the listner
|
|
43
43
|
* of {@link AuthStatus.FAILURE}.
|
|
44
|
+
*
|
|
44
45
|
* @group Authentication / Init
|
|
45
46
|
*/
|
|
46
47
|
export enum AuthFailureType {
|
|
@@ -52,6 +53,7 @@ export enum AuthFailureType {
|
|
|
52
53
|
|
|
53
54
|
/**
|
|
54
55
|
* Enum for auth status emitted by the emitter returned from {@link init}.
|
|
56
|
+
*
|
|
55
57
|
* @group Authentication / Init
|
|
56
58
|
*/
|
|
57
59
|
export enum AuthStatus {
|
|
@@ -75,6 +77,7 @@ export enum AuthStatus {
|
|
|
75
77
|
* Emitted when inPopup is true in the SAMLRedirect flow and the
|
|
76
78
|
* popup is waiting to be triggered either programmatically
|
|
77
79
|
* or by the trigger button.
|
|
80
|
+
*
|
|
78
81
|
* @version SDK: 1.19.0
|
|
79
82
|
*/
|
|
80
83
|
WAITING_FOR_POPUP = 'WAITING_FOR_POPUP',
|
|
@@ -82,17 +85,20 @@ export enum AuthStatus {
|
|
|
82
85
|
|
|
83
86
|
/**
|
|
84
87
|
* Event emitter returned from {@link init}.
|
|
88
|
+
*
|
|
85
89
|
* @group Authentication / Init
|
|
86
90
|
*/
|
|
87
91
|
export interface AuthEventEmitter {
|
|
88
92
|
/**
|
|
89
93
|
* Register a listener on Auth failure.
|
|
94
|
+
*
|
|
90
95
|
* @param event
|
|
91
96
|
* @param listener
|
|
92
97
|
*/
|
|
93
98
|
on(event: AuthStatus.FAILURE, listener: (failureType: AuthFailureType) => void): this;
|
|
94
99
|
/**
|
|
95
100
|
* Register a listener on Auth SDK success.
|
|
101
|
+
*
|
|
96
102
|
* @param event
|
|
97
103
|
* @param listener
|
|
98
104
|
*/
|
|
@@ -109,11 +115,13 @@ export interface AuthEventEmitter {
|
|
|
109
115
|
once(event: AuthStatus.SUCCESS, listener: (sessionInfo: any) => void): this;
|
|
110
116
|
/**
|
|
111
117
|
* Trigger an event on the emitter returned from init.
|
|
118
|
+
*
|
|
112
119
|
* @param {@link AuthEvent}
|
|
113
120
|
*/
|
|
114
121
|
emit(event: AuthEvent, ...args: any[]): boolean;
|
|
115
122
|
/**
|
|
116
123
|
* Remove listener from the emitter returned from init.
|
|
124
|
+
*
|
|
117
125
|
* @param event
|
|
118
126
|
* @param listener
|
|
119
127
|
* @param context
|
|
@@ -122,6 +130,7 @@ export interface AuthEventEmitter {
|
|
|
122
130
|
off(event: AuthStatus, listener: (...args: any[]) => void, context: any, once: boolean): this;
|
|
123
131
|
/**
|
|
124
132
|
* Remove all the event listeners
|
|
133
|
+
*
|
|
125
134
|
* @param event
|
|
126
135
|
*/
|
|
127
136
|
removeAllListeners(event: AuthStatus): this;
|
|
@@ -129,6 +138,7 @@ export interface AuthEventEmitter {
|
|
|
129
138
|
|
|
130
139
|
/**
|
|
131
140
|
* Events which can be triggered on the emitter returned from {@link init}.
|
|
141
|
+
*
|
|
132
142
|
* @group Authentication / Init
|
|
133
143
|
*/
|
|
134
144
|
export enum AuthEvent {
|
|
@@ -231,6 +241,7 @@ export const getSessionDetails = (sessionInfoResp: any): sessionInfoInterface =>
|
|
|
231
241
|
|
|
232
242
|
/**
|
|
233
243
|
* Check if we are logged into the ThoughtSpot cluster
|
|
244
|
+
*
|
|
234
245
|
* @param thoughtSpotHost The ThoughtSpot cluster hostname or IP
|
|
235
246
|
*/
|
|
236
247
|
async function isLoggedIn(thoughtSpotHost: string): Promise<boolean> {
|
|
@@ -259,6 +270,7 @@ export function getReleaseVersion() {
|
|
|
259
270
|
/**
|
|
260
271
|
* Return a promise that resolves with the session information when
|
|
261
272
|
* authentication is successful. And info is available.
|
|
273
|
+
*
|
|
262
274
|
* @group Global methods
|
|
263
275
|
*/
|
|
264
276
|
export function getSessionInfo(): Promise<sessionInfoInterface> {
|
|
@@ -286,6 +298,7 @@ function removeSSORedirectUrlMarker(): void {
|
|
|
286
298
|
|
|
287
299
|
/**
|
|
288
300
|
* Perform token based authentication
|
|
301
|
+
*
|
|
289
302
|
* @param embedConfig The embed configuration
|
|
290
303
|
*/
|
|
291
304
|
export const doTokenAuth = async (embedConfig: EmbedConfig): Promise<boolean> => {
|
|
@@ -317,6 +330,7 @@ export const doTokenAuth = async (embedConfig: EmbedConfig): Promise<boolean> =>
|
|
|
317
330
|
|
|
318
331
|
/**
|
|
319
332
|
* Validate embedConfig parameters required for cookielessTokenAuth
|
|
333
|
+
*
|
|
320
334
|
* @param embedConfig The embed configuration
|
|
321
335
|
*/
|
|
322
336
|
export const doCookielessTokenAuth = async (embedConfig: EmbedConfig): Promise<boolean> => {
|
|
@@ -343,6 +357,7 @@ export const doCookielessTokenAuth = async (embedConfig: EmbedConfig): Promise<b
|
|
|
343
357
|
*
|
|
344
358
|
* Warning: This feature is primarily intended for developer testing. It is
|
|
345
359
|
* strongly advised not to use this authentication method in production.
|
|
360
|
+
*
|
|
346
361
|
* @param embedConfig The embed configuration
|
|
347
362
|
*/
|
|
348
363
|
export const doBasicAuth = async (embedConfig: EmbedConfig): Promise<boolean> => {
|
|
@@ -402,6 +417,7 @@ async function samlPopupFlow(ssoURL: string, triggerContainer: DOMSelector, trig
|
|
|
402
417
|
|
|
403
418
|
/**
|
|
404
419
|
* Perform SAML authentication
|
|
420
|
+
*
|
|
405
421
|
* @param embedConfig The embed configuration
|
|
406
422
|
* @param ssoEndPoint
|
|
407
423
|
*/
|
|
@@ -476,7 +492,7 @@ export const logout = async (embedConfig: EmbedConfig): Promise<boolean> => {
|
|
|
476
492
|
const { thoughtSpotHost } = embedConfig;
|
|
477
493
|
await fetchLogoutService(thoughtSpotHost);
|
|
478
494
|
resetCachedAuthToken();
|
|
479
|
-
const thoughtspotIframes = document.querySelectorAll(
|
|
495
|
+
const thoughtspotIframes = document.querySelectorAll('[data-ts-iframe=\'true\']');
|
|
480
496
|
if (thoughtspotIframes?.length) {
|
|
481
497
|
thoughtspotIframes.forEach((el) => {
|
|
482
498
|
el.parentElement.innerHTML = embedConfig.loginFailedMessage;
|
|
@@ -488,6 +504,7 @@ export const logout = async (embedConfig: EmbedConfig): Promise<boolean> => {
|
|
|
488
504
|
|
|
489
505
|
/**
|
|
490
506
|
* Perform authentication on the ThoughtSpot cluster
|
|
507
|
+
*
|
|
491
508
|
* @param embedConfig The embed configuration
|
|
492
509
|
*/
|
|
493
510
|
export const authenticate = async (embedConfig: EmbedConfig): Promise<boolean> => {
|
package/src/authToken.ts
CHANGED
|
@@ -70,11 +70,12 @@ const validateAuthToken = async (
|
|
|
70
70
|
|
|
71
71
|
/**
|
|
72
72
|
* Resets the auth token and a new token will be fetched on the next request.
|
|
73
|
+
*
|
|
73
74
|
* @example
|
|
74
75
|
* ```js
|
|
75
76
|
* resetCachedAuthToken();
|
|
76
77
|
* ```
|
|
77
|
-
* @version SDK: 1.28.
|
|
78
|
+
* @version SDK: 1.28.0 | ThoughtSpot: *
|
|
78
79
|
* @group Authentication / Init
|
|
79
80
|
*/
|
|
80
81
|
export const resetCachedAuthToken = (): void => {
|
package/src/config.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { EmbedConfig } from './types';
|
|
|
5
5
|
* Copyright (c) 2023
|
|
6
6
|
*
|
|
7
7
|
* Utilities related to reading configuration objects
|
|
8
|
+
*
|
|
8
9
|
* @summary Config-related utils
|
|
9
10
|
* @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
|
|
10
11
|
*/
|
|
@@ -22,6 +23,7 @@ const urlRegex = new RegExp(
|
|
|
22
23
|
/**
|
|
23
24
|
* Parse and construct the ThoughtSpot hostname or IP address
|
|
24
25
|
* from the embed configuration object.
|
|
26
|
+
*
|
|
25
27
|
* @param config
|
|
26
28
|
*/
|
|
27
29
|
export const getThoughtSpotHost = (config: EmbedConfig): string => {
|
package/src/embed/app.ts
CHANGED
|
@@ -3,16 +3,22 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Full application embedding
|
|
5
5
|
* https://developers.thoughtspot.com/docs/?pageid=full-embed
|
|
6
|
+
*
|
|
6
7
|
* @summary Full app embed
|
|
7
8
|
* @module
|
|
8
9
|
* @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
|
|
9
10
|
*/
|
|
10
11
|
|
|
12
|
+
import { logger } from '../utils/logger';
|
|
13
|
+
import { getQueryParamString } from '../utils';
|
|
11
14
|
import {
|
|
12
|
-
|
|
15
|
+
Param,
|
|
16
|
+
DOMSelector,
|
|
17
|
+
HostEvent,
|
|
18
|
+
ViewConfig,
|
|
19
|
+
EmbedEvent,
|
|
20
|
+
MessagePayload,
|
|
13
21
|
} from '../types';
|
|
14
|
-
import { getQueryParamString } from '../utils';
|
|
15
|
-
import { logger } from '../utils/logger';
|
|
16
22
|
import { V1Embed } from './ts-embed';
|
|
17
23
|
|
|
18
24
|
/**
|
|
@@ -71,6 +77,7 @@ export enum DataPanelCustomColumnGroupsAccordionState {
|
|
|
71
77
|
|
|
72
78
|
/**
|
|
73
79
|
* The view configuration for full app embedding.
|
|
80
|
+
*
|
|
74
81
|
* @group Embed components
|
|
75
82
|
*/
|
|
76
83
|
export interface AppViewConfig extends Omit<ViewConfig, 'visibleTabs'> {
|
|
@@ -78,8 +85,10 @@ export interface AppViewConfig extends Omit<ViewConfig, 'visibleTabs'> {
|
|
|
78
85
|
* If true, the top navigation bar within the ThoughtSpot app
|
|
79
86
|
* is displayed. By default, the navigation bar is hidden.
|
|
80
87
|
* This flag also controls the homepage left navigation bar.
|
|
88
|
+
*
|
|
81
89
|
* @default true
|
|
82
90
|
* @version SDK: 1.2.0 | Thoughtspot: 8.4.0.cl
|
|
91
|
+
*
|
|
83
92
|
* @example
|
|
84
93
|
* ```js
|
|
85
94
|
* const embed = new AppEmbed('#tsEmbed', {
|
|
@@ -95,12 +104,13 @@ export interface AppViewConfig extends Omit<ViewConfig, 'visibleTabs'> {
|
|
|
95
104
|
* nav-bars are visible, this flag will only hide the homepage left nav-bar.
|
|
96
105
|
* The showPrimaryNavbar flag takes precedence over the hideHomepageLeftNav.
|
|
97
106
|
*
|
|
98
|
-
*
|
|
99
107
|
* **Note**: This option does not apply to the classic homepage.
|
|
100
108
|
* To access the updated modular homepage, set
|
|
101
109
|
* `modularHomeExperience` to `true` (available as Early Access feature in 9.12.5.cl).
|
|
110
|
+
*
|
|
102
111
|
* @default false
|
|
103
112
|
* @version SDK: 1.28.0 | Thoughtspot: 9.12.5.cl
|
|
113
|
+
*
|
|
104
114
|
* @example
|
|
105
115
|
* ```js
|
|
106
116
|
* const embed = new AppEmbed('#tsEmbed', {
|
|
@@ -115,6 +125,7 @@ export interface AppViewConfig extends Omit<ViewConfig, 'visibleTabs'> {
|
|
|
115
125
|
* Global nav-bar. By default, these buttons are visible on the nav-bar.
|
|
116
126
|
* @default false
|
|
117
127
|
* @version SDK: 1.2.0 | Thoughtspot: 8.4.0.cl
|
|
128
|
+
*
|
|
118
129
|
* @example
|
|
119
130
|
* ```js
|
|
120
131
|
* const embed = new AppEmbed('#tsEmbed', {
|
|
@@ -128,12 +139,13 @@ export interface AppViewConfig extends Omit<ViewConfig, 'visibleTabs'> {
|
|
|
128
139
|
* Control the visibility of the application switcher button on the nav-bar.
|
|
129
140
|
* By default, the application switcher is shown.
|
|
130
141
|
*
|
|
131
|
-
*
|
|
132
142
|
* **Note**: This option does not apply to the classic homepage.
|
|
133
143
|
* To access the updated modular homepage, set
|
|
134
144
|
* `modularHomeExperience` to `true` (available as Early Access feature in 9.12.5.cl).
|
|
145
|
+
*
|
|
135
146
|
* @version SDK: 1.28.0 | Thoughtspot: 9.12.5.cl
|
|
136
147
|
* @default false
|
|
148
|
+
*
|
|
137
149
|
* @example
|
|
138
150
|
* ```js
|
|
139
151
|
* const embed = new AppEmbed('#tsEmbed', {
|
|
@@ -147,12 +159,13 @@ export interface AppViewConfig extends Omit<ViewConfig, 'visibleTabs'> {
|
|
|
147
159
|
* Control the visibility of the Org switcher button on the nav-bar.
|
|
148
160
|
* By default, the Org switcher button is shown.
|
|
149
161
|
*
|
|
150
|
-
*
|
|
151
162
|
* **Note**: This option does not apply to the classic homepage.
|
|
152
163
|
* To access the updated modular homepage, set
|
|
153
164
|
* `modularHomeExperience` to `true` (available as Early Access feature in 9.12.5.cl).
|
|
165
|
+
*
|
|
154
166
|
* @version SDK: 1.28.0 | Thoughtspot: 9.12.5.cl
|
|
155
167
|
* @default true
|
|
168
|
+
*
|
|
156
169
|
* @example
|
|
157
170
|
* ```js
|
|
158
171
|
* const embed = new AppEmbed('#tsEmbed', {
|
|
@@ -170,7 +183,9 @@ export interface AppViewConfig extends Omit<ViewConfig, 'visibleTabs'> {
|
|
|
170
183
|
*
|
|
171
184
|
* For eg, if you want the component to open to a specific Liveboard
|
|
172
185
|
* you could set the path to `pinboard/<liveboardId>/tab/<tabId>`.
|
|
186
|
+
*
|
|
173
187
|
* @version SDK: 1.1.0 | Thoughtspot: 9.4.0.cl
|
|
188
|
+
*
|
|
174
189
|
* @example
|
|
175
190
|
* ```js
|
|
176
191
|
* const embed = new AppEmbed('#tsEmbed', {
|
|
@@ -186,7 +201,9 @@ export interface AppViewConfig extends Omit<ViewConfig, 'visibleTabs'> {
|
|
|
186
201
|
*
|
|
187
202
|
* Use this to open to particular page in the app. To open to a specific
|
|
188
203
|
* path within the app, use the `path` attribute which is more flexible.
|
|
204
|
+
*
|
|
189
205
|
* @version SDK: 1.1.0 | Thoughtspot: 9.4.0.cl
|
|
206
|
+
*
|
|
190
207
|
* @example
|
|
191
208
|
* ```js
|
|
192
209
|
* const embed = new AppEmbed('#tsEmbed', {
|
|
@@ -200,6 +217,7 @@ export interface AppViewConfig extends Omit<ViewConfig, 'visibleTabs'> {
|
|
|
200
217
|
* This puts a filter tag on the application. All metadata lists in the
|
|
201
218
|
* application, such as Liveboards and answers, would be filtered by this
|
|
202
219
|
* tag.
|
|
220
|
+
*
|
|
203
221
|
* @version SDK: 1.1.0 | Thoughtspot: 9.4.0.cl
|
|
204
222
|
* @example
|
|
205
223
|
* ```js
|
|
@@ -212,7 +230,9 @@ export interface AppViewConfig extends Omit<ViewConfig, 'visibleTabs'> {
|
|
|
212
230
|
tag?: string;
|
|
213
231
|
/**
|
|
214
232
|
* The array of GUIDs to be hidden
|
|
233
|
+
*
|
|
215
234
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
|
|
235
|
+
*
|
|
216
236
|
* @example
|
|
217
237
|
* ```js
|
|
218
238
|
* const embed = new AppEmbed('#tsEmbed', {
|
|
@@ -228,6 +248,7 @@ export interface AppViewConfig extends Omit<ViewConfig, 'visibleTabs'> {
|
|
|
228
248
|
/**
|
|
229
249
|
* Render liveboards using the new v2 rendering mode
|
|
230
250
|
* This is a transient flag which is primarily meant for internal use
|
|
251
|
+
*
|
|
231
252
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
|
|
232
253
|
* @hidden
|
|
233
254
|
*/
|
|
@@ -235,7 +256,9 @@ export interface AppViewConfig extends Omit<ViewConfig, 'visibleTabs'> {
|
|
|
235
256
|
/**
|
|
236
257
|
* If set to true, the Search Assist feature is enabled.
|
|
237
258
|
* @default true
|
|
259
|
+
*
|
|
238
260
|
* @version SDK: 1.13.0 | ThoughtSpot: 8.5.0.cl, 8.8.1-sw
|
|
261
|
+
*
|
|
239
262
|
* @example
|
|
240
263
|
* ```js
|
|
241
264
|
* const embed = new AppEmbed('#tsEmbed', {
|
|
@@ -248,7 +271,9 @@ export interface AppViewConfig extends Omit<ViewConfig, 'visibleTabs'> {
|
|
|
248
271
|
/**
|
|
249
272
|
* If set to true, the embedded object container dynamically resizes
|
|
250
273
|
* according to the height of the pages which support fullHeight mode.
|
|
274
|
+
*
|
|
251
275
|
* @version SDK: 1.21.0 | ThoughtSpot: 9.4.0.cl, 9.4.0-sw
|
|
276
|
+
*
|
|
252
277
|
* @example
|
|
253
278
|
* ```js
|
|
254
279
|
* const embed = new AppEmbed('#tsEmbed', {
|
|
@@ -260,6 +285,7 @@ export interface AppViewConfig extends Omit<ViewConfig, 'visibleTabs'> {
|
|
|
260
285
|
fullHeight?: boolean;
|
|
261
286
|
/**
|
|
262
287
|
* Flag to control Data panel experience
|
|
288
|
+
*
|
|
263
289
|
* @default false
|
|
264
290
|
* @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl
|
|
265
291
|
* @hidden
|
|
@@ -267,8 +293,10 @@ export interface AppViewConfig extends Omit<ViewConfig, 'visibleTabs'> {
|
|
|
267
293
|
dataPanelV2?: boolean;
|
|
268
294
|
/**
|
|
269
295
|
* Show or hide Liveboard header
|
|
296
|
+
*
|
|
270
297
|
* @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl
|
|
271
298
|
* @default false
|
|
299
|
+
*
|
|
272
300
|
* @example
|
|
273
301
|
* ```js
|
|
274
302
|
* const embed = new AppEmbed('#tsEmbed', {
|
|
@@ -280,8 +308,10 @@ export interface AppViewConfig extends Omit<ViewConfig, 'visibleTabs'> {
|
|
|
280
308
|
hideLiveboardHeader?: boolean;
|
|
281
309
|
/**
|
|
282
310
|
* Show or hide Liveboard title
|
|
311
|
+
*
|
|
283
312
|
* @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl
|
|
284
313
|
* @default false
|
|
314
|
+
*
|
|
285
315
|
* @example
|
|
286
316
|
* ```js
|
|
287
317
|
* const embed = new AppEmbed('#tsEmbed', {
|
|
@@ -293,8 +323,10 @@ export interface AppViewConfig extends Omit<ViewConfig, 'visibleTabs'> {
|
|
|
293
323
|
showLiveboardTitle?: boolean;
|
|
294
324
|
/**
|
|
295
325
|
* Show or hide Liveboard description
|
|
326
|
+
*
|
|
296
327
|
* @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl
|
|
297
328
|
* @default false
|
|
329
|
+
*
|
|
298
330
|
* @example
|
|
299
331
|
* ```js
|
|
300
332
|
* const embed = new AppEmbed('#tsEmbed', {
|
|
@@ -306,8 +338,10 @@ export interface AppViewConfig extends Omit<ViewConfig, 'visibleTabs'> {
|
|
|
306
338
|
showLiveboardDescription?: boolean;
|
|
307
339
|
/**
|
|
308
340
|
* Flag to control new Modular Home experience.
|
|
341
|
+
*
|
|
309
342
|
* @default false
|
|
310
343
|
* @version SDK: 1.28.0 | Thoughtspot: 9.12.5.cl
|
|
344
|
+
*
|
|
311
345
|
* @example
|
|
312
346
|
* ```js
|
|
313
347
|
* const embed = new AppEmbed('#tsEmbed', {
|
|
@@ -319,6 +353,7 @@ export interface AppViewConfig extends Omit<ViewConfig, 'visibleTabs'> {
|
|
|
319
353
|
modularHomeExperience?: boolean;
|
|
320
354
|
/**
|
|
321
355
|
* Boolean to control if Liveboard header is sticky or not.
|
|
356
|
+
*
|
|
322
357
|
* @example
|
|
323
358
|
* ```js
|
|
324
359
|
* const embed = new AppEmbed('#embed', {
|
|
@@ -331,20 +366,24 @@ export interface AppViewConfig extends Omit<ViewConfig, 'visibleTabs'> {
|
|
|
331
366
|
isLiveboardHeaderSticky?: boolean;
|
|
332
367
|
/**
|
|
333
368
|
* enable or disable ask sage
|
|
369
|
+
*
|
|
334
370
|
* @version SDK: 1.29.0 | Thoughtspot: 9.12.0.cl
|
|
335
371
|
* @default false
|
|
336
372
|
*/
|
|
337
373
|
enableAskSage?: boolean;
|
|
338
374
|
/**
|
|
339
375
|
* To set the initial state of the search bar in case of saved-answers.
|
|
376
|
+
*
|
|
340
377
|
* @version SDK: 1.32.0 | Thoughtspot: 10.0.0.cl
|
|
341
378
|
* @default false
|
|
342
379
|
*/
|
|
343
380
|
collapseSearchBarInitially?: boolean;
|
|
344
381
|
/**
|
|
345
382
|
* To enable custom column groups in data panel v2.
|
|
383
|
+
*
|
|
346
384
|
* @version SDK: 1.32.0 | Thoughtspot: 10.0.0.cl
|
|
347
385
|
* @default false
|
|
386
|
+
*
|
|
348
387
|
* @example
|
|
349
388
|
* ```js
|
|
350
389
|
* const embed = new AppEmbed('#embed', {
|
|
@@ -361,8 +400,10 @@ export interface AppViewConfig extends Omit<ViewConfig, 'visibleTabs'> {
|
|
|
361
400
|
* - EXPAND_ALL: Expand all the accordion initially in data panel v2.
|
|
362
401
|
* - COLLAPSE_ALL: Collapse all the accordions initially in data panel v2.
|
|
363
402
|
* - EXPAND_FIRST: Expand the first accordion and collapse the rest.
|
|
403
|
+
*
|
|
364
404
|
* @version SDK: 1.32.0 | Thoughtspot: 10.0.0.cl
|
|
365
405
|
* @default DataPanelCustomColumnGroupsAccordionState.EXPAND_ALL
|
|
406
|
+
*
|
|
366
407
|
* @example
|
|
367
408
|
* ```js
|
|
368
409
|
* const embed = new AppEmbed('#embed', {
|
|
@@ -375,9 +416,11 @@ export interface AppViewConfig extends Omit<ViewConfig, 'visibleTabs'> {
|
|
|
375
416
|
dataPanelCustomGroupsAccordionInitialState?: DataPanelCustomColumnGroupsAccordionState;
|
|
376
417
|
/**
|
|
377
418
|
* This flag is used to enable the 2 column layout in liveboard
|
|
419
|
+
*
|
|
378
420
|
* @type {boolean}
|
|
379
421
|
* @default false
|
|
380
422
|
* @version SDK: 1.32.0 | ThoughtSpot:10.1.0.cl
|
|
423
|
+
*
|
|
381
424
|
* @example
|
|
382
425
|
* ```js
|
|
383
426
|
* const embed = new LiveboardEmbed('#embed-container', {
|
|
@@ -389,6 +432,7 @@ export interface AppViewConfig extends Omit<ViewConfig, 'visibleTabs'> {
|
|
|
389
432
|
enable2ColumnLayout?: boolean;
|
|
390
433
|
/**
|
|
391
434
|
* Flag to use OnBeforeSearchExecute embed event
|
|
435
|
+
*
|
|
392
436
|
* @version SDK : 1.29.0 | Thoughtspot : 10.1.0.cl
|
|
393
437
|
*/
|
|
394
438
|
isOnBeforeGetVizDataInterceptEnabled?: boolean;
|
|
@@ -396,6 +440,7 @@ export interface AppViewConfig extends Omit<ViewConfig, 'visibleTabs'> {
|
|
|
396
440
|
|
|
397
441
|
/**
|
|
398
442
|
* Embeds full ThoughtSpot experience in a host application.
|
|
443
|
+
*
|
|
399
444
|
* @group Embed components
|
|
400
445
|
*/
|
|
401
446
|
export class AppEmbed extends V1Embed {
|
|
@@ -443,6 +488,7 @@ export class AppEmbed extends V1Embed {
|
|
|
443
488
|
isOnBeforeGetVizDataInterceptEnabled = false,
|
|
444
489
|
/* eslint-disable-next-line max-len */
|
|
445
490
|
dataPanelCustomGroupsAccordionInitialState = DataPanelCustomColumnGroupsAccordionState.EXPAND_ALL,
|
|
491
|
+
|
|
446
492
|
} = this.viewConfig;
|
|
447
493
|
|
|
448
494
|
let params = {};
|
|
@@ -487,9 +533,7 @@ export class AppEmbed extends V1Embed {
|
|
|
487
533
|
|
|
488
534
|
if (isOnBeforeGetVizDataInterceptEnabled) {
|
|
489
535
|
/* eslint-disable-next-line max-len */
|
|
490
|
-
params[
|
|
491
|
-
Param.IsOnBeforeGetVizDataInterceptEnabled
|
|
492
|
-
] = isOnBeforeGetVizDataInterceptEnabled;
|
|
536
|
+
params[Param.IsOnBeforeGetVizDataInterceptEnabled] = isOnBeforeGetVizDataInterceptEnabled;
|
|
493
537
|
}
|
|
494
538
|
|
|
495
539
|
params[Param.DataPanelV2Enabled] = dataPanelV2;
|
|
@@ -497,16 +541,13 @@ export class AppEmbed extends V1Embed {
|
|
|
497
541
|
params[Param.ModularHomeExperienceEnabled] = modularHomeExperience;
|
|
498
542
|
params[Param.CollapseSearchBarInitially] = collapseSearchBarInitially;
|
|
499
543
|
params[Param.EnableCustomColumnGroups] = enableCustomColumnGroups;
|
|
500
|
-
if (
|
|
501
|
-
|
|
502
|
-
=== DataPanelCustomColumnGroupsAccordionState.COLLAPSE_ALL
|
|
544
|
+
if (dataPanelCustomGroupsAccordionInitialState
|
|
545
|
+
=== DataPanelCustomColumnGroupsAccordionState.COLLAPSE_ALL
|
|
503
546
|
|| dataPanelCustomGroupsAccordionInitialState
|
|
504
|
-
|
|
547
|
+
=== DataPanelCustomColumnGroupsAccordionState.EXPAND_FIRST
|
|
505
548
|
) {
|
|
506
549
|
/* eslint-disable-next-line max-len */
|
|
507
|
-
params[
|
|
508
|
-
Param.DataPanelCustomGroupsAccordionInitialState
|
|
509
|
-
] = dataPanelCustomGroupsAccordionInitialState;
|
|
550
|
+
params[Param.DataPanelCustomGroupsAccordionInitialState] = dataPanelCustomGroupsAccordionInitialState;
|
|
510
551
|
} else {
|
|
511
552
|
/* eslint-disable-next-line max-len */
|
|
512
553
|
params[Param.DataPanelCustomGroupsAccordionInitialState] = DataPanelCustomColumnGroupsAccordionState.EXPAND_ALL;
|
|
@@ -518,6 +559,7 @@ export class AppEmbed extends V1Embed {
|
|
|
518
559
|
|
|
519
560
|
/**
|
|
520
561
|
* Constructs the URL of the ThoughtSpot app page to be rendered.
|
|
562
|
+
*
|
|
521
563
|
* @param pageId The ID of the page to be embedded.
|
|
522
564
|
*/
|
|
523
565
|
public getIFrameSrc(): string {
|
|
@@ -534,6 +576,7 @@ export class AppEmbed extends V1Embed {
|
|
|
534
576
|
/**
|
|
535
577
|
* Set the iframe height as per the computed height received
|
|
536
578
|
* from the ThoughtSpot app.
|
|
579
|
+
*
|
|
537
580
|
* @param data The event payload
|
|
538
581
|
*/
|
|
539
582
|
protected updateIFrameHeight = (data: MessagePayload) => {
|
|
@@ -554,6 +597,7 @@ export class AppEmbed extends V1Embed {
|
|
|
554
597
|
|
|
555
598
|
/**
|
|
556
599
|
* Gets the ThoughtSpot route of the page for a particular page ID.
|
|
600
|
+
*
|
|
557
601
|
* @param pageId The identifier for a page in the ThoughtSpot app.
|
|
558
602
|
* @param modularHomeExperience
|
|
559
603
|
*/
|
|
@@ -579,6 +623,7 @@ export class AppEmbed extends V1Embed {
|
|
|
579
623
|
|
|
580
624
|
/**
|
|
581
625
|
* Formats the path provided by the user.
|
|
626
|
+
*
|
|
582
627
|
* @param path The URL path.
|
|
583
628
|
* @returns The URL path that the embedded app understands.
|
|
584
629
|
*/
|
|
@@ -599,6 +644,7 @@ export class AppEmbed extends V1Embed {
|
|
|
599
644
|
* Navigate to particular page for app embed. eg:answers/pinboards/home
|
|
600
645
|
* This is used for embedding answers, pinboards, visualizations and full application
|
|
601
646
|
* only.
|
|
647
|
+
*
|
|
602
648
|
* @param path string | number The string, set to iframe src and navigate to new page
|
|
603
649
|
* eg: appEmbed.navigateToPage('pinboards')
|
|
604
650
|
* When used with `noReload` (default: true) this can also be a number
|
|
@@ -630,6 +676,7 @@ export class AppEmbed extends V1Embed {
|
|
|
630
676
|
|
|
631
677
|
/**
|
|
632
678
|
* Renders the embedded application pages in the ThoughtSpot app.
|
|
679
|
+
*
|
|
633
680
|
* @param renderOptions An object containing the page ID
|
|
634
681
|
* to be embedded.
|
|
635
682
|
*/
|
package/src/embed/base.spec.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-shadow */
|
|
3
3
|
import EventEmitter from 'eventemitter3';
|
|
4
|
+
import { EmbedConfig } from '../index';
|
|
4
5
|
import * as auth from '../auth';
|
|
6
|
+
import * as authService from '../utils/authService/authService';
|
|
5
7
|
import * as authTokenService from '../authToken';
|
|
6
8
|
import * as index from '../index';
|
|
7
|
-
import { EmbedConfig } from '../index';
|
|
8
|
-
import * as authService from '../utils/authService/authService';
|
|
9
9
|
import * as base from './base';
|
|
10
10
|
import * as embedConfigInstance from './embedConfig';
|
|
11
11
|
|
|
@@ -13,8 +13,8 @@ import {
|
|
|
13
13
|
executeAfterWait,
|
|
14
14
|
getAllIframeEl,
|
|
15
15
|
getDocumentBody,
|
|
16
|
-
getIFrameSrc,
|
|
17
16
|
getRootEl,
|
|
17
|
+
getIFrameSrc,
|
|
18
18
|
} from '../test/test-utils';
|
|
19
19
|
import * as tokenizedFetchInstance from '../tokenizedFetch';
|
|
20
20
|
import { logger } from '../utils/logger';
|
package/src/embed/base.ts
CHANGED
|
@@ -4,33 +4,33 @@
|
|
|
4
4
|
* Copyright (c) 2022
|
|
5
5
|
*
|
|
6
6
|
* Base classes
|
|
7
|
+
*
|
|
7
8
|
* @summary Base classes
|
|
8
9
|
* @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
|
|
9
10
|
*/
|
|
10
11
|
import EventEmitter from 'eventemitter3';
|
|
11
|
-
import
|
|
12
|
+
import { resetCachedAuthToken } from '../authToken';
|
|
13
|
+
import { logger, setGlobalLogLevelOverride } from '../utils/logger';
|
|
14
|
+
import { tokenizedFetch } from '../tokenizedFetch';
|
|
15
|
+
import { EndPoints } from '../utils/authService/authService';
|
|
16
|
+
import { getThoughtSpotHost } from '../config';
|
|
12
17
|
import {
|
|
13
|
-
|
|
14
|
-
|
|
18
|
+
AuthType, EmbedConfig, LogLevel, PrefetchFeatures,
|
|
19
|
+
} from '../types';
|
|
20
|
+
import {
|
|
21
|
+
authenticate,
|
|
22
|
+
logout as _logout,
|
|
15
23
|
AuthFailureType,
|
|
16
24
|
AuthStatus,
|
|
17
|
-
|
|
18
|
-
authenticate,
|
|
25
|
+
AuthEvent,
|
|
19
26
|
notifyAuthFailure,
|
|
20
27
|
notifyAuthSDKSuccess,
|
|
21
28
|
notifyAuthSuccess,
|
|
22
29
|
notifyLogout,
|
|
23
30
|
setAuthEE,
|
|
31
|
+
AuthEventEmitter,
|
|
24
32
|
} from '../auth';
|
|
25
|
-
import {
|
|
26
|
-
import { getThoughtSpotHost } from '../config';
|
|
27
|
-
import { MIXPANEL_EVENT, uploadMixpanelEvent } from '../mixpanel-service';
|
|
28
|
-
import { tokenizedFetch } from '../tokenizedFetch';
|
|
29
|
-
import {
|
|
30
|
-
AuthType, EmbedConfig, LogLevel, PrefetchFeatures,
|
|
31
|
-
} from '../types';
|
|
32
|
-
import { EndPoints } from '../utils/authService/authService';
|
|
33
|
-
import { logger, setGlobalLogLevelOverride } from '../utils/logger';
|
|
33
|
+
import { uploadMixpanelEvent, MIXPANEL_EVENT } from '../mixpanel-service';
|
|
34
34
|
import { getEmbedConfig, setEmbedConfig } from './embedConfig';
|
|
35
35
|
|
|
36
36
|
const CONFIG_DEFAULTS: Partial<EmbedConfig> = {
|
|
@@ -95,6 +95,7 @@ const hostUrlToFeatureUrl = {
|
|
|
95
95
|
* Prefetches static resources from the specified URL. Web browsers can then cache the
|
|
96
96
|
* prefetched resources and serve them from the user's local disk to provide faster access
|
|
97
97
|
* to your app.
|
|
98
|
+
*
|
|
98
99
|
* @param url The URL provided for prefetch
|
|
99
100
|
* @param prefetchFeatures Specify features which needs to be prefetched.
|
|
100
101
|
* @version SDK: 1.4.0 | ThoughtSpot: ts7.sep.cl, 7.2.1
|
|
@@ -159,6 +160,7 @@ function backwardCompat(embedConfig: EmbedConfig): EmbedConfig {
|
|
|
159
160
|
* authentication if applicable. This function needs to be called before any ThoughtSpot
|
|
160
161
|
* component like liveboard etc can be embedded. But need not wait for AuthEvent.SUCCESS
|
|
161
162
|
* to actually embed. That is handled internally.
|
|
163
|
+
*
|
|
162
164
|
* @param embedConfig The configuration object containing ThoughtSpot host,
|
|
163
165
|
* authentication mechanism and so on.
|
|
164
166
|
* @example
|
|
@@ -221,6 +223,7 @@ export function disableAutoLogin(): void {
|
|
|
221
223
|
*
|
|
222
224
|
* You can call the `init` method again to re login, if autoLogin is set to
|
|
223
225
|
* true in this second call it will be honored.
|
|
226
|
+
*
|
|
224
227
|
* @param doNotDisableAutoLogin This flag when passed will not disable autoLogin
|
|
225
228
|
* @returns Promise which resolves when logout completes.
|
|
226
229
|
* @version SDK: 1.10.1 | ThoughtSpot: 8.2.0.cl, 8.4.1-sw
|
|
@@ -241,6 +244,7 @@ let renderQueue: Promise<any> = Promise.resolve();
|
|
|
241
244
|
/**
|
|
242
245
|
* Renders functions in a queue, resolves to next function only after the callback next
|
|
243
246
|
* is called
|
|
247
|
+
*
|
|
244
248
|
* @param fn The function being registered
|
|
245
249
|
*/
|
|
246
250
|
export const renderInQueue = (fn: (next?: (val?: any) => void) => Promise<any>): Promise<any> => {
|
|
@@ -250,11 +254,12 @@ export const renderInQueue = (fn: (next?: (val?: any) => void) => Promise<any>):
|
|
|
250
254
|
return renderQueue;
|
|
251
255
|
}
|
|
252
256
|
// Sending an empty function to keep it consistent with the above usage.
|
|
253
|
-
return fn(() => {}); // eslint-disable-line @typescript-eslint/no-empty-function
|
|
257
|
+
return fn(() => { }); // eslint-disable-line @typescript-eslint/no-empty-function
|
|
254
258
|
};
|
|
255
259
|
|
|
256
260
|
/**
|
|
257
261
|
* Imports TML representation of the metadata objects into ThoughtSpot.
|
|
262
|
+
*
|
|
258
263
|
* @param data
|
|
259
264
|
* @example
|
|
260
265
|
* ```js
|
|
@@ -315,6 +320,7 @@ export const executeTML = async (data: executeTMLInput): Promise<any> => {
|
|
|
315
320
|
/**
|
|
316
321
|
* Exports TML representation of the metadata objects from ThoughtSpot in JSON or YAML
|
|
317
322
|
* format.
|
|
323
|
+
*
|
|
318
324
|
* @param data
|
|
319
325
|
* @example
|
|
320
326
|
* ```js
|