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.css CHANGED
@@ -63,11 +63,7 @@ a:active {
63
63
  color: #000;
64
64
  outline: none;
65
65
  }
66
-
67
- :root {
68
- --safe-area-inset-bottom: constant(safe-area-inset-bottom);
69
- --safe-area-inset-bottom: env(safe-area-inset-bottom);
70
- }
66
+
71
67
  .pb-appoint-form {
72
68
  position: relative;
73
69
  height: 100%;
@@ -1073,10 +1069,7 @@ a:active {
1073
1069
  flex: 1;
1074
1070
  height: 100vh;
1075
1071
  overflow-y: auto;
1076
- padding-top: 18px;
1077
- padding-left: 18px;
1078
- padding-right: 18px;
1079
- padding-bottom: calc(18px + var(--safe-area-inset-bottom, 0px));
1072
+ padding: 18px;
1080
1073
  }
1081
1074
  .waterfallFlow__title {
1082
1075
  text-align: center;
@@ -1555,7 +1548,6 @@ a:active {
1555
1548
  top: 0;
1556
1549
  left: 0;
1557
1550
  right: 0;
1558
- bottom: var(--safe-area-inset-bottom, 0px);
1559
1551
  width: 100%;
1560
1552
  -webkit-box-sizing: border-box;
1561
1553
  box-sizing: border-box;
@@ -2467,7 +2459,7 @@ button.swiper-pagination-bullet {
2467
2459
  left: 0;
2468
2460
  top: 0;
2469
2461
  right: 0;
2470
- bottom: var(--safe-area-inset-bottom, 0px);
2462
+ bottom: 0;
2471
2463
  z-index: 100;
2472
2464
  -webkit-box-orient: vertical;
2473
2465
  -webkit-box-direction: normal;
package/dist/index.js CHANGED
@@ -10305,6 +10305,106 @@ 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 && ratio !== 1;
10353
+ const finalHeight = isRatio ? Math.round(h) : visibleHeight;
10354
+ if (isRatio) {
10355
+ setBottomHeight(screenHeight - Math.round(h));
10356
+ }
10357
+ else {
10358
+ setBottomHeight(0);
10359
+ }
10360
+ if ('fundebug' in window) {
10361
+ const systemInfo = {
10362
+ ratio,
10363
+ h,
10364
+ finalHeight,
10365
+ visibleHeight,
10366
+ screenHeight,
10367
+ isInstagram,
10368
+ isFacebook,
10369
+ ua
10370
+ };
10371
+ window === null || window === void 0 ? void 0 : window.fundebug.notify('Collect_Info', 'resize', { metaData: { systemInfo, otherInfo: {} } });
10372
+ }
10373
+ setVisibleHeight(finalHeight);
10374
+ }, [getVisibleContentHeight]);
10375
+ useEffect(() => {
10376
+ // 初始计算
10377
+ updateHeight();
10378
+ // 事件监听
10379
+ const events = ['resize', 'orientationchange', 'load', 'DOMContentLoaded'];
10380
+ events.forEach((event) => {
10381
+ window.addEventListener(event, updateHeight);
10382
+ });
10383
+ // visualViewport 监听(最重要)
10384
+ if (window.visualViewport) {
10385
+ window.visualViewport.addEventListener('resize', updateHeight);
10386
+ window.visualViewport.addEventListener('scroll', updateHeight);
10387
+ }
10388
+ // 键盘弹出/收起监听(移动端重要)
10389
+ if ('virtualKeyboard' in navigator) {
10390
+ navigator.virtualKeyboard.addEventListener('geometrychange', updateHeight);
10391
+ }
10392
+ return () => {
10393
+ events.forEach((event) => {
10394
+ window.removeEventListener(event, updateHeight);
10395
+ });
10396
+ if (window.visualViewport) {
10397
+ window.visualViewport.removeEventListener('resize', updateHeight);
10398
+ window.visualViewport.removeEventListener('scroll', updateHeight);
10399
+ }
10400
+ if ('virtualKeyboard' in navigator) {
10401
+ navigator.virtualKeyboard.removeEventListener('geometrychange', updateHeight);
10402
+ }
10403
+ };
10404
+ }, [updateHeight]);
10405
+ return { visibleHeight, bottomHeight };
10406
+ }
10407
+
10308
10408
  /*
10309
10409
  * @Author: binruan@chatlabs.com
10310
10410
  * @Date: 2023-11-02 18:34:34
@@ -10314,15 +10414,17 @@ var CommodityGroup$1 = memo(CommodityGroup);
10314
10414
  *
10315
10415
  */
10316
10416
  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 = window.innerHeight, isFullScreen = false, openState }) => {
10417
+ const Modal = ({ visible, onClose, children, modalStyle, padding, popup, schema, fullHeight, isFullScreen = false, openState }) => {
10318
10418
  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;
10419
+ const { visibleHeight, bottomHeight } = useVisibleHeight();
10319
10420
  const touchRef = useRef(null);
10320
10421
  const fTouchRef = useRef(null);
10321
10422
  const touchMoveRef = useRef(null);
10322
10423
  const ref = useRef(null);
10323
10424
  const modalRef = useRef(null);
10324
- const MODAL_DEF_TRANS = fullHeight * 0.2;
10325
- const MODAL_DEF_CON_H = isFullScreen ? fullHeight : fullHeight * 0.8;
10425
+ const modalHeight = fullHeight || visibleHeight;
10426
+ const MODAL_DEF_TRANS = modalHeight * 0.2;
10427
+ const MODAL_DEF_CON_H = isFullScreen ? modalHeight : modalHeight * 0.8;
10326
10428
  const [modalTrans, setModalTrans] = useState(MODAL_DEF_TRANS);
10327
10429
  const [isShow, setIsShow] = useState(false);
10328
10430
  const modalEleRef = useRef(null);
@@ -10370,17 +10472,17 @@ const Modal = ({ visible, onClose, children, modalStyle, padding, popup, schema,
10370
10472
  }, [_popup, openState, globalConfig, schema]);
10371
10473
  useEffect(() => {
10372
10474
  const trapFocus = (element) => {
10373
- var 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])');
10374
- var firstFocusableEl = focusableEls === null || focusableEls === void 0 ? void 0 : focusableEls[0];
10375
- var lastFocusableEl = focusableEls === null || focusableEls === void 0 ? void 0 : focusableEls[(focusableEls === null || focusableEls === void 0 ? void 0 : focusableEls.length) - 1];
10376
- var KEYCODE_TAB = 9;
10475
+ 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])');
10476
+ const firstFocusableEl = focusableEls === null || focusableEls === void 0 ? void 0 : focusableEls[0];
10477
+ const lastFocusableEl = focusableEls === null || focusableEls === void 0 ? void 0 : focusableEls[(focusableEls === null || focusableEls === void 0 ? void 0 : focusableEls.length) - 1];
10478
+ const KEYCODE_TAB = 9;
10377
10479
  element.addEventListener('keydown', function (e) {
10378
10480
  if (e.key === 'Escape' || e.key === 'Esc') {
10379
10481
  // 在这里执行按下 Esc 键时的操作
10380
10482
  handleClose();
10381
10483
  e.preventDefault();
10382
10484
  }
10383
- var isTabPressed = e.key === 'Tab' || e.keyCode === KEYCODE_TAB;
10485
+ const isTabPressed = e.key === 'Tab' || e.keyCode === KEYCODE_TAB;
10384
10486
  if (!isTabPressed) {
10385
10487
  return;
10386
10488
  }
@@ -10462,12 +10564,12 @@ const Modal = ({ visible, onClose, children, modalStyle, padding, popup, schema,
10462
10564
  }
10463
10565
  touchMoveRef.current = false;
10464
10566
  };
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 },
10567
+ 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
10568
  React.createElement("div", { style: {
10467
10569
  position: 'relative',
10468
10570
  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
10571
  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`,
10572
+ 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
10573
  overflow: 'hidden',
10472
10574
  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
10575
  height: '100%'
@@ -10483,7 +10585,7 @@ const Modal = ({ visible, onClose, children, modalStyle, padding, popup, schema,
10483
10585
  onTouchEnd: handleTouchEnd
10484
10586
  })),
10485
10587
  React.createElement("div", Object.assign({ id: 'modal-content', ref: ref, style: {
10486
- height: isScrollFullScreen ? fullHeight : MODAL_DEF_CON_H,
10588
+ height: isScrollFullScreen ? modalHeight : MODAL_DEF_CON_H,
10487
10589
  overflow: (isScrollFullScreen && modalTrans <= 0) || !isScrollFullScreen ? 'auto' : 'hidden',
10488
10590
  zIndex: 1
10489
10591
  } }, (((_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 +18220,7 @@ const mountVideoPlayerAtNode = (() => {
18118
18220
  };
18119
18221
  })();
18120
18222
 
18121
- const VideoWidget$4 = forwardRef(({ rec, index, height, data, muted, activeIndex, videoPostConfig, videoPlayIcon, loopPlay, swiperRef }, ref) => {
18223
+ const VideoWidget$4 = forwardRef(({ rec, index, height, data, muted, activeIndex, videoPostConfig, videoPlayIcon, loopPlay, swiperRef, visibleHeight }, ref) => {
18122
18224
  var _a, _b;
18123
18225
  const [isPauseVideo, setIsPauseVideo] = useState(false);
18124
18226
  const { bffEventReport, sxpParameter, waterFallData, openHashtag, bffFbReport, isDiyH5 } = useSxpDataSource();
@@ -18226,7 +18328,7 @@ const VideoWidget$4 = forwardRef(({ rec, index, height, data, muted, activeIndex
18226
18328
  const canvas = canvasRef === null || canvasRef === void 0 ? void 0 : canvasRef.current;
18227
18329
  const ctx = canvas.getContext('2d');
18228
18330
  const targetWidth = window === null || window === void 0 ? void 0 : window.innerWidth;
18229
- const targetHeight = window === null || window === void 0 ? void 0 : window.innerHeight;
18331
+ const targetHeight = visibleHeight || (window === null || window === void 0 ? void 0 : window.innerHeight);
18230
18332
  canvas.height = targetHeight;
18231
18333
  canvas.width = targetWidth;
18232
18334
  ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(videoRef.current, 0, 0, canvas.width, canvas.height);
@@ -18236,7 +18338,7 @@ const VideoWidget$4 = forwardRef(({ rec, index, height, data, muted, activeIndex
18236
18338
  setTimeout(() => {
18237
18339
  setFrameImg();
18238
18340
  }, 500);
18239
- }, [videoRef.current, isBgColor, rec, firstFrameSrc, blur]);
18341
+ }, [videoRef.current, isBgColor, rec, firstFrameSrc, blur, visibleHeight]);
18240
18342
  const handleLoadedmetadata = useCallback(() => {
18241
18343
  if (!videoRef.current)
18242
18344
  return;
@@ -18978,148 +19080,6 @@ const NavBack = ({ data, minusHeight, tagHeight, onClick }) => {
18978
19080
  };
18979
19081
  var NavBack$1 = memo(NavBack);
18980
19082
 
18981
- const useVisibleHeight = () => {
18982
- var _a, _b;
18983
- const [visibleHeight, setVisibleHeight] = useState(0);
18984
- const getDvhInPx = () => {
18985
- const detector = document.createElement('div');
18986
- detector.style.position = 'fixed';
18987
- detector.style.bottom = `${getHeightWithSafeArea()}px`;
18988
- detector.style.left = '0';
18989
- detector.style.height = '100dvh';
18990
- detector.style.visibility = 'hidden';
18991
- detector.style.zIndex = '-1';
18992
- document.body.appendChild(detector);
18993
- const dvhInPx = detector.clientHeight;
18994
- document.body.removeChild(detector);
18995
- return dvhInPx;
18996
- };
18997
- const getVhInPx = () => {
18998
- const detector = document.createElement('div');
18999
- detector.style.position = 'fixed';
19000
- detector.style.bottom = `${getHeightWithSafeArea()}px`;
19001
- detector.style.left = '0';
19002
- detector.style.height = '100vh';
19003
- detector.style.visibility = 'hidden';
19004
- detector.style.zIndex = '-1';
19005
- document.body.appendChild(detector);
19006
- const dvhInPx = detector.clientHeight;
19007
- document.body.removeChild(detector);
19008
- return dvhInPx;
19009
- };
19010
- const getFillAvailableInPx = () => {
19011
- const detector = document.createElement('div');
19012
- detector.style.position = 'fixed';
19013
- detector.style.bottom = `${getHeightWithSafeArea()}px`;
19014
- detector.style.left = '0';
19015
- detector.style.height = '-webkit-fill-available';
19016
- detector.style.visibility = 'hidden';
19017
- detector.style.zIndex = '-1';
19018
- document.body.appendChild(detector);
19019
- const dvhInPx = detector.clientHeight;
19020
- document.body.removeChild(detector);
19021
- return dvhInPx;
19022
- };
19023
- const getHeightWithSafeArea = () => {
19024
- const root = document.documentElement;
19025
- const value = getComputedStyle(root).getPropertyValue('--safe-area-inset-bottom');
19026
- // 处理可能的值(可能是 '0px', '34px' 等)
19027
- const numericValue = parseInt(value) || 0;
19028
- return numericValue;
19029
- };
19030
- const dvhToPx = (dvh) => {
19031
- return Math.round((dvh / 100) * document.documentElement.clientHeight);
19032
- };
19033
- // 检测是否启用了系统字体缩放
19034
- const fontSize = parseFloat(getComputedStyle(document.documentElement).fontSize);
19035
- const isScaled = fontSize !== 52; // 默认 1rem = 16px
19036
- // 检测是否处于 Display Zoom 模式(通过屏幕宽高比间接判断)
19037
- const isZoomed = screen.width <= 375 && screen.height <= 667 && window.devicePixelRatio < 3;
19038
- const systemInfo = {
19039
- visualViewport: (_a = window.visualViewport) === null || _a === void 0 ? void 0 : _a.height,
19040
- innerHeight: window.innerHeight,
19041
- clientHeight: document.documentElement.clientHeight,
19042
- screenHeight: window.screen.height,
19043
- bodyHeight: (_b = document === null || document === void 0 ? void 0 : document.body) === null || _b === void 0 ? void 0 : _b.clientHeight,
19044
- agent: navigator.userAgent,
19045
- version: '1.19.17',
19046
- safeArea: getHeightWithSafeArea(),
19047
- dvh: dvhToPx(100),
19048
- dvhInPx: getDvhInPx(),
19049
- vhInPx: getVhInPx(),
19050
- fillAvailableInPx: getFillAvailableInPx(),
19051
- isScaled,
19052
- isZoomed,
19053
- meta: `${window === null || window === void 0 ? void 0 : window.Instagram},${window === null || window === void 0 ? void 0 : window.Facebook}`
19054
- };
19055
- console.log(systemInfo, 'fundebug-init--------------------->systemInfo');
19056
- if ('fundebug' in window) {
19057
- window === null || window === void 0 ? void 0 : window.fundebug.notify('Collect_Info', 'init', { metaData: { systemInfo, otherInfo: {} } });
19058
- }
19059
- const updateHeight = useCallback(() => {
19060
- var _a, _b, _c;
19061
- const fontSize = parseFloat(getComputedStyle(document.documentElement).fontSize);
19062
- const isScaled = fontSize !== 52; // 默认 1rem = 16px
19063
- const systemInfo = {
19064
- visualViewport: (_a = window.visualViewport) === null || _a === void 0 ? void 0 : _a.height,
19065
- innerHeight: window.innerHeight,
19066
- clientHeight: document.documentElement.clientHeight,
19067
- screenHeight: window.screen.height,
19068
- bodyHeight: (_b = document === null || document === void 0 ? void 0 : document.body) === null || _b === void 0 ? void 0 : _b.clientHeight,
19069
- agent: navigator.userAgent,
19070
- version: '1.19.17',
19071
- safeArea: getHeightWithSafeArea(),
19072
- dvh: dvhToPx(100),
19073
- dvhInPx: getDvhInPx(),
19074
- vhInPx: getVhInPx(),
19075
- fillAvailableInPx: getFillAvailableInPx(),
19076
- isScaled,
19077
- isZoomed,
19078
- meta: `${window === null || window === void 0 ? void 0 : window.Instagram},${window === null || window === void 0 ? void 0 : window.Facebook}`
19079
- };
19080
- console.log(systemInfo, 'fundebug-resize--------------------->systemInfo');
19081
- if ('fundebug' in window) {
19082
- window === null || window === void 0 ? void 0 : window.fundebug.notify('Collect_Info', 'resize', { metaData: { systemInfo, otherInfo: {} } });
19083
- }
19084
- 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);
19085
- setVisibleHeight(height);
19086
- }, [getHeightWithSafeArea, dvhToPx, getDvhInPx, getVhInPx, getFillAvailableInPx]);
19087
- useEffect(() => {
19088
- // 初始计算
19089
- updateHeight();
19090
- // 事件监听
19091
- const events = ['resize', 'orientationchange', 'load', 'DOMContentLoaded'];
19092
- events.forEach((event) => {
19093
- window.addEventListener(event, updateHeight);
19094
- });
19095
- // visualViewport 监听(最重要)
19096
- if (window.visualViewport) {
19097
- window.visualViewport.addEventListener('resize', updateHeight);
19098
- window.visualViewport.addEventListener('scroll', updateHeight);
19099
- }
19100
- // 键盘弹出/收起监听(移动端重要)
19101
- if ('virtualKeyboard' in navigator) {
19102
- navigator.virtualKeyboard.addEventListener('geometrychange', updateHeight);
19103
- }
19104
- // 定期检查(应对某些特殊情况)
19105
- const interval = setInterval(updateHeight, 1000);
19106
- return () => {
19107
- events.forEach((event) => {
19108
- window.removeEventListener(event, updateHeight);
19109
- });
19110
- if (window.visualViewport) {
19111
- window.visualViewport.removeEventListener('resize', updateHeight);
19112
- window.visualViewport.removeEventListener('scroll', updateHeight);
19113
- }
19114
- if ('virtualKeyboard' in navigator) {
19115
- navigator.virtualKeyboard.removeEventListener('geometrychange', updateHeight);
19116
- }
19117
- clearInterval(interval);
19118
- };
19119
- }, [updateHeight]);
19120
- return visibleHeight;
19121
- };
19122
-
19123
19083
  /*
19124
19084
  * @Author: binruan@chatlabs.com
19125
19085
  * @Date: 2024-03-20 10:27:31
@@ -19128,7 +19088,7 @@ const useVisibleHeight = () => {
19128
19088
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\index.tsx
19129
19089
  *
19130
19090
  */
19131
- const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.innerHeight, containerWidth = window.innerWidth, tempMap, resolver, data = [], ctaType, tipText, nudge, _schema, hashTagStyle, hashTagRightMargin, tagList = [], defaultData }) => {
19091
+ const SxpPageRender = ({ globalConfig, descStyle, containerHeight, containerWidth = window.innerWidth, tempMap, resolver, data = [], ctaType, tipText, nudge, _schema, hashTagStyle, hashTagRightMargin, tagList = [], defaultData }) => {
19132
19092
  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;
19133
19093
  const mutedIcon = useIconLink('/pb_static/5beaaa5ce7f3477b99db3838619cc471.png');
19134
19094
  const unmutedIcon = useIconLink('/pb_static/fea8668a8a894e4aa3a86bcc775e895e.png');
@@ -19148,7 +19108,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
19148
19108
  const fbcRef = useRef('');
19149
19109
  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();
19150
19110
  const { backMainFeed, productView, jumpToWeb } = useEventReport();
19151
- const visibleHeight = useVisibleHeight();
19111
+ const { visibleHeight, bottomHeight } = useVisibleHeight();
19152
19112
  const isShowFingerTip = useMemo(() => {
19153
19113
  return data.length > 0 && !loading && (getFeUserState() || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableSwiperTip));
19154
19114
  }, [data, loading, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableSwiperTip]);
@@ -19317,29 +19277,10 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
19317
19277
  }
19318
19278
  return minusHeight;
19319
19279
  }, [globalConfig]);
19320
- const getHeightWithSafeArea = () => {
19321
- const root = document.documentElement;
19322
- const value = getComputedStyle(root).getPropertyValue('--safe-area-inset-bottom');
19323
- // 处理可能的值(可能是 '0px', '34px' 等)
19324
- const numericValue = parseInt(value) || 0;
19325
- return numericValue;
19326
- };
19327
- const getDvhInPx = () => {
19328
- const detector = document.createElement('div');
19329
- detector.style.position = 'fixed';
19330
- detector.style.bottom = `${getHeightWithSafeArea()}px`;
19331
- detector.style.left = '0';
19332
- detector.style.height = '100dvh';
19333
- detector.style.visibility = 'hidden';
19334
- detector.style.zIndex = '-1';
19335
- document.body.appendChild(detector);
19336
- const dvhInPx = detector.clientHeight;
19337
- document.body.removeChild(detector);
19338
- return dvhInPx;
19339
- };
19340
19280
  const height = useMemo(() => {
19341
- return getDvhInPx() - minusHeight - tagHeight - getHeightWithSafeArea();
19342
- }, [minusHeight, visibleHeight, tagHeight, getHeightWithSafeArea, containerHeight, getDvhInPx]);
19281
+ const h = containerHeight || visibleHeight;
19282
+ return h - minusHeight - tagHeight;
19283
+ }, [containerHeight, visibleHeight, minusHeight, tagHeight]);
19343
19284
  const visList = useMemo(() => {
19344
19285
  var _a;
19345
19286
  const list = activeIndex === 0 && !waterFallData && !isEditor && !isDiyH5
@@ -19381,7 +19322,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
19381
19322
  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)));
19382
19323
  }
19383
19324
  if ((_g = rec === null || rec === void 0 ? void 0 : rec.video) === null || _g === void 0 ? void 0 : _g.url) {
19384
- 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 })));
19325
+ 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 })));
19385
19326
  }
19386
19327
  if ((_h = rec === null || rec === void 0 ? void 0 : rec.video) === null || _h === void 0 ? void 0 : _h.imgUrls) {
19387
19328
  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 }));
@@ -19408,7 +19349,8 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
19408
19349
  tipText,
19409
19350
  resolver,
19410
19351
  schema,
19411
- isReload
19352
+ isReload,
19353
+ visibleHeight
19412
19354
  ]);
19413
19355
  const onExpandableChange = useCallback((v) => {
19414
19356
  setIsShowMore(v);
@@ -19481,7 +19423,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
19481
19423
  top += minusHeight;
19482
19424
  }
19483
19425
  if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconFixed) && (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconYPosit) !== 'top') {
19484
- top += getHeightWithSafeArea();
19426
+ top += bottomHeight;
19485
19427
  }
19486
19428
  if (rec === null || rec === void 0 ? void 0 : rec.video) {
19487
19429
  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: {
@@ -19491,7 +19433,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
19491
19433
  }, position: index }));
19492
19434
  }
19493
19435
  return null;
19494
- }, [globalConfig, waterFallData]);
19436
+ }, [globalConfig, waterFallData, bottomHeight]);
19495
19437
  const handleViewImageStartEnd = (item) => {
19496
19438
  var _a, _b, _c, _d, _e, _f;
19497
19439
  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)) {
@@ -19718,7 +19660,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
19718
19660
  top += minusHeight;
19719
19661
  }
19720
19662
  if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed) && (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconYPosit) !== 'top') {
19721
- top += getHeightWithSafeArea();
19663
+ top += bottomHeight;
19722
19664
  }
19723
19665
  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: {
19724
19666
  position: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed) ? 'fixed' : 'absolute',
@@ -19728,7 +19670,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
19728
19670
  [(_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,
19729
19671
  [(_f = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconYPosit) !== null && _f !== void 0 ? _f : 'bottom']: top
19730
19672
  }, 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 })));
19731
- }, [globalConfig, visList, activeIndex, isMuted, waterFallData]);
19673
+ }, [globalConfig, visList, activeIndex, isMuted, waterFallData, bottomHeight]);
19732
19674
  const renderView = useMemo(() => {
19733
19675
  if (loading) {
19734
19676
  return (React.createElement("div", { style: { height, width: containerWidth, display: 'flex', justifyContent: 'center', alignItems: 'center' } },
@@ -19760,7 +19702,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
19760
19702
  isReload,
19761
19703
  renderToggleButton
19762
19704
  ]);
19763
- return (React.createElement("div", { id: 'sxp-render', className: 'clc-sxp-container' },
19705
+ return (React.createElement("div", { id: 'sxp-render', className: 'clc-sxp-container', style: { height } },
19764
19706
  (data === null || data === void 0 ? void 0 : data.length) < 1 && loading ? (React.createElement("div", { style: { height, width: containerWidth, display: 'flex', justifyContent: 'center', alignItems: 'center' } },
19765
19707
  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` })) },
19766
19708
  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: () => {
@@ -19822,10 +19764,10 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
19822
19764
  renderToggleButton(!!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed))),
19823
19765
  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)),
19824
19766
  React.createElement(ConsentPopup, { resolver: resolver, globalConfig: globalConfig }),
19825
- 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: 'var(--safe-area-inset-bottom,0px)' } }))))),
19767
+ 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' } }))))),
19826
19768
  (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableCookieSetting) && (React.createElement("div", { style: {
19827
19769
  position: 'fixed',
19828
- bottom: 'var(--safe-area-inset-bottom,0px)',
19770
+ bottom: bottomHeight + 'px',
19829
19771
  left: 0,
19830
19772
  right: 0,
19831
19773
  width: '100%',