@thoughtspot/visual-embed-sdk 1.41.1 → 1.42.1-alpha.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 (216) hide show
  1. package/cjs/package.json +9 -9
  2. package/cjs/src/api-intercept.d.ts +25 -0
  3. package/cjs/src/api-intercept.d.ts.map +1 -0
  4. package/cjs/src/api-intercept.js +115 -0
  5. package/cjs/src/api-intercept.js.map +1 -0
  6. package/cjs/src/css-variables.d.ts +52 -14
  7. package/cjs/src/css-variables.d.ts.map +1 -1
  8. package/cjs/src/embed/app.d.ts.map +1 -1
  9. package/cjs/src/embed/app.js +7 -2
  10. package/cjs/src/embed/app.js.map +1 -1
  11. package/cjs/src/embed/app.spec.js +20 -0
  12. package/cjs/src/embed/app.spec.js.map +1 -1
  13. package/cjs/src/embed/bodyless-conversation.d.ts +1 -0
  14. package/cjs/src/embed/bodyless-conversation.d.ts.map +1 -1
  15. package/cjs/src/embed/bodyless-conversation.js +7 -3
  16. package/cjs/src/embed/bodyless-conversation.js.map +1 -1
  17. package/cjs/src/embed/conversation.d.ts +1 -0
  18. package/cjs/src/embed/conversation.d.ts.map +1 -1
  19. package/cjs/src/embed/conversation.js +7 -2
  20. package/cjs/src/embed/conversation.js.map +1 -1
  21. package/cjs/src/embed/hostEventClient/contracts.d.ts +11 -1
  22. package/cjs/src/embed/hostEventClient/contracts.d.ts.map +1 -1
  23. package/cjs/src/embed/hostEventClient/contracts.js +1 -0
  24. package/cjs/src/embed/hostEventClient/contracts.js.map +1 -1
  25. package/cjs/src/embed/liveboard.d.ts +1 -0
  26. package/cjs/src/embed/liveboard.d.ts.map +1 -1
  27. package/cjs/src/embed/liveboard.js +10 -2
  28. package/cjs/src/embed/liveboard.js.map +1 -1
  29. package/cjs/src/embed/liveboard.spec.js +35 -0
  30. package/cjs/src/embed/liveboard.spec.js.map +1 -1
  31. package/cjs/src/embed/sage.d.ts +1 -0
  32. package/cjs/src/embed/sage.d.ts.map +1 -1
  33. package/cjs/src/embed/sage.js +10 -6
  34. package/cjs/src/embed/sage.js.map +1 -1
  35. package/cjs/src/embed/search-bar.d.ts +1 -0
  36. package/cjs/src/embed/search-bar.d.ts.map +1 -1
  37. package/cjs/src/embed/search-bar.js +11 -7
  38. package/cjs/src/embed/search-bar.js.map +1 -1
  39. package/cjs/src/embed/search.d.ts +1 -0
  40. package/cjs/src/embed/search.d.ts.map +1 -1
  41. package/cjs/src/embed/search.js +10 -9
  42. package/cjs/src/embed/search.js.map +1 -1
  43. package/cjs/src/embed/ts-embed.d.ts +21 -4
  44. package/cjs/src/embed/ts-embed.d.ts.map +1 -1
  45. package/cjs/src/embed/ts-embed.js +115 -34
  46. package/cjs/src/embed/ts-embed.js.map +1 -1
  47. package/cjs/src/embed/ts-embed.spec.js +83 -0
  48. package/cjs/src/embed/ts-embed.spec.js.map +1 -1
  49. package/cjs/src/errors.d.ts +1 -0
  50. package/cjs/src/errors.d.ts.map +1 -1
  51. package/cjs/src/errors.js +1 -0
  52. package/cjs/src/errors.js.map +1 -1
  53. package/cjs/src/index.d.ts +2 -2
  54. package/cjs/src/index.d.ts.map +1 -1
  55. package/cjs/src/index.js +2 -1
  56. package/cjs/src/index.js.map +1 -1
  57. package/cjs/src/react/all-types-export.d.ts +1 -1
  58. package/cjs/src/react/all-types-export.d.ts.map +1 -1
  59. package/cjs/src/react/all-types-export.js +2 -1
  60. package/cjs/src/react/all-types-export.js.map +1 -1
  61. package/cjs/src/react/all-types-export.spec.js +1 -1
  62. package/cjs/src/react/all-types-export.spec.js.map +1 -1
  63. package/cjs/src/react/util.js.map +1 -1
  64. package/cjs/src/react/util.spec.d.ts +2 -0
  65. package/cjs/src/react/util.spec.d.ts.map +1 -0
  66. package/cjs/src/react/util.spec.js +78 -0
  67. package/cjs/src/react/util.spec.js.map +1 -0
  68. package/cjs/src/types.d.ts +135 -8
  69. package/cjs/src/types.d.ts.map +1 -1
  70. package/cjs/src/types.js +73 -4
  71. package/cjs/src/types.js.map +1 -1
  72. package/cjs/src/utils/processData.d.ts +1 -1
  73. package/cjs/src/utils/processData.d.ts.map +1 -1
  74. package/cjs/src/utils/processData.js +8 -8
  75. package/cjs/src/utils/processData.js.map +1 -1
  76. package/dist/index-BEzW4MDA.js +7371 -0
  77. package/dist/{index-DQueHwfQ.js → index-DvNA626T.js} +1 -1
  78. package/dist/src/api-intercept.d.ts +25 -0
  79. package/dist/src/api-intercept.d.ts.map +1 -0
  80. package/dist/src/css-variables.d.ts +52 -14
  81. package/dist/src/css-variables.d.ts.map +1 -1
  82. package/dist/src/embed/app.d.ts.map +1 -1
  83. package/dist/src/embed/bodyless-conversation.d.ts +1 -0
  84. package/dist/src/embed/bodyless-conversation.d.ts.map +1 -1
  85. package/dist/src/embed/conversation.d.ts +1 -0
  86. package/dist/src/embed/conversation.d.ts.map +1 -1
  87. package/dist/src/embed/hostEventClient/contracts.d.ts +11 -1
  88. package/dist/src/embed/hostEventClient/contracts.d.ts.map +1 -1
  89. package/dist/src/embed/liveboard.d.ts +1 -0
  90. package/dist/src/embed/liveboard.d.ts.map +1 -1
  91. package/dist/src/embed/sage.d.ts +1 -0
  92. package/dist/src/embed/sage.d.ts.map +1 -1
  93. package/dist/src/embed/search-bar.d.ts +1 -0
  94. package/dist/src/embed/search-bar.d.ts.map +1 -1
  95. package/dist/src/embed/search.d.ts +1 -0
  96. package/dist/src/embed/search.d.ts.map +1 -1
  97. package/dist/src/embed/ts-embed.d.ts +21 -4
  98. package/dist/src/embed/ts-embed.d.ts.map +1 -1
  99. package/dist/src/errors.d.ts +1 -0
  100. package/dist/src/errors.d.ts.map +1 -1
  101. package/dist/src/index.d.ts +2 -2
  102. package/dist/src/index.d.ts.map +1 -1
  103. package/dist/src/react/all-types-export.d.ts +1 -1
  104. package/dist/src/react/all-types-export.d.ts.map +1 -1
  105. package/dist/src/react/util.spec.d.ts +2 -0
  106. package/dist/src/react/util.spec.d.ts.map +1 -0
  107. package/dist/src/types.d.ts +135 -8
  108. package/dist/src/types.d.ts.map +1 -1
  109. package/dist/src/utils/processData.d.ts +1 -1
  110. package/dist/src/utils/processData.d.ts.map +1 -1
  111. package/dist/tsembed-react.es.js +370 -90
  112. package/dist/tsembed-react.js +369 -89
  113. package/dist/tsembed.es.js +371 -91
  114. package/dist/tsembed.js +369 -89
  115. package/dist/visual-embed-sdk-react-full.d.ts +9431 -9915
  116. package/dist/visual-embed-sdk-react.d.ts +9301 -9922
  117. package/dist/visual-embed-sdk.d.ts +9470 -9532
  118. package/lib/package.json +9 -9
  119. package/lib/src/api-intercept.d.ts +25 -0
  120. package/lib/src/api-intercept.d.ts.map +1 -0
  121. package/lib/src/api-intercept.js +108 -0
  122. package/lib/src/api-intercept.js.map +1 -0
  123. package/lib/src/css-variables.d.ts +52 -14
  124. package/lib/src/css-variables.d.ts.map +1 -1
  125. package/lib/src/embed/app.d.ts.map +1 -1
  126. package/lib/src/embed/app.js +7 -2
  127. package/lib/src/embed/app.js.map +1 -1
  128. package/lib/src/embed/app.spec.js +20 -0
  129. package/lib/src/embed/app.spec.js.map +1 -1
  130. package/lib/src/embed/bodyless-conversation.d.ts +1 -0
  131. package/lib/src/embed/bodyless-conversation.d.ts.map +1 -1
  132. package/lib/src/embed/bodyless-conversation.js +7 -3
  133. package/lib/src/embed/bodyless-conversation.js.map +1 -1
  134. package/lib/src/embed/conversation.d.ts +1 -0
  135. package/lib/src/embed/conversation.d.ts.map +1 -1
  136. package/lib/src/embed/conversation.js +7 -2
  137. package/lib/src/embed/conversation.js.map +1 -1
  138. package/lib/src/embed/hostEventClient/contracts.d.ts +11 -1
  139. package/lib/src/embed/hostEventClient/contracts.d.ts.map +1 -1
  140. package/lib/src/embed/hostEventClient/contracts.js +1 -0
  141. package/lib/src/embed/hostEventClient/contracts.js.map +1 -1
  142. package/lib/src/embed/liveboard.d.ts +1 -0
  143. package/lib/src/embed/liveboard.d.ts.map +1 -1
  144. package/lib/src/embed/liveboard.js +10 -2
  145. package/lib/src/embed/liveboard.js.map +1 -1
  146. package/lib/src/embed/liveboard.spec.js +35 -0
  147. package/lib/src/embed/liveboard.spec.js.map +1 -1
  148. package/lib/src/embed/sage.d.ts +1 -0
  149. package/lib/src/embed/sage.d.ts.map +1 -1
  150. package/lib/src/embed/sage.js +10 -6
  151. package/lib/src/embed/sage.js.map +1 -1
  152. package/lib/src/embed/search-bar.d.ts +1 -0
  153. package/lib/src/embed/search-bar.d.ts.map +1 -1
  154. package/lib/src/embed/search-bar.js +11 -7
  155. package/lib/src/embed/search-bar.js.map +1 -1
  156. package/lib/src/embed/search.d.ts +1 -0
  157. package/lib/src/embed/search.d.ts.map +1 -1
  158. package/lib/src/embed/search.js +10 -9
  159. package/lib/src/embed/search.js.map +1 -1
  160. package/lib/src/embed/ts-embed.d.ts +21 -4
  161. package/lib/src/embed/ts-embed.d.ts.map +1 -1
  162. package/lib/src/embed/ts-embed.js +115 -34
  163. package/lib/src/embed/ts-embed.js.map +1 -1
  164. package/lib/src/embed/ts-embed.spec.js +83 -0
  165. package/lib/src/embed/ts-embed.spec.js.map +1 -1
  166. package/lib/src/errors.d.ts +1 -0
  167. package/lib/src/errors.d.ts.map +1 -1
  168. package/lib/src/errors.js +1 -0
  169. package/lib/src/errors.js.map +1 -1
  170. package/lib/src/index.d.ts +2 -2
  171. package/lib/src/index.d.ts.map +1 -1
  172. package/lib/src/index.js +2 -2
  173. package/lib/src/index.js.map +1 -1
  174. package/lib/src/react/all-types-export.d.ts +1 -1
  175. package/lib/src/react/all-types-export.d.ts.map +1 -1
  176. package/lib/src/react/all-types-export.js +1 -1
  177. package/lib/src/react/all-types-export.js.map +1 -1
  178. package/lib/src/react/all-types-export.spec.js +1 -1
  179. package/lib/src/react/all-types-export.spec.js.map +1 -1
  180. package/lib/src/react/util.js.map +1 -1
  181. package/lib/src/react/util.spec.d.ts +2 -0
  182. package/lib/src/react/util.spec.d.ts.map +1 -0
  183. package/lib/src/react/util.spec.js +76 -0
  184. package/lib/src/react/util.spec.js.map +1 -0
  185. package/lib/src/types.d.ts +135 -8
  186. package/lib/src/types.d.ts.map +1 -1
  187. package/lib/src/types.js +72 -3
  188. package/lib/src/types.js.map +1 -1
  189. package/lib/src/utils/processData.d.ts +1 -1
  190. package/lib/src/utils/processData.d.ts.map +1 -1
  191. package/lib/src/utils/processData.js +8 -8
  192. package/lib/src/utils/processData.js.map +1 -1
  193. package/package.json +9 -9
  194. package/src/api-intercept.ts +134 -0
  195. package/src/css-variables.ts +53 -16
  196. package/src/embed/app.spec.ts +28 -0
  197. package/src/embed/app.ts +9 -1
  198. package/src/embed/bodyless-conversation.ts +8 -3
  199. package/src/embed/conversation.ts +17 -2
  200. package/src/embed/hostEventClient/contracts.ts +10 -0
  201. package/src/embed/liveboard.spec.ts +44 -0
  202. package/src/embed/liveboard.ts +12 -1
  203. package/src/embed/sage.ts +14 -9
  204. package/src/embed/search-bar.tsx +14 -7
  205. package/src/embed/search.ts +21 -8
  206. package/src/embed/ts-embed.spec.ts +116 -5
  207. package/src/embed/ts-embed.ts +152 -50
  208. package/src/errors.ts +1 -0
  209. package/src/index.ts +2 -0
  210. package/src/react/all-types-export.spec.ts +1 -1
  211. package/src/react/all-types-export.ts +1 -0
  212. package/src/react/util.spec.tsx +88 -0
  213. package/src/react/util.ts +3 -3
  214. package/src/types.ts +195 -64
  215. package/src/utils/processData.ts +11 -11
  216. package/lib/src/visual-embed-sdk.d.ts +0 -9779
