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.cjs CHANGED
@@ -644,6 +644,7 @@ const DEFAULT_TAG = 'FOR U';
644
644
  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 }) => {
645
645
  var _a, _b, _c, _d, _e;
646
646
  const [rtcList, setRtcList] = React.useState([]);
647
+ const [firstRtcList, setFirstRtcList] = React.useState([]);
647
648
  const [tagList, setTagList] = React.useState([]);
648
649
  const [loading, setLoading] = React.useState(true);
649
650
  const [curReqInfo, setCurReqInfo] = React.useState({ rtc: '', requestId: '' });
@@ -814,6 +815,9 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
814
815
  if ((rtcList === null || rtcList === void 0 ? void 0 : rtcList.length) === 0) {
815
816
  setRtcList(getFilterRecList(Object.assign(Object.assign({}, result === null || result === void 0 ? void 0 : result.data), { recList: list })));
816
817
  setCacheRtcList(getFilterRecList(Object.assign(Object.assign({}, result === null || result === void 0 ? void 0 : result.data), { recList: list })));
818
+ if (isDiyH5) {
819
+ setFirstRtcList(getFilterRecList(Object.assign(Object.assign({}, result === null || result === void 0 ? void 0 : result.data), { recList: list })));
820
+ }
817
821
  }
818
822
  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));
819
823
  if (isNotNullList) {
@@ -853,12 +857,17 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
853
857
  if (rtcList.length <= 0) {
854
858
  return;
855
859
  }
860
+ if (isDiyH5 && (firstRtcList === null || firstRtcList === void 0 ? void 0 : firstRtcList.length) > 0) {
861
+ setRtcList(rtcList.concat(firstRtcList));
862
+ setCacheRtcList(cacheRtcList.concat(firstRtcList));
863
+ return;
864
+ }
856
865
  const lastItem = rtcList === null || rtcList === void 0 ? void 0 : rtcList[(rtcList === null || rtcList === void 0 ? void 0 : rtcList.length) - 1];
857
866
  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 })));
858
867
  setRtcList(rtcList.concat(getFilterRecList(data)));
859
868
  setCacheRtcList(cacheRtcList.concat(getFilterRecList(data)));
860
869
  return data;
861
- }), [getRecommendVideos, rtcList, waterFallData, cacheRtcList]);
870
+ }), [getRecommendVideos, rtcList, waterFallData, cacheRtcList, isDiyH5, firstRtcList]);
862
871
  const refreshFeSession = React.useCallback((enableReSid, event) => {
863
872
  var _a, _b, _c, _d, _e;
864
873
  let expire = false;
@@ -1205,6 +1214,9 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
1205
1214
  }
1206
1215
  setRtcList(list);
1207
1216
  setCacheRtcList(list);
1217
+ if (isDiyH5) {
1218
+ setFirstRtcList(list);
1219
+ }
1208
1220
  bffGetTagList(curData !== null && curData !== void 0 ? curData : finalPageData);
1209
1221
  if (channel) {
1210
1222
  const item = list === null || list === void 0 ? void 0 : list[0];
@@ -1240,6 +1252,9 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
1240
1252
  }
1241
1253
  setRtcList(list);
1242
1254
  setCacheRtcList(list);
1255
+ if (isDiyH5) {
1256
+ setFirstRtcList(list);
1257
+ }
1243
1258
  }
1244
1259
  })
