pb-sxp-ui 1.0.48 → 1.0.49

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
@@ -489,20 +489,20 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
489
489
  }, [bffDataSource]);
490
490
  // 获取推荐视频数据
491
491
  const getRecommendVideos = React.useCallback((query) => __awaiter(void 0, void 0, void 0, function* () {
492
- var _a, _b, _c, _d;
492
+ var _a, _b, _c, _d, _e;
493
493
  query = {
494
- maxSize,
495
- defaultSize: (_a = query === null || query === void 0 ? void 0 : query.defaultSize) !== null && _a !== void 0 ? _a : defaultSize,
494
+ maxSize: (_a = query === null || query === void 0 ? void 0 : query.maxSize) !== null && _a !== void 0 ? _a : maxSize,
495
+ defaultSize: (_b = query === null || query === void 0 ? void 0 : query.defaultSize) !== null && _b !== void 0 ? _b : defaultSize,
496
496
  'itemFilter.itemId': query === null || query === void 0 ? void 0 : query['itemFilter.itemId'],
497
497
  'itemFilter.itemType': query === null || query === void 0 ? void 0 : query['itemFilter.itemType'],
498
498
  hashTag: query === null || query === void 0 ? void 0 : query.hashTag,
499
499
  traceInfo: query === null || query === void 0 ? void 0 : query.traceInfo
500
500
  };
501
501
  if (utmVal) {
502
- const val = (_d = (_c = (_b = utmVal === null || utmVal === void 0 ? void 0 : utmVal.split('&')) === null || _b === void 0 ? void 0 : _b.filter((val) => {
502
+ const val = (_e = (_d = (_c = utmVal === null || utmVal === void 0 ? void 0 : utmVal.split('&')) === null || _c === void 0 ? void 0 : _c.filter((val) => {
503
503
  const key = val.split('=')[0];
504
504
  return UTM_KEYS.includes(key);
505
- })) === null || _c === void 0 ? void 0 : _c.join('&')) !== null && _d !== void 0 ? _d : '';
505
+ })) === null || _d === void 0 ? void 0 : _d.join('&')) !== null && _e !== void 0 ? _e : '';
506
506
  query = Object.assign(Object.assign({}, query), { channel: decodeURIComponent(val) });
507
507
  }
508
508
  const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/recommend/list', { method: 'GET', query }));
@@ -514,7 +514,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
514
514
  return result === null || result === void 0 ? void 0 : result.data;
515
515
  }), [bffFetch, utmVal, maxSize, defaultSize]);
516
516
  const loadVideos = React.useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
517
- var _e, _f;
517
+ var _f, _g;
518
518
  if (rtcList.length <= 0) {
519
519
  return;
520
520
  }
@@ -523,8 +523,8 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
523
523
  'itemFilter.itemId': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemId,
524
524
  'itemFilter.itemType': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemType
525
525
  });
526
- setRtcList(rtcList.concat((_e = data === null || data === void 0 ? void 0 : data.recList) !== null && _e !== void 0 ? _e : []));
527
- setCacheRtcList(cacheRtcList.concat((_f = data === null || data === void 0 ? void 0 : data.recList) !== null && _f !== void 0 ? _f : []));
526
+ setRtcList(rtcList.concat((_f = data === null || data === void 0 ? void 0 : data.recList) !== null && _f !== void 0 ? _f : []));
527
+ setCacheRtcList(cacheRtcList.concat((_g = data === null || data === void 0 ? void 0 : data.recList) !== null && _g !== void 0 ? _g : []));
528
528
  }), [getRecommendVideos, rtcList, waterFallData, cacheRtcList]);
529
529
  const bffEventReport = React.useCallback(({ userInfo, eventInfo }) => {
530
530
  // 关闭 BFF 事件上报
@@ -568,12 +568,12 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
568
568
  }), [bffFetch]);
569
569
  // 获取 Tag
570
570
  const bffGetTagList = React.useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
571
- var _g, _h;
571
+ var _h, _j;
572
572
  if (!utmVal)
573
573
  return;
574
574
  try {
575
575
  const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/tag/list', { method: 'GET', query: { channel: utmVal } }));
576
- setTagList((_h = (_g = result === null || result === void 0 ? void 0 : result.data) === null || _g === void 0 ? void 0 : _g.tags) !== null && _h !== void 0 ? _h : []);
576
+ setTagList((_j = (_h = result === null || result === void 0 ? void 0 : result.data) === null || _h === void 0 ? void 0 : _h.tags) !== null && _j !== void 0 ? _j : []);
577
577
  }
