@thoughtspot/visual-embed-sdk 1.13.0-alpha.1 → 1.13.0-alpha.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 (59) hide show
  1. package/dist/src/auth.d.ts +13 -0
  2. package/dist/src/embed/app.d.ts +5 -0
  3. package/dist/src/embed/base.d.ts +1 -0
  4. package/dist/src/embed/ts-embed.d.ts +9 -1
  5. package/dist/src/types.d.ts +191 -6
  6. package/dist/src/utils.d.ts +2 -1
  7. package/dist/tsembed.es.js +222 -8
  8. package/dist/tsembed.js +222 -8
  9. package/lib/package.json +1 -1
  10. package/lib/src/auth.d.ts +13 -0
  11. package/lib/src/auth.js +14 -0
  12. package/lib/src/auth.js.map +1 -1
  13. package/lib/src/auth.spec.js +9 -0
  14. package/lib/src/auth.spec.js.map +1 -1
  15. package/lib/src/config.spec.js +7 -0
  16. package/lib/src/config.spec.js.map +1 -1
  17. package/lib/src/embed/app.d.ts +5 -0
  18. package/lib/src/embed/app.js +1 -1
  19. package/lib/src/embed/app.js.map +1 -1
  20. package/lib/src/embed/app.spec.js +10 -0
  21. package/lib/src/embed/app.spec.js.map +1 -1
  22. package/lib/src/embed/base.d.ts +1 -0
  23. package/lib/src/embed/base.js +10 -0
  24. package/lib/src/embed/base.js.map +1 -1
  25. package/lib/src/embed/base.spec.js +16 -0
  26. package/lib/src/embed/base.spec.js.map +1 -1
  27. package/lib/src/embed/liveboard.js +4 -1
  28. package/lib/src/embed/liveboard.js.map +1 -1
  29. package/lib/src/embed/liveboard.spec.js +3 -2
  30. package/lib/src/embed/liveboard.spec.js.map +1 -1
  31. package/lib/src/embed/pinboard.spec.js +3 -2
  32. package/lib/src/embed/pinboard.spec.js.map +1 -1
  33. package/lib/src/embed/ts-embed.d.ts +9 -1
  34. package/lib/src/embed/ts-embed.js +21 -3
  35. package/lib/src/embed/ts-embed.js.map +1 -1
  36. package/lib/src/embed/ts-embed.spec.js +26 -0
  37. package/lib/src/embed/ts-embed.spec.js.map +1 -1
  38. package/lib/src/types.d.ts +191 -6
  39. package/lib/src/types.js +163 -3
  40. package/lib/src/types.js.map +1 -1
  41. package/lib/src/utils.d.ts +2 -1
  42. package/lib/src/utils.js +9 -0
  43. package/lib/src/utils.js.map +1 -1
  44. package/lib/src/visual-embed-sdk.d.ts +211 -7
  45. package/package.json +2 -2
  46. package/src/auth.spec.ts +10 -0
  47. package/src/auth.ts +14 -0
  48. package/src/config.spec.ts +11 -0
  49. package/src/embed/app.spec.ts +14 -0
  50. package/src/embed/app.ts +6 -0
  51. package/src/embed/base.spec.ts +18 -0
  52. package/src/embed/base.ts +10 -0
  53. package/src/embed/liveboard.spec.ts +4 -2
  54. package/src/embed/liveboard.ts +4 -0
  55. package/src/embed/pinboard.spec.ts +4 -3
  56. package/src/embed/ts-embed.spec.ts +32 -0
  57. package/src/embed/ts-embed.ts +25 -1
  58. package/src/types.ts +189 -3
  59. package/src/utils.ts +18 -1
