@thoughtspot/visual-embed-sdk 1.17.0-alpha.0 → 1.17.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 (57) hide show
  1. package/dist/src/embed/base.d.ts +1 -1
  2. package/dist/src/embed/ts-embed.d.ts +2 -8
  3. package/dist/src/test/test-utils.d.ts +4 -0
  4. package/dist/src/types.d.ts +105 -10
  5. package/dist/src/utils.d.ts +7 -1
  6. package/dist/tsembed.es.js +1099 -17069
  7. package/dist/tsembed.js +1099 -17069
  8. package/lib/package.json +2 -2
  9. package/lib/src/auth.js +11 -6
  10. package/lib/src/auth.js.map +1 -1
  11. package/lib/src/auth.spec.js +11 -3
  12. package/lib/src/auth.spec.js.map +1 -1
  13. package/lib/src/embed/app.spec.js +2 -6
  14. package/lib/src/embed/app.spec.js.map +1 -1
  15. package/lib/src/embed/base.d.ts +1 -1
  16. package/lib/src/embed/base.js +24 -6
  17. package/lib/src/embed/base.js.map +1 -1
  18. package/lib/src/embed/base.spec.js +33 -0
  19. package/lib/src/embed/base.spec.js.map +1 -1
  20. package/lib/src/embed/liveboard.spec.js +3 -6
  21. package/lib/src/embed/liveboard.spec.js.map +1 -1
  22. package/lib/src/embed/pinboard.spec.js +3 -6
  23. package/lib/src/embed/pinboard.spec.js.map +1 -1
  24. package/lib/src/embed/search.spec.js +1 -3
  25. package/lib/src/embed/search.spec.js.map +1 -1
  26. package/lib/src/embed/ts-embed.d.ts +2 -8
  27. package/lib/src/embed/ts-embed.js +12 -18
  28. package/lib/src/embed/ts-embed.js.map +1 -1
  29. package/lib/src/embed/ts-embed.spec.js +23 -4
  30. package/lib/src/embed/ts-embed.spec.js.map +1 -1
  31. package/lib/src/react/index.spec.js +2 -2
  32. package/lib/src/react/index.spec.js.map +1 -1
  33. package/lib/src/test/test-utils.d.ts +4 -0
  34. package/lib/src/test/test-utils.js +19 -1
  35. package/lib/src/test/test-utils.js.map +1 -1
  36. package/lib/src/types.d.ts +105 -10
  37. package/lib/src/types.js +89 -7
  38. package/lib/src/types.js.map +1 -1
  39. package/lib/src/utils.d.ts +7 -1
  40. package/lib/src/utils.js +10 -0
  41. package/lib/src/utils.js.map +1 -1
  42. package/lib/src/visual-embed-sdk.d.ts +108 -13
  43. package/package.json +2 -2
  44. package/src/auth.spec.ts +11 -3
  45. package/src/auth.ts +20 -10
  46. package/src/embed/app.spec.ts +4 -4
  47. package/src/embed/base.spec.ts +38 -0
  48. package/src/embed/base.ts +33 -6
  49. package/src/embed/liveboard.spec.ts +4 -4
  50. package/src/embed/pinboard.spec.ts +4 -4
  51. package/src/embed/search.spec.ts +1 -1
  52. package/src/embed/ts-embed.spec.ts +27 -6
  53. package/src/embed/ts-embed.ts +16 -18
  54. package/src/react/index.spec.tsx +2 -2
  55. package/src/test/test-utils.ts +21 -2
  56. package/src/types.ts +103 -7
  57. package/src/utils.ts +12 -0
@@ -55,5 +55,5 @@ export declare const logout: (doNotDisableAutoLogin?: boolean) => Promise<boolea
55
55
  * Renders functions in a queue, resolves to next function only after the callback next is called
56
56
  * @param fn The function being registered
57
57
  */
58
- export declare const renderInQueue: (fn: (next?: (val?: any) => void) => void) => void;
58
+ export declare const renderInQueue: (fn: (next?: (val?: any) => void) => Promise<any>) => Promise<any>;
59
59
  export declare function reset(): void;
