humanbehavior-js 0.2.1 → 0.2.3
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/cjs/index.js +16 -28
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/react/index.js +26 -451
- package/dist/cjs/react/index.js.map +1 -1
- package/dist/esm/index.js +16 -28
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/react/index.js +5 -430
- package/dist/esm/react/index.js.map +1 -1
- package/dist/index.min.js +15 -1
- package/dist/index.min.js.map +1 -1
- package/dist/types/index.d.ts +5 -10
- package/dist/types/react/index.d.ts +2 -3
- package/package.json +10 -32
- package/rollup.config.js +106 -0
- package/simple-demo.html +26 -0
- package/simple-spa.html +658 -0
- package/src/index.ts +2 -2
- package/src/tracker.ts +15 -22
- package/tsconfig.json +24 -0
- package/dist/.tsbuildinfo +0 -1
package/dist/types/index.d.ts
CHANGED
|
@@ -186,15 +186,14 @@ declare class HumanBehaviorTracker {
|
|
|
186
186
|
private trackConsoleEvent;
|
|
187
187
|
private setupPageUnloadHandler;
|
|
188
188
|
viewLogs(): void;
|
|
189
|
-
addUserInfo({ userId, userProperties }: {
|
|
190
|
-
userId: string;
|
|
191
|
-
userProperties: Record<string, any>;
|
|
192
|
-
}): Promise<void>;
|
|
193
189
|
/**
|
|
194
190
|
* Add user identification information to the tracker
|
|
195
|
-
*
|
|
191
|
+
* If userId is not provided, will use userProperties.email as the userId (if present)
|
|
196
192
|
*/
|
|
197
|
-
|
|
193
|
+
addUserInfo({ userId, userProperties }: {
|
|
194
|
+
userId?: string;
|
|
195
|
+
userProperties: Record<string, any>;
|
|
196
|
+
}): Promise<string>;
|
|
198
197
|
start(): Promise<void>;
|
|
199
198
|
stop(): Promise<void>;
|
|
200
199
|
addEvent(event: any): Promise<void>;
|
|
@@ -327,9 +326,5 @@ declare const logWarn: (message: string, ...args: any[]) => void;
|
|
|
327
326
|
declare const logInfo: (message: string, ...args: any[]) => void;
|
|
328
327
|
declare const logDebug: (message: string, ...args: any[]) => void;
|
|
329
328
|
|
|
330
|
-
/**
|
|
331
|
-
* Main entry point for the HumanBehavior SDK
|
|
332
|
-
*/
|
|
333
|
-
|
|
334
329
|
export { HumanBehaviorAPI, HumanBehaviorTracker, LogLevel, MAX_CHUNK_SIZE_BYTES, RedactionManager, HumanBehaviorTracker as default, isChunkSizeExceeded, logDebug, logError, logInfo, logWarn, logger, redactionManager, splitLargeEvent, validateSingleEventSize };
|
|
335
330
|
export type { LoggerConfig, RedactionOptions };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { ReactNode } from 'react';
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
3
2
|
import { HumanBehaviorTracker } from '..';
|
|
4
3
|
export { HumanBehaviorTracker } from '..';
|
|
5
4
|
|
|
@@ -13,7 +12,7 @@ interface HumanBehaviorProviderProps {
|
|
|
13
12
|
redactFields?: string[];
|
|
14
13
|
};
|
|
15
14
|
}
|
|
16
|
-
declare const HumanBehaviorProvider: ({ apiKey, client, children, options }: HumanBehaviorProviderProps) =>
|
|
15
|
+
declare const HumanBehaviorProvider: ({ apiKey, client, children, options }: HumanBehaviorProviderProps) => React.JSX.Element;
|
|
17
16
|
declare const useHumanBehavior: () => HumanBehaviorTracker;
|
|
18
17
|
declare const useRedaction: () => {
|
|
19
18
|
setRedactedFields: (fields: string[]) => void;
|
package/package.json
CHANGED
|
@@ -1,50 +1,37 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "humanbehavior-js",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "SDK for HumanBehavior session and event recording",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/cjs/index.js",
|
|
7
7
|
"module": "./dist/esm/index.js",
|
|
8
8
|
"types": "./dist/types/index.d.ts",
|
|
9
9
|
"unpkg": "dist/index.min.js",
|
|
10
|
-
"jsdelivr": "dist/index.min.js",
|
|
11
10
|
"homepage": "https://documentation.humanbehavior.co",
|
|
12
11
|
"exports": {
|
|
13
12
|
".": {
|
|
14
13
|
"import": "./dist/esm/index.js",
|
|
15
14
|
"require": "./dist/cjs/index.js",
|
|
16
|
-
"types": "./dist/types/index.d.ts"
|
|
17
|
-
"default": "./dist/esm/index.js"
|
|
15
|
+
"types": "./dist/types/index.d.ts"
|
|
18
16
|
},
|
|
19
17
|
"./react": {
|
|
20
18
|
"import": "./dist/esm/react/index.js",
|
|
21
19
|
"require": "./dist/cjs/react/index.js",
|
|
22
|
-
"types": "./dist/types/react/index.d.ts"
|
|
23
|
-
|
|
24
|
-
},
|
|
25
|
-
"./package.json": "./package.json"
|
|
20
|
+
"types": "./dist/types/react/index.d.ts"
|
|
21
|
+
}
|
|
26
22
|
},
|
|
27
|
-
"files": [
|
|
28
|
-
"dist/**/*",
|
|
29
|
-
"src/**/*",
|
|
30
|
-
"*.d.ts"
|
|
31
|
-
],
|
|
32
23
|
"scripts": {
|
|
33
24
|
"build": "rollup -c",
|
|
34
25
|
"build:dev": "rollup -c --environment NODE_ENV:development",
|
|
35
26
|
"prepare": "npm run build",
|
|
36
|
-
"test": "
|
|
37
|
-
"test:bundlers": "node scripts/test-bundlers.js",
|
|
38
|
-
"test:framework": "node scripts/test-framework-compatibility.js",
|
|
39
|
-
"test:all": "npm run test:bundlers && npm run test:framework"
|
|
27
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
40
28
|
},
|
|
41
29
|
"author": "Chirag Kawediya, Skyler Ji, Amogh Chaturvedi",
|
|
42
30
|
"license": "ISC",
|
|
43
|
-
"peerDependencies": {
|
|
44
|
-
"react": ">=16.8.0",
|
|
45
|
-
"react-dom": ">=16.8.0"
|
|
46
|
-
},
|
|
47
31
|
"dependencies": {
|
|
32
|
+
"@types/react": "^19.0.12",
|
|
33
|
+
"humanbehavior-js": "^0.0.9",
|
|
34
|
+
"react": "^19.0.0",
|
|
48
35
|
"rrweb": "^2.0.0-alpha.4",
|
|
49
36
|
"uuid": "^11.1.0"
|
|
50
37
|
},
|
|
@@ -54,8 +41,6 @@
|
|
|
54
41
|
"@rollup/plugin-terser": "^0.4.4",
|
|
55
42
|
"@rollup/plugin-typescript": "^12.1.2",
|
|
56
43
|
"@types/node": "^24.0.3",
|
|
57
|
-
"@types/react": "^19.0.12",
|
|
58
|
-
"@types/react-dom": "^19.0.0",
|
|
59
44
|
"rollup": "^4.36.0",
|
|
60
45
|
"rollup-plugin-dts": "^6.2.1",
|
|
61
46
|
"tslib": "^2.8.1",
|
|
@@ -72,13 +57,6 @@
|
|
|
72
57
|
"session-recording",
|
|
73
58
|
"analytics",
|
|
74
59
|
"rrweb",
|
|
75
|
-
"koalaware"
|
|
76
|
-
|
|
77
|
-
"esbuild",
|
|
78
|
-
"vite",
|
|
79
|
-
"rollup"
|
|
80
|
-
],
|
|
81
|
-
"engines": {
|
|
82
|
-
"node": ">=14.0.0"
|
|
83
|
-
}
|
|
60
|
+
"koalaware"
|
|
61
|
+
]
|
|
84
62
|
}
|
package/rollup.config.js
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import typescript from '@rollup/plugin-typescript';
|
|
2
|
+
import resolve from '@rollup/plugin-node-resolve';
|
|
3
|
+
import commonjs from '@rollup/plugin-commonjs';
|
|
4
|
+
import terser from '@rollup/plugin-terser';
|
|
5
|
+
import dts from 'rollup-plugin-dts';
|
|
6
|
+
|
|
7
|
+
// Only React should be external since it's typically provided by the host application
|
|
8
|
+
const external = ['react', 'react-dom'];
|
|
9
|
+
|
|
10
|
+
// Global variables for UMD build
|
|
11
|
+
const globals = {
|
|
12
|
+
react: 'React',
|
|
13
|
+
'react-dom': 'ReactDOM'
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export default [
|
|
17
|
+
// Main SDK bundle
|
|
18
|
+
{
|
|
19
|
+
input: 'src/index.ts',
|
|
20
|
+
output: [
|
|
21
|
+
{
|
|
22
|
+
file: 'dist/cjs/index.js',
|
|
23
|
+
format: 'cjs',
|
|
24
|
+
name: 'HumanBehaviorTracker',
|
|
25
|
+
globals,
|
|
26
|
+
exports: 'named',
|
|
27
|
+
sourcemap: true
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
file: 'dist/esm/index.js',
|
|
31
|
+
format: 'es',
|
|
32
|
+
sourcemap: true
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
file: 'dist/index.min.js',
|
|
36
|
+
format: 'umd',
|
|
37
|
+
name: 'HumanBehaviorTracker',
|
|
38
|
+
globals,
|
|
39
|
+
exports: 'auto',
|
|
40
|
+
sourcemap: true,
|
|
41
|
+
plugins: [terser()]
|
|
42
|
+
}
|
|
43
|
+
],
|
|
44
|
+
plugins: [
|
|
45
|
+
resolve(),
|
|
46
|
+
commonjs(),
|
|
47
|
+
typescript({
|
|
48
|
+
tsconfig: './tsconfig.json',
|
|
49
|
+
declaration: false
|
|
50
|
+
})
|
|
51
|
+
],
|
|
52
|
+
external
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
// React component bundle
|
|
56
|
+
{
|
|
57
|
+
input: './src/react/index.tsx',
|
|
58
|
+
output: [
|
|
59
|
+
{
|
|
60
|
+
file: 'dist/cjs/react/index.js',
|
|
61
|
+
format: 'cjs',
|
|
62
|
+
name: 'HumanBehaviorReact',
|
|
63
|
+
globals: {
|
|
64
|
+
...globals,
|
|
65
|
+
'..': 'HumanBehaviorTracker'
|
|
66
|
+
},
|
|
67
|
+
exports: 'named',
|
|
68
|
+
sourcemap: true
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
file: 'dist/esm/react/index.js',
|
|
72
|
+
format: 'es',
|
|
73
|
+
sourcemap: true
|
|
74
|
+
}
|
|
75
|
+
],
|
|
76
|
+
plugins: [
|
|
77
|
+
resolve(),
|
|
78
|
+
commonjs(),
|
|
79
|
+
typescript({
|
|
80
|
+
tsconfig: './tsconfig.json',
|
|
81
|
+
declaration: false
|
|
82
|
+
})
|
|
83
|
+
],
|
|
84
|
+
external: [...external, '..']
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
// Type definition bundles - generate these separately
|
|
88
|
+
{
|
|
89
|
+
input: 'src/index.ts',
|
|
90
|
+
output: {
|
|
91
|
+
file: 'dist/types/index.d.ts',
|
|
92
|
+
format: 'es'
|
|
93
|
+
},
|
|
94
|
+
plugins: [dts()],
|
|
95
|
+
external
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
input: 'src/react/index.tsx',
|
|
99
|
+
output: {
|
|
100
|
+
file: 'dist/types/react/index.d.ts',
|
|
101
|
+
format: 'es'
|
|
102
|
+
},
|
|
103
|
+
plugins: [dts()],
|
|
104
|
+
external: [...external, '..']
|
|
105
|
+
}
|
|
106
|
+
];
|
package/simple-demo.html
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<title>HumanBehavior Simple Demo</title>
|
|
7
|
+
</head>
|
|
8
|
+
<body>
|
|
9
|
+
<h1>HumanBehavior Tracker Demo</h1>
|
|
10
|
+
<p>This page initializes the HumanBehavior tracker. Check the console for status.</p>
|
|
11
|
+
|
|
12
|
+
<button>Click me to test recording</button>
|
|
13
|
+
<input type="text" placeholder="Type something">
|
|
14
|
+
<input type="password" placeholder="Password (will be redacted)">
|
|
15
|
+
|
|
16
|
+
<script src="./dist/index.min.js"></script>
|
|
17
|
+
<script>
|
|
18
|
+
// Initialize the tracker
|
|
19
|
+
const tracker = HumanBehaviorTracker.init('13c3e029-ca45-4a3c-a33b-f5dcb297e31c', {
|
|
20
|
+
redactFields: ['input[type="password"]']
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
console.log('HumanBehavior tracker initialized:', tracker);
|
|
24
|
+
</script>
|
|
25
|
+
</body>
|
|
26
|
+
</html>
|