@thoughtspot/visual-embed-sdk 1.10.0-alpha.4 → 1.11.0-auth.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/README.md +1 -1
- package/dist/src/auth.d.ts +5 -5
- package/dist/src/embed/base.d.ts +4 -4
- package/dist/src/embed/pinboard.d.ts +6 -0
- package/dist/src/embed/ts-embed.d.ts +1 -1
- package/dist/src/types.d.ts +6 -0
- package/dist/src/utils/plugin.d.ts +0 -0
- package/dist/src/v1/api.d.ts +19 -0
- package/dist/tsembed.es.js +45 -14
- package/dist/tsembed.js +45 -14
- package/lib/package.json +1 -1
- package/lib/src/auth.d.ts +5 -5
- package/lib/src/auth.js +13 -5
- package/lib/src/auth.js.map +1 -1
- package/lib/src/auth.spec.js +7 -3
- package/lib/src/auth.spec.js.map +1 -1
- package/lib/src/embed/base.d.ts +4 -4
- package/lib/src/embed/base.js.map +1 -1
- package/lib/src/embed/events.spec.js +30 -1
- package/lib/src/embed/events.spec.js.map +1 -1
- package/lib/src/embed/pinboard.d.ts +6 -0
- package/lib/src/embed/pinboard.js +4 -1
- package/lib/src/embed/pinboard.js.map +1 -1
- package/lib/src/embed/ts-embed.d.ts +1 -1
- package/lib/src/embed/ts-embed.js +14 -5
- package/lib/src/embed/ts-embed.js.map +1 -1
- package/lib/src/types.d.ts +6 -0
- package/lib/src/types.js +6 -0
- package/lib/src/types.js.map +1 -1
- package/lib/src/utils/authService.js +11 -3
- package/lib/src/utils/authService.js.map +1 -1
- package/lib/src/utils/authService.spec.js +4 -2
- package/lib/src/utils/authService.spec.js.map +1 -1
- package/lib/src/utils/plugin.d.ts +0 -0
- package/lib/src/utils/plugin.js +1 -0
- package/lib/src/utils/plugin.js.map +1 -0
- package/lib/src/visual-embed-sdk.d.ts +11 -5
- package/package.json +1 -1
- package/src/auth.spec.ts +11 -3
- package/src/auth.ts +24 -10
- package/src/embed/base.ts +4 -4
- package/src/embed/events.spec.ts +32 -0
- package/src/embed/ts-embed.ts +15 -4
- package/src/types.ts +6 -0
- package/src/utils/authService.spec.ts +8 -2
- package/src/utils/authService.ts +15 -3
- package/lib/src/utils/fetchAnswers.d.ts +0 -3
- package/lib/src/utils/fetchAnswers.js +0 -49
- package/lib/src/utils/fetchAnswers.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,10 @@ This project follows Semantic Versioning.
|
|
|
7
7
|
|
|
8
8
|
### New Features
|
|
9
9
|
- Events for all actions on Search Embed
|
|
10
|
+
## 1.10.0 (04-22-2022)
|
|
11
|
+
|
|
12
|
+
- Release to support TS version 8.2.0.cl
|
|
13
|
+
- Please check the full list of changes [here](https://developers.thoughtspot.com/docs/?pageid=whats-new)
|
|
10
14
|
|
|
11
15
|
## 1.9.5 (04-06-2022)
|
|
12
16
|
|
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
<br/>
|
|
6
6
|
|
|
7
|
-
# ThoughtSpot Visual Embed SDK [](https://coveralls.io/github/ts-blink/embed-sdk?branch=main)  [](https://www.jsdelivr.com/package/npm/@thoughtspot/visual-embed-sdk)
|
|
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) 
|
|
8
8
|
|
|
9
9
|
SDK to embed ThoughtSpot into your web apps.
|
|
10
10
|
|
package/dist/src/auth.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export declare function initSession(sessionDetails: any): void;
|
|
|
20
20
|
* Perform token based authentication
|
|
21
21
|
* @param embedConfig The embed configuration
|
|
22
22
|
*/
|
|
23
|
-
export declare const doTokenAuth: (embedConfig: EmbedConfig) => Promise<
|
|
23
|
+
export declare const doTokenAuth: (embedConfig: EmbedConfig) => Promise<boolean>;
|
|
24
24
|
/**
|
|
25
25
|
* Perform basic authentication to the ThoughtSpot cluster using the cluster
|
|
26
26
|
* credentials.
|
|
@@ -29,14 +29,14 @@ export declare const doTokenAuth: (embedConfig: EmbedConfig) => Promise<void>;
|
|
|
29
29
|
* strongly advised not to use this authentication method in production.
|
|
30
30
|
* @param embedConfig The embed configuration
|
|
31
31
|
*/
|
|
32
|
-
export declare const doBasicAuth: (embedConfig: EmbedConfig) => Promise<
|
|
33
|
-
export declare const doSamlAuth: (embedConfig: EmbedConfig) => Promise<
|
|
34
|
-
export declare const doOIDCAuth: (embedConfig: EmbedConfig) => Promise<
|
|
32
|
+
export declare const doBasicAuth: (embedConfig: EmbedConfig) => Promise<boolean>;
|
|
33
|
+
export declare const doSamlAuth: (embedConfig: EmbedConfig) => Promise<boolean>;
|
|
34
|
+
export declare const doOIDCAuth: (embedConfig: EmbedConfig) => Promise<boolean>;
|
|
35
35
|
/**
|
|
36
36
|
* Perform authentication on the ThoughtSpot cluster
|
|
37
37
|
* @param embedConfig The embed configuration
|
|
38
38
|
*/
|
|
39
|
-
export declare const authenticate: (embedConfig: EmbedConfig) => Promise<
|
|
39
|
+
export declare const authenticate: (embedConfig: EmbedConfig) => Promise<boolean>;
|
|
40
40
|
/**
|
|
41
41
|
* Check if we are authenticated to the ThoughtSpot cluster
|
|
42
42
|
*/
|
package/dist/src/embed/base.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { EmbedConfig } from '../types';
|
|
2
|
-
export declare let authPromise: Promise<
|
|
2
|
+
export declare let authPromise: Promise<boolean>;
|
|
3
3
|
/**
|
|
4
4
|
* Perform authentication on the ThoughtSpot app as applicable.
|
|
5
5
|
*/
|
|
6
|
-
export declare const handleAuth: () => Promise<
|
|
6
|
+
export declare const handleAuth: () => Promise<boolean>;
|
|
7
7
|
export declare const getEmbedConfig: () => EmbedConfig;
|
|
8
|
-
export declare const getAuthPromise: () => Promise<
|
|
8
|
+
export declare const getAuthPromise: () => Promise<boolean>;
|
|
9
9
|
/**
|
|
10
10
|
* Prefetches static resources from the specified URL. Web browsers can then cache the prefetched resources and serve them from the user's local disk to provide faster access to your app.
|
|
11
11
|
* @param url The URL provided for prefetch
|
|
@@ -19,7 +19,7 @@ export declare const prefetch: (url?: string) => void;
|
|
|
19
19
|
*
|
|
20
20
|
* @returns authPromise Promise which resolves when authentication is complete.
|
|
21
21
|
*/
|
|
22
|
-
export declare const init: (embedConfig: EmbedConfig) => Promise<
|
|
22
|
+
export declare const init: (embedConfig: EmbedConfig) => Promise<boolean>;
|
|
23
23
|
/**
|
|
24
24
|
* Renders functions in a queue, resolves to next function only after the callback next is called
|
|
25
25
|
* @param fn The function being registered
|
|
@@ -45,6 +45,12 @@ export interface PinboardViewConfig extends ViewConfig {
|
|
|
45
45
|
* pinboard page will be read-only (no X buttons)
|
|
46
46
|
*/
|
|
47
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[];
|
|
48
54
|
}
|
|
49
55
|
/**
|
|
50
56
|
* Embed a ThoughtSpot pinboard or visualization
|
|
@@ -293,5 +293,5 @@ export declare class V1Embed extends TsEmbed {
|
|
|
293
293
|
* @param iframeSrc
|
|
294
294
|
*/
|
|
295
295
|
protected renderV1Embed(iframeSrc: string): void;
|
|
296
|
-
on(messageType: EmbedEvent, callback: MessageCallback): typeof TsEmbed.prototype;
|
|
296
|
+
on(messageType: EmbedEvent, callback: MessageCallback, options?: MessageOptions): typeof TsEmbed.prototype;
|
|
297
297
|
}
|
package/dist/src/types.d.ts
CHANGED
|
@@ -383,6 +383,12 @@ export declare enum EmbedEvent {
|
|
|
383
383
|
* @version 1.9.1 or later
|
|
384
384
|
*/
|
|
385
385
|
LiveboardRendered = "PinboardRendered",
|
|
386
|
+
/**
|
|
387
|
+
* This can be used to register an event listener which
|
|
388
|
+
* is triggered on all events.
|
|
389
|
+
* @version SDK: 1.10.0 | ThoughtSpot: any
|
|
390
|
+
*/
|
|
391
|
+
ALL = "*",
|
|
386
392
|
/**
|
|
387
393
|
* Emitted when answer is saved in the app
|
|
388
394
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
|
|
File without changes
|
|
@@ -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 };
|
package/dist/tsembed.es.js
CHANGED
|
@@ -357,6 +357,12 @@ var EmbedEvent;
|
|
|
357
357
|
* @version 1.9.1 or later
|
|
358
358
|
*/
|
|
359
359
|
EmbedEvent["LiveboardRendered"] = "PinboardRendered";
|
|
360
|
+
/**
|
|
361
|
+
* This can be used to register an event listener which
|
|
362
|
+
* is triggered on all events.
|
|
363
|
+
* @version SDK: 1.10.0 | ThoughtSpot: any
|
|
364
|
+
*/
|
|
365
|
+
EmbedEvent["ALL"] = "*";
|
|
360
366
|
/**
|
|
361
367
|
* Emitted when answer is saved in the app
|
|
362
368
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
|
|
@@ -8681,8 +8687,16 @@ function initMixpanel(sessionInfo) {
|
|
|
8681
8687
|
}
|
|
8682
8688
|
|
|
8683
8689
|
// eslint-disable-next-line import/no-cycle
|
|
8690
|
+
function errorLoggedFetch(url, options) {
|
|
8691
|
+
return fetch(url, options).then(async (r) => {
|
|
8692
|
+
if (!r.ok) {
|
|
8693
|
+
console.error('Failure', await r.json());
|
|
8694
|
+
}
|
|
8695
|
+
return r;
|
|
8696
|
+
});
|
|
8697
|
+
}
|
|
8684
8698
|
function fetchSessionInfoService(authVerificationUrl) {
|
|
8685
|
-
return
|
|
8699
|
+
return errorLoggedFetch(authVerificationUrl, {
|
|
8686
8700
|
credentials: 'include',
|
|
8687
8701
|
});
|
|
8688
8702
|
}
|
|
@@ -8690,12 +8704,12 @@ async function fetchAuthTokenService(authEndpoint) {
|
|
|
8690
8704
|
return fetch(authEndpoint);
|
|
8691
8705
|
}
|
|
8692
8706
|
async function fetchAuthService(thoughtSpotHost, username, authToken) {
|
|
8693
|
-
return
|
|
8707
|
+
return errorLoggedFetch(`${thoughtSpotHost}${EndPoints.TOKEN_LOGIN}?username=${username}&auth_token=${authToken}`, {
|
|
8694
8708
|
credentials: 'include',
|
|
8695
8709
|
});
|
|
8696
8710
|
}
|
|
8697
8711
|
async function fetchBasicAuthService(thoughtSpotHost, username, password) {
|
|
8698
|
-
return
|
|
8712
|
+
return errorLoggedFetch(`${thoughtSpotHost}${EndPoints.BASIC_LOGIN}`, {
|
|
8699
8713
|
method: 'POST',
|
|
8700
8714
|
headers: {
|
|
8701
8715
|
'content-type': 'application/x-www-form-urlencoded',
|
|
@@ -8776,10 +8790,13 @@ const doTokenAuth = async (embedConfig) => {
|
|
|
8776
8790
|
const response = await fetchAuthTokenService(authEndpoint);
|
|
8777
8791
|
authToken = await response.text();
|
|
8778
8792
|
}
|
|
8779
|
-
await fetchAuthService(thoughtSpotHost, username, authToken);
|
|
8780
|
-
loggedInStatus =
|
|
8793
|
+
const resp = await fetchAuthService(thoughtSpotHost, username, authToken);
|
|
8794
|
+
loggedInStatus = resp.status === 200;
|
|
8795
|
+
}
|
|
8796
|
+
else {
|
|
8797
|
+
loggedInStatus = true;
|
|
8781
8798
|
}
|
|
8782
|
-
loggedInStatus
|
|
8799
|
+
return loggedInStatus;
|
|
8783
8800
|
};
|
|
8784
8801
|
/**
|
|
8785
8802
|
* Perform basic authentication to the ThoughtSpot cluster using the cluster
|
|
@@ -8796,7 +8813,10 @@ const doBasicAuth = async (embedConfig) => {
|
|
|
8796
8813
|
const response = await fetchBasicAuthService(thoughtSpotHost, username, password);
|
|
8797
8814
|
loggedInStatus = response.status === 200;
|
|
8798
8815
|
}
|
|
8799
|
-
|
|
8816
|
+
else {
|
|
8817
|
+
loggedInStatus = true;
|
|
8818
|
+
}
|
|
8819
|
+
return loggedInStatus;
|
|
8800
8820
|
};
|
|
8801
8821
|
async function samlPopupFlow(ssoURL) {
|
|
8802
8822
|
document.body.insertAdjacentHTML('beforeend', '<div id="ts-saml-auth"></div>');
|
|
@@ -8860,6 +8880,7 @@ const doSamlAuth = async (embedConfig) => {
|
|
|
8860
8880
|
// bring back the page to the same URL
|
|
8861
8881
|
const ssoEndPoint = `${EndPoints.SAML_LOGIN_TEMPLATE(encodeURIComponent(ssoRedirectUrl))}`;
|
|
8862
8882
|
await doSSOAuth(embedConfig, ssoEndPoint);
|
|
8883
|
+
return loggedInStatus;
|
|
8863
8884
|
};
|
|
8864
8885
|
const doOIDCAuth = async (embedConfig) => {
|
|
8865
8886
|
const { thoughtSpotHost } = embedConfig;
|
|
@@ -8871,6 +8892,7 @@ const doOIDCAuth = async (embedConfig) => {
|
|
|
8871
8892
|
// bring back the page to the same URL
|
|
8872
8893
|
const ssoEndPoint = `${EndPoints.OIDC_LOGIN_TEMPLATE(encodeURIComponent(ssoRedirectUrl))}`;
|
|
8873
8894
|
await doSSOAuth(embedConfig, ssoEndPoint);
|
|
8895
|
+
return loggedInStatus;
|
|
8874
8896
|
};
|
|
8875
8897
|
/**
|
|
8876
8898
|
* Perform authentication on the ThoughtSpot cluster
|
|
@@ -8888,7 +8910,7 @@ const authenticate = async (embedConfig) => {
|
|
|
8888
8910
|
case AuthType.Basic:
|
|
8889
8911
|
return doBasicAuth(embedConfig);
|
|
8890
8912
|
default:
|
|
8891
|
-
return Promise.resolve();
|
|
8913
|
+
return Promise.resolve(true);
|
|
8892
8914
|
}
|
|
8893
8915
|
};
|
|
8894
8916
|
|
|
@@ -9082,7 +9104,7 @@ function processTrigger(iFrame, messageType, thoughtSpotHost, data) {
|
|
|
9082
9104
|
}
|
|
9083
9105
|
}
|
|
9084
9106
|
|
|
9085
|
-
var name="@thoughtspot/visual-embed-sdk";var version="1.
|
|
9107
|
+
var name="@thoughtspot/visual-embed-sdk";var version="1.11.0-auth.0";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};
|
|
9086
9108
|
|
|
9087
9109
|
/**
|
|
9088
9110
|
* Copyright (c) 2022
|
|
@@ -9189,9 +9211,10 @@ class TsEmbed {
|
|
|
9189
9211
|
* will be removed for ts7.oct.cl
|
|
9190
9212
|
* @hidden
|
|
9191
9213
|
*/
|
|
9192
|
-
formatEventData(event) {
|
|
9214
|
+
formatEventData(event, eventType) {
|
|
9193
9215
|
const eventData = {
|
|
9194
9216
|
...event.data,
|
|
9217
|
+
type: eventType,
|
|
9195
9218
|
};
|
|
9196
9219
|
if (!eventData.data) {
|
|
9197
9220
|
eventData.data = event.data.payload;
|
|
@@ -9208,7 +9231,7 @@ class TsEmbed {
|
|
|
9208
9231
|
window.addEventListener('message', (event) => {
|
|
9209
9232
|
const eventType = this.getEventType(event);
|
|
9210
9233
|
const eventPort = this.getEventPort(event);
|
|
9211
|
-
const eventData = this.formatEventData(event);
|
|
9234
|
+
const eventData = this.formatEventData(event, eventType);
|
|
9212
9235
|
if (event.source === this.iFrame.contentWindow) {
|
|
9213
9236
|
this.executeCallbacks(eventType, getProcessData(eventType, eventData, this.thoughtSpotHost), eventPort);
|
|
9214
9237
|
}
|
|
@@ -9326,9 +9349,14 @@ class TsEmbed {
|
|
|
9326
9349
|
data: {
|
|
9327
9350
|
timestamp: initTimestamp,
|
|
9328
9351
|
},
|
|
9352
|
+
type: EmbedEvent.Init,
|
|
9329
9353
|
});
|
|
9330
9354
|
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_RENDER_START);
|
|
9331
|
-
(_a = getAuthPromise()) === null || _a === void 0 ? void 0 : _a.then(() => {
|
|
9355
|
+
(_a = getAuthPromise()) === null || _a === void 0 ? void 0 : _a.then((isLoggedIn) => {
|
|
9356
|
+
if (!isLoggedIn) {
|
|
9357
|
+
this.el.innerHTML = 'Login failed';
|
|
9358
|
+
return;
|
|
9359
|
+
}
|
|
9332
9360
|
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_RENDER_COMPLETE);
|
|
9333
9361
|
this.iFrame =
|
|
9334
9362
|
this.iFrame || document.createElement('iframe');
|
|
@@ -9357,6 +9385,7 @@ class TsEmbed {
|
|
|
9357
9385
|
data: {
|
|
9358
9386
|
timestamp: loadTimestamp,
|
|
9359
9387
|
},
|
|
9388
|
+
type: EmbedEvent.Load,
|
|
9360
9389
|
});
|
|
9361
9390
|
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_IFRAME_LOAD_PERFORMANCE, {
|
|
9362
9391
|
timeTookToLoad: loadTimestamp - initTimestamp,
|
|
@@ -9396,6 +9425,8 @@ class TsEmbed {
|
|
|
9396
9425
|
*/
|
|
9397
9426
|
executeCallbacks(eventType, data, eventPort) {
|
|
9398
9427
|
const callbacks = this.eventHandlerMap.get(eventType) || [];
|
|
9428
|
+
const allHandlers = this.eventHandlerMap.get(EmbedEvent.ALL) || [];
|
|
9429
|
+
callbacks.push(...allHandlers);
|
|
9399
9430
|
const dataStatus = (data === null || data === void 0 ? void 0 : data.status) || embedEventStatus.END;
|
|
9400
9431
|
callbacks.forEach((callbackObj) => {
|
|
9401
9432
|
if ((callbackObj.options.start &&
|
|
@@ -9562,9 +9593,9 @@ class V1Embed extends TsEmbed {
|
|
|
9562
9593
|
this.renderIFrame(iframeSrc, this.viewConfig.frameParams);
|
|
9563
9594
|
}
|
|
9564
9595
|
// @override
|
|
9565
|
-
on(messageType, callback) {
|
|
9596
|
+
on(messageType, callback, options = { start: false }) {
|
|
9566
9597
|
const eventType = this.getCompatibleEventType(messageType);
|
|
9567
|
-
return super.on(eventType, callback);
|
|
9598
|
+
return super.on(eventType, callback, options);
|
|
9568
9599
|
}
|
|
9569
9600
|
}
|
|
9570
9601
|
|
package/dist/tsembed.js
CHANGED
|
@@ -347,6 +347,12 @@
|
|
|
347
347
|
* @version 1.9.1 or later
|
|
348
348
|
*/
|
|
349
349
|
EmbedEvent["LiveboardRendered"] = "PinboardRendered";
|
|
350
|
+
/**
|
|
351
|
+
* This can be used to register an event listener which
|
|
352
|
+
* is triggered on all events.
|
|
353
|
+
* @version SDK: 1.10.0 | ThoughtSpot: any
|
|
354
|
+
*/
|
|
355
|
+
EmbedEvent["ALL"] = "*";
|
|
350
356
|
/**
|
|
351
357
|
* Emitted when answer is saved in the app
|
|
352
358
|
* @version SDK: 1.11.0 | ThoughtSpot: 8.3.0.cl
|
|
@@ -8650,8 +8656,16 @@
|
|
|
8650
8656
|
}
|
|
8651
8657
|
|
|
8652
8658
|
// eslint-disable-next-line import/no-cycle
|
|
8659
|
+
function errorLoggedFetch(url, options) {
|
|
8660
|
+
return fetch(url, options).then(async (r) => {
|
|
8661
|
+
if (!r.ok) {
|
|
8662
|
+
console.error('Failure', await r.json());
|
|
8663
|
+
}
|
|
8664
|
+
return r;
|
|
8665
|
+
});
|
|
8666
|
+
}
|
|
8653
8667
|
function fetchSessionInfoService(authVerificationUrl) {
|
|
8654
|
-
return
|
|
8668
|
+
return errorLoggedFetch(authVerificationUrl, {
|
|
8655
8669
|
credentials: 'include',
|
|
8656
8670
|
});
|
|
8657
8671
|
}
|
|
@@ -8659,12 +8673,12 @@
|
|
|
8659
8673
|
return fetch(authEndpoint);
|
|
8660
8674
|
}
|
|
8661
8675
|
async function fetchAuthService(thoughtSpotHost, username, authToken) {
|
|
8662
|
-
return
|
|
8676
|
+
return errorLoggedFetch(`${thoughtSpotHost}${EndPoints.TOKEN_LOGIN}?username=${username}&auth_token=${authToken}`, {
|
|
8663
8677
|
credentials: 'include',
|
|
8664
8678
|
});
|
|
8665
8679
|
}
|
|
8666
8680
|
async function fetchBasicAuthService(thoughtSpotHost, username, password) {
|
|
8667
|
-
return
|
|
8681
|
+
return errorLoggedFetch(`${thoughtSpotHost}${EndPoints.BASIC_LOGIN}`, {
|
|
8668
8682
|
method: 'POST',
|
|
8669
8683
|
headers: {
|
|
8670
8684
|
'content-type': 'application/x-www-form-urlencoded',
|
|
@@ -8745,10 +8759,13 @@
|
|
|
8745
8759
|
const response = await fetchAuthTokenService(authEndpoint);
|
|
8746
8760
|
authToken = await response.text();
|
|
8747
8761
|
}
|
|
8748
|
-
await fetchAuthService(thoughtSpotHost, username, authToken);
|
|
8749
|
-
loggedInStatus =
|
|
8762
|
+
const resp = await fetchAuthService(thoughtSpotHost, username, authToken);
|
|
8763
|
+
loggedInStatus = resp.status === 200;
|
|
8764
|
+
}
|
|
8765
|
+
else {
|
|
8766
|
+
loggedInStatus = true;
|
|
8750
8767
|
}
|
|
8751
|
-
loggedInStatus
|
|
8768
|
+
return loggedInStatus;
|
|
8752
8769
|
};
|
|
8753
8770
|
/**
|
|
8754
8771
|
* Perform basic authentication to the ThoughtSpot cluster using the cluster
|
|
@@ -8765,7 +8782,10 @@
|
|
|
8765
8782
|
const response = await fetchBasicAuthService(thoughtSpotHost, username, password);
|
|
8766
8783
|
loggedInStatus = response.status === 200;
|
|
8767
8784
|
}
|
|
8768
|
-
|
|
8785
|
+
else {
|
|
8786
|
+
loggedInStatus = true;
|
|
8787
|
+
}
|
|
8788
|
+
return loggedInStatus;
|
|
8769
8789
|
};
|
|
8770
8790
|
async function samlPopupFlow(ssoURL) {
|
|
8771
8791
|
document.body.insertAdjacentHTML('beforeend', '<div id="ts-saml-auth"></div>');
|
|
@@ -8829,6 +8849,7 @@
|
|
|
8829
8849
|
// bring back the page to the same URL
|
|
8830
8850
|
const ssoEndPoint = `${EndPoints.SAML_LOGIN_TEMPLATE(encodeURIComponent(ssoRedirectUrl))}`;
|
|
8831
8851
|
await doSSOAuth(embedConfig, ssoEndPoint);
|
|
8852
|
+
return loggedInStatus;
|
|
8832
8853
|
};
|
|
8833
8854
|
const doOIDCAuth = async (embedConfig) => {
|
|
8834
8855
|
const { thoughtSpotHost } = embedConfig;
|
|
@@ -8840,6 +8861,7 @@
|
|
|
8840
8861
|
// bring back the page to the same URL
|
|
8841
8862
|
const ssoEndPoint = `${EndPoints.OIDC_LOGIN_TEMPLATE(encodeURIComponent(ssoRedirectUrl))}`;
|
|
8842
8863
|
await doSSOAuth(embedConfig, ssoEndPoint);
|
|
8864
|
+
return loggedInStatus;
|
|
8843
8865
|
};
|
|
8844
8866
|
/**
|
|
8845
8867
|
* Perform authentication on the ThoughtSpot cluster
|
|
@@ -8857,7 +8879,7 @@
|
|
|
8857
8879
|
case exports.AuthType.Basic:
|
|
8858
8880
|
return doBasicAuth(embedConfig);
|
|
8859
8881
|
default:
|
|
8860
|
-
return Promise.resolve();
|
|
8882
|
+
return Promise.resolve(true);
|
|
8861
8883
|
}
|
|
8862
8884
|
};
|
|
8863
8885
|
|
|
@@ -9051,7 +9073,7 @@
|
|
|
9051
9073
|
}
|
|
9052
9074
|
}
|
|
9053
9075
|
|
|
9054
|
-
var name="@thoughtspot/visual-embed-sdk";var version="1.
|
|
9076
|
+
var name="@thoughtspot/visual-embed-sdk";var version="1.11.0-auth.0";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$1={".":"./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$1,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};
|
|
9055
9077
|
|
|
9056
9078
|
/**
|
|
9057
9079
|
* Copyright (c) 2022
|
|
@@ -9158,9 +9180,10 @@
|
|
|
9158
9180
|
* will be removed for ts7.oct.cl
|
|
9159
9181
|
* @hidden
|
|
9160
9182
|
*/
|
|
9161
|
-
formatEventData(event) {
|
|
9183
|
+
formatEventData(event, eventType) {
|
|
9162
9184
|
const eventData = {
|
|
9163
9185
|
...event.data,
|
|
9186
|
+
type: eventType,
|
|
9164
9187
|
};
|
|
9165
9188
|
if (!eventData.data) {
|
|
9166
9189
|
eventData.data = event.data.payload;
|
|
@@ -9177,7 +9200,7 @@
|
|
|
9177
9200
|
window.addEventListener('message', (event) => {
|
|
9178
9201
|
const eventType = this.getEventType(event);
|
|
9179
9202
|
const eventPort = this.getEventPort(event);
|
|
9180
|
-
const eventData = this.formatEventData(event);
|
|
9203
|
+
const eventData = this.formatEventData(event, eventType);
|
|
9181
9204
|
if (event.source === this.iFrame.contentWindow) {
|
|
9182
9205
|
this.executeCallbacks(eventType, getProcessData(eventType, eventData, this.thoughtSpotHost), eventPort);
|
|
9183
9206
|
}
|
|
@@ -9295,9 +9318,14 @@
|
|
|
9295
9318
|
data: {
|
|
9296
9319
|
timestamp: initTimestamp,
|
|
9297
9320
|
},
|
|
9321
|
+
type: exports.EmbedEvent.Init,
|
|
9298
9322
|
});
|
|
9299
9323
|
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_RENDER_START);
|
|
9300
|
-
(_a = getAuthPromise()) === null || _a === void 0 ? void 0 : _a.then(() => {
|
|
9324
|
+
(_a = getAuthPromise()) === null || _a === void 0 ? void 0 : _a.then((isLoggedIn) => {
|
|
9325
|
+
if (!isLoggedIn) {
|
|
9326
|
+
this.el.innerHTML = 'Login failed';
|
|
9327
|
+
return;
|
|
9328
|
+
}
|
|
9301
9329
|
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_RENDER_COMPLETE);
|
|
9302
9330
|
this.iFrame =
|
|
9303
9331
|
this.iFrame || document.createElement('iframe');
|
|
@@ -9326,6 +9354,7 @@
|
|
|
9326
9354
|
data: {
|
|
9327
9355
|
timestamp: loadTimestamp,
|
|
9328
9356
|
},
|
|
9357
|
+
type: exports.EmbedEvent.Load,
|
|
9329
9358
|
});
|
|
9330
9359
|
uploadMixpanelEvent(MIXPANEL_EVENT.VISUAL_SDK_IFRAME_LOAD_PERFORMANCE, {
|
|
9331
9360
|
timeTookToLoad: loadTimestamp - initTimestamp,
|
|
@@ -9365,6 +9394,8 @@
|
|
|
9365
9394
|
*/
|
|
9366
9395
|
executeCallbacks(eventType, data, eventPort) {
|
|
9367
9396
|
const callbacks = this.eventHandlerMap.get(eventType) || [];
|
|
9397
|
+
const allHandlers = this.eventHandlerMap.get(exports.EmbedEvent.ALL) || [];
|
|
9398
|
+
callbacks.push(...allHandlers);
|
|
9368
9399
|
const dataStatus = (data === null || data === void 0 ? void 0 : data.status) || embedEventStatus.END;
|
|
9369
9400
|
callbacks.forEach((callbackObj) => {
|
|
9370
9401
|
if ((callbackObj.options.start &&
|
|
@@ -9531,9 +9562,9 @@
|
|
|
9531
9562
|
this.renderIFrame(iframeSrc, this.viewConfig.frameParams);
|
|
9532
9563
|
}
|
|
9533
9564
|
// @override
|
|
9534
|
-
on(messageType, callback) {
|
|
9565
|
+
on(messageType, callback, options = { start: false }) {
|
|
9535
9566
|
const eventType = this.getCompatibleEventType(messageType);
|
|
9536
|
-
return super.on(eventType, callback);
|
|
9567
|
+
return super.on(eventType, callback, options);
|
|
9537
9568
|
}
|
|
9538
9569
|
}
|
|
9539
9570
|
|
package/lib/package.json
CHANGED
package/lib/src/auth.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export declare function initSession(sessionDetails: any): void;
|
|
|
20
20
|
* Perform token based authentication
|
|
21
21
|
* @param embedConfig The embed configuration
|
|
22
22
|
*/
|
|
23
|
-
export declare const doTokenAuth: (embedConfig: EmbedConfig) => Promise<
|
|
23
|
+
export declare const doTokenAuth: (embedConfig: EmbedConfig) => Promise<boolean>;
|
|
24
24
|
/**
|
|
25
25
|
* Perform basic authentication to the ThoughtSpot cluster using the cluster
|
|
26
26
|
* credentials.
|
|
@@ -29,14 +29,14 @@ export declare const doTokenAuth: (embedConfig: EmbedConfig) => Promise<void>;
|
|
|
29
29
|
* strongly advised not to use this authentication method in production.
|
|
30
30
|
* @param embedConfig The embed configuration
|
|
31
31
|
*/
|
|
32
|
-
export declare const doBasicAuth: (embedConfig: EmbedConfig) => Promise<
|
|
33
|
-
export declare const doSamlAuth: (embedConfig: EmbedConfig) => Promise<
|
|
34
|
-
export declare const doOIDCAuth: (embedConfig: EmbedConfig) => Promise<
|
|
32
|
+
export declare const doBasicAuth: (embedConfig: EmbedConfig) => Promise<boolean>;
|
|
33
|
+
export declare const doSamlAuth: (embedConfig: EmbedConfig) => Promise<boolean>;
|
|
34
|
+
export declare const doOIDCAuth: (embedConfig: EmbedConfig) => Promise<boolean>;
|
|
35
35
|
/**
|
|
36
36
|
* Perform authentication on the ThoughtSpot cluster
|
|
37
37
|
* @param embedConfig The embed configuration
|
|
38
38
|
*/
|
|
39
|
-
export declare const authenticate: (embedConfig: EmbedConfig) => Promise<
|
|
39
|
+
export declare const authenticate: (embedConfig: EmbedConfig) => Promise<boolean>;
|
|
40
40
|
/**
|
|
41
41
|
* Check if we are authenticated to the ThoughtSpot cluster
|
|
42
42
|
*/
|
package/lib/src/auth.js
CHANGED
|
@@ -79,10 +79,13 @@ export const doTokenAuth = async (embedConfig) => {
|
|
|
79
79
|
const response = await fetchAuthTokenService(authEndpoint);
|
|
80
80
|
authToken = await response.text();
|
|
81
81
|
}
|
|
82
|
-
await fetchAuthService(thoughtSpotHost, username, authToken);
|
|
83
|
-
loggedInStatus =
|
|
82
|
+
const resp = await fetchAuthService(thoughtSpotHost, username, authToken);
|
|
83
|
+
loggedInStatus = resp.status === 200;
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
loggedInStatus = true;
|
|
84
87
|
}
|
|
85
|
-
loggedInStatus
|
|
88
|
+
return loggedInStatus;
|
|
86
89
|
};
|
|
87
90
|
/**
|
|
88
91
|
* Perform basic authentication to the ThoughtSpot cluster using the cluster
|
|
@@ -99,7 +102,10 @@ export const doBasicAuth = async (embedConfig) => {
|
|
|
99
102
|
const response = await fetchBasicAuthService(thoughtSpotHost, username, password);
|
|
100
103
|
loggedInStatus = response.status === 200;
|
|
101
104
|
}
|
|
102
|
-
|
|
105
|
+
else {
|
|
106
|
+
loggedInStatus = true;
|
|
107
|
+
}
|
|
108
|
+
return loggedInStatus;
|
|
103
109
|
};
|
|
104
110
|
async function samlPopupFlow(ssoURL) {
|
|
105
111
|
document.body.insertAdjacentHTML('beforeend', '<div id="ts-saml-auth"></div>');
|
|
@@ -163,6 +169,7 @@ export const doSamlAuth = async (embedConfig) => {
|
|
|
163
169
|
// bring back the page to the same URL
|
|
164
170
|
const ssoEndPoint = `${EndPoints.SAML_LOGIN_TEMPLATE(encodeURIComponent(ssoRedirectUrl))}`;
|
|
165
171
|
await doSSOAuth(embedConfig, ssoEndPoint);
|
|
172
|
+
return loggedInStatus;
|
|
166
173
|
};
|
|
167
174
|
export const doOIDCAuth = async (embedConfig) => {
|
|
168
175
|
const { thoughtSpotHost } = embedConfig;
|
|
@@ -174,6 +181,7 @@ export const doOIDCAuth = async (embedConfig) => {
|
|
|
174
181
|
// bring back the page to the same URL
|
|
175
182
|
const ssoEndPoint = `${EndPoints.OIDC_LOGIN_TEMPLATE(encodeURIComponent(ssoRedirectUrl))}`;
|
|
176
183
|
await doSSOAuth(embedConfig, ssoEndPoint);
|
|
184
|
+
return loggedInStatus;
|
|
177
185
|
};
|
|
178
186
|
/**
|
|
179
187
|
* Perform authentication on the ThoughtSpot cluster
|
|
@@ -191,7 +199,7 @@ export const authenticate = async (embedConfig) => {
|
|
|
191
199
|
case AuthType.Basic:
|
|
192
200
|
return doBasicAuth(embedConfig);
|
|
193
201
|
default:
|
|
194
|
-
return Promise.resolve();
|
|
202
|
+
return Promise.resolve(true);
|
|
195
203
|
}
|
|
196
204
|
};
|
|
197
205
|
/**
|