pb-sxp-ui 1.19.17 → 1.19.19
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 +131 -189
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +3 -11
- package/dist/index.js +131 -189
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +6 -6
- package/dist/index.min.cjs.map +1 -1
- package/dist/index.min.js +6 -6
- package/dist/index.min.js.map +1 -1
- package/dist/pb-ui.js +131 -189
- package/dist/pb-ui.js.map +1 -1
- package/dist/pb-ui.min.js +6 -6
- package/dist/pb-ui.min.js.map +1 -1
- package/es/core/components/SxpPageRender/Modal/index.js +14 -11
- package/es/core/components/SxpPageRender/VideoWidget/index.d.ts +1 -0
- package/es/core/components/SxpPageRender/VideoWidget/index.js +3 -3
- package/es/core/components/SxpPageRender/index.js +15 -32
- package/es/core/hooks/useVisibleHeight.d.ts +4 -1
- package/es/core/hooks/useVisibleHeight.js +37 -102
- package/lib/core/components/SxpPageRender/Modal/index.js +14 -11
- package/lib/core/components/SxpPageRender/VideoWidget/index.d.ts +1 -0
- package/lib/core/components/SxpPageRender/VideoWidget/index.js +3 -3
- package/lib/core/components/SxpPageRender/index.js +15 -32
- package/lib/core/hooks/useVisibleHeight.d.ts +4 -1
- package/lib/core/hooks/useVisibleHeight.js +37 -102
- package/package.json +1 -2
package/dist/index.cjs
CHANGED
|
@@ -10327,6 +10327,106 @@ const CommodityGroup = ({ products, data, defImg, style, onCLick, popupDetailDat
|
|
|
10327
10327
|
};
|
|
10328
10328
|
var CommodityGroup$1 = React.memo(CommodityGroup);
|
|
10329
10329
|
|
|
10330
|
+
function useVisibleHeight() {
|
|
10331
|
+
const [visibleHeight, setVisibleHeight] = React.useState(0);
|
|
10332
|
+
const [bottomHeight, setBottomHeight] = React.useState(0);
|
|
10333
|
+
const getVisibleContentHeight = () => {
|
|
10334
|
+
// 方法优先级:
|
|
10335
|
+
// 1. visualViewport.height (最准确)
|
|
10336
|
+
// 2. window.innerHeight (次之)
|
|
10337
|
+
// 3. document.documentElement.clientHeight (fallback)
|
|
10338
|
+
if (typeof window === 'undefined')
|
|
10339
|
+
return 0;
|
|
10340
|
+
let height = window.innerHeight;
|
|
10341
|
+
// 优先使用 visualViewport
|
|
10342
|
+
if (window.visualViewport) {
|
|
10343
|
+
height = window.visualViewport.height;
|
|
10344
|
+
}
|
|
10345
|
+
// 验证高度合理性
|
|
10346
|
+
if (height <= 0 || height > window.screen.height) {
|
|
10347
|
+
height = window.innerHeight;
|
|
10348
|
+
}
|
|
10349
|
+
// 最终 fallback
|
|
10350
|
+
if (height <= 0) {
|
|
10351
|
+
height = document.documentElement.clientHeight;
|
|
10352
|
+
}
|
|
10353
|
+
return height;
|
|
10354
|
+
};
|
|
10355
|
+
const updateHeight = React.useCallback(() => {
|
|
10356
|
+
var _a;
|
|
10357
|
+
const visibleHeight = getVisibleContentHeight();
|
|
10358
|
+
const screenHeight = (_a = window.screen) === null || _a === void 0 ? void 0 : _a.height;
|
|
10359
|
+
const ua = navigator.userAgent;
|
|
10360
|
+
// Instagram 检测
|
|
10361
|
+
const isInstagram = /Instagram/i.test(ua);
|
|
10362
|
+
// Facebook 检测
|
|
10363
|
+
const isFacebook = /FBAV|FBAN|FBSN/i.test(ua);
|
|
10364
|
+
// 安全检查
|
|
10365
|
+
if (!screenHeight || visibleHeight <= 0 || (!isInstagram && !isFacebook)) {
|
|
10366
|
+
setVisibleHeight(visibleHeight);
|
|
10367
|
+
return;
|
|
10368
|
+
}
|
|
10369
|
+
const ratio = visibleHeight / screenHeight;
|
|
10370
|
+
const threshold = 0.9;
|
|
10371
|
+
const h = screenHeight >= 900 ? screenHeight * 0.8 : screenHeight * 0.79;
|
|
10372
|
+
// 当内容高度占屏幕高度90%以上时,使用按比例计算的高度
|
|
10373
|
+
// 否则使用实际内容高度
|
|
10374
|
+
const isRatio = ratio >= threshold && ratio !== 1;
|
|
10375
|
+
const finalHeight = isRatio ? Math.round(h) : visibleHeight;
|
|
10376
|
+
if (isRatio) {
|
|
10377
|
+
setBottomHeight(screenHeight - Math.round(h));
|
|
10378
|
+
}
|
|
10379
|
+
else {
|
|
10380
|
+
setBottomHeight(0);
|
|
10381
|
+
}
|
|
10382
|
+
if ('fundebug' in window) {
|
|
10383
|
+
const systemInfo = {
|
|
10384
|
+
ratio,
|
|
10385
|
+
h,
|
|
10386
|
+
finalHeight,
|
|
10387
|
+
visibleHeight,
|
|
10388
|
+
screenHeight,
|
|
10389
|
+
isInstagram,
|
|
10390
|
+
isFacebook,
|
|
10391
|
+
ua
|
|
10392
|
+
};
|
|
10393
|
+
window === null || window === void 0 ? void 0 : window.fundebug.notify('Collect_Info', 'resize', { metaData: { systemInfo, otherInfo: {} } });
|
|
10394
|
+
}
|
|
10395
|
+
setVisibleHeight(finalHeight);
|
|
10396
|
+
}, [getVisibleContentHeight]);
|
|
10397
|
+
React.useEffect(() => {
|
|
10398
|
+
// 初始计算
|
|
10399
|
+
updateHeight();
|
|
10400
|
+
// 事件监听
|
|
10401
|
+
const events = ['resize', 'orientationchange', 'load', 'DOMContentLoaded'];
|
|
10402
|
+
events.forEach((event) => {
|
|
10403
|
+
window.addEventListener(event, updateHeight);
|
|
10404
|
+
});
|
|
10405
|
+
// visualViewport 监听(最重要)
|
|
10406
|
+
if (window.visualViewport) {
|
|
10407
|
+
window.visualViewport.addEventListener('resize', updateHeight);
|
|
10408
|
+
window.visualViewport.addEventListener('scroll', updateHeight);
|
|
10409
|
+
}
|
|
10410
|
+
// 键盘弹出/收起监听(移动端重要)
|
|
10411
|
+
if ('virtualKeyboard' in navigator) {
|
|
10412
|
+
navigator.virtualKeyboard.addEventListener('geometrychange', updateHeight);
|
|
10413
|
+
}
|
|
10414
|
+
return () => {
|
|
10415
|
+
events.forEach((event) => {
|
|
10416
|
+
window.removeEventListener(event, updateHeight);
|
|
10417
|
+
});
|
|
10418
|
+
if (window.visualViewport) {
|
|
10419
|
+
window.visualViewport.removeEventListener('resize', updateHeight);
|
|
10420
|
+
window.visualViewport.removeEventListener('scroll', updateHeight);
|
|
10421
|
+
}
|
|
10422
|
+
if ('virtualKeyboard' in navigator) {
|
|
10423
|
+
navigator.virtualKeyboard.removeEventListener('geometrychange', updateHeight);
|
|
10424
|
+
}
|
|
10425
|
+
};
|
|
10426
|
+
}, [updateHeight]);
|
|
10427
|
+
return { visibleHeight, bottomHeight };
|
|
10428
|
+
}
|
|
10429
|
+
|
|
10330
10430
|
/*
|
|
10331
10431
|
* @Author: binruan@chatlabs.com
|
|
10332
10432
|
* @Date: 2023-11-02 18:34:34
|
|
@@ -10336,15 +10436,17 @@ var CommodityGroup$1 = React.memo(CommodityGroup);
|
|
|
10336
10436
|
*
|
|
10337
10437
|
*/
|
|
10338
10438
|
const closeIcon$1 = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAjhJREFUWEfFlztOw0AQhmeWiJ4CCmpQ5DiRQsIJyAWg5A0lR0AIChDiCJS8ER0cADgBeRSxt4CCDgkaKiq8i+zYeWx2413HEWmiJJv9v535Z2aN8M8vFPT9z3zETD0aAUChUJjwvPFHAJhBhB3Hqd6OAsK2yyucwykAvP38eJX398Z3AJDLlVYR8ToU9Rhj25TWr9KEsKy5dULIGQCMtfZly45TvwsAstm56UwG6wA4FUFwzrdctxZBDcWSy5XWEPG8I84/GcMipdWPtgcsaz5PCHtKG0IuTiqUvjT9U/WYMG2IOPE+AP+LtCB0xKUAAyA2Xbd2o2OG0NQXvTnvhL17D7EPtH9TRCIWwkRcGYGIQgYBABuqPuHXOQBc6pw80lBGwBQiiXhsBHQhkoprA6iM6acjhDQKu5YJZW6XeOI3XJdpvfsdTu52VfXEekD8owQiXGIubpSCbhDbLu8DwKEAd+A41SOdPpE4BS0viFOtvV2iKWqUgn5x/tmS70xR01GuDSCKc86/OCcLgTyyZ0ScDGNhFAktAJV4NFJ9YyaFiAWIE+9uVkkgBgLoig8DMWAa9ro9ynkUdlW5maZDCmB6clmz0k1HH4Cs1Ezbq2p2yEpUuBOKTSZZex00RUWIrltxuuK6EOGDSbGIOPZicpMx6fny650377qNRgBgWeVFQuA+6UjVgREhGIMlSqsPUQqIbZdOOIdZQmCv2axRnU1N1+TzJYsxOEaEV8ep7frPZ7Gd0FTEdP0ft0/kMNdg0eoAAAAASUVORK5CYII=';
|
|
10339
|
-
const Modal = ({ visible, onClose, children, modalStyle, padding, popup, schema, fullHeight
|
|
10439
|
+
const Modal = ({ visible, onClose, children, modalStyle, padding, popup, schema, fullHeight, isFullScreen = false, openState }) => {
|
|
10340
10440
|
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;
|
|
10441
|
+
const { visibleHeight, bottomHeight } = useVisibleHeight();
|
|
10341
10442
|
const touchRef = React.useRef(null);
|
|
10342
10443
|
const fTouchRef = React.useRef(null);
|
|
10343
10444
|
const touchMoveRef = React.useRef(null);
|
|
10344
10445
|
const ref = React.useRef(null);
|
|
10345
10446
|
const modalRef = React.useRef(null);
|
|
10346
|
-
const
|
|
10347
|
-
const
|
|
10447
|
+
const modalHeight = fullHeight || visibleHeight;
|
|
10448
|
+
const MODAL_DEF_TRANS = modalHeight * 0.2;
|
|
10449
|
+
const MODAL_DEF_CON_H = isFullScreen ? modalHeight : modalHeight * 0.8;
|
|
10348
10450
|
const [modalTrans, setModalTrans] = React.useState(MODAL_DEF_TRANS);
|
|
10349
10451
|
const [isShow, setIsShow] = React.useState(false);
|
|
10350
10452
|
const modalEleRef = React.useRef(null);
|
|
@@ -10392,17 +10494,17 @@ const Modal = ({ visible, onClose, children, modalStyle, padding, popup, schema,
|
|
|
10392
10494
|
}, [_popup, openState, globalConfig, schema]);
|
|
10393
10495
|
React.useEffect(() => {
|
|
10394
10496
|
const trapFocus = (element) => {
|
|
10395
|
-
|
|
10396
|
-
|
|
10397
|
-
|
|
10398
|
-
|
|
10497
|
+
const focusableEls = element === null || element === void 0 ? void 0 : element.querySelectorAll('[role="button"],a, a[href]:not([disabled]), button:not([disabled]), textarea:not([disabled]), input[type="text"]:not([disabled]), input[type="radio"]:not([disabled]), input[type="checkbox"]:not([disabled]), select:not([disabled])');
|
|
10498
|
+
const firstFocusableEl = focusableEls === null || focusableEls === void 0 ? void 0 : focusableEls[0];
|
|
10499
|
+
const lastFocusableEl = focusableEls === null || focusableEls === void 0 ? void 0 : focusableEls[(focusableEls === null || focusableEls === void 0 ? void 0 : focusableEls.length) - 1];
|
|
10500
|
+
const KEYCODE_TAB = 9;
|
|
10399
10501
|
element.addEventListener('keydown', function (e) {
|
|
10400
10502
|
if (e.key === 'Escape' || e.key === 'Esc') {
|
|
10401
10503
|
// 在这里执行按下 Esc 键时的操作
|
|
10402
10504
|
handleClose();
|
|
10403
10505
|
e.preventDefault();
|
|
10404
10506
|
}
|
|
10405
|
-
|
|
10507
|
+
const isTabPressed = e.key === 'Tab' || e.keyCode === KEYCODE_TAB;
|
|
10406
10508
|
if (!isTabPressed) {
|
|
10407
10509
|
return;
|
|
10408
10510
|
}
|
|
@@ -10484,12 +10586,12 @@ const Modal = ({ visible, onClose, children, modalStyle, padding, popup, schema,
|
|
|
10484
10586
|
}
|
|
10485
10587
|
touchMoveRef.current = false;
|
|
10486
10588
|
};
|
|
10487
|
-
return ReactDOM__namespace.createPortal(React.createElement(React.Fragment, null, isShow && (React.createElement("div", { className: 'modal-bg', style: Object.assign({ display: 'flex', backgroundColor: isOpen ? 'rgba(0, 0, 0, 0.7)' : 'rgba(0, 0, 0, 0)' }, modalStyle), onClick: handleClose },
|
|
10589
|
+
return ReactDOM__namespace.createPortal(React.createElement(React.Fragment, null, isShow && (React.createElement("div", { className: 'modal-bg', style: Object.assign({ display: 'flex', backgroundColor: isOpen ? 'rgba(0, 0, 0, 0.7)' : 'rgba(0, 0, 0, 0)', bottom: bottomHeight + 'px' }, modalStyle), onClick: handleClose },
|
|
10488
10590
|
React.createElement("div", { style: {
|
|
10489
10591
|
position: 'relative',
|
|
10490
10592
|
left: `${(_d = (_c = (_b = (_a = getPopupById === null || getPopupById === void 0 ? void 0 : getPopupById.item) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b.popupBg) === null || _c === void 0 ? void 0 : _c.horizontalMargin) !== null && _d !== void 0 ? _d : 0}px`,
|
|
10491
10593
|
right: `${(_h = (_g = (_f = (_e = getPopupById === null || getPopupById === void 0 ? void 0 : getPopupById.item) === null || _e === void 0 ? void 0 : _e.props) === null || _f === void 0 ? void 0 : _f.popupBg) === null || _g === void 0 ? void 0 : _g.horizontalMargin) !== null && _h !== void 0 ? _h : 0}px`,
|
|
10492
|
-
bottom: `${(_m = (_l = (_k = (_j = getPopupById === null || getPopupById === void 0 ? void 0 : getPopupById.item) === null || _j === void 0 ? void 0 : _j.props) === null || _k === void 0 ? void 0 : _k.popupBg) === null || _l === void 0 ? void 0 : _l.bottomMargin) !== null && _m !== void 0 ? _m : 0}px`,
|
|
10594
|
+
bottom: `${((_m = (_l = (_k = (_j = getPopupById === null || getPopupById === void 0 ? void 0 : getPopupById.item) === null || _j === void 0 ? void 0 : _j.props) === null || _k === void 0 ? void 0 : _k.popupBg) === null || _l === void 0 ? void 0 : _l.bottomMargin) !== null && _m !== void 0 ? _m : 0) + bottomHeight}px`,
|
|
10493
10595
|
overflow: 'hidden',
|
|
10494
10596
|
width: `calc(100% - ${((_r = (_q = (_p = (_o = getPopupById === null || getPopupById === void 0 ? void 0 : getPopupById.item) === null || _o === void 0 ? void 0 : _o.props) === null || _p === void 0 ? void 0 : _p.popupBg) === null || _q === void 0 ? void 0 : _q.horizontalMargin) !== null && _r !== void 0 ? _r : 0) * 2}px)`,
|
|
10495
10597
|
height: '100%'
|
|
@@ -10505,7 +10607,7 @@ const Modal = ({ visible, onClose, children, modalStyle, padding, popup, schema,
|
|
|
10505
10607
|
onTouchEnd: handleTouchEnd
|
|
10506
10608
|
})),
|
|
10507
10609
|
React.createElement("div", Object.assign({ id: 'modal-content', ref: ref, style: {
|
|
10508
|
-
height: isScrollFullScreen ?
|
|
10610
|
+
height: isScrollFullScreen ? modalHeight : MODAL_DEF_CON_H,
|
|
10509
10611
|
overflow: (isScrollFullScreen && modalTrans <= 0) || !isScrollFullScreen ? 'auto' : 'hidden',
|
|
10510
10612
|
zIndex: 1
|
|
10511
10613
|
} }, (((_z = (_y = getPopupById === null || getPopupById === void 0 ? void 0 : getPopupById.item) === null || _y === void 0 ? void 0 : _y.props) === null || _z === void 0 ? void 0 : _z.enableFixedCloseButton) && {
|
|
@@ -18140,7 +18242,7 @@ const mountVideoPlayerAtNode = (() => {
|
|
|
18140
18242
|
};
|
|
18141
18243
|
})();
|
|
18142
18244
|
|
|
18143
|
-
const VideoWidget$4 = React.forwardRef(({ rec, index, height, data, muted, activeIndex, videoPostConfig, videoPlayIcon, loopPlay, swiperRef }, ref) => {
|
|
18245
|
+
const VideoWidget$4 = React.forwardRef(({ rec, index, height, data, muted, activeIndex, videoPostConfig, videoPlayIcon, loopPlay, swiperRef, visibleHeight }, ref) => {
|
|
18144
18246
|
var _a, _b;
|
|
18145
18247
|
const [isPauseVideo, setIsPauseVideo] = React.useState(false);
|
|
18146
18248
|
const { bffEventReport, sxpParameter, waterFallData, openHashtag, bffFbReport, isDiyH5 } = useSxpDataSource();
|
|
@@ -18248,7 +18350,7 @@ const VideoWidget$4 = React.forwardRef(({ rec, index, height, data, muted, activ
|
|
|
18248
18350
|
const canvas = canvasRef === null || canvasRef === void 0 ? void 0 : canvasRef.current;
|
|
18249
18351
|
const ctx = canvas.getContext('2d');
|
|
18250
18352
|
const targetWidth = window === null || window === void 0 ? void 0 : window.innerWidth;
|
|
18251
|
-
const targetHeight = window === null || window === void 0 ? void 0 : window.innerHeight;
|
|
18353
|
+
const targetHeight = visibleHeight || (window === null || window === void 0 ? void 0 : window.innerHeight);
|
|
18252
18354
|
canvas.height = targetHeight;
|
|
18253
18355
|
canvas.width = targetWidth;
|
|
18254
18356
|
ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(videoRef.current, 0, 0, canvas.width, canvas.height);
|
|
@@ -18258,7 +18360,7 @@ const VideoWidget$4 = React.forwardRef(({ rec, index, height, data, muted, activ
|
|
|
18258
18360
|
setTimeout(() => {
|
|
18259
18361
|
setFrameImg();
|
|
18260
18362
|
}, 500);
|
|
18261
|
-
}, [videoRef.current, isBgColor, rec, firstFrameSrc, blur]);
|
|
18363
|
+
}, [videoRef.current, isBgColor, rec, firstFrameSrc, blur, visibleHeight]);
|
|
18262
18364
|
const handleLoadedmetadata = React.useCallback(() => {
|
|
18263
18365
|
if (!videoRef.current)
|
|
18264
18366
|
return;
|
|
@@ -19000,148 +19102,6 @@ const NavBack = ({ data, minusHeight, tagHeight, onClick }) => {
|
|
|
19000
19102
|
};
|
|
19001
19103
|
var NavBack$1 = React.memo(NavBack);
|
|
19002
19104
|
|
|
19003
|
-
const useVisibleHeight = () => {
|
|
19004
|
-
var _a, _b;
|
|
19005
|
-
const [visibleHeight, setVisibleHeight] = React.useState(0);
|
|
19006
|
-
const getDvhInPx = () => {
|
|
19007
|
-
const detector = document.createElement('div');
|
|
19008
|
-
detector.style.position = 'fixed';
|
|
19009
|
-
detector.style.bottom = `${getHeightWithSafeArea()}px`;
|
|
19010
|
-
detector.style.left = '0';
|
|
19011
|
-
detector.style.height = '100dvh';
|
|
19012
|
-
detector.style.visibility = 'hidden';
|
|
19013
|
-
detector.style.zIndex = '-1';
|
|
19014
|
-
document.body.appendChild(detector);
|
|
19015
|
-
const dvhInPx = detector.clientHeight;
|
|
19016
|
-
document.body.removeChild(detector);
|
|
19017
|
-
return dvhInPx;
|
|
19018
|
-
};
|
|
19019
|
-
const getVhInPx = () => {
|
|
19020
|
-
const detector = document.createElement('div');
|
|
19021
|
-
detector.style.position = 'fixed';
|
|
19022
|
-
detector.style.bottom = `${getHeightWithSafeArea()}px`;
|
|
19023
|
-
detector.style.left = '0';
|
|
19024
|
-
detector.style.height = '100vh';
|
|
19025
|
-
detector.style.visibility = 'hidden';
|
|
19026
|
-
detector.style.zIndex = '-1';
|
|
19027
|
-
document.body.appendChild(detector);
|
|
19028
|
-
const dvhInPx = detector.clientHeight;
|
|
19029
|
-
document.body.removeChild(detector);
|
|
19030
|
-
return dvhInPx;
|
|
19031
|
-
};
|
|
19032
|
-
const getFillAvailableInPx = () => {
|
|
19033
|
-
const detector = document.createElement('div');
|
|
19034
|
-
detector.style.position = 'fixed';
|
|
19035
|
-
detector.style.bottom = `${getHeightWithSafeArea()}px`;
|
|
19036
|
-
detector.style.left = '0';
|
|
19037
|
-
detector.style.height = '-webkit-fill-available';
|
|
19038
|
-
detector.style.visibility = 'hidden';
|
|
19039
|
-
detector.style.zIndex = '-1';
|
|
19040
|
-
document.body.appendChild(detector);
|
|
19041
|
-
const dvhInPx = detector.clientHeight;
|
|
19042
|
-
document.body.removeChild(detector);
|
|
19043
|
-
return dvhInPx;
|
|
19044
|
-
};
|
|
19045
|
-
const getHeightWithSafeArea = () => {
|
|
19046
|
-
const root = document.documentElement;
|
|
19047
|
-
const value = getComputedStyle(root).getPropertyValue('--safe-area-inset-bottom');
|
|
19048
|
-
// 处理可能的值(可能是 '0px', '34px' 等)
|
|
19049
|
-
const numericValue = parseInt(value) || 0;
|
|
19050
|
-
return numericValue;
|
|
19051
|
-
};
|
|
19052
|
-
const dvhToPx = (dvh) => {
|
|
19053
|
-
return Math.round((dvh / 100) * document.documentElement.clientHeight);
|
|
19054
|
-
};
|
|
19055
|
-
// 检测是否启用了系统字体缩放
|
|
19056
|
-
const fontSize = parseFloat(getComputedStyle(document.documentElement).fontSize);
|
|
19057
|
-
const isScaled = fontSize !== 52; // 默认 1rem = 16px
|
|
19058
|
-
// 检测是否处于 Display Zoom 模式(通过屏幕宽高比间接判断)
|
|
19059
|
-
const isZoomed = screen.width <= 375 && screen.height <= 667 && window.devicePixelRatio < 3;
|
|
19060
|
-
const systemInfo = {
|
|
19061
|
-
visualViewport: (_a = window.visualViewport) === null || _a === void 0 ? void 0 : _a.height,
|
|
19062
|
-
innerHeight: window.innerHeight,
|
|
19063
|
-
clientHeight: document.documentElement.clientHeight,
|
|
19064
|
-
screenHeight: window.screen.height,
|
|
19065
|
-
bodyHeight: (_b = document === null || document === void 0 ? void 0 : document.body) === null || _b === void 0 ? void 0 : _b.clientHeight,
|
|
19066
|
-
agent: navigator.userAgent,
|
|
19067
|
-
version: '1.19.17',
|
|
19068
|
-
safeArea: getHeightWithSafeArea(),
|
|
19069
|
-
dvh: dvhToPx(100),
|
|
19070
|
-
dvhInPx: getDvhInPx(),
|
|
19071
|
-
vhInPx: getVhInPx(),
|
|
19072
|
-
fillAvailableInPx: getFillAvailableInPx(),
|
|
19073
|
-
isScaled,
|
|
19074
|
-
isZoomed,
|
|
19075
|
-
meta: `${window === null || window === void 0 ? void 0 : window.Instagram},${window === null || window === void 0 ? void 0 : window.Facebook}`
|
|
19076
|
-
};
|
|
19077
|
-
console.log(systemInfo, 'fundebug-init--------------------->systemInfo');
|
|
19078
|
-
if ('fundebug' in window) {
|
|
19079
|
-
window === null || window === void 0 ? void 0 : window.fundebug.notify('Collect_Info', 'init', { metaData: { systemInfo, otherInfo: {} } });
|
|
19080
|
-
}
|
|
19081
|
-
const updateHeight = React.useCallback(() => {
|
|
19082
|
-
var _a, _b, _c;
|
|
19083
|
-
const fontSize = parseFloat(getComputedStyle(document.documentElement).fontSize);
|
|
19084
|
-
const isScaled = fontSize !== 52; // 默认 1rem = 16px
|
|
19085
|
-
const systemInfo = {
|
|
19086
|
-
visualViewport: (_a = window.visualViewport) === null || _a === void 0 ? void 0 : _a.height,
|
|
19087
|
-
innerHeight: window.innerHeight,
|
|
19088
|
-
clientHeight: document.documentElement.clientHeight,
|
|
19089
|
-
screenHeight: window.screen.height,
|
|
19090
|
-
bodyHeight: (_b = document === null || document === void 0 ? void 0 : document.body) === null || _b === void 0 ? void 0 : _b.clientHeight,
|
|
19091
|
-
agent: navigator.userAgent,
|
|
19092
|
-
version: '1.19.17',
|
|
19093
|
-
safeArea: getHeightWithSafeArea(),
|
|
19094
|
-
dvh: dvhToPx(100),
|
|
19095
|
-
dvhInPx: getDvhInPx(),
|
|
19096
|
-
vhInPx: getVhInPx(),
|
|
19097
|
-
fillAvailableInPx: getFillAvailableInPx(),
|
|
19098
|
-
isScaled,
|
|
19099
|
-
isZoomed,
|
|
19100
|
-
meta: `${window === null || window === void 0 ? void 0 : window.Instagram},${window === null || window === void 0 ? void 0 : window.Facebook}`
|
|
19101
|
-
};
|
|
19102
|
-
console.log(systemInfo, 'fundebug-resize--------------------->systemInfo');
|
|
19103
|
-
if ('fundebug' in window) {
|
|
19104
|
-
window === null || window === void 0 ? void 0 : window.fundebug.notify('Collect_Info', 'resize', { metaData: { systemInfo, otherInfo: {} } });
|
|
19105
|
-
}
|
|
19106
|
-
const height = ((_c = document === null || document === void 0 ? void 0 : document.documentElement) === null || _c === void 0 ? void 0 : _c.clientHeight) || (window === null || window === void 0 ? void 0 : window.innerHeight);
|
|
19107
|
-
setVisibleHeight(height);
|
|
19108
|
-
}, [getHeightWithSafeArea, dvhToPx, getDvhInPx, getVhInPx, getFillAvailableInPx]);
|
|
19109
|
-
React.useEffect(() => {
|
|
19110
|
-
// 初始计算
|
|
19111
|
-
updateHeight();
|
|
19112
|
-
// 事件监听
|
|
19113
|
-
const events = ['resize', 'orientationchange', 'load', 'DOMContentLoaded'];
|
|
19114
|
-
events.forEach((event) => {
|
|
19115
|
-
window.addEventListener(event, updateHeight);
|
|
19116
|
-
});
|
|
19117
|
-
// visualViewport 监听(最重要)
|
|
19118
|
-
if (window.visualViewport) {
|
|
19119
|
-
window.visualViewport.addEventListener('resize', updateHeight);
|
|
19120
|
-
window.visualViewport.addEventListener('scroll', updateHeight);
|
|
19121
|
-
}
|
|
19122
|
-
// 键盘弹出/收起监听(移动端重要)
|
|
19123
|
-
if ('virtualKeyboard' in navigator) {
|
|
19124
|
-
navigator.virtualKeyboard.addEventListener('geometrychange', updateHeight);
|
|
19125
|
-
}
|
|
19126
|
-
// 定期检查(应对某些特殊情况)
|
|
19127
|
-
const interval = setInterval(updateHeight, 1000);
|
|
19128
|
-
return () => {
|
|
19129
|
-
events.forEach((event) => {
|
|
19130
|
-
window.removeEventListener(event, updateHeight);
|
|
19131
|
-
});
|
|
19132
|
-
if (window.visualViewport) {
|
|
19133
|
-
window.visualViewport.removeEventListener('resize', updateHeight);
|
|
19134
|
-
window.visualViewport.removeEventListener('scroll', updateHeight);
|
|
19135
|
-
}
|
|
19136
|
-
if ('virtualKeyboard' in navigator) {
|
|
19137
|
-
navigator.virtualKeyboard.removeEventListener('geometrychange', updateHeight);
|
|
19138
|
-
}
|
|
19139
|
-
clearInterval(interval);
|
|
19140
|
-
};
|
|
19141
|
-
}, [updateHeight]);
|
|
19142
|
-
return visibleHeight;
|
|
19143
|
-
};
|
|
19144
|
-
|
|
19145
19105
|
/*
|
|
19146
19106
|
* @Author: binruan@chatlabs.com
|
|
19147
19107
|
* @Date: 2024-03-20 10:27:31
|
|
@@ -19150,7 +19110,7 @@ const useVisibleHeight = () => {
|
|
|
19150
19110
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\index.tsx
|
|
19151
19111
|
*
|
|
19152
19112
|
*/
|
|
19153
|
-
const SxpPageRender = ({ globalConfig, descStyle, containerHeight
|
|
19113
|
+
const SxpPageRender = ({ globalConfig, descStyle, containerHeight, containerWidth = window.innerWidth, tempMap, resolver, data = [], ctaType, tipText, nudge, _schema, hashTagStyle, hashTagRightMargin, tagList = [], defaultData }) => {
|
|
19154
19114
|
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;
|
|
19155
19115
|
const mutedIcon = useIconLink('/pb_static/5beaaa5ce7f3477b99db3838619cc471.png');
|
|
19156
19116
|
const unmutedIcon = useIconLink('/pb_static/fea8668a8a894e4aa3a86bcc775e895e.png');
|
|
@@ -19170,7 +19130,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
|
19170
19130
|
const fbcRef = React.useRef('');
|
|
19171
19131
|
const { loadVideos, bffEventReport, loading, setPopupDetailData, ctaEvent, swiperRef, waterFallData, setOpenHashtag, appDomain, openHashtag, loadingImage, isFromHashtag, popupDetailData, bffFbReport, curTime, h5EnterLink, isShowConsent, selectTag, isPreview, isEditor, cacheRtcList, setRtcList, cacheActiveIndex, rtcList, isNoMoreData, channel, refreshFeSession, isDiyH5, pixelPvStatusRef } = useSxpDataSource();
|
|
19172
19132
|
const { backMainFeed, productView, jumpToWeb } = useEventReport();
|
|
19173
|
-
const visibleHeight = useVisibleHeight();
|
|
19133
|
+
const { visibleHeight, bottomHeight } = useVisibleHeight();
|
|
19174
19134
|
const isShowFingerTip = React.useMemo(() => {
|
|
19175
19135
|
return data.length > 0 && !loading && (getFeUserState() || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableSwiperTip));
|
|
19176
19136
|
}, [data, loading, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableSwiperTip]);
|
|
@@ -19339,29 +19299,10 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
|
19339
19299
|
}
|
|
19340
19300
|
return minusHeight;
|
|
19341
19301
|
}, [globalConfig]);
|
|
19342
|
-
const getHeightWithSafeArea = () => {
|
|
19343
|
-
const root = document.documentElement;
|
|
19344
|
-
const value = getComputedStyle(root).getPropertyValue('--safe-area-inset-bottom');
|
|
19345
|
-
// 处理可能的值(可能是 '0px', '34px' 等)
|
|
19346
|
-
const numericValue = parseInt(value) || 0;
|
|
19347
|
-
return numericValue;
|
|
19348
|
-
};
|
|
19349
|
-
const getDvhInPx = () => {
|
|
19350
|
-
const detector = document.createElement('div');
|
|
19351
|
-
detector.style.position = 'fixed';
|
|
19352
|
-
detector.style.bottom = `${getHeightWithSafeArea()}px`;
|
|
19353
|
-
detector.style.left = '0';
|
|
19354
|
-
detector.style.height = '100dvh';
|
|
19355
|
-
detector.style.visibility = 'hidden';
|
|
19356
|
-
detector.style.zIndex = '-1';
|
|
19357
|
-
document.body.appendChild(detector);
|
|
19358
|
-
const dvhInPx = detector.clientHeight;
|
|
19359
|
-
document.body.removeChild(detector);
|
|
19360
|
-
return dvhInPx;
|
|
19361
|
-
};
|
|
19362
19302
|
const height = React.useMemo(() => {
|
|
19363
|
-
|
|
19364
|
-
|
|
19303
|
+
const h = containerHeight || visibleHeight;
|
|
19304
|
+
return h - minusHeight - tagHeight;
|
|
19305
|
+
}, [containerHeight, visibleHeight, minusHeight, tagHeight]);
|
|
19365
19306
|
const visList = React.useMemo(() => {
|
|
19366
19307
|
var _a;
|
|
19367
19308
|
const list = activeIndex === 0 && !waterFallData && !isEditor && !isDiyH5
|
|
@@ -19403,7 +19344,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
|
19403
19344
|
return (React.createElement(MultiPosts$2, Object.assign({ recData: data === null || data === void 0 ? void 0 : data[1] }, (_c = (_b = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.multiPosts) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.item) === null || _c === void 0 ? void 0 : _c.props, (_f = (_e = (_d = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.multiPosts) === null || _d === void 0 ? void 0 : _d[0]) === null || _e === void 0 ? void 0 : _e.item) === null || _f === void 0 ? void 0 : _f.event)));
|
|
19404
19345
|
}
|
|
19405
19346
|
if ((_g = rec === null || rec === void 0 ? void 0 : rec.video) === null || _g === void 0 ? void 0 : _g.url) {
|
|
19406
|
-
return (React.createElement(VideoWidget$5, Object.assign({ key: isReload }, (activeIndex === index && { ref: videoWidgetRef }), { rec: rec, index: index, muted: isMuted, data: data, height: height, activeIndex: activeIndex, videoPostConfig: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.videoPost, videoPlayIcon: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.videoPlayIcon, loopPlay: true, swiperRef: swiperRef })));
|
|
19347
|
+
return (React.createElement(VideoWidget$5, Object.assign({ key: isReload }, (activeIndex === index && { ref: videoWidgetRef }), { rec: rec, index: index, muted: isMuted, data: data, height: height, activeIndex: activeIndex, videoPostConfig: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.videoPost, videoPlayIcon: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.videoPlayIcon, loopPlay: true, swiperRef: swiperRef, visibleHeight: visibleHeight })));
|
|
19407
19348
|
}
|
|
19408
19349
|
if ((_h = rec === null || rec === void 0 ? void 0 : rec.video) === null || _h === void 0 ? void 0 : _h.imgUrls) {
|
|
19409
19350
|
return (React.createElement(PictureGroup$5, { key: rec === null || rec === void 0 ? void 0 : rec.video.itemId, imgUrls: rec === null || rec === void 0 ? void 0 : rec.video.imgUrls, width: containerWidth, height: height, rec: rec, index: index, onViewImageEndEvent: handleViewImageStartEnd, onViewImageStartEvent: handleViewImageStartEvent, imgUrlsPostConfig: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.imgUrlsPost }));
|
|
@@ -19430,7 +19371,8 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
|
19430
19371
|
tipText,
|
|
19431
19372
|
resolver,
|
|
19432
19373
|
schema,
|
|
19433
|
-
isReload
|
|
19374
|
+
isReload,
|
|
19375
|
+
visibleHeight
|
|
19434
19376
|
]);
|
|
19435
19377
|
const onExpandableChange = React.useCallback((v) => {
|
|
19436
19378
|
setIsShowMore(v);
|
|
@@ -19503,7 +19445,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
|
19503
19445
|
top += minusHeight;
|
|
19504
19446
|
}
|
|
19505
19447
|
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconFixed) && (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconYPosit) !== 'top') {
|
|
19506
|
-
top +=
|
|
19448
|
+
top += bottomHeight;
|
|
19507
19449
|
}
|
|
19508
19450
|
if (rec === null || rec === void 0 ? void 0 : rec.video) {
|
|
19509
19451
|
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: {
|
|
@@ -19513,7 +19455,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
|
19513
19455
|
}, position: index }));
|
|
19514
19456
|
}
|
|
19515
19457
|
return null;
|
|
19516
|
-
}, [globalConfig, waterFallData]);
|
|
19458
|
+
}, [globalConfig, waterFallData, bottomHeight]);
|
|
19517
19459
|
const handleViewImageStartEnd = (item) => {
|
|
19518
19460
|
var _a, _b, _c, _d, _e, _f;
|
|
19519
19461
|
if (!((_a = item === null || item === void 0 ? void 0 : item.video) === null || _a === void 0 ? void 0 : _a.url) && ((_b = item === null || item === void 0 ? void 0 : item.video) === null || _b === void 0 ? void 0 : _b.imgUrls)) {
|
|
@@ -19740,7 +19682,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
|
19740
19682
|
top += minusHeight;
|
|
19741
19683
|
}
|
|
19742
19684
|
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed) && (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconYPosit) !== 'top') {
|
|
19743
|
-
top +=
|
|
19685
|
+
top += bottomHeight;
|
|
19744
19686
|
}
|
|
19745
19687
|
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: {
|
|
19746
19688
|
position: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed) ? 'fixed' : 'absolute',
|
|
@@ -19750,7 +19692,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
|
19750
19692
|
[(_d = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconXPosit) !== null && _d !== void 0 ? _d : 'right']: (_e = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconX) !== null && _e !== void 0 ? _e : 0,
|
|
19751
19693
|
[(_f = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconYPosit) !== null && _f !== void 0 ? _f : 'bottom']: top
|
|
19752
19694
|
}, defaultValue: isMuted, activeIcon: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.unMuteIcon) ? globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.unMuteIcon : mutedIcon, unactiveIcon: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIcon) ? globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIcon : unmutedIcon, onChange: setIsMuted })));
|
|
19753
|
-
}, [globalConfig, visList, activeIndex, isMuted, waterFallData]);
|
|
19695
|
+
}, [globalConfig, visList, activeIndex, isMuted, waterFallData, bottomHeight]);
|
|
19754
19696
|
const renderView = React.useMemo(() => {
|
|
19755
19697
|
if (loading) {
|
|
19756
19698
|
return (React.createElement("div", { style: { height, width: containerWidth, display: 'flex', justifyContent: 'center', alignItems: 'center' } },
|
|
@@ -19782,7 +19724,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
|
19782
19724
|
isReload,
|
|
19783
19725
|
renderToggleButton
|
|
19784
19726
|
]);
|
|
19785
|
-
return (React.createElement("div", { id: 'sxp-render', className: 'clc-sxp-container' },
|
|
19727
|
+
return (React.createElement("div", { id: 'sxp-render', className: 'clc-sxp-container', style: { height } },
|
|
19786
19728
|
(data === null || data === void 0 ? void 0 : data.length) < 1 && loading ? (React.createElement("div", { style: { height, width: containerWidth, display: 'flex', justifyContent: 'center', alignItems: 'center' } },
|
|
19787
19729
|
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` })) },
|
|
19788
19730
|
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: () => {
|
|
@@ -19844,10 +19786,10 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
|
19844
19786
|
renderToggleButton(!!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed))),
|
|
19845
19787
|
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)),
|
|
19846
19788
|
React.createElement(ConsentPopup, { resolver: resolver, globalConfig: globalConfig }),
|
|
19847
|
-
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, bottom: '
|
|
19789
|
+
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, bottom: bottomHeight + 'px' } }))))),
|
|
19848
19790
|
(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableCookieSetting) && (React.createElement("div", { style: {
|
|
19849
19791
|
position: 'fixed',
|
|
19850
|
-
bottom: '
|
|
19792
|
+
bottom: bottomHeight + 'px',
|
|
19851
19793
|
left: 0,
|
|
19852
19794
|
right: 0,
|
|
19853
19795
|
width: '100%',
|