@thoughtspot/visual-embed-sdk 1.10.0-alpha.2 → 1.10.0-alpha.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 (41) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/src/embed/app.d.ts +5 -1
  3. package/dist/src/embed/pinboard.d.ts +91 -0
  4. package/dist/src/embed/ts-embed.d.ts +17 -3
  5. package/dist/src/types.d.ts +125 -2
  6. package/dist/src/utils/plugin.d.ts +0 -0
  7. package/dist/src/utils.d.ts +4 -0
  8. package/dist/src/v1/api.d.ts +19 -0
  9. package/dist/tsembed.es.js +140 -10
  10. package/dist/tsembed.js +140 -10
  11. package/lib/package.json +2 -2
  12. package/lib/src/embed/app.d.ts +5 -1
  13. package/lib/src/embed/app.js +6 -0
  14. package/lib/src/embed/app.js.map +1 -1
  15. package/lib/src/embed/base.spec.js +13 -1
  16. package/lib/src/embed/base.spec.js.map +1 -1
  17. package/lib/src/embed/pinboard.d.ts +91 -0
  18. package/lib/src/embed/pinboard.js +110 -0
  19. package/lib/src/embed/pinboard.js.map +1 -0
  20. package/lib/src/embed/ts-embed.d.ts +17 -3
  21. package/lib/src/embed/ts-embed.js +27 -10
  22. package/lib/src/embed/ts-embed.js.map +1 -1
  23. package/lib/src/embed/ts-embed.spec.js +123 -14
  24. package/lib/src/embed/ts-embed.spec.js.map +1 -1
  25. package/lib/src/types.d.ts +125 -2
  26. package/lib/src/types.js +103 -0
  27. package/lib/src/types.js.map +1 -1
  28. package/lib/src/utils/plugin.d.ts +0 -0
  29. package/lib/src/utils/plugin.js +1 -0
  30. package/lib/src/utils/plugin.js.map +1 -0
  31. package/lib/src/utils.d.ts +4 -0
  32. package/lib/src/utils.js +4 -0
  33. package/lib/src/utils.js.map +1 -1
  34. package/lib/src/visual-embed-sdk.d.ts +147 -6
  35. package/package.json +2 -2
  36. package/src/embed/app.ts +6 -0
  37. package/src/embed/base.spec.ts +14 -0
  38. package/src/embed/ts-embed.spec.ts +166 -14
  39. package/src/embed/ts-embed.ts +47 -13
  40. package/src/types.ts +135 -1
  41. package/src/utils.ts +5 -0
package/CHANGELOG.md CHANGED
@@ -8,6 +8,18 @@ This project follows Semantic Versioning.
8
8
  ### New Features
9
9
  - Events for all actions on Search Embed
10
10
 
11
+ ## 1.9.5 (04-06-2022)
12
+
13
+ ### New Features
14
+ - `locale` param to set Locale/language for the embedded view.
15
+
16
+
17
+ ## 1.9.4 (04-06-2022)
18
+
19
+ ### Fixed
20
+ - [React] `className` should be forwarded to the iframe container div.
21
+
22
+
11
23
  ## 1.9.3 (03-22-2022)
12
24
 
13
25
  ### New Features
@@ -37,7 +37,11 @@ export declare enum Page {
37
37
  /**
38
38
  * Data management page
39
39
  */
40
- Data = "data"
40
+ Data = "data",
41
+ /**
42
+ * SpotIQ listing page
43
+ */
44
+ SpotIQ = "spotiq"
41
45
  }
