@thoughtspot/visual-embed-sdk 1.27.8 → 1.28.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 (142) hide show
  1. package/README.md +1 -1
  2. package/cjs/package.json +1 -1
  3. package/cjs/src/auth.d.ts.map +1 -1
  4. package/cjs/src/auth.js +2 -2
  5. package/cjs/src/auth.js.map +1 -1
  6. package/cjs/src/embed/base.d.ts +1 -1
  7. package/cjs/src/embed/base.d.ts.map +1 -1
  8. package/cjs/src/embed/base.js +5 -5
  9. package/cjs/src/embed/base.js.map +1 -1
  10. package/cjs/src/embed/base.spec.js +1 -1
  11. package/cjs/src/embed/base.spec.js.map +1 -1
  12. package/cjs/src/embed/sage.d.ts +5 -5
  13. package/cjs/src/embed/sage.d.ts.map +1 -1
  14. package/cjs/src/embed/sage.js +1 -16
  15. package/cjs/src/embed/sage.js.map +1 -1
  16. package/cjs/src/embed/sage.spec.js +11 -11
  17. package/cjs/src/embed/sage.spec.js.map +1 -1
  18. package/cjs/src/embed/search.d.ts +1 -5
  19. package/cjs/src/embed/search.d.ts.map +1 -1
  20. package/cjs/src/embed/search.js +4 -4
  21. package/cjs/src/embed/search.js.map +1 -1
  22. package/cjs/src/embed/ts-embed.d.ts +1 -1
  23. package/cjs/src/embed/ts-embed.d.ts.map +1 -1
  24. package/cjs/src/embed/ts-embed.js +6 -6
  25. package/cjs/src/embed/ts-embed.js.map +1 -1
  26. package/cjs/src/embed/ts-embed.spec.js +8 -14
  27. package/cjs/src/embed/ts-embed.spec.js.map +1 -1
  28. package/cjs/src/index.d.ts +4 -3
  29. package/cjs/src/index.d.ts.map +1 -1
  30. package/cjs/src/index.js +4 -1
  31. package/cjs/src/index.js.map +1 -1
  32. package/cjs/src/mixpanel-service.d.ts +1 -0
  33. package/cjs/src/mixpanel-service.d.ts.map +1 -1
  34. package/cjs/src/mixpanel-service.js +1 -0
  35. package/cjs/src/mixpanel-service.js.map +1 -1
  36. package/cjs/src/react/all-types-export.d.ts +1 -1
  37. package/cjs/src/react/all-types-export.d.ts.map +1 -1
  38. package/cjs/src/react/all-types-export.js +2 -1
  39. package/cjs/src/react/all-types-export.js.map +1 -1
  40. package/cjs/src/react/index.spec.js +0 -12
  41. package/cjs/src/react/index.spec.js.map +1 -1
  42. package/cjs/src/types.d.ts +43 -13
  43. package/cjs/src/types.d.ts.map +1 -1
  44. package/cjs/src/types.js +37 -10
  45. package/cjs/src/types.js.map +1 -1
  46. package/cjs/src/utils/graphql/answerService/answerService.d.ts +56 -2
  47. package/cjs/src/utils/graphql/answerService/answerService.d.ts.map +1 -1
  48. package/cjs/src/utils/graphql/answerService/answerService.js +55 -0
  49. package/cjs/src/utils/graphql/answerService/answerService.js.map +1 -1
  50. package/dist/src/auth.d.ts.map +1 -1
  51. package/dist/src/embed/base.d.ts +1 -1
  52. package/dist/src/embed/base.d.ts.map +1 -1
  53. package/dist/src/embed/sage.d.ts +5 -5
  54. package/dist/src/embed/sage.d.ts.map +1 -1
  55. package/dist/src/embed/search.d.ts +1 -5
  56. package/dist/src/embed/search.d.ts.map +1 -1
  57. package/dist/src/embed/ts-embed.d.ts +1 -1
  58. package/dist/src/embed/ts-embed.d.ts.map +1 -1
  59. package/dist/src/index.d.ts +4 -3
  60. package/dist/src/index.d.ts.map +1 -1
  61. package/dist/src/mixpanel-service.d.ts +1 -0
  62. package/dist/src/mixpanel-service.d.ts.map +1 -1
  63. package/dist/src/react/all-types-export.d.ts +1 -1
  64. package/dist/src/react/all-types-export.d.ts.map +1 -1
  65. package/dist/src/types.d.ts +43 -13
  66. package/dist/src/types.d.ts.map +1 -1
  67. package/dist/src/utils/graphql/answerService/answerService.d.ts +56 -2
  68. package/dist/src/utils/graphql/answerService/answerService.d.ts.map +1 -1
  69. package/dist/tsembed-react.es.js +2800 -2732
  70. package/dist/tsembed-react.js +1525 -1457
  71. package/dist/tsembed.es.js +1768 -1700
  72. package/dist/tsembed.js +1674 -1604
  73. package/dist/visual-embed-sdk-react-full.d.ts +135 -24
  74. package/dist/visual-embed-sdk-react.d.ts +135 -24
  75. package/dist/visual-embed-sdk.d.ts +135 -24
  76. package/lib/package.json +1 -1
  77. package/lib/src/auth.d.ts.map +1 -1
  78. package/lib/src/auth.js +3 -3
  79. package/lib/src/auth.js.map +1 -1
  80. package/lib/src/embed/base.d.ts +1 -1
  81. package/lib/src/embed/base.d.ts.map +1 -1
  82. package/lib/src/embed/base.js +5 -5
  83. package/lib/src/embed/base.js.map +1 -1
  84. package/lib/src/embed/base.spec.js +2 -2
  85. package/lib/src/embed/base.spec.js.map +1 -1
  86. package/lib/src/embed/sage.d.ts +5 -5
  87. package/lib/src/embed/sage.d.ts.map +1 -1
  88. package/lib/src/embed/sage.js +1 -16
  89. package/lib/src/embed/sage.js.map +1 -1
  90. package/lib/src/embed/sage.spec.js +11 -11
  91. package/lib/src/embed/sage.spec.js.map +1 -1
  92. package/lib/src/embed/search.d.ts +1 -5
  93. package/lib/src/embed/search.d.ts.map +1 -1
  94. package/lib/src/embed/search.js +5 -5
  95. package/lib/src/embed/search.js.map +1 -1
  96. package/lib/src/embed/ts-embed.d.ts +1 -1
  97. package/lib/src/embed/ts-embed.d.ts.map +1 -1
  98. package/lib/src/embed/ts-embed.js +9 -9
  99. package/lib/src/embed/ts-embed.js.map +1 -1
  100. package/lib/src/embed/ts-embed.spec.js +8 -14
  101. package/lib/src/embed/ts-embed.spec.js.map +1 -1
  102. package/lib/src/index.d.ts +4 -3
  103. package/lib/src/index.d.ts.map +1 -1
  104. package/lib/src/index.js +2 -3
  105. package/lib/src/index.js.map +1 -1
  106. package/lib/src/mixpanel-service.d.ts +1 -0
  107. package/lib/src/mixpanel-service.d.ts.map +1 -1
  108. package/lib/src/mixpanel-service.js +1 -0
  109. package/lib/src/mixpanel-service.js.map +1 -1
  110. package/lib/src/react/all-types-export.d.ts +1 -1
  111. package/lib/src/react/all-types-export.d.ts.map +1 -1
  112. package/lib/src/react/all-types-export.js +1 -1
  113. package/lib/src/react/all-types-export.js.map +1 -1
  114. package/lib/src/react/index.spec.js +0 -12
  115. package/lib/src/react/index.spec.js.map +1 -1
  116. package/lib/src/types.d.ts +43 -13
  117. package/lib/src/types.d.ts.map +1 -1
  118. package/lib/src/types.js +37 -10
  119. package/lib/src/types.js.map +1 -1
  120. package/lib/src/utils/authService/authService.spec.js +1 -1
  121. package/lib/src/utils/authService/authService.spec.js.map +1 -1
  122. package/lib/src/utils/graphql/answerService/answerService.d.ts +56 -2
  123. package/lib/src/utils/graphql/answerService/answerService.d.ts.map +1 -1
  124. package/lib/src/utils/graphql/answerService/answerService.js +55 -0
  125. package/lib/src/utils/graphql/answerService/answerService.js.map +1 -1
  126. package/lib/src/visual-embed-sdk.d.ts +144 -30
  127. package/package.json +1 -1
  128. package/src/auth.ts +6 -6
  129. package/src/embed/base.spec.ts +3 -3
  130. package/src/embed/base.ts +12 -12
  131. package/src/embed/sage.spec.ts +11 -11
  132. package/src/embed/sage.ts +4 -17
  133. package/src/embed/search.ts +6 -11
  134. package/src/embed/ts-embed.spec.ts +19 -25
  135. package/src/embed/ts-embed.ts +37 -34
  136. package/src/index.ts +10 -1
  137. package/src/mixpanel-service.ts +1 -0
  138. package/src/react/all-types-export.ts +1 -0
  139. package/src/react/index.spec.tsx +0 -29
  140. package/src/types.ts +53 -24
  141. package/src/utils/authService/authService.spec.ts +4 -4
  142. package/src/utils/graphql/answerService/answerService.ts +56 -1
