@thoughtspot/visual-embed-sdk 1.25.0-alpha.1 → 1.25.0-alpha.2

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 (220) hide show
  1. package/cjs/package.json +2 -3
  2. package/cjs/src/embed/app.d.ts +1 -0
  3. package/cjs/src/embed/app.d.ts.map +1 -1
  4. package/cjs/src/embed/app.js +1 -0
  5. package/cjs/src/embed/app.js.map +1 -1
  6. package/cjs/src/embed/base.d.ts +2 -0
  7. package/cjs/src/embed/base.d.ts.map +1 -1
  8. package/cjs/src/embed/base.js +2 -0
  9. package/cjs/src/embed/base.js.map +1 -1
  10. package/cjs/src/embed/liveboard.d.ts +1 -0
  11. package/cjs/src/embed/liveboard.d.ts.map +1 -1
  12. package/cjs/src/embed/liveboard.js +1 -0
  13. package/cjs/src/embed/liveboard.js.map +1 -1
  14. package/cjs/src/embed/sage.d.ts +1 -0
  15. package/cjs/src/embed/sage.d.ts.map +1 -1
  16. package/cjs/src/embed/sage.js +1 -0
  17. package/cjs/src/embed/sage.js.map +1 -1
  18. package/cjs/src/embed/search-bar.d.ts +1 -0
  19. package/cjs/src/embed/search-bar.d.ts.map +1 -1
  20. package/cjs/src/embed/search-bar.js +1 -0
  21. package/cjs/src/embed/search-bar.js.map +1 -1
  22. package/cjs/src/embed/search.d.ts +1 -0
  23. package/cjs/src/embed/search.d.ts.map +1 -1
  24. package/cjs/src/embed/search.js +1 -0
  25. package/cjs/src/embed/search.js.map +1 -1
  26. package/cjs/src/embed/ts-embed.d.ts +1 -0
  27. package/cjs/src/embed/ts-embed.d.ts.map +1 -1
  28. package/cjs/src/embed/ts-embed.js +3 -0
  29. package/cjs/src/embed/ts-embed.js.map +1 -1
  30. package/cjs/src/embed/ts-embed.spec.js +47 -0
  31. package/cjs/src/embed/ts-embed.spec.js.map +1 -1
  32. package/cjs/src/index.d.ts +3 -2
  33. package/cjs/src/index.d.ts.map +1 -1
  34. package/cjs/src/index.js +3 -1
  35. package/cjs/src/index.js.map +1 -1
  36. package/cjs/src/mixpanel-service.d.ts.map +1 -1
  37. package/cjs/src/mixpanel-service.js +2 -0
  38. package/cjs/src/mixpanel-service.js.map +1 -1
  39. package/cjs/src/mixpanel-service.spec.js +1 -0
  40. package/cjs/src/mixpanel-service.spec.js.map +1 -1
  41. package/cjs/src/types.d.ts +46 -18
  42. package/cjs/src/types.d.ts.map +1 -1
  43. package/cjs/src/types.js +7 -13
  44. package/cjs/src/types.js.map +1 -1
  45. package/cjs/src/utils/graphql/answerService/answer-queries.d.ts +5 -0
  46. package/cjs/src/utils/graphql/answerService/answer-queries.d.ts.map +1 -0
  47. package/cjs/src/utils/graphql/answerService/answer-queries.js +80 -0
  48. package/cjs/src/utils/graphql/answerService/answer-queries.js.map +1 -0
  49. package/cjs/src/utils/graphql/answerService/answerService.d.ts +61 -0
  50. package/cjs/src/utils/graphql/answerService/answerService.d.ts.map +1 -0
  51. package/cjs/src/utils/graphql/answerService/answerService.js +182 -0
  52. package/cjs/src/utils/graphql/answerService/answerService.js.map +1 -0
  53. package/cjs/src/utils/graphql/answerService/answerService.spec.d.ts +2 -0
  54. package/cjs/src/utils/graphql/answerService/answerService.spec.d.ts.map +1 -0
  55. package/cjs/src/utils/graphql/answerService/answerService.spec.js +201 -0
  56. package/cjs/src/utils/graphql/answerService/answerService.spec.js.map +1 -0
  57. package/cjs/src/utils/graphql/graphql-request.d.ts +15 -0
  58. package/cjs/src/utils/graphql/graphql-request.d.ts.map +1 -0
  59. package/cjs/src/utils/graphql/graphql-request.js +40 -0
  60. package/cjs/src/utils/graphql/graphql-request.js.map +1 -0
  61. package/cjs/src/utils/graphql/sourceService.d.ts +8 -0
  62. package/cjs/src/utils/graphql/sourceService.d.ts.map +1 -0
  63. package/cjs/src/utils/graphql/sourceService.js +69 -0
  64. package/cjs/src/utils/graphql/sourceService.js.map +1 -0
  65. package/cjs/src/utils/graphql/sourceService.spec.d.ts +2 -0
  66. package/cjs/src/utils/graphql/sourceService.spec.d.ts.map +1 -0
  67. package/cjs/src/utils/graphql/sourceService.spec.js +12 -0
  68. package/cjs/src/utils/graphql/sourceService.spec.js.map +1 -0
  69. package/cjs/src/utils/processData.d.ts.map +1 -1
  70. package/cjs/src/utils/processData.js +7 -11
  71. package/cjs/src/utils/processData.js.map +1 -1
  72. package/cjs/src/utils/processData.spec.js +13 -17
  73. package/cjs/src/utils/processData.spec.js.map +1 -1
  74. package/cjs/src/utils.d.ts +6 -0
  75. package/cjs/src/utils.d.ts.map +1 -1
  76. package/cjs/src/utils.js +26 -1
  77. package/cjs/src/utils.js.map +1 -1
  78. package/dist/src/embed/app.d.ts +1 -0
  79. package/dist/src/embed/app.d.ts.map +1 -1
  80. package/dist/src/embed/base.d.ts +2 -0
  81. package/dist/src/embed/base.d.ts.map +1 -1
  82. package/dist/src/embed/liveboard.d.ts +1 -0
  83. package/dist/src/embed/liveboard.d.ts.map +1 -1
  84. package/dist/src/embed/sage.d.ts +1 -0
  85. package/dist/src/embed/sage.d.ts.map +1 -1
  86. package/dist/src/embed/search-bar.d.ts +1 -0
  87. package/dist/src/embed/search-bar.d.ts.map +1 -1
  88. package/dist/src/embed/search.d.ts +1 -0
  89. package/dist/src/embed/search.d.ts.map +1 -1
  90. package/dist/src/embed/ts-embed.d.ts +1 -0
  91. package/dist/src/embed/ts-embed.d.ts.map +1 -1
  92. package/dist/src/index.d.ts +3 -2
  93. package/dist/src/index.d.ts.map +1 -1
  94. package/dist/src/mixpanel-service.d.ts.map +1 -1
  95. package/dist/src/types.d.ts +46 -18
  96. package/dist/src/types.d.ts.map +1 -1
  97. package/dist/src/utils/graphql/answerService/answer-queries.d.ts +5 -0
  98. package/dist/src/utils/graphql/answerService/answer-queries.d.ts.map +1 -0
  99. package/dist/src/utils/graphql/answerService/answerService.d.ts +61 -0
  100. package/dist/src/utils/graphql/answerService/answerService.d.ts.map +1 -0
  101. package/dist/src/utils/graphql/answerService/answerService.spec.d.ts +2 -0
  102. package/dist/src/utils/graphql/answerService/answerService.spec.d.ts.map +1 -0
  103. package/dist/src/utils/graphql/graphql-request.d.ts +15 -0
  104. package/dist/src/utils/graphql/graphql-request.d.ts.map +1 -0
  105. package/dist/src/utils/graphql/sourceService.d.ts +8 -0
  106. package/dist/src/utils/graphql/sourceService.d.ts.map +1 -0
  107. package/dist/src/utils/graphql/sourceService.spec.d.ts +2 -0
  108. package/dist/src/utils/graphql/sourceService.spec.d.ts.map +1 -0
  109. package/dist/src/utils/processData.d.ts.map +1 -1
  110. package/dist/src/utils.d.ts +6 -0
  111. package/dist/src/utils.d.ts.map +1 -1
  112. package/dist/tsembed-react.es.js +384 -68
  113. package/dist/tsembed-react.js +384 -68
  114. package/dist/tsembed.es.js +435 -72
  115. package/dist/tsembed.js +435 -71
  116. package/dist/visual-embed-sdk-react-full.d.ts +110 -19
  117. package/dist/visual-embed-sdk-react.d.ts +110 -19
  118. package/dist/visual-embed-sdk.d.ts +110 -19
  119. package/lib/package.json +2 -3
  120. package/lib/src/embed/app.d.ts +1 -0
  121. package/lib/src/embed/app.d.ts.map +1 -1
  122. package/lib/src/embed/app.js +1 -0
  123. package/lib/src/embed/app.js.map +1 -1
  124. package/lib/src/embed/base.d.ts +2 -0
  125. package/lib/src/embed/base.d.ts.map +1 -1
  126. package/lib/src/embed/base.js +2 -0
  127. package/lib/src/embed/base.js.map +1 -1
  128. package/lib/src/embed/liveboard.d.ts +1 -0
  129. package/lib/src/embed/liveboard.d.ts.map +1 -1
  130. package/lib/src/embed/liveboard.js +1 -0
  131. package/lib/src/embed/liveboard.js.map +1 -1
  132. package/lib/src/embed/sage.d.ts +1 -0
  133. package/lib/src/embed/sage.d.ts.map +1 -1
  134. package/lib/src/embed/sage.js +1 -0
  135. package/lib/src/embed/sage.js.map +1 -1
  136. package/lib/src/embed/search-bar.d.ts +1 -0
  137. package/lib/src/embed/search-bar.d.ts.map +1 -1
  138. package/lib/src/embed/search-bar.js +1 -0
  139. package/lib/src/embed/search-bar.js.map +1 -1
  140. package/lib/src/embed/search.d.ts +1 -0
  141. package/lib/src/embed/search.d.ts.map +1 -1
  142. package/lib/src/embed/search.js +1 -0
  143. package/lib/src/embed/search.js.map +1 -1
  144. package/lib/src/embed/ts-embed.d.ts +1 -0
  145. package/lib/src/embed/ts-embed.d.ts.map +1 -1
  146. package/lib/src/embed/ts-embed.js +3 -0
  147. package/lib/src/embed/ts-embed.js.map +1 -1
  148. package/lib/src/embed/ts-embed.spec.js +47 -0
  149. package/lib/src/embed/ts-embed.spec.js.map +1 -1
  150. package/lib/src/index.d.ts +3 -2
  151. package/lib/src/index.d.ts.map +1 -1
  152. package/lib/src/index.js +2 -1
  153. package/lib/src/index.js.map +1 -1
  154. package/lib/src/mixpanel-service.d.ts.map +1 -1
  155. package/lib/src/mixpanel-service.js +2 -0
  156. package/lib/src/mixpanel-service.js.map +1 -1
  157. package/lib/src/mixpanel-service.spec.js +1 -0
  158. package/lib/src/mixpanel-service.spec.js.map +1 -1
  159. package/lib/src/types.d.ts +46 -18
  160. package/lib/src/types.d.ts.map +1 -1
  161. package/lib/src/types.js +6 -12
  162. package/lib/src/types.js.map +1 -1
  163. package/lib/src/utils/graphql/answerService/answer-queries.d.ts +5 -0
  164. package/lib/src/utils/graphql/answerService/answer-queries.d.ts.map +1 -0
  165. package/lib/src/utils/graphql/answerService/answer-queries.js +77 -0
  166. package/lib/src/utils/graphql/answerService/answer-queries.js.map +1 -0
  167. package/lib/src/utils/graphql/answerService/answerService.d.ts +61 -0
  168. package/lib/src/utils/graphql/answerService/answerService.d.ts.map +1 -0
  169. package/lib/src/utils/graphql/answerService/answerService.js +177 -0
  170. package/lib/src/utils/graphql/answerService/answerService.js.map +1 -0
  171. package/lib/src/utils/graphql/answerService/answerService.spec.d.ts +2 -0
  172. package/lib/src/utils/graphql/answerService/answerService.spec.d.ts.map +1 -0
  173. package/lib/src/utils/graphql/answerService/answerService.spec.js +199 -0
  174. package/lib/src/utils/graphql/answerService/answerService.spec.js.map +1 -0
  175. package/lib/src/utils/graphql/graphql-request.d.ts +15 -0
  176. package/lib/src/utils/graphql/graphql-request.d.ts.map +1 -0
  177. package/lib/src/utils/graphql/graphql-request.js +36 -0
  178. package/lib/src/utils/graphql/graphql-request.js.map +1 -0
  179. package/lib/src/utils/graphql/sourceService.d.ts +8 -0
  180. package/lib/src/utils/graphql/sourceService.d.ts.map +1 -0
  181. package/lib/src/utils/graphql/sourceService.js +65 -0
  182. package/lib/src/utils/graphql/sourceService.js.map +1 -0
  183. package/lib/src/utils/graphql/sourceService.spec.d.ts +2 -0
  184. package/lib/src/utils/graphql/sourceService.spec.d.ts.map +1 -0
  185. package/lib/src/utils/graphql/sourceService.spec.js +10 -0
  186. package/lib/src/utils/graphql/sourceService.spec.js.map +1 -0
  187. package/lib/src/utils/processData.d.ts.map +1 -1
  188. package/lib/src/utils/processData.js +8 -12
  189. package/lib/src/utils/processData.js.map +1 -1
  190. package/lib/src/utils/processData.spec.js +14 -18
  191. package/lib/src/utils/processData.spec.js.map +1 -1
  192. package/lib/src/utils.d.ts +6 -0
  193. package/lib/src/utils.d.ts.map +1 -1
  194. package/lib/src/utils.js +23 -0
  195. package/lib/src/utils.js.map +1 -1
  196. package/lib/src/visual-embed-sdk.d.ts +116 -20
  197. package/package.json +5 -6
  198. package/src/embed/app.ts +2 -0
  199. package/src/embed/base.ts +2 -0
  200. package/src/embed/liveboard.ts +2 -0
  201. package/src/embed/sage.ts +2 -0
  202. package/src/embed/search-bar.tsx +2 -0
  203. package/src/embed/search.ts +2 -0
  204. package/src/embed/ts-embed.spec.ts +49 -0
  205. package/src/embed/ts-embed.ts +4 -0
  206. package/src/index.ts +5 -0
  207. package/src/mixpanel-service.spec.ts +1 -0
  208. package/src/mixpanel-service.ts +1 -0
  209. package/src/types.ts +50 -19
  210. package/src/utils/graphql/answerService/answer-queries.ts +80 -0
  211. package/src/utils/graphql/answerService/answerService.spec.ts +231 -0
  212. package/src/utils/graphql/answerService/answerService.ts +234 -0
  213. package/src/utils/graphql/graphql-request.ts +45 -0
  214. package/src/utils/graphql/sourceService.spec.ts +10 -0
  215. package/src/utils/graphql/sourceService.ts +71 -0
  216. package/src/utils/processData.spec.ts +15 -25
  217. package/src/utils/processData.ts +13 -15
  218. package/src/utils.ts +24 -0
  219. package/src/utils/answerService.spec.ts +0 -41
  220. package/src/utils/answerService.ts +0 -63
