@thoughtspot/visual-embed-sdk 1.17.2 → 1.17.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 (47) hide show
  1. package/dist/src/embed/app.d.ts +2 -2
  2. package/dist/src/embed/liveboard.d.ts +2 -2
  3. package/dist/src/embed/search-bar.d.ts +2 -1
  4. package/dist/src/embed/search.d.ts +2 -2
  5. package/dist/src/embed/ts-embed.d.ts +1 -89
  6. package/dist/src/react/util.d.ts +1 -2
  7. package/dist/src/types.d.ts +99 -4
  8. package/dist/src/utils.d.ts +2 -2
  9. package/dist/tsembed.es.js +39 -19
  10. package/dist/tsembed.js +39 -19
  11. package/lib/package.json +1 -1
  12. package/lib/src/embed/app.d.ts +2 -2
  13. package/lib/src/embed/app.js +1 -1
  14. package/lib/src/embed/app.js.map +1 -1
  15. package/lib/src/embed/base.js +3 -3
  16. package/lib/src/embed/liveboard.d.ts +2 -2
  17. package/lib/src/embed/liveboard.js.map +1 -1
  18. package/lib/src/embed/search-bar.d.ts +2 -1
  19. package/lib/src/embed/search-bar.js.map +1 -1
  20. package/lib/src/embed/search.d.ts +2 -2
  21. package/lib/src/embed/search.js +1 -1
  22. package/lib/src/embed/search.js.map +1 -1
  23. package/lib/src/embed/ts-embed.d.ts +1 -89
  24. package/lib/src/embed/ts-embed.js +11 -7
  25. package/lib/src/embed/ts-embed.js.map +1 -1
  26. package/lib/src/embed/ts-embed.spec.js +33 -1
  27. package/lib/src/embed/ts-embed.spec.js.map +1 -1
  28. package/lib/src/react/util.d.ts +1 -2
  29. package/lib/src/react/util.js.map +1 -1
  30. package/lib/src/types.d.ts +99 -4
  31. package/lib/src/types.js.map +1 -1
  32. package/lib/src/utils.d.ts +2 -2
  33. package/lib/src/utils.js +24 -8
  34. package/lib/src/utils.js.map +1 -1
  35. package/lib/src/visual-embed-sdk.d.ts +108 -100
  36. package/package.json +1 -1
  37. package/src/embed/app.ts +8 -2
  38. package/src/embed/base.ts +3 -3
  39. package/src/embed/liveboard.ts +2 -1
  40. package/src/embed/search-bar.tsx +2 -2
  41. package/src/embed/search.ts +8 -2
  42. package/src/embed/ts-embed.spec.ts +41 -1
  43. package/src/embed/ts-embed.ts +18 -96
  44. package/src/react/index.tsx +2 -2
  45. package/src/react/util.ts +1 -2
  46. package/src/types.ts +101 -4
  47. package/src/utils.ts +27 -7
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
  }