@@ -7,20 +7,20 @@
7
7
  * @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
8
8
  */
9
9
 
10
- import { getReleaseVersion } from '../auth';
11
- import { ERROR_MESSAGE } from '../errors';
12
10
  import {
13
- Action, DOMSelector, DataSourceVisualMode, Param, ViewConfig,
11
+ DataSourceVisualMode, DOMSelector, Param, Action, ViewConfig,
14
12
  } from '../types';
15
13
  import {
14
+ getQueryParamString,
16
15
  checkReleaseVersionInBeta,
17
16
  getFilterQuery,
18
- getQueryParamString,
19
17
  getRuntimeParameters,
20
18
  } from '../utils';
19
+ import { TsEmbed } from './ts-embed';
20
+ import { ERROR_MESSAGE } from '../errors';
21
21
  import { getAuthPromise } from './base';
22
+ import { getReleaseVersion } from '../auth';
22
23
  import { getEmbedConfig } from './embedConfig';
23
- import { TsEmbed } from './ts-embed';
24
24
 
25
25
  /**
26
26
  * Configuration for search options.
@@ -69,10 +69,6 @@ export interface SearchViewConfig
69
69
  * using raw answer data.
70
70
  */
71
71
  hideResults?: boolean;
72
- /**
73
- * If set to true, expands all the data sources panel.
74
- */
75
- expandAllDataSource?: boolean;
76
72
  /**
77
73
  * If set to true, the Search Assist feature is enabled.
78
74
  *
@@ -194,7 +190,6 @@ export class SearchEmbed extends TsEmbed {
194
190
  protected getEmbedParams(): string {
195
191
  const {
196
192
  hideResults,
197
- expandAllDataSource,
198
193
  enableSearchAssist,
199
194
  forceTable,
200
195
  searchOptions,
@@ -297,7 +292,7 @@ export class SearchEmbed extends TsEmbed {
297
292
  checkReleaseVersionInBeta(
298
293
  getReleaseVersion(),
299
294
  getEmbedConfig().suppressSearchEmbedBetaWarning
300
- || getEmbedConfig().suppressErrorAlerts,
295
+ || getEmbedConfig().suppressErrorAlerts,
301
296
  )
302
297
  ) {
303
298
  alert(ERROR_MESSAGE.SEARCHEMBED_BETA_WRANING_MESSAGE);
@@ -1,38 +1,38 @@
1
1
  /* eslint-disable dot-notation */
