create-ailk 0.2.0 → 0.3.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/component-catalog.md +50 -53
- package/dist/lib/apply-module-patches.d.ts +47 -0
- package/dist/lib/apply-module-patches.js +370 -0
- package/dist/lib/extract-module-bundle.d.ts +12 -3
- package/dist/lib/extract-module-bundle.js +236 -24
- package/dist/lib/fetch-module.d.ts +3 -38
- package/dist/lib/fetch-module.js +26 -8
- package/dist/lib/module-license-gate.d.ts +2 -0
- package/dist/lib/module-license-gate.js +1 -0
- package/dist/lib/paid-paths.d.ts +16 -0
- package/dist/lib/paid-paths.js +90 -0
- package/dist/module-architecture.d.ts +139 -23
- package/dist/module-architecture.js +668 -25
- package/dist/parse-args.d.ts +2 -2
- package/dist/parse-args.js +3 -1
- package/dist/programmatic.d.ts +2 -1
- package/dist/programmatic.js +15 -4
- package/dist/surfaces.d.ts +12 -36
- package/dist/surfaces.js +35 -5
- package/dist/sync-routes.js +31 -1
- package/package.json +2 -2
- package/templates/.claude/agents/web.md +2 -3
- package/templates/.claude/rules/architecture.md +5 -5
- package/templates/.claude/skills/README.md +2 -1
- package/templates/.env.example +21 -9
- package/templates/CONVENTIONS.md +6 -7
- package/templates/apps/api/.env.example +9 -0
- package/templates/apps/api/CLAUDE.md +33 -5
- package/templates/apps/api/package.json +0 -1
- package/templates/apps/api/src/__tests__/cors.test.ts +195 -0
- package/templates/apps/api/src/__tests__/module-exclusion.test.ts +60 -2
- package/templates/apps/api/src/__tests__/vercel-handler.test.ts +159 -0
- package/templates/apps/api/src/config/__tests__/modules.test.ts +76 -0
- package/templates/apps/api/src/config/index.ts +19 -0
- package/templates/apps/api/src/config/modules.ts +12 -14
- package/templates/apps/api/src/lib/__mocks__/prisma.ts +3 -0
- package/templates/apps/api/src/lib/__tests__/slice-load.test.ts +89 -0
- package/templates/apps/api/src/lib/slice-load.ts +90 -0
- package/templates/apps/api/src/openapi/__tests__/openapi.test.ts +52 -32
- package/templates/apps/api/src/openapi/__tests__/spec-identity.test.ts +182 -0
- package/templates/apps/api/src/openapi/__tests__/surface-drift.test.ts +293 -0
- package/templates/apps/api/src/openapi/index.ts +9 -3
- package/templates/apps/api/src/openapi/spec.ts +505 -65
- package/templates/apps/api/src/openapi/surface-drift.ts +195 -0
- package/templates/apps/api/src/routes/content/__tests__/create.test.ts +14 -0
- package/templates/apps/api/src/routes/content/__tests__/delete.test.ts +14 -0
- package/templates/apps/api/src/routes/content/__tests__/update.test.ts +14 -0
- package/templates/apps/api/src/routes/content/index.ts +38 -11
- package/templates/apps/api/src/routes/project-listings/__tests__/configured-application.test.ts +17 -0
- package/templates/apps/api/src/routes/project-listings/__tests__/drafts.test.ts +17 -0
- package/templates/apps/api/src/routes/project-listings/__tests__/founder-identity.test.ts +796 -0
- package/templates/apps/api/src/routes/project-listings/__tests__/me.test.ts +10 -0
- package/templates/apps/api/src/routes/project-listings/__tests__/public.test.ts +38 -0
- package/templates/apps/api/src/routes/project-listings/__tests__/resume-email.test.ts +814 -0
- package/templates/apps/api/src/routes/project-listings/__tests__/site-answers.test.ts +10 -0
- package/templates/apps/api/src/routes/project-listings/__tests__/site-key.test.ts +24 -0
- package/templates/apps/api/src/routes/project-listings/__tests__/structured-address.test.ts +17 -0
- package/templates/apps/api/src/routes/project-listings/index.ts +37 -10
- package/templates/apps/api/src/routes/project-listings/me.ts +10 -0
- package/templates/apps/api/src/routes/project-listings/patch-draft.ts +5 -0
- package/templates/apps/api/src/routes/project-listings/public.ts +5 -0
- package/templates/apps/api/src/routes/project-listings/respond.ts +11 -0
- package/templates/apps/api/src/routes/project-listings/resume-token.ts +5 -0
- package/templates/apps/api/src/routes/project-listings/start.ts +30 -0
- package/templates/apps/api/src/routes/project-listings/submit.ts +5 -0
- package/templates/apps/api/src/routes/project-listings/verify-email.ts +150 -0
- package/templates/apps/api/src/server.ts +459 -135
- package/templates/apps/api/src/services/deliverable-fulfillment.ts +10 -0
- package/templates/apps/api/src/services/listing-config.ts +58 -0
- package/templates/apps/api/src/services/project-listing-resume-email.ts +326 -0
- package/templates/apps/api/src/services/project-listings.ts +229 -4
- package/templates/apps/api/src/vercel-handler.ts +60 -26
- package/templates/apps/mcp/.env.example +8 -0
- package/templates/apps/mcp/CLAUDE.md +2 -2
- package/templates/apps/mcp/__tests__/catalog-drift.test.ts +21 -0
- package/templates/apps/mcp/__tests__/config/modules.test.ts +78 -0
- package/templates/apps/mcp/__tests__/module-exclusion.test.ts +1 -1
- package/templates/apps/mcp/src/config/modules.ts +14 -13
- package/templates/apps/mcp/src/server.ts +8 -4
- package/templates/apps/mcp/src/tools/index.ts +7 -22
- package/templates/apps/web/.env.example +15 -0
- package/templates/apps/web/app/[locale]/(authed)/{waitlist/__tests__ → __tests__}/gate.test.tsx +4 -4
- package/templates/apps/web/app/[locale]/flows/[slug]/FlowStepperClient.tsx +2 -1
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.permalink.test.tsx +2 -1
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.test.tsx +2 -1
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/flow.actions.test.ts +1 -0
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/two-route-tool.test.tsx +1 -0
- package/templates/apps/web/app/[locale]/flows/[slug]/flow.actions.ts +2 -1
- package/templates/apps/web/app/[locale]/flows/[slug]/page.tsx +1 -0
- package/templates/apps/web/app/[locale]/flows/[slug]/start/page.tsx +1 -0
- package/templates/apps/web/app/llms.txt/route.ts +12 -9
- package/templates/apps/web/jest.config.cjs +14 -13
- package/templates/apps/web/next.config.mjs +1 -3
- package/templates/apps/web/package.json +0 -6
- package/templates/apps/web/public/android-chrome-192x192.png +0 -0
- package/templates/apps/web/public/android-chrome-512x512.png +0 -0
- package/templates/apps/web/public/apple-touch-icon.png +0 -0
- package/templates/apps/web/public/favicon-16x16.png +0 -0
- package/templates/apps/web/public/favicon-32x32.png +0 -0
- package/templates/apps/web/public/favicon.ico +0 -0
- package/templates/apps/web/public/favicon.svg +6 -3
- package/templates/apps/web/public/lockup-horizontal.svg +4 -0
- package/templates/apps/web/public/logomark.svg +4 -0
- package/templates/apps/web/public/site.webmanifest +2 -2
- package/templates/apps/web/public/wordmark.svg +4 -0
- package/templates/database/CHANGELOG.md +33 -0
- package/templates/database/inbox/schema.prisma +67 -0
- package/templates/database/migrations/20260914120000_listing_founder_identity/migration.sql +123 -0
- package/templates/database/package.json +1 -1
- package/templates/package.json +1 -1
- package/templates/.claude/skills/scaffold-commerce/SKILL.md +0 -807
- package/templates/.claude/skills/scaffold-commerce/references/lookup-keys-template.md +0 -71
- package/templates/.claude/skills/scaffold-commerce/references/marketplace-brand-pages.md +0 -83
- package/templates/.claude/skills/scaffold-commerce/templates/checkout-route.template.ts +0 -370
- package/templates/.claude/skills/scaffold-commerce/templates/invoice-route.template.ts +0 -376
- package/templates/.claude/skills/scaffold-commerce/templates/marketplace-cta-route.tsx.tmpl +0 -72
- package/templates/.claude/skills/scaffold-commerce/templates/payment-link-route.template.ts +0 -471
- package/templates/.claude/skills/scaffold-commerce/templates/portal-route.template.ts +0 -365
- package/templates/.claude/skills/scaffold-commerce/templates/stripe-config.template.ts +0 -60
- package/templates/.claude/skills/scaffold-commerce/templates/subscription-route.template.ts +0 -446
- package/templates/apps/api/src/__tests__/server.test.ts +0 -253
- package/templates/apps/api/src/bin/deliverable-resend.ts +0 -144
- package/templates/apps/api/src/bin/deliverable-upload.ts +0 -114
- package/templates/apps/api/src/bin/followup-sweep.ts +0 -44
- package/templates/apps/api/src/bin/listing-csv-sweep.ts +0 -46
- package/templates/apps/api/src/bin/seed-presets.ts +0 -58
- package/templates/apps/api/src/bin/seed-waitlist-experiments.ts +0 -104
- package/templates/apps/api/src/bin/session-retention-sweep.ts +0 -46
- package/templates/apps/api/src/lib/__tests__/stripe.test.ts +0 -74
- package/templates/apps/api/src/lib/stripe.ts +0 -52
- package/templates/apps/api/src/lib/tenant-db.ts +0 -225
- package/templates/apps/api/src/lib/ws-token.ts +0 -91
- package/templates/apps/api/src/middleware/tenant.ts +0 -99
- package/templates/apps/api/src/routes/billing/__tests__/portal.test.ts +0 -450
- package/templates/apps/api/src/routes/billing/__tests__/read.test.ts +0 -262
- package/templates/apps/api/src/routes/billing/__tests__/usage.test.ts +0 -436
- package/templates/apps/api/src/routes/billing/index.ts +0 -36
- package/templates/apps/api/src/routes/billing/portal.ts +0 -182
- package/templates/apps/api/src/routes/billing/read.ts +0 -75
- package/templates/apps/api/src/routes/billing/usage.ts +0 -153
- package/templates/apps/api/src/routes/checkout/__tests__/sessions.test.ts +0 -687
- package/templates/apps/api/src/routes/checkout/index.ts +0 -13
- package/templates/apps/api/src/routes/checkout/sessions.ts +0 -197
- package/templates/apps/api/src/routes/deliverables/__tests__/index.test.ts +0 -393
- package/templates/apps/api/src/routes/deliverables/index.ts +0 -200
- package/templates/apps/api/src/routes/flow-checkouts/__tests__/index.test.ts +0 -443
- package/templates/apps/api/src/routes/flow-checkouts/index.ts +0 -82
- package/templates/apps/api/src/routes/flows/README.md +0 -147
- package/templates/apps/api/src/routes/flows/__tests__/index.test.ts +0 -752
- package/templates/apps/api/src/routes/flows/__tests__/recommender.test.ts +0 -671
- package/templates/apps/api/src/routes/flows/index.ts +0 -202
- package/templates/apps/api/src/routes/flows/recommender.ts +0 -443
- package/templates/apps/api/src/routes/project-listings/__tests__/copy-edit.test.ts +0 -815
- package/templates/apps/api/src/routes/project-listings/__tests__/me-route-precedence.test.ts +0 -221
- package/templates/apps/api/src/routes/project-listings/__tests__/tenant-isolation.test.ts +0 -566
- package/templates/apps/api/src/routes/project-listings/get.ts +0 -70
- package/templates/apps/api/src/routes/project-listings/list.ts +0 -47
- package/templates/apps/api/src/routes/project-listings/patch.ts +0 -136
- package/templates/apps/api/src/routes/schedule/__tests__/index.test.ts +0 -490
- package/templates/apps/api/src/routes/schedule/index.ts +0 -249
- package/templates/apps/api/src/routes/slack/__tests__/actions.test.ts +0 -385
- package/templates/apps/api/src/routes/slack/actions.ts +0 -177
- package/templates/apps/api/src/routes/slack/index.ts +0 -38
- package/templates/apps/api/src/routes/waitlist-experiments/__tests__/tenant-isolation.test.ts +0 -577
- package/templates/apps/api/src/routes/waitlist-experiments/comparison.ts +0 -78
- package/templates/apps/api/src/routes/waitlist-experiments/index.ts +0 -41
- package/templates/apps/api/src/routes/waitlist-experiments/list.ts +0 -64
- package/templates/apps/api/src/routes/waitlist-experiments/respond.ts +0 -42
- package/templates/apps/api/src/routes/waitlist-experiments/signup.ts +0 -84
- package/templates/apps/api/src/routes/waitlist-experiments/signups.ts +0 -119
- package/templates/apps/api/src/routes/waitlist-signups/__tests__/index.test.ts +0 -238
- package/templates/apps/api/src/routes/waitlist-signups/index.ts +0 -101
- package/templates/apps/api/src/routes/webhooks/README.md +0 -80
- package/templates/apps/api/src/routes/webhooks/__tests__/stripe-flow-checkout.test.ts +0 -315
- package/templates/apps/api/src/routes/webhooks/__tests__/stripe-idempotency.test.ts +0 -247
- package/templates/apps/api/src/routes/webhooks/__tests__/stripe-org-billing.test.ts +0 -270
- package/templates/apps/api/src/routes/webhooks/__tests__/stripe-rate-limit.test.ts +0 -198
- package/templates/apps/api/src/routes/webhooks/__tests__/stripe.test.ts +0 -633
- package/templates/apps/api/src/routes/webhooks/index.ts +0 -41
- package/templates/apps/api/src/routes/webhooks/stripe.ts +0 -481
- package/templates/apps/api/src/routes/workspaces/__tests__/config-tenant-isolation.test.ts +0 -356
- package/templates/apps/api/src/routes/workspaces/__tests__/tenant-isolation.test.ts +0 -671
- package/templates/apps/api/src/routes/workspaces/config.ts +0 -125
- package/templates/apps/api/src/routes/workspaces/index.ts +0 -194
- package/templates/apps/api/src/routes/workspaces/sessions.ts +0 -218
- package/templates/apps/api/src/services/__tests__/flow-aggregate.test.ts +0 -425
- package/templates/apps/api/src/services/__tests__/flow-engine.test.ts +0 -2840
- package/templates/apps/api/src/services/__tests__/lead-promotion.test.ts +0 -393
- package/templates/apps/api/src/services/__tests__/listing-csv-sweep.test.ts +0 -560
- package/templates/apps/api/src/services/__tests__/listing-promotion.test.ts +0 -684
- package/templates/apps/api/src/services/__tests__/playbook-compile.test.ts +0 -406
- package/templates/apps/api/src/services/__tests__/playbook-render.test.ts +0 -290
- package/templates/apps/api/src/services/__tests__/project-listing-decision.test.ts +0 -736
- package/templates/apps/api/src/services/__tests__/project-listing-flow.test.ts +0 -475
- package/templates/apps/api/src/services/__tests__/project-listing-issue.test.ts +0 -340
- package/templates/apps/api/src/services/__tests__/recommender-capture.test.ts +0 -983
- package/templates/apps/api/src/services/__tests__/tenant-context-cascade.test.ts +0 -71
- package/templates/apps/api/src/services/__tests__/tenant-context.test.ts +0 -379
- package/templates/apps/api/src/services/__tests__/usage-metering.test.ts +0 -768
- package/templates/apps/api/src/services/__tests__/waitlist-dashboard.test.ts +0 -1314
- package/templates/apps/api/src/services/__tests__/waitlist-experiments.test.ts +0 -341
- package/templates/apps/api/src/services/__tests__/waitlist-followup.test.ts +0 -567
- package/templates/apps/api/src/services/__tests__/waitlist-scoring.test.ts +0 -474
- package/templates/apps/api/src/services/__tests__/waitlist-signups.test.ts +0 -354
- package/templates/apps/api/src/services/flow-aggregate.ts +0 -232
- package/templates/apps/api/src/services/flow-checkouts.ts +0 -123
- package/templates/apps/api/src/services/flow-engine.ts +0 -1296
- package/templates/apps/api/src/services/lead-promotion.ts +0 -176
- package/templates/apps/api/src/services/listing-csv-sweep.ts +0 -455
- package/templates/apps/api/src/services/listing-promotion.ts +0 -342
- package/templates/apps/api/src/services/playbook-compile.ts +0 -398
- package/templates/apps/api/src/services/playbook-render.ts +0 -263
- package/templates/apps/api/src/services/project-listing-decision.ts +0 -510
- package/templates/apps/api/src/services/project-listing-flow.ts +0 -426
- package/templates/apps/api/src/services/project-listing-issue.ts +0 -251
- package/templates/apps/api/src/services/recommender-capture.ts +0 -835
- package/templates/apps/api/src/services/scheduling/cal-provider.ts +0 -392
- package/templates/apps/api/src/services/scheduling/index.ts +0 -63
- package/templates/apps/api/src/services/scheduling/types.ts +0 -88
- package/templates/apps/api/src/services/tenant-context.ts +0 -451
- package/templates/apps/api/src/services/usage-metering.ts +0 -699
- package/templates/apps/api/src/services/waitlist-dashboard.ts +0 -947
- package/templates/apps/api/src/services/waitlist-experiments.ts +0 -213
- package/templates/apps/api/src/services/waitlist-followup.ts +0 -486
- package/templates/apps/api/src/services/waitlist-scoring.ts +0 -166
- package/templates/apps/api/src/services/waitlist-signups.ts +0 -165
- package/templates/apps/mcp/__tests__/schedule_tools.test.ts +0 -242
- package/templates/apps/mcp/src/tools/create_booking.ts +0 -58
- package/templates/apps/mcp/src/tools/get_event_meta.ts +0 -55
- package/templates/apps/mcp/src/tools/get_flow.ts +0 -61
- package/templates/apps/mcp/src/tools/list_availability.ts +0 -67
- package/templates/apps/mcp/src/tools/submit_flow_step.ts +0 -83
- package/templates/apps/web/app/[locale]/(authed)/waitlist/[experimentId]/page.tsx +0 -309
- package/templates/apps/web/app/[locale]/(authed)/waitlist/[experimentId]/signups/[leadId]/page.tsx +0 -149
- package/templates/apps/web/app/[locale]/(authed)/waitlist/__tests__/comparison.test.tsx +0 -273
- package/templates/apps/web/app/[locale]/(authed)/waitlist/__tests__/list.test.tsx +0 -171
- package/templates/apps/web/app/[locale]/(authed)/waitlist/__tests__/signup.test.tsx +0 -179
- package/templates/apps/web/app/[locale]/(authed)/waitlist/components/ExperimentsTable.tsx +0 -116
- package/templates/apps/web/app/[locale]/(authed)/waitlist/components/OfferFunnelTable.tsx +0 -66
- package/templates/apps/web/app/[locale]/(authed)/waitlist/components/RollupTicker.tsx +0 -61
- package/templates/apps/web/app/[locale]/(authed)/waitlist/components/ScoreTrace.tsx +0 -114
- package/templates/apps/web/app/[locale]/(authed)/waitlist/components/SignupsTable.tsx +0 -139
- package/templates/apps/web/app/[locale]/(authed)/waitlist/components/WaitlistComparisonTabs.tsx +0 -85
- package/templates/apps/web/app/[locale]/(authed)/waitlist/components/status-badges.tsx +0 -67
- package/templates/apps/web/app/[locale]/(authed)/waitlist/page.tsx +0 -179
- package/templates/apps/web/app/[locale]/blog/[[...slug]]/page.tsx +0 -178
- package/templates/apps/web/app/[locale]/dev/purchase/__tests__/actions.test.ts +0 -160
- package/templates/apps/web/app/[locale]/dev/purchase/error.tsx +0 -25
- package/templates/apps/web/app/[locale]/dev/purchase/page.tsx +0 -117
- package/templates/apps/web/app/[locale]/dev/purchase/purchase.actions.ts +0 -58
- package/templates/apps/web/app/[locale]/docs/[[...slug]]/page.tsx +0 -119
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/checkout.actions.test.ts +0 -287
- package/templates/apps/web/app/[locale]/flows/[slug]/checkout.actions.ts +0 -254
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/ResultsClient.tsx +0 -532
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/ResultsEmailStep.tsx +0 -121
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/ResultsClient.checkout.test.tsx +0 -457
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/page.test.tsx +0 -396
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/page.tsx +0 -114
- package/templates/apps/web/app/[locale]/projects/apply/ListingApplicationClient.tsx +0 -110
- package/templates/apps/web/app/[locale]/projects/apply/__tests__/ListingApplicationClient.test.tsx +0 -96
- package/templates/apps/web/app/[locale]/schedule/__tests__/page.test.tsx +0 -117
- package/templates/apps/web/app/[locale]/schedule/confirmed/__tests__/page.test.tsx +0 -96
- package/templates/apps/web/app/[locale]/schedule/confirmed/page.tsx +0 -92
- package/templates/apps/web/app/[locale]/schedule/page.tsx +0 -82
- package/templates/apps/web/content/en/blog/README.txt +0 -25
- package/templates/apps/web/content/en/docs/index.mdx +0 -28
- package/templates/apps/web/lib/__mocks__/source-server.js +0 -31
- package/templates/apps/web/lib/blog-list-data.ts +0 -95
- package/templates/apps/web/lib/blog-post-data.ts +0 -79
- package/templates/apps/web/lib/source.ts +0 -34
- package/templates/apps/web/public/logomark-dark.svg +0 -4
- package/templates/apps/web/public/logomark-light.svg +0 -4
- package/templates/apps/web/source.config.ts +0 -78
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ExperimentsTable — the list + rollup view's experiments table (#4665 D10).
|
|
3
|
-
*
|
|
4
|
-
* App-local composition from the catalog (the `apps-paid/workspace/components/`
|
|
5
|
-
* idiom): `Table` primitive (key → `Link`, mode `Badge`, status `Badge` with
|
|
6
|
-
* `role="status"`), `EmptyState` when there are no rows. Every string is
|
|
7
|
-
* caller-supplied (translatable); numbers are pre-formatted by the page via
|
|
8
|
-
* `../format.js`.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import {
|
|
12
|
-
EmptyState,
|
|
13
|
-
Link,
|
|
14
|
-
Table,
|
|
15
|
-
TableBody,
|
|
16
|
-
TableCaption,
|
|
17
|
-
TableCell,
|
|
18
|
-
TableHead,
|
|
19
|
-
TableHeader,
|
|
20
|
-
TableRow,
|
|
21
|
-
} from "@working-theory/ui/primitives";
|
|
22
|
-
import type { WaitlistExperimentSummary } from "@working-theory/validation";
|
|
23
|
-
import type { ReactElement } from "react";
|
|
24
|
-
|
|
25
|
-
import { ExperimentModeBadge, ExperimentStatusBadge } from "./status-badges";
|
|
26
|
-
|
|
27
|
-
export interface ExperimentsTableLabels {
|
|
28
|
-
caption: string;
|
|
29
|
-
columnKey: string;
|
|
30
|
-
columnMode: string;
|
|
31
|
-
columnStatus: string;
|
|
32
|
-
columnWaitlists: string;
|
|
33
|
-
columnRaw: string;
|
|
34
|
-
columnQualified: string;
|
|
35
|
-
columnRate: string;
|
|
36
|
-
columnUpdated: string;
|
|
37
|
-
emptyHeadline: string;
|
|
38
|
-
emptyDescription: string;
|
|
39
|
-
statusLabel: (status: string) => string;
|
|
40
|
-
modeLabel: (mode: string) => string;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export interface ExperimentsTableProps {
|
|
44
|
-
locale: string;
|
|
45
|
-
rows: Array<{
|
|
46
|
-
experiment: WaitlistExperimentSummary;
|
|
47
|
-
raw: string;
|
|
48
|
-
qualified: string;
|
|
49
|
-
rate: string;
|
|
50
|
-
updated: string;
|
|
51
|
-
}>;
|
|
52
|
-
labels: ExperimentsTableLabels;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export function ExperimentsTable({
|
|
56
|
-
locale,
|
|
57
|
-
rows,
|
|
58
|
-
labels,
|
|
59
|
-
}: ExperimentsTableProps): ReactElement {
|
|
60
|
-
if (rows.length === 0) {
|
|
61
|
-
return (
|
|
62
|
-
<div data-testid="experiments-table-empty">
|
|
63
|
-
<EmptyState headline={labels.emptyHeadline} description={labels.emptyDescription} />
|
|
64
|
-
</div>
|
|
65
|
-
);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
return (
|
|
69
|
-
<Table data-testid="experiments-table">
|
|
70
|
-
<TableCaption>{labels.caption}</TableCaption>
|
|
71
|
-
<TableHeader>
|
|
72
|
-
<TableRow>
|
|
73
|
-
<TableHead scope="col">{labels.columnKey}</TableHead>
|
|
74
|
-
<TableHead scope="col">{labels.columnMode}</TableHead>
|
|
75
|
-
<TableHead scope="col">{labels.columnStatus}</TableHead>
|
|
76
|
-
<TableHead scope="col">{labels.columnWaitlists}</TableHead>
|
|
77
|
-
<TableHead scope="col">{labels.columnRaw}</TableHead>
|
|
78
|
-
<TableHead scope="col">{labels.columnQualified}</TableHead>
|
|
79
|
-
<TableHead scope="col">{labels.columnRate}</TableHead>
|
|
80
|
-
<TableHead scope="col">{labels.columnUpdated}</TableHead>
|
|
81
|
-
</TableRow>
|
|
82
|
-
</TableHeader>
|
|
83
|
-
<TableBody>
|
|
84
|
-
{rows.map(({ experiment, raw, qualified, rate, updated }) => (
|
|
85
|
-
<TableRow
|
|
86
|
-
key={experiment.id}
|
|
87
|
-
data-testid={`experiments-table-row-${experiment.id}`}
|
|
88
|
-
>
|
|
89
|
-
<TableCell>
|
|
90
|
-
<Link href={`/${locale}/waitlist/${experiment.id}`}>
|
|
91
|
-
{experiment.key}
|
|
92
|
-
</Link>
|
|
93
|
-
</TableCell>
|
|
94
|
-
<TableCell>
|
|
95
|
-
<ExperimentModeBadge
|
|
96
|
-
mode={experiment.mode}
|
|
97
|
-
label={labels.modeLabel(experiment.mode)}
|
|
98
|
-
/>
|
|
99
|
-
</TableCell>
|
|
100
|
-
<TableCell>
|
|
101
|
-
<ExperimentStatusBadge
|
|
102
|
-
status={experiment.status}
|
|
103
|
-
label={labels.statusLabel(experiment.status)}
|
|
104
|
-
/>
|
|
105
|
-
</TableCell>
|
|
106
|
-
<TableCell>{experiment.waitlists.length}</TableCell>
|
|
107
|
-
<TableCell>{raw}</TableCell>
|
|
108
|
-
<TableCell>{qualified}</TableCell>
|
|
109
|
-
<TableCell>{rate}</TableCell>
|
|
110
|
-
<TableCell>{updated}</TableCell>
|
|
111
|
-
</TableRow>
|
|
112
|
-
))}
|
|
113
|
-
</TableBody>
|
|
114
|
-
</Table>
|
|
115
|
-
);
|
|
116
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* OfferFunnelTable — one recommending experiment's per-offer funnel on the
|
|
3
|
-
* list view (#4839 D4/FR7): Offer · Recommended · Saved · Checked out, one
|
|
4
|
-
* row per register offer in register order.
|
|
5
|
-
*
|
|
6
|
-
* App-local composition from the catalog (the `ExperimentsTable` idiom):
|
|
7
|
-
* `Table` primitive only. Every string is caller-supplied (translatable);
|
|
8
|
-
* numbers are pre-formatted by the page via `../format.js`. Zero shipped copy.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import {
|
|
12
|
-
Table,
|
|
13
|
-
TableBody,
|
|
14
|
-
TableCaption,
|
|
15
|
-
TableCell,
|
|
16
|
-
TableHead,
|
|
17
|
-
TableHeader,
|
|
18
|
-
TableRow,
|
|
19
|
-
} from "@working-theory/ui/primitives";
|
|
20
|
-
import type { ReactElement } from "react";
|
|
21
|
-
|
|
22
|
-
export interface OfferFunnelTableLabels {
|
|
23
|
-
captionPrefix: string;
|
|
24
|
-
columnOffer: string;
|
|
25
|
-
columnRecommended: string;
|
|
26
|
-
columnSaved: string;
|
|
27
|
-
columnCheckedOut: string;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export interface OfferFunnelTableProps {
|
|
31
|
-
experimentId: string;
|
|
32
|
-
experimentKey: string;
|
|
33
|
-
rows: Array<{ offerKey: string; recommended: string; saved: string; checkedOut: string }>;
|
|
34
|
-
labels: OfferFunnelTableLabels;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export function OfferFunnelTable({
|
|
38
|
-
experimentId,
|
|
39
|
-
experimentKey,
|
|
40
|
-
rows,
|
|
41
|
-
labels,
|
|
42
|
-
}: OfferFunnelTableProps): ReactElement {
|
|
43
|
-
return (
|
|
44
|
-
<Table data-testid={`experiments-offer-funnel-${experimentId}`}>
|
|
45
|
-
<TableCaption>{`${labels.captionPrefix} ${experimentKey}`}</TableCaption>
|
|
46
|
-
<TableHeader>
|
|
47
|
-
<TableRow>
|
|
48
|
-
<TableHead scope="col">{labels.columnOffer}</TableHead>
|
|
49
|
-
<TableHead scope="col">{labels.columnRecommended}</TableHead>
|
|
50
|
-
<TableHead scope="col">{labels.columnSaved}</TableHead>
|
|
51
|
-
<TableHead scope="col">{labels.columnCheckedOut}</TableHead>
|
|
52
|
-
</TableRow>
|
|
53
|
-
</TableHeader>
|
|
54
|
-
<TableBody>
|
|
55
|
-
{rows.map(({ offerKey, recommended, saved, checkedOut }) => (
|
|
56
|
-
<TableRow key={offerKey} data-testid={`experiments-offer-funnel-${experimentId}-${offerKey}`}>
|
|
57
|
-
<TableCell>{offerKey}</TableCell>
|
|
58
|
-
<TableCell>{recommended}</TableCell>
|
|
59
|
-
<TableCell>{saved}</TableCell>
|
|
60
|
-
<TableCell>{checkedOut}</TableCell>
|
|
61
|
-
</TableRow>
|
|
62
|
-
))}
|
|
63
|
-
</TableBody>
|
|
64
|
-
</Table>
|
|
65
|
-
);
|
|
66
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* RollupTicker — the list + rollup view's cross-experiment rollup strip
|
|
3
|
-
* (#4665 D10). App-local composition over the `StatTicker` block; every
|
|
4
|
-
* value is pre-formatted by the page (`../format.js`).
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import { StatTicker } from "@working-theory/ui/blocks";
|
|
8
|
-
import type { ReactElement } from "react";
|
|
9
|
-
|
|
10
|
-
export interface RollupTickerLabels {
|
|
11
|
-
live: string;
|
|
12
|
-
closed: string;
|
|
13
|
-
draft: string;
|
|
14
|
-
raw: string;
|
|
15
|
-
qualified: string;
|
|
16
|
-
rate: string;
|
|
17
|
-
sites: string;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export interface RollupTickerValues {
|
|
21
|
-
live: string;
|
|
22
|
-
closed: string;
|
|
23
|
-
draft: string;
|
|
24
|
-
raw: string;
|
|
25
|
-
qualified: string;
|
|
26
|
-
rate: string;
|
|
27
|
-
/** Present only for the platform-operator (`scope: "all"`) — D6/§2.1. */
|
|
28
|
-
sites?: string;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export interface RollupTickerProps {
|
|
32
|
-
labels: RollupTickerLabels;
|
|
33
|
-
values: RollupTickerValues;
|
|
34
|
-
ariaLabel: string;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export function RollupTicker({
|
|
38
|
-
labels,
|
|
39
|
-
values,
|
|
40
|
-
ariaLabel,
|
|
41
|
-
}: RollupTickerProps): ReactElement {
|
|
42
|
-
const items = [
|
|
43
|
-
{ id: "live", value: values.live, label: labels.live },
|
|
44
|
-
{ id: "closed", value: values.closed, label: labels.closed },
|
|
45
|
-
{ id: "draft", value: values.draft, label: labels.draft },
|
|
46
|
-
{ id: "raw", value: values.raw, label: labels.raw },
|
|
47
|
-
{ id: "qualified", value: values.qualified, label: labels.qualified },
|
|
48
|
-
{ id: "rate", value: values.rate, label: labels.rate },
|
|
49
|
-
...(values.sites !== undefined
|
|
50
|
-
? [{ id: "sites", value: values.sites, label: labels.sites }]
|
|
51
|
-
: []),
|
|
52
|
-
];
|
|
53
|
-
|
|
54
|
-
return (
|
|
55
|
-
<StatTicker
|
|
56
|
-
items={items}
|
|
57
|
-
label={ariaLabel}
|
|
58
|
-
data-testid="rollup-ticker"
|
|
59
|
-
/>
|
|
60
|
-
);
|
|
61
|
-
}
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ScoreTrace — the drill-down view's score panel (#4665 D10).
|
|
3
|
-
*
|
|
4
|
-
* App-local composition: `tier` `Badge`, `categoryScores` `DescriptionList`,
|
|
5
|
-
* `ruleTrace` `CodeBlock` (formatted JSON — `ruleTrace` is `unknown`, A2's to
|
|
6
|
-
* shape; this renders it as-is). "Not scored" `EmptyState` when the signup
|
|
7
|
-
* carries no `WaitlistScore` row.
|
|
8
|
-
*
|
|
9
|
-
* `scoreDisplay` / `categoryScores[].display` are pre-formatted by the
|
|
10
|
-
* caller (Rule 10 — locale-aware number formatting stays in `apps/web`'s
|
|
11
|
-
* `format.ts`, matching every other number on this surface; this component
|
|
12
|
-
* never calls a formatter itself).
|
|
13
|
-
*
|
|
14
|
-
* `decidingDefs` (FEAT-074 U4a, #4715, AC-5) is the targeting-maturity
|
|
15
|
-
* signup's deciding def names, pre-extracted by the caller
|
|
16
|
-
* (`format.ts#decidingDefsFor`, which scopes it to that ONE experiment) —
|
|
17
|
-
* absent or empty renders no section, byte-unchanged from before this unit.
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
import { CodeBlock, DescriptionList } from "@working-theory/ui/blocks";
|
|
21
|
-
import { Badge, EmptyState } from "@working-theory/ui/primitives";
|
|
22
|
-
import type { WaitlistSignupDetail } from "@working-theory/validation";
|
|
23
|
-
import type { ReactElement } from "react";
|
|
24
|
-
|
|
25
|
-
export interface ScoreTraceLabels {
|
|
26
|
-
tier: string;
|
|
27
|
-
score: string;
|
|
28
|
-
categoryScoresTitle: string;
|
|
29
|
-
decidingDefsTitle: string;
|
|
30
|
-
ruleTraceTitle: string;
|
|
31
|
-
notScoredHeadline: string;
|
|
32
|
-
notScoredDescription: string;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export interface ScoreTraceProps {
|
|
36
|
-
score: WaitlistSignupDetail["score"];
|
|
37
|
-
/** Pre-formatted `score.score` (Rule 10) — required whenever `score` is non-null. */
|
|
38
|
-
scoreDisplay?: string;
|
|
39
|
-
/** Pre-formatted per-category values, in `score.categoryScores` order. */
|
|
40
|
-
categoryScores?: Array<{ label: string; display: string }>;
|
|
41
|
-
/** The deciding def names (`format.ts#decidingDefsFor`) — absent or `[]` renders no section. */
|
|
42
|
-
decidingDefs?: string[];
|
|
43
|
-
labels: ScoreTraceLabels;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export function ScoreTrace({
|
|
47
|
-
score,
|
|
48
|
-
scoreDisplay,
|
|
49
|
-
categoryScores,
|
|
50
|
-
decidingDefs,
|
|
51
|
-
labels,
|
|
52
|
-
}: ScoreTraceProps): ReactElement {
|
|
53
|
-
if (score === null) {
|
|
54
|
-
return (
|
|
55
|
-
<div data-testid="score-trace-not-scored">
|
|
56
|
-
<EmptyState
|
|
57
|
-
headline={labels.notScoredHeadline}
|
|
58
|
-
description={labels.notScoredDescription}
|
|
59
|
-
/>
|
|
60
|
-
</div>
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
return (
|
|
65
|
-
<div data-testid="score-trace" className="flex flex-col gap-4">
|
|
66
|
-
<DescriptionList
|
|
67
|
-
data-testid="score-trace-summary"
|
|
68
|
-
items={[
|
|
69
|
-
{
|
|
70
|
-
label: labels.tier,
|
|
71
|
-
value: <Badge variant="default">{score.tier}</Badge>,
|
|
72
|
-
},
|
|
73
|
-
{ label: labels.score, value: scoreDisplay ?? String(score.score) },
|
|
74
|
-
]}
|
|
75
|
-
/>
|
|
76
|
-
<div>
|
|
77
|
-
<p className="mb-2 text-body-sm font-semibold text-(--color-fg)">
|
|
78
|
-
{labels.categoryScoresTitle}
|
|
79
|
-
</p>
|
|
80
|
-
<DescriptionList
|
|
81
|
-
data-testid="score-trace-category-scores"
|
|
82
|
-
items={(
|
|
83
|
-
categoryScores ??
|
|
84
|
-
Object.entries(score.categoryScores).map(([category, value]) => ({
|
|
85
|
-
label: category,
|
|
86
|
-
display: String(value),
|
|
87
|
-
}))
|
|
88
|
-
).map(({ label, display }) => ({ label, value: display }))}
|
|
89
|
-
/>
|
|
90
|
-
</div>
|
|
91
|
-
{decidingDefs && decidingDefs.length > 0 ? (
|
|
92
|
-
<div data-testid="score-trace-deciding-defs">
|
|
93
|
-
<p className="mb-2 text-body-sm font-semibold text-(--color-fg)">
|
|
94
|
-
{labels.decidingDefsTitle}
|
|
95
|
-
</p>
|
|
96
|
-
<ul className="list-disc pl-5">
|
|
97
|
-
{decidingDefs.map((name) => (
|
|
98
|
-
<li key={name}>{name}</li>
|
|
99
|
-
))}
|
|
100
|
-
</ul>
|
|
101
|
-
</div>
|
|
102
|
-
) : null}
|
|
103
|
-
<div>
|
|
104
|
-
<p className="mb-2 text-body-sm font-semibold text-(--color-fg)">
|
|
105
|
-
{labels.ruleTraceTitle}
|
|
106
|
-
</p>
|
|
107
|
-
<CodeBlock
|
|
108
|
-
language="JSON"
|
|
109
|
-
code={JSON.stringify(score.ruleTrace, null, 2)}
|
|
110
|
-
/>
|
|
111
|
-
</div>
|
|
112
|
-
</div>
|
|
113
|
-
);
|
|
114
|
-
}
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* SignupsTable — the comparison view's paginated signups table (#4665 D10).
|
|
3
|
-
*
|
|
4
|
-
* App-local composition: `Table` primitive + a "next page" link.
|
|
5
|
-
*
|
|
6
|
-
* Deviation from the spec's descriptive composition note ("Pagination (link
|
|
7
|
-
* form, `?cursor=`)"): the `Pagination` primitive
|
|
8
|
-
* (`packages/ui/src/primitives/Pagination.tsx`) is built around a
|
|
9
|
-
* `currentPage`/`totalPages` numeric model — the signups list is
|
|
10
|
-
* cursor-paginated (`nextCursor: string | null`, D6/D7) with no total-page
|
|
11
|
-
* count and no `prevCursor` from the server, so `Pagination`'s numeric API
|
|
12
|
-
* cannot express this list's actual pagination shape. Rather than force-fit
|
|
13
|
-
* it, this renders a single "next" `Link` (RSC-safe, no client boundary)
|
|
14
|
-
* when `nextCursor` is present — the honest shape of a forward-only cursor
|
|
15
|
-
* list. Documented in the PR body.
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
import {
|
|
19
|
-
Link,
|
|
20
|
-
Table,
|
|
21
|
-
TableBody,
|
|
22
|
-
TableCaption,
|
|
23
|
-
TableCell,
|
|
24
|
-
TableHead,
|
|
25
|
-
TableHeader,
|
|
26
|
-
TableRow,
|
|
27
|
-
} from "@working-theory/ui/primitives";
|
|
28
|
-
import type { WaitlistSignupRow } from "@working-theory/validation";
|
|
29
|
-
import type { ReactElement } from "react";
|
|
30
|
-
|
|
31
|
-
export interface SignupsTableLabels {
|
|
32
|
-
caption: string;
|
|
33
|
-
columnEmail: string;
|
|
34
|
-
columnWaitlist: string;
|
|
35
|
-
columnSource: string;
|
|
36
|
-
columnCreated: string;
|
|
37
|
-
columnTier: string;
|
|
38
|
-
columnScore: string;
|
|
39
|
-
unavailable: string;
|
|
40
|
-
next: string;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export interface SignupsTableProps {
|
|
44
|
-
locale: string;
|
|
45
|
-
experimentId: string;
|
|
46
|
-
waitlist?: string;
|
|
47
|
-
/**
|
|
48
|
-
* `created`, `score`, and `tierDisplay` are pre-formatted by the caller
|
|
49
|
-
* (Rule 10 — this component never formats a value itself); `score: null`
|
|
50
|
-
* means "not scored" and renders `labels.unavailable`, matching the
|
|
51
|
-
* caller's own `format.ts` sentinel handling elsewhere on this surface.
|
|
52
|
-
* `tierDisplay` is `signup.tier` unchanged for every experiment except
|
|
53
|
-
* `targeting-maturity`, where the caller maps it to its Level label
|
|
54
|
-
* (`format.ts#targetingMaturityLevel`, D5, AC-5) — `null` renders
|
|
55
|
-
* `labels.unavailable`, exactly as a raw `signup.tier` of `null` already did.
|
|
56
|
-
*/
|
|
57
|
-
rows: Array<{
|
|
58
|
-
signup: WaitlistSignupRow;
|
|
59
|
-
created: string;
|
|
60
|
-
score: string | null;
|
|
61
|
-
tierDisplay: string | null;
|
|
62
|
-
}>;
|
|
63
|
-
nextCursor: string | null;
|
|
64
|
-
labels: SignupsTableLabels;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
function buildNextHref(
|
|
68
|
-
locale: string,
|
|
69
|
-
experimentId: string,
|
|
70
|
-
waitlist: string | undefined,
|
|
71
|
-
nextCursor: string,
|
|
72
|
-
): string {
|
|
73
|
-
const params = new URLSearchParams();
|
|
74
|
-
if (waitlist) params.set("waitlist", waitlist);
|
|
75
|
-
params.set("cursor", nextCursor);
|
|
76
|
-
return `/${locale}/waitlist/${experimentId}?${params.toString()}`;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
export function SignupsTable({
|
|
80
|
-
locale,
|
|
81
|
-
experimentId,
|
|
82
|
-
waitlist,
|
|
83
|
-
rows,
|
|
84
|
-
nextCursor,
|
|
85
|
-
labels,
|
|
86
|
-
}: SignupsTableProps): ReactElement {
|
|
87
|
-
return (
|
|
88
|
-
<div data-testid="signups-table-wrapper">
|
|
89
|
-
<Table data-testid="signups-table">
|
|
90
|
-
<TableCaption>{labels.caption}</TableCaption>
|
|
91
|
-
<TableHeader>
|
|
92
|
-
<TableRow>
|
|
93
|
-
<TableHead scope="col">{labels.columnEmail}</TableHead>
|
|
94
|
-
<TableHead scope="col">{labels.columnWaitlist}</TableHead>
|
|
95
|
-
<TableHead scope="col">{labels.columnSource}</TableHead>
|
|
96
|
-
<TableHead scope="col">{labels.columnCreated}</TableHead>
|
|
97
|
-
<TableHead scope="col">{labels.columnTier}</TableHead>
|
|
98
|
-
<TableHead scope="col">{labels.columnScore}</TableHead>
|
|
99
|
-
</TableRow>
|
|
100
|
-
</TableHeader>
|
|
101
|
-
<TableBody>
|
|
102
|
-
{rows.map(({ signup, created, score, tierDisplay }) => (
|
|
103
|
-
<TableRow
|
|
104
|
-
key={signup.leadId}
|
|
105
|
-
data-testid={`signups-table-row-${signup.leadId}`}
|
|
106
|
-
>
|
|
107
|
-
<TableCell>
|
|
108
|
-
<Link
|
|
109
|
-
href={`/${locale}/waitlist/${experimentId}/signups/${signup.leadId}`}
|
|
110
|
-
>
|
|
111
|
-
{signup.email}
|
|
112
|
-
</Link>
|
|
113
|
-
</TableCell>
|
|
114
|
-
<TableCell>{signup.waitlistKey}</TableCell>
|
|
115
|
-
<TableCell>{signup.source}</TableCell>
|
|
116
|
-
<TableCell>{created}</TableCell>
|
|
117
|
-
<TableCell>{tierDisplay ?? labels.unavailable}</TableCell>
|
|
118
|
-
<TableCell>{score ?? labels.unavailable}</TableCell>
|
|
119
|
-
</TableRow>
|
|
120
|
-
))}
|
|
121
|
-
</TableBody>
|
|
122
|
-
</Table>
|
|
123
|
-
{nextCursor !== null ? (
|
|
124
|
-
<div className="mt-3 flex justify-end">
|
|
125
|
-
<Link
|
|
126
|
-
href={buildNextHref(locale, experimentId, waitlist, nextCursor)}
|
|
127
|
-
data-testid="signups-table-next"
|
|
128
|
-
// 24px hit-area floor (Rule 14) — a bare inline link's
|
|
129
|
-
// line-height box falls short on its own (#4665, caught on the
|
|
130
|
-
// worker's own re-inspection of the render evidence).
|
|
131
|
-
className="inline-flex min-h-6 items-center px-2"
|
|
132
|
-
>
|
|
133
|
-
{labels.next}
|
|
134
|
-
</Link>
|
|
135
|
-
</div>
|
|
136
|
-
) : null}
|
|
137
|
-
</div>
|
|
138
|
-
);
|
|
139
|
-
}
|
package/templates/apps/web/app/[locale]/(authed)/waitlist/components/WaitlistComparisonTabs.tsx
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WaitlistComparisonTabs — the comparison view's per-waitlist tab strip
|
|
3
|
-
* (#4665 D10): one tab per waitlist, each showing a by-source
|
|
4
|
-
* MetricComparisonTable + one DistributionList per question.
|
|
5
|
-
*
|
|
6
|
-
* Composes the Tabs primitive (a client boundary — `packages/ui/src/
|
|
7
|
-
* primitives/Tabs.tsx` carries its own "use client") with server-rendered
|
|
8
|
-
* children; this file itself holds no hooks and stays a plain RSC-composable
|
|
9
|
-
* component.
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
import {
|
|
13
|
-
DistributionList,
|
|
14
|
-
MetricComparisonTable,
|
|
15
|
-
} from "@working-theory/ui/blocks";
|
|
16
|
-
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@working-theory/ui/primitives";
|
|
17
|
-
import type { ReactElement } from "react";
|
|
18
|
-
|
|
19
|
-
export interface WaitlistTab {
|
|
20
|
-
key: string;
|
|
21
|
-
label: string;
|
|
22
|
-
bySourceCaption: string;
|
|
23
|
-
/** Header label for the leading (source-name) row-header column. */
|
|
24
|
-
bySourceRowHeaderLabel: string;
|
|
25
|
-
bySourceColumns: Array<{ key: string; label: string }>;
|
|
26
|
-
bySourceRows: Array<{
|
|
27
|
-
key: string;
|
|
28
|
-
label: string;
|
|
29
|
-
cells: Record<string, { display: string; value: number | null }>;
|
|
30
|
-
}>;
|
|
31
|
-
distributions: Array<{
|
|
32
|
-
questionId: string;
|
|
33
|
-
title: string;
|
|
34
|
-
answered: number;
|
|
35
|
-
answeredLabel: string;
|
|
36
|
-
emptyLabel: string;
|
|
37
|
-
items: Array<{ label: string; count: number; share: number; display: string }>;
|
|
38
|
-
}>;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export interface WaitlistComparisonTabsProps {
|
|
42
|
-
tabs: WaitlistTab[];
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export function WaitlistComparisonTabs({
|
|
46
|
-
tabs,
|
|
47
|
-
}: WaitlistComparisonTabsProps): ReactElement | null {
|
|
48
|
-
if (tabs.length === 0) return null;
|
|
49
|
-
|
|
50
|
-
return (
|
|
51
|
-
<Tabs defaultValue={tabs[0]!.key} data-testid="waitlist-comparison-tabs">
|
|
52
|
-
<TabsList>
|
|
53
|
-
{tabs.map((tab) => (
|
|
54
|
-
<TabsTrigger key={tab.key} value={tab.key}>
|
|
55
|
-
{tab.label}
|
|
56
|
-
</TabsTrigger>
|
|
57
|
-
))}
|
|
58
|
-
</TabsList>
|
|
59
|
-
{tabs.map((tab) => (
|
|
60
|
-
<TabsContent key={tab.key} value={tab.key}>
|
|
61
|
-
<div className="flex flex-col gap-6">
|
|
62
|
-
<MetricComparisonTable
|
|
63
|
-
caption={tab.bySourceCaption}
|
|
64
|
-
columns={tab.bySourceColumns}
|
|
65
|
-
rows={tab.bySourceRows}
|
|
66
|
-
rowHeaderLabel={tab.bySourceRowHeaderLabel}
|
|
67
|
-
/>
|
|
68
|
-
<div className="flex flex-col gap-4">
|
|
69
|
-
{tab.distributions.map((distribution) => (
|
|
70
|
-
<DistributionList
|
|
71
|
-
key={distribution.questionId}
|
|
72
|
-
title={distribution.title}
|
|
73
|
-
answered={distribution.answered}
|
|
74
|
-
answeredLabel={distribution.answeredLabel}
|
|
75
|
-
items={distribution.items}
|
|
76
|
-
emptyLabel={distribution.emptyLabel}
|
|
77
|
-
/>
|
|
78
|
-
))}
|
|
79
|
-
</div>
|
|
80
|
-
</div>
|
|
81
|
-
</TabsContent>
|
|
82
|
-
))}
|
|
83
|
-
</Tabs>
|
|
84
|
-
);
|
|
85
|
-
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared status/mode chip mapping for the waitlist operator dashboard
|
|
3
|
-
* (#4665 D10) — used by ExperimentsTable's list rows and the comparison
|
|
4
|
-
* view's DetailHeader typeBadge.
|
|
5
|
-
*
|
|
6
|
-
* Composes the Badge primitive (visible text + a semantic variant), not the
|
|
7
|
-
* icon-only StatusBadge primitive — StatusBadge renders a decorative glyph
|
|
8
|
-
* with an `aria-label` and carries no visible text
|
|
9
|
-
* (`packages/ui/src/primitives/StatusBadge.tsx`), so it cannot satisfy AC1's
|
|
10
|
-
* "status visible" requirement on its own. This mirrors the established
|
|
11
|
-
* `PaymentStatusBadge` block precedent (`packages/ui/src/blocks/
|
|
12
|
-
* PaymentStatusBadge.tsx`): a labeled status chip is a `Badge` with a status
|
|
13
|
-
* → variant map, not `StatusBadge`.
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
import { Badge, type BadgeProps } from "@working-theory/ui/primitives";
|
|
17
|
-
import type { WaitlistMode, WaitlistStatus } from "@working-theory/validation";
|
|
18
|
-
import type { ReactElement } from "react";
|
|
19
|
-
|
|
20
|
-
const STATUS_VARIANT: Record<WaitlistStatus, BadgeProps["variant"]> = {
|
|
21
|
-
live: "success",
|
|
22
|
-
closed: "muted",
|
|
23
|
-
draft: "outline",
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
const MODE_VARIANT: Record<WaitlistMode, BadgeProps["variant"]> = {
|
|
27
|
-
"lead-capture": "secondary",
|
|
28
|
-
qualifying: "info",
|
|
29
|
-
paid: "featured",
|
|
30
|
-
// #4767 — the register's fourth mode; the engine/UI that reads it are
|
|
31
|
-
// sibling children of Epic #4758 (out of scope here). A placeholder
|
|
32
|
-
// variant only, so `Record<WaitlistMode, …>` stays exhaustive.
|
|
33
|
-
recommending: "success",
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export function ExperimentStatusBadge({
|
|
37
|
-
status,
|
|
38
|
-
label,
|
|
39
|
-
}: {
|
|
40
|
-
status: WaitlistStatus;
|
|
41
|
-
label: string;
|
|
42
|
-
}): ReactElement {
|
|
43
|
-
return (
|
|
44
|
-
<Badge
|
|
45
|
-
variant={STATUS_VARIANT[status]}
|
|
46
|
-
size="sm"
|
|
47
|
-
role="status"
|
|
48
|
-
data-testid="experiment-status-badge"
|
|
49
|
-
>
|
|
50
|
-
{label}
|
|
51
|
-
</Badge>
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export function ExperimentModeBadge({
|
|
56
|
-
mode,
|
|
57
|
-
label,
|
|
58
|
-
}: {
|
|
59
|
-
mode: WaitlistMode;
|
|
60
|
-
label: string;
|
|
61
|
-
}): ReactElement {
|
|
62
|
-
return (
|
|
63
|
-
<Badge variant={MODE_VARIANT[mode]} size="sm" data-testid="experiment-mode-badge">
|
|
64
|
-
{label}
|
|
65
|
-
</Badge>
|
|
66
|
-
);
|
|
67
|
-
}
|