@thoughtspot/visual-embed-sdk 1.29.0-alpha.fullH → 1.29.0

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 (351) 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 +7 -15
  28. package/cjs/src/embed/base.js.map +1 -1
  29. package/cjs/src/embed/base.spec.js +1 -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/authService/tokenizedAuthService.spec.d.ts +2 -0
  96. package/cjs/src/utils/authService/tokenizedAuthService.spec.d.ts.map +1 -0
  97. package/cjs/src/utils/authService/tokenizedAuthService.spec.js +32 -0
  98. package/cjs/src/utils/authService/tokenizedAuthService.spec.js.map +1 -0
  99. package/cjs/src/utils/graphql/answerService/answer-queries.d.ts +2 -0
  100. package/cjs/src/utils/graphql/answerService/answer-queries.d.ts.map +1 -1
  101. package/cjs/src/utils/graphql/answerService/answer-queries.js +57 -1
  102. package/cjs/src/utils/graphql/answerService/answer-queries.js.map +1 -1
  103. package/cjs/src/utils/graphql/answerService/answerService.d.ts +37 -12
  104. package/cjs/src/utils/graphql/answerService/answerService.d.ts.map +1 -1
  105. package/cjs/src/utils/graphql/answerService/answerService.js +70 -14
  106. package/cjs/src/utils/graphql/answerService/answerService.js.map +1 -1
  107. package/cjs/src/utils/graphql/answerService/answerService.spec.js +78 -0
  108. package/cjs/src/utils/graphql/answerService/answerService.spec.js.map +1 -1
  109. package/cjs/src/utils/logger.d.ts.map +1 -1
  110. package/cjs/src/utils/logger.js +3 -5
  111. package/cjs/src/utils/logger.js.map +1 -1
  112. package/cjs/src/utils/processData.js +1 -1
  113. package/cjs/src/utils/processData.js.map +1 -1
  114. package/cjs/src/utils/processData.spec.js +1 -1
  115. package/cjs/src/utils/processData.spec.js.map +1 -1
  116. package/cjs/src/utils/processTrigger.d.ts +0 -1
  117. package/cjs/src/utils/processTrigger.d.ts.map +1 -1
  118. package/cjs/src/utils/processTrigger.js +0 -2
  119. package/cjs/src/utils/processTrigger.js.map +1 -1
  120. package/cjs/src/utils/sessionInfoService.d.ts +2 -2
  121. package/cjs/src/utils/sessionInfoService.d.ts.map +1 -1
  122. package/cjs/src/utils/sessionInfoService.js +4 -4
  123. package/cjs/src/utils/sessionInfoService.js.map +1 -1
  124. package/cjs/src/utils.d.ts +2 -10
  125. package/cjs/src/utils.d.ts.map +1 -1
  126. package/cjs/src/utils.js +19 -13
  127. package/cjs/src/utils.js.map +1 -1
  128. package/dist/src/auth.d.ts +0 -15
  129. package/dist/src/auth.d.ts.map +1 -1
  130. package/dist/src/authToken.d.ts +1 -2
  131. package/dist/src/authToken.d.ts.map +1 -1
  132. package/dist/src/authToken.spec.d.ts +2 -0
  133. package/dist/src/authToken.spec.d.ts.map +1 -0
  134. package/dist/src/config.d.ts +0 -1
  135. package/dist/src/config.d.ts.map +1 -1
  136. package/dist/src/embed/app.d.ts +73 -43
  137. package/dist/src/embed/app.d.ts.map +1 -1
  138. package/dist/src/embed/base.d.ts +1 -7
  139. package/dist/src/embed/base.d.ts.map +1 -1
  140. package/dist/src/embed/embedConfig.d.ts +0 -2
  141. package/dist/src/embed/embedConfig.d.ts.map +1 -1
  142. package/dist/src/embed/liveboard.d.ts +14 -28
  143. package/dist/src/embed/liveboard.d.ts.map +1 -1
  144. package/dist/src/embed/sage.d.ts +5 -21
  145. package/dist/src/embed/sage.d.ts.map +1 -1
  146. package/dist/src/embed/search-bar.d.ts +0 -11
  147. package/dist/src/embed/search-bar.d.ts.map +1 -1
  148. package/dist/src/embed/search.d.ts +60 -29
  149. package/dist/src/embed/search.d.ts.map +1 -1
  150. package/dist/src/embed/ts-embed.d.ts +1 -31
  151. package/dist/src/embed/ts-embed.d.ts.map +1 -1
  152. package/dist/src/index.d.ts +0 -1
  153. package/dist/src/index.d.ts.map +1 -1
  154. package/dist/src/mixpanel-service.d.ts +0 -1
  155. package/dist/src/mixpanel-service.d.ts.map +1 -1
  156. package/dist/src/react/index.d.ts +1 -12
  157. package/dist/src/react/index.d.ts.map +1 -1
  158. package/dist/src/test/test-utils.d.ts +0 -2
  159. package/dist/src/test/test-utils.d.ts.map +1 -1
  160. package/dist/src/tokenizedFetch.d.ts +0 -1
  161. package/dist/src/tokenizedFetch.d.ts.map +1 -1
  162. package/dist/src/types.d.ts +245 -366
  163. package/dist/src/types.d.ts.map +1 -1
  164. package/dist/src/utils/authService/authService.d.ts +0 -1
  165. package/dist/src/utils/authService/authService.d.ts.map +1 -1
  166. package/dist/src/utils/authService/tokenizedAuthService.spec.d.ts +2 -0
  167. package/dist/src/utils/authService/tokenizedAuthService.spec.d.ts.map +1 -0
  168. package/dist/src/utils/graphql/answerService/answer-queries.d.ts +2 -0
  169. package/dist/src/utils/graphql/answerService/answer-queries.d.ts.map +1 -1
  170. package/dist/src/utils/graphql/answerService/answerService.d.ts +37 -12
  171. package/dist/src/utils/graphql/answerService/answerService.d.ts.map +1 -1
  172. package/dist/src/utils/logger.d.ts.map +1 -1
  173. package/dist/src/utils/processTrigger.d.ts +0 -1
  174. package/dist/src/utils/processTrigger.d.ts.map +1 -1
  175. package/dist/src/utils/sessionInfoService.d.ts +66 -0
  176. package/dist/src/utils/sessionInfoService.d.ts.map +1 -0
  177. package/dist/src/utils.d.ts +2 -10
  178. package/dist/src/utils.d.ts.map +1 -1
  179. package/dist/tsembed-react.es.js +2331 -2358
  180. package/dist/tsembed-react.js +3475 -3498
  181. package/dist/tsembed.es.js +3688 -3922
  182. package/dist/tsembed.js +15216 -15442
  183. package/dist/visual-embed-sdk-react-full.d.ts +431 -564
  184. package/dist/visual-embed-sdk-react.d.ts +434 -567
  185. package/dist/visual-embed-sdk.d.ts +430 -552
  186. package/lib/package.json +2 -1
  187. package/lib/src/auth.d.ts +0 -15
  188. package/lib/src/auth.d.ts.map +1 -1
  189. package/lib/src/auth.js +3 -14
  190. package/lib/src/auth.js.map +1 -1
  191. package/lib/src/authToken.d.ts +1 -2
  192. package/lib/src/authToken.d.ts.map +1 -1
  193. package/lib/src/authToken.js +9 -3
  194. package/lib/src/authToken.js.map +1 -1
  195. package/lib/src/authToken.spec.d.ts +2 -0
  196. package/lib/src/authToken.spec.d.ts.map +1 -0
  197. package/lib/src/authToken.spec.js +26 -0
  198. package/lib/src/authToken.spec.js.map +1 -0
  199. package/lib/src/config.d.ts +0 -1
  200. package/lib/src/config.d.ts.map +1 -1
  201. package/lib/src/config.js +0 -2
  202. package/lib/src/config.js.map +1 -1
  203. package/lib/src/embed/app.d.ts +73 -43
  204. package/lib/src/embed/app.d.ts.map +1 -1
  205. package/lib/src/embed/app.js +44 -11
  206. package/lib/src/embed/app.js.map +1 -1
  207. package/lib/src/embed/app.spec.js +22 -1
  208. package/lib/src/embed/app.spec.js.map +1 -1
  209. package/lib/src/embed/base.d.ts +1 -7
  210. package/lib/src/embed/base.d.ts.map +1 -1
  211. package/lib/src/embed/base.js +6 -14
  212. package/lib/src/embed/base.js.map +1 -1
  213. package/lib/src/embed/base.spec.js +2 -2
  214. package/lib/src/embed/base.spec.js.map +1 -1
  215. package/lib/src/embed/embedConfig.d.ts +0 -2
  216. package/lib/src/embed/embedConfig.d.ts.map +1 -1
  217. package/lib/src/embed/embedConfig.js +0 -2
  218. package/lib/src/embed/embedConfig.js.map +1 -1
  219. package/lib/src/embed/liveboard.d.ts +14 -28
  220. package/lib/src/embed/liveboard.d.ts.map +1 -1
  221. package/lib/src/embed/liveboard.js +10 -10
  222. package/lib/src/embed/liveboard.js.map +1 -1
  223. package/lib/src/embed/liveboard.spec.js +79 -4
  224. package/lib/src/embed/liveboard.spec.js.map +1 -1
  225. package/lib/src/embed/sage.d.ts +5 -21
  226. package/lib/src/embed/sage.d.ts.map +1 -1
  227. package/lib/src/embed/sage.js +2 -23
  228. package/lib/src/embed/sage.js.map +1 -1
  229. package/lib/src/embed/sage.spec.js +20 -31
  230. package/lib/src/embed/sage.spec.js.map +1 -1
  231. package/lib/src/embed/search-bar.d.ts +0 -11
  232. package/lib/src/embed/search-bar.d.ts.map +1 -1
  233. package/lib/src/embed/search-bar.js +0 -2
  234. package/lib/src/embed/search-bar.js.map +1 -1
  235. package/lib/src/embed/search.d.ts +60 -29
  236. package/lib/src/embed/search.d.ts.map +1 -1
  237. package/lib/src/embed/search.js +43 -9
  238. package/lib/src/embed/search.js.map +1 -1
  239. package/lib/src/embed/search.spec.js +35 -1
  240. package/lib/src/embed/search.spec.js.map +1 -1
  241. package/lib/src/embed/ts-embed.d.ts +1 -31
  242. package/lib/src/embed/ts-embed.d.ts.map +1 -1
  243. package/lib/src/embed/ts-embed.js +37 -46
  244. package/lib/src/embed/ts-embed.js.map +1 -1
  245. package/lib/src/embed/ts-embed.spec.js +83 -9
  246. package/lib/src/embed/ts-embed.spec.js.map +1 -1
  247. package/lib/src/errors.js +1 -1
  248. package/lib/src/errors.js.map +1 -1
  249. package/lib/src/index.d.ts +0 -1
  250. package/lib/src/index.d.ts.map +1 -1
  251. package/lib/src/index.js +0 -1
  252. package/lib/src/index.js.map +1 -1
  253. package/lib/src/mixpanel-service.d.ts +0 -1
  254. package/lib/src/mixpanel-service.d.ts.map +1 -1
  255. package/lib/src/mixpanel-service.js +0 -1
  256. package/lib/src/mixpanel-service.js.map +1 -1
  257. package/lib/src/react/index.d.ts +1 -12
  258. package/lib/src/react/index.d.ts.map +1 -1
  259. package/lib/src/react/index.js +1 -11
  260. package/lib/src/react/index.js.map +1 -1
  261. package/lib/src/react/index.spec.js +16 -4
  262. package/lib/src/react/index.spec.js.map +1 -1
  263. package/lib/src/test/test-utils.d.ts +0 -2
  264. package/lib/src/test/test-utils.d.ts.map +1 -1
  265. package/lib/src/test/test-utils.js +0 -2
  266. package/lib/src/test/test-utils.js.map +1 -1
  267. package/lib/src/tokenizedFetch.d.ts +0 -1
  268. package/lib/src/tokenizedFetch.d.ts.map +1 -1
  269. package/lib/src/tokenizedFetch.js +0 -1
  270. package/lib/src/tokenizedFetch.js.map +1 -1
  271. package/lib/src/types.d.ts +245 -366
  272. package/lib/src/types.d.ts.map +1 -1
  273. package/lib/src/types.js +196 -296
  274. package/lib/src/types.js.map +1 -1
  275. package/lib/src/utils/authService/authService.d.ts +0 -1
  276. package/lib/src/utils/authService/authService.d.ts.map +1 -1
  277. package/lib/src/utils/authService/authService.js +0 -1
  278. package/lib/src/utils/authService/authService.js.map +1 -1
  279. package/lib/src/utils/authService/authService.spec.js +1 -1
  280. package/lib/src/utils/authService/authService.spec.js.map +1 -1
  281. package/lib/src/utils/authService/tokenizedAuthService.spec.d.ts +2 -0
  282. package/lib/src/utils/authService/tokenizedAuthService.spec.d.ts.map +1 -0
  283. package/lib/src/utils/authService/tokenizedAuthService.spec.js +29 -0
  284. package/lib/src/utils/authService/tokenizedAuthService.spec.js.map +1 -0
  285. package/lib/src/utils/graphql/answerService/answer-queries.d.ts +2 -0
  286. package/lib/src/utils/graphql/answerService/answer-queries.d.ts.map +1 -1
  287. package/lib/src/utils/graphql/answerService/answer-queries.js +56 -0
  288. package/lib/src/utils/graphql/answerService/answer-queries.js.map +1 -1
  289. package/lib/src/utils/graphql/answerService/answerService.d.ts +37 -12
  290. package/lib/src/utils/graphql/answerService/answerService.d.ts.map +1 -1
  291. package/lib/src/utils/graphql/answerService/answerService.js +71 -15
  292. package/lib/src/utils/graphql/answerService/answerService.js.map +1 -1
  293. package/lib/src/utils/graphql/answerService/answerService.spec.js +80 -2
  294. package/lib/src/utils/graphql/answerService/answerService.spec.js.map +1 -1
  295. package/lib/src/utils/logger.d.ts.map +1 -1
  296. package/lib/src/utils/logger.js +2 -3
  297. package/lib/src/utils/logger.js.map +1 -1
  298. package/lib/src/utils/processData.js +1 -1
  299. package/lib/src/utils/processData.js.map +1 -1
  300. package/lib/src/utils/processData.spec.js +1 -1
  301. package/lib/src/utils/processData.spec.js.map +1 -1
  302. package/lib/src/utils/processTrigger.d.ts +0 -1
  303. package/lib/src/utils/processTrigger.d.ts.map +1 -1
  304. package/lib/src/utils/processTrigger.js +0 -2
  305. package/lib/src/utils/processTrigger.js.map +1 -1
  306. package/lib/src/utils/sessionInfoService.d.ts +2 -2
  307. package/lib/src/utils/sessionInfoService.d.ts.map +1 -1
  308. package/lib/src/utils/sessionInfoService.js +2 -2
  309. package/lib/src/utils/sessionInfoService.js.map +1 -1
  310. package/lib/src/utils.d.ts +2 -10
  311. package/lib/src/utils.d.ts.map +1 -1
  312. package/lib/src/utils.js +17 -12
  313. package/lib/src/utils.js.map +1 -1
  314. package/lib/src/visual-embed-sdk.d.ts +436 -558
  315. package/package.json +2 -1
  316. package/src/auth.ts +6 -23
  317. package/src/authToken.spec.ts +31 -0
  318. package/src/authToken.ts +9 -3
  319. package/src/config.ts +0 -2
  320. package/src/embed/app.spec.ts +37 -1
  321. package/src/embed/app.ts +108 -50
  322. package/src/embed/base.spec.ts +3 -3
  323. package/src/embed/base.ts +15 -22
  324. package/src/embed/embedConfig.ts +0 -2
  325. package/src/embed/liveboard.spec.ts +104 -9
  326. package/src/embed/liveboard.ts +26 -39
  327. package/src/embed/sage.spec.ts +20 -35
  328. package/src/embed/sage.ts +5 -38
  329. package/src/embed/search-bar.tsx +0 -11
  330. package/src/embed/search.spec.ts +48 -1
  331. package/src/embed/search.ts +94 -38
  332. package/src/embed/ts-embed.spec.ts +109 -24
  333. package/src/embed/ts-embed.ts +68 -78
  334. package/src/errors.ts +1 -1
  335. package/src/index.ts +0 -1
  336. package/src/mixpanel-service.ts +0 -1
  337. package/src/react/index.spec.tsx +48 -60
  338. package/src/react/index.tsx +1 -12
  339. package/src/test/test-utils.ts +0 -2
  340. package/src/tokenizedFetch.ts +0 -1
  341. package/src/types.ts +245 -365
  342. package/src/utils/authService/authService.spec.ts +4 -4
  343. package/src/utils/authService/authService.ts +0 -1
  344. package/src/utils/graphql/answerService/answer-queries.ts +58 -0
  345. package/src/utils/graphql/answerService/answerService.spec.ts +88 -2
  346. package/src/utils/graphql/answerService/answerService.ts +87 -16
  347. package/src/utils/logger.ts +2 -3
  348. package/src/utils/processData.spec.ts +1 -1
  349. package/src/utils/processData.ts +1 -1
  350. package/src/utils/processTrigger.ts +0 -2
  351. package/src/utils.ts +21 -13