@@ -1,4 +1,4 @@
1
- /* @thoughtspot/visual-embed-sdk version 1.41.1 */
1
+ /* @thoughtspot/visual-embed-sdk version 1.42.1-alpha.1 */
2
2
  'use client';
3
3
  function _mergeNamespaces(n, m) {
4
4
  m.forEach(function (e) {
@@ -1999,6 +1999,21 @@ var EmbedEvent;
1999
1999
  * @version SDK: 1.41.0 | ThoughtSpot: 10.12.0.cl
2000
2000
  */
2001
2001
  EmbedEvent["OrgSwitched"] = "orgSwitched";
2002
+ /**
2003
+ * Emitted when the user intercepts a URL.
2004
+ *
2005
+ * Supported on all embed types.
2006
+ *
2007
+ * @example
2008
+ * ```js
2009
+ * embed.on(EmbedEvent.ApiIntercept, (payload) => {
2010
+ * console.log('payload', payload);
2011
+ * })
2012
+ * ```
2013
+ *
2014
+ * @version SDK: 1.42.0 | ThoughtSpot: 10.14.0.cl
2015
+ */
2016
+ EmbedEvent["ApiIntercept"] = "ApiIntercept";
2002
2017
  })(EmbedEvent || (EmbedEvent = {}));
2003
2018
  /**
2004
2019
  * Event types that can be triggered by the host application
@@ -2764,21 +2779,42 @@ var HostEvent;
2764
2779
  */
2765
2780
  HostEvent["Share"] = "share";
2766
2781
  /**
2767
- * Trigger the **Save** action on a Liveboard or Answer.
2782
+ * Trigger the **Save** action on a Liveboard, Answer, or Spotter.
2768
2783
  * Saves the changes.
2769
- * @param - `vizId` refers to the Answer ID in Spotter embed and is required in Spotter embed.
2784
+ *
2785
+ * @param - `vizId` refers to the Spotter Visualization Id used in Spotter embed.
2786
+ * It is required and can be retrieved from the data embed event.
2787
+ *
2770
2788
  * @example
2771
2789
  * ```js
2790
+ * // Save changes in a Liveboard
2772
2791
  * liveboardEmbed.trigger(HostEvent.Save)
2773
2792
  * ```
2793
+ *
2774
2794
  * ```js
2795
+ * // Save the current Answer in Search embed
2775
2796
  * searchEmbed.trigger(HostEvent.Save)
2776
2797
  * ```
2798
+ *
2777
2799
  * ```js
2800
+ * // Save an Answer in Spotter (requires vizId)
2778
2801
  * spotterEmbed.trigger(HostEvent.Save, {
2779
- * vizId:"730496d6-6903-4601-937e-2c691821af3c"
2802
+ * vizId: "730496d6-6903-4601-937e-2c691821af3c"
2780
2803
  * })
2781
2804
  * ```
2805
+ *
2806
+ * ```js
2807
+ * // How to get the vizId in Spotter?
2808
+ *
2809
+ * // You can use the Data event dispatched on each answer creation to get the vizId.
2810
+ * let latestSpotterVizId = '';
2811
+ * spotterEmbed.on(EmbedEvent.Data, (payload) => {
2812
+ * latestSpotterVizId = payload.data.id;
2813
+ * });
2814
+ *
2815
+ * spotterEmbed.trigger(HostEvent.Save, { vizId: latestSpotterVizId });
2816
+ * ```
2817
+ *
2782
2818
  * @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1.sw
2783
2819
  */
2784
2820
  HostEvent["Save"] = "save";
@@ -3262,6 +3298,16 @@ var HostEvent;
3262
3298
  * @version SDK: 1.41.0 | ThoughtSpot: 10.12.0.cl
3263
3299
  */
3264
3300
  HostEvent["AskSpotter"] = "AskSpotter";
3301
+ /**
3302
+ * @hidden
3303
+ * Triggers the update of the embed params.
3304
+ *
3305
+ * @example
3306
+ * ```js
3307
+ * liveboardEmbed.trigger(HostEvent.UpdateEmbedParams, viewConfig);
3308
+ * ```
3309
+ */
3310
+ HostEvent["UpdateEmbedParams"] = "updateEmbedParams";
3265
3311
  })(HostEvent || (HostEvent = {}));
3266
3312
  /**
3267
3313
  * The different visual modes that the data sources panel within
@@ -3409,6 +3455,7 @@ var Param;
3409
3455
  Param["RootMarginForLazyLoad"] = "rootMarginForLazyLoad";
3410
3456
  Param["LiveboardXLSXCSVDownload"] = "isLiveboardXLSXCSVDownloadEnabled";
3411
3457
  Param["isPNGInScheduledEmailsEnabled"] = "isPNGInScheduledEmailsEnabled";
3458
+ Param["isLinkParametersEnabled"] = "isLinkParametersEnabled";
3412
3459
  })(Param || (Param = {}));
3413
3460
  /**
3414
3461
  * ThoughtSpot application pages include actions and menu commands
@@ -4834,7 +4881,29 @@ var LogLevel;
4834
4881
  * @version SDK: 1.26.7 | ThoughtSpot Cloud: 9.10.0.cl
4835
4882
  */
4836
4883
  LogLevel["TRACE"] = "TRACE";
