@thoughtspot/visual-embed-sdk 1.13.0-alpha.2 → 1.13.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.
- package/CHANGELOG.md +25 -4
- package/README.md +1 -1
- package/dist/src/auth.d.ts +4 -1
- package/dist/src/auth.spec.d.ts +1 -0
- package/dist/src/embed/app.d.ts +5 -0
- package/dist/src/embed/liveboard.d.ts +7 -1
- package/dist/src/embed/search.d.ts +1 -0
- package/dist/src/embed/searchEmbed-basic-auth.spec.d.ts +1 -0
- package/dist/src/embed/ts-embed.d.ts +4 -3
- package/dist/src/errors.d.ts +2 -0
- package/dist/src/test/test-utils.d.ts +6 -0
- package/dist/src/types.d.ts +30 -2
- package/dist/src/utils/processTrigger.d.ts +1 -1
- package/dist/src/utils.d.ts +1 -0
- package/dist/tsembed.es.js +105 -20
- package/dist/tsembed.js +105 -20
- package/lib/package.json +4 -2
- package/lib/src/auth.d.ts +4 -1
- package/lib/src/auth.js +11 -2
- package/lib/src/auth.js.map +1 -1
- package/lib/src/auth.spec.d.ts +1 -0
- package/lib/src/auth.spec.js +13 -1
- package/lib/src/auth.spec.js.map +1 -1
- package/lib/src/config.spec.js +7 -0
- package/lib/src/config.spec.js.map +1 -1
- package/lib/src/embed/app.d.ts +5 -0
- package/lib/src/embed/app.js +1 -1
- package/lib/src/embed/app.js.map +1 -1
- package/lib/src/embed/app.spec.js +18 -6
- package/lib/src/embed/app.spec.js.map +1 -1
- package/lib/src/embed/embed.spec.js +2 -0
- package/lib/src/embed/embed.spec.js.map +1 -1
- package/lib/src/embed/events.spec.js +3 -1
- package/lib/src/embed/events.spec.js.map +1 -1
- package/lib/src/embed/liveboard.d.ts +7 -1
- package/lib/src/embed/liveboard.js +16 -1
- package/lib/src/embed/liveboard.js.map +1 -1
- package/lib/src/embed/liveboard.spec.js +21 -6
- package/lib/src/embed/liveboard.spec.js.map +1 -1
- package/lib/src/embed/pinboard.spec.js +7 -5
- package/lib/src/embed/pinboard.spec.js.map +1 -1
- package/lib/src/embed/search.d.ts +1 -0
- package/lib/src/embed/search.js +9 -1
- package/lib/src/embed/search.js.map +1 -1
- package/lib/src/embed/search.spec.js +9 -1
- package/lib/src/embed/search.spec.js.map +1 -1
- package/lib/src/embed/searchEmbed-basic-auth.spec.d.ts +1 -0
- package/lib/src/embed/searchEmbed-basic-auth.spec.js +96 -0
- package/lib/src/embed/searchEmbed-basic-auth.spec.js.map +1 -0
- package/lib/src/embed/ts-embed.d.ts +4 -3
- package/lib/src/embed/ts-embed.js +11 -9
- package/lib/src/embed/ts-embed.js.map +1 -1
- package/lib/src/embed/ts-embed.spec.js +12 -5
- package/lib/src/embed/ts-embed.spec.js.map +1 -1
- package/lib/src/errors.d.ts +2 -0
- package/lib/src/errors.js +2 -0
- package/lib/src/errors.js.map +1 -1
- package/lib/src/react/index.js +3 -2
- package/lib/src/react/index.js.map +1 -1
- package/lib/src/react/index.spec.js +6 -4
- package/lib/src/react/index.spec.js.map +1 -1
- package/lib/src/test/test-utils.d.ts +6 -0
- package/lib/src/test/test-utils.js +15 -0
- package/lib/src/test/test-utils.js.map +1 -1
- package/lib/src/types.d.ts +30 -2
- package/lib/src/types.js +22 -0
- package/lib/src/types.js.map +1 -1
- package/lib/src/utils/processTrigger.d.ts +1 -1
- package/lib/src/utils/processTrigger.js +28 -8
- package/lib/src/utils/processTrigger.js.map +1 -1
- package/lib/src/utils/processTrigger.spec.js +11 -1
- package/lib/src/utils/processTrigger.spec.js.map +1 -1
- package/lib/src/utils.d.ts +1 -0
- package/lib/src/utils.js +11 -0
- package/lib/src/utils.js.map +1 -1
- package/lib/src/utils.spec.js +22 -1
- package/lib/src/utils.spec.js.map +1 -1
- package/lib/src/visual-embed-sdk.d.ts +50 -7
- package/package.json +4 -2
- package/src/auth.spec.ts +20 -1
- package/src/auth.ts +12 -2
- package/src/config.spec.ts +11 -0
- package/src/embed/app.spec.ts +22 -3
- package/src/embed/app.ts +6 -0
- package/src/embed/embed.spec.ts +2 -0
- package/src/embed/events.spec.ts +3 -0
- package/src/embed/liveboard.spec.ts +31 -6
- package/src/embed/liveboard.ts +17 -0
- package/src/embed/pinboard.spec.ts +8 -6
- package/src/embed/search.spec.ts +11 -1
- package/src/embed/search.ts +15 -1
- package/src/embed/searchEmbed-basic-auth.spec.ts +115 -0
- package/src/embed/ts-embed.spec.ts +19 -5
- package/src/embed/ts-embed.ts +19 -11
- package/src/errors.ts +3 -0
- package/src/react/index.spec.tsx +7 -2
- package/src/react/index.tsx +3 -2
- package/src/test/test-utils.ts +16 -0
- package/src/types.ts +28 -0
- package/src/utils/processTrigger.spec.ts +11 -1
- package/src/utils/processTrigger.ts +36 -12
- package/src/utils.spec.ts +29 -0
- package/src/utils.ts +16 -0
package/CHANGELOG.md
CHANGED
|
@@ -6,7 +6,28 @@ This project follows Semantic Versioning.
|
|
|
6
6
|
## Unreleased
|
|
7
7
|
|
|
8
8
|
### New Features
|
|
9
|
-
-
|
|
9
|
+
- Event for navigating to a specific page in App embed without any reload
|
|
10
|
+
- Ability to turn on search assist in Search embed
|
|
11
|
+
- Set of new Host events to drive interactions on the embed programatically
|
|
12
|
+
|
|
13
|
+
## 1.12.1 (06-21-2022)
|
|
14
|
+
### Fixed
|
|
15
|
+
- Search embed beta warning check for TS cloud releases
|
|
16
|
+
## 1.12.0 (06-21-2022)
|
|
17
|
+
- Release to support TS version 8.4.0.cl
|
|
18
|
+
- Please check the full list of changes [here](https://developers.thoughtspot.com/docs/?pageid=embed-sdk-changelog)
|
|
19
|
+
|
|
20
|
+
## 1.11.2 (06-10-2022)
|
|
21
|
+
### Fixed
|
|
22
|
+
- Typescript build that was affecting some Angular project configurations
|
|
23
|
+
|
|
24
|
+
## 1.11.1 (05-30-2022)
|
|
25
|
+
### Fixed
|
|
26
|
+
- 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.
|
|
27
|
+
|
|
28
|
+
## 1.11.0 (05-20-2022)
|
|
29
|
+
- Release to support TS version 8.3.0.cl
|
|
30
|
+
- Please check the full list of changes [here](https://developers.thoughtspot.com/docs/?pageid=embed-sdk-changelog)
|
|
10
31
|
|
|
11
32
|
## 1.10.4 (05-06-2022)
|
|
12
33
|
### New Features
|
|
@@ -32,7 +53,7 @@ This project follows Semantic Versioning.
|
|
|
32
53
|
## 1.10.0 (04-22-2022)
|
|
33
54
|
|
|
34
55
|
- Release to support TS version 8.2.0.cl
|
|
35
|
-
- Please check the full list of changes [here](https://developers.thoughtspot.com/docs/?pageid=
|
|
56
|
+
- Please check the full list of changes [here](https://developers.thoughtspot.com/docs/?pageid=embed-sdk-changelog)
|
|
36
57
|
|
|
37
58
|
## 1.9.5 (04-06-2022)
|
|
38
59
|
|
|
@@ -73,7 +94,7 @@ This project follows Semantic Versioning.
|
|
|
73
94
|
## 1.9.0
|
|
74
95
|
|
|
75
96
|
- Release to support TS version 8.1.0.cl
|
|
76
|
-
- 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=embed-sdk-changelog)
|
|
77
98
|
|
|
78
99
|
|
|
79
100
|
## 1.8.1
|
|
@@ -94,4 +115,4 @@ This project follows Semantic Versioning.
|
|
|
94
115
|
|
|
95
116
|
## 1.7.0 (and earlier)
|
|
96
117
|
|
|
97
|
-
- Please check the full list of changes [here](https://developers.thoughtspot.com/docs/?pageid=
|
|
118
|
+
- Please check the full list of changes [here](https://developers.thoughtspot.com/docs/?pageid=embed-sdk-changelog)
|
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,7 +2,6 @@ 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;
|
|
6
5
|
export declare const SSO_REDIRECTION_MARKER_GUID = "5e16222e-ef02-43e9-9fbd-24226bf3ce5b";
|
|
7
6
|
export declare const EndPoints: {
|
|
8
7
|
AUTH_VERIFICATION: string;
|
|
@@ -36,6 +35,10 @@ export declare enum AuthStatus {
|
|
|
36
35
|
*/
|
|
37
36
|
LOGOUT = "LOGOUT"
|
|
38
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* Return releaseVersion if available
|
|
40
|
+
*/
|
|
41
|
+
export declare function getReleaseVersion(): string;
|
|
39
42
|
/**
|
|
40
43
|
* Return sessionInfo if available else make a loggedIn check to fetch the sessionInfo
|
|
41
44
|
*/
|
package/dist/src/auth.spec.d.ts
CHANGED
package/dist/src/embed/app.d.ts
CHANGED
|
@@ -86,6 +86,11 @@ export interface AppViewConfig extends ViewConfig {
|
|
|
86
86
|
* @hidden
|
|
87
87
|
*/
|
|
88
88
|
liveboardV2?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* If set to true, the Search Assist feature is enabled.
|
|
91
|
+
* @version SDK: 1.13.0 | ThoughtSpot: 8.5.0.cl
|
|
92
|
+
*/
|
|
93
|
+
enableSearchAssist?: boolean;
|
|
89
94
|
}
|
|
90
95
|
/**
|
|
91
96
|
* Embeds full ThoughtSpot experience in a host application.
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* @summary Liveboard & visualization embed
|
|
9
9
|
* @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
|
|
10
10
|
*/
|
|
11
|
-
import { DOMSelector } from '../types';
|
|
11
|
+
import { DOMSelector, HostEvent } 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,6 +102,12 @@ 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>;
|
|
105
111
|
/**
|
|
106
112
|
* Render an embedded ThoughtSpot Liveboard or visualization
|
|
107
113
|
* @param renderOptions An object specifying the Liveboard ID,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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 | undefined;
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
35
|
* The configuration object for an embedded view.
|
|
@@ -142,6 +142,7 @@ export declare class TsEmbed {
|
|
|
142
142
|
* @default false
|
|
143
143
|
*/
|
|
144
144
|
private shouldEncodeUrlQueryParams;
|
|
145
|
+
private defaultHiddenActions;
|
|
145
146
|
constructor(domSelector: DOMSelector, viewConfig?: ViewConfig);
|
|
146
147
|
/**
|
|
147
148
|
* Gets a reference to the root DOM node where
|
|
@@ -198,7 +199,7 @@ export declare class TsEmbed {
|
|
|
198
199
|
* @param isAppEmbed A Boolean parameter to specify if you are embedding
|
|
199
200
|
* the full application.
|
|
200
201
|
*/
|
|
201
|
-
protected getV1EmbedBasePath(queryString: string, showPrimaryNavbar?: boolean, disableProfileAndHelp?: boolean, isAppEmbed?: boolean): string;
|
|
202
|
+
protected getV1EmbedBasePath(queryString: string, showPrimaryNavbar?: boolean, disableProfileAndHelp?: boolean, isAppEmbed?: boolean, enableSearchAssist?: boolean): string;
|
|
202
203
|
/**
|
|
203
204
|
* Renders the embedded ThoughtSpot app in an iframe and sets up
|
|
204
205
|
* event listeners.
|
|
@@ -265,7 +266,7 @@ export declare class TsEmbed {
|
|
|
265
266
|
* @param messageType The event type
|
|
266
267
|
* @param data The payload to send with the message
|
|
267
268
|
*/
|
|
268
|
-
trigger(messageType: HostEvent, data: any):
|
|
269
|
+
trigger(messageType: HostEvent, data: any): Promise<any>;
|
|
269
270
|
/**
|
|
270
271
|
* Marks the ThoughtSpot object to have been rendered
|
|
271
272
|
* Needs to be overridden by subclasses to do the actual
|
package/dist/src/errors.d.ts
CHANGED
|
@@ -25,4 +25,10 @@ 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;
|
|
28
34
|
export {};
|
package/dist/src/types.d.ts
CHANGED
|
@@ -17,8 +17,13 @@ export declare enum AuthType {
|
|
|
17
17
|
None = "None",
|
|
18
18
|
/**
|
|
19
19
|
* SSO using SAML
|
|
20
|
+
* @deprecated Use {@link SAML} instead
|
|
20
21
|
*/
|
|
21
22
|
SSO = "SSO_SAML",
|
|
23
|
+
/**
|
|
24
|
+
* SSO using SAML
|
|
25
|
+
*/
|
|
26
|
+
SAML = "SSO_SAML",
|
|
22
27
|
/**
|
|
23
28
|
* SSO using OIDC
|
|
24
29
|
*/
|
|
@@ -161,6 +166,12 @@ export interface EmbedConfig {
|
|
|
161
166
|
* @version SDK: 1.10.4 | ThoughtSpot: *
|
|
162
167
|
*/
|
|
163
168
|
detectCookieAccessSlow?: boolean;
|
|
169
|
+
/**
|
|
170
|
+
* Hide beta alert warning message for SearchEmbed.
|
|
171
|
+
*
|
|
172
|
+
* @version SDK: 1.12.0 | ThoughtSpot: *
|
|
173
|
+
*/
|
|
174
|
+
suppressSearchEmbedBetaWarning?: boolean;
|
|
164
175
|
}
|
|
165
176
|
/**
|
|
166
177
|
* MessagePayload: Embed event payload: message type, data and status (start/end)
|
|
@@ -570,7 +581,19 @@ export declare enum HostEvent {
|
|
|
570
581
|
* @param path - the path to navigate to (can be a number[1/-1] to go forward/back)
|
|
571
582
|
* @version SDK: 1.12.0 | ThoughtSpot: 8.4.0.cl
|
|
572
583
|
*/
|
|
573
|
-
Navigate = "Navigate"
|
|
584
|
+
Navigate = "Navigate",
|
|
585
|
+
/**
|
|
586
|
+
* Gets the current pinboard content.
|
|
587
|
+
* @version SDK: 1.13.0 | ThoughtSpot: 8.5.0.cl
|
|
588
|
+
*/
|
|
589
|
+
getExportRequestForCurrentPinboard = "getExportRequestForCurrentPinboard",
|
|
590
|
+
/**
|
|
591
|
+
* Fires the pin action on an embedded object
|
|
592
|
+
* @param - incase of liveboard embed, takes in an object with vizId as a key
|
|
593
|
+
* can be left empty for search and viz embeds
|
|
594
|
+
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
|
|
595
|
+
*/
|
|
596
|
+
Pin = "pin"
|
|
574
597
|
}
|
|
575
598
|
/**
|
|
576
599
|
* The different visual modes that the data sources panel within
|
|
@@ -615,6 +638,7 @@ export declare enum Param {
|
|
|
615
638
|
fullHeight = "isFullHeightPinboard",
|
|
616
639
|
livedBoardEmbed = "isLiveboardEmbed",
|
|
617
640
|
searchEmbed = "isSearchEmbed",
|
|
641
|
+
vizEmbed = "isVizEmbed",
|
|
618
642
|
Version = "sdkVersion",
|
|
619
643
|
ViewPortHeight = "viewPortHeight",
|
|
620
644
|
ViewPortWidth = "viewPortWidth",
|
|
@@ -764,7 +788,11 @@ export declare enum Action {
|
|
|
764
788
|
/**
|
|
765
789
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
|
|
766
790
|
*/
|
|
767
|
-
CreateMonitor = "createMonitor"
|
|
791
|
+
CreateMonitor = "createMonitor",
|
|
792
|
+
/**
|
|
793
|
+
* @version SDK: 1.11.1 | ThoughtSpot: 8.3.0.cl
|
|
794
|
+
*/
|
|
795
|
+
ReportError = "reportError"
|
|
768
796
|
}
|
|
769
797
|
export interface SessionInterface {
|
|
770
798
|
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): Promise<any>;
|
package/dist/src/utils.d.ts
CHANGED
|
@@ -42,3 +42,4 @@ 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,6 +121,17 @@ 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;
|
|
124
135
|
};
|
|
125
136
|
|
|
126
137
|
/**
|
|
@@ -144,8 +155,13 @@ var AuthType;
|
|
|
144
155
|
AuthType["None"] = "None";
|
|
145
156
|
/**
|
|
146
157
|
* SSO using SAML
|
|
158
|
+
* @deprecated Use {@link SAML} instead
|
|
147
159
|
*/
|
|
148
160
|
AuthType["SSO"] = "SSO_SAML";
|
|
161
|
+
/**
|
|
162
|
+
* SSO using SAML
|
|
163
|
+
*/
|
|
164
|
+
AuthType["SAML"] = "SSO_SAML";
|
|
149
165
|
/**
|
|
150
166
|
* SSO using OIDC
|
|
151
167
|
*/
|
|
@@ -529,6 +545,18 @@ var HostEvent;
|
|
|
529
545
|
* @version SDK: 1.12.0 | ThoughtSpot: 8.4.0.cl
|
|
530
546
|
*/
|
|
531
547
|
HostEvent["Navigate"] = "Navigate";
|
|
548
|
+
/**
|
|
549
|
+
* Gets the current pinboard content.
|
|
550
|
+
* @version SDK: 1.13.0 | ThoughtSpot: 8.5.0.cl
|
|
551
|
+
*/
|
|
552
|
+
HostEvent["getExportRequestForCurrentPinboard"] = "getExportRequestForCurrentPinboard";
|
|
553
|
+
/**
|
|
554
|
+
* Fires the pin action on an embedded object
|
|
555
|
+
* @param - incase of liveboard embed, takes in an object with vizId as a key
|
|
556
|
+
* can be left empty for search and viz embeds
|
|
557
|
+
* @version SDK: 1.15.0 | ThoughtSpot: 8.7.0.cl
|
|
558
|
+
*/
|
|
559
|
+
HostEvent["Pin"] = "pin";
|
|
532
560
|
})(HostEvent || (HostEvent = {}));
|
|
533
561
|
/**
|
|
534
562
|
* The different visual modes that the data sources panel within
|
|
@@ -577,6 +605,7 @@ var Param;
|
|
|
577
605
|
Param["fullHeight"] = "isFullHeightPinboard";
|
|
578
606
|
Param["livedBoardEmbed"] = "isLiveboardEmbed";
|
|
579
607
|
Param["searchEmbed"] = "isSearchEmbed";
|
|
608
|
+
Param["vizEmbed"] = "isVizEmbed";
|
|
580
609
|
Param["Version"] = "sdkVersion";
|
|
581
610
|
Param["ViewPortHeight"] = "viewPortHeight";
|
|
582
611
|
Param["ViewPortWidth"] = "viewPortWidth";
|
|
@@ -729,6 +758,10 @@ var Action;
|
|
|
729
758
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
|
|
730
759
|
*/
|
|
731
760
|
Action["CreateMonitor"] = "createMonitor";
|
|
761
|
+
/**
|
|
762
|
+
* @version SDK: 1.11.1 | ThoughtSpot: 8.3.0.cl
|
|
763
|
+
*/
|
|
764
|
+
Action["ReportError"] = "reportError";
|
|
732
765
|
})(Action || (Action = {}));
|
|
733
766
|
// eslint-disable-next-line no-shadow
|
|
734
767
|
var OperationType;
|
|
@@ -740,6 +773,8 @@ var OperationType;
|
|
|
740
773
|
const ERROR_MESSAGE = {
|
|
741
774
|
INVALID_THOUGHTSPOT_HOST: 'Error parsing ThoughtSpot host. Please provide a valid URL.',
|
|
742
775
|
LIVEBOARD_VIZ_ID_VALIDATION: 'Please provide either liveboardId or pinboardId',
|
|
776
|
+
TRIGGER_TIMED_OUT: 'Trigger timedout in getting response',
|
|
777
|
+
SEARCHEMBED_BETA_WRANING_MESSAGE: 'Search Embed is in Beta in this release.',
|
|
743
778
|
};
|
|
744
779
|
|
|
745
780
|
/**
|
|
@@ -7227,8 +7262,8 @@ let loggedInStatus = false;
|
|
|
7227
7262
|
let samlAuthWindow = null;
|
|
7228
7263
|
// eslint-disable-next-line import/no-mutable-exports
|
|
7229
7264
|
let samlCompletionPromise = null;
|
|
7230
|
-
// eslint-disable-next-line import/no-mutable-exports
|
|
7231
7265
|
let sessionInfo = null;
|
|
7266
|
+
let releaseVersion = '';
|
|
7232
7267
|
const SSO_REDIRECTION_MARKER_GUID = '5e16222e-ef02-43e9-9fbd-24226bf3ce5b';
|
|
7233
7268
|
const EndPoints = {
|
|
7234
7269
|
AUTH_VERIFICATION: '/callosum/v1/session/info',
|
|
@@ -7273,12 +7308,20 @@ async function isLoggedIn(thoughtSpotHost) {
|
|
|
7273
7308
|
let response = null;
|
|
7274
7309
|
try {
|
|
7275
7310
|
response = await fetchSessionInfoService(authVerificationUrl);
|
|
7311
|
+
const sessionInfoResp = await response.json();
|
|
7312
|
+
releaseVersion = sessionInfoResp.releaseVersion;
|
|
7276
7313
|
}
|
|
7277
7314
|
catch (e) {
|
|
7278
7315
|
return false;
|
|
7279
7316
|
}
|
|
7280
7317
|
return response.status === 200;
|
|
7281
7318
|
}
|
|
7319
|
+
/**
|
|
7320
|
+
* Return releaseVersion if available
|
|
7321
|
+
*/
|
|
7322
|
+
function getReleaseVersion() {
|
|
7323
|
+
return releaseVersion;
|
|
7324
|
+
}
|
|
7282
7325
|
function initSession(sessionDetails) {
|
|
7283
7326
|
sessionInfo = sessionDetails;
|
|
7284
7327
|
initMixpanel(sessionInfo);
|
|
@@ -7455,6 +7498,7 @@ const authenticate = async (embedConfig) => {
|
|
|
7455
7498
|
const { authType } = embedConfig;
|
|
7456
7499
|
switch (authType) {
|
|
7457
7500
|
case AuthType.SSO:
|
|
7501
|
+
case AuthType.SAML:
|
|
7458
7502
|
return doSamlAuth(embedConfig);
|
|
7459
7503
|
case AuthType.OIDC:
|
|
7460
7504
|
return doOIDCAuth(embedConfig);
|
|
@@ -7749,19 +7793,38 @@ function reload(iFrame) {
|
|
|
7749
7793
|
/**
|
|
7750
7794
|
* Post Iframe message.
|
|
7751
7795
|
*/
|
|
7752
|
-
function postIframeMessage(iFrame, message, thoughtSpotHost) {
|
|
7753
|
-
return iFrame.contentWindow.postMessage(message, thoughtSpotHost
|
|
7796
|
+
function postIframeMessage(iFrame, message, thoughtSpotHost, channel) {
|
|
7797
|
+
return iFrame.contentWindow.postMessage(message, thoughtSpotHost, [
|
|
7798
|
+
channel === null || channel === void 0 ? void 0 : channel.port2,
|
|
7799
|
+
]);
|
|
7754
7800
|
}
|
|
7801
|
+
const TRIGGER_TIMEOUT = 30000;
|
|
7755
7802
|
function processTrigger(iFrame, messageType, thoughtSpotHost, data) {
|
|
7756
|
-
|
|
7757
|
-
|
|
7758
|
-
|
|
7759
|
-
|
|
7760
|
-
|
|
7761
|
-
|
|
7803
|
+
return new Promise((res, rej) => {
|
|
7804
|
+
if (messageType === HostEvent.Reload) {
|
|
7805
|
+
reload(iFrame);
|
|
7806
|
+
return res(null);
|
|
7807
|
+
}
|
|
7808
|
+
const channel = new MessageChannel();
|
|
7809
|
+
channel.port1.onmessage = ({ data: responseData }) => {
|
|
7810
|
+
channel.port1.close();
|
|
7811
|
+
if (responseData.error) {
|
|
7812
|
+
rej(responseData.error);
|
|
7813
|
+
}
|
|
7814
|
+
else {
|
|
7815
|
+
res(responseData);
|
|
7816
|
+
}
|
|
7817
|
+
};
|
|
7818
|
+
// Close the messageChannel and resolve the promise if timeout.
|
|
7819
|
+
setTimeout(() => {
|
|
7820
|
+
channel.port1.close();
|
|
7821
|
+
res(new Error(ERROR_MESSAGE.TRIGGER_TIMED_OUT));
|
|
7822
|
+
}, TRIGGER_TIMEOUT);
|
|
7823
|
+
return postIframeMessage(iFrame, { type: messageType, data }, thoughtSpotHost, channel);
|
|
7824
|
+
});
|
|
7762
7825
|
}
|
|
7763
7826
|
|
|
7764
|
-
var name="@thoughtspot/visual-embed-sdk";var version="1.13.0-alpha.
|
|
7827
|
+
var name="@thoughtspot/visual-embed-sdk";var version="1.13.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",eventemitter3:"^4.0.7","html-react-parser":"^1.4.12","mixpanel-browser":"^2.45.0","use-deep-compare-effect":"^1.8.1"};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};
|
|
7765
7828
|
|
|
7766
7829
|
/**
|
|
7767
7830
|
* Copyright (c) 2022
|
|
@@ -7799,6 +7862,7 @@ class TsEmbed {
|
|
|
7799
7862
|
* @default false
|
|
7800
7863
|
*/
|
|
7801
7864
|
this.shouldEncodeUrlQueryParams = false;
|
|
7865
|
+
this.defaultHiddenActions = [Action.ReportError];
|
|
7802
7866
|
this.el = this.getDOMNode(domSelector);
|
|
7803
7867
|
// TODO: handle error
|
|
7804
7868
|
this.embedConfig = getEmbedConfig();
|
|
@@ -7835,7 +7899,7 @@ class TsEmbed {
|
|
|
7835
7899
|
error,
|
|
7836
7900
|
});
|
|
7837
7901
|
// Log error
|
|
7838
|
-
console.
|
|
7902
|
+
console.error(error);
|
|
7839
7903
|
}
|
|
7840
7904
|
/**
|
|
7841
7905
|
* Extracts the type field from the event payload
|
|
@@ -7941,9 +8005,10 @@ class TsEmbed {
|
|
|
7941
8005
|
if (disabledActionReason) {
|
|
7942
8006
|
queryParams[Param.DisableActionReason] = disabledActionReason;
|
|
7943
8007
|
}
|
|
7944
|
-
|
|
7945
|
-
|
|
7946
|
-
|
|
8008
|
+
queryParams[Param.HideActions] = [
|
|
8009
|
+
...this.defaultHiddenActions,
|
|
8010
|
+
...(hiddenActions !== null && hiddenActions !== void 0 ? hiddenActions : []),
|
|
8011
|
+
];
|
|
7947
8012
|
if (Array.isArray(visibleActions)) {
|
|
7948
8013
|
queryParams[Param.VisibleActions] = visibleActions;
|
|
7949
8014
|
}
|
|
@@ -7965,11 +8030,12 @@ class TsEmbed {
|
|
|
7965
8030
|
* @param isAppEmbed A Boolean parameter to specify if you are embedding
|
|
7966
8031
|
* the full application.
|
|
7967
8032
|
*/
|
|
7968
|
-
getV1EmbedBasePath(queryString, showPrimaryNavbar = false, disableProfileAndHelp = false, isAppEmbed = false) {
|
|
8033
|
+
getV1EmbedBasePath(queryString, showPrimaryNavbar = false, disableProfileAndHelp = false, isAppEmbed = false, enableSearchAssist = false) {
|
|
7969
8034
|
const queryStringFrag = queryString ? `&${queryString}` : '';
|
|
7970
8035
|
const primaryNavParam = `&primaryNavHidden=${!showPrimaryNavbar}`;
|
|
7971
8036
|
const disableProfileAndHelpParam = `&profileAndHelpInNavBarHidden=${disableProfileAndHelp}`;
|
|
7972
|
-
|
|
8037
|
+
const enableSearchAssistParam = `&${Param.EnableSearchAssist}=${enableSearchAssist}`;
|
|
8038
|
+
let queryParams = `?embedApp=true${isAppEmbed ? primaryNavParam : ''}${isAppEmbed ? disableProfileAndHelpParam : ''}${enableSearchAssist ? enableSearchAssistParam : ''}${queryStringFrag}`;
|
|
7973
8039
|
if (this.shouldEncodeUrlQueryParams) {
|
|
7974
8040
|
queryParams = `?base64UrlEncodedFlags=${getEncodedQueryParamsString(queryParams.substr(1))}`;
|
|
7975
8041
|
}
|
|
@@ -8188,9 +8254,8 @@ class TsEmbed {
|
|
|
8188
8254
|
* @param data The payload to send with the message
|
|
8189
8255
|
*/
|
|
8190
8256
|
trigger(messageType, data) {
|
|
8191
|
-
processTrigger(this.iFrame, messageType, this.thoughtSpotHost, data);
|
|
8192
8257
|
uploadMixpanelEvent(`${MIXPANEL_EVENT.VISUAL_SDK_TRIGGER}-${messageType}`);
|
|
8193
|
-
return this;
|
|
8258
|
+
return processTrigger(this.iFrame, messageType, this.thoughtSpotHost, data);
|
|
8194
8259
|
}
|
|
8195
8260
|
/**
|
|
8196
8261
|
* Marks the ThoughtSpot object to have been rendered
|
|
@@ -8332,7 +8397,7 @@ class AppEmbed extends V1Embed {
|
|
|
8332
8397
|
const queryString = [filterQuery, queryParams]
|
|
8333
8398
|
.filter(Boolean)
|
|
8334
8399
|
.join('&');
|
|
8335
|
-
let url = `${this.getV1EmbedBasePath(queryString, this.viewConfig.showPrimaryNavbar, this.viewConfig.disableProfileAndHelp, true)}/${pageId}`;
|
|
8400
|
+
let url = `${this.getV1EmbedBasePath(queryString, this.viewConfig.showPrimaryNavbar, this.viewConfig.disableProfileAndHelp, true, this.viewConfig.enableSearchAssist)}/${pageId}`;
|
|
8336
8401
|
const tsPostHashParams = this.getThoughtSpotPostUrlParams();
|
|
8337
8402
|
url = `${url}${tsPostHashParams}`;
|
|
8338
8403
|
return url;
|
|
@@ -8460,7 +8525,7 @@ class LiveboardEmbed extends V1Embed {
|
|
|
8460
8525
|
*/
|
|
8461
8526
|
getEmbedParams() {
|
|
8462
8527
|
const params = this.getBaseQueryParams();
|
|
8463
|
-
const { enableVizTransformations, fullHeight, defaultHeight, visibleVizs, liveboardV2 = false, } = this.viewConfig;
|
|
8528
|
+
const { enableVizTransformations, fullHeight, defaultHeight, visibleVizs, liveboardV2 = false, vizId, } = this.viewConfig;
|
|
8464
8529
|
const preventLiveboardFilterRemoval = this.viewConfig.preventLiveboardFilterRemoval ||
|
|
8465
8530
|
this.viewConfig.preventPinboardFilterRemoval;
|
|
8466
8531
|
if (fullHeight === true) {
|
|
@@ -8479,6 +8544,9 @@ class LiveboardEmbed extends V1Embed {
|
|
|
8479
8544
|
params[Param.visibleVizs] = visibleVizs;
|
|
8480
8545
|
}
|
|
8481
8546
|
params[Param.livedBoardEmbed] = true;
|
|
8547
|
+
if (vizId) {
|
|
8548
|
+
params[Param.vizEmbed] = true;
|
|
8549
|
+
}
|
|
8482
8550
|
params[Param.LiveboardV2Enabled] = liveboardV2;
|
|
8483
8551
|
const queryParams = getQueryParamString(params, true);
|
|
8484
8552
|
return queryParams;
|
|
@@ -8505,6 +8573,18 @@ class LiveboardEmbed extends V1Embed {
|
|
|
8505
8573
|
url = `${url}${tsPostHashParams}`;
|
|
8506
8574
|
return url;
|
|
8507
8575
|
}
|
|
8576
|
+
/**
|
|
8577
|
+
* Triggers an event to the embedded app
|
|
8578
|
+
* @param messageType The event type
|
|
8579
|
+
* @param data The payload to send with the message
|
|
8580
|
+
*/
|
|
8581
|
+
trigger(messageType, data = {}) {
|
|
8582
|
+
const dataWithVizId = data;
|
|
8583
|
+
if (this.viewConfig.vizId) {
|
|
8584
|
+
dataWithVizId.vizId = this.viewConfig.vizId;
|
|
8585
|
+
}
|
|
8586
|
+
return super.trigger(messageType, dataWithVizId);
|
|
8587
|
+
}
|
|
8508
8588
|
/**
|
|
8509
8589
|
* Render an embedded ThoughtSpot Liveboard or visualization
|
|
8510
8590
|
* @param renderOptions An object specifying the Liveboard ID,
|
|
@@ -8625,6 +8705,11 @@ class SearchEmbed extends TsEmbed {
|
|
|
8625
8705
|
const { answerId, dataSources } = this.viewConfig;
|
|
8626
8706
|
const src = this.getIFrameSrc(answerId, dataSources);
|
|
8627
8707
|
this.renderIFrame(src, this.viewConfig.frameParams);
|
|
8708
|
+
getAuthPromise().then(() => {
|
|
8709
|
+
if (checkReleaseVersionInBeta(getReleaseVersion(), getEmbedConfig().suppressSearchEmbedBetaWarning)) {
|
|
8710
|
+
alert(ERROR_MESSAGE.SEARCHEMBED_BETA_WRANING_MESSAGE);
|
|
8711
|
+
}
|
|
8712
|
+
});
|
|
8628
8713
|
return this;
|
|
8629
8714
|
}
|
|
8630
8715
|
}
|