@amplitude/plugin-session-replay-browser 0.6.5 → 0.6.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 +5 -5
- package/lib/cjs/constants.d.ts +0 -15
- package/lib/cjs/constants.d.ts.map +1 -1
- package/lib/cjs/constants.js +1 -20
- package/lib/cjs/constants.js.map +1 -1
- package/lib/cjs/session-replay.d.ts +13 -2
- package/lib/cjs/session-replay.d.ts.map +1 -1
- package/lib/cjs/session-replay.js +28 -483
- package/lib/cjs/session-replay.js.map +1 -1
- package/lib/cjs/typings/session-replay.d.ts +0 -67
- package/lib/cjs/typings/session-replay.d.ts.map +1 -1
- package/lib/cjs/typings/session-replay.js +0 -6
- package/lib/cjs/typings/session-replay.js.map +1 -1
- package/lib/esm/constants.d.ts +0 -15
- package/lib/esm/constants.d.ts.map +1 -1
- package/lib/esm/constants.js +0 -19
- package/lib/esm/constants.js.map +1 -1
- package/lib/esm/session-replay.d.ts +13 -2
- package/lib/esm/session-replay.d.ts.map +1 -1
- package/lib/esm/session-replay.js +29 -484
- package/lib/esm/session-replay.js.map +1 -1
- package/lib/esm/typings/session-replay.d.ts +0 -67
- package/lib/esm/typings/session-replay.d.ts.map +1 -1
- package/lib/esm/typings/session-replay.js +1 -5
- package/lib/esm/typings/session-replay.js.map +1 -1
- package/lib/scripts/amplitude-min.js +1 -1
- package/lib/scripts/amplitude-min.js.gz +0 -0
- package/lib/scripts/amplitude-min.umd.js +1 -1
- package/lib/scripts/amplitude-min.umd.js.gz +0 -0
- package/lib/scripts/constants.d.ts +0 -15
- package/lib/scripts/constants.d.ts.map +1 -1
- package/lib/scripts/session-replay.d.ts +13 -2
- package/lib/scripts/session-replay.d.ts.map +1 -1
- package/lib/scripts/typings/session-replay.d.ts +0 -67
- package/lib/scripts/typings/session-replay.d.ts.map +1 -1
- package/package.json +3 -2
- package/lib/cjs/helpers.d.ts +0 -4
- package/lib/cjs/helpers.d.ts.map +0 -1
- package/lib/cjs/helpers.js +0 -32
- package/lib/cjs/helpers.js.map +0 -1
- package/lib/cjs/messages.d.ts +0 -5
- package/lib/cjs/messages.d.ts.map +0 -1
- package/lib/cjs/messages.js +0 -10
- package/lib/cjs/messages.js.map +0 -1
- package/lib/esm/helpers.d.ts +0 -4
- package/lib/esm/helpers.d.ts.map +0 -1
- package/lib/esm/helpers.js +0 -27
- package/lib/esm/helpers.js.map +0 -1
- package/lib/esm/messages.d.ts +0 -5
- package/lib/esm/messages.d.ts.map +0 -1
- package/lib/esm/messages.js +0 -7
- package/lib/esm/messages.js.map +0 -1
- package/lib/scripts/helpers.d.ts +0 -4
- package/lib/scripts/helpers.d.ts.map +0 -1
- package/lib/scripts/messages.d.ts +0 -5
- package/lib/scripts/messages.d.ts.map +0 -1
|
@@ -1,71 +1,4 @@
|
|
|
1
|
-
import { BrowserConfig, EnrichmentPlugin } from '@amplitude/analytics-types';
|
|
2
|
-
import { record } from 'rrweb';
|
|
3
1
|
export interface SessionReplayOptions {
|
|
4
2
|
sampleRate?: number;
|
|
5
3
|
}
|
|
6
|
-
export type Events = string[];
|
|
7
|
-
export interface SessionReplayContext {
|
|
8
|
-
events: Events;
|
|
9
|
-
sequenceId: number;
|
|
10
|
-
attempts: number;
|
|
11
|
-
timeout: number;
|
|
12
|
-
sessionId: number;
|
|
13
|
-
}
|
|
14
|
-
export declare enum RecordingStatus {
|
|
15
|
-
RECORDING = "recording",
|
|
16
|
-
SENT = "sent"
|
|
17
|
-
}
|
|
18
|
-
export interface IDBStoreSequence {
|
|
19
|
-
events: Events;
|
|
20
|
-
status: RecordingStatus;
|
|
21
|
-
}
|
|
22
|
-
export interface IDBStoreSession {
|
|
23
|
-
currentSequenceId: number;
|
|
24
|
-
sessionSequences: {
|
|
25
|
-
[sequenceId: number]: IDBStoreSequence;
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
export interface IDBStore {
|
|
29
|
-
[sessionId: number]: IDBStoreSession;
|
|
30
|
-
}
|
|
31
|
-
export interface SessionReplayEnrichmentPlugin extends EnrichmentPlugin {
|
|
32
|
-
setup: (config: BrowserConfig) => Promise<void>;
|
|
33
|
-
config: BrowserConfig;
|
|
34
|
-
storageKey: string;
|
|
35
|
-
retryTimeout: number;
|
|
36
|
-
events: Events;
|
|
37
|
-
currentSequenceId: number;
|
|
38
|
-
interval: number;
|
|
39
|
-
queue: SessionReplayContext[];
|
|
40
|
-
timeAtLastSend: number | null;
|
|
41
|
-
stopRecordingEvents: ReturnType<typeof record> | null;
|
|
42
|
-
stopRecordingAndSendEvents: (sessionId?: number) => void;
|
|
43
|
-
maxPersistedEventsSize: number;
|
|
44
|
-
initialize: (shouldSendStoredEvents?: boolean) => Promise<void>;
|
|
45
|
-
sendStoredEvents: (storedReplaySessions: IDBStore) => void;
|
|
46
|
-
getShouldRecord: () => boolean;
|
|
47
|
-
recordEvents: () => void;
|
|
48
|
-
shouldSplitEventsList: (nextEventString: string) => boolean;
|
|
49
|
-
sendEventsList: ({ events, sequenceId, sessionId, }: {
|
|
50
|
-
events: string[];
|
|
51
|
-
sequenceId: number;
|
|
52
|
-
sessionId: number;
|
|
53
|
-
}) => void;
|
|
54
|
-
addToQueue: (...list: SessionReplayContext[]) => void;
|
|
55
|
-
schedule: (timeout: number) => void;
|
|
56
|
-
flush: (useRetry?: boolean) => Promise<void>;
|
|
57
|
-
send: (context: SessionReplayContext, useRetry?: boolean) => Promise<void>;
|
|
58
|
-
completeRequest({ context, err, success, removeEvents, }: {
|
|
59
|
-
context: SessionReplayContext;
|
|
60
|
-
err?: string | undefined;
|
|
61
|
-
success?: string | undefined;
|
|
62
|
-
removeEvents?: boolean | undefined;
|
|
63
|
-
}): void;
|
|
64
|
-
getAllSessionEventsFromStore: () => Promise<IDBStore | undefined>;
|
|
65
|
-
storeEventsForSession: (events: Events, sequenceId: number, sessionId: number) => Promise<void>;
|
|
66
|
-
cleanUpSessionEventsStore: (sessionId: number, sequenceId: number) => Promise<void>;
|
|
67
|
-
}
|
|
68
|
-
export interface SessionReplayPlugin {
|
|
69
|
-
(options?: SessionReplayOptions): SessionReplayEnrichmentPlugin;
|
|
70
|
-
}
|
|
71
4
|
//# sourceMappingURL=session-replay.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-replay.d.ts","sourceRoot":"","sources":["../../../src/typings/session-replay.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"session-replay.d.ts","sourceRoot":"","sources":["../../../src/typings/session-replay.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,oBAAoB;IACnC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@amplitude/plugin-session-replay-browser",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.7",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "Amplitude Inc",
|
|
6
6
|
"homepage": "https://github.com/amplitude/Amplitude-TypeScript",
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
"@amplitude/analytics-client-common": ">=1 <3",
|
|
42
42
|
"@amplitude/analytics-core": ">=1 <3",
|
|
43
43
|
"@amplitude/analytics-types": ">=1 <3",
|
|
44
|
+
"@amplitude/session-replay-browser": "^0.1.1",
|
|
44
45
|
"idb-keyval": "^6.2.1",
|
|
45
46
|
"rrweb": "^2.0.0-alpha.11",
|
|
46
47
|
"tslib": "^2.4.1"
|
|
@@ -57,5 +58,5 @@
|
|
|
57
58
|
"files": [
|
|
58
59
|
"lib"
|
|
59
60
|
],
|
|
60
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "f361d34b9158827f298df4486d2f5110af1a880e"
|
|
61
62
|
}
|
package/lib/cjs/helpers.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export declare const maskInputFn: (text: string, element: HTMLElement) => string;
|
|
2
|
-
export declare const generateHashCode: (str: string) => number;
|
|
3
|
-
export declare const isSessionInSample: (sessionId: number, sampleRate: number) => boolean;
|
|
4
|
-
//# sourceMappingURL=helpers.d.ts.map
|
package/lib/cjs/helpers.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/helpers.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,SAAU,MAAM,WAAW,WAAW,WAK7D,CAAC;AAEF,eAAO,MAAM,gBAAgB,QAAkB,MAAM,WASpD,CAAC;AAEF,eAAO,MAAM,iBAAiB,cAAwB,MAAM,cAAc,MAAM,YAM/E,CAAC"}
|
package/lib/cjs/helpers.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
-
exports.isSessionInSample = exports.generateHashCode = exports.maskInputFn = void 0;
|
|
3
|
-
var constants_1 = require("./constants");
|
|
4
|
-
var maskInputFn = function (text, element) {
|
|
5
|
-
var _a;
|
|
6
|
-
if ((_a = element.classList) === null || _a === void 0 ? void 0 : _a.contains(constants_1.UNMASK_TEXT_CLASS)) {
|
|
7
|
-
return text;
|
|
8
|
-
}
|
|
9
|
-
return '*'.repeat(text.length);
|
|
10
|
-
};
|
|
11
|
-
exports.maskInputFn = maskInputFn;
|
|
12
|
-
var generateHashCode = function (str) {
|
|
13
|
-
var hash = 0;
|
|
14
|
-
if (str.length === 0)
|
|
15
|
-
return hash;
|
|
16
|
-
for (var i = 0; i < str.length; i++) {
|
|
17
|
-
var chr = str.charCodeAt(i);
|
|
18
|
-
hash = (hash << 5) - hash + chr;
|
|
19
|
-
hash |= 0;
|
|
20
|
-
}
|
|
21
|
-
return hash;
|
|
22
|
-
};
|
|
23
|
-
exports.generateHashCode = generateHashCode;
|
|
24
|
-
var isSessionInSample = function (sessionId, sampleRate) {
|
|
25
|
-
var hashNumber = (0, exports.generateHashCode)(sessionId.toString());
|
|
26
|
-
var absHash = Math.abs(hashNumber);
|
|
27
|
-
var absHashMultiply = absHash * 31;
|
|
28
|
-
var mod = absHashMultiply % 100;
|
|
29
|
-
return mod / 100 < sampleRate;
|
|
30
|
-
};
|
|
31
|
-
exports.isSessionInSample = isSessionInSample;
|
|
32
|
-
//# sourceMappingURL=helpers.js.map
|
package/lib/cjs/helpers.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/helpers.ts"],"names":[],"mappings":";;AAAA,yCAAgD;AAEzC,IAAM,WAAW,GAAG,UAAC,IAAY,EAAE,OAAoB;;IAC5D,IAAI,MAAA,OAAO,CAAC,SAAS,0CAAE,QAAQ,CAAC,6BAAiB,CAAC,EAAE;QAClD,OAAO,IAAI,CAAC;KACb;IACD,OAAO,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACjC,CAAC,CAAC;AALW,QAAA,WAAW,eAKtB;AAEK,IAAM,gBAAgB,GAAG,UAAU,GAAW;IACnD,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAClC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACnC,IAAM,GAAG,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QAC9B,IAAI,GAAG,CAAC,IAAI,IAAI,CAAC,CAAC,GAAG,IAAI,GAAG,GAAG,CAAC;QAChC,IAAI,IAAI,CAAC,CAAC;KACX;IACD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AATW,QAAA,gBAAgB,oBAS3B;AAEK,IAAM,iBAAiB,GAAG,UAAU,SAAiB,EAAE,UAAkB;IAC9E,IAAM,UAAU,GAAG,IAAA,wBAAgB,EAAC,SAAS,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC1D,IAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IACrC,IAAM,eAAe,GAAG,OAAO,GAAG,EAAE,CAAC;IACrC,IAAM,GAAG,GAAG,eAAe,GAAG,GAAG,CAAC;IAClC,OAAO,GAAG,GAAG,GAAG,GAAG,UAAU,CAAC;AAChC,CAAC,CAAC;AANW,QAAA,iBAAiB,qBAM5B","sourcesContent":["import { UNMASK_TEXT_CLASS } from './constants';\n\nexport const maskInputFn = (text: string, element: HTMLElement) => {\n if (element.classList?.contains(UNMASK_TEXT_CLASS)) {\n return text;\n }\n return '*'.repeat(text.length);\n};\n\nexport const generateHashCode = function (str: string) {\n let hash = 0;\n if (str.length === 0) return hash;\n for (let i = 0; i < str.length; i++) {\n const chr = str.charCodeAt(i);\n hash = (hash << 5) - hash + chr;\n hash |= 0;\n }\n return hash;\n};\n\nexport const isSessionInSample = function (sessionId: number, sampleRate: number) {\n const hashNumber = generateHashCode(sessionId.toString());\n const absHash = Math.abs(hashNumber);\n const absHashMultiply = absHash * 31;\n const mod = absHashMultiply % 100;\n return mod / 100 < sampleRate;\n};\n"]}
|
package/lib/cjs/messages.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export declare const getSuccessMessage: (sessionId: number) => string;
|
|
2
|
-
export declare const UNEXPECTED_ERROR_MESSAGE = "Unexpected error occurred";
|
|
3
|
-
export declare const MAX_RETRIES_EXCEEDED_MESSAGE = "Session replay event batch rejected due to exceeded retry count";
|
|
4
|
-
export declare const STORAGE_FAILURE = "Failed to store session replay events in IndexedDB";
|
|
5
|
-
//# sourceMappingURL=messages.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/messages.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,cAAe,MAAM,WAC4B,CAAC;AAChF,eAAO,MAAM,wBAAwB,8BAA8B,CAAC;AACpE,eAAO,MAAM,4BAA4B,oEAAoE,CAAC;AAC9G,eAAO,MAAM,eAAe,uDAAuD,CAAC"}
|
package/lib/cjs/messages.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
-
exports.STORAGE_FAILURE = exports.MAX_RETRIES_EXCEEDED_MESSAGE = exports.UNEXPECTED_ERROR_MESSAGE = exports.getSuccessMessage = void 0;
|
|
3
|
-
var getSuccessMessage = function (sessionId) {
|
|
4
|
-
return "Session replay event batch tracked successfully for session id ".concat(sessionId);
|
|
5
|
-
};
|
|
6
|
-
exports.getSuccessMessage = getSuccessMessage;
|
|
7
|
-
exports.UNEXPECTED_ERROR_MESSAGE = 'Unexpected error occurred';
|
|
8
|
-
exports.MAX_RETRIES_EXCEEDED_MESSAGE = 'Session replay event batch rejected due to exceeded retry count';
|
|
9
|
-
exports.STORAGE_FAILURE = 'Failed to store session replay events in IndexedDB';
|
|
10
|
-
//# sourceMappingURL=messages.js.map
|
package/lib/cjs/messages.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"messages.js","sourceRoot":"","sources":["../../src/messages.ts"],"names":[],"mappings":";;AAAO,IAAM,iBAAiB,GAAG,UAAC,SAAiB;IACjD,OAAA,yEAAkE,SAAS,CAAE;AAA7E,CAA6E,CAAC;AADnE,QAAA,iBAAiB,qBACkD;AACnE,QAAA,wBAAwB,GAAG,2BAA2B,CAAC;AACvD,QAAA,4BAA4B,GAAG,iEAAiE,CAAC;AACjG,QAAA,eAAe,GAAG,oDAAoD,CAAC","sourcesContent":["export const getSuccessMessage = (sessionId: number) =>\n `Session replay event batch tracked successfully for session id ${sessionId}`;\nexport const UNEXPECTED_ERROR_MESSAGE = 'Unexpected error occurred';\nexport const MAX_RETRIES_EXCEEDED_MESSAGE = 'Session replay event batch rejected due to exceeded retry count';\nexport const STORAGE_FAILURE = 'Failed to store session replay events in IndexedDB';\n"]}
|
package/lib/esm/helpers.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export declare const maskInputFn: (text: string, element: HTMLElement) => string;
|
|
2
|
-
export declare const generateHashCode: (str: string) => number;
|
|
3
|
-
export declare const isSessionInSample: (sessionId: number, sampleRate: number) => boolean;
|
|
4
|
-
//# sourceMappingURL=helpers.d.ts.map
|
package/lib/esm/helpers.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/helpers.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,SAAU,MAAM,WAAW,WAAW,WAK7D,CAAC;AAEF,eAAO,MAAM,gBAAgB,QAAkB,MAAM,WASpD,CAAC;AAEF,eAAO,MAAM,iBAAiB,cAAwB,MAAM,cAAc,MAAM,YAM/E,CAAC"}
|
package/lib/esm/helpers.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { UNMASK_TEXT_CLASS } from './constants';
|
|
2
|
-
export var maskInputFn = function (text, element) {
|
|
3
|
-
var _a;
|
|
4
|
-
if ((_a = element.classList) === null || _a === void 0 ? void 0 : _a.contains(UNMASK_TEXT_CLASS)) {
|
|
5
|
-
return text;
|
|
6
|
-
}
|
|
7
|
-
return '*'.repeat(text.length);
|
|
8
|
-
};
|
|
9
|
-
export var generateHashCode = function (str) {
|
|
10
|
-
var hash = 0;
|
|
11
|
-
if (str.length === 0)
|
|
12
|
-
return hash;
|
|
13
|
-
for (var i = 0; i < str.length; i++) {
|
|
14
|
-
var chr = str.charCodeAt(i);
|
|
15
|
-
hash = (hash << 5) - hash + chr;
|
|
16
|
-
hash |= 0;
|
|
17
|
-
}
|
|
18
|
-
return hash;
|
|
19
|
-
};
|
|
20
|
-
export var isSessionInSample = function (sessionId, sampleRate) {
|
|
21
|
-
var hashNumber = generateHashCode(sessionId.toString());
|
|
22
|
-
var absHash = Math.abs(hashNumber);
|
|
23
|
-
var absHashMultiply = absHash * 31;
|
|
24
|
-
var mod = absHashMultiply % 100;
|
|
25
|
-
return mod / 100 < sampleRate;
|
|
26
|
-
};
|
|
27
|
-
//# sourceMappingURL=helpers.js.map
|
package/lib/esm/helpers.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,MAAM,CAAC,IAAM,WAAW,GAAG,UAAC,IAAY,EAAE,OAAoB;;IAC5D,IAAI,MAAA,OAAO,CAAC,SAAS,0CAAE,QAAQ,CAAC,iBAAiB,CAAC,EAAE;QAClD,OAAO,IAAI,CAAC;KACb;IACD,OAAO,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACjC,CAAC,CAAC;AAEF,MAAM,CAAC,IAAM,gBAAgB,GAAG,UAAU,GAAW;IACnD,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAClC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACnC,IAAM,GAAG,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QAC9B,IAAI,GAAG,CAAC,IAAI,IAAI,CAAC,CAAC,GAAG,IAAI,GAAG,GAAG,CAAC;QAChC,IAAI,IAAI,CAAC,CAAC;KACX;IACD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,MAAM,CAAC,IAAM,iBAAiB,GAAG,UAAU,SAAiB,EAAE,UAAkB;IAC9E,IAAM,UAAU,GAAG,gBAAgB,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC1D,IAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IACrC,IAAM,eAAe,GAAG,OAAO,GAAG,EAAE,CAAC;IACrC,IAAM,GAAG,GAAG,eAAe,GAAG,GAAG,CAAC;IAClC,OAAO,GAAG,GAAG,GAAG,GAAG,UAAU,CAAC;AAChC,CAAC,CAAC","sourcesContent":["import { UNMASK_TEXT_CLASS } from './constants';\n\nexport const maskInputFn = (text: string, element: HTMLElement) => {\n if (element.classList?.contains(UNMASK_TEXT_CLASS)) {\n return text;\n }\n return '*'.repeat(text.length);\n};\n\nexport const generateHashCode = function (str: string) {\n let hash = 0;\n if (str.length === 0) return hash;\n for (let i = 0; i < str.length; i++) {\n const chr = str.charCodeAt(i);\n hash = (hash << 5) - hash + chr;\n hash |= 0;\n }\n return hash;\n};\n\nexport const isSessionInSample = function (sessionId: number, sampleRate: number) {\n const hashNumber = generateHashCode(sessionId.toString());\n const absHash = Math.abs(hashNumber);\n const absHashMultiply = absHash * 31;\n const mod = absHashMultiply % 100;\n return mod / 100 < sampleRate;\n};\n"]}
|
package/lib/esm/messages.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export declare const getSuccessMessage: (sessionId: number) => string;
|
|
2
|
-
export declare const UNEXPECTED_ERROR_MESSAGE = "Unexpected error occurred";
|
|
3
|
-
export declare const MAX_RETRIES_EXCEEDED_MESSAGE = "Session replay event batch rejected due to exceeded retry count";
|
|
4
|
-
export declare const STORAGE_FAILURE = "Failed to store session replay events in IndexedDB";
|
|
5
|
-
//# sourceMappingURL=messages.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/messages.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,cAAe,MAAM,WAC4B,CAAC;AAChF,eAAO,MAAM,wBAAwB,8BAA8B,CAAC;AACpE,eAAO,MAAM,4BAA4B,oEAAoE,CAAC;AAC9G,eAAO,MAAM,eAAe,uDAAuD,CAAC"}
|
package/lib/esm/messages.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export var getSuccessMessage = function (sessionId) {
|
|
2
|
-
return "Session replay event batch tracked successfully for session id ".concat(sessionId);
|
|
3
|
-
};
|
|
4
|
-
export var UNEXPECTED_ERROR_MESSAGE = 'Unexpected error occurred';
|
|
5
|
-
export var MAX_RETRIES_EXCEEDED_MESSAGE = 'Session replay event batch rejected due to exceeded retry count';
|
|
6
|
-
export var STORAGE_FAILURE = 'Failed to store session replay events in IndexedDB';
|
|
7
|
-
//# sourceMappingURL=messages.js.map
|
package/lib/esm/messages.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"messages.js","sourceRoot":"","sources":["../../src/messages.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAM,iBAAiB,GAAG,UAAC,SAAiB;IACjD,OAAA,yEAAkE,SAAS,CAAE;AAA7E,CAA6E,CAAC;AAChF,MAAM,CAAC,IAAM,wBAAwB,GAAG,2BAA2B,CAAC;AACpE,MAAM,CAAC,IAAM,4BAA4B,GAAG,iEAAiE,CAAC;AAC9G,MAAM,CAAC,IAAM,eAAe,GAAG,oDAAoD,CAAC","sourcesContent":["export const getSuccessMessage = (sessionId: number) =>\n `Session replay event batch tracked successfully for session id ${sessionId}`;\nexport const UNEXPECTED_ERROR_MESSAGE = 'Unexpected error occurred';\nexport const MAX_RETRIES_EXCEEDED_MESSAGE = 'Session replay event batch rejected due to exceeded retry count';\nexport const STORAGE_FAILURE = 'Failed to store session replay events in IndexedDB';\n"]}
|
package/lib/scripts/helpers.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export declare const maskInputFn: (text: string, element: HTMLElement) => string;
|
|
2
|
-
export declare const generateHashCode: (str: string) => number;
|
|
3
|
-
export declare const isSessionInSample: (sessionId: number, sampleRate: number) => boolean;
|
|
4
|
-
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/helpers.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,SAAU,MAAM,WAAW,WAAW,WAK7D,CAAC;AAEF,eAAO,MAAM,gBAAgB,QAAkB,MAAM,WASpD,CAAC;AAEF,eAAO,MAAM,iBAAiB,cAAwB,MAAM,cAAc,MAAM,YAM/E,CAAC"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export declare const getSuccessMessage: (sessionId: number) => string;
|
|
2
|
-
export declare const UNEXPECTED_ERROR_MESSAGE = "Unexpected error occurred";
|
|
3
|
-
export declare const MAX_RETRIES_EXCEEDED_MESSAGE = "Session replay event batch rejected due to exceeded retry count";
|
|
4
|
-
export declare const STORAGE_FAILURE = "Failed to store session replay events in IndexedDB";
|
|
5
|
-
//# sourceMappingURL=messages.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/messages.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,cAAe,MAAM,WAC4B,CAAC;AAChF,eAAO,MAAM,wBAAwB,8BAA8B,CAAC;AACpE,eAAO,MAAM,4BAA4B,oEAAoE,CAAC;AAC9G,eAAO,MAAM,eAAe,uDAAuD,CAAC"}
|