@thoughtspot/visual-embed-sdk 1.33.3 → 1.33.4

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 (96) hide show
  1. package/cjs/package.json +1 -1
  2. package/cjs/src/embed/app.d.ts +20 -6
  3. package/cjs/src/embed/app.d.ts.map +1 -1
  4. package/cjs/src/embed/app.js +3 -2
  5. package/cjs/src/embed/app.js.map +1 -1
  6. package/cjs/src/embed/app.spec.js +10 -0
  7. package/cjs/src/embed/app.spec.js.map +1 -1
  8. package/cjs/src/embed/base.spec.js +13 -1
  9. package/cjs/src/embed/base.spec.js.map +1 -1
  10. package/cjs/src/embed/conversation.d.ts.map +1 -1
  11. package/cjs/src/embed/conversation.js +4 -0
  12. package/cjs/src/embed/conversation.js.map +1 -1
  13. package/cjs/src/embed/conversation.spec.js +13 -0
  14. package/cjs/src/embed/conversation.spec.js.map +1 -1
  15. package/cjs/src/embed/liveboard.js +1 -1
  16. package/cjs/src/embed/liveboard.js.map +1 -1
  17. package/cjs/src/embed/liveboard.spec.js +2 -2
  18. package/cjs/src/embed/liveboard.spec.js.map +1 -1
  19. package/cjs/src/embed/search.js +1 -1
  20. package/cjs/src/embed/search.js.map +1 -1
  21. package/cjs/src/embed/search.spec.js +6 -6
  22. package/cjs/src/embed/search.spec.js.map +1 -1
  23. package/cjs/src/embed/ts-embed.spec.js +1 -1
  24. package/cjs/src/errors.d.ts +1 -0
  25. package/cjs/src/errors.d.ts.map +1 -1
  26. package/cjs/src/errors.js +10 -9
  27. package/cjs/src/errors.js.map +1 -1
  28. package/cjs/src/react/index.spec.js +1 -1
  29. package/cjs/src/react/index.spec.js.map +1 -1
  30. package/cjs/src/types.d.ts +34 -19
  31. package/cjs/src/types.d.ts.map +1 -1
  32. package/cjs/src/types.js +29 -14
  33. package/cjs/src/types.js.map +1 -1
  34. package/dist/{index-Ck3m4Sis.js → index-Cl8Rsh6W.js} +1 -1
  35. package/dist/src/embed/app.d.ts +20 -6
  36. package/dist/src/embed/app.d.ts.map +1 -1
  37. package/dist/src/embed/conversation.d.ts.map +1 -1
  38. package/dist/src/errors.d.ts +1 -0
  39. package/dist/src/errors.d.ts.map +1 -1
  40. package/dist/src/types.d.ts +34 -19
  41. package/dist/src/types.d.ts.map +1 -1
  42. package/dist/tsembed-react.es.js +50 -30
  43. package/dist/tsembed-react.js +49 -29
  44. package/dist/tsembed.es.js +50 -30
  45. package/dist/tsembed.js +49 -29
  46. package/dist/visual-embed-sdk-react-full.d.ts +54 -25
  47. package/dist/visual-embed-sdk-react.d.ts +54 -25
  48. package/dist/visual-embed-sdk.d.ts +54 -25
  49. package/lib/package.json +1 -1
  50. package/lib/src/embed/app.d.ts +20 -6
  51. package/lib/src/embed/app.d.ts.map +1 -1
  52. package/lib/src/embed/app.js +3 -2
  53. package/lib/src/embed/app.js.map +1 -1
  54. package/lib/src/embed/app.spec.js +10 -0
  55. package/lib/src/embed/app.spec.js.map +1 -1
  56. package/lib/src/embed/base.spec.js +13 -1
  57. package/lib/src/embed/base.spec.js.map +1 -1
  58. package/lib/src/embed/conversation.d.ts.map +1 -1
  59. package/lib/src/embed/conversation.js +4 -0
  60. package/lib/src/embed/conversation.js.map +1 -1
  61. package/lib/src/embed/conversation.spec.js +13 -0
  62. package/lib/src/embed/conversation.spec.js.map +1 -1
  63. package/lib/src/embed/liveboard.js +1 -1
  64. package/lib/src/embed/liveboard.js.map +1 -1
  65. package/lib/src/embed/liveboard.spec.js +2 -2
  66. package/lib/src/embed/liveboard.spec.js.map +1 -1
  67. package/lib/src/embed/search.js +1 -1
  68. package/lib/src/embed/search.js.map +1 -1
  69. package/lib/src/embed/search.spec.js +6 -6
  70. package/lib/src/embed/search.spec.js.map +1 -1
  71. package/lib/src/embed/ts-embed.spec.js +1 -1
  72. package/lib/src/errors.d.ts +1 -0
  73. package/lib/src/errors.d.ts.map +1 -1
  74. package/lib/src/errors.js +10 -9
  75. package/lib/src/errors.js.map +1 -1
  76. package/lib/src/react/index.spec.js +1 -1
  77. package/lib/src/react/index.spec.js.map +1 -1
  78. package/lib/src/types.d.ts +34 -19
  79. package/lib/src/types.d.ts.map +1 -1
  80. package/lib/src/types.js +29 -14
  81. package/lib/src/types.js.map +1 -1
  82. package/lib/src/visual-embed-sdk.d.ts +54 -25
  83. package/package.json +1 -1
  84. package/src/embed/app.spec.ts +15 -0
  85. package/src/embed/app.ts +23 -7
  86. package/src/embed/base.spec.ts +13 -1
  87. package/src/embed/conversation.spec.ts +16 -0
  88. package/src/embed/conversation.ts +4 -0
  89. package/src/embed/liveboard.spec.ts +2 -2
  90. package/src/embed/liveboard.ts +1 -1
  91. package/src/embed/search.spec.ts +6 -6
  92. package/src/embed/search.ts +1 -1
  93. package/src/embed/ts-embed.spec.ts +1 -1
  94. package/src/errors.ts +10 -9
  95. package/src/react/index.spec.tsx +1 -1
  96. package/src/types.ts +32 -17
