@thoughtspot/visual-embed-sdk 1.21.0-alpha.0 → 1.21.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/README.md +1 -1
  2. package/dist/src/auth.d.ts +10 -6
  3. package/dist/src/auth.d.ts.map +1 -1
  4. package/dist/src/auth.spec.d.ts +3 -0
  5. package/dist/src/auth.spec.d.ts.map +1 -1
  6. package/dist/src/embed/base.d.ts +3 -1
  7. package/dist/src/embed/base.d.ts.map +1 -1
  8. package/dist/src/embed/liveboard.d.ts +11 -1
  9. package/dist/src/embed/liveboard.d.ts.map +1 -1
  10. package/dist/src/embed/ts-embed.d.ts.map +1 -1
  11. package/dist/src/react/index.d.ts +15 -0
  12. package/dist/src/react/index.d.ts.map +1 -1
  13. package/dist/src/types.d.ts +95 -24
  14. package/dist/src/types.d.ts.map +1 -1
  15. package/dist/tsembed.es.js +17546 -249
  16. package/dist/tsembed.js +17546 -249
  17. package/lib/package.json +1 -1
  18. package/lib/src/auth.d.ts +10 -6
  19. package/lib/src/auth.d.ts.map +1 -1
  20. package/lib/src/auth.js +25 -10
  21. package/lib/src/auth.js.map +1 -1
  22. package/lib/src/auth.spec.d.ts +3 -0
  23. package/lib/src/auth.spec.d.ts.map +1 -1
  24. package/lib/src/auth.spec.js +23 -1
  25. package/lib/src/auth.spec.js.map +1 -1
  26. package/lib/src/embed/base.d.ts +3 -1
  27. package/lib/src/embed/base.d.ts.map +1 -1
  28. package/lib/src/embed/base.js +3 -1
  29. package/lib/src/embed/base.js.map +1 -1
  30. package/lib/src/embed/liveboard.d.ts +11 -1
  31. package/lib/src/embed/liveboard.d.ts.map +1 -1
  32. package/lib/src/embed/liveboard.js +11 -1
  33. package/lib/src/embed/liveboard.js.map +1 -1
  34. package/lib/src/embed/ts-embed.d.ts.map +1 -1
  35. package/lib/src/embed/ts-embed.js +3 -2
  36. package/lib/src/embed/ts-embed.js.map +1 -1
  37. package/lib/src/react/index.d.ts +15 -0
  38. package/lib/src/react/index.d.ts.map +1 -1
  39. package/lib/src/react/index.js +15 -0
  40. package/lib/src/react/index.js.map +1 -1
  41. package/lib/src/types.d.ts +95 -24
  42. package/lib/src/types.d.ts.map +1 -1
  43. package/lib/src/types.js +95 -24
  44. package/lib/src/types.js.map +1 -1
  45. package/lib/src/visual-embed-sdk.d.ts +119 -32
  46. package/package.json +1 -1
  47. package/src/auth.spec.ts +40 -8
  48. package/src/auth.ts +43 -16
  49. package/src/embed/base.ts +4 -2
  50. package/src/embed/liveboard.ts +11 -1
  51. package/src/embed/ts-embed.ts +2 -1
  52. package/src/react/index.tsx +15 -0
  53. package/src/types.ts +95 -24
