@clossys/writer 0.5.0 → 0.5.1
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 +9 -4
- package/dist/front-door-browser.d.ts +5 -0
- package/dist/front-door-browser.d.ts.map +1 -0
- package/dist/front-door-browser.js +30 -0
- package/dist/front-door-browser.js.map +1 -0
- package/dist/front-door-core.d.ts +45 -0
- package/dist/front-door-core.d.ts.map +1 -0
- package/dist/front-door-core.js +224 -0
- package/dist/front-door-core.js.map +1 -0
- package/dist/front-door.d.ts +8 -44
- package/dist/front-door.d.ts.map +1 -1
- package/dist/front-door.js +10 -220
- package/dist/front-door.js.map +1 -1
- package/package.json +6 -2
- package/src/front-door-browser.ts +31 -0
- package/src/front-door-core.ts +265 -0
- package/src/front-door.ts +11 -258
- package/templates/front-door.en.json +5 -8
package/README.md
CHANGED
|
@@ -66,6 +66,11 @@ remains the only required first-day assessment.
|
|
|
66
66
|
`VoiceChannel`.
|
|
67
67
|
- `@clossys/writer/voice-record.template.jsonc` is an annotated,
|
|
68
68
|
unbound template to copy into a consumer repository and fill in.
|
|
69
|
+
- `@clossys/writer/front-door` exports `resolveFrontDoorCopy` and its types
|
|
70
|
+
for browser rendering with immutable shipped English defaults. It accepts
|
|
71
|
+
only key and nouns; it exposes no registry or approval overrides. Returned
|
|
72
|
+
values and provenance do not share private catalog state. Package defaults
|
|
73
|
+
are not consumer approval; consumer registries use the strict root APIs.
|
|
69
74
|
- `@clossys/writer/front-door.en.json` is the shipped English front-door
|
|
70
75
|
catalog (`FRONT_DOOR_COPY_EN`) as a `CopyRegistry` JSON file.
|
|
71
76
|
|
|
@@ -336,14 +341,14 @@ label:
|
|
|
336
341
|
| `front-door.password.secondary` | Use a different email |
|
|
337
342
|
| `front-door.identifier-not-found.notice` | We couldn’t find an account for that email. Check it and try again. |
|
|
338
343
|
| `front-door.forgot-password.label` | Forgot password? |
|
|
339
|
-
| `front-door.password.notice` | That password isn’t right. Try again
|
|
344
|
+
| `front-door.password.notice` | That password isn’t right. Try again. |
|
|
340
345
|
| `front-door.sign-in.alt` | Sign in to {brand} |
|
|
341
|
-
| `front-door.code.title` |
|
|
342
|
-
| `front-door.code.description` | Enter
|
|
346
|
+
| `front-door.code.title` | Verify your sign-in |
|
|
347
|
+
| `front-door.code.description` | Enter your verification code to continue. |
|
|
343
348
|
| `front-door.code.label` | Code |
|
|
344
349
|
| `front-door.code.primary` | Verify |
|
|
345
350
|
| `front-door.code.secondary` | Send a new code |
|
|
346
|
-
| `front-door.code.notice` | That code isn’t right or has expired. Try again
|
|
351
|
+
| `front-door.code.notice` | That code isn’t right or has expired. Try again. |
|
|
347
352
|
| `front-door.unavailable.notice` | Sign-in isn’t available right now. Try again in a few minutes. |
|
|
348
353
|
| `front-door.rate-limited.notice` | Too many attempts. Wait a few minutes, then try again. |
|
|
349
354
|
| `front-door.locked.notice` | This account is temporarily locked after too many attempts. Try again later. |
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { FrontDoorKey, FrontDoorNouns, FrontDoorCopyResolution } from "./front-door-core.js";
|
|
2
|
+
export type { FrontDoorKey, FrontDoorNoun, FrontDoorNouns, FrontDoorCopyIssueReason, FrontDoorCopyIssue, FrontDoorCopyResolution } from "./front-door-core.js";
|
|
3
|
+
/** Pure and total; each success returns independent values and provenance. */
|
|
4
|
+
export declare function resolveFrontDoorCopy(key: FrontDoorKey, nouns: FrontDoorNouns): FrontDoorCopyResolution;
|
|
5
|
+
//# sourceMappingURL=front-door-browser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"front-door-browser.d.ts","sourceRoot":"","sources":["../src/front-door-browser.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAClG,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAW/J,8EAA8E;AAC9E,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,YAAY,EAAE,KAAK,EAAE,cAAc,GAAG,uBAAuB,CAWtG"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Immutable shipped English defaults for browser rendering. This entry accepts
|
|
3
|
+
* only a reserved key and nouns; package defaults do not authorize consumer copy.
|
|
4
|
+
* Consumer registries and approval records belong to the strict root resolver.
|
|
5
|
+
*/
|
|
6
|
+
import { CANONICAL_IDS, CANONICAL_NOUNS, createDefaultCatalog, prepareFrontDoorCopy } from "./front-door-core.js";
|
|
7
|
+
const defaults = createDefaultCatalog();
|
|
8
|
+
for (const entry of defaults.entries) {
|
|
9
|
+
if (entry.placeholders)
|
|
10
|
+
Object.freeze(entry.placeholders);
|
|
11
|
+
Object.freeze(entry);
|
|
12
|
+
}
|
|
13
|
+
Object.freeze(defaults.entries);
|
|
14
|
+
Object.freeze(defaults.source);
|
|
15
|
+
Object.freeze(defaults);
|
|
16
|
+
/** Pure and total; each success returns independent values and provenance. */
|
|
17
|
+
export function resolveFrontDoorCopy(key, nouns) {
|
|
18
|
+
const prepared = prepareFrontDoorCopy(key, nouns, defaults, CANONICAL_IDS, CANONICAL_NOUNS);
|
|
19
|
+
if (!prepared.complete)
|
|
20
|
+
return prepared;
|
|
21
|
+
const { entry, values } = prepared;
|
|
22
|
+
const text = entry.text.replace(/\{([^{}]+)\}/g, (_match, name) => String(values[name]));
|
|
23
|
+
return {
|
|
24
|
+
complete: true, text, issues: [], resolution: {
|
|
25
|
+
ref: { id: key, values }, text, recordId: defaults.id, revision: defaults.revision,
|
|
26
|
+
locale: defaults.locale, source: { ...defaults.source }, entryId: entry.id,
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=front-door-browser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"front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E,QAAQ,EAAE,QAAQ,CAAC,EAAE,EAAE,QAAQ,EAAE,QAAQ,CAAC,QAAQ;YAClF,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,GAAG,QAAQ,CAAC,MAAO,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE;SAC5E;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/** Pure private catalog and noun validation shared by the two public entry points. */
|
|
2
|
+
import type { CopyRegistry, CopyRegistryEntry, CopyResolution } from "./types.js";
|
|
3
|
+
/** All reserved front-door copy ids, in catalog order. */
|
|
4
|
+
export declare const CANONICAL_IDS: readonly ["front-door.sign-in.title", "front-door.sign-in.description", "front-door.sign-in.label", "front-door.sign-in.primary", "front-door.password.title", "front-door.password.description", "front-door.password.label", "front-door.password.primary", "front-door.password.secondary", "front-door.identifier-not-found.notice", "front-door.forgot-password.label", "front-door.password.notice", "front-door.sign-in.alt", "front-door.code.title", "front-door.code.description", "front-door.code.label", "front-door.code.primary", "front-door.code.secondary", "front-door.code.notice", "front-door.unavailable.notice", "front-door.rate-limited.notice", "front-door.locked.notice", "front-door.expired.notice", "front-door.signed-out.notice", "front-door.error.title", "front-door.error.description", "front-door.error.primary", "front-door.not-found.title", "front-door.not-found.description", "front-door.not-found.primary", "front-door.not-authorized.title", "front-door.not-authorized.description", "front-door.not-authorized.primary", "front-door.not-authorized.secondary", "front-door.access-pending.title", "front-door.access-pending.description", "front-door.access-pending.primary", "front-door.service-unavailable.title", "front-door.service-unavailable.description", "front-door.service-unavailable.primary", "front-door.request-access.description", "front-door.request-access.label", "front-door.reset.title", "front-door.reset.description", "front-door.reset.label", "front-door.reset.primary", "front-door.reset.secondary", "front-door.reset.notice", "front-door.activation.title", "front-door.activation.description", "front-door.activation.primary", "front-door.activation.notice", "front-door.internal-note.label", "front-door.identifier-required.notice", "front-door.password-required.notice", "front-door.code-required.notice", "front-door.network.notice", "front-door.password-weak.notice", "front-door.reset-code.primary", "front-door.activation.label", "front-door.activation-first-name.label", "front-door.activation-last-name.label", "front-door.name-required.notice"];
|
|
5
|
+
/** A reserved front-door copy id. */
|
|
6
|
+
export type FrontDoorKey = (typeof CANONICAL_IDS)[number];
|
|
7
|
+
/** The closed set of nouns a front-door text may name as a `{token}`. */
|
|
8
|
+
export declare const CANONICAL_NOUNS: readonly ["brand", "surface", "identifier", "digest", "requestAccessLabel"];
|
|
9
|
+
/** One noun a front-door text may name. */
|
|
10
|
+
export type FrontDoorNoun = (typeof CANONICAL_NOUNS)[number];
|
|
11
|
+
/** The nouns a caller supplies; each is read only when the entry declares it. */
|
|
12
|
+
export type FrontDoorNouns = Partial<Record<FrontDoorNoun, string>>;
|
|
13
|
+
/** Why a front-door entry could not be resolved. */
|
|
14
|
+
export type FrontDoorCopyIssueReason = "unknown-copy-id" | "missing-noun" | "unknown-noun";
|
|
15
|
+
/** One reason a front-door entry could not be resolved. */
|
|
16
|
+
export interface FrontDoorCopyIssue {
|
|
17
|
+
reason: FrontDoorCopyIssueReason;
|
|
18
|
+
message: string;
|
|
19
|
+
/** The id asked for, on `"unknown-copy-id"`. */
|
|
20
|
+
id?: string;
|
|
21
|
+
/** The noun at fault, on `"missing-noun"` and `"unknown-noun"`. */
|
|
22
|
+
noun?: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The outcome of `resolveFrontDoorCopy`. `text` and `resolution` are
|
|
26
|
+
* present only when `complete` is `true`; `issues` is empty exactly then.
|
|
27
|
+
*/
|
|
28
|
+
export interface FrontDoorCopyResolution {
|
|
29
|
+
complete: boolean;
|
|
30
|
+
text?: string;
|
|
31
|
+
resolution?: CopyResolution;
|
|
32
|
+
issues: FrontDoorCopyIssue[];
|
|
33
|
+
}
|
|
34
|
+
/** Returns independent mutable defaults for the legacy registry resolver. */
|
|
35
|
+
export declare function createDefaultCatalog(): CopyRegistry;
|
|
36
|
+
/** Reads and validates nouns without importing registry approval machinery. */
|
|
37
|
+
export declare function prepareFrontDoorCopy(key: FrontDoorKey, nouns: FrontDoorNouns, catalog: CopyRegistry, ids: readonly string[], nounNames: readonly string[]): {
|
|
38
|
+
complete: false;
|
|
39
|
+
issues: FrontDoorCopyIssue[];
|
|
40
|
+
} | {
|
|
41
|
+
complete: true;
|
|
42
|
+
entry: CopyRegistryEntry;
|
|
43
|
+
values: Record<string, string>;
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=front-door-core.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"front-door-core.d.ts","sourceRoot":"","sources":["../src/front-door-core.ts"],"names":[],"mappings":"AAAA,sFAAsF;AACtF,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAClF,0DAA0D;AAC1D,eAAO,MAAM,aAAa,2iEAgEf,CAAC;AAEZ,qCAAqC;AACrC,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAE1D,yEAAyE;AACzE,eAAO,MAAM,eAAe,6EAA6F,CAAC;AAE1H,2CAA2C;AAC3C,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAE7D,iFAAiF;AACjF,MAAM,MAAM,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC,CAAC;AAEpE,oDAAoD;AACpD,MAAM,MAAM,wBAAwB,GAAG,iBAAiB,GAAG,cAAc,GAAG,cAAc,CAAC;AAE3F,2DAA2D;AAC3D,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,wBAAwB,CAAC;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,gDAAgD;IAChD,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,mEAAmE;IACnE,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,cAAc,CAAC;IAC5B,MAAM,EAAE,kBAAkB,EAAE,CAAC;CAC9B;AA6FD,6EAA6E;AAC7E,wBAAgB,oBAAoB,IAAI,YAAY,CAMnD;AAuBD,+EAA+E;AAC/E,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,YAAY,EAAE,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,YAAY,EAClG,GAAG,EAAE,SAAS,MAAM,EAAE,EAAE,SAAS,EAAE,SAAS,MAAM,EAAE,GAAG;IAAE,QAAQ,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,kBAAkB,EAAE,CAAA;CAAE,GAAG;IAAE,QAAQ,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,iBAAiB,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,CAoCxL"}
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
/** All reserved front-door copy ids, in catalog order. */
|
|
2
|
+
export const CANONICAL_IDS = Object.freeze([
|
|
3
|
+
"front-door.sign-in.title",
|
|
4
|
+
"front-door.sign-in.description",
|
|
5
|
+
"front-door.sign-in.label",
|
|
6
|
+
"front-door.sign-in.primary",
|
|
7
|
+
"front-door.password.title",
|
|
8
|
+
"front-door.password.description",
|
|
9
|
+
"front-door.password.label",
|
|
10
|
+
"front-door.password.primary",
|
|
11
|
+
"front-door.password.secondary",
|
|
12
|
+
"front-door.identifier-not-found.notice",
|
|
13
|
+
"front-door.forgot-password.label",
|
|
14
|
+
"front-door.password.notice",
|
|
15
|
+
"front-door.sign-in.alt",
|
|
16
|
+
"front-door.code.title",
|
|
17
|
+
"front-door.code.description",
|
|
18
|
+
"front-door.code.label",
|
|
19
|
+
"front-door.code.primary",
|
|
20
|
+
"front-door.code.secondary",
|
|
21
|
+
"front-door.code.notice",
|
|
22
|
+
"front-door.unavailable.notice",
|
|
23
|
+
"front-door.rate-limited.notice",
|
|
24
|
+
"front-door.locked.notice",
|
|
25
|
+
"front-door.expired.notice",
|
|
26
|
+
"front-door.signed-out.notice",
|
|
27
|
+
"front-door.error.title",
|
|
28
|
+
"front-door.error.description",
|
|
29
|
+
"front-door.error.primary",
|
|
30
|
+
"front-door.not-found.title",
|
|
31
|
+
"front-door.not-found.description",
|
|
32
|
+
"front-door.not-found.primary",
|
|
33
|
+
"front-door.not-authorized.title",
|
|
34
|
+
"front-door.not-authorized.description",
|
|
35
|
+
"front-door.not-authorized.primary",
|
|
36
|
+
"front-door.not-authorized.secondary",
|
|
37
|
+
"front-door.access-pending.title",
|
|
38
|
+
"front-door.access-pending.description",
|
|
39
|
+
"front-door.access-pending.primary",
|
|
40
|
+
"front-door.service-unavailable.title",
|
|
41
|
+
"front-door.service-unavailable.description",
|
|
42
|
+
"front-door.service-unavailable.primary",
|
|
43
|
+
"front-door.request-access.description",
|
|
44
|
+
"front-door.request-access.label",
|
|
45
|
+
"front-door.reset.title",
|
|
46
|
+
"front-door.reset.description",
|
|
47
|
+
"front-door.reset.label",
|
|
48
|
+
"front-door.reset.primary",
|
|
49
|
+
"front-door.reset.secondary",
|
|
50
|
+
"front-door.reset.notice",
|
|
51
|
+
"front-door.activation.title",
|
|
52
|
+
"front-door.activation.description",
|
|
53
|
+
"front-door.activation.primary",
|
|
54
|
+
"front-door.activation.notice",
|
|
55
|
+
"front-door.internal-note.label",
|
|
56
|
+
"front-door.identifier-required.notice",
|
|
57
|
+
"front-door.password-required.notice",
|
|
58
|
+
"front-door.code-required.notice",
|
|
59
|
+
"front-door.network.notice",
|
|
60
|
+
"front-door.password-weak.notice",
|
|
61
|
+
"front-door.reset-code.primary",
|
|
62
|
+
"front-door.activation.label",
|
|
63
|
+
"front-door.activation-first-name.label",
|
|
64
|
+
"front-door.activation-last-name.label",
|
|
65
|
+
"front-door.name-required.notice",
|
|
66
|
+
]);
|
|
67
|
+
/** The closed set of nouns a front-door text may name as a `{token}`. */
|
|
68
|
+
export const CANONICAL_NOUNS = Object.freeze(["brand", "surface", "identifier", "digest", "requestAccessLabel"]);
|
|
69
|
+
const DEFAULTS = {
|
|
70
|
+
"front-door.sign-in.title": { text: "Sign in", context: "sign-in page: heading" },
|
|
71
|
+
"front-door.sign-in.description": { text: "Continue to {surface}.", context: "sign-in page: line under the heading" },
|
|
72
|
+
"front-door.sign-in.label": { text: "Email", context: "sign-in page: email field label" },
|
|
73
|
+
"front-door.sign-in.primary": { text: "Continue", context: "sign-in page: main button" },
|
|
74
|
+
"front-door.password.title": { text: "Enter your password", context: "password page: heading" },
|
|
75
|
+
"front-door.password.description": { text: "Signing in as {identifier}.", context: "password page: line under the heading" },
|
|
76
|
+
"front-door.password.label": { text: "Password", context: "password page: password field label" },
|
|
77
|
+
"front-door.password.primary": { text: "Sign in", context: "password page: main button" },
|
|
78
|
+
"front-door.password.secondary": { text: "Use a different email", context: "password page: link back to the email step" },
|
|
79
|
+
"front-door.identifier-not-found.notice": {
|
|
80
|
+
text: "We couldn’t find an account for that email. Check it and try again.",
|
|
81
|
+
context: "sign-in page: notice when no account matches the email",
|
|
82
|
+
},
|
|
83
|
+
"front-door.forgot-password.label": { text: "Forgot password?", context: "sign-in page: link to start a password reset" },
|
|
84
|
+
"front-door.password.notice": { text: "That password isn’t right. Try again.", context: "password page: notice when the password is wrong" },
|
|
85
|
+
"front-door.sign-in.alt": { text: "Sign in to {brand}", context: "sign-in page: alt text for the brand mark" },
|
|
86
|
+
"front-door.code.title": { text: "Verify your sign-in", context: "code page: heading" },
|
|
87
|
+
"front-door.code.description": { text: "Enter your verification code to continue.", context: "code page: line under the heading" },
|
|
88
|
+
"front-door.code.label": { text: "Code", context: "code page: code field label" },
|
|
89
|
+
"front-door.code.primary": { text: "Verify", context: "code page: main button" },
|
|
90
|
+
"front-door.code.secondary": { text: "Send a new code", context: "code page: link to request another code" },
|
|
91
|
+
"front-door.code.notice": { text: "That code isn’t right or has expired. Try again.", context: "code page: notice when the code is wrong or expired" },
|
|
92
|
+
"front-door.unavailable.notice": { text: "Sign-in isn’t available right now. Try again in a few minutes.", context: "sign-in page: notice when sign-in is temporarily unavailable" },
|
|
93
|
+
"front-door.rate-limited.notice": { text: "Too many attempts. Wait a few minutes, then try again.", context: "sign-in page: notice when attempts are rate limited" },
|
|
94
|
+
"front-door.locked.notice": { text: "This account is temporarily locked after too many attempts. Try again later.", context: "sign-in page: notice when the account is temporarily locked" },
|
|
95
|
+
"front-door.expired.notice": { text: "Your session expired. Sign in again to continue.", context: "sign-in page: notice when the session has expired" },
|
|
96
|
+
"front-door.signed-out.notice": { text: "You’re signed out.", context: "sign-in page: notice after signing out" },
|
|
97
|
+
"front-door.error.title": { text: "This page didn’t load", context: "error page: heading" },
|
|
98
|
+
"front-door.error.description": { text: "Something went wrong. Error: {digest}.", context: "error page: line under the heading, with the error digest" },
|
|
99
|
+
"front-door.error.primary": { text: "Try again", context: "error page: main button" },
|
|
100
|
+
"front-door.not-found.title": { text: "Page not found", context: "not-found page: heading" },
|
|
101
|
+
"front-door.not-found.description": { text: "This page doesn’t exist or has moved.", context: "not-found page: line under the heading" },
|
|
102
|
+
"front-door.not-found.primary": { text: "Go to {surface}", context: "not-found page: main button back to the surface" },
|
|
103
|
+
"front-door.not-authorized.title": { text: "You don’t have access", context: "not-authorized page: heading" },
|
|
104
|
+
"front-door.not-authorized.description": { text: "{identifier} doesn’t have access to {surface}.", context: "not-authorized page: line under the heading" },
|
|
105
|
+
"front-door.not-authorized.primary": { text: "Switch account", context: "not-authorized page: main button" },
|
|
106
|
+
"front-door.not-authorized.secondary": { text: "Sign out", context: "not-authorized page: link to sign out" },
|
|
107
|
+
"front-door.access-pending.title": { text: "Access pending", context: "access-pending page: heading" },
|
|
108
|
+
"front-door.access-pending.description": { text: "Your access to {surface} awaits approval. Check back later.", context: "access-pending page: line under the heading" },
|
|
109
|
+
"front-door.access-pending.primary": { text: "Sign out", context: "access-pending page: main button" },
|
|
110
|
+
"front-door.service-unavailable.title": { text: "{surface} isn’t available", context: "service-unavailable page: heading" },
|
|
111
|
+
"front-door.service-unavailable.description": { text: "This is temporary. Try again soon.", context: "service-unavailable page: line under the heading" },
|
|
112
|
+
"front-door.service-unavailable.primary": { text: "Try again", context: "service-unavailable page: main button" },
|
|
113
|
+
"front-door.request-access.description": { text: "Don’t have an account?", context: "sign-in page: line before the request-access link" },
|
|
114
|
+
"front-door.request-access.label": { text: "{requestAccessLabel}", context: "sign-in page: request-access link label" },
|
|
115
|
+
"front-door.reset.title": { text: "Reset your password", context: "reset page: heading" },
|
|
116
|
+
"front-door.reset.description": { text: "Enter your email and we’ll send you a code.", context: "reset page: line under the heading" },
|
|
117
|
+
"front-door.reset.label": { text: "New password", context: "reset page: new password field label" },
|
|
118
|
+
"front-door.reset.primary": { text: "Send code", context: "reset page: main button" },
|
|
119
|
+
"front-door.reset.secondary": { text: "Back to sign in", context: "reset page: link back to sign-in" },
|
|
120
|
+
"front-door.reset.notice": { text: "Password updated. Sign in with your new password.", context: "sign-in page: notice after a password reset" },
|
|
121
|
+
"front-door.activation.title": { text: "Set up your account", context: "activation page: heading" },
|
|
122
|
+
"front-door.activation.description": { text: "You’re invited to {surface}. Choose a password to finish.", context: "activation page: line under the heading" },
|
|
123
|
+
"front-door.activation.primary": { text: "Activate account", context: "activation page: main button" },
|
|
124
|
+
"front-door.activation.notice": { text: "This invitation has expired or was already used. Ask for a new invitation.", context: "activation page: notice when the invitation is no longer valid" },
|
|
125
|
+
"front-door.internal-note.label": { text: "Internal", context: "label marking a note visible only inside the organization" },
|
|
126
|
+
"front-door.identifier-required.notice": { text: "Enter your email.", context: "sign-in page: notice when the email is empty" },
|
|
127
|
+
"front-door.password-required.notice": { text: "Enter your password.", context: "password page: notice when the password is empty" },
|
|
128
|
+
"front-door.code-required.notice": { text: "Enter the code.", context: "code page: notice when the code is empty" },
|
|
129
|
+
"front-door.network.notice": { text: "Couldn’t reach {surface}. Check your connection and try again.", context: "any page: notice when the request could not reach the surface" },
|
|
130
|
+
"front-door.password-weak.notice": {
|
|
131
|
+
text: "That password isn’t strong enough. Use a longer one you haven’t used anywhere else.",
|
|
132
|
+
context: "reset and activation pages: notice when the new password is refused as too weak",
|
|
133
|
+
},
|
|
134
|
+
"front-door.reset-code.primary": { text: "Reset password", context: "reset page, code step: main button" },
|
|
135
|
+
"front-door.activation.label": { text: "Password", context: "activation page: password field label" },
|
|
136
|
+
"front-door.activation-first-name.label": { text: "First name", context: "activation page: first name field label" },
|
|
137
|
+
"front-door.activation-last-name.label": { text: "Last name", context: "activation page: last name field label" },
|
|
138
|
+
"front-door.name-required.notice": { text: "Enter your first and last name.", context: "activation page: notice when a name field is empty" },
|
|
139
|
+
};
|
|
140
|
+
for (const entry of Object.values(DEFAULTS))
|
|
141
|
+
Object.freeze(entry);
|
|
142
|
+
Object.freeze(DEFAULTS);
|
|
143
|
+
function placeholdersOf(text) {
|
|
144
|
+
return [...new Set([...text.matchAll(/\{([^{}]+)\}/g)].map((match) => match[1]))];
|
|
145
|
+
}
|
|
146
|
+
function entryFor(id) {
|
|
147
|
+
const { text, context } = DEFAULTS[id];
|
|
148
|
+
const placeholders = placeholdersOf(text);
|
|
149
|
+
return {
|
|
150
|
+
id,
|
|
151
|
+
text,
|
|
152
|
+
context,
|
|
153
|
+
status: "approved",
|
|
154
|
+
...(placeholders.length > 0 ? { placeholders } : {}),
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
/** Returns independent mutable defaults for the legacy registry resolver. */
|
|
158
|
+
export function createDefaultCatalog() {
|
|
159
|
+
return {
|
|
160
|
+
id: "front-door", locale: "en", revision: "1",
|
|
161
|
+
source: { kind: "imported", reference: "@clossys/writer/front-door.en.json" },
|
|
162
|
+
entries: CANONICAL_IDS.map(entryFor)
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
/** Copies the own, enumerable string-keyed values of `nouns`; anything unreadable reads as no nouns at all. */
|
|
166
|
+
function readNouns(nouns) {
|
|
167
|
+
const read = new Map();
|
|
168
|
+
if (typeof nouns !== "object" || nouns === null || Array.isArray(nouns))
|
|
169
|
+
return read;
|
|
170
|
+
try {
|
|
171
|
+
for (const name of Object.keys(nouns))
|
|
172
|
+
read.set(name, nouns[name]);
|
|
173
|
+
}
|
|
174
|
+
catch {
|
|
175
|
+
return new Map();
|
|
176
|
+
}
|
|
177
|
+
return read;
|
|
178
|
+
}
|
|
179
|
+
/** Names a lookup key for a message; a key that cannot be stringified (a null-prototype object, a throwing `toString`) reads as its type. */
|
|
180
|
+
function describeKey(key) {
|
|
181
|
+
try {
|
|
182
|
+
return String(key);
|
|
183
|
+
}
|
|
184
|
+
catch {
|
|
185
|
+
return `<${typeof key}>`;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
/** Reads and validates nouns without importing registry approval machinery. */
|
|
189
|
+
export function prepareFrontDoorCopy(key, nouns, catalog, ids, nounNames) {
|
|
190
|
+
if (typeof key !== "string" || !ids.includes(key)) {
|
|
191
|
+
return {
|
|
192
|
+
complete: false,
|
|
193
|
+
issues: [{ reason: "unknown-copy-id", id: describeKey(key), message: `Front-door copy id "${describeKey(key)}" is not a reserved id.` }],
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
const entry = catalog.entries.find((candidate) => candidate.id === key);
|
|
197
|
+
if (!entry) {
|
|
198
|
+
return {
|
|
199
|
+
complete: false,
|
|
200
|
+
issues: [{ reason: "unknown-copy-id", id: key, message: `Front-door copy "${key}" is not present in the catalog.` }],
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
const supplied = readNouns(nouns);
|
|
204
|
+
const issues = [];
|
|
205
|
+
for (const name of supplied.keys()) {
|
|
206
|
+
if (!nounNames.includes(name)) {
|
|
207
|
+
issues.push({ reason: "unknown-noun", noun: name, message: `"${name}" is not a front-door noun.` });
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
const values = {};
|
|
211
|
+
for (const name of entry.placeholders ?? []) {
|
|
212
|
+
const value = supplied.get(name);
|
|
213
|
+
if (typeof value !== "string" || value.trim().length === 0) {
|
|
214
|
+
issues.push({ reason: "missing-noun", id: key, noun: name, message: `Front-door copy "${key}" needs the noun "${name}", which is absent or blank.` });
|
|
215
|
+
}
|
|
216
|
+
else {
|
|
217
|
+
values[name] = value;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
if (issues.length > 0)
|
|
221
|
+
return { complete: false, issues };
|
|
222
|
+
return { complete: true, entry, values };
|
|
223
|
+
}
|
|
224
|
+
//# sourceMappingURL=front-door-core.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"front-door-core.js","sourceRoot":"","sources":["../src/front-door-core.ts"],"names":[],"mappings":"AAEA,0DAA0D;AAC1D,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC;IACzC,0BAA0B;IAC1B,gCAAgC;IAChC,0BAA0B;IAC1B,4BAA4B;IAC5B,2BAA2B;IAC3B,iCAAiC;IACjC,2BAA2B;IAC3B,6BAA6B;IAC7B,+BAA+B;IAC/B,wCAAwC;IACxC,kCAAkC;IAClC,4BAA4B;IAC5B,wBAAwB;IACxB,uBAAuB;IACvB,6BAA6B;IAC7B,uBAAuB;IACvB,yBAAyB;IACzB,2BAA2B;IAC3B,wBAAwB;IACxB,+BAA+B;IAC/B,gCAAgC;IAChC,0BAA0B;IAC1B,2BAA2B;IAC3B,8BAA8B;IAC9B,wBAAwB;IACxB,8BAA8B;IAC9B,0BAA0B;IAC1B,4BAA4B;IAC5B,kCAAkC;IAClC,8BAA8B;IAC9B,iCAAiC;IACjC,uCAAuC;IACvC,mCAAmC;IACnC,qCAAqC;IACrC,iCAAiC;IACjC,uCAAuC;IACvC,mCAAmC;IACnC,sCAAsC;IACtC,4CAA4C;IAC5C,wCAAwC;IACxC,uCAAuC;IACvC,iCAAiC;IACjC,wBAAwB;IACxB,8BAA8B;IAC9B,wBAAwB;IACxB,0BAA0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EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC3D,MAAM,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,cAAc,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,oBAAoB,GAAG,qBAAqB,IAAI,8BAA8B,EAAE,CAAC,CAAC;QACxJ,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;QACvB,CAAC;IACH,CAAC;IACD,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,EAAE,QAAQ,EAAE,KAAc,EAAE,MAAM,EAAE,CAAC;IAEnE,OAAO,EAAE,QAAQ,EAAE,IAAa,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;AACpD,CAAC"}
|
package/dist/front-door.d.ts
CHANGED
|
@@ -33,50 +33,14 @@
|
|
|
33
33
|
* record: their `approved` status is the package's own statement, not a
|
|
34
34
|
* consumer's sign-off.
|
|
35
35
|
*/
|
|
36
|
-
import
|
|
37
|
-
|
|
38
|
-
export
|
|
39
|
-
/**
|
|
40
|
-
export
|
|
41
|
-
|
|
42
|
-
export declare const
|
|
43
|
-
/** One noun a front-door text may name. */
|
|
44
|
-
export type FrontDoorNoun = (typeof FRONT_DOOR_NOUNS)[number];
|
|
45
|
-
/** The nouns a caller supplies; each is read only when the entry declares it. */
|
|
46
|
-
export type FrontDoorNouns = Partial<Record<FrontDoorNoun, string>>;
|
|
47
|
-
/** Why a front-door entry could not be resolved. */
|
|
48
|
-
export type FrontDoorCopyIssueReason = "unknown-copy-id" | "missing-noun" | "unknown-noun";
|
|
49
|
-
/** One reason a front-door entry could not be resolved. */
|
|
50
|
-
export interface FrontDoorCopyIssue {
|
|
51
|
-
reason: FrontDoorCopyIssueReason;
|
|
52
|
-
message: string;
|
|
53
|
-
/** The id asked for, on `"unknown-copy-id"`. */
|
|
54
|
-
id?: string;
|
|
55
|
-
/** The noun at fault, on `"missing-noun"` and `"unknown-noun"`. */
|
|
56
|
-
noun?: string;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* The outcome of `resolveFrontDoorCopy`. `text` and `resolution` are
|
|
60
|
-
* present only when `complete` is `true`; `issues` is empty exactly then.
|
|
61
|
-
*/
|
|
62
|
-
export interface FrontDoorCopyResolution {
|
|
63
|
-
complete: boolean;
|
|
64
|
-
text?: string;
|
|
65
|
-
resolution?: CopyResolution;
|
|
66
|
-
issues: FrontDoorCopyIssue[];
|
|
67
|
-
}
|
|
68
|
-
/** The shipped English defaults for every id in `FRONT_DOOR_COPY_IDS`. */
|
|
69
|
-
export declare const FRONT_DOOR_COPY_EN: CopyRegistry;
|
|
70
|
-
/** Whether `value` is one of the reserved front-door copy ids. */
|
|
36
|
+
import { CANONICAL_IDS, CANONICAL_NOUNS } from "./front-door-core.js";
|
|
37
|
+
import type { FrontDoorKey, FrontDoorNouns, FrontDoorCopyResolution } from "./front-door-core.js";
|
|
38
|
+
export type { FrontDoorKey, FrontDoorNoun, FrontDoorNouns, FrontDoorCopyIssueReason, FrontDoorCopyIssue, FrontDoorCopyResolution } from "./front-door-core.js";
|
|
39
|
+
/** Independent mutable legacy catalog objects; private browser defaults never share them. */
|
|
40
|
+
export declare const FRONT_DOOR_COPY_IDS: typeof CANONICAL_IDS;
|
|
41
|
+
export declare const FRONT_DOOR_NOUNS: typeof CANONICAL_NOUNS;
|
|
42
|
+
export declare const FRONT_DOOR_COPY_EN: import("./types.js").CopyRegistry;
|
|
71
43
|
export declare function isFrontDoorCopyId(value: unknown): value is FrontDoorKey;
|
|
72
|
-
/**
|
|
73
|
-
* Resolves one front-door entry from the shipped English defaults, naming
|
|
74
|
-
* the nouns it declares. Only nouns the entry declares reach
|
|
75
|
-
* `resolveCopyRef`; a name outside `FRONT_DOOR_NOUNS` is reported as
|
|
76
|
-
* `"unknown-noun"` and a declared noun that is absent or blank as
|
|
77
|
-
* `"missing-noun"`. An id outside `FRONT_DOOR_COPY_IDS` is
|
|
78
|
-
* `"unknown-copy-id"`. Pure and total: the defaults and `nouns` are not
|
|
79
|
-
* modified and no input makes this throw.
|
|
80
|
-
*/
|
|
44
|
+
/** Resolves through the strict registry resolver, preserving approval refusals. */
|
|
81
45
|
export declare function resolveFrontDoorCopy(key: FrontDoorKey, nouns: FrontDoorNouns): FrontDoorCopyResolution;
|
|
82
46
|
//# sourceMappingURL=front-door.d.ts.map
|
package/dist/front-door.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"front-door.d.ts","sourceRoot":"","sources":["../src/front-door.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAGH,OAAO,
|
|
1
|
+
{"version":3,"file":"front-door.d.ts","sourceRoot":"","sources":["../src/front-door.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAGH,OAAO,EAAE,aAAa,EAAE,eAAe,EAA8C,MAAM,sBAAsB,CAAC;AAClH,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAClG,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAE/J,6FAA6F;AAC7F,eAAO,MAAM,mBAAmB,EAAoC,OAAO,aAAa,CAAC;AACzF,eAAO,MAAM,gBAAgB,EAAsC,OAAO,eAAe,CAAC;AAC1F,eAAO,MAAM,kBAAkB,mCAAyB,CAAC;AAEzD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY,CAEvE;AAED,mFAAmF;AACnF,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,YAAY,EAAE,KAAK,EAAE,cAAc,GAAG,uBAAuB,CAatG"}
|