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/pb-ui.js CHANGED
@@ -930,6 +930,30 @@
930
930
  navigatorWithBeacon.sendBeacon = originalSendBeacon;
931
931
  };
932
932
  }, [bffCollectEvent]);
933
+ React.useEffect(() => {
934
+ // 保存原始的 form.submit 方法
935
+ const originalFormSubmit = HTMLFormElement.prototype.submit;
936
+ // 重写 form.submit 方法
937
+ HTMLFormElement.prototype.submit = function () {
938
+ const form = this;
939
+ // 检查是否是 Facebook Pixel 请求
940
+ if (form.action.includes('facebook.com/tr')) {
941
+ // 收集所有表单数据
942
+ const formData = new FormData(form);
943
+ const params = {};
944
+ for (const [key, value] of formData.entries()) {
945
+ params[key] = value;
946
+ }
947
+ bffCollectEvent({
948
+ eventName: params === null || params === void 0 ? void 0 : params.ev,
949
+ eventSource: 'Meta Pixel'
950
+ });
951
+ return originalFormSubmit.call(form);
952
+ }
953
+ // 非 Facebook 请求,正常提交
954
+ return originalFormSubmit.call(form);
955
+ };
956
+ }, []);
933
957
  React.useEffect(() => {
934
958
  const _originalFetch = window.fetch;
935
959
  // 覆盖 fetch 方法
@@ -1239,7 +1263,7 @@
1239
1263
  content_type: 'product',
1240
1264
  content_name: '',
1241
1265
  contents: [{
1242
- item_id: product === null || product === void 0 ? void 0 : product.itemId,
1266
+ id: product === null || product === void 0 ? void 0 : product.itemId,
1243
1267
  item_price: product === null || product === void 0 ? void 0 : product.price
1244
1268
  }],
1245
1269
  image_urls: (_s = product.homePage) !== null && _s !== void 0 ? _s : []
@@ -10879,10 +10903,10 @@
10879
10903
  }
10880
10904
  };
10881
10905
  React.useEffect(() => {
10882
- var _a;
10906
+ var _a, _b;
10883
10907
  if (!isActive)
10884
10908
  return;
10885
- 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 });
10909
+ 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 });
10886
10910
  bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
10887
10911
  eventName: 'ProductView',
10888
10912
  product: product ? [product] : undefined,
@@ -10931,8 +10955,8 @@
10931
10955
  contentType: 'product',
10932
10956
  view_time: new Date() - curTimeRef.current
10933
10957
  });
10934
- SXP_EVENT_BUS.off(SXP_EVENT_TYPE.PAGE_DID_SHOW, () => onShow());
10935
- SXP_EVENT_BUS.off(SXP_EVENT_TYPE.PAGE_DID_HIDE, () => onHide());
10958
+ SXP_EVENT_BUS.off(SXP_EVENT_TYPE.PAGE_DID_SHOW);
10959
+ SXP_EVENT_BUS.off(SXP_EVENT_TYPE.PAGE_DID_HIDE);
10936
10960
  };
10937
10961
  }, [isActive, isPost, bffFbReport, data, product, position, curTimeRef]);
10938
10962
  React.useEffect(() => {
@@ -11842,10 +11866,10 @@
11842
11866
  }
11843
11867
  };
11844
11868
  React.useEffect(() => {
11845
- var _a;
11869
+ var _a, _b;
11846
11870
  if (!isActive)
11847
11871
  return;
11848
- 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 });
11872
+ 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 });
11849
11873
  bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
11850
11874
  eventName: 'ProductView',
11851
11875
  product: product ? [product] : undefined,
@@ -11894,8 +11918,8 @@
11894
11918
  contentType: 'product',
11895
11919
  view_time: new Date() - curTimeRef.current
11896
11920
  });
11897
- SXP_EVENT_BUS.off(SXP_EVENT_TYPE.PAGE_DID_SHOW, () => onShow());
11898
- SXP_EVENT_BUS.off(SXP_EVENT_TYPE.PAGE_DID_HIDE, () => onHide());
11921
+ SXP_EVENT_BUS.off(SXP_EVENT_TYPE.PAGE_DID_SHOW);
11922
+ SXP_EVENT_BUS.off(SXP_EVENT_TYPE.PAGE_DID_HIDE);
11899
11923
  };
11900
11924
  }, [isActive, isPost, bffFbReport, data, product, position, curTimeRef]);
11901
11925
  React.useEffect(() => {
@@ -16266,7 +16290,7 @@ Made in Italy` })));
16266
16290
  position: cacheActiveIndex
16267
16291
  });
16268
16292
  }
16269
- }, [openHashtag, bffFbReport, waterFallData, cacheActiveIndex]);
16293
+ }, [openHashtag, waterFallData, cacheActiveIndex]);
16270
16294
  React.useEffect(() => {
16271
16295
  const initTime = () => {
16272
16296
  setViewTime(new Date());