noibu-react-native 0.2.3 → 0.2.5

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.
Files changed (71) hide show
  1. package/dist/api/clientConfig.js +20 -27
  2. package/dist/api/helpCode.js +61 -87
  3. package/dist/api/metroplexSocket.js +72 -65
  4. package/dist/api/storedPageVisit.js +150 -208
  5. package/dist/constants.js +3 -7
  6. package/dist/entry/init.js +13 -15
  7. package/dist/monitors/{appNavigationMonitor.js → AppNavigationMonitor.js} +10 -19
  8. package/dist/monitors/BaseMonitor.js +23 -0
  9. package/dist/monitors/ClickMonitor.js +198 -0
  10. package/dist/monitors/ErrorMonitor.js +206 -0
  11. package/dist/monitors/KeyboardInputMonitor.js +60 -0
  12. package/dist/monitors/PageMonitor.js +98 -0
  13. package/dist/monitors/RequestMonitor.js +390 -0
  14. package/dist/monitors/http-tools/GqlErrorValidator.js +259 -0
  15. package/dist/monitors/{httpDataBundler.js → http-tools/HTTPDataBundler.js} +23 -102
  16. package/dist/pageVisit/{eventDebouncer.js → EventDebouncer.js} +36 -47
  17. package/dist/pageVisit/pageVisitEventError.js +3 -3
  18. package/dist/pageVisit/pageVisitEventHTTP.js +5 -4
  19. package/dist/sessionRecorder/nativeSessionRecorderSubscription.js +22 -5
  20. package/dist/sessionRecorder/sessionRecorder.js +5 -2
  21. package/dist/src/api/clientConfig.d.ts +8 -13
  22. package/dist/src/api/clientConfig.test.d.ts +1 -0
  23. package/dist/src/api/helpCode.d.ts +10 -16
  24. package/dist/src/api/metroplexSocket.d.ts +52 -71
  25. package/dist/src/api/storedPageVisit.d.ts +12 -21
  26. package/dist/src/constants.d.ts +1 -0
  27. package/dist/src/monitors/AppNavigationMonitor.d.ts +18 -0
  28. package/dist/src/monitors/BaseMonitor.d.ts +13 -0
  29. package/dist/src/monitors/BaseMonitor.test.d.ts +1 -0
  30. package/dist/src/monitors/ClickMonitor.d.ts +31 -0
  31. package/dist/src/monitors/ErrorMonitor.d.ts +63 -0
  32. package/dist/src/monitors/{keyboardInputMonitor.d.ts → KeyboardInputMonitor.d.ts} +7 -4
  33. package/dist/src/monitors/{pageMonitor.d.ts → PageMonitor.d.ts} +6 -8
  34. package/dist/src/monitors/RequestMonitor.d.ts +94 -0
  35. package/dist/src/monitors/http-tools/GqlErrorValidator.d.ts +59 -0
  36. package/dist/src/monitors/{httpDataBundler.d.ts → http-tools/HTTPDataBundler.d.ts} +13 -28
  37. package/dist/src/monitors/integrations/react-native-navigation-integration.d.ts +3 -2
  38. package/dist/src/pageVisit/{eventDebouncer.d.ts → EventDebouncer.d.ts} +3 -10
  39. package/dist/src/pageVisit/pageVisit.d.ts +1 -1
  40. package/dist/src/pageVisit/pageVisitEventHTTP.d.ts +3 -3
  41. package/dist/src/sessionRecorder/nativeSessionRecorderSubscription.d.ts +15 -0
  42. package/dist/src/storage/rnStorageProvider.d.ts +1 -1
  43. package/dist/src/storage/storage.d.ts +1 -1
  44. package/dist/src/storage/storageProvider.d.ts +2 -2
  45. package/dist/src/utils/function.d.ts +4 -5
  46. package/dist/src/utils/object.d.ts +3 -5
  47. package/dist/src/utils/polyfills.d.ts +1 -4
  48. package/dist/types/Metroplex.types.d.ts +73 -0
  49. package/dist/types/PageVisit.types.d.ts +2 -145
  50. package/dist/types/PageVisitErrors.types.d.ts +114 -0
  51. package/dist/types/PageVisitEvents.types.d.ts +91 -0
  52. package/dist/types/Storage.d.ts +1 -1
  53. package/dist/types/StoredPageVisit.types.d.ts +4 -45
  54. package/dist/utils/function.js +0 -1
  55. package/dist/utils/object.js +1 -0
  56. package/package.json +11 -7
  57. package/dist/monitors/clickMonitor.js +0 -258
  58. package/dist/monitors/errorMonitor.js +0 -202
  59. package/dist/monitors/gqlErrorValidator.js +0 -306
  60. package/dist/monitors/inputMonitor.js +0 -138
  61. package/dist/monitors/keyboardInputMonitor.js +0 -66
  62. package/dist/monitors/pageMonitor.js +0 -122
  63. package/dist/monitors/requestMonitor.js +0 -386
  64. package/dist/src/monitors/appNavigationMonitor.d.ts +0 -22
  65. package/dist/src/monitors/clickMonitor.d.ts +0 -44
  66. package/dist/src/monitors/errorMonitor.d.ts +0 -28
  67. package/dist/src/monitors/gqlErrorValidator.d.ts +0 -82
  68. package/dist/src/monitors/inputMonitor.d.ts +0 -34
  69. package/dist/src/monitors/requestMonitor.d.ts +0 -10
  70. package/dist/types/RRWeb.d.ts +0 -48
  71. package/dist/types/ReactNative.d.ts +0 -4
