@thoughtspot/visual-embed-sdk 1.20.1 → 1.20.3

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 (368) hide show
  1. package/README.md +1 -1
  2. package/cjs/package.json +171 -0
  3. package/cjs/src/auth.d.ts +183 -0
  4. package/cjs/src/auth.d.ts.map +1 -0
  5. package/cjs/src/auth.js +457 -0
  6. package/cjs/src/auth.js.map +1 -0
  7. package/cjs/src/auth.spec.d.ts +13 -0
  8. package/cjs/src/auth.spec.d.ts.map +1 -0
  9. package/cjs/src/auth.spec.js +397 -0
  10. package/cjs/src/auth.spec.js.map +1 -0
  11. package/cjs/src/config.d.ts +22 -0
  12. package/cjs/src/config.d.ts.map +1 -0
  13. package/cjs/src/config.js +70 -0
  14. package/cjs/src/config.js.map +1 -0
  15. package/cjs/src/config.spec.d.ts +5 -0
  16. package/cjs/src/config.spec.d.ts.map +1 -0
  17. package/cjs/src/config.spec.js +65 -0
  18. package/cjs/src/config.spec.js.map +1 -0
  19. package/cjs/src/embed/app.d.ts +168 -0
  20. package/cjs/src/embed/app.d.ts.map +1 -0
  21. package/cjs/src/embed/app.js +215 -0
  22. package/cjs/src/embed/app.js.map +1 -0
  23. package/cjs/src/embed/app.spec.d.ts +2 -0
  24. package/cjs/src/embed/app.spec.d.ts.map +1 -0
  25. package/cjs/src/embed/app.spec.js +239 -0
  26. package/cjs/src/embed/app.spec.js.map +1 -0
  27. package/cjs/src/embed/base.d.ts +79 -0
  28. package/cjs/src/embed/base.d.ts.map +1 -0
  29. package/cjs/src/embed/base.js +229 -0
  30. package/cjs/src/embed/base.js.map +1 -0
  31. package/cjs/src/embed/base.spec.d.ts +2 -0
  32. package/cjs/src/embed/base.spec.d.ts.map +1 -0
  33. package/cjs/src/embed/base.spec.js +198 -0
  34. package/cjs/src/embed/base.spec.js.map +1 -0
  35. package/cjs/src/embed/embed.spec.d.ts +2 -0
  36. package/cjs/src/embed/embed.spec.d.ts.map +1 -0
  37. package/cjs/src/embed/embed.spec.js +74 -0
  38. package/cjs/src/embed/embed.spec.js.map +1 -0
  39. package/cjs/src/embed/events.spec.d.ts +2 -0
  40. package/cjs/src/embed/events.spec.d.ts.map +1 -0
  41. package/cjs/src/embed/events.spec.js +238 -0
  42. package/cjs/src/embed/events.spec.js.map +1 -0
  43. package/cjs/src/embed/liveboard.d.ts +150 -0
  44. package/cjs/src/embed/liveboard.d.ts.map +1 -0
  45. package/cjs/src/embed/liveboard.js +168 -0
  46. package/cjs/src/embed/liveboard.js.map +1 -0
  47. package/cjs/src/embed/liveboard.spec.d.ts +2 -0
  48. package/cjs/src/embed/liveboard.spec.d.ts.map +1 -0
  49. package/cjs/src/embed/liveboard.spec.js +229 -0
  50. package/cjs/src/embed/liveboard.spec.js.map +1 -0
  51. package/cjs/src/embed/pinboard.spec.d.ts +2 -0
  52. package/cjs/src/embed/pinboard.spec.d.ts.map +1 -0
  53. package/cjs/src/embed/pinboard.spec.js +148 -0
  54. package/cjs/src/embed/pinboard.spec.js.map +1 -0
  55. package/cjs/src/embed/search-bar.d.ts +50 -0
  56. package/cjs/src/embed/search-bar.d.ts.map +1 -0
  57. package/cjs/src/embed/search-bar.js +63 -0
  58. package/cjs/src/embed/search-bar.js.map +1 -0
  59. package/cjs/src/embed/search.d.ts +129 -0
  60. package/cjs/src/embed/search.d.ts.map +1 -0
  61. package/cjs/src/embed/search.js +121 -0
  62. package/cjs/src/embed/search.js.map +1 -0
  63. package/cjs/src/embed/search.spec.d.ts +2 -0
  64. package/cjs/src/embed/search.spec.d.ts.map +1 -0
  65. package/cjs/src/embed/search.spec.js +238 -0
  66. package/cjs/src/embed/search.spec.js.map +1 -0
  67. package/cjs/src/embed/searchEmbed-basic-auth.spec.d.ts +2 -0
  68. package/cjs/src/embed/searchEmbed-basic-auth.spec.d.ts.map +1 -0
  69. package/cjs/src/embed/searchEmbed-basic-auth.spec.js +103 -0
  70. package/cjs/src/embed/searchEmbed-basic-auth.spec.js.map +1 -0
  71. package/cjs/src/embed/ts-embed.d.ts +323 -0
  72. package/cjs/src/embed/ts-embed.d.ts.map +1 -0
  73. package/cjs/src/embed/ts-embed.js +719 -0
  74. package/cjs/src/embed/ts-embed.js.map +1 -0
  75. package/cjs/src/embed/ts-embed.spec.d.ts +2 -0
  76. package/cjs/src/embed/ts-embed.spec.d.ts.map +1 -0
  77. package/cjs/src/embed/ts-embed.spec.js +771 -0
  78. package/cjs/src/embed/ts-embed.spec.js.map +1 -0
  79. package/cjs/src/errors.d.ts +7 -0
  80. package/cjs/src/errors.d.ts.map +1 -0
  81. package/cjs/src/errors.js +10 -0
  82. package/cjs/src/errors.js.map +1 -0
  83. package/cjs/src/index.d.ts +18 -0
  84. package/cjs/src/index.d.ts.map +1 -0
  85. package/cjs/src/index.js +42 -0
  86. package/cjs/src/index.js.map +1 -0
  87. package/cjs/src/mixpanel-service.d.ts +29 -0
  88. package/cjs/src/mixpanel-service.d.ts.map +1 -0
  89. package/cjs/src/mixpanel-service.js +76 -0
  90. package/cjs/src/mixpanel-service.js.map +1 -0
  91. package/cjs/src/mixpanel-service.spec.d.ts +2 -0
  92. package/cjs/src/mixpanel-service.spec.d.ts.map +1 -0
  93. package/cjs/src/mixpanel-service.spec.js +63 -0
  94. package/cjs/src/mixpanel-service.spec.js.map +1 -0
  95. package/cjs/src/react/all-types-export.d.ts +3 -0
  96. package/cjs/src/react/all-types-export.d.ts.map +1 -0
  97. package/cjs/src/react/all-types-export.js +29 -0
  98. package/cjs/src/react/all-types-export.js.map +1 -0
  99. package/cjs/src/react/all-types-export.spec.d.ts +2 -0
  100. package/cjs/src/react/all-types-export.spec.d.ts.map +1 -0
  101. package/cjs/src/react/all-types-export.spec.js +13 -0
  102. package/cjs/src/react/all-types-export.spec.js.map +1 -0
  103. package/cjs/src/react/index.d.ts +95 -0
  104. package/cjs/src/react/index.d.ts.map +1 -0
  105. package/cjs/src/react/index.js +121 -0
  106. package/cjs/src/react/index.js.map +1 -0
  107. package/cjs/src/react/index.spec.d.ts +3 -0
  108. package/cjs/src/react/index.spec.d.ts.map +1 -0
  109. package/cjs/src/react/index.spec.js +138 -0
  110. package/cjs/src/react/index.spec.js.map +1 -0
  111. package/cjs/src/react/util.d.ts +19 -0
  112. package/cjs/src/react/util.d.ts.map +1 -0
  113. package/cjs/src/react/util.js +25 -0
  114. package/cjs/src/react/util.js.map +1 -0
  115. package/cjs/src/test/test-utils.d.ts +48 -0
  116. package/cjs/src/test/test-utils.d.ts.map +1 -0
  117. package/cjs/src/test/test-utils.js +108 -0
  118. package/cjs/src/test/test-utils.js.map +1 -0
  119. package/cjs/src/types.d.ts +2020 -0
  120. package/cjs/src/types.d.ts.map +1 -0
  121. package/cjs/src/types.js +1543 -0
  122. package/cjs/src/types.js.map +1 -0
  123. package/cjs/src/utils/answerService.d.ts +10 -0
  124. package/cjs/src/utils/answerService.d.ts.map +1 -0
  125. package/cjs/src/utils/answerService.js +61 -0
  126. package/cjs/src/utils/answerService.js.map +1 -0
  127. package/cjs/src/utils/answerService.spec.d.ts +2 -0
  128. package/cjs/src/utils/answerService.spec.d.ts.map +1 -0
  129. package/cjs/src/utils/answerService.spec.js +31 -0
  130. package/cjs/src/utils/answerService.spec.js.map +1 -0
  131. package/cjs/src/utils/authService.d.ts +37 -0
  132. package/cjs/src/utils/authService.d.ts.map +1 -0
  133. package/cjs/src/utils/authService.js +106 -0
  134. package/cjs/src/utils/authService.js.map +1 -0
  135. package/cjs/src/utils/authService.spec.d.ts +2 -0
  136. package/cjs/src/utils/authService.spec.d.ts.map +1 -0
  137. package/cjs/src/utils/authService.spec.js +72 -0
  138. package/cjs/src/utils/authService.spec.js.map +1 -0
  139. package/cjs/src/utils/processData.d.ts +16 -0
  140. package/cjs/src/utils/processData.d.ts.map +1 -0
  141. package/cjs/src/utils/processData.js +110 -0
  142. package/cjs/src/utils/processData.js.map +1 -0
  143. package/cjs/src/utils/processData.spec.d.ts +2 -0
  144. package/cjs/src/utils/processData.spec.d.ts.map +1 -0
  145. package/cjs/src/utils/processData.spec.js +142 -0
  146. package/cjs/src/utils/processData.spec.js.map +1 -0
  147. package/cjs/src/utils/processTrigger.d.ts +10 -0
  148. package/cjs/src/utils/processTrigger.d.ts.map +1 -0
  149. package/cjs/src/utils/processTrigger.js +63 -0
  150. package/cjs/src/utils/processTrigger.js.map +1 -0
  151. package/cjs/src/utils/processTrigger.spec.d.ts +2 -0
  152. package/cjs/src/utils/processTrigger.spec.d.ts.map +1 -0
  153. package/cjs/src/utils/processTrigger.spec.js +58 -0
  154. package/cjs/src/utils/processTrigger.spec.js.map +1 -0
  155. package/cjs/src/utils.d.ts +68 -0
  156. package/cjs/src/utils.d.ts.map +1 -0
  157. package/cjs/src/utils.js +196 -0
  158. package/cjs/src/utils.js.map +1 -0
  159. package/cjs/src/utils.spec.d.ts +5 -0
  160. package/cjs/src/utils.spec.d.ts.map +1 -0
  161. package/cjs/src/utils.spec.js +98 -0
  162. package/cjs/src/utils.spec.js.map +1 -0
  163. package/dist/src/auth.d.ts +54 -5
  164. package/dist/src/auth.d.ts.map +1 -1
  165. package/dist/src/auth.spec.d.ts +3 -0
  166. package/dist/src/auth.spec.d.ts.map +1 -1
  167. package/dist/src/config.d.ts +1 -0
  168. package/dist/src/config.d.ts.map +1 -1
  169. package/dist/src/embed/app.d.ts +35 -6
  170. package/dist/src/embed/app.d.ts.map +1 -1
  171. package/dist/src/embed/base.d.ts +23 -10
  172. package/dist/src/embed/base.d.ts.map +1 -1
  173. package/dist/src/embed/liveboard.d.ts +28 -6
  174. package/dist/src/embed/liveboard.d.ts.map +1 -1
  175. package/dist/src/embed/search-bar.d.ts +3 -0
  176. package/dist/src/embed/search-bar.d.ts.map +1 -1
  177. package/dist/src/embed/search.d.ts +9 -1
  178. package/dist/src/embed/search.d.ts.map +1 -1
  179. package/dist/src/embed/ts-embed.d.ts +65 -7
  180. package/dist/src/embed/ts-embed.d.ts.map +1 -1
  181. package/dist/src/errors.d.ts.map +1 -1
  182. package/dist/src/index.d.ts +2 -2
  183. package/dist/src/index.d.ts.map +1 -1
  184. package/dist/src/mixpanel-service.d.ts +8 -0
  185. package/dist/src/mixpanel-service.d.ts.map +1 -1
  186. package/dist/src/react/all-types-export.d.ts +3 -0
  187. package/dist/src/react/all-types-export.d.ts.map +1 -0
  188. package/dist/src/react/all-types-export.spec.d.ts +2 -0
  189. package/dist/src/react/all-types-export.spec.d.ts.map +1 -0
  190. package/dist/src/react/index.d.ts +72 -0
  191. package/dist/src/react/index.d.ts.map +1 -1
  192. package/dist/src/react/util.d.ts +4 -0
  193. package/dist/src/react/util.d.ts.map +1 -1
  194. package/dist/src/test/test-utils.d.ts +11 -2
  195. package/dist/src/test/test-utils.d.ts.map +1 -1
  196. package/dist/src/types.d.ts +540 -98
  197. package/dist/src/types.d.ts.map +1 -1
  198. package/dist/src/utils/answerService.d.ts +7 -0
  199. package/dist/src/utils/answerService.d.ts.map +1 -1
  200. package/dist/src/utils/authService.d.ts +30 -0
  201. package/dist/src/utils/authService.d.ts.map +1 -1
  202. package/dist/src/utils/processData.d.ts +12 -0
  203. package/dist/src/utils/processData.d.ts.map +1 -1
  204. package/dist/src/utils/processTrigger.d.ts +7 -0
  205. package/dist/src/utils/processTrigger.d.ts.map +1 -1
  206. package/dist/src/utils.d.ts +12 -0
  207. package/dist/src/utils.d.ts.map +1 -1
  208. package/dist/tsembed-react.es.js +28024 -0
  209. package/dist/tsembed-react.js +27966 -0
  210. package/dist/tsembed.es.js +18163 -303
  211. package/dist/tsembed.js +18120 -308
  212. package/dist/visual-embed-sdk-react-full.d.ts +3092 -0
  213. package/dist/visual-embed-sdk-react.d.ts +2781 -0
  214. package/dist/visual-embed-sdk.d.ts +2944 -0
  215. package/lib/package.json +15 -14
  216. package/lib/src/auth.d.ts +54 -5
  217. package/lib/src/auth.d.ts.map +1 -1
  218. package/lib/src/auth.js +91 -31
  219. package/lib/src/auth.js.map +1 -1
  220. package/lib/src/auth.spec.d.ts +3 -0
  221. package/lib/src/auth.spec.d.ts.map +1 -1
  222. package/lib/src/auth.spec.js +37 -6
  223. package/lib/src/auth.spec.js.map +1 -1
  224. package/lib/src/config.d.ts +1 -0
  225. package/lib/src/config.d.ts.map +1 -1
  226. package/lib/src/config.js +5 -3
  227. package/lib/src/config.js.map +1 -1
  228. package/lib/src/config.spec.js.map +1 -1
  229. package/lib/src/embed/app.d.ts +35 -6
  230. package/lib/src/embed/app.d.ts.map +1 -1
  231. package/lib/src/embed/app.js +55 -16
  232. package/lib/src/embed/app.js.map +1 -1
  233. package/lib/src/embed/app.spec.js +41 -12
  234. package/lib/src/embed/app.spec.js.map +1 -1
  235. package/lib/src/embed/base.d.ts +23 -10
  236. package/lib/src/embed/base.d.ts.map +1 -1
  237. package/lib/src/embed/base.js +34 -16
  238. package/lib/src/embed/base.js.map +1 -1
  239. package/lib/src/embed/base.spec.js.map +1 -1
  240. package/lib/src/embed/embed.spec.js +1 -1
  241. package/lib/src/embed/embed.spec.js.map +1 -1
  242. package/lib/src/embed/liveboard.d.ts +28 -6
  243. package/lib/src/embed/liveboard.d.ts.map +1 -1
  244. package/lib/src/embed/liveboard.js +60 -38
  245. package/lib/src/embed/liveboard.js.map +1 -1
  246. package/lib/src/embed/liveboard.spec.js +37 -30
  247. package/lib/src/embed/liveboard.spec.js.map +1 -1
  248. package/lib/src/embed/pinboard.spec.js +14 -26
  249. package/lib/src/embed/pinboard.spec.js.map +1 -1
  250. package/lib/src/embed/search-bar.d.ts +3 -0
  251. package/lib/src/embed/search-bar.d.ts.map +1 -1
  252. package/lib/src/embed/search-bar.js +5 -6
  253. package/lib/src/embed/search-bar.js.map +1 -1
  254. package/lib/src/embed/search.d.ts +9 -1
  255. package/lib/src/embed/search.d.ts.map +1 -1
  256. package/lib/src/embed/search.js +18 -14
  257. package/lib/src/embed/search.js.map +1 -1
  258. package/lib/src/embed/search.spec.js +16 -19
  259. package/lib/src/embed/search.spec.js.map +1 -1
  260. package/lib/src/embed/searchEmbed-basic-auth.spec.js +4 -0
  261. package/lib/src/embed/searchEmbed-basic-auth.spec.js.map +1 -1
  262. package/lib/src/embed/ts-embed.d.ts +65 -7
  263. package/lib/src/embed/ts-embed.d.ts.map +1 -1
  264. package/lib/src/embed/ts-embed.js +154 -77
  265. package/lib/src/embed/ts-embed.js.map +1 -1
  266. package/lib/src/embed/ts-embed.spec.js +46 -24
  267. package/lib/src/embed/ts-embed.spec.js.map +1 -1
  268. package/lib/src/errors.d.ts.map +1 -1
  269. package/lib/src/errors.js.map +1 -1
  270. package/lib/src/index.d.ts +2 -2
  271. package/lib/src/index.d.ts.map +1 -1
  272. package/lib/src/index.js +4 -4
  273. package/lib/src/index.js.map +1 -1
  274. package/lib/src/mixpanel-service.d.ts +8 -0
  275. package/lib/src/mixpanel-service.d.ts.map +1 -1
  276. package/lib/src/mixpanel-service.js +13 -1
  277. package/lib/src/mixpanel-service.js.map +1 -1
  278. package/lib/src/mixpanel-service.spec.js.map +1 -1
  279. package/lib/src/react/all-types-export.d.ts +3 -0
  280. package/lib/src/react/all-types-export.d.ts.map +1 -0
  281. package/lib/src/react/all-types-export.js +5 -0
  282. package/lib/src/react/all-types-export.js.map +1 -0
  283. package/lib/src/react/all-types-export.spec.d.ts +2 -0
  284. package/lib/src/react/all-types-export.spec.d.ts.map +1 -0
  285. package/lib/src/react/all-types-export.spec.js +10 -0
  286. package/lib/src/react/all-types-export.spec.js.map +1 -0
  287. package/lib/src/react/index.d.ts +72 -0
  288. package/lib/src/react/index.d.ts.map +1 -1
  289. package/lib/src/react/index.js +79 -7
  290. package/lib/src/react/index.js.map +1 -1
  291. package/lib/src/react/index.spec.js +27 -6
  292. package/lib/src/react/index.spec.js.map +1 -1
  293. package/lib/src/react/util.d.ts +4 -0
  294. package/lib/src/react/util.d.ts.map +1 -1
  295. package/lib/src/react/util.js +4 -0
  296. package/lib/src/react/util.js.map +1 -1
  297. package/lib/src/test/test-utils.d.ts +11 -2
  298. package/lib/src/test/test-utils.d.ts.map +1 -1
  299. package/lib/src/test/test-utils.js +36 -25
  300. package/lib/src/test/test-utils.js.map +1 -1
  301. package/lib/src/types.d.ts +540 -98
  302. package/lib/src/types.d.ts.map +1 -1
  303. package/lib/src/types.js +415 -70
  304. package/lib/src/types.js.map +1 -1
  305. package/lib/src/utils/answerService.d.ts +7 -0
  306. package/lib/src/utils/answerService.d.ts.map +1 -1
  307. package/lib/src/utils/answerService.js +7 -0
  308. package/lib/src/utils/answerService.js.map +1 -1
  309. package/lib/src/utils/answerService.spec.js.map +1 -1
  310. package/lib/src/utils/authService.d.ts +30 -0
  311. package/lib/src/utils/authService.d.ts.map +1 -1
  312. package/lib/src/utils/authService.js +39 -2
  313. package/lib/src/utils/authService.js.map +1 -1
  314. package/lib/src/utils/authService.spec.js.map +1 -1
  315. package/lib/src/utils/processData.d.ts +12 -0
  316. package/lib/src/utils/processData.d.ts.map +1 -1
  317. package/lib/src/utils/processData.js +33 -5
  318. package/lib/src/utils/processData.js.map +1 -1
  319. package/lib/src/utils/processData.spec.js.map +1 -1
  320. package/lib/src/utils/processTrigger.d.ts +7 -0
  321. package/lib/src/utils/processTrigger.d.ts.map +1 -1
  322. package/lib/src/utils/processTrigger.js +17 -3
  323. package/lib/src/utils/processTrigger.js.map +1 -1
  324. package/lib/src/utils/processTrigger.spec.js.map +1 -1
  325. package/lib/src/utils.d.ts +12 -0
  326. package/lib/src/utils.d.ts.map +1 -1
  327. package/lib/src/utils.js +24 -19
  328. package/lib/src/utils.js.map +1 -1
  329. package/lib/src/utils.spec.js.map +1 -1
  330. package/package.json +15 -14
  331. package/src/auth.spec.ts +83 -133
  332. package/src/auth.ts +148 -115
  333. package/src/config.spec.ts +2 -4
  334. package/src/config.ts +5 -3
  335. package/src/embed/app.spec.ts +57 -14
  336. package/src/embed/app.ts +91 -36
  337. package/src/embed/base.spec.ts +3 -9
  338. package/src/embed/base.ts +55 -55
  339. package/src/embed/embed.spec.ts +5 -6
  340. package/src/embed/liveboard.spec.ts +56 -37
  341. package/src/embed/liveboard.ts +77 -65
  342. package/src/embed/pinboard.spec.ts +26 -29
  343. package/src/embed/search-bar.tsx +10 -8
  344. package/src/embed/search.spec.ts +31 -21
  345. package/src/embed/search.ts +26 -20
  346. package/src/embed/searchEmbed-basic-auth.spec.ts +22 -28
  347. package/src/embed/ts-embed.spec.ts +99 -144
  348. package/src/embed/ts-embed.ts +188 -162
  349. package/src/errors.ts +3 -6
  350. package/src/index.ts +6 -10
  351. package/src/mixpanel-service.spec.ts +1 -3
  352. package/src/mixpanel-service.ts +13 -1
  353. package/src/react/index.spec.tsx +66 -13
  354. package/src/react/index.tsx +111 -62
  355. package/src/react/util.ts +8 -4
  356. package/src/test/test-utils.ts +43 -39
  357. package/src/types.ts +537 -98
  358. package/src/utils/answerService.spec.ts +3 -5
  359. package/src/utils/answerService.ts +21 -17
  360. package/src/utils/authService.spec.ts +26 -41
  361. package/src/utils/authService.ts +47 -21
  362. package/src/utils/processData.spec.ts +26 -59
  363. package/src/utils/processData.ts +36 -14
  364. package/src/utils/processTrigger.spec.ts +1 -6
  365. package/src/utils/processTrigger.ts +18 -9
  366. package/src/utils.spec.ts +8 -12
  367. package/src/utils.ts +25 -26
  368. package/lib/src/visual-embed-sdk.d.ts +0 -2368
