@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-react.js
CHANGED
|
@@ -187,7 +187,10 @@
|
|
|
187
187
|
const filterExpr = [];
|
|
188
188
|
filterExpr.push(`col${index}=${encodeURIComponent(filter.columnName)}`);
|
|
189
189
|
filterExpr.push(`op${index}=${filter.operator}`);
|
|
190
|
-
filterExpr.push(filter.values.map((value) =>
|
|
190
|
+
filterExpr.push(filter.values.map((value) => {
|
|
191
|
+
const encodedValue = typeof value === 'bigint' ? value.toString() : value;
|
|
192
|
+
return `val${index}=${encodeURIComponent(String(encodedValue))}`;
|
|
193
|
+
}).join('&'));
|
|
191
194
|
return filterExpr.join('&');
|
|
192
195
|
});
|
|
193
196
|
return `${filters.join('&')}`;
|
|
@@ -732,6 +735,8 @@
|
|
|
732
735
|
/**
|
|
733
736
|
* Authentication has either succeeded or failed.
|
|
734
737
|
*
|
|
738
|
+
* @version SDK: 1.1.0 | ThoughtSpot: ts7.may.cl, 8.4.1.sw
|
|
739
|
+
*
|
|
735
740
|
* @example
|
|
736
741
|
*```js
|
|
737
742
|
* appEmbed.on(EmbedEvent.AuthInit, payload => {
|
|
@@ -745,6 +750,8 @@
|
|
|
745
750
|
* The embed object container has loaded.
|
|
746
751
|
*
|
|
747
752
|
* @returns timestamp - The timestamp when the event was generated.
|
|
753
|
+
*
|
|
754
|
+
* @version SDK: 1.1.0 | ThoughtSpot: ts7.may.cl, 8.4.1.sw
|
|
748
755
|
* @example
|
|
749
756
|
*```js
|
|
750
757
|
* liveboardEmbed.on(EmbedEvent.Load, hideLoader)
|
|
@@ -759,6 +766,8 @@
|
|
|
759
766
|
* Data pertaining to answer or Liveboard is received
|
|
760
767
|
*
|
|
761
768
|
* @return data - The answer or Liveboard data
|
|
769
|
+
*
|
|
770
|
+
* @version SDK: 1.1.0 | ThoughtSpot: ts7.may.cl, 8.4.1.sw
|
|
762
771
|
* @example
|
|
763
772
|
*```js
|
|
764
773
|
* liveboardEmbed.on(EmbedEvent.Data, payload => {
|
|
@@ -777,6 +786,7 @@
|
|
|
777
786
|
/**
|
|
778
787
|
* Search query has been updated by the user.
|
|
779
788
|
*
|
|
789
|
+
* @version SDK: 1.4.0 | ThoughtSpot: ts7.sep.cl, 8.4.1.sw
|
|
780
790
|
* @example
|
|
781
791
|
*```js
|
|
782
792
|
* searchEmbed.on(EmbedEvent.QueryChanged, payload => console.log('data', payload))
|
|
@@ -786,12 +796,14 @@
|
|
|
786
796
|
/**
|
|
787
797
|
* A drill-down operation has been performed.
|
|
788
798
|
*
|
|
799
|
+
* @version SDK: 1.1.0 | ThoughtSpot: ts7.may.cl, 8.4.1.sw
|
|
800
|
+
*
|
|
789
801
|
* @returns additionalFilters - Any additional filters applied
|
|
790
802
|
* @returns drillDownColumns - The columns on which drill down was performed
|
|
791
803
|
* @returns nonFilteredColumns - The columns that were not filtered
|
|
792
804
|
* @example
|
|
793
805
|
*```js
|
|
794
|
-
* searchEmbed.
|
|
806
|
+
* searchEmbed.on(EmbedEvent.DrillDown, {
|
|
795
807
|
* points: {
|
|
796
808
|
* clickedPoint,
|
|
797
809
|
* selectedPoints: selectedPoint
|
|
@@ -824,6 +836,8 @@
|
|
|
824
836
|
* One or more data sources have been selected.
|
|
825
837
|
*
|
|
826
838
|
* @returns dataSourceIds - the list of data sources
|
|
839
|
+
*
|
|
840
|
+
* @version SDK: 1.1.0 | ThoughtSpot: ts7.may.cl, 8.4.1.sw
|
|
827
841
|
* @example
|
|
828
842
|
* ```js
|
|
829
843
|
* searchEmbed.on(EmbedEvent.DataSourceSelected, payload => {
|
|
@@ -851,6 +865,8 @@
|
|
|
851
865
|
* @returns actionId - ID of the custom action
|
|
852
866
|
* @returns payload {@link CustomActionPayload} - Response payload with the
|
|
853
867
|
* Answer or Liveboard data
|
|
868
|
+
*
|
|
869
|
+
* @version SDK: 1.1.0 | ThoughtSpot: ts7.may.cl, 8.4.1.sw
|
|
854
870
|
* @example
|
|
855
871
|
* ```js
|
|
856
872
|
* appEmbed.on(EmbedEvent.customAction, payload => {
|
|
@@ -898,21 +914,18 @@
|
|
|
898
914
|
/**
|
|
899
915
|
* An error has occurred. This event is fired for the following error types:
|
|
900
916
|
*
|
|
901
|
-
* API - API call failure error.
|
|
902
|
-
*
|
|
903
|
-
*
|
|
917
|
+
* `API` - API call failure error.
|
|
918
|
+
* `FULLSCREEN` - Error when presenting a Liveboard or visualization in full screen mode.
|
|
919
|
+
* `SINGLE_VALUE_FILTER` - Error due to multiple values in the single value filter.
|
|
920
|
+
* `NON_EXIST_FILTER` - Error due to a non-existent filter.
|
|
921
|
+
* `INVALID_DATE_VALUE` - Invalid date value error.
|
|
922
|
+
* `INVALID_OPERATOR` - Use of invalid operator during filter application.
|
|
904
923
|
*
|
|
905
|
-
*
|
|
906
|
-
*
|
|
907
|
-
* NON_EXIST_FILTER - Error due to a non-existent filter.
|
|
908
|
-
*
|
|
909
|
-
* INVALID_DATE_VALUE - Invalid date value error.
|
|
910
|
-
*
|
|
911
|
-
* INVALID_OPERATOR - Use of invalid operator during filter application.
|
|
912
|
-
*
|
|
913
|
-
* For more information, see [Developer Documentation](https://developers.thoughtspot.com/docs/events-app-integration#errorType)
|
|
924
|
+
* For more information, see https://developers.thoughtspot.com/docs/events-app-integration#errorType
|
|
914
925
|
*
|
|
915
926
|
* @returns error - An error object or message
|
|
927
|
+
*
|
|
928
|
+
* @version SDK: 1.1.0 | ThoughtSpot: ts7.may.cl, 8.4.1.sw
|
|
916
929
|
* @example
|
|
917
930
|
* ```js
|
|
918
931
|
* // API error
|
|
@@ -938,6 +951,9 @@
|
|
|
938
951
|
* The embedded object has sent an alert.
|
|
939
952
|
*
|
|
940
953
|
* @returns alert - An alert object
|
|
954
|
+
*
|
|
955
|
+
* @version SDK: 1.1.0 | ThoughtSpot: ts7.may.cl, 8.4.1.sw
|
|
956
|
+
*
|
|
941
957
|
* @example
|
|
942
958
|
* ```js
|
|
943
959
|
* searchEmbed.on(EmbedEvent.Alert)
|
|
@@ -947,6 +963,8 @@
|
|
|
947
963
|
/**
|
|
948
964
|
* The ThoughtSpot auth session has expired.
|
|
949
965
|
*
|
|
966
|
+
* @version SDK: 1.4.0 | ThoughtSpot: ts7.sep.cl, 8.4.1.sw
|
|
967
|
+
*
|
|
950
968
|
* @example
|
|
951
969
|
*```js
|
|
952
970
|
* appEmbed.on(EmbedEvent.AuthExpire, showAuthExpired)
|
|
@@ -1000,6 +1018,7 @@
|
|
|
1000
1018
|
/**
|
|
1001
1019
|
* Detects the route change.
|
|
1002
1020
|
*
|
|
1021
|
+
* @version SDK: 1.7.0 | ThoughtSpot: 8.0.0.cl, 8.4.1.sw
|
|
1003
1022
|
* @example
|
|
1004
1023
|
*```js
|
|
1005
1024
|
* searchEmbed.on(EmbedEvent.RouteChange, payload =>
|
|
@@ -1080,8 +1099,7 @@
|
|
|
1080
1099
|
*/
|
|
1081
1100
|
EmbedEvent["LiveboardRendered"] = "PinboardRendered";
|
|
1082
1101
|
/**
|
|
1083
|
-
*
|
|
1084
|
-
* is triggered on all events.
|
|
1102
|
+
* Emits all events.
|
|
1085
1103
|
*
|
|
1086
1104
|
* @Version SDK: 1.10.0 | ThoughtSpot: 8.2.0.cl, 8.4.1.sw
|
|
1087
1105
|
* @example
|
|
@@ -1098,13 +1116,13 @@
|
|
|
1098
1116
|
* @Version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
|
|
1099
1117
|
* @example
|
|
1100
1118
|
*```js
|
|
1101
|
-
* //
|
|
1119
|
+
* //Emit when action starts
|
|
1102
1120
|
* searchEmbed.on(EmbedEvent.Save, payload => {
|
|
1103
1121
|
* console.log('Save', payload)
|
|
1104
1122
|
* }, {
|
|
1105
1123
|
* start: true
|
|
1106
1124
|
* })
|
|
1107
|
-
* //
|
|
1125
|
+
* //emit when action ends
|
|
1108
1126
|
* searchEmbed.on(EmbedEvent.Save, payload => {
|
|
1109
1127
|
* console.log('Save', payload)
|
|
1110
1128
|
* })
|
|
@@ -1122,7 +1140,7 @@
|
|
|
1122
1140
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
|
|
1123
1141
|
* @example
|
|
1124
1142
|
*```js
|
|
1125
|
-
* liveboardEmbed.
|
|
1143
|
+
* liveboardEmbed.on(EmbedEvent.Download, {
|
|
1126
1144
|
* vizId: '730496d6-6903-4601-937e-2c691821af3c'
|
|
1127
1145
|
* })
|
|
1128
1146
|
*```
|
|
@@ -1134,10 +1152,10 @@
|
|
|
1134
1152
|
* @version SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl, 9.4.0.sw
|
|
1135
1153
|
* @example
|
|
1136
1154
|
*```js
|
|
1137
|
-
* //
|
|
1155
|
+
* //emit when action starts
|
|
1138
1156
|
* searchEmbed.on(EmbedEvent.DownloadAsPng, payload => {
|
|
1139
1157
|
* console.log('download PNG', payload)}, {start: true })
|
|
1140
|
-
* //
|
|
1158
|
+
* //emit when action ends
|
|
1141
1159
|
* searchEmbed.on(EmbedEvent.DownloadAsPng, payload => {
|
|
1142
1160
|
* console.log('download PNG', payload)})
|
|
1143
1161
|
*```
|
|
@@ -1149,10 +1167,10 @@
|
|
|
1149
1167
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
|
|
1150
1168
|
* @example
|
|
1151
1169
|
*```js
|
|
1152
|
-
* //
|
|
1170
|
+
* //emit when action starts
|
|
1153
1171
|
* searchEmbed.on(EmbedEvent.DownloadAsPdf, payload => {
|
|
1154
1172
|
* console.log('download PDF', payload)}, {start: true })
|
|
1155
|
-
* //
|
|
1173
|
+
* //emit when action ends
|
|
1156
1174
|
* searchEmbed.on(EmbedEvent.DownloadAsPdf, payload => {
|
|
1157
1175
|
* console.log('download PDF', payload)})
|
|
1158
1176
|
*```
|
|
@@ -1164,10 +1182,10 @@
|
|
|
1164
1182
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
|
|
1165
1183
|
* @example
|
|
1166
1184
|
*```js
|
|
1167
|
-
* //
|
|
1185
|
+
* //emit when action starts
|
|
1168
1186
|
* searchEmbed.on(EmbedEvent.DownloadAsCSV, payload => {
|
|
1169
1187
|
* console.log('download CSV', payload)}, {start: true })
|
|
1170
|
-
* //
|
|
1188
|
+
* //emit when action ends
|
|
1171
1189
|
* searchEmbed.on(EmbedEvent.DownloadAsCSV, payload => {
|
|
1172
1190
|
* console.log('download CSV', payload)})
|
|
1173
1191
|
*```
|
|
@@ -1179,10 +1197,10 @@
|
|
|
1179
1197
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
|
|
1180
1198
|
* @example
|
|
1181
1199
|
*```js
|
|
1182
|
-
* //
|
|
1200
|
+
* //emit when action starts
|
|
1183
1201
|
* searchEmbed.on(EmbedEvent.DownloadAsXlsx, payload => {
|
|
1184
1202
|
* console.log('download Xlsx', payload)}, { start: true })
|
|
1185
|
-
* //
|
|
1203
|
+
* //emit when action ends
|
|
1186
1204
|
* searchEmbed.on(EmbedEvent.DownloadAsXlsx, payload => {
|
|
1187
1205
|
* console.log('download Xlsx', payload)})
|
|
1188
1206
|
*```
|
|
@@ -1194,7 +1212,7 @@
|
|
|
1194
1212
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
|
|
1195
1213
|
* @example
|
|
1196
1214
|
*```js
|
|
1197
|
-
* //
|
|
1215
|
+
* //emit when action starts
|
|
1198
1216
|
* appEmbed.on(EmbedEvent.AnswerDelete, payload => {
|
|
1199
1217
|
* console.log('delete answer', payload)}, {start: true })
|
|
1200
1218
|
* //trigger when action is completed
|
|
@@ -1209,13 +1227,13 @@
|
|
|
1209
1227
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
|
|
1210
1228
|
* @example
|
|
1211
1229
|
*```js
|
|
1212
|
-
* //
|
|
1230
|
+
* //emit when action starts
|
|
1213
1231
|
* searchEmbed.on(EmbedEvent.Pin, payload => {
|
|
1214
1232
|
* console.log('pin', payload)
|
|
1215
1233
|
* }, {
|
|
1216
1234
|
* start: true
|
|
1217
1235
|
* })
|
|
1218
|
-
* //
|
|
1236
|
+
* //emit when action ends
|
|
1219
1237
|
* searchEmbed.on(EmbedEvent.Pin, payload => {
|
|
1220
1238
|
* console.log('pin', payload)
|
|
1221
1239
|
* })
|
|
@@ -1228,13 +1246,13 @@
|
|
|
1228
1246
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
|
|
1229
1247
|
* @example
|
|
1230
1248
|
*```js
|
|
1231
|
-
* //
|
|
1249
|
+
* //emit when action starts
|
|
1232
1250
|
* searchEmbed.on(EmbedEvent.SpotIQAnalyze, payload => {
|
|
1233
1251
|
* console.log('SpotIQAnalyze', payload)
|
|
1234
1252
|
* }, {
|
|
1235
1253
|
* start: true
|
|
1236
1254
|
* })
|
|
1237
|
-
* //
|
|
1255
|
+
* //emit when action ends
|
|
1238
1256
|
* searchEmbed.on(EmbedEvent.SpotIQAnalyze, payload => {
|
|
1239
1257
|
* console.log('SpotIQ analyze', payload)
|
|
1240
1258
|
* })
|
|
@@ -1247,13 +1265,13 @@
|
|
|
1247
1265
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
|
|
1248
1266
|
* @example
|
|
1249
1267
|
*```js
|
|
1250
|
-
* //
|
|
1268
|
+
* //emit when action starts
|
|
1251
1269
|
* searchEmbed.on(EmbedEvent.Share, payload => {
|
|
1252
1270
|
* console.log('Share', payload)
|
|
1253
1271
|
* }, {
|
|
1254
1272
|
* start: true
|
|
1255
1273
|
* })
|
|
1256
|
-
* //
|
|
1274
|
+
* //emit when action ends
|
|
1257
1275
|
* searchEmbed.on(EmbedEvent.Share, payload => {
|
|
1258
1276
|
* console.log('Share', payload)
|
|
1259
1277
|
* })
|
|
@@ -1328,10 +1346,10 @@
|
|
|
1328
1346
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
|
|
1329
1347
|
* @example
|
|
1330
1348
|
*```js
|
|
1331
|
-
* //
|
|
1349
|
+
* //emit when action starts
|
|
1332
1350
|
* searchEmbed.on(EmbedEvent.ExportTML, payload => {
|
|
1333
1351
|
* console.log('Export TML', payload)}, { start: true })
|
|
1334
|
-
* //
|
|
1352
|
+
* //emit when action ends
|
|
1335
1353
|
* searchEmbed.on(EmbedEvent.ExportTML, payload => {
|
|
1336
1354
|
* console.log('Export TML', payload)})
|
|
1337
1355
|
*```
|
|
@@ -1355,10 +1373,10 @@
|
|
|
1355
1373
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
|
|
1356
1374
|
* @example
|
|
1357
1375
|
*```js
|
|
1358
|
-
* //
|
|
1376
|
+
* //emit when action starts
|
|
1359
1377
|
* appEmbed.on(EmbedEvent.CopyAEdit, payload => {
|
|
1360
1378
|
* console.log('Copy and edit', payload)}, {start: true })
|
|
1361
|
-
* //
|
|
1379
|
+
* //emit when action ends
|
|
1362
1380
|
* appEmbed.on(EmbedEvent.CopyAEdit, payload => {
|
|
1363
1381
|
* console.log('Copy and edit', payload)})
|
|
1364
1382
|
*```
|
|
@@ -1460,7 +1478,7 @@
|
|
|
1460
1478
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
|
|
1461
1479
|
* @example
|
|
1462
1480
|
*```js
|
|
1463
|
-
* liveboardEmbed.
|
|
1481
|
+
* liveboardEmbed.on(EmbedEvent.Present)
|
|
1464
1482
|
*```
|
|
1465
1483
|
* @example
|
|
1466
1484
|
*```js
|
|
@@ -1476,7 +1494,7 @@
|
|
|
1476
1494
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
|
|
1477
1495
|
* @example
|
|
1478
1496
|
*```js
|
|
1479
|
-
* liveboardEmbed.
|
|
1497
|
+
* liveboardEmbed.on(EmbedEvent.Delete,
|
|
1480
1498
|
* {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
|
|
1481
1499
|
*```
|
|
1482
1500
|
*/
|
|
@@ -1487,7 +1505,7 @@
|
|
|
1487
1505
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
|
|
1488
1506
|
* @example
|
|
1489
1507
|
*```js
|
|
1490
|
-
* liveboardEmbed.
|
|
1508
|
+
* liveboardEmbed.on(EmbedEvent.SchedulesList)
|
|
1491
1509
|
*```
|
|
1492
1510
|
*/
|
|
1493
1511
|
EmbedEvent["SchedulesList"] = "schedule-list";
|
|
@@ -1497,7 +1515,7 @@
|
|
|
1497
1515
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
|
|
1498
1516
|
* @example
|
|
1499
1517
|
*```js
|
|
1500
|
-
* liveboardEmbed.
|
|
1518
|
+
* liveboardEmbed.on(EmbedEvent.Cancel)
|
|
1501
1519
|
*```
|
|
1502
1520
|
*/
|
|
1503
1521
|
EmbedEvent["Cancel"] = "cancel";
|
|
@@ -1507,7 +1525,7 @@
|
|
|
1507
1525
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
|
|
1508
1526
|
* @example
|
|
1509
1527
|
*```js
|
|
1510
|
-
* liveboardEmbed.
|
|
1528
|
+
* liveboardEmbed.on(EmbedEvent.Explore, {
|
|
1511
1529
|
* vizId: '730496d6-6903-4601-937e-2c691821af3c'})
|
|
1512
1530
|
*```
|
|
1513
1531
|
*/
|
|
@@ -1518,7 +1536,7 @@
|
|
|
1518
1536
|
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
|
|
1519
1537
|
* @example
|
|
1520
1538
|
*```js
|
|
1521
|
-
* liveboardEmbed.
|
|
1539
|
+
* liveboardEmbed.on(EmbedEvent.CopyLink, {
|
|
1522
1540
|
* vizId: '730496d6-6903-4601-937e-2c691821af3c'})
|
|
1523
1541
|
*```
|
|
1524
1542
|
*/
|
|
@@ -1874,7 +1892,7 @@
|
|
|
1874
1892
|
*
|
|
1875
1893
|
* @example
|
|
1876
1894
|
* ```js
|
|
1877
|
-
* liveboardEmbed.trigger(HostEvent.
|
|
1895
|
+
* liveboardEmbed.trigger(HostEvent.getExportRequestForCurrentPinboard).then(
|
|
1878
1896
|
* data=>console.log(data))
|
|
1879
1897
|
* ```
|
|
1880
1898
|
* @version SDK: 1.13.0 | ThoughtSpot: 8.5.0.cl, 8.8.1.sw
|
|
@@ -2338,7 +2356,7 @@
|
|
|
2338
2356
|
*
|
|
2339
2357
|
* ```js
|
|
2340
2358
|
* liveboardEmbed.trigger(HostEvent.UpdateFilters, {
|
|
2341
|
-
* filter: { column: 'column name', oper: 'IN', values: [1,2,3]
|
|
2359
|
+
* filter: { column: 'column name', oper: 'IN', values: [1,2,3]}
|
|
2342
2360
|
* })
|
|
2343
2361
|
* ```
|
|
2344
2362
|
* @version SDK: 1.23.0 | ThoughtSpot: 9.4.0.cl
|
|
@@ -3466,7 +3484,7 @@
|
|
|
3466
3484
|
* disabledActions: [Action.TML] // to disable all TML actions
|
|
3467
3485
|
* ```
|
|
3468
3486
|
*
|
|
3469
|
-
* @version SDK : 1.28.
|
|
3487
|
+
* @version SDK : 1.28.3 | Thoughtspot: 9.12.0.cl
|
|
3470
3488
|
*/
|
|
3471
3489
|
Action["TML"] = "tml";
|
|
3472
3490
|
/**
|
|
@@ -5941,6 +5959,7 @@
|
|
|
5941
5959
|
|
|
5942
5960
|
const EndPoints = {
|
|
5943
5961
|
AUTH_VERIFICATION: '/callosum/v1/session/info',
|
|
5962
|
+
SESSION_INFO: '/callosum/v1/session/info',
|
|
5944
5963
|
SAML_LOGIN_TEMPLATE: (targetUrl) => `/callosum/v1/saml/login?targetURLPath=${targetUrl}`,
|
|
5945
5964
|
OIDC_LOGIN_TEMPLATE: (targetUrl) => `/callosum/v1/oidc/login?targetURLPath=${targetUrl}`,
|
|
5946
5965
|
TOKEN_LOGIN: '/callosum/v1/session/login/token',
|
|
@@ -6057,8 +6076,10 @@
|
|
|
6057
6076
|
const INVALID_TOKEN_ERR = 'Invalid token received form token callback or authToken endpoint.';
|
|
6058
6077
|
let cachedAuthToken = null;
|
|
6059
6078
|
// This method can be used to get the authToken using the embedConfig
|
|
6060
|
-
|
|
6061
|
-
if
|
|
6079
|
+
async function getAuthenticationToken(embedConfig) {
|
|
6080
|
+
// Since we don't have token validation enabled , we cannot tell if the
|
|
6081
|
+
// cached token is valid or not. So we will always fetch a new token.
|
|
6082
|
+
if (cachedAuthToken && !embedConfig.disableTokenVerification) {
|
|
6062
6083
|
let isCachedTokenStillValid;
|
|
6063
6084
|
try {
|
|
6064
6085
|
isCachedTokenStillValid = await validateAuthToken(embedConfig, cachedAuthToken, true);
|
|
@@ -6078,12 +6099,22 @@
|
|
|
6078
6099
|
const response = await fetchAuthTokenService(authEndpoint);
|
|
6079
6100
|
authToken = await response.text();
|
|
6080
6101
|
}
|
|
6081
|
-
|
|
6082
|
-
|
|
6102
|
+
try {
|
|
6103
|
+
// this will throw error if the token is not valid
|
|
6104
|
+
await validateAuthToken(embedConfig, authToken);
|
|
6105
|
+
}
|
|
6106
|
+
catch (e) {
|
|
6107
|
+
logger.error(`Received invalid token from getAuthToken callback or authToken endpoint. Error : ${e.message}`);
|
|
6108
|
+
throw e;
|
|
6109
|
+
}
|
|
6083
6110
|
cachedAuthToken = authToken;
|
|
6084
6111
|
return authToken;
|
|
6085
|
-
}
|
|
6112
|
+
}
|
|
6086
6113
|
const validateAuthToken = async (embedConfig, authToken, suppressAlert) => {
|
|
6114
|
+
if (embedConfig.disableTokenVerification) {
|
|
6115
|
+
logger.info('Token verification is disabled. Assuming token is valid.');
|
|
6116
|
+
return true;
|
|
6117
|
+
}
|
|
6087
6118
|
try {
|
|
6088
6119
|
const isTokenValid = await verifyTokenService(embedConfig.thoughtSpotHost, authToken);
|
|
6089
6120
|
if (isTokenValid)
|
|
@@ -6348,6 +6379,16 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
6348
6379
|
* const data = await underlying.fetchData(0, 100);
|
|
6349
6380
|
* })
|
|
6350
6381
|
* ```
|
|
6382
|
+
* @example
|
|
6383
|
+
* ```js
|
|
6384
|
+
* embed.on(EmbedEvent.Data, async (e) => {
|
|
6385
|
+
* const service = await embed.getAnswerService();
|
|
6386
|
+
* await service.addColumns([
|
|
6387
|
+
* "<column guid>"
|
|
6388
|
+
* ]);
|
|
6389
|
+
* console.log(await service.fetchData());
|
|
6390
|
+
* });
|
|
6391
|
+
* ```
|
|
6351
6392
|
* @version SDK: 1.25.0| ThoughtSpot: 9.10.0.cl
|
|
6352
6393
|
* @group Events
|
|
6353
6394
|
*/
|
|
@@ -12688,6 +12729,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
12688
12729
|
function initMixpanel(sessionInfo) {
|
|
12689
12730
|
var _a;
|
|
12690
12731
|
if (!sessionInfo || !sessionInfo.mixpanelToken) {
|
|
12732
|
+
logger.error('Mixpanel token not found in session info');
|
|
12691
12733
|
return;
|
|
12692
12734
|
}
|
|
12693
12735
|
// On a public cluster the user is anonymous, so don't set the identify to
|
|
@@ -13072,36 +13114,111 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
13072
13114
|
* @param url
|
|
13073
13115
|
* @param options
|
|
13074
13116
|
*/
|
|
13075
|
-
function
|
|
13117
|
+
function tokenizedFailureLoggedFetch(url, options = {}) {
|
|
13076
13118
|
return tokenizedFetch(url, options).then(async (r) => {
|
|
13077
13119
|
var _a;
|
|
13078
13120
|
if (!r.ok && r.type !== 'opaqueredirect' && r.type !== 'opaque') {
|
|
13079
|
-
logger.error(
|
|
13121
|
+
logger.error(`Failed to fetch ${url}`, await ((_a = r.text) === null || _a === void 0 ? void 0 : _a.call(r)));
|
|
13080
13122
|
}
|
|
13081
13123
|
return r;
|
|
13082
13124
|
});
|
|
13083
13125
|
}
|
|
13084
13126
|
/**
|
|
13127
|
+
* Fetches the session info from the ThoughtSpot server.
|
|
13085
13128
|
*
|
|
13086
|
-
* @param
|
|
13129
|
+
* @param thoughtspotHost
|
|
13130
|
+
* @returns {Promise<any>}
|
|
13131
|
+
* @example
|
|
13132
|
+
* ```js
|
|
13133
|
+
* const response = await sessionInfoService();
|
|
13134
|
+
* ```
|
|
13087
13135
|
*/
|
|
13088
|
-
function fetchSessionInfoService(
|
|
13089
|
-
|
|
13090
|
-
|
|
13091
|
-
|
|
13136
|
+
async function fetchSessionInfoService(thoughtspotHost) {
|
|
13137
|
+
const sessionInfoPath = `${thoughtspotHost}${EndPoints.SESSION_INFO}`;
|
|
13138
|
+
const response = await tokenizedFailureLoggedFetch(sessionInfoPath);
|
|
13139
|
+
if (!response.ok) {
|
|
13140
|
+
throw new Error(`Failed to fetch session info: ${response.statusText}`);
|
|
13141
|
+
}
|
|
13142
|
+
const data = await response.json();
|
|
13143
|
+
return data;
|
|
13144
|
+
}
|
|
13145
|
+
/**
|
|
13146
|
+
* Is active service to check if the user is logged in.
|
|
13147
|
+
*
|
|
13148
|
+
* @param thoughtSpotHost
|
|
13149
|
+
* @version SDK: 1.28.4 | ThoughtSpot: *
|
|
13150
|
+
*/
|
|
13151
|
+
async function isActiveService(thoughtSpotHost) {
|
|
13152
|
+
const isActiveUrl = `${thoughtSpotHost}${EndPoints.IS_ACTIVE}`;
|
|
13153
|
+
try {
|
|
13154
|
+
const res = await tokenizedFetch(isActiveUrl, {
|
|
13155
|
+
credentials: 'include',
|
|
13156
|
+
});
|
|
13157
|
+
return res.ok;
|
|
13158
|
+
}
|
|
13159
|
+
catch (e) {
|
|
13160
|
+
logger.warn(`Is Logged In Service failed : ${e.message}`);
|
|
13161
|
+
}
|
|
13162
|
+
return false;
|
|
13092
13163
|
}
|
|
13093
13164
|
|
|
13165
|
+
let sessionInfo = null;
|
|
13166
|
+
/**
|
|
13167
|
+
* Returns the session info object and caches it for future use.
|
|
13168
|
+
* Once fetched the session info object is cached and returned from the cache on
|
|
13169
|
+
* subsequent calls.
|
|
13170
|
+
*
|
|
13171
|
+
* @example ```js
|
|
13172
|
+
* const sessionInfo = await getSessionInfo();
|
|
13173
|
+
* console.log(sessionInfo);
|
|
13174
|
+
* ```
|
|
13175
|
+
* @version SDK: 1.28.3 | ThoughtSpot: *
|
|
13176
|
+
* @returns {Promise<SessionInfo>} The session info object.
|
|
13177
|
+
*/
|
|
13178
|
+
async function getSessionInfo() {
|
|
13179
|
+
if (!sessionInfo) {
|
|
13180
|
+
const host = getEmbedConfig().thoughtSpotHost;
|
|
13181
|
+
const sessionResponse = await fetchSessionInfoService(host);
|
|
13182
|
+
const processedSessionInfo = getSessionDetails(sessionResponse);
|
|
13183
|
+
sessionInfo = processedSessionInfo;
|
|
13184
|
+
}
|
|
13185
|
+
return sessionInfo;
|
|
13186
|
+
}
|
|
13187
|
+
/**
|
|
13188
|
+
* Processes the session info response and returns the session info object.
|
|
13189
|
+
*
|
|
13190
|
+
* @param sessionInfoResp {any} Response from the session info API.
|
|
13191
|
+
* @returns {SessionInfo} The session info object.
|
|
13192
|
+
* @example ```js
|
|
13193
|
+
* const sessionInfoResp = await fetch(sessionInfoPath);
|
|
13194
|
+
* const sessionInfo = getSessionDetails(sessionInfoResp);
|
|
13195
|
+
* console.log(sessionInfo);
|
|
13196
|
+
* ```
|
|
13197
|
+
* @version SDK: 1.28.3 | ThoughtSpot: *
|
|
13198
|
+
*/
|
|
13199
|
+
const getSessionDetails = (sessionInfoResp) => {
|
|
13200
|
+
const devMixpanelToken = sessionInfoResp.configInfo.mixpanelConfig.devSdkKey;
|
|
13201
|
+
const prodMixpanelToken = sessionInfoResp.configInfo.mixpanelConfig.prodSdkKey;
|
|
13202
|
+
const mixpanelToken = sessionInfoResp.configInfo.mixpanelConfig.production
|
|
13203
|
+
? prodMixpanelToken
|
|
13204
|
+
: devMixpanelToken;
|
|
13205
|
+
return {
|
|
13206
|
+
userGUID: sessionInfoResp.userGUID,
|
|
13207
|
+
mixpanelToken,
|
|
13208
|
+
isPublicUser: sessionInfoResp.configInfo.isPublicUser,
|
|
13209
|
+
releaseVersion: sessionInfoResp.releaseVersion,
|
|
13210
|
+
clusterId: sessionInfoResp.configInfo.selfClusterId,
|
|
13211
|
+
clusterName: sessionInfoResp.configInfo.selfClusterName,
|
|
13212
|
+
...sessionInfoResp,
|
|
13213
|
+
};
|
|
13214
|
+
};
|
|
13215
|
+
|
|
13094
13216
|
// eslint-disable-next-line import/no-mutable-exports
|
|
13095
13217
|
let loggedInStatus = false;
|
|
13096
13218
|
// eslint-disable-next-line import/no-mutable-exports
|
|
13097
13219
|
let samlAuthWindow = null;
|
|
13098
13220
|
// eslint-disable-next-line import/no-mutable-exports
|
|
13099
13221
|
let samlCompletionPromise = null;
|
|
13100
|
-
let sessionInfo = null;
|
|
13101
|
-
let sessionInfoResolver = null;
|
|
13102
|
-
const sessionInfoPromise = new Promise((resolve) => {
|
|
13103
|
-
sessionInfoResolver = resolve;
|
|
13104
|
-
});
|
|
13105
13222
|
let releaseVersion = '';
|
|
13106
13223
|
const SSO_REDIRECTION_MARKER_GUID = '5e16222e-ef02-43e9-9fbd-24226bf3ce5b';
|
|
13107
13224
|
/**
|
|
@@ -13174,7 +13291,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
13174
13291
|
/**
|
|
13175
13292
|
*
|
|
13176
13293
|
*/
|
|
13177
|
-
function notifyAuthSuccess() {
|
|
13294
|
+
async function notifyAuthSuccess() {
|
|
13178
13295
|
{
|
|
13179
13296
|
logger.error('SDK not initialized');
|
|
13180
13297
|
return;
|
|
@@ -13199,52 +13316,39 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
13199
13316
|
return;
|
|
13200
13317
|
}
|
|
13201
13318
|
}
|
|
13202
|
-
const initSession = (sessionDetails) => {
|
|
13203
|
-
const embedConfig = getEmbedConfig();
|
|
13204
|
-
if (sessionInfo == null) {
|
|
13205
|
-
sessionInfo = sessionDetails;
|
|
13206
|
-
if (!embedConfig.disableSDKTracking) {
|
|
13207
|
-
initMixpanel(sessionInfo);
|
|
13208
|
-
}
|
|
13209
|
-
sessionInfoResolver(sessionInfo);
|
|
13210
|
-
}
|
|
13211
|
-
};
|
|
13212
|
-
const getSessionDetails = (sessionInfoResp) => {
|
|
13213
|
-
const devMixpanelToken = sessionInfoResp.configInfo.mixpanelConfig.devSdkKey;
|
|
13214
|
-
const prodMixpanelToken = sessionInfoResp.configInfo.mixpanelConfig.prodSdkKey;
|
|
13215
|
-
const mixpanelToken = sessionInfoResp.configInfo.mixpanelConfig.production
|
|
13216
|
-
? prodMixpanelToken
|
|
13217
|
-
: devMixpanelToken;
|
|
13218
|
-
return {
|
|
13219
|
-
userGUID: sessionInfoResp.userGUID,
|
|
13220
|
-
mixpanelToken,
|
|
13221
|
-
isPublicUser: sessionInfoResp.configInfo.isPublicUser,
|
|
13222
|
-
releaseVersion: sessionInfoResp.releaseVersion,
|
|
13223
|
-
clusterId: sessionInfoResp.configInfo.selfClusterId,
|
|
13224
|
-
clusterName: sessionInfoResp.configInfo.selfClusterName,
|
|
13225
|
-
...sessionInfoResp,
|
|
13226
|
-
};
|
|
13227
|
-
};
|
|
13228
13319
|
/**
|
|
13229
13320
|
* Check if we are logged into the ThoughtSpot cluster
|
|
13230
13321
|
*
|
|
13231
13322
|
* @param thoughtSpotHost The ThoughtSpot cluster hostname or IP
|
|
13232
13323
|
*/
|
|
13233
13324
|
async function isLoggedIn(thoughtSpotHost) {
|
|
13234
|
-
const authVerificationUrl = `${thoughtSpotHost}${EndPoints.AUTH_VERIFICATION}`;
|
|
13235
|
-
let response = null;
|
|
13236
13325
|
try {
|
|
13237
|
-
response = await
|
|
13238
|
-
|
|
13239
|
-
const sessionDetails = getSessionDetails(sessionInfoResp);
|
|
13240
|
-
// Store user session details from session info
|
|
13241
|
-
initSession(sessionDetails);
|
|
13242
|
-
releaseVersion = sessionInfoResp.releaseVersion;
|
|
13326
|
+
const response = await isActiveService(thoughtSpotHost);
|
|
13327
|
+
return response;
|
|
13243
13328
|
}
|
|
13244
13329
|
catch (e) {
|
|
13245
13330
|
return false;
|
|
13246
13331
|
}
|
|
13247
|
-
|
|
13332
|
+
}
|
|
13333
|
+
/**
|
|
13334
|
+
* Services to be called after the login is successful,
|
|
13335
|
+
* This should be called after the cookie is set for cookie auth or
|
|
13336
|
+
* after the token is set for cookieless.
|
|
13337
|
+
*
|
|
13338
|
+
* @return {Promise<void>}
|
|
13339
|
+
* @example
|
|
13340
|
+
* ```js
|
|
13341
|
+
* await postLoginService();
|
|
13342
|
+
* ```
|
|
13343
|
+
* @version SDK: 1.28.3 | ThoughtSpot: *
|
|
13344
|
+
*/
|
|
13345
|
+
async function postLoginService() {
|
|
13346
|
+
const sessionInfo = await getSessionInfo();
|
|
13347
|
+
releaseVersion = sessionInfo.releaseVersion;
|
|
13348
|
+
const embedConfig = getEmbedConfig();
|
|
13349
|
+
if (!embedConfig.disableSDKTracking) {
|
|
13350
|
+
initMixpanel(sessionInfo);
|
|
13351
|
+
}
|
|
13248
13352
|
}
|
|
13249
13353
|
/**
|
|
13250
13354
|
* Return releaseVersion if available
|
|
@@ -13281,7 +13385,14 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
13281
13385
|
}
|
|
13282
13386
|
loggedInStatus = await isLoggedIn(thoughtSpotHost);
|
|
13283
13387
|
if (!loggedInStatus) {
|
|
13284
|
-
|
|
13388
|
+
let authToken;
|
|
13389
|
+
try {
|
|
13390
|
+
authToken = await getAuthenticationToken(embedConfig);
|
|
13391
|
+
}
|
|
13392
|
+
catch (e) {
|
|
13393
|
+
loggedInStatus = false;
|
|
13394
|
+
throw e;
|
|
13395
|
+
}
|
|
13285
13396
|
let resp;
|
|
13286
13397
|
try {
|
|
13287
13398
|
resp = await fetchAuthPostService(thoughtSpotHost, username, authToken);
|
|
@@ -13479,6 +13590,8 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
13479
13590
|
notifyAuthFailure(AuthFailureType.SDK);
|
|
13480
13591
|
}
|
|
13481
13592
|
else {
|
|
13593
|
+
// Post login service is called after successful login.
|
|
13594
|
+
postLoginService();
|
|
13482
13595
|
notifyAuthSDKSuccess();
|
|
13483
13596
|
}
|
|
13484
13597
|
}, () => {
|
|
@@ -13529,13 +13642,13 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
13529
13642
|
};
|
|
13530
13643
|
}
|
|
13531
13644
|
/**
|
|
13645
|
+
* Responds to AuthInit sent from host signifying successful authentication in host.
|
|
13532
13646
|
*
|
|
13533
13647
|
* @param e
|
|
13648
|
+
* @returns {any}
|
|
13534
13649
|
*/
|
|
13535
13650
|
function processAuthInit(e) {
|
|
13536
13651
|
var _a, _b;
|
|
13537
|
-
// Store user session details sent by app.
|
|
13538
|
-
initSession(e.data);
|
|
13539
13652
|
notifyAuthSuccess();
|
|
13540
13653
|
// Expose only allowed details (eg: userGUID) back to SDK users.
|
|
13541
13654
|
return {
|
|
@@ -13673,7 +13786,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
13673
13786
|
});
|
|
13674
13787
|
}
|
|
13675
13788
|
|
|
13676
|
-
var name="@thoughtspot/visual-embed-sdk";var version="1.29.0-alpha.
|
|
13789
|
+
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$1={".":{"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$1,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};
|
|
13677
13790
|
|
|
13678
13791
|
/**
|
|
13679
13792
|
* Copyright (c) 2022
|
|
@@ -13773,6 +13886,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
13773
13886
|
});
|
|
13774
13887
|
}
|
|
13775
13888
|
catch (e) {
|
|
13889
|
+
logger.error(`Received invalid token. Error : ${e === null || e === void 0 ? void 0 : e.message}`);
|
|
13776
13890
|
processAuthFailure(e, this.isPreRendered ? this.preRenderWrapper : this.el);
|
|
13777
13891
|
}
|
|
13778
13892
|
}
|
|
@@ -14117,6 +14231,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
14117
14231
|
* @param url - The URL of the embedded ThoughtSpot app.
|
|
14118
14232
|
*/
|
|
14119
14233
|
async renderIFrame(url) {
|
|
14234
|
+
console.log('here 7');
|
|
14120
14235
|
if (this.isError) {
|
|
14121
14236
|
return null;
|
|
14122
14237
|
}
|
|
@@ -14124,8 +14239,10 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
14124
14239
|
this.throwInitError();
|
|
14125
14240
|
}
|
|
14126
14241
|
if (url.length > URL_MAX_LENGTH) ;
|
|
14242
|
+
console.log('here 8');
|
|
14127
14243
|
return renderInQueue((nextInQueue) => {
|
|
14128
14244
|
var _a;
|
|
14245
|
+
console.log('here 6');
|
|
14129
14246
|
const initTimestamp = Date.now();
|
|
14130
14247
|
this.executeCallbacks(exports.EmbedEvent.Init, {
|
|
14131
14248
|
data: {
|
|
@@ -14135,6 +14252,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
14135
14252
|
});
|
|
14136
14253
|
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_RENDER_START);
|
|
14137
14254
|
return (_a = getAuthPromise()) === null || _a === void 0 ? void 0 : _a.then((isLoggedIn) => {
|
|
14255
|
+
console.log('here 9', isLoggedIn);
|
|
14138
14256
|
if (!isLoggedIn) {
|
|
14139
14257
|
this.handleInsertionIntoDOM(this.embedConfig.loginFailedMessage);
|
|
14140
14258
|
return;
|
|
@@ -14158,7 +14276,9 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
14158
14276
|
this.iFrame.addEventListener('error', () => {
|
|
14159
14277
|
nextInQueue();
|
|
14160
14278
|
});
|
|
14279
|
+
console.log('here 10', this.iFrame);
|
|
14161
14280
|
this.handleInsertionIntoDOM(this.iFrame);
|
|
14281
|
+
console.log('here 11', document.body.innerHTML);
|
|
14162
14282
|
const prefetchIframe = document.querySelectorAll('.prefetchIframe');
|
|
14163
14283
|
if (prefetchIframe.length) {
|
|
14164
14284
|
prefetchIframe.forEach((el) => {
|
|
@@ -15760,6 +15880,7 @@ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!]
|
|
|
15760
15880
|
exports.SageEmbed = SageEmbed$1;
|
|
15761
15881
|
exports.SearchBarEmbed = SearchBarEmbed$1;
|
|
15762
15882
|
exports.SearchEmbed = SearchEmbed$1;
|
|
15883
|
+
exports.getSessionInfo = getSessionInfo;
|
|
15763
15884
|
exports.useEmbedRef = useEmbedRef;
|
|
15764
15885
|
|
|
15765
15886
|
Object.defineProperty(exports, '__esModule', { value: true });
|