@@ -1,3 +1,47 @@
1
+ // istanbul ignore next
2
+ const isObject = (obj) => {
3
+ if (typeof obj === "object" && obj !== null) {
4
+ if (typeof Object.getPrototypeOf === "function") {
5
+ const prototype = Object.getPrototypeOf(obj);
6
+ return prototype === Object.prototype || prototype === null;
7
+ }
8
+ return Object.prototype.toString.call(obj) === "[object Object]";
9
+ }
10
+ return false;
11
+ };
12
+ const merge = (...objects) => objects.reduce((result, current) => {
13
+ if (Array.isArray(current)) {
14
+ throw new TypeError("Arguments provided to ts-deepmerge must be objects, not arrays.");
15
+ }
16
+ Object.keys(current).forEach((key) => {
17
+ if (["__proto__", "constructor", "prototype"].includes(key)) {
18
+ return;
19
+ }
20
+ if (Array.isArray(result[key]) && Array.isArray(current[key])) {
21
+ result[key] = merge.options.mergeArrays
22
+ ? Array.from(new Set(result[key].concat(current[key])))
23
+ : current[key];
24
+ }
25
+ else if (isObject(result[key]) && isObject(current[key])) {
26
+ result[key] = merge(result[key], current[key]);
27
+ }
28
+ else {
29
+ result[key] = current[key];
30
+ }
31
+ });
32
+ return result;
33
+ }, {});
34
+ const defaultOptions = {
35
+ mergeArrays: true,
36
+ };
37
+ merge.options = defaultOptions;
38
+ merge.withOptions = (options, ...objects) => {
39
+ merge.options = Object.assign({ mergeArrays: true }, options);
40
+ const result = merge(...objects);
41
+ merge.options = defaultOptions;
42
+ return result;
43
+ };
44
+
1
45
  /**
2
46
  * Copyright (c) 2023
3
47
  *
@@ -193,6 +237,30 @@ const getRuntimeFilters = (runtimefilters) => getFilterQuery(runtimefilters || [
193
237
  */