2
- import * as authInstance from '../auth';
3
2
  import { resetCachedAuthToken } from '../authToken';
4
- import * as config from '../config';
5
3
  import {
6
- AppEmbed,
7
4
  AuthType,
5
+ init,
8
6
  EmbedEvent,
9
- LiveboardEmbed,
10
- LiveboardViewConfig,
11
- PinboardEmbed,
12
7
  SearchEmbed,
13
- init,
8
+ PinboardEmbed,
9
+ LiveboardViewConfig,
10
+ AppEmbed,
11
+ LiveboardEmbed,
14
12
  } from '../index';
15
- import * as mixpanelInstance from '../mixpanel-service';
16
- import { MIXPANEL_EVENT } from '../mixpanel-service';
17
13
  import {
18
- defaultParamsForPinboardEmbed,
14
+ Action, HomeLeftNavItem, RuntimeFilter, RuntimeFilterOp, HomepageModule,
15
+ } from '../types';
16
+ import {
19
17
  executeAfterWait,
20
- expectUrlMatchesWithParams,
21
18
  getDocumentBody,
22
19
  getIFrameEl,
23
20
  getIFrameSrc,
24
21
  getRootEl,
25
- mockMessageChannel,
26
22
  postMessageToParent,
23
+ defaultParamsForPinboardEmbed,
27
24
  waitFor,
25
+ expectUrlMatchesWithParams,
26
+ mockMessageChannel,
28
27
  } from '../test/test-utils';
29
- import {
30
- Action, HomeLeftNavItem, HomepageModule, RuntimeFilter, RuntimeFilterOp,
31
- } from '../types';
28
+ import * as config from '../config';
29
+ import * as tsEmbedInstance from './ts-embed';
30
+ import * as mixpanelInstance from '../mixpanel-service';
31
+ import * as authInstance from '../auth';
32
+ import * as baseInstance from './base';
33
+ import { MIXPANEL_EVENT } from '../mixpanel-service';
32
34
  import * as authService from '../utils/authService/authService';
