@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.es.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
|
import * as React from 'react';
|
|
4
4
|
import React__default, { useRef, useCallback } from 'react';
|
|
@@ -2411,11 +2411,30 @@ var HostEvent;
|
|
|
2411
2411
|
/**
|
|
2412
2412
|
* Navigate to a specific page in the embedded ThoughtSpot application.
|
|
2413
2413
|
* This is the same as calling `appEmbed.navigateToPage(path, true)`.
|
|
2414
|
-
*
|
|
2415
|
-
*
|
|
2414
|
+
*
|
|
2415
|
+
* Accepts either a plain value or an object with `path`
|
|
2416
|
+
* and an optional `replace` flag.
|
|
2417
|
+
*
|
|
2418
|
+
* @param data - A string path, a numeric history delta, or an object
|
|
2419
|
+
* `{ path: string | number, replace?: boolean }`.
|
|
2420
|
+
* - `path` — the route to navigate to, or a history delta such as `1`
|
|
2421
|
+
* or `-1` (calls `window.history.go()`).
|
|
2422
|
+
* - `replace` — when `true`, replaces the current history entry instead
|
|
2423
|
+
* of pushing a new one (uses `window.location.replace`).
|
|
2424
|
+
*
|
|
2416
2425
|
* @example
|
|
2417
2426
|
* ```js
|
|
2418
|
-
*
|
|
2427
|
+
* // Preferred: use navigateToPage directly
|
|
2428
|
+
* appEmbed.navigateToPage(-1);
|
|
2429
|
+
*
|
|
2430
|
+
* // Numeric delta — go back one step
|
|
2431
|
+
* appEmbed.trigger(HostEvent.Navigate, -1);
|
|
2432
|
+
*
|
|
2433
|
+
* // String path — push a new history entry
|
|
2434
|
+
* appEmbed.trigger(HostEvent.Navigate, 'home');
|
|
2435
|
+
*
|
|
2436
|
+
* // Object format — replace current history entry
|
|
2437
|
+
* appEmbed.trigger(HostEvent.Navigate, { path: 'home', replace: true }); // SDK: 1.51.0 | ThoughtSpot Cloud: 26.8.0.cl
|
|
2419
2438
|
* ```
|
|
2420
2439
|
* @version SDK: 1.12.0 | ThoughtSpot: 8.4.0.cl, 8.4.1.sw
|
|
2421
2440
|
*/
|
|
@@ -4404,6 +4423,7 @@ var Param;
|
|
|
4404
4423
|
Param["EnableLiveboardDataCache"] = "enableLiveboardDataCache";
|
|
4405
4424
|
Param["SpotterFileUploadEnabled"] = "spotterFileUploadEnabled";
|
|
4406
4425
|
Param["SpotterFileUploadFileTypes"] = "spotterFileUploadFileTypes";
|
|
4426
|
+
Param["IsStarterPromptsEnabled"] = "enableStarterPrompts";
|
|
4407
4427
|
})(Param || (Param = {}));
|
|
4408
4428
|
/**
|
|
4409
4429
|
* ThoughtSpot application pages include actions and menu commands
|
|
@@ -5046,6 +5066,16 @@ var Action;
|
|
|
5046
5066
|
* @version SDK: 1.9.0 | ThoughtSpot: 8.1.0.cl, 8.4.1.sw
|
|
5047
5067
|
*/
|
|
5048
5068
|
Action["AddToFavorites"] = "addToFavorites";
|
|
5069
|
+
/**
|
|
5070
|
+
* Remove from Favorites option in home page v3 sidebar.
|
|
5071
|
+
* Allows removing an object from the user's favorites list from home-page v3 sidebar.
|
|
5072
|
+
* @version SDK: 1.51.0 | ThoughtSpot Cloud: 26.8.0.cl
|
|
5073
|
+
* @example
|
|
5074
|
+
* ```js
|
|
5075
|
+
* disabledActions: [Action.RemoveFromFavorites]
|
|
5076
|
+
* ```
|
|
5077
|
+
*/
|
|
5078
|
+
Action["RemoveFromFavorites"] = "removeFromFavorites";
|
|
5049
5079
|
/**
|
|
5050
5080
|
* The edit icon on Liveboards (Classic experience).
|
|
5051
5081
|
* @example
|
|
@@ -6103,6 +6133,20 @@ var Action;
|
|
|
6103
6133
|
* ```
|
|
6104
6134
|
*/
|
|
6105
6135
|
Action["SpotterViz"] = "spotterViz";
|
|
6136
|
+
/**
|
|
6137
|
+
* The reference-mode toggle button inside the SpotterViz chat input.
|
|
6138
|
+
* When users enable reference mode, clicking tiles, filters, or
|
|
6139
|
+
* parameters adds them as chat context. Hide this action to remove
|
|
6140
|
+
* the reference-mode capability entirely.
|
|
6141
|
+
* Visible by default.
|
|
6142
|
+
* @version SDK: 1.51.0 | ThoughtSpot Cloud: 26.8.0.cl
|
|
6143
|
+
* @example
|
|
6144
|
+
* ```js
|
|
6145
|
+
* hiddenActions: [Action.SpotterVizReferenceMode]
|
|
6146
|
+
* disabledActions: [Action.SpotterVizReferenceMode]
|
|
6147
|
+
* ```
|
|
6148
|
+
*/
|
|
6149
|
+
Action["SpotterVizReferenceMode"] = "spotterVizReferenceMode";
|
|
6106
6150
|
/**
|
|
6107
6151
|
* Clears browser cache and fetches new data for liveboard ChartViz Containers.
|
|
6108
6152
|
* Requires `enableLiveboardDataCache` to be enabled.
|
|
@@ -6579,7 +6623,7 @@ var TableContentDensity;
|
|
|
6579
6623
|
TableContentDensity["Compact"] = "COMPACT";
|
|
6580
6624
|
})(TableContentDensity || (TableContentDensity = {}));
|
|
6581
6625
|
|
|
6582
|
-
var version$1="1.49.
|
|
6626
|
+
var version$1="1.49.2";var pkg = {version:version$1};
|
|
6583
6627
|
|
|
6584
6628
|
const { version } = pkg;
|
|
6585
6629
|
|
|
@@ -6926,6 +6970,27 @@ const getRuntimeFilters = (runtimefilters) => getFilterQuery(runtimefilters || [
|
|
|
6926
6970
|
function getDOMNode(domSelector) {
|
|
6927
6971
|
return typeof domSelector === 'string' ? document.querySelector(domSelector) : domSelector;
|
|
6928
6972
|
}
|
|
6973
|
+
/**
|
|
6974
|
+
* Resolves a CSS selector to an element. `document.querySelector` cannot pierce
|
|
6975
|
+
* shadow boundaries, so when the document lookup misses and a reference node is
|
|
6976
|
+
* provided, this also searches the shadow root the reference node lives in —
|
|
6977
|
+
* letting a selector target an element inside the same shadow root as the embed
|
|
6978
|
+
* instead of silently falling back to the light DOM.
|
|
6979
|
+
* @param selector CSS selector string.
|
|
6980
|
+
* @param referenceNode Node whose shadow root is searched when the document lookup misses.
|
|
6981
|
+
*/
|
|
6982
|
+
function querySelectorAcrossShadowRoot(selector, referenceNode) {
|
|
6983
|
+
var _a;
|
|
6984
|
+
const fromDocument = document.querySelector(selector);
|
|
6985
|
+
if (fromDocument) {
|
|
6986
|
+
return fromDocument;
|
|
6987
|
+
}
|
|
6988
|
+
const rootNode = (_a = referenceNode === null || referenceNode === void 0 ? void 0 : referenceNode.getRootNode) === null || _a === void 0 ? void 0 : _a.call(referenceNode);
|
|
6989
|
+
if (typeof ShadowRoot !== 'undefined' && rootNode instanceof ShadowRoot) {
|
|
6990
|
+
return rootNode.querySelector(selector);
|
|
6991
|
+
}
|
|
6992
|
+
return null;
|
|
6993
|
+
}
|
|
6929
6994
|
const deepMerge = (target, source) => merge(target, source);
|
|
6930
6995
|
const getOperationNameFromQuery = (query) => {
|
|
6931
6996
|
const regex = /(?:query|mutation)\s+(\w+)/;
|
|
@@ -9128,7 +9193,7 @@ class AnswerService {
|
|
|
9128
9193
|
async getTML() {
|
|
9129
9194
|
const { object } = await this.executeQuery(getAnswerTML, {});
|
|
9130
9195
|
const edoc = object[0].edoc;
|
|
9131
|
-
const YAML = await import('./index-
|
|
9196
|
+
const YAML = await import('./index-CS7yJ2Jj.js');
|
|
9132
9197
|
const parsedDoc = YAML.parse(edoc);
|
|
9133
9198
|
return {
|
|
9134
9199
|
answer: {
|
|
@@ -19439,8 +19504,14 @@ function processTrigger(iFrame, messageType, thoughtSpotHost, data, context) {
|
|
|
19439
19504
|
}
|
|
19440
19505
|
}
|
|
19441
19506
|
const channel = new MessageChannel();
|
|
19507
|
+
// Close the messageChannel and resolve the promise if timeout.
|
|
19508
|
+
const timeoutId = setTimeout(() => {
|
|
19509
|
+
channel.port1.close();
|
|
19510
|
+
res(new Error(ERROR_MESSAGE.TRIGGER_TIMED_OUT));
|
|
19511
|
+
}, TRIGGER_TIMEOUT);
|
|
19442
19512
|
channel.port1.onmessage = ({ data: responseData }) => {
|
|
19443
19513
|
var _a;
|
|
19514
|
+
clearTimeout(timeoutId);
|
|
19444
19515
|
channel.port1.close();
|
|
19445
19516
|
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);
|
|
19446
19517
|
if (error) {
|
|
@@ -19450,11 +19521,6 @@ function processTrigger(iFrame, messageType, thoughtSpotHost, data, context) {
|
|
|
19450
19521
|
res(responseData);
|
|
19451
19522
|
}
|
|
19452
19523
|
};
|
|
19453
|
-
// Close the messageChannel and resolve the promise if timeout.
|
|
19454
|
-
setTimeout(() => {
|
|
19455
|
-
channel.port1.close();
|
|
19456
|
-
res(new Error(ERROR_MESSAGE.TRIGGER_TIMED_OUT));
|
|
19457
|
-
}, TRIGGER_TIMEOUT);
|
|
19458
19524
|
return postIframeMessage(iFrame, { type: messageType, data, context }, thoughtSpotHost, channel);
|
|
19459
19525
|
});
|
|
19460
19526
|
}
|
|
@@ -20219,6 +20285,14 @@ const processLegacyInterceptResponse = (payload) => {
|
|
|
20219
20285
|
*/
|
|
20220
20286
|
const THOUGHTSPOT_PARAM_PREFIX = 'ts-';
|
|
20221
20287
|
const TS_EMBED_ID = '_thoughtspot-embed';
|
|
20288
|
+
/**
|
|
20289
|
+
* dataset key used to stash a custom preRenderContainer's original inline
|
|
20290
|
+
* `position` while we override it to `relative`. Stored on the container (not
|
|
20291
|
+
* per-instance) so the override can be reverted on destroy even when multiple
|
|
20292
|
+
* pre-rendered embeds share the same container.
|
|
20293
|
+
*/
|
|
20294
|
+
const PRERENDER_CONTAINER_ORIGINAL_POSITION_KEY = 'tsEmbedOriginalPosition';
|
|
20295
|
+
const PRERENDER_WRAPPER_ID_PREFIX = 'tsEmbed-pre-render-wrapper-';
|
|
20222
20296
|
/**
|
|
20223
20297
|
* The event id map from v2 event names to v1 event id
|
|
20224
20298
|
* v1 events are the classic embed events implemented in Blink v1
|
|
@@ -20254,6 +20328,8 @@ class TsEmbed {
|
|
|
20254
20328
|
*/
|
|
20255
20329
|
this.shouldEncodeUrlQueryParams = false;
|
|
20256
20330
|
this.defaultHiddenActions = [Action.ReportError];
|
|
20331
|
+
this.preRenderContainerEl = null;
|
|
20332
|
+
this.containerScrollListener = null;
|
|
20257
20333
|
/**
|
|
20258
20334
|
* Handler for fullscreen change events
|
|
20259
20335
|
*/
|
|
@@ -21119,6 +21195,89 @@ class TsEmbed {
|
|
|
21119
21195
|
placeholder.id = id.placeHolder;
|
|
21120
21196
|
return placeholder;
|
|
21121
21197
|
}
|
|
21198
|
+
/**
|
|
21199
|
+
* Resolves the configured preRenderContainer to a live element, falling
|
|
21200
|
+
* back to `document.body`. A string selector is re-queried on every call so
|
|
21201
|
+
* a remounted container (E.g.: React replacing the node) resolves to the
|
|
21202
|
+
* fresh element; an element passed directly cannot be re-resolved.
|
|
21203
|
+
*/
|
|
21204
|
+
resolvePreRenderContainerTarget() {
|
|
21205
|
+
var _a;
|
|
21206
|
+
const containerConfig = this.viewConfig.preRenderContainer;
|
|
21207
|
+
let container = null;
|
|
21208
|
+
if (typeof containerConfig === 'string') {
|
|
21209
|
+
try {
|
|
21210
|
+
// Resolve against the host's shadow root too, so a selector can
|
|
21211
|
+
// target a container inside the same shadow DOM as the embed —
|
|
21212
|
+
// document.querySelector alone cannot pierce shadow boundaries.
|
|
21213
|
+
container = querySelectorAcrossShadowRoot(containerConfig, this.hostElement);
|
|
21214
|
+
}
|
|
21215
|
+
catch (e) {
|
|
21216
|
+
logger$3.error(`Invalid CSS selector for preRenderContainer: ${containerConfig}`, e);
|
|
21217
|
+
}
|
|
21218
|
+
}
|
|
21219
|
+
else if (containerConfig) {
|
|
21220
|
+
container = containerConfig;
|
|
21221
|
+
}
|
|
21222
|
+
return (_a = container) !== null && _a !== void 0 ? _a : document.body;
|
|
21223
|
+
}
|
|
21224
|
+
/**
|
|
21225
|
+
* Makes the container a positioning context for the absolutely positioned
|
|
21226
|
+
* wrapper, stashing the original inline `position` on the element (once) so
|
|
21227
|
+
* destroy() can restore it exactly, leaving no trace. Recording it on the
|
|
21228
|
+
* element rather than per-instance lets the override be reverted even when
|
|
21229
|
+
* embeds share the same container.
|
|
21230
|
+
*/
|
|
21231
|
+
applyPreRenderContainerPositioning(container) {
|
|
21232
|
+
if (container === document.body) {
|
|
21233
|
+
return;
|
|
21234
|
+
}
|
|
21235
|
+
const pos = window.getComputedStyle(container).position;
|
|
21236
|
+
if (pos === 'static') {
|
|
21237
|
+
if (container.dataset[PRERENDER_CONTAINER_ORIGINAL_POSITION_KEY] === undefined) {
|
|
21238
|
+
container.dataset[PRERENDER_CONTAINER_ORIGINAL_POSITION_KEY] = container.style.position;
|
|
21239
|
+
}
|
|
21240
|
+
container.style.position = 'relative';
|
|
21241
|
+
}
|
|
21242
|
+
}
|
|
21243
|
+
/**
|
|
21244
|
+
* Re-attaches the wrapper to a live container when the previously resolved
|
|
21245
|
+
* one has been detached or no longer holds the wrapper — e.g. the host app
|
|
21246
|
+
* remounted a custom preRenderContainer, which would otherwise leave a stale
|
|
21247
|
+
* reference and collapse the wrapper. Only string selectors can be
|
|
21248
|
+
* re-resolved; a container passed as an element is left untouched.
|
|
21249
|
+
*/
|
|
21250
|
+
reconcilePreRenderContainer() {
|
|
21251
|
+
const wrapper = this.preRenderWrapper;
|
|
21252
|
+
const stored = this.preRenderContainerEl;
|
|
21253
|
+
// Nothing to reconcile until this instance resolved its container.
|
|
21254
|
+
if (!wrapper || !stored) {
|
|
21255
|
+
return;
|
|
21256
|
+
}
|
|
21257
|
+
const storedIsLive = stored === document.body || document.contains(stored);
|
|
21258
|
+
if (storedIsLive && stored.contains(wrapper)) {
|
|
21259
|
+
return;
|
|
21260
|
+
}
|
|
21261
|
+
const resolved = this.resolvePreRenderContainerTarget();
|
|
21262
|
+
// Re-resolution yielded the same (still stale) element — nothing we can
|
|
21263
|
+
// do, e.g. a detached container passed as an HTMLElement.
|
|
21264
|
+
if (resolved === stored && stored.contains(wrapper)) {
|
|
21265
|
+
return;
|
|
21266
|
+
}
|
|
21267
|
+
if (this.containerScrollListener && stored !== resolved) {
|
|
21268
|
+
if (stored !== document.body) {
|
|
21269
|
+
stored.removeEventListener('scroll', this.containerScrollListener);
|
|
21270
|
+
}
|
|
21271
|
+
if (resolved !== document.body) {
|
|
21272
|
+
resolved.addEventListener('scroll', this.containerScrollListener);
|
|
21273
|
+
}
|
|
21274
|
+
}
|
|
21275
|
+
this.applyPreRenderContainerPositioning(resolved);
|
|
21276
|
+
if (wrapper.parentNode !== resolved) {
|
|
21277
|
+
resolved.appendChild(wrapper);
|
|
21278
|
+
}
|
|
21279
|
+
this.preRenderContainerEl = resolved;
|
|
21280
|
+
}
|
|
21122
21281
|
insertIntoDOMForPreRender(child) {
|
|
21123
21282
|
const preRenderChild = this.createPreRenderChild(child);
|
|
21124
21283
|
const preRenderWrapper = this.createPreRenderWrapper();
|
|
@@ -21138,7 +21297,10 @@ class TsEmbed {
|
|
|
21138
21297
|
else {
|
|
21139
21298
|
this.hidePreRender();
|
|
21140
21299
|
}
|
|
21141
|
-
|
|
21300
|
+
const targetContainer = this.resolvePreRenderContainerTarget();
|
|
21301
|
+
this.preRenderContainerEl = targetContainer;
|
|
21302
|
+
this.applyPreRenderContainerPositioning(targetContainer);
|
|
21303
|
+
targetContainer.appendChild(preRenderWrapper);
|
|
21142
21304
|
}
|
|
21143
21305
|
insertIntoDOM(child) {
|
|
21144
21306
|
var _a;
|
|
@@ -21577,6 +21739,50 @@ class TsEmbed {
|
|
|
21577
21739
|
tsParams = tsParams ? `?${tsParams}` : '';
|
|
21578
21740
|
return tsParams;
|
|
21579
21741
|
}
|
|
21742
|
+
/**
|
|
21743
|
+
* Reverts the custom preRenderContainer's `position` to the value it had
|
|
21744
|
+
* before we overrode it to `relative` (see insertIntoDOMForPreRender).
|
|
21745
|
+
*
|
|
21746
|
+
* We restore the original inline value rather than forcing `static`, and we
|
|
21747
|
+
* skip the restore if another preRender wrapper is still mounted inside the
|
|
21748
|
+
* same container — a shared container still needs the positioning context.
|
|
21749
|
+
*/
|
|
21750
|
+
restorePreRenderContainerPosition() {
|
|
21751
|
+
const container = this.preRenderContainerEl;
|
|
21752
|
+
if (!container || container === document.body) {
|
|
21753
|
+
return;
|
|
21754
|
+
}
|
|
21755
|
+
// Drop our reference up front so a destroyed embed never pins a
|
|
21756
|
+
// detached container in memory; restoration uses the local handle.
|
|
21757
|
+
this.preRenderContainerEl = null;
|
|
21758
|
+
const originalPosition = container.dataset[PRERENDER_CONTAINER_ORIGINAL_POSITION_KEY];
|
|
21759
|
+
if (originalPosition === undefined) {
|
|
21760
|
+
// We never overrode this container's position; nothing to restore.
|
|
21761
|
+
return;
|
|
21762
|
+
}
|
|
21763
|
+
// This instance's own wrapper has already been removed by now, so any
|
|
21764
|
+
// match here belongs to another embed still sharing the container — it
|
|
21765
|
+
// continues to rely on the positioning context, so leave it in place.
|
|
21766
|
+
const hasOtherWrapper = container.querySelector(`[id^="${PRERENDER_WRAPPER_ID_PREFIX}"]`);
|
|
21767
|
+
if (hasOtherWrapper) {
|
|
21768
|
+
return;
|
|
21769
|
+
}
|
|
21770
|
+
container.style.position = originalPosition;
|
|
21771
|
+
delete container.dataset[PRERENDER_CONTAINER_ORIGINAL_POSITION_KEY];
|
|
21772
|
+
}
|
|
21773
|
+
/**
|
|
21774
|
+
* Detaches and clears the container scroll listener, if one is attached.
|
|
21775
|
+
*/
|
|
21776
|
+
removeContainerScrollListener() {
|
|
21777
|
+
if (!this.containerScrollListener) {
|
|
21778
|
+
return;
|
|
21779
|
+
}
|
|
21780
|
+
const customContainer = this.preRenderContainerEl && this.preRenderContainerEl !== document.body
|
|
21781
|
+
? this.preRenderContainerEl
|
|
21782
|
+
: null;
|
|
21783
|
+
customContainer === null || customContainer === void 0 ? void 0 : customContainer.removeEventListener('scroll', this.containerScrollListener);
|
|
21784
|
+
this.containerScrollListener = null;
|
|
21785
|
+
}
|
|
21580
21786
|
/**
|
|
21581
21787
|
* Destroys the ThoughtSpot embed, and remove any nodes from the DOM.
|
|
21582
21788
|
* @version SDK: 1.19.1 | ThoughtSpot: *
|
|
@@ -21585,8 +21791,10 @@ class TsEmbed {
|
|
|
21585
21791
|
var _a, _b, _c;
|
|
21586
21792
|
try {
|
|
21587
21793
|
this.removeFullscreenChangeHandler();
|
|
21794
|
+
this.removeContainerScrollListener();
|
|
21588
21795
|
this.unsubscribeToEvents();
|
|
21589
21796
|
(_a = this.preRenderWrapper) === null || _a === void 0 ? void 0 : _a.remove();
|
|
21797
|
+
this.restorePreRenderContainerPosition();
|
|
21590
21798
|
if (!this.isRendered) {
|
|
21591
21799
|
return;
|
|
21592
21800
|
}
|
|
@@ -21696,15 +21904,19 @@ class TsEmbed {
|
|
|
21696
21904
|
}
|
|
21697
21905
|
this.hostElement.appendChild(this.insertedDomEl);
|
|
21698
21906
|
this.syncPreRenderStyle();
|
|
21907
|
+
const customContainer = this.preRenderContainerEl && this.preRenderContainerEl !== document.body
|
|
21908
|
+
? this.preRenderContainerEl
|
|
21909
|
+
: null;
|
|
21910
|
+
if (customContainer && !this.containerScrollListener) {
|
|
21911
|
+
this.containerScrollListener = () => this.syncPreRenderStyle();
|
|
21912
|
+
customContainer.addEventListener('scroll', this.containerScrollListener);
|
|
21913
|
+
}
|
|
21699
21914
|
if (!this.viewConfig.doNotTrackPreRenderSize) {
|
|
21700
21915
|
const observeTarget = (_a = this.insertedDomEl) !== null && _a !== void 0 ? _a : this.hostElement;
|
|
21701
21916
|
this.resizeObserver = new ResizeObserver((entries) => {
|
|
21702
21917
|
entries.forEach((entry) => {
|
|
21703
|
-
if (entry.
|
|
21704
|
-
|
|
21705
|
-
width: `${entry.contentRect.width}px`,
|
|
21706
|
-
height: `${entry.contentRect.height}px`,
|
|
21707
|
-
});
|
|
21918
|
+
if (entry.target === observeTarget) {
|
|
21919
|
+
this.syncPreRenderStyle();
|
|
21708
21920
|
}
|
|
21709
21921
|
});
|
|
21710
21922
|
});
|
|
@@ -21736,14 +21948,24 @@ class TsEmbed {
|
|
|
21736
21948
|
* is not defined or not found.
|
|
21737
21949
|
*/
|
|
21738
21950
|
syncPreRenderStyle() {
|
|
21951
|
+
var _a;
|
|
21739
21952
|
if (!this.isPreRenderConnected() || !this.getPreRenderPlaceHolderElement()) {
|
|
21740
21953
|
logger$3.error(ERROR_MESSAGE.SYNC_STYLE_CALLED_BEFORE_RENDER);
|
|
21741
21954
|
return;
|
|
21742
21955
|
}
|
|
21956
|
+
// Self-heal if the resolved container was remounted/detached, so we
|
|
21957
|
+
// never measure a stale node (which would collapse the wrapper).
|
|
21958
|
+
this.reconcilePreRenderContainer();
|
|
21743
21959
|
const elBoundingClient = this.getPreRenderPlaceHolderElement().getBoundingClientRect();
|
|
21960
|
+
const containerEl = this.preRenderContainerEl && this.preRenderContainerEl !== document.body
|
|
21961
|
+
? this.preRenderContainerEl
|
|
21962
|
+
: null;
|
|
21963
|
+
const containerRect = (_a = containerEl === null || containerEl === void 0 ? void 0 : containerEl.getBoundingClientRect()) !== null && _a !== void 0 ? _a : { x: 0, y: 0 };
|
|
21964
|
+
const scrollX = containerEl ? containerEl.scrollLeft : window.scrollX;
|
|
21965
|
+
const scrollY = containerEl ? containerEl.scrollTop : window.scrollY;
|
|
21744
21966
|
setStyleProperties(this.preRenderWrapper, {
|
|
21745
|
-
top: `${elBoundingClient.y +
|
|
21746
|
-
left: `${elBoundingClient.x +
|
|
21967
|
+
top: `${elBoundingClient.y - containerRect.y + scrollY}px`,
|
|
21968
|
+
left: `${elBoundingClient.x - containerRect.x + scrollX}px`,
|
|
21747
21969
|
width: `${elBoundingClient.width}px`,
|
|
21748
21970
|
height: `${elBoundingClient.height}px`,
|
|
21749
21971
|
position: 'absolute',
|
|
@@ -21770,6 +21992,7 @@ class TsEmbed {
|
|
|
21770
21992
|
overflow: 'hidden',
|
|
21771
21993
|
};
|
|
21772
21994
|
setStyleProperties(this.preRenderWrapper, preRenderHideStyles);
|
|
21995
|
+
this.removeContainerScrollListener();
|
|
21773
21996
|
if (this.resizeObserver) {
|
|
21774
21997
|
this.resizeObserver.disconnect();
|
|
21775
21998
|
}
|
|
@@ -21788,7 +22011,7 @@ class TsEmbed {
|
|
|
21788
22011
|
*/
|
|
21789
22012
|
getPreRenderIds() {
|
|
21790
22013
|
return {
|
|
21791
|
-
wrapper:
|
|
22014
|
+
wrapper: `${PRERENDER_WRAPPER_ID_PREFIX}${this.viewConfig.preRenderId}`,
|
|
21792
22015
|
child: `tsEmbed-pre-render-child-${this.viewConfig.preRenderId}`,
|
|
21793
22016
|
placeHolder: `tsEmbed-pre-render-placeholder-${this.viewConfig.preRenderId}`,
|
|
21794
22017
|
};
|
|
@@ -22497,12 +22720,15 @@ let AppEmbed$1 = class AppEmbed extends V1Embed {
|
|
|
22497
22720
|
}
|
|
22498
22721
|
// Handle spotterChatConfig params
|
|
22499
22722
|
if (spotterChatConfig) {
|
|
22500
|
-
const { hideToolResponseCardBranding, toolResponseCardBrandingLabel, spotterFileUploadEnabled, spotterFileUploadFileTypes, } = spotterChatConfig;
|
|
22723
|
+
const { hideToolResponseCardBranding, toolResponseCardBrandingLabel, spotterFileUploadEnabled, spotterFileUploadFileTypes, enableStarterPrompts, } = spotterChatConfig;
|
|
22501
22724
|
setParamIfDefined(params, Param.HideToolResponseCardBranding, hideToolResponseCardBranding, true);
|
|
22502
22725
|
setParamIfDefined(params, Param.ToolResponseCardBrandingLabel, toolResponseCardBrandingLabel);
|
|
22503
22726
|
if (spotterFileUploadEnabled !== undefined) {
|
|
22504
22727
|
params[Param.SpotterFileUploadEnabled] = spotterFileUploadEnabled;
|
|
22505
22728
|
}
|
|
22729
|
+
if (enableStarterPrompts !== undefined) {
|
|
22730
|
+
params[Param.IsStarterPromptsEnabled] = enableStarterPrompts;
|
|
22731
|
+
}
|
|
22506
22732
|
if (spotterFileUploadFileTypes !== undefined) {
|
|
22507
22733
|
params[Param.SpotterFileUploadFileTypes] = JSON.stringify(spotterFileUploadFileTypes);
|
|
22508
22734
|
}
|
|
@@ -23058,12 +23284,15 @@ let LiveboardEmbed$1 = class LiveboardEmbed extends V1Embed {
|
|
|
23058
23284
|
}
|
|
23059
23285
|
// Handle spotterChatConfig params
|
|
23060
23286
|
if (spotterChatConfig) {
|
|
23061
|
-
const { hideToolResponseCardBranding, toolResponseCardBrandingLabel, spotterFileUploadEnabled, spotterFileUploadFileTypes, } = spotterChatConfig;
|
|
23287
|
+
const { hideToolResponseCardBranding, toolResponseCardBrandingLabel, spotterFileUploadEnabled, spotterFileUploadFileTypes, enableStarterPrompts, } = spotterChatConfig;
|
|
23062
23288
|
setParamIfDefined(params, Param.HideToolResponseCardBranding, hideToolResponseCardBranding, true);
|
|
23063
23289
|
setParamIfDefined(params, Param.ToolResponseCardBrandingLabel, toolResponseCardBrandingLabel);
|
|
23064
23290
|
if (spotterFileUploadEnabled !== undefined) {
|
|
23065
23291
|
params[Param.SpotterFileUploadEnabled] = spotterFileUploadEnabled;
|
|
23066
23292
|
}
|
|
23293
|
+
if (enableStarterPrompts !== undefined) {
|
|
23294
|
+
params[Param.IsStarterPromptsEnabled] = enableStarterPrompts;
|
|
23295
|
+
}
|
|
23067
23296
|
if (spotterFileUploadFileTypes !== undefined) {
|
|
23068
23297
|
params[Param.SpotterFileUploadFileTypes] = JSON.stringify(spotterFileUploadFileTypes);
|
|
23069
23298
|
}
|
|
@@ -23900,10 +24129,11 @@ let SpotterEmbed$1 = class SpotterEmbed extends TsEmbed {
|
|
|
23900
24129
|
setParamIfDefined(queryParams, Param.EnableStopAnswerGenerationEmbed, enableStopAnswerGenerationEmbed, true);
|
|
23901
24130
|
// Handle spotterChatConfig params
|
|
23902
24131
|
if (spotterChatConfig) {
|
|
23903
|
-
const { hideToolResponseCardBranding, toolResponseCardBrandingLabel, spotterFileUploadEnabled, spotterFileUploadFileTypes, } = spotterChatConfig;
|
|
24132
|
+
const { hideToolResponseCardBranding, toolResponseCardBrandingLabel, spotterFileUploadEnabled, spotterFileUploadFileTypes, enableStarterPrompts, } = spotterChatConfig;
|
|
23904
24133
|
setParamIfDefined(queryParams, Param.HideToolResponseCardBranding, hideToolResponseCardBranding, true);
|
|
23905
24134
|
setParamIfDefined(queryParams, Param.ToolResponseCardBrandingLabel, toolResponseCardBrandingLabel);
|
|
23906
24135
|
setParamIfDefined(queryParams, Param.SpotterFileUploadEnabled, spotterFileUploadEnabled, true);
|
|
24136
|
+
setParamIfDefined(queryParams, Param.IsStarterPromptsEnabled, enableStarterPrompts, true);
|
|
23907
24137
|
if (spotterFileUploadFileTypes !== undefined) {
|
|
23908
24138
|
queryParams[Param.SpotterFileUploadFileTypes] = JSON.stringify(spotterFileUploadFileTypes);
|
|
23909
24139
|
}
|