pb-sxp-ui 1.0.84 → 1.0.86

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
@@ -419,7 +419,7 @@ var SXP_EVENT_TYPE;
419
419
  * @Author: binruan@chatlabs.com
420
420
  * @Date: 2024-06-13 15:16:53
421
421
  * @LastEditors: binruan@chatlabs.com
422
- * @LastEditTime: 2024-06-17 14:25:01
422
+ * @LastEditTime: 2024-06-18 16:06:16
423
423
  * @FilePath: \pb-sxp-ui\src\core\components\Consent\index.tsx
424
424
  *
425
425
  */
@@ -459,7 +459,7 @@ const Consent$2 = ({ width = window.innerWidth, height = window.innerHeight, pri
459
459
  eventSubject: 'userConsent',
460
460
  eventDescription: '用户授权【操作结果】',
461
461
  consentResult: '0',
462
- consentTags: '[]',
462
+ consentTags: '["系统运营"]',
463
463
  rtc: null,
464
464
  requestId: null,
465
465
  sessionID: null
@@ -488,8 +488,8 @@ var DataSourceType;
488
488
  DataSourceType[DataSourceType["BFF"] = 5] = "BFF";
489
489
  })(DataSourceType || (DataSourceType = {}));
490
490
  const UTM_KEYS = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_id', 'utm_content', 'cl_source'];
491
- const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent = true, maxSize, defaultSize, isPreview = false, sxpParameter, appDomain, hashTagSize, loadingImage, isOpenHashTag = false, enabledMetaConversionApi = false, consentHeight, consentWidth, isShowTag = true, isOpenConsent = false, globalConfig }) => {
492
- var _a, _b, _c, _d, _e, _f, _g;
491
+ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent = true, maxSize, defaultSize, isPreview = false, sxpParameter, appDomain, hashTagSize, loadingImage, isOpenHashTag = false, enabledMetaConversionApi = false, consentHeight, consentWidth, isShowTag = true, isOpenConsent = false, globalConfig, isEditor = false }) => {
492
+ var _a, _b, _c;
493
493
  const [rtcList, setRtcList] = useState([]);
494
494
  const [tagList, setTagList] = useState([]);
495
495
  const [loading, setLoading] = useState(false);
@@ -507,6 +507,10 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
507
507
  const [videoRef, setVideoRef] = useState(null);
508
508
  const themeTag = useRef();
509
509
  const curTime = useRef();
510
+ const isShowConsent = useMemo(() => {
511
+ var _a, _b, _c, _d;
512
+ return (((_d = (_c = (_b = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.consent) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.item) === null || _c === void 0 ? void 0 : _c.props) === null || _d === void 0 ? void 0 : _d.privacy_necessity) && !isAgreePolicy && !isEditor) || isOpenConsent;
513
+ }, [isAgreePolicy, globalConfig, isOpenConsent, isEditor]);
510
514
  useEffect(() => {
511
515
  const handleChangeThemeTag = (tag) => {
512
516
  themeTag.current = tag;
@@ -551,10 +555,10 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
551
555
  }, [bffDataSource]);
552
556
  // 获取推荐视频数据
553
557
  const getRecommendVideos = useCallback((query) => __awaiter(void 0, void 0, void 0, function* () {
554
- var _h, _j, _k, _l, _m;
558
+ var _d, _e, _f, _g, _h;
555
559
  query = {
556
- maxSize: (_h = query === null || query === void 0 ? void 0 : query.maxSize) !== null && _h !== void 0 ? _h : maxSize,
557
- defaultSize: (_j = query === null || query === void 0 ? void 0 : query.defaultSize) !== null && _j !== void 0 ? _j : defaultSize,
560
+ maxSize: (_d = query === null || query === void 0 ? void 0 : query.maxSize) !== null && _d !== void 0 ? _d : maxSize,
561
+ defaultSize: (_e = query === null || query === void 0 ? void 0 : query.defaultSize) !== null && _e !== void 0 ? _e : defaultSize,
558
562
  'itemFilter.itemId': query === null || query === void 0 ? void 0 : query['itemFilter.itemId'],
559
563
  'itemFilter.itemType': query === null || query === void 0 ? void 0 : query['itemFilter.itemType'],
560
564
  hashTag: query === null || query === void 0 ? void 0 : query.hashTag,
@@ -562,10 +566,10 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
562
566
  themeTag: query === null || query === void 0 ? void 0 : query.themeTag
563
567
  };
564
568
  if (utmVal) {
565
- const val = (_m = (_l = (_k = utmVal === null || utmVal === void 0 ? void 0 : utmVal.split('&')) === null || _k === void 0 ? void 0 : _k.filter((val) => {
569
+ const val = (_h = (_g = (_f = utmVal === null || utmVal === void 0 ? void 0 : utmVal.split('&')) === null || _f === void 0 ? void 0 : _f.filter((val) => {
566
570
  const key = val.split('=')[0];
567
571
  return UTM_KEYS.includes(key);
568
- })) === null || _l === void 0 ? void 0 : _l.join('&')) !== null && _m !== void 0 ? _m : '';
572
+ })) === null || _g === void 0 ? void 0 : _g.join('&')) !== null && _h !== void 0 ? _h : '';
569
573
  query = Object.assign(Object.assign({}, query), { channel: decodeURIComponent(val) });
570
574
  }
571
575
  const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/recommend/list', { method: 'GET', query }));
@@ -577,7 +581,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
577
581
  return result === null || result === void 0 ? void 0 : result.data;
578
582
  }), [bffFetch, utmVal, maxSize, defaultSize]);
579
583
  const loadVideos = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
580
- var _o, _p;
584
+ var _j, _k;
581
585
  if (rtcList.length <= 0) {
582
586
  return;
583
587
  }
@@ -587,8 +591,8 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
587
591
  'itemFilter.itemType': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemType,
588
592
  themeTag: themeTag.current
589
593
  });
