@thoughtspot/visual-embed-sdk 1.17.2-customcss → 1.18.0-alpha.1

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 (51) hide show
  1. package/CHANGELOG.md +4 -8
  2. package/README.md +1 -1
  3. package/dist/src/embed/app.d.ts +2 -2
  4. package/dist/src/embed/liveboard.d.ts +2 -2
  5. package/dist/src/embed/search-bar.d.ts +3 -2
  6. package/dist/src/embed/search.d.ts +2 -6
  7. package/dist/src/embed/ts-embed.d.ts +2 -97
  8. package/dist/src/react/util.d.ts +1 -2
  9. package/dist/src/types.d.ts +198 -11
  10. package/dist/src/utils.d.ts +2 -2
  11. package/dist/tsembed.es.js +131 -31
  12. package/dist/tsembed.js +131 -31
  13. package/lib/package.json +8 -4
  14. package/lib/src/embed/app.d.ts +2 -2
  15. package/lib/src/embed/app.js +1 -1
  16. package/lib/src/embed/app.js.map +1 -1
  17. package/lib/src/embed/base.js +3 -3
  18. package/lib/src/embed/liveboard.d.ts +2 -2
  19. package/lib/src/embed/liveboard.js.map +1 -1
  20. package/lib/src/embed/search-bar.d.ts +3 -2
  21. package/lib/src/embed/search-bar.js +1 -1
  22. package/lib/src/embed/search-bar.js.map +1 -1
  23. package/lib/src/embed/search.d.ts +2 -6
  24. package/lib/src/embed/search.js +2 -2
  25. package/lib/src/embed/search.js.map +1 -1
  26. package/lib/src/embed/ts-embed.d.ts +2 -97
  27. package/lib/src/embed/ts-embed.js +11 -11
  28. package/lib/src/embed/ts-embed.js.map +1 -1
  29. package/lib/src/embed/ts-embed.spec.js +31 -1
  30. package/lib/src/embed/ts-embed.spec.js.map +1 -1
  31. package/lib/src/react/util.d.ts +1 -2
  32. package/lib/src/react/util.js.map +1 -1
  33. package/lib/src/types.d.ts +198 -11
  34. package/lib/src/types.js +98 -6
  35. package/lib/src/types.js.map +1 -1
  36. package/lib/src/utils.d.ts +2 -2
  37. package/lib/src/utils.js +16 -8
  38. package/lib/src/utils.js.map +1 -1
  39. package/lib/src/visual-embed-sdk.d.ts +209 -120
  40. package/package.json +8 -4
  41. package/src/embed/app.ts +8 -2
  42. package/src/embed/base.ts +3 -3
  43. package/src/embed/liveboard.ts +2 -1
  44. package/src/embed/search-bar.tsx +3 -3
  45. package/src/embed/search.ts +8 -7
  46. package/src/embed/ts-embed.spec.ts +39 -1
  47. package/src/embed/ts-embed.ts +16 -108
  48. package/src/react/index.tsx +2 -2
  49. package/src/react/util.ts +1 -2
  50. package/src/types.ts +199 -11
  51. package/src/utils.ts +19 -7
