@thoughtspot/visual-embed-sdk 1.37.0 → 1.37.1-spotter-embed

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 (173) hide show
  1. package/cjs/package.json +3 -3
  2. package/cjs/src/auth.d.ts +9 -4
  3. package/cjs/src/auth.d.ts.map +1 -1
  4. package/cjs/src/auth.js +21 -0
  5. package/cjs/src/auth.js.map +1 -1
  6. package/cjs/src/auth.spec.js +48 -0
  7. package/cjs/src/auth.spec.js.map +1 -1
  8. package/cjs/src/embed/app.d.ts +59 -0
  9. package/cjs/src/embed/app.d.ts.map +1 -1
  10. package/cjs/src/embed/app.js +13 -1
  11. package/cjs/src/embed/app.js.map +1 -1
  12. package/cjs/src/embed/app.spec.js +44 -0
  13. package/cjs/src/embed/app.spec.js.map +1 -1
  14. package/cjs/src/embed/bodyless-conversation.d.ts +39 -9
  15. package/cjs/src/embed/bodyless-conversation.d.ts.map +1 -1
  16. package/cjs/src/embed/bodyless-conversation.js +32 -5
  17. package/cjs/src/embed/bodyless-conversation.js.map +1 -1
  18. package/cjs/src/embed/bodyless-conversation.spec.js +4 -4
  19. package/cjs/src/embed/bodyless-conversation.spec.js.map +1 -1
  20. package/cjs/src/embed/conversation.d.ts +38 -11
  21. package/cjs/src/embed/conversation.d.ts.map +1 -1
  22. package/cjs/src/embed/conversation.js +28 -4
  23. package/cjs/src/embed/conversation.js.map +1 -1
  24. package/cjs/src/embed/conversation.spec.js +7 -7
  25. package/cjs/src/embed/conversation.spec.js.map +1 -1
  26. package/cjs/src/embed/ts-embed.d.ts.map +1 -1
  27. package/cjs/src/embed/ts-embed.js +4 -1
  28. package/cjs/src/embed/ts-embed.js.map +1 -1
  29. package/cjs/src/embed/ts-embed.spec.d.ts.map +1 -1
  30. package/cjs/src/embed/ts-embed.spec.js.map +1 -1
  31. package/cjs/src/index.d.ts +3 -3
  32. package/cjs/src/index.d.ts.map +1 -1
  33. package/cjs/src/index.js +5 -3
  34. package/cjs/src/index.js.map +1 -1
  35. package/cjs/src/pages/embed-test.page.d.ts +8 -0
  36. package/cjs/src/pages/embed-test.page.d.ts.map +1 -0
  37. package/cjs/src/pages/embed-test.page.js +20 -0
  38. package/cjs/src/pages/embed-test.page.js.map +1 -0
  39. package/cjs/src/pages/home.page.d.ts +6 -0
  40. package/cjs/src/pages/home.page.d.ts.map +1 -0
  41. package/cjs/src/pages/home.page.js +12 -0
  42. package/cjs/src/pages/home.page.js.map +1 -0
  43. package/cjs/src/pages/login.page.d.ts +15 -0
  44. package/cjs/src/pages/login.page.d.ts.map +1 -0
  45. package/cjs/src/pages/login.page.js +22 -0
  46. package/cjs/src/pages/login.page.js.map +1 -0
  47. package/cjs/src/react/all-types-export.d.ts +1 -1
  48. package/cjs/src/react/all-types-export.d.ts.map +1 -1
  49. package/cjs/src/react/all-types-export.js +2 -1
  50. package/cjs/src/react/all-types-export.js.map +1 -1
  51. package/cjs/src/react/index.d.ts +24 -5
  52. package/cjs/src/react/index.d.ts.map +1 -1
  53. package/cjs/src/react/index.js +21 -4
  54. package/cjs/src/react/index.js.map +1 -1
  55. package/cjs/src/tests/auth.test.d.ts +1 -0
  56. package/cjs/src/tests/auth.test.d.ts.map +1 -0
  57. package/cjs/src/tests/auth.test.js +1 -0
  58. package/cjs/src/tests/auth.test.js.map +1 -0
  59. package/cjs/src/tests/e2e/auth.spec.d.ts +2 -0
  60. package/cjs/src/tests/e2e/auth.spec.d.ts.map +1 -0
  61. package/cjs/src/tests/e2e/auth.spec.js +54 -0
  62. package/cjs/src/tests/e2e/auth.spec.js.map +1 -0
  63. package/cjs/src/types.d.ts +95 -3
  64. package/cjs/src/types.d.ts.map +1 -1
  65. package/cjs/src/types.js +79 -0
  66. package/cjs/src/types.js.map +1 -1
  67. package/cjs/src/utils/graphql/answerService/answerService.d.ts +35 -15
  68. package/cjs/src/utils/graphql/answerService/answerService.d.ts.map +1 -1
  69. package/cjs/src/utils/graphql/answerService/answerService.js +35 -15
  70. package/cjs/src/utils/graphql/answerService/answerService.js.map +1 -1
  71. package/cjs/src/utils/processData.js +6 -4
  72. package/cjs/src/utils/processData.js.map +1 -1
  73. package/dist/index-Cj4BVGHL.js +7371 -0
  74. package/dist/index-DUaG1OG2.js +7447 -0
  75. package/dist/index-Fhk1V_Gw.js +7371 -0
  76. package/dist/index-OuiZF3zE.js +7371 -0
  77. package/dist/src/auth.d.ts +9 -4
  78. package/dist/src/auth.d.ts.map +1 -1
  79. package/dist/src/embed/app.d.ts +59 -0
  80. package/dist/src/embed/app.d.ts.map +1 -1
  81. package/dist/src/embed/bodyless-conversation.d.ts +39 -9
  82. package/dist/src/embed/bodyless-conversation.d.ts.map +1 -1
  83. package/dist/src/embed/conversation.d.ts +38 -11
  84. package/dist/src/embed/conversation.d.ts.map +1 -1
  85. package/dist/src/embed/ts-embed.d.ts.map +1 -1
  86. package/dist/src/embed/ts-embed.spec.d.ts.map +1 -1
  87. package/dist/src/index.d.ts +3 -3
  88. package/dist/src/index.d.ts.map +1 -1
  89. package/dist/src/react/all-types-export.d.ts +1 -1
  90. package/dist/src/react/all-types-export.d.ts.map +1 -1
  91. package/dist/src/react/index.d.ts +24 -5
  92. package/dist/src/react/index.d.ts.map +1 -1
  93. package/dist/src/types.d.ts +95 -3
  94. package/dist/src/types.d.ts.map +1 -1
  95. package/dist/src/utils/graphql/answerService/answerService.d.ts +35 -15
  96. package/dist/src/utils/graphql/answerService/answerService.d.ts.map +1 -1
  97. package/dist/tsembed-react.es.js +208 -31
  98. package/dist/tsembed-react.js +428 -174
  99. package/dist/tsembed.es.js +170 -32
  100. package/dist/tsembed.js +392 -176
  101. package/dist/visual-embed-sdk-react-full.d.ts +299 -47
  102. package/dist/visual-embed-sdk-react.d.ts +299 -47
  103. package/dist/visual-embed-sdk.d.ts +276 -43
  104. package/lib/package.json +3 -3
  105. package/lib/src/auth.d.ts +9 -4
  106. package/lib/src/auth.d.ts.map +1 -1
  107. package/lib/src/auth.js +21 -0
  108. package/lib/src/auth.js.map +1 -1
  109. package/lib/src/auth.spec.js +48 -0
  110. package/lib/src/auth.spec.js.map +1 -1
  111. package/lib/src/embed/app.d.ts +59 -0
  112. package/lib/src/embed/app.d.ts.map +1 -1
  113. package/lib/src/embed/app.js +13 -1
  114. package/lib/src/embed/app.js.map +1 -1
  115. package/lib/src/embed/app.spec.js +44 -0
  116. package/lib/src/embed/app.spec.js.map +1 -1
  117. package/lib/src/embed/bodyless-conversation.d.ts +39 -9
  118. package/lib/src/embed/bodyless-conversation.d.ts.map +1 -1
  119. package/lib/src/embed/bodyless-conversation.js +30 -4
  120. package/lib/src/embed/bodyless-conversation.js.map +1 -1
  121. package/lib/src/embed/bodyless-conversation.spec.js +5 -5
  122. package/lib/src/embed/bodyless-conversation.spec.js.map +1 -1
  123. package/lib/src/embed/conversation.d.ts +38 -11
  124. package/lib/src/embed/conversation.d.ts.map +1 -1
  125. package/lib/src/embed/conversation.js +26 -3
  126. package/lib/src/embed/conversation.js.map +1 -1
  127. package/lib/src/embed/conversation.spec.js +8 -8
  128. package/lib/src/embed/conversation.spec.js.map +1 -1
  129. package/lib/src/embed/ts-embed.d.ts.map +1 -1
  130. package/lib/src/embed/ts-embed.js +4 -1
  131. package/lib/src/embed/ts-embed.js.map +1 -1
  132. package/lib/src/embed/ts-embed.spec.d.ts.map +1 -1
  133. package/lib/src/embed/ts-embed.spec.js.map +1 -1
  134. package/lib/src/index.d.ts +3 -3
  135. package/lib/src/index.d.ts.map +1 -1
  136. package/lib/src/index.js +3 -3
  137. package/lib/src/index.js.map +1 -1
  138. package/lib/src/react/all-types-export.d.ts +1 -1
  139. package/lib/src/react/all-types-export.d.ts.map +1 -1
  140. package/lib/src/react/all-types-export.js +1 -1
  141. package/lib/src/react/all-types-export.js.map +1 -1
  142. package/lib/src/react/index.d.ts +24 -5
  143. package/lib/src/react/index.d.ts.map +1 -1
  144. package/lib/src/react/index.js +21 -4
  145. package/lib/src/react/index.js.map +1 -1
  146. package/lib/src/types.d.ts +95 -3
  147. package/lib/src/types.d.ts.map +1 -1
  148. package/lib/src/types.js +79 -0
  149. package/lib/src/types.js.map +1 -1
  150. package/lib/src/utils/graphql/answerService/answerService.d.ts +35 -15
  151. package/lib/src/utils/graphql/answerService/answerService.d.ts.map +1 -1
  152. package/lib/src/utils/graphql/answerService/answerService.js +35 -15
  153. package/lib/src/utils/graphql/answerService/answerService.js.map +1 -1
  154. package/lib/src/utils/processData.js +6 -4
  155. package/lib/src/utils/processData.js.map +1 -1
  156. package/lib/src/visual-embed-sdk.d.ts +278 -45
  157. package/package.json +3 -3
  158. package/src/auth.spec.ts +52 -0
  159. package/src/auth.ts +25 -3
  160. package/src/embed/app.spec.ts +64 -0
  161. package/src/embed/app.ts +80 -0
  162. package/src/embed/bodyless-conversation.spec.ts +6 -6
  163. package/src/embed/bodyless-conversation.ts +43 -8
  164. package/src/embed/conversation.spec.ts +16 -16
  165. package/src/embed/conversation.ts +42 -11
  166. package/src/embed/ts-embed.spec.ts +0 -2
  167. package/src/embed/ts-embed.ts +4 -0
  168. package/src/index.ts +8 -4
  169. package/src/react/all-types-export.ts +1 -0
  170. package/src/react/index.tsx +36 -10
  171. package/src/types.ts +99 -1
  172. package/src/utils/graphql/answerService/answerService.ts +35 -15
  173. package/src/utils/processData.ts +6 -6
