aiellie

Search

Find a component, template or page

GitHub
Components

Human Handoff

Hands a chat to a person: an editable summary of what they'll see, a place in the queue that counts down, then who joined, or a way to be reached when no one is in.

Talk to a person

Refunds need someone from billing

What they'll see

Charged twice for the March invoice. The assistant confirmed both charges and couldn't refund the second one itself.

Invoice
INV-20418
Tried
Refund through billing, which needs a person
Open full screen
fig. 01 · open it full screen from the corner

Installation

npx shadcn@latest add "@aiellie/human-handoff"

shadcn needs the @aiellie registry in components.json first. npx aiellie add human-handoff adds it on its first run, then installs the same way.

Human Handoff hands a chat from the assistant to a person. It offers one, with a summary of what they'll see first that the user can edit, and the facts that come along. Once they connect, it shows their place in line as dots and counts the wait down.

Then it says who joined, with their avatar and a live dot, and that the assistant steps back. If no one's in, it says when they will be and takes an email to reach the user at. When the person leaves, the assistant picks up again.

Getting started

  1. Offer a person

    Pass the state your support queue reports. onConnect gets the summary as the user left it.

    components/handoff.tsx
    import { HumanHandoff } from "@/components/aiellie/human-handoff"
    
    export function Handoff({ queue }: { queue: Queue }) {
      return (
        <HumanHandoff
          state={queue.state}
          reason="Refunds need someone from billing"
          summary={queue.summary}
          queuePosition={queue.position}
          waitSeconds={queue.estimate}
          agent={queue.agent}
          onConnect={(summary) => queue.join(summary)}
          onCancel={queue.leave}
          onEnd={queue.end}
        />
      )
    }

Anatomy

<div data-slot="human-handoff" data-state="connecting" role="group">
  <div data-slot="human-handoff-header" />
  {/* offered: the summary and details, Keep chatting and Connect */}
  {/* connecting: the queue, what was sent, Leave queue */}
  {/* connected: who joined, End chat */}
  {/* unavailable: when they're back, an email field */}
</div>

The wait counts down once a second from the last estimate you pass. Only the place in line and whole minutes are read out, not every second.

When someone ahead leaves, their dot shrinks away. queueLabel is exported too: 1 is "Next in line", 3 is "3rd in line".

Examples

No one's in

With onLeaveContact, the unavailable state takes an email and confirms it.

No one is available right now

No one's available right now

Support is in from 9:00 to 17:00, Monday to Friday

API reference

HumanHandoff

PropTypeDefaultDescription
state"offered" | "connecting" | "connected" | "unavailable" | "ended"required
reasonstringWhy a person is offered.
summarystring""What the person sees first.
details{ label: string; value: string }[][]Facts that come along.
queuePositionnumber11 is next in line.
waitSecondsnumberThe estimate it counts down.
agent{ name: string; role?: string; image?: string }Who joined.
hoursstringWhen support is back.
onConnect(summary: string) => void
onDismiss() => voidAdds Keep chatting.
onCancel() => voidAdds Leave queue.
onLeaveContact(contact: string) => void
onEnd() => voidAdds End chat.

All other div props are forwarded.