// Kayser v2 — Teach Kayser an automation sheet + Level-up celebration. // ============ TEACH SHEET ============ // Three-step linear flow: trigger → action → confidence threshold. // Designed to feel like a Raycast snippet/hotkey: tight, technical, but legible. const KXV2_TRIGGER_SUGGESTIONS = [ { icon: '◷', label: 'Invoice goes 7+ days overdue', tag: 'invoice.overdue' }, { icon: '◷', label: 'New lead arrives via website', tag: 'lead.new' }, { icon: '◷', label: 'Quote unanswered for 3 days', tag: 'quote.cold' }, { icon: '◷', label: '70%+ rain forecast on a job day', tag: 'weather.rain' }, { icon: '◷', label: 'Customer texts after hours', tag: 'sms.afterhours' }, ]; const KXV2_ACTION_SUGGESTIONS = [ { icon: '↗', label: 'Send a reminder text', tag: 'send.sms' }, { icon: '↗', label: 'Reschedule the job', tag: 'job.reschedule' }, { icon: '↗', label: 'Reply with availability + book a call', tag: 'lead.respond' }, { icon: '↗', label: 'Notify me only', tag: 'notify' }, { icon: '↗', label: 'Draft for my approval', tag: 'draft' }, ]; function KxV2TeachSheet({ open, onClose }) { const [step, setStep] = React.useState(0); const [trig, setTrig] = React.useState(null); const [act, setAct] = React.useState(null); const [conf, setConf] = React.useState(70); React.useEffect(() => { if (open) { setStep(0); setTrig(null); setAct(null); setConf(70); } }, [open]); const stepDot = (i, active) => (
); return (
{/* Step indicator */}
{[0, 1, 2].map(i => stepDot(i, i === step))}
{/* STEP 0 — TRIGGER */} {step === 0 && (
WHEN
What should I watch for?
Pick a signal — or type your own.
{KXV2_TRIGGER_SUGGESTIONS.map(s => ( ))}
+
)} {/* STEP 1 — ACTION */} {step === 1 && (
THEN
What should I do?
Triggered by: {trig?.label || '—'}
{KXV2_ACTION_SUGGESTIONS.map(s => ( ))}
)} {/* STEP 2 — CONFIDENCE */} {step === 2 && (
HOW FAR
How much rope?
I'll start by drafting and asking. As you keep approving, I'll do it on my own.
{/* Live recipe preview */}
RECIPE
When {trig?.label.toLowerCase() || '…'}
then {act?.label.toLowerCase() || '…'}
{/* Confidence slider */}
Auto-handle threshold
{conf}%
setConf(+e.target.value)} style={{ width: '100%', accentColor: KX2.brand }} />
Always ask Just do it
At {conf}%: {conf < 30 && "I'll always ask before doing this. You stay in full control."} {conf >= 30 && conf < 70 && "I'll draft + ask the first 5 times. After 3 in a row of 'send as-is', I'll start handling it."} {conf >= 70 && conf < 95 && "I'll handle it on my own and tell you after. You can undo within 5 minutes."} {conf >= 95 && "I'll handle it silently. You'll see it in the daily summary."}
)} {/* Footer nav */}
{step > 0 && ( )} {step < 2 ? ( ) : ( )}
); } // ============ LEVEL-UP CELEBRATION ============ // One-time inline message in chat. Quiet but with a subtle animated ring. function KxV2LevelUp({ tier, onDismiss, onSeeMore }) { if (!tier) return null; return (
{/* Animated ring/shimmer */}
L{tier.lvl}
LEVELED UP
Kayser is now an {tier.name}
{tier.blurb}
); } Object.assign(window, { KxV2TeachSheet, KxV2LevelUp });