@thoughtspot/visual-embed-sdk 1.6.0-alpha.1 → 1.7.0-alpha.0

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 (61) hide show
  1. package/README.md +8 -8
  2. package/dist/src/embed/app.d.ts +14 -3
  3. package/dist/src/embed/liveboard.d.ts +101 -0
  4. package/dist/src/embed/liveboard.spec.d.ts +1 -0
  5. package/dist/src/embed/ts-embed.d.ts +2 -11
  6. package/dist/src/errors.d.ts +1 -1
  7. package/dist/src/index.d.ts +2 -2
  8. package/dist/src/react/index.d.ts +4 -3
  9. package/dist/src/types.d.ts +23 -20
  10. package/dist/tsembed.es.js +83 -70
  11. package/dist/tsembed.js +82 -68
  12. package/lib/package.json +4 -1
  13. package/lib/src/embed/app.d.ts +14 -3
  14. package/lib/src/embed/app.js +25 -2
  15. package/lib/src/embed/app.js.map +1 -1
  16. package/lib/src/embed/app.spec.js +32 -0
  17. package/lib/src/embed/app.spec.js.map +1 -1
  18. package/lib/src/embed/events.spec.js +55 -2
  19. package/lib/src/embed/events.spec.js.map +1 -1
  20. package/lib/src/embed/liveboard.d.ts +101 -0
  21. package/lib/src/embed/{pinboard.js → liveboard.js} +34 -26
  22. package/lib/src/embed/liveboard.js.map +1 -0
  23. package/lib/src/embed/liveboard.spec.d.ts +1 -0
  24. package/lib/src/embed/liveboard.spec.js +159 -0
  25. package/lib/src/embed/liveboard.spec.js.map +1 -0
  26. package/lib/src/embed/pinboard.spec.js +1 -1
  27. package/lib/src/embed/pinboard.spec.js.map +1 -1
  28. package/lib/src/embed/ts-embed.d.ts +2 -11
  29. package/lib/src/embed/ts-embed.js +2 -22
  30. package/lib/src/embed/ts-embed.js.map +1 -1
  31. package/lib/src/embed/ts-embed.spec.js +63 -6
  32. package/lib/src/embed/ts-embed.spec.js.map +1 -1
  33. package/lib/src/errors.d.ts +1 -1
  34. package/lib/src/errors.js +1 -1
  35. package/lib/src/errors.js.map +1 -1
  36. package/lib/src/index.d.ts +2 -2
  37. package/lib/src/index.js +2 -2
  38. package/lib/src/index.js.map +1 -1
  39. package/lib/src/react/index.d.ts +4 -3
  40. package/lib/src/react/index.js +3 -2
  41. package/lib/src/react/index.js.map +1 -1
  42. package/lib/src/types.d.ts +23 -20
  43. package/lib/src/types.js +20 -18
  44. package/lib/src/types.js.map +1 -1
  45. package/lib/src/visual-embed-sdk.d.ts +79 -58
  46. package/package.json +4 -1
  47. package/src/embed/app.spec.ts +41 -0
  48. package/src/embed/app.ts +28 -3
  49. package/src/embed/events.spec.ts +64 -5
  50. package/src/embed/liveboard.spec.ts +199 -0
  51. package/src/embed/{pinboard.ts → liveboard.ts} +60 -42
  52. package/src/embed/pinboard.spec.ts +11 -11
  53. package/src/embed/ts-embed.spec.ts +81 -8
  54. package/src/embed/ts-embed.ts +3 -24
  55. package/src/errors.ts +2 -2
  56. package/src/index.ts +7 -2
  57. package/src/react/index.tsx +14 -8
  58. package/src/types.ts +23 -20
  59. package/dist/src/embed/pinboard.d.ts +0 -85
  60. package/lib/src/embed/pinboard.d.ts +0 -85
  61. package/lib/src/embed/pinboard.js.map +0 -1
package/README.md CHANGED
@@ -31,7 +31,7 @@ import * as TsEmbedSDK from '@thoughtspot/visual-embed-sdk';
31
31
  <script src='https://cdn.jsdelivr.net/npm/@thoughtspot/visual-embed-sdk/dist/tsembed.js'></script>
