@thoughtspot/visual-embed-sdk 1.42.1-alpha.7 → 1.42.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (181) hide show
  1. package/cjs/package.json +4 -3
  2. package/cjs/src/embed/app.d.ts +20 -0
  3. package/cjs/src/embed/app.d.ts.map +1 -1
  4. package/cjs/src/embed/app.js +5 -4
  5. package/cjs/src/embed/app.js.map +1 -1
  6. package/cjs/src/embed/app.spec.js +32 -0
  7. package/cjs/src/embed/app.spec.js.map +1 -1
  8. package/cjs/src/embed/hostEventClient/contracts.d.ts +1 -11
  9. package/cjs/src/embed/hostEventClient/contracts.d.ts.map +1 -1
  10. package/cjs/src/embed/hostEventClient/contracts.js +0 -1
  11. package/cjs/src/embed/hostEventClient/contracts.js.map +1 -1
  12. package/cjs/src/embed/hostEventClient/host-event-client.d.ts +3 -3
  13. package/cjs/src/embed/hostEventClient/host-event-client.d.ts.map +1 -1
  14. package/cjs/src/embed/hostEventClient/host-event-client.js +6 -6
  15. package/cjs/src/embed/hostEventClient/host-event-client.js.map +1 -1
  16. package/cjs/src/embed/search.d.ts.map +1 -1
  17. package/cjs/src/embed/search.js +1 -3
  18. package/cjs/src/embed/search.js.map +1 -1
  19. package/cjs/src/embed/ts-embed.d.ts +1 -3
  20. package/cjs/src/embed/ts-embed.d.ts.map +1 -1
  21. package/cjs/src/embed/ts-embed.js +16 -44
  22. package/cjs/src/embed/ts-embed.js.map +1 -1
  23. package/cjs/src/embed/ts-embed.spec.js +0 -2
  24. package/cjs/src/embed/ts-embed.spec.js.map +1 -1
  25. package/cjs/src/index.d.ts +3 -3
  26. package/cjs/src/index.d.ts.map +1 -1
  27. package/cjs/src/index.js +1 -2
  28. package/cjs/src/index.js.map +1 -1
  29. package/cjs/src/react/all-types-export.d.ts +1 -2
  30. package/cjs/src/react/all-types-export.d.ts.map +1 -1
  31. package/cjs/src/react/all-types-export.js +3 -3
  32. package/cjs/src/react/all-types-export.js.map +1 -1
  33. package/cjs/src/react/all-types-export.spec.js +0 -8
  34. package/cjs/src/react/all-types-export.spec.js.map +1 -1
  35. package/cjs/src/react/index.d.ts +1 -2
  36. package/cjs/src/react/index.d.ts.map +1 -1
  37. package/cjs/src/react/index.js +2 -1
  38. package/cjs/src/react/index.js.map +1 -1
  39. package/cjs/src/react/util.d.ts +1 -0
  40. package/cjs/src/react/util.d.ts.map +1 -1
  41. package/cjs/src/types.d.ts +105 -143
  42. package/cjs/src/types.d.ts.map +1 -1
  43. package/cjs/src/types.js +103 -98
  44. package/cjs/src/types.js.map +1 -1
  45. package/cjs/src/utils/processData.d.ts +1 -1
  46. package/cjs/src/utils/processData.d.ts.map +1 -1
  47. package/cjs/src/utils/processData.js +8 -8
  48. package/cjs/src/utils/processData.js.map +1 -1
  49. package/cjs/src/utils/processData.spec.js.map +1 -1
  50. package/cjs/src/utils/processTrigger.d.ts +2 -1
  51. package/cjs/src/utils/processTrigger.d.ts.map +1 -1
  52. package/cjs/src/utils/processTrigger.js +4 -2
  53. package/cjs/src/utils/processTrigger.js.map +1 -1
  54. package/dist/{index-DvNA626T.js → index-CWQnMX2L.js} +1 -1
  55. package/dist/src/embed/app.d.ts +20 -0
  56. package/dist/src/embed/app.d.ts.map +1 -1
  57. package/dist/src/embed/hostEventClient/contracts.d.ts +1 -11
  58. package/dist/src/embed/hostEventClient/contracts.d.ts.map +1 -1
  59. package/dist/src/embed/hostEventClient/host-event-client.d.ts +3 -3
  60. package/dist/src/embed/hostEventClient/host-event-client.d.ts.map +1 -1
  61. package/dist/src/embed/search.d.ts.map +1 -1
  62. package/dist/src/embed/ts-embed.d.ts +1 -3
  63. package/dist/src/embed/ts-embed.d.ts.map +1 -1
  64. package/dist/src/index.d.ts +3 -3
  65. package/dist/src/index.d.ts.map +1 -1
  66. package/dist/src/react/all-types-export.d.ts +1 -2
  67. package/dist/src/react/all-types-export.d.ts.map +1 -1
  68. package/dist/src/react/index.d.ts +1 -2
  69. package/dist/src/react/index.d.ts.map +1 -1
  70. package/dist/src/react/util.d.ts +1 -0
  71. package/dist/src/react/util.d.ts.map +1 -1
  72. package/dist/src/types.d.ts +105 -143
  73. package/dist/src/types.d.ts.map +1 -1
  74. package/dist/src/utils/processData.d.ts +1 -1
  75. package/dist/src/utils/processData.d.ts.map +1 -1
  76. package/dist/src/utils/processTrigger.d.ts +2 -1
  77. package/dist/src/utils/processTrigger.d.ts.map +1 -1
  78. package/dist/tsembed-react.es.js +157 -280
  79. package/dist/tsembed-react.js +301 -500
  80. package/dist/tsembed.es.js +156 -280
  81. package/dist/tsembed.js +299 -499
  82. package/dist/visual-embed-sdk-react-full.d.ts +129 -160
  83. package/dist/visual-embed-sdk-react.d.ts +129 -157
  84. package/dist/visual-embed-sdk.d.ts +129 -160
  85. package/lib/package.json +4 -3
  86. package/lib/src/embed/app.d.ts +20 -0
  87. package/lib/src/embed/app.d.ts.map +1 -1
  88. package/lib/src/embed/app.js +5 -4
  89. package/lib/src/embed/app.js.map +1 -1
  90. package/lib/src/embed/app.spec.js +32 -0
  91. package/lib/src/embed/app.spec.js.map +1 -1
  92. package/lib/src/embed/hostEventClient/contracts.d.ts +1 -11
  93. package/lib/src/embed/hostEventClient/contracts.d.ts.map +1 -1
  94. package/lib/src/embed/hostEventClient/contracts.js +0 -1
  95. package/lib/src/embed/hostEventClient/contracts.js.map +1 -1
  96. package/lib/src/embed/hostEventClient/host-event-client.d.ts +3 -3
  97. package/lib/src/embed/hostEventClient/host-event-client.d.ts.map +1 -1
  98. package/lib/src/embed/hostEventClient/host-event-client.js +6 -6
  99. package/lib/src/embed/hostEventClient/host-event-client.js.map +1 -1
  100. package/lib/src/embed/search.d.ts.map +1 -1
  101. package/lib/src/embed/search.js +1 -3
  102. package/lib/src/embed/search.js.map +1 -1
  103. package/lib/src/embed/ts-embed.d.ts +1 -3
  104. package/lib/src/embed/ts-embed.d.ts.map +1 -1
  105. package/lib/src/embed/ts-embed.js +16 -44
  106. package/lib/src/embed/ts-embed.js.map +1 -1
  107. package/lib/src/embed/ts-embed.spec.js +0 -2
  108. package/lib/src/embed/ts-embed.spec.js.map +1 -1
  109. package/lib/src/index.d.ts +3 -3
  110. package/lib/src/index.d.ts.map +1 -1
  111. package/lib/src/index.js +2 -2
  112. package/lib/src/index.js.map +1 -1
  113. package/lib/src/react/all-types-export.d.ts +1 -2
  114. package/lib/src/react/all-types-export.d.ts.map +1 -1
  115. package/lib/src/react/all-types-export.js +2 -2
  116. package/lib/src/react/all-types-export.js.map +1 -1
  117. package/lib/src/react/all-types-export.spec.js +0 -8
  118. package/lib/src/react/all-types-export.spec.js.map +1 -1
  119. package/lib/src/react/index.d.ts +1 -2
  120. package/lib/src/react/index.d.ts.map +1 -1
  121. package/lib/src/react/index.js +4 -3
  122. package/lib/src/react/index.js.map +1 -1
  123. package/lib/src/react/util.d.ts +1 -0
  124. package/lib/src/react/util.d.ts.map +1 -1
  125. package/lib/src/types.d.ts +105 -143
  126. package/lib/src/types.d.ts.map +1 -1
  127. package/lib/src/types.js +102 -97
  128. package/lib/src/types.js.map +1 -1
  129. package/lib/src/utils/processData.d.ts +1 -1
  130. package/lib/src/utils/processData.d.ts.map +1 -1
  131. package/lib/src/utils/processData.js +8 -8
  132. package/lib/src/utils/processData.js.map +1 -1
  133. package/lib/src/utils/processData.spec.js.map +1 -1
  134. package/lib/src/utils/processTrigger.d.ts +2 -1
  135. package/lib/src/utils/processTrigger.d.ts.map +1 -1
  136. package/lib/src/utils/processTrigger.js +4 -2
  137. package/lib/src/utils/processTrigger.js.map +1 -1
  138. package/package.json +4 -3
  139. package/src/embed/app.spec.ts +45 -0
  140. package/src/embed/app.ts +26 -4
  141. package/src/embed/hostEventClient/contracts.ts +0 -10
  142. package/src/embed/hostEventClient/host-event-client.ts +7 -3
  143. package/src/embed/search.ts +1 -3
  144. package/src/embed/ts-embed.spec.ts +7 -9
  145. package/src/embed/ts-embed.ts +33 -68
  146. package/src/index.ts +3 -4
  147. package/src/react/all-types-export.spec.ts +1 -9
  148. package/src/react/all-types-export.ts +6 -10
  149. package/src/react/index.tsx +130 -155
  150. package/src/types.ts +104 -145
  151. package/src/utils/processData.spec.ts +1 -0
  152. package/src/utils/processData.ts +11 -11
  153. package/src/utils/processTrigger.ts +5 -2
  154. package/cjs/src/api-intercept.d.ts +0 -31
  155. package/cjs/src/api-intercept.d.ts.map +0 -1
  156. package/cjs/src/api-intercept.js +0 -119
  157. package/cjs/src/api-intercept.js.map +0 -1
  158. package/cjs/src/api-intercept.spec.d.ts +0 -2
  159. package/cjs/src/api-intercept.spec.d.ts.map +0 -1
  160. package/cjs/src/api-intercept.spec.js +0 -122
  161. package/cjs/src/api-intercept.spec.js.map +0 -1
  162. package/dist/index-BCC3Z072.js +0 -7371
  163. package/dist/index-BEzW4MDA.js +0 -7371
  164. package/dist/index-BaESA9rq.js +0 -7371
  165. package/dist/index-CFNZIcKr.js +0 -7447
  166. package/dist/index-CqKTa1Fe.js +0 -7447
  167. package/dist/index-DFnPKcjZ.js +0 -7447
  168. package/dist/index-DhFH7b7U.js +0 -7447
  169. package/dist/src/api-intercept.d.ts +0 -31
  170. package/dist/src/api-intercept.d.ts.map +0 -1
  171. package/dist/src/api-intercept.spec.d.ts +0 -2
  172. package/dist/src/api-intercept.spec.d.ts.map +0 -1
  173. package/lib/src/api-intercept.d.ts +0 -31
  174. package/lib/src/api-intercept.d.ts.map +0 -1
  175. package/lib/src/api-intercept.js +0 -112
  176. package/lib/src/api-intercept.js.map +0 -1
  177. package/lib/src/api-intercept.spec.d.ts +0 -2
  178. package/lib/src/api-intercept.spec.d.ts.map +0 -1
  179. package/lib/src/api-intercept.spec.js +0 -119
  180. package/lib/src/api-intercept.spec.js.map +0 -1
  181. package/src/api-intercept.ts +0 -139
