{
  "component": {
    "id": "customer-portal-template",
    "name": "Customer portal template",
    "tier": "pro",
    "exampleId": "customer-portal-template",
    "access": "pro",
    "requiresAuthorization": true
  },
  "source": {
    "demoModule": "src/customer-portal-template-demo.tsx",
    "exportName": "CustomerPortalTemplateDemo",
    "sha256": "d400de04aa0ceae7c57c58d13583337ed9605749578dd116b9f4a554662636f6",
    "helperImports": [],
    "directComponentImports": [
      "customer-portal-template",
      "session-manager",
      "support-inbox"
    ],
    "sampleBoundary": "Existing local demo fixture with fictional data and callbacks. No live service, customer data, access key, or Pro source is included."
  },
  "install": {
    "command": "npx shadcn@latest add @tidal-pro/customer-portal-template",
    "registryUrl": "https://tidalui.com/r/pro/customer-portal-template.json",
    "namespace": "@tidal-pro",
    "access": "pro",
    "sourceDelivery": "server-gated",
    "requiresAuthorization": true,
    "tokenSource": "local-env",
    "tokenEnvName": "TIDALUI_TOKEN",
    "cli": {
      "package": "shadcn",
      "requested": "latest"
    }
  },
  "installPlan": [
    {
      "order": 1,
      "kind": "primary",
      "dependency": "@tidal-pro/customer-portal-template",
      "purpose": "component",
      "command": "npx shadcn@latest add @tidal-pro/customer-portal-template",
      "registryUrl": "https://tidalui.com/r/pro/customer-portal-template.json",
      "access": "pro",
      "sourceDelivery": "server-gated",
      "requiresAuthorization": true
    }
  ],
  "imports": {
    "componentPath": "components/ui/customer-portal-template.tsx",
    "exports": [
      "TidalCustomerPortalBillingConfig",
      "TidalCustomerPortalSupportConfig",
      "TidalCustomerPortalTemplate",
      "TidalSessionRecord",
      "TidalSupportTicket"
    ],
    "stylesheets": [
      "components/ui/tidal.css",
      "components/ui/customer-portal-template.css",
      "components/ui/session-manager.css",
      "components/ui/support-inbox.css",
      "components/ui/customer-profile.css",
      "components/ui/status-badge.css",
      "components/ui/billing-overview.css",
      "components/ui/usage-limits.css",
      "components/ui/meter.css"
    ],
    "scopeClass": "tidal-scope"
  },
  "dependencies": {
    "npm": [],
    "registry": [
      "@tidal-pro/customer-profile",
      "@tidal-pro/billing-overview",
      "@tidal-pro/usage-limits",
      "@tidal-pro/session-manager",
      "@tidal-pro/support-inbox"
    ],
    "additionalRegistry": [],
    "installClosure": [
      "billing-overview",
      "customer-portal-template",
      "customer-profile",
      "meter",
      "session-manager",
      "status-badge",
      "support-inbox",
      "tidal-button",
      "usage-limits"
    ],
    "css": [
      "components/ui/tidal.css",
      "components/ui/customer-portal-template.css",
      "components/ui/session-manager.css",
      "components/ui/support-inbox.css",
      "components/ui/customer-profile.css",
      "components/ui/status-badge.css",
      "components/ui/billing-overview.css",
      "components/ui/usage-limits.css",
      "components/ui/meter.css"
    ],
    "demoCss": [],
    "consumerOwned": [
      "react",
      "react-dom"
    ]
  },
  "files": {
    "sourceFile": "/examples/customer-portal-template.tsx",
    "demoStyles": [],
    "inlinedDemoStyles": [
      "src/customer-portal-template-demo.css"
    ],
    "assets": []
  },
  "example": {
    "language": "tsx",
    "source": "import \"./components/ui/tidal.css\";\n\nimport { useId, useMemo, useState, type MouseEvent } from \"react\";\n\nimport { TidalCustomerPortalTemplate, type TidalCustomerPortalBillingConfig, type TidalCustomerPortalSupportConfig } from \"./components/ui/customer-portal-template\";\n\nimport type { TidalSessionRecord } from \"./components/ui/session-manager\";\n\nimport type { TidalSupportTicket } from \"./components/ui/support-inbox\";\n\nimport \"./components/ui/session-manager.css\";\n\nimport \"./components/ui/support-inbox.css\";\n\nimport \"./components/ui/customer-portal-template.css\";\n\nimport \"./components/ui/customer-profile.css\";\n\nimport \"./components/ui/status-badge.css\";\n\nimport \"./components/ui/billing-overview.css\";\n\nimport \"./components/ui/usage-limits.css\";\n\nimport \"./components/ui/meter.css\";\n\nfunction tidalExampleAvatarDataUri(seed: unknown) {\n  const text = String(seed).replace(/[^a-z0-9]/gi, \"\").slice(-2) || \"UI\";\n  const palette = [\"#333333\", \"#555555\", \"#777777\", \"#999999\", \"#bbbbbb\"];\n  const color = palette[Array.from(text).reduce((sum, character) => sum + character.charCodeAt(0), 0) % palette.length];\n  const svg = `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 96 96\"><rect width=\"96\" height=\"96\" rx=\"48\" fill=\"${color}\"/><circle cx=\"48\" cy=\"38\" r=\"17\" fill=\"white\" fill-opacity=\".92\"/><path d=\"M18 92c3-22 15-34 30-34s27 12 30 34\" fill=\"white\" fill-opacity=\".92\"/></svg>`;\n  return `data:image/svg+xml,${encodeURIComponent(svg)}`;\n}\n\nfunction tidalExampleImageDataUri(label: string) {\n  const safeLabel = label.replace(/[<>&]/g, \"\").slice(0, 28) || \"Sample image\";\n  const svg = `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 1200 675\"><defs><linearGradient id=\"g\" x1=\"0\" x2=\"1\" y1=\"0\" y2=\"1\"><stop stop-color=\"#171717\"/><stop offset=\"1\" stop-color=\"#555555\"/></linearGradient></defs><rect width=\"1200\" height=\"675\" fill=\"url(#g)\"/><circle cx=\"950\" cy=\"100\" r=\"260\" fill=\"white\" fill-opacity=\".08\"/><text x=\"80\" y=\"570\" fill=\"white\" font-family=\"system-ui,sans-serif\" font-size=\"64\" font-weight=\"700\">${safeLabel}</text></svg>`;\n  return `data:image/svg+xml,${encodeURIComponent(svg)}`;\n}\n\nconst tidalExampleStyles = \".tidal-scope .tidal-customer-portal-demo,\\n.tidal-scope .tidal-customer-portal-demo * {\\n  box-sizing: border-box;\\n}\\n\\n.tidal-scope .tidal-customer-portal-demo {\\n  inline-size: 100%;\\n  min-inline-size: 0;\\n  display: grid;\\n  justify-items: center;\\n  gap: 16px;\\n}\\n\\n.tidal-scope .tidal-customer-portal-demo-action {\\n  min-block-size: 44px;\\n  padding: 8px 13px;\\n  border: 1px solid var(--t-border-strong);\\n  border-radius: 10px;\\n  background: var(--t-surface);\\n  color: var(--t-ink);\\n  font: inherit;\\n  font-size: 11px;\\n  font-weight: 700;\\n  cursor: pointer;\\n}\\n\\n.tidal-scope .tidal-customer-portal-demo-action:hover {\\n  background: var(--t-subtle);\\n}\\n\\n.tidal-scope .tidal-customer-portal-demo-note {\\n  inline-size: min(100%, 1180px);\\n  min-inline-size: 0;\\n  padding: 16px;\\n  border: 1px solid var(--t-border);\\n  border-radius: var(--t-radius-card);\\n  background: var(--t-surface);\\n  scroll-margin-block-start: 16px;\\n}\\n\\n.tidal-scope .tidal-customer-portal-demo-note h2,\\n.tidal-scope .tidal-customer-portal-demo-note p {\\n  margin: 0;\\n}\\n\\n.tidal-scope .tidal-customer-portal-demo-note h2 {\\n  font-size: 15px;\\n}\\n\\n.tidal-scope .tidal-customer-portal-demo-note p {\\n  margin-block-start: 6px;\\n  color: var(--t-muted);\\n  font-size: 11px;\\n  line-height: 1.55;\\n}\\n\\n@media (prefers-reduced-motion: reduce) {\\n  .tidal-scope .tidal-customer-portal-demo-action {\\n    transition: none;\\n  }\\n}\";\n\nconst initialSessions: readonly TidalSessionRecord[] = [\n  {\n    id: \"current\",\n    device: \"MacBook Pro · Safari\",\n    detail: \"Current browser\",\n    location: \"Austin, Texas\",\n    lastActive: \"Active now\",\n    current: true,\n  },\n  {\n    id: \"phone\",\n    device: \"iPhone · Mobile Safari\",\n    location: \"Austin, Texas\",\n    lastActive: \"18 minutes ago\",\n    dateTime: \"2026-10-15T14:42:00-05:00\",\n  },\n  {\n    id: \"studio\",\n    device: \"Studio PC · Chrome\",\n    location: \"Dallas, Texas\",\n    lastActive: \"3 days ago\",\n    dateTime: \"2026-10-12T09:20:00-05:00\",\n  },\n];\n\nconst initialTickets: readonly TidalSupportTicket[] = [\n  {\n    id: \"exports\",\n    customerName: \"Ava Morgan\",\n    subject: \"Export column order\",\n    preview: \"Can I save a preferred column order?\",\n    timestamp: \"Today\",\n    status: \"open\",\n    statusLabel: \"Open\",\n    unreadCount: 1,\n    avatarSrc: tidalExampleAvatarDataUri(\"04\"),\n    messages: [\n      {\n        id: \"exports-1\",\n        authorName: \"Ava Morgan\",\n        body: \"Can I save a preferred column order for future exports?\",\n        timestamp: \"9:24 AM\",\n        avatarSrc: tidalExampleAvatarDataUri(\"04\"),\n        side: \"customer\",\n      },\n      {\n        id: \"exports-2\",\n        authorName: \"Support sample\",\n        body: \"Saved export layouts are available from the export menu.\",\n        timestamp: \"9:31 AM\",\n        side: \"agent\",\n      },\n    ],\n  },\n  {\n    id: \"members\",\n    customerName: \"Ava Morgan\",\n    subject: \"Member access\",\n    preview: \"A teammate needs access to the reports folder.\",\n    timestamp: \"Oct 12\",\n    status: \"closed\",\n    statusLabel: \"Closed\",\n    messages: [\n      {\n        id: \"members-1\",\n        authorName: \"Ava Morgan\",\n        body: \"A teammate needs access to the reports folder.\",\n        timestamp: \"Oct 12\",\n        avatarSrc: tidalExampleAvatarDataUri(\"04\"),\n        side: \"customer\",\n      },\n    ],\n  },\n];\n\nfunction isPlainPrimary(event: MouseEvent<HTMLAnchorElement>) {\n  return (\n    event.button === 0 &&\n    !event.metaKey &&\n    !event.ctrlKey &&\n    !event.shiftKey &&\n    !event.altKey\n  );\n}\n\nexport function CustomerPortalTemplateDemo({\n  theme = \"light\",\n}: {\n  theme?: \"light\" | \"dark\";\n}) {\n  const generatedId = useId().replace(/:/g, \"\");\n  const helpId = `customer-portal-help-${generatedId}`;\n  const invoiceId = `customer-portal-invoice-${generatedId}`;\n  const [billingPeriod, setBillingPeriod] = useState(\"current\");\n  const [sessions, setSessions] = useState(initialSessions);\n  const [tickets, setTickets] = useState(initialTickets);\n  const [selectedTicketId, setSelectedTicketId] = useState(\"exports\");\n  const [search, setSearch] = useState(\"\");\n  const [statusFilter, setStatusFilter] = useState(\"all\");\n  const [draft, setDraft] = useState(\"\");\n  const [showProfileNote, setShowProfileNote] = useState(false);\n  const [showPlanDetails, setShowPlanDetails] = useState(false);\n  const [showUsageDetails, setShowUsageDetails] = useState(false);\n  const [notice, setNotice] = useState(\"Local sample ready.\");\n\n  const visibleTickets = useMemo(() => {\n    const query = search.trim().toLocaleLowerCase();\n    return tickets.filter(\n      (ticket) =>\n        (statusFilter === \"all\" || ticket.status === statusFilter) &&\n        (!query ||\n          ticket.subject.toLocaleLowerCase().includes(query) ||\n          ticket.customerName.toLocaleLowerCase().includes(query)),\n    );\n  }, [search, statusFilter, tickets]);\n\n  const billing: TidalCustomerPortalBillingConfig = {\n    title: \"Billing overview\",\n    description: \"Current sample plan, allowances, and invoices.\",\n    plan: {\n      name: \"Studio\",\n      accessibleName: \"Studio plan\",\n      status: \"Active\",\n      price: billingPeriod === \"current\" ? \"$32\" : \"$384\",\n      priceNote: billingPeriod === \"current\" ? \"per month\" : \"per year\",\n      description: showPlanDetails\n        ? \"Workspace controls and reporting for a small team.\"\n        : undefined,\n      details: showPlanDetails\n        ? [\n            { id: \"seats\", label: \"Seats\", value: \"8 included\" },\n            { id: \"renewal\", label: \"Next review\", value: \"Nov 15, 2026\" },\n          ]\n        : undefined,\n      action: {\n        id: \"review-plan\",\n        kind: \"button\",\n        label: showPlanDetails ? \"Hide plan details\" : \"Show plan details\",\n        onAction: () => {\n          setShowPlanDetails((visible) => !visible);\n          setNotice(\n            showPlanDetails\n              ? \"Plan details hidden.\"\n              : \"Plan details shown locally.\",\n          );\n        },\n      },\n    },\n    allowances: [\n      {\n        id: \"members\",\n        label: \"Members\",\n        valueLabel: \"5 of 8 seats\",\n        used: 5,\n        limit: 8,\n        description: \"Three seats remain in this sample plan.\",\n      },\n      {\n        id: \"storage\",\n        label: \"Storage\",\n        valueLabel: \"18 GB of 50 GB\",\n        used: 18,\n        limit: 50,\n      },\n    ],\n    invoices: [\n      {\n        id: \"inv-1048\",\n        label: \"INV-1048\",\n        accessibleLabel: \"invoice INV-1048\",\n        date: \"Oct 15, 2026\",\n        total: \"$32.00\",\n        status: \"Paid\",\n        destination: {\n          href: `#${invoiceId}`,\n          linkProps: {\n            onClick: (event: import(\"react\").MouseEvent<HTMLAnchorElement>) => {\n              if (isPlainPrimary(event)) setNotice(\"Sample invoice selected.\");\n            },\n          },\n        },\n      },\n      {\n        id: \"inv-1037\",\n        label: \"INV-1037\",\n        accessibleLabel: \"invoice INV-1037\",\n        date: \"Sep 15, 2026\",\n        total: \"$32.00\",\n        status: \"Paid\",\n        destination: { href: `#${invoiceId}` },\n      },\n    ],\n    invoiceCaption: \"Sample invoices\",\n    periodControl: {\n      value: billingPeriod,\n      label: \"Billing period\",\n      options: [\n        { value: \"current\", label: \"Monthly\" },\n        { value: \"annual\", label: \"Annual\" },\n      ],\n      onValueChange: setBillingPeriod,\n    },\n    footer: \"No charge or plan change is made in this preview.\",\n  };\n\n  const support: TidalCustomerPortalSupportConfig = {\n    title: \"Support\",\n    eyebrow: \"\",\n    description: \"Search the sample record or add a local reply.\",\n    tickets: visibleTickets,\n    selectedTicketId,\n    onTicketSelect: (ticket) => {\n      setSelectedTicketId(ticket.id);\n      setNotice(`${ticket.subject} selected.`);\n    },\n    searchValue: search,\n    onSearchValueChange: setSearch,\n    statusFilterValue: statusFilter,\n    statusOptions: [\n      { value: \"all\", label: \"All statuses\" },\n      { value: \"open\", label: \"Open\" },\n      { value: \"closed\", label: \"Closed\" },\n    ],\n    onStatusFilterChange: setStatusFilter,\n    draftValue: draft,\n    onDraftValueChange: setDraft,\n    onReplySubmit: (ticket, event) => {\n      event.preventDefault();\n      const body = draft.trim();\n      if (!body) return;\n      setTickets((current) =>\n        current.map((item) =>\n          item.id === ticket.id\n            ? {\n                ...item,\n                preview: body,\n                messages: [\n                  ...item.messages,\n                  {\n                    id: `${item.id}-local-${item.messages.length + 1}`,\n                    authorName: \"Ava Morgan\",\n                    body,\n                    timestamp: \"Now\",\n                    avatarSrc: tidalExampleAvatarDataUri(\"04\"),\n                    side: \"customer\" as const,\n                  },\n                ],\n              }\n            : item,\n        ),\n      );\n      setDraft(\"\");\n      setNotice(\"Reply added to the local sample.\");\n    },\n    composerPlaceholder: \"Write a sample reply\",\n    submitLabel: \"Add local reply\",\n  };\n\n  return (\n    <div className=\"tidal-customer-portal-demo\" data-theme={theme}>\n      <TidalCustomerPortalTemplate\n        title=\"Your account\"\n        description=\"Review profile, billing, usage, active sessions, and support in one place.\"\n        helpHref={`#${helpId}`}\n        helpLabel=\"Account help\"\n        profile={{\n          customer: {\n            name: \"Ava Morgan\",\n            company: \"Northstar Studio\",\n            detail: \"Member since February 2025\",\n            imageSrc: tidalExampleAvatarDataUri(\"04\"),\n          },\n          contacts: [\n            { id: \"email\", label: \"Email\", value: \"ava@example.test\" },\n            { id: \"phone\", label: \"Phone\", value: \"+1 (555) 014-2038\" },\n          ],\n          fields: [\n            { id: \"workspace\", label: \"Workspace\", value: \"Northstar\" },\n            { id: \"region\", label: \"Data region\", value: \"United States\" },\n          ],\n          health: { label: \"Account in good standing\", status: \"success\" },\n          plan: { name: \"Studio\", detail: \"5 of 8 seats used\" },\n          actions: [\n            {\n              id: \"review-profile\",\n              kind: \"button\",\n              label: showProfileNote\n                ? \"Hide profile note\"\n                : \"Show profile note\",\n              onAction: () => {\n                setShowProfileNote((visible) => !visible);\n                setNotice(\n                  showProfileNote\n                    ? \"Profile note hidden.\"\n                    : \"Profile note shown locally.\",\n                );\n              },\n            },\n          ],\n          note: showProfileNote\n            ? \"Preferred workspace contact for billing and support.\"\n            : undefined,\n          activity: [\n            {\n              id: \"profile-update\",\n              title: \"Profile reviewed\",\n              description: \"Workspace contact details were checked.\",\n              time: \"Oct 14\",\n              dateTime: \"2026-10-14\",\n            },\n            {\n              id: \"invoice-paid\",\n              title: \"Invoice marked paid\",\n              description: \"Sample invoice INV-1048.\",\n              time: \"Oct 15\",\n              dateTime: \"2026-10-15\",\n              href: `#${invoiceId}`,\n              linkLabel: \"View invoice note\",\n            },\n          ],\n        }}\n        billing={billing}\n        usage={{\n          title: \"Usage\",\n          description: showUsageDetails\n            ? \"Sample plan allowances for the current period. Values reset on the dates shown.\"\n            : undefined,\n          metrics: [\n            {\n              id: \"automation-runs\",\n              kind: \"metered\",\n              label: \"Automation runs\",\n              value: 642,\n              limit: 1000,\n              valueText: \"642 runs\",\n              limitText: \"1,000 runs\",\n              description: showUsageDetails\n                ? \"358 sample runs remain in this period.\"\n                : undefined,\n              reset: { label: \"Resets Nov 1\", dateTime: \"2026-11-01\" },\n            },\n            {\n              id: \"reports\",\n              kind: \"unlimited\",\n              label: \"Saved reports\",\n              valueText: \"No set limit\",\n              description: showUsageDetails\n                ? \"Saved reports do not use a metered allowance in this sample.\"\n                : undefined,\n            },\n          ],\n          action: (\n            <button\n              className=\"tidal-customer-portal-demo-action\"\n              type=\"button\"\n              onClick={() => {\n                setShowUsageDetails((visible) => !visible);\n                setNotice(\n                  showUsageDetails\n                    ? \"Usage details hidden.\"\n                    : \"Usage details shown locally.\",\n                );\n              }}\n            >\n              {showUsageDetails ? \"Hide usage details\" : \"Show usage details\"}\n            </button>\n          ),\n        }}\n        sessions={{\n          title: \"Active sessions\",\n          description: \"Devices in this fictional account sample.\",\n          sessions,\n          onRevokeRequest: (session) => {\n            setSessions((current) =>\n              current.filter((item) => item.id !== session.id),\n            );\n            setNotice(\n              `${String(session.device)} removed from the local sample.`,\n            );\n          },\n          onRevokeOthersRequest: () => {\n            setSessions((current) =>\n              current.filter((session) => session.current),\n            );\n            setNotice(\"Other sessions removed from the local sample.\");\n          },\n        }}\n        support={support}\n        footer={\n          <output aria-live=\"polite\">\n            {notice} All records are fictional and stay in this page.\n          </output>\n        }\n      />\n      <section className=\"tidal-customer-portal-demo-note\">\n        <h2>Sample details</h2>\n        <p id={invoiceId}>\n          INV-1048 is a fictional paid invoice used for this local preview.\n        </p>\n        <p id={helpId}>\n          Account help in this sample does not contact a support service.\n        </p>\n      </section>\n    </div>\n  );\n}\n\nexport default function AgentExample() {\n  return (\n    <div className=\"tidal-scope\" data-theme=\"light\" dir=\"ltr\">\n      <style>{tidalExampleStyles}</style>\n      <CustomerPortalTemplateDemo />\n    </div>\n  );\n}\n",
    "sourceFile": "/examples/customer-portal-template.tsx",
    "fixtureData": "Existing demo fixture data only; replace with consumer-owned data before production use."
  },
  "controlledState": [],
  "events": [
    {
      "name": "onClick",
      "nativeType": "React synthetic event or native callback",
      "callerFirst": true,
      "preventable": true,
      "observedResult": "The existing demo callback remains the source of truth; this example does not call a live service."
    }
  ],
  "nativeForm": {
    "participates": true,
    "names": [],
    "expectedFormData": {},
    "submitBehavior": "The existing demo's native form callback receives the submit event.",
    "resetBehavior": "Native reset behavior remains available where the demo renders a resettable control.",
    "disabledBehavior": "Disabled controls remain excluded from successful native form submission.",
    "readOnlyBehavior": "Read-only controls retain their value and remain inspectable by the consumer."
  },
  "accessibility": {
    "labelSource": "Consumer-provided label remains required where the component API requires one.",
    "semantics": "Preserve the component's native element and the semantics demonstrated by the source fixture.",
    "keyboard": [
      "Tab and Shift+Tab",
      "Enter or Space for native activation",
      "Arrow keys where the component exposes a composite control"
    ],
    "focusReturn": "Verify focus returns to the invoking control after dismissal.",
    "errorAnnouncement": "No error announcement path is present in this demo; the consumer owns validation messaging.",
    "reducedMotion": "Verify prefers-reduced-motion with the existing component transition path.",
    "forcedColors": "Verify visible borders, text, and focus in forced-colors mode."
  },
  "responsive": {
    "widths": [
      320,
      390,
      768,
      1260
    ],
    "shortViewport": "Check the example at a 300px viewport height with keyboard or portal content visible.",
    "overflow": "The page should not gain horizontal overflow; component-local scrolling must remain intentional.",
    "touchTargetMinPx": 44,
    "coarseInputFontPx": 16
  },
  "errors": [
    {
      "fixture": "No error fixture is exposed by the existing demo; inject a consumer-owned failure state before production use.",
      "visibleResult": "The consumer-visible result must remain explicit and must not be replaced by a silent console error.",
      "focusResult": "Focus must remain on the triggering control or move to the announced error according to the native pattern.",
      "ownership": "Consumer-owned sample state only; no network request or customer data is used."
    }
  ],
  "verification": {
    "commands": [
      "npx tsc --noEmit",
      "npx vite build"
    ],
    "lockfile": "Use the consumer project's committed lockfile.",
    "browser": [
      "Chromium 1260x800",
      "Chromium 390x844",
      "Keyboard and reduced-motion pass"
    ]
  },
  "validation": {
    "consumerFixture": {
      "tsc": "pass",
      "viteBuild": "pass",
      "resourceModel": "Generated usage plus only the component files and CSS delivered by the primary item and listed registry dependencies."
    },
    "registryArtifact": "server-gated"
  },
  "exceptions": []
}
