noibu-react-native 0.2.5 → 0.2.7

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 (98) hide show
  1. package/README.md +15 -15
  2. package/android/build.gradle +1 -1
  3. package/dist/api/{clientConfig.js → ClientConfig.js} +69 -52
  4. package/dist/api/{helpCode.js → HelpCode.js} +6 -13
  5. package/dist/api/InputManager.js +156 -0
  6. package/dist/api/{metroplexSocket.js → MetroplexSocket.js} +189 -178
  7. package/dist/api/StoredMetrics.js +158 -0
  8. package/dist/api/{storedPageVisit.js → StoredPageVisit.js} +61 -48
  9. package/dist/const_matchers.js +1 -5
  10. package/dist/constants.js +15 -390
  11. package/dist/entry/index.js +3 -4
  12. package/dist/entry/init.js +33 -19
  13. package/dist/monitors/AppNavigationMonitor.js +19 -19
  14. package/dist/monitors/BaseMonitor.js +9 -4
  15. package/dist/monitors/ClickMonitor.js +72 -76
  16. package/dist/monitors/ErrorMonitor.js +45 -55
  17. package/dist/monitors/KeyboardInputMonitor.js +13 -11
  18. package/dist/monitors/PageMonitor.js +25 -2
  19. package/dist/monitors/RequestMonitor.js +46 -57
  20. package/dist/monitors/http-tools/GqlErrorValidator.js +39 -69
  21. package/dist/monitors/http-tools/HTTPDataBundler.js +71 -66
  22. package/dist/monitors/integrations/{react-native-navigation-integration.js → ReactNativeNavigationIntegration.js} +15 -12
  23. package/dist/pageVisit/EventDebouncer.js +43 -74
  24. package/dist/pageVisit/HttpEventManager.js +88 -0
  25. package/dist/pageVisit/PageVisitManager.js +99 -0
  26. package/dist/pageVisit/pageVisitEventError.js +170 -280
  27. package/dist/react/ErrorBoundary.js +3 -6
  28. package/dist/sessionRecorder/{sessionRecorder.js → SessionRecorder.js} +58 -70
  29. package/dist/sessionRecorder/nativeSessionRecorderSubscription.js +3 -5
  30. package/dist/storage/{rnStorageProvider.js → RNStorageProvider.js} +3 -7
  31. package/dist/storage/{storage.js → Storage.js} +17 -30
  32. package/dist/storage/{storageProvider.js → StorageProvider.js} +7 -8
  33. package/dist/utils/date.js +39 -50
  34. package/dist/utils/eventlistener.js +5 -12
  35. package/dist/utils/function.js +42 -113
  36. package/dist/utils/log.js +5 -5
  37. package/dist/utils/object.js +12 -12
  38. package/dist/utils/piiRedactor.js +31 -3
  39. package/dist/utils/stacktrace-parser.js +29 -21
  40. package/package.json +14 -14
  41. package/dist/api/inputManager.js +0 -227
  42. package/dist/api/storedMetrics.js +0 -198
  43. package/dist/pageVisit/pageVisit.js +0 -181
  44. package/dist/pageVisit/pageVisitEventHTTP.js +0 -98
  45. package/dist/pageVisit/userStep.js +0 -20
  46. package/dist/src/api/clientConfig.d.ts +0 -100
  47. package/dist/src/api/clientConfig.test.d.ts +0 -1
  48. package/dist/src/api/helpCode.d.ts +0 -23
  49. package/dist/src/api/inputManager.d.ts +0 -87
  50. package/dist/src/api/metroplexSocket.d.ts +0 -137
  51. package/dist/src/api/storedMetrics.d.ts +0 -73
  52. package/dist/src/api/storedPageVisit.d.ts +0 -40
  53. package/dist/src/const_matchers.d.ts +0 -1
  54. package/dist/src/constants.d.ts +0 -290
  55. package/dist/src/entry/index.d.ts +0 -14
  56. package/dist/src/entry/init.d.ts +0 -5
  57. package/dist/src/monitors/AppNavigationMonitor.d.ts +0 -18
  58. package/dist/src/monitors/BaseMonitor.d.ts +0 -13
  59. package/dist/src/monitors/BaseMonitor.test.d.ts +0 -1
  60. package/dist/src/monitors/ClickMonitor.d.ts +0 -31
  61. package/dist/src/monitors/ErrorMonitor.d.ts +0 -63
  62. package/dist/src/monitors/KeyboardInputMonitor.d.ts +0 -20
  63. package/dist/src/monitors/PageMonitor.d.ts +0 -20
  64. package/dist/src/monitors/RequestMonitor.d.ts +0 -94
  65. package/dist/src/monitors/http-tools/GqlErrorValidator.d.ts +0 -59
  66. package/dist/src/monitors/http-tools/HTTPDataBundler.d.ts +0 -112
  67. package/dist/src/monitors/integrations/react-native-navigation-integration.d.ts +0 -20
  68. package/dist/src/pageVisit/EventDebouncer.d.ts +0 -24
  69. package/dist/src/pageVisit/pageVisit.d.ts +0 -52
  70. package/dist/src/pageVisit/pageVisitEventError.d.ts +0 -15
  71. package/dist/src/pageVisit/pageVisitEventHTTP.d.ts +0 -25
  72. package/dist/src/pageVisit/userStep.d.ts +0 -5
  73. package/dist/src/react/ErrorBoundary.d.ts +0 -72
  74. package/dist/src/sessionRecorder/nativeSessionRecorderSubscription.d.ts +0 -79
  75. package/dist/src/sessionRecorder/sessionRecorder.d.ts +0 -60
  76. package/dist/src/sessionRecorder/types.d.ts +0 -91
  77. package/dist/src/storage/rnStorageProvider.d.ts +0 -23
  78. package/dist/src/storage/storage.d.ts +0 -39
  79. package/dist/src/storage/storageProvider.d.ts +0 -26
  80. package/dist/src/utils/date.d.ts +0 -6
  81. package/dist/src/utils/eventlistener.d.ts +0 -8
  82. package/dist/src/utils/function.d.ts +0 -102
  83. package/dist/src/utils/log.d.ts +0 -4
  84. package/dist/src/utils/object.d.ts +0 -44
  85. package/dist/src/utils/performance.d.ts +0 -6
  86. package/dist/src/utils/piiRedactor.d.ts +0 -11
  87. package/dist/src/utils/polyfills.d.ts +0 -4
  88. package/dist/src/utils/stacktrace-parser.d.ts +0 -7
  89. package/dist/types/Config.d.ts +0 -31
  90. package/dist/types/Metroplex.types.d.ts +0 -73
  91. package/dist/types/NavigationIntegration.d.ts +0 -6
  92. package/dist/types/PageVisit.types.d.ts +0 -8
  93. package/dist/types/PageVisitErrors.types.d.ts +0 -114
  94. package/dist/types/PageVisitEvents.types.d.ts +0 -91
  95. package/dist/types/PageVisitMetrics.types.d.ts +0 -27
  96. package/dist/types/Storage.d.ts +0 -14
  97. package/dist/types/StoredPageVisit.types.d.ts +0 -11
  98. package/dist/types/WrappedObjects.d.ts +0 -6