@@ -144,12 +144,6 @@ export declare class TsEmbed {
144
144
  private shouldEncodeUrlQueryParams;
145
145
  private defaultHiddenActions;
146
146
  constructor(domSelector: DOMSelector, viewConfig?: ViewConfig);
147
- /**
148
- * Gets a reference to the root DOM node where
149
- * the embedded content will appear.
150
- * @param domSelector
151
- */
152
- private getDOMNode;
153
147
  /**
154
148
  * Throws error encountered during initialization.
155
149
  */
@@ -214,7 +208,7 @@ export declare class TsEmbed {
214
208
  * @param url
215
209
  * @param frameOptions
216
210
  */
217
- protected renderIFrame(url: string, frameOptions?: FrameParams): void;
211
+ protected renderIFrame(url: string, frameOptions?: FrameParams): Promise<any>;
218
212
  /**
219
213
  * Sets the height of the iframe
220
214
  * @param height The height in pixels
@@ -302,6 +296,6 @@ export declare class V1Embed extends TsEmbed {
302
296
  * Render the app in an iframe and set up event handlers
303
297
  * @param iframeSrc
304
298
  */
305
- protected renderV1Embed(iframeSrc: string): void;
299
+ protected renderV1Embed(iframeSrc: string): any;
306
300
  on(messageType: EmbedEvent, callback: MessageCallback, options?: MessageOptions): typeof TsEmbed.prototype;
307
301
  }
@@ -1,3 +1,6 @@
1
+ export declare const defaultParamsWithoutHiddenActions: string;
2
+ export declare const defaultParams: string;
3
+ export declare const defaultParamsForPinboardEmbed: string;
1
4
  export declare const getDocumentBody: () => string;
2
5
  declare type DOMElement = HTMLElement | Document;
3
6
  export declare const getRootEl: () => HTMLElement;
@@ -5,6 +8,7 @@ export declare const getRootEl2: () => HTMLElement;
5
8
  export declare const getIFrameEl: (container?: DOMElement) => HTMLIFrameElement;
6
9
  export declare const getAllIframeEl: () => NodeListOf<HTMLIFrameElement>;
7
10
  export declare const getIFrameSrc: (container?: DOMElement) => string;
11
+ export declare const waitFor: (fn: () => boolean) => Promise<void>;
8
12
  /**
9
13
  * jsdom does not set event source, therefore we do it
10
14
  * programmatically and use dispatchEvent instead of the
@@ -15,23 +15,52 @@ export declare enum AuthType {
15
15
  * No authentication on the SDK. Passthrough to the embedded App. Alias for `Passthrough`.
16
16
  */
17
17
  None = "None",
18
+ /**
19
+ * Passthrough SSO to the embedded App within the iframe. Requires least configuration, but may not
20
+ * be supported by all IDPs. This will behave like `None` if SSO is not configured on ThoughtSpot.
21
+ * @version: SDK: 1.15.0 | ThouhgtSpot: 8.8.0.cl
22
+ */
23
+ EmbeddedSSO = "EmbeddedSSO",
18
24
  /**
19
25
  * SSO using SAML
20
- * @deprecated Use {@link SAML} instead
26
+ * @deprecated Use {@link SAMLRedirect} instead
27
+ * @hidden
21
28
  */
22
29
  SSO = "SSO_SAML",
23
30
  /**
24
31
  * SSO using SAML
32
+ * @deprecated Use {@link SAMLRedirect} instead
33
+ * @hidden
25
34
  */
26
35
  SAML = "SSO_SAML",
36
+ /**
37
+ * SSO using SAML
38
+ * Will make the host application redirect to the SAML Idp.
39
+ */
40
+ SAMLRedirect = "SSO_SAML",
27
41
  /**
28
42
  * SSO using OIDC
43
+ * @hidden
44
+ * @deprecated Use {@link OIDCRedirect} instead
29
45
  */
30
46
  OIDC = "SSO_OIDC",
47
+ /**
48
+ * SSO using OIDC
49
+ * Will make the host application redirect to the OIDC Idp.
50
+ */
51
+ OIDCRedirect = "SSO_OIDC",
31
52
  /**
32
53
  * Trusted authentication server
54
+ * @hidden
55
+ * @deprecated Use {@link TrustedAuth} instead
33
56
  */
34
57
  AuthServer = "AuthServer",
58
+ /**
59
+ * Trusted authentication server, Use you own authentication server
60
+ * which returns a bearer token, generated using the secret_key obtained from
61
+ * ThoughtSpot.
62
+ */
63
+ TrustedAuthToken = "AuthServer",
35
64
  /**
36
65
  * Use the ThoughtSpot login API to authenticate to the cluster directly.
37
66
  *
@@ -198,6 +227,20 @@ export interface EmbedConfig {
198
227
  * @version SDK: 1.17.0 | ThoughtSpot: 8.9.0.cl
199
228
  */
200
229
  customisations?: CustomisationsInterface;
230
+ /**
231
+ * For noRedirect SSO Auth, we need a button which the user
232
+ * click to trigger the flow. This is the containing element
233
+ * for that button.
234
+ *
235
+ * @version SDK: 1.17.0 | ThoughtSpot: *
236
+ */
237
+ authTriggerContainer?: string | HTMLElement;
238
+ /**
239
+ * Text to show in the button which triggers the popup auth flow.
240
+ * Default: "Authorize".
241
+ * @version SDK: 1.17.0 | ThoughtSpot: *
242
+ */
243
+ authTriggerText?: string;
201
244
  }
