pb-sxp-ui 1.0.84 → 1.0.85

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
@@ -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,