@@ -388,7 +388,7 @@ declare module '@thoughtspot/visual-embed-sdk/embed/app' {
388
388
  */
389
389
  dataPanelCustomGroupsAccordionInitialState?: DataPanelCustomColumnGroupsAccordionState;
390
390
  /**
391
- * This flag is used to enable the 2 column layout in liveboard
391
+ * This attribute can be used to enable the two-column layout on an embedded Liveboard
392
392
  * @type {boolean}
393
393
  * @default false
394
394
  * @version SDK: 1.32.0 | ThoughtSpot:10.1.0.cl
@@ -402,17 +402,17 @@ declare module '@thoughtspot/visual-embed-sdk/embed/app' {
402
402
  */
403
403
  enable2ColumnLayout?: boolean;
404
404
  /**
405
- * Flag to use OnBeforeSearchExecute embed event
405
+ * Flag that allows using `EmbedEvent.OnBeforeGetVizDataIntercept`.
406
406
  * @version SDK : 1.29.0 | Thoughtspot : 10.1.0.cl
407
407
  */
408
408
  isOnBeforeGetVizDataInterceptEnabled?: boolean;
409
409
  /**
410
410
  * Flag to use home page search bar mode
411
- * @version SDK : 1.33.0 | Thoughtspot : 10.2.0.cl
411
+ * @version SDK : 1.33.0 | Thoughtspot : 10.3.0.cl
412
412
  */
413
413
  homePageSearchBarMode?: HomePageSearchBarMode;
414
414
  /**
415
- * This flag is used to enable the compact header in liveboard
415
+ * This flag can be used to enable the compact header in Liveboard
416
416
  * @type {boolean}
417
417
  * @default false
418
418
  * @version SDK: 1.35.0 | ThoughtSpot:10.3.0.cl
@@ -426,7 +426,7 @@ declare module '@thoughtspot/visual-embed-sdk/embed/app' {
426
426
  */
427
427
  isLiveboardCompactHeaderEnabled?: boolean;
428
428
  /**
429
- * This flag is used to show/hide verified Icon in liveboard compact header
429
+ * This flag can be used to show or hide the Liveboard verified icon in the compact header.
430
430
  * @type {boolean}
431
431
  * @default true
432
432
  * @version SDK: 1.35.0 | ThoughtSpot:10.4.0.cl
@@ -440,7 +440,7 @@ declare module '@thoughtspot/visual-embed-sdk/embed/app' {
440
440
  */
441
441
  showLiveboardVerifiedBadge?: boolean;
442
442
  /**
443
- * This flag is used to show/hide re-verify banner in liveboard compact header
443
+ * This flag can be used to show or hide the re-verify banner on the Liveboard compact header
444
444
  * @type {boolean}
445
445
  * @default true
446
446
  * @version SDK: 1.35.0 | ThoughtSpot:10.4.0.cl
@@ -453,6 +453,20 @@ declare module '@thoughtspot/visual-embed-sdk/embed/app' {
453
453
  * ```
454
454
  */
455
455
  showLiveboardReverifyBanner?: boolean;
456
+ /**
457
+ * This flag is used to enable unified search experience for full app embed.
458
+ * @type {boolean}
459
+ * @default true
460
+ * @version SDK: 1.34.0 | ThoughtSpot:10.5.0.cl
461
+ * @example
462
+ * ```js
463
+ * const embed = new AppEmbed('#embed-container', {
464
+ * ... // other options
465
+ * isUnifiedSearchExperienceEnabled: true,
466
+ * })
467
+ * ```
468
+ */
469
+ isUnifiedSearchExperienceEnabled?: boolean;
456
470
  }
457
471
  /**
458
472
  * Embeds full ThoughtSpot experience in a host application.
@@ -2661,7 +2675,7 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
2661
2675
  */
2662
2676
  enableV2Shell_experimental?: boolean;
