@thoughtspot/visual-embed-sdk 1.15.0-alpha.0 → 1.15.0-searchbar.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +3 -0
- package/dist/src/embed/search-bar.d.ts +40 -0
- package/dist/src/embed/search.d.ts +1 -2
- package/dist/tsembed.es.js +1 -1
- package/dist/tsembed.js +1 -1
- package/lib/package.json +1 -1
- package/lib/src/embed/search-bar.d.ts +40 -0
- package/lib/src/embed/search-bar.js +59 -0
- package/lib/src/embed/search-bar.js.map +1 -0
- package/lib/src/embed/search.d.ts +1 -2
- package/lib/src/visual-embed-sdk.d.ts +1 -2
- package/package.json +1 -1
- package/src/embed/search-bar.tsx +89 -0
- package/src/embed/search.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,9 @@ This project follows Semantic Versioning.
|
|
|
8
8
|
### New Features
|
|
9
9
|
- Set of new Host events to drive interactions on the embed programatically
|
|
10
10
|
|
|
11
|
+
## 1.14.1 (08-31-2022)
|
|
12
|
+
- Fixed "not logged in" message showing up on "SearchEmbed" with AuthType.None.
|
|
13
|
+
|
|
11
14
|
## 1.14.0 (08-29-2022)
|
|
12
15
|
- [AuthType.AuthServer] Now uses `POST` call to log the user in using the bearer token.
|
|
13
16
|
- `liveboardV2` flag on `LiveboardEmbed` to try out the LiveboardV2 experience.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { TsEmbed, ViewConfig } from './ts-embed';
|
|
2
|
+
import { SearchOptions } from './search';
|
|
3
|
+
export interface SearchBarViewConfig extends ViewConfig {
|
|
4
|
+
/**
|
|
5
|
+
* If set to true, hides the data sources panel.
|
|
6
|
+
*/
|
|
7
|
+
hideDataSources?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* The array of data source GUIDs to set on load.
|
|
10
|
+
*/
|
|
11
|
+
dataSources?: string[];
|
|
12
|
+
/**
|
|
13
|
+
* Configuration for search options
|
|
14
|
+
*/
|
|
15
|
+
searchOptions?: SearchOptions;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Embed ThoughtSpot search bar
|
|
19
|
+
*
|
|
20
|
+
* @Category Search Embed
|
|
21
|
+
* @version: unreleased version
|
|
22
|
+
* @hidden
|
|
23
|
+
*/
|
|
24
|
+
export declare class SearchBarEmbed extends TsEmbed {
|
|
25
|
+
/**
|
|
26
|
+
* The view configuration for the embedded ThoughtSpot search bar.
|
|
27
|
+
*/
|
|
28
|
+
protected viewConfig: SearchBarViewConfig;
|
|
29
|
+
constructor(domSelector: string, viewConfig: SearchBarViewConfig);
|
|
30
|
+
/**
|
|
31
|
+
* Construct the URL of the embedded ThoughtSpot search to be
|
|
32
|
+
* loaded in the iframe
|
|
33
|
+
* @param dataSources A list of data source GUIDs
|
|
34
|
+
*/
|
|
35
|
+
private getIFrameSrc;
|
|
36
|
+
/**
|
|
37
|
+
* Render the embedded ThoughtSpot search
|
|
38
|
+
*/
|
|
39
|
+
render(): SearchBarEmbed;
|
|
40
|
+
}
|
|
@@ -11,7 +11,7 @@ import { ViewConfig, TsEmbed } from './ts-embed';
|
|
|
11
11
|
/**
|
|
12
12
|
* Configuration for search options
|
|
13
13
|
*/
|
|
14
|
-
interface SearchOptions {
|
|
14
|
+
export interface SearchOptions {
|
|
15
15
|
/**
|
|
16
16
|
* The tml string to load the answer
|
|
17
17
|
*/
|
|
@@ -101,4 +101,3 @@ export declare class SearchEmbed extends TsEmbed {
|
|
|
101
101
|
*/
|
|
102
102
|
render(): SearchEmbed;
|
|
103
103
|
}
|
|
104
|
-
export {};
|
package/dist/tsembed.es.js
CHANGED
|
@@ -8009,7 +8009,7 @@ function processTrigger(iFrame, messageType, thoughtSpotHost, data) {
|
|
|
8009
8009
|
});
|
|
8010
8010
|
}
|
|
8011
8011
|
|
|
8012
|
-
var name="@thoughtspot/visual-embed-sdk";var version="1.15.0-
|
|
8012
|
+
var name="@thoughtspot/visual-embed-sdk";var version="1.15.0-searchbar.0";var description="ThoughtSpot Embed SDK";var module="lib/src/index.js";var main="dist/tsembed.js";var types="lib/src/index.d.ts";var files=["dist/**","lib/**","src/**"];var exports={".":"./lib/src/index.js","./react":"./lib/src/react/index.js"};var scripts={lint:"eslint 'src/**'","lint:fix":"eslint 'src/**/*.*' --fix",tsc:"tsc -p . --incremental false",start:"gatsby develop","build:gatsby":"npm run clean:gatsby && gatsby build --prefix-paths","build:gatsby:noprefix":"npm run clean:gatsby && gatsby build","serve:gatsby":"gatsby serve","clean:gatsby":"gatsby clean","build-and-publish":"npm run build:gatsby && npm run publish","bundle-dts":"dts-bundle --name @thoughtspot/visual-embed-sdk --out visual-embed-sdk.d.ts --main lib/src/index.d.ts",build:"rollup -c",watch:"rollup -cw","docs-cmd":"node scripts/gatsby-commands.js",docgen:"typedoc --tsconfig tsconfig.json --theme typedoc-theme","test-sdk":"jest -c jest.config.sdk.js","test-docs":"jest -c jest.config.docs.js",test:"npm run test-sdk && npm run test-docs && npx istanbul-merge --out ./coverage/coverage.json ./coverage/docs/coverage-final.json ./coverage/sdk/coverage-final.json && npx istanbul report --include ./coverage/coverage.json --dir ./coverage lcov",posttest:"cat ./coverage/sdk/lcov.info | coveralls",prepublishOnly:"npm run test; npm run tsc; npm run bundle-dts; npm run build","publish-dev":"npm publish --tag dev","publish-prod":"npm publish --tag latest"};var peerDependencies={react:"> 16.8.0","react-dom":"> 16.8.0"};var dependencies={algoliasearch:"^4.10.5",classnames:"^2.3.1",eventemitter3:"^4.0.7","html-react-parser":"^1.4.12","mixpanel-browser":"^2.45.0","use-deep-compare-effect":"^1.8.1"};var devDependencies={"@mdx-js/mdx":"^1.6.22","@mdx-js/react":"^1.6.22","@react-icons/all-files":"^4.1.0","@rollup/plugin-commonjs":"^18.0.0","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^11.2.1","@testing-library/dom":"^7.31.0","@testing-library/jest-dom":"^5.14.1","@testing-library/react":"^11.2.7","@testing-library/user-event":"^13.1.8","@types/jest":"^22.2.3","@types/mixpanel-browser":"^2.35.6","@types/react-test-renderer":"^17.0.1","@typescript-eslint/eslint-plugin":"^4.6.0","@typescript-eslint/parser":"^4.6.0",asciidoctor:"^2.2.1","babel-jest":"^26.6.3","babel-preset-gatsby":"^1.10.0","command-line-args":"^5.1.1",coveralls:"^3.1.0","dts-bundle":"0.7.3",eslint:"^7.12.1","eslint-config-airbnb-base":"^14.2.0","eslint-config-prettier":"^6.15.0","eslint-import-resolver-typescript":"^2.3.0","eslint-plugin-import":"^2.22.1","eslint-plugin-prettier":"^3.1.4","eslint-plugin-react-hooks":"^4.2.0","fs-extra":"^10.0.0",gatsby:"3.1.0","gatsby-plugin-algolia":"^0.22.2","gatsby-plugin-catch-links":"^3.1.0","gatsby-plugin-env-variables":"^2.1.0","gatsby-plugin-intl":"^0.3.3","gatsby-plugin-manifest":"^3.2.0","gatsby-plugin-output":"^0.1.3","gatsby-plugin-sass":"4.1.0","gatsby-plugin-sitemap":"^4.10.0","gatsby-source-filesystem":"3.1.0","gatsby-transformer-asciidoc":"2.1.0","gatsby-transformer-rehype":"2.0.0","gh-pages":"^3.1.0","highlight.js":"^10.6.0","html-to-text":"^8.0.0","identity-obj-proxy":"^3.0.0","istanbul-merge":"^1.1.1",jest:"^26.6.3","jest-puppeteer":"^4.4.0",jsdom:"^17.0.0","node-sass":"^4.0.0",prettier:"2.1.2",puppeteer:"^7.0.1",react:"^16.14.0","react-dom":"^16.14.0","react-resizable":"^1.11.0","react-resize-detector":"^6.6.0","react-test-renderer":"^17.0.2","react-use-flexsearch":"^0.1.1",rollup:"2.30.0","rollup-plugin-typescript2":"0.27.3","ts-jest":"^26.5.5","ts-loader":"8.0.4",typedoc:"0.21.6","typedoc-neo-theme":"^1.1.0","typedoc-plugin-toc-group":"0.0.5",typescript:"^4.1.0","url-search-params-polyfill":"^8.1.0",util:"^0.12.4"};var author="ThoughtSpot";var email="support@thoughtspot.com";var license="ThoughtSpot Development Tools End User License Agreement";var directories={lib:"lib"};var repository={type:"git",url:"git+https://github.com/thoughtspot/visual-embed-sdk.git"};var publishConfig={registry:"https://registry.npmjs.org"};var keywords=["thoughtspot","everywhere","embed","sdk","analytics"];var bugs={url:"https://github.com/thoughtspot/visual-embed-sdk/issues"};var homepage="https://github.com/thoughtspot/visual-embed-sdk#readme";var globals={window:{}};var pkgInfo = {name:name,version:version,description:description,module:module,main:main,types:types,files:files,exports:exports,scripts:scripts,peerDependencies:peerDependencies,dependencies:dependencies,devDependencies:devDependencies,author:author,email:email,license:license,directories:directories,repository:repository,publishConfig:publishConfig,keywords:keywords,bugs:bugs,homepage:homepage,globals:globals};
|
|
8013
8013
|
|
|
8014
8014
|
/**
|
|
8015
8015
|
* Copyright (c) 2022
|
package/dist/tsembed.js
CHANGED
|
@@ -7976,7 +7976,7 @@
|
|
|
7976
7976
|
});
|
|
7977
7977
|
}
|
|
7978
7978
|
|
|
7979
|
-
var name="@thoughtspot/visual-embed-sdk";var version="1.15.0-
|
|
7979
|
+
var name="@thoughtspot/visual-embed-sdk";var version="1.15.0-searchbar.0";var description="ThoughtSpot Embed SDK";var module="lib/src/index.js";var main="dist/tsembed.js";var types="lib/src/index.d.ts";var files=["dist/**","lib/**","src/**"];var exports$1={".":"./lib/src/index.js","./react":"./lib/src/react/index.js"};var scripts={lint:"eslint 'src/**'","lint:fix":"eslint 'src/**/*.*' --fix",tsc:"tsc -p . --incremental false",start:"gatsby develop","build:gatsby":"npm run clean:gatsby && gatsby build --prefix-paths","build:gatsby:noprefix":"npm run clean:gatsby && gatsby build","serve:gatsby":"gatsby serve","clean:gatsby":"gatsby clean","build-and-publish":"npm run build:gatsby && npm run publish","bundle-dts":"dts-bundle --name @thoughtspot/visual-embed-sdk --out visual-embed-sdk.d.ts --main lib/src/index.d.ts",build:"rollup -c",watch:"rollup -cw","docs-cmd":"node scripts/gatsby-commands.js",docgen:"typedoc --tsconfig tsconfig.json --theme typedoc-theme","test-sdk":"jest -c jest.config.sdk.js","test-docs":"jest -c jest.config.docs.js",test:"npm run test-sdk && npm run test-docs && npx istanbul-merge --out ./coverage/coverage.json ./coverage/docs/coverage-final.json ./coverage/sdk/coverage-final.json && npx istanbul report --include ./coverage/coverage.json --dir ./coverage lcov",posttest:"cat ./coverage/sdk/lcov.info | coveralls",prepublishOnly:"npm run test; npm run tsc; npm run bundle-dts; npm run build","publish-dev":"npm publish --tag dev","publish-prod":"npm publish --tag latest"};var peerDependencies={react:"> 16.8.0","react-dom":"> 16.8.0"};var dependencies={algoliasearch:"^4.10.5",classnames:"^2.3.1",eventemitter3:"^4.0.7","html-react-parser":"^1.4.12","mixpanel-browser":"^2.45.0","use-deep-compare-effect":"^1.8.1"};var devDependencies={"@mdx-js/mdx":"^1.6.22","@mdx-js/react":"^1.6.22","@react-icons/all-files":"^4.1.0","@rollup/plugin-commonjs":"^18.0.0","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^11.2.1","@testing-library/dom":"^7.31.0","@testing-library/jest-dom":"^5.14.1","@testing-library/react":"^11.2.7","@testing-library/user-event":"^13.1.8","@types/jest":"^22.2.3","@types/mixpanel-browser":"^2.35.6","@types/react-test-renderer":"^17.0.1","@typescript-eslint/eslint-plugin":"^4.6.0","@typescript-eslint/parser":"^4.6.0",asciidoctor:"^2.2.1","babel-jest":"^26.6.3","babel-preset-gatsby":"^1.10.0","command-line-args":"^5.1.1",coveralls:"^3.1.0","dts-bundle":"0.7.3",eslint:"^7.12.1","eslint-config-airbnb-base":"^14.2.0","eslint-config-prettier":"^6.15.0","eslint-import-resolver-typescript":"^2.3.0","eslint-plugin-import":"^2.22.1","eslint-plugin-prettier":"^3.1.4","eslint-plugin-react-hooks":"^4.2.0","fs-extra":"^10.0.0",gatsby:"3.1.0","gatsby-plugin-algolia":"^0.22.2","gatsby-plugin-catch-links":"^3.1.0","gatsby-plugin-env-variables":"^2.1.0","gatsby-plugin-intl":"^0.3.3","gatsby-plugin-manifest":"^3.2.0","gatsby-plugin-output":"^0.1.3","gatsby-plugin-sass":"4.1.0","gatsby-plugin-sitemap":"^4.10.0","gatsby-source-filesystem":"3.1.0","gatsby-transformer-asciidoc":"2.1.0","gatsby-transformer-rehype":"2.0.0","gh-pages":"^3.1.0","highlight.js":"^10.6.0","html-to-text":"^8.0.0","identity-obj-proxy":"^3.0.0","istanbul-merge":"^1.1.1",jest:"^26.6.3","jest-puppeteer":"^4.4.0",jsdom:"^17.0.0","node-sass":"^4.0.0",prettier:"2.1.2",puppeteer:"^7.0.1",react:"^16.14.0","react-dom":"^16.14.0","react-resizable":"^1.11.0","react-resize-detector":"^6.6.0","react-test-renderer":"^17.0.2","react-use-flexsearch":"^0.1.1",rollup:"2.30.0","rollup-plugin-typescript2":"0.27.3","ts-jest":"^26.5.5","ts-loader":"8.0.4",typedoc:"0.21.6","typedoc-neo-theme":"^1.1.0","typedoc-plugin-toc-group":"0.0.5",typescript:"^4.1.0","url-search-params-polyfill":"^8.1.0",util:"^0.12.4"};var author="ThoughtSpot";var email="support@thoughtspot.com";var license="ThoughtSpot Development Tools End User License Agreement";var directories={lib:"lib"};var repository={type:"git",url:"git+https://github.com/thoughtspot/visual-embed-sdk.git"};var publishConfig={registry:"https://registry.npmjs.org"};var keywords=["thoughtspot","everywhere","embed","sdk","analytics"];var bugs={url:"https://github.com/thoughtspot/visual-embed-sdk/issues"};var homepage="https://github.com/thoughtspot/visual-embed-sdk#readme";var globals={window:{}};var pkgInfo = {name:name,version:version,description:description,module:module,main:main,types:types,files:files,exports:exports$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};
|
|
7980
7980
|
|
|
7981
7981
|
/**
|
|
7982
7982
|
* Copyright (c) 2022
|
package/lib/package.json
CHANGED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { TsEmbed, ViewConfig } from './ts-embed';
|
|
2
|
+
import { SearchOptions } from './search';
|
|
3
|
+
export interface SearchBarViewConfig extends ViewConfig {
|
|
4
|
+
/**
|
|
5
|
+
* If set to true, hides the data sources panel.
|
|
6
|
+
*/
|
|
7
|
+
hideDataSources?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* The array of data source GUIDs to set on load.
|
|
10
|
+
*/
|
|
11
|
+
dataSources?: string[];
|
|
12
|
+
/**
|
|
13
|
+
* Configuration for search options
|
|
14
|
+
*/
|
|
15
|
+
searchOptions?: SearchOptions;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Embed ThoughtSpot search bar
|
|
19
|
+
*
|
|
20
|
+
* @Category Search Embed
|
|
21
|
+
* @version: unreleased version
|
|
22
|
+
* @hidden
|
|
23
|
+
*/
|
|
24
|
+
export declare class SearchBarEmbed extends TsEmbed {
|
|
25
|
+
/**
|
|
26
|
+
* The view configuration for the embedded ThoughtSpot search bar.
|
|
27
|
+
*/
|
|
28
|
+
protected viewConfig: SearchBarViewConfig;
|
|
29
|
+
constructor(domSelector: string, viewConfig: SearchBarViewConfig);
|
|
30
|
+
/**
|
|
31
|
+
* Construct the URL of the embedded ThoughtSpot search to be
|
|
32
|
+
* loaded in the iframe
|
|
33
|
+
* @param dataSources A list of data source GUIDs
|
|
34
|
+
*/
|
|
35
|
+
private getIFrameSrc;
|
|
36
|
+
/**
|
|
37
|
+
* Render the embedded ThoughtSpot search
|
|
38
|
+
*/
|
|
39
|
+
render(): SearchBarEmbed;
|
|
40
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Param } from '../types';
|
|
2
|
+
import { getQueryParamString } from '../utils';
|
|
3
|
+
import { TsEmbed } from './ts-embed';
|
|
4
|
+
/**
|
|
5
|
+
* Embed ThoughtSpot search bar
|
|
6
|
+
*
|
|
7
|
+
* @Category Search Embed
|
|
8
|
+
* @version: unreleased version
|
|
9
|
+
* @hidden
|
|
10
|
+
*/
|
|
11
|
+
export class SearchBarEmbed extends TsEmbed {
|
|
12
|
+
constructor(domSelector, viewConfig) {
|
|
13
|
+
super(domSelector);
|
|
14
|
+
this.viewConfig = viewConfig;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Construct the URL of the embedded ThoughtSpot search to be
|
|
18
|
+
* loaded in the iframe
|
|
19
|
+
* @param dataSources A list of data source GUIDs
|
|
20
|
+
*/
|
|
21
|
+
getIFrameSrc(dataSources) {
|
|
22
|
+
var _a;
|
|
23
|
+
const { searchOptions } = this.viewConfig;
|
|
24
|
+
const path = 'search-bar-embed';
|
|
25
|
+
const queryParams = this.getBaseQueryParams();
|
|
26
|
+
queryParams[Param.HideActions] = [
|
|
27
|
+
...((_a = queryParams[Param.HideActions]) !== null && _a !== void 0 ? _a : []),
|
|
28
|
+
];
|
|
29
|
+
if (dataSources && dataSources.length) {
|
|
30
|
+
queryParams[Param.DataSources] = JSON.stringify(dataSources);
|
|
31
|
+
}
|
|
32
|
+
if (searchOptions === null || searchOptions === void 0 ? void 0 : searchOptions.searchTokenString) {
|
|
33
|
+
queryParams[Param.searchTokenString] = encodeURIComponent(searchOptions.searchTokenString);
|
|
34
|
+
if (searchOptions.executeSearch) {
|
|
35
|
+
queryParams[Param.executeSearch] = true;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
queryParams[Param.UseLastSelectedDataSource] = false;
|
|
39
|
+
queryParams[Param.searchEmbed] = true;
|
|
40
|
+
let query = '';
|
|
41
|
+
const queryParamsString = getQueryParamString(queryParams, true);
|
|
42
|
+
if (queryParamsString) {
|
|
43
|
+
query = `?${queryParamsString}`;
|
|
44
|
+
}
|
|
45
|
+
const tsPostHashParams = this.getThoughtSpotPostUrlParams();
|
|
46
|
+
return `${this.getEmbedBasePath(query)}/${path}${tsPostHashParams}`;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Render the embedded ThoughtSpot search
|
|
50
|
+
*/
|
|
51
|
+
render() {
|
|
52
|
+
super.render();
|
|
53
|
+
const { dataSources } = this.viewConfig;
|
|
54
|
+
const src = this.getIFrameSrc(dataSources);
|
|
55
|
+
this.renderIFrame(src, this.viewConfig.frameParams);
|
|
56
|
+
return this;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=search-bar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-bar.js","sourceRoot":"","sources":["../../../src/embed/search-bar.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,EAAU,MAAM,UAAU,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAc,MAAM,YAAY,CAAC;AAkBjD;;;;;;GAMG;AACH,MAAM,OAAO,cAAe,SAAQ,OAAO;IAMvC,YAAY,WAAmB,EAAE,UAA+B;QAC5D,KAAK,CAAC,WAAW,CAAC,CAAC;QACnB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IACjC,CAAC;IAED;;;;OAIG;IACK,YAAY,CAAC,WAAsB;;QACvC,MAAM,EAAE,aAAa,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC;QAC1C,MAAM,IAAI,GAAG,kBAAkB,CAAC;QAChC,MAAM,WAAW,GAAG,IAAI,CAAC,kBAAkB,EAAE,CAAC;QAE9C,WAAW,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG;YAC7B,GAAG,CAAC,MAAA,WAAW,CAAC,KAAK,CAAC,WAAW,CAAC,mCAAI,EAAE,CAAC;SAC5C,CAAC;QAEF,IAAI,WAAW,IAAI,WAAW,CAAC,MAAM,EAAE;YACnC,WAAW,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;SAChE;QACD,IAAI,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,iBAAiB,EAAE;YAClC,WAAW,CAAC,KAAK,CAAC,iBAAiB,CAAC,GAAG,kBAAkB,CACrD,aAAa,CAAC,iBAAiB,CAClC,CAAC;YAEF,IAAI,aAAa,CAAC,aAAa,EAAE;gBAC7B,WAAW,CAAC,KAAK,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC;aAC3C;SACJ;QAED,WAAW,CAAC,KAAK,CAAC,yBAAyB,CAAC,GAAG,KAAK,CAAC;QACrD,WAAW,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC;QACtC,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;QACD,MAAM,gBAAgB,GAAG,IAAI,CAAC,2BAA2B,EAAE,CAAC;QAE5D,OAAO,GAAG,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,IAAI,IAAI,GAAG,gBAAgB,EAAE,CAAC;IACxE,CAAC;IAED;;OAEG;IACI,MAAM;QACT,KAAK,CAAC,MAAM,EAAE,CAAC;QACf,MAAM,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC;QAExC,MAAM,GAAG,GAAG,IAAI,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC;QAC3C,IAAI,CAAC,YAAY,CAAC,GAAG,EAAE,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;QACpD,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ"}
|
|
@@ -11,7 +11,7 @@ import { ViewConfig, TsEmbed } from './ts-embed';
|
|
|
11
11
|
/**
|
|
12
12
|
* Configuration for search options
|
|
13
13
|
*/
|
|
14
|
-
interface SearchOptions {
|
|
14
|
+
export interface SearchOptions {
|
|
15
15
|
/**
|
|
16
16
|
* The tml string to load the answer
|
|
17
17
|
*/
|
|
@@ -101,4 +101,3 @@ export declare class SearchEmbed extends TsEmbed {
|
|
|
101
101
|
*/
|
|
102
102
|
render(): SearchEmbed;
|
|
103
103
|
}
|
|
104
|
-
export {};
|
|
@@ -322,7 +322,7 @@ declare module '@thoughtspot/visual-embed-sdk/embed/search' {
|
|
|
322
322
|
/**
|
|
323
323
|
* Configuration for search options
|
|
324
324
|
*/
|
|
325
|
-
interface SearchOptions {
|
|
325
|
+
export interface SearchOptions {
|
|
326
326
|
/**
|
|
327
327
|
* The tml string to load the answer
|
|
328
328
|
*/
|
|
@@ -400,7 +400,6 @@ declare module '@thoughtspot/visual-embed-sdk/embed/search' {
|
|
|
400
400
|
*/
|
|
401
401
|
render(): SearchEmbed;
|
|
402
402
|
}
|
|
403
|
-
export {};
|
|
404
403
|
}
|
|
405
404
|
|
|
406
405
|
declare module '@thoughtspot/visual-embed-sdk/auth' {
|
package/package.json
CHANGED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { DOMSelector, Param, Action } from '../types';
|
|
2
|
+
import { getQueryParamString } from '../utils';
|
|
3
|
+
import { TsEmbed, ViewConfig } from './ts-embed';
|
|
4
|
+
import { SearchOptions } from './search';
|
|
5
|
+
|
|
6
|
+
export interface SearchBarViewConfig extends ViewConfig {
|
|
7
|
+
/**
|
|
8
|
+
* If set to true, hides the data sources panel.
|
|
9
|
+
*/
|
|
10
|
+
hideDataSources?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* The array of data source GUIDs to set on load.
|
|
13
|
+
*/
|
|
14
|
+
dataSources?: string[];
|
|
15
|
+
/**
|
|
16
|
+
* Configuration for search options
|
|
17
|
+
*/
|
|
18
|
+
searchOptions?: SearchOptions;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Embed ThoughtSpot search bar
|
|
23
|
+
*
|
|
24
|
+
* @Category Search Embed
|
|
25
|
+
* @version: unreleased version
|
|
26
|
+
* @hidden
|
|
27
|
+
*/
|
|
28
|
+
export class SearchBarEmbed extends TsEmbed {
|
|
29
|
+
/**
|
|
30
|
+
* The view configuration for the embedded ThoughtSpot search bar.
|
|
31
|
+
*/
|
|
32
|
+
protected viewConfig: SearchBarViewConfig;
|
|
33
|
+
|
|
34
|
+
constructor(domSelector: string, viewConfig: SearchBarViewConfig) {
|
|
35
|
+
super(domSelector);
|
|
36
|
+
this.viewConfig = viewConfig;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Construct the URL of the embedded ThoughtSpot search to be
|
|
41
|
+
* loaded in the iframe
|
|
42
|
+
* @param dataSources A list of data source GUIDs
|
|
43
|
+
*/
|
|
44
|
+
private getIFrameSrc(dataSources?: string[]) {
|
|
45
|
+
const { searchOptions } = this.viewConfig;
|
|
46
|
+
const path = 'search-bar-embed';
|
|
47
|
+
const queryParams = this.getBaseQueryParams();
|
|
48
|
+
|
|
49
|
+
queryParams[Param.HideActions] = [
|
|
50
|
+
...(queryParams[Param.HideActions] ?? []),
|
|
51
|
+
];
|
|
52
|
+
|
|
53
|
+
if (dataSources && dataSources.length) {
|
|
54
|
+
queryParams[Param.DataSources] = JSON.stringify(dataSources);
|
|
55
|
+
}
|
|
56
|
+
if (searchOptions?.searchTokenString) {
|
|
57
|
+
queryParams[Param.searchTokenString] = encodeURIComponent(
|
|
58
|
+
searchOptions.searchTokenString,
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
if (searchOptions.executeSearch) {
|
|
62
|
+
queryParams[Param.executeSearch] = true;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
queryParams[Param.UseLastSelectedDataSource] = false;
|
|
67
|
+
queryParams[Param.searchEmbed] = true;
|
|
68
|
+
let query = '';
|
|
69
|
+
const queryParamsString = getQueryParamString(queryParams, true);
|
|
70
|
+
if (queryParamsString) {
|
|
71
|
+
query = `?${queryParamsString}`;
|
|
72
|
+
}
|
|
73
|
+
const tsPostHashParams = this.getThoughtSpotPostUrlParams();
|
|
74
|
+
|
|
75
|
+
return `${this.getEmbedBasePath(query)}/${path}${tsPostHashParams}`;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Render the embedded ThoughtSpot search
|
|
80
|
+
*/
|
|
81
|
+
public render(): SearchBarEmbed {
|
|
82
|
+
super.render();
|
|
83
|
+
const { dataSources } = this.viewConfig;
|
|
84
|
+
|
|
85
|
+
const src = this.getIFrameSrc(dataSources);
|
|
86
|
+
this.renderIFrame(src, this.viewConfig.frameParams);
|
|
87
|
+
return this;
|
|
88
|
+
}
|
|
89
|
+
}
|