@@ -1,112 +0,0 @@
1
- import { WrappedXMLHttpRequest } from '../../../types/WrappedObjects';
2
- import { HTTPDataBundle } from '../../../types/PageVisitEvents.types';
3
- import { Singleton } from '../BaseMonitor';
4
- /** Bundles HTTP payloads and headers */
5
- export declare class HTTPDataBundler extends Singleton {
6
- contentTypeReadableRegex: RegExp;
7
- hostname: string;
8
- initialURLPartsReversed: string[];
9
- httpDataCollectionEnabled: boolean;
10
- httpDataAllowedRelativeRegex: RegExp | null;
11
- httpDataAllowedAbsoluteRegex: RegExp | null;
12
- /**
13
- * Creates an instance of the ClickMonitor instance
14
- */
15
- constructor();
16
- /**
17
- * Builds the HTTP payload allowed regexes for full and relative URLs
18
- * @param allowedURLs A list of allowed URLs
19
- * @param absolute Use only absolute URLs if true, use only relative URL if false
20
- * @returns a regex of allowed URLs
21
- */
22
- private static buildAllowedRegex;
23
- /**
24
- * Takes an iterator and returns a map of strings representing headers.
25
- * param {object} headersIterable any iterable object
26
- * returns a map of strings (as expected by metroplex) representing HTTP
27
- * request or response headers
28
- */
29
- static headersMapFromIterable(headersIterable: Iterable<any[]>): Map<any, any>;
30
- /**
31
- * Takes a string of headers with 'name: value' and returns
32
- * a map of strings representing headers.
33
- * headersString is all the headers in one string
34
- * returns a map of strings (as expected by metroplex) representing HTTP
35
- * request or response headers
36
- */
37
- static headersMapFromString(headersString: unknown): Map<string, string>;
38
- /**
39
- * For an XHR object, checks the responseType property and handles the response or
40
- * responseText property accordingly to return a string representation of the response.
41
- * @returns a string representation of the response, or null if this fails.
42
- */
43
- static getResponseStringFromXHR(xhr: WrappedXMLHttpRequest): Promise<any>;
44
- /**
45
- * Builds an HTTP Data bundle
46
- */
47
- bundleHTTPData(url: string, requestHeaders: Map<string, string> | undefined, rawRequestPayload: any, responseHeaders: Map<string, string>, rawResponsePayload: any, method: string, isError: boolean): HTTPDataBundle | null;
48
- /**
49
- * Validates a request based on the URL and method. When enabled, will handle
50
- * de-duping the requests
51
- */
52
- isValidRequest(method: unknown): boolean;
53
- /**
54
- * Checks two things: that the URL is either on the same domain (or an address relative to the
55
- * current domain), and also checks that the config http_data_collection flag is enabled.
56
- * @param {string} url
57
- * @returns boolean indicating whether the URL passed is either relative (in which case it is
58
- * inherently on the current domain) or matches the current domain.
59
- */
60
- shouldContinueForURL(url: any): boolean;
61
- /**
62
- * Determines if the URL is absolute or relative
63
- * returns boolean indicating whether the URL passed is either absolute or relative
64
- */
65
- static isAbsoluteURL(url: unknown): boolean;
66
- /**
67
- * Checks whether HTTP payloads can be collected on this URL
68
- * returns boolean indicating whether HTTP payloads can be collected on this URL
69
- */
70
- shouldCollectPayloadForURL(url: any): boolean;
71
- /**
72
- * Double checks content length if we couldn't read the headers, and redacts PII
73
- * returns the restricted payload
74
- */
75
- restrictPayload(payload: string, url: string, isError: boolean): string;
76
- /**
77
- * Returns true if the content-length header is of acceptable size.
78
- * Too big gets rejected
79
- * If the headers are not found, check actual content for length
80
- * @param {Headers} headers
81
- * @returns boolean true if acceptable to collect
82
- */
83
- contentLengthAcceptable(headers: Map<string, string>, isError: boolean): boolean;
84
- /**
85
- * Returns true if the content type according to the headers is valid for collection.
86
- * Also returns assumed true if content type is not stated in headers.
87
- * @param {Map} headersMap
88
- * @returns boolean true if acceptable to collect
89
- */
90
- private contentTypeAcceptable;
91
- /**
92
- * Returns a descriptive string if we have to drop payload based on the length
93
- * or type listed in the headers passed. Returns an empty string otherwise.
94
- */
95
- getReasonPayloadIsDropped(headers: any, isError: boolean): string;
96
- /**
97
- * Returns content length from the headers, if available.
98
- * If headers are not found or length is not a number, return -1
99
- */
100
- contentLength(headersObject: any): number;
101
- /**
102
- * Accepts a value that could be any type used as a request payload,
103
- * and returns a string representation, or null if this fails.
104
- */
105
- stringFromRequestBody(value: any, requestHeaders?: Map<string, string>): any;
106
- /**
107
- * Removes possible PII from headers.
108
- * @param {Map} dirtyHeaders a Map of HTTP response or request headers
109
- * @returns {Map|null} a map of headers with PII redacted
110
- */
111
- removePIIHeaders(dirtyHeaders: Map<string, string> | undefined): typeof dirtyHeaders | null;
112
- }
@@ -1,20 +0,0 @@
1
- import { NavigationIntegration } from '../../../types/NavigationIntegration';
2
- import { NavigationRoot } from 'react-native-navigation/lib/dist/src/Navigation';
3
- /**
4
- * react-native-navigation adapter
5
- */
6
- export declare class ReactNativeNavigationIntegration implements NavigationIntegration {
7
- private stack;
8
- private stackPointers;
9
- /**
10
- * attaches provided listeners to the integration
11
- */
12
- register(navigation: NavigationRoot, onNavigation: (breadcrumbs: string[]) => void): void;
13
- /**
14
- * Listens to ComponentWillAppear events, keeps track of visited screens and
15
- * pops them if the same page is visited to prevent cycles
16
- * @param onNavigation
17
- * @private
18
- */
19
- private getListener;
20
- }
@@ -1,24 +0,0 @@
1
- import { Singleton } from '../monitors/BaseMonitor';
2
- /**
3
- * Singleton class responsible for debouncing all events
4
- * that are registered
5
- */
6
- export declare class EventDebouncer extends Singleton {
7
- private readonly eventsToDebounce;
8
- /**
9
- * Creates an instance of EventDebouncer
10
- */
11
- constructor();
12
- /**
13
- * Creates an event object with the event and the time it was added then pushes
14
- * that event object to the queue of events waiting to be debounced.
15
- */
16
- addEvent(event: any, type: keyof typeof this.eventsToDebounce, occurredAt?: number): void;
17
- /**
18
- * Adds the events from the object to the page visit and sets up a timer
19
- * to send the events if no more are received without the timeout
20
- */
21
- _debouncePvEvents(type: string): void;
22
- /** Sets up the page hide handler to try to push remaining events in the queues */
23
- _setupUnloadHandler(): void;
24
- }
@@ -1,52 +0,0 @@
1
- /**
2
- * Singleton class to hold all the information
3
- * about the gathered errors throught the session
4
- */
5
- export class PageVisit {
6
- /**
7
- * creates a PV object
8
- */
9
- static configureInstance(): void;
10
- /** gets the singleton instance
11
- * @returns {PageVisit}
12
- */
13
- static getInstance(): PageVisit;
14
- /**
15
- * Creates a page visit frag from an events array and part counter. Appends
16
- * the end time field and returns the frag
17
- * @param {} pvEvents
18
- * @param {} partCounter
19
- */
20
- static makePageVisitFrag(pvEvents: any, partCounter: any): import("../../types/Metroplex.types").PageVisitFrag | import("../../types/Metroplex.types").VideoFrag;
21
- partCounter: number;
22
- pvMap: {};
23
- pvEventLength: number;
24
- visibilityChangedCounter: number;
25
- totalPvEventLength: number;
26
- inDebounceHandle: number;
27
- isInAcceleratedPvPostMode: boolean;
28
- /** adds page visit events into the current page visit map and then sends a page visit message
29
- * @param {} eventObjects
30
- * @param {} type
31
- */
32
- addPageVisitEvents(eventObjects: any, type: any): void;
33
- /**
34
- * adds the page visit event into the current page visit map and then sends a page visit message
35
- * returns the the key to access this event in the map
36
- * @param {} eventObj
37
- * @param {} type
38
- */
39
- addPageVisitEvent(eventObj: any, type: any): string | number[];
40
- /**
41
- * adds a new page visit event into the current page visit map and returns the
42
- * the key to access this event in the map
43
- * @param {} eventObj
44
- * @param {} type
45
- */
46
- _addPageVisitEvent(eventObj: any, type: any): string | number[];
47
- /**
48
- * _sendPageVisitMessage will reset the buffer and post the current
49
- * content to metroplex
50
- */
51
- _sendPageVisitMessage(): void;
52
- }
@@ -1,15 +0,0 @@
1
- /**
2
- * gets the onURL of a string, defaulting to the location of the webpage
3
- */
4
- export function getOnURL(realOnURL: any): string;
5
- /**
6
- * determines if an error is a collect error
7
- * @param {} pvError
8
- */
9
- export function isErrorCollectedByNoibu(pvError: any): boolean;
10
- /** Saves the error to the ErrorQueue
11
- * @param {} type
12
- * @param {} payload
13
- * @param {} [httpDataSeqNum]
14
- */
15
- export function saveErrorToPagevisit(type: any, payload: any, httpDataSeqNum?: any): void;
@@ -1,25 +0,0 @@
1
- import { HTTPDataBundle, PVEventHTTPPayload } from '../../types/PageVisitEvents.types';
2
- /**
3
- * Determines if a response is a failure
4
- */
5
- export declare function isHttpCodeFailure(code: unknown): boolean;
6
- /** Class representing a PageVisitEventHTTP */
7
- export declare class PageVisitEventHTTP {
8
- httpEvent: PVEventHTTPPayload;
9
- httpData: HTTPDataBundle | null;
10
- isGqlError: boolean;
11
- /**
12
- * Creates an instance of the http event for the pv
13
- */
14
- constructor(httpEvent: Partial<PVEventHTTPPayload>, httpData: HTTPDataBundle | null, isGqlError?: boolean);
15
- /** Saves the HTTP event to the pageVisit Queue */
16
- saveHTTPEvent(): void;
17
- /**
18
- * Checks if sending data is allowed based on the HTTP status code and count.
19
- * status - The HTTP status code to evaluate.
20
- * count - The count of events to consider.
21
- * isGqlError - Whether the context is considered as a GQL error.
22
- * Returns `true` if sending data is allowed, `false` otherwise.
23
- */
24
- static isSendAllowed(status: number, count: number, isGqlError?: boolean): boolean;
25
- }
@@ -1,5 +0,0 @@
1
- /**
2
- * updates the payload of a user step in order to stringify the css class
3
- * @param {} payload
4
- */
5
- export function updatePayload(payload: any): any;
@@ -1,72 +0,0 @@
1
- import * as React from 'react';
2
- export declare const UNKNOWN_COMPONENT = "unknown";
3
- export type FallbackRender = (errorData: {
4
- error: Error;
5
- componentStack: string | null;
6
- eventId: string | null;
7
- resetError(): void;
8
- }) => React.ReactElement;
9
- export type ErrorBoundaryProps = {
10
- children?: React.ReactNode | (() => React.ReactNode);
11
- /**
12
- * A fallback component that gets rendered when the error boundary encounters an error.
13
- *
14
- * Can either provide a React Component, or a function that returns React Component as
15
- * a valid fallback prop. If a function is provided, the function will be called with
16
- * the error, the component stack, and a function that resets the error boundary on error.
17
- *
18
- */
19
- fallback?: React.ReactElement | FallbackRender;
20
- /** Called when the error boundary encounters an error */
21
- onError?(error: Error, componentStack: string, eventId: string): void;
22
- /** Called on componentDidMount() */
23
- onMount?(): void;
24
- /** Called if resetError() is called from the fallback render props function */
25
- onReset?(error: Error | null, componentStack: string | null, eventId: string | null): void;
26
- /** Called on componentWillUnmount() */
27
- onUnmount?(error: Error | null, componentStack: string | null, eventId: string | null): void;
28
- };
29
- export type ErrorBoundaryState = {
30
- componentStack: React.ErrorInfo['componentStack'] | null;
31
- error: Error | null;
32
- eventId: string | null;
33
- };
34
- /**
35
- * @description A ErrorBoundary component that logs errors to Noibu. Requires React >= 16.
36
- * @extends {Component<ErrorBoundaryProps, ErrorBoundaryState>}
37
- */
38
- declare class ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoundaryState> {
39
- state: ErrorBoundaryState;
40
- /**
41
- * Lifecycle hook on mount
42
- * @returns void
43
- */
44
- componentDidMount(): void;
45
- /**
46
- *
47
- * Handler for all errors that happen in a wrapped component
48
- * @param {Error&{cause?:Error}} error
49
- * @param {React.ErrorInfo} {componentStack}
50
- * @returns void
51
- */
52
- componentDidCatch(error: Error & {
53
- cause?: Error;
54
- }, { componentStack }: React.ErrorInfo): void;
55
- /**
56
- * * Lifecycle hook on unmount
57
- * @returns void
58
- */
59
- componentWillUnmount(): void;
60
- /**
61
- * Callback from fallback to reset the error boundary
62
- * @param {} =>void=(
63
- */
64
- resetErrorBoundary: () => void;
65
- /**
66
- *
67
- * Renders the fallback ui
68
- * @returns {React.ReactNode}
69
- */
70
- render(): React.ReactNode;
71
- }
72
- export { ErrorBoundary };
@@ -1,79 +0,0 @@
1
- /**
2
- * The level of logging to show in the device logcat stream.
3
- */
4
- export declare enum LogLevel {
5
- Verbose = "Verbose",
6
- Debug = "Debug",
7
- Info = "Info",
8
- Warning = "Warning",
9
- Error = "Error",
10
- None = "None"
11
- }
12
- /**
13
- * The configuration that will be used to customize the session recording behaviour.
14
- *
15
- * @param userId [OPTIONAL default = null] A custom identifier for the current user. If passed as null, the user id
16
- * will be auto generated. The user id in general is sticky across sessions.
17
- * The provided user id must follow these conditions:
18
- * 1. Cannot be an empty string.
19
- * 2. Should be base36 and smaller than "1Z141Z4".
20
- * @param logLevel [OPTIONAL default = LogLevel.None] The level of logging to show in the device logcat stream.
21
- * @param allowMeteredNetworkUsage [OPTIONAL default = false] Allows uploading session data to the servers on device metered network.
22
- * @param enableWebViewCapture [OPTIONAL default = true] Allows Noibu - Session recorder to capture the web views DOM content.
23
- * @param allowedDomains [OPTIONAL default = ["*"]] The whitelisted domains to allow Noibu - Session recorder to capture their DOM content.
24
- * If it contains "*" as an element, all domains will be captured.
25
- * @param disableOnLowEndDevices [OPTIONAL default = false] Disable Noibu - Session recorder on low-end devices.
26
- * @param maximumDailyNetworkUsageInMB [OPTIONAL default = null] Maximum daily network usage for Noibu - Session recorder (null = No limit). When the limit is reached, Noibu - Session recorder will turn on lean mode.
27
- */
28
- export interface SessionRecorderConfig {
29
- userId?: string | null;
30
- logLevel?: LogLevel;
31
- allowMeteredNetworkUsage?: boolean;
32
- enableWebViewCapture?: boolean;
33
- allowedDomains?: string[];
34
- disableOnLowEndDevices?: boolean;
35
- maximumDailyNetworkUsageInMB?: number;
36
- }
37
- /**
38
- * Initializes the Noibu - Session recording SDK if the API level is supported.
39
- * param projectId [REQUIRED] The session recording project id to send data to.
40
- * param config [OPTIONAL] The sessionreplay config, if not provided default values are used.
41
- */
42
- export declare function initialize(projectId: string, config?: SessionRecorderConfig): void;
43
- /**
44
- * Sets a custom user id that can be used to identify the user. It has less
45
- * restrictions than the userId parameter. You can pass any string and
46
- * you can filter on it on the dashboard side. If you need the most efficient
47
- * filtering on the dashboard, use the userId parameter if possible.
48
- * <p>
49
- * Note: custom user id cannot be null or empty, or consists only of whitespaces.
50
- * </p>
51
- * @param customUserId The custom user id to set.
52
- */
53
- export declare function setCustomUserId(customUserId: string): void;
54
- /**
55
- * Sets a custom session id that can be used to identify the session.
56
- * <p>
57
- * Note: custom session id cannot be null or empty, or consists only of whitespaces.
58
- * </p>
59
- * @param customSessionId The custom session id to set.
60
- */
61
- export declare function setCustomSessionId(customSessionId: string): void;
62
- export type RecorderEvent = import('./types').RecorderEvent;
63
- export type UnsubscribeFn = import('./types').UnsubscribeFn;
64
- /**
65
- * Subscribes to a native event emitted by the Noibu Session Recorder.
66
- *
67
- * This function listens for the `noibuRecordingEvent` emitted from the native layer (only on Android)
68
- * and invokes the provided callback whenever the event occurs. If the platform is not Android,
69
- * the function will do nothing and return a no-op unsubscribe function.
70
- *
71
- * @param {function(RecorderEvent): void} callback - A callback function that will be invoked with
72
- * the event data whenever the `noibuRecordingEvent` is emitted.
73
- *
74
- * @returns {UnsubscribeFn} A function to unsubscribe from the event. On Android, this will remove
75
- * the event listener. On other platforms, it will be a no-op.
76
- *
77
- * @throws {Error} If the Noibu Session Recorder is not initialized before calling this function.
78
- */
79
- export declare function subscribeToNativeEvent(callback: (event: RecorderEvent) => void): UnsubscribeFn;
@@ -1,60 +0,0 @@
1
- import { RecorderEvent } from './nativeSessionRecorderSubscription';
2
- /** Singleton class to record user sessions */
3
- export default class SessionRecorder {
4
- private static instance;
5
- private eventBuffer;
6
- private vfCounter;
7
- private didSetupRecorder;
8
- private isVideoLengthNegativeInvalid;
9
- private lastFragPostTimestamp;
10
- private pauseTimeout;
11
- private lastRecordedTimestamp;
12
- private firstRecordedTimestamp;
13
- private recordStopper;
14
- private freezingEvents;
15
- /**
16
- * Creates an instance of the session recorder
17
- */
18
- constructor();
19
- /**
20
- * Setups the SessionRecorder instance for usage
21
- */
22
- static getInstance(): SessionRecorder;
23
- /** Sets up the page hide handler to try to push remaining video events */
24
- setupUnloadHandler(): void;
25
- /** Sets up the post metrics handler to potentially log a debug message */
26
- setupPostMetricsHandler(): void;
27
- /**
28
- * Starts recording the user session
29
- */
30
- recordUserSession(): Promise<void>;
31
- /**
32
- * handleNewRRwebEvent will process each upcoming.
33
- * rrweb event. It will make sure that the current buffer
34
- * is updated with the latest events and post the contents
35
- * of the buffer if it exceeds max size
36
- */
37
- handleRecorderEvent(recorderEvent: RecorderEvent): Promise<void>;
38
- /**
39
- * Compress event
40
- */
41
- private pack;
42
- private static compress;
43
- /** builds a log message with debug info
44
- */
45
- buildDebugMessage(eventName: string, totalVideoTime: number, sessionLength: number): string;
46
- /**
47
- * handleFragPost communicates with the Metroplex socket
48
- * to post video fragments when needed. It also handles
49
- * necessary management of the buffer and it's related
50
- * variables
51
- */
52
- handleFragPost(): Promise<void>;
53
- /**
54
- * unfreeze forcefully resumes recording events in case it was frozen
55
- * waiting for user events
56
- */
57
- unfreeze(): Promise<void>;
58
- /** stops recording */
59
- private freeze;
60
- }
@@ -1,91 +0,0 @@
1
- type Color = {
2
- a: number;
3
- b: number;
4
- r: number;
5
- g: number;
6
- };
7
- type Paint = {
8
- strokeJoin: number;
9
- strokeWidth: number;
10
- strokeCap: number;
11
- color: Color;
12
- dither: boolean;
13
- blendMode: number;
14
- style: number;
15
- antiAlias: boolean;
16
- strokeMiter: number;
17
- };
18
- type Rect = {
19
- top: number;
20
- left: number;
21
- bottom: number;
22
- right: number;
23
- };
24
- type Command = {
25
- name?: string;
26
- id?: number;
27
- type: string;
28
- isClipRectSource?: boolean;
29
- rect?: Rect;
30
- paintIndex?: number;
31
- op?: number;
32
- antiAlias?: boolean;
33
- matrix?: number[];
34
- };
35
- type ViewNode = {
36
- viewX: number;
37
- visible: boolean;
38
- processedText$delegate: {
39
- _value: any;
40
- initializer: any;
41
- };
42
- viewY: number;
43
- viewWidth: number;
44
- clickable: boolean;
45
- viewHeight: number;
46
- isMasked: boolean;
47
- type: string;
48
- renderNodeId: number;
49
- isWebView: boolean;
50
- ignoreClicks: boolean;
51
- children: ViewNode[];
52
- width: number;
53
- x: number;
54
- y: number;
55
- id: number;
56
- text: string;
57
- height: number;
58
- backgroundColor?: number;
59
- };
60
- type ViewHierarchy = {
61
- root: ViewNode;
62
- visibleFragments: any[];
63
- timestamp: number;
64
- };
65
- type SubPicture = {
66
- subPictures: any[];
67
- images: any[];
68
- screenWidth: number;
69
- textBlobs: any[];
70
- density: number;
71
- vertices: any[];
72
- screenHeight: number;
73
- activityName: string;
74
- paints: Paint[];
75
- typefaces: any[];
76
- viewHierarchy: ViewHierarchy;
77
- paths: any[];
78
- activityHashCode: number;
79
- commands: Command[];
80
- timestamp: number;
81
- };
82
- export type RecorderEvent = {
83
- message: NativeFrames;
84
- };
85
- export type NativeFrames = {
86
- p: (number | boolean | SubPicture)[][];
87
- a: (number[] | (number | string | string[])[])[];
88
- e: (string | number)[];
89
- };
90
- export type UnsubscribeFn = () => void;
91
- export {};
@@ -1,23 +0,0 @@
1
- import StorageProvider from './storageProvider';
2
- /**
3
- * React native storage provider implementation
4
- */
5
- export default class RNStorageProvider extends StorageProvider {
6
- /**
7
- * Creates new instance
8
- */
9
- constructor();
10
- /**
11
- * Checks if storage is available
12
- * @returns {Object}
13
- */
14
- static isAvailable(): Promise<{
15
- result: boolean;
16
- error: Error;
17
- }>;
18
- /**
19
- * Calculates used scape
20
- * @returns {Number}
21
- */
22
- calculateUsedSize(): Promise<number>;
23
- }
@@ -1,39 +0,0 @@
1
- import { IStorage, StorageValue } from '../../types/Storage';
2
- /**
3
- * Encapsulates storage api
4
- */
5
- export default class Storage implements IStorage {
6
- private readonly _isRNStorageAvailable;
7
- private readonly _rnStorageError;
8
- private static _instance;
9
- private readonly _provider;
10
- private readonly _type;
11
- /**
12
- * Creates new instance assessing available options
13
- */
14
- constructor();
15
- /**
16
- * Singleton
17
- * @returns {Storage}
18
- */
19
- static getInstance(): Storage;
20
- /** Checks if storage is available */
21
- isAvailable(): Promise<boolean>;
22
- /** Loads value from storage */
23
- load(key: string): Promise<string | null>;
24
- /** Saves value to storage */
25
- save(key: string, value: StorageValue): Promise<void>;
26
- /**
27
- * Removes value from storage
28
- * @param {String} key
29
- */
30
- remove(key: string): Promise<void>;
31
- /** Calculates used scape */
32
- calculateUsedSize(): Promise<number>;
33
- /**
34
- * Returns string indicating current provider type
35
- * and availability for other storage types
36
- * @returns {String}
37
- */
38
- getDiagnoseInfo(): Promise<string>;
39
- }
@@ -1,26 +0,0 @@
1
- import { Provider, StorageValue } from '../../types/Storage';
2
- /**
3
- * Base implementation for LocalStorage and SessionStorage
4
- */
5
- export default abstract class StorageProvider {
6
- _provider: Provider;
7
- /** Creates new instance based on provided provider type */
8
- constructor(provider: Provider);
9
- /** Checks if provider is available */
10
- static isAvailable<T extends Provider>(resolver: () => T): Promise<{
11
- result: boolean;
12
- error: Error;
13
- }>;
14
- /**
15
- * Loads value from storage
16
- */
17
- load<R = StorageValue>(key: string): Promise<string | R>;
18
- /** Saves value to storage */
19
- save(key: string, value: StorageValue): Promise<void>;
20
- /**
21
- * Removes value from storage
22
- * @param {String} key
23
- */
24
- remove(key: string): Promise<void>;
25
- abstract calculateUsedSize(): Promise<number>;
26
- }
@@ -1,6 +0,0 @@
1
- /** Checks to see if the necessary Date functions that we use have been overwritten */
2
- export function isDateOverwritten(): boolean;
3
- /** Timestamp wrapper to properly handle timestamps
4
- * @param {} timestamp
5
- */
6
- export function timestampWrapper(timestamp: any): any;
@@ -1,8 +0,0 @@
1
- /** addSafeEventListener will add an event listener for the specified event
2
- * but will catch and log any errors encountered
3
- * @param {} object to attach the listener to
4
- * @param {} event to listen to
5
- * @param {} callback function to call
6
- * @param {} [capture] additional arguments
7
- */
8
- export function addSafeEventListener(object: any, event: any, callback: any, capture?: any): void;