@thoughtspot/visual-embed-sdk 1.17.0-alpha.5 → 1.17.0-customcss-embed

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.
@@ -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
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
  /**
@@ -66,7 +66,7 @@ describe('Unit test case for ts embed', () => {
66
66
  init({
67
67
  thoughtSpotHost: 'tshost',
68
68
  authType: AuthType.None,
69
- customisations,
69
+ customizations: customisations,
70
70
  });
71
71
  });
72
72
 
@@ -148,6 +148,13 @@ export interface ViewConfig {
148
148
  * @version SDK: 1.9.0 | ThoughtSpot: 8.1.0.cl, 8.4.1-sw
149
149
  */
150
150
  additionalFlags?: { [key: string]: string | number | boolean };
151
+ /**
152
+ * Dynamic CSS Url to be injected in the embedded view.
153
+ * You would also need to set `style-src` in the CSP settings.
154
+ * @version SDK: 1.6.0 | ThoughtSpot: ts8.nov.cl, 8.4.1-sw
155
+ * @default ''
156
+ */
157
+ customCssUrl?: string;
151
158
  }
152
159
 
153
160
  /**
@@ -385,6 +392,7 @@ export class TsEmbed {
385
392
  showAlerts,
386
393
  additionalFlags,
387
394
  locale,
395
+ customCssUrl,
388
396
  } = this.viewConfig;
389
397
 
390
398
  if (Array.isArray(visibleActions) && Array.isArray(hiddenActions)) {
@@ -393,7 +401,9 @@ export class TsEmbed {
393
401
  );
394
402
  return queryParams;
395
403
  }
396
-
404
+ if (customCssUrl) {
405
+ queryParams[Param.CustomCSSUrl] = customCssUrl;
406
+ }
397
407
  if (disabledActions?.length) {
398
408
  queryParams[Param.DisableActions] = disabledActions;
399
409
  }
package/src/types.ts CHANGED
@@ -87,11 +87,11 @@ interface customCssInterface {
87
87
  }
88
88
  interface CustomStyles {
89
89
  customCSSUrl?: string;
90
- customCss?: customCssInterface;
90
+ customCSS?: customCssInterface;
91
91
  }
92
92
  export interface CustomisationsInterface {
93
- style: CustomStyles;
94
- content: {
93
+ style?: CustomStyles;
94
+ content?: {
95
95
  [key: string]: string;
96
96
  };
97
97
  }
@@ -244,7 +244,7 @@ export interface EmbedConfig {
244
244
  *
245
245
  * @version SDK: 1.17.0 | ThoughtSpot: 8.9.0.cl
246
246
  */
247
- customisations?: CustomisationsInterface;
247
+ customizations?: CustomisationsInterface;
248
248
  /**
249
249
  * For noRedirect SSO Auth, we need a button which the user
250
250
  * click to trigger the flow. This is the containing element
@@ -285,7 +285,7 @@ export type MessageOptions = {
285
285
  export type MessageCallback = (
286
286
  /* payload: Message payload contain type, data and status */
287
287
  payload: MessagePayload,
288
- /* responder: Messsage callback function triggered when embed event initiated */
288
+ /* responder: Message callback function triggered when embed event initiated */
289
289
  responder?: (data: any) => void,
290
290
  ) => void;
291
291
  /**
@@ -753,8 +753,8 @@ export enum HostEvent {
753
753
  * @param - {@link RuntimeFilter}[] an array of {@link RuntimeFilter} Types.
754
754
  * @example
755
755
  * liveboardEmbed.trigger(HostEvent.UpdateRuntimeFilters, [
756
- * {columnName: "state",operator: "EQ",values: ["michigan"]},
757
- * {columnName: "item type",operator: "EQ",values: ["Jackets"]}
756
+ * {columnName: "state",operator: RuntimeFilterOp.EQ,values: ["michigan"]},
757
+ * {columnName: "item type",operator: RuntimeFilterOp.EQ,values: ["Jackets"]}
758
758
  * ])
759
759
  * @version SDK: 1.9.0 | ThoughtSpot: 8.1.0.cl, 8.4.1-sw
760
760
  */
