pb-sxp-ui 1.16.10 → 1.16.11

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
@@ -622,6 +622,7 @@ const DEFAULT_TAG = 'FOR U';
622
622
  const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent = true, maxSize, defaultSize, isPreview = false, sxpParameter, appDomain, hashTagSize, loadingImage, isOpenHashTag = false, enabledMetaConversionApi = false, consentHeight, consentWidth, isOpenConsent = false, isEditor = false, utmParameter, channelQueryList, data, dataList, isDiyH5, onUpdateSchema, onUpdateChannel }) => {
623
623
  var _a, _b, _c, _d, _e;
624
624
  const [rtcList, setRtcList] = useState([]);
625
+ const [firstRtcList, setFirstRtcList] = useState([]);
625
626
  const [tagList, setTagList] = useState([]);
626
627
  const [loading, setLoading] = useState(true);
627
628
  const [curReqInfo, setCurReqInfo] = useState({ rtc: '', requestId: '' });
@@ -792,6 +793,9 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
792
793
  if ((rtcList === null || rtcList === void 0 ? void 0 : rtcList.length) === 0) {
793
794
  setRtcList(getFilterRecList(Object.assign(Object.assign({}, result === null || result === void 0 ? void 0 : result.data), { recList: list })));
794
795
  setCacheRtcList(getFilterRecList(Object.assign(Object.assign({}, result === null || result === void 0 ? void 0 : result.data), { recList: list })));
796
+ if (isDiyH5) {
797
+ setFirstRtcList(getFilterRecList(Object.assign(Object.assign({}, result === null || result === void 0 ? void 0 : result.data), { recList: list })));
798
+ }
795
799
  }
796
800
  const isNotNullList = (_0 = (_z = result === null || result === void 0 ? void 0 : result.data) === null || _z === void 0 ? void 0 : _z.recList) === null || _0 === void 0 ? void 0 : _0.some((item) => (item === null || item === void 0 ? void 0 : item.product) || (item === null || item === void 0 ? void 0 : item.video));
797
801
  if (isNotNullList) {
@@ -831,12 +835,17 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
831
835
  if (rtcList.length <= 0) {
832
836
  return;
833
837
  }
838
+ if (isDiyH5 && (firstRtcList === null || firstRtcList === void 0 ? void 0 : firstRtcList.length) > 0) {
839
+ setRtcList(rtcList.concat(firstRtcList));
840
+ setCacheRtcList(cacheRtcList.concat(firstRtcList));
841
+ return;
842
+ }
834
843
  const lastItem = rtcList === null || rtcList === void 0 ? void 0 : rtcList[(rtcList === null || rtcList === void 0 ? void 0 : rtcList.length) - 1];
835
844
  const data = yield getRecommendVideos(Object.assign(Object.assign(Object.assign(Object.assign({ hashTag: waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag }, (((_1 = lastItem === null || lastItem === void 0 ? void 0 : lastItem.product) === null || _1 === void 0 ? void 0 : _1.itemId) && { productFilter: [(_2 = lastItem === null || lastItem === void 0 ? void 0 : lastItem.product) === null || _2 === void 0 ? void 0 : _2.itemId] })), (((_3 = lastItem === null || lastItem === void 0 ? void 0 : lastItem.video) === null || _3 === void 0 ? void 0 : _3.itemId) && { contentFilter: [(_4 = lastItem === null || lastItem === void 0 ? void 0 : lastItem.video) === null || _4 === void 0 ? void 0 : _4.itemId] })), { themeTag: themeTag.current }), ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enablePreview) && !isEditor && { pageNum })));
836
845
  setRtcList(rtcList.concat(getFilterRecList(data)));
837
846
  setCacheRtcList(cacheRtcList.concat(getFilterRecList(data)));
838
847
  return data;
839
- }), [getRecommendVideos, rtcList, waterFallData, cacheRtcList]);
848
+ }), [getRecommendVideos, rtcList, waterFallData, cacheRtcList, isDiyH5, firstRtcList]);
840
849
  const refreshFeSession = useCallback((enableReSid, event) => {
841
850
  var _a, _b, _c, _d, _e;
842
851
  let expire = false;
@@ -1183,6 +1192,9 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
1183
1192
  }
1184
1193
  setRtcList(list);
1185
1194
  setCacheRtcList(list);
1195
+ if (isDiyH5) {
1196
+ setFirstRtcList(list);
1197
+ }
1186
1198
  bffGetTagList(curData !== null && curData !== void 0 ? curData : finalPageData);
1187
1199
  if (channel) {
1188
1200
  const item = list === null || list === void 0 ? void 0 : list[0];
@@ -1218,6 +1230,9 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
1218
1230
  }
1219
1231
  setRtcList(list);
1220
1232
  setCacheRtcList(list);
1233
+ if (isDiyH5) {
1234
+ setFirstRtcList(list);
1235
+ }
1221
1236
  }
