pb-sxp-ui 1.15.18 → 1.15.20-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/index.cjs CHANGED
@@ -745,15 +745,25 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
745
745
  }
746
746
  // 事件上报优化
747
747
  // Beacon API 用于发送异步和非阻塞请求到服务器。这类请求不需要响应。
748
- if (options.type === 'beacon' && navigator.sendBeacon) {
749
- return navigator.sendBeacon(`${url}/api/${path}`, new Blob([
750
- JSON.stringify({
751
- body: btoa(encodeURIComponent(JSON.stringify(Object.assign(Object.assign(Object.assign({}, options.body), bffDataSource.headers), { 'x-user-id': fakeUserId }))))
752
- })
753
- ], {
754
- type: 'application/json;charset=UTF-8'
755
- }));
756
- }
748
+ // if (options.type === 'beacon' && navigator.sendBeacon) {
749
+ // return navigator.sendBeacon(
750
+ // `${url}/api/${path}`,
751
+ // new Blob(
752
+ // [
753
+ // JSON.stringify({
754
+ // body: btoa(
755
+ // encodeURIComponent(
756
+ // JSON.stringify({ ...options.body, ...bffDataSource.headers, 'x-user-id': fakeUserId })
757
+ // )
758
+ // )
759
+ // })
760
+ // ],
761
+ // {
762
+ // type: 'application/json;charset=UTF-8'
763
+ // }
764
+ // )
765
+ // );
766
+ // }
757
767
  return window
758
768
  .fetch(`${url}/api/${path}`, {
759
769
  headers: Object.assign({ 'Content-Type': 'application/json', 'x-user-id': fakeUserId }, bffDataSource.headers),
@@ -1006,13 +1016,18 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
1006
1016
  return uri + separator + key + '=' + value;
1007
1017
  }
1008
1018
  }
1009
- if (eventName === 'PageView') {
1019
+ if (eventName === 'PageView' && (pixelEventParamsJson === null || pixelEventParamsJson === void 0 ? void 0 : pixelEventParamsJson.event_name) === 'PageView') {
1010
1020
  const currentUrl = window.location.href;
1011
1021
  const newUrl = updateQueryStringParameter(currentUrl, 'timestamp', Date.now());
1012
1022
  history.pushState({ path: newUrl }, '', newUrl);
1013
1023
  }
1014
- const body = getEventParamsByJson(pixelEventParamsJson);
1015
- window === null || window === void 0 ? void 0 : window.fbq('track', pixelEventParamsJson === null || pixelEventParamsJson === void 0 ? void 0 : pixelEventParamsJson.event_name, body);
1024
+ else {
1025
+ const body = getEventParamsByJson(pixelEventParamsJson);
1026
+ window === null || window === void 0 ? void 0 : window.fbq('track', pixelEventParamsJson === null || pixelEventParamsJson === void 0 ? void 0 : pixelEventParamsJson.event_name, body);
1027
+ if (eventName === 'PageView' && typeof (window === null || window === void 0 ? void 0 : window.gtag) === 'function') {
1028
+ window === null || window === void 0 ? void 0 : window.gtag('event', 'page_view');
1029
+ }
1030
+ }
1016
1031
  }
1017
1032
  else if (eventName === 'PageView' && typeof (window === null || window === void 0 ? void 0 : window.gtag) === 'function') {
1018
1033
  window === null || window === void 0 ? void 0 : window.gtag('event', 'page_view');