noibu-react-native 0.2.3 → 0.2.4

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 (66) hide show
  1. package/dist/api/helpCode.js +61 -87
  2. package/dist/api/metroplexSocket.js +72 -65
  3. package/dist/api/storedPageVisit.js +150 -208
  4. package/dist/constants.js +3 -7
  5. package/dist/entry/init.js +11 -11
  6. package/dist/monitors/{appNavigationMonitor.js → AppNavigationMonitor.js} +10 -19
  7. package/dist/monitors/ClickMonitor.js +198 -0
  8. package/dist/monitors/ErrorMonitor.js +206 -0
  9. package/dist/monitors/KeyboardInputMonitor.js +60 -0
  10. package/dist/monitors/PageMonitor.js +98 -0
  11. package/dist/monitors/RequestMonitor.js +390 -0
  12. package/dist/monitors/http-tools/GqlErrorValidator.js +259 -0
  13. package/dist/monitors/{httpDataBundler.js → http-tools/HTTPDataBundler.js} +23 -102
  14. package/dist/pageVisit/{eventDebouncer.js → EventDebouncer.js} +36 -47
  15. package/dist/pageVisit/pageVisitEventError.js +3 -3
  16. package/dist/pageVisit/pageVisitEventHTTP.js +5 -4
  17. package/dist/sessionRecorder/sessionRecorder.js +1 -1
  18. package/dist/src/api/clientConfig.d.ts +1 -1
  19. package/dist/src/api/helpCode.d.ts +10 -16
  20. package/dist/src/api/metroplexSocket.d.ts +52 -71
  21. package/dist/src/api/storedPageVisit.d.ts +12 -21
  22. package/dist/src/constants.d.ts +1 -0
  23. package/dist/src/monitors/AppNavigationMonitor.d.ts +18 -0
  24. package/dist/src/monitors/ClickMonitor.d.ts +31 -0
  25. package/dist/src/monitors/ErrorMonitor.d.ts +63 -0
  26. package/dist/src/monitors/{keyboardInputMonitor.d.ts → KeyboardInputMonitor.d.ts} +7 -4
  27. package/dist/src/monitors/{pageMonitor.d.ts → PageMonitor.d.ts} +6 -8
  28. package/dist/src/monitors/RequestMonitor.d.ts +94 -0
  29. package/dist/src/monitors/http-tools/GqlErrorValidator.d.ts +59 -0
  30. package/dist/src/monitors/{httpDataBundler.d.ts → http-tools/HTTPDataBundler.d.ts} +13 -28
  31. package/dist/src/monitors/integrations/react-native-navigation-integration.d.ts +3 -2
  32. package/dist/src/pageVisit/{eventDebouncer.d.ts → EventDebouncer.d.ts} +3 -10
  33. package/dist/src/pageVisit/pageVisit.d.ts +1 -1
  34. package/dist/src/pageVisit/pageVisitEventHTTP.d.ts +3 -3
  35. package/dist/src/storage/rnStorageProvider.d.ts +1 -1
  36. package/dist/src/storage/storage.d.ts +1 -1
  37. package/dist/src/storage/storageProvider.d.ts +2 -2
  38. package/dist/src/utils/function.d.ts +4 -5
  39. package/dist/src/utils/object.d.ts +3 -5
  40. package/dist/src/utils/polyfills.d.ts +1 -4
  41. package/dist/types/Metroplex.types.d.ts +73 -0
  42. package/dist/types/Monitor.d.ts +11 -0
  43. package/dist/types/Monitor.js +19 -0
  44. package/dist/types/PageVisit.types.d.ts +2 -145
  45. package/dist/types/PageVisitErrors.types.d.ts +114 -0
  46. package/dist/types/PageVisitEvents.types.d.ts +91 -0
  47. package/dist/types/Storage.d.ts +1 -1
  48. package/dist/types/StoredPageVisit.types.d.ts +4 -45
  49. package/dist/utils/function.js +0 -1
  50. package/dist/utils/object.js +1 -0
  51. package/package.json +4 -3
  52. package/dist/monitors/clickMonitor.js +0 -258
  53. package/dist/monitors/errorMonitor.js +0 -202
  54. package/dist/monitors/gqlErrorValidator.js +0 -306
  55. package/dist/monitors/inputMonitor.js +0 -138
  56. package/dist/monitors/keyboardInputMonitor.js +0 -66
  57. package/dist/monitors/pageMonitor.js +0 -122
  58. package/dist/monitors/requestMonitor.js +0 -386
  59. package/dist/src/monitors/appNavigationMonitor.d.ts +0 -22
  60. package/dist/src/monitors/clickMonitor.d.ts +0 -44
  61. package/dist/src/monitors/errorMonitor.d.ts +0 -28
  62. package/dist/src/monitors/gqlErrorValidator.d.ts +0 -82
  63. package/dist/src/monitors/inputMonitor.d.ts +0 -34
  64. package/dist/src/monitors/requestMonitor.d.ts +0 -10
  65. package/dist/types/RRWeb.d.ts +0 -48
  66. package/dist/types/ReactNative.d.ts +0 -4
