@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
package/dist/tsembed.js CHANGED
@@ -4,6 +4,50 @@
4
4
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.tsembed = {}));
5
5
  }(this, (function (exports) { 'use strict';
6
6
 
7
+ // istanbul ignore next
8
+ const isObject = (obj) => {
9
+ if (typeof obj === "object" && obj !== null) {
10
+ if (typeof Object.getPrototypeOf === "function") {
11
+ const prototype = Object.getPrototypeOf(obj);
12
+ return prototype === Object.prototype || prototype === null;
13
+ }
14
+ return Object.prototype.toString.call(obj) === "[object Object]";
15
+ }
16
+ return false;
17
+ };
18
+ const merge = (...objects) => objects.reduce((result, current) => {
19
+ if (Array.isArray(current)) {
20
+ throw new TypeError("Arguments provided to ts-deepmerge must be objects, not arrays.");
21
+ }
22
+ Object.keys(current).forEach((key) => {
23
+ if (["__proto__", "constructor", "prototype"].includes(key)) {
24
+ return;
25
+ }
26
+ if (Array.isArray(result[key]) && Array.isArray(current[key])) {
27
+ result[key] = merge.options.mergeArrays
28
+ ? Array.from(new Set(result[key].concat(current[key])))
29
+ : current[key];
30
+ }
31
+ else if (isObject(result[key]) && isObject(current[key])) {
32
+ result[key] = merge(result[key], current[key]);
33
+ }
34
+ else {
35
+ result[key] = current[key];
36
+ }
37
+ });
38
+ return result;
39
+ }, {});
40
+ const defaultOptions = {
41
+ mergeArrays: true,
42
+ };
43
+ merge.options = defaultOptions;
44
+ merge.withOptions = (options, ...objects) => {
45
+ merge.options = Object.assign({ mergeArrays: true }, options);
46
+ const result = merge(...objects);
47
+ merge.options = defaultOptions;
48
+ return result;
49
+ };
50
+
7
51
  /**
8
52
  * Copyright (c) 2023
9
53
  *
@@ -199,6 +243,30 @@
199
243
  */
200
244
  function getDOMNode(domSelector) {
201
245
  return typeof domSelector === 'string' ? document.querySelector(domSelector) : domSelector;
246
+ }
247
+ const deepMerge = (target, source) => merge(target, source);
248
+ const getOperationNameFromQuery = (query) => {
249
+ const regex = /(?:query|mutation)\s+(\w+)/;
250
+ const matches = query.match(regex);
251
+ return matches === null || matches === void 0 ? void 0 : matches[1];
252
+ };
253
+ /**
254
+ *
255
+ * @param obj
256
+ */
257
+ function removeTypename(obj) {
258
+ if (!obj || typeof obj !== 'object')
259
+ return obj;
260
+ // eslint-disable-next-line no-restricted-syntax
261
+ for (const key in obj) {
262
+ if (key === '__typename') {
263
+ delete obj[key];
264
+ }
265
+ else if (typeof obj[key] === 'object') {
266
+ removeTypename(obj[key]);
267
+ }
268
+ }
269
+ return obj;
202
270
  }
203
271
 
204
272
  /**
@@ -443,27 +511,27 @@
443
511
  /**
444
512
  * Search bar
445
513
  */
446
- HomepageModule["Search"] = "search";
514
+ HomepageModule["Search"] = "SEARCH";
447
515
  /**
448
516
  * kPI watchlist module
449
517
  */
450
- HomepageModule["Watchlist"] = "watchlist";
518
+ HomepageModule["Watchlist"] = "WATCHLIST";
451
519
  /**
452
520
  * favorite objects
453
521
  */
454
- HomepageModule["Favorite"] = "favorite";
522
+ HomepageModule["Favorite"] = "FAVORITE";
455
523
  /**
456
524
  * List of answers and liveboards
457
525
  */
458
- HomepageModule["MyLibrary"] = "mylibrary";
526
+ HomepageModule["MyLibrary"] = "MY_LIBRARY";
459
527
  /**
460
528
  * Trending list
461
529
  */
462
- HomepageModule["Trending"] = "trending";
530
+ HomepageModule["Trending"] = "TRENDING";
463
531
  /**
464
532
  * Learning videos
465
533
  */
466
- HomepageModule["Learning"] = "learning";
534
+ HomepageModule["Learning"] = "LEARNING";
467
535
  })(exports.HomepageModule || (exports.HomepageModule = {}));
468
536
  (function (EmbedEvent) {
469
537
  /**
@@ -2530,12 +2598,6 @@
2530
2598
  */
2531
2599
  Action["PersonalisedViewsDropdown"] = "personalisedViewsDropdown";
2532
2600
  })(exports.Action || (exports.Action = {}));
2533
- // eslint-disable-next-line no-shadow
2534
- var OperationType;
2535
- (function (OperationType) {
2536
- OperationType["GetChartWithData"] = "GetChartWithData";
2537
- OperationType["GetTableWithHeadlineData"] = "GetTableWithHeadlineData";
2538
- })(OperationType || (OperationType = {}));
2539
2601
  (function (PrefetchFeatures) {
2540
2602
  PrefetchFeatures["FullApp"] = "FullApp";
2541
2603
  PrefetchFeatures["SearchEmbed"] = "SearchEmbed";
@@ -8646,6 +8708,7 @@
8646
8708
  * @param sessionInfo
8647
8709
  */
8648
8710
  function initMixpanel(sessionInfo) {
8711
+ var _a;
8649
8712
  if (!sessionInfo || !sessionInfo.mixpanelToken) {
8650
8713
  return;
8651
8714
  }
@@ -8663,6 +8726,7 @@
8663
8726
  clusterId: sessionInfo.clusterId,
8664
8727
  clusterName: sessionInfo.clusterName,
8665
8728
  releaseVersion: sessionInfo.releaseVersion,
8729
+ hostAppUrl: ((_a = window === null || window === void 0 ? void 0 : window.location) === null || _a === void 0 ? void 0 : _a.host) || '',
8666
8730
  });
8667
8731
  isMixpanelInitialized = true;
8668
8732
  emptyQueue();
@@ -9155,12 +9219,12 @@
9155
9219
  * _.isObject(null);
9156
9220
  * // => false
9157
9221
  */
9158
- function isObject(value) {
9222
+ function isObject$1(value) {
9159
9223
  var type = typeof value;
9160
9224
  return value != null && (type == 'object' || type == 'function');
9161
9225
  }
9162
9226
 
9163
- var isObject_1 = isObject;
9227
+ var isObject_1 = isObject$1;
9164
9228
 
9165
9229
  /** `Object#toString` result references. */
9166
9230
  var asyncTag = '[object AsyncFunction]',
@@ -9991,9 +10055,9 @@
9991
10055
  var _cacheHas = cacheHas;
9992
10056
 
9993
10057
  /* Built-in method references that are verified to be native. */
9994
- var Set = _getNative(_root, 'Set');
10058
+ var Set$1 = _getNative(_root, 'Set');
9995
10059
 
9996
- var _Set = Set;
10060
+ var _Set = Set$1;
9997
10061
 
9998
10062
  /**
9999
10063
  * This method returns `undefined`.
@@ -10832,6 +10896,7 @@
10832
10896
  *
10833
10897
  * @param data
10834
10898
  * @version SDK: 1.23.0 | ThoughtSpot: 9.4.0.cl
10899
+ * @group Global methods
10835
10900
  */
10836
10901
  const executeTML = async (data) => {
10837
10902
  const { thoughtSpotHost, authType } = config;
@@ -10879,6 +10944,7 @@
10879
10944
  *
10880
10945
  * @param data
10881
10946
  * @version SDK: 1.23.0 | ThoughtSpot: 9.4.0.cl
10947
+ * @group Global methods
10882
10948
  */
10883
10949
  const exportTML = async (data) => {
10884
10950
  const { thoughtSpotHost, authType } = config;
@@ -10924,58 +10990,351 @@
10924
10990
 
10925
10991
  /**
10926
10992
  *
10927
- * @param session
10928
- * @param query
10929
- * @param operation
10993
+ * @param root0
10994
+ * @param root0.query
10995
+ * @param root0.variables
10996
+ * @param root0.thoughtSpotHost
10997
+ * @param root0.isCompositeQuery
10998
+ */
10999
+ async function graphqlQuery({ query, variables, thoughtSpotHost, isCompositeQuery = false, }) {
11000
+ const operationName = getOperationNameFromQuery(query);
11001
+ try {
11002
+ const response = await fetch(`${thoughtSpotHost}/prism/?op=${operationName}`, {
11003
+ method: 'POST',
11004
+ headers: {
11005
+ 'content-type': 'application/json;charset=UTF-8',
11006
+ 'x-requested-by': 'ThoughtSpot',
11007
+ accept: '*/*',
11008
+ 'accept-language': 'en-us',
11009
+ },
11010
+ body: JSON.stringify({
11011
+ operationName,
11012
+ query,
11013
+ variables,
11014
+ }),
11015
+ credentials: 'include',
11016
+ });
11017
+ const result = await response.json();
11018
+ const dataValues = Object.values(result.data);
11019
+ return (isCompositeQuery) ? result.data : dataValues[0];
11020
+ }
11021
+ catch (error) {
11022
+ return error;
11023
+ }
11024
+ }
11025
+
11026
+ const getSourceDetailQuery = `
11027
+ query GetSourceDetail($ids: [GUID!]!) {
11028
+ getSourceDetailById(ids: $ids, type: LOGICAL_TABLE) {
11029
+ id
11030
+ name
11031
+ description
11032
+ authorName
11033
+ authorDisplayName
11034
+ isExternal
11035
+ type
11036
+ created
11037
+ modified
11038
+ columns {
11039
+ id
11040
+ name
11041
+ author
11042
+ authorDisplayName
11043
+ description
11044
+ dataType
11045
+ type
11046
+ modified
11047
+ ownerName
11048
+ owner
11049
+ dataRecency
11050
+ sources {
11051
+ tableId
11052
+ tableName
11053
+ columnId
11054
+ columnName
11055
+ __typename
11056
+ }
11057
+ synonyms
11058
+ cohortAnswerId
11059
+ __typename
11060
+ }
11061
+ relationships
11062
+ destinationRelationships
11063
+ dataSourceId
11064
+ __typename
11065
+ }
11066
+ }
11067
+ `;
11068
+ const sourceDetailCache = new Map();
11069
+ /**
11070
+ *
10930
11071
  * @param thoughtSpotHost
11072
+ * @param sourceId
10931
11073
  */
10932
- function getAnswerServiceInstance(session, query, operation, thoughtSpotHost) {
10933
- let variable;
10934
- const fetchQuery = async (variables) => {
10935
- try {
10936
- const response = await fetch(`${thoughtSpotHost}/prism/?op=${operation}`, {
10937
- method: 'POST',
10938
- headers: {
10939
- 'content-type': 'application/json;charset=UTF-8',
10940
- 'x-requested-by': 'ThoughtSpot',
10941
- accept: '*/*',
10942
- 'accept-language': 'en-us',
10943
- },
10944
- body: JSON.stringify({
10945
- operationName: operation,
10946
- query,
10947
- variables,
10948
- }),
10949
- credentials: 'include',
10950
- });
10951
- const result = await response.json();
10952
- return result.data;
11074
+ async function getSourceDetail(thoughtSpotHost, sourceId) {
11075
+ if (sourceDetailCache.has(sourceId)) {
11076
+ return sourceDetailCache.get(sourceId);
11077
+ }
11078
+ const details = await graphqlQuery({
11079
+ query: getSourceDetailQuery,
11080
+ variables: {
11081
+ ids: [sourceId],
11082
+ },
11083
+ thoughtSpotHost,
11084
+ });
11085
+ const souceDetails = details[0];
11086
+ sourceDetailCache.set(sourceId, souceDetails);
11087
+ return souceDetails;
11088
+ }
11089
+
11090
+ const bachSessionId = `
11091
+ id {
11092
+ sessionId
11093
+ genNo
11094
+ acSession {
11095
+ sessionId
11096
+ genNo
11097
+ }
11098
+ }
11099
+ `;
11100
+ const getUnaggregatedAnswerSession = `
11101
+ mutation GetUnAggregatedAnswerSession($session: BachSessionIdInput!, $columns: [UserPointSelectionInput!]!) {
11102
+ Answer__getUnaggregatedAnswer(session: $session, columns: $columns) {
11103
+ ${bachSessionId}
11104
+ answer {
11105
+ visualizations {
11106
+ ... on TableViz {
11107
+ columns {
11108
+ column {
11109
+ id
11110
+ name
11111
+ referencedColumns {
11112
+ guid
11113
+ displayName
11114
+ }
11115
+ }
11116
+ }
11117
+ }
11118
+ }
11119
+ }
11120
+ }
11121
+ }
11122
+ `;
11123
+ const removeColumns = `
11124
+ mutation RemoveColumns($session: BachSessionIdInput!, $logicalColumnIds: [GUID!], $columnIds: [GUID!]) {
11125
+ Answer__removeColumns(
11126
+ session: $session
11127
+ logicalColumnIds: $logicalColumnIds
11128
+ columnIds: $columnIds
11129
+ ) {
11130
+ ${bachSessionId}
11131
+ }
11132
+ }
11133
+ `;
11134
+ const addColumns = `
11135
+ mutation AddColumns($session: BachSessionIdInput!, $columns: [AnswerColumnInfo!]!) {
11136
+ Answer__addColumn(session: $session, columns: $columns) {
11137
+ ${bachSessionId}
11138
+ }
11139
+ }
11140
+ `;
11141
+ const getAnswerData = `
11142
+ query GetTableWithHeadlineData($session: BachSessionIdInput!, $deadline: Int!, $dataPaginationParams: DataPaginationParamsInput!) {
11143
+ getAnswer(session: $session) {
11144
+ ${bachSessionId}
11145
+ answer {
11146
+ id
11147
+ visualizations {
11148
+ id
11149
+ ... on TableViz {
11150
+ columns {
11151
+ column {
11152
+ id
11153
+ name
11154
+ type
11155
+ aggregationType
11156
+ dataType
11157
+ }
11158
+ }
11159
+ data(deadline: $deadline, pagination: $dataPaginationParams)
11160
+ }
11161
+ }
11162
+ }
11163
+ }
11164
+ }
11165
+ `;
11166
+
11167
+ // eslint-disable-next-line no-shadow
11168
+ var OperationType;
11169
+ (function (OperationType) {
11170
+ OperationType["GetChartWithData"] = "GetChartWithData";
11171
+ OperationType["GetTableWithHeadlineData"] = "GetTableWithHeadlineData";
11172
+ })(OperationType || (OperationType = {}));
11173
+ /**
11174
+ * Class representing the answer service provided with the
11175
+ * custom action payload. This service could be used to run
11176
+ * graphql queries in the context of the answer on which the
11177
+ * custom action was triggered.
11178
+ *
11179
+ * @example
11180
+ * ```js
11181
+ * embed.on(EmbedEvent.CustomAction, e => {
11182
+ * const underlying = await e.answerService.getUnderlyingDataForPoint([
11183
+ * 'col name 1'
11184
+ * ]);
11185
+ * const data = await underlying.fetchData(0, 100);
11186
+ * })
11187
+ * ```
11188
+ * @version
11189
+ * ThoughtSpot: 9.9.0.cl / SDK: 1.25.0
11190
+ */
11191
+ class AnswerService {
11192
+ constructor(session, answer, thoughtSpotHost, selectedPoints) {
11193
+ this.session = session;
11194
+ this.answer = answer;
11195
+ this.thoughtSpotHost = thoughtSpotHost;
11196
+ this.selectedPoints = selectedPoints;
11197
+ this.session = removeTypename(session);
11198
+ }
11199
+ async getSourceDetail() {
11200
+ const sourceId = this.answer.sources[0].header.guid;
11201
+ return getSourceDetail(this.thoughtSpotHost, sourceId);
11202
+ }
11203
+ async removeColumns(columnIds) {
11204
+ return this.executeQuery(removeColumns, {
11205
+ logicalColumnIds: columnIds,
11206
+ });
11207
+ }
11208
+ async addColumns(columnIds) {
11209
+ return this.executeQuery(addColumns, {
11210
+ columns: columnIds.map((colId) => ({ logicalColumnId: colId })),
11211
+ });
11212
+ }
11213
+ async fetchData(offset = 0, size = 1000) {
11214
+ const { answer } = await this.executeQuery(getAnswerData, {
11215
+ deadline: 0,
11216
+ dataPaginationParams: {
11217
+ isClientPaginated: true,
11218
+ offset,
11219
+ size,
11220
+ },
11221
+ });
11222
+ const { columns, data } = answer.visualizations[0];
11223
+ return {
11224
+ columns,
11225
+ data,
11226
+ };
11227
+ }
11228
+ /**
11229
+ *
11230
+ * @param userLocale
11231
+ * @param omitInfo Omit the download Info on top of the CSV
11232
+ * @returns Response
11233
+ */
11234
+ async fetchCSVBlob(userLocale = 'en-us', omitInfo = false) {
11235
+ if (omitInfo) {
11236
+ console.warn('omitInfo not supported yet.');
10953
11237
  }
10954
- catch (error) {
10955
- return error;
11238
+ const fetchUrl = `${this.thoughtSpotHost}/prism/download/answer/csv?sessionId=${this.session.sessionId}&genNo=${this.session.genNo}&userLocale=${userLocale}&exportFileName=data&omitInfo=${omitInfo}`;
11239
+ return fetch(fetchUrl, {
11240
+ credentials: 'include',
11241
+ });
11242
+ }
11243
+ async getUnderlyingDataForPoint(outputColumnNames, selectedPoints) {
11244
+ if (!selectedPoints && !this.selectedPoints) {
11245
+ throw new Error('Needs to be triggered in context of a point');
10956
11246
  }
10957
- };
10958
- const fetchData = (offset, batchSize) => {
10959
- if (operation === OperationType.GetChartWithData) {
10960
- variable = { batchSize, offset: offset * batchSize };
11247
+ if (!selectedPoints) {
11248
+ selectedPoints = getSelectedPointsForUnderlyingDataQuery(this.selectedPoints);
11249
+ }
11250
+ const sourceDetail = await this.getSourceDetail();
11251
+ const ouputColumnGuids = getGuidsFromColumnNames(sourceDetail, outputColumnNames);
11252
+ const unAggAnswer = await graphqlQuery({
11253
+ query: getUnaggregatedAnswerSession,
11254
+ variables: {
11255
+ session: this.session,
11256
+ columns: selectedPoints,
11257
+ },
11258
+ thoughtSpotHost: this.thoughtSpotHost,
11259
+ });
11260
+ const unaggAnswerSession = new AnswerService(unAggAnswer.id, unAggAnswer.answer, this.thoughtSpotHost);
11261
+ const currentColumns = new Set(unAggAnswer.answer.visualizations[0].columns
11262
+ .map((c) => c.column.referencedColumns[0].guid));
11263
+ const columnsToAdd = [...ouputColumnGuids].filter((col) => !currentColumns.has(col));
11264
+ if (columnsToAdd.length) {
11265
+ await unaggAnswerSession.addColumns(columnsToAdd);
11266
+ }
11267
+ const columnsToRemove = [...currentColumns].filter((col) => !ouputColumnGuids.has(col));
11268
+ if (columnsToRemove.length) {
11269
+ await unaggAnswerSession.removeColumns(columnsToRemove);
11270
+ }
11271
+ return unaggAnswerSession;
11272
+ }
11273
+ async executeQuery(query, variables) {
11274
+ const data = await graphqlQuery({
11275
+ query,
11276
+ variables: {
11277
+ session: this.session,
11278
+ ...variables,
11279
+ },
11280
+ thoughtSpotHost: this.thoughtSpotHost,
11281
+ isCompositeQuery: false,
11282
+ });
11283
+ this.session = deepMerge(this.session, (data === null || data === void 0 ? void 0 : data.id) || {});
11284
+ return data;
11285
+ }
11286
+ getSession() {
11287
+ return this.session;
11288
+ }
11289
+ }
11290
+ /**
11291
+ *
11292
+ * @param sourceDetail
11293
+ * @param colNames
11294
+ */
11295
+ function getGuidsFromColumnNames(sourceDetail, colNames) {
11296
+ const cols = sourceDetail.columns.reduce((colSet, col) => {
11297
+ colSet[col.name] = col;
11298
+ return colSet;
11299
+ }, {});
11300
+ return new Set(colNames.map((colName) => {
11301
+ const col = cols[colName];
11302
+ return col.id;
11303
+ }));
11304
+ }
11305
+ /**
11306
+ *
11307
+ * @param selectedPoints
11308
+ */
11309
+ function getSelectedPointsForUnderlyingDataQuery(selectedPoints) {
11310
+ const underlyingDataPoint = [];
11311
+ /**
11312
+ *
11313
+ * @param colVal
11314
+ */
11315
+ function addPointFromColVal(colVal) {
11316
+ const dataType = colVal.column.dataType;
11317
+ const id = colVal.column.id;
11318
+ let dataValue;
11319
+ if (dataType === 'DATE') {
11320
+ dataValue = [{
11321
+ epochRange: {
11322
+ startEpoch: colVal.value,
11323
+ },
11324
+ }];
10961
11325
  }
10962
11326
  else {
10963
- variable = {
10964
- dataPaginationParams: {
10965
- isClientPaginated: true,
10966
- offset: offset * batchSize,
10967
- size: batchSize,
10968
- },
10969
- };
11327
+ dataValue = [{ value: colVal.value }];
10970
11328
  }
10971
- return fetchQuery({
10972
- session,
10973
- ...variable,
11329
+ underlyingDataPoint.push({
11330
+ columnId: colVal.column.id,
11331
+ dataValue,
10974
11332
  });
10975
- };
10976
- return {
10977
- fetchData,
10978
- };
11333
+ }
11334
+ selectedPoints.forEach((p) => {
11335
+ p.selectedAttributes.forEach(addPointFromColVal);
11336
+ });
11337
+ return underlyingDataPoint;
10979
11338
  }
10980
11339
 
10981
11340
  /**
@@ -10984,16 +11343,12 @@
10984
11343
  * @param thoughtSpotHost
10985
11344
  */
10986
11345
  function processCustomAction(e, thoughtSpotHost) {
10987
- var _a;
10988
- if ([OperationType.GetChartWithData, OperationType.GetTableWithHeadlineData].includes((_a = e.data) === null || _a === void 0 ? void 0 : _a.operation)) {
10989
- const { session, query, operation } = e.data;
10990
- const answerService = getAnswerServiceInstance(session, query, operation, thoughtSpotHost);
10991
- return {
10992
- ...e,
10993
- answerService,
10994
- };
10995
- }
10996
- return e;
11346
+ const { session, embedAnswerData, contextMenuPoints } = e.data;
11347
+ const answerService = new AnswerService(session, embedAnswerData, thoughtSpotHost, contextMenuPoints === null || contextMenuPoints === void 0 ? void 0 : contextMenuPoints.selectedPoints);
11348
+ return {
11349
+ ...e,
11350
+ answerService,
11351
+ };
10997
11352
  }
10998
11353
  /**
10999
11354
  *
@@ -11138,7 +11493,7 @@
11138
11493
  });
11139
11494
  }
11140
11495
 
11141
- 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$1={".":{"import":"./lib/src/index.js",require:"./cjs/src/index.js",types:"./lib/src/index.d.ts"},"./react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"},"./lib/src/react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"}};var typesVersions={"*":{react:["./lib/src/react/all-types-export.d.ts"]}};var scripts={lint:"eslint 'src/**'","lint:fix":"eslint 'src/**/*.*' --fix",tsc:"tsc -p . --incremental false; tsc -p . --incremental false --module commonjs --outDir cjs",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$1,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};
11496
+ 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$1={".":{"import":"./lib/src/index.js",require:"./cjs/src/index.js",types:"./lib/src/index.d.ts"},"./react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"},"./lib/src/react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"}};var typesVersions={"*":{react:["./lib/src/react/all-types-export.d.ts"]}};var scripts={lint:"eslint 'src/**'","lint:fix":"eslint 'src/**/*.*' --fix",tsc:"tsc -p . --incremental false; tsc -p . --incremental false --module commonjs --outDir cjs",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$1,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};
11142
11497
 
11143
11498
  /**
11144
11499
  * Copyright (c) 2022
@@ -11170,6 +11525,7 @@
11170
11525
  class TsEmbed {
11171
11526
  constructor(domSelector, viewConfig) {
11172
11527
  this.isAppInitialized = false;
11528
+ this.embedComponentType = 'TsEmbed';
11173
11529
  /**
11174
11530
  * Should we encode URL Query Params using base64 encoding which thoughtspot
11175
11531
  * will generate for embedding. This provides additional security to
@@ -11201,6 +11557,7 @@
11201
11557
  ? getRuntimeFilters(this.viewConfig.runtimeFilters)
11202
11558
  : null,
11203
11559
  hiddenHomepageModules: this.viewConfig.hiddenHomepageModules || [],
11560
+ reorderedHomepageModules: this.viewConfig.reorderedHomepageModules || [],
11204
11561
  hostConfig: this.embedConfig.hostConfig,
11205
11562
  hiddenHomeLeftNavItems: ((_a = this.viewConfig) === null || _a === void 0 ? void 0 : _a.hiddenHomeLeftNavItems)
11206
11563
  ? (_b = this.viewConfig) === null || _b === void 0 ? void 0 : _b.hiddenHomeLeftNavItems
@@ -11250,6 +11607,7 @@
11250
11607
  this.registerAppInit();
11251
11608
  uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_EMBED_CREATE, {
11252
11609
  ...viewConfig,
11610
+ embedComponentType: this.embedComponentType,
11253
11611
  });
11254
11612
  }
11255
11613
  /**
@@ -11948,6 +12306,7 @@
11948
12306
  constructor(domSelector, viewConfig) {
11949
12307
  super(domSelector, viewConfig);
11950
12308
  this.defaultHeight = '100%';
12309
+ this.embedComponentType = 'AppEmbed';
11951
12310
  /**
11952
12311
  * Set the iframe height as per the computed height received
11953
12312
  * from the ThoughtSpot app.
@@ -12137,6 +12496,7 @@
12137
12496
  constructor(domSelector, viewConfig) {
12138
12497
  super(domSelector, viewConfig);
12139
12498
  this.defaultHeight = 500;
12499
+ this.embedComponentType = 'LiveboardEmbed';
12140
12500
  /**
12141
12501
  * Set the iframe height as per the computed height received
12142
12502
  * from the ThoughtSpot app.
@@ -12306,6 +12666,7 @@
12306
12666
  class SearchEmbed extends TsEmbed {
12307
12667
  constructor(domSelector, viewConfig) {
12308
12668
  super(domSelector);
12669
+ this.embedComponentType = 'SearchEmbed';
12309
12670
  this.viewConfig = viewConfig;
12310
12671
  }
12311
12672
  /**
@@ -12410,6 +12771,7 @@
12410
12771
  class SearchBarEmbed extends TsEmbed {
12411
12772
  constructor(domSelector, viewConfig) {
12412
12773
  super(domSelector);
12774
+ this.embedComponentType = 'SearchBarEmbed';
12413
12775
  this.viewConfig = viewConfig;
12414
12776
  }
12415
12777
  /**
@@ -12488,6 +12850,7 @@
12488
12850
  // eslint-disable-next-line no-useless-constructor
12489
12851
  constructor(domSelector, viewConfig) {
12490
12852
  super(domSelector, viewConfig);
12853
+ this.embedComponentType = 'SageEmbed';
12491
12854
  }
12492
12855
  /**
12493
12856
  * Constructs a map of parameters to be passed on to the
@@ -12549,6 +12912,7 @@
12549
12912
  }
12550
12913
  }
12551
12914
 
12915
+ exports.AnswerService = AnswerService;
12552
12916
  exports.AppEmbed = AppEmbed;
12553
12917
  exports.LiveboardEmbed = LiveboardEmbed;
12554
12918
  exports.PinboardEmbed = PinboardEmbed;