@thoughtspot/visual-embed-sdk 1.36.9 → 1.37.0-temp-nav

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 (115) hide show
  1. package/cjs/package.json +1 -1
  2. package/cjs/src/auth.d.ts +2 -1
  3. package/cjs/src/auth.d.ts.map +1 -1
  4. package/cjs/src/auth.js +1 -0
  5. package/cjs/src/auth.js.map +1 -1
  6. package/cjs/src/embed/app.d.ts +76 -0
  7. package/cjs/src/embed/app.d.ts.map +1 -1
  8. package/cjs/src/embed/app.js +18 -1
  9. package/cjs/src/embed/app.js.map +1 -1
  10. package/cjs/src/embed/app.spec.js +50 -0
  11. package/cjs/src/embed/app.spec.js.map +1 -1
  12. package/cjs/src/embed/liveboard.d.ts +2 -2
  13. package/cjs/src/embed/ts-embed.d.ts.map +1 -1
  14. package/cjs/src/embed/ts-embed.js +4 -1
  15. package/cjs/src/embed/ts-embed.js.map +1 -1
  16. package/cjs/src/index.d.ts.map +1 -1
  17. package/cjs/src/index.js +1 -0
  18. package/cjs/src/index.js.map +1 -1
  19. package/cjs/src/pages/embed-test.page.d.ts +8 -0
  20. package/cjs/src/pages/embed-test.page.d.ts.map +1 -0
  21. package/cjs/src/pages/embed-test.page.js +20 -0
  22. package/cjs/src/pages/embed-test.page.js.map +1 -0
  23. package/cjs/src/pages/home.page.d.ts +6 -0
  24. package/cjs/src/pages/home.page.d.ts.map +1 -0
  25. package/cjs/src/pages/home.page.js +12 -0
  26. package/cjs/src/pages/home.page.js.map +1 -0
  27. package/cjs/src/pages/login.page.d.ts +15 -0
  28. package/cjs/src/pages/login.page.d.ts.map +1 -0
  29. package/cjs/src/pages/login.page.js +22 -0
  30. package/cjs/src/pages/login.page.js.map +1 -0
  31. package/cjs/src/react/index.d.ts.map +1 -1
  32. package/cjs/src/react/index.js +1 -0
  33. package/cjs/src/react/index.js.map +1 -1
  34. package/cjs/src/tests/auth.test.d.ts +1 -0
  35. package/cjs/src/tests/auth.test.d.ts.map +1 -0
  36. package/cjs/src/tests/auth.test.js +1 -0
  37. package/cjs/src/tests/auth.test.js.map +1 -0
  38. package/cjs/src/tests/e2e/auth.spec.d.ts +2 -0
  39. package/cjs/src/tests/e2e/auth.spec.d.ts.map +1 -0
  40. package/cjs/src/tests/e2e/auth.spec.js +54 -0
  41. package/cjs/src/tests/e2e/auth.spec.js.map +1 -0
  42. package/cjs/src/types.d.ts +56 -13
  43. package/cjs/src/types.d.ts.map +1 -1
  44. package/cjs/src/types.js +39 -9
  45. package/cjs/src/types.js.map +1 -1
  46. package/cjs/src/utils/graphql/answerService/answerService.d.ts +35 -15
  47. package/cjs/src/utils/graphql/answerService/answerService.d.ts.map +1 -1
  48. package/cjs/src/utils/graphql/answerService/answerService.js +35 -15
  49. package/cjs/src/utils/graphql/answerService/answerService.js.map +1 -1
  50. package/cjs/src/utils/processData.js +6 -4
  51. package/cjs/src/utils/processData.js.map +1 -1
  52. package/dist/index-Cj4BVGHL.js +7371 -0
  53. package/dist/{index-Dg18PU5Z.js → index-Fhk1V_Gw.js} +1 -0
  54. package/dist/src/auth.d.ts +2 -1
  55. package/dist/src/auth.d.ts.map +1 -1
  56. package/dist/src/embed/app.d.ts +76 -0
  57. package/dist/src/embed/app.d.ts.map +1 -1
  58. package/dist/src/embed/liveboard.d.ts +2 -2
  59. package/dist/src/embed/ts-embed.d.ts.map +1 -1
  60. package/dist/src/index.d.ts.map +1 -1
  61. package/dist/src/react/index.d.ts.map +1 -1
  62. package/dist/src/types.d.ts +56 -13
  63. package/dist/src/types.d.ts.map +1 -1
  64. package/dist/src/utils/graphql/answerService/answerService.d.ts +35 -15
  65. package/dist/src/utils/graphql/answerService/answerService.d.ts.map +1 -1
  66. package/dist/tsembed-react.es.js +107 -33
  67. package/dist/tsembed-react.js +106 -32
  68. package/dist/tsembed.es.js +107 -33
  69. package/dist/tsembed.js +106 -32
  70. package/dist/visual-embed-sdk-react-full.d.ts +171 -31
  71. package/dist/visual-embed-sdk-react.d.ts +171 -31
  72. package/dist/visual-embed-sdk.d.ts +171 -31
  73. package/lib/package.json +1 -1
  74. package/lib/src/auth.d.ts +2 -1
  75. package/lib/src/auth.d.ts.map +1 -1
  76. package/lib/src/auth.js +1 -0
  77. package/lib/src/auth.js.map +1 -1
  78. package/lib/src/embed/app.d.ts +76 -0
  79. package/lib/src/embed/app.d.ts.map +1 -1
  80. package/lib/src/embed/app.js +18 -1
  81. package/lib/src/embed/app.js.map +1 -1
  82. package/lib/src/embed/app.spec.js +50 -0
  83. package/lib/src/embed/app.spec.js.map +1 -1
  84. package/lib/src/embed/liveboard.d.ts +2 -2
  85. package/lib/src/embed/ts-embed.d.ts.map +1 -1
  86. package/lib/src/embed/ts-embed.js +4 -1
  87. package/lib/src/embed/ts-embed.js.map +1 -1
  88. package/lib/src/index.d.ts.map +1 -1
  89. package/lib/src/index.js +1 -0
  90. package/lib/src/index.js.map +1 -1
  91. package/lib/src/react/index.d.ts.map +1 -1
  92. package/lib/src/react/index.js +1 -0
  93. package/lib/src/react/index.js.map +1 -1
  94. package/lib/src/types.d.ts +56 -13
  95. package/lib/src/types.d.ts.map +1 -1
  96. package/lib/src/types.js +39 -9
  97. package/lib/src/types.js.map +1 -1
  98. package/lib/src/utils/graphql/answerService/answerService.d.ts +35 -15
  99. package/lib/src/utils/graphql/answerService/answerService.d.ts.map +1 -1
  100. package/lib/src/utils/graphql/answerService/answerService.js +35 -15
  101. package/lib/src/utils/graphql/answerService/answerService.js.map +1 -1
  102. package/lib/src/utils/processData.js +6 -4
  103. package/lib/src/utils/processData.js.map +1 -1
  104. package/lib/src/visual-embed-sdk.d.ts +171 -31
  105. package/package.json +1 -1
  106. package/src/auth.ts +2 -1
  107. package/src/embed/app.spec.ts +70 -0
  108. package/src/embed/app.ts +104 -0
  109. package/src/embed/liveboard.ts +2 -2
  110. package/src/embed/ts-embed.ts +4 -0
  111. package/src/index.ts +2 -0
  112. package/src/react/index.tsx +2 -0
  113. package/src/types.ts +55 -12
  114. package/src/utils/graphql/answerService/answerService.ts +35 -15
  115. package/src/utils/processData.ts +6 -6