578
578
  catch (e) {
579
579
  console.log('e', e);
@@ -11730,7 +11730,8 @@ function WaterfallList(_a) {
11730
11730
  hashTag: waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag,
11731
11731
  'itemFilter.itemId': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemId,
11732
11732
  'itemFilter.itemType': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemType,
11733
- defaultSize: hashTagSize
11733
+ defaultSize: hashTagSize,
11734
+ maxSize: hashTagSize
11734
11735
  }).then((res) => {
11735
11736
  var _a, _b;
11736
11737
  setData(res);
@@ -12141,12 +12142,13 @@ const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPost
12141
12142
  }, [bffEventReport, data, index, isFirstPlay, videoRef]);
12142
12143
  const handLoadeddata = React.useCallback(() => {
12143
12144
  var _a;
12144
- if (!videoRef || isBgColor || firstFrameSrc)
12145
+ if (!videoRef || isBgColor || firstFrameSrc || !blur)
12145
12146
  return;
12146
12147
  const videoDomRef = document.getElementById('player-container-id_html5_api');
12147
12148
  if (((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.cover) || !canvasRef || !videoDomRef || !canvasRef.current)
12148
12149
  return;
12149
12150
  const setFrameImg = () => {
12151
+ videoDomRef.style.objectFit = 'contain';
12150
12152
  const video = videoDomRef;
12151
12153
  const canvas = canvasRef === null || canvasRef === void 0 ? void 0 : canvasRef.current;
12152
12154
  const ctx = canvas.getContext('2d');
@@ -12161,7 +12163,7 @@ const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPost
12161
12163
  setTimeout(() => {
12162
12164
  setFrameImg();
12163
12165
  }, 500);
12164
- }, [videoRef, isBgColor, rec, firstFrameSrc]);
12166
+ }, [videoRef, isBgColor, rec, firstFrameSrc, blur]);
12165
12167
  const handleLoadedmetadata = React.useCallback(() => {
12166
12168
  if (!videoRef)
12167
12169
  return;
@@ -12654,47 +12656,11 @@ const Nudge = ({ nudge }) => {
12654
12656
  React.createElement("p", { style: Object.assign({}, nudge === null || nudge === void 0 ? void 0 : nudge.textStyle) }, (_g = nudge === null || nudge === void 0 ? void 0 : nudge.content) !== null && _g !== void 0 ? _g : '')))));
12655
12657
  };
12656
12658
 
12657
- const DEFAULT_TAG = 'FOR U';
12658
- const Tagbar = ({ tagList = [], setActiveIndex }) => {
12659
- const [selectTag, setSelectTag] = React.useState(DEFAULT_TAG);
12660
- const { getRecommendVideos, setRtcList, setCacheRtcList, setCacheActiveIndex, setLoading, swiperRef } = useSxpDataSource();
12661
- const realTagList = React.useMemo(() => {
12662
- return [DEFAULT_TAG, ...tagList];
12663
- }, [tagList]);
12664
- const handleSelectTag = (tag) => () => {
12665
- if (tag === selectTag)
12666
- return;
12667
- let hashTag;
12668
- if (tag !== DEFAULT_TAG) {
12669
- hashTag = tag;
12670
- }
12671
- setLoading === null || setLoading === void 0 ? void 0 : setLoading(true);
12672
- getRecommendVideos === null || getRecommendVideos === void 0 ? void 0 : getRecommendVideos({ hashTag }).then((res) => {
12673
- var _a, _b, _c, _d;
12674
- setRtcList === null || setRtcList === void 0 ? void 0 : setRtcList((_a = res === null || res === void 0 ? void 0 : res.recList) !== null && _a !== void 0 ? _a : []);
12675
- setCacheRtcList === null || setCacheRtcList === void 0 ? void 0 : setCacheRtcList((_b = res === null || res === void 0 ? void 0 : res.recList) !== null && _b !== void 0 ? _b : []);
12676
- setActiveIndex === null || setActiveIndex === void 0 ? void 0 : setActiveIndex(0);
12677
- setCacheActiveIndex === null || setCacheActiveIndex === void 0 ? void 0 : setCacheActiveIndex(0);
12678
- (_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(0);
12679
- }).finally(() => {
12680
- setLoading === null || setLoading === void 0 ? void 0 : setLoading(false);
12681
- });
12682
- setSelectTag(tag);
12683
- };
12684
- if (tagList.length <= 0)
12685
- return null;
12686
- return (React.createElement("div", { className: 'clc-sxp-tagbar' },
12687
- React.createElement("ul", { className: 'clc-sxp-tagbar-list', style: { margin: 'auto', gap: 24 } }, realTagList.map((tag) => {
12688
- return (React.createElement("li", { className: `clc-sxp-tagbar-list-item ${tag === selectTag ? 'clc-sxp-tagbar-list-item-active' : ''}`, key: tag, onClick: handleSelectTag(tag) }, tag));
12689
- }))));
12690
- };
12691
- var Tagbar$1 = React.memo(Tagbar);
12692
-
12693
12659
  /*
12694
12660
  * @Author: binruan@chatlabs.com
12695
12661
  * @Date: 2024-01-15 19:03:09
12696
12662
  * @LastEditors: binruan@chatlabs.com
12697
- * @LastEditTime: 2024-04-29 16:55:16
12663
+ * @LastEditTime: 2024-04-30 15:43:40
12698
12664
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\index.tsx
12699
12665
  *
12700
12666
  */
@@ -13094,7 +13060,6 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
13094
13060
  setOpenHashtag === null || setOpenHashtag === void 0 ? void 0 : setOpenHashtag(true);
13095
13061
  } })),