2663
2677
  /**
2664
- * To set the initial state of the search bar in case of saved-answers.
2678
+ * To set the initial state of the search bar in case of saved Answers.
2665
2679
  * @default true
2666
2680
  * @version SDK: 1.34.0 | Thoughtspot: 10.3.0.cl
2667
2681
  * @example
@@ -2674,7 +2688,7 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
2674
2688
  collapseSearchBar?: boolean;
2675
2689
  /**
2676
2690
  * This flag can be used to disable links inside the embedded app,
2677
- * and disables redirection of links in a new tab.
2691
+ * and disable redirection of links in a new tab.
2678
2692
  * @example
2679
2693
  * ```js
2680
2694
  * const embed = new LiveboardEmbed('#embed', {
@@ -2686,7 +2700,7 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
2686
2700
  disableRedirectionLinksInNewTab?: boolean;
2687
2701
  /**
2688
2702
  * Flag to control Data panel experience
2689
- * @default true
2703
+ * @default false
2690
2704
  * @version SDK: 1.34.0 | Thoughtspot: 10.3.0.cl
2691
2705
  * @example
2692
2706
  * ```js
@@ -3794,22 +3808,26 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
3794
3808
  */
3795
3809
  Rename = "rename",
3796
3810
  /**
3797
- * Emitted if the user wants to intercept the search execution
3798
- * and implement logic to decide whether to run the search or not
3799
3811
  *
3800
- * Prerequisite: Set isOnBeforeGetVizDataInterceptEnabled : true
3812
+ * This event can be emitted to intercept search execution initiated by
3813
+ * the users and implement the logic to allow or restrict search execution.
3814
+ * You can can also show custom error text if the search query must be
3815
+ * restricted due to your application or business requirements.
3816
+
3817
+ * Prerequisite: Set `isOnBeforeGetVizDataInterceptEnabled` to `true`
3801
3818
  * for this embed event to get emitted.
3802
3819
  * @param: payload
3803
3820
  * @param: responder
3804
3821
  * Contains elements that lets developers define whether ThoughtSpot
3805
- * will run the search or not, and if not, which error message to provide.
3822
+ * should run the search, and if not, what error message
3823
+ * should be shown to the user.
3806
3824
  *
3807
- * execute: When execute returns true, the search will be run.
3808
- * When execute returns false, the search will not be executed.
3825
+ * execute: When execute returns `true`, the search will be run.
3826
+ * When execute returns `false`, the search will not be executed.
3809
3827
  *
3810
- * error: Developers can customize the user facing message when execute is
3811
- * set to false using the error parameter in responder
3812
- * @version SDK : 1.29.0 | Thoughtspot : 10.2.0.cl
3828
+ * error: Developers can customize the error message text when `execute`
3829
+ * returns `false` using the error parameter in responder.
3830
+ * @version SDK : 1.29.0 | Thoughtspot : 10.3.0.cl
3813
3831
  * @example
3814
3832
  *```js
3815
3833
  * .on(EmbedEvent.OnBeforeGetVizDataIntercept,
@@ -3849,15 +3867,15 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
3849
3867
  */
3850
3868
  OnBeforeGetVizDataIntercept = "onBeforeGetVizDataIntercept",
3851
3869
  /**
3852
- * Emitted when parameter changes in an answer
3853
- * or liveboard
3870
+ * Emitted when parameter changes in an Answer
3871
+ * or Liveboard
3854
3872
  *
3855
3873
  * ```js
3856
3874
  * liveboardEmbed.on(EmbedEvent.ParameterChanged, (payload) => {
3857
3875
  * console.log('payload', payload);
3858
3876
  * })
3859
3877
  *```
3860
- * @version SDK : 1.29.0 | Thoughtspot : 10.2.0.cl
3878
+ * @version SDK : 1.29.0 | Thoughtspot : 10.3.0.cl
3861
3879
  */
3862
3880
  ParameterChanged = "parameterChanged"
3863
3881
  }
@@ -4587,7 +4605,8 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
4587
4605
  *
4588
4606
  * `values` - An array of one or several values. The value definition on the
4589
4607
  * data type you choose to filter on. For a complete list of supported data types, see
4590
- * link:https://developers.thoughtspot.com/docs/runtime-filters#_supported_data_types[Supported data types]
4608
+ * link:https://developers.thoughtspot.com/docs/runtime-filters#_supported_data_types[Supported data types].
4609
+ *
4591
4610
  * `type` - To update filters for date time, specify the date format type.
4592
4611
  * For more information and examples, see link:https://developers.thoughtspot.com/docs/embed-liveboard#_date_filters[Date filters].
4593
4612
  *
@@ -4875,7 +4894,8 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
4875
4894
  ShowLiveboardVerifiedBadge = "showLiveboardVerifiedBadge",
4876
4895
  ShowLiveboardReverifyBanner = "showLiveboardReverifyBanner",
4877
4896
  LiveboardHeaderV2 = "isLiveboardHeaderV2Enabled",
