feat(cra,agent): readiness copy refinement + Track B (CompanyProfile prefill)
Readiness check: legally tighter + sales-sharper copy per review — names both regulations cleanly (CRA + Machinery Reg 2023/1230 in plain language), frames CRA Art. 13 as "more than a yearly pentest: assess/document/handle cyber risk across the lifecycle" (not over-claiming a "continuously documented risk assessment"), adds the "we turn regulation into code" positioning, and reorders the 8 questions in CRA order (machine -> connectivity -> software -> updates -> remote -> app -> personal data -> critical env). Track B: the Compliance Agent Pre-Scan wizard now detects the shared CompanyProfile and offers "Aus Profil übernehmen" — tolerant mapping (legal_form, industry, employee_count) across the differing module vocabularies, user- triggered (never silent), so company context isn't re-asked. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -110,6 +110,34 @@ export function isContextComplete(ctx: ScanContext): boolean {
|
||||
)
|
||||
}
|
||||
|
||||
// Track B — consolidation: prefill from the shared CompanyProfile instead of
|
||||
// re-asking. Vocabularies differ across modules, so map tolerantly (only fields
|
||||
// that map cleanly; the rest the user fills). User-triggered, never silent.
|
||||
const DEV_TENANT = '9282a473-5c95-4b3a-bf78-0ecc0ec71d3e'
|
||||
const _VALID_LEGAL = new Set(['ag', 'gmbh', 'gmbh_co_kg', 'kg', 'ohg', 'ug', 'ek', 'verein', 'stiftung', 'behoerde'])
|
||||
const _INDUSTRY_ALIAS: Record<string, string> = {
|
||||
maschinenbau: 'manufacturing', industrie: 'manufacturing', manufacturing: 'manufacturing',
|
||||
automotive: 'automotive', oem: 'automotive', saas: 'saas', software: 'saas',
|
||||
ecommerce: 'ecommerce', handel: 'ecommerce', banking: 'banking', finance: 'banking',
|
||||
insurance: 'insurance', versicherung: 'insurance', healthcare: 'healthcare', gesundheit: 'healthcare',
|
||||
bildung: 'education', education: 'education', medien: 'media', media: 'media',
|
||||
verwaltung: 'public', public: 'public',
|
||||
}
|
||||
const _SIZE_TO_EMP: Record<string, string> = {
|
||||
micro: 'lt10', small: '20_49', medium: '50_249', large: '250_499', enterprise: '1000_plus',
|
||||
}
|
||||
|
||||
function mapProfileToScanContext(p: any): Partial<ScanContext> {
|
||||
const out: Partial<ScanContext> = {}
|
||||
const lf = String(p.legal_form || '').toLowerCase().replace(/[^a-z_]/g, '')
|
||||
if (_VALID_LEGAL.has(lf)) out.legal_form = lf
|
||||
const ind = String(Array.isArray(p.industry) ? p.industry[0] : (p.industry || '')).toLowerCase().trim()
|
||||
if (_INDUSTRY_ALIAS[ind]) out.industry = _INDUSTRY_ALIAS[ind]
|
||||
const size = String(p.company_size || '').toLowerCase()
|
||||
if (_SIZE_TO_EMP[size]) out.employee_count = _SIZE_TO_EMP[size]
|
||||
return out
|
||||
}
|
||||
|
||||
export function PreScanWizard({
|
||||
value,
|
||||
onChange,
|
||||
@@ -117,6 +145,14 @@ export function PreScanWizard({
|
||||
value: ScanContext
|
||||
onChange: (ctx: ScanContext) => void
|
||||
}) {
|
||||
const [profile, setProfile] = useState<any>(null)
|
||||
useEffect(() => {
|
||||
fetch(`/api/sdk/v1/company-profile?tenant_id=${DEV_TENANT}`)
|
||||
.then((r) => (r.ok ? r.json() : null))
|
||||
.then((p) => { if (p && p.company_name) setProfile(p) })
|
||||
.catch(() => {})
|
||||
}, [])
|
||||
|
||||
const update = <K extends keyof ScanContext>(key: K, val: ScanContext[K]) => {
|
||||
onChange({ ...value, [key]: val })
|
||||
}
|
||||
@@ -149,6 +185,24 @@ export function PreScanWizard({
|
||||
Einschätzung statt pauschaler Verstoss-Listen.
|
||||
</p>
|
||||
|
||||
{profile && (
|
||||
<div style={{ background: '#ecfdf5', border: '1px solid #a7f3d0', borderRadius: 8,
|
||||
padding: '8px 12px', marginBottom: 12, fontSize: 11, color: '#065f46' }}>
|
||||
<strong>Unternehmensprofil erkannt:</strong> {profile.company_name}
|
||||
{profile.industry ? ` · ${Array.isArray(profile.industry) ? profile.industry.join(', ') : profile.industry}` : ''}
|
||||
{profile.legal_form ? ` · ${profile.legal_form}` : ''}
|
||||
{profile.company_size ? ` · ${profile.company_size}` : ''}
|
||||
{' '}— diese Angaben müssen Sie nicht erneut eingeben.
|
||||
<button
|
||||
onClick={() => onChange({ ...value, ...mapProfileToScanContext(profile) })}
|
||||
style={{ marginLeft: 8, padding: '2px 10px', borderRadius: 6, border: '1px solid #059669',
|
||||
background: '#059669', color: '#fff', cursor: 'pointer', fontSize: 11 }}
|
||||
>
|
||||
Aus Profil übernehmen
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(2, 1fr)', gap: 10 }}>
|
||||
<Field label="1. Branche*">
|
||||
<select value={value.industry} onChange={e => update('industry', e.target.value)} style={inputStyle}>
|
||||
|
||||
Reference in New Issue
Block a user