13096
13062
  renderLogo,
13097
- React.createElement(Tagbar$1, { tagList: tagList, setActiveIndex: setActiveIndex }),
13098
13063
  isShowFingerTip ? React.createElement(FingerSwipeTip, { imageUrl: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.swipeTipIcon }) : null,
13099
13064
  React.createElement(Swiper, { ref: swiperRef, onSlideChange: () => {
13100
13065
  swiperRef.current.swiper.allowTouchMove = false;
@@ -13155,6 +13120,42 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
13155
13120
  React.createElement("div", { id: 'player-container-id-copy' }))));
13156
13121
  };
13157
13122
 
13123
+ const DEFAULT_TAG = 'FOR U';
13124
+ const Tagbar = ({ tagList = [], setActiveIndex }) => {
13125
+ const [selectTag, setSelectTag] = React.useState(DEFAULT_TAG);
13126
+ const { getRecommendVideos, setRtcList, setCacheRtcList, setCacheActiveIndex, setLoading, swiperRef } = useSxpDataSource();
13127
+ const realTagList = React.useMemo(() => {
13128
+ return [DEFAULT_TAG, ...tagList];
13129
+ }, [tagList]);
13130
+ const handleSelectTag = (tag) => () => {
13131
+ if (tag === selectTag)
13132
+ return;
13133
+ let hashTag;
13134
+ if (tag !== DEFAULT_TAG) {
13135
+ hashTag = tag;
13136
+ }
13137
+ setLoading === null || setLoading === void 0 ? void 0 : setLoading(true);
13138
+ getRecommendVideos === null || getRecommendVideos === void 0 ? void 0 : getRecommendVideos({ hashTag }).then((res) => {
13139
+ var _a, _b, _c, _d;
13140
+ setRtcList === null || setRtcList === void 0 ? void 0 : setRtcList((_a = res === null || res === void 0 ? void 0 : res.recList) !== null && _a !== void 0 ? _a : []);
13141
+ setCacheRtcList === null || setCacheRtcList === void 0 ? void 0 : setCacheRtcList((_b = res === null || res === void 0 ? void 0 : res.recList) !== null && _b !== void 0 ? _b : []);
13142
+ setActiveIndex === null || setActiveIndex === void 0 ? void 0 : setActiveIndex(0);
13143
+ setCacheActiveIndex === null || setCacheActiveIndex === void 0 ? void 0 : setCacheActiveIndex(0);
13144
+ (_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(0);
13145
+ }).finally(() => {
13146
+ setLoading === null || setLoading === void 0 ? void 0 : setLoading(false);
13147
+ });
13148
+ setSelectTag(tag);
13149
+ };
13150
+ if (tagList.length <= 0)
13151
+ return null;
13152
+ return (React.createElement("div", { className: 'clc-sxp-tagbar' },
13153
+ React.createElement("ul", { className: 'clc-sxp-tagbar-list', style: { margin: 'auto', gap: 24 } }, realTagList.map((tag) => {
13154
+ return (React.createElement("li", { className: `clc-sxp-tagbar-list-item ${tag === selectTag ? 'clc-sxp-tagbar-list-item-active' : ''}`, key: tag, onClick: handleSelectTag(tag) }, tag));
13155
+ }))));
13156
+ };
13157
+ var Tagbar$1 = React.memo(Tagbar);
13158
+
13158
13159
  const PictureGroup = ({ imgUrls, width, height, imgUrlsPostConfig, rec, index }) => {
13159
13160
  return (React.createElement(Swiper, { defaultValue: 0, direction: 'horizontal', modules: [Pagination, Autoplay], pagination: { clickable: true, bulletActiveClass: 'swipe-item-active-bullet' }, height: height, style: { width }, loop: true, autoplay: false }, imgUrls === null || imgUrls === void 0 ? void 0 : imgUrls.map((url) => {
13160
13161
  return (React.createElement(SwiperSlide, { key: url },