@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.
Files changed (256) hide show
  1. package/cjs/package.json +1 -1
  2. package/cjs/src/auth.d.ts +14 -17
  3. package/cjs/src/auth.d.ts.map +1 -1
  4. package/cjs/src/auth.js +45 -59
  5. package/cjs/src/auth.js.map +1 -1
  6. package/cjs/src/auth.spec.d.ts +12 -0
  7. package/cjs/src/auth.spec.d.ts.map +1 -1
  8. package/cjs/src/auth.spec.js +89 -67
  9. package/cjs/src/auth.spec.js.map +1 -1
  10. package/cjs/src/authToken.d.ts +1 -1
  11. package/cjs/src/authToken.d.ts.map +1 -1
  12. package/cjs/src/authToken.js +18 -5
  13. package/cjs/src/authToken.js.map +1 -1
  14. package/cjs/src/authToken.spec.d.ts +2 -0
  15. package/cjs/src/authToken.spec.d.ts.map +1 -0
  16. package/cjs/src/authToken.spec.js +29 -0
  17. package/cjs/src/authToken.spec.js.map +1 -0
  18. package/cjs/src/embed/app.spec.js +4 -2
  19. package/cjs/src/embed/app.spec.js.map +1 -1
  20. package/cjs/src/embed/base.d.ts.map +1 -1
  21. package/cjs/src/embed/base.js +2 -0
  22. package/cjs/src/embed/base.js.map +1 -1
  23. package/cjs/src/embed/base.spec.js +1 -0
  24. package/cjs/src/embed/base.spec.js.map +1 -1
  25. package/cjs/src/embed/embed.spec.js +3 -0
  26. package/cjs/src/embed/embed.spec.js.map +1 -1
  27. package/cjs/src/embed/events.spec.js +3 -0
  28. package/cjs/src/embed/events.spec.js.map +1 -1
  29. package/cjs/src/embed/liveboard.spec.js +2 -0
  30. package/cjs/src/embed/liveboard.spec.js.map +1 -1
  31. package/cjs/src/embed/pinboard.spec.js +3 -0
  32. package/cjs/src/embed/pinboard.spec.js.map +1 -1
  33. package/cjs/src/embed/sage.spec.js +3 -0
  34. package/cjs/src/embed/sage.spec.js.map +1 -1
  35. package/cjs/src/embed/search.spec.js +1 -0
  36. package/cjs/src/embed/search.spec.js.map +1 -1
  37. package/cjs/src/embed/ts-embed-trigger.spec.js +3 -0
  38. package/cjs/src/embed/ts-embed-trigger.spec.js.map +1 -1
  39. package/cjs/src/embed/ts-embed.d.ts.map +1 -1
  40. package/cjs/src/embed/ts-embed.js +7 -0
  41. package/cjs/src/embed/ts-embed.js.map +1 -1
  42. package/cjs/src/embed/ts-embed.spec.js +7 -0
  43. package/cjs/src/embed/ts-embed.spec.js.map +1 -1
  44. package/cjs/src/index.d.ts +2 -1
  45. package/cjs/src/index.d.ts.map +1 -1
  46. package/cjs/src/index.js +2 -1
  47. package/cjs/src/index.js.map +1 -1
  48. package/cjs/src/mixpanel-service.d.ts +2 -1
  49. package/cjs/src/mixpanel-service.d.ts.map +1 -1
  50. package/cjs/src/mixpanel-service.js +1 -0
  51. package/cjs/src/mixpanel-service.js.map +1 -1
  52. package/cjs/src/mixpanel-service.spec.js +7 -0
  53. package/cjs/src/mixpanel-service.spec.js.map +1 -1
  54. package/cjs/src/react/index.d.ts +1 -1
  55. package/cjs/src/react/index.d.ts.map +1 -1
  56. package/cjs/src/react/index.js +2 -1
  57. package/cjs/src/react/index.js.map +1 -1
  58. package/cjs/src/react/index.spec.js +6 -0
  59. package/cjs/src/react/index.spec.js.map +1 -1
  60. package/cjs/src/types.d.ts +79 -47
  61. package/cjs/src/types.d.ts.map +1 -1
  62. package/cjs/src/types.js +61 -46
  63. package/cjs/src/types.js.map +1 -1
  64. package/cjs/src/utils/authService/authService.d.ts +1 -0
  65. package/cjs/src/utils/authService/authService.d.ts.map +1 -1
  66. package/cjs/src/utils/authService/authService.js +1 -0
  67. package/cjs/src/utils/authService/authService.js.map +1 -1
  68. package/cjs/src/utils/authService/authService.spec.js +18 -5
  69. package/cjs/src/utils/authService/authService.spec.js.map +1 -1
  70. package/cjs/src/utils/authService/tokenizedAuthService.d.ts +15 -2
  71. package/cjs/src/utils/authService/tokenizedAuthService.d.ts.map +1 -1
  72. package/cjs/src/utils/authService/tokenizedAuthService.js +39 -9
  73. package/cjs/src/utils/authService/tokenizedAuthService.js.map +1 -1
  74. package/cjs/src/utils/authService/tokenizedAuthService.spec.d.ts +2 -0
  75. package/cjs/src/utils/authService/tokenizedAuthService.spec.d.ts.map +1 -0
  76. package/cjs/src/utils/authService/tokenizedAuthService.spec.js +32 -0
  77. package/cjs/src/utils/authService/tokenizedAuthService.spec.js.map +1 -0
  78. package/cjs/src/utils/graphql/answerService/answerService.d.ts +10 -0
  79. package/cjs/src/utils/graphql/answerService/answerService.d.ts.map +1 -1
  80. package/cjs/src/utils/graphql/answerService/answerService.js +10 -0
  81. package/cjs/src/utils/graphql/answerService/answerService.js.map +1 -1
  82. package/cjs/src/utils/processData.js +2 -2
  83. package/cjs/src/utils/processData.js.map +1 -1
  84. package/cjs/src/utils/processData.spec.js +3 -2
  85. package/cjs/src/utils/processData.spec.js.map +1 -1
  86. package/cjs/src/utils/sessionInfoService.d.ts +66 -0
  87. package/cjs/src/utils/sessionInfoService.d.ts.map +1 -0
  88. package/cjs/src/utils/sessionInfoService.js +92 -0
  89. package/cjs/src/utils/sessionInfoService.js.map +1 -0
  90. package/cjs/src/utils.d.ts +1 -1
  91. package/cjs/src/utils.d.ts.map +1 -1
  92. package/cjs/src/utils.js +4 -1
  93. package/cjs/src/utils.js.map +1 -1
  94. package/dist/src/auth.d.ts +14 -17
  95. package/dist/src/auth.d.ts.map +1 -1
  96. package/dist/src/auth.spec.d.ts +12 -0
  97. package/dist/src/auth.spec.d.ts.map +1 -1
  98. package/dist/src/authToken.d.ts +1 -1
  99. package/dist/src/authToken.d.ts.map +1 -1
  100. package/dist/src/authToken.spec.d.ts +2 -0
  101. package/dist/src/authToken.spec.d.ts.map +1 -0
  102. package/dist/src/embed/base.d.ts.map +1 -1
  103. package/dist/src/embed/ts-embed.d.ts.map +1 -1
  104. package/dist/src/index.d.ts +2 -1
  105. package/dist/src/index.d.ts.map +1 -1
  106. package/dist/src/mixpanel-service.d.ts +2 -1
  107. package/dist/src/mixpanel-service.d.ts.map +1 -1
  108. package/dist/src/react/index.d.ts +1 -1
  109. package/dist/src/react/index.d.ts.map +1 -1
  110. package/dist/src/types.d.ts +79 -47
  111. package/dist/src/types.d.ts.map +1 -1
  112. package/dist/src/utils/authService/authService.d.ts +1 -0
  113. package/dist/src/utils/authService/authService.d.ts.map +1 -1
  114. package/dist/src/utils/authService/tokenizedAuthService.d.ts +15 -2
  115. package/dist/src/utils/authService/tokenizedAuthService.d.ts.map +1 -1
  116. package/dist/src/utils/authService/tokenizedAuthService.spec.d.ts +2 -0
  117. package/dist/src/utils/authService/tokenizedAuthService.spec.d.ts.map +1 -0
  118. package/dist/src/utils/graphql/answerService/answerService.d.ts +10 -0
  119. package/dist/src/utils/graphql/answerService/answerService.d.ts.map +1 -1
  120. package/dist/src/utils/sessionInfoService.d.ts +66 -0
  121. package/dist/src/utils/sessionInfoService.d.ts.map +1 -0
  122. package/dist/src/utils.d.ts +1 -1
  123. package/dist/src/utils.d.ts.map +1 -1
  124. package/dist/tsembed-react.es.js +225 -105
  125. package/dist/tsembed-react.js +225 -104
  126. package/dist/tsembed.es.js +233 -116
  127. package/dist/tsembed.js +233 -116
  128. package/dist/visual-embed-sdk-react-full.d.ts +171 -66
  129. package/dist/visual-embed-sdk-react.d.ts +171 -66
  130. package/dist/visual-embed-sdk.d.ts +171 -66
  131. package/lib/package.json +1 -1
  132. package/lib/src/auth.d.ts +14 -17
  133. package/lib/src/auth.d.ts.map +1 -1
  134. package/lib/src/auth.js +44 -56
  135. package/lib/src/auth.js.map +1 -1
  136. package/lib/src/auth.spec.d.ts +12 -0
  137. package/lib/src/auth.spec.d.ts.map +1 -1
  138. package/lib/src/auth.spec.js +88 -66
  139. package/lib/src/auth.spec.js.map +1 -1
  140. package/lib/src/authToken.d.ts +1 -1
  141. package/lib/src/authToken.d.ts.map +1 -1
  142. package/lib/src/authToken.js +18 -5
  143. package/lib/src/authToken.js.map +1 -1
  144. package/lib/src/authToken.spec.d.ts +2 -0
  145. package/lib/src/authToken.spec.d.ts.map +1 -0
  146. package/lib/src/authToken.spec.js +26 -0
  147. package/lib/src/authToken.spec.js.map +1 -0
  148. package/lib/src/embed/app.spec.js +4 -2
  149. package/lib/src/embed/app.spec.js.map +1 -1
  150. package/lib/src/embed/base.d.ts.map +1 -1
  151. package/lib/src/embed/base.js +3 -1
  152. package/lib/src/embed/base.js.map +1 -1
  153. package/lib/src/embed/base.spec.js +1 -0
  154. package/lib/src/embed/base.spec.js.map +1 -1
  155. package/lib/src/embed/embed.spec.js +2 -0
  156. package/lib/src/embed/embed.spec.js.map +1 -1
  157. package/lib/src/embed/events.spec.js +2 -0
  158. package/lib/src/embed/events.spec.js.map +1 -1
  159. package/lib/src/embed/liveboard.spec.js +2 -0
  160. package/lib/src/embed/liveboard.spec.js.map +1 -1
  161. package/lib/src/embed/pinboard.spec.js +2 -0
  162. package/lib/src/embed/pinboard.spec.js.map +1 -1
  163. package/lib/src/embed/sage.spec.js +2 -0
  164. package/lib/src/embed/sage.spec.js.map +1 -1
  165. package/lib/src/embed/search.spec.js +1 -0
  166. package/lib/src/embed/search.spec.js.map +1 -1
  167. package/lib/src/embed/ts-embed-trigger.spec.js +2 -0
  168. package/lib/src/embed/ts-embed-trigger.spec.js.map +1 -1
  169. package/lib/src/embed/ts-embed.d.ts.map +1 -1
  170. package/lib/src/embed/ts-embed.js +7 -0
  171. package/lib/src/embed/ts-embed.js.map +1 -1
  172. package/lib/src/embed/ts-embed.spec.js +7 -0
  173. package/lib/src/embed/ts-embed.spec.js.map +1 -1
  174. package/lib/src/index.d.ts +2 -1
  175. package/lib/src/index.d.ts.map +1 -1
  176. package/lib/src/index.js +2 -1
  177. package/lib/src/index.js.map +1 -1
  178. package/lib/src/mixpanel-service.d.ts +2 -1
  179. package/lib/src/mixpanel-service.d.ts.map +1 -1
  180. package/lib/src/mixpanel-service.js +1 -0
  181. package/lib/src/mixpanel-service.js.map +1 -1
  182. package/lib/src/mixpanel-service.spec.js +7 -0
  183. package/lib/src/mixpanel-service.spec.js.map +1 -1
  184. package/lib/src/react/index.d.ts +1 -1
  185. package/lib/src/react/index.d.ts.map +1 -1
  186. package/lib/src/react/index.js +1 -1
  187. package/lib/src/react/index.js.map +1 -1
  188. package/lib/src/react/index.spec.js +6 -0
  189. package/lib/src/react/index.spec.js.map +1 -1
  190. package/lib/src/types.d.ts +79 -47
  191. package/lib/src/types.d.ts.map +1 -1
  192. package/lib/src/types.js +61 -46
  193. package/lib/src/types.js.map +1 -1
  194. package/lib/src/utils/authService/authService.d.ts +1 -0
  195. package/lib/src/utils/authService/authService.d.ts.map +1 -1
  196. package/lib/src/utils/authService/authService.js +1 -0
  197. package/lib/src/utils/authService/authService.js.map +1 -1
  198. package/lib/src/utils/authService/authService.spec.js +18 -5
  199. package/lib/src/utils/authService/authService.spec.js.map +1 -1
  200. package/lib/src/utils/authService/tokenizedAuthService.d.ts +15 -2
  201. package/lib/src/utils/authService/tokenizedAuthService.d.ts.map +1 -1
  202. package/lib/src/utils/authService/tokenizedAuthService.js +37 -8
  203. package/lib/src/utils/authService/tokenizedAuthService.js.map +1 -1
  204. package/lib/src/utils/authService/tokenizedAuthService.spec.d.ts +2 -0
  205. package/lib/src/utils/authService/tokenizedAuthService.spec.d.ts.map +1 -0
  206. package/lib/src/utils/authService/tokenizedAuthService.spec.js +29 -0
  207. package/lib/src/utils/authService/tokenizedAuthService.spec.js.map +1 -0
  208. package/lib/src/utils/graphql/answerService/answerService.d.ts +10 -0
  209. package/lib/src/utils/graphql/answerService/answerService.d.ts.map +1 -1
  210. package/lib/src/utils/graphql/answerService/answerService.js +10 -0
  211. package/lib/src/utils/graphql/answerService/answerService.js.map +1 -1
  212. package/lib/src/utils/processData.js +3 -3
  213. package/lib/src/utils/processData.js.map +1 -1
  214. package/lib/src/utils/processData.spec.js +3 -2
  215. package/lib/src/utils/processData.spec.js.map +1 -1
  216. package/lib/src/utils/sessionInfoService.d.ts +66 -0
  217. package/lib/src/utils/sessionInfoService.d.ts.map +1 -0
  218. package/lib/src/utils/sessionInfoService.js +85 -0
  219. package/lib/src/utils/sessionInfoService.js.map +1 -0
  220. package/lib/src/utils.d.ts +1 -1
  221. package/lib/src/utils.d.ts.map +1 -1
  222. package/lib/src/utils.js +4 -1
  223. package/lib/src/utils.js.map +1 -1
  224. package/lib/src/visual-embed-sdk.d.ts +176 -67
  225. package/package.json +1 -1
  226. package/src/auth.spec.ts +92 -72
  227. package/src/auth.ts +46 -68
  228. package/src/authToken.spec.ts +31 -0
  229. package/src/authToken.ts +17 -5
  230. package/src/embed/app.spec.ts +4 -2
  231. package/src/embed/base.spec.ts +1 -0
  232. package/src/embed/base.ts +3 -0
  233. package/src/embed/embed.spec.ts +2 -0
  234. package/src/embed/events.spec.ts +2 -0
  235. package/src/embed/liveboard.spec.ts +2 -0
  236. package/src/embed/pinboard.spec.ts +2 -0
  237. package/src/embed/sage.spec.ts +3 -0
  238. package/src/embed/search.spec.ts +1 -0
  239. package/src/embed/ts-embed-trigger.spec.ts +3 -0
  240. package/src/embed/ts-embed.spec.ts +8 -0
  241. package/src/embed/ts-embed.ts +7 -0
  242. package/src/index.ts +2 -1
  243. package/src/mixpanel-service.spec.ts +12 -3
  244. package/src/mixpanel-service.ts +3 -1
  245. package/src/react/index.spec.tsx +7 -0
  246. package/src/react/index.tsx +1 -0
  247. package/src/types.ts +80 -47
  248. package/src/utils/authService/authService.spec.ts +18 -5
  249. package/src/utils/authService/authService.ts +1 -0
  250. package/src/utils/authService/tokenizedAuthService.spec.ts +36 -0
  251. package/src/utils/authService/tokenizedAuthService.ts +38 -8
  252. package/src/utils/graphql/answerService/answerService.ts +10 -0
  253. package/src/utils/processData.spec.ts +3 -2
  254. package/src/utils/processData.ts +3 -3
  255. package/src/utils/sessionInfoService.ts +101 -0
  256. package/src/utils.ts +7 -2
