@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.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
|
function _mergeNamespaces(n, m) {
|
|
4
4
|
m.forEach(function (e) {
|
|
@@ -2243,11 +2243,30 @@ var HostEvent;
|
|
|
2243
2243
|
/**
|
|
2244
2244
|
* Navigate to a specific page in the embedded ThoughtSpot application.
|
|
2245
2245
|
* This is the same as calling `appEmbed.navigateToPage(path, true)`.
|
|
2246
|
-
*
|
|
2247
|
-
*
|
|
2246
|
+
*
|
|
2247
|
+
* Accepts either a plain value or an object with `path`
|
|
2248
|
+
* and an optional `replace` flag.
|
|
2249
|
+
*
|
|
2250
|
+
* @param data - A string path, a numeric history delta, or an object
|
|
2251
|
+
* `{ path: string | number, replace?: boolean }`.
|
|
2252
|
+
* - `path` — the route to navigate to, or a history delta such as `1`
|
|
2253
|
+
* or `-1` (calls `window.history.go()`).
|
|
2254
|
+
* - `replace` — when `true`, replaces the current history entry instead
|
|
2255
|
+
* of pushing a new one (uses `window.location.replace`).
|
|
2256
|
+
*
|
|
2248
2257
|
* @example
|
|
2249
2258
|
* ```js
|
|
2250
|
-
*
|
|
2259
|
+
* // Preferred: use navigateToPage directly
|
|
2260
|
+
* appEmbed.navigateToPage(-1);
|
|
2261
|
+
*
|
|
2262
|
+
* // Numeric delta — go back one step
|
|
2263
|
+
* appEmbed.trigger(HostEvent.Navigate, -1);
|
|
2264
|
+
*
|
|
2265
|
+
* // String path — push a new history entry
|
|
2266
|
+
* appEmbed.trigger(HostEvent.Navigate, 'home');
|
|
2267
|
+
*
|
|
2268
|
+
* // Object format — replace current history entry
|
|
2269
|
+
* appEmbed.trigger(HostEvent.Navigate, { path: 'home', replace: true }); // SDK: 1.51.0 | ThoughtSpot Cloud: 26.8.0.cl
|
|
2251
2270
|
* ```
|
|
2252
2271
|
* @version SDK: 1.12.0 | ThoughtSpot: 8.4.0.cl, 8.4.1.sw
|
|
2253
2272
|
*/
|
|
@@ -4236,6 +4255,7 @@ var Param;
|
|
|
4236
4255
|
Param["EnableLiveboardDataCache"] = "enableLiveboardDataCache";
|
|
4237
4256
|
Param["SpotterFileUploadEnabled"] = "spotterFileUploadEnabled";
|
|
4238
4257
|
Param["SpotterFileUploadFileTypes"] = "spotterFileUploadFileTypes";
|
|
4258
|
+
Param["IsStarterPromptsEnabled"] = "enableStarterPrompts";
|
|
4239
4259
|
})(Param || (Param = {}));
|
|
4240
4260
|
/**
|
|
4241
4261
|
* ThoughtSpot application pages include actions and menu commands
|
|
@@ -4878,6 +4898,16 @@ var Action;
|
|
|
4878
4898
|
* @version SDK: 1.9.0 | ThoughtSpot: 8.1.0.cl, 8.4.1.sw
|
|
4879
4899
|
*/
|
|
4880
4900
|
Action["AddToFavorites"] = "addToFavorites";
|
|
4901
|
+
/**
|
|
4902
|
+
* Remove from Favorites option in home page v3 sidebar.
|
|
4903
|
+
* Allows removing an object from the user's favorites list from home-page v3 sidebar.
|
|
4904
|
+
* @version SDK: 1.51.0 | ThoughtSpot Cloud: 26.8.0.cl
|
|
4905
|
+
* @example
|
|
4906
|
+
* ```js
|
|
4907
|
+
* disabledActions: [Action.RemoveFromFavorites]
|
|
4908
|
+
* ```
|
|
4909
|
+
*/
|
|
4910
|
+
Action["RemoveFromFavorites"] = "removeFromFavorites";
|
|
4881
4911
|
/**
|
|
4882
4912
|
* The edit icon on Liveboards (Classic experience).
|
|
4883
4913
|
* @example
|
|
@@ -5935,6 +5965,20 @@ var Action;
|
|
|
5935
5965
|
* ```
|
|
5936
5966
|
*/
|
|
5937
5967
|
Action["SpotterViz"] = "spotterViz";
|
|
5968
|
+
/**
|
|
5969
|
+
* The reference-mode toggle button inside the SpotterViz chat input.
|
|
5970
|
+
* When users enable reference mode, clicking tiles, filters, or
|
|
5971
|
+
* parameters adds them as chat context. Hide this action to remove
|
|
5972
|
+
* the reference-mode capability entirely.
|
|
5973
|
+
* Visible by default.
|
|
5974
|
+
* @version SDK: 1.51.0 | ThoughtSpot Cloud: 26.8.0.cl
|
|
5975
|
+
* @example
|
|
5976
|
+
* ```js
|
|
5977
|
+
* hiddenActions: [Action.SpotterVizReferenceMode]
|
|
5978
|
+
* disabledActions: [Action.SpotterVizReferenceMode]
|
|
5979
|
+
* ```
|
|
5980
|
+
*/
|
|
5981
|
+
Action["SpotterVizReferenceMode"] = "spotterVizReferenceMode";
|
|
5938
5982
|
/**
|
|
5939
5983
|
* Clears browser cache and fetches new data for liveboard ChartViz Containers.
|
|
5940
5984
|
* Requires `enableLiveboardDataCache` to be enabled.
|
|
@@ -6411,7 +6455,7 @@ var TableContentDensity;
|
|
|
6411
6455
|
TableContentDensity["Compact"] = "COMPACT";
|
|
6412
6456
|
})(TableContentDensity || (TableContentDensity = {}));
|
|
6413
6457
|
|
|
6414
|
-
var version$1="1.49.
|
|
6458
|
+
var version$1="1.49.2";var pkg = {version:version$1};
|
|
6415
6459
|
|
|
6416
6460
|
const { version } = pkg;
|
|
6417
6461
|
|
|
@@ -6810,6 +6854,27 @@ const getRuntimeFilters = (runtimefilters) => getFilterQuery(runtimefilters || [
|
|
|
6810
6854
|
function getDOMNode(domSelector) {
|
|
6811
6855
|
return typeof domSelector === 'string' ? document.querySelector(domSelector) : domSelector;
|
|
6812
6856
|
}
|
|
6857
|
+
/**
|
|
6858
|
+
* Resolves a CSS selector to an element. `document.querySelector` cannot pierce
|
|
6859
|
+
* shadow boundaries, so when the document lookup misses and a reference node is
|
|
6860
|
+
* provided, this also searches the shadow root the reference node lives in —
|
|
6861
|
+
* letting a selector target an element inside the same shadow root as the embed
|
|
6862
|
+
* instead of silently falling back to the light DOM.
|
|
6863
|
+
* @param selector CSS selector string.
|
|
6864
|
+
* @param referenceNode Node whose shadow root is searched when the document lookup misses.
|
|
6865
|
+
*/
|
|
6866
|
+
function querySelectorAcrossShadowRoot(selector, referenceNode) {
|
|
6867
|
+
var _a;
|
|
6868
|
+
const fromDocument = document.querySelector(selector);
|
|
6869
|
+
if (fromDocument) {
|
|
6870
|
+
return fromDocument;
|
|
6871
|
+
}
|
|
6872
|
+
const rootNode = (_a = referenceNode === null || referenceNode === void 0 ? void 0 : referenceNode.getRootNode) === null || _a === void 0 ? void 0 : _a.call(referenceNode);
|
|
6873
|
+
if (typeof ShadowRoot !== 'undefined' && rootNode instanceof ShadowRoot) {
|
|
6874
|
+
return rootNode.querySelector(selector);
|
|
6875
|
+
}
|
|
6876
|
+
return null;
|
|
6877
|
+
}
|
|
6813
6878
|
const deepMerge = (target, source) => merge(target, source);
|
|
6814
6879
|
const getOperationNameFromQuery = (query) => {
|
|
6815
6880
|
const regex = /(?:query|mutation)\s+(\w+)/;
|
|
@@ -9012,7 +9077,7 @@ class AnswerService {
|
|
|
9012
9077
|
async getTML() {
|
|
9013
9078
|
const { object } = await this.executeQuery(getAnswerTML, {});
|
|
9014
9079
|
const edoc = object[0].edoc;
|
|
9015
|
-
const YAML = await import('./index-
|
|
9080
|
+
const YAML = await import('./index-CS7yJ2Jj.js');
|
|
9016
9081
|
const parsedDoc = YAML.parse(edoc);
|
|
9017
9082
|
return {
|
|
9018
9083
|
answer: {
|
|
@@ -19352,8 +19417,14 @@ function processTrigger(iFrame, messageType, thoughtSpotHost, data, context) {
|
|
|
19352
19417
|
}
|
|
19353
19418
|
}
|
|
19354
19419
|
const channel = new MessageChannel();
|
|
19420
|
+
// Close the messageChannel and resolve the promise if timeout.
|
|
19421
|
+
const timeoutId = setTimeout(() => {
|
|
19422
|
+
channel.port1.close();
|
|
19423
|
+
res(new Error(ERROR_MESSAGE.TRIGGER_TIMED_OUT));
|
|
19424
|
+
}, TRIGGER_TIMEOUT);
|
|
19355
19425
|
channel.port1.onmessage = ({ data: responseData }) => {
|
|
19356
19426
|
var _a;
|
|
19427
|
+
clearTimeout(timeoutId);
|
|
19357
19428
|
channel.port1.close();
|
|
19358
19429
|
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);
|
|
19359
19430
|
if (error) {
|
|
@@ -19363,11 +19434,6 @@ function processTrigger(iFrame, messageType, thoughtSpotHost, data, context) {
|
|
|
19363
19434
|
res(responseData);
|
|
19364
19435
|
}
|
|
19365
19436
|
};
|
|
19366
|
-
// Close the messageChannel and resolve the promise if timeout.
|
|
19367
|
-
setTimeout(() => {
|
|
19368
|
-
channel.port1.close();
|
|
19369
|
-
res(new Error(ERROR_MESSAGE.TRIGGER_TIMED_OUT));
|
|
19370
|
-
}, TRIGGER_TIMEOUT);
|
|
19371
19437
|
return postIframeMessage(iFrame, { type: messageType, data, context }, thoughtSpotHost, channel);
|
|
19372
19438
|
});
|
|
19373
19439
|
}
|
|
@@ -20285,6 +20351,14 @@ const processLegacyInterceptResponse = (payload) => {
|
|
|
20285
20351
|
*/
|
|
20286
20352
|
const THOUGHTSPOT_PARAM_PREFIX = 'ts-';
|
|
20287
20353
|
const TS_EMBED_ID = '_thoughtspot-embed';
|
|
20354
|
+
/**
|
|
20355
|
+
* dataset key used to stash a custom preRenderContainer's original inline
|
|
20356
|
+
* `position` while we override it to `relative`. Stored on the container (not
|
|
20357
|
+
* per-instance) so the override can be reverted on destroy even when multiple
|
|
20358
|
+
* pre-rendered embeds share the same container.
|
|
20359
|
+
*/
|
|
20360
|
+
const PRERENDER_CONTAINER_ORIGINAL_POSITION_KEY = 'tsEmbedOriginalPosition';
|
|
20361
|
+
const PRERENDER_WRAPPER_ID_PREFIX = 'tsEmbed-pre-render-wrapper-';
|
|
20288
20362
|
/**
|
|
20289
20363
|
* The event id map from v2 event names to v1 event id
|
|
20290
20364
|
* v1 events are the classic embed events implemented in Blink v1
|
|
@@ -20320,6 +20394,8 @@ class TsEmbed {
|
|
|
20320
20394
|
*/
|
|
20321
20395
|
this.shouldEncodeUrlQueryParams = false;
|
|
20322
20396
|
this.defaultHiddenActions = [Action.ReportError];
|
|
20397
|
+
this.preRenderContainerEl = null;
|
|
20398
|
+
this.containerScrollListener = null;
|
|
20323
20399
|
/**
|
|
20324
20400
|
* Handler for fullscreen change events
|
|
20325
20401
|
*/
|
|
@@ -21185,6 +21261,89 @@ class TsEmbed {
|
|
|
21185
21261
|
placeholder.id = id.placeHolder;
|
|
21186
21262
|
return placeholder;
|
|
21187
21263
|
}
|
|
21264
|
+
/**
|
|
21265
|
+
* Resolves the configured preRenderContainer to a live element, falling
|
|
21266
|
+
* back to `document.body`. A string selector is re-queried on every call so
|
|
21267
|
+
* a remounted container (E.g.: React replacing the node) resolves to the
|
|
21268
|
+
* fresh element; an element passed directly cannot be re-resolved.
|
|
21269
|
+
*/
|
|
21270
|
+
resolvePreRenderContainerTarget() {
|
|
21271
|
+
var _a;
|
|
21272
|
+
const containerConfig = this.viewConfig.preRenderContainer;
|
|
21273
|
+
let container = null;
|
|
21274
|
+
if (typeof containerConfig === 'string') {
|
|
21275
|
+
try {
|
|
21276
|
+
// Resolve against the host's shadow root too, so a selector can
|
|
21277
|
+
// target a container inside the same shadow DOM as the embed —
|
|
21278
|
+
// document.querySelector alone cannot pierce shadow boundaries.
|
|
21279
|
+
container = querySelectorAcrossShadowRoot(containerConfig, this.hostElement);
|
|
21280
|
+
}
|
|
21281
|
+
catch (e) {
|
|
21282
|
+
logger$3.error(`Invalid CSS selector for preRenderContainer: ${containerConfig}`, e);
|
|
21283
|
+
}
|
|
21284
|
+
}
|
|
21285
|
+
else if (containerConfig) {
|
|
21286
|
+
container = containerConfig;
|
|
21287
|
+
}
|
|
21288
|
+
return (_a = container) !== null && _a !== void 0 ? _a : document.body;
|
|
21289
|
+
}
|
|
21290
|
+
/**
|
|
21291
|
+
* Makes the container a positioning context for the absolutely positioned
|
|
21292
|
+
* wrapper, stashing the original inline `position` on the element (once) so
|
|
21293
|
+
* destroy() can restore it exactly, leaving no trace. Recording it on the
|
|
21294
|
+
* element rather than per-instance lets the override be reverted even when
|
|
21295
|
+
* embeds share the same container.
|
|
21296
|
+
*/
|
|
21297
|
+
applyPreRenderContainerPositioning(container) {
|
|
21298
|
+
if (container === document.body) {
|
|
21299
|
+
return;
|
|
21300
|
+
}
|
|
21301
|
+
const pos = window.getComputedStyle(container).position;
|
|
21302
|
+
if (pos === 'static') {
|
|
21303
|
+
if (container.dataset[PRERENDER_CONTAINER_ORIGINAL_POSITION_KEY] === undefined) {
|
|
21304
|
+
container.dataset[PRERENDER_CONTAINER_ORIGINAL_POSITION_KEY] = container.style.position;
|
|
21305
|
+
}
|
|
21306
|
+
container.style.position = 'relative';
|
|
21307
|
+
}
|
|
21308
|
+
}
|
|
21309
|
+
/**
|
|
21310
|
+
* Re-attaches the wrapper to a live container when the previously resolved
|
|
21311
|
+
* one has been detached or no longer holds the wrapper — e.g. the host app
|
|
21312
|
+
* remounted a custom preRenderContainer, which would otherwise leave a stale
|
|
21313
|
+
* reference and collapse the wrapper. Only string selectors can be
|
|
21314
|
+
* re-resolved; a container passed as an element is left untouched.
|
|
21315
|
+
*/
|
|
21316
|
+
reconcilePreRenderContainer() {
|
|
21317
|
+
const wrapper = this.preRenderWrapper;
|
|
21318
|
+
const stored = this.preRenderContainerEl;
|
|
21319
|
+
// Nothing to reconcile until this instance resolved its container.
|
|
21320
|
+
if (!wrapper || !stored) {
|
|
21321
|
+
return;
|
|
21322
|
+
}
|
|
21323
|
+
const storedIsLive = stored === document.body || document.contains(stored);
|
|
21324
|
+
if (storedIsLive && stored.contains(wrapper)) {
|
|
21325
|
+
return;
|
|
21326
|
+
}
|
|
21327
|
+
const resolved = this.resolvePreRenderContainerTarget();
|
|
21328
|
+
// Re-resolution yielded the same (still stale) element — nothing we can
|
|
21329
|
+
// do, e.g. a detached container passed as an HTMLElement.
|
|
21330
|
+
if (resolved === stored && stored.contains(wrapper)) {
|
|
21331
|
+
return;
|
|
21332
|
+
}
|
|
21333
|
+
if (this.containerScrollListener && stored !== resolved) {
|
|
21334
|
+
if (stored !== document.body) {
|
|
21335
|
+
stored.removeEventListener('scroll', this.containerScrollListener);
|
|
21336
|
+
}
|
|
21337
|
+
if (resolved !== document.body) {
|
|
21338
|
+
resolved.addEventListener('scroll', this.containerScrollListener);
|
|
21339
|
+
}
|
|
21340
|
+
}
|
|
21341
|
+
this.applyPreRenderContainerPositioning(resolved);
|
|
21342
|
+
if (wrapper.parentNode !== resolved) {
|
|
21343
|
+
resolved.appendChild(wrapper);
|
|
21344
|
+
}
|
|
21345
|
+
this.preRenderContainerEl = resolved;
|
|
21346
|
+
}
|
|
21188
21347
|
insertIntoDOMForPreRender(child) {
|
|
21189
21348
|
const preRenderChild = this.createPreRenderChild(child);
|
|
21190
21349
|
const preRenderWrapper = this.createPreRenderWrapper();
|
|
@@ -21204,7 +21363,10 @@ class TsEmbed {
|
|
|
21204
21363
|
else {
|
|
21205
21364
|
this.hidePreRender();
|
|
21206
21365
|
}
|
|
21207
|
-
|
|
21366
|
+
const targetContainer = this.resolvePreRenderContainerTarget();
|
|
21367
|
+
this.preRenderContainerEl = targetContainer;
|
|
21368
|
+
this.applyPreRenderContainerPositioning(targetContainer);
|
|
21369
|
+
targetContainer.appendChild(preRenderWrapper);
|
|
21208
21370
|
}
|
|
21209
21371
|
insertIntoDOM(child) {
|
|
21210
21372
|
var _a;
|
|
@@ -21643,6 +21805,50 @@ class TsEmbed {
|
|
|
21643
21805
|
tsParams = tsParams ? `?${tsParams}` : '';
|
|
21644
21806
|
return tsParams;
|
|
21645
21807
|
}
|
|
21808
|
+
/**
|
|
21809
|
+
* Reverts the custom preRenderContainer's `position` to the value it had
|
|
21810
|
+
* before we overrode it to `relative` (see insertIntoDOMForPreRender).
|
|
21811
|
+
*
|
|
21812
|
+
* We restore the original inline value rather than forcing `static`, and we
|
|
21813
|
+
* skip the restore if another preRender wrapper is still mounted inside the
|
|
21814
|
+
* same container — a shared container still needs the positioning context.
|
|
21815
|
+
*/
|
|
21816
|
+
restorePreRenderContainerPosition() {
|
|
21817
|
+
const container = this.preRenderContainerEl;
|
|
21818
|
+
if (!container || container === document.body) {
|
|
21819
|
+
return;
|
|
21820
|
+
}
|
|
21821
|
+
// Drop our reference up front so a destroyed embed never pins a
|
|
21822
|
+
// detached container in memory; restoration uses the local handle.
|
|
21823
|
+
this.preRenderContainerEl = null;
|
|
21824
|
+
const originalPosition = container.dataset[PRERENDER_CONTAINER_ORIGINAL_POSITION_KEY];
|
|
21825
|
+
if (originalPosition === undefined) {
|
|
21826
|
+
// We never overrode this container's position; nothing to restore.
|
|
21827
|
+
return;
|
|
21828
|
+
}
|
|
21829
|
+
// This instance's own wrapper has already been removed by now, so any
|
|
21830
|
+
// match here belongs to another embed still sharing the container — it
|
|
21831
|
+
// continues to rely on the positioning context, so leave it in place.
|
|
21832
|
+
const hasOtherWrapper = container.querySelector(`[id^="${PRERENDER_WRAPPER_ID_PREFIX}"]`);
|
|
21833
|
+
if (hasOtherWrapper) {
|
|
21834
|
+
return;
|
|
21835
|
+
}
|
|
21836
|
+
container.style.position = originalPosition;
|
|
21837
|
+
delete container.dataset[PRERENDER_CONTAINER_ORIGINAL_POSITION_KEY];
|
|
21838
|
+
}
|
|
21839
|
+
/**
|
|
21840
|
+
* Detaches and clears the container scroll listener, if one is attached.
|
|
21841
|
+
*/
|
|
21842
|
+
removeContainerScrollListener() {
|
|
21843
|
+
if (!this.containerScrollListener) {
|
|
21844
|
+
return;
|
|
21845
|
+
}
|
|
21846
|
+
const customContainer = this.preRenderContainerEl && this.preRenderContainerEl !== document.body
|
|
21847
|
+
? this.preRenderContainerEl
|
|
21848
|
+
: null;
|
|
21849
|
+
customContainer === null || customContainer === void 0 ? void 0 : customContainer.removeEventListener('scroll', this.containerScrollListener);
|
|
21850
|
+
this.containerScrollListener = null;
|
|
21851
|
+
}
|
|
21646
21852
|
/**
|
|
21647
21853
|
* Destroys the ThoughtSpot embed, and remove any nodes from the DOM.
|
|
21648
21854
|
* @version SDK: 1.19.1 | ThoughtSpot: *
|
|
@@ -21651,8 +21857,10 @@ class TsEmbed {
|
|
|
21651
21857
|
var _a, _b, _c;
|
|
21652
21858
|
try {
|
|
21653
21859
|
this.removeFullscreenChangeHandler();
|
|
21860
|
+
this.removeContainerScrollListener();
|
|
21654
21861
|
this.unsubscribeToEvents();
|
|
21655
21862
|
(_a = this.preRenderWrapper) === null || _a === void 0 ? void 0 : _a.remove();
|
|
21863
|
+
this.restorePreRenderContainerPosition();
|
|
21656
21864
|
if (!this.isRendered) {
|
|
21657
21865
|
return;
|
|
21658
21866
|
}
|
|
@@ -21762,15 +21970,19 @@ class TsEmbed {
|
|
|
21762
21970
|
}
|
|
21763
21971
|
this.hostElement.appendChild(this.insertedDomEl);
|
|
21764
21972
|
this.syncPreRenderStyle();
|
|
21973
|
+
const customContainer = this.preRenderContainerEl && this.preRenderContainerEl !== document.body
|
|
21974
|
+
? this.preRenderContainerEl
|
|
21975
|
+
: null;
|
|
21976
|
+
if (customContainer && !this.containerScrollListener) {
|
|
21977
|
+
this.containerScrollListener = () => this.syncPreRenderStyle();
|
|
21978
|
+
customContainer.addEventListener('scroll', this.containerScrollListener);
|
|
21979
|
+
}
|
|
21765
21980
|
if (!this.viewConfig.doNotTrackPreRenderSize) {
|
|
21766
21981
|
const observeTarget = (_a = this.insertedDomEl) !== null && _a !== void 0 ? _a : this.hostElement;
|
|
21767
21982
|
this.resizeObserver = new ResizeObserver((entries) => {
|
|
21768
21983
|
entries.forEach((entry) => {
|
|
21769
|
-
if (entry.
|
|
21770
|
-
|
|
21771
|
-
width: `${entry.contentRect.width}px`,
|
|
21772
|
-
height: `${entry.contentRect.height}px`,
|
|
21773
|
-
});
|
|
21984
|
+
if (entry.target === observeTarget) {
|
|
21985
|
+
this.syncPreRenderStyle();
|
|
21774
21986
|
}
|
|
21775
21987
|
});
|
|
21776
21988
|
});
|
|
@@ -21802,14 +22014,24 @@ class TsEmbed {
|
|
|
21802
22014
|
* is not defined or not found.
|
|
21803
22015
|
*/
|
|
21804
22016
|
syncPreRenderStyle() {
|
|
22017
|
+
var _a;
|
|
21805
22018
|
if (!this.isPreRenderConnected() || !this.getPreRenderPlaceHolderElement()) {
|
|
21806
22019
|
logger$3.error(ERROR_MESSAGE.SYNC_STYLE_CALLED_BEFORE_RENDER);
|
|
21807
22020
|
return;
|
|
21808
22021
|
}
|
|
22022
|
+
// Self-heal if the resolved container was remounted/detached, so we
|
|
22023
|
+
// never measure a stale node (which would collapse the wrapper).
|
|
22024
|
+
this.reconcilePreRenderContainer();
|
|
21809
22025
|
const elBoundingClient = this.getPreRenderPlaceHolderElement().getBoundingClientRect();
|
|
22026
|
+
const containerEl = this.preRenderContainerEl && this.preRenderContainerEl !== document.body
|
|
22027
|
+
? this.preRenderContainerEl
|
|
22028
|
+
: null;
|
|
22029
|
+
const containerRect = (_a = containerEl === null || containerEl === void 0 ? void 0 : containerEl.getBoundingClientRect()) !== null && _a !== void 0 ? _a : { x: 0, y: 0 };
|
|
22030
|
+
const scrollX = containerEl ? containerEl.scrollLeft : window.scrollX;
|
|
22031
|
+
const scrollY = containerEl ? containerEl.scrollTop : window.scrollY;
|
|
21810
22032
|
setStyleProperties(this.preRenderWrapper, {
|
|
21811
|
-
top: `${elBoundingClient.y +
|
|
21812
|
-
left: `${elBoundingClient.x +
|
|
22033
|
+
top: `${elBoundingClient.y - containerRect.y + scrollY}px`,
|
|
22034
|
+
left: `${elBoundingClient.x - containerRect.x + scrollX}px`,
|
|
21813
22035
|
width: `${elBoundingClient.width}px`,
|
|
21814
22036
|
height: `${elBoundingClient.height}px`,
|
|
21815
22037
|
position: 'absolute',
|
|
@@ -21836,6 +22058,7 @@ class TsEmbed {
|
|
|
21836
22058
|
overflow: 'hidden',
|
|
21837
22059
|
};
|
|
21838
22060
|
setStyleProperties(this.preRenderWrapper, preRenderHideStyles);
|
|
22061
|
+
this.removeContainerScrollListener();
|
|
21839
22062
|
if (this.resizeObserver) {
|
|
21840
22063
|
this.resizeObserver.disconnect();
|
|
21841
22064
|
}
|
|
@@ -21854,7 +22077,7 @@ class TsEmbed {
|
|
|
21854
22077
|
*/
|
|
21855
22078
|
getPreRenderIds() {
|
|
21856
22079
|
return {
|
|
21857
|
-
wrapper:
|
|
22080
|
+
wrapper: `${PRERENDER_WRAPPER_ID_PREFIX}${this.viewConfig.preRenderId}`,
|
|
21858
22081
|
child: `tsEmbed-pre-render-child-${this.viewConfig.preRenderId}`,
|
|
21859
22082
|
placeHolder: `tsEmbed-pre-render-placeholder-${this.viewConfig.preRenderId}`,
|
|
21860
22083
|
};
|
|
@@ -22291,12 +22514,15 @@ class AppEmbed extends V1Embed {
|
|
|
22291
22514
|
}
|
|
22292
22515
|
// Handle spotterChatConfig params
|
|
22293
22516
|
if (spotterChatConfig) {
|
|
22294
|
-
const { hideToolResponseCardBranding, toolResponseCardBrandingLabel, spotterFileUploadEnabled, spotterFileUploadFileTypes, } = spotterChatConfig;
|
|
22517
|
+
const { hideToolResponseCardBranding, toolResponseCardBrandingLabel, spotterFileUploadEnabled, spotterFileUploadFileTypes, enableStarterPrompts, } = spotterChatConfig;
|
|
22295
22518
|
setParamIfDefined(params, Param.HideToolResponseCardBranding, hideToolResponseCardBranding, true);
|
|
22296
22519
|
setParamIfDefined(params, Param.ToolResponseCardBrandingLabel, toolResponseCardBrandingLabel);
|
|
22297
22520
|
if (spotterFileUploadEnabled !== undefined) {
|
|
22298
22521
|
params[Param.SpotterFileUploadEnabled] = spotterFileUploadEnabled;
|
|
22299
22522
|
}
|
|
22523
|
+
if (enableStarterPrompts !== undefined) {
|
|
22524
|
+
params[Param.IsStarterPromptsEnabled] = enableStarterPrompts;
|
|
22525
|
+
}
|
|
22300
22526
|
if (spotterFileUploadFileTypes !== undefined) {
|
|
22301
22527
|
params[Param.SpotterFileUploadFileTypes] = JSON.stringify(spotterFileUploadFileTypes);
|
|
22302
22528
|
}
|
|
@@ -22852,12 +23078,15 @@ class LiveboardEmbed extends V1Embed {
|
|
|
22852
23078
|
}
|
|
22853
23079
|
// Handle spotterChatConfig params
|
|
22854
23080
|
if (spotterChatConfig) {
|
|
22855
|
-
const { hideToolResponseCardBranding, toolResponseCardBrandingLabel, spotterFileUploadEnabled, spotterFileUploadFileTypes, } = spotterChatConfig;
|
|
23081
|
+
const { hideToolResponseCardBranding, toolResponseCardBrandingLabel, spotterFileUploadEnabled, spotterFileUploadFileTypes, enableStarterPrompts, } = spotterChatConfig;
|
|
22856
23082
|
setParamIfDefined(params, Param.HideToolResponseCardBranding, hideToolResponseCardBranding, true);
|
|
22857
23083
|
setParamIfDefined(params, Param.ToolResponseCardBrandingLabel, toolResponseCardBrandingLabel);
|
|
22858
23084
|
if (spotterFileUploadEnabled !== undefined) {
|
|
22859
23085
|
params[Param.SpotterFileUploadEnabled] = spotterFileUploadEnabled;
|
|
22860
23086
|
}
|
|
23087
|
+
if (enableStarterPrompts !== undefined) {
|
|
23088
|
+
params[Param.IsStarterPromptsEnabled] = enableStarterPrompts;
|
|
23089
|
+
}
|
|
22861
23090
|
if (spotterFileUploadFileTypes !== undefined) {
|
|
22862
23091
|
params[Param.SpotterFileUploadFileTypes] = JSON.stringify(spotterFileUploadFileTypes);
|
|
22863
23092
|
}
|
|
@@ -23976,10 +24205,11 @@ class SpotterEmbed extends TsEmbed {
|
|
|
23976
24205
|
setParamIfDefined(queryParams, Param.EnableStopAnswerGenerationEmbed, enableStopAnswerGenerationEmbed, true);
|
|
23977
24206
|
// Handle spotterChatConfig params
|
|
23978
24207
|
if (spotterChatConfig) {
|
|
23979
|
-
const { hideToolResponseCardBranding, toolResponseCardBrandingLabel, spotterFileUploadEnabled, spotterFileUploadFileTypes, } = spotterChatConfig;
|
|
24208
|
+
const { hideToolResponseCardBranding, toolResponseCardBrandingLabel, spotterFileUploadEnabled, spotterFileUploadFileTypes, enableStarterPrompts, } = spotterChatConfig;
|
|
23980
24209
|
setParamIfDefined(queryParams, Param.HideToolResponseCardBranding, hideToolResponseCardBranding, true);
|
|
23981
24210
|
setParamIfDefined(queryParams, Param.ToolResponseCardBrandingLabel, toolResponseCardBrandingLabel);
|
|
23982
24211
|
setParamIfDefined(queryParams, Param.SpotterFileUploadEnabled, spotterFileUploadEnabled, true);
|
|
24212
|
+
setParamIfDefined(queryParams, Param.IsStarterPromptsEnabled, enableStarterPrompts, true);
|
|
23983
24213
|
if (spotterFileUploadFileTypes !== undefined) {
|
|
23984
24214
|
queryParams[Param.SpotterFileUploadFileTypes] = JSON.stringify(spotterFileUploadFileTypes);
|
|
23985
24215
|
}
|