@thoughtspot/visual-embed-sdk 1.46.2 → 1.46.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (169) hide show
  1. package/cjs/package.json +1 -1
  2. package/cjs/src/auth.js +0 -3
  3. package/cjs/src/auth.js.map +1 -1
  4. package/cjs/src/auth.spec.js +1 -3
  5. package/cjs/src/auth.spec.js.map +1 -1
  6. package/cjs/src/authToken.js +0 -1
  7. package/cjs/src/authToken.js.map +1 -1
  8. package/cjs/src/authToken.spec.js +2 -1
  9. package/cjs/src/authToken.spec.js.map +1 -1
  10. package/cjs/src/embed/app.d.ts +2 -1
  11. package/cjs/src/embed/app.d.ts.map +1 -1
  12. package/cjs/src/embed/app.js.map +1 -1
  13. package/cjs/src/embed/auto-frame-renderer.d.ts +41 -0
  14. package/cjs/src/embed/auto-frame-renderer.d.ts.map +1 -0
  15. package/cjs/src/embed/auto-frame-renderer.js +145 -0
  16. package/cjs/src/embed/auto-frame-renderer.js.map +1 -0
  17. package/cjs/src/embed/auto-frame-renderer.spec.d.ts +2 -0
  18. package/cjs/src/embed/auto-frame-renderer.spec.d.ts.map +1 -0
  19. package/cjs/src/embed/auto-frame-renderer.spec.js +195 -0
  20. package/cjs/src/embed/auto-frame-renderer.spec.js.map +1 -0
  21. package/cjs/src/embed/base.d.ts.map +1 -1
  22. package/cjs/src/embed/base.js +4 -7
  23. package/cjs/src/embed/base.js.map +1 -1
  24. package/cjs/src/embed/hostEventClient/host-event-client.js +0 -2
  25. package/cjs/src/embed/hostEventClient/host-event-client.js.map +1 -1
  26. package/cjs/src/embed/liveboard.d.ts +2 -1
  27. package/cjs/src/embed/liveboard.d.ts.map +1 -1
  28. package/cjs/src/embed/liveboard.js +5 -3
  29. package/cjs/src/embed/liveboard.js.map +1 -1
  30. package/cjs/src/embed/liveboard.spec.js +4 -2
  31. package/cjs/src/embed/liveboard.spec.js.map +1 -1
  32. package/cjs/src/embed/sage.js +0 -1
  33. package/cjs/src/embed/sage.js.map +1 -1
  34. package/cjs/src/embed/search.spec.js +0 -2
  35. package/cjs/src/embed/search.spec.js.map +1 -1
  36. package/cjs/src/embed/ts-embed.d.ts.map +1 -1
  37. package/cjs/src/embed/ts-embed.js +3 -3
  38. package/cjs/src/embed/ts-embed.js.map +1 -1
  39. package/cjs/src/embed/ts-embed.spec.js +2 -1
  40. package/cjs/src/embed/ts-embed.spec.js.map +1 -1
  41. package/cjs/src/index.d.ts +3 -2
  42. package/cjs/src/index.d.ts.map +1 -1
  43. package/cjs/src/index.js +3 -1
  44. package/cjs/src/index.js.map +1 -1
  45. package/cjs/src/react/index.js +0 -1
  46. package/cjs/src/react/index.js.map +1 -1
  47. package/cjs/src/react/index.spec.js +6 -3
  48. package/cjs/src/react/index.spec.js.map +1 -1
  49. package/cjs/src/types.d.ts +56 -32
  50. package/cjs/src/types.d.ts.map +1 -1
  51. package/cjs/src/types.js +34 -18
  52. package/cjs/src/types.js.map +1 -1
  53. package/cjs/src/utils/graphql/answerService/answerService.d.ts +5 -4
  54. package/cjs/src/utils/graphql/answerService/answerService.d.ts.map +1 -1
  55. package/cjs/src/utils/graphql/answerService/answerService.js +7 -11
  56. package/cjs/src/utils/graphql/answerService/answerService.js.map +1 -1
  57. package/cjs/src/utils/graphql/preview-service.js +0 -1
  58. package/cjs/src/utils/graphql/preview-service.js.map +1 -1
  59. package/cjs/src/utils/processData.js +0 -5
  60. package/cjs/src/utils/processData.js.map +1 -1
  61. package/dist/{index-DkizS4xM.js → index-DyX-x6uN.js} +1 -1
  62. package/dist/src/embed/app.d.ts +2 -1
  63. package/dist/src/embed/app.d.ts.map +1 -1
  64. package/dist/src/embed/auto-frame-renderer.d.ts +41 -0
  65. package/dist/src/embed/auto-frame-renderer.d.ts.map +1 -0
  66. package/dist/src/embed/auto-frame-renderer.spec.d.ts +2 -0
  67. package/dist/src/embed/auto-frame-renderer.spec.d.ts.map +1 -0
  68. package/dist/src/embed/base.d.ts.map +1 -1
  69. package/dist/src/embed/liveboard.d.ts +2 -1
  70. package/dist/src/embed/liveboard.d.ts.map +1 -1
  71. package/dist/src/embed/ts-embed.d.ts.map +1 -1
  72. package/dist/src/index.d.ts +3 -2
  73. package/dist/src/index.d.ts.map +1 -1
  74. package/dist/src/types.d.ts +56 -32
  75. package/dist/src/types.d.ts.map +1 -1
  76. package/dist/src/utils/graphql/answerService/answerService.d.ts +5 -4
  77. package/dist/src/utils/graphql/answerService/answerService.d.ts.map +1 -1
  78. package/dist/tsembed-react.es.js +55 -57
  79. package/dist/tsembed-react.js +54 -56
  80. package/dist/tsembed.es.js +194 -57
  81. package/dist/tsembed.js +193 -55
  82. package/dist/visual-embed-sdk-react-full.d.ts +54 -33
  83. package/dist/visual-embed-sdk-react.d.ts +54 -33
  84. package/dist/visual-embed-sdk.d.ts +103 -38
  85. package/lib/package.json +1 -1
  86. package/lib/src/auth.js +0 -3
  87. package/lib/src/auth.js.map +1 -1
  88. package/lib/src/auth.spec.js +1 -3
  89. package/lib/src/auth.spec.js.map +1 -1
  90. package/lib/src/authToken.js +0 -1
  91. package/lib/src/authToken.js.map +1 -1
  92. package/lib/src/authToken.spec.js +2 -1
  93. package/lib/src/authToken.spec.js.map +1 -1
  94. package/lib/src/embed/app.d.ts +2 -1
  95. package/lib/src/embed/app.d.ts.map +1 -1
  96. package/lib/src/embed/app.js.map +1 -1
  97. package/lib/src/embed/auto-frame-renderer.d.ts +41 -0
  98. package/lib/src/embed/auto-frame-renderer.d.ts.map +1 -0
  99. package/lib/src/embed/auto-frame-renderer.js +141 -0
  100. package/lib/src/embed/auto-frame-renderer.js.map +1 -0
  101. package/lib/src/embed/auto-frame-renderer.spec.d.ts +2 -0
  102. package/lib/src/embed/auto-frame-renderer.spec.d.ts.map +1 -0
  103. package/lib/src/embed/auto-frame-renderer.spec.js +192 -0
  104. package/lib/src/embed/auto-frame-renderer.spec.js.map +1 -0
  105. package/lib/src/embed/base.d.ts.map +1 -1
  106. package/lib/src/embed/base.js +4 -7
  107. package/lib/src/embed/base.js.map +1 -1
  108. package/lib/src/embed/hostEventClient/host-event-client.js +0 -2
  109. package/lib/src/embed/hostEventClient/host-event-client.js.map +1 -1
  110. package/lib/src/embed/liveboard.d.ts +2 -1
  111. package/lib/src/embed/liveboard.d.ts.map +1 -1
  112. package/lib/src/embed/liveboard.js +5 -3
  113. package/lib/src/embed/liveboard.js.map +1 -1
  114. package/lib/src/embed/liveboard.spec.js +4 -2
  115. package/lib/src/embed/liveboard.spec.js.map +1 -1
  116. package/lib/src/embed/sage.js +0 -1
  117. package/lib/src/embed/sage.js.map +1 -1
  118. package/lib/src/embed/search.spec.js +0 -2
  119. package/lib/src/embed/search.spec.js.map +1 -1
  120. package/lib/src/embed/ts-embed.d.ts.map +1 -1
  121. package/lib/src/embed/ts-embed.js +3 -3
  122. package/lib/src/embed/ts-embed.js.map +1 -1
  123. package/lib/src/embed/ts-embed.spec.js +2 -1
  124. package/lib/src/embed/ts-embed.spec.js.map +1 -1
  125. package/lib/src/index.d.ts +3 -2
  126. package/lib/src/index.d.ts.map +1 -1
  127. package/lib/src/index.js +1 -0
  128. package/lib/src/index.js.map +1 -1
  129. package/lib/src/react/index.js +0 -1
  130. package/lib/src/react/index.js.map +1 -1
  131. package/lib/src/react/index.spec.js +6 -3
  132. package/lib/src/react/index.spec.js.map +1 -1
  133. package/lib/src/types.d.ts +56 -32
  134. package/lib/src/types.d.ts.map +1 -1
  135. package/lib/src/types.js +34 -18
  136. package/lib/src/types.js.map +1 -1
  137. package/lib/src/utils/graphql/answerService/answerService.d.ts +5 -4
  138. package/lib/src/utils/graphql/answerService/answerService.d.ts.map +1 -1
  139. package/lib/src/utils/graphql/answerService/answerService.js +7 -11
  140. package/lib/src/utils/graphql/answerService/answerService.js.map +1 -1
  141. package/lib/src/utils/graphql/preview-service.js +0 -1
  142. package/lib/src/utils/graphql/preview-service.js.map +1 -1
  143. package/lib/src/utils/processData.js +0 -5
  144. package/lib/src/utils/processData.js.map +1 -1
  145. package/lib/src/visual-embed-sdk.d.ts +11466 -0
  146. package/package.json +1 -1
  147. package/src/auth.spec.ts +1 -1
  148. package/src/auth.ts +3 -3
  149. package/src/authToken.spec.ts +2 -1
  150. package/src/authToken.ts +1 -1
  151. package/src/embed/app.ts +2 -1
  152. package/src/embed/auto-frame-renderer.spec.ts +266 -0
  153. package/src/embed/auto-frame-renderer.ts +152 -0
  154. package/src/embed/base.spec.ts +1 -1
  155. package/src/embed/base.ts +7 -8
  156. package/src/embed/hostEventClient/host-event-client.ts +2 -2
  157. package/src/embed/liveboard.spec.ts +4 -2
  158. package/src/embed/liveboard.ts +7 -4
  159. package/src/embed/sage.ts +1 -1
  160. package/src/embed/search.spec.ts +2 -2
  161. package/src/embed/ts-embed.spec.ts +2 -1
  162. package/src/embed/ts-embed.ts +3 -3
  163. package/src/index.ts +3 -0
  164. package/src/react/index.spec.tsx +6 -3
  165. package/src/react/index.tsx +1 -1
  166. package/src/types.ts +57 -32
  167. package/src/utils/graphql/answerService/answerService.ts +8 -7
  168. package/src/utils/graphql/preview-service.ts +1 -1
  169. package/src/utils/processData.ts +5 -5
