pb-sxp-ui 1.15.41 → 1.15.42
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 +66 -51
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +66 -51
- 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 +66 -51
- 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/PictureGroup/index.d.ts +5 -0
- package/es/core/components/SxpPageRender/PictureGroup/index.js +37 -13
- package/es/core/components/SxpPageRender/VideoWidget/index.js +27 -38
- package/es/core/components/SxpPageRender/index.js +4 -2
- package/lib/core/components/SxpPageRender/PictureGroup/index.d.ts +5 -0
- package/lib/core/components/SxpPageRender/PictureGroup/index.js +36 -12
- package/lib/core/components/SxpPageRender/VideoWidget/index.js +27 -38
- package/lib/core/components/SxpPageRender/index.js +4 -2
- package/package.json +1 -1
package/dist/pb-ui.js
CHANGED
@@ -17818,6 +17818,26 @@ Made in Italy` })));
|
|
17818
17818
|
return;
|
17819
17819
|
(_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.play();
|
17820
17820
|
}, [videoRef === null || videoRef === void 0 ? void 0 : videoRef.current]);
|
17821
|
+
const handleEnd = () => {
|
17822
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
17823
|
+
if (!videoRef.current)
|
17824
|
+
return;
|
17825
|
+
if (isDiyH5) {
|
17826
|
+
(_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.pause();
|
17827
|
+
if (!loopPlayRef.current)
|
17828
|
+
return;
|
17829
|
+
if (index === (data === null || data === void 0 ? void 0 : data.length) - 1) {
|
17830
|
+
(_c = (_b = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _b === void 0 ? void 0 : _b.swiper) === null || _c === void 0 ? void 0 : _c.slideTo(0);
|
17831
|
+
}
|
17832
|
+
else {
|
17833
|
+
const i = (_e = (_d = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _d === void 0 ? void 0 : _d.swiper) === null || _e === void 0 ? void 0 : _e.activeIndex;
|
17834
|
+
(_g = (_f = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _f === void 0 ? void 0 : _f.swiper) === null || _g === void 0 ? void 0 : _g.slideTo(i + 1);
|
17835
|
+
}
|
17836
|
+
}
|
17837
|
+
else {
|
17838
|
+
(_h = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _h === void 0 ? void 0 : _h.play();
|
17839
|
+
}
|
17840
|
+
};
|
17821
17841
|
const PAUSE_ICON = useIconLink('/pb_static/06f28a2025c74c1cb49be6767316d827.png');
|
17822
17842
|
const handlePlaying = React.useCallback(() => {
|
17823
17843
|
if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current))
|
@@ -17842,11 +17862,6 @@ Made in Italy` })));
|
|
17842
17862
|
isFirstPlayRef.current = false;
|
17843
17863
|
}
|
17844
17864
|
}), [bffEventReport, data, index, isFirstPlayRef, videoRef === null || videoRef === void 0 ? void 0 : videoRef.current]);
|
17845
|
-
const setCurrentTimeByStartTime = React.useCallback(() => {
|
17846
|
-
if (isDiyH5) {
|
17847
|
-
videoRef.current.currentTime = scene === null || scene === void 0 ? void 0 : scene.startTime;
|
17848
|
-
}
|
17849
|
-
}, []);
|
17850
17865
|
const handLoadeddata = React.useCallback(() => {
|
17851
17866
|
if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) || firstFrameSrc || !blur)
|
17852
17867
|
return;
|
@@ -17871,13 +17886,12 @@ Made in Italy` })));
|
|
17871
17886
|
const handleLoadedmetadata = React.useCallback(() => {
|
17872
17887
|
if (!videoRef.current)
|
17873
17888
|
return;
|
17874
|
-
setCurrentTimeByStartTime();
|
17875
17889
|
loadedTimeRef.current = new Date();
|
17876
17890
|
handleStartPlay();
|
17877
17891
|
handLoadeddata();
|
17878
17892
|
}, [videoRef.current, handLoadeddata, handleStartPlay]);
|
17879
17893
|
const handleClickVideo = React.useCallback((type) => () => {
|
17880
|
-
var _a, _b, _c, _d, _e
|
17894
|
+
var _a, _b, _c, _d, _e;
|
17881
17895
|
if (!videoRef.current)
|
17882
17896
|
return;
|
17883
17897
|
if (!isLoadFinish)
|
@@ -17898,13 +17912,10 @@ Made in Italy` })));
|
|
17898
17912
|
break;
|
17899
17913
|
default:
|
17900
17914
|
if (isPause) {
|
17901
|
-
|
17902
|
-
videoRef.current.currentTime = scene === null || scene === void 0 ? void 0 : scene.startTime;
|
17903
|
-
}
|
17904
|
-
(_e = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _e === void 0 ? void 0 : _e.play();
|
17915
|
+
(_d = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _d === void 0 ? void 0 : _d.play();
|
17905
17916
|
}
|
17906
17917
|
else {
|
17907
|
-
(
|
17918
|
+
(_e = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _e === void 0 ? void 0 : _e.pause();
|
17908
17919
|
}
|
17909
17920
|
setIsPauseVideo(!isPause);
|
17910
17921
|
break;
|
@@ -17942,27 +17953,8 @@ Made in Italy` })));
|
|
17942
17953
|
const handleWaiting = React.useCallback(() => {
|
17943
17954
|
setWaiting(true);
|
17944
17955
|
}, []);
|
17945
|
-
const handleTimeUpload = () => {
|
17946
|
-
if (!videoRef.current || !isDiyH5)
|
17947
|
-
return;
|
17948
|
-
setTimeout(() => {
|
17949
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
17950
|
-
if (Math.round((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.currentTime) >= ((_b = scene === null || scene === void 0 ? void 0 : scene.endTime) !== null && _b !== void 0 ? _b : 0)) {
|
17951
|
-
(_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.pause();
|
17952
|
-
if (!loopPlayRef.current)
|
17953
|
-
return;
|
17954
|
-
if (index === (data === null || data === void 0 ? void 0 : data.length) - 1) {
|
17955
|
-
(_e = (_d = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _d === void 0 ? void 0 : _d.swiper) === null || _e === void 0 ? void 0 : _e.slideTo(0);
|
17956
|
-
}
|
17957
|
-
else {
|
17958
|
-
const i = (_g = (_f = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _f === void 0 ? void 0 : _f.swiper) === null || _g === void 0 ? void 0 : _g.activeIndex;
|
17959
|
-
(_j = (_h = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _h === void 0 ? void 0 : _h.swiper) === null || _j === void 0 ? void 0 : _j.slideTo(i + 1);
|
17960
|
-
}
|
17961
|
-
}
|
17962
|
-
});
|
17963
|
-
};
|
17964
17956
|
React.useEffect(() => {
|
17965
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k
|
17957
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
17966
17958
|
if (!isActive)
|
17967
17959
|
return;
|
17968
17960
|
const videoSrc = videoUrl;
|
@@ -17983,7 +17975,6 @@ Made in Italy` })));
|
|
17983
17975
|
hls === null || hls === void 0 ? void 0 : hls.attachMedia(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current);
|
17984
17976
|
hls === null || hls === void 0 ? void 0 : hls.on(Hls.Events.MANIFEST_PARSED, function () {
|
17985
17977
|
var _a;
|
17986
|
-
setCurrentTimeByStartTime();
|
17987
17978
|
(_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.play();
|
17988
17979
|
});
|
17989
17980
|
}
|
@@ -17997,12 +17988,11 @@ Made in Italy` })));
|
|
17997
17988
|
(_e = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _e === void 0 ? void 0 : _e.addEventListener('play', handleStartPlay);
|
17998
17989
|
(_f = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _f === void 0 ? void 0 : _f.addEventListener('playing', handlePlaying);
|
17999
17990
|
(_g = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _g === void 0 ? void 0 : _g.addEventListener('pause', handlePause);
|
18000
|
-
(_h = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _h === void 0 ? void 0 : _h.addEventListener('ended',
|
17991
|
+
(_h = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _h === void 0 ? void 0 : _h.addEventListener('ended', handleEnd);
|
18001
17992
|
(_j = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _j === void 0 ? void 0 : _j.addEventListener('canplay', handlePlay);
|
18002
17993
|
(_k = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _k === void 0 ? void 0 : _k.addEventListener('waiting', handleWaiting);
|
18003
|
-
(_l = videoRef.current) === null || _l === void 0 ? void 0 : _l.addEventListener('timeupdate', handleTimeUpload);
|
18004
17994
|
return () => {
|
18005
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k
|
17995
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
18006
17996
|
const isPause = (_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.paused;
|
18007
17997
|
if (!isPause)
|
18008
17998
|
handlePause();
|
@@ -18014,10 +18004,9 @@ Made in Italy` })));
|
|
18014
18004
|
(_e = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _e === void 0 ? void 0 : _e.removeEventListener('play', handleStartPlay);
|
18015
18005
|
(_f = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _f === void 0 ? void 0 : _f.removeEventListener('playing', handlePlaying);
|
18016
18006
|
(_g = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _g === void 0 ? void 0 : _g.removeEventListener('pause', handlePause);
|
18017
|
-
(_h = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _h === void 0 ? void 0 : _h.removeEventListener('ended',
|
18007
|
+
(_h = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _h === void 0 ? void 0 : _h.removeEventListener('ended', handleEnd);
|
18018
18008
|
(_j = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _j === void 0 ? void 0 : _j.removeEventListener('canplay', handlePlay);
|
18019
18009
|
(_k = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _k === void 0 ? void 0 : _k.removeEventListener('waiting', handleWaiting);
|
18020
|
-
(_l = videoRef.current) === null || _l === void 0 ? void 0 : _l.removeEventListener('timeupdate', handleTimeUpload);
|
18021
18010
|
};
|
18022
18011
|
}, [isActive]);
|
18023
18012
|
React.useEffect(() => {
|
@@ -18228,19 +18217,43 @@ Made in Italy` })));
|
|
18228
18217
|
}, onLoad: onShowFirstImage }))));
|
18229
18218
|
};
|
18230
18219
|
|
18231
|
-
const PictureGroup$4 = ({ imgUrls,
|
18220
|
+
const PictureGroup$4 = React.forwardRef(({ imgUrls, data, height, rec, index, onViewImageEndEvent, onViewImageStartEvent, imgUrlsPostConfig, swiperRef }, ref) => {
|
18232
18221
|
var _a, _b;
|
18233
18222
|
const { isActive } = useSwiperSlide();
|
18234
|
-
const { sxpParameter, openHashtag } = useSxpDataSource();
|
18223
|
+
const { sxpParameter, openHashtag, isDiyH5 } = useSxpDataSource();
|
18235
18224
|
const [isLoad, setIsLoad] = React.useState(false);
|
18236
18225
|
const [imgInfo, setImgInfo] = React.useState();
|
18237
18226
|
const [swiperActiveIndex, setSwiperActiveIndex] = React.useState(0);
|
18238
|
-
const
|
18227
|
+
const imgsSwiperRef = React.useRef();
|
18239
18228
|
const isFirstPlayRef = React.useRef(true);
|
18229
|
+
const loopPlayRef = React.useRef(true);
|
18240
18230
|
const initTime = new Date();
|
18231
|
+
React.useImperativeHandle(ref, () => {
|
18232
|
+
return {
|
18233
|
+
setLoopPlay(v) {
|
18234
|
+
loopPlayRef.current = v;
|
18235
|
+
}
|
18236
|
+
};
|
18237
|
+
});
|
18238
|
+
React.useEffect(() => {
|
18239
|
+
if (isLoad && isActive && isDiyH5) {
|
18240
|
+
setTimeout(() => {
|
18241
|
+
var _a, _b, _c, _d, _e, _f;
|
18242
|
+
if (!loopPlayRef.current)
|
18243
|
+
return;
|
18244
|
+
if (index === (data === null || data === void 0 ? void 0 : data.length) - 1) {
|
18245
|
+
(_b = (_a = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _a === void 0 ? void 0 : _a.swiper) === null || _b === void 0 ? void 0 : _b.slideTo(0);
|
18246
|
+
}
|
18247
|
+
else {
|
18248
|
+
const i = (_d = (_c = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _c === void 0 ? void 0 : _c.swiper) === null || _d === void 0 ? void 0 : _d.activeIndex;
|
18249
|
+
(_f = (_e = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _e === void 0 ? void 0 : _e.swiper) === null || _f === void 0 ? void 0 : _f.slideTo(i + 1);
|
18250
|
+
}
|
18251
|
+
}, 3000);
|
18252
|
+
}
|
18253
|
+
}, [isLoad, isActive, isDiyH5, data, index, swiperRef]);
|
18241
18254
|
React.useEffect(() => {
|
18242
18255
|
if (isLoad && isActive) {
|
18243
|
-
(
|
18256
|
+
(imgsSwiperRef === null || imgsSwiperRef === void 0 ? void 0 : imgsSwiperRef.current) && imgsSwiperRef.current.swiper.autoplay.start();
|
18244
18257
|
if (openHashtag) {
|
18245
18258
|
onViewImageEndEvent(rec);
|
18246
18259
|
}
|
@@ -18250,7 +18263,7 @@ Made in Italy` })));
|
|
18250
18263
|
}
|
18251
18264
|
}
|
18252
18265
|
else {
|
18253
|
-
(
|
18266
|
+
(imgsSwiperRef === null || imgsSwiperRef === void 0 ? void 0 : imgsSwiperRef.current) && imgsSwiperRef.current.swiper.autoplay.stop();
|
18254
18267
|
}
|
18255
18268
|
}, [rec, isActive, onViewImageEndEvent, openHashtag, index, onViewImageStartEvent, isLoad, imgInfo]);
|
18256
18269
|
const showFirstImageFn = React.useCallback((e) => __awaiter(void 0, void 0, void 0, function* () {
|
@@ -18277,13 +18290,13 @@ Made in Italy` })));
|
|
18277
18290
|
};
|
18278
18291
|
}, [isActive, imgInfo]);
|
18279
18292
|
const handleMouseEnter = React.useCallback(() => {
|
18280
|
-
if (
|
18281
|
-
|
18293
|
+
if (imgsSwiperRef.current && imgsSwiperRef.current.swiper && isAlly) {
|
18294
|
+
imgsSwiperRef.current.swiper.autoplay.stop();
|
18282
18295
|
}
|
18283
18296
|
}, []);
|
18284
18297
|
const handleMouseLeave = React.useCallback(() => {
|
18285
|
-
if (
|
18286
|
-
|
18298
|
+
if (imgsSwiperRef.current && imgsSwiperRef.current.swiper && isAlly) {
|
18299
|
+
imgsSwiperRef.current.swiper.autoplay.start();
|
18287
18300
|
}
|
18288
18301
|
}, []);
|
18289
18302
|
const handleSlideChange = React.useCallback((swiper) => {
|
@@ -18304,7 +18317,7 @@ Made in Italy` })));
|
|
18304
18317
|
enabled: true
|
18305
18318
|
}
|
18306
18319
|
}
|
18307
|
-
: {}), { loop: true, ref:
|
18320
|
+
: {}), { loop: true, ref: imgsSwiperRef, onSlideChange: handleSlideChange, className: css.css(Object.assign(Object.assign({ '.swiper-pagination': {
|
18308
18321
|
bottom: (_a = imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.marginBottom) !== null && _a !== void 0 ? _a : 0,
|
18309
18322
|
fontSize: '14px'
|
18310
18323
|
} }, ((imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.dotsBgColor) && {
|
@@ -18321,7 +18334,7 @@ Made in Italy` })));
|
|
18321
18334
|
return (React.createElement(SwiperSlide, { key: srcKey, "aria-hidden": srcKey !== swiperActiveIndex },
|
18322
18335
|
React.createElement(Picture, { src: !isLoad && srcKey > 0 ? '' : url, height: height, imgUrlsPostConfig: imgUrlsPostConfig, onShowFirstImage: showFirstImageFn })));
|
18323
18336
|
}))));
|
18324
|
-
};
|
18337
|
+
});
|
18325
18338
|
var PictureGroup$5 = React.memo(PictureGroup$4);
|
18326
18339
|
|
18327
18340
|
/*
|
@@ -18621,6 +18634,7 @@ Made in Italy` })));
|
|
18621
18634
|
const skipLinkRef = React.useRef(false);
|
18622
18635
|
const [pageNum, setPageNum] = React.useState(2);
|
18623
18636
|
const videoWidgetRef = React.useRef(null);
|
18637
|
+
const pictureGroupRef = React.useRef(null);
|
18624
18638
|
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 } = useSxpDataSource();
|
18625
18639
|
const { backMainFeed, productView, jumpToWeb } = useEventReport();
|
18626
18640
|
const isShowFingerTip = React.useMemo(() => {
|
@@ -18759,8 +18773,9 @@ Made in Italy` })));
|
|
18759
18773
|
refreshFeSession
|
18760
18774
|
]);
|
18761
18775
|
const handleSessionExpire = React.useCallback(lodash.debounce(() => {
|
18762
|
-
var _a;
|
18776
|
+
var _a, _b;
|
18763
18777
|
(_a = videoWidgetRef.current) === null || _a === void 0 ? void 0 : _a.setLoopPlay(false);
|
18778
|
+
(_b = pictureGroupRef.current) === null || _b === void 0 ? void 0 : _b.setLoopPlay(false);
|
18764
18779
|
refreshFeSession === null || refreshFeSession === void 0 ? void 0 : refreshFeSession(false, handleSessionCompleted);
|
18765
18780
|
}, 1000), [handleSessionCompleted, refreshFeSession]);
|
18766
18781
|
React.useEffect(() => {
|
@@ -18838,7 +18853,7 @@ Made in Italy` })));
|
|
18838
18853
|
return (React.createElement(VideoWidget$5, 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 })));
|
18839
18854
|
}
|
18840
18855
|
if ((_h = rec === null || rec === void 0 ? void 0 : rec.video) === null || _h === void 0 ? void 0 : _h.imgUrls) {
|
18841
|
-
return (React.createElement(PictureGroup$5, { 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 }));
|
18856
|
+
return (React.createElement(PictureGroup$5, Object.assign({ data: data }, (activeIndex === index && { ref: pictureGroupRef }), { 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, swiperRef: swiperRef })));
|
18842
18857
|
}
|
18843
18858
|
if (rec.product && Array.isArray(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.productPost) && ((_j = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.productPost) === null || _j === void 0 ? void 0 : _j.length) > 0) {
|
18844
18859
|
return (_k = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.productPost) === null || _k === void 0 ? void 0 : _k.map((value, idx) => {
|