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.cjs CHANGED
@@ -442,7 +442,7 @@ var SXP_EVENT_TYPE;
442
442
  * @Author: binruan@chatlabs.com
443
443
  * @Date: 2024-06-13 15:16:53
444
444
  * @LastEditors: binruan@chatlabs.com
445
- * @LastEditTime: 2024-06-17 14:25:01
445
+ * @LastEditTime: 2024-06-18 16:06:16
446
446
  * @FilePath: \pb-sxp-ui\src\core\components\Consent\index.tsx
447
447
  *
448
448
  */
@@ -482,7 +482,7 @@ const Consent$2 = ({ width = window.innerWidth, height = window.innerHeight, pri
482
482
  eventSubject: 'userConsent',
483
483
  eventDescription: '用户授权【操作结果】',
484
484
  consentResult: '0',
485
- consentTags: '[]',
485
+ consentTags: '["系统运营"]',
486
486
  rtc: null,
487
487
  requestId: null,
488
488
  sessionID: null
@@ -511,8 +511,8 @@ var DataSourceType;
511
511
  DataSourceType[DataSourceType["BFF"] = 5] = "BFF";
512
512
  })(DataSourceType || (DataSourceType = {}));
513
513
  const UTM_KEYS = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_id', 'utm_content', 'cl_source'];
514
- 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 }) => {
515
- var _a, _b, _c, _d, _e, _f, _g;
514
+ 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 }) => {
515
+ var _a, _b, _c;
516
516
  const [rtcList, setRtcList] = React.useState([]);
517
517
  const [tagList, setTagList] = React.useState([]);
518
518
  const [loading, setLoading] = React.useState(false);
@@ -530,6 +530,10 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
530
530
  const [videoRef, setVideoRef] = React.useState(null);
531
531
  const themeTag = React.useRef();
532
532
  const curTime = React.useRef();
533
+ const isShowConsent = React.useMemo(() => {
534
+ var _a, _b, _c, _d;
535
+ 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;
536
+ }, [isAgreePolicy, globalConfig, isOpenConsent, isEditor]);
533
537
  React.useEffect(() => {
534
538
  const handleChangeThemeTag = (tag) => {
535
539
  themeTag.current = tag;
@@ -574,10 +578,10 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
574
578
  }, [bffDataSource]);
575
579
  // 获取推荐视频数据
576
580
  const getRecommendVideos = React.useCallback((query) => __awaiter(void 0, void 0, void 0, function* () {
577
- var _h, _j, _k, _l, _m;
581
+ var _d, _e, _f, _g, _h;
578
582
  query = {
579
- maxSize: (_h = query === null || query === void 0 ? void 0 : query.maxSize) !== null && _h !== void 0 ? _h : maxSize,
580
- defaultSize: (_j = query === null || query === void 0 ? void 0 : query.defaultSize) !== null && _j !== void 0 ? _j : defaultSize,
583
+ maxSize: (_d = query === null || query === void 0 ? void 0 : query.maxSize) !== null && _d !== void 0 ? _d : maxSize,
584
+ defaultSize: (_e = query === null || query === void 0 ? void 0 : query.defaultSize) !== null && _e !== void 0 ? _e : defaultSize,
581
585
  'itemFilter.itemId': query === null || query === void 0 ? void 0 : query['itemFilter.itemId'],
582
586
  'itemFilter.itemType': query === null || query === void 0 ? void 0 : query['itemFilter.itemType'],
583
587
  hashTag: query === null || query === void 0 ? void 0 : query.hashTag,
@@ -585,10 +589,10 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
585
589
  themeTag: query === null || query === void 0 ? void 0 : query.themeTag
586
590
  };
587
591
  if (utmVal) {
588
- const val = (_m = (_l = (_k = utmVal === null || utmVal === void 0 ? void 0 : utmVal.split('&')) === null || _k === void 0 ? void 0 : _k.filter((val) => {
592
+ const val = (_h = (_g = (_f = utmVal === null || utmVal === void 0 ? void 0 : utmVal.split('&')) === null || _f === void 0 ? void 0 : _f.filter((val) => {
589
593
  const key = val.split('=')[0];
590
594
  return UTM_KEYS.includes(key);
591
- })) === null || _l === void 0 ? void 0 : _l.join('&')) !== null && _m !== void 0 ? _m : '';
595
+ })) === null || _g === void 0 ? void 0 : _g.join('&')) !== null && _h !== void 0 ? _h : '';
592
596
  query = Object.assign(Object.assign({}, query), { channel: decodeURIComponent(val) });
593
597
  }
594
598
  const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/recommend/list', { method: 'GET', query }));
@@ -600,7 +604,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
600
604
  return result === null || result === void 0 ? void 0 : result.data;
601
605
  }), [bffFetch, utmVal, maxSize, defaultSize]);
602
606
  const loadVideos = React.useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
603
- var _o, _p;
607
+ var _j, _k;
604
608
  if (rtcList.length <= 0) {
605
609
  return;
606
610
  }
@@ -610,8 +614,8 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
610
614
  'itemFilter.itemType': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemType,
611
615
  themeTag: themeTag.current
612
616
  });
