pb-sxp-ui 1.15.22-alpha.1 → 1.15.22-alpha.2

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/pb-ui.js CHANGED
@@ -1260,7 +1260,8 @@
1260
1260
  multiPostTimeRef,
1261
1261
  refreshFeSession,
1262
1262
  getAccount,
1263
- accountSonsent
1263
+ accountSonsent,
1264
+ isDiyH5
1264
1265
  } }, isShowConsent ? (React.createElement(Consent$4, Object.assign({}, (_e = (_d = (_c = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.consent) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.item) === null || _e === void 0 ? void 0 : _e.props))) : (render({
1265
1266
  rtcList,
1266
1267
  mutateLike: bffMutateLike,
@@ -1494,7 +1495,7 @@
1494
1495
  React.createElement(DataSourceProvider$1, { isSsr: isSsr, enable: enableDataSource }, children)));
1495
1496
  });
1496
1497
 
1497
- var index$2 = /*#__PURE__*/Object.freeze({
1498
+ var index$3 = /*#__PURE__*/Object.freeze({
1498
1499
  __proto__: null,
1499
1500
  EditorCore: EditorCore
1500
1501
  });
@@ -17675,9 +17676,9 @@ Made in Italy` })));
17675
17676
  };
17676
17677
  })();
17677
17678
 
17678
- const VideoWidget$4 = ({ rec, index, height, data, muted, activeIndex, videoPostConfig, videoPlayIcon }) => {
17679
+ const VideoWidget$4 = React.forwardRef(({ rec, index, height, data, muted, activeIndex, videoPostConfig, videoPlayIcon, loopPlay, swiperRef }, ref) => {
17679
17680
  const [isPauseVideo, setIsPauseVideo] = React.useState(false);
17680
- const { bffEventReport, sxpParameter, waterFallData, openHashtag, bffFbReport } = useSxpDataSource();
17681
+ const { bffEventReport, sxpParameter, waterFallData, openHashtag, bffFbReport, isDiyH5 } = useSxpDataSource();
17681
17682
  const videoStartTime = React.useRef(0);
17682
17683
  const [isLoadFinish, setIsLoadFinish] = React.useState(false);
17683
17684
  const { isActive } = useSwiperSlide();
@@ -17691,6 +17692,18 @@ Made in Italy` })));
17691
17692
  const initTimeRef = React.useRef();
17692
17693
  const loadedTimeRef = React.useRef();
17693
17694
  const isFirstPlayRef = React.useRef(true);
17695
+ const loopPlayRef = React.useRef(loopPlay);
17696
+ const scene = rec.video.scene;
17697
+ React.useImperativeHandle(ref, () => {
17698
+ return {
17699
+ setLoopPlay(v) {
17700
+ loopPlayRef.current = v;
17701
+ }
17702
+ };
17703
+ });
17704
+ React.useEffect(() => {
17705
+ loopPlayRef.current = loopPlay;
17706
+ }, [loopPlay]);
17694
17707
  const blur = React.useMemo(() => {
17695
17708
  return (videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.mode) === '2';
17696
17709
  }, [videoPostConfig]);
@@ -17778,12 +17791,15 @@ Made in Italy` })));
17778
17791
  const handleLoadedmetadata = React.useCallback(() => {
17779
17792
  if (!videoRef.current)
17780
17793
  return;
17794
+ if (isDiyH5) {
17795
+ videoRef.current.currentTime = scene === null || scene === void 0 ? void 0 : scene.startTime;
17796
+ }
17781
17797
  loadedTimeRef.current = new Date();
17782
17798
  handleStartPlay();
17783
17799
  handLoadeddata();
17784
17800
  }, [videoRef.current, handLoadeddata, handleStartPlay]);
17785
17801
  const handleClickVideo = React.useCallback((type) => () => {
17786
- var _a, _b, _c, _d, _e;
17802
+ var _a, _b, _c, _d, _e, _f;
17787
17803
  if (!videoRef.current)
17788
17804
  return;
17789
17805
  if (!isLoadFinish)
@@ -17804,10 +17820,13 @@ Made in Italy` })));
17804
17820
  break;
17805
17821
  default:
17806
17822
  if (isPause) {
17807
- (_d = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _d === void 0 ? void 0 : _d.play();
17823
+ 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)) {
17824
+ videoRef.current.currentTime = scene === null || scene === void 0 ? void 0 : scene.startTime;
17825
+ }
17826
+ (_e = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _e === void 0 ? void 0 : _e.play();
17808
17827
  }
