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.
@@ -85,7 +85,7 @@ const WaterFall = (props) => {
85
85
  position: cacheActiveIndex
86
86
  });
87
87
  }
88
- }, [openHashtag, bffFbReport, waterFallData, cacheActiveIndex]);
88
+ }, [openHashtag, waterFallData, cacheActiveIndex]);
89
89
  useEffect(() => {
90
90
  const initTime = () => {
91
91
  setViewTime(new Date());
@@ -265,6 +265,25 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
265
265
  navigatorWithBeacon.sendBeacon = originalSendBeacon;
266
266
  };
267
267
  }, [bffCollectEvent]);
268
+ useEffect(() => {
269
+ const originalFormSubmit = HTMLFormElement.prototype.submit;
270
+ HTMLFormElement.prototype.submit = function () {
271
+ const form = this;
272
+ if (form.action.includes('facebook.com/tr')) {
273
+ const formData = new FormData(form);
274
+ const params = {};
275
+ for (const [key, value] of formData.entries()) {
276
+ params[key] = value;
277
+ }
278
+ bffCollectEvent({
279
+ eventName: params === null || params === void 0 ? void 0 : params.ev,
280
+ eventSource: 'Meta Pixel'
281
+ });
282
+ return originalFormSubmit.call(form);
283
+ }
284
+ return originalFormSubmit.call(form);
285
+ };
286
+ }, []);
268
287
  useEffect(() => {
269
288
  const _originalFetch = window.fetch;
270
289
  window.fetch = function (input, init) {
@@ -557,7 +576,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
557
576
  content_type: 'product',
558
577
  content_name: '',
559
578
  contents: [{
560
- item_id: product === null || product === void 0 ? void 0 : product.itemId,
579
+ id: product === null || product === void 0 ? void 0 : product.itemId,
561
580
  item_price: product === null || product === void 0 ? void 0 : product.price
562
581
  }],
563
582
  image_urls: (_s = product.homePage) !== null && _s !== void 0 ? _s : []
@@ -63,10 +63,10 @@ const CommodityDetail = (_a) => {
63
63
  }
64
64
  };
65
65
  useEffect(() => {
66
- var _a;
66
+ var _a, _b;
67
67
  if (!isActive)
68
68
  return;
69
- 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 });
69
+ 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 });
70
70
  bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
71
71
  eventName: 'ProductView',
72
72
  product: product ? [product] : undefined,
@@ -115,8 +115,8 @@ const CommodityDetail = (_a) => {
115
115
  contentType: 'product',
116
116
  view_time: new Date() - curTimeRef.current
117
117
  });
118
- SXP_EVENT_BUS.off(SXP_EVENT_TYPE.PAGE_DID_SHOW, () => onShow());
119
- SXP_EVENT_BUS.off(SXP_EVENT_TYPE.PAGE_DID_HIDE, () => onHide());
118
+ SXP_EVENT_BUS.off(SXP_EVENT_TYPE.PAGE_DID_SHOW);
119
+ SXP_EVENT_BUS.off(SXP_EVENT_TYPE.PAGE_DID_HIDE);
120
120
  };
121
121
  }, [isActive, isPost, bffFbReport, data, product, position, curTimeRef]);
122
122
  useEffect(() => {
@@ -67,10 +67,10 @@ const CommodityDetailDiroNew = (_a) => {
67
67
  }
68
68
  };
69
69
  useEffect(() => {
70
- var _a;
70
+ var _a, _b;
71
71
  if (!isActive)
72
72
  return;
73
- 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 });
73
+ 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 });
74
74
  bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
75
75
  eventName: 'ProductView',
76
76
  product: product ? [product] : undefined,
@@ -119,8 +119,8 @@ const CommodityDetailDiroNew = (_a) => {
119
119
  contentType: 'product',
120
120
  view_time: new Date() - curTimeRef.current
121
121
  });
122
- SXP_EVENT_BUS.off(SXP_EVENT_TYPE.PAGE_DID_SHOW, () => onShow());
123
- SXP_EVENT_BUS.off(SXP_EVENT_TYPE.PAGE_DID_HIDE, () => onHide());
122
+ SXP_EVENT_BUS.off(SXP_EVENT_TYPE.PAGE_DID_SHOW);
123
+ SXP_EVENT_BUS.off(SXP_EVENT_TYPE.PAGE_DID_HIDE);
124
124
  };
125
125
  }, [isActive, isPost, bffFbReport, data, product, position, curTimeRef]);
126
126
  useEffect(() => {
@@ -88,7 +88,7 @@ const WaterFall = (props) => {
88
88
  position: cacheActiveIndex
89
89
  });
90
90
  }
