@axeptio/behavior-detection 1.0.1 → 1.0.2

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.
Files changed (53) hide show
  1. package/dist/behavior-detection.esm.min.js.map +1 -1
  2. package/dist/behavior-detection.min.js.map +1 -1
  3. package/dist/behavior-detector.d.ts +2 -2
  4. package/dist/cjs/behavior-detector.d.ts +2 -2
  5. package/dist/cjs/browser.js +2 -2
  6. package/dist/cjs/index.d.ts +4 -4
  7. package/dist/cjs/index.js +4 -4
  8. package/dist/cjs/strategies/click.d.ts +1 -1
  9. package/dist/cjs/strategies/click.js +2 -2
  10. package/dist/cjs/strategies/environment.d.ts +1 -1
  11. package/dist/cjs/strategies/environment.js +5 -5
  12. package/dist/cjs/strategies/index.d.ts +14 -14
  13. package/dist/cjs/strategies/index.js +28 -28
  14. package/dist/cjs/strategies/keyboard.d.ts +1 -1
  15. package/dist/cjs/strategies/keyboard.js +7 -7
  16. package/dist/cjs/strategies/mouse.d.ts +1 -1
  17. package/dist/cjs/strategies/mouse.js +6 -6
  18. package/dist/cjs/strategies/resize.d.ts +1 -1
  19. package/dist/cjs/strategies/resize.js +5 -5
  20. package/dist/cjs/strategies/scroll.d.ts +1 -1
  21. package/dist/cjs/strategies/scroll.js +8 -8
  22. package/dist/cjs/strategies/tap.d.ts +1 -1
  23. package/dist/cjs/strategies/tap.js +9 -9
  24. package/dist/esm/behavior-detector.d.ts +2 -2
  25. package/dist/esm/browser.js +1 -1
  26. package/dist/esm/index.d.ts +4 -4
  27. package/dist/esm/index.js +2 -2
  28. package/dist/esm/strategies/click.d.ts +1 -1
  29. package/dist/esm/strategies/click.js +1 -1
  30. package/dist/esm/strategies/environment.d.ts +1 -1
  31. package/dist/esm/strategies/environment.js +2 -2
  32. package/dist/esm/strategies/index.d.ts +14 -14
  33. package/dist/esm/strategies/index.js +14 -14
  34. package/dist/esm/strategies/keyboard.d.ts +1 -1
  35. package/dist/esm/strategies/keyboard.js +2 -2
  36. package/dist/esm/strategies/mouse.d.ts +1 -1
  37. package/dist/esm/strategies/mouse.js +2 -2
  38. package/dist/esm/strategies/resize.d.ts +1 -1
  39. package/dist/esm/strategies/resize.js +2 -2
  40. package/dist/esm/strategies/scroll.d.ts +1 -1
  41. package/dist/esm/strategies/scroll.js +2 -2
  42. package/dist/esm/strategies/tap.d.ts +1 -1
  43. package/dist/esm/strategies/tap.js +2 -2
  44. package/dist/index.d.ts +4 -4
  45. package/dist/strategies/click.d.ts +1 -1
  46. package/dist/strategies/environment.d.ts +1 -1
  47. package/dist/strategies/index.d.ts +14 -14
  48. package/dist/strategies/keyboard.d.ts +1 -1
  49. package/dist/strategies/mouse.d.ts +1 -1
  50. package/dist/strategies/resize.d.ts +1 -1
  51. package/dist/strategies/scroll.d.ts +1 -1
  52. package/dist/strategies/tap.d.ts +1 -1
  53. package/package.json +1 -1
