@thoughtspot/visual-embed-sdk 1.49.0 → 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 +168 -11
- 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/mixpanel-service.js +2 -2
- package/cjs/src/mixpanel-service.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/logger.js +2 -2
- package/cjs/src/utils/logger.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/sdk-version.d.ts +2 -0
- package/cjs/src/utils/sdk-version.d.ts.map +1 -0
- package/cjs/src/utils/sdk-version.js +7 -0
- package/cjs/src/utils/sdk-version.js.map +1 -0
- 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-_UGCSSDR.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/sdk-version.d.ts +2 -0
- package/dist/src/utils/sdk-version.d.ts.map +1 -0
- package/dist/src/utils.d.ts +10 -0
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/tsembed-react.es.js +255 -23
- package/dist/tsembed-react.js +254 -22
- package/dist/tsembed.es.js +255 -23
- package/dist/tsembed.js +254 -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 +168 -11
- 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/mixpanel-service.js +1 -1
- package/lib/src/mixpanel-service.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/logger.js +1 -1
- package/lib/src/utils/logger.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/sdk-version.d.ts +2 -0
- package/lib/src/utils/sdk-version.d.ts.map +1 -0
- package/lib/src/utils/sdk-version.js +3 -0
- package/lib/src/utils/sdk-version.js.map +1 -0
- 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 +181 -10
- package/src/mixpanel-service.ts +1 -1
- package/src/types.ts +86 -3
- package/src/utils/logger.ts +1 -1
- package/src/utils/processTrigger.spec.ts +23 -0
- package/src/utils/processTrigger.ts +8 -6
- package/src/utils/sdk-version.ts +3 -0
- 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,9 @@ var TableContentDensity;
|
|
|
6411
6455
|
TableContentDensity["Compact"] = "COMPACT";
|
|
6412
6456
|
})(TableContentDensity || (TableContentDensity = {}));
|
|
6413
6457
|
|
|
6414
|
-
var version="1.49.
|
|
6458
|
+
var version$1="1.49.2";var pkg = {version:version$1};
|
|
6459
|
+
|
|
6460
|
+
const { version } = pkg;
|
|
6415
6461
|
|
|
6416
6462
|
const logFunctions = {
|
|
6417
6463
|
[LogLevel.SILENT]: () => undefined,
|
|
@@ -6808,6 +6854,27 @@ const getRuntimeFilters = (runtimefilters) => getFilterQuery(runtimefilters || [
|
|
|
6808
6854
|
function getDOMNode(domSelector) {
|
|
6809
6855
|
return typeof domSelector === 'string' ? document.querySelector(domSelector) : domSelector;
|
|
6810
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
|
+
}
|
|
6811
6878
|
const deepMerge = (target, source) => merge(target, source);
|
|
6812
6879
|
const getOperationNameFromQuery = (query) => {
|
|
6813
6880
|
const regex = /(?:query|mutation)\s+(\w+)/;
|
|
@@ -9010,7 +9077,7 @@ class AnswerService {
|
|
|
9010
9077
|
async getTML() {
|
|
9011
9078
|
const { object } = await this.executeQuery(getAnswerTML, {});
|
|
9012
9079
|
const edoc = object[0].edoc;
|
|
9013
|
-
const YAML = await import('./index-
|
|
9080
|
+
const YAML = await import('./index-CS7yJ2Jj.js');
|
|
9014
9081
|
const parsedDoc = YAML.parse(edoc);
|
|
9015
9082
|
return {
|
|
9016
9083
|
answer: {
|
|
@@ -19350,8 +19417,14 @@ function processTrigger(iFrame, messageType, thoughtSpotHost, data, context) {
|
|
|
19350
19417
|
}
|
|
19351
19418
|
}
|
|
19352
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);
|
|
19353
19425
|
channel.port1.onmessage = ({ data: responseData }) => {
|
|
19354
19426
|
var _a;
|
|
19427
|
+
clearTimeout(timeoutId);
|
|
19355
19428
|
channel.port1.close();
|
|
19356
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);
|
|
19357
19430
|
if (error) {
|
|
@@ -19361,11 +19434,6 @@ function processTrigger(iFrame, messageType, thoughtSpotHost, data, context) {
|
|
|
19361
19434
|
res(responseData);
|
|
19362
19435
|
}
|
|
19363
19436
|
};
|
|
19364
|
-
// Close the messageChannel and resolve the promise if timeout.
|
|
19365
|
-
setTimeout(() => {
|
|
19366
|
-
channel.port1.close();
|
|
19367
|
-
res(new Error(ERROR_MESSAGE.TRIGGER_TIMED_OUT));
|
|
19368
|
-
}, TRIGGER_TIMEOUT);
|
|
19369
19437
|
return postIframeMessage(iFrame, { type: messageType, data, context }, thoughtSpotHost, channel);
|
|
19370
19438
|
});
|
|
19371
19439
|
}
|
|
@@ -20283,6 +20351,14 @@ const processLegacyInterceptResponse = (payload) => {
|
|
|
20283
20351
|
*/
|
|
20284
20352
|
const THOUGHTSPOT_PARAM_PREFIX = 'ts-';
|
|
20285
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-';
|
|
20286
20362
|
/**
|
|
20287
20363
|
* The event id map from v2 event names to v1 event id
|
|
20288
20364
|
* v1 events are the classic embed events implemented in Blink v1
|
|
@@ -20318,6 +20394,8 @@ class TsEmbed {
|
|
|
20318
20394
|
*/
|
|
20319
20395
|
this.shouldEncodeUrlQueryParams = false;
|
|
20320
20396
|
this.defaultHiddenActions = [Action.ReportError];
|
|
20397
|
+
this.preRenderContainerEl = null;
|
|
20398
|
+
this.containerScrollListener = null;
|
|
20321
20399
|
/**
|
|
20322
20400
|
* Handler for fullscreen change events
|
|
20323
20401
|
*/
|
|
@@ -21183,6 +21261,89 @@ class TsEmbed {
|
|
|
21183
21261
|
placeholder.id = id.placeHolder;
|
|
21184
21262
|
return placeholder;
|
|
21185
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
|
+
}
|
|
21186
21347
|
insertIntoDOMForPreRender(child) {
|
|
21187
21348
|
const preRenderChild = this.createPreRenderChild(child);
|
|
21188
21349
|
const preRenderWrapper = this.createPreRenderWrapper();
|
|
@@ -21202,7 +21363,10 @@ class TsEmbed {
|
|
|
21202
21363
|
else {
|
|
21203
21364
|
this.hidePreRender();
|
|
21204
21365
|
}
|
|
21205
|
-
|
|
21366
|
+
const targetContainer = this.resolvePreRenderContainerTarget();
|
|
21367
|
+
this.preRenderContainerEl = targetContainer;
|
|
21368
|
+
this.applyPreRenderContainerPositioning(targetContainer);
|
|
21369
|
+
targetContainer.appendChild(preRenderWrapper);
|
|
21206
21370
|
}
|
|
21207
21371
|
insertIntoDOM(child) {
|
|
21208
21372
|
var _a;
|
|
@@ -21641,6 +21805,50 @@ class TsEmbed {
|
|
|
21641
21805
|
tsParams = tsParams ? `?${tsParams}` : '';
|
|
21642
21806
|
return tsParams;
|
|
21643
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
|
+
}
|
|
21644
21852
|
/**
|
|
21645
21853
|
* Destroys the ThoughtSpot embed, and remove any nodes from the DOM.
|
|
21646
21854
|
* @version SDK: 1.19.1 | ThoughtSpot: *
|
|
@@ -21649,8 +21857,10 @@ class TsEmbed {
|
|
|
21649
21857
|
var _a, _b, _c;
|
|
21650
21858
|
try {
|
|
21651
21859
|
this.removeFullscreenChangeHandler();
|
|
21860
|
+
this.removeContainerScrollListener();
|
|
21652
21861
|
this.unsubscribeToEvents();
|
|
21653
21862
|
(_a = this.preRenderWrapper) === null || _a === void 0 ? void 0 : _a.remove();
|
|
21863
|
+
this.restorePreRenderContainerPosition();
|
|
21654
21864
|
if (!this.isRendered) {
|
|
21655
21865
|
return;
|
|
21656
21866
|
}
|
|
@@ -21760,15 +21970,19 @@ class TsEmbed {
|
|
|
21760
21970
|
}
|
|
21761
21971
|
this.hostElement.appendChild(this.insertedDomEl);
|
|
21762
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
|
+
}
|
|
21763
21980
|
if (!this.viewConfig.doNotTrackPreRenderSize) {
|
|
21764
21981
|
const observeTarget = (_a = this.insertedDomEl) !== null && _a !== void 0 ? _a : this.hostElement;
|
|
21765
21982
|
this.resizeObserver = new ResizeObserver((entries) => {
|
|
21766
21983
|
entries.forEach((entry) => {
|
|
21767
|
-
if (entry.
|
|
21768
|
-
|
|
21769
|
-
width: `${entry.contentRect.width}px`,
|
|
21770
|
-
height: `${entry.contentRect.height}px`,
|
|
21771
|
-
});
|
|
21984
|
+
if (entry.target === observeTarget) {
|
|
21985
|
+
this.syncPreRenderStyle();
|
|
21772
21986
|
}
|
|
21773
21987
|
});
|
|
21774
21988
|
});
|
|
@@ -21800,14 +22014,24 @@ class TsEmbed {
|
|
|
21800
22014
|
* is not defined or not found.
|
|
21801
22015
|
*/
|
|
21802
22016
|
syncPreRenderStyle() {
|
|
22017
|
+
var _a;
|
|
21803
22018
|
if (!this.isPreRenderConnected() || !this.getPreRenderPlaceHolderElement()) {
|
|
21804
22019
|
logger$3.error(ERROR_MESSAGE.SYNC_STYLE_CALLED_BEFORE_RENDER);
|
|
21805
22020
|
return;
|
|
21806
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();
|
|
21807
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;
|
|
21808
22032
|
setStyleProperties(this.preRenderWrapper, {
|
|
21809
|
-
top: `${elBoundingClient.y +
|
|
21810
|
-
left: `${elBoundingClient.x +
|
|
22033
|
+
top: `${elBoundingClient.y - containerRect.y + scrollY}px`,
|
|
22034
|
+
left: `${elBoundingClient.x - containerRect.x + scrollX}px`,
|
|
21811
22035
|
width: `${elBoundingClient.width}px`,
|
|
21812
22036
|
height: `${elBoundingClient.height}px`,
|
|
21813
22037
|
position: 'absolute',
|
|
@@ -21834,6 +22058,7 @@ class TsEmbed {
|
|
|
21834
22058
|
overflow: 'hidden',
|
|
21835
22059
|
};
|
|
21836
22060
|
setStyleProperties(this.preRenderWrapper, preRenderHideStyles);
|
|
22061
|
+
this.removeContainerScrollListener();
|
|
21837
22062
|
if (this.resizeObserver) {
|
|
21838
22063
|
this.resizeObserver.disconnect();
|
|
21839
22064
|
}
|
|
@@ -21852,7 +22077,7 @@ class TsEmbed {
|
|
|
21852
22077
|
*/
|
|
21853
22078
|
getPreRenderIds() {
|
|
21854
22079
|
return {
|
|
21855
|
-
wrapper:
|
|
22080
|
+
wrapper: `${PRERENDER_WRAPPER_ID_PREFIX}${this.viewConfig.preRenderId}`,
|
|
21856
22081
|
child: `tsEmbed-pre-render-child-${this.viewConfig.preRenderId}`,
|
|
21857
22082
|
placeHolder: `tsEmbed-pre-render-placeholder-${this.viewConfig.preRenderId}`,
|
|
21858
22083
|
};
|
|
@@ -22289,12 +22514,15 @@ class AppEmbed extends V1Embed {
|
|
|
22289
22514
|
}
|
|
22290
22515
|
// Handle spotterChatConfig params
|
|
22291
22516
|
if (spotterChatConfig) {
|
|
22292
|
-
const { hideToolResponseCardBranding, toolResponseCardBrandingLabel, spotterFileUploadEnabled, spotterFileUploadFileTypes, } = spotterChatConfig;
|
|
22517
|
+
const { hideToolResponseCardBranding, toolResponseCardBrandingLabel, spotterFileUploadEnabled, spotterFileUploadFileTypes, enableStarterPrompts, } = spotterChatConfig;
|
|
22293
22518
|
setParamIfDefined(params, Param.HideToolResponseCardBranding, hideToolResponseCardBranding, true);
|
|
22294
22519
|
setParamIfDefined(params, Param.ToolResponseCardBrandingLabel, toolResponseCardBrandingLabel);
|
|
22295
22520
|
if (spotterFileUploadEnabled !== undefined) {
|
|
22296
22521
|
params[Param.SpotterFileUploadEnabled] = spotterFileUploadEnabled;
|
|
22297
22522
|
}
|
|
22523
|
+
if (enableStarterPrompts !== undefined) {
|
|
22524
|
+
params[Param.IsStarterPromptsEnabled] = enableStarterPrompts;
|
|
22525
|
+
}
|
|
22298
22526
|
if (spotterFileUploadFileTypes !== undefined) {
|
|
22299
22527
|
params[Param.SpotterFileUploadFileTypes] = JSON.stringify(spotterFileUploadFileTypes);
|
|
22300
22528
|
}
|
|
@@ -22850,12 +23078,15 @@ class LiveboardEmbed extends V1Embed {
|
|
|
22850
23078
|
}
|
|
22851
23079
|
// Handle spotterChatConfig params
|
|
22852
23080
|
if (spotterChatConfig) {
|
|
22853
|
-
const { hideToolResponseCardBranding, toolResponseCardBrandingLabel, spotterFileUploadEnabled, spotterFileUploadFileTypes, } = spotterChatConfig;
|
|
23081
|
+
const { hideToolResponseCardBranding, toolResponseCardBrandingLabel, spotterFileUploadEnabled, spotterFileUploadFileTypes, enableStarterPrompts, } = spotterChatConfig;
|
|
22854
23082
|
setParamIfDefined(params, Param.HideToolResponseCardBranding, hideToolResponseCardBranding, true);
|
|
22855
23083
|
setParamIfDefined(params, Param.ToolResponseCardBrandingLabel, toolResponseCardBrandingLabel);
|
|
22856
23084
|
if (spotterFileUploadEnabled !== undefined) {
|
|
22857
23085
|
params[Param.SpotterFileUploadEnabled] = spotterFileUploadEnabled;
|
|
22858
23086
|
}
|
|
23087
|
+
if (enableStarterPrompts !== undefined) {
|
|
23088
|
+
params[Param.IsStarterPromptsEnabled] = enableStarterPrompts;
|
|
23089
|
+
}
|
|
22859
23090
|
if (spotterFileUploadFileTypes !== undefined) {
|
|
22860
23091
|
params[Param.SpotterFileUploadFileTypes] = JSON.stringify(spotterFileUploadFileTypes);
|
|
22861
23092
|
}
|
|
@@ -23974,10 +24205,11 @@ class SpotterEmbed extends TsEmbed {
|
|
|
23974
24205
|
setParamIfDefined(queryParams, Param.EnableStopAnswerGenerationEmbed, enableStopAnswerGenerationEmbed, true);
|
|
23975
24206
|
// Handle spotterChatConfig params
|
|
23976
24207
|
if (spotterChatConfig) {
|
|
23977
|
-
const { hideToolResponseCardBranding, toolResponseCardBrandingLabel, spotterFileUploadEnabled, spotterFileUploadFileTypes, } = spotterChatConfig;
|
|
24208
|
+
const { hideToolResponseCardBranding, toolResponseCardBrandingLabel, spotterFileUploadEnabled, spotterFileUploadFileTypes, enableStarterPrompts, } = spotterChatConfig;
|
|
23978
24209
|
setParamIfDefined(queryParams, Param.HideToolResponseCardBranding, hideToolResponseCardBranding, true);
|
|
23979
24210
|
setParamIfDefined(queryParams, Param.ToolResponseCardBrandingLabel, toolResponseCardBrandingLabel);
|
|
23980
24211
|
setParamIfDefined(queryParams, Param.SpotterFileUploadEnabled, spotterFileUploadEnabled, true);
|
|
24212
|
+
setParamIfDefined(queryParams, Param.IsStarterPromptsEnabled, enableStarterPrompts, true);
|
|
23981
24213
|
if (spotterFileUploadFileTypes !== undefined) {
|
|
23982
24214
|
queryParams[Param.SpotterFileUploadFileTypes] = JSON.stringify(spotterFileUploadFileTypes);
|
|
23983
24215
|
}
|