@@ -33,8 +33,8 @@ declare module '@thoughtspot/visual-embed-sdk/embed/app' {
33
33
  * @module
34
34
  * @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
35
35
  */
36
- import { DOMSelector } from '@thoughtspot/visual-embed-sdk/types';
37
- import { V1Embed, ViewConfig } from '@thoughtspot/visual-embed-sdk/embed/ts-embed';
36
+ import { DOMSelector, ViewConfig } from '@thoughtspot/visual-embed-sdk/types';
37
+ import { V1Embed } from '@thoughtspot/visual-embed-sdk/embed/ts-embed';
38
38
  /**
39
39
  * Pages within the ThoughtSpot app that can be embedded.
40
40
  */
@@ -215,8 +215,8 @@ declare module '@thoughtspot/visual-embed-sdk/embed/liveboard' {
215
215
  * @summary Liveboard & visualization embed
216
216
  * @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
217
217
  */
218
- import { DOMSelector, HostEvent } from '@thoughtspot/visual-embed-sdk/types';
219
- import { V1Embed, ViewConfig } from '@thoughtspot/visual-embed-sdk/embed/ts-embed';
218
+ import { DOMSelector, HostEvent, ViewConfig } from '@thoughtspot/visual-embed-sdk/types';
219
+ import { V1Embed } from '@thoughtspot/visual-embed-sdk/embed/ts-embed';
220
220
  /**
221
221
  * The configuration for the embedded Liveboard or visualization page view.
222
222
  * @Category Liveboards and Charts
@@ -320,8 +320,8 @@ declare module '@thoughtspot/visual-embed-sdk/embed/search' {
320
320
  * @summary Search embed
321
321
  * @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
322
322
  */
323
- import { DOMSelector, Action } from '@thoughtspot/visual-embed-sdk/types';
324
- import { ViewConfig, TsEmbed } from '@thoughtspot/visual-embed-sdk/embed/ts-embed';
323
+ import { DOMSelector, Action, ViewConfig } from '@thoughtspot/visual-embed-sdk/types';
324
+ import { TsEmbed } from '@thoughtspot/visual-embed-sdk/embed/ts-embed';
325
325
  /**
326
326
  * Configuration for search options
327
327
  */
@@ -358,10 +358,6 @@ declare module '@thoughtspot/visual-embed-sdk/embed/search' {
358
358
  * using raw answer data.
359
359
  */
360
360
  hideResults?: boolean;
361
- /**
362
- * If set to true, expands all the data sources panel.
363
- */
364
- expandAllDataSource?: boolean;
365
361
  /**
366
362
  * If set to true, the Search Assist feature is enabled.
367
363
  * @version SDK: 1.13.0 | ThoughtSpot: 8.5.0.cl, 8.8.1-sw
@@ -410,7 +406,8 @@ declare module '@thoughtspot/visual-embed-sdk/embed/search' {
410
406
  }
411
407
 
412
408
  declare module '@thoughtspot/visual-embed-sdk/embed/search-bar' {
413
- import { TsEmbed, ViewConfig } from '@thoughtspot/visual-embed-sdk/embed/ts-embed';
409
+ import { ViewConfig } from '@thoughtspot/visual-embed-sdk/types';
410
+ import { TsEmbed } from '@thoughtspot/visual-embed-sdk/embed/ts-embed';
414
411
  import { SearchOptions } from '@thoughtspot/visual-embed-sdk/embed/search';
415
412
  export interface SearchBarViewConfig extends ViewConfig {
416
413
  /**
@@ -430,7 +427,7 @@ declare module '@thoughtspot/visual-embed-sdk/embed/search-bar' {
430
427
  * Embed ThoughtSpot search bar
431
428
  *
432
429
  * @Category Search Embed
433
- * @version: SDK: 1.17.0 | ThoughtSpot 8.10.0.cl, 9.0.1-sw
430
+ * @version: SDK: 1.18.0 | ThoughtSpot: 8.10.0.cl, 9.0.1-sw
434
431
  */
435
432
  export class SearchBarEmbed extends TsEmbed {
436
433
  /**
@@ -597,11 +594,11 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
597
594
  }
598
595
  interface CustomStyles {
599
596
  customCSSUrl?: string;
600
- customCss?: customCssInterface;
597
+ customCSS?: customCssInterface;
601
598
  }
602
599
  export interface CustomisationsInterface {
603
- style: CustomStyles;
604
- content: {
600
+ style?: CustomStyles;
601
+ content?: {
605
602
  [key: string]: string;
606
603
  };
607
604
  }
@@ -741,7 +738,7 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
741
738
  *
742
739
  * @version SDK: 1.17.0 | ThoughtSpot: 8.9.0.cl
743
740
  */
744
- customisations?: CustomisationsInterface;
741
+ customizations?: CustomisationsInterface;
745
742
  /**
746
743
  * For noRedirect SSO Auth, we need a button which the user
747
744
  * click to trigger the flow. This is the containing element
@@ -757,6 +754,101 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
757
754
  */
758
755
  authTriggerText?: string;
759
756
  }
757
+ export interface LayoutConfig {
758
+ }
759
+ /**
760
+ * Embedded iFrame configuration
761
+ */
762
+ export interface FrameParams {
763
+ /**
764
+ * The width of the iFrame (unit is pixels if numeric).
765
+ */
766
+ width?: number | string;
767
+ /**
768
+ * The height of the iFrame (unit is pixels if numeric).
769
+ */
770
+ height?: number | string;
771
+ /**
772
+ * This parameters will be passed on the iframe
773
+ * as is.
774
+ */
775
+ [key: string]: string | number | boolean | undefined;
776
+ }
777
+ /**
778
+ * The configuration object for an embedded view.
779
+ */
780
+ export interface ViewConfig {
781
+ /**
782
+ * @hidden
783
+ */
784
+ layoutConfig?: LayoutConfig;
785
+ /**
786
+ * The <b>width</b> and <b>height</b> dimensions to render an embedded object inside your app. Specify the values in pixels or percentage.
787
+ */
788
+ frameParams?: FrameParams;
789
+ /**
790
+ * @hidden
791
+ */
792
+ theme?: string;
793
+ /**
794
+ * @hidden
795
+ */
796
+ styleSheet__unstable?: string;
797
+ /**
798
+ * The list of actions to disable from the primary menu, more menu
799
+ * (...), and the contextual menu.
800
+ */
801
+ disabledActions?: Action[];
802
+ /**
803
+ * The tooltip to display for disabled actions.
804
+ */
805
+ disabledActionReason?: string;
806
+ /**
807
+ * The list of actions to hide from the primary menu, more menu
808
+ * (...), and the contextual menu.
809
+ */
810
+ hiddenActions?: Action[];
811
+ /**
812
+ * The list of actions to display from the primary menu, more menu
813
+ * (...), and the contextual menu.
814
+ * @version SDK: 1.6.0 | ThoughtSpot: ts8.nov.cl, 8.4.1-sw
815
+ */
816
+ visibleActions?: Action[];
817
+ /**
818
+ * Show alert messages and toast messages in the embedded view.
819
+ * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
820
+ */
821
+ showAlerts?: boolean;
822
+ /**
823
+ * The list of runtime filters to apply to a search answer,
824
+ * visualization, or Liveboard.
825
+ */
826
+ runtimeFilters?: RuntimeFilter[];
827
+ /**
828
+ * The locale/language to use for the embedded view.
829
+ * @version SDK: 1.9.4 | ThoughtSpot 8.1.0.cl, 8.4.1-sw
830
+ */
831
+ locale?: string;
832
+ /**
833
+ * This is an object (key/val) of override flags which will be applied
834
+ * to the internal embedded object. This can be used to add any
835
+ * URL flag.
836
+ * Warning: This option is for advanced use only and is used internally
837
+ * to control embed behavior in non-regular ways. We do not publish the
838
+ * list of supported keys and values associated with each.
839
+ * @version SDK: 1.9.0 | ThoughtSpot: 8.1.0.cl, 8.4.1-sw
840
+ */
841
+ additionalFlags?: {
842
+ [key: string]: string | number | boolean;
843
+ };
844
+ /**
845
+ * Dynamic CSSUrl and customCSS to be injected in the loaded application.
846
+ * You would also need to set `style-src` in the CSP settings.
847
+ * @version SDK: 1.17.2 | ThoughtSpot: 8.4.1-sw, 8.4.0.cl
848
+ * @default ''
849
+ */
850
+ customizations?: CustomisationsInterface;
851
+ }
760
852
  /**
761
853
  * MessagePayload: Embed event payload: message type, data and status (start/end)
762
854
  */
@@ -1253,7 +1345,10 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
1253
1345
  * Triggers the Pin action on an embedded object
1254
1346
  * @param - incase of Liveboard embed, takes in an object with vizId as a key
1255
1347
  * can be left empty for search and visualization embeds
1256
- * @example liveboardEmbed.trigger(HostEvent.Pin, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
1348
+ * @example
1349
+ * liveboardEmbed.trigger(HostEvent.Pin, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
1350
+ * vizEmbed.trigger(HostEvent.Pin)
1351
+ * searchEmbed.trigger(HostEvent.Pin)
1257
1352
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
1258
1353
  */
1259
1354
  Pin = "pin",
@@ -1300,8 +1395,11 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
1300
1395
  */
1301
1396
  DownloadAsPdf = "downloadAsPdf",
1302
1397
  /**
1303
- * Triggers the Make a copy action on a Liveboard
1304
- * @example liveboardEmbed.trigger(HostEvent.MakeACopy)
1398
+ * Triggers the Make a copy action on a Liveboard, search or visualization
1399
+ * @example
1400
+ * liveboardEmbed.trigger(HostEvent.MakeACopy, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
1401
+ * vizEmbed.trigger(HostEvent.MakeACopy)
1402
+ * searchEmbed.trigger(HostEvent.MakeACopy)
1305
1403
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
1306
1404
  */
1307
1405
  MakeACopy = "makeACopy",
@@ -1365,15 +1463,74 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
1365
1463
  /**
1366
1464
  * Get TML for the current search.
1367
1465
  * @example searchEmbed.trigger(HostEvent.GetTML)
1368
- * @version SDK: 1.18.0 | ThoughtSpot: 8.10.0.cl, 9.0.1-sw
1466
+ * @version SDK: 1.18.0 | ThoughtSpot: 8.10.0.cl
1369
1467
  */
1370
1468
  GetTML = "getTML",
1469
+ /**
1470
+ * Triggers the ShowUnderlyingData action on visualization or search
1471
+ * @param - an object with vizId as a key
1472
+ * @example
1473
+ * liveboardEmbed.trigger(HostEvent.ShowUnderlyingData, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
1474
+ * vizEmbed.trigger(HostEvent.ShowUnderlyingData)
1475
+ * searchEmbed.trigger(HostEvent.ShowUnderlyingData)
1476
+ * @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
1477
+ */
1478
+ ShowUnderlyingData = "showUnderlyingData",
1479
+ /**
1480
+ * Triggers the Delete action on visualization or search
1481
+ * @param - incase of Liveboard embed, takes in an object with vizId as a key
1482
+ * can be left empty for search and visualization embeds
1483
+ * @example
1484
+ * liveboardEmbed.trigger(HostEvent.Delete, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
1485
+ * vizEmbed.trigger(HostEvent.Delete)
1486
+ * searchEmbed.trigger(HostEvent.Delete)
1487
+ * @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
1488
+ */
1489
+ Delete = "delete",
1490
+ /**
1491
+ * Triggers the SpotIQAnalyze action on visualization or search
1492
+ * @param - incase of Liveboard embed, takes in an object with vizId as a key
1493
+ * can be left empty for search and visualization embeds
1494
+ * @example
1495
+ * liveboardEmbed.trigger(HostEvent.SpotIQAnalyze, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
1496
+ * vizEmbed.trigger(HostEvent.SpotIQAnalyze)
1497
+ * searchEmbed.trigger(HostEvent.SpotIQAnalyze)
1498
+ * @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
1499
+ */
1500
+ SpotIQAnalyze = "spotIQAnalyze",
1501
+ /**
1502
+ * Triggers the Download action on visualization or search when Displaymode is Chart
1503
+ * @example
1504
+ * liveboardEmbed.trigger(HostEvent.Download, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
1505
+ * vizEmbed.trigger(HostEvent.Download)
1506
+ * searchEmbed.trigger(HostEvent.Download)
1507
+ * @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
1508
+ */
1509
+ Download = "download",
1510
+ /**
1511
+ * Triggers the downloadAsCSV action on visualization or search when Displaymode is Table
1512
+ * @example
1513
+ * liveboardEmbed.trigger(HostEvent.DownloadAsCsv, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
1514
+ * vizEmbed.trigger(HostEvent.DownloadAsCsv)
1515
+ * searchEmbed.trigger(HostEvent.DownloadAsCsv)
1516
+ * @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
1517
+ */
1518
+ DownloadAsCsv = "downloadAsCSV",
1519
+ /**
1520
+ * Triggers the downloadAsXLSX action on visualization or search when Displaymode is Table
1521
+ * @example
1522
+ * liveboardEmbed.trigger(HostEvent.DownloadAsXlsx, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
1523
+ * vizEmbed.trigger(HostEvent.DownloadAsXlsx)
1524
+ * searchEmbed.trigger(HostEvent.DownloadAsXlsx)
1525
+ * @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
1526
+ */
1527
+ DownloadAsXlsx = "downloadAsXLSX",
1371
1528
  /**
1372
1529
  * Triggers the Share action on a liveboard or answer
1373
1530
  * @example
1374
1531
  * liveboardEmbed.trigger(HostEvent.Share)
1375
1532
  * searchEmbed.trigger(HostEvent.Share)
1376
- * @version SDK: 1.19.0 | Thoughtspot: 9.0.0.cl, 9.0.1-sw
1533
+ * @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
1377
1534
  */
1378
1535
  Share = "share",
1379
1536
  /**
@@ -1381,9 +1538,36 @@ declare module '@thoughtspot/visual-embed-sdk/types' {
1381
1538
  * @example
1382
1539
  * liveboardEmbed.trigger(HostEvent.Save)
1383
1540
  * searchEmbed.trigger(HostEvent.Save)
1384
- * @version SDK: 1.19.0 | Thoughtspot: 9.0.0.cl, 9.0.1-sw
1541
+ * @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
1542
+ */
1543
+ Save = "save",
1544
+ /**
1545
+ * Triggers the SyncToSheets action on visualization
1546
+ * @param - an object with vizId as a key
1547
+ * @example
1548
+ * liveboardEmbed.trigger(HostEvent.SyncToSheets, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
1549
+ * vizEmbed.trigger(HostEvent.SyncToSheets)
1550
+ * @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
1551
+ */
1552
+ SyncToSheets = "sync-to-sheets",
1553
+ /**
1554
+ * Triggers the SyncToOtherApps action on visualization
1555
+ * @param - an object with vizId as a key
1556
+ * @example
1557
+ * liveboardEmbed.trigger(HostEvent.SyncToOtherApps, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
1558
+ * vizEmbed.trigger(HostEvent.SyncToOtherApps)
1559
+ * @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
1560
+ */
1561
+ SyncToOtherApps = "sync-to-other-apps",
1562
+ /**
1563
+ * Triggers the ManagePipelines action on visualization
1564
+ * @param - an object with vizId as a key
1565
+ * @example
1566
+ * liveboardEmbed.trigger(HostEvent.ManagePipelines, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
1567
+ * vizEmbed.trigger(HostEvent.ManagePipelines)
1568
+ * @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
1385
1569
  */
1386
- Save = "save"
1570
+ ManagePipelines = "manage-pipeline"
1387
1571
  }
1388
1572
  /**
1389
1573
  * The different visual modes that the data sources panel within
@@ -1623,106 +1807,11 @@ declare module '@thoughtspot/visual-embed-sdk/embed/ts-embed' {
1623
1807
  * @summary Base classes
1624
1808
  * @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
1625
1809
  */
1626
- import { DOMSelector, HostEvent, EmbedEvent, MessageCallback, Action, RuntimeFilter, EmbedConfig, MessageOptions } from '@thoughtspot/visual-embed-sdk/types';
1810
+ import { DOMSelector, HostEvent, EmbedEvent, MessageCallback, EmbedConfig, MessageOptions, ViewConfig, FrameParams } from '@thoughtspot/visual-embed-sdk/types';
1627
1811
  /**
1628
1812
  * Global prefix for all Thoughtspot postHash Params.
1629
1813
  */
1630
1814
  export const THOUGHTSPOT_PARAM_PREFIX = "ts-";
1631
- export interface LayoutConfig {
1632
- }
1633
- /**
1634
- * Embedded iFrame configuration
1635
- */
1636
- export interface FrameParams {
1637
- /**
1638
- * The width of the iFrame (unit is pixels if numeric).
1639
- */
1640
- width?: number | string;
1641
- /**
1642
- * The height of the iFrame (unit is pixels if numeric).
1643
- */
1644
- height?: number | string;
1645
- /**
1646
- * This parameters will be passed on the iframe
1647
- * as is.
1648
- */
1649
- [key: string]: string | number | boolean | undefined;
1650
- }
1651
- /**
1652
- * The configuration object for an embedded view.
1653
- */
1654
- export interface ViewConfig {
1655
- /**
1656
- * @hidden
1657
- */
1658
- layoutConfig?: LayoutConfig;
1659
- /**
1660
- * The <b>width</b> and <b>height</b> dimensions to render an embedded object inside your app. Specify the values in pixels or percentage.
1661
- */
1662
- frameParams?: FrameParams;
1663
- /**
1664
- * @hidden
1665
- */
1666
- theme?: string;
1667
- /**
1668
- * @hidden
1669
- */
1670
- styleSheet__unstable?: string;
1671
- /**
1672
- * The list of actions to disable from the primary menu, more menu
1673
- * (...), and the contextual menu.
1674
- */
1675
- disabledActions?: Action[];
1676
- /**
1677
- * The tooltip to display for disabled actions.
1678
- */
1679
- disabledActionReason?: string;
1680
- /**
1681
- * The list of actions to hide from the primary menu, more menu
1682
- * (...), and the contextual menu.
1683
- */
1684
- hiddenActions?: Action[];
1685
- /**
1686
- * The list of actions to display from the primary menu, more menu
1687
- * (...), and the contextual menu.
1688
- * @version SDK: 1.6.0 | ThoughtSpot: ts8.nov.cl, 8.4.1-sw
1689
- */
1690
- visibleActions?: Action[];
1691
- /**
1692
- * Show alert messages and toast messages in the embedded view.
1693
- * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
1694
- */
1695
- showAlerts?: boolean;
1696
- /**
1697
- * The list of runtime filters to apply to a search answer,
1698
- * visualization, or Liveboard.
1699
- */
1700
- runtimeFilters?: RuntimeFilter[];
1701
- /**
1702
- * The locale/language to use for the embedded view.
1703
- * @version SDK: 1.9.4 | ThoughtSpot 8.1.0.cl, 8.4.1-sw
1704
- */
1705
- locale?: string;
1706
- /**
1707
- * This is an object (key/val) of override flags which will be applied
1708
- * to the internal embedded object. This can be used to add any
1709
- * URL flag.
1710
- * Warning: This option is for advanced use only and is used internally
1711
- * to control embed behavior in non-regular ways. We do not publish the
1712
- * list of supported keys and values associated with each.
1713
- * @version SDK: 1.9.0 | ThoughtSpot: 8.1.0.cl, 8.4.1-sw
1714
- */
1715
- additionalFlags?: {
1716
- [key: string]: string | number | boolean;
1717
- };
1718
- /**
1719
- * Dynamic CSS Url to be injected in the loaded application.
1720
- * You would also need to set `style-src` in the CSP settings.
1721
- * @version SDK: 1.17.2 | ThoughtSpot: 8.4.1-sw, 8.4.0.cl
1722
- * @default ''
1723
- */
1724
- customCssUrl?: string;
1725
- }
1726
1815
  /**
1727
1816
  * Base class for embedding v2 experience
1728
1817
  * Note: the v2 version of ThoughtSpot Blink is built on the new stack:
@@ -1823,7 +1912,7 @@ declare module '@thoughtspot/visual-embed-sdk/embed/ts-embed' {
1823
1912
  * @param messageType The event type
1824
1913
  * @param data The payload to send with the message
1825
1914
  */
1826
- trigger(messageType: HostEvent, data: any): Promise<any>;
1915
+ trigger(messageType: HostEvent, data?: any): Promise<any>;
1827
1916
  /**
1828
1917
  * Marks the ThoughtSpot object to have been rendered
1829
1918
  * Needs to be overridden by subclasses to do the actual
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thoughtspot/visual-embed-sdk",
3
- "version": "1.17.2-customcss",
3
+ "version": "1.18.0-alpha.1",
4
4
  "description": "ThoughtSpot Embed SDK",
5
5
  "module": "lib/src/index.js",
6
6
  "main": "dist/tsembed.js",
@@ -12,12 +12,16 @@
12
12
  ],
13
13
  "exports": {
14
14
  ".": "./lib/src/index.js",
15
- "./react": "./lib/src/react/index.js"
15
+ "./react": {
16
+ "import": "./lib/src/react/index.js",
17
+ "require": "./cjs/src/react.index.js",
18
+ "types": "./lib/src/react/index.d.ts"
19
+ }
16
20
  },
17
21
  "scripts": {
18
22
  "lint": "eslint 'src/**'",
19
23
  "lint:fix": "eslint 'src/**/*.*' --fix",
20
- "tsc": "tsc -p . --incremental false",
24
+ "tsc": "tsc -p . --incremental false; tsc -p . --incremental false --module commonjs --outDir cjs",
21
25
  "start": "gatsby develop",
22
26
  "build:gatsby": "npm run clean:gatsby && gatsby build --prefix-paths",
23
27
  "build:gatsby:noprefix": "npm run clean:gatsby && gatsby build",
@@ -117,7 +121,7 @@
117
121
  "typedoc": "0.21.6",
118
122
  "typedoc-neo-theme": "^1.1.0",
119
123
  "typedoc-plugin-toc-group": "0.0.5",
120
- "typescript": "^4.1.0",
124
+ "typescript": "^4.9.4",
121
125
  "url-search-params-polyfill": "^8.1.0",
122
126
  "util": "^0.12.4"
123
127
  },
package/src/embed/app.ts CHANGED
@@ -10,8 +10,14 @@
10
10
  */
11
11
 
12
12
  import { getFilterQuery, getQueryParamString } from '../utils';
13
- import { Param, RuntimeFilter, DOMSelector, HostEvent } from '../types';
14
- import { V1Embed, ViewConfig } from './ts-embed';
13
+ import {
14
+ Param,
15
+ RuntimeFilter,
16
+ DOMSelector,
17
+ HostEvent,
18
+ ViewConfig,
19
+ } from '../types';
20
+ import { V1Embed } from './ts-embed';
15
21
 
16
22
  /**
17
23
  * Pages within the ThoughtSpot app that can be embedded.
package/src/embed/base.ts CHANGED
@@ -171,11 +171,11 @@ export const init = (embedConfig: EmbedConfig): EventEmitter => {
171
171
  authType: config.authType,
172
172
  host: config.thoughtSpotHost,
173
173
  usedCustomizationSheet:
174
- embedConfig.customisations?.style?.customCSSUrl != null,
174
+ embedConfig.customizations?.style?.customCSSUrl != null,
175
175
  usedCustomizationVariables:
176
- embedConfig.customisations?.style?.customCss?.variables != null,
176
+ embedConfig.customizations?.style?.customCSS?.variables != null,
177
177
  usedCustomizationRules:
178
- embedConfig.customisations?.style?.customCss?.rules_UNSTABLE !=
178
+ embedConfig.customizations?.style?.customCSS?.rules_UNSTABLE !=
179
179
  null,
180
180
  });
181
181
 
@@ -17,9 +17,10 @@ import {
17
17
  RuntimeFilter,
18
18
  DOMSelector,
19
19
  HostEvent,
20
+ ViewConfig,
20
21
  } from '../types';
21
22
  import { getFilterQuery, getQueryParamString } from '../utils';
22
- import { V1Embed, ViewConfig } from './ts-embed';
23
+ import { V1Embed } from './ts-embed';
23
24
 
24
25
  /**
25
26
  * The configuration for the embedded Liveboard or visualization page view.
@@ -1,6 +1,6 @@
1
- import { DOMSelector, Param, Action } from '../types';
1
+ import { DOMSelector, Param, Action, ViewConfig } from '../types';
2
2
  import { getQueryParamString } from '../utils';
3
- import { TsEmbed, ViewConfig } from './ts-embed';
3
+ import { TsEmbed } from './ts-embed';
4
4
  import { SearchOptions } from './search';
5
5
 
6
6
  export interface SearchBarViewConfig extends ViewConfig {
@@ -22,7 +22,7 @@ export interface SearchBarViewConfig extends ViewConfig {
22
22
  * Embed ThoughtSpot search bar
23
23
  *
24
24
  * @Category Search Embed
25
- * @version: SDK: 1.17.0 | ThoughtSpot 8.10.0.cl, 9.0.1-sw
25
+ * @version: SDK: 1.18.0 | ThoughtSpot: 8.10.0.cl, 9.0.1-sw
26
26
  */
27
27
  export class SearchBarEmbed extends TsEmbed {
28
28
  /**
@@ -7,9 +7,15 @@
7
7
  * @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
8
8
  */
9
9
 
10
- import { DataSourceVisualMode, DOMSelector, Param, Action } from '../types';
10
+ import {
11
+ DataSourceVisualMode,
12
+ DOMSelector,
13
+ Param,
14
+ Action,
15
+ ViewConfig,
16
+ } from '../types';
11
17
  import { getQueryParamString, checkReleaseVersionInBeta } from '../utils';
12
- import { ViewConfig, TsEmbed } from './ts-embed';
18
+ import { TsEmbed } from './ts-embed';
13
19
  import { version } from '../../package.json';
14
20
  import { ERROR_MESSAGE } from '../errors';
15
21
  import { getAuthPromise, getEmbedConfig } from './base';
@@ -52,10 +58,6 @@ export interface SearchViewConfig extends ViewConfig {
52
58
  * using raw answer data.
53
59
  */
54
60
  hideResults?: boolean;
55
- /**
56
- * If set to true, expands all the data sources panel.
57
- */
58
- expandAllDataSource?: boolean;
59
61
  /**
60
62
  * If set to true, the Search Assist feature is enabled.
61
63
  * @version SDK: 1.13.0 | ThoughtSpot: 8.5.0.cl, 8.8.1-sw
@@ -134,7 +136,6 @@ export class SearchEmbed extends TsEmbed {
134
136
  private getIFrameSrc(answerId: string, dataSources?: string[]) {
135
137
  const {
136
138
  hideResults,
137
- expandAllDataSource,
138
139
  enableSearchAssist,
139
140
  forceTable,
140
141
  searchOptions,
@@ -48,6 +48,13 @@ const customisations = {
48
48
  content: {},
49
49
  };
50
50
 
51
+ const customisationsView = {
52
+ style: {
53
+ customCSSUrl: 'http://localhost:8000',
54
+ },
55
+ content: {},
56
+ };
57
+
51
58
  describe('Unit test case for ts embed', () => {
52
59
  const mockMixPanelEvent = jest.spyOn(
53
60
  mixpanelInstance,
@@ -66,7 +73,8 @@ describe('Unit test case for ts embed', () => {
66
73
  init({
67
74
  thoughtSpotHost: 'tshost',
68
75
  authType: AuthType.None,
69
- customisations,
76
+ customizations: customisations,
77
+ customCssUrl: 'http://localhost:5000',
70
78
  });
71
79
  });
72
80
 
@@ -94,6 +102,36 @@ describe('Unit test case for ts embed', () => {
94
102
  });
95
103
  });
96
104
 
105
+ test('verify Customisations from viewConfig', async () => {
106
+ const mockEmbedEventPayload = {
107
+ type: EmbedEvent.APP_INIT,
108
+ data: {},
109
+ };
110
+ const searchEmbed = new SearchEmbed(getRootEl(), {
111
+ ...defaultViewConfig,
112
+ customizations: customisationsView,
113
+ });
114
+ searchEmbed.render();
115
+ const mockPort: any = {
116
+ postMessage: jest.fn(),
117
+ };
118
+ await executeAfterWait(() => {
119
+ const iframe = getIFrameEl();
120
+ postMessageToParent(
121
+ iframe.contentWindow,
122
+ mockEmbedEventPayload,
123
+ mockPort,
124
+ );
125
+ });
126
+ expect(mockPort.postMessage).toHaveBeenCalledWith({
127
+ type: EmbedEvent.APP_INIT,
128
+ data: { customisations: customisationsView },
129
+ });
130
+ expect(getIFrameSrc()).toContain(
131
+ `customCssUrl=${customisationsView.style.customCSSUrl}`,
132
+ );
133
+ });
134
+
97
135
  test('when Embed event status have start status', (done) => {
98
136
  const mockEmbedEventPayload = {
99
137
  type: EmbedEvent.Save,