194
238
  function getDOMNode(domSelector) {
195
239
  return typeof domSelector === 'string' ? document.querySelector(domSelector) : domSelector;
240
+ }
241
+ const deepMerge = (target, source) => merge(target, source);
242
+ const getOperationNameFromQuery = (query) => {
243
+ const regex = /(?:query|mutation)\s+(\w+)/;
244
+ const matches = query.match(regex);
245
+ return matches === null || matches === void 0 ? void 0 : matches[1];
246
+ };
247
+ /**
248
+ *
249
+ * @param obj
250
+ */
251
+ function removeTypename(obj) {
252
+ if (!obj || typeof obj !== 'object')
253
+ return obj;
254
+ // eslint-disable-next-line no-restricted-syntax
255
+ for (const key in obj) {
256
+ if (key === '__typename') {
257
+ delete obj[key];
258
+ }
259
+ else if (typeof obj[key] === 'object') {
260
+ removeTypename(obj[key]);
261
+ }
262
+ }
263
+ return obj;
196
264
  }
197
265
 
198
266
  /**
@@ -456,27 +524,27 @@ var HomepageModule;
456
524
  /**
457
525
  * Search bar
458
526
  */
459
- HomepageModule["Search"] = "search";
527
+ HomepageModule["Search"] = "SEARCH";
460
528
  /**
461
529
  * kPI watchlist module
462
530
  */
463
- HomepageModule["Watchlist"] = "watchlist";
531
+ HomepageModule["Watchlist"] = "WATCHLIST";
464
532
  /**
465
533
  * favorite objects
466
534
  */
467
- HomepageModule["Favorite"] = "favorite";
535
+ HomepageModule["Favorite"] = "FAVORITE";
468
536
  /**
469
537
  * List of answers and liveboards
470
538
  */