@@ -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) => `val${index}=${encodeURIComponent(value)}`).join('&'));
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.trigger(EmbedEvent.DrillDown, {
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
- * FULLSCREEN - Error when presenting a Liveboard or visualization in full screen mode.
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
- * SINGLE_VALUE_FILTER - Error due to multiple values in the single value filter.
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
- * This can be used to register an event listener which
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
- * //trigger when action starts
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
- * //trigger when action ends
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.trigger(HostEvent.Download, {
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
- * //trigger when action starts
1155
+ * //emit when action starts
1138
1156
  * searchEmbed.on(EmbedEvent.DownloadAsPng, payload => {
1139
1157
  * console.log('download PNG', payload)}, {start: true })
1140
- * //trigger when action ends
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
- * //trigger when action starts
1170
+ * //emit when action starts
1153
1171
  * searchEmbed.on(EmbedEvent.DownloadAsPdf, payload => {
1154
1172
  * console.log('download PDF', payload)}, {start: true })
1155
- * //trigger when action ends
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
- * //trigger when action starts
1185
+ * //emit when action starts
1168
1186
  * searchEmbed.on(EmbedEvent.DownloadAsCSV, payload => {
1169
1187
  * console.log('download CSV', payload)}, {start: true })
1170
- * //trigger when action ends
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
- * //trigger when action starts
1200
+ * //emit when action starts
1183
1201
  * searchEmbed.on(EmbedEvent.DownloadAsXlsx, payload => {
1184
1202
  * console.log('download Xlsx', payload)}, { start: true })
1185
- * //trigger when action ends
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
- * //trigger when action starts
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
- * //trigger when action starts
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
- * //trigger when action ends
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
- * //trigger when action starts
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
- * //trigger when action ends
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
- * //trigger when action starts
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
- * //trigger when action ends
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
- * //trigger when action starts
1349
+ * //emit when action starts
1332
1350
  * searchEmbed.on(EmbedEvent.ExportTML, payload => {
1333
1351
  * console.log('Export TML', payload)}, { start: true })
1334
- * //trigger when action ends
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
- * //trigger when action starts
1376
+ * //emit when action starts
1359
1377
  * appEmbed.on(EmbedEvent.CopyAEdit, payload => {
1360
1378
  * console.log('Copy and edit', payload)}, {start: true })
1361
- * //trigger when action ends
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.trigger(HostEvent.Present)
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.trigger(EmbedEvent.Delete,
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.trigger(EmbedEvent.SchedulesList)
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.trigger(EmbedEvent.Cancel)
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.trigger(EmbedEvent.Explore, {
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.trigger(EmbedEvent.CopyLink, {
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.getexportrequestforcurrentpinboard).then(
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], is_mandatory: false }
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.2 | Thoughtspot: 9.10.5.cl
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
- const getAuthenticationToken = async (embedConfig) => {
6061
- if (cachedAuthToken) {
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
- // this will throw error if the token is not valid
6082
- await validateAuthToken(embedConfig, authToken);
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 tokenisedFailureLoggedFetch(url, options = {}) {
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('Failure', await ((_a = r.text) === null || _a === void 0 ? void 0 : _a.call(r)));
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 authVerificationUrl
13129
+ * @param thoughtspotHost
13130
+ * @returns {Promise<any>}
13131
+ * @example
13132
+ * ```js
13133
+ * const response = await sessionInfoService();
13134
+ * ```
13087
13135
  */
13088
- function fetchSessionInfoService(authVerificationUrl) {
13089
- return tokenisedFailureLoggedFetch(authVerificationUrl, {
13090
- credentials: 'include',
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 fetchSessionInfoService(authVerificationUrl);
13238
- const sessionInfoResp = await response.json();
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
- return response.status === 200;
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
- const authToken = await getAuthenticationToken(embedConfig);
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.7";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};
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 });