@runhalo/engine 1.1.0 → 1.2.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.
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Age Gate Authentication Scaffold
|
|
3
|
-
* Addresses: coppa-auth-001 (CRITICAL)
|
|
4
|
-
* Generates an age verification gate
|
|
3
|
+
* Addresses: coppa-auth-001 (CRITICAL), asaa-av-004 (CRITICAL)
|
|
4
|
+
* Generates an age verification gate with three-tier categorization:
|
|
5
|
+
* - Under 13: COPPA (blocked or requires VPC)
|
|
6
|
+
* - 13-17: ASAA teen tier (requires parental consent)
|
|
7
|
+
* - 18+: Adult (full access)
|
|
5
8
|
*/
|
|
6
9
|
import type { ScaffoldTemplate } from '../index';
|
|
7
10
|
export declare const ageGateAuthTemplate: ScaffoldTemplate;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
3
|
* Age Gate Authentication Scaffold
|
|
4
|
-
* Addresses: coppa-auth-001 (CRITICAL)
|
|
5
|
-
* Generates an age verification gate
|
|
4
|
+
* Addresses: coppa-auth-001 (CRITICAL), asaa-av-004 (CRITICAL)
|
|
5
|
+
* Generates an age verification gate with three-tier categorization:
|
|
6
|
+
* - Under 13: COPPA (blocked or requires VPC)
|
|
7
|
+
* - 13-17: ASAA teen tier (requires parental consent)
|
|
8
|
+
* - 18+: Adult (full access)
|
|
6
9
|
*/
|
|
7
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
11
|
exports.ageGateAuthTemplate = void 0;
|
|
@@ -13,9 +16,9 @@ function generateReact(typescript) {
|
|
|
13
16
|
const eventType = typescript ? ': React.FormEvent<HTMLFormElement>' : '';
|
|
14
17
|
const changeType = typescript ? ': React.ChangeEvent<HTMLInputElement>' : '';
|
|
15
18
|
const propsType = typescript
|
|
16
|
-
? `\ninterface AgeGateProps {\n children: React.ReactNode;\n minimumAge?: number;\n onVerified?: () => void;\n onBlocked?: () => void;\n}\n`
|
|
19
|
+
? `\ntype AgeCategory = 'child' | 'teen' | 'adult';\n\ninterface AgeGateProps {\n children: React.ReactNode;\n minimumAge?: number;\n onVerified?: (category: AgeCategory) => void;\n onBlocked?: () => void;\n onTeenDetected?: () => void;\n}\n`
|
|
17
20
|
: '';
|
|
18
|
-
const propsArg = typescript ? '{ children, minimumAge = 13, onVerified, onBlocked }: AgeGateProps' : '{ children, minimumAge = 13, onVerified, onBlocked }';
|
|
21
|
+
const propsArg = typescript ? '{ children, minimumAge = 13, onVerified, onBlocked, onTeenDetected }: AgeGateProps' : '{ children, minimumAge = 13, onVerified, onBlocked, onTeenDetected }';
|
|
19
22
|
const component = `/**
|
|
20
23
|
* AgeGate — COPPA-compliant age verification component
|
|
21
24
|
*
|
|
@@ -39,7 +42,8 @@ export function AgeGate(${propsArg}) {
|
|
|
39
42
|
const [verified, setVerified] = useState${stateType}(() => {
|
|
40
43
|
// Check sessionStorage (not localStorage — don't persist across sessions)
|
|
41
44
|
if (typeof window !== 'undefined') {
|
|
42
|
-
|
|
45
|
+
const stored = sessionStorage.getItem(AGE_GATE_KEY);
|
|
46
|
+
return stored === 'adult' || stored === 'true'; // 'true' for backwards compat
|
|
43
47
|
}
|
|
44
48
|
return false;
|
|
45
49
|
});
|
|
@@ -64,11 +68,25 @@ export function AgeGate(${propsArg}) {
|
|
|
64
68
|
age--;
|
|
65
69
|
}
|
|
66
70
|
|
|
67
|
-
|
|
68
|
-
|
|
71
|
+
// ASAA three-tier age categorization
|
|
72
|
+
if (age >= 18) {
|
|
73
|
+
// Adult — full access
|
|
74
|
+
sessionStorage.setItem(AGE_GATE_KEY, 'adult');
|
|
69
75
|
setVerified(true);
|
|
70
|
-
onVerified?.();
|
|
76
|
+
onVerified?.('adult');
|
|
77
|
+
} else if (age >= 13) {
|
|
78
|
+
// ASAA teen tier (13-17) — requires parental consent
|
|
79
|
+
sessionStorage.setItem(AGE_GATE_KEY, 'teen');
|
|
80
|
+
onTeenDetected?.();
|
|
81
|
+
// Don't auto-verify — parent must consent first
|
|
82
|
+
setError('Users aged 13-17 require parental consent. Please ask a parent or guardian to approve your account.');
|
|
83
|
+
} else if (age >= minimumAge) {
|
|
84
|
+
// Custom minimum (if set below 13)
|
|
85
|
+
sessionStorage.setItem(AGE_GATE_KEY, 'child');
|
|
86
|
+
setVerified(true);
|
|
87
|
+
onVerified?.('child');
|
|
71
88
|
} else {
|
|
89
|
+
// Under minimum age — blocked
|
|
72
90
|
setBlocked(true);
|
|
73
91
|
onBlocked?.();
|
|
74
92
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"age-gate-auth.js","sourceRoot":"","sources":["../../../src/scaffolds/templates/age-gate-auth.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"age-gate-auth.js","sourceRoot":"","sources":["../../../src/scaffolds/templates/age-gate-auth.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AAKH,SAAS,aAAa,CAAC,UAAmB;IACxC,MAAM,GAAG,GAAG,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;IACvC,MAAM,cAAc,GAAG,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC;IACpD,MAAM,SAAS,GAAG,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC;IAChD,MAAM,SAAS,GAAG,UAAU,CAAC,CAAC,CAAC,oCAAoC,CAAC,CAAC,CAAC,EAAE,CAAC;IACzE,MAAM,UAAU,GAAG,UAAU,CAAC,CAAC,CAAC,uCAAuC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC7E,MAAM,SAAS,GAAG,UAAU;QAC1B,CAAC,CAAC,qPAAqP;QACvP,CAAC,CAAC,EAAE,CAAC;IACP,MAAM,QAAQ,GAAG,UAAU,CAAC,CAAC,CAAC,oFAAoF,CAAC,CAA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,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@runhalo/engine",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Halo rule engine — child online safety compliance detection. 160 rules across 16 packs covering COPPA, UK AADC, EU DSA, EU AI Act, and more.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|