pb-sxp-ui 1.16.22 → 1.16.24-alpha.1

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
@@ -882,26 +882,6 @@
882
882
  try {
883
883
  // 1. 先执行原始请求
884
884
  const response = _originalFetch.apply(this, arguments_1);
885
- if (url.includes('https://i.giesswein.com/nb-collector')) {
886
- if ((init === null || init === void 0 ? void 0 : init.method) === 'POST' && typeof (init === null || init === void 0 ? void 0 : init.body) === 'string') {
887
- try {
888
- const payload = JSON.parse(init.body);
889
- if (payload && Array.isArray(payload.data)) {
890
- payload.data.forEach((item) => {
891
- if (item && item.e) {
892
- bffCollectEvent({
893
- eventName: item.e,
894
- eventSource: 'Northbeam Pixel'
895
- });
896
- }
897
- });
898
- }
899
- }
900
- catch (e) {
901
- console.error('Failed to parse Northbeam event', e);
902
- }
903
- }
904
- }
905
885
  // 检查是否是 GA4 收集端点
906
886
  if (url.includes('https://www.google-analytics.com/g/collect')) {
907
887
  const urlObj = new URL(url);
@@ -944,6 +924,41 @@
944
924
  });
945
925
  };
946
926
  }, [bffCollectEvent]);
927
+ React.useEffect(() => {
928
+ const originalOpen = XMLHttpRequest.prototype.open;
929
+ const originalSend = XMLHttpRequest.prototype.send;
930
+ XMLHttpRequest.prototype.open = function (method, url) {
931
+ this._url = url;
932
+ originalOpen.apply(this, arguments);
933
+ };
934
+ XMLHttpRequest.prototype.send = function (body) {
935
+ if (this._url && typeof this._url === 'string' && this._url.includes('https://i.giesswein.com/nb-collector')) {
936
+ if (body && typeof body === 'string') {
937
+ try {
938
+ const payload = JSON.parse(body);
939
+ if (payload && Array.isArray(payload.data)) {
940
+ payload.data.forEach((item) => {
941
+ if (item && item.e) {
942
+ bffCollectEvent({
943
+ eventName: item.e,
944
+ eventSource: 'Northbeam Pixel'
945
+ });
946
+ }
947
+ });
948
+ }
949
+ }
950
+ catch (e) {
951
+ console.error('Failed to parse Northbeam event from XHR', e);
952
+ }
953
+ }
954
+ }
955
+ originalSend.apply(this, arguments);
956
+ };
957
+ return () => {
958
+ XMLHttpRequest.prototype.open = originalOpen;
959
+ XMLHttpRequest.prototype.send = originalSend;
960
+ };
961
+ }, [bffCollectEvent]);
947
962
  React.useEffect(() => {
948
963
  if (typeof (window === null || window === void 0 ? void 0 : window.fbq) === 'function') {
949
964
  window === null || window === void 0 ? void 0 : window.fbq('track', 'PageView');
@@ -1226,6 +1241,7 @@
1226
1241
  window === null || window === void 0 ? void 0 : window.snaptr('track', snapchatPixelEventParamsJson === null || snapchatPixelEventParamsJson === void 0 ? void 0 : snapchatPixelEventParamsJson.event_name, getEventParamsByJson(snapchatPixelEventParamsJson, product));
1227
1242
  }
1228
1243
  if (eventName === 'PageView' && typeof (window === null || window === void 0 ? void 0 : window.Northbeam) === 'object' && typeof ((_f = window === null || window === void 0 ? void 0 : window.Northbeam) === null || _f === void 0 ? void 0 : _f.trackPageView) === 'function') {
1244
+ console.log('-----------------trackPageView触发了------------------');
1229
1245
  (_g = window === null || window === void 0 ? void 0 : window.Northbeam) === null || _g === void 0 ? void 0 : _g.trackPageView();
1230
1246
  }
1231
1247
  const converApiEventParamsJson = (_h = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _h === void 0 ? void 0 : _h[eventName];