4878
- SpotterEnabled = "isSpotterExperienceEnabled"
4897
+ SpotterEnabled = "isSpotterExperienceEnabled",
4898
+ IsUnifiedSearchExperienceEnabled = "isUnifiedSearchExperienceEnabled"
4879
4899
  }
4880
4900
  /**
4881
4901
  * ThoughtSpot application pages include actions and menu commands
@@ -5845,7 +5865,7 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
5845
5865
  */
5846
5866
  AIHighlights = "AIHighlights",
5847
5867
  /**
5848
- * Action ID for edit schedule action on schedule on homepage
5868
+ * Action ID for edit the schedule action on schedule on homepage
5849
5869
  * @example
5850
5870
  * ```js
5851
5871
  * disabledActions: [Action.EditScheduleHomepage]
@@ -5906,7 +5926,16 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
5906
5926
  * ```
5907
5927
  * @version SDK: 1.34.0 | Thoughtspot: 10.3.0.cl
5908
5928
  */
5909
- KPIAnalysisCTA = "kpiAnalysisCTA"
5929
+ KPIAnalysisCTA = "kpiAnalysisCTA",
5930
+ /**
5931
+ * Action ID for disabling chip reorder in Answer and Liveboard
5932
+ * @example
5933
+ * ```js
5934
+ * const disabledActions = [Action.DisableChipReorder]
5935
+ * ```
5936
+ * @version SDK: 1.35.0 | Thoughtspot: 10.5.0.cl
5937
+ */
5938
+ DisableChipReorder = "disableChipReorder"
5910
5939
  }
5911
5940
  export interface AnswerServiceType {
5912
5941
  getAnswer?: (offset: number, batchSize: number) => any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thoughtspot/visual-embed-sdk",
3
- "version": "1.33.3",
3
+ "version": "1.33.4",
4
4
  "description": "ThoughtSpot Embed SDK",
5
5
  "module": "lib/src/index.js",
6
6
  "main": "dist/tsembed.js",
@@ -405,6 +405,21 @@ describe('App embed tests', () => {
405
405
  });
406
406
  });
407
407
 