33
35
  import { logger } from '../utils/logger';
34
- import * as baseInstance from './base';
35
- import * as tsEmbedInstance from './ts-embed';
36
36
 
37
37
  const defaultViewConfig = {
38
38
  frameParams: {
@@ -615,10 +615,7 @@ describe('Unit test case for ts embed', () => {
615
615
  type: EmbedEvent.APP_INIT,
616
616
  data: {},
617
617
  };
618
- const searchEmbed = new SearchEmbed(getRootEl(), {
619
- ...defaultViewConfig,
620
- preRenderId: 'test',
621
- });
618
+ const searchEmbed = new SearchEmbed(getRootEl(), { ...defaultViewConfig, preRenderId: 'test' });
622
619
  searchEmbed.preRender();
623
620
  const mockPort: any = {
624
621
  postMessage: jest.fn(),
@@ -675,10 +672,7 @@ describe('Unit test case for ts embed', () => {
675
672
  type: EmbedEvent.AuthExpire,
676
673
  data: {},
677
674
  };
678
- const searchEmbed = new SearchEmbed(getRootEl(), {
679
- ...defaultViewConfig,
680
- preRenderId: 'test',
681
- });
675
+ const searchEmbed = new SearchEmbed(getRootEl(), { ...defaultViewConfig, preRenderId: 'test' });
682
676
  jest.spyOn(baseInstance, 'notifyAuthFailure');
683
677
  searchEmbed.preRender();
684
678
  const mockPort: any = {
@@ -8,54 +8,57 @@
8
8
  */
9
9
 
10
10
  import isEqual from 'lodash/isEqual';
11
- import pkgInfo from '../../package.json';
12
- import { AuthFailureType } from '../auth';
11
+ import { logger } from '../utils/logger';
13
12
  import { getAuthenticationToken } from '../authToken';
13
+ import { AnswerService } from '../utils/graphql/answerService/answerService';
14
+ import {
15
+ getEncodedQueryParamsString,
16
+ getCssDimension,
17
+ getOffsetTop,
18
+ embedEventStatus,
19
+ setAttributes,
20
+ getCustomisations,
21
+ getRuntimeFilters,
22
+ getDOMNode,
23
+ getFilterQuery,
24
+ getQueryParamString,
25
+ getRuntimeParameters,
26
+ setStyleProperties,
27
+ removeStyleProperties,
28
+ isUndefined,
29
+ } from '../utils';
14
30
  import {
15
- DEFAULT_EMBED_HEIGHT,
16
- DEFAULT_EMBED_WIDTH,
17
- URL_MAX_LENGTH,
18
31
  getThoughtSpotHost,
32
+ URL_MAX_LENGTH,
33
+ DEFAULT_EMBED_WIDTH,
34
+ DEFAULT_EMBED_HEIGHT,
19
35
  getV2BasePath,
20
36
  } from '../config';
21
- import { MIXPANEL_EVENT, uploadMixpanelEvent } from '../mixpanel-service';
22
37
  import {
23
- Action,
24
38
  AuthType,
25
- ContextMenuTriggerOptions,
26
39
  DOMSelector,
27
- EmbedConfig,
28
- EmbedEvent,
29
40
  HostEvent,
41
+ EmbedEvent,
30
42
  MessageCallback,
31
- MessageCallbackObj,
32
- MessageOptions,
43
+ Action,
33
44
  Param,
45
+ EmbedConfig,
46
+ MessageOptions,
47
+ MessagePayload,
48
+ MessageCallbackObj,
34
49
  ViewConfig,
50
+ FrameParams,
51
+ ContextMenuTriggerOptions,
52
+ RuntimeFilter,
35
53
  } from '../types';
36
- import {
37
- embedEventStatus,
38
- getCssDimension,
39
- getCustomisations,
40
- getDOMNode,
41
- getEncodedQueryParamsString,
42
- getFilterQuery,
43
- getOffsetTop,
44
- getQueryParamString,
45
- getRuntimeFilters,
46
- getRuntimeParameters,
47
- isUndefined,
48
- removeStyleProperties,
49
- setAttributes,
50
- setStyleProperties,
51
- } from '../utils';
52
- import { AnswerService } from '../utils/graphql/answerService/answerService';
53
- import { logger } from '../utils/logger';
54
- import { processAuthFailure, processEventData } from '../utils/processData';
54
+ import { uploadMixpanelEvent, MIXPANEL_EVENT } from '../mixpanel-service';
55
+ import { processEventData, processAuthFailure } from '../utils/processData';
55
56
  import { processTrigger } from '../utils/processTrigger';
57
+ import pkgInfo from '../../package.json';
56
58
  import {
57
- getAuthPromise, handleAuth, notifyAuthFailure, renderInQueue,
59
+ getAuthPromise, renderInQueue, handleAuth, notifyAuthFailure,
58
60
  } from './base';
61
+ import { AuthFailureType } from '../auth';
59
62
  import { getEmbedConfig } from './embedConfig';
60
63
 
61
64
  const { version } = pkgInfo;
@@ -517,7 +520,7 @@ export class TsEmbed {
517
520
  : `?${queryString}`;
518
521
  let host = this.thoughtSpotHost;
519
522
  if (!isUndefined(this.embedConfig.enableReactShell)) {
520
- host = (this.embedConfig.enableReactShell as boolean) ? '/v2' : '/v1';
523
+ host = this.embedConfig.enableReactShell as boolean ? '/v2' : '/v1';
521
524
  }
522
525
  const path = `${host}/${queryParams}#`;
523
526
  return path;
@@ -679,7 +682,7 @@ export class TsEmbed {
679
682
  protected connectPreRendered(): boolean {
680
683
  const preRenderIds = this.getPreRenderIds();
681
684
  this.preRenderWrapper = this.preRenderWrapper
682
- || document.getElementById(preRenderIds.wrapper);
685
+ || document.getElementById(preRenderIds.wrapper);
683
686
 
684
687
  this.preRenderChild = this.preRenderChild || document.getElementById(preRenderIds.child);
685
688
 
package/src/index.ts CHANGED
@@ -46,11 +46,14 @@ import {
46
46
  ContextMenuTriggerOptions,
47
47
  RuntimeParameter,
48
48
  LogLevel,
49
+ VizPoint,
50
+ CustomActionPayload,
49
51
  } from './types';
50
52
  import { CustomCssVariables } from './css-variables';
51
53
  import { SageEmbed, SageViewConfig } from './embed/sage';
52
- import { AnswerService } from './utils/graphql/answerService/answerService';
54
+ import { AnswerService, SessionInterface, UnderlyingDataPoint } from './utils/graphql/answerService/answerService';
53
55
  import { getEmbedConfig } from './embed/embedConfig';
56
+ import { uploadMixpanelEvent, MIXPANEL_EVENT } from './mixpanel-service';
54
57
 
55
58
  export {
56
59
  init,
@@ -74,6 +77,8 @@ export {
74
77
  AuthEventEmitter,
75
78
  AnswerService,
76
79
  // types
80
+ SessionInterface,
81
+ UnderlyingDataPoint,
77
82
  Page,
78
83
  AuthType,
79
84
  RuntimeFilter,
@@ -103,4 +108,8 @@ export {
103
108
  CustomCssVariables,
104
109
  RuntimeParameter,
105
110
  LogLevel,
111
+ uploadMixpanelEvent,
112
+ MIXPANEL_EVENT,
113
+ VizPoint,
114
+ CustomActionPayload,
106
115
  };
@@ -18,6 +18,7 @@ export const MIXPANEL_EVENT = {
18
18
  VISUAL_SDK_ON: 'visual-sdk-on',
19
19
  VISUAL_SDK_IFRAME_LOAD_PERFORMANCE: 'visual-sdk-iframe-load-performance',
20
20
  VISUAL_SDK_EMBED_CREATE: 'visual-sdk-embed-create',
21
+ VERCEL_INTEGRATION_COMPLETED: 'vercel-integration-completed',
21
22
  };
22
23
 
23
24
  let isMixpanelInitialized = false;
@@ -18,6 +18,7 @@ export {
18
18
  prefetch,
19
19
  getInitConfig,
20
20
  getSessionInfo,
21
+ uploadMixpanelEvent,
21
22
  PinboardEmbed,
22
23
  AuthFailureType,
23
24
  AuthStatus,
@@ -199,35 +199,6 @@ describe('React Components', () => {
199
199
  ).toBe(true);
200
200
  expect(containerSibling.querySelector('div')).toBe(null);
201
201
  });
202
-
203
- it('Should have the correct container element', async () => {
204
- const { container } = render(
205
- <LiveboardEmbed liveboardId="abcd" className="def" />,
206
- );
207
-
208
- await waitFor(() => getIFrameEl(container));
209
- expect(container.querySelector('div')).not.toBe(null);
210
- expect(
211
- container.querySelector('div').classList.contains('def'),
212
- ).toBe(true);
213
-
214
- const { container: containerSibling } = render(
215
- <LiveboardEmbed
216
- liveboardId="abcd"
217
- className="def"
218
- insertAsSibling={true}
219
- />,
220
- );
221
- await waitFor(() => getIFrameEl(containerSibling));
222
- expect(containerSibling.querySelector('span')).not.toBe(null);
223
- expect(containerSibling.querySelector('span').style.position).toBe(
224
- 'absolute',
225
- );
226
- expect(
227
- getIFrameEl(containerSibling).classList.contains('def'),
228
- ).toBe(true);
229
- expect(containerSibling.querySelector('div')).toBe(null);
230
- });
231
202
  });
232
203
 
233
204
  describe('SearchBarEmbed', () => {
package/src/types.ts CHANGED
@@ -145,6 +145,7 @@ export enum AuthType {
145
145
  * .then((response) => response.json())
146
146
  * .then((data) => data.token);
147
147
  * }
148
+ * });
148
149
  * ```
149
150
  */
150
151
  TrustedAuthToken = 'AuthServer',
@@ -470,7 +471,6 @@ export interface EmbedConfig {
470
471
  * @version SDK: 1.12.0 | ThoughtSpot: 8.4.0.cl, 8.4.1.sw*
471
472
  */
472
473
  suppressSearchEmbedBetaWarning?: boolean;
473
-
474
474
  /**
475
475
  * Hide `beta` alert warning message for SageEmbed.
476
476
  *
@@ -565,7 +565,7 @@ export interface EmbedConfig {
565
565
  }
566
566
 
567
567
  // eslint-disable-next-line @typescript-eslint/no-empty-interface
568
- export interface LayoutConfig {}
568
+ export interface LayoutConfig { }
569
569
 
570
570
  /**
571
571
  * Embedded iframe configuration
@@ -767,14 +767,14 @@ export interface ViewConfig {
767
767
  * Hide the home page modules
768
768
  * eg: hiddenHomepageModules = [HomepageModule.MyLibrary]
769
769
  *
770
- * @version SDK: 1.27.0 | Thoughtspot: 9.8.0.cl
770
+ * @version SDK: 1.27.0 | Thoughtspot: 9.12.0.cl
771
771
  */
772
772
  hiddenHomepageModules?: HomepageModule[];
773
773
  /**
774
774
  * reordering the home page modules
775
775
  * eg: reorderedHomepageModules = [HomepageModule.MyLibrary, HomepageModule.Watchlist]
776
776
  *
777
- * @version SDK: 1.28.0 | Thoughtspot: 9.9.0.cl
777
+ * @version SDK: 1.28.0 | Thoughtspot: 9.12.0.cl
778
778
  */
779
779
  reorderedHomepageModules?: HomepageModule[];
780
780
  /**
@@ -801,7 +801,7 @@ export interface ViewConfig {
801
801
  * hiddenHomeLeftNavItems = [HomeLeftNavItem.Home]
802
802
  * ```
803
803
  *
804
- * @version SDK: 1.27.0 | Thoughtspot: 9.10.0.cl
804
+ * @version SDK: 1.27.0 | Thoughtspot: 9.12.0.cl
805
805
  */
806
806
  hiddenHomeLeftNavItems?: HomeLeftNavItem[];
807
807
  /**
@@ -1191,7 +1191,8 @@ export enum EmbedEvent {
1191
1191
  * A custom action has been triggered.
1192
1192
  *
1193
1193
  * @returns actionId - ID of the custom action
1194
- * @returns data - Response payload with the Answer or Liveboard data
1194
+ * @returns payload {@link CustomActionPayload} - Response payload with the
1195
+ * Answer or Liveboard data
1195
1196
  * @example
1196
1197
  * ```js
1197
1198
  * appEmbed.on(EmbedEvent.customAction, payload => {
@@ -1211,7 +1212,7 @@ export enum EmbedEvent {
1211
1212
  * @example
1212
1213
  * ```js
1213
1214
  * livebaordEmbed.on(EmbedEvent.VizPointDoubleClick, payload => {
1214
- * console.log('VizPointDoubleClick', payload)
1215
+ * console.log('VizPointDoubleClick', payload);
1215
1216
  * })
1216
1217
  * ```
1217
1218
  */
@@ -1237,15 +1238,40 @@ export enum EmbedEvent {
1237
1238
  */
1238
1239
  VizPointClick = 'vizPointClick',
1239
1240
  /**
1240
- * An error has occurred.
1241
+ * An error has occurred. This event is fired for the following error types:
1242
+ *
1243
+ * `API` - API call failure error.
1244
+ *
1245
+ * `FULLSCREEN` - Error when presenting a Liveboard or visualization in full screen mode.
1246
+ *
1247
+ * `SINGLE_VALUE_FILTER` - Error due to multiple values in the single value filter.
1248
+ *
1249
+ * `NON_EXIST_FILTER` - Error due to a non-existent filter.
1241
1250
  *
1251
+ * `INVALID_DATE_VALUE` - Invalid date value error.
1252
+ *
1253
+ * `INVALID_OPERATOR` - Use of invalid operator during filter application.
1254
+ *
1255
+ * For more information, see [Developer Documentation](https://developers.thoughtspot.com/docs/events-app-integration#errorType)
1242
1256
  * @returns error - An error object or message
1243
1257
  * @example
1244
1258
  * ```js
1245
- * SearchEmbed.on(EmbedEvent.Error, showErrorMsg)
1246
- * //show error messaage
1247
- * function showErrorMsg() {
1248
- * document.getElementById("error");
1259
+ * // API error
1260
+ * SearchEmbed.on(EmbedEvent.Error, (error) => {
1261
+ * console.log(error);
1262
+ * // { type: "Error", data: { errorType: "API", error: { message: '...', error: '...' } } }
1263
+ * });
1264
+ * ```
1265
+ * @example
1266
+ * ```js
1267
+ * // Fullscreen error (Errors during presenting of a liveboard)
1268
+ * LiveboardEmbed.on(EmbedEvent.Error, (error) => {
1269
+ * console.log(error);
1270
+ * // { type: "Error", data: { errorType: "FULLSCREEN", error: {
1271
+ * // message: "Fullscreen API is not enabled",
1272
+ * // stack: "..."
1273
+ * // } }}
1274
+ * })
1249
1275
  * ```
1250
1276
  */
1251
1277
  Error = 'Error',
@@ -1955,7 +1981,7 @@ export enum EmbedEvent {
1955
1981
  /**
1956
1982
  * Emitted when a LB/viz is renamed
1957
1983
  *
1958
- * @version SDK : 1.28.0 | ThoughtSpot: 9.11.0.cl
1984
+ * @version SDK : 1.28.0 | ThoughtSpot: 9.10.5.cl
1959
1985
  */
1960
1986
  Rename = 'rename',
1961
1987
  }
@@ -2630,7 +2656,7 @@ export enum HostEvent {
2630
2656
  */
2631
2657
  ResetSearch = 'resetSearch',
2632
2658
  /**
2633
- * @hidden
2659
+ *
2634
2660
  * Get the currents visible and runtime filters applied on a Liveboard
2635
2661
  * @example
2636
2662
  * liveboardEmbed.trigger(HostEvent.GetFilters)
@@ -2638,7 +2664,7 @@ export enum HostEvent {
2638
2664
  */
2639
2665
  GetFilters = 'getFilters',
2640
2666
  /**
2641
- * @hidden
2667
+ *
2642
2668
  * Update the visible filters on the Liveboard.
2643
2669
  * @param - filter: filter object containing column name and filter operation and values
2644
2670
  * @example
@@ -3736,15 +3762,15 @@ export interface ColumnValue {
3736
3762
  [key: string]: any;
3737
3763
  };
3738
3764
  value:
3739
- | string
3740
- | number
3741
- | boolean
3742
- | {
3743
- v: {
3744
- s: number;
3745
- e: number;
3746
- };
3747
- };
3765
+ | string
3766
+ | number
3767
+ | boolean
3768
+ | {
3769
+ v: {
3770
+ s: number;
3771
+ e: number;
3772
+ };
3773
+ };
3748
3774
  }
3749
3775
 
3750
3776
  export interface VizPoint {
@@ -3752,6 +3778,9 @@ export interface VizPoint {
3752
3778
  selectedMeasures: ColumnValue[];
3753
3779
  }
3754
3780
 
3781
+ /**
3782
+ * @group Events
3783
+ */
3755
3784
  export interface CustomActionPayload {
3756
3785
  contextMenuPoints?: {
3757
3786
  clickedPoint: VizPoint;
@@ -1,11 +1,11 @@
1
1
  import {
2
- EndPoints,
3
- fetchAuthPostService,
4
- fetchAuthService,
2
+ fetchSessionInfoService,
5
3
  fetchAuthTokenService,
4
+ fetchAuthService,
6
5
  fetchBasicAuthService,
7
- fetchSessionInfoService,
6
+ fetchAuthPostService,
8
7
  verifyTokenService,
8
+ EndPoints,
9
9
  } from '.';
10
10
  import { logger } from '../logger';
11
11
 
@@ -17,7 +17,7 @@ export enum OperationType {
17
17
  GetTableWithHeadlineData = 'GetTableWithHeadlineData',
18
18
  }
19
19
 
20
- interface UnderlyingDataPoint {
20
+ export interface UnderlyingDataPoint {
21
21
  columnId: string;
22
22
  dataValue: any;
23
23
  }
@@ -41,6 +41,14 @@ interface UnderlyingDataPoint {
41
41
  * @group Events
42
42
  */
43
43
  export class AnswerService {
44
+ /**
45
+ * Should not need to be called directly.
46
+ *
47
+ * @param session
48
+ * @param answer
49
+ * @param thoughtSpotHost
50
+ * @param selectedPoints
51
+ */
44
52
  constructor(
45
53
  private session: SessionInterface,
46
54
  private answer: any,
@@ -50,6 +58,10 @@ export class AnswerService {
50
58
  this.session = removeTypename(session);
51
59
  }
52
60
 
61
+ /**
62
+ * Get the details about the source used in the answer.
63
+ * This can be used to get the list of all columns in the data source for example.
64
+ */
53
65
  public async getSourceDetail() {
54
66
  const sourceId = this.answer.sources[0].header.guid;
55
67
  return getSourceDetail(
@@ -58,6 +70,12 @@ export class AnswerService {
58
70
  );
59
71
  }
60
72
 
73
+ /**
74
+ * Remove columnIds and return updated answer session.
75
+ *
76
+ * @param columnIds
77
+ * @returns
78
+ */
61
79
  public async removeColumns(columnIds: string[]) {
62
80
  return this.executeQuery(
63
81
  queries.removeColumns,
@@ -67,6 +85,12 @@ export class AnswerService {
67
85
  );
68
86
  }
69
87
 
88
+ /**
89
+ * Add columnIds and return updated answer session.
90
+ *
91
+ * @param columnIds
92
+ * @returns
93
+ */
70
94
  public async addColumns(columnIds: string[]) {
71
95
  return this.executeQuery(
72
96
  queries.addColumns,
@@ -76,6 +100,13 @@ export class AnswerService {
76
100
  );
77
101
  }
78
102
 
103
+ /**
104
+ * Fetch data from the answer.
105
+ *
106
+ * @param offset
107
+ * @param size
108
+ * @returns
109
+ */
79
110
  public async fetchData(offset = 0, size = 1000) {
80
111
  const { answer } = await this.executeQuery(
81
112
  queries.getAnswerData,
@@ -98,6 +129,8 @@ export class AnswerService {
98
129
  }
99
130
 
100
131
  /**
132
+ * Fetch the data for the answer as a CSV blob. This might be
133
+ * quicker for larger data.
101
134
  *
102
135
  * @param userLocale
103
136
  * @param includeInfo Include the CSV header in the output
@@ -110,12 +143,22 @@ export class AnswerService {
110
143
  });
111
144
  }
112
145
 
146
+ /**
147
+ * Just get the internal URL for this answer's data
148
+ * as a CSV blob.
149
+ *
150
+ * @param userLocale
151
+ * @param includeInfo
152
+ * @returns
153
+ */
113
154
  public getFetchCSVBlobUrl(userLocale = 'en-us', includeInfo = false): string {
114
155
  return `${this.thoughtSpotHost}/prism/download/answer/csv?sessionId=${this.session.sessionId}&genNo=${this.session.genNo}&userLocale=${userLocale}&exportFileName=data&hideCsvHeader=${!includeInfo}`;
115
156
  }
116
157
 
117
158
  /**
118
159
  * Get underlying data given a point and the output column names.
160
+ * In case of a context menu action, the selectedPoints are
161
+ * automatically passed.
119
162
  *
120
163
  * @param outputColumnNames
121
164
  * @param selectedPoints
@@ -179,6 +222,13 @@ export class AnswerService {
179
222
  return unaggAnswerSession;
180
223
  }
181
224
 
225
+ /**
226
+ * Execute a custom graphql query in the context of the answer.
227
+ *
228
+ * @param query graphql query
229
+ * @param variables graphql variables
230
+ * @returns
231
+ */
182
232
  public async executeQuery(query: string, variables: any): Promise<any> {
183
233
  const data = await graphqlQuery({
184
234
  query,
@@ -194,6 +244,11 @@ export class AnswerService {
194
244
  return data;
195
245
  }
196
246
 
247
+ /**
248
+ * Get the internal session details for the answer.
249
+ *
250
+ * @returns
251
+ */
197
252
  public getSession() {
198
253
  return this.session;
199
254
  }