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/index.js CHANGED
@@ -22,7 +22,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
22
22
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
23
23
  PERFORMANCE OF THIS SOFTWARE.
24
24
  ***************************************************************************** */
25
- /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
25
+ /* global Reflect, Promise, SuppressedError, Symbol */
26
26
 
27
27
 
28
28
  function __rest(s, e) {
@@ -723,25 +723,11 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
723
723
  }
724
724
  // 事件上报优化
725
725
  // Beacon API 用于发送异步和非阻塞请求到服务器。这类请求不需要响应。
726
- // if (options.type === 'beacon' && navigator.sendBeacon) {
727
- // return navigator.sendBeacon(
728
- // `${url}/api/${path}`,
729
- // new Blob(
730
- // [
731
- // JSON.stringify({
732
- // body: btoa(
733
- // encodeURIComponent(
734
- // JSON.stringify({ ...options.body, ...bffDataSource.headers, 'x-user-id': fakeUserId })
735
- // )
736
- // )
737
- // })
738
- // ],
739
- // {
740
- // type: 'application/json;charset=UTF-8'
741
- // }
742
- // )
743
- // );
744
- // }
726
+ if (options.type === 'beacon' && navigator.sendBeacon) {
727
+ const formData = new FormData();
728
+ formData.append('data', JSON.stringify(Object.assign(Object.assign(Object.assign({}, options.body), bffDataSource.headers), { 'x-user-id': fakeUserId })));
729
+ return navigator.sendBeacon(`${url}/api/${path}`, formData);
730
+ }
745
731
  return window
746
732
  .fetch(`${url}/api/${path}`, {
747
733
  headers: Object.assign({ 'Content-Type': 'application/json', 'x-user-id': fakeUserId }, bffDataSource.headers),