@thoughtspot/visual-embed-sdk 1.39.2-alpha.1 → 1.39.2-alpha.3
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 +1 -1
- package/cjs/src/config.spec.js +9 -0
- package/cjs/src/config.spec.js.map +1 -1
- package/cjs/src/embed/app.d.ts +75 -15
- package/cjs/src/embed/app.d.ts.map +1 -1
- package/cjs/src/embed/app.js +68 -9
- package/cjs/src/embed/app.js.map +1 -1
- package/cjs/src/embed/app.spec.js +360 -7
- package/cjs/src/embed/app.spec.js.map +1 -1
- package/cjs/src/embed/bodyless-conversation.d.ts +19 -7
- package/cjs/src/embed/bodyless-conversation.d.ts.map +1 -1
- package/cjs/src/embed/bodyless-conversation.js +24 -4
- package/cjs/src/embed/bodyless-conversation.js.map +1 -1
- package/cjs/src/embed/bodyless-conversation.spec.js +8 -190
- package/cjs/src/embed/bodyless-conversation.spec.js.map +1 -1
- package/cjs/src/embed/conversation.d.ts +2 -60
- package/cjs/src/embed/conversation.d.ts.map +1 -1
- package/cjs/src/embed/conversation.js +1 -9
- package/cjs/src/embed/conversation.js.map +1 -1
- package/cjs/src/embed/conversation.spec.js +0 -102
- package/cjs/src/embed/conversation.spec.js.map +1 -1
- package/cjs/src/embed/liveboard.d.ts +56 -0
- package/cjs/src/embed/liveboard.d.ts.map +1 -1
- package/cjs/src/embed/liveboard.js +46 -0
- package/cjs/src/embed/liveboard.js.map +1 -1
- package/cjs/src/embed/liveboard.spec.js +206 -0
- package/cjs/src/embed/liveboard.spec.js.map +1 -1
- 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 -2
- package/cjs/src/index.d.ts.map +1 -1
- package/cjs/src/index.js +2 -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 -2
- package/cjs/src/react/all-types-export.js.map +1 -1
- package/cjs/src/react/index.d.ts +71 -20
- package/cjs/src/react/index.d.ts.map +1 -1
- package/cjs/src/react/index.js +79 -42
- package/cjs/src/react/index.js.map +1 -1
- package/cjs/src/react/index.spec.js +436 -100
- package/cjs/src/react/index.spec.js.map +1 -1
- package/cjs/src/types.d.ts +46 -4
- package/cjs/src/types.d.ts.map +1 -1
- package/cjs/src/types.js +28 -0
- package/cjs/src/types.js.map +1 -1
- package/cjs/src/utils/graphql/nlsService/conversation-service.d.ts.map +1 -1
- package/cjs/src/utils/graphql/nlsService/conversation-service.js +2 -0
- package/cjs/src/utils/graphql/nlsService/conversation-service.js.map +1 -1
- package/cjs/src/utils/processTrigger.js +2 -1
- package/cjs/src/utils/processTrigger.js.map +1 -1
- package/cjs/src/utils.d.ts +6 -0
- package/cjs/src/utils.d.ts.map +1 -1
- package/cjs/src/utils.js +23 -3
- package/cjs/src/utils.js.map +1 -1
- package/cjs/src/utils.spec.js +237 -1
- package/cjs/src/utils.spec.js.map +1 -1
- package/dist/index-D1pyb7RG.js +7371 -0
- package/dist/index-e3Uw3YFO.js +7371 -0
- package/dist/src/embed/app.d.ts +75 -15
- package/dist/src/embed/app.d.ts.map +1 -1
- package/dist/src/embed/bodyless-conversation.d.ts +19 -7
- package/dist/src/embed/bodyless-conversation.d.ts.map +1 -1
- package/dist/src/embed/conversation.d.ts +2 -60
- package/dist/src/embed/conversation.d.ts.map +1 -1
- package/dist/src/embed/liveboard.d.ts +56 -0
- package/dist/src/embed/liveboard.d.ts.map +1 -1
- package/dist/src/errors.d.ts +1 -0
- package/dist/src/errors.d.ts.map +1 -1
- package/dist/src/index.d.ts +2 -2
- 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 +71 -20
- package/dist/src/react/index.d.ts.map +1 -1
- package/dist/src/types.d.ts +46 -4
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/utils/graphql/nlsService/conversation-service.d.ts.map +1 -1
- package/dist/src/utils.d.ts +6 -0
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/tsembed-react.es.js +276 -74
- package/dist/tsembed-react.js +276 -72
- package/dist/tsembed.es.js +194 -27
- package/dist/tsembed.js +192 -25
- package/dist/visual-embed-sdk-react-full.d.ts +246 -105
- package/dist/visual-embed-sdk-react.d.ts +246 -105
- package/dist/visual-embed-sdk.d.ts +176 -86
- package/lib/package.json +1 -1
- package/lib/src/config.spec.js +9 -0
- package/lib/src/config.spec.js.map +1 -1
- package/lib/src/embed/app.d.ts +75 -15
- package/lib/src/embed/app.d.ts.map +1 -1
- package/lib/src/embed/app.js +68 -9
- package/lib/src/embed/app.js.map +1 -1
- package/lib/src/embed/app.spec.js +361 -8
- package/lib/src/embed/app.spec.js.map +1 -1
- package/lib/src/embed/bodyless-conversation.d.ts +19 -7
- package/lib/src/embed/bodyless-conversation.d.ts.map +1 -1
- package/lib/src/embed/bodyless-conversation.js +23 -4
- package/lib/src/embed/bodyless-conversation.js.map +1 -1
- package/lib/src/embed/bodyless-conversation.spec.js +9 -191
- package/lib/src/embed/bodyless-conversation.spec.js.map +1 -1
- package/lib/src/embed/conversation.d.ts +2 -60
- package/lib/src/embed/conversation.d.ts.map +1 -1
- package/lib/src/embed/conversation.js +2 -10
- package/lib/src/embed/conversation.js.map +1 -1
- package/lib/src/embed/conversation.spec.js +2 -104
- package/lib/src/embed/conversation.spec.js.map +1 -1
- package/lib/src/embed/liveboard.d.ts +56 -0
- package/lib/src/embed/liveboard.d.ts.map +1 -1
- package/lib/src/embed/liveboard.js +47 -1
- package/lib/src/embed/liveboard.js.map +1 -1
- package/lib/src/embed/liveboard.spec.js +206 -0
- package/lib/src/embed/liveboard.spec.js.map +1 -1
- 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 -2
- package/lib/src/index.d.ts.map +1 -1
- package/lib/src/index.js +2 -2
- 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 +71 -20
- package/lib/src/react/index.d.ts.map +1 -1
- package/lib/src/react/index.js +79 -43
- package/lib/src/react/index.js.map +1 -1
- package/lib/src/react/index.spec.js +439 -103
- package/lib/src/react/index.spec.js.map +1 -1
- package/lib/src/types.d.ts +46 -4
- package/lib/src/types.d.ts.map +1 -1
- package/lib/src/types.js +28 -0
- package/lib/src/types.js.map +1 -1
- package/lib/src/utils/graphql/nlsService/conversation-service.d.ts.map +1 -1
- package/lib/src/utils/graphql/nlsService/conversation-service.js +2 -0
- package/lib/src/utils/graphql/nlsService/conversation-service.js.map +1 -1
- package/lib/src/utils/processTrigger.js +2 -1
- package/lib/src/utils/processTrigger.js.map +1 -1
- package/lib/src/utils.d.ts +6 -0
- package/lib/src/utils.d.ts.map +1 -1
- package/lib/src/utils.js +21 -2
- package/lib/src/utils.js.map +1 -1
- package/lib/src/utils.spec.js +238 -2
- package/lib/src/utils.spec.js.map +1 -1
- package/lib/src/visual-embed-sdk.d.ts +178 -88
- package/package.json +1 -1
- package/src/config.spec.ts +11 -0
- package/src/embed/app.spec.ts +451 -8
- package/src/embed/app.ts +131 -27
- package/src/embed/bodyless-conversation.spec.ts +9 -203
- package/src/embed/bodyless-conversation.ts +24 -10
- package/src/embed/conversation.spec.ts +5 -131
- package/src/embed/conversation.ts +10 -82
- package/src/embed/liveboard.spec.ts +254 -1
- package/src/embed/liveboard.ts +96 -5
- package/src/errors.ts +1 -0
- package/src/index.ts +2 -0
- package/src/react/all-types-export.ts +2 -1
- package/src/react/index.spec.tsx +556 -157
- package/src/react/index.tsx +117 -51
- package/src/types.ts +42 -0
- package/src/utils/graphql/nlsService/conversation-service.ts +2 -0
- package/src/utils/processTrigger.ts +1 -1
- package/src/utils.spec.ts +279 -2
- package/src/utils.ts +28 -2
package/dist/tsembed-react.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* @thoughtspot/visual-embed-sdk version 1.39.2-alpha.
|
|
1
|
+
/* @thoughtspot/visual-embed-sdk version 1.39.2-alpha.3 */
|
|
2
2
|
'use client';
|
|
3
3
|
(function (global, factory) {
|
|
4
4
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react')) :
|
|
@@ -421,6 +421,12 @@
|
|
|
421
421
|
* @version SDK: 1.40.0 | ThoughtSpot: 10.11.0.cl
|
|
422
422
|
*/
|
|
423
423
|
HomeLeftNavItem["Spotter"] = "spotter";
|
|
424
|
+
/**
|
|
425
|
+
* Favorites option in the insights left navigation,
|
|
426
|
+
* available when new navigation V3 is enabled.
|
|
427
|
+
* @version SDK: 1.41.0 | ThoughtSpot: 10.12.0.cl
|
|
428
|
+
*/
|
|
429
|
+
HomeLeftNavItem["Favorites"] = "favorites";
|
|
424
430
|
})(exports.HomeLeftNavItem || (exports.HomeLeftNavItem = {}));
|
|
425
431
|
/**
|
|
426
432
|
* A map of the supported runtime filter operations
|
|
@@ -1607,6 +1613,12 @@
|
|
|
1607
1613
|
* @version SDK : 1.40.0 | ThoughtSpot: 10.11.0.cl
|
|
1608
1614
|
*/
|
|
1609
1615
|
EmbedEvent["ExitPresentMode"] = "exitPresentMode";
|
|
1616
|
+
/**
|
|
1617
|
+
* Emitted when a user requests the full height lazy load data.
|
|
1618
|
+
* @version SDK : 1.39.0 | ThoughtSpot : 10.10.0.cl
|
|
1619
|
+
* @hidden
|
|
1620
|
+
*/
|
|
1621
|
+
EmbedEvent["RequestVisibleEmbedCoordinates"] = "requestVisibleEmbedCoordinates";
|
|
1610
1622
|
})(exports.EmbedEvent || (exports.EmbedEvent = {}));
|
|
1611
1623
|
/**
|
|
1612
1624
|
* Event types that can be triggered by the host application
|
|
@@ -2691,6 +2703,19 @@
|
|
|
2691
2703
|
* @version SDK: 1.40.0 | ThoughtSpot: 10.11.0.cl
|
|
2692
2704
|
*/
|
|
2693
2705
|
HostEvent["ExitPresentMode"] = "exitPresentMode";
|
|
2706
|
+
/**
|
|
2707
|
+
* Triggers the full height lazy load data.
|
|
2708
|
+
* @example
|
|
2709
|
+
* ```js
|
|
2710
|
+
* liveboardEmbed.on(EmbedEvent.RequestVisibleEmbedCoordinates, (payload) => {
|
|
2711
|
+
* console.log(payload);
|
|
2712
|
+
* });
|
|
2713
|
+
* ```
|
|
2714
|
+
* @version SDK: 1.39.0 | ThoughtSpot: 10.10.0.cl
|
|
2715
|
+
*
|
|
2716
|
+
* @hidden
|
|
2717
|
+
*/
|
|
2718
|
+
HostEvent["VisibleEmbedCoordinates"] = "visibleEmbedCoordinates";
|
|
2694
2719
|
})(exports.HostEvent || (exports.HostEvent = {}));
|
|
2695
2720
|
/**
|
|
2696
2721
|
* The different visual modes that the data sources panel within
|
|
@@ -2796,6 +2821,7 @@
|
|
|
2796
2821
|
Param["Query"] = "query";
|
|
2797
2822
|
Param["HideHomepageLeftNav"] = "hideHomepageLeftNav";
|
|
2798
2823
|
Param["ModularHomeExperienceEnabled"] = "modularHomeExperience";
|
|
2824
|
+
Param["ListPageVersion"] = "listpageVersion";
|
|
2799
2825
|
Param["PendoTrackingKey"] = "additionalPendoKey";
|
|
2800
2826
|
Param["LiveboardHeaderSticky"] = "isLiveboardHeaderSticky";
|
|
2801
2827
|
Param["IsProductTour"] = "isProductTour";
|
|
@@ -2834,6 +2860,8 @@
|
|
|
2834
2860
|
Param["PrimaryAction"] = "primaryAction";
|
|
2835
2861
|
Param["isSpotterAgentEmbed"] = "isSpotterAgentEmbed";
|
|
2836
2862
|
Param["IsLiveboardStylingAndGroupingEnabled"] = "isLiveboardStylingAndGroupingEnabled";
|
|
2863
|
+
Param["IsLazyLoadingForEmbedEnabled"] = "isLazyLoadingForEmbedEnabled";
|
|
2864
|
+
Param["RootMarginForLazyLoad"] = "rootMarginForLazyLoad";
|
|
2837
2865
|
})(Param || (Param = {}));
|
|
2838
2866
|
/**
|
|
2839
2867
|
* ThoughtSpot application pages include actions and menu commands
|
|
@@ -4455,7 +4483,6 @@
|
|
|
4455
4483
|
function removeTypename(obj) {
|
|
4456
4484
|
if (!obj || typeof obj !== 'object')
|
|
4457
4485
|
return obj;
|
|
4458
|
-
// eslint-disable-next-line no-restricted-syntax
|
|
4459
4486
|
for (const key in obj) {
|
|
4460
4487
|
if (key === '__typename') {
|
|
4461
4488
|
delete obj[key];
|
|
@@ -4484,7 +4511,11 @@
|
|
|
4484
4511
|
if (!(element === null || element === void 0 ? void 0 : element.style))
|
|
4485
4512
|
return;
|
|
4486
4513
|
Object.keys(styleProperties).forEach((styleProperty) => {
|
|
4487
|
-
|
|
4514
|
+
const styleKey = styleProperty;
|
|
4515
|
+
const value = styleProperties[styleKey];
|
|
4516
|
+
if (value !== undefined) {
|
|
4517
|
+
element.style[styleKey] = value.toString();
|
|
4518
|
+
}
|
|
4488
4519
|
});
|
|
4489
4520
|
};
|
|
4490
4521
|
/**
|
|
@@ -4612,6 +4643,22 @@
|
|
|
4612
4643
|
}
|
|
4613
4644
|
}
|
|
4614
4645
|
logger$3.warn('Exit fullscreen API is not supported by this browser.');
|
|
4646
|
+
};
|
|
4647
|
+
const calculateVisibleElementData = (element) => {
|
|
4648
|
+
const rect = element.getBoundingClientRect();
|
|
4649
|
+
const windowHeight = window.innerHeight;
|
|
4650
|
+
const windowWidth = window.innerWidth;
|
|
4651
|
+
const frameRelativeTop = Math.max(rect.top, 0);
|
|
4652
|
+
const frameRelativeLeft = Math.max(rect.left, 0);
|
|
4653
|
+
const frameRelativeBottom = Math.min(windowHeight, rect.bottom);
|
|
4654
|
+
const frameRelativeRight = Math.min(windowWidth, rect.right);
|
|
4655
|
+
const data = {
|
|
4656
|
+
top: Math.max(0, rect.top * -1),
|
|
4657
|
+
height: Math.max(0, frameRelativeBottom - frameRelativeTop),
|
|
4658
|
+
left: Math.max(0, rect.left * -1),
|
|
4659
|
+
width: Math.max(0, frameRelativeRight - frameRelativeLeft),
|
|
4660
|
+
};
|
|
4661
|
+
return data;
|
|
4615
4662
|
};
|
|
4616
4663
|
|
|
4617
4664
|
/**
|
|
@@ -6907,6 +6954,7 @@
|
|
|
6907
6954
|
CSP_FRAME_HOST_VIOLATION_LOG_MESSAGE: 'Please set up CSP correctly for the application to start working. For more information, see https://developers.thoughtspot.com/docs/security-settings#csp-viz-embed-hosts. \n If the issue persists, refer to https://developers.thoughtspot.com/docs/security-settings#csp-viz-embed-hosts',
|
|
6908
6955
|
MISSING_REPORTING_OBSERVER: 'ReportingObserver not supported',
|
|
6909
6956
|
RENDER_CALLED_BEFORE_INIT: 'Looks like render was called before calling init, the render won\'t start until init is called.\nFor more info check\n1. https://developers.thoughtspot.com/docs/Function_init#_init\n2.https://developers.thoughtspot.com/docs/getting-started#initSdk',
|
|
6957
|
+
SPOTTER_AGENT_NOT_INITIALIZED: 'SpotterAgent not initialized',
|
|
6910
6958
|
};
|
|
6911
6959
|
|
|
6912
6960
|
const EndPoints = {
|
|
@@ -15531,7 +15579,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
15531
15579
|
return e;
|
|
15532
15580
|
}
|
|
15533
15581
|
|
|
15534
|
-
var name="@thoughtspot/visual-embed-sdk";var version$1="1.39.2-alpha.
|
|
15582
|
+
var name="@thoughtspot/visual-embed-sdk";var version$1="1.39.2-alpha.3";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};
|
|
15535
15583
|
|
|
15536
15584
|
/**
|
|
15537
15585
|
* Reloads the ThoughtSpot iframe.
|
|
@@ -15554,7 +15602,8 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
15554
15602
|
* @param channel
|
|
15555
15603
|
*/
|
|
15556
15604
|
function postIframeMessage(iFrame, message, thoughtSpotHost, channel) {
|
|
15557
|
-
|
|
15605
|
+
var _a;
|
|
15606
|
+
return (_a = iFrame.contentWindow) === null || _a === void 0 ? void 0 : _a.postMessage(message, thoughtSpotHost, [channel === null || channel === void 0 ? void 0 : channel.port2]);
|
|
15558
15607
|
}
|
|
15559
15608
|
const TRIGGER_TIMEOUT = 30000;
|
|
15560
15609
|
/**
|
|
@@ -17267,7 +17316,6 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
17267
17316
|
/**
|
|
17268
17317
|
* Pages within the ThoughtSpot app that can be embedded.
|
|
17269
17318
|
*/
|
|
17270
|
-
// eslint-disable-next-line no-shadow
|
|
17271
17319
|
exports.Page = void 0;
|
|
17272
17320
|
(function (Page) {
|
|
17273
17321
|
/**
|
|
@@ -17353,16 +17401,46 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
17353
17401
|
*/
|
|
17354
17402
|
HomePage["Modular"] = "v2";
|
|
17355
17403
|
})(HomePage || (HomePage = {}));
|
|
17404
|
+
/**
|
|
17405
|
+
* Define the version of the list page
|
|
17406
|
+
* @version SDK: 1.40.0 | ThoughtSpot: 10.12.0.cl
|
|
17407
|
+
*/
|
|
17408
|
+
var ListPage;
|
|
17409
|
+
(function (ListPage) {
|
|
17410
|
+
/**
|
|
17411
|
+
* List (v2) is the traditional List Experience.
|
|
17412
|
+
* It serves as the foundational version of the list page.
|
|
17413
|
+
*/
|
|
17414
|
+
ListPage["List"] = "v2";
|
|
17415
|
+
/**
|
|
17416
|
+
* ListWithUXChanges (v3) introduces the new updated list page with UX changes.
|
|
17417
|
+
*/
|
|
17418
|
+
ListPage["ListWithUXChanges"] = "v3";
|
|
17419
|
+
})(ListPage || (ListPage = {}));
|
|
17356
17420
|
/**
|
|
17357
17421
|
* Embeds full ThoughtSpot experience in a host application.
|
|
17358
17422
|
* @group Embed components
|
|
17359
17423
|
*/
|
|
17360
17424
|
let AppEmbed$1 = class AppEmbed extends V1Embed {
|
|
17361
|
-
// eslint-disable-next-line no-useless-constructor
|
|
17362
17425
|
constructor(domSelector, viewConfig) {
|
|
17363
17426
|
viewConfig.embedComponentType = 'AppEmbed';
|
|
17364
17427
|
super(domSelector, viewConfig);
|
|
17365
17428
|
this.defaultHeight = '100%';
|
|
17429
|
+
this.sendFullHeightLazyLoadData = () => {
|
|
17430
|
+
const data = calculateVisibleElementData(this.iFrame);
|
|
17431
|
+
this.trigger(exports.HostEvent.VisibleEmbedCoordinates, data);
|
|
17432
|
+
};
|
|
17433
|
+
/**
|
|
17434
|
+
* This is a handler for the RequestVisibleEmbedCoordinates event.
|
|
17435
|
+
* It is used to send the visible coordinates data to the host application.
|
|
17436
|
+
* @param data The event payload
|
|
17437
|
+
* @param responder The responder function
|
|
17438
|
+
*/
|
|
17439
|
+
this.requestVisibleEmbedCoordinatesHandler = (data, responder) => {
|
|
17440
|
+
logger$3.info('Sending RequestVisibleEmbedCoordinates', data);
|
|
17441
|
+
const visibleCoordinatesData = calculateVisibleElementData(this.iFrame);
|
|
17442
|
+
responder({ type: exports.EmbedEvent.RequestVisibleEmbedCoordinates, data: visibleCoordinatesData });
|
|
17443
|
+
};
|
|
17366
17444
|
/**
|
|
17367
17445
|
* Set the iframe height as per the computed height received
|
|
17368
17446
|
* from the ThoughtSpot app.
|
|
@@ -17371,6 +17449,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
17371
17449
|
this.updateIFrameHeight = (data) => {
|
|
17372
17450
|
var _a;
|
|
17373
17451
|
this.setIFrameHeight(Math.max(data.data, (_a = this.iFrame) === null || _a === void 0 ? void 0 : _a.scrollHeight));
|
|
17452
|
+
this.sendFullHeightLazyLoadData();
|
|
17374
17453
|
};
|
|
17375
17454
|
this.embedIframeCenter = (data, responder) => {
|
|
17376
17455
|
const obj = this.getIframeCenter();
|
|
@@ -17400,6 +17479,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
17400
17479
|
this.on(exports.EmbedEvent.RouteChange, this.setIframeHeightForNonEmbedLiveboard);
|
|
17401
17480
|
this.on(exports.EmbedEvent.EmbedHeight, this.updateIFrameHeight);
|
|
17402
17481
|
this.on(exports.EmbedEvent.EmbedIframeCenter, this.embedIframeCenter);
|
|
17482
|
+
this.on(exports.EmbedEvent.RequestVisibleEmbedCoordinates, this.requestVisibleEmbedCoordinatesHandler);
|
|
17403
17483
|
}
|
|
17404
17484
|
}
|
|
17405
17485
|
/**
|
|
@@ -17407,9 +17487,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
17407
17487
|
* embedded Liveboard or visualization.
|
|
17408
17488
|
*/
|
|
17409
17489
|
getEmbedParams() {
|
|
17410
|
-
const { tag, hideObjects, liveboardV2, showPrimaryNavbar, disableProfileAndHelp, hideHamburger, hideObjectSearch, hideNotification, hideApplicationSwitcher, hideOrgSwitcher, enableSearchAssist, fullHeight, dataPanelV2 = false, hideLiveboardHeader = false, showLiveboardTitle = true, showLiveboardDescription = true, hideHomepageLeftNav = false, modularHomeExperience = false, isLiveboardHeaderSticky = true, enableAskSage, collapseSearchBarInitially = false, enable2ColumnLayout, enableCustomColumnGroups = false, isOnBeforeGetVizDataInterceptEnabled = false,
|
|
17411
|
-
/* eslint-disable-next-line max-len */
|
|
17412
|
-
dataPanelCustomGroupsAccordionInitialState = DataPanelCustomColumnGroupsAccordionState.EXPAND_ALL, collapseSearchBar = true, isLiveboardCompactHeaderEnabled = false, showLiveboardVerifiedBadge = true, showLiveboardReverifyBanner = true, hideIrrelevantChipsInLiveboardTabs = false, homePageSearchBarMode, isUnifiedSearchExperienceEnabled = true, enablePendoHelp = true, discoveryExperience, coverAndFilterOptionInPDF = false, isLiveboardStylingAndGroupingEnabled, } = this.viewConfig;
|
|
17490
|
+
const { tag, hideObjects, liveboardV2, showPrimaryNavbar, disableProfileAndHelp, hideHamburger, hideObjectSearch, hideNotification, hideApplicationSwitcher, hideOrgSwitcher, enableSearchAssist, fullHeight, dataPanelV2 = false, hideLiveboardHeader = false, showLiveboardTitle = true, showLiveboardDescription = true, hideHomepageLeftNav = false, modularHomeExperience = false, isLiveboardHeaderSticky = true, enableAskSage, collapseSearchBarInitially = false, enable2ColumnLayout, enableCustomColumnGroups = false, isOnBeforeGetVizDataInterceptEnabled = false, dataPanelCustomGroupsAccordionInitialState = DataPanelCustomColumnGroupsAccordionState.EXPAND_ALL, collapseSearchBar = true, isLiveboardCompactHeaderEnabled = false, showLiveboardVerifiedBadge = true, showLiveboardReverifyBanner = true, hideIrrelevantChipsInLiveboardTabs = false, homePageSearchBarMode, isUnifiedSearchExperienceEnabled = true, enablePendoHelp = true, discoveryExperience, coverAndFilterOptionInPDF = false, isLiveboardStylingAndGroupingEnabled, } = this.viewConfig;
|
|
17413
17491
|
let params = {};
|
|
17414
17492
|
params[Param.PrimaryNavHidden] = !showPrimaryNavbar;
|
|
17415
17493
|
params[Param.HideProfleAndHelp] = !!disableProfileAndHelp;
|
|
@@ -17438,6 +17516,10 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
17438
17516
|
}
|
|
17439
17517
|
if (fullHeight === true) {
|
|
17440
17518
|
params[Param.fullHeight] = true;
|
|
17519
|
+
if (this.viewConfig.lazyLoadingForFullHeight) {
|
|
17520
|
+
params[Param.IsLazyLoadingForEmbedEnabled] = true;
|
|
17521
|
+
params[Param.RootMarginForLazyLoad] = this.viewConfig.lazyLoadingMargin;
|
|
17522
|
+
}
|
|
17441
17523
|
}
|
|
17442
17524
|
if (tag) {
|
|
17443
17525
|
params[Param.Tag] = tag;
|
|
@@ -17458,7 +17540,6 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
17458
17540
|
params[Param.enableAskSage] = enableAskSage;
|
|
17459
17541
|
}
|
|
17460
17542
|
if (isOnBeforeGetVizDataInterceptEnabled) {
|
|
17461
|
-
/* eslint-disable-next-line max-len */
|
|
17462
17543
|
params[Param.IsOnBeforeGetVizDataInterceptEnabled] = isOnBeforeGetVizDataInterceptEnabled;
|
|
17463
17544
|
}
|
|
17464
17545
|
if (homePageSearchBarMode) {
|
|
@@ -17479,11 +17560,9 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
17479
17560
|
=== DataPanelCustomColumnGroupsAccordionState.COLLAPSE_ALL
|
|
17480
17561
|
|| dataPanelCustomGroupsAccordionInitialState
|
|
17481
17562
|
=== DataPanelCustomColumnGroupsAccordionState.EXPAND_FIRST) {
|
|
17482
|
-
/* eslint-disable-next-line max-len */
|
|
17483
17563
|
params[Param.DataPanelCustomGroupsAccordionInitialState] = dataPanelCustomGroupsAccordionInitialState;
|
|
17484
17564
|
}
|
|
17485
17565
|
else {
|
|
17486
|
-
/* eslint-disable-next-line max-len */
|
|
17487
17566
|
params[Param.DataPanelCustomGroupsAccordionInitialState] = DataPanelCustomColumnGroupsAccordionState.EXPAND_ALL;
|
|
17488
17567
|
}
|
|
17489
17568
|
if (discoveryExperience) {
|
|
@@ -17496,6 +17575,10 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
17496
17575
|
if (discoveryExperience.homePage === HomePage.Modular) {
|
|
17497
17576
|
params[Param.ModularHomeExperienceEnabled] = true;
|
|
17498
17577
|
}
|
|
17578
|
+
// listPageVersion v3 will enable the new list page
|
|
17579
|
+
if (discoveryExperience.listPageVersion === ListPage.ListWithUXChanges) {
|
|
17580
|
+
params[Param.ListPageVersion] = discoveryExperience.listPageVersion;
|
|
17581
|
+
}
|
|
17499
17582
|
}
|
|
17500
17583
|
const queryParams = getQueryParamString(params, true);
|
|
17501
17584
|
return queryParams;
|
|
@@ -17583,6 +17666,30 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
17583
17666
|
this.iFrame.src = `${iframeSrc.split(currentPath)[0]}${currentPath}/${path.replace(/^\/?#?\//, '')}`;
|
|
17584
17667
|
}
|
|
17585
17668
|
}
|
|
17669
|
+
/**
|
|
17670
|
+
* Destroys the ThoughtSpot embed, and remove any nodes from the DOM.
|
|
17671
|
+
* @version SDK: 1.39.0 | ThoughtSpot: 10.10.0.cl
|
|
17672
|
+
*/
|
|
17673
|
+
destroy() {
|
|
17674
|
+
super.destroy();
|
|
17675
|
+
this.unregisterLazyLoadEvents();
|
|
17676
|
+
}
|
|
17677
|
+
postRender() {
|
|
17678
|
+
this.registerLazyLoadEvents();
|
|
17679
|
+
}
|
|
17680
|
+
registerLazyLoadEvents() {
|
|
17681
|
+
if (this.viewConfig.fullHeight && this.viewConfig.lazyLoadingForFullHeight) {
|
|
17682
|
+
// TODO: Use passive: true, install modernizr to check for passive
|
|
17683
|
+
window.addEventListener('resize', this.sendFullHeightLazyLoadData);
|
|
17684
|
+
window.addEventListener('scroll', this.sendFullHeightLazyLoadData, true);
|
|
17685
|
+
}
|
|
17686
|
+
}
|
|
17687
|
+
unregisterLazyLoadEvents() {
|
|
17688
|
+
if (this.viewConfig.fullHeight && this.viewConfig.lazyLoadingForFullHeight) {
|
|
17689
|
+
window.removeEventListener('resize', this.sendFullHeightLazyLoadData);
|
|
17690
|
+
window.removeEventListener('scroll', this.sendFullHeightLazyLoadData);
|
|
17691
|
+
}
|
|
17692
|
+
}
|
|
17586
17693
|
/**
|
|
17587
17694
|
* Renders the embedded application pages in the ThoughtSpot app.
|
|
17588
17695
|
* @param renderOptions An object containing the page ID
|
|
@@ -17592,6 +17699,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
17592
17699
|
await super.render();
|
|
17593
17700
|
const src = this.getIFrameSrc();
|
|
17594
17701
|
await this.renderV1Embed(src);
|
|
17702
|
+
this.postRender();
|
|
17595
17703
|
return this;
|
|
17596
17704
|
}
|
|
17597
17705
|
};
|
|
@@ -17696,6 +17804,21 @@ query GetEurekaVizSnapshots(
|
|
|
17696
17804
|
viewConfig.embedComponentType = 'LiveboardEmbed';
|
|
17697
17805
|
super(domSelector, viewConfig);
|
|
17698
17806
|
this.defaultHeight = 500;
|
|
17807
|
+
this.sendFullHeightLazyLoadData = () => {
|
|
17808
|
+
const data = calculateVisibleElementData(this.iFrame);
|
|
17809
|
+
this.trigger(exports.HostEvent.VisibleEmbedCoordinates, data);
|
|
17810
|
+
};
|
|
17811
|
+
/**
|
|
17812
|
+
* This is a handler for the RequestVisibleEmbedCoordinates event.
|
|
17813
|
+
* It is used to send the visible coordinates data to the host application.
|
|
17814
|
+
* @param data The event payload
|
|
17815
|
+
* @param responder The responder function
|
|
17816
|
+
*/
|
|
17817
|
+
this.requestVisibleEmbedCoordinatesHandler = (data, responder) => {
|
|
17818
|
+
logger$3.info('Sending RequestVisibleEmbedCoordinates', data);
|
|
17819
|
+
const visibleCoordinatesData = calculateVisibleElementData(this.iFrame);
|
|
17820
|
+
responder({ type: exports.EmbedEvent.RequestVisibleEmbedCoordinates, data: visibleCoordinatesData });
|
|
17821
|
+
};
|
|
17699
17822
|
/**
|
|
17700
17823
|
* Set the iframe height as per the computed height received
|
|
17701
17824
|
* from the ThoughtSpot app.
|
|
@@ -17703,6 +17826,7 @@ query GetEurekaVizSnapshots(
|
|
|
17703
17826
|
*/
|
|
17704
17827
|
this.updateIFrameHeight = (data) => {
|
|
17705
17828
|
this.setIFrameHeight(Math.max(data.data, this.defaultHeight));
|
|
17829
|
+
this.sendFullHeightLazyLoadData();
|
|
17706
17830
|
};
|
|
17707
17831
|
this.embedIframeCenter = (data, responder) => {
|
|
17708
17832
|
const obj = this.getIframeCenter();
|
|
@@ -17736,6 +17860,7 @@ query GetEurekaVizSnapshots(
|
|
|
17736
17860
|
this.on(exports.EmbedEvent.RouteChange, this.setIframeHeightForNonEmbedLiveboard);
|
|
17737
17861
|
this.on(exports.EmbedEvent.EmbedHeight, this.updateIFrameHeight);
|
|
17738
17862
|
this.on(exports.EmbedEvent.EmbedIframeCenter, this.embedIframeCenter);
|
|
17863
|
+
this.on(exports.EmbedEvent.RequestVisibleEmbedCoordinates, this.requestVisibleEmbedCoordinatesHandler);
|
|
17739
17864
|
}
|
|
17740
17865
|
}
|
|
17741
17866
|
/**
|
|
@@ -17750,6 +17875,10 @@ query GetEurekaVizSnapshots(
|
|
|
17750
17875
|
|| this.viewConfig.preventPinboardFilterRemoval;
|
|
17751
17876
|
if (fullHeight === true) {
|
|
17752
17877
|
params[Param.fullHeight] = true;
|
|
17878
|
+
if (this.viewConfig.lazyLoadingForFullHeight) {
|
|
17879
|
+
params[Param.IsLazyLoadingForEmbedEnabled] = true;
|
|
17880
|
+
params[Param.RootMarginForLazyLoad] = this.viewConfig.lazyLoadingMargin;
|
|
17881
|
+
}
|
|
17753
17882
|
}
|
|
17754
17883
|
if (defaultHeight) {
|
|
17755
17884
|
this.defaultHeight = defaultHeight;
|
|
@@ -17905,6 +18034,30 @@ query GetEurekaVizSnapshots(
|
|
|
17905
18034
|
}
|
|
17906
18035
|
return super.trigger(messageType, dataWithVizId);
|
|
17907
18036
|
}
|
|
18037
|
+
/**
|
|
18038
|
+
* Destroys the ThoughtSpot embed, and remove any nodes from the DOM.
|
|
18039
|
+
* @version SDK: 1.39.0 | ThoughtSpot: 10.10.0.cl
|
|
18040
|
+
*/
|
|
18041
|
+
destroy() {
|
|
18042
|
+
super.destroy();
|
|
18043
|
+
this.unregisterLazyLoadEvents();
|
|
18044
|
+
}
|
|
18045
|
+
postRender() {
|
|
18046
|
+
this.registerLazyLoadEvents();
|
|
18047
|
+
}
|
|
18048
|
+
registerLazyLoadEvents() {
|
|
18049
|
+
if (this.viewConfig.fullHeight && this.viewConfig.lazyLoadingForFullHeight) {
|
|
18050
|
+
// TODO: Use passive: true, install modernizr to check for passive
|
|
18051
|
+
window.addEventListener('resize', this.sendFullHeightLazyLoadData);
|
|
18052
|
+
window.addEventListener('scroll', this.sendFullHeightLazyLoadData, true);
|
|
18053
|
+
}
|
|
18054
|
+
}
|
|
18055
|
+
unregisterLazyLoadEvents() {
|
|
18056
|
+
if (this.viewConfig.fullHeight && this.viewConfig.lazyLoadingForFullHeight) {
|
|
18057
|
+
window.removeEventListener('resize', this.sendFullHeightLazyLoadData);
|
|
18058
|
+
window.removeEventListener('scroll', this.sendFullHeightLazyLoadData);
|
|
18059
|
+
}
|
|
18060
|
+
}
|
|
17908
18061
|
/**
|
|
17909
18062
|
* Render an embedded ThoughtSpot Liveboard or visualization
|
|
17910
18063
|
* @param renderOptions An object specifying the Liveboard ID,
|
|
@@ -17915,6 +18068,7 @@ query GetEurekaVizSnapshots(
|
|
|
17915
18068
|
const src = this.getIFrameSrc();
|
|
17916
18069
|
await this.renderV1Embed(src);
|
|
17917
18070
|
this.showPreviewLoader();
|
|
18071
|
+
this.postRender();
|
|
17918
18072
|
return this;
|
|
17919
18073
|
}
|
|
17920
18074
|
navigateToLiveboard(liveboardId, vizId, activeTabId) {
|
|
@@ -18311,6 +18465,8 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
18311
18465
|
});
|
|
18312
18466
|
const data = responses[0].data;
|
|
18313
18467
|
return {
|
|
18468
|
+
convId: this.conversationId,
|
|
18469
|
+
messageId: responses[0].msgId,
|
|
18314
18470
|
data: data.asstRespData.nlsAnsData.sageQuerySuggestions[0],
|
|
18315
18471
|
error: null,
|
|
18316
18472
|
};
|
|
@@ -18329,7 +18485,7 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
18329
18485
|
}
|
|
18330
18486
|
}
|
|
18331
18487
|
|
|
18332
|
-
class ConversationMessage extends TsEmbed {
|
|
18488
|
+
let ConversationMessage$1 = class ConversationMessage extends TsEmbed {
|
|
18333
18489
|
constructor(container, viewConfig) {
|
|
18334
18490
|
viewConfig.embedComponentType = 'bodyless-conversation';
|
|
18335
18491
|
super(container, viewConfig);
|
|
@@ -18361,7 +18517,7 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
18361
18517
|
await this.renderIFrame(src);
|
|
18362
18518
|
return this;
|
|
18363
18519
|
}
|
|
18364
|
-
}
|
|
18520
|
+
};
|
|
18365
18521
|
/**
|
|
18366
18522
|
* Create a conversation embed, which can be integrated inside
|
|
18367
18523
|
* chatbots or other conversational interfaces.
|
|
@@ -18381,7 +18537,7 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
18381
18537
|
* @group Embed components
|
|
18382
18538
|
* @version SDK: 1.37.0 | ThoughtSpot: 10.9.0.cl
|
|
18383
18539
|
*/
|
|
18384
|
-
|
|
18540
|
+
class SpotterAgentEmbed {
|
|
18385
18541
|
constructor(viewConfig) {
|
|
18386
18542
|
this.viewConfig = viewConfig;
|
|
18387
18543
|
const embedConfig = getEmbedConfig();
|
|
@@ -18393,10 +18549,7 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
18393
18549
|
return { error };
|
|
18394
18550
|
}
|
|
18395
18551
|
const container = document.createElement('div');
|
|
18396
|
-
|
|
18397
|
-
container.className = this.viewConfig.containerClassName;
|
|
18398
|
-
}
|
|
18399
|
-
const embed = new ConversationMessage(container, {
|
|
18552
|
+
const embed = new ConversationMessage$1(container, {
|
|
18400
18553
|
...this.viewConfig,
|
|
18401
18554
|
sessionId: data.sessionId,
|
|
18402
18555
|
genNo: data.genNo,
|
|
@@ -18406,7 +18559,29 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
18406
18559
|
await embed.render();
|
|
18407
18560
|
return { container, viz: embed };
|
|
18408
18561
|
}
|
|
18409
|
-
|
|
18562
|
+
/**
|
|
18563
|
+
* Send a message to the conversation service and return only the data.
|
|
18564
|
+
* @param userMessage - The message to send to the conversation service.
|
|
18565
|
+
* @returns The data from the conversation service.
|
|
18566
|
+
*/
|
|
18567
|
+
async sendMessageData(userMessage) {
|
|
18568
|
+
try {
|
|
18569
|
+
const { data, error } = await this.conversationService.sendMessage(userMessage);
|
|
18570
|
+
if (error) {
|
|
18571
|
+
return { error };
|
|
18572
|
+
}
|
|
18573
|
+
return { data: {
|
|
18574
|
+
sessionId: data.sessionId,
|
|
18575
|
+
genNo: data.genNo,
|
|
18576
|
+
acSessionId: data.stateKey.transactionId,
|
|
18577
|
+
acGenNo: data.stateKey.generationNumber,
|
|
18578
|
+
} };
|
|
18579
|
+
}
|
|
18580
|
+
catch (error) {
|
|
18581
|
+
return { error: error };
|
|
18582
|
+
}
|
|
18583
|
+
}
|
|
18584
|
+
}
|
|
18410
18585
|
|
|
18411
18586
|
/**
|
|
18412
18587
|
*
|
|
@@ -18473,7 +18648,7 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
18473
18648
|
this.viewConfig = viewConfig;
|
|
18474
18649
|
}
|
|
18475
18650
|
getIframeSrc() {
|
|
18476
|
-
const { worksheetId, searchOptions, disableSourceSelection, hideSourceSelection, dataPanelV2, showSpotterLimitations, hideSampleQuestions,
|
|
18651
|
+
const { worksheetId, searchOptions, disableSourceSelection, hideSourceSelection, dataPanelV2, showSpotterLimitations, hideSampleQuestions, } = this.viewConfig;
|
|
18477
18652
|
const path = 'insights/conv-assist';
|
|
18478
18653
|
if (!worksheetId) {
|
|
18479
18654
|
this.handleError(ERROR_MESSAGE.SPOTTER_EMBED_WORKSHEED_ID_NOT_FOUND);
|
|
@@ -18500,14 +18675,6 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
18500
18675
|
if (queryParamsString) {
|
|
18501
18676
|
query = `?${queryParamsString}`;
|
|
18502
18677
|
}
|
|
18503
|
-
const filterQuery = getFilterQuery(runtimeFilters || []);
|
|
18504
|
-
if (filterQuery && !excludeRuntimeFiltersfromURL) {
|
|
18505
|
-
query += `&${filterQuery}`;
|
|
18506
|
-
}
|
|
18507
|
-
const parameterQuery = getRuntimeParameters(runtimeParameters || []);
|
|
18508
|
-
if (parameterQuery && !excludeRuntimeParametersfromURL) {
|
|
18509
|
-
query += `&${parameterQuery}`;
|
|
18510
|
-
}
|
|
18511
18678
|
const tsPostHashParams = this.getThoughtSpotPostUrlParams({
|
|
18512
18679
|
worksheet: worksheetId,
|
|
18513
18680
|
query: (searchOptions === null || searchOptions === void 0 ? void 0 : searchOptions.searchQuery) || '',
|
|
@@ -18789,55 +18956,34 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
18789
18956
|
* ```
|
|
18790
18957
|
*/
|
|
18791
18958
|
const ConversationEmbed = componentFactory(ConversationEmbed$1);
|
|
18959
|
+
const ConversationMessage = componentFactory(ConversationMessage$1);
|
|
18792
18960
|
/**
|
|
18793
|
-
* React component for
|
|
18794
|
-
*
|
|
18961
|
+
* React component for displaying individual conversation messages from SpotterAgent.
|
|
18962
|
+
*
|
|
18963
|
+
* This component renders a single message response from your ThoughtSpot conversation,
|
|
18964
|
+
* showing charts, visualizations, or text responses based on the user's query.
|
|
18965
|
+
*
|
|
18795
18966
|
* @example
|
|
18796
18967
|
* ```tsx
|
|
18797
|
-
*
|
|
18798
|
-
*
|
|
18968
|
+
* const { sendMessage } = useSpotterAgent({ worksheetId: 'worksheetId' });
|
|
18969
|
+
* const result = await sendMessage('show me sales by region');
|
|
18799
18970
|
*
|
|
18800
|
-
*
|
|
18801
|
-
*
|
|
18802
|
-
*
|
|
18803
|
-
* document.body.appendChild(container);
|
|
18804
|
-
* }
|
|
18805
|
-
* };
|
|
18971
|
+
* if (!result.error) {
|
|
18972
|
+
* // Simple usage - just pass the message data
|
|
18973
|
+
* <SpotterMessage message={result.message} />
|
|
18806
18974
|
*
|
|
18807
|
-
*
|
|
18808
|
-
*
|
|
18809
|
-
*
|
|
18810
|
-
*
|
|
18811
|
-
*
|
|
18812
|
-
* );
|
|
18975
|
+
* // With optional query for context
|
|
18976
|
+
* <SpotterMessage
|
|
18977
|
+
* message={result.message}
|
|
18978
|
+
* query={result.query}
|
|
18979
|
+
* />
|
|
18813
18980
|
* }
|
|
18814
18981
|
* ```
|
|
18982
|
+
* @version SDK: 1.39.0 | ThoughtSpot: 10.11.0.cl
|
|
18815
18983
|
*/
|
|
18816
|
-
const
|
|
18817
|
-
const {
|
|
18818
|
-
|
|
18819
|
-
useDeepCompareEffect(() => {
|
|
18820
|
-
if (serviceRef.current) {
|
|
18821
|
-
serviceRef.current = null;
|
|
18822
|
-
}
|
|
18823
|
-
const configProps = {
|
|
18824
|
-
...restProps,
|
|
18825
|
-
...(className ? { containerClassName: className } : {})
|
|
18826
|
-
};
|
|
18827
|
-
serviceRef.current = new SpotterAgentEmbed$1(configProps);
|
|
18828
|
-
if (ref) {
|
|
18829
|
-
if (typeof ref === 'function') {
|
|
18830
|
-
ref(serviceRef.current);
|
|
18831
|
-
}
|
|
18832
|
-
else {
|
|
18833
|
-
ref.current = serviceRef.current;
|
|
18834
|
-
}
|
|
18835
|
-
}
|
|
18836
|
-
return () => {
|
|
18837
|
-
serviceRef.current = null;
|
|
18838
|
-
};
|
|
18839
|
-
}, [props]);
|
|
18840
|
-
return null;
|
|
18984
|
+
const SpotterMessage = React.forwardRef((props, ref) => {
|
|
18985
|
+
const { message, query: _, ...otherProps } = props;
|
|
18986
|
+
return (React.createElement(ConversationMessage, { ref: ref, ...message, ...otherProps }));
|
|
18841
18987
|
});
|
|
18842
18988
|
/**
|
|
18843
18989
|
* React component for PreRendered Conversation embed.
|
|
@@ -18897,6 +19043,62 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
18897
19043
|
ref.current = authEE;
|
|
18898
19044
|
}, [config]);
|
|
18899
19045
|
return ref;
|
|
19046
|
+
}
|
|
19047
|
+
/**
|
|
19048
|
+
* React hook for interacting with SpotterAgent AI conversations.
|
|
19049
|
+
*
|
|
19050
|
+
* This hook provides a sendMessage function that allows you to send natural language
|
|
19051
|
+
* queries to your data and get back AI-generated responses with visualizations.
|
|
19052
|
+
*
|
|
19053
|
+
* @param config - Configuration object containing worksheetId and other options
|
|
19054
|
+
* @returns Object with sendMessage function that returns conversation results
|
|
19055
|
+
* @example
|
|
19056
|
+
* ```tsx
|
|
19057
|
+
* const { sendMessage } = useSpotterAgent({ worksheetId: 'worksheetId' });
|
|
19058
|
+
*
|
|
19059
|
+
* const handleQuery = async () => {
|
|
19060
|
+
* const result = await sendMessage('show me sales by region');
|
|
19061
|
+
*
|
|
19062
|
+
* if (!result.error) {
|
|
19063
|
+
* // Display the message response
|
|
19064
|
+
* <SpotterMessage message={result.message} />
|
|
19065
|
+
* } else {
|
|
19066
|
+
* console.error('Error:', result.error);
|
|
19067
|
+
* }
|
|
19068
|
+
* };
|
|
19069
|
+
* ```
|
|
19070
|
+
* @version SDK: 1.39.0 | ThoughtSpot: 10.11.0.cl
|
|
19071
|
+
*/
|
|
19072
|
+
function useSpotterAgent(config) {
|
|
19073
|
+
const serviceRef = React.useRef(null);
|
|
19074
|
+
useDeepCompareEffect(() => {
|
|
19075
|
+
if (serviceRef.current) {
|
|
19076
|
+
serviceRef.current = null;
|
|
19077
|
+
}
|
|
19078
|
+
serviceRef.current = new SpotterAgentEmbed(config);
|
|
19079
|
+
return () => {
|
|
19080
|
+
serviceRef.current = null;
|
|
19081
|
+
};
|
|
19082
|
+
}, [config]);
|
|
19083
|
+
const sendMessage = React.useCallback(async (query) => {
|
|
19084
|
+
if (!serviceRef.current) {
|
|
19085
|
+
return { error: new Error(ERROR_MESSAGE.SPOTTER_AGENT_NOT_INITIALIZED) };
|
|
19086
|
+
}
|
|
19087
|
+
const result = await serviceRef.current.sendMessageData(query);
|
|
19088
|
+
if (result.error) {
|
|
19089
|
+
return { error: result.error };
|
|
19090
|
+
}
|
|
19091
|
+
return {
|
|
19092
|
+
query: query,
|
|
19093
|
+
message: {
|
|
19094
|
+
...result.data,
|
|
19095
|
+
worksheetId: config.worksheetId,
|
|
19096
|
+
},
|
|
19097
|
+
};
|
|
19098
|
+
}, [config.worksheetId]);
|
|
19099
|
+
return {
|
|
19100
|
+
sendMessage,
|
|
19101
|
+
};
|
|
18900
19102
|
}
|
|
18901
19103
|
|
|
18902
19104
|
const ALIAS = Symbol.for('yaml.alias');
|
|
@@ -26303,6 +26505,7 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
26303
26505
|
|
|
26304
26506
|
exports.AppEmbed = AppEmbed;
|
|
26305
26507
|
exports.ConversationEmbed = ConversationEmbed;
|
|
26508
|
+
exports.ConversationMessage = ConversationMessage;
|
|
26306
26509
|
exports.LiveboardEmbed = LiveboardEmbed;
|
|
26307
26510
|
exports.PinboardEmbed = PinboardEmbed;
|
|
26308
26511
|
exports.PreRenderedAppEmbed = PreRenderedAppEmbed;
|
|
@@ -26315,10 +26518,11 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
26315
26518
|
exports.SageEmbed = SageEmbed;
|
|
26316
26519
|
exports.SearchBarEmbed = SearchBarEmbed;
|
|
26317
26520
|
exports.SearchEmbed = SearchEmbed;
|
|
26318
|
-
exports.SpotterAgentEmbed = SpotterAgentEmbed;
|
|
26319
26521
|
exports.SpotterEmbed = SpotterEmbed;
|
|
26522
|
+
exports.SpotterMessage = SpotterMessage;
|
|
26320
26523
|
exports.getSessionInfo = getSessionInfo;
|
|
26321
26524
|
exports.useEmbedRef = useEmbedRef;
|
|
26322
26525
|
exports.useInit = useInit;
|
|
26526
|
+
exports.useSpotterAgent = useSpotterAgent;
|
|
26323
26527
|
|
|
26324
26528
|
}));
|