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/pb-ui.js
CHANGED
|
@@ -10320,6 +10320,106 @@
|
|
|
10320
10320
|
};
|
|
10321
10321
|
var CommodityGroup$1 = React.memo(CommodityGroup);
|
|
10322
10322
|
|
|
10323
|
+
function useVisibleHeight() {
|
|
10324
|
+
const [visibleHeight, setVisibleHeight] = React.useState(0);
|
|
10325
|
+
const [bottomHeight, setBottomHeight] = React.useState(0);
|
|
10326
|
+
const getVisibleContentHeight = () => {
|
|
10327
|
+
// 方法优先级:
|
|
10328
|
+
// 1. visualViewport.height (最准确)
|
|
10329
|
+
// 2. window.innerHeight (次之)
|
|
10330
|
+
// 3. document.documentElement.clientHeight (fallback)
|
|
10331
|
+
if (typeof window === 'undefined')
|
|
10332
|
+
return 0;
|
|
10333
|
+
let height = window.innerHeight;
|
|
10334
|
+
// 优先使用 visualViewport
|
|
10335
|
+
if (window.visualViewport) {
|
|
10336
|
+
height = window.visualViewport.height;
|
|
10337
|
+
}
|
|
10338
|
+
// 验证高度合理性
|
|
10339
|
+
if (height <= 0 || height > window.screen.height) {
|
|
10340
|
+
height = window.innerHeight;
|
|
10341
|
+
}
|
|
10342
|
+
// 最终 fallback
|
|
10343
|
+
if (height <= 0) {
|
|
10344
|
+
height = document.documentElement.clientHeight;
|
|
10345
|
+
}
|
|
10346
|
+
return height;
|
|
10347
|
+
};
|
|
10348
|
+
const updateHeight = React.useCallback(() => {
|
|
10349
|
+
var _a;
|
|
10350
|
+
const visibleHeight = getVisibleContentHeight();
|
|
10351
|
+
const screenHeight = (_a = window.screen) === null || _a === void 0 ? void 0 : _a.height;
|
|
10352
|
+
const ua = navigator.userAgent;
|
|
10353
|
+
// Instagram 检测
|
|
10354
|
+
const isInstagram = /Instagram/i.test(ua);
|
|
10355
|
+
// Facebook 检测
|
|
10356
|
+
const isFacebook = /FBAV|FBAN|FBSN/i.test(ua);
|
|
10357
|
+
// 安全检查
|
|
10358
|
+
if (!screenHeight || visibleHeight <= 0 || (!isInstagram && !isFacebook)) {
|
|
10359
|
+
setVisibleHeight(visibleHeight);
|
|
10360
|
+
return;
|
|
10361
|
+
}
|
|
10362
|
+
const ratio = visibleHeight / screenHeight;
|
|
10363
|
+
const threshold = 0.9;
|
|
10364
|
+
const h = screenHeight >= 900 ? screenHeight * 0.8 : screenHeight * 0.79;
|
|
10365
|
+
// 当内容高度占屏幕高度90%以上时,使用按比例计算的高度
|
|
10366
|
+
// 否则使用实际内容高度
|
|
10367
|
+
const isRatio = ratio >= threshold && ratio !== 1;
|
|
10368
|
+
const finalHeight = isRatio ? Math.round(h) : visibleHeight;
|
|
10369
|
+
if (isRatio) {
|
|
10370
|
+
setBottomHeight(screenHeight - Math.round(h));
|
|
10371
|
+
}
|
|
10372
|
+
else {
|
|
10373
|
+
setBottomHeight(0);
|
|
10374
|
+
}
|
|
10375
|
+
if ('fundebug' in window) {
|
|
10376
|
+
const systemInfo = {
|
|
10377
|
+
ratio,
|
|
10378
|
+
h,
|
|
10379
|
+
finalHeight,
|
|
10380
|
+
visibleHeight,
|
|
10381
|
+
screenHeight,
|
|
10382
|
+
isInstagram,
|
|
10383
|
+
isFacebook,
|
|
10384
|
+
ua
|
|
10385
|
+
};
|
|
10386
|
+
window === null || window === void 0 ? void 0 : window.fundebug.notify('Collect_Info', 'resize', { metaData: { systemInfo, otherInfo: {} } });
|
|
10387
|
+
}
|
|
10388
|
+
setVisibleHeight(finalHeight);
|
|
10389
|
+
}, [getVisibleContentHeight]);
|
|
10390
|
+
React.useEffect(() => {
|
|
10391
|
+
// 初始计算
|
|
10392
|
+
updateHeight();
|
|
10393
|
+
// 事件监听
|
|
10394
|
+
const events = ['resize', 'orientationchange', 'load', 'DOMContentLoaded'];
|
|
10395
|
+
events.forEach((event) => {
|
|
10396
|
+
window.addEventListener(event, updateHeight);
|
|
10397
|
+
});
|
|
10398
|
+
// visualViewport 监听(最重要)
|
|
10399
|
+
if (window.visualViewport) {
|
|
10400
|
+
window.visualViewport.addEventListener('resize', updateHeight);
|
|
10401
|
+
window.visualViewport.addEventListener('scroll', updateHeight);
|
|
10402
|
+
}
|
|
10403
|
+
// 键盘弹出/收起监听(移动端重要)
|
|
10404
|
+
if ('virtualKeyboard' in navigator) {
|
|
10405
|
+
navigator.virtualKeyboard.addEventListener('geometrychange', updateHeight);
|
|
10406
|
+
}
|
|
10407
|
+
return () => {
|
|
10408
|
+
events.forEach((event) => {
|
|
10409
|
+
window.removeEventListener(event, updateHeight);
|
|
10410
|
+
});
|
|
10411
|
+
if (window.visualViewport) {
|
|
10412
|
+
window.visualViewport.removeEventListener('resize', updateHeight);
|
|
10413
|
+
window.visualViewport.removeEventListener('scroll', updateHeight);
|
|
10414
|
+
}
|
|
10415
|
+
if ('virtualKeyboard' in navigator) {
|
|
10416
|
+
navigator.virtualKeyboard.removeEventListener('geometrychange', updateHeight);
|
|
10417
|
+
}
|
|
10418
|
+
};
|
|
10419
|
+
}, [updateHeight]);
|
|
10420
|
+
return { visibleHeight, bottomHeight };
|
|
10421
|
+
}
|
|
10422
|
+
|
|
10323
10423
|
/*
|
|
10324
10424
|
* @Author: binruan@chatlabs.com
|
|
10325
10425
|
* @Date: 2023-11-02 18:34:34
|
|
@@ -10329,15 +10429,17 @@
|
|
|
10329
10429
|
*
|
|
10330
10430
|
*/
|
|
10331
10431
|
const closeIcon$1 = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAjhJREFUWEfFlztOw0AQhmeWiJ4CCmpQ5DiRQsIJyAWg5A0lR0AIChDiCJS8ER0cADgBeRSxt4CCDgkaKiq8i+zYeWx2413HEWmiJJv9v535Z2aN8M8vFPT9z3zETD0aAUChUJjwvPFHAJhBhB3Hqd6OAsK2yyucwykAvP38eJX398Z3AJDLlVYR8ToU9Rhj25TWr9KEsKy5dULIGQCMtfZly45TvwsAstm56UwG6wA4FUFwzrdctxZBDcWSy5XWEPG8I84/GcMipdWPtgcsaz5PCHtKG0IuTiqUvjT9U/WYMG2IOPE+AP+LtCB0xKUAAyA2Xbd2o2OG0NQXvTnvhL17D7EPtH9TRCIWwkRcGYGIQgYBABuqPuHXOQBc6pw80lBGwBQiiXhsBHQhkoprA6iM6acjhDQKu5YJZW6XeOI3XJdpvfsdTu52VfXEekD8owQiXGIubpSCbhDbLu8DwKEAd+A41SOdPpE4BS0viFOtvV2iKWqUgn5x/tmS70xR01GuDSCKc86/OCcLgTyyZ0ScDGNhFAktAJV4NFJ9YyaFiAWIE+9uVkkgBgLoig8DMWAa9ro9ynkUdlW5maZDCmB6clmz0k1HH4Cs1Ezbq2p2yEpUuBOKTSZZex00RUWIrltxuuK6EOGDSbGIOPZicpMx6fny650377qNRgBgWeVFQuA+6UjVgREhGIMlSqsPUQqIbZdOOIdZQmCv2axRnU1N1+TzJYsxOEaEV8ep7frPZ7Gd0FTEdP0ft0/kMNdg0eoAAAAASUVORK5CYII=';
|
|
10332
|
-
const Modal = ({ visible, onClose, children, modalStyle, padding, popup, schema, fullHeight
|
|
10432
|
+
const Modal = ({ visible, onClose, children, modalStyle, padding, popup, schema, fullHeight, isFullScreen = false, openState }) => {
|
|
10333
10433
|
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;
|
|
10434
|
+
const { visibleHeight, bottomHeight } = useVisibleHeight();
|
|
10334
10435
|
const touchRef = React.useRef(null);
|
|
10335
10436
|
const fTouchRef = React.useRef(null);
|
|
10336
10437
|
const touchMoveRef = React.useRef(null);
|
|
10337
10438
|
const ref = React.useRef(null);
|
|
10338
10439
|
const modalRef = React.useRef(null);
|
|
10339
|
-
const
|
|
10340
|
-
const
|
|
10440
|
+
const modalHeight = fullHeight || visibleHeight;
|
|
10441
|
+
const MODAL_DEF_TRANS = modalHeight * 0.2;
|
|
10442
|
+
const MODAL_DEF_CON_H = isFullScreen ? modalHeight : modalHeight * 0.8;
|
|
10341
10443
|
const [modalTrans, setModalTrans] = React.useState(MODAL_DEF_TRANS);
|
|
10342
10444
|
const [isShow, setIsShow] = React.useState(false);
|
|
10343
10445
|
const modalEleRef = React.useRef(null);
|
|
@@ -10385,17 +10487,17 @@
|
|
|
10385
10487
|
}, [_popup, openState, globalConfig, schema]);
|
|
10386
10488
|
React.useEffect(() => {
|
|
10387
10489
|
const trapFocus = (element) => {
|
|
10388
|
-
|
|
10389
|
-
|
|
10390
|
-
|
|
10391
|
-
|
|
10490
|
+
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])');
|
|
10491
|
+
const firstFocusableEl = focusableEls === null || focusableEls === void 0 ? void 0 : focusableEls[0];
|
|
10492
|
+
const lastFocusableEl = focusableEls === null || focusableEls === void 0 ? void 0 : focusableEls[(focusableEls === null || focusableEls === void 0 ? void 0 : focusableEls.length) - 1];
|
|
10493
|
+
const KEYCODE_TAB = 9;
|
|
10392
10494
|
element.addEventListener('keydown', function (e) {
|
|
10393
10495
|
if (e.key === 'Escape' || e.key === 'Esc') {
|
|
10394
10496
|
// 在这里执行按下 Esc 键时的操作
|
|
10395
10497
|
handleClose();
|
|
10396
10498
|
e.preventDefault();
|
|
10397
10499
|
}
|
|
10398
|
-
|
|
10500
|
+
const isTabPressed = e.key === 'Tab' || e.keyCode === KEYCODE_TAB;
|
|
10399
10501
|
if (!isTabPressed) {
|
|
10400
10502
|
return;
|
|
10401
10503
|
}
|
|
@@ -10477,12 +10579,12 @@
|
|
|
10477
10579
|
}
|
|
10478
10580
|
touchMoveRef.current = false;
|
|
10479
10581
|
};
|
|
10480
|
-
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 },
|
|
10582
|
+
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 },
|
|
10481
10583
|
React.createElement("div", { style: {
|
|
10482
10584
|
position: 'relative',
|
|
10483
10585
|
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`,
|
|
10484
10586
|
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`,
|
|
10485
|
-
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`,
|
|
10587
|
+
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`,
|
|
10486
10588
|
overflow: 'hidden',
|
|
10487
10589
|
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)`,
|
|
10488
10590
|
height: '100%'
|
|
@@ -10498,7 +10600,7 @@
|
|
|
10498
10600
|
onTouchEnd: handleTouchEnd
|
|
10499
10601
|
})),
|
|
10500
10602
|
React.createElement("div", Object.assign({ id: 'modal-content', ref: ref, style: {
|
|
10501
|
-
height: isScrollFullScreen ?
|
|
10603
|
+
height: isScrollFullScreen ? modalHeight : MODAL_DEF_CON_H,
|
|
10502
10604
|
overflow: (isScrollFullScreen && modalTrans <= 0) || !isScrollFullScreen ? 'auto' : 'hidden',
|
|
10503
10605
|
zIndex: 1
|
|
10504
10606
|
} }, (((_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) && {
|
|
@@ -18133,7 +18235,7 @@ Made in Italy` })));
|
|
|
18133
18235
|
};
|
|
18134
18236
|
})();
|
|
18135
18237
|
|
|
18136
|
-
const VideoWidget$4 = React.forwardRef(({ rec, index, height, data, muted, activeIndex, videoPostConfig, videoPlayIcon, loopPlay, swiperRef }, ref) => {
|
|
18238
|
+
const VideoWidget$4 = React.forwardRef(({ rec, index, height, data, muted, activeIndex, videoPostConfig, videoPlayIcon, loopPlay, swiperRef, visibleHeight }, ref) => {
|
|
18137
18239
|
var _a, _b;
|
|
18138
18240
|
const [isPauseVideo, setIsPauseVideo] = React.useState(false);
|
|
18139
18241
|
const { bffEventReport, sxpParameter, waterFallData, openHashtag, bffFbReport, isDiyH5 } = useSxpDataSource();
|
|
@@ -18241,7 +18343,7 @@ Made in Italy` })));
|
|
|
18241
18343
|
const canvas = canvasRef === null || canvasRef === void 0 ? void 0 : canvasRef.current;
|
|
18242
18344
|
const ctx = canvas.getContext('2d');
|
|
18243
18345
|
const targetWidth = window === null || window === void 0 ? void 0 : window.innerWidth;
|
|
18244
|
-
const targetHeight = window === null || window === void 0 ? void 0 : window.innerHeight;
|
|
18346
|
+
const targetHeight = visibleHeight || (window === null || window === void 0 ? void 0 : window.innerHeight);
|
|
18245
18347
|
canvas.height = targetHeight;
|
|
18246
18348
|
canvas.width = targetWidth;
|
|
18247
18349
|
ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(videoRef.current, 0, 0, canvas.width, canvas.height);
|
|
@@ -18251,7 +18353,7 @@ Made in Italy` })));
|
|
|
18251
18353
|
setTimeout(() => {
|
|
18252
18354
|
setFrameImg();
|
|
18253
18355
|
}, 500);
|
|
18254
|
-
}, [videoRef.current, isBgColor, rec, firstFrameSrc, blur]);
|
|
18356
|
+
}, [videoRef.current, isBgColor, rec, firstFrameSrc, blur, visibleHeight]);
|
|
18255
18357
|
const handleLoadedmetadata = React.useCallback(() => {
|
|
18256
18358
|
if (!videoRef.current)
|
|
18257
18359
|
return;
|
|
@@ -18993,148 +19095,6 @@ Made in Italy` })));
|
|
|
18993
19095
|
};
|
|
18994
19096
|
var NavBack$1 = React.memo(NavBack);
|
|
18995
19097
|
|
|
18996
|
-
const useVisibleHeight = () => {
|
|
18997
|
-
var _a, _b;
|
|
18998
|
-
const [visibleHeight, setVisibleHeight] = React.useState(0);
|
|
18999
|
-
const getDvhInPx = () => {
|
|
19000
|
-
const detector = document.createElement('div');
|
|
19001
|
-
detector.style.position = 'fixed';
|
|
19002
|
-
detector.style.bottom = `${getHeightWithSafeArea()}px`;
|
|
19003
|
-
detector.style.left = '0';
|
|
19004
|
-
detector.style.height = '100dvh';
|
|
19005
|
-
detector.style.visibility = 'hidden';
|
|
19006
|
-
detector.style.zIndex = '-1';
|
|
19007
|
-
document.body.appendChild(detector);
|
|
19008
|
-
const dvhInPx = detector.clientHeight;
|
|
19009
|
-
document.body.removeChild(detector);
|
|
19010
|
-
return dvhInPx;
|
|
19011
|
-
};
|
|
19012
|
-
const getVhInPx = () => {
|
|
19013
|
-
const detector = document.createElement('div');
|
|
19014
|
-
detector.style.position = 'fixed';
|
|
19015
|
-
detector.style.bottom = `${getHeightWithSafeArea()}px`;
|
|
19016
|
-
detector.style.left = '0';
|
|
19017
|
-
detector.style.height = '100vh';
|
|
19018
|
-
detector.style.visibility = 'hidden';
|
|
19019
|
-
detector.style.zIndex = '-1';
|
|
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
|
-
// 检测是否启用了系统字体缩放
|
|
19049
|
-
const fontSize = parseFloat(getComputedStyle(document.documentElement).fontSize);
|
|
19050
|
-
const isScaled = fontSize !== 52; // 默认 1rem = 16px
|
|
19051
|
-
// 检测是否处于 Display Zoom 模式(通过屏幕宽高比间接判断)
|
|
19052
|
-
const isZoomed = screen.width <= 375 && screen.height <= 667 && window.devicePixelRatio < 3;
|
|
19053
|
-
const systemInfo = {
|
|
19054
|
-
visualViewport: (_a = window.visualViewport) === null || _a === void 0 ? void 0 : _a.height,
|
|
19055
|
-
innerHeight: window.innerHeight,
|
|
19056
|
-
clientHeight: document.documentElement.clientHeight,
|
|
19057
|
-
screenHeight: window.screen.height,
|
|
19058
|
-
bodyHeight: (_b = document === null || document === void 0 ? void 0 : document.body) === null || _b === void 0 ? void 0 : _b.clientHeight,
|
|
19059
|
-
agent: navigator.userAgent,
|
|
19060
|
-
version: '1.19.17',
|
|
19061
|
-
safeArea: getHeightWithSafeArea(),
|
|
19062
|
-
dvh: dvhToPx(100),
|
|
19063
|
-
dvhInPx: getDvhInPx(),
|
|
19064
|
-
vhInPx: getVhInPx(),
|
|
19065
|
-
fillAvailableInPx: getFillAvailableInPx(),
|
|
19066
|
-
isScaled,
|
|
19067
|
-
isZoomed,
|
|
19068
|
-
meta: `${window === null || window === void 0 ? void 0 : window.Instagram},${window === null || window === void 0 ? void 0 : window.Facebook}`
|
|
19069
|
-
};
|
|
19070
|
-
console.log(systemInfo, 'fundebug-init--------------------->systemInfo');
|
|
19071
|
-
if ('fundebug' in window) {
|
|
19072
|
-
window === null || window === void 0 ? void 0 : window.fundebug.notify('Collect_Info', 'init', { metaData: { systemInfo, otherInfo: {} } });
|
|
19073
|
-
}
|
|
19074
|
-
const updateHeight = React.useCallback(() => {
|
|
19075
|
-
var _a, _b, _c;
|
|
19076
|
-
const fontSize = parseFloat(getComputedStyle(document.documentElement).fontSize);
|
|
19077
|
-
const isScaled = fontSize !== 52; // 默认 1rem = 16px
|
|
19078
|
-
const systemInfo = {
|
|
19079
|
-
visualViewport: (_a = window.visualViewport) === null || _a === void 0 ? void 0 : _a.height,
|
|
19080
|
-
innerHeight: window.innerHeight,
|
|
19081
|
-
clientHeight: document.documentElement.clientHeight,
|
|
19082
|
-
screenHeight: window.screen.height,
|
|
19083
|
-
bodyHeight: (_b = document === null || document === void 0 ? void 0 : document.body) === null || _b === void 0 ? void 0 : _b.clientHeight,
|
|
19084
|
-
agent: navigator.userAgent,
|
|
19085
|
-
version: '1.19.17',
|
|
19086
|
-
safeArea: getHeightWithSafeArea(),
|
|
19087
|
-
dvh: dvhToPx(100),
|
|
19088
|
-
dvhInPx: getDvhInPx(),
|
|
19089
|
-
vhInPx: getVhInPx(),
|
|
19090
|
-
fillAvailableInPx: getFillAvailableInPx(),
|
|
19091
|
-
isScaled,
|
|
19092
|
-
isZoomed,
|
|
19093
|
-
meta: `${window === null || window === void 0 ? void 0 : window.Instagram},${window === null || window === void 0 ? void 0 : window.Facebook}`
|
|
19094
|
-
};
|
|
19095
|
-
console.log(systemInfo, 'fundebug-resize--------------------->systemInfo');
|
|
19096
|
-
if ('fundebug' in window) {
|
|
19097
|
-
window === null || window === void 0 ? void 0 : window.fundebug.notify('Collect_Info', 'resize', { metaData: { systemInfo, otherInfo: {} } });
|
|
19098
|
-
}
|
|
19099
|
-
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);
|
|
19100
|
-
setVisibleHeight(height);
|
|
19101
|
-
}, [getHeightWithSafeArea, dvhToPx, getDvhInPx, getVhInPx, getFillAvailableInPx]);
|
|
19102
|
-
React.useEffect(() => {
|
|
19103
|
-
// 初始计算
|
|
19104
|
-
updateHeight();
|
|
19105
|
-
// 事件监听
|
|
19106
|
-
const events = ['resize', 'orientationchange', 'load', 'DOMContentLoaded'];
|
|
19107
|
-
events.forEach((event) => {
|
|
19108
|
-
window.addEventListener(event, updateHeight);
|
|
19109
|
-
});
|
|
19110
|
-
// visualViewport 监听(最重要)
|
|
19111
|
-
if (window.visualViewport) {
|
|
19112
|
-
window.visualViewport.addEventListener('resize', updateHeight);
|
|
19113
|
-
window.visualViewport.addEventListener('scroll', updateHeight);
|
|
19114
|
-
}
|
|
19115
|
-
// 键盘弹出/收起监听(移动端重要)
|
|
19116
|
-
if ('virtualKeyboard' in navigator) {
|
|
19117
|
-
navigator.virtualKeyboard.addEventListener('geometrychange', updateHeight);
|
|
19118
|
-
}
|
|
19119
|
-
// 定期检查(应对某些特殊情况)
|
|
19120
|
-
const interval = setInterval(updateHeight, 1000);
|
|
19121
|
-
return () => {
|
|
19122
|
-
events.forEach((event) => {
|
|
19123
|
-
window.removeEventListener(event, updateHeight);
|
|
19124
|
-
});
|
|
19125
|
-
if (window.visualViewport) {
|
|
19126
|
-
window.visualViewport.removeEventListener('resize', updateHeight);
|
|
19127
|
-
window.visualViewport.removeEventListener('scroll', updateHeight);
|
|
19128
|
-
}
|
|
19129
|
-
if ('virtualKeyboard' in navigator) {
|
|
19130
|
-
navigator.virtualKeyboard.removeEventListener('geometrychange', updateHeight);
|
|
19131
|
-
}
|
|
19132
|
-
clearInterval(interval);
|
|
19133
|
-
};
|
|
19134
|
-
}, [updateHeight]);
|
|
19135
|
-
return visibleHeight;
|
|
19136
|
-
};
|
|
19137
|
-
|
|
19138
19098
|
/*
|
|
19139
19099
|
* @Author: binruan@chatlabs.com
|
|
19140
19100
|
* @Date: 2024-03-20 10:27:31
|
|
@@ -19143,7 +19103,7 @@ Made in Italy` })));
|
|
|
19143
19103
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\index.tsx
|
|
19144
19104
|
*
|
|
19145
19105
|
*/
|
|
19146
|
-
const SxpPageRender = ({ globalConfig, descStyle, containerHeight
|
|
19106
|
+
const SxpPageRender = ({ globalConfig, descStyle, containerHeight, containerWidth = window.innerWidth, tempMap, resolver, data = [], ctaType, tipText, nudge, _schema, hashTagStyle, hashTagRightMargin, tagList = [], defaultData }) => {
|
|
19147
19107
|
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;
|
|
19148
19108
|
const mutedIcon = useIconLink('/pb_static/5beaaa5ce7f3477b99db3838619cc471.png');
|
|
19149
19109
|
const unmutedIcon = useIconLink('/pb_static/fea8668a8a894e4aa3a86bcc775e895e.png');
|
|
@@ -19163,7 +19123,7 @@ Made in Italy` })));
|
|
|
19163
19123
|
const fbcRef = React.useRef('');
|
|
19164
19124
|
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();
|
|
19165
19125
|
const { backMainFeed, productView, jumpToWeb } = useEventReport();
|
|
19166
|
-
const visibleHeight = useVisibleHeight();
|
|
19126
|
+
const { visibleHeight, bottomHeight } = useVisibleHeight();
|
|
19167
19127
|
const isShowFingerTip = React.useMemo(() => {
|
|
19168
19128
|
return data.length > 0 && !loading && (getFeUserState() || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableSwiperTip));
|
|
19169
19129
|
}, [data, loading, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableSwiperTip]);
|
|
@@ -19332,29 +19292,10 @@ Made in Italy` })));
|
|
|
19332
19292
|
}
|
|
19333
19293
|
return minusHeight;
|
|
19334
19294
|
}, [globalConfig]);
|
|
19335
|
-
const getHeightWithSafeArea = () => {
|
|
19336
|
-
const root = document.documentElement;
|
|
19337
|
-
const value = getComputedStyle(root).getPropertyValue('--safe-area-inset-bottom');
|
|
19338
|
-
// 处理可能的值(可能是 '0px', '34px' 等)
|
|
19339
|
-
const numericValue = parseInt(value) || 0;
|
|
19340
|
-
return numericValue;
|
|
19341
|
-
};
|
|
19342
|
-
const getDvhInPx = () => {
|
|
19343
|
-
const detector = document.createElement('div');
|
|
19344
|
-
detector.style.position = 'fixed';
|
|
19345
|
-
detector.style.bottom = `${getHeightWithSafeArea()}px`;
|
|
19346
|
-
detector.style.left = '0';
|
|
19347
|
-
detector.style.height = '100dvh';
|
|
19348
|
-
detector.style.visibility = 'hidden';
|
|
19349
|
-
detector.style.zIndex = '-1';
|
|
19350
|
-
document.body.appendChild(detector);
|
|
19351
|
-
const dvhInPx = detector.clientHeight;
|
|
19352
|
-
document.body.removeChild(detector);
|
|
19353
|
-
return dvhInPx;
|
|
19354
|
-
};
|
|
19355
19295
|
const height = React.useMemo(() => {
|
|
19356
|
-
|
|
19357
|
-
|
|
19296
|
+
const h = containerHeight || visibleHeight;
|
|
19297
|
+
return h - minusHeight - tagHeight;
|
|
19298
|
+
}, [containerHeight, visibleHeight, minusHeight, tagHeight]);
|
|
19358
19299
|
const visList = React.useMemo(() => {
|
|
19359
19300
|
var _a;
|
|
19360
19301
|
const list = activeIndex === 0 && !waterFallData && !isEditor && !isDiyH5
|
|
@@ -19396,7 +19337,7 @@ Made in Italy` })));
|
|
|
19396
19337
|
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)));
|
|
19397
19338
|
}
|
|
19398
19339
|
if ((_g = rec === null || rec === void 0 ? void 0 : rec.video) === null || _g === void 0 ? void 0 : _g.url) {
|
|
19399
|
-
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 })));
|
|
19340
|
+
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 })));
|
|
19400
19341
|
}
|
|
19401
19342
|
if ((_h = rec === null || rec === void 0 ? void 0 : rec.video) === null || _h === void 0 ? void 0 : _h.imgUrls) {
|
|
19402
19343
|
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 }));
|
|
@@ -19423,7 +19364,8 @@ Made in Italy` })));
|
|
|
19423
19364
|
tipText,
|
|
19424
19365
|
resolver,
|
|
19425
19366
|
schema,
|
|
19426
|
-
isReload
|
|
19367
|
+
isReload,
|
|
19368
|
+
visibleHeight
|
|
19427
19369
|
]);
|
|
19428
19370
|
const onExpandableChange = React.useCallback((v) => {
|
|
19429
19371
|
setIsShowMore(v);
|
|
@@ -19496,7 +19438,7 @@ Made in Italy` })));
|
|
|
19496
19438
|
top += minusHeight;
|
|
19497
19439
|
}
|
|
19498
19440
|
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconFixed) && (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconYPosit) !== 'top') {
|
|
19499
|
-
top +=
|
|
19441
|
+
top += bottomHeight;
|
|
19500
19442
|
}
|
|
19501
19443
|
if (rec === null || rec === void 0 ? void 0 : rec.video) {
|
|
19502
19444
|
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: {
|
|
@@ -19506,7 +19448,7 @@ Made in Italy` })));
|
|
|
19506
19448
|
}, position: index }));
|
|
19507
19449
|
}
|
|
19508
19450
|
return null;
|
|
19509
|
-
}, [globalConfig, waterFallData]);
|
|
19451
|
+
}, [globalConfig, waterFallData, bottomHeight]);
|
|
19510
19452
|
const handleViewImageStartEnd = (item) => {
|
|
19511
19453
|
var _a, _b, _c, _d, _e, _f;
|
|
19512
19454
|
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)) {
|
|
@@ -19733,7 +19675,7 @@ Made in Italy` })));
|
|
|
19733
19675
|
top += minusHeight;
|
|
19734
19676
|
}
|
|
19735
19677
|
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed) && (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconYPosit) !== 'top') {
|
|
19736
|
-
top +=
|
|
19678
|
+
top += bottomHeight;
|
|
19737
19679
|
}
|
|
19738
19680
|
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: {
|
|
19739
19681
|
position: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed) ? 'fixed' : 'absolute',
|
|
@@ -19743,7 +19685,7 @@ Made in Italy` })));
|
|
|
19743
19685
|
[(_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,
|
|
19744
19686
|
[(_f = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconYPosit) !== null && _f !== void 0 ? _f : 'bottom']: top
|
|
19745
19687
|
}, 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 })));
|
|
19746
|
-
}, [globalConfig, visList, activeIndex, isMuted, waterFallData]);
|
|
19688
|
+
}, [globalConfig, visList, activeIndex, isMuted, waterFallData, bottomHeight]);
|
|
19747
19689
|
const renderView = React.useMemo(() => {
|
|
19748
19690
|
if (loading) {
|
|
19749
19691
|
return (React.createElement("div", { style: { height, width: containerWidth, display: 'flex', justifyContent: 'center', alignItems: 'center' } },
|
|
@@ -19775,7 +19717,7 @@ Made in Italy` })));
|
|
|
19775
19717
|
isReload,
|
|
19776
19718
|
renderToggleButton
|
|
19777
19719
|
]);
|
|
19778
|
-
return (React.createElement("div", { id: 'sxp-render', className: 'clc-sxp-container' },
|
|
19720
|
+
return (React.createElement("div", { id: 'sxp-render', className: 'clc-sxp-container', style: { height } },
|
|
19779
19721
|
(data === null || data === void 0 ? void 0 : data.length) < 1 && loading ? (React.createElement("div", { style: { height, width: containerWidth, display: 'flex', justifyContent: 'center', alignItems: 'center' } },
|
|
19780
19722
|
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` })) },
|
|
19781
19723
|
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: () => {
|
|
@@ -19837,10 +19779,10 @@ Made in Italy` })));
|
|
|
19837
19779
|
renderToggleButton(!!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed))),
|
|
19838
19780
|
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)),
|
|
19839
19781
|
React.createElement(ConsentPopup, { resolver: resolver, globalConfig: globalConfig }),
|
|
19840
|
-
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: '
|
|
19782
|
+
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' } }))))),
|
|
19841
19783
|
(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableCookieSetting) && (React.createElement("div", { style: {
|
|
19842
19784
|
position: 'fixed',
|
|
19843
|
-
bottom: '
|
|
19785
|
+
bottom: bottomHeight + 'px',
|
|
19844
19786
|
left: 0,
|
|
19845
19787
|
right: 0,
|
|
19846
19788
|
width: '100%',
|