32
32
 
33
33
  // ES6 from web
34
- import { PinboardEmbed, AuthType, init } from 'https://cdn.jsdelivr.net/npm/@thoughtspot/visual-embed-sdk/dist/tsembed.es.js';
34
+ import { LiveboardEmbed, AuthType, init } from 'https://cdn.jsdelivr.net/npm/@thoughtspot/visual-embed-sdk/dist/tsembed.es.js';
35
35
  ```
36
36
  <br/>
37
37
 
@@ -51,7 +51,7 @@ Visit our [code playground](https://try-everywhere.thoughtspot.cloud/v2/#/everyw
51
51
  ## Quick Start
52
52
 
53
53
  The ThoughtSpot Embed SDK allows you to embed the ThoughtSpot search experience,
54
- pinboards, visualizations or the even full app version.
54
+ liveboards, visualizations or the even full app version.
55
55
 
56
56
  ### Embedded Search
57
57
 
@@ -76,32 +76,32 @@ const searchEmbed = new SearchEmbed(document.getElementById('ts-embed'), {
76
76
  searchEmbed.render();
77
77
  ```
78
78
 
79
- ### Embedded Pinboard & Visualization
79
+ ### Embedded Liveboard & Visualization
80
80
 
81
81
  ```js
82
82
  // NPM
83
- import { PinboardEmbed, AuthType, init } from '@thoughtspot/visual-embed-sdk';
83
+ import { LiveboardEmbed, AuthType, init } from '@thoughtspot/visual-embed-sdk';
84
84
  // or ES6
85
- // import { PinboardEmbed, AuthType, init } from 'https://cdn.jsdelivr.net/npm/@thoughtspot/visual-embed-sdk/dist/tsembed.es.js';
85
+ // import { LiveboardEmbed, AuthType, init } from 'https://cdn.jsdelivr.net/npm/@thoughtspot/visual-embed-sdk/dist/tsembed.es.js';
86
86
 
87
87
  init({
88
88
  thoughtSpotHost: '<%=tshost%>',
89
89
  authType: AuthType.None,
90
90
  });
91
91
 
92
- const pinboardEmbed = new PinboardEmbed(
92
+ const liveboardEmbed = new LiveboardEmbed(
93
93
  document.getElementById('ts-embed'),
94
94
  {
95
95
  frameParams: {
96
96
  width: '100%',
97
97
  height: '100%',
98
98
  },
99
- pinboardId: '<%=pinboardGUID%>',
99
+ liveboardId: '<%=liveboardGUID%>',
100
100
  vizId: '<%=vizGUID%>',
101
101
  },
102
102
  });
103
103
 
104
- pinboardEmbed.render();
104
+ liveboardEmbed.render();
105
105
  ```
106
106
 
107
107
  ### Embedded Full App