613
- setRtcList(rtcList.concat((_o = data === null || data === void 0 ? void 0 : data.recList) !== null && _o !== void 0 ? _o : []));
614
- setCacheRtcList(cacheRtcList.concat((_p = data === null || data === void 0 ? void 0 : data.recList) !== null && _p !== void 0 ? _p : []));
617
+ setRtcList(rtcList.concat((_j = data === null || data === void 0 ? void 0 : data.recList) !== null && _j !== void 0 ? _j : []));
618
+ setCacheRtcList(cacheRtcList.concat((_k = data === null || data === void 0 ? void 0 : data.recList) !== null && _k !== void 0 ? _k : []));
615
619
  }), [getRecommendVideos, rtcList, waterFallData, cacheRtcList]);
616
620
  const bffEventReport = React.useCallback(({ userInfo, eventInfo }) => {
617
621
  // 关闭 BFF 事件上报
@@ -675,16 +679,16 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
675
679
  }), [bffFetch]);
676
680
  // 获取 Tag
677
681
  const bffGetTagList = React.useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
678
- var _q, _r, _s, _t, _u;
682
+ var _l, _m, _o, _p, _q;
679
683
  if (!utmVal || !isShowTag)
680
684
  return;
681
685
  try {
682
- const val = (_s = (_r = (_q = utmVal === null || utmVal === void 0 ? void 0 : utmVal.split('&')) === null || _q === void 0 ? void 0 : _q.filter((val) => {
686
+ const val = (_o = (_m = (_l = utmVal === null || utmVal === void 0 ? void 0 : utmVal.split('&')) === null || _l === void 0 ? void 0 : _l.filter((val) => {
683
687
  const key = val.split('=')[0];
684
688
  return UTM_KEYS.includes(key);
685
- })) === null || _r === void 0 ? void 0 : _r.join('&')) !== null && _s !== void 0 ? _s : '';
689
+ })) === null || _m === void 0 ? void 0 : _m.join('&')) !== null && _o !== void 0 ? _o : '';
686
690
  const result = yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('/tag/list', { method: 'GET', query: { channel: decodeURIComponent(val) } }));
687
- 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 : []);
691
+ 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 : []);
688
692
  }
689
693
  catch (e) {
690
694
  console.log('e', e);
@@ -738,7 +742,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
738
742
  h5EnterLink();
739
743
  }, []);
740
744
  React.useEffect(() => {
741
- if (!isAgreePolicy)
745
+ if (isShowConsent)
742
746
  return;
743
747
  setLoading(true);
744
748
  bffGetTagList();
@@ -758,7 +762,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
758
762
  setLoading(false);
759
763
  isInit.current = true;
760
764
  });