91
- }, [openHashtag, bffFbReport, waterFallData, cacheActiveIndex]);
91
+ }, [openHashtag, waterFallData, cacheActiveIndex]);
92
92
  (0, react_1.useEffect)(() => {
93
93
  const initTime = () => {
94
94
  setViewTime(new Date());
@@ -268,6 +268,25 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
268
268
  navigatorWithBeacon.sendBeacon = originalSendBeacon;
269
269
  };
270
270
  }, [bffCollectEvent]);
271
+ (0, react_1.useEffect)(() => {
272
+ const originalFormSubmit = HTMLFormElement.prototype.submit;
273
+ HTMLFormElement.prototype.submit = function () {
274
+ const form = this;
275
+ if (form.action.includes('facebook.com/tr')) {
276
+ const formData = new FormData(form);
277
+ const params = {};
278
+ for (const [key, value] of formData.entries()) {
279
+ params[key] = value;
280
+ }
281
+ bffCollectEvent({
282
+ eventName: params === null || params === void 0 ? void 0 : params.ev,
283
+ eventSource: 'Meta Pixel'
284
+ });
285
+ return originalFormSubmit.call(form);
286
+ }
287
+ return originalFormSubmit.call(form);
288
+ };
289
+ }, []);
271
290
  (0, react_1.useEffect)(() => {
272
291
  const _originalFetch = window.fetch;
273
292
  window.fetch = function (input, init) {
@@ -560,7 +579,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
560
579
  content_type: 'product',
561
580
  content_name: '',
562
581
  contents: [{
563
- item_id: product === null || product === void 0 ? void 0 : product.itemId,
582
+ id: product === null || product === void 0 ? void 0 : product.itemId,
564
583
  item_price: product === null || product === void 0 ? void 0 : product.price
565
584
  }],
566
585
  image_urls: (_s = product.homePage) !== null && _s !== void 0 ? _s : []
@@ -65,10 +65,10 @@ const CommodityDetail = (_a) => {
65
65
  }
66
66
  };
67
67
  (0, react_1.useEffect)(() => {
68
- var _a;
68
+ var _a, _b;
69
69
  if (!isActive)
70
70
  return;
71
- 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 });
71
+ 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 });
72
72
  bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
73
73
  eventName: 'ProductView',
74
74
  product: product ? [product] : undefined,
@@ -117,8 +117,8 @@ const CommodityDetail = (_a) => {
117
117
  contentType: 'product',
118
118
  view_time: new Date() - curTimeRef.current
119
119
  });
120
- event_1.default.off(event_1.SXP_EVENT_TYPE.PAGE_DID_SHOW, () => onShow());
121
- event_1.default.off(event_1.SXP_EVENT_TYPE.PAGE_DID_HIDE, () => onHide());
120
+ event_1.default.off(event_1.SXP_EVENT_TYPE.PAGE_DID_SHOW);
121
+ event_1.default.off(event_1.SXP_EVENT_TYPE.PAGE_DID_HIDE);
122
122
  };
123
123
  }, [isActive, isPost, bffFbReport, data, product, position, curTimeRef]);
124
124
  (0, react_1.useEffect)(() => {
@@ -69,10 +69,10 @@ const CommodityDetailDiroNew = (_a) => {
69
69
  }
70
70
  };
71
71
  (0, react_1.useEffect)(() => {
72
- var _a;
72
+ var _a, _b;
73
73
  if (!isActive)
74
74
  return;
75
- 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 });
75
+ 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 });
76
76
  bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
77
77
  eventName: 'ProductView',
78
78
  product: product ? [product] : undefined,
@@ -121,8 +121,8 @@ const CommodityDetailDiroNew = (_a) => {
121
121
  contentType: 'product',
122
122
  view_time: new Date() - curTimeRef.current
123
123
  });
124
- event_1.default.off(event_1.SXP_EVENT_TYPE.PAGE_DID_SHOW, () => onShow());
125
- event_1.default.off(event_1.SXP_EVENT_TYPE.PAGE_DID_HIDE, () => onHide());
124
+ event_1.default.off(event_1.SXP_EVENT_TYPE.PAGE_DID_SHOW);
125
+ event_1.default.off(event_1.SXP_EVENT_TYPE.PAGE_DID_HIDE);
126
126
  };
127
127
  }, [isActive, isPost, bffFbReport, data, product, position, curTimeRef]);
128
128
  (0, react_1.useEffect)(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pb-sxp-ui",
3
- "version": "1.20.4",
3
+ "version": "1.20.6",
4
4
  "description": "React enterprise-class UI components",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",