@thoughtspot/visual-embed-sdk 1.6.1 → 1.6.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 +2 -4
- package/dist/src/types.d.ts +4 -0
- package/dist/tsembed.es.js +30 -8
- package/dist/tsembed.js +30 -8
- package/lib/package.json +1 -1
- package/lib/src/auth.d.ts +2 -4
- package/lib/src/auth.js +25 -7
- package/lib/src/auth.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/visual-embed-sdk.d.ts +4 -0
- package/package.json +1 -1
- package/src/auth.ts +35 -7
- package/src/types.ts +4 -0
- package/dist/src/embed/pinboard.d.ts +0 -91
- package/dist/src/v1/api.d.ts +0 -19
- package/lib/src/embed/pinboard.d.ts +0 -91
- package/lib/src/embed/pinboard.js +0 -110
- package/lib/src/embed/pinboard.js.map +0 -1
package/dist/src/auth.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export declare const SSO_REDIRECTION_MARKER_GUID = "5e16222e-ef02-43e9-9fbd-2422
|
|
|
7
7
|
export declare const EndPoints: {
|
|
8
8
|
AUTH_VERIFICATION: string;
|
|
9
9
|
SSO_LOGIN_TEMPLATE: (targetUrl: string) => string;
|
|
10
|
+
IODC_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 doIODCAuth: (embedConfig: EmbedConfig) => Promise<void>;
|
|
37
35
|
/**
|
|
38
36
|
* Perform authentication on the ThoughtSpot cluster
|
|
39
37
|
* @param embedConfig The embed configuration
|
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 IODC
|
|
138
|
+
*/
|
|
139
|
+
AuthType["IODC"] = "SSO_IODC";
|
|
136
140
|
/**
|
|
137
141
|
* Trusted authentication server
|
|
138
142
|
*/
|
|
@@ -8498,6 +8502,7 @@ const SSO_REDIRECTION_MARKER_GUID = '5e16222e-ef02-43e9-9fbd-24226bf3ce5b';
|
|
|
8498
8502
|
const EndPoints = {
|
|
8499
8503
|
AUTH_VERIFICATION: '/callosum/v1/session/info',
|
|
8500
8504
|
SSO_LOGIN_TEMPLATE: (targetUrl) => `/callosum/v1/saml/login?targetURLPath=${targetUrl}`,
|
|
8505
|
+
IODC_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,6 +8627,15 @@ const doSamlAuth = async (embedConfig) => {
|
|
|
8622
8627
|
loggedInStatus = false;
|
|
8623
8628
|
return;
|
|
8624
8629
|
}
|
|
8630
|
+
const ssoURL = `${thoughtSpotHost}${ssoEndPoint}`;
|
|
8631
|
+
if (embedConfig.noRedirect) {
|
|
8632
|
+
await samlPopupFlow(ssoURL);
|
|
8633
|
+
return;
|
|
8634
|
+
}
|
|
8635
|
+
window.location.href = ssoURL;
|
|
8636
|
+
};
|
|
8637
|
+
const doSamlAuth = async (embedConfig) => {
|
|
8638
|
+
const { thoughtSpotHost } = embedConfig;
|
|
8625
8639
|
// redirect for SSO, when the SSO authentication is done, this page will be loaded
|
|
8626
8640
|
// again and the same JS will execute again.
|
|
8627
8641
|
const ssoRedirectUrl = embedConfig.noRedirect
|
|
@@ -8629,12 +8643,18 @@ const doSamlAuth = async (embedConfig) => {
|
|
|
8629
8643
|
: appendToUrlHash(window.location.href, SSO_REDIRECTION_MARKER_GUID);
|
|
8630
8644
|
// bring back the page to the same URL
|
|
8631
8645
|
const ssoEndPoint = `${EndPoints.SSO_LOGIN_TEMPLATE(encodeURIComponent(ssoRedirectUrl))}`;
|
|
8632
|
-
|
|
8633
|
-
|
|
8634
|
-
|
|
8635
|
-
|
|
8636
|
-
|
|
8637
|
-
|
|
8646
|
+
await doSSOAuth(embedConfig, ssoEndPoint);
|
|
8647
|
+
};
|
|
8648
|
+
const doIODCAuth = 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.IODC_LOGIN_TEMPLATE(encodeURIComponent(ssoRedirectUrl))}`;
|
|
8657
|
+
await doSSOAuth(embedConfig, ssoEndPoint);
|
|
8638
8658
|
};
|
|
8639
8659
|
/**
|
|
8640
8660
|
* Perform authentication on the ThoughtSpot cluster
|
|
@@ -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.IODC:
|
|
8669
|
+
return doIODCAuth(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.6.
|
|
8865
|
+
var name="@thoughtspot/visual-embed-sdk";var version="1.6.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",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};
|
|
8844
8866
|
|
|
8845
8867
|
/**
|
|
8846
8868
|
* Copyright (c) 2021
|
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 IODC
|
|
138
|
+
*/
|
|
139
|
+
AuthType["IODC"] = "SSO_IODC";
|
|
136
140
|
/**
|
|
137
141
|
* Trusted authentication server
|
|
138
142
|
*/
|
|
@@ -8470,6 +8474,7 @@
|
|
|
8470
8474
|
const EndPoints = {
|
|
8471
8475
|
AUTH_VERIFICATION: '/callosum/v1/session/info',
|
|
8472
8476
|
SSO_LOGIN_TEMPLATE: (targetUrl) => `/callosum/v1/saml/login?targetURLPath=${targetUrl}`,
|
|
8477
|
+
IODC_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,6 +8599,15 @@
|
|
|
8594
8599
|
loggedInStatus = false;
|
|
8595
8600
|
return;
|
|
8596
8601
|
}
|
|
8602
|
+
const ssoURL = `${thoughtSpotHost}${ssoEndPoint}`;
|
|
8603
|
+
if (embedConfig.noRedirect) {
|
|
8604
|
+
await samlPopupFlow(ssoURL);
|
|
8605
|
+
return;
|
|
8606
|
+
}
|
|
8607
|
+
window.location.href = ssoURL;
|
|
8608
|
+
};
|
|
8609
|
+
const doSamlAuth = async (embedConfig) => {
|
|
8610
|
+
const { thoughtSpotHost } = embedConfig;
|
|
8597
8611
|
// redirect for SSO, when the SSO authentication is done, this page will be loaded
|
|
8598
8612
|
// again and the same JS will execute again.
|
|
8599
8613
|
const ssoRedirectUrl = embedConfig.noRedirect
|
|
@@ -8601,12 +8615,18 @@
|
|
|
8601
8615
|
: appendToUrlHash(window.location.href, SSO_REDIRECTION_MARKER_GUID);
|
|
8602
8616
|
// bring back the page to the same URL
|
|
8603
8617
|
const ssoEndPoint = `${EndPoints.SSO_LOGIN_TEMPLATE(encodeURIComponent(ssoRedirectUrl))}`;
|
|
8604
|
-
|
|
8605
|
-
|
|
8606
|
-
|
|
8607
|
-
|
|
8608
|
-
|
|
8609
|
-
|
|
8618
|
+
await doSSOAuth(embedConfig, ssoEndPoint);
|
|
8619
|
+
};
|
|
8620
|
+
const doIODCAuth = 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.IODC_LOGIN_TEMPLATE(encodeURIComponent(ssoRedirectUrl))}`;
|
|
8629
|
+
await doSSOAuth(embedConfig, ssoEndPoint);
|
|
8610
8630
|
};
|
|
8611
8631
|
/**
|
|
8612
8632
|
* Perform authentication on the ThoughtSpot cluster
|
|
@@ -8617,6 +8637,8 @@
|
|
|
8617
8637
|
switch (authType) {
|
|
8618
8638
|
case exports.AuthType.SSO:
|
|
8619
8639
|
return doSamlAuth(embedConfig);
|
|
8640
|
+
case exports.AuthType.IODC:
|
|
8641
|
+
return doIODCAuth(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.6.
|
|
8837
|
+
var name="@thoughtspot/visual-embed-sdk";var version="1.6.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",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};
|
|
8816
8838
|
|
|
8817
8839
|
/**
|
|
8818
8840
|
* Copyright (c) 2021
|
package/lib/package.json
CHANGED
package/lib/src/auth.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export declare const SSO_REDIRECTION_MARKER_GUID = "5e16222e-ef02-43e9-9fbd-2422
|
|
|
7
7
|
export declare const EndPoints: {
|
|
8
8
|
AUTH_VERIFICATION: string;
|
|
9
9
|
SSO_LOGIN_TEMPLATE: (targetUrl: string) => string;
|
|
10
|
+
IODC_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 doIODCAuth: (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
|
@@ -15,6 +15,7 @@ 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
|
SSO_LOGIN_TEMPLATE: (targetUrl) => `/callosum/v1/saml/login?targetURLPath=${targetUrl}`,
|
|
18
|
+
IODC_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,6 +146,15 @@ export const doSamlAuth = async (embedConfig) => {
|
|
|
145
146
|
loggedInStatus = false;
|
|
146
147
|
return;
|
|
147
148
|
}
|
|
149
|
+
const ssoURL = `${thoughtSpotHost}${ssoEndPoint}`;
|
|
150
|
+
if (embedConfig.noRedirect) {
|
|
151
|
+
await samlPopupFlow(ssoURL);
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
window.location.href = ssoURL;
|
|
155
|
+
};
|
|
156
|
+
export const doSamlAuth = async (embedConfig) => {
|
|
157
|
+
const { thoughtSpotHost } = embedConfig;
|
|
148
158
|
// redirect for SSO, when the SSO authentication is done, this page will be loaded
|
|
149
159
|
// again and the same JS will execute again.
|
|
150
160
|
const ssoRedirectUrl = embedConfig.noRedirect
|
|
@@ -152,12 +162,18 @@ export const doSamlAuth = async (embedConfig) => {
|
|
|
152
162
|
: appendToUrlHash(window.location.href, SSO_REDIRECTION_MARKER_GUID);
|
|
153
163
|
// bring back the page to the same URL
|
|
154
164
|
const ssoEndPoint = `${EndPoints.SSO_LOGIN_TEMPLATE(encodeURIComponent(ssoRedirectUrl))}`;
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
165
|
+
await doSSOAuth(embedConfig, ssoEndPoint);
|
|
166
|
+
};
|
|
167
|
+
export const doIODCAuth = 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.IODC_LOGIN_TEMPLATE(encodeURIComponent(ssoRedirectUrl))}`;
|
|
176
|
+
await doSSOAuth(embedConfig, ssoEndPoint);
|
|
161
177
|
};
|
|
162
178
|
/**
|
|
163
179
|
* Perform authentication on the ThoughtSpot cluster
|
|
@@ -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.IODC:
|
|
188
|
+
return doIODCAuth(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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OAAO,UAAU,CAAC,WAAW,CAAC,CAAC;QACnC,KAAK,QAAQ,CAAC,UAAU;YACpB,OAAO,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/types.d.ts
CHANGED
package/lib/src/types.js
CHANGED
package/lib/src/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/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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AAA;AACzD,CAAC,EAHW,aAAa,KAAb,aAAa,QAGxB"}
|
package/package.json
CHANGED
package/src/auth.ts
CHANGED
|
@@ -25,6 +25,8 @@ export const EndPoints = {
|
|
|
25
25
|
AUTH_VERIFICATION: '/callosum/v1/session/info',
|
|
26
26
|
SSO_LOGIN_TEMPLATE: (targetUrl: string) =>
|
|
27
27
|
`/callosum/v1/saml/login?targetURLPath=${targetUrl}`,
|
|
28
|
+
IODC_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
|
|
@@ -201,13 +217,23 @@ export const doSamlAuth = async (embedConfig: EmbedConfig): Promise<void> => {
|
|
|
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 doIODCAuth = 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.IODC_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.IODC:
|
|
249
|
+
return doIODCAuth(embedConfig);
|
|
222
250
|
case AuthType.AuthServer:
|
|
223
251
|
return doTokenAuth(embedConfig);
|
|
224
252
|
case AuthType.Basic:
|
package/src/types.ts
CHANGED
|
@@ -1,91 +0,0 @@
|
|
|
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
|
-
* An array of vizids which should be visible when this pinboard loads.
|
|
50
|
-
* The ids not in this array are hidden from the pinboard.
|
|
51
|
-
* _since: 1.6.0_
|
|
52
|
-
*/
|
|
53
|
-
pinboardVisibleVizs?: string[];
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Embed a ThoughtSpot pinboard or visualization
|
|
57
|
-
* @Category Pinboards and Charts
|
|
58
|
-
*/
|
|
59
|
-
export declare class PinboardEmbed extends V1Embed {
|
|
60
|
-
protected viewConfig: PinboardViewConfig;
|
|
61
|
-
private defaultHeight;
|
|
62
|
-
constructor(domSelector: DOMSelector, viewConfig: PinboardViewConfig);
|
|
63
|
-
/**
|
|
64
|
-
* Construct a map of params to be passed on to the
|
|
65
|
-
* embedded pinboard or visualization.
|
|
66
|
-
*/
|
|
67
|
-
private getEmbedParams;
|
|
68
|
-
/**
|
|
69
|
-
* Construct the URL of the embedded ThoughtSpot pinboard or visualization
|
|
70
|
-
* to be loaded within the iframe.
|
|
71
|
-
* @param pinboardId The GUID of the pinboard.
|
|
72
|
-
* @param vizId The optional GUID of a visualization within the pinboard.
|
|
73
|
-
* @param runtimeFilters A list of runtime filters to be applied to
|
|
74
|
-
* the pinboard or visualization on load.
|
|
75
|
-
*/
|
|
76
|
-
private getIFrameSrc;
|
|
77
|
-
/**
|
|
78
|
-
* Set the iframe height as per the computed height received
|
|
79
|
-
* from the ThoughtSpot app.
|
|
80
|
-
* @param data The event payload
|
|
81
|
-
*/
|
|
82
|
-
private updateIFrameHeight;
|
|
83
|
-
private embedIframeCenter;
|
|
84
|
-
private handleRouteChangeFullHeightPinboard;
|
|
85
|
-
/**
|
|
86
|
-
* Render an embedded ThoughtSpot pinboard or visualization
|
|
87
|
-
* @param renderOptions An object specifying the pinboard ID,
|
|
88
|
-
* visualization ID and the runtime filters.
|
|
89
|
-
*/
|
|
90
|
-
render(): PinboardEmbed;
|
|
91
|
-
}
|
package/dist/src/v1/api.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright: ThoughtSpot Inc. 2012-2016
|
|
3
|
-
* Author: Shashank Singh (sunny@thoughtspot.com)
|
|
4
|
-
*
|
|
5
|
-
* @fileoverview ThoughtSpot Javascript API for use of ThoughtSpot in external webpages.
|
|
6
|
-
*/
|
|
7
|
-
import { AuthType } from '../types';
|
|
8
|
-
export declare enum Events {
|
|
9
|
-
THOUGHTSPOT_AUTH_EXPIRED = "ThoughtspotAuthExpired",
|
|
10
|
-
EXPORT_VIZ_DATA_TO_PARENT = "exportVizDataToParent",
|
|
11
|
-
ALERT = "alert",
|
|
12
|
-
EXPORT_VIZ_DATA_TO_CHILD = "exportVizDataToChild",
|
|
13
|
-
GET_DATA = "getData"
|
|
14
|
-
}
|
|
15
|
-
declare type Callback = (...args: any[]) => void;
|
|
16
|
-
declare function checkIfLoggedIn(tsHost: string, callback: Callback): void;
|
|
17
|
-
declare function initialize(onInitialized: Callback, onAuthExpiration: Callback, _thoughtspotHost: string, authType: AuthType): void;
|
|
18
|
-
declare function notifyOnAuthExpiration(): void;
|
|
19
|
-
export { initialize, checkIfLoggedIn, notifyOnAuthExpiration };
|
|
@@ -1,91 +0,0 @@
|
|
|
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
|
-
* An array of vizids which should be visible when this pinboard loads.
|
|
50
|
-
* The ids not in this array are hidden from the pinboard.
|
|
51
|
-
* _since: 1.6.0_
|
|
52
|
-
*/
|
|
53
|
-
pinboardVisibleVizs?: string[];
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Embed a ThoughtSpot pinboard or visualization
|
|
57
|
-
* @Category Pinboards and Charts
|
|
58
|
-
*/
|
|
59
|
-
export declare class PinboardEmbed extends V1Embed {
|
|
60
|
-
protected viewConfig: PinboardViewConfig;
|
|
61
|
-
private defaultHeight;
|
|
62
|
-
constructor(domSelector: DOMSelector, viewConfig: PinboardViewConfig);
|
|
63
|
-
/**
|
|
64
|
-
* Construct a map of params to be passed on to the
|
|
65
|
-
* embedded pinboard or visualization.
|
|
66
|
-
*/
|
|
67
|
-
private getEmbedParams;
|
|
68
|
-
/**
|
|
69
|
-
* Construct the URL of the embedded ThoughtSpot pinboard or visualization
|
|
70
|
-
* to be loaded within the iframe.
|
|
71
|
-
* @param pinboardId The GUID of the pinboard.
|
|
72
|
-
* @param vizId The optional GUID of a visualization within the pinboard.
|
|
73
|
-
* @param runtimeFilters A list of runtime filters to be applied to
|
|
74
|
-
* the pinboard or visualization on load.
|
|
75
|
-
*/
|
|
76
|
-
private getIFrameSrc;
|
|
77
|
-
/**
|
|
78
|
-
* Set the iframe height as per the computed height received
|
|
79
|
-
* from the ThoughtSpot app.
|
|
80
|
-
* @param data The event payload
|
|
81
|
-
*/
|
|
82
|
-
private updateIFrameHeight;
|
|
83
|
-
private embedIframeCenter;
|
|
84
|
-
private handleRouteChangeFullHeightPinboard;
|
|
85
|
-
/**
|
|
86
|
-
* Render an embedded ThoughtSpot pinboard or visualization
|
|
87
|
-
* @param renderOptions An object specifying the pinboard ID,
|
|
88
|
-
* visualization ID and the runtime filters.
|
|
89
|
-
*/
|
|
90
|
-
render(): PinboardEmbed;
|
|
91
|
-
}
|
|
@@ -1,110 +0,0 @@
|
|
|
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, pinboardVisibleVizs, } = 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
|
-
if (pinboardVisibleVizs) {
|
|
63
|
-
params[Param.PinboardVisibleVizs] = pinboardVisibleVizs;
|
|
64
|
-
}
|
|
65
|
-
params[Param.livedBoardEmbed] = true;
|
|
66
|
-
const queryParams = getQueryParamString(params, true);
|
|
67
|
-
return queryParams;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Construct the URL of the embedded ThoughtSpot pinboard or visualization
|
|
71
|
-
* to be loaded within the iframe.
|
|
72
|
-
* @param pinboardId The GUID of the pinboard.
|
|
73
|
-
* @param vizId The optional GUID of a visualization within the pinboard.
|
|
74
|
-
* @param runtimeFilters A list of runtime filters to be applied to
|
|
75
|
-
* the pinboard or visualization on load.
|
|
76
|
-
*/
|
|
77
|
-
getIFrameSrc(pinboardId, vizId, runtimeFilters) {
|
|
78
|
-
const filterQuery = getFilterQuery(runtimeFilters || []);
|
|
79
|
-
const queryParams = this.getEmbedParams();
|
|
80
|
-
const queryString = [filterQuery, queryParams]
|
|
81
|
-
.filter(Boolean)
|
|
82
|
-
.join('&');
|
|
83
|
-
let url = `${this.getV1EmbedBasePath(queryString, true, false, false)}/viz/${pinboardId}`;
|
|
84
|
-
if (vizId) {
|
|
85
|
-
url = `${url}/${vizId}`;
|
|
86
|
-
}
|
|
87
|
-
return url;
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Render an embedded ThoughtSpot pinboard or visualization
|
|
91
|
-
* @param renderOptions An object specifying the pinboard ID,
|
|
92
|
-
* visualization ID and the runtime filters.
|
|
93
|
-
*/
|
|
94
|
-
render() {
|
|
95
|
-
const { pinboardId, vizId, runtimeFilters } = this.viewConfig;
|
|
96
|
-
if (!pinboardId && !vizId) {
|
|
97
|
-
this.handleError(ERROR_MESSAGE.PINBOARD_VIZ_ID_VALIDATION);
|
|
98
|
-
}
|
|
99
|
-
if (this.viewConfig.fullHeight === true) {
|
|
100
|
-
this.on(EmbedEvent.RouteChange, this.handleRouteChangeFullHeightPinboard);
|
|
101
|
-
this.on(EmbedEvent.EmbedHeight, this.updateIFrameHeight);
|
|
102
|
-
this.on(EmbedEvent.EmbedIframeCenter, this.embedIframeCenter);
|
|
103
|
-
}
|
|
104
|
-
super.render();
|
|
105
|
-
const src = this.getIFrameSrc(pinboardId, vizId, runtimeFilters);
|
|
106
|
-
this.renderV1Embed(src);
|
|
107
|
-
return this;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
//# sourceMappingURL=pinboard.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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;AA6CjD;;;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;QA2E5B;;;;WAIG;QACK,uBAAkB,GAAG,CAAC,IAAoB,EAAE,EAAE;YAClD,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC;QAClE,CAAC,CAAC;QAEM,sBAAiB,GAAG,CAAC,IA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