/* ============================================================
FLUJO COLABORADOR — Bienvenida · Datos · Evaluación
Exporta: ScreenWelcome, ScreenDatos, ScreenEval
============================================================ */
const { useState, useEffect, useRef } = React;
const IHF = window.IH;
/* ---------- Marca compacta ---------- */
function Brand({ small }) {
return (
Ingeniería Humana
El Sendero del Alto Rendimiento
);
}
/* ============================================================
1 · BIENVENIDA
============================================================ */
function ScreenWelcome({ onStart, onExec }) {
return (
Diagnóstico conductual organizacional
No es un test. Es una radiografía de cómo opera tu gente.
Todos llevamos dentro seis arquetipos. La evaluación no etiqueta personas: revela qué arquetipo gobierna hoy las decisiones, los comportamientos y el desempeño de cada colaborador.
60 afirmaciones · 6 arquetipos · un mapa conductual claro para la persona y para la organización.
Comenzar evaluación
≈ 8 minutos
PSICOLOGÍA APLICADA · NEUROCIENCIA · ALTO RENDIMIENTO
Grupo Nexa · Confidencial
);
}
/* El sendero de los 6 arquetipos */
function SenderoVisual() {
return (
El sendero · de la contracción a la maestría
{IHF.archetypes.map((a, i) => (
{a.name}
0{a.order}
{a.glyph}
{a.group === 'riesgo' ? 'Riesgo' : a.group === 'transicion' ? 'Transición' : 'Evolución'}
))}
);
}
/* ============================================================
2 · DATOS GENERALES
============================================================ */
function ScreenDatos({ profile, onChange, onNext, onBack }) {
const fields = [
{ k: 'nombre', label: 'Nombre completo', type: 'text', ph: 'Ej. Ana García' },
{ k: 'empresa', label: 'Empresa', type: 'text', ph: 'Ej. Grupo Nexa' },
{ k: 'area', label: 'Área', type: 'select', opts: IHF.areas },
{ k: 'puesto', label: 'Puesto', type: 'text', ph: 'Ej. Coordinador comercial' },
{ k: 'antiguedad', label: 'Antigüedad', type: 'select', opts: IHF.antiguedades },
{ k: 'sucursal', label: 'Sucursal', type: 'select', opts: IHF.sucursales },
];
const complete = profile.nombre && profile.empresa && profile.area;
return (
Antes de comenzar
Cuéntanos quién eres
Estos datos permiten agrupar tus resultados por área y organización. Tus respuestas son confidenciales.
{fields.map(f => (
{f.label}
{f.type === 'select' ? (
onChange(f.k, e.target.value)} className="ih-input">
Selecciona…
{f.opts.map(o => {o} )}
) : (
onChange(f.k, e.target.value)} className="ih-input" />
)}
))}
Iniciar evaluación →
);
}
/* ============================================================
3 · EVALUACIÓN (6 bloques × 10 afirmaciones)
============================================================ */
function ScreenEval({ answers, onAnswer, onFinish, onBack, blockIdx, setBlockIdx }) {
const ids = IHF.order;
const id = ids[blockIdx];
const arch = IHF.byId[id];
const qs = IHF.questions[id];
const blockAnswers = answers[id] || [];
const blockDone = blockAnswers.filter(Boolean).length;
const totalAnswered = ids.reduce((s, a) => s + (answers[a] || []).filter(Boolean).length, 0);
const pct = Math.round((totalAnswered / 60) * 100);
const blockComplete = blockDone === 10;
const isLast = blockIdx === 5;
const topRef = useRef(null);
useEffect(() => { if (topRef.current) topRef.current.scrollTop = 0; }, [blockIdx]);
return (
{/* barra superior con progreso */}
{totalAnswered} / 60 respondidas
Guardado
{/* cabecera de bloque (neutral, sin nombrar el arquetipo para no sesgar) */}
Bloque {String(blockIdx + 1).padStart(2, '0')} de 06
10 afirmaciones
Indica con qué frecuencia te identificas con cada afirmación. Responde con honestidad: no hay respuestas correctas.
{qs.map((q, i) => (
onAnswer(id, i, v)} />
))}
{/* footer navegación */}
blockIdx === 0 ? onBack() : setBlockIdx(blockIdx - 1)}>← {blockIdx === 0 ? 'Datos' : 'Bloque anterior'}
{ids.map((_, i) => {
const done = (answers[ids[i]] || []).filter(Boolean).length === 10;
return
setBlockIdx(i)} style={{ width: 26, height: 5, borderRadius: 5, cursor: 'pointer',
background: i === blockIdx ? 'var(--gold)' : done ? 'var(--ink-3)' : 'var(--hair-2)' }}>
;
})}
isLast ? onFinish() : setBlockIdx(blockIdx + 1)}>
{isLast ? 'Ver mi radiografía →' : 'Siguiente bloque →'}
);
}
function QuestionRow({ idx, text, value, onChange, color }) {
return (
{String(idx + 1).padStart(2, '0')}
{text}
{IHF.scaleLabels.map((lbl, v) => {
const active = value === v + 1;
return (
onChange(v + 1)} title={lbl}
style={{ width: 38, height: 38, borderRadius: 8, cursor: 'pointer', fontFamily: 'var(--mono)', fontSize: 13, fontWeight: 600,
border: '1px solid ' + (active ? color : 'var(--hair-2)'),
background: active ? color : 'var(--panel)', color: active ? '#fff' : 'var(--ink-3)',
transition: 'all .14s' }}>
{v + 1}
);
})}
);
}
/* ---------- Shell de pasos intermedios ---------- */
function FlowShell({ step, onBack, children }) {
return (
);
}
/* ============================================================
ScreenLogin — acceso al panel ejecutivo
============================================================ */
function ScreenLogin({ onSuccess, onBack }) {
const [email, setEmail] = useState('');
const [password, setPassword] = useState('');
const [busy, setBusy] = useState(false);
const [error, setError] = useState(null);
const handleSubmit = async (e) => {
e.preventDefault();
if (!email || !password) return;
setBusy(true);
setError(null);
try {
const user = await IHA.login(email, password);
onSuccess(user);
} catch (err) {
setError(err.message || 'Credenciales incorrectas');
} finally {
setBusy(false);
}
};
return (
Panel ejecutivo
Acceso restringido
Ingresa con tu cuenta de administrador para ver el panel ejecutivo.
);
}
Object.assign(window, { Brand, ScreenWelcome, ScreenDatos, ScreenEval, FlowShell, ScreenLogin });