@thoughtspot/visual-embed-sdk 1.12.1 → 1.13.0-alpha.2
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.
- package/CHANGELOG.md +6 -19
- package/README.md +1 -1
- package/dist/src/auth.d.ts +14 -4
- package/dist/src/auth.spec.d.ts +0 -1
- package/dist/src/embed/base.d.ts +1 -0
- package/dist/src/embed/liveboard.d.ts +1 -7
- package/dist/src/embed/search.d.ts +0 -5
- package/dist/src/embed/ts-embed.d.ts +2 -3
- package/dist/src/errors.d.ts +0 -2
- package/dist/src/test/test-utils.d.ts +0 -6
- package/dist/src/types.d.ts +2 -24
- package/dist/src/utils/processTrigger.d.ts +1 -1
- package/dist/src/utils.d.ts +0 -1
- package/dist/tsembed.es.js +40 -91
- package/dist/tsembed.js +40 -91
- package/lib/package.json +2 -4
- package/lib/src/auth.d.ts +14 -4
- package/lib/src/auth.js +15 -10
- package/lib/src/auth.js.map +1 -1
- package/lib/src/auth.spec.d.ts +0 -1
- package/lib/src/auth.spec.js +1 -4
- package/lib/src/auth.spec.js.map +1 -1
- package/lib/src/embed/app.spec.js +6 -8
- package/lib/src/embed/app.spec.js.map +1 -1
- package/lib/src/embed/base.d.ts +1 -0
- package/lib/src/embed/base.js +10 -0
- package/lib/src/embed/base.js.map +1 -1
- package/lib/src/embed/base.spec.js +16 -0
- package/lib/src/embed/base.spec.js.map +1 -1
- package/lib/src/embed/embed.spec.js +0 -2
- package/lib/src/embed/embed.spec.js.map +1 -1
- package/lib/src/embed/events.spec.js +1 -3
- package/lib/src/embed/events.spec.js.map +1 -1
- package/lib/src/embed/liveboard.d.ts +1 -7
- package/lib/src/embed/liveboard.js +0 -12
- package/lib/src/embed/liveboard.js.map +1 -1
- package/lib/src/embed/liveboard.spec.js +4 -18
- package/lib/src/embed/liveboard.spec.js.map +1 -1
- package/lib/src/embed/pinboard.spec.js +3 -4
- package/lib/src/embed/pinboard.spec.js.map +1 -1
- package/lib/src/embed/search.d.ts +0 -5
- package/lib/src/embed/search.js +2 -10
- package/lib/src/embed/search.js.map +1 -1
- package/lib/src/embed/search.spec.js +1 -9
- package/lib/src/embed/search.spec.js.map +1 -1
- package/lib/src/embed/ts-embed.d.ts +2 -3
- package/lib/src/embed/ts-embed.js +7 -8
- package/lib/src/embed/ts-embed.js.map +1 -1
- package/lib/src/embed/ts-embed.spec.js +5 -12
- package/lib/src/embed/ts-embed.spec.js.map +1 -1
- package/lib/src/errors.d.ts +0 -2
- package/lib/src/errors.js +0 -2
- package/lib/src/errors.js.map +1 -1
- package/lib/src/react/index.js +2 -3
- package/lib/src/react/index.js.map +1 -1
- package/lib/src/react/index.spec.js +4 -6
- package/lib/src/react/index.spec.js.map +1 -1
- package/lib/src/test/test-utils.d.ts +0 -6
- package/lib/src/test/test-utils.js +0 -15
- package/lib/src/test/test-utils.js.map +1 -1
- package/lib/src/types.d.ts +2 -24
- package/lib/src/types.js +0 -16
- package/lib/src/types.js.map +1 -1
- package/lib/src/utils/processTrigger.d.ts +1 -1
- package/lib/src/utils/processTrigger.js +8 -28
- package/lib/src/utils/processTrigger.js.map +1 -1
- package/lib/src/utils/processTrigger.spec.js +1 -11
- package/lib/src/utils/processTrigger.spec.js.map +1 -1
- package/lib/src/utils.d.ts +0 -1
- package/lib/src/utils.js +0 -11
- package/lib/src/utils.js.map +1 -1
- package/lib/src/utils.spec.js +1 -22
- package/lib/src/utils.spec.js.map +1 -1
- package/lib/src/visual-embed-sdk.d.ts +20 -42
- package/package.json +3 -5
- package/src/auth.spec.ts +1 -10
- package/src/auth.ts +15 -11
- package/src/embed/app.spec.ts +3 -8
- package/src/embed/base.spec.ts +18 -0
- package/src/embed/base.ts +10 -0
- package/src/embed/embed.spec.ts +0 -2
- package/src/embed/events.spec.ts +0 -3
- package/src/embed/liveboard.spec.ts +4 -27
- package/src/embed/liveboard.ts +0 -13
- package/src/embed/pinboard.spec.ts +3 -4
- package/src/embed/search.spec.ts +1 -11
- package/src/embed/search.ts +1 -20
- package/src/embed/ts-embed.spec.ts +5 -19
- package/src/embed/ts-embed.ts +11 -15
- package/src/errors.ts +0 -3
- package/src/react/index.spec.tsx +2 -7
- package/src/react/index.tsx +2 -3
- package/src/test/test-utils.ts +0 -16
- package/src/types.ts +0 -22
- package/src/utils/processTrigger.spec.ts +1 -11
- package/src/utils/processTrigger.ts +12 -36
- package/src/utils.spec.ts +0 -29
- package/src/utils.ts +0 -16
- package/dist/src/embed/searchEmbed-basic-auth.spec.d.ts +0 -1
- package/lib/src/embed/searchEmbed-basic-auth.spec.d.ts +0 -1
- package/lib/src/embed/searchEmbed-basic-auth.spec.js +0 -96
- package/lib/src/embed/searchEmbed-basic-auth.spec.js.map +0 -1
- package/src/embed/searchEmbed-basic-auth.spec.ts +0 -115
package/CHANGELOG.md
CHANGED
|
@@ -6,20 +6,7 @@ This project follows Semantic Versioning.
|
|
|
6
6
|
## Unreleased
|
|
7
7
|
|
|
8
8
|
### New Features
|
|
9
|
-
-
|
|
10
|
-
- Ability to turn on search assist in Search embed
|
|
11
|
-
|
|
12
|
-
## 1.11.2 (06-10-2022)
|
|
13
|
-
### Fixed
|
|
14
|
-
- Typescript build that was affecting some Angular project configurations
|
|
15
|
-
|
|
16
|
-
## 1.11.1 (05-30-2022)
|
|
17
|
-
### Fixed
|
|
18
|
-
- Whitelabeling - new [action](https://developers.thoughtspot.com/docs/typedoc/enums/Action.html#ReportError) for the ability to turn off TS specific error reporting by end users.
|
|
19
|
-
|
|
20
|
-
## 1.11.0 (05-20-2022)
|
|
21
|
-
- Release to support TS version 8.3.0.cl
|
|
22
|
-
- Please check the full list of changes [here](https://developers.thoughtspot.com/docs/?pageid=embed-sdk-changelog)
|
|
9
|
+
- Events for all actions on Search Embed
|
|
23
10
|
|
|
24
11
|
## 1.10.4 (05-06-2022)
|
|
25
12
|
### New Features
|
|
@@ -45,7 +32,7 @@ This project follows Semantic Versioning.
|
|
|
45
32
|
## 1.10.0 (04-22-2022)
|
|
46
33
|
|
|
47
34
|
- Release to support TS version 8.2.0.cl
|
|
48
|
-
- Please check the full list of changes [here](https://developers.thoughtspot.com/docs/?pageid=
|
|
35
|
+
- Please check the full list of changes [here](https://developers.thoughtspot.com/docs/?pageid=whats-new)
|
|
49
36
|
|
|
50
37
|
## 1.9.5 (04-06-2022)
|
|
51
38
|
|
|
@@ -61,12 +48,12 @@ This project follows Semantic Versioning.
|
|
|
61
48
|
|
|
62
49
|
## 1.9.3 (03-22-2022)
|
|
63
50
|
|
|
64
|
-
### New Features
|
|
51
|
+
### New Features
|
|
65
52
|
- `disableLoginRedirect` option in `EmbedConfig`
|
|
66
53
|
|
|
67
54
|
## 1.9.2 (03-17-2022)
|
|
68
55
|
|
|
69
|
-
### New Features
|
|
56
|
+
### New Features
|
|
70
57
|
- Ability to trigger events on React components
|
|
71
58
|
- Added new `useEmbedRef` hook, check README for usage.
|
|
72
59
|
|
|
@@ -86,7 +73,7 @@ This project follows Semantic Versioning.
|
|
|
86
73
|
## 1.9.0
|
|
87
74
|
|
|
88
75
|
- Release to support TS version 8.1.0.cl
|
|
89
|
-
- Please check the full list of changes [here](https://developers.thoughtspot.com/docs/?pageid=
|
|
76
|
+
- Please check the full list of changes [here](https://developers.thoughtspot.com/docs/?pageid=whats-new)
|
|
90
77
|
|
|
91
78
|
|
|
92
79
|
## 1.8.1
|
|
@@ -107,4 +94,4 @@ This project follows Semantic Versioning.
|
|
|
107
94
|
|
|
108
95
|
## 1.7.0 (and earlier)
|
|
109
96
|
|
|
110
|
-
- Please check the full list of changes [here](https://developers.thoughtspot.com/docs/?pageid=
|
|
97
|
+
- Please check the full list of changes [here](https://developers.thoughtspot.com/docs/?pageid=whats-new)
|
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
<br/>
|
|
6
6
|
|
|
7
|
-
# ThoughtSpot Visual Embed SDK <br/> [](https://coveralls.io/github/ts-blink/embed-sdk?branch=main)  [](https://www.jsdelivr.com/package/npm/@thoughtspot/visual-embed-sdk)  [](https://openbase.com/js/@thoughtspot/visual-embed-sdk?utm_source=embedded&utm_medium=badge&utm_campaign=rate-badge)
|
|
7
|
+
# ThoughtSpot Visual Embed SDK <br/> [](https://coveralls.io/github/ts-blink/embed-sdk?branch=main)  [](https://www.jsdelivr.com/package/npm/@thoughtspot/visual-embed-sdk)  [](https://openbase.com/js/@thoughtspot/visual-embed-sdk?utm_source=embedded&utm_medium=badge&utm_campaign=rate-badge)
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
SDK to embed ThoughtSpot into your web apps.
|
package/dist/src/auth.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { EmbedConfig } from './types';
|
|
|
2
2
|
export declare let loggedInStatus: boolean;
|
|
3
3
|
export declare let samlAuthWindow: Window;
|
|
4
4
|
export declare let samlCompletionPromise: Promise<void>;
|
|
5
|
+
export declare let sessionInfo: any;
|
|
5
6
|
export declare const SSO_REDIRECTION_MARKER_GUID = "5e16222e-ef02-43e9-9fbd-24226bf3ce5b";
|
|
6
7
|
export declare const EndPoints: {
|
|
7
8
|
AUTH_VERIFICATION: string;
|
|
@@ -18,14 +19,23 @@ export declare enum AuthFailureType {
|
|
|
18
19
|
OTHER = "OTHER"
|
|
19
20
|
}
|
|
20
21
|
export declare enum AuthStatus {
|
|
22
|
+
/**
|
|
23
|
+
* Emits when the SDK fails to authenticate
|
|
24
|
+
*/
|
|
21
25
|
FAILURE = "FAILURE",
|
|
26
|
+
/**
|
|
27
|
+
* Emits when the SDK succeeds to authenticate
|
|
28
|
+
*/
|
|
29
|
+
SDK_SUCCESS = "SDK_SUCCESS",
|
|
30
|
+
/**
|
|
31
|
+
* Emits when the App sends a auth success
|
|
32
|
+
*/
|
|
22
33
|
SUCCESS = "SUCCESS",
|
|
34
|
+
/**
|
|
35
|
+
* Emits when there is a logout
|
|
36
|
+
*/
|
|
23
37
|
LOGOUT = "LOGOUT"
|
|
24
38
|
}
|
|
25
|
-
/**
|
|
26
|
-
* Return releaseVersion if available
|
|
27
|
-
*/
|
|
28
|
-
export declare function getReleaseVersion(): string;
|
|
29
39
|
/**
|
|
30
40
|
* Return sessionInfo if available else make a loggedIn check to fetch the sessionInfo
|
|
31
41
|
*/
|
package/dist/src/auth.spec.d.ts
CHANGED
package/dist/src/embed/base.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ import { AuthFailureType } from '../auth';
|
|
|
12
12
|
export declare let authPromise: Promise<boolean>;
|
|
13
13
|
export declare const getEmbedConfig: () => EmbedConfig;
|
|
14
14
|
export declare const getAuthPromise: () => Promise<boolean>;
|
|
15
|
+
export declare function notifyAuthSDKSuccess(): void;
|
|
15
16
|
export declare function notifyAuthSuccess(): void;
|
|
16
17
|
export declare function notifyAuthFailure(failureType: AuthFailureType): void;
|
|
17
18
|
export declare function notifyLogout(): void;
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* @summary Liveboard & visualization embed
|
|
9
9
|
* @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
|
|
10
10
|
*/
|
|
11
|
-
import { DOMSelector
|
|
11
|
+
import { DOMSelector } from '../types';
|
|
12
12
|
import { V1Embed, ViewConfig } from './ts-embed';
|
|
13
13
|
/**
|
|
14
14
|
* The configuration for the embedded Liveboard or visualization page view.
|
|
@@ -102,12 +102,6 @@ export declare class LiveboardEmbed extends V1Embed {
|
|
|
102
102
|
private updateIFrameHeight;
|
|
103
103
|
private embedIframeCenter;
|
|
104
104
|
private setIframeHeightForNonEmbedLiveboard;
|
|
105
|
-
/**
|
|
106
|
-
* Triggers an event to the embedded app
|
|
107
|
-
* @param messageType The event type
|
|
108
|
-
* @param data The payload to send with the message
|
|
109
|
-
*/
|
|
110
|
-
trigger(messageType: HostEvent, data?: any): Promise<any>;
|
|
111
105
|
/**
|
|
112
106
|
* Render an embedded ThoughtSpot Liveboard or visualization
|
|
113
107
|
* @param renderOptions An object specifying the Liveboard ID,
|
|
@@ -44,13 +44,8 @@ export interface SearchViewConfig extends ViewConfig {
|
|
|
44
44
|
* using raw answer data.
|
|
45
45
|
*/
|
|
46
46
|
hideResults?: boolean;
|
|
47
|
-
/**
|
|
48
|
-
* If set to true, expands all the data sources panel.
|
|
49
|
-
*/
|
|
50
|
-
expandAllDataSource?: boolean;
|
|
51
47
|
/**
|
|
52
48
|
* If set to true, the Search Assist feature is enabled.
|
|
53
|
-
* @version SDK: 1.13.0 | ThoughtSpot: 8.5.0.cl
|
|
54
49
|
*/
|
|
55
50
|
enableSearchAssist?: boolean;
|
|
56
51
|
/**
|
|
@@ -29,7 +29,7 @@ export interface FrameParams {
|
|
|
29
29
|
* This parameters will be passed on the iframe
|
|
30
30
|
* as is.
|
|
31
31
|
*/
|
|
32
|
-
[key: string]: string | number | boolean
|
|
32
|
+
[key: string]: string | number | boolean;
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
35
|
* The configuration object for an embedded view.
|
|
@@ -142,7 +142,6 @@ export declare class TsEmbed {
|
|
|
142
142
|
* @default false
|
|
143
143
|
*/
|
|
144
144
|
private shouldEncodeUrlQueryParams;
|
|
145
|
-
private defaultHiddenActions;
|
|
146
145
|
constructor(domSelector: DOMSelector, viewConfig?: ViewConfig);
|
|
147
146
|
/**
|
|
148
147
|
* Gets a reference to the root DOM node where
|
|
@@ -266,7 +265,7 @@ export declare class TsEmbed {
|
|
|
266
265
|
* @param messageType The event type
|
|
267
266
|
* @param data The payload to send with the message
|
|
268
267
|
*/
|
|
269
|
-
trigger(messageType: HostEvent, data: any):
|
|
268
|
+
trigger(messageType: HostEvent, data: any): typeof TsEmbed.prototype;
|
|
270
269
|
/**
|
|
271
270
|
* Marks the ThoughtSpot object to have been rendered
|
|
272
271
|
* Needs to be overridden by subclasses to do the actual
|
package/dist/src/errors.d.ts
CHANGED
|
@@ -25,10 +25,4 @@ export declare const executeAfterWait: (fn: (...args: any[]) => void, waitTime?:
|
|
|
25
25
|
*/
|
|
26
26
|
export declare const EVENT_WAIT_TIME = 1000;
|
|
27
27
|
export declare function fixedEncodeURI(str: string): string;
|
|
28
|
-
/**
|
|
29
|
-
* MessageChannel is available in Node > 15.0.0. Since the current node environment's
|
|
30
|
-
* used for github actions is not above 14, we are mocking this for the current unit tests.
|
|
31
|
-
*/
|
|
32
|
-
export declare const messageChannelMock: any;
|
|
33
|
-
export declare const mockMessageChannel: () => void;
|
|
34
28
|
export {};
|
package/dist/src/types.d.ts
CHANGED
|
@@ -161,12 +161,6 @@ export interface EmbedConfig {
|
|
|
161
161
|
* @version SDK: 1.10.4 | ThoughtSpot: *
|
|
162
162
|
*/
|
|
163
163
|
detectCookieAccessSlow?: boolean;
|
|
164
|
-
/**
|
|
165
|
-
* Hide beta alert warning message for SearchEmbed.
|
|
166
|
-
*
|
|
167
|
-
* @version SDK: 1.12.0 | ThoughtSpot: *
|
|
168
|
-
*/
|
|
169
|
-
suppressSearchEmbedBetaWarning?: boolean;
|
|
170
164
|
}
|
|
171
165
|
/**
|
|
172
166
|
* MessagePayload: Embed event payload: message type, data and status (start/end)
|
|
@@ -576,19 +570,7 @@ export declare enum HostEvent {
|
|
|
576
570
|
* @param path - the path to navigate to (can be a number[1/-1] to go forward/back)
|
|
577
571
|
* @version SDK: 1.12.0 | ThoughtSpot: 8.4.0.cl
|
|
578
572
|
*/
|
|
579
|
-
Navigate = "Navigate"
|
|
580
|
-
/**
|
|
581
|
-
* Gets the current pinboard content.
|
|
582
|
-
* @version SDK: 1.13.0 | ThoughtSpot: 8.5.0.cl
|
|
583
|
-
*/
|
|
584
|
-
getExportRequestForCurrentPinboard = "getExportRequestForCurrentPinboard",
|
|
585
|
-
/**
|
|
586
|
-
* Fires the pin action on an embedded object
|
|
587
|
-
* @param - incase of liveboard embed, takes in an object with vizId as a key
|
|
588
|
-
* can be left empty for search and viz embeds
|
|
589
|
-
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
|
|
590
|
-
*/
|
|
591
|
-
Pin = "pin"
|
|
573
|
+
Navigate = "Navigate"
|
|
592
574
|
}
|
|
593
575
|
/**
|
|
594
576
|
* The different visual modes that the data sources panel within
|
|
@@ -782,11 +764,7 @@ export declare enum Action {
|
|
|
782
764
|
/**
|
|
783
765
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
|
|
784
766
|
*/
|
|
785
|
-
CreateMonitor = "createMonitor"
|
|
786
|
-
/**
|
|
787
|
-
* @version SDK: 1.11.1 | ThoughtSpot: 8.3.0.cl
|
|
788
|
-
*/
|
|
789
|
-
ReportError = "reportError"
|
|
767
|
+
CreateMonitor = "createMonitor"
|
|
790
768
|
}
|
|
791
769
|
export interface SessionInterface {
|
|
792
770
|
sessionId: string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { HostEvent } from '../types';
|
|
2
|
-
export declare function processTrigger(iFrame: HTMLIFrameElement, messageType: HostEvent, thoughtSpotHost: string, data: any):
|
|
2
|
+
export declare function processTrigger(iFrame: HTMLIFrameElement, messageType: HostEvent, thoughtSpotHost: string, data: any): void;
|
package/dist/src/utils.d.ts
CHANGED
|
@@ -42,4 +42,3 @@ export declare const embedEventStatus: {
|
|
|
42
42
|
export declare const setAttributes: (element: HTMLElement, attributes: {
|
|
43
43
|
[key: string]: string | number | boolean;
|
|
44
44
|
}) => void;
|
|
45
|
-
export declare const checkReleaseVersionInBeta: (releaseVersion: string, suppressBetaWarning: boolean) => boolean;
|
package/dist/tsembed.es.js
CHANGED
|
@@ -121,17 +121,6 @@ const setAttributes = (element, attributes) => {
|
|
|
121
121
|
Object.keys(attributes).forEach((key) => {
|
|
122
122
|
element.setAttribute(key, attributes[key].toString());
|
|
123
123
|
});
|
|
124
|
-
};
|
|
125
|
-
const isCloudRelease = (version) => version.endsWith('.cl');
|
|
126
|
-
/* For Search Embed: ReleaseVersionInBeta */
|
|
127
|
-
const checkReleaseVersionInBeta = (releaseVersion, suppressBetaWarning) => {
|
|
128
|
-
if (releaseVersion !== '' && !isCloudRelease(releaseVersion)) {
|
|
129
|
-
const splittedReleaseVersion = releaseVersion.split('.');
|
|
130
|
-
const majorVersion = Number(splittedReleaseVersion[0]);
|
|
131
|
-
const isBetaVersion = majorVersion < 8;
|
|
132
|
-
return !suppressBetaWarning && isBetaVersion;
|
|
133
|
-
}
|
|
134
|
-
return false;
|
|
135
124
|
};
|
|
136
125
|
|
|
137
126
|
/**
|
|
@@ -540,18 +529,6 @@ var HostEvent;
|
|
|
540
529
|
* @version SDK: 1.12.0 | ThoughtSpot: 8.4.0.cl
|
|
541
530
|
*/
|
|
542
531
|
HostEvent["Navigate"] = "Navigate";
|
|
543
|
-
/**
|
|
544
|
-
* Gets the current pinboard content.
|
|
545
|
-
* @version SDK: 1.13.0 | ThoughtSpot: 8.5.0.cl
|
|
546
|
-
*/
|
|
547
|
-
HostEvent["getExportRequestForCurrentPinboard"] = "getExportRequestForCurrentPinboard";
|
|
548
|
-
/**
|
|
549
|
-
* Fires the pin action on an embedded object
|
|
550
|
-
* @param - incase of liveboard embed, takes in an object with vizId as a key
|
|
551
|
-
* can be left empty for search and viz embeds
|
|
552
|
-
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
|
|
553
|
-
*/
|
|
554
|
-
HostEvent["Pin"] = "pin";
|
|
555
532
|
})(HostEvent || (HostEvent = {}));
|
|
556
533
|
/**
|
|
557
534
|
* The different visual modes that the data sources panel within
|
|
@@ -752,10 +729,6 @@ var Action;
|
|
|
752
729
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
|
|
753
730
|
*/
|
|
754
731
|
Action["CreateMonitor"] = "createMonitor";
|
|
755
|
-
/**
|
|
756
|
-
* @version SDK: 1.11.1 | ThoughtSpot: 8.3.0.cl
|
|
757
|
-
*/
|
|
758
|
-
Action["ReportError"] = "reportError";
|
|
759
732
|
})(Action || (Action = {}));
|
|
760
733
|
// eslint-disable-next-line no-shadow
|
|
761
734
|
var OperationType;
|
|
@@ -767,8 +740,6 @@ var OperationType;
|
|
|
767
740
|
const ERROR_MESSAGE = {
|
|
768
741
|
INVALID_THOUGHTSPOT_HOST: 'Error parsing ThoughtSpot host. Please provide a valid URL.',
|
|
769
742
|
LIVEBOARD_VIZ_ID_VALIDATION: 'Please provide either liveboardId or pinboardId',
|
|
770
|
-
TRIGGER_TIMED_OUT: 'Trigger timedout in getting response',
|
|
771
|
-
SEARCHEMBED_BETA_WRANING_MESSAGE: 'Search Embed is in Beta in this release.',
|
|
772
743
|
};
|
|
773
744
|
|
|
774
745
|
/**
|
|
@@ -7256,8 +7227,8 @@ let loggedInStatus = false;
|
|
|
7256
7227
|
let samlAuthWindow = null;
|
|
7257
7228
|
// eslint-disable-next-line import/no-mutable-exports
|
|
7258
7229
|
let samlCompletionPromise = null;
|
|
7230
|
+
// eslint-disable-next-line import/no-mutable-exports
|
|
7259
7231
|
let sessionInfo = null;
|
|
7260
|
-
let releaseVersion = '';
|
|
7261
7232
|
const SSO_REDIRECTION_MARKER_GUID = '5e16222e-ef02-43e9-9fbd-24226bf3ce5b';
|
|
7262
7233
|
const EndPoints = {
|
|
7263
7234
|
AUTH_VERIFICATION: '/callosum/v1/session/info',
|
|
@@ -7276,8 +7247,21 @@ var AuthFailureType;
|
|
|
7276
7247
|
})(AuthFailureType || (AuthFailureType = {}));
|
|
7277
7248
|
var AuthStatus;
|
|
7278
7249
|
(function (AuthStatus) {
|
|
7250
|
+
/**
|
|
7251
|
+
* Emits when the SDK fails to authenticate
|
|
7252
|
+
*/
|
|
7279
7253
|
AuthStatus["FAILURE"] = "FAILURE";
|
|
7254
|
+
/**
|
|
7255
|
+
* Emits when the SDK succeeds to authenticate
|
|
7256
|
+
*/
|
|
7257
|
+
AuthStatus["SDK_SUCCESS"] = "SDK_SUCCESS";
|
|
7258
|
+
/**
|
|
7259
|
+
* Emits when the App sends a auth success
|
|
7260
|
+
*/
|
|
7280
7261
|
AuthStatus["SUCCESS"] = "SUCCESS";
|
|
7262
|
+
/**
|
|
7263
|
+
* Emits when there is a logout
|
|
7264
|
+
*/
|
|
7281
7265
|
AuthStatus["LOGOUT"] = "LOGOUT";
|
|
7282
7266
|
})(AuthStatus || (AuthStatus = {}));
|
|
7283
7267
|
/**
|
|
@@ -7289,20 +7273,12 @@ async function isLoggedIn(thoughtSpotHost) {
|
|
|
7289
7273
|
let response = null;
|
|
7290
7274
|
try {
|
|
7291
7275
|
response = await fetchSessionInfoService(authVerificationUrl);
|
|
7292
|
-
const sessionInfoResp = await response.json();
|
|
7293
|
-
releaseVersion = sessionInfoResp.releaseVersion;
|
|
7294
7276
|
}
|
|
7295
7277
|
catch (e) {
|
|
7296
7278
|
return false;
|
|
7297
7279
|
}
|
|
7298
7280
|
return response.status === 200;
|
|
7299
7281
|
}
|
|
7300
|
-
/**
|
|
7301
|
-
* Return releaseVersion if available
|
|
7302
|
-
*/
|
|
7303
|
-
function getReleaseVersion() {
|
|
7304
|
-
return releaseVersion;
|
|
7305
|
-
}
|
|
7306
7282
|
function initSession(sessionDetails) {
|
|
7307
7283
|
sessionInfo = sessionDetails;
|
|
7308
7284
|
initMixpanel(sessionInfo);
|
|
@@ -7501,6 +7477,13 @@ let authPromise;
|
|
|
7501
7477
|
const getEmbedConfig = () => config;
|
|
7502
7478
|
const getAuthPromise = () => authPromise;
|
|
7503
7479
|
let authEE;
|
|
7480
|
+
function notifyAuthSDKSuccess() {
|
|
7481
|
+
if (!authEE) {
|
|
7482
|
+
console.error('SDK not initialized');
|
|
7483
|
+
return;
|
|
7484
|
+
}
|
|
7485
|
+
authEE.emit(AuthStatus.SDK_SUCCESS);
|
|
7486
|
+
}
|
|
7504
7487
|
function notifyAuthSuccess() {
|
|
7505
7488
|
if (!authEE) {
|
|
7506
7489
|
console.error('SDK not initialized');
|
|
@@ -7531,6 +7514,9 @@ const handleAuth = () => {
|
|
|
7531
7514
|
if (!isLoggedIn) {
|
|
7532
7515
|
notifyAuthFailure(AuthFailureType.SDK);
|
|
7533
7516
|
}
|
|
7517
|
+
else {
|
|
7518
|
+
notifyAuthSDKSuccess();
|
|
7519
|
+
}
|
|
7534
7520
|
}, () => {
|
|
7535
7521
|
notifyAuthFailure(AuthFailureType.SDK);
|
|
7536
7522
|
});
|
|
@@ -7763,38 +7749,19 @@ function reload(iFrame) {
|
|
|
7763
7749
|
/**
|
|
7764
7750
|
* Post Iframe message.
|
|
7765
7751
|
*/
|
|
7766
|
-
function postIframeMessage(iFrame, message, thoughtSpotHost
|
|
7767
|
-
return iFrame.contentWindow.postMessage(message, thoughtSpotHost
|
|
7768
|
-
channel === null || channel === void 0 ? void 0 : channel.port2,
|
|
7769
|
-
]);
|
|
7752
|
+
function postIframeMessage(iFrame, message, thoughtSpotHost) {
|
|
7753
|
+
return iFrame.contentWindow.postMessage(message, thoughtSpotHost);
|
|
7770
7754
|
}
|
|
7771
|
-
const TRIGGER_TIMEOUT = 30000;
|
|
7772
7755
|
function processTrigger(iFrame, messageType, thoughtSpotHost, data) {
|
|
7773
|
-
|
|
7774
|
-
|
|
7775
|
-
reload(iFrame);
|
|
7776
|
-
|
|
7777
|
-
|
|
7778
|
-
|
|
7779
|
-
channel.port1.onmessage = ({ data: responseData }) => {
|
|
7780
|
-
channel.port1.close();
|
|
7781
|
-
if (responseData.error) {
|
|
7782
|
-
rej(responseData.error);
|
|
7783
|
-
}
|
|
7784
|
-
else {
|
|
7785
|
-
res(responseData);
|
|
7786
|
-
}
|
|
7787
|
-
};
|
|
7788
|
-
// Close the messageChannel and resolve the promise if timeout.
|
|
7789
|
-
setTimeout(() => {
|
|
7790
|
-
channel.port1.close();
|
|
7791
|
-
res(new Error(ERROR_MESSAGE.TRIGGER_TIMED_OUT));
|
|
7792
|
-
}, TRIGGER_TIMEOUT);
|
|
7793
|
-
return postIframeMessage(iFrame, { type: messageType, data }, thoughtSpotHost, channel);
|
|
7794
|
-
});
|
|
7756
|
+
switch (messageType) {
|
|
7757
|
+
case HostEvent.Reload:
|
|
7758
|
+
return reload(iFrame);
|
|
7759
|
+
default:
|
|
7760
|
+
return postIframeMessage(iFrame, { type: messageType, data }, thoughtSpotHost);
|
|
7761
|
+
}
|
|
7795
7762
|
}
|
|
7796
7763
|
|
|
7797
|
-
var name="@thoughtspot/visual-embed-sdk";var version="1.
|
|
7764
|
+
var name="@thoughtspot/visual-embed-sdk";var version="1.13.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/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",eventemitter3:"^4.0.7","mixpanel-browser":"^2.45.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};
|
|
7798
7765
|
|
|
7799
7766
|
/**
|
|
7800
7767
|
* Copyright (c) 2022
|
|
@@ -7832,7 +7799,6 @@ class TsEmbed {
|
|
|
7832
7799
|
* @default false
|
|
7833
7800
|
*/
|
|
7834
7801
|
this.shouldEncodeUrlQueryParams = false;
|
|
7835
|
-
this.defaultHiddenActions = [Action.ReportError];
|
|
7836
7802
|
this.el = this.getDOMNode(domSelector);
|
|
7837
7803
|
// TODO: handle error
|
|
7838
7804
|
this.embedConfig = getEmbedConfig();
|
|
@@ -7869,7 +7835,7 @@ class TsEmbed {
|
|
|
7869
7835
|
error,
|
|
7870
7836
|
});
|
|
7871
7837
|
// Log error
|
|
7872
|
-
console.
|
|
7838
|
+
console.log(error);
|
|
7873
7839
|
}
|
|
7874
7840
|
/**
|
|
7875
7841
|
* Extracts the type field from the event payload
|
|
@@ -7975,10 +7941,9 @@ class TsEmbed {
|
|
|
7975
7941
|
if (disabledActionReason) {
|
|
7976
7942
|
queryParams[Param.DisableActionReason] = disabledActionReason;
|
|
7977
7943
|
}
|
|
7978
|
-
|
|
7979
|
-
|
|
7980
|
-
|
|
7981
|
-
];
|
|
7944
|
+
if (hiddenActions === null || hiddenActions === void 0 ? void 0 : hiddenActions.length) {
|
|
7945
|
+
queryParams[Param.HideActions] = hiddenActions;
|
|
7946
|
+
}
|
|
7982
7947
|
if (Array.isArray(visibleActions)) {
|
|
7983
7948
|
queryParams[Param.VisibleActions] = visibleActions;
|
|
7984
7949
|
}
|
|
@@ -8223,8 +8188,9 @@ class TsEmbed {
|
|
|
8223
8188
|
* @param data The payload to send with the message
|
|
8224
8189
|
*/
|
|
8225
8190
|
trigger(messageType, data) {
|
|
8191
|
+
processTrigger(this.iFrame, messageType, this.thoughtSpotHost, data);
|
|
8226
8192
|
uploadMixpanelEvent(`${MIXPANEL_EVENT.VISUAL_SDK_TRIGGER}-${messageType}`);
|
|
8227
|
-
return
|
|
8193
|
+
return this;
|
|
8228
8194
|
}
|
|
8229
8195
|
/**
|
|
8230
8196
|
* Marks the ThoughtSpot object to have been rendered
|
|
@@ -8539,18 +8505,6 @@ class LiveboardEmbed extends V1Embed {
|
|
|
8539
8505
|
url = `${url}${tsPostHashParams}`;
|
|
8540
8506
|
return url;
|
|
8541
8507
|
}
|
|
8542
|
-
/**
|
|
8543
|
-
* Triggers an event to the embedded app
|
|
8544
|
-
* @param messageType The event type
|
|
8545
|
-
* @param data The payload to send with the message
|
|
8546
|
-
*/
|
|
8547
|
-
trigger(messageType, data = {}) {
|
|
8548
|
-
const dataWithVizId = data;
|
|
8549
|
-
if (this.viewConfig.vizId) {
|
|
8550
|
-
dataWithVizId.vizId = this.viewConfig.vizId;
|
|
8551
|
-
}
|
|
8552
|
-
return super.trigger(messageType, dataWithVizId);
|
|
8553
|
-
}
|
|
8554
8508
|
/**
|
|
8555
8509
|
* Render an embedded ThoughtSpot Liveboard or visualization
|
|
8556
8510
|
* @param renderOptions An object specifying the Liveboard ID,
|
|
@@ -8627,7 +8581,7 @@ class SearchEmbed extends TsEmbed {
|
|
|
8627
8581
|
*/
|
|
8628
8582
|
getIFrameSrc(answerId, dataSources) {
|
|
8629
8583
|
var _a;
|
|
8630
|
-
const { hideResults,
|
|
8584
|
+
const { hideResults, enableSearchAssist, forceTable, searchOptions, } = this.viewConfig;
|
|
8631
8585
|
const answerPath = answerId ? `saved-answer/${answerId}` : 'answer';
|
|
8632
8586
|
const queryParams = this.getBaseQueryParams();
|
|
8633
8587
|
queryParams[Param.HideActions] = [
|
|
@@ -8671,11 +8625,6 @@ class SearchEmbed extends TsEmbed {
|
|
|
8671
8625
|
const { answerId, dataSources } = this.viewConfig;
|
|
8672
8626
|
const src = this.getIFrameSrc(answerId, dataSources);
|
|
8673
8627
|
this.renderIFrame(src, this.viewConfig.frameParams);
|
|
8674
|
-
getAuthPromise().then(() => {
|
|
8675
|
-
if (checkReleaseVersionInBeta(getReleaseVersion(), getEmbedConfig().suppressSearchEmbedBetaWarning)) {
|
|
8676
|
-
alert(ERROR_MESSAGE.SEARCHEMBED_BETA_WRANING_MESSAGE);
|
|
8677
|
-
}
|
|
8678
|
-
});
|
|
8679
8628
|
return this;
|
|
8680
8629
|
}
|
|
8681
8630
|
}
|