noibu-react-native 0.2.33 → 0.2.34-rc.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/constants.js CHANGED
@@ -24,7 +24,7 @@ const CONTENT_TYPE = 'content-type';
24
24
  * Gets the script id from the cookie object, returns default if cannot be found
25
25
  */
26
26
  function GET_SCRIPT_ID() {
27
- return "1.0.104-rn-sdk-0.2.33" ;
27
+ return "1.0.104-rn-sdk-0.2.34-rc.1" ;
28
28
  }
29
29
  /**
30
30
  * Gets the max metro recon number
@@ -76,10 +76,13 @@ function globalInit(customerConfig) {
76
76
  const clickMonitor = ClickMonitor.getInstance();
77
77
  const pageMonitor = PageMonitor.getInstance();
78
78
  AppNavigationMonitor.getInstance().monitor();
79
- HTTPDataBundler.getInstance();
79
+ // Only initialize HTTP data collection and request monitoring if enabled
80
+ if (ClientConfig.getInstance().enableHttpDataCollection) {
81
+ HTTPDataBundler.getInstance();
82
+ RequestMonitor.getInstance().monitor();
83
+ }
80
84
  // monitoring calls
81
85
  ErrorMonitor.getInstance().monitor();
82
- RequestMonitor.getInstance().monitor();
83
86
  clickMonitor.monitor();
84
87
  keyboardInputMonitor.monitor();
85
88
  pageMonitor.monitor();
@@ -0,0 +1 @@
1
+ export {};
@@ -1,4 +1,4 @@
1
- import { isStackTrace, asString } from '../utils/function.js';
1
+ import { asString, isStackTrace } from '../utils/function.js';
2
2
  import { saveErrorToPagevisit } from '../pageVisit/pageVisitEventError.js';
3
3
  import { replace } from '../utils/object.js';
4
4
  import { Singleton } from './BaseMonitor.js';
@@ -112,12 +112,19 @@ class RequestMonitor extends Singleton {
112
112
  const headers = clonedResponse.headers;
113
113
  const gqlError = yield GqlErrorValidator.fromFetch(url, options, request, graphqlResponse);
114
114
  const isHttpError = isHttpCodeFailure(status);
115
- const [maybeRequestText, responseText] = yield promiseAll([
116
- Promise.resolve((_a = request === null || request === void 0 ? void 0 : request.text) === null || _a === void 0 ? void 0 : _a.call(request)),
117
- RequestMonitor.consumeResponseAndGetBodyText(httpEventDataResponse),
118
- ]);
115
+ // Only consume request/response bodies if HTTP data collection is enabled for this URL
116
+ // This prevents bodyUsed from being set to true when customers don't want body capture
117
+ const shouldCaptureBody = HTTPDataBundler.getInstance().shouldContinueForURL(url);
118
+ const [maybeRequestText, responseText] = shouldCaptureBody
119
+ ? yield promiseAll([
120
+ Promise.resolve((_a = request === null || request === void 0 ? void 0 : request.text) === null || _a === void 0 ? void 0 : _a.call(request)),
121
+ RequestMonitor.consumeResponseAndGetBodyText(httpEventDataResponse),
122
+ ])
123
+ : [undefined, undefined];
119
124
  const httpEvent = RequestMonitor.getPvEventHttp(status, headers, method, url, respTime);
120
- const httpData = yield RequestMonitor.getHttpDataFromFetch(request, httpEventDataResponse, method, url, options, isHttpError || !!gqlError, maybeRequestText, responseText);
125
+ const httpData = shouldCaptureBody
126
+ ? yield RequestMonitor.getHttpDataFromFetch(request, httpEventDataResponse, method, url, options, isHttpError || !!gqlError, maybeRequestText, responseText)
127
+ : null;
121
128
  const seq = saveHTTPEvent(httpEvent, httpData, !!gqlError);
122
129
  if (isHttpError) {
123
130
  // this does not consume response body so no need to clone it
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "noibu-react-native",
3
- "version": "0.2.33",
3
+ "version": "0.2.34-rc.1",
4
4
  "targetNjsVersion": "1.0.104",
5
5
  "description": "React-Native SDK for NoibuJS to collect errors in React-Native applications",
6
6
  "main": "dist/entry/index.js",