4837
- })(LogLevel || (LogLevel = {}));
4884
+ })(LogLevel || (LogLevel = {}));
4885
+ /**
4886
+ * Enum for the type of API intercepted
4887
+ */
4888
+ var InterceptedApiType;
4889
+ (function (InterceptedApiType) {
4890
+ /**
4891
+ * The apis that are use to get the metadata for the embed
4892
+ */
4893
+ InterceptedApiType["METADATA"] = "METADATA";
4894
+ /**
4895
+ * The apis that are use to get the data for the embed
4896
+ */
4897
+ InterceptedApiType["ANSWER_DATA"] = "ANSWER_DATA";
4898
+ /**
4899
+ * This will intercept all the apis
4900
+ */
4901
+ InterceptedApiType["ALL"] = "ALL";
4902
+ /**
4903
+ * The apis that are use to get the data for the liveboard
4904
+ */
4905
+ InterceptedApiType["LIVEBOARD_DATA"] = "LIVEBOARD_DATA";
4906
+ })(InterceptedApiType || (InterceptedApiType = {}));
4838
4907
 
4839
4908
  const logFunctions = {
4840
4909
  [LogLevel.SILENT]: () => undefined,
@@ -7180,6 +7249,17 @@ function isEmpty(value) {
7180
7249
 
7181
7250
  var isEmpty_1 = isEmpty;
7182
7251
 
7252
+ var UIPassthroughEvent;
7253
+ (function (UIPassthroughEvent) {
7254
+ UIPassthroughEvent["PinAnswerToLiveboard"] = "addVizToPinboard";
7255
+ UIPassthroughEvent["SaveAnswer"] = "saveAnswer";
7256
+ UIPassthroughEvent["GetDiscoverabilityStatus"] = "getDiscoverabilityStatus";
7257
+ UIPassthroughEvent["GetAvailableUIPassthroughs"] = "getAvailableUiPassthroughs";
7258
+ UIPassthroughEvent["GetAnswerConfig"] = "getAnswerPageConfig";
7259
+ UIPassthroughEvent["GetLiveboardConfig"] = "getPinboardPageConfig";
7260
+ UIPassthroughEvent["GetUnsavedAnswerTML"] = "getUnsavedAnswerTML";
7261
+ })(UIPassthroughEvent || (UIPassthroughEvent = {}));
7262
+
7183
7263
  const ERROR_MESSAGE = {
7184
7264
  INVALID_THOUGHTSPOT_HOST: 'Error parsing ThoughtSpot host. Please provide a valid URL.',
7185
7265
  SPOTTER_EMBED_WORKSHEED_ID_NOT_FOUND: 'Please select a worksheet to get started',
@@ -7201,6 +7281,7 @@ const ERROR_MESSAGE = {
7201
7281
  MISSING_REPORTING_OBSERVER: 'ReportingObserver not supported',
7202
7282
  RENDER_CALLED_BEFORE_INIT: 'Looks like render was called before calling init, the render won\'t start until init is called.\nFor more info check\n1. https://developers.thoughtspot.com/docs/Function_init#_init\n2.https://developers.thoughtspot.com/docs/getting-started#initSdk',
7203
7283
  SPOTTER_AGENT_NOT_INITIALIZED: 'SpotterAgent not initialized',
7284
+ OFFLINE_WARNING: 'Network not Detected. Embed is offline. Please reconnect and refresh',
7204
7285
  };
7205
7286
  const CUSTOM_ACTIONS_ERROR_MESSAGE = {
7206
7287
  INVALID_ACTION_OBJECT: 'Custom Action Validation Error: Invalid action object provided',
@@ -8110,7 +8191,7 @@ class AnswerService {
8110
8191
  async getTML() {
8111
8192
  const { object } = await this.executeQuery(getAnswerTML, {});
8112
8193
  const edoc = object[0].edoc;
8113
- const YAML = await import('./index-DQueHwfQ.js');
8194
+ const YAML = await import('./index-BEzW4MDA.js');
8114
8195
  const parsedDoc = YAML.parse(edoc);
8115
8196
  return {
8116
8197
  answer: {
@@ -17429,27 +17510,27 @@ function processAuthLogout(e, containerEl) {
17429
17510
  * @param thoughtSpotHost
17430
17511
  * @param containerEl
17431
17512
  */
17432
- function processEventData(type, e, thoughtSpotHost, containerEl) {
17513
+ function processEventData(type, eventData, thoughtSpotHost, containerEl) {
17433
17514
  switch (type) {
17434
17515
  case EmbedEvent.CustomAction:
17435
- return processCustomAction(e, thoughtSpotHost);
17516
+ return processCustomAction(eventData, thoughtSpotHost);
17436
17517
  case EmbedEvent.AuthInit:
17437
- return processAuthInit(e);
17518
+ return processAuthInit(eventData);
17438
17519
  case EmbedEvent.NoCookieAccess:
17439
- return processNoCookieAccess(e, containerEl);
17520
+ return processNoCookieAccess(eventData, containerEl);
17440
17521
  case EmbedEvent.AuthFailure:
17441
- return processAuthFailure(e, containerEl);
17522
+ return processAuthFailure(eventData, containerEl);
17442
17523
  case EmbedEvent.AuthLogout:
17443
- return processAuthLogout(e, containerEl);
17524
+ return processAuthLogout(eventData, containerEl);
17444
17525
  case EmbedEvent.ExitPresentMode:
17445
17526
  return processExitPresentMode();
17446
17527
  case EmbedEvent.CLEAR_INFO_CACHE:
17447
17528
  return processClearInfoCache();
17448
17529
  }
17449
- return e;
17530
+ return eventData;
17450
17531
  }
17451
17532
 
17452
- var name="@thoughtspot/visual-embed-sdk";var version$1="1.41.1";var description="ThoughtSpot Embed SDK";var module="lib/src/index.js";var main="dist/tsembed.js";var types="lib/src/index.d.ts";var files=["dist/**","lib/**","src/**","cjs/**"];var exports={".":{"import":"./lib/src/index.js",require:"./cjs/src/index.js",types:"./lib/src/index.d.ts"},"./react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"},"./lib/src/react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"}};var typesVersions={"*":{react:["./lib/src/react/all-types-export.d.ts"]}};var scripts={lint:"eslint 'src/**'","lint:fix":"eslint 'src/**/*.*' --fix",tsc:"tsc -p . --incremental false; tsc -p . --incremental false --module commonjs --outDir cjs","build-and-publish":"npm run build:gatsby && npm run publish","bundle-dts-file":"dts-bundle --name @thoughtspot/visual-embed-sdk --out visual-embed-sdk.d.ts --main lib/src/index.d.ts","bundle-dts":"dts-bundle --name ../../dist/visual-embed-sdk --main lib/src/index.d.ts --outputAsModuleFolder=true","bundle-dts-react":"dts-bundle --name ../../../dist/visual-embed-sdk-react --main lib/src/react/index.d.ts --outputAsModuleFolder=true","bundle-dts-react-full":"dts-bundle --name ../../../dist/visual-embed-sdk-react-full --main lib/src/react/all-types-export.d.ts --outputAsModuleFolder=true",build:"rollup -c",watch:"rollup -cw",docgen:"typedoc --tsconfig tsconfig.json --theme typedoc-theme --json static/typedoc/typedoc.json --disableOutputCheck","test-sdk":"jest -c jest.config.sdk.js --runInBand",test:"npm run test-sdk",posttest:"cat ./coverage/sdk/lcov.info | npx coveralls-next","is-publish-allowed":"node scripts/is-publish-allowed.js",prepublishOnly:"npm run is-publish-allowed && npm run test && npm run tsc && npm run bundle-dts-file && npm run bundle-dts && npm run bundle-dts-react && npm run bundle-dts-react-full && npm run build","check-size":"npm run build && size-limit","publish-dev":"npm publish --tag dev","publish-prod":"npm publish --tag latest",dev:"vite -c vite.local.config.ts"};var peerDependencies={react:"> 16.8.0","react-dom":"> 16.8.0"};var dependencies={classnames:"^2.3.1",eventemitter3:"^4.0.7",lodash:"^4.17.21","mixpanel-browser":"2.47.0","ts-deepmerge":"^6.0.2",tslib:"^2.5.3","use-deep-compare-effect":"^1.8.1",yaml:"^2.5.1"};var devDependencies={"@mdx-js/mdx":"^1.6.22","@mdx-js/react":"^1.6.22","@react-icons/all-files":"^4.1.0","@rollup/plugin-commonjs":"^18.0.0","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^11.2.1","@rollup/plugin-replace":"^5.0.2","@size-limit/preset-big-lib":"^11.2.0","@testing-library/dom":"^7.31.0","@testing-library/jest-dom":"^5.14.1","@testing-library/react":"^11.2.7","@testing-library/user-event":"^13.1.8","@types/jest":"^22.2.3","@types/lodash":"^4.17.0","@types/mixpanel-browser":"^2.35.6","@types/react-test-renderer":"^17.0.1","@typescript-eslint/eslint-plugin":"^8.28.0","@typescript-eslint/parser":"^8.28.0",ajv:"^8.17.1",asciidoctor:"^2.2.1","babel-jest":"^26.6.3","babel-preset-gatsby":"^1.10.0","command-line-args":"^5.1.1","coveralls-next":"^5.0.0",crypto:"^1.0.1","current-git-branch":"^1.1.0","dts-bundle":"^0.7.3",eslint:"^9.23.0","eslint-config-airbnb-base":"^15.0.0","eslint-config-prettier":"^10.1.1","eslint-import-resolver-typescript":"^4.2.5","eslint-plugin-comment-length":"2.2.1","eslint-plugin-import":"^2.31.0","eslint-plugin-jsdoc":"^50.6.9","eslint-plugin-prettier":"^5.2.5","eslint-plugin-react":"^7.37.5","eslint-plugin-react-hooks":"^5.2.0","fs-extra":"^10.0.0","gh-pages":"6.3.0",globals:"^16.0.0","highlight.js":"^10.6.0","html-to-text":"^8.0.0","identity-obj-proxy":"^3.0.0","istanbul-merge":"^2.0.0",jest:"^26.6.3","jest-fetch-mock":"^3.0.3",jsdom:"^17.0.0",prettier:"2.1.2",react:"^16.14.0","react-dom":"^16.14.0","react-resizable":"^1.11.0","react-resize-detector":"^6.6.0","react-test-renderer":"^17.0.2","react-use-flexsearch":"^0.1.1",rollup:"4.24.0","rollup-plugin-typescript2":"0.27.3","ts-jest":"^26.5.5","ts-loader":"8.0.4",typedoc:"0.21.6","typedoc-plugin-toc-group":"thoughtspot/typedoc-plugin-toc-group",typescript:"^4.9.4","typescript-eslint":"^8.29.1","url-search-params-polyfill":"^8.1.0",util:"^0.12.4",vite:"^6.3.5"};var author="ThoughtSpot";var email="support@thoughtspot.com";var license="ThoughtSpot Development Tools End User License Agreement";var directories={lib:"lib"};var repository={type:"git",url:"git+https://github.com/thoughtspot/visual-embed-sdk.git"};var publishConfig={registry:"https://registry.npmjs.org"};var keywords=["thoughtspot","everywhere","embedded","embed","sdk","analytics"];var bugs={url:"https://github.com/thoughtspot/visual-embed-sdk/issues"};var homepage="https://github.com/thoughtspot/visual-embed-sdk#readme";var globals={window:{}};var pkgInfo = {name:name,version:version$1,description:description,module:module,main:main,types:types,files:files,exports:exports,typesVersions:typesVersions,"size-limit":[{path:"dist/tsembed.es.js",limit:"32 kB"}],scripts:scripts,peerDependencies:peerDependencies,dependencies:dependencies,devDependencies:devDependencies,author:author,email:email,license:license,directories:directories,repository:repository,publishConfig:publishConfig,keywords:keywords,bugs:bugs,homepage:homepage,globals:globals};
17533
+ var name="@thoughtspot/visual-embed-sdk";var version$1="1.42.1-alpha.1";var description="ThoughtSpot Embed SDK";var module="lib/src/index.js";var main="dist/tsembed.js";var types="lib/src/index.d.ts";var files=["dist/**","lib/**","src/**","cjs/**"];var exports={".":{"import":"./lib/src/index.js",require:"./cjs/src/index.js",types:"./lib/src/index.d.ts"},"./react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"},"./lib/src/react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"}};var typesVersions={"*":{react:["./lib/src/react/all-types-export.d.ts"]}};var scripts={lint:"eslint 'src/**'","lint:fix":"eslint 'src/**/*.*' --fix",tsc:"tsc -p tsconfig.build.json --incremental false; tsc -p tsconfig.build.json --incremental false --module commonjs --outDir cjs","build-and-publish":"npm run build:gatsby && npm run publish","bundle-dts-file":"dts-bundle-generator --config ./dts-config/dts-bundle-file.config.js","bundle-dts":"dts-bundle-generator --config ./dts-config/dts-bundle.config.js","bundle-dts-react":"dts-bundle-generator --config ./dts-config/dts-bundle-react.config.js","bundle-dts-react-full":"dts-bundle-generator --config ./dts-config/dts-bundle-react-full.config.js",build:"rollup -c",watch:"rollup -cw",docgen:"typedoc --tsconfig tsconfig.build.json --theme typedoc-theme --json static/typedoc/typedoc.json --disableOutputCheck","test-sdk":"jest -c jest.config.sdk.js --runInBand",test:"npm run test-sdk",posttest:"cat ./coverage/sdk/lcov.info | npx coveralls-next","is-publish-allowed":"node scripts/is-publish-allowed.js",prepublishOnly:"npm run tsc && npm run bundle-dts-file && npm run bundle-dts && npm run bundle-dts-react && npm run bundle-dts-react-full && npm run build","check-size":"npm run build && size-limit","publish-dev":"npm publish --tag dev","publish-prod":"npm publish --tag latest",dev:"vite -c vite.local.config.ts"};var peerDependencies={react:"> 16.8.0","react-dom":"> 16.8.0"};var dependencies={classnames:"^2.3.1",eventemitter3:"^4.0.7",lodash:"^4.17.21","mixpanel-browser":"2.47.0","ts-deepmerge":"^6.0.2",tslib:"^2.5.3","use-deep-compare-effect":"^1.8.1",yaml:"^2.5.1"};var devDependencies={"@mdx-js/mdx":"^1.6.22","@mdx-js/react":"^1.6.22","@react-icons/all-files":"^4.1.0","@rollup/plugin-commonjs":"^18.0.0","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^11.2.1","@rollup/plugin-replace":"^5.0.2","@size-limit/preset-big-lib":"^11.2.0","@testing-library/dom":"^7.31.0","@testing-library/jest-dom":"^5.14.1","@testing-library/react":"^11.2.7","@testing-library/user-event":"^13.1.8","@types/jest":"^22.2.3","@types/lodash":"^4.17.0","@types/mixpanel-browser":"^2.35.6","@types/react-test-renderer":"^17.0.1","@typescript-eslint/eslint-plugin":"^8.28.0","@typescript-eslint/parser":"^8.28.0",ajv:"^8.17.1",asciidoctor:"^2.2.1","babel-jest":"^26.6.3","babel-preset-gatsby":"^1.10.0","command-line-args":"^5.1.1","coveralls-next":"^5.0.0",crypto:"^1.0.1","current-git-branch":"^1.1.0","dts-bundle-generator":"^9.5.1",eslint:"^9.23.0","eslint-config-airbnb-base":"^15.0.0","eslint-config-prettier":"^10.1.1","eslint-import-resolver-typescript":"^4.2.5","eslint-plugin-comment-length":"2.2.1","eslint-plugin-import":"^2.31.0","eslint-plugin-jsdoc":"^50.6.9","eslint-plugin-prettier":"^5.2.5","eslint-plugin-react":"^7.37.5","eslint-plugin-react-hooks":"^5.2.0","fs-extra":"^10.0.0","gh-pages":"6.3.0",globals:"^16.0.0","highlight.js":"^10.6.0","html-to-text":"^8.0.0","identity-obj-proxy":"^3.0.0","istanbul-merge":"^2.0.0",jest:"^26.6.3","jest-fetch-mock":"^3.0.3",jsdom:"^17.0.0",prettier:"2.1.2",react:"^16.14.0","react-dom":"^16.14.0","react-resizable":"^1.11.0","react-resize-detector":"^6.6.0","react-test-renderer":"^17.0.2","react-use-flexsearch":"^0.1.1",rollup:"4.24.0","rollup-plugin-typescript2":"0.27.3","ts-jest":"^26.5.5","ts-loader":"8.0.4",typedoc:"0.21.6","typedoc-plugin-toc-group":"thoughtspot/typedoc-plugin-toc-group",typescript:"^4.9.4","typescript-eslint":"^8.29.1","url-search-params-polyfill":"^8.1.0",util:"^0.12.4",vite:"^6.3.5"};var author="ThoughtSpot";var email="support@thoughtspot.com";var license="ThoughtSpot Development Tools End User License Agreement";var directories={lib:"lib"};var repository={type:"git",url:"git+https://github.com/thoughtspot/visual-embed-sdk.git"};var publishConfig={registry:"https://registry.npmjs.org"};var keywords=["thoughtspot","everywhere","embedded","embed","sdk","analytics"];var bugs={url:"https://github.com/thoughtspot/visual-embed-sdk/issues"};var homepage="https://github.com/thoughtspot/visual-embed-sdk#readme";var globals={window:{}};var pkgInfo = {name:name,version:version$1,description:description,module:module,main:main,types:types,files:files,exports:exports,typesVersions:typesVersions,"size-limit":[{path:"dist/tsembed.es.js",limit:"32 kB"}],scripts:scripts,peerDependencies:peerDependencies,dependencies:dependencies,devDependencies:devDependencies,author:author,email:email,license:license,directories:directories,repository:repository,publishConfig:publishConfig,keywords:keywords,bugs:bugs,homepage:homepage,globals:globals};
17453
17534
 
17454
17535
  /**
17455
17536
  * Reloads the ThoughtSpot iframe.
@@ -17521,16 +17602,6 @@ function processTrigger(iFrame, messageType, thoughtSpotHost, data) {
17521
17602
  });
17522
17603
  }
17523
17604
 
17524
- var UIPassthroughEvent;
17525
- (function (UIPassthroughEvent) {
17526
- UIPassthroughEvent["PinAnswerToLiveboard"] = "addVizToPinboard";
17527
- UIPassthroughEvent["SaveAnswer"] = "saveAnswer";
17528
- UIPassthroughEvent["GetDiscoverabilityStatus"] = "getDiscoverabilityStatus";
17529
- UIPassthroughEvent["GetAvailableUIPassthroughs"] = "getAvailableUiPassthroughs";
17530
- UIPassthroughEvent["GetAnswerConfig"] = "getAnswerPageConfig";
17531
- UIPassthroughEvent["GetLiveboardConfig"] = "getPinboardPageConfig";
17532
- })(UIPassthroughEvent || (UIPassthroughEvent = {}));
17533
-
17534
17605
  class HostEventClient {
17535
17606
  constructor(iFrame) {
17536
17607
  this.iFrame = iFrame;
@@ -17622,6 +17693,107 @@ class HostEventClient {
17622
17693
  }
17623
17694
  }
17624
17695
 
17696
+ const defaultUrls = {
17697
+ [InterceptedApiType.METADATA]: [
17698
+ '/prism/?op=CreateAnswerSession',
17699
+ '/prism/?op=GetV2SourceDetail',
17700
+ ],
17701
+ [InterceptedApiType.ANSWER_DATA]: [
17702
+ '/prism/?op=GetChartWithData',
17703
+ '/prism/?op=GetTableWithHeadlineData',
17704
+ ],
17705
+ [InterceptedApiType.LIVEBOARD_DATA]: [
17706
+ '/prism/?op=LoadContextBook'
17707
+ ],
17708
+ };
17709
+ const formatInterceptUrl = (url) => {
17710
+ const host = getThoughtSpotHost(getEmbedConfig());
17711
+ if (url.startsWith('/'))
17712
+ return `${host}${url}`;
17713
+ return url;
17714
+ };
17715
+ const processInterceptUrls = (interceptUrls) => {
17716
+ let processedUrls = [...interceptUrls];
17717
+ Object.entries(defaultUrls).forEach(([apiType, apiTypeUrls]) => {
17718
+ if (!processedUrls.includes(apiType))
17719
+ return;
17720
+ processedUrls = processedUrls.filter(url => url !== apiType);
17721
+ processedUrls = [...processedUrls, ...apiTypeUrls];
17722
+ });
17723
+ return processedUrls.map(url => formatInterceptUrl(url));
17724
+ };
17725
+ const getInterceptInitData = (embedConfig, viewConfig) => {
17726
+ const enableApiIntercept = (embedConfig.enableApiIntercept || viewConfig.enableApiIntercept) && (viewConfig.enableApiIntercept !== false);
17727
+ if (!enableApiIntercept)
17728
+ return {
17729
+ enableApiIntercept: false,
17730
+ };
17731
+ const combinedUrls = [...(embedConfig.interceptUrls || []), ...(viewConfig.interceptUrls || [])];
17732
+ if (viewConfig.isOnBeforeGetVizDataInterceptEnabled) {
17733
+ combinedUrls.push(InterceptedApiType.ANSWER_DATA);
17734
+ }
17735
+ const shouldInterceptAll = combinedUrls.includes(InterceptedApiType.ALL);
17736
+ const interceptUrls = shouldInterceptAll ? [InterceptedApiType.ALL] : processInterceptUrls(combinedUrls);
17737
+ const interceptTimeout = embedConfig.interceptTimeout || viewConfig.interceptTimeout;
17738
+ return {
17739
+ interceptUrls,
17740
+ interceptTimeout,
17741
+ enableApiIntercept,
17742
+ };
17743
+ };
17744
+ /**
17745
+ *
17746
+ * @param fetchInit
17747
+ */
17748
+ const parseInterceptData = (eventDataString) => {
17749
+ try {
17750
+ const { input, init } = JSON.parse(eventDataString);
17751
+ init.body = JSON.parse(init.body);
17752
+ const parsedInit = { input, init };
17753
+ return [parsedInit, null];
17754
+ }
17755
+ catch (error) {
17756
+ return [null, error];
17757
+ }
17758
+ };
17759
+ const handleInterceptEvent = async (params) => {
17760
+ var _a, _b, _c, _d, _e;
17761
+ const { eventData, executeEvent, viewConfig, getUnsavedAnswerTml } = params;
17762
+ const [interceptData, bodyParseError] = parseInterceptData(eventData.data);
17763
+ if (bodyParseError) {
17764
+ executeEvent(EmbedEvent.Error, {
17765
+ error: 'Error parsing api intercept body',
17766
+ });
17767
+ logger$3.error('Error parsing request body', bodyParseError);
17768
+ return;
17769
+ }
17770
+ const { input: requestUrl, init } = interceptData;
17771
+ const sessionId = (_c = (_b = (_a = init === null || init === void 0 ? void 0 : init.body) === null || _a === void 0 ? void 0 : _a.variables) === null || _b === void 0 ? void 0 : _b.session) === null || _c === void 0 ? void 0 : _c.sessionId;
17772
+ const vizId = (_e = (_d = init === null || init === void 0 ? void 0 : init.body) === null || _d === void 0 ? void 0 : _d.variables) === null || _e === void 0 ? void 0 : _e.contextBookId;
17773
+ if (defaultUrls.ANSWER_DATA.includes(requestUrl) && viewConfig.isOnBeforeGetVizDataInterceptEnabled) {
17774
+ const answerTml = await getUnsavedAnswerTml({ sessionId, vizId });
17775
+ executeEvent(EmbedEvent.OnBeforeGetVizDataIntercept, { data: { data: answerTml } });
17776
+ }
17777
+ executeEvent(EmbedEvent.ApiIntercept, interceptData);
17778
+ };
17779
+ const processLegacyInterceptResponse = (payload) => {
17780
+ var _a, _b;
17781
+ const title = (_a = payload === null || payload === void 0 ? void 0 : payload.data) === null || _a === void 0 ? void 0 : _a.errorText;
17782
+ const desc = (_b = payload === null || payload === void 0 ? void 0 : payload.data) === null || _b === void 0 ? void 0 : _b.errorDescription;
17783
+ const payloadToSend = [{
17784
+ data: {},
17785
+ errors: [
17786
+ {
17787
+ errorObj: {
17788
+ title,
17789
+ desc
17790
+ }
17791
+ }
17792
+ ],
17793
+ }];
17794
+ return payloadToSend;
17795
+ };
17796
+
17625
17797
  /**
17626
17798
  * Copyright (c) 2022
17627
17799
  *
@@ -17675,6 +17847,27 @@ class TsEmbed {
17675
17847
  */
17676
17848
  this.fullscreenChangeHandler = null;
17677
17849
  this.subscribedListeners = {};
17850
+ this.messageEventListener = async (event) => {
17851
+ const eventType = this.getEventType(event);
17852
+ const eventPort = this.getEventPort(event);
17853
+ const eventData = this.formatEventData(event, eventType);
17854
+ if (event.source === this.iFrame.contentWindow) {
17855
+ const processedEventData = await processEventData(eventType, eventData, this.thoughtSpotHost, this.isPreRendered ? this.preRenderWrapper : this.el);
17856
+ const executeEvent = (_eventType, data) => {
17857
+ this.executeCallbacks(_eventType, data, eventPort);
17858
+ };
17859
+ if (eventType === EmbedEvent.ApiIntercept && this.viewConfig.enableApiIntercept) {
17860
+ const getUnsavedAnswerTml = async (props) => {
17861
+ var _a;
17862
+ const response = await this.triggerUIPassThrough(UIPassthroughEvent.GetUnsavedAnswerTML, props);
17863
+ return (_a = response[0]) === null || _a === void 0 ? void 0 : _a.value;
17864
+ };
17865
+ handleInterceptEvent({ eventData: processedEventData, executeEvent, embedConfig: this.embedConfig, viewConfig: this.viewConfig, getUnsavedAnswerTml });
17866
+ return;
17867
+ }
17868
+ this.executeCallbacks(eventType, processedEventData, eventPort);
17869
+ }
17870
+ };
17678
17871
  /**
17679
17872
  * Send Custom style as part of payload of APP_INIT
17680
17873
  * @param _
@@ -17759,11 +17952,23 @@ class TsEmbed {
17759
17952
  this.on(EmbedEvent.AuthInit, authInitHandler, { start: false }, true);
17760
17953
  };
17761
17954
  this.showPreRenderByDefault = false;
17955
+ this.createEmbedEventResponder = (eventPort, eventType) => {
17956
+ const { enableApiIntercept } = getInterceptInitData(this.embedConfig, this.viewConfig);
17957
+ if (eventType === EmbedEvent.OnBeforeGetVizDataIntercept && enableApiIntercept) {
17958
+ return (payload) => {
17959
+ const payloadToSend = processLegacyInterceptResponse(payload);
17960
+ this.triggerEventOnPort(eventPort, payloadToSend);
17961
+ };
17962
+ }
17963
+ return (payload) => {
17964
+ this.triggerEventOnPort(eventPort, payload);
17965
+ };
17966
+ };
17762
17967
  /**
17763
- * @hidden
17764
- * Internal state to track if the embed container is loaded.
17765
- * This is used to trigger events after the embed container is loaded.
17766
- */
17968
+ * @hidden
17969
+ * Internal state to track if the embed container is loaded.
17970
+ * This is used to trigger events after the embed container is loaded.
17971
+ */
17767
17972
  this.isEmbedContainerLoaded = false;
17768
17973
  /**
17769
17974
  * @hidden
@@ -17822,10 +18027,10 @@ class TsEmbed {
17822
18027
  uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_EMBED_CREATE, {
17823
18028
  ...viewConfig,
17824
18029
  });
18030
+ const embedConfig = getEmbedConfig();
18031
+ this.embedConfig = embedConfig;
17825
18032
  this.hostEventClient = new HostEventClient(this.iFrame);
17826
18033
  this.isReadyForRenderPromise = getInitPromise().then(async () => {
17827
- const embedConfig = getEmbedConfig();
17828
- this.embedConfig = embedConfig;
17829
18034
  if (!embedConfig.authTriggerContainer && !embedConfig.useEventForSAMLPopup) {
17830
18035
  this.embedConfig.authTriggerContainer = domSelector;
17831
18036
  }
@@ -17919,39 +18124,61 @@ class TsEmbed {
17919
18124
  return eventData;
17920
18125
  }
17921
18126
  /**
17922
- * Adds a global event listener to window for "message" events.
17923
- * ThoughtSpot detects if a particular event is targeted to this
17924
- * embed instance through an identifier contained in the payload,
17925
- * and executes the registered callbacks accordingly.
18127
+ * Subscribe to network events (online/offline) that should
18128
+ * work regardless of auth status
17926
18129
  */
17927
- subscribeToEvents() {
17928
- this.unsubscribeToEvents();
17929
- const messageEventListener = (event) => {
17930
- const eventType = this.getEventType(event);
17931
- const eventPort = this.getEventPort(event);
17932
- const eventData = this.formatEventData(event, eventType);
17933
- if (event.source === this.iFrame.contentWindow) {
17934
- this.executeCallbacks(eventType, processEventData(eventType, eventData, this.thoughtSpotHost, this.isPreRendered ? this.preRenderWrapper : this.el), eventPort);
17935
- }
17936
- };
17937
- window.addEventListener('message', messageEventListener);
18130
+ subscribeToNetworkEvents() {
18131
+ this.unsubscribeToNetworkEvents();
17938
18132
  const onlineEventListener = (e) => {
17939
18133
  this.trigger(HostEvent.Reload);
17940
18134
  };
17941
18135
  window.addEventListener('online', onlineEventListener);
17942
18136
  const offlineEventListener = (e) => {
17943
- const offlineWarning = 'Network not Detected. Embed is offline. Please reconnect and refresh';
18137
+ const offlineWarning = ERROR_MESSAGE.OFFLINE_WARNING;
17944
18138
  this.executeCallbacks(EmbedEvent.Error, {
17945
18139
  offlineWarning,
17946
18140
  });
17947
18141
  logger$3.warn(offlineWarning);
17948
18142
  };
17949
18143
  window.addEventListener('offline', offlineEventListener);
17950
- this.subscribedListeners = {
17951
- message: messageEventListener,
17952
- online: onlineEventListener,
17953
- offline: offlineEventListener,
17954
- };
18144
+ this.subscribedListeners.online = onlineEventListener;
18145
+ this.subscribedListeners.offline = offlineEventListener;
18146
+ }
18147
+ /**
18148
+ * Subscribe to message events that depend on successful iframe setup
18149
+ */
18150
+ subscribeToMessageEvents() {
18151
+ this.unsubscribeToMessageEvents();
18152
+ window.addEventListener('message', this.messageEventListener);
18153
+ this.subscribedListeners.message = this.messageEventListener;
18154
+ }
18155
+ /**
18156
+ * Adds event listeners for both network and message events.
18157
+ * This maintains backward compatibility with the existing method.
18158
+ * Adds a global event listener to window for "message" events.
18159
+ * ThoughtSpot detects if a particular event is targeted to this
18160
+ * embed instance through an identifier contained in the payload,
18161
+ * and executes the registered callbacks accordingly.
18162
+ */
18163
+ subscribeToEvents() {
18164
+ this.subscribeToNetworkEvents();
18165
+ this.subscribeToMessageEvents();
18166
+ }
18167
+ unsubscribeToNetworkEvents() {
18168
+ if (this.subscribedListeners.online) {
18169
+ window.removeEventListener('online', this.subscribedListeners.online);
18170
+ delete this.subscribedListeners.online;
18171
+ }
18172
+ if (this.subscribedListeners.offline) {
18173
+ window.removeEventListener('offline', this.subscribedListeners.offline);
18174
+ delete this.subscribedListeners.offline;
18175
+ }
18176
+ }
18177
+ unsubscribeToMessageEvents() {
18178
+ if (this.subscribedListeners.message) {
18179
+ window.removeEventListener('message', this.subscribedListeners.message);
18180
+ delete this.subscribedListeners.message;
18181
+ }
17955
18182
  }
17956
18183
  unsubscribeToEvents() {
17957
18184
  Object.keys(this.subscribedListeners).forEach((key) => {
@@ -17984,7 +18211,7 @@ class TsEmbed {
17984
18211
  message: customActionsResult.errors,
17985
18212
  });
17986
18213
  }
17987
- return {
18214
+ const baseInitData = {
17988
18215
  customisations: getCustomisations(this.embedConfig, this.viewConfig),
17989
18216
  authToken,
17990
18217
  runtimeFilterParams: this.viewConfig.excludeRuntimeFiltersfromURL
@@ -18002,7 +18229,9 @@ class TsEmbed {
18002
18229
  customVariablesForThirdPartyTools: this.embedConfig.customVariablesForThirdPartyTools || {},
18003
18230
  hiddenListColumns: this.viewConfig.hiddenListColumns || [],
18004
18231
  customActions: customActionsResult.actions,
18232
+ ...getInterceptInitData(this.embedConfig, this.viewConfig),
18005
18233
  };
18234
+ return baseInitData;
18006
18235
  }
18007
18236
  async getAppInitData() {
18008
18237
  return this.getDefaultAppInitData();
@@ -18021,6 +18250,11 @@ class TsEmbed {
18021
18250
  .join('/');
18022
18251
  return `${basePath}#`;
18023
18252
  }
18253
+ getUpdateEmbedParamsObject() {
18254
+ let queryParams = this.getEmbedParamsObject();
18255
+ queryParams = { ...this.viewConfig, ...queryParams };
18256
+ return queryParams;
18257
+ }
18024
18258
  /**
18025
18259
  * Common query params set for all the embed modes.
18026
18260
  * @param queryParams
@@ -18170,9 +18404,13 @@ class TsEmbed {
18170
18404
  return path;
18171
18405
  }
18172
18406
  getEmbedParams() {
18173
- const queryParams = this.getBaseQueryParams();
18407
+ const queryParams = this.getEmbedParamsObject();
18174
18408
  return getQueryParamString(queryParams);
18175
18409
  }
18410
+ getEmbedParamsObject() {
18411
+ const params = this.getBaseQueryParams();
18412
+ return params;
18413
+ }
18176
18414
  getRootIframeSrc() {
18177
18415
  const query = this.getEmbedParams();
18178
18416
  return this.getEmbedBasePath(query);
@@ -18243,6 +18481,8 @@ class TsEmbed {
18243
18481
  type: EmbedEvent.Init,
18244
18482
  });
18245
18483
  uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_RENDER_START);
18484
+ // Always subscribe to network events, regardless of auth status
18485
+ this.subscribeToNetworkEvents();
18246
18486
  return (_a = getAuthPromise()) === null || _a === void 0 ? void 0 : _a.then((isLoggedIn) => {
18247
18487
  if (!isLoggedIn) {
18248
18488
  this.handleInsertionIntoDOM(this.embedConfig.loginFailedMessage);
@@ -18285,7 +18525,9 @@ class TsEmbed {
18285
18525
  el.remove();
18286
18526
  });
18287
18527
  }
18288
- this.subscribeToEvents();
18528
+ // Subscribe to message events only after successful
18529
+ // auth and iframe setup
18530
+ this.subscribeToMessageEvents();
18289
18531
  }).catch((error) => {
18290
18532
  nextInQueue();
18291
18533
  uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_RENDER_FAILED, {
@@ -18418,9 +18660,8 @@ class TsEmbed {
18418
18660
  // When start status is false it trigger only end releated
18419
18661
  // payload
18420
18662
  || (!callbackObj.options.start && dataStatus === embedEventStatus.END)) {
18421
- callbackObj.callback(data, (payload) => {
18422
- this.triggerEventOnPort(eventPort, payload);
18423
- });
18663
+ const responder = this.createEmbedEventResponder(eventPort, eventType);
18664
+ callbackObj.callback(data, responder);
18424
18665
  }
18425
18666
  });
18426
18667
  }
@@ -18605,6 +18846,12 @@ class TsEmbed {
18605
18846
  this.handleError('Host event type is undefined');
18606
18847
  return null;
18607
18848
  }
18849
+ // Check if iframe exists before triggering -
18850
+ // this prevents the error when auth fails
18851
+ if (!this.iFrame) {
18852
+ logger$3.debug(`Cannot trigger ${messageType} - iframe not available (likely due to auth failure)`);
18853
+ return null;
18854
+ }
18608
18855
  // send an empty object, this is needed for liveboard default handlers
18609
18856
  return this.hostEventClient.triggerHostEvent(messageType, data);
18610
18857
  }
@@ -18737,7 +18984,12 @@ class TsEmbed {
18737
18984
  return this.preRender(true);
18738
18985
  }
18739
18986
  this.validatePreRenderViewConfig(this.viewConfig);
18987
+ logger$3.debug('triggering UpdateEmbedParams', this.viewConfig);
18988
+ this.executeAfterEmbedContainerLoaded(() => {
18989
+ this.trigger(HostEvent.UpdateEmbedParams, this.getUpdateEmbedParamsObject());
18990
+ });
18740
18991
  }
18992
+ this.beforePrerenderVisible();
18741
18993
  if (this.el) {
18742
18994
  this.syncPreRenderStyle();
18743
18995
  if (!this.viewConfig.doNotTrackPreRenderSize) {
@@ -18754,7 +19006,6 @@ class TsEmbed {
18754
19006
  this.resizeObserver.observe(this.el);
18755
19007
  }
18756
19008
  }
18757
- this.beforePrerenderVisible();
18758
19009
  removeStyleProperties(this.preRenderWrapper, ['z-index', 'opacity', 'pointer-events']);
18759
19010
  this.subscribeToEvents();
18760
19011
  // Setup fullscreen change handler for prerendered components
@@ -19120,7 +19371,7 @@ class AppEmbed extends V1Embed {
19120
19371
  * embedded Liveboard or visualization.
19121
19372
  */
19122
19373
  getEmbedParams() {
19123
- const { tag, hideObjects, liveboardV2, showPrimaryNavbar, disableProfileAndHelp, hideHamburger, hideObjectSearch, hideNotification, hideApplicationSwitcher, hideOrgSwitcher, enableSearchAssist, fullHeight, dataPanelV2 = true, hideLiveboardHeader = false, showLiveboardTitle = true, showLiveboardDescription = true, hideHomepageLeftNav = false, modularHomeExperience = false, isLiveboardHeaderSticky = true, enableAskSage, collapseSearchBarInitially = false, enable2ColumnLayout, enableCustomColumnGroups = false, isOnBeforeGetVizDataInterceptEnabled = false, dataPanelCustomGroupsAccordionInitialState = DataPanelCustomColumnGroupsAccordionState$1.EXPAND_ALL, collapseSearchBar = true, isLiveboardCompactHeaderEnabled = false, showLiveboardVerifiedBadge = true, showLiveboardReverifyBanner = true, hideIrrelevantChipsInLiveboardTabs = false, homePageSearchBarMode, isUnifiedSearchExperienceEnabled = true, enablePendoHelp = true, discoveryExperience, coverAndFilterOptionInPDF = false, liveboardXLSXCSVDownload = false, isLiveboardStylingAndGroupingEnabled, isPNGInScheduledEmailsEnabled = false, } = this.viewConfig;
19374
+ const { tag, hideObjects, liveboardV2, showPrimaryNavbar, disableProfileAndHelp, hideHamburger, hideObjectSearch, hideNotification, hideApplicationSwitcher, hideOrgSwitcher, enableSearchAssist, fullHeight, dataPanelV2 = true, hideLiveboardHeader = false, showLiveboardTitle = true, showLiveboardDescription = true, hideHomepageLeftNav = false, modularHomeExperience = false, isLiveboardHeaderSticky = true, enableAskSage, collapseSearchBarInitially = false, enable2ColumnLayout, enableCustomColumnGroups = false, isOnBeforeGetVizDataInterceptEnabled = false, dataPanelCustomGroupsAccordionInitialState = DataPanelCustomColumnGroupsAccordionState$1.EXPAND_ALL, collapseSearchBar = true, isLiveboardCompactHeaderEnabled = false, showLiveboardVerifiedBadge = true, showLiveboardReverifyBanner = true, hideIrrelevantChipsInLiveboardTabs = false, homePageSearchBarMode, isUnifiedSearchExperienceEnabled = true, enablePendoHelp = true, discoveryExperience, coverAndFilterOptionInPDF = false, liveboardXLSXCSVDownload = false, isLiveboardStylingAndGroupingEnabled, isPNGInScheduledEmailsEnabled = false, isLinkParametersEnabled, } = this.viewConfig;
19124
19375
  let params = {};
19125
19376
  params[Param.PrimaryNavHidden] = !showPrimaryNavbar;
19126
19377
  params[Param.HideProfleAndHelp] = !!disableProfileAndHelp;
@@ -19173,7 +19424,8 @@ class AppEmbed extends V1Embed {
19173
19424
  if (enableAskSage) {
19174
19425
  params[Param.enableAskSage] = enableAskSage;
19175
19426
  }
19176
- if (isOnBeforeGetVizDataInterceptEnabled) {
19427
+ const { enableApiIntercept } = getInterceptInitData(this.embedConfig, this.viewConfig);
19428
+ if (isOnBeforeGetVizDataInterceptEnabled && !enableApiIntercept) {
19177
19429
  params[Param.IsOnBeforeGetVizDataInterceptEnabled] = isOnBeforeGetVizDataInterceptEnabled;
19178
19430
  }
19179
19431
  if (homePageSearchBarMode) {
@@ -19188,6 +19440,9 @@ class AppEmbed extends V1Embed {
19188
19440
  if (isPNGInScheduledEmailsEnabled !== undefined) {
19189
19441
  params[Param.isPNGInScheduledEmailsEnabled] = isPNGInScheduledEmailsEnabled;
19190
19442
  }
19443
+ if (isLinkParametersEnabled !== undefined) {
19444
+ params[Param.isLinkParametersEnabled] = isLinkParametersEnabled;
19445
+ }
19191
19446
  params[Param.DataPanelV2Enabled] = dataPanelV2;
19192
19447
  params[Param.HideHomepageLeftNav] = hideHomepageLeftNav;
19193
19448
  params[Param.ModularHomeExperienceEnabled] = modularHomeExperience;
@@ -19535,9 +19790,14 @@ class LiveboardEmbed extends V1Embed {
19535
19790
  * embedded Liveboard or visualization.
19536
19791
  */
19537
19792
  getEmbedParams() {
19793
+ const params = this.getEmbedParamsObject();
19794
+ const queryParams = getQueryParamString(params, true);
19795
+ return queryParams;
19796
+ }
19797
+ getEmbedParamsObject() {
19538
19798
  let params = {};
19539
19799
  params = this.getBaseQueryParams(params);
19540
- const { enableVizTransformations, fullHeight, defaultHeight, visibleVizs, liveboardV2, vizId, hideTabPanel, activeTabId, hideLiveboardHeader, showLiveboardDescription, showLiveboardTitle, isLiveboardHeaderSticky = true, isLiveboardCompactHeaderEnabled = false, showLiveboardVerifiedBadge = true, showLiveboardReverifyBanner = true, hideIrrelevantChipsInLiveboardTabs = false, enableAskSage, enable2ColumnLayout, dataPanelV2 = true, enableCustomColumnGroups = false, oAuthPollingInterval, isForceRedirect, dataSourceId, coverAndFilterOptionInPDF = false, liveboardXLSXCSVDownload = false, isLiveboardStylingAndGroupingEnabled, isPNGInScheduledEmailsEnabled = false, showSpotterLimitations, } = this.viewConfig;
19800
+ const { enableVizTransformations, fullHeight, defaultHeight, visibleVizs, liveboardV2, vizId, hideTabPanel, activeTabId, hideLiveboardHeader, showLiveboardDescription, showLiveboardTitle, isLiveboardHeaderSticky = true, isLiveboardCompactHeaderEnabled = false, showLiveboardVerifiedBadge = true, showLiveboardReverifyBanner = true, hideIrrelevantChipsInLiveboardTabs = false, enableAskSage, enable2ColumnLayout, dataPanelV2 = true, enableCustomColumnGroups = false, oAuthPollingInterval, isForceRedirect, dataSourceId, coverAndFilterOptionInPDF = false, liveboardXLSXCSVDownload = false, isLiveboardStylingAndGroupingEnabled, isPNGInScheduledEmailsEnabled = false, showSpotterLimitations, isLinkParametersEnabled, } = this.viewConfig;
19541
19801
  const preventLiveboardFilterRemoval = this.viewConfig.preventLiveboardFilterRemoval
19542
19802
  || this.viewConfig.preventPinboardFilterRemoval;
19543
19803
  if (fullHeight === true) {
@@ -19602,6 +19862,9 @@ class LiveboardEmbed extends V1Embed {
19602
19862
  if (showSpotterLimitations !== undefined) {
19603
19863
  params[Param.ShowSpotterLimitations] = showSpotterLimitations;
19604
19864
  }
19865
+ if (isLinkParametersEnabled !== undefined) {
19866
+ params[Param.isLinkParametersEnabled] = isLinkParametersEnabled;
19867
+ }
19605
19868
  params[Param.LiveboardHeaderSticky] = isLiveboardHeaderSticky;
19606
19869
  params[Param.LiveboardHeaderV2] = isLiveboardCompactHeaderEnabled;
19607
19870
  params[Param.ShowLiveboardVerifiedBadge] = showLiveboardVerifiedBadge;
@@ -19611,8 +19874,8 @@ class LiveboardEmbed extends V1Embed {
19611
19874
  params[Param.EnableCustomColumnGroups] = enableCustomColumnGroups;
19612
19875
  params[Param.CoverAndFilterOptionInPDF] = coverAndFilterOptionInPDF;
19613
19876
  params[Param.LiveboardXLSXCSVDownload] = !!liveboardXLSXCSVDownload;
19614
- const queryParams = getQueryParamString(params, true);
19615
- return queryParams;
19877
+ getQueryParamString(params, true);
19878
+ return params;
19616
19879
  }
19617
19880
  getIframeSuffixSrc(liveboardId, vizId, activeTabId) {
19618
19881
  let suffix = `/embed/viz/${liveboardId}`;
@@ -19854,11 +20117,9 @@ class SearchEmbed extends TsEmbed {
19854
20117
  const defaultAppInitData = await super.getAppInitData();
19855
20118
  return { ...defaultAppInitData, ...this.getSearchInitData() };
19856
20119
  }
19857
- getEmbedParams() {
20120
+ getEmbedParamsObject() {
19858
20121
  var _a;
19859
- const { hideResults, enableSearchAssist, forceTable, searchOptions, runtimeFilters, dataSource, dataSources, excludeRuntimeFiltersfromURL, hideSearchBar, dataPanelV2 = true, useLastSelectedSources = false, runtimeParameters, collapseSearchBarInitially = false, enableCustomColumnGroups = false, isOnBeforeGetVizDataInterceptEnabled = false,
19860
- /* eslint-disable-next-line max-len */
19861
- dataPanelCustomGroupsAccordionInitialState = DataPanelCustomColumnGroupsAccordionState.EXPAND_ALL, focusSearchBarOnRender = true, excludeRuntimeParametersfromURL, excludeSearchTokenStringFromURL, collapseSearchBar = true, } = this.viewConfig;
20122
+ const { hideResults, enableSearchAssist, forceTable, searchOptions, runtimeFilters, dataSource, dataSources, excludeRuntimeFiltersfromURL, hideSearchBar, dataPanelV2 = true, useLastSelectedSources = false, runtimeParameters, collapseSearchBarInitially = false, enableCustomColumnGroups = false, isOnBeforeGetVizDataInterceptEnabled = false, dataPanelCustomGroupsAccordionInitialState = DataPanelCustomColumnGroupsAccordionState.EXPAND_ALL, focusSearchBarOnRender = true, excludeRuntimeParametersfromURL, excludeSearchTokenStringFromURL, collapseSearchBar = true, } = this.viewConfig;
19862
20123
  const queryParams = this.getBaseQueryParams();
19863
20124
  queryParams[Param.HideActions] = [
19864
20125
  ...((_a = queryParams[Param.HideActions]) !== null && _a !== void 0 ? _a : []),
@@ -19890,8 +20151,8 @@ class SearchEmbed extends TsEmbed {
19890
20151
  if (hideSearchBar) {
19891
20152
  queryParams[Param.HideSearchBar] = true;
19892
20153
  }
19893
- if (isOnBeforeGetVizDataInterceptEnabled) {
19894
- /* eslint-disable-next-line max-len */
20154
+ const { enableApiIntercept } = getInterceptInitData(this.embedConfig, this.viewConfig);
20155
+ if (isOnBeforeGetVizDataInterceptEnabled && !enableApiIntercept) {
19895
20156
  queryParams[Param.IsOnBeforeGetVizDataInterceptEnabled] = isOnBeforeGetVizDataInterceptEnabled;
19896
20157
  }
19897
20158
  if (!focusSearchBarOnRender) {
@@ -19904,20 +20165,22 @@ class SearchEmbed extends TsEmbed {
19904
20165
  queryParams[Param.UseLastSelectedDataSource] = false;
19905
20166
  }
19906
20167
  queryParams[Param.searchEmbed] = true;
19907
- /* eslint-disable-next-line max-len */
19908
20168
  queryParams[Param.CollapseSearchBarInitially] = collapseSearchBarInitially || collapseSearchBar;
19909
20169
  queryParams[Param.EnableCustomColumnGroups] = enableCustomColumnGroups;
19910
20170
  if (dataPanelCustomGroupsAccordionInitialState
19911
20171
  === DataPanelCustomColumnGroupsAccordionState.COLLAPSE_ALL
19912
20172
  || dataPanelCustomGroupsAccordionInitialState
19913
20173
  === DataPanelCustomColumnGroupsAccordionState.EXPAND_FIRST) {
19914
- /* eslint-disable-next-line max-len */
19915
20174
  queryParams[Param.DataPanelCustomGroupsAccordionInitialState] = dataPanelCustomGroupsAccordionInitialState;
19916
20175
  }
19917
20176
  else {
19918
- /* eslint-disable-next-line max-len */
19919
20177
  queryParams[Param.DataPanelCustomGroupsAccordionInitialState] = DataPanelCustomColumnGroupsAccordionState.EXPAND_ALL;
19920
20178
  }
20179
+ return queryParams;
20180
+ }
20181
+ getEmbedParams() {
20182
+ const { runtimeParameters, runtimeFilters, excludeRuntimeParametersfromURL, excludeRuntimeFiltersfromURL, } = this.viewConfig;
20183
+ const queryParams = this.getEmbedParamsObject();
19921
20184
  let query = '';
19922
20185
  const queryParamsString = getQueryParamString(queryParams, true);
19923
20186
  if (queryParamsString) {
@@ -19973,15 +20236,9 @@ class SearchBarEmbed extends TsEmbed {
19973
20236
  this.embedComponentType = 'SearchBarEmbed';
19974
20237
  this.viewConfig = viewConfig;
19975
20238
  }
19976
- /**
19977
- * Construct the URL of the embedded ThoughtSpot search to be
19978
- * loaded in the iframe
19979
- * @param dataSources A list of data source GUIDs
19980
- */
19981
- getIFrameSrc() {
20239
+ getEmbedParamsObject() {
19982
20240
  var _a;
19983
20241
  const { searchOptions, dataSource, dataSources, useLastSelectedSources = false, excludeSearchTokenStringFromURL, } = this.viewConfig;
19984
- const path = 'search-bar-embed';
19985
20242
  const queryParams = this.getBaseQueryParams();
19986
20243
  queryParams[Param.HideActions] = [...((_a = queryParams[Param.HideActions]) !== null && _a !== void 0 ? _a : [])];
19987
20244
  if (dataSources && dataSources.length) {
@@ -20003,6 +20260,16 @@ class SearchBarEmbed extends TsEmbed {
20003
20260
  queryParams[Param.UseLastSelectedDataSource] = false;
20004
20261
  }
20005
20262
  queryParams[Param.searchEmbed] = true;
20263
+ return queryParams;
20264
+ }
20265
+ /**
20266
+ * Construct the URL of the embedded ThoughtSpot search to be
20267
+ * loaded in the iframe
20268
+ * @param dataSources A list of data source GUIDs
20269
+ */
20270
+ getIFrameSrc() {
20271
+ const queryParams = this.getEmbedParamsObject();
20272
+ const path = 'search-bar-embed';
20006
20273
  let query = '';
20007
20274
  const queryParamsString = getQueryParamString(queryParams, true);
20008
20275
  if (queryParamsString) {
@@ -20425,13 +20692,17 @@ class ConversationMessage extends TsEmbed {
20425
20692
  super(container, viewConfig);
20426
20693
  this.viewConfig = viewConfig;
20427
20694
  }
20428
- getIframeSrc() {
20695
+ getEmbedParamsObject() {
20429
20696
  var _a;
20430
- const { sessionId, genNo, acSessionId, acGenNo, convId, messageId, } = this.viewConfig;
20431
- const path = 'conv-assist-answer';
20432
20697
  const queryParams = this.getBaseQueryParams();
20433
20698
  queryParams[Param.HideActions] = [...((_a = queryParams[Param.HideActions]) !== null && _a !== void 0 ? _a : [])];
20434
20699
  queryParams[Param.isSpotterAgentEmbed] = true;
20700
+ return queryParams;
20701
+ }
20702
+ getIframeSrc() {
20703
+ const { sessionId, genNo, acSessionId, acGenNo, convId, messageId, } = this.viewConfig;
20704
+ const path = 'conv-assist-answer';
20705
+ const queryParams = this.getEmbedParamsObject();
20435
20706
  let query = '';
20436
20707
  const queryParamsString = getQueryParamString(queryParams, true);
20437
20708
  if (queryParamsString) {
@@ -20592,9 +20863,8 @@ class SpotterEmbed extends TsEmbed {
20592
20863
  super(container, viewConfig);
20593
20864
  this.viewConfig = viewConfig;
20594
20865
  }
20595
- getIframeSrc() {
20866
+ getEmbedParamsObject() {
20596
20867
  const { worksheetId, searchOptions, disableSourceSelection, hideSourceSelection, dataPanelV2, showSpotterLimitations, hideSampleQuestions, runtimeFilters, excludeRuntimeFiltersfromURL, runtimeParameters, excludeRuntimeParametersfromURL, } = this.viewConfig;
20597
- const path = 'insights/conv-assist';
20598
20868
  if (!worksheetId) {
20599
20869
  this.handleError(ERROR_MESSAGE.SPOTTER_EMBED_WORKSHEED_ID_NOT_FOUND);
20600
20870
  }
@@ -20615,6 +20885,12 @@ class SpotterEmbed extends TsEmbed {
20615
20885
  if (!isUndefined_1(hideSampleQuestions)) {
20616
20886
  queryParams[Param.HideSampleQuestions] = !!hideSampleQuestions;
20617
20887
  }
20888
+ return queryParams;
20889
+ }
20890
+ getIframeSrc() {
20891
+ const { worksheetId, searchOptions, runtimeFilters, excludeRuntimeFiltersfromURL, runtimeParameters, excludeRuntimeParametersfromURL, } = this.viewConfig;
20892
+ const path = 'insights/conv-assist';
20893
+ const queryParams = this.getEmbedParamsObject();
20618
20894
  let query = '';
20619
20895
  const queryParamsString = getQueryParamString(queryParams, true);
20620
20896
  if (queryParamsString) {
@@ -20686,12 +20962,7 @@ class SageEmbed extends V1Embed {
20686
20962
  viewConfig.embedComponentType = 'SageEmbed';
20687
20963
  super(domSelector, viewConfig);
20688
20964
  }
20689
- /**
20690
- * Constructs a map of parameters to be passed on to the
20691
- * embedded Eureka or Sage search page.
20692
- * @returns {string} query string
20693
- */
20694
- getEmbedParams() {
20965
+ getEmbedParamsObject() {
20695
20966
  const { disableWorksheetChange, hideWorksheetSelector, showObjectSuggestions, dataPanelV2, hideSampleQuestions, isProductTour, hideSageAnswerHeader, hideAutocompleteSuggestions, } = this.viewConfig;
20696
20967
  const params = this.getBaseQueryParams();
20697
20968
  params[Param.DataPanelV2Enabled] = !!dataPanelV2;
@@ -20706,6 +20977,15 @@ class SageEmbed extends V1Embed {
20706
20977
  params[Param.HideSampleQuestions] = !!hideSampleQuestions;
20707
20978
  params[Param.IsProductTour] = !!isProductTour;
20708
20979
  params[Param.HideSageAnswerHeader] = !!hideSageAnswerHeader;
20980
+ return params;
20981
+ }
20982
+ /**
20983
+ * Constructs a map of parameters to be passed on to the
20984
+ * embedded Eureka or Sage search page.
20985
+ * @returns {string} query string
20986
+ */
20987
+ getEmbedParams() {
20988
+ const params = this.getEmbedParamsObject();
20709
20989
  return getQueryParamString(params, true);
20710
20990
  }
20711
20991
  /**
@@ -21266,4 +21546,4 @@ const createLiveboardWithAnswers = async (answers, name) => {
21266
21546
  return result;
21267
21547
  };
21268
21548
 
21269
- export { Action, AnswerService, AppEmbed, AuthEvent, AuthFailureType, AuthStatus, AuthType, BodylessConversation, ContextMenuTriggerOptions, ConversationEmbed, CustomActionTarget, CustomActionsPosition, DataPanelCustomColumnGroupsAccordionState$1 as DataPanelCustomColumnGroupsAccordionState, DataSourceVisualMode, EmbedEvent, HomeLeftNavItem, HomePage, HomePageSearchBarMode, HomepageModule, HostEvent, ListPage, ListPageColumns, LiveboardEmbed, LogLevel, MIXPANEL_EVENT, Page, PinboardEmbed, PrefetchFeatures, PrimaryNavbarVersion, RuntimeFilterOp, SageEmbed, SearchBarEmbed, SearchEmbed, SpotterAgentEmbed, SpotterEmbed, UIPassthroughEvent, createLiveboardWithAnswers, executeTML, exportTML, getAnswerFromQuery, getEmbedConfig as getInitConfig, getSessionInfo, init, logout, prefetch, resetCachedAuthToken, tokenizedFetch, uploadMixpanelEvent };
21549
+ export { Action, AnswerService, AppEmbed, AuthEvent, AuthFailureType, AuthStatus, AuthType, BodylessConversation, ContextMenuTriggerOptions, ConversationEmbed, CustomActionTarget, CustomActionsPosition, DataPanelCustomColumnGroupsAccordionState$1 as DataPanelCustomColumnGroupsAccordionState, DataSourceVisualMode, EmbedEvent, HomeLeftNavItem, HomePage, HomePageSearchBarMode, HomepageModule, HostEvent, InterceptedApiType, ListPage, ListPageColumns, LiveboardEmbed, LogLevel, MIXPANEL_EVENT, Page, PinboardEmbed, PrefetchFeatures, PrimaryNavbarVersion, RuntimeFilterOp, SageEmbed, SearchBarEmbed, SearchEmbed, SpotterAgentEmbed, SpotterEmbed, UIPassthroughEvent, createLiveboardWithAnswers, executeTML, exportTML, getAnswerFromQuery, getEmbedConfig as getInitConfig, getSessionInfo, init, logout, prefetch, resetCachedAuthToken, tokenizedFetch, uploadMixpanelEvent };