@thoughtspot/visual-embed-sdk 1.17.2-customcss → 1.18.0-alpha.1

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 (51) hide show
  1. package/CHANGELOG.md +4 -8
  2. package/README.md +1 -1
  3. package/dist/src/embed/app.d.ts +2 -2
  4. package/dist/src/embed/liveboard.d.ts +2 -2
  5. package/dist/src/embed/search-bar.d.ts +3 -2
  6. package/dist/src/embed/search.d.ts +2 -6
  7. package/dist/src/embed/ts-embed.d.ts +2 -97
  8. package/dist/src/react/util.d.ts +1 -2
  9. package/dist/src/types.d.ts +198 -11
  10. package/dist/src/utils.d.ts +2 -2
  11. package/dist/tsembed.es.js +131 -31
  12. package/dist/tsembed.js +131 -31
  13. package/lib/package.json +8 -4
  14. package/lib/src/embed/app.d.ts +2 -2
  15. package/lib/src/embed/app.js +1 -1
  16. package/lib/src/embed/app.js.map +1 -1
  17. package/lib/src/embed/base.js +3 -3
  18. package/lib/src/embed/liveboard.d.ts +2 -2
  19. package/lib/src/embed/liveboard.js.map +1 -1
  20. package/lib/src/embed/search-bar.d.ts +3 -2
  21. package/lib/src/embed/search-bar.js +1 -1
  22. package/lib/src/embed/search-bar.js.map +1 -1
  23. package/lib/src/embed/search.d.ts +2 -6
  24. package/lib/src/embed/search.js +2 -2
  25. package/lib/src/embed/search.js.map +1 -1
  26. package/lib/src/embed/ts-embed.d.ts +2 -97
  27. package/lib/src/embed/ts-embed.js +11 -11
  28. package/lib/src/embed/ts-embed.js.map +1 -1
  29. package/lib/src/embed/ts-embed.spec.js +31 -1
  30. package/lib/src/embed/ts-embed.spec.js.map +1 -1
  31. package/lib/src/react/util.d.ts +1 -2
  32. package/lib/src/react/util.js.map +1 -1
  33. package/lib/src/types.d.ts +198 -11
  34. package/lib/src/types.js +98 -6
  35. package/lib/src/types.js.map +1 -1
  36. package/lib/src/utils.d.ts +2 -2
  37. package/lib/src/utils.js +16 -8
  38. package/lib/src/utils.js.map +1 -1
  39. package/lib/src/visual-embed-sdk.d.ts +209 -120
  40. package/package.json +8 -4
  41. package/src/embed/app.ts +8 -2
  42. package/src/embed/base.ts +3 -3
  43. package/src/embed/liveboard.ts +2 -1
  44. package/src/embed/search-bar.tsx +3 -3
  45. package/src/embed/search.ts +8 -7
  46. package/src/embed/ts-embed.spec.ts +39 -1
  47. package/src/embed/ts-embed.ts +16 -108
  48. package/src/react/index.tsx +2 -2
  49. package/src/react/util.ts +1 -2
  50. package/src/types.ts +199 -11
  51. package/src/utils.ts +19 -7
@@ -30,12 +30,13 @@ import {
30
30
  EmbedEvent,
31
31
  MessageCallback,
32
32
  Action,
33
- RuntimeFilter,
34
33
  Param,
35
34
  EmbedConfig,
36
35
  MessageOptions,
37
36
  MessagePayload,
38
37
  MessageCallbackObj,
38
+ ViewConfig,
39
+ FrameParams,
39
40
  } from '../types';
40
41
  import { uploadMixpanelEvent, MIXPANEL_EVENT } from '../mixpanel-service';
41
42
  import { processEventData } from '../utils/processData';
@@ -60,103 +61,6 @@ const V1EventMap = {
60
61
  [EmbedEvent.Data]: [EmbedEvent.V1Data],
61
62
  };
62
63
 