@@ -1,4 +1,4 @@
1
- /* @thoughtspot/visual-embed-sdk version 1.37.0 */
1
+ /* @thoughtspot/visual-embed-sdk version 1.37.1-spotter-embed */
2
2
  'use client';
3
3
  (function (global, factory) {
4
4
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react')) :
@@ -163,7 +163,7 @@
163
163
  }
164
164
  return false;
165
165
  };
166
- const merge = (...objects) => objects.reduce((result, current) => {
166
+ const merge$1 = (...objects) => objects.reduce((result, current) => {
167
167
  if (Array.isArray(current)) {
168
168
  throw new TypeError("Arguments provided to ts-deepmerge must be objects, not arrays.");
169
169
  }
@@ -172,19 +172,19 @@
172
172
  return;
173
173
  }
174
174
  if (Array.isArray(result[key]) && Array.isArray(current[key])) {
175
- result[key] = merge.options.mergeArrays
176
- ? merge.options.uniqueArrayItems
175
+ result[key] = merge$1.options.mergeArrays
176
+ ? merge$1.options.uniqueArrayItems
177
177
  ? Array.from(new Set(result[key].concat(current[key])))
178
178
  : [...result[key], ...current[key]]
179
179
  : current[key];
180
180
  }
181
181
  else if (isObject$1(result[key]) && isObject$1(current[key])) {
182
- result[key] = merge(result[key], current[key]);
182
+ result[key] = merge$1(result[key], current[key]);
183
183
  }
184
184
  else {
185
185
  result[key] =
186
186
  current[key] === undefined
187
- ? merge.options.allowUndefinedOverrides
187
+ ? merge$1.options.allowUndefinedOverrides
188
188
  ? current[key]
189
189
  : result[key]
190
190
  : current[key];
@@ -197,11 +197,11 @@
197
197
  mergeArrays: true,
198
198
  uniqueArrayItems: true,
199
199
  };
200
- merge.options = defaultOptions;
201
- merge.withOptions = (options, ...objects) => {
202
- merge.options = Object.assign(Object.assign({}, defaultOptions), options);
203
- const result = merge(...objects);
204
- merge.options = defaultOptions;
200
+ merge$1.options = defaultOptions;
201
+ merge$1.withOptions = (options, ...objects) => {
202
+ merge$1.options = Object.assign(Object.assign({}, defaultOptions), options);
203
+ const result = merge$1(...objects);
204
+ merge$1.options = defaultOptions;
205
205
  return result;
206
206
  };
207
207
 
@@ -402,7 +402,7 @@
402
402
  function getDOMNode(domSelector) {
403
403
  return typeof domSelector === 'string' ? document.querySelector(domSelector) : domSelector;
404
404
  }
405
- const deepMerge = (target, source) => merge(target, source);
405
+ const deepMerge = (target, source) => merge$1(target, source);
406
406
  const getOperationNameFromQuery = (query) => {
407
407
  const regex = /(?:query|mutation)\s+(\w+)/;
408
408
  const matches = query.match(regex);
@@ -712,6 +712,18 @@
712
712
  * @version SDK: 1.34.0| ThoughtSpot: 10.3.0.cl
713
713
  */
714
714
  HomeLeftNavItem["LiveboardSchedules"] = "liveboard-schedules";
715
+ /**
716
+ * Create new options in the insights left navigation,
717
+ * available when new navigation V3 is enabled.
718
+ * @version SDK: 1.39.0 | ThoughtSpot: 10.10.0.cl
719
+ */
720
+ HomeLeftNavItem["Create"] = "create";
721
+ /**
722
+ * Spotter option in the insights left navigation,
723
+ * available when new navigation V3 is enabled.
724
+ * @version SDK: 1.39.0 | ThoughtSpot: 10.10.0.cl
725
+ */
726
+ HomeLeftNavItem["Spotter"] = "spotter";
715
727
  })(exports.HomeLeftNavItem || (exports.HomeLeftNavItem = {}));
716
728
  /**
717
729
  * A map of the supported runtime filter operations
@@ -2794,8 +2806,17 @@
2794
2806
  /**
2795
2807
  * Get the Answer session for a Search or
2796
2808
  * Liveboard visualization.
2809
+ *
2810
+ * Note: This event is not typically used directly. Instead, use the
2811
+ * `getAnswerService()` method on the embed instance to get an AnswerService
2812
+ * object that provides a more convenient interface for working with answers.
2813
+ *
2797
2814
  * @example
2798
2815
  * ```js
2816
+ * // Preferred way to get an AnswerService
2817
+ * const service = await embed.getAnswerService();
2818
+ *
2819
+ * // Alternative direct usage (not recommended)
2799
2820
  * const {session} = await embed.trigger(
2800
2821
  * HostEvent.GetAnswerSession, {
2801
2822
  * vizId: '123', // For Liveboard Visualization.
@@ -2803,6 +2824,10 @@
2803
2824
  * ```
2804
2825
  * @example
2805
2826
  * ```js
2827
+ * // Preferred way to get an AnswerService
2828
+ * const service = await embed.getAnswerService();
2829
+ *
2830
+ * // Alternative direct usage (not recommended)
2806
2831
  * const {session} = await embed.trigger( HostEvent.GetAnswerSession )
2807
2832
  * ```
2808
2833
  * @version SDK: 1.26.0 | ThoughtSpot: 9.10.0.cl, 10.1.0.sw
@@ -2931,6 +2956,54 @@
2931
2956
  * @version SDK: 1.37.0 | ThoughtSpot: 10.8.0.cl
2932
2957
  */
2933
2958
  HostEvent["TransformTableVizData"] = "TransformTableVizData";
2959
+ /**
2960
+ * Triggers the table visualization re-render with the updated data.
2961
+ * Includes the following properties:
2962
+ * @param - `columnDataLite` - an array of object containing the
2963
+ * data value modifications retrieved from the `EmbedEvent.TableVizRendered`
2964
+ * payload.For example, { columnDataLite: []}`.
2965
+ */
2966
+ HostEvent["SpotterSearch"] = "SpotterSearch";
2967
+ /**
2968
+ * Triggers the table visualization re-render with the updated data.
2969
+ * Includes the following properties:
2970
+ * @param - `columnDataLite` - an array of object containing the
2971
+ * data value modifications retrieved from the `EmbedEvent.TableVizRendered`
2972
+ * payload.For example, { columnDataLite: []}`.
2973
+ */
2974
+ HostEvent["EditLastPrompt"] = "EditLastPrompt";
2975
+ /**
2976
+ * Triggers the table visualization re-render with the updated data.
2977
+ * Includes the following properties:
2978
+ * @param - `columnDataLite` - an array of object containing the
2979
+ * data value modifications retrieved from the `EmbedEvent.TableVizRendered`
2980
+ * payload.For example, { columnDataLite: []}`.
2981
+ */
2982
+ HostEvent["PreviewSpotterData"] = "PreviewSpotterData";
2983
+ /**
2984
+ * Triggers the table visualization re-render with the updated data.
2985
+ * Includes the following properties:
2986
+ * @param - `columnDataLite` - an array of object containing the
2987
+ * data value modifications retrieved from the `EmbedEvent.TableVizRendered`
2988
+ * payload.For example, { columnDataLite: []}`.
2989
+ */
2990
+ HostEvent["ResetSpotterConversation"] = "ResetSpotterConversation";
2991
+ /**
2992
+ * Triggers the table visualization re-render with the updated data.
2993
+ * Includes the following properties:
2994
+ * @param - `columnDataLite` - an array of object containing the
2995
+ * data value modifications retrieved from the `EmbedEvent.TableVizRendered`
2996
+ * payload.For example, { columnDataLite: []}`.
2997
+ */
2998
+ HostEvent["DeleteLastPrompt"] = "DeleteLastPrompt";
2999
+ /**
3000
+ * Triggers the table visualization re-render with the updated data.
3001
+ * Includes the following properties:
3002
+ * @param - `columnDataLite` - an array of object containing the
3003
+ * data value modifications retrieved from the `EmbedEvent.TableVizRendered`
3004
+ * payload.For example, { columnDataLite: []}`.
3005
+ */
3006
+ HostEvent["AnswerChartSwitcher"] = "answerChartSwitcher";
2934
3007
  })(exports.HostEvent || (exports.HostEvent = {}));
2935
3008
  /**
2936
3009
  * The different visual modes that the data sources panel within
@@ -3011,6 +3084,10 @@
3011
3084
  Param["ShowInsertToSlide"] = "insertInToSlide";
3012
3085
  Param["PrimaryNavHidden"] = "primaryNavHidden";
3013
3086
  Param["HideProfleAndHelp"] = "profileAndHelpInNavBarHidden";
3087
+ Param["NavigationVersion"] = "navigationVersion";
3088
+ Param["HideHamburger"] = "hideHamburger";
3089
+ Param["HideObjectSearch"] = "hideObjectSearch";
3090
+ Param["HideNotification"] = "hideNotification";
3014
3091
  Param["HideApplicationSwitcher"] = "applicationSwitcherHidden";
3015
3092
  Param["HideOrgSwitcher"] = "orgSwitcherHidden";
3016
3093
  Param["IsSageEmbed"] = "isSageEmbed";
@@ -3067,6 +3144,8 @@
3067
3144
  Param["preAuthCache"] = "preAuthCache";
3068
3145
  Param["ShowSpotterLimitations"] = "showSpotterLimitations";
3069
3146
  Param["CoverAndFilterOptionInPDF"] = "coverAndFilterOptionInPDF";
3147
+ Param["PrimaryAction"] = "primaryAction";
3148
+ Param["isSpotterAgentEmbed"] = "isSpotterAgentEmbed";
3070
3149
  })(Param || (Param = {}));
3071
3150
  /**
3072
3151
  * ThoughtSpot application pages include actions and menu commands
@@ -7304,29 +7383,49 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
7304
7383
  OperationType["GetTableWithHeadlineData"] = "GetTableWithHeadlineData";
7305
7384
  })(OperationType || (OperationType = {}));
7306
7385
  /**
7307
- * Class representing the answer service provided with the
7308
- * custom action payload. This service could be used to run
7309
- * graphql queries in the context of the answer on which the
7310
- * custom action was triggered.
7386
+ * AnswerService provides a simple way to work with ThoughtSpot Answers.
7387
+ *
7388
+ * This service allows you to interact with ThoughtSpot Answers programmatically,
7389
+ * making it easy to customize visualizations, filter data, and extract insights
7390
+ * directly from your application.
7391
+ *
7392
+ * You can use this service to:
7393
+ * - Add or remove columns from Answers (`addColumns`, `removeColumns`, `addColumnsByName`)
7394
+ * - Apply filters to Answers (`addFilter`)
7395
+ * - Get data from Answers in different formats (JSON, CSV, PNG) (`fetchData`, `fetchCSVBlob`, `fetchPNGBlob`)
7396
+ * - Get data for specific points in visualizations (`getUnderlyingDataForPoint`)
7397
+ * - Run custom queries (`executeQuery`)
7398
+ * - Add visualizations to liveboards (`addDisplayedVizToLiveboard`)
7399
+ *
7311
7400
  * @example
7312
7401
  * ```js
7313
- * embed.on(EmbedEvent.CustomAction, e => {
7314
- * const underlying = await e.answerService.getUnderlyingDataForPoint([
7315
- * 'col name 1'
7316
- * ]);
7317
- * const data = await underlying.fetchData(0, 100);
7318
- * })
7402
+ * // Get the answer service
7403
+ * embed.on(EmbedEvent.Data, async (e) => {
7404
+ * const service = await embed.getAnswerService();
7405
+ *
7406
+ * // Add columns to the answer
7407
+ * await service.addColumnsByName(["Sales", "Region"]);
7408
+ *
7409
+ * // Get the data
7410
+ * const data = await service.fetchData();
7411
+ * console.log(data);
7412
+ * });
7319
7413
  * ```
7414
+ *
7320
7415
  * @example
7321
7416
  * ```js
7322
- * embed.on(EmbedEvent.Data, async (e) => {
7323
- * const service = await embed.getAnswerService();
7324
- * await service.addColumns([
7325
- * "<column guid>"
7417
+ * // Get data for a point in a visualization
7418
+ * embed.on(EmbedEvent.CustomAction, async (e) => {
7419
+ * const underlying = await e.answerService.getUnderlyingDataForPoint([
7420
+ * 'Product Name',
7421
+ * 'Sales Amount'
7326
7422
  * ]);
7327
- * console.log(await service.fetchData());
7423
+ *
7424
+ * const data = await underlying.fetchData(0, 100);
7425
+ * console.log(data);
7328
7426
  * });
7329
7427
  * ```
7428
+ *
7330
7429
  * @version SDK: 1.25.0| ThoughtSpot: 9.10.0.cl
7331
7430
  * @group Events
7332
7431
  */
@@ -14589,6 +14688,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
14589
14688
  AuthFailureType["EXPIRY"] = "EXPIRY";
14590
14689
  AuthFailureType["OTHER"] = "OTHER";
14591
14690
  AuthFailureType["IDLE_SESSION_TIMEOUT"] = "IDLE_SESSION_TIMEOUT";
14691
+ AuthFailureType["UNAUTHENTICATED_FAILURE"] = "UNAUTHENTICATED_FAILURE";
14592
14692
  })(AuthFailureType || (AuthFailureType = {}));
