// src/components/docs/libraries/LibrariesGrowthPage.tsx
import { CodeBlock, InstallCommand } from "@contractspec/lib.design-system";
import Link from "@contractspec/lib.ui-link";
import { ChevronRight } from "lucide-react";
import { jsx, jsxs } from "react/jsx-runtime";
function LibrariesGrowthPage() {
  return /* @__PURE__ */ jsxs("div", {
    className: "space-y-8",
    children: [
      /* @__PURE__ */ jsxs("div", {
        className: "space-y-4",
        children: [
          /* @__PURE__ */ jsx("h1", {
            className: "text-4xl font-bold",
            children: "@contractspec/lib.growth"
          }),
          /* @__PURE__ */ jsx("p", {
            className: "text-muted-foreground text-lg",
            children: "Launch experiments without third-party SDKs. Register variants, assign users deterministically, track exposures, and compute significance."
          })
        ]
      }),
      /* @__PURE__ */ jsxs("div", {
        className: "space-y-4",
        children: [
          /* @__PURE__ */ jsx("h2", {
            className: "text-2xl font-bold",
            children: "Installation"
          }),
          /* @__PURE__ */ jsx(InstallCommand, {
            package: "@contractspec/lib.growth"
          })
        ]
      }),
      /* @__PURE__ */ jsxs("div", {
        className: "space-y-3",
        children: [
          /* @__PURE__ */ jsx("h2", {
            className: "text-2xl font-bold",
            children: "Register + assign"
          }),
          /* @__PURE__ */ jsx(CodeBlock, {
            language: "typescript",
            code: `import { ExperimentRegistry, ExperimentRunner } from '@contractspec/lib.growth/experiments';

const registry = new ExperimentRegistry().register({
  key: 'pricing.cta',
  version: '1.0.0',
  goal: 'Increase demo bookings',
  variants: [
    { id: 'A', weight: 1 },
    { id: 'B', weight: 1 },
  ],
  primaryMetric: 'demo_booked',
});

const runner = new ExperimentRunner();
const assignment = runner.assign(registry.get('pricing.cta')!, 'user_123');`
          })
        ]
      }),
      /* @__PURE__ */ jsxs("div", {
        className: "space-y-3",
        children: [
          /* @__PURE__ */ jsx("h2", {
            className: "text-2xl font-bold",
            children: "Track + analyze"
          }),
          /* @__PURE__ */ jsx(CodeBlock, {
            language: "typescript",
            code: `import { ExperimentTracker } from '@contractspec/lib.growth/tracker';
import { StatsEngine } from '@contractspec/lib.growth/stats';

const tracker = new ExperimentTracker(new InMemoryTrackerStore());
await tracker.recordAssignment(assignment);
await tracker.recordSample({
  experimentKey: assignment.experimentKey,
  variantId: assignment.variantId,
  metric: 'demo_booked',
  value: 1,
  timestamp: new Date(),
});

const stats = new StatsEngine().summarize(
  await tracker.getSamples(assignment.experimentKey, 'demo_booked'),
  'demo_booked'
);`
          })
        ]
      }),
      /* @__PURE__ */ jsxs("div", {
        className: "flex items-center gap-4 pt-4",
        children: [
          /* @__PURE__ */ jsx(Link, {
            href: "/docs/libraries",
            className: "btn-ghost",
            children: "Back to Libraries"
          }),
          /* @__PURE__ */ jsxs(Link, {
            href: "/docs/libraries/analytics",
            className: "btn-primary",
            children: [
              "Next: Analytics ",
              /* @__PURE__ */ jsx(ChevronRight, {
                size: 16
              })
            ]
          })
        ]
      })
    ]
  });
}
export {
  LibrariesGrowthPage
};
