@thoughtspot/visual-embed-sdk 1.29.1-alpha.0 → 1.29.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 (347) hide show
  1. package/README.md +1 -1
  2. package/cjs/package.json +2 -1
  3. package/cjs/src/auth.d.ts +0 -15
  4. package/cjs/src/auth.d.ts.map +1 -1
  5. package/cjs/src/auth.js +2 -13
  6. package/cjs/src/auth.js.map +1 -1
  7. package/cjs/src/authToken.d.ts +1 -2
  8. package/cjs/src/authToken.d.ts.map +1 -1
  9. package/cjs/src/authToken.js +9 -3
  10. package/cjs/src/authToken.js.map +1 -1
  11. package/cjs/src/authToken.spec.d.ts +2 -0
  12. package/cjs/src/authToken.spec.d.ts.map +1 -0
  13. package/cjs/src/authToken.spec.js +29 -0
  14. package/cjs/src/authToken.spec.js.map +1 -0
  15. package/cjs/src/config.d.ts +0 -1
  16. package/cjs/src/config.d.ts.map +1 -1
  17. package/cjs/src/config.js +0 -2
  18. package/cjs/src/config.js.map +1 -1
  19. package/cjs/src/embed/app.d.ts +73 -43
  20. package/cjs/src/embed/app.d.ts.map +1 -1
  21. package/cjs/src/embed/app.js +45 -12
  22. package/cjs/src/embed/app.js.map +1 -1
  23. package/cjs/src/embed/app.spec.js +21 -0
  24. package/cjs/src/embed/app.spec.js.map +1 -1
  25. package/cjs/src/embed/base.d.ts +1 -7
  26. package/cjs/src/embed/base.d.ts.map +1 -1
  27. package/cjs/src/embed/base.js +9 -15
  28. package/cjs/src/embed/base.js.map +1 -1
  29. package/cjs/src/embed/base.spec.js +3 -1
  30. package/cjs/src/embed/base.spec.js.map +1 -1
  31. package/cjs/src/embed/embedConfig.d.ts +0 -2
  32. package/cjs/src/embed/embedConfig.d.ts.map +1 -1
  33. package/cjs/src/embed/embedConfig.js +0 -2
  34. package/cjs/src/embed/embedConfig.js.map +1 -1
  35. package/cjs/src/embed/liveboard.d.ts +14 -28
  36. package/cjs/src/embed/liveboard.d.ts.map +1 -1
  37. package/cjs/src/embed/liveboard.js +9 -9
  38. package/cjs/src/embed/liveboard.js.map +1 -1
  39. package/cjs/src/embed/liveboard.spec.js +79 -4
  40. package/cjs/src/embed/liveboard.spec.js.map +1 -1
  41. package/cjs/src/embed/sage.d.ts +5 -21
  42. package/cjs/src/embed/sage.d.ts.map +1 -1
  43. package/cjs/src/embed/sage.js +2 -23
  44. package/cjs/src/embed/sage.js.map +1 -1
  45. package/cjs/src/embed/sage.spec.js +20 -31
  46. package/cjs/src/embed/sage.spec.js.map +1 -1
  47. package/cjs/src/embed/search-bar.d.ts +0 -11
  48. package/cjs/src/embed/search-bar.d.ts.map +1 -1
  49. package/cjs/src/embed/search-bar.js +0 -2
  50. package/cjs/src/embed/search-bar.js.map +1 -1
  51. package/cjs/src/embed/search.d.ts +60 -29
  52. package/cjs/src/embed/search.d.ts.map +1 -1
  53. package/cjs/src/embed/search.js +43 -9
  54. package/cjs/src/embed/search.js.map +1 -1
  55. package/cjs/src/embed/search.spec.js +34 -0
  56. package/cjs/src/embed/search.spec.js.map +1 -1
  57. package/cjs/src/embed/ts-embed.d.ts +1 -31
  58. package/cjs/src/embed/ts-embed.d.ts.map +1 -1
  59. package/cjs/src/embed/ts-embed.js +34 -43
  60. package/cjs/src/embed/ts-embed.js.map +1 -1
  61. package/cjs/src/embed/ts-embed.spec.js +83 -9
  62. package/cjs/src/embed/ts-embed.spec.js.map +1 -1
  63. package/cjs/src/errors.js +1 -1
  64. package/cjs/src/errors.js.map +1 -1
  65. package/cjs/src/index.d.ts +0 -1
  66. package/cjs/src/index.d.ts.map +1 -1
  67. package/cjs/src/index.js +0 -1
  68. package/cjs/src/index.js.map +1 -1
  69. package/cjs/src/mixpanel-service.d.ts +0 -1
  70. package/cjs/src/mixpanel-service.d.ts.map +1 -1
  71. package/cjs/src/mixpanel-service.js +0 -1
  72. package/cjs/src/mixpanel-service.js.map +1 -1
  73. package/cjs/src/react/index.d.ts +1 -12
  74. package/cjs/src/react/index.d.ts.map +1 -1
  75. package/cjs/src/react/index.js +1 -11
  76. package/cjs/src/react/index.js.map +1 -1
  77. package/cjs/src/react/index.spec.js +15 -3
  78. package/cjs/src/react/index.spec.js.map +1 -1
  79. package/cjs/src/test/test-utils.d.ts +0 -2
  80. package/cjs/src/test/test-utils.d.ts.map +1 -1
  81. package/cjs/src/test/test-utils.js +0 -2
  82. package/cjs/src/test/test-utils.js.map +1 -1
  83. package/cjs/src/tokenizedFetch.d.ts +0 -1
  84. package/cjs/src/tokenizedFetch.d.ts.map +1 -1
  85. package/cjs/src/tokenizedFetch.js +0 -1
  86. package/cjs/src/tokenizedFetch.js.map +1 -1
  87. package/cjs/src/types.d.ts +245 -366
  88. package/cjs/src/types.d.ts.map +1 -1
  89. package/cjs/src/types.js +196 -296
  90. package/cjs/src/types.js.map +1 -1
  91. package/cjs/src/utils/authService/authService.d.ts +0 -1
  92. package/cjs/src/utils/authService/authService.d.ts.map +1 -1
  93. package/cjs/src/utils/authService/authService.js +0 -1
  94. package/cjs/src/utils/authService/authService.js.map +1 -1
  95. package/cjs/src/utils/graphql/answerService/answer-queries.d.ts +2 -0
  96. package/cjs/src/utils/graphql/answerService/answer-queries.d.ts.map +1 -1
  97. package/cjs/src/utils/graphql/answerService/answer-queries.js +57 -1
  98. package/cjs/src/utils/graphql/answerService/answer-queries.js.map +1 -1
  99. package/cjs/src/utils/graphql/answerService/answerService.d.ts +37 -12
  100. package/cjs/src/utils/graphql/answerService/answerService.d.ts.map +1 -1
  101. package/cjs/src/utils/graphql/answerService/answerService.js +70 -14
  102. package/cjs/src/utils/graphql/answerService/answerService.js.map +1 -1
  103. package/cjs/src/utils/graphql/answerService/answerService.spec.js +78 -0
  104. package/cjs/src/utils/graphql/answerService/answerService.spec.js.map +1 -1
  105. package/cjs/src/utils/logger.d.ts.map +1 -1
  106. package/cjs/src/utils/logger.js +3 -5
  107. package/cjs/src/utils/logger.js.map +1 -1
  108. package/cjs/src/utils/processData.js +1 -1
  109. package/cjs/src/utils/processData.js.map +1 -1
  110. package/cjs/src/utils/processData.spec.js +1 -1
  111. package/cjs/src/utils/processData.spec.js.map +1 -1
  112. package/cjs/src/utils/processTrigger.d.ts +0 -1
  113. package/cjs/src/utils/processTrigger.d.ts.map +1 -1
  114. package/cjs/src/utils/processTrigger.js +0 -2
  115. package/cjs/src/utils/processTrigger.js.map +1 -1
  116. package/cjs/src/utils.d.ts +2 -10
  117. package/cjs/src/utils.d.ts.map +1 -1
  118. package/cjs/src/utils.js +19 -13
  119. package/cjs/src/utils.js.map +1 -1
  120. package/dist/src/auth.d.ts +0 -15
  121. package/dist/src/auth.d.ts.map +1 -1
  122. package/dist/src/authToken.d.ts +1 -2
  123. package/dist/src/authToken.d.ts.map +1 -1
  124. package/dist/src/authToken.spec.d.ts +2 -0
  125. package/dist/src/authToken.spec.d.ts.map +1 -0
  126. package/dist/src/config.d.ts +0 -1
  127. package/dist/src/config.d.ts.map +1 -1
  128. package/dist/src/embed/app.d.ts +73 -43
  129. package/dist/src/embed/app.d.ts.map +1 -1
  130. package/dist/src/embed/base.d.ts +1 -7
  131. package/dist/src/embed/base.d.ts.map +1 -1
  132. package/dist/src/embed/embedConfig.d.ts +0 -2
  133. package/dist/src/embed/embedConfig.d.ts.map +1 -1
  134. package/dist/src/embed/liveboard.d.ts +14 -28
  135. package/dist/src/embed/liveboard.d.ts.map +1 -1
  136. package/dist/src/embed/sage.d.ts +5 -21
  137. package/dist/src/embed/sage.d.ts.map +1 -1
  138. package/dist/src/embed/search-bar.d.ts +0 -11
  139. package/dist/src/embed/search-bar.d.ts.map +1 -1
  140. package/dist/src/embed/search.d.ts +60 -29
  141. package/dist/src/embed/search.d.ts.map +1 -1
  142. package/dist/src/embed/ts-embed.d.ts +1 -31
  143. package/dist/src/embed/ts-embed.d.ts.map +1 -1
  144. package/dist/src/index.d.ts +0 -1
  145. package/dist/src/index.d.ts.map +1 -1
  146. package/dist/src/mixpanel-service.d.ts +0 -1
  147. package/dist/src/mixpanel-service.d.ts.map +1 -1
  148. package/dist/src/react/index.d.ts +1 -12
  149. package/dist/src/react/index.d.ts.map +1 -1
  150. package/dist/src/test/test-utils.d.ts +0 -2
  151. package/dist/src/test/test-utils.d.ts.map +1 -1
  152. package/dist/src/tokenizedFetch.d.ts +0 -1
  153. package/dist/src/tokenizedFetch.d.ts.map +1 -1
  154. package/dist/src/types.d.ts +245 -366
  155. package/dist/src/types.d.ts.map +1 -1
  156. package/dist/src/utils/authService/authService.d.ts +0 -1
  157. package/dist/src/utils/authService/authService.d.ts.map +1 -1
  158. package/dist/src/utils/graphql/answerService/answer-queries.d.ts +2 -0
  159. package/dist/src/utils/graphql/answerService/answer-queries.d.ts.map +1 -1
  160. package/dist/src/utils/graphql/answerService/answerService.d.ts +37 -12
  161. package/dist/src/utils/graphql/answerService/answerService.d.ts.map +1 -1
  162. package/dist/src/utils/logger.d.ts.map +1 -1
  163. package/dist/src/utils/processTrigger.d.ts +0 -1
  164. package/dist/src/utils/processTrigger.d.ts.map +1 -1
  165. package/dist/src/utils.d.ts +2 -10
  166. package/dist/src/utils.d.ts.map +1 -1
  167. package/dist/tsembed-react.es.js +2331 -2358
  168. package/dist/tsembed-react.js +3475 -3498
  169. package/dist/tsembed.es.js +3690 -3922
  170. package/dist/tsembed.js +15218 -15442
  171. package/dist/visual-embed-sdk-react-full.d.ts +431 -564
  172. package/dist/visual-embed-sdk-react.d.ts +434 -567
  173. package/dist/visual-embed-sdk.d.ts +430 -552
  174. package/lib/package.json +2 -1
  175. package/lib/src/auth.d.ts +0 -15
  176. package/lib/src/auth.d.ts.map +1 -1
  177. package/lib/src/auth.js +3 -14
  178. package/lib/src/auth.js.map +1 -1
  179. package/lib/src/authToken.d.ts +1 -2
  180. package/lib/src/authToken.d.ts.map +1 -1
  181. package/lib/src/authToken.js +9 -3
  182. package/lib/src/authToken.js.map +1 -1
  183. package/lib/src/authToken.spec.d.ts +2 -0
  184. package/lib/src/authToken.spec.d.ts.map +1 -0
  185. package/lib/src/authToken.spec.js +26 -0
  186. package/lib/src/authToken.spec.js.map +1 -0
  187. package/lib/src/config.d.ts +0 -1
  188. package/lib/src/config.d.ts.map +1 -1
  189. package/lib/src/config.js +0 -2
  190. package/lib/src/config.js.map +1 -1
  191. package/lib/src/embed/app.d.ts +73 -43
  192. package/lib/src/embed/app.d.ts.map +1 -1
  193. package/lib/src/embed/app.js +44 -11
  194. package/lib/src/embed/app.js.map +1 -1
  195. package/lib/src/embed/app.spec.js +22 -1
  196. package/lib/src/embed/app.spec.js.map +1 -1
  197. package/lib/src/embed/base.d.ts +1 -7
  198. package/lib/src/embed/base.d.ts.map +1 -1
  199. package/lib/src/embed/base.js +8 -14
  200. package/lib/src/embed/base.js.map +1 -1
  201. package/lib/src/embed/base.spec.js +4 -2
  202. package/lib/src/embed/base.spec.js.map +1 -1
  203. package/lib/src/embed/embedConfig.d.ts +0 -2
  204. package/lib/src/embed/embedConfig.d.ts.map +1 -1
  205. package/lib/src/embed/embedConfig.js +0 -2
  206. package/lib/src/embed/embedConfig.js.map +1 -1
  207. package/lib/src/embed/liveboard.d.ts +14 -28
  208. package/lib/src/embed/liveboard.d.ts.map +1 -1
  209. package/lib/src/embed/liveboard.js +10 -10
  210. package/lib/src/embed/liveboard.js.map +1 -1
  211. package/lib/src/embed/liveboard.spec.js +79 -4
  212. package/lib/src/embed/liveboard.spec.js.map +1 -1
  213. package/lib/src/embed/sage.d.ts +5 -21
  214. package/lib/src/embed/sage.d.ts.map +1 -1
  215. package/lib/src/embed/sage.js +2 -23
  216. package/lib/src/embed/sage.js.map +1 -1
  217. package/lib/src/embed/sage.spec.js +20 -31
  218. package/lib/src/embed/sage.spec.js.map +1 -1
  219. package/lib/src/embed/search-bar.d.ts +0 -11
  220. package/lib/src/embed/search-bar.d.ts.map +1 -1
  221. package/lib/src/embed/search-bar.js +0 -2
  222. package/lib/src/embed/search-bar.js.map +1 -1
  223. package/lib/src/embed/search.d.ts +60 -29
  224. package/lib/src/embed/search.d.ts.map +1 -1
  225. package/lib/src/embed/search.js +43 -9
  226. package/lib/src/embed/search.js.map +1 -1
  227. package/lib/src/embed/search.spec.js +35 -1
  228. package/lib/src/embed/search.spec.js.map +1 -1
  229. package/lib/src/embed/ts-embed.d.ts +1 -31
  230. package/lib/src/embed/ts-embed.d.ts.map +1 -1
  231. package/lib/src/embed/ts-embed.js +37 -46
  232. package/lib/src/embed/ts-embed.js.map +1 -1
  233. package/lib/src/embed/ts-embed.spec.js +83 -9
  234. package/lib/src/embed/ts-embed.spec.js.map +1 -1
  235. package/lib/src/errors.js +1 -1
  236. package/lib/src/errors.js.map +1 -1
  237. package/lib/src/index.d.ts +0 -1
  238. package/lib/src/index.d.ts.map +1 -1
  239. package/lib/src/index.js +0 -1
  240. package/lib/src/index.js.map +1 -1
  241. package/lib/src/mixpanel-service.d.ts +0 -1
  242. package/lib/src/mixpanel-service.d.ts.map +1 -1
  243. package/lib/src/mixpanel-service.js +0 -1
  244. package/lib/src/mixpanel-service.js.map +1 -1
  245. package/lib/src/react/index.d.ts +1 -12
  246. package/lib/src/react/index.d.ts.map +1 -1
  247. package/lib/src/react/index.js +1 -11
  248. package/lib/src/react/index.js.map +1 -1
  249. package/lib/src/react/index.spec.js +16 -4
  250. package/lib/src/react/index.spec.js.map +1 -1
  251. package/lib/src/test/test-utils.d.ts +0 -2
  252. package/lib/src/test/test-utils.d.ts.map +1 -1
  253. package/lib/src/test/test-utils.js +0 -2
  254. package/lib/src/test/test-utils.js.map +1 -1
  255. package/lib/src/tokenizedFetch.d.ts +0 -1
  256. package/lib/src/tokenizedFetch.d.ts.map +1 -1
  257. package/lib/src/tokenizedFetch.js +0 -1
  258. package/lib/src/tokenizedFetch.js.map +1 -1
  259. package/lib/src/types.d.ts +245 -366
  260. package/lib/src/types.d.ts.map +1 -1
  261. package/lib/src/types.js +196 -296
  262. package/lib/src/types.js.map +1 -1
  263. package/lib/src/utils/authService/authService.d.ts +0 -1
  264. package/lib/src/utils/authService/authService.d.ts.map +1 -1
  265. package/lib/src/utils/authService/authService.js +0 -1
  266. package/lib/src/utils/authService/authService.js.map +1 -1
  267. package/lib/src/utils/authService/authService.spec.js +1 -1
  268. package/lib/src/utils/authService/authService.spec.js.map +1 -1
  269. package/lib/src/utils/graphql/answerService/answer-queries.d.ts +2 -0
  270. package/lib/src/utils/graphql/answerService/answer-queries.d.ts.map +1 -1
  271. package/lib/src/utils/graphql/answerService/answer-queries.js +56 -0
  272. package/lib/src/utils/graphql/answerService/answer-queries.js.map +1 -1
  273. package/lib/src/utils/graphql/answerService/answerService.d.ts +37 -12
  274. package/lib/src/utils/graphql/answerService/answerService.d.ts.map +1 -1
  275. package/lib/src/utils/graphql/answerService/answerService.js +71 -15
  276. package/lib/src/utils/graphql/answerService/answerService.js.map +1 -1
  277. package/lib/src/utils/graphql/answerService/answerService.spec.js +80 -2
  278. package/lib/src/utils/graphql/answerService/answerService.spec.js.map +1 -1
  279. package/lib/src/utils/logger.d.ts.map +1 -1
  280. package/lib/src/utils/logger.js +2 -3
  281. package/lib/src/utils/logger.js.map +1 -1
  282. package/lib/src/utils/processData.js +1 -1
  283. package/lib/src/utils/processData.js.map +1 -1
  284. package/lib/src/utils/processData.spec.js +1 -1
  285. package/lib/src/utils/processData.spec.js.map +1 -1
  286. package/lib/src/utils/processTrigger.d.ts +0 -1
  287. package/lib/src/utils/processTrigger.d.ts.map +1 -1
  288. package/lib/src/utils/processTrigger.js +0 -2
  289. package/lib/src/utils/processTrigger.js.map +1 -1
  290. package/lib/src/utils.d.ts +2 -10
  291. package/lib/src/utils.d.ts.map +1 -1
  292. package/lib/src/utils.js +17 -12
  293. package/lib/src/utils.js.map +1 -1
  294. package/lib/src/visual-embed-sdk.d.ts +436 -558
  295. package/package.json +3 -1
  296. package/src/auth.spec.ts +72 -66
  297. package/src/auth.ts +53 -54
  298. package/src/authToken.spec.ts +31 -0
  299. package/src/authToken.ts +12 -12
  300. package/src/config.ts +0 -2
  301. package/src/embed/app.spec.ts +39 -5
  302. package/src/embed/app.ts +108 -50
  303. package/src/embed/base.spec.ts +5 -4
  304. package/src/embed/base.ts +30 -36
  305. package/src/embed/embed.spec.ts +0 -2
  306. package/src/embed/embedConfig.ts +0 -2
  307. package/src/embed/events.spec.ts +0 -2
  308. package/src/embed/liveboard.spec.ts +104 -11
  309. package/src/embed/liveboard.ts +25 -38
  310. package/src/embed/pinboard.spec.ts +0 -2
  311. package/src/embed/sage.spec.ts +20 -38
  312. package/src/embed/sage.ts +5 -38
  313. package/src/embed/search-bar.tsx +0 -11
  314. package/src/embed/search.spec.ts +48 -2
  315. package/src/embed/search.ts +94 -38
  316. package/src/embed/ts-embed-trigger.spec.ts +0 -3
  317. package/src/embed/ts-embed.spec.ts +109 -32
  318. package/src/embed/ts-embed.ts +68 -79
  319. package/src/errors.ts +1 -1
  320. package/src/index.ts +1 -3
  321. package/src/mixpanel-service.spec.ts +3 -4
  322. package/src/mixpanel-service.ts +1 -4
  323. package/src/react/index.spec.tsx +48 -67
  324. package/src/react/index.tsx +1 -13
  325. package/src/test/test-utils.ts +0 -2
  326. package/src/tokenizedFetch.ts +0 -1
  327. package/src/types.ts +245 -365
  328. package/src/utils/authService/authService.spec.ts +8 -13
  329. package/src/utils/authService/authService.ts +0 -2
  330. package/src/utils/authService/tokenizedAuthService.ts +8 -38
  331. package/src/utils/graphql/answerService/answer-queries.ts +58 -0
  332. package/src/utils/graphql/answerService/answerService.spec.ts +88 -2
  333. package/src/utils/graphql/answerService/answerService.ts +87 -16
  334. package/src/utils/logger.ts +2 -3
  335. package/src/utils/processData.spec.ts +3 -4
  336. package/src/utils/processData.ts +4 -2
  337. package/src/utils/processTrigger.ts +0 -2
  338. package/src/utils.ts +21 -13
  339. package/cjs/src/utils/sessionInfoService.d.ts +0 -66
  340. package/cjs/src/utils/sessionInfoService.d.ts.map +0 -1
  341. package/cjs/src/utils/sessionInfoService.js +0 -92
  342. package/cjs/src/utils/sessionInfoService.js.map +0 -1
  343. package/lib/src/utils/sessionInfoService.d.ts +0 -66
  344. package/lib/src/utils/sessionInfoService.d.ts.map +0 -1
  345. package/lib/src/utils/sessionInfoService.js +0 -85
  346. package/lib/src/utils/sessionInfoService.js.map +0 -1
  347. package/src/utils/sessionInfoService.ts +0 -101
