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.cjs
CHANGED
|
@@ -10327,6 +10327,126 @@ 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;
|
|
10375
|
+
const finalHeight = isRatio ? Math.round(h) : visibleHeight;
|
|
10376
|
+
const b = screenHeight - Math.round(h);
|
|
10377
|
+
if (isRatio) {
|
|
10378
|
+
const banner = document.querySelector('#onetrust-banner-sdk');
|
|
10379
|
+
if (banner) {
|
|
10380
|
+
banner.style.bottom = `${b}px`;
|
|
10381
|
+
}
|
|
10382
|
+
const styleElement = document.createElement('style');
|
|
10383
|
+
styleElement.id = 'onetrust-pc-sdk';
|
|
10384
|
+
styleElement.setAttribute('type', 'text/css');
|
|
10385
|
+
document.head.appendChild(styleElement);
|
|
10386
|
+
const css = `
|
|
10387
|
+
#onetrust-pc-sdk {
|
|
10388
|
+
height: ${finalHeight}px !important;
|
|
10389
|
+
}
|
|
10390
|
+
#onetrust-pc-sdk #ot-pc-content{
|
|
10391
|
+
bottom: ${b}px !important;
|
|
10392
|
+
}
|
|
10393
|
+
`;
|
|
10394
|
+
styleElement.textContent = css;
|
|
10395
|
+
}
|
|
10396
|
+
if (isRatio) {
|
|
10397
|
+
setBottomHeight(b);
|
|
10398
|
+
}
|
|
10399
|
+
else {
|
|
10400
|
+
setBottomHeight(0);
|
|
10401
|
+
}
|
|
10402
|
+
if ('fundebug' in window) {
|
|
10403
|
+
const systemInfo = {
|
|
10404
|
+
ratio,
|
|
10405
|
+
h,
|
|
10406
|
+
finalHeight,
|
|
10407
|
+
visibleHeight,
|
|
10408
|
+
screenHeight,
|
|
10409
|
+
isInstagram,
|
|
10410
|
+
isFacebook,
|
|
10411
|
+
ua
|
|
10412
|
+
};
|
|
10413
|
+
window === null || window === void 0 ? void 0 : window.fundebug.notify('Collect_Info', 'resize', { metaData: { systemInfo, otherInfo: {} } });
|
|
10414
|
+
}
|
|
10415
|
+
setVisibleHeight(finalHeight);
|
|
10416
|
+
}, [getVisibleContentHeight]);
|
|
10417
|
+
React.useEffect(() => {
|
|
10418
|
+
// 初始计算
|
|
10419
|
+
updateHeight();
|
|
10420
|
+
// 事件监听
|
|
10421
|
+
const events = ['resize', 'orientationchange', 'load', 'DOMContentLoaded'];
|
|
10422
|
+
events.forEach((event) => {
|
|
10423
|
+
window.addEventListener(event, updateHeight);
|
|
10424
|
+
});
|
|
10425
|
+
// visualViewport 监听(最重要)
|
|
10426
|
+
if (window.visualViewport) {
|
|
10427
|
+
window.visualViewport.addEventListener('resize', updateHeight);
|
|
10428
|
+
window.visualViewport.addEventListener('scroll', updateHeight);
|
|
10429
|
+
}
|
|
10430
|
+
// 键盘弹出/收起监听(移动端重要)
|
|
10431
|
+
if ('virtualKeyboard' in navigator) {
|
|
10432
|
+
navigator.virtualKeyboard.addEventListener('geometrychange', updateHeight);
|
|
10433
|
+
}
|
|
10434
|
+
return () => {
|
|
10435
|
+
events.forEach((event) => {
|
|
10436
|
+
window.removeEventListener(event, updateHeight);
|
|
10437
|
+
});
|
|
10438
|
+
if (window.visualViewport) {
|
|
10439
|
+
window.visualViewport.removeEventListener('resize', updateHeight);
|
|
10440
|
+
window.visualViewport.removeEventListener('scroll', updateHeight);
|
|
10441
|
+
}
|
|
10442
|
+
if ('virtualKeyboard' in navigator) {
|
|
10443
|
+
navigator.virtualKeyboard.removeEventListener('geometrychange', updateHeight);
|
|
10444
|
+
}
|
|
10445
|
+
};
|
|
10446
|
+
}, [updateHeight]);
|
|
10447
|
+
return { visibleHeight, bottomHeight };
|
|
10448
|
+
}
|
|
10449
|
+
|
|
10330
10450
|
/*
|
|
10331
10451
|
* @Author: binruan@chatlabs.com
|
|
10332
10452
|
* @Date: 2023-11-02 18:34:34
|
|
@@ -10336,15 +10456,17 @@ var CommodityGroup$1 = React.memo(CommodityGroup);
|
|
|
10336
10456
|
*
|
|
10337
10457
|
*/
|
|
10338
10458
|
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
|
|
10459
|
+
const Modal = ({ visible, onClose, children, modalStyle, padding, popup, schema, fullHeight, isFullScreen = false, openState }) => {
|
|
10340
10460
|
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;
|
|
10461
|
+
const { visibleHeight, bottomHeight } = useVisibleHeight();
|
|
10341
10462
|
const touchRef = React.useRef(null);
|
|
10342
10463
|
const fTouchRef = React.useRef(null);
|
|
10343
10464
|
const touchMoveRef = React.useRef(null);
|
|
10344
10465
|
const ref = React.useRef(null);
|
|
10345
10466
|
const modalRef = React.useRef(null);
|
|
10346
|
-
const
|
|
10347
|
-
const
|
|
10467
|
+
const modalHeight = fullHeight || visibleHeight;
|
|
10468
|
+
const MODAL_DEF_TRANS = modalHeight * 0.2;
|
|
10469
|
+
const MODAL_DEF_CON_H = isFullScreen ? modalHeight : modalHeight * 0.8;
|
|
10348
10470
|
const [modalTrans, setModalTrans] = React.useState(MODAL_DEF_TRANS);
|
|
10349
10471
|
const [isShow, setIsShow] = React.useState(false);
|
|
10350
10472
|
const modalEleRef = React.useRef(null);
|
|
@@ -10392,17 +10514,17 @@ const Modal = ({ visible, onClose, children, modalStyle, padding, popup, schema,
|
|
|
10392
10514
|
}, [_popup, openState, globalConfig, schema]);
|
|
10393
10515
|
React.useEffect(() => {
|
|
10394
10516
|
const trapFocus = (element) => {
|
|
10395
|
-
|
|
10396
|
-
|
|
10397
|
-
|
|
10398
|
-
|
|
10517
|
+
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])');
|
|
10518
|
+
const firstFocusableEl = focusableEls === null || focusableEls === void 0 ? void 0 : focusableEls[0];
|
|
10519
|
+
const lastFocusableEl = focusableEls === null || focusableEls === void 0 ? void 0 : focusableEls[(focusableEls === null || focusableEls === void 0 ? void 0 : focusableEls.length) - 1];
|
|
10520
|
+
const KEYCODE_TAB = 9;
|
|
10399
10521
|
element.addEventListener('keydown', function (e) {
|
|
10400
10522
|
if (e.key === 'Escape' || e.key === 'Esc') {
|
|
10401
10523
|
// 在这里执行按下 Esc 键时的操作
|
|
10402
10524
|
handleClose();
|
|
10403
10525
|
e.preventDefault();
|
|
10404
10526
|
}
|
|
10405
|
-
|
|
10527
|
+
const isTabPressed = e.key === 'Tab' || e.keyCode === KEYCODE_TAB;
|
|
10406
10528
|
if (!isTabPressed) {
|
|
10407
10529
|
return;
|
|
10408
10530
|
}
|
|
@@ -10484,12 +10606,12 @@ const Modal = ({ visible, onClose, children, modalStyle, padding, popup, schema,
|
|
|
10484
10606
|
}
|
|
10485
10607
|
touchMoveRef.current = false;
|
|
10486
10608
|
};
|
|
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 },
|
|
10609
|
+
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
10610
|
React.createElement("div", { style: {
|
|
10489
10611
|
position: 'relative',
|
|
10490
10612
|
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
10613
|
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`,
|
|
10614
|
+
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
10615
|
overflow: 'hidden',
|
|
10494
10616
|
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
10617
|
height: '100%'
|
|
@@ -10505,7 +10627,7 @@ const Modal = ({ visible, onClose, children, modalStyle, padding, popup, schema,
|
|
|
10505
10627
|
onTouchEnd: handleTouchEnd
|
|
10506
10628
|
})),
|
|
10507
10629
|
React.createElement("div", Object.assign({ id: 'modal-content', ref: ref, style: {
|
|
10508
|
-
height: isScrollFullScreen ?
|
|
10630
|
+
height: isScrollFullScreen ? modalHeight : MODAL_DEF_CON_H,
|
|
10509
10631
|
overflow: (isScrollFullScreen && modalTrans <= 0) || !isScrollFullScreen ? 'auto' : 'hidden',
|
|
10510
10632
|
zIndex: 1
|
|
10511
10633
|
} }, (((_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 +18262,7 @@ const mountVideoPlayerAtNode = (() => {
|
|
|
18140
18262
|
};
|
|
18141
18263
|
})();
|
|
18142
18264
|
|
|
18143
|
-
const VideoWidget$4 = React.forwardRef(({ rec, index, height, data, muted, activeIndex, videoPostConfig, videoPlayIcon, loopPlay, swiperRef }, ref) => {
|
|
18265
|
+
const VideoWidget$4 = React.forwardRef(({ rec, index, height, data, muted, activeIndex, videoPostConfig, videoPlayIcon, loopPlay, swiperRef, visibleHeight }, ref) => {
|
|
18144
18266
|
var _a, _b;
|
|
18145
18267
|
const [isPauseVideo, setIsPauseVideo] = React.useState(false);
|
|
18146
18268
|
const { bffEventReport, sxpParameter, waterFallData, openHashtag, bffFbReport, isDiyH5 } = useSxpDataSource();
|
|
@@ -18248,7 +18370,7 @@ const VideoWidget$4 = React.forwardRef(({ rec, index, height, data, muted, activ
|
|
|
18248
18370
|
const canvas = canvasRef === null || canvasRef === void 0 ? void 0 : canvasRef.current;
|
|
18249
18371
|
const ctx = canvas.getContext('2d');
|
|
18250
18372
|
const targetWidth = window === null || window === void 0 ? void 0 : window.innerWidth;
|
|
18251
|
-
const targetHeight = window === null || window === void 0 ? void 0 : window.innerHeight;
|
|
18373
|
+
const targetHeight = visibleHeight || (window === null || window === void 0 ? void 0 : window.innerHeight);
|
|
18252
18374
|
canvas.height = targetHeight;
|
|
18253
18375
|
canvas.width = targetWidth;
|
|
18254
18376
|
ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(videoRef.current, 0, 0, canvas.width, canvas.height);
|
|
@@ -18258,7 +18380,7 @@ const VideoWidget$4 = React.forwardRef(({ rec, index, height, data, muted, activ
|
|
|
18258
18380
|
setTimeout(() => {
|
|
18259
18381
|
setFrameImg();
|
|
18260
18382
|
}, 500);
|
|
18261
|
-
}, [videoRef.current, isBgColor, rec, firstFrameSrc, blur]);
|
|
18383
|
+
}, [videoRef.current, isBgColor, rec, firstFrameSrc, blur, visibleHeight]);
|
|
18262
18384
|
const handleLoadedmetadata = React.useCallback(() => {
|
|
18263
18385
|
if (!videoRef.current)
|
|
18264
18386
|
return;
|
|
@@ -19000,98 +19122,6 @@ const NavBack = ({ data, minusHeight, tagHeight, onClick }) => {
|
|
|
19000
19122
|
};
|
|
19001
19123
|
var NavBack$1 = React.memo(NavBack);
|
|
19002
19124
|
|
|
19003
|
-
const useVisibleHeight = () => {
|
|
19004
|
-
const [visibleHeight, setVisibleHeight] = React.useState(0);
|
|
19005
|
-
const getVisibleContentHeight = () => {
|
|
19006
|
-
// 方法优先级:
|
|
19007
|
-
// 1. visualViewport.height (最准确)
|
|
19008
|
-
// 2. window.innerHeight (次之)
|
|
19009
|
-
// 3. document.documentElement.clientHeight (fallback)
|
|
19010
|
-
if (typeof window === 'undefined')
|
|
19011
|
-
return 0;
|
|
19012
|
-
let height = window.innerHeight;
|
|
19013
|
-
// 优先使用 visualViewport
|
|
19014
|
-
if (window.visualViewport) {
|
|
19015
|
-
height = window.visualViewport.height;
|
|
19016
|
-
}
|
|
19017
|
-
// 验证高度合理性
|
|
19018
|
-
if (height <= 0 || height > window.screen.height) {
|
|
19019
|
-
height = window.innerHeight;
|
|
19020
|
-
}
|
|
19021
|
-
// 最终 fallback
|
|
19022
|
-
if (height <= 0) {
|
|
19023
|
-
height = document.documentElement.clientHeight;
|
|
19024
|
-
}
|
|
19025
|
-
return height;
|
|
19026
|
-
};
|
|
19027
|
-
const updateHeight = React.useCallback(() => {
|
|
19028
|
-
var _a;
|
|
19029
|
-
const visibleHeight = getVisibleContentHeight();
|
|
19030
|
-
const screenHeight = (_a = window.screen) === null || _a === void 0 ? void 0 : _a.height;
|
|
19031
|
-
const ua = navigator.userAgent;
|
|
19032
|
-
// Instagram 检测
|
|
19033
|
-
const isInstagram = /Instagram/i.test(ua);
|
|
19034
|
-
// Facebook 检测
|
|
19035
|
-
const isFacebook = /FBAV|FBAN|FBSN/i.test(ua);
|
|
19036
|
-
// 安全检查
|
|
19037
|
-
if (!screenHeight || visibleHeight <= 0 || (!isInstagram && !isFacebook)) {
|
|
19038
|
-
setVisibleHeight(visibleHeight);
|
|
19039
|
-
return;
|
|
19040
|
-
}
|
|
19041
|
-
const ratio = visibleHeight / screenHeight;
|
|
19042
|
-
const threshold = 0.9;
|
|
19043
|
-
const h = screenHeight >= 900 ? screenHeight * 0.8 : screenHeight * 0.79;
|
|
19044
|
-
// 当内容高度占屏幕高度90%以上时,使用按比例计算的高度
|
|
19045
|
-
// 否则使用实际内容高度
|
|
19046
|
-
const finalHeight = Math.round(ratio >= threshold ? h : visibleHeight);
|
|
19047
|
-
if ('fundebug' in window) {
|
|
19048
|
-
const systemInfo = {
|
|
19049
|
-
ratio,
|
|
19050
|
-
h,
|
|
19051
|
-
finalHeight,
|
|
19052
|
-
visibleHeight,
|
|
19053
|
-
screenHeight,
|
|
19054
|
-
isInstagram,
|
|
19055
|
-
isFacebook,
|
|
19056
|
-
ua
|
|
19057
|
-
};
|
|
19058
|
-
window === null || window === void 0 ? void 0 : window.fundebug.notify('Collect_Info', 'resize', { metaData: { systemInfo, otherInfo: {} } });
|
|
19059
|
-
}
|
|
19060
|
-
setVisibleHeight(finalHeight);
|
|
19061
|
-
}, [getVisibleContentHeight]);
|
|
19062
|
-
React.useEffect(() => {
|
|
19063
|
-
// 初始计算
|
|
19064
|
-
updateHeight();
|
|
19065
|
-
// 事件监听
|
|
19066
|
-
const events = ['resize', 'orientationchange', 'load', 'DOMContentLoaded'];
|
|
19067
|
-
events.forEach((event) => {
|
|
19068
|
-
window.addEventListener(event, updateHeight);
|
|
19069
|
-
});
|
|
19070
|
-
// visualViewport 监听(最重要)
|
|
19071
|
-
if (window.visualViewport) {
|
|
19072
|
-
window.visualViewport.addEventListener('resize', updateHeight);
|
|
19073
|
-
window.visualViewport.addEventListener('scroll', updateHeight);
|
|
19074
|
-
}
|
|
19075
|
-
// 键盘弹出/收起监听(移动端重要)
|
|
19076
|
-
if ('virtualKeyboard' in navigator) {
|
|
19077
|
-
navigator.virtualKeyboard.addEventListener('geometrychange', updateHeight);
|
|
19078
|
-
}
|
|
19079
|
-
return () => {
|
|
19080
|
-
events.forEach((event) => {
|
|
19081
|
-
window.removeEventListener(event, updateHeight);
|
|
19082
|
-
});
|
|
19083
|
-
if (window.visualViewport) {
|
|
19084
|
-
window.visualViewport.removeEventListener('resize', updateHeight);
|
|
19085
|
-
window.visualViewport.removeEventListener('scroll', updateHeight);
|
|
19086
|
-
}
|
|
19087
|
-
if ('virtualKeyboard' in navigator) {
|
|
19088
|
-
navigator.virtualKeyboard.removeEventListener('geometrychange', updateHeight);
|
|
19089
|
-
}
|
|
19090
|
-
};
|
|
19091
|
-
}, [updateHeight]);
|
|
19092
|
-
return visibleHeight;
|
|
19093
|
-
};
|
|
19094
|
-
|
|
19095
19125
|
/*
|
|
19096
19126
|
* @Author: binruan@chatlabs.com
|
|
19097
19127
|
* @Date: 2024-03-20 10:27:31
|
|
@@ -19120,7 +19150,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight, containerWidt
|
|
|
19120
19150
|
const fbcRef = React.useRef('');
|
|
19121
19151
|
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();
|
|
19122
19152
|
const { backMainFeed, productView, jumpToWeb } = useEventReport();
|
|
19123
|
-
const visibleHeight = useVisibleHeight();
|
|
19153
|
+
const { visibleHeight, bottomHeight } = useVisibleHeight();
|
|
19124
19154
|
const isShowFingerTip = React.useMemo(() => {
|
|
19125
19155
|
return data.length > 0 && !loading && (getFeUserState() || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableSwiperTip));
|
|
19126
19156
|
}, [data, loading, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableSwiperTip]);
|
|
@@ -19334,7 +19364,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight, containerWidt
|
|
|
19334
19364
|
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)));
|
|
19335
19365
|
}
|
|
19336
19366
|
if ((_g = rec === null || rec === void 0 ? void 0 : rec.video) === null || _g === void 0 ? void 0 : _g.url) {
|
|
19337
|
-
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 })));
|
|
19367
|
+
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 })));
|
|
19338
19368
|
}
|
|
19339
19369
|
if ((_h = rec === null || rec === void 0 ? void 0 : rec.video) === null || _h === void 0 ? void 0 : _h.imgUrls) {
|
|
19340
19370
|
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 }));
|
|
@@ -19361,7 +19391,8 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight, containerWidt
|
|
|
19361
19391
|
tipText,
|
|
19362
19392
|
resolver,
|
|
19363
19393
|
schema,
|
|
19364
|
-
isReload
|
|
19394
|
+
isReload,
|
|
19395
|
+
visibleHeight
|
|
19365
19396
|
]);
|
|
19366
19397
|
const onExpandableChange = React.useCallback((v) => {
|
|
19367
19398
|
setIsShowMore(v);
|
|
@@ -19433,6 +19464,9 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight, containerWidt
|
|
|
19433
19464
|
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconYPosit) === 'top') {
|
|
19434
19465
|
top += minusHeight;
|
|
19435
19466
|
}
|
|
19467
|
+
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconFixed) && (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconYPosit) !== 'top') {
|
|
19468
|
+
top += bottomHeight;
|
|
19469
|
+
}
|
|
19436
19470
|
if (rec === null || rec === void 0 ? void 0 : rec.video) {
|
|
19437
19471
|
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: {
|
|
19438
19472
|
position: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconFixed) ? 'fixed' : 'absolute',
|
|
@@ -19441,7 +19475,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight, containerWidt
|
|
|
19441
19475
|
}, position: index }));
|
|
19442
19476
|
}
|
|
19443
19477
|
return null;
|
|
19444
|
-
}, [globalConfig, waterFallData]);
|
|
19478
|
+
}, [globalConfig, waterFallData, bottomHeight]);
|
|
19445
19479
|
const handleViewImageStartEnd = (item) => {
|
|
19446
19480
|
var _a, _b, _c, _d, _e, _f;
|
|
19447
19481
|
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)) {
|
|
@@ -19667,6 +19701,9 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight, containerWidt
|
|
|
19667
19701
|
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconYPosit) === 'top') {
|
|
19668
19702
|
top += minusHeight;
|
|
19669
19703
|
}
|
|
19704
|
+
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed) && (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconYPosit) !== 'top') {
|
|
19705
|
+
top += bottomHeight;
|
|
19706
|
+
}
|
|
19670
19707
|
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: {
|
|
19671
19708
|
position: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed) ? 'fixed' : 'absolute',
|
|
19672
19709
|
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',
|
|
@@ -19675,7 +19712,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight, containerWidt
|
|
|
19675
19712
|
[(_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,
|
|
19676
19713
|
[(_f = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconYPosit) !== null && _f !== void 0 ? _f : 'bottom']: top
|
|
19677
19714
|
}, 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 })));
|
|
19678
|
-
}, [globalConfig, visList, activeIndex, isMuted, waterFallData]);
|
|
19715
|
+
}, [globalConfig, visList, activeIndex, isMuted, waterFallData, bottomHeight]);
|
|
19679
19716
|
const renderView = React.useMemo(() => {
|
|
19680
19717
|
if (loading) {
|
|
19681
19718
|
return (React.createElement("div", { style: { height, width: containerWidth, display: 'flex', justifyContent: 'center', alignItems: 'center' } },
|
|
@@ -19769,10 +19806,10 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight, containerWidt
|
|
|
19769
19806
|
renderToggleButton(!!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed))),
|
|
19770
19807
|
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)),
|
|
19771
19808
|
React.createElement(ConsentPopup, { resolver: resolver, globalConfig: globalConfig }),
|
|
19772
|
-
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 } }))))),
|
|
19809
|
+
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' } }))))),
|
|
19773
19810
|
(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableCookieSetting) && (React.createElement("div", { style: {
|
|
19774
19811
|
position: 'fixed',
|
|
19775
|
-
bottom:
|
|
19812
|
+
bottom: bottomHeight + 'px',
|
|
19776
19813
|
left: 0,
|
|
19777
19814
|
right: 0,
|
|
19778
19815
|
width: '100%',
|