@@ -2,63 +2,59 @@
2
2
  * Copyright (c) 2022
3
3
  *
4
4
  * Base classes
5
- *
6
5
  * @summary Base classes
7
6
  * @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
8
7
  */
9
8
 
10
9
  import isEqual from 'lodash/isEqual';
11
- import { logger } from '../utils/logger';
10
+ import pkgInfo from '../../package.json';
11
+ import { AuthFailureType } from '../auth';
12
12
  import { getAuthenticationToken } from '../authToken';
13
- import { AnswerService } from '../utils/graphql/answerService/answerService';
14
13
  import {
15
- getEncodedQueryParamsString,
16
- getCssDimension,
17
- getOffsetTop,
18
- embedEventStatus,
19
- setAttributes,
20
- getCustomisations,
21
- getRuntimeFilters,
22
- getDOMNode,
23
- getFilterQuery,
24
- getQueryParamString,
25
- getRuntimeParameters,
26
- setStyleProperties,
27
- removeStyleProperties,
28
- isUndefined,
29
- } from '../utils';
30
- import {
31
- getThoughtSpotHost,
32
- URL_MAX_LENGTH,
33
- DEFAULT_EMBED_WIDTH,
34
14
  DEFAULT_EMBED_HEIGHT,
15
+ DEFAULT_EMBED_WIDTH,
16
+ URL_MAX_LENGTH,
17
+ getThoughtSpotHost,
35
18
  getV2BasePath,
36
19
  } from '../config';
