@thoughtspot/visual-embed-sdk 1.17.0-alpha.1 → 1.17.0-alpha.3

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 (66) hide show
  1. package/dist/src/embed/base.d.ts +1 -1
  2. package/dist/src/embed/pinboard.d.ts +91 -0
  3. package/dist/src/embed/ts-embed.d.ts +2 -8
  4. package/dist/src/test/test-utils.d.ts +4 -0
  5. package/dist/src/types.d.ts +101 -9
  6. package/dist/src/utils/plugin.d.ts +0 -0
  7. package/dist/src/utils.d.ts +7 -1
  8. package/dist/src/v1/api.d.ts +19 -0
  9. package/dist/tsembed.es.js +1099 -17069
  10. package/dist/tsembed.js +1099 -17069
  11. package/lib/package.json +7 -4
  12. package/lib/src/auth.js +11 -6
  13. package/lib/src/auth.js.map +1 -1
  14. package/lib/src/auth.spec.js +11 -3
  15. package/lib/src/auth.spec.js.map +1 -1
  16. package/lib/src/embed/app.spec.js +2 -6
  17. package/lib/src/embed/app.spec.js.map +1 -1
  18. package/lib/src/embed/base.d.ts +1 -1
  19. package/lib/src/embed/base.js +24 -6
  20. package/lib/src/embed/base.js.map +1 -1
  21. package/lib/src/embed/base.spec.js +33 -0
  22. package/lib/src/embed/base.spec.js.map +1 -1
  23. package/lib/src/embed/liveboard.spec.js +3 -6
  24. package/lib/src/embed/liveboard.spec.js.map +1 -1
  25. package/lib/src/embed/pinboard.d.ts +91 -0
  26. package/lib/src/embed/pinboard.js +110 -0
  27. package/lib/src/embed/pinboard.js.map +1 -0
  28. package/lib/src/embed/pinboard.spec.js +3 -6
  29. package/lib/src/embed/pinboard.spec.js.map +1 -1
  30. package/lib/src/embed/search.spec.js +1 -3
  31. package/lib/src/embed/search.spec.js.map +1 -1
  32. package/lib/src/embed/ts-embed.d.ts +2 -8
  33. package/lib/src/embed/ts-embed.js +15 -18
  34. package/lib/src/embed/ts-embed.js.map +1 -1
  35. package/lib/src/embed/ts-embed.spec.js +23 -4
  36. package/lib/src/embed/ts-embed.spec.js.map +1 -1
  37. package/lib/src/react/index.spec.js +2 -2
  38. package/lib/src/react/index.spec.js.map +1 -1
  39. package/lib/src/test/test-utils.d.ts +4 -0
  40. package/lib/src/test/test-utils.js +19 -1
  41. package/lib/src/test/test-utils.js.map +1 -1
  42. package/lib/src/types.d.ts +101 -9
  43. package/lib/src/types.js +86 -7
  44. package/lib/src/types.js.map +1 -1
  45. package/lib/src/utils/plugin.d.ts +0 -0
  46. package/lib/src/utils/plugin.js +1 -0
  47. package/lib/src/utils/plugin.js.map +1 -0
  48. package/lib/src/utils.d.ts +7 -1
  49. package/lib/src/utils.js +10 -0
  50. package/lib/src/utils.js.map +1 -1
  51. package/lib/src/visual-embed-sdk.d.ts +104 -12
  52. package/package.json +7 -4
  53. package/src/auth.spec.ts +11 -3
  54. package/src/auth.ts +20 -10
  55. package/src/embed/app.spec.ts +4 -4
  56. package/src/embed/base.spec.ts +38 -0
  57. package/src/embed/base.ts +33 -6
  58. package/src/embed/liveboard.spec.ts +4 -4
  59. package/src/embed/pinboard.spec.ts +4 -4
  60. package/src/embed/search.spec.ts +1 -1
  61. package/src/embed/ts-embed.spec.ts +27 -6
  62. package/src/embed/ts-embed.ts +19 -18
  63. package/src/react/index.spec.tsx +2 -2
  64. package/src/test/test-utils.ts +21 -2
  65. package/src/types.ts +100 -7
  66. package/src/utils.ts +12 -0
