pb-sxp-ui 1.15.20-alpha.1 → 1.15.20-alpha.3

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
@@ -37,7 +37,7 @@
37
37
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
38
38
  PERFORMANCE OF THIS SOFTWARE.
39
39
  ***************************************************************************** */
40
- /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
40
+ /* global Reflect, Promise, SuppressedError, Symbol */
41
41
 
42
42
 
43
43
  function __rest(s, e) {
@@ -738,25 +738,11 @@
738
738
  }
739
739
  // 事件上报优化
740
740
  // Beacon API 用于发送异步和非阻塞请求到服务器。这类请求不需要响应。
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
- // }
741
+ if (options.type === 'beacon' && navigator.sendBeacon) {
742
+ const formData = new FormData();
743
+ formData.append('data', JSON.stringify(Object.assign(Object.assign(Object.assign({}, options.body), bffDataSource.headers), { 'x-user-id': fakeUserId })));
744
+ return navigator.sendBeacon(`${url}/api/${path}`, formData);
745
+ }
760
746
  return window
761
747
  .fetch(`${url}/api/${path}`, {
762
748
  headers: Object.assign({ 'Content-Type': 'application/json', 'x-user-id': fakeUserId }, bffDataSource.headers),