17809
17828
  else {
17810
- (_e = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _e === void 0 ? void 0 : _e.pause();
17829
+ (_f = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _f === void 0 ? void 0 : _f.pause();
17811
17830
  }
17812
17831
  setIsPauseVideo(!isPause);
17813
17832
  break;
@@ -17844,8 +17863,27 @@ Made in Italy` })));
17844
17863
  const handleWaiting = React.useCallback(() => {
17845
17864
  setWaiting(true);
17846
17865
  }, []);
17866
+ const handleTimeUpload = () => {
17867
+ if (!videoRef.current || !isDiyH5)
17868
+ return;
17869
+ setTimeout(() => {
17870
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
17871
+ 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)) {
17872
+ (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.pause();
17873
+ if (!loopPlayRef.current)
17874
+ return;
17875
+ if (index === (data === null || data === void 0 ? void 0 : data.length) - 1) {
17876
+ (_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);
17877
+ }
17878
+ else {
17879
+ 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;
17880
+ (_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);
17881
+ }
17882
+ }
17883
+ });
17884
+ };
17847
17885
  React.useEffect(() => {
17848
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
17886
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
17849
17887
  if (!isActive)
17850
17888
  return;
17851
17889
  const videoSrc = rec === null || rec === void 0 ? void 0 : rec.video.url;
@@ -17866,6 +17904,7 @@ Made in Italy` })));
17866
17904
  hls === null || hls === void 0 ? void 0 : hls.attachMedia(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current);
17867
17905
  hls === null || hls === void 0 ? void 0 : hls.on(Hls.Events.MANIFEST_PARSED, function () {
17868
17906
  var _a;
17907
+ videoRef.current.currentTime = scene === null || scene === void 0 ? void 0 : scene.startTime;
17869
17908
  (_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.play();
17870
17909
  });
17871
17910
  }
@@ -17882,8 +17921,9 @@ Made in Italy` })));
17882
17921
  (_h = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _h === void 0 ? void 0 : _h.addEventListener('ended', handlePlay);
17883
17922
  (_j = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _j === void 0 ? void 0 : _j.addEventListener('canplay', handlePlay);
17884
17923
  (_k = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _k === void 0 ? void 0 : _k.addEventListener('waiting', handleWaiting);
17924
+ (_l = videoRef.current) === null || _l === void 0 ? void 0 : _l.addEventListener('timeupdate', handleTimeUpload);
17885
17925
  return () => {
17886
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
17926
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
17887
17927
  const isPause = (_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.paused;
17888
17928
  if (!isPause)
17889
17929
  handlePause();
@@ -17898,6 +17938,7 @@ Made in Italy` })));
17898
17938
  (_h = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _h === void 0 ? void 0 : _h.removeEventListener('ended', handlePlay);
17899
17939
  (_j = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _j === void 0 ? void 0 : _j.removeEventListener('canplay', handlePlay);
17900
17940
  (_k = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _k === void 0 ? void 0 : _k.removeEventListener('waiting', handleWaiting);
17941
+ (_l = videoRef.current) === null || _l === void 0 ? void 0 : _l.removeEventListener('timeupdate', handleTimeUpload);
17901
17942
  };
17902
17943
  }, [isActive]);
17903
17944
  React.useEffect(() => {
@@ -17920,8 +17961,8 @@ Made in Italy` })));
17920
17961
  }
17921
17962
  }, [isActive, isLoadFinish, videoRef === null || videoRef === void 0 ? void 0 : videoRef.current]);
17922
17963
  /*
17923
- 打开/关闭hashtag暂停/播放视频
17924
- */
17964
+ 打开/关闭hashtag暂停/播放视频
17965
+ */
17925
17966
  React.useEffect(() => {
17926
17967
  var _a, _b, _c;
17927
17968
  if (!isActive || !(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current))
@@ -18018,8 +18059,8 @@ Made in Italy` })));
18018
18059
  React.createElement("div", { className: 'n-full-screen', ref: videoEleRef, id: videoId, style: { width: '100%', height: '100%' } }),
18019
18060
  renderPoster,
18020
18061
  renderLoading,
18021
- isPauseVideo && React.createElement(FormatImage$1, { className: 'clc-pb-video-pause', src: videoPlayIcon !== null && videoPlayIcon !== void 0 ? videoPlayIcon : PAUSE_ICON, alt: 'pause' })))));
18022
- };
18062
+ isPauseVideo && (React.createElement(FormatImage$1, { className: 'clc-pb-video-pause', src: videoPlayIcon !== null && videoPlayIcon !== void 0 ? videoPlayIcon : PAUSE_ICON, alt: 'pause' }))))));
18063
+ });
18023
18064
  var VideoWidget$5 = React.memo(VideoWidget$4);
