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.js CHANGED
@@ -17803,6 +17803,26 @@ const VideoWidget$4 = forwardRef(({ rec, index, height, data, muted, activeIndex
17803
17803
  return;
17804
17804
  (_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.play();
17805
17805
  }, [videoRef === null || videoRef === void 0 ? void 0 : videoRef.current]);
17806
+ const handleEnd = () => {
17807
+ var _a, _b, _c, _d, _e, _f, _g, _h;
17808
+ if (!videoRef.current)
17809
+ return;
17810
+ if (isDiyH5) {
17811
+ (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.pause();
17812
+ if (!loopPlayRef.current)
17813
+ return;
17814
+ if (index === (data === null || data === void 0 ? void 0 : data.length) - 1) {
17815
+ (_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);
17816
+ }
17817
+ else {
17818
+ 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;
17819
+ (_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);
17820
+ }
17821
+ }
17822
+ else {
17823
+ (_h = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _h === void 0 ? void 0 : _h.play();
17824
+ }
17825
+ };
17806
17826
  const PAUSE_ICON = useIconLink('/pb_static/06f28a2025c74c1cb49be6767316d827.png');
17807
17827
  const handlePlaying = useCallback(() => {
17808
17828
  if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current))
@@ -17827,11 +17847,6 @@ const VideoWidget$4 = forwardRef(({ rec, index, height, data, muted, activeIndex
17827
17847
  isFirstPlayRef.current = false;
17828
17848
  }
17829
17849
  }), [bffEventReport, data, index, isFirstPlayRef, videoRef === null || videoRef === void 0 ? void 0 : videoRef.current]);
17830
- const setCurrentTimeByStartTime = useCallback(() => {
17831
- if (isDiyH5) {
17832
- videoRef.current.currentTime = scene === null || scene === void 0 ? void 0 : scene.startTime;
17833
- }
17834
- }, []);
17835
17850
  const handLoadeddata = useCallback(() => {
17836
17851
  if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) || firstFrameSrc || !blur)
17837
17852
  return;
@@ -17856,13 +17871,12 @@ const VideoWidget$4 = forwardRef(({ rec, index, height, data, muted, activeIndex
17856
17871
  const handleLoadedmetadata = useCallback(() => {
17857
17872
  if (!videoRef.current)
17858
17873
  return;
17859
- setCurrentTimeByStartTime();
17860
17874
  loadedTimeRef.current = new Date();
17861
17875
  handleStartPlay();
17862
17876
  handLoadeddata();
17863
17877
  }, [videoRef.current, handLoadeddata, handleStartPlay]);
17864
17878
  const handleClickVideo = useCallback((type) => () => {
17865
- var _a, _b, _c, _d, _e, _f;
17879
+ var _a, _b, _c, _d, _e;
17866
17880
  if (!videoRef.current)
17867
17881
  return;
17868
17882
  if (!isLoadFinish)
@@ -17883,13 +17897,10 @@ const VideoWidget$4 = forwardRef(({ rec, index, height, data, muted, activeIndex
17883
17897
  break;
17884
17898
  default:
17885
17899
  if (isPause) {
17886
- if (isDiyH5 && Math.round((_d = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _d === void 0 ? void 0 : _d.currentTime) >= (scene === null || scene === void 0 ? void 0 : scene.endTime)) {
17887
- videoRef.current.currentTime = scene === null || scene === void 0 ? void 0 : scene.startTime;
17888
- }
17889
- (_e = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _e === void 0 ? void 0 : _e.play();
17900
+ (_d = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _d === void 0 ? void 0 : _d.play();
17890
17901
  }
17891
17902
  else {
17892
- (_f = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _f === void 0 ? void 0 : _f.pause();
17903
+ (_e = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _e === void 0 ? void 0 : _e.pause();
17893
17904
  }
17894
17905
  setIsPauseVideo(!isPause);
17895
17906
  break;
@@ -17927,27 +17938,8 @@ const VideoWidget$4 = forwardRef(({ rec, index, height, data, muted, activeIndex
17927
17938
  const handleWaiting = useCallback(() => {
17928
17939
  setWaiting(true);
17929
17940
  }, []);
17930
- const handleTimeUpload = () => {
17931
- if (!videoRef.current || !isDiyH5)
17932
- return;
17933
- setTimeout(() => {
17934
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
17935
- 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)) {
17936
- (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.pause();
17937
- if (!loopPlayRef.current)
17938
- return;
17939
- if (index === (data === null || data === void 0 ? void 0 : data.length) - 1) {
17940
- (_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);
17941
- }
17942
- else {
17943
- 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;
17944
- (_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);
17945
- }
17946
- }
17947
- });
17948
- };
17949
17941
  useEffect(() => {
17950
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
17942
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
17951
17943
  if (!isActive)
17952
17944
  return;
17953
17945
  const videoSrc = videoUrl;
@@ -17968,7 +17960,6 @@ const VideoWidget$4 = forwardRef(({ rec, index, height, data, muted, activeIndex
17968
17960
  hls === null || hls === void 0 ? void 0 : hls.attachMedia(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current);
17969
17961
  hls === null || hls === void 0 ? void 0 : hls.on(Hls.Events.MANIFEST_PARSED, function () {
17970
17962
  var _a;
17971
- setCurrentTimeByStartTime();
17972
17963
  (_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.play();
17973
17964
  });
17974
17965
  }
@@ -17982,12 +17973,11 @@ const VideoWidget$4 = forwardRef(({ rec, index, height, data, muted, activeIndex
17982
17973
  (_e = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _e === void 0 ? void 0 : _e.addEventListener('play', handleStartPlay);
17983
17974
  (_f = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _f === void 0 ? void 0 : _f.addEventListener('playing', handlePlaying);
17984
17975
  (_g = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _g === void 0 ? void 0 : _g.addEventListener('pause', handlePause);
17985
- (_h = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _h === void 0 ? void 0 : _h.addEventListener('ended', handlePlay);
17976
+ (_h = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _h === void 0 ? void 0 : _h.addEventListener('ended', handleEnd);
17986
17977
  (_j = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _j === void 0 ? void 0 : _j.addEventListener('canplay', handlePlay);
17987
17978
  (_k = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _k === void 0 ? void 0 : _k.addEventListener('waiting', handleWaiting);
17988
- (_l = videoRef.current) === null || _l === void 0 ? void 0 : _l.addEventListener('timeupdate', handleTimeUpload);
17989
17979
  return () => {
17990
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
17980
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
17991
17981
  const isPause = (_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.paused;
17992
17982
  if (!isPause)
17993
17983
  handlePause();
@@ -17999,10 +17989,9 @@ const VideoWidget$4 = forwardRef(({ rec, index, height, data, muted, activeIndex
17999
17989
  (_e = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _e === void 0 ? void 0 : _e.removeEventListener('play', handleStartPlay);
18000
17990
  (_f = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _f === void 0 ? void 0 : _f.removeEventListener('playing', handlePlaying);
18001
17991
  (_g = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _g === void 0 ? void 0 : _g.removeEventListener('pause', handlePause);
18002
- (_h = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _h === void 0 ? void 0 : _h.removeEventListener('ended', handlePlay);
17992
+ (_h = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _h === void 0 ? void 0 : _h.removeEventListener('ended', handleEnd);
18003
17993
  (_j = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _j === void 0 ? void 0 : _j.removeEventListener('canplay', handlePlay);
18004
17994
  (_k = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _k === void 0 ? void 0 : _k.removeEventListener('waiting', handleWaiting);
18005
- (_l = videoRef.current) === null || _l === void 0 ? void 0 : _l.removeEventListener('timeupdate', handleTimeUpload);
18006
17995
  };
18007
17996
  }, [isActive]);
18008
17997
  useEffect(() => {
@@ -18213,19 +18202,43 @@ const Picture = (props) => {
18213
18202
  }, onLoad: onShowFirstImage }))));
18214
18203
  };
18215
18204
 
18216
- const PictureGroup$4 = ({ imgUrls, width, height, rec, index, onViewImageEndEvent, onViewImageStartEvent, imgUrlsPostConfig }) => {
18205
+ const PictureGroup$4 = forwardRef(({ imgUrls, data, height, rec, index, onViewImageEndEvent, onViewImageStartEvent, imgUrlsPostConfig, swiperRef }, ref) => {
18217
18206
  var _a, _b;
18218
18207
  const { isActive } = useSwiperSlide();
18219
- const { sxpParameter, openHashtag } = useSxpDataSource();
18208
+ const { sxpParameter, openHashtag, isDiyH5 } = useSxpDataSource();
18220
18209
  const [isLoad, setIsLoad] = useState(false);
18221
18210
  const [imgInfo, setImgInfo] = useState();
18222
18211
  const [swiperActiveIndex, setSwiperActiveIndex] = useState(0);
18223
- const swiperRef = useRef();
18212
+ const imgsSwiperRef = useRef();
18224
18213
  const isFirstPlayRef = useRef(true);
18214
+ const loopPlayRef = useRef(true);
18225
18215
  const initTime = new Date();
18216
+ useImperativeHandle(ref, () => {
18217
+ return {
18218
+ setLoopPlay(v) {
18219
+ loopPlayRef.current = v;
18220
+ }
18221
+ };
18222
+ });
18223
+ useEffect(() => {
18224
+ if (isLoad && isActive && isDiyH5) {
18225
+ setTimeout(() => {
18226
+ var _a, _b, _c, _d, _e, _f;
18227
+ if (!loopPlayRef.current)
18228
+ return;
18229
+ if (index === (data === null || data === void 0 ? void 0 : data.length) - 1) {
18230
+ (_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);
18231
+ }
18232
+ else {
18233
+ 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;
18234
+ (_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);
18235
+ }
18236
+ }, 3000);
18237
+ }
18238
+ }, [isLoad, isActive, isDiyH5, data, index, swiperRef]);
18226
18239
  useEffect(() => {
18227
18240
  if (isLoad && isActive) {
18228
- (swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) && swiperRef.current.swiper.autoplay.start();
18241
+ (imgsSwiperRef === null || imgsSwiperRef === void 0 ? void 0 : imgsSwiperRef.current) && imgsSwiperRef.current.swiper.autoplay.start();
18229
18242
  if (openHashtag) {
18230
18243
  onViewImageEndEvent(rec);
18231
18244
  }
@@ -18235,7 +18248,7 @@ const PictureGroup$4 = ({ imgUrls, width, height, rec, index, onViewImageEndEven
18235
18248
  }
18236
18249
  }
18237
18250
  else {
18238
- (swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) && swiperRef.current.swiper.autoplay.stop();
18251
+ (imgsSwiperRef === null || imgsSwiperRef === void 0 ? void 0 : imgsSwiperRef.current) && imgsSwiperRef.current.swiper.autoplay.stop();
18239
18252
  }
18240
18253
  }, [rec, isActive, onViewImageEndEvent, openHashtag, index, onViewImageStartEvent, isLoad, imgInfo]);
18241
18254
  const showFirstImageFn = useCallback((e) => __awaiter(void 0, void 0, void 0, function* () {
@@ -18262,13 +18275,13 @@ const PictureGroup$4 = ({ imgUrls, width, height, rec, index, onViewImageEndEven
18262
18275
  };
18263
18276
  }, [isActive, imgInfo]);
18264
18277
  const handleMouseEnter = useCallback(() => {
18265
- if (swiperRef.current && swiperRef.current.swiper && isAlly) {
18266
- swiperRef.current.swiper.autoplay.stop();
18278
+ if (imgsSwiperRef.current && imgsSwiperRef.current.swiper && isAlly) {
18279
+ imgsSwiperRef.current.swiper.autoplay.stop();
18267
18280
  }
18268
18281
  }, []);
18269
18282
  const handleMouseLeave = useCallback(() => {
18270
- if (swiperRef.current && swiperRef.current.swiper && isAlly) {
18271
- swiperRef.current.swiper.autoplay.start();
18283
+ if (imgsSwiperRef.current && imgsSwiperRef.current.swiper && isAlly) {
18284
+ imgsSwiperRef.current.swiper.autoplay.start();
18272
18285
  }
18273
18286
  }, []);
18274
18287
  const handleSlideChange = useCallback((swiper) => {
@@ -18289,7 +18302,7 @@ const PictureGroup$4 = ({ imgUrls, width, height, rec, index, onViewImageEndEven
18289
18302
  enabled: true
18290
18303
  }
18291
18304
  }
18292
- : {}), { loop: true, ref: swiperRef, onSlideChange: handleSlideChange, className: css(Object.assign(Object.assign({ '.swiper-pagination': {
18305
+ : {}), { loop: true, ref: imgsSwiperRef, onSlideChange: handleSlideChange, className: css(Object.assign(Object.assign({ '.swiper-pagination': {
18293
18306
  bottom: (_a = imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.marginBottom) !== null && _a !== void 0 ? _a : 0,
18294
18307
  fontSize: '14px'
18295
18308
  } }, ((imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.dotsBgColor) && {
@@ -18306,7 +18319,7 @@ const PictureGroup$4 = ({ imgUrls, width, height, rec, index, onViewImageEndEven
18306
18319
  return (React.createElement(SwiperSlide, { key: srcKey, "aria-hidden": srcKey !== swiperActiveIndex },
18307
18320
  React.createElement(Picture, { src: !isLoad && srcKey > 0 ? '' : url, height: height, imgUrlsPostConfig: imgUrlsPostConfig, onShowFirstImage: showFirstImageFn })));
18308
18321
  }))));
18309
- };
18322
+ });
18310
18323
  var PictureGroup$5 = memo(PictureGroup$4);
18311
18324
 
18312
18325
  /*
@@ -18606,6 +18619,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
18606
18619
  const skipLinkRef = useRef(false);
18607
18620
  const [pageNum, setPageNum] = useState(2);
18608
18621
  const videoWidgetRef = useRef(null);
18622
+ const pictureGroupRef = useRef(null);
18609
18623
  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();
18610
18624
  const { backMainFeed, productView, jumpToWeb } = useEventReport();
18611
18625
  const isShowFingerTip = useMemo(() => {
@@ -18744,8 +18758,9 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
18744
18758
  refreshFeSession
18745
18759
  ]);
18746
18760
  const handleSessionExpire = useCallback(debounce(() => {
18747
- var _a;
18761
+ var _a, _b;
18748
18762
  (_a = videoWidgetRef.current) === null || _a === void 0 ? void 0 : _a.setLoopPlay(false);
18763
+ (_b = pictureGroupRef.current) === null || _b === void 0 ? void 0 : _b.setLoopPlay(false);
18749
18764
  refreshFeSession === null || refreshFeSession === void 0 ? void 0 : refreshFeSession(false, handleSessionCompleted);
18750
18765
  }, 1000), [handleSessionCompleted, refreshFeSession]);
18751
18766
  useEffect(() => {
@@ -18823,7 +18838,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
18823
18838
  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 })));
18824
18839
  }
18825
18840
  if ((_h = rec === null || rec === void 0 ? void 0 : rec.video) === null || _h === void 0 ? void 0 : _h.imgUrls) {
18826
- 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 }));
18841
+ 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 })));
18827
18842
  }
18828
18843
  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) {
18829
18844
  return (_k = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.productPost) === null || _k === void 0 ? void 0 : _k.map((value, idx) => {