package/src/types.ts CHANGED
@@ -204,7 +204,19 @@ export enum HomeLeftNavItem {
204
204
  /**
205
205
  * @version SDK: 1.34.0| ThoughtSpot: 10.3.0.cl
206
206
  */
207
- LiveboardSchedules = 'liveboard-schedules'
207
+ LiveboardSchedules = 'liveboard-schedules',
208
+ /**
209
+ * Create new options in the insights left navigation,
210
+ * available when new navigation V3 is enabled.
211
+ * @version SDK: 1.39.0 | ThoughtSpot: 10.10.0.cl
212
+ */
213
+ Create = 'create',
214
+ /**
215
+ * Spotter option in the insights left navigation,
216
+ * available when new navigation V3 is enabled.
217
+ * @version SDK: 1.39.0 | ThoughtSpot: 10.10.0.cl
218
+ */
219
+ Spotter = 'spotter',
208
220
  }
209
221
  export type DOMSelector = string | HTMLElement;
210
222
 
@@ -712,6 +724,19 @@ export interface ViewConfig {
712
724
  * ```
713
725
  */
714
726
  disabledActions?: Action[];
727
+ /**
728
+ * The primary action to display on top of the viz for Liveboard and App Embed.
729
+ * Use this to set the primary action.
730
+ * @version SDK: 1.37.0 | ThoughtSpot: 10.9.0.cl
731
+ * @example
732
+ * ```js
733
+ * const embed = new LiveboardEmbed('#embed', {
734
+ * ... // other liveboard view config
735
+ * primaryAction: Action.Download
736
+ * });
737
+ * ```
738
+ */
739
+ primaryAction?: Action | string;
715
740
  /**
716
741
  * The tooltip to display for disabled actions.
717
742
  * @version SDK: 1.6.0 | ThoughtSpot: ts8.nov.cl, 8.4.1.sw
@@ -1138,8 +1163,8 @@ export interface ViewConfig {
1138
1163
  * Hide list page columns
1139
1164
  * For example: hiddenListColumns = [ListPageColumns.Author]
1140
1165
  *
1141
- * **Note**: This option is appplicable only in full app embedding.
1142
- * @version SDK: 1.38.0 | ThoughtSpot: 9.12.5.cl, 10.1.0.sw
1166
+ * **Note**: This option is available only in full app embedding.
1167
+ * @version SDK: 1.38.0 | ThoughtSpot: 10.9.0.cl
1143
1168
  * @example
1144
1169
  * ```js
1145
1170
  * const embed = new AppEmbed('#tsEmbed', {
@@ -1311,8 +1336,8 @@ export enum HomepageModule {
1311
1336
 
1312
1337
  /**
1313
1338
  * List page columns that can be hidden.
1314
- * **Note**: This option is applicable only in full app embedding.
1315
- * @version SDK: 1.38.0 | ThoughtSpot: 9.12.5.cl, 10.1.0.sw
1339
+ * **Note**: This option is applicable to full app embedding only.
1340
+ * @version SDK: 1.38.0 | ThoughtSpot: 10.9.0.cl
1316
1341
  */
1317
1342
  // eslint-disable-next-line no-shadow
1318
1343
  export enum ListPageColumns {
@@ -2401,7 +2426,7 @@ export enum EmbedEvent {
2401
2426
  * searchEmbed.trigger(HostEvent.TransformTableVizData, columnDataLite);
2402
2427
  * })
2403
2428
  * ```
2404
- * @version SDK: 1.38.0 | ThoughtSpot: 10.8.0.cl
2429
+ * @version SDK: 1.37.0 | ThoughtSpot: 10.8.0.cl
2405
2430
  */
2406
2431
  TableVizRendered = 'TableVizRendered',
2407
2432
  /**
@@ -2414,12 +2439,12 @@ export enum EmbedEvent {
2414
2439
  * console.log('payload', payload);
2415
2440
  * })
2416
2441
  *```
2417
- * @version SDK : 1.38.0 | ThoughtSpot : 10.8.0.cl
2442
+ * @version SDK : 1.37.0 | ThoughtSpot : 10.8.0.cl
2418
2443
  */
2419
2444
  CreateLiveboard = 'createLiveboard',
2420
2445
  /**
2421
2446
  * Emitted when a user creates a Model.
2422
- * @version SDK : 1.38.0 | ThoughtSpot : 10.8.0.cl
2447
+ * @version SDK : 1.37.0 | ThoughtSpot : 10.8.0.cl
2423
2448
  */
2424
2449
  CreateModel = 'createModel',
2425
2450
  }
@@ -2863,7 +2888,7 @@ export enum HostEvent {
2863
2888
  * ```js
2864
2889
  * liveboardEmbed.trigger(HostEvent.Remove)
2865
2890
  * ```
2866
- * @version SDK: 1.38.0 | ThoughtSpot: 10.8.0.cl, 10.10.0.sw
2891
+ * @version SDK: 1.37.0 | ThoughtSpot: 10.8.0.cl, 10.10.0.sw
2867
2892
  */
2868
2893
  Remove = 'delete',
2869
2894
  /**
@@ -3324,8 +3349,17 @@ export enum HostEvent {
3324
3349
  /**
3325
3350
  * Get the Answer session for a Search or
3326
3351
  * Liveboard visualization.
3352
+ *
3353
+ * Note: This event is not typically used directly. Instead, use the
3354
+ * `getAnswerService()` method on the embed instance to get an AnswerService
3355
+ * object that provides a more convenient interface for working with answers.
3356
+ *
3327
3357
  * @example
3328
3358
  * ```js
3359
+ * // Preferred way to get an AnswerService
3360
+ * const service = await embed.getAnswerService();
3361
+ *
3362
+ * // Alternative direct usage (not recommended)
3329
3363
  * const {session} = await embed.trigger(
3330
3364
  * HostEvent.GetAnswerSession, {
3331
3365
  * vizId: '123', // For Liveboard Visualization.
@@ -3333,6 +3367,10 @@ export enum HostEvent {
3333
3367
  * ```
3334
3368
  * @example
3335
3369
  * ```js
3370
+ * // Preferred way to get an AnswerService
3371
+ * const service = await embed.getAnswerService();
3372
+ *
3373
+ * // Alternative direct usage (not recommended)
3336
3374
  * const {session} = await embed.trigger( HostEvent.GetAnswerSession )
3337
3375
  * ```
3338
3376
  * @version SDK: 1.26.0 | ThoughtSpot: 9.10.0.cl, 10.1.0.sw
@@ -3458,7 +3496,7 @@ export enum HostEvent {
3458
3496
  * searchEmbed.trigger(HostEvent.TransformTableVizData, columnDataLite);
3459
3497
  * })
3460
3498
  * ```
3461
- * @version SDK: 1.38.0 | ThoughtSpot: 10.8.0.cl
3499
+ * @version SDK: 1.37.0 | ThoughtSpot: 10.8.0.cl
3462
3500
  */
3463
3501
  TransformTableVizData = 'TransformTableVizData',
3464
3502
  }
@@ -3541,6 +3579,10 @@ export enum Param {
3541
3579
  ShowInsertToSlide = 'insertInToSlide',
3542
3580
  PrimaryNavHidden = 'primaryNavHidden',
3543
3581
  HideProfleAndHelp = 'profileAndHelpInNavBarHidden',
3582
+ NavigationVersion = 'navigationVersion',
3583
+ HideHamburger = 'hideHamburger',
3584
+ HideObjectSearch = 'hideObjectSearch',
3585
+ HideNotification = 'hideNotification',
3544
3586
  HideApplicationSwitcher = 'applicationSwitcherHidden',
3545
3587
  HideOrgSwitcher = 'orgSwitcherHidden',
3546
3588
  IsSageEmbed = 'isSageEmbed',
@@ -3597,6 +3639,7 @@ export enum Param {
3597
3639
  preAuthCache = 'preAuthCache',
3598
3640
  ShowSpotterLimitations = 'showSpotterLimitations',
3599
3641
  CoverAndFilterOptionInPDF = 'coverAndFilterOptionInPDF',
3642
+ PrimaryAction = 'primaryAction',
3600
3643
  }
3601
3644
 
3602
3645
  /**
@@ -4822,7 +4865,7 @@ export enum Action {
4822
4865
  * ```js
4823
4866
  * hiddenAction: [Action.ColumnRename]
4824
4867
  * ```
4825
- * @version SDK: 1.38.0 | ThoughtSpot Cloud: 10.8.0.cl
4868
+ * @version SDK: 1.37.0 | ThoughtSpot Cloud: 10.8.0.cl
4826
4869
  */
4827
4870
  ColumnRename = 'columnRename',
4828
4871
  /**
@@ -4832,7 +4875,7 @@ export enum Action {
4832
4875
  * ```js
4833
4876
  * hiddenAction: [Action.CoverAndFilterOptionInPDF]
4834
4877
  * ```
4835
- * @version SDK: 1.38.0 | ThoughtSpot Cloud: 10.8.0.cl
4878
+ * @version SDK: 1.37.0 | ThoughtSpot Cloud: 10.8.0.cl
4836
4879
  */
4837
4880
  CoverAndFilterOptionInPDF = 'coverAndFilterOptionInPDF',
4838
4881
  }
@@ -26,29 +26,49 @@ export interface UnderlyingDataPoint {
26
26
  }
27
27
 
28
28
  /**
29
- * Class representing the answer service provided with the
30
- * custom action payload. This service could be used to run
31
- * graphql queries in the context of the answer on which the
32
- * custom action was triggered.
29
+ * AnswerService provides a simple way to work with ThoughtSpot Answers.
30
+ *
31
+ * This service allows you to interact with ThoughtSpot Answers programmatically,
32
+ * making it easy to customize visualizations, filter data, and extract insights
33
+ * directly from your application.
34
+ *
35
+ * You can use this service to:
36
+ * - Add or remove columns from Answers (`addColumns`, `removeColumns`, `addColumnsByName`)
37
+ * - Apply filters to Answers (`addFilter`)
38
+ * - Get data from Answers in different formats (JSON, CSV, PNG) (`fetchData`, `fetchCSVBlob`, `fetchPNGBlob`)
39
+ * - Get data for specific points in visualizations (`getUnderlyingDataForPoint`)
40
+ * - Run custom queries (`executeQuery`)
41
+ * - Add visualizations to liveboards (`addDisplayedVizToLiveboard`)
42
+ *
33
43
  * @example
34
44
  * ```js
35
- * embed.on(EmbedEvent.CustomAction, e => {
36
- * const underlying = await e.answerService.getUnderlyingDataForPoint([
37
- * 'col name 1'
38
- * ]);
39
- * const data = await underlying.fetchData(0, 100);
40
- * })
45
+ * // Get the answer service
46
+ * embed.on(EmbedEvent.Data, async (e) => {
47
+ * const service = await embed.getAnswerService();
48
+ *
49
+ * // Add columns to the answer
50
+ * await service.addColumnsByName(["Sales", "Region"]);
51
+ *
52
+ * // Get the data
53
+ * const data = await service.fetchData();
54
+ * console.log(data);
55
+ * });
41
56
  * ```
57
+ *
42
58
  * @example
43
59
  * ```js
44
- * embed.on(EmbedEvent.Data, async (e) => {
45
- * const service = await embed.getAnswerService();
46
- * await service.addColumns([
47
- * "<column guid>"
60
+ * // Get data for a point in a visualization
61
+ * embed.on(EmbedEvent.CustomAction, async (e) => {
62
+ * const underlying = await e.answerService.getUnderlyingDataForPoint([
63
+ * 'Product Name',
64
+ * 'Sales Amount'
48
65
  * ]);
49
- * console.log(await service.fetchData());
66
+ *
67
+ * const data = await underlying.fetchData(0, 100);
68
+ * console.log(data);
50
69
  * });
51
70
  * ```
71
+ *
52
72
  * @version SDK: 1.25.0| ThoughtSpot: 9.10.0.cl
53
73
  * @group Events
54
74
  */
@@ -80,15 +80,15 @@ export function processAuthFailure(e: any, containerEl: Element) {
80
80
  const {
81
81
  loginFailedMessage, authType, disableLoginFailurePage, autoLogin,
82
82
  } = getEmbedConfig();
83
- if (
84
- autoLogin
85
- && (authType === AuthType.TrustedAuthToken
86
- || authType === AuthType.TrustedAuthTokenCookieless)
87
- ) {
83
+
84
+ const isEmbeddedSSO = authType === AuthType.EmbeddedSSO;
85
+ const isTrustedAuth = authType === AuthType.TrustedAuthToken || authType === AuthType.TrustedAuthTokenCookieless;
86
+ const isEmbeddedSSOInfoFailure = isEmbeddedSSO && e?.data?.type === AuthFailureType.UNAUTHENTICATED_FAILURE;
87
+ if (autoLogin && isTrustedAuth) {
88
88
  // eslint-disable-next-line no-param-reassign
89
89
  containerEl.innerHTML = loginFailedMessage;
90
90
  notifyAuthFailure(AuthFailureType.IDLE_SESSION_TIMEOUT);
91
- } else if (authType !== AuthType.None && !disableLoginFailurePage) {
91
+ } else if (authType !== AuthType.None && !disableLoginFailurePage && !isEmbeddedSSOInfoFailure) {
92
92
  // eslint-disable-next-line no-param-reassign
93
93
  containerEl.innerHTML = loginFailedMessage;
94
94
  notifyAuthFailure(AuthFailureType.OTHER);