/* Mandera Portal — Welcome + dynamic Onboarding (renders from MData.schema()). */ function Chip({ active, onClick, children }) { return ( ); } function Field({ label, hint, children }) { return (
{children} {hint && {hint}}
); } function Welcome({ go }) { const acc = window.MAuth.current(); const client = acc && acc.clientId ? window.MData.client(acc.clientId) : null; const brand = (client && client.brand) || 'there'; const first = brand.split(' ')[0]; return (
Welcome aboard · {brand}

Welcome,
{first}.

We’re thrilled to be working together. Before your dashboard opens, tell us a little about your brand so we can hit the ground running.

{[['clipboard-list', 'Complete onboarding'], ['calendar-check', 'See your schedule'], ['sparkles', 'Watch the work roll in']].map(([ic, t]) => (
{t}
))}
{(() => { const { Button } = window.ManderaDesignSystem_8327ce; return ( ); })()}

This takes about 3 minutes. You can’t reach your dashboard until it’s done.

); } function Onboarding({ go }) { const { Button, Input, Checkbox } = window.ManderaDesignSystem_8327ce; const acc = window.MAuth.current(); const clientId = acc && acc.clientId; const schema = window.MData.schema(); const existing = clientId ? window.MData.onboardingOf(clientId) : { data: {} }; const [step, setStep] = React.useState(0); const [done, setDone] = React.useState(false); const [f, setF] = React.useState(() => ({ ...existing.data })); const set = (k, v) => setF((p) => ({ ...p, [k]: v })); const toggle = (k, v, single) => setF((p) => { if (single) return { ...p, [k]: v }; const arr = Array.isArray(p[k]) ? p[k] : []; return { ...p, [k]: arr.includes(v) ? arr.filter((x) => x !== v) : [...arr, v] }; }); const total = schema.length + 1; // +review const isReview = step === schema.length; const pct = Math.round(((step + 1) / total) * 100); const [consent, setConsent] = React.useState(false); const submit = () => { if (clientId) window.MData.saveOnboarding(clientId, f, 'submitted'); if (clientId) { const cl = window.MData.client(clientId); window.MData.notify({ audience: 'team', type: 'onboarding', text: (cl ? cl.brand : 'A client') + ' submitted their onboarding brief', link: 'onboarding', refId: clientId }); } if (window.MAuth) window.MAuth.markOnboarded(); setDone(true); }; const wrap = (children) => (
{children}
); if (done) { return wrap(

You’re all set.

Thanks! Your brief is with the Mandera team. Your dashboard is now unlocked.

); } const renderField = (fld) => { if (fld.type === 'text') return set(fld.key, e.target.value)} placeholder={fld.hint || ''} />; if (fld.type === 'textarea') return (