@@ -245,7 +245,7 @@ export interface EmbedConfig {
245
245
  *
246
246
  * @version SDK: 1.17.0 | ThoughtSpot: 8.9.0.cl
247
247
  */
248
- customisations?: CustomisationsInterface;
248
+ customizations?: CustomisationsInterface;
249
249
  /**
250
250
  * For noRedirect SSO Auth, we need a button which the user
251
251
  * click to trigger the flow. This is the containing element
@@ -262,6 +262,103 @@ export interface EmbedConfig {
262
262
  authTriggerText?: string;
263
263
  }
264
264
 
265
+ // eslint-disable-next-line @typescript-eslint/no-empty-interface
266
+ export interface LayoutConfig {}
267
+
268
+ /**
269
+ * Embedded iFrame configuration
270
+ */
271
+ export interface FrameParams {
272
+ /**
273
+ * The width of the iFrame (unit is pixels if numeric).
274
+ */
275
+ width?: number | string;
276
+ /**
277
+ * The height of the iFrame (unit is pixels if numeric).
278
+ */
279
+ height?: number | string;
280
+ /**
281
+ * This parameters will be passed on the iframe
282
+ * as is.
283
+ */
284
+ [key: string]: string | number | boolean | undefined;
285
+ }
286
+
287
+ /**
288
+ * The configuration object for an embedded view.
289
+ */
290
+ export interface ViewConfig {
291
+ /**
292
+ * @hidden
293
+ */
294
+ layoutConfig?: LayoutConfig;
295
+ /**
296
+ * The <b>width</b> and <b>height</b> dimensions to render an embedded object inside your app. Specify the values in pixels or percentage.
297
+ */
298
+ frameParams?: FrameParams;
299
+ /**
300
+ * @hidden
301
+ */
302
+ theme?: string;
303
+ /**
304
+ * @hidden
305
+ */
306
+ // eslint-disable-next-line camelcase
307
+ styleSheet__unstable?: string;
308
+ /**
309
+ * The list of actions to disable from the primary menu, more menu
310
+ * (...), and the contextual menu.
311
+ */
312
+ disabledActions?: Action[];
313
+ /**
314
+ * The tooltip to display for disabled actions.
315
+ */
316
+ disabledActionReason?: string;
317
+ /**
318
+ * The list of actions to hide from the primary menu, more menu
319
+ * (...), and the contextual menu.
320
+ */
321
+ hiddenActions?: Action[];
322
+ /**
323
+ * The list of actions to display from the primary menu, more menu
324
+ * (...), and the contextual menu.
325
+ * @version SDK: 1.6.0 | ThoughtSpot: ts8.nov.cl, 8.4.1-sw
326
+ */
327
+ visibleActions?: Action[];
328
+ /**
329
+ * Show alert messages and toast messages in the embedded view.
330
+ * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl, 8.4.1-sw
331
+ */
332
+ showAlerts?: boolean;
333
+ /**
334
+ * The list of runtime filters to apply to a search answer,
335
+ * visualization, or Liveboard.
336
+ */
337
+ runtimeFilters?: RuntimeFilter[];
338
+ /**
339
+ * The locale/language to use for the embedded view.
340
+ * @version SDK: 1.9.4 | ThoughtSpot 8.1.0.cl, 8.4.1-sw
341
+ */
342
+ locale?: string;
343
+ /**
344
+ * This is an object (key/val) of override flags which will be applied
345
+ * to the internal embedded object. This can be used to add any
346
+ * URL flag.
347
+ * Warning: This option is for advanced use only and is used internally
348
+ * to control embed behavior in non-regular ways. We do not publish the
349
+ * list of supported keys and values associated with each.
350
+ * @version SDK: 1.9.0 | ThoughtSpot: 8.1.0.cl, 8.4.1-sw
351
+ */
352
+ additionalFlags?: { [key: string]: string | number | boolean };
353
+ /**
354
+ * Dynamic CSSUrl and customCSS to be injected in the loaded application.
355
+ * You would also need to set `style-src` in the CSP settings.
356
+ * @version SDK: 1.17.2 | ThoughtSpot: 8.4.1-sw, 8.4.0.cl
357
+ * @default ''
358
+ */
359
+ customizations?: CustomisationsInterface;
360
+ }
361
+
265
362
  /**
266
363
  * MessagePayload: Embed event payload: message type, data and status (start/end)
267
364
  */
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,33 @@ 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 customCssUrlFromEmbedConfig = embedConfig.customCssUrl;
186
+ const customizationsFromViewConfig = viewConfig.customizations;
187
+ const customizationsFromEmbedConfig =
188
+ embedConfig.customizations ||
189
+ ((embedConfig as any).customisations as CustomisationsInterface);
190
+
191
+ const customizations: CustomisationsInterface = {
192
+ style: {
193
+ ...customizationsFromEmbedConfig?.style,
194
+ ...customizationsFromViewConfig?.style,
195
+ customCSS: {
196
+ ...customizationsFromEmbedConfig?.style?.customCSS,
197
+ ...customizationsFromViewConfig?.style?.customCSS,
198
+ },
199
+ customCSSUrl:
200
+ customizationsFromViewConfig?.style?.customCSSUrl ||
201
+ customizationsFromEmbedConfig?.style?.customCSSUrl ||
202
+ customCssUrlFromEmbedConfig,
203
+ },
204
+ content: {
205
+ ...customizationsFromEmbedConfig?.content,
206
+ ...customizationsFromViewConfig?.content,
207
+ },
208
+ };
209
+ return customizations;
190
210
  };
191
211
 
192
212
  /**