pb-sxp-ui 1.19.17 → 1.19.18

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
@@ -18979,111 +18979,64 @@ const NavBack = ({ data, minusHeight, tagHeight, onClick }) => {
18979
18979
  var NavBack$1 = memo(NavBack);
18980
18980
 
18981
18981
  const useVisibleHeight = () => {
18982
- var _a, _b;
18983
18982
  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}`
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;
19054
19004
  };
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
19005
  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');
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);
19081
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
+ };
19082
19036
  window === null || window === void 0 ? void 0 : window.fundebug.notify('Collect_Info', 'resize', { metaData: { systemInfo, otherInfo: {} } });
19083
19037
  }
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]);
19038
+ setVisibleHeight(finalHeight);
19039
+ }, [getVisibleContentHeight]);
19087
19040
  useEffect(() => {
19088
19041
  // 初始计算
19089
19042
  updateHeight();
@@ -19101,8 +19054,6 @@ const useVisibleHeight = () => {
19101
19054
  if ('virtualKeyboard' in navigator) {
19102
19055
  navigator.virtualKeyboard.addEventListener('geometrychange', updateHeight);
19103
19056
  }
19104
- // 定期检查(应对某些特殊情况)
19105
- const interval = setInterval(updateHeight, 1000);
19106
19057
  return () => {
19107
19058
  events.forEach((event) => {
19108
19059
  window.removeEventListener(event, updateHeight);
@@ -19114,7 +19065,6 @@ const useVisibleHeight = () => {
19114
19065
  if ('virtualKeyboard' in navigator) {
19115
19066
  navigator.virtualKeyboard.removeEventListener('geometrychange', updateHeight);
19116
19067
  }
19117
- clearInterval(interval);
19118
19068
  };
19119
19069
  }, [updateHeight]);
19120
19070
  return visibleHeight;
@@ -19128,7 +19078,7 @@ const useVisibleHeight = () => {
19128
19078
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\index.tsx
19129
19079
  *
19130
19080
  */
19131
- const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.innerHeight, containerWidth = window.innerWidth, tempMap, resolver, data = [], ctaType, tipText, nudge, _schema, hashTagStyle, hashTagRightMargin, tagList = [], defaultData }) => {
19081
+ const SxpPageRender = ({ globalConfig, descStyle, containerHeight, containerWidth = window.innerWidth, tempMap, resolver, data = [], ctaType, tipText, nudge, _schema, hashTagStyle, hashTagRightMargin, tagList = [], defaultData }) => {
19132
19082
  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
19083
  const mutedIcon = useIconLink('/pb_static/5beaaa5ce7f3477b99db3838619cc471.png');
19134
19084
  const unmutedIcon = useIconLink('/pb_static/fea8668a8a894e4aa3a86bcc775e895e.png');
@@ -19317,29 +19267,10 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
19317
19267
  }
19318
19268
  return minusHeight;
19319
19269
  }, [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
19270
  const height = useMemo(() => {
19341
- return getDvhInPx() - minusHeight - tagHeight - getHeightWithSafeArea();
19342
- }, [minusHeight, visibleHeight, tagHeight, getHeightWithSafeArea, containerHeight, getDvhInPx]);
19271
+ const h = containerHeight || visibleHeight;
19272
+ return h - minusHeight - tagHeight;
19273
+ }, [containerHeight, visibleHeight, minusHeight, tagHeight]);
19343
19274
  const visList = useMemo(() => {
19344
19275
  var _a;
19345
19276
  const list = activeIndex === 0 && !waterFallData && !isEditor && !isDiyH5
@@ -19480,9 +19411,6 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
19480
19411
  if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconYPosit) === 'top') {
19481
19412
  top += minusHeight;
19482
19413
  }
19483
- if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconFixed) && (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconYPosit) !== 'top') {
19484
- top += getHeightWithSafeArea();
19485
- }
19486
19414
  if (rec === null || rec === void 0 ? void 0 : rec.video) {
19487
19415
  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: {
19488
19416
  position: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconFixed) ? 'fixed' : 'absolute',
@@ -19717,9 +19645,6 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
19717
19645
  if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconYPosit) === 'top') {
19718
19646
  top += minusHeight;
19719
19647
  }
19720
- if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed) && (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconYPosit) !== 'top') {
19721
- top += getHeightWithSafeArea();
19722
- }
19723
19648
  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
19649
  position: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed) ? 'fixed' : 'absolute',
19725
19650
  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',
@@ -19760,7 +19685,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
19760
19685
  isReload,
19761
19686
  renderToggleButton
19762
19687
  ]);
19763
- return (React.createElement("div", { id: 'sxp-render', className: 'clc-sxp-container' },
19688
+ return (React.createElement("div", { id: 'sxp-render', className: 'clc-sxp-container', style: { height } },
19764
19689
  (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
19690
  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
19691
  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 +19747,10 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
19822
19747
  renderToggleButton(!!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed))),
19823
19748
  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
19749
  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)' } }))))),
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 } }))))),
19826
19751
  (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableCookieSetting) && (React.createElement("div", { style: {
19827
19752
  position: 'fixed',
19828
- bottom: 'var(--safe-area-inset-bottom,0px)',
19753
+ bottom: 0,
19829
19754
  left: 0,
19830
19755
  right: 0,
19831
19756
  width: '100%',