pb-sxp-ui 1.19.12 → 1.19.14

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