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 CHANGED
@@ -17825,6 +17825,26 @@ const VideoWidget$4 = React.forwardRef(({ rec, index, height, data, muted, activ
17825
17825
  return;
17826
17826
  (_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.play();
17827
17827
  }, [videoRef === null || videoRef === void 0 ? void 0 : videoRef.current]);
17828
+ const handleEnd = () => {
17829
+ var _a, _b, _c, _d, _e, _f, _g, _h;
17830
+ if (!videoRef.current)
17831
+ return;
17832
+ if (isDiyH5) {
17833
+ (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.pause();
17834
+ if (!loopPlayRef.current)
17835
+ return;
17836
+ if (index === (data === null || data === void 0 ? void 0 : data.length) - 1) {
17837
+ (_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);
17838
+ }
17839
+ else {
17840
+ 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;
17841
+ (_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);
17842
+ }
17843
+ }
17844
+ else {
17845
+ (_h = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _h === void 0 ? void 0 : _h.play();
17846
+ }
17847
+ };
17828
17848
  const PAUSE_ICON = useIconLink('/pb_static/06f28a2025c74c1cb49be6767316d827.png');
17829
17849
  const handlePlaying = React.useCallback(() => {
17830
17850
  if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current))
@@ -17849,11 +17869,6 @@ const VideoWidget$4 = React.forwardRef(({ rec, index, height, data, muted, activ
17849
17869
  isFirstPlayRef.current = false;
17850
17870
  }
17851
17871
  }), [bffEventReport, data, index, isFirstPlayRef, videoRef === null || videoRef === void 0 ? void 0 : videoRef.current]);
17852
- const setCurrentTimeByStartTime = React.useCallback(() => {
17853
- if (isDiyH5) {
17854
- videoRef.current.currentTime = scene === null || scene === void 0 ? void 0 : scene.startTime;
17855
- }
17856
- }, []);
17857
17872
  const handLoadeddata = React.useCallback(() => {
17858
17873
  if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) || firstFrameSrc || !blur)
17859
17874
  return;
@@ -17878,13 +17893,12 @@ const VideoWidget$4 = React.forwardRef(({ rec, index, height, data, muted, activ
17878
17893
  const handleLoadedmetadata = React.useCallback(() => {
17879
17894
  if (!videoRef.current)
17880
17895
  return;
17881
- setCurrentTimeByStartTime();
17882
17896
  loadedTimeRef.current = new Date();
17883
17897
  handleStartPlay();
17884
17898
  handLoadeddata();
17885
17899
  }, [videoRef.current, handLoadeddata, handleStartPlay]);
17886
17900
  const handleClickVideo = React.useCallback((type) => () => {
17887
- var _a, _b, _c, _d, _e, _f;
17901
+ var _a, _b, _c, _d, _e;
17888
17902
  if (!videoRef.current)
17889
17903
  return;
17890
17904
  if (!isLoadFinish)
@@ -17905,13 +17919,10 @@ const VideoWidget$4 = React.forwardRef(({ rec, index, height, data, muted, activ
17905
17919
  break;
17906
17920
  default:
17907
17921
  if (isPause) {
17908
- 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)) {
17909
- videoRef.current.currentTime = scene === null || scene === void 0 ? void 0 : scene.startTime;
17910
- }
17911
- (_e = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _e === void 0 ? void 0 : _e.play();
17922
+ (_d = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _d === void 0 ? void 0 : _d.play();
17912
17923
  }
17913
17924
  else {
17914
- (_f = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _f === void 0 ? void 0 : _f.pause();
17925
+ (_e = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _e === void 0 ? void 0 : _e.pause();
17915
17926
  }
17916
17927
  setIsPauseVideo(!isPause);
17917
17928
  break;
@@ -17949,27 +17960,8 @@ const VideoWidget$4 = React.forwardRef(({ rec, index, height, data, muted, activ
17949
17960
  const handleWaiting = React.useCallback(() => {
17950
17961
  setWaiting(true);
17951
17962
  }, []);
17952
- const handleTimeUpload = () => {
17953
- if (!videoRef.current || !isDiyH5)
17954
- return;
17955
- setTimeout(() => {
17956
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
17957
- 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)) {
17958
- (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.pause();
17959
- if (!loopPlayRef.current)
17960
- return;
17961
- if (index === (data === null || data === void 0 ? void 0 : data.length) - 1) {
17962
- (_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);
17963
- }
17964
- else {
17965
- 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;
17966
- (_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);
17967
- }
17968
- }
17969
- });
17970
- };
17971
17963
  React.useEffect(() => {
17972
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
17964
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
17973
17965
  if (!isActive)
17974
17966
  return;
17975
17967
  const videoSrc = videoUrl;
@@ -17990,7 +17982,6 @@ const VideoWidget$4 = React.forwardRef(({ rec, index, height, data, muted, activ
17990
17982
  hls === null || hls === void 0 ? void 0 : hls.attachMedia(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current);
17991
17983
  hls === null || hls === void 0 ? void 0 : hls.on(Hls.Events.MANIFEST_PARSED, function () {
17992
17984
  var _a;
17993
- setCurrentTimeByStartTime();
17994
17985
  (_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.play();
17995
17986
  });
17996
17987
  }
@@ -18004,12 +17995,11 @@ const VideoWidget$4 = React.forwardRef(({ rec, index, height, data, muted, activ
18004
17995
  (_e = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _e === void 0 ? void 0 : _e.addEventListener('play', handleStartPlay);
18005
17996
  (_f = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _f === void 0 ? void 0 : _f.addEventListener('playing', handlePlaying);
18006
17997
  (_g = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _g === void 0 ? void 0 : _g.addEventListener('pause', handlePause);
18007
- (_h = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _h === void 0 ? void 0 : _h.addEventListener('ended', handlePlay);
17998
+ (_h = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _h === void 0 ? void 0 : _h.addEventListener('ended', handleEnd);
18008
17999
  (_j = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _j === void 0 ? void 0 : _j.addEventListener('canplay', handlePlay);
18009
18000
  (_k = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _k === void 0 ? void 0 : _k.addEventListener('waiting', handleWaiting);
18010
- (_l = videoRef.current) === null || _l === void 0 ? void 0 : _l.addEventListener('timeupdate', handleTimeUpload);
18011
18001
  return () => {
18012
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
18002
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
18013
18003
  const isPause = (_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.paused;
18014
18004
  if (!isPause)
18015
18005
  handlePause();
@@ -18021,10 +18011,9 @@ const VideoWidget$4 = React.forwardRef(({ rec, index, height, data, muted, activ
18021
18011
  (_e = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _e === void 0 ? void 0 : _e.removeEventListener('play', handleStartPlay);
18022
18012
  (_f = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _f === void 0 ? void 0 : _f.removeEventListener('playing', handlePlaying);
18023
18013
  (_g = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _g === void 0 ? void 0 : _g.removeEventListener('pause', handlePause);
18024
- (_h = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _h === void 0 ? void 0 : _h.removeEventListener('ended', handlePlay);
18014
+ (_h = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _h === void 0 ? void 0 : _h.removeEventListener('ended', handleEnd);
18025
18015
  (_j = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _j === void 0 ? void 0 : _j.removeEventListener('canplay', handlePlay);
18026
18016
  (_k = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _k === void 0 ? void 0 : _k.removeEventListener('waiting', handleWaiting);
18027
- (_l = videoRef.current) === null || _l === void 0 ? void 0 : _l.removeEventListener('timeupdate', handleTimeUpload);
18028
18017
  };
18029
18018
  }, [isActive]);
18030
18019
  React.useEffect(() => {
@@ -18235,19 +18224,43 @@ const Picture = (props) => {
18235
18224
  }, onLoad: onShowFirstImage }))));
18236
18225
  };
18237
18226
 
18238
- const PictureGroup$4 = ({ imgUrls, width, height, rec, index, onViewImageEndEvent, onViewImageStartEvent, imgUrlsPostConfig }) => {
18227
+ const PictureGroup$4 = React.forwardRef(({ imgUrls, data, height, rec, index, onViewImageEndEvent, onViewImageStartEvent, imgUrlsPostConfig, swiperRef }, ref) => {
18239
18228
  var _a, _b;
18240
18229
  const { isActive } = useSwiperSlide();
18241
- const { sxpParameter, openHashtag } = useSxpDataSource();
18230
+ const { sxpParameter, openHashtag, isDiyH5 } = useSxpDataSource();
18242
18231
  const [isLoad, setIsLoad] = React.useState(false);
18243
18232
  const [imgInfo, setImgInfo] = React.useState();
18244
18233
  const [swiperActiveIndex, setSwiperActiveIndex] = React.useState(0);
18245
- const swiperRef = React.useRef();
18234
+ const imgsSwiperRef = React.useRef();
18246
18235
  const isFirstPlayRef = React.useRef(true);
18236
+ const loopPlayRef = React.useRef(true);
18247
18237
  const initTime = new Date();
18238
+ React.useImperativeHandle(ref, () => {
18239
+ return {
18240
+ setLoopPlay(v) {
18241
+ loopPlayRef.current = v;
18242
+ }
18243
+ };
18244
+ });
18245
+ React.useEffect(() => {
18246
+ if (isLoad && isActive && isDiyH5) {
18247
+ setTimeout(() => {
18248
+ var _a, _b, _c, _d, _e, _f;
18249
+ if (!loopPlayRef.current)
18250
+ return;
18251
+ if (index === (data === null || data === void 0 ? void 0 : data.length) - 1) {
18252
+ (_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);
18253
+ }
18254
+ else {
18255
+ 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;
18256
+ (_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);
18257
+ }
18258
+ }, 3000);
18259
+ }
18260
+ }, [isLoad, isActive, isDiyH5, data, index, swiperRef]);
18248
18261
  React.useEffect(() => {
18249
18262
  if (isLoad && isActive) {
18250
- (swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) && swiperRef.current.swiper.autoplay.start();
18263
+ (imgsSwiperRef === null || imgsSwiperRef === void 0 ? void 0 : imgsSwiperRef.current) && imgsSwiperRef.current.swiper.autoplay.start();
18251
18264
  if (openHashtag) {
18252
18265
  onViewImageEndEvent(rec);
18253
18266
  }
@@ -18257,7 +18270,7 @@ const PictureGroup$4 = ({ imgUrls, width, height, rec, index, onViewImageEndEven
18257
18270
  }
18258
18271
  }
18259
18272
  else {
18260
- (swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) && swiperRef.current.swiper.autoplay.stop();
18273
+ (imgsSwiperRef === null || imgsSwiperRef === void 0 ? void 0 : imgsSwiperRef.current) && imgsSwiperRef.current.swiper.autoplay.stop();
18261
18274
  }
18262
18275
  }, [rec, isActive, onViewImageEndEvent, openHashtag, index, onViewImageStartEvent, isLoad, imgInfo]);
18263
18276
  const showFirstImageFn = React.useCallback((e) => __awaiter(void 0, void 0, void 0, function* () {
@@ -18284,13 +18297,13 @@ const PictureGroup$4 = ({ imgUrls, width, height, rec, index, onViewImageEndEven
18284
18297
  };
18285
18298
  }, [isActive, imgInfo]);
18286
18299
  const handleMouseEnter = React.useCallback(() => {
18287
- if (swiperRef.current && swiperRef.current.swiper && isAlly) {
18288
- swiperRef.current.swiper.autoplay.stop();
18300
+ if (imgsSwiperRef.current && imgsSwiperRef.current.swiper && isAlly) {
18301
+ imgsSwiperRef.current.swiper.autoplay.stop();
18289
18302
  }
18290
18303
  }, []);
18291
18304
  const handleMouseLeave = React.useCallback(() => {
18292
- if (swiperRef.current && swiperRef.current.swiper && isAlly) {
18293
- swiperRef.current.swiper.autoplay.start();
18305
+ if (imgsSwiperRef.current && imgsSwiperRef.current.swiper && isAlly) {
18306
+ imgsSwiperRef.current.swiper.autoplay.start();
18294
18307
  }
18295
18308
  }, []);
18296
18309
  const handleSlideChange = React.useCallback((swiper) => {
@@ -18311,7 +18324,7 @@ const PictureGroup$4 = ({ imgUrls, width, height, rec, index, onViewImageEndEven
18311
18324
  enabled: true
18312
18325
  }
18313
18326
  }
18314
- : {}), { loop: true, ref: swiperRef, onSlideChange: handleSlideChange, className: css.css(Object.assign(Object.assign({ '.swiper-pagination': {
18327
+ : {}), { loop: true, ref: imgsSwiperRef, onSlideChange: handleSlideChange, className: css.css(Object.assign(Object.assign({ '.swiper-pagination': {
18315
18328
  bottom: (_a = imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.marginBottom) !== null && _a !== void 0 ? _a : 0,
18316
18329
  fontSize: '14px'
18317
18330
  } }, ((imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.dotsBgColor) && {
@@ -18328,7 +18341,7 @@ const PictureGroup$4 = ({ imgUrls, width, height, rec, index, onViewImageEndEven
18328
18341
  return (React.createElement(SwiperSlide, { key: srcKey, "aria-hidden": srcKey !== swiperActiveIndex },
18329
18342
  React.createElement(Picture, { src: !isLoad && srcKey > 0 ? '' : url, height: height, imgUrlsPostConfig: imgUrlsPostConfig, onShowFirstImage: showFirstImageFn })));
18330
18343
  }))));
18331
- };
18344
+ });
18332
18345
  var PictureGroup$5 = React.memo(PictureGroup$4);
18333
18346
 
18334
18347
  /*
@@ -18628,6 +18641,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
18628
18641
  const skipLinkRef = React.useRef(false);
18629
18642
  const [pageNum, setPageNum] = React.useState(2);
18630
18643
  const videoWidgetRef = React.useRef(null);
18644
+ const pictureGroupRef = React.useRef(null);
18631
18645
  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();
18632
18646
  const { backMainFeed, productView, jumpToWeb } = useEventReport();
18633
18647
  const isShowFingerTip = React.useMemo(() => {
@@ -18766,8 +18780,9 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
18766
18780
  refreshFeSession
18767
18781
  ]);
18768
18782
  const handleSessionExpire = React.useCallback(lodash.debounce(() => {
18769
- var _a;
18783
+ var _a, _b;
18770
18784
  (_a = videoWidgetRef.current) === null || _a === void 0 ? void 0 : _a.setLoopPlay(false);
18785
+ (_b = pictureGroupRef.current) === null || _b === void 0 ? void 0 : _b.setLoopPlay(false);
18771
18786
  refreshFeSession === null || refreshFeSession === void 0 ? void 0 : refreshFeSession(false, handleSessionCompleted);
18772
18787
  }, 1000), [handleSessionCompleted, refreshFeSession]);
18773
18788
  React.useEffect(() => {
@@ -18845,7 +18860,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
18845
18860
  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 })));
18846
18861
  }
18847
18862
  if ((_h = rec === null || rec === void 0 ? void 0 : rec.video) === null || _h === void 0 ? void 0 : _h.imgUrls) {
18848
- 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 }));
18863
+ 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 })));
18849
18864
  }
18850
18865
  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) {
18851
18866
  return (_k = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.productPost) === null || _k === void 0 ? void 0 : _k.map((value, idx) => {