18024
18065
 
18025
18066
  const ToggleButton = ({ defaultValue, activeIcon, unactiveIcon, onChange, style }) => {
@@ -18482,7 +18523,7 @@ Made in Italy` })));
18482
18523
  * @Author: binruan@chatlabs.com
18483
18524
  * @Date: 2024-03-20 10:27:31
18484
18525
  * @LastEditors: binruan@chatlabs.com
18485
- * @LastEditTime: 2025-02-25 16:50:19
18526
+ * @LastEditTime: 2025-05-06 18:19:21
18486
18527
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\index.tsx
18487
18528
  *
18488
18529
  */
@@ -18501,7 +18542,8 @@ Made in Italy` })));
18501
18542
  const [isReload, setIsReload] = React.useState(new Date().getTime());
18502
18543
  const skipLinkRef = React.useRef(false);
18503
18544
  const [pageNum, setPageNum] = React.useState(2);
18504
- 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 } = useSxpDataSource();
18545
+ const videoWidgetRef = React.useRef(null);
18546
+ 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();
18505
18547
  const { backMainFeed, productView, jumpToWeb } = useEventReport();
18506
18548
  const isShowFingerTip = React.useMemo(() => {
18507
18549
  return data.length > 0 && !loading && (getFeUserState() || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableSwiperTip));
@@ -18639,6 +18681,8 @@ Made in Italy` })));
18639
18681
  refreshFeSession
18640
18682
  ]);
18641
18683
  const handleSessionExpire = React.useCallback(lodash.debounce(() => {
18684
+ var _a;
18685
+ (_a = videoWidgetRef.current) === null || _a === void 0 ? void 0 : _a.setLoopPlay(false);
18642
18686
  refreshFeSession === null || refreshFeSession === void 0 ? void 0 : refreshFeSession(false, handleSessionCompleted);
18643
18687
  }, 1000), [handleSessionCompleted, refreshFeSession]);
18644
18688
  React.useEffect(() => {
@@ -18713,7 +18757,7 @@ Made in Italy` })));
18713
18757
  return (React.createElement(MultiPosts$2, 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)));
18714
18758
  }
18715
18759
  if ((_g = rec === null || rec === void 0 ? void 0 : rec.video) === null || _g === void 0 ? void 0 : _g.url) {
18716
- return (React.createElement(VideoWidget$5, { key: isReload, 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 }));
18760
+ 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 })));
18717
18761
  }
18718
18762
  if ((_h = rec === null || rec === void 0 ? void 0 : rec.video) === null || _h === void 0 ? void 0 : _h.imgUrls) {
18719
18763
  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 }));
@@ -19062,7 +19106,7 @@ Made in Italy` })));
19062
19106
  return;
19063
19107
  // 处理上滑下滑事件
19064
19108
  handleScrollEvent(swiper);
19065
- if (waterFallData || isEditor)
19109
+ if (waterFallData || isEditor || isDiyH5)
19066
19110
  return;
19067
19111
  if ((swiper === null || swiper === void 0 ? void 0 : swiper.activeIndex) + 1 >= (data === null || data === void 0 ? void 0 : data.length)) {
19068
19112
  if (!isLoadMore) {
@@ -19448,7 +19492,7 @@ Made in Italy` })));
19448
19492
  return renderView(rec, index);
19449
19493
  })));
19450
19494
  };
19451
- var index$1 = React.memo(DiyPortalPreview);
19495
+ var index$2 = React.memo(DiyPortalPreview);
19452
19496
 
19453
19497
  /*
19454
19498
  * @Author: binruan@chatlabs.com
@@ -19709,7 +19753,7 @@ Made in Italy` })));
19709
19753
  * @Author: binruan@chatlabs.com
19710
19754
  * @Date: 2025-03-25 13:54:27
19711
19755
  * @LastEditors: binruan@chatlabs.com
19712
- * @LastEditTime: 2025-04-28 14:08:59
19756
+ * @LastEditTime: 2025-05-06 18:10:44
19713
19757
  * @FilePath: \pb-sxp-ui\src\core\components\DiyStoryPreview\index.tsx
19714
19758
  *
19715
19759
  */
@@ -19941,7 +19985,7 @@ Made in Italy` })));
19941
19985
  return renderView(rec, index);
19942
19986
  }))));
19943
19987
  });
19944
- var DiyStoryPreview$1 = React.memo(DiyStoryPreview);
19988
+ var index$1 = React.memo(DiyStoryPreview);
19945
19989
 
19946
19990
  /*
19947
19991
  * @Author: binruan@chatlabs.com
@@ -20041,7 +20085,7 @@ Made in Italy` })));
20041
20085
  * @Author: binruan@chatlabs.com
