# Add the "Help CTA" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/help-cta) to this Pantheon Content Publisher (P1) Next.js project. Still-need-help panel listing ways to reach a person by phone, email, chat or visit, with hours and response times.

## Steps

1. Create `components/puck/help-cta-block.tsx` with the exact file contents below. If `components/puck/` doesn't exist, find the folder where this project keeps its Puck components (look at the imports in `puck.config.tsx`) and put it there.
2. In `puck.config.tsx`, import it: `import { helpCtaBlock } from "./components/puck/help-cta-block";`
3. Register it under `components` as `HelpCtaBlock: helpCtaBlock`.
4. Add `"HelpCtaBlock"` to the best-fitting entry in `categories` (this block's library category is "Conversion"). Create a category only if none fits.
5. Run the project's type check (usually `pnpm typecheck`) and resolve anything project-specific.
6. If `package.json` has a `sync:registry` script, tell the user it must run (or that CI will run it) before the new component appears in the P1 editor.

## Rules

- Do not add dependencies. The block is self-contained by design: one type-only import from `@puckeditor/core`, Tailwind v4 classes, no client JavaScript.
- Keep the files as-is unless the user asks for changes. The accent color is `indigo-*`; if the project has brand colors, offer to swap them with a find-and-replace on `indigo-`.
- Images are plain `imageUrl` + `imageAlt` text fields. If this project defines a P1 media-library field (search for `"p1-media"`), offer to switch to it.
- Don't change prop names in `defaultProps`. Content editors' saved pages depend on them.

## File: `components/puck/help-cta-block.tsx`

```tsx
import type { ComponentConfig } from "@puckeditor/core";

/**
 * Help CTA — a "Still need help?" panel for the end of FAQ, service and support pages: up to
 * four ways to reach a person (call, email, chat, visit), each with hours or response time.
 * Register: `HelpCtaBlock: helpCtaBlock` in puck.config.tsx.
 */

type Heading = "h1" | "h2" | "h3" | "h4";
type Channel = "phone" | "email" | "chat" | "visit";

type Option = { channel: Channel; label: string; value: string; href: string; detail: string };

export type HelpCtaProps = {
  heading: string;
  headingLevel: Heading;
  body: string;
  options: Option[];
  footnote: string;
};

const childHeading: Record<Heading, "h2" | "h3" | "h4" | "h5"> = { h1: "h2", h2: "h3", h3: "h4", h4: "h5" };

const icons: Record<Channel, string> = {
  phone:
    "M2.25 6.75c0 8.284 6.716 15 15 15h2.25a2.25 2.25 0 0 0 2.25-2.25v-1.372c0-.516-.351-.966-.852-1.091l-4.423-1.106c-.44-.11-.902.055-1.173.417l-.97 1.293c-.282.376-.769.542-1.21.38a12.035 12.035 0 0 1-7.143-7.143c-.162-.441.004-.928.38-1.21l1.293-.97c.363-.271.527-.734.417-1.173L6.963 3.102a1.125 1.125 0 0 0-1.091-.852H4.5A2.25 2.25 0 0 0 2.25 4.5v2.25Z",
  email:
    "M21.75 6.75v10.5a2.25 2.25 0 0 1-2.25 2.25h-15a2.25 2.25 0 0 1-2.25-2.25V6.75m19.5 0A2.25 2.25 0 0 0 19.5 4.5h-15a2.25 2.25 0 0 0-2.25 2.25m19.5 0v.243a2.25 2.25 0 0 1-1.07 1.916l-7.5 4.615a2.25 2.25 0 0 1-2.36 0L3.32 8.91a2.25 2.25 0 0 1-1.07-1.916V6.75",
  chat: "M8.625 12a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Zm0 0H8.25m4.125 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Zm0 0H12m4.125 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Zm0 0h-.375M21 12c0 4.556-4.03 8.25-9 8.25a9.764 9.764 0 0 1-2.555-.337A5.972 5.972 0 0 1 5.41 20.97a5.969 5.969 0 0 1-.474-.065 4.48 4.48 0 0 0 .978-2.025c.09-.457-.133-.901-.467-1.226C3.93 16.178 3 14.189 3 12c0-4.556 4.03-8.25 9-8.25s9 3.694 9 8.25Z",
  visit: "M15 10.5a3 3 0 1 1-6 0 3 3 0 0 1 6 0ZM19.5 10.5c0 7.142-7.5 11.25-7.5 11.25S4.5 17.642 4.5 10.5a7.5 7.5 0 1 1 15 0Z",
};

const hrefFor = (o: Option) => {
  if (o.href) return o.href;
  if (o.channel === "phone" && o.value) return `tel:${o.value.replace(/[^\d+]/g, "")}`;
  if (o.channel === "email" && o.value) return `mailto:${o.value.trim()}`;
  return "";
};

export const helpCtaBlock: ComponentConfig<HelpCtaProps> = {
  label: "Help CTA",
  fields: {
    heading: { type: "text", label: "Heading" },
    headingLevel: {
      type: "select",
      label: "Heading level",
      options: [
        { label: "H1", value: "h1" },
        { label: "H2", value: "h2" },
        { label: "H3", value: "h3" },
        { label: "H4", value: "h4" },
      ],
      metadata: { help: "Sets the page outline for screen readers and search. The look doesn't change." },
    },
    body: { type: "textarea", label: "Body" },
    options: {
      type: "array",
      label: "Contact options",
      min: 1,
      max: 4,
      getItemSummary: (item) => item?.label || "Option",
      defaultItemProps: { channel: "phone", label: "Call us", value: "(502) 555-0100", href: "", detail: "Mon–Fri, 9 a.m. – 5 p.m." },
      arrayFields: {
        channel: {
          type: "select",
          label: "Type",
          options: [
            { label: "Phone", value: "phone" },
            { label: "Email", value: "email" },
            { label: "Chat", value: "chat" },
            { label: "Visit", value: "visit" },
          ],
          metadata: { help: "Sets the icon, and builds the tap-to-call or email link for you." },
        },
        label: { type: "text", label: "Label", metadata: { help: "Such as Call us or Live chat." } },
        value: { type: "text", label: "Contact", metadata: { help: "The number, address or link text people see, such as (502) 555-0100." } },
        href: { type: "text", label: "Link", metadata: { help: "Leave blank for phone and email; it's built from the contact. Needed for chat and visit, such as /chat or a map link." } },
        detail: { type: "text", label: "Hours or response time", metadata: { help: "Such as \"Replies within one business day\". Leave blank to hide it." } },
      },
    },
    footnote: { type: "text", label: "Footnote", metadata: { help: "Small print under the panel, such as an emergency line. Leave blank to hide it." } },
  },
  defaultProps: {
    heading: "Still need help?",
    headingLevel: "h2",
    body: "Our benefits navigators can walk you through an application, check what you qualify for, or help you appeal a decision. It's free and confidential.",
    options: [
      { channel: "phone", label: "Call a navigator", value: "(502) 555-0172", href: "", detail: "Mon–Fri, 8 a.m. – 6 p.m. · Spanish and Arabic available" },
      { channel: "email", label: "Email us", value: "help@neighborlink.org", href: "", detail: "Replies within one business day" },
      { channel: "visit", label: "Walk in", value: "Southside Library, Room 2", href: "https://maps.google.com/?q=Southside+Library", detail: "Tuesdays and Thursdays, 10 a.m. – 2 p.m." },
    ],
    footnote: "In a crisis? Call or text 988 any time, day or night.",
  },
  render: ({ heading, headingLevel, body, options, footnote }) => {
    const H = headingLevel || "h2";
    const Sub = childHeading[H] || "h3";
    const list = (options ?? []).filter((o) => o?.label || o?.value);
    if (!heading && !body && !list.length) return <></>;

    return (
      <section className="bg-white px-4 py-16 sm:px-6 sm:py-20 lg:px-8 lg:py-24">
        <div className="mx-auto max-w-6xl">
          <div className="grid grid-cols-1 overflow-hidden rounded-3xl bg-neutral-50 ring-1 ring-neutral-200 lg:grid-cols-5">
            {heading || body ? (
              <div className="relative isolate overflow-hidden bg-neutral-950 px-6 py-10 sm:px-10 sm:py-12 lg:col-span-2">
                <svg aria-hidden="true" viewBox="0 0 200 200" fill="none" stroke="currentColor" strokeWidth="1" className="absolute -right-16 -bottom-16 -z-10 size-64 text-indigo-400/20">
                  <circle cx="100" cy="100" r="30" />
                  <circle cx="100" cy="100" r="55" />
                  <circle cx="100" cy="100" r="80" />
                  <circle cx="100" cy="100" r="99" />
                </svg>
                <span aria-hidden="true" className="flex size-11 items-center justify-center rounded-full bg-indigo-500/20 ring-1 ring-indigo-400/30">
                  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" className="size-6 text-indigo-200">
                    <path strokeLinecap="round" strokeLinejoin="round" d="M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9 5.25h.008v.008H12v-.008Z" />
                  </svg>
                </span>
                {heading ? <H className="mt-6 text-3xl font-semibold tracking-tight text-balance text-white sm:text-4xl">{heading}</H> : null}
                {body ? <p className="mt-4 text-base leading-7 text-pretty text-neutral-300">{body}</p> : null}
              </div>
            ) : null}

            {list.length ? (
              <ul role="list" className={`divide-y divide-neutral-200 px-6 py-4 sm:px-10 sm:py-6 ${heading || body ? "lg:col-span-3" : "lg:col-span-5"}`}>
                {list.map((o, i) => {
                  const href = hrefFor(o);
                  const external = /^https?:/.test(href);
                  const d = icons[o.channel] ?? icons.phone;
                  return (
                    <li key={`${o.label}-${i}`} className="flex gap-4 py-5 sm:gap-5">
                      <span aria-hidden="true" className="mt-1 flex size-10 shrink-0 items-center justify-center rounded-full bg-white ring-1 ring-neutral-200">
                        <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" className="size-5 text-indigo-600">
                          <path strokeLinecap="round" strokeLinejoin="round" d={d} />
                        </svg>
                      </span>
                      <div className="min-w-0 flex-1">
                        {o.label ? <Sub className="text-sm leading-6 font-semibold text-neutral-600">{o.label}</Sub> : null}
                        {o.value ? (
                          href ? (
                            <a
                              href={href}
                              {...(external ? { target: "_blank", rel: "noopener noreferrer" } : {})}
                              className="-mx-1 inline-flex min-h-11 items-center gap-1.5 rounded px-1 text-lg font-semibold break-all text-neutral-950 underline decoration-neutral-300 underline-offset-4 transition hover:text-indigo-700 hover:decoration-indigo-400 focus-visible:outline-2 focus-visible:outline-indigo-600 sm:text-xl"
                            >
                              {o.value}
                              {external ? <span className="sr-only"> (opens in a new tab)</span> : null}
                            </a>
                          ) : (
                            <p className="py-2 text-lg font-semibold text-neutral-950 sm:text-xl">{o.value}</p>
                          )
                        ) : null}
                        {o.detail ? <p className="text-sm leading-6 text-pretty text-neutral-600">{o.detail}</p> : null}
                      </div>
                    </li>
                  );
                })}
              </ul>
            ) : null}
          </div>
          {footnote ? <p className="mt-6 text-center text-sm leading-6 text-pretty text-neutral-600">{footnote}</p> : null}
        </div>
      </section>
    );
  },
};
```
