@thoughtspot/visual-embed-sdk 1.40.1-alpha.1 → 1.40.1-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 (99) hide show
  1. package/cjs/package.json +1 -1
  2. package/cjs/src/embed/bodyless-conversation.d.ts +1 -0
  3. package/cjs/src/embed/bodyless-conversation.d.ts.map +1 -1
  4. package/cjs/src/embed/bodyless-conversation.js +7 -3
  5. package/cjs/src/embed/bodyless-conversation.js.map +1 -1
  6. package/cjs/src/embed/conversation.d.ts +1 -0
  7. package/cjs/src/embed/conversation.d.ts.map +1 -1
  8. package/cjs/src/embed/conversation.js +7 -2
  9. package/cjs/src/embed/conversation.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 +30 -14
  13. package/cjs/src/embed/liveboard.js.map +1 -1
  14. package/cjs/src/embed/liveboard.spec.js +29 -4
  15. package/cjs/src/embed/liveboard.spec.js.map +1 -1
  16. package/cjs/src/embed/sage.d.ts +1 -0
  17. package/cjs/src/embed/sage.d.ts.map +1 -1
  18. package/cjs/src/embed/sage.js +10 -6
  19. package/cjs/src/embed/sage.js.map +1 -1
  20. package/cjs/src/embed/search-bar.d.ts +1 -0
  21. package/cjs/src/embed/search-bar.d.ts.map +1 -1
  22. package/cjs/src/embed/search-bar.js +11 -7
  23. package/cjs/src/embed/search-bar.js.map +1 -1
  24. package/cjs/src/embed/search.d.ts +1 -0
  25. package/cjs/src/embed/search.d.ts.map +1 -1
  26. package/cjs/src/embed/search.js +7 -8
  27. package/cjs/src/embed/search.js.map +1 -1
  28. package/cjs/src/embed/ts-embed.d.ts +2 -0
  29. package/cjs/src/embed/ts-embed.d.ts.map +1 -1
  30. package/cjs/src/embed/ts-embed.js +18 -17
  31. package/cjs/src/embed/ts-embed.js.map +1 -1
  32. package/dist/index-k7pkZMhx.js +7371 -0
  33. package/dist/src/embed/bodyless-conversation.d.ts +5 -0
  34. package/dist/src/embed/bodyless-conversation.d.ts.map +1 -1
  35. package/dist/src/embed/conversation.d.ts +1 -0
  36. package/dist/src/embed/conversation.d.ts.map +1 -1
  37. package/dist/src/embed/liveboard.d.ts +3 -1
  38. package/dist/src/embed/liveboard.d.ts.map +1 -1
  39. package/dist/src/embed/sage.d.ts +1 -0
  40. package/dist/src/embed/sage.d.ts.map +1 -1
  41. package/dist/src/embed/search-bar.d.ts +1 -0
  42. package/dist/src/embed/search-bar.d.ts.map +1 -1
  43. package/dist/src/embed/search.d.ts +1 -0
  44. package/dist/src/embed/search.d.ts.map +1 -1
  45. package/dist/src/embed/ts-embed.d.ts +9 -0
  46. package/dist/src/embed/ts-embed.d.ts.map +1 -1
  47. package/dist/src/react/index.d.ts +2 -0
  48. package/dist/src/react/index.d.ts.map +1 -1
  49. package/dist/src/types.d.ts +220 -7
  50. package/dist/src/types.d.ts.map +1 -1
  51. package/dist/src/utils/graphql/nlsService/conversation-service.d.ts.map +1 -1
  52. package/dist/tsembed-react.es.js +375 -60
  53. package/dist/tsembed-react.js +374 -59
  54. package/dist/tsembed.es.js +375 -60
  55. package/dist/tsembed.js +374 -59
  56. package/dist/visual-embed-sdk-react-full.d.ts +240 -8
  57. package/dist/visual-embed-sdk-react.d.ts +240 -8
  58. package/dist/visual-embed-sdk.d.ts +238 -8
  59. package/lib/package.json +1 -1
  60. package/lib/src/embed/bodyless-conversation.d.ts +1 -0
  61. package/lib/src/embed/bodyless-conversation.d.ts.map +1 -1
  62. package/lib/src/embed/bodyless-conversation.js +7 -3
  63. package/lib/src/embed/bodyless-conversation.js.map +1 -1
  64. package/lib/src/embed/conversation.d.ts +1 -0
  65. package/lib/src/embed/conversation.d.ts.map +1 -1
  66. package/lib/src/embed/conversation.js +7 -2
  67. package/lib/src/embed/conversation.js.map +1 -1
  68. package/lib/src/embed/liveboard.d.ts +1 -0
  69. package/lib/src/embed/liveboard.d.ts.map +1 -1
  70. package/lib/src/embed/liveboard.js +30 -14
  71. package/lib/src/embed/liveboard.js.map +1 -1
  72. package/lib/src/embed/liveboard.spec.js +29 -4
  73. package/lib/src/embed/liveboard.spec.js.map +1 -1
  74. package/lib/src/embed/sage.d.ts +1 -0
  75. package/lib/src/embed/sage.d.ts.map +1 -1
  76. package/lib/src/embed/sage.js +10 -6
  77. package/lib/src/embed/sage.js.map +1 -1
  78. package/lib/src/embed/search-bar.d.ts +1 -0
  79. package/lib/src/embed/search-bar.d.ts.map +1 -1
  80. package/lib/src/embed/search-bar.js +11 -7
  81. package/lib/src/embed/search-bar.js.map +1 -1
  82. package/lib/src/embed/search.d.ts +1 -0
  83. package/lib/src/embed/search.d.ts.map +1 -1
  84. package/lib/src/embed/search.js +7 -8
  85. package/lib/src/embed/search.js.map +1 -1
  86. package/lib/src/embed/ts-embed.d.ts +2 -0
  87. package/lib/src/embed/ts-embed.d.ts.map +1 -1
  88. package/lib/src/embed/ts-embed.js +18 -17
  89. package/lib/src/embed/ts-embed.js.map +1 -1
  90. package/lib/src/visual-embed-sdk.d.ts +238 -8
  91. package/package.json +2 -1
  92. package/src/embed/bodyless-conversation.ts +9 -3
  93. package/src/embed/conversation.ts +13 -2
  94. package/src/embed/liveboard.spec.ts +32 -4
  95. package/src/embed/liveboard.ts +36 -16
  96. package/src/embed/sage.ts +11 -6
  97. package/src/embed/search-bar.tsx +14 -7
  98. package/src/embed/search.ts +18 -7
  99. package/src/embed/ts-embed.ts +21 -18
