pb-sxp-ui 1.0.83 → 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/pb-ui.js CHANGED
@@ -434,7 +434,7 @@
434
434
  * @Author: binruan@chatlabs.com
435
435
  * @Date: 2024-06-13 15:16:53
436
436
  * @LastEditors: binruan@chatlabs.com
437
- * @LastEditTime: 2024-06-13 18:22:53
437
+ * @LastEditTime: 2024-06-17 14:25:01
438
438
  * @FilePath: \pb-sxp-ui\src\core\components\Consent\index.tsx
439
439
  *
440
440
  */
@@ -503,8 +503,8 @@
503
503
  DataSourceType[DataSourceType["BFF"] = 5] = "BFF";
504
504
  })(DataSourceType || (DataSourceType = {}));
505
505
  const UTM_KEYS = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_id', 'utm_content', 'cl_source'];
506
- 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 }) => {
507
- var _a, _b, _c, _d, _e, _f, _g;
506
+ 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 }) => {
507
+ var _a, _b, _c;
508
508
  const [rtcList, setRtcList] = React.useState([]);
509
509
  const [tagList, setTagList] = React.useState([]);
510
510
  const [loading, setLoading] = React.useState(false);
@@ -522,6 +522,10 @@
522
522
  const [videoRef, setVideoRef] = React.useState(null);
523
523
  const themeTag = React.useRef();
524
524
  const curTime = React.useRef();
525
+ const isShowConsent = React.useMemo(() => {
526
+ var _a, _b, _c, _d;
527
+ 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;
528
+ }, [isAgreePolicy, globalConfig, isOpenConsent, isEditor]);
525
529
  React.useEffect(() => {
526
530
  const handleChangeThemeTag = (tag) => {
527
531
  themeTag.current = tag;
@@ -566,10 +570,10 @@
566
570
  }, [bffDataSource]);
567
571
  // 获取推荐视频数据
568
572
  const getRecommendVideos = React.useCallback((query) => __awaiter(void 0, void 0, void 0, function* () {
569
- var _h, _j, _k, _l, _m;
573
+ var _d, _e, _f, _g, _h;
570
574
  query = {
571
- maxSize: (_h = query === null || query === void 0 ? void 0 : query.maxSize) !== null && _h !== void 0 ? _h : maxSize,
572
- defaultSize: (_j = query === null || query === void 0 ? void 0 : query.defaultSize) !== null && _j !== void 0 ? _j : defaultSize,
575
+ maxSize: (_d = query === null || query === void 0 ? void 0 : query.maxSize) !== null && _d !== void 0 ? _d : maxSize,
576
+ defaultSize: (_e = query === null || query === void 0 ? void 0 : query.defaultSize) !== null && _e !== void 0 ? _e : defaultSize,
573
577
  'itemFilter.itemId': query === null || query === void 0 ? void 0 : query['itemFilter.itemId'],
574
578
  'itemFilter.itemType': query === null || query === void 0 ? void 0 : query['itemFilter.itemType'],
575
579
  hashTag: query === null || query === void 0 ? void 0 : query.hashTag,
@@ -577,10 +581,10 @@
577
581
  themeTag: query === null || query === void 0 ? void 0 : query.themeTag
578
582
  };
579
583
  if (utmVal) {
580
- const val = (_m = (_l = (_k = utmVal === null || utmVal === void 0 ? void 0 : utmVal.split('&')) === null || _k === void 0 ? void 0 : _k.filter((val) => {
584
+ const val = (_h = (_g = (_f = utmVal === null || utmVal === void 0 ? void 0 : utmVal.split('&')) === null || _f === void 0 ? void 0 : _f.filter((val) => {
581
585
  const key = val.split('=')[0];
582
586
  return UTM_KEYS.includes(key);
583
- })) === null || _l === void 0 ? void 0 : _l.join('&')) !== null && _m !== void 0 ? _m : '';
587
+ })) === null || _g === void 0 ? void 0 : _g.join('&')) !== null && _h !== void 0 ? _h : '';
584
588
  query = Object.assign(Object.assign({}, query), { channel: decodeURIComponent(val) });
585
589
  }
586
590
  const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/recommend/list', { method: 'GET', query }));
@@ -592,7 +596,7 @@
592
596
  return result === null || result === void 0 ? void 0 : result.data;
593
597
  }), [bffFetch, utmVal, maxSize, defaultSize]);
594
598
  const loadVideos = React.useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
595
- var _o, _p;
599
+ var _j, _k;
596
600
  if (rtcList.length <= 0) {
597
601
  return;
598
602
  }
@@ -602,8 +606,8 @@
602
606
  'itemFilter.itemType': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemType,
603
607
  themeTag: themeTag.current
604
608
  });