590
- setRtcList(rtcList.concat((_o = data === null || data === void 0 ? void 0 : data.recList) !== null && _o !== void 0 ? _o : []));
591
- setCacheRtcList(cacheRtcList.concat((_p = data === null || data === void 0 ? void 0 : data.recList) !== null && _p !== void 0 ? _p : []));
594
+ setRtcList(rtcList.concat((_j = data === null || data === void 0 ? void 0 : data.recList) !== null && _j !== void 0 ? _j : []));
595
+ setCacheRtcList(cacheRtcList.concat((_k = data === null || data === void 0 ? void 0 : data.recList) !== null && _k !== void 0 ? _k : []));
592
596
  }), [getRecommendVideos, rtcList, waterFallData, cacheRtcList]);
593
597
  const bffEventReport = useCallback(({ userInfo, eventInfo }) => {
594
598
  // 关闭 BFF 事件上报
@@ -652,16 +656,16 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
652
656
  }), [bffFetch]);
653
657
  // 获取 Tag
654
658
  const bffGetTagList = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
655
- var _q, _r, _s, _t, _u;
659
+ var _l, _m, _o, _p, _q;
656
660
  if (!utmVal || !isShowTag)
657
661
  return;
658
662
  try {
659
- const val = (_s = (_r = (_q = utmVal === null || utmVal === void 0 ? void 0 : utmVal.split('&')) === null || _q === void 0 ? void 0 : _q.filter((val) => {
663
+ const val = (_o = (_m = (_l = utmVal === null || utmVal === void 0 ? void 0 : utmVal.split('&')) === null || _l === void 0 ? void 0 : _l.filter((val) => {
660
664
  const key = val.split('=')[0];
661
665
  return UTM_KEYS.includes(key);
662
- })) === null || _r === void 0 ? void 0 : _r.join('&')) !== null && _s !== void 0 ? _s : '';
666
+ })) === null || _m === void 0 ? void 0 : _m.join('&')) !== null && _o !== void 0 ? _o : '';
663
667
  const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/tag/list', { method: 'GET', query: { channel: decodeURIComponent(val) } }));
664
- setTagList((_u = (_t = result === null || result === void 0 ? void 0 : result.data) === null || _t === void 0 ? void 0 : _t.tags) !== null && _u !== void 0 ? _u : []);
668
+ setTagList((_q = (_p = result === null || result === void 0 ? void 0 : result.data) === null || _p === void 0 ? void 0 : _p.tags) !== null && _q !== void 0 ? _q : []);
665
669
  }
666
670
  catch (e) {
667
671
  console.log('e', e);
@@ -715,7 +719,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
715
719
  h5EnterLink();
716
720
  }, []);
717
721
  useEffect(() => {
718
- if (!isAgreePolicy)
722
+ if (isShowConsent)
719
723
  return;
720
724
  setLoading(true);
721
725
  bffGetTagList();
@@ -735,7 +739,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
735
739
  setLoading(false);
736
740
  isInit.current = true;
737
741
  });