@@ -1,4 +1,4 @@
1
- /* @thoughtspot/visual-embed-sdk version 1.46.2 */
1
+ /* @thoughtspot/visual-embed-sdk version 1.46.3 */
2
2
  'use client';
3
3
  function _mergeNamespaces(n, m) {
4
4
  m.forEach(function (e) {
@@ -827,7 +827,8 @@ var EmbedEvent;
827
827
  EmbedEvent["Download"] = "download";
828
828
  /**
829
829
  * Emitted when the download action is triggered on an Answer.
830
- * Use start:true to subscribe to when download is initiated, or end:true to subscribe to when download is completed. Default is end:true.
830
+ * Use start:true to subscribe to when download is initiated, or end:true to
831
+ * subscribe to when download is completed. Default is end:true.
831
832
  * @version SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl, 9.4.0.sw
832
833
  * @example
833
834
  * ```js
@@ -842,7 +843,8 @@ var EmbedEvent;
842
843
  EmbedEvent["DownloadAsPng"] = "downloadAsPng";
843
844
  /**
844
845
  * Emitted when the Download as PDF action is triggered on an Answer
845
- * Use start:true to subscribe to when download as PDF is initiated, or end:true to subscribe to when download as PDF is completed. Default is end:true.
846
+ * Use start:true to subscribe to when download as PDF is initiated, or end:true to
847
+ * subscribe to when download as PDF is completed. Default is end:true.
846
848
  * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
847
849
  * @example
848
850
  * ```js
@@ -857,7 +859,8 @@ var EmbedEvent;
857
859
  EmbedEvent["DownloadAsPdf"] = "downloadAsPdf";
858
860
  /**
859
861
  * Emitted when the Download as CSV action is triggered on an Answer.
860
- * Use start:true to subscribe to when download as CSV is initiated, or end:true to subscribe to when download as CSV is completed. Default is end:true.
862
+ * Use start:true to subscribe to when download as CSV is initiated, or end:true to
863
+ * subscribe to when download as CSV is completed. Default is end:true.
861
864
  * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
862
865
  * @example
863
866
  * ```js
@@ -872,7 +875,8 @@ var EmbedEvent;
872
875
  EmbedEvent["DownloadAsCsv"] = "downloadAsCsv";
873
876
  /**
874
877
  * Emitted when the Download as XLSX action is triggered on an Answer.
875
- * Use start:true to subscribe to when download as XLSX is initiated, or end:true to subscribe to when download as XLSX is completed. Default is end:true.
878
+ * Use start:true to subscribe to when download as XLSX is initiated, or end:true to
879
+ * subscribe to when download as XLSX is completed. Default is end:true.
876
880
  * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
877
881
  * @example
878
882
  * ```js
@@ -887,7 +891,8 @@ var EmbedEvent;
887
891
  EmbedEvent["DownloadAsXlsx"] = "downloadAsXlsx";
888
892
  /**
889
893
  * Emitted when an Answer is deleted in the app
890
- * Use start:true to subscribe to when delete is initiated, or end:true to subscribe to when delete is completed. Default is end:true.
894
+ * Use start:true to subscribe to when delete is initiated, or end:true to subscribe
895
+ * to when delete is completed. Default is end:true.
891
896
  * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
892
897
  * @example
893
898
  * ```js
@@ -914,7 +919,8 @@ var EmbedEvent;
914
919
  /**
915
920
  * Emitted when a user initiates the Pin action to
916
921
  * add an Answer to a Liveboard.
917
- * Use start:true to subscribe to when pin is initiated, or end:true to subscribe to when pin is completed. Default is end:true.
922
+ * Use start:true to subscribe to when pin is initiated, or end:true to subscribe to
923
+ * when pin is completed. Default is end:true.
918
924
  * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
919
925
  * @example
920
926
  * ```js
@@ -1028,7 +1034,8 @@ var EmbedEvent;
1028
1034
  /**
1029
1035
  * Emitted when the **Export TML** action is triggered on an
1030
1036
  * an embedded object in the app
1031
- * Use start:true to subscribe to when export is initiated, or end:true to subscribe to when export is completed. Default is end:true.
1037
+ * Use start:true to subscribe to when export is initiated, or end:true to subscribe
1038
+ * to when export is completed. Default is end:true.
1032
1039
  * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
1033
1040
  * @example
1034
1041
  * ```js
@@ -1054,7 +1061,8 @@ var EmbedEvent;
1054
1061
  EmbedEvent["SaveAsView"] = "saveAsView";
1055
1062
  /**
1056
1063
  * Emitted when the user creates a copy of an Answer.
1057
- * Use start:true to subscribe to when copy and edit is initiated, or end:true to subscribe to when copy and edit is completed. Default is end:true.
1064
+ * Use start:true to subscribe to when copy and edit is initiated, or end:true to
1065
+ * subscribe to when copy and edit is completed. Default is end:true.
1058
1066
  * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1.sw
1059
1067
  * @example
1060
1068
  * ```js
@@ -1818,7 +1826,8 @@ var HostEvent;
1818
1826
  * - `autoDrillDown`: Optional. If `true`, the drill down will be done automatically
1819
1827
  * on the most popular column.
1820
1828
  * - `vizId` (TS >= 9.8.0): Optional. The GUID of the visualization to drill in case
1821
- * of a Liveboard. In Spotter embed, `vizId` refers to the Answer ID and is **required**.
1829
+ * of a Liveboard. In Spotter embed, `vizId` refers to the Answer ID and is
1830
+ * **required**.
1822
1831
  * @example
1823
1832
  * ```js
1824
1833
  * searchEmbed.on(EmbedEvent.VizPointDoubleClick, (payload) => {
@@ -2014,7 +2023,8 @@ var HostEvent;
2014
2023
  * the following parameters:
2015
2024
  *
2016
2025
  * @param - Includes the following keys:
2017
- * - `vizId`: GUID of the saved Answer or Spotter visualization ID to pin to a Liveboard.
2026
+ * - `vizId`: GUID of the saved Answer or Spotter visualization ID to pin to a
2027
+ * Liveboard.
2018
2028
  * Optional when pinning a new chart or table generated from a Search query.
2019
2029
  * **Required** in Spotter Embed.
2020
2030
  * - `liveboardId`: GUID of the Liveboard to pin an Answer. If there is no Liveboard,
@@ -2270,7 +2280,8 @@ var HostEvent;
2270
2280
  * This event is not supported in visualization embed and search embed.
2271
2281
  * @param - Object parameter. Includes the following keys:
2272
2282
  * - `vizId`: To trigger the action for a specific visualization in Liveboard embed,
2273
- * pass in `vizId` as a key. In Spotter embed, `vizId` refers to the Answer ID and is **required**.
2283
+ * pass in `vizId` as a key. In Spotter embed, `vizId` refers to the Answer ID and
2284
+ * is **required**.
2274
2285
  *
2275
2286
  * @example
2276
2287
  * ```js
@@ -2639,8 +2650,9 @@ var HostEvent;
2639
2650
  /**
2640
2651
  * Update one or several filters applied on a Liveboard.
2641
2652
  * @param - Includes the following keys:
2642
- * - `filter`: A single filter object containing column name, filter operator, and values.
2643
- * - `filters`: Multiple filter objects with column name, filter operator, and values for each.
2653
+ * - `filter`: A single filter object containing column name, filter operator, and
2654
+ * values. - `filters`: Multiple filter objects with column name, filter operator,
2655
+ * and values for each.
2644
2656
  *
2645
2657
  * Each filter object must include the following attributes:
2646
2658
  *
@@ -2909,8 +2921,8 @@ var HostEvent;
2909
2921
  * triggered with a modal to prompt users to
2910
2922
  * add a name and description for the Answer.
2911
2923
  * @param - Includes the following keys:
2912
- * - `vizId`: Refers to the Answer ID in Spotter embed and is **required** in Spotter embed.
2913
- * - `name`: Optional. Name string for the Answer.
2924
+ * - `vizId`: Refers to the Answer ID in Spotter embed and is **required** in Spotter
2925
+ * embed. - `name`: Optional. Name string for the Answer.
2914
2926
  * - `description`: Optional. Description text for the Answer.
2915
2927
  * @example
2916
2928
  * ```js
@@ -3105,8 +3117,9 @@ var HostEvent;
3105
3117
  /**
3106
3118
  * Triggers a new conversation in Spotter embed.
3107
3119
  *
3108
- * This feature is available only when chat history is enabled on your ThoughtSpot instance.
3109
- * Contact your admin or ThoughtSpot Support to enable chat history on your instance.
3120
+ * This feature is available only when chat history is enabled on your ThoughtSpot
3121
+ * instance. Contact your admin or ThoughtSpot Support to enable chat history on your
3122
+ * instance.
3110
3123
  *
3111
3124
  * @example
3112
3125
  * ```js
@@ -3152,6 +3165,7 @@ var DataSourceVisualMode;
3152
3165
  */
3153
3166
  var Param;
3154
3167
  (function (Param) {
3168
+ Param["Tsmcp"] = "tsmcp";
3155
3169
  Param["EmbedApp"] = "embedApp";
3156
3170
  Param["DataSources"] = "dataSources";
3157
3171
  Param["DataSourceMode"] = "dataSourceMode";
@@ -5046,7 +5060,9 @@ var ErrorDetailsTypes;
5046
5060
  ErrorDetailsTypes["NETWORK"] = "NETWORK";
5047
5061
  })(ErrorDetailsTypes || (ErrorDetailsTypes = {}));
5048
5062
  /**
5049
- * Error codes for identifying specific issues in embedded ThoughtSpot components. Use {@link EmbedErrorDetailsEvent} and {@link ErrorDetailsTypes} codes for precise error handling and debugging.
5063
+ * Error codes for identifying specific issues in embedded ThoughtSpot components. Use
5064
+ * {@link EmbedErrorDetailsEvent} and {@link ErrorDetailsTypes} codes for precise error
5065
+ * handling and debugging.
5050
5066
  *
5051
5067
  * @version SDK: 1.44.2 | ThoughtSpot: 26.2.0.cl
5052
5068
  * @group Error Handling
@@ -8289,7 +8305,6 @@ const validateAuthToken = async (embedConfig, authToken, suppressAlert) => {
8289
8305
  }
8290
8306
  if (cachedAuthToken && cachedAuthToken === authToken) {
8291
8307
  if (!embedConfig.suppressErrorAlerts && !suppressAlert) {
8292
- // eslint-disable-next-line no-alert
8293
8308
  alert(ERROR_MESSAGE.DUPLICATE_TOKEN_ERR);
8294
8309
  }
8295
8310
  throw new Error(ERROR_MESSAGE.DUPLICATE_TOKEN_ERR);
@@ -8721,7 +8736,6 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
8721
8736
  }`;
8722
8737
 
8723
8738
  // import YAML from 'yaml';
8724
- // eslint-disable-next-line no-shadow
8725
8739
  var OperationType;
8726
8740
  (function (OperationType) {
8727
8741
  OperationType["GetChartWithData"] = "GetChartWithData";
@@ -8737,10 +8751,11 @@ const DATA_TYPES = ['DATE', 'DATE_TIME', 'TIME'];
8737
8751
  *
8738
8752
  * You can use this service to:
8739
8753
  *
8740
- * - Add or remove columns from Answers (`addColumns`, `removeColumns`, `addColumnsByName`)
8741
- * - Apply filters to Answers (`addFilter`)
8742
- * - Get data from Answers in different formats (JSON, CSV, PNG) (`fetchData`, `fetchCSVBlob`, `fetchPNGBlob`)
8743
- * - Get data for specific points in visualizations (`getUnderlyingDataForPoint`)
8754
+ * - Add or remove columns from Answers (`addColumns`, `removeColumns`,
8755
+ * `addColumnsByName`) - Apply filters to Answers (`addFilter`)
8756
+ * - Get data from Answers in different formats (JSON, CSV, PNG) (`fetchData`,
8757
+ * `fetchCSVBlob`, `fetchPNGBlob`) - Get data for specific points in visualizations
8758
+ * (`getUnderlyingDataForPoint`)
8744
8759
  * - Run custom queries (`executeQuery`)
8745
8760
  * - Add visualizations to Liveboards (`addDisplayedVizToLiveboard`)
8746
8761
  *
@@ -9033,7 +9048,7 @@ class AnswerService {
9033
9048
  async getTML() {
9034
9049
  const { object } = await this.executeQuery(getAnswerTML, {});
9035
9050
  const edoc = object[0].edoc;
9036
- const YAML = await import('./index-DkizS4xM.js');
9051
+ const YAML = await import('./index-DyX-x6uN.js');
9037
9052
  const parsedDoc = YAML.parse(edoc);
9038
9053
  return {
9039
9054
  answer: {
@@ -9122,13 +9137,9 @@ function getSelectedPointsForUnderlyingDataQuery(selectedPoints) {
9122
9137
  */
9123
9138
  function getDisplayedViz(visualizations, displayMode) {
9124
9139
  if (displayMode === 'CHART_MODE') {
9125
- return visualizations.find(
9126
- // eslint-disable-next-line no-underscore-dangle
9127
- (viz) => viz.__typename === 'ChartViz');
9140
+ return visualizations.find((viz) => viz.__typename === 'ChartViz');
9128
9141
  }
9129
- return visualizations.find(
9130
- // eslint-disable-next-line no-underscore-dangle
9131
- (viz) => viz.__typename === 'TableViz');
9142
+ return visualizations.find((viz) => viz.__typename === 'TableViz');
9132
9143
  }
9133
9144
 
9134
9145
  /** Built-in value references. */
@@ -17475,11 +17486,8 @@ function resetAllCachedServices() {
17475
17486
  resetCachedPreauthInfo();
17476
17487
  }
17477
17488
 
17478
- // eslint-disable-next-line import/no-mutable-exports
17479
17489
  let loggedInStatus = false;
17480
- // eslint-disable-next-line import/no-mutable-exports
17481
17490
  let samlAuthWindow = null;
17482
- // eslint-disable-next-line import/no-mutable-exports
17483
17491
  let samlCompletionPromise = null;
17484
17492
  let releaseVersion = '';
17485
17493
  const SSO_REDIRECTION_MARKER_GUID = '5e16222e-ef02-43e9-9fbd-24226bf3ce5b';
@@ -18034,8 +18042,6 @@ function processTrigger(iFrame, messageType, thoughtSpotHost, data, context) {
18034
18042
  });
18035
18043
  }
18036
18044
 
18037
- /* eslint-disable camelcase */
18038
- /* eslint-disable import/no-mutable-exports */
18039
18045
  /**
18040
18046
  * Copyright (c) 2022
18041
18047
  *
@@ -18091,7 +18097,6 @@ const hostUrlToFeatureUrl = {
18091
18097
  const prefetch = (url, prefetchFeatures, additionalFlags) => {
18092
18098
  var _a;
18093
18099
  if (url === '') {
18094
- // eslint-disable-next-line no-console
18095
18100
  logger$3.warn('The prefetch method does not have a valid URL');
18096
18101
  }
18097
18102
  else {
@@ -18111,9 +18116,9 @@ const prefetch = (url, prefetchFeatures, additionalFlags) => {
18111
18116
  iFrame.style.width = '0';
18112
18117
  iFrame.style.height = '0';
18113
18118
  iFrame.style.border = '0';
18114
- // Make it 'fixed' to keep it in a different stacking context.
18115
- // This should solve the focus behaviours inside the iframe from
18116
- // interfering with main body.
18119
+ // Make it 'fixed' to keep it in a different stacking
18120
+ // context. This should solve the focus behaviours inside
18121
+ // the iframe from interfering with main body.
18117
18122
  iFrame.style.position = 'fixed';
18118
18123
  // Push it out of viewport.
18119
18124
  iFrame.style.top = '100vh';
@@ -18262,7 +18267,7 @@ const renderInQueue = (fn) => {
18262
18267
  return renderQueue;
18263
18268
  }
18264
18269
  // Sending an empty function to keep it consistent with the above usage.
18265
- return fn(() => { }); // eslint-disable-line @typescript-eslint/no-empty-function
18270
+ return fn(() => { });
18266
18271
  };
18267
18272
  /**
18268
18273
  * Imports TML representation of the metadata objects into ThoughtSpot.
@@ -18455,10 +18460,8 @@ function processNoCookieAccess(e, containerEl) {
18455
18460
  const { loginFailedMessage, suppressNoCookieAccessAlert, ignoreNoCookieAccess, suppressErrorAlerts, } = getEmbedConfig();
18456
18461
  if (!ignoreNoCookieAccess) {
18457
18462
  if (!suppressNoCookieAccessAlert && !suppressErrorAlerts) {
18458
- // eslint-disable-next-line no-alert
18459
18463
  alert(ERROR_MESSAGE.THIRD_PARTY_COOKIE_BLOCKED_ALERT);
18460
18464
  }
18461
- // eslint-disable-next-line no-param-reassign
18462
18465
  containerEl.innerHTML = loginFailedMessage;
18463
18466
  }
18464
18467
  notifyAuthFailure(AuthFailureType.NO_COOKIE_ACCESS);
@@ -18476,12 +18479,10 @@ function processAuthFailure(e, containerEl) {
18476
18479
  const isTrustedAuth = authType === AuthType.TrustedAuthToken || authType === AuthType.TrustedAuthTokenCookieless;
18477
18480
  const isEmbeddedSSOInfoFailure = isEmbeddedSSO && ((_a = e === null || e === void 0 ? void 0 : e.data) === null || _a === void 0 ? void 0 : _a.type) === AuthFailureType.UNAUTHENTICATED_FAILURE;
18478
18481
  if (autoLogin && isTrustedAuth) {
18479
- // eslint-disable-next-line no-param-reassign
18480
18482
  containerEl.innerHTML = loginFailedMessage;
18481
18483
  notifyAuthFailure(AuthFailureType.IDLE_SESSION_TIMEOUT);
18482
18484
  }
18483
18485
  else if (authType !== AuthType.None && !disableLoginFailurePage && !isEmbeddedSSOInfoFailure) {
18484
- // eslint-disable-next-line no-param-reassign
18485
18486
  containerEl.innerHTML = loginFailedMessage;
18486
18487
  notifyAuthFailure(AuthFailureType.OTHER);
18487
18488
  }
@@ -18495,7 +18496,6 @@ function processAuthFailure(e, containerEl) {
18495
18496
  */
18496
18497
  function processAuthLogout(e, containerEl) {
18497
18498
  const { loginFailedMessage } = getEmbedConfig();
18498
- // eslint-disable-next-line no-param-reassign
18499
18499
  containerEl.innerHTML = loginFailedMessage;
18500
18500
  resetCachedAuthToken();
18501
18501
  disableAutoLogin();
@@ -18529,7 +18529,7 @@ function processEventData(type, eventData, thoughtSpotHost, containerEl) {
18529
18529
  return eventData;
18530
18530
  }
18531
18531
 
18532
- var name="@thoughtspot/visual-embed-sdk";var version$1="1.46.2";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 || echo 'Warning: Coveralls upload failed but not breaking the build.'","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.23","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":"^30.0.0","@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":"^30.2.0","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:"^30.2.0","jest-environment-jsdom":"^29.7.0","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":"^29.4.6","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};
18532
+ var name="@thoughtspot/visual-embed-sdk";var version$1="1.46.3";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 || echo 'Warning: Coveralls upload failed but not breaking the build.'","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.23","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":"^30.0.0","@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":"^30.2.0","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:"^30.2.0","jest-environment-jsdom":"^29.7.0","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":"^29.4.6","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};
18533
18533
 
18534
18534
  class HostEventClient {
18535
18535
  constructor(iFrame) {
@@ -18553,14 +18553,12 @@ class HostEventClient {
18553
18553
  const response = (_b = (_a = (await this.triggerUIPassthroughApi(apiName, parameters, context))) === null || _a === void 0 ? void 0 : _a.filter) === null || _b === void 0 ? void 0 : _b.call(_a, (r) => r.error || r.value)[0];
18554
18554
  if (!response) {
18555
18555
  const error = `No answer found${parameters.vizId ? ` for vizId: ${parameters.vizId}` : ''}.`;
18556
- // eslint-disable-next-line no-throw-literal
18557
18556
  throw { error };
18558
18557
  }
18559
18558
  const errors = response.error
18560
18559
  || ((_c = response.value) === null || _c === void 0 ? void 0 : _c.errors)
18561
18560
  || ((_d = response.value) === null || _d === void 0 ? void 0 : _d.error);
18562
18561
  if (errors) {
18563
- // eslint-disable-next-line no-throw-literal
18564
18562
  throw { error: response.error };
18565
18563
  }
18566
18564
  return { ...response.value };
@@ -18902,7 +18900,8 @@ class TsEmbed {
18902
18900
  */
18903
18901
  this.updateAuthToken = async (_, responder) => {
18904
18902
  const { authType, autoLogin: autoLoginConfig } = this.embedConfig;
18905
- // Default autoLogin: true for cookieless if undefined/null, otherwise false
18903
+ // Default autoLogin: true for cookieless if undefined/null, otherwise
18904
+ // false
18906
18905
  const autoLogin = autoLoginConfig !== null && autoLoginConfig !== void 0 ? autoLoginConfig : (authType === AuthType.TrustedAuthTokenCookieless);
18907
18906
  try {
18908
18907
  await this.refreshAuthTokenForCookieless(responder, EmbedEvent.AuthExpire, false);
@@ -20807,7 +20806,6 @@ class AppEmbed extends V1Embed {
20807
20806
  }
20808
20807
  }
20809
20808
 
20810
- /* eslint-disable quotes */
20811
20809
  const getPreviewQuery = `
20812
20810
  query GetEurekaVizSnapshots(
20813
20811
  $vizId: String!, $liveboardId: String!) {
@@ -21093,8 +21091,9 @@ class LiveboardEmbed extends V1Embed {
21093
21091
  return params;
21094
21092
  }
21095
21093
  getIframeSuffixSrc(liveboardId, vizId, activeTabId, personalizedViewId) {
21096
- // Extract view from liveboardId if passed along with it (legacy approach)
21097
- // View must be appended as query param at the end, not embedded in path
21094
+ // Extract view from liveboardId if passed along with it (legacy
21095
+ // approach) View must be appended as query param at the end, not
21096
+ // embedded in path
21098
21097
  let liveboardGuid = liveboardId;
21099
21098
  let legacyViewId;
21100
21099
  if (liveboardId === null || liveboardId === void 0 ? void 0 : liveboardId.includes('?')) {
@@ -21103,7 +21102,8 @@ class LiveboardEmbed extends V1Embed {
21103
21102
  const params = new URLSearchParams(query);
21104
21103
  legacyViewId = params.get('view') || undefined;
21105
21104
  }
21106
- // personalizedViewId takes precedence over legacyViewId (when passed as part of liveboardId)
21105
+ // personalizedViewId takes precedence over legacyViewId (when passed
21106
+ // as part of liveboardId)
21107
21107
  const effectiveViewId = personalizedViewId || legacyViewId;
21108
21108
  let suffix = `/embed/viz/${liveboardGuid}`;
21109
21109
  if (activeTabId) {
@@ -22225,7 +22225,6 @@ class ConversationEmbed extends SpotterEmbed {
22225
22225
  * @group Embed components
22226
22226
  */
22227
22227
  class SageEmbed extends V1Embed {
22228
- // eslint-disable-next-line no-useless-constructor
22229
22228
  constructor(domSelector, viewConfig) {
22230
22229
  viewConfig.embedComponentType = 'SageEmbed';
22231
22230
  super(domSelector, viewConfig);
@@ -22814,4 +22813,142 @@ const createLiveboardWithAnswers = async (answers, name) => {
22814
22813
  return result;
22815
22814
  };
22816
22815
 
22817
- export { Action, AnswerService, AppEmbed, AuthEvent, AuthFailureType, AuthStatus, AuthType, BodylessConversation, ContextMenuTriggerOptions, ContextType, ConversationEmbed, CustomActionTarget, CustomActionsPosition, DataPanelCustomColumnGroupsAccordionState$1 as DataPanelCustomColumnGroupsAccordionState, DataSourceVisualMode, EmbedErrorCodes, EmbedEvent, ErrorDetailsTypes, 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, reloadIframe, resetCachedAuthToken, tokenizedFetch, uploadMixpanelEvent };
22816
+ /**
22817
+ * Starts an automatic renderer that watches the DOM for iframes containing
22818
+ * the `tsmcp=true` query parameter and replaces them with fully configured
22819
+ * ThoughtSpot embed iframes. The query parameter is automatically added by
22820
+ * the ThoughtSpot MCP server.
22821
+ *
22822
+ * A {@link MutationObserver} is set up on `document.body` to detect both
22823
+ * directly added iframes and iframes nested within added container elements.
22824
+ * Each matching iframe is replaced in-place with a new ThoughtSpot embed
22825
+ * iframe that merges the original iframe's query parameters with the SDK
22826
+ * embed parameters.
22827
+ *
22828
+ * Call {@link MutationObserver.disconnect | observer.disconnect()} on the
22829
+ * returned observer to stop monitoring the DOM.
22830
+ *
22831
+ * @param viewConfig - Optional configuration for the auto-rendered embeds.
22832
+ * Accepts all properties from {@link AutoMCPFrameRendererViewConfig}.
22833
+ * Defaults to an empty config.
22834
+ * @returns A {@link MutationObserver} instance that is actively observing
22835
+ * `document.body`. Disconnect it when monitoring is no longer needed.
22836
+ *
22837
+ * @example
22838
+ * ```js
22839
+ * import { startAutoMCPFrameRenderer } from '@thoughtspot/visual-embed-sdk';
22840
+ *
22841
+ * // Start watching the DOM for tsmcp iframes
22842
+ * const observer = startAutoMCPFrameRenderer({
22843
+ * // optional view config overrides
22844
+ * });
22845
+ *
22846
+ * // Later, stop watching
22847
+ * observer.disconnect();
22848
+ * ```
22849
+ *
22850
+ * @example
22851
+ * Detailed example of how to use the auto-frame renderer:
22852
+ * [Python React Agent Simple UI](https://github.com/thoughtspot/developer-examples/tree/main/mcp/python-react-agent-simple-ui)
22853
+ */
22854
+ function startAutoMCPFrameRenderer(viewConfig = {}) {
22855
+ const replaceWithMCPIframe = (iframe) => {
22856
+ const autoMCPFrameRenderer = new AutoFrameRenderer(viewConfig);
22857
+ autoMCPFrameRenderer.replaceIframe(iframe);
22858
+ };
22859
+ const observer = new MutationObserver((mutations) => {
22860
+ for (const mutation of mutations) {
22861
+ for (const node of Array.from(mutation.addedNodes)) {
22862
+ if (node instanceof HTMLIFrameElement && isTSMCPIframe(node)) {
22863
+ replaceWithMCPIframe(node);
22864
+ }
22865
+ if (node instanceof HTMLElement) {
22866
+ node.querySelectorAll('iframe').forEach((iframe) => {
22867
+ if (isTSMCPIframe(iframe)) {
22868
+ replaceWithMCPIframe(iframe);
22869
+ }
22870
+ });
22871
+ }
22872
+ }
22873
+ }
22874
+ });
22875
+ observer.observe(document.body, { childList: true, subtree: true });
22876
+ return observer;
22877
+ }
22878
+ function isTSMCPIframe(iframe) {
22879
+ try {
22880
+ const url = new URL(iframe.src);
22881
+ return url.searchParams.get(Param.Tsmcp) === 'true';
22882
+ }
22883
+ catch (e) {
22884
+ // The iframe src might not be a valid URL (e.g., 'about:blank').
22885
+ return false;
22886
+ }
22887
+ }
22888
+ /**
22889
+ * Embed component that automatically replaces a plain iframe with a
22890
+ * ThoughtSpot embed iframe. It merges the SDK's embed parameters with
22891
+ * the original iframe's query parameters (stripping the `tsmcp` marker)
22892
+ * and swaps the original iframe element in the DOM.
22893
+ *
22894
+ * This class is used internally by {@link startAutoMCPFrameRenderer} and
22895
+ * is not intended to be instantiated directly.
22896
+ */
22897
+ class AutoFrameRenderer extends TsEmbed {
22898
+ constructor(viewConfig) {
22899
+ viewConfig.embedComponentType = 'auto-frame-renderer';
22900
+ const container = document.createElement('div');
22901
+ super(container, viewConfig);
22902
+ this.viewConfig = viewConfig;
22903
+ }
22904
+ /**
22905
+ * Builds the final iframe `src` by merging the SDK embed parameters
22906
+ * with the query parameters already present on the source iframe URL.
22907
+ * The `tsmcp` marker param is removed so it does not propagate to the
22908
+ * ThoughtSpot application.
22909
+ *
22910
+ * @param sourceSrc - The original iframe's `src` URL string.
22911
+ * @returns The constructed URL to use for the ThoughtSpot embed iframe.
22912
+ */
22913
+ getMCPIframeSrc(sourceSrc) {
22914
+ const queryParams = this.getEmbedParamsObject();
22915
+ const sourceURL = new URL(sourceSrc);
22916
+ const existingQueryParams = sourceURL.searchParams;
22917
+ const existingQueryParamsObject = Object.fromEntries(existingQueryParams);
22918
+ delete existingQueryParamsObject[Param.Tsmcp];
22919
+ const mergedQueryParams = { ...queryParams, ...existingQueryParamsObject };
22920
+ const mergedQueryParamsString = getQueryParamString(mergedQueryParams);
22921
+ const frameSrc = `${this.getEmbedBasePath(mergedQueryParamsString)}${sourceURL.hash.replace('#', '')}`;
22922
+ return frameSrc;
22923
+ }
22924
+ /**
22925
+ * Overrides the base insertion behavior so the new embed iframe
22926
+ * replaces the original iframe in-place rather than being appended
22927
+ * to a container element. Falls back to the default behavior when
22928
+ * no iframe has been set for replacement.
22929
+ */
22930
+ handleInsertionIntoDOM(child) {
22931
+ if (this.frameToReplace) {
22932
+ this.frameToReplace.replaceWith(child);
22933
+ }
22934
+ else {
22935
+ super.handleInsertionIntoDOM(child);
22936
+ }
22937
+ }
22938
+ /**
22939
+ * Replaces the given iframe with a new ThoughtSpot embed iframe.
22940
+ *
22941
+ * The original iframe's `src` is used to derive the embed URL, and
22942
+ * once the new iframe is rendered it takes the original's place in
22943
+ * the DOM tree.
22944
+ *
22945
+ * @param iframe - The existing `<iframe>` element to replace.
22946
+ */
22947
+ async replaceIframe(iframe) {
22948
+ this.frameToReplace = iframe;
22949
+ const src = this.getMCPIframeSrc(iframe.src);
22950
+ await this.renderIFrame(src);
22951
+ }
22952
+ }
22953
+
22954
+ export { Action, AnswerService, AppEmbed, AuthEvent, AuthFailureType, AuthStatus, AuthType, BodylessConversation, ContextMenuTriggerOptions, ContextType, ConversationEmbed, CustomActionTarget, CustomActionsPosition, DataPanelCustomColumnGroupsAccordionState$1 as DataPanelCustomColumnGroupsAccordionState, DataSourceVisualMode, EmbedErrorCodes, EmbedEvent, ErrorDetailsTypes, 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, reloadIframe, resetCachedAuthToken, startAutoMCPFrameRenderer, tokenizedFetch, uploadMixpanelEvent };