create-ailk 0.34.1 → 0.36.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/README.md +1 -1
- package/component-catalog.json +37 -4
- package/component-catalog.md +11 -9
- package/dist/add-module.js +7 -2
- package/dist/derive-architecture.js +2 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/lib/env-catalog.js +8 -0
- package/dist/module-architecture.js +9 -0
- package/dist/programmatic.js +5 -2
- package/dist/site-listing-path.d.ts +8 -0
- package/dist/site-listing-path.js +8 -0
- package/dist/surfaces.d.ts +20 -0
- package/dist/surfaces.js +32 -3
- package/dist/template-record.js +2 -0
- package/dist/topology.d.ts +4 -4
- package/dist/topology.js +104 -60
- package/dist/update.js +11 -0
- package/package.json +3 -3
- package/templates/.env.example +21 -0
- package/templates/apps/api/.env.example +7 -0
- package/templates/apps/api/CLAUDE.md +14 -9
- package/templates/apps/mcp/CLAUDE.md +18 -7
- package/templates/apps/web/.env.example +16 -0
- package/templates/apps/web/CLAUDE.md +46 -5
- package/templates/apps/web/app/[locale]/(auth)/__tests__/password-reset.test.tsx +2 -0
- package/templates/apps/web/app/[locale]/(auth)/sign-in/__tests__/page.test.tsx +52 -1
- package/templates/apps/web/app/[locale]/(auth)/sign-in/__tests__/remembered-method.test.ts +43 -0
- package/templates/apps/web/app/[locale]/(auth)/sign-in/__tests__/sign-in-card.test.tsx +108 -1
- package/templates/apps/web/app/[locale]/(auth)/sign-in/page.tsx +36 -3
- package/templates/apps/web/app/[locale]/(auth)/sign-in/remembered-method.ts +37 -0
- package/templates/apps/web/app/[locale]/(auth)/sign-in/sign-in-card.tsx +90 -33
- package/templates/apps/web/app/[locale]/(auth)/sign-in/sign-in-text.ts +9 -4
- package/templates/apps/web/app/[locale]/(authed)/__tests__/gate.test.tsx +79 -348
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/billing.test.tsx +12 -1
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/hub-mode.test.tsx +55 -2
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/item.test.tsx +43 -0
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/layout-sign-out.test.tsx +10 -5
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/page.test.tsx +6 -5
- package/templates/apps/web/app/[locale]/(authed)/account/account-frame.tsx +1 -1
- package/templates/apps/web/app/[locale]/(authed)/account/billing/page.tsx +60 -6
- package/templates/apps/web/app/[locale]/(authed)/account/billing-source.ts +32 -3
- package/templates/apps/web/app/[locale]/(authed)/account/connect/__tests__/page.test.tsx +8 -1
- package/templates/apps/web/app/[locale]/(authed)/account/connect/page.tsx +7 -3
- package/templates/apps/web/app/[locale]/(authed)/account/general/__tests__/phone-verification.test.tsx +215 -0
- package/templates/apps/web/app/[locale]/(authed)/account/general/__tests__/seam-imports.test.ts +65 -0
- package/templates/apps/web/app/[locale]/(authed)/account/general/page.tsx +47 -0
- package/templates/apps/web/app/[locale]/(authed)/account/general/phone-actions.ts +122 -0
- package/templates/apps/web/app/[locale]/(authed)/account/general/phone-verification.tsx +214 -0
- package/templates/apps/web/app/[locale]/(authed)/account/inbox/[kind]/[id]/page.tsx +6 -1
- package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/__tests__/invitation-id.test.ts +35 -0
- package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/__tests__/page.test.tsx +266 -0
- package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/actions.ts +116 -0
- package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/invitation-id.ts +12 -0
- package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/page.tsx +154 -0
- package/templates/apps/web/app/[locale]/(authed)/account/layout.tsx +6 -4
- package/templates/apps/web/app/[locale]/(authed)/account/security/page.tsx +3 -1
- package/templates/apps/web/app/[locale]/(authed)/layout.tsx +15 -13
- package/templates/apps/web/app/[locale]/(authed)/signed-out-gate.generated.tsx +20 -52
- package/templates/apps/web/app/[locale]/flows/[slug]/FlowStepperClient.tsx +43 -4
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.deliverable.test.tsx +23 -9
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.invite.test.tsx +15 -0
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.permalink.test.tsx +74 -0
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.test.tsx +34 -1
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/magnet-page.test.tsx +257 -4
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/save.actions.test.ts +72 -92
- package/templates/apps/web/app/[locale]/flows/[slug]/email-moment.ts +2 -2
- package/templates/apps/web/app/[locale]/flows/[slug]/magnet-page.tsx +164 -65
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/LevelChart.tsx +100 -0
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/ResultsCard.tsx +99 -0
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/ResultsClient.tsx +415 -253
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/ResultsEmailStep.tsx +113 -32
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/ResultsClient.no-commerce.test.tsx +16 -17
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/ResultsClient.report.test.tsx +284 -0
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/by-result.test.tsx +52 -19
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/cards.test.tsx +402 -0
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/page.test.tsx +100 -12
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/score.test.tsx +153 -101
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/meeting-seam.ts +36 -0
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/page.tsx +121 -33
- package/templates/apps/web/app/[locale]/flows/[slug]/save.actions.ts +27 -17
- package/templates/apps/web/app/[locale]/flows/[slug]/served-flow.ts +91 -0
- package/templates/apps/web/app/[locale]/layout.tsx +42 -76
- package/templates/apps/web/app/[locale]/purchase/__tests__/success.test.tsx +50 -0
- package/templates/apps/web/app/[locale]/purchase/success/page.tsx +48 -7
- package/templates/apps/web/app/api/auth/hub/__tests__/entry-routes.test.ts +749 -0
- package/templates/apps/web/app/api/auth/hub/authorize/__tests__/route.test.ts +189 -6
- package/templates/apps/web/app/api/auth/hub/authorize/route.ts +101 -31
- package/templates/apps/web/app/api/auth/hub/continuation.ts +51 -2
- package/templates/apps/web/app/api/auth/hub/email/route.ts +111 -0
- package/templates/apps/web/app/api/auth/hub/entry-shared.ts +163 -0
- package/templates/apps/web/app/api/auth/hub/purchase/route.ts +230 -0
- package/templates/apps/web/app/api/auth/hub/purchase-link/route.ts +174 -0
- package/templates/apps/web/app/api/auth/hub/sign-up/route.ts +60 -0
- package/templates/apps/web/app/api/auth/hub/sign-up-evidence.ts +97 -0
- package/templates/apps/web/app/api/hub-session/__tests__/routes.test.ts +475 -7
- package/templates/apps/web/app/api/hub-session/callback/route.ts +13 -47
- package/templates/apps/web/app/api/hub-session/email/route.ts +125 -0
- package/templates/apps/web/app/api/hub-session/one-tap/nonce/route.ts +49 -0
- package/templates/apps/web/app/api/hub-session/one-tap/route.ts +106 -0
- package/templates/apps/web/app/api/hub-session/open/route.ts +111 -0
- package/templates/apps/web/app/api/hub-session/sign-in/route.ts +23 -40
- package/templates/apps/web/app/api/hub-session/sign-out/route.ts +1 -10
- package/templates/apps/web/app/llms.txt/__tests__/site-listing.test.ts +122 -0
- package/templates/apps/web/app/llms.txt/route.ts +14 -2
- package/templates/apps/web/app/sitemap.xml/__tests__/site-listing.test.ts +98 -0
- package/templates/apps/web/app/sitemap.xml/route.ts +13 -2
- package/templates/apps/web/auth.ts +133 -6
- package/templates/apps/web/components/sign-out-trigger.tsx +1 -1
- package/templates/apps/web/lib/__tests__/auth-email.test.ts +141 -0
- package/templates/apps/web/lib/__tests__/auth-phone.test.ts +445 -0
- package/templates/apps/web/lib/__tests__/auth-sms.test.ts +140 -0
- package/templates/apps/web/lib/__tests__/fixtures/tsconfig.flow.json +18 -0
- package/templates/apps/web/lib/__tests__/site-header.test.ts +13 -0
- package/templates/apps/web/lib/__tests__/telemetry-scrub.test.ts +19 -1
- package/templates/apps/web/lib/account-config.ts +24 -9
- package/templates/apps/web/lib/auth-email.ts +62 -6
- package/templates/apps/web/lib/auth-env.ts +13 -0
- package/templates/apps/web/lib/auth-sms.ts +180 -0
- package/templates/apps/web/lib/hub-session/__tests__/hub-session.test.ts +28 -0
- package/templates/apps/web/lib/hub-session/__tests__/spoke-sign-in.test.tsx +332 -0
- package/templates/apps/web/lib/hub-session/config.ts +7 -1
- package/templates/apps/web/lib/hub-session/entry.ts +238 -0
- package/templates/apps/web/lib/hub-session/index.ts +1 -4
- package/templates/apps/web/lib/hub-session/one-tap.tsx +148 -0
- package/templates/apps/web/lib/hub-session/session.ts +120 -2
- package/templates/apps/web/lib/hub-session/spoke-sign-in.tsx +277 -0
- package/templates/apps/web/lib/site-header.ts +14 -1
- package/templates/apps/web/lib/site-listing.ts +7 -0
- package/templates/apps/web/lib/telemetry-scrub.ts +11 -0
- package/templates/apps/web/lib/topology.generated.ts +39 -0
- package/templates/apps/web/messages/en.json +125 -21
- package/templates/apps/web/middleware.ts +34 -2
- package/templates/apps/web/security-headers.config.ts +21 -0
- package/versions.json +47 -47
- package/templates/apps/web/app/[locale]/(authed)/sign-in-gate.tsx +0 -162
- package/templates/apps/web/components/signed-in-nav.tsx +0 -79
- package/templates/apps/web/lib/hub-session/__tests__/sign-in-gate.test.tsx +0 -180
- package/templates/apps/web/lib/hub-session/sign-in-gate.tsx +0 -162
|
@@ -3,13 +3,25 @@
|
|
|
3
3
|
* magnet-page.tsx — the standard magnet page pair (#8840 D8).
|
|
4
4
|
*
|
|
5
5
|
* Every multi-step magnet is two pages, the canon's #5053 split moved to the
|
|
6
|
-
* magnet's own path: an indexable LANDING (`/<magnet>`,
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* `
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
6
|
+
* magnet's own path: an indexable LANDING (`/<magnet>`, the flow record's
|
|
7
|
+
* `landing` copy with a CTA to `/<magnet>/start` and the `Assessment` page
|
|
8
|
+
* type's single-layer `WebApplication` JSON-LD) and a `noindex, follow`
|
|
9
|
+
* WALK (`/<magnet>/start`, or the `startPath` a landing names, as `/trial`
|
|
10
|
+
* names `/trial/request` — #9287 DD10; chrome-free by `lib/magnet-routes.ts`).
|
|
11
|
+
*
|
|
12
|
+
* #11013 (spec E, D-A, D-B, D-D) — a multi-step magnet's landing is the
|
|
13
|
+
* TITLE PAGE: the same takeover window the walk lives in (`FlowFrame`, no
|
|
14
|
+
* bar, the site's logomark and wordmark on the left and one `Esc ×` exit to
|
|
15
|
+
* the site's home on the right, no header title), holding one `h1` (the
|
|
16
|
+
* landing title at `--flow-title-size`), the description, the button to the
|
|
17
|
+
* walk and a Time line — the record's `landing.meta`, else the counted
|
|
18
|
+
* steps ÷ 5 as "~ {n} min". The site chrome stays in the document under the
|
|
19
|
+
* overlay, so the page keeps its URL and its JSON-LD and stays indexable; a
|
|
20
|
+
* one-step flow keeps the centred hero inside the chrome. The walk hands
|
|
21
|
+
* `FlowStepperClient` the frame's brand (the marks and the landing title)
|
|
22
|
+
* and an exit to where the walk was entered from — the landing, or the
|
|
23
|
+
* posting — in place of the back arrow; the unavailable fallback keeps the
|
|
24
|
+
* arrow.
|
|
13
25
|
* This module is the only code that renders either half: `/flows/<slug>`,
|
|
14
26
|
* the careers apply pages and every pair `create-ailk add-route magnet`
|
|
15
27
|
* writes are callers of the factories below.
|
|
@@ -19,9 +31,11 @@
|
|
|
19
31
|
* burst of views make one hub read. A slug the schema refuses is `absent`
|
|
20
32
|
* with no read and no cache entry, each insert first drops the stale
|
|
21
33
|
* entries, and the map holds at most 256 slugs, so random URLs cannot grow
|
|
22
|
-
* it (SEC-8840-G).
|
|
23
|
-
*
|
|
24
|
-
*
|
|
34
|
+
* it (SEC-8840-G). The read itself is `served-flow.ts`'s `readServedFlow`
|
|
35
|
+
* (#10990 D1): anything but a served flow or a 404 — a refused connection, a
|
|
36
|
+
* 5xx, a 403 or 429, a 2xx that is not a flow, no answer within 5 s — is
|
|
37
|
+
* `unavailable`: both pages then show the site's contact email instead of a
|
|
38
|
+
* 500, are `noindex`, and retry nothing. A site
|
|
25
39
|
* with no hub to ask — the read answers 503 `flows_not_configured`, or a
|
|
26
40
|
* failed read with no API origin configured — is `not-configured` (#9219);
|
|
27
41
|
* a pair renders it as `unavailable`, and `/reports/<slug>` uses it to 404
|
|
@@ -37,24 +51,37 @@
|
|
|
37
51
|
* hand it over and an ungated deliverable never gets a form here. The
|
|
38
52
|
* deliverable's own walk calls `renderMagnetStart` with `asDeliverable`.
|
|
39
53
|
*/
|
|
40
|
-
import { flows } from "@working-theory/api-client";
|
|
41
54
|
import { JsonLd } from "@working-theory/jsonld";
|
|
42
55
|
import { flowRouteMetadata } from "@working-theory/metadata";
|
|
43
56
|
import { buildJsonLd } from "@working-theory/schema";
|
|
44
|
-
import {
|
|
57
|
+
import type { FlowFrameBrand, FlowFramePresentation } from "@working-theory/ui";
|
|
58
|
+
import {
|
|
59
|
+
Button,
|
|
60
|
+
ContactFallback,
|
|
61
|
+
Container,
|
|
62
|
+
FlowFrame,
|
|
63
|
+
Heading,
|
|
64
|
+
Icon,
|
|
65
|
+
Link,
|
|
66
|
+
localeHref,
|
|
67
|
+
Text,
|
|
68
|
+
} from "@working-theory/ui";
|
|
45
69
|
import { NavBackLink } from "@working-theory/ui/chrome";
|
|
70
|
+
import { Image } from "@working-theory/ui/primitives";
|
|
46
71
|
import { SectionRenderer } from "@working-theory/ui/sections";
|
|
47
72
|
import type { FlowConfig, PageSection } from "@working-theory/validation";
|
|
48
73
|
import { flowSlugSchema, resolveLocalizedString } from "@working-theory/validation";
|
|
74
|
+
import { ArrowRight } from "lucide-react";
|
|
49
75
|
import type { Metadata } from "next";
|
|
50
76
|
import { notFound, redirect } from "next/navigation";
|
|
51
77
|
import { getTranslations } from "next-intl/server";
|
|
52
|
-
import type { ReactElement } from "react";
|
|
78
|
+
import type { CSSProperties, ReactElement } from "react";
|
|
53
79
|
|
|
54
|
-
import {
|
|
80
|
+
import { siteLogo, siteWordmarkAsset } from "../../../../lib/site-logo";
|
|
55
81
|
import { readSiteContactEmail } from "../../contact/site-contact-email";
|
|
56
82
|
|
|
57
83
|
import { FlowStepperClient } from "./FlowStepperClient";
|
|
84
|
+
import { type MagnetRead, readServedFlow } from "./served-flow";
|
|
58
85
|
|
|
59
86
|
/** The marker every standard magnet page carries in its header comment (D13). */
|
|
60
87
|
export const MAGNET_PAGE_MARKER = "Standard magnet page (#8840)";
|
|
@@ -65,52 +92,42 @@ const MAGNET_READ_TTL_MS = 15_000;
|
|
|
65
92
|
/** At most this many slugs are held at once; past it a read is not shared. */
|
|
66
93
|
const MAGNET_READ_MAX_ENTRIES = 256;
|
|
67
94
|
|
|
68
|
-
export type MagnetRead
|
|
69
|
-
| { kind: "ok"; config: FlowConfig }
|
|
70
|
-
| { kind: "absent" }
|
|
71
|
-
| { kind: "unavailable" }
|
|
72
|
-
| { kind: "not-configured" };
|
|
95
|
+
export type { MagnetRead } from "./served-flow";
|
|
73
96
|
|
|
74
|
-
|
|
97
|
+
// Mirrors `FlowStepperClient.tsx` (#4707) — a path the frame's exit follows
|
|
98
|
+
// is built only from an enabled locale, never the raw route segment.
|
|
99
|
+
const DEFAULT_LOCALE = "en";
|
|
100
|
+
const ENABLED_LOCALES = (process.env.NEXT_PUBLIC_ENABLED_LOCALES ?? DEFAULT_LOCALE).split(",");
|
|
75
101
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
* packages/api-client/src/http.ts reads, in step with it on a hub. Without one
|
|
79
|
-
* that function answers `localhost:3001`. The browser-facing origin comes from
|
|
80
|
-
* the topology seam (#7874 D12), which a spoke renders with no env read, so a
|
|
81
|
-
* spoke passes its own `env:check` (#9480). A spoke diverges on purpose: the
|
|
82
|
-
* browser-facing name set on one at runtime counts as no origin here.
|
|
83
|
-
*/
|
|
84
|
-
function apiOriginConfigured(): boolean {
|
|
85
|
-
return Boolean(
|
|
86
|
-
process.env.AILK_API_URL ||
|
|
87
|
-
browserApiOrigin() ||
|
|
88
|
-
process.env.NEXT_PUBLIC_API_URL,
|
|
89
|
-
);
|
|
102
|
+
function resolveSafeLocale(candidate: string): string {
|
|
103
|
+
return ENABLED_LOCALES.includes(candidate) ? candidate : DEFAULT_LOCALE;
|
|
90
104
|
}
|
|
91
105
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
106
|
+
// #11013 decision 21 / spec E D-B — the title's size, read from
|
|
107
|
+
// `--flow-title-size` with the heading-1 role as its fallback (heading-2
|
|
108
|
+
// below `md:`), declared under this page's own property names so a site's
|
|
109
|
+
// one-line `:root` declaration wins (the `FLOW_QUESTION_SIZE_STYLE` idiom).
|
|
110
|
+
const FLOW_TITLE_SIZE_STYLE = {
|
|
111
|
+
"--ailk-flow-title-size": "var(--flow-title-size, var(--text-heading-1))",
|
|
112
|
+
"--ailk-flow-title-size-sm": "var(--flow-title-size, var(--text-heading-2))",
|
|
113
|
+
} as CSSProperties;
|
|
114
|
+
const FLOW_TITLE_HEADING_CLASS =
|
|
115
|
+
"text-balance text-(length:--ailk-flow-title-size-sm) md:text-(length:--ailk-flow-title-size)";
|
|
97
116
|
|
|
98
|
-
/** A
|
|
99
|
-
function
|
|
100
|
-
return
|
|
117
|
+
/** #11013 D-A — the frame's brand marks: the site's logomark and wordmark, built on the server. */
|
|
118
|
+
function brandMarks(): Pick<FlowFrameBrand, "logomark" | "wordmark"> {
|
|
119
|
+
return { logomark: siteLogo(), wordmark: <Image {...siteWordmarkAsset()} /> };
|
|
101
120
|
}
|
|
102
121
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
return res.status >= 500 ? failedRead() : { kind: "absent" };
|
|
109
|
-
} catch {
|
|
110
|
-
return failedRead();
|
|
111
|
-
}
|
|
122
|
+
/** #11013 D-D — the Time line: the owner's words, else the counted steps ÷ 5. */
|
|
123
|
+
function landingTime(config: FlowConfig, meta: string | undefined, t: (key: "landingTime", values: { minutes: number }) => string): string {
|
|
124
|
+
if (meta !== undefined) return meta;
|
|
125
|
+
const counted = config.steps.filter((step) => step.type !== "message").length;
|
|
126
|
+
return t("landingTime", { minutes: Math.max(1, Math.round(counted / 5)) });
|
|
112
127
|
}
|
|
113
128
|
|
|
129
|
+
const magnetReads = new Map<string, { at: number; read: Promise<MagnetRead> }>();
|
|
130
|
+
|
|
114
131
|
/** The served flow config for `slug`, shared per instance for 15 seconds. */
|
|
115
132
|
export function readMagnet(slug: string): Promise<MagnetRead> {
|
|
116
133
|
if (!flowSlugSchema.safeParse(slug).success) {
|
|
@@ -122,7 +139,7 @@ export function readMagnet(slug: string): Promise<MagnetRead> {
|
|
|
122
139
|
for (const [key, entry] of magnetReads) {
|
|
123
140
|
if (now - entry.at >= MAGNET_READ_TTL_MS) magnetReads.delete(key);
|
|
124
141
|
}
|
|
125
|
-
const read =
|
|
142
|
+
const read = readServedFlow(slug);
|
|
126
143
|
if (magnetReads.size < MAGNET_READ_MAX_ENTRIES) magnetReads.set(slug, { at: now, read });
|
|
127
144
|
return read;
|
|
128
145
|
}
|
|
@@ -204,6 +221,88 @@ export async function renderMagnetLanding({
|
|
|
204
221
|
if (read.config.deliverable !== undefined) redirect(localeHref(locale, `/reports/${slug}`));
|
|
205
222
|
|
|
206
223
|
const copy = await landingCopy(read.config, locale);
|
|
224
|
+
const jsonLd = (
|
|
225
|
+
<JsonLd
|
|
226
|
+
schema={buildJsonLd({
|
|
227
|
+
type: "Assessment",
|
|
228
|
+
slug: read.config.slug,
|
|
229
|
+
title: copy.title,
|
|
230
|
+
description: copy.description,
|
|
231
|
+
locale,
|
|
232
|
+
})}
|
|
233
|
+
/>
|
|
234
|
+
);
|
|
235
|
+
|
|
236
|
+
// #11013 D-B — a multi-step magnet's landing is the takeover title page.
|
|
237
|
+
if (read.config.steps.length > 1) {
|
|
238
|
+
const t = await getTranslations({ locale, namespace: "flow" });
|
|
239
|
+
return (
|
|
240
|
+
<>
|
|
241
|
+
{jsonLd}
|
|
242
|
+
<main>
|
|
243
|
+
<FlowFrame
|
|
244
|
+
takeover
|
|
245
|
+
barMode="none"
|
|
246
|
+
brand={brandMarks()}
|
|
247
|
+
exit={{ href: `/${resolveSafeLocale(locale)}`, label: t("exitLabel") }}
|
|
248
|
+
data-testid="flow-title-frame"
|
|
249
|
+
>
|
|
250
|
+
{/* On a phone the copy scrolls in its own column and the button row sits
|
|
251
|
+
below it (the board's dock), so the frame's middle region never
|
|
252
|
+
overflows and its bottom fade (decision 23) never dims the primary;
|
|
253
|
+
from `md:` the row follows the description in normal flow. */}
|
|
254
|
+
<div
|
|
255
|
+
data-testid="flow-title-page"
|
|
256
|
+
className="flex min-h-0 w-full flex-1 flex-col md:justify-center"
|
|
257
|
+
style={FLOW_TITLE_SIZE_STYLE}
|
|
258
|
+
>
|
|
259
|
+
<div
|
|
260
|
+
data-testid="flow-title-scroller"
|
|
261
|
+
className="min-h-0 flex-1 overflow-y-auto md:min-h-fit md:flex-none md:overflow-visible"
|
|
262
|
+
>
|
|
263
|
+
<div className="mx-auto w-full max-w-container-sm px-5 pt-3 md:px-6 md:pt-8">
|
|
264
|
+
<Heading level={1} className={FLOW_TITLE_HEADING_CLASS}>
|
|
265
|
+
{copy.title}
|
|
266
|
+
</Heading>
|
|
267
|
+
<Text
|
|
268
|
+
variant="lead"
|
|
269
|
+
tone="muted"
|
|
270
|
+
className="mt-block-tight max-w-prose text-pretty"
|
|
271
|
+
data-testid="flow-title-description"
|
|
272
|
+
>
|
|
273
|
+
{copy.description}
|
|
274
|
+
</Text>
|
|
275
|
+
</div>
|
|
276
|
+
</div>
|
|
277
|
+
{/* Decision 9 — the button under the description, with Time just below it;
|
|
278
|
+
on a phone full width and anchored to the screen bottom. */}
|
|
279
|
+
<div
|
|
280
|
+
className="mx-auto flex w-full max-w-container-sm shrink-0 flex-col gap-3 px-5 pt-6 pb-(--ailk-flow-safe-bottom) md:mt-block-loose md:items-start md:px-6 md:pb-10"
|
|
281
|
+
style={{ "--ailk-flow-safe-bottom": "max(env(safe-area-inset-bottom, 0px), 1.25rem)" } as CSSProperties}
|
|
282
|
+
>
|
|
283
|
+
<Button asChild size="big" className="min-h-11 w-full md:w-auto">
|
|
284
|
+
<Link href={localeHref(locale, startPath)} variant="bare" data-testid="flow-title-cta">
|
|
285
|
+
{copy.cta}
|
|
286
|
+
<Icon icon={ArrowRight} size="sm" decorative />
|
|
287
|
+
</Link>
|
|
288
|
+
</Button>
|
|
289
|
+
<Text
|
|
290
|
+
as="span"
|
|
291
|
+
variant="body-sm"
|
|
292
|
+
tone="muted"
|
|
293
|
+
className="text-center tabular-nums md:text-start"
|
|
294
|
+
data-testid="flow-title-time"
|
|
295
|
+
>
|
|
296
|
+
{landingTime(read.config, copy.meta, t)}
|
|
297
|
+
</Text>
|
|
298
|
+
</div>
|
|
299
|
+
</div>
|
|
300
|
+
</FlowFrame>
|
|
301
|
+
</main>
|
|
302
|
+
</>
|
|
303
|
+
);
|
|
304
|
+
}
|
|
305
|
+
|
|
207
306
|
const sections: PageSection[] = [
|
|
208
307
|
{
|
|
209
308
|
id: "flow-landing-hero",
|
|
@@ -220,15 +319,7 @@ export async function renderMagnetLanding({
|
|
|
220
319
|
|
|
221
320
|
return (
|
|
222
321
|
<>
|
|
223
|
-
|
|
224
|
-
schema={buildJsonLd({
|
|
225
|
-
type: "Assessment",
|
|
226
|
-
slug: read.config.slug,
|
|
227
|
-
title: copy.title,
|
|
228
|
-
description: copy.description,
|
|
229
|
-
locale,
|
|
230
|
-
})}
|
|
231
|
-
/>
|
|
322
|
+
{jsonLd}
|
|
232
323
|
<main>
|
|
233
324
|
<SectionRenderer sections={sections} locale={locale} />
|
|
234
325
|
</main>
|
|
@@ -253,8 +344,10 @@ export async function renderMagnetLandingMetadata({
|
|
|
253
344
|
export interface MagnetStartInput {
|
|
254
345
|
slug: string;
|
|
255
346
|
locale: string;
|
|
256
|
-
/** Where the
|
|
347
|
+
/** Where the frame's Esc goes, unlocalized (the landing, or the posting); the fallback's back arrow too. */
|
|
257
348
|
backHref: string;
|
|
349
|
+
/** #11013 decision 2 — the frame's presentation; absent, the stepper's own default (a window). */
|
|
350
|
+
presentation?: FlowFramePresentation;
|
|
258
351
|
/** Page-supplied `hidden` field values (a posting's slug as `job`). */
|
|
259
352
|
hiddenValues?: Readonly<Record<string, string>>;
|
|
260
353
|
/** Replaces step 1's title at every locale it holds (a posting's title). */
|
|
@@ -284,6 +377,7 @@ export async function renderMagnetStart({
|
|
|
284
377
|
firstStepTitle,
|
|
285
378
|
asDeliverable = false,
|
|
286
379
|
title,
|
|
380
|
+
presentation,
|
|
287
381
|
}: MagnetStartInput): Promise<ReactElement> {
|
|
288
382
|
const read = await readMagnet(slug);
|
|
289
383
|
if (read.kind === "absent" && title === undefined) notFound();
|
|
@@ -291,11 +385,12 @@ export async function renderMagnetStart({
|
|
|
291
385
|
redirect(localeHref(locale, `/reports/${slug}/start`));
|
|
292
386
|
}
|
|
293
387
|
const t = await getTranslations({ locale, namespace: "flow" });
|
|
294
|
-
const back = <NavBackLink href={localeHref(locale, backHref)} label={t("back")} />;
|
|
295
388
|
if (read.kind !== "ok") {
|
|
296
389
|
return (
|
|
297
390
|
<>
|
|
298
|
-
<div className="px-control-x pt-control-y">
|
|
391
|
+
<div className="px-control-x pt-control-y">
|
|
392
|
+
<NavBackLink href={localeHref(locale, backHref)} label={t("back")} />
|
|
393
|
+
</div>
|
|
299
394
|
{await magnetUnavailable(locale, title)}
|
|
300
395
|
</>
|
|
301
396
|
);
|
|
@@ -303,12 +398,16 @@ export async function renderMagnetStart({
|
|
|
303
398
|
|
|
304
399
|
const config =
|
|
305
400
|
firstStepTitle !== undefined ? withFirstStepTitle(read.config, firstStepTitle) : read.config;
|
|
401
|
+
// #11013 D-A — the frame's brand header and the Esc exit replace the back arrow.
|
|
402
|
+
const brand: FlowFrameBrand = { ...brandMarks(), title: (await landingCopy(read.config, locale)).title };
|
|
306
403
|
return (
|
|
307
404
|
<FlowStepperClient
|
|
308
405
|
config={config}
|
|
309
406
|
locale={locale}
|
|
310
407
|
slug={read.config.slug}
|
|
311
|
-
|
|
408
|
+
brand={brand}
|
|
409
|
+
exit={{ href: `/${resolveSafeLocale(locale)}${backHref}`, label: t("exitLabel") }}
|
|
410
|
+
{...(presentation !== undefined ? { presentation } : {})}
|
|
312
411
|
{...(hiddenValues !== undefined ? { hiddenValues } : {})}
|
|
313
412
|
/>
|
|
314
413
|
);
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
// oss: false
|
|
2
|
+
/**
|
|
3
|
+
* LevelChart — the results page's Level chart (#11013 decision 10, spec E
|
|
4
|
+
* D-E).
|
|
5
|
+
*
|
|
6
|
+
* Five equal columns numbered 01–05, one per Level (equal fifths of all
|
|
7
|
+
* points, #11034), drawn as a bell — the shape only, never counted
|
|
8
|
+
* respondents (README § Later). The respondent's own Level is filled and a
|
|
9
|
+
* line marks their rounded share of all points. The Level and the share are
|
|
10
|
+
* the evaluator's (`evaluateWaitlistScoring`), computed from the unrounded
|
|
11
|
+
* value; only the marker's position and the accessible name's `{pct}` round.
|
|
12
|
+
*
|
|
13
|
+
* The marker is placed through one `--flow-level-marker` custom property — a
|
|
14
|
+
* per-render data value, the `style` carve-out `.claude/rules/frontend.md`
|
|
15
|
+
* admits — so no arbitrary-value class is needed. This page's alone: it is
|
|
16
|
+
* not a package component (D-E).
|
|
17
|
+
*/
|
|
18
|
+
import { Text } from "@working-theory/ui";
|
|
19
|
+
import type { CSSProperties, ReactElement } from "react";
|
|
20
|
+
|
|
21
|
+
/** The bell the five columns draw, by Level (decision 10). */
|
|
22
|
+
const COLUMN_HEIGHTS = ["h-1/4", "h-1/2", "h-full", "h-1/2", "h-1/4"] as const;
|
|
23
|
+
|
|
24
|
+
export interface LevelChartProps {
|
|
25
|
+
/** The respondent's Level, 1–5. */
|
|
26
|
+
level: number;
|
|
27
|
+
/** Their share of all points, 0–100, unrounded. */
|
|
28
|
+
pct: number;
|
|
29
|
+
/** The chart's accessible name (`flow.levelChartLabel`). */
|
|
30
|
+
label: string;
|
|
31
|
+
className?: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function LevelChart({ level, pct, label, className }: LevelChartProps): ReactElement {
|
|
35
|
+
const marker = Math.round(Math.min(100, Math.max(0, pct)));
|
|
36
|
+
// A numeric unit on a decorative marker; the chart's accessible name carries the message.
|
|
37
|
+
const markerLabel = `${marker}%`;
|
|
38
|
+
return (
|
|
39
|
+
<div
|
|
40
|
+
role="img"
|
|
41
|
+
aria-label={label}
|
|
42
|
+
data-testid="flow-level-chart"
|
|
43
|
+
className={["pt-7", className].filter(Boolean).join(" ")}
|
|
44
|
+
>
|
|
45
|
+
<div
|
|
46
|
+
className="relative grid h-28 grid-cols-5 items-end gap-1 border-b border-(--color-fg) md:h-32"
|
|
47
|
+
style={{ "--flow-level-marker": `${marker}%` } as CSSProperties}
|
|
48
|
+
>
|
|
49
|
+
{COLUMN_HEIGHTS.map((height, index) => {
|
|
50
|
+
const n = index + 1;
|
|
51
|
+
const filled = n === level;
|
|
52
|
+
return (
|
|
53
|
+
<div
|
|
54
|
+
key={n}
|
|
55
|
+
data-testid={`flow-level-chart-column-${n}`}
|
|
56
|
+
data-level={n}
|
|
57
|
+
data-filled={filled ? "true" : "false"}
|
|
58
|
+
className="relative flex h-full items-end"
|
|
59
|
+
>
|
|
60
|
+
<div
|
|
61
|
+
aria-hidden="true"
|
|
62
|
+
className={[
|
|
63
|
+
"w-full",
|
|
64
|
+
height,
|
|
65
|
+
// The ScoreBar track's token, so the columns flip with the palette.
|
|
66
|
+
filled ? "bg-(--color-accent)" : "bg-(--color-border-strong)",
|
|
67
|
+
].join(" ")}
|
|
68
|
+
/>
|
|
69
|
+
<span className="absolute inset-x-0 top-full mt-2 text-center">
|
|
70
|
+
<Text
|
|
71
|
+
as="span"
|
|
72
|
+
variant="caption"
|
|
73
|
+
tone={filled ? "default" : "muted"}
|
|
74
|
+
className={filled ? "font-semibold tabular-nums" : "tabular-nums"}
|
|
75
|
+
>
|
|
76
|
+
{String(n).padStart(2, "0")}
|
|
77
|
+
</Text>
|
|
78
|
+
</span>
|
|
79
|
+
</div>
|
|
80
|
+
);
|
|
81
|
+
})}
|
|
82
|
+
<span
|
|
83
|
+
aria-hidden="true"
|
|
84
|
+
data-testid="flow-level-chart-marker"
|
|
85
|
+
className="absolute -top-7 bottom-0 w-px bg-(--color-fg) start-(--flow-level-marker)"
|
|
86
|
+
>
|
|
87
|
+
<Text
|
|
88
|
+
as="span"
|
|
89
|
+
variant="caption"
|
|
90
|
+
className="absolute top-0 ms-1.5 whitespace-nowrap bg-(--color-bg) px-0.5 font-semibold tabular-nums"
|
|
91
|
+
>
|
|
92
|
+
{markerLabel}
|
|
93
|
+
</Text>
|
|
94
|
+
</span>
|
|
95
|
+
</div>
|
|
96
|
+
{/* The column labels sit below the baseline; reserve their line. */}
|
|
97
|
+
<div aria-hidden="true" className="h-6" />
|
|
98
|
+
</div>
|
|
99
|
+
);
|
|
100
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
// oss: false
|
|
2
|
+
/**
|
|
3
|
+
* ResultsCard — the results page's one card (#11013 decisions 14–16, spec E
|
|
4
|
+
* D-G, D-H).
|
|
5
|
+
*
|
|
6
|
+
* Two shapes, one component: a **Product** card (an offering — its name, its
|
|
7
|
+
* price, the Stripe description when set, "What's included" from its
|
|
8
|
+
* marketing features, Get Started to its `/pricing?plan=` landing) and a
|
|
9
|
+
* **Meeting** card (an appointment — its title, its description, a button to
|
|
10
|
+
* its `/meet/<slug>` page labelled with `/meet`'s own "Book {n} min"). The
|
|
11
|
+
* by-result row's card (#10827) and the Email-links-to offering's card are
|
|
12
|
+
* the same Product card; the Meeting card's data arrives through the
|
|
13
|
+
* scheduling seam (`meeting-seam.ts`), never from a scheduling import here.
|
|
14
|
+
*
|
|
15
|
+
* The card's button is the primary action when the card shows (decision 16);
|
|
16
|
+
* the consumer passes every string (customer-facing-i18n). Composed from the
|
|
17
|
+
* `Card` block and the `Heading`, `Text`, `Icon`, `Button` and `Link`
|
|
18
|
+
* primitives; no raw HTML the lint bans.
|
|
19
|
+
*/
|
|
20
|
+
import { Button, Card, Heading, Icon, Link, Text } from "@working-theory/ui";
|
|
21
|
+
import { Check } from "lucide-react";
|
|
22
|
+
import type { ReactElement } from "react";
|
|
23
|
+
|
|
24
|
+
export interface ResultsCardProps {
|
|
25
|
+
/** "Recommended for you" (`flow.priceCard.eyebrow`). */
|
|
26
|
+
eyebrow: string;
|
|
27
|
+
/** The offering's name or the meeting's title. */
|
|
28
|
+
title: string;
|
|
29
|
+
/** The Product card's price, as `/pricing` words it; a draft has none. */
|
|
30
|
+
price?: string;
|
|
31
|
+
description?: string;
|
|
32
|
+
/** The Product card's "What's included" entries (Stripe's marketing features). */
|
|
33
|
+
features?: string[];
|
|
34
|
+
/** The heading over `features` (`flow.whatsIncluded`). */
|
|
35
|
+
featuresLabel?: string;
|
|
36
|
+
/** The one button: a link, labelled Get Started or "Book {n} min"; a draft has none. */
|
|
37
|
+
action?: { href: string; label: string };
|
|
38
|
+
className?: string;
|
|
39
|
+
"data-testid"?: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function ResultsCard({
|
|
43
|
+
eyebrow,
|
|
44
|
+
title,
|
|
45
|
+
price,
|
|
46
|
+
description,
|
|
47
|
+
features = [],
|
|
48
|
+
featuresLabel,
|
|
49
|
+
action,
|
|
50
|
+
className,
|
|
51
|
+
"data-testid": testId = "flow-results-card",
|
|
52
|
+
}: ResultsCardProps): ReactElement {
|
|
53
|
+
return (
|
|
54
|
+
<Card variant="outline" {...(className !== undefined ? { className } : {})} data-testid={testId}>
|
|
55
|
+
<Text as="span" variant="caption" tone="muted" className="uppercase tracking-wide">
|
|
56
|
+
{eyebrow}
|
|
57
|
+
</Text>
|
|
58
|
+
<Heading level={2} className="mt-2 text-heading-4">
|
|
59
|
+
{title}
|
|
60
|
+
</Heading>
|
|
61
|
+
{price !== undefined ? (
|
|
62
|
+
<Text as="p" variant="body-sm" className="mt-1.5 font-medium" data-testid={`${testId}-price`}>
|
|
63
|
+
{price}
|
|
64
|
+
</Text>
|
|
65
|
+
) : null}
|
|
66
|
+
{description !== undefined ? (
|
|
67
|
+
<Text as="p" variant="body-sm" tone="muted" className="mt-1.5" data-testid={`${testId}-description`}>
|
|
68
|
+
{description}
|
|
69
|
+
</Text>
|
|
70
|
+
) : null}
|
|
71
|
+
{features.length > 0 ? (
|
|
72
|
+
<div className="mt-4 border-t border-(--color-border) pt-3" data-testid={`${testId}-features`}>
|
|
73
|
+
<Text as="span" variant="body-sm" className="font-semibold">
|
|
74
|
+
{featuresLabel}
|
|
75
|
+
</Text>
|
|
76
|
+
<ul className="mt-2 flex flex-col gap-2">
|
|
77
|
+
{features.map((feature) => (
|
|
78
|
+
<li key={feature} className="flex items-start gap-2 text-body-sm text-fg">
|
|
79
|
+
<Icon icon={Check} size="sm" decorative className="mt-0.5 shrink-0" />
|
|
80
|
+
<span>{feature}</span>
|
|
81
|
+
</li>
|
|
82
|
+
))}
|
|
83
|
+
</ul>
|
|
84
|
+
</div>
|
|
85
|
+
) : null}
|
|
86
|
+
{action !== undefined ? (
|
|
87
|
+
// Decision 16 — below `md:` the page's dock carries this button, so the
|
|
88
|
+
// card shows its own from `md:` only (the 390 boards draw the card bare).
|
|
89
|
+
<div className="mt-5 hidden md:block">
|
|
90
|
+
<Button asChild size="big" className="min-h-11 w-full">
|
|
91
|
+
<Link href={action.href} variant="bare" data-testid={`${testId}-action`}>
|
|
92
|
+
{action.label}
|
|
93
|
+
</Link>
|
|
94
|
+
</Button>
|
|
95
|
+
</div>
|
|
96
|
+
) : null}
|
|
97
|
+
</Card>
|
|
98
|
+
);
|
|
99
|
+
}
|