'use client' import React, { useState } from 'react' import { IdentityVerificationMethod, DSRVerifyIdentityRequest } from '@/lib/sdk/dsr/types' interface DSRIdentityModalProps { isOpen: boolean onClose: () => void onVerify: (verification: DSRVerifyIdentityRequest) => Promise requesterName: string requesterEmail: string } const VERIFICATION_METHODS: { value: IdentityVerificationMethod label: string description: string icon: string }[] = [ { value: 'id_document', label: 'Ausweisdokument', description: 'Kopie von Personalausweis oder Reisepass', icon: 'M10 6H5a2 2 0 00-2 2v9a2 2 0 002 2h14a2 2 0 002-2V8a2 2 0 00-2-2h-5m-4 0V5a2 2 0 114 0v1m-4 0a2 2 0 104 0m-5 8a2 2 0 100-4 2 2 0 000 4zm0 0c1.306 0 2.417.835 2.83 2M9 14a3.001 3.001 0 00-2.83 2M15 11h3m-3 4h2' }, { value: 'email', label: 'E-Mail-Bestaetigung', description: 'Bestaetigung ueber verifizierte E-Mail-Adresse', icon: 'M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z' }, { value: 'existing_account', label: 'Bestehendes Konto', description: 'Anmeldung ueber bestehendes Kundenkonto', icon: 'M5.121 17.804A13.937 13.937 0 0112 16c2.5 0 4.847.655 6.879 1.804M15 10a3 3 0 11-6 0 3 3 0 016 0zm6 2a9 9 0 11-18 0 9 9 0 0118 0z' }, { value: 'phone', label: 'Telefonische Bestaetigung', description: 'Verifizierung per Telefonanruf', icon: 'M3 5a2 2 0 012-2h3.28a1 1 0 01.948.684l1.498 4.493a1 1 0 01-.502 1.21l-2.257 1.13a11.042 11.042 0 005.516 5.516l1.13-2.257a1 1 0 011.21-.502l4.493 1.498a1 1 0 01.684.949V19a2 2 0 01-2 2h-1C9.716 21 3 14.284 3 6V5z' }, { value: 'postal', label: 'Postalische Bestaetigung', description: 'Bestaetigung per Brief', icon: 'M3 19v-8.93a2 2 0 01.89-1.664l7-4.666a2 2 0 012.22 0l7 4.666A2 2 0 0121 10.07V19M3 19a2 2 0 002 2h14a2 2 0 002-2M3 19l6.75-4.5M21 19l-6.75-4.5M3 10l6.75 4.5M21 10l-6.75 4.5m0 0l-1.14.76a2 2 0 01-2.22 0l-1.14-.76' }, { value: 'other', label: 'Sonstige Methode', description: 'Andere Verifizierungsmethode', icon: 'M8.228 9c.549-1.165 2.03-2 3.772-2 2.21 0 4 1.343 4 3 0 1.4-1.278 2.575-3.006 2.907-.542.104-.994.54-.994 1.093m0 3h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z' } ] export function DSRIdentityModal({ isOpen, onClose, onVerify, requesterName, requesterEmail }: DSRIdentityModalProps) { const [selectedMethod, setSelectedMethod] = useState(null) const [notes, setNotes] = useState('') const [documentRef, setDocumentRef] = useState('') const [isLoading, setIsLoading] = useState(false) const [error, setError] = useState(null) if (!isOpen) return null const handleVerify = async () => { if (!selectedMethod) { setError('Bitte waehlen Sie eine Verifizierungsmethode') return } setIsLoading(true) setError(null) try { await onVerify({ method: selectedMethod, notes: notes || undefined, documentRef: documentRef || undefined }) onClose() } catch (err) { setError(err instanceof Error ? err.message : 'Verifizierung fehlgeschlagen') } finally { setIsLoading(false) } } const handleClose = () => { setSelectedMethod(null) setNotes('') setDocumentRef('') setError(null) onClose() } return (
{/* Backdrop */}
{/* Modal */}
{/* Header */}

Identitaet verifizieren

{/* Content */}
{/* Requester Info */}
Antragsteller
{requesterName}
{requesterEmail}
{/* Error */} {error && (
{error}
)} {/* Verification Methods */}
{VERIFICATION_METHODS.map(method => ( ))}
{/* Document Reference */} {selectedMethod === 'id_document' && (
setDocumentRef(e.target.value)} placeholder="z.B. Datei-ID oder Speicherort" className="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-purple-500 focus:border-purple-500" />
)} {/* Notes */}