noibu-react-native 0.2.6 → 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.
- package/README.md +15 -15
- package/dist/api/{clientConfig.js → ClientConfig.js} +69 -52
- package/dist/api/{helpCode.js → HelpCode.js} +6 -13
- package/dist/api/InputManager.js +156 -0
- package/dist/api/{metroplexSocket.js → MetroplexSocket.js} +189 -178
- package/dist/api/StoredMetrics.js +158 -0
- package/dist/api/{storedPageVisit.js → StoredPageVisit.js} +61 -48
- package/dist/const_matchers.js +1 -5
- package/dist/constants.js +15 -390
- package/dist/entry/index.js +3 -4
- package/dist/entry/init.js +33 -19
- package/dist/monitors/AppNavigationMonitor.js +19 -19
- package/dist/monitors/BaseMonitor.js +9 -4
- package/dist/monitors/ClickMonitor.js +72 -76
- package/dist/monitors/ErrorMonitor.js +45 -55
- package/dist/monitors/KeyboardInputMonitor.js +13 -11
- package/dist/monitors/PageMonitor.js +25 -2
- package/dist/monitors/RequestMonitor.js +46 -57
- package/dist/monitors/http-tools/GqlErrorValidator.js +39 -69
- package/dist/monitors/http-tools/HTTPDataBundler.js +71 -66
- package/dist/monitors/integrations/{react-native-navigation-integration.js → ReactNativeNavigationIntegration.js} +15 -12
- package/dist/pageVisit/EventDebouncer.js +43 -74
- package/dist/pageVisit/HttpEventManager.js +88 -0
- package/dist/pageVisit/PageVisitManager.js +99 -0
- package/dist/pageVisit/pageVisitEventError.js +170 -280
- package/dist/react/ErrorBoundary.js +3 -6
- package/dist/sessionRecorder/{sessionRecorder.js → SessionRecorder.js} +58 -70
- package/dist/sessionRecorder/nativeSessionRecorderSubscription.js +3 -5
- package/dist/storage/{rnStorageProvider.js → RNStorageProvider.js} +3 -7
- package/dist/storage/{storage.js → Storage.js} +17 -30
- package/dist/storage/{storageProvider.js → StorageProvider.js} +7 -8
- package/dist/utils/date.js +39 -50
- package/dist/utils/eventlistener.js +5 -12
- package/dist/utils/function.js +42 -113
- package/dist/utils/log.js +5 -5
- package/dist/utils/object.js +12 -12
- package/dist/utils/piiRedactor.js +31 -3
- package/dist/utils/stacktrace-parser.js +29 -21
- package/package.json +14 -14
- package/dist/api/inputManager.js +0 -227
- package/dist/api/storedMetrics.js +0 -198
- package/dist/pageVisit/pageVisit.js +0 -181
- package/dist/pageVisit/pageVisitEventHTTP.js +0 -98
- package/dist/pageVisit/userStep.js +0 -20
- package/dist/src/api/clientConfig.d.ts +0 -100
- package/dist/src/api/clientConfig.test.d.ts +0 -1
- package/dist/src/api/helpCode.d.ts +0 -23
- package/dist/src/api/inputManager.d.ts +0 -87
- package/dist/src/api/metroplexSocket.d.ts +0 -137
- package/dist/src/api/storedMetrics.d.ts +0 -73
- package/dist/src/api/storedPageVisit.d.ts +0 -40
- package/dist/src/const_matchers.d.ts +0 -1
- package/dist/src/constants.d.ts +0 -290
- package/dist/src/entry/index.d.ts +0 -14
- package/dist/src/entry/init.d.ts +0 -5
- package/dist/src/monitors/AppNavigationMonitor.d.ts +0 -18
- package/dist/src/monitors/BaseMonitor.d.ts +0 -13
- package/dist/src/monitors/BaseMonitor.test.d.ts +0 -1
- package/dist/src/monitors/ClickMonitor.d.ts +0 -31
- package/dist/src/monitors/ErrorMonitor.d.ts +0 -63
- package/dist/src/monitors/KeyboardInputMonitor.d.ts +0 -20
- package/dist/src/monitors/PageMonitor.d.ts +0 -20
- package/dist/src/monitors/RequestMonitor.d.ts +0 -94
- package/dist/src/monitors/http-tools/GqlErrorValidator.d.ts +0 -59
- package/dist/src/monitors/http-tools/HTTPDataBundler.d.ts +0 -112
- package/dist/src/monitors/integrations/react-native-navigation-integration.d.ts +0 -20
- package/dist/src/pageVisit/EventDebouncer.d.ts +0 -24
- package/dist/src/pageVisit/pageVisit.d.ts +0 -52
- package/dist/src/pageVisit/pageVisitEventError.d.ts +0 -15
- package/dist/src/pageVisit/pageVisitEventHTTP.d.ts +0 -25
- package/dist/src/pageVisit/userStep.d.ts +0 -5
- package/dist/src/react/ErrorBoundary.d.ts +0 -72
- package/dist/src/sessionRecorder/nativeSessionRecorderSubscription.d.ts +0 -79
- package/dist/src/sessionRecorder/sessionRecorder.d.ts +0 -60
- package/dist/src/sessionRecorder/types.d.ts +0 -91
- package/dist/src/storage/rnStorageProvider.d.ts +0 -23
- package/dist/src/storage/storage.d.ts +0 -39
- package/dist/src/storage/storageProvider.d.ts +0 -26
- package/dist/src/utils/date.d.ts +0 -6
- package/dist/src/utils/eventlistener.d.ts +0 -8
- package/dist/src/utils/function.d.ts +0 -102
- package/dist/src/utils/log.d.ts +0 -4
- package/dist/src/utils/object.d.ts +0 -44
- package/dist/src/utils/performance.d.ts +0 -6
- package/dist/src/utils/piiRedactor.d.ts +0 -11
- package/dist/src/utils/polyfills.d.ts +0 -4
- package/dist/src/utils/stacktrace-parser.d.ts +0 -7
- package/dist/types/Config.d.ts +0 -31
- package/dist/types/Metroplex.types.d.ts +0 -73
- package/dist/types/NavigationIntegration.d.ts +0 -6
- package/dist/types/PageVisit.types.d.ts +0 -8
- package/dist/types/PageVisitErrors.types.d.ts +0 -114
- package/dist/types/PageVisitEvents.types.d.ts +0 -91
- package/dist/types/PageVisitMetrics.types.d.ts +0 -27
- package/dist/types/Storage.d.ts +0 -14
- package/dist/types/StoredPageVisit.types.d.ts +0 -11
- package/dist/types/WrappedObjects.d.ts +0 -6
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { asString } from '../utils/function.js';
|
|
2
|
-
import { CSS_CLASS_ATT_NAME } from '../constants.js';
|
|
3
|
-
|
|
4
|
-
/** @module UserStep */
|
|
5
|
-
/**
|
|
6
|
-
* updates the payload of a user step in order to stringify the css class
|
|
7
|
-
* @param {} payload
|
|
8
|
-
*/
|
|
9
|
-
function updatePayload(payload) {
|
|
10
|
-
// In certain cases the class returned by the attribute will be an
|
|
11
|
-
// object. This will break the metroplex validation and thus needs to be
|
|
12
|
-
// stringified
|
|
13
|
-
const updatedPayload = payload;
|
|
14
|
-
updatedPayload[CSS_CLASS_ATT_NAME] = asString(
|
|
15
|
-
updatedPayload[CSS_CLASS_ATT_NAME],
|
|
16
|
-
);
|
|
17
|
-
return updatedPayload;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export { updatePayload };
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import { SEVERITY } from '../constants';
|
|
2
|
-
import { CustomerConfig, StoredConfig } from '../../types/Config';
|
|
3
|
-
import { Singleton } from '../monitors/BaseMonitor';
|
|
4
|
-
/**
|
|
5
|
-
* Singleton class to manage the client configuration
|
|
6
|
-
* this class will be responsible for controlling the disabled
|
|
7
|
-
* status of the client script as well as managing all storage
|
|
8
|
-
* storing and retrieval.
|
|
9
|
-
*/
|
|
10
|
-
export default class ClientConfig extends Singleton {
|
|
11
|
-
readonly pageVisitId: string;
|
|
12
|
-
browserId: StoredConfig['BrowserId'];
|
|
13
|
-
private pageVisitSeq;
|
|
14
|
-
lastActiveTime: Date;
|
|
15
|
-
private readonly noibuErrorURL;
|
|
16
|
-
private cltErrorPostCounter;
|
|
17
|
-
private readonly maxSocketInactiveTime;
|
|
18
|
-
private locationBreadcrumbs;
|
|
19
|
-
customerDomain: string;
|
|
20
|
-
isClientDisabled: boolean;
|
|
21
|
-
configurationPromise: Promise<void>;
|
|
22
|
-
readonly listOfUrlsToCollectHttpDataFrom: CustomerConfig['listOfUrlsToCollectHttpDataFrom'];
|
|
23
|
-
readonly enableHttpDataCollection: CustomerConfig['enableHttpDataCollection'];
|
|
24
|
-
readonly blockedElements: CustomerConfig['blockedElements'];
|
|
25
|
-
/**
|
|
26
|
-
* Creates a ClientConfig singleton instance
|
|
27
|
-
*/
|
|
28
|
-
constructor(noibuErrorURL?: string, customerConfig?: CustomerConfig);
|
|
29
|
-
/**
|
|
30
|
-
* Convenience method to check correct setup
|
|
31
|
-
*/
|
|
32
|
-
private hasAllNecessaryArgs;
|
|
33
|
-
/** lockClient will disable the client script for a single pagevisit for
|
|
34
|
-
* duration given in minuntes */
|
|
35
|
-
lockClient(duration: number, msg: string): Promise<void>;
|
|
36
|
-
/** Locks the client until the next page loads */
|
|
37
|
-
lockClientUntilNextPage(msg: string): Promise<void>;
|
|
38
|
-
/** Updates the config object to store the given last active time */
|
|
39
|
-
updateLastActiveTime(lastActiveTime: Date): Promise<void>;
|
|
40
|
-
/** Gets the current page visit sequence number that should be used */
|
|
41
|
-
getPageVisitSeq(): Promise<number>;
|
|
42
|
-
/**
|
|
43
|
-
* Returns the client config object from storage or generates a new one
|
|
44
|
-
* What is stored in storage will look like this
|
|
45
|
-
* {
|
|
46
|
-
* BrowserId: UUIDV4
|
|
47
|
-
* ExpiryTime: DATE OBJ
|
|
48
|
-
* DisabledStatus: BOOL
|
|
49
|
-
* CurrentPageVisitCount: INT
|
|
50
|
-
* ClientUnlockTime: DATE OBJ
|
|
51
|
-
* LastActiveTime: DATE OBJ
|
|
52
|
-
* }
|
|
53
|
-
*/
|
|
54
|
-
_getLsObject(): Promise<StoredConfig>;
|
|
55
|
-
/**
|
|
56
|
-
* Check if we have surpassed the last active time and the page visit seq number needs resetting
|
|
57
|
-
*/
|
|
58
|
-
_pageVisitSeqNeedsReset(): Promise<boolean>;
|
|
59
|
-
/**
|
|
60
|
-
* _setupStorageVars will set all class variables that depend
|
|
61
|
-
* on the storage's value.
|
|
62
|
-
*/
|
|
63
|
-
_setupStorageVars(): Promise<void>;
|
|
64
|
-
/**
|
|
65
|
-
* Function will get the Noibu Storage Object
|
|
66
|
-
* 1. Generate a brand new one
|
|
67
|
-
* Get it from storage if the expiry date is not in the past
|
|
68
|
-
* Generate a brand new one if the expiry date is in the past
|
|
69
|
-
*/
|
|
70
|
-
_getClientState(): Promise<StoredConfig>;
|
|
71
|
-
/**
|
|
72
|
-
* _generateAndStoreData generates brand new data and then proceeds to store
|
|
73
|
-
* it.
|
|
74
|
-
*/
|
|
75
|
-
_generateAndStoreData(): Promise<StoredConfig>;
|
|
76
|
-
/**
|
|
77
|
-
* _generateNewBrowserData will create new data to be stored in storage
|
|
78
|
-
* and persisted throughout a session
|
|
79
|
-
*/
|
|
80
|
-
_generateNewBrowserData(): StoredConfig;
|
|
81
|
-
/**
|
|
82
|
-
* _storeBrowserData will store the passed object in storage.
|
|
83
|
-
* @param {} data the data to be stored
|
|
84
|
-
*/
|
|
85
|
-
_storeBrowserData(data: StoredConfig): Promise<StoredConfig>;
|
|
86
|
-
/** sets current breadcrumbs to be reconstructed into global url */
|
|
87
|
-
set currentLocationBreadcrumbs(newValue: typeof this.locationBreadcrumbs);
|
|
88
|
-
/** gets current global url */
|
|
89
|
-
get globalUrl(): string;
|
|
90
|
-
/**
|
|
91
|
-
* postNoibuErrorAndOptionallyDisableClient will post errors that were thrown by collect
|
|
92
|
-
* and disable the client if required
|
|
93
|
-
* severity expects one of the SEVERITY_x level constants, or else error will be used
|
|
94
|
-
*/
|
|
95
|
-
postNoibuErrorAndOptionallyDisableClient(errorMsg: any, disableClient?: boolean, severity?: (typeof SEVERITY)[keyof typeof SEVERITY], keepAlive?: boolean): Promise<void>;
|
|
96
|
-
/**
|
|
97
|
-
* Returns true if the page visit is considered to be inactive
|
|
98
|
-
*/
|
|
99
|
-
isInactive(): boolean;
|
|
100
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { Singleton } from '../monitors/BaseMonitor';
|
|
2
|
-
/**
|
|
3
|
-
* HelpCode class is responsible for help code feature related functionality
|
|
4
|
-
*/
|
|
5
|
-
export default class HelpCode extends Singleton {
|
|
6
|
-
private requestContext;
|
|
7
|
-
/**
|
|
8
|
-
* Constructs instance and sets up event listeners
|
|
9
|
-
*/
|
|
10
|
-
constructor();
|
|
11
|
-
/**
|
|
12
|
-
* Requests a help code and returns a Promise that resolves when the help code is obtained
|
|
13
|
-
* or rejects if the noibu connection is unavailable.
|
|
14
|
-
|
|
15
|
-
* @returns {Promise<string>} Promise object representing the help code request.
|
|
16
|
-
* @throws {string} Throws an error if the noibu connection is unavailable.
|
|
17
|
-
*/
|
|
18
|
-
requestHelpCode(): Promise<unknown>;
|
|
19
|
-
/**
|
|
20
|
-
* Handles the received help code event.
|
|
21
|
-
*/
|
|
22
|
-
receiveHelpCode(event: CustomEvent<string>): void;
|
|
23
|
-
}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
/** this class controls the input that customers can inject into
|
|
2
|
-
* our script via the NoibuJS SDK
|
|
3
|
-
*/
|
|
4
|
-
export default class InputManager {
|
|
5
|
-
/** gets the singleton instance */
|
|
6
|
-
static getInstance(): InputManager;
|
|
7
|
-
customIDs: {};
|
|
8
|
-
customErrorsCount: number;
|
|
9
|
-
TOO_MANY_IDS_ADDED_MSG: string;
|
|
10
|
-
ID_NAME_ALREADY_ADDED_MSG: string;
|
|
11
|
-
NAME_TOO_LONG_MSG: string;
|
|
12
|
-
VALUE_TOO_LONG_MSG: string;
|
|
13
|
-
INVALID_NAME_TYPE_MSG: string;
|
|
14
|
-
INVALID_VALUE_TYPE_MSG: string;
|
|
15
|
-
NAME_HAS_NO_LENGTH_MSG: string;
|
|
16
|
-
VALUE_HAS_NO_LENGTH_MSG: string;
|
|
17
|
-
SUCCESS_MSG: string;
|
|
18
|
-
ERROR_HAS_NO_MSG_MSG: string;
|
|
19
|
-
ERROR_HAS_NO_STACK_MSG: string;
|
|
20
|
-
NULL_CUSTOM_ERR_MSG: string;
|
|
21
|
-
ERROR_ALREADY_RECEIVED_MSG: string;
|
|
22
|
-
INVALID_ERROR_SOURCE_MSG: string;
|
|
23
|
-
TOO_MANY_ERRORS_RECEIVED_PER_PAGEVISIT_MSG: string;
|
|
24
|
-
/** exposes functions to the window of the browser for the clients
|
|
25
|
-
* to interact with on their end
|
|
26
|
-
*/
|
|
27
|
-
exposeFunctions(): {
|
|
28
|
-
requestHelpCode: (alert?: boolean) => Promise<string>;
|
|
29
|
-
addCustomAttribute: (name: string, value: string) => Promise<string>;
|
|
30
|
-
addError: (customError: Error) => string;
|
|
31
|
-
addJsSdkError: (customError: string, errorSource: string) => string;
|
|
32
|
-
};
|
|
33
|
-
/**
|
|
34
|
-
* gets the sdk object that will be assigned to a window variable
|
|
35
|
-
* @returns {{
|
|
36
|
-
* requestHelpCode: (alert?: boolean) => Promise<string>,
|
|
37
|
-
* addCustomAttribute: (name: string, value: string) => Promise<string>,
|
|
38
|
-
* addError: (customError: Error) => string,
|
|
39
|
-
* addJsSdkError: (customError: string, errorSource: string) => string
|
|
40
|
-
* }}
|
|
41
|
-
*/
|
|
42
|
-
_getSDKWindowObject(): {
|
|
43
|
-
requestHelpCode: (alert?: boolean) => Promise<string>;
|
|
44
|
-
addCustomAttribute: (name: string, value: string) => Promise<string>;
|
|
45
|
-
addError: (customError: Error) => string;
|
|
46
|
-
addJsSdkError: (customError: string, errorSource: string) => string;
|
|
47
|
-
};
|
|
48
|
-
/**
|
|
49
|
-
* validates the custom error that was passed
|
|
50
|
-
* @param {} customError
|
|
51
|
-
*/
|
|
52
|
-
_validateCustomError(customError: any): string;
|
|
53
|
-
/**
|
|
54
|
-
* Validates and sets the custom error to our internal trackers
|
|
55
|
-
* @param {} customError
|
|
56
|
-
*/
|
|
57
|
-
_validateAndSetCustomError(customError: any): string;
|
|
58
|
-
/**
|
|
59
|
-
* adds an error from a JS Sdk to the session
|
|
60
|
-
* @param {} customError
|
|
61
|
-
* @param {string} errorSource
|
|
62
|
-
*/
|
|
63
|
-
_addErrorFromJSSdk(customError: any, errorSource: string): string;
|
|
64
|
-
/**
|
|
65
|
-
* adds a custom Error to the session
|
|
66
|
-
* @param {} customError
|
|
67
|
-
*/
|
|
68
|
-
_addCustomError(customError: any): string;
|
|
69
|
-
/**
|
|
70
|
-
* adds a custom id to the session
|
|
71
|
-
* @param {} name
|
|
72
|
-
* @param {} value
|
|
73
|
-
*/
|
|
74
|
-
_addCustomAttribute(name: any, value: any): Promise<string>;
|
|
75
|
-
/**
|
|
76
|
-
* validation function for customer input
|
|
77
|
-
* @param {} name
|
|
78
|
-
* @param {} value
|
|
79
|
-
*/
|
|
80
|
-
_validateCustomIDInput(name: any, value: any): string;
|
|
81
|
-
/**
|
|
82
|
-
* Requests a help code from the HelpCode instance.
|
|
83
|
-
* @param {boolean} [alertUser=true] - Whether to alert the user about the help code request.
|
|
84
|
-
* @returns {Promise<string>} A promise that resolves with the requested help code.
|
|
85
|
-
*/
|
|
86
|
-
_requestHelpCode(): Promise<string>;
|
|
87
|
-
}
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
import { PAGE_VISIT_PART_ATT_NAME, PAGE_VISIT_VID_FRAG_ATT_NAME } from '../constants';
|
|
2
|
-
import { CompletePageVisit, InboundMessageType, OutboundMessageType, OutboundMessageTypeMap, PageVisitFrag, PageVisitInfo, SlidingMessage, VideoFrag } from '../../types/Metroplex.types';
|
|
3
|
-
import { PVEventMessage } from '../../types/PageVisitEvents.types';
|
|
4
|
-
import { Singleton } from '../monitors/BaseMonitor';
|
|
5
|
-
/**
|
|
6
|
-
* Implements rolling window of specified size,
|
|
7
|
-
* but only makes a cut once array length exceeds 150%.
|
|
8
|
-
* During downsize deletes oldest (lowest indexes) elements.
|
|
9
|
-
*/
|
|
10
|
-
export declare function createSlidingArrayOfSize<T>(size: number, arraySource?: T[], downsizeThreshold?: number, downsizeFactor?: number): T[];
|
|
11
|
-
/** Manages the socket to Metroplex */
|
|
12
|
-
export default class MetroplexSocket extends Singleton {
|
|
13
|
-
forceClosed: boolean;
|
|
14
|
-
socket: WebSocket | null;
|
|
15
|
-
socketInstanceId: string | null;
|
|
16
|
-
previousMessageType: string;
|
|
17
|
-
currentConnectionAttempts: number;
|
|
18
|
-
connectionCount: number;
|
|
19
|
-
sessionStartTime: any;
|
|
20
|
-
connectionPromise: Promise<void> | null;
|
|
21
|
-
pageVisitInfoSent: boolean;
|
|
22
|
-
connectionURL: string;
|
|
23
|
-
postURL: string;
|
|
24
|
-
messageSequenceNum: number;
|
|
25
|
-
latestReceivedSeqNumber: number;
|
|
26
|
-
isRetryLoopDisabled: boolean;
|
|
27
|
-
/** messages that need to be resent to metroplex since they are lacking confirmation */
|
|
28
|
-
retryMessageQueue: SlidingMessage<keyof OutboundMessageTypeMap>[];
|
|
29
|
-
metroplexTypeLock: Record<OutboundMessageType, boolean>;
|
|
30
|
-
initialURL: string;
|
|
31
|
-
initialReferringURL: string;
|
|
32
|
-
sessionTimestamp: Date;
|
|
33
|
-
latestReceivedSeqNumStoredTime: Date;
|
|
34
|
-
instanceId: string;
|
|
35
|
-
scriptInstanceId?: string;
|
|
36
|
-
sessionLength: number;
|
|
37
|
-
socketCloseCodes: string[];
|
|
38
|
-
socketOpens: string[];
|
|
39
|
-
ackedOnce: boolean;
|
|
40
|
-
metroRetryFrequencyMS: 30000;
|
|
41
|
-
retryMetroplexInterval: ReturnType<typeof setTimeout> | null;
|
|
42
|
-
private helpCodeCb;
|
|
43
|
-
/**
|
|
44
|
-
* Creates an instance of metroplex
|
|
45
|
-
* id of script, to make sure only a single socket is open
|
|
46
|
-
*/
|
|
47
|
-
constructor(scriptInstanceId?: string);
|
|
48
|
-
private static readonly typeToPayloadPropMap;
|
|
49
|
-
/**
|
|
50
|
-
* Adds the seq num field to the given payload depending on whether its
|
|
51
|
-
* a page visit part or video frag
|
|
52
|
-
*/
|
|
53
|
-
_addSeqNumToPayload<T>(type: OutboundMessageType, payload: T): T;
|
|
54
|
-
/** requests help code and saves a callback to be called on response */
|
|
55
|
-
requestHelpCode(cb: typeof this.helpCodeCb): Promise<boolean>;
|
|
56
|
-
/**
|
|
57
|
-
* Immediately sends a message to Metroplex over the web socket
|
|
58
|
-
* Queues the message if the connection isn't open yet.
|
|
59
|
-
* returns true if message was sent succefully, false otherwise
|
|
60
|
-
*/
|
|
61
|
-
sendMessage<T extends OutboundMessageType>(type: T, payload: OutboundMessageTypeMap[T]): Promise<boolean>;
|
|
62
|
-
/** Updates the latest pv message sent timestamp if events contain any user steps
|
|
63
|
-
*/
|
|
64
|
-
_updateLatestPvTimestamp(events: PVEventMessage[]): Promise<void>;
|
|
65
|
-
/** returns true if the socket is either connecting or connected to metroplex */
|
|
66
|
-
isConnected(): boolean;
|
|
67
|
-
/** returns true if we are connecting to the socket */
|
|
68
|
-
isConnecting(): boolean;
|
|
69
|
-
/** close will close the socket opened for video frag transmission */
|
|
70
|
-
close(): void;
|
|
71
|
-
/** Connects the web socket to metroplex and calls callback upon successfully connecting
|
|
72
|
-
*/
|
|
73
|
-
handleConnect(forceOpen: boolean): Promise<void>;
|
|
74
|
-
/**
|
|
75
|
-
* connectSocket will establish a websocket connection to the metroplex
|
|
76
|
-
* service
|
|
77
|
-
*/
|
|
78
|
-
connectSocket(): Promise<void>;
|
|
79
|
-
/** Calculates and sets the end_at field of the payload
|
|
80
|
-
* @param {} payload
|
|
81
|
-
* @param {} isPageVisit
|
|
82
|
-
*/
|
|
83
|
-
addEndTimeToPayload<T extends VideoFrag | PageVisitFrag>(payload: T, isPageVisit: boolean): T;
|
|
84
|
-
/** open handler for socket */
|
|
85
|
-
_onSocketOpen(): Promise<void>;
|
|
86
|
-
/** message handler for socket
|
|
87
|
-
* @param {} event
|
|
88
|
-
*/
|
|
89
|
-
_onSocketMessage(event: InboundMessageType): Promise<void>;
|
|
90
|
-
/**
|
|
91
|
-
* Returns true if the message's payload has the payload type given and has a sequence
|
|
92
|
-
* number higher than seqNum
|
|
93
|
-
*/
|
|
94
|
-
_messagePayloadHasLargerSeqNum(message: SlidingMessage, payloadType: typeof PAGE_VISIT_PART_ATT_NAME | typeof PAGE_VISIT_VID_FRAG_ATT_NAME, seqNum: number): boolean;
|
|
95
|
-
/**
|
|
96
|
-
* removes messages from the retry queue that are smaller than the
|
|
97
|
-
* latest stored message in metroplex
|
|
98
|
-
*/
|
|
99
|
-
_clearRetryQueue(seqNum: number): void;
|
|
100
|
-
/** will resend everything that is in the retry queue */
|
|
101
|
-
_sendUnconfirmedMessages(socketWasAlreadyOpen: boolean): Promise<void>;
|
|
102
|
-
/** sets up the interval to empty the queue as we receive confirmation messages from metroplex */
|
|
103
|
-
setupRetryMechanism(): void;
|
|
104
|
-
/** sets up events that will trigger the event queue to be emptied */
|
|
105
|
-
_setupOffloadEvents(): void;
|
|
106
|
-
/**
|
|
107
|
-
* will handle the final moments of a page being active. It
|
|
108
|
-
* will try to empty both the queues with beacons.
|
|
109
|
-
*/
|
|
110
|
-
_handleUnload(): Promise<void>;
|
|
111
|
-
/**
|
|
112
|
-
* will post full page visit to metroplex. It
|
|
113
|
-
* will try to empty both the queues with beacons.
|
|
114
|
-
*/
|
|
115
|
-
postFullPageVisit(maxMessageSize: number): Promise<void>;
|
|
116
|
-
/**
|
|
117
|
-
* will send a message to metroplex via a post request that will outlive the current page
|
|
118
|
-
*/
|
|
119
|
-
postMessage(msg: CompletePageVisit): Promise<void>;
|
|
120
|
-
/**
|
|
121
|
-
* Stringifies the payload into JSON, sends it to the back end if the session
|
|
122
|
-
* is active and returns true. If inactive the session and socket are closed
|
|
123
|
-
* and this method returns false.
|
|
124
|
-
*/
|
|
125
|
-
_sendSocketMessage<T extends ValueOf<OutboundMessageTypeMap>>(payload: T): Promise<void>;
|
|
126
|
-
/**
|
|
127
|
-
* Closes the socket connection if the session is inactive. Returns true if the
|
|
128
|
-
* session is inactive
|
|
129
|
-
*/
|
|
130
|
-
closeIfInactive(): Promise<boolean>;
|
|
131
|
-
/** will get page information, calling this will increase the connection count */
|
|
132
|
-
getPageInformation(): Promise<PageVisitInfo>;
|
|
133
|
-
/**
|
|
134
|
-
* Try to parse help code response and fire custom event
|
|
135
|
-
*/
|
|
136
|
-
_tryProcessHelpCodeResponse(response: unknown): boolean;
|
|
137
|
-
}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This class holds the final page visit and video frag metrics. It flushes
|
|
3
|
-
* them to storage and then finally sends them to Metroplex via the post
|
|
4
|
-
* route when the next page is loaded
|
|
5
|
-
*/
|
|
6
|
-
export default class StoredMetrics {
|
|
7
|
-
/**
|
|
8
|
-
* gets the singleton instance
|
|
9
|
-
* @returns {StoredMetrics}
|
|
10
|
-
*/
|
|
11
|
-
static getInstance(): StoredMetrics;
|
|
12
|
-
expectedVideoLength: number;
|
|
13
|
-
expectedVfSeq: number;
|
|
14
|
-
httpSequenceNumber: number;
|
|
15
|
-
httpOverLimitCount: number;
|
|
16
|
-
httpDroppedPayloadByTypeCount: number;
|
|
17
|
-
httpDroppedPayloadByLengthCount: number;
|
|
18
|
-
httpPayloadCount: number;
|
|
19
|
-
expectedPvPart: number;
|
|
20
|
-
videoClicks: number;
|
|
21
|
-
pvClicks: number;
|
|
22
|
-
errCount: number;
|
|
23
|
-
httpCount: number;
|
|
24
|
-
didCutPv: boolean;
|
|
25
|
-
didCutVideo: boolean;
|
|
26
|
-
writeTimeout: any;
|
|
27
|
-
didStartVideo: boolean;
|
|
28
|
-
/** Add video frag payload data to the stored metrics
|
|
29
|
-
* @param {} expectedVfSeq
|
|
30
|
-
* @param {} expectedVideoLength
|
|
31
|
-
*/
|
|
32
|
-
addVideoFragData(expectedVfSeq: any, expectedVideoLength: any): void;
|
|
33
|
-
/** Set the amount of page visit parts
|
|
34
|
-
* @param {} expectedPvPart
|
|
35
|
-
*/
|
|
36
|
-
setPvPart(expectedPvPart: any): void;
|
|
37
|
-
/** Increase the amount of video clicks seen in the session */
|
|
38
|
-
addVideoClick(): void;
|
|
39
|
-
/** Increase the amount of page visit clicks */
|
|
40
|
-
addPvClick(): void;
|
|
41
|
-
/** Increments the error count by 1 */
|
|
42
|
-
addError(): void;
|
|
43
|
-
/** Increments the http count by 1 */
|
|
44
|
-
addHttpEvent(): void;
|
|
45
|
-
/** Increments the http data sequence count by 1 */
|
|
46
|
-
addHttpData(): void;
|
|
47
|
-
/** Increments the http data over limit count by 1 */
|
|
48
|
-
addHttpDataOverLimit(): void;
|
|
49
|
-
/** Increments the http data drop count by content type */
|
|
50
|
-
addHttpDataDropByType(): void;
|
|
51
|
-
/** Increments the http data drop count by content length */
|
|
52
|
-
addHttpDataDropByLength(): void;
|
|
53
|
-
/** Increments the http data payload collected count */
|
|
54
|
-
addHttpDataPayloadCount(): void;
|
|
55
|
-
/** Set that the video was cut/blocked due to size constraints */
|
|
56
|
-
setDidCutVideo(): void;
|
|
57
|
-
/** Set that the video was started */
|
|
58
|
-
setDidStartVideo(): void;
|
|
59
|
-
/** Set that the page visit was cut/blocked due to size constraints */
|
|
60
|
-
setDidCutPv(): void;
|
|
61
|
-
/**
|
|
62
|
-
* Sets up all the listeners that noibujs should listen to before storing
|
|
63
|
-
* our metrics to localstorage
|
|
64
|
-
*/
|
|
65
|
-
_setupListeners(): void;
|
|
66
|
-
/** posts the metrics to metroplex if client is active
|
|
67
|
-
* @param {} eventName
|
|
68
|
-
*/
|
|
69
|
-
_postMetricsIfActive(eventName: any): void;
|
|
70
|
-
/** posts the metrics to metroplex using the beacon API
|
|
71
|
-
*/
|
|
72
|
-
postMetrics(): Promise<void>;
|
|
73
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { CompletePageVisit, PageVisitFrag, PageVisitInfo, SlidingMessage } from '../../types/Metroplex.types';
|
|
2
|
-
import { Singleton } from '../monitors/BaseMonitor';
|
|
3
|
-
/**
|
|
4
|
-
* This class holds the final page visit. It flushes it to storage and then
|
|
5
|
-
* finally sends it to Metroplex via the post route when the next page is loaded
|
|
6
|
-
*/
|
|
7
|
-
export default class StoredPageVisit extends Singleton {
|
|
8
|
-
/**
|
|
9
|
-
* Creates a new instance of StoredPageVisit
|
|
10
|
-
*/
|
|
11
|
-
constructor();
|
|
12
|
-
/**
|
|
13
|
-
* Check if the events contain a click or location change. If they do then write the retry
|
|
14
|
-
* queue (which contains the metroplex msg sent above) to storage
|
|
15
|
-
*/
|
|
16
|
-
checkAndStoreRetryQueue(retryMessageQueue: SlidingMessage[], pvInfo: PageVisitInfo): void;
|
|
17
|
-
/** Writes the page visit frags in the retry queue to storage
|
|
18
|
-
*/
|
|
19
|
-
writePageVisitsFromRetryQueue(retryMessageQueue: SlidingMessage[], pvInfo: PageVisitInfo): void;
|
|
20
|
-
/** Write the given page visit frags to storage
|
|
21
|
-
*/
|
|
22
|
-
_writePageVisitFrags(pageVisitFrags: PageVisitFrag[], pvInfo: PageVisitInfo): Promise<void>;
|
|
23
|
-
/**
|
|
24
|
-
* Read the stored page visit from storage, create a complete page visit object
|
|
25
|
-
* and then post that to Metroplex
|
|
26
|
-
*/
|
|
27
|
-
_getPostData(): Promise<CompletePageVisit>;
|
|
28
|
-
/**
|
|
29
|
-
* Creates and tries to resolve a promise that posts the previous page visit
|
|
30
|
-
* to Metroplex from storage
|
|
31
|
-
*/
|
|
32
|
-
_postPreviousPageVisit(): void;
|
|
33
|
-
/**
|
|
34
|
-
* Remove the storage item and set flushed to true after they have
|
|
35
|
-
* been posted to metroplex
|
|
36
|
-
*/
|
|
37
|
-
_updateStorageFlushed(): void;
|
|
38
|
-
/** Returns a promise that resolves to post the page visit in storage to Metroplex */
|
|
39
|
-
_getPostPageVisitPromise(): Promise<void>;
|
|
40
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export function WHITELIST_TEXT_REGEX_STRING(): string;
|