14593
14693
  /**
14594
14694
  * Enum for auth status emitted by the emitter returned from {@link init}.
@@ -14624,6 +14724,10 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
14624
14724
  * @version SDK: 1.19.0
14625
14725
  */
14626
14726
  AuthStatus["WAITING_FOR_POPUP"] = "WAITING_FOR_POPUP";
14727
+ /**
14728
+ * Emitted when the SAML popup is closed without authentication
14729
+ */
14730
+ AuthStatus["SAML_POPUP_CLOSED_NO_AUTH"] = "SAML_POPUP_CLOSED_NO_AUTH";
14627
14731
  })(AuthStatus || (AuthStatus = {}));
14628
14732
  /**
14629
14733
  * Events which can be triggered on the emitter returned from {@link init}.
@@ -14844,14 +14948,26 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
14844
14948
  * @param triggerText
14845
14949
  */
14846
14950
  async function samlPopupFlow(ssoURL, triggerContainer, triggerText) {
14951
+ let popupClosedCheck;
14847
14952
  const openPopup = () => {
14848
14953
  if (samlAuthWindow === null || samlAuthWindow.closed) {
14849
14954
  samlAuthWindow = window.open(ssoURL, '_blank', 'location=no,height=570,width=520,scrollbars=yes,status=yes');
14955
+ if (samlAuthWindow) {
14956
+ popupClosedCheck = setInterval(() => {
14957
+ if (samlAuthWindow.closed) {
14958
+ clearInterval(popupClosedCheck);
14959
+ if (samlCompletionPromise && !samlCompletionResolved) {
14960
+ authEE === null || authEE === void 0 ? void 0 : authEE.emit(AuthStatus.SAML_POPUP_CLOSED_NO_AUTH);
14961
+ }
14962
+ }
14963
+ }, 500);
14964
+ }
14850
14965
  }
14851
14966
  else {
14852
14967
  samlAuthWindow.focus();
14853
14968
  }
14854
14969
  };
14970
+ let samlCompletionResolved = false;
14855
14971
  authEE === null || authEE === void 0 ? void 0 : authEE.emit(AuthStatus.WAITING_FOR_POPUP);
14856
14972
  const containerEl = getDOMNode(triggerContainer);
14857
14973
  if (containerEl) {
@@ -14863,6 +14979,10 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
14863
14979
  samlCompletionPromise = samlCompletionPromise || new Promise((resolve, reject) => {
14864
14980
  window.addEventListener('message', (e) => {
14865
14981
  if (e.data.type === exports.EmbedEvent.SAMLComplete) {
14982
+ samlCompletionResolved = true;
14983
+ if (popupClosedCheck) {
14984
+ clearInterval(popupClosedCheck);
14985
+ }
14866
14986
  e.source.close();
14867
14987
  resolve();
14868
14988
  }
@@ -15215,15 +15335,17 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
15215
15335
  * @param containerEl
15216
15336
  */
15217
15337
  function processAuthFailure(e, containerEl) {
15338
+ var _a;
15218
15339
  const { loginFailedMessage, authType, disableLoginFailurePage, autoLogin, } = getEmbedConfig();
15219
- if (autoLogin
15220
- && (authType === AuthType.TrustedAuthToken
15221
- || authType === AuthType.TrustedAuthTokenCookieless)) {
15340
+ const isEmbeddedSSO = authType === AuthType.EmbeddedSSO;
15341
+ const isTrustedAuth = authType === AuthType.TrustedAuthToken || authType === AuthType.TrustedAuthTokenCookieless;
15342
+ const isEmbeddedSSOInfoFailure = isEmbeddedSSO && ((_a = e === null || e === void 0 ? void 0 : e.data) === null || _a === void 0 ? void 0 : _a.type) === AuthFailureType.UNAUTHENTICATED_FAILURE;
15343
+ if (autoLogin && isTrustedAuth) {
15222
15344
  // eslint-disable-next-line no-param-reassign
15223
15345
  containerEl.innerHTML = loginFailedMessage;
15224
15346
  notifyAuthFailure(AuthFailureType.IDLE_SESSION_TIMEOUT);
15225
15347
  }
15226
- else if (authType !== AuthType.None && !disableLoginFailurePage) {
15348
+ else if (authType !== AuthType.None && !disableLoginFailurePage && !isEmbeddedSSOInfoFailure) {
15227
15349
  // eslint-disable-next-line no-param-reassign
15228
15350
  containerEl.innerHTML = loginFailedMessage;
15229
15351
  notifyAuthFailure(AuthFailureType.OTHER);
@@ -15268,7 +15390,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
15268
15390
  return e;
15269
15391
  }
15270
15392
 
15271
- var name="@thoughtspot/visual-embed-sdk";var version$1="1.37.0";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$1={".":{"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 | coveralls","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":"^8.2.6","@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",asciidoctor:"^2.2.1","babel-jest":"^26.6.3","babel-preset-gatsby":"^1.10.0","command-line-args":"^5.1.1",coveralls:"^3.1.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":"^1.1.1",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:"^5.3.4"};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$1,typesVersions:typesVersions,"size-limit":[{path:"dist/tsembed.es.js",limit:"31 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};
15393
+ var name="@thoughtspot/visual-embed-sdk";var version$1="1.37.1-spotter-embed";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$1={".":{"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 | coveralls","is-publish-allowed":"node scripts/is-publish-allowed.js",prepublishOnly:"npm run is-publish-allowed && 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":"^8.2.6","@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",asciidoctor:"^2.2.1","babel-jest":"^26.6.3","babel-preset-gatsby":"^1.10.0","command-line-args":"^5.1.1",coveralls:"^3.1.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":"^1.1.1",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$1,typesVersions:typesVersions,"size-limit":[{path:"dist/tsembed.es.js",limit:"31 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};
15272
15394
 
15273
15395
  /**
15274
15396
  * Reloads the ThoughtSpot iframe.
@@ -15805,7 +15927,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
15805
15927
  if (this.embedConfig.currencyFormat) {
15806
15928
  queryParams[Param.CurrencyFormat] = this.embedConfig.currencyFormat;
15807
15929
  }
15808
- const { disabledActions, disabledActionReason, hiddenActions, visibleActions, hiddenTabs, visibleTabs, showAlerts, additionalFlags: additionalFlagsFromView, locale, customizations, contextMenuTrigger, linkOverride, insertInToSlide, disableRedirectionLinksInNewTab, overrideOrgId, exposeTranslationIDs, } = this.viewConfig;
15930
+ const { disabledActions, disabledActionReason, hiddenActions, visibleActions, hiddenTabs, visibleTabs, showAlerts, additionalFlags: additionalFlagsFromView, locale, customizations, contextMenuTrigger, linkOverride, insertInToSlide, disableRedirectionLinksInNewTab, overrideOrgId, exposeTranslationIDs, primaryAction, } = this.viewConfig;
15809
15931
  const { additionalFlags: additionalFlagsFromInit } = this.embedConfig;
15810
15932
  const additionalFlags = {
15811
15933
  ...additionalFlagsFromInit,
@@ -15819,6 +15941,9 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
15819
15941
  this.handleError('You cannot have both hidden Tabs and visible Tabs');
15820
15942
  return queryParams;
15821
15943
  }
15944
+ if (primaryAction) {
15945
+ queryParams[Param.PrimaryAction] = primaryAction;
15946
+ }
15822
15947
  if (disabledActions === null || disabledActions === void 0 ? void 0 : disabledActions.length) {
15823
15948
  queryParams[Param.DisableActions] = disabledActions;
15824
15949
  }
@@ -17037,7 +17162,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
17037
17162
  * embedded Liveboard or visualization.
17038
17163
  */
17039
17164
  getEmbedParams() {
17040
- const { tag, hideObjects, liveboardV2, showPrimaryNavbar, disableProfileAndHelp, hideApplicationSwitcher, hideOrgSwitcher, enableSearchAssist, fullHeight, dataPanelV2 = false, hideLiveboardHeader = false, showLiveboardTitle = true, showLiveboardDescription = true, hideHomepageLeftNav = false, modularHomeExperience = false, isLiveboardHeaderSticky = true, enableAskSage, collapseSearchBarInitially = false, enable2ColumnLayout, enableCustomColumnGroups = false, isOnBeforeGetVizDataInterceptEnabled = false,
17165
+ const { tag, hideObjects, liveboardV2, showPrimaryNavbar, disableProfileAndHelp, hideHamburger, hideObjectSearch, hideNotification, hideApplicationSwitcher, hideOrgSwitcher, enableSearchAssist, fullHeight, dataPanelV2 = false, hideLiveboardHeader = false, showLiveboardTitle = true, showLiveboardDescription = true, hideHomepageLeftNav = false, modularHomeExperience = false, modularHomeExperienceV3 = false, isLiveboardHeaderSticky = true, enableAskSage, collapseSearchBarInitially = false, enable2ColumnLayout, enableCustomColumnGroups = false, isOnBeforeGetVizDataInterceptEnabled = false,
17041
17166
  /* eslint-disable-next-line max-len */
17042
17167
  dataPanelCustomGroupsAccordionInitialState = DataPanelCustomColumnGroupsAccordionState.EXPAND_ALL, collapseSearchBar = true, isLiveboardCompactHeaderEnabled = false, showLiveboardVerifiedBadge = true, showLiveboardReverifyBanner = true, hideIrrelevantChipsInLiveboardTabs = false, homePageSearchBarMode, isUnifiedSearchExperienceEnabled = true, enablePendoHelp = true, } = this.viewConfig;
17043
17168
  let params = {};
@@ -17056,6 +17181,18 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
17056
17181
  params[Param.HideIrrelevantFiltersInTab] = hideIrrelevantChipsInLiveboardTabs;
17057
17182
  params[Param.IsUnifiedSearchExperienceEnabled] = isUnifiedSearchExperienceEnabled;
17058
17183
  params = this.getBaseQueryParams(params);
17184
+ if (modularHomeExperienceV3) {
17185
+ params[Param.NavigationVersion] = 'v3';
17186
+ }
17187
+ if (hideObjectSearch) {
17188
+ params[Param.HideObjectSearch] = !!hideObjectSearch;
17189
+ }
17190
+ if (hideHamburger) {
17191
+ params[Param.HideHamburger] = !!hideHamburger;
17192
+ }
17193
+ if (hideNotification) {
17194
+ params[Param.HideNotification] = !!hideNotification;
17195
+ }
17059
17196
  if (fullHeight === true) {
17060
17197
  params[Param.fullHeight] = true;
17061
17198
  }
@@ -17592,7 +17729,7 @@ query GetEurekaVizSnapshots(
17592
17729
  * @group Embed components
17593
17730
  * @example
17594
17731
  * ```js
17595
- * const conversation = new ConversationEmbed('#tsEmbed', {
17732
+ * const conversation = new SpotterEmbed('#tsEmbed', {
17596
17733
  * worksheetId: 'worksheetId',
17597
17734
  * searchOptions: {
17598
17735
  * searchQuery: 'searchQuery',
@@ -17600,9 +17737,9 @@ query GetEurekaVizSnapshots(
17600
17737
  * });
17601
17738
  * conversation.render();
17602
17739
  * ```
17603
- * @version SDK: 1.33.1 | ThoughtSpot: 10.5.0.cl
17740
+ * @version SDK: 1.38.0 | ThoughtSpot: 10.10.0.cl
17604
17741
  */
17605
- let ConversationEmbed$1 = class ConversationEmbed extends TsEmbed {
17742
+ let SpotterEmbed$1 = class SpotterEmbed extends TsEmbed {
17606
17743
  constructor(container, viewConfig) {
17607
17744
  viewConfig.embedComponentType = 'conversation';
17608
17745
  super(container, viewConfig);
@@ -17648,6 +17785,29 @@ query GetEurekaVizSnapshots(
17648
17785
  await this.renderIFrame(src);
17649
17786
  return this;
17650
17787
  }
17788
+ };
17789
+ /**
17790
+ * Embed ThoughtSpot AI Conversation.
17791
+ * @deprecated Renamed to SpotterEmbed
17792
+ * @group Embed components
17793
+ * @example
17794
+ * ```js
17795
+ * const conversation = new SpotterEmbed('#tsEmbed', {
17796
+ * worksheetId: 'worksheetId',
17797
+ * searchOptions: {
17798
+ * searchQuery: 'searchQuery',
17799
+ * },
17800
+ * });
17801
+ * conversation.render();
17802
+ * ```
17803
+ * @version SDK: 1.37.0 | ThoughtSpot: 10.9.0.cl
17804
+ */
17805
+ let ConversationEmbed$1 = class ConversationEmbed extends SpotterEmbed$1 {
17806
+ constructor(container, viewConfig) {
17807
+ viewConfig.embedComponentType = 'conversation';
17808
+ super(container, viewConfig);
17809
+ this.viewConfig = viewConfig;
17810
+ }
17651
17811
  };
17652
17812
 
17653
17813
  const componentFactory = (EmbedConstructor,
@@ -17864,6 +18024,23 @@ query GetEurekaVizSnapshots(
17864
18024
  * @example
17865
18025
  * ```tsx
17866
18026
  * function Sage() {
18027
+ * return <SpotterEmbed
18028
+ * worksheetId="<worksheet-id-here>"
18029
+ * searchOptions={{
18030
+ * searchQuery: "<search query to start with>"
18031
+ * }}
18032
+ * ... other view config props or event listeners.
18033
+ * />
18034
+ * }
18035
+ * ```
18036
+ */
18037
+ const SpotterEmbed = componentFactory(SpotterEmbed$1);
18038
+ /**
18039
+ * React component for LLM based conversation BI.
18040
+ * @deprecated This component is renamed to SpotterEmbed. Use {@link SpotterEmbed} instead.
18041
+ * @example
18042
+ * ```tsx
18043
+ * function Sage() {
17867
18044
  * return <ConversationEmbed
17868
18045
  * worksheetId="<worksheet-id-here>"
17869
18046
  * searchOptions={{
@@ -17878,7 +18055,7 @@ query GetEurekaVizSnapshots(
17878
18055
  /**
17879
18056
  * React component for PreRendered Conversation embed.
17880
18057
  *
17881
- * PreRenderedConversationEmbed will preRender the ConversationEmbed and will be hidden by
18058
+ * PreRenderedConversationEmbed will preRender the SpotterEmbed and will be hidden by
17882
18059
  * default.
17883
18060
  *
17884
18061
  * SageEmbed with preRenderId passed will call showPreRender on the embed.
@@ -17889,11 +18066,11 @@ query GetEurekaVizSnapshots(
17889
18066
  * }
17890
18067
  * ```
17891
18068
  * function MyComponent() {
17892
- * return <ConversationEmbed preRenderId="someId" worksheetId="id" />
18069
+ * return <SpotterEmbed preRenderId="someId" worksheetId="id" />
17893
18070
  * }
17894
18071
  * ```
17895
18072
  */
17896
- const PreRenderedConversationEmbed = componentFactory(ConversationEmbed$1, true);
18073
+ const PreRenderedConversationEmbed = componentFactory(SpotterEmbed$1, true);
17897
18074
  /**
17898
18075
  * Get a reference to the embed component to trigger events on the component.
17899
18076
  * @example
@@ -18410,8 +18587,7 @@ query GetEurekaVizSnapshots(
18410
18587
  return {
18411
18588
  onAnchor: (source) => {
18412
18589
  aliasObjects.push(source);
18413
- if (!prevAnchors)
18414
- prevAnchors = anchorNames(doc);
18590
+ prevAnchors ?? (prevAnchors = anchorNames(doc));
18415
18591
  const anchor = findNewAnchor(prefix, prevAnchors);
18416
18592
  prevAnchors.add(anchor);
18417
18593
  return anchor;
@@ -18575,23 +18751,36 @@ query GetEurekaVizSnapshots(
18575
18751
  * Resolve the value of this alias within `doc`, finding the last
18576
18752
  * instance of the `source` anchor before this node.
18577
18753
  */
18578
- resolve(doc) {
18754
+ resolve(doc, ctx) {
18755
+ let nodes;
18756
+ if (ctx?.aliasResolveCache) {
18757
+ nodes = ctx.aliasResolveCache;
18758
+ }
18759
+ else {
18760
+ nodes = [];
18761
+ visit$1(doc, {
18762
+ Node: (_key, node) => {
18763
+ if (isAlias(node) || hasAnchor(node))
18764
+ nodes.push(node);
18765
+ }
18766
+ });
18767
+ if (ctx)
18768
+ ctx.aliasResolveCache = nodes;
18769
+ }
18579
18770
  let found = undefined;
18580
- visit$1(doc, {
18581
- Node: (_key, node) => {
18582
- if (node === this)
18583
- return visit$1.BREAK;
18584
- if (node.anchor === this.source)
18585
- found = node;
18586
- }
18587
- });
18771
+ for (const node of nodes) {
18772
+ if (node === this)
18773
+ break;
18774
+ if (node.anchor === this.source)
18775
+ found = node;
18776
+ }
18588
18777
  return found;
18589
18778
  }
18590
18779
  toJSON(_arg, ctx) {
18591
18780
  if (!ctx)
18592
18781
  return { source: this.source };
18593
18782
  const { anchors, doc, maxAliasCount } = ctx;
18594
- const source = this.resolve(doc);
18783
+ const source = this.resolve(doc, ctx);
18595
18784
  if (!source) {
18596
18785
  const msg = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
18597
18786
  throw new ReferenceError(msg);
@@ -18710,8 +18899,7 @@ query GetEurekaVizSnapshots(
18710
18899
  if (aliasDuplicateObjects && value && typeof value === 'object') {
18711
18900
  ref = sourceObjects.get(value);
18712
18901
  if (ref) {
18713
- if (!ref.anchor)
18714
- ref.anchor = onAnchor(value);
18902
+ ref.anchor ?? (ref.anchor = onAnchor(value));
18715
18903
  return new Alias(ref.anchor);
18716
18904
  }
18717
18905
  else {
@@ -19282,23 +19470,32 @@ query GetEurekaVizSnapshots(
19282
19470
  start = start.replace(/\n+/g, `$&${indent}`);
19283
19471
  }
19284
19472
  const indentSize = indent ? '2' : '1'; // root is at -1
19285
- let header = (literal ? '|' : '>') + (startWithSpace ? indentSize : '') + chomp;
19473
+ // Leading | or > is added later
19474
+ let header = (startWithSpace ? indentSize : '') + chomp;
19286
19475
  if (comment) {
19287
19476
  header += ' ' + commentString(comment.replace(/ ?[\r\n]+/g, ' '));
19288
19477
  if (onComment)
19289
19478
  onComment();
19290
19479
  }
19291
- if (literal) {
19292
- value = value.replace(/\n+/g, `$&${indent}`);
19293
- return `${header}\n${indent}${start}${value}${end}`;
19294
- }
19295
- value = value
19296
- .replace(/\n+/g, '\n$&')
19297
- .replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, '$1$2') // more-indented lines aren't folded
19298
- // ^ more-ind. ^ empty ^ capture next empty lines only at end of indent
19299
- .replace(/\n+/g, `$&${indent}`);
19300
- const body = foldFlowLines(`${start}${value}${end}`, indent, FOLD_BLOCK, getFoldOptions(ctx, true));
19301
- return `${header}\n${indent}${body}`;
19480
+ if (!literal) {
19481
+ const foldedValue = value
19482
+ .replace(/\n+/g, '\n$&')
19483
+ .replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, '$1$2') // more-indented lines aren't folded
19484
+ // ^ more-ind. ^ empty ^ capture next empty lines only at end of indent
19485
+ .replace(/\n+/g, `$&${indent}`);
19486
+ let literalFallback = false;
19487
+ const foldOptions = getFoldOptions(ctx, true);
19488
+ if (blockQuote !== 'folded' && type !== Scalar.BLOCK_FOLDED) {
19489
+ foldOptions.onOverflow = () => {
19490
+ literalFallback = true;
19491
+ };
19492
+ }
19493
+ const body = foldFlowLines(`${start}${foldedValue}${end}`, indent, FOLD_BLOCK, foldOptions);
19494
+ if (!literalFallback)
19495
+ return `>${header}\n${indent}${body}`;
19496
+ }
19497
+ value = value.replace(/\n+/g, `$&${indent}`);
19498
+ return `|${header}\n${indent}${start}${value}${end}`;
19302
19499
  }
19303
19500
  function plainString(item, ctx, onComment, onChompKeep) {
19304
19501
  const { type, value } = item;
@@ -19307,10 +19504,9 @@ query GetEurekaVizSnapshots(
19307
19504
  (inFlow && /[[\]{},]/.test(value))) {
19308
19505
  return quotedString(value, ctx);
19309
19506
  }
19310
- if (!value ||
19311
- /^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(value)) {
19507
+ if (/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(value)) {
19312
19508
  // not allowed:
19313
- // - empty string, '-' or '?'
19509
+ // - '-' or '?'
19314
19510
  // - start with an indicator character (except [?:-]) or /[?-] /
19315
19511
  // - '\n ', ': ' or ' \n' anywhere
19316
19512
  // - '#' not preceded by a non-space char
@@ -19439,7 +19635,12 @@ query GetEurekaVizSnapshots(
19439
19635
  let obj;
19440
19636
  if (isScalar$1(item)) {
19441
19637
  obj = item.value;
19442
- const match = tags.filter(t => t.identify?.(obj));
19638
+ let match = tags.filter(t => t.identify?.(obj));
19639
+ if (match.length > 1) {
19640
+ const testMatch = match.filter(t => t.test);
19641
+ if (testMatch.length > 0)
19642
+ match = testMatch;
19643
+ }
19443
19644
  tagObj =
19444
19645
  match.find(t => t.format === item.format) ?? match.find(t => !t.format);
19445
19646
  }
@@ -19448,7 +19649,7 @@ query GetEurekaVizSnapshots(
19448
19649
  tagObj = tags.find(t => t.nodeClass && obj instanceof t.nodeClass);
19449
19650
  }
19450
19651
  if (!tagObj) {
19451
- const name = obj?.constructor?.name ?? typeof obj;
19652
+ const name = obj?.constructor?.name ?? (obj === null ? 'null' : typeof obj);
19452
19653
  throw new Error(`Tag not resolved for ${name} value`);
19453
19654
  }
19454
19655
  return tagObj;
@@ -19463,7 +19664,7 @@ query GetEurekaVizSnapshots(
19463
19664
  anchors.add(anchor);
19464
19665
  props.push(`&${anchor}`);
19465
19666
  }
19466
- const tag = node.tag ? node.tag : tagObj.default ? null : tagObj.tag;
19667
+ const tag = node.tag ?? (tagObj.default ? null : tagObj.tag);
19467
19668
  if (tag)
19468
19669
  props.push(doc.directives.tagString(tag));
19469
19670
  return props.join(' ');
@@ -19489,8 +19690,7 @@ query GetEurekaVizSnapshots(
19489
19690
  const node = isNode(item)
19490
19691
  ? item
19491
19692
  : ctx.doc.createNode(item, { onTagObj: o => (tagObj = o) });
19492
- if (!tagObj)
19493
- tagObj = getTagObject(ctx.doc.schema.tags, node);
19693
+ tagObj ?? (tagObj = getTagObject(ctx.doc.schema.tags, node));
19494
19694
  const props = stringifyProps(node, tagObj, ctx);
19495
19695
  if (props.length > 0)
19496
19696
  ctx.indentAtStart = (ctx.indentAtStart ?? 0) + props.length + 1;
@@ -19652,54 +19852,10 @@ query GetEurekaVizSnapshots(
19652
19852
 
19653
19853
  function warn(logLevel, warning) {
19654
19854
  if (logLevel === 'debug' || logLevel === 'warn') {
19655
- if (typeof process !== 'undefined' && process.emitWarning)
19656
- process.emitWarning(warning);
19657
- else
19658
- console.warn(warning);
19855
+ console.warn(warning);
19659
19856
  }
19660
19857
  }
19661
19858
 
19662
- const MERGE_KEY = '<<';
19663
- function addPairToJSMap(ctx, map, { key, value }) {
19664
- if (ctx?.doc.schema.merge && isMergeKey(key)) {
19665
- value = isAlias(value) ? value.resolve(ctx.doc) : value;
19666
- if (isSeq(value))
19667
- for (const it of value.items)
19668
- mergeToJSMap(ctx, map, it);
19669
- else if (Array.isArray(value))
19670
- for (const it of value)
19671
- mergeToJSMap(ctx, map, it);
19672
- else
19673
- mergeToJSMap(ctx, map, value);
19674
- }
19675
- else {
19676
- const jsKey = toJS(key, '', ctx);
19677
- if (map instanceof Map) {
19678
- map.set(jsKey, toJS(value, jsKey, ctx));
19679
- }
19680
- else if (map instanceof Set) {
19681
- map.add(jsKey);
19682
- }
19683
- else {
19684
- const stringKey = stringifyKey(key, jsKey, ctx);
19685
- const jsValue = toJS(value, stringKey, ctx);
19686
- if (stringKey in map)
19687
- Object.defineProperty(map, stringKey, {
19688
- value: jsValue,
19689
- writable: true,
19690
- enumerable: true,
19691
- configurable: true
19692
- });
19693
- else
19694
- map[stringKey] = jsValue;
19695
- }
19696
- }
19697
- return map;
19698
- }
19699
- const isMergeKey = (key) => key === MERGE_KEY ||
19700
- (isScalar$1(key) &&
19701
- key.value === MERGE_KEY &&
19702
- (!key.type || key.type === Scalar.PLAIN));
19703
19859
  // If the value associated with a merge key is a single mapping node, each of
19704
19860
  // its key/value pairs is inserted into the current mapping, unless the key
19705
19861
  // already exists in it. If the value associated with the merge key is a
@@ -19707,7 +19863,35 @@ query GetEurekaVizSnapshots(
19707
19863
  // of these nodes is merged in turn according to its order in the sequence.
19708
19864
  // Keys in mapping nodes earlier in the sequence override keys specified in
19709
19865
  // later mapping nodes. -- http://yaml.org/type/merge.html
19710
- function mergeToJSMap(ctx, map, value) {
19866
+ const MERGE_KEY = '<<';
19867
+ const merge = {
19868
+ identify: value => value === MERGE_KEY ||
19869
+ (typeof value === 'symbol' && value.description === MERGE_KEY),
19870
+ default: 'key',
19871
+ tag: 'tag:yaml.org,2002:merge',
19872
+ test: /^<<$/,
19873
+ resolve: () => Object.assign(new Scalar(Symbol(MERGE_KEY)), {
19874
+ addToJSMap: addMergeToJSMap
19875
+ }),
19876
+ stringify: () => MERGE_KEY
19877
+ };
19878
+ const isMergeKey = (ctx, key) => (merge.identify(key) ||
19879
+ (isScalar$1(key) &&
19880
+ (!key.type || key.type === Scalar.PLAIN) &&
19881
+ merge.identify(key.value))) &&
19882
+ ctx?.doc.schema.tags.some(tag => tag.tag === merge.tag && tag.default);
19883
+ function addMergeToJSMap(ctx, map, value) {
19884
+ value = ctx && isAlias(value) ? value.resolve(ctx.doc) : value;
19885
+ if (isSeq(value))
19886
+ for (const it of value.items)
19887
+ mergeValue(ctx, map, it);
19888
+ else if (Array.isArray(value))
19889
+ for (const it of value)
19890
+ mergeValue(ctx, map, it);
19891
+ else
19892
+ mergeValue(ctx, map, value);
19893
+ }
19894
+ function mergeValue(ctx, map, value) {
19711
19895
  const source = ctx && isAlias(value) ? value.resolve(ctx.doc) : value;
19712
19896
  if (!isMap(source))
19713
19897
  throw new Error('Merge sources must be maps or map aliases');
@@ -19731,9 +19915,41 @@ query GetEurekaVizSnapshots(
19731
19915
  }
19732
19916
  return map;
19733
19917
  }
19918
+
19919
+ function addPairToJSMap(ctx, map, { key, value }) {
19920
+ if (isNode(key) && key.addToJSMap)
19921
+ key.addToJSMap(ctx, map, value);
19922
+ // TODO: Should drop this special case for bare << handling
19923
+ else if (isMergeKey(ctx, key))
19924
+ addMergeToJSMap(ctx, map, value);
19925
+ else {
19926
+ const jsKey = toJS(key, '', ctx);
19927
+ if (map instanceof Map) {
19928
+ map.set(jsKey, toJS(value, jsKey, ctx));
19929
+ }
19930
+ else if (map instanceof Set) {
19931
+ map.add(jsKey);
19932
+ }
19933
+ else {
19934
+ const stringKey = stringifyKey(key, jsKey, ctx);
19935
+ const jsValue = toJS(value, stringKey, ctx);
19936
+ if (stringKey in map)
19937
+ Object.defineProperty(map, stringKey, {
19938
+ value: jsValue,
19939
+ writable: true,
19940
+ enumerable: true,
19941
+ configurable: true
19942
+ });
19943
+ else
19944
+ map[stringKey] = jsValue;
19945
+ }
19946
+ }
19947
+ return map;
19948
+ }
19734
19949
  function stringifyKey(key, jsKey, ctx) {
19735
19950
  if (jsKey === null)
19736
19951
  return '';
19952
+ // eslint-disable-next-line @typescript-eslint/no-base-to-string
19737
19953
  if (typeof jsKey !== 'object')
19738
19954
  return String(jsKey);
19739
19955
  if (isNode(key) && ctx?.doc) {
@@ -20366,7 +20582,7 @@ query GetEurekaVizSnapshots(
20366
20582
  identify: value => typeof value === 'boolean',
20367
20583
  default: true,
20368
20584
  tag: 'tag:yaml.org,2002:bool',
20369
- test: /^true|false$/,
20585
+ test: /^true$|^false$/,
20370
20586
  resolve: str => str === 'true',
20371
20587
  stringify: stringifyJSON
20372
20588
  },
@@ -20411,10 +20627,7 @@ query GetEurekaVizSnapshots(
20411
20627
  * document.querySelector('#photo').src = URL.createObjectURL(blob)
20412
20628
  */
20413
20629
  resolve(src, onError) {
20414
- if (typeof Buffer === 'function') {
20415
- return Buffer.from(src, 'base64');
20416
- }
20417
- else if (typeof atob === 'function') {
20630
+ if (typeof atob === 'function') {
20418
20631
  // On IE 11, atob() can't handle newlines
20419
20632
  const str = atob(src.replace(/[\n\r]/g, ''));
20420
20633
  const buffer = new Uint8Array(str.length);
@@ -20428,15 +20641,11 @@ query GetEurekaVizSnapshots(
20428
20641
  }
20429
20642
  },
20430
20643
  stringify({ comment, type, value }, ctx, onComment, onChompKeep) {
20644
+ if (!value)
20645
+ return '';
20431
20646
  const buf = value; // checked earlier by binary.identify()
20432
20647
  let str;
20433
- if (typeof Buffer === 'function') {
20434
- str =
20435
- buf instanceof Buffer
20436
- ? buf.toString('base64')
20437
- : Buffer.from(buf.buffer).toString('base64');
20438
- }
20439
- else if (typeof btoa === 'function') {
20648
+ if (typeof btoa === 'function') {
20440
20649
  let s = '';
20441
20650
  for (let i = 0; i < buf.length; ++i)
20442
20651
  s += String.fromCharCode(buf[i]);
@@ -20445,8 +20654,7 @@ query GetEurekaVizSnapshots(
20445
20654
  else {
20446
20655
  throw new Error('This environment does not support writing binary tags; either Buffer or btoa is required');
20447
20656
  }
20448
- if (!type)
20449
- type = Scalar.BLOCK_LITERAL;
20657
+ type ?? (type = Scalar.BLOCK_LITERAL);
20450
20658
  if (type !== Scalar.QUOTE_DOUBLE) {
20451
20659
  const lineWidth = Math.max(ctx.options.lineWidth - ctx.indent.length, ctx.options.minContentWidth);
20452
20660
  const n = Math.ceil(str.length / lineWidth);
@@ -20915,7 +21123,7 @@ query GetEurekaVizSnapshots(
20915
21123
  }
20916
21124
  return new Date(date);
20917
21125
  },
20918
- stringify: ({ value }) => value.toISOString().replace(/((T00:00)?:00)?\.000Z$/, '')
21126
+ stringify: ({ value }) => value?.toISOString().replace(/(T00:00:00)?\.000Z$/, '') ?? ''
20919
21127
  };
20920
21128
 
20921
21129
  const schema = [
@@ -20933,6 +21141,7 @@ query GetEurekaVizSnapshots(
20933
21141
  floatExp,
20934
21142
  float,
20935
21143
  binary,
21144
+ merge,
20936
21145
  omap,
20937
21146
  pairs,
20938
21147
  set,
@@ -20960,6 +21169,7 @@ query GetEurekaVizSnapshots(
20960
21169
  intOct: intOct$1,
20961
21170
  intTime,
20962
21171
  map,
21172
+ merge,
20963
21173
  null: nullTag,
20964
21174
  omap,
20965
21175
  pairs,
@@ -20969,13 +21179,20 @@ query GetEurekaVizSnapshots(
20969
21179
  };
20970
21180
  const coreKnownTags = {
20971
21181
  'tag:yaml.org,2002:binary': binary,
21182
+ 'tag:yaml.org,2002:merge': merge,
20972
21183
  'tag:yaml.org,2002:omap': omap,
20973
21184
  'tag:yaml.org,2002:pairs': pairs,
20974
21185
  'tag:yaml.org,2002:set': set,
20975
21186
  'tag:yaml.org,2002:timestamp': timestamp
20976
21187
  };
20977
- function getTags(customTags, schemaName) {
20978
- let tags = schemas.get(schemaName);
21188
+ function getTags(customTags, schemaName, addMergeTag) {
21189
+ const schemaTags = schemas.get(schemaName);
21190
+ if (schemaTags && !customTags) {
21191
+ return addMergeTag && !schemaTags.includes(merge)
21192
+ ? schemaTags.concat(merge)
21193
+ : schemaTags.slice();
21194
+ }
21195
+ let tags = schemaTags;
20979
21196
  if (!tags) {
20980
21197
  if (Array.isArray(customTags))
20981
21198
  tags = [];
@@ -20994,17 +21211,21 @@ query GetEurekaVizSnapshots(
20994
21211
  else if (typeof customTags === 'function') {
20995
21212
  tags = customTags(tags.slice());
20996
21213
  }
20997
- return tags.map(tag => {
20998
- if (typeof tag !== 'string')
20999
- return tag;
21000
- const tagObj = tagsByName[tag];
21001
- if (tagObj)
21002
- return tagObj;
21003
- const keys = Object.keys(tagsByName)
21004
- .map(key => JSON.stringify(key))
21005
- .join(', ');
21006
- throw new Error(`Unknown custom tag "${tag}"; use one of ${keys}`);
21007
- });
21214
+ if (addMergeTag)
21215
+ tags = tags.concat(merge);
21216
+ return tags.reduce((tags, tag) => {
21217
+ const tagObj = typeof tag === 'string' ? tagsByName[tag] : tag;
21218
+ if (!tagObj) {
21219
+ const tagName = JSON.stringify(tag);
21220
+ const keys = Object.keys(tagsByName)
21221
+ .map(key => JSON.stringify(key))
21222
+ .join(', ');
21223
+ throw new Error(`Unknown custom tag ${tagName}; use one of ${keys}`);
21224
+ }
21225
+ if (!tags.includes(tagObj))
21226
+ tags.push(tagObj);
21227
+ return tags;
21228
+ }, []);
21008
21229
  }
21009
21230
 
21010
21231
  const sortMapEntriesByKey = (a, b) => a.key < b.key ? -1 : a.key > b.key ? 1 : 0;
@@ -21015,10 +21236,9 @@ query GetEurekaVizSnapshots(
21015
21236
  : compat
21016
21237
  ? getTags(null, compat)
21017
21238
  : null;
21018
- this.merge = !!merge;
21019
21239
  this.name = (typeof schema === 'string' && schema) || 'core';
21020
21240
  this.knownTags = resolveKnownTags ? coreKnownTags : {};
21021
- this.tags = getTags(customTags, this.name);
21241
+ this.tags = getTags(customTags, this.name, merge);
21022
21242
  this.toStringOptions = toStringDefaults ?? null;
21023
21243
  Object.defineProperty(this, MAP, { value: map });
21024
21244
  Object.defineProperty(this, SCALAR$1, { value: string });
@@ -21143,6 +21363,7 @@ query GetEurekaVizSnapshots(
21143
21363
  logLevel: 'warn',
21144
21364
  prettyErrors: true,
21145
21365
  strict: true,
21366
+ stringKeys: false,
21146
21367
  uniqueKeys: true,
21147
21368
  version: '1.2'
21148
21369
  }, options);
@@ -21366,7 +21587,7 @@ query GetEurekaVizSnapshots(
21366
21587
  this.directives.yaml.version = '1.1';
21367
21588
  else
21368
21589
  this.directives = new Directives({ version: '1.1' });
21369
- opt = { merge: true, resolveKnownTags: false, schema: 'yaml-1.1' };
21590
+ opt = { resolveKnownTags: false, schema: 'yaml-1.1' };
21370
21591
  break;
21371
21592
  case '1.2':
21372
21593
  case 'next':
@@ -21374,7 +21595,7 @@ query GetEurekaVizSnapshots(
21374
21595
  this.directives.yaml.version = version;
21375
21596
  else
21376
21597
  this.directives = new Directives({ version });
21377
- opt = { merge: false, resolveKnownTags: true, schema: 'core' };
21598
+ opt = { resolveKnownTags: true, schema: 'core' };
21378
21599
  break;
21379
21600
  case null:
21380
21601
  if (this.directives)
@@ -21552,7 +21773,7 @@ query GetEurekaVizSnapshots(
21552
21773
  if (atNewline) {
21553
21774
  if (comment)
21554
21775
  comment += token.source;
21555
- else
21776
+ else if (!found || indicator !== 'seq-item-ind')
21556
21777
  spaceBefore = true;
21557
21778
  }
21558
21779
  else
@@ -21569,8 +21790,7 @@ query GetEurekaVizSnapshots(
21569
21790
  if (token.source.endsWith(':'))
21570
21791
  onError(token.offset + token.source.length - 1, 'BAD_ALIAS', 'Anchor ending in : is ambiguous', true);
21571
21792
  anchor = token;
21572
- if (start === null)
21573
- start = token.offset;
21793
+ start ?? (start = token.offset);
21574
21794
  atNewline = false;
21575
21795
  hasSpace = false;
21576
21796
  reqSpace = true;
@@ -21579,8 +21799,7 @@ query GetEurekaVizSnapshots(
21579
21799
  if (tag)
21580
21800
  onError(token, 'MULTIPLE_TAGS', 'A node can have at most one tag');
21581
21801
  tag = token;
21582
- if (start === null)
21583
- start = token.offset;
21802
+ start ?? (start = token.offset);
21584
21803
  atNewline = false;
21585
21804
  hasSpace = false;
21586
21805
  reqSpace = true;
@@ -21693,11 +21912,7 @@ query GetEurekaVizSnapshots(
21693
21912
  return false;
21694
21913
  const isEqual = typeof uniqueKeys === 'function'
21695
21914
  ? uniqueKeys
21696
- : (a, b) => a === b ||
21697
- (isScalar$1(a) &&
21698
- isScalar$1(b) &&
21699
- a.value === b.value &&
21700
- !(a.value === '<<' && ctx.schema.merge));
21915
+ : (a, b) => a === b || (isScalar$1(a) && isScalar$1(b) && a.value === b.value);
21701
21916
  return items.some(pair => isEqual(pair.key, search));
21702
21917
  }
21703
21918
 
@@ -21746,12 +21961,14 @@ query GetEurekaVizSnapshots(
21746
21961
  onError(offset, 'BAD_INDENT', startColMsg);
21747
21962
  }
21748
21963
  // key value
21964
+ ctx.atKey = true;
21749
21965
  const keyStart = keyProps.end;
21750
21966
  const keyNode = key
21751
21967
  ? composeNode(ctx, key, keyProps, onError)
21752
21968
  : composeEmptyNode(ctx, keyStart, start, null, keyProps, onError);
21753
21969
  if (ctx.schema.compat)
21754
21970
  flowIndentCheck(bm.indent, key, onError);
21971
+ ctx.atKey = false;
21755
21972
  if (mapIncludes(ctx, map.items, keyNode))
21756
21973
  onError(keyStart, 'DUPLICATE_KEY', 'Map keys must be unique');
21757
21974
  // value properties
@@ -21811,6 +22028,8 @@ query GetEurekaVizSnapshots(
21811
22028
  const seq = new NodeClass(ctx.schema);
21812
22029
  if (ctx.atRoot)
21813
22030
  ctx.atRoot = false;
22031
+ if (ctx.atKey)
22032
+ ctx.atKey = false;
21814
22033
  let offset = bs.offset;
21815
22034
  let commentEnd = null;
21816
22035
  for (const { start, value } of bs.items) {
@@ -21895,6 +22114,8 @@ query GetEurekaVizSnapshots(
21895
22114
  const atRoot = ctx.atRoot;
21896
22115
  if (atRoot)
21897
22116
  ctx.atRoot = false;
22117
+ if (ctx.atKey)
22118
+ ctx.atKey = false;
21898
22119
  let offset = fc.offset + fc.start.source.length;
21899
22120
  for (let i = 0; i < fc.items.length; ++i) {
21900
22121
  const collItem = fc.items[i];
@@ -21974,12 +22195,14 @@ query GetEurekaVizSnapshots(
21974
22195
  else {
21975
22196
  // item is a key+value pair
21976
22197
  // key value
22198
+ ctx.atKey = true;
21977
22199
  const keyStart = props.end;
21978
22200
  const keyNode = key
21979
22201
  ? composeNode(ctx, key, props, onError)
21980
22202
  : composeEmptyNode(ctx, keyStart, start, null, props, onError);
21981
22203
  if (isBlock(key))
21982
22204
  onError(keyNode.range, 'BLOCK_IN_FLOW', blockMsg);
22205
+ ctx.atKey = false;
21983
22206
  // value properties
21984
22207
  const valueProps = resolveProps(sep ?? [], {
21985
22208
  flow: fcName,
@@ -22135,8 +22358,8 @@ query GetEurekaVizSnapshots(
22135
22358
  tag = kt;
22136
22359
  }
22137
22360
  else {
22138
- if (kt?.collection) {
22139
- onError(tagToken, 'BAD_COLLECTION_TYPE', `${kt.tag} used for ${expType} collection, but expects ${kt.collection}`, true);
22361
+ if (kt) {
22362
+ onError(tagToken, 'BAD_COLLECTION_TYPE', `${kt.tag} used for ${expType} collection, but expects ${kt.collection ?? 'scalar'}`, true);
22140
22363
  }
22141
22364
  else {
22142
22365
  onError(tagToken, 'TAG_RESOLVE_FAILED', `Unresolved tag: ${tagName}`, true);
@@ -22577,11 +22800,16 @@ query GetEurekaVizSnapshots(
22577
22800
  const tagName = tagToken
22578
22801
  ? ctx.directives.tagName(tagToken.source, msg => onError(tagToken, 'TAG_RESOLVE_FAILED', msg))
22579
22802
  : null;
22580
- const tag = tagToken && tagName
22581
- ? findScalarTagByName(ctx.schema, value, tagName, tagToken, onError)
22582
- : token.type === 'scalar'
22583
- ? findScalarTagByTest(ctx, value, token, onError)
22584
- : ctx.schema[SCALAR$1];
22803
+ let tag;
22804
+ if (ctx.options.stringKeys && ctx.atKey) {
22805
+ tag = ctx.schema[SCALAR$1];
22806
+ }
22807
+ else if (tagName)
22808
+ tag = findScalarTagByName(ctx.schema, value, tagName, tagToken, onError);
22809
+ else if (token.type === 'scalar')
22810
+ tag = findScalarTagByTest(ctx, value, token, onError);
22811
+ else
22812
+ tag = ctx.schema[SCALAR$1];
22585
22813
  let scalar;
22586
22814
  try {
22587
22815
  const res = tag.resolve(value, msg => onError(tagToken ?? token, 'TAG_RESOLVE_FAILED', msg), ctx.options);
@@ -22629,8 +22857,9 @@ query GetEurekaVizSnapshots(
22629
22857
  onError(tagToken, 'TAG_RESOLVE_FAILED', `Unresolved tag: ${tagName}`, tagName !== 'tag:yaml.org,2002:str');
22630
22858
  return schema[SCALAR$1];
22631
22859
  }
22632
- function findScalarTagByTest({ directives, schema }, value, token, onError) {
22633
- const tag = schema.tags.find(tag => tag.default && tag.test?.test(value)) || schema[SCALAR$1];
22860
+ function findScalarTagByTest({ atKey, directives, schema }, value, token, onError) {
22861
+ const tag = schema.tags.find(tag => (tag.default === true || (atKey && tag.default === 'key')) &&
22862
+ tag.test?.test(value)) || schema[SCALAR$1];
22634
22863
  if (schema.compat) {
22635
22864
  const compat = schema.compat.find(tag => tag.default && tag.test?.test(value)) ??
22636
22865
  schema[SCALAR$1];
@@ -22646,8 +22875,7 @@ query GetEurekaVizSnapshots(
22646
22875
 
22647
22876
  function emptyScalarPosition(offset, before, pos) {
22648
22877
  if (before) {
22649
- if (pos === null)
22650
- pos = before.length;
22878
+ pos ?? (pos = before.length);
22651
22879
  for (let i = pos - 1; i >= 0; --i) {
22652
22880
  let st = before[i];
22653
22881
  switch (st.type) {
@@ -22672,6 +22900,7 @@ query GetEurekaVizSnapshots(
22672
22900
 
22673
22901
  const CN = { composeNode, composeEmptyNode };
22674
22902
  function composeNode(ctx, token, props, onError) {
22903
+ const atKey = ctx.atKey;
22675
22904
  const { spaceBefore, comment, anchor, tag } = props;
22676
22905
  let node;
22677
22906
  let isSrcToken = true;
@@ -22707,6 +22936,14 @@ query GetEurekaVizSnapshots(
22707
22936
  }
22708
22937
  if (anchor && node.anchor === '')
22709
22938
  onError(anchor, 'BAD_ALIAS', 'Anchor cannot be an empty string');
22939
+ if (atKey &&
22940
+ ctx.options.stringKeys &&
22941
+ (!isScalar$1(node) ||
22942
+ typeof node.value !== 'string' ||
22943
+ (node.tag && node.tag !== 'tag:yaml.org,2002:str'))) {
22944
+ const msg = 'With stringKeys, all keys must be strings';
22945
+ onError(tag ?? token, 'NON_STRING_KEY', msg);
22946
+ }
22710
22947
  if (spaceBefore)
22711
22948
  node.spaceBefore = true;
22712
22949
  if (comment) {
@@ -22759,6 +22996,7 @@ query GetEurekaVizSnapshots(
22759
22996
  const opts = Object.assign({ _directives: directives }, options);
22760
22997
  const doc = new Document(undefined, opts);
22761
22998
  const ctx = {
22999
+ atKey: false,
22762
23000
  atRoot: true,
22763
23001
  directives: doc.directives,
22764
23002
  options: doc.options,
@@ -24893,7 +25131,20 @@ query GetEurekaVizSnapshots(
24893
25131
  default: {
24894
25132
  const bv = this.startBlockValue(map);
24895
25133
  if (bv) {
24896
- if (atMapIndent && bv.type !== 'block-seq') {
25134
+ if (bv.type === 'block-seq') {
25135
+ if (!it.explicitKey &&
25136
+ it.sep &&
25137
+ !includesToken(it.sep, 'newline')) {
25138
+ yield* this.pop({
25139
+ type: 'error',
25140
+ offset: this.offset,
25141
+ message: 'Unexpected block-seq-ind on same line with key',
25142
+ source: this.source
25143
+ });
25144
+ return;
25145
+ }
25146
+ }
25147
+ else if (atMapIndent) {
24897
25148
  map.items.push({ start });
24898
25149
  }
24899
25150
  this.stack.push(bv);
@@ -25264,6 +25515,8 @@ query GetEurekaVizSnapshots(
25264
25515
  if (!keepUndefined)
25265
25516
  return undefined;
25266
25517
  }
25518
+ if (isDocument(value) && !_replacer)
25519
+ return value.toString(options);
25267
25520
  return new Document(value, _replacer, options).toString(options);
25268
25521
  }
25269
25522
 
@@ -25351,6 +25604,7 @@ query GetEurekaVizSnapshots(
25351
25604
  exports.SageEmbed = SageEmbed;
25352
25605
  exports.SearchBarEmbed = SearchBarEmbed;
25353
25606
  exports.SearchEmbed = SearchEmbed;
25607
+ exports.SpotterEmbed = SpotterEmbed;
25354
25608
  exports.getSessionInfo = getSessionInfo;
25355
25609
  exports.useEmbedRef = useEmbedRef;
25356
25610
  exports.useInit = useInit;