@thoughtspot/visual-embed-sdk 1.49.1 → 1.49.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/package.json +4 -10
- 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 +7 -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 +6 -0
- 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/spotter-viz-utils.d.ts +29 -0
- package/cjs/src/embed/spotter-viz-utils.d.ts.map +1 -1
- package/cjs/src/embed/spotter-viz-utils.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/index.d.ts +2 -2
- package/cjs/src/index.d.ts.map +1 -1
- package/cjs/src/index.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/graphql/answerService/answerService.spec.js +15 -0
- package/cjs/src/utils/graphql/answerService/answerService.spec.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 +25 -4
- 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-DsSQndIB.js} +303 -187
- 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 +7 -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 +6 -0
- package/dist/src/embed/liveboard.d.ts.map +1 -1
- package/dist/src/embed/spotter-viz-utils.d.ts +29 -0
- package/dist/src/embed/spotter-viz-utils.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/index.d.ts +2 -2
- package/dist/src/index.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 +282 -35
- package/dist/tsembed-react.js +583 -220
- package/dist/tsembed.es.js +282 -35
- package/dist/tsembed.js +583 -220
- package/dist/visual-embed-sdk-react-full.d.ts +190 -4
- package/dist/visual-embed-sdk-react.d.ts +190 -4
- package/dist/visual-embed-sdk.d.ts +190 -4
- package/lib/package.json +4 -10
- 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 +7 -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 +6 -0
- 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/spotter-viz-utils.d.ts +29 -0
- package/lib/src/embed/spotter-viz-utils.d.ts.map +1 -1
- package/lib/src/embed/spotter-viz-utils.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/index.d.ts +2 -2
- package/lib/src/index.d.ts.map +1 -1
- package/lib/src/index.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/graphql/answerService/answerService.spec.js +15 -0
- package/lib/src/utils/graphql/answerService/answerService.spec.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 +22 -1
- 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 +190 -4
- package/package.json +4 -10
- package/src/css-variables.ts +20 -0
- package/src/embed/app.spec.ts +109 -0
- package/src/embed/app.ts +11 -1
- 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 +10 -0
- package/src/embed/spotter-viz-utils.ts +30 -0
- package/src/embed/ts-embed.spec.ts +294 -0
- package/src/embed/ts-embed.ts +180 -9
- package/src/index.ts +2 -1
- package/src/types.ts +86 -3
- package/src/utils/graphql/answerService/answerService.spec.ts +18 -0
- 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 +25 -1
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.3 */
|
|
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.3";var pkg = {version:version$1};
|
|
6415
6459
|
|
|
6416
6460
|
const { version } = pkg;
|
|
6417
6461
|
|
|
@@ -6496,28 +6540,45 @@ const isObject$1 = (obj) => {
|
|
|
6496
6540
|
}
|
|
6497
6541
|
return false;
|
|
6498
6542
|
};
|
|
6499
|
-
const
|
|
6543
|
+
const UNSAFE_KEYS = new Set([
|
|
6544
|
+
"__proto__",
|
|
6545
|
+
"constructor",
|
|
6546
|
+
"prototype",
|
|
6547
|
+
"toString",
|
|
6548
|
+
"valueOf",
|
|
6549
|
+
"hasOwnProperty",
|
|
6550
|
+
"isPrototypeOf",
|
|
6551
|
+
"propertyIsEnumerable",
|
|
6552
|
+
"toLocaleString",
|
|
6553
|
+
]);
|
|
6554
|
+
const merge$1 = (...objects) => objects.reduce((result, current) => {
|
|
6555
|
+
if (current === undefined) {
|
|
6556
|
+
return result;
|
|
6557
|
+
}
|
|
6500
6558
|
if (Array.isArray(current)) {
|
|
6501
6559
|
throw new TypeError("Arguments provided to ts-deepmerge must be objects, not arrays.");
|
|
6502
6560
|
}
|
|
6503
6561
|
Object.keys(current).forEach((key) => {
|
|
6504
|
-
if (
|
|
6562
|
+
if (UNSAFE_KEYS.has(key)) {
|
|
6505
6563
|
return;
|
|
6506
6564
|
}
|
|
6507
6565
|
if (Array.isArray(result[key]) && Array.isArray(current[key])) {
|
|
6508
|
-
result[key] = merge.options.mergeArrays
|
|
6509
|
-
? merge.options.uniqueArrayItems
|
|
6566
|
+
result[key] = merge$1.options.mergeArrays
|
|
6567
|
+
? merge$1.options.uniqueArrayItems
|
|
6510
6568
|
? Array.from(new Set(result[key].concat(current[key])))
|
|
6511
6569
|
: [...result[key], ...current[key]]
|
|
6512
6570
|
: current[key];
|
|
6513
6571
|
}
|
|
6514
6572
|
else if (isObject$1(result[key]) && isObject$1(current[key])) {
|
|
6515
|
-
result[key] = merge(result[key], current[key]);
|
|
6573
|
+
result[key] = merge$1(result[key], current[key]);
|
|
6574
|
+
}
|
|
6575
|
+
else if (!isObject$1(result[key]) && isObject$1(current[key])) {
|
|
6576
|
+
result[key] = merge$1(current[key], undefined);
|
|
6516
6577
|
}
|
|
6517
6578
|
else {
|
|
6518
6579
|
result[key] =
|
|
6519
6580
|
current[key] === undefined
|
|
6520
|
-
? merge.options.allowUndefinedOverrides
|
|
6581
|
+
? merge$1.options.allowUndefinedOverrides
|
|
6521
6582
|
? current[key]
|
|
6522
6583
|
: result[key]
|
|
6523
6584
|
: current[key];
|
|
@@ -6530,11 +6591,11 @@ const defaultOptions = {
|
|
|
6530
6591
|
mergeArrays: true,
|
|
6531
6592
|
uniqueArrayItems: true,
|
|
6532
6593
|
};
|
|
6533
|
-
merge.options = defaultOptions;
|
|
6534
|
-
merge.withOptions = (options, ...objects) => {
|
|
6535
|
-
merge.options = Object.assign(Object.assign({}, defaultOptions), options);
|
|
6536
|
-
const result = merge(...objects);
|
|
6537
|
-
merge.options = defaultOptions;
|
|
6594
|
+
merge$1.options = defaultOptions;
|
|
6595
|
+
merge$1.withOptions = (options, ...objects) => {
|
|
6596
|
+
merge$1.options = Object.assign(Object.assign({}, defaultOptions), options);
|
|
6597
|
+
const result = merge$1(...objects);
|
|
6598
|
+
merge$1.options = defaultOptions;
|
|
6538
6599
|
return result;
|
|
6539
6600
|
};
|
|
6540
6601
|
|
|
@@ -6810,7 +6871,28 @@ const getRuntimeFilters = (runtimefilters) => getFilterQuery(runtimefilters || [
|
|
|
6810
6871
|
function getDOMNode(domSelector) {
|
|
6811
6872
|
return typeof domSelector === 'string' ? document.querySelector(domSelector) : domSelector;
|
|
6812
6873
|
}
|
|
6813
|
-
|
|
6874
|
+
/**
|
|
6875
|
+
* Resolves a CSS selector to an element. `document.querySelector` cannot pierce
|
|
6876
|
+
* shadow boundaries, so when the document lookup misses and a reference node is
|
|
6877
|
+
* provided, this also searches the shadow root the reference node lives in —
|
|
6878
|
+
* letting a selector target an element inside the same shadow root as the embed
|
|
6879
|
+
* instead of silently falling back to the light DOM.
|
|
6880
|
+
* @param selector CSS selector string.
|
|
6881
|
+
* @param referenceNode Node whose shadow root is searched when the document lookup misses.
|
|
6882
|
+
*/
|
|
6883
|
+
function querySelectorAcrossShadowRoot(selector, referenceNode) {
|
|
6884
|
+
var _a;
|
|
6885
|
+
const fromDocument = document.querySelector(selector);
|
|
6886
|
+
if (fromDocument) {
|
|
6887
|
+
return fromDocument;
|
|
6888
|
+
}
|
|
6889
|
+
const rootNode = (_a = referenceNode === null || referenceNode === void 0 ? void 0 : referenceNode.getRootNode) === null || _a === void 0 ? void 0 : _a.call(referenceNode);
|
|
6890
|
+
if (typeof ShadowRoot !== 'undefined' && rootNode instanceof ShadowRoot) {
|
|
6891
|
+
return rootNode.querySelector(selector);
|
|
6892
|
+
}
|
|
6893
|
+
return null;
|
|
6894
|
+
}
|
|
6895
|
+
const deepMerge = (target, source) => merge$1(target, source);
|
|
6814
6896
|
const getOperationNameFromQuery = (query) => {
|
|
6815
6897
|
const regex = /(?:query|mutation)\s+(\w+)/;
|
|
6816
6898
|
const matches = query.match(regex);
|
|
@@ -9012,7 +9094,7 @@ class AnswerService {
|
|
|
9012
9094
|
async getTML() {
|
|
9013
9095
|
const { object } = await this.executeQuery(getAnswerTML, {});
|
|
9014
9096
|
const edoc = object[0].edoc;
|
|
9015
|
-
const YAML = await import('./index-
|
|
9097
|
+
const YAML = await import('./index-DsSQndIB.js');
|
|
9016
9098
|
const parsedDoc = YAML.parse(edoc);
|
|
9017
9099
|
return {
|
|
9018
9100
|
answer: {
|
|
@@ -19352,8 +19434,14 @@ function processTrigger(iFrame, messageType, thoughtSpotHost, data, context) {
|
|
|
19352
19434
|
}
|
|
19353
19435
|
}
|
|
19354
19436
|
const channel = new MessageChannel();
|
|
19437
|
+
// Close the messageChannel and resolve the promise if timeout.
|
|
19438
|
+
const timeoutId = setTimeout(() => {
|
|
19439
|
+
channel.port1.close();
|
|
19440
|
+
res(new Error(ERROR_MESSAGE.TRIGGER_TIMED_OUT));
|
|
19441
|
+
}, TRIGGER_TIMEOUT);
|
|
19355
19442
|
channel.port1.onmessage = ({ data: responseData }) => {
|
|
19356
19443
|
var _a;
|
|
19444
|
+
clearTimeout(timeoutId);
|
|
19357
19445
|
channel.port1.close();
|
|
19358
19446
|
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
19447
|
if (error) {
|
|
@@ -19363,11 +19451,6 @@ function processTrigger(iFrame, messageType, thoughtSpotHost, data, context) {
|
|
|
19363
19451
|
res(responseData);
|
|
19364
19452
|
}
|
|
19365
19453
|
};
|
|
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
19454
|
return postIframeMessage(iFrame, { type: messageType, data, context }, thoughtSpotHost, channel);
|
|
19372
19455
|
});
|
|
19373
19456
|
}
|
|
@@ -20285,6 +20368,14 @@ const processLegacyInterceptResponse = (payload) => {
|
|
|
20285
20368
|
*/
|
|
20286
20369
|
const THOUGHTSPOT_PARAM_PREFIX = 'ts-';
|
|
20287
20370
|
const TS_EMBED_ID = '_thoughtspot-embed';
|
|
20371
|
+
/**
|
|
20372
|
+
* dataset key used to stash a custom preRenderContainer's original inline
|
|
20373
|
+
* `position` while we override it to `relative`. Stored on the container (not
|
|
20374
|
+
* per-instance) so the override can be reverted on destroy even when multiple
|
|
20375
|
+
* pre-rendered embeds share the same container.
|
|
20376
|
+
*/
|
|
20377
|
+
const PRERENDER_CONTAINER_ORIGINAL_POSITION_KEY = 'tsEmbedOriginalPosition';
|
|
20378
|
+
const PRERENDER_WRAPPER_ID_PREFIX = 'tsEmbed-pre-render-wrapper-';
|
|
20288
20379
|
/**
|
|
20289
20380
|
* The event id map from v2 event names to v1 event id
|
|
20290
20381
|
* v1 events are the classic embed events implemented in Blink v1
|
|
@@ -20320,6 +20411,8 @@ class TsEmbed {
|
|
|
20320
20411
|
*/
|
|
20321
20412
|
this.shouldEncodeUrlQueryParams = false;
|
|
20322
20413
|
this.defaultHiddenActions = [Action.ReportError];
|
|
20414
|
+
this.preRenderContainerEl = null;
|
|
20415
|
+
this.containerScrollListener = null;
|
|
20323
20416
|
/**
|
|
20324
20417
|
* Handler for fullscreen change events
|
|
20325
20418
|
*/
|
|
@@ -21185,6 +21278,89 @@ class TsEmbed {
|
|
|
21185
21278
|
placeholder.id = id.placeHolder;
|
|
21186
21279
|
return placeholder;
|
|
21187
21280
|
}
|
|
21281
|
+
/**
|
|
21282
|
+
* Resolves the configured preRenderContainer to a live element, falling
|
|
21283
|
+
* back to `document.body`. A string selector is re-queried on every call so
|
|
21284
|
+
* a remounted container (E.g.: React replacing the node) resolves to the
|
|
21285
|
+
* fresh element; an element passed directly cannot be re-resolved.
|
|
21286
|
+
*/
|
|
21287
|
+
resolvePreRenderContainerTarget() {
|
|
21288
|
+
var _a;
|
|
21289
|
+
const containerConfig = this.viewConfig.preRenderContainer;
|
|
21290
|
+
let container = null;
|
|
21291
|
+
if (typeof containerConfig === 'string') {
|
|
21292
|
+
try {
|
|
21293
|
+
// Resolve against the host's shadow root too, so a selector can
|
|
21294
|
+
// target a container inside the same shadow DOM as the embed —
|
|
21295
|
+
// document.querySelector alone cannot pierce shadow boundaries.
|
|
21296
|
+
container = querySelectorAcrossShadowRoot(containerConfig, this.hostElement);
|
|
21297
|
+
}
|
|
21298
|
+
catch (e) {
|
|
21299
|
+
logger$3.error(`Invalid CSS selector for preRenderContainer: ${containerConfig}`, e);
|
|
21300
|
+
}
|
|
21301
|
+
}
|
|
21302
|
+
else if (containerConfig) {
|
|
21303
|
+
container = containerConfig;
|
|
21304
|
+
}
|
|
21305
|
+
return (_a = container) !== null && _a !== void 0 ? _a : document.body;
|
|
21306
|
+
}
|
|
21307
|
+
/**
|
|
21308
|
+
* Makes the container a positioning context for the absolutely positioned
|
|
21309
|
+
* wrapper, stashing the original inline `position` on the element (once) so
|
|
21310
|
+
* destroy() can restore it exactly, leaving no trace. Recording it on the
|
|
21311
|
+
* element rather than per-instance lets the override be reverted even when
|
|
21312
|
+
* embeds share the same container.
|
|
21313
|
+
*/
|
|
21314
|
+
applyPreRenderContainerPositioning(container) {
|
|
21315
|
+
if (container === document.body) {
|
|
21316
|
+
return;
|
|
21317
|
+
}
|
|
21318
|
+
const pos = window.getComputedStyle(container).position;
|
|
21319
|
+
if (pos === 'static') {
|
|
21320
|
+
if (container.dataset[PRERENDER_CONTAINER_ORIGINAL_POSITION_KEY] === undefined) {
|
|
21321
|
+
container.dataset[PRERENDER_CONTAINER_ORIGINAL_POSITION_KEY] = container.style.position;
|
|
21322
|
+
}
|
|
21323
|
+
container.style.position = 'relative';
|
|
21324
|
+
}
|
|
21325
|
+
}
|
|
21326
|
+
/**
|
|
21327
|
+
* Re-attaches the wrapper to a live container when the previously resolved
|
|
21328
|
+
* one has been detached or no longer holds the wrapper — e.g. the host app
|
|
21329
|
+
* remounted a custom preRenderContainer, which would otherwise leave a stale
|
|
21330
|
+
* reference and collapse the wrapper. Only string selectors can be
|
|
21331
|
+
* re-resolved; a container passed as an element is left untouched.
|
|
21332
|
+
*/
|
|
21333
|
+
reconcilePreRenderContainer() {
|
|
21334
|
+
const wrapper = this.preRenderWrapper;
|
|
21335
|
+
const stored = this.preRenderContainerEl;
|
|
21336
|
+
// Nothing to reconcile until this instance resolved its container.
|
|
21337
|
+
if (!wrapper || !stored) {
|
|
21338
|
+
return;
|
|
21339
|
+
}
|
|
21340
|
+
const storedIsLive = stored === document.body || document.contains(stored);
|
|
21341
|
+
if (storedIsLive && stored.contains(wrapper)) {
|
|
21342
|
+
return;
|
|
21343
|
+
}
|
|
21344
|
+
const resolved = this.resolvePreRenderContainerTarget();
|
|
21345
|
+
// Re-resolution yielded the same (still stale) element — nothing we can
|
|
21346
|
+
// do, e.g. a detached container passed as an HTMLElement.
|
|
21347
|
+
if (resolved === stored && stored.contains(wrapper)) {
|
|
21348
|
+
return;
|
|
21349
|
+
}
|
|
21350
|
+
if (this.containerScrollListener && stored !== resolved) {
|
|
21351
|
+
if (stored !== document.body) {
|
|
21352
|
+
stored.removeEventListener('scroll', this.containerScrollListener);
|
|
21353
|
+
}
|
|
21354
|
+
if (resolved !== document.body) {
|
|
21355
|
+
resolved.addEventListener('scroll', this.containerScrollListener);
|
|
21356
|
+
}
|
|
21357
|
+
}
|
|
21358
|
+
this.applyPreRenderContainerPositioning(resolved);
|
|
21359
|
+
if (wrapper.parentNode !== resolved) {
|
|
21360
|
+
resolved.appendChild(wrapper);
|
|
21361
|
+
}
|
|
21362
|
+
this.preRenderContainerEl = resolved;
|
|
21363
|
+
}
|
|
21188
21364
|
insertIntoDOMForPreRender(child) {
|
|
21189
21365
|
const preRenderChild = this.createPreRenderChild(child);
|
|
21190
21366
|
const preRenderWrapper = this.createPreRenderWrapper();
|
|
@@ -21204,7 +21380,10 @@ class TsEmbed {
|
|
|
21204
21380
|
else {
|
|
21205
21381
|
this.hidePreRender();
|
|
21206
21382
|
}
|
|
21207
|
-
|
|
21383
|
+
const targetContainer = this.resolvePreRenderContainerTarget();
|
|
21384
|
+
this.preRenderContainerEl = targetContainer;
|
|
21385
|
+
this.applyPreRenderContainerPositioning(targetContainer);
|
|
21386
|
+
targetContainer.appendChild(preRenderWrapper);
|
|
21208
21387
|
}
|
|
21209
21388
|
insertIntoDOM(child) {
|
|
21210
21389
|
var _a;
|
|
@@ -21643,6 +21822,50 @@ class TsEmbed {
|
|
|
21643
21822
|
tsParams = tsParams ? `?${tsParams}` : '';
|
|
21644
21823
|
return tsParams;
|
|
21645
21824
|
}
|
|
21825
|
+
/**
|
|
21826
|
+
* Reverts the custom preRenderContainer's `position` to the value it had
|
|
21827
|
+
* before we overrode it to `relative` (see insertIntoDOMForPreRender).
|
|
21828
|
+
*
|
|
21829
|
+
* We restore the original inline value rather than forcing `static`, and we
|
|
21830
|
+
* skip the restore if another preRender wrapper is still mounted inside the
|
|
21831
|
+
* same container — a shared container still needs the positioning context.
|
|
21832
|
+
*/
|
|
21833
|
+
restorePreRenderContainerPosition() {
|
|
21834
|
+
const container = this.preRenderContainerEl;
|
|
21835
|
+
if (!container || container === document.body) {
|
|
21836
|
+
return;
|
|
21837
|
+
}
|
|
21838
|
+
// Drop our reference up front so a destroyed embed never pins a
|
|
21839
|
+
// detached container in memory; restoration uses the local handle.
|
|
21840
|
+
this.preRenderContainerEl = null;
|
|
21841
|
+
const originalPosition = container.dataset[PRERENDER_CONTAINER_ORIGINAL_POSITION_KEY];
|
|
21842
|
+
if (originalPosition === undefined) {
|
|
21843
|
+
// We never overrode this container's position; nothing to restore.
|
|
21844
|
+
return;
|
|
21845
|
+
}
|
|
21846
|
+
// This instance's own wrapper has already been removed by now, so any
|
|
21847
|
+
// match here belongs to another embed still sharing the container — it
|
|
21848
|
+
// continues to rely on the positioning context, so leave it in place.
|
|
21849
|
+
const hasOtherWrapper = container.querySelector(`[id^="${PRERENDER_WRAPPER_ID_PREFIX}"]`);
|
|
21850
|
+
if (hasOtherWrapper) {
|
|
21851
|
+
return;
|
|
21852
|
+
}
|
|
21853
|
+
container.style.position = originalPosition;
|
|
21854
|
+
delete container.dataset[PRERENDER_CONTAINER_ORIGINAL_POSITION_KEY];
|
|
21855
|
+
}
|
|
21856
|
+
/**
|
|
21857
|
+
* Detaches and clears the container scroll listener, if one is attached.
|
|
21858
|
+
*/
|
|
21859
|
+
removeContainerScrollListener() {
|
|
21860
|
+
if (!this.containerScrollListener) {
|
|
21861
|
+
return;
|
|
21862
|
+
}
|
|
21863
|
+
const customContainer = this.preRenderContainerEl && this.preRenderContainerEl !== document.body
|
|
21864
|
+
? this.preRenderContainerEl
|
|
21865
|
+
: null;
|
|
21866
|
+
customContainer === null || customContainer === void 0 ? void 0 : customContainer.removeEventListener('scroll', this.containerScrollListener);
|
|
21867
|
+
this.containerScrollListener = null;
|
|
21868
|
+
}
|
|
21646
21869
|
/**
|
|
21647
21870
|
* Destroys the ThoughtSpot embed, and remove any nodes from the DOM.
|
|
21648
21871
|
* @version SDK: 1.19.1 | ThoughtSpot: *
|
|
@@ -21651,8 +21874,10 @@ class TsEmbed {
|
|
|
21651
21874
|
var _a, _b, _c;
|
|
21652
21875
|
try {
|
|
21653
21876
|
this.removeFullscreenChangeHandler();
|
|
21877
|
+
this.removeContainerScrollListener();
|
|
21654
21878
|
this.unsubscribeToEvents();
|
|
21655
21879
|
(_a = this.preRenderWrapper) === null || _a === void 0 ? void 0 : _a.remove();
|
|
21880
|
+
this.restorePreRenderContainerPosition();
|
|
21656
21881
|
if (!this.isRendered) {
|
|
21657
21882
|
return;
|
|
21658
21883
|
}
|
|
@@ -21762,15 +21987,19 @@ class TsEmbed {
|
|
|
21762
21987
|
}
|
|
21763
21988
|
this.hostElement.appendChild(this.insertedDomEl);
|
|
21764
21989
|
this.syncPreRenderStyle();
|
|
21990
|
+
const customContainer = this.preRenderContainerEl && this.preRenderContainerEl !== document.body
|
|
21991
|
+
? this.preRenderContainerEl
|
|
21992
|
+
: null;
|
|
21993
|
+
if (customContainer && !this.containerScrollListener) {
|
|
21994
|
+
this.containerScrollListener = () => this.syncPreRenderStyle();
|
|
21995
|
+
customContainer.addEventListener('scroll', this.containerScrollListener);
|
|
21996
|
+
}
|
|
21765
21997
|
if (!this.viewConfig.doNotTrackPreRenderSize) {
|
|
21766
21998
|
const observeTarget = (_a = this.insertedDomEl) !== null && _a !== void 0 ? _a : this.hostElement;
|
|
21767
21999
|
this.resizeObserver = new ResizeObserver((entries) => {
|
|
21768
22000
|
entries.forEach((entry) => {
|
|
21769
|
-
if (entry.
|
|
21770
|
-
|
|
21771
|
-
width: `${entry.contentRect.width}px`,
|
|
21772
|
-
height: `${entry.contentRect.height}px`,
|
|
21773
|
-
});
|
|
22001
|
+
if (entry.target === observeTarget) {
|
|
22002
|
+
this.syncPreRenderStyle();
|
|
21774
22003
|
}
|
|
21775
22004
|
});
|
|
21776
22005
|
});
|
|
@@ -21802,14 +22031,24 @@ class TsEmbed {
|
|
|
21802
22031
|
* is not defined or not found.
|
|
21803
22032
|
*/
|
|
21804
22033
|
syncPreRenderStyle() {
|
|
22034
|
+
var _a;
|
|
21805
22035
|
if (!this.isPreRenderConnected() || !this.getPreRenderPlaceHolderElement()) {
|
|
21806
22036
|
logger$3.error(ERROR_MESSAGE.SYNC_STYLE_CALLED_BEFORE_RENDER);
|
|
21807
22037
|
return;
|
|
21808
22038
|
}
|
|
22039
|
+
// Self-heal if the resolved container was remounted/detached, so we
|
|
22040
|
+
// never measure a stale node (which would collapse the wrapper).
|
|
22041
|
+
this.reconcilePreRenderContainer();
|
|
21809
22042
|
const elBoundingClient = this.getPreRenderPlaceHolderElement().getBoundingClientRect();
|
|
22043
|
+
const containerEl = this.preRenderContainerEl && this.preRenderContainerEl !== document.body
|
|
22044
|
+
? this.preRenderContainerEl
|
|
22045
|
+
: null;
|
|
22046
|
+
const containerRect = (_a = containerEl === null || containerEl === void 0 ? void 0 : containerEl.getBoundingClientRect()) !== null && _a !== void 0 ? _a : { x: 0, y: 0 };
|
|
22047
|
+
const scrollX = containerEl ? containerEl.scrollLeft : window.scrollX;
|
|
22048
|
+
const scrollY = containerEl ? containerEl.scrollTop : window.scrollY;
|
|
21810
22049
|
setStyleProperties(this.preRenderWrapper, {
|
|
21811
|
-
top: `${elBoundingClient.y +
|
|
21812
|
-
left: `${elBoundingClient.x +
|
|
22050
|
+
top: `${elBoundingClient.y - containerRect.y + scrollY}px`,
|
|
22051
|
+
left: `${elBoundingClient.x - containerRect.x + scrollX}px`,
|
|
21813
22052
|
width: `${elBoundingClient.width}px`,
|
|
21814
22053
|
height: `${elBoundingClient.height}px`,
|
|
21815
22054
|
position: 'absolute',
|
|
@@ -21836,6 +22075,7 @@ class TsEmbed {
|
|
|
21836
22075
|
overflow: 'hidden',
|
|
21837
22076
|
};
|
|
21838
22077
|
setStyleProperties(this.preRenderWrapper, preRenderHideStyles);
|
|
22078
|
+
this.removeContainerScrollListener();
|
|
21839
22079
|
if (this.resizeObserver) {
|
|
21840
22080
|
this.resizeObserver.disconnect();
|
|
21841
22081
|
}
|
|
@@ -21854,7 +22094,7 @@ class TsEmbed {
|
|
|
21854
22094
|
*/
|
|
21855
22095
|
getPreRenderIds() {
|
|
21856
22096
|
return {
|
|
21857
|
-
wrapper:
|
|
22097
|
+
wrapper: `${PRERENDER_WRAPPER_ID_PREFIX}${this.viewConfig.preRenderId}`,
|
|
21858
22098
|
child: `tsEmbed-pre-render-child-${this.viewConfig.preRenderId}`,
|
|
21859
22099
|
placeHolder: `tsEmbed-pre-render-placeholder-${this.viewConfig.preRenderId}`,
|
|
21860
22100
|
};
|
|
@@ -22291,12 +22531,15 @@ class AppEmbed extends V1Embed {
|
|
|
22291
22531
|
}
|
|
22292
22532
|
// Handle spotterChatConfig params
|
|
22293
22533
|
if (spotterChatConfig) {
|
|
22294
|
-
const { hideToolResponseCardBranding, toolResponseCardBrandingLabel, spotterFileUploadEnabled, spotterFileUploadFileTypes, } = spotterChatConfig;
|
|
22534
|
+
const { hideToolResponseCardBranding, toolResponseCardBrandingLabel, spotterFileUploadEnabled, spotterFileUploadFileTypes, enableStarterPrompts, } = spotterChatConfig;
|
|
22295
22535
|
setParamIfDefined(params, Param.HideToolResponseCardBranding, hideToolResponseCardBranding, true);
|
|
22296
22536
|
setParamIfDefined(params, Param.ToolResponseCardBrandingLabel, toolResponseCardBrandingLabel);
|
|
22297
22537
|
if (spotterFileUploadEnabled !== undefined) {
|
|
22298
22538
|
params[Param.SpotterFileUploadEnabled] = spotterFileUploadEnabled;
|
|
22299
22539
|
}
|
|
22540
|
+
if (enableStarterPrompts !== undefined) {
|
|
22541
|
+
params[Param.IsStarterPromptsEnabled] = enableStarterPrompts;
|
|
22542
|
+
}
|
|
22300
22543
|
if (spotterFileUploadFileTypes !== undefined) {
|
|
22301
22544
|
params[Param.SpotterFileUploadFileTypes] = JSON.stringify(spotterFileUploadFileTypes);
|
|
22302
22545
|
}
|
|
@@ -22852,12 +23095,15 @@ class LiveboardEmbed extends V1Embed {
|
|
|
22852
23095
|
}
|
|
22853
23096
|
// Handle spotterChatConfig params
|
|
22854
23097
|
if (spotterChatConfig) {
|
|
22855
|
-
const { hideToolResponseCardBranding, toolResponseCardBrandingLabel, spotterFileUploadEnabled, spotterFileUploadFileTypes, } = spotterChatConfig;
|
|
23098
|
+
const { hideToolResponseCardBranding, toolResponseCardBrandingLabel, spotterFileUploadEnabled, spotterFileUploadFileTypes, enableStarterPrompts, } = spotterChatConfig;
|
|
22856
23099
|
setParamIfDefined(params, Param.HideToolResponseCardBranding, hideToolResponseCardBranding, true);
|
|
22857
23100
|
setParamIfDefined(params, Param.ToolResponseCardBrandingLabel, toolResponseCardBrandingLabel);
|
|
22858
23101
|
if (spotterFileUploadEnabled !== undefined) {
|
|
22859
23102
|
params[Param.SpotterFileUploadEnabled] = spotterFileUploadEnabled;
|
|
22860
23103
|
}
|
|
23104
|
+
if (enableStarterPrompts !== undefined) {
|
|
23105
|
+
params[Param.IsStarterPromptsEnabled] = enableStarterPrompts;
|
|
23106
|
+
}
|
|
22861
23107
|
if (spotterFileUploadFileTypes !== undefined) {
|
|
22862
23108
|
params[Param.SpotterFileUploadFileTypes] = JSON.stringify(spotterFileUploadFileTypes);
|
|
22863
23109
|
}
|
|
@@ -23976,10 +24222,11 @@ class SpotterEmbed extends TsEmbed {
|
|
|
23976
24222
|
setParamIfDefined(queryParams, Param.EnableStopAnswerGenerationEmbed, enableStopAnswerGenerationEmbed, true);
|
|
23977
24223
|
// Handle spotterChatConfig params
|
|
23978
24224
|
if (spotterChatConfig) {
|
|
23979
|
-
const { hideToolResponseCardBranding, toolResponseCardBrandingLabel, spotterFileUploadEnabled, spotterFileUploadFileTypes, } = spotterChatConfig;
|
|
24225
|
+
const { hideToolResponseCardBranding, toolResponseCardBrandingLabel, spotterFileUploadEnabled, spotterFileUploadFileTypes, enableStarterPrompts, } = spotterChatConfig;
|
|
23980
24226
|
setParamIfDefined(queryParams, Param.HideToolResponseCardBranding, hideToolResponseCardBranding, true);
|
|
23981
24227
|
setParamIfDefined(queryParams, Param.ToolResponseCardBrandingLabel, toolResponseCardBrandingLabel);
|
|
23982
24228
|
setParamIfDefined(queryParams, Param.SpotterFileUploadEnabled, spotterFileUploadEnabled, true);
|
|
24229
|
+
setParamIfDefined(queryParams, Param.IsStarterPromptsEnabled, enableStarterPrompts, true);
|
|
23983
24230
|
if (spotterFileUploadFileTypes !== undefined) {
|
|
23984
24231
|
queryParams[Param.SpotterFileUploadFileTypes] = JSON.stringify(spotterFileUploadFileTypes);
|
|
23985
24232
|
}
|