@thoughtspot/visual-embed-sdk 1.21.0-react.2 → 1.21.0-sage.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/cjs/package.json +5 -5
- package/cjs/src/embed/nls.spec.d.ts +1 -0
- package/cjs/src/embed/nls.spec.d.ts.map +1 -0
- package/cjs/src/embed/nls.spec.js +1 -0
- package/cjs/src/embed/nls.spec.js.map +1 -0
- package/cjs/src/embed/sage-fullscreen.d.ts +87 -0
- package/cjs/src/embed/sage-fullscreen.d.ts.map +1 -0
- package/cjs/src/embed/sage-fullscreen.js +114 -0
- package/cjs/src/embed/sage-fullscreen.js.map +1 -0
- package/cjs/src/embed/sage.d.ts +79 -0
- package/cjs/src/embed/sage.d.ts.map +1 -0
- package/cjs/src/embed/sage.js +112 -0
- package/cjs/src/embed/sage.js.map +1 -0
- package/cjs/src/errors.d.ts +1 -0
- package/cjs/src/errors.d.ts.map +1 -1
- package/cjs/src/errors.js +1 -0
- package/cjs/src/errors.js.map +1 -1
- package/cjs/src/index.d.ts +2 -1
- package/cjs/src/index.d.ts.map +1 -1
- package/cjs/src/index.js +3 -1
- package/cjs/src/index.js.map +1 -1
- package/cjs/src/mixpanel-service.d.ts.map +1 -1
- package/cjs/src/mixpanel-service.js +6 -11
- package/cjs/src/mixpanel-service.js.map +1 -1
- package/cjs/src/react/index.d.ts +9 -5
- package/cjs/src/react/index.d.ts.map +1 -1
- package/cjs/src/react/index.js +3 -1
- package/cjs/src/react/index.js.map +1 -1
- package/cjs/src/types.d.ts +9 -1
- package/cjs/src/types.d.ts.map +1 -1
- package/cjs/src/types.js +4 -0
- package/cjs/src/types.js.map +1 -1
- package/dist/src/embed/sage-fullscreen.d.ts +87 -0
- package/dist/src/embed/sage-fullscreen.d.ts.map +1 -0
- package/dist/src/embed/sage.d.ts +79 -0
- package/dist/src/embed/sage.d.ts.map +1 -0
- package/dist/src/errors.d.ts +1 -0
- package/dist/src/errors.d.ts.map +1 -1
- package/dist/src/index.d.ts +2 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/mixpanel-service.d.ts.map +1 -1
- package/dist/src/react/index.d.ts +9 -5
- package/dist/src/react/index.d.ts.map +1 -1
- package/dist/src/types.d.ts +9 -1
- package/dist/src/types.d.ts.map +1 -1
- package/dist/tsembed-react.es.js +119 -13
- package/dist/tsembed-react.js +119 -12
- package/dist/tsembed.es.js +118 -13
- package/dist/tsembed.js +118 -12
- package/dist/visual-embed-sdk-react-full.d.ts +74 -3
- package/dist/visual-embed-sdk.d.ts +70 -2
- package/lib/package.json +5 -5
- package/lib/src/embed/nls.spec.d.ts +1 -0
- package/lib/src/embed/nls.spec.d.ts.map +1 -0
- package/lib/src/embed/nls.spec.js +1 -0
- package/lib/src/embed/nls.spec.js.map +1 -0
- package/lib/src/embed/sage-fullscreen.d.ts +87 -0
- package/lib/src/embed/sage-fullscreen.d.ts.map +1 -0
- package/lib/src/embed/sage-fullscreen.js +110 -0
- package/lib/src/embed/sage-fullscreen.js.map +1 -0
- package/lib/src/embed/sage.d.ts +79 -0
- package/lib/src/embed/sage.d.ts.map +1 -0
- package/lib/src/embed/sage.js +108 -0
- package/lib/src/embed/sage.js.map +1 -0
- package/lib/src/errors.d.ts +1 -0
- package/lib/src/errors.d.ts.map +1 -1
- package/lib/src/errors.js +1 -0
- package/lib/src/errors.js.map +1 -1
- package/lib/src/index.d.ts +2 -1
- package/lib/src/index.d.ts.map +1 -1
- package/lib/src/index.js +2 -1
- package/lib/src/index.js.map +1 -1
- package/lib/src/mixpanel-service.d.ts.map +1 -1
- package/lib/src/mixpanel-service.js +6 -11
- package/lib/src/mixpanel-service.js.map +1 -1
- package/lib/src/react/index.d.ts +9 -5
- package/lib/src/react/index.d.ts.map +1 -1
- package/lib/src/react/index.js +2 -0
- package/lib/src/react/index.js.map +1 -1
- package/lib/src/types.d.ts +9 -1
- package/lib/src/types.d.ts.map +1 -1
- package/lib/src/types.js +4 -0
- package/lib/src/types.js.map +1 -1
- package/package.json +5 -5
- package/src/embed/sage.ts +153 -0
- package/src/errors.ts +1 -0
- package/src/index.ts +2 -0
- package/src/mixpanel-service.ts +6 -10
- package/src/react/index.tsx +10 -1
- package/src/types.ts +8 -0
- package/dist/visual-embed-sdk-react.d.ts +0 -2781
package/dist/tsembed-react.es.js
CHANGED
|
@@ -1638,6 +1638,10 @@ var Param;
|
|
|
1638
1638
|
Param["HideProfleAndHelp"] = "profileAndHelpInNavBarHidden";
|
|
1639
1639
|
Param["HideApplicationSwitcher"] = "applicationSwitcherHidden";
|
|
1640
1640
|
Param["HideOrgSwitcher"] = "orgSwitcherHidden";
|
|
1641
|
+
Param["IsSageEmbed"] = "isSageEmbed";
|
|
1642
|
+
Param["HideWorksheetSelector"] = "hideWorksheetSelector";
|
|
1643
|
+
Param["DisableWorksheetChange"] = "disableWorksheetChange";
|
|
1644
|
+
Param["HideEurekaResults"] = "hideEurekaResults";
|
|
1641
1645
|
})(Param || (Param = {}));
|
|
1642
1646
|
/**
|
|
1643
1647
|
* The list of actions that can be performed on visual ThoughtSpot
|
|
@@ -1896,6 +1900,7 @@ const ERROR_MESSAGE = {
|
|
|
1896
1900
|
LIVEBOARD_VIZ_ID_VALIDATION: 'Please provide either liveboardId or pinboardId',
|
|
1897
1901
|
TRIGGER_TIMED_OUT: 'Trigger timedout in getting response',
|
|
1898
1902
|
SEARCHEMBED_BETA_WRANING_MESSAGE: 'Search Embed is in Beta in this release.',
|
|
1903
|
+
SAGE_EMBED_BETA_WARNING_MESSAGE: 'Sage Embed is in Beta in this release.',
|
|
1899
1904
|
};
|
|
1900
1905
|
|
|
1901
1906
|
/**
|
|
@@ -7988,18 +7993,13 @@ function initMixpanel(sessionInfo) {
|
|
|
7988
7993
|
// userGUID
|
|
7989
7994
|
const isPublicCluster = !!sessionInfo.isPublicUser;
|
|
7990
7995
|
const token = sessionInfo.mixpanelToken;
|
|
7991
|
-
|
|
7992
|
-
|
|
7993
|
-
|
|
7994
|
-
|
|
7995
|
-
mixpanel_cjs.identify(sessionInfo.userGUID);
|
|
7996
|
-
}
|
|
7997
|
-
isMixpanelInitialized = true;
|
|
7998
|
-
emptyQueue();
|
|
7996
|
+
if (token) {
|
|
7997
|
+
mixpanel_cjs.init(token);
|
|
7998
|
+
if (!isPublicCluster) {
|
|
7999
|
+
mixpanel_cjs.identify(sessionInfo.userGUID);
|
|
7999
8000
|
}
|
|
8000
|
-
|
|
8001
|
-
|
|
8002
|
-
console.error('Error initializing mixpanel', e);
|
|
8001
|
+
isMixpanelInitialized = true;
|
|
8002
|
+
emptyQueue();
|
|
8003
8003
|
}
|
|
8004
8004
|
}
|
|
8005
8005
|
|
|
@@ -26662,7 +26662,7 @@ function processTrigger(iFrame, messageType, thoughtSpotHost, data) {
|
|
|
26662
26662
|
});
|
|
26663
26663
|
}
|
|
26664
26664
|
|
|
26665
|
-
var name="@thoughtspot/visual-embed-sdk";var version="1.21.0-
|
|
26665
|
+
var name="@thoughtspot/visual-embed-sdk";var version="1.21.0-sage.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/**","cjs/**"];var exports={".":{"import":"./lib/src/index.js",require:"./dist/tsembed.js",types:"./lib/src/index.d.ts"},"./react":{"import":"./lib/src/react/index.js",require:"./cjs/src/react.index.js",types:"./lib/src/react/index.d.ts"}};var typesVersions={"*":{react:["./lib/src/react/index.d.ts"]}};var scripts={lint:"eslint 'src/**'","lint:fix":"eslint 'src/**/*.*' --fix",tsc:"tsc -p . --incremental false; tsc -p . --incremental false --module commonjs --outDir cjs",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 ../../dist/visual-embed-sdk --main lib/src/index.d.ts --outputAsModuleFolder=true","bundle-dts-react":"dts-bundle --name ../../../dist/visual-embed-sdk-react --main lib/src/react/index.d.ts --outputAsModuleFolder=true","bundle-dts-react-full":"dts-bundle --name ../../../dist/visual-embed-sdk-react-full --main lib/src/react/all-types-export.d.ts --outputAsModuleFolder=true",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 --runInBand","test-docs":"jest -c jest.config.docs.js",test:"npm run test-sdk && npm run test-docs",posttest:"cat ./coverage/sdk/lcov.info | coveralls",prepublishOnly:"npm run test; npm run tsc; npm run bundle-dts; npm run bundle-dts-react-full; 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",dompurify:"^2.3.4","eslint-plugin-comment-length":"^0.9.2","eslint-plugin-jsdoc":"^40.1.0",eventemitter3:"^4.0.7","gatsby-plugin-vercel":"^1.0.3","html-react-parser":"^1.4.12",lodash:"^4.17.21","mixpanel-browser":"^2.45.0","ts-deepmerge":"^6.0.2","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","@rollup/plugin-replace":"^5.0.2","@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.13.1","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":"6.7.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":"^8.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-plugin-toc-group":"thoughtspot/typedoc-plugin-toc-group",typescript:"^4.9.4","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,typesVersions:typesVersions,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};
|
|
26666
26666
|
|
|
26667
26667
|
/**
|
|
26668
26668
|
* Copyright (c) 2022
|
|
@@ -27438,6 +27438,111 @@ class SearchBarEmbed extends TsEmbed {
|
|
|
27438
27438
|
}
|
|
27439
27439
|
}
|
|
27440
27440
|
|
|
27441
|
+
/**
|
|
27442
|
+
* Copyright (c) 2022
|
|
27443
|
+
*
|
|
27444
|
+
* Embed ThoughtSpot Sage
|
|
27445
|
+
*
|
|
27446
|
+
* @summary TS Sage embed
|
|
27447
|
+
* @author Mourya Balabhadra <mourya.balabhadra@thoughtspot.com>
|
|
27448
|
+
*/
|
|
27449
|
+
const HiddenActionItemByDefaultForSageEmbed = [
|
|
27450
|
+
Action.Save,
|
|
27451
|
+
Action.Pin,
|
|
27452
|
+
];
|
|
27453
|
+
/**
|
|
27454
|
+
* Embed ThoughtSpot search
|
|
27455
|
+
*
|
|
27456
|
+
* @group Embed components
|
|
27457
|
+
*/
|
|
27458
|
+
class SageEmbed extends V1Embed {
|
|
27459
|
+
// eslint-disable-next-line no-useless-constructor
|
|
27460
|
+
constructor(domSelector, viewConfig) {
|
|
27461
|
+
super(domSelector, viewConfig);
|
|
27462
|
+
this.defaultHeight = 500;
|
|
27463
|
+
/**
|
|
27464
|
+
* Set the iframe height as per the computed height received
|
|
27465
|
+
* from the ThoughtSpot app.
|
|
27466
|
+
*
|
|
27467
|
+
* @param {MessagePayload} data The event payload
|
|
27468
|
+
*/
|
|
27469
|
+
this.updateIFrameHeight = (data) => {
|
|
27470
|
+
this.setIFrameHeight(Math.max(data.data, this.defaultHeight));
|
|
27471
|
+
};
|
|
27472
|
+
this.embedIframeCenter = (data, responder) => {
|
|
27473
|
+
const obj = this.getIframeCenter();
|
|
27474
|
+
responder({ type: EmbedEvent.EmbedIframeCenter, data: obj });
|
|
27475
|
+
};
|
|
27476
|
+
this.setIframeHeightForNonEmbedLiveboard = (data) => {
|
|
27477
|
+
if (!data.data.currentPath.startsWith('/embed/viz/')) {
|
|
27478
|
+
this.setIFrameHeight(this.defaultHeight);
|
|
27479
|
+
}
|
|
27480
|
+
};
|
|
27481
|
+
if (this.viewConfig.fullHeight === true) {
|
|
27482
|
+
this.on(EmbedEvent.RouteChange, this.setIframeHeightForNonEmbedLiveboard);
|
|
27483
|
+
this.on(EmbedEvent.EmbedHeight, this.updateIFrameHeight);
|
|
27484
|
+
this.on(EmbedEvent.EmbedIframeCenter, this.embedIframeCenter);
|
|
27485
|
+
}
|
|
27486
|
+
}
|
|
27487
|
+
/**
|
|
27488
|
+
* Constructs a map of parameters to be passed on to the
|
|
27489
|
+
* embedded Eureka or Sage search page.
|
|
27490
|
+
*
|
|
27491
|
+
* @returns {string} query string
|
|
27492
|
+
*/
|
|
27493
|
+
getEmbedParams() {
|
|
27494
|
+
var _a, _b;
|
|
27495
|
+
const { hideEurekaResults, isSageEmbed, disableWorksheetChange, hideWorksheetSelector, } = this.viewConfig;
|
|
27496
|
+
const params = {};
|
|
27497
|
+
params[Param.EmbedApp] = true;
|
|
27498
|
+
params[Param.HideActions] = [...((_a = params[Param.HideActions]) !== null && _a !== void 0 ? _a : [])];
|
|
27499
|
+
params[Param.HideActions] = [
|
|
27500
|
+
...((_b = params[Param.HideActions]) !== null && _b !== void 0 ? _b : []),
|
|
27501
|
+
...HiddenActionItemByDefaultForSageEmbed,
|
|
27502
|
+
];
|
|
27503
|
+
if (hideEurekaResults) {
|
|
27504
|
+
params[Param.HideEurekaResults] = true;
|
|
27505
|
+
}
|
|
27506
|
+
if (isSageEmbed) {
|
|
27507
|
+
params[Param.IsSageEmbed] = true;
|
|
27508
|
+
}
|
|
27509
|
+
if (disableWorksheetChange) {
|
|
27510
|
+
params[Param.DisableWorksheetChange] = true;
|
|
27511
|
+
}
|
|
27512
|
+
if (hideWorksheetSelector) {
|
|
27513
|
+
params[Param.HideWorksheetSelector] = true;
|
|
27514
|
+
}
|
|
27515
|
+
const queryParamsString = getQueryParamString(params, true);
|
|
27516
|
+
let query = '';
|
|
27517
|
+
if (queryParamsString) {
|
|
27518
|
+
query = `?${queryParamsString}`;
|
|
27519
|
+
}
|
|
27520
|
+
return query;
|
|
27521
|
+
}
|
|
27522
|
+
/**
|
|
27523
|
+
* Construct the URL of the embedded ThoughtSpot sage to be
|
|
27524
|
+
* loaded in the iframe
|
|
27525
|
+
*
|
|
27526
|
+
* @returns {string} iframe url
|
|
27527
|
+
*/
|
|
27528
|
+
getIFrameSrc() {
|
|
27529
|
+
const path = 'eureka';
|
|
27530
|
+
const tsPostHashParams = this.getThoughtSpotPostUrlParams();
|
|
27531
|
+
return `${this.getRootIframeSrc()}/embed/${path}${tsPostHashParams}`;
|
|
27532
|
+
}
|
|
27533
|
+
/**
|
|
27534
|
+
* Render the embedded ThoughtSpot Sage
|
|
27535
|
+
*
|
|
27536
|
+
* @returns {SageEmbed} Eureka/Sage embed
|
|
27537
|
+
*/
|
|
27538
|
+
render() {
|
|
27539
|
+
super.render();
|
|
27540
|
+
const src = this.getIFrameSrc();
|
|
27541
|
+
this.renderV1Embed(src);
|
|
27542
|
+
return this;
|
|
27543
|
+
}
|
|
27544
|
+
}
|
|
27545
|
+
|
|
27441
27546
|
/**
|
|
27442
27547
|
* Copyright (c) 2022
|
|
27443
27548
|
*
|
|
@@ -28022,6 +28127,7 @@ const PinboardEmbed = LiveboardEmbed$1;
|
|
|
28022
28127
|
* ```
|
|
28023
28128
|
*/
|
|
28024
28129
|
const SearchBarEmbed$1 = componentFactory(SearchBarEmbed);
|
|
28130
|
+
const SageEmbed$1 = componentFactory(SageEmbed);
|
|
28025
28131
|
/**
|
|
28026
28132
|
* Get a reference to the embed component to trigger events on the component.
|
|
28027
28133
|
*
|
|
@@ -28041,4 +28147,4 @@ const SearchBarEmbed$1 = componentFactory(SearchBarEmbed);
|
|
|
28041
28147
|
*/
|
|
28042
28148
|
const useEmbedRef = () => React.useRef(null);
|
|
28043
28149
|
|
|
28044
|
-
export { Action, AppEmbed$1 as AppEmbed, EmbedEvent, HostEvent, LiveboardEmbed$1 as LiveboardEmbed, Page, PinboardEmbed, RuntimeFilterOp, SearchBarEmbed$1 as SearchBarEmbed, SearchEmbed$1 as SearchEmbed, useEmbedRef };
|
|
28150
|
+
export { Action, AppEmbed$1 as AppEmbed, EmbedEvent, HostEvent, LiveboardEmbed$1 as LiveboardEmbed, Page, PinboardEmbed, RuntimeFilterOp, SageEmbed$1 as SageEmbed, SearchBarEmbed$1 as SearchBarEmbed, SearchEmbed$1 as SearchEmbed, useEmbedRef };
|
package/dist/tsembed-react.js
CHANGED
|
@@ -1595,6 +1595,10 @@
|
|
|
1595
1595
|
Param["HideProfleAndHelp"] = "profileAndHelpInNavBarHidden";
|
|
1596
1596
|
Param["HideApplicationSwitcher"] = "applicationSwitcherHidden";
|
|
1597
1597
|
Param["HideOrgSwitcher"] = "orgSwitcherHidden";
|
|
1598
|
+
Param["IsSageEmbed"] = "isSageEmbed";
|
|
1599
|
+
Param["HideWorksheetSelector"] = "hideWorksheetSelector";
|
|
1600
|
+
Param["DisableWorksheetChange"] = "disableWorksheetChange";
|
|
1601
|
+
Param["HideEurekaResults"] = "hideEurekaResults";
|
|
1598
1602
|
})(Param || (Param = {}));
|
|
1599
1603
|
(function (Action) {
|
|
1600
1604
|
Action["Save"] = "save";
|
|
@@ -1834,6 +1838,7 @@
|
|
|
1834
1838
|
LIVEBOARD_VIZ_ID_VALIDATION: 'Please provide either liveboardId or pinboardId',
|
|
1835
1839
|
TRIGGER_TIMED_OUT: 'Trigger timedout in getting response',
|
|
1836
1840
|
SEARCHEMBED_BETA_WRANING_MESSAGE: 'Search Embed is in Beta in this release.',
|
|
1841
|
+
SAGE_EMBED_BETA_WARNING_MESSAGE: 'Sage Embed is in Beta in this release.',
|
|
1837
1842
|
};
|
|
1838
1843
|
|
|
1839
1844
|
/**
|
|
@@ -7926,18 +7931,13 @@
|
|
|
7926
7931
|
// userGUID
|
|
7927
7932
|
const isPublicCluster = !!sessionInfo.isPublicUser;
|
|
7928
7933
|
const token = sessionInfo.mixpanelToken;
|
|
7929
|
-
|
|
7930
|
-
|
|
7931
|
-
|
|
7932
|
-
|
|
7933
|
-
mixpanel_cjs.identify(sessionInfo.userGUID);
|
|
7934
|
-
}
|
|
7935
|
-
isMixpanelInitialized = true;
|
|
7936
|
-
emptyQueue();
|
|
7934
|
+
if (token) {
|
|
7935
|
+
mixpanel_cjs.init(token);
|
|
7936
|
+
if (!isPublicCluster) {
|
|
7937
|
+
mixpanel_cjs.identify(sessionInfo.userGUID);
|
|
7937
7938
|
}
|
|
7938
|
-
|
|
7939
|
-
|
|
7940
|
-
console.error('Error initializing mixpanel', e);
|
|
7939
|
+
isMixpanelInitialized = true;
|
|
7940
|
+
emptyQueue();
|
|
7941
7941
|
}
|
|
7942
7942
|
}
|
|
7943
7943
|
|
|
@@ -26600,7 +26600,7 @@
|
|
|
26600
26600
|
});
|
|
26601
26601
|
}
|
|
26602
26602
|
|
|
26603
|
-
var name="@thoughtspot/visual-embed-sdk";var version="1.21.0-
|
|
26603
|
+
var name="@thoughtspot/visual-embed-sdk";var version="1.21.0-sage.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/**","cjs/**"];var exports$1={".":{"import":"./lib/src/index.js",require:"./dist/tsembed.js",types:"./lib/src/index.d.ts"},"./react":{"import":"./lib/src/react/index.js",require:"./cjs/src/react.index.js",types:"./lib/src/react/index.d.ts"}};var typesVersions={"*":{react:["./lib/src/react/index.d.ts"]}};var scripts={lint:"eslint 'src/**'","lint:fix":"eslint 'src/**/*.*' --fix",tsc:"tsc -p . --incremental false; tsc -p . --incremental false --module commonjs --outDir cjs",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 ../../dist/visual-embed-sdk --main lib/src/index.d.ts --outputAsModuleFolder=true","bundle-dts-react":"dts-bundle --name ../../../dist/visual-embed-sdk-react --main lib/src/react/index.d.ts --outputAsModuleFolder=true","bundle-dts-react-full":"dts-bundle --name ../../../dist/visual-embed-sdk-react-full --main lib/src/react/all-types-export.d.ts --outputAsModuleFolder=true",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 --runInBand","test-docs":"jest -c jest.config.docs.js",test:"npm run test-sdk && npm run test-docs",posttest:"cat ./coverage/sdk/lcov.info | coveralls",prepublishOnly:"npm run test; npm run tsc; npm run bundle-dts; npm run bundle-dts-react-full; 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",dompurify:"^2.3.4","eslint-plugin-comment-length":"^0.9.2","eslint-plugin-jsdoc":"^40.1.0",eventemitter3:"^4.0.7","gatsby-plugin-vercel":"^1.0.3","html-react-parser":"^1.4.12",lodash:"^4.17.21","mixpanel-browser":"^2.45.0","ts-deepmerge":"^6.0.2","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","@rollup/plugin-replace":"^5.0.2","@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.13.1","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":"6.7.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":"^8.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-plugin-toc-group":"thoughtspot/typedoc-plugin-toc-group",typescript:"^4.9.4","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,typesVersions:typesVersions,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};
|
|
26604
26604
|
|
|
26605
26605
|
/**
|
|
26606
26606
|
* Copyright (c) 2022
|
|
@@ -27376,6 +27376,111 @@
|
|
|
27376
27376
|
}
|
|
27377
27377
|
}
|
|
27378
27378
|
|
|
27379
|
+
/**
|
|
27380
|
+
* Copyright (c) 2022
|
|
27381
|
+
*
|
|
27382
|
+
* Embed ThoughtSpot Sage
|
|
27383
|
+
*
|
|
27384
|
+
* @summary TS Sage embed
|
|
27385
|
+
* @author Mourya Balabhadra <mourya.balabhadra@thoughtspot.com>
|
|
27386
|
+
*/
|
|
27387
|
+
const HiddenActionItemByDefaultForSageEmbed = [
|
|
27388
|
+
exports.Action.Save,
|
|
27389
|
+
exports.Action.Pin,
|
|
27390
|
+
];
|
|
27391
|
+
/**
|
|
27392
|
+
* Embed ThoughtSpot search
|
|
27393
|
+
*
|
|
27394
|
+
* @group Embed components
|
|
27395
|
+
*/
|
|
27396
|
+
class SageEmbed extends V1Embed {
|
|
27397
|
+
// eslint-disable-next-line no-useless-constructor
|
|
27398
|
+
constructor(domSelector, viewConfig) {
|
|
27399
|
+
super(domSelector, viewConfig);
|
|
27400
|
+
this.defaultHeight = 500;
|
|
27401
|
+
/**
|
|
27402
|
+
* Set the iframe height as per the computed height received
|
|
27403
|
+
* from the ThoughtSpot app.
|
|
27404
|
+
*
|
|
27405
|
+
* @param {MessagePayload} data The event payload
|
|
27406
|
+
*/
|
|
27407
|
+
this.updateIFrameHeight = (data) => {
|
|
27408
|
+
this.setIFrameHeight(Math.max(data.data, this.defaultHeight));
|
|
27409
|
+
};
|
|
27410
|
+
this.embedIframeCenter = (data, responder) => {
|
|
27411
|
+
const obj = this.getIframeCenter();
|
|
27412
|
+
responder({ type: exports.EmbedEvent.EmbedIframeCenter, data: obj });
|
|
27413
|
+
};
|
|
27414
|
+
this.setIframeHeightForNonEmbedLiveboard = (data) => {
|
|
27415
|
+
if (!data.data.currentPath.startsWith('/embed/viz/')) {
|
|
27416
|
+
this.setIFrameHeight(this.defaultHeight);
|
|
27417
|
+
}
|
|
27418
|
+
};
|
|
27419
|
+
if (this.viewConfig.fullHeight === true) {
|
|
27420
|
+
this.on(exports.EmbedEvent.RouteChange, this.setIframeHeightForNonEmbedLiveboard);
|
|
27421
|
+
this.on(exports.EmbedEvent.EmbedHeight, this.updateIFrameHeight);
|
|
27422
|
+
this.on(exports.EmbedEvent.EmbedIframeCenter, this.embedIframeCenter);
|
|
27423
|
+
}
|
|
27424
|
+
}
|
|
27425
|
+
/**
|
|
27426
|
+
* Constructs a map of parameters to be passed on to the
|
|
27427
|
+
* embedded Eureka or Sage search page.
|
|
27428
|
+
*
|
|
27429
|
+
* @returns {string} query string
|
|
27430
|
+
*/
|
|
27431
|
+
getEmbedParams() {
|
|
27432
|
+
var _a, _b;
|
|
27433
|
+
const { hideEurekaResults, isSageEmbed, disableWorksheetChange, hideWorksheetSelector, } = this.viewConfig;
|
|
27434
|
+
const params = {};
|
|
27435
|
+
params[Param.EmbedApp] = true;
|
|
27436
|
+
params[Param.HideActions] = [...((_a = params[Param.HideActions]) !== null && _a !== void 0 ? _a : [])];
|
|
27437
|
+
params[Param.HideActions] = [
|
|
27438
|
+
...((_b = params[Param.HideActions]) !== null && _b !== void 0 ? _b : []),
|
|
27439
|
+
...HiddenActionItemByDefaultForSageEmbed,
|
|
27440
|
+
];
|
|
27441
|
+
if (hideEurekaResults) {
|
|
27442
|
+
params[Param.HideEurekaResults] = true;
|
|
27443
|
+
}
|
|
27444
|
+
if (isSageEmbed) {
|
|
27445
|
+
params[Param.IsSageEmbed] = true;
|
|
27446
|
+
}
|
|
27447
|
+
if (disableWorksheetChange) {
|
|
27448
|
+
params[Param.DisableWorksheetChange] = true;
|
|
27449
|
+
}
|
|
27450
|
+
if (hideWorksheetSelector) {
|
|
27451
|
+
params[Param.HideWorksheetSelector] = true;
|
|
27452
|
+
}
|
|
27453
|
+
const queryParamsString = getQueryParamString(params, true);
|
|
27454
|
+
let query = '';
|
|
27455
|
+
if (queryParamsString) {
|
|
27456
|
+
query = `?${queryParamsString}`;
|
|
27457
|
+
}
|
|
27458
|
+
return query;
|
|
27459
|
+
}
|
|
27460
|
+
/**
|
|
27461
|
+
* Construct the URL of the embedded ThoughtSpot sage to be
|
|
27462
|
+
* loaded in the iframe
|
|
27463
|
+
*
|
|
27464
|
+
* @returns {string} iframe url
|
|
27465
|
+
*/
|
|
27466
|
+
getIFrameSrc() {
|
|
27467
|
+
const path = 'eureka';
|
|
27468
|
+
const tsPostHashParams = this.getThoughtSpotPostUrlParams();
|
|
27469
|
+
return `${this.getRootIframeSrc()}/embed/${path}${tsPostHashParams}`;
|
|
27470
|
+
}
|
|
27471
|
+
/**
|
|
27472
|
+
* Render the embedded ThoughtSpot Sage
|
|
27473
|
+
*
|
|
27474
|
+
* @returns {SageEmbed} Eureka/Sage embed
|
|
27475
|
+
*/
|
|
27476
|
+
render() {
|
|
27477
|
+
super.render();
|
|
27478
|
+
const src = this.getIFrameSrc();
|
|
27479
|
+
this.renderV1Embed(src);
|
|
27480
|
+
return this;
|
|
27481
|
+
}
|
|
27482
|
+
}
|
|
27483
|
+
|
|
27379
27484
|
/**
|
|
27380
27485
|
* Copyright (c) 2022
|
|
27381
27486
|
*
|
|
@@ -27955,6 +28060,7 @@
|
|
|
27955
28060
|
* ```
|
|
27956
28061
|
*/
|
|
27957
28062
|
const SearchBarEmbed$1 = componentFactory(SearchBarEmbed);
|
|
28063
|
+
const SageEmbed$1 = componentFactory(SageEmbed);
|
|
27958
28064
|
/**
|
|
27959
28065
|
* Get a reference to the embed component to trigger events on the component.
|
|
27960
28066
|
*
|
|
@@ -27977,6 +28083,7 @@
|
|
|
27977
28083
|
exports.AppEmbed = AppEmbed$1;
|
|
27978
28084
|
exports.LiveboardEmbed = LiveboardEmbed$1;
|
|
27979
28085
|
exports.PinboardEmbed = PinboardEmbed;
|
|
28086
|
+
exports.SageEmbed = SageEmbed$1;
|
|
27980
28087
|
exports.SearchBarEmbed = SearchBarEmbed$1;
|
|
27981
28088
|
exports.SearchEmbed = SearchEmbed$1;
|
|
27982
28089
|
exports.useEmbedRef = useEmbedRef;
|
package/dist/tsembed.es.js
CHANGED
|
@@ -1479,6 +1479,10 @@ var Param;
|
|
|
1479
1479
|
Param["HideProfleAndHelp"] = "profileAndHelpInNavBarHidden";
|
|
1480
1480
|
Param["HideApplicationSwitcher"] = "applicationSwitcherHidden";
|
|
1481
1481
|
Param["HideOrgSwitcher"] = "orgSwitcherHidden";
|
|
1482
|
+
Param["IsSageEmbed"] = "isSageEmbed";
|
|
1483
|
+
Param["HideWorksheetSelector"] = "hideWorksheetSelector";
|
|
1484
|
+
Param["DisableWorksheetChange"] = "disableWorksheetChange";
|
|
1485
|
+
Param["HideEurekaResults"] = "hideEurekaResults";
|
|
1482
1486
|
})(Param || (Param = {}));
|
|
1483
1487
|
/**
|
|
1484
1488
|
* The list of actions that can be performed on visual ThoughtSpot
|
|
@@ -1737,6 +1741,7 @@ const ERROR_MESSAGE = {
|
|
|
1737
1741
|
LIVEBOARD_VIZ_ID_VALIDATION: 'Please provide either liveboardId or pinboardId',
|
|
1738
1742
|
TRIGGER_TIMED_OUT: 'Trigger timedout in getting response',
|
|
1739
1743
|
SEARCHEMBED_BETA_WRANING_MESSAGE: 'Search Embed is in Beta in this release.',
|
|
1744
|
+
SAGE_EMBED_BETA_WARNING_MESSAGE: 'Sage Embed is in Beta in this release.',
|
|
1740
1745
|
};
|
|
1741
1746
|
|
|
1742
1747
|
/**
|
|
@@ -7829,18 +7834,13 @@ function initMixpanel(sessionInfo) {
|
|
|
7829
7834
|
// userGUID
|
|
7830
7835
|
const isPublicCluster = !!sessionInfo.isPublicUser;
|
|
7831
7836
|
const token = sessionInfo.mixpanelToken;
|
|
7832
|
-
|
|
7833
|
-
|
|
7834
|
-
|
|
7835
|
-
|
|
7836
|
-
mixpanel_cjs.identify(sessionInfo.userGUID);
|
|
7837
|
-
}
|
|
7838
|
-
isMixpanelInitialized = true;
|
|
7839
|
-
emptyQueue();
|
|
7837
|
+
if (token) {
|
|
7838
|
+
mixpanel_cjs.init(token);
|
|
7839
|
+
if (!isPublicCluster) {
|
|
7840
|
+
mixpanel_cjs.identify(sessionInfo.userGUID);
|
|
7840
7841
|
}
|
|
7841
|
-
|
|
7842
|
-
|
|
7843
|
-
console.error('Error initializing mixpanel', e);
|
|
7842
|
+
isMixpanelInitialized = true;
|
|
7843
|
+
emptyQueue();
|
|
7844
7844
|
}
|
|
7845
7845
|
}
|
|
7846
7846
|
|
|
@@ -27509,7 +27509,7 @@ function processTrigger(iFrame, messageType, thoughtSpotHost, data) {
|
|
|
27509
27509
|
});
|
|
27510
27510
|
}
|
|
27511
27511
|
|
|
27512
|
-
var name="@thoughtspot/visual-embed-sdk";var version="1.21.0-
|
|
27512
|
+
var name="@thoughtspot/visual-embed-sdk";var version="1.21.0-sage.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/**","cjs/**"];var exports={".":{"import":"./lib/src/index.js",require:"./dist/tsembed.js",types:"./lib/src/index.d.ts"},"./react":{"import":"./lib/src/react/index.js",require:"./cjs/src/react.index.js",types:"./lib/src/react/index.d.ts"}};var typesVersions={"*":{react:["./lib/src/react/index.d.ts"]}};var scripts={lint:"eslint 'src/**'","lint:fix":"eslint 'src/**/*.*' --fix",tsc:"tsc -p . --incremental false; tsc -p . --incremental false --module commonjs --outDir cjs",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 ../../dist/visual-embed-sdk --main lib/src/index.d.ts --outputAsModuleFolder=true","bundle-dts-react":"dts-bundle --name ../../../dist/visual-embed-sdk-react --main lib/src/react/index.d.ts --outputAsModuleFolder=true","bundle-dts-react-full":"dts-bundle --name ../../../dist/visual-embed-sdk-react-full --main lib/src/react/all-types-export.d.ts --outputAsModuleFolder=true",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 --runInBand","test-docs":"jest -c jest.config.docs.js",test:"npm run test-sdk && npm run test-docs",posttest:"cat ./coverage/sdk/lcov.info | coveralls",prepublishOnly:"npm run test; npm run tsc; npm run bundle-dts; npm run bundle-dts-react-full; 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",dompurify:"^2.3.4","eslint-plugin-comment-length":"^0.9.2","eslint-plugin-jsdoc":"^40.1.0",eventemitter3:"^4.0.7","gatsby-plugin-vercel":"^1.0.3","html-react-parser":"^1.4.12",lodash:"^4.17.21","mixpanel-browser":"^2.45.0","ts-deepmerge":"^6.0.2","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","@rollup/plugin-replace":"^5.0.2","@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.13.1","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":"6.7.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":"^8.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-plugin-toc-group":"thoughtspot/typedoc-plugin-toc-group",typescript:"^4.9.4","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,typesVersions:typesVersions,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};
|
|
27513
27513
|
|
|
27514
27514
|
/**
|
|
27515
27515
|
* Copyright (c) 2022
|
|
@@ -28765,4 +28765,109 @@ class SearchBarEmbed extends TsEmbed {
|
|
|
28765
28765
|
}
|
|
28766
28766
|
}
|
|
28767
28767
|
|
|
28768
|
-
|
|
28768
|
+
/**
|
|
28769
|
+
* Copyright (c) 2022
|
|
28770
|
+
*
|
|
28771
|
+
* Embed ThoughtSpot Sage
|
|
28772
|
+
*
|
|
28773
|
+
* @summary TS Sage embed
|
|
28774
|
+
* @author Mourya Balabhadra <mourya.balabhadra@thoughtspot.com>
|
|
28775
|
+
*/
|
|
28776
|
+
const HiddenActionItemByDefaultForSageEmbed = [
|
|
28777
|
+
Action.Save,
|
|
28778
|
+
Action.Pin,
|
|
28779
|
+
];
|
|
28780
|
+
/**
|
|
28781
|
+
* Embed ThoughtSpot search
|
|
28782
|
+
*
|
|
28783
|
+
* @group Embed components
|
|
28784
|
+
*/
|
|
28785
|
+
class SageEmbed extends V1Embed {
|
|
28786
|
+
// eslint-disable-next-line no-useless-constructor
|
|
28787
|
+
constructor(domSelector, viewConfig) {
|
|
28788
|
+
super(domSelector, viewConfig);
|
|
28789
|
+
this.defaultHeight = 500;
|
|
28790
|
+
/**
|
|
28791
|
+
* Set the iframe height as per the computed height received
|
|
28792
|
+
* from the ThoughtSpot app.
|
|
28793
|
+
*
|
|
28794
|
+
* @param {MessagePayload} data The event payload
|
|
28795
|
+
*/
|
|
28796
|
+
this.updateIFrameHeight = (data) => {
|
|
28797
|
+
this.setIFrameHeight(Math.max(data.data, this.defaultHeight));
|
|
28798
|
+
};
|
|
28799
|
+
this.embedIframeCenter = (data, responder) => {
|
|
28800
|
+
const obj = this.getIframeCenter();
|
|
28801
|
+
responder({ type: EmbedEvent.EmbedIframeCenter, data: obj });
|
|
28802
|
+
};
|
|
28803
|
+
this.setIframeHeightForNonEmbedLiveboard = (data) => {
|
|
28804
|
+
if (!data.data.currentPath.startsWith('/embed/viz/')) {
|
|
28805
|
+
this.setIFrameHeight(this.defaultHeight);
|
|
28806
|
+
}
|
|
28807
|
+
};
|
|
28808
|
+
if (this.viewConfig.fullHeight === true) {
|
|
28809
|
+
this.on(EmbedEvent.RouteChange, this.setIframeHeightForNonEmbedLiveboard);
|
|
28810
|
+
this.on(EmbedEvent.EmbedHeight, this.updateIFrameHeight);
|
|
28811
|
+
this.on(EmbedEvent.EmbedIframeCenter, this.embedIframeCenter);
|
|
28812
|
+
}
|
|
28813
|
+
}
|
|
28814
|
+
/**
|
|
28815
|
+
* Constructs a map of parameters to be passed on to the
|
|
28816
|
+
* embedded Eureka or Sage search page.
|
|
28817
|
+
*
|
|
28818
|
+
* @returns {string} query string
|
|
28819
|
+
*/
|
|
28820
|
+
getEmbedParams() {
|
|
28821
|
+
var _a, _b;
|
|
28822
|
+
const { hideEurekaResults, isSageEmbed, disableWorksheetChange, hideWorksheetSelector, } = this.viewConfig;
|
|
28823
|
+
const params = {};
|
|
28824
|
+
params[Param.EmbedApp] = true;
|
|
28825
|
+
params[Param.HideActions] = [...((_a = params[Param.HideActions]) !== null && _a !== void 0 ? _a : [])];
|
|
28826
|
+
params[Param.HideActions] = [
|
|
28827
|
+
...((_b = params[Param.HideActions]) !== null && _b !== void 0 ? _b : []),
|
|
28828
|
+
...HiddenActionItemByDefaultForSageEmbed,
|
|
28829
|
+
];
|
|
28830
|
+
if (hideEurekaResults) {
|
|
28831
|
+
params[Param.HideEurekaResults] = true;
|
|
28832
|
+
}
|
|
28833
|
+
if (isSageEmbed) {
|
|
28834
|
+
params[Param.IsSageEmbed] = true;
|
|
28835
|
+
}
|
|
28836
|
+
if (disableWorksheetChange) {
|
|
28837
|
+
params[Param.DisableWorksheetChange] = true;
|
|
28838
|
+
}
|
|
28839
|
+
if (hideWorksheetSelector) {
|
|
28840
|
+
params[Param.HideWorksheetSelector] = true;
|
|
28841
|
+
}
|
|
28842
|
+
const queryParamsString = getQueryParamString(params, true);
|
|
28843
|
+
let query = '';
|
|
28844
|
+
if (queryParamsString) {
|
|
28845
|
+
query = `?${queryParamsString}`;
|
|
28846
|
+
}
|
|
28847
|
+
return query;
|
|
28848
|
+
}
|
|
28849
|
+
/**
|
|
28850
|
+
* Construct the URL of the embedded ThoughtSpot sage to be
|
|
28851
|
+
* loaded in the iframe
|
|
28852
|
+
*
|
|
28853
|
+
* @returns {string} iframe url
|
|
28854
|
+
*/
|
|
28855
|
+
getIFrameSrc() {
|
|
28856
|
+
const path = 'eureka';
|
|
28857
|
+
const tsPostHashParams = this.getThoughtSpotPostUrlParams();
|
|
28858
|
+
return `${this.getRootIframeSrc()}/embed/${path}${tsPostHashParams}`;
|
|
28859
|
+
}
|
|
28860
|
+
/**
|
|
28861
|
+
* Render the embedded ThoughtSpot Sage
|
|
28862
|
+
*
|
|
28863
|
+
* @returns {SageEmbed} Eureka/Sage embed
|
|
28864
|
+
*/
|
|
28865
|
+
render() {
|
|
28866
|
+
super.render();
|
|
28867
|
+
const src = this.getIFrameSrc();
|
|
28868
|
+
this.renderV1Embed(src);
|
|
28869
|
+
return this;
|
|
28870
|
+
}
|
|
28871
|
+
}
|
|
28872
|
+
|
|
28873
|
+
export { Action, AppEmbed, AuthEvent, AuthFailureType, AuthStatus, AuthType, ContextMenuTriggerOptions, DataSourceVisualMode, EmbedEvent, HostEvent, LiveboardEmbed, Page, PinboardEmbed, PrefetchFeatures, RuntimeFilterOp, SageEmbed, SearchBarEmbed, SearchEmbed, executeTML, exportTML, getEmbedConfig as getInitConfig, getSessionInfo, init, logout$1 as logout, prefetch };
|