@thoughtspot/visual-embed-sdk 1.29.0-alpha.7 → 1.29.0-alpha.SCAL-205893-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/package.json +1 -1
- package/cjs/src/auth.d.ts +14 -17
- package/cjs/src/auth.d.ts.map +1 -1
- package/cjs/src/auth.js +45 -59
- package/cjs/src/auth.js.map +1 -1
- package/cjs/src/auth.spec.d.ts +12 -0
- package/cjs/src/auth.spec.d.ts.map +1 -1
- package/cjs/src/auth.spec.js +89 -67
- package/cjs/src/auth.spec.js.map +1 -1
- package/cjs/src/authToken.d.ts +1 -1
- package/cjs/src/authToken.d.ts.map +1 -1
- package/cjs/src/authToken.js +18 -5
- package/cjs/src/authToken.js.map +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.spec.js +4 -2
- package/cjs/src/embed/app.spec.js.map +1 -1
- package/cjs/src/embed/base.d.ts.map +1 -1
- package/cjs/src/embed/base.js +2 -0
- package/cjs/src/embed/base.js.map +1 -1
- package/cjs/src/embed/base.spec.js +1 -0
- package/cjs/src/embed/base.spec.js.map +1 -1
- package/cjs/src/embed/embed.spec.js +3 -0
- package/cjs/src/embed/embed.spec.js.map +1 -1
- package/cjs/src/embed/events.spec.js +3 -0
- package/cjs/src/embed/events.spec.js.map +1 -1
- package/cjs/src/embed/liveboard.spec.js +2 -0
- package/cjs/src/embed/liveboard.spec.js.map +1 -1
- package/cjs/src/embed/pinboard.spec.js +3 -0
- package/cjs/src/embed/pinboard.spec.js.map +1 -1
- package/cjs/src/embed/sage.spec.js +3 -0
- package/cjs/src/embed/sage.spec.js.map +1 -1
- package/cjs/src/embed/search.spec.js +1 -0
- package/cjs/src/embed/search.spec.js.map +1 -1
- package/cjs/src/embed/ts-embed-trigger.spec.js +3 -0
- package/cjs/src/embed/ts-embed-trigger.spec.js.map +1 -1
- package/cjs/src/embed/ts-embed.d.ts.map +1 -1
- package/cjs/src/embed/ts-embed.js +7 -0
- package/cjs/src/embed/ts-embed.js.map +1 -1
- package/cjs/src/embed/ts-embed.spec.js +7 -0
- package/cjs/src/embed/ts-embed.spec.js.map +1 -1
- package/cjs/src/index.d.ts +2 -1
- package/cjs/src/index.d.ts.map +1 -1
- package/cjs/src/index.js +2 -1
- package/cjs/src/index.js.map +1 -1
- package/cjs/src/mixpanel-service.d.ts +2 -1
- 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/mixpanel-service.spec.js +7 -0
- package/cjs/src/mixpanel-service.spec.js.map +1 -1
- package/cjs/src/react/index.d.ts +1 -1
- package/cjs/src/react/index.d.ts.map +1 -1
- package/cjs/src/react/index.js +2 -1
- package/cjs/src/react/index.js.map +1 -1
- package/cjs/src/react/index.spec.js +6 -0
- package/cjs/src/react/index.spec.js.map +1 -1
- package/cjs/src/types.d.ts +79 -47
- package/cjs/src/types.d.ts.map +1 -1
- package/cjs/src/types.js +61 -46
- package/cjs/src/types.js.map +1 -1
- package/cjs/src/utils/authService/authService.d.ts +1 -0
- package/cjs/src/utils/authService/authService.d.ts.map +1 -1
- package/cjs/src/utils/authService/authService.js +1 -0
- package/cjs/src/utils/authService/authService.js.map +1 -1
- package/cjs/src/utils/authService/authService.spec.js +18 -5
- package/cjs/src/utils/authService/authService.spec.js.map +1 -1
- package/cjs/src/utils/authService/tokenizedAuthService.d.ts +15 -2
- package/cjs/src/utils/authService/tokenizedAuthService.d.ts.map +1 -1
- package/cjs/src/utils/authService/tokenizedAuthService.js +39 -9
- package/cjs/src/utils/authService/tokenizedAuthService.js.map +1 -1
- package/cjs/src/utils/authService/tokenizedAuthService.spec.d.ts +2 -0
- package/cjs/src/utils/authService/tokenizedAuthService.spec.d.ts.map +1 -0
- package/cjs/src/utils/authService/tokenizedAuthService.spec.js +32 -0
- package/cjs/src/utils/authService/tokenizedAuthService.spec.js.map +1 -0
- package/cjs/src/utils/graphql/answerService/answerService.d.ts +10 -0
- package/cjs/src/utils/graphql/answerService/answerService.d.ts.map +1 -1
- package/cjs/src/utils/graphql/answerService/answerService.js +10 -0
- package/cjs/src/utils/graphql/answerService/answerService.js.map +1 -1
- package/cjs/src/utils/processData.js +2 -2
- package/cjs/src/utils/processData.js.map +1 -1
- package/cjs/src/utils/processData.spec.js +3 -2
- package/cjs/src/utils/processData.spec.js.map +1 -1
- package/cjs/src/utils/sessionInfoService.d.ts +66 -0
- package/cjs/src/utils/sessionInfoService.d.ts.map +1 -0
- package/cjs/src/utils/sessionInfoService.js +92 -0
- package/cjs/src/utils/sessionInfoService.js.map +1 -0
- package/cjs/src/utils.d.ts +1 -1
- package/cjs/src/utils.d.ts.map +1 -1
- package/cjs/src/utils.js +4 -1
- package/cjs/src/utils.js.map +1 -1
- package/dist/src/auth.d.ts +14 -17
- package/dist/src/auth.d.ts.map +1 -1
- package/dist/src/auth.spec.d.ts +12 -0
- package/dist/src/auth.spec.d.ts.map +1 -1
- package/dist/src/authToken.d.ts +1 -1
- package/dist/src/authToken.d.ts.map +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/base.d.ts.map +1 -1
- package/dist/src/embed/ts-embed.d.ts.map +1 -1
- package/dist/src/index.d.ts +2 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/mixpanel-service.d.ts +2 -1
- package/dist/src/mixpanel-service.d.ts.map +1 -1
- package/dist/src/react/index.d.ts +1 -1
- package/dist/src/react/index.d.ts.map +1 -1
- package/dist/src/types.d.ts +79 -47
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/utils/authService/authService.d.ts +1 -0
- package/dist/src/utils/authService/authService.d.ts.map +1 -1
- package/dist/src/utils/authService/tokenizedAuthService.d.ts +15 -2
- package/dist/src/utils/authService/tokenizedAuthService.d.ts.map +1 -1
- package/dist/src/utils/authService/tokenizedAuthService.spec.d.ts +2 -0
- package/dist/src/utils/authService/tokenizedAuthService.spec.d.ts.map +1 -0
- package/dist/src/utils/graphql/answerService/answerService.d.ts +10 -0
- package/dist/src/utils/graphql/answerService/answerService.d.ts.map +1 -1
- package/dist/src/utils/sessionInfoService.d.ts +66 -0
- package/dist/src/utils/sessionInfoService.d.ts.map +1 -0
- package/dist/src/utils.d.ts +1 -1
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/tsembed-react.es.js +225 -105
- package/dist/tsembed-react.js +225 -104
- package/dist/tsembed.es.js +233 -116
- package/dist/tsembed.js +233 -116
- package/dist/visual-embed-sdk-react-full.d.ts +171 -66
- package/dist/visual-embed-sdk-react.d.ts +171 -66
- package/dist/visual-embed-sdk.d.ts +171 -66
- package/lib/package.json +1 -1
- package/lib/src/auth.d.ts +14 -17
- package/lib/src/auth.d.ts.map +1 -1
- package/lib/src/auth.js +44 -56
- package/lib/src/auth.js.map +1 -1
- package/lib/src/auth.spec.d.ts +12 -0
- package/lib/src/auth.spec.d.ts.map +1 -1
- package/lib/src/auth.spec.js +88 -66
- package/lib/src/auth.spec.js.map +1 -1
- package/lib/src/authToken.d.ts +1 -1
- package/lib/src/authToken.d.ts.map +1 -1
- package/lib/src/authToken.js +18 -5
- package/lib/src/authToken.js.map +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.spec.js +4 -2
- package/lib/src/embed/app.spec.js.map +1 -1
- package/lib/src/embed/base.d.ts.map +1 -1
- package/lib/src/embed/base.js +3 -1
- package/lib/src/embed/base.js.map +1 -1
- package/lib/src/embed/base.spec.js +1 -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 +2 -0
- package/lib/src/embed/events.spec.js.map +1 -1
- package/lib/src/embed/liveboard.spec.js +2 -0
- package/lib/src/embed/liveboard.spec.js.map +1 -1
- package/lib/src/embed/pinboard.spec.js +2 -0
- package/lib/src/embed/pinboard.spec.js.map +1 -1
- package/lib/src/embed/sage.spec.js +2 -0
- package/lib/src/embed/sage.spec.js.map +1 -1
- package/lib/src/embed/search.spec.js +1 -0
- package/lib/src/embed/search.spec.js.map +1 -1
- package/lib/src/embed/ts-embed-trigger.spec.js +2 -0
- package/lib/src/embed/ts-embed-trigger.spec.js.map +1 -1
- package/lib/src/embed/ts-embed.d.ts.map +1 -1
- package/lib/src/embed/ts-embed.js +7 -0
- package/lib/src/embed/ts-embed.js.map +1 -1
- package/lib/src/embed/ts-embed.spec.js +7 -0
- package/lib/src/embed/ts-embed.spec.js.map +1 -1
- package/lib/src/index.d.ts +2 -1
- package/lib/src/index.d.ts.map +1 -1
- package/lib/src/index.js +2 -1
- package/lib/src/index.js.map +1 -1
- package/lib/src/mixpanel-service.d.ts +2 -1
- 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/mixpanel-service.spec.js +7 -0
- package/lib/src/mixpanel-service.spec.js.map +1 -1
- package/lib/src/react/index.d.ts +1 -1
- package/lib/src/react/index.d.ts.map +1 -1
- package/lib/src/react/index.js +1 -1
- package/lib/src/react/index.js.map +1 -1
- package/lib/src/react/index.spec.js +6 -0
- package/lib/src/react/index.spec.js.map +1 -1
- package/lib/src/types.d.ts +79 -47
- package/lib/src/types.d.ts.map +1 -1
- package/lib/src/types.js +61 -46
- package/lib/src/types.js.map +1 -1
- package/lib/src/utils/authService/authService.d.ts +1 -0
- package/lib/src/utils/authService/authService.d.ts.map +1 -1
- package/lib/src/utils/authService/authService.js +1 -0
- package/lib/src/utils/authService/authService.js.map +1 -1
- package/lib/src/utils/authService/authService.spec.js +18 -5
- package/lib/src/utils/authService/authService.spec.js.map +1 -1
- package/lib/src/utils/authService/tokenizedAuthService.d.ts +15 -2
- package/lib/src/utils/authService/tokenizedAuthService.d.ts.map +1 -1
- package/lib/src/utils/authService/tokenizedAuthService.js +37 -8
- package/lib/src/utils/authService/tokenizedAuthService.js.map +1 -1
- package/lib/src/utils/authService/tokenizedAuthService.spec.d.ts +2 -0
- package/lib/src/utils/authService/tokenizedAuthService.spec.d.ts.map +1 -0
- package/lib/src/utils/authService/tokenizedAuthService.spec.js +29 -0
- package/lib/src/utils/authService/tokenizedAuthService.spec.js.map +1 -0
- package/lib/src/utils/graphql/answerService/answerService.d.ts +10 -0
- package/lib/src/utils/graphql/answerService/answerService.d.ts.map +1 -1
- package/lib/src/utils/graphql/answerService/answerService.js +10 -0
- package/lib/src/utils/graphql/answerService/answerService.js.map +1 -1
- package/lib/src/utils/processData.js +3 -3
- package/lib/src/utils/processData.js.map +1 -1
- package/lib/src/utils/processData.spec.js +3 -2
- package/lib/src/utils/processData.spec.js.map +1 -1
- package/lib/src/utils/sessionInfoService.d.ts +66 -0
- package/lib/src/utils/sessionInfoService.d.ts.map +1 -0
- package/lib/src/utils/sessionInfoService.js +85 -0
- package/lib/src/utils/sessionInfoService.js.map +1 -0
- package/lib/src/utils.d.ts +1 -1
- package/lib/src/utils.d.ts.map +1 -1
- package/lib/src/utils.js +4 -1
- package/lib/src/utils.js.map +1 -1
- package/lib/src/visual-embed-sdk.d.ts +176 -67
- package/package.json +1 -1
- package/src/auth.spec.ts +92 -72
- package/src/auth.ts +46 -68
- package/src/authToken.spec.ts +31 -0
- package/src/authToken.ts +17 -5
- package/src/embed/app.spec.ts +4 -2
- package/src/embed/base.spec.ts +1 -0
- package/src/embed/base.ts +3 -0
- package/src/embed/embed.spec.ts +2 -0
- package/src/embed/events.spec.ts +2 -0
- package/src/embed/liveboard.spec.ts +2 -0
- package/src/embed/pinboard.spec.ts +2 -0
- package/src/embed/sage.spec.ts +3 -0
- package/src/embed/search.spec.ts +1 -0
- package/src/embed/ts-embed-trigger.spec.ts +3 -0
- package/src/embed/ts-embed.spec.ts +8 -0
- package/src/embed/ts-embed.ts +7 -0
- package/src/index.ts +2 -1
- package/src/mixpanel-service.spec.ts +12 -3
- package/src/mixpanel-service.ts +3 -1
- package/src/react/index.spec.tsx +7 -0
- package/src/react/index.tsx +1 -0
- package/src/types.ts +80 -47
- package/src/utils/authService/authService.spec.ts +18 -5
- package/src/utils/authService/authService.ts +1 -0
- package/src/utils/authService/tokenizedAuthService.spec.ts +36 -0
- package/src/utils/authService/tokenizedAuthService.ts +38 -8
- package/src/utils/graphql/answerService/answerService.ts +10 -0
- package/src/utils/processData.spec.ts +3 -2
- package/src/utils/processData.ts +3 -3
- package/src/utils/sessionInfoService.ts +101 -0
- package/src/utils.ts +7 -2
package/src/types.ts
CHANGED
|
@@ -610,6 +610,24 @@ export interface EmbedConfig {
|
|
|
610
610
|
* @version SDK: 1.28.4 | Thoughtspot: 10.0.0.cl, 9.5.0.sw
|
|
611
611
|
*/
|
|
612
612
|
currencyFormat?: string;
|
|
613
|
+
|
|
614
|
+
/**
|
|
615
|
+
* This flag is used to disable the token verification in the SDK.
|
|
616
|
+
* Enabling this flag will also disable the caching of the token.
|
|
617
|
+
*
|
|
618
|
+
* @hidden
|
|
619
|
+
*
|
|
620
|
+
* @example
|
|
621
|
+
* ```js
|
|
622
|
+
* init({
|
|
623
|
+
* ...embedConfig,
|
|
624
|
+
* disableTokenVerification : true
|
|
625
|
+
* })
|
|
626
|
+
* ```
|
|
627
|
+
*
|
|
628
|
+
* @version SDK: 1.28.5 | Thoughtspot: *
|
|
629
|
+
*/
|
|
630
|
+
disableTokenVerification?: boolean;
|
|
613
631
|
}
|
|
614
632
|
|
|
615
633
|
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
|
@@ -1227,7 +1245,7 @@ export interface RuntimeFilter {
|
|
|
1227
1245
|
* a single operand, whereas other operators like BW and IN accept multiple
|
|
1228
1246
|
* operands.
|
|
1229
1247
|
*/
|
|
1230
|
-
values: (number | boolean | string)[];
|
|
1248
|
+
values: (number | boolean | string | bigint)[];
|
|
1231
1249
|
}
|
|
1232
1250
|
/**
|
|
1233
1251
|
* A filter that can be applied to ThoughtSpot Answers, Liveboards, or
|
|
@@ -1283,6 +1301,8 @@ export enum EmbedEvent {
|
|
|
1283
1301
|
/**
|
|
1284
1302
|
* Authentication has either succeeded or failed.
|
|
1285
1303
|
*
|
|
1304
|
+
* @version SDK: 1.1.0 | ThoughtSpot: ts7.may.cl, 8.4.1.sw
|
|
1305
|
+
*
|
|
1286
1306
|
* @example
|
|
1287
1307
|
*```js
|
|
1288
1308
|
* appEmbed.on(EmbedEvent.AuthInit, payload => {
|
|
@@ -1296,6 +1316,8 @@ export enum EmbedEvent {
|
|
|
1296
1316
|
* The embed object container has loaded.
|
|
1297
1317
|
*
|
|
1298
1318
|
* @returns timestamp - The timestamp when the event was generated.
|
|
1319
|
+
*
|
|
1320
|
+
* @version SDK: 1.1.0 | ThoughtSpot: ts7.may.cl, 8.4.1.sw
|
|
1299
1321
|
* @example
|
|
1300
1322
|
*```js
|
|
1301
1323
|
* liveboardEmbed.on(EmbedEvent.Load, hideLoader)
|
|
@@ -1310,6 +1332,8 @@ export enum EmbedEvent {
|
|
|
1310
1332
|
* Data pertaining to answer or Liveboard is received
|
|
1311
1333
|
*
|
|
1312
1334
|
* @return data - The answer or Liveboard data
|
|
1335
|
+
*
|
|
1336
|
+
* @version SDK: 1.1.0 | ThoughtSpot: ts7.may.cl, 8.4.1.sw
|
|
1313
1337
|
* @example
|
|
1314
1338
|
*```js
|
|
1315
1339
|
* liveboardEmbed.on(EmbedEvent.Data, payload => {
|
|
@@ -1328,6 +1352,7 @@ export enum EmbedEvent {
|
|
|
1328
1352
|
/**
|
|
1329
1353
|
* Search query has been updated by the user.
|
|
1330
1354
|
*
|
|
1355
|
+
* @version SDK: 1.4.0 | ThoughtSpot: ts7.sep.cl, 8.4.1.sw
|
|
1331
1356
|
* @example
|
|
1332
1357
|
*```js
|
|
1333
1358
|
* searchEmbed.on(EmbedEvent.QueryChanged, payload => console.log('data', payload))
|
|
@@ -1337,12 +1362,14 @@ export enum EmbedEvent {
|
|
|
1337
1362
|
/**
|
|
1338
1363
|
* A drill-down operation has been performed.
|
|
1339
1364
|
*
|
|
1365
|
+
* @version SDK: 1.1.0 | ThoughtSpot: ts7.may.cl, 8.4.1.sw
|
|
1366
|
+
*
|
|
1340
1367
|
* @returns additionalFilters - Any additional filters applied
|
|
1341
1368
|
* @returns drillDownColumns - The columns on which drill down was performed
|
|
1342
1369
|
* @returns nonFilteredColumns - The columns that were not filtered
|
|
1343
1370
|
* @example
|
|
1344
1371
|
*```js
|
|
1345
|
-
* searchEmbed.
|
|
1372
|
+
* searchEmbed.on(EmbedEvent.DrillDown, {
|
|
1346
1373
|
* points: {
|
|
1347
1374
|
* clickedPoint,
|
|
1348
1375
|
* selectedPoints: selectedPoint
|
|
@@ -1375,6 +1402,8 @@ export enum EmbedEvent {
|
|
|
1375
1402
|
* One or more data sources have been selected.
|
|
1376
1403
|
*
|
|
1377
1404
|
* @returns dataSourceIds - the list of data sources
|
|
1405
|
+
*
|
|
1406
|
+
* @version SDK: 1.1.0 | ThoughtSpot: ts7.may.cl, 8.4.1.sw
|
|
1378
1407
|
* @example
|
|
1379
1408
|
* ```js
|
|
1380
1409
|
* searchEmbed.on(EmbedEvent.DataSourceSelected, payload => {
|
|
@@ -1402,6 +1431,8 @@ export enum EmbedEvent {
|
|
|
1402
1431
|
* @returns actionId - ID of the custom action
|
|
1403
1432
|
* @returns payload {@link CustomActionPayload} - Response payload with the
|
|
1404
1433
|
* Answer or Liveboard data
|
|
1434
|
+
*
|
|
1435
|
+
* @version SDK: 1.1.0 | ThoughtSpot: ts7.may.cl, 8.4.1.sw
|
|
1405
1436
|
* @example
|
|
1406
1437
|
* ```js
|
|
1407
1438
|
* appEmbed.on(EmbedEvent.customAction, payload => {
|
|
@@ -1449,21 +1480,18 @@ export enum EmbedEvent {
|
|
|
1449
1480
|
/**
|
|
1450
1481
|
* An error has occurred. This event is fired for the following error types:
|
|
1451
1482
|
*
|
|
1452
|
-
* API - API call failure error.
|
|
1453
|
-
*
|
|
1454
|
-
*
|
|
1455
|
-
*
|
|
1456
|
-
*
|
|
1457
|
-
*
|
|
1458
|
-
* NON_EXIST_FILTER - Error due to a non-existent filter.
|
|
1483
|
+
* `API` - API call failure error.
|
|
1484
|
+
* `FULLSCREEN` - Error when presenting a Liveboard or visualization in full screen mode.
|
|
1485
|
+
* `SINGLE_VALUE_FILTER` - Error due to multiple values in the single value filter.
|
|
1486
|
+
* `NON_EXIST_FILTER` - Error due to a non-existent filter.
|
|
1487
|
+
* `INVALID_DATE_VALUE` - Invalid date value error.
|
|
1488
|
+
* `INVALID_OPERATOR` - Use of invalid operator during filter application.
|
|
1459
1489
|
*
|
|
1460
|
-
*
|
|
1461
|
-
*
|
|
1462
|
-
* INVALID_OPERATOR - Use of invalid operator during filter application.
|
|
1463
|
-
*
|
|
1464
|
-
* For more information, see [Developer Documentation](https://developers.thoughtspot.com/docs/events-app-integration#errorType)
|
|
1490
|
+
* For more information, see https://developers.thoughtspot.com/docs/events-app-integration#errorType
|
|
1465
1491
|
*
|
|
1466
1492
|
* @returns error - An error object or message
|
|
1493
|
+
*
|
|
1494
|
+
* @version SDK: 1.1.0 | ThoughtSpot: ts7.may.cl, 8.4.1.sw
|
|
1467
1495
|
* @example
|
|
1468
1496
|
* ```js
|
|
1469
1497
|
* // API error
|
|
@@ -1489,6 +1517,9 @@ export enum EmbedEvent {
|
|
|
1489
1517
|
* The embedded object has sent an alert.
|
|
1490
1518
|
*
|
|
1491
1519
|
* @returns alert - An alert object
|
|
1520
|
+
*
|
|
1521
|
+
* @version SDK: 1.1.0 | ThoughtSpot: ts7.may.cl, 8.4.1.sw
|
|
1522
|
+
*
|
|
1492
1523
|
* @example
|
|
1493
1524
|
* ```js
|
|
1494
1525
|
* searchEmbed.on(EmbedEvent.Alert)
|
|
@@ -1498,6 +1529,8 @@ export enum EmbedEvent {
|
|
|
1498
1529
|
/**
|
|
1499
1530
|
* The ThoughtSpot auth session has expired.
|
|
1500
1531
|
*
|
|
1532
|
+
* @version SDK: 1.4.0 | ThoughtSpot: ts7.sep.cl, 8.4.1.sw
|
|
1533
|
+
*
|
|
1501
1534
|
* @example
|
|
1502
1535
|
*```js
|
|
1503
1536
|
* appEmbed.on(EmbedEvent.AuthExpire, showAuthExpired)
|
|
@@ -1551,6 +1584,7 @@ export enum EmbedEvent {
|
|
|
1551
1584
|
/**
|
|
1552
1585
|
* Detects the route change.
|
|
1553
1586
|
*
|
|
1587
|
+
* @version SDK: 1.7.0 | ThoughtSpot: 8.0.0.cl, 8.4.1.sw
|
|
1554
1588
|
* @example
|
|
1555
1589
|
*```js
|
|
1556
1590
|
* searchEmbed.on(EmbedEvent.RouteChange, payload =>
|
|
@@ -1631,8 +1665,7 @@ export enum EmbedEvent {
|
|
|
1631
1665
|
*/
|
|
1632
1666
|
LiveboardRendered = 'PinboardRendered',
|
|
1633
1667
|
/**
|
|
1634
|
-
*
|
|
1635
|
-
* is triggered on all events.
|
|
1668
|
+
* Emits all events.
|
|
1636
1669
|
*
|
|
1637
1670
|
* @Version SDK: 1.10.0 | ThoughtSpot: 8.2.0.cl, 8.4.1.sw
|
|
1638
1671
|
* @example
|
|
@@ -1649,13 +1682,13 @@ export enum EmbedEvent {
|
|
|
1649
1682
|
* @Version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
|
|
1650
1683
|
* @example
|
|
1651
1684
|
*```js
|
|
1652
|
-
* //
|
|
1685
|
+
* //Emit when action starts
|
|
1653
1686
|
* searchEmbed.on(EmbedEvent.Save, payload => {
|
|
1654
1687
|
* console.log('Save', payload)
|
|
1655
1688
|
* }, {
|
|
1656
1689
|
* start: true
|
|
1657
1690
|
* })
|
|
1658
|
-
* //
|
|
1691
|
+
* //emit when action ends
|
|
1659
1692
|
* searchEmbed.on(EmbedEvent.Save, payload => {
|
|
1660
1693
|
* console.log('Save', payload)
|
|
1661
1694
|
* })
|
|
@@ -1673,7 +1706,7 @@ export enum EmbedEvent {
|
|
|
1673
1706
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
|
|
1674
1707
|
* @example
|
|
1675
1708
|
*```js
|
|
1676
|
-
* liveboardEmbed.
|
|
1709
|
+
* liveboardEmbed.on(EmbedEvent.Download, {
|
|
1677
1710
|
* vizId: '730496d6-6903-4601-937e-2c691821af3c'
|
|
1678
1711
|
* })
|
|
1679
1712
|
*```
|
|
@@ -1685,10 +1718,10 @@ export enum EmbedEvent {
|
|
|
1685
1718
|
* @version SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl, 9.4.0.sw
|
|
1686
1719
|
* @example
|
|
1687
1720
|
*```js
|
|
1688
|
-
* //
|
|
1721
|
+
* //emit when action starts
|
|
1689
1722
|
* searchEmbed.on(EmbedEvent.DownloadAsPng, payload => {
|
|
1690
1723
|
* console.log('download PNG', payload)}, {start: true })
|
|
1691
|
-
* //
|
|
1724
|
+
* //emit when action ends
|
|
1692
1725
|
* searchEmbed.on(EmbedEvent.DownloadAsPng, payload => {
|
|
1693
1726
|
* console.log('download PNG', payload)})
|
|
1694
1727
|
*```
|
|
@@ -1700,10 +1733,10 @@ export enum EmbedEvent {
|
|
|
1700
1733
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
|
|
1701
1734
|
* @example
|
|
1702
1735
|
*```js
|
|
1703
|
-
* //
|
|
1736
|
+
* //emit when action starts
|
|
1704
1737
|
* searchEmbed.on(EmbedEvent.DownloadAsPdf, payload => {
|
|
1705
1738
|
* console.log('download PDF', payload)}, {start: true })
|
|
1706
|
-
* //
|
|
1739
|
+
* //emit when action ends
|
|
1707
1740
|
* searchEmbed.on(EmbedEvent.DownloadAsPdf, payload => {
|
|
1708
1741
|
* console.log('download PDF', payload)})
|
|
1709
1742
|
*```
|
|
@@ -1715,10 +1748,10 @@ export enum EmbedEvent {
|
|
|
1715
1748
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
|
|
1716
1749
|
* @example
|
|
1717
1750
|
*```js
|
|
1718
|
-
* //
|
|
1751
|
+
* //emit when action starts
|
|
1719
1752
|
* searchEmbed.on(EmbedEvent.DownloadAsCSV, payload => {
|
|
1720
1753
|
* console.log('download CSV', payload)}, {start: true })
|
|
1721
|
-
* //
|
|
1754
|
+
* //emit when action ends
|
|
1722
1755
|
* searchEmbed.on(EmbedEvent.DownloadAsCSV, payload => {
|
|
1723
1756
|
* console.log('download CSV', payload)})
|
|
1724
1757
|
*```
|
|
@@ -1730,10 +1763,10 @@ export enum EmbedEvent {
|
|
|
1730
1763
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
|
|
1731
1764
|
* @example
|
|
1732
1765
|
*```js
|
|
1733
|
-
* //
|
|
1766
|
+
* //emit when action starts
|
|
1734
1767
|
* searchEmbed.on(EmbedEvent.DownloadAsXlsx, payload => {
|
|
1735
1768
|
* console.log('download Xlsx', payload)}, { start: true })
|
|
1736
|
-
* //
|
|
1769
|
+
* //emit when action ends
|
|
1737
1770
|
* searchEmbed.on(EmbedEvent.DownloadAsXlsx, payload => {
|
|
1738
1771
|
* console.log('download Xlsx', payload)})
|
|
1739
1772
|
*```
|
|
@@ -1745,7 +1778,7 @@ export enum EmbedEvent {
|
|
|
1745
1778
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
|
|
1746
1779
|
* @example
|
|
1747
1780
|
*```js
|
|
1748
|
-
* //
|
|
1781
|
+
* //emit when action starts
|
|
1749
1782
|
* appEmbed.on(EmbedEvent.AnswerDelete, payload => {
|
|
1750
1783
|
* console.log('delete answer', payload)}, {start: true })
|
|
1751
1784
|
* //trigger when action is completed
|
|
@@ -1760,13 +1793,13 @@ export enum EmbedEvent {
|
|
|
1760
1793
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
|
|
1761
1794
|
* @example
|
|
1762
1795
|
*```js
|
|
1763
|
-
* //
|
|
1796
|
+
* //emit when action starts
|
|
1764
1797
|
* searchEmbed.on(EmbedEvent.Pin, payload => {
|
|
1765
1798
|
* console.log('pin', payload)
|
|
1766
1799
|
* }, {
|
|
1767
1800
|
* start: true
|
|
1768
1801
|
* })
|
|
1769
|
-
* //
|
|
1802
|
+
* //emit when action ends
|
|
1770
1803
|
* searchEmbed.on(EmbedEvent.Pin, payload => {
|
|
1771
1804
|
* console.log('pin', payload)
|
|
1772
1805
|
* })
|
|
@@ -1779,13 +1812,13 @@ export enum EmbedEvent {
|
|
|
1779
1812
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
|
|
1780
1813
|
* @example
|
|
1781
1814
|
*```js
|
|
1782
|
-
* //
|
|
1815
|
+
* //emit when action starts
|
|
1783
1816
|
* searchEmbed.on(EmbedEvent.SpotIQAnalyze, payload => {
|
|
1784
1817
|
* console.log('SpotIQAnalyze', payload)
|
|
1785
1818
|
* }, {
|
|
1786
1819
|
* start: true
|
|
1787
1820
|
* })
|
|
1788
|
-
* //
|
|
1821
|
+
* //emit when action ends
|
|
1789
1822
|
* searchEmbed.on(EmbedEvent.SpotIQAnalyze, payload => {
|
|
1790
1823
|
* console.log('SpotIQ analyze', payload)
|
|
1791
1824
|
* })
|
|
@@ -1798,13 +1831,13 @@ export enum EmbedEvent {
|
|
|
1798
1831
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
|
|
1799
1832
|
* @example
|
|
1800
1833
|
*```js
|
|
1801
|
-
* //
|
|
1834
|
+
* //emit when action starts
|
|
1802
1835
|
* searchEmbed.on(EmbedEvent.Share, payload => {
|
|
1803
1836
|
* console.log('Share', payload)
|
|
1804
1837
|
* }, {
|
|
1805
1838
|
* start: true
|
|
1806
1839
|
* })
|
|
1807
|
-
* //
|
|
1840
|
+
* //emit when action ends
|
|
1808
1841
|
* searchEmbed.on(EmbedEvent.Share, payload => {
|
|
1809
1842
|
* console.log('Share', payload)
|
|
1810
1843
|
* })
|
|
@@ -1879,10 +1912,10 @@ export enum EmbedEvent {
|
|
|
1879
1912
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
|
|
1880
1913
|
* @example
|
|
1881
1914
|
*```js
|
|
1882
|
-
* //
|
|
1915
|
+
* //emit when action starts
|
|
1883
1916
|
* searchEmbed.on(EmbedEvent.ExportTML, payload => {
|
|
1884
1917
|
* console.log('Export TML', payload)}, { start: true })
|
|
1885
|
-
* //
|
|
1918
|
+
* //emit when action ends
|
|
1886
1919
|
* searchEmbed.on(EmbedEvent.ExportTML, payload => {
|
|
1887
1920
|
* console.log('Export TML', payload)})
|
|
1888
1921
|
*```
|
|
@@ -1906,10 +1939,10 @@ export enum EmbedEvent {
|
|
|
1906
1939
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
|
|
1907
1940
|
* @example
|
|
1908
1941
|
*```js
|
|
1909
|
-
* //
|
|
1942
|
+
* //emit when action starts
|
|
1910
1943
|
* appEmbed.on(EmbedEvent.CopyAEdit, payload => {
|
|
1911
1944
|
* console.log('Copy and edit', payload)}, {start: true })
|
|
1912
|
-
* //
|
|
1945
|
+
* //emit when action ends
|
|
1913
1946
|
* appEmbed.on(EmbedEvent.CopyAEdit, payload => {
|
|
1914
1947
|
* console.log('Copy and edit', payload)})
|
|
1915
1948
|
*```
|
|
@@ -2011,7 +2044,7 @@ export enum EmbedEvent {
|
|
|
2011
2044
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
|
|
2012
2045
|
* @example
|
|
2013
2046
|
*```js
|
|
2014
|
-
* liveboardEmbed.
|
|
2047
|
+
* liveboardEmbed.on(EmbedEvent.Present)
|
|
2015
2048
|
*```
|
|
2016
2049
|
* @example
|
|
2017
2050
|
*```js
|
|
@@ -2027,7 +2060,7 @@ export enum EmbedEvent {
|
|
|
2027
2060
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
|
|
2028
2061
|
* @example
|
|
2029
2062
|
*```js
|
|
2030
|
-
* liveboardEmbed.
|
|
2063
|
+
* liveboardEmbed.on(EmbedEvent.Delete,
|
|
2031
2064
|
* {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
|
|
2032
2065
|
*```
|
|
2033
2066
|
*/
|
|
@@ -2038,7 +2071,7 @@ export enum EmbedEvent {
|
|
|
2038
2071
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
|
|
2039
2072
|
* @example
|
|
2040
2073
|
*```js
|
|
2041
|
-
* liveboardEmbed.
|
|
2074
|
+
* liveboardEmbed.on(EmbedEvent.SchedulesList)
|
|
2042
2075
|
*```
|
|
2043
2076
|
*/
|
|
2044
2077
|
SchedulesList = 'schedule-list',
|
|
@@ -2048,7 +2081,7 @@ export enum EmbedEvent {
|
|
|
2048
2081
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
|
|
2049
2082
|
* @example
|
|
2050
2083
|
*```js
|
|
2051
|
-
* liveboardEmbed.
|
|
2084
|
+
* liveboardEmbed.on(EmbedEvent.Cancel)
|
|
2052
2085
|
*```
|
|
2053
2086
|
*/
|
|
2054
2087
|
Cancel = 'cancel',
|
|
@@ -2058,7 +2091,7 @@ export enum EmbedEvent {
|
|
|
2058
2091
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
|
|
2059
2092
|
* @example
|
|
2060
2093
|
*```js
|
|
2061
|
-
* liveboardEmbed.
|
|
2094
|
+
* liveboardEmbed.on(EmbedEvent.Explore, {
|
|
2062
2095
|
* vizId: '730496d6-6903-4601-937e-2c691821af3c'})
|
|
2063
2096
|
*```
|
|
2064
2097
|
*/
|
|
@@ -2069,7 +2102,7 @@ export enum EmbedEvent {
|
|
|
2069
2102
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
|
|
2070
2103
|
* @example
|
|
2071
2104
|
*```js
|
|
2072
|
-
* liveboardEmbed.
|
|
2105
|
+
* liveboardEmbed.on(EmbedEvent.CopyLink, {
|
|
2073
2106
|
* vizId: '730496d6-6903-4601-937e-2c691821af3c'})
|
|
2074
2107
|
*```
|
|
2075
2108
|
*/
|
|
@@ -2449,7 +2482,7 @@ export enum HostEvent {
|
|
|
2449
2482
|
*
|
|
2450
2483
|
* @example
|
|
2451
2484
|
* ```js
|
|
2452
|
-
* liveboardEmbed.trigger(HostEvent.
|
|
2485
|
+
* liveboardEmbed.trigger(HostEvent.getExportRequestForCurrentPinboard).then(
|
|
2453
2486
|
* data=>console.log(data))
|
|
2454
2487
|
* ```
|
|
2455
2488
|
* @version SDK: 1.13.0 | ThoughtSpot: 8.5.0.cl, 8.8.1.sw
|
|
@@ -2913,7 +2946,7 @@ export enum HostEvent {
|
|
|
2913
2946
|
*
|
|
2914
2947
|
* ```js
|
|
2915
2948
|
* liveboardEmbed.trigger(HostEvent.UpdateFilters, {
|
|
2916
|
-
* filter: { column: 'column name', oper: 'IN', values: [1,2,3]
|
|
2949
|
+
* filter: { column: 'column name', oper: 'IN', values: [1,2,3]}
|
|
2917
2950
|
* })
|
|
2918
2951
|
* ```
|
|
2919
2952
|
* @version SDK: 1.23.0 | ThoughtSpot: 9.4.0.cl
|
|
@@ -4072,7 +4105,7 @@ export enum Action {
|
|
|
4072
4105
|
* disabledActions: [Action.TML] // to disable all TML actions
|
|
4073
4106
|
* ```
|
|
4074
4107
|
*
|
|
4075
|
-
* @version SDK : 1.28.
|
|
4108
|
+
* @version SDK : 1.28.3 | Thoughtspot: 9.12.0.cl
|
|
4076
4109
|
*/
|
|
4077
4110
|
TML = 'tml',
|
|
4078
4111
|
|
|
@@ -26,9 +26,10 @@ describe('Unit test for authService', () => {
|
|
|
26
26
|
status: 200,
|
|
27
27
|
ok: true,
|
|
28
28
|
}));
|
|
29
|
-
const response = await fetchSessionInfoService(
|
|
30
|
-
expect(response.
|
|
29
|
+
const response = await fetchSessionInfoService(thoughtSpotHost);
|
|
30
|
+
expect(response.success).toBe(true);
|
|
31
31
|
expect(fetch).toHaveBeenCalledTimes(1);
|
|
32
|
+
expect(fetch).toBeCalledWith(`${thoughtSpotHost}${EndPoints.SESSION_INFO}`, {});
|
|
32
33
|
});
|
|
33
34
|
|
|
34
35
|
test('fetchAuthTokenService', async () => {
|
|
@@ -108,11 +109,15 @@ describe('Unit test for authService', () => {
|
|
|
108
109
|
status: 500,
|
|
109
110
|
ok: false,
|
|
110
111
|
}));
|
|
111
|
-
|
|
112
|
-
|
|
112
|
+
try {
|
|
113
|
+
await fetchSessionInfoService(authVerificationUrl);
|
|
114
|
+
} catch (e) {
|
|
115
|
+
expect(e.message).toContain('Failed to fetch session info');
|
|
116
|
+
}
|
|
117
|
+
expect(logger.error).toHaveBeenCalledWith('Failed to fetch http://localhost:3000/callosum/v1/session/info', 'error');
|
|
113
118
|
});
|
|
114
119
|
|
|
115
|
-
test('verifyTokenService', async () => {
|
|
120
|
+
test('verifyTokenService if token api works', async () => {
|
|
116
121
|
global.fetch = jest.fn(() => Promise.resolve({ success: true, ok: true }));
|
|
117
122
|
await verifyTokenService(thoughtSpotHost, authToken);
|
|
118
123
|
expect(fetch).toBeCalledWith(`${thoughtSpotHost}${EndPoints.IS_ACTIVE}`, {
|
|
@@ -123,4 +128,12 @@ describe('Unit test for authService', () => {
|
|
|
123
128
|
},
|
|
124
129
|
});
|
|
125
130
|
});
|
|
131
|
+
|
|
132
|
+
test('verifyTokenService if token api fails', async () => {
|
|
133
|
+
global.fetch = jest.fn(() => Promise.reject(new Error('error')));
|
|
134
|
+
jest.spyOn(logger, 'warn');
|
|
135
|
+
const status = await verifyTokenService(thoughtSpotHost, authToken);
|
|
136
|
+
expect(status).toBe(false);
|
|
137
|
+
expect(logger.warn).toHaveBeenCalledWith('Token Verification Service failed : error');
|
|
138
|
+
});
|
|
126
139
|
});
|
|
@@ -2,6 +2,7 @@ import { logger } from '../logger';
|
|
|
2
2
|
|
|
3
3
|
export const EndPoints = {
|
|
4
4
|
AUTH_VERIFICATION: '/callosum/v1/session/info',
|
|
5
|
+
SESSION_INFO: '/callosum/v1/session/info',
|
|
5
6
|
SAML_LOGIN_TEMPLATE: (targetUrl: string) => `/callosum/v1/saml/login?targetURLPath=${targetUrl}`,
|
|
6
7
|
OIDC_LOGIN_TEMPLATE: (targetUrl: string) => `/callosum/v1/oidc/login?targetURLPath=${targetUrl}`,
|
|
7
8
|
TOKEN_LOGIN: '/callosum/v1/session/login/token',
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as tokenizedFetchModule from '../../tokenizedFetch';
|
|
2
|
+
import { isActiveService } from './tokenizedAuthService';
|
|
3
|
+
import { logger } from '../logger';
|
|
4
|
+
|
|
5
|
+
describe('tokenizedAuthService', () => {
|
|
6
|
+
test('isActiveService is fetch returns ok', async () => {
|
|
7
|
+
jest.spyOn(tokenizedFetchModule, 'tokenizedFetch').mockResolvedValueOnce({
|
|
8
|
+
ok: true,
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
const isActiveResp = await isActiveService('http://thoughtspotHost');
|
|
12
|
+
|
|
13
|
+
expect(isActiveResp).toEqual(true);
|
|
14
|
+
});
|
|
15
|
+
test('isActiveService if fetch returns not ok', async () => {
|
|
16
|
+
jest.spyOn(tokenizedFetchModule, 'tokenizedFetch').mockResolvedValueOnce({
|
|
17
|
+
ok: false,
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const isActiveResp = await isActiveService('http://thoughtspotHost');
|
|
21
|
+
|
|
22
|
+
expect(isActiveResp).toEqual(false);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
test('isActiveService if fetch fails', async () => {
|
|
26
|
+
jest.spyOn(tokenizedFetchModule, 'tokenizedFetch').mockRejectedValueOnce({
|
|
27
|
+
ok: false,
|
|
28
|
+
});
|
|
29
|
+
jest.spyOn(logger, 'warn');
|
|
30
|
+
|
|
31
|
+
const isActiveResp = await isActiveService('http://thoughtspotHost');
|
|
32
|
+
|
|
33
|
+
expect(isActiveResp).toEqual(false);
|
|
34
|
+
expect(logger.warn).toHaveBeenCalled();
|
|
35
|
+
});
|
|
36
|
+
});
|
|
@@ -7,23 +7,33 @@ import { EndPoints } from './authService';
|
|
|
7
7
|
* @param url
|
|
8
8
|
* @param options
|
|
9
9
|
*/
|
|
10
|
-
function
|
|
10
|
+
function tokenizedFailureLoggedFetch(url: string, options: RequestInit = {}): Promise<Response> {
|
|
11
11
|
return tokenizedFetch(url, options).then(async (r) => {
|
|
12
12
|
if (!r.ok && r.type !== 'opaqueredirect' && r.type !== 'opaque') {
|
|
13
|
-
logger.error(
|
|
13
|
+
logger.error(`Failed to fetch ${url}`, await r.text?.());
|
|
14
14
|
}
|
|
15
15
|
return r;
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
|
+
* Fetches the session info from the ThoughtSpot server.
|
|
20
21
|
*
|
|
21
|
-
* @param
|
|
22
|
+
* @param thoughtspotHost
|
|
23
|
+
* @returns {Promise<any>}
|
|
24
|
+
* @example
|
|
25
|
+
* ```js
|
|
26
|
+
* const response = await sessionInfoService();
|
|
27
|
+
* ```
|
|
22
28
|
*/
|
|
23
|
-
export function fetchSessionInfoService(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
29
|
+
export async function fetchSessionInfoService(thoughtspotHost: string): Promise<any> {
|
|
30
|
+
const sessionInfoPath = `${thoughtspotHost}${EndPoints.SESSION_INFO}`;
|
|
31
|
+
const response = await tokenizedFailureLoggedFetch(sessionInfoPath);
|
|
32
|
+
if (!response.ok) {
|
|
33
|
+
throw new Error(`Failed to fetch session info: ${response.statusText}`);
|
|
34
|
+
}
|
|
35
|
+
const data = await response.json();
|
|
36
|
+
return data;
|
|
27
37
|
}
|
|
28
38
|
|
|
29
39
|
/**
|
|
@@ -31,7 +41,7 @@ export function fetchSessionInfoService(authVerificationUrl: string): Promise<an
|
|
|
31
41
|
* @param thoughtSpotHost
|
|
32
42
|
*/
|
|
33
43
|
export async function fetchLogoutService(thoughtSpotHost: string): Promise<any> {
|
|
34
|
-
return
|
|
44
|
+
return tokenizedFailureLoggedFetch(`${thoughtSpotHost}${EndPoints.LOGOUT}`, {
|
|
35
45
|
credentials: 'include',
|
|
36
46
|
method: 'POST',
|
|
37
47
|
headers: {
|
|
@@ -39,3 +49,23 @@ export async function fetchLogoutService(thoughtSpotHost: string): Promise<any>
|
|
|
39
49
|
},
|
|
40
50
|
});
|
|
41
51
|
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Is active service to check if the user is logged in.
|
|
55
|
+
*
|
|
56
|
+
* @param thoughtSpotHost
|
|
57
|
+
* @version SDK: 1.28.4 | ThoughtSpot: *
|
|
58
|
+
*/
|
|
59
|
+
export async function isActiveService(thoughtSpotHost: string): Promise<boolean> {
|
|
60
|
+
const isActiveUrl = `${thoughtSpotHost}${EndPoints.IS_ACTIVE}`;
|
|
61
|
+
try {
|
|
62
|
+
const res = await tokenizedFetch(isActiveUrl, {
|
|
63
|
+
credentials: 'include',
|
|
64
|
+
});
|
|
65
|
+
return res.ok;
|
|
66
|
+
} catch (e) {
|
|
67
|
+
logger.warn(`Is Logged In Service failed : ${e.message}`);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
@@ -37,6 +37,16 @@ export interface UnderlyingDataPoint {
|
|
|
37
37
|
* const data = await underlying.fetchData(0, 100);
|
|
38
38
|
* })
|
|
39
39
|
* ```
|
|
40
|
+
* @example
|
|
41
|
+
* ```js
|
|
42
|
+
* embed.on(EmbedEvent.Data, async (e) => {
|
|
43
|
+
* const service = await embed.getAnswerService();
|
|
44
|
+
* await service.addColumns([
|
|
45
|
+
* "<column guid>"
|
|
46
|
+
* ]);
|
|
47
|
+
* console.log(await service.fetchData());
|
|
48
|
+
* });
|
|
49
|
+
* ```
|
|
40
50
|
* @version SDK: 1.25.0| ThoughtSpot: 9.10.0.cl
|
|
41
51
|
* @group Events
|
|
42
52
|
*/
|
|
@@ -4,9 +4,11 @@ import * as auth from '../auth';
|
|
|
4
4
|
import * as base from '../embed/base';
|
|
5
5
|
import * as embedConfigInstance from '../embed/embedConfig';
|
|
6
6
|
import { EmbedEvent, AuthType } from '../types';
|
|
7
|
+
import * as sessionInfoService from './sessionInfoService';
|
|
7
8
|
|
|
8
9
|
describe('Unit test for process data', () => {
|
|
9
10
|
beforeAll(() => {
|
|
11
|
+
jest.spyOn(auth, 'postLoginService').mockImplementation(() => Promise.resolve({}));
|
|
10
12
|
base.init({
|
|
11
13
|
thoughtSpotHost: 'https://tshost',
|
|
12
14
|
authType: AuthType.None,
|
|
@@ -58,15 +60,14 @@ describe('Unit test for process data', () => {
|
|
|
58
60
|
isPublicUser: false,
|
|
59
61
|
};
|
|
60
62
|
const e = { type: EmbedEvent.AuthInit, data: sessionInfo };
|
|
61
|
-
jest.spyOn(auth, 'initSession').mockReturnValue(null);
|
|
62
63
|
jest.spyOn(base, 'notifyAuthSuccess');
|
|
64
|
+
jest.spyOn(sessionInfoService, 'getSessionInfo').mockReturnValue(sessionInfo);
|
|
63
65
|
expect(processDataInstance.processEventData(e.type, e, '', null)).toEqual({
|
|
64
66
|
type: e.type,
|
|
65
67
|
data: {
|
|
66
68
|
userGUID: sessionInfo.userGUID,
|
|
67
69
|
},
|
|
68
70
|
});
|
|
69
|
-
expect(auth.initSession).toBeCalledWith(sessionInfo);
|
|
70
71
|
expect(base.notifyAuthSuccess).toBeCalled();
|
|
71
72
|
});
|
|
72
73
|
|
package/src/utils/processData.ts
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
notifyAuthSuccess,
|
|
6
6
|
notifyLogout,
|
|
7
7
|
} from '../embed/base';
|
|
8
|
-
import { AuthFailureType
|
|
8
|
+
import { AuthFailureType } from '../auth';
|
|
9
9
|
import { AuthType, CustomActionPayload, EmbedEvent } from '../types';
|
|
10
10
|
import { AnswerService } from './graphql/answerService/answerService';
|
|
11
11
|
import { resetCachedAuthToken } from '../authToken';
|
|
@@ -30,12 +30,12 @@ export function processCustomAction(e: any, thoughtSpotHost: string) {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
|
+
* Responds to AuthInit sent from host signifying successful authentication in host.
|
|
33
34
|
*
|
|
34
35
|
* @param e
|
|
36
|
+
* @returns {any}
|
|
35
37
|
*/
|
|
36
38
|
function processAuthInit(e: any) {
|
|
37
|
-
// Store user session details sent by app.
|
|
38
|
-
initSession(e.data);
|
|
39
39
|
notifyAuthSuccess();
|
|
40
40
|
|
|
41
41
|
// Expose only allowed details (eg: userGUID) back to SDK users.
|