pb-sxp-ui 1.20.40 → 1.20.41

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
@@ -912,6 +912,9 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
912
912
  const [chatlabsId, setChatlabsId] = React.useState();
913
913
  const finalPageData = React.useMemo(() => pageData !== null && pageData !== void 0 ? pageData : data, [pageData, data]);
914
914
  const pixelPvStatusRef = React.useRef(false);
915
+ // 防止重复上报的标记
916
+ const h5EnterReportedRef = React.useRef(false);
917
+ const lastFetchChannelRef = React.useRef();
915
918
  const isDiyPage = React.useMemo(() => {
916
919
  var _a, _b, _c;
917
920
  return isDiyH5 && !((_c = (_b = (_a = finalPageData === null || finalPageData === void 0 ? void 0 : finalPageData.data) === null || _a === void 0 ? void 0 : _a.sxpPageConf) === null || _b === void 0 ? void 0 : _b.globalConfig) === null || _c === void 0 ? void 0 : _c.enablePreview);
@@ -1772,12 +1775,19 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
1772
1775
  return res === null || res === void 0 ? void 0 : res.success;
1773
1776
  }), [bffFetch]);
1774
1777
  React.useEffect(() => {
1775
- if (!isShowConsent)
1778
+ // 只在首次加载且不显示同意弹窗时上报进入事件
1779
+ if (!isShowConsent && !h5EnterReportedRef.current) {
1780
+ h5EnterReportedRef.current = true;
1776
1781
  h5EnterLink();
1777
- }, [isShowConsent]);
1782
+ }
1783
+ }, [isShowConsent, h5EnterLink]);
1778
1784
  React.useEffect(() => {
1779
1785
  if (isShowConsent || isPreview)
1780
1786
  return;
1787
+ // 防止相同 channel 重复获取(只在 channel 真正变化时才重新获取)
1788
+ if (lastFetchChannelRef.current === channel)
1789
+ return;
1790
+ lastFetchChannelRef.current = channel;
1781
1791
  setLoading(true);
1782
1792
  let layId;
1783
1793
  let pbType;
@@ -19855,6 +19865,8 @@ const StructurePage = (_a) => {
19855
19865
  const [carouselVideoPausedStates, setCarouselVideoPausedStates] = React.useState([]);
19856
19866
  // 引入事件上报 hooks
19857
19867
  const { ctaEvent, bffFbReport, bffEventReport } = useSxpDataSource();
19868
+ // 防止重复上报的标记
19869
+ const h5EnterReportedRef = React.useRef(false);
19858
19870
  // CTA 曝光状态追踪(避免重复上报)
19859
19871
  const exposedCtaRefs = React.useRef(new Set());
19860
19872
  // Carousel 图片浏览时间追踪
@@ -20254,13 +20266,17 @@ const StructurePage = (_a) => {
20254
20266
  // 页面进入事件上报 - 只在组件挂载时执行一次
20255
20267
  React.useEffect(() => {
20256
20268
  var _a;
20269
+ // 防止重复上报
20270
+ if (h5EnterReportedRef.current || !bffEventReport)
20271
+ return;
20272
+ h5EnterReportedRef.current = true;
20257
20273
  // 上报 h5LinkEnterFeed 事件
20258
20274
  const enterTime = Date.now();
20259
20275
  const getUrlParam = (key) => {
20260
20276
  const params = new URLSearchParams(window.location.search);
20261
20277
  return params.get(key) || '';
20262
20278
  };
20263
- bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
20279
+ bffEventReport({
20264
20280
  eventInfo: {
20265
20281
  eventSubject: 'h5LinkEnterFeed',
20266
20282
  eventDescription: 'User enter h5 link',
@@ -20274,7 +20290,7 @@ const StructurePage = (_a) => {
20274
20290
  clSource: getUrlParam('cl_source')
20275
20291
  }
20276
20292
  });
20277
- }, [bffEventReport]);
20293
+ }, []); // 空依赖数组,只在挂载时执行一次
20278
20294
  // 获取数据 - 只在组件挂载时执行一次
20279
20295
  React.useEffect(() => {
20280
20296
  // 重要:在 PB 编辑器模式下,propMultiCTAConfig 只是样式配置,不是数据源