@the-smithy/hearth-schema 0.0.0-stage → 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/dist/index.js ADDED
@@ -0,0 +1,500 @@
1
+ // src/blocks.ts
2
+ import { z } from "zod";
3
+ var BLOCK_SCHEMA_VERSION = 1;
4
+ var image = z.object({
5
+ /** R2 object key of an uploaded file, or an absolute URL. The API returns absolute URLs. */
6
+ src: z.string().min(1),
7
+ alt: z.string().default("")
8
+ });
9
+ var link = z.object({
10
+ label: z.string().min(1),
11
+ /** A path on the site ("/about") or a full URL. */
12
+ href: z.string().min(1)
13
+ });
14
+ var markdown = z.string().default("");
15
+ var tone = z.enum(["default", "muted", "inverse", "accent"]);
16
+ var formFieldSchema = z.object({
17
+ /** Key in the submitted data, e.g. "phone". */
18
+ name: z.string().regex(/^[a-z][a-zA-Z0-9_]*$/, "Use letters and numbers, starting with a lowercase letter."),
19
+ label: z.string().min(1),
20
+ type: z.enum(["text", "email", "tel", "textarea", "select", "checkbox"]),
21
+ required: z.boolean().default(false),
22
+ /** Choices for a select, one per line in the editor. */
23
+ options: z.array(z.string().min(1)).optional(),
24
+ /** Example text inside the empty input (for a select, the prompt before a choice is made). */
25
+ placeholder: z.string().max(120).optional()
26
+ });
27
+ var blockDataSchemas = {
28
+ hero: z.object({
29
+ eyebrow: z.string().optional(),
30
+ heading: z.string().min(1),
31
+ body: z.string().optional(),
32
+ image: image.optional(),
33
+ primaryCta: link.optional(),
34
+ secondaryCta: link.optional(),
35
+ size: z.enum(["full", "compact"]).default("full"),
36
+ /** Show the site's logo (Settings → SEO) in the hero; the API adds it as `logo`. */
37
+ showLogo: z.boolean().optional()
38
+ }),
39
+ richText: z.object({
40
+ markdown,
41
+ width: z.enum(["narrow", "wide"]).default("narrow")
42
+ }),
43
+ mediaText: z.object({
44
+ eyebrow: z.string().optional(),
45
+ heading: z.string().min(1),
46
+ markdown,
47
+ image: image.optional(),
48
+ imagePosition: z.enum(["left", "right"]).default("right"),
49
+ /** "contain" shows the whole image (logos, badges); "cover" fills the frame. */
50
+ imageFit: z.enum(["cover", "contain"]).default("cover"),
51
+ cta: link.optional()
52
+ }),
53
+ stats: z.object({
54
+ heading: z.string().optional(),
55
+ items: z.array(z.object({ value: z.string().min(1), label: z.string().min(1) })).min(1)
56
+ }),
57
+ cardGrid: z.object({
58
+ eyebrow: z.string().optional(),
59
+ heading: z.string().optional(),
60
+ intro: z.string().optional(),
61
+ items: z.array(
62
+ z.object({
63
+ title: z.string().min(1),
64
+ body: z.string().default(""),
65
+ image: image.optional(),
66
+ link: link.optional()
67
+ })
68
+ ).min(1),
69
+ tone: tone.default("default")
70
+ }),
71
+ cta: z.object({
72
+ heading: z.string().min(1),
73
+ body: z.string().optional(),
74
+ primary: link.optional(),
75
+ secondary: link.optional(),
76
+ tone: tone.default("accent"),
77
+ /** Optional background photo. */
78
+ image: image.optional()
79
+ }),
80
+ faq: z.object({
81
+ heading: z.string().optional(),
82
+ items: z.array(z.object({ question: z.string().min(1), answer: markdown })).min(1)
83
+ }),
84
+ /** Plans or packages side by side. Prices are text, so any currency, "Free" or "Let's talk" works. */
85
+ pricing: z.object({
86
+ eyebrow: z.string().optional(),
87
+ heading: z.string().optional(),
88
+ intro: z.string().optional(),
89
+ plans: z.array(
90
+ z.object({
91
+ name: z.string().min(1),
92
+ /** Shown large, e.g. "$15", "Free" or "Let's talk". */
93
+ price: z.string().min(1),
94
+ /** Shown after the price, e.g. "per user / month". */
95
+ period: z.string().optional(),
96
+ description: z.string().optional(),
97
+ /** What the plan includes, one item each. */
98
+ features: z.array(z.string().min(1)).default([]),
99
+ cta: link.optional(),
100
+ /** A badge such as "Most popular". The plan is also given emphasis. */
101
+ highlight: z.string().optional()
102
+ })
103
+ ).min(1).max(6),
104
+ /** Small print under the plans: taxes, billing terms, notes. */
105
+ footnote: z.string().optional(),
106
+ tone: tone.default("default")
107
+ }),
108
+ /** Portfolio work: projects with a description, screenshot, live link, role and the tools used. */
109
+ projects: z.object({
110
+ eyebrow: z.string().optional(),
111
+ heading: z.string().optional(),
112
+ intro: z.string().optional(),
113
+ items: z.array(
114
+ z.object({
115
+ name: z.string().min(1),
116
+ description: markdown,
117
+ /** A screenshot or photo of the work. */
118
+ image: image.optional(),
119
+ /** The live site or app. */
120
+ url: z.string().url().optional(),
121
+ /** The part played, e.g. "Website manager" or "CTO". */
122
+ role: z.string().optional(),
123
+ /** A short badge such as "Live", "Beta" or "2019–2021". */
124
+ status: z.string().optional(),
125
+ /** Tools and platforms used, one each. */
126
+ stack: z.array(z.string().min(1)).default([])
127
+ })
128
+ ).min(1).max(24),
129
+ /** "showcase" gives each project a large image in alternating rows; "grid" shows compact cards. */
130
+ layout: z.enum(["showcase", "grid"]).default("showcase"),
131
+ tone: tone.default("default")
132
+ }),
133
+ location: z.object({
134
+ eyebrow: z.string().optional(),
135
+ heading: z.string().optional(),
136
+ /** Venue or office name. */
137
+ name: z.string().min(1),
138
+ /** Street address; used for the map and directions. */
139
+ address: z.string().min(1),
140
+ /** Free text so editors control the wording: "Mon–Fri · 9am–5pm". */
141
+ hours: z.string().optional(),
142
+ notes: z.string().optional(),
143
+ showMap: z.boolean().default(true)
144
+ }),
145
+ schedule: z.object({
146
+ eyebrow: z.string().optional(),
147
+ heading: z.string().optional(),
148
+ intro: z.string().optional(),
149
+ items: z.array(z.object({ time: z.string().min(1), title: z.string().min(1), details: z.string().optional() })).min(1)
150
+ }),
151
+ gallery: z.object({
152
+ heading: z.string().optional(),
153
+ intro: z.string().optional(),
154
+ images: z.array(z.object({ image, caption: z.string().optional() })).min(1),
155
+ columns: z.enum(["2", "3", "4"]).default("3")
156
+ }),
157
+ quote: z.object({
158
+ quote: z.string().min(1),
159
+ name: z.string().optional(),
160
+ role: z.string().optional(),
161
+ image: image.optional(),
162
+ tone: tone.default("default")
163
+ }),
164
+ video: z.object({
165
+ heading: z.string().optional(),
166
+ /** YouTube or Vimeo link. */
167
+ url: z.string().url().refine((u) => videoEmbedUrl(u) !== null, "Use a YouTube or Vimeo link."),
168
+ /** Describes the video for screen readers. */
169
+ title: z.string().min(1),
170
+ caption: z.string().optional()
171
+ }),
172
+ people: z.object({
173
+ eyebrow: z.string().optional(),
174
+ heading: z.string().optional(),
175
+ intro: z.string().optional(),
176
+ people: z.array(z.object({ name: z.string().min(1), role: z.string().optional(), image: image.optional(), bio: z.string().optional() })).min(1)
177
+ }),
178
+ logos: z.object({
179
+ heading: z.string().optional(),
180
+ intro: z.string().optional(),
181
+ logos: z.array(z.object({ name: z.string().min(1), logo: image.optional(), url: z.string().url().optional() })).min(1)
182
+ }),
183
+ form: z.object({
184
+ heading: z.string().optional(),
185
+ intro: z.string().optional(),
186
+ /** Which of the site's forms (Forms in the admin), e.g. "contact". Submissions are stored under this key. */
187
+ formKey: z.string().regex(/^[a-z0-9]+(-[a-z0-9]+)*$/, "Use lowercase letters, numbers and dashes."),
188
+ /**
189
+ * The form's fields. Forms are managed on the site's Forms page, and the API fills these (and the labels and
190
+ * messages below) from there, so stored blocks only name the form. Older blocks defined their form inline here.
191
+ */
192
+ fields: z.array(formFieldSchema).min(1).optional(),
193
+ submitLabel: z.string().min(1).default("Send"),
194
+ successMessage: z.string().min(1).default("Thanks! We'll be in touch soon."),
195
+ /** Email a confirmation to the address in the form's email field (wording under Emails → Form confirmation). */
196
+ sendConfirmation: z.boolean().optional(),
197
+ /** This form's own confirmation message, replacing the default intro. May use {{firstName}}, {{form}}, {{organization}}. */
198
+ confirmationMessage: z.string().max(2e3).optional(),
199
+ /**
200
+ * Show this Ember form (Ember, The Smithy's CRM: its public id, frm_…) instead of the site's form, so submissions
201
+ * become leads in Ember. Render it with @the-smithy/ember; frontends that don't show the site's form instead.
202
+ */
203
+ emberFormId: z.string().regex(/^frm_[A-Za-z0-9]+$/, "Use the form's id from Ember, like frm_a1B2c3.").optional()
204
+ }),
205
+ upcomingEvents: z.object({
206
+ eyebrow: z.string().optional(),
207
+ heading: z.string().optional(),
208
+ intro: z.string().optional(),
209
+ limit: z.number().int().min(1).max(12).default(3),
210
+ /** Only events in this event collection (e.g. "Talks"); omit for every event. */
211
+ collectionId: z.string().uuid().optional(),
212
+ /** Only events in this category (e.g. "Featured"). */
213
+ categoryId: z.string().uuid().optional()
214
+ }),
215
+ eventSpotlight: z.object({
216
+ /** Event slug; omit to show the next upcoming event. */
217
+ eventSlug: z.string().optional(),
218
+ /** Without an event chosen: the next upcoming event in this category (e.g. "Featured"). */
219
+ categoryId: z.string().uuid().optional(),
220
+ heading: z.string().optional()
221
+ }),
222
+ /** Entries of a page collection (a blog, case studies…), newest first unless the collection says otherwise. */
223
+ collectionList: z.object({
224
+ eyebrow: z.string().optional(),
225
+ heading: z.string().optional(),
226
+ intro: z.string().optional(),
227
+ collectionId: z.string().uuid("Choose a collection"),
228
+ limit: z.number().int().min(1).max(24).default(6),
229
+ layout: z.enum(["cards", "list"]).default("cards"),
230
+ /** Only entries with this tag. */
231
+ tag: z.string().trim().max(60).optional(),
232
+ /** Only entries in this category (e.g. "Featured"). */
233
+ categoryId: z.string().uuid().optional()
234
+ }),
235
+ sharedBlock: z.object({
236
+ sharedBlockId: z.string().uuid("Choose a shared block")
237
+ }),
238
+ /** One fundraiser with its progress (giving feature). The API adds `fundraiser`. */
239
+ fundraiserSpotlight: z.object({
240
+ /** Fundraiser slug; omit to show the first active one (in the category, if set). */
241
+ fundraiserSlug: z.string().optional(),
242
+ categoryId: z.string().uuid().optional(),
243
+ heading: z.string().optional()
244
+ }),
245
+ /** Fundraisers as cards with progress (giving feature). The API adds `fundraisers`. */
246
+ fundraiserGrid: z.object({
247
+ eyebrow: z.string().optional(),
248
+ heading: z.string().optional(),
249
+ intro: z.string().optional(),
250
+ limit: z.number().int().min(1).max(24).default(6),
251
+ status: z.enum(["active", "completed", "all"]).default("active"),
252
+ categoryId: z.string().uuid().optional()
253
+ }),
254
+ /**
255
+ * A donation form (giving feature). The frontend posts it to its own server, which starts checkout through the
256
+ * API. The API adds `presetsCents`, `minCents`, `maxCents` and the `fundraiser`, if one is chosen.
257
+ */
258
+ donate: z.object({
259
+ heading: z.string().optional(),
260
+ intro: z.string().optional(),
261
+ /** Donations go to this fundraiser; omit for general donations. */
262
+ fundraiserSlug: z.string().optional(),
263
+ submitLabel: z.string().min(1).default("Donate")
264
+ })
265
+ };
266
+ var blockTypes = Object.keys(blockDataSchemas);
267
+ var blockFeature = {
268
+ upcomingEvents: "events",
269
+ eventSpotlight: "events",
270
+ fundraiserSpotlight: "giving",
271
+ fundraiserGrid: "giving",
272
+ donate: "giving"
273
+ };
274
+ var blockVariants = blockTypes.map(
275
+ (type) => z.object({
276
+ id: z.string().min(1),
277
+ type: z.literal(type),
278
+ data: blockDataSchemas[type]
279
+ })
280
+ );
281
+ var blockSchema = z.discriminatedUnion(
282
+ "type",
283
+ blockVariants
284
+ );
285
+ var pageContentSchema = z.object({
286
+ title: z.string().trim().min(1, "Give the page a title."),
287
+ seo: z.object({
288
+ title: z.string().trim().max(70, "Keep it under 70 characters.").optional(),
289
+ description: z.string().trim().max(200, "Keep it under 200 characters.").optional(),
290
+ image: image.optional(),
291
+ /** Keep this page out of search engines (and the sitemap). */
292
+ noIndex: z.boolean().optional(),
293
+ /** Point search engines at another address for this content (a path or full URL). */
294
+ canonical: z.string().trim().max(500).optional()
295
+ }).default({}),
296
+ blocks: z.array(blockSchema, "Some blocks are invalid."),
297
+ /** Ids of the site's categories this page is in (see category groups in the admin). */
298
+ categories: z.array(z.string().uuid()).max(50).optional(),
299
+ /** Listing details for a page that's an entry in a collection (shown by collectionList blocks). */
300
+ entry: z.object({
301
+ /** The entry's date (YYYY-MM-DD), e.g. a post's publish date. Lists sort by it. */
302
+ date: z.iso.date().optional(),
303
+ summary: z.string().trim().max(300, "Keep it under 300 characters.").optional(),
304
+ image: image.optional(),
305
+ tags: z.array(z.string().trim().min(1).max(60)).max(20).default([])
306
+ }).optional()
307
+ });
308
+ function videoEmbedUrl(url) {
309
+ let u;
310
+ try {
311
+ u = new URL(url);
312
+ } catch {
313
+ return null;
314
+ }
315
+ const host = u.hostname.replace(/^www\.|^m\./, "");
316
+ let id = null;
317
+ if (host === "youtu.be") id = u.pathname.slice(1).split("/")[0];
318
+ else if (host === "youtube.com" || host === "youtube-nocookie.com") {
319
+ id = u.searchParams.get("v") ?? u.pathname.match(/^\/(?:embed|shorts|live)\/([^/?]+)/)?.[1] ?? null;
320
+ }
321
+ if (id && /^[\w-]{6,20}$/.test(id)) return `https://www.youtube-nocookie.com/embed/${id}`;
322
+ if (host === "vimeo.com" || host === "player.vimeo.com") {
323
+ const vimeoId = u.pathname.match(/(\d{6,12})/)?.[1];
324
+ if (vimeoId) return `https://player.vimeo.com/video/${vimeoId}?dnt=1`;
325
+ }
326
+ return null;
327
+ }
328
+ function parseBlocks(input) {
329
+ if (!Array.isArray(input)) return [];
330
+ const blocks = [];
331
+ for (const raw of input) {
332
+ const result = blockSchema.safeParse(raw);
333
+ if (result.success) {
334
+ blocks.push(result.data);
335
+ } else {
336
+ console.warn("[blocks] skipping invalid block", z.prettifyError(result.error));
337
+ }
338
+ }
339
+ return blocks;
340
+ }
341
+ function parsePageContent(input) {
342
+ const raw = input && typeof input === "object" ? input : {};
343
+ const seo = pageContentSchema.shape.seo.safeParse(raw.seo);
344
+ const entry = raw.entry === void 0 ? null : pageContentSchema.shape.entry.safeParse(raw.entry);
345
+ const uuid = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
346
+ const categories = Array.isArray(raw.categories) ? raw.categories.filter((c) => typeof c === "string" && uuid.test(c)) : [];
347
+ return {
348
+ title: typeof raw.title === "string" ? raw.title : "",
349
+ seo: seo.success ? seo.data : {},
350
+ blocks: parseBlocks(raw.blocks),
351
+ ...entry?.success && entry.data ? { entry: entry.data } : {},
352
+ ...categories.length ? { categories } : {}
353
+ };
354
+ }
355
+ var formDefinitionSchema = z.object({
356
+ key: z.string().trim().max(60).regex(/^[a-z0-9]+(-[a-z0-9]+)*$/, "Use lowercase letters, numbers and dashes."),
357
+ name: z.string().trim().min(1, "Name the form.").max(120),
358
+ fields: z.array(formFieldSchema).min(1, "Add at least one field.").max(30, "Up to 30 fields."),
359
+ submitLabel: z.string().trim().min(1).max(40).default("Send"),
360
+ successMessage: z.string().trim().min(1).max(500).default("Thanks! We'll be in touch soon."),
361
+ /** Email a confirmation to the address in the form's email field. */
362
+ sendConfirmation: z.boolean().default(false),
363
+ /** This form's own confirmation message, replacing the default. May use {{firstName}}, {{form}}, {{organization}}. */
364
+ confirmationMessage: z.string().trim().max(2e3).optional()
365
+ }).superRefine((form, ctx) => {
366
+ const seen = /* @__PURE__ */ new Set();
367
+ form.fields.forEach((f, i) => {
368
+ if (seen.has(f.name)) ctx.addIssue({ code: "custom", path: ["fields", i, "name"], message: `Two fields use the key \u201C${f.name}\u201D.` });
369
+ seen.add(f.name);
370
+ if (f.type === "select" && !f.options?.length) ctx.addIssue({ code: "custom", path: ["fields", i, "options"], message: "Add the dropdown's choices." });
371
+ });
372
+ if (form.sendConfirmation && !form.fields.some((f) => f.type === "email"))
373
+ ctx.addIssue({ code: "custom", path: ["sendConfirmation"], message: "Add an Email field to send confirmations." });
374
+ });
375
+
376
+ // src/site-settings.ts
377
+ import { z as z2 } from "zod";
378
+ var link2 = z2.object({ label: z2.string().trim().min(1, "Add link text."), href: z2.string().trim().min(1, "Add where it goes.") });
379
+ var ORGANIZATION_TYPES = ["Organization", "LocalBusiness", "NGO", "Corporation", "EducationalOrganization", "GovernmentOrganization", "MedicalOrganization", "SportsOrganization"];
380
+ var SOCIAL_PLATFORMS = ["facebook", "instagram", "linkedin", "x", "youtube", "tiktok", "other"];
381
+ var siteSettingsSchema = z2.object({
382
+ navigation: z2.array(link2).default([]),
383
+ footerLinks: z2.array(link2).default([]),
384
+ contact: z2.object({
385
+ email: z2.string().trim().optional(),
386
+ phone: z2.string().trim().optional(),
387
+ address: z2.string().trim().optional()
388
+ }).default({}),
389
+ /** A short line under the site name, e.g. "Serving Dover since 1985". */
390
+ tagline: z2.string().trim().max(160).optional(),
391
+ social: z2.array(
392
+ z2.object({
393
+ platform: z2.enum(SOCIAL_PLATFORMS),
394
+ url: z2.url("Enter a full link starting with https://"),
395
+ /** Optional name, to tell apart several profiles on one platform (e.g. "Local 1312"). */
396
+ label: z2.string().trim().max(40).optional()
397
+ })
398
+ ).default([]),
399
+ /** Optional site-wide banner, e.g. "Closed Monday for the holiday". */
400
+ announcement: z2.string().trim().max(300).optional(),
401
+ /** How the site shows events (sites with the Events feature). */
402
+ events: z2.object({
403
+ /** On upcoming events with no registration link, show a note such as "Registration coming soon". */
404
+ registrationComingSoon: z2.boolean().default(false),
405
+ /** The note's wording; defaults to "Registration coming soon". */
406
+ comingSoonText: z2.string().trim().max(80).optional()
407
+ }).default({ registrationComingSoon: false }),
408
+ /** How emails to the site's donors and registrants look and who they come from (sites with Giving or Tickets). */
409
+ email: z2.object({
410
+ /** Sender name, e.g. "Dover Firefighters". Defaults to the site name. */
411
+ fromName: z2.string().trim().max(80).optional(),
412
+ /**
413
+ * Send from this address (e.g. giving@example.org). Its domain must be verified for The Smithy in Bellow;
414
+ * otherwise emails go out from Hearth's address with this site's name.
415
+ */
416
+ fromAddress: z2.union([z2.literal(""), z2.email("Enter a valid email address.")]).optional(),
417
+ /** Where replies go, e.g. the organization's inbox. */
418
+ replyTo: z2.union([z2.literal(""), z2.email("Enter a valid email address.")]).optional(),
419
+ /** Button and accent color. */
420
+ accentColor: z2.string().regex(/^#[0-9a-fA-F]{6}$/, "Use a hex color like #B3261E.").optional(),
421
+ /** Small print under every email, e.g. the mailing address. */
422
+ footer: z2.string().trim().max(400).optional()
423
+ }).default({}),
424
+ /** Donations (sites with the Giving feature). */
425
+ giving: z2.object({
426
+ /** The organization's legal name, for receipts. Defaults to the site name. */
427
+ legalName: z2.string().trim().max(160).optional(),
428
+ /** Tax ID (EIN) shown on receipts. */
429
+ ein: z2.string().trim().max(20).optional(),
430
+ /** Tax wording on receipts, e.g. "No goods or services were provided in exchange for this gift." */
431
+ taxStatement: z2.string().trim().max(600).optional(),
432
+ /** Suggested amounts on donation forms, in cents. */
433
+ presetsCents: z2.array(z2.number().int().min(100).max(1e7)).max(8).default([2500, 5e3, 1e4, 25e3]),
434
+ minCents: z2.number().int().min(100).max(1e7).default(500),
435
+ maxCents: z2.number().int().min(100).max(1e8).default(25e5)
436
+ }).refine((g) => g.minCents <= g.maxCents, { message: "The smallest donation can't be more than the largest.", path: ["minCents"] }).default({ presetsCents: [2500, 5e3, 1e4, 25e3], minCents: 500, maxCents: 25e5 }),
437
+ seo: z2.object({
438
+ /** Page title pattern; %s is the page title. Defaults to "%s | <site name>". */
439
+ titleTemplate: z2.string().trim().max(80).optional(),
440
+ /** Used when a page has no description of its own. */
441
+ description: z2.string().trim().max(200).optional(),
442
+ /** Share image used when a page has none (otherwise one is generated). */
443
+ image: z2.object({ src: z2.string().min(1), alt: z2.string().default("") }).optional(),
444
+ /** What kind of organization this is, for search engines' structured data. */
445
+ organizationType: z2.enum(ORGANIZATION_TYPES).default("Organization"),
446
+ logo: z2.object({ src: z2.string().min(1), alt: z2.string().default("") }).optional(),
447
+ /** X (Twitter) handle, e.g. @acme. */
448
+ twitterHandle: z2.string().trim().max(30).optional(),
449
+ /** Colors for generated share images. */
450
+ ogBackground: z2.string().regex(/^#[0-9a-fA-F]{6}$/, "Use a hex color like #1A1A14.").optional(),
451
+ ogText: z2.string().regex(/^#[0-9a-fA-F]{6}$/, "Use a hex color like #FFFFFF.").optional(),
452
+ ogAccent: z2.string().regex(/^#[0-9a-fA-F]{6}$/, "Use a hex color like #E8993F.").optional()
453
+ }).default({ organizationType: "Organization" })
454
+ });
455
+ function parseSiteSettings(input) {
456
+ const parsed = siteSettingsSchema.safeParse(input ?? {});
457
+ return parsed.success ? parsed.data : siteSettingsSchema.parse({});
458
+ }
459
+
460
+ // src/tickets.ts
461
+ import { z as z3 } from "zod";
462
+ var ticketTypeSchema = z3.object({
463
+ id: z3.string().min(1).max(40),
464
+ name: z3.string().trim().min(1, "Name this ticket, e.g. Foursome.").max(80),
465
+ description: z3.string().trim().max(300).optional(),
466
+ /** 0 is free (an RSVP). */
467
+ priceCents: z3.number().int().min(0).max(25e5),
468
+ /** How many attendee names to collect: 4 for a foursome, 0 for a sponsorship. */
469
+ attendeesPerRegistration: z3.number().int().min(0).max(12).default(1),
470
+ /** What to call each attendee on the form, e.g. "Golfer". */
471
+ attendeeLabel: z3.string().trim().max(40).optional(),
472
+ /** Total available; empty means unlimited. */
473
+ capacity: z3.number().int().min(1).max(1e4).optional(),
474
+ active: z3.boolean().default(true)
475
+ });
476
+ var ticketTypesSchema = z3.array(ticketTypeSchema).max(12, "Use up to 12 ticket types.");
477
+ function parseTicketTypes(input) {
478
+ const parsed = ticketTypesSchema.safeParse(input);
479
+ return parsed.success ? parsed.data : [];
480
+ }
481
+ export {
482
+ BLOCK_SCHEMA_VERSION,
483
+ ORGANIZATION_TYPES,
484
+ SOCIAL_PLATFORMS,
485
+ blockDataSchemas,
486
+ blockFeature,
487
+ blockSchema,
488
+ blockTypes,
489
+ formDefinitionSchema,
490
+ formFieldSchema,
491
+ pageContentSchema,
492
+ parseBlocks,
493
+ parsePageContent,
494
+ parseSiteSettings,
495
+ parseTicketTypes,
496
+ siteSettingsSchema,
497
+ ticketTypeSchema,
498
+ ticketTypesSchema,
499
+ videoEmbedUrl
500
+ };
package/package.json CHANGED
@@ -1,6 +1,33 @@
1
1
  {
2
2
  "name": "@the-smithy/hearth-schema",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.12.0",
4
+ "description": "Content schemas and API types shared by Hearth and its SDK.",
5
+ "type": "module",
6
+ "license": "SEE LICENSE IN LICENSE",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/The-Smithy/hearth.git",
10
+ "directory": "packages/schema"
11
+ },
12
+ "exports": {
13
+ ".": {
14
+ "types": "./dist/index.d.ts",
15
+ "import": "./dist/index.js"
16
+ }
17
+ },
18
+ "files": [
19
+ "dist"
20
+ ],
21
+ "sideEffects": false,
22
+ "dependencies": {
23
+ "zod": "^4.6.5"
24
+ },
25
+ "devDependencies": {
26
+ "tsup": "^8.5.1",
27
+ "typescript": "^5.9.3"
28
+ },
29
+ "scripts": {
30
+ "build": "tsup",
31
+ "typecheck": "tsc --noEmit"
32
+ }
6
33
  }