@@ -5,32 +5,32 @@
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.Resize = exports.Environment = exports.Keyboard = exports.Tap = exports.Click = exports.Scroll = exports.Mouse = exports.ResizeStrategy = exports.EnvironmentStrategy = exports.KeyboardStrategy = exports.TapStrategy = exports.ClickStrategy = exports.ScrollStrategy = exports.MouseStrategy = void 0;
8
- var mouse_1 = require("./mouse");
9
- Object.defineProperty(exports, "MouseStrategy", { enumerable: true, get: function () { return mouse_1.MouseStrategy; } });
10
- var scroll_1 = require("./scroll");
11
- Object.defineProperty(exports, "ScrollStrategy", { enumerable: true, get: function () { return scroll_1.ScrollStrategy; } });
12
- var click_1 = require("./click");
13
- Object.defineProperty(exports, "ClickStrategy", { enumerable: true, get: function () { return click_1.ClickStrategy; } });
14
- var tap_1 = require("./tap");
15
- Object.defineProperty(exports, "TapStrategy", { enumerable: true, get: function () { return tap_1.TapStrategy; } });
16
- var keyboard_1 = require("./keyboard");
17
- Object.defineProperty(exports, "KeyboardStrategy", { enumerable: true, get: function () { return keyboard_1.KeyboardStrategy; } });
18
- var environment_1 = require("./environment");
19
- Object.defineProperty(exports, "EnvironmentStrategy", { enumerable: true, get: function () { return environment_1.EnvironmentStrategy; } });
20
- var resize_1 = require("./resize");
21
- Object.defineProperty(exports, "ResizeStrategy", { enumerable: true, get: function () { return resize_1.ResizeStrategy; } });
8
+ var mouse_js_1 = require("./mouse.js");
9
+ Object.defineProperty(exports, "MouseStrategy", { enumerable: true, get: function () { return mouse_js_1.MouseStrategy; } });
10
+ var scroll_js_1 = require("./scroll.js");
11
+ Object.defineProperty(exports, "ScrollStrategy", { enumerable: true, get: function () { return scroll_js_1.ScrollStrategy; } });
12
+ var click_js_1 = require("./click.js");
13
+ Object.defineProperty(exports, "ClickStrategy", { enumerable: true, get: function () { return click_js_1.ClickStrategy; } });
14
+ var tap_js_1 = require("./tap.js");
15
+ Object.defineProperty(exports, "TapStrategy", { enumerable: true, get: function () { return tap_js_1.TapStrategy; } });
16
+ var keyboard_js_1 = require("./keyboard.js");
17
+ Object.defineProperty(exports, "KeyboardStrategy", { enumerable: true, get: function () { return keyboard_js_1.KeyboardStrategy; } });
18
+ var environment_js_1 = require("./environment.js");
19
+ Object.defineProperty(exports, "EnvironmentStrategy", { enumerable: true, get: function () { return environment_js_1.EnvironmentStrategy; } });
20
+ var resize_js_1 = require("./resize.js");
21
+ Object.defineProperty(exports, "ResizeStrategy", { enumerable: true, get: function () { return resize_js_1.ResizeStrategy; } });
22
22
  // Convenience: All strategies
23
- var mouse_2 = require("./mouse");
24
- Object.defineProperty(exports, "Mouse", { enumerable: true, get: function () { return mouse_2.MouseStrategy; } });
25
- var scroll_2 = require("./scroll");
26
- Object.defineProperty(exports, "Scroll", { enumerable: true, get: function () { return scroll_2.ScrollStrategy; } });
27
- var click_2 = require("./click");
28
- Object.defineProperty(exports, "Click", { enumerable: true, get: function () { return click_2.ClickStrategy; } });
29
- var tap_2 = require("./tap");
30
- Object.defineProperty(exports, "Tap", { enumerable: true, get: function () { return tap_2.TapStrategy; } });
31
- var keyboard_2 = require("./keyboard");
32
- Object.defineProperty(exports, "Keyboard", { enumerable: true, get: function () { return keyboard_2.KeyboardStrategy; } });
33
- var environment_2 = require("./environment");
34
- Object.defineProperty(exports, "Environment", { enumerable: true, get: function () { return environment_2.EnvironmentStrategy; } });
35
- var resize_2 = require("./resize");
36
- Object.defineProperty(exports, "Resize", { enumerable: true, get: function () { return resize_2.ResizeStrategy; } });
23
+ var mouse_js_2 = require("./mouse.js");
24
+ Object.defineProperty(exports, "Mouse", { enumerable: true, get: function () { return mouse_js_2.MouseStrategy; } });
25
+ var scroll_js_2 = require("./scroll.js");
26
+ Object.defineProperty(exports, "Scroll", { enumerable: true, get: function () { return scroll_js_2.ScrollStrategy; } });
27
+ var click_js_2 = require("./click.js");
28
+ Object.defineProperty(exports, "Click", { enumerable: true, get: function () { return click_js_2.ClickStrategy; } });
29
+ var tap_js_2 = require("./tap.js");
30
+ Object.defineProperty(exports, "Tap", { enumerable: true, get: function () { return tap_js_2.TapStrategy; } });
31
+ var keyboard_js_2 = require("./keyboard.js");
32
+ Object.defineProperty(exports, "Keyboard", { enumerable: true, get: function () { return keyboard_js_2.KeyboardStrategy; } });
33
+ var environment_js_2 = require("./environment.js");
34
+ Object.defineProperty(exports, "Environment", { enumerable: true, get: function () { return environment_js_2.EnvironmentStrategy; } });
35
+ var resize_js_2 = require("./resize.js");
36
+ Object.defineProperty(exports, "Resize", { enumerable: true, get: function () { return resize_js_2.ResizeStrategy; } });
@@ -3,7 +3,7 @@
3
3
  * Monitors typing in specific input fields
4
4
  * Analyzes keydown/keyup timing and micro-variations
5
5
  */