761
- }, [isAgreePolicy]);
765
+ }, [isShowConsent]);
762
766
  React.useEffect(() => {
763
767
  if (!isInit.current)
764
768
  return;
@@ -816,7 +820,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
816
820
  curTime,
817
821
  h5EnterLink,
818
822
  themeTag
819
- } }, (((_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({
823
+ } }, 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({
820
824
  rtcList,
821
825
  mutateLike: bffMutateLike,
822
826
  mutateUnlike: bffMutateUnlike,
@@ -12082,8 +12086,8 @@ const WaterfallFlowItem$1 = (props) => {
12082
12086
  // 通过宽度比例获取图片高度
12083
12087
  const height = imgInfo.height * (unitWidth / imgInfo.width);
12084
12088
  if (isLoading) {
12085
- // 加40是因为下方文字部分高度为40,可以自己设置
12086
- sizeChange(height + 76 + space, index);
12089
+ // 加56是因为下方文字部分高度为56,可以自己设置
12090
+ sizeChange(height + 56 + space, index);
12087
12091
  }
12088
12092
  }, [imgInfo, index, unitWidth, isLoading, space]); /* 增加sizeChange依赖项会导致在admin预览编辑时无限刷新 */
12089
12093
  const calculateHeightForWidth = (videoWidth, videoHeight, targetWidth) => {
@@ -13605,7 +13609,7 @@ var Tagbar$1 = React.memo(Tagbar);
13605
13609
  * @Author: binruan@chatlabs.com
13606
13610
  * @Date: 2024-01-15 19:03:09
13607
13611
  * @LastEditors: binruan@chatlabs.com
13608
- * @LastEditTime: 2024-06-13 18:09:16
13612
+ * @LastEditTime: 2024-06-18 11:50:31
13609
13613
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\index.tsx
13610
13614
  *
13611
13615
  */
@@ -13696,9 +13700,11 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
13696
13700
  if (document.visibilityState === 'hidden') {
13697
13701
  // 当用户导航到新页面、切换标签页、关闭标签页、最小化或关闭浏览器、刷新原页面(即离开原页面时),或者在移动设备上从浏览器切换到不同的应用程序时
13698
13702
  // 移动端h5直接杀掉浏览器或宿主app时不会触发,pc端直接杀掉标签页时能触发
13699
- SXP_EVENT_BUS.emit(SXP_EVENT_TYPE.PAGE_DID_HIDE, item);
13700
- handleReportViewImageEnd(item);
13701
- handleReportProductView(item);
13703
+ if (!openHashtag) {
13704
+ SXP_EVENT_BUS.emit(SXP_EVENT_TYPE.PAGE_DID_HIDE, item);
13705
+ handleReportViewImageEnd(item);
13706
+ handleReportProductView(item);
13707
+ }
13702
13708
  let fromKName = '';
13703
13709
  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))) {
13704
13710
  fromKName = 'pdpPage';
@@ -13735,8 +13741,10 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
13735
13741
  else if (document.visibilityState === 'visible') {
13736
13742
  // 页面可见时触发,注意页面初始化时不会触发
13737
13743
  handleH5EnterLink();
13738
- handleViewImageStartEvent(activeIndex);
13739
- SXP_EVENT_BUS.emit(SXP_EVENT_TYPE.PAGE_DID_SHOW, item);
13744
+ if (!openHashtag) {
13745
+ handleViewImageStartEvent(activeIndex);
13746
+ SXP_EVENT_BUS.emit(SXP_EVENT_TYPE.PAGE_DID_SHOW, item);
13747
+ }
13740
13748
  backMainFeed('external');
13741
13749
  }
13742
13750
  };
@@ -13753,7 +13761,8 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
13753
13761
  isFromHashtag,
13754
13762
  tempMap,
13755
13763
  curTime,
13756
- backMainFeed
13764
+ backMainFeed,
13765
+ openHashtag
13757
13766
  ]);
13758
13767
  React.useEffect(() => {
13759
13768
  const initTime = () => {