@tetsuo-ai/marketplace-react 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -3
- package/README.md +50 -20
- package/dist/{chunk-ABS77JB2.js → chunk-D2TDU3TJ.js} +3 -3
- package/dist/{chunk-ABS77JB2.js.map → chunk-D2TDU3TJ.js.map} +1 -1
- package/dist/{chunk-GN5DYVN5.js → chunk-ECU7HGO3.js} +6 -5
- package/dist/chunk-ECU7HGO3.js.map +1 -0
- package/dist/{chunk-YORZNYZZ.js → chunk-FAIRTAIB.js} +53 -17
- package/dist/chunk-FAIRTAIB.js.map +1 -0
- package/dist/{chunk-5OTKSRHM.js → chunk-MNJ2EQDJ.js} +3 -3
- package/dist/{chunk-5OTKSRHM.js.map → chunk-MNJ2EQDJ.js.map} +1 -1
- package/dist/{chunk-KJMR6OGC.js → chunk-WJUVTFJ7.js} +105 -9
- package/dist/chunk-WJUVTFJ7.js.map +1 -0
- package/dist/components/agenc-components.css +20 -0
- package/dist/components/index.cjs +147 -17
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.d.cts +2 -2
- package/dist/components/index.d.ts +2 -2
- package/dist/components/index.js +3 -3
- package/dist/hooks/index.cjs +350 -28
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.d.cts +160 -36
- package/dist/hooks/index.d.ts +160 -36
- package/dist/hooks/index.js +299 -19
- package/dist/hooks/index.js.map +1 -1
- package/dist/{index-BLrlBVj-.d.cts → index-C9R3B80j.d.ts} +176 -47
- package/dist/{index-CKTYsNPH.d.ts → index-CTTh1ZPg.d.cts} +176 -47
- package/dist/index.cjs +168 -33
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -19
- package/dist/index.d.ts +10 -19
- package/dist/index.js +17 -12
- package/dist/index.js.map +1 -1
- package/dist/signers/index.cjs +4 -3
- package/dist/signers/index.cjs.map +1 -1
- package/dist/signers/index.js +2 -2
- package/dist/{useAgentTrackRecord-BLf1nrbu.d.cts → useAgentTrackRecord-BCvRHYM2.d.cts} +7 -7
- package/dist/{useAgentTrackRecord-BLf1nrbu.d.ts → useAgentTrackRecord-BCvRHYM2.d.ts} +7 -7
- package/package.json +4 -3
- package/src/components/HireButton.tsx +1 -2
- package/src/components/HireCheckoutModal.tsx +8 -9
- package/src/components/ProviderCard.stories.tsx +54 -4
- package/src/components/ProviderCard.tsx +113 -9
- package/src/components/ReferrerDisclosure.tsx +8 -12
- package/src/components/__fixtures__/index.tsx +28 -0
- package/src/components/agenc-components.css +20 -0
- package/src/components/index.ts +12 -0
- package/src/components/strings.ts +10 -2
- package/src/components/useAgentVerification.ts +223 -0
- package/src/hooks/index.ts +47 -4
- package/src/hooks/internal.ts +74 -2
- package/src/hooks/useHire.ts +30 -38
- package/src/hooks/useHumanlessHireFlow.ts +259 -0
- package/src/hooks/useRateHire.ts +52 -0
- package/src/hooks/useReferrerEarnings.ts +32 -33
- package/src/hooks/useTaskActivation.ts +58 -0
- package/src/hooks/useTaskLifecycle.ts +110 -0
- package/src/hooks/useTaskWork.ts +76 -0
- package/src/index.ts +12 -2
- package/src/provider/AgencProvider.tsx +3 -3
- package/src/provider/referrer.ts +24 -32
- package/src/strings/index.ts +5 -3
- package/src/types.ts +7 -10
- package/dist/chunk-GN5DYVN5.js.map +0 -1
- package/dist/chunk-KJMR6OGC.js.map +0 -1
- package/dist/chunk-YORZNYZZ.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/theme/index.ts","../src/components/strings.ts","../src/components/format.ts","../src/components/primitives.tsx","../src/components/badges.tsx","../src/components/useFocusTrap.ts","../src/components/Modal.tsx","../src/components/ListingCard.tsx","../src/components/ListingGrid.tsx","../src/components/ReferrerDisclosure.tsx","../src/components/HireCheckoutModal.tsx","../src/components/HireButton.tsx","../src/components/TaskTimeline.tsx","../src/components/ReviewPanel.tsx","../src/components/DisputeBanner.tsx","../src/components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MACC,SAAA,EAAW,SAAA;AAAA,MACX,IAAA,EAAM,SAAS,IAAI,CAAA;AAAA,MACnB,MAAA,EAAQ,SAAS,QAAA,GAAW,MAAA;AAAA,MAG5B,GAAA,EAAK,SAAS,qBAAA,GAAwB,MAAA;AAAA,MAEtC,cAAY,CAAA,EAAG,KAAA,IAAS,EAAA,CAAG,4BAA4B,CAAC,CAAA,QAAA,EAAM,EAAA;AAAA,QAC5D;AAAA,OACD,CAAA,CAAA;AAAA,MAED,QAAA,kBAAAA,GAAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAW,QAAA,GAAW,SAAY,yBAAA,EACrC,QAAA,EAAA,KAAA,IAAS,EAAA,CAAG,4BAA4B,CAAA,EAC3C;AAAA;AAAA,GACF;AAEJ","file":"chunk-KJMR6OGC.js","sourcesContent":["/**\n * AgenC theme — the `--agenc-*` CSS custom-property contract.\n *\n * ## How theming works (no CSS-in-JS runtime)\n *\n * Every prebuilt component (shipped by the components agent) styles itself\n * **only** through CSS custom properties named `--agenc-*` (e.g.\n * `--agenc-violet`, `--agenc-surface`, `--agenc-radius`). They are declared in\n * the vendored {@link AGENC_TOKENS_CSS_PATH} stylesheet under `:root, .agenc`.\n * To restyle, override any of those variables on an ancestor element — no\n * recompile, no Tailwind, no JS.\n *\n * ## Three ways to load the tokens\n *\n * 1. **Side-effect CSS import** (recommended for bundler apps):\n * ```ts\n * import \"@tetsuo-ai/marketplace-react/theme.css\";\n * ```\n * Pulls in the full vendored token sheet as a side effect. This is the only\n * CSS this package ships, and it is fully optional: headless hook usage\n * needs no CSS at all.\n *\n * 2. **`<link>` / framework asset pipeline:** point at the resolved package\n * path `@tetsuo-ai/marketplace-react/theme.css`.\n *\n * 3. **Inline injection** via {@link agencThemeStyleTag} — returns the token\n * CSS as a string you can drop into a `<style>` tag (handy for the embed\n * widget / iframe where a separate stylesheet request is undesirable).\n * NOTE: this returns only the small base token set, not the full vendored\n * sheet; prefer (1) or (2) for the canonical theme.\n *\n * ## The `unstyled` escape hatch (white-label)\n *\n * Per PLAN_2 A3, every prebuilt component accepts an `unstyled` prop. When set,\n * the component renders semantic markup and ARIA wiring but emits **none** of\n * the default `--agenc-*`-driven classes, so a host app can style it from\n * scratch. This module owns the convention so components stay consistent:\n * - the default class root is {@link AGENC_THEME_CLASS} (`\"agenc\"`), the scope\n * under which `--agenc-*` tokens are defined;\n * - {@link resolveThemeClassName} returns `undefined` when `unstyled` is true,\n * so a component can spread it onto its root without branching.\n *\n * @module theme\n */\n\n/**\n * The root class scope under which the vendored sheet declares `--agenc-*`\n * tokens (`:root, .agenc`). Components default their outermost element to this\n * class so the tokens resolve even when the sheet is scoped rather than global.\n */\nexport const AGENC_THEME_CLASS = \"agenc\";\n\n/**\n * Package-relative specifier for the vendored token stylesheet, exposed for\n * documentation/tooling. Import it for its side effect via the package's\n * `./theme.css` export: `import \"@tetsuo-ai/marketplace-react/theme.css\"`.\n */\nexport const AGENC_TOKENS_CSS_PATH = \"@tetsuo-ai/marketplace-react/theme.css\";\n\n/**\n * Resolve the class name a themable component should put on its root element.\n *\n * @param unstyled - When true (white-label mode), returns `undefined` so the\n * component emits no default theme class.\n * @param extra - An optional caller-supplied `className` to append.\n * @returns The composed class string, or `undefined` when there is nothing to\n * apply.\n */\nexport function resolveThemeClassName(\n unstyled?: boolean,\n extra?: string,\n): string | undefined {\n if (unstyled) {\n return extra && extra.trim() !== \"\" ? extra : undefined;\n }\n const composed = [AGENC_THEME_CLASS, extra]\n .filter((part): part is string => Boolean(part && part.trim() !== \"\"))\n .join(\" \");\n return composed === \"\" ? undefined : composed;\n}\n\n/**\n * The minimal base `--agenc-*` token set as inline CSS text, for the embed /\n * iframe surface where a separate stylesheet request is undesirable. This is a\n * SUBSET of the full vendored sheet (the most load-bearing surface, brand,\n * text, semantic, and radius tokens) — for the canonical, complete theme\n * import `@tetsuo-ai/marketplace-react/theme.css` instead.\n *\n * SSR-safe: returns a string and never touches `document`. The caller decides\n * how to inject it (a `<style>` element, a `dangerouslySetInnerHTML`, etc.).\n */\nexport function agencThemeStyleTag(): string {\n return `:root,.${AGENC_THEME_CLASS}{--agenc-void:#0A0612;--agenc-surface:#16102A;--agenc-surface-2:#221638;--agenc-surface-3:#2E1A4A;--agenc-violet:#7B3FFF;--agenc-magenta:#FF2E93;--agenc-orange:#FF6B1A;--agenc-cyan:#48C8EF;--agenc-text:#F5F0FF;--agenc-text-muted:#B8A8D9;--agenc-text-dim:#6E5C8F;--agenc-success:#3FFFA0;--agenc-warning:#FFC53F;--agenc-danger:#FF3D3D;--agenc-border:#2E1A4A;--agenc-border-strong:#4A2E7A;--agenc-radius-sm:4px;--agenc-radius:8px;--agenc-radius-lg:12px;--agenc-radius-pill:9999px;}`;\n}\n","/**\n * Component-layer string catalog (PLAN_2 A3).\n *\n * Every user-facing literal a prebuilt component renders routes through the\n * shared {@link t} resolver and is keyed HERE, namespaced under\n * `components.*` so it never collides with the foundation catalog\n * (`provider.*`, `referrer.*`, `transport.*`, `state.*`, `hire.*`). A future\n * locale extends this object — no component code changes.\n *\n * These are MERGED over `EN_STRINGS` at module load (see `mergedCatalog`) so a\n * component calling `t(\"components.listingCard.priceLabel\")` resolves without\n * the caller threading a catalog. SSR-safe: a plain object literal, no globals.\n *\n * @module components/strings\n */\nimport { EN_STRINGS, type StringCatalog } from \"../strings/index.js\";\n\n/**\n * The component-surface English strings. Keys are namespaced by component\n * (`components.<component>.<key>`) plus a few shared `components.common.*`.\n */\nexport const EN_COMPONENT_STRINGS = {\n // Shared / cross-component.\n \"components.common.loading\": \"Loading…\",\n \"components.common.empty\": \"Nothing to show yet.\",\n \"components.common.error\": \"Something went wrong.\",\n \"components.common.retry\": \"Retry\",\n \"components.common.close\": \"Close\",\n \"components.common.verified\": \"Verified\",\n \"components.common.unverified\": \"Unverified\",\n \"components.common.sol\": \"SOL\",\n \"components.common.lamports\": \"lamports\",\n\n // ListingCard.\n \"components.listingCard.priceLabel\": \"Price\",\n \"components.listingCard.byProvider\": \"by {provider}\",\n \"components.listingCard.untitled\": \"Untitled service\",\n \"components.listingCard.hires\": \"{count} hires\",\n \"components.listingCard.category\": \"Category\",\n\n // ListingGrid.\n \"components.listingGrid.empty\": \"No listings match your filters yet.\",\n \"components.listingGrid.loadMore\": \"Load more\",\n \"components.listingGrid.error\": \"Could not load listings.\",\n\n // HireButton / Checkout.\n \"components.hire.cta\": \"Hire\",\n \"components.hire.ctaPrice\": \"Hire — {price}\",\n \"components.hire.checkoutTitle\": \"Confirm hire\",\n \"components.hire.priceLabel\": \"You pay\",\n \"components.hire.escrowNote\":\n \"Funds are held in protocol escrow and released to the provider only when you accept the result.\",\n \"components.hire.confirm\": \"Confirm and fund escrow\",\n \"components.hire.cancel\": \"Cancel\",\n \"components.hire.pending\": \"Confirming…\",\n \"components.hire.success\": \"Escrow funded.\",\n \"components.hire.successDetail\": \"Your task is created. Track it below.\",\n \"components.hire.viewTask\": \"View task\",\n \"components.hire.errorTitle\": \"Hire failed\",\n \"components.hire.moderationAttested\": \"Moderation attested\",\n \"components.hire.moderationPending\": \"Moderation pending\",\n \"components.hire.moderationIssues\": \"Moderation issues found\",\n \"components.hire.notConnected\": \"Connect a wallet to hire.\",\n\n // Referrer disclosure (P6.2 gate — never claims a live fee).\n \"components.referrer.disclosure\": \"This site earns a referral fee.\",\n \"components.referrer.disclosurePending\":\n \"This site earns a referral fee (pending protocol support).\",\n \"components.referrer.feeBps\": \"{bps} bps\",\n\n // TaskTimeline.\n \"components.taskTimeline.title\": \"Task progress\",\n \"components.taskTimeline.empty\": \"No task to track yet.\",\n \"components.taskTimeline.status.Open\": \"Open\",\n \"components.taskTimeline.status.InProgress\": \"In progress\",\n \"components.taskTimeline.status.PendingValidation\": \"Pending review\",\n \"components.taskTimeline.status.Completed\": \"Completed\",\n \"components.taskTimeline.status.Cancelled\": \"Cancelled\",\n \"components.taskTimeline.status.Disputed\": \"Disputed\",\n \"components.taskTimeline.status.RejectFrozen\": \"Rejected (frozen)\",\n\n // ReviewPanel.\n \"components.review.title\": \"Review submission\",\n \"components.review.noSubmission\": \"Awaiting the worker's submission.\",\n \"components.review.accept\": \"Accept and release escrow\",\n \"components.review.reject\": \"Reject\",\n \"components.review.requestChanges\": \"Request changes\",\n \"components.review.accepted\": \"Result accepted. Escrow released.\",\n \"components.review.rejected\": \"Result rejected.\",\n \"components.review.changesRequested\": \"Changes requested.\",\n \"components.review.pending\": \"Submitting…\",\n \"components.review.errorTitle\": \"Review action failed\",\n\n // DisputeBanner.\n \"components.dispute.title\": \"This task is in dispute.\",\n \"components.dispute.body\":\n \"A dispute has been opened. A protocol resolver decides the outcome; funds stay in escrow until then.\",\n \"components.dispute.initiate\": \"Open a dispute\",\n \"components.dispute.pending\": \"Opening dispute…\",\n \"components.dispute.opened\": \"Dispute opened.\",\n \"components.dispute.none\": \"No open dispute.\",\n \"components.dispute.errorTitle\": \"Could not open dispute\",\n\n // ProviderCard.\n \"components.provider.title\": \"Provider\",\n \"components.provider.completionRate\": \"Completion rate\",\n \"components.provider.disputeRate\": \"Dispute rate\",\n \"components.provider.completions\": \"{count} completed\",\n \"components.provider.disputes\": \"{count} disputes\",\n \"components.provider.provisional\": \"provisional\",\n \"components.provider.noData\": \"No track record yet.\",\n \"components.provider.unavailable\":\n \"Track record is unavailable on this read transport.\",\n\n // PoweredByAgenC.\n \"components.poweredBy.label\": \"Powered by AgenC\",\n \"components.poweredBy.trustLink\": \"Learn how this works\",\n} as const satisfies StringCatalog;\n\n/** A component-surface message id. */\nexport type ComponentStringId = keyof typeof EN_COMPONENT_STRINGS;\n\n/**\n * The default catalog every component resolves against: the foundation\n * `EN_STRINGS` merged with {@link EN_COMPONENT_STRINGS}. A host-supplied catalog\n * (`t(id, vars, { catalog })`) still wins per-call.\n */\nexport const COMPONENT_CATALOG: StringCatalog = {\n ...EN_STRINGS,\n ...EN_COMPONENT_STRINGS,\n};\n","/**\n * Pure presentation helpers for the prebuilt components.\n *\n * Everything here is a deterministic, SSR-safe pure function — no React, no\n * `window`/`document`, no `Intl` at module scope. They turn the SDK's raw\n * on-chain shapes (NUL-padded byte fields, lamport `bigint`s, base58\n * `Address`es) into display strings, and centralize the component string\n * resolver so callers don't thread the component catalog by hand.\n *\n * @module components/format\n */\nimport { values } from \"@tetsuo-ai/marketplace-sdk\";\nimport type { ServiceListing } from \"../types.js\";\nimport { t, type StringVars, type TranslateOptions } from \"../strings/index.js\";\nimport { COMPONENT_CATALOG, type ComponentStringId } from \"./strings.js\";\n\n/**\n * Resolve a component string id against the merged component catalog by\n * default. A per-call `options.catalog` (e.g. a future locale) still wins.\n *\n * This is the only resolver components call so every literal is overridable in\n * one place.\n */\nexport function tc(\n id: ComponentStringId | (string & {}),\n vars?: StringVars,\n options?: TranslateOptions,\n): string {\n return t(id, vars, { catalog: COMPONENT_CATALOG, ...options });\n}\n\n/** Lamports per SOL. */\nconst LAMPORTS_PER_SOL = 1_000_000_000n;\n\n/**\n * Format a lamports `bigint` as a human SOL string with up to 9 decimal places,\n * trailing zeros trimmed. Pure bigint math — no float rounding, no `Intl`.\n *\n * @example formatSol(1_500_000_000n) // \"1.5\"\n * @example formatSol(1_000_000n) // \"0.001\"\n * @example formatSol(0n) // \"0\"\n */\nexport function formatSol(lamports: bigint): string {\n const negative = lamports < 0n;\n const abs = negative ? -lamports : lamports;\n const whole = abs / LAMPORTS_PER_SOL;\n const frac = abs % LAMPORTS_PER_SOL;\n let out: string;\n if (frac === 0n) {\n out = whole.toString();\n } else {\n // Zero-pad the fractional part to 9 digits, then trim trailing zeros.\n const fracStr = frac.toString().padStart(9, \"0\").replace(/0+$/, \"\");\n out = `${whole.toString()}.${fracStr}`;\n }\n return negative ? `-${out}` : out;\n}\n\n/**\n * A price label like `\"1.5 SOL\"` (SOL leg) — the only denomination the v1\n * components render (SPL-priced listings surface the raw lamport-equivalent\n * with the configured unit label by the caller; v1 assumes SOL).\n */\nexport function formatPriceSol(\n lamports: bigint,\n options?: TranslateOptions,\n): string {\n return `${formatSol(lamports)} ${t(\"components.common.sol\", undefined, {\n catalog: COMPONENT_CATALOG,\n ...options,\n })}`;\n}\n\n/**\n * Truncate a base58 address/string to `head…tail` for compact display.\n *\n * @example truncateAddress(\"So11111111111111111111111111111111111111112\")\n * // \"So1111…1112\"\n */\nexport function truncateAddress(\n value: string | { toString(): string } | null | undefined,\n head = 4,\n tail = 4,\n): string {\n if (value === null || value === undefined) return \"\";\n const s = String(value);\n if (s.length <= head + tail + 1) return s;\n return `${s.slice(0, head)}…${s.slice(-tail)}`;\n}\n\n/**\n * Decode a listing's NUL-padded `name` byte field to a display string using the\n * SDK's canonical decoder, falling back to an empty string on any decode error\n * (a malformed on-chain name must never crash a card).\n */\nexport function decodeListingName(listing: Pick<ServiceListing, \"name\">): string {\n try {\n return values.decodeListingName(Uint8Array.from(listing.name));\n } catch {\n return \"\";\n }\n}\n\n/**\n * Decode a listing's `category` byte field, tolerant of malformed bytes.\n */\nexport function decodeListingCategory(\n listing: Pick<ServiceListing, \"category\">,\n): string {\n try {\n return values.decodeListingCategory(Uint8Array.from(listing.category));\n } catch {\n return \"\";\n }\n}\n\n/**\n * Decode a listing's `tags` byte field to a string array, tolerant of malformed\n * bytes (returns `[]` on error).\n */\nexport function decodeListingTags(\n listing: Pick<ServiceListing, \"tags\">,\n): string[] {\n try {\n return values.decodeListingTags(Uint8Array.from(listing.tags));\n } catch {\n return [];\n }\n}\n\n/**\n * Lowercase-hex a byte field (e.g. a spec hash) for display / comparison.\n */\nexport function toHex(bytes: ArrayLike<number>): string {\n let out = \"\";\n for (let i = 0; i < bytes.length; i++) {\n out += bytes[i]!.toString(16).padStart(2, \"0\");\n }\n return out;\n}\n\n/**\n * Format a `[0,1]` rate as an integer percentage string, or a fallback when the\n * rate is `null` (no denominator — the P6.6 provisional state).\n */\nexport function formatRate(rate: number | null, fallback = \"—\"): string {\n if (rate === null || Number.isNaN(rate)) return fallback;\n const pct = Math.round(rate * 100);\n return `${pct}%`;\n}\n","/**\n * Shared presentational primitives for the prebuilt components.\n *\n * These are the small, themable building blocks every higher-level component\n * (ListingCard, HireCheckoutModal, ...) composes: a class-name joiner, a\n * loading spinner, the canonical loading/empty/error state block, a status\n * badge, and a button. They emit ONLY `--agenc-*`-driven class names (no\n * CSS-in-JS), honor the `unstyled` white-label contract, and route every\n * literal through {@link tc}.\n *\n * SSR-safe: pure render functions, no `window`/`document` at module scope.\n *\n * @module components/primitives\n */\nimport type {\n ButtonHTMLAttributes,\n HTMLAttributes,\n ReactNode,\n} from \"react\";\nimport { AGENC_THEME_CLASS } from \"../theme/index.js\";\nimport { tc } from \"./format.js\";\n\n/** Join truthy class names with a single space. */\nexport function cx(...parts: Array<string | false | null | undefined>): string {\n return parts.filter((p): p is string => Boolean(p)).join(\" \");\n}\n\n/**\n * Resolve the className a styled element should carry: when `unstyled`, only\n * the caller's `extra` survives (white-label); otherwise the base `agenc-*`\n * class plus `extra`.\n */\nexport function elementClass(\n base: string,\n unstyled: boolean | undefined,\n extra?: string,\n): string | undefined {\n if (unstyled) return extra && extra.trim() !== \"\" ? extra : undefined;\n return cx(base, extra) || undefined;\n}\n\n/**\n * Resolve a COMPONENT ROOT className. Like {@link elementClass} but, when\n * styled, ALSO prepends the {@link AGENC_THEME_CLASS} scope (`\"agenc\"`) so the\n * `--agenc-*` tokens resolve even when the token sheet is scoped rather than\n * global. When `unstyled`, ONLY the caller's `extra` survives — neither the\n * scope class nor the component base class is emitted (true white-label).\n *\n * Use this for the outermost element of every prebuilt component; use\n * {@link elementClass} for inner elements (which inherit the scope from the\n * root and so don't repeat it).\n */\nexport function rootClass(\n base: string,\n unstyled: boolean | undefined,\n extra?: string,\n): string | undefined {\n if (unstyled) return extra && extra.trim() !== \"\" ? extra : undefined;\n return cx(AGENC_THEME_CLASS, base, extra) || undefined;\n}\n\n/** Common props every prebuilt component accepts. */\nexport interface ThemableProps {\n /** White-label mode: emit semantic markup + ARIA but no default theme class. */\n unstyled?: boolean;\n /** Extra class name appended to the component root. */\n className?: string;\n}\n\n/** Variants the loading/empty/error block renders. */\nexport type StateKind = \"loading\" | \"empty\" | \"error\";\n\n/** Props for {@link StateMessage}. */\nexport interface StateMessageProps extends ThemableProps {\n /** Which state to render. */\n kind: StateKind;\n /** Override message (defaults to the catalog string for `kind`). */\n message?: string;\n /** Optional retry handler (renders a Retry button for `error`/`empty`). */\n onRetry?: () => void;\n /** Accessible role override. Defaults: `status` (loading) / `alert` (error). */\n role?: HTMLAttributes<HTMLDivElement>[\"role\"];\n}\n\nconst STATE_STRING: Record<StateKind, string> = {\n loading: \"components.common.loading\",\n empty: \"components.common.empty\",\n error: \"components.common.error\",\n};\n\n/**\n * The canonical loading / empty / error block. Every read component renders\n * this for its non-data states so screen readers get a consistent, polite\n * announcement (`role=\"status\"` for loading, `role=\"alert\"` for error).\n */\nexport function StateMessage({\n kind,\n message,\n onRetry,\n role,\n unstyled,\n className,\n}: StateMessageProps): ReactNode {\n const text = message ?? tc(STATE_STRING[kind]);\n const resolvedRole = role ?? (kind === \"error\" ? \"alert\" : \"status\");\n return (\n <div\n className={elementClass(`agenc-state agenc-state--${kind}`, unstyled, className)}\n role={resolvedRole}\n aria-live={kind === \"error\" ? \"assertive\" : \"polite\"}\n aria-busy={kind === \"loading\" ? true : undefined}\n >\n {kind === \"loading\" ? <Spinner unstyled={unstyled} /> : null}\n <span className={unstyled ? undefined : \"agenc-state__text\"}>{text}</span>\n {onRetry && kind !== \"loading\" ? (\n <Button unstyled={unstyled} variant=\"ghost\" onClick={onRetry}>\n {tc(\"components.common.retry\")}\n </Button>\n ) : null}\n </div>\n );\n}\n\n/** Props for {@link Spinner}. */\nexport interface SpinnerProps extends ThemableProps {\n /** Accessible label (default \"Loading…\"). */\n label?: string;\n}\n\n/**\n * An accessible, CSS-animated spinner. `role=\"status\"` + visually-hidden label\n * so a screen reader announces the loading state with no visible text.\n */\nexport function Spinner({ label, unstyled, className }: SpinnerProps): ReactNode {\n return (\n <span\n className={elementClass(\"agenc-spinner\", unstyled, className)}\n role=\"status\"\n aria-live=\"polite\"\n >\n <span className={unstyled ? undefined : \"agenc-visually-hidden\"}>\n {label ?? tc(\"components.common.loading\")}\n </span>\n </span>\n );\n}\n\n/** Visual intent of a {@link Badge}. */\nexport type BadgeTone = \"neutral\" | \"success\" | \"warning\" | \"danger\" | \"info\";\n\n/** Props for {@link Badge}. */\nexport interface BadgeProps extends ThemableProps {\n /** Color intent. */\n tone?: BadgeTone;\n /** Badge content. */\n children: ReactNode;\n /**\n * Optional `title`/`aria-label` for an icon-only or abbreviated badge so it\n * carries an accessible name.\n */\n label?: string;\n}\n\n/**\n * A small status pill (verified / moderation / state). Themable via\n * `--agenc-*`; tone maps to a semantic color token.\n */\nexport function Badge({\n tone = \"neutral\",\n children,\n label,\n unstyled,\n className,\n}: BadgeProps): ReactNode {\n return (\n <span\n className={elementClass(\n `agenc-badge agenc-badge--${tone}`,\n unstyled,\n className,\n )}\n title={label}\n aria-label={label}\n >\n {children}\n </span>\n );\n}\n\n/** Visual variant of a {@link Button}. */\nexport type ButtonVariant = \"primary\" | \"secondary\" | \"ghost\" | \"danger\";\n\n/** Props for {@link Button}. */\nexport interface ButtonProps\n extends ButtonHTMLAttributes<HTMLButtonElement>,\n ThemableProps {\n /** Visual variant. */\n variant?: ButtonVariant;\n /** Show a spinner + disable while a related action is in flight. */\n loading?: boolean;\n}\n\n/**\n * A themable, accessible button. Always a real `<button type=\"button\">` (the\n * default) so keyboard + screen-reader semantics are correct; `loading`\n * disables it and shows an inline spinner with an accessible busy state.\n */\nexport function Button({\n variant = \"primary\",\n loading = false,\n unstyled,\n className,\n children,\n disabled,\n type,\n ...rest\n}: ButtonProps): ReactNode {\n return (\n <button\n type={type ?? \"button\"}\n className={elementClass(\n `agenc-button agenc-button--${variant}`,\n unstyled,\n className,\n )}\n disabled={disabled || loading}\n aria-busy={loading || undefined}\n {...rest}\n >\n {loading ? <Spinner unstyled={unstyled} /> : null}\n <span className={unstyled ? undefined : \"agenc-button__label\"}>\n {children}\n </span>\n </button>\n );\n}\n","/**\n * Shared status badges: moderation attestation + provider-verified.\n *\n * ## Moderation (P6.8 boundary — read before extending)\n *\n * Per PLAN_2 A3, `ListingCard`/`Checkout` surface moderation aggressively, but\n * the UNATTESTED-listing render toggle is gated on the PLAN.md P6.8 [HUMAN]\n * neutrality decision and is NOT built here. This badge therefore only ever\n * SHOWS the attestation STATE (attested / pending / issues); it never gates\n * whether a listing renders. The v1 read model does not project a standalone\n * attestation verdict, so \"attested\" is inferred from the indexer listing\n * projection's `metadataValid` (the strongest signal available today); a\n * dedicated verdict slots in later without changing this surface.\n *\n * @module components/badges\n */\nimport type { ReactNode } from \"react\";\nimport type { IndexerListing } from \"../types.js\";\nimport { tc } from \"./format.js\";\nimport { Badge, type ThemableProps } from \"./primitives.js\";\n\n/** The moderation state a badge can show (never a render gate). */\nexport type ModerationState = \"attested\" | \"pending\" | \"issues\";\n\n/**\n * Derive a moderation display state from the indexer listing projection.\n *\n * - `null` projection (gPA fallback, no indexer) → `\"pending\"` (unknown, shown\n * honestly as pending — never asserted as attested);\n * - `metadataValid === true` → `\"attested\"`;\n * - `metadataValid === false` (issues present) → `\"issues\"`.\n */\nexport function moderationStateOf(\n moderation: IndexerListing | null | undefined,\n): ModerationState {\n if (!moderation) return \"pending\";\n return moderation.metadataValid ? \"attested\" : \"issues\";\n}\n\n/** Props for {@link ModerationBadge}. */\nexport interface ModerationBadgeProps extends ThemableProps {\n /** The indexer listing projection (carries `metadataValid`/`metadataIssues`). */\n moderation: IndexerListing | null | undefined;\n /** Pre-resolved state (overrides `moderation`-derived state). */\n state?: ModerationState;\n}\n\nconst MODERATION_TONE = {\n attested: \"success\",\n pending: \"neutral\",\n issues: \"warning\",\n} as const;\n\nconst MODERATION_STRING = {\n attested: \"components.hire.moderationAttested\",\n pending: \"components.hire.moderationPending\",\n // Distinct from `pending` (\"Moderation pending\") so a buyer can textually\n // tell \"we found problems\" apart from \"we haven't checked\", not just by tone.\n issues: \"components.hire.moderationIssues\",\n} as const;\n\n/**\n * Show the listing's moderation attestation STATE (never a render gate).\n */\nexport function ModerationBadge({\n moderation,\n state,\n unstyled,\n className,\n}: ModerationBadgeProps): ReactNode {\n const resolved = state ?? moderationStateOf(moderation);\n const label = tc(MODERATION_STRING[resolved]);\n const issues =\n resolved === \"issues\" && moderation?.metadataIssues?.length\n ? moderation.metadataIssues.join(\"; \")\n : undefined;\n return (\n <Badge\n tone={MODERATION_TONE[resolved]}\n unstyled={unstyled}\n className={className}\n label={issues ?? label}\n >\n {label}\n </Badge>\n );\n}\n\n/** Props for {@link VerifiedBadge}. */\nexport interface VerifiedBadgeProps extends ThemableProps {\n /** Whether the entity is verified. */\n verified: boolean;\n}\n\n/**\n * A provider-verified pill (used by ProviderCard). Shows verified/unverified\n * state with the appropriate tone.\n */\nexport function VerifiedBadge({\n verified,\n unstyled,\n className,\n}: VerifiedBadgeProps): ReactNode {\n return (\n <Badge\n tone={verified ? \"success\" : \"neutral\"}\n unstyled={unstyled}\n className={className}\n >\n {verified\n ? tc(\"components.common.verified\")\n : tc(\"components.common.unverified\")}\n </Badge>\n );\n}\n","/**\n * `useFocusTrap` — an accessible focus trap for the modal surface.\n *\n * `HireCheckoutModal` is a money-handling dialog published to third-party\n * sites, so accessibility is STRUCTURAL (PLAN_2 A3): when the modal is open\n * this hook\n * - moves focus into the dialog (the first focusable element, or the dialog\n * container itself);\n * - cycles Tab / Shift+Tab within the dialog (a real trap, not just an\n * initial focus);\n * - RECAPTURES focus that escapes the dialog via a document-level `focusin`\n * listener (a Tab from browser autofill UI, a third-party widget, or\n * programmatic focus pulls focus back in — a container-scoped keydown alone\n * never sees it);\n * - invokes `onEscape` when Escape is pressed;\n * - restores focus to the element that was focused before the dialog opened on\n * close/unmount.\n *\n * SSR-safe: every `document` access happens inside `useEffect`, which never\n * runs on the server. The hook is a no-op while `active` is false.\n *\n * @module components/useFocusTrap\n */\nimport { useEffect, type RefObject } from \"react\";\n\n/** Selector matching the natively focusable, non-disabled elements. */\nconst FOCUSABLE_SELECTOR = [\n \"a[href]\",\n \"button:not([disabled])\",\n \"textarea:not([disabled])\",\n \"input:not([disabled])\",\n \"select:not([disabled])\",\n '[tabindex]:not([tabindex=\"-1\"])',\n].join(\",\");\n\nfunction focusableWithin(container: HTMLElement): HTMLElement[] {\n return Array.from(\n container.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR),\n ).filter((el) => el.offsetParent !== null || el === document.activeElement);\n}\n\n/**\n * Trap keyboard focus within `containerRef` while `active`.\n *\n * @param containerRef - Ref to the dialog container element.\n * @param active - Whether the trap is engaged (the modal is open).\n * @param onEscape - Called when Escape is pressed inside the trap.\n */\nexport function useFocusTrap(\n containerRef: RefObject<HTMLElement | null>,\n active: boolean,\n onEscape?: () => void,\n): void {\n useEffect(() => {\n if (!active) return;\n const container = containerRef.current;\n if (!container) return;\n\n // Remember what had focus so we can restore it on close.\n const previouslyFocused =\n document.activeElement instanceof HTMLElement\n ? document.activeElement\n : null;\n\n // Move focus into the dialog (first focusable, else the container).\n const initial = focusableWithin(container)[0] ?? container;\n initial.focus();\n\n function onKeyDown(event: KeyboardEvent): void {\n if (event.key === \"Escape\") {\n event.stopPropagation();\n onEscape?.();\n return;\n }\n if (event.key !== \"Tab\") return;\n const focusable = focusableWithin(container!);\n if (focusable.length === 0) {\n // Nothing to tab to — keep focus on the container.\n event.preventDefault();\n container!.focus();\n return;\n }\n const first = focusable[0]!;\n const last = focusable[focusable.length - 1]!;\n const activeEl = document.activeElement;\n if (event.shiftKey) {\n if (activeEl === first || activeEl === container) {\n event.preventDefault();\n last.focus();\n }\n } else if (activeEl === last) {\n event.preventDefault();\n first.focus();\n }\n }\n\n // Document-level recapture: a container-scoped keydown listener never sees a\n // Tab pressed while focus is OUTSIDE the dialog (browser autofill UI, a\n // third-party widget on the embedder's page, programmatic focus, or tabbing\n // back into the page from the address bar). When focus lands on something\n // the dialog does not contain, pull it back to the first focusable element\n // (or the container) so a keyboard/AT user cannot fall out of a money modal.\n function onFocusIn(event: FocusEvent): void {\n const target = event.target;\n if (!(target instanceof Node)) return;\n if (container!.contains(target)) return;\n // Focus escaped the dialog — recapture it.\n event.stopPropagation();\n const focusable = focusableWithin(container!);\n (focusable[0] ?? container!).focus();\n }\n\n container.addEventListener(\"keydown\", onKeyDown);\n document.addEventListener(\"focusin\", onFocusIn);\n return () => {\n container.removeEventListener(\"keydown\", onKeyDown);\n document.removeEventListener(\"focusin\", onFocusIn);\n // Restore focus to where it was before the dialog opened.\n previouslyFocused?.focus();\n };\n }, [containerRef, active, onEscape]);\n}\n","/**\n * `<Modal>` — the accessible dialog primitive the checkout flow is built on.\n *\n * Accessibility is STRUCTURAL here (PLAN_2 A3): this is the surface a\n * money-handling modal published to third parties renders into, so it ships\n * with:\n * - `role=\"dialog\"` + `aria-modal=\"true\"` + a labelled title\n * (`aria-labelledby`) and optional description (`aria-describedby`);\n * - a focus trap (initial focus in, Tab cycling, focus restore on close) via\n * {@link useFocusTrap};\n * - Escape-to-close and overlay-click-to-close (both opt-out-able);\n * - a real `<button>` close affordance with an accessible name.\n *\n * SSR-safe: renders nothing while closed; all `document` access is inside the\n * focus-trap effect. No portal is used (a portal needs `document.body`, which\n * SSR lacks) — the dialog renders inline in the React tree behind a fixed\n * overlay, which keeps it hydration-safe. Hosts that need a body portal can\n * wrap it themselves on the client.\n *\n * @module components/Modal\n */\nimport { useId, useRef, type ReactNode } from \"react\";\nimport { tc } from \"./format.js\";\nimport { rootClass, type ThemableProps } from \"./primitives.js\";\nimport { useFocusTrap } from \"./useFocusTrap.js\";\n\n/** Props for {@link Modal}. */\nexport interface ModalProps extends ThemableProps {\n /** Whether the dialog is open. Renders nothing when false. */\n open: boolean;\n /** Called to request a close (Escape, overlay click, close button). */\n onClose: () => void;\n /** The dialog title (becomes the `aria-labelledby` target). */\n title: ReactNode;\n /** Dialog body. */\n children: ReactNode;\n /** Optional footer (actions). */\n footer?: ReactNode;\n /** Disable Escape-to-close (e.g. mid-transaction). Default false. */\n disableEscapeClose?: boolean;\n /** Disable overlay-click-to-close. Default false. */\n disableOverlayClose?: boolean;\n /** Hide the close (X) button (e.g. a forced confirmation step). Default false. */\n hideCloseButton?: boolean;\n /** Accessible label for the close button. */\n closeLabel?: string;\n}\n\n/**\n * An accessible modal dialog.\n */\nexport function Modal({\n open,\n onClose,\n title,\n children,\n footer,\n disableEscapeClose = false,\n disableOverlayClose = false,\n hideCloseButton = false,\n closeLabel,\n unstyled,\n className,\n}: ModalProps): ReactNode {\n const dialogRef = useRef<HTMLDivElement>(null);\n const titleId = useId();\n const bodyId = useId();\n\n useFocusTrap(dialogRef, open, () => {\n if (!disableEscapeClose) onClose();\n });\n\n if (!open) return null;\n\n const overlayClass = rootClass(\"agenc-modal\", unstyled, className);\n\n return (\n <div\n className={overlayClass}\n // The overlay. Clicking it (not the dialog) requests close.\n onMouseDown={(event) => {\n if (disableOverlayClose) return;\n if (event.target === event.currentTarget) onClose();\n }}\n >\n <div\n className={unstyled ? undefined : \"agenc-modal__dialog\"}\n ref={dialogRef}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby={titleId}\n aria-describedby={bodyId}\n tabIndex={-1}\n >\n <header className={unstyled ? undefined : \"agenc-modal__header\"}>\n <h2 id={titleId} className={unstyled ? undefined : \"agenc-modal__title\"}>\n {title}\n </h2>\n {hideCloseButton ? null : (\n <button\n type=\"button\"\n className={unstyled ? undefined : \"agenc-modal__close\"}\n aria-label={closeLabel ?? tc(\"components.common.close\")}\n onClick={onClose}\n >\n <span aria-hidden=\"true\">×</span>\n </button>\n )}\n </header>\n <div id={bodyId} className={unstyled ? undefined : \"agenc-modal__body\"}>\n {children}\n </div>\n {footer ? (\n <footer className={unstyled ? undefined : \"agenc-modal__footer\"}>\n {footer}\n </footer>\n ) : null}\n </div>\n </div>\n );\n}\n","/**\n * `<ListingCard>` — a single service-listing card.\n *\n * Renders the decoded on-chain `ServiceListing` (name, category, price,\n * provider, lifetime hires) plus the moderation attestation badge. It is a\n * PRESENTATIONAL component: it takes already-fetched data (a `ListingRow` from\n * `useListings`, or a `ServiceListing` + address) so it can be used inside a\n * grid, a detail page, or SSR without owning a query.\n *\n * Themable via `--agenc-*`; `unstyled` strips the default classes. Every\n * literal routes through the component catalog.\n *\n * @module components/ListingCard\n */\nimport type { ReactNode } from \"react\";\nimport type { Address, IndexerListing, ServiceListing } from \"../types.js\";\nimport {\n decodeListingCategory,\n decodeListingName,\n formatPriceSol,\n tc,\n truncateAddress,\n} from \"./format.js\";\nimport { ModerationBadge } from \"./badges.js\";\nimport { Badge, Button, rootClass, type ThemableProps } from \"./primitives.js\";\n\n/** A decoded listing the card can render (matches `useListings`' `ListingRow`). */\nexport interface ListingCardData {\n /** The listing PDA. */\n address: Address;\n /** The decoded on-chain account. */\n account: ServiceListing;\n}\n\n/** Props for {@link ListingCard}. */\nexport interface ListingCardProps extends ThemableProps {\n /** The decoded listing to render. */\n listing: ListingCardData;\n /**\n * Optional indexer projection for the moderation badge. When absent the badge\n * shows the honest \"pending\" state (never asserts attestation).\n */\n moderation?: IndexerListing | null;\n /**\n * Click/hire handler. When provided the card renders a hire CTA (use\n * {@link HireButton} for the full flow); when absent the card is display-only.\n */\n onHire?: (listing: ListingCardData) => void;\n /** Optional select handler (e.g. open a detail view) on the card body. */\n onSelect?: (listing: ListingCardData) => void;\n /** Hide the price row (e.g. a teaser card). Default false. */\n hidePrice?: boolean;\n}\n\n/**\n * Render one service listing as a card.\n *\n * @example\n * ```tsx\n * <ListingCard listing={row} moderation={detail.moderation} onHire={open} />\n * ```\n */\nexport function ListingCard({\n listing,\n moderation,\n onHire,\n onSelect,\n hidePrice = false,\n unstyled,\n className,\n}: ListingCardProps): ReactNode {\n const { account } = listing;\n const name = decodeListingName(account) || tc(\"components.listingCard.untitled\");\n const category = decodeListingCategory(account);\n const price = formatPriceSol(account.price);\n const provider = truncateAddress(account.providerAgent);\n const hires = account.totalHires;\n\n const cardClass = rootClass(\"agenc-listing-card\", unstyled, className);\n\n const selectable = Boolean(onSelect);\n const heading = (\n <h3 className={unstyled ? undefined : \"agenc-listing-card__title\"}>{name}</h3>\n );\n\n return (\n <article\n className={cardClass}\n aria-label={name}\n >\n <header className={unstyled ? undefined : \"agenc-listing-card__header\"}>\n {selectable ? (\n <button\n type=\"button\"\n className={\n unstyled ? undefined : \"agenc-listing-card__title-button\"\n }\n onClick={() => onSelect?.(listing)}\n >\n {heading}\n </button>\n ) : (\n heading\n )}\n <ModerationBadge moderation={moderation} unstyled={unstyled} />\n </header>\n\n <dl className={unstyled ? undefined : \"agenc-listing-card__meta\"}>\n {category ? (\n <div className={unstyled ? undefined : \"agenc-listing-card__meta-row\"}>\n <dt>{tc(\"components.listingCard.category\")}</dt>\n <dd>\n <Badge tone=\"info\" unstyled={unstyled}>\n {category}\n </Badge>\n </dd>\n </div>\n ) : null}\n <div className={unstyled ? undefined : \"agenc-listing-card__meta-row\"}>\n <dt>{tc(\"components.listingCard.byProvider\", { provider })}</dt>\n <dd>{tc(\"components.listingCard.hires\", { count: String(hires) })}</dd>\n </div>\n </dl>\n\n <footer className={unstyled ? undefined : \"agenc-listing-card__footer\"}>\n {hidePrice ? null : (\n <p className={unstyled ? undefined : \"agenc-listing-card__price\"}>\n <span className={unstyled ? undefined : \"agenc-listing-card__price-label\"}>\n {tc(\"components.listingCard.priceLabel\")}\n </span>{\" \"}\n <span className={unstyled ? undefined : \"agenc-listing-card__price-value\"}>\n {price}\n </span>\n </p>\n )}\n {onHire ? (\n <Button\n unstyled={unstyled}\n variant=\"primary\"\n onClick={() => onHire(listing)}\n >\n {tc(\"components.hire.cta\")}\n </Button>\n ) : null}\n </footer>\n </article>\n );\n}\n","/**\n * `<ListingGrid>` — a responsive grid of {@link ListingCard}s with the\n * canonical loading / empty / error states.\n *\n * Presentational by design: it takes the `useListings` result fields\n * (`listings`, `isLoading`, `error`, `hasMore`, `fetchMore`) rather than\n * calling the hook itself, so it renders identically under SSR, in Ladle, and\n * against the live transport. A host wires it to `useListings` in one line:\n *\n * ```tsx\n * const q = useListings(filter);\n * <ListingGrid {...q} onLoadMore={q.fetchMore} onHire={open} />\n * ```\n *\n * @module components/ListingGrid\n */\nimport type { ReactNode } from \"react\";\nimport type { IndexerListing } from \"../types.js\";\nimport { tc } from \"./format.js\";\nimport { ListingCard, type ListingCardData } from \"./ListingCard.js\";\nimport { StateMessage, rootClass, type ThemableProps } from \"./primitives.js\";\n\n/** Props for {@link ListingGrid}. */\nexport interface ListingGridProps extends ThemableProps {\n /** The listings to render (typically `useListings().listings`). */\n listings: ListingCardData[];\n /** True while the first load is in flight. Shows the loading state. */\n isLoading?: boolean;\n /** A load error. Shows the error state (with retry when `onRetry` given). */\n error?: Error | null;\n /** Whether more rows can be revealed (shows the \"Load more\" control). */\n hasMore?: boolean;\n /** Reveal the next page (typically `useListings().fetchMore`). */\n onLoadMore?: () => void;\n /** Retry handler for the error state. */\n onRetry?: () => void;\n /** Hire handler forwarded to each card. */\n onHire?: (listing: ListingCardData) => void;\n /** Select handler forwarded to each card. */\n onSelect?: (listing: ListingCardData) => void;\n /**\n * Optional per-listing moderation projections, keyed by listing PDA string,\n * for the moderation badge. Absent entries render the honest \"pending\" badge.\n */\n moderationByPda?: Record<string, IndexerListing | null>;\n /** Override the empty-state message. */\n emptyMessage?: string;\n}\n\n/**\n * A grid of listing cards with loading/empty/error handling.\n */\nexport function ListingGrid({\n listings,\n isLoading = false,\n error = null,\n hasMore = false,\n onLoadMore,\n onRetry,\n onHire,\n onSelect,\n moderationByPda,\n emptyMessage,\n unstyled,\n className,\n}: ListingGridProps): ReactNode {\n const gridClass = rootClass(\"agenc-listing-grid\", unstyled, className);\n\n // Error wins over loading/empty so a failed refetch is never masked.\n if (error) {\n return (\n <div className={gridClass}>\n <StateMessage\n kind=\"error\"\n message={tc(\"components.listingGrid.error\")}\n onRetry={onRetry}\n unstyled={unstyled}\n />\n </div>\n );\n }\n\n if (isLoading && listings.length === 0) {\n return (\n <div className={gridClass}>\n <StateMessage kind=\"loading\" unstyled={unstyled} />\n </div>\n );\n }\n\n if (listings.length === 0) {\n return (\n <div className={gridClass}>\n <StateMessage\n kind=\"empty\"\n message={emptyMessage ?? tc(\"components.listingGrid.empty\")}\n unstyled={unstyled}\n />\n </div>\n );\n }\n\n return (\n <div className={gridClass}>\n <ul\n className={unstyled ? undefined : \"agenc-listing-grid__list\"}\n // The list is a semantic list of cards; each item is a listitem.\n >\n {listings.map((listing) => (\n <li\n key={String(listing.address)}\n className={unstyled ? undefined : \"agenc-listing-grid__item\"}\n >\n <ListingCard\n listing={listing}\n moderation={moderationByPda?.[String(listing.address)] ?? null}\n onHire={onHire}\n onSelect={onSelect}\n unstyled={unstyled}\n />\n </li>\n ))}\n </ul>\n {hasMore && onLoadMore ? (\n <div className={unstyled ? undefined : \"agenc-listing-grid__more\"}>\n <button\n type=\"button\"\n className={unstyled ? undefined : \"agenc-button agenc-button--secondary\"}\n onClick={onLoadMore}\n >\n {tc(\"components.listingGrid.loadMore\")}\n </button>\n </div>\n ) : null}\n </div>\n );\n}\n","/**\n * `<ReferrerDisclosure>` — the \"this site earns a referral fee\" notice.\n *\n * ## THE P6.2 GATE (PLAN_2 §0 / the §0 referrer gate — read before editing)\n *\n * Disclosure is the ONE referrer surface allowed to render while the on-chain\n * referrer leg is not live. It NEVER asserts that a fee was charged: when\n * `live` is false it shows the \"(pending protocol support)\" copy. It is purely\n * informational and reads no earnings. The actual injection / earnings remain\n * blocked on P6.2 (handled by the hooks, not here). This component only\n * DISCLOSES the configured intent.\n *\n * Render it only when a referrer is configured on the provider.\n *\n * @module components/ReferrerDisclosure\n */\nimport type { ReactNode } from \"react\";\nimport type { ValidatedReferrerConfig } from \"../types.js\";\nimport { tc } from \"./format.js\";\nimport { cx, type ThemableProps } from \"./primitives.js\";\n\n/** Props for {@link ReferrerDisclosure}. */\nexport interface ReferrerDisclosureProps extends ThemableProps {\n /** The validated referrer config (from the provider context). */\n referrer: ValidatedReferrerConfig;\n /**\n * Whether the referral fee is actually live on-chain (the P6.2 capability).\n * ALWAYS false today — when false the copy shows the pending-support note and\n * no fee is implied as charged. Defaults to false.\n */\n live?: boolean;\n /** Show the configured fee in bps alongside the disclosure. Default true. */\n showFee?: boolean;\n}\n\n/**\n * Disclose that the embedding site earns a referral fee. Honors the P6.2 gate:\n * shows the pending-support copy until referral settlement is live.\n */\nexport function ReferrerDisclosure({\n referrer,\n live = false,\n showFee = true,\n unstyled,\n className,\n}: ReferrerDisclosureProps): ReactNode {\n const text = live\n ? tc(\"components.referrer.disclosure\")\n : tc(\"components.referrer.disclosurePending\");\n return (\n <p\n className={\n unstyled ? className : cx(\"agenc-referrer-disclosure\", className)\n }\n // Informational, not an alert — a polite, non-interrupting note.\n role=\"note\"\n >\n <span>{text}</span>\n {showFee ? (\n <span className={unstyled ? undefined : \"agenc-referrer-disclosure__fee\"}>\n {\" \"}\n {tc(\"components.referrer.feeBps\", { bps: String(referrer.feeBps) })}\n </span>\n ) : null}\n </p>\n );\n}\n","/**\n * `<HireCheckoutModal>` — the embeddable money path (PLAN_2 A3).\n *\n * The accessible, themable checkout dialog: it shows the price, the moderation\n * attestation badge, the escrow-funding explanation, the referrer disclosure\n * (P6.2-gated), and walks the buyer through idle → confirming → funded /\n * error confirmation states.\n *\n * ## Accessibility (STRUCTURAL — this is published to third parties)\n *\n * Built on the accessible {@link Modal}: focus trap, Escape/overlay close\n * (auto-disabled while a hire is in flight so the buyer can't dismiss a pending\n * transaction), ARIA dialog roles, and live-region status announcements for\n * the confirming/funded/error transitions.\n *\n * ## The P6.2 referrer gate\n *\n * The disclosure renders when a `referrer` is configured, with the pending-\n * support copy until `referrerLive` is true (always false today). The modal\n * NEVER computes or claims a fee was charged — it discloses configured intent\n * only. Injection/earnings stay in the hooks, blocked on P6.2.\n *\n * ## Wiring\n *\n * Presentational by design: a host maps `useHire()` onto the props\n * (`status`/`error`/`taskPda`/`onConfirm`). The connected\n * {@link HireButton} shows the canonical wiring.\n *\n * @module components/HireCheckoutModal\n */\nimport { useCallback, useEffect, useRef, useState, type ReactNode } from \"react\";\nimport type {\n Address,\n IndexerListing,\n ServiceListing,\n ValidatedReferrerConfig,\n} from \"../types.js\";\nimport type { HireStatus } from \"../hooks/useHire.js\";\nimport { formatPriceSol, tc } from \"./format.js\";\nimport { ModerationBadge } from \"./badges.js\";\nimport { Modal } from \"./Modal.js\";\nimport { ReferrerDisclosure } from \"./ReferrerDisclosure.js\";\nimport { Button } from \"./primitives.js\";\n\n/** The listing being hired (decoded account + address). */\nexport interface HireCheckoutListing {\n /** The listing PDA. */\n address: Address;\n /** The decoded on-chain account (for price + name). */\n account: ServiceListing;\n}\n\n/** Props for {@link HireCheckoutModal}. */\nexport interface HireCheckoutModalProps {\n /** Whether the modal is open. */\n open: boolean;\n /** Close request handler. */\n onClose: () => void;\n /** The listing under checkout. */\n listing: HireCheckoutListing;\n /**\n * Confirm handler — runs the actual hire (e.g. `() => hire({...})`). Resolves\n * when the hire settles; rejects with the typed `AgencError` to surface.\n */\n onConfirm: () => void | Promise<void>;\n /** Current hire status (map from `useHire().status`). Default \"idle\". */\n status?: HireStatus;\n /** The hire error to surface (map from `useHire().error`). */\n error?: Error | null;\n /** The minted Task PDA on success (map from `useHire().taskPda`). */\n taskPda?: Address | null;\n /** Optional handler when the buyer clicks \"View task\" after success. */\n onViewTask?: (taskPda: Address) => void;\n /** Indexer projection for the moderation badge. */\n moderation?: IndexerListing | null;\n /**\n * Configured referrer (from provider context). When present the disclosure\n * renders. Pass `null`/omit when no referrer is configured.\n */\n referrer?: ValidatedReferrerConfig | null;\n /**\n * Whether referral settlement is live (P6.2). Always false today. Drives the\n * disclosure copy only; never implies a fee was charged.\n */\n referrerLive?: boolean;\n /** Whether a signer/wallet is connected (gates the confirm button). */\n connected?: boolean;\n /** White-label mode. */\n unstyled?: boolean;\n /** Extra root class. */\n className?: string;\n}\n\n/**\n * The hire checkout dialog.\n */\nexport function HireCheckoutModal({\n open,\n onClose,\n listing,\n onConfirm,\n status = \"idle\",\n error = null,\n taskPda = null,\n onViewTask,\n moderation,\n referrer,\n referrerLive = false,\n connected = true,\n unstyled,\n className,\n}: HireCheckoutModalProps): ReactNode {\n const pending = status === \"pending\";\n const success = status === \"success\";\n const price = formatPriceSol(listing.account.price);\n\n // SYNCHRONOUS double-submit guard. The parent-controlled `status` prop does\n // NOT flip to \"pending\" within the same tick as the click, so two fast\n // clicks would otherwise fire `onConfirm` (a funded hire) twice. We latch\n // locally the instant the button is clicked — before awaiting — and clear it\n // only when the hire settles (resolve/reject), the modal closes, or the\n // parent reaches a terminal status. This is independent of `status` so the\n // first click immediately disables the button.\n const [submitting, setSubmitting] = useState(false);\n // A ref mirror so the click handler reads/sets the latch synchronously\n // (state updates are async; a second click in the same tick must see it set).\n const submittingRef = useRef(false);\n\n // Clear the latch when the modal closes so a re-open starts clean, and when\n // the parent settles to a terminal status (success/error/idle, i.e. not\n // pending) so a retry after an error is allowed. The local latch (set\n // synchronously on click) only needs to outlive the gap before the parent's\n // `status` flips to pending; once it has settled the parent drives the gate.\n useEffect(() => {\n if (!open || !pending) {\n submittingRef.current = false;\n setSubmitting(false);\n }\n }, [open, pending]);\n\n const handleConfirm = useCallback(() => {\n // Already in flight (sync ref check) — drop the duplicate click.\n if (submittingRef.current) return;\n submittingRef.current = true;\n setSubmitting(true);\n let result: void | Promise<void>;\n try {\n result = onConfirm();\n } catch {\n // Synchronous throw: release the latch so the buyer can retry.\n submittingRef.current = false;\n setSubmitting(false);\n return;\n }\n if (result && typeof (result as Promise<void>).then === \"function\") {\n void (result as Promise<void>).finally(() => {\n submittingRef.current = false;\n setSubmitting(false);\n });\n }\n // For a synchronous (void) onConfirm the parent drives `status`; the effect\n // above clears the latch when it reaches a terminal/closed state.\n }, [onConfirm]);\n\n // The button is disabled the instant a submit is in flight (local latch) OR\n // the parent reports pending — whichever fires first.\n const confirmDisabled = !connected || pending || submitting;\n\n // While a hire is in flight, lock the dialog so the buyer cannot dismiss a\n // pending on-chain transaction by mistake.\n const lockClose = pending || submitting;\n\n const footer = success ? (\n <>\n {taskPda && onViewTask ? (\n <Button\n unstyled={unstyled}\n variant=\"primary\"\n onClick={() => onViewTask(taskPda)}\n >\n {tc(\"components.hire.viewTask\")}\n </Button>\n ) : null}\n <Button unstyled={unstyled} variant=\"secondary\" onClick={onClose}>\n {tc(\"components.common.close\")}\n </Button>\n </>\n ) : (\n <>\n <Button\n unstyled={unstyled}\n variant=\"secondary\"\n onClick={onClose}\n disabled={pending || submitting}\n >\n {tc(\"components.hire.cancel\")}\n </Button>\n <Button\n unstyled={unstyled}\n variant=\"primary\"\n loading={pending || submitting}\n disabled={confirmDisabled}\n onClick={handleConfirm}\n >\n {pending || submitting\n ? tc(\"components.hire.pending\")\n : tc(\"components.hire.confirm\")}\n </Button>\n </>\n );\n\n return (\n <Modal\n open={open}\n onClose={onClose}\n title={tc(\"components.hire.checkoutTitle\")}\n footer={footer}\n disableEscapeClose={lockClose}\n disableOverlayClose={lockClose}\n hideCloseButton={lockClose}\n unstyled={unstyled}\n className={className}\n >\n <div className={unstyled ? undefined : \"agenc-checkout\"}>\n <div className={unstyled ? undefined : \"agenc-checkout__row\"}>\n <span className={unstyled ? undefined : \"agenc-checkout__price-label\"}>\n {tc(\"components.hire.priceLabel\")}\n </span>\n <span className={unstyled ? undefined : \"agenc-checkout__price\"}>\n {price}\n </span>\n </div>\n\n <div className={unstyled ? undefined : \"agenc-checkout__moderation\"}>\n <ModerationBadge moderation={moderation} unstyled={unstyled} />\n </div>\n\n <p className={unstyled ? undefined : \"agenc-checkout__escrow-note\"}>\n {tc(\"components.hire.escrowNote\")}\n </p>\n\n {referrer ? (\n <ReferrerDisclosure\n referrer={referrer}\n live={referrerLive}\n unstyled={unstyled}\n />\n ) : null}\n\n {/* Live-region status: announces confirming / funded / error. */}\n <div\n className={unstyled ? undefined : \"agenc-checkout__status\"}\n role=\"status\"\n aria-live=\"polite\"\n >\n {pending ? tc(\"components.hire.pending\") : null}\n {success ? (\n <>\n <strong>{tc(\"components.hire.success\")}</strong>{\" \"}\n {tc(\"components.hire.successDetail\")}\n </>\n ) : null}\n </div>\n\n {error ? (\n <div\n className={unstyled ? undefined : \"agenc-checkout__error\"}\n role=\"alert\"\n aria-live=\"assertive\"\n >\n <strong>{tc(\"components.hire.errorTitle\")}</strong>\n <span>{error.message}</span>\n </div>\n ) : null}\n\n {!connected && !success ? (\n <p className={unstyled ? undefined : \"agenc-checkout__hint\"}>\n {tc(\"components.hire.notConnected\")}\n </p>\n ) : null}\n </div>\n </Modal>\n );\n}\n","/**\n * `<HireButton>` — the connected, drop-in hire entry point.\n *\n * This is the one component that binds the hooks directly: it renders a price-\n * aware CTA that opens {@link HireCheckoutModal}, drives the hire through\n * `useHire()`, resolves the signer via `useWalletSigner()`, and threads the\n * provider's configured referrer + the P6.2 capability into the modal's\n * disclosure (never injecting a fee — the gate lives in `useHire`).\n *\n * ## Why the caller supplies the hire input\n *\n * A hire needs caller-specific fields the listing alone can't provide\n * (`creatorAgent` — the BUYER's registered agent PDA, or the humanless flag —\n * and a fresh `taskId`). So `HireButton` takes a `buildHireInput(listing)`\n * factory rather than guessing them. The compare-and-swap guards\n * (`expectedPrice`/`expectedVersion`/`listingSpecHash`) are derived from the\n * decoded listing by default and can be overridden in the returned input.\n *\n * @module components/HireButton\n */\nimport { useCallback, useRef, useState, type ReactNode } from \"react\";\nimport { useAgencContext } from \"../provider/context.js\";\nimport { useHire, type AnyHireInput } from \"../hooks/useHire.js\";\nimport { useWalletSigner } from \"../hooks/useWalletSigner.js\";\nimport type { Address } from \"../types.js\";\nimport { formatPriceSol, tc } from \"./format.js\";\nimport {\n HireCheckoutModal,\n type HireCheckoutListing,\n} from \"./HireCheckoutModal.js\";\nimport { Button, type ThemableProps } from \"./primitives.js\";\n\n/** Props for {@link HireButton}. */\nexport interface HireButtonProps extends ThemableProps {\n /** The listing to hire (decoded account + address). */\n listing: HireCheckoutListing;\n /**\n * Build the per-hire input from the listing. Must return at least\n * `creatorAgent` (standard hire) or `{ humanless: true }` plus a fresh\n * `taskId` and the compare-and-swap guards. `listing` and the signer default\n * to context. See `useHire` for the full input shape.\n */\n buildHireInput: (listing: HireCheckoutListing) => AnyHireInput;\n /** Called after a successful hire with the minted Task PDA. */\n onHired?: (taskPda: Address) => void;\n /** Called when the buyer clicks \"View task\" on the success screen. */\n onViewTask?: (taskPda: Address) => void;\n /** Show the price in the button label (`Hire — 1.5 SOL`). Default true. */\n showPriceInLabel?: boolean;\n /** Override the button label. */\n label?: string;\n}\n\n/**\n * A connected hire button + checkout modal.\n *\n * @example\n * ```tsx\n * <HireButton\n * listing={row}\n * buildHireInput={(l) => ({\n * listing: l.address,\n * creatorAgent: myAgentPda,\n * taskId: randomId32(),\n * expectedPrice: l.account.price,\n * expectedVersion: l.account.version,\n * })}\n * onHired={(task) => router.push(`/tasks/${task}`)}\n * />\n * ```\n */\nexport function HireButton({\n listing,\n buildHireInput,\n onHired,\n onViewTask,\n showPriceInLabel = true,\n label,\n unstyled,\n className,\n}: HireButtonProps): ReactNode {\n const ctx = useAgencContext();\n const { hire, status, error, taskPda, reset } = useHire();\n const { connected } = useWalletSigner();\n const [open, setOpen] = useState(false);\n // SYNCHRONOUS in-flight latch (defense-in-depth alongside the modal's own\n // latch): the `useHire` mutation's `status` does NOT flip to \"pending\" within\n // the same tick, and `mutateAsync` does NOT dedupe concurrent calls — so a\n // fast double-invoke of `confirm` would fire two funded hires with fresh\n // taskIds (two escrows / double charge). The ref guards against re-entrancy\n // before the first `hire(...)` promise settles.\n const inFlightRef = useRef(false);\n\n const capability = ctx.resolveReferrerCapability();\n\n const close = useCallback(() => {\n setOpen(false);\n inFlightRef.current = false;\n // Reset the mutation so re-opening starts clean (idle), not stuck on a\n // prior success/error.\n reset();\n }, [reset]);\n\n const confirm = useCallback(async () => {\n // Drop a duplicate confirm while the first hire is still in flight.\n if (inFlightRef.current) return;\n inFlightRef.current = true;\n try {\n const input = buildHireInput(listing);\n const result = await hire(input);\n onHired?.(result.taskPda);\n } finally {\n inFlightRef.current = false;\n }\n }, [buildHireInput, hire, listing, onHired]);\n\n const buttonLabel =\n label ??\n (showPriceInLabel\n ? tc(\"components.hire.ctaPrice\", {\n price: formatPriceSol(listing.account.price),\n })\n : tc(\"components.hire.cta\"));\n\n return (\n <>\n <Button\n unstyled={unstyled}\n className={className}\n variant=\"primary\"\n onClick={() => setOpen(true)}\n >\n {buttonLabel}\n </Button>\n <HireCheckoutModal\n open={open}\n onClose={close}\n listing={listing}\n onConfirm={confirm}\n status={status}\n error={error}\n taskPda={taskPda}\n onViewTask={onViewTask}\n referrer={ctx.referrer}\n referrerLive={capability.live}\n connected={connected}\n unstyled={unstyled}\n />\n </>\n );\n}\n","/**\n * `<TaskTimeline>` — the lifecycle progress of a hired task.\n *\n * Renders the canonical happy-path stages (Open → In progress → Pending review\n * → Completed) as an ordered, accessible list with the current stage marked,\n * and surfaces the terminal off-path states (Cancelled / Disputed / Rejected-\n * frozen) when reached. Presentational: it takes a `TaskStatus | null` (from\n * `useTaskStatus().status`) plus loading/error, so it renders under SSR and in\n * Ladle without owning a reader.\n *\n * @module components/TaskTimeline\n */\nimport type { ReactNode } from \"react\";\nimport { TaskStatus } from \"@tetsuo-ai/marketplace-sdk\";\nimport { tc } from \"./format.js\";\nimport { StateMessage, cx, rootClass, type ThemableProps } from \"./primitives.js\";\n\n/** Props for {@link TaskTimeline}. */\nexport interface TaskTimelineProps extends ThemableProps {\n /** The current task status (from `useTaskStatus().status`). */\n status: TaskStatus | null;\n /** True while loading the status. */\n isLoading?: boolean;\n /** A read error. */\n error?: Error | null;\n /** Retry handler for the error state. */\n onRetry?: () => void;\n}\n\n/** The happy-path stages in order. */\nconst HAPPY_PATH: ReadonlyArray<{ status: TaskStatus; stringId: string }> = [\n { status: TaskStatus.Open, stringId: \"components.taskTimeline.status.Open\" },\n {\n status: TaskStatus.InProgress,\n stringId: \"components.taskTimeline.status.InProgress\",\n },\n {\n status: TaskStatus.PendingValidation,\n stringId: \"components.taskTimeline.status.PendingValidation\",\n },\n {\n status: TaskStatus.Completed,\n stringId: \"components.taskTimeline.status.Completed\",\n },\n];\n\n/** Off-path terminal statuses + their tone class suffix. */\nconst OFF_PATH: Partial<Record<TaskStatus, { stringId: string; tone: string }>> =\n {\n [TaskStatus.Cancelled]: {\n stringId: \"components.taskTimeline.status.Cancelled\",\n tone: \"cancelled\",\n },\n [TaskStatus.Disputed]: {\n stringId: \"components.taskTimeline.status.Disputed\",\n tone: \"disputed\",\n },\n [TaskStatus.RejectFrozen]: {\n stringId: \"components.taskTimeline.status.RejectFrozen\",\n tone: \"rejected\",\n },\n };\n\n/** The index of `status` within the happy path, or -1. */\nfunction happyIndex(status: TaskStatus): number {\n return HAPPY_PATH.findIndex((s) => s.status === status);\n}\n\n/**\n * Render a task's lifecycle progress.\n */\nexport function TaskTimeline({\n status,\n isLoading = false,\n error = null,\n onRetry,\n unstyled,\n className,\n}: TaskTimelineProps): ReactNode {\n const timelineClass = rootClass(\"agenc-timeline\", unstyled, className);\n\n if (error) {\n return (\n <div className={timelineClass}>\n <StateMessage kind=\"error\" onRetry={onRetry} unstyled={unstyled} />\n </div>\n );\n }\n if (isLoading && status === null) {\n return (\n <div className={timelineClass}>\n <StateMessage kind=\"loading\" unstyled={unstyled} />\n </div>\n );\n }\n if (status === null) {\n return (\n <div className={timelineClass}>\n <StateMessage\n kind=\"empty\"\n message={tc(\"components.taskTimeline.empty\")}\n unstyled={unstyled}\n />\n </div>\n );\n }\n\n const offPath = OFF_PATH[status];\n const currentIndex = offPath ? -1 : happyIndex(status);\n\n return (\n <div className={timelineClass} aria-label={tc(\"components.taskTimeline.title\")}>\n <ol className={unstyled ? undefined : \"agenc-timeline__list\"}>\n {HAPPY_PATH.map((stage, index) => {\n const done = currentIndex > index;\n const current = currentIndex === index;\n const state = done ? \"done\" : current ? \"current\" : \"upcoming\";\n return (\n <li\n key={stage.status}\n className={\n unstyled\n ? undefined\n : cx(\"agenc-timeline__step\", `agenc-timeline__step--${state}`)\n }\n aria-current={current ? \"step\" : undefined}\n >\n <span\n className={unstyled ? undefined : \"agenc-timeline__marker\"}\n aria-hidden=\"true\"\n />\n <span className={unstyled ? undefined : \"agenc-timeline__label\"}>\n {tc(stage.stringId)}\n </span>\n </li>\n );\n })}\n </ol>\n {offPath ? (\n <p\n className={\n unstyled\n ? undefined\n : cx(\n \"agenc-timeline__terminal\",\n `agenc-timeline__terminal--${offPath.tone}`,\n )\n }\n role=\"status\"\n >\n {tc(offPath.stringId)}\n </p>\n ) : null}\n </div>\n );\n}\n","/**\n * `<ReviewPanel>` — buyer-side settlement actions (accept / reject / request\n * changes) for a submitted task.\n *\n * Presentational: it takes the three action handlers and a status/error (map\n * from `useSubmissionReview()`), plus a `hasSubmission` flag that gates the\n * actions until the worker has submitted. Each action is a real, keyboard-\n * accessible button; the panel announces the settled outcome in a live region.\n *\n * The destructive verbs (reject, request changes) are visually distinguished\n * but never hidden behind a confirm of their own — the host decides whether to\n * wrap them; the panel keeps them clearly labelled and reversible-where-the-\n * protocol-allows (request changes returns the task to the worker).\n *\n * @module components/ReviewPanel\n */\nimport type { ReactNode } from \"react\";\nimport type { ReviewStatus } from \"../hooks/useSubmissionReview.js\";\nimport { tc } from \"./format.js\";\nimport {\n Button,\n StateMessage,\n rootClass,\n type ThemableProps,\n} from \"./primitives.js\";\n\n/** Props for {@link ReviewPanel}. */\nexport interface ReviewPanelProps extends ThemableProps {\n /** Whether the worker has submitted a result to review. */\n hasSubmission?: boolean;\n /** Accept handler (`useSubmissionReview().accept`-bound by the host). */\n onAccept?: () => void;\n /** Reject handler. */\n onReject?: () => void;\n /** Request-changes handler. */\n onRequestChanges?: () => void;\n /** Current action status (from `useSubmissionReview().status`). */\n status?: ReviewStatus;\n /** The action error to surface. */\n error?: Error | null;\n /**\n * Which verb most recently settled, for the success copy. Optional; when\n * given and `status === \"success\"` the matching message renders.\n */\n settledAction?: \"accept\" | \"reject\" | \"requestChanges\";\n}\n\nconst SUCCESS_STRING: Record<\n NonNullable<ReviewPanelProps[\"settledAction\"]>,\n string\n> = {\n accept: \"components.review.accepted\",\n reject: \"components.review.rejected\",\n requestChanges: \"components.review.changesRequested\",\n};\n\n/**\n * The accept / reject / request-changes review panel.\n */\nexport function ReviewPanel({\n hasSubmission = false,\n onAccept,\n onReject,\n onRequestChanges,\n status = \"idle\",\n error = null,\n settledAction,\n unstyled,\n className,\n}: ReviewPanelProps): ReactNode {\n const panelClass = rootClass(\"agenc-review\", unstyled, className);\n const pending = status === \"pending\";\n const success = status === \"success\";\n\n return (\n <section\n className={panelClass}\n aria-label={tc(\"components.review.title\")}\n >\n <h3 className={unstyled ? undefined : \"agenc-review__title\"}>\n {tc(\"components.review.title\")}\n </h3>\n\n {!hasSubmission ? (\n <StateMessage\n kind=\"empty\"\n message={tc(\"components.review.noSubmission\")}\n unstyled={unstyled}\n />\n ) : (\n <div className={unstyled ? undefined : \"agenc-review__actions\"}>\n <Button\n unstyled={unstyled}\n variant=\"primary\"\n loading={pending}\n disabled={pending || !onAccept}\n onClick={onAccept}\n >\n {tc(\"components.review.accept\")}\n </Button>\n <Button\n unstyled={unstyled}\n variant=\"secondary\"\n disabled={pending || !onRequestChanges}\n onClick={onRequestChanges}\n >\n {tc(\"components.review.requestChanges\")}\n </Button>\n <Button\n unstyled={unstyled}\n variant=\"danger\"\n disabled={pending || !onReject}\n onClick={onReject}\n >\n {tc(\"components.review.reject\")}\n </Button>\n </div>\n )}\n\n <div\n className={unstyled ? undefined : \"agenc-review__status\"}\n role=\"status\"\n aria-live=\"polite\"\n >\n {pending ? tc(\"components.review.pending\") : null}\n {success && settledAction ? tc(SUCCESS_STRING[settledAction]) : null}\n </div>\n\n {error ? (\n <div\n className={unstyled ? undefined : \"agenc-review__error\"}\n role=\"alert\"\n aria-live=\"assertive\"\n >\n <strong>{tc(\"components.review.errorTitle\")}</strong>\n <span>{error.message}</span>\n </div>\n ) : null}\n </section>\n );\n}\n","/**\n * `<DisputeBanner>` — surfaces a task's dispute state + the entry point to open\n * one.\n *\n * Two modes, driven by `disputeOpen`:\n * - OPEN: a prominent `role=\"alert\"` banner explaining funds stay in escrow\n * until a protocol resolver decides (matches the assignable single-resolver\n * model — no voting copy);\n * - NONE: an optional \"Open a dispute\" affordance (rendered only when\n * `onInitiate` is provided), with pending/opened/error states.\n *\n * Presentational: it takes `disputeOpen` + the initiate handler/status/error\n * (map from `useDispute()`), so it renders under SSR and in Ladle.\n *\n * @module components/DisputeBanner\n */\nimport type { ReactNode } from \"react\";\nimport type { DisputeStatus } from \"../hooks/useDispute.js\";\nimport { tc } from \"./format.js\";\nimport { Button, cx, rootClass, type ThemableProps } from \"./primitives.js\";\n\n/** Props for {@link DisputeBanner}. */\nexport interface DisputeBannerProps extends ThemableProps {\n /** Whether a dispute is currently open on the task. */\n disputeOpen?: boolean;\n /**\n * Open-a-dispute handler (`useDispute().initiate`-bound by the host). When\n * omitted, the no-dispute state renders informationally with no action.\n */\n onInitiate?: () => void;\n /** Initiate-mutation status (from `useDispute().status`). */\n status?: DisputeStatus;\n /** The initiate error to surface. */\n error?: Error | null;\n}\n\n/**\n * The dispute banner / entry point.\n */\nexport function DisputeBanner({\n disputeOpen = false,\n onInitiate,\n status = \"idle\",\n error = null,\n unstyled,\n className,\n}: DisputeBannerProps): ReactNode {\n const bannerClass = rootClass(\n cx(\n \"agenc-dispute\",\n disputeOpen ? \"agenc-dispute--open\" : \"agenc-dispute--none\",\n ),\n unstyled,\n className,\n );\n const pending = status === \"pending\";\n const opened = status === \"success\";\n\n if (disputeOpen) {\n return (\n <div className={bannerClass} role=\"alert\">\n <strong className={unstyled ? undefined : \"agenc-dispute__title\"}>\n {tc(\"components.dispute.title\")}\n </strong>\n <p className={unstyled ? undefined : \"agenc-dispute__body\"}>\n {tc(\"components.dispute.body\")}\n </p>\n </div>\n );\n }\n\n // No open dispute. Render the action only when a handler is provided.\n return (\n <div className={bannerClass} role=\"region\" aria-label={tc(\"components.dispute.none\")}>\n <p className={unstyled ? undefined : \"agenc-dispute__none\"}>\n {tc(\"components.dispute.none\")}\n </p>\n {onInitiate ? (\n <Button\n unstyled={unstyled}\n variant=\"secondary\"\n loading={pending}\n disabled={pending}\n onClick={onInitiate}\n >\n {pending\n ? tc(\"components.dispute.pending\")\n : tc(\"components.dispute.initiate\")}\n </Button>\n ) : null}\n <div\n className={unstyled ? undefined : \"agenc-dispute__status\"}\n role=\"status\"\n aria-live=\"polite\"\n >\n {opened ? tc(\"components.dispute.opened\") : null}\n </div>\n {error ? (\n <div\n className={unstyled ? undefined : \"agenc-dispute__error\"}\n role=\"alert\"\n aria-live=\"assertive\"\n >\n <strong>{tc(\"components.dispute.errorTitle\")}</strong>\n <span>{error.message}</span>\n </div>\n ) : null}\n </div>\n );\n}\n","/**\n * `<ProviderCard>` — a provider's reputation summary.\n *\n * Renders the agent's track record (completion rate, dispute rate, completions,\n * dispute count, slash history count) plus a verified badge. Presentational: it\n * takes the projected `AgentTrackRecord | null` (from\n * `useAgentTrackRecord().trackRecord`) + loading/error, so it renders under SSR\n * and in Ladle.\n *\n * ## P6.6 honesty\n *\n * Rates are PROVISIONAL until P6.6 supplies true denominators. When the\n * `partial` flag is set the card marks the rates \"(provisional)\"; a `null` rate\n * renders as \"—\" (no denominator), never as a fabricated 0% or 100%.\n *\n * @module components/ProviderCard\n */\nimport type { ReactNode } from \"react\";\nimport type { AgentTrackRecord } from \"../hooks/useAgentTrackRecord.js\";\nimport type { Address } from \"../types.js\";\nimport { formatRate, tc, truncateAddress } from \"./format.js\";\nimport { VerifiedBadge } from \"./badges.js\";\nimport { StateMessage, rootClass, type ThemableProps } from \"./primitives.js\";\n\n/** Props for {@link ProviderCard}. */\nexport interface ProviderCardProps extends ThemableProps {\n /** The provider's agent PDA (for the heading). */\n agent?: Address | string | null;\n /** The projected track record (from `useAgentTrackRecord().trackRecord`). */\n trackRecord: AgentTrackRecord | null;\n /** Whether the provider is verified (shows the verified badge). */\n verified?: boolean;\n /** True while loading the track record. */\n isLoading?: boolean;\n /**\n * A read error. Under the gPA fallback the track record is unsupported; the\n * card shows the \"unavailable on this transport\" copy for that case.\n */\n error?: Error | null;\n /** Retry handler for the error state. */\n onRetry?: () => void;\n}\n\n/**\n * Render a provider reputation card.\n */\nexport function ProviderCard({\n agent,\n trackRecord,\n verified = false,\n isLoading = false,\n error = null,\n onRetry,\n unstyled,\n className,\n}: ProviderCardProps): ReactNode {\n const cardClass = rootClass(\"agenc-provider\", unstyled, className);\n\n const header = (\n <header className={unstyled ? undefined : \"agenc-provider__header\"}>\n <div className={unstyled ? undefined : \"agenc-provider__id\"}>\n <span className={unstyled ? undefined : \"agenc-provider__label\"}>\n {tc(\"components.provider.title\")}\n </span>\n {agent ? (\n <span className={unstyled ? undefined : \"agenc-provider__pda\"}>\n {truncateAddress(agent)}\n </span>\n ) : null}\n </div>\n <VerifiedBadge verified={verified} unstyled={unstyled} />\n </header>\n );\n\n if (error) {\n return (\n <section className={cardClass} aria-label={tc(\"components.provider.title\")}>\n {header}\n <StateMessage\n kind=\"error\"\n message={tc(\"components.provider.unavailable\")}\n onRetry={onRetry}\n unstyled={unstyled}\n />\n </section>\n );\n }\n\n if (isLoading && trackRecord === null) {\n return (\n <section className={cardClass} aria-label={tc(\"components.provider.title\")}>\n {header}\n <StateMessage kind=\"loading\" unstyled={unstyled} />\n </section>\n );\n }\n\n if (trackRecord === null) {\n return (\n <section className={cardClass} aria-label={tc(\"components.provider.title\")}>\n {header}\n <StateMessage\n kind=\"empty\"\n message={tc(\"components.provider.noData\")}\n unstyled={unstyled}\n />\n </section>\n );\n }\n\n const provisional = trackRecord.partial;\n\n return (\n <section className={cardClass} aria-label={tc(\"components.provider.title\")}>\n {header}\n <dl className={unstyled ? undefined : \"agenc-provider__stats\"}>\n <div className={unstyled ? undefined : \"agenc-provider__stat\"}>\n <dt>{tc(\"components.provider.completionRate\")}</dt>\n <dd>\n {formatRate(trackRecord.completionRate)}\n {provisional ? (\n <span className={unstyled ? undefined : \"agenc-provider__provisional\"}>\n {\" \"}\n ({tc(\"components.provider.provisional\")})\n </span>\n ) : null}\n </dd>\n </div>\n <div className={unstyled ? undefined : \"agenc-provider__stat\"}>\n <dt>{tc(\"components.provider.disputeRate\")}</dt>\n <dd>\n {formatRate(trackRecord.disputeRate)}\n {provisional ? (\n <span className={unstyled ? undefined : \"agenc-provider__provisional\"}>\n {\" \"}\n ({tc(\"components.provider.provisional\")})\n </span>\n ) : null}\n </dd>\n </div>\n <div className={unstyled ? undefined : \"agenc-provider__stat\"}>\n <dt>{tc(\"components.provider.completions\", {\n count: String(trackRecord.completions),\n })}</dt>\n <dd>\n {tc(\"components.provider.disputes\", {\n count: String(trackRecord.disputesLost),\n })}\n </dd>\n </div>\n </dl>\n </section>\n );\n}\n","/**\n * `<PoweredByAgenC>` — an optional attribution badge linking a trust page.\n *\n * A small, themable \"Powered by AgenC\" mark embedders can drop into a\n * storefront footer / checkout to link buyers to an explanation of the escrow +\n * moderation trust stack. Optional and fully white-labelable.\n *\n * SSR-safe; the link is a plain anchor (`rel=\"noopener noreferrer\"` for safety\n * when it opens in a new tab). The `href` is scheme-validated (http/https/\n * mailto only; `javascript:`/`data:` fall back to the default trust href) so an\n * embedder wiring untrusted data into the prop cannot create a click-to-execute\n * XSS on a money surface.\n *\n * @module components/PoweredByAgenC\n */\nimport type { ReactNode } from \"react\";\nimport { tc } from \"./format.js\";\nimport { rootClass, type ThemableProps } from \"./primitives.js\";\n\n/** The default trust page the badge links to. */\nexport const DEFAULT_TRUST_HREF = \"https://agenc.tech/trust\";\n\n/** Schemes a trust link may safely use. Anything else (e.g. `javascript:`,\n * `data:`) is rejected and falls back to {@link DEFAULT_TRUST_HREF}. */\nconst SAFE_HREF_SCHEMES = new Set([\"http:\", \"https:\", \"mailto:\"]);\n\n/**\n * Validate an embedder-supplied href. React does NOT block `javascript:` (or\n * `data:`) in an anchor href, so an embedder wiring untrusted data here would\n * create a click-to-execute XSS. Allow only http/https/mailto; fall back to the\n * safe default trust href otherwise. Scheme-relative (`//host`) and\n * path/relative URLs resolve against a dummy base and keep their (http/https)\n * scheme; anything that fails to parse falls back too.\n */\nfunction safeHref(href: string): string {\n try {\n // Resolve against a base so relative/scheme-relative hrefs parse and adopt\n // a concrete (https) scheme rather than being rejected.\n const url = new URL(href, DEFAULT_TRUST_HREF);\n return SAFE_HREF_SCHEMES.has(url.protocol) ? href : DEFAULT_TRUST_HREF;\n } catch {\n return DEFAULT_TRUST_HREF;\n }\n}\n\n/** Props for {@link PoweredByAgenC}. */\nexport interface PoweredByAgenCProps extends ThemableProps {\n /** Trust-page URL. Defaults to {@link DEFAULT_TRUST_HREF}. */\n href?: string;\n /** Open the link in a new tab. Default true. */\n newTab?: boolean;\n /** Override the visible label. */\n label?: string;\n}\n\n/**\n * The \"Powered by AgenC\" attribution mark.\n */\nexport function PoweredByAgenC({\n href = DEFAULT_TRUST_HREF,\n newTab = true,\n label,\n unstyled,\n className,\n}: PoweredByAgenCProps): ReactNode {\n const linkClass = rootClass(\"agenc-powered-by\", unstyled, className);\n return (\n <a\n className={linkClass}\n href={safeHref(href)}\n target={newTab ? \"_blank\" : undefined}\n // noopener + noreferrer for new-tab links (defense-in-depth against\n // reverse-tabnabbing; noreferrer implies noopener in modern browsers).\n rel={newTab ? \"noopener noreferrer\" : undefined}\n // The link's accessible name combines the brand + the trust-link copy.\n aria-label={`${label ?? tc(\"components.poweredBy.label\")} — ${tc(\n \"components.poweredBy.trustLink\",\n )}`}\n >\n <span className={unstyled ? undefined : \"agenc-powered-by__label\"}>\n {label ?? tc(\"components.poweredBy.label\")}\n </span>\n </a>\n );\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/provider/context.ts","../src/hooks/internal.ts","../src/hooks/useHire.ts","../src/hooks/useWalletSigner.ts"],"names":["useCallback"],"mappings":";;;;;AAkBO,IAAM,YAAA,GAAe,cAAwC,IAAI;AACxE,YAAA,CAAa,WAAA,GAAc,cAAA;AASpB,SAAS,eAAA,GAAqC;AACnD,EAAA,MAAM,GAAA,GAAM,WAAW,YAAY,CAAA;AACnC,EAAA,IAAI,QAAQ,IAAA,EAAM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AAO,SAAA;AAC/B,IAAA,IAAI,QAAA,CAAS,SAAS,OAAO,OAAA;AAC7B,IAAA,IAAI,QAAA,CAAS,WAAW,OAAO,SAAA;AAC/B,IAAA,OAAO,MAAA;AAAA,EACT,CAAA,EAAG,CAAC,QAAA,CAAS,SAAA,EAAW,SAAS,OAAA,EAAS,QAAA,CAAS,SAAS,CAAC,CAAA;AAE7D,EAAA,OAAO;AAAA,IACL,IAAA;AAAA,IACA,MAAA;AAAA,IACA,OAAA,EAAS,QAAA,CAAS,IAAA,EAAM,OAAA,IAAW,IAAA;AAAA,IACnC,SAAA,EAAW,QAAA,CAAS,IAAA,EAAM,SAAA,IAAa,IAAA;AAAA,IACvC,KAAA,EAAO,SAAS,KAAA,IAAS,IAAA;AAAA,IACzB,WAAW,QAAA,CAAS,SAAA;AAAA,IACpB,OAAO,QAAA,CAAS;AAAA,GAClB;AACF;ACxHO,SAAS,gBACd,OAAA,EACuB;AACvB,EAAA,MAAM,MAAM,eAAA,EAAgB;AAC5B,EAAA,MAAM,UAAU,OAAA,EAAS,OAAA;AAGzB,EAAA,MAAM,MAAA,GACJ,OAAA,EAAS,MAAA,IAAU,GAAA,CAAI,MAAA,IAAU,IAAA;AACnC,EAAA,MAAM,SAAA,GACJ,YAAY,MAAA,GACP,OAAA,CAAQ,aAAa,OAAA,CAAQ,MAAA,KAAW,IAAA,GACzC,GAAA,CAAI,MAAA,KAAW,IAAA;AAErB,EAAA,MAAM,OAAA,GAAUA,YAAY,MAAM;AAGhC,IAAA,OAAO,OAAA,EAAS,OAAA,GAAU,OAAA,CAAQ,OAAA,EAAQ,GAAI,MAAA;AAAA,EAChD,CAAA,EAAG,CAAC,OAAO,CAAC,CAAA;AAEZ,EAAA,OAAO,EAAE,MAAA,EAAQ,SAAA,EAAW,OAAA,EAAQ;AACtC","file":"chunk-YORZNYZZ.js","sourcesContent":["/**\n * The React context object + the internal `useAgencContext()` hook.\n *\n * Split from the component file so the context identity is stable and so hooks\n * can import the context without pulling the JSX provider into their module\n * graph. SSR-safe: this module only calls `createContext` at import time, never\n * touches `window`.\n *\n * @module provider/context\n */\nimport { createContext, useContext } from \"react\";\nimport { t } from \"../strings/index.js\";\nimport type { AgencContextValue } from \"../types.js\";\n\n/**\n * The AgenC context. `null` until a `<AgencProvider>` mounts above the consumer\n * — {@link useAgencContext} turns that into a clear developer error.\n */\nexport const AgencContext = createContext<AgencContextValue | null>(null);\nAgencContext.displayName = \"AgencContext\";\n\n/**\n * Read the AgenC context. INTERNAL hook the package's own hooks build on; also\n * exported from the package root so downstream hooks (components agent) can\n * reach the resolved transport/client/referrer.\n *\n * @throws Error when called outside a `<AgencProvider>`.\n */\nexport function useAgencContext(): AgencContextValue {\n const ctx = useContext(AgencContext);\n if (ctx === null) {\n throw new Error(t(\"provider.missingContext\"));\n }\n return ctx;\n}\n","/**\n * Internal helpers shared by the headless hooks.\n *\n * - A namespaced TanStack Query key factory so every hook's cache entries are\n * stable, collision-free, and individually invalidatable.\n * - Tiny guards that turn a missing write client / signer into a clear,\n * catalog-routed error (never a `null.method()` crash) BEFORE a mutation runs.\n *\n * SSR-safe: pure functions, no `window`/`document`, no module-scope side\n * effects.\n *\n * @module hooks/internal\n */\nimport { t } from \"../strings/index.js\";\nimport type { Address, MarketplaceClient } from \"../types.js\";\n\n/** Root namespace for every cache key this package writes. */\nexport const QUERY_KEY_ROOT = \"agenc\" as const;\n\n/**\n * Stable, hierarchical TanStack Query keys. Hooks build their keys ONLY through\n * this factory so a consumer (or a hook) can invalidate a whole sub-tree\n * (`[\"agenc\", \"listings\"]`) or one entity (`[\"agenc\", \"listing\", pda]`).\n *\n * `JSON.stringify` is intentionally NOT used — TanStack compares keys\n * structurally, so passing the raw filter object keeps equality correct for\n * `bigint`/`Address` values without a serialization step.\n */\nexport const queryKeys = {\n /** All listings list queries (with their filter object as the leaf). */\n listings: (filter?: unknown) =>\n [QUERY_KEY_ROOT, \"listings\", filter ?? null] as const,\n /** One listing + its joined provider/track-record/moderation. */\n listing: (pda: string) => [QUERY_KEY_ROOT, \"listing\", pda] as const,\n /** One agent's indexer track record. */\n agentTrackRecord: (agentPda: string) =>\n [QUERY_KEY_ROOT, \"agentTrackRecord\", agentPda] as const,\n /** One task's status (read via transport / svm decode). */\n taskStatus: (taskPda: string) =>\n [QUERY_KEY_ROOT, \"taskStatus\", taskPda] as const,\n /** One task's dispute record. */\n dispute: (taskPda: string) => [QUERY_KEY_ROOT, \"dispute\", taskPda] as const,\n /** One referrer wallet's earnings (P6.2-gated; see useReferrerEarnings). */\n referrerEarnings: (wallet: string) =>\n [QUERY_KEY_ROOT, \"referrerEarnings\", wallet] as const,\n} as const;\n\n/**\n * Assert a write client exists, returning it narrowed to non-null. Throws a\n * clear, catalog-routed error when the provider was configured read-only (no\n * `client` and no resolvable `rpcUrl` + `signer`).\n *\n * Mutating hooks call this at the top of their `mutationFn` so the failure is a\n * descriptive Error in the mutation's `error` channel — never a crash.\n *\n * @throws Error (`provider.missingWriteClient`) when `client` is null.\n */\nexport function requireClient(\n client: MarketplaceClient | null,\n): MarketplaceClient {\n if (client === null) {\n throw new Error(t(\"provider.missingWriteClient\"));\n }\n return client;\n}\n\n/** Coerce an `Address | string` to its string form for use as a cache key. */\nexport function pdaKey(pda: Address | string): string {\n return String(pda);\n}\n","/**\n * `useHire()` — the hire mutation hook (the embeddable money path).\n *\n * Drives `client.hireFromListing(...)` through the provider's write client and\n * surfaces the resulting transaction signature + minted Task PDA. Typed\n * `AgencError`s from the runtime client are surfaced UNTOUCHED in `error`.\n *\n * ## THE P6.2 REFERRER GATE (PLAN_2 §0, MANDATORY — read before editing)\n *\n * The on-chain referrer args + 4th settlement leg (PLAN.md P6.2) are UNBUILT.\n * The SDK `facade.hireFromListing` has NO referrer parameter. So this hook:\n * - reads `resolveReferrerCapability()` from context BEFORE building the hire;\n * - when `live === false` (ALWAYS, today): it injects NO referrer argument into\n * the hire input. The referrer config is still accepted/validated/stored on\n * the provider and disclosure UI may show the pending-support copy — but the\n * transaction the user signs is a plain hire with no referral leg.\n * - the `referrerInjected` flag in the result is the audit signal: it is `false`\n * today and would only become `true` once P6.2 is live AND a referrer is\n * configured. We NEVER fabricate it.\n *\n * When P6.2 ships, the ONLY change here is: under `capability.live === true`,\n * spread the referrer fields (`referrer`, `referrerFeeBps`) into the hire input\n * below. Nothing else moves.\n *\n * @module hooks/useHire\n */\nimport { useMutation } from \"@tanstack/react-query\";\nimport { useCallback, useMemo } from \"react\";\nimport { facade, findTaskPda } from \"@tetsuo-ai/marketplace-sdk\";\nimport type { facade as facadeNs } from \"@tetsuo-ai/marketplace-sdk\";\nimport { useAgencContext } from \"../provider/context.js\";\nimport type { Address } from \"../types.js\";\nimport { requireClient } from \"./internal.js\";\n\n/**\n * Input to a standard `hire(...)` — a buyer that has a registered marketplace\n * agent (`creatorAgent`). This task settles on the HIRE COMPLETION path (the\n * worker calls `complete_task`). This is the SDK `facade.hireFromListing` input\n * MINUS the fee-payer signers, which default to the provider's write-client\n * signer (authority == creator == buyer). Pass them only to override.\n *\n * NOTE: deliberately NO referrer field — the referrer is provider-level config,\n * gated by P6.2, and is never threaded through a per-call hire input.\n */\nexport type HireInput = Omit<\n Parameters<typeof facadeNs.hireFromListing>[0],\n \"authority\" | \"creator\"\n> & {\n /** Standard hire (default). */\n humanless?: false;\n /** Override the buyer authority signer (defaults to the client signer). */\n authority?: Parameters<typeof facadeNs.hireFromListing>[0][\"authority\"];\n /** Override the buyer/creator signer (defaults to the client signer). */\n creator?: Parameters<typeof facadeNs.hireFromListing>[0][\"creator\"];\n};\n\n/**\n * Input to a HUMANLESS `hire(...)` — a plain-wallet buyer with NO registered\n * agent (the storefront-visitor path). The task is pinned to CreatorReview, so\n * it settles via the BUYER REVIEW path (`useSubmissionReview` accept/reject) —\n * the human reviews before funds release. This is the SDK\n * `facade.hireFromListingHumanless` input minus the `creator` signer (defaulted\n * to the client signer).\n */\nexport type HumanlessHireInput = Omit<\n Parameters<typeof facadeNs.hireFromListingHumanless>[0],\n \"creator\"\n> & {\n /** Discriminates the humanless storefront-visitor hire. */\n humanless: true;\n /** Override the buyer/creator signer (defaults to the client signer). */\n creator?: Parameters<typeof facadeNs.hireFromListingHumanless>[0][\"creator\"];\n};\n\n/** The union of standard and humanless hire inputs. */\nexport type AnyHireInput = HireInput | HumanlessHireInput;\n\n/** Lifecycle status of the hire mutation. */\nexport type HireStatus = \"idle\" | \"pending\" | \"success\" | \"error\";\n\n/** Result of a settled hire. */\nexport interface HireResult {\n /** The confirmed transaction signature. */\n signature: string;\n /** The minted Task PDA (derived from creator + taskId). */\n taskPda: Address;\n /**\n * Whether a referrer fee leg was injected into THIS hire. Always `false`\n * today (the P6.2 gate). Audit signal — never fabricated.\n */\n referrerInjected: boolean;\n}\n\n/** Return value of {@link useHire}. */\nexport interface UseHireResult {\n /** Execute a hire. Resolves to {@link HireResult}; rejects with `AgencError`. */\n hire: (input: AnyHireInput) => Promise<HireResult>;\n /** Current mutation status. */\n status: HireStatus;\n /** The minted Task PDA from the last successful hire, or null. */\n taskPda: Address | null;\n /** The signature from the last successful hire, or null. */\n signature: string | null;\n /** The error from the last hire (typed `AgencError` untouched), or null. */\n error: Error | null;\n /** Whether a hire is currently in flight. */\n isPending: boolean;\n /** Reset the mutation back to idle. */\n reset: () => void;\n}\n\n/**\n * The hire hook.\n *\n * @returns {@link UseHireResult}.\n *\n * @example\n * ```tsx\n * const { hire, status, taskPda, error } = useHire();\n * await hire({\n * listing, creatorAgent, taskId, expectedPrice: price, expectedVersion: 1n,\n * listingSpecHash,\n * });\n * ```\n */\nexport function useHire(): UseHireResult {\n const ctx = useAgencContext();\n\n const mutation = useMutation<HireResult, Error, AnyHireInput>({\n mutationFn: async (input: AnyHireInput): Promise<HireResult> => {\n const client = requireClient(ctx.client);\n\n // --- THE P6.2 GATE ---\n // Capability is resolved fresh per hire. Today it is ALWAYS not-live, so\n // we build a referrer-free hire. When P6.2 lands, the `capability.live`\n // branch is where the referrer fields get spread in (for BOTH paths).\n const capability = ctx.resolveReferrerCapability();\n const referrerInjected = capability.live && ctx.referrer !== null;\n\n const creator = input.creator ?? client.signer;\n let signature: string;\n\n if (input.humanless === true) {\n // Storefront-visitor hire: no creator agent; CreatorReview-pinned, so\n // it settles via the buyer review path (useSubmissionReview).\n const ix = await facade.hireFromListingHumanless({\n ...input,\n creator,\n // NOTE: P6.2 referrer fields would spread here under capability.live.\n } as Parameters<typeof facadeNs.hireFromListingHumanless>[0]);\n ({ signature } = await client.send([ix]));\n } else {\n // Standard hire: authority == creator == buyer (the buyer has an agent).\n const authority = input.authority ?? client.signer;\n const result = await client.hireFromListing({\n ...input,\n authority,\n creator,\n // NOTE: P6.2 referrer fields would spread here under capability.live.\n } as Parameters<typeof facadeNs.hireFromListing>[0]);\n signature = result.signature;\n }\n\n // Derive the minted Task PDA from (creator, taskId).\n const [taskPda] = await findTaskPda({\n creator:\n typeof creator === \"object\" && creator !== null && \"address\" in creator\n ? creator.address\n : (creator as Address),\n taskId: input.taskId,\n });\n\n return { signature, taskPda, referrerInjected };\n },\n });\n\n const hire = useCallback(\n (input: AnyHireInput) => mutation.mutateAsync(input),\n [mutation],\n );\n\n const status: HireStatus = useMemo(() => {\n if (mutation.isPending) return \"pending\";\n if (mutation.isError) return \"error\";\n if (mutation.isSuccess) return \"success\";\n return \"idle\";\n }, [mutation.isPending, mutation.isError, mutation.isSuccess]);\n\n return {\n hire,\n status,\n taskPda: mutation.data?.taskPda ?? null,\n signature: mutation.data?.signature ?? null,\n error: mutation.error ?? null,\n isPending: mutation.isPending,\n reset: mutation.reset,\n };\n}\n","/**\n * `useWalletSigner()` — bridges a browser wallet into the kit `TransactionSigner`\n * the SDK write client expects.\n *\n * ## Adapter seam (the signer-adapters package is not built yet)\n *\n * The dedicated `@tetsuo-ai/signer-adapters` package (the signers agent, PLAN.md\n * P4.1) — which wraps `@solana/react`'s\n * `useWalletAccountTransactionSendingSigner` (Wallet Standard) and the legacy\n * `@solana/wallet-adapter` shim into a kit `TransactionSigner` — does not exist\n * at this hook's build time. So this hook is defined against a **documented\n * adapter interface** ({@link WalletSignerAdapter}) rather than importing that\n * package. A caller passes an adapter (today: a thin wrapper they write, or the\n * signer-adapters hook once it ships) and this hook normalizes it to the\n * `{ signer, connected, connect() }` contract every other hook expects.\n *\n * With NO adapter passed, the hook falls back to the provider's configured\n * `signer` (the `AgencProvider config.signer` slot), so a server-supplied or\n * test signer just works and `connect()` is a no-op.\n *\n * SSR-safe: no `window`/`document`; the adapter (which may touch wallet globals)\n * is the caller's responsibility to gate to the client. This hook only reads\n * what the adapter already resolved.\n *\n * @module hooks/useWalletSigner\n */\nimport { useCallback } from \"react\";\nimport { useAgencContext } from \"../provider/context.js\";\nimport type { TransactionSigner } from \"../types.js\";\n\n/**\n * The minimal adapter shape this hook bridges. The forthcoming\n * `@tetsuo-ai/signer-adapters` hook is expected to return exactly this shape\n * (its `signerFromWalletAccount(...)` resolves the `signer`); until it ships,\n * any object matching this interface works.\n */\nexport interface WalletSignerAdapter {\n /** The resolved kit signer, or null when no wallet is connected. */\n signer: TransactionSigner | null;\n /** Whether a wallet is currently connected. */\n connected?: boolean;\n /** Trigger the wallet connect flow (browser-only). Optional. */\n connect?: () => void | Promise<void>;\n}\n\n/** Options for {@link useWalletSigner}. */\nexport interface UseWalletSignerOptions {\n /**\n * A wallet adapter (e.g. the signer-adapters hook's result). When omitted the\n * hook falls back to the provider's `config.signer`.\n */\n adapter?: WalletSignerAdapter;\n}\n\n/** Return value of {@link useWalletSigner}. */\nexport interface UseWalletSignerResult {\n /** The resolved kit `TransactionSigner`, or null. */\n signer: TransactionSigner | null;\n /** Whether a signer is available (adapter-connected or provider-configured). */\n connected: boolean;\n /** Trigger the wallet connect flow. No-op when no adapter `connect` exists. */\n connect: () => void | Promise<void>;\n}\n\n/**\n * Resolve the active signer for write operations.\n *\n * @param options - Optional wallet adapter; falls back to the provider signer.\n * @returns {@link UseWalletSignerResult}.\n *\n * @example\n * ```tsx\n * // Once @tetsuo-ai/signer-adapters ships:\n * const adapter = useWalletStandardSigner(); // returns WalletSignerAdapter\n * const { signer, connected, connect } = useWalletSigner({ adapter });\n * ```\n */\nexport function useWalletSigner(\n options?: UseWalletSignerOptions,\n): UseWalletSignerResult {\n const ctx = useAgencContext();\n const adapter = options?.adapter;\n\n // Adapter wins when present; otherwise the provider's configured signer.\n const signer: TransactionSigner | null =\n adapter?.signer ?? ctx.signer ?? null;\n const connected =\n adapter !== undefined\n ? (adapter.connected ?? adapter.signer !== null)\n : ctx.signer !== null;\n\n const connect = useCallback(() => {\n // No adapter (or no connect on it) => provider-supplied signer is already\n // \"connected\"; connecting is a no-op rather than an error.\n return adapter?.connect ? adapter.connect() : undefined;\n }, [adapter]);\n\n return { signer, connected, connect };\n}\n"]}
|