@thoughtspot/visual-embed-sdk 1.29.2 → 1.30.0
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/cjs/package.json +1 -1
- package/cjs/src/authToken.d.ts +1 -1
- package/cjs/src/authToken.js +1 -1
- package/cjs/src/embed/app.d.ts +1 -4
- 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/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/search.spec.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/types.d.ts +21 -54
- package/cjs/src/types.d.ts.map +1 -1
- package/cjs/src/types.js +20 -47
- package/cjs/src/types.js.map +1 -1
- package/cjs/src/utils/graphql/answerService/answerService.d.ts +2 -2
- package/cjs/src/utils/graphql/answerService/answerService.d.ts.map +1 -1
- package/cjs/src/utils/graphql/answerService/answerService.js +2 -2
- package/cjs/src/utils/graphql/answerService/answerService.js.map +1 -1
- package/cjs/src/utils/graphql/answerService/answerService.spec.js +43 -0
- package/cjs/src/utils/graphql/answerService/answerService.spec.js.map +1 -1
- package/cjs/src/utils/graphql/graphql-request.d.ts.map +1 -1
- package/cjs/src/utils/graphql/graphql-request.js +2 -1
- package/cjs/src/utils/graphql/graphql-request.js.map +1 -1
- package/dist/src/authToken.d.ts +1 -1
- package/dist/src/embed/app.d.ts +1 -4
- 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/search.d.ts +1 -5
- package/dist/src/embed/search.d.ts.map +1 -1
- package/dist/src/types.d.ts +21 -54
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/utils/graphql/answerService/answerService.d.ts +2 -2
- package/dist/src/utils/graphql/answerService/answerService.d.ts.map +1 -1
- package/dist/src/utils/graphql/graphql-request.d.ts.map +1 -1
- package/dist/tsembed-react.es.js +26 -53
- package/dist/tsembed-react.js +26 -53
- package/dist/tsembed.es.js +1563 -1590
- package/dist/tsembed.js +3139 -3166
- package/dist/visual-embed-sdk-react-full.d.ts +24 -64
- package/dist/visual-embed-sdk-react.d.ts +24 -64
- package/dist/visual-embed-sdk.d.ts +24 -64
- package/lib/package.json +1 -1
- package/lib/src/authToken.d.ts +1 -1
- package/lib/src/authToken.js +1 -1
- package/lib/src/embed/app.d.ts +1 -4
- 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/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/search.spec.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/types.d.ts +21 -54
- package/lib/src/types.d.ts.map +1 -1
- package/lib/src/types.js +20 -47
- package/lib/src/types.js.map +1 -1
- package/lib/src/utils/graphql/answerService/answerService.d.ts +2 -2
- package/lib/src/utils/graphql/answerService/answerService.d.ts.map +1 -1
- package/lib/src/utils/graphql/answerService/answerService.js +2 -2
- package/lib/src/utils/graphql/answerService/answerService.js.map +1 -1
- package/lib/src/utils/graphql/answerService/answerService.spec.js +44 -1
- package/lib/src/utils/graphql/answerService/answerService.spec.js.map +1 -1
- package/lib/src/utils/graphql/graphql-request.d.ts.map +1 -1
- package/lib/src/utils/graphql/graphql-request.js +2 -1
- package/lib/src/utils/graphql/graphql-request.js.map +1 -1
- package/lib/src/visual-embed-sdk.d.ts +27 -67
- package/package.json +1 -1
- package/src/authToken.ts +1 -1
- package/src/embed/app.ts +14 -16
- package/src/embed/base.ts +14 -15
- package/src/embed/search.spec.ts +1 -2
- package/src/embed/search.ts +15 -21
- package/src/embed/ts-embed.spec.ts +24 -37
- package/src/types.ts +26 -60
- package/src/utils/graphql/answerService/answerService.spec.ts +53 -1
- package/src/utils/graphql/answerService/answerService.ts +2 -2
- package/src/utils/graphql/graphql-request.ts +2 -1
|
@@ -1,45 +1,40 @@
|
|
|
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
|
-
Action,
|
|
19
|
-
HomeLeftNavItem,
|
|
20
|
-
RuntimeFilter,
|
|
21
|
-
RuntimeFilterOp,
|
|
22
|
-
HomepageModule,
|
|
23
|
-
HostEvent,
|
|
14
|
+
Action, HomeLeftNavItem, RuntimeFilter, RuntimeFilterOp, HomepageModule, HostEvent,
|
|
24
15
|
RuntimeParameter,
|
|
25
16
|
} from '../types';
|
|
26
17
|
import {
|
|
27
|
-
createRootEleForEmbed,
|
|
28
|
-
defaultParamsForPinboardEmbed,
|
|
29
18
|
executeAfterWait,
|
|
30
|
-
expectUrlMatchesWithParams,
|
|
31
19
|
getDocumentBody,
|
|
32
20
|
getIFrameEl,
|
|
33
21
|
getIFrameSrc,
|
|
34
22
|
getRootEl,
|
|
35
|
-
mockMessageChannel,
|
|
36
23
|
postMessageToParent,
|
|
24
|
+
defaultParamsForPinboardEmbed,
|
|
37
25
|
waitFor,
|
|
26
|
+
expectUrlMatchesWithParams,
|
|
27
|
+
mockMessageChannel,
|
|
28
|
+
createRootEleForEmbed,
|
|
38
29
|
} from '../test/test-utils';
|
|
30
|
+
import * as config from '../config';
|
|
31
|
+
import * as tsEmbedInstance from './ts-embed';
|
|
32
|
+
import * as mixpanelInstance from '../mixpanel-service';
|
|
33
|
+
import * as authInstance from '../auth';
|
|
34
|
+
import * as baseInstance from './base';
|
|
35
|
+
import { MIXPANEL_EVENT } from '../mixpanel-service';
|
|
39
36
|
import * as authService from '../utils/authService/authService';
|
|
40
37
|
import { logger } from '../utils/logger';
|
|
41
|
-
import * as baseInstance from './base';
|
|
42
|
-
import * as tsEmbedInstance from './ts-embed';
|
|
43
38
|
|
|
44
39
|
const defaultViewConfig = {
|
|
45
40
|
frameParams: {
|
|
@@ -471,10 +466,8 @@ describe('Unit test case for ts embed', () => {
|
|
|
471
466
|
hostConfig: undefined,
|
|
472
467
|
runtimeFilterParams: null,
|
|
473
468
|
runtimeParameterParams: null,
|
|
474
|
-
hiddenHomeLeftNavItems:
|
|
475
|
-
HomeLeftNavItem.Home,
|
|
476
|
-
HomeLeftNavItem.MonitorSubscription,
|
|
477
|
-
],
|
|
469
|
+
hiddenHomeLeftNavItems:
|
|
470
|
+
[HomeLeftNavItem.Home, HomeLeftNavItem.MonitorSubscription],
|
|
478
471
|
hiddenHomepageModules: [],
|
|
479
472
|
reorderedHomepageModules: [],
|
|
480
473
|
},
|
|
@@ -704,10 +697,7 @@ describe('Unit test case for ts embed', () => {
|
|
|
704
697
|
type: EmbedEvent.APP_INIT,
|
|
705
698
|
data: {},
|
|
706
699
|
};
|
|
707
|
-
const searchEmbed = new SearchEmbed(getRootEl(), {
|
|
708
|
-
...defaultViewConfig,
|
|
709
|
-
preRenderId: 'test',
|
|
710
|
-
});
|
|
700
|
+
const searchEmbed = new SearchEmbed(getRootEl(), { ...defaultViewConfig, preRenderId: 'test' });
|
|
711
701
|
searchEmbed.preRender();
|
|
712
702
|
const mockPort: any = {
|
|
713
703
|
postMessage: jest.fn(),
|
|
@@ -764,10 +754,7 @@ describe('Unit test case for ts embed', () => {
|
|
|
764
754
|
type: EmbedEvent.AuthExpire,
|
|
765
755
|
data: {},
|
|
766
756
|
};
|
|
767
|
-
const searchEmbed = new SearchEmbed(getRootEl(), {
|
|
768
|
-
...defaultViewConfig,
|
|
769
|
-
preRenderId: 'test',
|
|
770
|
-
});
|
|
757
|
+
const searchEmbed = new SearchEmbed(getRootEl(), { ...defaultViewConfig, preRenderId: 'test' });
|
|
771
758
|
jest.spyOn(baseInstance, 'notifyAuthFailure');
|
|
772
759
|
searchEmbed.preRender();
|
|
773
760
|
const mockPort: any = {
|
|
@@ -1271,7 +1258,7 @@ describe('Unit test case for ts embed', () => {
|
|
|
1271
1258
|
expectUrlMatchesWithParams(
|
|
1272
1259
|
getIFrameSrc(),
|
|
1273
1260
|
`http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&${defaultParamsForPinboardEmbed}`
|
|
1274
|
-
|
|
1261
|
+
+ `&foo=bar&baz=1&bool=true${defaultParamsPost}#/home`,
|
|
1275
1262
|
);
|
|
1276
1263
|
});
|
|
1277
1264
|
|
|
@@ -1287,7 +1274,7 @@ describe('Unit test case for ts embed', () => {
|
|
|
1287
1274
|
expectUrlMatchesWithParams(
|
|
1288
1275
|
getIFrameSrc(),
|
|
1289
1276
|
`http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&${defaultParamsForPinboardEmbed}`
|
|
1290
|
-
|
|
1277
|
+
+ `&showAlerts=true${defaultParamsPost}#/home`,
|
|
1291
1278
|
);
|
|
1292
1279
|
});
|
|
1293
1280
|
it('Sets the locale param', async () => {
|
|
@@ -1302,7 +1289,7 @@ describe('Unit test case for ts embed', () => {
|
|
|
1302
1289
|
expectUrlMatchesWithParams(
|
|
1303
1290
|
getIFrameSrc(),
|
|
1304
1291
|
`http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&${defaultParamsForPinboardEmbed}`
|
|
1305
|
-
|
|
1292
|
+
+ `&locale=ja-JP${defaultParamsPost}#/home`,
|
|
1306
1293
|
);
|
|
1307
1294
|
});
|
|
1308
1295
|
it('Sets the iconSprite url', async () => {
|
|
@@ -1319,7 +1306,7 @@ describe('Unit test case for ts embed', () => {
|
|
|
1319
1306
|
expectUrlMatchesWithParams(
|
|
1320
1307
|
getIFrameSrc(),
|
|
1321
1308
|
`http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&${defaultParamsForPinboardEmbed}`
|
|
1322
|
-
|
|
1309
|
+
+ `&iconSprite=iconSprite.com${defaultParamsPost}#/home`,
|
|
1323
1310
|
);
|
|
1324
1311
|
});
|
|
1325
1312
|
|
package/src/types.ts
CHANGED
|
@@ -136,7 +136,6 @@ export enum AuthType {
|
|
|
136
136
|
* .then((data) => data.token);
|
|
137
137
|
* }
|
|
138
138
|
* });
|
|
139
|
-
* });
|
|
140
139
|
* ```
|
|
141
140
|
*/
|
|
142
141
|
TrustedAuthToken = 'AuthServer',
|
|
@@ -468,7 +467,6 @@ export interface EmbedConfig {
|
|
|
468
467
|
* @version SDK: 1.12.0 | ThoughtSpot: 8.4.0.cl, 8.4.1.sw*
|
|
469
468
|
*/
|
|
470
469
|
suppressSearchEmbedBetaWarning?: boolean;
|
|
471
|
-
|
|
472
470
|
/**
|
|
473
471
|
* Hide `beta` alert warning message for SageEmbed.
|
|
474
472
|
*
|
|
@@ -529,7 +527,6 @@ export interface EmbedConfig {
|
|
|
529
527
|
/**
|
|
530
528
|
* Pendo API key to enable Pendo tracking to your own subscription, the key
|
|
531
529
|
* is added as an additional key to the embed, as per this link:https://support.pendo.io/hc/en-us/articles/360032201951-Send-data-to-multiple-subscriptions[document].
|
|
532
|
-
*
|
|
533
530
|
* @version SDK: 1.27.0 | ThoughtSpot: 9.8.0.cl
|
|
534
531
|
*/
|
|
535
532
|
pendoTrackingKey?: string;
|
|
@@ -884,8 +881,6 @@ export interface ViewConfig {
|
|
|
884
881
|
* Hide the home page modules
|
|
885
882
|
* For example: hiddenHomepageModules = [HomepageModule.MyLibrary]
|
|
886
883
|
*
|
|
887
|
-
*
|
|
888
|
-
*
|
|
889
884
|
* **Note**: This option does not apply to the classic homepage.
|
|
890
885
|
* To access the updated modular homepage, set
|
|
891
886
|
* `modularHomeExperience` to `true` (available as Early Access feature in 9.12.5.cl).
|
|
@@ -903,7 +898,6 @@ export interface ViewConfig {
|
|
|
903
898
|
* reordering the home page modules
|
|
904
899
|
* eg: reorderedHomepageModules = [HomepageModule.MyLibrary, HomepageModule.Watchlist]
|
|
905
900
|
*
|
|
906
|
-
*
|
|
907
901
|
* **Note**: This option does not apply to the classic homepage.
|
|
908
902
|
* To access the updated modular homepage, set
|
|
909
903
|
* `modularHomeExperience` to `true` (available as Early Access feature in 9.12.5.cl).
|
|
@@ -947,8 +941,6 @@ export interface ViewConfig {
|
|
|
947
941
|
* })
|
|
948
942
|
* ```
|
|
949
943
|
*
|
|
950
|
-
*
|
|
951
|
-
*
|
|
952
944
|
* **Note**: This option does not apply to the classic homepage.
|
|
953
945
|
* To access the updated modular homepage, set
|
|
954
946
|
* `modularHomeExperience` to `true` (available as Early Access feature in 9.12.5.cl).
|
|
@@ -1125,6 +1117,10 @@ export enum RuntimeFilterOp {
|
|
|
1125
1117
|
* Is included in this list of values
|
|
1126
1118
|
*/
|
|
1127
1119
|
IN = 'IN',
|
|
1120
|
+
/**
|
|
1121
|
+
* Is not included in this list of values
|
|
1122
|
+
*/
|
|
1123
|
+
NOT_IN = 'NOT_IN',
|
|
1128
1124
|
}
|
|
1129
1125
|
|
|
1130
1126
|
/**
|
|
@@ -1396,20 +1392,14 @@ export enum EmbedEvent {
|
|
|
1396
1392
|
/**
|
|
1397
1393
|
* An error has occurred. This event is fired for the following error types:
|
|
1398
1394
|
*
|
|
1399
|
-
* `API
|
|
1400
|
-
*
|
|
1401
|
-
* `
|
|
1402
|
-
*
|
|
1395
|
+
* `API` - API call failure error.
|
|
1396
|
+
* `FULLSCREEN` - Error when presenting a Liveboard or visualization in full screen
|
|
1397
|
+
* mode. `SINGLE_VALUE_FILTER` - Error due to multiple values in the single value
|
|
1398
|
+
* filter. `NON_EXIST_FILTER` - Error due to a non-existent filter.
|
|
1399
|
+
* `INVALID_DATE_VALUE` - Invalid date value error.
|
|
1400
|
+
* `INVALID_OPERATOR` - Use of invalid operator during filter application.
|
|
1403
1401
|
*
|
|
1404
|
-
*
|
|
1405
|
-
*
|
|
1406
|
-
* `NON_EXIST_FILTER`: Error due to a non-existent filter.
|
|
1407
|
-
*
|
|
1408
|
-
* `INVALID_DATE_VALUE`: Invalid date value error.
|
|
1409
|
-
*
|
|
1410
|
-
* `INVALID_OPERATOR`: Use of invalid operator during filter application.
|
|
1411
|
-
*
|
|
1412
|
-
* For more information, see https://developers.thoughtspot.com/docs/events-app-integration#errorType.
|
|
1402
|
+
* For more information, see https://developers.thoughtspot.com/docs/events-app-integration#errorType
|
|
1413
1403
|
* @returns error - An error object or message
|
|
1414
1404
|
* @version SDK: 1.1.0 | ThoughtSpot: ts7.may.cl, 8.4.1.sw
|
|
1415
1405
|
* @example
|
|
@@ -1509,7 +1499,7 @@ export enum EmbedEvent {
|
|
|
1509
1499
|
/**
|
|
1510
1500
|
* Emitted when the embed does not have cookie access. This happens
|
|
1511
1501
|
* when Safari and other Web browsers block third-party cookies
|
|
1512
|
-
* are blocked by default.
|
|
1502
|
+
* are blocked by default. `NoCookieAccess` can trigger
|
|
1513
1503
|
* @example
|
|
1514
1504
|
*```js
|
|
1515
1505
|
* appEmbed.on(EmbedEvent.NoCookieAccess)
|
|
@@ -1548,7 +1538,7 @@ export enum EmbedEvent {
|
|
|
1548
1538
|
/**
|
|
1549
1539
|
* Emitted when the Liveboard shell loads.
|
|
1550
1540
|
* You can use this event as a hook to trigger
|
|
1551
|
-
*
|
|
1541
|
+
* other events on the rendered Liveboard.
|
|
1552
1542
|
* @version SDK: 1.9.1 | ThoughtSpot: 8.1.0.cl, 8.4.1.sw
|
|
1553
1543
|
* @example
|
|
1554
1544
|
*```js
|
|
@@ -1599,7 +1589,7 @@ export enum EmbedEvent {
|
|
|
1599
1589
|
/**
|
|
1600
1590
|
* Emitted when the download action is triggered on an answer
|
|
1601
1591
|
*
|
|
1602
|
-
* **Note**:
|
|
1592
|
+
* **Note**: This event is deprecated in v1.21.0.
|
|
1603
1593
|
* To fire an event when a download action is initiated on a chart or table,
|
|
1604
1594
|
* use `EmbedEvent.DownloadAsPng`, `EmbedEvent.DownloadAsPDF`, `EmbedEvent.DownloadAsCSV`,
|
|
1605
1595
|
* or `EmbedEvent.DownloadAsXLSX`
|
|
@@ -1676,7 +1666,7 @@ export enum EmbedEvent {
|
|
|
1676
1666
|
* //emit when action starts
|
|
1677
1667
|
* appEmbed.on(EmbedEvent.AnswerDelete, payload => {
|
|
1678
1668
|
* console.log('delete answer', payload)}, {start: true })
|
|
1679
|
-
* //
|
|
1669
|
+
* //trigger when action is completed
|
|
1680
1670
|
* appEmbed.on(EmbedEvent.AnswerDelete, payload => {
|
|
1681
1671
|
* console.log('delete answer', payload)})
|
|
1682
1672
|
*```
|
|
@@ -1774,7 +1764,6 @@ export enum EmbedEvent {
|
|
|
1774
1764
|
/**
|
|
1775
1765
|
* Emitted when a user clicks the **Update TML** action on
|
|
1776
1766
|
* embedded Liveboard.
|
|
1777
|
-
*
|
|
1778
1767
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
|
|
1779
1768
|
* @example
|
|
1780
1769
|
*```js
|
|
@@ -1786,7 +1775,6 @@ export enum EmbedEvent {
|
|
|
1786
1775
|
/**
|
|
1787
1776
|
* Emitted when a user clicks the **Edit TML** action
|
|
1788
1777
|
* on an embedded Liveboard.
|
|
1789
|
-
*
|
|
1790
1778
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
|
|
1791
1779
|
* @example
|
|
1792
1780
|
*```js
|
|
@@ -1986,7 +1974,7 @@ export enum EmbedEvent {
|
|
|
1986
1974
|
* @version SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl, 9.5.0.sw
|
|
1987
1975
|
* @example
|
|
1988
1976
|
*```js
|
|
1989
|
-
* liveboardEmbed.
|
|
1977
|
+
* liveboardEmbed.trigger(HostEvent.CrossFilterChanged, {
|
|
1990
1978
|
* vizId: '730496d6-6903-4601-937e-2c691821af3c'})
|
|
1991
1979
|
*```
|
|
1992
1980
|
*/
|
|
@@ -2019,13 +2007,6 @@ export enum EmbedEvent {
|
|
|
2019
2007
|
* })
|
|
2020
2008
|
*
|
|
2021
2009
|
* @version SDK: 1.23.0 | ThoughtSpot: 9.4.0.cl, 9.5.0.sw
|
|
2022
|
-
* @example
|
|
2023
|
-
*
|
|
2024
|
-
*```js
|
|
2025
|
-
* LiveboardEmbed.on(EmbedEvent.FilterChanged, (payload) => {
|
|
2026
|
-
* console.log('payload', payload);
|
|
2027
|
-
* })
|
|
2028
|
-
*```
|
|
2029
2010
|
*/
|
|
2030
2011
|
FilterChanged = 'filterChanged',
|
|
2031
2012
|
/**
|
|
@@ -2119,12 +2100,12 @@ export enum EmbedEvent {
|
|
|
2119
2100
|
*```
|
|
2120
2101
|
* @version SDK : 1.29.0 | Thoughtspot : 10.1.0.cl
|
|
2121
2102
|
*/
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2103
|
+
OnBeforeGetVizDataIntercept = 'onBeforeGetVizDataIntercept',
|
|
2104
|
+
/**
|
|
2105
|
+
* Emitted when runtime parameters changes
|
|
2106
|
+
* @version SDK : 1.29.0 | Thoughtspot : 10.1.0.cl
|
|
2107
|
+
*/
|
|
2108
|
+
ParameterChanged = 'ParameterChanged'
|
|
2128
2109
|
}
|
|
2129
2110
|
|
|
2130
2111
|
/**
|
|
@@ -2265,8 +2246,8 @@ export enum HostEvent {
|
|
|
2265
2246
|
* _String_. The name of the column to filter on.
|
|
2266
2247
|
*
|
|
2267
2248
|
* `operator`
|
|
2268
|
-
*
|
|
2269
|
-
*
|
|
2249
|
+
* Runtime filter operator to apply. For information,
|
|
2250
|
+
* see link:https://developers.thoughtspot.com/docs/?pageid=runtime-filters#rtOperator[Developer Documentation].
|
|
2270
2251
|
*
|
|
2271
2252
|
* `values`
|
|
2272
2253
|
* List of operands. Some operators such as EQ, LE allow a single value, whereas
|
|
@@ -2396,20 +2377,16 @@ export enum HostEvent {
|
|
|
2396
2377
|
/**
|
|
2397
2378
|
* Trigger the **Export TML** action on an embedded Liveboard or
|
|
2398
2379
|
* Answer.
|
|
2399
|
-
*
|
|
2400
2380
|
* @example
|
|
2401
2381
|
* ```js
|
|
2402
2382
|
* liveboardEmbed.trigger(HostEvent.ExportTML)
|
|
2403
2383
|
* ```
|
|
2404
|
-
*
|
|
2405
2384
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
|
|
2406
2385
|
*/
|
|
2407
2386
|
ExportTML = 'exportTSL',
|
|
2408
2387
|
/**
|
|
2409
2388
|
* Trigger the **Edit TML** action on an embedded Liveboard or
|
|
2410
2389
|
* saved Answers in the full application embedding.
|
|
2411
|
-
*
|
|
2412
|
-
*
|
|
2413
2390
|
* @example
|
|
2414
2391
|
* ```js
|
|
2415
2392
|
* liveboardEmbed.trigger(HostEvent.EditTML)
|
|
@@ -2432,7 +2409,6 @@ export enum HostEvent {
|
|
|
2432
2409
|
*
|
|
2433
2410
|
* **NOTE**: The **Download** > **PDF** action is available on
|
|
2434
2411
|
* visualizations and Answers if the data is in tabular format.
|
|
2435
|
-
*
|
|
2436
2412
|
* @example
|
|
2437
2413
|
* ```js
|
|
2438
2414
|
* liveboardEmbed.trigger(HostEvent.DownloadAsPdf)
|
|
@@ -2504,15 +2480,12 @@ export enum HostEvent {
|
|
|
2504
2480
|
* on a Liveboard.
|
|
2505
2481
|
*
|
|
2506
2482
|
* This event is not supported in visualization embed and search embed.
|
|
2507
|
-
*
|
|
2508
2483
|
* @param - object - To trigger the action for a specific visualization
|
|
2509
2484
|
* in Liveboard embed, pass in `vizId` as a key.
|
|
2510
|
-
*
|
|
2511
2485
|
* @example
|
|
2512
2486
|
* ```js
|
|
2513
2487
|
* liveboardEmbed.trigger(HostEvent.Edit)
|
|
2514
2488
|
* ```
|
|
2515
|
-
* @example
|
|
2516
2489
|
* ```js
|
|
2517
2490
|
* liveboardEmbed.trigger(HostEvent.Edit, {vizId:
|
|
2518
2491
|
* '730496d6-6903-4601-937e-2c691821af3c'})
|
|
@@ -2775,7 +2748,6 @@ export enum HostEvent {
|
|
|
2775
2748
|
/**
|
|
2776
2749
|
* Get details of filters applied on the Liveboard.
|
|
2777
2750
|
* Returns arrays containing Liveboard filter and runtime filter elements.
|
|
2778
|
-
*
|
|
2779
2751
|
* @example
|
|
2780
2752
|
* ```js
|
|
2781
2753
|
* const data = await liveboardEmbed.trigger(HostEvent.GetFilters);
|
|
@@ -2802,7 +2774,6 @@ export enum HostEvent {
|
|
|
2802
2774
|
* `values` - An array of one or several values. The value definition on the
|
|
2803
2775
|
* data type you choose to filter on. For a complete list of supported data types,
|
|
2804
2776
|
* see link:https://developers.thoughtspot.com/docs/runtime-filters#_supported_data_types[Developer Documentation].
|
|
2805
|
-
*
|
|
2806
2777
|
* @example
|
|
2807
2778
|
* ```js
|
|
2808
2779
|
*
|
|
@@ -3127,7 +3098,6 @@ export enum Action {
|
|
|
3127
3098
|
* The **Save as View** action on the Answer
|
|
3128
3099
|
* page. Saves an Answer as a View object in the full
|
|
3129
3100
|
* application embedding mode.
|
|
3130
|
-
*
|
|
3131
3101
|
* @example
|
|
3132
3102
|
* ```js
|
|
3133
3103
|
* disabledActions: [Action.SaveAsView]
|
|
@@ -3331,13 +3301,10 @@ export enum Action {
|
|
|
3331
3301
|
DownloadAsPng = 'downloadAsPng',
|
|
3332
3302
|
/**
|
|
3333
3303
|
*
|
|
3334
|
-
*
|
|
3335
|
-
*
|
|
3304
|
+
*The **Download PDF** action that downloads a Liveboard,
|
|
3305
|
+
*visualization, or Answer as a PDF file.
|
|
3336
3306
|
*
|
|
3337
3307
|
*
|
|
3338
|
-
* **NOTE**: The **Download** > **PDF** action is available on
|
|
3339
|
-
* visualizations and Answers if the data is in tabular format.
|
|
3340
|
-
*
|
|
3341
3308
|
***NOTE**: The **Download** > **PDF** action is available on
|
|
3342
3309
|
*visualizations and Answers if the data is in tabular format.
|
|
3343
3310
|
* @example
|
|
@@ -3588,7 +3555,6 @@ export enum Action {
|
|
|
3588
3555
|
/**
|
|
3589
3556
|
* The **Delete** action for Answers in the full application
|
|
3590
3557
|
* embedding mode.
|
|
3591
|
-
*
|
|
3592
3558
|
* @example
|
|
3593
3559
|
* ```js
|
|
3594
3560
|
* disabledActions: [Action.AnswerDelete]
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import 'jest-fetch-mock';
|
|
2
2
|
import { AuthType, RuntimeFilterOp, VizPoint } from '../../../types';
|
|
3
3
|
import { AnswerService } from './answerService';
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
getAnswerData, removeColumns, addFilter, addColumns,
|
|
6
|
+
} from './answer-queries';
|
|
5
7
|
import * as authTokenInstance from '../../../authToken';
|
|
6
8
|
import * as tokenizedFetch from '../../../tokenizedFetch';
|
|
7
9
|
import * as embedConfigInstance from '../../../embed/embedConfig';
|
|
@@ -352,4 +354,54 @@ describe('Answer service tests', () => {
|
|
|
352
354
|
const answer = await answerService.getAnswer();
|
|
353
355
|
expect(answer.sources[0].header.guid).toBe('source1');
|
|
354
356
|
});
|
|
357
|
+
|
|
358
|
+
test('Add columns by name should call the right API', async () => {
|
|
359
|
+
fetchMock.mockResponses(
|
|
360
|
+
JSON.stringify({
|
|
361
|
+
data: {
|
|
362
|
+
getSourceDetailById: [{
|
|
363
|
+
columns: [{
|
|
364
|
+
id: 'id1',
|
|
365
|
+
name: 'col1',
|
|
366
|
+
}, {
|
|
367
|
+
id: 'id2',
|
|
368
|
+
name: 'col2',
|
|
369
|
+
}],
|
|
370
|
+
}],
|
|
371
|
+
},
|
|
372
|
+
}),
|
|
373
|
+
JSON.stringify({
|
|
374
|
+
data: {
|
|
375
|
+
Answer__addColumn: {
|
|
376
|
+
id: {
|
|
377
|
+
genNo: 2,
|
|
378
|
+
},
|
|
379
|
+
},
|
|
380
|
+
},
|
|
381
|
+
}),
|
|
382
|
+
);
|
|
383
|
+
const answerService = createAnswerService({
|
|
384
|
+
sources: [{
|
|
385
|
+
header: {
|
|
386
|
+
guid: 'source1',
|
|
387
|
+
},
|
|
388
|
+
}],
|
|
389
|
+
});
|
|
390
|
+
const session = await answerService.addColumnsByName(['col1']);
|
|
391
|
+
expect(fetchMock).toHaveBeenCalledWith(
|
|
392
|
+
'https://tshost/prism/?op=AddColumns',
|
|
393
|
+
expect.objectContaining({
|
|
394
|
+
body: JSON.stringify({
|
|
395
|
+
operationName: 'AddColumns',
|
|
396
|
+
query: addColumns,
|
|
397
|
+
variables: {
|
|
398
|
+
session: defaultSession,
|
|
399
|
+
columns: [{
|
|
400
|
+
logicalColumnId: 'id1',
|
|
401
|
+
}],
|
|
402
|
+
},
|
|
403
|
+
}),
|
|
404
|
+
}),
|
|
405
|
+
);
|
|
406
|
+
});
|
|
355
407
|
});
|
|
@@ -126,14 +126,14 @@ export class AnswerService {
|
|
|
126
126
|
* ```js
|
|
127
127
|
* embed.on(EmbedEvent.Data, async (e) => {
|
|
128
128
|
* const service = await embed.getAnswerService();
|
|
129
|
-
* await service.
|
|
129
|
+
* await service.addColumnsByName([
|
|
130
130
|
* "col name 1",
|
|
131
131
|
* "col name 2"
|
|
132
132
|
* ]);
|
|
133
133
|
* console.log(await service.fetchData());
|
|
134
134
|
* });
|
|
135
135
|
*/
|
|
136
|
-
public async
|
|
136
|
+
public async addColumnsByName(columnNames: string[]) {
|
|
137
137
|
const sourceDetail = await this.getSourceDetail();
|
|
138
138
|
const columnGuids = getGuidsFromColumnNames(sourceDetail, columnNames);
|
|
139
139
|
return this.addColumns([...columnGuids]);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { tokenizedFetch } from '../../tokenizedFetch';
|
|
1
2
|
import { getOperationNameFromQuery } from '../../utils';
|
|
2
3
|
|
|
3
4
|
/**
|
|
@@ -21,7 +22,7 @@ export async function graphqlQuery({
|
|
|
21
22
|
}) {
|
|
22
23
|
const operationName = getOperationNameFromQuery(query);
|
|
23
24
|
try {
|
|
24
|
-
const response = await
|
|
25
|
+
const response = await tokenizedFetch(`${thoughtSpotHost}/prism/?op=${operationName}`, {
|
|
25
26
|
method: 'POST',
|
|
26
27
|
headers: {
|
|
27
28
|
'content-type': 'application/json;charset=UTF-8',
|