@thoughtspot/visual-embed-sdk 1.49.1 → 1.49.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/package.json +1 -1
- package/cjs/src/css-variables.d.ts +17 -0
- package/cjs/src/css-variables.d.ts.map +1 -1
- package/cjs/src/embed/app.d.ts.map +1 -1
- package/cjs/src/embed/app.js +4 -1
- package/cjs/src/embed/app.js.map +1 -1
- package/cjs/src/embed/app.spec.js +97 -0
- package/cjs/src/embed/app.spec.js.map +1 -1
- package/cjs/src/embed/conversation.d.ts +8 -0
- package/cjs/src/embed/conversation.d.ts.map +1 -1
- package/cjs/src/embed/conversation.js +2 -1
- package/cjs/src/embed/conversation.js.map +1 -1
- package/cjs/src/embed/conversation.spec.js +12 -0
- package/cjs/src/embed/conversation.spec.js.map +1 -1
- package/cjs/src/embed/events.spec.js +5 -0
- package/cjs/src/embed/events.spec.js.map +1 -1
- package/cjs/src/embed/liveboard.d.ts.map +1 -1
- package/cjs/src/embed/liveboard.js +4 -1
- package/cjs/src/embed/liveboard.js.map +1 -1
- package/cjs/src/embed/liveboard.spec.js +11 -0
- package/cjs/src/embed/liveboard.spec.js.map +1 -1
- package/cjs/src/embed/ts-embed.d.ts +38 -0
- package/cjs/src/embed/ts-embed.d.ts.map +1 -1
- package/cjs/src/embed/ts-embed.js +166 -9
- package/cjs/src/embed/ts-embed.js.map +1 -1
- package/cjs/src/embed/ts-embed.spec.js +237 -0
- package/cjs/src/embed/ts-embed.spec.js.map +1 -1
- package/cjs/src/types.d.ts +87 -4
- package/cjs/src/types.d.ts.map +1 -1
- package/cjs/src/types.js +47 -3
- package/cjs/src/types.js.map +1 -1
- package/cjs/src/utils/processTrigger.d.ts.map +1 -1
- package/cjs/src/utils/processTrigger.js +6 -5
- package/cjs/src/utils/processTrigger.js.map +1 -1
- package/cjs/src/utils/processTrigger.spec.js +13 -0
- package/cjs/src/utils/processTrigger.spec.js.map +1 -1
- package/cjs/src/utils.d.ts +10 -0
- package/cjs/src/utils.d.ts.map +1 -1
- package/cjs/src/utils.js +23 -1
- package/cjs/src/utils.js.map +1 -1
- package/cjs/src/utils.spec.js +48 -0
- package/cjs/src/utils.spec.js.map +1 -1
- package/dist/{index-B6Rn561t.js → index-CS7yJ2Jj.js} +1 -1
- package/dist/src/css-variables.d.ts +17 -0
- package/dist/src/css-variables.d.ts.map +1 -1
- package/dist/src/embed/app.d.ts.map +1 -1
- package/dist/src/embed/conversation.d.ts +8 -0
- 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.d.ts +38 -0
- package/dist/src/embed/ts-embed.d.ts.map +1 -1
- package/dist/src/types.d.ts +87 -4
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/utils/processTrigger.d.ts.map +1 -1
- package/dist/src/utils.d.ts +10 -0
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/tsembed-react.es.js +253 -23
- package/dist/tsembed-react.js +252 -22
- package/dist/tsembed.es.js +253 -23
- package/dist/tsembed.js +252 -22
- package/dist/visual-embed-sdk-react-full.d.ts +148 -3
- package/dist/visual-embed-sdk-react.d.ts +148 -3
- package/dist/visual-embed-sdk.d.ts +148 -3
- package/lib/package.json +1 -1
- package/lib/src/css-variables.d.ts +17 -0
- package/lib/src/css-variables.d.ts.map +1 -1
- package/lib/src/embed/app.d.ts.map +1 -1
- package/lib/src/embed/app.js +4 -1
- package/lib/src/embed/app.js.map +1 -1
- package/lib/src/embed/app.spec.js +97 -0
- package/lib/src/embed/app.spec.js.map +1 -1
- package/lib/src/embed/conversation.d.ts +8 -0
- package/lib/src/embed/conversation.d.ts.map +1 -1
- package/lib/src/embed/conversation.js +2 -1
- package/lib/src/embed/conversation.js.map +1 -1
- package/lib/src/embed/conversation.spec.js +12 -0
- package/lib/src/embed/conversation.spec.js.map +1 -1
- package/lib/src/embed/events.spec.js +5 -0
- package/lib/src/embed/events.spec.js.map +1 -1
- package/lib/src/embed/liveboard.d.ts.map +1 -1
- package/lib/src/embed/liveboard.js +4 -1
- package/lib/src/embed/liveboard.js.map +1 -1
- package/lib/src/embed/liveboard.spec.js +11 -0
- package/lib/src/embed/liveboard.spec.js.map +1 -1
- package/lib/src/embed/ts-embed.d.ts +38 -0
- package/lib/src/embed/ts-embed.d.ts.map +1 -1
- package/lib/src/embed/ts-embed.js +167 -10
- package/lib/src/embed/ts-embed.js.map +1 -1
- package/lib/src/embed/ts-embed.spec.js +237 -0
- package/lib/src/embed/ts-embed.spec.js.map +1 -1
- package/lib/src/types.d.ts +87 -4
- package/lib/src/types.d.ts.map +1 -1
- package/lib/src/types.js +47 -3
- package/lib/src/types.js.map +1 -1
- package/lib/src/utils/processTrigger.d.ts.map +1 -1
- package/lib/src/utils/processTrigger.js +6 -5
- package/lib/src/utils/processTrigger.js.map +1 -1
- package/lib/src/utils/processTrigger.spec.js +13 -0
- package/lib/src/utils/processTrigger.spec.js.map +1 -1
- package/lib/src/utils.d.ts +10 -0
- package/lib/src/utils.d.ts.map +1 -1
- package/lib/src/utils.js +21 -0
- package/lib/src/utils.js.map +1 -1
- package/lib/src/utils.spec.js +49 -1
- package/lib/src/utils.spec.js.map +1 -1
- package/lib/src/visual-embed-sdk.d.ts +148 -3
- package/package.json +1 -1
- package/src/css-variables.ts +20 -0
- package/src/embed/app.spec.ts +109 -0
- package/src/embed/app.ts +4 -0
- package/src/embed/conversation.spec.ts +17 -0
- package/src/embed/conversation.ts +10 -0
- package/src/embed/events.spec.ts +7 -0
- package/src/embed/liveboard.spec.ts +15 -0
- package/src/embed/liveboard.ts +4 -0
- package/src/embed/ts-embed.spec.ts +294 -0
- package/src/embed/ts-embed.ts +180 -9
- package/src/types.ts +86 -3
- package/src/utils/processTrigger.spec.ts +23 -0
- package/src/utils/processTrigger.ts +8 -6
- package/src/utils.spec.ts +63 -0
- package/src/utils.ts +24 -0
package/dist/tsembed-react.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* @thoughtspot/visual-embed-sdk version 1.49.
|
|
1
|
+
/* @thoughtspot/visual-embed-sdk version 1.49.2 */
|
|
2
2
|
'use client';
|
|
3
3
|
(function (global, factory) {
|
|
4
4
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react')) :
|
|
@@ -2433,11 +2433,30 @@
|
|
|
2433
2433
|
/**
|
|
2434
2434
|
* Navigate to a specific page in the embedded ThoughtSpot application.
|
|
2435
2435
|
* This is the same as calling `appEmbed.navigateToPage(path, true)`.
|
|
2436
|
-
*
|
|
2437
|
-
*
|
|
2436
|
+
*
|
|
2437
|
+
* Accepts either a plain value or an object with `path`
|
|
2438
|
+
* and an optional `replace` flag.
|
|
2439
|
+
*
|
|
2440
|
+
* @param data - A string path, a numeric history delta, or an object
|
|
2441
|
+
* `{ path: string | number, replace?: boolean }`.
|
|
2442
|
+
* - `path` — the route to navigate to, or a history delta such as `1`
|
|
2443
|
+
* or `-1` (calls `window.history.go()`).
|
|
2444
|
+
* - `replace` — when `true`, replaces the current history entry instead
|
|
2445
|
+
* of pushing a new one (uses `window.location.replace`).
|
|
2446
|
+
*
|
|
2438
2447
|
* @example
|
|
2439
2448
|
* ```js
|
|
2440
|
-
*
|
|
2449
|
+
* // Preferred: use navigateToPage directly
|
|
2450
|
+
* appEmbed.navigateToPage(-1);
|
|
2451
|
+
*
|
|
2452
|
+
* // Numeric delta — go back one step
|
|
2453
|
+
* appEmbed.trigger(HostEvent.Navigate, -1);
|
|
2454
|
+
*
|
|
2455
|
+
* // String path — push a new history entry
|
|
2456
|
+
* appEmbed.trigger(HostEvent.Navigate, 'home');
|
|
2457
|
+
*
|
|
2458
|
+
* // Object format — replace current history entry
|
|
2459
|
+
* appEmbed.trigger(HostEvent.Navigate, { path: 'home', replace: true }); // SDK: 1.51.0 | ThoughtSpot Cloud: 26.8.0.cl
|
|
2441
2460
|
* ```
|
|
2442
2461
|
* @version SDK: 1.12.0 | ThoughtSpot: 8.4.0.cl, 8.4.1.sw
|
|
2443
2462
|
*/
|
|
@@ -4426,6 +4445,7 @@
|
|
|
4426
4445
|
Param["EnableLiveboardDataCache"] = "enableLiveboardDataCache";
|
|
4427
4446
|
Param["SpotterFileUploadEnabled"] = "spotterFileUploadEnabled";
|
|
4428
4447
|
Param["SpotterFileUploadFileTypes"] = "spotterFileUploadFileTypes";
|
|
4448
|
+
Param["IsStarterPromptsEnabled"] = "enableStarterPrompts";
|
|
4429
4449
|
})(Param || (Param = {}));
|
|
4430
4450
|
/**
|
|
4431
4451
|
* ThoughtSpot application pages include actions and menu commands
|
|
@@ -5068,6 +5088,16 @@
|
|
|
5068
5088
|
* @version SDK: 1.9.0 | ThoughtSpot: 8.1.0.cl, 8.4.1.sw
|
|
5069
5089
|
*/
|
|
5070
5090
|
Action["AddToFavorites"] = "addToFavorites";
|
|
5091
|
+
/**
|
|
5092
|
+
* Remove from Favorites option in home page v3 sidebar.
|
|
5093
|
+
* Allows removing an object from the user's favorites list from home-page v3 sidebar.
|
|
5094
|
+
* @version SDK: 1.51.0 | ThoughtSpot Cloud: 26.8.0.cl
|
|
5095
|
+
* @example
|
|
5096
|
+
* ```js
|
|
5097
|
+
* disabledActions: [Action.RemoveFromFavorites]
|
|
5098
|
+
* ```
|
|
5099
|
+
*/
|
|
5100
|
+
Action["RemoveFromFavorites"] = "removeFromFavorites";
|
|
5071
5101
|
/**
|
|
5072
5102
|
* The edit icon on Liveboards (Classic experience).
|
|
5073
5103
|
* @example
|
|
@@ -6125,6 +6155,20 @@
|
|
|
6125
6155
|
* ```
|
|
6126
6156
|
*/
|
|
6127
6157
|
Action["SpotterViz"] = "spotterViz";
|
|
6158
|
+
/**
|
|
6159
|
+
* The reference-mode toggle button inside the SpotterViz chat input.
|
|
6160
|
+
* When users enable reference mode, clicking tiles, filters, or
|
|
6161
|
+
* parameters adds them as chat context. Hide this action to remove
|
|
6162
|
+
* the reference-mode capability entirely.
|
|
6163
|
+
* Visible by default.
|
|
6164
|
+
* @version SDK: 1.51.0 | ThoughtSpot Cloud: 26.8.0.cl
|
|
6165
|
+
* @example
|
|
6166
|
+
* ```js
|
|
6167
|
+
* hiddenActions: [Action.SpotterVizReferenceMode]
|
|
6168
|
+
* disabledActions: [Action.SpotterVizReferenceMode]
|
|
6169
|
+
* ```
|
|
6170
|
+
*/
|
|
6171
|
+
Action["SpotterVizReferenceMode"] = "spotterVizReferenceMode";
|
|
6128
6172
|
/**
|
|
6129
6173
|
* Clears browser cache and fetches new data for liveboard ChartViz Containers.
|
|
6130
6174
|
* Requires `enableLiveboardDataCache` to be enabled.
|
|
@@ -6601,7 +6645,7 @@
|
|
|
6601
6645
|
TableContentDensity["Compact"] = "COMPACT";
|
|
6602
6646
|
})(TableContentDensity || (TableContentDensity = {}));
|
|
6603
6647
|
|
|
6604
|
-
var version$1="1.49.
|
|
6648
|
+
var version$1="1.49.2";var pkg = {version:version$1};
|
|
6605
6649
|
|
|
6606
6650
|
const { version } = pkg;
|
|
6607
6651
|
|
|
@@ -6948,6 +6992,27 @@
|
|
|
6948
6992
|
function getDOMNode(domSelector) {
|
|
6949
6993
|
return typeof domSelector === 'string' ? document.querySelector(domSelector) : domSelector;
|
|
6950
6994
|
}
|
|
6995
|
+
/**
|
|
6996
|
+
* Resolves a CSS selector to an element. `document.querySelector` cannot pierce
|
|
6997
|
+
* shadow boundaries, so when the document lookup misses and a reference node is
|
|
6998
|
+
* provided, this also searches the shadow root the reference node lives in —
|
|
6999
|
+
* letting a selector target an element inside the same shadow root as the embed
|
|
7000
|
+
* instead of silently falling back to the light DOM.
|
|
7001
|
+
* @param selector CSS selector string.
|
|
7002
|
+
* @param referenceNode Node whose shadow root is searched when the document lookup misses.
|
|
7003
|
+
*/
|
|
7004
|
+
function querySelectorAcrossShadowRoot(selector, referenceNode) {
|
|
7005
|
+
var _a;
|
|
7006
|
+
const fromDocument = document.querySelector(selector);
|
|
7007
|
+
if (fromDocument) {
|
|
7008
|
+
return fromDocument;
|
|
7009
|
+
}
|
|
7010
|
+
const rootNode = (_a = referenceNode === null || referenceNode === void 0 ? void 0 : referenceNode.getRootNode) === null || _a === void 0 ? void 0 : _a.call(referenceNode);
|
|
7011
|
+
if (typeof ShadowRoot !== 'undefined' && rootNode instanceof ShadowRoot) {
|
|
7012
|
+
return rootNode.querySelector(selector);
|
|
7013
|
+
}
|
|
7014
|
+
return null;
|
|
7015
|
+
}
|
|
6951
7016
|
const deepMerge = (target, source) => merge(target, source);
|
|
6952
7017
|
const getOperationNameFromQuery = (query) => {
|
|
6953
7018
|
const regex = /(?:query|mutation)\s+(\w+)/;
|
|
@@ -19461,8 +19526,14 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
19461
19526
|
}
|
|
19462
19527
|
}
|
|
19463
19528
|
const channel = new MessageChannel();
|
|
19529
|
+
// Close the messageChannel and resolve the promise if timeout.
|
|
19530
|
+
const timeoutId = setTimeout(() => {
|
|
19531
|
+
channel.port1.close();
|
|
19532
|
+
res(new Error(ERROR_MESSAGE.TRIGGER_TIMED_OUT));
|
|
19533
|
+
}, TRIGGER_TIMEOUT);
|
|
19464
19534
|
channel.port1.onmessage = ({ data: responseData }) => {
|
|
19465
19535
|
var _a;
|
|
19536
|
+
clearTimeout(timeoutId);
|
|
19466
19537
|
channel.port1.close();
|
|
19467
19538
|
const error = (responseData === null || responseData === void 0 ? void 0 : responseData.error) || ((_a = responseData === null || responseData === void 0 ? void 0 : responseData.data) === null || _a === void 0 ? void 0 : _a.error);
|
|
19468
19539
|
if (error) {
|
|
@@ -19472,11 +19543,6 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
19472
19543
|
res(responseData);
|
|
19473
19544
|
}
|
|
19474
19545
|
};
|
|
19475
|
-
// Close the messageChannel and resolve the promise if timeout.
|
|
19476
|
-
setTimeout(() => {
|
|
19477
|
-
channel.port1.close();
|
|
19478
|
-
res(new Error(ERROR_MESSAGE.TRIGGER_TIMED_OUT));
|
|
19479
|
-
}, TRIGGER_TIMEOUT);
|
|
19480
19546
|
return postIframeMessage(iFrame, { type: messageType, data, context }, thoughtSpotHost, channel);
|
|
19481
19547
|
});
|
|
19482
19548
|
}
|
|
@@ -20241,6 +20307,14 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
20241
20307
|
*/
|
|
20242
20308
|
const THOUGHTSPOT_PARAM_PREFIX = 'ts-';
|
|
20243
20309
|
const TS_EMBED_ID = '_thoughtspot-embed';
|
|
20310
|
+
/**
|
|
20311
|
+
* dataset key used to stash a custom preRenderContainer's original inline
|
|
20312
|
+
* `position` while we override it to `relative`. Stored on the container (not
|
|
20313
|
+
* per-instance) so the override can be reverted on destroy even when multiple
|
|
20314
|
+
* pre-rendered embeds share the same container.
|
|
20315
|
+
*/
|
|
20316
|
+
const PRERENDER_CONTAINER_ORIGINAL_POSITION_KEY = 'tsEmbedOriginalPosition';
|
|
20317
|
+
const PRERENDER_WRAPPER_ID_PREFIX = 'tsEmbed-pre-render-wrapper-';
|
|
20244
20318
|
/**
|
|
20245
20319
|
* The event id map from v2 event names to v1 event id
|
|
20246
20320
|
* v1 events are the classic embed events implemented in Blink v1
|
|
@@ -20276,6 +20350,8 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
20276
20350
|
*/
|
|
20277
20351
|
this.shouldEncodeUrlQueryParams = false;
|
|
20278
20352
|
this.defaultHiddenActions = [exports.Action.ReportError];
|
|
20353
|
+
this.preRenderContainerEl = null;
|
|
20354
|
+
this.containerScrollListener = null;
|
|
20279
20355
|
/**
|
|
20280
20356
|
* Handler for fullscreen change events
|
|
20281
20357
|
*/
|
|
@@ -21141,6 +21217,89 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
21141
21217
|
placeholder.id = id.placeHolder;
|
|
21142
21218
|
return placeholder;
|
|
21143
21219
|
}
|
|
21220
|
+
/**
|
|
21221
|
+
* Resolves the configured preRenderContainer to a live element, falling
|
|
21222
|
+
* back to `document.body`. A string selector is re-queried on every call so
|
|
21223
|
+
* a remounted container (E.g.: React replacing the node) resolves to the
|
|
21224
|
+
* fresh element; an element passed directly cannot be re-resolved.
|
|
21225
|
+
*/
|
|
21226
|
+
resolvePreRenderContainerTarget() {
|
|
21227
|
+
var _a;
|
|
21228
|
+
const containerConfig = this.viewConfig.preRenderContainer;
|
|
21229
|
+
let container = null;
|
|
21230
|
+
if (typeof containerConfig === 'string') {
|
|
21231
|
+
try {
|
|
21232
|
+
// Resolve against the host's shadow root too, so a selector can
|
|
21233
|
+
// target a container inside the same shadow DOM as the embed —
|
|
21234
|
+
// document.querySelector alone cannot pierce shadow boundaries.
|
|
21235
|
+
container = querySelectorAcrossShadowRoot(containerConfig, this.hostElement);
|
|
21236
|
+
}
|
|
21237
|
+
catch (e) {
|
|
21238
|
+
logger$3.error(`Invalid CSS selector for preRenderContainer: ${containerConfig}`, e);
|
|
21239
|
+
}
|
|
21240
|
+
}
|
|
21241
|
+
else if (containerConfig) {
|
|
21242
|
+
container = containerConfig;
|
|
21243
|
+
}
|
|
21244
|
+
return (_a = container) !== null && _a !== void 0 ? _a : document.body;
|
|
21245
|
+
}
|
|
21246
|
+
/**
|
|
21247
|
+
* Makes the container a positioning context for the absolutely positioned
|
|
21248
|
+
* wrapper, stashing the original inline `position` on the element (once) so
|
|
21249
|
+
* destroy() can restore it exactly, leaving no trace. Recording it on the
|
|
21250
|
+
* element rather than per-instance lets the override be reverted even when
|
|
21251
|
+
* embeds share the same container.
|
|
21252
|
+
*/
|
|
21253
|
+
applyPreRenderContainerPositioning(container) {
|
|
21254
|
+
if (container === document.body) {
|
|
21255
|
+
return;
|
|
21256
|
+
}
|
|
21257
|
+
const pos = window.getComputedStyle(container).position;
|
|
21258
|
+
if (pos === 'static') {
|
|
21259
|
+
if (container.dataset[PRERENDER_CONTAINER_ORIGINAL_POSITION_KEY] === undefined) {
|
|
21260
|
+
container.dataset[PRERENDER_CONTAINER_ORIGINAL_POSITION_KEY] = container.style.position;
|
|
21261
|
+
}
|
|
21262
|
+
container.style.position = 'relative';
|
|
21263
|
+
}
|
|
21264
|
+
}
|
|
21265
|
+
/**
|
|
21266
|
+
* Re-attaches the wrapper to a live container when the previously resolved
|
|
21267
|
+
* one has been detached or no longer holds the wrapper — e.g. the host app
|
|
21268
|
+
* remounted a custom preRenderContainer, which would otherwise leave a stale
|
|
21269
|
+
* reference and collapse the wrapper. Only string selectors can be
|
|
21270
|
+
* re-resolved; a container passed as an element is left untouched.
|
|
21271
|
+
*/
|
|
21272
|
+
reconcilePreRenderContainer() {
|
|
21273
|
+
const wrapper = this.preRenderWrapper;
|
|
21274
|
+
const stored = this.preRenderContainerEl;
|
|
21275
|
+
// Nothing to reconcile until this instance resolved its container.
|
|
21276
|
+
if (!wrapper || !stored) {
|
|
21277
|
+
return;
|
|
21278
|
+
}
|
|
21279
|
+
const storedIsLive = stored === document.body || document.contains(stored);
|
|
21280
|
+
if (storedIsLive && stored.contains(wrapper)) {
|
|
21281
|
+
return;
|
|
21282
|
+
}
|
|
21283
|
+
const resolved = this.resolvePreRenderContainerTarget();
|
|
21284
|
+
// Re-resolution yielded the same (still stale) element — nothing we can
|
|
21285
|
+
// do, e.g. a detached container passed as an HTMLElement.
|
|
21286
|
+
if (resolved === stored && stored.contains(wrapper)) {
|
|
21287
|
+
return;
|
|
21288
|
+
}
|
|
21289
|
+
if (this.containerScrollListener && stored !== resolved) {
|
|
21290
|
+
if (stored !== document.body) {
|
|
21291
|
+
stored.removeEventListener('scroll', this.containerScrollListener);
|
|
21292
|
+
}
|
|
21293
|
+
if (resolved !== document.body) {
|
|
21294
|
+
resolved.addEventListener('scroll', this.containerScrollListener);
|
|
21295
|
+
}
|
|
21296
|
+
}
|
|
21297
|
+
this.applyPreRenderContainerPositioning(resolved);
|
|
21298
|
+
if (wrapper.parentNode !== resolved) {
|
|
21299
|
+
resolved.appendChild(wrapper);
|
|
21300
|
+
}
|
|
21301
|
+
this.preRenderContainerEl = resolved;
|
|
21302
|
+
}
|
|
21144
21303
|
insertIntoDOMForPreRender(child) {
|
|
21145
21304
|
const preRenderChild = this.createPreRenderChild(child);
|
|
21146
21305
|
const preRenderWrapper = this.createPreRenderWrapper();
|
|
@@ -21160,7 +21319,10 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
21160
21319
|
else {
|
|
21161
21320
|
this.hidePreRender();
|
|
21162
21321
|
}
|
|
21163
|
-
|
|
21322
|
+
const targetContainer = this.resolvePreRenderContainerTarget();
|
|
21323
|
+
this.preRenderContainerEl = targetContainer;
|
|
21324
|
+
this.applyPreRenderContainerPositioning(targetContainer);
|
|
21325
|
+
targetContainer.appendChild(preRenderWrapper);
|
|
21164
21326
|
}
|
|
21165
21327
|
insertIntoDOM(child) {
|
|
21166
21328
|
var _a;
|
|
@@ -21599,6 +21761,50 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
21599
21761
|
tsParams = tsParams ? `?${tsParams}` : '';
|
|
21600
21762
|
return tsParams;
|
|
21601
21763
|
}
|
|
21764
|
+
/**
|
|
21765
|
+
* Reverts the custom preRenderContainer's `position` to the value it had
|
|
21766
|
+
* before we overrode it to `relative` (see insertIntoDOMForPreRender).
|
|
21767
|
+
*
|
|
21768
|
+
* We restore the original inline value rather than forcing `static`, and we
|
|
21769
|
+
* skip the restore if another preRender wrapper is still mounted inside the
|
|
21770
|
+
* same container — a shared container still needs the positioning context.
|
|
21771
|
+
*/
|
|
21772
|
+
restorePreRenderContainerPosition() {
|
|
21773
|
+
const container = this.preRenderContainerEl;
|
|
21774
|
+
if (!container || container === document.body) {
|
|
21775
|
+
return;
|
|
21776
|
+
}
|
|
21777
|
+
// Drop our reference up front so a destroyed embed never pins a
|
|
21778
|
+
// detached container in memory; restoration uses the local handle.
|
|
21779
|
+
this.preRenderContainerEl = null;
|
|
21780
|
+
const originalPosition = container.dataset[PRERENDER_CONTAINER_ORIGINAL_POSITION_KEY];
|
|
21781
|
+
if (originalPosition === undefined) {
|
|
21782
|
+
// We never overrode this container's position; nothing to restore.
|
|
21783
|
+
return;
|
|
21784
|
+
}
|
|
21785
|
+
// This instance's own wrapper has already been removed by now, so any
|
|
21786
|
+
// match here belongs to another embed still sharing the container — it
|
|
21787
|
+
// continues to rely on the positioning context, so leave it in place.
|
|
21788
|
+
const hasOtherWrapper = container.querySelector(`[id^="${PRERENDER_WRAPPER_ID_PREFIX}"]`);
|
|
21789
|
+
if (hasOtherWrapper) {
|
|
21790
|
+
return;
|
|
21791
|
+
}
|
|
21792
|
+
container.style.position = originalPosition;
|
|
21793
|
+
delete container.dataset[PRERENDER_CONTAINER_ORIGINAL_POSITION_KEY];
|
|
21794
|
+
}
|
|
21795
|
+
/**
|
|
21796
|
+
* Detaches and clears the container scroll listener, if one is attached.
|
|
21797
|
+
*/
|
|
21798
|
+
removeContainerScrollListener() {
|
|
21799
|
+
if (!this.containerScrollListener) {
|
|
21800
|
+
return;
|
|
21801
|
+
}
|
|
21802
|
+
const customContainer = this.preRenderContainerEl && this.preRenderContainerEl !== document.body
|
|
21803
|
+
? this.preRenderContainerEl
|
|
21804
|
+
: null;
|
|
21805
|
+
customContainer === null || customContainer === void 0 ? void 0 : customContainer.removeEventListener('scroll', this.containerScrollListener);
|
|
21806
|
+
this.containerScrollListener = null;
|
|
21807
|
+
}
|
|
21602
21808
|
/**
|
|
21603
21809
|
* Destroys the ThoughtSpot embed, and remove any nodes from the DOM.
|
|
21604
21810
|
* @version SDK: 1.19.1 | ThoughtSpot: *
|
|
@@ -21607,8 +21813,10 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
21607
21813
|
var _a, _b, _c;
|
|
21608
21814
|
try {
|
|
21609
21815
|
this.removeFullscreenChangeHandler();
|
|
21816
|
+
this.removeContainerScrollListener();
|
|
21610
21817
|
this.unsubscribeToEvents();
|
|
21611
21818
|
(_a = this.preRenderWrapper) === null || _a === void 0 ? void 0 : _a.remove();
|
|
21819
|
+
this.restorePreRenderContainerPosition();
|
|
21612
21820
|
if (!this.isRendered) {
|
|
21613
21821
|
return;
|
|
21614
21822
|
}
|
|
@@ -21718,15 +21926,19 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
21718
21926
|
}
|
|
21719
21927
|
this.hostElement.appendChild(this.insertedDomEl);
|
|
21720
21928
|
this.syncPreRenderStyle();
|
|
21929
|
+
const customContainer = this.preRenderContainerEl && this.preRenderContainerEl !== document.body
|
|
21930
|
+
? this.preRenderContainerEl
|
|
21931
|
+
: null;
|
|
21932
|
+
if (customContainer && !this.containerScrollListener) {
|
|
21933
|
+
this.containerScrollListener = () => this.syncPreRenderStyle();
|
|
21934
|
+
customContainer.addEventListener('scroll', this.containerScrollListener);
|
|
21935
|
+
}
|
|
21721
21936
|
if (!this.viewConfig.doNotTrackPreRenderSize) {
|
|
21722
21937
|
const observeTarget = (_a = this.insertedDomEl) !== null && _a !== void 0 ? _a : this.hostElement;
|
|
21723
21938
|
this.resizeObserver = new ResizeObserver((entries) => {
|
|
21724
21939
|
entries.forEach((entry) => {
|
|
21725
|
-
if (entry.
|
|
21726
|
-
|
|
21727
|
-
width: `${entry.contentRect.width}px`,
|
|
21728
|
-
height: `${entry.contentRect.height}px`,
|
|
21729
|
-
});
|
|
21940
|
+
if (entry.target === observeTarget) {
|
|
21941
|
+
this.syncPreRenderStyle();
|
|
21730
21942
|
}
|
|
21731
21943
|
});
|
|
21732
21944
|
});
|
|
@@ -21758,14 +21970,24 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
21758
21970
|
* is not defined or not found.
|
|
21759
21971
|
*/
|
|
21760
21972
|
syncPreRenderStyle() {
|
|
21973
|
+
var _a;
|
|
21761
21974
|
if (!this.isPreRenderConnected() || !this.getPreRenderPlaceHolderElement()) {
|
|
21762
21975
|
logger$3.error(ERROR_MESSAGE.SYNC_STYLE_CALLED_BEFORE_RENDER);
|
|
21763
21976
|
return;
|
|
21764
21977
|
}
|
|
21978
|
+
// Self-heal if the resolved container was remounted/detached, so we
|
|
21979
|
+
// never measure a stale node (which would collapse the wrapper).
|
|
21980
|
+
this.reconcilePreRenderContainer();
|
|
21765
21981
|
const elBoundingClient = this.getPreRenderPlaceHolderElement().getBoundingClientRect();
|
|
21982
|
+
const containerEl = this.preRenderContainerEl && this.preRenderContainerEl !== document.body
|
|
21983
|
+
? this.preRenderContainerEl
|
|
21984
|
+
: null;
|
|
21985
|
+
const containerRect = (_a = containerEl === null || containerEl === void 0 ? void 0 : containerEl.getBoundingClientRect()) !== null && _a !== void 0 ? _a : { x: 0, y: 0 };
|
|
21986
|
+
const scrollX = containerEl ? containerEl.scrollLeft : window.scrollX;
|
|
21987
|
+
const scrollY = containerEl ? containerEl.scrollTop : window.scrollY;
|
|
21766
21988
|
setStyleProperties(this.preRenderWrapper, {
|
|
21767
|
-
top: `${elBoundingClient.y +
|
|
21768
|
-
left: `${elBoundingClient.x +
|
|
21989
|
+
top: `${elBoundingClient.y - containerRect.y + scrollY}px`,
|
|
21990
|
+
left: `${elBoundingClient.x - containerRect.x + scrollX}px`,
|
|
21769
21991
|
width: `${elBoundingClient.width}px`,
|
|
21770
21992
|
height: `${elBoundingClient.height}px`,
|
|
21771
21993
|
position: 'absolute',
|
|
@@ -21792,6 +22014,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
21792
22014
|
overflow: 'hidden',
|
|
21793
22015
|
};
|
|
21794
22016
|
setStyleProperties(this.preRenderWrapper, preRenderHideStyles);
|
|
22017
|
+
this.removeContainerScrollListener();
|
|
21795
22018
|
if (this.resizeObserver) {
|
|
21796
22019
|
this.resizeObserver.disconnect();
|
|
21797
22020
|
}
|
|
@@ -21810,7 +22033,7 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
21810
22033
|
*/
|
|
21811
22034
|
getPreRenderIds() {
|
|
21812
22035
|
return {
|
|
21813
|
-
wrapper:
|
|
22036
|
+
wrapper: `${PRERENDER_WRAPPER_ID_PREFIX}${this.viewConfig.preRenderId}`,
|
|
21814
22037
|
child: `tsEmbed-pre-render-child-${this.viewConfig.preRenderId}`,
|
|
21815
22038
|
placeHolder: `tsEmbed-pre-render-placeholder-${this.viewConfig.preRenderId}`,
|
|
21816
22039
|
};
|
|
@@ -22519,12 +22742,15 @@ mutation GetUnsavedAnswerTML($session: BachSessionIdInput!, $exportDependencies:
|
|
|
22519
22742
|
}
|
|
22520
22743
|
// Handle spotterChatConfig params
|
|
22521
22744
|
if (spotterChatConfig) {
|
|
22522
|
-
const { hideToolResponseCardBranding, toolResponseCardBrandingLabel, spotterFileUploadEnabled, spotterFileUploadFileTypes, } = spotterChatConfig;
|
|
22745
|
+
const { hideToolResponseCardBranding, toolResponseCardBrandingLabel, spotterFileUploadEnabled, spotterFileUploadFileTypes, enableStarterPrompts, } = spotterChatConfig;
|
|
22523
22746
|
setParamIfDefined(params, Param.HideToolResponseCardBranding, hideToolResponseCardBranding, true);
|
|
22524
22747
|
setParamIfDefined(params, Param.ToolResponseCardBrandingLabel, toolResponseCardBrandingLabel);
|
|
22525
22748
|
if (spotterFileUploadEnabled !== undefined) {
|
|
22526
22749
|
params[Param.SpotterFileUploadEnabled] = spotterFileUploadEnabled;
|
|
22527
22750
|
}
|
|
22751
|
+
if (enableStarterPrompts !== undefined) {
|
|
22752
|
+
params[Param.IsStarterPromptsEnabled] = enableStarterPrompts;
|
|
22753
|
+
}
|
|
22528
22754
|
if (spotterFileUploadFileTypes !== undefined) {
|
|
22529
22755
|
params[Param.SpotterFileUploadFileTypes] = JSON.stringify(spotterFileUploadFileTypes);
|
|
22530
22756
|
}
|
|
@@ -23080,12 +23306,15 @@ query GetEurekaVizSnapshots(
|
|
|
23080
23306
|
}
|
|
23081
23307
|
// Handle spotterChatConfig params
|
|
23082
23308
|
if (spotterChatConfig) {
|
|
23083
|
-
const { hideToolResponseCardBranding, toolResponseCardBrandingLabel, spotterFileUploadEnabled, spotterFileUploadFileTypes, } = spotterChatConfig;
|
|
23309
|
+
const { hideToolResponseCardBranding, toolResponseCardBrandingLabel, spotterFileUploadEnabled, spotterFileUploadFileTypes, enableStarterPrompts, } = spotterChatConfig;
|
|
23084
23310
|
setParamIfDefined(params, Param.HideToolResponseCardBranding, hideToolResponseCardBranding, true);
|
|
23085
23311
|
setParamIfDefined(params, Param.ToolResponseCardBrandingLabel, toolResponseCardBrandingLabel);
|
|
23086
23312
|
if (spotterFileUploadEnabled !== undefined) {
|
|
23087
23313
|
params[Param.SpotterFileUploadEnabled] = spotterFileUploadEnabled;
|
|
23088
23314
|
}
|
|
23315
|
+
if (enableStarterPrompts !== undefined) {
|
|
23316
|
+
params[Param.IsStarterPromptsEnabled] = enableStarterPrompts;
|
|
23317
|
+
}
|
|
23089
23318
|
if (spotterFileUploadFileTypes !== undefined) {
|
|
23090
23319
|
params[Param.SpotterFileUploadFileTypes] = JSON.stringify(spotterFileUploadFileTypes);
|
|
23091
23320
|
}
|
|
@@ -23922,10 +24151,11 @@ query SendMessage($params: Input_convassist_SendMessageRequest) {
|
|
|
23922
24151
|
setParamIfDefined(queryParams, Param.EnableStopAnswerGenerationEmbed, enableStopAnswerGenerationEmbed, true);
|
|
23923
24152
|
// Handle spotterChatConfig params
|
|
23924
24153
|
if (spotterChatConfig) {
|
|
23925
|
-
const { hideToolResponseCardBranding, toolResponseCardBrandingLabel, spotterFileUploadEnabled, spotterFileUploadFileTypes, } = spotterChatConfig;
|
|
24154
|
+
const { hideToolResponseCardBranding, toolResponseCardBrandingLabel, spotterFileUploadEnabled, spotterFileUploadFileTypes, enableStarterPrompts, } = spotterChatConfig;
|
|
23926
24155
|
setParamIfDefined(queryParams, Param.HideToolResponseCardBranding, hideToolResponseCardBranding, true);
|
|
23927
24156
|
setParamIfDefined(queryParams, Param.ToolResponseCardBrandingLabel, toolResponseCardBrandingLabel);
|
|
23928
24157
|
setParamIfDefined(queryParams, Param.SpotterFileUploadEnabled, spotterFileUploadEnabled, true);
|
|
24158
|
+
setParamIfDefined(queryParams, Param.IsStarterPromptsEnabled, enableStarterPrompts, true);
|
|
23929
24159
|
if (spotterFileUploadFileTypes !== undefined) {
|
|
23930
24160
|
queryParams[Param.SpotterFileUploadFileTypes] = JSON.stringify(spotterFileUploadFileTypes);
|
|
23931
24161
|
}
|