@thoughtspot/visual-embed-sdk 1.6.0-alpha.3 → 1.6.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/dist/src/auth.d.ts +3 -5
- package/dist/src/embed/search.d.ts +4 -0
- package/dist/src/types.d.ts +13 -8
- package/dist/tsembed.es.js +42 -18
- package/dist/tsembed.js +42 -18
- package/lib/package.json +5 -1
- package/lib/src/auth.d.ts +3 -5
- package/lib/src/auth.js +27 -9
- package/lib/src/auth.js.map +1 -1
- package/lib/src/auth.spec.js +2 -2
- package/lib/src/auth.spec.js.map +1 -1
- package/lib/src/embed/search.d.ts +4 -0
- package/lib/src/embed/search.js +1 -1
- package/lib/src/embed/search.js.map +1 -1
- package/lib/src/embed/ts-embed.js +2 -1
- package/lib/src/embed/ts-embed.js.map +1 -1
- package/lib/src/types.d.ts +13 -8
- package/lib/src/types.js +11 -6
- package/lib/src/types.js.map +1 -1
- package/lib/src/visual-embed-sdk.d.ts +17 -8
- package/package.json +5 -1
- package/src/auth.spec.ts +2 -2
- package/src/auth.ts +37 -9
- package/src/embed/search.ts +5 -0
- package/src/embed/ts-embed.ts +3 -1
- package/src/types.ts +13 -8
- package/dist/src/embed/pinboard.d.ts +0 -85
- package/lib/src/embed/pinboard.d.ts +0 -85
- package/lib/src/embed/pinboard.js +0 -107
- package/lib/src/embed/pinboard.js.map +0 -1
- 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/dist/src/auth.d.ts
CHANGED
|
@@ -6,7 +6,8 @@ export declare let sessionInfo: any;
|
|
|
6
6
|
export declare const SSO_REDIRECTION_MARKER_GUID = "5e16222e-ef02-43e9-9fbd-24226bf3ce5b";
|
|
7
7
|
export declare const EndPoints: {
|
|
8
8
|
AUTH_VERIFICATION: string;
|
|
9
|
-
|
|
9
|
+
SAML_LOGIN_TEMPLATE: (targetUrl: string) => string;
|
|
10
|
+
OIDC_LOGIN_TEMPLATE: (targetUrl: string) => string;
|
|
10
11
|
TOKEN_LOGIN: string;
|
|
11
12
|
BASIC_LOGIN: string;
|
|
12
13
|
};
|
|
@@ -29,11 +30,8 @@ export declare const doTokenAuth: (embedConfig: EmbedConfig) => Promise<void>;
|
|
|
29
30
|
* @param embedConfig The embed configuration
|
|
30
31
|
*/
|
|
31
32
|
export declare const doBasicAuth: (embedConfig: EmbedConfig) => Promise<void>;
|
|
32
|
-
/**
|
|
33
|
-
* Perform SAML authentication
|
|
34
|
-
* @param embedConfig The embed configuration
|
|
35
|
-
*/
|
|
36
33
|
export declare const doSamlAuth: (embedConfig: EmbedConfig) => Promise<void>;
|
|
34
|
+
export declare const doOIDCAuth: (embedConfig: EmbedConfig) => Promise<void>;
|
|
37
35
|
/**
|
|
38
36
|
* Perform authentication on the ThoughtSpot cluster
|
|
39
37
|
* @param embedConfig The embed configuration
|
|
@@ -44,6 +44,10 @@ 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;
|
|
47
51
|
/**
|
|
48
52
|
* If set to true, the Search Assist feature is enabled.
|
|
49
53
|
*/
|
package/dist/src/types.d.ts
CHANGED
|
@@ -19,6 +19,10 @@ export declare enum AuthType {
|
|
|
19
19
|
* SSO using SAML
|
|
20
20
|
*/
|
|
21
21
|
SSO = "SSO_SAML",
|
|
22
|
+
/**
|
|
23
|
+
* SSO using OIDC
|
|
24
|
+
*/
|
|
25
|
+
OIDC = "SSO_OIDC",
|
|
22
26
|
/**
|
|
23
27
|
* Trusted authentication server
|
|
24
28
|
*/
|
|
@@ -112,13 +116,13 @@ export interface EmbedConfig {
|
|
|
112
116
|
* When there are multiple embeds, queue the render of embed to start
|
|
113
117
|
* after the previous embed's render is complete. This helps in the load performance
|
|
114
118
|
* by decreasing the load on the browser.
|
|
115
|
-
*
|
|
119
|
+
* @version 1.5.0 or later
|
|
116
120
|
* @default false
|
|
117
121
|
*/
|
|
118
122
|
queueMultiRenders?: boolean;
|
|
119
123
|
/**
|
|
120
124
|
* Dynamic CSS Url to be injected in the loaded application.
|
|
121
|
-
*
|
|
125
|
+
* @version 1.6.0 or later
|
|
122
126
|
* @default ''
|
|
123
127
|
*/
|
|
124
128
|
customCssUrl?: string;
|
|
@@ -266,7 +270,7 @@ export declare enum EmbedEvent {
|
|
|
266
270
|
/**
|
|
267
271
|
* A double click has been triggered on table/chart
|
|
268
272
|
* @return ContextMenuInputPoints - data point that is double clicked
|
|
269
|
-
*
|
|
273
|
+
* @version 1.5.0 or later
|
|
270
274
|
*/
|
|
271
275
|
VizPointDoubleClick = "vizPointDoubleClick",
|
|
272
276
|
/**
|
|
@@ -308,7 +312,7 @@ export declare enum EmbedEvent {
|
|
|
308
312
|
* Emitted when the embed does not have cookie access. This
|
|
309
313
|
* happens on Safari where third-party cookies are blocked by default.
|
|
310
314
|
*
|
|
311
|
-
* @version 1.1.0
|
|
315
|
+
* @version 1.1.0 or later
|
|
312
316
|
*/
|
|
313
317
|
NoCookieAccess = "noCookieAccess",
|
|
314
318
|
/**
|
|
@@ -319,12 +323,12 @@ export declare enum EmbedEvent {
|
|
|
319
323
|
SAMLComplete = "samlComplete",
|
|
320
324
|
/**
|
|
321
325
|
* Emitted when any modal is opened in the app
|
|
322
|
-
*
|
|
326
|
+
* @version 1.6.0 or later
|
|
323
327
|
*/
|
|
324
328
|
DialogOpen = "dialog-open",
|
|
325
329
|
/**
|
|
326
330
|
* Emitted when any modal is closed in the app
|
|
327
|
-
*
|
|
331
|
+
* @version 1.6.0 or later
|
|
328
332
|
*/
|
|
329
333
|
DialogClose = "dialog-close"
|
|
330
334
|
}
|
|
@@ -345,7 +349,7 @@ export declare enum HostEvent {
|
|
|
345
349
|
* eg. { selectedPoints: []}
|
|
346
350
|
* @param columnGuid - a string guid of the column to drill by. This is optional,
|
|
347
351
|
* if not provided it will auto drill by the configured column. \
|
|
348
|
-
*
|
|
352
|
+
* @version 1.5.0 or later
|
|
349
353
|
*/
|
|
350
354
|
DrillDown = "triggerDrillDown",
|
|
351
355
|
/**
|
|
@@ -362,7 +366,7 @@ export declare enum HostEvent {
|
|
|
362
366
|
* Set the visible visualizations on a Liveboard.
|
|
363
367
|
* @param - an array of ids of visualizations to show, the ids not passed
|
|
364
368
|
* will be hidden.
|
|
365
|
-
*
|
|
369
|
+
* @version 1.6.0 or later
|
|
366
370
|
*/
|
|
367
371
|
SetVisibleVizs = "SetPinboardVisibleVizs"
|
|
368
372
|
}
|
|
@@ -391,6 +395,7 @@ export declare enum DataSourceVisualMode {
|
|
|
391
395
|
export declare enum Param {
|
|
392
396
|
DataSources = "dataSources",
|
|
393
397
|
DataSourceMode = "dataSourceMode",
|
|
398
|
+
ExpandAllDataSource = "expandAllDataSource",
|
|
394
399
|
DisableActions = "disableAction",
|
|
395
400
|
DisableActionReason = "disableHint",
|
|
396
401
|
ForceTable = "forceTable",
|
package/dist/tsembed.es.js
CHANGED
|
@@ -133,6 +133,10 @@ var AuthType;
|
|
|
133
133
|
* SSO using SAML
|
|
134
134
|
*/
|
|
135
135
|
AuthType["SSO"] = "SSO_SAML";
|
|
136
|
+
/**
|
|
137
|
+
* SSO using OIDC
|
|
138
|
+
*/
|
|
139
|
+
AuthType["OIDC"] = "SSO_OIDC";
|
|
136
140
|
/**
|
|
137
141
|
* Trusted authentication server
|
|
138
142
|
*/
|
|
@@ -264,7 +268,7 @@ var EmbedEvent;
|
|
|
264
268
|
/**
|
|
265
269
|
* A double click has been triggered on table/chart
|
|
266
270
|
* @return ContextMenuInputPoints - data point that is double clicked
|
|
267
|
-
*
|
|
271
|
+
* @version 1.5.0 or later
|
|
268
272
|
*/
|
|
269
273
|
EmbedEvent["VizPointDoubleClick"] = "vizPointDoubleClick";
|
|
270
274
|
/**
|
|
@@ -306,7 +310,7 @@ var EmbedEvent;
|
|
|
306
310
|
* Emitted when the embed does not have cookie access. This
|
|
307
311
|
* happens on Safari where third-party cookies are blocked by default.
|
|
308
312
|
*
|
|
309
|
-
* @version 1.1.0
|
|
313
|
+
* @version 1.1.0 or later
|
|
310
314
|
*/
|
|
311
315
|
EmbedEvent["NoCookieAccess"] = "noCookieAccess";
|
|
312
316
|
/**
|
|
@@ -317,12 +321,12 @@ var EmbedEvent;
|
|
|
317
321
|
EmbedEvent["SAMLComplete"] = "samlComplete";
|
|
318
322
|
/**
|
|
319
323
|
* Emitted when any modal is opened in the app
|
|
320
|
-
*
|
|
324
|
+
* @version 1.6.0 or later
|
|
321
325
|
*/
|
|
322
326
|
EmbedEvent["DialogOpen"] = "dialog-open";
|
|
323
327
|
/**
|
|
324
328
|
* Emitted when any modal is closed in the app
|
|
325
|
-
*
|
|
329
|
+
* @version 1.6.0 or later
|
|
326
330
|
*/
|
|
327
331
|
EmbedEvent["DialogClose"] = "dialog-close";
|
|
328
332
|
})(EmbedEvent || (EmbedEvent = {}));
|
|
@@ -345,7 +349,7 @@ var HostEvent;
|
|
|
345
349
|
* eg. { selectedPoints: []}
|
|
346
350
|
* @param columnGuid - a string guid of the column to drill by. This is optional,
|
|
347
351
|
* if not provided it will auto drill by the configured column. \
|
|
348
|
-
*
|
|
352
|
+
* @version 1.5.0 or later
|
|
349
353
|
*/
|
|
350
354
|
HostEvent["DrillDown"] = "triggerDrillDown";
|
|
351
355
|
/**
|
|
@@ -362,7 +366,7 @@ var HostEvent;
|
|
|
362
366
|
* Set the visible visualizations on a Liveboard.
|
|
363
367
|
* @param - an array of ids of visualizations to show, the ids not passed
|
|
364
368
|
* will be hidden.
|
|
365
|
-
*
|
|
369
|
+
* @version 1.6.0 or later
|
|
366
370
|
*/
|
|
367
371
|
HostEvent["SetVisibleVizs"] = "SetPinboardVisibleVizs";
|
|
368
372
|
})(HostEvent || (HostEvent = {}));
|
|
@@ -395,6 +399,7 @@ var Param;
|
|
|
395
399
|
(function (Param) {
|
|
396
400
|
Param["DataSources"] = "dataSources";
|
|
397
401
|
Param["DataSourceMode"] = "dataSourceMode";
|
|
402
|
+
Param["ExpandAllDataSource"] = "expandAllDataSource";
|
|
398
403
|
Param["DisableActions"] = "disableAction";
|
|
399
404
|
Param["DisableActionReason"] = "disableHint";
|
|
400
405
|
Param["ForceTable"] = "forceTable";
|
|
@@ -8496,7 +8501,8 @@ let sessionInfo = null;
|
|
|
8496
8501
|
const SSO_REDIRECTION_MARKER_GUID = '5e16222e-ef02-43e9-9fbd-24226bf3ce5b';
|
|
8497
8502
|
const EndPoints = {
|
|
8498
8503
|
AUTH_VERIFICATION: '/callosum/v1/session/info',
|
|
8499
|
-
|
|
8504
|
+
SAML_LOGIN_TEMPLATE: (targetUrl) => `/callosum/v1/saml/login?targetURLPath=${targetUrl}`,
|
|
8505
|
+
OIDC_LOGIN_TEMPLATE: (targetUrl) => `/callosum/v1/oidc/login?targetURLPath=${targetUrl}`,
|
|
8500
8506
|
TOKEN_LOGIN: '/callosum/v1/session/login/token',
|
|
8501
8507
|
BASIC_LOGIN: '/callosum/v1/session/login',
|
|
8502
8508
|
};
|
|
@@ -8604,7 +8610,7 @@ async function samlPopupFlow(ssoURL) {
|
|
|
8604
8610
|
* Perform SAML authentication
|
|
8605
8611
|
* @param embedConfig The embed configuration
|
|
8606
8612
|
*/
|
|
8607
|
-
const
|
|
8613
|
+
const doSSOAuth = async (embedConfig, ssoEndPoint) => {
|
|
8608
8614
|
const { thoughtSpotHost } = embedConfig;
|
|
8609
8615
|
const loggedIn = await isLoggedIn(thoughtSpotHost);
|
|
8610
8616
|
if (loggedIn) {
|
|
@@ -8621,13 +8627,6 @@ const doSamlAuth = async (embedConfig) => {
|
|
|
8621
8627
|
loggedInStatus = false;
|
|
8622
8628
|
return;
|
|
8623
8629
|
}
|
|
8624
|
-
// redirect for SSO, when the SSO authentication is done, this page will be loaded
|
|
8625
|
-
// again and the same JS will execute again.
|
|
8626
|
-
const ssoRedirectUrl = embedConfig.noRedirect
|
|
8627
|
-
? `${thoughtSpotHost}/v2/#/embed/saml-complete`
|
|
8628
|
-
: appendToUrlHash(window.location.href, SSO_REDIRECTION_MARKER_GUID);
|
|
8629
|
-
// bring back the page to the same URL
|
|
8630
|
-
const ssoEndPoint = `${EndPoints.SSO_LOGIN_TEMPLATE(encodeURIComponent(ssoRedirectUrl))}`;
|
|
8631
8630
|
const ssoURL = `${thoughtSpotHost}${ssoEndPoint}`;
|
|
8632
8631
|
if (embedConfig.noRedirect) {
|
|
8633
8632
|
await samlPopupFlow(ssoURL);
|
|
@@ -8635,6 +8634,28 @@ const doSamlAuth = async (embedConfig) => {
|
|
|
8635
8634
|
}
|
|
8636
8635
|
window.location.href = ssoURL;
|
|
8637
8636
|
};
|
|
8637
|
+
const doSamlAuth = async (embedConfig) => {
|
|
8638
|
+
const { thoughtSpotHost } = embedConfig;
|
|
8639
|
+
// redirect for SSO, when the SSO authentication is done, this page will be loaded
|
|
8640
|
+
// again and the same JS will execute again.
|
|
8641
|
+
const ssoRedirectUrl = embedConfig.noRedirect
|
|
8642
|
+
? `${thoughtSpotHost}/v2/#/embed/saml-complete`
|
|
8643
|
+
: appendToUrlHash(window.location.href, SSO_REDIRECTION_MARKER_GUID);
|
|
8644
|
+
// bring back the page to the same URL
|
|
8645
|
+
const ssoEndPoint = `${EndPoints.SAML_LOGIN_TEMPLATE(encodeURIComponent(ssoRedirectUrl))}`;
|
|
8646
|
+
await doSSOAuth(embedConfig, ssoEndPoint);
|
|
8647
|
+
};
|
|
8648
|
+
const doOIDCAuth = async (embedConfig) => {
|
|
8649
|
+
const { thoughtSpotHost } = embedConfig;
|
|
8650
|
+
// redirect for SSO, when the SSO authentication is done, this page will be loaded
|
|
8651
|
+
// again and the same JS will execute again.
|
|
8652
|
+
const ssoRedirectUrl = embedConfig.noRedirect
|
|
8653
|
+
? `${thoughtSpotHost}/v2/#/embed/saml-complete`
|
|
8654
|
+
: appendToUrlHash(window.location.href, SSO_REDIRECTION_MARKER_GUID);
|
|
8655
|
+
// bring back the page to the same URL
|
|
8656
|
+
const ssoEndPoint = `${EndPoints.OIDC_LOGIN_TEMPLATE(encodeURIComponent(ssoRedirectUrl))}`;
|
|
8657
|
+
await doSSOAuth(embedConfig, ssoEndPoint);
|
|
8658
|
+
};
|
|
8638
8659
|
/**
|
|
8639
8660
|
* Perform authentication on the ThoughtSpot cluster
|
|
8640
8661
|
* @param embedConfig The embed configuration
|
|
@@ -8644,6 +8665,8 @@ const authenticate = async (embedConfig) => {
|
|
|
8644
8665
|
switch (authType) {
|
|
8645
8666
|
case AuthType.SSO:
|
|
8646
8667
|
return doSamlAuth(embedConfig);
|
|
8668
|
+
case AuthType.OIDC:
|
|
8669
|
+
return doOIDCAuth(embedConfig);
|
|
8647
8670
|
case AuthType.AuthServer:
|
|
8648
8671
|
return doTokenAuth(embedConfig);
|
|
8649
8672
|
case AuthType.Basic:
|
|
@@ -8839,7 +8862,7 @@ function processTrigger(iFrame, messageType, thoughtSpotHost, data) {
|
|
|
8839
8862
|
}
|
|
8840
8863
|
}
|
|
8841
8864
|
|
|
8842
|
-
var version="1.6.0-
|
|
8865
|
+
var name="@thoughtspot/visual-embed-sdk";var version="1.6.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/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",classnames:"^2.3.1","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};
|
|
8843
8866
|
|
|
8844
8867
|
/**
|
|
8845
8868
|
* Copyright (c) 2021
|
|
@@ -8849,6 +8872,7 @@ var version="1.6.0-alpha.3";
|
|
|
8849
8872
|
* @summary Base classes
|
|
8850
8873
|
* @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
|
|
8851
8874
|
*/
|
|
8875
|
+
const { version: version$1 } = pkgInfo;
|
|
8852
8876
|
/**
|
|
8853
8877
|
* The event id map from v2 event names to v1 event id
|
|
8854
8878
|
* v1 events are the classic embed events implemented in Blink v1
|
|
@@ -9000,7 +9024,7 @@ class TsEmbed {
|
|
|
9000
9024
|
queryParams[Param.HostAppUrl] = encodeURIComponent(hostAppUrl);
|
|
9001
9025
|
queryParams[Param.ViewPortHeight] = window.innerHeight;
|
|
9002
9026
|
queryParams[Param.ViewPortWidth] = window.innerWidth;
|
|
9003
|
-
queryParams[Param.Version] = version;
|
|
9027
|
+
queryParams[Param.Version] = version$1;
|
|
9004
9028
|
if (this.embedConfig.customCssUrl) {
|
|
9005
9029
|
queryParams[Param.CustomCSSUrl] = this.embedConfig.customCssUrl;
|
|
9006
9030
|
}
|
|
@@ -9568,7 +9592,7 @@ class SearchEmbed extends TsEmbed {
|
|
|
9568
9592
|
* @param dataSources A list of data source GUIDs
|
|
9569
9593
|
*/
|
|
9570
9594
|
getIFrameSrc(answerId, dataSources) {
|
|
9571
|
-
const { hideResults, enableSearchAssist, forceTable, searchOptions, } = this.viewConfig;
|
|
9595
|
+
const { hideResults, expandAllDataSource, enableSearchAssist, forceTable, searchOptions, } = this.viewConfig;
|
|
9572
9596
|
const answerPath = answerId ? `saved-answer/${answerId}` : 'answer';
|
|
9573
9597
|
const queryParams = this.getBaseQueryParams();
|
|
9574
9598
|
if (dataSources && dataSources.length) {
|
package/dist/tsembed.js
CHANGED
|
@@ -133,6 +133,10 @@
|
|
|
133
133
|
* SSO using SAML
|
|
134
134
|
*/
|
|
135
135
|
AuthType["SSO"] = "SSO_SAML";
|
|
136
|
+
/**
|
|
137
|
+
* SSO using OIDC
|
|
138
|
+
*/
|
|
139
|
+
AuthType["OIDC"] = "SSO_OIDC";
|
|
136
140
|
/**
|
|
137
141
|
* Trusted authentication server
|
|
138
142
|
*/
|
|
@@ -254,7 +258,7 @@
|
|
|
254
258
|
/**
|
|
255
259
|
* A double click has been triggered on table/chart
|
|
256
260
|
* @return ContextMenuInputPoints - data point that is double clicked
|
|
257
|
-
*
|
|
261
|
+
* @version 1.5.0 or later
|
|
258
262
|
*/
|
|
259
263
|
EmbedEvent["VizPointDoubleClick"] = "vizPointDoubleClick";
|
|
260
264
|
/**
|
|
@@ -296,7 +300,7 @@
|
|
|
296
300
|
* Emitted when the embed does not have cookie access. This
|
|
297
301
|
* happens on Safari where third-party cookies are blocked by default.
|
|
298
302
|
*
|
|
299
|
-
* @version 1.1.0
|
|
303
|
+
* @version 1.1.0 or later
|
|
300
304
|
*/
|
|
301
305
|
EmbedEvent["NoCookieAccess"] = "noCookieAccess";
|
|
302
306
|
/**
|
|
@@ -307,12 +311,12 @@
|
|
|
307
311
|
EmbedEvent["SAMLComplete"] = "samlComplete";
|
|
308
312
|
/**
|
|
309
313
|
* Emitted when any modal is opened in the app
|
|
310
|
-
*
|
|
314
|
+
* @version 1.6.0 or later
|
|
311
315
|
*/
|
|
312
316
|
EmbedEvent["DialogOpen"] = "dialog-open";
|
|
313
317
|
/**
|
|
314
318
|
* Emitted when any modal is closed in the app
|
|
315
|
-
*
|
|
319
|
+
* @version 1.6.0 or later
|
|
316
320
|
*/
|
|
317
321
|
EmbedEvent["DialogClose"] = "dialog-close";
|
|
318
322
|
})(exports.EmbedEvent || (exports.EmbedEvent = {}));
|
|
@@ -329,7 +333,7 @@
|
|
|
329
333
|
* eg. { selectedPoints: []}
|
|
330
334
|
* @param columnGuid - a string guid of the column to drill by. This is optional,
|
|
331
335
|
* if not provided it will auto drill by the configured column. \
|
|
332
|
-
*
|
|
336
|
+
* @version 1.5.0 or later
|
|
333
337
|
*/
|
|
334
338
|
HostEvent["DrillDown"] = "triggerDrillDown";
|
|
335
339
|
/**
|
|
@@ -346,7 +350,7 @@
|
|
|
346
350
|
* Set the visible visualizations on a Liveboard.
|
|
347
351
|
* @param - an array of ids of visualizations to show, the ids not passed
|
|
348
352
|
* will be hidden.
|
|
349
|
-
*
|
|
353
|
+
* @version 1.6.0 or later
|
|
350
354
|
*/
|
|
351
355
|
HostEvent["SetVisibleVizs"] = "SetPinboardVisibleVizs";
|
|
352
356
|
})(exports.HostEvent || (exports.HostEvent = {}));
|
|
@@ -373,6 +377,7 @@
|
|
|
373
377
|
(function (Param) {
|
|
374
378
|
Param["DataSources"] = "dataSources";
|
|
375
379
|
Param["DataSourceMode"] = "dataSourceMode";
|
|
380
|
+
Param["ExpandAllDataSource"] = "expandAllDataSource";
|
|
376
381
|
Param["DisableActions"] = "disableAction";
|
|
377
382
|
Param["DisableActionReason"] = "disableHint";
|
|
378
383
|
Param["ForceTable"] = "forceTable";
|
|
@@ -8468,7 +8473,8 @@
|
|
|
8468
8473
|
const SSO_REDIRECTION_MARKER_GUID = '5e16222e-ef02-43e9-9fbd-24226bf3ce5b';
|
|
8469
8474
|
const EndPoints = {
|
|
8470
8475
|
AUTH_VERIFICATION: '/callosum/v1/session/info',
|
|
8471
|
-
|
|
8476
|
+
SAML_LOGIN_TEMPLATE: (targetUrl) => `/callosum/v1/saml/login?targetURLPath=${targetUrl}`,
|
|
8477
|
+
OIDC_LOGIN_TEMPLATE: (targetUrl) => `/callosum/v1/oidc/login?targetURLPath=${targetUrl}`,
|
|
8472
8478
|
TOKEN_LOGIN: '/callosum/v1/session/login/token',
|
|
8473
8479
|
BASIC_LOGIN: '/callosum/v1/session/login',
|
|
8474
8480
|
};
|
|
@@ -8576,7 +8582,7 @@
|
|
|
8576
8582
|
* Perform SAML authentication
|
|
8577
8583
|
* @param embedConfig The embed configuration
|
|
8578
8584
|
*/
|
|
8579
|
-
const
|
|
8585
|
+
const doSSOAuth = async (embedConfig, ssoEndPoint) => {
|
|
8580
8586
|
const { thoughtSpotHost } = embedConfig;
|
|
8581
8587
|
const loggedIn = await isLoggedIn(thoughtSpotHost);
|
|
8582
8588
|
if (loggedIn) {
|
|
@@ -8593,13 +8599,6 @@
|
|
|
8593
8599
|
loggedInStatus = false;
|
|
8594
8600
|
return;
|
|
8595
8601
|
}
|
|
8596
|
-
// redirect for SSO, when the SSO authentication is done, this page will be loaded
|
|
8597
|
-
// again and the same JS will execute again.
|
|
8598
|
-
const ssoRedirectUrl = embedConfig.noRedirect
|
|
8599
|
-
? `${thoughtSpotHost}/v2/#/embed/saml-complete`
|
|
8600
|
-
: appendToUrlHash(window.location.href, SSO_REDIRECTION_MARKER_GUID);
|
|
8601
|
-
// bring back the page to the same URL
|
|
8602
|
-
const ssoEndPoint = `${EndPoints.SSO_LOGIN_TEMPLATE(encodeURIComponent(ssoRedirectUrl))}`;
|
|
8603
8602
|
const ssoURL = `${thoughtSpotHost}${ssoEndPoint}`;
|
|
8604
8603
|
if (embedConfig.noRedirect) {
|
|
8605
8604
|
await samlPopupFlow(ssoURL);
|
|
@@ -8607,6 +8606,28 @@
|
|
|
8607
8606
|
}
|
|
8608
8607
|
window.location.href = ssoURL;
|
|
8609
8608
|
};
|
|
8609
|
+
const doSamlAuth = async (embedConfig) => {
|
|
8610
|
+
const { thoughtSpotHost } = embedConfig;
|
|
8611
|
+
// redirect for SSO, when the SSO authentication is done, this page will be loaded
|
|
8612
|
+
// again and the same JS will execute again.
|
|
8613
|
+
const ssoRedirectUrl = embedConfig.noRedirect
|
|
8614
|
+
? `${thoughtSpotHost}/v2/#/embed/saml-complete`
|
|
8615
|
+
: appendToUrlHash(window.location.href, SSO_REDIRECTION_MARKER_GUID);
|
|
8616
|
+
// bring back the page to the same URL
|
|
8617
|
+
const ssoEndPoint = `${EndPoints.SAML_LOGIN_TEMPLATE(encodeURIComponent(ssoRedirectUrl))}`;
|
|
8618
|
+
await doSSOAuth(embedConfig, ssoEndPoint);
|
|
8619
|
+
};
|
|
8620
|
+
const doOIDCAuth = async (embedConfig) => {
|
|
8621
|
+
const { thoughtSpotHost } = embedConfig;
|
|
8622
|
+
// redirect for SSO, when the SSO authentication is done, this page will be loaded
|
|
8623
|
+
// again and the same JS will execute again.
|
|
8624
|
+
const ssoRedirectUrl = embedConfig.noRedirect
|
|
8625
|
+
? `${thoughtSpotHost}/v2/#/embed/saml-complete`
|
|
8626
|
+
: appendToUrlHash(window.location.href, SSO_REDIRECTION_MARKER_GUID);
|
|
8627
|
+
// bring back the page to the same URL
|
|
8628
|
+
const ssoEndPoint = `${EndPoints.OIDC_LOGIN_TEMPLATE(encodeURIComponent(ssoRedirectUrl))}`;
|
|
8629
|
+
await doSSOAuth(embedConfig, ssoEndPoint);
|
|
8630
|
+
};
|
|
8610
8631
|
/**
|
|
8611
8632
|
* Perform authentication on the ThoughtSpot cluster
|
|
8612
8633
|
* @param embedConfig The embed configuration
|
|
@@ -8616,6 +8637,8 @@
|
|
|
8616
8637
|
switch (authType) {
|
|
8617
8638
|
case exports.AuthType.SSO:
|
|
8618
8639
|
return doSamlAuth(embedConfig);
|
|
8640
|
+
case exports.AuthType.OIDC:
|
|
8641
|
+
return doOIDCAuth(embedConfig);
|
|
8619
8642
|
case exports.AuthType.AuthServer:
|
|
8620
8643
|
return doTokenAuth(embedConfig);
|
|
8621
8644
|
case exports.AuthType.Basic:
|
|
@@ -8811,7 +8834,7 @@
|
|
|
8811
8834
|
}
|
|
8812
8835
|
}
|
|
8813
8836
|
|
|
8814
|
-
var version="1.6.0-
|
|
8837
|
+
var name="@thoughtspot/visual-embed-sdk";var version="1.6.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$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/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",classnames:"^2.3.1","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};
|
|
8815
8838
|
|
|
8816
8839
|
/**
|
|
8817
8840
|
* Copyright (c) 2021
|
|
@@ -8821,6 +8844,7 @@
|
|
|
8821
8844
|
* @summary Base classes
|
|
8822
8845
|
* @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
|
|
8823
8846
|
*/
|
|
8847
|
+
const { version: version$1 } = pkgInfo;
|
|
8824
8848
|
/**
|
|
8825
8849
|
* The event id map from v2 event names to v1 event id
|
|
8826
8850
|
* v1 events are the classic embed events implemented in Blink v1
|
|
@@ -8972,7 +8996,7 @@
|
|
|
8972
8996
|
queryParams[Param.HostAppUrl] = encodeURIComponent(hostAppUrl);
|
|
8973
8997
|
queryParams[Param.ViewPortHeight] = window.innerHeight;
|
|
8974
8998
|
queryParams[Param.ViewPortWidth] = window.innerWidth;
|
|
8975
|
-
queryParams[Param.Version] = version;
|
|
8999
|
+
queryParams[Param.Version] = version$1;
|
|
8976
9000
|
if (this.embedConfig.customCssUrl) {
|
|
8977
9001
|
queryParams[Param.CustomCSSUrl] = this.embedConfig.customCssUrl;
|
|
8978
9002
|
}
|
|
@@ -9535,7 +9559,7 @@
|
|
|
9535
9559
|
* @param dataSources A list of data source GUIDs
|
|
9536
9560
|
*/
|
|
9537
9561
|
getIFrameSrc(answerId, dataSources) {
|
|
9538
|
-
const { hideResults, enableSearchAssist, forceTable, searchOptions, } = this.viewConfig;
|
|
9562
|
+
const { hideResults, expandAllDataSource, enableSearchAssist, forceTable, searchOptions, } = this.viewConfig;
|
|
9539
9563
|
const answerPath = answerId ? `saved-answer/${answerId}` : 'answer';
|
|
9540
9564
|
const queryParams = this.getBaseQueryParams();
|
|
9541
9565
|
if (dataSources && dataSources.length) {
|
package/lib/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thoughtspot/visual-embed-sdk",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.3",
|
|
4
4
|
"description": "ThoughtSpot Embed SDK",
|
|
5
5
|
"module": "lib/src/index.js",
|
|
6
6
|
"main": "dist/tsembed.js",
|
|
@@ -65,6 +65,7 @@
|
|
|
65
65
|
"asciidoctor": "^2.2.1",
|
|
66
66
|
"babel-jest": "^26.6.3",
|
|
67
67
|
"babel-preset-gatsby": "^1.10.0",
|
|
68
|
+
"classnames": "^2.3.1",
|
|
68
69
|
"command-line-args": "^5.1.1",
|
|
69
70
|
"coveralls": "^3.1.0",
|
|
70
71
|
"dts-bundle": "0.7.3",
|
|
@@ -126,6 +127,9 @@
|
|
|
126
127
|
"type": "git",
|
|
127
128
|
"url": "git+https://github.com/thoughtspot/visual-embed-sdk.git"
|
|
128
129
|
},
|
|
130
|
+
"publishConfig": {
|
|
131
|
+
"registry": "https://registry.npmjs.org"
|
|
132
|
+
},
|
|
129
133
|
"keywords": [
|
|
130
134
|
"thoughtspot",
|
|
131
135
|
"everywhere",
|
package/lib/src/auth.d.ts
CHANGED
|
@@ -6,7 +6,8 @@ export declare let sessionInfo: any;
|
|
|
6
6
|
export declare const SSO_REDIRECTION_MARKER_GUID = "5e16222e-ef02-43e9-9fbd-24226bf3ce5b";
|
|
7
7
|
export declare const EndPoints: {
|
|
8
8
|
AUTH_VERIFICATION: string;
|
|
9
|
-
|
|
9
|
+
SAML_LOGIN_TEMPLATE: (targetUrl: string) => string;
|
|
10
|
+
OIDC_LOGIN_TEMPLATE: (targetUrl: string) => string;
|
|
10
11
|
TOKEN_LOGIN: string;
|
|
11
12
|
BASIC_LOGIN: string;
|
|
12
13
|
};
|
|
@@ -29,11 +30,8 @@ export declare const doTokenAuth: (embedConfig: EmbedConfig) => Promise<void>;
|
|
|
29
30
|
* @param embedConfig The embed configuration
|
|
30
31
|
*/
|
|
31
32
|
export declare const doBasicAuth: (embedConfig: EmbedConfig) => Promise<void>;
|
|
32
|
-
/**
|
|
33
|
-
* Perform SAML authentication
|
|
34
|
-
* @param embedConfig The embed configuration
|
|
35
|
-
*/
|
|
36
33
|
export declare const doSamlAuth: (embedConfig: EmbedConfig) => Promise<void>;
|
|
34
|
+
export declare const doOIDCAuth: (embedConfig: EmbedConfig) => Promise<void>;
|
|
37
35
|
/**
|
|
38
36
|
* Perform authentication on the ThoughtSpot cluster
|
|
39
37
|
* @param embedConfig The embed configuration
|
package/lib/src/auth.js
CHANGED
|
@@ -14,7 +14,8 @@ export let sessionInfo = null;
|
|
|
14
14
|
export const SSO_REDIRECTION_MARKER_GUID = '5e16222e-ef02-43e9-9fbd-24226bf3ce5b';
|
|
15
15
|
export const EndPoints = {
|
|
16
16
|
AUTH_VERIFICATION: '/callosum/v1/session/info',
|
|
17
|
-
|
|
17
|
+
SAML_LOGIN_TEMPLATE: (targetUrl) => `/callosum/v1/saml/login?targetURLPath=${targetUrl}`,
|
|
18
|
+
OIDC_LOGIN_TEMPLATE: (targetUrl) => `/callosum/v1/oidc/login?targetURLPath=${targetUrl}`,
|
|
18
19
|
TOKEN_LOGIN: '/callosum/v1/session/login/token',
|
|
19
20
|
BASIC_LOGIN: '/callosum/v1/session/login',
|
|
20
21
|
};
|
|
@@ -128,7 +129,7 @@ async function samlPopupFlow(ssoURL) {
|
|
|
128
129
|
* Perform SAML authentication
|
|
129
130
|
* @param embedConfig The embed configuration
|
|
130
131
|
*/
|
|
131
|
-
|
|
132
|
+
const doSSOAuth = async (embedConfig, ssoEndPoint) => {
|
|
132
133
|
const { thoughtSpotHost } = embedConfig;
|
|
133
134
|
const loggedIn = await isLoggedIn(thoughtSpotHost);
|
|
134
135
|
if (loggedIn) {
|
|
@@ -145,13 +146,6 @@ export const doSamlAuth = async (embedConfig) => {
|
|
|
145
146
|
loggedInStatus = false;
|
|
146
147
|
return;
|
|
147
148
|
}
|
|
148
|
-
// redirect for SSO, when the SSO authentication is done, this page will be loaded
|
|
149
|
-
// again and the same JS will execute again.
|
|
150
|
-
const ssoRedirectUrl = embedConfig.noRedirect
|
|
151
|
-
? `${thoughtSpotHost}/v2/#/embed/saml-complete`
|
|
152
|
-
: appendToUrlHash(window.location.href, SSO_REDIRECTION_MARKER_GUID);
|
|
153
|
-
// bring back the page to the same URL
|
|
154
|
-
const ssoEndPoint = `${EndPoints.SSO_LOGIN_TEMPLATE(encodeURIComponent(ssoRedirectUrl))}`;
|
|
155
149
|
const ssoURL = `${thoughtSpotHost}${ssoEndPoint}`;
|
|
156
150
|
if (embedConfig.noRedirect) {
|
|
157
151
|
await samlPopupFlow(ssoURL);
|
|
@@ -159,6 +153,28 @@ export const doSamlAuth = async (embedConfig) => {
|
|
|
159
153
|
}
|
|
160
154
|
window.location.href = ssoURL;
|
|
161
155
|
};
|
|
156
|
+
export const doSamlAuth = async (embedConfig) => {
|
|
157
|
+
const { thoughtSpotHost } = embedConfig;
|
|
158
|
+
// redirect for SSO, when the SSO authentication is done, this page will be loaded
|
|
159
|
+
// again and the same JS will execute again.
|
|
160
|
+
const ssoRedirectUrl = embedConfig.noRedirect
|
|
161
|
+
? `${thoughtSpotHost}/v2/#/embed/saml-complete`
|
|
162
|
+
: appendToUrlHash(window.location.href, SSO_REDIRECTION_MARKER_GUID);
|
|
163
|
+
// bring back the page to the same URL
|
|
164
|
+
const ssoEndPoint = `${EndPoints.SAML_LOGIN_TEMPLATE(encodeURIComponent(ssoRedirectUrl))}`;
|
|
165
|
+
await doSSOAuth(embedConfig, ssoEndPoint);
|
|
166
|
+
};
|
|
167
|
+
export const doOIDCAuth = async (embedConfig) => {
|
|
168
|
+
const { thoughtSpotHost } = embedConfig;
|
|
169
|
+
// redirect for SSO, when the SSO authentication is done, this page will be loaded
|
|
170
|
+
// again and the same JS will execute again.
|
|
171
|
+
const ssoRedirectUrl = embedConfig.noRedirect
|
|
172
|
+
? `${thoughtSpotHost}/v2/#/embed/saml-complete`
|
|
173
|
+
: appendToUrlHash(window.location.href, SSO_REDIRECTION_MARKER_GUID);
|
|
174
|
+
// bring back the page to the same URL
|
|
175
|
+
const ssoEndPoint = `${EndPoints.OIDC_LOGIN_TEMPLATE(encodeURIComponent(ssoRedirectUrl))}`;
|
|
176
|
+
await doSSOAuth(embedConfig, ssoEndPoint);
|
|
177
|
+
};
|
|
162
178
|
/**
|
|
163
179
|
* Perform authentication on the ThoughtSpot cluster
|
|
164
180
|
* @param embedConfig The embed configuration
|
|
@@ -168,6 +184,8 @@ export const authenticate = async (embedConfig) => {
|
|
|
168
184
|
switch (authType) {
|
|
169
185
|
case AuthType.SSO:
|
|
170
186
|
return doSamlAuth(embedConfig);
|
|
187
|
+
case AuthType.OIDC:
|
|
188
|
+
return doOIDCAuth(embedConfig);
|
|
171
189
|
case AuthType.AuthServer:
|
|
172
190
|
return doTokenAuth(embedConfig);
|
|
173
191
|
case AuthType.Basic:
|
package/lib/src/auth.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAe,UAAU,EAAE,MAAM,SAAS,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC1C,2CAA2C;AAC3C,OAAO,EACH,uBAAuB,EACvB,qBAAqB,EACrB,gBAAgB,EAChB,qBAAqB,GACxB,MAAM,qBAAqB,CAAC;AAE7B,qDAAqD;AACrD,MAAM,CAAC,IAAI,cAAc,GAAG,KAAK,CAAC;AAClC,qDAAqD;AACrD,MAAM,CAAC,IAAI,cAAc,GAAW,IAAI,CAAC;AACzC,qDAAqD;AACrD,MAAM,CAAC,IAAI,qBAAqB,GAAkB,IAAI,CAAC;AACvD,qDAAqD;AACrD,MAAM,CAAC,IAAI,WAAW,GAAQ,IAAI,CAAC;AAEnC,MAAM,CAAC,MAAM,2BAA2B,GACpC,sCAAsC,CAAC;AAE3C,MAAM,CAAC,MAAM,SAAS,GAAG;IACrB,iBAAiB,EAAE,2BAA2B;IAC9C,
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/auth.ts"],"names":[],"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Ae,GAAG,GAAY,EAAE,CAAC,cAAc,CAAC"}
|
package/lib/src/auth.spec.js
CHANGED
|
@@ -69,8 +69,8 @@ describe('Unit test for auth', () => {
|
|
|
69
69
|
beforeEach(() => {
|
|
70
70
|
global.fetch = window.fetch;
|
|
71
71
|
});
|
|
72
|
-
test('endpoints,
|
|
73
|
-
const ssoTemplateUrl = authInstance.EndPoints.
|
|
72
|
+
test('endpoints, SAML_LOGIN_TEMPLATE', () => {
|
|
73
|
+
const ssoTemplateUrl = authInstance.EndPoints.SAML_LOGIN_TEMPLATE(thoughtSpotHost);
|
|
74
74
|
expect(ssoTemplateUrl).toBe(`/callosum/v1/saml/login?targetURLPath=${thoughtSpotHost}`);
|
|
75
75
|
});
|
|
76
76
|
test('when session info giving response', async () => {
|