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