@thoughtspot/visual-embed-sdk 1.12.0-alpha.2 → 1.12.2
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/CHANGELOG.md +19 -6
- package/README.md +1 -1
- package/dist/src/auth.d.ts +17 -1
- package/dist/src/auth.spec.d.ts +1 -0
- package/dist/src/embed/base.d.ts +1 -0
- package/dist/src/embed/liveboard.d.ts +7 -1
- package/dist/src/embed/search.d.ts +5 -0
- package/dist/src/embed/searchEmbed-basic-auth.spec.d.ts +1 -0
- package/dist/src/embed/ts-embed.d.ts +2 -1
- package/dist/src/errors.d.ts +1 -0
- package/dist/src/types.d.ts +19 -2
- package/dist/src/utils.d.ts +1 -0
- package/dist/tsembed.es.js +80 -7
- package/dist/tsembed.js +80 -7
- package/lib/package.json +4 -2
- package/lib/src/auth.d.ts +17 -1
- package/lib/src/auth.js +23 -2
- package/lib/src/auth.js.map +1 -1
- package/lib/src/auth.spec.d.ts +1 -0
- package/lib/src/auth.spec.js +4 -1
- package/lib/src/auth.spec.js.map +1 -1
- package/lib/src/embed/app.spec.js +4 -3
- package/lib/src/embed/app.spec.js.map +1 -1
- package/lib/src/embed/base.d.ts +1 -0
- package/lib/src/embed/base.js +10 -0
- package/lib/src/embed/base.js.map +1 -1
- package/lib/src/embed/base.spec.js +16 -0
- package/lib/src/embed/base.spec.js.map +1 -1
- package/lib/src/embed/embed.spec.js +2 -0
- package/lib/src/embed/embed.spec.js.map +1 -1
- package/lib/src/embed/events.spec.js +1 -0
- package/lib/src/embed/events.spec.js.map +1 -1
- package/lib/src/embed/liveboard.d.ts +7 -1
- package/lib/src/embed/liveboard.js +12 -0
- package/lib/src/embed/liveboard.js.map +1 -1
- package/lib/src/embed/liveboard.spec.js +18 -4
- package/lib/src/embed/liveboard.spec.js.map +1 -1
- package/lib/src/embed/pinboard.spec.js +4 -3
- package/lib/src/embed/pinboard.spec.js.map +1 -1
- package/lib/src/embed/search.d.ts +5 -0
- package/lib/src/embed/search.js +10 -2
- package/lib/src/embed/search.js.map +1 -1
- package/lib/src/embed/search.spec.js +9 -1
- package/lib/src/embed/search.spec.js.map +1 -1
- package/lib/src/embed/searchEmbed-basic-auth.spec.d.ts +1 -0
- package/lib/src/embed/searchEmbed-basic-auth.spec.js +96 -0
- package/lib/src/embed/searchEmbed-basic-auth.spec.js.map +1 -0
- package/lib/src/embed/ts-embed.d.ts +2 -1
- package/lib/src/embed/ts-embed.js +7 -5
- package/lib/src/embed/ts-embed.js.map +1 -1
- package/lib/src/embed/ts-embed.spec.js +12 -5
- package/lib/src/embed/ts-embed.spec.js.map +1 -1
- package/lib/src/errors.d.ts +1 -0
- package/lib/src/errors.js +1 -0
- package/lib/src/errors.js.map +1 -1
- package/lib/src/react/index.js +3 -2
- package/lib/src/react/index.js.map +1 -1
- package/lib/src/react/index.spec.js +3 -2
- package/lib/src/react/index.spec.js.map +1 -1
- package/lib/src/types.d.ts +19 -2
- package/lib/src/types.js +11 -0
- package/lib/src/types.js.map +1 -1
- package/lib/src/utils.d.ts +1 -0
- package/lib/src/utils.js +11 -0
- package/lib/src/utils.js.map +1 -1
- package/lib/src/utils.spec.js +22 -1
- package/lib/src/utils.spec.js.map +1 -1
- package/lib/src/visual-embed-sdk.d.ts +50 -5
- package/package.json +5 -3
- package/src/auth.spec.ts +10 -1
- package/src/auth.ts +24 -2
- package/src/embed/app.spec.ts +4 -3
- package/src/embed/base.spec.ts +18 -0
- package/src/embed/base.ts +10 -0
- package/src/embed/embed.spec.ts +2 -0
- package/src/embed/events.spec.ts +1 -0
- package/src/embed/liveboard.spec.ts +27 -4
- package/src/embed/liveboard.ts +13 -0
- package/src/embed/pinboard.spec.ts +4 -3
- package/src/embed/search.spec.ts +11 -1
- package/src/embed/search.ts +20 -1
- package/src/embed/searchEmbed-basic-auth.spec.ts +115 -0
- package/src/embed/ts-embed.spec.ts +19 -5
- package/src/embed/ts-embed.ts +8 -5
- package/src/errors.ts +2 -0
- package/src/react/index.spec.tsx +4 -2
- package/src/react/index.tsx +3 -2
- package/src/types.ts +17 -0
- package/src/utils.spec.ts +29 -0
- package/src/utils.ts +16 -0
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { SearchEmbed } from './search';
|
|
2
|
+
import * as baseInstance from './base';
|
|
3
|
+
import * as authService from '../utils/authService';
|
|
4
|
+
import * as authInstance from '../auth';
|
|
5
|
+
import * as config from '../config';
|
|
6
|
+
|
|
7
|
+
import { init } from '../index';
|
|
8
|
+
import { AuthType } from '../types';
|
|
9
|
+
import { getDocumentBody, getRootEl } from '../test/test-utils';
|
|
10
|
+
import { mockSessionInfo } from '../auth.spec';
|
|
11
|
+
import { ERROR_MESSAGE } from '../errors';
|
|
12
|
+
|
|
13
|
+
const thoughtSpotHost = 'tshost';
|
|
14
|
+
init({
|
|
15
|
+
thoughtSpotHost,
|
|
16
|
+
authType: AuthType.Basic,
|
|
17
|
+
username: 'tsadmin',
|
|
18
|
+
password: 'admin',
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
describe('Search embed tests when authType is Basic', () => {
|
|
22
|
+
function setupVersion(version: string) {
|
|
23
|
+
jest.spyOn(window, 'addEventListener').mockImplementationOnce(
|
|
24
|
+
(event, handler, options) => {
|
|
25
|
+
handler({
|
|
26
|
+
data: {
|
|
27
|
+
type: 'xyz',
|
|
28
|
+
},
|
|
29
|
+
ports: [3000],
|
|
30
|
+
source: null,
|
|
31
|
+
});
|
|
32
|
+
},
|
|
33
|
+
);
|
|
34
|
+
jest.spyOn(authService, 'fetchSessionInfoService').mockImplementation(
|
|
35
|
+
async () => ({
|
|
36
|
+
json: () => ({
|
|
37
|
+
...mockSessionInfo,
|
|
38
|
+
releaseVersion: version,
|
|
39
|
+
}),
|
|
40
|
+
status: 200,
|
|
41
|
+
}),
|
|
42
|
+
);
|
|
43
|
+
jest.spyOn(authInstance, 'getReleaseVersion').mockReturnValue(version);
|
|
44
|
+
}
|
|
45
|
+
beforeEach(() => {
|
|
46
|
+
document.body.innerHTML = getDocumentBody();
|
|
47
|
+
jest.spyOn(baseInstance, 'getAuthPromise').mockResolvedValue(true);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
afterEach(() => {
|
|
51
|
+
jest.clearAllMocks();
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
test('when releaseVersion is empty', async () => {
|
|
55
|
+
setupVersion('');
|
|
56
|
+
const mockAlert = spyOn(window, 'alert');
|
|
57
|
+
const searchEmbed = new SearchEmbed(getRootEl(), {});
|
|
58
|
+
await searchEmbed.render();
|
|
59
|
+
expect(mockAlert).not.toBeCalled();
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
test("when releaseVersion is '7.0.1.cl' ", async () => {
|
|
63
|
+
setupVersion('7.0.1.cl');
|
|
64
|
+
const mockAlert = jest.spyOn(window, 'alert');
|
|
65
|
+
const searchEmbed = new SearchEmbed(getRootEl(), {});
|
|
66
|
+
await searchEmbed.render();
|
|
67
|
+
expect(mockAlert).not.toBeCalled();
|
|
68
|
+
});
|
|
69
|
+
test('when releaseVersion is above 8.4.0.sw', async () => {
|
|
70
|
+
setupVersion('8.4.0.sw');
|
|
71
|
+
const mockAlert = jest.spyOn(window, 'alert');
|
|
72
|
+
const searchEmbed = new SearchEmbed(getRootEl(), {});
|
|
73
|
+
await searchEmbed.render();
|
|
74
|
+
expect(mockAlert).not.toBeCalled();
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
test('releaseVersion is above 8.4.0.sw', async () => {
|
|
78
|
+
setupVersion('8.8.0.sw');
|
|
79
|
+
jest.spyOn(config, 'getThoughtSpotHost').mockImplementation(
|
|
80
|
+
() => 'http://tshost',
|
|
81
|
+
);
|
|
82
|
+
const mockAlert = jest.spyOn(window, 'alert');
|
|
83
|
+
const searchEmbed = new SearchEmbed(getRootEl(), {});
|
|
84
|
+
await searchEmbed.render();
|
|
85
|
+
expect(mockAlert).not.toBeCalled();
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
test('Alert should not appear when suppressSearchEmbedBetaWarning is true and releaseVersion is ts7.dec.cl', async () => {
|
|
89
|
+
setupVersion('ts7.dec.cl');
|
|
90
|
+
jest.spyOn(config, 'getThoughtSpotHost').mockImplementation(
|
|
91
|
+
() => 'http://tshost',
|
|
92
|
+
);
|
|
93
|
+
jest.spyOn(baseInstance, 'getEmbedConfig').mockReturnValue({
|
|
94
|
+
suppressSearchEmbedBetaWarning: true,
|
|
95
|
+
});
|
|
96
|
+
const mockAlert = jest.spyOn(window, 'alert');
|
|
97
|
+
const searchEmbed = new SearchEmbed(getRootEl(), {});
|
|
98
|
+
await searchEmbed.render();
|
|
99
|
+
expect(mockAlert).not.toBeCalled();
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
test('Alert should not appear when suppressSearchEmbedBetaWarning is true and releaseVersion is 8.4.0.sw', async () => {
|
|
103
|
+
setupVersion('8.4.0.sw');
|
|
104
|
+
jest.spyOn(config, 'getThoughtSpotHost').mockImplementation(
|
|
105
|
+
() => 'http://tshost',
|
|
106
|
+
);
|
|
107
|
+
jest.spyOn(baseInstance, 'getEmbedConfig').mockReturnValue({
|
|
108
|
+
suppressSearchEmbedBetaWarning: true,
|
|
109
|
+
});
|
|
110
|
+
const mockAlert = jest.spyOn(window, 'alert');
|
|
111
|
+
const searchEmbed = new SearchEmbed(getRootEl(), {});
|
|
112
|
+
await searchEmbed.render();
|
|
113
|
+
expect(mockAlert).not.toBeCalled();
|
|
114
|
+
});
|
|
115
|
+
});
|
|
@@ -34,9 +34,13 @@ const defaultViewConfig = {
|
|
|
34
34
|
const pinboardId = 'eca215d4-0d2c-4a55-90e3-d81ef6848ae0';
|
|
35
35
|
const liveboardId = 'eca215d4-0d2c-4a55-90e3-d81ef6848ae0';
|
|
36
36
|
const thoughtSpotHost = 'tshost';
|
|
37
|
-
const defaultParamsForPinboardEmbed = `hostAppUrl=local-host&viewPortHeight=768&viewPortWidth=1024&sdkVersion=${version}`;
|
|
37
|
+
const defaultParamsForPinboardEmbed = `hostAppUrl=local-host&viewPortHeight=768&viewPortWidth=1024&sdkVersion=${version}&hideAction=[%22${Action.ReportError}%22]`;
|
|
38
38
|
const defaultParamsPost = '&isPinboardV2Enabled=false';
|
|
39
39
|
|
|
40
|
+
beforeAll(() => {
|
|
41
|
+
spyOn(window, 'alert');
|
|
42
|
+
});
|
|
43
|
+
|
|
40
44
|
describe('Unit test case for ts embed', () => {
|
|
41
45
|
const mockMixPanelEvent = jest.spyOn(
|
|
42
46
|
mixpanelInstance,
|
|
@@ -261,7 +265,7 @@ describe('Unit test case for ts embed', () => {
|
|
|
261
265
|
|
|
262
266
|
describe('when visible actions are set', () => {
|
|
263
267
|
test('should throw error when there are both visible and hidden actions - pinboard', async () => {
|
|
264
|
-
spyOn(console, '
|
|
268
|
+
spyOn(console, 'error');
|
|
265
269
|
const pinboardEmbed = new PinboardEmbed(getRootEl(), {
|
|
266
270
|
hiddenActions: [Action.DownloadAsCsv],
|
|
267
271
|
visibleActions: [Action.DownloadAsCsv],
|
|
@@ -270,7 +274,7 @@ describe('Unit test case for ts embed', () => {
|
|
|
270
274
|
} as LiveboardViewConfig);
|
|
271
275
|
await pinboardEmbed.render();
|
|
272
276
|
expect(pinboardEmbed['isError']).toBe(true);
|
|
273
|
-
expect(console.
|
|
277
|
+
expect(console.error).toHaveBeenCalledWith(
|
|
274
278
|
'You cannot have both hidden actions and visible actions',
|
|
275
279
|
);
|
|
276
280
|
});
|
|
@@ -288,7 +292,7 @@ describe('Unit test case for ts embed', () => {
|
|
|
288
292
|
hiddenActions: Array<Action>,
|
|
289
293
|
visibleActions: Array<Action>,
|
|
290
294
|
) {
|
|
291
|
-
spyOn(console, '
|
|
295
|
+
spyOn(console, 'error');
|
|
292
296
|
const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
|
|
293
297
|
hiddenActions,
|
|
294
298
|
visibleActions,
|
|
@@ -297,7 +301,7 @@ describe('Unit test case for ts embed', () => {
|
|
|
297
301
|
} as LiveboardViewConfig);
|
|
298
302
|
await liveboardEmbed.render();
|
|
299
303
|
expect(liveboardEmbed['isError']).toBe(true);
|
|
300
|
-
expect(console.
|
|
304
|
+
expect(console.error).toHaveBeenCalledWith(
|
|
301
305
|
'You cannot have both hidden actions and visible actions',
|
|
302
306
|
);
|
|
303
307
|
}
|
|
@@ -346,14 +350,19 @@ describe('Unit test case for ts embed', () => {
|
|
|
346
350
|
});
|
|
347
351
|
|
|
348
352
|
test('Error should be true', async () => {
|
|
353
|
+
spyOn(console, 'error');
|
|
349
354
|
const tsEmbed = new SearchEmbed(getRootEl(), {});
|
|
350
355
|
tsEmbed.render();
|
|
351
356
|
expect(tsEmbed['isError']).toBe(true);
|
|
357
|
+
expect(console.error).toHaveBeenCalledWith(
|
|
358
|
+
'You need to init the ThoughtSpot SDK module first',
|
|
359
|
+
);
|
|
352
360
|
});
|
|
353
361
|
});
|
|
354
362
|
|
|
355
363
|
describe('V1Embed ', () => {
|
|
356
364
|
test('when isRendered is true than isError will be true', () => {
|
|
365
|
+
spyOn(console, 'error');
|
|
357
366
|
const viEmbedIns = new tsEmbedInstance.V1Embed(
|
|
358
367
|
getRootEl(),
|
|
359
368
|
defaultViewConfig,
|
|
@@ -362,11 +371,15 @@ describe('Unit test case for ts embed', () => {
|
|
|
362
371
|
viEmbedIns.render();
|
|
363
372
|
viEmbedIns.on(EmbedEvent.CustomAction, jest.fn()).render();
|
|
364
373
|
expect(viEmbedIns['isError']).toBe(true);
|
|
374
|
+
expect(console.error).toHaveBeenCalledWith(
|
|
375
|
+
'Please register event handlers before calling render',
|
|
376
|
+
);
|
|
365
377
|
});
|
|
366
378
|
});
|
|
367
379
|
|
|
368
380
|
describe('Navigate to Page API', () => {
|
|
369
381
|
const path = 'viz/e0836cad-4fdf-42d4-bd97-567a6b2a6058';
|
|
382
|
+
|
|
370
383
|
beforeEach(() => {
|
|
371
384
|
jest.spyOn(config, 'getThoughtSpotHost').mockImplementation(
|
|
372
385
|
() => 'http://tshost',
|
|
@@ -415,6 +428,7 @@ describe('Unit test case for ts embed', () => {
|
|
|
415
428
|
});
|
|
416
429
|
describe('Navigate to Page API - Pinboard', () => {
|
|
417
430
|
const path = 'pinboard/e0836cad-4fdf-42d4-bd97-567a6b2a6058';
|
|
431
|
+
|
|
418
432
|
beforeEach(() => {
|
|
419
433
|
jest.spyOn(config, 'getThoughtSpotHost').mockImplementation(
|
|
420
434
|
() => 'http://tshost',
|
package/src/embed/ts-embed.ts
CHANGED
|
@@ -75,7 +75,7 @@ export interface FrameParams {
|
|
|
75
75
|
* This parameters will be passed on the iframe
|
|
76
76
|
* as is.
|
|
77
77
|
*/
|
|
78
|
-
[key: string]: string | number | boolean;
|
|
78
|
+
[key: string]: string | number | boolean | undefined;
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
/**
|
|
@@ -202,6 +202,8 @@ export class TsEmbed {
|
|
|
202
202
|
*/
|
|
203
203
|
private shouldEncodeUrlQueryParams = false;
|
|
204
204
|
|
|
205
|
+
private defaultHiddenActions = [Action.ReportError];
|
|
206
|
+
|
|
205
207
|
constructor(domSelector: DOMSelector, viewConfig?: ViewConfig) {
|
|
206
208
|
this.el = this.getDOMNode(domSelector);
|
|
207
209
|
// TODO: handle error
|
|
@@ -242,7 +244,7 @@ export class TsEmbed {
|
|
|
242
244
|
error,
|
|
243
245
|
});
|
|
244
246
|
// Log error
|
|
245
|
-
console.
|
|
247
|
+
console.error(error);
|
|
246
248
|
}
|
|
247
249
|
|
|
248
250
|
/**
|
|
@@ -382,9 +384,10 @@ export class TsEmbed {
|
|
|
382
384
|
if (disabledActionReason) {
|
|
383
385
|
queryParams[Param.DisableActionReason] = disabledActionReason;
|
|
384
386
|
}
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
387
|
+
queryParams[Param.HideActions] = [
|
|
388
|
+
...this.defaultHiddenActions,
|
|
389
|
+
...(hiddenActions ?? []),
|
|
390
|
+
];
|
|
388
391
|
if (Array.isArray(visibleActions)) {
|
|
389
392
|
queryParams[Param.VisibleActions] = visibleActions;
|
|
390
393
|
}
|
package/src/errors.ts
CHANGED
package/src/react/index.spec.tsx
CHANGED
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import '@testing-library/jest-dom';
|
|
3
3
|
import '@testing-library/jest-dom/extend-expect';
|
|
4
4
|
import { cleanup, fireEvent, render, waitFor } from '@testing-library/react';
|
|
5
|
+
import { Action, EmbedEvent, HostEvent } from '../types';
|
|
5
6
|
import {
|
|
6
7
|
executeAfterWait,
|
|
7
8
|
getIFrameEl,
|
|
@@ -11,7 +12,7 @@ import {
|
|
|
11
12
|
} from '../test/test-utils';
|
|
12
13
|
import { SearchEmbed, AppEmbed, LiveboardEmbed, useEmbedRef } from './index';
|
|
13
14
|
import { AuthType, init } from '../index';
|
|
14
|
-
|
|
15
|
+
|
|
15
16
|
import { version } from '../../package.json';
|
|
16
17
|
|
|
17
18
|
const thoughtSpotHost = 'localhost';
|
|
@@ -21,6 +22,7 @@ beforeAll(() => {
|
|
|
21
22
|
thoughtSpotHost,
|
|
22
23
|
authType: AuthType.None,
|
|
23
24
|
});
|
|
25
|
+
spyOn(window, 'alert');
|
|
24
26
|
});
|
|
25
27
|
|
|
26
28
|
describe('React Components', () => {
|
|
@@ -38,7 +40,7 @@ describe('React Components', () => {
|
|
|
38
40
|
),
|
|
39
41
|
).toBe(true);
|
|
40
42
|
expect(getIFrameSrc(container)).toBe(
|
|
41
|
-
`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`,
|
|
43
|
+
`http://${thoughtSpotHost}/?hostAppUrl=local-host&viewPortHeight=768&viewPortWidth=1024&sdkVersion=${version}&hideAction=[%22${Action.ReportError}%22,%22editACopy%22,%22saveAsView%22,%22updateTSL%22,%22editTSL%22,%22onDeleteAnswer%22]&dataSourceMode=hide&useLastSelectedSources=false&isSearchEmbed=true#/embed/answer`,
|
|
42
44
|
);
|
|
43
45
|
});
|
|
44
46
|
|
package/src/react/index.tsx
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import useDeepCompareEffect from 'use-deep-compare-effect';
|
|
2
3
|
import { SearchEmbed as _SearchEmbed, SearchViewConfig } from '../embed/search';
|
|
3
4
|
import { AppEmbed as _AppEmbed, AppViewConfig } from '../embed/app';
|
|
4
5
|
import {
|
|
@@ -25,7 +26,7 @@ const componentFactory = <
|
|
|
25
26
|
Omit<U, 'className'>,
|
|
26
27
|
V
|
|
27
28
|
>(embedProps);
|
|
28
|
-
|
|
29
|
+
useDeepCompareEffect(() => {
|
|
29
30
|
const tsEmbed = new EmbedConstructor(ref!.current, {
|
|
30
31
|
...viewConfig,
|
|
31
32
|
});
|
|
@@ -40,7 +41,7 @@ const componentFactory = <
|
|
|
40
41
|
// eslint-disable-next-line no-param-reassign
|
|
41
42
|
forwardedRef.current = tsEmbed;
|
|
42
43
|
}
|
|
43
|
-
}, [
|
|
44
|
+
}, [viewConfig, listeners]);
|
|
44
45
|
|
|
45
46
|
return (
|
|
46
47
|
<div
|
package/src/types.ts
CHANGED
|
@@ -177,6 +177,12 @@ export interface EmbedConfig {
|
|
|
177
177
|
* @version SDK: 1.10.4 | ThoughtSpot: *
|
|
178
178
|
*/
|
|
179
179
|
detectCookieAccessSlow?: boolean;
|
|
180
|
+
/**
|
|
181
|
+
* Hide beta alert warning message for SearchEmbed.
|
|
182
|
+
*
|
|
183
|
+
* @version SDK: 1.12.0 | ThoughtSpot: *
|
|
184
|
+
*/
|
|
185
|
+
suppressSearchEmbedBetaWarning?: boolean;
|
|
180
186
|
}
|
|
181
187
|
|
|
182
188
|
/**
|
|
@@ -613,6 +619,13 @@ export enum HostEvent {
|
|
|
613
619
|
* @version SDK: 1.13.0 | ThoughtSpot: 8.5.0.cl
|
|
614
620
|
*/
|
|
615
621
|
getExportRequestForCurrentPinboard = 'getExportRequestForCurrentPinboard',
|
|
622
|
+
/**
|
|
623
|
+
* Fires the pin action on an embedded object
|
|
624
|
+
* @param - incase of liveboard embed, takes in an object with vizId as a key
|
|
625
|
+
* can be left empty for search and viz embeds
|
|
626
|
+
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
|
|
627
|
+
*/
|
|
628
|
+
Pin = 'pin',
|
|
616
629
|
}
|
|
617
630
|
|
|
618
631
|
/**
|
|
@@ -813,6 +826,10 @@ export enum Action {
|
|
|
813
826
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
|
|
814
827
|
*/
|
|
815
828
|
CreateMonitor = 'createMonitor',
|
|
829
|
+
/**
|
|
830
|
+
* @version SDK: 1.11.1 | ThoughtSpot: 8.3.0.cl
|
|
831
|
+
*/
|
|
832
|
+
ReportError = 'reportError',
|
|
816
833
|
}
|
|
817
834
|
|
|
818
835
|
export interface SessionInterface {
|
package/src/utils.spec.ts
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
getEncodedQueryParamsString,
|
|
10
10
|
appendToUrlHash,
|
|
11
11
|
getRedirectUrl,
|
|
12
|
+
checkReleaseVersionInBeta,
|
|
12
13
|
} from './utils';
|
|
13
14
|
import { RuntimeFilterOp } from './types';
|
|
14
15
|
|
|
@@ -110,4 +111,32 @@ describe('unit test for utils', () => {
|
|
|
110
111
|
expect(getEncodedQueryParamsString('')).toBe('');
|
|
111
112
|
expect(getEncodedQueryParamsString('test')).toBe('dGVzdA');
|
|
112
113
|
});
|
|
114
|
+
|
|
115
|
+
test('when ReleaseVersion is empty ', () => {
|
|
116
|
+
expect(checkReleaseVersionInBeta('', false)).toBe(false);
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
test('when ReleaseVersion is 7.0.1.cl ', () => {
|
|
120
|
+
expect(checkReleaseVersionInBeta('7.0.1.cl', false)).toBe(false);
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
test('when cluster has dev version', () => {
|
|
124
|
+
expect(checkReleaseVersionInBeta('dev', false)).toBe(false);
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
test('when cluster is above 8.4.0.cl-11 software version', () => {
|
|
128
|
+
expect(checkReleaseVersionInBeta('8.4.0.cl-117', false)).toBe(false);
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
test('when cluster is bellow 8.0.0.sw software version', () => {
|
|
132
|
+
expect(checkReleaseVersionInBeta('7.2.1.sw', false)).toBe(true);
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
test('when suppressBetaWarning is true and ReleaseVersion is 7.0.1', () => {
|
|
136
|
+
expect(checkReleaseVersionInBeta('7.0.1', true)).toBe(false);
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
test('when suppressBetaWarning is false ReleaseVersion is 7.0.1', () => {
|
|
140
|
+
expect(checkReleaseVersionInBeta('7.0.1', false)).toBe(true);
|
|
141
|
+
});
|
|
113
142
|
});
|
package/src/utils.ts
CHANGED
|
@@ -154,3 +154,19 @@ export const setAttributes = (
|
|
|
154
154
|
element.setAttribute(key, attributes[key].toString());
|
|
155
155
|
});
|
|
156
156
|
};
|
|
157
|
+
|
|
158
|
+
const isCloudRelease = (version: string) => version.endsWith('.cl');
|
|
159
|
+
|
|
160
|
+
/* For Search Embed: ReleaseVersionInBeta */
|
|
161
|
+
export const checkReleaseVersionInBeta = (
|
|
162
|
+
releaseVersion: string,
|
|
163
|
+
suppressBetaWarning: boolean,
|
|
164
|
+
): boolean => {
|
|
165
|
+
if (releaseVersion !== '' && !isCloudRelease(releaseVersion)) {
|
|
166
|
+
const splittedReleaseVersion = releaseVersion.split('.');
|
|
167
|
+
const majorVersion = Number(splittedReleaseVersion[0]);
|
|
168
|
+
const isBetaVersion = majorVersion < 8;
|
|
169
|
+
return !suppressBetaWarning && isBetaVersion;
|
|
170
|
+
}
|
|
171
|
+
return false;
|
|
172
|
+
};
|