@@ -408,6 +408,12 @@ export class LiveboardEmbed extends V1Embed {
408
408
  * embedded Liveboard or visualization.
409
409
  */
410
410
  protected getEmbedParams() {
411
+ const params = this.getEmbedParamsObject();
412
+ const queryParams = getQueryParamString(params, true);
413
+ return queryParams;
414
+ }
415
+
416
+ protected getEmbedParamsObject() {
411
417
  let params: any = {};
412
418
  params = this.getBaseQueryParams(params);
413
419
  const {
@@ -511,9 +517,33 @@ export class LiveboardEmbed extends V1Embed {
511
517
  params[Param.DataPanelV2Enabled] = dataPanelV2;
512
518
  params[Param.EnableCustomColumnGroups] = enableCustomColumnGroups;
513
519
  params[Param.CoverAndFilterOptionInPDF] = coverAndFilterOptionInPDF;
514
- const queryParams = getQueryParamString(params, true);
515
520
 
516
- return queryParams;
521
+ if (oAuthPollingInterval !== undefined) {
522
+ params[Param.OauthPollingInterval] = oAuthPollingInterval;
523
+ }
524
+
525
+ if (isForceRedirect) {
526
+ params[Param.IsForceRedirect] = isForceRedirect;
527
+ }
528
+
529
+ if (dataSourceId !== undefined) {
530
+ params[Param.DataSourceId] = dataSourceId;
531
+ }
532
+
533
+
534
+ if (isLiveboardStylingAndGroupingEnabled !== undefined) {
535
+ params[Param.IsLiveboardStylingAndGroupingEnabled] = isLiveboardStylingAndGroupingEnabled;
536
+ }
537
+
538
+ params[Param.LiveboardHeaderSticky] = isLiveboardHeaderSticky;
539
+ params[Param.LiveboardHeaderV2] = isLiveboardCompactHeaderEnabled;
540
+ params[Param.ShowLiveboardVerifiedBadge] = showLiveboardVerifiedBadge;
541
+ params[Param.ShowLiveboardReverifyBanner] = showLiveboardReverifyBanner;
542
+ params[Param.HideIrrelevantFiltersInTab] = hideIrrelevantChipsInLiveboardTabs;
543
+ params[Param.DataPanelV2Enabled] = dataPanelV2;
544
+ params[Param.EnableCustomColumnGroups] = enableCustomColumnGroups;
545
+ params[Param.CoverAndFilterOptionInPDF] = coverAndFilterOptionInPDF;
546
+ return params;
517
547
  }
518
548
 
519
549
  private getIframeSuffixSrc(liveboardId: string, vizId: string, activeTabId: string) {
@@ -647,19 +677,10 @@ export class LiveboardEmbed extends V1Embed {
647
677
  protected beforePrerenderVisible(): void {
648
678
  const embedObj = this.getPreRenderObj<LiveboardEmbed>();
649
679
 
650
- if (isUndefined(embedObj)) return;
651
-
652
- const showDifferentLib = this.currentLiveboardId
653
- && embedObj.currentLiveboardId !== this.currentLiveboardId;
654
-
655
- if (showDifferentLib) {
656
- console.log('showDifferentLib', this.currentLiveboardId);
657
- const libId = this.currentLiveboardId;
658
- this.navigateToLiveboard(libId, null, null, () => {
659
- console.log('onNavigateCalled', libId);
660
- embedObj.currentLiveboardId = libId;
661
- });
662
- }
680
+ const libId = this.currentLiveboardId;
681
+ this.navigateToLiveboard(libId, this.viewConfig.vizId, this.viewConfig.activeTabId, () => {
682
+ if (embedObj) embedObj.currentLiveboardId = libId;
683
+ });
663
684
  }
664
685
 
665
686
  protected async handleRenderForPrerender(): Promise<TsEmbed> {
@@ -741,7 +762,6 @@ export class LiveboardEmbed extends V1Embed {
741
762
  this.viewConfig.activeTabId = activeTabId;
742
763
  this.viewConfig.vizId = vizId;
743
764
  if (this.isRendered) {
744
- console.log('navigating to liveboard', path.substring(1));
745
765
  this.triggerAfterLoad(HostEvent.Navigate, path.substring(1), onNavigateCalled);
746
766
  } else if (this.viewConfig.preRenderId) {
747
767
  this.preRender(true);
package/src/embed/sage.ts CHANGED
@@ -153,12 +153,7 @@ export class SageEmbed extends V1Embed {
153
153
  super(domSelector, viewConfig);
154
154
  }
155
155
 
156
- /**
157
- * Constructs a map of parameters to be passed on to the
158
- * embedded Eureka or Sage search page.
159
- * @returns {string} query string
160
- */
161
- protected getEmbedParams(): string {
156
+ protected getEmbedParamsObject() {
162
157
  const {
163
158
  disableWorksheetChange,
164
159
  hideWorksheetSelector,
@@ -184,6 +179,16 @@ export class SageEmbed extends V1Embed {
184
179
  params[Param.IsProductTour] = !!isProductTour;
185
180
  params[Param.HideSageAnswerHeader] = !!hideSageAnswerHeader;
186
181
 
182
+ return params;
183
+ }
184
+
185
+ /**
186
+ * Constructs a map of parameters to be passed on to the
187
+ * embedded Eureka or Sage search page.
188
+ * @returns {string} query string
189
+ */
190
+ protected getEmbedParams(): string {
191
+ const params = this.getEmbedParamsObject();
187
192
  return getQueryParamString(params, true);
188
193
  }
189
194
 
@@ -118,12 +118,7 @@ export class SearchBarEmbed extends TsEmbed {
118
118
  this.viewConfig = viewConfig;
119
119
  }
120
120
 
121
- /**
122
- * Construct the URL of the embedded ThoughtSpot search to be
123
- * loaded in the iframe
124
- * @param dataSources A list of data source GUIDs
125
- */
126
- private getIFrameSrc() {
121
+ protected getEmbedParamsObject() {
127
122
  const {
128
123
  searchOptions,
129
124
  dataSource,
@@ -131,7 +126,6 @@ export class SearchBarEmbed extends TsEmbed {
131
126
  useLastSelectedSources = false,
132
127
  excludeSearchTokenStringFromURL,
133
128
  } = this.viewConfig;
134
- const path = 'search-bar-embed';
135
129
  const queryParams = this.getBaseQueryParams();
136
130
 
137
131
  queryParams[Param.HideActions] = [...(queryParams[Param.HideActions] ?? [])];
@@ -159,6 +153,19 @@ export class SearchBarEmbed extends TsEmbed {
159
153
  queryParams[Param.UseLastSelectedDataSource] = false;
160
154
  }
161
155
  queryParams[Param.searchEmbed] = true;
156
+
157
+ return queryParams;
158
+ }
159
+
160
+ /**
161
+ * Construct the URL of the embedded ThoughtSpot search to be
162
+ * loaded in the iframe
163
+ * @param dataSources A list of data source GUIDs
164
+ */
165
+ private getIFrameSrc() {
166
+ const queryParams = this.getEmbedParamsObject();
167
+ const path = 'search-bar-embed';
168
+
162
169
  let query = '';
163
170
  const queryParamsString = getQueryParamString(queryParams, true);
164
171
  if (queryParamsString) {
@@ -331,7 +331,7 @@ export const HiddenActionItemByDefaultForSearchEmbed = [
331
331
  ];
332
332
 
333
333
  export interface SearchAppInitData extends DefaultAppInitData {
334
- searchOptions?: SearchOptions;
334
+ searchOptions?: SearchOptions;
335
335
  }
336
336
 
337
337
  /**
@@ -381,7 +381,7 @@ export class SearchEmbed extends TsEmbed {
381
381
  return { ...defaultAppInitData, ...this.getSearchInitData() };
382
382
  }
383
383
 
384
- protected getEmbedParams(): string {
384
+ protected getEmbedParamsObject() {
385
385
  const {
386
386
  hideResults,
387
387
  enableSearchAssist,
@@ -398,7 +398,7 @@ export class SearchEmbed extends TsEmbed {
398
398
  collapseSearchBarInitially = false,
399
399
  enableCustomColumnGroups = false,
400
400
  isOnBeforeGetVizDataInterceptEnabled = false,
401
- /* eslint-disable-next-line max-len */
401
+
402
402
  dataPanelCustomGroupsAccordionInitialState = DataPanelCustomColumnGroupsAccordionState.EXPAND_ALL,
403
403
  focusSearchBarOnRender = true,
404
404
  excludeRuntimeParametersfromURL,
@@ -443,7 +443,7 @@ export class SearchEmbed extends TsEmbed {
443
443
  }
444
444
 
445
445
  if (isOnBeforeGetVizDataInterceptEnabled) {
446
- /* eslint-disable-next-line max-len */
446
+
447
447
  queryParams[Param.IsOnBeforeGetVizDataInterceptEnabled] = isOnBeforeGetVizDataInterceptEnabled;
448
448
  }
449
449
 
@@ -460,7 +460,7 @@ export class SearchEmbed extends TsEmbed {
460
460
  }
461
461
 
462
462
  queryParams[Param.searchEmbed] = true;
463
- /* eslint-disable-next-line max-len */
463
+
464
464
  queryParams[Param.CollapseSearchBarInitially] = collapseSearchBarInitially || collapseSearchBar;
465
465
  queryParams[Param.EnableCustomColumnGroups] = enableCustomColumnGroups;
466
466
  if (dataPanelCustomGroupsAccordionInitialState
@@ -468,12 +468,23 @@ export class SearchEmbed extends TsEmbed {
468
468
  || dataPanelCustomGroupsAccordionInitialState
469
469
  === DataPanelCustomColumnGroupsAccordionState.EXPAND_FIRST
470
470
  ) {
471
- /* eslint-disable-next-line max-len */
471
+
472
472
  queryParams[Param.DataPanelCustomGroupsAccordionInitialState] = dataPanelCustomGroupsAccordionInitialState;
473
473
  } else {
474
- /* eslint-disable-next-line max-len */
474
+
475
475
  queryParams[Param.DataPanelCustomGroupsAccordionInitialState] = DataPanelCustomColumnGroupsAccordionState.EXPAND_ALL;
476
476
  }
477
+ return queryParams;
478
+ }
479
+
480
+ protected getEmbedParams() {
481
+ const {
482
+ runtimeParameters,
483
+ runtimeFilters,
484
+ excludeRuntimeParametersfromURL,
485
+ excludeRuntimeFiltersfromURL,
486
+ } = this.viewConfig;
487
+ const queryParams = this.getEmbedParamsObject();
477
488
  let query = '';
478
489
  const queryParamsString = getQueryParamString(queryParams, true);
479
490
  if (queryParamsString) {
@@ -203,9 +203,10 @@ export class TsEmbed {
203
203
  });
204
204
  this.hostEventClient = new HostEventClient(this.iFrame);
205
205
 
206
+ const embedConfig = getEmbedConfig();
207
+ this.embedConfig = embedConfig;
206
208
  this.isReadyForRenderPromise = getInitPromise().then(async () => {
207
- const embedConfig = getEmbedConfig();
208
- this.embedConfig = embedConfig;
209
+
209
210
  if (!embedConfig.authTriggerContainer && !embedConfig.useEventForSAMLPopup) {
210
211
  this.embedConfig.authTriggerContainer = domSelector;
211
212
  }
@@ -482,13 +483,12 @@ export class TsEmbed {
482
483
 
483
484
  private pendingEvents: Array<{ eventType: HostEvent, data: TriggerPayload<any, HostEvent>, onEventTriggered?: () => void }> = [];
484
485
 
485
- protected getPreRenderObj<T extends TsEmbed>() {
486
+ protected getPreRenderObj<T extends TsEmbed>(): T {
486
487
  const embedObj = (this.insertedDomEl as any)?.[this.embedNodeKey] as T;
487
488
  if (embedObj === (this as any)) {
488
- console.log('embedObj is same as this');
489
- return null;
489
+ logger.info('embedObj is same as this');
490
490
  }
491
- return (this.insertedDomEl as any)?.[this.embedNodeKey] as T;
491
+ return embedObj;
492
492
  }
493
493
 
494
494
  private checkEmbedContainerLoaded() {
@@ -499,16 +499,13 @@ export class TsEmbed {
499
499
  this.isEmbedContainerLoaded = true;
500
500
  }
501
501
 
502
- console.log('checkEmbedContainerLoaded', this.isEmbedContainerLoaded);
503
-
504
502
  return this.isEmbedContainerLoaded;
505
503
  }
506
504
 
507
505
  private executePendingEvents() {
508
- console.log('executePendingEvents', this.pendingEvents);
506
+ logger.debug('executePendingEvents', this.pendingEvents);
509
507
  setTimeout(() => {
510
508
  this.pendingEvents.forEach((event) => {
511
- console.log('executing event', event.eventType, event.data);
512
509
  this.trigger(event.eventType, event.data);
513
510
  event.onEventTriggered?.();
514
511
  });
@@ -517,13 +514,10 @@ export class TsEmbed {
517
514
  }
518
515
  protected triggerAfterLoad(eventType: HostEvent, data: TriggerPayload<any, HostEvent>, onEventTriggered?: () => void) {
519
516
  if (this.checkEmbedContainerLoaded()) {
520
- console.log('triggerAfterLoad', eventType, data);
521
517
  this.trigger(eventType, data);
522
518
  onEventTriggered?.();
523
519
  } else {
524
- console.log('pushing to pendingEvents', eventType, data, this.getPreRenderObj());
525
520
  this.pendingEvents.push({ eventType, data, onEventTriggered });
526
- console.log('pendingEvents', this.pendingEvents);
527
521
  }
528
522
  }
529
523
 
@@ -533,10 +527,7 @@ export class TsEmbed {
533
527
  private registerAppInit = () => {
534
528
  this.on(EmbedEvent.APP_INIT, this.appInitCb, { start: false }, true);
535
529
  this.on(EmbedEvent.AuthInit, () => {
536
- console.log('AuthInit', this.getPreRenderObj());
537
530
  this.isEmbedContainerLoaded = true;
538
- console.log('isEmbedContainerLoaded', this.isEmbedContainerLoaded);
539
- console.log('executePendingEvents', this.pendingEvents);
540
531
  this.executePendingEvents();
541
532
  }, { start: false }, true);
542
533
  this.on(EmbedEvent.AuthExpire, this.updateAuthToken, { start: false }, true);
@@ -561,6 +552,12 @@ export class TsEmbed {
561
552
  return `${basePath}#`;
562
553
  }
563
554
 
555
+ protected getUpdateEmbedParamsObject() {
556
+ let queryParams = this.getEmbedParamsObject();
557
+ queryParams = { ...this.viewConfig, ...queryParams };
558
+ return queryParams;
559
+ }
560
+
564
561
  /**
565
562
  * Common query params set for all the embed modes.
566
563
  * @param queryParams
@@ -743,10 +740,15 @@ export class TsEmbed {
743
740
  }
744
741
 
745
742
  protected getEmbedParams() {
746
- const queryParams = this.getBaseQueryParams();
743
+ const queryParams = this.getEmbedParamsObject();
747
744
  return getQueryParamString(queryParams);
748
745
  }
749
746
 
747
+ protected getEmbedParamsObject() {
748
+ const params = this.getBaseQueryParams();
749
+ return params;
750
+ }
751
+
750
752
  protected getRootIframeSrc() {
751
753
  const query = this.getEmbedParams();
752
754
  return this.getEmbedBasePath(query);
@@ -1379,7 +1381,8 @@ export class TsEmbed {
1379
1381
  return this.preRender(true);
1380
1382
  }
1381
1383
  this.validatePreRenderViewConfig(this.viewConfig);
1382
- this.trigger(HostEvent.UpdateEmbedParams, this.viewConfig);
1384
+ logger.debug('triggering UpdateEmbedParams', this.viewConfig);
1385
+ this.triggerAfterLoad(HostEvent.UpdateEmbedParams, this.getUpdateEmbedParamsObject());
1383
1386
  }
1384
1387
 
1385
1388
  this.beforePrerenderVisible();