pb-sxp-ui 1.19.13 → 1.19.15

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.
@@ -220,22 +220,22 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
220
220
  const numericValue = parseInt(value) || 0;
221
221
  return numericValue;
222
222
  };
223
- const getHeightWithSafeArea2 = () => {
223
+ const getDvhInPx = () => {
224
224
  const detector = document.createElement('div');
225
225
  detector.style.position = 'fixed';
226
- detector.style.bottom = '0';
226
+ detector.style.bottom = `${getHeightWithSafeArea()}px`;
227
227
  detector.style.left = '0';
228
- detector.style.paddingBottom = 'env(safe-area-inset-bottom)';
228
+ detector.style.height = '100dvh';
229
229
  detector.style.visibility = 'hidden';
230
+ detector.style.zIndex = '-1';
230
231
  document.body.appendChild(detector);
231
- const computedStyle = window.getComputedStyle(detector);
232
- const safeAreaBottom = parseFloat(computedStyle.paddingBottom) || 0;
232
+ const dvhInPx = detector.clientHeight;
233
233
  document.body.removeChild(detector);
234
- return safeAreaBottom;
234
+ return dvhInPx;
235
235
  };
236
236
  const height = useMemo(() => {
237
- return visibleHeight - minusHeight - tagHeight - getHeightWithSafeArea2();
238
- }, [minusHeight, visibleHeight, tagHeight, getHeightWithSafeArea2, containerHeight]);
237
+ return getDvhInPx() - minusHeight - tagHeight - getHeightWithSafeArea();
238
+ }, [minusHeight, visibleHeight, tagHeight, getHeightWithSafeArea, containerHeight, getDvhInPx]);
239
239
  const visList = useMemo(() => {
240
240
  var _a;
241
241
  const list = activeIndex === 0 && !waterFallData && !isEditor && !isDiyH5
@@ -712,10 +712,10 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
712
712
  renderToggleButton(!!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed))),
713
713
  React.createElement(WaterFall, 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)),
714
714
  React.createElement(ConsentPopup, { resolver: resolver, globalConfig: globalConfig }),
