# Add the "Price Estimate" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/price-estimate) to this Pantheon Content Publisher (P1) Next.js project. Typical self-pay prices for common services in an accessible table, a disclaimer and an estimate request box.

## Steps

1. Create `components/puck/price-estimate-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 { priceEstimateBlock } from "./components/puck/price-estimate-block";`
3. Register it under `components` as `PriceEstimateBlock: priceEstimateBlock`.
4. Add `"PriceEstimateBlock"` to the best-fitting entry in `categories` (this block's library category is "Health"). 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/price-estimate-block.tsx`

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

/**
 * Price Estimate — a price list for common services (typical self-pay range and a note for
 * insured patients) in an accessible table, a price-transparency disclaimer and a button to
 * request a personal estimate.
 * Register: `PriceEstimateBlock: priceEstimateBlock` in puck.config.tsx.
 */

type Heading = "h1" | "h2" | "h3" | "h4";

export type PriceEstimateProps = {
  heading: string;
  headingLevel: Heading;
  intro: string;
  serviceLabel: string;
  priceLabel: string;
  insuranceLabel: string;
  services: { service: string; detail: string; price: string; insurance: string }[];
  updated: string;
  disclaimer: string;
  rightsText: string;
  ctaHeading: string;
  ctaText: string;
  ctaLabel: string;
  ctaHref: string;
  phone: string;
};

const childLevel = { h1: "h2", h2: "h3", h3: "h4", h4: "h5" } as const;
const focusRing = "focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600";

export const priceEstimateBlock: ComponentConfig<PriceEstimateProps> = {
  label: "Price Estimate",
  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. The estimate box uses the next level down." },
    },
    intro: { type: "textarea", label: "Intro" },
    serviceLabel: { type: "text", label: "Service column label" },
    priceLabel: { type: "text", label: "Price column label" },
    insuranceLabel: { type: "text", label: "Insurance column label" },
    services: {
      type: "array",
      label: "Services",
      min: 1,
      max: 30,
      getItemSummary: (item) => (item?.service ? `${item.service}${item.price ? ` · ${item.price}` : ""}` : "Service"),
      defaultItemProps: { service: "New service", detail: "", price: "", insurance: "" },
      arrayFields: {
        service: { type: "text", label: "Service" },
        detail: { type: "text", label: "Detail", metadata: { help: "Optional small print under the name, like what's included or a billing code." } },
        price: { type: "text", label: "Typical self-pay price", metadata: { help: "A range, like $95 – $140." } },
        insurance: { type: "text", label: "With insurance", metadata: { help: "Like Usually your copay, or Often covered in full." } },
      },
    },
    updated: { type: "text", label: "Prices updated", metadata: { help: "Like January 2026. Shown under the table." } },
    disclaimer: { type: "textarea", label: "Disclaimer", metadata: { help: "Explain that these are estimates and what can change the price." } },
    rightsText: { type: "textarea", label: "Your rights note", metadata: { help: "Optional, like a note about the Good Faith Estimate. Leave blank to hide." } },
    ctaHeading: { type: "text", label: "Estimate box heading", metadata: { help: "Leave blank, with no button, to hide the box." } },
    ctaText: { type: "textarea", label: "Estimate box text" },
    ctaLabel: { type: "text", label: "Button text" },
    ctaHref: { type: "text", label: "Button link" },
    phone: { type: "text", label: "Phone", metadata: { help: "Optional. Shown under the button." } },
  },
  defaultProps: {
    heading: "What common services cost",
    headingLevel: "h2",
    intro: "We want you to know what to expect before your visit. These are typical prices if you pay for care yourself. The sliding fee scale can lower them.",
    serviceLabel: "Service",
    priceLabel: "Typical self-pay price",
    insuranceLabel: "With insurance",
    services: [
      { service: "New patient office visit", detail: "First visit with a primary care provider", price: "$150 – $220", insurance: "Usually your copay" },
      { service: "Return office visit", detail: "Follow-up or sick visit", price: "$95 – $160", insurance: "Usually your copay" },
      { service: "Yearly checkup", detail: "Preventive visit for adults", price: "$180 – $250", insurance: "Often covered in full" },
      { service: "Video visit", detail: "", price: "$75 – $120", insurance: "Usually your copay" },
      { service: "Basic blood work", detail: "Blood count and metabolic panel", price: "$35 – $60", insurance: "May count toward your deductible" },
      { service: "Dental cleaning and exam", detail: "Adults", price: "$110 – $170", insurance: "Often covered by dental plans" },
      { service: "Flu shot", detail: "", price: "$0", insurance: "No cost" },
    ],
    updated: "January 2026",
    disclaimer: "Sample prices for illustration. These are estimates, not a quote. Your final cost depends on the care you need during the visit, your insurance plan and whether you qualify for the sliding fee scale.",
    rightsText: "If you don't have insurance or won't use it, you have the right to a Good Faith Estimate of your costs before your visit. Learn more at cms.gov/nosurprises.",
    ctaHeading: "Get a personal estimate",
    ctaText: "Tell us the service you need and we'll send a written estimate within two business days.",
    ctaLabel: "Request an estimate",
    ctaHref: "/billing/estimate",
    phone: "(555) 010-2100",
  },
  render: ({ id, heading, headingLevel, intro, serviceLabel, priceLabel, insuranceLabel, services, updated, disclaimer, rightsText, ctaHeading, ctaText, ctaLabel, ctaHref, phone }) => {
    const H = headingLevel || "h2";
    const Sub = childLevel[H] ?? "h3";
    const rows = (services ?? []).filter((s) => s?.service);
    const captionId = `pe-${id || "block"}-caption`;
    const tel = (phone || "").replace(/[^\d+]/g, "");
    const hasCta = Boolean(ctaHeading || ctaLabel);

    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-7xl">
          {heading || intro ? (
            <div className="max-w-2xl">
              {heading ? <H className="text-3xl font-semibold tracking-tight text-balance text-neutral-950 sm:text-4xl">{heading}</H> : null}
              {intro ? <p className="mt-4 text-lg leading-8 text-pretty text-neutral-600">{intro}</p> : null}
            </div>
          ) : null}

          <div className={`grid grid-cols-1 gap-8 lg:gap-12 ${hasCta ? "lg:grid-cols-12" : ""} ${heading || intro ? "mt-10 sm:mt-12" : ""}`}>
            <div className={hasCta ? "min-w-0 lg:col-span-8" : "min-w-0"}>
              {rows.length ? (
                <div role="region" aria-labelledby={captionId} tabIndex={0} className={`relative overflow-x-auto rounded-2xl ring-1 ring-neutral-200 ${focusRing}`}>
                  <table className="w-full min-w-xl text-left text-sm">
                    <caption id={captionId} className="sr-only">
                      {heading || "Prices"}: {priceLabel || "self-pay price"} and {(insuranceLabel || "with insurance").toLowerCase()} for {rows.length} services
                    </caption>
                    <thead className="bg-neutral-50">
                      <tr>
                        <th scope="col" className="px-4 py-3.5 font-semibold text-neutral-950 sm:px-6">{serviceLabel || "Service"}</th>
                        <th scope="col" className="px-4 py-3.5 text-right font-semibold whitespace-nowrap text-neutral-950 sm:px-6">{priceLabel || "Self-pay price"}</th>
                        <th scope="col" className="px-4 py-3.5 font-semibold text-neutral-950 sm:px-6">{insuranceLabel || "With insurance"}</th>
                      </tr>
                    </thead>
                    <tbody className="divide-y divide-neutral-200 bg-white">
                      {rows.map((r, i) => (
                        <tr key={`${r.service}-${i}`} className="align-top">
                          <th scope="row" className="px-4 py-4 font-normal sm:px-6">
                            <span className="block font-semibold text-neutral-950">{r.service}</span>
                            {r.detail ? <span className="mt-0.5 block text-neutral-600">{r.detail}</span> : null}
                          </th>
                          <td className="px-4 py-4 text-right font-semibold whitespace-nowrap text-neutral-950 tabular-nums sm:px-6">{r.price || "—"}</td>
                          <td className="px-4 py-4 text-neutral-700 sm:px-6">{r.insurance || "—"}</td>
                        </tr>
                      ))}
                    </tbody>
                  </table>
                </div>
              ) : null}
              {updated ? <p className="mt-3 text-xs text-neutral-600">Prices updated {updated}.</p> : null}
              {disclaimer || rightsText ? (
                <div className="mt-6 space-y-3 text-sm leading-6 text-pretty text-neutral-600">
                  {disclaimer ? <p>{disclaimer}</p> : null}
                  {rightsText ? (
                    <p className="flex gap-2.5 rounded-xl bg-neutral-50 p-4 text-neutral-700 ring-1 ring-neutral-950/5 ring-inset">
                      <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="mt-0.5 size-5 shrink-0 text-indigo-600">
                        <path fillRule="evenodd" d="M9.661 2.237a.531.531 0 0 1 .678 0 11.947 11.947 0 0 0 7.078 2.749.5.5 0 0 1 .479.425c.069.52.104 1.05.104 1.59 0 5.162-3.26 9.563-7.834 11.256a.48.48 0 0 1-.332 0C5.26 16.564 2 12.163 2 7c0-.538.035-1.069.104-1.589a.5.5 0 0 1 .48-.425 11.947 11.947 0 0 0 7.077-2.75Zm4.196 5.954a.75.75 0 0 0-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 1 0-1.06 1.061l2.5 2.5a.75.75 0 0 0 1.137-.089l4-5.5Z" clipRule="evenodd" />
                      </svg>
                      <span className="min-w-0">{rightsText}</span>
                    </p>
                  ) : null}
                </div>
              ) : null}
            </div>

            {hasCta ? (
              <aside aria-label={ctaHeading || "Request an estimate"} className="self-start rounded-2xl bg-indigo-600 p-6 text-white sm:p-8 lg:sticky lg:top-8 lg:col-span-4">
                <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-8 text-indigo-200">
                  <path fillRule="evenodd" d="M4.5 2A1.5 1.5 0 0 0 3 3.5v13A1.5 1.5 0 0 0 4.5 18h11a1.5 1.5 0 0 0 1.5-1.5V7.621a1.5 1.5 0 0 0-.44-1.06l-4.12-4.122A1.5 1.5 0 0 0 11.378 2H4.5Zm2.25 8.5a.75.75 0 0 0 0 1.5h6.5a.75.75 0 0 0 0-1.5h-6.5Zm0 3a.75.75 0 0 0 0 1.5h6.5a.75.75 0 0 0 0-1.5h-6.5Z" clipRule="evenodd" />
                </svg>
                {ctaHeading ? <Sub className="mt-4 text-xl font-semibold tracking-tight text-balance text-white">{ctaHeading}</Sub> : null}
                {ctaText ? <p className="mt-2 text-base leading-7 text-pretty text-indigo-100">{ctaText}</p> : null}
                {ctaLabel ? (
                  <a
                    href={ctaHref || "#"}
                    className="mt-6 inline-flex min-h-11 w-full items-center justify-center rounded-lg bg-white px-5 py-2.5 text-base font-semibold text-indigo-700 shadow-xs transition hover:bg-indigo-50 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-white"
                  >
                    {ctaLabel}
                  </a>
                ) : null}
                {tel ? (
                  <p className="mt-4 text-center text-sm text-indigo-100">
                    Or call{" "}
                    <a href={`tel:${tel}`} className="-my-3 inline-flex min-h-11 items-center rounded font-semibold text-white tabular-nums underline decoration-indigo-300 underline-offset-4 hover:decoration-white focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-white">
                      {phone}
                    </a>
                  </p>
                ) : null}
              </aside>
            ) : null}
          </div>
        </div>
      </section>
    );
  },
};
```