42
46
  /**
43
47
  * The view configuration for full app embedding.
@@ -0,0 +1,91 @@
1
+ /**
2
+ * Copyright (c) 2021
3
+ *
4
+ * Embed a ThoughtSpot pinboard or visualization
5
+ * https://developers.thoughtspot.com/docs/?pageid=embed-pinboard
6
+ * https://developers.thoughtspot.com/docs/?pageid=embed-a-viz
7
+ *
8
+ * @summary Pinboard & 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 pinboard or visualization page view.
15
+ * @Category Pinboards and Charts
16
+ */
17
+ export interface PinboardViewConfig extends ViewConfig {
18
+ /**
19
+ * If set to true, the embedded object container dynamically resizes
20
+ * according to the height of the pinboard.
21
+ */
22
+ fullHeight?: boolean;
23
+ /**
24
+ * This is the minimum height(in pixels) for a full height pinboard.
25
+ * Setting this height helps resolves issues with empty pinboards and
26
+ * other screens navigable from a pinboard.
27
+ * @default 500
28
+ * * _since 1.5.0_
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 pinboard to display in the embedded view.
37
+ */
38
+ pinboardId: string;
39
+ /**
40
+ * The visualization within the pinboard to display.
41
+ */
42
+ vizId?: string;
43
+ /**
44
+ * If set to true, all filter chips from a
45
+ * pinboard page will be read-only (no X buttons)
46
+ */
47
+ preventPinboardFilterRemoval?: boolean;
48
+ /**
49
+ * An array of vizids which should be visible when this pinboard loads.
50
+ * The ids not in this array are hidden from the pinboard.
51
+ * _since: 1.6.0_
52
+ */
53
+ pinboardVisibleVizs?: string[];
54
+ }
55
+ /**
56
+ * Embed a ThoughtSpot pinboard or visualization
57
+ * @Category Pinboards and Charts
58
+ */
59
+ export declare class PinboardEmbed extends V1Embed {
60
+ protected viewConfig: PinboardViewConfig;
61
+ private defaultHeight;
62
+ constructor(domSelector: DOMSelector, viewConfig: PinboardViewConfig);
63
+ /**
64
+ * Construct a map of params to be passed on to the
65
+ * embedded pinboard or visualization.
66
+ */
67
+ private getEmbedParams;
68
+ /**
69
+ * Construct the URL of the embedded ThoughtSpot pinboard or visualization
70
+ * to be loaded within the iframe.
71
+ * @param pinboardId The GUID of the pinboard.
72
+ * @param vizId The optional GUID of a visualization within the pinboard.
73
+ * @param runtimeFilters A list of runtime filters to be applied to
74
+ * the pinboard or visualization on load.
75
+ */
76
+ private getIFrameSrc;
77
+ /**
78
+ * Set the iframe height as per the computed height received
79
+ * from the ThoughtSpot app.
80
+ * @param data The event payload
81
+ */
82
+ private updateIFrameHeight;
83
+ private embedIframeCenter;
84
+ private handleRouteChangeFullHeightPinboard;
85
+ /**
86
+ * Render an embedded ThoughtSpot pinboard or visualization
87
+ * @param renderOptions An object specifying the pinboard ID,
88
+ * visualization ID and the runtime filters.
89
+ */
90
+ render(): PinboardEmbed;
91
+ }
@@ -6,7 +6,7 @@
6
6
  * @summary Base classes
7
7
  * @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
8
8
  */
9
- import { DOMSelector, HostEvent, EmbedEvent, MessageCallback, Action, RuntimeFilter, EmbedConfig } from '../types';
9
+ import { DOMSelector, HostEvent, EmbedEvent, MessageCallback, Action, RuntimeFilter, EmbedConfig, MessageOptions } from '../types';
10
10
  /**
11
11
  * Global prefix for all Thoughtspot postHash Params.
12
12
  */
