@the-smithy/hearth-schema 0.34.0 → 0.35.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.d.ts CHANGED
@@ -792,6 +792,44 @@ declare const blockDataSchemas: {
792
792
  fundraiserSlug: z.ZodOptional<z.ZodString>;
793
793
  submitLabel: z.ZodDefault<z.ZodString>;
794
794
  }, z.core.$strip>;
795
+ /**
796
+ * The site's menus (the menus feature: Menus in the admin), in one of three styles. The API adds `menus`, the chosen
797
+ * live menus in this order, and leaves the block out when there are none. Locations, dietary filters and the share
798
+ * link are drawn from them; see `HearthMenu`.
799
+ */
800
+ readonly menu: z.ZodObject<{
801
+ eyebrow: z.ZodOptional<z.ZodString>;
802
+ heading: z.ZodOptional<z.ZodString>;
803
+ intro: z.ZodOptional<z.ZodString>;
804
+ menuIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
805
+ style: z.ZodDefault<z.ZodEnum<{
806
+ grid: "grid";
807
+ carte: "carte";
808
+ tabbed: "tabbed";
809
+ }>>;
810
+ display: z.ZodOptional<z.ZodEnum<{
811
+ accordion: "accordion";
812
+ tabs: "tabs";
813
+ }>>;
814
+ filters: z.ZodDefault<z.ZodBoolean>;
815
+ share: z.ZodDefault<z.ZodBoolean>;
816
+ image: z.ZodOptional<z.ZodObject<{
817
+ src: z.ZodString;
818
+ alt: z.ZodDefault<z.ZodString>;
819
+ width: z.ZodOptional<z.ZodNumber>;
820
+ height: z.ZodOptional<z.ZodNumber>;
821
+ focal: z.ZodOptional<z.ZodObject<{
822
+ x: z.ZodNumber;
823
+ y: z.ZodNumber;
824
+ }, z.core.$strip>>;
825
+ }, z.core.$strip>>;
826
+ tone: z.ZodDefault<z.ZodEnum<{
827
+ default: "default";
828
+ muted: "muted";
829
+ inverse: "inverse";
830
+ accent: "accent";
831
+ }>>;
832
+ }, z.core.$strip>;
795
833
  /**
796
834
  * One of the site's own block types (Custom blocks in the admin): `block` is its key, `values` its fields' values,
797
835
  * as described by the site's custom block definitions (GET /custom-blocks). The site's frontend renders it.
@@ -805,10 +843,10 @@ type BlockType = keyof typeof blockDataSchemas;
805
843
  type BlockData<T extends BlockType> = z.infer<(typeof blockDataSchemas)[T]>;
806
844
  declare const blockTypes: BlockType[];
807
845
  /** Block types that only make sense when a site has the matching feature switched on. (Every site has forms.) */
808
- declare const blockFeature: Partial<Record<BlockType, "events" | "giving">>;
846
+ declare const blockFeature: Partial<Record<BlockType, "events" | "giving" | "menus">>;
809
847
  declare const blockSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
810
848
  id: z.ZodString;
811
- type: z.ZodLiteral<"custom" | "cta" | "quote" | "people" | "logos" | "hero" | "richText" | "mediaText" | "stats" | "cardGrid" | "faq" | "pricing" | "projects" | "location" | "locations" | "schedule" | "gallery" | "video" | "embed" | "form" | "upcomingEvents" | "pastEvents" | "eventSpotlight" | "volunteerSignup" | "collectionList" | "sharedBlock" | "fundraiserSpotlight" | "fundraiserGrid" | "donate">;
849
+ type: z.ZodLiteral<"custom" | "cta" | "quote" | "people" | "logos" | "hero" | "richText" | "mediaText" | "stats" | "cardGrid" | "faq" | "pricing" | "projects" | "location" | "locations" | "schedule" | "gallery" | "video" | "embed" | "form" | "upcomingEvents" | "pastEvents" | "eventSpotlight" | "volunteerSignup" | "collectionList" | "sharedBlock" | "fundraiserSpotlight" | "fundraiserGrid" | "donate" | "menu">;
812
850
  anchor: z.ZodOptional<z.ZodString>;