715
- openMultiPosts && (React.createElement(MultiPosts, 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)' } }))))),
715
+ openMultiPosts && (React.createElement(MultiPosts, 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)' } }))))),
716
716
  (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableCookieSetting) && (React.createElement("div", { style: {
717
717
  position: 'fixed',
718
- bottom: 'env(safe-area-inset-bottom)',
718
+ bottom: 'var(--safe-area-inset-bottom,0px)',
719
719
  left: 0,
720
720
  right: 0,
721
721
  width: '100%',
@@ -1,6 +1,73 @@
1
1
  import { useState, useEffect, useCallback } from 'react';
2
2
  export const useVisibleHeight = () => {
3
+ var _a, _b;
3
4
  const [visibleHeight, setVisibleHeight] = useState(0);
5
+ const getDvhInPx = () => {
6
+ const detector = document.createElement('div');
7
+ detector.style.position = 'fixed';
8
+ detector.style.bottom = `${getHeightWithSafeArea()}px`;
9
+ detector.style.left = '0';
10
+ detector.style.height = '100dvh';
11
+ detector.style.visibility = 'hidden';
12
+ detector.style.zIndex = '-1';
13
+ document.body.appendChild(detector);
14
+ const dvhInPx = detector.clientHeight;
15
+ document.body.removeChild(detector);
16
+ return dvhInPx;
17
+ };
18
+ const getVhInPx = () => {
19
+ const detector = document.createElement('div');
20
+ detector.style.position = 'fixed';
21
+ detector.style.bottom = `${getHeightWithSafeArea()}px`;
22
+ detector.style.left = '0';
23
+ detector.style.height = '100vh';
24
+ detector.style.visibility = 'hidden';
25
+ detector.style.zIndex = '-1';
26
+ document.body.appendChild(detector);
27
+ const dvhInPx = detector.clientHeight;
28
+ document.body.removeChild(detector);
29
+ return dvhInPx;
30
+ };
31
+ const getFillAvailableInPx = () => {
32
+ const detector = document.createElement('div');
33
+ detector.style.position = 'fixed';
34
+ detector.style.bottom = `${getHeightWithSafeArea()}px`;
35
+ detector.style.left = '0';
36
+ detector.style.height = '-webkit-fill-available';
37
+ detector.style.visibility = 'hidden';
38
+ detector.style.zIndex = '-1';
39
+ document.body.appendChild(detector);
40
+ const dvhInPx = detector.clientHeight;
41
+ document.body.removeChild(detector);
42
+ return dvhInPx;
43
+ };
44
+ const getHeightWithSafeArea = () => {
45
+ const root = document.documentElement;
46
+ const value = getComputedStyle(root).getPropertyValue('--safe-area-inset-bottom');
47
+ const numericValue = parseInt(value) || 0;
48
+ return numericValue;
49
+ };
50
+ const dvhToPx = (dvh) => {
51
+ return Math.round((dvh / 100) * document.documentElement.clientHeight);
52
+ };
53
+ const systemInfo = {
54
+ visualViewport: (_a = window.visualViewport) === null || _a === void 0 ? void 0 : _a.height,
55
+ innerHeight: window.innerHeight,
56
+ clientHeight: document.documentElement.clientHeight,
57
+ screenHeight: window.screen.height,
58
+ bodyHeight: (_b = document === null || document === void 0 ? void 0 : document.body) === null || _b === void 0 ? void 0 : _b.clientHeight,
59
+ agent: navigator.userAgent,
60
+ version: '1.19.14',
61
+ safeArea: getHeightWithSafeArea(),
62
+ dvh: dvhToPx(100),
63
+ dvhInPx: getDvhInPx(),
64
+ vhInPx: getVhInPx(),
65
+ fillAvailableInPx: getFillAvailableInPx()
66
+ };
67
+ console.log(systemInfo, 'fundebug-init--------------------->systemInfo');
68
+ if ('fundebug' in window) {
69
+ window === null || window === void 0 ? void 0 : window.fundebug.notify('Collect_Info', 'init', { metaData: { systemInfo, otherInfo: {} } });
70
+ }
4
71
  const getVisibleContentHeight = () => {
5
72
  if (typeof window === 'undefined')
6
73
  return 0;
@@ -17,10 +84,28 @@ export const useVisibleHeight = () => {
17
84
  return height;
18
85
  };
19
86
  const updateHeight = useCallback(() => {
20
- var _a;
21
- const height = ((_a = document === null || document === void 0 ? void 0 : document.documentElement) === null || _a === void 0 ? void 0 : _a.clientHeight) || (window === null || window === void 0 ? void 0 : window.innerHeight);
87
+ var _a, _b, _c;
88
+ const systemInfo = {
89
+ visualViewport: (_a = window.visualViewport) === null || _a === void 0 ? void 0 : _a.height,
90
+ innerHeight: window.innerHeight,
91
+ clientHeight: document.documentElement.clientHeight,
92
+ screenHeight: window.screen.height,
93
+ bodyHeight: (_b = document === null || document === void 0 ? void 0 : document.body) === null || _b === void 0 ? void 0 : _b.clientHeight,
94
+ agent: navigator.userAgent,
95
+ version: '1.19.15',
96
+ safeArea: getHeightWithSafeArea(),
97
+ dvh: dvhToPx(100),
98
+ dvhInPx: getDvhInPx(),
99
+ vhInPx: getVhInPx(),
100
+ fillAvailableInPx: getFillAvailableInPx()
101
+ };
102
+ console.log(systemInfo, 'fundebug-resize--------------------->systemInfo');
103
+ if ('fundebug' in window) {
104
+ window === null || window === void 0 ? void 0 : window.fundebug.notify('Collect_Info', 'resize', { metaData: { systemInfo, otherInfo: {} } });
105
+ }
106
+ 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);
22
107
  setVisibleHeight(height);
23
- }, []);
108
+ }, [getHeightWithSafeArea, dvhToPx, getDvhInPx, getVhInPx, getFillAvailableInPx]);
24
109
  useEffect(() => {
25
110
  updateHeight();
26
111
  const events = ['resize', 'orientationchange', 'load', 'DOMContentLoaded'];
@@ -223,22 +223,22 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
223
223
  const numericValue = parseInt(value) || 0;
224
224
  return numericValue;
225
225
  };
226
- const getHeightWithSafeArea2 = () => {
226
+ const getDvhInPx = () => {
227
227
  const detector = document.createElement('div');
228
228
  detector.style.position = 'fixed';
229
- detector.style.bottom = '0';
229
+ detector.style.bottom = `${getHeightWithSafeArea()}px`;
230
230
  detector.style.left = '0';
231
- detector.style.paddingBottom = 'env(safe-area-inset-bottom)';
231
+ detector.style.height = '100dvh';
232
232
  detector.style.visibility = 'hidden';
233
+ detector.style.zIndex = '-1';
233
234
  document.body.appendChild(detector);
234
- const computedStyle = window.getComputedStyle(detector);
235
- const safeAreaBottom = parseFloat(computedStyle.paddingBottom) || 0;
235
+ const dvhInPx = detector.clientHeight;
236
236
  document.body.removeChild(detector);
237
- return safeAreaBottom;
237
+ return dvhInPx;
238
238
  };
239
239
  const height = (0, react_1.useMemo)(() => {
240
- return visibleHeight - minusHeight - tagHeight - getHeightWithSafeArea2();
241
- }, [minusHeight, visibleHeight, tagHeight, getHeightWithSafeArea2, containerHeight]);
240
+ return getDvhInPx() - minusHeight - tagHeight - getHeightWithSafeArea();
241
+ }, [minusHeight, visibleHeight, tagHeight, getHeightWithSafeArea, containerHeight, getDvhInPx]);
242
242
  const visList = (0, react_1.useMemo)(() => {
243
243
  var _a;
244
244
  const list = activeIndex === 0 && !waterFallData && !isEditor && !isDiyH5
@@ -715,10 +715,10 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
715
715
  renderToggleButton(!!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed))),
716
716
  react_1.default.createElement(WaterFall_1.default, 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)),
717
717
  react_1.default.createElement(ConsentPopup_1.default, { resolver: resolver, globalConfig: globalConfig }),
718
- openMultiPosts && (react_1.default.createElement(MultiPosts_1.default, 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)' } }))))),
718
+ openMultiPosts && (react_1.default.createElement(MultiPosts_1.default, 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)' } }))))),
719
719
  (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableCookieSetting) && (react_1.default.createElement("div", { style: {
720
720
  position: 'fixed',
721
- bottom: 'env(safe-area-inset-bottom)',
721
+ bottom: 'var(--safe-area-inset-bottom,0px)',
722
722
  left: 0,
723
723
  right: 0,
724
724
  width: '100%',
@@ -3,7 +3,74 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useVisibleHeight = void 0;
4
4
  const react_1 = require("react");
5
5
  const useVisibleHeight = () => {
6
+ var _a, _b;
6
7
  const [visibleHeight, setVisibleHeight] = (0, react_1.useState)(0);
8
+ const getDvhInPx = () => {
9
+ const detector = document.createElement('div');
10
+ detector.style.position = 'fixed';
11
+ detector.style.bottom = `${getHeightWithSafeArea()}px`;
12
+ detector.style.left = '0';
13
+ detector.style.height = '100dvh';
14
+ detector.style.visibility = 'hidden';
15
+ detector.style.zIndex = '-1';
16
+ document.body.appendChild(detector);
17
+ const dvhInPx = detector.clientHeight;
18
+ document.body.removeChild(detector);
19
+ return dvhInPx;
20
+ };
21
+ const getVhInPx = () => {
22
+ const detector = document.createElement('div');
23
+ detector.style.position = 'fixed';
24
+ detector.style.bottom = `${getHeightWithSafeArea()}px`;
25
+ detector.style.left = '0';
26
+ detector.style.height = '100vh';
27
+ detector.style.visibility = 'hidden';
28
+ detector.style.zIndex = '-1';
29
+ document.body.appendChild(detector);
30
+ const dvhInPx = detector.clientHeight;
31
+ document.body.removeChild(detector);
32
+ return dvhInPx;
33
+ };
34
+ const getFillAvailableInPx = () => {
35
+ const detector = document.createElement('div');
36
+ detector.style.position = 'fixed';
37
+ detector.style.bottom = `${getHeightWithSafeArea()}px`;
38
+ detector.style.left = '0';
39
+ detector.style.height = '-webkit-fill-available';
40
+ detector.style.visibility = 'hidden';
41
+ detector.style.zIndex = '-1';
42
+ document.body.appendChild(detector);
43
+ const dvhInPx = detector.clientHeight;
44
+ document.body.removeChild(detector);
45
+ return dvhInPx;
46
+ };
47
+ const getHeightWithSafeArea = () => {
48
+ const root = document.documentElement;
49
+ const value = getComputedStyle(root).getPropertyValue('--safe-area-inset-bottom');
50
+ const numericValue = parseInt(value) || 0;
51
+ return numericValue;
52
+ };
53
+ const dvhToPx = (dvh) => {
54
+ return Math.round((dvh / 100) * document.documentElement.clientHeight);
55
+ };
56
+ const systemInfo = {
57
+ visualViewport: (_a = window.visualViewport) === null || _a === void 0 ? void 0 : _a.height,
58
+ innerHeight: window.innerHeight,
59
+ clientHeight: document.documentElement.clientHeight,
60
+ screenHeight: window.screen.height,
61
+ bodyHeight: (_b = document === null || document === void 0 ? void 0 : document.body) === null || _b === void 0 ? void 0 : _b.clientHeight,
62
+ agent: navigator.userAgent,
63
+ version: '1.19.14',
64
+ safeArea: getHeightWithSafeArea(),
65
+ dvh: dvhToPx(100),
66
+ dvhInPx: getDvhInPx(),
67
+ vhInPx: getVhInPx(),
68
+ fillAvailableInPx: getFillAvailableInPx()
69
+ };
70
+ console.log(systemInfo, 'fundebug-init--------------------->systemInfo');
71
+ if ('fundebug' in window) {
72
+ window === null || window === void 0 ? void 0 : window.fundebug.notify('Collect_Info', 'init', { metaData: { systemInfo, otherInfo: {} } });
73
+ }
7
74
  const getVisibleContentHeight = () => {
8
75
  if (typeof window === 'undefined')
9
76
  return 0;
@@ -20,10 +87,28 @@ const useVisibleHeight = () => {
20
87
  return height;
21
88
  };
22
89
  const updateHeight = (0, react_1.useCallback)(() => {
23
- var _a;
24
- const height = ((_a = document === null || document === void 0 ? void 0 : document.documentElement) === null || _a === void 0 ? void 0 : _a.clientHeight) || (window === null || window === void 0 ? void 0 : window.innerHeight);
90
+ var _a, _b, _c;
91
+ const systemInfo = {
92
+ visualViewport: (_a = window.visualViewport) === null || _a === void 0 ? void 0 : _a.height,
93
+ innerHeight: window.innerHeight,
94
+ clientHeight: document.documentElement.clientHeight,
95
+ screenHeight: window.screen.height,
96
+ bodyHeight: (_b = document === null || document === void 0 ? void 0 : document.body) === null || _b === void 0 ? void 0 : _b.clientHeight,
97
+ agent: navigator.userAgent,
98
+ version: '1.19.15',
99
+ safeArea: getHeightWithSafeArea(),
100
+ dvh: dvhToPx(100),
101
+ dvhInPx: getDvhInPx(),
102
+ vhInPx: getVhInPx(),
103
+ fillAvailableInPx: getFillAvailableInPx()
104
+ };
105
+ console.log(systemInfo, 'fundebug-resize--------------------->systemInfo');
106
+ if ('fundebug' in window) {
107
+ window === null || window === void 0 ? void 0 : window.fundebug.notify('Collect_Info', 'resize', { metaData: { systemInfo, otherInfo: {} } });
108
+ }
109
+ 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);
25
110
  setVisibleHeight(height);
26
- }, []);
111
+ }, [getHeightWithSafeArea, dvhToPx, getDvhInPx, getVhInPx, getFillAvailableInPx]);
27
112
  (0, react_1.useEffect)(() => {
28
113
  updateHeight();
29
114
  const events = ['resize', 'orientationchange', 'load', 'DOMContentLoaded'];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pb-sxp-ui",
3
- "version": "1.19.13",
3
+ "version": "1.19.15",
4
4
  "description": "React enterprise-class UI components",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",
@@ -39,6 +39,7 @@
39
39
  "@emotion/css": "^11.11.2",
40
40
  "eslint": "^8.48.0",
41
41
  "eventemitter3": "^5.0.1",
42
+ "fundebug-javascript": "^2.8.8",
42
43
  "less": "^4.2.0",
43
44
  "lodash": "^4.17.21",
44
45
  "pako": "^2.1.0",