@thoughtspot/visual-embed-sdk 1.28.5-alpha-1 → 1.28.5
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.map +1 -1
- package/cjs/src/auth.js +2 -2
- package/cjs/src/auth.js.map +1 -1
- package/cjs/src/authToken.d.ts +1 -1
- package/cjs/src/authToken.js +1 -1
- package/cjs/src/authToken.spec.d.ts +2 -0
- package/cjs/src/authToken.spec.d.ts.map +1 -0
- package/cjs/src/authToken.spec.js +29 -0
- package/cjs/src/authToken.spec.js.map +1 -0
- package/cjs/src/embed/app.d.ts +6 -12
- package/cjs/src/embed/app.d.ts.map +1 -1
- package/cjs/src/embed/app.js +2 -2
- package/cjs/src/embed/app.js.map +1 -1
- package/cjs/src/embed/base.d.ts +1 -1
- package/cjs/src/embed/base.d.ts.map +1 -1
- package/cjs/src/embed/base.js +6 -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/liveboard.d.ts +2 -8
- package/cjs/src/embed/liveboard.d.ts.map +1 -1
- package/cjs/src/embed/liveboard.js.map +1 -1
- package/cjs/src/embed/search.d.ts +5 -11
- package/cjs/src/embed/search.d.ts.map +1 -1
- package/cjs/src/embed/search.js +4 -4
- package/cjs/src/embed/search.js.map +1 -1
- package/cjs/src/embed/ts-embed.d.ts +1 -1
- package/cjs/src/embed/ts-embed.d.ts.map +1 -1
- package/cjs/src/embed/ts-embed.js +6 -6
- package/cjs/src/embed/ts-embed.js.map +1 -1
- package/cjs/src/embed/ts-embed.spec.js +18 -9
- package/cjs/src/embed/ts-embed.spec.js.map +1 -1
- package/cjs/src/react/index.spec.js +12 -0
- package/cjs/src/react/index.spec.js.map +1 -1
- package/cjs/src/types.d.ts +84 -57
- package/cjs/src/types.d.ts.map +1 -1
- package/cjs/src/types.js +77 -47
- package/cjs/src/types.js.map +1 -1
- package/dist/src/auth.d.ts.map +1 -1
- package/dist/src/authToken.d.ts +1 -1
- package/dist/src/authToken.spec.d.ts +2 -0
- package/dist/src/authToken.spec.d.ts.map +1 -0
- package/dist/src/embed/app.d.ts +6 -12
- package/dist/src/embed/app.d.ts.map +1 -1
- package/dist/src/embed/base.d.ts +1 -1
- package/dist/src/embed/base.d.ts.map +1 -1
- package/dist/src/embed/liveboard.d.ts +2 -8
- package/dist/src/embed/liveboard.d.ts.map +1 -1
- package/dist/src/embed/search.d.ts +5 -11
- package/dist/src/embed/search.d.ts.map +1 -1
- package/dist/src/embed/ts-embed.d.ts +1 -1
- package/dist/src/embed/ts-embed.d.ts.map +1 -1
- package/dist/src/types.d.ts +84 -57
- package/dist/src/types.d.ts.map +1 -1
- package/dist/tsembed-react.es.js +1507 -1477
- package/dist/tsembed-react.js +2294 -2264
- package/dist/tsembed.es.js +1893 -1863
- package/dist/tsembed.js +15477 -15447
- package/dist/visual-embed-sdk-react-full.d.ts +96 -87
- package/dist/visual-embed-sdk-react.d.ts +96 -87
- package/dist/visual-embed-sdk.d.ts +96 -87
- package/lib/package.json +1 -1
- package/lib/src/auth.d.ts.map +1 -1
- package/lib/src/auth.js +3 -3
- package/lib/src/auth.js.map +1 -1
- package/lib/src/authToken.d.ts +1 -1
- package/lib/src/authToken.js +1 -1
- package/lib/src/authToken.spec.d.ts +2 -0
- package/lib/src/authToken.spec.d.ts.map +1 -0
- package/lib/src/authToken.spec.js +26 -0
- package/lib/src/authToken.spec.js.map +1 -0
- package/lib/src/embed/app.d.ts +6 -12
- package/lib/src/embed/app.d.ts.map +1 -1
- package/lib/src/embed/app.js +2 -2
- package/lib/src/embed/app.js.map +1 -1
- package/lib/src/embed/base.d.ts +1 -1
- package/lib/src/embed/base.d.ts.map +1 -1
- package/lib/src/embed/base.js +5 -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/liveboard.d.ts +2 -8
- package/lib/src/embed/liveboard.d.ts.map +1 -1
- package/lib/src/embed/liveboard.js +1 -1
- package/lib/src/embed/liveboard.js.map +1 -1
- package/lib/src/embed/search.d.ts +5 -11
- package/lib/src/embed/search.d.ts.map +1 -1
- package/lib/src/embed/search.js +5 -5
- package/lib/src/embed/search.js.map +1 -1
- package/lib/src/embed/ts-embed.d.ts +1 -1
- package/lib/src/embed/ts-embed.d.ts.map +1 -1
- package/lib/src/embed/ts-embed.js +9 -9
- package/lib/src/embed/ts-embed.js.map +1 -1
- package/lib/src/embed/ts-embed.spec.js +18 -9
- package/lib/src/embed/ts-embed.spec.js.map +1 -1
- package/lib/src/react/index.spec.js +12 -0
- package/lib/src/react/index.spec.js.map +1 -1
- package/lib/src/types.d.ts +84 -57
- package/lib/src/types.d.ts.map +1 -1
- package/lib/src/types.js +77 -47
- package/lib/src/types.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/visual-embed-sdk.d.ts +100 -91
- package/package.json +1 -1
- package/src/auth.ts +6 -6
- package/src/authToken.spec.ts +31 -0
- package/src/authToken.ts +1 -1
- package/src/embed/app.ts +8 -19
- package/src/embed/base.spec.ts +3 -3
- package/src/embed/base.ts +14 -14
- package/src/embed/liveboard.ts +3 -16
- package/src/embed/search.ts +10 -19
- package/src/embed/ts-embed.spec.ts +34 -26
- package/src/embed/ts-embed.ts +39 -43
- package/src/react/index.spec.tsx +29 -0
- package/src/types.ts +85 -57
- package/src/utils/authService/authService.spec.ts +4 -4
- package/cjs/src/utils/authService/tokenizedAuthService.spec.d.ts +0 -2
- package/cjs/src/utils/authService/tokenizedAuthService.spec.d.ts.map +0 -1
- package/cjs/src/utils/authService/tokenizedAuthService.spec.js +0 -32
- package/cjs/src/utils/authService/tokenizedAuthService.spec.js.map +0 -1
- package/cjs/src/utils/sessionInfoService.d.ts +0 -66
- package/cjs/src/utils/sessionInfoService.d.ts.map +0 -1
- package/cjs/src/utils/sessionInfoService.js +0 -92
- package/cjs/src/utils/sessionInfoService.js.map +0 -1
- package/dist/src/utils/authService/tokenizedAuthService.spec.d.ts +0 -2
- package/dist/src/utils/authService/tokenizedAuthService.spec.d.ts.map +0 -1
- package/dist/src/utils/sessionInfoService.d.ts +0 -66
- package/dist/src/utils/sessionInfoService.d.ts.map +0 -1
- package/lib/src/utils/authService/tokenizedAuthService.spec.d.ts +0 -2
- package/lib/src/utils/authService/tokenizedAuthService.spec.d.ts.map +0 -1
- package/lib/src/utils/authService/tokenizedAuthService.spec.js +0 -29
- package/lib/src/utils/authService/tokenizedAuthService.spec.js.map +0 -1
- package/lib/src/utils/sessionInfoService.d.ts +0 -66
- package/lib/src/utils/sessionInfoService.d.ts.map +0 -1
- package/lib/src/utils/sessionInfoService.js +0 -85
- package/lib/src/utils/sessionInfoService.js.map +0 -1
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';
|
|
2
3
|
import { initMixpanel } from './mixpanel-service';
|
|
3
4
|
import {
|
|
4
|
-
AuthType, DOMSelector, EmbedConfig, EmbedEvent,
|
|
5
|
+
AuthType, DOMSelector, EmbedConfig, EmbedEvent,
|
|
5
6
|
} from './types';
|
|
6
7
|
import { getDOMNode, getRedirectUrl } from './utils';
|
|
7
8
|
import {
|
|
8
|
-
|
|
9
|
+
EndPoints,
|
|
10
|
+
fetchAuthPostService,
|
|
9
11
|
fetchAuthService,
|
|
10
12
|
fetchBasicAuthService,
|
|
11
13
|
fetchLogoutService,
|
|
12
|
-
|
|
13
|
-
EndPoints,
|
|
14
|
+
fetchSessionInfoService,
|
|
14
15
|
} 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
|
|
|
@@ -492,7 +492,7 @@ export const logout = async (embedConfig: EmbedConfig): Promise<boolean> => {
|
|
|
492
492
|
const { thoughtSpotHost } = embedConfig;
|
|
493
493
|
await fetchLogoutService(thoughtSpotHost);
|
|
494
494
|
resetCachedAuthToken();
|
|
495
|
-
const thoughtspotIframes = document.querySelectorAll(
|
|
495
|
+
const thoughtspotIframes = document.querySelectorAll("[data-ts-iframe='true']");
|
|
496
496
|
if (thoughtspotIframes?.length) {
|
|
497
497
|
thoughtspotIframes.forEach((el) => {
|
|
498
498
|
el.parentElement.innerHTML = embedConfig.loginFailedMessage;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { getAuthenticationToken, resetCachedAuthToken } from './authToken';
|
|
2
|
+
import * as authServiceInstance from './utils/authService/authService';
|
|
3
|
+
import { EmbedConfig } from './types';
|
|
4
|
+
|
|
5
|
+
describe('AuthToken Unit tests', () => {
|
|
6
|
+
test('getAuthenticationToken: When verification is disabled', async () => {
|
|
7
|
+
jest.spyOn(authServiceInstance, 'verifyTokenService');
|
|
8
|
+
|
|
9
|
+
const token = await getAuthenticationToken({
|
|
10
|
+
getAuthToken: async () => 'abc3',
|
|
11
|
+
disableTokenVerification: true,
|
|
12
|
+
} as EmbedConfig);
|
|
13
|
+
|
|
14
|
+
expect(token).toBe('abc3');
|
|
15
|
+
expect(authServiceInstance.verifyTokenService).not.toBeCalled();
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
test.only('getAuthenticationToken: When verification is enabled', async () => {
|
|
19
|
+
resetCachedAuthToken();
|
|
20
|
+
jest.clearAllMocks();
|
|
21
|
+
jest.spyOn(authServiceInstance, 'verifyTokenService').mockImplementation(() => true);
|
|
22
|
+
const token = await getAuthenticationToken({
|
|
23
|
+
thoughtSpotHost: 'test',
|
|
24
|
+
getAuthToken: async () => 'abc2',
|
|
25
|
+
disableTokenVerification: false,
|
|
26
|
+
} as EmbedConfig);
|
|
27
|
+
|
|
28
|
+
expect(token).toBe('abc2');
|
|
29
|
+
expect(authServiceInstance.verifyTokenService).toBeCalledWith('test', 'abc2');
|
|
30
|
+
});
|
|
31
|
+
});
|
package/src/authToken.ts
CHANGED
|
@@ -75,7 +75,7 @@ const validateAuthToken = async (
|
|
|
75
75
|
* ```js
|
|
76
76
|
* resetCachedAuthToken();
|
|
77
77
|
* ```
|
|
78
|
-
* @version SDK: 1.28.
|
|
78
|
+
* @version SDK: 1.28.2 | ThoughtSpot: *
|
|
79
79
|
* @group Authentication / Init
|
|
80
80
|
*/
|
|
81
81
|
export const resetCachedAuthToken = (): void => {
|
package/src/embed/app.ts
CHANGED
|
@@ -9,16 +9,11 @@
|
|
|
9
9
|
* @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
import { logger } from '../utils/logger';
|
|
13
|
-
import { getQueryParamString } from '../utils';
|
|
14
12
|
import {
|
|
15
|
-
Param,
|
|
16
|
-
DOMSelector,
|
|
17
|
-
HostEvent,
|
|
18
|
-
ViewConfig,
|
|
19
|
-
EmbedEvent,
|
|
20
|
-
MessagePayload,
|
|
13
|
+
DOMSelector, EmbedEvent, HostEvent, MessagePayload, Param, ViewConfig,
|
|
21
14
|
} from '../types';
|
|
15
|
+
import { getQueryParamString } from '../utils';
|
|
16
|
+
import { logger } from '../utils/logger';
|
|
22
17
|
import { V1Embed } from './ts-embed';
|
|
23
18
|
|
|
24
19
|
/**
|
|
@@ -69,7 +64,6 @@ export interface AppViewConfig extends Omit<ViewConfig, 'visibleTabs'> {
|
|
|
69
64
|
*
|
|
70
65
|
* @default true
|
|
71
66
|
* @version SDK: 1.2.0 | Thoughtspot: 8.4.0.cl
|
|
72
|
-
*
|
|
73
67
|
* @example
|
|
74
68
|
* ```js
|
|
75
69
|
* const embed = new AppEmbed('#tsEmbed', {
|
|
@@ -85,6 +79,7 @@ export interface AppViewConfig extends Omit<ViewConfig, 'visibleTabs'> {
|
|
|
85
79
|
* nav-bars are visible, this flag will only hide the homepage left nav-bar.
|
|
86
80
|
* The showPrimaryNavbar flag takes precedence over the hideHomepageLeftNav.
|
|
87
81
|
*
|
|
82
|
+
*
|
|
88
83
|
* **Note**: This option does not apply to the classic homepage.
|
|
89
84
|
* To access the updated modular homepage, set
|
|
90
85
|
* `modularHomeExperience` to `true` (available as Early Access feature in 9.12.5.cl).
|
|
@@ -104,9 +99,9 @@ export interface AppViewConfig extends Omit<ViewConfig, 'visibleTabs'> {
|
|
|
104
99
|
/**
|
|
105
100
|
* Control the visibility of the help (?) and profile buttons on the
|
|
106
101
|
* Global nav-bar. By default, these buttons are visible on the nav-bar.
|
|
102
|
+
*
|
|
107
103
|
* @default false
|
|
108
104
|
* @version SDK: 1.2.0 | Thoughtspot: 8.4.0.cl
|
|
109
|
-
*
|
|
110
105
|
* @example
|
|
111
106
|
* ```js
|
|
112
107
|
* const embed = new AppEmbed('#tsEmbed', {
|
|
@@ -120,6 +115,7 @@ export interface AppViewConfig extends Omit<ViewConfig, 'visibleTabs'> {
|
|
|
120
115
|
* Control the visibility of the application switcher button on the nav-bar.
|
|
121
116
|
* By default, the application switcher is shown.
|
|
122
117
|
*
|
|
118
|
+
*
|
|
123
119
|
* **Note**: This option does not apply to the classic homepage.
|
|
124
120
|
* To access the updated modular homepage, set
|
|
125
121
|
* `modularHomeExperience` to `true` (available as Early Access feature in 9.12.5.cl).
|
|
@@ -140,6 +136,7 @@ export interface AppViewConfig extends Omit<ViewConfig, 'visibleTabs'> {
|
|
|
140
136
|
* Control the visibility of the Org switcher button on the nav-bar.
|
|
141
137
|
* By default, the Org switcher button is shown.
|
|
142
138
|
*
|
|
139
|
+
*
|
|
143
140
|
* **Note**: This option does not apply to the classic homepage.
|
|
144
141
|
* To access the updated modular homepage, set
|
|
145
142
|
* `modularHomeExperience` to `true` (available as Early Access feature in 9.12.5.cl).
|
|
@@ -166,7 +163,6 @@ export interface AppViewConfig extends Omit<ViewConfig, 'visibleTabs'> {
|
|
|
166
163
|
* you could set the path to `pinboard/<liveboardId>/tab/<tabId>`.
|
|
167
164
|
*
|
|
168
165
|
* @version SDK: 1.1.0 | Thoughtspot: 9.4.0.cl
|
|
169
|
-
*
|
|
170
166
|
* @example
|
|
171
167
|
* ```js
|
|
172
168
|
* const embed = new AppEmbed('#tsEmbed', {
|
|
@@ -184,7 +180,6 @@ export interface AppViewConfig extends Omit<ViewConfig, 'visibleTabs'> {
|
|
|
184
180
|
* path within the app, use the `path` attribute which is more flexible.
|
|
185
181
|
*
|
|
186
182
|
* @version SDK: 1.1.0 | Thoughtspot: 9.4.0.cl
|
|
187
|
-
*
|
|
188
183
|
* @example
|
|
189
184
|
* ```js
|
|
190
185
|
* const embed = new AppEmbed('#tsEmbed', {
|
|
@@ -213,7 +208,6 @@ export interface AppViewConfig extends Omit<ViewConfig, 'visibleTabs'> {
|
|
|
213
208
|
* The array of GUIDs to be hidden
|
|
214
209
|
*
|
|
215
210
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
|
|
216
|
-
*
|
|
217
211
|
* @example
|
|
218
212
|
* ```js
|
|
219
213
|
* const embed = new AppEmbed('#tsEmbed', {
|
|
@@ -236,10 +230,9 @@ export interface AppViewConfig extends Omit<ViewConfig, 'visibleTabs'> {
|
|
|
236
230
|
liveboardV2?: boolean;
|
|
237
231
|
/**
|
|
238
232
|
* If set to true, the Search Assist feature is enabled.
|
|
239
|
-
* @default true
|
|
240
233
|
*
|
|
234
|
+
* @default true
|
|
241
235
|
* @version SDK: 1.13.0 | ThoughtSpot: 8.5.0.cl, 8.8.1-sw
|
|
242
|
-
*
|
|
243
236
|
* @example
|
|
244
237
|
* ```js
|
|
245
238
|
* const embed = new AppEmbed('#tsEmbed', {
|
|
@@ -254,7 +247,6 @@ export interface AppViewConfig extends Omit<ViewConfig, 'visibleTabs'> {
|
|
|
254
247
|
* according to the height of the pages which support fullHeight mode.
|
|
255
248
|
*
|
|
256
249
|
* @version SDK: 1.21.0 | ThoughtSpot: 9.4.0.cl, 9.4.0-sw
|
|
257
|
-
*
|
|
258
250
|
* @example
|
|
259
251
|
* ```js
|
|
260
252
|
* const embed = new AppEmbed('#tsEmbed', {
|
|
@@ -277,7 +269,6 @@ export interface AppViewConfig extends Omit<ViewConfig, 'visibleTabs'> {
|
|
|
277
269
|
*
|
|
278
270
|
* @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl
|
|
279
271
|
* @default false
|
|
280
|
-
*
|
|
281
272
|
* @example
|
|
282
273
|
* ```js
|
|
283
274
|
* const embed = new AppEmbed('#tsEmbed', {
|
|
@@ -292,7 +283,6 @@ export interface AppViewConfig extends Omit<ViewConfig, 'visibleTabs'> {
|
|
|
292
283
|
*
|
|
293
284
|
* @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl
|
|
294
285
|
* @default false
|
|
295
|
-
*
|
|
296
286
|
* @example
|
|
297
287
|
* ```js
|
|
298
288
|
* const embed = new AppEmbed('#tsEmbed', {
|
|
@@ -307,7 +297,6 @@ export interface AppViewConfig extends Omit<ViewConfig, 'visibleTabs'> {
|
|
|
307
297
|
*
|
|
308
298
|
* @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl
|
|
309
299
|
* @default false
|
|
310
|
-
*
|
|
311
300
|
* @example
|
|
312
301
|
* ```js
|
|
313
302
|
* const embed = new AppEmbed('#tsEmbed', {
|
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';
|
|
5
4
|
import * as auth from '../auth';
|
|
6
|
-
import * as authService from '../utils/authService/authService';
|
|
7
5
|
import * as authTokenService from '../authToken';
|
|
8
6
|
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
|
-
getRootEl,
|
|
17
16
|
getIFrameSrc,
|
|
17
|
+
getRootEl,
|
|
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
|
@@ -10,28 +10,28 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import EventEmitter from 'eventemitter3';
|
|
12
12
|
import uniq from 'lodash/uniq';
|
|
13
|
-
import { resetCachedAuthToken } from '../authToken';
|
|
14
|
-
import { logger, setGlobalLogLevelOverride } from '../utils/logger';
|
|
15
|
-
import { tokenizedFetch } from '../tokenizedFetch';
|
|
16
|
-
import { EndPoints } from '../utils/authService/authService';
|
|
17
|
-
import { getThoughtSpotHost } from '../config';
|
|
18
|
-
import {
|
|
19
|
-
AuthType, EmbedConfig, LogLevel, PrefetchFeatures,
|
|
20
|
-
} from '../types';
|
|
21
13
|
import {
|
|
22
|
-
|
|
23
|
-
|
|
14
|
+
AuthEvent,
|
|
15
|
+
AuthEventEmitter,
|
|
24
16
|
AuthFailureType,
|
|
25
17
|
AuthStatus,
|
|
26
|
-
|
|
18
|
+
logout as _logout,
|
|
19
|
+
authenticate,
|
|
27
20
|
notifyAuthFailure,
|
|
28
21
|
notifyAuthSDKSuccess,
|
|
29
22
|
notifyAuthSuccess,
|
|
30
23
|
notifyLogout,
|
|
31
24
|
setAuthEE,
|
|
32
|
-
AuthEventEmitter,
|
|
33
25
|
} from '../auth';
|
|
34
|
-
import {
|
|
26
|
+
import { resetCachedAuthToken } from '../authToken';
|
|
27
|
+
import { getThoughtSpotHost } from '../config';
|
|
28
|
+
import { MIXPANEL_EVENT, uploadMixpanelEvent } from '../mixpanel-service';
|
|
29
|
+
import { tokenizedFetch } from '../tokenizedFetch';
|
|
30
|
+
import {
|
|
31
|
+
AuthType, EmbedConfig, LogLevel, PrefetchFeatures,
|
|
32
|
+
} from '../types';
|
|
33
|
+
import { EndPoints } from '../utils/authService/authService';
|
|
34
|
+
import { logger, setGlobalLogLevelOverride } from '../utils/logger';
|
|
35
35
|
import { getEmbedConfig, setEmbedConfig } from './embedConfig';
|
|
36
36
|
|
|
37
37
|
const CONFIG_DEFAULTS: Partial<EmbedConfig> = {
|
|
@@ -251,7 +251,7 @@ export const renderInQueue = (fn: (next?: (val?: any) => void) => Promise<any>):
|
|
|
251
251
|
return renderQueue;
|
|
252
252
|
}
|
|
253
253
|
// Sending an empty function to keep it consistent with the above usage.
|
|
254
|
-
return fn(() => {
|
|
254
|
+
return fn(() => {}); // eslint-disable-line @typescript-eslint/no-empty-function
|
|
255
255
|
};
|
|
256
256
|
|
|
257
257
|
/**
|
package/src/embed/liveboard.ts
CHANGED
|
@@ -11,16 +11,9 @@
|
|
|
11
11
|
|
|
12
12
|
import { ERROR_MESSAGE } from '../errors';
|
|
13
13
|
import {
|
|
14
|
-
EmbedEvent,
|
|
15
|
-
MessagePayload,
|
|
16
|
-
Param,
|
|
17
|
-
RuntimeFilter,
|
|
18
|
-
DOMSelector,
|
|
19
|
-
HostEvent,
|
|
20
|
-
ViewConfig,
|
|
14
|
+
DOMSelector, EmbedEvent, HostEvent, MessagePayload, Param, ViewConfig,
|
|
21
15
|
} from '../types';
|
|
22
16
|
import { getQueryParamString, isUndefined } from '../utils';
|
|
23
|
-
import { getAuthPromise } from './base';
|
|
24
17
|
import { V1Embed } from './ts-embed';
|
|
25
18
|
|
|
26
19
|
/**
|
|
@@ -44,7 +37,6 @@ export interface LiveboardViewConfig
|
|
|
44
37
|
* incrementally as users scroll the page to view the charts and tables.
|
|
45
38
|
*
|
|
46
39
|
* @version SDK: 1.1.0 | ThoughtSpot: ts7.may.cl, 7.2.1
|
|
47
|
-
*
|
|
48
40
|
* @example
|
|
49
41
|
* ```js
|
|
50
42
|
* const embed = new LiveboardEmbed('#embed', {
|
|
@@ -73,7 +65,6 @@ export interface LiveboardViewConfig
|
|
|
73
65
|
defaultHeight?: number;
|
|
74
66
|
/**
|
|
75
67
|
* @Deprecated If set to true, the context menu in visualizations will be enabled.
|
|
76
|
-
*
|
|
77
68
|
* @example
|
|
78
69
|
* ```js
|
|
79
70
|
* const embed = new LiveboardEmbed('#tsEmbed', {
|
|
@@ -81,7 +72,6 @@ export interface LiveboardViewConfig
|
|
|
81
72
|
* enableVizTransformations:true,
|
|
82
73
|
* })
|
|
83
74
|
* ```
|
|
84
|
-
*
|
|
85
75
|
* @version: SDK: 1.1.0 | ThoughtSpot: 8.1.0.sw
|
|
86
76
|
*/
|
|
87
77
|
enableVizTransformations?: boolean;
|
|
@@ -108,7 +98,6 @@ export interface LiveboardViewConfig
|
|
|
108
98
|
* The visualization within the Liveboard to display.
|
|
109
99
|
*
|
|
110
100
|
* @version SDK: 1.9.1 | ThoughtSpot: 8.1.0.cl, 8.4.1-sw
|
|
111
|
-
*
|
|
112
101
|
* @example
|
|
113
102
|
* ```js
|
|
114
103
|
* const embed = new LiveboardEmbed('#embed-container', {
|
|
@@ -138,7 +127,6 @@ export interface LiveboardViewConfig
|
|
|
138
127
|
* event.
|
|
139
128
|
*
|
|
140
129
|
* @version SDK: 1.9.1 | ThoughtSpot: 8.1.0.cl, 8.4.1-sw
|
|
141
|
-
*
|
|
142
130
|
* @example
|
|
143
131
|
* ```js
|
|
144
132
|
* const embed = new LiveboardEmbed('#embed-container', {
|
|
@@ -188,7 +176,6 @@ export interface LiveboardViewConfig
|
|
|
188
176
|
* Show or hide the tab panel of the embedded Liveboard.
|
|
189
177
|
*
|
|
190
178
|
* @version SDK: 1.25.0 | Thoughtspot: 9.6.0.cl, 9.8.0.sw
|
|
191
|
-
*
|
|
192
179
|
* @example
|
|
193
180
|
* ```js
|
|
194
181
|
* const embed = new LiveboardEmbed('#embed-container', {
|
|
@@ -214,9 +201,9 @@ export interface LiveboardViewConfig
|
|
|
214
201
|
hideLiveboardHeader?: boolean;
|
|
215
202
|
/**
|
|
216
203
|
* Show or hide the Liveboard title.
|
|
204
|
+
*
|
|
217
205
|
* @default false
|
|
218
206
|
* @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl, 9.8.0.sw
|
|
219
|
-
*
|
|
220
207
|
* @example
|
|
221
208
|
* ```js
|
|
222
209
|
* const embed = new LiveboardEmbed('#embed-container', {
|
|
@@ -228,9 +215,9 @@ export interface LiveboardViewConfig
|
|
|
228
215
|
showLiveboardTitle?: boolean;
|
|
229
216
|
/**
|
|
230
217
|
* Show or hide the Liveboard description.
|
|
218
|
+
*
|
|
231
219
|
* @default false
|
|
232
220
|
* @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl, 9.8.0.sw
|
|
233
|
-
*
|
|
234
221
|
* @example
|
|
235
222
|
* ```js
|
|
236
223
|
* const embed = new LiveboardEmbed('#embed-container', {
|
package/src/embed/search.ts
CHANGED
|
@@ -7,24 +7,20 @@
|
|
|
7
7
|
* @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
+
import { getReleaseVersion } from '../auth';
|
|
11
|
+
import { ERROR_MESSAGE } from '../errors';
|
|
10
12
|
import {
|
|
11
|
-
DataSourceVisualMode,
|
|
12
|
-
DOMSelector,
|
|
13
|
-
Param,
|
|
14
|
-
Action,
|
|
15
|
-
ViewConfig,
|
|
13
|
+
Action, DOMSelector, DataSourceVisualMode, Param, ViewConfig,
|
|
16
14
|
} from '../types';
|
|
17
15
|
import {
|
|
18
|
-
getQueryParamString,
|
|
19
16
|
checkReleaseVersionInBeta,
|
|
20
17
|
getFilterQuery,
|
|
18
|
+
getQueryParamString,
|
|
21
19
|
getRuntimeParameters,
|
|
22
20
|
} from '../utils';
|
|
23
|
-
import { TsEmbed } from './ts-embed';
|
|
24
|
-
import { ERROR_MESSAGE } from '../errors';
|
|
25
21
|
import { getAuthPromise } from './base';
|
|
26
|
-
import { getReleaseVersion } from '../auth';
|
|
27
22
|
import { getEmbedConfig } from './embedConfig';
|
|
23
|
+
import { TsEmbed } from './ts-embed';
|
|
28
24
|
|
|
29
25
|
/**
|
|
30
26
|
* Configuration for search options.
|
|
@@ -63,7 +59,6 @@ export interface SearchViewConfig
|
|
|
63
59
|
* but can be expanded manually.
|
|
64
60
|
*
|
|
65
61
|
* @version: SDK: 1.1.0 | ThoughtSpot: 8.1.0.sw
|
|
66
|
-
*
|
|
67
62
|
* @example
|
|
68
63
|
* ```js
|
|
69
64
|
* const embed = new SearchEmbed('#tsEmbed', {
|
|
@@ -77,7 +72,6 @@ export interface SearchViewConfig
|
|
|
77
72
|
* Show or hide the data sources panel.
|
|
78
73
|
*
|
|
79
74
|
* @version: SDK: 1.2.0 | ThoughtSpot: 9.1.0.sw
|
|
80
|
-
*
|
|
81
75
|
* @example
|
|
82
76
|
* ```js
|
|
83
77
|
* const embed = new SearchEmbed('#tsEmbed', {
|
|
@@ -93,7 +87,6 @@ export interface SearchViewConfig
|
|
|
93
87
|
* using raw answer data.
|
|
94
88
|
*
|
|
95
89
|
* @version: SDK: 1.2.0 | ThoughtSpot: 9.1.0.sw
|
|
96
|
-
*
|
|
97
90
|
* @example
|
|
98
91
|
* ```js
|
|
99
92
|
* const embed = new SearchEmbed('#tsEmbed', {
|
|
@@ -103,11 +96,14 @@ export interface SearchViewConfig
|
|
|
103
96
|
* ```
|
|
104
97
|
*/
|
|
105
98
|
hideResults?: boolean;
|
|
99
|
+
/**
|
|
100
|
+
* If set to true, expands all the data sources panel.
|
|
101
|
+
*/
|
|
102
|
+
expandAllDataSource?: boolean;
|
|
106
103
|
/**
|
|
107
104
|
* If set to true, the Search Assist feature is enabled.
|
|
108
105
|
*
|
|
109
106
|
* @version SDK: 1.13.0 | ThoughtSpot: 8.5.0.cl, 8.8.1-sw
|
|
110
|
-
*
|
|
111
107
|
* @example
|
|
112
108
|
* ```js
|
|
113
109
|
* const embed = new SearchEmbed('#tsEmbed', {
|
|
@@ -122,7 +118,6 @@ export interface SearchViewConfig
|
|
|
122
118
|
* format for presenting search data.
|
|
123
119
|
*
|
|
124
120
|
* @version: SDK: 1.1.0 | ThoughtSpot: 8.1.0.sw
|
|
125
|
-
*
|
|
126
121
|
* @example
|
|
127
122
|
* ```js
|
|
128
123
|
* const embed = new SearchEmbed('#tsEmbed', {
|
|
@@ -136,7 +131,6 @@ export interface SearchViewConfig
|
|
|
136
131
|
* Only a single data source is supported currently.
|
|
137
132
|
*
|
|
138
133
|
* @deprecated Use `dataSource` instead.
|
|
139
|
-
*
|
|
140
134
|
* @example
|
|
141
135
|
* ```js
|
|
142
136
|
* const embed = new SearchEmbed('#tsEmbed', {
|
|
@@ -150,7 +144,6 @@ export interface SearchViewConfig
|
|
|
150
144
|
* The array of data source GUIDs to set on load.
|
|
151
145
|
*
|
|
152
146
|
* @version: SDK: 1.19.0
|
|
153
|
-
*
|
|
154
147
|
* @example
|
|
155
148
|
* ```js
|
|
156
149
|
* const embed = new SearchEmbed('#tsEmbed', {
|
|
@@ -192,7 +185,6 @@ export interface SearchViewConfig
|
|
|
192
185
|
* The GUID of a saved answer to load initially.
|
|
193
186
|
*
|
|
194
187
|
* @version: SDK: 1.1.0 | ThoughtSpot: 8.1.0.sw
|
|
195
|
-
*
|
|
196
188
|
* @example
|
|
197
189
|
* ```js
|
|
198
190
|
* const embed = new SearchEmbed('#tsEmbed', {
|
|
@@ -207,7 +199,6 @@ export interface SearchViewConfig
|
|
|
207
199
|
* The chart/table should still be visible.
|
|
208
200
|
*
|
|
209
201
|
* @version SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl, 9.5.0.sw
|
|
210
|
-
*
|
|
211
202
|
* @example
|
|
212
203
|
* ```js
|
|
213
204
|
* const embed = new SearchEmbed('#tsEmbed', {
|
|
@@ -222,7 +213,6 @@ export interface SearchViewConfig
|
|
|
222
213
|
*
|
|
223
214
|
* @default false
|
|
224
215
|
* @version SDK: 1.26.0 | Thoughtspot: 9.7.0.cl
|
|
225
|
-
*
|
|
226
216
|
* @example
|
|
227
217
|
* ```js
|
|
228
218
|
* const embed = new SearchEmbed('#tsEmbed', {
|
|
@@ -305,6 +295,7 @@ export class SearchEmbed extends TsEmbed {
|
|
|
305
295
|
protected getEmbedParams(): string {
|
|
306
296
|
const {
|
|
307
297
|
hideResults,
|
|
298
|
+
expandAllDataSource,
|
|
308
299
|
enableSearchAssist,
|
|
309
300
|
forceTable,
|
|
310
301
|
searchOptions,
|
|
@@ -1,39 +1,39 @@
|
|
|
1
1
|
/* eslint-disable dot-notation */
|
|
2
|
+
import * as authInstance from '../auth';
|
|
2
3
|
import { resetCachedAuthToken } from '../authToken';
|
|
4
|
+
import * as config from '../config';
|
|
3
5
|
import {
|
|
6
|
+
AppEmbed,
|
|
4
7
|
AuthType,
|
|
5
|
-
init,
|
|
6
8
|
EmbedEvent,
|
|
7
|
-
SearchEmbed,
|
|
8
|
-
PinboardEmbed,
|
|
9
|
-
LiveboardViewConfig,
|
|
10
|
-
AppEmbed,
|
|
11
9
|
LiveboardEmbed,
|
|
10
|
+
LiveboardViewConfig,
|
|
11
|
+
PinboardEmbed,
|
|
12
|
+
SearchEmbed,
|
|
13
|
+
init,
|
|
12
14
|
} from '../index';
|
|
15
|
+
import * as mixpanelInstance from '../mixpanel-service';
|
|
16
|
+
import { MIXPANEL_EVENT } from '../mixpanel-service';
|
|
13
17
|
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
import {
|
|
18
|
+
createRootEleForEmbed,
|
|
19
|
+
defaultParamsForPinboardEmbed,
|
|
17
20
|
executeAfterWait,
|
|
21
|
+
expectUrlMatchesWithParams,
|
|
18
22
|
getDocumentBody,
|
|
19
23
|
getIFrameEl,
|
|
20
24
|
getIFrameSrc,
|
|
21
25
|
getRootEl,
|
|
26
|
+
mockMessageChannel,
|
|
22
27
|
postMessageToParent,
|
|
23
|
-
defaultParamsForPinboardEmbed,
|
|
24
28
|
waitFor,
|
|
25
|
-
expectUrlMatchesWithParams,
|
|
26
|
-
mockMessageChannel,
|
|
27
|
-
createRootEleForEmbed,
|
|
28
29
|
} from '../test/test-utils';
|
|
29
|
-
import
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
import * as authInstance from '../auth';
|
|
33
|
-
import * as baseInstance from './base';
|
|
34
|
-
import { MIXPANEL_EVENT } from '../mixpanel-service';
|
|
30
|
+
import {
|
|
31
|
+
Action, HomeLeftNavItem, HomepageModule, RuntimeFilter, RuntimeFilterOp,
|
|
32
|
+
} from '../types';
|
|
35
33
|
import * as authService from '../utils/authService/authService';
|
|
36
34
|
import { logger } from '../utils/logger';
|
|
35
|
+
import * as baseInstance from './base';
|
|
36
|
+
import * as tsEmbedInstance from './ts-embed';
|
|
37
37
|
|
|
38
38
|
const defaultViewConfig = {
|
|
39
39
|
frameParams: {
|
|
@@ -417,8 +417,10 @@ describe('Unit test case for ts embed', () => {
|
|
|
417
417
|
authToken: '',
|
|
418
418
|
hostConfig: undefined,
|
|
419
419
|
runtimeFilterParams: null,
|
|
420
|
-
hiddenHomeLeftNavItems:
|
|
421
|
-
|
|
420
|
+
hiddenHomeLeftNavItems: [
|
|
421
|
+
HomeLeftNavItem.Home,
|
|
422
|
+
HomeLeftNavItem.MonitorSubscription,
|
|
423
|
+
],
|
|
422
424
|
hiddenHomepageModules: [],
|
|
423
425
|
reorderedHomepageModules: [],
|
|
424
426
|
},
|
|
@@ -647,7 +649,10 @@ describe('Unit test case for ts embed', () => {
|
|
|
647
649
|
type: EmbedEvent.APP_INIT,
|
|
648
650
|
data: {},
|
|
649
651
|
};
|
|
650
|
-
const searchEmbed = new SearchEmbed(getRootEl(), {
|
|
652
|
+
const searchEmbed = new SearchEmbed(getRootEl(), {
|
|
653
|
+
...defaultViewConfig,
|
|
654
|
+
preRenderId: 'test',
|
|
655
|
+
});
|
|
651
656
|
searchEmbed.preRender();
|
|
652
657
|
const mockPort: any = {
|
|
653
658
|
postMessage: jest.fn(),
|
|
@@ -704,7 +709,10 @@ describe('Unit test case for ts embed', () => {
|
|
|
704
709
|
type: EmbedEvent.AuthExpire,
|
|
705
710
|
data: {},
|
|
706
711
|
};
|
|
707
|
-
const searchEmbed = new SearchEmbed(getRootEl(), {
|
|
712
|
+
const searchEmbed = new SearchEmbed(getRootEl(), {
|
|
713
|
+
...defaultViewConfig,
|
|
714
|
+
preRenderId: 'test',
|
|
715
|
+
});
|
|
708
716
|
jest.spyOn(baseInstance, 'notifyAuthFailure');
|
|
709
717
|
searchEmbed.preRender();
|
|
710
718
|
const mockPort: any = {
|
|
@@ -1208,7 +1216,7 @@ describe('Unit test case for ts embed', () => {
|
|
|
1208
1216
|
expectUrlMatchesWithParams(
|
|
1209
1217
|
getIFrameSrc(),
|
|
1210
1218
|
`http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&${defaultParamsForPinboardEmbed}`
|
|
1211
|
-
|
|
1219
|
+
+ `&foo=bar&baz=1&bool=true${defaultParamsPost}#/home`,
|
|
1212
1220
|
);
|
|
1213
1221
|
});
|
|
1214
1222
|
|
|
@@ -1224,7 +1232,7 @@ describe('Unit test case for ts embed', () => {
|
|
|
1224
1232
|
expectUrlMatchesWithParams(
|
|
1225
1233
|
getIFrameSrc(),
|
|
1226
1234
|
`http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&${defaultParamsForPinboardEmbed}`
|
|
1227
|
-
|
|
1235
|
+
+ `&showAlerts=true${defaultParamsPost}#/home`,
|
|
1228
1236
|
);
|
|
1229
1237
|
});
|
|
1230
1238
|
it('Sets the locale param', async () => {
|
|
@@ -1239,7 +1247,7 @@ describe('Unit test case for ts embed', () => {
|
|
|
1239
1247
|
expectUrlMatchesWithParams(
|
|
1240
1248
|
getIFrameSrc(),
|
|
1241
1249
|
`http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&${defaultParamsForPinboardEmbed}`
|
|
1242
|
-
|
|
1250
|
+
+ `&locale=ja-JP${defaultParamsPost}#/home`,
|
|
1243
1251
|
);
|
|
1244
1252
|
});
|
|
1245
1253
|
it('Sets the iconSprite url', async () => {
|
|
@@ -1256,7 +1264,7 @@ describe('Unit test case for ts embed', () => {
|
|
|
1256
1264
|
expectUrlMatchesWithParams(
|
|
1257
1265
|
getIFrameSrc(),
|
|
1258
1266
|
`http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&${defaultParamsForPinboardEmbed}`
|
|
1259
|
-
|
|
1267
|
+
+ `&iconSprite=iconSprite.com${defaultParamsPost}#/home`,
|
|
1260
1268
|
);
|
|
1261
1269
|
});
|
|
1262
1270
|
|