@tsdevstack/react-bot-detection 0.1.4
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/LICENSE +21 -0
- package/README.md +314 -0
- package/dist/components/bot-protected-form.d.ts +42 -0
- package/dist/components/bot-protected-form.js +114 -0
- package/dist/components/bot-protected-form.test.d.ts +1 -0
- package/dist/components/bot-protected-form.test.js +366 -0
- package/dist/components/honeypot.d.ts +30 -0
- package/dist/components/honeypot.js +40 -0
- package/dist/components/honeypot.test.d.ts +1 -0
- package/dist/components/honeypot.test.js +186 -0
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.js +3 -0
- package/dist/hooks/index.d.ts +4 -0
- package/dist/hooks/index.js +3 -0
- package/dist/hooks/use-bot-detection.d.ts +31 -0
- package/dist/hooks/use-bot-detection.js +140 -0
- package/dist/hooks/use-bot-detection.test.d.ts +1 -0
- package/dist/hooks/use-bot-detection.test.js +384 -0
- package/dist/hooks/use-honeypot.d.ts +32 -0
- package/dist/hooks/use-honeypot.js +29 -0
- package/dist/hooks/use-honeypot.test.d.ts +1 -0
- package/dist/hooks/use-honeypot.test.js +78 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +3 -0
- package/dist/types/bot-detection.d.ts +33 -0
- package/dist/types/bot-detection.js +0 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +0 -0
- package/package.json +68 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Statistics collected during bot detection analysis.
|
|
3
|
+
*/
|
|
4
|
+
export interface BotDetectionStats {
|
|
5
|
+
mouseMovements: number;
|
|
6
|
+
typingEvents: number;
|
|
7
|
+
focusEvents: number;
|
|
8
|
+
timeSpent: number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Result of bot detection analysis combining behavioral analysis and honeypot detection.
|
|
12
|
+
*/
|
|
13
|
+
export interface BotDetectionResult {
|
|
14
|
+
/** Combined score from all detection methods (0-100+) */
|
|
15
|
+
score: number;
|
|
16
|
+
/** Human-readable reasons for the score */
|
|
17
|
+
reasons: string[];
|
|
18
|
+
/** True if score >= 50 or honeypot was triggered */
|
|
19
|
+
isBot: boolean;
|
|
20
|
+
/** Detailed statistics from behavioral analysis */
|
|
21
|
+
stats: BotDetectionStats;
|
|
22
|
+
/** True if honeypot field was filled */
|
|
23
|
+
honeypotTriggered: boolean;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Props for custom button components used in BotProtectedForm.
|
|
27
|
+
*/
|
|
28
|
+
export interface ButtonComponentProps {
|
|
29
|
+
type: 'submit';
|
|
30
|
+
disabled: boolean;
|
|
31
|
+
className?: string;
|
|
32
|
+
children: React.ReactNode;
|
|
33
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { BotDetectionResult, BotDetectionStats, ButtonComponentProps, } from './bot-detection';
|
|
File without changes
|
package/package.json
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tsdevstack/react-bot-detection",
|
|
3
|
+
"version": "0.1.4",
|
|
4
|
+
"description": "React hooks and components for bot detection using behavioral analysis and honeypot fields",
|
|
5
|
+
"private": false,
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"author": "tsdevstack",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/tsdevstack/react-bot-detection"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/tsdevstack/react-bot-detection/issues"
|
|
14
|
+
},
|
|
15
|
+
"homepage": "https://github.com/tsdevstack/react-bot-detection#readme",
|
|
16
|
+
"engines": {
|
|
17
|
+
"node": ">=18.0.0"
|
|
18
|
+
},
|
|
19
|
+
"type": "module",
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
23
|
+
"import": "./dist/index.js"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
27
|
+
"files": [
|
|
28
|
+
"dist"
|
|
29
|
+
],
|
|
30
|
+
"keywords": [
|
|
31
|
+
"react",
|
|
32
|
+
"bot-detection",
|
|
33
|
+
"honeypot",
|
|
34
|
+
"form-protection",
|
|
35
|
+
"anti-spam",
|
|
36
|
+
"behavioral-analysis",
|
|
37
|
+
"security"
|
|
38
|
+
],
|
|
39
|
+
"scripts": {
|
|
40
|
+
"build": "rslib build",
|
|
41
|
+
"dev": "rslib build --watch",
|
|
42
|
+
"format": "prettier --write .",
|
|
43
|
+
"lint": "eslint .",
|
|
44
|
+
"test": "rstest run",
|
|
45
|
+
"test:watch": "rstest",
|
|
46
|
+
"tsc": "tsc --noEmit"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@eslint/js": "^9.39.1",
|
|
50
|
+
"@rsbuild/plugin-react": "^1.4.2",
|
|
51
|
+
"@rslib/core": "^0.19.1",
|
|
52
|
+
"@rstest/adapter-rslib": "^0.2.0",
|
|
53
|
+
"@rstest/core": "^0.8.5",
|
|
54
|
+
"@testing-library/jest-dom": "^6.9.1",
|
|
55
|
+
"@testing-library/react": "^16.3.1",
|
|
56
|
+
"@types/react": "^19.2.7",
|
|
57
|
+
"eslint": "^9.39.1",
|
|
58
|
+
"globals": "^16.5.0",
|
|
59
|
+
"jsdom": "^26.1.0",
|
|
60
|
+
"prettier": "^3.7.3",
|
|
61
|
+
"react": "^19.2.3",
|
|
62
|
+
"typescript": "^5.9.3",
|
|
63
|
+
"typescript-eslint": "^8.48.0"
|
|
64
|
+
},
|
|
65
|
+
"peerDependencies": {
|
|
66
|
+
"react": "^18.0.0 || ^19.0.0"
|
|
67
|
+
}
|
|
68
|
+
}
|