20
+ import { MIXPANEL_EVENT, uploadMixpanelEvent } from '../mixpanel-service';
37
21
  import {
22
+ Action,
38
23
  AuthType,
24
+ ContextMenuTriggerOptions,
39
25
  DOMSelector,
40
- HostEvent,
26
+ EmbedConfig,
41
27
  EmbedEvent,
28
+ HostEvent,
42
29
  MessageCallback,
43
- Action,
44
- Param,
45
- EmbedConfig,
46
- MessageOptions,
47
- MessagePayload,
48
30
  MessageCallbackObj,
31
+ MessageOptions,
32
+ Param,
49
33
  ViewConfig,
50
- FrameParams,
51
- ContextMenuTriggerOptions,
52
- RuntimeFilter,
53
34
  } from '../types';
54
- import { uploadMixpanelEvent, MIXPANEL_EVENT } from '../mixpanel-service';
55
- import { processEventData, processAuthFailure } from '../utils/processData';
35
+ import {
36
+ embedEventStatus,
37
+ getCssDimension,
38
+ getCustomisations,
39
+ getDOMNode,
40
+ getEncodedQueryParamsString,
41
+ getFilterQuery,
42
+ getOffsetTop,
43
+ getQueryParamString,
44
+ getRuntimeFilters,
45
+ getRuntimeParameters,
46
+ isUndefined,
47
+ removeStyleProperties,
48
+ setAttributes,
49
+ setStyleProperties,
50
+ } from '../utils';
51
+ import { AnswerService } from '../utils/graphql/answerService/answerService';
52
+ import { logger } from '../utils/logger';
53
+ import { processAuthFailure, processEventData } from '../utils/processData';
56
54
  import { processTrigger } from '../utils/processTrigger';
