pb-sxp-ui 1.20.4 → 1.20.5

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
@@ -937,6 +937,30 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
937
937
  navigatorWithBeacon.sendBeacon = originalSendBeacon;
938
938
  };
939
939
  }, [bffCollectEvent]);
940
+ React.useEffect(() => {
941
+ // 保存原始的 form.submit 方法
942
+ const originalFormSubmit = HTMLFormElement.prototype.submit;
943
+ // 重写 form.submit 方法
944
+ HTMLFormElement.prototype.submit = function () {
945
+ const form = this;
946
+ // 检查是否是 Facebook Pixel 请求
947
+ if (form.action.includes('facebook.com/tr')) {
948
+ // 收集所有表单数据
949
+ const formData = new FormData(form);
950
+ const params = {};
951
+ for (const [key, value] of formData.entries()) {
952
+ params[key] = value;
953
+ }
954
+ bffCollectEvent({
955
+ eventName: params === null || params === void 0 ? void 0 : params.ev,
956
+ eventSource: 'Meta Pixel'
957
+ });
958
+ return originalFormSubmit.call(form);
959
+ }
960
+ // 非 Facebook 请求,正常提交
961
+ return originalFormSubmit.call(form);
962
+ };
963
+ }, []);
940
964
  React.useEffect(() => {
941
965
  const _originalFetch = window.fetch;
942
966
  // 覆盖 fetch 方法
@@ -10938,8 +10962,8 @@ const CommodityDetail$1 = (_a) => {
10938
10962
  contentType: 'product',
10939
10963
  view_time: new Date() - curTimeRef.current
10940
10964
  });
10941
- SXP_EVENT_BUS.off(SXP_EVENT_TYPE.PAGE_DID_SHOW, () => onShow());
10942
- SXP_EVENT_BUS.off(SXP_EVENT_TYPE.PAGE_DID_HIDE, () => onHide());
10965
+ SXP_EVENT_BUS.off(SXP_EVENT_TYPE.PAGE_DID_SHOW);
10966
+ SXP_EVENT_BUS.off(SXP_EVENT_TYPE.PAGE_DID_HIDE);
10943
10967
  };
10944
10968
  }, [isActive, isPost, bffFbReport, data, product, position, curTimeRef]);
10945
10969
  React.useEffect(() => {
@@ -11901,8 +11925,8 @@ const CommodityDetailDiroNew$1 = (_a) => {
11901
11925
  contentType: 'product',
11902
11926
  view_time: new Date() - curTimeRef.current
11903
11927
  });
11904
- SXP_EVENT_BUS.off(SXP_EVENT_TYPE.PAGE_DID_SHOW, () => onShow());
11905
- SXP_EVENT_BUS.off(SXP_EVENT_TYPE.PAGE_DID_HIDE, () => onHide());
11928
+ SXP_EVENT_BUS.off(SXP_EVENT_TYPE.PAGE_DID_SHOW);
11929
+ SXP_EVENT_BUS.off(SXP_EVENT_TYPE.PAGE_DID_HIDE);
11906
11930
  };
11907
11931
  }, [isActive, isPost, bffFbReport, data, product, position, curTimeRef]);
11908
11932
  React.useEffect(() => {