@thoughtspot/visual-embed-sdk 1.51.2 → 1.52.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 (316) hide show
  1. package/cjs/package.json +9 -1
  2. package/cjs/src/api-intercept.d.ts.map +1 -1
  3. package/cjs/src/api-intercept.js +1 -0
  4. package/cjs/src/api-intercept.js.map +1 -1
  5. package/cjs/src/contracts/contracts.spec.d.ts +2 -0
  6. package/cjs/src/contracts/contracts.spec.d.ts.map +1 -0
  7. package/cjs/src/contracts/contracts.spec.js +345 -0
  8. package/cjs/src/contracts/contracts.spec.js.map +1 -0
  9. package/cjs/src/contracts/embed-event-payloads.d.ts +73 -0
  10. package/cjs/src/contracts/embed-event-payloads.d.ts.map +1 -0
  11. package/cjs/src/contracts/embed-event-payloads.js +3 -0
  12. package/cjs/src/contracts/embed-event-payloads.js.map +1 -0
  13. package/cjs/src/contracts/host-event-contracts.d.ts +378 -0
  14. package/cjs/src/contracts/host-event-contracts.d.ts.map +1 -0
  15. package/cjs/src/contracts/host-event-contracts.js +3 -0
  16. package/cjs/src/contracts/host-event-contracts.js.map +1 -0
  17. package/cjs/src/contracts/index.d.ts +22 -0
  18. package/cjs/src/contracts/index.d.ts.map +1 -0
  19. package/cjs/src/contracts/index.js +33 -0
  20. package/cjs/src/contracts/index.js.map +1 -0
  21. package/cjs/src/contracts/ui-passthrough-contracts.d.ts +277 -0
  22. package/cjs/src/contracts/ui-passthrough-contracts.d.ts.map +1 -0
  23. package/cjs/src/{embed/hostEventClient/contracts.js → contracts/ui-passthrough-contracts.js} +6 -2
  24. package/cjs/src/contracts/ui-passthrough-contracts.js.map +1 -0
  25. package/cjs/src/css-variables.d.ts +1 -1
  26. package/cjs/src/embed/app.d.ts +17 -140
  27. package/cjs/src/embed/app.d.ts.map +1 -1
  28. package/cjs/src/embed/app.js +20 -120
  29. package/cjs/src/embed/app.js.map +1 -1
  30. package/cjs/src/embed/app.spec.js +70 -26
  31. package/cjs/src/embed/app.spec.js.map +1 -1
  32. package/cjs/src/embed/conversation.d.ts +5 -5
  33. package/cjs/src/embed/events.spec.js +12 -2
  34. package/cjs/src/embed/events.spec.js.map +1 -1
  35. package/cjs/src/embed/hostEventClient/host-event-client.d.ts +3 -2
  36. package/cjs/src/embed/hostEventClient/host-event-client.d.ts.map +1 -1
  37. package/cjs/src/embed/hostEventClient/host-event-client.js +23 -18
  38. package/cjs/src/embed/hostEventClient/host-event-client.js.map +1 -1
  39. package/cjs/src/embed/hostEventClient/host-event-client.spec.js +36 -36
  40. package/cjs/src/embed/hostEventClient/host-event-client.spec.js.map +1 -1
  41. package/cjs/src/embed/hostEventClient/utils.d.ts +1 -1
  42. package/cjs/src/embed/hostEventClient/utils.d.ts.map +1 -1
  43. package/cjs/src/embed/hostEventClient/utils.js +3 -3
  44. package/cjs/src/embed/hostEventClient/utils.js.map +1 -1
  45. package/cjs/src/embed/liveboard.d.ts +9 -161
  46. package/cjs/src/embed/liveboard.d.ts.map +1 -1
  47. package/cjs/src/embed/liveboard.js +68 -135
  48. package/cjs/src/embed/liveboard.js.map +1 -1
  49. package/cjs/src/embed/liveboard.spec.js +215 -32
  50. package/cjs/src/embed/liveboard.spec.js.map +1 -1
  51. package/cjs/src/embed/search.d.ts +14 -0
  52. package/cjs/src/embed/search.d.ts.map +1 -1
  53. package/cjs/src/embed/search.js +4 -1
  54. package/cjs/src/embed/search.js.map +1 -1
  55. package/cjs/src/embed/search.spec.js +65 -0
  56. package/cjs/src/embed/search.spec.js.map +1 -1
  57. package/cjs/src/embed/ts-embed.d.ts +21 -25
  58. package/cjs/src/embed/ts-embed.d.ts.map +1 -1
  59. package/cjs/src/embed/ts-embed.js +105 -72
  60. package/cjs/src/embed/ts-embed.js.map +1 -1
  61. package/cjs/src/embed/ts-embed.spec.d.ts.map +1 -1
  62. package/cjs/src/embed/ts-embed.spec.js +380 -33
  63. package/cjs/src/embed/ts-embed.spec.js.map +1 -1
  64. package/cjs/src/full-height.d.ts +137 -0
  65. package/cjs/src/full-height.d.ts.map +1 -0
  66. package/cjs/src/full-height.js +272 -0
  67. package/cjs/src/full-height.js.map +1 -0
  68. package/cjs/src/full-height.spec.d.ts +2 -0
  69. package/cjs/src/full-height.spec.d.ts.map +1 -0
  70. package/cjs/src/full-height.spec.js +835 -0
  71. package/cjs/src/full-height.spec.js.map +1 -0
  72. package/cjs/src/index.d.ts +4 -3
  73. package/cjs/src/index.d.ts.map +1 -1
  74. package/cjs/src/index.js +5 -4
  75. package/cjs/src/index.js.map +1 -1
  76. package/cjs/src/react/all-types-export.d.ts +1 -1
  77. package/cjs/src/react/all-types-export.d.ts.map +1 -1
  78. package/cjs/src/react/all-types-export.js +2 -1
  79. package/cjs/src/react/all-types-export.js.map +1 -1
  80. package/cjs/src/react/all-types-export.parity.spec.js +55 -3
  81. package/cjs/src/react/all-types-export.parity.spec.js.map +1 -1
  82. package/cjs/src/react/index.d.ts +8 -8
  83. package/cjs/src/react/index.d.ts.map +1 -1
  84. package/cjs/src/react/index.js +1 -1
  85. package/cjs/src/react/index.js.map +1 -1
  86. package/cjs/src/react/index.spec.js +7 -7
  87. package/cjs/src/react/index.spec.js.map +1 -1
  88. package/cjs/src/types.d.ts +664 -39
  89. package/cjs/src/types.d.ts.map +1 -1
  90. package/cjs/src/types.js +406 -13
  91. package/cjs/src/types.js.map +1 -1
  92. package/cjs/src/utils/processTrigger.d.ts +3 -1
  93. package/cjs/src/utils/processTrigger.d.ts.map +1 -1
  94. package/cjs/src/utils/processTrigger.js +19 -51
  95. package/cjs/src/utils/processTrigger.js.map +1 -1
  96. package/cjs/src/utils/transport/iframe-transport.d.ts +55 -0
  97. package/cjs/src/utils/transport/iframe-transport.d.ts.map +1 -0
  98. package/cjs/src/utils/transport/iframe-transport.js +108 -0
  99. package/cjs/src/utils/transport/iframe-transport.js.map +1 -0
  100. package/cjs/src/utils/transport/iframe-transport.spec.d.ts +2 -0
  101. package/cjs/src/utils/transport/iframe-transport.spec.d.ts.map +1 -0
  102. package/cjs/src/utils/transport/iframe-transport.spec.js +140 -0
  103. package/cjs/src/utils/transport/iframe-transport.spec.js.map +1 -0
  104. package/cjs/src/utils.d.ts +18 -0
  105. package/cjs/src/utils.d.ts.map +1 -1
  106. package/cjs/src/utils.js +39 -1
  107. package/cjs/src/utils.js.map +1 -1
  108. package/cjs/src/utils.spec.js +62 -0
  109. package/cjs/src/utils.spec.js.map +1 -1
  110. package/dist/{index-D8_Zs-Nr.js → index-C1pmYb5H.js} +1 -1
  111. package/dist/src/api-intercept.d.ts.map +1 -1
  112. package/dist/src/contracts/contracts.spec.d.ts +2 -0
  113. package/dist/src/contracts/contracts.spec.d.ts.map +1 -0
  114. package/dist/src/contracts/embed-event-payloads.d.ts +73 -0
  115. package/dist/src/contracts/embed-event-payloads.d.ts.map +1 -0
  116. package/dist/src/contracts/host-event-contracts.d.ts +378 -0
  117. package/dist/src/contracts/host-event-contracts.d.ts.map +1 -0
  118. package/dist/src/contracts/index.d.ts +22 -0
  119. package/dist/src/contracts/index.d.ts.map +1 -0
  120. package/dist/src/contracts/ui-passthrough-contracts.d.ts +277 -0
  121. package/dist/src/contracts/ui-passthrough-contracts.d.ts.map +1 -0
  122. package/dist/src/css-variables.d.ts +1 -1
  123. package/dist/src/embed/app.d.ts +17 -140
  124. package/dist/src/embed/app.d.ts.map +1 -1
  125. package/dist/src/embed/conversation.d.ts +5 -5
  126. package/dist/src/embed/hostEventClient/host-event-client.d.ts +3 -2
  127. package/dist/src/embed/hostEventClient/host-event-client.d.ts.map +1 -1
  128. package/dist/src/embed/hostEventClient/utils.d.ts +1 -1
  129. package/dist/src/embed/hostEventClient/utils.d.ts.map +1 -1
  130. package/dist/src/embed/liveboard.d.ts +9 -161
  131. package/dist/src/embed/liveboard.d.ts.map +1 -1
  132. package/dist/src/embed/search.d.ts +14 -0
  133. package/dist/src/embed/search.d.ts.map +1 -1
  134. package/dist/src/embed/ts-embed.d.ts +21 -25
  135. package/dist/src/embed/ts-embed.d.ts.map +1 -1
  136. package/dist/src/embed/ts-embed.spec.d.ts.map +1 -1
  137. package/dist/src/full-height.d.ts +137 -0
  138. package/dist/src/full-height.d.ts.map +1 -0
  139. package/dist/src/full-height.spec.d.ts +2 -0
  140. package/dist/src/full-height.spec.d.ts.map +1 -0
  141. package/dist/src/index.d.ts +4 -3
  142. package/dist/src/index.d.ts.map +1 -1
  143. package/dist/src/react/all-types-export.d.ts +1 -1
  144. package/dist/src/react/all-types-export.d.ts.map +1 -1
  145. package/dist/src/react/index.d.ts +8 -8
  146. package/dist/src/react/index.d.ts.map +1 -1
  147. package/dist/src/types.d.ts +664 -39
  148. package/dist/src/types.d.ts.map +1 -1
  149. package/dist/src/utils/processTrigger.d.ts +3 -1
  150. package/dist/src/utils/processTrigger.d.ts.map +1 -1
  151. package/dist/src/utils/transport/iframe-transport.d.ts +55 -0
  152. package/dist/src/utils/transport/iframe-transport.d.ts.map +1 -0
  153. package/dist/src/utils/transport/iframe-transport.spec.d.ts +2 -0
  154. package/dist/src/utils/transport/iframe-transport.spec.d.ts.map +1 -0
  155. package/dist/src/utils.d.ts +18 -0
  156. package/dist/src/utils.d.ts.map +1 -1
  157. package/dist/tsembed-react.es.js +1031 -392
  158. package/dist/tsembed-react.js +1030 -391
  159. package/dist/tsembed.es.js +1031 -392
  160. package/dist/tsembed.js +1029 -390
  161. package/dist/visual-embed-sdk-react-full.d.ts +1483 -693
  162. package/dist/visual-embed-sdk-react.d.ts +1364 -647
  163. package/dist/visual-embed-sdk.d.ts +1426 -659
  164. package/lib/package.json +9 -1
  165. package/lib/src/api-intercept.d.ts.map +1 -1
  166. package/lib/src/api-intercept.js +2 -1
  167. package/lib/src/api-intercept.js.map +1 -1
  168. package/lib/src/contracts/contracts.spec.d.ts +2 -0
  169. package/lib/src/contracts/contracts.spec.d.ts.map +1 -0
  170. package/lib/src/contracts/contracts.spec.js +342 -0
  171. package/lib/src/contracts/contracts.spec.js.map +1 -0
  172. package/lib/src/contracts/embed-event-payloads.d.ts +73 -0
  173. package/lib/src/contracts/embed-event-payloads.d.ts.map +1 -0
  174. package/lib/src/contracts/embed-event-payloads.js +2 -0
  175. package/lib/src/contracts/embed-event-payloads.js.map +1 -0
  176. package/lib/src/contracts/host-event-contracts.d.ts +378 -0
  177. package/lib/src/contracts/host-event-contracts.d.ts.map +1 -0
  178. package/lib/src/contracts/host-event-contracts.js +2 -0
  179. package/lib/src/contracts/host-event-contracts.js.map +1 -0
  180. package/lib/src/contracts/index.d.ts +22 -0
  181. package/lib/src/contracts/index.d.ts.map +1 -0
  182. package/lib/src/contracts/index.js +22 -0
  183. package/lib/src/contracts/index.js.map +1 -0
  184. package/lib/src/contracts/ui-passthrough-contracts.d.ts +277 -0
  185. package/lib/src/contracts/ui-passthrough-contracts.d.ts.map +1 -0
  186. package/lib/src/{embed/hostEventClient/contracts.js → contracts/ui-passthrough-contracts.js} +6 -2
  187. package/lib/src/contracts/ui-passthrough-contracts.js.map +1 -0
  188. package/lib/src/css-variables.d.ts +1 -1
  189. package/lib/src/embed/app.d.ts +17 -140
  190. package/lib/src/embed/app.d.ts.map +1 -1
  191. package/lib/src/embed/app.js +22 -122
  192. package/lib/src/embed/app.js.map +1 -1
  193. package/lib/src/embed/app.spec.js +70 -26
  194. package/lib/src/embed/app.spec.js.map +1 -1
  195. package/lib/src/embed/conversation.d.ts +5 -5
  196. package/lib/src/embed/events.spec.js +12 -2
  197. package/lib/src/embed/events.spec.js.map +1 -1
  198. package/lib/src/embed/hostEventClient/host-event-client.d.ts +3 -2
  199. package/lib/src/embed/hostEventClient/host-event-client.d.ts.map +1 -1
  200. package/lib/src/embed/hostEventClient/host-event-client.js +6 -1
  201. package/lib/src/embed/hostEventClient/host-event-client.js.map +1 -1
  202. package/lib/src/embed/hostEventClient/host-event-client.spec.js +1 -1
  203. package/lib/src/embed/hostEventClient/host-event-client.spec.js.map +1 -1
  204. package/lib/src/embed/hostEventClient/utils.d.ts +1 -1
  205. package/lib/src/embed/hostEventClient/utils.d.ts.map +1 -1
  206. package/lib/src/embed/hostEventClient/utils.js +1 -1
  207. package/lib/src/embed/hostEventClient/utils.js.map +1 -1
  208. package/lib/src/embed/liveboard.d.ts +9 -161
  209. package/lib/src/embed/liveboard.d.ts.map +1 -1
  210. package/lib/src/embed/liveboard.js +70 -137
  211. package/lib/src/embed/liveboard.js.map +1 -1
  212. package/lib/src/embed/liveboard.spec.js +215 -32
  213. package/lib/src/embed/liveboard.spec.js.map +1 -1
  214. package/lib/src/embed/search.d.ts +14 -0
  215. package/lib/src/embed/search.d.ts.map +1 -1
  216. package/lib/src/embed/search.js +4 -1
  217. package/lib/src/embed/search.js.map +1 -1
  218. package/lib/src/embed/search.spec.js +65 -0
  219. package/lib/src/embed/search.spec.js.map +1 -1
  220. package/lib/src/embed/ts-embed.d.ts +21 -25
  221. package/lib/src/embed/ts-embed.d.ts.map +1 -1
  222. package/lib/src/embed/ts-embed.js +106 -73
  223. package/lib/src/embed/ts-embed.js.map +1 -1
  224. package/lib/src/embed/ts-embed.spec.d.ts.map +1 -1
  225. package/lib/src/embed/ts-embed.spec.js +378 -31
  226. package/lib/src/embed/ts-embed.spec.js.map +1 -1
  227. package/lib/src/full-height.d.ts +137 -0
  228. package/lib/src/full-height.d.ts.map +1 -0
  229. package/lib/src/full-height.js +268 -0
  230. package/lib/src/full-height.js.map +1 -0
  231. package/lib/src/full-height.spec.d.ts +2 -0
  232. package/lib/src/full-height.spec.d.ts.map +1 -0
  233. package/lib/src/full-height.spec.js +833 -0
  234. package/lib/src/full-height.spec.js.map +1 -0
  235. package/lib/src/index.d.ts +4 -3
  236. package/lib/src/index.d.ts.map +1 -1
  237. package/lib/src/index.js +3 -3
  238. package/lib/src/index.js.map +1 -1
  239. package/lib/src/react/all-types-export.d.ts +1 -1
  240. package/lib/src/react/all-types-export.d.ts.map +1 -1
  241. package/lib/src/react/all-types-export.js +1 -1
  242. package/lib/src/react/all-types-export.js.map +1 -1
  243. package/lib/src/react/all-types-export.parity.spec.js +55 -3
  244. package/lib/src/react/all-types-export.parity.spec.js.map +1 -1
  245. package/lib/src/react/index.d.ts +8 -8
  246. package/lib/src/react/index.d.ts.map +1 -1
  247. package/lib/src/react/index.js +1 -1
  248. package/lib/src/react/index.js.map +1 -1
  249. package/lib/src/react/index.spec.js +7 -7
  250. package/lib/src/react/index.spec.js.map +1 -1
  251. package/lib/src/types.d.ts +664 -39
  252. package/lib/src/types.d.ts.map +1 -1
  253. package/lib/src/types.js +405 -12
  254. package/lib/src/types.js.map +1 -1
  255. package/lib/src/utils/processTrigger.d.ts +3 -1
  256. package/lib/src/utils/processTrigger.d.ts.map +1 -1
  257. package/lib/src/utils/processTrigger.js +19 -51
  258. package/lib/src/utils/processTrigger.js.map +1 -1
  259. package/lib/src/utils/transport/iframe-transport.d.ts +55 -0
  260. package/lib/src/utils/transport/iframe-transport.d.ts.map +1 -0
  261. package/lib/src/utils/transport/iframe-transport.js +101 -0
  262. package/lib/src/utils/transport/iframe-transport.js.map +1 -0
  263. package/lib/src/utils/transport/iframe-transport.spec.d.ts +2 -0
  264. package/lib/src/utils/transport/iframe-transport.spec.d.ts.map +1 -0
  265. package/lib/src/utils/transport/iframe-transport.spec.js +138 -0
  266. package/lib/src/utils/transport/iframe-transport.spec.js.map +1 -0
  267. package/lib/src/utils.d.ts +18 -0
  268. package/lib/src/utils.d.ts.map +1 -1
  269. package/lib/src/utils.js +37 -0
  270. package/lib/src/utils.js.map +1 -1
  271. package/lib/src/utils.spec.js +63 -1
  272. package/lib/src/utils.spec.js.map +1 -1
  273. package/lib/src/visual-embed-sdk.d.ts +1426 -659
  274. package/package.json +9 -1
  275. package/src/api-intercept.ts +2 -1
  276. package/src/contracts/contracts.spec.ts +392 -0
  277. package/src/contracts/embed-event-payloads.ts +83 -0
  278. package/src/contracts/host-event-contracts.ts +456 -0
  279. package/src/contracts/index.ts +53 -0
  280. package/src/contracts/ui-passthrough-contracts.ts +301 -0
  281. package/src/css-variables.ts +1 -1
  282. package/src/embed/app.spec.ts +86 -34
  283. package/src/embed/app.ts +37 -264
  284. package/src/embed/conversation.ts +5 -5
  285. package/src/embed/events.spec.ts +14 -2
  286. package/src/embed/hostEventClient/host-event-client.spec.ts +2 -2
  287. package/src/embed/hostEventClient/host-event-client.ts +18 -5
  288. package/src/embed/hostEventClient/utils.ts +2 -1
  289. package/src/embed/liveboard.spec.ts +261 -42
  290. package/src/embed/liveboard.ts +78 -297
  291. package/src/embed/search.spec.ts +80 -0
  292. package/src/embed/search.ts +20 -0
  293. package/src/embed/ts-embed.spec.ts +518 -31
  294. package/src/embed/ts-embed.ts +133 -82
  295. package/src/full-height.spec.ts +1008 -0
  296. package/src/full-height.ts +361 -0
  297. package/src/index.ts +95 -5
  298. package/src/react/all-types-export.parity.spec.ts +63 -3
  299. package/src/react/all-types-export.ts +46 -0
  300. package/src/react/index.spec.tsx +7 -7
  301. package/src/react/index.tsx +9 -9
  302. package/src/types.ts +665 -37
  303. package/src/utils/processTrigger.ts +28 -58
  304. package/src/utils/transport/iframe-transport.spec.ts +177 -0
  305. package/src/utils/transport/iframe-transport.ts +122 -0
  306. package/src/utils.spec.ts +71 -0
  307. package/src/utils.ts +38 -0
  308. package/cjs/src/embed/hostEventClient/contracts.d.ts +0 -231
  309. package/cjs/src/embed/hostEventClient/contracts.d.ts.map +0 -1
  310. package/cjs/src/embed/hostEventClient/contracts.js.map +0 -1
  311. package/dist/src/embed/hostEventClient/contracts.d.ts +0 -231
  312. package/dist/src/embed/hostEventClient/contracts.d.ts.map +0 -1
  313. package/lib/src/embed/hostEventClient/contracts.d.ts +0 -231
  314. package/lib/src/embed/hostEventClient/contracts.d.ts.map +0 -1
  315. package/lib/src/embed/hostEventClient/contracts.js.map +0 -1
  316. package/src/embed/hostEventClient/contracts.ts +0 -262
