@thoughtspot/visual-embed-sdk 1.7.0-alpha.1 → 1.7.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/auth.d.ts +3 -5
- package/dist/src/embed/pinboard.d.ts +85 -0
- package/dist/src/types.d.ts +4 -0
- package/dist/tsembed.es.js +32 -11
- package/dist/tsembed.js +32 -11
- package/lib/package.json +1 -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/pinboard.d.ts +85 -0
- package/lib/src/embed/pinboard.js +107 -0
- package/lib/src/embed/pinboard.js.map +1 -0
- package/lib/src/embed/search.js +0 -1
- package/lib/src/embed/search.js.map +1 -1
- package/lib/src/react/index.spec.js +1 -1
- package/lib/src/react/index.spec.js.map +1 -1
- package/lib/src/types.d.ts +4 -0
- package/lib/src/types.js +4 -0
- package/lib/src/types.js.map +1 -1
- package/lib/src/utils/fetchAnswers.d.ts +3 -0
- package/lib/src/utils/fetchAnswers.js +49 -0
- package/lib/src/utils/fetchAnswers.js.map +1 -0
- package/lib/src/visual-embed-sdk.d.ts +4 -0
- package/package.json +1 -1
- package/src/auth.spec.ts +2 -2
- package/src/auth.ts +37 -9
- package/src/embed/search.ts +0 -1
- package/src/react/index.spec.tsx +1 -1
- package/src/types.ts +4 -0
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
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2021
|
|
3
|
+
*
|
|
4
|
+
* Embed a ThoughtSpot pinboard or visualization
|
|
5
|
+
* https://developers.thoughtspot.com/docs/?pageid=embed-pinboard
|
|
6
|
+
* https://developers.thoughtspot.com/docs/?pageid=embed-a-viz
|
|
7
|
+
*
|
|
8
|
+
* @summary Pinboard & visualization embed
|
|
9
|
+
* @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
|
|
10
|
+
*/
|
|
11
|
+
import { DOMSelector } from '../types';
|
|
12
|
+
import { V1Embed, ViewConfig } from './ts-embed';
|
|
13
|
+
/**
|
|
14
|
+
* The configuration for the embedded pinboard or visualization page view.
|
|
15
|
+
* @Category Pinboards and Charts
|
|
16
|
+
*/
|
|
17
|
+
export interface PinboardViewConfig extends ViewConfig {
|
|
18
|
+
/**
|
|
19
|
+
* If set to true, the embedded object container dynamically resizes
|
|
20
|
+
* according to the height of the pinboard.
|
|
21
|
+
*/
|
|
22
|
+
fullHeight?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* This is the minimum height(in pixels) for a full height pinboard.
|
|
25
|
+
* Setting this height helps resolves issues with empty pinboards and
|
|
26
|
+
* other screens navigable from a pinboard.
|
|
27
|
+
* @default 500
|
|
28
|
+
* * _since 1.5.0_
|
|
29
|
+
*/
|
|
30
|
+
defaultHeight?: number;
|
|
31
|
+
/**
|
|
32
|
+
* If set to true, the context menu in visualizations will be enabled.
|
|
33
|
+
*/
|
|
34
|
+
enableVizTransformations?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* The pinboard to display in the embedded view.
|
|
37
|
+
*/
|
|
38
|
+
pinboardId: string;
|
|
39
|
+
/**
|
|
40
|
+
* The visualization within the pinboard to display.
|
|
41
|
+
*/
|
|
42
|
+
vizId?: string;
|
|
43
|
+
/**
|
|
44
|
+
* If set to true, all filter chips from a
|
|
45
|
+
* pinboard page will be read-only (no X buttons)
|
|
46
|
+
*/
|
|
47
|
+
preventPinboardFilterRemoval?: boolean;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Embed a ThoughtSpot pinboard or visualization
|
|
51
|
+
* @Category Pinboards and Charts
|
|
52
|
+
*/
|
|
53
|
+
export declare class PinboardEmbed extends V1Embed {
|
|
54
|
+
protected viewConfig: PinboardViewConfig;
|
|
55
|
+
private defaultHeight;
|
|
56
|
+
constructor(domSelector: DOMSelector, viewConfig: PinboardViewConfig);
|
|
57
|
+
/**
|
|
58
|
+
* Construct a map of params to be passed on to the
|
|
59
|
+
* embedded pinboard or visualization.
|
|
60
|
+
*/
|
|
61
|
+
private getEmbedParams;
|
|
62
|
+
/**
|
|
63
|
+
* Construct the URL of the embedded ThoughtSpot pinboard or visualization
|
|
64
|
+
* to be loaded within the iframe.
|
|
65
|
+
* @param pinboardId The GUID of the pinboard.
|
|
66
|
+
* @param vizId The optional GUID of a visualization within the pinboard.
|
|
67
|
+
* @param runtimeFilters A list of runtime filters to be applied to
|
|
68
|
+
* the pinboard or visualization on load.
|
|
69
|
+
*/
|
|
70
|
+
private getIFrameSrc;
|
|
71
|
+
/**
|
|
72
|
+
* Set the iframe height as per the computed height received
|
|
73
|
+
* from the ThoughtSpot app.
|
|
74
|
+
* @param data The event payload
|
|
75
|
+
*/
|
|
76
|
+
private updateIFrameHeight;
|
|
77
|
+
private embedIframeCenter;
|
|
78
|
+
private handleRouteChangeFullHeightPinboard;
|
|
79
|
+
/**
|
|
80
|
+
* Render an embedded ThoughtSpot pinboard or visualization
|
|
81
|
+
* @param renderOptions An object specifying the pinboard ID,
|
|
82
|
+
* visualization ID and the runtime filters.
|
|
83
|
+
*/
|
|
84
|
+
render(): PinboardEmbed;
|
|
85
|
+
}
|
package/dist/src/types.d.ts
CHANGED
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
|
*/
|
|
@@ -8497,7 +8501,8 @@ let sessionInfo = null;
|
|
|
8497
8501
|
const SSO_REDIRECTION_MARKER_GUID = '5e16222e-ef02-43e9-9fbd-24226bf3ce5b';
|
|
8498
8502
|
const EndPoints = {
|
|
8499
8503
|
AUTH_VERIFICATION: '/callosum/v1/session/info',
|
|
8500
|
-
|
|
8504
|
+
SAML_LOGIN_TEMPLATE: (targetUrl) => `/callosum/v1/saml/login?targetURLPath=${targetUrl}`,
|
|
8505
|
+
OIDC_LOGIN_TEMPLATE: (targetUrl) => `/callosum/v1/oidc/login?targetURLPath=${targetUrl}`,
|
|
8501
8506
|
TOKEN_LOGIN: '/callosum/v1/session/login/token',
|
|
8502
8507
|
BASIC_LOGIN: '/callosum/v1/session/login',
|
|
8503
8508
|
};
|
|
@@ -8605,7 +8610,7 @@ async function samlPopupFlow(ssoURL) {
|
|
|
8605
8610
|
* Perform SAML authentication
|
|
8606
8611
|
* @param embedConfig The embed configuration
|
|
8607
8612
|
*/
|
|
8608
|
-
const
|
|
8613
|
+
const doSSOAuth = async (embedConfig, ssoEndPoint) => {
|
|
8609
8614
|
const { thoughtSpotHost } = embedConfig;
|
|
8610
8615
|
const loggedIn = await isLoggedIn(thoughtSpotHost);
|
|
8611
8616
|
if (loggedIn) {
|
|
@@ -8622,13 +8627,6 @@ const doSamlAuth = async (embedConfig) => {
|
|
|
8622
8627
|
loggedInStatus = false;
|
|
8623
8628
|
return;
|
|
8624
8629
|
}
|
|
8625
|
-
// redirect for SSO, when the SSO authentication is done, this page will be loaded
|
|
8626
|
-
// again and the same JS will execute again.
|
|
8627
|
-
const ssoRedirectUrl = embedConfig.noRedirect
|
|
8628
|
-
? `${thoughtSpotHost}/v2/#/embed/saml-complete`
|
|
8629
|
-
: appendToUrlHash(window.location.href, SSO_REDIRECTION_MARKER_GUID);
|
|
8630
|
-
// bring back the page to the same URL
|
|
8631
|
-
const ssoEndPoint = `${EndPoints.SSO_LOGIN_TEMPLATE(encodeURIComponent(ssoRedirectUrl))}`;
|
|
8632
8630
|
const ssoURL = `${thoughtSpotHost}${ssoEndPoint}`;
|
|
8633
8631
|
if (embedConfig.noRedirect) {
|
|
8634
8632
|
await samlPopupFlow(ssoURL);
|
|
@@ -8636,6 +8634,28 @@ const doSamlAuth = async (embedConfig) => {
|
|
|
8636
8634
|
}
|
|
8637
8635
|
window.location.href = ssoURL;
|
|
8638
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
|
+
};
|
|
8639
8659
|
/**
|
|
8640
8660
|
* Perform authentication on the ThoughtSpot cluster
|
|
8641
8661
|
* @param embedConfig The embed configuration
|
|
@@ -8645,6 +8665,8 @@ const authenticate = async (embedConfig) => {
|
|
|
8645
8665
|
switch (authType) {
|
|
8646
8666
|
case AuthType.SSO:
|
|
8647
8667
|
return doSamlAuth(embedConfig);
|
|
8668
|
+
case AuthType.OIDC:
|
|
8669
|
+
return doOIDCAuth(embedConfig);
|
|
8648
8670
|
case AuthType.AuthServer:
|
|
8649
8671
|
return doTokenAuth(embedConfig);
|
|
8650
8672
|
case AuthType.Basic:
|
|
@@ -8840,7 +8862,7 @@ function processTrigger(iFrame, messageType, thoughtSpotHost, data) {
|
|
|
8840
8862
|
}
|
|
8841
8863
|
}
|
|
8842
8864
|
|
|
8843
|
-
var name="@thoughtspot/visual-embed-sdk";var version="1.7.0-alpha.
|
|
8865
|
+
var name="@thoughtspot/visual-embed-sdk";var version="1.7.0-alpha.2";var description="ThoughtSpot Embed SDK";var module="lib/src/index.js";var main="dist/tsembed.js";var types="lib/src/index.d.ts";var files=["dist/**","lib/**","src/**"];var exports={".":"./lib/src/index.js","./react":"./lib/src/react/index.js"};var scripts={lint:"eslint 'src/**'","lint:fix":"eslint 'src/**/*.*' --fix",tsc:"tsc -p . --incremental false",start:"gatsby develop","build:gatsby":"npm run clean:gatsby && gatsby build --prefix-paths","build:gatsby:noprefix":"npm run clean:gatsby && gatsby build","serve:gatsby":"gatsby serve","clean:gatsby":"gatsby clean","build-and-publish":"npm run build:gatsby && npm run publish","bundle-dts":"dts-bundle --name @thoughtspot/visual-embed-sdk --out visual-embed-sdk.d.ts --main lib/src/index.d.ts",build:"rollup -c",watch:"rollup -cw","docs-cmd":"node scripts/gatsby-commands.js",docgen:"typedoc --tsconfig tsconfig.json --theme typedoc-theme","test-sdk":"jest -c jest.config.sdk.js","test-docs":"jest -c jest.config.docs.js",test:"npm run test-sdk && npm run test-docs && npx istanbul-merge --out ./coverage/coverage.json ./coverage/docs/coverage-final.json ./coverage/sdk/coverage-final.json && npx istanbul report --include ./coverage/coverage.json --dir ./coverage lcov",posttest:"cat ./coverage/lcov.info | coveralls",prepublishOnly:"npm run test; npm run tsc; npm run bundle-dts; npm run build","publish-dev":"npm publish --tag dev","publish-prod":"npm publish --tag latest"};var peerDependencies={react:"> 16.8.0","react-dom":"> 16.8.0"};var dependencies={algoliasearch:"^4.10.5",classnames:"^2.3.1","mixpanel-browser":"^2.41.0"};var devDependencies={"@mdx-js/mdx":"^1.6.22","@mdx-js/react":"^1.6.22","@react-icons/all-files":"^4.1.0","@rollup/plugin-commonjs":"^18.0.0","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^11.2.1","@testing-library/dom":"^7.31.0","@testing-library/jest-dom":"^5.14.1","@testing-library/react":"^11.2.7","@testing-library/user-event":"^13.1.8","@types/jest":"^22.2.3","@types/mixpanel-browser":"^2.35.6","@types/react-test-renderer":"^17.0.1","@typescript-eslint/eslint-plugin":"^4.6.0","@typescript-eslint/parser":"^4.6.0",asciidoctor:"^2.2.1","babel-jest":"^26.6.3","babel-preset-gatsby":"^1.10.0","command-line-args":"^5.1.1",coveralls:"^3.1.0","dts-bundle":"0.7.3",eslint:"^7.12.1","eslint-config-airbnb-base":"^14.2.0","eslint-config-prettier":"^6.15.0","eslint-import-resolver-typescript":"^2.3.0","eslint-plugin-import":"^2.22.1","eslint-plugin-prettier":"^3.1.4","eslint-plugin-react-hooks":"^4.2.0","fs-extra":"^10.0.0",gatsby:"3.1.0","gatsby-plugin-algolia":"^0.22.2","gatsby-plugin-catch-links":"^3.1.0","gatsby-plugin-env-variables":"^2.1.0","gatsby-plugin-intl":"^0.3.3","gatsby-plugin-manifest":"^3.2.0","gatsby-plugin-output":"^0.1.3","gatsby-plugin-sass":"4.1.0","gatsby-plugin-sitemap":"^4.10.0","gatsby-source-filesystem":"3.1.0","gatsby-transformer-asciidoc":"2.1.0","gatsby-transformer-rehype":"2.0.0","gh-pages":"^3.1.0","highlight.js":"^10.6.0","html-to-text":"^8.0.0","identity-obj-proxy":"^3.0.0","istanbul-merge":"^1.1.1",jest:"^26.6.3","jest-puppeteer":"^4.4.0",jsdom:"^17.0.0","node-sass":"^4.0.0",prettier:"2.1.2",puppeteer:"^7.0.1",react:"^16.14.0","react-dom":"^16.14.0","react-resizable":"^1.11.0","react-resize-detector":"^6.6.0","react-test-renderer":"^17.0.2","react-use-flexsearch":"^0.1.1",rollup:"2.30.0","rollup-plugin-typescript2":"0.27.3","ts-jest":"^26.5.5","ts-loader":"8.0.4",typedoc:"0.21.6","typedoc-neo-theme":"^1.1.0","typedoc-plugin-toc-group":"0.0.5",typescript:"^4.1.0","url-search-params-polyfill":"^8.1.0",util:"^0.12.4"};var author="ThoughtSpot";var email="support@thoughtspot.com";var license="ThoughtSpot Development Tools End User License Agreement";var directories={lib:"lib"};var repository={type:"git",url:"git+https://github.com/thoughtspot/visual-embed-sdk.git"};var publishConfig={registry:"https://registry.npmjs.org"};var keywords=["thoughtspot","everywhere","embed","sdk","analytics"];var bugs={url:"https://github.com/thoughtspot/visual-embed-sdk/issues"};var homepage="https://github.com/thoughtspot/visual-embed-sdk#readme";var globals={window:{}};var pkgInfo = {name:name,version:version,description:description,module:module,main:main,types:types,files:files,exports:exports,scripts:scripts,peerDependencies:peerDependencies,dependencies:dependencies,devDependencies:devDependencies,author:author,email:email,license:license,directories:directories,repository:repository,publishConfig:publishConfig,keywords:keywords,bugs:bugs,homepage:homepage,globals:globals};
|
|
8844
8866
|
|
|
8845
8867
|
/**
|
|
8846
8868
|
* Copyright (c) 2021
|
|
@@ -9541,7 +9563,6 @@ class PinboardEmbed extends LiveboardEmbed {
|
|
|
9541
9563
|
*/
|
|
9542
9564
|
const HiddenActionItemByDefaultForSearchEmbed = [
|
|
9543
9565
|
Action.EditACopy,
|
|
9544
|
-
Action.SpotIQAnalyze,
|
|
9545
9566
|
Action.SaveAsView,
|
|
9546
9567
|
];
|
|
9547
9568
|
/**
|
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
|
*/
|
|
@@ -8469,7 +8473,8 @@
|
|
|
8469
8473
|
const SSO_REDIRECTION_MARKER_GUID = '5e16222e-ef02-43e9-9fbd-24226bf3ce5b';
|
|
8470
8474
|
const EndPoints = {
|
|
8471
8475
|
AUTH_VERIFICATION: '/callosum/v1/session/info',
|
|
8472
|
-
|
|
8476
|
+
SAML_LOGIN_TEMPLATE: (targetUrl) => `/callosum/v1/saml/login?targetURLPath=${targetUrl}`,
|
|
8477
|
+
OIDC_LOGIN_TEMPLATE: (targetUrl) => `/callosum/v1/oidc/login?targetURLPath=${targetUrl}`,
|
|
8473
8478
|
TOKEN_LOGIN: '/callosum/v1/session/login/token',
|
|
8474
8479
|
BASIC_LOGIN: '/callosum/v1/session/login',
|
|
8475
8480
|
};
|
|
@@ -8577,7 +8582,7 @@
|
|
|
8577
8582
|
* Perform SAML authentication
|
|
8578
8583
|
* @param embedConfig The embed configuration
|
|
8579
8584
|
*/
|
|
8580
|
-
const
|
|
8585
|
+
const doSSOAuth = async (embedConfig, ssoEndPoint) => {
|
|
8581
8586
|
const { thoughtSpotHost } = embedConfig;
|
|
8582
8587
|
const loggedIn = await isLoggedIn(thoughtSpotHost);
|
|
8583
8588
|
if (loggedIn) {
|
|
@@ -8594,13 +8599,6 @@
|
|
|
8594
8599
|
loggedInStatus = false;
|
|
8595
8600
|
return;
|
|
8596
8601
|
}
|
|
8597
|
-
// redirect for SSO, when the SSO authentication is done, this page will be loaded
|
|
8598
|
-
// again and the same JS will execute again.
|
|
8599
|
-
const ssoRedirectUrl = embedConfig.noRedirect
|
|
8600
|
-
? `${thoughtSpotHost}/v2/#/embed/saml-complete`
|
|
8601
|
-
: appendToUrlHash(window.location.href, SSO_REDIRECTION_MARKER_GUID);
|
|
8602
|
-
// bring back the page to the same URL
|
|
8603
|
-
const ssoEndPoint = `${EndPoints.SSO_LOGIN_TEMPLATE(encodeURIComponent(ssoRedirectUrl))}`;
|
|
8604
8602
|
const ssoURL = `${thoughtSpotHost}${ssoEndPoint}`;
|
|
8605
8603
|
if (embedConfig.noRedirect) {
|
|
8606
8604
|
await samlPopupFlow(ssoURL);
|
|
@@ -8608,6 +8606,28 @@
|
|
|
8608
8606
|
}
|
|
8609
8607
|
window.location.href = ssoURL;
|
|
8610
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
|
+
};
|
|
8611
8631
|
/**
|
|
8612
8632
|
* Perform authentication on the ThoughtSpot cluster
|
|
8613
8633
|
* @param embedConfig The embed configuration
|
|
@@ -8617,6 +8637,8 @@
|
|
|
8617
8637
|
switch (authType) {
|
|
8618
8638
|
case exports.AuthType.SSO:
|
|
8619
8639
|
return doSamlAuth(embedConfig);
|
|
8640
|
+
case exports.AuthType.OIDC:
|
|
8641
|
+
return doOIDCAuth(embedConfig);
|
|
8620
8642
|
case exports.AuthType.AuthServer:
|
|
8621
8643
|
return doTokenAuth(embedConfig);
|
|
8622
8644
|
case exports.AuthType.Basic:
|
|
@@ -8812,7 +8834,7 @@
|
|
|
8812
8834
|
}
|
|
8813
8835
|
}
|
|
8814
8836
|
|
|
8815
|
-
var name="@thoughtspot/visual-embed-sdk";var version="1.7.0-alpha.
|
|
8837
|
+
var name="@thoughtspot/visual-embed-sdk";var version="1.7.0-alpha.2";var description="ThoughtSpot Embed SDK";var module="lib/src/index.js";var main="dist/tsembed.js";var types="lib/src/index.d.ts";var files=["dist/**","lib/**","src/**"];var exports$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","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};
|
|
8816
8838
|
|
|
8817
8839
|
/**
|
|
8818
8840
|
* Copyright (c) 2021
|
|
@@ -9508,7 +9530,6 @@
|
|
|
9508
9530
|
*/
|
|
9509
9531
|
const HiddenActionItemByDefaultForSearchEmbed = [
|
|
9510
9532
|
exports.Action.EditACopy,
|
|
9511
|
-
exports.Action.SpotIQAnalyze,
|
|
9512
9533
|
exports.Action.SaveAsView,
|
|
9513
9534
|
];
|
|
9514
9535
|
/**
|
package/lib/package.json
CHANGED
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,G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O,WAAW,CAAC,WAAW,CAAC,CAAC;QACpC,KAAK,QAAQ,CAAC,KAAK;YACf,OAAO,WAAW,CAAC,WAAW,CAAC,CAAC;QACpC;YACI,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;KAChC;AACL,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,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 () => {
|
package/lib/src/auth.spec.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.spec.js","sourceRoot":"","sources":["../../src/auth.spec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,YAAY,MAAM,QAAQ,CAAC;AACvC,OAAO,KAAK,WAAW,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAErD,MAAM,eAAe,GAAG,uBAAuB,CAAC;AAChD,MAAM,QAAQ,GAAG,QAAQ,CAAC;AAC1B,MAAM,QAAQ,GAAG,UAAU,CAAC;AAC5B,MAAM,aAAa,GAAG,GAAG,eAAe,+EAA+E,CAAC;AAExH,MAAM,WAAW,GAAQ;IACrB,kBAAkB,EAAE;QAChB,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AAC;IACN,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2021
|
|
3
|
+
*
|
|
4
|
+
* Embed a ThoughtSpot pinboard or visualization
|
|
5
|
+
* https://developers.thoughtspot.com/docs/?pageid=embed-pinboard
|
|
6
|
+
* https://developers.thoughtspot.com/docs/?pageid=embed-a-viz
|
|
7
|
+
*
|
|
8
|
+
* @summary Pinboard & visualization embed
|
|
9
|
+
* @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
|
|
10
|
+
*/
|
|
11
|
+
import { DOMSelector } from '../types';
|
|
12
|
+
import { V1Embed, ViewConfig } from './ts-embed';
|
|
13
|
+
/**
|
|
14
|
+
* The configuration for the embedded pinboard or visualization page view.
|
|
15
|
+
* @Category Pinboards and Charts
|
|
16
|
+
*/
|
|
17
|
+
export interface PinboardViewConfig extends ViewConfig {
|
|
18
|
+
/**
|
|
19
|
+
* If set to true, the embedded object container dynamically resizes
|
|
20
|
+
* according to the height of the pinboard.
|
|
21
|
+
*/
|
|
22
|
+
fullHeight?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* This is the minimum height(in pixels) for a full height pinboard.
|
|
25
|
+
* Setting this height helps resolves issues with empty pinboards and
|
|
26
|
+
* other screens navigable from a pinboard.
|
|
27
|
+
* @default 500
|
|
28
|
+
* * _since 1.5.0_
|
|
29
|
+
*/
|
|
30
|
+
defaultHeight?: number;
|
|
31
|
+
/**
|
|
32
|
+
* If set to true, the context menu in visualizations will be enabled.
|
|
33
|
+
*/
|
|
34
|
+
enableVizTransformations?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* The pinboard to display in the embedded view.
|
|
37
|
+
*/
|
|
38
|
+
pinboardId: string;
|
|
39
|
+
/**
|
|
40
|
+
* The visualization within the pinboard to display.
|
|
41
|
+
*/
|
|
42
|
+
vizId?: string;
|
|
43
|
+
/**
|
|
44
|
+
* If set to true, all filter chips from a
|
|
45
|
+
* pinboard page will be read-only (no X buttons)
|
|
46
|
+
*/
|
|
47
|
+
preventPinboardFilterRemoval?: boolean;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Embed a ThoughtSpot pinboard or visualization
|
|
51
|
+
* @Category Pinboards and Charts
|
|
52
|
+
*/
|
|
53
|
+
export declare class PinboardEmbed extends V1Embed {
|
|
54
|
+
protected viewConfig: PinboardViewConfig;
|
|
55
|
+
private defaultHeight;
|
|
56
|
+
constructor(domSelector: DOMSelector, viewConfig: PinboardViewConfig);
|
|
57
|
+
/**
|
|
58
|
+
* Construct a map of params to be passed on to the
|
|
59
|
+
* embedded pinboard or visualization.
|
|
60
|
+
*/
|
|
61
|
+
private getEmbedParams;
|
|
62
|
+
/**
|
|
63
|
+
* Construct the URL of the embedded ThoughtSpot pinboard or visualization
|
|
64
|
+
* to be loaded within the iframe.
|
|
65
|
+
* @param pinboardId The GUID of the pinboard.
|
|
66
|
+
* @param vizId The optional GUID of a visualization within the pinboard.
|
|
67
|
+
* @param runtimeFilters A list of runtime filters to be applied to
|
|
68
|
+
* the pinboard or visualization on load.
|
|
69
|
+
*/
|
|
70
|
+
private getIFrameSrc;
|
|
71
|
+
/**
|
|
72
|
+
* Set the iframe height as per the computed height received
|
|
73
|
+
* from the ThoughtSpot app.
|
|
74
|
+
* @param data The event payload
|
|
75
|
+
*/
|
|
76
|
+
private updateIFrameHeight;
|
|
77
|
+
private embedIframeCenter;
|
|
78
|
+
private handleRouteChangeFullHeightPinboard;
|
|
79
|
+
/**
|
|
80
|
+
* Render an embedded ThoughtSpot pinboard or visualization
|
|
81
|
+
* @param renderOptions An object specifying the pinboard ID,
|
|
82
|
+
* visualization ID and the runtime filters.
|
|
83
|
+
*/
|
|
84
|
+
render(): PinboardEmbed;
|
|
85
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2021
|
|
3
|
+
*
|
|
4
|
+
* Embed a ThoughtSpot pinboard or visualization
|
|
5
|
+
* https://developers.thoughtspot.com/docs/?pageid=embed-pinboard
|
|
6
|
+
* https://developers.thoughtspot.com/docs/?pageid=embed-a-viz
|
|
7
|
+
*
|
|
8
|
+
* @summary Pinboard & visualization embed
|
|
9
|
+
* @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
|
|
10
|
+
*/
|
|
11
|
+
import { ERROR_MESSAGE } from '../errors';
|
|
12
|
+
import { EmbedEvent, Param, } from '../types';
|
|
13
|
+
import { getFilterQuery, getQueryParamString } from '../utils';
|
|
14
|
+
import { V1Embed } from './ts-embed';
|
|
15
|
+
/**
|
|
16
|
+
* Embed a ThoughtSpot pinboard or visualization
|
|
17
|
+
* @Category Pinboards and Charts
|
|
18
|
+
*/
|
|
19
|
+
export class PinboardEmbed extends V1Embed {
|
|
20
|
+
// eslint-disable-next-line no-useless-constructor
|
|
21
|
+
constructor(domSelector, viewConfig) {
|
|
22
|
+
super(domSelector, viewConfig);
|
|
23
|
+
this.defaultHeight = 500;
|
|
24
|
+
/**
|
|
25
|
+
* Set the iframe height as per the computed height received
|
|
26
|
+
* from the ThoughtSpot app.
|
|
27
|
+
* @param data The event payload
|
|
28
|
+
*/
|
|
29
|
+
this.updateIFrameHeight = (data) => {
|
|
30
|
+
this.setIFrameHeight(Math.max(data.data, this.defaultHeight));
|
|
31
|
+
};
|
|
32
|
+
this.embedIframeCenter = (data, responder) => {
|
|
33
|
+
const obj = this.getIframeCenter();
|
|
34
|
+
responder({ type: EmbedEvent.EmbedIframeCenter, data: obj });
|
|
35
|
+
};
|
|
36
|
+
this.handleRouteChangeFullHeightPinboard = (data) => {
|
|
37
|
+
if (data.data.canvasState !== 'EMBED' &&
|
|
38
|
+
data.data.canvasState !== 'pinboard') {
|
|
39
|
+
this.setIFrameHeight(this.defaultHeight);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Construct a map of params to be passed on to the
|
|
45
|
+
* embedded pinboard or visualization.
|
|
46
|
+
*/
|
|
47
|
+
getEmbedParams() {
|
|
48
|
+
const params = this.getBaseQueryParams();
|
|
49
|
+
const { enableVizTransformations, fullHeight, preventPinboardFilterRemoval, defaultHeight, } = this.viewConfig;
|
|
50
|
+
if (fullHeight === true) {
|
|
51
|
+
params[Param.fullHeight] = true;
|
|
52
|
+
}
|
|
53
|
+
if (defaultHeight) {
|
|
54
|
+
this.defaultHeight = defaultHeight;
|
|
55
|
+
}
|
|
56
|
+
if (enableVizTransformations !== undefined) {
|
|
57
|
+
params[Param.EnableVizTransformations] = enableVizTransformations.toString();
|
|
58
|
+
}
|
|
59
|
+
if (preventPinboardFilterRemoval) {
|
|
60
|
+
params[Param.preventPinboardFilterRemoval] = true;
|
|
61
|
+
}
|
|
62
|
+
params[Param.livedBoardEmbed] = true;
|
|
63
|
+
const queryParams = getQueryParamString(params, true);
|
|
64
|
+
return queryParams;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Construct the URL of the embedded ThoughtSpot pinboard or visualization
|
|
68
|
+
* to be loaded within the iframe.
|
|
69
|
+
* @param pinboardId The GUID of the pinboard.
|
|
70
|
+
* @param vizId The optional GUID of a visualization within the pinboard.
|
|
71
|
+
* @param runtimeFilters A list of runtime filters to be applied to
|
|
72
|
+
* the pinboard or visualization on load.
|
|
73
|
+
*/
|
|
74
|
+
getIFrameSrc(pinboardId, vizId, runtimeFilters) {
|
|
75
|
+
const filterQuery = getFilterQuery(runtimeFilters || []);
|
|
76
|
+
const queryParams = this.getEmbedParams();
|
|
77
|
+
const queryString = [filterQuery, queryParams]
|
|
78
|
+
.filter(Boolean)
|
|
79
|
+
.join('&');
|
|
80
|
+
let url = `${this.getV1EmbedBasePath(queryString, true, false, false)}/viz/${pinboardId}`;
|
|
81
|
+
if (vizId) {
|
|
82
|
+
url = `${url}/${vizId}`;
|
|
83
|
+
}
|
|
84
|
+
return url;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Render an embedded ThoughtSpot pinboard or visualization
|
|
88
|
+
* @param renderOptions An object specifying the pinboard ID,
|
|
89
|
+
* visualization ID and the runtime filters.
|
|
90
|
+
*/
|
|
91
|
+
render() {
|
|
92
|
+
const { pinboardId, vizId, runtimeFilters } = this.viewConfig;
|
|
93
|
+
if (!pinboardId && !vizId) {
|
|
94
|
+
this.handleError(ERROR_MESSAGE.PINBOARD_VIZ_ID_VALIDATION);
|
|
95
|
+
}
|
|
96
|
+
if (this.viewConfig.fullHeight === true) {
|
|
97
|
+
this.on(EmbedEvent.RouteChange, this.handleRouteChangeFullHeightPinboard);
|
|
98
|
+
this.on(EmbedEvent.EmbedHeight, this.updateIFrameHeight);
|
|
99
|
+
this.on(EmbedEvent.EmbedIframeCenter, this.embedIframeCenter);
|
|
100
|
+
}
|
|
101
|
+
super.render();
|
|
102
|
+
const src = this.getIFrameSrc(pinboardId, vizId, runtimeFilters);
|
|
103
|
+
this.renderV1Embed(src);
|
|
104
|
+
return this;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=pinboard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pinboard.js","sourceRoot":"","sources":["../../../src/embed/pinboard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EACH,UAAU,EAEV,KAAK,GAIR,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAc,MAAM,YAAY,CAAC;AAuCjD;;;GAGG;AACH,MAAM,OAAO,aAAc,SAAQ,OAAO;IAKtC,kDAAkD;IAClD,YAAY,WAAwB,EAAE,UAA8B;QAChE,KAAK,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;QAJ3B,kBAAa,GAAG,GAAG,CAAC;QAuE5B;;;;WAIG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AE,IAAI,CAAC,iBAAiB,CAAC,CAAC;SACjE;QAED,KAAK,CAAC,MAAM,EAAE,CAAC;QAEf,MAAM,GAAG,GAAG,IAAI,CAAC,YAAY,CAAC,UAAU,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC;QACjE,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;QAExB,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ"}
|
package/lib/src/embed/search.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.js","sourceRoot":"","sources":["../../../src/embed/search.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,oBAAoB,EAAe,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAC5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAc,OAAO,EAAE,MAAM,YAAY,CAAC;AAoEjD,MAAM,CAAC,MAAM,uCAAuC,GAAG;IACnD,MAAM,CAAC,SAAS;IAChB,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"search.js","sourceRoot":"","sources":["../../../src/embed/search.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,oBAAoB,EAAe,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAC5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAc,OAAO,EAAE,MAAM,YAAY,CAAC;AAoEjD,MAAM,CAAC,MAAM,uCAAuC,GAAG;IACnD,MAAM,CAAC,SAAS;IAChB,MAAM,CAAC,UAAU;CACpB,CAAC;AAEF;;;;GAIG;AACH,MAAM,OAAO,WAAY,SAAQ,OAAO;IAMpC,YAAY,WAAwB,EAAE,UAA4B;QAC9D,KAAK,CAAC,WAAW,CAAC,CAAC;QACnB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IACjC,CAAC;IAED;;;OAGG;IACK,iBAAiB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,WAAW,CAAC,KAAK,CAAC,kBAAkB,CAAC,GAAG,IAAI,CAAC;SAChD;QACD,IAAI,WAAW,EAAE;YACb,WAAW,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC;SACxC;QACD,IAAI,UAAU,EAAE;YACZ,WAAW,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC;SACxC;QAED,WAAW,CAAC,KAAK,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC,iBAAiB,EAAE,CAAC;QAC7D,WAAW,CAAC,KAAK,CAAC,yBAAyB,CAAC,GAAG,KAAK,CAAC;QACrD,IAAI,KAAK,GAAG,EAAE,CAAC;QACf,MAAM,iBAAiB,GAAG,mBAAmB,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;QACjE,IAAI,iBAAiB,EAAE;YACnB,KAAK,GAAG,IAAI,iBAAiB,EAAE,CAAC;SACnC;QAED,OAAO,GAAG,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,IAAI,UAAU,EAAE,CAAC;IAC3D,CAAC;IAED;;OAEG;IACI,MAAM;QACT,KAAK,CAAC,MAAM,EAAE,CAAC;QACf,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC;QAElD,MAAM,GAAG,GAAG,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;QACrD,IAAI,CAAC,YAAY,CAAC,GAAG,EAAE,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;QACpD,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ"}
|
|
@@ -19,7 +19,7 @@ describe('React Components', () => {
|
|
|
19
19
|
it('Should Render the Iframe with props', async () => {
|
|
20
20
|
const { container } = render(React.createElement(SearchEmbed, { hideDataSources: true }));
|
|
21
21
|
await waitFor(() => getIFrameEl(container));
|
|
22
|
-
expect(getIFrameSrc(container)).toBe(`http://${thoughtSpotHost}/?hostAppUrl=local-host&viewPortHeight=768&viewPortWidth=1024&sdkVersion=${version}&hideAction=[%22editACopy%22,%
|
|
22
|
+
expect(getIFrameSrc(container)).toBe(`http://${thoughtSpotHost}/?hostAppUrl=local-host&viewPortHeight=768&viewPortWidth=1024&sdkVersion=${version}&hideAction=[%22editACopy%22,%22saveAsView%22]&dataSourceMode=hide&useLastSelectedSources=false#/embed/answer`);
|
|
23
23
|
});
|
|
24
24
|
it('Should attach event listeners', async () => {
|
|
25
25
|
const userGUID = 'absfdfgd';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.spec.js","sourceRoot":"","sources":["../../../src/react/index.spec.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,2BAA2B,CAAC;AACnC,OAAO,yCAAyC,CAAC;AACjD,OAAO,EAAsB,MAAM,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAC7E,OAAO,EACH,WAAW,EACX,YAAY,EACZ,mBAAmB,GACtB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,WAAW,EAA2B,MAAM,SAAS,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C,MAAM,eAAe,GAAG,WAAW,CAAC;AAEpC,SAAS,CAAC,GAAG,EAAE;IACX,IAAI,CAAC;QACD,eAAe;QACf,QAAQ,EAAE,QAAQ,CAAC,IAAI;KAC1B,CAAC,CAAC;AACP,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAC9B,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;QACzB,EAAE,CAAC,qCAAqC,EAAE,KAAK,IAAI,EAAE;YACjD,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,CACxB,oBAAC,WAAW,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/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;GAGG;AACH,qCAAqC;AACrC,MAAM,CAAN,IAAY,
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;GAGG;AACH,qCAAqC;AACrC,MAAM,CAAN,IAAY,QAwBX;AAxBD,WAAY,QAAQ;IAChB;;OAEG;IACH,yBAAa,CAAA;IACb;;OAEG;IACH,4BAAgB,CAAA;IAChB;;OAEG;IACH,6BAAiB,CAAA;IACjB;;OAEG;IACH,qCAAyB,CAAA;IACzB;;;;;OAKG;IACH,2BAAe,CAAA;AACnB,CAAC,EAxBW,QAAQ,KAAR,QAAQ,QAwBnB;AAqHD;;GAEG;AACH,qCAAqC;AACrC,MAAM,CAAN,IAAY,eAyDX;AAzDD,WAAY,eAAe;IACvB;;OAEG;IACH,4BAAS,CAAA;IACT;;OAEG;IACH,4BAAS,CAAA;IACT;;OAEG;IACH,4BAAS,CAAA;IACT;;OAEG;IACH,4BAAS,CAAA;IACT;;OAEG;IACH,4BAAS,CAAA;IACT;;OAEG;IACH,4BAAS,CAAA;IACT;;OAEG;IACH,wCAAqB,CAAA;IACrB;;OAEG;IACH,8CAA2B,CAAA;IAC3B;;OAEG;IACH,0CAAuB,CAAA;IACvB;;OAEG;IACH,4CAAyB,CAAA;IACzB;;OAEG;IACH,4CAAyB,CAAA;IACzB;;OAEG;IACH,oCAAiB,CAAA;IACjB;;OAEG;IACH,4BAAS,CAAA;IACT;;OAEG;IACH,4BAAS,CAAA;AACb,CAAC,EAzDW,eAAe,KAAf,eAAe,QAyD1B;AAsBD;;GAEG;AACH,qCAAqC;AACrC,MAAM,CAAN,IAAY,UAgHX;AAhHD,WAAY,UAAU;IAClB;;;OAGG;IACH,2BAAa,CAAA;IACb;;;OAGG;IACH,mCAAqB,CAAA;IACrB;;;OAGG;IACH,2BAAa,CAAA;IACb;;;OAGG;IACH,2BAA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BAAmB,CAAA;IACnB,6BAAmB,CAAA;IACnB,mCAAyB,CAAA;IACzB,uBAAa,CAAA;IACb,iCAAuB,CAAA;IACvB,2BAAiB,CAAA;IACjB,6BAAmB,CAAA;IACnB,+BAAqB,CAAA;IACrB,2BAAiB,CAAA;IACjB,mDAAyC,CAAA;IACzC;;OAEG;IACH,uCAA6B,CAAA;IAC7B,wCAA8B,CAAA;IAC9B,6CAAmC,CAAA;IACnC;;OAEG;IACH,uCAA6B,CAAA;IAC7B,2DAAiD,CAAA;IACjD,qBAAW,CAAA;IACX,uCAA6B,CAAA;IAC7B,uCAA6B,CAAA;IAC7B,6BAAmB,CAAA;IACnB,oDAA0C,CAAA;IAC1C,oDAA0C,CAAA;IAC1C,iEAAuD,CAAA;IACvD,yDAA+C,CAAA;IAC/C,8CAAoC,CAAA;IACpC,wDAA8C,CAAA;IAC9C,mDAAyC,CAAA;IACzC,6BAAmB,CAAA;IACnB,yCAA+B,CAAA;IAC/B,qDAA2C,CAAA;AAC/C,CAAC,EAjEW,MAAM,KAAN,MAAM,QAiEjB;AAQD,qCAAqC;AACrC,MAAM,CAAN,IAAY,aAGX;AAHD,WAAY,aAAa;IACrB,sDAAqC,CAAA;IACrC,sEAAqD,CAAA;AACzD,CAAC,EAHW,aAAa,KAAb,aAAa,QAGxB"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { OperationType } from '../types';
|
|
2
|
+
function FetchAnswers(session, query, operation, thoughtSpotHost) {
|
|
3
|
+
let variable;
|
|
4
|
+
const fetchQuery = async (variables) => {
|
|
5
|
+
try {
|
|
6
|
+
const response = await fetch(`${thoughtSpotHost}/prism/?op=${operation}`, {
|
|
7
|
+
method: 'POST',
|
|
8
|
+
headers: {
|
|
9
|
+
'content-type': 'application/json;charset=UTF-8',
|
|
10
|
+
'x-requested-by': 'ThoughtSpot',
|
|
11
|
+
accept: '*/*',
|
|
12
|
+
'accept-language': 'en-us',
|
|
13
|
+
},
|
|
14
|
+
body: JSON.stringify({
|
|
15
|
+
operationName: operation,
|
|
16
|
+
query,
|
|
17
|
+
variables,
|
|
18
|
+
}),
|
|
19
|
+
credentials: 'include'
|
|
20
|
+
});
|
|
21
|
+
const result = await response.json();
|
|
22
|
+
return result.data;
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
return error;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
const getAnswer = (offset, batchSize) => {
|
|
29
|
+
if (operation === OperationType.GetChartWithData) {
|
|
30
|
+
variable = { batchSize, offset };
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
variable = {
|
|
34
|
+
dataPaginationParams: {
|
|
35
|
+
isClientPaginated: true,
|
|
36
|
+
offset,
|
|
37
|
+
size: batchSize,
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
return fetchQuery({
|
|
42
|
+
session,
|
|
43
|
+
...variable,
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
return getAnswer;
|
|
47
|
+
}
|
|
48
|
+
export default FetchAnswers;
|
|
49
|
+
//# sourceMappingURL=fetchAnswers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetchAnswers.js","sourceRoot":"","sources":["../../../src/utils/fetchAnswers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,aAAa,EAAE,MAAM,UAAU,CAAC;AAE3D,SAAS,YAAY,CACjB,OAAyB,EACzB,KAAa,EACb,SAAiB,EACjB,eAAuB;IAEvB,IAAI,QAAa,CAAC;IAElB,MAAM,UAAU,GAAG,KAAK,EAAE,SAAc,EAAE,EAAE;QACxC,IAAI;YACA,MAAM,QAAQ,GAAG,MAAM,KAAK,CACxB,GAAG,eAAe,cAAc,SAAS,EAAE,EAC3C;gBACI,MAAM,EAAE,MAAM;gBACd,OAAO,EAAE;oBACL,cAAc,EAAE,gCAAgC;oBAChD,gBAAgB,EAAE,aAAa;oBAC/B,MAAM,EAAE,KAAK;oBACb,iBAAiB,EAAE,OAAO;iBAC7B;gBACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;oBACjB,aAAa,EAAE,SAAS;oBACxB,KAAK;oBACL,SAAS;iBACZ,CAAC;gBACF,WAAW,EAAE,SAAS;aACzB,CACA,CAAC;YACF,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;YACrC,OAAO,MAAM,CAAC,IAAI,CAAC;SACtB;QAAC,OAAO,KAAK,EAAE;YACZ,OAAO,KAAK,CAAC;SAChB;IACL,CAAC,CAAC;IAEF,MAAM,SAAS,GAAG,CAAC,MAAc,EAAE,SAAiB,EAAE,EAAE;QACpD,IAAI,SAAS,KAAK,aAAa,CAAC,gBAAgB,EAAE;YAC9C,QAAQ,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC;SACpC;aAAM;YACH,QAAQ,GAAG;gBACP,oBAAoB,EAAE;oBAClB,iBAAiB,EAAE,IAAI;oBACvB,MAAM;oBACN,IAAI,EAAE,SAAS;iBAClB;aACJ,CAAC;SACL;QACD,OAAO,UAAU,CAAC;YACd,OAAO;YACP,GAAG,QAAQ;SACd,CAAC,CAAC;IACP,CAAC,CAAC;IAEF,OAAO,SAAS,CAAC;AACrB,CAAC;AAED,eAAe,YAAY,CAAC"}
|
package/package.json
CHANGED
package/src/auth.spec.ts
CHANGED
|
@@ -74,8 +74,8 @@ describe('Unit test for auth', () => {
|
|
|
74
74
|
global.fetch = window.fetch;
|
|
75
75
|
});
|
|
76
76
|
|
|
77
|
-
test('endpoints,
|
|
78
|
-
const ssoTemplateUrl = authInstance.EndPoints.
|
|
77
|
+
test('endpoints, SAML_LOGIN_TEMPLATE', () => {
|
|
78
|
+
const ssoTemplateUrl = authInstance.EndPoints.SAML_LOGIN_TEMPLATE(
|
|
79
79
|
thoughtSpotHost,
|
|
80
80
|
);
|
|
81
81
|
expect(ssoTemplateUrl).toBe(
|
package/src/auth.ts
CHANGED
|
@@ -23,8 +23,10 @@ export const SSO_REDIRECTION_MARKER_GUID =
|
|
|
23
23
|
|
|
24
24
|
export const EndPoints = {
|
|
25
25
|
AUTH_VERIFICATION: '/callosum/v1/session/info',
|
|
26
|
-
|
|
26
|
+
SAML_LOGIN_TEMPLATE: (targetUrl: string) =>
|
|
27
27
|
`/callosum/v1/saml/login?targetURLPath=${targetUrl}`,
|
|
28
|
+
OIDC_LOGIN_TEMPLATE: (targetUrl: string) =>
|
|
29
|
+
`/callosum/v1/oidc/login?targetURLPath=${targetUrl}`,
|
|
28
30
|
TOKEN_LOGIN: '/callosum/v1/session/login/token',
|
|
29
31
|
BASIC_LOGIN: '/callosum/v1/session/login',
|
|
30
32
|
};
|
|
@@ -171,7 +173,10 @@ async function samlPopupFlow(ssoURL: string) {
|
|
|
171
173
|
* Perform SAML authentication
|
|
172
174
|
* @param embedConfig The embed configuration
|
|
173
175
|
*/
|
|
174
|
-
|
|
176
|
+
const doSSOAuth = async (
|
|
177
|
+
embedConfig: EmbedConfig,
|
|
178
|
+
ssoEndPoint: string,
|
|
179
|
+
): Promise<void> => {
|
|
175
180
|
const { thoughtSpotHost } = embedConfig;
|
|
176
181
|
const loggedIn = await isLoggedIn(thoughtSpotHost);
|
|
177
182
|
if (loggedIn) {
|
|
@@ -190,6 +195,17 @@ export const doSamlAuth = async (embedConfig: EmbedConfig): Promise<void> => {
|
|
|
190
195
|
return;
|
|
191
196
|
}
|
|
192
197
|
|
|
198
|
+
const ssoURL = `${thoughtSpotHost}${ssoEndPoint}`;
|
|
199
|
+
if (embedConfig.noRedirect) {
|
|
200
|
+
await samlPopupFlow(ssoURL);
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
window.location.href = ssoURL;
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
export const doSamlAuth = async (embedConfig: EmbedConfig) => {
|
|
208
|
+
const { thoughtSpotHost } = embedConfig;
|
|
193
209
|
// redirect for SSO, when the SSO authentication is done, this page will be loaded
|
|
194
210
|
// again and the same JS will execute again.
|
|
195
211
|
const ssoRedirectUrl = embedConfig.noRedirect
|
|
@@ -197,17 +213,27 @@ export const doSamlAuth = async (embedConfig: EmbedConfig): Promise<void> => {
|
|
|
197
213
|
: appendToUrlHash(window.location.href, SSO_REDIRECTION_MARKER_GUID);
|
|
198
214
|
|
|
199
215
|
// bring back the page to the same URL
|
|
200
|
-
const ssoEndPoint = `${EndPoints.
|
|
216
|
+
const ssoEndPoint = `${EndPoints.SAML_LOGIN_TEMPLATE(
|
|
201
217
|
encodeURIComponent(ssoRedirectUrl),
|
|
202
218
|
)}`;
|
|
203
219
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
await samlPopupFlow(ssoURL);
|
|
207
|
-
return;
|
|
208
|
-
}
|
|
220
|
+
await doSSOAuth(embedConfig, ssoEndPoint);
|
|
221
|
+
};
|
|
209
222
|
|
|
210
|
-
|
|
223
|
+
export const doOIDCAuth = async (embedConfig: EmbedConfig) => {
|
|
224
|
+
const { thoughtSpotHost } = embedConfig;
|
|
225
|
+
// redirect for SSO, when the SSO authentication is done, this page will be loaded
|
|
226
|
+
// again and the same JS will execute again.
|
|
227
|
+
const ssoRedirectUrl = embedConfig.noRedirect
|
|
228
|
+
? `${thoughtSpotHost}/v2/#/embed/saml-complete`
|
|
229
|
+
: appendToUrlHash(window.location.href, SSO_REDIRECTION_MARKER_GUID);
|
|
230
|
+
|
|
231
|
+
// bring back the page to the same URL
|
|
232
|
+
const ssoEndPoint = `${EndPoints.OIDC_LOGIN_TEMPLATE(
|
|
233
|
+
encodeURIComponent(ssoRedirectUrl),
|
|
234
|
+
)}`;
|
|
235
|
+
|
|
236
|
+
await doSSOAuth(embedConfig, ssoEndPoint);
|
|
211
237
|
};
|
|
212
238
|
|
|
213
239
|
/**
|
|
@@ -219,6 +245,8 @@ export const authenticate = async (embedConfig: EmbedConfig): Promise<void> => {
|
|
|
219
245
|
switch (authType) {
|
|
220
246
|
case AuthType.SSO:
|
|
221
247
|
return doSamlAuth(embedConfig);
|
|
248
|
+
case AuthType.OIDC:
|
|
249
|
+
return doOIDCAuth(embedConfig);
|
|
222
250
|
case AuthType.AuthServer:
|
|
223
251
|
return doTokenAuth(embedConfig);
|
|
224
252
|
case AuthType.Basic:
|
package/src/embed/search.ts
CHANGED
package/src/react/index.spec.tsx
CHANGED
|
@@ -31,7 +31,7 @@ describe('React Components', () => {
|
|
|
31
31
|
await waitFor(() => getIFrameEl(container));
|
|
32
32
|
|
|
33
33
|
expect(getIFrameSrc(container)).toBe(
|
|
34
|
-
`http://${thoughtSpotHost}/?hostAppUrl=local-host&viewPortHeight=768&viewPortWidth=1024&sdkVersion=${version}&hideAction=[%22editACopy%22,%
|
|
34
|
+
`http://${thoughtSpotHost}/?hostAppUrl=local-host&viewPortHeight=768&viewPortWidth=1024&sdkVersion=${version}&hideAction=[%22editACopy%22,%22saveAsView%22]&dataSourceMode=hide&useLastSelectedSources=false#/embed/answer`,
|
|
35
35
|
);
|
|
36
36
|
});
|
|
37
37
|
|