package/src/types.ts CHANGED
@@ -17,23 +17,52 @@ export enum AuthType {
17
17
  * No authentication on the SDK. Passthrough to the embedded App. Alias for `Passthrough`.
18
18
  */
19
19
  None = 'None',
20
+ /**
21
+ * Passthrough SSO to the embedded App within the iframe. Requires least configuration, but may not
22
+ * be supported by all IDPs. This will behave like `None` if SSO is not configured on ThoughtSpot.
23
+ * @version: SDK: 1.15.0 | ThouhgtSpot: 8.8.0.cl
24
+ */
25
+ EmbeddedSSO = 'EmbeddedSSO',
20
26
  /**
21
27
  * SSO using SAML
22
- * @deprecated Use {@link SAML} instead
28
+ * @deprecated Use {@link SAMLRedirect} instead
29
+ * @hidden
23
30
  */
24
31
  SSO = 'SSO_SAML',
25
32
  /**
26
33
  * SSO using SAML
34
+ * @deprecated Use {@link SAMLRedirect} instead
35
+ * @hidden
27
36
  */
28
37
  SAML = 'SSO_SAML',
38
+ /**
39
+ * SSO using SAML
40
+ * Will make the host application redirect to the SAML Idp.
41
+ */
42
+ SAMLRedirect = 'SSO_SAML',
29
43
  /**
30
44
  * SSO using OIDC
45
+ * @hidden
46
+ * @deprecated Use {@link OIDCRedirect} instead
31
47
  */
32
48
  OIDC = 'SSO_OIDC',
49
+ /**
50
+ * SSO using OIDC
51
+ * Will make the host application redirect to the OIDC Idp.
52
+ */
53
+ OIDCRedirect = 'SSO_OIDC',
33
54
  /**
34
55
  * Trusted authentication server
56
+ * @hidden
57
+ * @deprecated Use {@link TrustedAuth} instead
35
58
  */
36
59
  AuthServer = 'AuthServer',
60
+ /**
61
+ * Trusted authentication server, Use you own authentication server
62
+ * which returns a bearer token, generated using the secret_key obtained from
63
+ * ThoughtSpot.
64
+ */
65
+ TrustedAuthToken = 'AuthServer',
37
66
  /**
38
67
  * Use the ThoughtSpot login API to authenticate to the cluster directly.
39
68
  *
@@ -216,6 +245,20 @@ export interface EmbedConfig {
216
245
  * @version SDK: 1.17.0 | ThoughtSpot: 8.9.0.cl
217
246
  */
218
247
  customisations?: CustomisationsInterface;
248
+ /**
249
+ * For noRedirect SSO Auth, we need a button which the user
250
+ * click to trigger the flow. This is the containing element
251
+ * for that button.
252
+ *
253
+ * @version SDK: 1.17.0 | ThoughtSpot: *
254
+ */
255
+ authTriggerContainer?: string | HTMLElement;
256
+ /**
257
+ * Text to show in the button which triggers the popup auth flow.
258
+ * Default: "Authorize".
259
+ * @version SDK: 1.17.0 | ThoughtSpot: *
260
+ */
261
+ authTriggerText?: string;
219
262
  }
220
263
 
221
264
  /**
@@ -663,16 +706,25 @@ export enum EmbedEvent {
663
706
  export enum HostEvent {
664
707
  /**
665
708
  * Trigger a search
666
- * @param dataSourceIds - The list of data source GUIDs
667
- * @param searchQuery - The search query
709
+ * @param - dataSourceIds - The list of data source GUIDs
710
+ * @param - searchQuery - The search query
711
+ * @example
712
+ * searchEmbed.trigger(HostEvent.Search, {
713
+ * searchQuery: "[sales] by [item type],
714
+ * "dataSourceIds: ["cd252e5c-b552-49a8-821d-3eadaa049cca"]
715
+ * })
668
716
  */
669
717
  Search = 'search',
670
718
  /**
671
719
  * Trigger a drill on certain points by certain column
672
- * @param points - an object containing selectedPoints/clickedPoints
720
+ * @param - points - an object containing selectedPoints/clickedPoints
673
721
  * eg. { selectedPoints: []}
674
- * @param columnGuid - a string guid of the column to drill by. This is optional,
722
+ * @param - columnGuid - a string guid of the column to drill by. This is optional,
675
723
  * if not provided it will auto drill by the configured column.
724
+ * @example searchEmbed.trigger(HostEvent.DrillDown, {
725
+ * points: clickedPointData,
726
+ * autoDrillDown: true,
727
+ * })
676
728
  * @version SDK: 1.5.0 | ThoughtSpot: ts7.oct.cl, 7.2.1
677
729
  */