63
- // eslint-disable-next-line @typescript-eslint/no-empty-interface
64
- export interface LayoutConfig {}
65
-
66
- /**
67
- * Embedded iFrame configuration
68
- */
69
- export interface FrameParams {
70
- /**
71
- * The width of the iFrame (unit is pixels if numeric).
72
- */
73
- width?: number | string;
74
- /**
75
- * The height of the iFrame (unit is pixels if numeric).
76
- */
77
- height?: number | string;
78
- /**
79
- * This parameters will be passed on the iframe
80
- * as is.
81
- */
82
- [key: string]: string | number | boolean | undefined;
83
- }
84
-
85
- /**
86
- * The configuration object for an embedded view.
87
- */
88
- export interface ViewConfig {
89
- /**
90
- * @hidden
91
- */
92
- layoutConfig?: LayoutConfig;
93
- /**
94
- * The <b>width</b> and <b>height</b> dimensions to render an embedded object inside your app. Specify the values in pixels or percentage.
95
- */
96
- frameParams?: FrameParams;
97
- /**
98
- * @hidden
99
- */
100
- theme?: string;
101
- /**
102
- * @hidden
103
- */
104
- // eslint-disable-next-line camelcase
105
- styleSheet__unstable?: string;
106
- /**
107
- * The list of actions to disable from the primary menu, more menu
108
- * (...), and the contextual menu.
109
- */
110
- disabledActions?: Action[];
111
- /**
112
- * The tooltip to display for disabled actions.
113
- */
114
- disabledActionReason?: string;
115
- /**
116
- * The list of actions to hide from the primary menu, more menu
117
- * (...), and the contextual menu.
118
- */
119
- hiddenActions?: Action[];
120
- /**
121
- * The list of actions to display from the primary menu, more menu
122
- * (...), and the contextual menu.
123
- * @version SDK: 1.6.0 | ThoughtSpot: ts8.nov.cl, 8.4.1-sw
124
- */
125
- visibleActions?: Action[];
126
- /**
127
- * Show alert messages and toast messages in the embedded view.
128
- * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
129
- */
130
- showAlerts?: boolean;
131
- /**
132
- * The list of runtime filters to apply to a search answer,
133
- * visualization, or Liveboard.
134
- */
135
- runtimeFilters?: RuntimeFilter[];
136
- /**
137
- * The locale/language to use for the embedded view.
138
- * @version SDK: 1.9.4 | ThoughtSpot 8.1.0.cl, 8.4.1-sw
139
- */
140
- locale?: string;
141
- /**
142
- * This is an object (key/val) of override flags which will be applied
143
- * to the internal embedded object. This can be used to add any
144
- * URL flag.
145
- * Warning: This option is for advanced use only and is used internally
146
- * to control embed behavior in non-regular ways. We do not publish the
147
- * list of supported keys and values associated with each.
148
- * @version SDK: 1.9.0 | ThoughtSpot: 8.1.0.cl, 8.4.1-sw
149
- */
150
- additionalFlags?: { [key: string]: string | number | boolean };
151
- /**
152
- * Dynamic CSS Url to be injected in the loaded application.
153
- * You would also need to set `style-src` in the CSP settings.
154
- * @version SDK: 1.17.2 | ThoughtSpot: 8.4.1-sw, 8.4.0.cl
155
- * @default ''
156
- */
157
- customCssUrl?: string;
158
- }
159
-
160
64
  /**
161
65
  * Base class for embedding v2 experience
162
66
  * Note: the v2 version of ThoughtSpot Blink is built on the new stack:
@@ -317,7 +221,12 @@ export class TsEmbed {
317
221
  private appInitCb = (_: any, responder: any) => {
318
222
  responder({
319
223
  type: EmbedEvent.APP_INIT,
320
- data: { customisations: getCustomisations(this.embedConfig) },
224
+ data: {
225
+ customisations: getCustomisations(
226
+ this.embedConfig,
227
+ this.viewConfig,
228
+ ),
229
+ },
321
230
  });
322
231
  };
323
232
 
@@ -388,7 +297,7 @@ export class TsEmbed {
388
297
  showAlerts,
389
298
  additionalFlags,
390
299
  locale,
391
- customCssUrl,
300
+ customizations,
392
301
  } = this.viewConfig;
393
302
 
394
303
  if (Array.isArray(visibleActions) && Array.isArray(hiddenActions)) {
@@ -398,14 +307,13 @@ export class TsEmbed {
398
307
  return queryParams;
399
308
  }
400
309
 
401
- // TODO remove this
402
- if (this.embedConfig.customCssUrl) {
403
- queryParams[Param.CustomCSSUrl] = this.embedConfig.customCssUrl;
404
- }
310
+ // TODO remove embedConfig.customCssUrl
311
+ const cssUrlParam =
312
+ customizations?.style?.customCSSUrl ||
313
+ this.embedConfig.customCssUrl;
405
314
 
406
- // If you need to override customCSS URL for a specific embed liveboard
407
- if (customCssUrl) {
408
- queryParams[Param.CustomCSSUrl] = customCssUrl;
315
+ if (cssUrlParam) {
316
+ queryParams[Param.CustomCSSUrl] = cssUrlParam;
409
317
  }
410
318
 
411
319
  if (disabledActions?.length) {
@@ -733,7 +641,7 @@ export class TsEmbed {
733
641
  * @param messageType The event type
734
642
  * @param data The payload to send with the message
735
643
  */