605
- setRtcList(rtcList.concat((_o = data === null || data === void 0 ? void 0 : data.recList) !== null && _o !== void 0 ? _o : []));
606
- setCacheRtcList(cacheRtcList.concat((_p = data === null || data === void 0 ? void 0 : data.recList) !== null && _p !== void 0 ? _p : []));
609
+ setRtcList(rtcList.concat((_j = data === null || data === void 0 ? void 0 : data.recList) !== null && _j !== void 0 ? _j : []));
610
+ setCacheRtcList(cacheRtcList.concat((_k = data === null || data === void 0 ? void 0 : data.recList) !== null && _k !== void 0 ? _k : []));
607
611
  }), [getRecommendVideos, rtcList, waterFallData, cacheRtcList]);
608
612
  const bffEventReport = React.useCallback(({ userInfo, eventInfo }) => {
609
613
  // 关闭 BFF 事件上报
@@ -667,16 +671,16 @@
667
671
  }), [bffFetch]);
668
672
  // 获取 Tag
669
673
  const bffGetTagList = React.useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
670
- var _q, _r, _s, _t, _u;
674
+ var _l, _m, _o, _p, _q;
671
675
  if (!utmVal || !isShowTag)
672
676
  return;
673
677
  try {
674
- const val = (_s = (_r = (_q = utmVal === null || utmVal === void 0 ? void 0 : utmVal.split('&')) === null || _q === void 0 ? void 0 : _q.filter((val) => {
678
+ const val = (_o = (_m = (_l = utmVal === null || utmVal === void 0 ? void 0 : utmVal.split('&')) === null || _l === void 0 ? void 0 : _l.filter((val) => {
675
679
  const key = val.split('=')[0];
676
680
  return UTM_KEYS.includes(key);
677
- })) === null || _r === void 0 ? void 0 : _r.join('&')) !== null && _s !== void 0 ? _s : '';
681
+ })) === null || _m === void 0 ? void 0 : _m.join('&')) !== null && _o !== void 0 ? _o : '';
678
682
  const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/tag/list', { method: 'GET', query: { channel: decodeURIComponent(val) } }));
679
- 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 : []);
683
+ 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 : []);
680
684
  }
681
685
  catch (e) {
682
686
  console.log('e', e);
@@ -730,7 +734,7 @@
730
734
  h5EnterLink();
731
735
  }, []);
732
736
  React.useEffect(() => {
733
- if (!isAgreePolicy)
737
+ if (isShowConsent)
734
738
  return;
735
739
  setLoading(true);
736
740
  bffGetTagList();
@@ -750,7 +754,7 @@
750
754
  setLoading(false);
751
755
  isInit.current = true;
752
756
  });
753
- }, [isAgreePolicy]);
757
+ }, [isShowConsent]);
754
758
  React.useEffect(() => {
755
759
  if (!isInit.current)
756
760
  return;
@@ -808,7 +812,7 @@
808
812
  curTime,
809
813
  h5EnterLink,
810
814
  themeTag
811
- } }, (((_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({
815
+ } }, 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({
812
816
  rtcList,
813
817
  mutateLike: bffMutateLike,
814
818
  mutateUnlike: bffMutateUnlike,