noibu-react-native 0.2.8 → 0.2.10
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/dist/api/ClientConfig.d.ts +1 -1
- package/dist/api/ClientConfig.js +1 -2
- package/dist/api/HelpCode.js +1 -2
- package/dist/api/InputManager.js +2 -4
- package/dist/api/MetroplexSocket.d.ts +3 -3
- package/dist/api/MetroplexSocket.js +7 -12
- package/dist/api/StoredPageVisit.d.ts +1 -1
- package/dist/api/StoredPageVisit.js +3 -6
- package/dist/constants.js +2 -2
- package/dist/entry/init.js +1 -2
- package/dist/monitors/AppNavigationMonitor.js +1 -3
- package/dist/monitors/ClickMonitor.js +1 -3
- package/dist/monitors/ErrorMonitor.js +1 -2
- package/dist/monitors/KeyboardInputMonitor.js +1 -3
- package/dist/monitors/PageMonitor.js +1 -2
- package/dist/monitors/RequestMonitor.js +1 -3
- package/dist/monitors/http-tools/GqlErrorValidator.d.ts +1 -1
- package/dist/monitors/http-tools/GqlErrorValidator.js +1 -2
- package/dist/monitors/http-tools/HTTPDataBundler.d.ts +1 -1
- package/dist/monitors/http-tools/HTTPDataBundler.js +1 -2
- package/dist/pageVisit/EventDebouncer.d.ts +1 -1
- package/dist/pageVisit/HttpEventManager.d.ts +1 -1
- package/dist/pageVisit/HttpEventManager.js +2 -4
- package/dist/pageVisit/PageVisitManager.d.ts +1 -1
- package/dist/pageVisit/PageVisitManager.js +2 -3
- package/dist/pageVisit/pageVisitEventError.d.ts +1 -1
- package/dist/pageVisit/pageVisitEventError.js +4 -8
- package/dist/sessionRecorder/SessionRecorder.js +2 -4
- package/dist/utils/date.js +1 -2
- package/dist/utils/function.d.ts +2 -2
- package/package.json +4 -2
package/dist/api/ClientConfig.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { __awaiter } from 'tslib';
|
|
2
2
|
import uuid from 'react-native-uuid';
|
|
3
|
-
import '
|
|
3
|
+
import { Severity } from 'noibu-metroplex-ts-bindings';
|
|
4
4
|
import { MAX_METROPLEX_SOCKET_INNACTIVE_TIME, GET_SCRIPT_ID, GET_DEVICE_ENV } from '../constants.js';
|
|
5
5
|
import { stringifyJSON, getMaxSubstringAllowed, getUserAgent, postRequest } from '../utils/function.js';
|
|
6
6
|
import Storage from '../storage/Storage.js';
|
|
7
7
|
import { noibuLog } from '../utils/log.js';
|
|
8
8
|
import { unwrapNoibuWrapped } from '../utils/object.js';
|
|
9
9
|
import { Singleton } from '../monitors/BaseMonitor.js';
|
|
10
|
-
import { Severity } from '../node_modules/@noibu/metroplex-ts-bindings/dist/Severity.js';
|
|
11
10
|
|
|
12
11
|
// maximum number of page visits assigned to a single browser id
|
|
13
12
|
const MAX_PAGEVISIT_VISITED = 300;
|
package/dist/api/HelpCode.js
CHANGED
|
@@ -2,8 +2,7 @@ import { __awaiter } from 'tslib';
|
|
|
2
2
|
import MetroplexSocket from './MetroplexSocket.js';
|
|
3
3
|
import ClientConfig from './ClientConfig.js';
|
|
4
4
|
import { Singleton } from '../monitors/BaseMonitor.js';
|
|
5
|
-
import '
|
|
6
|
-
import { Severity } from '../node_modules/@noibu/metroplex-ts-bindings/dist/Severity.js';
|
|
5
|
+
import { Severity } from 'noibu-metroplex-ts-bindings';
|
|
7
6
|
|
|
8
7
|
/**
|
|
9
8
|
* HelpCode class is responsible for help code feature related functionality
|
package/dist/api/InputManager.js
CHANGED
|
@@ -3,9 +3,7 @@ import MetroplexSocket from './MetroplexSocket.js';
|
|
|
3
3
|
import { saveErrorToPagevisit } from '../pageVisit/pageVisitEventError.js';
|
|
4
4
|
import HelpCode from './HelpCode.js';
|
|
5
5
|
import { Singleton } from '../monitors/BaseMonitor.js';
|
|
6
|
-
import '
|
|
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';
|
|
6
|
+
import { PageVisitErrorSource, MetroplexMessageType } from 'noibu-metroplex-ts-bindings';
|
|
9
7
|
|
|
10
8
|
// maximum ids that a user can add to a pagevisit
|
|
11
9
|
const MAX_CUSTOM_IDS_PER_PAGEVISIT = 10;
|
|
@@ -115,7 +113,7 @@ class InputManager extends Singleton {
|
|
|
115
113
|
}
|
|
116
114
|
this.customIDs[name] = value;
|
|
117
115
|
yield MetroplexSocket.getInstance().sendMessage({
|
|
118
|
-
type:
|
|
116
|
+
type: MetroplexMessageType.PageVisitMeta,
|
|
119
117
|
payload: {
|
|
120
118
|
id_name: name,
|
|
121
119
|
id_val: value,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MetroplexInputRouteMap, MetroplexRoute, PageInformation, PageVisitEvent, VideoRecorder,
|
|
1
|
+
import { MetroplexInputRouteMap, MetroplexRoute, PageInformation, PageVisitEvent, VideoRecorder, MetroplexMessageType } from 'noibu-metroplex-ts-bindings';
|
|
2
2
|
import { Singleton } from '../monitors/BaseMonitor';
|
|
3
3
|
import { NoSeqNumSlidingMessage, RetryQueueWSMessage } from '../types/Metroplex';
|
|
4
4
|
/**
|
|
@@ -29,7 +29,7 @@ export default class MetroplexSocket extends Singleton {
|
|
|
29
29
|
isRetryLoopDisabled: boolean;
|
|
30
30
|
/** messages that need to be resent to metroplex since they are lacking confirmation */
|
|
31
31
|
retryMessageQueue: RetryQueueWSMessage[];
|
|
32
|
-
metroplexTypeLock: Record<
|
|
32
|
+
metroplexTypeLock: Record<MetroplexMessageType, boolean>;
|
|
33
33
|
initialURL: string;
|
|
34
34
|
initialReferringURL: string;
|
|
35
35
|
sessionTimestamp: Date;
|
|
@@ -67,7 +67,7 @@ export default class MetroplexSocket extends Singleton {
|
|
|
67
67
|
* Queues the message if the connection isn't open yet.
|
|
68
68
|
* returns true if message was sent succefully, false otherwise
|
|
69
69
|
*/
|
|
70
|
-
sendMessage(message: NoSeqNumSlidingMessage<RetryQueueWSMessage<
|
|
70
|
+
sendMessage(message: NoSeqNumSlidingMessage<RetryQueueWSMessage<MetroplexMessageType>>): Promise<boolean>;
|
|
71
71
|
/** Updates the latest pv message sent timestamp if events contain any user steps
|
|
72
72
|
*/
|
|
73
73
|
_updateLatestPvTimestamp(events: PageVisitEvent[]): Promise<void>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __awaiter } from 'tslib';
|
|
2
2
|
import uuid from 'react-native-uuid';
|
|
3
3
|
import { Platform } from 'react-native';
|
|
4
|
-
import { MetroplexRoute } from '
|
|
4
|
+
import { MetroplexRoute, MetroplexMessageType, WorkRequestMessageType, EventType, Severity, InboundMessageType } from 'noibu-metroplex-ts-bindings';
|
|
5
5
|
import { getUserAgent, stringifyJSON } from '../utils/function.js';
|
|
6
6
|
import { addSafeEventListener } from '../utils/eventlistener.js';
|
|
7
7
|
import { GET_METROPLEX_BASE_SOCKET_URL, GET_METROPLEX_POST_URL, GET_MAX_METROPLEX_RECONNECTION_NUMBER, GET_METROPLEX_CONSECUTIVE_CONNECTION_DELAY, MAX_BEACON_PAYLOAD_SIZE, CURRENT_NOIBUJS_VERSION, GET_SCRIPT_ID } from '../constants.js';
|
|
@@ -13,11 +13,6 @@ import { isDateOverwritten } from '../utils/date.js';
|
|
|
13
13
|
import { unwrapNoibuWrapped } from '../utils/object.js';
|
|
14
14
|
import { noibuLog } from '../utils/log.js';
|
|
15
15
|
import { Singleton } from '../monitors/BaseMonitor.js';
|
|
16
|
-
import { WebsocketMessageType } from '../node_modules/@noibu/metroplex-ts-bindings/dist/WebsocketMessageType.js';
|
|
17
|
-
import { WorkRequestMessageType } from '../node_modules/@noibu/metroplex-ts-bindings/dist/WorkRequestMessageType.js';
|
|
18
|
-
import { EventType } from '../node_modules/@noibu/metroplex-ts-bindings/dist/EventType.js';
|
|
19
|
-
import { Severity } from '../node_modules/@noibu/metroplex-ts-bindings/dist/Severity.js';
|
|
20
|
-
import { InboundMessageType } from '../node_modules/@noibu/metroplex-ts-bindings/dist/InboundMessageType.js';
|
|
21
16
|
|
|
22
17
|
/**
|
|
23
18
|
* Grab the video recorder type based on the device we run the app on.
|
|
@@ -177,7 +172,7 @@ class MetroplexSocket extends Singleton {
|
|
|
177
172
|
/** requests help code and saves a callback to be called on response */
|
|
178
173
|
requestHelpCode(cb) {
|
|
179
174
|
this.helpCodeCb = cb;
|
|
180
|
-
return this.sendMessage({ type:
|
|
175
|
+
return this.sendMessage({ type: MetroplexMessageType.WorkRequest, payload: WorkRequestMessageType.HelpCode });
|
|
181
176
|
}
|
|
182
177
|
/**
|
|
183
178
|
* Immediately sends a message to Metroplex over the web socket
|
|
@@ -196,7 +191,7 @@ class MetroplexSocket extends Singleton {
|
|
|
196
191
|
});
|
|
197
192
|
return false;
|
|
198
193
|
}
|
|
199
|
-
const withSeqNum = type ===
|
|
194
|
+
const withSeqNum = type === MetroplexMessageType.WorkRequest
|
|
200
195
|
? message
|
|
201
196
|
: yield this._addSeqNumToPayload(message);
|
|
202
197
|
// send the socket message if we are connected and have sent page visit info
|
|
@@ -208,7 +203,7 @@ class MetroplexSocket extends Singleton {
|
|
|
208
203
|
// Only update the last message send if its a page visit with user action
|
|
209
204
|
// ensure this is done regardless of whether socket is connected or not,
|
|
210
205
|
// so that pagehide will post PV if user is active but socket is not
|
|
211
|
-
if (withSeqNum.type ===
|
|
206
|
+
if (withSeqNum.type === MetroplexMessageType.PageVisitPart) {
|
|
212
207
|
yield this._updateLatestPvTimestamp(withSeqNum.payload.events || []);
|
|
213
208
|
}
|
|
214
209
|
return true;
|
|
@@ -560,13 +555,13 @@ class MetroplexSocket extends Singleton {
|
|
|
560
555
|
currentMsgPayloadSize = currentPayloadSize;
|
|
561
556
|
}
|
|
562
557
|
switch (msg.type) {
|
|
563
|
-
case
|
|
558
|
+
case MetroplexMessageType.PageVisitVideoFile:
|
|
564
559
|
currentCompletePv.pvvf.push(msg.payload);
|
|
565
560
|
break;
|
|
566
|
-
case
|
|
561
|
+
case MetroplexMessageType.PageVisitPart:
|
|
567
562
|
currentCompletePv.pvp.push(msg.payload);
|
|
568
563
|
break;
|
|
569
|
-
case
|
|
564
|
+
case MetroplexMessageType.PageVisitHttp:
|
|
570
565
|
(_c = (_b = currentCompletePv.pvh) === null || _b === void 0 ? void 0 : _b.push) === null || _c === void 0 ? void 0 : _c.call(_b, msg.payload);
|
|
571
566
|
break;
|
|
572
567
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Singleton } from '../monitors/BaseMonitor';
|
|
2
2
|
import { RetryQueueWSMessage } from '../types/Metroplex';
|
|
3
|
-
import { CompletePageVisitPart, PageInformation, PageVisitPart } from '
|
|
3
|
+
import { CompletePageVisitPart, PageInformation, PageVisitPart } from 'noibu-metroplex-ts-bindings';
|
|
4
4
|
/**
|
|
5
5
|
* This class holds the final page visit. It flushes it to storage and then
|
|
6
6
|
* finally sends it to Metroplex via the post route when the next page is loaded
|
|
@@ -4,10 +4,7 @@ import ClientConfig from './ClientConfig.js';
|
|
|
4
4
|
import { stringifyJSON, postRequest } from '../utils/function.js';
|
|
5
5
|
import Storage from '../storage/Storage.js';
|
|
6
6
|
import { Singleton } from '../monitors/BaseMonitor.js';
|
|
7
|
-
import '
|
|
8
|
-
import { WebsocketMessageType } from '../node_modules/@noibu/metroplex-ts-bindings/dist/WebsocketMessageType.js';
|
|
9
|
-
import { EventType } from '../node_modules/@noibu/metroplex-ts-bindings/dist/EventType.js';
|
|
10
|
-
import { Severity } from '../node_modules/@noibu/metroplex-ts-bindings/dist/Severity.js';
|
|
7
|
+
import { MetroplexMessageType, EventType, Severity } from 'noibu-metroplex-ts-bindings';
|
|
11
8
|
|
|
12
9
|
// The local storage key used to store the last page visit
|
|
13
10
|
const NOIBU_STORED_PAGE_VISIT = 'n_stored_page_visit';
|
|
@@ -33,7 +30,7 @@ class StoredPageVisit extends Singleton {
|
|
|
33
30
|
// Get the events from the last message
|
|
34
31
|
const { type, payload } = retryMessageQueue[retryMessageQueue.length - 1];
|
|
35
32
|
// Only store page visit payloads
|
|
36
|
-
if (type !==
|
|
33
|
+
if (type !== MetroplexMessageType.PageVisitPart || !payload) {
|
|
37
34
|
return;
|
|
38
35
|
}
|
|
39
36
|
const events = payload.events ? payload.events : [];
|
|
@@ -53,7 +50,7 @@ class StoredPageVisit extends Singleton {
|
|
|
53
50
|
const pageVisitFrags = [];
|
|
54
51
|
for (let i = 0; i < retryMessageQueue.length; i += 1) {
|
|
55
52
|
const { type, payload } = retryMessageQueue[i];
|
|
56
|
-
if (type ===
|
|
53
|
+
if (type === MetroplexMessageType.PageVisitPart) {
|
|
57
54
|
pageVisitFrags.push(payload);
|
|
58
55
|
}
|
|
59
56
|
}
|
package/dist/constants.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MetroplexRoute } from '
|
|
1
|
+
import { MetroplexRoute } from 'noibu-metroplex-ts-bindings';
|
|
2
2
|
|
|
3
3
|
/** @module Constants */
|
|
4
4
|
// current collect version to be sent to front end services
|
|
@@ -24,7 +24,7 @@ const CONTENT_TYPE = 'content-type';
|
|
|
24
24
|
* Gets the script id from the cookie object, returns default if cannot be found
|
|
25
25
|
*/
|
|
26
26
|
function GET_SCRIPT_ID() {
|
|
27
|
-
return "1.0.104-rn-sdk-0.2.
|
|
27
|
+
return "1.0.104-rn-sdk-0.2.10" ;
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
30
30
|
* Gets the max metro recon number
|
package/dist/entry/init.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __awaiter } from 'tslib';
|
|
2
2
|
import uuid from 'react-native-uuid';
|
|
3
|
-
import { MetroplexRoute } from '
|
|
3
|
+
import { MetroplexRoute, Severity } from 'noibu-metroplex-ts-bindings';
|
|
4
4
|
import { KeyboardInputMonitor } from '../monitors/KeyboardInputMonitor.js';
|
|
5
5
|
import { PageMonitor } from '../monitors/PageMonitor.js';
|
|
6
6
|
import { GET_METROPLEX_BASE_SOCKET_URL, GET_METROPLEX_BASE_HTTP_URL } from '../constants.js';
|
|
@@ -17,7 +17,6 @@ import { ClickMonitor } from '../monitors/ClickMonitor.js';
|
|
|
17
17
|
import { ErrorMonitor } from '../monitors/ErrorMonitor.js';
|
|
18
18
|
import { HTTPDataBundler } from '../monitors/http-tools/HTTPDataBundler.js';
|
|
19
19
|
import RequestMonitor from '../monitors/RequestMonitor.js';
|
|
20
|
-
import { Severity } from '../node_modules/@noibu/metroplex-ts-bindings/dist/Severity.js';
|
|
21
20
|
|
|
22
21
|
// urls needed to communicate with our fe components
|
|
23
22
|
const REQUIRED_DATA_PROCESSING_URLS = ['metroplexSocketBase', 'metroplexHTTPBase', 'domain'];
|
|
@@ -2,9 +2,7 @@ import { ReactNativeNavigationIntegration } from './integrations/ReactNativeNavi
|
|
|
2
2
|
import ClientConfig from '../api/ClientConfig.js';
|
|
3
3
|
import { EventDebouncer } from '../pageVisit/EventDebouncer.js';
|
|
4
4
|
import { Singleton } from './BaseMonitor.js';
|
|
5
|
-
import '
|
|
6
|
-
import { Severity } from '../node_modules/@noibu/metroplex-ts-bindings/dist/Severity.js';
|
|
7
|
-
import { EventType } from '../node_modules/@noibu/metroplex-ts-bindings/dist/EventType.js';
|
|
5
|
+
import { Severity, EventType } from 'noibu-metroplex-ts-bindings';
|
|
8
6
|
|
|
9
7
|
/** Attaches corresponding listener to the passed navigation integration */
|
|
10
8
|
class AppNavigationMonitor extends Singleton {
|
|
@@ -6,9 +6,7 @@ import { maskTextInput } from '../utils/function.js';
|
|
|
6
6
|
import ClientConfig from '../api/ClientConfig.js';
|
|
7
7
|
import { Singleton } from './BaseMonitor.js';
|
|
8
8
|
import { isNoibuWrapped, replace, unwrapNoibuWrapped } from '../utils/object.js';
|
|
9
|
-
import '
|
|
10
|
-
import { UserStepType } from '../node_modules/@noibu/metroplex-ts-bindings/dist/UserStepType.js';
|
|
11
|
-
import { EventType } from '../node_modules/@noibu/metroplex-ts-bindings/dist/EventType.js';
|
|
9
|
+
import { UserStepType, EventType } from 'noibu-metroplex-ts-bindings';
|
|
12
10
|
|
|
13
11
|
/** @module ClickMonitor */
|
|
14
12
|
/**
|
|
@@ -2,9 +2,8 @@ import { asString, isStackTrace } from '../utils/function.js';
|
|
|
2
2
|
import { saveErrorToPagevisit } from '../pageVisit/pageVisitEventError.js';
|
|
3
3
|
import { replace } from '../utils/object.js';
|
|
4
4
|
import { Singleton } from './BaseMonitor.js';
|
|
5
|
-
import '
|
|
5
|
+
import { PageVisitErrorSource } from 'noibu-metroplex-ts-bindings';
|
|
6
6
|
import ClientConfig from '../api/ClientConfig.js';
|
|
7
|
-
import { PageVisitErrorSource } from '../node_modules/@noibu/metroplex-ts-bindings/dist/PageVisitErrorSource.js';
|
|
8
7
|
|
|
9
8
|
/* eslint-disable @typescript-eslint/ban-types,prefer-arrow-callback */
|
|
10
9
|
/** @module ErrorMonitor */
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { EventDebouncer } from '../pageVisit/EventDebouncer.js';
|
|
2
2
|
import { TextInput } from 'react-native';
|
|
3
3
|
import { Singleton } from './BaseMonitor.js';
|
|
4
|
-
import '
|
|
5
|
-
import { EventType } from '../node_modules/@noibu/metroplex-ts-bindings/dist/EventType.js';
|
|
6
|
-
import { UserStepType } from '../node_modules/@noibu/metroplex-ts-bindings/dist/UserStepType.js';
|
|
4
|
+
import { EventType, UserStepType } from 'noibu-metroplex-ts-bindings';
|
|
7
5
|
|
|
8
6
|
/** @module KeyboardInputMonitor */
|
|
9
7
|
/**
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { addSafeEventListener } from '../utils/eventlistener.js';
|
|
2
2
|
import { EventDebouncer } from '../pageVisit/EventDebouncer.js';
|
|
3
3
|
import { Singleton } from './BaseMonitor.js';
|
|
4
|
-
import '
|
|
5
|
-
import { EventType } from '../node_modules/@noibu/metroplex-ts-bindings/dist/EventType.js';
|
|
4
|
+
import { EventType } from 'noibu-metroplex-ts-bindings';
|
|
6
5
|
|
|
7
6
|
/** @module PageMonitor */
|
|
8
7
|
const PAGE_EVENTS_DOCUMENT = ['visibilitychange', 'resume', 'freeze', 'readystatechange', 'cut', 'copy', 'paste'];
|
|
@@ -10,9 +10,7 @@ import { addSafeEventListener } from '../utils/eventlistener.js';
|
|
|
10
10
|
import { HTTPDataBundler } from './http-tools/HTTPDataBundler.js';
|
|
11
11
|
import GqlErrorValidator from './http-tools/GqlErrorValidator.js';
|
|
12
12
|
import { Singleton } from './BaseMonitor.js';
|
|
13
|
-
import '
|
|
14
|
-
import { Severity } from '../node_modules/@noibu/metroplex-ts-bindings/dist/Severity.js';
|
|
15
|
-
import { PageVisitErrorSource } from '../node_modules/@noibu/metroplex-ts-bindings/dist/PageVisitErrorSource.js';
|
|
13
|
+
import { Severity, PageVisitErrorSource } from 'noibu-metroplex-ts-bindings';
|
|
16
14
|
|
|
17
15
|
/** request monitor */
|
|
18
16
|
const BODY_USED_ERROR = 'Response data unavailable due to an improperly wrapped fetch call';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GQLError } from '
|
|
1
|
+
import { GQLError } from 'noibu-metroplex-ts-bindings';
|
|
2
2
|
/** Try detecting GraphQL errors from http response */
|
|
3
3
|
export default class GqlErrorValidator {
|
|
4
4
|
/** Retrieves GQL error object based on fetch request/response */
|
|
@@ -2,8 +2,7 @@ import { __awaiter } from 'tslib';
|
|
|
2
2
|
import { isInstanceOf, getMaxSubstringAllowed } from '../../utils/function.js';
|
|
3
3
|
import { CONTENT_TYPE } from '../../constants.js';
|
|
4
4
|
import ClientConfig from '../../api/ClientConfig.js';
|
|
5
|
-
import '
|
|
6
|
-
import { Severity } from '../../node_modules/@noibu/metroplex-ts-bindings/dist/Severity.js';
|
|
5
|
+
import { Severity } from 'noibu-metroplex-ts-bindings';
|
|
7
6
|
|
|
8
7
|
const GQL_EXTENSIONS_ATT_NAME = 'extensions';
|
|
9
8
|
const GQL_LOCATIONS_ATT_NAME = 'locations';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Singleton } from '../BaseMonitor';
|
|
2
2
|
import { NoSeq } from '../../types/Metroplex';
|
|
3
|
-
import { RawHttpData } from '
|
|
3
|
+
import { RawHttpData } from 'noibu-metroplex-ts-bindings';
|
|
4
4
|
/** Bundles HTTP payloads and headers */
|
|
5
5
|
export declare class HTTPDataBundler extends Singleton {
|
|
6
6
|
contentTypeReadableRegex: RegExp;
|
|
@@ -6,8 +6,7 @@ import { safeFromEntries, safeEntries } from '../../utils/object.js';
|
|
|
6
6
|
import { safeTrim, stringifyJSON } from '../../utils/function.js';
|
|
7
7
|
import { removePII } from '../../utils/piiRedactor.js';
|
|
8
8
|
import { Singleton } from '../BaseMonitor.js';
|
|
9
|
-
import '
|
|
10
|
-
import { Severity } from '../../node_modules/@noibu/metroplex-ts-bindings/dist/Severity.js';
|
|
9
|
+
import { Severity } from 'noibu-metroplex-ts-bindings';
|
|
11
10
|
|
|
12
11
|
const DEFAULT_WEBSITE_SUBDOMAIN_PATTERN = /^www\d{0,2}$/;
|
|
13
12
|
const CONTENT_LENGTH = 'content-length';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Singleton } from '../monitors/BaseMonitor';
|
|
2
|
-
import { EventType, PageVisitEvent, UserStepType } from '
|
|
2
|
+
import { EventType, PageVisitEvent, UserStepType } from 'noibu-metroplex-ts-bindings';
|
|
3
3
|
/**
|
|
4
4
|
* Singleton class responsible for debouncing all events
|
|
5
5
|
* that are registered
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NoSeq } from '../types/Metroplex';
|
|
2
|
-
import { PageVisitEventHTTP, RawHttpData } from '
|
|
2
|
+
import { PageVisitEventHTTP, RawHttpData } from 'noibu-metroplex-ts-bindings';
|
|
3
3
|
/** Saves the HTTP event to the pageVisit Queue */
|
|
4
4
|
export declare function saveHTTPEvent(httpEvent: Partial<PageVisitEventHTTP>, httpData?: NoSeq<RawHttpData> | null, isGqlError?: boolean): number | undefined;
|
|
5
5
|
/** Determines if a response is a failure */
|
|
@@ -3,9 +3,7 @@ import StoredMetrics from '../api/StoredMetrics.js';
|
|
|
3
3
|
import MetroplexSocket from '../api/MetroplexSocket.js';
|
|
4
4
|
import { safeTrim, getMaxSubstringAllowed, asString } from '../utils/function.js';
|
|
5
5
|
import { EventDebouncer } from './EventDebouncer.js';
|
|
6
|
-
import '
|
|
7
|
-
import { WebsocketMessageType } from '../node_modules/@noibu/metroplex-ts-bindings/dist/WebsocketMessageType.js';
|
|
8
|
-
import { EventType } from '../node_modules/@noibu/metroplex-ts-bindings/dist/EventType.js';
|
|
6
|
+
import { MetroplexMessageType, EventType } from 'noibu-metroplex-ts-bindings';
|
|
9
7
|
|
|
10
8
|
/** @module PageVisitEventHTTP */
|
|
11
9
|
/** http event manager */
|
|
@@ -44,7 +42,7 @@ function saveHTTPEvent(httpEvent, httpData, isGqlError = false) {
|
|
|
44
42
|
validatedEvent.seq = sequenceNumber;
|
|
45
43
|
// increment the count
|
|
46
44
|
StoredMetrics.getInstance().addHttpData();
|
|
47
|
-
MetroplexSocket.getInstance().sendMessage({ type:
|
|
45
|
+
MetroplexSocket.getInstance().sendMessage({ type: MetroplexMessageType.PageVisitHttp, payload: httpDataWithSeq });
|
|
48
46
|
}
|
|
49
47
|
else {
|
|
50
48
|
// have collected more than the max number of http requests for this
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Singleton } from '../monitors/BaseMonitor';
|
|
2
|
-
import { PageVisitEvent } from '
|
|
2
|
+
import { PageVisitEvent } from 'noibu-metroplex-ts-bindings';
|
|
3
3
|
/**
|
|
4
4
|
* Singleton class to hold all the information
|
|
5
5
|
* about the gathered errors throught the session
|
|
@@ -4,8 +4,7 @@ import StoredMetrics from '../api/StoredMetrics.js';
|
|
|
4
4
|
import { noibuLog } from '../utils/log.js';
|
|
5
5
|
import { Singleton } from '../monitors/BaseMonitor.js';
|
|
6
6
|
import { getOccurredNow } from '../utils/date.js';
|
|
7
|
-
import '
|
|
8
|
-
import { WebsocketMessageType } from '../node_modules/@noibu/metroplex-ts-bindings/dist/WebsocketMessageType.js';
|
|
7
|
+
import { MetroplexMessageType } from 'noibu-metroplex-ts-bindings';
|
|
9
8
|
|
|
10
9
|
/** @module Pagevisit */
|
|
11
10
|
const MAX_PAGEVISIT_EVENTS = 200;
|
|
@@ -87,7 +86,7 @@ class PageVisitManager extends Singleton {
|
|
|
87
86
|
}
|
|
88
87
|
const pvp = MetroplexSocket.getInstance().addEndTimeToPayload({ events: this.pvEvents, pc: this.partCounter }, true);
|
|
89
88
|
StoredMetrics.getInstance().setPvPart(this.partCounter);
|
|
90
|
-
MetroplexSocket.getInstance().sendMessage({ payload: pvp, type:
|
|
89
|
+
MetroplexSocket.getInstance().sendMessage({ payload: pvp, type: MetroplexMessageType.PageVisitPart });
|
|
91
90
|
// since we sent the content of the buffer to metroplex, we reset
|
|
92
91
|
// all variables that contained information about the past buffer.
|
|
93
92
|
this.pvEvents = [];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Option, PageVisitEventError } from '
|
|
1
|
+
import { Option, PageVisitEventError } from 'noibu-metroplex-ts-bindings';
|
|
2
2
|
import { EventInput, PageVisitErrorInput } from '../types/PageVisitErrors';
|
|
3
3
|
/**
|
|
4
4
|
* gets the onURL of a string, defaulting to the location of the webpage
|
|
@@ -3,11 +3,7 @@ import { isValidURL, getJSStack, stringifyJSON, getMaxSubstringAllowed, asString
|
|
|
3
3
|
import ClientConfig from '../api/ClientConfig.js';
|
|
4
4
|
import StoredMetrics from '../api/StoredMetrics.js';
|
|
5
5
|
import { EventDebouncer } from './EventDebouncer.js';
|
|
6
|
-
import '
|
|
7
|
-
import { PageVisitErrorSource } from '../node_modules/@noibu/metroplex-ts-bindings/dist/PageVisitErrorSource.js';
|
|
8
|
-
import { EventType } from '../node_modules/@noibu/metroplex-ts-bindings/dist/EventType.js';
|
|
9
|
-
import { Severity } from '../node_modules/@noibu/metroplex-ts-bindings/dist/Severity.js';
|
|
10
|
-
import { ErrorType } from '../node_modules/@noibu/metroplex-ts-bindings/dist/ErrorType.js';
|
|
6
|
+
import { PageVisitErrorSource, EventType, Severity, ErrorType } from 'noibu-metroplex-ts-bindings';
|
|
11
7
|
|
|
12
8
|
const BLOCKLISTED_DOMAINS = {
|
|
13
9
|
'input.noibu.com': true,
|
|
@@ -59,7 +55,7 @@ function getPVErrorFromResponse(errPayload, seq) {
|
|
|
59
55
|
function getPVErrorFromErrorEvent(errPayload) {
|
|
60
56
|
return {
|
|
61
57
|
url: getOnURL(errPayload.filename || ClientConfig.getInstance().globalUrl),
|
|
62
|
-
type: ErrorType.
|
|
58
|
+
type: ErrorType.JS,
|
|
63
59
|
j_err: getJSStack(errPayload.error),
|
|
64
60
|
err_src: errPayload.type,
|
|
65
61
|
};
|
|
@@ -68,7 +64,7 @@ function getPVErrorFromErrorEvent(errPayload) {
|
|
|
68
64
|
function getPVErrorFromErrorLog(errPayload) {
|
|
69
65
|
return {
|
|
70
66
|
url: ClientConfig.getInstance().globalUrl,
|
|
71
|
-
type: ErrorType.
|
|
67
|
+
type: ErrorType.JS,
|
|
72
68
|
j_err: getJSStack(errPayload),
|
|
73
69
|
err_src: PageVisitErrorSource.ErrorLogEvent,
|
|
74
70
|
};
|
|
@@ -138,7 +134,7 @@ function createPageVisitEventError(payload, httpDataSeqNum) {
|
|
|
138
134
|
function getCollectErrorMsg(pvError) {
|
|
139
135
|
var _a, _b;
|
|
140
136
|
switch (pvError.type) {
|
|
141
|
-
case ErrorType.
|
|
137
|
+
case ErrorType.JS: {
|
|
142
138
|
if (!((_b = (_a = pvError.j_err) === null || _a === void 0 ? void 0 : _a.frames) === null || _b === void 0 ? void 0 : _b.length)) {
|
|
143
139
|
return false;
|
|
144
140
|
}
|
|
@@ -10,9 +10,7 @@ import { addSafeEventListener } from '../utils/eventlistener.js';
|
|
|
10
10
|
import { noibuLog } from '../utils/log.js';
|
|
11
11
|
import { Platform } from 'react-native';
|
|
12
12
|
import { Singleton } from '../monitors/BaseMonitor.js';
|
|
13
|
-
import '
|
|
14
|
-
import { Severity } from '../node_modules/@noibu/metroplex-ts-bindings/dist/Severity.js';
|
|
15
|
-
import { WebsocketMessageType } from '../node_modules/@noibu/metroplex-ts-bindings/dist/WebsocketMessageType.js';
|
|
13
|
+
import { Severity, MetroplexMessageType } from 'noibu-metroplex-ts-bindings';
|
|
16
14
|
|
|
17
15
|
// custom event name for posting metrics
|
|
18
16
|
const POST_METRICS_EVENT_NAME = 'noibuPostMetrics';
|
|
@@ -237,7 +235,7 @@ class SessionRecorder extends Singleton {
|
|
|
237
235
|
StoredMetrics.getInstance().addVideoFragData(this.vfCounter, totalVideoTime);
|
|
238
236
|
// constructing a client message that metroplex knows how to handle.
|
|
239
237
|
yield MetroplexSocket.getInstance().sendMessage({
|
|
240
|
-
type:
|
|
238
|
+
type: MetroplexMessageType.PageVisitVideoFile,
|
|
241
239
|
payload: videoFragment,
|
|
242
240
|
});
|
|
243
241
|
this.lastFragPostTimestamp = Date.now();
|
package/dist/utils/date.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import ClientConfig from '../api/ClientConfig.js';
|
|
2
|
-
import '
|
|
3
|
-
import { Severity } from '../node_modules/@noibu/metroplex-ts-bindings/dist/Severity.js';
|
|
2
|
+
import { Severity } from 'noibu-metroplex-ts-bindings';
|
|
4
3
|
|
|
5
4
|
/** @module Date */
|
|
6
5
|
/** Checks to see if the necessary Date functions that we use have been overwritten */
|
package/dist/utils/function.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { JSError } from '
|
|
1
|
+
import { JSError } from 'noibu-metroplex-ts-bindings';
|
|
2
2
|
import { RawStackFrame } from './stacktrace-parser';
|
|
3
3
|
/**
|
|
4
4
|
* returns a string that satisfies a max length
|
|
@@ -9,7 +9,7 @@ export declare function getMaxSubstringAllowed(stringToVerify: string, length?:
|
|
|
9
9
|
/**
|
|
10
10
|
* Processes the raw stack frames and creates a readable stack in a safe manner
|
|
11
11
|
*/
|
|
12
|
-
export declare function processFrames(rawFrames: RawStackFrame[]): import("
|
|
12
|
+
export declare function processFrames(rawFrames: RawStackFrame[]): import("noibu-metroplex-ts-bindings").JSStackFrame[];
|
|
13
13
|
/** Retrieves the javascript stack and message from an error event object */
|
|
14
14
|
export declare function getJSStack(errObj?: {
|
|
15
15
|
stack?: string | NativeStackAndroid;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "noibu-react-native",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.10",
|
|
4
4
|
"targetNjsVersion": "1.0.104",
|
|
5
5
|
"description": "React-Native SDK for NoibuJS to collect errors in React-Native applications",
|
|
6
6
|
"main": "dist/entry/index.js",
|
|
@@ -26,6 +26,9 @@
|
|
|
26
26
|
"optional": true
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"noibu-metroplex-ts-bindings": "1.0.29"
|
|
31
|
+
},
|
|
29
32
|
"optionalDependencies": {
|
|
30
33
|
"@react-native-async-storage/async-storage": "^1.19.0",
|
|
31
34
|
"fflate": "^0.8.2",
|
|
@@ -49,7 +52,6 @@
|
|
|
49
52
|
"@babel/preset-typescript": "^7.26.0",
|
|
50
53
|
"@eslint/eslintrc": "^3.2.0",
|
|
51
54
|
"@jest/globals": "^29.7.0",
|
|
52
|
-
"@noibu/metroplex-ts-bindings": "1.0.25",
|
|
53
55
|
"@react-native-async-storage/async-storage": "^1.19.0",
|
|
54
56
|
"@rollup/plugin-commonjs": "^25.0.0",
|
|
55
57
|
"@rollup/plugin-json": "^6.0.0",
|