736
- public trigger(messageType: HostEvent, data: any): Promise<any> {
644
+ public trigger(messageType: HostEvent, data: any = {}): Promise<any> {
737
645
  uploadMixpanelEvent(
738
646
  `${MIXPANEL_EVENT.VISUAL_SDK_TRIGGER}-${messageType}`,
739
647
  );
@@ -10,9 +10,9 @@ import {
10
10
  LiveboardEmbed as _LiveboardEmbed,
11
11
  LiveboardViewConfig,
12
12
  } from '../embed/liveboard';
13
- import { TsEmbed, ViewConfig } from '../embed/ts-embed';
13
+ import { TsEmbed } from '../embed/ts-embed';
14
14
 
15
- import { EmbedEvent } from '../types';
15
+ import { EmbedEvent, ViewConfig } from '../types';
16
16
  import { EmbedProps, getViewPropsAndListeners } from './util';
17
17
 
18
18
  const componentFactory = <
package/src/react/util.ts CHANGED
@@ -1,5 +1,4 @@
1
- import { EmbedEvent, MessageCallback } from '../types';
2
- import { ViewConfig } from '../embed/ts-embed';
1
+ import { EmbedEvent, MessageCallback, ViewConfig } from '../types';
3
2
 
4
3
  // eslint-disable-next-line prettier/prettier
5
4
  export type EmbedEventHandlers = { [key in keyof typeof EmbedEvent as `on${Capitalize<key>}`]?: MessageCallback };
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
  }
@@ -239,13 +239,12 @@ export interface EmbedConfig {
239
239
  * @version SDK: 1.12.0 | ThoughtSpot: 8.4.0.cl, 8.4.1-sw*
240
240
  */
241
241
  suppressSearchEmbedBetaWarning?: boolean;
242
-
243
242
  /**
244
243
  * Custom style params for embed Config.
245
244
  *
246
245
  * @version SDK: 1.17.0 | ThoughtSpot: 8.9.0.cl
247
246
  */
248
- customisations?: CustomisationsInterface;
247
+ customizations?: CustomisationsInterface;
249
248
  /**
250
249
  * For noRedirect SSO Auth, we need a button which the user
251
250
  * click to trigger the flow. This is the containing element
@@ -262,6 +261,103 @@ export interface EmbedConfig {
262
261
  authTriggerText?: string;
263
262
  }
264
263
 
264
+ // eslint-disable-next-line @typescript-eslint/no-empty-interface
265
+ export interface LayoutConfig {}
266
+
267
+ /**
268
+ * Embedded iFrame configuration
269
+ */
270
+ export interface FrameParams {
271
+ /**
272
+ * The width of the iFrame (unit is pixels if numeric).
273
+ */
274
+ width?: number | string;
275
+ /**
276
+ * The height of the iFrame (unit is pixels if numeric).
277
+ */
278
+ height?: number | string;
279
+ /**
280
+ * This parameters will be passed on the iframe
281
+ * as is.
282
+ */
283
+ [key: string]: string | number | boolean | undefined;
284
+ }
285
+
286
+ /**
287
+ * The configuration object for an embedded view.
288
+ */
289
+ export interface ViewConfig {
290
+ /**
291
+ * @hidden
292
+ */
293
+ layoutConfig?: LayoutConfig;
294
+ /**
295
+ * The <b>width</b> and <b>height</b> dimensions to render an embedded object inside your app. Specify the values in pixels or percentage.
296
+ */
297
+ frameParams?: FrameParams;
298
+ /**
299
+ * @hidden
300
+ */
301
+ theme?: string;
302
+ /**
303
+ * @hidden
304
+ */
305
+ // eslint-disable-next-line camelcase
306
+ styleSheet__unstable?: string;
307
+ /**
308
+ * The list of actions to disable from the primary menu, more menu
309
+ * (...), and the contextual menu.
310
+ */
311
+ disabledActions?: Action[];
312
+ /**
313
+ * The tooltip to display for disabled actions.
314
+ */
315
+ disabledActionReason?: string;
316
+ /**
317
+ * The list of actions to hide from the primary menu, more menu
318
+ * (...), and the contextual menu.
319
+ */
320
+ hiddenActions?: Action[];
321
+ /**
322
+ * The list of actions to display from the primary menu, more menu
323
+ * (...), and the contextual menu.
324
+ * @version SDK: 1.6.0 | ThoughtSpot: ts8.nov.cl, 8.4.1-sw
325
+ */
326
+ visibleActions?: Action[];
327
+ /**
328
+ * Show alert messages and toast messages in the embedded view.
329
+ * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
330
+ */
331
+ showAlerts?: boolean;
332
+ /**
333
+ * The list of runtime filters to apply to a search answer,
334
+ * visualization, or Liveboard.
335
+ */
336
+ runtimeFilters?: RuntimeFilter[];
337
+ /**
338
+ * The locale/language to use for the embedded view.
339
+ * @version SDK: 1.9.4 | ThoughtSpot 8.1.0.cl, 8.4.1-sw
340
+ */
341
+ locale?: string;
342
+ /**
343
+ * This is an object (key/val) of override flags which will be applied
344
+ * to the internal embedded object. This can be used to add any
345
+ * URL flag.
346
+ * Warning: This option is for advanced use only and is used internally
347
+ * to control embed behavior in non-regular ways. We do not publish the
348
+ * list of supported keys and values associated with each.
349
+ * @version SDK: 1.9.0 | ThoughtSpot: 8.1.0.cl, 8.4.1-sw
350
+ */
351
+ additionalFlags?: { [key: string]: string | number | boolean };
352
+ /**
353
+ * Dynamic CSSUrl and customCSS to be injected in the loaded application.
354
+ * You would also need to set `style-src` in the CSP settings.
355
+ * @version SDK: 1.17.2 | ThoughtSpot: 8.4.1-sw, 8.4.0.cl
356
+ * @default ''
357
+ */
358
+ customizations?: CustomisationsInterface;
359
+ }
360
+
265
361
  /**
266
362
  * MessagePayload: Embed event payload: message type, data and status (start/end)
267
363
  */
@@ -778,7 +874,10 @@ export enum HostEvent {
778
874
  * Triggers the Pin action on an embedded object
779
875
  * @param - incase of Liveboard embed, takes in an object with vizId as a key
780
876
  * can be left empty for search and visualization embeds
781
- * @example liveboardEmbed.trigger(HostEvent.Pin, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
877
+ * @example
878
+ * liveboardEmbed.trigger(HostEvent.Pin, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
879
+ * vizEmbed.trigger(HostEvent.Pin)
880
+ * searchEmbed.trigger(HostEvent.Pin)
782
881
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
783
882
  */
784
883
  Pin = 'pin',
@@ -825,8 +924,11 @@ export enum HostEvent {
825
924
  */
826
925
  DownloadAsPdf = 'downloadAsPdf',
827
926
  /**
828
- * Triggers the Make a copy action on a Liveboard
829
- * @example liveboardEmbed.trigger(HostEvent.MakeACopy)
927
+ * Triggers the Make a copy action on a Liveboard, search or visualization
928
+ * @example
929
+ * liveboardEmbed.trigger(HostEvent.MakeACopy, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
930
+ * vizEmbed.trigger(HostEvent.MakeACopy)
931
+ * searchEmbed.trigger(HostEvent.MakeACopy)
830
932
  * @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl, 8.8.1-sw
831
933
  */
832
934
  MakeACopy = 'makeACopy',
@@ -890,15 +992,74 @@ export enum HostEvent {
890
992
  /**
891
993
  * Get TML for the current search.
892
994
  * @example searchEmbed.trigger(HostEvent.GetTML)
893
- * @version SDK: 1.18.0 | ThoughtSpot: 8.10.0.cl, 9.0.1-sw
995
+ * @version SDK: 1.18.0 | ThoughtSpot: 8.10.0.cl
894
996
  */
895
997
  GetTML = 'getTML',
998
+ /**
999
+ * Triggers the ShowUnderlyingData action on visualization or search
1000
+ * @param - an object with vizId as a key
1001
+ * @example
1002
+ * liveboardEmbed.trigger(HostEvent.ShowUnderlyingData, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
1003
+ * vizEmbed.trigger(HostEvent.ShowUnderlyingData)
1004
+ * searchEmbed.trigger(HostEvent.ShowUnderlyingData)
1005
+ * @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
1006
+ */
1007
+ ShowUnderlyingData = 'showUnderlyingData',
1008
+ /**
1009
+ * Triggers the Delete action on visualization or search
1010
+ * @param - incase of Liveboard embed, takes in an object with vizId as a key
1011
+ * can be left empty for search and visualization embeds
1012
+ * @example
1013
+ * liveboardEmbed.trigger(HostEvent.Delete, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
1014
+ * vizEmbed.trigger(HostEvent.Delete)
1015
+ * searchEmbed.trigger(HostEvent.Delete)
1016
+ * @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
1017
+ */
1018
+ Delete = 'delete',
1019
+ /**
1020
+ * Triggers the SpotIQAnalyze action on visualization or search
1021
+ * @param - incase of Liveboard embed, takes in an object with vizId as a key
1022
+ * can be left empty for search and visualization embeds
1023
+ * @example
1024
+ * liveboardEmbed.trigger(HostEvent.SpotIQAnalyze, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
1025
+ * vizEmbed.trigger(HostEvent.SpotIQAnalyze)
1026
+ * searchEmbed.trigger(HostEvent.SpotIQAnalyze)
1027
+ * @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
1028
+ */
1029
+ SpotIQAnalyze = 'spotIQAnalyze',
1030
+ /**
1031
+ * Triggers the Download action on visualization or search when Displaymode is Chart
1032
+ * @example
1033
+ * liveboardEmbed.trigger(HostEvent.Download, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
1034
+ * vizEmbed.trigger(HostEvent.Download)
1035
+ * searchEmbed.trigger(HostEvent.Download)
1036
+ * @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
1037
+ */
1038
+ Download = 'download',
1039
+ /**
1040
+ * Triggers the downloadAsCSV action on visualization or search when Displaymode is Table
1041
+ * @example
1042
+ * liveboardEmbed.trigger(HostEvent.DownloadAsCsv, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
1043
+ * vizEmbed.trigger(HostEvent.DownloadAsCsv)
1044
+ * searchEmbed.trigger(HostEvent.DownloadAsCsv)
1045
+ * @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
1046
+ */
1047
+ DownloadAsCsv = 'downloadAsCSV',
1048
+ /**
1049
+ * Triggers the downloadAsXLSX action on visualization or search when Displaymode is Table
1050
+ * @example
1051
+ * liveboardEmbed.trigger(HostEvent.DownloadAsXlsx, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
1052
+ * vizEmbed.trigger(HostEvent.DownloadAsXlsx)
1053
+ * searchEmbed.trigger(HostEvent.DownloadAsXlsx)
1054
+ * @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
1055
+ */
1056
+ DownloadAsXlsx = 'downloadAsXLSX',
896
1057
  /**
897
1058
  * Triggers the Share action on a liveboard or answer
898
1059
  * @example
899
1060
  * liveboardEmbed.trigger(HostEvent.Share)
900
1061
  * searchEmbed.trigger(HostEvent.Share)
901
- * @version SDK: 1.19.0 | Thoughtspot: 9.0.0.cl, 9.0.1-sw
1062
+ * @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
902
1063
  */
903
1064
  Share = 'share',
904
1065
  /**
@@ -906,9 +1067,36 @@ export enum HostEvent {
906
1067
  * @example
907
1068
  * liveboardEmbed.trigger(HostEvent.Save)
908
1069
  * searchEmbed.trigger(HostEvent.Save)
909
- * @version SDK: 1.19.0 | Thoughtspot: 9.0.0.cl, 9.0.1-sw
1070
+ * @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
910
1071
  */
911
1072
  Save = 'save',
1073
+ /**
1074
+ * Triggers the SyncToSheets action on visualization
1075
+ * @param - an object with vizId as a key
1076
+ * @example
1077
+ * liveboardEmbed.trigger(HostEvent.SyncToSheets, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
1078
+ * vizEmbed.trigger(HostEvent.SyncToSheets)
1079
+ * @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
1080
+ */
1081
+ SyncToSheets = 'sync-to-sheets',
1082
+ /**
1083
+ * Triggers the SyncToOtherApps action on visualization
1084
+ * @param - an object with vizId as a key
1085
+ * @example
1086
+ * liveboardEmbed.trigger(HostEvent.SyncToOtherApps, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
1087
+ * vizEmbed.trigger(HostEvent.SyncToOtherApps)
1088
+ * @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
1089
+ */
1090
+ SyncToOtherApps = 'sync-to-other-apps',
1091
+ /**
1092
+ * Triggers the ManagePipelines action on visualization
1093
+ * @param - an object with vizId as a key
1094
+ * @example
1095
+ * liveboardEmbed.trigger(HostEvent.ManagePipelines, {vizId: '730496d6-6903-4601-937e-2c691821af3c'})
1096
+ * vizEmbed.trigger(HostEvent.ManagePipelines)
1097
+ * @version SDK: 1.19.0 | ThoughtSpot: 9.0.0.cl, 9.0.1-sw
1098
+ */
1099
+ ManagePipelines = 'manage-pipeline',
912
1100
  }
913
1101
 
914
1102
  /**
package/src/utils.ts CHANGED
@@ -13,6 +13,7 @@ import {
13
13
  RuntimeFilter,
14
14
  CustomisationsInterface,
15
15
  DOMSelector,
16
+ ViewConfig,
16
17
  } from './types';
17
18
 
18
19
  /**
@@ -179,14 +180,25 @@ export const checkReleaseVersionInBeta = (
179
180
 
180
181
  export const getCustomisations = (
181
182
  embedConfig: EmbedConfig,
183
+ viewConfig: ViewConfig,
182
184
  ): CustomisationsInterface => {
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;
185
+ const customCssFromEmbedConfig = embedConfig.customCssUrl;
186
+ const customizationsFromViewConfig =
187
+ viewConfig.customizations ||
188
+ ((viewConfig as any).customisations as CustomisationsInterface);
189
+ let customizations =
190
+ embedConfig.customizations ||
191
+ ((embedConfig as any).customisations as CustomisationsInterface);
192
+ customizations = customizations || ({} as CustomisationsInterface);
193
+ customizations.style = customizations.style || {};
194
+ customizations.style.customCSSUrl =
195
+ customizationsFromViewConfig?.style.customCSSUrl ||
196
+ customizations.style.customCSSUrl ||
197
+ customCssFromEmbedConfig;
198
+ customizations.style.customCSS =
199
+ customizationsFromViewConfig?.style.customCSS ||
200
+ customizations.style.customCSS;
201
+ return customizations;
190
202
  };
191
203
 
192
204
  /**