1245
1260
  .finally(() => {
@@ -17936,23 +17951,21 @@ const VideoWidget$4 = React.forwardRef(({ rec, index, height, data, muted, activ
17936
17951
  (_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.play();
17937
17952
  }, [videoRef === null || videoRef === void 0 ? void 0 : videoRef.current]);
17938
17953
  const handleEnd = () => {
17939
- var _a, _b, _c, _d, _e, _f, _g, _h;
17954
+ var _a, _b, _c, _d, _e, _f;
17940
17955
  if (!videoRef.current)
17941
17956
  return;
17942
17957
  if (isDiyH5) {
17943
17958
  (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.pause();
17944
17959
  if (!loopPlayRef.current)
17945
17960
  return;
17946
- if (index === (data === null || data === void 0 ? void 0 : data.length) - 1) {
17947
- (_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);
17948
- }
17961
+ if (index === (data === null || data === void 0 ? void 0 : data.length) - 1) ;
17949
17962
  else {
17950
- 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;
17951
- (_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);
17963
+ 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;
17964
+ (_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);
17952
17965
  }
17953
17966
  }
17954
17967
  else {
17955
- (_h = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _h === void 0 ? void 0 : _h.play();
17968
+ (_f = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _f === void 0 ? void 0 : _f.play();
17956
17969
  }
17957
17970
  };
17958
17971
  const PAUSE_ICON = useIconLink('/pb_static/06f28a2025c74c1cb49be6767316d827.png');
@@ -18357,15 +18370,13 @@ const PictureGroup$4 = React.forwardRef(({ imgUrls, data, height, rec, index, on
18357
18370
  let timerId;
18358
18371
  if (isLoad && isActive && isDiyH5) {
18359
18372
  timerId = setTimeout(() => {
18360
- var _a, _b, _c, _d, _e, _f;
18373
+ var _a, _b, _c, _d;
18361
18374
  if (!loopPlayRef.current)
18362
18375
  return;
18363
- if (index === (data === null || data === void 0 ? void 0 : data.length) - 1) {
18364
- (_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);
18365
- }
18376
+ if (index === (data === null || data === void 0 ? void 0 : data.length) - 1) ;
18366
18377
  else {
18367
- 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;
18368
- (_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);
18378
+ 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;
18379
+ (_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);
18369
18380
  }
18370
18381
  }, 3000);
18371
18382
  }
@@ -18373,7 +18384,7 @@ const PictureGroup$4 = React.forwardRef(({ imgUrls, data, height, rec, index, on
18373
18384
  if (timerId)
18374
18385
  clearTimeout(timerId);
18375
18386
  };
18376
- }, [isLoad, isActive, isDiyH5, data, index, swiperRef]);
18387
+ }, [isLoad, isActive, isDiyH5, index, swiperRef]);
18377
18388
  React.useEffect(() => {
18378
18389
  if (isLoad && isActive) {
18379
18390
  (imgsSwiperRef === null || imgsSwiperRef === void 0 ? void 0 : imgsSwiperRef.current) && imgsSwiperRef.current.swiper.autoplay.start();
@@ -19331,15 +19342,20 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
19331
19342
  swiperRef.current.swiper.allowTouchMove = true;
19332
19343
  }, 500);
19333
19344
  }, onActiveIndexChange: (swiper) => {
19345
+ var _a, _b;
19334
19346
  setActiveIndex(swiper.activeIndex);
19335
19347
  if (openHashtag)
19336
19348
  return;
19337
19349
  // 处理上滑下滑事件
19338
19350
  handleScrollEvent(swiper);
19339
- if (waterFallData || isEditor || isDiyH5)
19351
+ if (waterFallData || isEditor)
19340
19352
  return;
19341
19353
  if ((swiper === null || swiper === void 0 ? void 0 : swiper.activeIndex) + 1 >= (data === null || data === void 0 ? void 0 : data.length)) {
19342
19354
  if (!isLoadMore) {
19355
+ if (isDiyH5) {
19356
+ (_a = videoWidgetRef.current) === null || _a === void 0 ? void 0 : _a.setLoopPlay(false);
19357
+ (_b = pictureGroupRef.current) === null || _b === void 0 ? void 0 : _b.setLoopPlay(false);
19358
+ }
19343
19359
  setIsLoadMore(true);
19344
19360
  loadVideos === null || loadVideos === void 0 ? void 0 : loadVideos(pageNum).then((res) => {
19345
19361
  var _a;