noibu-react-native 0.2.6 → 0.2.8
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/android/build.gradle +1 -1
- package/dist/{src/api/clientConfig.d.ts → api/ClientConfig.d.ts} +19 -20
- package/dist/api/{clientConfig.js → ClientConfig.js} +82 -63
- package/dist/{src/api/helpCode.d.ts → api/HelpCode.d.ts} +3 -10
- package/dist/api/{helpCode.js → HelpCode.js} +8 -14
- package/dist/api/InputManager.d.ts +39 -0
- package/dist/api/InputManager.js +156 -0
- package/dist/{src/api/metroplexSocket.d.ts → api/MetroplexSocket.d.ts} +33 -38
- package/dist/api/{metroplexSocket.js → MetroplexSocket.js} +190 -178
- package/dist/{src/api/storedMetrics.d.ts → api/StoredMetrics.d.ts} +10 -20
- package/dist/api/StoredMetrics.js +158 -0
- package/dist/{src/api/storedPageVisit.d.ts → api/StoredPageVisit.d.ts} +11 -8
- package/dist/api/{storedPageVisit.js → StoredPageVisit.js} +62 -48
- package/dist/const_matchers.js +1 -5
- package/dist/constants.d.ts +48 -0
- package/dist/constants.js +15 -397
- package/dist/{src/entry → entry}/index.d.ts +5 -6
- package/dist/entry/index.js +3 -4
- package/dist/entry/init.d.ts +8 -0
- package/dist/entry/init.js +34 -19
- package/dist/monitors/AppNavigationMonitor.d.ts +10 -0
- package/dist/monitors/AppNavigationMonitor.js +19 -19
- package/dist/monitors/AppNavigationMonitor.test.d.ts +1 -0
- package/dist/{src/monitors → monitors}/BaseMonitor.d.ts +5 -5
- package/dist/monitors/BaseMonitor.js +9 -4
- package/dist/monitors/BaseMonitor.test.d.ts +1 -0
- package/dist/{src/monitors → monitors}/ClickMonitor.d.ts +10 -13
- package/dist/monitors/ClickMonitor.js +72 -76
- package/dist/monitors/ClickMonitor.test.d.ts +1 -0
- package/dist/{src/monitors → monitors}/ErrorMonitor.d.ts +4 -28
- package/dist/monitors/ErrorMonitor.js +45 -55
- package/dist/{src/monitors → monitors}/KeyboardInputMonitor.d.ts +1 -3
- package/dist/monitors/KeyboardInputMonitor.js +13 -11
- package/dist/{src/monitors → monitors}/PageMonitor.d.ts +1 -1
- package/dist/monitors/PageMonitor.js +25 -2
- package/dist/{src/monitors → monitors}/RequestMonitor.d.ts +9 -29
- package/dist/monitors/RequestMonitor.js +46 -57
- package/dist/monitors/http-tools/GqlErrorValidator.d.ts +35 -0
- package/dist/monitors/http-tools/GqlErrorValidator.js +42 -70
- package/dist/{src/monitors → monitors}/http-tools/HTTPDataBundler.d.ts +9 -15
- package/dist/monitors/http-tools/HTTPDataBundler.js +74 -67
- package/dist/monitors/integrations/ReactNativeNavigationIntegration.d.ts +17 -0
- package/dist/monitors/integrations/{react-native-navigation-integration.js → ReactNativeNavigationIntegration.js} +15 -12
- package/dist/{src/pageVisit → pageVisit}/EventDebouncer.d.ts +9 -10
- package/dist/pageVisit/EventDebouncer.js +43 -74
- package/dist/pageVisit/HttpEventManager.d.ts +14 -0
- package/dist/pageVisit/HttpEventManager.js +88 -0
- package/dist/pageVisit/PageVisitManager.d.ts +31 -0
- package/dist/pageVisit/PageVisitManager.js +99 -0
- package/dist/pageVisit/pageVisitEventError.d.ts +12 -0
- package/dist/pageVisit/pageVisitEventError.js +170 -280
- package/dist/{src/react → react}/ErrorBoundary.d.ts +4 -9
- package/dist/react/ErrorBoundary.js +3 -6
- package/dist/{src/sessionRecorder/sessionRecorder.d.ts → sessionRecorder/SessionRecorder.d.ts} +7 -17
- package/dist/sessionRecorder/{sessionRecorder.js → SessionRecorder.js} +60 -71
- package/dist/{src/sessionRecorder → sessionRecorder}/nativeSessionRecorderSubscription.d.ts +4 -6
- package/dist/sessionRecorder/nativeSessionRecorderSubscription.js +3 -5
- package/dist/{src/storage/rnStorageProvider.d.ts → storage/RNStorageProvider.d.ts} +4 -8
- package/dist/storage/{rnStorageProvider.js → RNStorageProvider.js} +3 -7
- package/dist/{src/storage/storage.d.ts → storage/Storage.d.ts} +8 -18
- package/dist/storage/{storage.js → Storage.js} +17 -30
- package/dist/{src/storage/storageProvider.d.ts → storage/StorageProvider.d.ts} +5 -8
- package/dist/storage/{storageProvider.js → StorageProvider.js} +7 -8
- package/dist/types/NavigationIntegration.d.ts +1 -1
- package/dist/utils/date.d.ts +7 -0
- package/dist/utils/date.js +41 -51
- package/dist/utils/eventlistener.js +6 -14
- package/dist/{src/utils → utils}/function.d.ts +13 -43
- package/dist/utils/function.js +42 -113
- package/dist/utils/log.d.ts +4 -0
- package/dist/utils/log.js +2 -4
- package/dist/{src/utils → utils}/object.d.ts +10 -8
- package/dist/utils/object.js +12 -12
- package/dist/{src/utils → utils}/performance.d.ts +1 -1
- package/dist/utils/piiRedactor.js +31 -3
- package/dist/utils/stacktrace-parser.d.ts +8 -0
- package/dist/utils/stacktrace-parser.js +29 -21
- package/dist/utils/stacktrace-parser.test.d.ts +1 -0
- 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/inputManager.d.ts +0 -87
- package/dist/src/constants.d.ts +0 -290
- package/dist/src/entry/init.d.ts +0 -5
- package/dist/src/monitors/AppNavigationMonitor.d.ts +0 -18
- package/dist/src/monitors/http-tools/GqlErrorValidator.d.ts +0 -59
- package/dist/src/monitors/integrations/react-native-navigation-integration.d.ts +0 -20
- 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/utils/date.d.ts +0 -6
- package/dist/src/utils/log.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/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
- /package/dist/{src/api/clientConfig.test.d.ts → api/ClientConfig.test.d.ts} +0 -0
- /package/dist/{src/monitors/BaseMonitor.test.d.ts → api/MetroplexSocket.test.d.ts} +0 -0
- /package/dist/{src/const_matchers.d.ts → const_matchers.d.ts} +0 -0
- /package/dist/{src/sessionRecorder → sessionRecorder}/types.d.ts +0 -0
- /package/dist/{src/utils → utils}/eventlistener.d.ts +0 -0
- /package/dist/{src/utils → utils}/piiRedactor.d.ts +0 -0
- /package/dist/{src/utils → utils}/polyfills.d.ts +0 -0
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { __awaiter } from 'tslib';
|
|
2
|
+
import MetroplexSocket from './MetroplexSocket.js';
|
|
3
|
+
import { saveErrorToPagevisit } from '../pageVisit/pageVisitEventError.js';
|
|
4
|
+
import HelpCode from './HelpCode.js';
|
|
5
|
+
import { Singleton } from '../monitors/BaseMonitor.js';
|
|
6
|
+
import '../node_modules/@noibu/metroplex-ts-bindings/dist/index.js';
|
|
7
|
+
import { PageVisitErrorSource } from '../node_modules/@noibu/metroplex-ts-bindings/dist/PageVisitErrorSource.js';
|
|
8
|
+
import { WebsocketMessageType } from '../node_modules/@noibu/metroplex-ts-bindings/dist/WebsocketMessageType.js';
|
|
9
|
+
|
|
10
|
+
// maximum ids that a user can add to a pagevisit
|
|
11
|
+
const MAX_CUSTOM_IDS_PER_PAGEVISIT = 10;
|
|
12
|
+
const MAX_CUSTOM_ERRORS_PER_PAGEVISIT = 500;
|
|
13
|
+
const TOO_MANY_IDS_ADDED_MSG = 'TOO_MANY_IDS_ADDED';
|
|
14
|
+
const ID_NAME_ALREADY_ADDED_MSG = 'ID_NAME_ALREADY_ADDED';
|
|
15
|
+
const NAME_TOO_LONG_MSG = 'NAME_TOO_LONG';
|
|
16
|
+
const VALUE_TOO_LONG_MSG = 'VALUE_TOO_LONG';
|
|
17
|
+
const INVALID_NAME_TYPE_MSG = 'INVALID_NAME_TYPE';
|
|
18
|
+
const INVALID_VALUE_TYPE_MSG = 'INVALID_VALUE_TYPE';
|
|
19
|
+
const NAME_HAS_NO_LENGTH_MSG = 'NAME_HAS_NO_LENGTH';
|
|
20
|
+
const VALUE_HAS_NO_LENGTH_MSG = 'VALUE_HAS_NO_LENGTH';
|
|
21
|
+
const SUCCESS_MSG = 'SUCCESS';
|
|
22
|
+
const ERROR_HAS_NO_MSG_MSG = 'ERROR_HAS_NO_MSG';
|
|
23
|
+
const ERROR_HAS_NO_STACK_MSG = 'ERROR_HAS_NO_STACK';
|
|
24
|
+
const NULL_CUSTOM_ERR_MSG = 'NULL_CUSTOM_ERROR';
|
|
25
|
+
const TOO_MANY_ERRORS_RECEIVED_PER_PAGEVISIT_MSG = 'TOO_MANY_ERRORS_RECEIVED_PER_PAGEVISIT';
|
|
26
|
+
/** this class controls the input that customers can inject into
|
|
27
|
+
* our script via the NoibuJS SDK
|
|
28
|
+
*/
|
|
29
|
+
class InputManager extends Singleton {
|
|
30
|
+
constructor() {
|
|
31
|
+
super(...arguments);
|
|
32
|
+
this.customIDs = {};
|
|
33
|
+
this.customErrorsCount = 0;
|
|
34
|
+
}
|
|
35
|
+
/** exposes functions to the window of the browser for the clients
|
|
36
|
+
* to interact with on their end
|
|
37
|
+
*/
|
|
38
|
+
exposeFunctions() {
|
|
39
|
+
return {
|
|
40
|
+
// adding all the functions and binding the current context
|
|
41
|
+
// so that we can use the exposed function as if they are running`
|
|
42
|
+
// in the noibujs script
|
|
43
|
+
requestHelpCode: this._requestHelpCode.bind(this),
|
|
44
|
+
addCustomAttribute: this._addCustomAttribute.bind(this),
|
|
45
|
+
addError: this._addCustomError.bind(this),
|
|
46
|
+
addJsSdkError: this._addErrorFromJSSdk.bind(this),
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
/** validates the custom error that was passed */
|
|
50
|
+
getErrorValidationError(customError) {
|
|
51
|
+
if (!customError) {
|
|
52
|
+
return NULL_CUSTOM_ERR_MSG;
|
|
53
|
+
}
|
|
54
|
+
if (!customError.message) {
|
|
55
|
+
return ERROR_HAS_NO_MSG_MSG;
|
|
56
|
+
}
|
|
57
|
+
if (!customError.stack) {
|
|
58
|
+
return ERROR_HAS_NO_STACK_MSG;
|
|
59
|
+
}
|
|
60
|
+
return SUCCESS_MSG;
|
|
61
|
+
}
|
|
62
|
+
/** Validates and sets the custom error to our internal trackers */
|
|
63
|
+
_validateAndSetCustomError(customError) {
|
|
64
|
+
// we cap the number of errors allowed to be sent
|
|
65
|
+
if (this.customErrorsCount >= MAX_CUSTOM_ERRORS_PER_PAGEVISIT) {
|
|
66
|
+
return TOO_MANY_ERRORS_RECEIVED_PER_PAGEVISIT_MSG;
|
|
67
|
+
}
|
|
68
|
+
// need to validate first before we start operating with the received
|
|
69
|
+
// data
|
|
70
|
+
const validationResult = this.getErrorValidationError(customError);
|
|
71
|
+
if (validationResult !== SUCCESS_MSG) {
|
|
72
|
+
return validationResult;
|
|
73
|
+
}
|
|
74
|
+
this.customErrorsCount += 1;
|
|
75
|
+
return SUCCESS_MSG;
|
|
76
|
+
}
|
|
77
|
+
/** adds an error from a JS Sdk to the session */
|
|
78
|
+
_addErrorFromJSSdk(customError, errorSource) {
|
|
79
|
+
const validationAndSettingResult = this._validateAndSetCustomError(customError);
|
|
80
|
+
if (validationAndSettingResult !== SUCCESS_MSG) {
|
|
81
|
+
return validationAndSettingResult;
|
|
82
|
+
}
|
|
83
|
+
saveErrorToPagevisit({ error: customError, type: `${errorSource}` });
|
|
84
|
+
return validationAndSettingResult;
|
|
85
|
+
}
|
|
86
|
+
/** adds a custom Error to the session */
|
|
87
|
+
_addCustomError(customError) {
|
|
88
|
+
const validationAndSettingResult = this._validateAndSetCustomError(customError);
|
|
89
|
+
if (validationAndSettingResult !== SUCCESS_MSG) {
|
|
90
|
+
return validationAndSettingResult;
|
|
91
|
+
}
|
|
92
|
+
// customError is validated at this point
|
|
93
|
+
saveErrorToPagevisit({ type: PageVisitErrorSource.CustomError, error: customError });
|
|
94
|
+
return validationAndSettingResult;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* adds a custom id to the session
|
|
98
|
+
* todo wrong param types, should be unknown
|
|
99
|
+
*/
|
|
100
|
+
_addCustomAttribute(name, value) {
|
|
101
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
102
|
+
// we return if we are over the limit of ids
|
|
103
|
+
if (Object.keys(this.customIDs).length >= MAX_CUSTOM_IDS_PER_PAGEVISIT) {
|
|
104
|
+
return TOO_MANY_IDS_ADDED_MSG;
|
|
105
|
+
}
|
|
106
|
+
// need to validate first before we start operating with the received
|
|
107
|
+
// data
|
|
108
|
+
const validationResult = this.getValidationError(name, value);
|
|
109
|
+
if (validationResult !== SUCCESS_MSG) {
|
|
110
|
+
return validationResult;
|
|
111
|
+
}
|
|
112
|
+
// we do not want to keep sending something that was already sent
|
|
113
|
+
if (name in this.customIDs) {
|
|
114
|
+
return ID_NAME_ALREADY_ADDED_MSG;
|
|
115
|
+
}
|
|
116
|
+
this.customIDs[name] = value;
|
|
117
|
+
yield MetroplexSocket.getInstance().sendMessage({
|
|
118
|
+
type: WebsocketMessageType.PageVisitMeta,
|
|
119
|
+
payload: {
|
|
120
|
+
id_name: name,
|
|
121
|
+
id_val: value,
|
|
122
|
+
},
|
|
123
|
+
});
|
|
124
|
+
return SUCCESS_MSG;
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
/** validation function for customer input */
|
|
128
|
+
getValidationError(name, value) {
|
|
129
|
+
// all ids need to be strings and less than 50 chars and more than 0 chars
|
|
130
|
+
if (typeof name !== 'string') {
|
|
131
|
+
return INVALID_NAME_TYPE_MSG;
|
|
132
|
+
}
|
|
133
|
+
if (typeof value !== 'string') {
|
|
134
|
+
return INVALID_VALUE_TYPE_MSG;
|
|
135
|
+
}
|
|
136
|
+
if (value.length > 50) {
|
|
137
|
+
return VALUE_TOO_LONG_MSG;
|
|
138
|
+
}
|
|
139
|
+
if (name.length > 50) {
|
|
140
|
+
return NAME_TOO_LONG_MSG;
|
|
141
|
+
}
|
|
142
|
+
if (value.length === 0) {
|
|
143
|
+
return VALUE_HAS_NO_LENGTH_MSG;
|
|
144
|
+
}
|
|
145
|
+
if (name.length === 0) {
|
|
146
|
+
return NAME_HAS_NO_LENGTH_MSG;
|
|
147
|
+
}
|
|
148
|
+
return SUCCESS_MSG;
|
|
149
|
+
}
|
|
150
|
+
/** Requests a help code from the HelpCode instance. */
|
|
151
|
+
_requestHelpCode() {
|
|
152
|
+
return HelpCode.getInstance().requestHelpCode();
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export { InputManager as default };
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { CompletePageVisit, InboundMessageType, OutboundMessageType, OutboundMessageTypeMap, PageVisitFrag, PageVisitInfo, SlidingMessage, VideoFrag } from '../../types/Metroplex.types';
|
|
3
|
-
import { PVEventMessage } from '../../types/PageVisitEvents.types';
|
|
1
|
+
import { MetroplexInputRouteMap, MetroplexRoute, PageInformation, PageVisitEvent, VideoRecorder, WebsocketMessageType } from '@noibu/metroplex-ts-bindings';
|
|
4
2
|
import { Singleton } from '../monitors/BaseMonitor';
|
|
3
|
+
import { NoSeqNumSlidingMessage, RetryQueueWSMessage } from '../types/Metroplex';
|
|
4
|
+
/**
|
|
5
|
+
* Grab the video recorder type based on the device we run the app on.
|
|
6
|
+
*/
|
|
7
|
+
export declare function getVideoRecorderType(): Promise<VideoRecorder>;
|
|
5
8
|
/**
|
|
6
9
|
* Implements rolling window of specified size,
|
|
7
10
|
* but only makes a cut once array length exceeds 150%.
|
|
@@ -16,8 +19,8 @@ export default class MetroplexSocket extends Singleton {
|
|
|
16
19
|
previousMessageType: string;
|
|
17
20
|
currentConnectionAttempts: number;
|
|
18
21
|
connectionCount: number;
|
|
19
|
-
sessionStartTime:
|
|
20
|
-
connectionPromise: Promise<void
|
|
22
|
+
sessionStartTime: number;
|
|
23
|
+
connectionPromise: Promise<void>;
|
|
21
24
|
pageVisitInfoSent: boolean;
|
|
22
25
|
connectionURL: string;
|
|
23
26
|
postURL: string;
|
|
@@ -25,8 +28,8 @@ export default class MetroplexSocket extends Singleton {
|
|
|
25
28
|
latestReceivedSeqNumber: number;
|
|
26
29
|
isRetryLoopDisabled: boolean;
|
|
27
30
|
/** messages that need to be resent to metroplex since they are lacking confirmation */
|
|
28
|
-
retryMessageQueue:
|
|
29
|
-
metroplexTypeLock: Record<
|
|
31
|
+
retryMessageQueue: RetryQueueWSMessage[];
|
|
32
|
+
metroplexTypeLock: Record<WebsocketMessageType, boolean>;
|
|
30
33
|
initialURL: string;
|
|
31
34
|
initialReferringURL: string;
|
|
32
35
|
sessionTimestamp: Date;
|
|
@@ -37,7 +40,7 @@ export default class MetroplexSocket extends Singleton {
|
|
|
37
40
|
socketCloseCodes: string[];
|
|
38
41
|
socketOpens: string[];
|
|
39
42
|
ackedOnce: boolean;
|
|
40
|
-
metroRetryFrequencyMS:
|
|
43
|
+
metroRetryFrequencyMS: number;
|
|
41
44
|
retryMetroplexInterval: ReturnType<typeof setTimeout> | null;
|
|
42
45
|
private helpCodeCb;
|
|
43
46
|
/**
|
|
@@ -45,12 +48,18 @@ export default class MetroplexSocket extends Singleton {
|
|
|
45
48
|
* id of script, to make sure only a single socket is open
|
|
46
49
|
*/
|
|
47
50
|
constructor(scriptInstanceId?: string);
|
|
48
|
-
|
|
51
|
+
/**
|
|
52
|
+
* connectSocket will establish a websocket connection to the metroplex
|
|
53
|
+
* service
|
|
54
|
+
*/
|
|
55
|
+
connectSocket(): Promise<void>;
|
|
56
|
+
/** sets up events that will trigger the event queue to be emptied */
|
|
57
|
+
_setupOffloadEvents(): void;
|
|
49
58
|
/**
|
|
50
59
|
* Adds the seq num field to the given payload depending on whether its
|
|
51
60
|
* a page visit part or video frag
|
|
52
61
|
*/
|
|
53
|
-
_addSeqNumToPayload<T>(
|
|
62
|
+
_addSeqNumToPayload<T extends RetryQueueWSMessage>(message: NoSeqNumSlidingMessage<T>): Promise<T>;
|
|
54
63
|
/** requests help code and saves a callback to be called on response */
|
|
55
64
|
requestHelpCode(cb: typeof this.helpCodeCb): Promise<boolean>;
|
|
56
65
|
/**
|
|
@@ -58,10 +67,10 @@ export default class MetroplexSocket extends Singleton {
|
|
|
58
67
|
* Queues the message if the connection isn't open yet.
|
|
59
68
|
* returns true if message was sent succefully, false otherwise
|
|
60
69
|
*/
|
|
61
|
-
sendMessage
|
|
70
|
+
sendMessage(message: NoSeqNumSlidingMessage<RetryQueueWSMessage<WebsocketMessageType>>): Promise<boolean>;
|
|
62
71
|
/** Updates the latest pv message sent timestamp if events contain any user steps
|
|
63
72
|
*/
|
|
64
|
-
_updateLatestPvTimestamp(events:
|
|
73
|
+
_updateLatestPvTimestamp(events: PageVisitEvent[]): Promise<void>;
|
|
65
74
|
/** returns true if the socket is either connecting or connected to metroplex */
|
|
66
75
|
isConnected(): boolean;
|
|
67
76
|
/** returns true if we are connecting to the socket */
|
|
@@ -71,27 +80,19 @@ export default class MetroplexSocket extends Singleton {
|
|
|
71
80
|
/** Connects the web socket to metroplex and calls callback upon successfully connecting
|
|
72
81
|
*/
|
|
73
82
|
handleConnect(forceOpen: boolean): Promise<void>;
|
|
74
|
-
/**
|
|
75
|
-
|
|
76
|
-
|
|
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;
|
|
83
|
+
/** Calculates and sets the end_at field of the payload */
|
|
84
|
+
addEndTimeToPayload<T>(payload: T, isPageVisit: boolean): T & {
|
|
85
|
+
end_at: string;
|
|
86
|
+
};
|
|
84
87
|
/** open handler for socket */
|
|
85
88
|
_onSocketOpen(): Promise<void>;
|
|
86
|
-
/** message handler for socket
|
|
87
|
-
|
|
88
|
-
*/
|
|
89
|
-
_onSocketMessage(event: InboundMessageType): Promise<void>;
|
|
89
|
+
/** message handler for socket */
|
|
90
|
+
_onSocketMessage(event: WebSocketMessageEvent): Promise<void>;
|
|
90
91
|
/**
|
|
91
92
|
* Returns true if the message's payload has the payload type given and has a sequence
|
|
92
93
|
* number higher than seqNum
|
|
93
94
|
*/
|
|
94
|
-
_messagePayloadHasLargerSeqNum(message:
|
|
95
|
+
_messagePayloadHasLargerSeqNum(message: RetryQueueWSMessage, seqNum: number): boolean | 0;
|
|
95
96
|
/**
|
|
96
97
|
* removes messages from the retry queue that are smaller than the
|
|
97
98
|
* latest stored message in metroplex
|
|
@@ -101,8 +102,6 @@ export default class MetroplexSocket extends Singleton {
|
|
|
101
102
|
_sendUnconfirmedMessages(socketWasAlreadyOpen: boolean): Promise<void>;
|
|
102
103
|
/** sets up the interval to empty the queue as we receive confirmation messages from metroplex */
|
|
103
104
|
setupRetryMechanism(): void;
|
|
104
|
-
/** sets up events that will trigger the event queue to be emptied */
|
|
105
|
-
_setupOffloadEvents(): void;
|
|
106
105
|
/**
|
|
107
106
|
* will handle the final moments of a page being active. It
|
|
108
107
|
* will try to empty both the queues with beacons.
|
|
@@ -113,25 +112,21 @@ export default class MetroplexSocket extends Singleton {
|
|
|
113
112
|
* will try to empty both the queues with beacons.
|
|
114
113
|
*/
|
|
115
114
|
postFullPageVisit(maxMessageSize: number): Promise<void>;
|
|
116
|
-
/**
|
|
117
|
-
|
|
118
|
-
*/
|
|
119
|
-
postMessage(msg: CompletePageVisit): Promise<void>;
|
|
115
|
+
/** will send a message to metroplex via a post request that will outlive the current page */
|
|
116
|
+
postMessage(msg: MetroplexInputRouteMap[MetroplexRoute.PageVisit]): Promise<void>;
|
|
120
117
|
/**
|
|
121
118
|
* Stringifies the payload into JSON, sends it to the back end if the session
|
|
122
119
|
* is active and returns true. If inactive the session and socket are closed
|
|
123
120
|
* and this method returns false.
|
|
124
121
|
*/
|
|
125
|
-
|
|
122
|
+
private sendSocketMessage;
|
|
126
123
|
/**
|
|
127
124
|
* Closes the socket connection if the session is inactive. Returns true if the
|
|
128
125
|
* session is inactive
|
|
129
126
|
*/
|
|
130
127
|
closeIfInactive(): Promise<boolean>;
|
|
131
128
|
/** will get page information, calling this will increase the connection count */
|
|
132
|
-
getPageInformation(): Promise<
|
|
133
|
-
/**
|
|
134
|
-
* Try to parse help code response and fire custom event
|
|
135
|
-
*/
|
|
129
|
+
getPageInformation(): Promise<PageInformation>;
|
|
130
|
+
/** Try to parse help code response and fire custom event */
|
|
136
131
|
_tryProcessHelpCodeResponse(response: unknown): boolean;
|
|
137
132
|
}
|