202
245
  /**
203
246
  * MessagePayload: Embed event payload: message type, data and status (start/end)
@@ -624,16 +667,25 @@ export declare enum EmbedEvent {
624
667
  export declare enum HostEvent {
625
668
  /**
626
669
  * Trigger a search
627
- * @param dataSourceIds - The list of data source GUIDs
628
- * @param searchQuery - The search query
670
+ * @param - dataSourceIds - The list of data source GUIDs
671
+ * @param - searchQuery - The search query
672
+ * @example
673
+ * searchEmbed.trigger(HostEvent.Search, {
674
+ * searchQuery: "[sales] by [item type],
675
+ * "dataSourceIds: ["cd252e5c-b552-49a8-821d-3eadaa049cca"]
676
+ * })
629
677
  */
630
678
  Search = "search",
631
679
  /**
632
680
  * Trigger a drill on certain points by certain column
633
- * @param points - an object containing selectedPoints/clickedPoints
681
+ * @param - points - an object containing selectedPoints/clickedPoints
634
682
  * eg. { selectedPoints: []}
635
- * @param columnGuid - a string guid of the column to drill by. This is optional,
683
+ * @param - columnGuid - a string guid of the column to drill by. This is optional,
636
684
  * if not provided it will auto drill by the configured column.
685
+ * @example searchEmbed.trigger(HostEvent.DrillDown, {
686
+ * points: clickedPointData,
687
+ * autoDrillDown: true,
688
+ * })
637
689
  * @version SDK: 1.5.0 | ThoughtSpot: ts7.oct.cl, 7.2.1
638
690
  */
639
691
  DrillDown = "triggerDrillDown",
