@openreplay/tracker 16.4.2-beta.1 → 16.4.2-beta.2

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/cjs/entry.js CHANGED
@@ -5259,7 +5259,7 @@ class App {
5259
5259
  this.stopCallbacks = [];
5260
5260
  this.commitCallbacks = [];
5261
5261
  this.activityState = ActivityState.NotActive;
5262
- this.version = '16.4.2-beta.1'; // TODO: version compatability check inside each plugin.
5262
+ this.version = '16.4.2-beta.2'; // TODO: version compatability check inside each plugin.
5263
5263
  this.socketMode = false;
5264
5264
  this.compressionThreshold = 24 * 1000;
5265
5265
  this.bc = null;
@@ -8559,42 +8559,47 @@ const genStringBody = (body) => {
8559
8559
  return null;
8560
8560
  }
8561
8561
  let result;
8562
- if (typeof body === 'string') {
8563
- if (body[0] === '{' || body[0] === '[') {
8564
- result = body;
8562
+ try {
8563
+ if (typeof body === 'string') {
8564
+ if (body[0] === '{' || body[0] === '[') {
8565
+ result = body;
8566
+ }
8567
+ // 'a=1&b=2' => try to parse as query
8568
+ const arr = body.split('&');
8569
+ if (arr.length === 1) {
8570
+ // not a query, parse as original string
8571
+ result = body;
8572
+ }
8573
+ else {
8574
+ // 'a=1&b=2&c' => parse as query
8575
+ result = arr.join(',');
8576
+ }
8577
+ }
8578
+ else if (isIterable(body)) {
8579
+ // FormData or URLSearchParams or Array
8580
+ const arr = [];
8581
+ for (const [key, value] of body) {
8582
+ arr.push(`${key}=${typeof value === 'string' ? value : '[object Object]'}`);
8583
+ }
8584
+ result = arr.join(',');
8565
8585
  }
8566
- // 'a=1&b=2' => try to parse as query
8567
- const arr = body.split('&');
8568
- if (arr.length === 1) {
8569
- // not a query, parse as original string
8586
+ else if (body instanceof Blob ||
8587
+ body instanceof ReadableStream ||
8588
+ body instanceof ArrayBuffer) {
8589
+ result = 'byte data';
8590
+ }
8591
+ else if (isPureObject(body)) {
8592
+ // overriding ArrayBufferView which is not convertable to string
8570
8593
  result = body;
8571
8594
  }
8572
8595
  else {
8573
- // 'a=1&b=2&c' => parse as query
8574
- result = arr.join(',');
8575
- }
8576
- }
8577
- else if (isIterable(body)) {
8578
- // FormData or URLSearchParams or Array
8579
- const arr = [];
8580
- for (const [key, value] of body) {
8581
- arr.push(`${key}=${typeof value === 'string' ? value : '[object Object]'}`);
8596
+ result = `can't parse body ${typeof body}`;
8582
8597
  }
8583
- result = arr.join(',');
8598
+ return result;
8584
8599
  }
8585
- else if (body instanceof Blob ||
8586
- body instanceof ReadableStream ||
8587
- body instanceof ArrayBuffer) {
8588
- result = 'byte data';
8600
+ catch (_) {
8601
+ return "can't parse body";
8589
8602
  }
8590
- else if (isPureObject(body)) {
8591
- // overriding ArrayBufferView which is not convertable to string
8592
- result = body;
8593
- }
8594
- else {
8595
- result = `can't parse body ${typeof body}`;
8596
- }
8597
- return result;
8598
8603
  };
8599
8604
  const genGetDataByUrl = (url, getData = {}) => {
8600
8605
  if (!isPureObject(getData)) {
@@ -9634,7 +9639,7 @@ class API {
9634
9639
  this.signalStartIssue = (reason, missingApi) => {
9635
9640
  const doNotTrack = this.checkDoNotTrack();
9636
9641
  console.log("Tracker couldn't start due to:", JSON.stringify({
9637
- trackerVersion: '16.4.2-beta.1',
9642
+ trackerVersion: '16.4.2-beta.2',
9638
9643
  projectKey: this.options.projectKey,
9639
9644
  doNotTrack,
9640
9645
  reason: missingApi.length ? `missing api: ${missingApi.join(',')}` : reason,