@c1m-public/dash-site-kit 0.11.0 → 0.12.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 +21 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/models/legal.d.ts +40 -0
- package/dist/models/legal.js +80 -0
- package/dist/ui/legal-page.d.ts +7 -0
- package/dist/ui/legal-page.js +10 -0
- package/dist/ui.d.ts +1 -0
- package/dist/ui.js +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -244,6 +244,27 @@ Legal pages, framework routes and crawler files are always exempt
|
|
|
244
244
|
version does not know is ignored, so the server can add modes without
|
|
245
245
|
breaking older sites.
|
|
246
246
|
|
|
247
|
+
## Legal pages
|
|
248
|
+
|
|
249
|
+
Legal pages stay reachable in every site mode, so every site needs them before
|
|
250
|
+
it collects signups. Build them from the site's facts and render them with
|
|
251
|
+
`DashLegalPage`:
|
|
252
|
+
|
|
253
|
+
```tsx
|
|
254
|
+
import { DashLegalPage } from "@c1m-public/dash-site-kit/ui";
|
|
255
|
+
import { privacyNotice } from "@c1m-public/dash-site-kit";
|
|
256
|
+
|
|
257
|
+
const facts = { siteName: "SimpleVan", contactHref: "/contact", sharesWithProviders: true, waitlist: true, updated: "2026-09-22" };
|
|
258
|
+
export default function PrivacyPage() {
|
|
259
|
+
return <DashLegalPage document={privacyNotice(facts)} siteName={facts.siteName} />;
|
|
260
|
+
}
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
`cookieNotice` and `termsOfUse` take the same facts. The text states what the
|
|
264
|
+
platform collects (requests, waitlist sign-ups, the `c1m_ft` attribution
|
|
265
|
+
cookie); pass `operator` with the registered company name and review the text
|
|
266
|
+
before relying on it.
|
|
267
|
+
|
|
247
268
|
## Peer dependencies
|
|
248
269
|
|
|
249
270
|
`@c1m-public/channel-client` (>=0.31.0), `next` 16, `react` 19.
|
package/dist/index.d.ts
CHANGED
|
@@ -13,6 +13,8 @@ export type * from "./models/waitlist.js";
|
|
|
13
13
|
export type * from "./models/landing.js";
|
|
14
14
|
export { GATE_EXEMPT_PATHS, gateAction } from "./models/bootstrap.js";
|
|
15
15
|
export type * from "./models/attribution.js";
|
|
16
|
+
export type { LegalDocument, LegalSection, LegalSiteFacts } from "./models/legal.js";
|
|
17
|
+
export { cookieNotice, privacyNotice, termsOfUse } from "./models/legal.js";
|
|
16
18
|
export { FIRST_TOUCH_COOKIE, FIRST_TOUCH_MAX_AGE_SECONDS, decodeFirstTouch, encodeFirstTouch, firstTouchFrom } from "./models/attribution.js";
|
|
17
19
|
export type * from "./models/directory.js";
|
|
18
20
|
export type * from "./models/leads.js";
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { GATE_EXEMPT_PATHS, gateAction } from "./models/bootstrap.js";
|
|
2
|
+
export { cookieNotice, privacyNotice, termsOfUse } from "./models/legal.js";
|
|
2
3
|
export { FIRST_TOUCH_COOKIE, FIRST_TOUCH_MAX_AGE_SECONDS, decodeFirstTouch, encodeFirstTouch, firstTouchFrom } from "./models/attribution.js";
|
|
3
4
|
export { selectDirectoryRegion, validateDirectoryKey, validateRegionFilter, } from "./validation/directory.js";
|
|
4
5
|
export { LEAD_LIMITS, validateLeadForm } from "./validation/leads.js";
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/** One section of a legal page: a heading, paragraphs, and optional bullets. */
|
|
2
|
+
export interface LegalSection {
|
|
3
|
+
heading: string;
|
|
4
|
+
paragraphs?: string[];
|
|
5
|
+
bullets?: string[];
|
|
6
|
+
}
|
|
7
|
+
/** A legal page as data, rendered by `DashLegalPage`. */
|
|
8
|
+
export interface LegalDocument {
|
|
9
|
+
title: string;
|
|
10
|
+
/** ISO date the text was last reviewed. */
|
|
11
|
+
updated: string;
|
|
12
|
+
summary: string;
|
|
13
|
+
sections: LegalSection[];
|
|
14
|
+
}
|
|
15
|
+
export interface LegalSiteFacts {
|
|
16
|
+
/** The brand visitors see. */
|
|
17
|
+
siteName: string;
|
|
18
|
+
/** The legal entity that runs the site; defaults to the brand. */
|
|
19
|
+
operator?: string;
|
|
20
|
+
/** Where people reach the operator (a path or URL). */
|
|
21
|
+
contactHref?: string;
|
|
22
|
+
/** Quote requests go to independent providers who may contact the person. */
|
|
23
|
+
sharesWithProviders?: boolean;
|
|
24
|
+
/** Whether the site runs a waitlist. */
|
|
25
|
+
waitlist?: boolean;
|
|
26
|
+
/** Governing law for the terms. */
|
|
27
|
+
jurisdiction?: string;
|
|
28
|
+
/** ISO date the owner last reviewed the text. */
|
|
29
|
+
updated: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* The privacy notice for a Dash site, describing what the platform actually
|
|
33
|
+
* collects and why. The operator should review it and add registered company
|
|
34
|
+
* details before relying on it.
|
|
35
|
+
*/
|
|
36
|
+
export declare function privacyNotice(facts: LegalSiteFacts): LegalDocument;
|
|
37
|
+
/** The cookie notice: the only cookie the kit sets is first-touch attribution. */
|
|
38
|
+
export declare function cookieNotice(facts: LegalSiteFacts): LegalDocument;
|
|
39
|
+
/** Terms of use for a Dash site. */
|
|
40
|
+
export declare function termsOfUse(facts: LegalSiteFacts): LegalDocument;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { FIRST_TOUCH_COOKIE, FIRST_TOUCH_MAX_AGE_SECONDS } from "./attribution.js";
|
|
2
|
+
function operatorOf(facts) {
|
|
3
|
+
return facts.operator?.trim() || facts.siteName;
|
|
4
|
+
}
|
|
5
|
+
function contactLine(facts) {
|
|
6
|
+
return facts.contactHref ? `through our contact page (${facts.contactHref})` : "using the contact details on this site";
|
|
7
|
+
}
|
|
8
|
+
const firstTouchDays = Math.round(FIRST_TOUCH_MAX_AGE_SECONDS / 86_400);
|
|
9
|
+
/**
|
|
10
|
+
* The privacy notice for a Dash site, describing what the platform actually
|
|
11
|
+
* collects and why. The operator should review it and add registered company
|
|
12
|
+
* details before relying on it.
|
|
13
|
+
*/
|
|
14
|
+
export function privacyNotice(facts) {
|
|
15
|
+
const operator = operatorOf(facts);
|
|
16
|
+
const collected = [
|
|
17
|
+
"Requests you send us: your name, email address, phone number and the details you enter about the job.",
|
|
18
|
+
"An email address when you ask for a link to your existing requests.",
|
|
19
|
+
...(facts.waitlist ? ["Waitlist sign-ups: your email address, your name if you give it, and whether you agreed to marketing emails."] : []),
|
|
20
|
+
`How you found us: the first page you visited, the site that referred you, campaign tags in the link, your approximate country and your browser language. This is kept in a first-party cookie for ${firstTouchDays} days and stored with any request you send.`,
|
|
21
|
+
"Technical logs our hosting and security providers keep to run and protect the site.",
|
|
22
|
+
];
|
|
23
|
+
return {
|
|
24
|
+
title: "Privacy notice",
|
|
25
|
+
updated: facts.updated,
|
|
26
|
+
summary: `How ${operator} collects and uses personal information on ${facts.siteName}.`,
|
|
27
|
+
sections: [
|
|
28
|
+
{ heading: "Who we are", paragraphs: [`${facts.siteName} is run by ${operator}, the controller of the personal information described here. The site runs on the SaaSDash platform, which stores and processes that information on our behalf.`] },
|
|
29
|
+
{ heading: "What we collect", bullets: collected },
|
|
30
|
+
{
|
|
31
|
+
heading: "How we use it",
|
|
32
|
+
bullets: [
|
|
33
|
+
"To answer your request and keep you updated about it.",
|
|
34
|
+
...(facts.sharesWithProviders ? ["To share your request with independent providers who can do the job, so they can contact you with a quote. Each provider is responsible for how it then uses your details."] : []),
|
|
35
|
+
...(facts.waitlist ? ["To confirm your waitlist sign-up and tell you when we open. We send marketing emails only if you ticked the separate consent box, and every email has an unsubscribe link."] : []),
|
|
36
|
+
"To understand which pages and campaigns bring people to us.",
|
|
37
|
+
"To keep the site secure and prevent abuse.",
|
|
38
|
+
],
|
|
39
|
+
paragraphs: ["We rely on your request (to take steps you ask for), your consent (for marketing emails) and our legitimate interest in running and improving the site."],
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
heading: "How long we keep it",
|
|
43
|
+
paragraphs: [
|
|
44
|
+
"We keep requests for as long as we need them to handle the job and meet our legal obligations.",
|
|
45
|
+
...(facts.waitlist ? ["Waitlist details are kept until you unsubscribe or ask us to delete them."] : []),
|
|
46
|
+
],
|
|
47
|
+
},
|
|
48
|
+
{ heading: "Your rights", paragraphs: [`You can ask to see, correct or delete your information, object to how we use it, or withdraw consent at any time. Contact us ${contactLine(facts)}. You can also complain to the Information Commissioner's Office (ico.org.uk).`] },
|
|
49
|
+
],
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
/** The cookie notice: the only cookie the kit sets is first-touch attribution. */
|
|
53
|
+
export function cookieNotice(facts) {
|
|
54
|
+
return {
|
|
55
|
+
title: "Cookies",
|
|
56
|
+
updated: facts.updated,
|
|
57
|
+
summary: `The cookies ${facts.siteName} uses.`,
|
|
58
|
+
sections: [
|
|
59
|
+
{ heading: "What we set", bullets: [`${FIRST_TOUCH_COOKIE}: remembers how you first arrived (first page, referring site, campaign tags) so a later request can be attributed to it. It lasts ${firstTouchDays} days and is not shared with advertisers.`] },
|
|
60
|
+
{ heading: "Your choices", paragraphs: ["You can delete or block cookies in your browser settings. The site keeps working without them; we just cannot tell how you found us."] },
|
|
61
|
+
],
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
/** Terms of use for a Dash site. */
|
|
65
|
+
export function termsOfUse(facts) {
|
|
66
|
+
const operator = operatorOf(facts);
|
|
67
|
+
return {
|
|
68
|
+
title: "Terms of use",
|
|
69
|
+
updated: facts.updated,
|
|
70
|
+
summary: `The terms for using ${facts.siteName}.`,
|
|
71
|
+
sections: [
|
|
72
|
+
{ heading: "About these terms", paragraphs: [`These terms apply when you use ${facts.siteName}, run by ${operator}. By using the site you accept them.`] },
|
|
73
|
+
...(facts.sharesWithProviders ? [{ heading: "Providers", paragraphs: ["Providers listed on the site are independent businesses. Any job you agree with a provider is a contract between you and that provider, who is responsible for the service, its price and its insurance. We help you find and contact providers but do not carry out the work."] }] : []),
|
|
74
|
+
{ heading: "Using the site", bullets: ["Give accurate information when you send a request.", "Do not misuse the site, interfere with it or try to access it without permission.", "Do not submit other people's details without their agreement."] },
|
|
75
|
+
{ heading: "Information on the site", paragraphs: ["We keep the site accurate but cannot guarantee every listing, price or guide is complete or current."] },
|
|
76
|
+
{ heading: "Liability", paragraphs: ["Nothing in these terms limits liability that cannot be limited by law. Otherwise we are not liable for losses arising from a provider's work or from using the site, to the extent the law allows."] },
|
|
77
|
+
{ heading: "Law", paragraphs: [`These terms are governed by the law of ${facts.jurisdiction ?? "England and Wales"}. Questions: contact us ${contactLine(facts)}.`] },
|
|
78
|
+
],
|
|
79
|
+
};
|
|
80
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { LegalDocument } from "../models/legal.js";
|
|
2
|
+
/** A legal page (privacy, cookies, terms) rendered from a `LegalDocument`. Server component. */
|
|
3
|
+
export declare function DashLegalPage({ document, siteName, locale }: {
|
|
4
|
+
document: LegalDocument;
|
|
5
|
+
siteName: string;
|
|
6
|
+
locale?: string;
|
|
7
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Container, Eyebrow } from "./primitives.js";
|
|
3
|
+
function formatUpdated(updated, locale) {
|
|
4
|
+
const date = new Date(`${updated}T00:00:00Z`);
|
|
5
|
+
return Number.isNaN(date.getTime()) ? updated : date.toLocaleDateString(locale, { dateStyle: "long", timeZone: "UTC" });
|
|
6
|
+
}
|
|
7
|
+
/** A legal page (privacy, cookies, terms) rendered from a `LegalDocument`. Server component. */
|
|
8
|
+
export function DashLegalPage({ document, siteName, locale }) {
|
|
9
|
+
return (_jsx("main", { className: "py-16 sm:py-24", children: _jsxs(Container, { className: "max-w-3xl", children: [_jsx(Eyebrow, { children: siteName }), _jsx("h1", { className: "mt-4 text-balance text-4xl font-semibold tracking-[-0.045em] text-ink sm:text-5xl", children: document.title }), _jsx("p", { className: "mt-4 text-lg leading-8 text-muted", children: document.summary }), _jsxs("p", { className: "mt-2 text-sm text-muted", children: ["Last updated ", formatUpdated(document.updated, locale)] }), _jsx("div", { className: "mt-12 space-y-10", children: document.sections.map((section) => (_jsxs("section", { "aria-labelledby": `legal-${section.heading}`, children: [_jsx("h2", { id: `legal-${section.heading}`, className: "text-xl font-semibold tracking-tight text-ink", children: section.heading }), section.paragraphs?.map((paragraph) => (_jsx("p", { className: "mt-3 text-base leading-7 text-muted", children: paragraph }, paragraph))), section.bullets?.length ? (_jsx("ul", { className: "mt-3 list-disc space-y-2 pl-5 text-base leading-7 text-muted", children: section.bullets.map((bullet) => _jsx("li", { children: bullet }, bullet)) })) : null] }, section.heading))) })] }) }));
|
|
10
|
+
}
|
package/dist/ui.d.ts
CHANGED
|
@@ -14,3 +14,4 @@ export { DashWaitlistEmailLink, DashWaitlistPage } from "./ui/waitlist-page.js";
|
|
|
14
14
|
export { DashMaintenancePage } from "./ui/maintenance-page.js";
|
|
15
15
|
export { DashLandingPage, DashWaitlistLanding } from "./ui/landing-page.js";
|
|
16
16
|
export { SiteErrorFallback } from "./ui/error-fallback.js";
|
|
17
|
+
export { DashLegalPage } from "./ui/legal-page.js";
|
package/dist/ui.js
CHANGED
|
@@ -14,3 +14,4 @@ export { DashWaitlistEmailLink, DashWaitlistPage } from "./ui/waitlist-page.js";
|
|
|
14
14
|
export { DashMaintenancePage } from "./ui/maintenance-page.js";
|
|
15
15
|
export { DashLandingPage, DashWaitlistLanding } from "./ui/landing-page.js";
|
|
16
16
|
export { SiteErrorFallback } from "./ui/error-fallback.js";
|
|
17
|
+
export { DashLegalPage } from "./ui/legal-page.js";
|