noibu-react-native 0.2.9 → 0.2.11
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/android/build.gradle +1 -1
- package/android/src/main/java/com/noibu/sessionreplay/reactnative/NoibuSessionReplayModule.kt +5 -2
- package/dist/api/InputManager.js +2 -2
- package/dist/api/MetroplexSocket.d.ts +3 -3
- package/dist/api/MetroplexSocket.js +7 -7
- package/dist/api/StoredPageVisit.js +3 -3
- package/dist/constants.js +1 -1
- package/dist/monitors/KeyboardInputMonitor.test.d.ts +1 -0
- package/dist/pageVisit/HttpEventManager.js +2 -2
- package/dist/pageVisit/PageVisitManager.js +2 -2
- package/dist/pageVisit/pageVisitEventError.js +3 -3
- package/dist/sessionRecorder/SessionRecorder.js +2 -2
- package/package.json +2 -2
package/android/build.gradle
CHANGED
|
@@ -67,7 +67,7 @@ def kotlin_version = getExtOrDefault("kotlinVersion")
|
|
|
67
67
|
dependencies {
|
|
68
68
|
implementation "com.facebook.react:react-native:+"
|
|
69
69
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
70
|
-
implementation "com.noibu:sessionreplay-recorder:0.2.
|
|
70
|
+
implementation "com.noibu:sessionreplay-recorder:0.2.2"
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
if (isNewArchitectureEnabled()) {
|
package/android/src/main/java/com/noibu/sessionreplay/reactnative/NoibuSessionReplayModule.kt
CHANGED
|
@@ -24,7 +24,6 @@ class NoibuSessionReplayModule(reactContext: ReactApplicationContext) :
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
private fun sendEvent(eventName: String, params: WritableMap?) {
|
|
27
|
-
Log.d("SessionReplayModule", "will send event: ${params}")
|
|
28
27
|
reactContext?.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)?.emit(eventName, params)
|
|
29
28
|
}
|
|
30
29
|
|
|
@@ -64,9 +63,13 @@ class NoibuSessionReplayModule(reactContext: ReactApplicationContext) :
|
|
|
64
63
|
)
|
|
65
64
|
|
|
66
65
|
Handler(Looper.getMainLooper()).post {
|
|
66
|
+
val context = currentActivity?.applicationContext ?: reactContext?.applicationContext ?: run {
|
|
67
|
+
promise.reject("ACTIVITY_NOT_AVAILABLE", "Current activity is not available.")
|
|
68
|
+
return@post
|
|
69
|
+
}
|
|
67
70
|
promise.resolve(
|
|
68
71
|
SessionReplay.initialize(
|
|
69
|
-
|
|
72
|
+
context,
|
|
70
73
|
config,
|
|
71
74
|
currentActivity
|
|
72
75
|
) { param ->
|
package/dist/api/InputManager.js
CHANGED
|
@@ -3,7 +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 { PageVisitErrorSource,
|
|
6
|
+
import { PageVisitErrorSource, MetroplexMessageType } from 'noibu-metroplex-ts-bindings';
|
|
7
7
|
|
|
8
8
|
// maximum ids that a user can add to a pagevisit
|
|
9
9
|
const MAX_CUSTOM_IDS_PER_PAGEVISIT = 10;
|
|
@@ -113,7 +113,7 @@ class InputManager extends Singleton {
|
|
|
113
113
|
}
|
|
114
114
|
this.customIDs[name] = value;
|
|
115
115
|
yield MetroplexSocket.getInstance().sendMessage({
|
|
116
|
-
type:
|
|
116
|
+
type: MetroplexMessageType.PageVisitMeta,
|
|
117
117
|
payload: {
|
|
118
118
|
id_name: name,
|
|
119
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,
|
|
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';
|
|
@@ -172,7 +172,7 @@ class MetroplexSocket extends Singleton {
|
|
|
172
172
|
/** requests help code and saves a callback to be called on response */
|
|
173
173
|
requestHelpCode(cb) {
|
|
174
174
|
this.helpCodeCb = cb;
|
|
175
|
-
return this.sendMessage({ type:
|
|
175
|
+
return this.sendMessage({ type: MetroplexMessageType.WorkRequest, payload: WorkRequestMessageType.HelpCode });
|
|
176
176
|
}
|
|
177
177
|
/**
|
|
178
178
|
* Immediately sends a message to Metroplex over the web socket
|
|
@@ -191,7 +191,7 @@ class MetroplexSocket extends Singleton {
|
|
|
191
191
|
});
|
|
192
192
|
return false;
|
|
193
193
|
}
|
|
194
|
-
const withSeqNum = type ===
|
|
194
|
+
const withSeqNum = type === MetroplexMessageType.WorkRequest
|
|
195
195
|
? message
|
|
196
196
|
: yield this._addSeqNumToPayload(message);
|
|
197
197
|
// send the socket message if we are connected and have sent page visit info
|
|
@@ -203,7 +203,7 @@ class MetroplexSocket extends Singleton {
|
|
|
203
203
|
// Only update the last message send if its a page visit with user action
|
|
204
204
|
// ensure this is done regardless of whether socket is connected or not,
|
|
205
205
|
// so that pagehide will post PV if user is active but socket is not
|
|
206
|
-
if (withSeqNum.type ===
|
|
206
|
+
if (withSeqNum.type === MetroplexMessageType.PageVisitPart) {
|
|
207
207
|
yield this._updateLatestPvTimestamp(withSeqNum.payload.events || []);
|
|
208
208
|
}
|
|
209
209
|
return true;
|
|
@@ -555,13 +555,13 @@ class MetroplexSocket extends Singleton {
|
|
|
555
555
|
currentMsgPayloadSize = currentPayloadSize;
|
|
556
556
|
}
|
|
557
557
|
switch (msg.type) {
|
|
558
|
-
case
|
|
558
|
+
case MetroplexMessageType.PageVisitVideoFile:
|
|
559
559
|
currentCompletePv.pvvf.push(msg.payload);
|
|
560
560
|
break;
|
|
561
|
-
case
|
|
561
|
+
case MetroplexMessageType.PageVisitPart:
|
|
562
562
|
currentCompletePv.pvp.push(msg.payload);
|
|
563
563
|
break;
|
|
564
|
-
case
|
|
564
|
+
case MetroplexMessageType.PageVisitHttp:
|
|
565
565
|
(_c = (_b = currentCompletePv.pvh) === null || _b === void 0 ? void 0 : _b.push) === null || _c === void 0 ? void 0 : _c.call(_b, msg.payload);
|
|
566
566
|
break;
|
|
567
567
|
}
|
|
@@ -4,7 +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 {
|
|
7
|
+
import { MetroplexMessageType, EventType, Severity } from 'noibu-metroplex-ts-bindings';
|
|
8
8
|
|
|
9
9
|
// The local storage key used to store the last page visit
|
|
10
10
|
const NOIBU_STORED_PAGE_VISIT = 'n_stored_page_visit';
|
|
@@ -30,7 +30,7 @@ class StoredPageVisit extends Singleton {
|
|
|
30
30
|
// Get the events from the last message
|
|
31
31
|
const { type, payload } = retryMessageQueue[retryMessageQueue.length - 1];
|
|
32
32
|
// Only store page visit payloads
|
|
33
|
-
if (type !==
|
|
33
|
+
if (type !== MetroplexMessageType.PageVisitPart || !payload) {
|
|
34
34
|
return;
|
|
35
35
|
}
|
|
36
36
|
const events = payload.events ? payload.events : [];
|
|
@@ -50,7 +50,7 @@ class StoredPageVisit extends Singleton {
|
|
|
50
50
|
const pageVisitFrags = [];
|
|
51
51
|
for (let i = 0; i < retryMessageQueue.length; i += 1) {
|
|
52
52
|
const { type, payload } = retryMessageQueue[i];
|
|
53
|
-
if (type ===
|
|
53
|
+
if (type === MetroplexMessageType.PageVisitPart) {
|
|
54
54
|
pageVisitFrags.push(payload);
|
|
55
55
|
}
|
|
56
56
|
}
|
package/dist/constants.js
CHANGED
|
@@ -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.11" ;
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
30
30
|
* Gets the max metro recon number
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -3,7 +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 {
|
|
6
|
+
import { MetroplexMessageType, EventType } from 'noibu-metroplex-ts-bindings';
|
|
7
7
|
|
|
8
8
|
/** @module PageVisitEventHTTP */
|
|
9
9
|
/** http event manager */
|
|
@@ -42,7 +42,7 @@ function saveHTTPEvent(httpEvent, httpData, isGqlError = false) {
|
|
|
42
42
|
validatedEvent.seq = sequenceNumber;
|
|
43
43
|
// increment the count
|
|
44
44
|
StoredMetrics.getInstance().addHttpData();
|
|
45
|
-
MetroplexSocket.getInstance().sendMessage({ type:
|
|
45
|
+
MetroplexSocket.getInstance().sendMessage({ type: MetroplexMessageType.PageVisitHttp, payload: httpDataWithSeq });
|
|
46
46
|
}
|
|
47
47
|
else {
|
|
48
48
|
// have collected more than the max number of http requests for this
|
|
@@ -4,7 +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 {
|
|
7
|
+
import { MetroplexMessageType } from 'noibu-metroplex-ts-bindings';
|
|
8
8
|
|
|
9
9
|
/** @module Pagevisit */
|
|
10
10
|
const MAX_PAGEVISIT_EVENTS = 200;
|
|
@@ -86,7 +86,7 @@ class PageVisitManager extends Singleton {
|
|
|
86
86
|
}
|
|
87
87
|
const pvp = MetroplexSocket.getInstance().addEndTimeToPayload({ events: this.pvEvents, pc: this.partCounter }, true);
|
|
88
88
|
StoredMetrics.getInstance().setPvPart(this.partCounter);
|
|
89
|
-
MetroplexSocket.getInstance().sendMessage({ payload: pvp, type:
|
|
89
|
+
MetroplexSocket.getInstance().sendMessage({ payload: pvp, type: MetroplexMessageType.PageVisitPart });
|
|
90
90
|
// since we sent the content of the buffer to metroplex, we reset
|
|
91
91
|
// all variables that contained information about the past buffer.
|
|
92
92
|
this.pvEvents = [];
|
|
@@ -55,7 +55,7 @@ function getPVErrorFromResponse(errPayload, seq) {
|
|
|
55
55
|
function getPVErrorFromErrorEvent(errPayload) {
|
|
56
56
|
return {
|
|
57
57
|
url: getOnURL(errPayload.filename || ClientConfig.getInstance().globalUrl),
|
|
58
|
-
type: ErrorType.
|
|
58
|
+
type: ErrorType.JS,
|
|
59
59
|
j_err: getJSStack(errPayload.error),
|
|
60
60
|
err_src: errPayload.type,
|
|
61
61
|
};
|
|
@@ -64,7 +64,7 @@ function getPVErrorFromErrorEvent(errPayload) {
|
|
|
64
64
|
function getPVErrorFromErrorLog(errPayload) {
|
|
65
65
|
return {
|
|
66
66
|
url: ClientConfig.getInstance().globalUrl,
|
|
67
|
-
type: ErrorType.
|
|
67
|
+
type: ErrorType.JS,
|
|
68
68
|
j_err: getJSStack(errPayload),
|
|
69
69
|
err_src: PageVisitErrorSource.ErrorLogEvent,
|
|
70
70
|
};
|
|
@@ -134,7 +134,7 @@ function createPageVisitEventError(payload, httpDataSeqNum) {
|
|
|
134
134
|
function getCollectErrorMsg(pvError) {
|
|
135
135
|
var _a, _b;
|
|
136
136
|
switch (pvError.type) {
|
|
137
|
-
case ErrorType.
|
|
137
|
+
case ErrorType.JS: {
|
|
138
138
|
if (!((_b = (_a = pvError.j_err) === null || _a === void 0 ? void 0 : _a.frames) === null || _b === void 0 ? void 0 : _b.length)) {
|
|
139
139
|
return false;
|
|
140
140
|
}
|
|
@@ -10,7 +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 { Severity,
|
|
13
|
+
import { Severity, MetroplexMessageType } from 'noibu-metroplex-ts-bindings';
|
|
14
14
|
|
|
15
15
|
// custom event name for posting metrics
|
|
16
16
|
const POST_METRICS_EVENT_NAME = 'noibuPostMetrics';
|
|
@@ -235,7 +235,7 @@ class SessionRecorder extends Singleton {
|
|
|
235
235
|
StoredMetrics.getInstance().addVideoFragData(this.vfCounter, totalVideoTime);
|
|
236
236
|
// constructing a client message that metroplex knows how to handle.
|
|
237
237
|
yield MetroplexSocket.getInstance().sendMessage({
|
|
238
|
-
type:
|
|
238
|
+
type: MetroplexMessageType.PageVisitVideoFile,
|
|
239
239
|
payload: videoFragment,
|
|
240
240
|
});
|
|
241
241
|
this.lastFragPostTimestamp = Date.now();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "noibu-react-native",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.11",
|
|
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",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"noibu-metroplex-ts-bindings": "1.0.
|
|
30
|
+
"noibu-metroplex-ts-bindings": "1.0.29"
|
|
31
31
|
},
|
|
32
32
|
"optionalDependencies": {
|
|
33
33
|
"@react-native-async-storage/async-storage": "^1.19.0",
|