@thoughtspot/visual-embed-sdk 1.52.2-beta → 1.52.2-beta.0
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 +2 -2
- package/cjs/src/embed/app.js +1 -1
- package/cjs/src/embed/app.js.map +1 -1
- package/cjs/src/embed/auto-frame-renderer.js +1 -1
- package/cjs/src/embed/auto-frame-renderer.js.map +1 -1
- package/cjs/src/embed/bodyless-conversation.js +1 -1
- package/cjs/src/embed/bodyless-conversation.js.map +1 -1
- package/cjs/src/embed/conversation.js +1 -1
- package/cjs/src/embed/conversation.js.map +1 -1
- package/cjs/src/embed/liveboard.js +1 -1
- package/cjs/src/embed/liveboard.js.map +1 -1
- package/cjs/src/embed/search-bar.js +1 -1
- package/cjs/src/embed/search-bar.js.map +1 -1
- package/cjs/src/embed/search.js +1 -1
- package/cjs/src/embed/search.js.map +1 -1
- package/cjs/src/embed/search.spec.js +0 -20
- package/cjs/src/embed/search.spec.js.map +1 -1
- package/cjs/src/embed/ts-embed.d.ts +34 -12
- package/cjs/src/embed/ts-embed.d.ts.map +1 -1
- package/cjs/src/embed/ts-embed.js +98 -142
- package/cjs/src/embed/ts-embed.js.map +1 -1
- package/cjs/src/embed/ts-embed.spec.d.ts.map +1 -1
- package/cjs/src/embed/ts-embed.spec.js +171 -138
- package/cjs/src/embed/ts-embed.spec.js.map +1 -1
- package/dist/{index-CcBYlGo9.js → index-BrJMbt8r.js} +1 -1
- package/dist/src/embed/ts-embed.d.ts +34 -12
- package/dist/src/embed/ts-embed.d.ts.map +1 -1
- package/dist/src/embed/ts-embed.spec.d.ts.map +1 -1
- package/dist/tsembed-react.es.js +108 -152
- package/dist/tsembed-react.js +107 -151
- package/dist/tsembed.es.js +109 -153
- package/dist/tsembed.js +108 -152
- package/dist/visual-embed-sdk-react-full.d.ts +34 -12
- package/dist/visual-embed-sdk-react.d.ts +34 -12
- package/dist/visual-embed-sdk.d.ts +34 -12
- package/lib/package.json +2 -2
- package/lib/src/embed/app.js +1 -1
- package/lib/src/embed/app.js.map +1 -1
- package/lib/src/embed/auto-frame-renderer.js +1 -1
- package/lib/src/embed/auto-frame-renderer.js.map +1 -1
- package/lib/src/embed/bodyless-conversation.js +1 -1
- package/lib/src/embed/bodyless-conversation.js.map +1 -1
- package/lib/src/embed/conversation.js +1 -1
- package/lib/src/embed/conversation.js.map +1 -1
- package/lib/src/embed/liveboard.js +1 -1
- package/lib/src/embed/liveboard.js.map +1 -1
- package/lib/src/embed/search-bar.js +1 -1
- package/lib/src/embed/search-bar.js.map +1 -1
- package/lib/src/embed/search.js +1 -1
- package/lib/src/embed/search.js.map +1 -1
- package/lib/src/embed/search.spec.js +0 -20
- package/lib/src/embed/search.spec.js.map +1 -1
- package/lib/src/embed/ts-embed.d.ts +34 -12
- package/lib/src/embed/ts-embed.d.ts.map +1 -1
- package/lib/src/embed/ts-embed.js +99 -143
- package/lib/src/embed/ts-embed.js.map +1 -1
- package/lib/src/embed/ts-embed.spec.d.ts.map +1 -1
- package/lib/src/embed/ts-embed.spec.js +172 -139
- package/lib/src/embed/ts-embed.spec.js.map +1 -1
- package/lib/src/visual-embed-sdk.d.ts +34 -12
- package/package.json +2 -2
- package/src/embed/app.ts +1 -1
- package/src/embed/auto-frame-renderer.ts +1 -1
- package/src/embed/bodyless-conversation.ts +1 -1
- package/src/embed/conversation.ts +1 -1
- package/src/embed/liveboard.ts +1 -1
- package/src/embed/search-bar.tsx +1 -1
- package/src/embed/search.spec.ts +0 -23
- package/src/embed/search.ts +1 -1
- package/src/embed/ts-embed.spec.ts +213 -179
- package/src/embed/ts-embed.ts +96 -149
|
@@ -43,6 +43,9 @@ const TS_EMBED_ID = '_thoughtspot-embed';
|
|
|
43
43
|
*/
|
|
44
44
|
const PRERENDER_CONTAINER_ORIGINAL_POSITION_KEY = 'tsEmbedOriginalPosition';
|
|
45
45
|
const PRERENDER_WRAPPER_ID_PREFIX = 'tsEmbed-pre-render-wrapper-';
|
|
46
|
+
const PRERENDER_PARKED_TRANSFORM = 'translateY(-100%)';
|
|
47
|
+
/** The height createPreRenderWrapper() seeds before anything is measured. */
|
|
48
|
+
const UNMEASURED_WRAPPER_HEIGHT = '100vh';
|
|
46
49
|
// The container applies UpdateEmbedParams through React state, so a delivered
|
|
47
50
|
// post is not the same as the params being in effect.
|
|
48
51
|
const UPDATE_EMBED_PARAMS_SETTLE_MS = 200;
|
|
@@ -50,56 +53,6 @@ const UPDATE_EMBED_PARAMS_SETTLE_MS = 200;
|
|
|
50
53
|
// truthy, so null or '' leaves the previous embed's values in place. '&' is
|
|
51
54
|
// truthy and parses to {}.
|
|
52
55
|
const NO_RUNTIME_PARAMS = '&';
|
|
53
|
-
/**
|
|
54
|
-
* Query parameters that stay on the iframe `src` while config is excluded from
|
|
55
|
-
* the URL, which is the default unless the embed sets the
|
|
56
|
-
* `excludeConfigFromURL` additional flag to `false`. These are the parameters the
|
|
57
|
-
* application shell needs before it can receive a postMessage at all: the
|
|
58
|
-
* embed marker, the host application URL used to validate the message origin,
|
|
59
|
-
* the SDK version, the flags that pick the authentication flow, and the
|
|
60
|
-
* boot-time settings that would otherwise be applied a frame late (viewport,
|
|
61
|
-
* log level, locale, formatting and org). Everything else is delivered over
|
|
62
|
-
* `HostEvent.UpdateEmbedParams`.
|
|
63
|
-
* @internal
|
|
64
|
-
*/
|
|
65
|
-
const BOOTSTRAP_URL_PARAMS = new Set([
|
|
66
|
-
types_1.Param.EmbedApp,
|
|
67
|
-
types_1.Param.HostAppUrl,
|
|
68
|
-
types_1.Param.Version,
|
|
69
|
-
types_1.Param.AuthType,
|
|
70
|
-
types_1.Param.AutoLogin,
|
|
71
|
-
types_1.Param.DisableLoginRedirect,
|
|
72
|
-
types_1.Param.ForceSAMLAutoRedirect,
|
|
73
|
-
types_1.Param.cookieless,
|
|
74
|
-
types_1.Param.preAuthCache,
|
|
75
|
-
types_1.Param.blockNonEmbedFullAppAccess,
|
|
76
|
-
types_1.Param.OverrideOrgId,
|
|
77
|
-
types_1.Param.ViewPortHeight,
|
|
78
|
-
types_1.Param.ViewPortWidth,
|
|
79
|
-
types_1.Param.ClientLogLevel,
|
|
80
|
-
types_1.Param.OverrideNativeConsole,
|
|
81
|
-
types_1.Param.PendoTrackingKey,
|
|
82
|
-
types_1.Param.NumberFormatLocale,
|
|
83
|
-
types_1.Param.DateFormatLocale,
|
|
84
|
-
types_1.Param.CurrencyFormat,
|
|
85
|
-
types_1.Param.Locale,
|
|
86
|
-
types_1.Param.searchEmbed,
|
|
87
|
-
types_1.Param.livedBoardEmbed,
|
|
88
|
-
types_1.Param.isSpotterAgentEmbed,
|
|
89
|
-
types_1.Param.SpotterEnabled,
|
|
90
|
-
types_1.Param.IsFullAppEmbed,
|
|
91
|
-
types_1.Param.IsOnBeforeGetVizDataInterceptEnabled,
|
|
92
|
-
types_1.Param.LinkOverride,
|
|
93
|
-
types_1.Param.EnableLinkOverridesV2,
|
|
94
|
-
types_1.Param.DisableRedirectionLinksInNewTab,
|
|
95
|
-
types_1.Param.OverrideHistoryState,
|
|
96
|
-
types_1.Param.ForceTable,
|
|
97
|
-
types_1.Param.StringIDsUrl,
|
|
98
|
-
types_1.Param.DataSources,
|
|
99
|
-
types_1.Param.ExposeTranslationIDs,
|
|
100
|
-
types_1.Param.IconSpriteUrl,
|
|
101
|
-
types_1.Param.Tag,
|
|
102
|
-
]);
|
|
103
56
|
/**
|
|
104
57
|
* The event id map from v2 event names to v1 event id
|
|
105
58
|
* v1 events are the classic embed events implemented in Blink v1
|
|
@@ -137,7 +90,6 @@ class TsEmbed {
|
|
|
137
90
|
this.shouldEncodeUrlQueryParams = false;
|
|
138
91
|
this.defaultHiddenActions = [types_1.Action.ReportError];
|
|
139
92
|
this.preRenderContainerEl = document.body;
|
|
140
|
-
this.containerScrollListener = null;
|
|
141
93
|
/**
|
|
142
94
|
* Handler for fullscreen change events
|
|
143
95
|
*/
|
|
@@ -302,9 +254,6 @@ class TsEmbed {
|
|
|
302
254
|
}
|
|
303
255
|
else if (source === types_1.EmbedEvent.EmbedListenerReady) {
|
|
304
256
|
processEmbedContainerReady();
|
|
305
|
-
if (this.isConfigExcludedFromUrl()) {
|
|
306
|
-
this.triggerUpdateEmbedParams();
|
|
307
|
-
}
|
|
308
257
|
}
|
|
309
258
|
};
|
|
310
259
|
// Subclasses that navigate the pre-render on show must await this before
|
|
@@ -809,20 +758,13 @@ class TsEmbed {
|
|
|
809
758
|
return path;
|
|
810
759
|
}
|
|
811
760
|
getEmbedParams() {
|
|
812
|
-
const queryParams = this.
|
|
761
|
+
const queryParams = this.getEmbedParamsObject();
|
|
813
762
|
return (0, utils_1.getQueryParamString)(queryParams);
|
|
814
763
|
}
|
|
815
764
|
getEmbedParamsObject() {
|
|
816
765
|
const params = this.getBaseQueryParams();
|
|
817
766
|
return params;
|
|
818
767
|
}
|
|
819
|
-
getUrlQueryParamsObject() {
|
|
820
|
-
const queryParams = this.getEmbedParamsObject();
|
|
821
|
-
if (!this.isConfigExcludedFromUrl()) {
|
|
822
|
-
return queryParams;
|
|
823
|
-
}
|
|
824
|
-
return Object.fromEntries(Object.entries(queryParams).filter(([key]) => BOOTSTRAP_URL_PARAMS.has(key)));
|
|
825
|
-
}
|
|
826
768
|
getRootIframeSrc() {
|
|
827
769
|
const query = this.getEmbedParams();
|
|
828
770
|
return this.getEmbedBasePath(query);
|
|
@@ -995,7 +937,7 @@ class TsEmbed {
|
|
|
995
937
|
top: '0',
|
|
996
938
|
left: '0',
|
|
997
939
|
width: '100vw',
|
|
998
|
-
height:
|
|
940
|
+
height: UNMEASURED_WRAPPER_HEIGHT,
|
|
999
941
|
};
|
|
1000
942
|
(0, utils_1.setStyleProperties)(preRenderWrapper, initialPreRenderWrapperStyle);
|
|
1001
943
|
return preRenderWrapper;
|
|
@@ -1063,10 +1005,26 @@ class TsEmbed {
|
|
|
1063
1005
|
return placeholder;
|
|
1064
1006
|
}
|
|
1065
1007
|
/**
|
|
1066
|
-
* Resolves the configured preRenderContainer to a live element
|
|
1067
|
-
*
|
|
1068
|
-
*
|
|
1069
|
-
*
|
|
1008
|
+
* Resolves the configured preRenderContainer to a live element. A string
|
|
1009
|
+
* selector is re-queried on every call so a remounted container (E.g.: React
|
|
1010
|
+
* replacing the node) resolves to the fresh element; an element passed
|
|
1011
|
+
* directly cannot be re-resolved.
|
|
1012
|
+
*
|
|
1013
|
+
* With nothing configured the frame goes into the host element's nearest
|
|
1014
|
+
* scrolling ancestor, falling back to `document.body`.
|
|
1015
|
+
*
|
|
1016
|
+
* The wrapper is absolutely positioned, so it follows the page for free —
|
|
1017
|
+
* but only while it sits inside whatever scrolls. `document.body` is right
|
|
1018
|
+
* only when the document itself is the scroller; an app that scrolls an
|
|
1019
|
+
* inner element instead left the frame pinned to the viewport while the page
|
|
1020
|
+
* moved under it (SCAL-338563). Being inside the scroller also lets wheel
|
|
1021
|
+
* events chain out of the frame into it, which they cannot do from
|
|
1022
|
+
* `document.body`.
|
|
1023
|
+
*
|
|
1024
|
+
* A scrolling ancestor is layout chrome rather than route content, so it
|
|
1025
|
+
* outlives the embed in practice; and if it does go, the host element goes
|
|
1026
|
+
* with it and this instance is remounting anyway.
|
|
1027
|
+
* `reconcilePreRenderContainer` re-runs this on a detached container.
|
|
1070
1028
|
*/
|
|
1071
1029
|
resolvePreRenderContainerTarget() {
|
|
1072
1030
|
var _a;
|
|
@@ -1086,7 +1044,13 @@ class TsEmbed {
|
|
|
1086
1044
|
else if (containerConfig) {
|
|
1087
1045
|
container = containerConfig;
|
|
1088
1046
|
}
|
|
1089
|
-
|
|
1047
|
+
if (container) {
|
|
1048
|
+
return container;
|
|
1049
|
+
}
|
|
1050
|
+
if (!this.hostElement) {
|
|
1051
|
+
return document.body;
|
|
1052
|
+
}
|
|
1053
|
+
return (_a = (0, utils_1.getScrollableAncestors)(this.hostElement)[0]) !== null && _a !== void 0 ? _a : document.body;
|
|
1090
1054
|
}
|
|
1091
1055
|
inheritPreRenderContainer() {
|
|
1092
1056
|
var _a;
|
|
@@ -1131,8 +1095,9 @@ class TsEmbed {
|
|
|
1131
1095
|
* Re-attaches the wrapper to a live container when the previously resolved
|
|
1132
1096
|
* one has been detached or no longer holds the wrapper — e.g. the host app
|
|
1133
1097
|
* remounted a custom preRenderContainer, which would otherwise leave a stale
|
|
1134
|
-
* reference and collapse the wrapper.
|
|
1135
|
-
* re-resolved; a container passed as an element
|
|
1098
|
+
* reference and collapse the wrapper. Selectors and the auto-resolved
|
|
1099
|
+
* scrolling ancestor are both re-resolved; a container passed as an element
|
|
1100
|
+
* is left untouched, as there is nothing to re-query.
|
|
1136
1101
|
*/
|
|
1137
1102
|
reconcilePreRenderContainer() {
|
|
1138
1103
|
const wrapper = this.preRenderWrapper;
|
|
@@ -1151,14 +1116,6 @@ class TsEmbed {
|
|
|
1151
1116
|
if (resolved === stored && stored.contains(wrapper)) {
|
|
1152
1117
|
return;
|
|
1153
1118
|
}
|
|
1154
|
-
if (this.containerScrollListener && stored !== resolved) {
|
|
1155
|
-
if (stored !== document.body) {
|
|
1156
|
-
stored.removeEventListener('scroll', this.containerScrollListener);
|
|
1157
|
-
}
|
|
1158
|
-
if (resolved !== document.body) {
|
|
1159
|
-
resolved.addEventListener('scroll', this.containerScrollListener);
|
|
1160
|
-
}
|
|
1161
|
-
}
|
|
1162
1119
|
this.preRenderContainerEl = resolved;
|
|
1163
1120
|
this.applyPreRenderContainerPositioning();
|
|
1164
1121
|
if (wrapper.parentNode !== resolved) {
|
|
@@ -1220,11 +1177,12 @@ class TsEmbed {
|
|
|
1220
1177
|
*/
|
|
1221
1178
|
setIFrameHeight(height) {
|
|
1222
1179
|
if (this.isPreRendered) {
|
|
1180
|
+
const next = (0, utils_1.getCssDimension)(height);
|
|
1223
1181
|
if (this.insertedDomEl) {
|
|
1224
|
-
this.insertedDomEl.style.height =
|
|
1182
|
+
this.insertedDomEl.style.height = next;
|
|
1225
1183
|
}
|
|
1226
1184
|
else if (this.preRenderWrapper) {
|
|
1227
|
-
this.preRenderWrapper.style.height =
|
|
1185
|
+
this.preRenderWrapper.style.height = next;
|
|
1228
1186
|
}
|
|
1229
1187
|
}
|
|
1230
1188
|
else {
|
|
@@ -1659,34 +1617,47 @@ class TsEmbed {
|
|
|
1659
1617
|
delete container.dataset[PRERENDER_CONTAINER_ORIGINAL_POSITION_KEY];
|
|
1660
1618
|
}
|
|
1661
1619
|
/**
|
|
1662
|
-
*
|
|
1620
|
+
* Re-sizes the wrapper when its placeholder changes size.
|
|
1621
|
+
*
|
|
1622
|
+
* Position deliberately has no equivalent. An absolutely positioned wrapper
|
|
1623
|
+
* follows its containing block for free, so a correctly placed frame is the
|
|
1624
|
+
* browser's job and costs nothing; repositioning it on scroll would mean a
|
|
1625
|
+
* layout read and a style write per frame to compensate for placing it in
|
|
1626
|
+
* the wrong box. Size is the one thing the browser will not do for us: the
|
|
1627
|
+
* placeholder grows when the embedded app reports a new height, and the
|
|
1628
|
+
* wrapper has to be told.
|
|
1663
1629
|
*/
|
|
1664
|
-
|
|
1665
|
-
|
|
1630
|
+
observePreRenderSize() {
|
|
1631
|
+
var _a;
|
|
1632
|
+
if (this.getPreRenderConfig().doNotTrackSize || typeof ResizeObserver === 'undefined') {
|
|
1633
|
+
return;
|
|
1634
|
+
}
|
|
1635
|
+
const placeholder = this.getPreRenderPlaceHolderElement();
|
|
1636
|
+
if (!placeholder) {
|
|
1666
1637
|
return;
|
|
1667
1638
|
}
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
this.
|
|
1639
|
+
(_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
1640
|
+
this.resizeObserver = new ResizeObserver(() => this.syncPreRenderStyle());
|
|
1641
|
+
this.resizeObserver.observe(placeholder);
|
|
1671
1642
|
}
|
|
1672
1643
|
/**
|
|
1673
1644
|
* Destroys the ThoughtSpot embed, and remove any nodes from the DOM.
|
|
1674
1645
|
* @version SDK: 1.19.1 | ThoughtSpot: *
|
|
1675
1646
|
*/
|
|
1676
1647
|
destroy() {
|
|
1677
|
-
var _a, _b, _c;
|
|
1648
|
+
var _a, _b, _c, _d;
|
|
1678
1649
|
try {
|
|
1679
1650
|
this.removeFullscreenChangeHandler();
|
|
1680
|
-
this.
|
|
1651
|
+
(_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
1681
1652
|
this.unsubscribeToEvents();
|
|
1682
|
-
(
|
|
1653
|
+
(_b = this.preRenderWrapper) === null || _b === void 0 ? void 0 : _b.remove();
|
|
1683
1654
|
this.restorePreRenderContainerPosition();
|
|
1684
1655
|
if (!this.isRendered) {
|
|
1685
1656
|
return;
|
|
1686
1657
|
}
|
|
1687
1658
|
if (!(0, embedConfig_1.getEmbedConfig)().waitForCleanupOnDestroy) {
|
|
1688
1659
|
this.trigger(types_1.HostEvent.DestroyEmbed);
|
|
1689
|
-
(
|
|
1660
|
+
(_d = (_c = this.insertedDomEl) === null || _c === void 0 ? void 0 : _c.parentNode) === null || _d === void 0 ? void 0 : _d.removeChild(this.insertedDomEl);
|
|
1690
1661
|
}
|
|
1691
1662
|
else {
|
|
1692
1663
|
const cleanupTimeout = (0, embedConfig_1.getEmbedConfig)().cleanupTimeout;
|
|
@@ -1732,27 +1703,6 @@ class TsEmbed {
|
|
|
1732
1703
|
this.isRendered = true;
|
|
1733
1704
|
return this.renderIFrame(prerenderFrameSrc);
|
|
1734
1705
|
}
|
|
1735
|
-
isConfigExcludedFromUrl() {
|
|
1736
|
-
var _a, _b, _c;
|
|
1737
|
-
const flag = (_b = (_a = this.viewConfig.additionalFlags) === null || _a === void 0 ? void 0 : _a.excludeConfigFromURL) !== null && _b !== void 0 ? _b : (_c = this.embedConfig.additionalFlags) === null || _c === void 0 ? void 0 : _c.excludeConfigFromURL;
|
|
1738
|
-
// Enabled by default; only an explicit false opts out.
|
|
1739
|
-
return flag !== false && flag !== 'false';
|
|
1740
|
-
}
|
|
1741
|
-
async triggerUpdateEmbedParams() {
|
|
1742
|
-
try {
|
|
1743
|
-
const params = await this.getUpdateEmbedParamsObject();
|
|
1744
|
-
this.trigger(types_1.HostEvent.UpdateEmbedParams, params);
|
|
1745
|
-
}
|
|
1746
|
-
catch (error) {
|
|
1747
|
-
logger_1.logger.error(errors_1.ERROR_MESSAGE.UPDATE_PARAMS_FAILED, error);
|
|
1748
|
-
this.handleError({
|
|
1749
|
-
errorType: types_1.ErrorDetailsTypes.API,
|
|
1750
|
-
message: (error === null || error === void 0 ? void 0 : error.message) || errors_1.ERROR_MESSAGE.UPDATE_PARAMS_FAILED,
|
|
1751
|
-
code: types_1.EmbedErrorCodes.UPDATE_PARAMS_FAILED,
|
|
1752
|
-
error: (error === null || error === void 0 ? void 0 : error.message) || error,
|
|
1753
|
-
});
|
|
1754
|
-
}
|
|
1755
|
-
}
|
|
1756
1706
|
beforePrerenderVisible() {
|
|
1757
1707
|
// We can ignore this as its a bit expensive and the newer customers
|
|
1758
1708
|
// have moved on to UpdateEmbedParams supported clusters
|
|
@@ -1763,7 +1713,17 @@ class TsEmbed {
|
|
|
1763
1713
|
this.preRenderParamsApplied = new Promise((resolve) => {
|
|
1764
1714
|
this.executeAfterEmbedContainerLoaded(async () => {
|
|
1765
1715
|
try {
|
|
1766
|
-
await this.
|
|
1716
|
+
const params = await this.getUpdateEmbedParamsObject();
|
|
1717
|
+
this.trigger(types_1.HostEvent.UpdateEmbedParams, params);
|
|
1718
|
+
}
|
|
1719
|
+
catch (error) {
|
|
1720
|
+
logger_1.logger.error(errors_1.ERROR_MESSAGE.UPDATE_PARAMS_FAILED, error);
|
|
1721
|
+
this.handleError({
|
|
1722
|
+
errorType: types_1.ErrorDetailsTypes.API,
|
|
1723
|
+
message: (error === null || error === void 0 ? void 0 : error.message) || errors_1.ERROR_MESSAGE.UPDATE_PARAMS_FAILED,
|
|
1724
|
+
code: types_1.EmbedErrorCodes.UPDATE_PARAMS_FAILED,
|
|
1725
|
+
error: (error === null || error === void 0 ? void 0 : error.message) || error,
|
|
1726
|
+
});
|
|
1767
1727
|
}
|
|
1768
1728
|
finally {
|
|
1769
1729
|
setTimeout(resolve, UPDATE_EMBED_PARAMS_SETTLE_MS);
|
|
@@ -1778,7 +1738,7 @@ class TsEmbed {
|
|
|
1778
1738
|
* wrapper to overlay it.
|
|
1779
1739
|
*/
|
|
1780
1740
|
async showPreRender() {
|
|
1781
|
-
var _a
|
|
1741
|
+
var _a;
|
|
1782
1742
|
(0, mixpanel_service_1.uploadMixpanelEvent)(mixpanel_service_1.MIXPANEL_EVENT.VISUAL_SDK_SHOW_PRE_RENDER, {
|
|
1783
1743
|
preRenderId: this.getPreRenderConfig().id,
|
|
1784
1744
|
embedComponentType: this.viewConfig.embedComponentType,
|
|
@@ -1797,14 +1757,16 @@ class TsEmbed {
|
|
|
1797
1757
|
this.beforePrerenderVisible();
|
|
1798
1758
|
if (this.hostElement) {
|
|
1799
1759
|
this.insertedDomEl = this.createPreRenderPlaceholder();
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1760
|
+
// Carry a height fullHeight has already measured onto the fresh
|
|
1761
|
+
// placeholder, so a re-show does not flash at frameParams height.
|
|
1762
|
+
// UNMEASURED_WRAPPER_HEIGHT is what createPreRenderWrapper() seeds
|
|
1763
|
+
// before anything has been measured; treating that as a measurement
|
|
1764
|
+
// is what made a first reveal overshoot to a full viewport.
|
|
1765
|
+
const wrapperHeight = this.preRenderWrapper.style.height;
|
|
1766
|
+
if (this.viewConfig.fullHeight
|
|
1767
|
+
&& wrapperHeight
|
|
1768
|
+
&& wrapperHeight !== UNMEASURED_WRAPPER_HEIGHT) {
|
|
1769
|
+
this.insertedDomEl.style.height = wrapperHeight;
|
|
1808
1770
|
}
|
|
1809
1771
|
const placeHolderId = this.getPreRenderIds().placeHolder;
|
|
1810
1772
|
// Remove any stale placeholder from a previous cycle. It is located
|
|
@@ -1818,29 +1780,19 @@ class TsEmbed {
|
|
|
1818
1780
|
(_a = this.hostElement.querySelector(`#${placeHolderId}`)) === null || _a === void 0 ? void 0 : _a.remove();
|
|
1819
1781
|
this.hostElement.appendChild(this.insertedDomEl);
|
|
1820
1782
|
this.syncPreRenderStyle();
|
|
1821
|
-
|
|
1822
|
-
if (customContainer && !this.containerScrollListener) {
|
|
1823
|
-
this.containerScrollListener = () => this.syncPreRenderStyle();
|
|
1824
|
-
customContainer.addEventListener('scroll', this.containerScrollListener);
|
|
1825
|
-
}
|
|
1826
|
-
if (!this.getPreRenderConfig().doNotTrackSize) {
|
|
1827
|
-
const observeTarget = (_b = this.insertedDomEl) !== null && _b !== void 0 ? _b : this.hostElement;
|
|
1828
|
-
this.resizeObserver = new ResizeObserver((entries) => {
|
|
1829
|
-
entries.forEach((entry) => {
|
|
1830
|
-
if (entry.target === observeTarget) {
|
|
1831
|
-
this.syncPreRenderStyle();
|
|
1832
|
-
}
|
|
1833
|
-
});
|
|
1834
|
-
});
|
|
1835
|
-
this.resizeObserver.observe(observeTarget);
|
|
1836
|
-
}
|
|
1783
|
+
this.observePreRenderSize();
|
|
1837
1784
|
}
|
|
1838
1785
|
(0, utils_1.removeStyleProperties)(this.preRenderWrapper, [
|
|
1839
1786
|
'z-index',
|
|
1840
1787
|
'opacity',
|
|
1841
|
-
'pointer-events',
|
|
1842
1788
|
'overflow',
|
|
1789
|
+
'transform',
|
|
1843
1790
|
]);
|
|
1791
|
+
// Set rather than removed: a container that carries `pointer-events:
|
|
1792
|
+
// none` — the usual styling for a parking root that must not swallow
|
|
1793
|
+
// clicks — passes it down, and dropping the property here would leave
|
|
1794
|
+
// the inherited `none` in force and the frame dead to input.
|
|
1795
|
+
(0, utils_1.setStyleProperties)(this.preRenderWrapper, { pointerEvents: 'auto' });
|
|
1844
1796
|
this.subscribeToEvents();
|
|
1845
1797
|
// Setup fullscreen change handler for prerendered components
|
|
1846
1798
|
if (this.iFrame) {
|
|
@@ -1893,6 +1845,7 @@ class TsEmbed {
|
|
|
1893
1845
|
* If the component is not preRendered, it issues a warning.
|
|
1894
1846
|
*/
|
|
1895
1847
|
hidePreRender() {
|
|
1848
|
+
var _a;
|
|
1896
1849
|
(0, mixpanel_service_1.uploadMixpanelEvent)(mixpanel_service_1.MIXPANEL_EVENT.VISUAL_SDK_HIDE_PRE_RENDER, {
|
|
1897
1850
|
preRenderId: this.getPreRenderConfig().id,
|
|
1898
1851
|
embedComponentType: this.viewConfig.embedComponentType,
|
|
@@ -1912,12 +1865,15 @@ class TsEmbed {
|
|
|
1912
1865
|
top: '0',
|
|
1913
1866
|
left: '0',
|
|
1914
1867
|
overflow: 'hidden',
|
|
1868
|
+
// Keeps the measured size — so the next show needs no resize, which
|
|
1869
|
+
// is the point of pre-rendering — while lifting the box out of
|
|
1870
|
+
// the container's scrollable area. Overflow only extends
|
|
1871
|
+
// downwards, so a hidden frame parked above the top edge adds
|
|
1872
|
+
// none, where one left at full height shows as blank scroll space.
|
|
1873
|
+
transform: PRERENDER_PARKED_TRANSFORM,
|
|
1915
1874
|
};
|
|
1916
1875
|
(0, utils_1.setStyleProperties)(this.preRenderWrapper, preRenderHideStyles);
|
|
1917
|
-
this.
|
|
1918
|
-
if (this.resizeObserver) {
|
|
1919
|
-
this.resizeObserver.disconnect();
|
|
1920
|
-
}
|
|
1876
|
+
(_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
1921
1877
|
const placeHolderEle = this.getPreRenderPlaceHolderElement();
|
|
1922
1878
|
if (placeHolderEle) {
|
|
1923
1879
|
placeHolderEle.parentElement.removeChild(placeHolderEle);
|