@@ -1,4 +1,4 @@
1
- /* @thoughtspot/visual-embed-sdk version 1.42.1-alpha.7 */
1
+ /* @thoughtspot/visual-embed-sdk version 1.42.1 */
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$1 = (...objects) => objects.reduce((result, current) => {
166
+ const merge = (...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$1.options.mergeArrays
176
- ? merge$1.options.uniqueArrayItems
175
+ result[key] = merge.options.mergeArrays
176
+ ? merge.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$1(result[key], current[key]);
182
+ result[key] = merge(result[key], current[key]);
183
183
  }
184
184
  else {
185
185
  result[key] =
186
186
  current[key] === undefined
187
- ? merge$1.options.allowUndefinedOverrides
187
+ ? merge.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$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;
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;
205
205
  return result;
206
206
  };
207
207
 
@@ -636,7 +636,7 @@
636
636
  */
637
637
  EmbedEvent["Load"] = "load";
638
638
  /**
639
- * Data pertaining to an Answer or Liveboard is received.
639
+ * Data pertaining to an Answer, Liveboard or Spotter visualization is received.
640
640
  * The event payload includes the raw data of the object.
641
641
  * @return data - Answer of Liveboard data
642
642
  * @version SDK: 1.1.0 | ThoughtSpot: ts7.may.cl, 8.4.1.sw
@@ -1719,21 +1719,6 @@
1719
1719
  * @version SDK: 1.41.0 | ThoughtSpot: 10.12.0.cl
1720
1720
  */
1721
1721
  EmbedEvent["OrgSwitched"] = "orgSwitched";
1722
- /**
1723
- * Emitted when the user intercepts a URL.
1724
- *
1725
- * Supported on all embed types.
1726
- *
1727
- * @example
1728
- * ```js
1729
- * embed.on(EmbedEvent.ApiIntercept, (payload) => {
1730
- * console.log('payload', payload);
1731
- * })
1732
- * ```
1733
- *
1734
- * @version SDK: 1.42.0 | ThoughtSpot: 10.14.0.cl
1735
- */
1736
- EmbedEvent["ApiIntercept"] = "ApiIntercept";
1737
1722
  })(exports.EmbedEvent || (exports.EmbedEvent = {}));
1738
1723
  /**
1739
1724
  * Event types that can be triggered by the host application
@@ -2022,7 +2007,7 @@
2022
2007
  * the following parameters:
2023
2008
  *
2024
2009
  * @param
2025
- * `vizId`- GUID of the saved Answer or visualization to pin to a Liveboard.
2010
+ * `vizId`- GUID of the saved Answer or Spotter visualization ID to pin to a Liveboard.
2026
2011
  * Optional when pinning a new chart or table generated from a Search query.
2027
2012
  * **Required** in Spotter Embed.
2028
2013
  * @param
@@ -2074,10 +2059,16 @@
2074
2059
  * ```
2075
2060
  * @example
2076
2061
  * ```js
2077
- * const pinResponse = await spotterEmbed.trigger(HostEvent.Pin, {
2078
- * vizId:'730496d6-6903-4601-937e-2c691821af3c'
2079
- * });
2080
- * ```
2062
+
2063
+ * // You can use the Data event dispatched on each answer creation to get the vizId and use in Pin host event.
2064
+ * let latestSpotterVizId = '';
2065
+ * spotterEmbed.on(EmbedEvent.Data, (payload) => {
2066
+ * latestSpotterVizId = payload.data.id;
2067
+ * });
2068
+ *
2069
+ * spotterEmbed.trigger(HostEvent.Pin, { vizId: latestSpotterVizId });
2070
+ * ```
2071
+ *
2081
2072
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
2082
2073
  */
2083
2074
  HostEvent["Pin"] = "pin";
@@ -2152,10 +2143,15 @@
2152
2143
  * ```
2153
2144
  * @example
2154
2145
  * ```js
2155
- * spotterEmbed.trigger(HostEvent.DownloadAsPdf, {
2156
- * vizId:'730496d6-6903-4601-937e-2c691821af3c'
2157
- * });
2158
- * ```
2146
+
2147
+ * // You can use the Data event dispatched on each answer creation to get the vizId and use in DownloadAsPdf host event.
2148
+ * let latestSpotterVizId = '';
2149
+ * spotterEmbed.on(EmbedEvent.Data, (payload) => {
2150
+ * latestSpotterVizId = payload.data.id;
2151
+ * });
2152
+ *
2153
+ * spotterEmbed.trigger(HostEvent.DownloadAsPdf, { vizId: latestSpotterVizId });
2154
+ * ```
2159
2155
  *
2160
2156
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
2161
2157
  */
@@ -2182,10 +2178,14 @@
2182
2178
  * ```
2183
2179
  * @example
2184
2180
  * ```js
2185
- * const pinResponse = await spotterEmbed.trigger(HostEvent.MakeACopy, {
2186
- * vizId:'730496d6-6903-4601-937e-2c691821af3c'
2187
- * });
2188
- * ```
2181
+ * // You can use the Data event dispatched on each answer creation to get the vizId and use in MakeACopy host event.
2182
+ * let latestSpotterVizId = '';
2183
+ * spotterEmbed.on(EmbedEvent.Data, (payload) => {
2184
+ * latestSpotterVizId = payload.data.id;
2185
+ * });
2186
+ *
2187
+ * spotterEmbed.trigger(HostEvent.MakeACopy, { vizId: latestSpotterVizId });
2188
+ * ```
2189
2189
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
2190
2190
  */
2191
2191
  HostEvent["MakeACopy"] = "makeACopy";
@@ -2270,15 +2270,7 @@
2270
2270
  * ```
2271
2271
  * @example
2272
2272
  * ```js
2273
- * const pinResponse = await spotterEmbed.trigger(HostEvent.Edit, {
2274
- * vizId:'730496d6-6903-4601-937e-2c691821af3c'
2275
- * });
2276
- * ```
2277
- * @example
2278
- * ```js
2279
- * const editResponse = await spotterEmbed.trigger(HostEvent.Edit, {
2280
- * vizId:'730496d6-6903-4601-937e-2c691821af3c'
2281
- * });
2273
+ * spotterEmbed.trigger(HostEvent.Edit);
2282
2274
  * ```
2283
2275
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1.sw
2284
2276
  */
@@ -2327,16 +2319,23 @@
2327
2319
  * );
2328
2320
  * })
2329
2321
  * ```
2330
- * @example
2322
+ * * @example
2331
2323
  * ```js
2332
- * spotterEmbed.trigger(HostEvent.GetTML, {
2333
- * vizId: '730496d6-6903-4601-937e-2c691821af3c'
2324
+
2325
+ * // You can use the Data event dispatched on each answer creation to get the vizId and use in Pin host event.
2326
+ * let latestSpotterVizId = '';
2327
+ * spotterEmbed.on(EmbedEvent.Data, (payload) => {
2328
+ * latestSpotterVizId = payload.data.id;
2329
+ * });
2330
+ *
2331
+ * spotterEmbed.trigger(HostEvent.GetTML, {
2332
+ * vizId: latestSpotterVizId
2334
2333
  * }).then((tml) => {
2335
2334
  * console.log(
2336
2335
  * tml.answer.search_query // TML representation of the search query
2337
2336
  * );
2338
2337
  * })
2339
- * ```
2338
+ * ```
2340
2339
  * @version SDK: 1.18.0 | ThoughtSpot: 8.10.0.cl, 9.0.1.sw
2341
2340
  * @important
2342
2341
  */
@@ -2400,7 +2399,7 @@
2400
2399
  /**
2401
2400
  * Trigger the **Download** action on charts in
2402
2401
  * the embedded view.
2403
- * @param - `vizId` refers to the Answer ID in Spotter embed and is required in Spotter embed.
2402
+ * @param - `vizId` refers to the Visualization ID in Spotter embed and is required in Spotter embed.
2404
2403
  * @example
2405
2404
  * ```js