package/src/types.ts CHANGED
@@ -19,8 +19,13 @@ export enum AuthType {
19
19
  None = 'None',
20
20
  /**
21
21
  * SSO using SAML
22
+ * @deprecated Use {@link SAML} instead
22
23
  */
23
24
  SSO = 'SSO_SAML',
25
+ /**
26
+ * SSO using SAML
27
+ */
28
+ SAML = 'SSO_SAML',
24
29
  /**
25
30
  * SSO using OIDC
26
31
  */
@@ -40,6 +45,28 @@ export enum AuthType {
40
45
 
41
46
  export type DOMSelector = string | HTMLElement;
42
47
 
48
+ interface customCssInterface {
49
+ variables?: {
50
+ [variableName: string]: string;
51
+ };
52
+ // eslint-disable-next-line camelcase
53
+ rules_UNSTABLE?: {
54
+ [selector: string]: {
55
+ [declaration: string]: string;
56
+ };
57
+ };
58
+ }
59
+ interface CustomStyles {
60
+ customCSSUrl?: string;
61
+ customCss?: customCssInterface;
62
+ }
63
+ export interface CustomisationsInterface {
64
+ style: CustomStyles;
65
+ content: {
66
+ [key: string]: string;
67
+ };
68
+ }
69
+
43
70
  /**
44
71
  * The configuration object for embedding ThoughtSpot content.
45
72
  * It includes the ThoughtSpot hostname or IP address,
@@ -183,6 +210,10 @@ export interface EmbedConfig {
183
210
  * @version SDK: 1.12.0 | ThoughtSpot: *
184
211
  */
185
212
  suppressSearchEmbedBetaWarning?: boolean;
213
+ /**
214
+ * Custom style params for embed Config
215
+ */
216
+ customisations?: CustomisationsInterface;
186
217
  }
187
218
 
188
219
  /**
@@ -557,6 +588,65 @@ export enum EmbedEvent {
557
588
  * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
558
589
  */
559
590
  AnswerChartSwitcher = 'answerChartSwitcher',
591
+ /**
592
+ *
593
+ */
594
+ APP_INIT = 'appInit',
595
+ /**
596
+ * Emitted when a user clicks Show Liveboard details on a Liveboard
597
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
598
+ */
599
+ LiveboardInfo = 'pinboardInfo',
600
+ /**
601
+ * Emitted when a user clicks on the Favorite icon on a Liveboard
602
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
603
+ */
604
+ AddToFavorites = 'addToFavorites',
605
+ /**
606
+ * Emitted when a user clicks Schedule on a Liveboard
607
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
608
+ */
609
+ Schedule = 'subscription',
610
+ /**
611
+ * Emitted when a user clicks Edit on a Liveboard or visualization
612
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
613
+ */
614
+ Edit = 'edit',
615
+ /**
616
+ * Emitted when a user clicks Make a copy on a Liveboard
617
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
618
+ */
619
+ MakeACopy = 'makeACopy',
620
+ /**
621
+ * Emitted when a user clicks Present on a Liveboard or visualization
622
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
623
+ */
624
+ Present = 'present',
625
+ /**
626
+ * Emitted when a user clicks Delete on a Liveboard
627
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
628
+ */
629
+ Delete = 'delete',
630
+ /**
631
+ * Emitted when a user clicks Manage schedules on a Liveboard
632
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
633
+ */
634
+ SchedulesList = 'schedule-list',
635
+ /**
636
+ * Emitted when a user clicks Cancel in edit mode on a Liveboard
637
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
638
+ */
639
+ Cancel = 'cancel',
640
+ /**
641
+ * Emitted when a user clicks Explore on a visualization
642
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
643
+ */
644
+ Explore = 'explore',
645
+ /**
646
+ * Emitted when a user clicks Copy link action on a visualization
647
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
648
+ */
649
+ CopyLink = 'copyLink',
560
650
  }
561
651
 
562
652
  /**
@@ -620,12 +710,106 @@ export enum HostEvent {
620
710
  */
621
711
  getExportRequestForCurrentPinboard = 'getExportRequestForCurrentPinboard',
622
712
  /**
623
- * Fires the pin action on an embedded object
624
- * @param - incase of liveboard embed, takes in an object with vizId as a key
625
- * can be left empty for search and viz embeds
713
+ * Triggers the Pin action on an embedded object
714
+ * @param - incase of Liveboard embed, takes in an object with vizId as a key
715
+ * can be left empty for search and visualization embeds
626
716
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
627
717
  */
628
718
  Pin = 'pin',