471
- HomepageModule["MyLibrary"] = "mylibrary";
539
+ HomepageModule["MyLibrary"] = "MY_LIBRARY";
472
540
  /**
473
541
  * Trending list
474
542
  */
475
- HomepageModule["Trending"] = "trending";
543
+ HomepageModule["Trending"] = "TRENDING";
476
544
  /**
477
545
  * Learning videos
478
546
  */
479
- HomepageModule["Learning"] = "learning";
547
+ HomepageModule["Learning"] = "LEARNING";
480
548
  })(HomepageModule || (HomepageModule = {}));
481
549
  /**
482
550
  * Event types emitted by the embedded ThoughtSpot application.
@@ -2624,12 +2692,6 @@ var Action;
2624
2692
  */
2625
2693
  Action["PersonalisedViewsDropdown"] = "personalisedViewsDropdown";
2626
2694
  })(Action || (Action = {}));
2627
- // eslint-disable-next-line no-shadow
2628
- var OperationType;
2629
- (function (OperationType) {
2630
- OperationType["GetChartWithData"] = "GetChartWithData";
2631
- OperationType["GetTableWithHeadlineData"] = "GetTableWithHeadlineData";
2632
- })(OperationType || (OperationType = {}));
2633
2695
  var PrefetchFeatures;
