@formguard/sdk 1.0.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.
@@ -0,0 +1,76 @@
1
+ interface FormGuardConfig {
2
+ apiKey: string;
3
+ apiUrl?: string;
4
+ debug?: boolean;
5
+ }
6
+ interface SubmissionData {
7
+ email: string;
8
+ fields: Record<string, any>;
9
+ completionTime?: number;
10
+ device?: string;
11
+ browser?: string;
12
+ }
13
+ interface SubmissionResponse {
14
+ success: boolean;
15
+ allowed: boolean;
16
+ action: "allowed" | "flagged" | "blocked";
17
+ qualityScore: number;
18
+ flags: {
19
+ vpn: boolean;
20
+ proxy: boolean;
21
+ disposableEmail: boolean;
22
+ duplicate: boolean;
23
+ fastCompletion: boolean;
24
+ };
25
+ submissionId: string;
26
+ }
27
+ declare class FormGuardSDK {
28
+ private apiKey;
29
+ private apiUrl;
30
+ private debug;
31
+ private sessionId;
32
+ private startTime;
33
+ private initialized;
34
+ /**
35
+ * Initialize FormGuard SDK
36
+ */
37
+ init(config: string | FormGuardConfig): void;
38
+ /**
39
+ * Track step change in multi-step forms
40
+ */
41
+ trackStep(step: number): void;
42
+ /**
43
+ * Track field error
44
+ */
45
+ trackError(field: string, errorMessage?: string): void;
46
+ /**
47
+ * Track drop-off
48
+ */
49
+ trackDropOff(step?: number, field?: string): void;
50
+ /**
51
+ * Submit form data
52
+ */
53
+ submit(data: SubmissionData): Promise<SubmissionResponse>;
54
+ /**
55
+ * Track custom event
56
+ */
57
+ private trackEvent;
58
+ /**
59
+ * Generate unique session ID
60
+ */
61
+ private generateSessionId;
62
+ /**
63
+ * Detect device type
64
+ */
65
+ private detectDevice;
66
+ /**
67
+ * Detect browser
68
+ */
69
+ private detectBrowser;
70
+ /**
71
+ * Debug logging
72
+ */
73
+ private log;
74
+ }
75
+ declare const formGuard: FormGuardSDK;
76
+ export default formGuard;
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "@formguard/sdk",
3
+ "version": "1.0.0",
4
+ "description": "FormGuard JavaScript SDK for form intelligence and lead quality scoring",
5
+ "main": "dist/formguard.js",
6
+ "module": "dist/formguard.esm.js",
7
+ "types": "dist/index.d.ts",
8
+ "type": "module",
9
+ "files": [
10
+ "dist",
11
+ "README.md",
12
+ "LICENSE"
13
+ ],
14
+ "scripts": {
15
+ "build": "rollup -c",
16
+ "dev": "rollup -c -w",
17
+ "prepublishOnly": "npm run build"
18
+ },
19
+ "keywords": [
20
+ "form",
21
+ "analytics",
22
+ "lead-scoring",
23
+ "bot-detection",
24
+ "form-validation",
25
+ "lead-quality",
26
+ "spam-detection",
27
+ "formguard"
28
+ ],
29
+ "author": "Omair Khoder <omair.khoder.01@gmail.com>",
30
+ "license": "MIT",
31
+ "repository": {
32
+ "type": "git",
33
+ "url": "git+https://github.com/OmAiR1Kh/formguard-sdk.git"
34
+ },
35
+ "bugs": {
36
+ "url": "https://github.com/OmAiR1Kh/formguard-sdk/issues"
37
+ },
38
+ "homepage": "https://github.com/OmAiR1Kh/formguard-sdk#readme",
39
+ "devDependencies": {
40
+ "@rollup/plugin-typescript": "^11.1.5",
41
+ "rollup": "^4.9.0",
42
+ "tslib": "^2.6.2",
43
+ "typescript": "^5.3.3"
44
+ }
45
+ }