pb-sxp-ui 1.20.4 → 1.20.6

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
@@ -915,6 +915,30 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
915
915
  navigatorWithBeacon.sendBeacon = originalSendBeacon;
916
916
  };
917
917
  }, [bffCollectEvent]);
918
+ useEffect(() => {
919
+ // 保存原始的 form.submit 方法
920
+ const originalFormSubmit = HTMLFormElement.prototype.submit;
921
+ // 重写 form.submit 方法
922
+ HTMLFormElement.prototype.submit = function () {
923
+ const form = this;
924
+ // 检查是否是 Facebook Pixel 请求
925
+ if (form.action.includes('facebook.com/tr')) {
926
+ // 收集所有表单数据
927
+ const formData = new FormData(form);
928
+ const params = {};
929
+ for (const [key, value] of formData.entries()) {
930
+ params[key] = value;
931
+ }
932
+ bffCollectEvent({
933
+ eventName: params === null || params === void 0 ? void 0 : params.ev,
934
+ eventSource: 'Meta Pixel'
935
+ });
936
+ return originalFormSubmit.call(form);
937
+ }
938
+ // 非 Facebook 请求,正常提交
939
+ return originalFormSubmit.call(form);
940
+ };
941
+ }, []);
918
942
  useEffect(() => {
919
943
  const _originalFetch = window.fetch;
920
944
  // 覆盖 fetch 方法
@@ -1224,7 +1248,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
1224
1248
  content_type: 'product',
1225
1249
  content_name: '',
1226
1250
  contents: [{
1227
- item_id: product === null || product === void 0 ? void 0 : product.itemId,
1251
+ id: product === null || product === void 0 ? void 0 : product.itemId,
1228
1252
  item_price: product === null || product === void 0 ? void 0 : product.price
1229
1253
  }],
1230
1254
  image_urls: (_s = product.homePage) !== null && _s !== void 0 ? _s : []
@@ -10864,10 +10888,10 @@ const CommodityDetail$1 = (_a) => {
10864
10888
  }
10865
10889
  };
10866
10890
  useEffect(() => {
10867
- var _a;
10891
+ var _a, _b;
10868
10892
  if (!isActive)
10869
10893
  return;
10870
- const recData = Object.assign(Object.assign({}, data), { video: (data === null || data === void 0 ? void 0 : data.video) ? Object.assign(Object.assign({}, data === null || data === void 0 ? void 0 : data.video), { title: '', imgUrls: !isPost ? product === null || product === void 0 ? void 0 : product.homePage : (_a = data === null || data === void 0 ? void 0 : data.video) === null || _a === void 0 ? void 0 : _a.imgUrls }) : null });
10894
+ const recData = Object.assign(Object.assign({}, data), { video: (data === null || data === void 0 ? void 0 : data.video) ? Object.assign(Object.assign({}, data === null || data === void 0 ? void 0 : data.video), { title: '', imgUrls: !isPost ? product === null || product === void 0 ? void 0 : product.homePage : (_a = data === null || data === void 0 ? void 0 : data.video) === null || _a === void 0 ? void 0 : _a.imgUrls, url: !isPost ? '' : (_b = data === null || data === void 0 ? void 0 : data.video) === null || _b === void 0 ? void 0 : _b.url }) : null });
10871
10895
  bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
10872
10896
  eventName: 'ProductView',
10873
10897
  product: product ? [product] : undefined,
@@ -10916,8 +10940,8 @@ const CommodityDetail$1 = (_a) => {
10916
10940
  contentType: 'product',
10917
10941
  view_time: new Date() - curTimeRef.current
10918
10942
  });
10919
- SXP_EVENT_BUS.off(SXP_EVENT_TYPE.PAGE_DID_SHOW, () => onShow());
10920
- SXP_EVENT_BUS.off(SXP_EVENT_TYPE.PAGE_DID_HIDE, () => onHide());
10943
+ SXP_EVENT_BUS.off(SXP_EVENT_TYPE.PAGE_DID_SHOW);
10944
+ SXP_EVENT_BUS.off(SXP_EVENT_TYPE.PAGE_DID_HIDE);
10921
10945
  };
10922
10946
  }, [isActive, isPost, bffFbReport, data, product, position, curTimeRef]);
10923
10947
  useEffect(() => {
@@ -11827,10 +11851,10 @@ const CommodityDetailDiroNew$1 = (_a) => {
11827
11851
  }
11828
11852
  };
11829
11853
  useEffect(() => {
11830
- var _a;
11854
+ var _a, _b;
11831
11855
  if (!isActive)
11832
11856
  return;
11833
- const recData = Object.assign(Object.assign({}, data), { video: (data === null || data === void 0 ? void 0 : data.video) ? Object.assign(Object.assign({}, data === null || data === void 0 ? void 0 : data.video), { title: '', imgUrls: !isPost ? product === null || product === void 0 ? void 0 : product.homePage : (_a = data === null || data === void 0 ? void 0 : data.video) === null || _a === void 0 ? void 0 : _a.imgUrls }) : null });
11857
+ const recData = Object.assign(Object.assign({}, data), { video: (data === null || data === void 0 ? void 0 : data.video) ? Object.assign(Object.assign({}, data === null || data === void 0 ? void 0 : data.video), { title: '', imgUrls: !isPost ? product === null || product === void 0 ? void 0 : product.homePage : (_a = data === null || data === void 0 ? void 0 : data.video) === null || _a === void 0 ? void 0 : _a.imgUrls, url: !isPost ? '' : (_b = data === null || data === void 0 ? void 0 : data.video) === null || _b === void 0 ? void 0 : _b.url }) : null });
11834
11858
  bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
11835
11859
  eventName: 'ProductView',
11836
11860
  product: product ? [product] : undefined,
@@ -11879,8 +11903,8 @@ const CommodityDetailDiroNew$1 = (_a) => {
11879
11903
  contentType: 'product',
11880
11904
  view_time: new Date() - curTimeRef.current
11881
11905
  });
11882
- SXP_EVENT_BUS.off(SXP_EVENT_TYPE.PAGE_DID_SHOW, () => onShow());
11883
- SXP_EVENT_BUS.off(SXP_EVENT_TYPE.PAGE_DID_HIDE, () => onHide());
11906
+ SXP_EVENT_BUS.off(SXP_EVENT_TYPE.PAGE_DID_SHOW);
11907
+ SXP_EVENT_BUS.off(SXP_EVENT_TYPE.PAGE_DID_HIDE);
11884
11908
  };
11885
11909
  }, [isActive, isPost, bffFbReport, data, product, position, curTimeRef]);
11886
11910
  useEffect(() => {
@@ -16251,7 +16275,7 @@ const WaterFall = (props) => {
16251
16275
  position: cacheActiveIndex
16252
16276
  });
16253
16277
  }
16254
- }, [openHashtag, bffFbReport, waterFallData, cacheActiveIndex]);
16278
+ }, [openHashtag, waterFallData, cacheActiveIndex]);
16255
16279
  useEffect(() => {
16256
16280
  const initTime = () => {
16257
16281
  setViewTime(new Date());