package/src/types.ts CHANGED
@@ -44,16 +44,47 @@ export enum AuthType {
44
44
  SAML = 'SSO_SAML',
45
45
  /**
46
46
  * SSO using SAML
47
- * Will make the host application redirect to the SAML Idp.
47
+ * Will make the host application redirect to the SAML Idp. Use this
48
+ * when the idp does not allow itself to be embedded.
49
+ *
50
+ * This redirects the host application to the SAML Idp. The host application
51
+ * will be redirected back to the ThoughtSpot app after authentication.
48
52
  *
49
53
  * @example
50
54
  * ```js
51
55
  * init({
52
56
  * // ...
53
57
  * authType: AuthType.SAMLRedirect,
58
+ * });
59
+ * ```
60
+ *
61
+ * This opens the SAML Idp in a popup window. The popup is triggered
62
+ * when the user clicks the trigger button. The popup window will be
63
+ * closed automatically after authentication.
64
+ * @example
65
+ * ```js
66
+ * init({
67
+ * // ...
68
+ * authType: AuthType.SAMLRedirect,
54
69
  * authTriggerText: 'Login with SAML',
55
70
  * authTriggerContainer: '#embed-container',
56
- * });
71
+ * inPopup: true,
72
+ * });
73
+ * ```
74
+ *
75
+ * Can also use event to trigger the popup flow. Works the same
76
+ * as above example.
77
+ * @example
78
+ * ```js
79
+ * const authEE = init({
80
+ * // ...
81
+ * authType: AuthType.SAMLRedirect,
82
+ * inPopup: true,
83
+ * });
84
+ *
85
+ * someButtonOnYourPage.addEventListener('click', () => {
86
+ * authEE.emit(AuthEvent.TRIGGER_SSO_POPUP);
87
+ * });
57
88
  * ```
58
89
  */
59
90
  SAMLRedirect = 'SSO_SAML',
@@ -67,6 +98,7 @@ export enum AuthType {
67
98
  /**
68
99
  * SSO using OIDC
69
100
  * Will make the host application redirect to the OIDC Idp.
101
+ * See code samples in {@link SAMLRedirect}.
70
102
  */
71
103
  OIDCRedirect = 'SSO_OIDC',
72
104
  /**
@@ -677,18 +709,17 @@ export enum EmbedEvent {
677
709
  Load = 'load',
678
710
  /**
679
711
  * Data pertaining to answer or Liveboard is received
680
- *
681
- * @returns data - The answer or Liveboard data
712
+ * @return data - The answer or Liveboard data
713
+ * @important
682
714
  */
683
715
  Data = 'data',
684
716
  /**
685
- * Search/answer/Liveboard filters have been applied/updated
686
- *
717
+ * Search/answer/Liveboard filters have been applied/updated by the user.
687
718
  * @hidden
688
719
  */
689
720
  FiltersChanged = 'filtersChanged',
690
721
  /**
691
- * Search query has been updated
722
+ * Search query has been updated by the user.
692
723
  */
693
724
  QueryChanged = 'queryChanged',
694
725
  /**
@@ -720,17 +751,29 @@ export enum EmbedEvent {
720
751
  */
721
752
  CustomAction = 'customAction',
722
753
  /**
723
- * A double click has been triggered on table/chart
724
- *
725
- * @returns ContextMenuInputPoints - data point that is double clicked
754
+ * Listen to double clicks on a visualization
755
+ * @return ContextMenuInputPoints - data point that is double clicked
726
756
  * @version SDK: 1.5.0 | ThoughtSpot: ts7.oct.cl, 7.2.1
727
757
  */
728
758
  VizPointDoubleClick = 'vizPointDoubleClick',
729
759
  /**
730
- * A click has been triggered on table/chart
760
+ * Listen to clicks on a visualization in a liveboard or Search result.
731
761
  *
732
- * @returns ContextMenuInputPoints - data point that is clicked
762
+ * @example
763
+ * ```js
764
+ * embed.on(ThoughtSpotEmbed.Event.VizPointClick, (data) => {
765
+ * console.log(
766
+ * data.vizId, // viz id
767
+ * data.clickedPoint.selectedAttributes[0].value,
768
+ * data.clickedPoint.selectedAttributes[0].column.name,
769
+ * data.clickedPoint.selectedMeasures[0].value,
770
+ * data.clickedPoint.selectedMeasures[0].column.name,
771
+ * )
772
+ * });
773
+ * ```
774
+ * @return {vizId, clickedPoint} - metadata about point that is clicked
733
775
  * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
776
+ * @important
734
777
  */
735
778
  VizPointClick = 'vizPointClick',
736
779
  /**
@@ -845,6 +888,12 @@ export enum EmbedEvent {
845
888
  * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
846
889
  */
847
890
  Download = 'download',
891
+ /**
892
+ * Emitted when the download action is triggered on an answer
893
+ *
894
+ * @version SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl, 9.4.0-sw
895
+ */
896
+ DownloadAsPng = 'downloadAsPng',
848
897
  /**
849
898
  * Emitted when the Download as PDF action is triggered on an answer
850
899
  *
@@ -1028,8 +1077,7 @@ export enum EmbedEvent {
1028
1077
  */
1029
1078
  CrossFilterChanged = 'cross-filter-changed',
1030
1079
  /**
1031
- * Emitted when a user right clicks on chart or table
1032
- *
1080
+ * Emitted when a user right clicks on a visualization (chart or table)
1033
1081
  * @version SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl
1034
1082
  */
1035
1083
  VizPointRightClick = 'vizPointRightClick',
@@ -1120,10 +1168,11 @@ export enum HostEvent {
1120
1168
  * @param - {@link RuntimeFilter}[] an array of {@link RuntimeFilter} Types.
1121
1169
  * @example
1122
1170
  * liveboardEmbed.trigger(HostEvent.UpdateRuntimeFilters, [
1123
- * {columnName: "state",operator: RuntimeFilterOp.EQ,values: ["michigan"]},
1124
- * {columnName: "item type",operator: RuntimeFilterOp.EQ,values:
1125
- * ["Jackets"]} ])
1171
+ * {columnName: "state",operator: RuntimeFilterOp.EQ,values: ["michigan"]},
1172
+ * {columnName: "item type",operator: RuntimeFilterOp.EQ,values: ["Jackets"]}
1173
+ * ])
1126
1174
  * @version SDK: 1.9.0 | ThoughtSpot: 8.1.0.cl, 8.4.1-sw
1175
+ * @important
1127
1176
  */
1128
1177
  UpdateRuntimeFilters = 'UpdateRuntimeFilters',
1129
1178
  /**
@@ -1375,9 +1424,14 @@ export enum HostEvent {
1375
1424
  *
1376
1425
  * @example
1377
1426
  * ```js
1378
- * searchEmbed.trigger(HostEvent.GetTML)
1427
+ * searchEmbed.trigger(HostEvent.GetTML).then((tml) => {
1428
+ * console.log(
1429
+ * tml.search_query // TML representation of the search query
1430
+ * );
1431
+ * })
1379
1432
  * ```
1380
- * @version SDK: 1.18.0 | ThoughtSpot: 8.10.0.cl
1433
+ * @version SDK: 1.18.0 | ThoughtSpot: 8.10.0.cl, 9.0.1-sw
1434
+ * @important
1381
1435
  */
1382
1436
  GetTML = 'getTML',
1383
1437
  /**
@@ -1426,12 +1480,29 @@ export enum HostEvent {
1426
1480
  * '730496d6-6903-4601-937e-2c691821af3c'})
1427
1481
  * vizEmbed.trigger(HostEvent.Download)
1428
1482
  * searchEmbed.trigger(HostEvent.Download)
1483
+ * @deprecated from SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl, 9.4.1-sw, Please use DownloadAsPng
1429
1484
  * @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
1430
1485
  */
1431
- Download = 'download',
1486
+ Download = 'downloadAsPng',
1487
+ /**
1488
+ * Triggers the Download action on visualization or search when Displaymode is Chart
1489
+ *
1490
+ * @example
1491
+ * ```js
1492
+ * liveboardEmbed.trigger(HostEvent.DownloadAsPng,
1493
+ * {vizId:'730496d6-6903-4601-937e-2c691821af3c'})
1494
+ * ```
1495
+ * ```js
1496
+ * vizEmbed.trigger(HostEvent.DownloadAsPng)
1497
+ * ```
1498
+ * ```js
1499
+ * searchEmbed.trigger(HostEvent.DownloadAsPng)
1500
+ * ```
1501
+ * @version SDK: 1.21.0 | ThoughtSpot: 9.2.0.cl, 9.4.1-sw
1502
+ */
1503
+ DownloadAsPng = 'downloadAsPng',
1432
1504
  /**
1433
- * Triggers the downloadAsCSV action on visualization or search when Displaymode is
1434
- * Table
1505
+ * Triggers the downloadAsCSV action on visualization or search
1435
1506
  *
1436
1507
  * @example
1437
1508
  * liveboardEmbed.trigger(HostEvent.DownloadAsCsv, {vizId:
@@ -1442,8 +1513,7 @@ export enum HostEvent {
1442
1513
  */
1443
1514
  DownloadAsCsv = 'downloadAsCSV',
1444
1515
  /**
1445
- * Triggers the downloadAsXLSX action on visualization or search when Displaymode is
1446
- * Table
1516
+ * Triggers the downloadAsXLSX action on visualization or search
1447
1517
  *
1448
1518
  * @example
1449
1519
  * liveboardEmbed.trigger(HostEvent.DownloadAsXlsx, {vizId:
@@ -1637,6 +1707,7 @@ export enum Action {
1637
1707
  ReplaySearch = 'replaySearch',
1638
1708
  ShowUnderlyingData = 'showUnderlyingData',
1639
1709
  Download = 'download',
1710
+ DownloadAsPng = 'downloadAsPng',
1640
1711
  DownloadAsPdf = 'downloadAsPdf',
1641
1712
  DownloadAsCsv = 'downloadAsCSV',
1642
1713
  DownloadAsXlsx = 'downloadAsXLSX',