@coralogix/browser 2.8.8 → 2.9.0
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/CHANGELOG.md +12 -0
- package/README.md +6 -0
- package/index.esm2.js +40 -5
- package/package.json +1 -1
- package/src/constants.d.ts +1 -0
- package/src/instrumentations/network/CoralogixFetchInstrumentation.d.ts +1 -0
- package/src/instrumentations/network/CoralogixXhrInstrumentation.d.ts +1 -0
- package/src/session/sessionManager.d.ts +3 -0
- package/src/types.d.ts +1 -0
- package/src/version.d.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
## 2.9.0 (2025-08-18)
|
|
2
|
+
|
|
3
|
+
### 🚀 Features
|
|
4
|
+
|
|
5
|
+
- **fingerprint:** Added user fingerprint. The fingerprint is generated and stored on each user’s machine for reuse, and will be used to calculate the unique users count.
|
|
6
|
+
|
|
7
|
+
## 2.8.9 (2025-07-24)
|
|
8
|
+
|
|
9
|
+
### 🩹 Fixes
|
|
10
|
+
|
|
11
|
+
- **sdk:** improve SDK shutdown handling
|
|
12
|
+
|
|
1
13
|
## 2.8.8 (2025-07-20)
|
|
2
14
|
|
|
3
15
|
### 🩹 Fixes
|
package/README.md
CHANGED
|
@@ -420,6 +420,12 @@ CoralogixRum.init({
|
|
|
420
420
|
});
|
|
421
421
|
```
|
|
422
422
|
|
|
423
|
+
### Unique Users
|
|
424
|
+
|
|
425
|
+
Starting with version `2.9.0`, the SDK calculates unique users based on the user’s `fingerprint`.<br>
|
|
426
|
+
The fingerprint is generated and stored on each user’s machine for reuse.<br>
|
|
427
|
+
In earlier versions, the SDK used user_id to calculate unique users, which is still supported for backward compatibility.<br>
|
|
428
|
+
|
|
423
429
|
### Network Extra Configuration
|
|
424
430
|
|
|
425
431
|
The `networkExtraConfig` property is an array of configuration objects, each specifying custom rules for capturing network requests and responses. This feature collects data from `Fetch` and `XMLHttpRequest` calls, attaching specified request and response information, headers, and payloads to each network event.
|
package/index.esm2.js
CHANGED
|
@@ -1058,6 +1058,7 @@ var CoralogixFetchInstrumentation = (function (_super) {
|
|
|
1058
1058
|
});
|
|
1059
1059
|
});
|
|
1060
1060
|
};
|
|
1061
|
+
CoralogixFetchInstrumentation.prototype.disable = function () { };
|
|
1061
1062
|
return CoralogixFetchInstrumentation;
|
|
1062
1063
|
}(FetchInstrumentation));
|
|
1063
1064
|
|
|
@@ -1112,6 +1113,7 @@ var CoralogixXhrInstrumentation = (function (_super) {
|
|
|
1112
1113
|
Object.fromEntries(sanitizedHeaders);
|
|
1113
1114
|
}
|
|
1114
1115
|
};
|
|
1116
|
+
CoralogixXhrInstrumentation.prototype.disable = function () { };
|
|
1115
1117
|
return CoralogixXhrInstrumentation;
|
|
1116
1118
|
}(XMLHttpRequestInstrumentation));
|
|
1117
1119
|
|
|
@@ -2455,6 +2457,7 @@ var MASK_INPUT_TYPES_DEFAULT = [
|
|
|
2455
2457
|
'email',
|
|
2456
2458
|
'tel',
|
|
2457
2459
|
];
|
|
2460
|
+
var FINGER_PRINT_KEY = 'cx-fingerprint';
|
|
2458
2461
|
var idPatterns = [
|
|
2459
2462
|
{
|
|
2460
2463
|
pattern: new RegExp(UUID_REGEX),
|
|
@@ -3672,6 +3675,13 @@ var SessionManager = (function (_super) {
|
|
|
3672
3675
|
enumerable: false,
|
|
3673
3676
|
configurable: true
|
|
3674
3677
|
});
|
|
3678
|
+
Object.defineProperty(SessionManager.prototype, "fingerPrint", {
|
|
3679
|
+
get: function () {
|
|
3680
|
+
return this._fingerPrint;
|
|
3681
|
+
},
|
|
3682
|
+
enumerable: false,
|
|
3683
|
+
configurable: true
|
|
3684
|
+
});
|
|
3675
3685
|
SessionManager.prototype.updateCurrentPage = function (fragment) {
|
|
3676
3686
|
if (this.isIdleActive) {
|
|
3677
3687
|
this._currentPageFragment = undefined;
|
|
@@ -3690,6 +3700,7 @@ var SessionManager = (function (_super) {
|
|
|
3690
3700
|
this.startIdleListener();
|
|
3691
3701
|
this.clearPrevSession();
|
|
3692
3702
|
this.setSession();
|
|
3703
|
+
this.setFingerPrint();
|
|
3693
3704
|
};
|
|
3694
3705
|
SessionManager.prototype.stop = function () {
|
|
3695
3706
|
this.stopIdleListener();
|
|
@@ -3777,6 +3788,17 @@ var SessionManager = (function (_super) {
|
|
|
3777
3788
|
sessionExpirationDate: now + SESSION_EXPIRATION_TIME,
|
|
3778
3789
|
};
|
|
3779
3790
|
};
|
|
3791
|
+
SessionManager.prototype.setFingerPrint = function () {
|
|
3792
|
+
var generateFingerPrint = function () { return generateUUID(); };
|
|
3793
|
+
var storedFingerPrint = CxGlobal.localStorage.getItem(FINGER_PRINT_KEY);
|
|
3794
|
+
if (storedFingerPrint) {
|
|
3795
|
+
this._fingerPrint = storedFingerPrint;
|
|
3796
|
+
return;
|
|
3797
|
+
}
|
|
3798
|
+
var newFingerPrint = generateFingerPrint();
|
|
3799
|
+
CxGlobal.localStorage.setItem(FINGER_PRINT_KEY, newFingerPrint);
|
|
3800
|
+
this._fingerPrint = newFingerPrint;
|
|
3801
|
+
};
|
|
3780
3802
|
return SessionManager;
|
|
3781
3803
|
}(SessionIdle));
|
|
3782
3804
|
|
|
@@ -3933,7 +3955,7 @@ function resolveUrlBlueprinters(urlBlueprinters) {
|
|
|
3933
3955
|
return resolvedUrlBlueprinters;
|
|
3934
3956
|
}
|
|
3935
3957
|
|
|
3936
|
-
var SDK_VERSION = '2.
|
|
3958
|
+
var SDK_VERSION = '2.9.0';
|
|
3937
3959
|
|
|
3938
3960
|
function shouldDropEvent(cxRumEvent, options) {
|
|
3939
3961
|
if (isDocumentErrorWithoutMessage(cxRumEvent)) {
|
|
@@ -4048,6 +4070,7 @@ var CoralogixSpanMapProcessor = (function () {
|
|
|
4048
4070
|
var eventTypeContext = this._getEventTypeContext(attributes, eventType, span);
|
|
4049
4071
|
var _e = span.spanContext(), spanId = _e.spanId, traceId = _e.traceId;
|
|
4050
4072
|
var resourceAttributes = __assign(__assign({}, (_a = span.resource) === null || _a === void 0 ? void 0 : _a.attributes), { 'service.name': application });
|
|
4073
|
+
var fingerPrint = getSessionManager().fingerPrint;
|
|
4051
4074
|
var labels = JSON.parse(attributes[CoralogixAttributes.CUSTOM_LABELS]);
|
|
4052
4075
|
var isErrorWithStacktrace = !!((_b = eventTypeContext === null || eventTypeContext === void 0 ? void 0 : eventTypeContext.error_context) === null || _b === void 0 ? void 0 : _b.original_stacktrace);
|
|
4053
4076
|
var version_metadata = {
|
|
@@ -4068,7 +4091,7 @@ var CoralogixSpanMapProcessor = (function () {
|
|
|
4068
4091
|
severity: severity,
|
|
4069
4092
|
timestamp: timestamp,
|
|
4070
4093
|
text: {
|
|
4071
|
-
cx_rum: __assign(__assign({ platform: 'browser', timestamp: timestamp }, eventTypeContext), { browser_sdk: {
|
|
4094
|
+
cx_rum: __assign(__assign({ fingerPrint: fingerPrint, platform: 'browser', timestamp: timestamp }, eventTypeContext), { browser_sdk: {
|
|
4072
4095
|
version: SDK_VERSION,
|
|
4073
4096
|
}, version_metadata: version_metadata, session_context: __assign(__assign(__assign(__assign({}, user_context), { session_id: sessionId, session_creation_date: sessionCreationDate, prev_session: prevSessionId
|
|
4074
4097
|
? {
|
|
@@ -4451,8 +4474,10 @@ var CoralogixRum = {
|
|
|
4451
4474
|
var _a, _b;
|
|
4452
4475
|
var _this = this;
|
|
4453
4476
|
try {
|
|
4454
|
-
if (isInited
|
|
4455
|
-
|
|
4477
|
+
if (isInited) {
|
|
4478
|
+
if (options === null || options === void 0 ? void 0 : options.debug) {
|
|
4479
|
+
console.debug('CoralogixRum already initialized, skipping init');
|
|
4480
|
+
}
|
|
4456
4481
|
return;
|
|
4457
4482
|
}
|
|
4458
4483
|
if (!CxGlobal.sessionStorage) {
|
|
@@ -4656,7 +4681,7 @@ var CoralogixRum = {
|
|
|
4656
4681
|
};
|
|
4657
4682
|
},
|
|
4658
4683
|
shutdown: function () {
|
|
4659
|
-
var _a;
|
|
4684
|
+
var _a, _b;
|
|
4660
4685
|
if (!isInited) {
|
|
4661
4686
|
return;
|
|
4662
4687
|
}
|
|
@@ -4670,6 +4695,9 @@ var CoralogixRum = {
|
|
|
4670
4695
|
snapshotProcessor === null || snapshotProcessor === void 0 ? void 0 : snapshotProcessor.shutdown();
|
|
4671
4696
|
exporter === null || exporter === void 0 ? void 0 : exporter.shutdown();
|
|
4672
4697
|
isInited = false;
|
|
4698
|
+
if ((_b = getSdkConfig()) === null || _b === void 0 ? void 0 : _b.debug) {
|
|
4699
|
+
console.debug('Coralogix Browser SDK - shutdown has completed');
|
|
4700
|
+
}
|
|
4673
4701
|
},
|
|
4674
4702
|
setApplicationContext: function (applicationContext) {
|
|
4675
4703
|
var _a;
|
|
@@ -4716,6 +4744,13 @@ var CoralogixRum = {
|
|
|
4716
4744
|
(_a = getSessionRecorder()) === null || _a === void 0 ? void 0 : _a.stopRecording();
|
|
4717
4745
|
},
|
|
4718
4746
|
startSessionRecording: function () {
|
|
4747
|
+
var _a;
|
|
4748
|
+
if (!isInited) {
|
|
4749
|
+
if ((_a = getSdkConfig()) === null || _a === void 0 ? void 0 : _a.debug) {
|
|
4750
|
+
console.debug('Coralogix Browser SDK - CoralogixRum must be initiated before starting session recording');
|
|
4751
|
+
}
|
|
4752
|
+
return;
|
|
4753
|
+
}
|
|
4719
4754
|
if (getSessionRecorder()) {
|
|
4720
4755
|
getSessionRecorder().startRecording();
|
|
4721
4756
|
return;
|
package/package.json
CHANGED
package/src/constants.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ export declare const RUM_INTERNAL_DATA_KEY = "rumInternalData";
|
|
|
18
18
|
export declare const MASKED_TEXT = "***";
|
|
19
19
|
export declare const MASK_CLASS_DEFAULT = "cx-mask";
|
|
20
20
|
export declare const MASK_INPUT_TYPES_DEFAULT: InputType[];
|
|
21
|
+
export declare const FINGER_PRINT_KEY = "cx-fingerprint";
|
|
21
22
|
export declare const OPTIONS_DEFAULTS: Partial<CoralogixBrowserSdkConfig>;
|
|
22
23
|
export declare const INSTRUMENTATIONS: readonly InternalInstrumentationConfig[];
|
|
23
24
|
export declare const CoralogixAttributes: {
|
|
@@ -10,6 +10,7 @@ export declare class SessionManager extends SessionIdle {
|
|
|
10
10
|
private _cachedLogsSent;
|
|
11
11
|
private _currentPageFragment;
|
|
12
12
|
private _currentPageTimestamp;
|
|
13
|
+
private _fingerPrint;
|
|
13
14
|
private debugMode;
|
|
14
15
|
constructor(recordConfig?: SessionRecordingConfig);
|
|
15
16
|
get currentPageTimestamp(): number;
|
|
@@ -21,6 +22,7 @@ export declare class SessionManager extends SessionIdle {
|
|
|
21
22
|
get instrumentationsToSend(): Partial<Record<CoralogixEventType, boolean>> | undefined;
|
|
22
23
|
get cachedLogsSent(): boolean;
|
|
23
24
|
get sessionHasError(): boolean;
|
|
25
|
+
get fingerPrint(): string | undefined;
|
|
24
26
|
set sessionHasError(value: boolean);
|
|
25
27
|
set cachedLogsSent(val: boolean);
|
|
26
28
|
updateCurrentPage(fragment: string): void;
|
|
@@ -38,5 +40,6 @@ export declare class SessionManager extends SessionIdle {
|
|
|
38
40
|
private clearSessionWithErrorMode;
|
|
39
41
|
private handleRefreshedSessions;
|
|
40
42
|
private createNewSession;
|
|
43
|
+
private setFingerPrint;
|
|
41
44
|
setSession: (afterIdle?: boolean) => Session;
|
|
42
45
|
}
|
package/src/types.d.ts
CHANGED
|
@@ -324,6 +324,7 @@ export interface CxRumEvent extends EventTypeContext {
|
|
|
324
324
|
isSnapshotEvent?: boolean;
|
|
325
325
|
screenshot_context?: ScreenshotContext;
|
|
326
326
|
screenshotId?: string;
|
|
327
|
+
fingerPrint: string;
|
|
327
328
|
}
|
|
328
329
|
export interface CxSpan {
|
|
329
330
|
version_metadata: VersionMetaData;
|
package/src/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "2.
|
|
1
|
+
export declare const SDK_VERSION = "2.9.0";
|