@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/dist/tsembed.es.js
CHANGED
|
@@ -390,6 +390,8 @@ var EmbedEvent;
|
|
|
390
390
|
/**
|
|
391
391
|
* Authentication has either succeeded or failed.
|
|
392
392
|
*
|
|
393
|
+
* @version SDK: 1.1.0 | ThoughtSpot: ts7.may.cl, 8.4.1.sw
|
|
394
|
+
*
|
|
393
395
|
* @example
|
|
394
396
|
*```js
|
|
395
397
|
* appEmbed.on(EmbedEvent.AuthInit, payload => {
|
|
@@ -403,6 +405,8 @@ var EmbedEvent;
|
|
|
403
405
|
* The embed object container has loaded.
|
|
404
406
|
*
|
|
405
407
|
* @returns timestamp - The timestamp when the event was generated.
|
|
408
|
+
*
|
|
409
|
+
* @version SDK: 1.1.0 | ThoughtSpot: ts7.may.cl, 8.4.1.sw
|
|
406
410
|
* @example
|
|
407
411
|
*```js
|
|
408
412
|
* liveboardEmbed.on(EmbedEvent.Load, hideLoader)
|
|
@@ -417,6 +421,8 @@ var EmbedEvent;
|
|
|
417
421
|
* Data pertaining to answer or Liveboard is received
|
|
418
422
|
*
|
|
419
423
|
* @return data - The answer or Liveboard data
|
|
424
|
+
*
|
|
425
|
+
* @version SDK: 1.1.0 | ThoughtSpot: ts7.may.cl, 8.4.1.sw
|
|
420
426
|
* @example
|
|
421
427
|
*```js
|
|
422
428
|
* liveboardEmbed.on(EmbedEvent.Data, payload => {
|
|
@@ -435,6 +441,7 @@ var EmbedEvent;
|
|
|
435
441
|
/**
|
|
436
442
|
* Search query has been updated by the user.
|
|
437
443
|
*
|
|
444
|
+
* @version SDK: 1.4.0 | ThoughtSpot: ts7.sep.cl, 8.4.1.sw
|
|
438
445
|
* @example
|
|
439
446
|
*```js
|
|
440
447
|
* searchEmbed.on(EmbedEvent.QueryChanged, payload => console.log('data', payload))
|
|
@@ -444,12 +451,14 @@ var EmbedEvent;
|
|
|
444
451
|
/**
|
|
445
452
|
* A drill-down operation has been performed.
|
|
446
453
|
*
|
|
454
|
+
* @version SDK: 1.1.0 | ThoughtSpot: ts7.may.cl, 8.4.1.sw
|
|
455
|
+
*
|
|
447
456
|
* @returns additionalFilters - Any additional filters applied
|
|
448
457
|
* @returns drillDownColumns - The columns on which drill down was performed
|
|
449
458
|
* @returns nonFilteredColumns - The columns that were not filtered
|
|
450
459
|
* @example
|
|
451
460
|
*```js
|
|
452
|
-
* searchEmbed.
|
|
461
|
+
* searchEmbed.on(EmbedEvent.DrillDown, {
|
|
453
462
|
* points: {
|
|
454
463
|
* clickedPoint,
|
|
455
464
|
* selectedPoints: selectedPoint
|
|
@@ -482,6 +491,8 @@ var EmbedEvent;
|
|
|
482
491
|
* One or more data sources have been selected.
|
|
483
492
|
*
|
|
484
493
|
* @returns dataSourceIds - the list of data sources
|
|
494
|
+
*
|
|
495
|
+
* @version SDK: 1.1.0 | ThoughtSpot: ts7.may.cl, 8.4.1.sw
|
|
485
496
|
* @example
|
|
486
497
|
* ```js
|
|
487
498
|
* searchEmbed.on(EmbedEvent.DataSourceSelected, payload => {
|
|
@@ -509,6 +520,8 @@ var EmbedEvent;
|
|
|
509
520
|
* @returns actionId - ID of the custom action
|
|
510
521
|
* @returns payload {@link CustomActionPayload} - Response payload with the
|
|
511
522
|
* Answer or Liveboard data
|
|
523
|
+
*
|
|
524
|
+
* @version SDK: 1.1.0 | ThoughtSpot: ts7.may.cl, 8.4.1.sw
|
|
512
525
|
* @example
|
|
513
526
|
* ```js
|
|
514
527
|
* appEmbed.on(EmbedEvent.customAction, payload => {
|
|
@@ -556,21 +569,18 @@ var EmbedEvent;
|
|
|
556
569
|
/**
|
|
557
570
|
* An error has occurred. This event is fired for the following error types:
|
|
558
571
|
*
|
|
559
|
-
* API - API call failure error.
|
|
560
|
-
*
|
|
561
|
-
*
|
|
562
|
-
*
|
|
563
|
-
*
|
|
572
|
+
* `API` - API call failure error.
|
|
573
|
+
* `FULLSCREEN` - Error when presenting a Liveboard or visualization in full screen mode.
|
|
574
|
+
* `SINGLE_VALUE_FILTER` - Error due to multiple values in the single value filter.
|
|
575
|
+
* `NON_EXIST_FILTER` - Error due to a non-existent filter.
|
|
576
|
+
* `INVALID_DATE_VALUE` - Invalid date value error.
|
|
577
|
+
* `INVALID_OPERATOR` - Use of invalid operator during filter application.
|
|
564
578
|
*
|
|
565
|
-
*
|
|
566
|
-
*
|
|
567
|
-
* INVALID_DATE_VALUE - Invalid date value error.
|
|
568
|
-
*
|
|
569
|
-
* INVALID_OPERATOR - Use of invalid operator during filter application.
|
|
570
|
-
*
|
|
571
|
-
* For more information, see [Developer Documentation](https://developers.thoughtspot.com/docs/events-app-integration#errorType)
|
|
579
|
+
* For more information, see https://developers.thoughtspot.com/docs/events-app-integration#errorType
|
|
572
580
|
*
|
|
573
581
|
* @returns error - An error object or message
|
|
582
|
+
*
|
|
583
|
+
* @version SDK: 1.1.0 | ThoughtSpot: ts7.may.cl, 8.4.1.sw
|
|
574
584
|
* @example
|
|
575
585
|
* ```js
|
|
576
586
|
* // API error
|
|
@@ -596,6 +606,9 @@ var EmbedEvent;
|
|
|
596
606
|
* The embedded object has sent an alert.
|
|
597
607
|
*
|
|
598
608
|
* @returns alert - An alert object
|
|
609
|
+
*
|
|
610
|
+
* @version SDK: 1.1.0 | ThoughtSpot: ts7.may.cl, 8.4.1.sw
|
|
611
|
+
*
|
|
599
612
|
* @example
|
|
600
613
|
* ```js
|
|
601
614
|
* searchEmbed.on(EmbedEvent.Alert)
|
|
@@ -605,6 +618,8 @@ var EmbedEvent;
|
|
|
605
618
|
/**
|
|
606
619
|
* The ThoughtSpot auth session has expired.
|
|
607
620
|
*
|
|
621
|
+
* @version SDK: 1.4.0 | ThoughtSpot: ts7.sep.cl, 8.4.1.sw
|
|
622
|
+
*
|
|
608
623
|
* @example
|
|
609
624
|
*```js
|
|
610
625
|
* appEmbed.on(EmbedEvent.AuthExpire, showAuthExpired)
|
|
@@ -658,6 +673,7 @@ var EmbedEvent;
|
|
|
658
673
|
/**
|
|
659
674
|
* Detects the route change.
|
|
660
675
|
*
|
|
676
|
+
* @version SDK: 1.7.0 | ThoughtSpot: 8.0.0.cl, 8.4.1.sw
|
|
661
677
|
* @example
|
|
662
678
|
*```js
|
|
663
679
|
* searchEmbed.on(EmbedEvent.RouteChange, payload =>
|
|
@@ -738,8 +754,7 @@ var EmbedEvent;
|
|
|
738
754
|
*/
|
|
739
755
|
EmbedEvent["LiveboardRendered"] = "PinboardRendered";
|
|
740
756
|
/**
|
|
741
|
-
*
|
|
742
|
-
* is triggered on all events.
|
|
757
|
+
* Emits all events.
|
|
743
758
|
*
|
|
744
759
|
* @Version SDK: 1.10.0 | ThoughtSpot: 8.2.0.cl, 8.4.1.sw
|
|
745
760
|
* @example
|
|
@@ -756,13 +771,13 @@ var EmbedEvent;
|
|
|
756
771
|
* @Version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
|
|
757
772
|
* @example
|
|
758
773
|
*```js
|
|
759
|
-
* //
|
|
774
|
+
* //Emit when action starts
|
|
760
775
|
* searchEmbed.on(EmbedEvent.Save, payload => {
|
|
761
776
|
* console.log('Save', payload)
|
|
762
777
|
* }, {
|
|
763
778
|
* start: true
|
|
764
779
|
* })
|
|
765
|
-
* //
|
|
780
|
+
* //emit when action ends
|
|
766
781
|
* searchEmbed.on(EmbedEvent.Save, payload => {
|
|
767
782
|
* console.log('Save', payload)
|
|
768
783
|
* })
|
|
@@ -780,7 +795,7 @@ var EmbedEvent;
|
|
|
780
795
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
|
|
781
796
|
* @example
|
|
782
797
|
*```js
|
|
783
|
-
* liveboardEmbed.
|
|
798
|
+
* liveboardEmbed.on(EmbedEvent.Download, {
|
|
784
799
|
* vizId: '730496d6-6903-4601-937e-2c691821af3c'
|
|
785
800
|
* })
|
|
786
801
|
*```
|
|
@@ -792,10 +807,10 @@ var EmbedEvent;
|
|
|
792
807
|
* @version SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl, 9.4.0.sw
|
|
793
808
|
* @example
|
|
794
809
|
*```js
|
|
795
|
-
* //
|
|
810
|
+
* //emit when action starts
|
|
796
811
|
* searchEmbed.on(EmbedEvent.DownloadAsPng, payload => {
|
|
797
812
|
* console.log('download PNG', payload)}, {start: true })
|
|
798
|
-
* //
|
|
813
|
+
* //emit when action ends
|
|
799
814
|
* searchEmbed.on(EmbedEvent.DownloadAsPng, payload => {
|
|
800
815
|
* console.log('download PNG', payload)})
|
|
801
816
|
*```
|
|
@@ -807,10 +822,10 @@ var EmbedEvent;
|
|
|
807
822
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
|
|
808
823
|
* @example
|
|
809
824
|
*```js
|
|
810
|
-
* //
|
|
825
|
+
* //emit when action starts
|
|
811
826
|
* searchEmbed.on(EmbedEvent.DownloadAsPdf, payload => {
|
|
812
827
|
* console.log('download PDF', payload)}, {start: true })
|
|
813
|
-
* //
|
|
828
|
+
* //emit when action ends
|
|
814
829
|
* searchEmbed.on(EmbedEvent.DownloadAsPdf, payload => {
|
|
815
830
|
* console.log('download PDF', payload)})
|
|
816
831
|
*```
|
|
@@ -822,10 +837,10 @@ var EmbedEvent;
|
|
|
822
837
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
|
|
823
838
|
* @example
|
|
824
839
|
*```js
|
|
825
|
-
* //
|
|
840
|
+
* //emit when action starts
|
|
826
841
|
* searchEmbed.on(EmbedEvent.DownloadAsCSV, payload => {
|
|
827
842
|
* console.log('download CSV', payload)}, {start: true })
|
|
828
|
-
* //
|
|
843
|
+
* //emit when action ends
|
|
829
844
|
* searchEmbed.on(EmbedEvent.DownloadAsCSV, payload => {
|
|
830
845
|
* console.log('download CSV', payload)})
|
|
831
846
|
*```
|
|
@@ -837,10 +852,10 @@ var EmbedEvent;
|
|
|
837
852
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
|
|
838
853
|
* @example
|
|
839
854
|
*```js
|
|
840
|
-
* //
|
|
855
|
+
* //emit when action starts
|
|
841
856
|
* searchEmbed.on(EmbedEvent.DownloadAsXlsx, payload => {
|
|
842
857
|
* console.log('download Xlsx', payload)}, { start: true })
|
|
843
|
-
* //
|
|
858
|
+
* //emit when action ends
|
|
844
859
|
* searchEmbed.on(EmbedEvent.DownloadAsXlsx, payload => {
|
|
845
860
|
* console.log('download Xlsx', payload)})
|
|
846
861
|
*```
|
|
@@ -852,7 +867,7 @@ var EmbedEvent;
|
|
|
852
867
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
|
|
853
868
|
* @example
|
|
854
869
|
*```js
|
|
855
|
-
* //
|
|
870
|
+
* //emit when action starts
|
|
856
871
|
* appEmbed.on(EmbedEvent.AnswerDelete, payload => {
|
|
857
872
|
* console.log('delete answer', payload)}, {start: true })
|
|
858
873
|
* //trigger when action is completed
|
|
@@ -867,13 +882,13 @@ var EmbedEvent;
|
|
|
867
882
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
|
|
868
883
|
* @example
|
|
869
884
|
*```js
|
|
870
|
-
* //
|
|
885
|
+
* //emit when action starts
|
|
871
886
|
* searchEmbed.on(EmbedEvent.Pin, payload => {
|
|
872
887
|
* console.log('pin', payload)
|
|
873
888
|
* }, {
|
|
874
889
|
* start: true
|
|
875
890
|
* })
|
|
876
|
-
* //
|
|
891
|
+
* //emit when action ends
|
|
877
892
|
* searchEmbed.on(EmbedEvent.Pin, payload => {
|
|
878
893
|
* console.log('pin', payload)
|
|
879
894
|
* })
|
|
@@ -886,13 +901,13 @@ var EmbedEvent;
|
|
|
886
901
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
|
|
887
902
|
* @example
|
|
888
903
|
*```js
|
|
889
|
-
* //
|
|
904
|
+
* //emit when action starts
|
|
890
905
|
* searchEmbed.on(EmbedEvent.SpotIQAnalyze, payload => {
|
|
891
906
|
* console.log('SpotIQAnalyze', payload)
|
|
892
907
|
* }, {
|
|
893
908
|
* start: true
|
|
894
909
|
* })
|
|
895
|
-
* //
|
|
910
|
+
* //emit when action ends
|
|
896
911
|
* searchEmbed.on(EmbedEvent.SpotIQAnalyze, payload => {
|
|
897
912
|
* console.log('SpotIQ analyze', payload)
|
|
898
913
|
* })
|
|
@@ -905,13 +920,13 @@ var EmbedEvent;
|
|
|
905
920
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
|
|
906
921
|
* @example
|
|
907
922
|
*```js
|
|
908
|
-
* //
|
|
923
|
+
* //emit when action starts
|
|
909
924
|
* searchEmbed.on(EmbedEvent.Share, payload => {
|
|
910
925
|
* console.log('Share', payload)
|
|
911
926
|
* }, {
|
|
912
927
|
* start: true
|
|
913
928
|
* })
|
|
914
|
-
* //
|
|
929
|
+
* //emit when action ends
|
|
915
930
|
* searchEmbed.on(EmbedEvent.Share, payload => {
|
|
916
931
|
* console.log('Share', payload)
|
|
917
932
|
* })
|
|
@@ -986,10 +1001,10 @@ var EmbedEvent;
|
|
|
986
1001
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
|
|
987
1002
|
* @example
|
|
988
1003
|
*```js
|
|
989
|
-
* //
|
|
1004
|
+
* //emit when action starts
|
|
990
1005
|
* searchEmbed.on(EmbedEvent.ExportTML, payload => {
|
|
991
1006
|
* console.log('Export TML', payload)}, { start: true })
|
|
992
|
-
* //
|
|
1007
|
+
* //emit when action ends
|
|
993
1008
|
* searchEmbed.on(EmbedEvent.ExportTML, payload => {
|
|
994
1009
|
* console.log('Export TML', payload)})
|
|
995
1010
|
*```
|
|
@@ -1013,10 +1028,10 @@ var EmbedEvent;
|
|
|
1013
1028
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
|
|
1014
1029
|
* @example
|
|
1015
1030
|
*```js
|
|
1016
|
-
* //
|
|
1031
|
+
* //emit when action starts
|
|
1017
1032
|
* appEmbed.on(EmbedEvent.CopyAEdit, payload => {
|
|
1018
1033
|
* console.log('Copy and edit', payload)}, {start: true })
|
|
1019
|
-
* //
|
|
1034
|
+
* //emit when action ends
|
|
1020
1035
|
* appEmbed.on(EmbedEvent.CopyAEdit, payload => {
|
|
1021
1036
|
* console.log('Copy and edit', payload)})
|
|
1022
1037
|
*```
|
|
@@ -1118,7 +1133,7 @@ var EmbedEvent;
|
|
|
1118
1133
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
|
|
1119
1134
|
* @example
|
|
1120
1135
|
*```js
|
|
1121
|
-
* liveboardEmbed.
|
|
1136
|
+
* liveboardEmbed.on(EmbedEvent.Present)
|
|
1122
1137
|
*```
|
|
1123
1138
|
* @example
|
|
1124
1139
|
*```js
|
|
@@ -1134,7 +1149,7 @@ var EmbedEvent;
|
|
|
1134
1149
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
|
|
1135
1150
|
* @example
|
|
1136
1151
|
*```js
|
|
1137
|
-
* liveboardEmbed.
|
|
1152
|
+
* liveboardEmbed.on(EmbedEvent.Delete,
|
|
1138
1153
|
* {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
|
|
1139
1154
|
*```
|
|
1140
1155
|
*/
|
|
@@ -1145,7 +1160,7 @@ var EmbedEvent;
|
|
|
1145
1160
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
|
|
1146
1161
|
* @example
|
|
1147
1162
|
*```js
|
|
1148
|
-
* liveboardEmbed.
|
|
1163
|
+
* liveboardEmbed.on(EmbedEvent.SchedulesList)
|
|
1149
1164
|
*```
|
|
1150
1165
|
*/
|
|
1151
1166
|
EmbedEvent["SchedulesList"] = "schedule-list";
|
|
@@ -1155,7 +1170,7 @@ var EmbedEvent;
|
|
|
1155
1170
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
|
|
1156
1171
|
* @example
|
|
1157
1172
|
*```js
|
|
1158
|
-
* liveboardEmbed.
|
|
1173
|
+
* liveboardEmbed.on(EmbedEvent.Cancel)
|
|
1159
1174
|
*```
|
|
1160
1175
|
*/
|
|
1161
1176
|
EmbedEvent["Cancel"] = "cancel";
|
|
@@ -1165,7 +1180,7 @@ var EmbedEvent;
|
|
|
1165
1180
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
|
|
1166
1181
|
* @example
|
|
1167
1182
|
*```js
|
|
1168
|
-
* liveboardEmbed.
|
|
1183
|
+
* liveboardEmbed.on(EmbedEvent.Explore, {
|
|
1169
1184
|
* vizId: '730496d6-6903-4601-937e-2c691821af3c'})
|
|
1170
1185
|
*```
|
|
1171
1186
|
*/
|
|
@@ -1176,7 +1191,7 @@ var EmbedEvent;
|
|
|
1176
1191
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
|
|
1177
1192
|
* @example
|
|
1178
1193
|
*```js
|
|
1179
|
-
* liveboardEmbed.
|
|
1194
|
+
* liveboardEmbed.on(EmbedEvent.CopyLink, {
|
|
1180
1195
|
* vizId: '730496d6-6903-4601-937e-2c691821af3c'})
|
|
1181
1196
|
*```
|
|
1182
1197
|
*/
|
|
@@ -1556,7 +1571,7 @@ var HostEvent;
|
|
|
1556
1571
|
*
|
|
1557
1572
|
* @example
|
|
1558
1573
|
* ```js
|
|
1559
|
-
* liveboardEmbed.trigger(HostEvent.
|
|
1574
|
+
* liveboardEmbed.trigger(HostEvent.getExportRequestForCurrentPinboard).then(
|
|
1560
1575
|
* data=>console.log(data))
|
|
1561
1576
|
* ```
|
|
1562
1577
|
* @version SDK: 1.13.0 | ThoughtSpot: 8.5.0.cl, 8.8.1.sw
|
|
@@ -2020,7 +2035,7 @@ var HostEvent;
|
|
|
2020
2035
|
*
|
|
2021
2036
|
* ```js
|
|
2022
2037
|
* liveboardEmbed.trigger(HostEvent.UpdateFilters, {
|
|
2023
|
-
* filter: { column: 'column name', oper: 'IN', values: [1,2,3]
|
|
2038
|
+
* filter: { column: 'column name', oper: 'IN', values: [1,2,3]}
|
|
2024
2039
|
* })
|
|
2025
2040
|
* ```
|
|
2026
2041
|
* @version SDK: 1.23.0 | ThoughtSpot: 9.4.0.cl
|
|
@@ -3177,7 +3192,7 @@ var Action;
|
|
|
3177
3192
|
* disabledActions: [Action.TML] // to disable all TML actions
|
|
3178
3193
|
* ```
|
|
3179
3194
|
*
|
|
3180
|
-
* @version SDK : 1.28.
|
|
3195
|
+
* @version SDK : 1.28.3 | Thoughtspot: 9.12.0.cl
|
|
3181
3196
|
*/
|
|
3182
3197
|
Action["TML"] = "tml";
|
|
3183
3198
|
/**
|
|
@@ -3475,7 +3490,10 @@ const getFilterQuery = (runtimeFilters) => {
|
|
|
3475
3490
|
const filterExpr = [];
|
|
3476
3491
|
filterExpr.push(`col${index}=${encodeURIComponent(filter.columnName)}`);
|
|
3477
3492
|
filterExpr.push(`op${index}=${filter.operator}`);
|
|
3478
|
-
filterExpr.push(filter.values.map((value) =>
|
|
3493
|
+
filterExpr.push(filter.values.map((value) => {
|
|
3494
|
+
const encodedValue = typeof value === 'bigint' ? value.toString() : value;
|
|
3495
|
+
return `val${index}=${encodeURIComponent(String(encodedValue))}`;
|
|
3496
|
+
}).join('&'));
|
|
3479
3497
|
return filterExpr.join('&');
|
|
3480
3498
|
});
|
|
3481
3499
|
return `${filters.join('&')}`;
|
|
@@ -5922,6 +5940,7 @@ var isEqual_1 = isEqual;
|
|
|
5922
5940
|
|
|
5923
5941
|
const EndPoints = {
|
|
5924
5942
|
AUTH_VERIFICATION: '/callosum/v1/session/info',
|
|
5943
|
+
SESSION_INFO: '/callosum/v1/session/info',
|
|
5925
5944
|
SAML_LOGIN_TEMPLATE: (targetUrl) => `/callosum/v1/saml/login?targetURLPath=${targetUrl}`,
|
|
5926
5945
|
OIDC_LOGIN_TEMPLATE: (targetUrl) => `/callosum/v1/oidc/login?targetURLPath=${targetUrl}`,
|
|
5927
5946
|
TOKEN_LOGIN: '/callosum/v1/session/login/token',
|
|
@@ -6038,8 +6057,10 @@ const DUPLICATE_TOKEN_ERR = 'Duplicate token, please issue a new token every tim
|
|
|
6038
6057
|
const INVALID_TOKEN_ERR = 'Invalid token received form token callback or authToken endpoint.';
|
|
6039
6058
|
let cachedAuthToken = null;
|
|
6040
6059
|
// This method can be used to get the authToken using the embedConfig
|
|
6041
|
-
|
|
6042
|
-
if
|
|
6060
|
+
async function getAuthenticationToken(embedConfig) {
|
|
6061
|
+
// Since we don't have token validation enabled , we cannot tell if the
|
|
6062
|
+
// cached token is valid or not. So we will always fetch a new token.
|
|
6063
|
+
if (cachedAuthToken && !embedConfig.disableTokenVerification) {
|
|
6043
6064
|
let isCachedTokenStillValid;
|
|
6044
6065
|
try {
|
|
6045
6066
|
isCachedTokenStillValid = await validateAuthToken(embedConfig, cachedAuthToken, true);
|
|
@@ -6059,12 +6080,22 @@ const getAuthenticationToken = async (embedConfig) => {
|
|
|
6059
6080
|
const response = await fetchAuthTokenService(authEndpoint);
|
|
6060
6081
|
authToken = await response.text();
|
|
6061
6082
|
}
|
|
6062
|
-
|
|
6063
|
-
|
|
6083
|
+
try {
|
|
6084
|
+
// this will throw error if the token is not valid
|
|
6085
|
+
await validateAuthToken(embedConfig, authToken);
|
|
6086
|
+
}
|
|
6087
|
+
catch (e) {
|
|
6088
|
+
logger.error(`Received invalid token from getAuthToken callback or authToken endpoint. Error : ${e.message}`);
|
|
6089
|
+
throw e;
|
|
6090
|
+
}
|
|
6064
6091
|
cachedAuthToken = authToken;
|
|
6065
6092
|
return authToken;
|
|
6066
|
-
}
|
|
6093
|
+
}
|
|
6067
6094
|
const validateAuthToken = async (embedConfig, authToken, suppressAlert) => {
|
|
6095
|
+
if (embedConfig.disableTokenVerification) {
|
|
6096
|
+
logger.info('Token verification is disabled. Assuming token is valid.');
|
|
6097
|
+
return true;
|
|
6098
|
+
}
|
|
6068
6099
|
try {
|
|
6069
6100
|
const isTokenValid = await verifyTokenService(embedConfig.thoughtSpotHost, authToken);
|
|
6070
6101
|
if (isTokenValid)
|
|
@@ -6341,6 +6372,16 @@ var OperationType;
|
|
|
6341
6372
|
* const data = await underlying.fetchData(0, 100);
|
|
6342
6373
|
* })
|
|
6343
6374
|
* ```
|
|
6375
|
+
* @example
|
|
6376
|
+
* ```js
|
|
6377
|
+
* embed.on(EmbedEvent.Data, async (e) => {
|
|
6378
|
+
* const service = await embed.getAnswerService();
|
|
6379
|
+
* await service.addColumns([
|
|
6380
|
+
* "<column guid>"
|
|
6381
|
+
* ]);
|
|
6382
|
+
* console.log(await service.fetchData());
|
|
6383
|
+
* });
|
|
6384
|
+
* ```
|
|
6344
6385
|
* @version SDK: 1.25.0| ThoughtSpot: 9.10.0.cl
|
|
6345
6386
|
* @group Events
|
|
6346
6387
|
*/
|
|
@@ -12681,6 +12722,7 @@ function emptyQueue() {
|
|
|
12681
12722
|
function initMixpanel(sessionInfo) {
|
|
12682
12723
|
var _a;
|
|
12683
12724
|
if (!sessionInfo || !sessionInfo.mixpanelToken) {
|
|
12725
|
+
logger.error('Mixpanel token not found in session info');
|
|
12684
12726
|
return;
|
|
12685
12727
|
}
|
|
12686
12728
|
// On a public cluster the user is anonymous, so don't set the identify to
|
|
@@ -13275,49 +13317,124 @@ var uniq_1 = uniq;
|
|
|
13275
13317
|
* @param url
|
|
13276
13318
|
* @param options
|
|
13277
13319
|
*/
|
|
13278
|
-
function
|
|
13320
|
+
function tokenizedFailureLoggedFetch(url, options = {}) {
|
|
13279
13321
|
return tokenizedFetch(url, options).then(async (r) => {
|
|
13280
13322
|
var _a;
|
|
13281
13323
|
if (!r.ok && r.type !== 'opaqueredirect' && r.type !== 'opaque') {
|
|
13282
|
-
logger.error(
|
|
13324
|
+
logger.error(`Failed to fetch ${url}`, await ((_a = r.text) === null || _a === void 0 ? void 0 : _a.call(r)));
|
|
13283
13325
|
}
|
|
13284
13326
|
return r;
|
|
13285
13327
|
});
|
|
13286
13328
|
}
|
|
13287
13329
|
/**
|
|
13330
|
+
* Fetches the session info from the ThoughtSpot server.
|
|
13288
13331
|
*
|
|
13289
|
-
* @param
|
|
13332
|
+
* @param thoughtspotHost
|
|
13333
|
+
* @returns {Promise<any>}
|
|
13334
|
+
* @example
|
|
13335
|
+
* ```js
|
|
13336
|
+
* const response = await sessionInfoService();
|
|
13337
|
+
* ```
|
|
13290
13338
|
*/
|
|
13291
|
-
function fetchSessionInfoService(
|
|
13292
|
-
|
|
13293
|
-
|
|
13294
|
-
|
|
13339
|
+
async function fetchSessionInfoService(thoughtspotHost) {
|
|
13340
|
+
const sessionInfoPath = `${thoughtspotHost}${EndPoints.SESSION_INFO}`;
|
|
13341
|
+
const response = await tokenizedFailureLoggedFetch(sessionInfoPath);
|
|
13342
|
+
if (!response.ok) {
|
|
13343
|
+
throw new Error(`Failed to fetch session info: ${response.statusText}`);
|
|
13344
|
+
}
|
|
13345
|
+
const data = await response.json();
|
|
13346
|
+
return data;
|
|
13295
13347
|
}
|
|
13296
13348
|
/**
|
|
13297
13349
|
*
|
|
13298
13350
|
* @param thoughtSpotHost
|
|
13299
13351
|
*/
|
|
13300
13352
|
async function fetchLogoutService(thoughtSpotHost) {
|
|
13301
|
-
return
|
|
13353
|
+
return tokenizedFailureLoggedFetch(`${thoughtSpotHost}${EndPoints.LOGOUT}`, {
|
|
13302
13354
|
credentials: 'include',
|
|
13303
13355
|
method: 'POST',
|
|
13304
13356
|
headers: {
|
|
13305
13357
|
'x-requested-by': 'ThoughtSpot',
|
|
13306
13358
|
},
|
|
13307
13359
|
});
|
|
13360
|
+
}
|
|
13361
|
+
/**
|
|
13362
|
+
* Is active service to check if the user is logged in.
|
|
13363
|
+
*
|
|
13364
|
+
* @param thoughtSpotHost
|
|
13365
|
+
* @version SDK: 1.28.4 | ThoughtSpot: *
|
|
13366
|
+
*/
|
|
13367
|
+
async function isActiveService(thoughtSpotHost) {
|
|
13368
|
+
const isActiveUrl = `${thoughtSpotHost}${EndPoints.IS_ACTIVE}`;
|
|
13369
|
+
try {
|
|
13370
|
+
const res = await tokenizedFetch(isActiveUrl, {
|
|
13371
|
+
credentials: 'include',
|
|
13372
|
+
});
|
|
13373
|
+
return res.ok;
|
|
13374
|
+
}
|
|
13375
|
+
catch (e) {
|
|
13376
|
+
logger.warn(`Is Logged In Service failed : ${e.message}`);
|
|
13377
|
+
}
|
|
13378
|
+
return false;
|
|
13308
13379
|
}
|
|
13309
13380
|
|
|
13381
|
+
let sessionInfo = null;
|
|
13382
|
+
/**
|
|
13383
|
+
* Returns the session info object and caches it for future use.
|
|
13384
|
+
* Once fetched the session info object is cached and returned from the cache on
|
|
13385
|
+
* subsequent calls.
|
|
13386
|
+
*
|
|
13387
|
+
* @example ```js
|
|
13388
|
+
* const sessionInfo = await getSessionInfo();
|
|
13389
|
+
* console.log(sessionInfo);
|
|
13390
|
+
* ```
|
|
13391
|
+
* @version SDK: 1.28.3 | ThoughtSpot: *
|
|
13392
|
+
* @returns {Promise<SessionInfo>} The session info object.
|
|
13393
|
+
*/
|
|
13394
|
+
async function getSessionInfo() {
|
|
13395
|
+
if (!sessionInfo) {
|
|
13396
|
+
const host = getEmbedConfig().thoughtSpotHost;
|
|
13397
|
+
const sessionResponse = await fetchSessionInfoService(host);
|
|
13398
|
+
const processedSessionInfo = getSessionDetails(sessionResponse);
|
|
13399
|
+
sessionInfo = processedSessionInfo;
|
|
13400
|
+
}
|
|
13401
|
+
return sessionInfo;
|
|
13402
|
+
}
|
|
13403
|
+
/**
|
|
13404
|
+
* Processes the session info response and returns the session info object.
|
|
13405
|
+
*
|
|
13406
|
+
* @param sessionInfoResp {any} Response from the session info API.
|
|
13407
|
+
* @returns {SessionInfo} The session info object.
|
|
13408
|
+
* @example ```js
|
|
13409
|
+
* const sessionInfoResp = await fetch(sessionInfoPath);
|
|
13410
|
+
* const sessionInfo = getSessionDetails(sessionInfoResp);
|
|
13411
|
+
* console.log(sessionInfo);
|
|
13412
|
+
* ```
|
|
13413
|
+
* @version SDK: 1.28.3 | ThoughtSpot: *
|
|
13414
|
+
*/
|
|
13415
|
+
const getSessionDetails = (sessionInfoResp) => {
|
|
13416
|
+
const devMixpanelToken = sessionInfoResp.configInfo.mixpanelConfig.devSdkKey;
|
|
13417
|
+
const prodMixpanelToken = sessionInfoResp.configInfo.mixpanelConfig.prodSdkKey;
|
|
13418
|
+
const mixpanelToken = sessionInfoResp.configInfo.mixpanelConfig.production
|
|
13419
|
+
? prodMixpanelToken
|
|
13420
|
+
: devMixpanelToken;
|
|
13421
|
+
return {
|
|
13422
|
+
userGUID: sessionInfoResp.userGUID,
|
|
13423
|
+
mixpanelToken,
|
|
13424
|
+
isPublicUser: sessionInfoResp.configInfo.isPublicUser,
|
|
13425
|
+
releaseVersion: sessionInfoResp.releaseVersion,
|
|
13426
|
+
clusterId: sessionInfoResp.configInfo.selfClusterId,
|
|
13427
|
+
clusterName: sessionInfoResp.configInfo.selfClusterName,
|
|
13428
|
+
...sessionInfoResp,
|
|
13429
|
+
};
|
|
13430
|
+
};
|
|
13431
|
+
|
|
13310
13432
|
// eslint-disable-next-line import/no-mutable-exports
|
|
13311
13433
|
let loggedInStatus = false;
|
|
13312
13434
|
// eslint-disable-next-line import/no-mutable-exports
|
|
13313
13435
|
let samlAuthWindow = null;
|
|
13314
13436
|
// eslint-disable-next-line import/no-mutable-exports
|
|
13315
13437
|
let samlCompletionPromise = null;
|
|
13316
|
-
let sessionInfo = null;
|
|
13317
|
-
let sessionInfoResolver = null;
|
|
13318
|
-
const sessionInfoPromise = new Promise((resolve) => {
|
|
13319
|
-
sessionInfoResolver = resolve;
|
|
13320
|
-
});
|
|
13321
13438
|
let releaseVersion = '';
|
|
13322
13439
|
const SSO_REDIRECTION_MARKER_GUID = '5e16222e-ef02-43e9-9fbd-24226bf3ce5b';
|
|
13323
13440
|
/**
|
|
@@ -13399,12 +13516,18 @@ function notifyAuthSDKSuccess() {
|
|
|
13399
13516
|
/**
|
|
13400
13517
|
*
|
|
13401
13518
|
*/
|
|
13402
|
-
function notifyAuthSuccess() {
|
|
13519
|
+
async function notifyAuthSuccess() {
|
|
13403
13520
|
if (!authEE) {
|
|
13404
13521
|
logger.error('SDK not initialized');
|
|
13405
13522
|
return;
|
|
13406
13523
|
}
|
|
13407
|
-
|
|
13524
|
+
try {
|
|
13525
|
+
const sessionInfo = await getSessionInfo();
|
|
13526
|
+
authEE.emit(AuthStatus.SUCCESS, sessionInfo);
|
|
13527
|
+
}
|
|
13528
|
+
catch (e) {
|
|
13529
|
+
logger.error('Failed to get session info');
|
|
13530
|
+
}
|
|
13408
13531
|
}
|
|
13409
13532
|
/**
|
|
13410
13533
|
*
|
|
@@ -13427,67 +13550,45 @@ function notifyLogout() {
|
|
|
13427
13550
|
}
|
|
13428
13551
|
authEE.emit(AuthStatus.LOGOUT);
|
|
13429
13552
|
}
|
|
13430
|
-
const initSession = (sessionDetails) => {
|
|
13431
|
-
const embedConfig = getEmbedConfig();
|
|
13432
|
-
if (sessionInfo == null) {
|
|
13433
|
-
sessionInfo = sessionDetails;
|
|
13434
|
-
if (!embedConfig.disableSDKTracking) {
|
|
13435
|
-
initMixpanel(sessionInfo);
|
|
13436
|
-
}
|
|
13437
|
-
sessionInfoResolver(sessionInfo);
|
|
13438
|
-
}
|
|
13439
|
-
};
|
|
13440
|
-
const getSessionDetails = (sessionInfoResp) => {
|
|
13441
|
-
const devMixpanelToken = sessionInfoResp.configInfo.mixpanelConfig.devSdkKey;
|
|
13442
|
-
const prodMixpanelToken = sessionInfoResp.configInfo.mixpanelConfig.prodSdkKey;
|
|
13443
|
-
const mixpanelToken = sessionInfoResp.configInfo.mixpanelConfig.production
|
|
13444
|
-
? prodMixpanelToken
|
|
13445
|
-
: devMixpanelToken;
|
|
13446
|
-
return {
|
|
13447
|
-
userGUID: sessionInfoResp.userGUID,
|
|
13448
|
-
mixpanelToken,
|
|
13449
|
-
isPublicUser: sessionInfoResp.configInfo.isPublicUser,
|
|
13450
|
-
releaseVersion: sessionInfoResp.releaseVersion,
|
|
13451
|
-
clusterId: sessionInfoResp.configInfo.selfClusterId,
|
|
13452
|
-
clusterName: sessionInfoResp.configInfo.selfClusterName,
|
|
13453
|
-
...sessionInfoResp,
|
|
13454
|
-
};
|
|
13455
|
-
};
|
|
13456
13553
|
/**
|
|
13457
13554
|
* Check if we are logged into the ThoughtSpot cluster
|
|
13458
13555
|
*
|
|
13459
13556
|
* @param thoughtSpotHost The ThoughtSpot cluster hostname or IP
|
|
13460
13557
|
*/
|
|
13461
13558
|
async function isLoggedIn(thoughtSpotHost) {
|
|
13462
|
-
const authVerificationUrl = `${thoughtSpotHost}${EndPoints.AUTH_VERIFICATION}`;
|
|
13463
|
-
let response = null;
|
|
13464
13559
|
try {
|
|
13465
|
-
response = await
|
|
13466
|
-
|
|
13467
|
-
const sessionDetails = getSessionDetails(sessionInfoResp);
|
|
13468
|
-
// Store user session details from session info
|
|
13469
|
-
initSession(sessionDetails);
|
|
13470
|
-
releaseVersion = sessionInfoResp.releaseVersion;
|
|
13560
|
+
const response = await isActiveService(thoughtSpotHost);
|
|
13561
|
+
return response;
|
|
13471
13562
|
}
|
|
13472
13563
|
catch (e) {
|
|
13473
13564
|
return false;
|
|
13474
13565
|
}
|
|
13475
|
-
return response.status === 200;
|
|
13476
13566
|
}
|
|
13477
13567
|
/**
|
|
13478
|
-
*
|
|
13568
|
+
* Services to be called after the login is successful,
|
|
13569
|
+
* This should be called after the cookie is set for cookie auth or
|
|
13570
|
+
* after the token is set for cookieless.
|
|
13571
|
+
*
|
|
13572
|
+
* @return {Promise<void>}
|
|
13573
|
+
* @example
|
|
13574
|
+
* ```js
|
|
13575
|
+
* await postLoginService();
|
|
13576
|
+
* ```
|
|
13577
|
+
* @version SDK: 1.28.3 | ThoughtSpot: *
|
|
13479
13578
|
*/
|
|
13480
|
-
function
|
|
13481
|
-
|
|
13579
|
+
async function postLoginService() {
|
|
13580
|
+
const sessionInfo = await getSessionInfo();
|
|
13581
|
+
releaseVersion = sessionInfo.releaseVersion;
|
|
13582
|
+
const embedConfig = getEmbedConfig();
|
|
13583
|
+
if (!embedConfig.disableSDKTracking) {
|
|
13584
|
+
initMixpanel(sessionInfo);
|
|
13585
|
+
}
|
|
13482
13586
|
}
|
|
13483
13587
|
/**
|
|
13484
|
-
* Return
|
|
13485
|
-
* authentication is successful. And info is available.
|
|
13486
|
-
*
|
|
13487
|
-
* @group Global methods
|
|
13588
|
+
* Return releaseVersion if available
|
|
13488
13589
|
*/
|
|
13489
|
-
function
|
|
13490
|
-
return
|
|
13590
|
+
function getReleaseVersion() {
|
|
13591
|
+
return releaseVersion;
|
|
13491
13592
|
}
|
|
13492
13593
|
/**
|
|
13493
13594
|
* Check if we are stuck at the SSO redirect URL
|
|
@@ -13518,7 +13619,14 @@ const doTokenAuth = async (embedConfig) => {
|
|
|
13518
13619
|
}
|
|
13519
13620
|
loggedInStatus = await isLoggedIn(thoughtSpotHost);
|
|
13520
13621
|
if (!loggedInStatus) {
|
|
13521
|
-
|
|
13622
|
+
let authToken;
|
|
13623
|
+
try {
|
|
13624
|
+
authToken = await getAuthenticationToken(embedConfig);
|
|
13625
|
+
}
|
|
13626
|
+
catch (e) {
|
|
13627
|
+
loggedInStatus = false;
|
|
13628
|
+
throw e;
|
|
13629
|
+
}
|
|
13522
13630
|
let resp;
|
|
13523
13631
|
try {
|
|
13524
13632
|
resp = await fetchAuthPostService(thoughtSpotHost, username, authToken);
|
|
@@ -13676,7 +13784,7 @@ const logout = async (embedConfig) => {
|
|
|
13676
13784
|
const { thoughtSpotHost } = embedConfig;
|
|
13677
13785
|
await fetchLogoutService(thoughtSpotHost);
|
|
13678
13786
|
resetCachedAuthToken();
|
|
13679
|
-
const thoughtspotIframes = document.querySelectorAll(
|
|
13787
|
+
const thoughtspotIframes = document.querySelectorAll("[data-ts-iframe='true']");
|
|
13680
13788
|
if (thoughtspotIframes === null || thoughtspotIframes === void 0 ? void 0 : thoughtspotIframes.length) {
|
|
13681
13789
|
thoughtspotIframes.forEach((el) => {
|
|
13682
13790
|
el.parentElement.innerHTML = embedConfig.loginFailedMessage;
|
|
@@ -13731,6 +13839,8 @@ const handleAuth = () => {
|
|
|
13731
13839
|
notifyAuthFailure(AuthFailureType.SDK);
|
|
13732
13840
|
}
|
|
13733
13841
|
else {
|
|
13842
|
+
// Post login service is called after successful login.
|
|
13843
|
+
postLoginService();
|
|
13734
13844
|
notifyAuthSDKSuccess();
|
|
13735
13845
|
}
|
|
13736
13846
|
}, () => {
|
|
@@ -14026,13 +14136,13 @@ function processCustomAction(e, thoughtSpotHost) {
|
|
|
14026
14136
|
};
|
|
14027
14137
|
}
|
|
14028
14138
|
/**
|
|
14139
|
+
* Responds to AuthInit sent from host signifying successful authentication in host.
|
|
14029
14140
|
*
|
|
14030
14141
|
* @param e
|
|
14142
|
+
* @returns {any}
|
|
14031
14143
|
*/
|
|
14032
14144
|
function processAuthInit(e) {
|
|
14033
14145
|
var _a, _b;
|
|
14034
|
-
// Store user session details sent by app.
|
|
14035
|
-
initSession(e.data);
|
|
14036
14146
|
notifyAuthSuccess();
|
|
14037
14147
|
// Expose only allowed details (eg: userGUID) back to SDK users.
|
|
14038
14148
|
return {
|
|
@@ -14170,7 +14280,7 @@ function processTrigger(iFrame, messageType, thoughtSpotHost, data) {
|
|
|
14170
14280
|
});
|
|
14171
14281
|
}
|
|
14172
14282
|
|
|
14173
|
-
var name="@thoughtspot/visual-embed-sdk";var version="1.29.0-alpha.
|
|
14283
|
+
var name="@thoughtspot/visual-embed-sdk";var version="1.29.0-alpha.SCAL-205893-1";var description="ThoughtSpot Embed SDK";var module="lib/src/index.js";var main="dist/tsembed.js";var types="lib/src/index.d.ts";var files=["dist/**","lib/**","src/**","cjs/**"];var exports={".":{"import":"./lib/src/index.js",require:"./cjs/src/index.js",types:"./lib/src/index.d.ts"},"./react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"},"./lib/src/react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"}};var typesVersions={"*":{react:["./lib/src/react/all-types-export.d.ts"]}};var scripts={lint:"eslint 'src/**'","lint:fix":"eslint 'src/**/*.*' --fix",tsc:"tsc -p . --incremental false; tsc -p . --incremental false --module commonjs --outDir cjs",start:"gatsby develop","build:gatsby":"npm run clean:gatsby && gatsby build --prefix-paths","build:gatsby:noprefix":"npm run clean:gatsby && gatsby build","serve:gatsby":"gatsby serve","clean:gatsby":"gatsby clean","build-and-publish":"npm run build:gatsby && npm run publish","bundle-dts-file":"dts-bundle --name @thoughtspot/visual-embed-sdk --out visual-embed-sdk.d.ts --main lib/src/index.d.ts","bundle-dts":"dts-bundle --name ../../dist/visual-embed-sdk --main lib/src/index.d.ts --outputAsModuleFolder=true","bundle-dts-react":"dts-bundle --name ../../../dist/visual-embed-sdk-react --main lib/src/react/index.d.ts --outputAsModuleFolder=true","bundle-dts-react-full":"dts-bundle --name ../../../dist/visual-embed-sdk-react-full --main lib/src/react/all-types-export.d.ts --outputAsModuleFolder=true",build:"rollup -c",watch:"rollup -cw","docs-cmd":"node scripts/gatsby-commands.js",docgen:"typedoc --tsconfig tsconfig.json --theme typedoc-theme","test-sdk":"jest -c jest.config.sdk.js --runInBand","test-docs":"jest -c jest.config.docs.js",test:"npm run test-sdk && npm run test-docs",posttest:"cat ./coverage/sdk/lcov.info | coveralls","is-publish-allowed":"node scripts/is-publish-allowed.js",prepublishOnly:"npm run is-publish-allowed && npm run test && npm run tsc && npm run bundle-dts-file && npm run bundle-dts && npm run bundle-dts-react && npm run bundle-dts-react-full && npm run build","check-size":"npm run build && size-limit","publish-dev":"npm publish --tag dev","publish-prod":"npm publish --tag latest"};var peerDependencies={react:"> 16.8.0","react-dom":"> 16.8.0"};var dependencies={algoliasearch:"^4.10.5",classnames:"^2.3.1",dompurify:"^2.3.4","eslint-plugin-comment-length":"^0.9.2","eslint-plugin-jsdoc":"^46.9.0",eventemitter3:"^4.0.7","gatsby-plugin-vercel":"^1.0.3","html-react-parser":"^1.4.12",lodash:"^4.17.21","mixpanel-browser":"^2.45.0","ts-deepmerge":"^6.0.2",tslib:"^2.5.3","use-deep-compare-effect":"^1.8.1"};var devDependencies={"@mdx-js/mdx":"^1.6.22","@mdx-js/react":"^1.6.22","@react-icons/all-files":"^4.1.0","@rollup/plugin-commonjs":"^18.0.0","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^11.2.1","@rollup/plugin-replace":"^5.0.2","@size-limit/preset-big-lib":"^8.2.6","@testing-library/dom":"^7.31.0","@testing-library/jest-dom":"^5.14.1","@testing-library/react":"^11.2.7","@testing-library/user-event":"^13.1.8","@types/jest":"^22.2.3","@types/mixpanel-browser":"^2.35.6","@types/react-test-renderer":"^17.0.1","@typescript-eslint/eslint-plugin":"^4.6.0","@typescript-eslint/parser":"^4.6.0",asciidoctor:"^2.2.1","babel-jest":"^26.6.3","babel-preset-gatsby":"^1.10.0","command-line-args":"^5.1.1",coveralls:"^3.1.0","current-git-branch":"^1.1.0","dts-bundle":"^0.7.3",eslint:"^7.12.1","eslint-config-airbnb-base":"^14.2.0","eslint-config-prettier":"^6.15.0","eslint-import-resolver-typescript":"^2.3.0","eslint-plugin-import":"^2.22.1","eslint-plugin-prettier":"^3.1.4","eslint-plugin-react-hooks":"^4.2.0","fs-extra":"^10.0.0",gatsby:"3.13.1","gatsby-plugin-algolia":"^0.22.2","gatsby-plugin-catch-links":"^3.1.0","gatsby-plugin-env-variables":"^2.1.0","gatsby-plugin-intl":"^0.3.3","gatsby-plugin-manifest":"^3.2.0","gatsby-plugin-output":"^0.1.3","gatsby-plugin-sass":"6.7.0","gatsby-plugin-sitemap":"^4.10.0","gatsby-source-filesystem":"3.1.0","gatsby-transformer-asciidoc":"2.1.0","gatsby-transformer-rehype":"2.0.0","gh-pages":"^3.1.0","highlight.js":"^10.6.0","html-to-text":"^8.0.0","identity-obj-proxy":"^3.0.0","istanbul-merge":"^1.1.1",jest:"^26.6.3","jest-fetch-mock":"^3.0.3",jsdom:"^17.0.0","node-sass":"^8.0.0",prettier:"2.1.2",react:"^16.14.0","react-dom":"^16.14.0","react-resizable":"^1.11.0","react-resize-detector":"^6.6.0","react-test-renderer":"^17.0.2","react-use-flexsearch":"^0.1.1",rollup:"2.30.0","rollup-plugin-typescript2":"0.27.3","ts-jest":"^26.5.5","ts-loader":"8.0.4",typedoc:"0.21.6","typedoc-plugin-toc-group":"thoughtspot/typedoc-plugin-toc-group",typescript:"^4.9.4","url-search-params-polyfill":"^8.1.0",util:"^0.12.4"};var author="ThoughtSpot";var email="support@thoughtspot.com";var license="ThoughtSpot Development Tools End User License Agreement";var directories={lib:"lib"};var repository={type:"git",url:"git+https://github.com/thoughtspot/visual-embed-sdk.git"};var publishConfig={registry:"https://registry.npmjs.org"};var keywords=["thoughtspot","everywhere","embedded","embed","sdk","analytics"];var bugs={url:"https://github.com/thoughtspot/visual-embed-sdk/issues"};var homepage="https://github.com/thoughtspot/visual-embed-sdk#readme";var globals={window:{}};var pkgInfo = {name:name,version:version,description:description,module:module,main:main,types:types,files:files,exports:exports,typesVersions:typesVersions,"size-limit":[{path:"dist/tsembed.js",limit:"45 kB"}],scripts:scripts,peerDependencies:peerDependencies,dependencies:dependencies,devDependencies:devDependencies,author:author,email:email,license:license,directories:directories,repository:repository,publishConfig:publishConfig,keywords:keywords,bugs:bugs,homepage:homepage,globals:globals};
|
|
14174
14284
|
|
|
14175
14285
|
/**
|
|
14176
14286
|
* Copyright (c) 2022
|
|
@@ -14270,6 +14380,7 @@ class TsEmbed {
|
|
|
14270
14380
|
});
|
|
14271
14381
|
}
|
|
14272
14382
|
catch (e) {
|
|
14383
|
+
logger.error(`Received invalid token. Error : ${e === null || e === void 0 ? void 0 : e.message}`);
|
|
14273
14384
|
processAuthFailure(e, this.isPreRendered ? this.preRenderWrapper : this.el);
|
|
14274
14385
|
}
|
|
14275
14386
|
}
|
|
@@ -14614,6 +14725,7 @@ class TsEmbed {
|
|
|
14614
14725
|
* @param url - The URL of the embedded ThoughtSpot app.
|
|
14615
14726
|
*/
|
|
14616
14727
|
async renderIFrame(url) {
|
|
14728
|
+
console.log('here 7');
|
|
14617
14729
|
if (this.isError) {
|
|
14618
14730
|
return null;
|
|
14619
14731
|
}
|
|
@@ -14621,8 +14733,10 @@ class TsEmbed {
|
|
|
14621
14733
|
this.throwInitError();
|
|
14622
14734
|
}
|
|
14623
14735
|
if (url.length > URL_MAX_LENGTH) ;
|
|
14736
|
+
console.log('here 8');
|
|
14624
14737
|
return renderInQueue((nextInQueue) => {
|
|
14625
14738
|
var _a;
|
|
14739
|
+
console.log('here 6');
|
|
14626
14740
|
const initTimestamp = Date.now();
|
|
14627
14741
|
this.executeCallbacks(EmbedEvent.Init, {
|
|
14628
14742
|
data: {
|
|
@@ -14632,6 +14746,7 @@ class TsEmbed {
|
|
|
14632
14746
|
});
|
|
14633
14747
|
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_RENDER_START);
|
|
14634
14748
|
return (_a = getAuthPromise()) === null || _a === void 0 ? void 0 : _a.then((isLoggedIn) => {
|
|
14749
|
+
console.log('here 9', isLoggedIn);
|
|
14635
14750
|
if (!isLoggedIn) {
|
|
14636
14751
|
this.handleInsertionIntoDOM(this.embedConfig.loginFailedMessage);
|
|
14637
14752
|
return;
|
|
@@ -14655,7 +14770,9 @@ class TsEmbed {
|
|
|
14655
14770
|
this.iFrame.addEventListener('error', () => {
|
|
14656
14771
|
nextInQueue();
|
|
14657
14772
|
});
|
|
14773
|
+
console.log('here 10', this.iFrame);
|
|
14658
14774
|
this.handleInsertionIntoDOM(this.iFrame);
|
|
14775
|
+
console.log('here 11', document.body.innerHTML);
|
|
14659
14776
|
const prefetchIframe = document.querySelectorAll('.prefetchIframe');
|
|
14660
14777
|
if (prefetchIframe.length) {
|
|
14661
14778
|
prefetchIframe.forEach((el) => {
|