pb-sxp-ui 1.19.8 → 1.19.10

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/pb-ui.js CHANGED
@@ -18993,6 +18993,70 @@ Made in Italy` })));
18993
18993
  };
18994
18994
  var NavBack$1 = React.memo(NavBack);
18995
18995
 
18996
+ const useVisibleHeight = () => {
18997
+ const [visibleHeight, setVisibleHeight] = React.useState(0);
18998
+ const getVisibleContentHeight = () => {
18999
+ // 方法优先级:
19000
+ // 1. visualViewport.height (最准确)
19001
+ // 2. window.innerHeight (次之)
19002
+ // 3. document.documentElement.clientHeight (fallback)
19003
+ if (typeof window === 'undefined')
19004
+ return 0;
19005
+ let height = window.innerHeight;
19006
+ // 优先使用 visualViewport
19007
+ if (window.visualViewport) {
19008
+ height = window.visualViewport.height;
19009
+ }
19010
+ // 验证高度合理性
19011
+ if (height <= 0 || height > window.screen.height) {
19012
+ height = window.innerHeight;
19013
+ }
19014
+ // 最终 fallback
19015
+ if (height <= 0) {
19016
+ height = document.documentElement.clientHeight;
19017
+ }
19018
+ return height;
19019
+ };
19020
+ const updateHeight = React.useCallback(() => {
19021
+ const height = getVisibleContentHeight();
19022
+ setVisibleHeight(height);
19023
+ }, []);
19024
+ React.useEffect(() => {
19025
+ // 初始计算
19026
+ updateHeight();
19027
+ // 事件监听
19028
+ const events = ['resize', 'orientationchange', 'load', 'DOMContentLoaded'];
19029
+ events.forEach((event) => {
19030
+ window.addEventListener(event, updateHeight);
19031
+ });
19032
+ // visualViewport 监听(最重要)
19033
+ if (window.visualViewport) {
19034
+ window.visualViewport.addEventListener('resize', updateHeight);
19035
+ window.visualViewport.addEventListener('scroll', updateHeight);
19036
+ }
19037
+ // 键盘弹出/收起监听(移动端重要)
19038
+ if ('virtualKeyboard' in navigator) {
19039
+ navigator.virtualKeyboard.addEventListener('geometrychange', updateHeight);
19040
+ }
19041
+ // 定期检查(应对某些特殊情况)
19042
+ const interval = setInterval(updateHeight, 1000);
19043
+ return () => {
19044
+ events.forEach((event) => {
19045
+ window.removeEventListener(event, updateHeight);
19046
+ });
19047
+ if (window.visualViewport) {
19048
+ window.visualViewport.removeEventListener('resize', updateHeight);
19049
+ window.visualViewport.removeEventListener('scroll', updateHeight);
19050
+ }
19051
+ if ('virtualKeyboard' in navigator) {
19052
+ navigator.virtualKeyboard.removeEventListener('geometrychange', updateHeight);
19053
+ }
19054
+ clearInterval(interval);
19055
+ };
19056
+ }, [updateHeight]);
19057
+ return visibleHeight;
19058
+ };
19059
+
18996
19060
  /*
18997
19061
  * @Author: binruan@chatlabs.com
18998
19062
  * @Date: 2024-03-20 10:27:31
@@ -19021,6 +19085,7 @@ Made in Italy` })));
19021
19085
  const fbcRef = React.useRef('');
19022
19086
  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();
19023
19087
  const { backMainFeed, productView, jumpToWeb } = useEventReport();
19088
+ const visibleHeight = useVisibleHeight();
19024
19089
  const isShowFingerTip = React.useMemo(() => {
19025
19090
  return data.length > 0 && !loading && (getFeUserState() || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableSwiperTip));
19026
19091
  }, [data, loading, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableSwiperTip]);
@@ -19189,9 +19254,24 @@ Made in Italy` })));
19189
19254
  }
19190
19255
  return minusHeight;
19191
19256
  }, [globalConfig]);
19257
+ const getHeightWithSafeArea = () => {
19258
+ // 获取窗口高度
19259
+ // 动态检测安全区域
19260
+ const detector = document.createElement('div');
19261
+ detector.style.position = 'fixed';
19262
+ detector.style.bottom = '0';
19263
+ detector.style.left = '0';
19264
+ detector.style.paddingBottom = 'env(safe-area-inset-bottom)';
19265
+ detector.style.visibility = 'hidden';
19266
+ document.body.appendChild(detector);
19267
+ const computedStyle = window.getComputedStyle(detector);
19268
+ const safeAreaBottom = parseFloat(computedStyle.paddingBottom) || 0;
19269
+ document.body.removeChild(detector);
19270
+ return safeAreaBottom;
19271
+ };
19192
19272
  const height = React.useMemo(() => {
19193
- return containerHeight - minusHeight - tagHeight;
19194
- }, [minusHeight, containerHeight, tagHeight]);
19273
+ return visibleHeight - minusHeight - tagHeight;
19274
+ }, [minusHeight, visibleHeight, tagHeight]);
19195
19275
  const visList = React.useMemo(() => {
19196
19276
  var _a;
19197
19277
  const list = activeIndex === 0 && !waterFallData && !isEditor && !isDiyH5
@@ -19332,6 +19412,9 @@ Made in Italy` })));
19332
19412
  if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconYPosit) === 'top') {
19333
19413
  top += minusHeight;
19334
19414
  }
19415
+ if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconFixed) && (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconYPosit) !== 'top') {
19416
+ top += getHeightWithSafeArea();
19417
+ }
19335
19418
  if (rec === null || rec === void 0 ? void 0 : rec.video) {
19336
19419
  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: {
19337
19420
  position: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconFixed) ? 'fixed' : 'absolute',
@@ -19566,6 +19649,9 @@ Made in Italy` })));
19566
19649
  if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconYPosit) === 'top') {
19567
19650
  top += minusHeight;
19568
19651
  }
19652
+ if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed) && (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconYPosit) !== 'top') {
19653
+ top += getHeightWithSafeArea();
19654
+ }
19569
19655
  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: {
19570
19656
  position: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed) ? 'fixed' : 'absolute',
19571
19657
  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',
@@ -19668,10 +19754,10 @@ Made in Italy` })));
19668
19754
  renderToggleButton(!!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed))),
19669
19755
  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)),
19670
19756
  React.createElement(ConsentPopup, { resolver: resolver, globalConfig: globalConfig }),
19671
- 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 } }))))),
19757
+ 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: 'env(safe-area-inset-bottom)' } }))))),
19672
19758
  (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableCookieSetting) && (React.createElement("div", { style: {
19673
19759
  position: 'fixed',
19674
- bottom: 0,
19760
+ bottom: 'env(safe-area-inset-bottom)',
19675
19761
  left: 0,
19676
19762
  right: 0,
19677
19763
  width: '100%',