719
+ /**
720
+ * Triggers the Show Liveboard details action on a Liveboard
721
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
722
+ */
723
+ LiveboardInfo = 'pinboardInfo',
724
+ /**
725
+ * Triggers the Schedule action on a Liveboard
726
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
727
+ */
728
+ Schedule = 'subscription',
729
+ /**
730
+ * Triggers the Manage schedule action on a Liveboard
731
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
732
+ */
733
+ SchedulesList = 'schedule-list',
734
+ /**
735
+ * Triggers the Export TML action on a Liveboard
736
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
737
+ */
738
+ ExportTML = 'exportTSL',
739
+ /**
740
+ * Triggers the Edit TML action on a Liveboard
741
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
742
+ */
743
+ EditTML = 'editTSL',
744
+ /**
745
+ * Triggers the Update TML action on a Liveboard
746
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
747
+ */
748
+ UpdateTML = 'updateTSL',
749
+ /**
750
+ * Triggers the Download PDF action on a Liveboard
751
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
752
+ */
753
+ DownloadAsPdf = 'downloadAsPdf',
754
+ /**
755
+ * Triggers the Make a copy action on a Liveboard
756
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
757
+ */
758
+ MakeACopy = 'makeACopy',
759
+ /**
760
+ * Triggers the Delete action on a Liveboard
761
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
762
+ */
763
+ Remove = 'delete',
764
+ /**
765
+ * Triggers the Explore action on a visualization
766
+ * @param - an object with vizId as a key
767
+ * eg: {vizId: '730496d6-6903-4601-937e-2c691821af3c'}
768
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
769
+ */
770
+ Explore = 'explore',
771
+ /**
772
+ * Triggers the Create alert action on a visualization
773
+ * @param - an object with vizId as a key
774
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
775
+ */
776
+ CreateMonitor = 'createMonitor',
777
+ /**
778
+ * Triggers the Manage alert action on a visualization
779
+ * @param - an object with vizId as a key
780
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
781
+ */
782
+ ManageMonitor = 'manageMonitor',
783
+ /**
784
+ * Triggers the Edit action on a Liveboard or visualization
785
+ * @param - object - to trigger the action for a specfic visualization in Liveboard embed, pass in vizId as a key
786
+ * @example
787
+ * liveboardEmbed.trigger(HostEvent.Edit)
788
+ * liveboardEmbed.trigger(HostEvent.Edit, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
789
+ * vizEmbed.trigger((HostEvent.Edit)
790
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
791
+ */
792
+ Edit = 'edit',
793
+ /**
794
+ * Triggers the Copy link action on a Liveboard or visualization
795
+ * @param - object - to trigger the action for a specfic visualization in Liveboard embed, pass in vizId as a key
796
+ * @example
797
+ * liveboardEmbed.trigger(HostEvent.CopyLink)
798
+ * liveboardEmbed.trigger(HostEvent.CopyLink, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
799
+ * vizEmbed.trigger((HostEvent.CopyLink)
800
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
801
+ */
802
+ CopyLink = 'embedDocument',
803
+ /**
804
+ * Triggers the Present action on a Liveboard or visualization
805
+ * @param - object - to trigger the action for a specfic visualization in Liveboard embed, pass in vizId as a key
806
+ * @example
807
+ * liveboardEmbed.trigger(HostEvent.Present)
808
+ * liveboardEmbed.trigger(HostEvent.Present, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
809
+ * vizEmbed.trigger((HostEvent.Present)
810
+ * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
811
+ */
812
+ Present = 'present',
629
813
  }
630
814
 
631
815
  /**
@@ -674,6 +858,7 @@ export enum Param {
674
858
  fullHeight = 'isFullHeightPinboard',
675
859
  livedBoardEmbed = 'isLiveboardEmbed',
676
860
  searchEmbed = 'isSearchEmbed',
861
+ vizEmbed = 'isVizEmbed',
677
862
  Version = 'sdkVersion',
678
863
  ViewPortHeight = 'viewPortHeight',
679
864
  ViewPortWidth = 'viewPortWidth',
@@ -684,6 +869,7 @@ export enum Param {
684
869
  LiveboardV2Enabled = 'isPinboardV2Enabled',
685
870
  ShowAlerts = 'showAlerts',
686
871
  Locale = 'locale',
872
+ CustomStyle = 'customStyle',
687
873
  }
688
874
 
689
875
  /**
package/src/utils.ts CHANGED
@@ -7,7 +7,12 @@
7
7
  * @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
8
8
  */
9
9
 
10
- import { QueryParams, RuntimeFilter } from './types';
10
+ import {
11
+ EmbedConfig,
12
+ QueryParams,
13
+ RuntimeFilter,
14
+ CustomisationsInterface,
15
+ } from './types';
11
16
 
12
17
  /**
13
18
  * Construct a runtime filters query string from the given filters.
@@ -170,3 +175,15 @@ export const checkReleaseVersionInBeta = (
170
175
  }
171
176
  return false;
172
177
  };
178
+
179
+ export const getCustomisations = (
180
+ embedConfig: EmbedConfig,
181
+ ): CustomisationsInterface => {
182
+ const { customCssUrl } = embedConfig;
183
+ let { customisations } = embedConfig;
184
+ customisations = customisations || ({} as CustomisationsInterface);
185
+ customisations.style = customisations.style || {};
186
+ customisations.style.customCSSUrl =
187
+ customisations.style.customCSSUrl || customCssUrl;
188
+ return customisations;
189
+ };