@@ -905,7 +905,7 @@ export enum HostEvent {
905
905
  * liveboardEmbed.trigger(HostEvent.ShowUnderlyingData, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
906
906
  * vizEmbed.trigger(HostEvent.ShowUnderlyingData)
907
907
  * searchEmbed.trigger(HostEvent.ShowUnderlyingData)
908
- * @version SDK: 1.18.0 | ThoughtSpot: 9.0.0.cl
908
+ * @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
909
909
  */
910
910
  ShowUnderlyingData = 'showUnderlyingData',
911
911
  /**
@@ -916,7 +916,7 @@ export enum HostEvent {
916
916
  * liveboardEmbed.trigger(HostEvent.Delete, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
917
917
  * vizEmbed.trigger(HostEvent.Delete)
918
918
  * searchEmbed.trigger(HostEvent.Delete)
919
- * @version SDK: 1.18.0 | ThoughtSpot: 9.0.0.cl
919
+ * @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
920
920
  */
921
921
  Delete = 'delete',
922
922
  /**
@@ -927,7 +927,7 @@ export enum HostEvent {
927
927
  * liveboardEmbed.trigger(HostEvent.SpotIQAnalyze, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
928
928
  * vizEmbed.trigger(HostEvent.SpotIQAnalyze)
929
929
  * searchEmbed.trigger(HostEvent.SpotIQAnalyze)
930
- * @version SDK: 1.18.0 | ThoughtSpot: 9.0.0.cl
930
+ * @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
931
931
  */
932
932
  SpotIQAnalyze = 'spotIQAnalyze',
933
933
  /**
@@ -936,7 +936,7 @@ export enum HostEvent {
936
936
  * liveboardEmbed.trigger(HostEvent.Download, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
937
937
  * vizEmbed.trigger(HostEvent.Download)
938
938
  * searchEmbed.trigger(HostEvent.Download)
939
- * @version SDK: 1.18.0 | ThoughtSpot: 9.0.0.cl
939
+ * @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
940
940
  */
941
941
  Download = 'download',
942
942
  /**
@@ -945,7 +945,7 @@ export enum HostEvent {
945
945
  * liveboardEmbed.trigger(HostEvent.DownloadAsCsv, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
946
946
  * vizEmbed.trigger(HostEvent.DownloadAsCsv)
947
947
  * searchEmbed.trigger(HostEvent.DownloadAsCsv)
948
- * @version SDK: 1.18.0 | ThoughtSpot: 9.0.0.cl
948
+ * @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
949
949
  */
950
950
  DownloadAsCsv = 'downloadAsCSV',
951
951
  /**
@@ -954,7 +954,7 @@ export enum HostEvent {
954
954
  * liveboardEmbed.trigger(HostEvent.DownloadAsXlsx, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
955
955
  * vizEmbed.trigger(HostEvent.DownloadAsXlsx)
956
956
  * searchEmbed.trigger(HostEvent.DownloadAsXlsx)
957
- * @version SDK: 1.18.0 | ThoughtSpot: 9.0.0.cl
957
+ * @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
958
958
  */
959
959
  DownloadAsXlsx = 'downloadAsXLSX',
960
960
  /**
@@ -962,7 +962,7 @@ export enum HostEvent {
962
962
  * @example
963
963
  * liveboardEmbed.trigger(HostEvent.Share)
964
964
  * searchEmbed.trigger(HostEvent.Share)
965
- * @version SDK: 1.18.0 | Thoughtspot: 9.0.0.cl
965
+ * @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
966
966
  */
967
967
  Share = 'share',
968
968
  /**
@@ -970,7 +970,7 @@ export enum HostEvent {
970
970
  * @example
971
971
  * liveboardEmbed.trigger(HostEvent.Save)
972
972
  * searchEmbed.trigger(HostEvent.Save)
973
- * @version SDK: 1.18.0 | Thoughtspot: 9.0.0.cl
973
+ * @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
974
974
  */
975
975
  Save = 'save',
976
976
  /**
@@ -979,7 +979,7 @@ export enum HostEvent {
979
979
  * @example
980
980
  * liveboardEmbed.trigger(HostEvent.SyncToSheets, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
981
981
  * vizEmbed.trigger(HostEvent.SyncToSheets)
982
- * @version SDK: 1.18.0 | ThoughtSpot: 9.0.0.cl
982
+ * @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
983
983
  */
984
984
  SyncToSheets = 'sync-to-sheets',
985
985
  /**
@@ -988,7 +988,7 @@ export enum HostEvent {
988
988
  * @example
989
989
  * liveboardEmbed.trigger(HostEvent.SyncToOtherApps, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
990
990
  * vizEmbed.trigger(HostEvent.SyncToOtherApps)
991
- * @version SDK: 1.18.0 | ThoughtSpot: 9.0.0.cl
991
+ * @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
992
992
  */
993
993
  SyncToOtherApps = 'sync-to-other-apps',
994
994
  /**
@@ -997,7 +997,7 @@ export enum HostEvent {
997
997
  * @example
998
998
  * liveboardEmbed.trigger(HostEvent.ManagePipelines, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
999
999
  * vizEmbed.trigger(HostEvent.ManagePipelines)
1000
- * @version SDK: 1.18.0 | ThoughtSpot: 9.0.0.cl
1000
+ * @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
1001
1001
  */
1002
1002
  ManagePipelines = 'manage-pipeline',
1003
1003
  }
package/src/utils.ts CHANGED
@@ -181,12 +181,14 @@ export const getCustomisations = (
181
181
  embedConfig: EmbedConfig,
182
182
  ): CustomisationsInterface => {
183
183
  const { customCssUrl } = embedConfig;
184
- let { customisations } = embedConfig;
185
- customisations = customisations || ({} as CustomisationsInterface);
186
- customisations.style = customisations.style || {};
187
- customisations.style.customCSSUrl =
188
- customisations.style.customCSSUrl || customCssUrl;
189
- return customisations;
184
+ let customizations =
185
+ embedConfig.customizations ||
186
+ ((embedConfig as any).customisations as CustomisationsInterface);
187
+ customizations = customizations || ({} as CustomisationsInterface);
188
+ customizations.style = customizations.style || {};
189
+ customizations.style.customCSSUrl =
190
+ customizations.style.customCSSUrl || customCssUrl;
191
+ return customizations;
190
192
  };
191
193
 
192
194
  /**