@c1m-public/dash-site-kit 0.9.0 → 0.11.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 +34 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -1
- package/dist/models/bootstrap.d.ts +22 -14
- package/dist/models/bootstrap.js +12 -22
- package/dist/models/landing.d.ts +46 -0
- package/dist/models/landing.js +1 -0
- package/dist/next/normalize.js +5 -9
- package/dist/next/providers/waitlist.js +1 -1
- package/dist/next/site-proxy.d.ts +4 -3
- package/dist/next/site-proxy.js +19 -10
- package/dist/ui/landing-page.d.ts +21 -0
- package/dist/ui/landing-page.js +18 -0
- package/dist/ui/maintenance-page.d.ts +12 -0
- package/dist/ui/maintenance-page.js +19 -0
- package/dist/ui.d.ts +2 -0
- package/dist/ui.js +2 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -211,6 +211,39 @@ forking the components. If a primitive needs a variant that cannot be expressed
|
|
|
211
211
|
through the tokens, add the variant here rather than copying the file back into
|
|
212
212
|
a site — that copy is how the drift started.
|
|
213
213
|
|
|
214
|
+
Tailwind v4 does not scan `node_modules`, so every site must add this line
|
|
215
|
+
after `@import "tailwindcss";` in its `globals.css`. Without it, kit
|
|
216
|
+
components render only the classes the site happens to use elsewhere:
|
|
217
|
+
|
|
218
|
+
```css
|
|
219
|
+
@source "../node_modules/@c1m-public/dash-site-kit/dist";
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
## Landing pages
|
|
223
|
+
|
|
224
|
+
`DashLandingPage` renders a typed `LandingContent` around any call to action:
|
|
225
|
+
the hero, then optional how it works, benefits, audiences, FAQ and closing
|
|
226
|
+
sections. `DashWaitlistLanding` puts the waitlist form in it. Sites own the
|
|
227
|
+
copy; the kit owns the structure. Use the generic `DashWaitlistPage` when a
|
|
228
|
+
Dash has no launch copy yet.
|
|
229
|
+
|
|
230
|
+
## Site modes
|
|
231
|
+
|
|
232
|
+
The Dash's mode arrives in `dash.init`'s `signals` as the server-decided
|
|
233
|
+
gate, and `createDashSiteProxy` enforces it before anything renders, through
|
|
234
|
+
the same `siteDecision` workspace sites use:
|
|
235
|
+
|
|
236
|
+
- **Waitlist** (page placement): every non-exempt path gets a 307 to
|
|
237
|
+
`/waitlist`. Signups are stored as CRM leads.
|
|
238
|
+
- **Maintenance**: every non-exempt path is served `/maintenance` in place
|
|
239
|
+
with 503, `Retry-After` (when the owner announced an end) and `noindex`.
|
|
240
|
+
Add an `app/maintenance/page.tsx` that renders `DashMaintenancePage`.
|
|
241
|
+
|
|
242
|
+
Legal pages, framework routes and crawler files are always exempt
|
|
243
|
+
(`GATE_EXEMPT_PATHS`); pass `exempt` for site-specific paths. A mode this kit
|
|
244
|
+
version does not know is ignored, so the server can add modes without
|
|
245
|
+
breaking older sites.
|
|
246
|
+
|
|
214
247
|
## Peer dependencies
|
|
215
248
|
|
|
216
|
-
`@c1m-public/channel-client` (>=0.
|
|
249
|
+
`@c1m-public/channel-client` (>=0.31.0), `next` 16, `react` 19.
|
package/dist/index.d.ts
CHANGED
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
*/
|
|
11
11
|
export type * from "./models/bootstrap.js";
|
|
12
12
|
export type * from "./models/waitlist.js";
|
|
13
|
-
export
|
|
13
|
+
export type * from "./models/landing.js";
|
|
14
|
+
export { GATE_EXEMPT_PATHS, gateAction } from "./models/bootstrap.js";
|
|
14
15
|
export type * from "./models/attribution.js";
|
|
15
16
|
export { FIRST_TOUCH_COOKIE, FIRST_TOUCH_MAX_AGE_SECONDS, decodeFirstTouch, encodeFirstTouch, firstTouchFrom } from "./models/attribution.js";
|
|
16
17
|
export type * from "./models/directory.js";
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { GATE_EXEMPT_PATHS,
|
|
1
|
+
export { GATE_EXEMPT_PATHS, gateAction } from "./models/bootstrap.js";
|
|
2
2
|
export { FIRST_TOUCH_COOKIE, FIRST_TOUCH_MAX_AGE_SECONDS, decodeFirstTouch, encodeFirstTouch, firstTouchFrom } from "./models/attribution.js";
|
|
3
3
|
export { selectDirectoryRegion, validateDirectoryKey, validateRegionFilter, } from "./validation/directory.js";
|
|
4
4
|
export { LEAD_LIMITS, validateLeadForm } from "./validation/leads.js";
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { GATE_EXEMPT_PATHS, type SiteGate, type SiteSignals } from "@c1m-public/channel-client/site";
|
|
2
|
+
export { GATE_EXEMPT_PATHS };
|
|
1
3
|
/**
|
|
2
4
|
* Everything the shell needs on every request, from ONE channel read
|
|
3
5
|
* (`dash.init`): who the dash is, how it looks, where it lives, what it
|
|
@@ -30,22 +32,28 @@ export interface DashBootstrap {
|
|
|
30
32
|
title: string;
|
|
31
33
|
description?: string;
|
|
32
34
|
};
|
|
33
|
-
/** The
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
export interface DashGate {
|
|
37
|
-
kind: "waitlist";
|
|
38
|
-
placement: "page" | "block";
|
|
39
|
-
path: string;
|
|
35
|
+
/** The standard site-decision block; decide requests with `gateAction`. */
|
|
36
|
+
signals: SiteSignals;
|
|
40
37
|
}
|
|
41
38
|
/**
|
|
42
|
-
*
|
|
43
|
-
*
|
|
39
|
+
* The site's mode as the server decided it. `redirect` sends visitors to the
|
|
40
|
+
* gate path (waitlist); `rewrite` serves the gate path in place with
|
|
41
|
+
* `status` (maintenance answers 503 with Retry-After).
|
|
44
42
|
*/
|
|
45
|
-
export
|
|
43
|
+
export type DashGate = SiteGate;
|
|
44
|
+
/** What the proxy does with a request instead of serving it. */
|
|
45
|
+
export type GateAction = {
|
|
46
|
+
type: "redirect";
|
|
47
|
+
path: string;
|
|
48
|
+
} | {
|
|
49
|
+
type: "rewrite";
|
|
50
|
+
path: string;
|
|
51
|
+
status: number;
|
|
52
|
+
retryAfter?: number;
|
|
53
|
+
};
|
|
46
54
|
/**
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
55
|
+
* What a request gets instead of the normal site, or null to serve it: the
|
|
56
|
+
* shared `siteDecision` reduced to what a proxy enforces. Exempt paths
|
|
57
|
+
* (`GATE_EXEMPT_PATHS` plus `exempt`) are always served.
|
|
50
58
|
*/
|
|
51
|
-
export declare function
|
|
59
|
+
export declare function gateAction(bootstrap: Pick<DashBootstrap, "signals">, pathname: string, exempt?: readonly string[]): GateAction | null;
|
package/dist/models/bootstrap.js
CHANGED
|
@@ -1,26 +1,16 @@
|
|
|
1
|
+
import { GATE_EXEMPT_PATHS, siteDecision } from "@c1m-public/channel-client/site";
|
|
2
|
+
export { GATE_EXEMPT_PATHS };
|
|
1
3
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
+
* What a request gets instead of the normal site, or null to serve it: the
|
|
5
|
+
* shared `siteDecision` reduced to what a proxy enforces. Exempt paths
|
|
6
|
+
* (`GATE_EXEMPT_PATHS` plus `exempt`) are always served.
|
|
4
7
|
*/
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Where a request must go instead, or null to serve it. Only page placement
|
|
14
|
-
* redirects; the server already decided whether the gate applies, so this
|
|
15
|
-
* never recomputes availability.
|
|
16
|
-
*/
|
|
17
|
-
export function gateRedirect(bootstrap, pathname, exempt = []) {
|
|
18
|
-
const gate = bootstrap.gate;
|
|
19
|
-
if (!gate || gate.placement !== "page")
|
|
20
|
-
return null;
|
|
21
|
-
for (const prefix of [gate.path, ...GATE_EXEMPT_PATHS, ...exempt]) {
|
|
22
|
-
if (underPath(pathname, prefix))
|
|
23
|
-
return null;
|
|
8
|
+
export function gateAction(bootstrap, pathname, exempt = []) {
|
|
9
|
+
const decision = siteDecision(bootstrap.signals, pathname, { exempt });
|
|
10
|
+
if (decision.type === "redirect")
|
|
11
|
+
return { type: "redirect", path: decision.path };
|
|
12
|
+
if (decision.type === "rewrite") {
|
|
13
|
+
return { type: "rewrite", path: decision.path, status: decision.status, ...(decision.retryAfter ? { retryAfter: decision.retryAfter } : {}) };
|
|
24
14
|
}
|
|
25
|
-
return
|
|
15
|
+
return null;
|
|
26
16
|
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copy for a content-driven landing page. The kit owns the structure; each
|
|
3
|
+
* site owns the words. Every section except the hero is optional.
|
|
4
|
+
*/
|
|
5
|
+
export interface LandingContent {
|
|
6
|
+
eyebrow?: string;
|
|
7
|
+
headline: string;
|
|
8
|
+
subheadline: string;
|
|
9
|
+
/** Short ticked points under the hero copy. */
|
|
10
|
+
highlights?: readonly string[];
|
|
11
|
+
/** Heading and reassurance around the call to action. */
|
|
12
|
+
cta: {
|
|
13
|
+
title: string;
|
|
14
|
+
note?: string;
|
|
15
|
+
};
|
|
16
|
+
steps?: LandingSection<{
|
|
17
|
+
title: string;
|
|
18
|
+
description: string;
|
|
19
|
+
}>;
|
|
20
|
+
benefits?: LandingSection<{
|
|
21
|
+
title: string;
|
|
22
|
+
description: string;
|
|
23
|
+
}>;
|
|
24
|
+
/** Parallel pitches for different visitors, e.g. customers and providers. */
|
|
25
|
+
audiences?: LandingSection<{
|
|
26
|
+
eyebrow?: string;
|
|
27
|
+
title: string;
|
|
28
|
+
description: string;
|
|
29
|
+
points?: readonly string[];
|
|
30
|
+
}>;
|
|
31
|
+
faqs?: LandingSection<{
|
|
32
|
+
question: string;
|
|
33
|
+
answer: string;
|
|
34
|
+
}>;
|
|
35
|
+
closing?: {
|
|
36
|
+
headline: string;
|
|
37
|
+
description?: string;
|
|
38
|
+
action: string;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
export interface LandingSection<Item> {
|
|
42
|
+
eyebrow?: string;
|
|
43
|
+
title: string;
|
|
44
|
+
description?: string;
|
|
45
|
+
items: readonly Item[];
|
|
46
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/next/normalize.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { normalizeSignals } from "@c1m-public/channel-client/site";
|
|
1
2
|
function text(value) {
|
|
2
3
|
const trimmed = value?.trim();
|
|
3
4
|
return trimmed || undefined;
|
|
@@ -5,8 +6,9 @@ function text(value) {
|
|
|
5
6
|
// --- bootstrap ------------------------------------------------------------
|
|
6
7
|
/** One flat shell object from ONE wire read: `dash.init`. */
|
|
7
8
|
export function normalizeDashBootstrap(init) {
|
|
9
|
+
const signals = normalizeSignals(init);
|
|
8
10
|
const name = text(init.tenant.display_name) ?? init.tenant.id;
|
|
9
|
-
const siteUrl = text(
|
|
11
|
+
const siteUrl = text(signals.site?.url)?.replace(/\/+$/, "") ?? null;
|
|
10
12
|
return {
|
|
11
13
|
id: init.tenant.id,
|
|
12
14
|
name,
|
|
@@ -24,12 +26,12 @@ export function normalizeDashBootstrap(init) {
|
|
|
24
26
|
locale: text(init.locale?.locale),
|
|
25
27
|
timezone: text(init.locale?.timezone),
|
|
26
28
|
},
|
|
27
|
-
site: { url: siteUrl, source: siteUrl ? (
|
|
29
|
+
site: { url: siteUrl, source: siteUrl ? (signals.site?.source ?? null) : null },
|
|
28
30
|
seo: {
|
|
29
31
|
title: text(init.seo?.title) ?? name,
|
|
30
32
|
description: text(init.seo?.description) ?? text(init.public_profile.headline) ?? text(init.public_profile.short_description),
|
|
31
33
|
},
|
|
32
|
-
|
|
34
|
+
signals,
|
|
33
35
|
};
|
|
34
36
|
}
|
|
35
37
|
// --- profile --------------------------------------------------------------
|
|
@@ -141,9 +143,3 @@ export function normalizePlanCatalog(response) {
|
|
|
141
143
|
defaultRegion: response.default_region,
|
|
142
144
|
};
|
|
143
145
|
}
|
|
144
|
-
function normalizeGate(gate) {
|
|
145
|
-
if (gate?.kind !== "waitlist" || (gate.placement !== "page" && gate.placement !== "block"))
|
|
146
|
-
return null;
|
|
147
|
-
const path = typeof gate.path === "string" && gate.path.startsWith("/") && !gate.path.startsWith("//") ? gate.path : "/waitlist";
|
|
148
|
-
return { kind: "waitlist", placement: gate.placement, path };
|
|
149
|
-
}
|
|
@@ -6,7 +6,7 @@ export function createC1MWaitlistProvider(resolveClient = getDashChannelClient,
|
|
|
6
6
|
async loadForm() {
|
|
7
7
|
const response = await (await resolveClient()).dash.waitlist.form();
|
|
8
8
|
return {
|
|
9
|
-
acceptingEntries: response.gate
|
|
9
|
+
acceptingEntries: response.gate?.kind === "waitlist",
|
|
10
10
|
collectMarketingConsent: response.collect_marketing_consent === true,
|
|
11
11
|
};
|
|
12
12
|
},
|
|
@@ -2,13 +2,14 @@ import { NextResponse, type NextRequest } from "next/server";
|
|
|
2
2
|
import { type DashBootstrap } from "../models/bootstrap.js";
|
|
3
3
|
export interface DashSiteProxyOptions {
|
|
4
4
|
/** The site's cached bootstrap read (`data.loadDashBootstrap`). */
|
|
5
|
-
loadBootstrap: () => Promise<Pick<DashBootstrap, "
|
|
5
|
+
loadBootstrap: () => Promise<Pick<DashBootstrap, "signals">>;
|
|
6
6
|
/** Extra paths a page gate must never redirect. */
|
|
7
7
|
exempt?: readonly string[];
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
|
-
* The site's proxy in one line. A live page gate
|
|
11
|
-
*
|
|
10
|
+
* The site's proxy in one line. A live page gate acts before anything
|
|
11
|
+
* renders — a real 307 to the waitlist, or the maintenance page served in
|
|
12
|
+
* place with 503 and Retry-After; every other request passes through with
|
|
12
13
|
* first-touch attribution recorded. The bootstrap read is the same cached
|
|
13
14
|
* `dash.init` the layout uses, so the gate costs no extra API call. If the
|
|
14
15
|
* bootstrap cannot be read the request passes through: the site's own error
|
package/dist/next/site-proxy.js
CHANGED
|
@@ -1,9 +1,21 @@
|
|
|
1
1
|
import { NextResponse } from "next/server";
|
|
2
|
-
import {
|
|
2
|
+
import { gateAction } from "../models/bootstrap.js";
|
|
3
3
|
import { recordFirstTouch } from "./first-touch.js";
|
|
4
|
+
function respond(request, action) {
|
|
5
|
+
if (!action)
|
|
6
|
+
return NextResponse.next();
|
|
7
|
+
const target = new URL(action.path, request.nextUrl);
|
|
8
|
+
if (action.type === "redirect")
|
|
9
|
+
return NextResponse.redirect(target, 307);
|
|
10
|
+
const headers = new Headers({ "X-Robots-Tag": "noindex" });
|
|
11
|
+
if (action.retryAfter)
|
|
12
|
+
headers.set("Retry-After", String(action.retryAfter));
|
|
13
|
+
return NextResponse.rewrite(target, { status: action.status, headers });
|
|
14
|
+
}
|
|
4
15
|
/**
|
|
5
|
-
* The site's proxy in one line. A live page gate
|
|
6
|
-
*
|
|
16
|
+
* The site's proxy in one line. A live page gate acts before anything
|
|
17
|
+
* renders — a real 307 to the waitlist, or the maintenance page served in
|
|
18
|
+
* place with 503 and Retry-After; every other request passes through with
|
|
7
19
|
* first-touch attribution recorded. The bootstrap read is the same cached
|
|
8
20
|
* `dash.init` the layout uses, so the gate costs no extra API call. If the
|
|
9
21
|
* bootstrap cannot be read the request passes through: the site's own error
|
|
@@ -11,16 +23,13 @@ import { recordFirstTouch } from "./first-touch.js";
|
|
|
11
23
|
*/
|
|
12
24
|
export function createDashSiteProxy({ loadBootstrap, exempt = [] }) {
|
|
13
25
|
return async function proxy(request) {
|
|
14
|
-
let
|
|
26
|
+
let action = null;
|
|
15
27
|
try {
|
|
16
|
-
|
|
28
|
+
action = gateAction(await loadBootstrap(), request.nextUrl.pathname, exempt);
|
|
17
29
|
}
|
|
18
30
|
catch {
|
|
19
|
-
|
|
31
|
+
action = null;
|
|
20
32
|
}
|
|
21
|
-
|
|
22
|
-
? NextResponse.redirect(new URL(target, request.nextUrl), 307)
|
|
23
|
-
: NextResponse.next();
|
|
24
|
-
return recordFirstTouch(request, response);
|
|
33
|
+
return recordFirstTouch(request, respond(request, action));
|
|
25
34
|
};
|
|
26
35
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { LandingContent } from "../models/landing.js";
|
|
3
|
+
import type { DashWaitlistForm as DashWaitlistFormSettings, DashWaitlistReceipt, DashWaitlistSubmission } from "../models/waitlist.js";
|
|
4
|
+
/**
|
|
5
|
+
* A reusable, content-driven landing page: hero with the call to action, then
|
|
6
|
+
* optional how-it-works, benefits, audiences, FAQ and a closing prompt that
|
|
7
|
+
* scrolls back to the call to action. `cta` is any server- or client-rendered
|
|
8
|
+
* action (a waitlist form, a lead form, a plans link).
|
|
9
|
+
*/
|
|
10
|
+
export declare function DashLandingPage({ siteName, content, cta }: {
|
|
11
|
+
siteName: string;
|
|
12
|
+
content: LandingContent;
|
|
13
|
+
cta: ReactNode;
|
|
14
|
+
}): import("react").JSX.Element;
|
|
15
|
+
/** The landing page with the waitlist form as its call to action. */
|
|
16
|
+
export declare function DashWaitlistLanding({ siteName, content, form, submit, }: {
|
|
17
|
+
siteName: string;
|
|
18
|
+
content: LandingContent;
|
|
19
|
+
form: DashWaitlistFormSettings;
|
|
20
|
+
submit: (input: DashWaitlistSubmission) => Promise<DashWaitlistReceipt>;
|
|
21
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ButtonLink, Container, Eyebrow, SectionHeading } from "./primitives.js";
|
|
3
|
+
import { DashWaitlistForm } from "./waitlist-form.js";
|
|
4
|
+
const CTA_ID = "join";
|
|
5
|
+
/**
|
|
6
|
+
* A reusable, content-driven landing page: hero with the call to action, then
|
|
7
|
+
* optional how-it-works, benefits, audiences, FAQ and a closing prompt that
|
|
8
|
+
* scrolls back to the call to action. `cta` is any server- or client-rendered
|
|
9
|
+
* action (a waitlist form, a lead form, a plans link).
|
|
10
|
+
*/
|
|
11
|
+
export function DashLandingPage({ siteName, content, cta }) {
|
|
12
|
+
const { steps, benefits, audiences, faqs, closing } = content;
|
|
13
|
+
return (_jsxs("main", { children: [_jsx("section", { className: "border-b border-border bg-subtle", children: _jsxs(Container, { className: "grid items-center gap-12 py-14 lg:grid-cols-[minmax(0,1fr)_minmax(20rem,26rem)] lg:py-24", children: [_jsxs("div", { className: "max-w-2xl", children: [_jsx(Eyebrow, { children: content.eyebrow ?? siteName }), _jsx("h1", { className: "mt-5 text-balance text-4xl font-semibold tracking-[-0.05em] text-ink sm:text-6xl", children: content.headline }), _jsx("p", { className: "mt-6 text-pretty text-lg leading-8 text-muted", children: content.subheadline }), content.highlights?.length ? (_jsx("ul", { className: "mt-8 space-y-3", children: content.highlights.map((point) => (_jsxs("li", { className: "flex gap-3 text-base text-ink", children: [_jsx("span", { "aria-hidden": "true", className: "mt-1 inline-flex size-5 shrink-0 items-center justify-center rounded-full bg-accent text-xs font-bold text-accent-foreground", children: "\u2713" }), _jsx("span", { children: point })] }, point))) })) : null] }), _jsxs("div", { id: CTA_ID, className: "scroll-mt-24 rounded-3xl border border-border bg-white p-6 shadow-sm sm:p-8", children: [_jsx("h2", { className: "text-xl font-semibold text-ink", children: content.cta.title }), _jsx("div", { className: "mt-5", children: cta }), content.cta.note ? _jsx("p", { className: "mt-4 text-xs leading-5 text-muted", children: content.cta.note }) : null] })] }) }), steps ? (_jsx("section", { className: "border-b border-border py-16 sm:py-20", children: _jsxs(Container, { children: [_jsx(SectionHeading, { eyebrow: steps.eyebrow, title: steps.title, description: steps.description }), _jsx("ol", { className: "mt-10 grid gap-6 sm:grid-cols-2 lg:grid-cols-4", children: steps.items.map((step, index) => (_jsxs("li", { className: "rounded-2xl border border-border p-6", children: [_jsxs("span", { className: "text-sm font-semibold text-accent-text", children: ["Step ", index + 1] }), _jsx("h3", { className: "mt-2 text-lg font-semibold text-ink", children: step.title }), _jsx("p", { className: "mt-2 text-sm leading-6 text-muted", children: step.description })] }, step.title))) })] }) })) : null, benefits ? (_jsx("section", { className: "border-b border-border bg-subtle py-16 sm:py-20", children: _jsxs(Container, { children: [_jsx(SectionHeading, { eyebrow: benefits.eyebrow, title: benefits.title, description: benefits.description }), _jsx("div", { className: "mt-10 grid gap-6 sm:grid-cols-2 lg:grid-cols-3", children: benefits.items.map((benefit) => (_jsxs("div", { className: "rounded-2xl border border-border bg-white p-6", children: [_jsx("h3", { className: "text-lg font-semibold text-ink", children: benefit.title }), _jsx("p", { className: "mt-2 text-sm leading-6 text-muted", children: benefit.description })] }, benefit.title))) })] }) })) : null, audiences ? (_jsx("section", { className: "border-b border-border py-16 sm:py-20", children: _jsxs(Container, { children: [_jsx(SectionHeading, { eyebrow: audiences.eyebrow, title: audiences.title, description: audiences.description }), _jsx("div", { className: "mt-10 grid gap-6 lg:grid-cols-2", children: audiences.items.map((audience) => (_jsxs("div", { className: "rounded-3xl border border-border p-8", children: [audience.eyebrow ? _jsx(Eyebrow, { children: audience.eyebrow }) : null, _jsx("h3", { className: "mt-3 text-2xl font-semibold tracking-tight text-ink", children: audience.title }), _jsx("p", { className: "mt-3 text-base leading-7 text-muted", children: audience.description }), audience.points?.length ? (_jsx("ul", { className: "mt-5 space-y-2 text-sm text-ink", children: audience.points.map((point) => _jsxs("li", { children: ["\u2022 ", point] }, point)) })) : null] }, audience.title))) })] }) })) : null, faqs ? (_jsx("section", { className: "border-b border-border py-16 sm:py-20", children: _jsxs(Container, { className: "max-w-3xl", children: [_jsx(SectionHeading, { eyebrow: faqs.eyebrow, title: faqs.title, description: faqs.description }), _jsx("div", { className: "mt-8 divide-y divide-border border-y border-border", children: faqs.items.map((faq) => (_jsxs("details", { className: "group py-5", children: [_jsx("summary", { className: "cursor-pointer list-none text-base font-semibold text-ink", children: faq.question }), _jsx("p", { className: "mt-3 text-sm leading-6 text-muted", children: faq.answer })] }, faq.question))) })] }) })) : null, closing ? (_jsx("section", { className: "py-16 sm:py-24", children: _jsxs(Container, { className: "max-w-3xl text-center", children: [_jsx("h2", { className: "text-balance text-3xl font-semibold tracking-[-0.035em] text-ink sm:text-4xl", children: closing.headline }), closing.description ? _jsx("p", { className: "mt-4 text-lg leading-8 text-muted", children: closing.description }) : null, _jsx("div", { className: "mt-8", children: _jsx(ButtonLink, { href: `#${CTA_ID}`, children: closing.action }) })] }) })) : null] }));
|
|
14
|
+
}
|
|
15
|
+
/** The landing page with the waitlist form as its call to action. */
|
|
16
|
+
export function DashWaitlistLanding({ siteName, content, form, submit, }) {
|
|
17
|
+
return (_jsx(DashLandingPage, { siteName: siteName, content: content, cta: _jsx(DashWaitlistForm, { acceptingEntries: form.acceptingEntries, collectMarketingConsent: form.collectMarketingConsent, placement: "page", submit: submit }) }));
|
|
18
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { DashGate } from "../models/bootstrap.js";
|
|
2
|
+
/**
|
|
3
|
+
* The maintenance mode page. The proxy serves it in place with 503, so this
|
|
4
|
+
* only renders the site's name, the owner's message and the announced end.
|
|
5
|
+
* Server component.
|
|
6
|
+
*/
|
|
7
|
+
export declare function DashMaintenancePage({ siteName, gate, locale, headline, }: {
|
|
8
|
+
siteName: string;
|
|
9
|
+
gate: Pick<DashGate, "message" | "until"> | null;
|
|
10
|
+
locale?: string;
|
|
11
|
+
headline?: string;
|
|
12
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Container, Eyebrow } from "./primitives.js";
|
|
3
|
+
function formatUntil(until, locale) {
|
|
4
|
+
if (!until)
|
|
5
|
+
return null;
|
|
6
|
+
const date = new Date(until);
|
|
7
|
+
if (Number.isNaN(date.getTime()) || date.getTime() <= Date.now())
|
|
8
|
+
return null;
|
|
9
|
+
return date.toLocaleString(locale, { dateStyle: "medium", timeStyle: "short" });
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* The maintenance mode page. The proxy serves it in place with 503, so this
|
|
13
|
+
* only renders the site's name, the owner's message and the announced end.
|
|
14
|
+
* Server component.
|
|
15
|
+
*/
|
|
16
|
+
export function DashMaintenancePage({ siteName, gate, locale, headline = "We'll be back soon", }) {
|
|
17
|
+
const until = formatUntil(gate?.until, locale);
|
|
18
|
+
return (_jsx("main", { className: "flex min-h-screen items-center py-16", children: _jsxs(Container, { className: "max-w-md space-y-6", children: [_jsx(Eyebrow, { children: siteName }), _jsx("h1", { className: "text-3xl font-semibold tracking-tight text-ink", children: headline }), _jsx("p", { className: "whitespace-pre-line text-base leading-7 text-muted", children: gate?.message || "The site is down for maintenance. Please check back shortly." }), until ? _jsxs("p", { className: "text-sm text-muted", children: ["Expected back by ", until, "."] }) : null] }) }));
|
|
19
|
+
}
|
package/dist/ui.d.ts
CHANGED
|
@@ -11,4 +11,6 @@ export { ButtonLink, Container, Eyebrow, SectionHeading, StatusPanel, VerifiedBa
|
|
|
11
11
|
export { SiteImage } from "./ui/site-image.js";
|
|
12
12
|
export { DashWaitlistForm } from "./ui/waitlist-form.js";
|
|
13
13
|
export { DashWaitlistEmailLink, DashWaitlistPage } from "./ui/waitlist-page.js";
|
|
14
|
+
export { DashMaintenancePage } from "./ui/maintenance-page.js";
|
|
15
|
+
export { DashLandingPage, DashWaitlistLanding } from "./ui/landing-page.js";
|
|
14
16
|
export { SiteErrorFallback } from "./ui/error-fallback.js";
|
package/dist/ui.js
CHANGED
|
@@ -11,4 +11,6 @@ export { ButtonLink, Container, Eyebrow, SectionHeading, StatusPanel, VerifiedBa
|
|
|
11
11
|
export { SiteImage } from "./ui/site-image.js";
|
|
12
12
|
export { DashWaitlistForm } from "./ui/waitlist-form.js";
|
|
13
13
|
export { DashWaitlistEmailLink, DashWaitlistPage } from "./ui/waitlist-page.js";
|
|
14
|
+
export { DashMaintenancePage } from "./ui/maintenance-page.js";
|
|
15
|
+
export { DashLandingPage, DashWaitlistLanding } from "./ui/landing-page.js";
|
|
14
16
|
export { SiteErrorFallback } from "./ui/error-fallback.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@c1m-public/dash-site-kit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Shared transport, domain and UI layer for MML dash-scoped public sites",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"server-only": "0.0.1"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
|
-
"@c1m-public/channel-client": ">=0.
|
|
46
|
+
"@c1m-public/channel-client": ">=0.31.0 <1",
|
|
47
47
|
"next": "^16",
|
|
48
48
|
"react": "^19"
|
|
49
49
|
},
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"react-dom": "19.2.8",
|
|
57
57
|
"typescript": "5.9.3",
|
|
58
58
|
"vitest": "^4.1.4",
|
|
59
|
-
"@c1m-public/channel-client": "0.
|
|
59
|
+
"@c1m-public/channel-client": "0.31.0"
|
|
60
60
|
},
|
|
61
61
|
"peerDependenciesMeta": {
|
|
62
62
|
"next": {
|