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.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 方法
@@ -1246,7 +1270,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
1246
1270
  content_type: 'product',
1247
1271
  content_name: '',
1248
1272
  contents: [{
1249
- item_id: product === null || product === void 0 ? void 0 : product.itemId,
1273
+ id: product === null || product === void 0 ? void 0 : product.itemId,
1250
1274
  item_price: product === null || product === void 0 ? void 0 : product.price
1251
1275
  }],
1252
1276
  image_urls: (_s = product.homePage) !== null && _s !== void 0 ? _s : []
@@ -10886,10 +10910,10 @@ const CommodityDetail$1 = (_a) => {
10886
10910
  }
10887
10911
  };
10888
10912
  React.useEffect(() => {
10889
- var _a;
10913
+ var _a, _b;
10890
10914
  if (!isActive)
10891
10915
  return;
10892
- 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 });
10916
+ 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 });
10893
10917
  bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
10894
10918
  eventName: 'ProductView',
10895
10919
  product: product ? [product] : undefined,
@@ -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(() => {
@@ -11849,10 +11873,10 @@ const CommodityDetailDiroNew$1 = (_a) => {
11849
11873
  }
11850
11874
  };
11851
11875
  React.useEffect(() => {
11852
- var _a;
11876
+ var _a, _b;
11853
11877
  if (!isActive)
11854
11878
  return;
11855
- 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 });
11879
+ 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 });
11856
11880
  bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
11857
11881
  eventName: 'ProductView',
11858
11882
  product: product ? [product] : undefined,
@@ -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(() => {
@@ -16273,7 +16297,7 @@ const WaterFall = (props) => {
16273
16297
  position: cacheActiveIndex
16274
16298
  });
16275
16299
  }
16276
- }, [openHashtag, bffFbReport, waterFallData, cacheActiveIndex]);
16300
+ }, [openHashtag, waterFallData, cacheActiveIndex]);
16277
16301
  React.useEffect(() => {
16278
16302
  const initTime = () => {
16279
16303
  setViewTime(new Date());