@@ -27,7 +27,11 @@ export declare enum Page {
27
27
  */
28
28
  Answers = "answers",
29
29
  /**
30
- * Pinboards listing page
30
+ * Liveboards listing page
31
+ */
32
+ Liveboards = "liveboards",
33
+ /**
34
+ * @hidden
31
35
  */
32
36
  Pinboards = "pinboards",
33
37
  /**
@@ -63,7 +67,7 @@ export interface AppViewConfig extends ViewConfig {
63
67
  pageId?: Page;
64
68
  /**
65
69
  * This puts a filter tag on the application. All metadata lists in the application, such as
66
- * pinboards and answers, would be filtered by this tag.
70
+ * Liveboards and answers, would be filtered by this tag.
67
71
  */
68
72
  tag?: string;
69
73
  /**
@@ -80,7 +84,7 @@ export declare class AppEmbed extends V1Embed {
80
84
  constructor(domSelector: DOMSelector, viewConfig: AppViewConfig);
81
85
  /**
82
86
  * Constructs a map of parameters to be passed on to the
83
- * embedded pinboard or visualization.
87
+ * embedded Liveboard or visualization.
84
88
  */
85
89
  private getEmbedParams;
86
90
  /**
@@ -99,6 +103,13 @@ export declare class AppEmbed extends V1Embed {
99
103
  * @returns The URL path that the embedded app understands.
100
104
  */
101
105
  private formatPath;
106
+ /**
107
+ * Navigate to particular page for app embed. eg:answers/pinboards/home
108
+ * This is used for embedding answers, pinboards, visualizations and full application only.
109
+ * @param path The string, set to iframe src and navigate to new page
110
+ * eg: appEmbed.navigateToPage('pinboards')
111
+ */
112
+ navigateToPage(path: string): void;
102
113
  /**
103
114
  * Renders the embedded application pages in the ThoughtSpot app.
104
115
  * @param renderOptions An object containing the page ID
@@ -0,0 +1,101 @@
1
+ /**
2
+ * Copyright (c) 2021
3
+ *
4
+ * Embed a ThoughtSpot Liveboard or visualization
5
+ * https://developers.thoughtspot.com/docs/?pageid=embed-pinboard
6
+ * https://developers.thoughtspot.com/docs/?pageid=embed-a-viz
7
+ *
8
+ * @summary Liveboard & visualization embed
9
+ * @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
10
+ */
11
+ import { DOMSelector } from '../types';
12
+ import { V1Embed, ViewConfig } from './ts-embed';
13
+ /**
14
+ * The configuration for the embedded Liveboard or visualization page view.
15
+ * @Category Liveboards and Charts
16
+ */
17
+ export interface LiveboardViewConfig extends ViewConfig {
18
+ /**
19
+ * If set to true, the embedded object container dynamically resizes
20
+ * according to the height of the Liveboard.
21
+ */
22
+ fullHeight?: boolean;
23
+ /**
24
+ * This is the minimum height(in pixels) for a full height Liveboard.
25
+ * Setting this height helps resolves issues with empty Liveboards and
26
+ * other screens navigable from a Liveboard.
27
+ * *_since 1.5.0_
28
+ * @default 500
29
+ */
30
+ defaultHeight?: number;
31
+ /**
32
+ * If set to true, the context menu in visualizations will be enabled.
33
+ */
34
+ enableVizTransformations?: boolean;
35
+ /**
36
+ * The Liveboard to display in the embedded view.
37
+ * Use either of liveboardId or pinboardId to reference the Liveboard to embed.
38
+ */
39
+ liveboardId?: string;
40
+ /**
41
+ * To support backward compatibilty
42
+ * @hidden
43
+ */
44
+ pinboardId?: string;
45
+ /**
46
+ * The visualization within the Liveboard to display.
47
+ */
48
+ vizId?: string;
49
+ /**
50
+ * If set to true, all filter chips from a
51
+ * Liveboard page will be read-only (no X buttons)
52
+ */
53
+ preventLiveboardFilterRemoval?: boolean;
54
+ /**
55
+ * To support backward compatibilty
56
+ * @hidden
57
+ */
58
+ preventPinboardFilterRemoval?: boolean;
59
+ }
60
+ /**
61
+ * Embed a ThoughtSpot Liveboard or visualization
62
+ * @Category Liveboards and Charts
63
+ */
64
+ export declare class LiveboardEmbed extends V1Embed {
65
+ protected viewConfig: LiveboardViewConfig;
66
+ private defaultHeight;
67
+ constructor(domSelector: DOMSelector, viewConfig: LiveboardViewConfig);
68
+ /**
69
+ * Construct a map of params to be passed on to the
70
+ * embedded Liveboard or visualization.
71
+ */
72
+ private getEmbedParams;
73
+ /**
74
+ * Construct the URL of the embedded ThoughtSpot Liveboard or visualization
75
+ * to be loaded within the iframe.
76
+ * @param liveboardId The GUID of the Liveboard.
77
+ * @param vizId The optional GUID of a visualization within the Liveboard.
78
+ * @param runtimeFilters A list of runtime filters to be applied to
79
+ * the Liveboard or visualization on load.
80
+ */
81
+ private getIFrameSrc;
82
+ /**
83
+ * Set the iframe height as per the computed height received
84
+ * from the ThoughtSpot app.
85
+ * @param data The event payload
86
+ */
87
+ private updateIFrameHeight;
88
+ private embedIframeCenter;
89
+ private setIframeHeightForNonEmbedLiveboard;
90
+ /**
91
+ * Render an embedded ThoughtSpot Liveboard or visualization
92
+ * @param renderOptions An object specifying the Liveboard ID,
93
+ * visualization ID and the runtime filters.
94
+ */
95
+ render(): LiveboardEmbed;
96
+ }
97
+ /**
98
+ * @hidden
99
+ */
100
+ export declare class PinboardEmbed extends LiveboardEmbed {
101
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -64,7 +64,7 @@ export interface ViewConfig {
64
64
  visibleActions?: Action[];
65
65
  /**
66
66
  * The list of runtime filters to apply to a search answer,
67
- * visualization, or pinboard.
67
+ * visualization, or Liveboard.
68
68
  */
69
69
  runtimeFilters?: RuntimeFilter[];
70
70
  }
@@ -162,7 +162,7 @@ export declare class TsEmbed {
162
162
  protected getBaseQueryParams(): {};
163
163
  /**
164
164
  * Constructs the base URL string to load v1 of the ThoughtSpot app.
165
- * This is used for embedding pinboards, visualizations, and full application.
165
+ * This is used for embedding Liveboards, visualizations, and full application.
166
166
  * @param queryString The query string to append to the URL.
167
167
  * @param isAppEmbed A Boolean parameter to specify if you are embedding
168
168
  * the full application.
@@ -221,15 +221,6 @@ export declare class TsEmbed {
221
221
  * @param callback A callback function
222
222
  */
223
223
  on(messageType: EmbedEvent, callback: MessageCallback): typeof TsEmbed.prototype;
224
- /**
225
- * Navigates users to the specified application page.
226
- * Use this method to navigate users from the embedded
227
- * ThoughtSpot context to a specific page in your app.
228
- * @param path The page path string.
229
- * For example, to navigate users to a pinboard page,
230
- * define the method as navigateToPage('pinboard/&lt;pinboardId&gt;').
231
- */
232
- navigateToPage(path: string): void;
233
224
  /**
234
225
  * Triggers an event on specific Port registered against
235
226
  * for the EmbedEvent
@@ -1,4 +1,4 @@
1
1
  export declare const ERROR_MESSAGE: {
2
2
  INVALID_THOUGHTSPOT_HOST: string;
3
- PINBOARD_VIZ_ID_VALIDATION: string;
3
+ LIVEBOARD_VIZ_ID_VALIDATION: string;
4
4
  };
@@ -9,7 +9,7 @@
9
9
  */
10
10
  import { AppEmbed, Page, AppViewConfig } from './embed/app';
11
11
  import { init, prefetch } from './embed/base';
12
- import { PinboardEmbed, PinboardViewConfig } from './embed/pinboard';
12
+ import { PinboardEmbed, LiveboardViewConfig, LiveboardEmbed } from './embed/liveboard';
13
13
  import { SearchEmbed, SearchViewConfig } from './embed/search';
14
14
  import { AuthType, RuntimeFilter, RuntimeFilterOp, EmbedEvent, HostEvent, DataSourceVisualMode, Action, EmbedConfig } from './types';
15
- export { init, prefetch, SearchEmbed, PinboardEmbed, AppEmbed, Page, AuthType, RuntimeFilter, RuntimeFilterOp, EmbedEvent, HostEvent, DataSourceVisualMode, Action, EmbedConfig, SearchViewConfig, PinboardViewConfig, AppViewConfig, };
15
+ export { init, prefetch, SearchEmbed, PinboardEmbed, LiveboardEmbed, AppEmbed, Page, AuthType, RuntimeFilter, RuntimeFilterOp, EmbedEvent, HostEvent, DataSourceVisualMode, Action, EmbedConfig, SearchViewConfig, LiveboardViewConfig, AppViewConfig, };
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { SearchViewConfig } from '../embed/search';
3
3
  import { AppViewConfig } from '../embed/app';
4
- import { PinboardViewConfig } from '../embed/pinboard';
4
+ import { LiveboardViewConfig } from '../embed/liveboard';
5
5
  import { EmbedProps } from './util';
6
6
  interface SearchProps extends EmbedProps, SearchViewConfig {
7
7
  }
@@ -9,7 +9,8 @@ export declare const SearchEmbed: (props: SearchProps) => JSX.Element;
9
9
  interface AppProps extends EmbedProps, AppViewConfig {
10
10
  }
11
11
  export declare const AppEmbed: (props: AppProps) => JSX.Element;
12
- interface PinboardProps extends EmbedProps, PinboardViewConfig {
12
+ interface LiveboardProps extends EmbedProps, LiveboardViewConfig {
13
13
  }
14
- export declare const PinboardEmbed: (props: PinboardProps) => JSX.Element;
14
+ export declare const LiveboardEmbed: (props: LiveboardProps) => JSX.Element;
15
+ export declare const PinboardEmbed: (props: LiveboardProps) => JSX.Element;
15
16
  export {};
@@ -112,12 +112,13 @@ export interface EmbedConfig {
112
112
  * When there are multiple embeds, queue the render of embed to start
113
113
  * after the previous embed's render is complete. This helps in the load performance
114
114
  * by decreasing the load on the browser.
115
+ * @version 1.5.0 or later
115
116
  * @default false
116
117
  */
117
118
  queueMultiRenders?: boolean;
118
119
  /**
119
120
  * Dynamic CSS Url to be injected in the loaded application.
120
- * _Since: 1.6.0_
121
+ * @version 1.6.0 or later
121
122
  * @default ''
122
123
  */
123
124
  customCssUrl?: string;
@@ -193,7 +194,7 @@ export declare enum RuntimeFilterOp {
193
194
  IN = "IN"
194
195
  }
195
196
  /**
196
- * A filter that can be applied to ThoughtSpot answers, pinboards, or
197
+ * A filter that can be applied to ThoughtSpot answers, Liveboards, or
197
198
  * visualizations at runtime.
198
199
  */
199
200
  export interface RuntimeFilter {
@@ -231,12 +232,12 @@ export declare enum EmbedEvent {
231
232
  */
232
233
  Load = "load",
233
234
  /**
234
- * Data pertaining to answer or pinboard is received
235
- * @return data - The answer or pinboard data
235
+ * Data pertaining to answer or Liveboard is received
236
+ * @return data - The answer or Liveboard data
236
237
  */
237
238
  Data = "data",
238
239
  /**
239
- * Search/answer/pinboard filters have been applied/updated
240
+ * Search/answer/Liveboard filters have been applied/updated
240
241
  * @hidden
241
242
  */
242
243
  FiltersChanged = "filtersChanged",
@@ -259,13 +260,13 @@ export declare enum EmbedEvent {
259
260
  /**
260
261
  * A custom action has been triggered
261
262
  * @return actionId - The id of the custom action
262
- * @return data - The answer or pinboard data
263
+ * @return data - The answer or Liveboard data
263
264
  */
264
265
  CustomAction = "customAction",
265
266
  /**
266
267
  * A double click has been triggered on table/chart
267
268
  * @return ContextMenuInputPoints - data point that is double clicked
268
- * * _since: 1.5.0_
269
+ * @version 1.5.0 or later
269
270
  */
270
271
  VizPointDoubleClick = "vizPointDoubleClick",
271
272
  /**
@@ -283,8 +284,8 @@ export declare enum EmbedEvent {
283
284
  */
284
285
  AuthExpire = "ThoughtspotAuthExpired",
285
286
  /**
286
- * The height of the embedded pinboard or visualization has been computed.
287
- * @return data - The height of the embedded pinboard or visualization
287
+ * The height of the embedded Liveboard or visualization has been computed.
288
+ * @return data - The height of the embedded Liveboard or visualization
288
289
  * @hidden
289
290
  */
290
291
  EmbedHeight = "EMBED_HEIGHT",
@@ -296,7 +297,6 @@ export declare enum EmbedEvent {
296
297
  EmbedIframeCenter = "EmbedIframeCenter",
297
298
  /**
298
299
  * Detects the route change.
299
- * @hidden
300
300
  */
301
301
  RouteChange = "ROUTE_CHANGE",
302
302
  /**
@@ -308,7 +308,7 @@ export declare enum EmbedEvent {
308
308
  * Emitted when the embed does not have cookie access. This
309
309
  * happens on Safari where third-party cookies are blocked by default.
310
310
  *
311
- * @version 1.1.0
311
+ * @version 1.1.0 or later
312
312
  */
313
313
  NoCookieAccess = "noCookieAccess",
314
314
  /**
@@ -319,12 +319,12 @@ export declare enum EmbedEvent {
319
319
  SAMLComplete = "samlComplete",
320
320
  /**
321
321
  * Emitted when any modal is opened in the app
322
- * * _since: 1.6.0_
322
+ * @version 1.6.0 or later
323
323
  */
324
324
  DialogOpen = "dialog-open",
325
325
  /**
326
326
  * Emitted when any modal is closed in the app
327
- * * _since: 1.6.0_
327
+ * @version 1.6.0 or later
328
328
  */
329
329
  DialogClose = "dialog-close"
330
330
  }
@@ -345,7 +345,7 @@ export declare enum HostEvent {
345
345
  * eg. { selectedPoints: []}
346
346
  * @param columnGuid - a string guid of the column to drill by. This is optional,
347
347
  * if not provided it will auto drill by the configured column. \
348
- * * _since: 1.5.0_
348
+ * @version 1.5.0 or later
349
349
  */
350
350
  DrillDown = "triggerDrillDown",
351
351
  /**
@@ -359,10 +359,10 @@ export declare enum HostEvent {
359
359
  */
360
360
  Reload = "reload",
361
361
  /**
362
- * Set the visible Vizs on a pinboard/liveboard.
363
- * @param - an array of ids of vizs to show, the ids not passed
362
+ * Set the visible visualizations on a Liveboard.
363
+ * @param - an array of ids of visualizations to show, the ids not passed
364
364
  * will be hidden.
365
- * _since: 1.6.0_
365
+ * @version 1.6.0 or later
366
366
  */
367
367
  SetVisibleVizs = "SetPinboardVisibleVizs"
368
368
  }
@@ -394,7 +394,7 @@ export declare enum Param {
394
394
  DisableActions = "disableAction",
395
395
  DisableActionReason = "disableHint",
396
396
  ForceTable = "forceTable",
397
- preventPinboardFilterRemoval = "preventPinboardFilterRemoval",
397
+ preventLiveboardFilterRemoval = "preventPinboardFilterRemoval",
398
398
  SearchQuery = "searchQuery",
399
399
  HideActions = "hideAction",
400
400
  HideObjects = "hideObjects",
@@ -416,7 +416,7 @@ export declare enum Param {
416
416
  }
417
417
  /**
418
418
  * The list of actions that can be performed on visual ThoughtSpot
419
- * entities, such as answers and pinboards.
419
+ * entities, such as answers and Liveboards.
420
420
  */
421
421
  export declare enum Action {
422
422
  Save = "save",
@@ -426,7 +426,6 @@ export declare enum Action {
426
426
  MakeACopy = "makeACopy",
427
427
  EditACopy = "editACopy",
428
428
  CopyLink = "embedDocument",
429
- PinboardSnapshot = "pinboardSnapshot",
430
429
  ResetLayout = "resetLayout",
431
430
  Schedule = "schedule",
432
431
  SchedulesList = "schedule-list",
@@ -459,7 +458,11 @@ export declare enum Action {
459
458
  Describe = "describe",
460
459
  Relate = "relate",
461
460
  CustomizeHeadlines = "customizeHeadlines",
461
+ /**
462
+ * @hidden
463
+ */
462
464
  PinboardInfo = "pinboardInfo",
465
+ LiveboardInfo = "pinboardInfo",
463
466
  SendAnswerFeedback = "sendFeedback",
464
467
  /**
465
468
  * @deprecated Will be removed in next version