@@ -1,6 +1,8 @@
1
1
  import { AppEmbed, AppViewConfig, Page } from './app';
2
2
  import { init } from '../index';
3
- import { Action, AuthType, HostEvent, RuntimeFilterOp } from '../types';
3
+ import {
4
+ Action, AuthType, EmbedEvent, HostEvent, RuntimeFilterOp,
5
+ } from '../types';
4
6
  import {
5
7
  executeAfterWait,
6
8
  getDocumentBody,
@@ -11,9 +13,11 @@ import {
11
13
  defaultParams,
12
14
  defaultParamsForPinboardEmbed,
13
15
  defaultParamsWithoutHiddenActions,
16
+ expectUrlMatchesWithParams,
14
17
  } from '../test/test-utils';
15
18
  import { version } from '../../package.json';
16
19
  import * as config from '../config';
20
+ import { TsEmbed, V1Embed } from './ts-embed';
17
21
 
18
22
  const defaultViewConfig = {
19
23
  frameParams: {
@@ -44,7 +48,8 @@ describe('App embed tests', () => {
44
48
  const appEmbed = new AppEmbed(getRootEl(), defaultViewConfig);
45
49
  appEmbed.render();
46
50
  await executeAfterWait(() => {
47
- expect(getIFrameSrc()).toBe(
51
+ expectUrlMatchesWithParams(
52
+ getIFrameSrc(),
48
53
  `http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false${defaultParams}${defaultParamsPost}#/home`,
49
54
  );
50
55
  });
@@ -57,7 +62,8 @@ describe('App embed tests', () => {
57
62
  } as AppViewConfig);
58
63
  appEmbed.render();
59
64
  await executeAfterWait(() => {
60
- expect(getIFrameSrc()).toBe(
65
+ expectUrlMatchesWithParams(
66
+ getIFrameSrc(),
61
67
  `http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=false&profileAndHelpInNavBarHidden=false${defaultParams}${defaultParamsPost}#/home`,
62
68
  );
63
69
  });
@@ -70,7 +76,8 @@ describe('App embed tests', () => {
70
76
  } as AppViewConfig);
71
77
  appEmbed.render();
72
78
  await executeAfterWait(() => {
73
- expect(getIFrameSrc()).toBe(
79
+ expectUrlMatchesWithParams(
80
+ getIFrameSrc(),
74
81
  `http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=true${defaultParams}${defaultParamsPost}#/home`,
75
82
  );
76
83
  });
@@ -101,7 +108,8 @@ describe('App embed tests', () => {
101
108
  appEmbed.render();
102
109
 
103
110
  await executeAfterWait(() => {
104
- expect(getIFrameSrc()).toBe(
111
+ expectUrlMatchesWithParams(
112
+ getIFrameSrc(),
105
113
  `http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false${defaultParams}${defaultParamsPost}#/${route}`,
106
114
  );
107
115
  cleanUp();
@@ -117,7 +125,8 @@ describe('App embed tests', () => {
117
125
  } as AppViewConfig);
118
126
  appEmbed.render();
119
127
  await executeAfterWait(() => {
120
- expect(getIFrameSrc()).toBe(
128
+ expectUrlMatchesWithParams(
129
+ getIFrameSrc(),
121
130
  `http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false${defaultParams}${defaultParamsPost}#/foo/bar`,
122
131
  );
123
132
  });
@@ -138,7 +147,8 @@ describe('App embed tests', () => {
138
147
 
139
148
  appEmbed.render();
140
149
  await executeAfterWait(() => {
141
- expect(getIFrameSrc()).toBe(
150
+ expectUrlMatchesWithParams(
151
+ getIFrameSrc(),
142
152
  `http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=false&profileAndHelpInNavBarHidden=false&col1=sales&op1=EQ&val1=1000${defaultParams}${defaultParamsPost}#/home`,
143
153
  );
144
154
  });
@@ -155,7 +165,8 @@ describe('App embed tests', () => {
155
165
 
156
166
  appEmbed.render();
157
167
  await executeAfterWait(() => {
158
- expect(getIFrameSrc()).toBe(
168
+ expectUrlMatchesWithParams(
169
+ getIFrameSrc(),
159
170
  `http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=false&profileAndHelpInNavBarHidden=false&${defaultParamsWithoutHiddenActions}&disableAction=[%22save%22,%22update%22]&disableHint=Access%20denied&hideAction=[%22${Action.ReportError}%22,%22download%22]${defaultParamsPost}#/home`,
160
171
  );
161
172
  });
@@ -170,7 +181,8 @@ describe('App embed tests', () => {
170
181
 
171
182
  appEmbed.render();
172
183
  await executeAfterWait(() => {
173
- expect(getIFrameSrc()).toBe(
184
+ expectUrlMatchesWithParams(
185
+ getIFrameSrc(),
174
186
  `http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false${defaultParams}&tag=Finance${defaultParamsPost}#/home`,
175
187
  );
176
188
  });
@@ -184,18 +196,48 @@ describe('App embed tests', () => {
184
196
 
185
197
  appEmbed.render();
186
198
  await executeAfterWait(() => {
187
- expect(getIFrameSrc()).toBe(
199
+ expectUrlMatchesWithParams(
200
+ getIFrameSrc(),
188
201
  `http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&enableSearchAssist=true${defaultParams}${defaultParamsPost}#/home`,
189
202
  );
190
203
  });
191
204
  });
192
205
 
206
+ test('should register event handlers to adjust iframe height', async () => {
207
+ const onSpy = jest.spyOn(AppEmbed.prototype, 'on')
208
+ .mockImplementation((event, callback) => {
209
+ if (event === EmbedEvent.RouteChange) {
210
+ callback({ data: { currentPath: '/answers' } }, jest.fn());
211
+ }
212
+ if (event === EmbedEvent.EmbedHeight) {
213
+ callback({ data: '100%' });
214
+ }
215
+ if (event === EmbedEvent.EmbedIframeCenter) {
216
+ callback({}, jest.fn());
217
+ }
218
+ return null;
219
+ });
220
+ jest.spyOn(TsEmbed.prototype as any, 'getIframeCenter').mockReturnValue({});
221
+ jest.spyOn(TsEmbed.prototype as any, 'setIFrameHeight').mockReturnValue({});
222
+ const appEmbed = new AppEmbed(getRootEl(), {
223
+ ...defaultViewConfig,
224
+ fullHeight: true,
225
+ } as AppViewConfig);
226
+
227
+ appEmbed.render();
228
+
229
+ await executeAfterWait(() => {
230
+ expect(onSpy).toHaveBeenCalledWith(EmbedEvent.EmbedHeight, expect.anything());
231
+ expect(onSpy).toHaveBeenCalledWith(EmbedEvent.RouteChange, expect.anything());
232
+ expect(onSpy).toHaveBeenCalledWith(EmbedEvent.EmbedIframeCenter, expect.anything());
233
+ });
234
+ jest.clearAllMocks();
235
+ });
236
+
193
237
  describe('Navigate to Page API', () => {
194
238
  const path = 'pinboard/e0836cad-4fdf-42d4-bd97-567a6b2a6058';
195
239
  beforeEach(() => {
196
- jest.spyOn(config, 'getThoughtSpotHost').mockImplementation(
197
- () => 'http://tshost',
198
- );
240
+ jest.spyOn(config, 'getThoughtSpotHost').mockImplementation(() => 'http://tshost');
199
241
  });
200
242
 
201
243
  test('when app is AppEmbed after navigateToPage function call, new path should be set to iframe', async () => {
@@ -207,7 +249,8 @@ describe('App embed tests', () => {
207
249
  });
208
250
  await appEmbed.render();
209
251
  appEmbed.navigateToPage(path);
210
- expect(getIFrameSrc()).toBe(
252
+ expectUrlMatchesWithParams(
253
+ getIFrameSrc(),
211
254
  `http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&${defaultParamsForPinboardEmbed}${defaultParamsPost}#/${path}`,
212
255
  );
213
256
  });
package/src/embed/app.ts CHANGED
@@ -9,13 +9,9 @@
9
9
  * @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
10
10
  */
11
11
 
12
- import { getFilterQuery, getQueryParamString } from '../utils';
12
+ import { getQueryParamString } from '../utils';
13
13
  import {
14
- Param,
15
- RuntimeFilter,
16
- DOMSelector,
17
- HostEvent,
18
- ViewConfig,
14
+ Param, DOMSelector, HostEvent, ViewConfig, EmbedEvent, MessagePayload,
19
15
  } from '../types';
20
16
  import { V1Embed } from './ts-embed';
21
17
 
@@ -56,6 +52,7 @@ export enum Page {
56
52
 
57
53
  /**
58
54
  * The view configuration for full app embedding.
55
+ *
59
56
  * @group Embed components
60
57
  */
61
58
  export interface AppViewConfig extends ViewConfig {
@@ -81,8 +78,9 @@ export interface AppViewConfig extends ViewConfig {
81
78
  */
82
79
  pageId?: Page;
83
80
  /**
84
- * This puts a filter tag on the application. All metadata lists in the application, such as
85
- * Liveboards and answers, would be filtered by this tag.
81
+ * This puts a filter tag on the application. All metadata lists in the
82
+ * application, such as Liveboards and answers, would be filtered by this
83
+ * tag.
86
84
  */
87
85
  tag?: string;
88
86
  /**
@@ -92,36 +90,71 @@ export interface AppViewConfig extends ViewConfig {
92
90
  /**
93
91
  * Render liveboards using the new v2 rendering mode
94
92
  * This is a transient flag which is primarily meant for internal use
93
+ *
95
94
  * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
96
95
  * @hidden
97
96
  */
98
97
  liveboardV2?: boolean;
99
98
  /**
100
99
  * If set to true, the Search Assist feature is enabled.
100
+ *
101
101
  * @version SDK: 1.13.0 | ThoughtSpot: 8.5.0.cl, 8.8.1-sw
102
102
  */
103
103
  enableSearchAssist?: boolean;
104
+ /**
105
+ * If set to true, the embedded object container dynamically resizes
106
+ * according to the height of the pages which support fullHeight mode.
107
+ *
108
+ * @version SDK: 1.21.0 | ThoughtSpot: 9.4.0.cl, 9.4.0-sw
109
+ */
110
+ fullHeight?:boolean;
104
111
  }
105
112
 
106
113
  /**
107
114
  * Embeds full ThoughtSpot experience in a host application.
115
+ *
108
116
  * @group Embed components
109
117
  */
110
118
  export class AppEmbed extends V1Embed {
111
119
  protected viewConfig: AppViewConfig;
112
120
 
121
+ private defaultHeight = '100%';
122
+
113
123
  // eslint-disable-next-line no-useless-constructor
114
124
  constructor(domSelector: DOMSelector, viewConfig: AppViewConfig) {
115
125
  super(domSelector, viewConfig);
126
+ if (this.viewConfig.fullHeight === true) {
127
+ this.on(EmbedEvent.RouteChange, this.setIframeHeightForNonEmbedLiveboard);
128
+ this.on(EmbedEvent.EmbedHeight, this.updateIFrameHeight);
129
+ this.on(EmbedEvent.EmbedIframeCenter, this.embedIframeCenter);
130
+ }
116
131
  }
117
132
 
118
133
  /**
119
134
  * Constructs a map of parameters to be passed on to the
120
135
  * embedded Liveboard or visualization.
121
136
  */
122
- private getEmbedParams() {
123
- const params = this.getBaseQueryParams();
124
- const { tag, hideObjects, liveboardV2 } = this.viewConfig;
137
+ protected getEmbedParams() {
138
+ const {
139
+ tag,
140
+ hideObjects,
141
+ liveboardV2,
142
+ showPrimaryNavbar,
143
+ disableProfileAndHelp,
144
+ enableSearchAssist,
145
+ fullHeight,
146
+ } = this.viewConfig;
147
+
148
+ let params = {};
149
+ params[Param.EmbedApp] = true;
150
+ params[Param.PrimaryNavHidden] = !showPrimaryNavbar;
151
+ params[Param.HideProfleAndHelp] = !!disableProfileAndHelp;
152
+
153
+ params = this.getBaseQueryParams(params);
154
+
155
+ if (fullHeight === true) {
156
+ params[Param.fullHeight] = true;
157
+ }
125
158
 
126
159
  if (tag) {
127
160
  params[Param.Tag] = tag;
@@ -133,6 +166,10 @@ export class AppEmbed extends V1Embed {
133
166
  params[Param.LiveboardV2Enabled] = liveboardV2;
134
167
  }
135
168
 
169
+ if (enableSearchAssist !== undefined) {
170
+ params[Param.EnableSearchAssist] = enableSearchAssist;
171
+ }
172
+
136
173
  const queryParams = getQueryParamString(params, true);
137
174
 
138
175
  return queryParams;
@@ -140,21 +177,13 @@ export class AppEmbed extends V1Embed {
140
177
 
141
178
  /**
142
179
  * Constructs the URL of the ThoughtSpot app page to be rendered.
180
+ *
143
181
  * @param pageId The ID of the page to be embedded.
144
182
  */
145
- private getIFrameSrc(pageId: string, runtimeFilters: RuntimeFilter[]) {
146
- const filterQuery = getFilterQuery(runtimeFilters || []);
147
- const queryParams = this.getEmbedParams();
148
- const queryString = [filterQuery, queryParams]
149
- .filter(Boolean)
150
- .join('&');
151
- let url = `${this.getV1EmbedBasePath(
152
- queryString,
153
- this.viewConfig.showPrimaryNavbar,
154
- this.viewConfig.disableProfileAndHelp,
155
- true,
156
- this.viewConfig.enableSearchAssist,
157
- )}/${pageId}`;
183
+ private getIFrameSrc() {
184
+ const { pageId, path } = this.viewConfig;
185
+ const pageRoute = this.formatPath(path) || this.getPageRoute(pageId);
186
+ let url = `${this.getRootIframeSrc()}/${pageRoute}`;
158
187
 
159
188
  const tsPostHashParams = this.getThoughtSpotPostUrlParams();
160
189
  url = `${url}${tsPostHashParams}`;
@@ -162,8 +191,33 @@ export class AppEmbed extends V1Embed {
162
191
  return url;
163
192
  }
164
193
 
194
+ /**
195
+ * Set the iframe height as per the computed height received
196
+ * from the ThoughtSpot app.
197
+ *
198
+ * @param data The event payload
199
+ */
200
+ protected updateIFrameHeight = (data: MessagePayload) => {
201
+ this.setIFrameHeight(Math.max(data.data, this.iFrame?.scrollHeight));
202
+ }
203
+
204
+ private embedIframeCenter = (data: MessagePayload, responder: any) => {
205
+ const obj = this.getIframeCenter();
206
+ responder({ type: EmbedEvent.EmbedIframeCenter, data: obj });
207
+ };
208
+
209
+ private setIframeHeightForNonEmbedLiveboard = (data: MessagePayload) => {
210
+ const {
211
+ height: frameHeight, ...restParams
212
+ } = this.viewConfig.frameParams || {};
213
+ if (!data.data.currentPath.startsWith('/pinboard/')) {
214
+ this.setIFrameHeight(frameHeight || this.defaultHeight);
215
+ }
216
+ };
217
+
165
218
  /**
166
219
  * Gets the ThoughtSpot route of the page for a particular page ID.
220
+ *
167
221
  * @param pageId The identifier for a page in the ThoughtSpot app.
168
222
  */
169
223
  private getPageRoute(pageId: Page) {
@@ -188,6 +242,7 @@ export class AppEmbed extends V1Embed {
188
242
 
189
243
  /**
190
244
  * Formats the path provided by the user.
245
+ *
191
246
  * @param path The URL path.
192
247
  * @returns The URL path that the embedded app understands.
193
248
  */
@@ -206,10 +261,13 @@ export class AppEmbed extends V1Embed {
206
261
 
207
262
  /**
208
263
  * Navigate to particular page for app embed. eg:answers/pinboards/home
209
- * This is used for embedding answers, pinboards, visualizations and full application only.
264
+ * This is used for embedding answers, pinboards, visualizations and full application
265
+ * only.
266
+ *
210
267
  * @param path string | number The string, set to iframe src and navigate to new page
211
268
  * eg: appEmbed.navigateToPage('pinboards')
212
- * When used with `noReload` this can also be a number like 1/-1 to go forward/back.
269
+ * When used with `noReload` (default: true) this can also be a number
270
+ * like 1/-1 to go forward/back.
213
271
  * @param noReload boolean Trigger the navigation without reloading the page
214
272
  * @version SDK: 1.12.0 | ThoughtSpot: 8.4.0.cl, 8.4.1-sw
215
273
  */
@@ -222,31 +280,28 @@ export class AppEmbed extends V1Embed {
222
280
  this.trigger(HostEvent.Navigate, path);
223
281
  } else {
224
282
  if (typeof path !== 'string') {
225
- console.warn(
226
- 'Path can only by a string when triggered without noReload',
227
- );
283
+ console.warn('Path can only by a string when triggered without noReload');
228
284
  return;
229
285
  }
230
286
  const iframeSrc = this.iFrame.src;
231
287
  const embedPath = '#/embed';
232
288
  const currentPath = iframeSrc.includes(embedPath) ? embedPath : '#';
233
- this.iFrame.src = `${
234
- iframeSrc.split(currentPath)[0]
235
- }${currentPath}/${path.replace(/^\/?#?\//, '')}`;
289
+ this.iFrame.src = `${iframeSrc.split(currentPath)[0]}${currentPath}/${path.replace(
290
+ /^\/?#?\//,
291
+ '',
292
+ )}`;
236
293
  }
237
294
  }
238
295
 
239
296
  /**
240
297
  * Renders the embedded application pages in the ThoughtSpot app.
298
+ *
241
299
  * @param renderOptions An object containing the page ID
242
300
  * to be embedded.
243
301
  */
244
302
  public render(): AppEmbed {
245
303
  super.render();
246
-
247
- const { pageId, runtimeFilters, path } = this.viewConfig;
248
- const pageRoute = this.formatPath(path) || this.getPageRoute(pageId);
249
- const src = this.getIFrameSrc(pageRoute, runtimeFilters);
304
+ const src = this.getIFrameSrc();
250
305
  this.renderV1Embed(src);
251
306
 
252
307
  return this;
@@ -62,9 +62,7 @@ describe('Base TS Embed', () => {
62
62
  callPrefetch: true,
63
63
  });
64
64
  expect(getAllIframeEl().length).toBe(1);
65
- const prefetchIframe = document.querySelectorAll<HTMLIFrameElement>(
66
- '.prefetchIframe',
67
- );
65
+ const prefetchIframe = document.querySelectorAll<HTMLIFrameElement>('.prefetchIframe');
68
66
  expect(prefetchIframe.length).toBe(1);
69
67
  const firstIframe = <HTMLIFrameElement>prefetchIframe[0];
70
68
  expect(firstIframe.src).toBe(url);
@@ -79,9 +77,7 @@ describe('Base TS Embed', () => {
79
77
  index.PrefetchFeatures.LiveboardEmbed,
80
78
  ]);
81
79
  expect(getAllIframeEl().length).toBe(2);
82
- const prefetchIframe = document.querySelectorAll<HTMLIFrameElement>(
83
- '.prefetchIframe',
84
- );
80
+ const prefetchIframe = document.querySelectorAll<HTMLIFrameElement>('.prefetchIframe');
85
81
  expect(prefetchIframe.length).toBe(2);
86
82
  const firstIframe = <HTMLIFrameElement>prefetchIframe[0];
87
83
  expect(firstIframe.src).toBe(searchUrl);
@@ -93,9 +89,7 @@ describe('Base TS Embed', () => {
93
89
  const url = '';
94
90
  index.prefetch(url);
95
91
  expect(getAllIframeEl().length).toBe(0);
96
- const prefetchIframe = document.querySelectorAll<HTMLIFrameElement>(
97
- '.prefetchIframe',
98
- );
92
+ const prefetchIframe = document.querySelectorAll<HTMLIFrameElement>('.prefetchIframe');
99
93
  expect(prefetchIframe.length).toBe(0);
100
94
  });
101
95
 
package/src/embed/base.ts CHANGED
@@ -46,10 +46,7 @@ export const getEmbedConfig = (): EmbedConfig => config;
46
46
  export const getAuthPromise = (): Promise<boolean> => authPromise;
47
47
 
48
48
  export {
49
- notifyAuthFailure,
50
- notifyAuthSDKSuccess,
51
- notifyAuthSuccess,
52
- notifyLogout,
49
+ notifyAuthFailure, notifyAuthSDKSuccess, notifyAuthSuccess, notifyLogout,
53
50
  };
54
51
 
55
52
  /**
@@ -80,16 +77,16 @@ const hostUrlToFeatureUrl = {
80
77
  };
81
78
 
82
79
  /**
83
- * Prefetches static resources from the specified URL. Web browsers can then cache the prefetched resources and serve them from the user's local disk to provide faster access to your app.
80
+ * Prefetches static resources from the specified URL. Web browsers can then cache the
81
+ * prefetched resources and serve them from the user's local disk to provide faster access
82
+ * to your app.
83
+ *
84
84
  * @param url The URL provided for prefetch
85
85
  * @param prefetchFeatures Specify features which needs to be prefetched.
86
86
  * @version SDK: 1.4.0 | ThoughtSpot: ts7.sep.cl, 7.2.1
87
87
  * @group Global methods
88
88
  */
89
- export const prefetch = (
90
- url?: string,
91
- prefetchFeatures?: PrefetchFeatures[],
92
- ): void => {
89
+ export const prefetch = (url?: string, prefetchFeatures?: PrefetchFeatures[]): void => {
93
90
  if (url === '') {
94
91
  // eslint-disable-next-line no-console
95
92
  console.warn('The prefetch method does not have a valid URL');
@@ -97,21 +94,25 @@ export const prefetch = (
97
94
  const features = prefetchFeatures || [PrefetchFeatures.FullApp];
98
95
  let hostUrl = url || config.thoughtSpotHost;
99
96
  hostUrl = hostUrl[hostUrl.length - 1] === '/' ? hostUrl : `${hostUrl}/`;
100
- uniq(
101
- features.map((feature) => hostUrlToFeatureUrl[feature](hostUrl)),
102
- ).forEach((prefetchUrl, index) => {
103
- const iFrame = document.createElement('iframe');
104
- iFrame.src = prefetchUrl;
105
- iFrame.style.width = '0';
106
- iFrame.style.height = '0';
107
- iFrame.style.border = '0';
108
- iFrame.classList.add('prefetchIframe');
109
- iFrame.classList.add(`prefetchIframeNum-${index}`);
110
- document.body.appendChild(iFrame);
111
- });
97
+ uniq(features.map((feature) => hostUrlToFeatureUrl[feature](hostUrl))).forEach(
98
+ (prefetchUrl, index) => {
99
+ const iFrame = document.createElement('iframe');
100
+ iFrame.src = prefetchUrl;
101
+ iFrame.style.width = '0';
102
+ iFrame.style.height = '0';
103
+ iFrame.style.border = '0';
104
+ iFrame.classList.add('prefetchIframe');
105
+ iFrame.classList.add(`prefetchIframeNum-${index}`);
106
+ document.body.appendChild(iFrame);
107
+ },
108
+ );
112
109
  }
113
110
  };
114
111
 
112
+ /**
113
+ *
114
+ * @param embedConfig
115
+ */
115
116
  function sanity(embedConfig: EmbedConfig) {
116
117
  if (embedConfig.thoughtSpotHost === undefined) {
117
118
  throw new Error('ThoughtSpot host not provided');
@@ -121,23 +122,19 @@ function sanity(embedConfig: EmbedConfig) {
121
122
  throw new Error('Username not provided with Trusted auth');
122
123
  }
123
124
 
124
- if (
125
- !embedConfig.authEndpoint &&
126
- typeof embedConfig.getAuthToken !== 'function'
127
- ) {
128
- throw new Error(
129
- 'Trusted auth should provide either authEndpoint or getAuthToken',
130
- );
125
+ if (!embedConfig.authEndpoint && typeof embedConfig.getAuthToken !== 'function') {
126
+ throw new Error('Trusted auth should provide either authEndpoint or getAuthToken');
131
127
  }
132
128
  }
133
129
  }
134
130
 
131
+ /**
132
+ *
133
+ * @param embedConfig
134
+ */
135
135
  function backwardCompat(embedConfig: EmbedConfig): EmbedConfig {
136
136
  const newConfig = { ...embedConfig };
137
- if (
138
- embedConfig.noRedirect !== undefined &&
139
- embedConfig.inPopup === undefined
140
- ) {
137
+ if (embedConfig.noRedirect !== undefined && embedConfig.inPopup === undefined) {
141
138
  newConfig.inPopup = embedConfig.noRedirect;
142
139
  }
143
140
  return newConfig;
@@ -145,10 +142,12 @@ function backwardCompat(embedConfig: EmbedConfig): EmbedConfig {
145
142
 
146
143
  /**
147
144
  * Initializes the Visual Embed SDK globally and perform
148
- * authentication if applicable.
145
+ * authentication if applicable. This function needs to be called before any ThoughtSpot
146
+ * component like liveboard etc can be embedded. But need not wait for AuthEvent.SUCCESS
147
+ * to actually embed. That is handled internally.
148
+ *
149
149
  * @param embedConfig The configuration object containing ThoughtSpot host,
150
150
  * authentication mechanism and so on.
151
- *
152
151
  * @example
153
152
  * ```js
154
153
  * const authStatus = init({
@@ -157,8 +156,8 @@ function backwardCompat(embedConfig: EmbedConfig): EmbedConfig {
157
156
  * });
158
157
  * authStatus.on(AuthStatus.FAILURE, (reason) => { // do something here });
159
158
  * ```
160
- *
161
- * @returns {@link AuthEventEmitter} event emitter which emits events on authentication success, failure and logout. See {@link AuthStatus}
159
+ * @returns {@link AuthEventEmitter} event emitter which emits events on authentication success,
160
+ * failure and logout. See {@link AuthStatus}
162
161
  * @version SDK: 1.0.0 | ThoughtSpot ts7.april.cl, 7.2.1
163
162
  * @group Authentication / Init
164
163
  */
@@ -177,17 +176,12 @@ export const init = (embedConfig: EmbedConfig): AuthEventEmitter => {
177
176
  uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_CALLED_INIT, {
178
177
  authType: config.authType,
179
178
  host: config.thoughtSpotHost,
180
- usedCustomizationSheet:
181
- embedConfig.customizations?.style?.customCSSUrl != null,
182
- usedCustomizationVariables:
183
- embedConfig.customizations?.style?.customCSS?.variables != null,
179
+ usedCustomizationSheet: embedConfig.customizations?.style?.customCSSUrl != null,
180
+ usedCustomizationVariables: embedConfig.customizations?.style?.customCSS?.variables != null,
184
181
  usedCustomizationRules:
185
- embedConfig.customizations?.style?.customCSS?.rules_UNSTABLE !=
186
- null,
187
- usedCustomizationStrings: !!embedConfig.customizations?.content
188
- ?.strings,
189
- usedCustomizationIconSprite: !!embedConfig.customizations
190
- ?.iconSpriteUrl,
182
+ embedConfig.customizations?.style?.customCSS?.rules_UNSTABLE != null,
183
+ usedCustomizationStrings: !!embedConfig.customizations?.content?.strings,
184
+ usedCustomizationIconSprite: !!embedConfig.customizations?.iconSpriteUrl,
191
185
  });
192
186
 
193
187
  if (config.callPrefetch) {
@@ -196,16 +190,19 @@ export const init = (embedConfig: EmbedConfig): AuthEventEmitter => {
196
190
  return authEE as AuthEventEmitter;
197
191
  };
198
192
 
193
+ /**
194
+ *
195
+ */
199
196
  export function disableAutoLogin(): void {
200
197
  config.autoLogin = false;
201
198
  }
202
199
 
203
200
  /**
204
- * Logs out from ThoughtSpot. This also sets the autoLogin flag to false, to prevent
205
- * the SDK from automatically logging in again.
201
+ * Logs out from ThoughtSpot. This also sets the autoLogin flag to false, to
202
+ * prevent the SDK from automatically logging in again.
206
203
  *
207
- * You can call the `init` method again to re login, if autoLogin is set to true in this
208
- * second call it will be honored.
204
+ * You can call the `init` method again to re login, if autoLogin is set to
205
+ * true in this second call it will be honored.
209
206
  *
210
207
  * @param doNotDisableAutoLogin This flag when passed will not disable autoLogin
211
208
  * @returns Promise which resolves when logout completes.
@@ -225,22 +222,25 @@ export const logout = (doNotDisableAutoLogin = false): Promise<boolean> => {
225
222
  let renderQueue: Promise<any> = Promise.resolve();
226
223
 
227
224
  /**
228
- * Renders functions in a queue, resolves to next function only after the callback next is called
225
+ * Renders functions in a queue, resolves to next function only after the callback next
226
+ * is called
227
+ *
229
228
  * @param fn The function being registered
230
229
  */
231
- export const renderInQueue = (
232
- fn: (next?: (val?: any) => void) => Promise<any>,
233
- ): Promise<any> => {
230
+ export const renderInQueue = (fn: (next?: (val?: any) => void) => Promise<any>): Promise<any> => {
234
231
  const { queueMultiRenders = false } = config;
235
232
  if (queueMultiRenders) {
236
233
  renderQueue = renderQueue.then(() => new Promise((res) => fn(res)));
237
234
  return renderQueue;
238
235
  }
239
236
  // Sending an empty function to keep it consistent with the above usage.
240
- return fn(() => {}); // eslint-disable-line @typescript-eslint/no-empty-function
237
+ return fn(() => { }); // eslint-disable-line @typescript-eslint/no-empty-function
241
238
  };
242
239
 
243
240
  // For testing purposes only
241
+ /**
242
+ *
243
+ */
244
244
  export function reset(): void {
245
245
  config = {} as any;
246
246
  setAuthEE(null);
@@ -1,4 +1,6 @@
1
- import { init, AuthType, SearchEmbed, EmbedEvent } from '../index';
1
+ import {
2
+ init, AuthType, SearchEmbed, EmbedEvent,
3
+ } from '../index';
2
4
  import {
3
5
  EVENT_WAIT_TIME,
4
6
  executeAfterWait,
@@ -59,8 +61,7 @@ describe('test view config', () => {
59
61
  await executeAfterWait(() => {
60
62
  expect(onErrorSpy).toHaveBeenCalledWith(
61
63
  {
62
- error:
63
- 'Please register event handlers before calling render',
64
+ error: 'Please register event handlers before calling render',
64
65
  },
65
66
  expect.any(Function),
66
67
  );
@@ -84,9 +85,7 @@ describe('Custom CSS Url', () => {
84
85
  embed.render();
85
86
  executeAfterWait(() => {
86
87
  const iframe = getIFrameEl();
87
- expect(iframe.src.includes('customCssUrl=bla.com/foo.css')).toBe(
88
- true,
89
- );
88
+ expect(iframe.src.includes('customCssUrl=bla.com/foo.css')).toBe(true);
90
89
  done();
91
90
  });
92
91
  });