@@ -141,6 +141,7 @@ export declare const VIDEO_PART_COUNT_ATT_NAME: "vpnum";
141
141
  export declare const CSS_SEQ_SENT: "seq_sent";
142
142
  export declare const CSS_RECEIVED: "received";
143
143
  export declare const MAX_BEACON_PAYLOAD_SIZE: 59000;
144
+ export declare const MAX_RETRY_MSG_Q_SIZE = 500;
144
145
  export declare const MAX_METROPLEX_CONNECTION_COUNT: 100;
145
146
  export declare const NOIBU_INPUT_URLS: string[];
146
147
  export declare const METROPLEX_FRAG_ROUTE: "pv_part";
@@ -0,0 +1,18 @@
1
+ import { Monitor, Singleton } from '../../types/Monitor';
2
+ /**
3
+ * Attaches corresponding listener to the passed navigation integration
4
+ */
5
+ export declare class AppNavigationMonitor extends Singleton implements Monitor {
6
+ /**
7
+ * Main method for starting the monitoring
8
+ */
9
+ monitor(): void;
10
+ /**
11
+ * handler for updating navigation breadcrumbs and notifying metro of location change
12
+ */
13
+ private static onNavigation;
14
+ /**
15
+ * Called when the event needs to be emitted
16
+ */
17
+ private static reportLocationChange;
18
+ }
@@ -0,0 +1,31 @@
1
+ /** @module ClickMonitor */
2
+ import { Monitor, Singleton } from '../../types/Monitor';
3
+ /** Monitors the clicks which we capture and later process */
4
+ export declare class ClickMonitor extends Singleton implements Monitor {
5
+ private static textCapturedWhiteListRegex;
6
+ private static htmlIDAllowListRegex;
7
+ private static originalCreateEventHandlers;
8
+ /** Starts monitoring clicks on every Press-able component */
9
+ monitor(): void;
10
+ /**
11
+ * Handles a single click event
12
+ */
13
+ private static onClickHandle;
14
+ /** Gets the textual content from an element, if any
15
+ */
16
+ private static getTextualContentFromEl;
17
+ /** Parse and trim text */
18
+ private static trimText;
19
+ /**
20
+ * Recursively parses element's inner content and masks blocked css classes
21
+ */
22
+ private static parseInnerContent;
23
+ /**
24
+ * Gets selectors to prevent those elements from being recorded
25
+ */
26
+ private static getBlockedElements;
27
+ /**
28
+ * normalize value and append to the resulting text if not empty
29
+ */
30
+ private static parseAndAppendText;
31
+ }
@@ -0,0 +1,63 @@
1
+ import { Monitor, Singleton } from '../../types/Monitor';
2
+ type WrappedFunction<T extends Function = Function> = T & Partial<{
3
+ __noibu__: boolean;
4
+ __noibu_wrapped__: T;
5
+ }>;
6
+ /**
7
+ * wraps a provided function into a function that try and catches
8
+ * the original function, doing so allows us to catch errors
9
+ * functionToWrap: function to be wrapped
10
+ * @param {} functionToWrap
11
+ */
12
+ export declare function wrap(functionToWrap: WrappedFunction): Function;
13
+ /**
14
+ * Monitors the errors happening on the window
15
+ */
16
+ export declare class ErrorMonitor extends Singleton implements Monitor {
17
+ /** base method */
18
+ monitor(): void;
19
+ /** proxy error utils */
20
+ private static configureErrorUtilsHandler;
21
+ /**
22
+ * Handles a single error event
23
+ */
24
+ private static onErrorHandler;
25
+ /** proxy hermes engine */
26
+ private static configureHermesHooks;
27
+ /**
28
+ * handler for promise rejection failures
29
+ */
30
+ private static onPromiseRejectionHandler;
31
+ /**
32
+ * wraps and replaces the addEventListener property
33
+ * of event targets to try and catch errors
34
+ * eventTargetString: event target name
35
+ */
36
+ private static configureEventListeners;
37
+ /** iterates arguments to try to extract errors from them
38
+ */
39
+ private static processErrorLogArguments;
40
+ /**
41
+ * Constructs error objects based on console args.
42
+ * Relies on isStackTrace() to determine if arg is a stack trace, otherwise the arg must be a message.
43
+ *
44
+ * If there are multiple stack traces or the number of error messages is not equal to one,
45
+ * it maps the stack traces to objects with their respective first lines as messages.
46
+ * Otherwise, if there is exactly one stack trace and one error message,
47
+ * it constructs an array with a single object containing the first stack trace and the first error message.
48
+ * @param {Array<string>} args
49
+ */
50
+ private static constructErrors;
51
+ /**
52
+ * returns boolean that indicates wether we should
53
+ * ignore the next error event caught by the error event
54
+ * listener.
55
+ */
56
+ private static shouldIgnoreError;
57
+ /**
58
+ * transform a log into an error since React hides component errors
59
+ * https://reactjs.org/docs/error-boundaries.html
60
+ */
61
+ private static processErrorLog;
62
+ }
63
+ export {};
@@ -1,8 +1,10 @@
1
+ import { Monitor, Singleton } from '../../types/Monitor';
1
2
  /**
2
3
  * KeyboardInputMonitor is a listener class that attaches a
3
4
  * keyboard input listener of the document object.
4
5
  */