20042
20086
  * @Date: 2024-01-15 19:03:09
20043
20087
  * @LastEditors: binruan@chatlabs.com
20044
- * @LastEditTime: 2025-04-28 14:33:34
20088
+ * @LastEditTime: 2025-05-06 15:49:04
20045
20089
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageCore\index.tsx
20046
20090
  *
20047
20091
  */
@@ -20069,9 +20113,9 @@ Made in Italy` })));
20069
20113
  const [channel, setChannel] = React.useState();
20070
20114
  return (React.createElement(EditorCore, { resolver: RESOLVER, enableDataSource: false, schema: _schema, utmVal: channel || utmVal },
20071
20115
  React.createElement(SxpDataSourceProvider$1, { utmVal: utmVal, dataSources: data === null || data === void 0 ? void 0 : data.data_sources, sxpParameter: data === null || data === void 0 ? void 0 : data.sxp_parameter, maxSize: (_c = (_b = data === null || data === void 0 ? void 0 : data.sxp_parameter) === null || _b === void 0 ? void 0 : _b.personalized_recommend) !== null && _c !== void 0 ? _c : maxSize, defaultSize: (_e = (_d = data === null || data === void 0 ? void 0 : data.sxp_parameter) === null || _d === void 0 ? void 0 : _d.default_recommend) !== null && _e !== void 0 ? _e : defaultSize, hashTagSize: (_g = (_f = data === null || data === void 0 ? void 0 : data.sxp_parameter) === null || _f === void 0 ? void 0 : _f.hash_tag_size) !== null && _g !== void 0 ? _g : hashTagSize, loadingImage: loadingImage, appDomain: appDomain, enabledMetaConversionApi: enabledMetaConversionApi, utmParameter: data === null || data === void 0 ? void 0 : data.utm_parameter, data: data, dataList: dataList, isDiyH5: isDiyH5, onUpdateSchema: (d) => setSchema(d), onUpdateChannel: (d) => setChannel(d), render: ({ rtcList, tagList, pageData }) => {
20072
- var _a, _b;
20116
+ var _a;
20073
20117
  return (React.createElement(React.Fragment, null,
20074
- isDiyH5 ? (React.createElement(DiyStoryPreview$1, Object.assign({ defaultData: data }, (_a = pageData === null || pageData === void 0 ? void 0 : pageData.data) === null || _a === void 0 ? void 0 : _a.sxpPageConf, { tagList: tagList, data: rtcList, resolver: RESOLVER, containerHeight: window === null || window === void 0 ? void 0 : window.innerHeight, pointerEvents: 'all', loopPlay: true }))) : (React.createElement(SxpPageRender$1, Object.assign({ defaultData: data }, (_b = pageData === null || pageData === void 0 ? void 0 : pageData.data) === null || _b === void 0 ? void 0 : _b.sxpPageConf, { tagList: tagList, data: rtcList, resolver: RESOLVER }))),
20118
+ React.createElement(SxpPageRender$1, Object.assign({ defaultData: data }, (_a = pageData === null || pageData === void 0 ? void 0 : pageData.data) === null || _a === void 0 ? void 0 : _a.sxpPageConf, { tagList: tagList, data: rtcList, resolver: RESOLVER })),
20075
20119
  React.createElement(Popup, null)));
20076
20120
  } })));
20077
20121
  };
@@ -20085,14 +20129,14 @@ Made in Italy` })));
20085
20129
  * @FilePath: \pb-sxp-ui\src\index.ts
20086
20130
  */
20087
20131
 
20088
- exports.DiyPortalPreview = index$1;
20089
- exports.DiyStoryPreview = DiyStoryPreview$1;
20132
+ exports.DiyPortalPreview = index$2;
20133
+ exports.DiyStoryPreview = index$1;
20090
20134
  exports.EditorDataProvider = EditorDataProvider;
20091
20135
  exports.Modal = Modal$1;
20092
20136
  exports.SxpDataSourceProvider = SxpDataSourceProvider$1;
20093
20137
  exports.SxpPageCore = index;
20094
20138
  exports.SxpPageRender = SxpPageRender$1;
20095
- exports.core = index$2;
20139
+ exports.core = index$3;
20096
20140
  exports.default = Pagebuilder;
20097
20141
  exports.materials = _materials_;
20098
20142
  exports.useEditorDataProvider = useEditorDataProvider;