813
851
  data: z.ZodObject<{
814
852
  eyebrow: z.ZodOptional<z.ZodString>;
@@ -1217,13 +1255,45 @@ declare const blockSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1217
1255
  intro: z.ZodOptional<z.ZodString>;
1218
1256
  fundraiserSlug: z.ZodOptional<z.ZodString>;
1219
1257
  submitLabel: z.ZodDefault<z.ZodString>;
1258
+ }, z.core.$strip> | z.ZodObject<{
1259
+ eyebrow: z.ZodOptional<z.ZodString>;
1260
+ heading: z.ZodOptional<z.ZodString>;
1261
+ intro: z.ZodOptional<z.ZodString>;
1262
+ menuIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
1263
+ style: z.ZodDefault<z.ZodEnum<{
1264
+ grid: "grid";
1265
+ carte: "carte";
1266
+ tabbed: "tabbed";
1267
+ }>>;
1268
+ display: z.ZodOptional<z.ZodEnum<{
1269
+ accordion: "accordion";
1270
+ tabs: "tabs";
1271
+ }>>;
1272
+ filters: z.ZodDefault<z.ZodBoolean>;
1273
+ share: z.ZodDefault<z.ZodBoolean>;
1274
+ image: z.ZodOptional<z.ZodObject<{
1275
+ src: z.ZodString;
1276
+ alt: z.ZodDefault<z.ZodString>;
1277
+ width: z.ZodOptional<z.ZodNumber>;
1278
+ height: z.ZodOptional<z.ZodNumber>;
1279
+ focal: z.ZodOptional<z.ZodObject<{
1280
+ x: z.ZodNumber;
1281
+ y: z.ZodNumber;
1282
+ }, z.core.$strip>>;
1283
+ }, z.core.$strip>>;
1284
+ tone: z.ZodDefault<z.ZodEnum<{
1285
+ default: "default";
1286
+ muted: "muted";
1287
+ inverse: "inverse";
1288
+ accent: "accent";
1289
+ }>>;
1220
1290
  }, z.core.$strip> | z.ZodObject<{
1221
1291
  block: z.ZodString;
1222
1292
  values: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1223
1293
  }, z.core.$strip>;