2634
2696
  (function (PrefetchFeatures) {
2635
2697
  PrefetchFeatures["FullApp"] = "FullApp";
@@ -8745,6 +8807,7 @@ function emptyQueue() {
8745
8807
  * @param sessionInfo
8746
8808
  */
8747
8809
  function initMixpanel(sessionInfo) {
8810
+ var _a;
8748
8811
  if (!sessionInfo || !sessionInfo.mixpanelToken) {
8749
8812
  return;
8750
8813
  }
@@ -8762,6 +8825,7 @@ function initMixpanel(sessionInfo) {
8762
8825
  clusterId: sessionInfo.clusterId,
8763
8826
  clusterName: sessionInfo.clusterName,
8764
8827
  releaseVersion: sessionInfo.releaseVersion,
8828
+ hostAppUrl: ((_a = window === null || window === void 0 ? void 0 : window.location) === null || _a === void 0 ? void 0 : _a.host) || '',
8765
8829
  });
8766
8830
  isMixpanelInitialized = true;
8767
8831
  emptyQueue();
@@ -9254,12 +9318,12 @@ var _baseGetTag = baseGetTag;
9254
9318
  * _.isObject(null);
9255
9319
  * // => false
9256
9320
  */
9257
- function isObject(value) {
9321
+ function isObject$1(value) {
9258
9322
  var type = typeof value;
9259
9323
  return value != null && (type == 'object' || type == 'function');
9260
9324
  }
9261
9325
 
9262
- var isObject_1 = isObject;
9326
+ var isObject_1 = isObject$1;
9263
9327
 
9264
9328
  /** `Object#toString` result references. */
9265
9329
  var asyncTag = '[object AsyncFunction]',
@@ -10090,9 +10154,9 @@ function cacheHas(cache, key) {
10090
10154
  var _cacheHas = cacheHas;
10091
10155
 
10092
10156
  /* Built-in method references that are verified to be native. */
10093
- var Set = _getNative(_root, 'Set');
10157
+ var Set$1 = _getNative(_root, 'Set');
10094
10158
 
10095
- var _Set = Set;
10159
+ var _Set = Set$1;
10096
10160
 
10097
10161
  /**
10098
10162
  * This method returns `undefined`.
@@ -10950,6 +11014,7 @@ const renderInQueue = (fn) => {
10950
11014
  *
10951
11015
  * @param data
10952
11016
  * @version SDK: 1.23.0 | ThoughtSpot: 9.4.0.cl
11017
+ * @group Global methods
10953
11018
  */
10954
11019
  const executeTML = async (data) => {
10955
11020
  const { thoughtSpotHost, authType } = config;
@@ -10997,6 +11062,7 @@ const executeTML = async (data) => {
10997
11062
  *
10998
11063
  * @param data
10999
11064
  * @version SDK: 1.23.0 | ThoughtSpot: 9.4.0.cl
11065
+ * @group Global methods
11000
11066
  */
11001
11067
  const exportTML = async (data) => {
11002
11068
  const { thoughtSpotHost, authType } = config;
@@ -11042,58 +11108,351 @@ const exportTML = async (data) => {
11042
11108
 
11043
11109
  /**
11044
11110
  *
11045
- * @param session
11046
- * @param query
11047
- * @param operation
11111
+ * @param root0
11112
+ * @param root0.query
11113
+ * @param root0.variables
11114
+ * @param root0.thoughtSpotHost
11115
+ * @param root0.isCompositeQuery
11116
+ */
11117
+ async function graphqlQuery({ query, variables, thoughtSpotHost, isCompositeQuery = false, }) {
11118
+ const operationName = getOperationNameFromQuery(query);
11119
+ try {
11120
+ const response = await fetch(`${thoughtSpotHost}/prism/?op=${operationName}`, {
11121
+ method: 'POST',
11122
+ headers: {
11123
+ 'content-type': 'application/json;charset=UTF-8',
11124
+ 'x-requested-by': 'ThoughtSpot',
11125
+ accept: '*/*',
11126
+ 'accept-language': 'en-us',
11127
+ },
11128
+ body: JSON.stringify({
11129
+ operationName,
11130
+ query,
11131
+ variables,
11132
+ }),
11133
+ credentials: 'include',
11134
+ });
11135
+ const result = await response.json();
11136
+ const dataValues = Object.values(result.data);
11137
+ return (isCompositeQuery) ? result.data : dataValues[0];
11138
+ }
11139
+ catch (error) {
11140
+ return error;
11141
+ }
11142
+ }
11143
+
11144
+ const getSourceDetailQuery = `
11145
+ query GetSourceDetail($ids: [GUID!]!) {
11146
+ getSourceDetailById(ids: $ids, type: LOGICAL_TABLE) {
11147
+ id
11148
+ name
11149
+ description
11150
+ authorName
11151
+ authorDisplayName
11152
+ isExternal
11153
+ type
11154
+ created
11155
+ modified
11156
+ columns {
11157
+ id
11158
+ name
11159
+ author
11160
+ authorDisplayName
11161
+ description
11162
+ dataType
11163
+ type
11164
+ modified
11165
+ ownerName
11166
+ owner
11167
+ dataRecency
11168
+ sources {
11169
+ tableId
11170
+ tableName
11171
+ columnId
11172
+ columnName
11173
+ __typename
11174
+ }
11175
+ synonyms
11176
+ cohortAnswerId
11177
+ __typename
11178
+ }
11179
+ relationships
11180
+ destinationRelationships
11181
+ dataSourceId
11182
+ __typename
11183
+ }
11184
+ }
11185
+ `;
11186
+ const sourceDetailCache = new Map();
11187
+ /**
11188
+ *
11048
11189
  * @param thoughtSpotHost
11190
+ * @param sourceId
11049
11191
  */
11050
- function getAnswerServiceInstance(session, query, operation, thoughtSpotHost) {
11051
- let variable;
11052
- const fetchQuery = async (variables) => {
11053
- try {
11054
- const response = await fetch(`${thoughtSpotHost}/prism/?op=${operation}`, {
11055
- method: 'POST',
11056
- headers: {
11057
- 'content-type': 'application/json;charset=UTF-8',
11058
- 'x-requested-by': 'ThoughtSpot',
11059
- accept: '*/*',
11060
- 'accept-language': 'en-us',
11061
- },
11062
- body: JSON.stringify({
11063
- operationName: operation,
11064
- query,
11065
- variables,
11066
- }),
11067
- credentials: 'include',
11068
- });
11069
- const result = await response.json();
11070
- return result.data;
11192
+ async function getSourceDetail(thoughtSpotHost, sourceId) {
11193
+ if (sourceDetailCache.has(sourceId)) {
11194
+ return sourceDetailCache.get(sourceId);
11195
+ }
11196
+ const details = await graphqlQuery({
11197
+ query: getSourceDetailQuery,
11198
+ variables: {
11199
+ ids: [sourceId],
11200
+ },
11201
+ thoughtSpotHost,
11202
+ });
11203
+ const souceDetails = details[0];
11204
+ sourceDetailCache.set(sourceId, souceDetails);
11205
+ return souceDetails;
11206
+ }
11207
+
11208
+ const bachSessionId = `
11209
+ id {
11210
+ sessionId
11211
+ genNo
11212
+ acSession {
11213
+ sessionId
11214
+ genNo
11215
+ }
11216
+ }
11217
+ `;
11218
+ const getUnaggregatedAnswerSession = `
11219
+ mutation GetUnAggregatedAnswerSession($session: BachSessionIdInput!, $columns: [UserPointSelectionInput!]!) {
11220
+ Answer__getUnaggregatedAnswer(session: $session, columns: $columns) {
11221
+ ${bachSessionId}
11222
+ answer {
11223
+ visualizations {
11224
+ ... on TableViz {
11225
+ columns {
11226
+ column {
11227
+ id
11228
+ name
11229
+ referencedColumns {
11230
+ guid
11231
+ displayName
11232
+ }
11233
+ }
11234
+ }
11235
+ }
11236
+ }
11237
+ }
11238
+ }
11239
+ }
11240
+ `;
11241
+ const removeColumns = `
11242
+ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!], $columnIds: [GUID!]) {
11243
+ Answer__removeColumns(
11244
+ session: $session
11245
+ logicalColumnIds: $logicalColumnIds
11246
+ columnIds: $columnIds
11247
+ ) {
11248
+ ${bachSessionId}
11249
+ }
11250
+ }
11251
+ `;
11252
+ const addColumns = `
11253
+ mutation AddColumns($session: BachSessionIdInput!, $columns: [AnswerColumnInfo!]!) {
11254
+ Answer__addColumn(session: $session, columns: $columns) {
11255
+ ${bachSessionId}
11256
+ }
11257
+ }
11258
+ `;
11259
+ const getAnswerData = `
11260
+ query GetTableWithHeadlineData($session: BachSessionIdInput!, $deadline: Int!, $dataPaginationParams: DataPaginationParamsInput!) {
11261
+ getAnswer(session: $session) {
11262
+ ${bachSessionId}
11263
+ answer {
11264
+ id
11265
+ visualizations {
11266
+ id
11267
+ ... on TableViz {
11268
+ columns {
11269
+ column {
11270
+ id
11271
+ name
11272
+ type
11273
+ aggregationType
11274
+ dataType
11275
+ }
11276
+ }
11277
+ data(deadline: $deadline, pagination: $dataPaginationParams)
11278
+ }
11279
+ }
11280
+ }
11281
+ }
11282
+ }
11283
+ `;
11284
+
11285
+ // eslint-disable-next-line no-shadow
11286
+ var OperationType;
11287
+ (function (OperationType) {
11288
+ OperationType["GetChartWithData"] = "GetChartWithData";
11289
+ OperationType["GetTableWithHeadlineData"] = "GetTableWithHeadlineData";
11290
+ })(OperationType || (OperationType = {}));
11291
+ /**
11292
+ * Class representing the answer service provided with the
11293
+ * custom action payload. This service could be used to run
11294
+ * graphql queries in the context of the answer on which the
11295
+ * custom action was triggered.
11296
+ *
11297
+ * @example
11298
+ * ```js
11299
+ * embed.on(EmbedEvent.CustomAction, e => {
11300
+ * const underlying = await e.answerService.getUnderlyingDataForPoint([
11301
+ * 'col name 1'
11302
+ * ]);
11303
+ * const data = await underlying.fetchData(0, 100);
11304
+ * })
11305
+ * ```
11306
+ * @version
11307
+ * ThoughtSpot: 9.9.0.cl / SDK: 1.25.0
11308
+ */
11309
+ class AnswerService {
11310
+ constructor(session, answer, thoughtSpotHost, selectedPoints) {
11311
+ this.session = session;
11312
+ this.answer = answer;
11313
+ this.thoughtSpotHost = thoughtSpotHost;
11314
+ this.selectedPoints = selectedPoints;
11315
+ this.session = removeTypename(session);
11316
+ }
11317
+ async getSourceDetail() {
11318
+ const sourceId = this.answer.sources[0].header.guid;
11319
+ return getSourceDetail(this.thoughtSpotHost, sourceId);
11320
+ }
11321
+ async removeColumns(columnIds) {
11322
+ return this.executeQuery(removeColumns, {
11323
+ logicalColumnIds: columnIds,
11324
+ });
11325
+ }
11326
+ async addColumns(columnIds) {
11327
+ return this.executeQuery(addColumns, {
11328
+ columns: columnIds.map((colId) => ({ logicalColumnId: colId })),
11329
+ });
11330
+ }
11331
+ async fetchData(offset = 0, size = 1000) {
11332
+ const { answer } = await this.executeQuery(getAnswerData, {
11333
+ deadline: 0,
11334
+ dataPaginationParams: {
11335
+ isClientPaginated: true,
11336
+ offset,
11337
+ size,
11338
+ },
11339
+ });
11340
+ const { columns, data } = answer.visualizations[0];
11341
+ return {
11342
+ columns,
11343
+ data,
11344
+ };
11345
+ }
11346
+ /**
11347
+ *
11348
+ * @param userLocale
11349
+ * @param omitInfo Omit the download Info on top of the CSV
11350
+ * @returns Response
11351
+ */
11352
+ async fetchCSVBlob(userLocale = 'en-us', omitInfo = false) {
11353
+ if (omitInfo) {
11354
+ console.warn('omitInfo not supported yet.');
11071
11355
  }
11072
- catch (error) {
11073
- return error;
11356
+ const fetchUrl = `${this.thoughtSpotHost}/prism/download/answer/csv?sessionId=${this.session.sessionId}&genNo=${this.session.genNo}&userLocale=${userLocale}&exportFileName=data&omitInfo=${omitInfo}`;
11357
+ return fetch(fetchUrl, {
11358
+ credentials: 'include',
11359
+ });
11360
+ }
11361
+ async getUnderlyingDataForPoint(outputColumnNames, selectedPoints) {
11362
+ if (!selectedPoints && !this.selectedPoints) {
11363
+ throw new Error('Needs to be triggered in context of a point');
11074
11364
  }
11075
- };
11076
- const fetchData = (offset, batchSize) => {
11077
- if (operation === OperationType.GetChartWithData) {
11078
- variable = { batchSize, offset: offset * batchSize };
11365
+ if (!selectedPoints) {
11366
+ selectedPoints = getSelectedPointsForUnderlyingDataQuery(this.selectedPoints);
11367
+ }
11368
+ const sourceDetail = await this.getSourceDetail();
11369
+ const ouputColumnGuids = getGuidsFromColumnNames(sourceDetail, outputColumnNames);
11370
+ const unAggAnswer = await graphqlQuery({
11371
+ query: getUnaggregatedAnswerSession,
11372
+ variables: {
11373
+ session: this.session,
11374
+ columns: selectedPoints,
11375
+ },
11376
+ thoughtSpotHost: this.thoughtSpotHost,
11377
+ });
11378
+ const unaggAnswerSession = new AnswerService(unAggAnswer.id, unAggAnswer.answer, this.thoughtSpotHost);
11379
+ const currentColumns = new Set(unAggAnswer.answer.visualizations[0].columns
11380
+ .map((c) => c.column.referencedColumns[0].guid));
11381
+ const columnsToAdd = [...ouputColumnGuids].filter((col) => !currentColumns.has(col));
11382
+ if (columnsToAdd.length) {
11383
+ await unaggAnswerSession.addColumns(columnsToAdd);
11384
+ }
11385
+ const columnsToRemove = [...currentColumns].filter((col) => !ouputColumnGuids.has(col));
11386
+ if (columnsToRemove.length) {
11387
+ await unaggAnswerSession.removeColumns(columnsToRemove);
11388
+ }
11389
+ return unaggAnswerSession;
11390
+ }
11391
+ async executeQuery(query, variables) {
11392
+ const data = await graphqlQuery({
11393
+ query,
11394
+ variables: {
11395
+ session: this.session,
11396
+ ...variables,
11397
+ },
11398
+ thoughtSpotHost: this.thoughtSpotHost,
11399
+ isCompositeQuery: false,
11400
+ });
11401
+ this.session = deepMerge(this.session, (data === null || data === void 0 ? void 0 : data.id) || {});
11402
+ return data;
11403
+ }
11404
+ getSession() {
11405
+ return this.session;
11406
+ }
11407
+ }
11408
+ /**
11409
+ *
11410
+ * @param sourceDetail
11411
+ * @param colNames
11412
+ */
11413
+ function getGuidsFromColumnNames(sourceDetail, colNames) {
11414
+ const cols = sourceDetail.columns.reduce((colSet, col) => {
11415
+ colSet[col.name] = col;
11416
+ return colSet;
11417
+ }, {});
11418
+ return new Set(colNames.map((colName) => {
11419
+ const col = cols[colName];
11420
+ return col.id;
11421
+ }));
11422
+ }
11423
+ /**
11424
+ *
11425
+ * @param selectedPoints
11426
+ */
11427
+ function getSelectedPointsForUnderlyingDataQuery(selectedPoints) {
11428
+ const underlyingDataPoint = [];
11429
+ /**
11430
+ *
11431
+ * @param colVal
11432
+ */
11433
+ function addPointFromColVal(colVal) {
11434
+ const dataType = colVal.column.dataType;
11435
+ const id = colVal.column.id;
11436
+ let dataValue;
11437
+ if (dataType === 'DATE') {
11438
+ dataValue = [{
11439
+ epochRange: {
11440
+ startEpoch: colVal.value,
11441
+ },
11442
+ }];
11079
11443
  }
11080
11444
  else {
11081
- variable = {
11082
- dataPaginationParams: {
11083
- isClientPaginated: true,
11084
- offset: offset * batchSize,
11085
- size: batchSize,
11086
- },
11087
- };
11445
+ dataValue = [{ value: colVal.value }];
11088
11446
  }
11089
- return fetchQuery({
11090
- session,
11091
- ...variable,
11447
+ underlyingDataPoint.push({
11448
+ columnId: colVal.column.id,
11449
+ dataValue,
11092
11450
  });
11093
- };
11094
- return {
11095
- fetchData,
11096
- };
11451
+ }
11452
+ selectedPoints.forEach((p) => {
11453
+ p.selectedAttributes.forEach(addPointFromColVal);
11454
+ });
11455
+ return underlyingDataPoint;
11097
11456
  }
11098
11457
 
11099
11458
  /**
@@ -11102,16 +11461,12 @@ function getAnswerServiceInstance(session, query, operation, thoughtSpotHost) {
11102
11461
  * @param thoughtSpotHost
11103
11462
  */
11104
11463
  function processCustomAction(e, thoughtSpotHost) {
11105
- var _a;
11106
- if ([OperationType.GetChartWithData, OperationType.GetTableWithHeadlineData].includes((_a = e.data) === null || _a === void 0 ? void 0 : _a.operation)) {
11107
- const { session, query, operation } = e.data;
11108
- const answerService = getAnswerServiceInstance(session, query, operation, thoughtSpotHost);
11109
- return {
11110
- ...e,
11111
- answerService,
11112
- };
11113
- }
11114
- return e;
11464
+ const { session, embedAnswerData, contextMenuPoints } = e.data;
11465
+ const answerService = new AnswerService(session, embedAnswerData, thoughtSpotHost, contextMenuPoints === null || contextMenuPoints === void 0 ? void 0 : contextMenuPoints.selectedPoints);
11466
+ return {
11467
+ ...e,
11468
+ answerService,
11469
+ };
11115
11470
  }
11116
11471
  /**
11117
11472
  *
@@ -11256,7 +11611,7 @@ function processTrigger(iFrame, messageType, thoughtSpotHost, data) {
11256
11611
  });
11257
11612
  }
11258
11613
 
11259
- var name="@thoughtspot/visual-embed-sdk";var version="1.25.0-alpha.1";var description="ThoughtSpot Embed SDK";var module="lib/src/index.js";var main="dist/tsembed.js";var types="lib/src/index.d.ts";var files=["dist/**","lib/**","src/**","cjs/**"];var exports={".":{"import":"./lib/src/index.js",require:"./cjs/src/index.js",types:"./lib/src/index.d.ts"},"./react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"},"./lib/src/react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"}};var typesVersions={"*":{react:["./lib/src/react/all-types-export.d.ts"]}};var scripts={lint:"eslint 'src/**'","lint:fix":"eslint 'src/**/*.*' --fix",tsc:"tsc -p . --incremental false; tsc -p . --incremental false --module commonjs --outDir cjs",start:"gatsby develop","build:gatsby":"npm run clean:gatsby && gatsby build --prefix-paths","build:gatsby:noprefix":"npm run clean:gatsby && gatsby build","serve:gatsby":"gatsby serve","clean:gatsby":"gatsby clean","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","docs-cmd":"node scripts/gatsby-commands.js",docgen:"typedoc --tsconfig tsconfig.json --theme typedoc-theme","test-sdk":"jest -c jest.config.sdk.js --runInBand","test-docs":"jest -c jest.config.docs.js",test:"npm run test-sdk && npm run test-docs",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"};var peerDependencies={react:"> 16.8.0","react-dom":"> 16.8.0"};var dependencies={algoliasearch:"^4.10.5",classnames:"^2.3.1",dompurify:"^2.3.4","eslint-plugin-comment-length":"^0.9.2","eslint-plugin-jsdoc":"^40.1.0",eventemitter3:"^4.0.7","gatsby-plugin-vercel":"^1.0.3","html-react-parser":"^1.4.12",lodash:"^4.17.21","mixpanel-browser":"^2.45.0","ts-deepmerge":"^6.0.2",tslib:"^2.5.3","use-deep-compare-effect":"^1.8.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/mixpanel-browser":"^2.35.6","@types/react-test-renderer":"^17.0.1","@typescript-eslint/eslint-plugin":"^4.6.0","@typescript-eslint/parser":"^4.6.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","current-git-branch":"^1.1.0","dts-bundle":"^0.7.3",eslint:"^7.12.1","eslint-config-airbnb-base":"^14.2.0","eslint-config-prettier":"^6.15.0","eslint-import-resolver-typescript":"^2.3.0","eslint-plugin-import":"^2.22.1","eslint-plugin-prettier":"^3.1.4","eslint-plugin-react-hooks":"^4.2.0","fs-extra":"^10.0.0",gatsby:"3.13.1","gatsby-plugin-algolia":"^0.22.2","gatsby-plugin-catch-links":"^3.1.0","gatsby-plugin-env-variables":"^2.1.0","gatsby-plugin-intl":"^0.3.3","gatsby-plugin-manifest":"^3.2.0","gatsby-plugin-output":"^0.1.3","gatsby-plugin-sass":"6.7.0","gatsby-plugin-sitemap":"^4.10.0","gatsby-source-filesystem":"3.1.0","gatsby-transformer-asciidoc":"2.1.0","gatsby-transformer-rehype":"2.0.0","gh-pages":"^3.1.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-puppeteer":"^4.4.0",jsdom:"^17.0.0","node-sass":"^8.0.0",prettier:"2.1.2",puppeteer:"^7.0.1",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:"2.30.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","url-search-params-polyfill":"^8.1.0",util:"^0.12.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","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,description:description,module:module,main:main,types:types,files:files,exports:exports,typesVersions:typesVersions,"size-limit":[{path:"dist/tsembed.js",limit:"40 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};
11614
+ var name="@thoughtspot/visual-embed-sdk";var version="1.25.0-alpha.2";var description="ThoughtSpot Embed SDK";var module="lib/src/index.js";var main="dist/tsembed.js";var types="lib/src/index.d.ts";var files=["dist/**","lib/**","src/**","cjs/**"];var exports={".":{"import":"./lib/src/index.js",require:"./cjs/src/index.js",types:"./lib/src/index.d.ts"},"./react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"},"./lib/src/react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"}};var typesVersions={"*":{react:["./lib/src/react/all-types-export.d.ts"]}};var scripts={lint:"eslint 'src/**'","lint:fix":"eslint 'src/**/*.*' --fix",tsc:"tsc -p . --incremental false; tsc -p . --incremental false --module commonjs --outDir cjs",start:"gatsby develop","build:gatsby":"npm run clean:gatsby && gatsby build --prefix-paths","build:gatsby:noprefix":"npm run clean:gatsby && gatsby build","serve:gatsby":"gatsby serve","clean:gatsby":"gatsby clean","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","docs-cmd":"node scripts/gatsby-commands.js",docgen:"typedoc --tsconfig tsconfig.json --theme typedoc-theme","test-sdk":"jest -c jest.config.sdk.js --runInBand","test-docs":"jest -c jest.config.docs.js",test:"npm run test-sdk && npm run test-docs",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"};var peerDependencies={react:"> 16.8.0","react-dom":"> 16.8.0"};var dependencies={algoliasearch:"^4.10.5",classnames:"^2.3.1",dompurify:"^2.3.4","eslint-plugin-comment-length":"^0.9.2","eslint-plugin-jsdoc":"^40.1.0",eventemitter3:"^4.0.7","gatsby-plugin-vercel":"^1.0.3","html-react-parser":"^1.4.12",lodash:"^4.17.21","mixpanel-browser":"^2.45.0","ts-deepmerge":"^6.0.2",tslib:"^2.5.3","use-deep-compare-effect":"^1.8.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/mixpanel-browser":"^2.35.6","@types/react-test-renderer":"^17.0.1","@typescript-eslint/eslint-plugin":"^4.6.0","@typescript-eslint/parser":"^4.6.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","current-git-branch":"^1.1.0","dts-bundle":"^0.7.3",eslint:"^7.12.1","eslint-config-airbnb-base":"^14.2.0","eslint-config-prettier":"^6.15.0","eslint-import-resolver-typescript":"^2.3.0","eslint-plugin-import":"^2.22.1","eslint-plugin-prettier":"^3.1.4","eslint-plugin-react-hooks":"^4.2.0","fs-extra":"^10.0.0",gatsby:"3.13.1","gatsby-plugin-algolia":"^0.22.2","gatsby-plugin-catch-links":"^3.1.0","gatsby-plugin-env-variables":"^2.1.0","gatsby-plugin-intl":"^0.3.3","gatsby-plugin-manifest":"^3.2.0","gatsby-plugin-output":"^0.1.3","gatsby-plugin-sass":"6.7.0","gatsby-plugin-sitemap":"^4.10.0","gatsby-source-filesystem":"3.1.0","gatsby-transformer-asciidoc":"2.1.0","gatsby-transformer-rehype":"2.0.0","gh-pages":"^3.1.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","node-sass":"^8.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:"2.30.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","url-search-params-polyfill":"^8.1.0",util:"^0.12.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","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,description:description,module:module,main:main,types:types,files:files,exports:exports,typesVersions:typesVersions,"size-limit":[{path:"dist/tsembed.js",limit:"40 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};
11260
11615
 
11261
11616
  /**
11262
11617
  * Copyright (c) 2022
@@ -11288,6 +11643,7 @@ const V1EventMap = {};
11288
11643
  class TsEmbed {
11289
11644
  constructor(domSelector, viewConfig) {
11290
11645
  this.isAppInitialized = false;
11646
+ this.embedComponentType = 'TsEmbed';
11291
11647
  /**
11292
11648
  * Should we encode URL Query Params using base64 encoding which thoughtspot
11293
11649
  * will generate for embedding. This provides additional security to
@@ -11319,6 +11675,7 @@ class TsEmbed {
11319
11675
  ? getRuntimeFilters(this.viewConfig.runtimeFilters)
11320
11676
  : null,
11321
11677
  hiddenHomepageModules: this.viewConfig.hiddenHomepageModules || [],
11678
+ reorderedHomepageModules: this.viewConfig.reorderedHomepageModules || [],
11322
11679
  hostConfig: this.embedConfig.hostConfig,
11323
11680
  hiddenHomeLeftNavItems: ((_a = this.viewConfig) === null || _a === void 0 ? void 0 : _a.hiddenHomeLeftNavItems)
11324
11681
  ? (_b = this.viewConfig) === null || _b === void 0 ? void 0 : _b.hiddenHomeLeftNavItems
@@ -11368,6 +11725,7 @@ class TsEmbed {
11368
11725
  this.registerAppInit();
11369
11726
  uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_EMBED_CREATE, {
11370
11727
  ...viewConfig,
11728
+ embedComponentType: this.embedComponentType,
11371
11729
  });
11372
11730
  }
11373
11731
  /**
@@ -12071,6 +12429,7 @@ class AppEmbed extends V1Embed {
12071
12429
  constructor(domSelector, viewConfig) {
12072
12430
  super(domSelector, viewConfig);
12073
12431
  this.defaultHeight = '100%';
12432
+ this.embedComponentType = 'AppEmbed';
12074
12433
  /**
12075
12434
  * Set the iframe height as per the computed height received
12076
12435
  * from the ThoughtSpot app.
@@ -12260,6 +12619,7 @@ class LiveboardEmbed extends V1Embed {
12260
12619
  constructor(domSelector, viewConfig) {
12261
12620
  super(domSelector, viewConfig);
12262
12621
  this.defaultHeight = 500;
12622
+ this.embedComponentType = 'LiveboardEmbed';
12263
12623
  /**
12264
12624
  * Set the iframe height as per the computed height received
12265
12625
  * from the ThoughtSpot app.
@@ -12429,6 +12789,7 @@ const HiddenActionItemByDefaultForSearchEmbed = [
12429
12789
  class SearchEmbed extends TsEmbed {
12430
12790
  constructor(domSelector, viewConfig) {
12431
12791
  super(domSelector);
12792
+ this.embedComponentType = 'SearchEmbed';
12432
12793
  this.viewConfig = viewConfig;
12433
12794
  }
12434
12795
  /**
@@ -12533,6 +12894,7 @@ class SearchEmbed extends TsEmbed {
12533
12894
  class SearchBarEmbed extends TsEmbed {
12534
12895
  constructor(domSelector, viewConfig) {
12535
12896
  super(domSelector);
12897
+ this.embedComponentType = 'SearchBarEmbed';
12536
12898
  this.viewConfig = viewConfig;
12537
12899
  }
12538
12900
  /**
@@ -12611,6 +12973,7 @@ class SageEmbed extends V1Embed {
12611
12973
  // eslint-disable-next-line no-useless-constructor
12612
12974
  constructor(domSelector, viewConfig) {
12613
12975
  super(domSelector, viewConfig);
12976
+ this.embedComponentType = 'SageEmbed';
12614
12977
  }
12615
12978
  /**
12616
12979
  * Constructs a map of parameters to be passed on to the
@@ -12672,4 +13035,4 @@ class SageEmbed extends V1Embed {
12672
13035
  }
12673
13036
  }
12674
13037
 
12675
- export { Action, AppEmbed, AuthEvent, AuthFailureType, AuthStatus, AuthType, ContextMenuTriggerOptions, DataSourceVisualMode, EmbedEvent, HomeLeftNavItem, HomepageModule, HostEvent, LiveboardEmbed, Page, PinboardEmbed, PrefetchFeatures, RuntimeFilterOp, SageEmbed, SearchBarEmbed, SearchEmbed, executeTML, exportTML, getEmbedConfig as getInitConfig, getSessionInfo, init, logout$1 as logout, prefetch };
13038
+ export { Action, AnswerService, AppEmbed, AuthEvent, AuthFailureType, AuthStatus, AuthType, ContextMenuTriggerOptions, DataSourceVisualMode, EmbedEvent, HomeLeftNavItem, HomepageModule, HostEvent, LiveboardEmbed, Page, PinboardEmbed, PrefetchFeatures, RuntimeFilterOp, SageEmbed, SearchBarEmbed, SearchEmbed, executeTML, exportTML, getEmbedConfig as getInitConfig, getSessionInfo, init, logout$1 as logout, prefetch };