pb-sxp-ui 1.16.21 → 1.16.23
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 +36 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +36 -21
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +4 -4
- package/dist/index.min.cjs.map +1 -1
- package/dist/index.min.js +4 -4
- package/dist/index.min.js.map +1 -1
- package/dist/pb-ui.js +36 -21
- package/dist/pb-ui.js.map +1 -1
- package/dist/pb-ui.min.js +4 -4
- package/dist/pb-ui.min.js.map +1 -1
- package/es/core/context/SxpDataSourceProvider.js +36 -21
- package/lib/core/context/SxpDataSourceProvider.js +36 -21
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
@@ -889,26 +889,6 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
889
889
|
try {
|
890
890
|
// 1. 先执行原始请求
|
891
891
|
const response = _originalFetch.apply(this, arguments_1);
|
892
|
-
if (url.includes('https://i.giesswein.com/nb-collector')) {
|
893
|
-
if ((init === null || init === void 0 ? void 0 : init.method) === 'POST' && typeof (init === null || init === void 0 ? void 0 : init.body) === 'string') {
|
894
|
-
try {
|
895
|
-
const payload = JSON.parse(init.body);
|
896
|
-
if (payload && Array.isArray(payload.data)) {
|
897
|
-
payload.data.forEach((item) => {
|
898
|
-
if (item && item.e) {
|
899
|
-
bffCollectEvent({
|
900
|
-
eventName: item.e,
|
901
|
-
eventSource: 'Northbeam Pixel'
|
902
|
-
});
|
903
|
-
}
|
904
|
-
});
|
905
|
-
}
|
906
|
-
}
|
907
|
-
catch (e) {
|
908
|
-
console.error('Failed to parse Northbeam event', e);
|
909
|
-
}
|
910
|
-
}
|
911
|
-
}
|
912
892
|
// 检查是否是 GA4 收集端点
|
913
893
|
if (url.includes('https://www.google-analytics.com/g/collect')) {
|
914
894
|
const urlObj = new URL(url);
|
@@ -951,6 +931,41 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
951
931
|
});
|
952
932
|
};
|
953
933
|
}, [bffCollectEvent]);
|
934
|
+
React.useEffect(() => {
|
935
|
+
const originalOpen = XMLHttpRequest.prototype.open;
|
936
|
+
const originalSend = XMLHttpRequest.prototype.send;
|
937
|
+
XMLHttpRequest.prototype.open = function (method, url) {
|
938
|
+
this._url = url;
|
939
|
+
originalOpen.apply(this, arguments);
|
940
|
+
};
|
941
|
+
XMLHttpRequest.prototype.send = function (body) {
|
942
|
+
if (this._url && typeof this._url === 'string' && this._url.includes('https://i.giesswein.com/nb-collector')) {
|
943
|
+
if (body && typeof body === 'string') {
|
944
|
+
try {
|
945
|
+
const payload = JSON.parse(body);
|
946
|
+
if (payload && Array.isArray(payload.data)) {
|
947
|
+
payload.data.forEach((item) => {
|
948
|
+
if (item && item.e) {
|
949
|
+
bffCollectEvent({
|
950
|
+
eventName: item.e,
|
951
|
+
eventSource: 'Northbeam Pixel'
|
952
|
+
});
|
953
|
+
}
|
954
|
+
});
|
955
|
+
}
|
956
|
+
}
|
957
|
+
catch (e) {
|
958
|
+
console.error('Failed to parse Northbeam event from XHR', e);
|
959
|
+
}
|
960
|
+
}
|
961
|
+
}
|
962
|
+
originalSend.apply(this, arguments);
|
963
|
+
};
|
964
|
+
return () => {
|
965
|
+
XMLHttpRequest.prototype.open = originalOpen;
|
966
|
+
XMLHttpRequest.prototype.send = originalSend;
|
967
|
+
};
|
968
|
+
}, [bffCollectEvent]);
|
954
969
|
React.useEffect(() => {
|
955
970
|
if (typeof (window === null || window === void 0 ? void 0 : window.fbq) === 'function') {
|
956
971
|
window === null || window === void 0 ? void 0 : window.fbq('track', 'PageView');
|
@@ -1232,7 +1247,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
1232
1247
|
if ((snapchatPixelEventParamsJson === null || snapchatPixelEventParamsJson === void 0 ? void 0 : snapchatPixelEventParamsJson.event_name) && typeof (window === null || window === void 0 ? void 0 : window.snaptr) === 'function') {
|
1233
1248
|
window === null || window === void 0 ? void 0 : window.snaptr('track', snapchatPixelEventParamsJson === null || snapchatPixelEventParamsJson === void 0 ? void 0 : snapchatPixelEventParamsJson.event_name, getEventParamsByJson(snapchatPixelEventParamsJson, product));
|
1234
1249
|
}
|
1235
|
-
if (eventName === 'PageView' && typeof (window === null || window === void 0 ? void 0 : window.Northbeam) === '
|
1250
|
+
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') {
|
1236
1251
|
(_g = window === null || window === void 0 ? void 0 : window.Northbeam) === null || _g === void 0 ? void 0 : _g.trackPageView();
|
1237
1252
|
}
|
1238
1253
|
const converApiEventParamsJson = (_h = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.converApi) === null || _h === void 0 ? void 0 : _h[eventName];
|