6
- import { BaseStrategy } from '../strategy';
6
+ import { BaseStrategy } from '../strategy.js';
7
7
  export declare class KeyboardStrategy extends BaseStrategy {
8
8
  readonly name = "keyboard";
9
9
  readonly defaultWeight = 0.1;
@@ -6,9 +6,9 @@
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
8
  exports.KeyboardStrategy = void 0;
9
- const strategy_1 = require("../strategy");
10
- const math_utils_1 = require("../math-utils");
11
- class KeyboardStrategy extends strategy_1.BaseStrategy {
9
+ const strategy_js_1 = require("../strategy.js");
10
+ const math_utils_js_1 = require("../math-utils.js");
11
+ class KeyboardStrategy extends strategy_js_1.BaseStrategy {
12
12
  constructor(options) {
13
13
  super();
14
14
  this.name = 'keyboard';
@@ -151,14 +151,14 @@ class KeyboardStrategy extends strategy_1.BaseStrategy {
151
151
  for (let i = 1; i < downEvents.length; i++) {
152
152
  keystrokeIntervals.push(downEvents[i].timestamp - downEvents[i - 1].timestamp);
153
153
  }
154
- const keystrokeAnalysis = (0, math_utils_1.analyzeIntervals)(keystrokeIntervals);
154
+ const keystrokeAnalysis = (0, math_utils_js_1.analyzeIntervals)(keystrokeIntervals);
155
155
  if (keystrokeAnalysis) {
156
156
  const { statistics, allIdentical } = keystrokeAnalysis;
157
157
  // Keyboard-specific heuristics for keystroke timing
158
158
  if (allIdentical) {
159
159
  return 0.1; // All identical - bot!
160
160
  }
161
- const keystrokeScore = (0, math_utils_1.scoreCoefficientOfVariation)(statistics.cv);
161
+ const keystrokeScore = (0, math_utils_js_1.scoreCoefficientOfVariation)(statistics.cv);
162
162
  score += keystrokeScore;
163
163
  factors++;
164
164
  // Early return if bot detected
@@ -173,7 +173,7 @@ class KeyboardStrategy extends strategy_1.BaseStrategy {
173
173
  pressDurations.push(this.events[i + 1].timestamp - this.events[i].timestamp);
174
174
  }
175
175
  }
176
- const pressDurationAnalysis = (0, math_utils_1.analyzeIntervals)(pressDurations);
176
+ const pressDurationAnalysis = (0, math_utils_js_1.analyzeIntervals)(pressDurations);
177
177
  if (pressDurationAnalysis) {
178
178
  const { statistics, allIdentical } = pressDurationAnalysis;
179
179
  // Keyboard-specific heuristics for press duration
@@ -186,7 +186,7 @@ class KeyboardStrategy extends strategy_1.BaseStrategy {
186
186
  factors++;
187
187
  }
188
188
  else {
189
- const pressDurationScore = (0, math_utils_1.scoreCoefficientOfVariation)(statistics.cv);
189
+ const pressDurationScore = (0, math_utils_js_1.scoreCoefficientOfVariation)(statistics.cv);
190
190
  score += pressDurationScore;
191
191
  factors++;
192
192
  // Early return if bot detected
@@ -3,7 +3,7 @@
3
3
  * Autonomous module that manages its own mouse event listeners and state
4
4
  * Tracks distance and angle to detect unnatural jumps and sharp turns
5
5
  */
6
- import { BaseStrategy, type TimeSeriesPoint } from '../strategy';
6
+ import { BaseStrategy, type TimeSeriesPoint } from '../strategy.js';
7
7
  export declare class MouseStrategy extends BaseStrategy {
8
8
  readonly name = "mouse";
9
9
  readonly defaultWeight = 0.3;
@@ -6,9 +6,9 @@
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
8
  exports.MouseStrategy = void 0;
9
- const strategy_1 = require("../strategy");
10
- const math_utils_1 = require("../math-utils");
11
- class MouseStrategy extends strategy_1.BaseStrategy {
9
+ const strategy_js_1 = require("../strategy.js");
10
+ const math_utils_js_1 = require("../math-utils.js");
11
+ class MouseStrategy extends strategy_js_1.BaseStrategy {
12
12
  constructor(options) {
13
13
  super();
14
14
  this.name = 'mouse';
@@ -124,11 +124,11 @@ class MouseStrategy extends strategy_1.BaseStrategy {
124
124
  // 1. VELOCITY CONSISTENCY - Bots often move at constant speed
125
125
  const distances = this.distanceSeries.map(p => p.value);
126
126
  if (distances.length >= 3) {
127
- const stats = (0, math_utils_1.calculateStatistics)(distances);
127
+ const stats = (0, math_utils_js_1.calculateStatistics)(distances);
128
128
  // Real human movement has high variation (CV ~0.8-1.2)
129
129
  // page.mouse.move() with steps has lower CV (~0.4-0.6)
130
130
  // Narrower gaussian to be strict
131
- score += (0, math_utils_1.gaussian)(stats.cv, 0.9, 0.35);
131
+ score += (0, math_utils_js_1.gaussian)(stats.cv, 0.9, 0.35);
132
132
  factors++;
133
133
  }
134
134
  // 2. DIRECTION CHANGES - Bots often have too few or too many sharp turns
@@ -141,7 +141,7 @@ class MouseStrategy extends strategy_1.BaseStrategy {
141
141
  const avgChange = angleChanges.reduce((a, b) => a + b, 0) / angleChanges.length;
142
142
  // Real humans have moderate but varied direction changes
143
143
  // page.mouse.move() linear interpolation has very small, consistent changes
144
- score += (0, math_utils_1.gaussian)(avgChange, 0.15, 0.12);
144
+ score += (0, math_utils_js_1.gaussian)(avgChange, 0.15, 0.12);
145
145
  factors++;
146
146
  }
147
147
  return factors > 0 ? score / factors : undefined;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Resize Behavior Detection Strategy
3
3
  */
4
- import { BaseStrategy } from '../strategy';
4
+ import { BaseStrategy } from '../strategy.js';
5
5
  export declare class ResizeStrategy extends BaseStrategy {
6
6
  readonly name = "resize";
7
7
  readonly defaultWeight = 0.02;
@@ -4,9 +4,9 @@
4
4
  */
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.ResizeStrategy = void 0;
7
- const strategy_1 = require("../strategy");
8
- const math_utils_1 = require("../math-utils");
9
- class ResizeStrategy extends strategy_1.BaseStrategy {
7
+ const strategy_js_1 = require("../strategy.js");
8
+ const math_utils_js_1 = require("../math-utils.js");
9
+ class ResizeStrategy extends strategy_js_1.BaseStrategy {
10
10
  constructor() {
11
11
  super(...arguments);
12
12
  this.name = 'resize';
@@ -76,13 +76,13 @@ class ResizeStrategy extends strategy_1.BaseStrategy {
76
76
  let score = 0;
77
77
  let factors = 0;
78
78
  // Frequency
79
- score += (0, math_utils_1.inverseSigmoid)(this.events.length, 5, 0.5);
79
+ score += (0, math_utils_js_1.inverseSigmoid)(this.events.length, 5, 0.5);
80
80
  factors++;
81
81
  // Mouse near edge
82
82
  const withMouse = this.events.filter(e => e.mouseX !== undefined);
83
83
  if (withMouse.length > 0) {
84
84
  const nearEdge = withMouse.filter(e => e.mouseNearEdge).length;
85
- score += (0, math_utils_1.sigmoid)(nearEdge / withMouse.length, 0.5, 8);
85
+ score += (0, math_utils_js_1.sigmoid)(nearEdge / withMouse.length, 0.5, 8);
86
86
  factors++;
87
87
  }
88
88
  return factors > 0 ? score / factors : undefined;
@@ -3,7 +3,7 @@
3
3
  * Autonomous module managing scroll event listeners
4
4
  * Tracks normalized scroll distance and velocity patterns
5
5
  */
6
- import { BaseStrategy, type TimeSeriesPoint } from '../strategy';
6
+ import { BaseStrategy, type TimeSeriesPoint } from '../strategy.js';
7
7
  export declare class ScrollStrategy extends BaseStrategy {
8
8
  readonly name = "scroll";
9
9
  readonly defaultWeight = 0.15;
@@ -6,9 +6,9 @@
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
8
  exports.ScrollStrategy = void 0;
9
- const strategy_1 = require("../strategy");
10
- const math_utils_1 = require("../math-utils");
11
- class ScrollStrategy extends strategy_1.BaseStrategy {
9
+ const strategy_js_1 = require("../strategy.js");
10
+ const math_utils_js_1 = require("../math-utils.js");
11
+ class ScrollStrategy extends strategy_js_1.BaseStrategy {
12
12
  constructor(options) {
13
13
  super();
14
14
  this.name = 'scroll';
@@ -110,20 +110,20 @@ class ScrollStrategy extends strategy_1.BaseStrategy {
110
110
  }
111
111
  // 2. DISTANCE CONSISTENCY - Bots often scroll same amount repeatedly
112
112
  if (distances.length >= 2) {
113
- const stats = (0, math_utils_1.calculateStatistics)(distances);
113
+ const stats = (0, math_utils_js_1.calculateStatistics)(distances);
114
114
  // Real humans have high CV (>0.8) due to natural scroll acceleration/deceleration
115
115
  // Simple automation has lower CV even with varied amounts
116
116
  // Gaussian centered high with narrow width - be strict
117
- score += (0, math_utils_1.gaussian)(stats.cv, 1.0, 0.4);
117
+ score += (0, math_utils_js_1.gaussian)(stats.cv, 1.0, 0.4);
118
118
  factors++;
119
119
  }
120
120
  // 3. VELOCITY VARIATION - Humans have highly variable scroll speeds
121
121
  const velocities = this.velocitySeries.map(p => p.value);
122
122
  if (velocities.length >= 2) {
123
- const stats = (0, math_utils_1.calculateStatistics)(velocities);
123
+ const stats = (0, math_utils_js_1.calculateStatistics)(velocities);
124
124
  // Human velocity is very chaotic (acceleration/deceleration)
125
125
  // Automation has more consistent velocity even with delays
126
- score += (0, math_utils_1.gaussian)(stats.cv, 1.2, 0.5);
126
+ score += (0, math_utils_js_1.gaussian)(stats.cv, 1.2, 0.5);
127
127
  factors++;
128
128
  }
129
129
  // 4. INSTANT JUMPS - Detect programmatic scrollTo
@@ -131,7 +131,7 @@ class ScrollStrategy extends strategy_1.BaseStrategy {
131
131
  if (distances.length > 0) {
132
132
  const jumpRatio = instantJumps / distances.length;
133
133
  // Penalize high jump ratio (programmatic scrollTo)
134
- score += (0, math_utils_1.inverseSigmoid)(jumpRatio, 0.3, 15);
134
+ score += (0, math_utils_js_1.inverseSigmoid)(jumpRatio, 0.3, 15);
135
135
  factors++;
136
136
  }
137
137
  return factors > 0 ? score / factors : undefined;
@@ -3,7 +3,7 @@
3
3
  * Monitors touch interactions on specific elements
4
4
  * Analyzes tap duration, precision, movement, and timing patterns
5
5
  */
6
- import { BaseStrategy } from '../strategy';
6
+ import { BaseStrategy } from '../strategy.js';
7
7
  export declare class TapStrategy extends BaseStrategy {
8
8
  readonly name = "tap";
9
9
  readonly defaultWeight = 0.35;
@@ -6,9 +6,9 @@
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
8
  exports.TapStrategy = void 0;
9
- const strategy_1 = require("../strategy");
10
- const math_utils_1 = require("../math-utils");
11
- class TapStrategy extends strategy_1.BaseStrategy {
9
+ const strategy_js_1 = require("../strategy.js");
10
+ const math_utils_js_1 = require("../math-utils.js");
11
+ class TapStrategy extends strategy_js_1.BaseStrategy {
12
12
  constructor(options) {
13
13
  super();
14
14
  this.name = 'tap';
@@ -159,7 +159,7 @@ class TapStrategy extends strategy_1.BaseStrategy {
159
159
  // 2. Tap duration variation - Humans have natural variation (50-150ms typical)
160
160
  const durations = this.events.map(e => e.duration);
161
161
  if (durations.length >= 2) {
162
- const durationAnalysis = (0, math_utils_1.analyzeIntervals)(durations);
162
+ const durationAnalysis = (0, math_utils_js_1.analyzeIntervals)(durations);
163
163
  if (durationAnalysis) {
164
164
  const { statistics, allIdentical } = durationAnalysis;
165
165
  // All identical = bot
@@ -167,10 +167,10 @@ class TapStrategy extends strategy_1.BaseStrategy {
167
167
  return 0.05;
168
168
  }
169
169
  // Human tap durations have moderate CV (~0.3-0.5)
170
- score += (0, math_utils_1.scoreCoefficientOfVariation)(statistics.cv);
170
+ score += (0, math_utils_js_1.scoreCoefficientOfVariation)(statistics.cv);
171
171
  factors++;
172
172
  // Ideal duration: 70-120ms
173
- score += (0, math_utils_1.gaussian)(statistics.mean, 95, 40);
173
+ score += (0, math_utils_js_1.gaussian)(statistics.mean, 95, 40);
174
174
  factors++;
175
175
  }
176
176
  }
@@ -179,7 +179,7 @@ class TapStrategy extends strategy_1.BaseStrategy {
179
179
  if (movements.length > 0) {
180
180
  const avgMovement = movements.reduce((a, b) => a + b, 0) / movements.length;
181
181
  // Some movement is natural (1-5px), too much is a swipe, zero is suspicious
182
- score += (0, math_utils_1.gaussian)(avgMovement, 2, 3);
182
+ score += (0, math_utils_js_1.gaussian)(avgMovement, 2, 3);
183
183
  factors++;
184
184
  }
185
185
  // 4. Tap interval timing - Time between taps should vary naturally
@@ -188,9 +188,9 @@ class TapStrategy extends strategy_1.BaseStrategy {
188
188
  for (let i = 1; i < this.events.length; i++) {
189
189
  intervals.push(this.events[i].timestamp - this.events[i - 1].timestamp);
190
190
  }
191
- const intervalAnalysis = (0, math_utils_1.analyzeIntervals)(intervals);
191
+ const intervalAnalysis = (0, math_utils_js_1.analyzeIntervals)(intervals);
192
192
  if (intervalAnalysis && !intervalAnalysis.allIdentical) {
193
- score += (0, math_utils_1.scoreCoefficientOfVariation)(intervalAnalysis.statistics.cv);
193
+ score += (0, math_utils_js_1.scoreCoefficientOfVariation)(intervalAnalysis.statistics.cv);
194
194
  factors++;
195
195
  }
196
196
  }
@@ -1,5 +1,5 @@
1
- import type { ScoreOptions, ScoreResult } from './types';
2
- import type { DetectionStrategy, StrategyConfig, TickOptions } from './strategy';
1
+ import type { ScoreOptions, ScoreResult } from './types.js';
2
+ import type { DetectionStrategy, StrategyConfig, TickOptions } from './strategy.js';
3
3
  /**
4
4
  * Main class for behavior detection
5
5
  * Uses modular strategy pattern for tree-shakeable, autonomous detection modules
@@ -30,7 +30,7 @@
30
30
  * }
31
31
  * </script>
32
32
  */
33
- import { BehaviorDetector } from './behavior-detector';
33
+ import { BehaviorDetector } from './behavior-detector.js';
34
34
  import { MouseStrategy, ScrollStrategy, ClickStrategy, TapStrategy, KeyboardStrategy, EnvironmentStrategy, ResizeStrategy, } from './strategies/index.js';
35
35
  /**
36
36
  * Detect if the current device is mobile
@@ -31,8 +31,8 @@
31
31
  * const result = await detector.score();
32
32
  * ```
33
33
  */
34
- export { BehaviorDetector } from './behavior-detector';
35
- export type { DetectionStrategy, StrategyConfig } from './strategy';
34
+ export { BehaviorDetector } from './behavior-detector.js';
35
+ export type { DetectionStrategy, StrategyConfig } from './strategy.js';
36
36
  export { Mouse, Scroll, Click, Tap, Keyboard, Environment, Resize, MouseStrategy, ScrollStrategy, ClickStrategy, TapStrategy, KeyboardStrategy, EnvironmentStrategy, ResizeStrategy, } from './strategies/index.js';
37
- export type { BehaviorSettings, ScoreOptions, ScoreResult, ScoreBreakdown, TrackedEvent, EventType, ScoringFunction, } from './types';
38
- export { DEFAULT_SETTINGS } from './types';
37
+ export type { BehaviorSettings, ScoreOptions, ScoreResult, ScoreBreakdown, TrackedEvent, EventType, ScoringFunction, } from './types.js';
38
+ export { DEFAULT_SETTINGS } from './types.js';
package/dist/esm/index.js CHANGED
@@ -31,6 +31,6 @@
31
31
  * const result = await detector.score();
32
32
  * ```
33
33
  */
34
- export { BehaviorDetector } from './behavior-detector';
34
+ export { BehaviorDetector } from './behavior-detector.js';
35
35
  export { Mouse, Scroll, Click, Tap, Keyboard, Environment, Resize, MouseStrategy, ScrollStrategy, ClickStrategy, TapStrategy, KeyboardStrategy, EnvironmentStrategy, ResizeStrategy, } from './strategies/index.js';
36
- export { DEFAULT_SETTINGS } from './types';
36
+ export { DEFAULT_SETTINGS } from './types.js';
@@ -2,7 +2,7 @@
2
2
  * Click Behavior Detection Strategy
3
3
  * Monitors specific elements for click positioning patterns
4
4
  */
5
- import { BaseStrategy } from '../strategy';
5
+ import { BaseStrategy } from '../strategy.js';
6
6
  export declare class ClickStrategy extends BaseStrategy {
7
7
  readonly name = "click";
8
8
  readonly defaultWeight = 0.3;
@@ -2,7 +2,7 @@
2
2
  * Click Behavior Detection Strategy
3
3
  * Monitors specific elements for click positioning patterns
4
4
  */
5
- import { BaseStrategy } from '../strategy';
5
+ import { BaseStrategy } from '../strategy.js';
6
6
  export class ClickStrategy extends BaseStrategy {
7
7
  constructor(options) {
8
8
  super();
@@ -2,7 +2,7 @@
2
2
  * Environment Fingerprinting Strategy
3
3
  * Captures browser environment on initialization and tick updates
4
4
  */
5
- import { BaseStrategy } from '../strategy';
5
+ import { BaseStrategy } from '../strategy.js';
6
6
  interface EnvironmentData {
7
7
  screenWidth: number;
8
8
  screenHeight: number;
@@ -2,8 +2,8 @@
2
2
  * Environment Fingerprinting Strategy
3
3
  * Captures browser environment on initialization and tick updates
4
4
  */
5
- import { BaseStrategy } from '../strategy';
6
- import { inverseSigmoid, gaussian } from '../math-utils';
5
+ import { BaseStrategy } from '../strategy.js';
6
+ import { inverseSigmoid, gaussian } from '../math-utils.js';
7
7
  export class EnvironmentStrategy extends BaseStrategy {
8
8
  constructor() {
9
9
  super(...arguments);
@@ -2,17 +2,17 @@
2
2
  * Detection Strategies - Modular behavior analysis
3
3
  * Import only what you need for optimal bundle size
4
4
  */
5
- export { MouseStrategy } from './mouse';
6
- export { ScrollStrategy } from './scroll';
7
- export { ClickStrategy } from './click';
8
- export { TapStrategy } from './tap';
9
- export { KeyboardStrategy } from './keyboard';
10
- export { EnvironmentStrategy } from './environment';
11
- export { ResizeStrategy } from './resize';
12
- export { MouseStrategy as Mouse } from './mouse';
13
- export { ScrollStrategy as Scroll } from './scroll';
14
- export { ClickStrategy as Click } from './click';
15
- export { TapStrategy as Tap } from './tap';
16
- export { KeyboardStrategy as Keyboard } from './keyboard';
17
- export { EnvironmentStrategy as Environment } from './environment';
18
- export { ResizeStrategy as Resize } from './resize';
5
+ export { MouseStrategy } from './mouse.js';
6
+ export { ScrollStrategy } from './scroll.js';
7
+ export { ClickStrategy } from './click.js';
8
+ export { TapStrategy } from './tap.js';
9
+ export { KeyboardStrategy } from './keyboard.js';
10
+ export { EnvironmentStrategy } from './environment.js';
11
+ export { ResizeStrategy } from './resize.js';
12
+ export { MouseStrategy as Mouse } from './mouse.js';
13
+ export { ScrollStrategy as Scroll } from './scroll.js';
14
+ export { ClickStrategy as Click } from './click.js';
15
+ export { TapStrategy as Tap } from './tap.js';
16
+ export { KeyboardStrategy as Keyboard } from './keyboard.js';
17
+ export { EnvironmentStrategy as Environment } from './environment.js';
18
+ export { ResizeStrategy as Resize } from './resize.js';
@@ -2,18 +2,18 @@
2
2
  * Detection Strategies - Modular behavior analysis
3
3
  * Import only what you need for optimal bundle size
4
4
  */
5
- export { MouseStrategy } from './mouse';
6
- export { ScrollStrategy } from './scroll';
7
- export { ClickStrategy } from './click';
8
- export { TapStrategy } from './tap';
9
- export { KeyboardStrategy } from './keyboard';
10
- export { EnvironmentStrategy } from './environment';
11
- export { ResizeStrategy } from './resize';
5
+ export { MouseStrategy } from './mouse.js';
6
+ export { ScrollStrategy } from './scroll.js';
7
+ export { ClickStrategy } from './click.js';
8
+ export { TapStrategy } from './tap.js';
9
+ export { KeyboardStrategy } from './keyboard.js';
10
+ export { EnvironmentStrategy } from './environment.js';
11
+ export { ResizeStrategy } from './resize.js';
12
12
  // Convenience: All strategies
13
- export { MouseStrategy as Mouse } from './mouse';
14
- export { ScrollStrategy as Scroll } from './scroll';
15
- export { ClickStrategy as Click } from './click';
16
- export { TapStrategy as Tap } from './tap';
17
- export { KeyboardStrategy as Keyboard } from './keyboard';
18
- export { EnvironmentStrategy as Environment } from './environment';
19
- export { ResizeStrategy as Resize } from './resize';
13
+ export { MouseStrategy as Mouse } from './mouse.js';
14
+ export { ScrollStrategy as Scroll } from './scroll.js';
15
+ export { ClickStrategy as Click } from './click.js';
16
+ export { TapStrategy as Tap } from './tap.js';
17
+ export { KeyboardStrategy as Keyboard } from './keyboard.js';
18
+ export { EnvironmentStrategy as Environment } from './environment.js';
19
+ export { ResizeStrategy as Resize } from './resize.js';
@@ -3,7 +3,7 @@
3
3
  * Monitors typing in specific input fields
4
4
  * Analyzes keydown/keyup timing and micro-variations
5
5
  */
6
- import { BaseStrategy } from '../strategy';
6
+ import { BaseStrategy } from '../strategy.js';
7
7
  export declare class KeyboardStrategy extends BaseStrategy {
8
8
  readonly name = "keyboard";
9
9
  readonly defaultWeight = 0.1;
@@ -3,8 +3,8 @@
3
3
  * Monitors typing in specific input fields
4
4
  * Analyzes keydown/keyup timing and micro-variations
5
5
  */
6
- import { BaseStrategy } from '../strategy';
7
- import { analyzeIntervals, scoreCoefficientOfVariation } from '../math-utils';
6
+ import { BaseStrategy } from '../strategy.js';
7
+ import { analyzeIntervals, scoreCoefficientOfVariation } from '../math-utils.js';
8
8
  export class KeyboardStrategy extends BaseStrategy {
9
9
  constructor(options) {
10
10
  super();
@@ -3,7 +3,7 @@
3
3
  * Autonomous module that manages its own mouse event listeners and state
4
4
  * Tracks distance and angle to detect unnatural jumps and sharp turns
5
5
  */
6
- import { BaseStrategy, type TimeSeriesPoint } from '../strategy';
6
+ import { BaseStrategy, type TimeSeriesPoint } from '../strategy.js';
7
7
  export declare class MouseStrategy extends BaseStrategy {
8
8
  readonly name = "mouse";
9
9
  readonly defaultWeight = 0.3;
@@ -3,8 +3,8 @@
3
3
  * Autonomous module that manages its own mouse event listeners and state
4
4
  * Tracks distance and angle to detect unnatural jumps and sharp turns
5
5
  */
6
- import { BaseStrategy } from '../strategy';
7
- import { calculateStatistics, gaussian } from '../math-utils';
6
+ import { BaseStrategy } from '../strategy.js';
7
+ import { calculateStatistics, gaussian } from '../math-utils.js';
8
8
  export class MouseStrategy extends BaseStrategy {
9
9
  constructor(options) {
10
10
  super();
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Resize Behavior Detection Strategy
3
3
  */
4
- import { BaseStrategy } from '../strategy';
4
+ import { BaseStrategy } from '../strategy.js';
5
5
  export declare class ResizeStrategy extends BaseStrategy {
6
6
  readonly name = "resize";
7
7
  readonly defaultWeight = 0.02;
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * Resize Behavior Detection Strategy
3
3
  */
4
- import { BaseStrategy } from '../strategy';
5
- import { inverseSigmoid, sigmoid } from '../math-utils';
4
+ import { BaseStrategy } from '../strategy.js';
5
+ import { inverseSigmoid, sigmoid } from '../math-utils.js';
6
6
  export class ResizeStrategy extends BaseStrategy {
7
7
  constructor() {
8
8
  super(...arguments);
@@ -3,7 +3,7 @@
3
3
  * Autonomous module managing scroll event listeners
4
4
  * Tracks normalized scroll distance and velocity patterns
5
5
  */
6
- import { BaseStrategy, type TimeSeriesPoint } from '../strategy';
6
+ import { BaseStrategy, type TimeSeriesPoint } from '../strategy.js';
7
7
  export declare class ScrollStrategy extends BaseStrategy {
8
8
  readonly name = "scroll";
9
9
  readonly defaultWeight = 0.15;
@@ -3,8 +3,8 @@
3
3
  * Autonomous module managing scroll event listeners
4
4
  * Tracks normalized scroll distance and velocity patterns
5
5
  */
6
- import { BaseStrategy } from '../strategy';
7
- import { calculateStatistics, gaussian, inverseSigmoid } from '../math-utils';
6
+ import { BaseStrategy } from '../strategy.js';
7
+ import { calculateStatistics, gaussian, inverseSigmoid } from '../math-utils.js';
8
8
  export class ScrollStrategy extends BaseStrategy {
9
9
  constructor(options) {
10
10
  super();
@@ -3,7 +3,7 @@
3
3
  * Monitors touch interactions on specific elements
4
4
  * Analyzes tap duration, precision, movement, and timing patterns
5
5
  */
6
- import { BaseStrategy } from '../strategy';
6
+ import { BaseStrategy } from '../strategy.js';
7
7
  export declare class TapStrategy extends BaseStrategy {
8
8
  readonly name = "tap";
9
9
  readonly defaultWeight = 0.35;
@@ -3,8 +3,8 @@
3
3
  * Monitors touch interactions on specific elements
4
4
  * Analyzes tap duration, precision, movement, and timing patterns
5
5
  */
6
- import { BaseStrategy } from '../strategy';
7
- import { analyzeIntervals, scoreCoefficientOfVariation, gaussian } from '../math-utils';
6
+ import { BaseStrategy } from '../strategy.js';
7
+ import { analyzeIntervals, scoreCoefficientOfVariation, gaussian } from '../math-utils.js';
8
8
  export class TapStrategy extends BaseStrategy {
9
9
  constructor(options) {
10
10
  super();
package/dist/index.d.ts CHANGED
@@ -31,8 +31,8 @@
31
31
  * const result = await detector.score();
32
32
  * ```
33
33
  */
34
- export { BehaviorDetector } from './behavior-detector';
35
- export type { DetectionStrategy, StrategyConfig } from './strategy';
34
+ export { BehaviorDetector } from './behavior-detector.js';
35
+ export type { DetectionStrategy, StrategyConfig } from './strategy.js';
36
36
  export { Mouse, Scroll, Click, Tap, Keyboard, Environment, Resize, MouseStrategy, ScrollStrategy, ClickStrategy, TapStrategy, KeyboardStrategy, EnvironmentStrategy, ResizeStrategy, } from './strategies/index.js';
37
- export type { BehaviorSettings, ScoreOptions, ScoreResult, ScoreBreakdown, TrackedEvent, EventType, ScoringFunction, } from './types';
38
- export { DEFAULT_SETTINGS } from './types';
37
+ export type { BehaviorSettings, ScoreOptions, ScoreResult, ScoreBreakdown, TrackedEvent, EventType, ScoringFunction, } from './types.js';
38
+ export { DEFAULT_SETTINGS } from './types.js';
@@ -2,7 +2,7 @@
2
2
  * Click Behavior Detection Strategy
3
3
  * Monitors specific elements for click positioning patterns
4
4
  */
5
- import { BaseStrategy } from '../strategy';
5
+ import { BaseStrategy } from '../strategy.js';
6
6
  export declare class ClickStrategy extends BaseStrategy {
7
7
  readonly name = "click";
8
8
  readonly defaultWeight = 0.3;