# Call insights

> Sales call analysis card with speaker talk-time bar, flagged moment quote clips, AI summary and next steps that update deal risk.

- Kind: block · Category: AI · Interactivity: script
- Install: `npx shadcn@latest add @haze/call-insights`
- File: `src/components/haze/blocks/call-insights.astro`
- npm dependencies: @lucide/astro
- Registry dependencies: @haze/utils
- Docs page: https://hazeui.com/blocks/call-insights

## Use when
- Reviewing recorded sales or customer calls with highlighted pricing, competitor and objection clips
- Tracking owned follow-up tasks that dynamically update a deal risk badge

## Avoid when
- Displaying a generic media player or full raw transcript without AI highlights

## Alternatives
- [ai-insight-card](https://hazeui.com/blocks/ai-insight-card.md)
- [bento-checklist](https://hazeui.com/ui/bento-checklist.md)

## Props

| Name | Type | Default | Required | Description |
|---|---|---|---|---|
| id | `string` | "haze-call-insights" | no | Unique prefix for section heading IDs. |
| callTitle | `string` | "Tidewell Enterprise · Discovery Call" | no | Recorded call title. |
| moments | `Moment[]` | 3 flagged clips | no | Timestamped pricing, competitor and objection clips. |
| nextSteps | `{ id: string; task: string; owner: string }[]` | 3 owned steps | no | Checkable action items linked to the deal risk badge. |
| class | `string` |  | no | Extra classes on the outer section. |

## Accessibility
- Flagged moment buttons expose aria-pressed and update the visible blockquote preview in place.
- Checking off next steps uses native checkboxes and announces completion counts via role="status".
- Key Tab: Move across flagged moment buttons and next-step checkboxes
- Key Enter / Space: Preview a flagged quote clip or check off a next step

## Agent prompts

### Install and use

Install the Haze UI block "Call insights" with `npx shadcn@latest add @haze/call-insights`. If components.json has no "@haze" registry yet, add "registries": { "@haze": "https://hazeui.com/r/{name}.json" }. If src/styles/haze.css does not exist yet, run `npx shadcn@latest add @haze/theme` once and import it from the global stylesheet after Tailwind. The CLI stops at an overwrite question when a Haze file already exists and differs, even with --yes, and then installs nothing after it: read its output. If the user has not edited their Haze files, re-run with --overwrite to take the registry versions; if they have, ask them before overwriting. Then import CallInsights from "@/components/haze/blocks/call-insights.astro" (or the relative path) and render it where it fits the page. Keep Haze token classes (bg-background, text-muted-foreground, border-border...) and never hardcode colors. Docs: https://hazeui.com/blocks/call-insights.md

### Customize with real content

Adapt the Haze call-insights block for our product. Replace the demo values of these props with our real content: id, callTitle, moments, nextSteps, class. Keep the layout, the heading level rules and these accessibility details: Flagged moment buttons expose aria-pressed and update the visible blockquote preview in place. Checking off next steps uses native checkboxes and announces completion counts via role="status". Do not add raw color classes; use the Haze tokens.

### Choose the right block

Before using call-insights, check it fits: use it when reviewing recorded sales or customer calls with highlighted pricing, competitor and objection clips; tracking owned follow-up tasks that dynamically update a deal risk badge. Avoid it when displaying a generic media player or full raw transcript without ai highlights. Alternatives: @haze/ai-insight-card, @haze/bento-checklist.

## Example requests that should lead here
- Add a sales call insights card with talk-time breakdown, flagged moment clips, AI summary and risk-lowering next steps

## Source

```astro
---
import { AlertTriangle, Check, CheckCircle2, PhoneCall, Play, Sparkles } from "@lucide/astro";
import { cn } from "../../../lib/haze/utils";

interface Moment {
  id: string;
  tag: "Pricing" | "Competitor" | "Objection";
  time: string;
  quote: string;
}

interface NextStep {
  id: string;
  task: string;
  owner: string;
}

interface Props {
  id?: string;
  callTitle?: string;
  moments?: Moment[];
  nextSteps?: NextStep[];
  class?: string;
}

const {
  id = "haze-call-insights",
  callTitle = "Tidewell Enterprise · Discovery Call",
  moments = [
    { id: "m1", tag: "Pricing", time: "14:22", quote: "\"Annual billing works if we can lock per-seat pricing for 24 months.\"" },
    { id: "m2", tag: "Competitor", time: "21:08", quote: "\"We evaluated two React-only kits, but our marketing site is moving to Astro.\"" },
    { id: "m3", tag: "Objection", time: "32:45", quote: "\"Security needs a SOC 2 bridge letter before procurement approves.\"" },
  ],
  nextSteps = [
    { id: "ns1", task: "Send SOC 2 bridge letter and DPA to InfoSec", owner: "Elena" },
    { id: "ns2", task: "Share 24-month annual seat quote (120 seats)", owner: "Marco" },
    { id: "ns3", task: "Schedule technical review with frontend lead", owner: "Elena" },
  ],
  class: className,
} = Astro.props;
const firstMoment = moments[0];
---

<section aria-labelledby={`${id}-title`} data-haze-call-insights class={cn("bg-background px-4 py-10 sm:px-6 sm:py-14", className)}>
  <div class="mx-auto max-w-4xl rounded-2xl border border-border bg-card p-5 sm:p-6">
    <header class="flex flex-wrap items-center justify-between gap-3 border-b border-border pb-4">
      <div class="flex items-center gap-2.5">
        <span class="grid size-8 place-items-center rounded-lg border border-frame bg-muted text-muted-foreground" aria-hidden="true">
          <PhoneCall class="size-4" />
        </span>
        <div>
          <h2 id={`${id}-title`} class="text-base/6 font-semibold tracking-tight text-foreground">{callTitle}</h2>
          <p class="text-xs/5 text-muted-foreground">42 min · 3 speakers · Recorded today</p>
        </div>
      </div>
      <span data-ci-risk class="inline-flex items-center gap-1.5 rounded-full border border-frame-warning bg-warning/10 px-2.5 py-0.5 text-xs font-medium text-warning">
        <AlertTriangle class="size-3.5" aria-hidden="true" />
        Deal risk: Medium
      </span>
    </header>

    <div class="mt-4 grid gap-5 lg:grid-cols-[minmax(0,1.1fr)_minmax(0,0.9fr)]">
      <div class="space-y-4">
        <div class="rounded-xl border border-border bg-muted/40 p-3.5">
          <div class="flex items-center justify-between text-xs text-muted-foreground">
            <span class="font-medium text-foreground">Talk-time ratio</span>
            <span class="font-mono tabular-nums">Rep 38% · Customer 62%</span>
          </div>
          <div class="mt-2 flex h-2 overflow-hidden rounded-full bg-muted">
            <div class="bg-foreground" style="width: 38%"></div>
            <div class="bg-muted-foreground" style="width: 62%"></div>
          </div>
        </div>

        <div>
          <h3 class="text-xs/4 font-medium tracking-wider text-muted-foreground uppercase">Flagged moments</h3>
          <div class="mt-2 flex flex-wrap gap-1.5">
            {
              moments.map((m, idx) => (
                <button
                  type="button"
                  data-ci-moment={m.id}
                  data-ci-quote={m.quote}
                  data-ci-time={m.time}
                  aria-pressed={idx === 0 ? "true" : "false"}
                  class="inline-flex h-8 cursor-pointer items-center gap-1.5 rounded-lg border border-frame bg-field px-2.5 text-xs font-medium text-muted-foreground transition-colors duration-150 hover:border-frame-strong hover:text-foreground aria-pressed:border-border-strong aria-pressed:bg-accent aria-pressed:text-foreground focus-visible:outline-2 focus-visible:outline-ring active:scale-[0.97] active:duration-75"
                >
                  <Play class="size-3" aria-hidden="true" />
                  <span>{m.tag}</span>
                  <span class="font-mono text-[0.6875rem] tabular-nums">{m.time}</span>
                </button>
              ))
            }
          </div>
          {firstMoment ? (
            <blockquote class="mt-2.5 rounded-xl border border-border bg-muted/40 p-3.5 text-sm/6 text-pretty text-foreground">
              <p data-ci-quote-box>{firstMoment.quote}</p>
              <footer class="mt-1 font-mono text-[0.6875rem] text-muted-foreground" data-ci-time-box>Clip at {firstMoment.time}</footer>
            </blockquote>
          ) : <p class="mt-2.5 text-sm/6 text-muted-foreground">No moments have been flagged.</p>}
        </div>

        <div class="rounded-xl border border-border bg-muted/40 p-3.5">
          <p class="inline-flex items-center gap-1.5 text-xs font-medium text-muted-foreground">
            <Sparkles class="size-3.5" aria-hidden="true" />
            AI call summary
          </p>
          <p class="mt-1.5 text-xs/5 text-pretty text-muted-foreground">
            Strong technical fit on Astro migration and dark UI tokens. Main blocker to close before Q4 is security review sign-off and 24-month seat lock confirmation.
          </p>
        </div>
      </div>

      <div class="flex flex-col justify-between rounded-xl border border-border bg-muted/40 p-4">
        <div>
          <h3 class="text-xs/4 font-medium tracking-wider text-muted-foreground uppercase">Owned next steps</h3>
          <ul role="list" class="mt-3 space-y-2">
            {
              nextSteps.map((step) => (
                <li>
                  <label class="flex cursor-pointer items-start gap-2.5 rounded-lg border border-border bg-card p-3 transition-colors duration-150 hover:border-border-strong">
                    <span class="relative inline-grid size-4 shrink-0 place-items-center mt-0.5"><input type="checkbox" data-ci-step class="peer col-start-1 row-start-1 shrink-0 focus-visible:outline-2 focus-visible:outline-ring size-4 shrink-0 cursor-pointer appearance-none rounded-sm border border-border-strong bg-field transition-[background-color,border-color,scale] duration-150 ease-snappy hover:border-foreground active:scale-90 checked:border-primary checked:bg-primary focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-ring forced-colors:appearance-auto" /><Check class="pointer-events-none col-start-1 row-start-1 size-3 scale-50 text-primary-foreground opacity-0 transition-[opacity,scale] duration-200 ease-spring peer-checked:scale-100 peer-checked:opacity-100 forced-colors:hidden" stroke-width={3} aria-hidden="true" /></span>
                    <span class="min-w-0 flex-1">
                      <span class="block text-xs/5 font-medium text-foreground">{step.task}</span>
                      <span class="block text-[0.6875rem]/4 text-muted-foreground">Owner: {step.owner}</span>
                    </span>
                  </label>
                </li>
              ))
            }
          </ul>
        </div>
        <p data-ci-status role="status" class="mt-3 min-h-4 text-xs/4 text-muted-foreground">Complete next steps to lower deal risk.</p>
      </div>
    </div>
  </div>
</section>

<script>
  function initCallInsights() {
    document.querySelectorAll<HTMLElement>("[data-haze-call-insights]").forEach((root) => {
      if (root.hasAttribute("data-enhanced")) return;
      root.setAttribute("data-enhanced", "");
      const quoteBox = root.querySelector<HTMLElement>("[data-ci-quote-box]");
      const timeBox = root.querySelector<HTMLElement>("[data-ci-time-box]");
      const risk = root.querySelector<HTMLElement>("[data-ci-risk]");
      const status = root.querySelector<HTMLElement>("[data-ci-status]");

      root.querySelectorAll<HTMLButtonElement>("[data-ci-moment]").forEach((btn) => {
        btn.addEventListener("click", () => {
          root.querySelectorAll<HTMLButtonElement>("[data-ci-moment]").forEach((b) => b.setAttribute("aria-pressed", String(b === btn)));
          if (quoteBox) quoteBox.textContent = btn.dataset.ciQuote ?? "";
          if (timeBox) timeBox.textContent = `Clip at ${btn.dataset.ciTime ?? ""}`;
        });
      });

      const steps = Array.from(root.querySelectorAll<HTMLInputElement>("[data-ci-step]"));
      const updateRisk = () => {
        const done = steps.filter((s) => s.checked).length;
        if (!risk) return;
        if (done === steps.length) {
          risk.textContent = "Deal risk: Low";
          risk.className = "inline-flex items-center gap-1.5 rounded-full border border-frame-success bg-success/10 px-2.5 py-0.5 text-xs font-medium text-success";
        } else if (done >= 1) {
          risk.textContent = "Deal risk: Guarded";
          risk.className = "inline-flex items-center gap-1.5 rounded-full border border-frame bg-muted px-2.5 py-0.5 text-xs font-medium text-foreground";
        } else {
          risk.textContent = "Deal risk: Medium";
          risk.className = "inline-flex items-center gap-1.5 rounded-full border border-frame-warning bg-warning/10 px-2.5 py-0.5 text-xs font-medium text-warning";
        }
        if (status) status.textContent = `${done} of ${steps.length} next steps completed.`;
      };
      steps.forEach((s) => s.addEventListener("change", updateRisk));
    });
  }
  initCallInsights();
  document.addEventListener("astro:page-load", initCallInsights);
</script>
```