@@ -651,6 +703,8 @@ export declare enum HostEvent {
651
703
  * Set the visible visualizations on a Liveboard.
652
704
  * @param - an array of ids of visualizations to show, the ids not passed
653
705
  * will be hidden.
706
+ * @example
707
+ * liveboardEmbed.trigger(HostEvent.SetVisibleVizs, ['730496d6-6903-4601-937e-2c691821af3c', 'd547ec54-2a37-4516-a222-2b06719af726'])
654
708
  * @version SDK: 1.6.0 | ThoughtSpot: ts8.nov.cl, 8.4.1-sw
655
709
  */
656
710
  SetVisibleVizs = "SetPinboardVisibleVizs",
@@ -658,18 +712,25 @@ export declare enum HostEvent {
658
712
  * Update the runtime filters. The runtime filters passed here are extended
659
713
  * on to the existing runtime filters if they exist.
660
714
  * @param - {@link RuntimeFilter}[] an array of {@link RuntimeFilter} Types.
715
+ * @example
716
+ * liveboardEmbed.trigger(HostEvent.UpdateRuntimeFilters, [
717
+ * {columnName: "state",operator: "EQ",values: ["michigan"]},
718
+ * {columnName: "item type",operator: "EQ",values: ["Jackets"]}
719
+ * ])
661
720
  * @version SDK: 1.9.0 | ThoughtSpot: 8.1.0.cl, 8.4.1-sw
662
721
  */
663
722
  UpdateRuntimeFilters = "UpdateRuntimeFilters",
664
723
  /**
665
724
  * Navigate to a specific page in App embed without any reload.
666
725
  * This is the same as calling `appEmbed.navigateToPage(path, true)`
667
- * @param path - the path to navigate to (can be a number[1/-1] to go forward/back)
726
+ * @param - path - the path to navigate to (can be a number[1/-1] to go forward/back)
727
+ * @example appEmbed.navigateToPage(-1)
668
728
  * @version SDK: 1.12.0 | ThoughtSpot 8.4.0.cl, 8.4.1-sw
669
729
  */
670
730
  Navigate = "Navigate",
671
731
  /**
672
732
  * Gets the current pinboard content.
733
+ * @example liveboardEmbed.trigger(HostEvent.getExportRequestForCurrentPinboard)
673
734
  * @version SDK: 1.13.0 | ThoughtSpot: 8.5.0.cl, 8.8.1-sw
674
735
  */
675
736
  getExportRequestForCurrentPinboard = "getExportRequestForCurrentPinboard",
@@ -677,70 +738,82 @@ export declare enum HostEvent {
677
738
  * Triggers the Pin action on an embedded object
678
739
  * @param - incase of Liveboard embed, takes in an object with vizId as a key
679
740
  * can be left empty for search and visualization embeds
741
+ * @example liveboardEmbed.trigger(HostEvent.Pin, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
680
742
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
681
743
  */
682
744
  Pin = "pin",
683
745
  /**
684
746
  * Triggers the Show Liveboard details action on a Liveboard
747
+ * @example liveboardEmbed.trigger(HostEvent.LiveboardInfo)
685
748
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
686
749
  */
687
750
  LiveboardInfo = "pinboardInfo",
688
751
  /**
689
752
  * Triggers the Schedule action on a Liveboard
753
+ * @example liveboardEmbed.trigger(HostEvent.Schedule)
690
754
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
691
755
  */
692
756
  Schedule = "subscription",
693
757
  /**
694
758
  * Triggers the Manage schedule action on a Liveboard
759
+ * @example liveboardEmbed.trigger(HostEvent.ScheduleList)
695
760
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
696
761
  */
697
762
  SchedulesList = "schedule-list",
698
763
  /**
699
764
  * Triggers the Export TML action on a Liveboard
765
+ * @example liveboardEmbed.trigger(HostEvent.ExportTML)
700
766
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
701
767
  */
702
768
  ExportTML = "exportTSL",
703
769
  /**
704
770
  * Triggers the Edit TML action on a Liveboard
771
+ * @example liveboardEmbed.trigger(HostEvent.EditTML)
705
772
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
706
773
  */
707
774
  EditTML = "editTSL",
708
775
  /**
709
776
  * Triggers the Update TML action on a Liveboard
777
+ * @example liveboardEmbed.trigger(HostEvent.UpdateTML)
710
778
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
711
779
  */
712
780
  UpdateTML = "updateTSL",
713
781
  /**
714
782
  * Triggers the Download PDF action on a Liveboard
783
+ * @example liveboardEmbed.trigger(HostEvent.DownloadAsPDF)
715
784
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
716
785
  */
717
786
  DownloadAsPdf = "downloadAsPdf",
718
787
  /**
719
788
  * Triggers the Make a copy action on a Liveboard
789
+ * @example liveboardEmbed.trigger(HostEvent.MakeACopy)
720
790
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
721
791
  */
722
792
  MakeACopy = "makeACopy",
723
793
  /**
724
794
  * Triggers the Delete action on a Liveboard
795
+ * @example appEmbed.trigger(HostEvent.Remove)
725
796
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
726
797
  */
727
798
  Remove = "delete",
728
799
  /**
729
800
  * Triggers the Explore action on a visualization
730
801
  * @param - an object with vizId as a key
731
- * eg: {vizId: '730496d6-6903-4601-937e-2c691821af3c'}
802
+ * @example liveboardEmbed.trigger(HostEvent.Explore, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
732
803
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
733
804
  */
734
805
  Explore = "explore",
735
806
  /**
736
807
  * Triggers the Create alert action on a visualization
737
808
  * @param - an object with vizId as a key
809
+ * @example liveboardEmbed.trigger(HostEvent.CreateMonitor {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
738
810
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
739
811
  */
740
812
  CreateMonitor = "createMonitor",
741
813
  /**
742
814
  * Triggers the Manage alert action on a visualization
743
815
  * @param - an object with vizId as a key
816
+ * @example liveboardEmbed.trigger(HostEvent.ManageMonitor, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
744
817
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
745
818
  */
746
819
  ManageMonitor = "manageMonitor",
@@ -776,9 +849,26 @@ export declare enum HostEvent {
776
849
  Present = "present",
777
850
  /**
778
851
  * Get TML for the current search.
852
+ * @example searchEmbed.trigger(HostEvent.GetTML)
779
853
  * @version SDK: 1.18.0 | ThoughtSpot: 8.10.0.cl
780
854
  */
781
- GetTML = "getTML"
855
+ GetTML = "getTML",
856
+ /**
857
+ * Triggers the Share action on a liveboard or answer
858
+ * @example
859
+ * liveboardEmbed.trigger(HostEvent.Share)
860
+ * searchEmbed.trigger(HostEvent.Share)
861
+ * @version SDK: 1.18.0 | Thoughtspot: 9.0.0.cl
862
+ */
863
+ Share = "share",
864
+ /**
865
+ * Trigger the Save action on a liveboard or answer
866
+ * @example
867
+ * liveboardEmbed.trigger(HostEvent.Save)
868
+ * searchEmbed.trigger(HostEvent.Save)
869
+ * @version SDK: 1.18.0 | Thoughtspot: 9.0.0.cl
870
+ */
871
+ Save = "save"
782
872
  }
783
873
  /**
784
874
  * The different visual modes that the data sources panel within
@@ -834,7 +924,9 @@ export declare enum Param {
834
924
  LiveboardV2Enabled = "isPinboardV2Enabled",
835
925
  ShowAlerts = "showAlerts",
836
926
  Locale = "locale",
837
- CustomStyle = "customStyle"
927
+ CustomStyle = "customStyle",
928
+ ForceSAMLAutoRedirect = "forceSAMLAutoRedirect",
929
+ AuthType = "authType"
838
930
  }
839
931
  /**
840
932
  * The list of actions that can be performed on visual ThoughtSpot
@@ -978,7 +1070,10 @@ export declare enum Action {
978
1070
  /**
979
1071
  * @version SDK: 1.11.1 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
980
1072
  */
981
- ReportError = "reportError"
1073
+ ReportError = "reportError",
1074
+ SyncToSheets = "sync-to-sheets",
1075
+ SyncToOtherApps = "sync-to-other-apps",
1076
+ ManagePipelines = "manage-pipeline"
982
1077
  }
983
1078
  export interface SessionInterface {
984
1079
  sessionId: string;
@@ -6,7 +6,7 @@
6
6
  * @summary Utils
7
7
  * @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
8
8
  */
9
- import { EmbedConfig, QueryParams, RuntimeFilter, CustomisationsInterface } from './types';
9
+ import { EmbedConfig, QueryParams, RuntimeFilter, CustomisationsInterface, DOMSelector } from './types';
10
10
  /**
11
11
  * Construct a runtime filters query string from the given filters.
12
12
  * Refer to the following docs for more details on runtime filter syntax:
@@ -44,3 +44,9 @@ export declare const setAttributes: (element: HTMLElement, attributes: {
44
44
  }) => void;
45
45
  export declare const checkReleaseVersionInBeta: (releaseVersion: string, suppressBetaWarning: boolean) => boolean;
46
46
  export declare const getCustomisations: (embedConfig: EmbedConfig) => CustomisationsInterface;
47
+ /**
48
+ * Gets a reference to the DOM node given
49
+ * a selector.
50
+ * @param domSelector
51
+ */
52
+ export declare function getDOMNode(domSelector: DOMSelector): HTMLElement;