2406
2405
  * liveboardEmbed.trigger(HostEvent.Download, {vizId:
@@ -2410,10 +2409,14 @@
2410
2409
  * embed.trigger(HostEvent.Download)
2411
2410
  * ```
2412
2411
  * ```js
2413
- * spotterEmbed.trigger(HostEvent.Download, {
2414
- * vizId:'730496d6-6903-4601-937e-2c691821af3c'
2415
- * });
2416
- * ```
2412
+ * // You can use the Data event dispatched on each answer creation to get the vizId and use in Download host event.
2413
+ * let latestSpotterVizId = '';
2414
+ * spotterEmbed.on(EmbedEvent.Data, (payload) => {
2415
+ * latestSpotterVizId = payload.data.id;
2416
+ * });
2417
+ *
2418
+ * spotterEmbed.trigger(HostEvent.Download, { vizId: latestSpotterVizId });
2419
+ * ```
2417
2420
  * @deprecated from SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl ,9.4.1.sw
2418
2421
  * Use {@link DownloadAsPng}
2419
2422
  * @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1.sw
@@ -2431,9 +2434,13 @@
2431
2434
  *
2432
2435
  * searchEmbed.trigger(HostEvent.DownloadAsPng)
2433
2436
  *
2434
- * spotterEmbed.trigger(HostEvent.DownloadAsPng, {
2435
- * vizId:"730496d6-6903-4601-937e-2c691821af3c"
2436
- * })
2437
+ * // You can use the Data event dispatched on each answer creation to get the vizId and use in DownloadAsPng host event.
2438
+ * let latestSpotterVizId = '';
2439
+ * spotterEmbed.on(EmbedEvent.Data, (payload) => {
2440
+ * latestSpotterVizId = payload.data.id;
2441
+ * });
2442
+ *
2443
+ * spotterEmbed.trigger(HostEvent.DownloadAsPng, { vizId: latestSpotterVizId });
2437
2444
  * ```
2438
2445
  *
2439
2446
  * @version SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl, 9.4.1.sw
@@ -2442,7 +2449,7 @@
2442
2449
  /**
2443
2450
  * Trigger the **Download** > **CSV** action on tables in
2444
2451
  * the embedded view.
2445
- * @param - `vizId` refers to the Answer ID in Spotter embed and is required in Spotter embed.
2452
+ * @param - `vizId` refers to the Visualization ID in Spotter embed and is required in Spotter embed.
2446
2453
  * @example
2447
2454
  * ```js
2448
2455
  * liveboardEmbed.trigger(HostEvent.DownloadAsCsv, {vizId:
@@ -2455,9 +2462,13 @@
2455
2462
  * searchEmbed.trigger(HostEvent.DownloadAsCsv)
2456
2463
  * ```
2457
2464
  * ```js
2458
- * spotterEmbed.trigger(HostEvent.DownloadAsCsv, {
2459
- * vizId:"730496d6-6903-4601-937e-2c691821af3c"
2460
- * })
2465
+ * // You can use the Data event dispatched on each answer creation to get the vizId and use in DownloadAsCsv host event.
2466
+ * let latestSpotterVizId = '';
2467
+ * spotterEmbed.on(EmbedEvent.Data, (payload) => {
2468
+ * latestSpotterVizId = payload.data.id;
2469
+ * });
2470
+ *
2471
+ * spotterEmbed.trigger(HostEvent.DownloadAsCsv, { vizId: latestSpotterVizId });
2461
2472
  * ```
2462
2473
  * @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1.sw
2463
2474
  */
@@ -2465,7 +2476,7 @@
2465
2476
  /**
2466
2477
  * Trigger the **Download** > **XLSX** action on tables
2467
2478
  * in the embedded view.
2468
- * @param - `vizId` refers to the Answer ID in Spotter embed and is required in Spotter embed.
2479
+ * @param - `vizId` refers to the Visualization ID in Spotter embed and is required in Spotter embed.
2469
2480
  * @example
2470
2481
  * ```js
2471
2482
  * liveboardEmbed.trigger(HostEvent.DownloadAsXlsx, {vizId:
@@ -2478,9 +2489,13 @@
2478
2489
  * searchEmbed.trigger(HostEvent.DownloadAsXlsx)
2479
2490
  * ```
2480
2491
  * ```js
2481
- * spotterEmbed.trigger(HostEvent.downloadAsXLSX, {
2482
- * vizId:"730496d6-6903-4601-937e-2c691821af3c"
2483
- * })
2492
+ * // You can use the Data event dispatched on each answer creation to get the vizId and use in DownloadAsXlsx host event.
2493
+ * let latestSpotterVizId = '';
2494
+ * spotterEmbed.on(EmbedEvent.Data, (payload) => {
2495
+ * latestSpotterVizId = payload.data.id;
2496
+ * });
2497
+ *
2498
+ * spotterEmbed.trigger(HostEvent.DownloadAsXlsx, { vizId: latestSpotterVizId });
2484
2499
  * ```
2485
2500
  * @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1.sw
2486
2501
  */
@@ -2517,7 +2532,7 @@
2517
2532
  * ```
2518
2533
  *
2519
2534
  * ```js
2520
- * // Save an Answer in Spotter (requires vizId)
2535
+ * // Save a Visualization in Spotter (requires vizId)
2521
2536
  * spotterEmbed.trigger(HostEvent.Save, {
2522
2537
  * vizId: "730496d6-6903-4601-937e-2c691821af3c"
2523
2538
  * })
@@ -2839,11 +2854,13 @@
2839
2854
  * });
2840
2855
  *```
2841
2856
  *```js
2842
- * spotterEmbed.trigger(HostEvent.GetParameters, {
2843
- * vizId: '730496d6-6903-4601-937e-2c691821af3c'
2844
- * }).then((parameter) => {
2845
- * console.log('parameters', parameter);
2846
- * });
2857
+ * // You can use the Data event dispatched on each answer creation to get the vizId and use in GetParameters host event.
2858
+ * let latestSpotterVizId = '';
2859
+ * spotterEmbed.on(EmbedEvent.Data, (payload) => {
2860
+ * latestSpotterVizId = payload.data.id;
2861
+ * });
2862
+ *
2863
+ * spotterEmbed.trigger(HostEvent.GetParameters, { vizId: latestSpotterVizId });
2847
2864
  *```
2848
2865
  * @version SDK: 1.29.0 | ThoughtSpot: 10.1.0.cl, 10.1.0.sw
2849
2866
  */
@@ -2886,11 +2903,13 @@
2886
2903
  * ```
2887
2904
  * @example
2888
2905
  * ```js
2889
- * const saveAnswerResponse = await spotterEmbed.trigger(HostEvent.SaveAnswer, {
2890
- * vizId: '730496d6-6903-4601-937e-2c691821af3c',
2891
- * name: "Sales by states",
2892
- * description: "Total sales by states in MidWest"
2906
+ * // You can use the Data event dispatched on each answer creation to get the vizId and use in SaveAnswer host event.
2907
+ * let latestSpotterVizId = '';
2908
+ * spotterEmbed.on(EmbedEvent.Data, (payload) => {
2909
+ * latestSpotterVizId = payload.data.id;
2893
2910
  * });
2911
+ *
2912
+ * spotterEmbed.trigger(HostEvent.SaveAnswer, { vizId: latestSpotterVizId });
2894
2913
  * ```
2895
2914
  * @version SDK: 1.36.0 | ThoughtSpot: 10.6.0.cl
2896
2915
  */
@@ -2974,12 +2993,15 @@
2974
2993
  HostEvent["DeleteLastPrompt"] = "DeleteLastPrompt";
2975
2994
  /**
2976
2995
  * Toggle the visualization to chart or table view.
2977
- * @param - `vizId ` refers to the answer id in spotter Embed, it is required in spotter Embed.
2996
+ * @param - `vizId ` refers to the Visualization ID in Spotter embed and is required.
2978
2997
  * @example
2979
2998
  * ```js
2980
- * spotterEmbed.trigger(HostEvent.AnswerChartSwitcher, {
2981
- * vizId:'b535c760-8bbe-4e6f-bb26-af56b4129a1e'
2999
+ * let latestSpotterVizId = '';
3000
+ * spotterEmbed.on(EmbedEvent.Data, (payload) => {
3001
+ * latestSpotterVizId = payload.data.id;
2982
3002
  * });
3003
+ *
3004
+ * spotterEmbed.trigger(HostEvent.AnswerChartSwitcher, { vizId: latestSpotterVizId });
2983
3005
  *```
2984
3006
  * @version SDK: 1.40.0 | ThoughtSpot: 10.11.0.cl
2985
3007
  */
@@ -3008,12 +3030,16 @@
3008
3030
  */
3009
3031
  HostEvent["VisibleEmbedCoordinates"] = "visibleEmbedCoordinates";
3010
3032
  /**
3011
- * Trigger the *Ask Spotter* action for visualizations
3012
- * @param - `vizId` refers to the Answer ID in Spotter embed and is required in Spotter embed.
3033
+ * Trigger the *Spotter* action for visualizations present on the liveboard's vizzes.
3034
+ * @param - `vizId` refers to the Visualization ID in Spotter embed and is required.
3013
3035
  * @example
3014
3036
  * ```js
3015
- * spotterEmbed.trigger(HostEvent.AskSpotter,
3016
- * {vizId:'730496d6-6903-4601-937e-2c691821af3c'})
3037
+ * let latestSpotterVizId = '';
3038
+ * spotterEmbed.on(EmbedEvent.Data, (payload) => {
3039
+ * latestSpotterVizId = payload.data.id;
3040
+ * });
3041
+ *
3042
+ * spotterEmbed.trigger(HostEvent.AskSpotter, { vizId: latestSpotterVizId });
3017
3043
  * ```
3018
3044
  * @version SDK: 1.41.0 | ThoughtSpot: 10.12.0.cl
3019
3045
  */
@@ -3071,6 +3097,7 @@
3071
3097
  Param["HideResult"] = "hideResult";
3072
3098
  Param["UseLastSelectedDataSource"] = "useLastSelectedSources";
3073
3099
  Param["Tag"] = "tag";
3100
+ Param["HideTagFilterChips"] = "hideTagFilterChips";
3074
3101
  Param["AutoLogin"] = "autoLogin";
3075
3102
  Param["searchTokenString"] = "searchTokenString";
3076
3103
  Param["executeSearch"] = "executeSearch";
@@ -4601,29 +4628,7 @@
4601
4628
  * @version SDK: 1.26.7 | ThoughtSpot Cloud: 9.10.0.cl
4602
4629
  */
4603
4630
  LogLevel["TRACE"] = "TRACE";
4604
- })(exports.LogLevel || (exports.LogLevel = {}));
4605
- /**
4606
- * Enum for the type of API intercepted
4607
- */
4608
- var InterceptedApiType;
4609
- (function (InterceptedApiType) {
4610
- /**
4611
- * The apis that are use to get the metadata for the embed
4612
- */
4613
- InterceptedApiType["METADATA"] = "METADATA";
4614
- /**
4615
- * The apis that are use to get the data for the embed
4616
- */
4617
- InterceptedApiType["ANSWER_DATA"] = "ANSWER_DATA";
4618
- /**
4619
- * This will intercept all the apis
4620
- */
4621
- InterceptedApiType["ALL"] = "ALL";
4622
- /**
4623
- * The apis that are use to get the data for the liveboard
4624
- */
4625
- InterceptedApiType["LIVEBOARD_DATA"] = "LIVEBOARD_DATA";
4626
- })(InterceptedApiType || (InterceptedApiType = {}));
4631
+ })(exports.LogLevel || (exports.LogLevel = {}));
4627
4632
 
4628
4633
  const logFunctions = {
4629
4634
  [exports.LogLevel.SILENT]: () => undefined,
@@ -4892,7 +4897,7 @@
4892
4897
  function getDOMNode(domSelector) {
4893
4898
  return typeof domSelector === 'string' ? document.querySelector(domSelector) : domSelector;
4894
4899
  }
4895
- const deepMerge = (target, source) => merge$1(target, source);
4900
+ const deepMerge = (target, source) => merge(target, source);
4896
4901
  const getOperationNameFromQuery = (query) => {
4897
4902
  const regex = /(?:query|mutation)\s+(\w+)/;
4898
4903
  const matches = query.match(regex);
@@ -7386,17 +7391,6 @@
7386
7391
 
7387
7392
  var isEmpty_1 = isEmpty$1;
7388
7393
 
7389
- var UIPassthroughEvent;
7390
- (function (UIPassthroughEvent) {
7391
- UIPassthroughEvent["PinAnswerToLiveboard"] = "addVizToPinboard";
7392
- UIPassthroughEvent["SaveAnswer"] = "saveAnswer";
7393
- UIPassthroughEvent["GetDiscoverabilityStatus"] = "getDiscoverabilityStatus";
7394
- UIPassthroughEvent["GetAvailableUIPassthroughs"] = "getAvailableUiPassthroughs";
7395
- UIPassthroughEvent["GetAnswerConfig"] = "getAnswerPageConfig";
7396
- UIPassthroughEvent["GetLiveboardConfig"] = "getPinboardPageConfig";
7397
- UIPassthroughEvent["GetUnsavedAnswerTML"] = "getUnsavedAnswerTML";
7398
- })(UIPassthroughEvent || (UIPassthroughEvent = {}));
7399
-
7400
7394
  const ERROR_MESSAGE = {
7401
7395
  INVALID_THOUGHTSPOT_HOST: 'Error parsing ThoughtSpot host. Please provide a valid URL.',
7402
7396
  SPOTTER_EMBED_WORKSHEED_ID_NOT_FOUND: 'Please select a worksheet to get started',
@@ -17481,27 +17475,27 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
17481
17475
  * @param thoughtSpotHost
17482
17476
  * @param containerEl
17483
17477
  */
17484
- function processEventData(type, eventData, thoughtSpotHost, containerEl) {
17478
+ function processEventData(type, e, thoughtSpotHost, containerEl) {
17485
17479
  switch (type) {
17486
17480
  case exports.EmbedEvent.CustomAction:
17487
- return processCustomAction(eventData, thoughtSpotHost);
17481
+ return processCustomAction(e, thoughtSpotHost);
17488
17482
  case exports.EmbedEvent.AuthInit:
17489
- return processAuthInit(eventData);
17483
+ return processAuthInit(e);
17490
17484
  case exports.EmbedEvent.NoCookieAccess:
17491
- return processNoCookieAccess(eventData, containerEl);
17485
+ return processNoCookieAccess(e, containerEl);
17492
17486
  case exports.EmbedEvent.AuthFailure:
17493
- return processAuthFailure(eventData, containerEl);
17487
+ return processAuthFailure(e, containerEl);
17494
17488
  case exports.EmbedEvent.AuthLogout:
17495
- return processAuthLogout(eventData, containerEl);
17489
+ return processAuthLogout(e, containerEl);
17496
17490
  case exports.EmbedEvent.ExitPresentMode:
17497
17491
  return processExitPresentMode();
17498
17492
  case exports.EmbedEvent.CLEAR_INFO_CACHE:
17499
17493
  return processClearInfoCache();
17500
17494
  }
17501
- return eventData;
17495
+ return e;
17502
17496
  }
17503
17497
 
17504
- var name="@thoughtspot/visual-embed-sdk";var version$1="1.42.1-alpha.7";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 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":"NODE_OPTIONS=--max_old_space_size=8192 jest -c jest.config.sdk.js --runInBand --no-cache",test:"npm run test-sdk",posttest:"cat ./coverage/sdk/lcov.info | npx coveralls-next","is-publish-allowed":"node scripts/is-publish-allowed.js",prepublishOnly:"npm run tsc && npm run bundle-dts-file && npm run bundle-dts && npm run bundle-dts-react && npm run bundle-dts-react-full && npm run build","check-size":"npm run build && size-limit","publish-dev":"npm publish --tag dev","publish-prod":"npm publish --tag latest",dev:"vite -c vite.local.config.ts"};var peerDependencies={react:"> 16.8.0","react-dom":"> 16.8.0"};var dependencies={classnames:"^2.3.1",eventemitter3:"^4.0.7",lodash:"^4.17.21","mixpanel-browser":"2.47.0","ts-deepmerge":"^6.0.2",tslib:"^2.5.3","use-deep-compare-effect":"^1.8.1",yaml:"^2.5.1"};var devDependencies={"@mdx-js/mdx":"^1.6.22","@mdx-js/react":"^1.6.22","@react-icons/all-files":"^4.1.0","@rollup/plugin-commonjs":"^18.0.0","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^11.2.1","@rollup/plugin-replace":"^5.0.2","@size-limit/preset-big-lib":"^11.2.0","@testing-library/dom":"^7.31.0","@testing-library/jest-dom":"^5.14.1","@testing-library/react":"^11.2.7","@testing-library/user-event":"^13.1.8","@types/jest":"^22.2.3","@types/lodash":"^4.17.0","@types/react-test-renderer":"^17.0.1","@typescript-eslint/eslint-plugin":"^8.28.0","@typescript-eslint/parser":"^8.28.0",ajv:"^8.17.1",asciidoctor:"^2.2.1","babel-jest":"^26.6.3","babel-preset-gatsby":"^1.10.0","command-line-args":"^5.1.1","coveralls-next":"^5.0.0",crypto:"^1.0.1","current-git-branch":"^1.1.0","dts-bundle-generator":"^9.5.1",eslint:"^9.23.0","eslint-config-airbnb-base":"^15.0.0","eslint-config-prettier":"^10.1.1","eslint-import-resolver-typescript":"^4.2.5","eslint-plugin-comment-length":"2.2.1","eslint-plugin-import":"^2.31.0","eslint-plugin-jsdoc":"^50.6.9","eslint-plugin-prettier":"^5.2.5","eslint-plugin-react":"^7.37.5","eslint-plugin-react-hooks":"^5.2.0","fs-extra":"^10.0.0","gh-pages":"6.3.0",globals:"^16.0.0","highlight.js":"^10.6.0","html-to-text":"^8.0.0","identity-obj-proxy":"^3.0.0","istanbul-merge":"^2.0.0",jest:"^26.6.3","jest-fetch-mock":"^3.0.3",jsdom:"^17.0.0",prettier:"2.1.2",react:"^16.14.0","react-dom":"^16.14.0","react-resizable":"^1.11.0","react-resize-detector":"^6.6.0","react-test-renderer":"^17.0.2","react-use-flexsearch":"^0.1.1",rollup:"4.24.0","rollup-plugin-typescript2":"0.27.3","ts-jest":"^26.5.5","ts-loader":"8.0.4",typedoc:"0.21.6","typedoc-plugin-toc-group":"thoughtspot/typedoc-plugin-toc-group",typescript:"^4.9.4","typescript-eslint":"^8.29.1","url-search-params-polyfill":"^8.1.0",util:"^0.12.4",vite:"^6.3.5"};var author="ThoughtSpot";var email="support@thoughtspot.com";var license="ThoughtSpot Development Tools End User License Agreement";var directories={lib:"lib"};var repository={type:"git",url:"git+https://github.com/thoughtspot/visual-embed-sdk.git"};var publishConfig={registry:"https://registry.npmjs.org"};var keywords=["thoughtspot","everywhere","embedded","embed","sdk","analytics"];var bugs={url:"https://github.com/thoughtspot/visual-embed-sdk/issues"};var homepage="https://github.com/thoughtspot/visual-embed-sdk#readme";var globals={window:{}};var pkgInfo = {name:name,version:version$1,description:description,module:module,main:main,types:types,files:files,exports:exports$1,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};
17498
+ var name="@thoughtspot/visual-embed-sdk";var version$1="1.42.1";var description="ThoughtSpot Embed SDK";var module="lib/src/index.js";var main="dist/tsembed.js";var types="lib/src/index.d.ts";var files=["dist/**","lib/**","src/**","cjs/**"];var exports$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 tsconfig.build.json --incremental false; tsc -p tsconfig.build.json --incremental false --module commonjs --outDir cjs","build-and-publish":"npm run build:gatsby && npm run publish","bundle-dts-file":"dts-bundle-generator --config ./dts-config/dts-bundle-file.config.js","bundle-dts":"dts-bundle-generator --config ./dts-config/dts-bundle.config.js","bundle-dts-react":"dts-bundle-generator --config ./dts-config/dts-bundle-react.config.js","bundle-dts-react-full":"dts-bundle-generator --config ./dts-config/dts-bundle-react-full.config.js",build:"rollup -c",watch:"rollup -cw",docgen:"typedoc --tsconfig tsconfig.build.json --theme typedoc-theme --json static/typedoc/typedoc.json --disableOutputCheck","test-sdk":"jest -c jest.config.sdk.js --runInBand",test:"npm run test-sdk",posttest:"cat ./coverage/sdk/lcov.info | npx coveralls-next","is-publish-allowed":"node scripts/is-publish-allowed.js",prepublishOnly:"npm run 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":"^11.2.0","@testing-library/dom":"^7.31.0","@testing-library/jest-dom":"^5.14.1","@testing-library/react":"^11.2.7","@testing-library/user-event":"^13.1.8","@types/jest":"^22.2.3","@types/lodash":"^4.17.0","@types/mixpanel-browser":"^2.35.6","@types/react-test-renderer":"^17.0.1","@typescript-eslint/eslint-plugin":"^8.28.0","@typescript-eslint/parser":"^8.28.0",ajv:"^8.17.1",asciidoctor:"^2.2.1","babel-jest":"^26.6.3","babel-preset-gatsby":"^1.10.0","command-line-args":"^5.1.1","coveralls-next":"^5.0.0",crypto:"^1.0.1","current-git-branch":"^1.1.0","dts-bundle-generator":"^9.5.1",eslint:"^9.23.0","eslint-config-airbnb-base":"^15.0.0","eslint-config-prettier":"^10.1.1","eslint-import-resolver-typescript":"^4.2.5","eslint-plugin-comment-length":"2.2.1","eslint-plugin-import":"^2.31.0","eslint-plugin-jsdoc":"^50.6.9","eslint-plugin-prettier":"^5.2.5","eslint-plugin-react":"^7.37.5","eslint-plugin-react-hooks":"^5.2.0","fs-extra":"^10.0.0","gh-pages":"6.3.0",globals:"^16.0.0","highlight.js":"^10.6.0","html-to-text":"^8.0.0","identity-obj-proxy":"^3.0.0","istanbul-merge":"^2.0.0",jest:"^26.6.3","jest-fetch-mock":"^3.0.3",jsdom:"^17.0.0",prettier:"2.1.2",react:"^16.14.0","react-dom":"^16.14.0","react-resizable":"^1.11.0","react-resize-detector":"^6.6.0","react-test-renderer":"^17.0.2","react-use-flexsearch":"^0.1.1",rollup:"4.24.0","rollup-plugin-typescript2":"0.27.3","ts-jest":"^26.5.5","ts-loader":"8.0.4",typedoc:"0.21.6","typedoc-plugin-toc-group":"thoughtspot/typedoc-plugin-toc-group",typescript:"^4.9.4","typescript-eslint":"^8.29.1","url-search-params-polyfill":"^8.1.0",util:"^0.12.4",vite:"^6.3.5"};var author="ThoughtSpot";var email="support@thoughtspot.com";var license="ThoughtSpot Development Tools End User License Agreement";var directories={lib:"lib"};var repository={type:"git",url:"git+https://github.com/thoughtspot/visual-embed-sdk.git"};var publishConfig={registry:"https://registry.npmjs.org"};var keywords=["thoughtspot","everywhere","embedded","embed","sdk","analytics"];var bugs={url:"https://github.com/thoughtspot/visual-embed-sdk/issues"};var homepage="https://github.com/thoughtspot/visual-embed-sdk#readme";var globals={window:{}};var pkgInfo = {name:name,version:version$1,description:description,module:module,main:main,types:types,files:files,exports:exports$1,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};
17505
17499
 
17506
17500
  /**
17507
17501
  * Reloads the ThoughtSpot iframe.
@@ -17520,6 +17514,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
17520
17514
  * @param message
17521
17515
  * @param message.type
17522
17516
  * @param message.data
17517
+ * @param message.context
17523
17518
  * @param thoughtSpotHost
17524
17519
  * @param channel
17525
17520
  */
@@ -17534,8 +17529,9 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
17534
17529
  * @param messageType
17535
17530
  * @param thoughtSpotHost
17536
17531
  * @param data
17532
+ * @param context
17537
17533
  */
17538
- function processTrigger(iFrame, messageType, thoughtSpotHost, data) {
17534
+ function processTrigger(iFrame, messageType, thoughtSpotHost, data, context) {
17539
17535
  return new Promise((res, rej) => {
17540
17536
  var _a;
17541
17537
  if (messageType === exports.HostEvent.Reload) {
@@ -17569,10 +17565,20 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
17569
17565
  channel.port1.close();
17570
17566
  res(new Error(ERROR_MESSAGE.TRIGGER_TIMED_OUT));
17571
17567
  }, TRIGGER_TIMEOUT);
17572
- return postIframeMessage(iFrame, { type: messageType, data }, thoughtSpotHost, channel);
17568
+ return postIframeMessage(iFrame, { type: messageType, data, context }, thoughtSpotHost, channel);
17573
17569
  });
17574
17570
  }
17575
17571
 
17572
+ var UIPassthroughEvent;
17573
+ (function (UIPassthroughEvent) {
17574
+ UIPassthroughEvent["PinAnswerToLiveboard"] = "addVizToPinboard";
17575
+ UIPassthroughEvent["SaveAnswer"] = "saveAnswer";
17576
+ UIPassthroughEvent["GetDiscoverabilityStatus"] = "getDiscoverabilityStatus";
17577
+ UIPassthroughEvent["GetAvailableUIPassthroughs"] = "getAvailableUiPassthroughs";
17578
+ UIPassthroughEvent["GetAnswerConfig"] = "getAnswerPageConfig";
17579
+ UIPassthroughEvent["GetLiveboardConfig"] = "getPinboardPageConfig";
17580
+ })(UIPassthroughEvent || (UIPassthroughEvent = {}));
17581
+
17576
17582
  class HostEventClient {
17577
17583
  constructor(iFrame) {
17578
17584
  this.iFrame = iFrame;
@@ -17583,12 +17589,12 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
17583
17589
  * @param {any} data Data to send with the host event
17584
17590
  * @returns {Promise<any>} - the response from the process trigger
17585
17591
  */
17586
- async processTrigger(message, data) {
17592
+ async processTrigger(message, data, context) {
17587
17593
  if (!this.iFrame) {
17588
17594
  throw new Error('Iframe element is not set');
17589
17595
  }
17590
17596
  const thoughtspotHost = getEmbedConfig().thoughtSpotHost;
17591
- return processTrigger(this.iFrame, message, thoughtspotHost, data);
17597
+ return processTrigger(this.iFrame, message, thoughtspotHost, data, context);
17592
17598
  }
17593
17599
  async handleHostEventWithParam(apiName, parameters) {
17594
17600
  var _a, _b, _c, _d;
@@ -17607,8 +17613,8 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
17607
17613
  }
17608
17614
  return { ...response.value };
17609
17615
  }
17610
- async hostEventFallback(hostEvent, data) {
17611
- return this.processTrigger(hostEvent, data);
17616
+ async hostEventFallback(hostEvent, data, context) {
17617
+ return this.processTrigger(hostEvent, data, context);
17612
17618
  }
17613
17619
  /**
17614
17620
  * Setter for the iframe element used for host events
@@ -17652,123 +17658,18 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
17652
17658
  answerId: (_d = (_c = (_b = (_a = data === null || data === void 0 ? void 0 : data.saveResponse) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.Answer__save) === null || _c === void 0 ? void 0 : _c.answer) === null || _d === void 0 ? void 0 : _d.id,
17653
17659
  };
17654
17660
  }
17655
- async triggerHostEvent(hostEvent, payload) {
17661
+ async triggerHostEvent(hostEvent, payload, context) {
17656
17662
  switch (hostEvent) {
17657
17663
  case exports.HostEvent.Pin:
17658
17664
  return this.handlePinEvent(payload);
17659
17665
  case exports.HostEvent.SaveAnswer:
17660
17666
  return this.handleSaveAnswerEvent(payload);
17661
17667
  default:
17662
- return this.hostEventFallback(hostEvent, payload);
17668
+ return this.hostEventFallback(hostEvent, payload, context);
17663
17669
  }
17664
17670
  }
17665
17671
  }
17666
17672
 
17667
- const defaultUrls = {
17668
- [InterceptedApiType.METADATA]: [
17669
- '/prism/?op=CreateAnswerSession',
17670
- '/prism/?op=GetV2SourceDetail',
17671
- ],
17672
- [InterceptedApiType.ANSWER_DATA]: [
17673
- '/prism/?op=GetChartWithData',
17674
- '/prism/?op=GetTableWithHeadlineData',
17675
- ],
17676
- [InterceptedApiType.LIVEBOARD_DATA]: [
17677
- '/prism/?op=LoadContextBook'
17678
- ],
17679
- };
17680
- const formatInterceptUrl = (url) => {
17681
- const host = getThoughtSpotHost(getEmbedConfig());
17682
- if (url.startsWith('/'))
17683
- return `${host}${url}`;
17684
- return url;
17685
- };
17686
- const processInterceptUrls = (interceptUrls) => {
17687
- let processedUrls = [...interceptUrls];
17688
- Object.entries(defaultUrls).forEach(([apiType, apiTypeUrls]) => {
17689
- if (!processedUrls.includes(apiType))
17690
- return;
17691
- processedUrls = processedUrls.filter(url => url !== apiType);
17692
- processedUrls = [...processedUrls, ...apiTypeUrls];
17693
- });
17694
- return processedUrls.map(url => formatInterceptUrl(url));
17695
- };
17696
- const getInterceptInitData = (embedConfig, viewConfig) => {
17697
- const enableApiIntercept = (embedConfig.enableApiIntercept || viewConfig.enableApiIntercept) && (viewConfig.enableApiIntercept !== false);
17698
- if (!enableApiIntercept)
17699
- return {
17700
- enableApiIntercept: false,
17701
- };
17702
- const combinedUrls = [...(embedConfig.interceptUrls || []), ...(viewConfig.interceptUrls || [])];
17703
- if (viewConfig.isOnBeforeGetVizDataInterceptEnabled) {
17704
- combinedUrls.push(InterceptedApiType.ANSWER_DATA);
17705
- }
17706
- const shouldInterceptAll = combinedUrls.includes(InterceptedApiType.ALL);
17707
- const interceptUrls = shouldInterceptAll ? [InterceptedApiType.ALL] : processInterceptUrls(combinedUrls);
17708
- const interceptTimeout = embedConfig.interceptTimeout || viewConfig.interceptTimeout;
17709
- return {
17710
- interceptUrls,
17711
- interceptTimeout,
17712
- enableApiIntercept,
17713
- };
17714
- };
17715
- /**
17716
- *
17717
- * @param fetchInit
17718
- */
17719
- const parseInterceptData = (eventDataString) => {
17720
- try {
17721
- const { input, init } = JSON.parse(eventDataString);
17722
- init.body = JSON.parse(init.body);
17723
- const parsedInit = { input, init };
17724
- return [parsedInit, null];
17725
- }
17726
- catch (error) {
17727
- return [null, error];
17728
- }
17729
- };
17730
- const handleInterceptEvent = async (params) => {
17731
- var _a, _b, _c, _d, _e;
17732
- const { eventData, executeEvent, viewConfig, getUnsavedAnswerTml } = params;
17733
- const [interceptData, bodyParseError] = parseInterceptData(eventData.data);
17734
- if (bodyParseError) {
17735
- executeEvent(exports.EmbedEvent.Error, {
17736
- error: 'Error parsing api intercept body',
17737
- });
17738
- logger$3.error('Error parsing request body', bodyParseError);
17739
- return;
17740
- }
17741
- const { input: requestUrl, init } = interceptData;
17742
- const sessionId = (_c = (_b = (_a = init === null || init === void 0 ? void 0 : init.body) === null || _a === void 0 ? void 0 : _a.variables) === null || _b === void 0 ? void 0 : _b.session) === null || _c === void 0 ? void 0 : _c.sessionId;
17743
- const vizId = (_e = (_d = init === null || init === void 0 ? void 0 : init.body) === null || _d === void 0 ? void 0 : _d.variables) === null || _e === void 0 ? void 0 : _e.contextBookId;
17744
- if (defaultUrls.ANSWER_DATA.includes(requestUrl) && viewConfig.isOnBeforeGetVizDataInterceptEnabled) {
17745
- const answerTml = await getUnsavedAnswerTml({ sessionId, vizId });
17746
- executeEvent(exports.EmbedEvent.OnBeforeGetVizDataIntercept, { data: { data: answerTml } });
17747
- }
17748
- executeEvent(exports.EmbedEvent.ApiIntercept, interceptData);
17749
- };
17750
- const processLegacyInterceptResponse = (payload) => {
17751
- var _a, _b, _c, _d, _e, _f, _g;
17752
- const errorText = ((_a = payload === null || payload === void 0 ? void 0 : payload.data) === null || _a === void 0 ? void 0 : _a.errorText) || ((_c = (_b = payload === null || payload === void 0 ? void 0 : payload.data) === null || _b === void 0 ? void 0 : _b.error) === null || _c === void 0 ? void 0 : _c.errorText);
17753
- const errorDescription = ((_d = payload === null || payload === void 0 ? void 0 : payload.data) === null || _d === void 0 ? void 0 : _d.errorDescription) || ((_f = (_e = payload === null || payload === void 0 ? void 0 : payload.data) === null || _e === void 0 ? void 0 : _e.error) === null || _f === void 0 ? void 0 : _f.errorDescription);
17754
- const payloadToSend = {
17755
- execute: (_g = payload === null || payload === void 0 ? void 0 : payload.data) === null || _g === void 0 ? void 0 : _g.execute,
17756
- response: {
17757
- body: {
17758
- errors: [
17759
- {
17760
- title: errorText,
17761
- description: errorDescription,
17762
- isUserError: true,
17763
- },
17764
- ],
17765
- data: {},
17766
- },
17767
- },
17768
- };
17769
- return { data: payloadToSend };
17770
- };
17771
-
17772
17673
  /**
17773
17674
  * Copyright (c) 2022
17774
17675
  *
@@ -17822,27 +17723,6 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
17822
17723
  */
17823
17724
  this.fullscreenChangeHandler = null;
17824
17725
  this.subscribedListeners = {};
17825
- this.messageEventListener = async (event) => {
17826
- const eventType = this.getEventType(event);
17827
- const eventPort = this.getEventPort(event);
17828
- const eventData = this.formatEventData(event, eventType);
17829
- if (event.source === this.iFrame.contentWindow) {
17830
- const processedEventData = await processEventData(eventType, eventData, this.thoughtSpotHost, this.isPreRendered ? this.preRenderWrapper : this.el);
17831
- const executeEvent = (_eventType, data) => {
17832
- this.executeCallbacks(_eventType, data, eventPort);
17833
- };
17834
- if (eventType === exports.EmbedEvent.ApiIntercept && this.viewConfig.enableApiIntercept) {
17835
- const getUnsavedAnswerTml = async (props) => {
17836
- var _a;
17837
- const response = await this.triggerUIPassThrough(UIPassthroughEvent.GetUnsavedAnswerTML, props);
17838
- return (_a = response[0]) === null || _a === void 0 ? void 0 : _a.value;
17839
- };
17840
- handleInterceptEvent({ eventData: processedEventData, executeEvent, embedConfig: this.embedConfig, viewConfig: this.viewConfig, getUnsavedAnswerTml });
17841
- return;
17842
- }
17843
- this.executeCallbacks(eventType, processedEventData, eventPort);
17844
- }
17845
- };
17846
17726
  /**
17847
17727
  * Send Custom style as part of payload of APP_INIT
17848
17728
  * @param _
@@ -17927,18 +17807,6 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
17927
17807
  this.on(exports.EmbedEvent.AuthInit, authInitHandler, { start: false }, true);
17928
17808
  };
17929
17809
  this.showPreRenderByDefault = false;
17930
- this.createEmbedEventResponder = (eventPort, eventType) => {
17931
- const { enableApiIntercept } = getInterceptInitData(this.embedConfig, this.viewConfig);
17932
- if (eventType === exports.EmbedEvent.OnBeforeGetVizDataIntercept && enableApiIntercept) {
17933
- return (payload) => {
17934
- const payloadToSend = processLegacyInterceptResponse(payload);
17935
- this.triggerEventOnPort(eventPort, payloadToSend);
17936
- };
17937
- }
17938
- return (payload) => {
17939
- this.triggerEventOnPort(eventPort, payload);
17940
- };
17941
- };
17942
17810
  /**
17943
17811
  * @hidden
17944
17812
  * Internal state to track if the embed container is loaded.
@@ -18124,8 +17992,16 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
18124
17992
  */
18125
17993
  subscribeToMessageEvents() {
18126
17994
  this.unsubscribeToMessageEvents();
18127
- window.addEventListener('message', this.messageEventListener);
18128
- this.subscribedListeners.message = this.messageEventListener;
17995
+ const messageEventListener = (event) => {
17996
+ const eventType = this.getEventType(event);
17997
+ const eventPort = this.getEventPort(event);
17998
+ const eventData = this.formatEventData(event, eventType);
17999
+ if (event.source === this.iFrame.contentWindow) {
18000
+ this.executeCallbacks(eventType, processEventData(eventType, eventData, this.thoughtSpotHost, this.isPreRendered ? this.preRenderWrapper : this.el), eventPort);
18001
+ }
18002
+ };
18003
+ window.addEventListener('message', messageEventListener);
18004
+ this.subscribedListeners.message = messageEventListener;
18129
18005
  }
18130
18006
  /**
18131
18007
  * Adds event listeners for both network and message events.
@@ -18186,7 +18062,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
18186
18062
  message: customActionsResult.errors,
18187
18063
  });
18188
18064
  }
18189
- const baseInitData = {
18065
+ return {
18190
18066
  customisations: getCustomisations(this.embedConfig, this.viewConfig),
18191
18067
  authToken,
18192
18068
  runtimeFilterParams: this.viewConfig.excludeRuntimeFiltersfromURL
@@ -18204,9 +18080,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
18204
18080
  customVariablesForThirdPartyTools: this.embedConfig.customVariablesForThirdPartyTools || {},
18205
18081
  hiddenListColumns: this.viewConfig.hiddenListColumns || [],
18206
18082
  customActions: customActionsResult.actions,
18207
- ...getInterceptInitData(this.embedConfig, this.viewConfig),
18208
18083
  };
18209
- return baseInitData;
18210
18084
  }
18211
18085
  async getAppInitData() {
18212
18086
  return this.getDefaultAppInitData();
@@ -18635,8 +18509,9 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
18635
18509
  // When start status is false it trigger only end releated
18636
18510
  // payload
18637
18511
  || (!callbackObj.options.start && dataStatus === embedEventStatus.END)) {
18638
- const responder = this.createEmbedEventResponder(eventPort, eventType);
18639
- callbackObj.callback(data, responder);
18512
+ callbackObj.callback(data, (payload) => {
18513
+ this.triggerEventOnPort(eventPort, payload);
18514
+ });
18640
18515
  }
18641
18516
  });
18642
18517
  }
@@ -18811,7 +18686,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
18811
18686
  * @param {any} data The payload to send with the message
18812
18687
  * @returns A promise that resolves with the response from the embedded app
18813
18688
  */
18814
- async trigger(messageType, data = {}) {
18689
+ async trigger(messageType, data = {}, context = {}) {
18815
18690
  uploadMixpanelEvent(`${MIXPANEL_EVENT.VISUAL_SDK_TRIGGER}-${messageType}`);
18816
18691
  if (!this.isRendered) {
18817
18692
  this.handleError('Please call render before triggering events');
@@ -18828,7 +18703,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
18828
18703
  return null;
18829
18704
  }
18830
18705
  // send an empty object, this is needed for liveboard default handlers
18831
- return this.hostEventClient.triggerHostEvent(messageType, data);
18706
+ return this.hostEventClient.triggerHostEvent(messageType, data, context);
18832
18707
  }
18833
18708
  /**
18834
18709
  * Triggers an event to the embedded app, skipping the UI flow.
@@ -19420,8 +19295,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
19420
19295
  if (hideSearchBar) {
19421
19296
  queryParams[Param.HideSearchBar] = true;
19422
19297
  }
19423
- const { enableApiIntercept } = getInterceptInitData(this.embedConfig, this.viewConfig);
19424
- if (isOnBeforeGetVizDataInterceptEnabled && !enableApiIntercept) {
19298
+ if (isOnBeforeGetVizDataInterceptEnabled) {
19425
19299
  queryParams[Param.IsOnBeforeGetVizDataInterceptEnabled] = isOnBeforeGetVizDataInterceptEnabled;
19426
19300
  }
19427
19301
  if (!focusSearchBarOnRender) {
@@ -19682,7 +19556,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
19682
19556
  * embedded Liveboard or visualization.
19683
19557
  */
19684
19558
  getEmbedParams() {
19685
- const { tag, hideObjects, liveboardV2, showPrimaryNavbar, disableProfileAndHelp, hideHamburger, hideObjectSearch, hideNotification, hideApplicationSwitcher, hideOrgSwitcher, enableSearchAssist, fullHeight, dataPanelV2 = true, hideLiveboardHeader = false, showLiveboardTitle = true, showLiveboardDescription = true, hideHomepageLeftNav = false, modularHomeExperience = false, isLiveboardHeaderSticky = true, enableAskSage, collapseSearchBarInitially = false, enable2ColumnLayout, enableCustomColumnGroups = false, isOnBeforeGetVizDataInterceptEnabled = false, dataPanelCustomGroupsAccordionInitialState = DataPanelCustomColumnGroupsAccordionState.EXPAND_ALL, collapseSearchBar = true, isLiveboardCompactHeaderEnabled = false, showLiveboardVerifiedBadge = true, showLiveboardReverifyBanner = true, hideIrrelevantChipsInLiveboardTabs = false, homePageSearchBarMode, isUnifiedSearchExperienceEnabled = true, enablePendoHelp = true, discoveryExperience, coverAndFilterOptionInPDF = false, liveboardXLSXCSVDownload = false, isLiveboardStylingAndGroupingEnabled, isPNGInScheduledEmailsEnabled = false, isLinkParametersEnabled, } = this.viewConfig;
19559
+ const { tag, hideTagFilterChips, hideObjects, liveboardV2, showPrimaryNavbar, disableProfileAndHelp, hideHamburger, hideObjectSearch, hideNotification, hideApplicationSwitcher, hideOrgSwitcher, enableSearchAssist, fullHeight, dataPanelV2 = true, hideLiveboardHeader = false, showLiveboardTitle = true, showLiveboardDescription = true, hideHomepageLeftNav = false, modularHomeExperience = false, isLiveboardHeaderSticky = true, enableAskSage, collapseSearchBarInitially = false, enable2ColumnLayout, enableCustomColumnGroups = false, isOnBeforeGetVizDataInterceptEnabled = false, dataPanelCustomGroupsAccordionInitialState = DataPanelCustomColumnGroupsAccordionState.EXPAND_ALL, collapseSearchBar = true, isLiveboardCompactHeaderEnabled = false, showLiveboardVerifiedBadge = true, showLiveboardReverifyBanner = true, hideIrrelevantChipsInLiveboardTabs = false, homePageSearchBarMode, isUnifiedSearchExperienceEnabled = true, enablePendoHelp = true, discoveryExperience, coverAndFilterOptionInPDF = false, liveboardXLSXCSVDownload = false, isLiveboardStylingAndGroupingEnabled, isPNGInScheduledEmailsEnabled = false, isLinkParametersEnabled, } = this.viewConfig;
19686
19560
  let params = {};
19687
19561
  params[Param.PrimaryNavHidden] = !showPrimaryNavbar;
19688
19562
  params[Param.HideProfleAndHelp] = !!disableProfileAndHelp;
@@ -19735,8 +19609,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
19735
19609
  if (enableAskSage) {
19736
19610
  params[Param.enableAskSage] = enableAskSage;
19737
19611
  }
19738
- const { enableApiIntercept } = getInterceptInitData(this.embedConfig, this.viewConfig);
19739
- if (isOnBeforeGetVizDataInterceptEnabled && !enableApiIntercept) {
19612
+ if (isOnBeforeGetVizDataInterceptEnabled) {
19740
19613
  params[Param.IsOnBeforeGetVizDataInterceptEnabled] = isOnBeforeGetVizDataInterceptEnabled;
19741
19614
  }
19742
19615
  if (homePageSearchBarMode) {
@@ -19751,6 +19624,9 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
19751
19624
  if (isPNGInScheduledEmailsEnabled !== undefined) {
19752
19625
  params[Param.isPNGInScheduledEmailsEnabled] = isPNGInScheduledEmailsEnabled;
19753
19626
  }
19627
+ if (hideTagFilterChips !== undefined) {
19628
+ params[Param.HideTagFilterChips] = hideTagFilterChips;
19629
+ }
19754
19630
  if (isLinkParametersEnabled !== undefined) {
19755
19631
  params[Param.isLinkParametersEnabled] = isLinkParametersEnabled;
19756
19632
  }
@@ -21039,6 +20915,7 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
21039
20915
  });
21040
20916
  handleRendering(tsEmbed);
21041
20917
  if (forwardedRef) {
20918
+ // eslint-disable-next-line no-param-reassign
21042
20919
  forwardedRef.current = tsEmbed;
21043
20920
  }
21044
20921
  return () => {
@@ -21259,7 +21136,7 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
21259
21136
  */
21260
21137
  const SpotterMessage = React.forwardRef((props, ref) => {
21261
21138
  const { message, query: _, ...otherProps } = props;
21262
- return React.createElement(ConversationMessage, { ref: ref, ...message, ...otherProps });
21139
+ return (React.createElement(ConversationMessage, { ref: ref, ...message, ...otherProps }));
21263
21140
  });
21264
21141
  /**
21265
21142
  * React component for PreRendered Conversation embed.
@@ -21852,7 +21729,8 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
21852
21729
  return {
21853
21730
  onAnchor: (source) => {
21854
21731
  aliasObjects.push(source);
21855
- prevAnchors ?? (prevAnchors = anchorNames(doc));
21732
+ if (!prevAnchors)
21733
+ prevAnchors = anchorNames(doc);
21856
21734
  const anchor = findNewAnchor(prefix, prevAnchors);
21857
21735
  prevAnchors.add(anchor);
21858
21736
  return anchor;
@@ -22016,36 +21894,23 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
22016
21894
  * Resolve the value of this alias within `doc`, finding the last
22017
21895
  * instance of the `source` anchor before this node.
22018
21896
  */
22019
- resolve(doc, ctx) {
22020
- let nodes;
22021
- if (ctx?.aliasResolveCache) {
22022
- nodes = ctx.aliasResolveCache;
22023
- }
22024
- else {
22025
- nodes = [];
22026
- visit$1(doc, {
22027
- Node: (_key, node) => {
22028
- if (isAlias(node) || hasAnchor(node))
22029
- nodes.push(node);
22030
- }
22031
- });
22032
- if (ctx)
22033
- ctx.aliasResolveCache = nodes;
22034
- }
21897
+ resolve(doc) {
22035
21898
  let found = undefined;
22036
- for (const node of nodes) {
22037
- if (node === this)
22038
- break;
22039
- if (node.anchor === this.source)
22040
- found = node;
22041
- }
21899
+ visit$1(doc, {
21900
+ Node: (_key, node) => {
21901
+ if (node === this)
21902
+ return visit$1.BREAK;
21903
+ if (node.anchor === this.source)
21904
+ found = node;
21905
+ }
21906
+ });
22042
21907
  return found;
22043
21908
  }
22044
21909
  toJSON(_arg, ctx) {
22045
21910
  if (!ctx)
22046
21911
  return { source: this.source };
22047
21912
  const { anchors, doc, maxAliasCount } = ctx;
22048
- const source = this.resolve(doc, ctx);
21913
+ const source = this.resolve(doc);
22049
21914
  if (!source) {
22050
21915
  const msg = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
22051
21916
  throw new ReferenceError(msg);
@@ -22164,7 +22029,8 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
22164
22029
  if (aliasDuplicateObjects && value && typeof value === 'object') {
22165
22030
  ref = sourceObjects.get(value);
22166
22031
  if (ref) {
22167
- ref.anchor ?? (ref.anchor = onAnchor(value));
22032
+ if (!ref.anchor)
22033
+ ref.anchor = onAnchor(value);
22168
22034
  return new Alias(ref.anchor);
22169
22035
  }
22170
22036
  else {
@@ -22675,7 +22541,7 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
22675
22541
  const { blockQuote, commentString, lineWidth } = ctx.options;
22676
22542
  // 1. Block can't end in whitespace unless the last line is non-empty.
22677
22543
  // 2. Strings consisting of only whitespace are best rendered explicitly.
22678
- if (!blockQuote || /\n[\t ]+$/.test(value)) {
22544
+ if (!blockQuote || /\n[\t ]+$/.test(value) || /^\s*$/.test(value)) {
22679
22545
  return quotedString(value, ctx);
22680
22546
  }
22681
22547
  const indent = ctx.indent ||
@@ -22735,32 +22601,23 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
22735
22601
  start = start.replace(/\n+/g, `$&${indent}`);
22736
22602
  }
22737
22603
  const indentSize = indent ? '2' : '1'; // root is at -1
22738
- // Leading | or > is added later
22739
- let header = (startWithSpace ? indentSize : '') + chomp;
22604
+ let header = (literal ? '|' : '>') + (startWithSpace ? indentSize : '') + chomp;
22740
22605
  if (comment) {
22741
22606
  header += ' ' + commentString(comment.replace(/ ?[\r\n]+/g, ' '));
22742
22607
  if (onComment)
22743
22608
  onComment();
22744
22609
  }
22745
- if (!literal) {
22746
- const foldedValue = value
22747
- .replace(/\n+/g, '\n$&')
22748
- .replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, '$1$2') // more-indented lines aren't folded
22749
- // ^ more-ind. ^ empty ^ capture next empty lines only at end of indent
22750
- .replace(/\n+/g, `$&${indent}`);
22751
- let literalFallback = false;
22752
- const foldOptions = getFoldOptions(ctx, true);
22753
- if (blockQuote !== 'folded' && type !== Scalar.BLOCK_FOLDED) {
22754
- foldOptions.onOverflow = () => {
22755
- literalFallback = true;
22756
- };
22757
- }
22758
- const body = foldFlowLines(`${start}${foldedValue}${end}`, indent, FOLD_BLOCK, foldOptions);
22759
- if (!literalFallback)
22760
- return `>${header}\n${indent}${body}`;
22610
+ if (literal) {
22611
+ value = value.replace(/\n+/g, `$&${indent}`);
22612
+ return `${header}\n${indent}${start}${value}${end}`;
22761
22613
  }
22762
- value = value.replace(/\n+/g, `$&${indent}`);
22763
- return `|${header}\n${indent}${start}${value}${end}`;
22614
+ value = value
22615
+ .replace(/\n+/g, '\n$&')
22616
+ .replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, '$1$2') // more-indented lines aren't folded
22617
+ // ^ more-ind. ^ empty ^ capture next empty lines only at end of indent
22618
+ .replace(/\n+/g, `$&${indent}`);
22619
+ const body = foldFlowLines(`${start}${value}${end}`, indent, FOLD_BLOCK, getFoldOptions(ctx, true));
22620
+ return `${header}\n${indent}${body}`;
22764
22621
  }
22765
22622
  function plainString(item, ctx, onComment, onChompKeep) {
22766
22623
  const { type, value } = item;
@@ -22769,9 +22626,10 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
22769
22626
  (inFlow && /[[\]{},]/.test(value))) {
22770
22627
  return quotedString(value, ctx);
22771
22628
  }
22772
- if (/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(value)) {
22629
+ if (!value ||
22630
+ /^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(value)) {
22773
22631
  // not allowed:
22774
- // - '-' or '?'
22632
+ // - empty string, '-' or '?'
22775
22633
  // - start with an indicator character (except [?:-]) or /[?-] /
22776
22634
  // - '\n ', ': ' or ' \n' anywhere
22777
22635
  // - '#' not preceded by a non-space char
@@ -22900,12 +22758,7 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
22900
22758
  let obj;
22901
22759
  if (isScalar$1(item)) {
22902
22760
  obj = item.value;
22903
- let match = tags.filter(t => t.identify?.(obj));
22904
- if (match.length > 1) {
22905
- const testMatch = match.filter(t => t.test);
22906
- if (testMatch.length > 0)
22907
- match = testMatch;
22908
- }
22761
+ const match = tags.filter(t => t.identify?.(obj));
22909
22762
  tagObj =
22910
22763
  match.find(t => t.format === item.format) ?? match.find(t => !t.format);
22911
22764
  }
@@ -22914,7 +22767,7 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
22914
22767
  tagObj = tags.find(t => t.nodeClass && obj instanceof t.nodeClass);
22915
22768
  }
22916
22769
  if (!tagObj) {
22917
- const name = obj?.constructor?.name ?? (obj === null ? 'null' : typeof obj);
22770
+ const name = obj?.constructor?.name ?? typeof obj;
22918
22771
  throw new Error(`Tag not resolved for ${name} value`);
22919
22772
  }
22920
22773
  return tagObj;
@@ -22929,7 +22782,7 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
22929
22782
  anchors.add(anchor);
22930
22783
  props.push(`&${anchor}`);
22931
22784
  }
22932
- const tag = node.tag ?? (tagObj.default ? null : tagObj.tag);
22785
+ const tag = node.tag ? node.tag : tagObj.default ? null : tagObj.tag;
22933
22786
  if (tag)
22934
22787
  props.push(doc.directives.tagString(tag));
22935
22788
  return props.join(' ');
@@ -22955,7 +22808,8 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
22955
22808
  const node = isNode(item)
22956
22809
  ? item
22957
22810
  : ctx.doc.createNode(item, { onTagObj: o => (tagObj = o) });
22958
- tagObj ?? (tagObj = getTagObject(ctx.doc.schema.tags, node));
22811
+ if (!tagObj)
22812
+ tagObj = getTagObject(ctx.doc.schema.tags, node);
22959
22813
  const props = stringifyProps(node, tagObj, ctx);
22960
22814
  if (props.length > 0)
22961
22815
  ctx.indentAtStart = (ctx.indentAtStart ?? 0) + props.length + 1;
@@ -23117,10 +22971,54 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
23117
22971
 
23118
22972
  function warn(logLevel, warning) {
23119
22973
  if (logLevel === 'debug' || logLevel === 'warn') {
23120
- console.warn(warning);
22974
+ if (typeof process !== 'undefined' && process.emitWarning)
22975
+ process.emitWarning(warning);
22976
+ else
22977
+ console.warn(warning);
23121
22978
  }
23122
22979
  }
23123
22980
 
22981
+ const MERGE_KEY = '<<';
22982
+ function addPairToJSMap(ctx, map, { key, value }) {
22983
+ if (ctx?.doc.schema.merge && isMergeKey(key)) {
22984
+ value = isAlias(value) ? value.resolve(ctx.doc) : value;
22985
+ if (isSeq(value))
22986
+ for (const it of value.items)
22987
+ mergeToJSMap(ctx, map, it);
22988
+ else if (Array.isArray(value))
22989
+ for (const it of value)
22990
+ mergeToJSMap(ctx, map, it);
22991
+ else
22992
+ mergeToJSMap(ctx, map, value);
22993
+ }
22994
+ else {
22995
+ const jsKey = toJS(key, '', ctx);
22996
+ if (map instanceof Map) {
22997
+ map.set(jsKey, toJS(value, jsKey, ctx));
22998
+ }
22999
+ else if (map instanceof Set) {
23000
+ map.add(jsKey);
23001
+ }
23002
+ else {
23003
+ const stringKey = stringifyKey(key, jsKey, ctx);
23004
+ const jsValue = toJS(value, stringKey, ctx);
23005
+ if (stringKey in map)
23006
+ Object.defineProperty(map, stringKey, {
23007
+ value: jsValue,
23008
+ writable: true,
23009
+ enumerable: true,
23010
+ configurable: true
23011
+ });
23012
+ else
23013
+ map[stringKey] = jsValue;
23014
+ }
23015
+ }
23016
+ return map;
23017
+ }
23018
+ const isMergeKey = (key) => key === MERGE_KEY ||
23019
+ (isScalar$1(key) &&
23020
+ key.value === MERGE_KEY &&
23021
+ (!key.type || key.type === Scalar.PLAIN));
23124
23022
  // If the value associated with a merge key is a single mapping node, each of
23125
23023
  // its key/value pairs is inserted into the current mapping, unless the key
23126
23024
  // already exists in it. If the value associated with the merge key is a
@@ -23128,35 +23026,7 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
23128
23026
  // of these nodes is merged in turn according to its order in the sequence.
23129
23027
  // Keys in mapping nodes earlier in the sequence override keys specified in
23130
23028
  // later mapping nodes. -- http://yaml.org/type/merge.html
23131
- const MERGE_KEY = '<<';
23132
- const merge = {
23133
- identify: value => value === MERGE_KEY ||
23134
- (typeof value === 'symbol' && value.description === MERGE_KEY),
23135
- default: 'key',
23136
- tag: 'tag:yaml.org,2002:merge',
23137
- test: /^<<$/,
23138
- resolve: () => Object.assign(new Scalar(Symbol(MERGE_KEY)), {
23139
- addToJSMap: addMergeToJSMap
23140
- }),
23141
- stringify: () => MERGE_KEY
23142
- };
23143
- const isMergeKey = (ctx, key) => (merge.identify(key) ||
23144
- (isScalar$1(key) &&
23145
- (!key.type || key.type === Scalar.PLAIN) &&
23146
- merge.identify(key.value))) &&
23147
- ctx?.doc.schema.tags.some(tag => tag.tag === merge.tag && tag.default);
23148
- function addMergeToJSMap(ctx, map, value) {
23149
- value = ctx && isAlias(value) ? value.resolve(ctx.doc) : value;
23150
- if (isSeq(value))
23151
- for (const it of value.items)
23152
- mergeValue(ctx, map, it);
23153
- else if (Array.isArray(value))
23154
- for (const it of value)
23155
- mergeValue(ctx, map, it);
23156
- else
23157
- mergeValue(ctx, map, value);
23158
- }
23159
- function mergeValue(ctx, map, value) {
23029
+ function mergeToJSMap(ctx, map, value) {
23160
23030
  const source = ctx && isAlias(value) ? value.resolve(ctx.doc) : value;
23161
23031
  if (!isMap(source))
23162
23032
  throw new Error('Merge sources must be maps or map aliases');
@@ -23180,41 +23050,9 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
23180
23050
  }
23181
23051
  return map;
23182
23052
  }
23183
-
23184
- function addPairToJSMap(ctx, map, { key, value }) {
23185
- if (isNode(key) && key.addToJSMap)
23186
- key.addToJSMap(ctx, map, value);
23187
- // TODO: Should drop this special case for bare << handling
23188
- else if (isMergeKey(ctx, key))
23189
- addMergeToJSMap(ctx, map, value);
23190
- else {
23191
- const jsKey = toJS(key, '', ctx);
23192
- if (map instanceof Map) {
23193
- map.set(jsKey, toJS(value, jsKey, ctx));
23194
- }
23195
- else if (map instanceof Set) {
23196
- map.add(jsKey);
23197
- }
23198
- else {
23199
- const stringKey = stringifyKey(key, jsKey, ctx);
23200
- const jsValue = toJS(value, stringKey, ctx);
23201
- if (stringKey in map)
23202
- Object.defineProperty(map, stringKey, {
23203
- value: jsValue,
23204
- writable: true,
23205
- enumerable: true,
23206
- configurable: true
23207
- });
23208
- else
23209
- map[stringKey] = jsValue;
23210
- }
23211
- }
23212
- return map;
23213
- }
23214
23053
  function stringifyKey(key, jsKey, ctx) {
23215
23054
  if (jsKey === null)
23216
23055
  return '';
23217
- // eslint-disable-next-line @typescript-eslint/no-base-to-string
23218
23056
  if (typeof jsKey !== 'object')
23219
23057
  return String(jsKey);
23220
23058
  if (isNode(key) && ctx?.doc) {
@@ -23847,7 +23685,7 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
23847
23685
  identify: value => typeof value === 'boolean',
23848
23686
  default: true,
23849
23687
  tag: 'tag:yaml.org,2002:bool',
23850
- test: /^true$|^false$/,
23688
+ test: /^true|false$/,
23851
23689
  resolve: str => str === 'true',
23852
23690
  stringify: stringifyJSON
23853
23691
  },
@@ -23892,7 +23730,10 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
23892
23730
  * document.querySelector('#photo').src = URL.createObjectURL(blob)
23893
23731
  */
23894
23732
  resolve(src, onError) {
23895
- if (typeof atob === 'function') {
23733
+ if (typeof Buffer === 'function') {
23734
+ return Buffer.from(src, 'base64');
23735
+ }
23736
+ else if (typeof atob === 'function') {
23896
23737
  // On IE 11, atob() can't handle newlines
23897
23738
  const str = atob(src.replace(/[\n\r]/g, ''));
23898
23739
  const buffer = new Uint8Array(str.length);
@@ -23906,11 +23747,15 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
23906
23747
  }
23907
23748
  },
23908
23749
  stringify({ comment, type, value }, ctx, onComment, onChompKeep) {
23909
- if (!value)
23910
- return '';
23911
23750
  const buf = value; // checked earlier by binary.identify()
23912
23751
  let str;
23913
- if (typeof btoa === 'function') {
23752
+ if (typeof Buffer === 'function') {
23753
+ str =
23754
+ buf instanceof Buffer
23755
+ ? buf.toString('base64')
23756
+ : Buffer.from(buf.buffer).toString('base64');
23757
+ }
23758
+ else if (typeof btoa === 'function') {
23914
23759
  let s = '';
23915
23760
  for (let i = 0; i < buf.length; ++i)
23916
23761
  s += String.fromCharCode(buf[i]);
@@ -23919,7 +23764,8 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
23919
23764
  else {
23920
23765
  throw new Error('This environment does not support writing binary tags; either Buffer or btoa is required');
23921
23766
  }
23922
- type ?? (type = Scalar.BLOCK_LITERAL);
23767
+ if (!type)
23768
+ type = Scalar.BLOCK_LITERAL;
23923
23769
  if (type !== Scalar.QUOTE_DOUBLE) {
23924
23770
  const lineWidth = Math.max(ctx.options.lineWidth - ctx.indent.length, ctx.options.minContentWidth);
23925
23771
  const n = Math.ceil(str.length / lineWidth);
@@ -24388,7 +24234,7 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
24388
24234
  }
24389
24235
  return new Date(date);
24390
24236
  },
24391
- stringify: ({ value }) => value?.toISOString().replace(/(T00:00:00)?\.000Z$/, '') ?? ''
24237
+ stringify: ({ value }) => value.toISOString().replace(/((T00:00)?:00)?\.000Z$/, '')
24392
24238
  };
24393
24239
 
24394
24240
  const schema = [
@@ -24406,7 +24252,6 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
24406
24252
  floatExp,
24407
24253
  float,
24408
24254
  binary,
24409
- merge,
24410
24255
  omap,
24411
24256
  pairs,
24412
24257
  set,
@@ -24434,7 +24279,6 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
24434
24279
  intOct: intOct$1,
24435
24280
  intTime,
24436
24281
  map,
24437
- merge,
24438
24282
  null: nullTag,
24439
24283
  omap,
24440
24284
  pairs,
@@ -24444,20 +24288,13 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
24444
24288
  };
24445
24289
  const coreKnownTags = {
24446
24290
  'tag:yaml.org,2002:binary': binary,
24447
- 'tag:yaml.org,2002:merge': merge,
24448
24291
  'tag:yaml.org,2002:omap': omap,
24449
24292
  'tag:yaml.org,2002:pairs': pairs,
24450
24293
  'tag:yaml.org,2002:set': set,
24451
24294
  'tag:yaml.org,2002:timestamp': timestamp
24452
24295
  };
24453
- function getTags(customTags, schemaName, addMergeTag) {
24454
- const schemaTags = schemas.get(schemaName);
24455
- if (schemaTags && !customTags) {
24456
- return addMergeTag && !schemaTags.includes(merge)
24457
- ? schemaTags.concat(merge)
24458
- : schemaTags.slice();
24459
- }
24460
- let tags = schemaTags;
24296
+ function getTags(customTags, schemaName) {
24297
+ let tags = schemas.get(schemaName);
24461
24298
  if (!tags) {
24462
24299
  if (Array.isArray(customTags))
24463
24300
  tags = [];
@@ -24476,21 +24313,17 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
24476
24313
  else if (typeof customTags === 'function') {
24477
24314
  tags = customTags(tags.slice());
24478
24315
  }
24479
- if (addMergeTag)
24480
- tags = tags.concat(merge);
24481
- return tags.reduce((tags, tag) => {
24482
- const tagObj = typeof tag === 'string' ? tagsByName[tag] : tag;
24483
- if (!tagObj) {
24484
- const tagName = JSON.stringify(tag);
24485
- const keys = Object.keys(tagsByName)
24486
- .map(key => JSON.stringify(key))
24487
- .join(', ');
24488
- throw new Error(`Unknown custom tag ${tagName}; use one of ${keys}`);
24489
- }
24490
- if (!tags.includes(tagObj))
24491
- tags.push(tagObj);
24492
- return tags;
24493
- }, []);
24316
+ return tags.map(tag => {
24317
+ if (typeof tag !== 'string')
24318
+ return tag;
24319
+ const tagObj = tagsByName[tag];
24320
+ if (tagObj)
24321
+ return tagObj;
24322
+ const keys = Object.keys(tagsByName)
24323
+ .map(key => JSON.stringify(key))
24324
+ .join(', ');
24325
+ throw new Error(`Unknown custom tag "${tag}"; use one of ${keys}`);
24326
+ });
24494
24327
  }
24495
24328
 
24496
24329
  const sortMapEntriesByKey = (a, b) => a.key < b.key ? -1 : a.key > b.key ? 1 : 0;
@@ -24501,9 +24334,10 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
24501
24334
  : compat
24502
24335
  ? getTags(null, compat)
24503
24336
  : null;
24337
+ this.merge = !!merge;
24504
24338
  this.name = (typeof schema === 'string' && schema) || 'core';
24505
24339
  this.knownTags = resolveKnownTags ? coreKnownTags : {};
24506
- this.tags = getTags(customTags, this.name, merge);
24340
+ this.tags = getTags(customTags, this.name);
24507
24341
  this.toStringOptions = toStringDefaults ?? null;
24508
24342
  Object.defineProperty(this, MAP, { value: map });
24509
24343
  Object.defineProperty(this, SCALAR$1, { value: string });
@@ -24628,7 +24462,6 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
24628
24462
  logLevel: 'warn',
24629
24463
  prettyErrors: true,
24630
24464
  strict: true,
24631
- stringKeys: false,
24632
24465
  uniqueKeys: true,
24633
24466
  version: '1.2'
24634
24467
  }, options);
@@ -24852,7 +24685,7 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
24852
24685
  this.directives.yaml.version = '1.1';
24853
24686
  else
24854
24687
  this.directives = new Directives({ version: '1.1' });
24855
- opt = { resolveKnownTags: false, schema: 'yaml-1.1' };
24688
+ opt = { merge: true, resolveKnownTags: false, schema: 'yaml-1.1' };
24856
24689
  break;
24857
24690
  case '1.2':
24858
24691
  case 'next':
@@ -24860,7 +24693,7 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
24860
24693
  this.directives.yaml.version = version;
24861
24694
  else
24862
24695
  this.directives = new Directives({ version });
24863
- opt = { resolveKnownTags: true, schema: 'core' };
24696
+ opt = { merge: false, resolveKnownTags: true, schema: 'core' };
24864
24697
  break;
24865
24698
  case null:
24866
24699
  if (this.directives)
@@ -25038,7 +24871,7 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
25038
24871
  if (atNewline) {
25039
24872
  if (comment)
25040
24873
  comment += token.source;
25041
- else if (!found || indicator !== 'seq-item-ind')
24874
+ else
25042
24875
  spaceBefore = true;
25043
24876
  }
25044
24877
  else
@@ -25055,7 +24888,8 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
25055
24888
  if (token.source.endsWith(':'))
25056
24889
  onError(token.offset + token.source.length - 1, 'BAD_ALIAS', 'Anchor ending in : is ambiguous', true);
25057
24890
  anchor = token;
25058
- start ?? (start = token.offset);
24891
+ if (start === null)
24892
+ start = token.offset;
25059
24893
  atNewline = false;
25060
24894
  hasSpace = false;
25061
24895
  reqSpace = true;
@@ -25064,7 +24898,8 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
25064
24898
  if (tag)
25065
24899
  onError(token, 'MULTIPLE_TAGS', 'A node can have at most one tag');
25066
24900
  tag = token;
25067
- start ?? (start = token.offset);
24901
+ if (start === null)
24902
+ start = token.offset;
25068
24903
  atNewline = false;
25069
24904
  hasSpace = false;
25070
24905
  reqSpace = true;
@@ -25177,7 +25012,11 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
25177
25012
  return false;
25178
25013
  const isEqual = typeof uniqueKeys === 'function'
25179
25014
  ? uniqueKeys
25180
- : (a, b) => a === b || (isScalar$1(a) && isScalar$1(b) && a.value === b.value);
25015
+ : (a, b) => a === b ||
25016
+ (isScalar$1(a) &&
25017
+ isScalar$1(b) &&
25018
+ a.value === b.value &&
25019
+ !(a.value === '<<' && ctx.schema.merge));
25181
25020
  return items.some(pair => isEqual(pair.key, search));
25182
25021
  }
25183
25022
 
@@ -25226,14 +25065,12 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
25226
25065
  onError(offset, 'BAD_INDENT', startColMsg);
25227
25066
  }
25228
25067
  // key value
25229
- ctx.atKey = true;
25230
25068
  const keyStart = keyProps.end;
25231
25069
  const keyNode = key
25232
25070
  ? composeNode(ctx, key, keyProps, onError)
25233
25071
  : composeEmptyNode(ctx, keyStart, start, null, keyProps, onError);
25234
25072
  if (ctx.schema.compat)
25235
25073
  flowIndentCheck(bm.indent, key, onError);
25236
- ctx.atKey = false;
25237
25074
  if (mapIncludes(ctx, map.items, keyNode))
25238
25075
  onError(keyStart, 'DUPLICATE_KEY', 'Map keys must be unique');
25239
25076
  // value properties
@@ -25293,8 +25130,6 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
25293
25130
  const seq = new NodeClass(ctx.schema);
25294
25131
  if (ctx.atRoot)
25295
25132
  ctx.atRoot = false;
25296
- if (ctx.atKey)
25297
- ctx.atKey = false;
25298
25133
  let offset = bs.offset;
25299
25134
  let commentEnd = null;
25300
25135
  for (const { start, value } of bs.items) {
@@ -25379,8 +25214,6 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
25379
25214
  const atRoot = ctx.atRoot;
25380
25215
  if (atRoot)
25381
25216
  ctx.atRoot = false;
25382
- if (ctx.atKey)
25383
- ctx.atKey = false;
25384
25217
  let offset = fc.offset + fc.start.source.length;
25385
25218
  for (let i = 0; i < fc.items.length; ++i) {
25386
25219
  const collItem = fc.items[i];
@@ -25460,14 +25293,12 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
25460
25293
  else {
25461
25294
  // item is a key+value pair
25462
25295
  // key value
25463
- ctx.atKey = true;
25464
25296
  const keyStart = props.end;
25465
25297
  const keyNode = key
25466
25298
  ? composeNode(ctx, key, props, onError)
25467
25299
  : composeEmptyNode(ctx, keyStart, start, null, props, onError);
25468
25300
  if (isBlock(key))
25469
25301
  onError(keyNode.range, 'BLOCK_IN_FLOW', blockMsg);
25470
- ctx.atKey = false;
25471
25302
  // value properties
25472
25303
  const valueProps = resolveProps(sep ?? [], {
25473
25304
  flow: fcName,
@@ -25623,8 +25454,8 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
25623
25454
  tag = kt;
25624
25455
  }
25625
25456
  else {
25626
- if (kt) {
25627
- onError(tagToken, 'BAD_COLLECTION_TYPE', `${kt.tag} used for ${expType} collection, but expects ${kt.collection ?? 'scalar'}`, true);
25457
+ if (kt?.collection) {
25458
+ onError(tagToken, 'BAD_COLLECTION_TYPE', `${kt.tag} used for ${expType} collection, but expects ${kt.collection}`, true);
25628
25459
  }
25629
25460
  else {
25630
25461
  onError(tagToken, 'TAG_RESOLVE_FAILED', `Unresolved tag: ${tagName}`, true);
@@ -26065,16 +25896,11 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
26065
25896
  const tagName = tagToken
26066
25897
  ? ctx.directives.tagName(tagToken.source, msg => onError(tagToken, 'TAG_RESOLVE_FAILED', msg))
26067
25898
  : null;
26068
- let tag;
26069
- if (ctx.options.stringKeys && ctx.atKey) {
26070
- tag = ctx.schema[SCALAR$1];
26071
- }
26072
- else if (tagName)
26073
- tag = findScalarTagByName(ctx.schema, value, tagName, tagToken, onError);
26074
- else if (token.type === 'scalar')
26075
- tag = findScalarTagByTest(ctx, value, token, onError);
26076
- else
26077
- tag = ctx.schema[SCALAR$1];
25899
+ const tag = tagToken && tagName
25900
+ ? findScalarTagByName(ctx.schema, value, tagName, tagToken, onError)
25901
+ : token.type === 'scalar'
25902
+ ? findScalarTagByTest(ctx, value, token, onError)
25903
+ : ctx.schema[SCALAR$1];
26078
25904
  let scalar;
26079
25905
  try {
26080
25906
  const res = tag.resolve(value, msg => onError(tagToken ?? token, 'TAG_RESOLVE_FAILED', msg), ctx.options);
@@ -26122,9 +25948,8 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
26122
25948
  onError(tagToken, 'TAG_RESOLVE_FAILED', `Unresolved tag: ${tagName}`, tagName !== 'tag:yaml.org,2002:str');
26123
25949
  return schema[SCALAR$1];
26124
25950
  }
26125
- function findScalarTagByTest({ atKey, directives, schema }, value, token, onError) {
26126
- const tag = schema.tags.find(tag => (tag.default === true || (atKey && tag.default === 'key')) &&
26127
- tag.test?.test(value)) || schema[SCALAR$1];
25951
+ function findScalarTagByTest({ directives, schema }, value, token, onError) {
25952
+ const tag = schema.tags.find(tag => tag.default && tag.test?.test(value)) || schema[SCALAR$1];
26128
25953
  if (schema.compat) {
26129
25954
  const compat = schema.compat.find(tag => tag.default && tag.test?.test(value)) ??
26130
25955
  schema[SCALAR$1];
@@ -26140,7 +25965,8 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
26140
25965
 
26141
25966
  function emptyScalarPosition(offset, before, pos) {
26142
25967
  if (before) {
26143
- pos ?? (pos = before.length);
25968
+ if (pos === null)
25969
+ pos = before.length;
26144
25970
  for (let i = pos - 1; i >= 0; --i) {
26145
25971
  let st = before[i];
26146
25972
  switch (st.type) {
@@ -26165,7 +25991,6 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
26165
25991
 
26166
25992
  const CN = { composeNode, composeEmptyNode };
26167
25993
  function composeNode(ctx, token, props, onError) {
26168
- const atKey = ctx.atKey;
26169
25994
  const { spaceBefore, comment, anchor, tag } = props;
26170
25995
  let node;
26171
25996
  let isSrcToken = true;
@@ -26201,14 +26026,6 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
26201
26026
  }
26202
26027
  if (anchor && node.anchor === '')
26203
26028
  onError(anchor, 'BAD_ALIAS', 'Anchor cannot be an empty string');
26204
- if (atKey &&
26205
- ctx.options.stringKeys &&
26206
- (!isScalar$1(node) ||
26207
- typeof node.value !== 'string' ||
26208
- (node.tag && node.tag !== 'tag:yaml.org,2002:str'))) {
26209
- const msg = 'With stringKeys, all keys must be strings';
26210
- onError(tag ?? token, 'NON_STRING_KEY', msg);
26211
- }
26212
26029
  if (spaceBefore)
26213
26030
  node.spaceBefore = true;
26214
26031
  if (comment) {
@@ -26261,7 +26078,6 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
26261
26078
  const opts = Object.assign({ _directives: directives }, options);
26262
26079
  const doc = new Document(undefined, opts);
26263
26080
  const ctx = {
26264
- atKey: false,
26265
26081
  atRoot: true,
26266
26082
  directives: doc.directives,
26267
26083
  options: doc.options,
@@ -28396,20 +28212,7 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
28396
28212
  default: {
28397
28213
  const bv = this.startBlockValue(map);
28398
28214
  if (bv) {
28399
- if (bv.type === 'block-seq') {
28400
- if (!it.explicitKey &&
28401
- it.sep &&
28402
- !includesToken(it.sep, 'newline')) {
28403
- yield* this.pop({
28404
- type: 'error',
28405
- offset: this.offset,
28406
- message: 'Unexpected block-seq-ind on same line with key',
28407
- source: this.source
28408
- });
28409
- return;
28410
- }
28411
- }
28412
- else if (atMapIndent) {
28215
+ if (atMapIndent && bv.type !== 'block-seq') {
28413
28216
  map.items.push({ start });
28414
28217
  }
28415
28218
  this.stack.push(bv);
@@ -28780,8 +28583,6 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
28780
28583
  if (!keepUndefined)
28781
28584
  return undefined;
28782
28585
  }
28783
- if (isDocument(value) && !_replacer)
28784
- return value.toString(options);
28785
28586
  return new Document(value, _replacer, options).toString(options);
28786
28587
  }
28787
28588