import React, { useState } from 'react'; import { Layers, X, Code, KeyRound } from 'lucide-react'; export default function SelectionModal({ selectionPrompt, onSelect, onConfirm, onCancel }) { const [inputValues, setInputValues] = useState({}); const type = selectionPrompt.type || 'selection'; const missingKeys = selectionPrompt.missingKeys || []; const allFilled = missingKeys.every(k => inputValues[k]?.trim()); return (
{/* Header */}
{type === 'manual_input' ? : } {type === 'manual_input' ? 'Provide Missing IDs' : 'Choose an Option'}
{/* ── Manual input mode ── */} {type === 'manual_input' && ( <>

This step requires real IDs that could not be determined automatically. Enter the correct values from your system or database.

{missingKeys.map(key => (
setInputValues(prev => ({ ...prev, [key]: e.target.value }))} style={{ width: '100%', boxSizing: 'border-box' }} />
))}
)} {/* ── Selection mode (existing behaviour) ── */} {type === 'selection' && ( <>

Select one to save as {selectionPrompt.fieldName}.

{(selectionPrompt.options || []).map((opt, idx) => ( ))}
{selectionPrompt.responseBody && (
Raw response
                    {(() => { try { return JSON.stringify(JSON.parse(selectionPrompt.responseBody), null, 2); } catch { return selectionPrompt.responseBody; } })()}
                  
)} )}
); }