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.cjs +131 -189
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +3 -11
- package/dist/index.js +131 -189
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +6 -6
- package/dist/index.min.cjs.map +1 -1
- package/dist/index.min.js +6 -6
- package/dist/index.min.js.map +1 -1
- package/dist/pb-ui.js +131 -189
- package/dist/pb-ui.js.map +1 -1
- package/dist/pb-ui.min.js +6 -6
- package/dist/pb-ui.min.js.map +1 -1
- package/es/core/components/SxpPageRender/Modal/index.js +14 -11
- package/es/core/components/SxpPageRender/VideoWidget/index.d.ts +1 -0
- package/es/core/components/SxpPageRender/VideoWidget/index.js +3 -3
- package/es/core/components/SxpPageRender/index.js +15 -32
- package/es/core/hooks/useVisibleHeight.d.ts +4 -1
- package/es/core/hooks/useVisibleHeight.js +37 -102
- package/lib/core/components/SxpPageRender/Modal/index.js +14 -11
- package/lib/core/components/SxpPageRender/VideoWidget/index.d.ts +1 -0
- package/lib/core/components/SxpPageRender/VideoWidget/index.js +3 -3
- package/lib/core/components/SxpPageRender/index.js +15 -32
- package/lib/core/hooks/useVisibleHeight.d.ts +4 -1
- package/lib/core/hooks/useVisibleHeight.js +37 -102
- package/package.json +1 -2
|
@@ -31,7 +31,7 @@ const EditorDataProvider_1 = require("../../../core/context/EditorDataProvider")
|
|
|
31
31
|
const NavBack_1 = tslib_1.__importDefault(require("./NavBack"));
|
|
32
32
|
const tool_1 = require("../../../core/utils/tool");
|
|
33
33
|
const useVisibleHeight_1 = require("../../../core/hooks/useVisibleHeight");
|
|
34
|
-
const SxpPageRender = ({ globalConfig, descStyle, containerHeight
|
|
34
|
+
const SxpPageRender = ({ globalConfig, descStyle, containerHeight, containerWidth = window.innerWidth, tempMap, resolver, data = [], ctaType, tipText, nudge, _schema, hashTagStyle, hashTagRightMargin, tagList = [], defaultData }) => {
|
|
35
35
|
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;
|
|
36
36
|
const mutedIcon = (0, useIconLink_1.useIconLink)('/pb_static/5beaaa5ce7f3477b99db3838619cc471.png');
|
|
37
37
|
const unmutedIcon = (0, useIconLink_1.useIconLink)('/pb_static/fea8668a8a894e4aa3a86bcc775e895e.png');
|
|
@@ -51,7 +51,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
|
51
51
|
const fbcRef = (0, react_1.useRef)('');
|
|
52
52
|
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 } = (0, hooks_1.useSxpDataSource)();
|
|
53
53
|
const { backMainFeed, productView, jumpToWeb } = (0, useEventReport_1.useEventReport)();
|
|
54
|
-
const visibleHeight = (0, useVisibleHeight_1.useVisibleHeight)();
|
|
54
|
+
const { visibleHeight, bottomHeight } = (0, useVisibleHeight_1.useVisibleHeight)();
|
|
55
55
|
const isShowFingerTip = (0, react_1.useMemo)(() => {
|
|
56
56
|
return data.length > 0 && !loading && ((0, localStore_1.getFeUserState)() || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableSwiperTip));
|
|
57
57
|
}, [data, loading, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableSwiperTip]);
|
|
@@ -217,28 +217,10 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
|
217
217
|
}
|
|
218
218
|
return minusHeight;
|
|
219
219
|
}, [globalConfig]);
|
|
220
|
-
const getHeightWithSafeArea = () => {
|
|
221
|
-
const root = document.documentElement;
|
|
222
|
-
const value = getComputedStyle(root).getPropertyValue('--safe-area-inset-bottom');
|
|
223
|
-
const numericValue = parseInt(value) || 0;
|
|
224
|
-
return numericValue;
|
|
225
|
-
};
|
|
226
|
-
const getDvhInPx = () => {
|
|
227
|
-
const detector = document.createElement('div');
|
|
228
|
-
detector.style.position = 'fixed';
|
|
229
|
-
detector.style.bottom = `${getHeightWithSafeArea()}px`;
|
|
230
|
-
detector.style.left = '0';
|
|
231
|
-
detector.style.height = '100dvh';
|
|
232
|
-
detector.style.visibility = 'hidden';
|
|
233
|
-
detector.style.zIndex = '-1';
|
|
234
|
-
document.body.appendChild(detector);
|
|
235
|
-
const dvhInPx = detector.clientHeight;
|
|
236
|
-
document.body.removeChild(detector);
|
|
237
|
-
return dvhInPx;
|
|
238
|
-
};
|
|
239
220
|
const height = (0, react_1.useMemo)(() => {
|
|
240
|
-
|
|
241
|
-
|
|
221
|
+
const h = containerHeight || visibleHeight;
|
|
222
|
+
return h - minusHeight - tagHeight;
|
|
223
|
+
}, [containerHeight, visibleHeight, minusHeight, tagHeight]);
|
|
242
224
|
const visList = (0, react_1.useMemo)(() => {
|
|
243
225
|
var _a;
|
|
244
226
|
const list = activeIndex === 0 && !waterFallData && !isEditor && !isDiyH5
|
|
@@ -280,7 +262,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
|
280
262
|
return (react_1.default.createElement(MultiPosts_1.default, 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)));
|
|
281
263
|
}
|
|
282
264
|
if ((_g = rec === null || rec === void 0 ? void 0 : rec.video) === null || _g === void 0 ? void 0 : _g.url) {
|
|
283
|
-
return (react_1.default.createElement(VideoWidget_1.default, 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 })));
|
|
265
|
+
return (react_1.default.createElement(VideoWidget_1.default, 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 })));
|
|
284
266
|
}
|
|
285
267
|
if ((_h = rec === null || rec === void 0 ? void 0 : rec.video) === null || _h === void 0 ? void 0 : _h.imgUrls) {
|
|
286
268
|
return (react_1.default.createElement(PictureGroup_1.default, { 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 }));
|
|
@@ -307,7 +289,8 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
|
307
289
|
tipText,
|
|
308
290
|
resolver,
|
|
309
291
|
schema,
|
|
310
|
-
isReload
|
|
292
|
+
isReload,
|
|
293
|
+
visibleHeight
|
|
311
294
|
]);
|
|
312
295
|
const onExpandableChange = (0, react_1.useCallback)((v) => {
|
|
313
296
|
setIsShowMore(v);
|
|
@@ -380,7 +363,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
|
380
363
|
top += minusHeight;
|
|
381
364
|
}
|
|
382
365
|
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconFixed) && (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconYPosit) !== 'top') {
|
|
383
|
-
top +=
|
|
366
|
+
top += bottomHeight;
|
|
384
367
|
}
|
|
385
368
|
if (rec === null || rec === void 0 ? void 0 : rec.video) {
|
|
386
369
|
return (react_1.default.createElement(LikeButton_1.default, { 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: {
|
|
@@ -390,7 +373,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
|
390
373
|
}, position: index }));
|
|
391
374
|
}
|
|
392
375
|
return null;
|
|
393
|
-
}, [globalConfig, waterFallData]);
|
|
376
|
+
}, [globalConfig, waterFallData, bottomHeight]);
|
|
394
377
|
const handleViewImageStartEnd = (item) => {
|
|
395
378
|
var _a, _b, _c, _d, _e, _f;
|
|
396
379
|
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)) {
|
|
@@ -612,7 +595,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
|
612
595
|
top += minusHeight;
|
|
613
596
|
}
|
|
614
597
|
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed) && (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconYPosit) !== 'top') {
|
|
615
|
-
top +=
|
|
598
|
+
top += bottomHeight;
|
|
616
599
|
}
|
|
617
600
|
return (((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowMute) === undefined || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowMute) === true) && (react_1.default.createElement(ToggleButton_1.default, { style: {
|
|
618
601
|
position: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed) ? 'fixed' : 'absolute',
|
|
@@ -622,7 +605,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
|
622
605
|
[(_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,
|
|
623
606
|
[(_f = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconYPosit) !== null && _f !== void 0 ? _f : 'bottom']: top
|
|
624
607
|
}, 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 })));
|
|
625
|
-
}, [globalConfig, visList, activeIndex, isMuted, waterFallData]);
|
|
608
|
+
}, [globalConfig, visList, activeIndex, isMuted, waterFallData, bottomHeight]);
|
|
626
609
|
const renderView = (0, react_1.useMemo)(() => {
|
|
627
610
|
if (loading) {
|
|
628
611
|
return (react_1.default.createElement("div", { style: { height, width: containerWidth, display: 'flex', justifyContent: 'center', alignItems: 'center' } },
|
|
@@ -654,7 +637,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
|
654
637
|
isReload,
|
|
655
638
|
renderToggleButton
|
|
656
639
|
]);
|
|
657
|
-
return (react_1.default.createElement("div", { id: 'sxp-render', className: 'clc-sxp-container' },
|
|
640
|
+
return (react_1.default.createElement("div", { id: 'sxp-render', className: 'clc-sxp-container', style: { height } },
|
|
658
641
|
(data === null || data === void 0 ? void 0 : data.length) < 1 && loading ? (react_1.default.createElement("div", { style: { height, width: containerWidth, display: 'flex', justifyContent: 'center', alignItems: 'center' } },
|
|
659
642
|
react_1.default.createElement("img", { width: 64, height: 64, src: loadingImage, alt: 'loading...', style: { objectFit: 'contain' } }))) : (react_1.default.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` })) },
|
|
660
643
|
waterFallData && (react_1.default.createElement(Navbar_1.default, { icon: left_png_1.default, 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: () => {
|
|
@@ -715,10 +698,10 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
|
715
698
|
renderToggleButton(!!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed))),
|
|
716
699
|
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
700
|
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: '
|
|
701
|
+
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: bottomHeight + 'px' } }))))),
|
|
719
702
|
(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableCookieSetting) && (react_1.default.createElement("div", { style: {
|
|
720
703
|
position: 'fixed',
|
|
721
|
-
bottom: '
|
|
704
|
+
bottom: bottomHeight + 'px',
|
|
722
705
|
left: 0,
|
|
723
706
|
right: 0,
|
|
724
707
|
width: '100%',
|
|
@@ -2,81 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useVisibleHeight = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
|
-
|
|
6
|
-
var _a, _b;
|
|
5
|
+
function useVisibleHeight() {
|
|
7
6
|
const [visibleHeight, setVisibleHeight] = (0, react_1.useState)(0);
|
|
8
|
-
const
|
|
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 fontSize = parseFloat(getComputedStyle(document.documentElement).fontSize);
|
|
57
|
-
const isScaled = fontSize !== 52;
|
|
58
|
-
const isZoomed = screen.width <= 375 && screen.height <= 667 && window.devicePixelRatio < 3;
|
|
59
|
-
const systemInfo = {
|
|
60
|
-
visualViewport: (_a = window.visualViewport) === null || _a === void 0 ? void 0 : _a.height,
|
|
61
|
-
innerHeight: window.innerHeight,
|
|
62
|
-
clientHeight: document.documentElement.clientHeight,
|
|
63
|
-
screenHeight: window.screen.height,
|
|
64
|
-
bodyHeight: (_b = document === null || document === void 0 ? void 0 : document.body) === null || _b === void 0 ? void 0 : _b.clientHeight,
|
|
65
|
-
agent: navigator.userAgent,
|
|
66
|
-
version: '1.19.17',
|
|
67
|
-
safeArea: getHeightWithSafeArea(),
|
|
68
|
-
dvh: dvhToPx(100),
|
|
69
|
-
dvhInPx: getDvhInPx(),
|
|
70
|
-
vhInPx: getVhInPx(),
|
|
71
|
-
fillAvailableInPx: getFillAvailableInPx(),
|
|
72
|
-
isScaled,
|
|
73
|
-
isZoomed,
|
|
74
|
-
meta: `${window === null || window === void 0 ? void 0 : window.Instagram},${window === null || window === void 0 ? void 0 : window.Facebook}`
|
|
75
|
-
};
|
|
76
|
-
console.log(systemInfo, 'fundebug-init--------------------->systemInfo');
|
|
77
|
-
if ('fundebug' in window) {
|
|
78
|
-
window === null || window === void 0 ? void 0 : window.fundebug.notify('Collect_Info', 'init', { metaData: { systemInfo, otherInfo: {} } });
|
|
79
|
-
}
|
|
7
|
+
const [bottomHeight, setBottomHeight] = (0, react_1.useState)(0);
|
|
80
8
|
const getVisibleContentHeight = () => {
|
|
81
9
|
if (typeof window === 'undefined')
|
|
82
10
|
return 0;
|
|
@@ -93,33 +21,42 @@ const useVisibleHeight = () => {
|
|
|
93
21
|
return height;
|
|
94
22
|
};
|
|
95
23
|
const updateHeight = (0, react_1.useCallback)(() => {
|
|
96
|
-
var _a
|
|
97
|
-
const
|
|
98
|
-
const
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
24
|
+
var _a;
|
|
25
|
+
const visibleHeight = getVisibleContentHeight();
|
|
26
|
+
const screenHeight = (_a = window.screen) === null || _a === void 0 ? void 0 : _a.height;
|
|
27
|
+
const ua = navigator.userAgent;
|
|
28
|
+
const isInstagram = /Instagram/i.test(ua);
|
|
29
|
+
const isFacebook = /FBAV|FBAN|FBSN/i.test(ua);
|
|
30
|
+
if (!screenHeight || visibleHeight <= 0 || (!isInstagram && !isFacebook)) {
|
|
31
|
+
setVisibleHeight(visibleHeight);
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
const ratio = visibleHeight / screenHeight;
|
|
35
|
+
const threshold = 0.9;
|
|
36
|
+
const h = screenHeight >= 900 ? screenHeight * 0.8 : screenHeight * 0.79;
|
|
37
|
+
const isRatio = ratio >= threshold && ratio !== 1;
|
|
38
|
+
const finalHeight = isRatio ? Math.round(h) : visibleHeight;
|
|
39
|
+
if (isRatio) {
|
|
40
|
+
setBottomHeight(screenHeight - Math.round(h));
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
setBottomHeight(0);
|
|
44
|
+
}
|
|
117
45
|
if ('fundebug' in window) {
|
|
46
|
+
const systemInfo = {
|
|
47
|
+
ratio,
|
|
48
|
+
h,
|
|
49
|
+
finalHeight,
|
|
50
|
+
visibleHeight,
|
|
51
|
+
screenHeight,
|
|
52
|
+
isInstagram,
|
|
53
|
+
isFacebook,
|
|
54
|
+
ua
|
|
55
|
+
};
|
|
118
56
|
window === null || window === void 0 ? void 0 : window.fundebug.notify('Collect_Info', 'resize', { metaData: { systemInfo, otherInfo: {} } });
|
|
119
57
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
}, [getHeightWithSafeArea, dvhToPx, getDvhInPx, getVhInPx, getFillAvailableInPx]);
|
|
58
|
+
setVisibleHeight(finalHeight);
|
|
59
|
+
}, [getVisibleContentHeight]);
|
|
123
60
|
(0, react_1.useEffect)(() => {
|
|
124
61
|
updateHeight();
|
|
125
62
|
const events = ['resize', 'orientationchange', 'load', 'DOMContentLoaded'];
|
|
@@ -133,7 +70,6 @@ const useVisibleHeight = () => {
|
|
|
133
70
|
if ('virtualKeyboard' in navigator) {
|
|
134
71
|
navigator.virtualKeyboard.addEventListener('geometrychange', updateHeight);
|
|
135
72
|
}
|
|
136
|
-
const interval = setInterval(updateHeight, 1000);
|
|
137
73
|
return () => {
|
|
138
74
|
events.forEach((event) => {
|
|
139
75
|
window.removeEventListener(event, updateHeight);
|
|
@@ -145,9 +81,8 @@ const useVisibleHeight = () => {
|
|
|
145
81
|
if ('virtualKeyboard' in navigator) {
|
|
146
82
|
navigator.virtualKeyboard.removeEventListener('geometrychange', updateHeight);
|
|
147
83
|
}
|
|
148
|
-
clearInterval(interval);
|
|
149
84
|
};
|
|
150
85
|
}, [updateHeight]);
|
|
151
|
-
return visibleHeight;
|
|
152
|
-
}
|
|
86
|
+
return { visibleHeight, bottomHeight };
|
|
87
|
+
}
|
|
153
88
|
exports.useVisibleHeight = useVisibleHeight;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pb-sxp-ui",
|
|
3
|
-
"version": "1.19.
|
|
3
|
+
"version": "1.19.19",
|
|
4
4
|
"description": "React enterprise-class UI components",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -39,7 +39,6 @@
|
|
|
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",
|
|
43
42
|
"less": "^4.2.0",
|
|
44
43
|
"lodash": "^4.17.21",
|
|
45
44
|
"pako": "^2.1.0",
|