caelum0x 598cd03f05 feat: implement all 8 SettleKit apps + fix x402 nonce round-trip
apps:
- api: Hono REST server, all §26 endpoints, 14 tests
- worker: delivery runner + payment-confirm + access-sync + renewal + webhook-retry jobs wired to real package clients
- dashboard: Next.js merchant dashboard, full §16/§27 sections + §28 product builder
- checkout: Next.js hosted USDC checkout with real delivery materialization
- marketplace: Next.js public marketplace + agent metadata.json route
- admin: Next.js risk/ops console wired to @settlekit/risk + database
- docs: Next.js docs site (9 static routes)
- examples: 5 runnable end-to-end examples

fix(x402): support pinned config.nonce so a stateless verifier can confirm
the challenge nonce round-trips (default stays random; package tests intact).

Full workspace: 590 tests passing (122 files), tsc green for all packages +
api/worker/examples, all 5 Next apps typecheck clean, docs next build green.
2026-06-15 10:49:14 +03:00

47 lines
1.1 KiB
TypeScript

"use client";
import { useCallback, useState } from "react";
interface CopyButtonProps {
value: string;
label?: string;
}
/** Small copy-to-clipboard button with a transient "Copied" state. */
export function CopyButton({ value, label = "Copy" }: CopyButtonProps) {
const [copied, setCopied] = useState(false);
const onCopy = useCallback(async () => {
try {
if (navigator.clipboard?.writeText) {
await navigator.clipboard.writeText(value);
} else {
// Fallback for non-secure contexts.
const el = document.createElement("textarea");
el.value = value;
el.style.position = "fixed";
el.style.opacity = "0";
document.body.appendChild(el);
el.select();
document.execCommand("copy");
document.body.removeChild(el);
}
setCopied(true);
window.setTimeout(() => setCopied(false), 1600);
} catch {
setCopied(false);
}
}, [value]);
return (
<button
type="button"
className="btn btn-small"
onClick={onCopy}
aria-label={`Copy ${label}`}
>
{copied ? "Copied" : label}
</button>
);
}