@@ -12,7 +12,6 @@ import { getPreview } from '../utils/graphql/preview-service';
12
12
  import { ERROR_MESSAGE } from '../errors';
13
13
  import {
14
14
  EmbedEvent,
15
- MessagePayload,
16
15
  Param,
17
16
  RuntimeFilter,
18
17
  DOMSelector,
@@ -20,22 +19,29 @@ import {
20
19
  SearchLiveboardCommonViewConfig as LiveboardOtherViewConfig,
21
20
  BaseViewConfig,
22
21
  LiveboardAppEmbedViewConfig,
22
+ FullHeightViewConfig,
23
23
  ErrorDetailsTypes,
24
24
  EmbedErrorCodes,
25
+ EmbedErrorSeverity,
25
26
  ContextType,
26
27
  DefaultAppInitData,
27
28
  } from '../types';
28
- import { calculateVisibleElementData, getEffectiveClippingAncestors, getQueryParamString, getScrollableAncestors, isUndefined, isValidCssMargin, setParamIfDefined } from '../utils';
29
- import { DEFAULT_LAZY_LOADING_MARGIN } from '../config';
29
+ import { FullHeightController } from '../full-height';
30
+ import { getQueryParamString, isUndefined, setParamIfDefined } from '../utils';
30
31
  import { getAuthPromise } from './base';
31
32
  import { TsEmbed, V1Embed } from './ts-embed';
32
33
  import { addPreviewStylesIfNotPresent } from '../utils/global-styles';
33
- import { HostEventRequest, TriggerPayload, TriggerResponse } from './hostEventClient/contracts';
34
+ import { HostEventRequest, TriggerData, TriggerResponse } from '../contracts/host-event-contracts';
34
35
  import { logger } from '../utils/logger';
35
36
  import { SpotterChatViewConfig, StarterPromptsConfig } from './conversation';
36
37
  import { buildStarterPromptsAppInitData } from './spotter-utils';
37
38
  import { SpotterVizConfig, buildSpotterVizAppInitData } from './spotter-viz-utils';
38
39
 
40
+ // Home unmounts the liveboard container, which is how its state gets cleared. The
41
+ // settle window gives the container time to do it before we ask for the liveboard back.
42
+ const HOME_ROUTE = 'home';
43
+ const HOME_SETTLE_MS = 200;
44
+
39
45
  /**
40
46
  * APP_INIT data shape for LiveboardEmbed.
41
47
  * @internal
@@ -52,71 +58,11 @@ export interface LiveboardEmbedAppInitData extends DefaultAppInitData {
52
58
  * The configuration for the embedded Liveboard or visualization page view.
53
59
  * @group Embed components
54
60
  */
55
- export interface LiveboardViewConfig extends BaseViewConfig, LiveboardOtherViewConfig, LiveboardAppEmbedViewConfig {
56
- /**
57
- * If set to true, the embedded object container dynamically resizes
58
- * according to the height of the Liveboard.
59
- *
60
- * **Note**: Using fullHeight loads all visualizations on the
61
- * Liveboard simultaneously, which results in multiple warehouse
62
- * queries and potentially a longer wait for the topmost
63
- * visualizations to display on the screen.
64
- * Setting `fullHeight` to `false` fetches visualizations
65
- * incrementally as users scroll the page to view the charts and tables.
66
- *
67
- * From SDK 1.52.0, enabling `fullHeight` also turns on
68
- * {@link lazyLoadingForFullHeight} and
69
- * {@link enableScrollableContainerLazyLoading}, so visualizations load as
70
- * they scroll into view. Set either flag to `false` to opt out.
71
- *
72
- *
73
- * Supported embed types: `LiveboardEmbed`
74
- * @version SDK: 1.1.0 | ThoughtSpot: ts7.may.cl, 7.2.1
75
- * @example
76
- * ```js
77
- * const embed = new LiveboardEmbed('#embed', {
78
- * ... // other liveboard view config
79
- * fullHeight: true,
80
- * });
81
- * ```
82
- */
83
- fullHeight?: boolean;
84
- /**
85
- * This is the minimum height (in pixels) for a full-height Liveboard.
86
- * Setting this height helps resolve issues with empty Liveboards and
87
- * other screens navigable from a Liveboard.
88
- *
89
- * Supported embed types: `LiveboardEmbed`
90
- * @version SDK: 1.5.0 | ThoughtSpot: ts7.oct.cl, 7.2.1
91
- * @deprecated Use `minimumHeight` instead.
92
- * @default 500
93
- * @example
94
- * ```js
95
- * const embed = new LiveboardEmbed('#embed', {
96
- * ... // other liveboard view config
97
- * fullHeight: true,
98
- * defaultHeight: 600,
99
- * });
100
- * ```
101
- */
102
- defaultHeight?: number;
103
- /**
104
- * This is the minimum height (in pixels) for a full-height Liveboard.
105
- * Setting this height helps resolve issues with empty Liveboards and
106
- * other screens navigable from a Liveboard.
107
- *
108
- * @version SDK: 1.44.2 | ThoughtSpot: 10.15.0.cl
109
- * @default 500
110
- * @example
111
- * ```js
112
- * const embed = new LiveboardEmbed('#embed', {
113
- * ... // other liveboard view config
114
- * fullHeight: true,
115
- * minimumHeight: 600,
116
- * });
117
- * ```
118
- */
119
- minimumHeight?: number;
61
+ export interface LiveboardViewConfig
62
+ extends BaseViewConfig,
63
+ FullHeightViewConfig,
64
+ LiveboardOtherViewConfig,
65
+ LiveboardAppEmbedViewConfig {
120
66
  /**
121
67
  * If set to true, the context menu in visualizations will be enabled.
122
68
  * @version SDK: 1.1.0 | ThoughtSpot: 8.1.0.sw
@@ -462,77 +408,6 @@ export interface LiveboardViewConfig extends BaseViewConfig, LiveboardOtherViewC
462
408
  * ```
463
409
  */
464
410
  isGranularXLSXCSVSchedulesEnabled?: boolean;
465
- /**
466
- * Loads visualizations only as they scroll into the viewport, instead of
467
- * loading the whole full-height Liveboard at once.
468
- *
469
- * From SDK 1.52.0 this is enabled automatically whenever `fullHeight` is
470
- * `true`. On SDK 1.51.0 and earlier it defaulted to `false` and had to be
471
- * set explicitly. Set it to `false` to load every visualization upfront.
472
- * The flag has no effect unless `fullHeight` is enabled.
473
- *
474
- * @type {boolean}
475
- * @version SDK: 1.40.0 | ThoughtSpot: 10.12.0.cl
476
- * @default true when `fullHeight` is enabled, from SDK 1.52.0
477
- * @example
478
- * ```js
479
- * const embed = new LiveboardEmbed('#embed-container', {
480
- * // ...other options
481
- * fullHeight: true,
482
- * lazyLoadingForFullHeight: true,
483
- * })
484
- * ```
485
- */
486
- lazyLoadingForFullHeight?: boolean;
487
- /**
488
- * Computes the visible region of the embed against its scrollable and
489
- * clipping ancestors, instead of treating the browser window as the only
490
- * viewport, and tracks scroll and resize on those ancestors.
491
- *
492
- * From SDK 1.52.0 this is enabled automatically whenever `fullHeight` is
493
- * `true`. On SDK 1.51.0 and earlier it defaulted to `false` and had to be
494
- * set explicitly. Set it to `false` when the page scrolls with the window
495
- * and the embed has no clipping ancestor, to skip the extra ancestor
496
- * tracking.
497
- *
498
- * @type {boolean}
499
- * @default true when `fullHeight` is enabled, from SDK 1.52.0
500
- */
501
- enableScrollableContainerLazyLoading?: boolean;
502
- /**
503
- * How far outside the viewport a visualization starts loading, when
504
- * {@link lazyLoadingForFullHeight} is enabled.
505
- *
506
- * For example, if the margin is set to '10px',
507
- * the visualization will be loaded 10px before its top edge is visible in the
508
- * viewport.
509
- *
510
- * The format is similar to CSS margin, so `'500px 0px'` extends the
511
- * prefetch 500px above and below the viewport and not sideways. Accepted
512
- * units are `px`, `em`, `rem`, `%`, `vh` and `vw`, plus bare `0` and
513
- * `auto`; an invalid value is logged and ignored.
514
- *
515
- * From SDK 1.52.0 this defaults to `'500px 0px'` — roughly one
516
- * visualization ahead of the scroll position, so a chart has usually
517
- * finished loading by the time it scrolls into view. Use a smaller margin
518
- * to cut warehouse queries further, or `'0px'` to load a visualization
519
- * only once it is actually visible.
520
- *
521
- * @type {string}
522
- * @version SDK: 1.40.0 | ThoughtSpot: 10.12.0.cl
523
- * @default '500px 0px' when `fullHeight` is enabled, from SDK 1.52.0
524
- * @example
525
- * ```js
526
- * const embed = new LiveboardEmbed('#embed-container', {
527
- * // ...other options
528
- * fullHeight: true,
529
- * lazyLoadingForFullHeight: true,
530
- * // Using 0px, the visualization will be only loaded when it's visible in the viewport.
531
- * lazyLoadingMargin: '0px',
532
- * })
533
- * ```
534
- */
535
- lazyLoadingMargin?: string;
536
411
  /**
537
412
  * showSpotterLimitations : show limitation text
538
413
  * of the spotter underneath the chat input.
@@ -688,36 +563,26 @@ export interface LiveboardViewConfig extends BaseViewConfig, LiveboardOtherViewC
688
563
  export class LiveboardEmbed extends V1Embed {
689
564
  protected viewConfig: LiveboardViewConfig;
690
565
 
691
- private defaultHeight = 500;
692
-
693
- private lazyLoadScrollContainers: HTMLElement[] = [];
694
-
695
- private lazyLoadResizeObserver: ResizeObserver | undefined;
696
-
566
+ private readonly fullHeightController?: FullHeightController;
697
567
 
698
568
  constructor(domSelector: DOMSelector, viewConfig: LiveboardViewConfig) {
699
569
  viewConfig.embedComponentType = 'LiveboardEmbed';
700
570
  super(domSelector, viewConfig);
701
571
  if (this.viewConfig.fullHeight === true) {
702
572
  if (this.viewConfig.vizId) {
703
- logger.warn('Full height is currently only supported for Liveboard embeds.' +
704
- 'Using full height with vizId might lead to unexpected behavior.');
573
+ logger.warn('Full height is currently only supported for Liveboard embeds.'
574
+ + 'Using full height with vizId might lead to unexpected behavior.');
705
575
  }
706
-
707
- if (this.viewConfig.lazyLoadingForFullHeight === undefined) {
708
- this.viewConfig.lazyLoadingForFullHeight = true;
709
- }
710
- if (this.viewConfig.enableScrollableContainerLazyLoading === undefined) {
711
- this.viewConfig.enableScrollableContainerLazyLoading = true;
712
- }
713
- if (this.viewConfig.lazyLoadingMargin === undefined) {
714
- this.viewConfig.lazyLoadingMargin = DEFAULT_LAZY_LOADING_MARGIN;
715
- }
716
-
717
- this.on(EmbedEvent.RouteChange, this.setIframeHeightForNonEmbedLiveboard);
718
- this.on(EmbedEvent.EmbedHeight, this.updateIFrameHeight);
719
- this.on(EmbedEvent.EmbedIframeCenter, this.embedIframeCenter);
720
- this.on(EmbedEvent.RequestVisibleEmbedCoordinates, this.requestVisibleEmbedCoordinatesHandler);
576
+ this.fullHeightController = new FullHeightController(this.viewConfig, {
577
+ getIframe: () => this.iFrame,
578
+ setFrameHeight: (height) => this.setIFrameHeight(height),
579
+ on: (eventType, callback) => {
580
+ this.on(eventType, callback);
581
+ },
582
+ trigger: (hostEvent, data) => {
583
+ this.trigger(hostEvent, data);
584
+ },
585
+ });
721
586
  }
722
587
  }
723
588
 
@@ -742,9 +607,6 @@ export class LiveboardEmbed extends V1Embed {
742
607
  params = this.getBaseQueryParams(params);
743
608
  const {
744
609
  enableVizTransformations,
745
- fullHeight,
746
- defaultHeight,
747
- minimumHeight,
748
610
  visibleVizs,
749
611
  liveboardV2,
750
612
  vizId,
@@ -793,16 +655,7 @@ export class LiveboardEmbed extends V1Embed {
793
655
  const preventLiveboardFilterRemoval = this.viewConfig.preventLiveboardFilterRemoval
794
656
  || this.viewConfig.preventPinboardFilterRemoval;
795
657
 
796
- if (fullHeight === true) {
797
- params[Param.fullHeight] = true;
798
- if (this.viewConfig.lazyLoadingForFullHeight) {
799
- params[Param.IsLazyLoadingForEmbedEnabled] = true;
800
- if (isValidCssMargin(this.viewConfig.lazyLoadingMargin)) {
801
- params[Param.RootMarginForLazyLoad] = this.viewConfig.lazyLoadingMargin;
802
- }
803
- }
804
- }
805
- this.defaultHeight = minimumHeight || defaultHeight || this.defaultHeight;
658
+ this.fullHeightController?.addQueryParams(params);
806
659
  if (enableVizTransformations !== undefined) {
807
660
  params[Param.EnableVizTransformations] = enableVizTransformations.toString();
808
661
  }
@@ -1017,32 +870,6 @@ export class LiveboardEmbed extends V1Embed {
1017
870
  return suffix;
1018
871
  }
1019
872
 
1020
- private sendFullHeightLazyLoadData = () => {
1021
- const data = calculateVisibleElementData(
1022
- this.iFrame,
1023
- this.viewConfig.enableScrollableContainerLazyLoading,
1024
- );
1025
- // this should be fired only if the lazyLoadingForFullHeight and fullHeight are true
1026
- if(this.viewConfig.lazyLoadingForFullHeight && this.viewConfig.fullHeight){
1027
- this.trigger(HostEvent.VisibleEmbedCoordinates, data);
1028
- }
1029
- };
1030
-
1031
- /**
1032
- * This is a handler for the RequestVisibleEmbedCoordinates event.
1033
- * It is used to send the visible coordinates data to the host application.
1034
- * @param data The event payload
1035
- * @param responder The responder function
1036
- */
1037
- private requestVisibleEmbedCoordinatesHandler = (data: MessagePayload, responder: any) => {
1038
- logger.info('Sending RequestVisibleEmbedCoordinates', data);
1039
- const visibleCoordinatesData = calculateVisibleElementData(
1040
- this.iFrame,
1041
- this.viewConfig.enableScrollableContainerLazyLoading,
1042
- );
1043
- responder({ type: EmbedEvent.RequestVisibleEmbedCoordinates, data: visibleCoordinatesData });
1044
- }
1045
-
1046
873
  /**
1047
874
  * Construct the URL of the embedded ThoughtSpot Liveboard or visualization
1048
875
  * to be loaded within the iFrame.
@@ -1056,6 +883,7 @@ export class LiveboardEmbed extends V1Embed {
1056
883
  errorType: ErrorDetailsTypes.VALIDATION_ERROR,
1057
884
  message: ERROR_MESSAGE.LIVEBOARD_VIZ_ID_VALIDATION,
1058
885
  code: EmbedErrorCodes.LIVEBOARD_ID_MISSING,
886
+ severity: EmbedErrorSeverity.SEV1,
1059
887
  error: ERROR_MESSAGE.LIVEBOARD_VIZ_ID_VALIDATION,
1060
888
  });
1061
889
  }
@@ -1067,44 +895,6 @@ export class LiveboardEmbed extends V1Embed {
1067
895
  )}`;
1068
896
  }
1069
897
 
1070
- /**
1071
- * Set the iframe height as per the computed height received
1072
- * from the ThoughtSpot app.
1073
- * @param data The event payload
1074
- */
1075
- private updateIFrameHeight = (data: MessagePayload) => {
1076
- this.setIFrameHeight(Math.max(data.data, this.defaultHeight));
1077
- this.sendFullHeightLazyLoadData();
1078
- };
1079
-
1080
- private embedIframeCenter = (data: MessagePayload, responder: any) => {
1081
- const obj = this.getIframeCenter();
1082
- responder({ type: EmbedEvent.EmbedIframeCenter, data: obj });
1083
- };
1084
-
1085
- private setIframeHeightForNonEmbedLiveboard = (data: MessagePayload) => {
1086
- const { height: frameHeight } = this.viewConfig.frameParams || {};
1087
-
1088
- const liveboardRelatedRoutes = [
1089
- '/pinboard/',
1090
- '/insights/pinboard/',
1091
- '/schedules/',
1092
- '/embed/viz/',
1093
- '/embed/insights/viz/',
1094
- '/liveboard/',
1095
- '/insights/liveboard/',
1096
- '/tsl-editor/PINBOARD_ANSWER_BOOK/',
1097
- '/import-tsl/PINBOARD_ANSWER_BOOK/',
1098
- ];
1099
-
1100
- if (liveboardRelatedRoutes.some((path) => data.data.currentPath.startsWith(path))) {
1101
- // Ignore the height reset of the frame, if the navigation is
1102
- // only within the liveboard page.
1103
- return;
1104
- }
1105
- this.setIFrameHeight(frameHeight || this.defaultHeight);
1106
- };
1107
-
1108
898
  private setActiveTab(data: { tabId: string }) {
1109
899
  if (!this.viewConfig.vizId) {
1110
900
  const prefixPath = this.iFrame.src.split('#/')[1].split('/tab')[0];
@@ -1161,26 +951,55 @@ export class LiveboardEmbed extends V1Embed {
1161
951
 
1162
952
  protected beforePrerenderVisible(): void {
1163
953
  super.beforePrerenderVisible();
1164
- const embedObj = this.getPreRenderObj<LiveboardEmbed>();
1165
954
 
1166
- this.executeAfterEmbedContainerLoaded(() => {
955
+ // Captured before showPreRender() hands the wrapper over to this instance.
956
+ // Itself means a hide/show, not a hand-over, so there is nothing stale to clear.
957
+ const previous = this.getPreRenderObj<LiveboardEmbed>();
958
+ const showing = previous === this ? undefined : previous?.currentLiveboardState;
959
+
960
+ this.executeAfterEmbedContainerLoaded(async () => {
961
+ // Without this the params callback suspends on its await and Navigate
962
+ // goes out first, so the container loads with the previous config's filters.
963
+ await this.preRenderParamsApplied;
964
+ if (this.isShowingLiveboardRoute(showing)) {
965
+ // Navigate to the route we are already on is a no-op, so the liveboard
966
+ // keeps its state. Home unmounts the container, which clears it.
967
+ this.trigger(HostEvent.Navigate, HOME_ROUTE)
968
+ .catch((error) => logger.warn('Could not route via home', error));
969
+ // Not awaited above: the container never acks Navigate, so that promise
970
+ // only settles on the 30s trigger timeout.
971
+ await new Promise((resolve) => {
972
+ setTimeout(resolve, HOME_SETTLE_MS);
973
+ });
974
+ }
1167
975
  this.navigateToLiveboard(
1168
976
  this.viewConfig.liveboardId,
1169
977
  this.viewConfig.vizId,
1170
978
  this.viewConfig.activeTabId,
1171
979
  this.viewConfig.personalizedViewId,
1172
980
  );
1173
- if (embedObj) {
1174
- embedObj.currentLiveboardState = {
1175
- liveboardId: this.viewConfig.liveboardId,
1176
- vizId: this.viewConfig.vizId,
1177
- activeTabId: this.viewConfig.activeTabId,
1178
- personalizedViewId: this.viewConfig.personalizedViewId,
1179
- };
1180
- }
981
+ this.currentLiveboardState = {
982
+ liveboardId: this.viewConfig.liveboardId,
983
+ vizId: this.viewConfig.vizId,
984
+ activeTabId: this.viewConfig.activeTabId,
985
+ personalizedViewId: this.viewConfig.personalizedViewId,
986
+ };
1181
987
  });
1182
988
  }
1183
989
 
990
+ // The whole route, not just the liveboard id: the path is built from the viz, tab
991
+ // and view too, so a same-liveboard show onto another tab is a real navigation.
992
+ private isShowingLiveboardRoute(showing?: LiveboardEmbed['currentLiveboardState']): boolean {
993
+ if (!showing?.liveboardId) return false;
994
+ const {
995
+ liveboardId, vizId, activeTabId, personalizedViewId,
996
+ } = this.viewConfig;
997
+ return showing.liveboardId === liveboardId
998
+ && showing.vizId === vizId
999
+ && showing.activeTabId === activeTabId
1000
+ && showing.personalizedViewId === personalizedViewId;
1001
+ }
1002
+
1184
1003
  protected async handleRenderForPrerender(): Promise<TsEmbed> {
1185
1004
  if (isUndefined(this.viewConfig.liveboardId)) {
1186
1005
  return this.prerenderGeneric();
@@ -1190,8 +1009,10 @@ export class LiveboardEmbed extends V1Embed {
1190
1009
 
1191
1010
  /**
1192
1011
  * Triggers an event to the embedded app
1012
+ * Payload typing follows {@link TsEmbed.trigger}: unknown fields fail to compile
1013
+ * from SDK 1.52.0; strict contract checks land in SDK 1.54.0.
1193
1014
  * @param {HostEvent} messageType The event type
1194
- * @param {any} data The payload to send with the message
1015
+ * @param {TriggerData} data The payload, typed against the event's contract
1195
1016
  * @returns A promise that resolves with the response from the embedded app
1196
1017
  */
1197
1018
  public trigger<
@@ -1202,7 +1023,9 @@ export class LiveboardEmbed extends V1Embed {
1202
1023
  ContextT extends ContextType = ContextType,
1203
1024
  >(
1204
1025
  messageType: HostEventT,
1205
- data: TriggerPayload<PayloadT, HostEventT> = ({} as any),
1026
+ // Mirror TsEmbed.trigger: contract shape is the contextual type and
1027
+ // unknown fields on object literals are flagged. Strict in SDK 1.54.0.
1028
+ data: TriggerData<HostEventT> = ({} as any),
1206
1029
  context?: ContextT,
1207
1030
  ): Promise<TriggerResponse<PayloadT, HostEventT, ContextT>> {
1208
1031
  const dataWithVizId: any = data;
@@ -1221,53 +1044,11 @@ export class LiveboardEmbed extends V1Embed {
1221
1044
  */
1222
1045
  public destroy() {
1223
1046
  super.destroy();
1224
- this.unregisterLazyLoadEvents();
1047
+ this.fullHeightController?.destroy();
1225
1048
  }
1226
1049
 
1227
1050
  private postRender() {
1228
- this.registerLazyLoadEvents();
1229
- }
1230
-
1231
- private registerLazyLoadEvents() {
1232
- if(!this.iFrame) {
1233
- return;
1234
- }
1235
- if (this.viewConfig.fullHeight && this.viewConfig.lazyLoadingForFullHeight) {
1236
- this.unregisterLazyLoadEvents();
1237
- // TODO: Use passive: true, install modernizr to check for passive
1238
- window.addEventListener('resize', this.sendFullHeightLazyLoadData);
1239
- window.addEventListener('scroll', this.sendFullHeightLazyLoadData, true);
1240
- if (!this.viewConfig.enableScrollableContainerLazyLoading) {
1241
- return;
1242
- }
1243
- this.lazyLoadScrollContainers = getScrollableAncestors(this.iFrame);
1244
- this.lazyLoadScrollContainers.forEach((scrollContainer) => {
1245
- scrollContainer.addEventListener('scroll', this.sendFullHeightLazyLoadData);
1246
- });
1247
- if (typeof ResizeObserver !== 'undefined') {
1248
- const resizeTargets = new Set([
1249
- this.iFrame.parentElement,
1250
- ...getEffectiveClippingAncestors(this.iFrame),
1251
- ].filter(Boolean) as HTMLElement[]);
1252
- this.lazyLoadResizeObserver = new ResizeObserver(this.sendFullHeightLazyLoadData);
1253
- resizeTargets.forEach((resizeTarget) => {
1254
- this.lazyLoadResizeObserver.observe(resizeTarget);
1255
- });
1256
- }
1257
- }
1258
- }
1259
-
1260
- private unregisterLazyLoadEvents() {
1261
- if (this.viewConfig.fullHeight && this.viewConfig.lazyLoadingForFullHeight) {
1262
- window.removeEventListener('resize', this.sendFullHeightLazyLoadData);
1263
- window.removeEventListener('scroll', this.sendFullHeightLazyLoadData, true);
1264
- this.lazyLoadResizeObserver?.disconnect();
1265
- this.lazyLoadResizeObserver = undefined;
1266
- this.lazyLoadScrollContainers.forEach((scrollContainer) => {
1267
- scrollContainer.removeEventListener('scroll', this.sendFullHeightLazyLoadData);
1268
- });
1269
- this.lazyLoadScrollContainers = [];
1270
- }
1051
+ this.fullHeightController?.onRender();
1271
1052
  }
1272
1053
 
1273
1054
  /**
@@ -1299,7 +1080,7 @@ export class LiveboardEmbed extends V1Embed {
1299
1080
  this.viewConfig.personalizedViewId = personalizedViewId;
1300
1081
  if (this.isRendered) {
1301
1082
  this.trigger(HostEvent.Navigate, path.substring(1));
1302
- } else if (this.getPreRenderConfig().preRenderId) {
1083
+ } else if (this.getPreRenderConfig().id) {
1303
1084
  this.preRender(true);
1304
1085
  } else {
1305
1086
  this.render();
@@ -438,6 +438,58 @@ describe('Search embed tests', () => {
438
438
  });
439
439
  });
440
440
 
441
+ test('should set visibility and disable state for Chart Settings V2 menu items', async () => {
442
+ expect(Action.ChartTypeSettings).toBe('CHART_TYPE');
443
+ expect(Action.LayoutSettings).toBe('LAYOUT');
444
+ expect(Action.ColumnSettings).toBe('COLUMN');
445
+ expect(Action.AxisSettings).toBe('AXIS');
446
+ expect(Action.DataLabelSettings).toBe('DATA_LABEL');
447
+ expect(Action.TooltipSettings).toBe('TOOLTIP');
448
+ expect(Action.LegendSettings).toBe('LEGEND');
449
+ expect(Action.DisplaySettings).toBe('DISPLAY');
450
+ expect(Action.QuerySettings).toBe('QUERY_DETAILS');
451
+ expect(Action.CustomSettings).toBe('CUSTOM_ACTION');
452
+ expect(Action.MuzeAiSettings).toBe('MUZE_AI');
453
+ expect(Action.RAnalysisSettings).toBe('R_ANALYSIS');
454
+
455
+ const chartSettingsActions = [
456
+ Action.ChartTypeSettings,
457
+ Action.LayoutSettings,
458
+ Action.ColumnSettings,
459
+ Action.AxisSettings,
460
+ Action.DataLabelSettings,
461
+ Action.TooltipSettings,
462
+ Action.LegendSettings,
463
+ Action.DisplaySettings,
464
+ Action.QuerySettings,
465
+ Action.CustomSettings,
466
+ Action.MuzeAiSettings,
467
+ Action.RAnalysisSettings,
468
+ ];
469
+ const searchEmbed = new SearchEmbed(getRootEl(), {
470
+ hiddenActions: chartSettingsActions,
471
+ disabledActions: chartSettingsActions,
472
+ disabledActionReason: 'Access denied',
473
+ ...defaultViewConfig,
474
+ answerId,
475
+ });
476
+ searchEmbed.render();
477
+ const hideActionUrl = fixedEncodeURI(
478
+ JSON.stringify([
479
+ Action.ReportError,
480
+ ...chartSettingsActions,
481
+ ...HiddenActionItemByDefaultForSearchEmbed,
482
+ ]),
483
+ );
484
+ const disableActionUrl = fixedEncodeURI(JSON.stringify(chartSettingsActions));
485
+ await executeAfterWait(() => {
486
+ expectUrlMatchesWithParams(
487
+ getIFrameSrc(),
488
+ `http://${thoughtSpotHost}/v2/?${defaultParams}&disableAction=${disableActionUrl}&disableHint=Access%20denied&hideAction=${hideActionUrl}&dataSourceMode=expand&useLastSelectedSources=false${prefixParams}#/embed/saved-answer/${answerId}`,
489
+ );
490
+ });
491
+ });
492
+
441
493
  test('should load saved answer', async () => {
442
494
  const searchEmbed = new SearchEmbed(getRootEl(), {
443
495
  ...defaultViewConfig,
@@ -584,6 +636,34 @@ describe('Search embed tests', () => {
584
636
  });
585
637
  });
586
638
 
639
+ test('Should add showAnswerEditPanel flag set to false to the iframe src when hideAnswerEditPanel is true', async () => {
640
+ const searchEmbed = new SearchEmbed(getRootEl(), {
641
+ ...defaultViewConfig,
642
+ hideAnswerEditPanel: true,
643
+ });
644
+ searchEmbed.render();
645
+ await executeAfterWait(() => {
646
+ expectUrlMatchesWithParams(
647
+ getIFrameSrc(),
648
+ `http://${thoughtSpotHost}/v2/?${defaultParamsWithHiddenActions}&showAnswerEditPanel=false&dataSourceMode=expand&useLastSelectedSources=false${prefixParams}#/embed/answer`,
649
+ );
650
+ });
651
+ });
652
+
653
+ test('Should add showAnswerEditPanel flag set to true to the iframe src when hideAnswerEditPanel is false', async () => {
654
+ const searchEmbed = new SearchEmbed(getRootEl(), {
655
+ ...defaultViewConfig,
656
+ hideAnswerEditPanel: false,
657
+ });
658
+ searchEmbed.render();
659
+ await executeAfterWait(() => {
660
+ expectUrlMatchesWithParams(
661
+ getIFrameSrc(),
662
+ `http://${thoughtSpotHost}/v2/?${defaultParamsWithHiddenActions}&showAnswerEditPanel=true&dataSourceMode=expand&useLastSelectedSources=false${prefixParams}#/embed/answer`,
663
+ );
664
+ });
665
+ });
666
+
587
667
  test('should set dataPanelCustomGroupsAccordionInitialState to EXPAND_FIRST when passed', async () => {
588
668
  const searchEmbed = new SearchBarEmbed(getRootEl() as any, {
589
669
  ...defaultViewConfig,
@@ -192,6 +192,22 @@ export interface SearchViewConfig
192
192
  * ```
193
193
  */
194
194
  dataSource?: string;
195
+
196
+ /**
197
+ * If set to `true`, the answer edit panel is hidden.
198
+ *
199
+ * Supported embed types: `SearchEmbed`
200
+ * @version SDK: 1.54.0 | ThoughtSpot Cloud: 26.11.0.cl
201
+ * @example
202
+ * ```js
203
+ * const embed = new SearchEmbed('#tsEmbed', {
204
+ * ... // other embed view config
205
+ * hideAnswerEditPanel: true,
206
+ * })
207
+ * ```
208
+ */
209
+ hideAnswerEditPanel?: boolean;
210
+
195
211
  /**
196
212
  * The initial search query to load the answer with.
197
213
  * Use {@link searchOptions} instead.
@@ -443,6 +459,7 @@ export class SearchEmbed extends TsEmbed {
443
459
  collapseSearchBar = true,
444
460
  isThisPeriodInDateFiltersEnabled,
445
461
  newChartsLibrary,
462
+ hideAnswerEditPanel,
446
463
  } = this.viewConfig;
447
464
  const queryParams = this.getBaseQueryParams();
448
465
 
@@ -470,6 +487,9 @@ export class SearchEmbed extends TsEmbed {
470
487
  if (enableSearchAssist) {
471
488
  queryParams[Param.EnableSearchAssist] = true;
472
489
  }
490
+ if (hideAnswerEditPanel !== undefined) {
491
+ queryParams[Param.ShowAnswerEditPanel] = !hideAnswerEditPanel;
492
+ }
473
493
  if (hideResults) {
474
494
  queryParams[Param.HideResult] = true;
475
495
  }