1222
1237
  })
1223
1238
  .finally(() => {
@@ -17914,23 +17929,21 @@ const VideoWidget$4 = forwardRef(({ rec, index, height, data, muted, activeIndex
17914
17929
  (_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.play();
17915
17930
  }, [videoRef === null || videoRef === void 0 ? void 0 : videoRef.current]);
17916
17931
  const handleEnd = () => {
17917
- var _a, _b, _c, _d, _e, _f, _g, _h;
17932
+ var _a, _b, _c, _d, _e, _f;
17918
17933
  if (!videoRef.current)
17919
17934
  return;
17920
17935
  if (isDiyH5) {
17921
17936
  (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.pause();
17922
17937
  if (!loopPlayRef.current)
17923
17938
  return;
17924
- if (index === (data === null || data === void 0 ? void 0 : data.length) - 1) {
17925
- (_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);
17926
- }
17939
+ if (index === (data === null || data === void 0 ? void 0 : data.length) - 1) ;
17927
17940
  else {
17928
- 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;
17929
- (_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);
17941
+ const i = (_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.activeIndex;
17942
+ (_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(i + 1);
17930
17943
  }
17931
17944
  }
17932
17945
  else {
17933
- (_h = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _h === void 0 ? void 0 : _h.play();
17946
+ (_f = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _f === void 0 ? void 0 : _f.play();
17934
17947
  }
17935
17948
  };
17936
17949
  const PAUSE_ICON = useIconLink('/pb_static/06f28a2025c74c1cb49be6767316d827.png');
@@ -18335,15 +18348,13 @@ const PictureGroup$4 = forwardRef(({ imgUrls, data, height, rec, index, onViewIm
18335
18348
  let timerId;
18336
18349
  if (isLoad && isActive && isDiyH5) {
18337
18350
  timerId = setTimeout(() => {
18338
- var _a, _b, _c, _d, _e, _f;
18351
+ var _a, _b, _c, _d;
18339
18352
  if (!loopPlayRef.current)
18340
18353
  return;
18341
- if (index === (data === null || data === void 0 ? void 0 : data.length) - 1) {
18342
- (_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);
18343
- }
18354
+ if (index === (data === null || data === void 0 ? void 0 : data.length) - 1) ;
18344
18355
  else {
18345
- 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;
18346
- (_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);
18356
+ const i = (_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.activeIndex;
18357
+ (_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.slideTo(i + 1);
18347
18358
  }
18348
18359
  }, 3000);
18349
18360
  }
@@ -18351,7 +18362,7 @@ const PictureGroup$4 = forwardRef(({ imgUrls, data, height, rec, index, onViewIm
18351
18362
  if (timerId)
18352
18363
  clearTimeout(timerId);
18353
18364
  };
18354
- }, [isLoad, isActive, isDiyH5, data, index, swiperRef]);
18365
+ }, [isLoad, isActive, isDiyH5, index, swiperRef]);
18355
18366
  useEffect(() => {
18356
18367
  if (isLoad && isActive) {
18357
18368
  (imgsSwiperRef === null || imgsSwiperRef === void 0 ? void 0 : imgsSwiperRef.current) && imgsSwiperRef.current.swiper.autoplay.start();
@@ -19309,15 +19320,20 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
19309
19320
  swiperRef.current.swiper.allowTouchMove = true;
19310
19321
  }, 500);
19311
19322
  }, onActiveIndexChange: (swiper) => {
19323
+ var _a, _b;
19312
19324
  setActiveIndex(swiper.activeIndex);
19313
19325
  if (openHashtag)
19314
19326
  return;
19315
19327
  // 处理上滑下滑事件
19316
19328
  handleScrollEvent(swiper);
19317
- if (waterFallData || isEditor || isDiyH5)
19329
+ if (waterFallData || isEditor)
19318
19330
  return;
19319
19331
  if ((swiper === null || swiper === void 0 ? void 0 : swiper.activeIndex) + 1 >= (data === null || data === void 0 ? void 0 : data.length)) {
19320
19332
  if (!isLoadMore) {
19333
+ if (isDiyH5) {
19334
+ (_a = videoWidgetRef.current) === null || _a === void 0 ? void 0 : _a.setLoopPlay(false);
19335
+ (_b = pictureGroupRef.current) === null || _b === void 0 ? void 0 : _b.setLoopPlay(false);
19336
+ }
19321
19337
  setIsLoadMore(true);
19322
19338
  loadVideos === null || loadVideos === void 0 ? void 0 : loadVideos(pageNum).then((res) => {
19323
19339
  var _a;