pb-sxp-ui 1.19.18 → 1.19.20
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 +150 -113
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +150 -113
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +13 -6
- package/dist/index.min.cjs.map +1 -1
- package/dist/index.min.js +13 -6
- package/dist/index.min.js.map +1 -1
- package/dist/pb-ui.js +150 -113
- package/dist/pb-ui.js.map +1 -1
- package/dist/pb-ui.min.js +13 -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 +14 -7
- package/es/core/hooks/useVisibleHeight.d.ts +4 -1
- package/es/core/hooks/useVisibleHeight.js +32 -4
- 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 +14 -7
- package/lib/core/hooks/useVisibleHeight.d.ts +4 -1
- package/lib/core/hooks/useVisibleHeight.js +32 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -10305,6 +10305,126 @@ const CommodityGroup = ({ products, data, defImg, style, onCLick, popupDetailDat
|
|
|
10305
10305
|
};
|
|
10306
10306
|
var CommodityGroup$1 = memo(CommodityGroup);
|
|
10307
10307
|
|
|
10308
|
+
function useVisibleHeight() {
|
|
10309
|
+
const [visibleHeight, setVisibleHeight] = useState(0);
|
|
10310
|
+
const [bottomHeight, setBottomHeight] = useState(0);
|
|
10311
|
+
const getVisibleContentHeight = () => {
|
|
10312
|
+
// 方法优先级:
|
|
10313
|
+
// 1. visualViewport.height (最准确)
|
|
10314
|
+
// 2. window.innerHeight (次之)
|
|
10315
|
+
// 3. document.documentElement.clientHeight (fallback)
|
|
10316
|
+
if (typeof window === 'undefined')
|
|
10317
|
+
return 0;
|
|
10318
|
+
let height = window.innerHeight;
|
|
10319
|
+
// 优先使用 visualViewport
|
|
10320
|
+
if (window.visualViewport) {
|
|
10321
|
+
height = window.visualViewport.height;
|
|
10322
|
+
}
|
|
10323
|
+
// 验证高度合理性
|
|
10324
|
+
if (height <= 0 || height > window.screen.height) {
|
|
10325
|
+
height = window.innerHeight;
|
|
10326
|
+
}
|
|
10327
|
+
// 最终 fallback
|
|
10328
|
+
if (height <= 0) {
|
|
10329
|
+
height = document.documentElement.clientHeight;
|
|
10330
|
+
}
|
|
10331
|
+
return height;
|
|
10332
|
+
};
|
|
10333
|
+
const updateHeight = useCallback(() => {
|
|
10334
|
+
var _a;
|
|
10335
|
+
const visibleHeight = getVisibleContentHeight();
|
|
10336
|
+
const screenHeight = (_a = window.screen) === null || _a === void 0 ? void 0 : _a.height;
|
|
10337
|
+
const ua = navigator.userAgent;
|
|
10338
|
+
// Instagram 检测
|
|
10339
|
+
const isInstagram = /Instagram/i.test(ua);
|
|
10340
|
+
// Facebook 检测
|
|
10341
|
+
const isFacebook = /FBAV|FBAN|FBSN/i.test(ua);
|
|
10342
|
+
// 安全检查
|
|
10343
|
+
if (!screenHeight || visibleHeight <= 0 || (!isInstagram && !isFacebook)) {
|
|
10344
|
+
setVisibleHeight(visibleHeight);
|
|
10345
|
+
return;
|
|
10346
|
+
}
|
|
10347
|
+
const ratio = visibleHeight / screenHeight;
|
|
10348
|
+
const threshold = 0.9;
|
|
10349
|
+
const h = screenHeight >= 900 ? screenHeight * 0.8 : screenHeight * 0.79;
|
|
10350
|
+
// 当内容高度占屏幕高度90%以上时,使用按比例计算的高度
|
|
10351
|
+
// 否则使用实际内容高度
|
|
10352
|
+
const isRatio = ratio >= threshold;
|
|
10353
|
+
const finalHeight = isRatio ? Math.round(h) : visibleHeight;
|
|
10354
|
+
const b = screenHeight - Math.round(h);
|
|
10355
|
+
if (isRatio) {
|
|
10356
|
+
const banner = document.querySelector('#onetrust-banner-sdk');
|
|
10357
|
+
if (banner) {
|
|
10358
|
+
banner.style.bottom = `${b}px`;
|
|
10359
|
+
}
|
|
10360
|
+
const styleElement = document.createElement('style');
|
|
10361
|
+
styleElement.id = 'onetrust-pc-sdk';
|
|
10362
|
+
styleElement.setAttribute('type', 'text/css');
|
|
10363
|
+
document.head.appendChild(styleElement);
|
|
10364
|
+
const css = `
|
|
10365
|
+
#onetrust-pc-sdk {
|
|
10366
|
+
height: ${finalHeight}px !important;
|
|
10367
|
+
}
|
|
10368
|
+
#onetrust-pc-sdk #ot-pc-content{
|
|
10369
|
+
bottom: ${b}px !important;
|
|
10370
|
+
}
|
|
10371
|
+
`;
|
|
10372
|
+
styleElement.textContent = css;
|
|
10373
|
+
}
|
|
10374
|
+
if (isRatio) {
|
|
10375
|
+
setBottomHeight(b);
|
|
10376
|
+
}
|
|
10377
|
+
else {
|
|
10378
|
+
setBottomHeight(0);
|
|
10379
|
+
}
|
|
10380
|
+
if ('fundebug' in window) {
|
|
10381
|
+
const systemInfo = {
|
|
10382
|
+
ratio,
|
|
10383
|
+
h,
|
|
10384
|
+
finalHeight,
|
|
10385
|
+
visibleHeight,
|
|
10386
|
+
screenHeight,
|
|
10387
|
+
isInstagram,
|
|
10388
|
+
isFacebook,
|
|
10389
|
+
ua
|
|
10390
|
+
};
|
|
10391
|
+
window === null || window === void 0 ? void 0 : window.fundebug.notify('Collect_Info', 'resize', { metaData: { systemInfo, otherInfo: {} } });
|
|
10392
|
+
}
|
|
10393
|
+
setVisibleHeight(finalHeight);
|
|
10394
|
+
}, [getVisibleContentHeight]);
|
|
10395
|
+
useEffect(() => {
|
|
10396
|
+
// 初始计算
|
|
10397
|
+
updateHeight();
|
|
10398
|
+
// 事件监听
|
|
10399
|
+
const events = ['resize', 'orientationchange', 'load', 'DOMContentLoaded'];
|
|
10400
|
+
events.forEach((event) => {
|
|
10401
|
+
window.addEventListener(event, updateHeight);
|
|
10402
|
+
});
|
|
10403
|
+
// visualViewport 监听(最重要)
|
|
10404
|
+
if (window.visualViewport) {
|
|
10405
|
+
window.visualViewport.addEventListener('resize', updateHeight);
|
|
10406
|
+
window.visualViewport.addEventListener('scroll', updateHeight);
|
|
10407
|
+
}
|
|
10408
|
+
// 键盘弹出/收起监听(移动端重要)
|
|
10409
|
+
if ('virtualKeyboard' in navigator) {
|
|
10410
|
+
navigator.virtualKeyboard.addEventListener('geometrychange', updateHeight);
|
|
10411
|
+
}
|
|
10412
|
+
return () => {
|
|
10413
|
+
events.forEach((event) => {
|
|
10414
|
+
window.removeEventListener(event, updateHeight);
|
|
10415
|
+
});
|
|
10416
|
+
if (window.visualViewport) {
|
|
10417
|
+
window.visualViewport.removeEventListener('resize', updateHeight);
|
|
10418
|
+
window.visualViewport.removeEventListener('scroll', updateHeight);
|
|
10419
|
+
}
|
|
10420
|
+
if ('virtualKeyboard' in navigator) {
|
|
10421
|
+
navigator.virtualKeyboard.removeEventListener('geometrychange', updateHeight);
|
|
10422
|
+
}
|
|
10423
|
+
};
|
|
10424
|
+
}, [updateHeight]);
|
|
10425
|
+
return { visibleHeight, bottomHeight };
|
|
10426
|
+
}
|
|
10427
|
+
|
|
10308
10428
|
/*
|
|
10309
10429
|
* @Author: binruan@chatlabs.com
|
|
10310
10430
|
* @Date: 2023-11-02 18:34:34
|
|
@@ -10314,15 +10434,17 @@ var CommodityGroup$1 = memo(CommodityGroup);
|
|
|
10314
10434
|
*
|
|
10315
10435
|
*/
|
|
10316
10436
|
const closeIcon$1 = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAjhJREFUWEfFlztOw0AQhmeWiJ4CCmpQ5DiRQsIJyAWg5A0lR0AIChDiCJS8ER0cADgBeRSxt4CCDgkaKiq8i+zYeWx2413HEWmiJJv9v535Z2aN8M8vFPT9z3zETD0aAUChUJjwvPFHAJhBhB3Hqd6OAsK2yyucwykAvP38eJX398Z3AJDLlVYR8ToU9Rhj25TWr9KEsKy5dULIGQCMtfZly45TvwsAstm56UwG6wA4FUFwzrdctxZBDcWSy5XWEPG8I84/GcMipdWPtgcsaz5PCHtKG0IuTiqUvjT9U/WYMG2IOPE+AP+LtCB0xKUAAyA2Xbd2o2OG0NQXvTnvhL17D7EPtH9TRCIWwkRcGYGIQgYBABuqPuHXOQBc6pw80lBGwBQiiXhsBHQhkoprA6iM6acjhDQKu5YJZW6XeOI3XJdpvfsdTu52VfXEekD8owQiXGIubpSCbhDbLu8DwKEAd+A41SOdPpE4BS0viFOtvV2iKWqUgn5x/tmS70xR01GuDSCKc86/OCcLgTyyZ0ScDGNhFAktAJV4NFJ9YyaFiAWIE+9uVkkgBgLoig8DMWAa9ro9ynkUdlW5maZDCmB6clmz0k1HH4Cs1Ezbq2p2yEpUuBOKTSZZex00RUWIrltxuuK6EOGDSbGIOPZicpMx6fny650377qNRgBgWeVFQuA+6UjVgREhGIMlSqsPUQqIbZdOOIdZQmCv2axRnU1N1+TzJYsxOEaEV8ep7frPZ7Gd0FTEdP0ft0/kMNdg0eoAAAAASUVORK5CYII=';
|
|
10317
|
-
const Modal = ({ visible, onClose, children, modalStyle, padding, popup, schema, fullHeight
|
|
10437
|
+
const Modal = ({ visible, onClose, children, modalStyle, padding, popup, schema, fullHeight, isFullScreen = false, openState }) => {
|
|
10318
10438
|
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;
|
|
10439
|
+
const { visibleHeight, bottomHeight } = useVisibleHeight();
|
|
10319
10440
|
const touchRef = useRef(null);
|
|
10320
10441
|
const fTouchRef = useRef(null);
|
|
10321
10442
|
const touchMoveRef = useRef(null);
|
|
10322
10443
|
const ref = useRef(null);
|
|
10323
10444
|
const modalRef = useRef(null);
|
|
10324
|
-
const
|
|
10325
|
-
const
|
|
10445
|
+
const modalHeight = fullHeight || visibleHeight;
|
|
10446
|
+
const MODAL_DEF_TRANS = modalHeight * 0.2;
|
|
10447
|
+
const MODAL_DEF_CON_H = isFullScreen ? modalHeight : modalHeight * 0.8;
|
|
10326
10448
|
const [modalTrans, setModalTrans] = useState(MODAL_DEF_TRANS);
|
|
10327
10449
|
const [isShow, setIsShow] = useState(false);
|
|
10328
10450
|
const modalEleRef = useRef(null);
|
|
@@ -10370,17 +10492,17 @@ const Modal = ({ visible, onClose, children, modalStyle, padding, popup, schema,
|
|
|
10370
10492
|
}, [_popup, openState, globalConfig, schema]);
|
|
10371
10493
|
useEffect(() => {
|
|
10372
10494
|
const trapFocus = (element) => {
|
|
10373
|
-
|
|
10374
|
-
|
|
10375
|
-
|
|
10376
|
-
|
|
10495
|
+
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])');
|
|
10496
|
+
const firstFocusableEl = focusableEls === null || focusableEls === void 0 ? void 0 : focusableEls[0];
|
|
10497
|
+
const lastFocusableEl = focusableEls === null || focusableEls === void 0 ? void 0 : focusableEls[(focusableEls === null || focusableEls === void 0 ? void 0 : focusableEls.length) - 1];
|
|
10498
|
+
const KEYCODE_TAB = 9;
|
|
10377
10499
|
element.addEventListener('keydown', function (e) {
|
|
10378
10500
|
if (e.key === 'Escape' || e.key === 'Esc') {
|
|
10379
10501
|
// 在这里执行按下 Esc 键时的操作
|
|
10380
10502
|
handleClose();
|
|
10381
10503
|
e.preventDefault();
|
|
10382
10504
|
}
|
|
10383
|
-
|
|
10505
|
+
const isTabPressed = e.key === 'Tab' || e.keyCode === KEYCODE_TAB;
|
|
10384
10506
|
if (!isTabPressed) {
|
|
10385
10507
|
return;
|
|
10386
10508
|
}
|
|
@@ -10462,12 +10584,12 @@ const Modal = ({ visible, onClose, children, modalStyle, padding, popup, schema,
|
|
|
10462
10584
|
}
|
|
10463
10585
|
touchMoveRef.current = false;
|
|
10464
10586
|
};
|
|
10465
|
-
return ReactDOM.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 },
|
|
10587
|
+
return ReactDOM.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 },
|
|
10466
10588
|
React.createElement("div", { style: {
|
|
10467
10589
|
position: 'relative',
|
|
10468
10590
|
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`,
|
|
10469
10591
|
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`,
|
|
10470
|
-
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`,
|
|
10592
|
+
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`,
|
|
10471
10593
|
overflow: 'hidden',
|
|
10472
10594
|
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)`,
|
|
10473
10595
|
height: '100%'
|
|
@@ -10483,7 +10605,7 @@ const Modal = ({ visible, onClose, children, modalStyle, padding, popup, schema,
|
|
|
10483
10605
|
onTouchEnd: handleTouchEnd
|
|
10484
10606
|
})),
|
|
10485
10607
|
React.createElement("div", Object.assign({ id: 'modal-content', ref: ref, style: {
|
|
10486
|
-
height: isScrollFullScreen ?
|
|
10608
|
+
height: isScrollFullScreen ? modalHeight : MODAL_DEF_CON_H,
|
|
10487
10609
|
overflow: (isScrollFullScreen && modalTrans <= 0) || !isScrollFullScreen ? 'auto' : 'hidden',
|
|
10488
10610
|
zIndex: 1
|
|
10489
10611
|
} }, (((_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) && {
|
|
@@ -18118,7 +18240,7 @@ const mountVideoPlayerAtNode = (() => {
|
|
|
18118
18240
|
};
|
|
18119
18241
|
})();
|
|
18120
18242
|
|
|
18121
|
-
const VideoWidget$4 = forwardRef(({ rec, index, height, data, muted, activeIndex, videoPostConfig, videoPlayIcon, loopPlay, swiperRef }, ref) => {
|
|
18243
|
+
const VideoWidget$4 = forwardRef(({ rec, index, height, data, muted, activeIndex, videoPostConfig, videoPlayIcon, loopPlay, swiperRef, visibleHeight }, ref) => {
|
|
18122
18244
|
var _a, _b;
|
|
18123
18245
|
const [isPauseVideo, setIsPauseVideo] = useState(false);
|
|
18124
18246
|
const { bffEventReport, sxpParameter, waterFallData, openHashtag, bffFbReport, isDiyH5 } = useSxpDataSource();
|
|
@@ -18226,7 +18348,7 @@ const VideoWidget$4 = forwardRef(({ rec, index, height, data, muted, activeIndex
|
|
|
18226
18348
|
const canvas = canvasRef === null || canvasRef === void 0 ? void 0 : canvasRef.current;
|
|
18227
18349
|
const ctx = canvas.getContext('2d');
|
|
18228
18350
|
const targetWidth = window === null || window === void 0 ? void 0 : window.innerWidth;
|
|
18229
|
-
const targetHeight = window === null || window === void 0 ? void 0 : window.innerHeight;
|
|
18351
|
+
const targetHeight = visibleHeight || (window === null || window === void 0 ? void 0 : window.innerHeight);
|
|
18230
18352
|
canvas.height = targetHeight;
|
|
18231
18353
|
canvas.width = targetWidth;
|
|
18232
18354
|
ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(videoRef.current, 0, 0, canvas.width, canvas.height);
|
|
@@ -18236,7 +18358,7 @@ const VideoWidget$4 = forwardRef(({ rec, index, height, data, muted, activeIndex
|
|
|
18236
18358
|
setTimeout(() => {
|
|
18237
18359
|
setFrameImg();
|
|
18238
18360
|
}, 500);
|
|
18239
|
-
}, [videoRef.current, isBgColor, rec, firstFrameSrc, blur]);
|
|
18361
|
+
}, [videoRef.current, isBgColor, rec, firstFrameSrc, blur, visibleHeight]);
|
|
18240
18362
|
const handleLoadedmetadata = useCallback(() => {
|
|
18241
18363
|
if (!videoRef.current)
|
|
18242
18364
|
return;
|
|
@@ -18978,98 +19100,6 @@ const NavBack = ({ data, minusHeight, tagHeight, onClick }) => {
|
|
|
18978
19100
|
};
|
|
18979
19101
|
var NavBack$1 = memo(NavBack);
|
|
18980
19102
|
|
|
18981
|
-
const useVisibleHeight = () => {
|
|
18982
|
-
const [visibleHeight, setVisibleHeight] = useState(0);
|
|
18983
|
-
const getVisibleContentHeight = () => {
|
|
18984
|
-
// 方法优先级:
|
|
18985
|
-
// 1. visualViewport.height (最准确)
|
|
18986
|
-
// 2. window.innerHeight (次之)
|
|
18987
|
-
// 3. document.documentElement.clientHeight (fallback)
|
|
18988
|
-
if (typeof window === 'undefined')
|
|
18989
|
-
return 0;
|
|
18990
|
-
let height = window.innerHeight;
|
|
18991
|
-
// 优先使用 visualViewport
|
|
18992
|
-
if (window.visualViewport) {
|
|
18993
|
-
height = window.visualViewport.height;
|
|
18994
|
-
}
|
|
18995
|
-
// 验证高度合理性
|
|
18996
|
-
if (height <= 0 || height > window.screen.height) {
|
|
18997
|
-
height = window.innerHeight;
|
|
18998
|
-
}
|
|
18999
|
-
// 最终 fallback
|
|
19000
|
-
if (height <= 0) {
|
|
19001
|
-
height = document.documentElement.clientHeight;
|
|
19002
|
-
}
|
|
19003
|
-
return height;
|
|
19004
|
-
};
|
|
19005
|
-
const updateHeight = useCallback(() => {
|
|
19006
|
-
var _a;
|
|
19007
|
-
const visibleHeight = getVisibleContentHeight();
|
|
19008
|
-
const screenHeight = (_a = window.screen) === null || _a === void 0 ? void 0 : _a.height;
|
|
19009
|
-
const ua = navigator.userAgent;
|
|
19010
|
-
// Instagram 检测
|
|
19011
|
-
const isInstagram = /Instagram/i.test(ua);
|
|
19012
|
-
// Facebook 检测
|
|
19013
|
-
const isFacebook = /FBAV|FBAN|FBSN/i.test(ua);
|
|
19014
|
-
// 安全检查
|
|
19015
|
-
if (!screenHeight || visibleHeight <= 0 || (!isInstagram && !isFacebook)) {
|
|
19016
|
-
setVisibleHeight(visibleHeight);
|
|
19017
|
-
return;
|
|
19018
|
-
}
|
|
19019
|
-
const ratio = visibleHeight / screenHeight;
|
|
19020
|
-
const threshold = 0.9;
|
|
19021
|
-
const h = screenHeight >= 900 ? screenHeight * 0.8 : screenHeight * 0.79;
|
|
19022
|
-
// 当内容高度占屏幕高度90%以上时,使用按比例计算的高度
|
|
19023
|
-
// 否则使用实际内容高度
|
|
19024
|
-
const finalHeight = Math.round(ratio >= threshold ? h : visibleHeight);
|
|
19025
|
-
if ('fundebug' in window) {
|
|
19026
|
-
const systemInfo = {
|
|
19027
|
-
ratio,
|
|
19028
|
-
h,
|
|
19029
|
-
finalHeight,
|
|
19030
|
-
visibleHeight,
|
|
19031
|
-
screenHeight,
|
|
19032
|
-
isInstagram,
|
|
19033
|
-
isFacebook,
|
|
19034
|
-
ua
|
|
19035
|
-
};
|
|
19036
|
-
window === null || window === void 0 ? void 0 : window.fundebug.notify('Collect_Info', 'resize', { metaData: { systemInfo, otherInfo: {} } });
|
|
19037
|
-
}
|
|
19038
|
-
setVisibleHeight(finalHeight);
|
|
19039
|
-
}, [getVisibleContentHeight]);
|
|
19040
|
-
useEffect(() => {
|
|
19041
|
-
// 初始计算
|
|
19042
|
-
updateHeight();
|
|
19043
|
-
// 事件监听
|
|
19044
|
-
const events = ['resize', 'orientationchange', 'load', 'DOMContentLoaded'];
|
|
19045
|
-
events.forEach((event) => {
|
|
19046
|
-
window.addEventListener(event, updateHeight);
|
|
19047
|
-
});
|
|
19048
|
-
// visualViewport 监听(最重要)
|
|
19049
|
-
if (window.visualViewport) {
|
|
19050
|
-
window.visualViewport.addEventListener('resize', updateHeight);
|
|
19051
|
-
window.visualViewport.addEventListener('scroll', updateHeight);
|
|
19052
|
-
}
|
|
19053
|
-
// 键盘弹出/收起监听(移动端重要)
|
|
19054
|
-
if ('virtualKeyboard' in navigator) {
|
|
19055
|
-
navigator.virtualKeyboard.addEventListener('geometrychange', updateHeight);
|
|
19056
|
-
}
|
|
19057
|
-
return () => {
|
|
19058
|
-
events.forEach((event) => {
|
|
19059
|
-
window.removeEventListener(event, updateHeight);
|
|
19060
|
-
});
|
|
19061
|
-
if (window.visualViewport) {
|
|
19062
|
-
window.visualViewport.removeEventListener('resize', updateHeight);
|
|
19063
|
-
window.visualViewport.removeEventListener('scroll', updateHeight);
|
|
19064
|
-
}
|
|
19065
|
-
if ('virtualKeyboard' in navigator) {
|
|
19066
|
-
navigator.virtualKeyboard.removeEventListener('geometrychange', updateHeight);
|
|
19067
|
-
}
|
|
19068
|
-
};
|
|
19069
|
-
}, [updateHeight]);
|
|
19070
|
-
return visibleHeight;
|
|
19071
|
-
};
|
|
19072
|
-
|
|
19073
19103
|
/*
|
|
19074
19104
|
* @Author: binruan@chatlabs.com
|
|
19075
19105
|
* @Date: 2024-03-20 10:27:31
|
|
@@ -19098,7 +19128,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight, containerWidt
|
|
|
19098
19128
|
const fbcRef = useRef('');
|
|
19099
19129
|
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();
|
|
19100
19130
|
const { backMainFeed, productView, jumpToWeb } = useEventReport();
|
|
19101
|
-
const visibleHeight = useVisibleHeight();
|
|
19131
|
+
const { visibleHeight, bottomHeight } = useVisibleHeight();
|
|
19102
19132
|
const isShowFingerTip = useMemo(() => {
|
|
19103
19133
|
return data.length > 0 && !loading && (getFeUserState() || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableSwiperTip));
|
|
19104
19134
|
}, [data, loading, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableSwiperTip]);
|
|
@@ -19312,7 +19342,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight, containerWidt
|
|
|
19312
19342
|
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)));
|
|
19313
19343
|
}
|
|
19314
19344
|
if ((_g = rec === null || rec === void 0 ? void 0 : rec.video) === null || _g === void 0 ? void 0 : _g.url) {
|
|
19315
|
-
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 })));
|
|
19345
|
+
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 })));
|
|
19316
19346
|
}
|
|
19317
19347
|
if ((_h = rec === null || rec === void 0 ? void 0 : rec.video) === null || _h === void 0 ? void 0 : _h.imgUrls) {
|
|
19318
19348
|
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 }));
|
|
@@ -19339,7 +19369,8 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight, containerWidt
|
|
|
19339
19369
|
tipText,
|
|
19340
19370
|
resolver,
|
|
19341
19371
|
schema,
|
|
19342
|
-
isReload
|
|
19372
|
+
isReload,
|
|
19373
|
+
visibleHeight
|
|
19343
19374
|
]);
|
|
19344
19375
|
const onExpandableChange = useCallback((v) => {
|
|
19345
19376
|
setIsShowMore(v);
|
|
@@ -19411,6 +19442,9 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight, containerWidt
|
|
|
19411
19442
|
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconYPosit) === 'top') {
|
|
19412
19443
|
top += minusHeight;
|
|
19413
19444
|
}
|
|
19445
|
+
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconFixed) && (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconYPosit) !== 'top') {
|
|
19446
|
+
top += bottomHeight;
|
|
19447
|
+
}
|
|
19414
19448
|
if (rec === null || rec === void 0 ? void 0 : rec.video) {
|
|
19415
19449
|
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: {
|
|
19416
19450
|
position: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconFixed) ? 'fixed' : 'absolute',
|
|
@@ -19419,7 +19453,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight, containerWidt
|
|
|
19419
19453
|
}, position: index }));
|
|
19420
19454
|
}
|
|
19421
19455
|
return null;
|
|
19422
|
-
}, [globalConfig, waterFallData]);
|
|
19456
|
+
}, [globalConfig, waterFallData, bottomHeight]);
|
|
19423
19457
|
const handleViewImageStartEnd = (item) => {
|
|
19424
19458
|
var _a, _b, _c, _d, _e, _f;
|
|
19425
19459
|
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)) {
|
|
@@ -19645,6 +19679,9 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight, containerWidt
|
|
|
19645
19679
|
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconYPosit) === 'top') {
|
|
19646
19680
|
top += minusHeight;
|
|
19647
19681
|
}
|
|
19682
|
+
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed) && (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconYPosit) !== 'top') {
|
|
19683
|
+
top += bottomHeight;
|
|
19684
|
+
}
|
|
19648
19685
|
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: {
|
|
19649
19686
|
position: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed) ? 'fixed' : 'absolute',
|
|
19650
19687
|
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',
|
|
@@ -19653,7 +19690,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight, containerWidt
|
|
|
19653
19690
|
[(_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,
|
|
19654
19691
|
[(_f = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconYPosit) !== null && _f !== void 0 ? _f : 'bottom']: top
|
|
19655
19692
|
}, 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 })));
|
|
19656
|
-
}, [globalConfig, visList, activeIndex, isMuted, waterFallData]);
|
|
19693
|
+
}, [globalConfig, visList, activeIndex, isMuted, waterFallData, bottomHeight]);
|
|
19657
19694
|
const renderView = useMemo(() => {
|
|
19658
19695
|
if (loading) {
|
|
19659
19696
|
return (React.createElement("div", { style: { height, width: containerWidth, display: 'flex', justifyContent: 'center', alignItems: 'center' } },
|
|
@@ -19747,10 +19784,10 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight, containerWidt
|
|
|
19747
19784
|
renderToggleButton(!!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed))),
|
|
19748
19785
|
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)),
|
|
19749
19786
|
React.createElement(ConsentPopup, { resolver: resolver, globalConfig: globalConfig }),
|
|
19750
|
-
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 } }))))),
|
|
19787
|
+
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' } }))))),
|
|
19751
19788
|
(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableCookieSetting) && (React.createElement("div", { style: {
|
|
19752
19789
|
position: 'fixed',
|
|
19753
|
-
bottom:
|
|
19790
|
+
bottom: bottomHeight + 'px',
|
|
19754
19791
|
left: 0,
|
|
19755
19792
|
right: 0,
|
|
19756
19793
|
width: '100%',
|