pb-sxp-ui 1.19.16 → 1.19.18
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/dist/index.cjs +59 -121
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +3 -11
- package/dist/index.js +59 -121
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +4 -4
- package/dist/index.min.cjs.map +1 -1
- package/dist/index.min.js +4 -4
- package/dist/index.min.js.map +1 -1
- package/dist/pb-ui.js +59 -121
- package/dist/pb-ui.js.map +1 -1
- package/dist/pb-ui.min.js +4 -4
- package/dist/pb-ui.min.js.map +1 -1
- package/es/core/components/SxpPageRender/index.js +7 -31
- package/es/core/hooks/useVisibleHeight.js +26 -88
- package/lib/core/components/SxpPageRender/index.js +7 -31
- package/lib/core/hooks/useVisibleHeight.js +26 -88
- package/package.json +1 -2
package/dist/pb-ui.js
CHANGED
|
@@ -18994,98 +18994,64 @@ Made in Italy` })));
|
|
|
18994
18994
|
var NavBack$1 = React.memo(NavBack);
|
|
18995
18995
|
|
|
18996
18996
|
const useVisibleHeight = () => {
|
|
18997
|
-
var _a, _b;
|
|
18998
18997
|
const [visibleHeight, setVisibleHeight] = React.useState(0);
|
|
18999
|
-
const
|
|
19000
|
-
|
|
19001
|
-
|
|
19002
|
-
|
|
19003
|
-
|
|
19004
|
-
|
|
19005
|
-
|
|
19006
|
-
|
|
19007
|
-
|
|
19008
|
-
|
|
19009
|
-
|
|
19010
|
-
|
|
19011
|
-
|
|
19012
|
-
|
|
19013
|
-
|
|
19014
|
-
|
|
19015
|
-
|
|
19016
|
-
|
|
19017
|
-
|
|
19018
|
-
|
|
19019
|
-
|
|
19020
|
-
document.body.appendChild(detector);
|
|
19021
|
-
const dvhInPx = detector.clientHeight;
|
|
19022
|
-
document.body.removeChild(detector);
|
|
19023
|
-
return dvhInPx;
|
|
19024
|
-
};
|
|
19025
|
-
const getFillAvailableInPx = () => {
|
|
19026
|
-
const detector = document.createElement('div');
|
|
19027
|
-
detector.style.position = 'fixed';
|
|
19028
|
-
detector.style.bottom = `${getHeightWithSafeArea()}px`;
|
|
19029
|
-
detector.style.left = '0';
|
|
19030
|
-
detector.style.height = '-webkit-fill-available';
|
|
19031
|
-
detector.style.visibility = 'hidden';
|
|
19032
|
-
detector.style.zIndex = '-1';
|
|
19033
|
-
document.body.appendChild(detector);
|
|
19034
|
-
const dvhInPx = detector.clientHeight;
|
|
19035
|
-
document.body.removeChild(detector);
|
|
19036
|
-
return dvhInPx;
|
|
19037
|
-
};
|
|
19038
|
-
const getHeightWithSafeArea = () => {
|
|
19039
|
-
const root = document.documentElement;
|
|
19040
|
-
const value = getComputedStyle(root).getPropertyValue('--safe-area-inset-bottom');
|
|
19041
|
-
// 处理可能的值(可能是 '0px', '34px' 等)
|
|
19042
|
-
const numericValue = parseInt(value) || 0;
|
|
19043
|
-
return numericValue;
|
|
19044
|
-
};
|
|
19045
|
-
const dvhToPx = (dvh) => {
|
|
19046
|
-
return Math.round((dvh / 100) * document.documentElement.clientHeight);
|
|
19047
|
-
};
|
|
19048
|
-
const systemInfo = {
|
|
19049
|
-
visualViewport: (_a = window.visualViewport) === null || _a === void 0 ? void 0 : _a.height,
|
|
19050
|
-
innerHeight: window.innerHeight,
|
|
19051
|
-
clientHeight: document.documentElement.clientHeight,
|
|
19052
|
-
screenHeight: window.screen.height,
|
|
19053
|
-
bodyHeight: (_b = document === null || document === void 0 ? void 0 : document.body) === null || _b === void 0 ? void 0 : _b.clientHeight,
|
|
19054
|
-
agent: navigator.userAgent,
|
|
19055
|
-
version: '1.19.16',
|
|
19056
|
-
safeArea: getHeightWithSafeArea(),
|
|
19057
|
-
dvh: dvhToPx(100),
|
|
19058
|
-
dvhInPx: getDvhInPx(),
|
|
19059
|
-
vhInPx: getVhInPx(),
|
|
19060
|
-
fillAvailableInPx: getFillAvailableInPx()
|
|
18998
|
+
const getVisibleContentHeight = () => {
|
|
18999
|
+
// 方法优先级:
|
|
19000
|
+
// 1. visualViewport.height (最准确)
|
|
19001
|
+
// 2. window.innerHeight (次之)
|
|
19002
|
+
// 3. document.documentElement.clientHeight (fallback)
|
|
19003
|
+
if (typeof window === 'undefined')
|
|
19004
|
+
return 0;
|
|
19005
|
+
let height = window.innerHeight;
|
|
19006
|
+
// 优先使用 visualViewport
|
|
19007
|
+
if (window.visualViewport) {
|
|
19008
|
+
height = window.visualViewport.height;
|
|
19009
|
+
}
|
|
19010
|
+
// 验证高度合理性
|
|
19011
|
+
if (height <= 0 || height > window.screen.height) {
|
|
19012
|
+
height = window.innerHeight;
|
|
19013
|
+
}
|
|
19014
|
+
// 最终 fallback
|
|
19015
|
+
if (height <= 0) {
|
|
19016
|
+
height = document.documentElement.clientHeight;
|
|
19017
|
+
}
|
|
19018
|
+
return height;
|
|
19061
19019
|
};
|
|
19062
|
-
console.log(systemInfo, 'fundebug-init--------------------->systemInfo');
|
|
19063
|
-
if ('fundebug' in window) {
|
|
19064
|
-
window === null || window === void 0 ? void 0 : window.fundebug.notify('Collect_Info', 'init', { metaData: { systemInfo, otherInfo: {} } });
|
|
19065
|
-
}
|
|
19066
19020
|
const updateHeight = React.useCallback(() => {
|
|
19067
|
-
var _a
|
|
19068
|
-
const
|
|
19069
|
-
|
|
19070
|
-
|
|
19071
|
-
|
|
19072
|
-
|
|
19073
|
-
|
|
19074
|
-
|
|
19075
|
-
|
|
19076
|
-
|
|
19077
|
-
|
|
19078
|
-
|
|
19079
|
-
|
|
19080
|
-
|
|
19081
|
-
|
|
19082
|
-
|
|
19021
|
+
var _a;
|
|
19022
|
+
const visibleHeight = getVisibleContentHeight();
|
|
19023
|
+
const screenHeight = (_a = window.screen) === null || _a === void 0 ? void 0 : _a.height;
|
|
19024
|
+
const ua = navigator.userAgent;
|
|
19025
|
+
// Instagram 检测
|
|
19026
|
+
const isInstagram = /Instagram/i.test(ua);
|
|
19027
|
+
// Facebook 检测
|
|
19028
|
+
const isFacebook = /FBAV|FBAN|FBSN/i.test(ua);
|
|
19029
|
+
// 安全检查
|
|
19030
|
+
if (!screenHeight || visibleHeight <= 0 || (!isInstagram && !isFacebook)) {
|
|
19031
|
+
setVisibleHeight(visibleHeight);
|
|
19032
|
+
return;
|
|
19033
|
+
}
|
|
19034
|
+
const ratio = visibleHeight / screenHeight;
|
|
19035
|
+
const threshold = 0.9;
|
|
19036
|
+
const h = screenHeight >= 900 ? screenHeight * 0.8 : screenHeight * 0.79;
|
|
19037
|
+
// 当内容高度占屏幕高度90%以上时,使用按比例计算的高度
|
|
19038
|
+
// 否则使用实际内容高度
|
|
19039
|
+
const finalHeight = Math.round(ratio >= threshold ? h : visibleHeight);
|
|
19083
19040
|
if ('fundebug' in window) {
|
|
19041
|
+
const systemInfo = {
|
|
19042
|
+
ratio,
|
|
19043
|
+
h,
|
|
19044
|
+
finalHeight,
|
|
19045
|
+
visibleHeight,
|
|
19046
|
+
screenHeight,
|
|
19047
|
+
isInstagram,
|
|
19048
|
+
isFacebook,
|
|
19049
|
+
ua
|
|
19050
|
+
};
|
|
19084
19051
|
window === null || window === void 0 ? void 0 : window.fundebug.notify('Collect_Info', 'resize', { metaData: { systemInfo, otherInfo: {} } });
|
|
19085
19052
|
}
|
|
19086
|
-
|
|
19087
|
-
|
|
19088
|
-
}, [getHeightWithSafeArea, dvhToPx, getDvhInPx, getVhInPx, getFillAvailableInPx]);
|
|
19053
|
+
setVisibleHeight(finalHeight);
|
|
19054
|
+
}, [getVisibleContentHeight]);
|
|
19089
19055
|
React.useEffect(() => {
|
|
19090
19056
|
// 初始计算
|
|
19091
19057
|
updateHeight();
|
|
@@ -19103,8 +19069,6 @@ Made in Italy` })));
|
|
|
19103
19069
|
if ('virtualKeyboard' in navigator) {
|
|
19104
19070
|
navigator.virtualKeyboard.addEventListener('geometrychange', updateHeight);
|
|
19105
19071
|
}
|
|
19106
|
-
// 定期检查(应对某些特殊情况)
|
|
19107
|
-
const interval = setInterval(updateHeight, 1000);
|
|
19108
19072
|
return () => {
|
|
19109
19073
|
events.forEach((event) => {
|
|
19110
19074
|
window.removeEventListener(event, updateHeight);
|
|
@@ -19116,7 +19080,6 @@ Made in Italy` })));
|
|
|
19116
19080
|
if ('virtualKeyboard' in navigator) {
|
|
19117
19081
|
navigator.virtualKeyboard.removeEventListener('geometrychange', updateHeight);
|
|
19118
19082
|
}
|
|
19119
|
-
clearInterval(interval);
|
|
19120
19083
|
};
|
|
19121
19084
|
}, [updateHeight]);
|
|
19122
19085
|
return visibleHeight;
|
|
@@ -19130,7 +19093,7 @@ Made in Italy` })));
|
|
|
19130
19093
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\index.tsx
|
|
19131
19094
|
*
|
|
19132
19095
|
*/
|
|
19133
|
-
const SxpPageRender = ({ globalConfig, descStyle, containerHeight
|
|
19096
|
+
const SxpPageRender = ({ globalConfig, descStyle, containerHeight, containerWidth = window.innerWidth, tempMap, resolver, data = [], ctaType, tipText, nudge, _schema, hashTagStyle, hashTagRightMargin, tagList = [], defaultData }) => {
|
|
19134
19097
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
|
|
19135
19098
|
const mutedIcon = useIconLink('/pb_static/5beaaa5ce7f3477b99db3838619cc471.png');
|
|
19136
19099
|
const unmutedIcon = useIconLink('/pb_static/fea8668a8a894e4aa3a86bcc775e895e.png');
|
|
@@ -19319,29 +19282,10 @@ Made in Italy` })));
|
|
|
19319
19282
|
}
|
|
19320
19283
|
return minusHeight;
|
|
19321
19284
|
}, [globalConfig]);
|
|
19322
|
-
const getHeightWithSafeArea = () => {
|
|
19323
|
-
const root = document.documentElement;
|
|
19324
|
-
const value = getComputedStyle(root).getPropertyValue('--safe-area-inset-bottom');
|
|
19325
|
-
// 处理可能的值(可能是 '0px', '34px' 等)
|
|
19326
|
-
const numericValue = parseInt(value) || 0;
|
|
19327
|
-
return numericValue;
|
|
19328
|
-
};
|
|
19329
|
-
const getDvhInPx = () => {
|
|
19330
|
-
const detector = document.createElement('div');
|
|
19331
|
-
detector.style.position = 'fixed';
|
|
19332
|
-
detector.style.bottom = `${getHeightWithSafeArea()}px`;
|
|
19333
|
-
detector.style.left = '0';
|
|
19334
|
-
detector.style.height = '100dvh';
|
|
19335
|
-
detector.style.visibility = 'hidden';
|
|
19336
|
-
detector.style.zIndex = '-1';
|
|
19337
|
-
document.body.appendChild(detector);
|
|
19338
|
-
const dvhInPx = detector.clientHeight;
|
|
19339
|
-
document.body.removeChild(detector);
|
|
19340
|
-
return dvhInPx;
|
|
19341
|
-
};
|
|
19342
19285
|
const height = React.useMemo(() => {
|
|
19343
|
-
|
|
19344
|
-
|
|
19286
|
+
const h = containerHeight || visibleHeight;
|
|
19287
|
+
return h - minusHeight - tagHeight;
|
|
19288
|
+
}, [containerHeight, visibleHeight, minusHeight, tagHeight]);
|
|
19345
19289
|
const visList = React.useMemo(() => {
|
|
19346
19290
|
var _a;
|
|
19347
19291
|
const list = activeIndex === 0 && !waterFallData && !isEditor && !isDiyH5
|
|
@@ -19482,9 +19426,6 @@ Made in Italy` })));
|
|
|
19482
19426
|
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconYPosit) === 'top') {
|
|
19483
19427
|
top += minusHeight;
|
|
19484
19428
|
}
|
|
19485
|
-
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconFixed) && (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconYPosit) !== 'top') {
|
|
19486
|
-
top += getHeightWithSafeArea();
|
|
19487
|
-
}
|
|
19488
19429
|
if (rec === null || rec === void 0 ? void 0 : rec.video) {
|
|
19489
19430
|
return (React.createElement(LikeButton$1, { key: rec.position, activeIcon: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIcon, unActicveIcon: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.unlikeIcon, active: rec.isCollected, recData: rec, className: 'clc-sxp-like-button', style: {
|
|
19490
19431
|
position: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconFixed) ? 'fixed' : 'absolute',
|
|
@@ -19719,9 +19660,6 @@ Made in Italy` })));
|
|
|
19719
19660
|
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconYPosit) === 'top') {
|
|
19720
19661
|
top += minusHeight;
|
|
19721
19662
|
}
|
|
19722
|
-
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed) && (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconYPosit) !== 'top') {
|
|
19723
|
-
top += getHeightWithSafeArea();
|
|
19724
|
-
}
|
|
19725
19663
|
return (((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowMute) === undefined || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowMute) === true) && (React.createElement(ToggleButton$1, { style: {
|
|
19726
19664
|
position: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed) ? 'fixed' : 'absolute',
|
|
19727
19665
|
visibility: ((_c = (_b = visList === null || visList === void 0 ? void 0 : visList[activeIndex]) === null || _b === void 0 ? void 0 : _b.video) === null || _c === void 0 ? void 0 : _c.url) ? 'visible' : 'hidden',
|
|
@@ -19762,7 +19700,7 @@ Made in Italy` })));
|
|
|
19762
19700
|
isReload,
|
|
19763
19701
|
renderToggleButton
|
|
19764
19702
|
]);
|
|
19765
|
-
return (React.createElement("div", { id: 'sxp-render', className: 'clc-sxp-container' },
|
|
19703
|
+
return (React.createElement("div", { id: 'sxp-render', className: 'clc-sxp-container', style: { height } },
|
|
19766
19704
|
(data === null || data === void 0 ? void 0 : data.length) < 1 && loading ? (React.createElement("div", { style: { height, width: containerWidth, display: 'flex', justifyContent: 'center', alignItems: 'center' } },
|
|
19767
19705
|
React.createElement("img", { width: 64, height: 64, src: loadingImage, alt: 'loading...', style: { objectFit: 'contain' } }))) : (React.createElement("div", { style: Object.assign({}, ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.textUnderlineOffset) && { textUnderlineOffset: `${globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.textUnderlineOffset}px` })) },
|
|
19768
19706
|
waterFallData && (React.createElement(Navbar$1, { icon: img, styles: { background: 'rgba(0,0,0,.3)', color: '#fff', top: `${minusHeight}px` }, textStyle: Object.assign(Object.assign({}, (_e = (_d = (_c = (_b = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.hashTag) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.item) === null || _c === void 0 ? void 0 : _c.props) === null || _d === void 0 ? void 0 : _d.textStyles) === null || _e === void 0 ? void 0 : _e.hashTagTitle), { color: '#fff' }), onClose: () => {
|
|
@@ -19824,10 +19762,10 @@ Made in Italy` })));
|
|
|
19824
19762
|
renderToggleButton(!!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed))),
|
|
19825
19763
|
React.createElement(WaterFall$1, Object.assign({}, (_u = (_t = (_s = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.hashTag) === null || _s === void 0 ? void 0 : _s[0]) === null || _t === void 0 ? void 0 : _t.item) === null || _u === void 0 ? void 0 : _u.props)),
|
|
19826
19764
|
React.createElement(ConsentPopup, { resolver: resolver, globalConfig: globalConfig }),
|
|
19827
|
-
openMultiPosts && (React.createElement(MultiPosts$2, Object.assign({}, (_x = (_w = (_v = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.multiPosts) === null || _v === void 0 ? void 0 : _v[0]) === null || _w === void 0 ? void 0 : _w.item) === null || _x === void 0 ? void 0 : _x.props, (_0 = (_z = (_y = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.multiPosts) === null || _y === void 0 ? void 0 : _y[0]) === null || _z === void 0 ? void 0 : _z.item) === null || _0 === void 0 ? void 0 : _0.event, { style: { position: 'fixed', top: 0, left: 0, right: 0
|
|
19765
|
+
openMultiPosts && (React.createElement(MultiPosts$2, Object.assign({}, (_x = (_w = (_v = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.multiPosts) === null || _v === void 0 ? void 0 : _v[0]) === null || _w === void 0 ? void 0 : _w.item) === null || _x === void 0 ? void 0 : _x.props, (_0 = (_z = (_y = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.multiPosts) === null || _y === void 0 ? void 0 : _y[0]) === null || _z === void 0 ? void 0 : _z.item) === null || _0 === void 0 ? void 0 : _0.event, { style: { position: 'fixed', top: 0, left: 0, right: 0 } }))))),
|
|
19828
19766
|
(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableCookieSetting) && (React.createElement("div", { style: {
|
|
19829
19767
|
position: 'fixed',
|
|
19830
|
-
bottom:
|
|
19768
|
+
bottom: 0,
|
|
19831
19769
|
left: 0,
|
|
19832
19770
|
right: 0,
|
|
19833
19771
|
width: '100%',
|