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