@@ -71,15 +71,28 @@ export interface ViewConfig {
71
71
  * @version 1.6.0 or later
72
72
  */
73
73
  visibleActions?: Action[];
74
+ /**
75
+ * Show alert messages and toast messages in the embedded view.
76
+ * @version 1.11.0 | ThoughtSpot: 8.3.0.cl
77
+ */
78
+ showAlerts?: boolean;
74
79
  /**
75
80
  * The list of runtime filters to apply to a search answer,
76
81
  * visualization, or Liveboard.
77
82
  */
78
83
  runtimeFilters?: RuntimeFilter[];
84
+ /**
85
+ * The locale/language to use for the embedded view.
86
+ * @version 1.9.4 or later
87
+ */
88
+ locale?: string;
79
89
  /**
80
90
  * This is an object (key/val) of override flags which will be applied
81
91
  * to the internal embedded object. This can be used to add any
82
92
  * URL flag.
93
+ * Warning: This option is for advanced use only and is used internally
94
+ * to control embed behavior in non-regular ways. We do not publish the
95
+ * list of supported keys and values associated with each.
83
96
  * @version SDK: 1.9.0 | ThoughtSpot: 8.1.0.cl
84
97
  */
85
98
  additionalFlags?: {
@@ -236,9 +249,10 @@ export declare class TsEmbed {
236
249
  * sends an event of a particular message type to the host application.
237
250
  *
238
251
  * @param messageType The message type
239
- * @param callback A callback function
252
+ * @param callback A callback as a function
253
+ * @param options The message options
240
254
  */
241
- on(messageType: EmbedEvent, callback: MessageCallback): typeof TsEmbed.prototype;
255
+ on(messageType: EmbedEvent, callback: MessageCallback, options?: MessageOptions): typeof TsEmbed.prototype;
242
256
  /**
243
257
  * Triggers an event on specific Port registered against
244
258
  * for the EmbedEvent
@@ -140,11 +140,31 @@ export interface EmbedConfig {
140
140
  */
141
141
  customCssUrl?: string;
142
142
  }
143
+ /**
144
+ * MessagePayload: Embed event payload: message type, data and status (start/end)
145
+ */
143
146
  export declare type MessagePayload = {
144
147
  type: string;
145
148
  data: any;
149
+ status?: string;
150
+ };
151
+ /**
152
+ * MessageOptions: By Providing options, getting specific event start / end based on option
153
+ */
154
+ export declare type MessageOptions = {
155
+ start?: boolean;
146
156
  };
157
+ /**
158
+ * MessageCallback: Embed event message callback
159
+ */
147
160
  export declare type MessageCallback = (payload: MessagePayload, responder?: (data: any) => void) => void;
161
+ /**
162
+ * MessageCallbackObj: contains message options & callback function
163
+ */
164
+ export declare type MessageCallbackObj = {
165
+ options: MessageOptions;
166
+ callback: MessageCallback;
167
+ };
148
168
  export declare type GenericCallbackFn = (...args: any[]) => any;
149
169
  export declare type QueryParams = {
150
170
  [key: string]: string;
@@ -292,6 +312,12 @@ export declare enum EmbedEvent {
292
312
  * @version 1.5.0 or later
293
313
  */
294
314
  VizPointDoubleClick = "vizPointDoubleClick",
315
+ /**
316
+ * A click has been triggered on table/chart
317
+ * @return ContextMenuInputPoints - data point that is clicked
318
+ * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
319
+ */
320
+ VizPointClick = "vizPointClick",
295
321
  /**
296
322
  * An error has occurred.
297
323
  * @return error - An error object or message
@@ -356,7 +382,102 @@ export declare enum EmbedEvent {
356
382
  * rendered liveboard
357
383
  * @version 1.9.1 or later
358
384
  */
359
- LiveboardRendered = "PinboardRendered"
385
+ LiveboardRendered = "PinboardRendered",
386
+ /**
387
+ * Emitted when answer is saved in the app
388
+ * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
389
+ */
390
+ Save = "save",
391
+ /**
392
+ * Emitted when the download action is triggered on an answer
393
+ * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
394
+ */
395
+ Download = "download",
396
+ /**
397
+ * Emitted when the Download as PDF action is triggered on an answer
398
+ * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
399
+ */
400
+ DownloadAsPdf = "downloadAsPdf",
401
+ /**
402
+ * Emitted when the Download as CSV action is triggered on an answer
403
+ * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
404
+ */
405
+ DownloadAsCsv = "downloadAsCsv",
406
+ /**
407
+ * Emitted when the Download as XLSX action is triggered on an answer
408
+ * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
409
+ */
410
+ DownloadAsXlsx = "downloadAsXlsx",
411
+ /**
412
+ * Emitted when an answer is deleted in the app
413
+ * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
414
+ */
415
+ AnswerDelete = "answerDelete",
416
+ /**
417
+ * Emitted when an answer is pinned to a Liveboard
418
+ * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
419
+ */
420
+ Pin = "pin",
421
+ /**
422
+ * Emitted when SpotIQ analysis is triggered
423
+ * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
424
+ */
425
+ SpotIQAnalyze = "spotIQAnalyze",
426
+ /**
427
+ * Emitted when a user shares an object with another user or group
428
+ * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
429
+ */
430
+ Share = "share",
431
+ /**
432
+ * Emitted when a user clicks the Include action to include a specific value or data on a chart or table
433
+ * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
434
+ */
435
+ DrillInclude = "context-menu-item-include",
436
+ /**
437
+ * Emitted when a user clicks the Exclude action to exclude a specific value or data on a chart or table
438
+ * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
439
+ */
440
+ DrillExclude = "context-menu-item-exclude",
441
+ /**
442
+ * Emitted when copied column value on the app
443
+ * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
444
+ */
445
+ CopyToClipboard = "context-menu-item-copy-to-clipboard",
446
+ /**
447
+ * Emitted when a user clicks the Update TML action
448
+ * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
449
+ */
450
+ UpdateTML = "updateTSL",
451
+ /**
452
+ * Emitted when a user clicks the Edit TML action
453
+ * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
454
+ */
455
+ EditTML = "editTSL",
456
+ /**
457
+ * Emitted when ExportTML trigger in answer on the app
458
+ * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
459
+ */
460
+ ExportTML = "exportTSL",
461
+ /**
462
+ * Emitted when an answer is saved as a view
463
+ * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
464
+ */
465
+ SaveAsView = "saveAsView",
466
+ /**
467
+ * Emitted when copy of existing answer on the app
468
+ * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
469
+ */
470
+ CopyAEdit = "copyAEdit",
471
+ /**
472
+ * Emitted when a user clicks Show underlying data on an answe
473
+ * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
474
+ */
475
+ ShowUnderlyingData = "showUnderlyingData",
476
+ /**
477
+ * Emitted when an answer is switched to a chart or table view
478
+ * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
479
+ */
480
+ AnswerChartSwitcher = "answerChartSwitcher"
360
481
  }
361
482
  /**
362
483
  * Event types that can be triggered by the host application
@@ -456,7 +577,9 @@ export declare enum Param {
456
577
  CustomCSSUrl = "customCssUrl",
457
578
  DisableLoginRedirect = "disableLoginRedirect",
458
579
  visibleVizs = "pinboardVisibleVizs",
459
- LiveboardV2Enabled = "isPinboardV2Enabled"
580
+ LiveboardV2Enabled = "isPinboardV2Enabled",
581
+ ShowAlerts = "showAlerts",
582
+ Locale = "locale"
460
583
  }
461
584
  /**
462
585
  * The list of actions that can be performed on visual ThoughtSpot
File without changes
@@ -34,6 +34,10 @@ export declare const getCssDimension: (value: number | string) => string;
34
34
  export declare const appendToUrlHash: (url: string, stringToAppend: string) => string;
35
35
  export declare const getEncodedQueryParamsString: (queryString: string) => string;
36
36
  export declare const getOffsetTop: (element: any) => any;
37
+ export declare const embedEventStatus: {
38
+ START: string;
39
+ END: string;
40
+ };
37
41
  export declare const setAttributes: (element: HTMLElement, attributes: {
38
42
  [key: string]: string | number | boolean;
39
43
  }) => void;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Copyright: ThoughtSpot Inc. 2012-2016
3
+ * Author: Shashank Singh (sunny@thoughtspot.com)
4
+ *
5
+ * @fileoverview ThoughtSpot Javascript API for use of ThoughtSpot in external webpages.
6
+ */
7
+ import { AuthType } from '../types';
8
+ export declare enum Events {
9
+ THOUGHTSPOT_AUTH_EXPIRED = "ThoughtspotAuthExpired",
10
+ EXPORT_VIZ_DATA_TO_PARENT = "exportVizDataToParent",
11
+ ALERT = "alert",
12
+ EXPORT_VIZ_DATA_TO_CHILD = "exportVizDataToChild",
13
+ GET_DATA = "getData"
14
+ }
15
+ declare type Callback = (...args: any[]) => void;
16
+ declare function checkIfLoggedIn(tsHost: string, callback: Callback): void;
17
+ declare function initialize(onInitialized: Callback, onAuthExpiration: Callback, _thoughtspotHost: string, authType: AuthType): void;
18
+ declare function notifyOnAuthExpiration(): void;
19
+ export { initialize, checkIfLoggedIn, notifyOnAuthExpiration };
@@ -109,6 +109,10 @@ const getOffsetTop = (element) => {
109
109
  const rect = element.getBoundingClientRect();
110
110
  return rect.top + window.scrollY;
111
111
  };
112
+ const embedEventStatus = {
113
+ START: 'start',
114
+ END: 'end',
115
+ };
112
116
  const setAttributes = (element, attributes) => {
113
117
  Object.keys(attributes).forEach((key) => {
114
118
  element.setAttribute(key, attributes[key].toString());
@@ -282,6 +286,12 @@ var EmbedEvent;
282
286
  * @version 1.5.0 or later
283
287
  */
284
288
  EmbedEvent["VizPointDoubleClick"] = "vizPointDoubleClick";
289
+ /**
290
+ * A click has been triggered on table/chart
291
+ * @return ContextMenuInputPoints - data point that is clicked
292
+ * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
293
+ */
294
+ EmbedEvent["VizPointClick"] = "vizPointClick";
285
295
  /**
286
296
  * An error has occurred.
287
297
  * @return error - An error object or message
@@ -347,6 +357,101 @@ var EmbedEvent;
347
357
  * @version 1.9.1 or later
348
358
  */
349
359
  EmbedEvent["LiveboardRendered"] = "PinboardRendered";
360
+ /**
361
+ * Emitted when answer is saved in the app
362
+ * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
363
+ */
364
+ EmbedEvent["Save"] = "save";
365
+ /**
366
+ * Emitted when the download action is triggered on an answer
367
+ * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
368
+ */
369
+ EmbedEvent["Download"] = "download";
370
+ /**
371
+ * Emitted when the Download as PDF action is triggered on an answer
372
+ * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
373
+ */
374
+ EmbedEvent["DownloadAsPdf"] = "downloadAsPdf";
375
+ /**
376
+ * Emitted when the Download as CSV action is triggered on an answer
377
+ * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
378
+ */
379
+ EmbedEvent["DownloadAsCsv"] = "downloadAsCsv";
380
+ /**
381
+ * Emitted when the Download as XLSX action is triggered on an answer
382
+ * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
383
+ */
384
+ EmbedEvent["DownloadAsXlsx"] = "downloadAsXlsx";
385
+ /**
386
+ * Emitted when an answer is deleted in the app
387
+ * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
388
+ */
389
+ EmbedEvent["AnswerDelete"] = "answerDelete";
390
+ /**
391
+ * Emitted when an answer is pinned to a Liveboard
392
+ * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
393
+ */
394
+ EmbedEvent["Pin"] = "pin";
395
+ /**
396
+ * Emitted when SpotIQ analysis is triggered
397
+ * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
398
+ */
399
+ EmbedEvent["SpotIQAnalyze"] = "spotIQAnalyze";
400
+ /**
401
+ * Emitted when a user shares an object with another user or group
402
+ * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
403
+ */
404
+ EmbedEvent["Share"] = "share";
405
+ /**
406
+ * Emitted when a user clicks the Include action to include a specific value or data on a chart or table
407
+ * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
408
+ */
409
+ EmbedEvent["DrillInclude"] = "context-menu-item-include";
410
+ /**
411
+ * Emitted when a user clicks the Exclude action to exclude a specific value or data on a chart or table
412
+ * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
413
+ */
414
+ EmbedEvent["DrillExclude"] = "context-menu-item-exclude";
415
+ /**
416
+ * Emitted when copied column value on the app
417
+ * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
418
+ */
419
+ EmbedEvent["CopyToClipboard"] = "context-menu-item-copy-to-clipboard";
420
+ /**
421
+ * Emitted when a user clicks the Update TML action
422
+ * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
423
+ */
424
+ EmbedEvent["UpdateTML"] = "updateTSL";
425
+ /**
426
+ * Emitted when a user clicks the Edit TML action
427
+ * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
428
+ */
429
+ EmbedEvent["EditTML"] = "editTSL";
430
+ /**
431
+ * Emitted when ExportTML trigger in answer on the app
432
+ * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
433
+ */
434
+ EmbedEvent["ExportTML"] = "exportTSL";
435
+ /**
436
+ * Emitted when an answer is saved as a view
437
+ * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
438
+ */
439
+ EmbedEvent["SaveAsView"] = "saveAsView";
440
+ /**
441
+ * Emitted when copy of existing answer on the app
442
+ * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
443
+ */
444
+ EmbedEvent["CopyAEdit"] = "copyAEdit";
445
+ /**
446
+ * Emitted when a user clicks Show underlying data on an answe
447
+ * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
448
+ */
449
+ EmbedEvent["ShowUnderlyingData"] = "showUnderlyingData";
450
+ /**
451
+ * Emitted when an answer is switched to a chart or table view
452
+ * @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
453
+ */
454
+ EmbedEvent["AnswerChartSwitcher"] = "answerChartSwitcher";
350
455
  })(EmbedEvent || (EmbedEvent = {}));
351
456
  /**
352
457
  * Event types that can be triggered by the host application
@@ -453,6 +558,8 @@ var Param;
453
558
  Param["DisableLoginRedirect"] = "disableLoginRedirect";
454
559
  Param["visibleVizs"] = "pinboardVisibleVizs";
455
560
  Param["LiveboardV2Enabled"] = "isPinboardV2Enabled";
561
+ Param["ShowAlerts"] = "showAlerts";
562
+ Param["Locale"] = "locale";
456
563
  })(Param || (Param = {}));
457
564
  /**
458
565
  * The list of actions that can be performed on visual ThoughtSpot
@@ -8968,7 +9075,7 @@ function processTrigger(iFrame, messageType, thoughtSpotHost, data) {
8968
9075
  }
8969
9076
  }
8970
9077
 
8971
- var name="@thoughtspot/visual-embed-sdk";var version="1.10.0-alpha.2";var description="ThoughtSpot Embed SDK";var module="lib/src/index.js";var main="dist/tsembed.js";var types="lib/src/index.d.ts";var files=["dist/**","lib/**","src/**"];var exports={".":"./lib/src/index.js","./react":"./lib/src/react/index.js"};var scripts={lint:"eslint 'src/**'","lint:fix":"eslint 'src/**/*.*' --fix",tsc:"tsc -p . --incremental false",start:"gatsby develop","build:gatsby":"npm run clean:gatsby && gatsby build --prefix-paths","build:gatsby:noprefix":"npm run clean:gatsby && gatsby build","serve:gatsby":"gatsby serve","clean:gatsby":"gatsby clean","build-and-publish":"npm run build:gatsby && npm run publish","bundle-dts":"dts-bundle --name @thoughtspot/visual-embed-sdk --out visual-embed-sdk.d.ts --main lib/src/index.d.ts",build:"rollup -c",watch:"rollup -cw","docs-cmd":"node scripts/gatsby-commands.js",docgen:"typedoc --tsconfig tsconfig.json --theme typedoc-theme","test-sdk":"jest -c jest.config.sdk.js","test-docs":"jest -c jest.config.docs.js",test:"npm run test-sdk && npm run test-docs && npx istanbul-merge --out ./coverage/coverage.json ./coverage/docs/coverage-final.json ./coverage/sdk/coverage-final.json && npx istanbul report --include ./coverage/coverage.json --dir ./coverage lcov",posttest:"cat ./coverage/lcov.info | coveralls",prepublishOnly:"npm run test; npm run tsc; npm run bundle-dts; npm run build","publish-dev":"npm publish --tag dev","publish-prod":"npm publish --tag latest"};var peerDependencies={react:"> 16.8.0","react-dom":"> 16.8.0"};var dependencies={algoliasearch:"^4.10.5",classnames:"^2.3.1","mixpanel-browser":"^2.41.0"};var devDependencies={"@mdx-js/mdx":"^1.6.22","@mdx-js/react":"^1.6.22","@react-icons/all-files":"^4.1.0","@rollup/plugin-commonjs":"^18.0.0","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^11.2.1","@testing-library/dom":"^7.31.0","@testing-library/jest-dom":"^5.14.1","@testing-library/react":"^11.2.7","@testing-library/user-event":"^13.1.8","@types/jest":"^22.2.3","@types/mixpanel-browser":"^2.35.6","@types/react-test-renderer":"^17.0.1","@typescript-eslint/eslint-plugin":"^4.6.0","@typescript-eslint/parser":"^4.6.0",asciidoctor:"^2.2.1","babel-jest":"^26.6.3","babel-preset-gatsby":"^1.10.0","command-line-args":"^5.1.1",coveralls:"^3.1.0","dts-bundle":"0.7.3",eslint:"^7.12.1","eslint-config-airbnb-base":"^14.2.0","eslint-config-prettier":"^6.15.0","eslint-import-resolver-typescript":"^2.3.0","eslint-plugin-import":"^2.22.1","eslint-plugin-prettier":"^3.1.4","eslint-plugin-react-hooks":"^4.2.0","fs-extra":"^10.0.0",gatsby:"3.1.0","gatsby-plugin-algolia":"^0.22.2","gatsby-plugin-catch-links":"^3.1.0","gatsby-plugin-env-variables":"^2.1.0","gatsby-plugin-intl":"^0.3.3","gatsby-plugin-manifest":"^3.2.0","gatsby-plugin-output":"^0.1.3","gatsby-plugin-sass":"4.1.0","gatsby-plugin-sitemap":"^4.10.0","gatsby-source-filesystem":"3.1.0","gatsby-transformer-asciidoc":"2.1.0","gatsby-transformer-rehype":"2.0.0","gh-pages":"^3.1.0","highlight.js":"^10.6.0","html-to-text":"^8.0.0","identity-obj-proxy":"^3.0.0","istanbul-merge":"^1.1.1",jest:"^26.6.3","jest-puppeteer":"^4.4.0",jsdom:"^17.0.0","node-sass":"^4.0.0",prettier:"2.1.2",puppeteer:"^7.0.1",react:"^16.14.0","react-dom":"^16.14.0","react-resizable":"^1.11.0","react-resize-detector":"^6.6.0","react-test-renderer":"^17.0.2","react-use-flexsearch":"^0.1.1",rollup:"2.30.0","rollup-plugin-typescript2":"0.27.3","ts-jest":"^26.5.5","ts-loader":"8.0.4",typedoc:"0.21.6","typedoc-neo-theme":"^1.1.0","typedoc-plugin-toc-group":"0.0.5",typescript:"^4.1.0","url-search-params-polyfill":"^8.1.0",util:"^0.12.4"};var author="ThoughtSpot";var email="support@thoughtspot.com";var license="ThoughtSpot Development Tools End User License Agreement";var directories={lib:"lib"};var repository={type:"git",url:"git+https://github.com/thoughtspot/visual-embed-sdk.git"};var publishConfig={registry:"https://registry.npmjs.org"};var keywords=["thoughtspot","everywhere","embed","sdk","analytics"];var bugs={url:"https://github.com/thoughtspot/visual-embed-sdk/issues"};var homepage="https://github.com/thoughtspot/visual-embed-sdk#readme";var globals={window:{}};var pkgInfo = {name:name,version:version,description:description,module:module,main:main,types:types,files:files,exports:exports,scripts:scripts,peerDependencies:peerDependencies,dependencies:dependencies,devDependencies:devDependencies,author:author,email:email,license:license,directories:directories,repository:repository,publishConfig:publishConfig,keywords:keywords,bugs:bugs,homepage:homepage,globals:globals};
9078
+ var name="@thoughtspot/visual-embed-sdk";var version="1.10.0-alpha.3";var description="ThoughtSpot Embed SDK";var module="lib/src/index.js";var main="dist/tsembed.js";var types="lib/src/index.d.ts";var files=["dist/**","lib/**","src/**"];var exports={".":"./lib/src/index.js","./react":"./lib/src/react/index.js"};var scripts={lint:"eslint 'src/**'","lint:fix":"eslint 'src/**/*.*' --fix",tsc:"tsc -p . --incremental false",start:"gatsby develop","build:gatsby":"npm run clean:gatsby && gatsby build --prefix-paths","build:gatsby:noprefix":"npm run clean:gatsby && gatsby build","serve:gatsby":"gatsby serve","clean:gatsby":"gatsby clean","build-and-publish":"npm run build:gatsby && npm run publish","bundle-dts":"dts-bundle --name @thoughtspot/visual-embed-sdk --out visual-embed-sdk.d.ts --main lib/src/index.d.ts",build:"rollup -c",watch:"rollup -cw","docs-cmd":"node scripts/gatsby-commands.js",docgen:"typedoc --tsconfig tsconfig.json --theme typedoc-theme","test-sdk":"jest -c jest.config.sdk.js","test-docs":"jest -c jest.config.docs.js",test:"npm run test-sdk && npm run test-docs && npx istanbul-merge --out ./coverage/coverage.json ./coverage/docs/coverage-final.json ./coverage/sdk/coverage-final.json && npx istanbul report --include ./coverage/coverage.json --dir ./coverage lcov",posttest:"cat ./coverage/sdk/lcov.info | coveralls",prepublishOnly:"npm run test; npm run tsc; npm run bundle-dts; npm run build","publish-dev":"npm publish --tag dev","publish-prod":"npm publish --tag latest"};var peerDependencies={react:"> 16.8.0","react-dom":"> 16.8.0"};var dependencies={algoliasearch:"^4.10.5",classnames:"^2.3.1","mixpanel-browser":"^2.41.0"};var devDependencies={"@mdx-js/mdx":"^1.6.22","@mdx-js/react":"^1.6.22","@react-icons/all-files":"^4.1.0","@rollup/plugin-commonjs":"^18.0.0","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^11.2.1","@testing-library/dom":"^7.31.0","@testing-library/jest-dom":"^5.14.1","@testing-library/react":"^11.2.7","@testing-library/user-event":"^13.1.8","@types/jest":"^22.2.3","@types/mixpanel-browser":"^2.35.6","@types/react-test-renderer":"^17.0.1","@typescript-eslint/eslint-plugin":"^4.6.0","@typescript-eslint/parser":"^4.6.0",asciidoctor:"^2.2.1","babel-jest":"^26.6.3","babel-preset-gatsby":"^1.10.0","command-line-args":"^5.1.1",coveralls:"^3.1.0","dts-bundle":"0.7.3",eslint:"^7.12.1","eslint-config-airbnb-base":"^14.2.0","eslint-config-prettier":"^6.15.0","eslint-import-resolver-typescript":"^2.3.0","eslint-plugin-import":"^2.22.1","eslint-plugin-prettier":"^3.1.4","eslint-plugin-react-hooks":"^4.2.0","fs-extra":"^10.0.0",gatsby:"3.1.0","gatsby-plugin-algolia":"^0.22.2","gatsby-plugin-catch-links":"^3.1.0","gatsby-plugin-env-variables":"^2.1.0","gatsby-plugin-intl":"^0.3.3","gatsby-plugin-manifest":"^3.2.0","gatsby-plugin-output":"^0.1.3","gatsby-plugin-sass":"4.1.0","gatsby-plugin-sitemap":"^4.10.0","gatsby-source-filesystem":"3.1.0","gatsby-transformer-asciidoc":"2.1.0","gatsby-transformer-rehype":"2.0.0","gh-pages":"^3.1.0","highlight.js":"^10.6.0","html-to-text":"^8.0.0","identity-obj-proxy":"^3.0.0","istanbul-merge":"^1.1.1",jest:"^26.6.3","jest-puppeteer":"^4.4.0",jsdom:"^17.0.0","node-sass":"^4.0.0",prettier:"2.1.2",puppeteer:"^7.0.1",react:"^16.14.0","react-dom":"^16.14.0","react-resizable":"^1.11.0","react-resize-detector":"^6.6.0","react-test-renderer":"^17.0.2","react-use-flexsearch":"^0.1.1",rollup:"2.30.0","rollup-plugin-typescript2":"0.27.3","ts-jest":"^26.5.5","ts-loader":"8.0.4",typedoc:"0.21.6","typedoc-neo-theme":"^1.1.0","typedoc-plugin-toc-group":"0.0.5",typescript:"^4.1.0","url-search-params-polyfill":"^8.1.0",util:"^0.12.4"};var author="ThoughtSpot";var email="support@thoughtspot.com";var license="ThoughtSpot Development Tools End User License Agreement";var directories={lib:"lib"};var repository={type:"git",url:"git+https://github.com/thoughtspot/visual-embed-sdk.git"};var publishConfig={registry:"https://registry.npmjs.org"};var keywords=["thoughtspot","everywhere","embed","sdk","analytics"];var bugs={url:"https://github.com/thoughtspot/visual-embed-sdk/issues"};var homepage="https://github.com/thoughtspot/visual-embed-sdk#readme";var globals={window:{}};var pkgInfo = {name:name,version:version,description:description,module:module,main:main,types:types,files:files,exports:exports,scripts:scripts,peerDependencies:peerDependencies,dependencies:dependencies,devDependencies:devDependencies,author:author,email:email,license:license,directories:directories,repository:repository,publishConfig:publishConfig,keywords:keywords,bugs:bugs,homepage:homepage,globals:globals};
8972
9079
 
8973
9080
  /**
8974
9081
  * Copyright (c) 2022
@@ -9135,13 +9242,14 @@ class TsEmbed {
9135
9242
  queryParams[Param.ViewPortHeight] = window.innerHeight;
9136
9243
  queryParams[Param.ViewPortWidth] = window.innerWidth;
9137
9244
  queryParams[Param.Version] = version$1;
9138
- if (this.embedConfig.disableLoginRedirect === true) {
9139
- queryParams[Param.DisableLoginRedirect] = this.embedConfig.disableLoginRedirect;
9245
+ if (this.embedConfig.disableLoginRedirect === true ||
9246
+ this.embedConfig.autoLogin === true) {
9247
+ queryParams[Param.DisableLoginRedirect] = true;
9140
9248
  }
9141
9249
  if (this.embedConfig.customCssUrl) {
9142
9250
  queryParams[Param.CustomCSSUrl] = this.embedConfig.customCssUrl;
9143
9251
  }
9144
- const { disabledActions, disabledActionReason, hiddenActions, visibleActions, additionalFlags, } = this.viewConfig;
9252
+ const { disabledActions, disabledActionReason, hiddenActions, visibleActions, showAlerts, additionalFlags, locale, } = this.viewConfig;
9145
9253
  if (Array.isArray(visibleActions) && Array.isArray(hiddenActions)) {
9146
9254
  this.handleError('You cannot have both hidden actions and visible actions');
9147
9255
  return queryParams;
@@ -9158,6 +9266,12 @@ class TsEmbed {
9158
9266
  if (Array.isArray(visibleActions)) {
9159
9267
  queryParams[Param.VisibleActions] = visibleActions;
9160
9268
  }
9269
+ if (showAlerts !== undefined) {
9270
+ queryParams[Param.ShowAlerts] = showAlerts;
9271
+ }
9272
+ if (locale !== undefined) {
9273
+ queryParams[Param.Locale] = locale;
9274
+ }
9161
9275
  if (additionalFlags && additionalFlags.constructor.name === 'Object') {
9162
9276
  Object.assign(queryParams, additionalFlags);
9163
9277
  }
@@ -9275,9 +9389,18 @@ class TsEmbed {
9275
9389
  */
9276
9390
  executeCallbacks(eventType, data, eventPort) {
9277
9391
  const callbacks = this.eventHandlerMap.get(eventType) || [];
9278
- callbacks.forEach((callback) => callback(data, (payload) => {
9279
- this.triggerEventOnPort(eventPort, payload);
9280
- }));
9392
+ const dataStatus = (data === null || data === void 0 ? void 0 : data.status) || embedEventStatus.END;
9393
+ callbacks.forEach((callbackObj) => {
9394
+ if ((callbackObj.options.start &&
9395
+ dataStatus === embedEventStatus.START) || // When start status is true it trigger only start releated payload
9396
+ (!callbackObj.options.start &&
9397
+ dataStatus === embedEventStatus.END) // When start status is false it trigger only end releated payload
9398
+ ) {
9399
+ callbackObj.callback(data, (payload) => {
9400
+ this.triggerEventOnPort(eventPort, payload);
9401
+ });
9402
+ }
9403
+ });
9281
9404
  }
9282
9405
  /**
9283
9406
  * Returns the ThoughtSpot hostname or IP address.
@@ -9334,14 +9457,15 @@ class TsEmbed {
9334
9457
  * sends an event of a particular message type to the host application.
9335
9458
  *
9336
9459
  * @param messageType The message type
9337
- * @param callback A callback function
9460
+ * @param callback A callback as a function
9461
+ * @param options The message options
9338
9462
  */
9339
- on(messageType, callback) {
9463
+ on(messageType, callback, options = { start: false }) {
9340
9464
  if (this.isRendered) {
9341
9465
  this.handleError('Please register event handlers before calling render');
9342
9466
  }
9343
9467
  const callbacks = this.eventHandlerMap.get(messageType) || [];
9344
- callbacks.push(callback);
9468
+ callbacks.push({ options, callback });
9345
9469
  this.eventHandlerMap.set(messageType, callbacks);
9346
9470
  return this;
9347
9471
  }
@@ -9477,6 +9601,10 @@ var Page;
9477
9601
  * Data management page
9478
9602
  */
9479
9603
  Page["Data"] = "data";
9604
+ /**
9605
+ * SpotIQ listing page
9606
+ */
9607
+ Page["SpotIQ"] = "spotiq";
9480
9608
  })(Page || (Page = {}));
9481
9609
  /**
9482
9610
  * Embeds full ThoughtSpot experience in a host application.
@@ -9535,6 +9663,8 @@ class AppEmbed extends V1Embed {
9535
9663
  return 'pinboards';
9536
9664
  case Page.Data:
9537
9665
  return 'data/tables';
9666
+ case Page.SpotIQ:
9667
+ return 'insights/results';
9538
9668
  case Page.Home:
9539
9669
  default:
9540
9670
  return 'home';