678
730
  DrillDown = 'triggerDrillDown',
@@ -690,6 +742,8 @@ export enum HostEvent {
690
742
  * Set the visible visualizations on a Liveboard.
691
743
  * @param - an array of ids of visualizations to show, the ids not passed
692
744
  * will be hidden.
745
+ * @example
746
+ * liveboardEmbed.trigger(HostEvent.SetVisibleVizs, ['730496d6-6903-4601-937e-2c691821af3c', 'd547ec54-2a37-4516-a222-2b06719af726'])
693
747
  * @version SDK: 1.6.0 | ThoughtSpot: ts8.nov.cl, 8.4.1-sw
694
748
  */
695
749
  SetVisibleVizs = 'SetPinboardVisibleVizs',
@@ -697,18 +751,25 @@ export enum HostEvent {
697
751
  * Update the runtime filters. The runtime filters passed here are extended
698
752
  * on to the existing runtime filters if they exist.
699
753
  * @param - {@link RuntimeFilter}[] an array of {@link RuntimeFilter} Types.
754
+ * @example
755
+ * liveboardEmbed.trigger(HostEvent.UpdateRuntimeFilters, [
756
+ * {columnName: "state",operator: "EQ",values: ["michigan"]},
757
+ * {columnName: "item type",operator: "EQ",values: ["Jackets"]}
758
+ * ])
700
759
  * @version SDK: 1.9.0 | ThoughtSpot: 8.1.0.cl, 8.4.1-sw
701
760
  */
702
761
  UpdateRuntimeFilters = 'UpdateRuntimeFilters',
703
762
  /**
704
763
  * Navigate to a specific page in App embed without any reload.
705
764
  * This is the same as calling `appEmbed.navigateToPage(path, true)`
706
- * @param path - the path to navigate to (can be a number[1/-1] to go forward/back)
765
+ * @param - path - the path to navigate to (can be a number[1/-1] to go forward/back)
766
+ * @example appEmbed.navigateToPage(-1)
707
767
  * @version SDK: 1.12.0 | ThoughtSpot 8.4.0.cl, 8.4.1-sw
708
768
  */
709
769
  Navigate = 'Navigate',
710
770
  /**
711
771
  * Gets the current pinboard content.
772
+ * @example liveboardEmbed.trigger(HostEvent.getExportRequestForCurrentPinboard)
712
773
  * @version SDK: 1.13.0 | ThoughtSpot: 8.5.0.cl, 8.8.1-sw
713
774
  */
714
775
  getExportRequestForCurrentPinboard = 'getExportRequestForCurrentPinboard',
@@ -716,70 +777,82 @@ export enum HostEvent {
716
777
  * Triggers the Pin action on an embedded object
717
778
  * @param - incase of Liveboard embed, takes in an object with vizId as a key
718
779
  * can be left empty for search and visualization embeds
780
+ * @example liveboardEmbed.trigger(HostEvent.Pin, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
719
781
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
720
782
  */
721
783
  Pin = 'pin',
722
784
  /**
723
785
  * Triggers the Show Liveboard details action on a Liveboard
786
+ * @example liveboardEmbed.trigger(HostEvent.LiveboardInfo)
724
787
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
725
788
  */
726
789
  LiveboardInfo = 'pinboardInfo',
727
790
  /**
728
791
  * Triggers the Schedule action on a Liveboard
792
+ * @example liveboardEmbed.trigger(HostEvent.Schedule)
729
793
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
730
794
  */
731
795
  Schedule = 'subscription',
732
796
  /**
733
797
  * Triggers the Manage schedule action on a Liveboard
798
+ * @example liveboardEmbed.trigger(HostEvent.ScheduleList)
734
799
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
735
800
  */
736
801
  SchedulesList = 'schedule-list',
737
802
  /**
738
803
  * Triggers the Export TML action on a Liveboard
804
+ * @example liveboardEmbed.trigger(HostEvent.ExportTML)
739
805
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
740
806
  */
741
807
  ExportTML = 'exportTSL',
742
808
  /**
743
809
  * Triggers the Edit TML action on a Liveboard
810
+ * @example liveboardEmbed.trigger(HostEvent.EditTML)
744
811
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
745
812
  */
746
813
  EditTML = 'editTSL',
747
814
  /**
748
815
  * Triggers the Update TML action on a Liveboard
816
+ * @example liveboardEmbed.trigger(HostEvent.UpdateTML)
749
817
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
750
818
  */
751
819
  UpdateTML = 'updateTSL',
752
820
  /**
753
821
  * Triggers the Download PDF action on a Liveboard
822
+ * @example liveboardEmbed.trigger(HostEvent.DownloadAsPDF)
754
823
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
755
824
  */
756
825
  DownloadAsPdf = 'downloadAsPdf',
757
826
  /**
758
827
  * Triggers the Make a copy action on a Liveboard
828
+ * @example liveboardEmbed.trigger(HostEvent.MakeACopy)
759
829
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
760
830
  */
761
831
  MakeACopy = 'makeACopy',
762
832
  /**
763
833
  * Triggers the Delete action on a Liveboard
834
+ * @example appEmbed.trigger(HostEvent.Remove)
764
835
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
765
836
  */
766
837
  Remove = 'delete',
767
838
  /**
768
839
  * Triggers the Explore action on a visualization
769
840
  * @param - an object with vizId as a key
770
- * eg: {vizId: '730496d6-6903-4601-937e-2c691821af3c'}
841
+ * @example liveboardEmbed.trigger(HostEvent.Explore, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
771
842
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
772
843
  */
773
844
  Explore = 'explore',
774
845
  /**
775
846
  * Triggers the Create alert action on a visualization
776
847
  * @param - an object with vizId as a key
848
+ * @example liveboardEmbed.trigger(HostEvent.CreateMonitor {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
777
849
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
778
850
  */
779
851
  CreateMonitor = 'createMonitor',
780
852
  /**
781
853
  * Triggers the Manage alert action on a visualization
782
854
  * @param - an object with vizId as a key
855
+ * @example liveboardEmbed.trigger(HostEvent.ManageMonitor, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
783
856
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
784
857
  */
785
858
  ManageMonitor = 'manageMonitor',
@@ -815,9 +888,26 @@ export enum HostEvent {
815
888
  Present = 'present',
816
889
  /**
817
890
  * Get TML for the current search.
891
+ * @example searchEmbed.trigger(HostEvent.GetTML)
818
892
  * @version SDK: 1.18.0 | ThoughtSpot: 8.10.0.cl
819
893
  */
820
894
  GetTML = 'getTML',
895
+ /**
896
+ * Triggers the Share action on a liveboard or answer
897
+ * @example
898
+ * liveboardEmbed.trigger(HostEvent.Share)
899
+ * searchEmbed.trigger(HostEvent.Share)
900
+ * @version SDK: 1.18.0 | Thoughtspot: 9.0.0.cl
901
+ */
902
+ Share = 'share',
903
+ /**
904
+ * Trigger the Save action on a liveboard or answer
905
+ * @example
906
+ * liveboardEmbed.trigger(HostEvent.Save)
907
+ * searchEmbed.trigger(HostEvent.Save)
908
+ * @version SDK: 1.18.0 | Thoughtspot: 9.0.0.cl
909
+ */
910
+ Save = 'save',
821
911
  }
822
912
 
823
913
  /**
@@ -878,6 +968,9 @@ export enum Param {
878
968
  ShowAlerts = 'showAlerts',
879
969
  Locale = 'locale',
880
970
  CustomStyle = 'customStyle',
971
+ ForceSAMLAutoRedirect = 'forceSAMLAutoRedirect',
972
+ // eslint-disable-next-line @typescript-eslint/no-shadow
973
+ AuthType = 'authType',
881
974
  }
882
975
 
883
976
  /**
package/src/utils.ts CHANGED
@@ -12,6 +12,7 @@ import {
12
12
  QueryParams,
13
13
  RuntimeFilter,
14
14
  CustomisationsInterface,
15
+ DOMSelector,
15
16
  } from './types';
16
17
 
17
18
  /**
@@ -187,3 +188,14 @@ export const getCustomisations = (
187
188
  customisations.style.customCSSUrl || customCssUrl;
188
189
  return customisations;
189
190
  };
191
+
192
+ /**
193
+ * Gets a reference to the DOM node given
194
+ * a selector.
195
+ * @param domSelector
196
+ */
197
+ export function getDOMNode(domSelector: DOMSelector): HTMLElement {
198
+ return typeof domSelector === 'string'
199
+ ? document.querySelector(domSelector)
200
+ : domSelector;
201
+ }