5
- export class KeyboardInputMonitor {
6
+ export declare class KeyboardInputMonitor extends Singleton implements Monitor {
7
+ private static originalRender;
6
8
  /**
7
9
  * Begins the monitoring process
8
10
  * we currently only monitor two input locations: textarea and input
@@ -10,8 +12,9 @@ export class KeyboardInputMonitor {
10
12
  monitor(): void;
11
13
  /**
12
14
  * Validates an event
13
- * @param uiViewClassName
14
- * @param props
15
15
  */
16
- _handle(uiViewClassName: any, props: any): void;
16
+ static handle(uiViewClassName: string, props: {
17
+ placeholder?: string;
18
+ testID?: string;
19
+ }): void;
17
20
  }
@@ -1,17 +1,14 @@
1
+ import { Monitor, Singleton } from '../../types/Monitor';
2
+ type Event = any;
1
3
  /** Monitors the page events which we capture and later process */
2
- export class PageMonitor {
3
- /**
4
- * gets the singleton instance
5
- * @returns {PageMonitor}
6
- */
7
- static getInstance(): PageMonitor;
4
+ export declare class PageMonitor extends Singleton implements Monitor {
8
5
  /** Starts monitoring page events on the document */
9
6
  monitor(): void;
10
7
  /**
11
8
  * Handles a single page event
12
- * @param {} event
9
+ * todo: don't think these events exist in RN world
13
10
  */
14
- _onPageEventHandle(event: any): void;
11
+ _onPageEventHandle(event: Event): void;
15
12
  /** Returns document state */
16
13
  getDocumentState(): "hidden" | "active" | "passive";
17
14
  /**
@@ -20,3 +17,4 @@ export class PageMonitor {
20
17
  */
21
18
  getSizeInBytes(obj: any): number;
22
19
  }
20
+ export {};
@@ -0,0 +1,94 @@
1
+ /** @module RequestMonitor */
2
+ import 'react-native/Libraries/Network/fetch';
3
+ import { Monitor, Singleton } from '../../types/Monitor';
4
+ /**
5
+ * Monitors all requests
6
+ */
7
+ export default class RequestMonitor extends Singleton implements Monitor {
8
+ /** main method */
9
+ monitor(): void;
10
+ /**
11
+ * Gets a response text Promise out of Response & headers. Returns reason if bundler decides to drop text.
12
+ * Due to async nature of text() and async function sent to Promise.all,
13
+ * our code race competes with client's code consuming the response.
14
+ * So at this point engine somehow gets access to the original ReadableStream and marks it as locked,
15
+ * thus client code may throw an error.
16
+ */
17
+ private static consumeResponseAndGetBodyText;
18
+ /**
19
+ * Generates new PVEventHTTP
20
+ */
21
+ private static getPvEventHttp;
22
+ /**
23
+ * Gets headers from request or request options. Handles different scenarios where simple conversion is not possible
24
+ */
25
+ private static getRequestHeaders;
26
+ /**
27
+ * Gets response headers.
28
+ * It is always a Headers object.
29
+ */
30
+ private static getResponseHeaders;
31
+ /**
32
+ * Gets request body from body strings or Request options
33
+ */
34
+ private static getRequestBody;
35
+ /**
36
+ * Returns the parameters to pass the PageVisitEventHTTP constructor. Specific to the fetch wrapper.
37
+ */
38
+ private static getHttpDataFromFetch;
39
+ /** Clones Response / Request or returns original object if cloning is not possible */
40
+ private static cloneResponse;
41
+ /**
42
+ * Handles fetch response safely. Reports PageVisitEventHTTP and error to Pagevisit if needed.
43
+ */
44
+ private static safeHandleFetchResponse;
45
+ /**
46
+ * Safe function to get method and url from fetch args
47
+ */
48
+ private static getMethodUrlFromFetchArgs;
49
+ /**
50
+ * Setting up the wrapper around fetch functions to try and
51
+ * catch http errors
52
+ */
53
+ private static setupGlobalFetchWrapper;
54
+ /**
55
+ * Does a check if data collection is enabled and combines it into HttpDataBundle
56
+ */
57
+ private static getHttpDataFromXhr;
58
+ /**
59
+ * on loadend we catch the event and
60
+ * make sure it was correct
61
+ */
62
+ private static loadendHandler;
63
+ /**
64
+ * Handles fetch failure
65
+ */
66
+ private static handleFetchFailure;
67
+ /** gets method from xhr */
68
+ private static getMethodFromXHR;
69
+ /**
70
+ * Wraps the send prototype of the xmlhttp object
71
+ * We set nbuWrapper to the handler function so if this returns an error
72
+ * the trace message will start with nbuWrapper which would allow us to
73
+ * detect that this is a wrapped function and not a NoibuJS error
74
+ */
75
+ private static wrapXMLHTTPSend;
76
+ /**
77
+ * Wraps the open prototype of the xmlhttp object
78
+ * We set nbuWrapper to the handler function so if this returns an error
79
+ * the trace message will start with nbuWrapper which would allow us to
80
+ * detect that this is a wrapped function and not a NoibuJS error
81
+ */
82
+ private static wrapXMLHTTPOpen;
83
+ /**
84
+ * Replaces the native XMLHTTPRequest.setHeader() function. We use this to build an array of
85
+ * request headers as these are not stored by the XMLHTTPRequest object.
86
+ * @param {object} proto window.XMLHTTPRequest's prototype
87
+ */
88
+ private static wrapXMLHTTPSetRequestHeader;
89
+ /**
90
+ * Setting up the wrapper around send functions to try and
91
+ * catch http errors
92
+ */
93
+ private static setupGlobalXMLHttpWrapper;
94
+ }
@@ -0,0 +1,59 @@
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
+ */
8
+ static fromFetch(url: string, options: RequestInit | undefined, request: Request | undefined, response: Response): Promise<unknown[]>;
9
+ /**
10
+ * Retrieves GQL error object based on XHR object
11
+ */
12
+ static fromXhr(url: string, xhr: unknown): Promise<unknown[]>;
13
+ /**
14
+ * Try safely parse a string and return null if fails
15
+ */
16
+ static _parseJsonSafely(content: string): any;
17
+ /**
18
+ * Try to get content type for fetch arguments
19
+ */
20
+ static _getContentTypeFromFetchArguments(options?: RequestInit, request?: Request): string;
21
+ /**
22
+ * Checks if request is aborted
23
+ * If it has been aborted we are not able to consume the response
24
+ */
25
+ static _isRequestAborted(options?: RequestInit, request?: RequestInit): boolean;
26
+ /**
27
+ * Determines if request should be processed
28
+ */
29
+ static _shouldHandleRequest(url: string, contentType?: string | null): boolean;
30
+ /**
31
+ * Sanitizes payload object
32
+ */
33
+ static _validate(data: unknown, validationIssues: string[]): unknown[];
34
+ /**
35
+ * Sanitizes message object
36
+ */
37
+ static _validateMessage(error: object): void;
38
+ /**
39
+ * Sanitizes extensions object
40
+ * @param {any} error
41
+ */
42
+ static _validateExtensions(error: any): void;
43
+ /**
44
+ * Sanitizes locations object
45
+ */
46
+ static _validateLocations(error: object, validationIssues: string[]): void;
47
+ /**
48
+ * Sanitizes path object
49
+ */
50
+ static _validatePath(error: object, validationIssues: string[]): void;
51
+ /**
52
+ * Posts error
53
+ */
54
+ static _postError(message: unknown): void;
55
+ /**
56
+ * Posts issue found during object sanitization
57
+ */
58
+ static _postValidationIssues(validationIssues: string[]): void;
59
+ }
@@ -1,36 +1,32 @@
1
- import { HTTPDataBundle } from '../../types/PageVisit.types';
2
- import { WrappedXMLHttpRequest } from '../../types/WrappedObjects';
1
+ import { WrappedXMLHttpRequest } from '../../../types/WrappedObjects';
2
+ import { Singleton } from '../../../types/Monitor';
3
+ import { HTTPDataBundle } from '../../../types/PageVisitEvents.types';
3
4
  /** Bundles HTTP payloads and headers */
4
- export declare class HTTPDataBundler {
5
+ export declare class HTTPDataBundler extends Singleton {
5
6
  contentTypeReadableRegex: RegExp;
6
7
  hostname: string;
7
8
  initialURLPartsReversed: string[];
8
9
  httpDataCollectionEnabled: boolean;
9
10
  httpDataAllowedRelativeRegex: RegExp | null;
10
11
  httpDataAllowedAbsoluteRegex: RegExp | null;
11
- private static instance;
12
12
  /**
13
13
  * Creates an instance of the ClickMonitor instance
14
14
  */
15
15
  constructor();
16
- /** gets the singleton instance
17
- * @returns {HTTPDataBundler}
18
- * */
19
- static getInstance(): HTTPDataBundler;
20
16
  /**
21
17
  * Builds the HTTP payload allowed regexes for full and relative URLs
22
18
  * @param allowedURLs A list of allowed URLs
23
19
  * @param absolute Use only absolute URLs if true, use only relative URL if false
24
20
  * @returns a regex of allowed URLs
25
21
  */
26
- static buildAllowedRegex(allowedURLs: unknown | unknown[], absolute: boolean): RegExp | null;
22
+ private static buildAllowedRegex;
27
23
  /**
28
24
  * Takes an iterator and returns a map of strings representing headers.
29
- * @param {object} headersIterable any iterable object
30
- * @returns a map of strings (as expected by metroplex) representing HTTP
25
+ * param {object} headersIterable any iterable object
26
+ * returns a map of strings (as expected by metroplex) representing HTTP
31
27
  * request or response headers
32
28
  */
33
- static headersMapFromIterable(headersIterable: any): Map<any, any>;
29
+ static headersMapFromIterable(headersIterable: Iterable<any[]>): Map<any, any>;
34
30
  /**
35
31
  * Takes a string of headers with 'name: value' and returns
36
32
  * a map of strings representing headers.
@@ -45,13 +41,6 @@ export declare class HTTPDataBundler {
45
41
  * @returns a string representation of the response, or null if this fails.
46
42
  */
47
43
  static getResponseStringFromXHR(xhr: WrappedXMLHttpRequest): Promise<any>;
48
- /**
49
- * Takes a URL and returns true if it is determined to be on the same domain as the URL
50
- * the script is running on. Ignores protocol and path, and allows the URL to be a subdomain.
51
- * @param {string} requestURL the URL of a request to compare to the script website's URL
52
- * @param {bool} isHostnameCheck the URL is a domain hostname, could be a super or sub domain
53
- */
54
- isURLSameDomain(requestURL: any, isHostnameCheck?: boolean): boolean;
55
44
  /**
56
45
  * Builds an HTTP Data bundle
57
46
  */
@@ -59,11 +48,8 @@ export declare class HTTPDataBundler {
59
48
  /**
60
49
  * Validates a request based on the URL and method. When enabled, will handle
61
50
  * de-duping the requests
62
- * @param {string} url
63
- * @param {string} method
64
- * @returns boolean indicating whether the validation passed
65
51
  */
66
- isValidRequest(url: any, method: any): boolean;
52
+ isValidRequest(method: unknown): boolean;
67
53
  /**
68
54
  * Checks two things: that the URL is either on the same domain (or an address relative to the
69
55
  * current domain), and also checks that the config http_data_collection flag is enabled.
@@ -73,14 +59,13 @@ export declare class HTTPDataBundler {
73
59
  */
74
60
  shouldContinueForURL(url: any): boolean;
75
61
  /**
76
- * Determins if the URL is absolute or relative
77
- * @param {string} url
78
- * @returns boolean indicating whether the URL passed is either absolute or relative
62
+ * Determines if the URL is absolute or relative
63
+ * returns boolean indicating whether the URL passed is either absolute or relative
79
64
  */
80
- static isAbsoluteURL(url: any): boolean;
65
+ static isAbsoluteURL(url: unknown): boolean;
81
66
  /**
82
67
  * Checks whether HTTP payloads can be collected on this URL
83
- * @returns boolean indicating whether HTTP payloads can be collected on this URL
68
+ * returns boolean indicating whether HTTP payloads can be collected on this URL
84
69
  */
85
70
  shouldCollectPayloadForURL(url: any): boolean;
86
71
  /**
@@ -1,4 +1,5 @@
1
- import { NavigationIntegration } from '../../types/NavigationIntegration';
1
+ import { NavigationIntegration } from '../../../types/NavigationIntegration';
2
+ import { NavigationRoot } from 'react-native-navigation/lib/dist/src/Navigation';
2
3
  /**
3
4
  * react-native-navigation adapter
4
5
  */
@@ -8,7 +9,7 @@ export declare class ReactNativeNavigationIntegration implements NavigationInteg
8
9
  /**
9
10
  * attaches provided listeners to the integration
10
11
  */
11
- register(navigation: any, onNavigation: (breadcrumbs: string[]) => void): void;
12
+ register(navigation: NavigationRoot, onNavigation: (breadcrumbs: string[]) => void): void;
12
13
  /**
13
14
  * Listens to ComponentWillAppear events, keeps track of visited screens and
14
15
  * pops them if the same page is visited to prevent cycles
@@ -1,26 +1,19 @@
1
+ import { Singleton } from '../../types/Monitor';
1
2
  /**
2
3
  * Singleton class responsible for debouncing all events
3
4
  * that are registered
4
5
  */
5
- export declare class EventDebouncer {
6
+ export declare class EventDebouncer extends Singleton {
6
7
  private readonly eventsToDebounce;
7
- private static instance;
8
8
  /**
9
9
  * Creates an instance of EventDebouncer
10
10
  */
11
11
  constructor();
12
- /**
13
- * gets the instance of EventDebouncer
14
- */
15
- static getInstance(): EventDebouncer;
16
- /** will debounce all events that are of this type by the debounce period
17
- */
18
- registerInputType(type: string, debouncePeriod: number, eventName?: string): void;
19
12
  /**
20
13
  * Creates an event object with the event and the time it was added then pushes
21
14
  * that event object to the queue of events waiting to be debounced.
22
15
  */
23
- addEvent(event: any, type: string, occurredAt?: number): void;
16
+ addEvent(event: any, type: keyof typeof this.eventsToDebounce, occurredAt?: number): void;
24
17
  /**
25
18
  * Adds the events from the object to the page visit and sets up a timer
26
19
  * to send the events if no more are received without the timeout
@@ -17,7 +17,7 @@ export class PageVisit {
17
17
  * @param {} pvEvents
18
18
  * @param {} partCounter
19
19
  */
20
- static makePageVisitFrag(pvEvents: any, partCounter: any): any;
20
+ static makePageVisitFrag(pvEvents: any, partCounter: any): import("../../types/Metroplex.types").PageVisitFrag | import("../../types/Metroplex.types").VideoFrag;
21
21
  partCounter: number;
22
22
  pvMap: {};
23
23
  pvEventLength: number;
@@ -1,17 +1,17 @@
1
- import { HTTPDataBundle, PVEventHTTP } from '../../types/PageVisit.types';
1
+ import { HTTPDataBundle, PVEventHTTPPayload } from '../../types/PageVisitEvents.types';
2
2
  /**
3
3
  * Determines if a response is a failure
4
4
  */
5
5
  export declare function isHttpCodeFailure(code: unknown): boolean;
6
6
  /** Class representing a PageVisitEventHTTP */
7
7
  export declare class PageVisitEventHTTP {
8
- httpEvent: PVEventHTTP;
8
+ httpEvent: PVEventHTTPPayload;
9
9
  httpData: HTTPDataBundle | null;
10
10
  isGqlError: boolean;
11
11
  /**
12
12
  * Creates an instance of the http event for the pv
13
13
  */
14
- constructor(httpEvent: Partial<PVEventHTTP>, httpData: HTTPDataBundle | null, isGqlError?: boolean);
14
+ constructor(httpEvent: Partial<PVEventHTTPPayload>, httpData: HTTPDataBundle | null, isGqlError?: boolean);
15
15
  /** Saves the HTTP event to the pageVisit Queue */
16
16
  saveHTTPEvent(): void;
17
17
  /**
@@ -13,7 +13,7 @@ export default class RNStorageProvider extends StorageProvider {
13
13
  */
14
14
  static isAvailable(): Promise<{
15
15
  result: boolean;
16
- error: Error | null;
16
+ error: Error;
17
17
  }>;
18
18
  /**
19
19
  * Calculates used scape
@@ -20,7 +20,7 @@ export default class Storage implements IStorage {
20
20
  /** Checks if storage is available */
21
21
  isAvailable(): Promise<boolean>;
22
22
  /** Loads value from storage */
23
- load<R = unknown>(key: string): Promise<R | null>;
23
+ load(key: string): Promise<string | null>;
24
24
  /** Saves value to storage */
25
25
  save(key: string, value: StorageValue): Promise<void>;
26
26
  /**
@@ -9,12 +9,12 @@ export default abstract class StorageProvider {
9
9
  /** Checks if provider is available */
10
10
  static isAvailable<T extends Provider>(resolver: () => T): Promise<{
11
11
  result: boolean;
12
- error: Error | null;
12
+ error: Error;
13
13
  }>;
14
14
  /**
15
15
  * Loads value from storage
16
16
  */
17
- load<R = StorageValue>(key: string): Promise<R | null>;
17
+ load<R = StorageValue>(key: string): Promise<string | R>;
18
18
  /** Saves value to storage */
19
19
  save(key: string, value: StorageValue): Promise<void>;
20
20
  /**
@@ -1,15 +1,14 @@
1
1
  import { RawStackFrame } from './stacktrace-parser';
2
2
  import { REQUIRED_DATA_PROCESSING_URLS } from '../constants';
3
- import { JSErrorOutputMessage } from '../../types/PageVisit.types';
3
+ import { JSErrorOutputMessage } from '../../types/PageVisitErrors.types';
4
4
  /**
5
5
  * returns a string that satisfies a max length
6
6
  * stringToVerify: string that needs to be verified
7
7
  * length :optional, max length that stringToVerify can be
8
8
  */
9
- export declare function getMaxSubstringAllowed(stringToVerify: string, length?: 1024): string;
9
+ export declare function getMaxSubstringAllowed(stringToVerify: string, length?: number): string;
10
10
  /**
11
11
  * Processes the raw stack frames and creates a readable stack in a safe manner
12
- * @param {StackFrame[]} rawFrames
13
12
  */
14
13
  export declare function processFrames(rawFrames: RawStackFrame[]): {
15
14
  file: string;
@@ -28,7 +27,7 @@ export declare function getJSStack(errObj: {
28
27
  /**
29
28
  * Checks if possiblyStacktrace has any stack frames present
30
29
  */
31
- export declare function isStackTrace(_possiblyStacktrace: string): boolean;
30
+ export declare function isStackTrace(_possiblyStacktrace: unknown): _possiblyStacktrace is string;
32
31
  /**
33
32
  * counts the number of bytes
34
33
  */
@@ -80,7 +79,7 @@ export declare function maskTextInput(text: string): string;
80
79
  * It's safer than `instanceof` operator as it handles cases
81
80
  * where type is not actually a type but an object.
82
81
  */
83
- export declare function isInstanceOf(instance: unknown, type: unknown): boolean;
82
+ export declare function isInstanceOf<T>(instance: unknown, type: T): instance is T;
84
83
  /**
85
84
  * To grab the video recorder type based on the device we run the app on.
86
85
  */
@@ -1,5 +1,4 @@
1
1
  /** @module Object */
2
- type Func = (...args: any[]) => any;
3
2
  /**
4
3
  * Replaces an attribute value found in an object with another value
5
4
  * sourceObject: source object whose attribute will get replaced
@@ -10,14 +9,14 @@ type Func = (...args: any[]) => any;
10
9
  * @param {} attributeName
11
10
  * @param {} processingFunction
12
11
  */
13
- export declare const replace: <A extends { [k in K]: Func; }, K extends keyof A>(sourceObject: A, attributeName: K, processingFunction: (arg: A[K]) => A[K]) => void;
12
+ export declare const replace: <A extends { [k in K]: Function; }, K extends keyof A>(sourceObject: A, attributeName: K, processingFunction: (arg: A[K]) => A[K]) => void;
14
13
  /**
15
14
  * unwraps wrapped property, so we can use it without side effects
16
15
  * @param anything
17
16
  */
18
17
  export declare function unwrapNoibuWrapped<T>(anything: {
19
18
  __noibu_original__?: T;
20
- } & T): NonNullable<T>;
19
+ } & T): T;
21
20
  /**
22
21
  * Checks whether the prototype's property is writeable. If it is not,
23
22
  * checks whether the property can be made writeable. If it can, it is
@@ -36,11 +35,10 @@ export declare const propWriteableOrMadeWriteable: <T>(proto: T, property: keyof
36
35
  export declare const iterateObjectRecursively: (instance: Record<any, any>, visit: (i: typeof instance, p: keyof typeof i, v: (typeof i)[typeof p]) => typeof v, limit?: {
37
36
  depth: number;
38
37
  }) => void;
39
- export declare const safeEntries: (obj: unknown | Record<string, string | null> | Headers) => [string, string | null][];
38
+ export declare const safeEntries: (obj: unknown | Record<string, string | null> | Headers) => [string, string][];
40
39
  /**
41
40
  * Replaces the behaviour of Object.fromEntries() as it is not supported on all browsers
42
41
  * @param {Iterable} entries The iterable to parse into an object
43
42
  * @returns An object containing the same key/values as the iterable passed
44
43
  */
45
44
  export declare const safeFromEntries: <T>(entries: unknown) => Record<string, T>;
46
- export {};
@@ -1,7 +1,4 @@
1
1
  /**
2
2
  * In case Promise.all is not available, use this polyfill
3
3
  */
4
- export declare const promiseAll: {
5
- <T>(values: Iterable<T | PromiseLike<T>>): Promise<Awaited<T>[]>;
6
- <T extends readonly unknown[] | []>(values: T): Promise<{ -readonly [P in keyof T]: Awaited<T[P]>; }>;
7
- };
4
+ export declare const promiseAll: any;