| 1 | /** |
| 2 | * Publication metadata shared by every Codewhale legal page. This record does |
| 3 | * not approve legal text or publish a draft; approval and publication require |
| 4 | * a recorded founder decision before its status can change. |
| 5 | * |
| 6 | * Recorded founder decision (chat, 2026-10-04): the paid terms and the privacy |
| 7 | * revision drafted with them are approved and in effect from October 4, 2026. |
| 8 | * They move together: the terms name paid checkout, and so must the policy. |
| 9 | */ |
| 10 | export const LEGAL_DOCUMENTS = Object.freeze({ |
| 11 | terms: Object.freeze({ version: "2026-10-04", status: "effective", effectiveAt: "2026-10-04" }), |
| 12 | privacy: Object.freeze({ version: "2026-10-04", status: "effective", effectiveAt: "2026-10-04" }), |
| 13 | }); |
| 14 | |
| 15 | /** Render the pinned document's status; a revision date never makes a draft effective. */ |
| 16 | export function formatLegalDocumentStatus(documentId, dateLocale = "en-US") { |
| 17 | if (!Object.hasOwn(LEGAL_DOCUMENTS, documentId)) throw new TypeError("Unknown legal document"); |
| 18 | const document = LEGAL_DOCUMENTS[documentId]; |
| 19 | const date = new Intl.DateTimeFormat(dateLocale, { dateStyle: "long", timeZone: "UTC" }) |
| 20 | .format(new Date(`${document.version}T00:00:00Z`)); |
| 21 | if (dateLocale.toLowerCase().startsWith("zh")) { |
| 22 | return document.status === "draft" |
| 23 | ? `草案更新于 ${date}。尚未生效:待批准和发布。` |
| 24 | : `生效并最近更新于 ${date}。`; |
| 25 | } |
| 26 | return document.status === "draft" |
| 27 | ? `Draft updated ${date}. Not yet in effect: pending approval and publication.` |
| 28 | : `Effective and last updated ${date}`; |
| 29 | } |
| 30 |