package/src/utils.ts CHANGED
@@ -2,7 +2,6 @@
2
2
  * Copyright (c) 2023
3
3
  *
4
4
  * Common utility functions for ThoughtSpot Visual Embed SDK
5
- *
6
5
  * @summary Utils
7
6
  * @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
8
7
  */
@@ -23,17 +22,21 @@ import {
23
22
  * Refer to the following docs for more details on runtime filter syntax:
24
23
  * https://cloud-docs.thoughtspot.com/admin/ts-cloud/apply-runtime-filter.html
25
24
  * https://cloud-docs.thoughtspot.com/admin/ts-cloud/runtime-filter-operators.html
26
- *
27
25
  * @param runtimeFilters
28
26
  */
29
- export const getFilterQuery = (runtimeFilters: RuntimeFilter[]): string => {
27
+ export const getFilterQuery = (runtimeFilters: RuntimeFilter[]): string | null => {
30
28
  if (runtimeFilters && runtimeFilters.length) {
31
29
  const filters = runtimeFilters.map((filter, valueIndex) => {
32
30
  const index = valueIndex + 1;
33
31
  const filterExpr = [];
34
32
  filterExpr.push(`col${index}=${encodeURIComponent(filter.columnName)}`);
35
33
  filterExpr.push(`op${index}=${filter.operator}`);
36
- filterExpr.push(filter.values.map((value) => `val${index}=${encodeURIComponent(value)}`).join('&'));
34
+ filterExpr.push(
35
+ filter.values.map((value) => {
36
+ const encodedValue = typeof value === 'bigint' ? value.toString() : value;
37
+ return `val${index}=${encodeURIComponent(String(encodedValue))}`;
38
+ }).join('&'),
39
+ );
37
40
 
38
41
  return filterExpr.join('&');
39
42
  });
@@ -46,7 +49,6 @@ export const getFilterQuery = (runtimeFilters: RuntimeFilter[]): string => {
46
49
 
47
50
  /**
48
51
  * Construct a runtime parameter override query string from the given option.
49
- *
50
52
  * @param runtimeParameters
51
53
  */
52
54
  export const getRuntimeParameters = (runtimeParameters: RuntimeParameter[]): string => {
@@ -69,7 +71,6 @@ export const getRuntimeParameters = (runtimeParameters: RuntimeParameter[]): str
69
71
  /**
70
72
  * Convert a value to a string representation to be sent as a query
71
73
  * parameter to the ThoughtSpot app.
72
- *
73
74
  * @param value Any parameter value
74
75
  */
75
76
  const serializeParam = (value: any) => {
@@ -85,14 +86,12 @@ const serializeParam = (value: any) => {
85
86
  * Convert a value to a string:
86
87
  * in case of an array, we convert it to CSV.
87
88
  * in case of any other type, we directly return the value.
88
- *
89
89
  * @param value
90
90
  */
91
91
  const paramToString = (value: any) => (Array.isArray(value) ? value.join(',') : value);
92
92
 
93
93
  /**
94
94
  * Return a query param string composed from the given params object
95
- *
96
95
  * @param queryParams
97
96
  * @param shouldSerializeParamValues
98
97
  */
@@ -122,7 +121,6 @@ export const getQueryParamString = (
122
121
  /**
123
122
  * Get a string representation of a dimension value in CSS
124
123
  * If numeric, it is considered in pixels.
125
- *
126
124
  * @param value
127
125
  */
128
126
  export const getCssDimension = (value: number | string): string => {
@@ -135,7 +133,6 @@ export const getCssDimension = (value: number | string): string => {
135
133
 
136
134
  /**
137
135
  * Append a string to a URL's hash fragment
138
- *
139
136
  * @param url A URL
140
137
  * @param stringToAppend The string to append to the URL hash
141
138
  */
@@ -240,7 +237,6 @@ export const getRuntimeFilters = (runtimefilters: any) => getFilterQuery(runtime
240
237
  /**
241
238
  * Gets a reference to the DOM node given
242
239
  * a selector.
243
- *
244
240
  * @param domSelector
245
241
  */
246
242
  export function getDOMNode(domSelector: DOMSelector): HTMLElement {
@@ -275,7 +271,6 @@ export function removeTypename(obj: any) {
275
271
 
276
272
  /**
277
273
  * Sets the specified style properties on an HTML element.
278
- *
279
274
  * @param {HTMLElement} element - The HTML element to which the styles should be applied.
280
275
  * @param {Partial<CSSStyleDeclaration>} styleProperties - An object containing style
281
276
  * property names and their values.
@@ -299,7 +294,6 @@ export const setStyleProperties = (
299
294
  };
300
295
  /**
301
296
  * Removes specified style properties from an HTML element.
302
- *
303
297
  * @param {HTMLElement} element - The HTML element from which the styles should be removed.
304
298
  * @param {string[]} styleProperties - An array of style property names to be removed.
305
299
  * @example
@@ -317,3 +311,17 @@ export const removeStyleProperties = (element: HTMLElement, styleProperties: str
317
311
  };
318
312
 
319
313
  export const isUndefined = (value: any): boolean => value === undefined;
314
+
315
+ // Return if the value is a string, double or boolean.
316
+ export const getTypeFromValue = (value: any): [string, string] => {
317
+ if (typeof value === 'string') {
318
+ return ['char', 'string'];
319
+ }
320
+ if (typeof value === 'number') {
321
+ return ['double', 'double'];
322
+ }
323
+ if (typeof value === 'boolean') {
324
+ return ['boolean', 'boolean'];
325
+ }
326
+ return ['', ''];
327
+ };
@@ -1,66 +0,0 @@
1
- export type SessionInfo = {
2
- releaseVersion: string;
3
- userGUID: string;
4
- currentOrgId: number;
5
- privileges: string[];
6
- mixpanelToken: string;
7
- isPublicUser: boolean;
8
- clusterId: string;
9
- clusterName: string;
10
- [key: string]: any;
11
- };
12
- /**
13
- * Returns the session info object and caches it for future use.
14
- * Once fetched the session info object is cached and returned from the cache on
15
- * subsequent calls.
16
- *
17
- * @example ```js
18
- * const sessionInfo = await getSessionInfo();
19
- * console.log(sessionInfo);
20
- * ```
21
- * @version SDK: 1.28.3 | ThoughtSpot: *
22
- * @returns {Promise<SessionInfo>} The session info object.
23
- */
24
- export declare function getSessionInfo(): Promise<SessionInfo>;
25
- /**
26
- * Returns the cached session info object. If the client is not authenticated the
27
- * function will return null.
28
- *
29
- * @example ```js
30
- * const sessionInfo = getSessionInfoSync();
31
- * if (sessionInfo) {
32
- * console.log(sessionInfo);
33
- * } else {
34
- * console.log('Not authenticated');
35
- * }
36
- * ```
37
- * @returns {SessionInfo | null} The session info object.
38
- * @version SDK: 1.28.3 | ThoughtSpot: *
39
- */
40
- export declare function getSessionInfoSync(): SessionInfo | null;
41
- /**
42
- * Processes the session info response and returns the session info object.
43
- *
44
- * @param sessionInfoResp {any} Response from the session info API.
45
- * @returns {SessionInfo} The session info object.
46
- * @example ```js
47
- * const sessionInfoResp = await fetch(sessionInfoPath);
48
- * const sessionInfo = getSessionDetails(sessionInfoResp);
49
- * console.log(sessionInfo);
50
- * ```
51
- * @version SDK: 1.28.3 | ThoughtSpot: *
52
- */
53
- export declare const getSessionDetails: (sessionInfoResp: any) => SessionInfo;
54
- /**
55
- * Resets the cached session info object and forces a new fetch on the next call.
56
- *
57
- * @example ```js
58
- * resetCachedSessionInfo();
59
- * const sessionInfo = await getSessionInfo();
60
- * console.log(sessionInfo);
61
- * ```
62
- * @version SDK: 1.28.3 | ThoughtSpot ts7.april.cl, 7.2.1
63
- * @returns {void}
64
- */
65
- export declare function resetCachedSessionInfo(): void;
66
- //# sourceMappingURL=sessionInfoService.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sessionInfoService.d.ts","sourceRoot":"","sources":["../../../src/utils/sessionInfoService.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,WAAW,GAAG;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,OAAO,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACtB,CAAC;AAIF;;;;;;;;;;;GAWG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,WAAW,CAAC,CAQ3D;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kBAAkB,IAAI,WAAW,GAAG,IAAI,CAEvD;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,iBAAiB,oBAAqB,GAAG,KAAG,WAexD,CAAC;AAEF;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,IAAI,IAAI,CAE7C"}
@@ -1,92 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.resetCachedSessionInfo = exports.getSessionDetails = exports.getSessionInfoSync = exports.getSessionInfo = void 0;
4
- const embedConfig_1 = require("../embed/embedConfig");
5
- const authService_1 = require("./authService");
6
- let sessionInfo = null;
7
- /**
8
- * Returns the session info object and caches it for future use.
9
- * Once fetched the session info object is cached and returned from the cache on
10
- * subsequent calls.
11
- *
12
- * @example ```js
13
- * const sessionInfo = await getSessionInfo();
14
- * console.log(sessionInfo);
15
- * ```
16
- * @version SDK: 1.28.3 | ThoughtSpot: *
17
- * @returns {Promise<SessionInfo>} The session info object.
18
- */
19
- async function getSessionInfo() {
20
- if (!sessionInfo) {
21
- const host = (0, embedConfig_1.getEmbedConfig)().thoughtSpotHost;
22
- const sessionResponse = await (0, authService_1.fetchSessionInfoService)(host);
23
- const processedSessionInfo = (0, exports.getSessionDetails)(sessionResponse);
24
- sessionInfo = processedSessionInfo;
25
- }
26
- return sessionInfo;
27
- }
28
- exports.getSessionInfo = getSessionInfo;
29
- /**
30
- * Returns the cached session info object. If the client is not authenticated the
31
- * function will return null.
32
- *
33
- * @example ```js
34
- * const sessionInfo = getSessionInfoSync();
35
- * if (sessionInfo) {
36
- * console.log(sessionInfo);
37
- * } else {
38
- * console.log('Not authenticated');
39
- * }
40
- * ```
41
- * @returns {SessionInfo | null} The session info object.
42
- * @version SDK: 1.28.3 | ThoughtSpot: *
43
- */
44
- function getSessionInfoSync() {
45
- return sessionInfo;
46
- }
47
- exports.getSessionInfoSync = getSessionInfoSync;
48
- /**
49
- * Processes the session info response and returns the session info object.
50
- *
51
- * @param sessionInfoResp {any} Response from the session info API.
52
- * @returns {SessionInfo} The session info object.
53
- * @example ```js
54
- * const sessionInfoResp = await fetch(sessionInfoPath);
55
- * const sessionInfo = getSessionDetails(sessionInfoResp);
56
- * console.log(sessionInfo);
57
- * ```
58
- * @version SDK: 1.28.3 | ThoughtSpot: *
59
- */
60
- const getSessionDetails = (sessionInfoResp) => {
61
- const devMixpanelToken = sessionInfoResp.configInfo.mixpanelConfig.devSdkKey;
62
- const prodMixpanelToken = sessionInfoResp.configInfo.mixpanelConfig.prodSdkKey;
63
- const mixpanelToken = sessionInfoResp.configInfo.mixpanelConfig.production
64
- ? prodMixpanelToken
65
- : devMixpanelToken;
66
- return {
67
- userGUID: sessionInfoResp.userGUID,
68
- mixpanelToken,
69
- isPublicUser: sessionInfoResp.configInfo.isPublicUser,
70
- releaseVersion: sessionInfoResp.releaseVersion,
71
- clusterId: sessionInfoResp.configInfo.selfClusterId,
72
- clusterName: sessionInfoResp.configInfo.selfClusterName,
73
- ...sessionInfoResp,
74
- };
75
- };
76
- exports.getSessionDetails = getSessionDetails;
77
- /**
78
- * Resets the cached session info object and forces a new fetch on the next call.
79
- *
80
- * @example ```js
81
- * resetCachedSessionInfo();
82
- * const sessionInfo = await getSessionInfo();
83
- * console.log(sessionInfo);
84
- * ```
85
- * @version SDK: 1.28.3 | ThoughtSpot ts7.april.cl, 7.2.1
86
- * @returns {void}
87
- */
88
- function resetCachedSessionInfo() {
89
- sessionInfo = null;
90
- }
91
- exports.resetCachedSessionInfo = resetCachedSessionInfo;
92
- //# sourceMappingURL=sessionInfoService.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sessionInfoService.js","sourceRoot":"","sources":["../../../src/utils/sessionInfoService.ts"],"names":[],"mappings":";;;AAAA,sDAAsD;AACtD,+CAAwD;AAcxD,IAAI,WAAW,GAAuB,IAAI,CAAC;AAE3C;;;;;;;;;;;GAWG;AACI,KAAK,UAAU,cAAc;IAChC,IAAI,CAAC,WAAW,EAAE;QACd,MAAM,IAAI,GAAG,IAAA,4BAAc,GAAE,CAAC,eAAe,CAAC;QAC9C,MAAM,eAAe,GAAG,MAAM,IAAA,qCAAuB,EAAC,IAAI,CAAC,CAAC;QAC5D,MAAM,oBAAoB,GAAG,IAAA,yBAAiB,EAAC,eAAe,CAAC,CAAC;QAChE,WAAW,GAAG,oBAAoB,CAAC;KACtC;IACD,OAAO,WAAW,CAAC;AACvB,CAAC;AARD,wCAQC;AAED;;;;;;;;;;;;;;GAcG;AACH,SAAgB,kBAAkB;IAC9B,OAAO,WAAW,CAAC;AACvB,CAAC;AAFD,gDAEC;AAED;;;;;;;;;;;GAWG;AACI,MAAM,iBAAiB,GAAG,CAAC,eAAoB,EAAe,EAAE;IACnE,MAAM,gBAAgB,GAAG,eAAe,CAAC,UAAU,CAAC,cAAc,CAAC,SAAS,CAAC;IAC7E,MAAM,iBAAiB,GAAG,eAAe,CAAC,UAAU,CAAC,cAAc,CAAC,UAAU,CAAC;IAC/E,MAAM,aAAa,GAAG,eAAe,CAAC,UAAU,CAAC,cAAc,CAAC,UAAU;QACtE,CAAC,CAAC,iBAAiB;QACnB,CAAC,CAAC,gBAAgB,CAAC;IACvB,OAAO;QACH,QAAQ,EAAE,eAAe,CAAC,QAAQ;QAClC,aAAa;QACb,YAAY,EAAE,eAAe,CAAC,UAAU,CAAC,YAAY;QACrD,cAAc,EAAE,eAAe,CAAC,cAAc;QAC9C,SAAS,EAAE,eAAe,CAAC,UAAU,CAAC,aAAa;QACnD,WAAW,EAAE,eAAe,CAAC,UAAU,CAAC,eAAe;QACvD,GAAG,eAAe;KACrB,CAAC;AACN,CAAC,CAAC;AAfW,QAAA,iBAAiB,qBAe5B;AAEF;;;;;;;;;;GAUG;AACH,SAAgB,sBAAsB;IAClC,WAAW,GAAG,IAAI,CAAC;AACvB,CAAC;AAFD,wDAEC"}
@@ -1,66 +0,0 @@
1
- export type SessionInfo = {
2
- releaseVersion: string;
3
- userGUID: string;
4
- currentOrgId: number;
5
- privileges: string[];
6
- mixpanelToken: string;
7
- isPublicUser: boolean;
8
- clusterId: string;
9
- clusterName: string;
10
- [key: string]: any;
11
- };
12
- /**
13
- * Returns the session info object and caches it for future use.
14
- * Once fetched the session info object is cached and returned from the cache on
15
- * subsequent calls.
16
- *
17
- * @example ```js
18
- * const sessionInfo = await getSessionInfo();
19
- * console.log(sessionInfo);
20
- * ```
21
- * @version SDK: 1.28.3 | ThoughtSpot: *
22
- * @returns {Promise<SessionInfo>} The session info object.
23
- */
24
- export declare function getSessionInfo(): Promise<SessionInfo>;
25
- /**
26
- * Returns the cached session info object. If the client is not authenticated the
27
- * function will return null.
28
- *
29
- * @example ```js
30
- * const sessionInfo = getSessionInfoSync();
31
- * if (sessionInfo) {
32
- * console.log(sessionInfo);
33
- * } else {
34
- * console.log('Not authenticated');
35
- * }
36
- * ```
37
- * @returns {SessionInfo | null} The session info object.
38
- * @version SDK: 1.28.3 | ThoughtSpot: *
39
- */
40
- export declare function getSessionInfoSync(): SessionInfo | null;
41
- /**
42
- * Processes the session info response and returns the session info object.
43
- *
44
- * @param sessionInfoResp {any} Response from the session info API.
45
- * @returns {SessionInfo} The session info object.
46
- * @example ```js
47
- * const sessionInfoResp = await fetch(sessionInfoPath);
48
- * const sessionInfo = getSessionDetails(sessionInfoResp);
49
- * console.log(sessionInfo);
50
- * ```
51
- * @version SDK: 1.28.3 | ThoughtSpot: *
52
- */
53
- export declare const getSessionDetails: (sessionInfoResp: any) => SessionInfo;
54
- /**
55
- * Resets the cached session info object and forces a new fetch on the next call.
56
- *
57
- * @example ```js
58
- * resetCachedSessionInfo();
59
- * const sessionInfo = await getSessionInfo();
60
- * console.log(sessionInfo);
61
- * ```
62
- * @version SDK: 1.28.3 | ThoughtSpot ts7.april.cl, 7.2.1
63
- * @returns {void}
64
- */
65
- export declare function resetCachedSessionInfo(): void;
66
- //# sourceMappingURL=sessionInfoService.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sessionInfoService.d.ts","sourceRoot":"","sources":["../../../src/utils/sessionInfoService.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,WAAW,GAAG;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,OAAO,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACtB,CAAC;AAIF;;;;;;;;;;;GAWG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,WAAW,CAAC,CAQ3D;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kBAAkB,IAAI,WAAW,GAAG,IAAI,CAEvD;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,iBAAiB,oBAAqB,GAAG,KAAG,WAexD,CAAC;AAEF;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,IAAI,IAAI,CAE7C"}
@@ -1,85 +0,0 @@
1
- import { getEmbedConfig } from '../embed/embedConfig';
2
- import { fetchSessionInfoService } from './authService';
3
- let sessionInfo = null;
4
- /**
5
- * Returns the session info object and caches it for future use.
6
- * Once fetched the session info object is cached and returned from the cache on
7
- * subsequent calls.
8
- *
9
- * @example ```js
10
- * const sessionInfo = await getSessionInfo();
11
- * console.log(sessionInfo);
12
- * ```
13
- * @version SDK: 1.28.3 | ThoughtSpot: *
14
- * @returns {Promise<SessionInfo>} The session info object.
15
- */
16
- export async function getSessionInfo() {
17
- if (!sessionInfo) {
18
- const host = getEmbedConfig().thoughtSpotHost;
19
- const sessionResponse = await fetchSessionInfoService(host);
20
- const processedSessionInfo = getSessionDetails(sessionResponse);
21
- sessionInfo = processedSessionInfo;
22
- }
23
- return sessionInfo;
24
- }
25
- /**
26
- * Returns the cached session info object. If the client is not authenticated the
27
- * function will return null.
28
- *
29
- * @example ```js
30
- * const sessionInfo = getSessionInfoSync();
31
- * if (sessionInfo) {
32
- * console.log(sessionInfo);
33
- * } else {
34
- * console.log('Not authenticated');
35
- * }
36
- * ```
37
- * @returns {SessionInfo | null} The session info object.
38
- * @version SDK: 1.28.3 | ThoughtSpot: *
39
- */
40
- export function getSessionInfoSync() {
41
- return sessionInfo;
42
- }
43
- /**
44
- * Processes the session info response and returns the session info object.
45
- *
46
- * @param sessionInfoResp {any} Response from the session info API.
47
- * @returns {SessionInfo} The session info object.
48
- * @example ```js
49
- * const sessionInfoResp = await fetch(sessionInfoPath);
50
- * const sessionInfo = getSessionDetails(sessionInfoResp);
51
- * console.log(sessionInfo);
52
- * ```
53
- * @version SDK: 1.28.3 | ThoughtSpot: *
54
- */
55
- export const getSessionDetails = (sessionInfoResp) => {
56
- const devMixpanelToken = sessionInfoResp.configInfo.mixpanelConfig.devSdkKey;
57
- const prodMixpanelToken = sessionInfoResp.configInfo.mixpanelConfig.prodSdkKey;
58
- const mixpanelToken = sessionInfoResp.configInfo.mixpanelConfig.production
59
- ? prodMixpanelToken
60
- : devMixpanelToken;
61
- return {
62
- userGUID: sessionInfoResp.userGUID,
63
- mixpanelToken,
64
- isPublicUser: sessionInfoResp.configInfo.isPublicUser,
65
- releaseVersion: sessionInfoResp.releaseVersion,
66
- clusterId: sessionInfoResp.configInfo.selfClusterId,
67
- clusterName: sessionInfoResp.configInfo.selfClusterName,
68
- ...sessionInfoResp,
69
- };
70
- };
71
- /**
72
- * Resets the cached session info object and forces a new fetch on the next call.
73
- *
74
- * @example ```js
75
- * resetCachedSessionInfo();
76
- * const sessionInfo = await getSessionInfo();
77
- * console.log(sessionInfo);
78
- * ```
79
- * @version SDK: 1.28.3 | ThoughtSpot ts7.april.cl, 7.2.1
80
- * @returns {void}
81
- */
82
- export function resetCachedSessionInfo() {
83
- sessionInfo = null;
84
- }
85
- //# sourceMappingURL=sessionInfoService.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sessionInfoService.js","sourceRoot":"","sources":["../../../src/utils/sessionInfoService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAcxD,IAAI,WAAW,GAAuB,IAAI,CAAC;AAE3C;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc;IAChC,IAAI,CAAC,WAAW,EAAE;QACd,MAAM,IAAI,GAAG,cAAc,EAAE,CAAC,eAAe,CAAC;QAC9C,MAAM,eAAe,GAAG,MAAM,uBAAuB,CAAC,IAAI,CAAC,CAAC;QAC5D,MAAM,oBAAoB,GAAG,iBAAiB,CAAC,eAAe,CAAC,CAAC;QAChE,WAAW,GAAG,oBAAoB,CAAC;KACtC;IACD,OAAO,WAAW,CAAC;AACvB,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,kBAAkB;IAC9B,OAAO,WAAW,CAAC;AACvB,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,eAAoB,EAAe,EAAE;IACnE,MAAM,gBAAgB,GAAG,eAAe,CAAC,UAAU,CAAC,cAAc,CAAC,SAAS,CAAC;IAC7E,MAAM,iBAAiB,GAAG,eAAe,CAAC,UAAU,CAAC,cAAc,CAAC,UAAU,CAAC;IAC/E,MAAM,aAAa,GAAG,eAAe,CAAC,UAAU,CAAC,cAAc,CAAC,UAAU;QACtE,CAAC,CAAC,iBAAiB;QACnB,CAAC,CAAC,gBAAgB,CAAC;IACvB,OAAO;QACH,QAAQ,EAAE,eAAe,CAAC,QAAQ;QAClC,aAAa;QACb,YAAY,EAAE,eAAe,CAAC,UAAU,CAAC,YAAY;QACrD,cAAc,EAAE,eAAe,CAAC,cAAc;QAC9C,SAAS,EAAE,eAAe,CAAC,UAAU,CAAC,aAAa;QACnD,WAAW,EAAE,eAAe,CAAC,UAAU,CAAC,eAAe;QACvD,GAAG,eAAe;KACrB,CAAC;AACN,CAAC,CAAC;AAEF;;;;;;;;;;GAUG;AACH,MAAM,UAAU,sBAAsB;IAClC,WAAW,GAAG,IAAI,CAAC;AACvB,CAAC"}
@@ -1,101 +0,0 @@
1
- import { getEmbedConfig } from '../embed/embedConfig';
2
- import { fetchSessionInfoService } from './authService';
3
-
4
- export type SessionInfo = {
5
- releaseVersion: string;
6
- userGUID: string;
7
- currentOrgId: number;
8
- privileges: string[];
9
- mixpanelToken: string;
10
- isPublicUser: boolean;
11
- clusterId: string;
12
- clusterName: string;
13
- [key: string]: any;
14
- };
15
-
16
- let sessionInfo: null | SessionInfo = null;
17
-
18
- /**
19
- * Returns the session info object and caches it for future use.
20
- * Once fetched the session info object is cached and returned from the cache on
21
- * subsequent calls.
22
- *
23
- * @example ```js
24
- * const sessionInfo = await getSessionInfo();
25
- * console.log(sessionInfo);
26
- * ```
27
- * @version SDK: 1.28.3 | ThoughtSpot: *
28
- * @returns {Promise<SessionInfo>} The session info object.
29
- */
30
- export async function getSessionInfo(): Promise<SessionInfo> {
31
- if (!sessionInfo) {
32
- const host = getEmbedConfig().thoughtSpotHost;
33
- const sessionResponse = await fetchSessionInfoService(host);
34
- const processedSessionInfo = getSessionDetails(sessionResponse);
35
- sessionInfo = processedSessionInfo;
36
- }
37
- return sessionInfo;
38
- }
39
-
40
- /**
41
- * Returns the cached session info object. If the client is not authenticated the
42
- * function will return null.
43
- *
44
- * @example ```js
45
- * const sessionInfo = getSessionInfoSync();
46
- * if (sessionInfo) {
47
- * console.log(sessionInfo);
48
- * } else {
49
- * console.log('Not authenticated');
50
- * }
51
- * ```
52
- * @returns {SessionInfo | null} The session info object.
53
- * @version SDK: 1.28.3 | ThoughtSpot: *
54
- */
55
- export function getSessionInfoSync(): SessionInfo | null {
56
- return sessionInfo;
57
- }
58
-
59
- /**
60
- * Processes the session info response and returns the session info object.
61
- *
62
- * @param sessionInfoResp {any} Response from the session info API.
63
- * @returns {SessionInfo} The session info object.
64
- * @example ```js
65
- * const sessionInfoResp = await fetch(sessionInfoPath);
66
- * const sessionInfo = getSessionDetails(sessionInfoResp);
67
- * console.log(sessionInfo);
68
- * ```
69
- * @version SDK: 1.28.3 | ThoughtSpot: *
70
- */
71
- export const getSessionDetails = (sessionInfoResp: any): SessionInfo => {
72
- const devMixpanelToken = sessionInfoResp.configInfo.mixpanelConfig.devSdkKey;
73
- const prodMixpanelToken = sessionInfoResp.configInfo.mixpanelConfig.prodSdkKey;
74
- const mixpanelToken = sessionInfoResp.configInfo.mixpanelConfig.production
75
- ? prodMixpanelToken
76
- : devMixpanelToken;
77
- return {
78
- userGUID: sessionInfoResp.userGUID,
79
- mixpanelToken,
80
- isPublicUser: sessionInfoResp.configInfo.isPublicUser,
81
- releaseVersion: sessionInfoResp.releaseVersion,
82
- clusterId: sessionInfoResp.configInfo.selfClusterId,
83
- clusterName: sessionInfoResp.configInfo.selfClusterName,
84
- ...sessionInfoResp,
85
- };
86
- };
87
-
88
- /**
89
- * Resets the cached session info object and forces a new fetch on the next call.
90
- *
91
- * @example ```js
92
- * resetCachedSessionInfo();
93
- * const sessionInfo = await getSessionInfo();
94
- * console.log(sessionInfo);
95
- * ```
96
- * @version SDK: 1.28.3 | ThoughtSpot ts7.april.cl, 7.2.1
97
- * @returns {void}
98
- */
99
- export function resetCachedSessionInfo(): void {
100
- sessionInfo = null;
101
- }