738
- }, [isAgreePolicy]);
742
+ }, [isShowConsent]);
739
743
  useEffect(() => {
740
744
  if (!isInit.current)
741
745
  return;
@@ -793,7 +797,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
793
797
  curTime,
794
798
  h5EnterLink,
795
799
  themeTag
796
- } }, (((_d = (_c = (_b = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.consent) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.item) === null || _c === void 0 ? void 0 : _c.props) === null || _d === void 0 ? void 0 : _d.privacy_necessity) && !isAgreePolicy) || isOpenConsent ? (React.createElement(Consent$3, Object.assign({}, (_g = (_f = (_e = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.consent) === null || _e === void 0 ? void 0 : _e[0]) === null || _f === void 0 ? void 0 : _f.item) === null || _g === void 0 ? void 0 : _g.props))) : (render({
800
+ } }, isShowConsent ? (React.createElement(Consent$3, Object.assign({}, (_c = (_b = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.consent) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.item) === null || _c === void 0 ? void 0 : _c.props))) : (render({
797
801
  rtcList,
798
802
  mutateLike: bffMutateLike,
799
803
  mutateUnlike: bffMutateUnlike,
@@ -12059,8 +12063,8 @@ const WaterfallFlowItem$1 = (props) => {
12059
12063
  // 通过宽度比例获取图片高度
12060
12064
  const height = imgInfo.height * (unitWidth / imgInfo.width);
12061
12065
  if (isLoading) {
12062
- // 加40是因为下方文字部分高度为40,可以自己设置
12063
- sizeChange(height + 76 + space, index);
12066
+ // 加56是因为下方文字部分高度为56,可以自己设置
12067
+ sizeChange(height + 56 + space, index);
12064
12068
  }
12065
12069
  }, [imgInfo, index, unitWidth, isLoading, space]); /* 增加sizeChange依赖项会导致在admin预览编辑时无限刷新 */
12066
12070
  const calculateHeightForWidth = (videoWidth, videoHeight, targetWidth) => {
@@ -13582,7 +13586,7 @@ var Tagbar$1 = memo(Tagbar);
13582
13586
  * @Author: binruan@chatlabs.com
13583
13587
  * @Date: 2024-01-15 19:03:09
13584
13588
  * @LastEditors: binruan@chatlabs.com
13585
- * @LastEditTime: 2024-06-13 18:09:16
13589
+ * @LastEditTime: 2024-06-18 11:50:31
13586
13590
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\index.tsx
13587
13591
  *
13588
13592
  */
@@ -13673,9 +13677,11 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
13673
13677
  if (document.visibilityState === 'hidden') {
13674
13678
  // 当用户导航到新页面、切换标签页、关闭标签页、最小化或关闭浏览器、刷新原页面(即离开原页面时),或者在移动设备上从浏览器切换到不同的应用程序时
13675
13679
  // 移动端h5直接杀掉浏览器或宿主app时不会触发,pc端直接杀掉标签页时能触发
13676
- SXP_EVENT_BUS.emit(SXP_EVENT_TYPE.PAGE_DID_HIDE, item);
13677
- handleReportViewImageEnd(item);
13678
- handleReportProductView(item);
13680
+ if (!openHashtag) {
13681
+ SXP_EVENT_BUS.emit(SXP_EVENT_TYPE.PAGE_DID_HIDE, item);
13682
+ handleReportViewImageEnd(item);
13683
+ handleReportProductView(item);
13684
+ }
13679
13685
  let fromKName = '';
13680
13686
  if (popupDetailData && (((_b = (_a = item === null || item === void 0 ? void 0 : item.video) === null || _a === void 0 ? void 0 : _a.bindProducts) === null || _b === void 0 ? void 0 : _b.length) || ((_c = item === null || item === void 0 ? void 0 : item.video) === null || _c === void 0 ? void 0 : _c.bindProduct))) {
13681
13687
  fromKName = 'pdpPage';
@@ -13712,8 +13718,10 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
13712
13718
  else if (document.visibilityState === 'visible') {
13713
13719
  // 页面可见时触发,注意页面初始化时不会触发
13714
13720
  handleH5EnterLink();
13715
- handleViewImageStartEvent(activeIndex);
13716
- SXP_EVENT_BUS.emit(SXP_EVENT_TYPE.PAGE_DID_SHOW, item);
13721
+ if (!openHashtag) {
13722
+ handleViewImageStartEvent(activeIndex);
13723
+ SXP_EVENT_BUS.emit(SXP_EVENT_TYPE.PAGE_DID_SHOW, item);
13724
+ }
13717
13725
  backMainFeed('external');
13718
13726
  }
13719
13727
  };
@@ -13730,7 +13738,8 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
13730
13738
  isFromHashtag,
13731
13739
  tempMap,
13732
13740
  curTime,
13733
- backMainFeed
13741
+ backMainFeed,
13742
+ openHashtag
13734
13743
  ]);
13735
13744
  useEffect(() => {
13736
13745
  const initTime = () => {