@thoughtspot/visual-embed-sdk 1.27.8 → 1.28.0-alpha.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/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/embed/base.d.ts +1 -1
- package/cjs/src/embed/base.d.ts.map +1 -1
- package/cjs/src/embed/base.js +5 -5
- 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/sage.d.ts +5 -5
- package/cjs/src/embed/sage.d.ts.map +1 -1
- package/cjs/src/embed/sage.js +1 -16
- package/cjs/src/embed/sage.js.map +1 -1
- package/cjs/src/embed/sage.spec.js +11 -11
- package/cjs/src/embed/sage.spec.js.map +1 -1
- package/cjs/src/embed/search.d.ts +1 -5
- 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 +8 -14
- package/cjs/src/embed/ts-embed.spec.js.map +1 -1
- package/cjs/src/index.d.ts +4 -3
- package/cjs/src/index.d.ts.map +1 -1
- package/cjs/src/index.js +4 -1
- 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/all-types-export.d.ts +1 -1
- package/cjs/src/react/all-types-export.d.ts.map +1 -1
- package/cjs/src/react/all-types-export.js +2 -1
- package/cjs/src/react/all-types-export.js.map +1 -1
- package/cjs/src/react/index.spec.js +0 -12
- package/cjs/src/react/index.spec.js.map +1 -1
- package/cjs/src/types.d.ts +43 -13
- package/cjs/src/types.d.ts.map +1 -1
- package/cjs/src/types.js +37 -10
- package/cjs/src/types.js.map +1 -1
- package/cjs/src/utils/graphql/answerService/answerService.d.ts +56 -2
- package/cjs/src/utils/graphql/answerService/answerService.d.ts.map +1 -1
- package/cjs/src/utils/graphql/answerService/answerService.js +55 -0
- package/cjs/src/utils/graphql/answerService/answerService.js.map +1 -1
- package/dist/src/auth.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/sage.d.ts +5 -5
- package/dist/src/embed/sage.d.ts.map +1 -1
- package/dist/src/embed/search.d.ts +1 -5
- 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/index.d.ts +4 -3
- 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/all-types-export.d.ts +1 -1
- package/dist/src/react/all-types-export.d.ts.map +1 -1
- package/dist/src/types.d.ts +43 -13
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/utils/graphql/answerService/answerService.d.ts +56 -2
- package/dist/src/utils/graphql/answerService/answerService.d.ts.map +1 -1
- package/dist/tsembed-react.es.js +2800 -2732
- package/dist/tsembed-react.js +1525 -1457
- package/dist/tsembed.es.js +1768 -1700
- package/dist/tsembed.js +1674 -1604
- package/dist/visual-embed-sdk-react-full.d.ts +135 -24
- package/dist/visual-embed-sdk-react.d.ts +135 -24
- package/dist/visual-embed-sdk.d.ts +135 -24
- 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/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/sage.d.ts +5 -5
- package/lib/src/embed/sage.d.ts.map +1 -1
- package/lib/src/embed/sage.js +1 -16
- package/lib/src/embed/sage.js.map +1 -1
- package/lib/src/embed/sage.spec.js +11 -11
- package/lib/src/embed/sage.spec.js.map +1 -1
- package/lib/src/embed/search.d.ts +1 -5
- 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 +8 -14
- package/lib/src/embed/ts-embed.spec.js.map +1 -1
- package/lib/src/index.d.ts +4 -3
- package/lib/src/index.d.ts.map +1 -1
- package/lib/src/index.js +2 -3
- 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/all-types-export.d.ts +1 -1
- package/lib/src/react/all-types-export.d.ts.map +1 -1
- package/lib/src/react/all-types-export.js +1 -1
- package/lib/src/react/all-types-export.js.map +1 -1
- package/lib/src/react/index.spec.js +0 -12
- package/lib/src/react/index.spec.js.map +1 -1
- package/lib/src/types.d.ts +43 -13
- package/lib/src/types.d.ts.map +1 -1
- package/lib/src/types.js +37 -10
- 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/utils/graphql/answerService/answerService.d.ts +56 -2
- package/lib/src/utils/graphql/answerService/answerService.d.ts.map +1 -1
- package/lib/src/utils/graphql/answerService/answerService.js +55 -0
- package/lib/src/utils/graphql/answerService/answerService.js.map +1 -1
- package/lib/src/visual-embed-sdk.d.ts +144 -30
- package/package.json +1 -1
- package/src/auth.ts +6 -6
- package/src/embed/base.spec.ts +3 -3
- package/src/embed/base.ts +12 -12
- package/src/embed/sage.spec.ts +11 -11
- package/src/embed/sage.ts +4 -17
- package/src/embed/search.ts +6 -11
- package/src/embed/ts-embed.spec.ts +19 -25
- package/src/embed/ts-embed.ts +37 -34
- package/src/index.ts +10 -1
- package/src/mixpanel-service.ts +1 -0
- package/src/react/all-types-export.ts +1 -0
- package/src/react/index.spec.tsx +0 -29
- package/src/types.ts +53 -24
- package/src/utils/authService/authService.spec.ts +4 -4
- package/src/utils/graphql/answerService/answerService.ts +56 -1
package/src/embed/search.ts
CHANGED
|
@@ -7,20 +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';
|
|
12
10
|
import {
|
|
13
|
-
|
|
11
|
+
DataSourceVisualMode, DOMSelector, Param, Action, ViewConfig,
|
|
14
12
|
} from '../types';
|
|
15
13
|
import {
|
|
14
|
+
getQueryParamString,
|
|
16
15
|
checkReleaseVersionInBeta,
|
|
17
16
|
getFilterQuery,
|
|
18
|
-
getQueryParamString,
|
|
19
17
|
getRuntimeParameters,
|
|
20
18
|
} from '../utils';
|
|
19
|
+
import { TsEmbed } from './ts-embed';
|
|
20
|
+
import { ERROR_MESSAGE } from '../errors';
|
|
21
21
|
import { getAuthPromise } from './base';
|
|
22
|
+
import { getReleaseVersion } from '../auth';
|
|
22
23
|
import { getEmbedConfig } from './embedConfig';
|
|
23
|
-
import { TsEmbed } from './ts-embed';
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* Configuration for search options.
|
|
@@ -69,10 +69,6 @@ export interface SearchViewConfig
|
|
|
69
69
|
* using raw answer data.
|
|
70
70
|
*/
|
|
71
71
|
hideResults?: boolean;
|
|
72
|
-
/**
|
|
73
|
-
* If set to true, expands all the data sources panel.
|
|
74
|
-
*/
|
|
75
|
-
expandAllDataSource?: boolean;
|
|
76
72
|
/**
|
|
77
73
|
* If set to true, the Search Assist feature is enabled.
|
|
78
74
|
*
|
|
@@ -194,7 +190,6 @@ export class SearchEmbed extends TsEmbed {
|
|
|
194
190
|
protected getEmbedParams(): string {
|
|
195
191
|
const {
|
|
196
192
|
hideResults,
|
|
197
|
-
expandAllDataSource,
|
|
198
193
|
enableSearchAssist,
|
|
199
194
|
forceTable,
|
|
200
195
|
searchOptions,
|
|
@@ -297,7 +292,7 @@ export class SearchEmbed extends TsEmbed {
|
|
|
297
292
|
checkReleaseVersionInBeta(
|
|
298
293
|
getReleaseVersion(),
|
|
299
294
|
getEmbedConfig().suppressSearchEmbedBetaWarning
|
|
300
|
-
|
|
295
|
+
|| getEmbedConfig().suppressErrorAlerts,
|
|
301
296
|
)
|
|
302
297
|
) {
|
|
303
298
|
alert(ERROR_MESSAGE.SEARCHEMBED_BETA_WRANING_MESSAGE);
|
|
@@ -1,38 +1,38 @@
|
|
|
1
1
|
/* eslint-disable dot-notation */
|
|
2
|
-
import * as authInstance from '../auth';
|
|
3
2
|
import { resetCachedAuthToken } from '../authToken';
|
|
4
|
-
import * as config from '../config';
|
|
5
3
|
import {
|
|
6
|
-
AppEmbed,
|
|
7
4
|
AuthType,
|
|
5
|
+
init,
|
|
8
6
|
EmbedEvent,
|
|
9
|
-
LiveboardEmbed,
|
|
10
|
-
LiveboardViewConfig,
|
|
11
|
-
PinboardEmbed,
|
|
12
7
|
SearchEmbed,
|
|
13
|
-
|
|
8
|
+
PinboardEmbed,
|
|
9
|
+
LiveboardViewConfig,
|
|
10
|
+
AppEmbed,
|
|
11
|
+
LiveboardEmbed,
|
|
14
12
|
} from '../index';
|
|
15
|
-
import * as mixpanelInstance from '../mixpanel-service';
|
|
16
|
-
import { MIXPANEL_EVENT } from '../mixpanel-service';
|
|
17
13
|
import {
|
|
18
|
-
|
|
14
|
+
Action, HomeLeftNavItem, RuntimeFilter, RuntimeFilterOp, HomepageModule,
|
|
15
|
+
} from '../types';
|
|
16
|
+
import {
|
|
19
17
|
executeAfterWait,
|
|
20
|
-
expectUrlMatchesWithParams,
|
|
21
18
|
getDocumentBody,
|
|
22
19
|
getIFrameEl,
|
|
23
20
|
getIFrameSrc,
|
|
24
21
|
getRootEl,
|
|
25
|
-
mockMessageChannel,
|
|
26
22
|
postMessageToParent,
|
|
23
|
+
defaultParamsForPinboardEmbed,
|
|
27
24
|
waitFor,
|
|
25
|
+
expectUrlMatchesWithParams,
|
|
26
|
+
mockMessageChannel,
|
|
28
27
|
} from '../test/test-utils';
|
|
29
|
-
import
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
import * as config from '../config';
|
|
29
|
+
import * as tsEmbedInstance from './ts-embed';
|
|
30
|
+
import * as mixpanelInstance from '../mixpanel-service';
|
|
31
|
+
import * as authInstance from '../auth';
|
|
32
|
+
import * as baseInstance from './base';
|
|
33
|
+
import { MIXPANEL_EVENT } from '../mixpanel-service';
|
|
32
34
|
import * as authService from '../utils/authService/authService';
|
|
33
35
|
import { logger } from '../utils/logger';
|
|
34
|
-
import * as baseInstance from './base';
|
|
35
|
-
import * as tsEmbedInstance from './ts-embed';
|
|
36
36
|
|
|
37
37
|
const defaultViewConfig = {
|
|
38
38
|
frameParams: {
|
|
@@ -615,10 +615,7 @@ describe('Unit test case for ts embed', () => {
|
|
|
615
615
|
type: EmbedEvent.APP_INIT,
|
|
616
616
|
data: {},
|
|
617
617
|
};
|
|
618
|
-
const searchEmbed = new SearchEmbed(getRootEl(), {
|
|
619
|
-
...defaultViewConfig,
|
|
620
|
-
preRenderId: 'test',
|
|
621
|
-
});
|
|
618
|
+
const searchEmbed = new SearchEmbed(getRootEl(), { ...defaultViewConfig, preRenderId: 'test' });
|
|
622
619
|
searchEmbed.preRender();
|
|
623
620
|
const mockPort: any = {
|
|
624
621
|
postMessage: jest.fn(),
|
|
@@ -675,10 +672,7 @@ describe('Unit test case for ts embed', () => {
|
|
|
675
672
|
type: EmbedEvent.AuthExpire,
|
|
676
673
|
data: {},
|
|
677
674
|
};
|
|
678
|
-
const searchEmbed = new SearchEmbed(getRootEl(), {
|
|
679
|
-
...defaultViewConfig,
|
|
680
|
-
preRenderId: 'test',
|
|
681
|
-
});
|
|
675
|
+
const searchEmbed = new SearchEmbed(getRootEl(), { ...defaultViewConfig, preRenderId: 'test' });
|
|
682
676
|
jest.spyOn(baseInstance, 'notifyAuthFailure');
|
|
683
677
|
searchEmbed.preRender();
|
|
684
678
|
const mockPort: any = {
|
package/src/embed/ts-embed.ts
CHANGED
|
@@ -8,54 +8,57 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import isEqual from 'lodash/isEqual';
|
|
11
|
-
import
|
|
12
|
-
import { AuthFailureType } from '../auth';
|
|
11
|
+
import { logger } from '../utils/logger';
|
|
13
12
|
import { getAuthenticationToken } from '../authToken';
|
|
13
|
+
import { AnswerService } from '../utils/graphql/answerService/answerService';
|
|
14
|
+
import {
|
|
15
|
+
getEncodedQueryParamsString,
|
|
16
|
+
getCssDimension,
|
|
17
|
+
getOffsetTop,
|
|
18
|
+
embedEventStatus,
|
|
19
|
+
setAttributes,
|
|
20
|
+
getCustomisations,
|
|
21
|
+
getRuntimeFilters,
|
|
22
|
+
getDOMNode,
|
|
23
|
+
getFilterQuery,
|
|
24
|
+
getQueryParamString,
|
|
25
|
+
getRuntimeParameters,
|
|
26
|
+
setStyleProperties,
|
|
27
|
+
removeStyleProperties,
|
|
28
|
+
isUndefined,
|
|
29
|
+
} from '../utils';
|
|
14
30
|
import {
|
|
15
|
-
DEFAULT_EMBED_HEIGHT,
|
|
16
|
-
DEFAULT_EMBED_WIDTH,
|
|
17
|
-
URL_MAX_LENGTH,
|
|
18
31
|
getThoughtSpotHost,
|
|
32
|
+
URL_MAX_LENGTH,
|
|
33
|
+
DEFAULT_EMBED_WIDTH,
|
|
34
|
+
DEFAULT_EMBED_HEIGHT,
|
|
19
35
|
getV2BasePath,
|
|
20
36
|
} from '../config';
|
|
21
|
-
import { MIXPANEL_EVENT, uploadMixpanelEvent } from '../mixpanel-service';
|
|
22
37
|
import {
|
|
23
|
-
Action,
|
|
24
38
|
AuthType,
|
|
25
|
-
ContextMenuTriggerOptions,
|
|
26
39
|
DOMSelector,
|
|
27
|
-
EmbedConfig,
|
|
28
|
-
EmbedEvent,
|
|
29
40
|
HostEvent,
|
|
41
|
+
EmbedEvent,
|
|
30
42
|
MessageCallback,
|
|
31
|
-
|
|
32
|
-
MessageOptions,
|
|
43
|
+
Action,
|
|
33
44
|
Param,
|
|
45
|
+
EmbedConfig,
|
|
46
|
+
MessageOptions,
|
|
47
|
+
MessagePayload,
|
|
48
|
+
MessageCallbackObj,
|
|
34
49
|
ViewConfig,
|
|
50
|
+
FrameParams,
|
|
51
|
+
ContextMenuTriggerOptions,
|
|
52
|
+
RuntimeFilter,
|
|
35
53
|
} from '../types';
|
|
36
|
-
import {
|
|
37
|
-
|
|
38
|
-
getCssDimension,
|
|
39
|
-
getCustomisations,
|
|
40
|
-
getDOMNode,
|
|
41
|
-
getEncodedQueryParamsString,
|
|
42
|
-
getFilterQuery,
|
|
43
|
-
getOffsetTop,
|
|
44
|
-
getQueryParamString,
|
|
45
|
-
getRuntimeFilters,
|
|
46
|
-
getRuntimeParameters,
|
|
47
|
-
isUndefined,
|
|
48
|
-
removeStyleProperties,
|
|
49
|
-
setAttributes,
|
|
50
|
-
setStyleProperties,
|
|
51
|
-
} from '../utils';
|
|
52
|
-
import { AnswerService } from '../utils/graphql/answerService/answerService';
|
|
53
|
-
import { logger } from '../utils/logger';
|
|
54
|
-
import { processAuthFailure, processEventData } from '../utils/processData';
|
|
54
|
+
import { uploadMixpanelEvent, MIXPANEL_EVENT } from '../mixpanel-service';
|
|
55
|
+
import { processEventData, processAuthFailure } from '../utils/processData';
|
|
55
56
|
import { processTrigger } from '../utils/processTrigger';
|
|
57
|
+
import pkgInfo from '../../package.json';
|
|
56
58
|
import {
|
|
57
|
-
getAuthPromise, handleAuth, notifyAuthFailure,
|
|
59
|
+
getAuthPromise, renderInQueue, handleAuth, notifyAuthFailure,
|
|
58
60
|
} from './base';
|
|
61
|
+
import { AuthFailureType } from '../auth';
|
|
59
62
|
import { getEmbedConfig } from './embedConfig';
|
|
60
63
|
|
|
61
64
|
const { version } = pkgInfo;
|
|
@@ -517,7 +520,7 @@ export class TsEmbed {
|
|
|
517
520
|
: `?${queryString}`;
|
|
518
521
|
let host = this.thoughtSpotHost;
|
|
519
522
|
if (!isUndefined(this.embedConfig.enableReactShell)) {
|
|
520
|
-
host =
|
|
523
|
+
host = this.embedConfig.enableReactShell as boolean ? '/v2' : '/v1';
|
|
521
524
|
}
|
|
522
525
|
const path = `${host}/${queryParams}#`;
|
|
523
526
|
return path;
|
|
@@ -679,7 +682,7 @@ export class TsEmbed {
|
|
|
679
682
|
protected connectPreRendered(): boolean {
|
|
680
683
|
const preRenderIds = this.getPreRenderIds();
|
|
681
684
|
this.preRenderWrapper = this.preRenderWrapper
|
|
682
|
-
|
|
685
|
+
|| document.getElementById(preRenderIds.wrapper);
|
|
683
686
|
|
|
684
687
|
this.preRenderChild = this.preRenderChild || document.getElementById(preRenderIds.child);
|
|
685
688
|
|
package/src/index.ts
CHANGED
|
@@ -46,11 +46,14 @@ import {
|
|
|
46
46
|
ContextMenuTriggerOptions,
|
|
47
47
|
RuntimeParameter,
|
|
48
48
|
LogLevel,
|
|
49
|
+
VizPoint,
|
|
50
|
+
CustomActionPayload,
|
|
49
51
|
} from './types';
|
|
50
52
|
import { CustomCssVariables } from './css-variables';
|
|
51
53
|
import { SageEmbed, SageViewConfig } from './embed/sage';
|
|
52
|
-
import { AnswerService } from './utils/graphql/answerService/answerService';
|
|
54
|
+
import { AnswerService, SessionInterface, UnderlyingDataPoint } from './utils/graphql/answerService/answerService';
|
|
53
55
|
import { getEmbedConfig } from './embed/embedConfig';
|
|
56
|
+
import { uploadMixpanelEvent, MIXPANEL_EVENT } from './mixpanel-service';
|
|
54
57
|
|
|
55
58
|
export {
|
|
56
59
|
init,
|
|
@@ -74,6 +77,8 @@ export {
|
|
|
74
77
|
AuthEventEmitter,
|
|
75
78
|
AnswerService,
|
|
76
79
|
// types
|
|
80
|
+
SessionInterface,
|
|
81
|
+
UnderlyingDataPoint,
|
|
77
82
|
Page,
|
|
78
83
|
AuthType,
|
|
79
84
|
RuntimeFilter,
|
|
@@ -103,4 +108,8 @@ export {
|
|
|
103
108
|
CustomCssVariables,
|
|
104
109
|
RuntimeParameter,
|
|
105
110
|
LogLevel,
|
|
111
|
+
uploadMixpanelEvent,
|
|
112
|
+
MIXPANEL_EVENT,
|
|
113
|
+
VizPoint,
|
|
114
|
+
CustomActionPayload,
|
|
106
115
|
};
|
package/src/mixpanel-service.ts
CHANGED
|
@@ -18,6 +18,7 @@ export const MIXPANEL_EVENT = {
|
|
|
18
18
|
VISUAL_SDK_ON: 'visual-sdk-on',
|
|
19
19
|
VISUAL_SDK_IFRAME_LOAD_PERFORMANCE: 'visual-sdk-iframe-load-performance',
|
|
20
20
|
VISUAL_SDK_EMBED_CREATE: 'visual-sdk-embed-create',
|
|
21
|
+
VERCEL_INTEGRATION_COMPLETED: 'vercel-integration-completed',
|
|
21
22
|
};
|
|
22
23
|
|
|
23
24
|
let isMixpanelInitialized = false;
|
package/src/react/index.spec.tsx
CHANGED
|
@@ -199,35 +199,6 @@ describe('React Components', () => {
|
|
|
199
199
|
).toBe(true);
|
|
200
200
|
expect(containerSibling.querySelector('div')).toBe(null);
|
|
201
201
|
});
|
|
202
|
-
|
|
203
|
-
it('Should have the correct container element', async () => {
|
|
204
|
-
const { container } = render(
|
|
205
|
-
<LiveboardEmbed liveboardId="abcd" className="def" />,
|
|
206
|
-
);
|
|
207
|
-
|
|
208
|
-
await waitFor(() => getIFrameEl(container));
|
|
209
|
-
expect(container.querySelector('div')).not.toBe(null);
|
|
210
|
-
expect(
|
|
211
|
-
container.querySelector('div').classList.contains('def'),
|
|
212
|
-
).toBe(true);
|
|
213
|
-
|
|
214
|
-
const { container: containerSibling } = render(
|
|
215
|
-
<LiveboardEmbed
|
|
216
|
-
liveboardId="abcd"
|
|
217
|
-
className="def"
|
|
218
|
-
insertAsSibling={true}
|
|
219
|
-
/>,
|
|
220
|
-
);
|
|
221
|
-
await waitFor(() => getIFrameEl(containerSibling));
|
|
222
|
-
expect(containerSibling.querySelector('span')).not.toBe(null);
|
|
223
|
-
expect(containerSibling.querySelector('span').style.position).toBe(
|
|
224
|
-
'absolute',
|
|
225
|
-
);
|
|
226
|
-
expect(
|
|
227
|
-
getIFrameEl(containerSibling).classList.contains('def'),
|
|
228
|
-
).toBe(true);
|
|
229
|
-
expect(containerSibling.querySelector('div')).toBe(null);
|
|
230
|
-
});
|
|
231
202
|
});
|
|
232
203
|
|
|
233
204
|
describe('SearchBarEmbed', () => {
|
package/src/types.ts
CHANGED
|
@@ -145,6 +145,7 @@ export enum AuthType {
|
|
|
145
145
|
* .then((response) => response.json())
|
|
146
146
|
* .then((data) => data.token);
|
|
147
147
|
* }
|
|
148
|
+
* });
|
|
148
149
|
* ```
|
|
149
150
|
*/
|
|
150
151
|
TrustedAuthToken = 'AuthServer',
|
|
@@ -470,7 +471,6 @@ export interface EmbedConfig {
|
|
|
470
471
|
* @version SDK: 1.12.0 | ThoughtSpot: 8.4.0.cl, 8.4.1.sw*
|
|
471
472
|
*/
|
|
472
473
|
suppressSearchEmbedBetaWarning?: boolean;
|
|
473
|
-
|
|
474
474
|
/**
|
|
475
475
|
* Hide `beta` alert warning message for SageEmbed.
|
|
476
476
|
*
|
|
@@ -565,7 +565,7 @@ export interface EmbedConfig {
|
|
|
565
565
|
}
|
|
566
566
|
|
|
567
567
|
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
|
568
|
-
export interface LayoutConfig {}
|
|
568
|
+
export interface LayoutConfig { }
|
|
569
569
|
|
|
570
570
|
/**
|
|
571
571
|
* Embedded iframe configuration
|
|
@@ -767,14 +767,14 @@ export interface ViewConfig {
|
|
|
767
767
|
* Hide the home page modules
|
|
768
768
|
* eg: hiddenHomepageModules = [HomepageModule.MyLibrary]
|
|
769
769
|
*
|
|
770
|
-
* @version SDK: 1.27.0 | Thoughtspot: 9.
|
|
770
|
+
* @version SDK: 1.27.0 | Thoughtspot: 9.12.0.cl
|
|
771
771
|
*/
|
|
772
772
|
hiddenHomepageModules?: HomepageModule[];
|
|
773
773
|
/**
|
|
774
774
|
* reordering the home page modules
|
|
775
775
|
* eg: reorderedHomepageModules = [HomepageModule.MyLibrary, HomepageModule.Watchlist]
|
|
776
776
|
*
|
|
777
|
-
* @version SDK: 1.28.0 | Thoughtspot: 9.
|
|
777
|
+
* @version SDK: 1.28.0 | Thoughtspot: 9.12.0.cl
|
|
778
778
|
*/
|
|
779
779
|
reorderedHomepageModules?: HomepageModule[];
|
|
780
780
|
/**
|
|
@@ -801,7 +801,7 @@ export interface ViewConfig {
|
|
|
801
801
|
* hiddenHomeLeftNavItems = [HomeLeftNavItem.Home]
|
|
802
802
|
* ```
|
|
803
803
|
*
|
|
804
|
-
* @version SDK: 1.27.0 | Thoughtspot: 9.
|
|
804
|
+
* @version SDK: 1.27.0 | Thoughtspot: 9.12.0.cl
|
|
805
805
|
*/
|
|
806
806
|
hiddenHomeLeftNavItems?: HomeLeftNavItem[];
|
|
807
807
|
/**
|
|
@@ -1191,7 +1191,8 @@ export enum EmbedEvent {
|
|
|
1191
1191
|
* A custom action has been triggered.
|
|
1192
1192
|
*
|
|
1193
1193
|
* @returns actionId - ID of the custom action
|
|
1194
|
-
* @returns
|
|
1194
|
+
* @returns payload {@link CustomActionPayload} - Response payload with the
|
|
1195
|
+
* Answer or Liveboard data
|
|
1195
1196
|
* @example
|
|
1196
1197
|
* ```js
|
|
1197
1198
|
* appEmbed.on(EmbedEvent.customAction, payload => {
|
|
@@ -1211,7 +1212,7 @@ export enum EmbedEvent {
|
|
|
1211
1212
|
* @example
|
|
1212
1213
|
* ```js
|
|
1213
1214
|
* livebaordEmbed.on(EmbedEvent.VizPointDoubleClick, payload => {
|
|
1214
|
-
* console.log('VizPointDoubleClick', payload)
|
|
1215
|
+
* console.log('VizPointDoubleClick', payload);
|
|
1215
1216
|
* })
|
|
1216
1217
|
* ```
|
|
1217
1218
|
*/
|
|
@@ -1237,15 +1238,40 @@ export enum EmbedEvent {
|
|
|
1237
1238
|
*/
|
|
1238
1239
|
VizPointClick = 'vizPointClick',
|
|
1239
1240
|
/**
|
|
1240
|
-
* An error has occurred.
|
|
1241
|
+
* An error has occurred. This event is fired for the following error types:
|
|
1242
|
+
*
|
|
1243
|
+
* `API` - API call failure error.
|
|
1244
|
+
*
|
|
1245
|
+
* `FULLSCREEN` - Error when presenting a Liveboard or visualization in full screen mode.
|
|
1246
|
+
*
|
|
1247
|
+
* `SINGLE_VALUE_FILTER` - Error due to multiple values in the single value filter.
|
|
1248
|
+
*
|
|
1249
|
+
* `NON_EXIST_FILTER` - Error due to a non-existent filter.
|
|
1241
1250
|
*
|
|
1251
|
+
* `INVALID_DATE_VALUE` - Invalid date value error.
|
|
1252
|
+
*
|
|
1253
|
+
* `INVALID_OPERATOR` - Use of invalid operator during filter application.
|
|
1254
|
+
*
|
|
1255
|
+
* For more information, see [Developer Documentation](https://developers.thoughtspot.com/docs/events-app-integration#errorType)
|
|
1242
1256
|
* @returns error - An error object or message
|
|
1243
1257
|
* @example
|
|
1244
1258
|
* ```js
|
|
1245
|
-
*
|
|
1246
|
-
*
|
|
1247
|
-
*
|
|
1248
|
-
*
|
|
1259
|
+
* // API error
|
|
1260
|
+
* SearchEmbed.on(EmbedEvent.Error, (error) => {
|
|
1261
|
+
* console.log(error);
|
|
1262
|
+
* // { type: "Error", data: { errorType: "API", error: { message: '...', error: '...' } } }
|
|
1263
|
+
* });
|
|
1264
|
+
* ```
|
|
1265
|
+
* @example
|
|
1266
|
+
* ```js
|
|
1267
|
+
* // Fullscreen error (Errors during presenting of a liveboard)
|
|
1268
|
+
* LiveboardEmbed.on(EmbedEvent.Error, (error) => {
|
|
1269
|
+
* console.log(error);
|
|
1270
|
+
* // { type: "Error", data: { errorType: "FULLSCREEN", error: {
|
|
1271
|
+
* // message: "Fullscreen API is not enabled",
|
|
1272
|
+
* // stack: "..."
|
|
1273
|
+
* // } }}
|
|
1274
|
+
* })
|
|
1249
1275
|
* ```
|
|
1250
1276
|
*/
|
|
1251
1277
|
Error = 'Error',
|
|
@@ -1955,7 +1981,7 @@ export enum EmbedEvent {
|
|
|
1955
1981
|
/**
|
|
1956
1982
|
* Emitted when a LB/viz is renamed
|
|
1957
1983
|
*
|
|
1958
|
-
* @version SDK : 1.28.0 | ThoughtSpot: 9.
|
|
1984
|
+
* @version SDK : 1.28.0 | ThoughtSpot: 9.10.5.cl
|
|
1959
1985
|
*/
|
|
1960
1986
|
Rename = 'rename',
|
|
1961
1987
|
}
|
|
@@ -2630,7 +2656,7 @@ export enum HostEvent {
|
|
|
2630
2656
|
*/
|
|
2631
2657
|
ResetSearch = 'resetSearch',
|
|
2632
2658
|
/**
|
|
2633
|
-
*
|
|
2659
|
+
*
|
|
2634
2660
|
* Get the currents visible and runtime filters applied on a Liveboard
|
|
2635
2661
|
* @example
|
|
2636
2662
|
* liveboardEmbed.trigger(HostEvent.GetFilters)
|
|
@@ -2638,7 +2664,7 @@ export enum HostEvent {
|
|
|
2638
2664
|
*/
|
|
2639
2665
|
GetFilters = 'getFilters',
|
|
2640
2666
|
/**
|
|
2641
|
-
*
|
|
2667
|
+
*
|
|
2642
2668
|
* Update the visible filters on the Liveboard.
|
|
2643
2669
|
* @param - filter: filter object containing column name and filter operation and values
|
|
2644
2670
|
* @example
|
|
@@ -3736,15 +3762,15 @@ export interface ColumnValue {
|
|
|
3736
3762
|
[key: string]: any;
|
|
3737
3763
|
};
|
|
3738
3764
|
value:
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3765
|
+
| string
|
|
3766
|
+
| number
|
|
3767
|
+
| boolean
|
|
3768
|
+
| {
|
|
3769
|
+
v: {
|
|
3770
|
+
s: number;
|
|
3771
|
+
e: number;
|
|
3772
|
+
};
|
|
3773
|
+
};
|
|
3748
3774
|
}
|
|
3749
3775
|
|
|
3750
3776
|
export interface VizPoint {
|
|
@@ -3752,6 +3778,9 @@ export interface VizPoint {
|
|
|
3752
3778
|
selectedMeasures: ColumnValue[];
|
|
3753
3779
|
}
|
|
3754
3780
|
|
|
3781
|
+
/**
|
|
3782
|
+
* @group Events
|
|
3783
|
+
*/
|
|
3755
3784
|
export interface CustomActionPayload {
|
|
3756
3785
|
contextMenuPoints?: {
|
|
3757
3786
|
clickedPoint: VizPoint;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
fetchAuthPostService,
|
|
4
|
-
fetchAuthService,
|
|
2
|
+
fetchSessionInfoService,
|
|
5
3
|
fetchAuthTokenService,
|
|
4
|
+
fetchAuthService,
|
|
6
5
|
fetchBasicAuthService,
|
|
7
|
-
|
|
6
|
+
fetchAuthPostService,
|
|
8
7
|
verifyTokenService,
|
|
8
|
+
EndPoints,
|
|
9
9
|
} from '.';
|
|
10
10
|
import { logger } from '../logger';
|
|
11
11
|
|
|
@@ -17,7 +17,7 @@ export enum OperationType {
|
|
|
17
17
|
GetTableWithHeadlineData = 'GetTableWithHeadlineData',
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
interface UnderlyingDataPoint {
|
|
20
|
+
export interface UnderlyingDataPoint {
|
|
21
21
|
columnId: string;
|
|
22
22
|
dataValue: any;
|
|
23
23
|
}
|
|
@@ -41,6 +41,14 @@ interface UnderlyingDataPoint {
|
|
|
41
41
|
* @group Events
|
|
42
42
|
*/
|
|
43
43
|
export class AnswerService {
|
|
44
|
+
/**
|
|
45
|
+
* Should not need to be called directly.
|
|
46
|
+
*
|
|
47
|
+
* @param session
|
|
48
|
+
* @param answer
|
|
49
|
+
* @param thoughtSpotHost
|
|
50
|
+
* @param selectedPoints
|
|
51
|
+
*/
|
|
44
52
|
constructor(
|
|
45
53
|
private session: SessionInterface,
|
|
46
54
|
private answer: any,
|
|
@@ -50,6 +58,10 @@ export class AnswerService {
|
|
|
50
58
|
this.session = removeTypename(session);
|
|
51
59
|
}
|
|
52
60
|
|
|
61
|
+
/**
|
|
62
|
+
* Get the details about the source used in the answer.
|
|
63
|
+
* This can be used to get the list of all columns in the data source for example.
|
|
64
|
+
*/
|
|
53
65
|
public async getSourceDetail() {
|
|
54
66
|
const sourceId = this.answer.sources[0].header.guid;
|
|
55
67
|
return getSourceDetail(
|
|
@@ -58,6 +70,12 @@ export class AnswerService {
|
|
|
58
70
|
);
|
|
59
71
|
}
|
|
60
72
|
|
|
73
|
+
/**
|
|
74
|
+
* Remove columnIds and return updated answer session.
|
|
75
|
+
*
|
|
76
|
+
* @param columnIds
|
|
77
|
+
* @returns
|
|
78
|
+
*/
|
|
61
79
|
public async removeColumns(columnIds: string[]) {
|
|
62
80
|
return this.executeQuery(
|
|
63
81
|
queries.removeColumns,
|
|
@@ -67,6 +85,12 @@ export class AnswerService {
|
|
|
67
85
|
);
|
|
68
86
|
}
|
|
69
87
|
|
|
88
|
+
/**
|
|
89
|
+
* Add columnIds and return updated answer session.
|
|
90
|
+
*
|
|
91
|
+
* @param columnIds
|
|
92
|
+
* @returns
|
|
93
|
+
*/
|
|
70
94
|
public async addColumns(columnIds: string[]) {
|
|
71
95
|
return this.executeQuery(
|
|
72
96
|
queries.addColumns,
|
|
@@ -76,6 +100,13 @@ export class AnswerService {
|
|
|
76
100
|
);
|
|
77
101
|
}
|
|
78
102
|
|
|
103
|
+
/**
|
|
104
|
+
* Fetch data from the answer.
|
|
105
|
+
*
|
|
106
|
+
* @param offset
|
|
107
|
+
* @param size
|
|
108
|
+
* @returns
|
|
109
|
+
*/
|
|
79
110
|
public async fetchData(offset = 0, size = 1000) {
|
|
80
111
|
const { answer } = await this.executeQuery(
|
|
81
112
|
queries.getAnswerData,
|
|
@@ -98,6 +129,8 @@ export class AnswerService {
|
|
|
98
129
|
}
|
|
99
130
|
|
|
100
131
|
/**
|
|
132
|
+
* Fetch the data for the answer as a CSV blob. This might be
|
|
133
|
+
* quicker for larger data.
|
|
101
134
|
*
|
|
102
135
|
* @param userLocale
|
|
103
136
|
* @param includeInfo Include the CSV header in the output
|
|
@@ -110,12 +143,22 @@ export class AnswerService {
|
|
|
110
143
|
});
|
|
111
144
|
}
|
|
112
145
|
|
|
146
|
+
/**
|
|
147
|
+
* Just get the internal URL for this answer's data
|
|
148
|
+
* as a CSV blob.
|
|
149
|
+
*
|
|
150
|
+
* @param userLocale
|
|
151
|
+
* @param includeInfo
|
|
152
|
+
* @returns
|
|
153
|
+
*/
|
|
113
154
|
public getFetchCSVBlobUrl(userLocale = 'en-us', includeInfo = false): string {
|
|
114
155
|
return `${this.thoughtSpotHost}/prism/download/answer/csv?sessionId=${this.session.sessionId}&genNo=${this.session.genNo}&userLocale=${userLocale}&exportFileName=data&hideCsvHeader=${!includeInfo}`;
|
|
115
156
|
}
|
|
116
157
|
|
|
117
158
|
/**
|
|
118
159
|
* Get underlying data given a point and the output column names.
|
|
160
|
+
* In case of a context menu action, the selectedPoints are
|
|
161
|
+
* automatically passed.
|
|
119
162
|
*
|
|
120
163
|
* @param outputColumnNames
|
|
121
164
|
* @param selectedPoints
|
|
@@ -179,6 +222,13 @@ export class AnswerService {
|
|
|
179
222
|
return unaggAnswerSession;
|
|
180
223
|
}
|
|
181
224
|
|
|
225
|
+
/**
|
|
226
|
+
* Execute a custom graphql query in the context of the answer.
|
|
227
|
+
*
|
|
228
|
+
* @param query graphql query
|
|
229
|
+
* @param variables graphql variables
|
|
230
|
+
* @returns
|
|
231
|
+
*/
|
|
182
232
|
public async executeQuery(query: string, variables: any): Promise<any> {
|
|
183
233
|
const data = await graphqlQuery({
|
|
184
234
|
query,
|
|
@@ -194,6 +244,11 @@ export class AnswerService {
|
|
|
194
244
|
return data;
|
|
195
245
|
}
|
|
196
246
|
|
|
247
|
+
/**
|
|
248
|
+
* Get the internal session details for the answer.
|
|
249
|
+
*
|
|
250
|
+
* @returns
|
|
251
|
+
*/
|
|
197
252
|
public getSession() {
|
|
198
253
|
return this.session;
|
|
199
254
|
}
|