ferst-core 0.17.1 → 0.19.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/bin/ferst-modules.mjs +8 -13
- package/components/BlockRenderer.astro +0 -2
- package/components/islands/MembersAccount.tsx +501 -395
- package/content/blocks.ts +2 -19
- package/content/cookies.ts +2 -3
- package/content/recipe-questions.ts +0 -1
- package/examples/recipes.ts +0 -1
- package/lib/members-account.ts +352 -283
- package/lib/members.ts +88 -134
- package/package.json +1 -1
- package/components/recipes/MembersContent.astro +0 -176
package/content/blocks.ts
CHANGED
|
@@ -330,20 +330,6 @@ export const bookBlock = z.object({
|
|
|
330
330
|
buttonLabel: z.string().max(40).optional(),
|
|
331
331
|
});
|
|
332
332
|
|
|
333
|
-
/** A members' page from the Ferst Members module, written in the portal: only signed-in members
|
|
334
|
-
* of the organisation read it. The build renders a placeholder (and the title, when given); the
|
|
335
|
-
* visitor's browser asks the site for the page (`/ferst-api/members/pages/<id>`), and the platform
|
|
336
|
-
* checks who is signed in. Nothing members-only is ever in the build or the repo (lib/members).
|
|
337
|
-
* List a site's members' pages with `npx ferst-modules`. */
|
|
338
|
-
export const membersContentBlock = z.object({
|
|
339
|
-
type: z.literal('membersContent'),
|
|
340
|
-
enabled: z.boolean().default(true),
|
|
341
|
-
/** The page's id in the portal (e.g. `mpg_3f2a…`). */
|
|
342
|
-
page: z.string().regex(/^mpg_[0-9a-f]{24}$/, 'a members’ page id from the portal, like mpg_ and 24 letters and digits'),
|
|
343
|
-
/** Shown while the page loads and to visitors who can't read it. Left out: the page's own title, once it loads. */
|
|
344
|
-
title: z.string().optional(),
|
|
345
|
-
});
|
|
346
|
-
|
|
347
333
|
/** A contact form recipe. `fields` is generic (any labelled input list) so the
|
|
348
334
|
* same recipe serves a contact page, an enquiry form, a sign-up, etc. `action`
|
|
349
335
|
* is optional: the core ships no backend, so with none it renders a standard
|
|
@@ -846,7 +832,6 @@ export type RecipeBlock =
|
|
|
846
832
|
| z.infer<typeof formBlock>
|
|
847
833
|
| z.infer<typeof payBlock>
|
|
848
834
|
| z.infer<typeof bookBlock>
|
|
849
|
-
| z.infer<typeof membersContentBlock>
|
|
850
835
|
| z.infer<typeof accordionBlock>
|
|
851
836
|
| z.infer<typeof tilesBlock>
|
|
852
837
|
| z.infer<typeof bannerBlock>
|
|
@@ -993,7 +978,6 @@ export const blockSchema = z.discriminatedUnion(
|
|
|
993
978
|
formBlock,
|
|
994
979
|
payBlock,
|
|
995
980
|
bookBlock,
|
|
996
|
-
membersContentBlock,
|
|
997
981
|
accordionBlock,
|
|
998
982
|
tilesBlock,
|
|
999
983
|
bannerBlock,
|
|
@@ -1084,8 +1068,7 @@ export const blockTypes = (
|
|
|
1084
1068
|
blockSchema as unknown as { options: ReadonlyArray<{ shape: { type: { value: BlockType } } }> }
|
|
1085
1069
|
).options.map((o) => o.shape.type.value);
|
|
1086
1070
|
|
|
1087
|
-
/** Blocks whose content comes from the Ferst platform (a form, an item to pay for, an offer to book
|
|
1088
|
-
* time; a members' page: in the visitor's browser). The public showcase can't render them without the
|
|
1071
|
+
/** Blocks whose content comes from the Ferst platform at build time (a form, an item to pay for, an offer to book). The public showcase can't render them without the
|
|
1089
1072
|
* platform, so its galleries show the look through their local twin instead (`form` renders with the
|
|
1090
1073
|
* contactForm recipe). */
|
|
1091
|
-
export const platformBlockTypes: readonly BlockType[] = ['form', 'pay', 'book'
|
|
1074
|
+
export const platformBlockTypes: readonly BlockType[] = ['form', 'pay', 'book'];
|
package/content/cookies.ts
CHANGED
|
@@ -166,8 +166,7 @@ export interface CookieScanInput {
|
|
|
166
166
|
blockTypes?: Iterable<string>;
|
|
167
167
|
/** True when the site has a Google Calendar configured (dedicated calendar page). */
|
|
168
168
|
calendarConfigured?: boolean;
|
|
169
|
-
/** True when members sign in on the site (the Ferst Members module): its sign-in cookie is listed.
|
|
170
|
-
* A members' page block on the site lists it too. */
|
|
169
|
+
/** True when members sign in on the site (the Ferst Members module): its sign-in cookie is listed. */
|
|
171
170
|
members?: boolean;
|
|
172
171
|
}
|
|
173
172
|
|
|
@@ -198,7 +197,7 @@ const BY_TYPE: Record<string, string[]> = {
|
|
|
198
197
|
/** Report the cookie uses actually active on a site, grouped by category. */
|
|
199
198
|
export function scanCookieUses(input: CookieScanInput): CookiePolicyModel {
|
|
200
199
|
const necessary = NECESSARY.map((u) => ({ ...u }));
|
|
201
|
-
const signsIn = input.members === true
|
|
200
|
+
const signsIn = input.members === true;
|
|
202
201
|
if (signsIn) necessary.push({ ...MEMBERS_SESSION });
|
|
203
202
|
if (!input.blocks && input.blockTypes) {
|
|
204
203
|
const types = new Set(input.blockTypes);
|
|
@@ -31,7 +31,6 @@ const QUESTIONS: Record<string, RecipeQuestion | null> = {
|
|
|
31
31
|
form: note('Form', 'This shows one of your organisation’s forms. Choose or create it in the portal under Forms.'),
|
|
32
32
|
pay: note('Payment', 'This takes a payment for one of the things your sites take payment for. Set what it’s for and its price in the portal, under Payments.'),
|
|
33
33
|
book: note('Booking', 'This lets visitors book a time for one of your offers. Set the offer, who gives it and their opening hours in the portal, under Events and bookings.'),
|
|
34
|
-
membersContent: note('Members’ page', 'This shows one of your members’ pages to members who are signed in. Write it, and choose the sites it’s shown on, in the portal under Members.'),
|
|
35
34
|
accordion: ask('Expandable sections', 'What information should people be able to open up and read here?', 'Give each topic a short heading and the detail that goes under it.'),
|
|
36
35
|
tiles: ask('Quick links', 'Where do visitors most often want to go from here?', 'List the places or tasks, a few words each, for example: opening times, book now, prices.'),
|
|
37
36
|
banner: ask('Banner', 'What message deserves a bold band across the page?', 'A short statement or invitation, and where it should lead if anywhere.'),
|
package/examples/recipes.ts
CHANGED
|
@@ -14,7 +14,6 @@ export const recipes: GalleryEntry[] = [
|
|
|
14
14
|
{ type: 'gallery', description: 'A responsive grid of images with optional captions.', block: { type: 'gallery', columns: 3, images: [{ src: '/placeholder.svg', alt: 'One', caption: 'One' }, { src: '/placeholder.svg', alt: 'Two', caption: 'Two' }, { src: '/placeholder.svg', alt: 'Three', caption: 'Three' }] } },
|
|
15
15
|
{ type: 'testimonial', description: 'A centred quotation with author, role and an optional avatar.', block: { type: 'testimonial', quote: 'The showcase made the whole model click in a minute.', author: 'A. Client', role: 'Parish administrator' } },
|
|
16
16
|
{ type: 'contactForm', description: 'An accessible contact form in a centred column — labelled fields, a submit and an optional note. Fields are generic, so it also serves enquiry / sign-up forms.', block: { type: 'contactForm', title: 'Send us a message', intro: 'We usually reply within a day.', note: 'Demo form — the showcase has no backend; a real client points its action at their own endpoint.' } },
|
|
17
|
-
{ type: 'membersContent', description: 'A members’ page from the Members module, written in the portal and read only by the organisation’s signed-in members. The build holds a placeholder, never the words: the visitor’s browser asks the site (`/ferst-api/members/pages/<id>`) and the platform decides. Signed out, it offers “Sign in”; someone whose membership doesn’t include it is told so. The showcase has no members service, so here it says it can’t be shown (on your own computer: that sign-in works on the published site).', block: { type: 'membersContent', page: 'mpg_000000000000000000000000', title: 'For members' } },
|
|
18
17
|
{ type: 'accordion', description: 'Generic expand/collapse rows (title + body) — native, accessible, no JavaScript. FAQ’s domain-free sibling.', block: { type: 'accordion', title: 'How it works', items: [{ heading: 'Composable', body: 'Pages are ordered blocks stored as JSON.' }, { heading: 'Consistent', body: 'Recipes lock a good layout so quality can’t drift.' }] } },
|
|
19
18
|
{ type: 'tiles', description: 'A card grid with five looks — here “elevated” (soft shadow, lifts on hover) with the optional pointer-following spotlight. Radius / stroke / elevation come from the global surface tokens.', block: { type: 'tiles', variant: 'elevated', columns: 3, spotlight: true, tiles: [{ icon: 'sparkle', eyebrow: 'Level 1', title: 'Primitives', text: 'The raw ingredients.', href: '#' }, { icon: 'book-open', eyebrow: 'Level 2', title: 'Recipes', text: 'Curated compositions.', href: '#' }, { icon: 'shield', eyebrow: 'Level 3', title: 'Templates', text: 'Whole pages.', href: '#' }] } },
|
|
20
19
|
{ type: 'tiles', description: 'The “gradient” variant — brand → a derived accent-2 (an OKLCH hue-shift of your one brand colour), light text.', block: { type: 'tiles', variant: 'gradient', columns: 3, tiles: [{ icon: 'flame', title: 'Vibrant', text: 'One brand colour, a harmonious gradient.' }, { icon: 'sparkle', title: 'Derived', text: 'Accent-2 is computed, not configured.' }, { icon: 'heart', title: 'On-brand', text: 'Always harmonises with your hue.' }] } },
|