@@ -1,386 +0,0 @@
1
- import { __awaiter } from 'tslib';
2
- import 'react-native/Libraries/Network/fetch';
3
- import { saveErrorToPagevisit } from '../pageVisit/pageVisitEventError.js';
4
- import { isHttpCodeFailure, PageVisitEventHTTP } from '../pageVisit/pageVisitEventHTTP.js';
5
- import { propWriteableOrMadeWriteable, replace, safeEntries } from '../utils/object.js';
6
- import { HTTPDataBundler } from './httpDataBundler.js';
7
- import { SEVERITY, FETCH_EXCEPTION_ERROR_TYPE, PV_SEQ_ATT_NAME, RESPONSE_ERROR_TYPE, GQL_ERROR_TYPE, XML_HTTP_REQUEST_ERROR_TYPE, BODY_USED_ERROR, HTTP_RESP_LENGTH_ATT_NAME, HTTP_METHOD_ATT_NAME, HTTP_RESP_CODE_ATT_NAME, URL_ATT_NAME, HTTP_RESP_TIME_ATT_NAME } from '../constants.js';
8
- import ClientConfig from '../api/clientConfig.js';
9
- import GqlErrorValidator from './gqlErrorValidator.js';
10
- import { noibuLog } from '../utils/log.js';
11
- import { tryGetStackTrace, safeTrim } from '../utils/function.js';
12
- import { promiseAll } from '../utils/polyfills.js';
13
- import { addSafeEventListener } from '../utils/eventlistener.js';
14
-
15
- /**
16
- * Gets a response text Promise out of Response & headers. Returns reason if bundler decides to drop text.
17
- * Due to async nature of text() and async function sent to Promise.all,
18
- * our code race competes with client's code consuming the response.
19
- * So at this point engine somehow gets access to the original ReadableStream and marks it as locked,
20
- * thus client code may throw an error.
21
- */
22
- function consumeResponseAndGetBodyText(response) {
23
- return __awaiter(this, void 0, void 0, function* () {
24
- if (!(response instanceof Response)) {
25
- return '';
26
- }
27
- if (response.bodyUsed) {
28
- return BODY_USED_ERROR;
29
- }
30
- return response.text();
31
- });
32
- }
33
- /**
34
- * Generates new PVEventHTTP
35
- */
36
- function getPvEventHttp(status, responseHeaders, method, url, responseTime) {
37
- const httpEvent = {
38
- [HTTP_METHOD_ATT_NAME]: method,
39
- [HTTP_RESP_CODE_ATT_NAME]: status,
40
- [URL_ATT_NAME]: url,
41
- [HTTP_RESP_TIME_ATT_NAME]: responseTime,
42
- };
43
- const bundler = HTTPDataBundler.getInstance();
44
- // add response payload length, if any
45
- const contentLength = bundler.contentLength(responseHeaders);
46
- if (contentLength > 0 && bundler.shouldContinueForURL(url)) {
47
- httpEvent[HTTP_RESP_LENGTH_ATT_NAME] = contentLength;
48
- }
49
- return httpEvent;
50
- }
51
- /**
52
- * Gets headers from request or request options. Handles different scenarios where simple conversion is not possible
53
- */
54
- function getRequestHeaders(request, options) {
55
- const headers = safeEntries((request === null || request === void 0 ? void 0 : request.headers) || (options === null || options === void 0 ? void 0 : options.headers));
56
- return HTTPDataBundler.headersMapFromIterable(headers);
57
- }
58
- /**
59
- * Gets response headers.
60
- * It is always a Headers object.
61
- */
62
- function getResponseHeaders(response) {
63
- const headers = safeEntries(response === null || response === void 0 ? void 0 : response.headers);
64
- return HTTPDataBundler.headersMapFromIterable(headers);
65
- }
66
- /**
67
- * Gets request body from body strings or Request options
68
- */
69
- function getRequestBody(requestText, options) {
70
- if (typeof requestText === 'string') {
71
- return requestText;
72
- }
73
- // it's fine if it's falsy or an empty string, we catch that in HTTPDataBundler.getInstance().bundleHTTPData
74
- return options === null || options === void 0 ? void 0 : options.body;
75
- }
76
- /**
77
- * Returns the parameters to pass the PageVisitEventHTTP constructor. Specific to the fetch wrapper.
78
- */
79
- function getHttpDataFromFetch(request, response, method, url, options, isError, requestText, responseText) {
80
- return __awaiter(this, void 0, void 0, function* () {
81
- if (!HTTPDataBundler.getInstance().shouldContinueForURL(url)) {
82
- return null;
83
- }
84
- return HTTPDataBundler.getInstance().bundleHTTPData(url, getRequestHeaders(request, options), getRequestBody(requestText, options), getResponseHeaders(response), responseText, method, isError);
85
- });
86
- }
87
- /** Clones Response / Request or returns original object if cloning is not possible */
88
- function cloneResponse(ogResponse) {
89
- if (!ogResponse.bodyUsed) {
90
- return ogResponse.clone();
91
- }
92
- return ogResponse; // body consumed already, no http response body for us
93
- }
94
- /**
95
- * Handles fetch failure
96
- */
97
- function handleFetchFailure(maybeErr, url) {
98
- if (!maybeErr || typeof maybeErr !== 'object') {
99
- return;
100
- }
101
- const err = maybeErr;
102
- // we do not need this error if we cannot extract both the message and stack
103
- if (!(err === null || err === void 0 ? void 0 : err.message) || !(err === null || err === void 0 ? void 0 : err.stack)) {
104
- return;
105
- }
106
- const errorFromFetch = new Error();
107
- errorFromFetch.stack = err.stack;
108
- // making sure we have a url
109
- const checkedURL = safeTrim(url);
110
- const urlMessage = checkedURL ? ` on url ${checkedURL}` : '';
111
- errorFromFetch.message = `${err.message}${urlMessage}`;
112
- const errorPayload = {
113
- error: errorFromFetch,
114
- };
115
- saveErrorToPagevisit(FETCH_EXCEPTION_ERROR_TYPE, errorPayload);
116
- }
117
- /**
118
- * Handles fetch response safely. Reports PageVisitEventHTTP and errorToPagevisit if needed.
119
- */
120
- function safeHandleFetchResponse(startTime, url, method, options, request) {
121
- return (ogResponse) => __awaiter(this, void 0, void 0, function* () {
122
- var _a, _b;
123
- try {
124
- if (!ogResponse) {
125
- // no idea how, but this happens sometimes, esp if other libs override fetch
126
- // logging to track the issue if it becomes widespread
127
- return ClientConfig.getInstance().postNoibuErrorAndOptionallyDisableClient(`Error in custom fetch() callback: no response received`, false, SEVERITY.error);
128
- }
129
- const clonedResponse = cloneResponse(ogResponse); // gotta do it as early as possible
130
- const graphqlResponse = cloneResponse(clonedResponse); // and two times more for each consumption
131
- const httpEventDataResponse = cloneResponse(clonedResponse);
132
- const respTime = Date.now() - startTime;
133
- const status = clonedResponse.status;
134
- const headers = clonedResponse.headers;
135
- const gqlError = yield GqlErrorValidator.fromFetch(url, options, request, graphqlResponse);
136
- const isHttpError = isHttpCodeFailure(status);
137
- const [maybeRequestText, responseText] = yield promiseAll([
138
- Promise.resolve((_a = request === null || request === void 0 ? void 0 : request.text) === null || _a === void 0 ? void 0 : _a.call(request)),
139
- consumeResponseAndGetBodyText(httpEventDataResponse),
140
- ]);
141
- const httpEvent = getPvEventHttp(status, headers, method, url, respTime);
142
- const httpData = yield getHttpDataFromFetch(request, httpEventDataResponse, method, url, options, isHttpError || !!gqlError, maybeRequestText, responseText);
143
- const pageVisitEventHTTP = new PageVisitEventHTTP(httpEvent, httpData, !!gqlError);
144
- pageVisitEventHTTP.saveHTTPEvent();
145
- const seq = (_b = pageVisitEventHTTP.httpData) === null || _b === void 0 ? void 0 : _b[PV_SEQ_ATT_NAME];
146
- if (isHttpError) {
147
- // this does not consume response body so no need to clone it
148
- saveErrorToPagevisit(RESPONSE_ERROR_TYPE, clonedResponse, seq);
149
- }
150
- if (gqlError) {
151
- gqlError.forEach(error => saveErrorToPagevisit(GQL_ERROR_TYPE, error, seq));
152
- }
153
- }
154
- catch (e) {
155
- if ((e === null || e === void 0 ? void 0 : e.name) === 'AbortError') {
156
- // skip it, as it's somewhat expected
157
- return;
158
- }
159
- const stack = tryGetStackTrace(e);
160
- ClientConfig.getInstance().postNoibuErrorAndOptionallyDisableClient(`Error in custom fetch() callback: ${e}${stack}`, false, SEVERITY.error);
161
- }
162
- });
163
- }
164
- /**
165
- * Safe function to get method and url from fetch args
166
- */
167
- function getMethodUrlFromFetchArgs(resource, options) {
168
- const defaultResource = { method: 'GET', url: '' };
169
- try {
170
- // There is no valid reason for fetch() to be called without a resource but we
171
- // see it on a bunch of websites. It seems to work the same as empty string
172
- if (!resource) {
173
- return defaultResource;
174
- }
175
- if (resource instanceof Request && resource.method) {
176
- return { method: resource.method, url: resource.url || '' };
177
- }
178
- return {
179
- method: (options === null || options === void 0 ? void 0 : options.method) || 'GET',
180
- url: typeof resource.toString === 'function' ? resource.toString() : '',
181
- };
182
- }
183
- catch (e) {
184
- ClientConfig.getInstance().postNoibuErrorAndOptionallyDisableClient(`Error in fetch() wrapper: ${e}`, false, SEVERITY.error);
185
- }
186
- return defaultResource;
187
- }
188
- /**
189
- * Setting up the wrapper around fetch functions to try and
190
- * catch http errors
191
- */
192
- function setupGlobalFetchWrapper(proto) {
193
- if (!propWriteableOrMadeWriteable(proto, 'fetch')) {
194
- return;
195
- }
196
- replace(proto, 'fetch', function (originalFunction) {
197
- // please don't change the name of this function. we need this stack frame to be nbuWrapper
198
- return function nbuWrapper(resource, options) {
199
- let request;
200
- const { url, method } = getMethodUrlFromFetchArgs(resource, options);
201
- if (resource instanceof Request) {
202
- /**
203
- * We clone the request object, as its body can only be read once per instance.
204
- * It's important that we do this before the original function is called, as it
205
- * cannot be cloned afterward.
206
- */
207
- request = resource.clone();
208
- }
209
- const startTime = Date.now();
210
- const promiseFromOriginalFetch = originalFunction.call(this, resource, options);
211
- promiseFromOriginalFetch
212
- .then(safeHandleFetchResponse(startTime, url, method, options, request))
213
- .catch(err => {
214
- handleFetchFailure(err, url);
215
- });
216
- return promiseFromOriginalFetch;
217
- };
218
- });
219
- }
220
- /**
221
- * Does a check if data collection is enabled and combines it into HttpDataBundle
222
- */
223
- function getHttpDataFromXhr(xhrObj_1, method_1, url_1, isError_1) {
224
- return __awaiter(this, arguments, void 0, function* (xhrObj, method, url, isError, requestPayload = null, responseText) {
225
- if (!HTTPDataBundler.getInstance().shouldContinueForURL(url)) {
226
- return null;
227
- }
228
- const responseHeaders = HTTPDataBundler.headersMapFromString(xhrObj.getAllResponseHeaders());
229
- return HTTPDataBundler.getInstance().bundleHTTPData(url, xhrObj.noibuRequestHeaders, requestPayload, responseHeaders, responseText, method, isError);
230
- });
231
- }
232
- /**
233
- * on loadend we catch the event and
234
- * make sure it was correct
235
- */
236
- function loadendHandler(xhr, startTime, url, method, requestPayload) {
237
- return __awaiter(this, void 0, void 0, function* () {
238
- var _a;
239
- const respTime = Date.now() - startTime;
240
- const gqlError = yield GqlErrorValidator.fromXhr(url, xhr);
241
- const httpError = isHttpCodeFailure(xhr.status);
242
- const responseText = yield HTTPDataBundler.getResponseStringFromXHR(xhr);
243
- const httpEvent = getPvEventHttp(xhr.status, HTTPDataBundler.headersMapFromString(xhr.getAllResponseHeaders()), method, url, respTime);
244
- const httpData = yield getHttpDataFromXhr(xhr, method, url, httpError || !!gqlError, requestPayload, responseText);
245
- const pageVisitEventHTTP = new PageVisitEventHTTP(httpEvent, httpData, gqlError);
246
- // Save HTTP Info
247
- pageVisitEventHTTP.saveHTTPEvent();
248
- const seq = (_a = pageVisitEventHTTP.httpData) === null || _a === void 0 ? void 0 : _a[PV_SEQ_ATT_NAME];
249
- if (httpError) {
250
- saveErrorToPagevisit(XML_HTTP_REQUEST_ERROR_TYPE, xhr, seq);
251
- }
252
- if (gqlError) {
253
- gqlError.forEach(error => saveErrorToPagevisit(GQL_ERROR_TYPE, error, seq));
254
- }
255
- });
256
- }
257
- /** gets method from xhr */
258
- function getMethodFromXHR(xhr, payload) {
259
- if (xhr.noibuHttpMethod) {
260
- return xhr.noibuHttpMethod;
261
- }
262
- // This is very hacky, but we do not really have an option as
263
- // we do not have access to either the url nor the method when
264
- // overriding the send method
265
- return payload ? 'POST' : 'GET';
266
- }
267
- /**
268
- * Wraps the send prototype of the xmlhttp object
269
- * We set nbuWrapper to the handler function so if this returns an error
270
- * the trace message will start with nbuWrapper which would allow us to
271
- * detect that this is a wrapped function and not a NoibuJS error
272
- */
273
- function wrapXMLHTTPSend(proto) {
274
- replace(proto, 'send', function (originalFunction) {
275
- return function nbuWrapper(payload) {
276
- try {
277
- const method = getMethodFromXHR(this, payload);
278
- const startTime = Date.now();
279
- addSafeEventListener(this, 'loadend', () => loadendHandler(this, startTime, this.noibuHttpUrl || this.responseURL, method, payload));
280
- }
281
- catch (e) {
282
- const stack = tryGetStackTrace(e);
283
- ClientConfig.getInstance().postNoibuErrorAndOptionallyDisableClient(`Error in XHR.send() wrapper: ${e}${stack}`, false, SEVERITY.error);
284
- }
285
- return originalFunction.call(this, payload);
286
- };
287
- });
288
- }
289
- /**
290
- * Wraps the open prototype of the xmlhttp object
291
- * We set nbuWrapper to the handler function so if this returns an error
292
- * the trace message will start with nbuWrapper which would allow us to
293
- * detect that this is a wrapped function and not a NoibuJS error
294
- */
295
- function wrapXMLHTTPOpen(proto, shouldHandleLoadend) {
296
- replace(proto, 'open', function (originalFunction) {
297
- return function nbuWrapper(method, url, async = true, user = null, password = null) {
298
- try {
299
- /**
300
- * We wrap assignment of the .noibu[...] variables in a try/catch, as we're assigning
301
- * properties to a built-in object type, and have no guarantee of success.
302
- */
303
- try {
304
- this.noibuHttpMethod = method;
305
- this.noibuHttpUrl = url;
306
- }
307
- catch (error) {
308
- ClientConfig.getInstance().postNoibuErrorAndOptionallyDisableClient(`Unable to set custom properties on XHR object: ${error}`, false, SEVERITY.warn);
309
- }
310
- if (shouldHandleLoadend) {
311
- const startTime = Date.now();
312
- addSafeEventListener(this, 'loadend', () => loadendHandler(this, startTime, url, method, null));
313
- }
314
- }
315
- catch (e) {
316
- const stack = tryGetStackTrace(e);
317
- ClientConfig.getInstance().postNoibuErrorAndOptionallyDisableClient(`Error in XHR.open() wrapper: ${e}${stack}`, false, SEVERITY.error);
318
- }
319
- return originalFunction.call(this, method, url, async, user, password);
320
- };
321
- });
322
- }
323
- /**
324
- * Replaces the native XMLHTTPRequest.setHeader() function. We use this to build an array of
325
- * request headers as these are not stored by the XMLHTTPRequest object.
326
- * @param {object} proto window.XMLHTTPRequest's prototype
327
- */
328
- function wrapXMLHTTPSetRequestHeader(proto) {
329
- replace(proto, 'setRequestHeader', function (originalFunction) {
330
- return function nbuWrapper(header, value) {
331
- // We wrap all of our logic in a try block to guarantee that we will complete the original
332
- // implementation if we throw an error in our logic.
333
- try {
334
- if (!(this.noibuRequestHeaders instanceof Map)) {
335
- this.noibuRequestHeaders = new Map();
336
- }
337
- // Ensure it's a string. This also converts null to "null"
338
- const stringValue = typeof value === 'string' ? value : String(value);
339
- if (typeof header === 'string') {
340
- this.noibuRequestHeaders.set(header.toLowerCase(), stringValue);
341
- }
342
- }
343
- catch (error) {
344
- ClientConfig.getInstance().postNoibuErrorAndOptionallyDisableClient(`Error in XHR.setRequestHeader() wrapper: ${error}`, false, SEVERITY.error);
345
- }
346
- return originalFunction.call(this, header, value);
347
- };
348
- });
349
- }
350
- /**
351
- * Setting up the wrapper around send functions to try and
352
- * catch http errors
353
- */
354
- function setupGlobalXMLHttpWrapper() {
355
- if (typeof XMLHttpRequest === 'undefined') {
356
- return;
357
- }
358
- const XMLHttp = XMLHttpRequest;
359
- // The event target needs to have a prototype and have the open function
360
- const proto = XMLHttp && XMLHttp.prototype;
361
- const canWriteOpen = propWriteableOrMadeWriteable(proto, 'open');
362
- const canWriteSend = propWriteableOrMadeWriteable(proto, 'send');
363
- const canWriteSetHeader = propWriteableOrMadeWriteable(proto, 'setRequestHeader');
364
- if (canWriteOpen) {
365
- // If we can't wrap the XHR.send() function, we need the wrapped .open() function to
366
- // set the listener on 'loadend' events.
367
- wrapXMLHTTPOpen(proto, !canWriteSend);
368
- }
369
- if (canWriteSend) {
370
- wrapXMLHTTPSend(proto);
371
- }
372
- if (canWriteSetHeader) {
373
- wrapXMLHTTPSetRequestHeader(proto);
374
- }
375
- }
376
- /**
377
- * Monitors all requests
378
- */
379
- function monitorRequests() {
380
- noibuLog('monitorRequests started');
381
- setupGlobalFetchWrapper(global);
382
- setupGlobalXMLHttpWrapper();
383
- noibuLog('monitorRequests ended');
384
- }
385
-
386
- export { handleFetchFailure, monitorRequests };
@@ -1,22 +0,0 @@
1
- /**
2
- * Attaches corresponding listener to the passed navigation integration
3
- */
4
- export declare class AppNavigationMonitor {
5
- private static instance;
6
- /**
7
- * guesses which navigation is used in app, and registers a listener if found
8
- */
9
- constructor();
10
- /**
11
- * handler for updating navigation breadcrumbs and notifying metro of location change
12
- */
13
- onNavigation(breadcrumbs: string[]): void;
14
- /**
15
- * Gets the singleton instance
16
- */
17
- static getInstance(): AppNavigationMonitor;
18
- /**
19
- * Called when the event needs to be emitted
20
- */
21
- private reportLocationChange;
22
- }
@@ -1,44 +0,0 @@
1
- /** Monitors the clicks which we capture and later process */
2
- export class ClickMonitor {
3
- /** gets the singleton instance
4
- * @returns {ClickMonitor}
5
- */
6
- static getInstance(): ClickMonitor;
7
- /**
8
- * Gets selectors to prevent those elements from being recorded
9
- */
10
- static getBlockedElements(): string[];
11
- textCapturedWhiteListRegex: RegExp;
12
- htmlIDAllowListRegex: RegExp;
13
- /** Starts monitoring clicks on every Press-able component */
14
- monitorClicks(): void;
15
- /**
16
- * Handles a single click event
17
- * @param {{ _targetInst: RNNode }} event
18
- */
19
- _onClickHandle(event: {
20
- _targetInst: RNNode;
21
- }): void;
22
- /** Gets the textual content from an element, if any
23
- * @param {} element
24
- */
25
- _getTextualContentFromEl(element: any): string;
26
- /** Parse and trim text
27
- * @param {} text
28
- */
29
- _trimText(text: any): any;
30
- /**
31
- * Recursively parses element's inner content and masks blocked css classes
32
- * @param {NReactNative.Node} element
33
- * @param {String} text
34
- * @param {Number} textLimit
35
- * @param {Object} counter
36
- */
37
- _parseInnerContent(element: NReactNative.Node, text: string, textLimit: number, counter: any): string;
38
- /**
39
- * normalize value and append to the resulting text if not empty
40
- * @param {String} text
41
- * @param {Array.<any>} values
42
- */
43
- _parseAndAppendText(text: string, values: Array<any>): string;
44
- }
@@ -1,28 +0,0 @@
1
- type WrappedFunction<T extends Function = Function> = T & Partial<{
2
- __noibu__: boolean;
3
- __noibu_wrapped__: T;
4
- }>;
5
- /**
6
- * wraps a provided function into a function that try and catches
7
- * the original function, doing so allows us to catch errors
8
- * functionToWrap: function to be wrapped
9
- * @param {} functionToWrap
10
- */
11
- export declare function wrap(functionToWrap: WrappedFunction): Function;
12
- /** iterates arguments to try to extract errors from them
13
- * @param {Array<string | Error>} argsFromErrorLog
14
- */
15
- export declare function processErrorLogArguments(argsFromErrorLog: any[]): void;
16
- /**
17
- * handler for promise rejection failures
18
- * @param error
19
- */
20
- export declare function onPromiseRejectionHandler(error: {
21
- message: string;
22
- stack?: string;
23
- }): void;
24
- /**
25
- * Monitors the errors happening on the window
26
- */
27
- export declare function monitorErrors(): void;
28
- export {};
@@ -1,82 +0,0 @@
1
- /**
2
- * Try detecting GraphQL errors from http response
3
- */
4
- export default class GqlErrorValidator {
5
- /**
6
- * Retrieves GQL error object based on fetch request/response
7
- * @param {String} url
8
- * @param {{}} [options]
9
- * @param {Request} [request]
10
- * @param {Response} [response] - cloned() from original response
11
- */
12
- static fromFetch(url: string, options?: {} | undefined, request?: Request | undefined, response?: Response | undefined): Promise<any>;
13
- /**
14
- * Retrieves GQL error object based on XHR object
15
- * @param {String} url
16
- * @param {XMLHttpRequest} xhr
17
- */
18
- static fromXhr(url: string, xhr: XMLHttpRequest): Promise<any>;
19
- /**
20
- * Try safely parse a string and return null if fails
21
- * @param {String} content
22
- */
23
- static _parseJsonSafely(content: string): any;
24
- /**
25
- * Try to get content type for fetch arguments
26
- * @param {{}} options
27
- * @param {Request} [request]
28
- */
29
- static _getContentTypeFromFetchArguments(options: {}, request?: Request | undefined): string | null;
30
- /**
31
- * Checks if request is aborted
32
- * If it has been aborder we are not able to consume the response
33
- * @param {{}} options
34
- * @param {Request} request
35
- */
36
- static _isRequestAborted(options: {}, request: Request): any;
37
- /**
38
- * Determines if request should be processed
39
- * @param {String|URL} url
40
- * @param {String} contentType
41
- */
42
- static _shouldHandleRequest(url: string | URL, contentType: string): boolean;
43
- /**
44
- * Sanitizes payload object
45
- * @param {any} data
46
- * @param {Array<String>} validationIssues
47
- */
48
- static _validate(data: any, validationIssues: Array<string>): any;
49
- /**
50
- * Sanitizes message object
51
- * @param {any} error
52
- */
53
- static _validateMessage(error: any): void;
54
- /**
55
- * Sanitizes extensions object
56
- * @param {any} error
57
- * @param {Array<String>} validationIssues
58
- */
59
- static _validateExtensions(error: any): void;
60
- /**
61
- * Sanitizes locations object
62
- * @param {any} error
63
- * @param {Array<String>} validationIssues
64
- */
65
- static _validateLocations(error: any, validationIssues: Array<string>): void;
66
- /**
67
- * Sanitizes path object
68
- * @param {any} error
69
- * @param {Array<String>} validationIssues
70
- */
71
- static _validatePath(error: any, validationIssues: Array<string>): void;
72
- /**
73
- * Posts error
74
- * @param {String} message
75
- */
76
- static _postError(message: string): void;
77
- /**
78
- * Posts issue found during object sanitization
79
- * @param {Array<String>} validationIssues
80
- */
81
- static _postValidationIssues(validationIssues: Array<string>): void;
82
- }
@@ -1,34 +0,0 @@
1
- /**
2
- * Singleton class to manage the client configuration
3
- * this class will be responsible for debouncing all events
4
- * that are registered
5
- */
6
- export class InputMonitor {
7
- /**
8
- * gets the instance of InputMonitor
9
- * @returns {InputMonitor}
10
- */
11
- static getInstance(): InputMonitor;
12
- eventsToDebounce: {};
13
- /** will debounce all events that are of this type by the debounce period
14
- * @param {} type
15
- * @param {} debouncePeriod
16
- * @param {} eventName=type
17
- */
18
- registerInputType(type: any, debouncePeriod: any, eventName?: any): void;
19
- /**
20
- * Creates an event object with the event and the time it was added then pushes
21
- * that event object to the queue of events waiting to be debounced.
22
- * @param {} event
23
- * @param {} type
24
- */
25
- addEvent(event: any, type: any): void;
26
- /**
27
- * Adds the events from the object to the page visit and sets up a timer
28
- * to send the events if no more are received without the timeout
29
- * @param {} type
30
- */
31
- _debouncePvEvents(type: any): void;
32
- /** Sets up the page hide handler to try to push remaining events in the queues */
33
- _setupUnloadHandler(): void;
34
- }
@@ -1,10 +0,0 @@
1
- /** @module RequestMonitor */
2
- import 'react-native/Libraries/Network/fetch';
3
- /**
4
- * Handles fetch failure
5
- */
6
- export declare function handleFetchFailure(maybeErr: unknown, url: unknown): void;
7
- /**
8
- * Monitors all requests
9
- */
10
- export declare function monitorRequests(): void;
@@ -1,48 +0,0 @@
1
- export declare const enum EventType {
2
- DomContentLoaded = 0,
3
- Load = 1,
4
- FullSnapshot = 2,
5
- IncrementalSnapshot = 3,
6
- Meta = 4,
7
- Custom = 5,
8
- Plugin = 6
9
- }
10
- export declare const enum NodeType {
11
- Document = 0,
12
- DocumentType = 1,
13
- Element = 2,
14
- Text = 3,
15
- CDATA = 4,
16
- Comment = 5
17
- }
18
- export declare const enum IncrementalSource {
19
- Mutation = 0,
20
- MouseMove = 1,
21
- MouseInteraction = 2,
22
- Scroll = 3,
23
- ViewportResize = 4,
24
- Input = 5,
25
- TouchMove = 6,
26
- MediaInteraction = 7,
27
- StyleSheetRule = 8,
28
- CanvasMutation = 9,
29
- Font = 10,
30
- Log = 11,
31
- Drag = 12,
32
- StyleDeclaration = 13,
33
- Selection = 14,
34
- AdoptedStyleSheet = 15
35
- }
36
- export declare const enum MouseInteractions {
37
- MouseUp = 0,
38
- MouseDown = 1,
39
- Click = 2,
40
- ContextMenu = 3,
41
- DblClick = 4,
42
- Focus = 5,
43
- Blur = 6,
44
- TouchStart = 7,
45
- TouchMove_Departed = 8,
46
- TouchEnd = 9,
47
- TouchCancel = 10
48
- }
@@ -1,4 +0,0 @@
1
- export interface RNNode {
2
- memoizedProps: any;
3
- elementType: string;
4
- }