@thoughtspot/visual-embed-sdk 1.37.1 → 1.38.0-alpha.1
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/README.md +1 -1
- package/cjs/package.json +1 -1
- package/cjs/src/embed/app.js +1 -1
- package/cjs/src/embed/app.js.map +1 -1
- package/cjs/src/embed/bodyless-conversation.d.ts +44 -9
- package/cjs/src/embed/bodyless-conversation.d.ts.map +1 -1
- package/cjs/src/embed/bodyless-conversation.js +35 -5
- package/cjs/src/embed/bodyless-conversation.js.map +1 -1
- package/cjs/src/embed/bodyless-conversation.spec.js +290 -5
- package/cjs/src/embed/bodyless-conversation.spec.js.map +1 -1
- package/cjs/src/embed/conversation.d.ts +40 -11
- package/cjs/src/embed/conversation.d.ts.map +1 -1
- package/cjs/src/embed/conversation.js +29 -4
- package/cjs/src/embed/conversation.js.map +1 -1
- package/cjs/src/embed/conversation.spec.js +7 -7
- package/cjs/src/embed/conversation.spec.js.map +1 -1
- package/cjs/src/embed/liveboard.d.ts.map +1 -1
- package/cjs/src/embed/liveboard.js +21 -10
- package/cjs/src/embed/liveboard.js.map +1 -1
- package/cjs/src/embed/ts-embed.spec.d.ts.map +1 -1
- package/cjs/src/embed/ts-embed.spec.js.map +1 -1
- package/cjs/src/index.d.ts +4 -4
- package/cjs/src/index.d.ts.map +1 -1
- package/cjs/src/index.js +5 -1
- package/cjs/src/index.js.map +1 -1
- package/cjs/src/react/all-types-export.d.ts +1 -1
- package/cjs/src/react/all-types-export.d.ts.map +1 -1
- package/cjs/src/react/all-types-export.js +3 -1
- package/cjs/src/react/all-types-export.js.map +1 -1
- package/cjs/src/react/index.d.ts +53 -5
- package/cjs/src/react/index.d.ts.map +1 -1
- package/cjs/src/react/index.js +73 -4
- package/cjs/src/react/index.js.map +1 -1
- package/cjs/src/react/index.spec.js +94 -0
- package/cjs/src/react/index.spec.js.map +1 -1
- package/cjs/src/types.d.ts +2 -1
- package/cjs/src/types.d.ts.map +1 -1
- package/cjs/src/types.js +1 -0
- package/cjs/src/types.js.map +1 -1
- package/dist/{index-m9UtENc9.js → index-DeFzsyFF.js} +1 -1
- package/dist/index-NZYq1Tu3.js +7370 -0
- package/dist/src/embed/bodyless-conversation.d.ts +44 -9
- package/dist/src/embed/bodyless-conversation.d.ts.map +1 -1
- package/dist/src/embed/conversation.d.ts +40 -11
- package/dist/src/embed/conversation.d.ts.map +1 -1
- package/dist/src/embed/liveboard.d.ts.map +1 -1
- package/dist/src/embed/ts-embed.spec.d.ts.map +1 -1
- package/dist/src/index.d.ts +4 -4
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/react/all-types-export.d.ts +1 -1
- package/dist/src/react/all-types-export.d.ts.map +1 -1
- package/dist/src/react/index.d.ts +53 -5
- package/dist/src/react/index.d.ts.map +1 -1
- package/dist/src/types.d.ts +2 -1
- package/dist/src/types.d.ts.map +1 -1
- package/dist/tsembed-react.es.js +583 -21
- package/dist/tsembed-react.js +583 -19
- package/dist/tsembed.es.js +86 -22
- package/dist/tsembed.js +92 -26
- package/dist/visual-embed-sdk-react-full.d.ts +184 -72
- package/dist/visual-embed-sdk-react.d.ts +184 -72
- package/dist/visual-embed-sdk.d.ts +87 -22
- package/lib/package.json +1 -1
- package/lib/src/embed/app.js +1 -1
- package/lib/src/embed/app.js.map +1 -1
- package/lib/src/embed/bodyless-conversation.d.ts +44 -9
- package/lib/src/embed/bodyless-conversation.d.ts.map +1 -1
- package/lib/src/embed/bodyless-conversation.js +33 -4
- package/lib/src/embed/bodyless-conversation.js.map +1 -1
- package/lib/src/embed/bodyless-conversation.spec.js +292 -7
- package/lib/src/embed/bodyless-conversation.spec.js.map +1 -1
- package/lib/src/embed/conversation.d.ts +40 -11
- package/lib/src/embed/conversation.d.ts.map +1 -1
- package/lib/src/embed/conversation.js +27 -3
- package/lib/src/embed/conversation.js.map +1 -1
- package/lib/src/embed/conversation.spec.js +8 -8
- package/lib/src/embed/conversation.spec.js.map +1 -1
- package/lib/src/embed/liveboard.d.ts.map +1 -1
- package/lib/src/embed/liveboard.js +21 -10
- package/lib/src/embed/liveboard.js.map +1 -1
- package/lib/src/embed/ts-embed.spec.d.ts.map +1 -1
- package/lib/src/embed/ts-embed.spec.js.map +1 -1
- package/lib/src/index.d.ts +4 -4
- package/lib/src/index.d.ts.map +1 -1
- package/lib/src/index.js +4 -4
- package/lib/src/index.js.map +1 -1
- package/lib/src/react/all-types-export.d.ts +1 -1
- package/lib/src/react/all-types-export.d.ts.map +1 -1
- package/lib/src/react/all-types-export.js +1 -1
- package/lib/src/react/all-types-export.js.map +1 -1
- package/lib/src/react/index.d.ts +53 -5
- package/lib/src/react/index.d.ts.map +1 -1
- package/lib/src/react/index.js +73 -4
- package/lib/src/react/index.js.map +1 -1
- package/lib/src/react/index.spec.js +96 -2
- package/lib/src/react/index.spec.js.map +1 -1
- package/lib/src/types.d.ts +2 -1
- package/lib/src/types.d.ts.map +1 -1
- package/lib/src/types.js +1 -0
- package/lib/src/types.js.map +1 -1
- package/lib/src/visual-embed-sdk.d.ts +90 -25
- package/package.json +1 -1
- package/src/embed/app.ts +1 -1
- package/src/embed/bodyless-conversation.spec.ts +314 -7
- package/src/embed/bodyless-conversation.ts +53 -8
- package/src/embed/conversation.spec.ts +16 -16
- package/src/embed/conversation.ts +44 -11
- package/src/embed/liveboard.ts +25 -10
- package/src/embed/ts-embed.spec.ts +0 -2
- package/src/index.ts +16 -5
- package/src/react/all-types-export.ts +2 -0
- package/src/react/index.spec.tsx +157 -1
- package/src/react/index.tsx +98 -11
- package/src/types.ts +1 -0
package/dist/tsembed-react.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* @thoughtspot/visual-embed-sdk version 1.
|
|
1
|
+
/* @thoughtspot/visual-embed-sdk version 1.38.0-alpha.1 */
|
|
2
2
|
'use client';
|
|
3
3
|
(function (global, factory) {
|
|
4
4
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react')) :
|
|
@@ -3119,6 +3119,7 @@
|
|
|
3119
3119
|
Param["ShowSpotterLimitations"] = "showSpotterLimitations";
|
|
3120
3120
|
Param["CoverAndFilterOptionInPDF"] = "coverAndFilterOptionInPDF";
|
|
3121
3121
|
Param["PrimaryAction"] = "primaryAction";
|
|
3122
|
+
Param["isSpotterAgentEmbed"] = "isSpotterAgentEmbed";
|
|
3122
3123
|
})(Param || (Param = {}));
|
|
3123
3124
|
/**
|
|
3124
3125
|
* ThoughtSpot application pages include actions and menu commands
|
|
@@ -15370,7 +15371,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
15370
15371
|
return e;
|
|
15371
15372
|
}
|
|
15372
15373
|
|
|
15373
|
-
var name="@thoughtspot/visual-embed-sdk";var version$1="1.
|
|
15374
|
+
var name="@thoughtspot/visual-embed-sdk";var version$1="1.38.0-alpha.1";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:"./cjs/src/index.js",types:"./lib/src/index.d.ts"},"./react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"},"./lib/src/react":{"import":"./lib/src/react/all-types-export.js",require:"./cjs/src/react/all-types-export.js",types:"./lib/src/react/all-types-export.d.ts"}};var typesVersions={"*":{react:["./lib/src/react/all-types-export.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","build-and-publish":"npm run build:gatsby && npm run publish","bundle-dts-file":"dts-bundle --name @thoughtspot/visual-embed-sdk --out visual-embed-sdk.d.ts --main lib/src/index.d.ts","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",docgen:"typedoc --tsconfig tsconfig.json --theme typedoc-theme --json static/typedoc/typedoc.json --disableOutputCheck","test-sdk":"jest -c jest.config.sdk.js --runInBand",test:"npm run test-sdk",posttest:"cat ./coverage/sdk/lcov.info | coveralls","is-publish-allowed":"node scripts/is-publish-allowed.js",prepublishOnly:"npm run is-publish-allowed && npm run test && npm run tsc && npm run bundle-dts-file && npm run bundle-dts && npm run bundle-dts-react && npm run bundle-dts-react-full && npm run build","check-size":"npm run build && size-limit","publish-dev":"npm publish --tag dev","publish-prod":"npm publish --tag latest",dev:"vite -c vite.local.config.ts"};var peerDependencies={react:"> 16.8.0","react-dom":"> 16.8.0"};var dependencies={classnames:"^2.3.1",eventemitter3:"^4.0.7",lodash:"^4.17.21","mixpanel-browser":"2.47.0","ts-deepmerge":"^6.0.2",tslib:"^2.5.3","use-deep-compare-effect":"^1.8.1",yaml:"^2.5.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","@size-limit/preset-big-lib":"^8.2.6","@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/lodash":"^4.17.0","@types/mixpanel-browser":"^2.35.6","@types/react-test-renderer":"^17.0.1","@typescript-eslint/eslint-plugin":"^8.28.0","@typescript-eslint/parser":"^8.28.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",crypto:"^1.0.1","current-git-branch":"^1.1.0","dts-bundle":"^0.7.3",eslint:"^9.23.0","eslint-config-airbnb-base":"^15.0.0","eslint-config-prettier":"^10.1.1","eslint-import-resolver-typescript":"^4.2.5","eslint-plugin-comment-length":"2.2.1","eslint-plugin-import":"^2.31.0","eslint-plugin-jsdoc":"^50.6.9","eslint-plugin-prettier":"^5.2.5","eslint-plugin-react":"^7.37.5","eslint-plugin-react-hooks":"^5.2.0","fs-extra":"^10.0.0","gh-pages":"6.3.0",globals:"^16.0.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-fetch-mock":"^3.0.3",jsdom:"^17.0.0",prettier:"2.1.2",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:"4.24.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","typescript-eslint":"^8.29.1","url-search-params-polyfill":"^8.1.0",util:"^0.12.4",vite:"^6.3.5"};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","embedded","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$1,description:description,module:module,main:main,types:types,files:files,exports:exports$1,typesVersions:typesVersions,"size-limit":[{path:"dist/tsembed.es.js",limit:"31 kB"}],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};
|
|
15374
15375
|
|
|
15375
15376
|
/**
|
|
15376
15377
|
* Reloads the ThoughtSpot iframe.
|
|
@@ -17139,7 +17140,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
17139
17140
|
responder({ type: exports.EmbedEvent.EmbedIframeCenter, data: obj });
|
|
17140
17141
|
};
|
|
17141
17142
|
this.setIframeHeightForNonEmbedLiveboard = (data) => {
|
|
17142
|
-
const { height: frameHeight
|
|
17143
|
+
const { height: frameHeight } = this.viewConfig.frameParams || {};
|
|
17143
17144
|
const liveboardRelatedRoutes = [
|
|
17144
17145
|
'/pinboard/',
|
|
17145
17146
|
'/insights/pinboard/',
|
|
@@ -17434,12 +17435,6 @@ query GetEurekaVizSnapshots(
|
|
|
17434
17435
|
* @summary Liveboard & visualization embed
|
|
17435
17436
|
* @author Ayon Ghosh <ayon.ghosh@thoughtspot.com>
|
|
17436
17437
|
*/
|
|
17437
|
-
const liveboardHeightWhitelistedRoutes = [
|
|
17438
|
-
'/embed/viz/',
|
|
17439
|
-
'/embed/insights/viz/',
|
|
17440
|
-
'/tsl-editor/PINBOARD_ANSWER_BOOK/',
|
|
17441
|
-
'/import-tsl/PINBOARD_ANSWER_BOOK/',
|
|
17442
|
-
];
|
|
17443
17438
|
/**
|
|
17444
17439
|
* Embed a ThoughtSpot Liveboard or visualization. When rendered it already
|
|
17445
17440
|
* waits for the authentication to complete, so you need not wait for
|
|
@@ -17456,7 +17451,6 @@ query GetEurekaVizSnapshots(
|
|
|
17456
17451
|
* @group Embed components
|
|
17457
17452
|
*/
|
|
17458
17453
|
let LiveboardEmbed$1 = class LiveboardEmbed extends V1Embed {
|
|
17459
|
-
// eslint-disable-next-line no-useless-constructor
|
|
17460
17454
|
constructor(domSelector, viewConfig) {
|
|
17461
17455
|
viewConfig.embedComponentType = 'LiveboardEmbed';
|
|
17462
17456
|
super(domSelector, viewConfig);
|
|
@@ -17474,13 +17468,30 @@ query GetEurekaVizSnapshots(
|
|
|
17474
17468
|
responder({ type: exports.EmbedEvent.EmbedIframeCenter, data: obj });
|
|
17475
17469
|
};
|
|
17476
17470
|
this.setIframeHeightForNonEmbedLiveboard = (data) => {
|
|
17477
|
-
const
|
|
17478
|
-
|
|
17471
|
+
const { height: frameHeight } = this.viewConfig.frameParams || {};
|
|
17472
|
+
const liveboardRelatedRoutes = [
|
|
17473
|
+
'/pinboard/',
|
|
17474
|
+
'/insights/pinboard/',
|
|
17475
|
+
'/schedules/',
|
|
17476
|
+
'/embed/viz/',
|
|
17477
|
+
'/embed/insights/viz/',
|
|
17478
|
+
'/liveboard/',
|
|
17479
|
+
'/insights/liveboard/',
|
|
17480
|
+
'/tsl-editor/PINBOARD_ANSWER_BOOK/',
|
|
17481
|
+
'/import-tsl/PINBOARD_ANSWER_BOOK/',
|
|
17482
|
+
];
|
|
17483
|
+
if (liveboardRelatedRoutes.some((path) => data.data.currentPath.startsWith(path))) {
|
|
17484
|
+
// Ignore the height reset of the frame, if the navigation is
|
|
17485
|
+
// only within the liveboard page.
|
|
17479
17486
|
return;
|
|
17480
17487
|
}
|
|
17481
|
-
this.setIFrameHeight(this.defaultHeight);
|
|
17488
|
+
this.setIFrameHeight(frameHeight || this.defaultHeight);
|
|
17482
17489
|
};
|
|
17483
17490
|
if (this.viewConfig.fullHeight === true) {
|
|
17491
|
+
if (this.viewConfig.vizId) {
|
|
17492
|
+
logger$3.warn('Full height is currently only supported for Liveboard embeds.' +
|
|
17493
|
+
'Using full height with vizId might lead to unexpected behavior.');
|
|
17494
|
+
}
|
|
17484
17495
|
this.on(exports.EmbedEvent.RouteChange, this.setIframeHeightForNonEmbedLiveboard);
|
|
17485
17496
|
this.on(exports.EmbedEvent.EmbedHeight, this.updateIFrameHeight);
|
|
17486
17497
|
this.on(exports.EmbedEvent.EmbedIframeCenter, this.embedIframeCenter);
|
|
@@ -17696,6 +17707,465 @@ query GetEurekaVizSnapshots(
|
|
|
17696
17707
|
}
|
|
17697
17708
|
};
|
|
17698
17709
|
|
|
17710
|
+
const createConversation = `
|
|
17711
|
+
mutation CreateConversation($params: Input_convassist_CreateConversationRequest) {
|
|
17712
|
+
ConvAssist__createConversation(request: $params) {
|
|
17713
|
+
convId
|
|
17714
|
+
initialCtx {
|
|
17715
|
+
type
|
|
17716
|
+
tsAnsCtx {
|
|
17717
|
+
sessionId
|
|
17718
|
+
genNo
|
|
17719
|
+
stateKey {
|
|
17720
|
+
transactionId
|
|
17721
|
+
generationNumber
|
|
17722
|
+
}
|
|
17723
|
+
worksheet {
|
|
17724
|
+
worksheetId
|
|
17725
|
+
worksheetName
|
|
17726
|
+
}
|
|
17727
|
+
}
|
|
17728
|
+
}
|
|
17729
|
+
}
|
|
17730
|
+
}
|
|
17731
|
+
`;
|
|
17732
|
+
const sendMessage = `
|
|
17733
|
+
query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
17734
|
+
ConvAssist__sendMessage(request: $params) {
|
|
17735
|
+
responses {
|
|
17736
|
+
timestamp
|
|
17737
|
+
msgId
|
|
17738
|
+
data {
|
|
17739
|
+
asstRespData {
|
|
17740
|
+
tool
|
|
17741
|
+
asstRespText
|
|
17742
|
+
nlsAnsData {
|
|
17743
|
+
sageQuerySuggestions {
|
|
17744
|
+
sageQueryTokens {
|
|
17745
|
+
additions {
|
|
17746
|
+
phrase {
|
|
17747
|
+
isCompletePhrase
|
|
17748
|
+
numTokens
|
|
17749
|
+
phraseType
|
|
17750
|
+
startIndex
|
|
17751
|
+
__typename
|
|
17752
|
+
}
|
|
17753
|
+
tokens {
|
|
17754
|
+
token
|
|
17755
|
+
dataType
|
|
17756
|
+
typeEnum
|
|
17757
|
+
guid
|
|
17758
|
+
tokenMetadata {
|
|
17759
|
+
name
|
|
17760
|
+
__typename
|
|
17761
|
+
}
|
|
17762
|
+
__typename
|
|
17763
|
+
}
|
|
17764
|
+
__typename
|
|
17765
|
+
}
|
|
17766
|
+
phrases {
|
|
17767
|
+
isCompletePhrase
|
|
17768
|
+
numTokens
|
|
17769
|
+
phraseType
|
|
17770
|
+
startIndex
|
|
17771
|
+
__typename
|
|
17772
|
+
}
|
|
17773
|
+
removals {
|
|
17774
|
+
phrase {
|
|
17775
|
+
isCompletePhrase
|
|
17776
|
+
numTokens
|
|
17777
|
+
phraseType
|
|
17778
|
+
startIndex
|
|
17779
|
+
__typename
|
|
17780
|
+
}
|
|
17781
|
+
tokens {
|
|
17782
|
+
token
|
|
17783
|
+
dataType
|
|
17784
|
+
typeEnum
|
|
17785
|
+
guid
|
|
17786
|
+
tokenMetadata {
|
|
17787
|
+
name
|
|
17788
|
+
__typename
|
|
17789
|
+
}
|
|
17790
|
+
__typename
|
|
17791
|
+
}
|
|
17792
|
+
__typename
|
|
17793
|
+
}
|
|
17794
|
+
tokens {
|
|
17795
|
+
token
|
|
17796
|
+
dataType
|
|
17797
|
+
typeEnum
|
|
17798
|
+
guid
|
|
17799
|
+
tokenMetadata {
|
|
17800
|
+
name
|
|
17801
|
+
__typename
|
|
17802
|
+
}
|
|
17803
|
+
__typename
|
|
17804
|
+
}
|
|
17805
|
+
__typename
|
|
17806
|
+
}
|
|
17807
|
+
llmReasoning {
|
|
17808
|
+
assumptions
|
|
17809
|
+
clarifications
|
|
17810
|
+
interpretation
|
|
17811
|
+
__typename
|
|
17812
|
+
}
|
|
17813
|
+
tokens
|
|
17814
|
+
tmlTokens
|
|
17815
|
+
worksheetId
|
|
17816
|
+
tokens
|
|
17817
|
+
description
|
|
17818
|
+
title
|
|
17819
|
+
tmlTokens
|
|
17820
|
+
cached
|
|
17821
|
+
sqlQuery
|
|
17822
|
+
sessionId
|
|
17823
|
+
genNo
|
|
17824
|
+
formulaInfo {
|
|
17825
|
+
name
|
|
17826
|
+
expression
|
|
17827
|
+
__typename
|
|
17828
|
+
}
|
|
17829
|
+
tmlPhrases
|
|
17830
|
+
ambiguousPhrases {
|
|
17831
|
+
alternativePhrases {
|
|
17832
|
+
phraseType
|
|
17833
|
+
token {
|
|
17834
|
+
token
|
|
17835
|
+
dataType
|
|
17836
|
+
typeEnum
|
|
17837
|
+
guid
|
|
17838
|
+
tokenMetadata {
|
|
17839
|
+
name
|
|
17840
|
+
__typename
|
|
17841
|
+
}
|
|
17842
|
+
__typename
|
|
17843
|
+
}
|
|
17844
|
+
__typename
|
|
17845
|
+
}
|
|
17846
|
+
ambiguityType
|
|
17847
|
+
token {
|
|
17848
|
+
token
|
|
17849
|
+
dataType
|
|
17850
|
+
typeEnum
|
|
17851
|
+
guid
|
|
17852
|
+
tokenMetadata {
|
|
17853
|
+
name
|
|
17854
|
+
__typename
|
|
17855
|
+
}
|
|
17856
|
+
__typename
|
|
17857
|
+
}
|
|
17858
|
+
__typename
|
|
17859
|
+
}
|
|
17860
|
+
ambiguousTokens {
|
|
17861
|
+
alternativeTokens {
|
|
17862
|
+
token
|
|
17863
|
+
dataType
|
|
17864
|
+
typeEnum
|
|
17865
|
+
guid
|
|
17866
|
+
tokenMetadata {
|
|
17867
|
+
name
|
|
17868
|
+
deprecatedTableGuid
|
|
17869
|
+
deprecatedTableName
|
|
17870
|
+
isFormula
|
|
17871
|
+
rootTables {
|
|
17872
|
+
created
|
|
17873
|
+
description
|
|
17874
|
+
guid
|
|
17875
|
+
indexVersion
|
|
17876
|
+
modified
|
|
17877
|
+
name
|
|
17878
|
+
__typename
|
|
17879
|
+
}
|
|
17880
|
+
schemaTableUserDefinedName
|
|
17881
|
+
table {
|
|
17882
|
+
created
|
|
17883
|
+
description
|
|
17884
|
+
guid
|
|
17885
|
+
indexVersion
|
|
17886
|
+
modified
|
|
17887
|
+
name
|
|
17888
|
+
__typename
|
|
17889
|
+
}
|
|
17890
|
+
__typename
|
|
17891
|
+
}
|
|
17892
|
+
__typename
|
|
17893
|
+
}
|
|
17894
|
+
ambiguityType
|
|
17895
|
+
token {
|
|
17896
|
+
token
|
|
17897
|
+
dataType
|
|
17898
|
+
typeEnum
|
|
17899
|
+
guid
|
|
17900
|
+
tokenMetadata {
|
|
17901
|
+
name
|
|
17902
|
+
__typename
|
|
17903
|
+
}
|
|
17904
|
+
__typename
|
|
17905
|
+
}
|
|
17906
|
+
__typename
|
|
17907
|
+
}
|
|
17908
|
+
stateKey {
|
|
17909
|
+
transactionId
|
|
17910
|
+
generationNumber
|
|
17911
|
+
transactionId
|
|
17912
|
+
__typename
|
|
17913
|
+
}
|
|
17914
|
+
subQueries {
|
|
17915
|
+
tokens
|
|
17916
|
+
cohortConfig {
|
|
17917
|
+
anchorColumnId
|
|
17918
|
+
cohortAnswerGuid
|
|
17919
|
+
cohortGroupingType
|
|
17920
|
+
cohortGuid
|
|
17921
|
+
cohortType
|
|
17922
|
+
combineNonGroupValues
|
|
17923
|
+
description
|
|
17924
|
+
groupExcludedQueryValues
|
|
17925
|
+
hideExcludedQueryValues
|
|
17926
|
+
isEditable
|
|
17927
|
+
name
|
|
17928
|
+
nullOutputValue
|
|
17929
|
+
returnColumnId
|
|
17930
|
+
__typename
|
|
17931
|
+
}
|
|
17932
|
+
formulas {
|
|
17933
|
+
name
|
|
17934
|
+
expression
|
|
17935
|
+
__typename
|
|
17936
|
+
}
|
|
17937
|
+
__typename
|
|
17938
|
+
}
|
|
17939
|
+
visualizationSuggestion {
|
|
17940
|
+
chartType
|
|
17941
|
+
displayMode
|
|
17942
|
+
axisConfigs {
|
|
17943
|
+
category
|
|
17944
|
+
color
|
|
17945
|
+
hidden
|
|
17946
|
+
size
|
|
17947
|
+
sort
|
|
17948
|
+
x
|
|
17949
|
+
y
|
|
17950
|
+
__typename
|
|
17951
|
+
}
|
|
17952
|
+
usersVizIntentApplied
|
|
17953
|
+
customChartConfigs {
|
|
17954
|
+
dimensions {
|
|
17955
|
+
columns
|
|
17956
|
+
key
|
|
17957
|
+
__typename
|
|
17958
|
+
}
|
|
17959
|
+
key
|
|
17960
|
+
__typename
|
|
17961
|
+
}
|
|
17962
|
+
customChartGuid
|
|
17963
|
+
__typename
|
|
17964
|
+
}
|
|
17965
|
+
tableData {
|
|
17966
|
+
columnDataLite {
|
|
17967
|
+
columnId
|
|
17968
|
+
columnDataType
|
|
17969
|
+
dataValue
|
|
17970
|
+
columnName
|
|
17971
|
+
__typename
|
|
17972
|
+
}
|
|
17973
|
+
__typename
|
|
17974
|
+
}
|
|
17975
|
+
warningType
|
|
17976
|
+
cached
|
|
17977
|
+
__typename
|
|
17978
|
+
}
|
|
17979
|
+
debugInfo {
|
|
17980
|
+
fewShotExamples {
|
|
17981
|
+
chartType
|
|
17982
|
+
id
|
|
17983
|
+
mappingId
|
|
17984
|
+
nlQuery
|
|
17985
|
+
nlQueryConcepts
|
|
17986
|
+
sageQuery
|
|
17987
|
+
scope
|
|
17988
|
+
sql
|
|
17989
|
+
tml
|
|
17990
|
+
__typename
|
|
17991
|
+
}
|
|
17992
|
+
__typename
|
|
17993
|
+
}
|
|
17994
|
+
__typename
|
|
17995
|
+
}
|
|
17996
|
+
__typename
|
|
17997
|
+
}
|
|
17998
|
+
errorData {
|
|
17999
|
+
tool
|
|
18000
|
+
errCode
|
|
18001
|
+
errTxt
|
|
18002
|
+
toolErrCode
|
|
18003
|
+
__typename
|
|
18004
|
+
}
|
|
18005
|
+
__typename
|
|
18006
|
+
}
|
|
18007
|
+
type
|
|
18008
|
+
__typename
|
|
18009
|
+
}
|
|
18010
|
+
prevCtx {
|
|
18011
|
+
genNo
|
|
18012
|
+
sessionId
|
|
18013
|
+
__typename
|
|
18014
|
+
}
|
|
18015
|
+
__typename
|
|
18016
|
+
}
|
|
18017
|
+
}
|
|
18018
|
+
`;
|
|
18019
|
+
|
|
18020
|
+
class Conversation {
|
|
18021
|
+
constructor(thoughtSpotHost, worksheetId) {
|
|
18022
|
+
this.thoughtSpotHost = thoughtSpotHost;
|
|
18023
|
+
this.worksheetId = worksheetId;
|
|
18024
|
+
this.inProgress = null;
|
|
18025
|
+
this.inProgress = this.init();
|
|
18026
|
+
}
|
|
18027
|
+
async init() {
|
|
18028
|
+
const { convId } = await this.createConversation();
|
|
18029
|
+
this.conversationId = convId;
|
|
18030
|
+
}
|
|
18031
|
+
createConversation() {
|
|
18032
|
+
return this.executeQuery(createConversation, {
|
|
18033
|
+
params: {
|
|
18034
|
+
initialCtx: {
|
|
18035
|
+
tsWorksheetCtx: {
|
|
18036
|
+
worksheet: {
|
|
18037
|
+
worksheetId: this.worksheetId,
|
|
18038
|
+
},
|
|
18039
|
+
},
|
|
18040
|
+
type: 'TS_WORKSHEET',
|
|
18041
|
+
},
|
|
18042
|
+
userInfo: {
|
|
18043
|
+
tenantUrl: `${this.thoughtSpotHost}/prism`,
|
|
18044
|
+
},
|
|
18045
|
+
},
|
|
18046
|
+
});
|
|
18047
|
+
}
|
|
18048
|
+
async sendMessage(userMessage) {
|
|
18049
|
+
await this.inProgress;
|
|
18050
|
+
try {
|
|
18051
|
+
const { responses } = await this.executeQuery(sendMessage, {
|
|
18052
|
+
params: {
|
|
18053
|
+
convId: this.conversationId,
|
|
18054
|
+
headers: [],
|
|
18055
|
+
msg: {
|
|
18056
|
+
data: {
|
|
18057
|
+
userCmdData: {
|
|
18058
|
+
cmdText: userMessage,
|
|
18059
|
+
nlsData: {
|
|
18060
|
+
worksheetId: this.worksheetId,
|
|
18061
|
+
questionType: 'ANSWER_SPEC_GENERATION',
|
|
18062
|
+
},
|
|
18063
|
+
},
|
|
18064
|
+
},
|
|
18065
|
+
msgId: crypto.randomUUID(),
|
|
18066
|
+
type: 'USER_COMMAND',
|
|
18067
|
+
},
|
|
18068
|
+
},
|
|
18069
|
+
});
|
|
18070
|
+
const data = responses[0].data;
|
|
18071
|
+
return {
|
|
18072
|
+
data: data.asstRespData.nlsAnsData.sageQuerySuggestions[0],
|
|
18073
|
+
error: null,
|
|
18074
|
+
};
|
|
18075
|
+
}
|
|
18076
|
+
catch (error) {
|
|
18077
|
+
return { error };
|
|
18078
|
+
}
|
|
18079
|
+
}
|
|
18080
|
+
async executeQuery(query, variables) {
|
|
18081
|
+
return graphqlQuery({
|
|
18082
|
+
query,
|
|
18083
|
+
variables,
|
|
18084
|
+
thoughtSpotHost: this.thoughtSpotHost,
|
|
18085
|
+
isCompositeQuery: false,
|
|
18086
|
+
});
|
|
18087
|
+
}
|
|
18088
|
+
}
|
|
18089
|
+
|
|
18090
|
+
class ConversationMessage extends TsEmbed {
|
|
18091
|
+
constructor(container, viewConfig) {
|
|
18092
|
+
viewConfig.embedComponentType = 'bodyless-conversation';
|
|
18093
|
+
super(container, viewConfig);
|
|
18094
|
+
this.viewConfig = viewConfig;
|
|
18095
|
+
}
|
|
18096
|
+
getIframeSrc() {
|
|
18097
|
+
var _a;
|
|
18098
|
+
const { sessionId, genNo, acSessionId, acGenNo, } = this.viewConfig;
|
|
18099
|
+
const path = 'conv-assist-answer';
|
|
18100
|
+
const queryParams = this.getBaseQueryParams();
|
|
18101
|
+
queryParams[Param.HideActions] = [...((_a = queryParams[Param.HideActions]) !== null && _a !== void 0 ? _a : [])];
|
|
18102
|
+
queryParams[Param.isSpotterAgentEmbed] = true;
|
|
18103
|
+
let query = '';
|
|
18104
|
+
const queryParamsString = getQueryParamString(queryParams, true);
|
|
18105
|
+
if (queryParamsString) {
|
|
18106
|
+
query = `?${queryParamsString}`;
|
|
18107
|
+
}
|
|
18108
|
+
const tsPostHashParams = this.getThoughtSpotPostUrlParams({
|
|
18109
|
+
sessionId,
|
|
18110
|
+
genNo,
|
|
18111
|
+
acSessionId,
|
|
18112
|
+
acGenNo,
|
|
18113
|
+
});
|
|
18114
|
+
return `${this.getEmbedBasePath(query)}/embed/${path}${tsPostHashParams}`;
|
|
18115
|
+
}
|
|
18116
|
+
async render() {
|
|
18117
|
+
await super.render();
|
|
18118
|
+
const src = this.getIframeSrc();
|
|
18119
|
+
await this.renderIFrame(src);
|
|
18120
|
+
return this;
|
|
18121
|
+
}
|
|
18122
|
+
}
|
|
18123
|
+
/**
|
|
18124
|
+
* Create a conversation embed, which can be integrated inside
|
|
18125
|
+
* chatbots or other conversational interfaces.
|
|
18126
|
+
* @example
|
|
18127
|
+
* ```js
|
|
18128
|
+
* import { SpotterAgentEmbed } from '@thoughtspot/visual-embed-sdk';
|
|
18129
|
+
*
|
|
18130
|
+
* const conversation = new SpotterAgentEmbed({
|
|
18131
|
+
* worksheetId: 'worksheetId',
|
|
18132
|
+
* });
|
|
18133
|
+
*
|
|
18134
|
+
* const { container, error } = await conversation.sendMessage('show me sales by region');
|
|
18135
|
+
*
|
|
18136
|
+
* // append the container to the DOM
|
|
18137
|
+
* document.body.appendChild(container); // or to any other element
|
|
18138
|
+
* ```
|
|
18139
|
+
* @group Embed components
|
|
18140
|
+
* @version SDK: 1.37.0 | ThoughtSpot: 10.9.0.cl
|
|
18141
|
+
*/
|
|
18142
|
+
let SpotterAgentEmbed$1 = class SpotterAgentEmbed {
|
|
18143
|
+
constructor(viewConfig) {
|
|
18144
|
+
this.viewConfig = viewConfig;
|
|
18145
|
+
const embedConfig = getEmbedConfig();
|
|
18146
|
+
this.conversationService = new Conversation(embedConfig.thoughtSpotHost, viewConfig.worksheetId);
|
|
18147
|
+
}
|
|
18148
|
+
async sendMessage(userMessage) {
|
|
18149
|
+
const { data, error } = await this.conversationService.sendMessage(userMessage);
|
|
18150
|
+
if (error) {
|
|
18151
|
+
return { error };
|
|
18152
|
+
}
|
|
18153
|
+
const container = document.createElement('div');
|
|
18154
|
+
if (this.viewConfig.containerClassName) {
|
|
18155
|
+
container.className = this.viewConfig.containerClassName;
|
|
18156
|
+
}
|
|
18157
|
+
const embed = new ConversationMessage(container, {
|
|
18158
|
+
...this.viewConfig,
|
|
18159
|
+
sessionId: data.sessionId,
|
|
18160
|
+
genNo: data.genNo,
|
|
18161
|
+
acSessionId: data.stateKey.transactionId,
|
|
18162
|
+
acGenNo: data.stateKey.generationNumber,
|
|
18163
|
+
});
|
|
18164
|
+
await embed.render();
|
|
18165
|
+
return { container, viz: embed };
|
|
18166
|
+
}
|
|
18167
|
+
};
|
|
18168
|
+
|
|
17699
18169
|
/**
|
|
17700
18170
|
*
|
|
17701
18171
|
* @param props
|
|
@@ -17744,7 +18214,7 @@ query GetEurekaVizSnapshots(
|
|
|
17744
18214
|
* @group Embed components
|
|
17745
18215
|
* @example
|
|
17746
18216
|
* ```js
|
|
17747
|
-
* const conversation = new
|
|
18217
|
+
* const conversation = new SpotterEmbed('#tsEmbed', {
|
|
17748
18218
|
* worksheetId: 'worksheetId',
|
|
17749
18219
|
* searchOptions: {
|
|
17750
18220
|
* searchQuery: 'searchQuery',
|
|
@@ -17752,9 +18222,9 @@ query GetEurekaVizSnapshots(
|
|
|
17752
18222
|
* });
|
|
17753
18223
|
* conversation.render();
|
|
17754
18224
|
* ```
|
|
17755
|
-
* @version SDK: 1.
|
|
18225
|
+
* @version SDK: 1.37.0 | ThoughtSpot: 10.9.0.cl
|
|
17756
18226
|
*/
|
|
17757
|
-
let
|
|
18227
|
+
let SpotterEmbed$1 = class SpotterEmbed extends TsEmbed {
|
|
17758
18228
|
constructor(container, viewConfig) {
|
|
17759
18229
|
viewConfig.embedComponentType = 'conversation';
|
|
17760
18230
|
super(container, viewConfig);
|
|
@@ -17800,6 +18270,30 @@ query GetEurekaVizSnapshots(
|
|
|
17800
18270
|
await this.renderIFrame(src);
|
|
17801
18271
|
return this;
|
|
17802
18272
|
}
|
|
18273
|
+
};
|
|
18274
|
+
/**
|
|
18275
|
+
* Embed ThoughtSpot AI Conversation.
|
|
18276
|
+
* @deprecated from SDK: 1.38.0 | ThoughtSpot: 10.10.0.cl
|
|
18277
|
+
* Use {@link SpotterEmbed} instead
|
|
18278
|
+
* @group Embed components
|
|
18279
|
+
* @example
|
|
18280
|
+
* ```js
|
|
18281
|
+
* const conversation = new SpotterEmbed('#tsEmbed', {
|
|
18282
|
+
* worksheetId: 'worksheetId',
|
|
18283
|
+
* searchOptions: {
|
|
18284
|
+
* searchQuery: 'searchQuery',
|
|
18285
|
+
* },
|
|
18286
|
+
* });
|
|
18287
|
+
* conversation.render();
|
|
18288
|
+
* ```
|
|
18289
|
+
* @version SDK: 1.37.0 | ThoughtSpot: 10.9.0.cl
|
|
18290
|
+
*/
|
|
18291
|
+
let ConversationEmbed$1 = class ConversationEmbed extends SpotterEmbed$1 {
|
|
18292
|
+
constructor(container, viewConfig) {
|
|
18293
|
+
viewConfig.embedComponentType = 'conversation';
|
|
18294
|
+
super(container, viewConfig);
|
|
18295
|
+
this.viewConfig = viewConfig;
|
|
18296
|
+
}
|
|
17803
18297
|
};
|
|
17804
18298
|
|
|
17805
18299
|
const componentFactory = (EmbedConstructor,
|
|
@@ -18016,6 +18510,24 @@ query GetEurekaVizSnapshots(
|
|
|
18016
18510
|
* @example
|
|
18017
18511
|
* ```tsx
|
|
18018
18512
|
* function Sage() {
|
|
18513
|
+
* return <SpotterEmbed
|
|
18514
|
+
* worksheetId="<worksheet-id-here>"
|
|
18515
|
+
* searchOptions={{
|
|
18516
|
+
* searchQuery: "<search query to start with>"
|
|
18517
|
+
* }}
|
|
18518
|
+
* ... other view config props or event listeners.
|
|
18519
|
+
* />
|
|
18520
|
+
* }
|
|
18521
|
+
* ```
|
|
18522
|
+
*/
|
|
18523
|
+
const SpotterEmbed = componentFactory(SpotterEmbed$1);
|
|
18524
|
+
/**
|
|
18525
|
+
* React component for LLM based conversation BI.
|
|
18526
|
+
* @deprecated from SDK: 1.38.0 | ThoughtSpot: 10.10.0.cl
|
|
18527
|
+
* Use {@link SpotterEmbed} instead
|
|
18528
|
+
* @example
|
|
18529
|
+
* ```tsx
|
|
18530
|
+
* function Sage() {
|
|
18019
18531
|
* return <ConversationEmbed
|
|
18020
18532
|
* worksheetId="<worksheet-id-here>"
|
|
18021
18533
|
* searchOptions={{
|
|
@@ -18027,10 +18539,60 @@ query GetEurekaVizSnapshots(
|
|
|
18027
18539
|
* ```
|
|
18028
18540
|
*/
|
|
18029
18541
|
const ConversationEmbed = componentFactory(ConversationEmbed$1);
|
|
18542
|
+
/**
|
|
18543
|
+
* React component for SpotterAgent embed, which can be integrated inside
|
|
18544
|
+
* chatbots or other conversational interfaces.
|
|
18545
|
+
* @example
|
|
18546
|
+
* ```tsx
|
|
18547
|
+
* function SpotterAgent() {
|
|
18548
|
+
* const ref = useRef();
|
|
18549
|
+
*
|
|
18550
|
+
* const handleSendMessage = async () => {
|
|
18551
|
+
* const { container, error } = await ref.current.sendMessage('show me sales by region');
|
|
18552
|
+
* if (container) {
|
|
18553
|
+
* document.body.appendChild(container);
|
|
18554
|
+
* }
|
|
18555
|
+
* };
|
|
18556
|
+
*
|
|
18557
|
+
* return (
|
|
18558
|
+
* <div>
|
|
18559
|
+
* <SpotterAgentEmbed ref={ref} worksheetId="worksheetId" />
|
|
18560
|
+
* <button onClick={handleSendMessage}>Send Message</button>
|
|
18561
|
+
* </div>
|
|
18562
|
+
* );
|
|
18563
|
+
* }
|
|
18564
|
+
* ```
|
|
18565
|
+
*/
|
|
18566
|
+
const SpotterAgentEmbed = React.forwardRef((props, ref) => {
|
|
18567
|
+
const { className, ...restProps } = props;
|
|
18568
|
+
const serviceRef = React.useRef(null);
|
|
18569
|
+
useDeepCompareEffect(() => {
|
|
18570
|
+
if (serviceRef.current) {
|
|
18571
|
+
serviceRef.current = null;
|
|
18572
|
+
}
|
|
18573
|
+
const configProps = {
|
|
18574
|
+
...restProps,
|
|
18575
|
+
...(className ? { containerClassName: className } : {})
|
|
18576
|
+
};
|
|
18577
|
+
serviceRef.current = new SpotterAgentEmbed$1(configProps);
|
|
18578
|
+
if (ref) {
|
|
18579
|
+
if (typeof ref === 'function') {
|
|
18580
|
+
ref(serviceRef.current);
|
|
18581
|
+
}
|
|
18582
|
+
else {
|
|
18583
|
+
ref.current = serviceRef.current;
|
|
18584
|
+
}
|
|
18585
|
+
}
|
|
18586
|
+
return () => {
|
|
18587
|
+
serviceRef.current = null;
|
|
18588
|
+
};
|
|
18589
|
+
}, [props]);
|
|
18590
|
+
return null;
|
|
18591
|
+
});
|
|
18030
18592
|
/**
|
|
18031
18593
|
* React component for PreRendered Conversation embed.
|
|
18032
18594
|
*
|
|
18033
|
-
* PreRenderedConversationEmbed will preRender the
|
|
18595
|
+
* PreRenderedConversationEmbed will preRender the SpotterEmbed and will be hidden by
|
|
18034
18596
|
* default.
|
|
18035
18597
|
*
|
|
18036
18598
|
* SageEmbed with preRenderId passed will call showPreRender on the embed.
|
|
@@ -18041,11 +18603,11 @@ query GetEurekaVizSnapshots(
|
|
|
18041
18603
|
* }
|
|
18042
18604
|
* ```
|
|
18043
18605
|
* function MyComponent() {
|
|
18044
|
-
* return <
|
|
18606
|
+
* return <SpotterEmbed preRenderId="someId" worksheetId="id" />
|
|
18045
18607
|
* }
|
|
18046
18608
|
* ```
|
|
18047
18609
|
*/
|
|
18048
|
-
const PreRenderedConversationEmbed = componentFactory(
|
|
18610
|
+
const PreRenderedConversationEmbed = componentFactory(SpotterEmbed$1, true);
|
|
18049
18611
|
/**
|
|
18050
18612
|
* Get a reference to the embed component to trigger events on the component.
|
|
18051
18613
|
* @example
|
|
@@ -25503,6 +26065,8 @@ query GetEurekaVizSnapshots(
|
|
|
25503
26065
|
exports.SageEmbed = SageEmbed;
|
|
25504
26066
|
exports.SearchBarEmbed = SearchBarEmbed;
|
|
25505
26067
|
exports.SearchEmbed = SearchEmbed;
|
|
26068
|
+
exports.SpotterAgentEmbed = SpotterAgentEmbed;
|
|
26069
|
+
exports.SpotterEmbed = SpotterEmbed;
|
|
25506
26070
|
exports.getSessionInfo = getSessionInfo;
|
|
25507
26071
|
exports.useEmbedRef = useEmbedRef;
|
|
25508
26072
|
exports.useInit = useInit;
|