1224
1294
  }, z.core.$strip>, ...z.ZodObject<{
1225
1295
  id: z.ZodString;
1226
- type: z.ZodLiteral<"custom" | "cta" | "quote" | "people" | "logos" | "hero" | "richText" | "mediaText" | "stats" | "cardGrid" | "faq" | "pricing" | "projects" | "location" | "locations" | "schedule" | "gallery" | "video" | "embed" | "form" | "upcomingEvents" | "pastEvents" | "eventSpotlight" | "volunteerSignup" | "collectionList" | "sharedBlock" | "fundraiserSpotlight" | "fundraiserGrid" | "donate">;
1296
+ type: z.ZodLiteral<"custom" | "cta" | "quote" | "people" | "logos" | "hero" | "richText" | "mediaText" | "stats" | "cardGrid" | "faq" | "pricing" | "projects" | "location" | "locations" | "schedule" | "gallery" | "video" | "embed" | "form" | "upcomingEvents" | "pastEvents" | "eventSpotlight" | "volunteerSignup" | "collectionList" | "sharedBlock" | "fundraiserSpotlight" | "fundraiserGrid" | "donate" | "menu">;
1227
1297
  anchor: z.ZodOptional<z.ZodString>;
1228
1298
  data: z.ZodObject<{
1229
1299
  eyebrow: z.ZodOptional<z.ZodString>;
@@ -1632,6 +1702,38 @@ declare const blockSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1632
1702
  intro: z.ZodOptional<z.ZodString>;
1633
1703
  fundraiserSlug: z.ZodOptional<z.ZodString>;
1634
1704
  submitLabel: z.ZodDefault<z.ZodString>;
1705
+ }, z.core.$strip> | z.ZodObject<{
1706
+ eyebrow: z.ZodOptional<z.ZodString>;
1707
+ heading: z.ZodOptional<z.ZodString>;
1708
+ intro: z.ZodOptional<z.ZodString>;
1709
+ menuIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
1710
+ style: z.ZodDefault<z.ZodEnum<{
1711
+ grid: "grid";
1712
+ carte: "carte";
1713
+ tabbed: "tabbed";
1714
+ }>>;
1715
+ display: z.ZodOptional<z.ZodEnum<{
1716
+ accordion: "accordion";
1717
+ tabs: "tabs";
1718
+ }>>;
1719
+ filters: z.ZodDefault<z.ZodBoolean>;
1720
+ share: z.ZodDefault<z.ZodBoolean>;
1721
+ image: z.ZodOptional<z.ZodObject<{
1722
+ src: z.ZodString;
1723
+ alt: z.ZodDefault<z.ZodString>;
1724
+ width: z.ZodOptional<z.ZodNumber>;
1725
+ height: z.ZodOptional<z.ZodNumber>;
1726
+ focal: z.ZodOptional<z.ZodObject<{
1727
+ x: z.ZodNumber;
1728
+ y: z.ZodNumber;
1729
+ }, z.core.$strip>>;
1730
+ }, z.core.$strip>>;
1731
+ tone: z.ZodDefault<z.ZodEnum<{
1732
+ default: "default";
1733
+ muted: "muted";
1734
+ inverse: "inverse";
1735
+ accent: "accent";
1736
+ }>>;
1635
1737
  }, z.core.$strip> | z.ZodObject<{
1636
1738
  block: z.ZodString;
1637
1739
  values: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -1697,7 +1799,7 @@ declare const pageContentSchema: z.ZodObject<{
1697
1799
  }, z.core.$strip>>;
1698
1800
  blocks: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
1699
1801
  id: z.ZodString;
1700
- type: z.ZodLiteral<"custom" | "cta" | "quote" | "people" | "logos" | "hero" | "richText" | "mediaText" | "stats" | "cardGrid" | "faq" | "pricing" | "projects" | "location" | "locations" | "schedule" | "gallery" | "video" | "embed" | "form" | "upcomingEvents" | "pastEvents" | "eventSpotlight" | "volunteerSignup" | "collectionList" | "sharedBlock" | "fundraiserSpotlight" | "fundraiserGrid" | "donate">;
1802
+ type: z.ZodLiteral<"custom" | "cta" | "quote" | "people" | "logos" | "hero" | "richText" | "mediaText" | "stats" | "cardGrid" | "faq" | "pricing" | "projects" | "location" | "locations" | "schedule" | "gallery" | "video" | "embed" | "form" | "upcomingEvents" | "pastEvents" | "eventSpotlight" | "volunteerSignup" | "collectionList" | "sharedBlock" | "fundraiserSpotlight" | "fundraiserGrid" | "donate" | "menu">;
1701
1803
  anchor: z.ZodOptional<z.ZodString>;
1702
1804
  data: z.ZodObject<{
1703
1805
  eyebrow: z.ZodOptional<z.ZodString>;
@@ -2106,13 +2208,45 @@ declare const pageContentSchema: z.ZodObject<{
2106
2208
  intro: z.ZodOptional<z.ZodString>;
2107
2209
  fundraiserSlug: z.ZodOptional<z.ZodString>;
2108
2210
  submitLabel: z.ZodDefault<z.ZodString>;
2211
+ }, z.core.$strip> | z.ZodObject<{
2212
+ eyebrow: z.ZodOptional<z.ZodString>;
2213
+ heading: z.ZodOptional<z.ZodString>;
2214
+ intro: z.ZodOptional<z.ZodString>;
2215
+ menuIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
2216
+ style: z.ZodDefault<z.ZodEnum<{
2217
+ grid: "grid";
2218
+ carte: "carte";
2219
+ tabbed: "tabbed";
2220
+ }>>;
2221
+ display: z.ZodOptional<z.ZodEnum<{
2222
+ accordion: "accordion";
2223
+ tabs: "tabs";
2224
+ }>>;
2225
+ filters: z.ZodDefault<z.ZodBoolean>;
2226
+ share: z.ZodDefault<z.ZodBoolean>;
2227
+ image: z.ZodOptional<z.ZodObject<{
2228
+ src: z.ZodString;
2229
+ alt: z.ZodDefault<z.ZodString>;
2230
+ width: z.ZodOptional<z.ZodNumber>;
2231
+ height: z.ZodOptional<z.ZodNumber>;
2232
+ focal: z.ZodOptional<z.ZodObject<{
2233
+ x: z.ZodNumber;
2234
+ y: z.ZodNumber;
2235
+ }, z.core.$strip>>;
2236
+ }, z.core.$strip>>;
2237
+ tone: z.ZodDefault<z.ZodEnum<{
2238
+ default: "default";
2239
+ muted: "muted";
2240
+ inverse: "inverse";
2241
+ accent: "accent";
2242
+ }>>;
2109
2243
  }, z.core.$strip> | z.ZodObject<{
2110
2244
  block: z.ZodString;
2111
2245
  values: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2112
2246
  }, z.core.$strip>;
2113
2247
  }, z.core.$strip>, ...z.ZodObject<{
2114
2248
  id: z.ZodString;
2115
- type: z.ZodLiteral<"custom" | "cta" | "quote" | "people" | "logos" | "hero" | "richText" | "mediaText" | "stats" | "cardGrid" | "faq" | "pricing" | "projects" | "location" | "locations" | "schedule" | "gallery" | "video" | "embed" | "form" | "upcomingEvents" | "pastEvents" | "eventSpotlight" | "volunteerSignup" | "collectionList" | "sharedBlock" | "fundraiserSpotlight" | "fundraiserGrid" | "donate">;
2249
+ type: z.ZodLiteral<"custom" | "cta" | "quote" | "people" | "logos" | "hero" | "richText" | "mediaText" | "stats" | "cardGrid" | "faq" | "pricing" | "projects" | "location" | "locations" | "schedule" | "gallery" | "video" | "embed" | "form" | "upcomingEvents" | "pastEvents" | "eventSpotlight" | "volunteerSignup" | "collectionList" | "sharedBlock" | "fundraiserSpotlight" | "fundraiserGrid" | "donate" | "menu">;
2116
2250
  anchor: z.ZodOptional<z.ZodString>;
2117
2251
  data: z.ZodObject<{
2118
2252
  eyebrow: z.ZodOptional<z.ZodString>;
@@ -2521,6 +2655,38 @@ declare const pageContentSchema: z.ZodObject<{
2521
2655
  intro: z.ZodOptional<z.ZodString>;
2522
2656
  fundraiserSlug: z.ZodOptional<z.ZodString>;
2523
2657
  submitLabel: z.ZodDefault<z.ZodString>;
2658
+ }, z.core.$strip> | z.ZodObject<{
2659
+ eyebrow: z.ZodOptional<z.ZodString>;
2660
+ heading: z.ZodOptional<z.ZodString>;
2661
+ intro: z.ZodOptional<z.ZodString>;
2662
+ menuIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
2663
+ style: z.ZodDefault<z.ZodEnum<{
2664
+ grid: "grid";
2665
+ carte: "carte";
2666
+ tabbed: "tabbed";
2667
+ }>>;
2668
+ display: z.ZodOptional<z.ZodEnum<{
2669
+ accordion: "accordion";
2670
+ tabs: "tabs";
2671
+ }>>;
2672
+ filters: z.ZodDefault<z.ZodBoolean>;
2673
+ share: z.ZodDefault<z.ZodBoolean>;
2674
+ image: z.ZodOptional<z.ZodObject<{
2675
+ src: z.ZodString;
2676
+ alt: z.ZodDefault<z.ZodString>;
2677
+ width: z.ZodOptional<z.ZodNumber>;
2678
+ height: z.ZodOptional<z.ZodNumber>;
2679
+ focal: z.ZodOptional<z.ZodObject<{
2680
+ x: z.ZodNumber;
2681
+ y: z.ZodNumber;
2682
+ }, z.core.$strip>>;
2683
+ }, z.core.$strip>>;
2684
+ tone: z.ZodDefault<z.ZodEnum<{
2685
+ default: "default";
2686
+ muted: "muted";
2687
+ inverse: "inverse";
2688
+ accent: "accent";
2689
+ }>>;
2524
2690
  }, z.core.$strip> | z.ZodObject<{
2525
2691
  block: z.ZodString;
2526
2692
  values: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -2584,6 +2750,130 @@ declare const formDefinitionSchema: z.ZodObject<{
2584
2750
  confirmationMessage: z.ZodOptional<z.ZodString>;
2585
2751
  }, z.core.$strip>;
2586
2752
  type FormDefinition = z.infer<typeof formDefinitionSchema>;
2753
+ /**
2754
+ * Diets a dish can suit, a fixed list so visitors can filter by them and search engines can read them. Additive
2755
+ * changes only: dishes store these keys.
2756
+ */
2757
+ declare const DIETARY_TAGS: readonly ["vegan", "vegetarian", "gluten-free", "dairy-free", "nut-free", "halal", "kosher", "spicy"];
2758
+ type DietaryTag = (typeof DIETARY_TAGS)[number];
2759
+ /** How each diet is named to visitors, and the short mark printed beside a dish. */
2760
+ declare const DIETARY_LABELS: Record<DietaryTag, {
2761
+ label: string;
2762
+ short: string;
2763
+ }>;
2764
+ /** One dish or drink on a menu. Prices are text, so any currency, "MP" (market price) or "3 for 13" works. */
2765
+ declare const menuItemSchema: z.ZodObject<{
2766
+ name: z.ZodString;
2767
+ description: z.ZodOptional<z.ZodString>;
2768
+ prices: z.ZodDefault<z.ZodArray<z.ZodObject<{
2769
+ label: z.ZodOptional<z.ZodString>;
2770
+ amount: z.ZodString;
2771
+ }, z.core.$strip>>>;
2772
+ dietary: z.ZodDefault<z.ZodArray<z.ZodEnum<{
2773
+ vegan: "vegan";
2774
+ vegetarian: "vegetarian";
2775
+ "gluten-free": "gluten-free";
2776
+ "dairy-free": "dairy-free";
2777
+ "nut-free": "nut-free";
2778
+ halal: "halal";
2779
+ kosher: "kosher";
2780
+ spicy: "spicy";
2781
+ }>>>;
2782
+ calories: z.ZodOptional<z.ZodNumber>;
2783
+ badges: z.ZodDefault<z.ZodArray<z.ZodString>>;
2784
+ image: z.ZodOptional<z.ZodObject<{
2785
+ src: z.ZodString;
2786
+ alt: z.ZodDefault<z.ZodString>;
2787
+ width: z.ZodOptional<z.ZodNumber>;
2788
+ height: z.ZodOptional<z.ZodNumber>;
2789
+ focal: z.ZodOptional<z.ZodObject<{
2790
+ x: z.ZodNumber;
2791
+ y: z.ZodNumber;
2792
+ }, z.core.$strip>>;
2793
+ }, z.core.$strip>>;
2794
+ featured: z.ZodOptional<z.ZodBoolean>;
2795
+ }, z.core.$strip>;
2796
+ type MenuItem = z.infer<typeof menuItemSchema>;
2797
+ declare const menuSectionSchema: z.ZodObject<{
2798
+ name: z.ZodString;
2799
+ subtitle: z.ZodOptional<z.ZodString>;
2800
+ intro: z.ZodOptional<z.ZodString>;
2801
+ items: z.ZodDefault<z.ZodArray<z.ZodObject<{
2802
+ name: z.ZodString;
2803
+ description: z.ZodOptional<z.ZodString>;
2804
+ prices: z.ZodDefault<z.ZodArray<z.ZodObject<{
2805
+ label: z.ZodOptional<z.ZodString>;
2806
+ amount: z.ZodString;
2807
+ }, z.core.$strip>>>;
2808
+ dietary: z.ZodDefault<z.ZodArray<z.ZodEnum<{
2809
+ vegan: "vegan";
2810
+ vegetarian: "vegetarian";
2811
+ "gluten-free": "gluten-free";
2812
+ "dairy-free": "dairy-free";
2813
+ "nut-free": "nut-free";
2814
+ halal: "halal";
2815
+ kosher: "kosher";
2816
+ spicy: "spicy";
2817
+ }>>>;
2818
+ calories: z.ZodOptional<z.ZodNumber>;
2819
+ badges: z.ZodDefault<z.ZodArray<z.ZodString>>;
2820
+ image: z.ZodOptional<z.ZodObject<{
2821
+ src: z.ZodString;
2822
+ alt: z.ZodDefault<z.ZodString>;
2823
+ width: z.ZodOptional<z.ZodNumber>;
2824
+ height: z.ZodOptional<z.ZodNumber>;
2825
+ focal: z.ZodOptional<z.ZodObject<{
2826
+ x: z.ZodNumber;
2827
+ y: z.ZodNumber;
2828
+ }, z.core.$strip>>;
2829
+ }, z.core.$strip>>;
2830
+ featured: z.ZodOptional<z.ZodBoolean>;
2831
+ }, z.core.$strip>>>;
2832
+ }, z.core.$strip>;
2833
+ type MenuSection = z.infer<typeof menuSectionSchema>;
2834
+ /** What a menu holds, as stored in `menus.content` and edited on the Menus page. */
2835
+ declare const menuContentSchema: z.ZodObject<{
2836
+ sections: z.ZodDefault<z.ZodArray<z.ZodObject<{
2837
+ name: z.ZodString;
2838
+ subtitle: z.ZodOptional<z.ZodString>;
2839
+ intro: z.ZodOptional<z.ZodString>;
2840
+ items: z.ZodDefault<z.ZodArray<z.ZodObject<{
2841
+ name: z.ZodString;
2842
+ description: z.ZodOptional<z.ZodString>;
2843
+ prices: z.ZodDefault<z.ZodArray<z.ZodObject<{
2844
+ label: z.ZodOptional<z.ZodString>;
2845
+ amount: z.ZodString;
2846
+ }, z.core.$strip>>>;
2847
+ dietary: z.ZodDefault<z.ZodArray<z.ZodEnum<{
2848
+ vegan: "vegan";
2849
+ vegetarian: "vegetarian";
2850
+ "gluten-free": "gluten-free";
2851
+ "dairy-free": "dairy-free";
2852
+ "nut-free": "nut-free";
2853
+ halal: "halal";
2854
+ kosher: "kosher";
2855
+ spicy: "spicy";
2856
+ }>>>;
2857
+ calories: z.ZodOptional<z.ZodNumber>;
2858
+ badges: z.ZodDefault<z.ZodArray<z.ZodString>>;
2859
+ image: z.ZodOptional<z.ZodObject<{
2860
+ src: z.ZodString;
2861
+ alt: z.ZodDefault<z.ZodString>;
2862
+ width: z.ZodOptional<z.ZodNumber>;
2863
+ height: z.ZodOptional<z.ZodNumber>;
2864
+ focal: z.ZodOptional<z.ZodObject<{
2865
+ x: z.ZodNumber;
2866
+ y: z.ZodNumber;
2867
+ }, z.core.$strip>>;
2868
+ }, z.core.$strip>>;
2869
+ featured: z.ZodOptional<z.ZodBoolean>;
2870
+ }, z.core.$strip>>>;
2871
+ }, z.core.$strip>>>;
2872
+ note: z.ZodOptional<z.ZodString>;
2873
+ }, z.core.$strip>;
2874
+ type MenuContent = z.infer<typeof menuContentSchema>;
2875
+ /** Stored menu content, tolerating anything invalid (it's dropped, not thrown). */
2876
+ declare function parseMenuContent(input: unknown): MenuContent;
2587
2877
 
2588
2878
  /**
2589
2879
  * How an Embed block runs: its HTML inside an iframe's `srcdoc` with this sandbox. Scripts, forms and popups work
@@ -3159,6 +3449,26 @@ type DonationCheckout = {
3159
3449
  donationId: string;
3160
3450
  checkoutUrl: string;
3161
3451
  };
3452
+ /**
3453
+ * A live menu (sites with Menus): Dinner, Drinks, Brunch. `locations` names where it's served; empty means
3454
+ * everywhere. Dishes' `dietary` keys are DIETARY_TAGS (labels in DIETARY_LABELS).
3455
+ */
3456
+ type HearthMenu = {
3457
+ id: string;
3458
+ slug: string;
3459
+ name: string;
3460
+ /** When it's served, or a line about it: "From 12pm daily", "Fridays and Saturdays". */
3461
+ description: string | null;
3462
+ locations: string[];
3463
+ sections: MenuSection[];
3464
+ /** Small print under the menu: allergens, service charge. */
3465
+ note: string | null;
3466
+ /** Where the allergen information is: a page on the site or a full URL. */
3467
+ allergensUrl: string | null;
3468
+ /** A printable copy (a PDF's full URL, or a page). */
3469
+ printUrl: string | null;
3470
+ updatedAt: string;
3471
+ };
3162
3472
  /** One of a site's forms (GET /forms/{key}): render it anywhere, then post it back with forms.submit. */
3163
3473
  type HearthForm = {
3164
3474
  key: string;
@@ -3233,6 +3543,12 @@ type Resolved<T extends BlockType> = T extends "hero" ? {
3233
3543
  block: string;
3234
3544
  values: Record<string, unknown>;
3235
3545
  };
3546
+ } : T extends "menu" ? {
3547
+ id: string;
3548
+ type: T;
3549
+ data: BlockData<T> & {
3550
+ menus: HearthMenu[];
3551
+ };
3236
3552
  } : T extends "donate" ? {
3237
3553
  id: string;
3238
3554
  type: T;
@@ -3381,7 +3697,7 @@ type Redirect = {
3381
3697
  /** Body of a publish webhook (verify the X-Hearth-Signature header first). */
3382
3698
  type WebhookPayload = {
3383
3699
  site: string;
3384
- kind: "page" | "sharedBlock" | "event" | "settings" | "scheduled" | (string & {});
3700
+ kind: "page" | "sharedBlock" | "event" | "settings" | "scheduled" | "giving" | "menus" | (string & {});
3385
3701
  slug?: string;
3386
3702
  at: string;
3387
3703
  };
@@ -3393,4 +3709,4 @@ type ApiErrorBody = {
3393
3709
  };
3394
3710
  };
3395
3711
 
3396
- export { type AnalyticsReport, type AnalyticsRow, type ApiErrorBody, BLOCK_SCHEMA_VERSION, type Block, type BlockData, type BlockOf, type BlockType, COLLECTION_SCHEMA_TYPES, type CategoryGroup, type CategoryRef, type Collection, type CollectionEntry, type CollectionRef, type CollectionSchemaType, type CustomBlockDefinition, type CustomField, type CustomFieldKind, DAYS_OF_WEEK, type DonationCheckout, type DonationInput, EMBED_ALLOW, EMBED_SANDBOX, type EntryDetails, type EventCustomFields, type EventRegistration, type EventTicket, type EventVolunteerShift, type EventVolunteering, type FormDefinition, type FormField, type Fundraiser, type FundraiserDetail, type GlobalBlock, type GlobalPopup, type HearthEvent, type HearthEventDetail, type HearthForm, type ImageRef, type KnownBlock, LODGING_TYPES, type LinkRef, ORGANIZATION_TYPES, type OrganizationType, PLACE_TYPES, type Page, type PageContent, type PageMeta, type PageSummary, type Position, type Redirect, type RegistrationInput, type RegistrationResult, type ResolvedBlock, SITE_LOCALES, SOCIAL_PLATFORMS, type Seo, type SharedFrom, type Site, type SiteAnalytics, type SiteSettings, type SitemapEntry, type TicketType, UNLISTED_PAGE_SLUGS, type UnknownBlock, VOLUNTEER_RESERVED_KEYS, type VolunteerForm, type VolunteerInput, type VolunteerResult, type VolunteerShift, type WebhookPayload, blockAnchorSchema, blockDataSchemas, blockFeature, blockSchema, blockTypes, customBlockDefinitionSchema, customBlockKey, customFieldSchema, customValuesSchema, directionsUrl, embedDocument, focalPosition, formDefinitionSchema, formFieldSchema, globalBlockKey, globalPopupSchema, isUnlistedPage, pageContentSchema, parseBlocks, parsePageContent, parseSiteSettings, parseTicketTypes, parseVolunteerForm, parseVolunteerShifts, pinned, popupHref, popupKey, seoSchema, siteSettingsSchema, ticketTypeSchema, ticketTypesSchema, videoEmbedUrl, volunteerFormSchema, volunteerShiftSchema, volunteerShiftsSchema };
3712
+ export { type AnalyticsReport, type AnalyticsRow, type ApiErrorBody, BLOCK_SCHEMA_VERSION, type Block, type BlockData, type BlockOf, type BlockType, COLLECTION_SCHEMA_TYPES, type CategoryGroup, type CategoryRef, type Collection, type CollectionEntry, type CollectionRef, type CollectionSchemaType, type CustomBlockDefinition, type CustomField, type CustomFieldKind, DAYS_OF_WEEK, DIETARY_LABELS, DIETARY_TAGS, type DietaryTag, type DonationCheckout, type DonationInput, EMBED_ALLOW, EMBED_SANDBOX, type EntryDetails, type EventCustomFields, type EventRegistration, type EventTicket, type EventVolunteerShift, type EventVolunteering, type FormDefinition, type FormField, type Fundraiser, type FundraiserDetail, type GlobalBlock, type GlobalPopup, type HearthEvent, type HearthEventDetail, type HearthForm, type HearthMenu, type ImageRef, type KnownBlock, LODGING_TYPES, type LinkRef, type MenuContent, type MenuItem, type MenuSection, ORGANIZATION_TYPES, type OrganizationType, PLACE_TYPES, type Page, type PageContent, type PageMeta, type PageSummary, type Position, type Redirect, type RegistrationInput, type RegistrationResult, type ResolvedBlock, SITE_LOCALES, SOCIAL_PLATFORMS, type Seo, type SharedFrom, type Site, type SiteAnalytics, type SiteSettings, type SitemapEntry, type TicketType, UNLISTED_PAGE_SLUGS, type UnknownBlock, VOLUNTEER_RESERVED_KEYS, type VolunteerForm, type VolunteerInput, type VolunteerResult, type VolunteerShift, type WebhookPayload, blockAnchorSchema, blockDataSchemas, blockFeature, blockSchema, blockTypes, customBlockDefinitionSchema, customBlockKey, customFieldSchema, customValuesSchema, directionsUrl, embedDocument, focalPosition, formDefinitionSchema, formFieldSchema, globalBlockKey, globalPopupSchema, isUnlistedPage, menuContentSchema, menuItemSchema, menuSectionSchema, pageContentSchema, parseBlocks, parseMenuContent, parsePageContent, parseSiteSettings, parseTicketTypes, parseVolunteerForm, parseVolunteerShifts, pinned, popupHref, popupKey, seoSchema, siteSettingsSchema, ticketTypeSchema, ticketTypesSchema, videoEmbedUrl, volunteerFormSchema, volunteerShiftSchema, volunteerShiftsSchema };
package/dist/index.js CHANGED
@@ -433,6 +433,32 @@ var blockDataSchemas = {
433
433
  fundraiserSlug: z.string().optional(),
434
434
  submitLabel: z.string().min(1).default("Donate")
435
435
  }),
436
+ /**
437
+ * The site's menus (the menus feature: Menus in the admin), in one of three styles. The API adds `menus`, the chosen
438
+ * live menus in this order, and leaves the block out when there are none. Locations, dietary filters and the share
439
+ * link are drawn from them; see `HearthMenu`.
440
+ */
441
+ menu: z.object({
442
+ eyebrow: z.string().optional(),
443
+ heading: z.string().optional(),
444
+ intro: z.string().optional(),
445
+ /** Which menus, in this order; empty shows every live menu in the admin's order. */
446
+ menuIds: z.array(z.string().uuid()).max(20).default([]),
447
+ /**
448
+ * "carte": set as type, like a printed menu, with an index of its sections. "tabbed": one section at a time
449
+ * under a row of tabs (an accordion on phones). "grid": every dish as a card with its photo.
450
+ */
451
+ style: z.enum(["carte", "tabbed", "grid"]).default("tabbed"),
452
+ /** Tabbed only: "accordion" shows every section as a heading that opens, at every width. */
453
+ display: z.enum(["tabs", "accordion"]).optional(),
454
+ /** Let visitors show only the dishes that suit a diet (vegan, gluten-free…). Shown when dishes carry those tags. */
455
+ filters: z.boolean().default(true),
456
+ /** A "Share this menu" button (copies the link, or the phone's share sheet). */
457
+ share: z.boolean().default(false),
458
+ /** Carte only: one photo the menu sits over, like a menu card on a table. */
459
+ image: image.optional(),
460
+ tone: tone.default("default")
461
+ }),
436
462
  /**
437
463
  * One of the site's own block types (Custom blocks in the admin): `block` is its key, `values` its fields' values,
438
464
  * as described by the site's custom block definitions (GET /custom-blocks). The site's frontend renders it.
@@ -444,6 +470,7 @@ var blockDataSchemas = {
444
470
  };
445
471
  var blockTypes = Object.keys(blockDataSchemas);
446
472
  var blockFeature = {
473
+ menu: "menus",
447
474
  upcomingEvents: "events",
448
475
  pastEvents: "events",
449
476
  eventSpotlight: "events",
@@ -565,6 +592,51 @@ var formDefinitionSchema = z.object({
565
592
  if (form.sendConfirmation && !form.fields.some((f) => f.type === "email"))
566
593
  ctx.addIssue({ code: "custom", path: ["sendConfirmation"], message: "Add an Email field to send confirmations." });
567
594
  });
595
+ var DIETARY_TAGS = ["vegan", "vegetarian", "gluten-free", "dairy-free", "nut-free", "halal", "kosher", "spicy"];
596
+ var DIETARY_LABELS = {
597
+ vegan: { label: "Vegan", short: "VG" },
598
+ vegetarian: { label: "Vegetarian", short: "V" },
599
+ "gluten-free": { label: "Gluten-free", short: "GF" },
600
+ "dairy-free": { label: "Dairy-free", short: "DF" },
601
+ "nut-free": { label: "Nut-free", short: "NF" },
602
+ halal: { label: "Halal", short: "H" },
603
+ kosher: { label: "Kosher", short: "K" },
604
+ spicy: { label: "Spicy", short: "S" }
605
+ };
606
+ var menuItemSchema = z.object({
607
+ name: z.string().trim().min(1, "Name the dish.").max(120),
608
+ description: z.string().trim().max(500, "Keep it under 500 characters.").optional(),
609
+ /** One price, or several with labels: "Glass" 9, "Bottle" 34; "175ml", "250ml", "750ml". */
610
+ prices: z.array(z.object({ label: z.string().trim().max(40).optional(), amount: z.string().trim().min(1, "Enter the price.").max(40) })).max(6, "Up to 6 prices.").default([]),
611
+ dietary: z.array(z.enum(DIETARY_TAGS)).max(DIETARY_TAGS.length).default([]),
612
+ /** Energy in kcal, where the law or the menu shows it. */
613
+ calories: z.number().int().min(0).max(1e4).optional(),
614
+ /** Short labels such as "New", "Popular" or "Chef's pick". */
615
+ badges: z.array(z.string().trim().min(1).max(30)).max(4).default([]),
616
+ image: image.optional(),
617
+ /** Set apart from the list: a set menu in a box, the signature dish, a special. */
618
+ featured: z.boolean().optional()
619
+ });
620
+ var menuSectionSchema = z.object({
621
+ /** "Small plates", "Antipasti", "Red wine". */
622
+ name: z.string().trim().min(1, "Name the section.").max(80),
623
+ /** A second name under the first: the English for "Antipasti", or "175 / 375 / 750ml". */
624
+ subtitle: z.string().trim().max(80).optional(),
625
+ intro: z.string().trim().max(500).optional(),
626
+ items: z.array(menuItemSchema).max(150, "Up to 150 dishes in a section.").default([])
627
+ });
628
+ var menuContentSchema = z.object({
629
+ sections: z.array(menuSectionSchema).max(40, "Up to 40 sections.").default([]),
630
+ /** Small print under the menu: allergens, service charge, "Ask about today's specials". */
631
+ note: z.string().trim().max(1e3).optional()
632
+ });
633
+ function parseMenuContent(input) {
634
+ const result = menuContentSchema.safeParse(input ?? {});
635
+ if (result.success) return result.data;
636
+ const raw = input && typeof input === "object" ? input : {};
637
+ const sections = Array.isArray(raw.sections) ? raw.sections.flatMap((s) => menuSectionSchema.safeParse(s).data ?? []) : [];
638
+ return { sections, ...typeof raw.note === "string" ? { note: raw.note } : {} };
639
+ }
568
640
 
569
641
  // src/embed.ts
570
642
  var EMBED_SANDBOX = "allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox allow-presentation";
@@ -867,6 +939,8 @@ export {
867
939
  BLOCK_SCHEMA_VERSION,
868
940
  COLLECTION_SCHEMA_TYPES,
869
941
  DAYS_OF_WEEK,
942
+ DIETARY_LABELS,
943
+ DIETARY_TAGS,
870
944
  EMBED_ALLOW,
871
945
  EMBED_SANDBOX,
872
946
  LODGING_TYPES,
@@ -893,8 +967,12 @@ export {
893
967
  globalBlockKey,
894
968
  globalPopupSchema,
895
969
  isUnlistedPage,
970
+ menuContentSchema,
971
+ menuItemSchema,
972
+ menuSectionSchema,
896
973
  pageContentSchema,
897
974
  parseBlocks,
975
+ parseMenuContent,
898
976
  parsePageContent,
899
977
  parseSiteSettings,
900
978
  parseTicketTypes,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@the-smithy/hearth-schema",
3
- "version": "0.34.0",
3
+ "version": "0.35.0",
4
4
  "description": "Content schemas and API types shared by Hearth and its SDK.",
5
5
  "type": "module",
6
6
  "license": "SEE LICENSE IN LICENSE",