408
+ test('Should add isUnifiedSearchExperienceEnabled flag to the iframe src', async () => {
409
+ const appEmbed = new AppEmbed(getRootEl(), {
410
+ ...defaultViewConfig,
411
+ isUnifiedSearchExperienceEnabled: false,
412
+ } as AppViewConfig);
413
+
414
+ appEmbed.render();
415
+ await executeAfterWait(() => {
416
+ expectUrlMatchesWithParams(
417
+ getIFrameSrc(),
418
+ `http://${thoughtSpotHost}/?embedApp=true&primaryNavHidden=true&profileAndHelpInNavBarHidden=false&isUnifiedSearchExperienceEnabled=false${defaultParams}${defaultParamsPost}#/home`,
419
+ );
420
+ });
421
+ });
422
+
408
423
  test('Should add showLiveboardVerifiedBadge flag to the iframe src', async () => {
409
424
  const appEmbed = new AppEmbed(getRootEl(), {
410
425
  ...defaultViewConfig,
package/src/embed/app.ts CHANGED
@@ -366,7 +366,7 @@ export interface AppViewConfig extends Omit<ViewConfig, 'visibleTabs'> {
366
366
  */
367
367
  dataPanelCustomGroupsAccordionInitialState?: DataPanelCustomColumnGroupsAccordionState;
368
368
  /**
369
- * This flag is used to enable the 2 column layout in liveboard
369
+ * This attribute can be used to enable the two-column layout on an embedded Liveboard
370
370
  * @type {boolean}
371
371
  * @default false
372
372
  * @version SDK: 1.32.0 | ThoughtSpot:10.1.0.cl
@@ -380,17 +380,17 @@ export interface AppViewConfig extends Omit<ViewConfig, 'visibleTabs'> {
380
380
  */
381
381
  enable2ColumnLayout?: boolean;
382
382
  /**
383
- * Flag to use OnBeforeSearchExecute embed event
383
+ * Flag that allows using `EmbedEvent.OnBeforeGetVizDataIntercept`.
384
384
  * @version SDK : 1.29.0 | Thoughtspot : 10.1.0.cl
385
385
  */
386
386
  isOnBeforeGetVizDataInterceptEnabled?: boolean;
387
387
  /**
388
388
  * Flag to use home page search bar mode
389
- * @version SDK : 1.33.0 | Thoughtspot : 10.2.0.cl
389
+ * @version SDK : 1.33.0 | Thoughtspot : 10.3.0.cl
390
390
  */
391
391
  homePageSearchBarMode?: HomePageSearchBarMode;
392
392
  /**
393
- * This flag is used to enable the compact header in liveboard
393
+ * This flag can be used to enable the compact header in Liveboard
394
394
  * @type {boolean}
395
395
  * @default false
396
396
  * @version SDK: 1.35.0 | ThoughtSpot:10.3.0.cl
@@ -404,7 +404,7 @@ export interface AppViewConfig extends Omit<ViewConfig, 'visibleTabs'> {
404
404
  */
405
405
  isLiveboardCompactHeaderEnabled?: boolean;
406
406
  /**
407
- * This flag is used to show/hide verified Icon in liveboard compact header
407
+ * This flag can be used to show or hide the Liveboard verified icon in the compact header.
408
408
  * @type {boolean}
409
409
  * @default true
410
410
  * @version SDK: 1.35.0 | ThoughtSpot:10.4.0.cl
@@ -418,7 +418,7 @@ export interface AppViewConfig extends Omit<ViewConfig, 'visibleTabs'> {
418
418
  */
419
419
  showLiveboardVerifiedBadge?: boolean;
420
420
  /**
421
- * This flag is used to show/hide re-verify banner in liveboard compact header
421
+ * This flag can be used to show or hide the re-verify banner on the Liveboard compact header
422
422
  * @type {boolean}
423
423
  * @default true
424
424
  * @version SDK: 1.35.0 | ThoughtSpot:10.4.0.cl
@@ -431,6 +431,20 @@ export interface AppViewConfig extends Omit<ViewConfig, 'visibleTabs'> {
431
431
  * ```
432
432
  */
433
433
  showLiveboardReverifyBanner?: boolean;
434
+ /**
435
+ * This flag is used to enable unified search experience for full app embed.
436
+ * @type {boolean}
437
+ * @default true
438
+ * @version SDK: 1.34.0 | ThoughtSpot:10.5.0.cl
439
+ * @example
440
+ * ```js
441
+ * const embed = new AppEmbed('#embed-container', {
442
+ * ... // other options
443
+ * isUnifiedSearchExperienceEnabled: true,
444
+ * })
445
+ * ```
446
+ */
447
+ isUnifiedSearchExperienceEnabled?: boolean;
434
448
  }
435
449
 
436
450
  /**
@@ -468,7 +482,7 @@ export class AppEmbed extends V1Embed {
468
482
  hideOrgSwitcher,
469
483
  enableSearchAssist,
470
484
  fullHeight,
471
- dataPanelV2 = true,
485
+ dataPanelV2 = false,
472
486
  hideLiveboardHeader = false,
473
487
  showLiveboardTitle = true,
474
488
  showLiveboardDescription = true,
@@ -487,6 +501,7 @@ export class AppEmbed extends V1Embed {
487
501
  showLiveboardVerifiedBadge = true,
488
502
  showLiveboardReverifyBanner = true,
489
503
  homePageSearchBarMode,
504
+ isUnifiedSearchExperienceEnabled = true,
490
505
  } = this.viewConfig;
491
506
 
492
507
  let params = {};
@@ -503,6 +518,7 @@ export class AppEmbed extends V1Embed {
503
518
  params[Param.LiveboardHeaderV2] = isLiveboardCompactHeaderEnabled;
504
519
  params[Param.ShowLiveboardVerifiedBadge] = showLiveboardVerifiedBadge;
505
520
  params[Param.ShowLiveboardReverifyBanner] = showLiveboardReverifyBanner;
521
+ params[Param.IsUnifiedSearchExperienceEnabled] = isUnifiedSearchExperienceEnabled;
506
522
 
507
523
  params = this.getBaseQueryParams(params);
508
524
 
@@ -56,7 +56,7 @@ describe('Base TS Embed', () => {
56
56
  authEE.on(auth.AuthStatus.FAILURE, (reason) => {
57
57
  expect(reason).toEqual(auth.AuthFailureType.NO_COOKIE_ACCESS);
58
58
  expect(window.alert).toBeCalledWith(
59
- 'Third party cookie access is blocked on this browser, please allow third party cookies for this to work properly. \nYou can use `suppressNoCookieAccessAlert` to suppress this message.',
59
+ 'Third-party cookie access is blocked on this browser. Please allow third-party cookies for this to work properly. \nYou can use `suppressNoCookieAccessAlert` to suppress this message.',
60
60
  );
61
61
  done();
62
62
  });
@@ -411,6 +411,18 @@ describe('Base TS Embed', () => {
411
411
  });
412
412
  expect(embedConfigInstance.getEmbedConfig().inPopup).toBe(false);
413
413
  });
414
+ test('@P0 @SCAL-226935 embedConfig should contain correct value of customCSSUrl when added in init ', async () => {
415
+ index.init({
416
+ thoughtSpotHost,
417
+ authType: index.AuthType.None,
418
+ customizations: {
419
+ style: {
420
+ customCSSUrl: 'test.com',
421
+ },
422
+ },
423
+ });
424
+ expect(embedConfigInstance.getEmbedConfig().customizations.style.customCSSUrl).toEqual('test.com');
425
+ });
414
426
  });
415
427
 
416
428
  describe('Base without init', () => {
@@ -14,6 +14,7 @@ import {
14
14
  defaultParamsWithoutHiddenActions as defaultParams,
15
15
  expectUrlMatchesWithParams,
16
16
  } from '../test/test-utils';
17
+ import { ERROR_MESSAGE } from '../errors';
17
18
 
18
19
  const thoughtSpotHost = 'tshost';
19
20
 
@@ -43,4 +44,19 @@ describe('ConversationEmbed', () => {
43
44
  `http://${thoughtSpotHost}/v2/?${defaultParams}&isSpotterExperienceEnabled=true#/embed/insights/conv-assist?worksheet=worksheetId&query=searchQuery`,
44
45
  );
45
46
  });
47
+
48
+ it('should handle error when worksheetId is not provided', async () => {
49
+ const viewConfig: ConversationViewConfig = {
50
+ worksheetId: '',
51
+ searchOptions: {
52
+ searchQuery: 'searchQuery',
53
+ },
54
+ };
55
+ const conversationEmbed = new ConversationEmbed(getRootEl(), viewConfig);
56
+ (conversationEmbed as any).handleError = jest.fn();
57
+ await conversationEmbed.render();
58
+ expect((conversationEmbed as any).handleError).toHaveBeenCalledWith(
59
+ ERROR_MESSAGE.SPOTTER_EMBED_WORKSHEED_ID_NOT_FOUND,
60
+ );
61
+ });
46
62
  });
@@ -1,3 +1,4 @@
1
+ import { ERROR_MESSAGE } from '../errors';
1
2
  import { ViewConfig, Param } from '../types';
2
3
  import { TsEmbed } from './ts-embed';
3
4
  import { getQueryParamString } from '../utils';
@@ -49,6 +50,9 @@ export class ConversationEmbed extends TsEmbed {
49
50
  searchOptions,
50
51
  } = this.viewConfig;
51
52
  const path = 'insights/conv-assist';
53
+ if (!worksheetId) {
54
+ this.handleError(ERROR_MESSAGE.SPOTTER_EMBED_WORKSHEED_ID_NOT_FOUND);
55
+ }
52
56
  const queryParams = this.getBaseQueryParams();
53
57
  queryParams[Param.SpotterEnabled] = true;
54
58
 
@@ -67,7 +67,7 @@ describe('Liveboard/viz embed tests', () => {
67
67
  });
68
68
  });
69
69
 
70
- test('should render liveboard with data panel v2 flag set to true by default', async () => {
70
+ test('should render liveboard with data panel v2 flag set to false by default', async () => {
71
71
  const liveboardEmbed = new LiveboardEmbed(getRootEl(), {
72
72
  ...defaultViewConfig,
73
73
  liveboardId,
@@ -76,7 +76,7 @@ describe('Liveboard/viz embed tests', () => {
76
76
  await executeAfterWait(() => {
77
77
  expectUrlMatchesWithParams(
78
78
  getIFrameSrc(),
79
- `http://${thoughtSpotHost}/?embedApp=true${defaultParams}${prefixParams}&enableDataPanelV2=true#/embed/viz/${liveboardId}`,
79
+ `http://${thoughtSpotHost}/?embedApp=true${defaultParams}${prefixParams}&enableDataPanelV2=false#/embed/viz/${liveboardId}`,
80
80
  );
81
81
  });
82
82
  });
@@ -383,7 +383,7 @@ export class LiveboardEmbed extends V1Embed {
383
383
  showLiveboardReverifyBanner = true,
384
384
  enableAskSage,
385
385
  enable2ColumnLayout,
386
- dataPanelV2 = true,
386
+ dataPanelV2 = false,
387
387
  enableCustomColumnGroups = false,
388
388
  } = this.viewConfig;
389
389
 
@@ -52,7 +52,7 @@ describe('Search embed tests', () => {
52
52
  await executeAfterWait(() => {
53
53
  expectUrlMatchesWithParams(
54
54
  getIFrameSrc(),
55
- `http://${thoughtSpotHost}/v2/?${defaultParamsWithHiddenActions}&enableDataPanelV2=true&dataSourceMode=expand&useLastSelectedSources=false${prefixParams}#/embed/answer`,
55
+ `http://${thoughtSpotHost}/v2/?${defaultParamsWithHiddenActions}&enableDataPanelV2=false&dataSourceMode=expand&useLastSelectedSources=false${prefixParams}#/embed/answer`,
56
56
  );
57
57
  });
58
58
  });
@@ -438,7 +438,7 @@ describe('Search embed tests', () => {
438
438
  await executeAfterWait(() => {
439
439
  expectUrlMatchesWithParams(
440
440
  getIFrameSrc(),
441
- `http://${thoughtSpotHost}/v2/?${defaultParamsWithHiddenActions}&dataSourceMode=expand&enableDataPanelV2=true&useLastSelectedSources=true${prefixParams}#/embed/saved-answer/${answerId}`,
441
+ `http://${thoughtSpotHost}/v2/?${defaultParamsWithHiddenActions}&dataSourceMode=expand&enableDataPanelV2=false&useLastSelectedSources=true${prefixParams}#/embed/saved-answer/${answerId}`,
442
442
  );
443
443
  });
444
444
  });
@@ -453,7 +453,7 @@ describe('Search embed tests', () => {
453
453
  await executeAfterWait(() => {
454
454
  expectUrlMatchesWithParams(
455
455
  getIFrameSrc(),
456
- `http://${thoughtSpotHost}/v2/?${defaultParamsWithHiddenActions}&dataSources=[%22data-source-1%22]&dataSourceMode=expand&enableDataPanelV2=true&useLastSelectedSources=false${prefixParams}#/embed/saved-answer/${answerId}`,
456
+ `http://${thoughtSpotHost}/v2/?${defaultParamsWithHiddenActions}&dataSources=[%22data-source-1%22]&dataSourceMode=expand&enableDataPanelV2=false&useLastSelectedSources=false${prefixParams}#/embed/saved-answer/${answerId}`,
457
457
  );
458
458
  });
459
459
  });
@@ -468,7 +468,7 @@ describe('Search embed tests', () => {
468
468
  await executeAfterWait(() => {
469
469
  expectUrlMatchesWithParams(
470
470
  getIFrameSrc(),
471
- `http://${thoughtSpotHost}/v2/?${defaultParamsWithHiddenActions}&dataSources=[%22data-source-1%22]&dataSourceMode=expand&enableDataPanelV2=true&useLastSelectedSources=false${prefixParams}#/embed/saved-answer/${answerId}`,
471
+ `http://${thoughtSpotHost}/v2/?${defaultParamsWithHiddenActions}&dataSources=[%22data-source-1%22]&dataSourceMode=expand&enableDataPanelV2=false&useLastSelectedSources=false${prefixParams}#/embed/saved-answer/${answerId}`,
472
472
  );
473
473
  });
474
474
  });
@@ -499,7 +499,7 @@ describe('Search embed tests', () => {
499
499
  await executeAfterWait(() => {
500
500
  expectUrlMatchesWithParams(
501
501
  getIFrameSrc(),
502
- `http://${thoughtSpotHost}/v2/?${defaultParamsWithHiddenActions}&dataSourceMode=expand&enableDataPanelV2=true&useLastSelectedSources=false&hideSearchBar=true${prefixParams}#/embed/saved-answer/${answerId}`,
502
+ `http://${thoughtSpotHost}/v2/?${defaultParamsWithHiddenActions}&dataSourceMode=expand&enableDataPanelV2=false&useLastSelectedSources=false&hideSearchBar=true${prefixParams}#/embed/saved-answer/${answerId}`,
503
503
  );
504
504
  });
505
505
  });
@@ -514,7 +514,7 @@ describe('Search embed tests', () => {
514
514
  await executeAfterWait(() => {
515
515
  expectUrlMatchesWithParams(
516
516
  getIFrameSrc(),
517
- `http://${thoughtSpotHost}/v2/?${defaultParamsWithHiddenActions}&dataSourceMode=expand&enableDataPanelV2=true&useLastSelectedSources=false&dataPanelCustomGroupsAccordionInitialState=EXPAND_FIRST${prefixParams}#/embed/saved-answer/${answerId}`,
517
+ `http://${thoughtSpotHost}/v2/?${defaultParamsWithHiddenActions}&dataSourceMode=expand&enableDataPanelV2=false&useLastSelectedSources=false&dataPanelCustomGroupsAccordionInitialState=EXPAND_FIRST${prefixParams}#/embed/saved-answer/${answerId}`,
518
518
  );
519
519
  });
520
520
  });
@@ -330,7 +330,7 @@ export class SearchEmbed extends TsEmbed {
330
330
  dataSources,
331
331
  excludeRuntimeFiltersfromURL,
332
332
  hideSearchBar,
333
- dataPanelV2 = true,
333
+ dataPanelV2 = false,
334
334
  useLastSelectedSources = false,
335
335
  runtimeParameters,
336
336
  collapseSearchBarInitially = false,
@@ -1615,7 +1615,7 @@ describe('Unit test case for ts embed', () => {
1615
1615
  });
1616
1616
  libEmbed.preRender();
1617
1617
 
1618
- expect(logger.error).toHaveBeenCalledWith('PreRender id is required for preRender');
1618
+ expect(logger.error).toHaveBeenCalledWith('PreRender ID is required for preRender');
1619
1619
  });
1620
1620
 
1621
1621
  it('showPreRender should preRender if not available', async () => {
package/src/errors.ts CHANGED
@@ -1,18 +1,19 @@
1
1
  export const ERROR_MESSAGE = {
2
2
  INVALID_THOUGHTSPOT_HOST: 'Error parsing ThoughtSpot host. Please provide a valid URL.',
3
- LIVEBOARD_VIZ_ID_VALIDATION: 'Please select a liveboard to embed.',
4
- TRIGGER_TIMED_OUT: 'Trigger timedout in getting response',
5
- SEARCHEMBED_BETA_WRANING_MESSAGE: 'Search Embed is in Beta in this release.',
6
- SAGE_EMBED_BETA_WARNING_MESSAGE: 'Sage Embed is in Beta in this release.',
7
- THIRD_PARTY_COOKIE_BLOCKED_ALERT: 'Third party cookie access is blocked on this browser, please allow third party cookies for this to work properly. \nYou can use `suppressNoCookieAccessAlert` to suppress this message.',
8
- DUPLICATE_TOKEN_ERR: 'Duplicate token, please issue a new token every time getAuthToken callback is called. See https://developers.thoughtspot.com/docs/?pageid=embed-auth#trusted-auth-embed for more details.',
3
+ SPOTTER_EMBED_WORKSHEED_ID_NOT_FOUND: 'Please select a worksheet to get started',
4
+ LIVEBOARD_VIZ_ID_VALIDATION: 'Please select a Liveboard to embed.',
5
+ TRIGGER_TIMED_OUT: 'Trigger timed-out in getting a response',
6
+ SEARCHEMBED_BETA_WRANING_MESSAGE: 'SearchEmbed is in Beta in this release.',
7
+ SAGE_EMBED_BETA_WARNING_MESSAGE: 'SageEmbed is in Beta in this release.',
8
+ THIRD_PARTY_COOKIE_BLOCKED_ALERT: 'Third-party cookie access is blocked on this browser. Please allow third-party cookies for this to work properly. \nYou can use `suppressNoCookieAccessAlert` to suppress this message.',
9
+ DUPLICATE_TOKEN_ERR: 'Duplicate token. Please issue a new token every time getAuthToken callback is called. See https://developers.thoughtspot.com/docs/?pageid=embed-auth#trusted-auth-embed for more details.',
9
10
  SDK_NOT_INITIALIZED: 'SDK not initialized',
10
- SESSION_INFO_FAILED: 'Failed to get session info',
11
+ SESSION_INFO_FAILED: 'Failed to get session information',
11
12
  INVALID_TOKEN_ERROR: 'Received invalid token from getAuthToken callback or authToken endpoint.',
12
13
  MIXPANEL_TOKEN_NOT_FOUND: 'Mixpanel token not found in session info',
13
- PRERENDER_ID_MISSING: 'PreRender id is required for preRender',
14
+ PRERENDER_ID_MISSING: 'PreRender ID is required for preRender',
14
15
  SYNC_STYLE_CALLED_BEFORE_RENDER: 'PreRender should be called before using syncPreRenderStyle',
15
16
  CSP_VIOLATION_ALERT: 'CSP violation detected. Please check the console errors for more details.',
16
- CSP_FRAME_HOST_VIOLATION_LOG_MESSAGE: 'Please setup CSP Correctly for the Application to start working. You can know more about setting CSP Correctly here: https://developers.thoughtspot.com/docs/security-settings#csp-viz-embed-hosts. \n In case you are still facing error, please read: https://developers.thoughtspot.com/docs/security-settings#csp-viz-embed-hosts',
17
+ CSP_FRAME_HOST_VIOLATION_LOG_MESSAGE: 'Please set up CSP correctly for the application to start working. For more information, see https://developers.thoughtspot.com/docs/security-settings#csp-viz-embed-hosts. \n If the issue persists, refer to https://developers.thoughtspot.com/docs/security-settings#csp-viz-embed-hosts',
17
18
  MISSING_REPORTING_OBSERVER: 'ReportingObserver not supported',
18
19
  };
@@ -56,7 +56,7 @@ describe('React Components', () => {
56
56
  ),
57
57
  ).toBe(true);
58
58
  expect(getIFrameSrc(container)).toBe(
59
- `http://${thoughtSpotHost}/?hostAppUrl=local-host&viewPortHeight=768&viewPortWidth=1024&sdkVersion=${version}&authType=None&blockNonEmbedFullAppAccess=true&hideAction=[%22${Action.ReportError}%22,%22editACopy%22,%22saveAsView%22,%22updateTSL%22,%22editTSL%22,%22onDeleteAnswer%22]&overrideConsoleLogs=true&clientLogLevel=ERROR&enableDataPanelV2=true&dataSourceMode=hide&useLastSelectedSources=false&isSearchEmbed=true&collapseSearchBarInitially=true&enableCustomColumnGroups=false&dataPanelCustomGroupsAccordionInitialState=EXPAND_ALL#/embed/answer`,
59
+ `http://${thoughtSpotHost}/?hostAppUrl=local-host&viewPortHeight=768&viewPortWidth=1024&sdkVersion=${version}&authType=None&blockNonEmbedFullAppAccess=true&hideAction=[%22${Action.ReportError}%22,%22editACopy%22,%22saveAsView%22,%22updateTSL%22,%22editTSL%22,%22onDeleteAnswer%22]&overrideConsoleLogs=true&clientLogLevel=ERROR&enableDataPanelV2=false&dataSourceMode=hide&useLastSelectedSources=false&isSearchEmbed=true&collapseSearchBarInitially=true&enableCustomColumnGroups=false&dataPanelCustomGroupsAccordionInitialState=EXPAND_ALL#/embed/answer`,
60
60
  );
61
61
  });
62
62