57
- import pkgInfo from '../../package.json';
58
55
  import {
59
- getAuthPromise, renderInQueue, handleAuth, notifyAuthFailure,
56
+ getAuthPromise, handleAuth, notifyAuthFailure, renderInQueue,
60
57
  } from './base';
61
- import { AuthFailureType } from '../auth';
62
58
  import { getEmbedConfig } from './embedConfig';
63
59
 
64
60
  const { version } = pkgInfo;
@@ -73,7 +69,6 @@ const TS_EMBED_ID = '_thoughtspot-embed';
73
69
  * The event id map from v2 event names to v1 event id
74
70
  * v1 events are the classic embed events implemented in Blink v1
75
71
  * We cannot rename v1 event types to maintain backward compatibility
76
- *
77
72
  * @internal
78
73
  */
79
74
  const V1EventMap = {};
@@ -150,7 +145,6 @@ export class TsEmbed {
150
145
  * Should we encode URL Query Params using base64 encoding which thoughtspot
151
146
  * will generate for embedding. This provides additional security to
152
147
  * thoughtspot clusters against Cross site scripting attacks.
153
- *
154
148
  * @default false
155
149
  */
156
150
  private shouldEncodeUrlQueryParams = false;
@@ -170,7 +164,11 @@ export class TsEmbed {
170
164
  this.thoughtSpotV2Base = getV2BasePath(this.embedConfig);
171
165
  this.eventHandlerMap = new Map();
172
166
  this.isError = false;
173
- this.viewConfig = { excludeRuntimeFiltersfromURL: false, ...viewConfig };
167
+ this.viewConfig = {
168
+ excludeRuntimeFiltersfromURL: false,
169
+ excludeRuntimeParametersfromURL: false,
170
+ ...viewConfig,
171
+ };
174
172
  this.shouldEncodeUrlQueryParams = this.embedConfig.shouldEncodeUrlQueryParams;
175
173
  this.registerAppInit();
176
174
  uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_EMBED_CREATE, {
@@ -187,7 +185,6 @@ export class TsEmbed {
187
185
 
188
186
  /**
189
187
  * Handles errors within the SDK
190
- *
191
188
  * @param error The error message or object
192
189
  */
193
190
  protected handleError(error: string | Record<string, unknown>) {
@@ -201,7 +198,6 @@ export class TsEmbed {
201
198
 
202
199
  /**
203
200
  * Extracts the type field from the event payload
204
- *
205
201
  * @param event The window message event
206
202
  */
207
203
  private getEventType(event: MessageEvent) {
@@ -211,7 +207,6 @@ export class TsEmbed {
211
207
 
212
208
  /**
213
209
  * Extracts the port field from the event payload
214
- *
215
210
  * @param event The window message event
216
211
  * @returns
217
212
  */
@@ -225,7 +220,6 @@ export class TsEmbed {
225
220
  /**
226
221
  * fix for ts7.sep.cl
227
222
  * will be removed for ts7.oct.cl
228
- *
229
223
  * @param event
230
224
  * @param eventType
231
225
  * @hidden
@@ -299,7 +293,6 @@ export class TsEmbed {
299
293
 
300
294
  /**
301
295
  * Send Custom style as part of payload of APP_INIT
302
- *
303
296
  * @param _
304
297
  * @param responder
305
298
  */
@@ -322,6 +315,9 @@ export class TsEmbed {
322
315
  runtimeFilterParams: this.viewConfig.excludeRuntimeFiltersfromURL
323
316
  ? getRuntimeFilters(this.viewConfig.runtimeFilters)
324
317
  : null,
318
+ runtimeParameterParams: this.viewConfig.excludeRuntimeParametersfromURL
319
+ ? getRuntimeParameters(this.viewConfig.runtimeParameters || [])
320
+ : null,
325
321
  hiddenHomepageModules: this.viewConfig.hiddenHomepageModules || [],
326
322
  reorderedHomepageModules: this.viewConfig.reorderedHomepageModules || [],
327
323
  hostConfig: this.embedConfig.hostConfig,
@@ -334,7 +330,6 @@ export class TsEmbed {
334
330
 
335
331
  /**
336
332
  * Sends updated auth token to the iFrame to avoid user logout
337
- *
338
333
  * @param _
339
334
  * @param responder
340
335
  */
@@ -367,7 +362,6 @@ export class TsEmbed {
367
362
 
368
363
  /**
369
364
  * Constructs the base URL string to load the ThoughtSpot app.
370
- *
371
365
  * @param query
372
366
  */
373
367
  protected getEmbedBasePath(query: string): string {
@@ -386,7 +380,6 @@ export class TsEmbed {
386
380
 
387
381
  /**
388
382
  * Common query params set for all the embed modes.
389
- *
390
383
  * @param queryParams
391
384
  * @returns queryParams
392
385
  */
@@ -417,6 +410,15 @@ export class TsEmbed {
417
410
  if (this.embedConfig.pendoTrackingKey) {
418
411
  queryParams[Param.PendoTrackingKey] = this.embedConfig.pendoTrackingKey;
419
412
  }
413
+ if (this.embedConfig.numberFormatLocale) {
414
+ queryParams[Param.NumberFormatLocale] = this.embedConfig.numberFormatLocale;
415
+ }
416
+ if (this.embedConfig.dateFormatLocale) {
417
+ queryParams[Param.DateFormatLocale] = this.embedConfig.dateFormatLocale;
418
+ }
419
+ if (this.embedConfig.currencyFormat) {
420
+ queryParams[Param.CurrencyFormat] = this.embedConfig.currencyFormat;
421
+ }
420
422
 
421
423
  const {
422
424
  disabledActions,
@@ -509,7 +511,6 @@ export class TsEmbed {
509
511
  /**
510
512
  * Constructs the base URL string to load v1 of the ThoughtSpot app.
511
513
  * This is used for embedding Liveboards, visualizations, and full application.
512
- *
513
514
  * @param queryString The query string to append to the URL.
514
515
  * @param isAppEmbed A Boolean parameter to specify if you are embedding
515
516
  * the full application.
@@ -584,10 +585,10 @@ export class TsEmbed {
584
585
  /**
585
586
  * Renders the embedded ThoughtSpot app in an iframe and sets up
586
587
  * event listeners.
587
- *
588
588
  * @param url - The URL of the embedded ThoughtSpot app.
589
589
  */
590
590
  protected async renderIFrame(url: string): Promise<any> {
591
+ console.log('here 7');
591
592
  if (this.isError) {
592
593
  return null;
593
594
  }
@@ -597,8 +598,10 @@ export class TsEmbed {
597
598
  if (url.length > URL_MAX_LENGTH) {
598
599
  // warn: The URL is too long
599
600
  }
601
+ console.log('here 8');
600
602
 
601
603
  return renderInQueue((nextInQueue) => {
604
+ console.log('here 6');
602
605
  const initTimestamp = Date.now();
603
606
 
604
607
  this.executeCallbacks(EmbedEvent.Init, {
@@ -611,6 +614,7 @@ export class TsEmbed {
611
614
  uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_RENDER_START);
612
615
  return getAuthPromise()
613
616
  ?.then((isLoggedIn: boolean) => {
617
+ console.log('here 9', isLoggedIn);
614
618
  if (!isLoggedIn) {
615
619
  this.handleInsertionIntoDOM(this.embedConfig.loginFailedMessage);
616
620
  return;
@@ -635,7 +639,9 @@ export class TsEmbed {
635
639
  this.iFrame.addEventListener('error', () => {
636
640
  nextInQueue();
637
641
  });
642
+ console.log('here 10', this.iFrame);
638
643
  this.handleInsertionIntoDOM(this.iFrame);
644
+ console.log('here 11', document.body.innerHTML);
639
645
  const prefetchIframe = document.querySelectorAll('.prefetchIframe');
640
646
  if (prefetchIframe.length) {
641
647
  prefetchIframe.forEach((el) => {
@@ -679,7 +685,7 @@ export class TsEmbed {
679
685
  protected connectPreRendered(): boolean {
680
686
  const preRenderIds = this.getPreRenderIds();
681
687
  this.preRenderWrapper = this.preRenderWrapper
682
- || document.getElementById(preRenderIds.wrapper);
688
+ || document.getElementById(preRenderIds.wrapper);
683
689
 
684
690
  this.preRenderChild = this.preRenderChild || document.getElementById(preRenderIds.child);
685
691
 
@@ -776,7 +782,6 @@ export class TsEmbed {
776
782
 
777
783
  /**
778
784
  * Sets the height of the iframe
779
- *
780
785
  * @param height The height in pixels
781
786
  */
782
787
  protected setIFrameHeight(height: number | string): void {
@@ -785,7 +790,6 @@ export class TsEmbed {
785
790
 
786
791
  /**
787
792
  * Executes all registered event handlers for a particular event type
788
- *
789
793
  * @param eventType The event type
790
794
  * @param data The payload invoked with the event handler
791
795
  * @param eventPort The event Port for a specific MessageChannel
@@ -824,7 +828,6 @@ export class TsEmbed {
824
828
 
825
829
  /**
826
830
  * Gets the v1 event type (if applicable) for the EmbedEvent type
827
- *
828
831
  * @param eventType The v2 event type
829
832
  * @returns The corresponding v1 event type if one exists
830
833
  * or else the v2 event type itself
@@ -837,7 +840,6 @@ export class TsEmbed {
837
840
  * Calculates the iframe center for the current visible viewPort
838
841
  * of iframe using Scroll position of Host App, offsetTop for iframe
839
842
  * in Host app. ViewPort height of the tab.
840
- *
841
843
  * @returns iframe Center in visible viewport,
842
844
  * Iframe height,
843
845
  * View port height.
@@ -872,7 +874,6 @@ export class TsEmbed {
872
874
  /**
873
875
  * Registers an event listener to trigger an alert when the ThoughtSpot app
874
876
  * sends an event of a particular message type to the host application.
875
- *
876
877
  * @param messageType The message type
877
878
  * @param callback A callback as a function
878
879
  * @param options The message options
@@ -913,7 +914,6 @@ export class TsEmbed {
913
914
 
914
915
  /**
915
916
  * Removes an event listener for a particular event type.
916
- *
917
917
  * @param messageType The message type
918
918
  * @param callback The callback to remove
919
919
  * @example
@@ -935,7 +935,6 @@ export class TsEmbed {
935
935
  /**
936
936
  * Triggers an event on specific Port registered against
937
937
  * for the EmbedEvent
938
- *
939
938
  * @param eventType The message type
940
939
  * @param data The payload to send
941
940
  * @param eventPort
@@ -959,7 +958,6 @@ export class TsEmbed {
959
958
 
960
959
  /**
961
960
  * Triggers an event to the embedded app
962
- *
963
961
  * @param messageType The event type
964
962
  * @param data The payload to send with the message
965
963
  */
@@ -982,7 +980,6 @@ export class TsEmbed {
982
980
  * Marks the ThoughtSpot object to have been rendered
983
981
  * Needs to be overridden by subclasses to do the actual
984
982
  * rendering of the iframe.
985
- *
986
983
  * @param args
987
984
  */
988
985
  public async render(): Promise<TsEmbed> {
@@ -1001,7 +998,6 @@ export class TsEmbed {
1001
998
 
1002
999
  /**
1003
1000
  * Creates the preRender shell
1004
- *
1005
1001
  * @param showPreRenderByDefault - Show the preRender after render, hidden by default
1006
1002
  */
1007
1003
  public preRender(showPreRenderByDefault = false): TsEmbed {
@@ -1019,7 +1015,6 @@ export class TsEmbed {
1019
1015
  * Get the Post Url Params for THOUGHTSPOT from the current
1020
1016
  * host app URL.
1021
1017
  * THOUGHTSPOT URL params starts with a prefix "ts-"
1022
- *
1023
1018
  * @version SDK: 1.14.0 | ThoughtSpot: 8.4.0.cl, 8.4.1-sw
1024
1019
  */
1025
1020
  public getThoughtSpotPostUrlParams(): string {
@@ -1047,7 +1042,6 @@ export class TsEmbed {
1047
1042
 
1048
1043
  /**
1049
1044
  * Destroys the ThoughtSpot embed, and remove any nodes from the DOM.
1050
- *
1051
1045
  * @version SDK: 1.19.1 | ThoughtSpot: *
1052
1046
  */
1053
1047
  public destroy(): void {
@@ -1067,7 +1061,6 @@ export class TsEmbed {
1067
1061
  * Prerenders a generic instance of the TS component.
1068
1062
  * This means without the path but with the flags already applied.
1069
1063
  * This is useful for prerendering the component in the background.
1070
- *
1071
1064
  * @version SDK: 1.22.0
1072
1065
  * @returns
1073
1066
  */
@@ -1097,11 +1090,11 @@ export class TsEmbed {
1097
1090
  ) {
1098
1091
  logger.warn(
1099
1092
  `${viewConfig.embedComponentType || 'Component'} was pre-rendered with `
1100
- + `"${key}" as "${JSON.stringify(preRenderedObject.viewConfig[key])}" `
1101
- + `but a different value "${JSON.stringify(viewConfig[key])}" `
1102
- + 'was passed to the Embed component. '
1103
- + 'The new value provided is ignored, the value provided during '
1104
- + 'preRender is used.',
1093
+ + `"${key}" as "${JSON.stringify(preRenderedObject.viewConfig[key])}" `
1094
+ + `but a different value "${JSON.stringify(viewConfig[key])}" `
1095
+ + 'was passed to the Embed component. '
1096
+ + 'The new value provided is ignored, the value provided during '
1097
+ + 'preRender is used.',
1105
1098
  );
1106
1099
  }
1107
1100
  });
@@ -1159,7 +1152,6 @@ export class TsEmbed {
1159
1152
  * element. This function adjusts the position, width, and height of the PreRender
1160
1153
  * component
1161
1154
  * to match the dimensions and position of the embedding element.
1162
- *
1163
1155
  * @throws {Error} Throws an error if the embedding element (passed as domSelector)
1164
1156
  * is not defined or not found.
1165
1157
  */
@@ -1206,7 +1198,6 @@ export class TsEmbed {
1206
1198
  /**
1207
1199
  * Retrieves unique HTML element IDs for PreRender-related elements.
1208
1200
  * These IDs are constructed based on the provided 'preRenderId' from 'viewConfig'.
1209
- *
1210
1201
  * @returns {object} An object containing the IDs for the PreRender elements.
1211
1202
  * @property {string} wrapper - The HTML element ID for the PreRender wrapper.
1212
1203
  * @property {string} child - The HTML element ID for the PreRender child.
@@ -1221,13 +1212,13 @@ export class TsEmbed {
1221
1212
  /**
1222
1213
  * Returns the answerService which can be used to make arbitrary graphql calls on top
1223
1214
  * session.
1224
- *
1225
1215
  * @param vizId [Optional] to get for a specific viz in case of a liveboard.
1226
1216
  * @version SDK: 1.25.0 / ThoughtSpot 9.10.0
1227
1217
  */
1228
1218
  public async getAnswerService(vizId?: string): Promise<AnswerService> {
1229
- const { session, embedAnswerData } = await this.trigger(HostEvent.GetAnswerSession, vizId);
1230
- return new AnswerService(session, embedAnswerData, this.embedConfig.thoughtSpotHost);
1219
+ const { session } = await this.trigger(HostEvent.GetAnswerSession, vizId);
1220
+
1221
+ return new AnswerService(session, null, this.embedConfig.thoughtSpotHost);
1231
1222
  }
1232
1223
  }
1233
1224
 
@@ -1235,7 +1226,6 @@ export class TsEmbed {
1235
1226
  * Base class for embedding v1 experience
1236
1227
  * Note: The v1 version of ThoughtSpot Blink works on the AngularJS stack
1237
1228
  * which is currently under migration to v2
1238
- *
1239
1229
  * @inheritdoc
1240
1230
  */
1241
1231
  export class V1Embed extends TsEmbed {
@@ -1248,7 +1238,6 @@ export class V1Embed extends TsEmbed {
1248
1238
 
1249
1239
  /**
1250
1240
  * Render the app in an iframe and set up event handlers
1251
- *
1252
1241
  * @param iframeSrc
1253
1242
  */
1254
1243
  protected renderV1Embed(iframeSrc: string): Promise<any> {
@@ -1258,9 +1247,10 @@ export class V1Embed extends TsEmbed {
1258
1247
  protected getRootIframeSrc(): string {
1259
1248
  const queryParams = this.getEmbedParams();
1260
1249
  let queryString = queryParams;
1261
- const { runtimeParameters = [] } = this.viewConfig;
1262
- if (runtimeParameters?.length > 0) {
1263
- const parameterQuery = getRuntimeParameters(runtimeParameters);
1250
+
1251
+ if (!this.viewConfig.excludeRuntimeParametersfromURL) {
1252
+ const runtimeParameters = this.viewConfig.runtimeParameters;
1253
+ const parameterQuery = getRuntimeParameters(runtimeParameters || []);
1264
1254
  queryString = [parameterQuery, queryParams].filter(Boolean).join('&');
1265
1255
  }
1266
1256
 
package/src/errors.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export const ERROR_MESSAGE = {
2
2
  INVALID_THOUGHTSPOT_HOST: 'Error parsing ThoughtSpot host. Please provide a valid URL.',
3
- LIVEBOARD_VIZ_ID_VALIDATION: 'Please provide either liveboardId or pinboardId',
3
+ LIVEBOARD_VIZ_ID_VALIDATION: 'Please select a liveboard to embed.',
4
4
  TRIGGER_TIMED_OUT: 'Trigger timedout in getting response',
5
5
  SEARCHEMBED_BETA_WRANING_MESSAGE: 'Search Embed is in Beta in this release.',
6
6
  SAGE_EMBED_BETA_WARNING_MESSAGE: 'Sage Embed is in Beta in this release.',
package/src/index.ts CHANGED
@@ -3,7 +3,6 @@
3
3
  *
4
4
  * ThoughtSpot Visual Embed SDK for embedding ThoughtSpot analytics
5
5
  * in other web applications.
6
- *
7
6
  * @summary ThoughtSpot Visual Embed SDK
8
7
  * @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
9
8
  */
@@ -26,7 +26,6 @@ let eventQueue: { eventId: string; eventProps: any }[] = [];
26
26
 
27
27
  /**
28
28
  * Pushes the event with its Property key-value map to mixpanel.
29
- *
30
29
  * @param eventId
31
30
  * @param eventProps
32
31
  */
@@ -15,12 +15,15 @@ import {
15
15
  mockMessageChannel,
16
16
  } from '../test/test-utils';
17
17
  import {
18
- SearchEmbed, AppEmbed, LiveboardEmbed, useEmbedRef, SearchBarEmbed, PreRenderedLiveboardEmbed,
18
+ SearchEmbed,
19
+ AppEmbed,
20
+ LiveboardEmbed,
21
+ useEmbedRef,
22
+ SearchBarEmbed,
23
+ PreRenderedLiveboardEmbed,
19
24
  } from './index';
20
25
  import * as allExports from './index';
21
- import {
22
- AuthType, init,
23
- } from '../index';
26
+ import { AuthType, init } from '../index';
24
27
 
25
28
  import { version } from '../../package.json';
26
29
 
@@ -43,13 +46,11 @@ describe('React Components', () => {
43
46
 
44
47
  await waitFor(() => getIFrameEl(container));
45
48
 
46
- expect(
47
- getIFrameEl(container).parentElement.classList.contains(
48
- 'embedClass',
49
- ),
50
- ).toBe(true);
49
+ expect(getIFrameEl(container).parentElement.classList.contains('embedClass')).toBe(
50
+ true,
51
+ );
51
52
  expect(getIFrameSrc(container)).toBe(
52
- `http://${thoughtSpotHost}/?hostAppUrl=local-host&viewPortHeight=768&viewPortWidth=1024&sdkVersion=${version}&authType=None&blockNonEmbedFullAppAccess=true&hideAction=[%22${Action.ReportError}%22,%22editACopy%22,%22saveAsView%22,%22updateTSL%22,%22editTSL%22,%22onDeleteAnswer%22]&overrideConsoleLogs=true&clientLogLevel=ERROR&enableDataPanelV2=false&dataSourceMode=hide&useLastSelectedSources=false&isSearchEmbed=true&collapseSearchBarInitially=false#/embed/answer`,
53
+ `http://${thoughtSpotHost}/?hostAppUrl=local-host&viewPortHeight=768&viewPortWidth=1024&sdkVersion=${version}&authType=None&blockNonEmbedFullAppAccess=true&hideAction=[%22${Action.ReportError}%22,%22editACopy%22,%22saveAsView%22,%22updateTSL%22,%22editTSL%22,%22onDeleteAnswer%22]&overrideConsoleLogs=true&clientLogLevel=ERROR&enableDataPanelV2=false&dataSourceMode=hide&useLastSelectedSources=false&isSearchEmbed=true&collapseSearchBarInitially=false&enableCustomColumnGroups=false&dataPanelCustomGroupsAccordionInitialState=EXPAND_ALL#/embed/answer`,
53
54
  );
54
55
  });
55
56
 
@@ -144,60 +145,53 @@ describe('React Components', () => {
144
145
  });
145
146
 
146
147
  it('Should have the correct container element', async () => {
147
- const { container } = render(
148
- <LiveboardEmbed liveboardId="abcd" className="def" />,
149
- );
148
+ const { container } = render(<LiveboardEmbed liveboardId="abcd" className="def" />);
150
149
 
151
150
  await waitFor(() => getIFrameEl(container));
152
151
  expect(container.querySelector('div')).not.toBe(null);
153
- expect(
154
- container.querySelector('div').classList.contains('def'),
155
- ).toBe(true);
152
+ expect(container.querySelector('div').classList.contains('def')).toBe(true);
156
153
 
157
154
  const { container: containerSibling } = render(
158
- <LiveboardEmbed
159
- liveboardId="abcd"
160
- className="def"
161
- insertAsSibling={true}
162
- />,
155
+ <LiveboardEmbed liveboardId="abcd" className="def" insertAsSibling={true} />,
163
156
  );
164
157
  await waitFor(() => getIFrameEl(containerSibling));
165
158
  expect(containerSibling.querySelector('span')).not.toBe(null);
166
- expect(containerSibling.querySelector('span').style.position).toBe(
167
- 'absolute',
168
- );
169
- expect(
170
- getIFrameEl(containerSibling).classList.contains('def'),
171
- ).toBe(true);
159
+ expect(containerSibling.querySelector('span').style.position).toBe('absolute');
160
+ expect(getIFrameEl(containerSibling).classList.contains('def')).toBe(true);
172
161
  expect(containerSibling.querySelector('div')).toBe(null);
173
162
  });
174
163
 
175
164
  it('Should have the correct container element', async () => {
176
- const { container } = render(
177
- <LiveboardEmbed liveboardId="abcd" className="def" />,
178
- );
165
+ const { container } = render(<LiveboardEmbed liveboardId="abcd" className="def" />);
179
166
 
180
167
  await waitFor(() => getIFrameEl(container));
181
168
  expect(container.querySelector('div')).not.toBe(null);
182
- expect(
183
- container.querySelector('div').classList.contains('def'),
184
- ).toBe(true);
169
+ expect(container.querySelector('div').classList.contains('def')).toBe(true);
185
170
 
186
171
  const { container: containerSibling } = render(
187
- <LiveboardEmbed
188
- liveboardId="abcd"
189
- className="def"
190
- insertAsSibling={true}
191
- />,
172
+ <LiveboardEmbed liveboardId="abcd" className="def" insertAsSibling={true} />,
192
173
  );
193
174
  await waitFor(() => getIFrameEl(containerSibling));
194
175
  expect(containerSibling.querySelector('span')).not.toBe(null);
195
- expect(containerSibling.querySelector('span').style.position).toBe(
196
- 'absolute',
176
+ expect(containerSibling.querySelector('span').style.position).toBe('absolute');
177
+ expect(getIFrameEl(containerSibling).classList.contains('def')).toBe(true);
178
+ expect(containerSibling.querySelector('div')).toBe(null);
179
+ });
180
+
181
+ it('Should have the correct container element', async () => {
182
+ const { container } = render(<LiveboardEmbed liveboardId="abcd" className="def" />);
183
+
184
+ await waitFor(() => getIFrameEl(container));
185
+ expect(container.querySelector('div')).not.toBe(null);
186
+ expect(container.querySelector('div').classList.contains('def')).toBe(true);
187
+
188
+ const { container: containerSibling } = render(
189
+ <LiveboardEmbed liveboardId="abcd" className="def" insertAsSibling={true} />,
197
190
  );
198
- expect(
199
- getIFrameEl(containerSibling).classList.contains('def'),
200
- ).toBe(true);
191
+ await waitFor(() => getIFrameEl(containerSibling));
192
+ expect(containerSibling.querySelector('span')).not.toBe(null);
193
+ expect(containerSibling.querySelector('span').style.position).toBe('absolute');
194
+ expect(getIFrameEl(containerSibling).classList.contains('def')).toBe(true);
201
195
  expect(containerSibling.querySelector('div')).toBe(null);
202
196
  });
203
197
  });
@@ -217,11 +211,9 @@ describe('React Components', () => {
217
211
 
218
212
  await waitFor(() => getIFrameEl(container));
219
213
 
220
- expect(
221
- getIFrameEl(container).parentElement.classList.contains(
222
- 'embedClass',
223
- ),
224
- ).toBe(true);
214
+ expect(getIFrameEl(container).parentElement.classList.contains('embedClass')).toBe(
215
+ true,
216
+ );
225
217
  expect(getIFrameSrc(container)).toBe(
226
218
  `http://${thoughtSpotHost}/?hostAppUrl=local-host&viewPortHeight=768&viewPortWidth=1024&sdkVersion=${version}&authType=None&blockNonEmbedFullAppAccess=true&hideAction=[%22${Action.ReportError}%22]&overrideConsoleLogs=true&clientLogLevel=ERROR&dataSources=[%22test%22]&searchTokenString=%5Brevenue%5D&executeSearch=true&useLastSelectedSources=false&isSearchEmbed=true#/embed/search-bar-embed`,
227
219
  );
@@ -241,7 +233,9 @@ describe('React Components', () => {
241
233
  );
242
234
 
243
235
  await waitFor(() => getIFrameEl());
244
- const preRenderWrapper = document.body.querySelector(`#${preRenderId}`) as HTMLDivElement;
236
+ const preRenderWrapper = document.body.querySelector(
237
+ `#${preRenderId}`,
238
+ ) as HTMLDivElement;
245
239
 
246
240
  expect(preRenderWrapper).toBeInstanceOf(HTMLDivElement);
247
241
  expect((preRenderWrapper as HTMLDivElement).childElementCount).toBe(1);
@@ -256,11 +250,7 @@ describe('React Components', () => {
256
250
  unobserve: jest.fn(),
257
251
  }));
258
252
  const { container: libContainer } = render(
259
- <LiveboardEmbed
260
- className="embedClass"
261
- preRenderId="test"
262
- liveboardId="libId"
263
- />,
253
+ <LiveboardEmbed className="embedClass" preRenderId="test" liveboardId="libId" />,
264
254
  );
265
255
 
266
256
  expect(preRenderWrapper.style.opacity).toBe('');
@@ -276,11 +266,9 @@ describe('allExports', () => {
276
266
  });
277
267
 
278
268
  it('should not have undefined exports', () => {
279
- Object.keys(allExports).forEach(
280
- (exportKey) => expect(
281
- Boolean(allExports[exportKey]),
282
- )
283
- .toBe(true),
284
- );
269
+ Object.keys(allExports)
270
+ .forEach(
271
+ (exportKey) => expect(Boolean(allExports[exportKey])).toBe(true),
272
+ );
285
273
  });
286
274
  });