@the-smithy/hearth-schema 0.21.0 → 0.23.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 +113 -11
- package/dist/index.js +119 -5
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -311,6 +311,22 @@ declare const customBlockDefinitionSchema: z.ZodObject<{
|
|
|
311
311
|
}, z.core.$strip>]>>;
|
|
312
312
|
}, z.core.$strip>;
|
|
313
313
|
type CustomBlockDefinition = z.infer<typeof customBlockDefinitionSchema>;
|
|
314
|
+
/**
|
|
315
|
+
* A global block's key, set when it's created and fixed after: menus, pop-up links and frontends refer to it
|
|
316
|
+
* ("contact", "newsletter"). Global blocks are edited once and shown anywhere: on pages (a `sharedBlock` block), as
|
|
317
|
+
* a pop-up, or in a menu dropdown.
|
|
318
|
+
*/
|
|
319
|
+
declare const globalBlockKey: RegExp;
|
|
320
|
+
/** A global block shown as a pop-up: links to `#popup-<key>` open it, and `button` adds a floating button that does. */
|
|
321
|
+
declare const globalPopupSchema: z.ZodObject<{
|
|
322
|
+
title: z.ZodOptional<z.ZodString>;
|
|
323
|
+
button: z.ZodOptional<z.ZodString>;
|
|
324
|
+
}, z.core.$strip>;
|
|
325
|
+
type GlobalPopup = z.infer<typeof globalPopupSchema>;
|
|
326
|
+
/** The link that opens a global block's pop-up: "#popup-contact". */
|
|
327
|
+
declare const popupHref: (key: string) => string;
|
|
328
|
+
/** The global block key a pop-up link opens ("#popup-contact" → "contact"), or null for any other link. */
|
|
329
|
+
declare function popupKey(href: string): string | null;
|
|
314
330
|
/** Validates a custom block's `values` against its definition (the block schema itself can't: it's per site). */
|
|
315
331
|
declare function customValuesSchema(fields: CustomField[]): z.ZodType<Record<string, unknown>>;
|
|
316
332
|
declare const blockDataSchemas: {
|
|
@@ -724,6 +740,7 @@ declare const blockDataSchemas: {
|
|
|
724
740
|
tag: z.ZodOptional<z.ZodString>;
|
|
725
741
|
categoryId: z.ZodOptional<z.ZodString>;
|
|
726
742
|
}, z.core.$strip>;
|
|
743
|
+
/** One of the site's global blocks, by id. The API inlines it (and adds `shared`); frontends never see this type. */
|
|
727
744
|
readonly sharedBlock: z.ZodObject<{
|
|
728
745
|
sharedBlockId: z.ZodString;
|
|
729
746
|
}, z.core.$strip>;
|
|
@@ -2530,7 +2547,6 @@ declare function pinned<T extends {
|
|
|
2530
2547
|
position: Position;
|
|
2531
2548
|
})[];
|
|
2532
2549
|
|
|
2533
|
-
declare const ORGANIZATION_TYPES: readonly ["Organization", "LocalBusiness", "NGO", "Corporation", "EducationalOrganization", "GovernmentOrganization", "MedicalOrganization", "SportsOrganization"];
|
|
2534
2550
|
/** Languages a site can be in (Open Graph locale; the page's lang attribute is the part before the underscore). */
|
|
2535
2551
|
declare const SITE_LOCALES: readonly ["en_US", "en_GB", "en_CA", "en_AU", "es_US", "es_ES", "es_MX", "fr_CA", "fr_FR", "de_DE", "pt_BR"];
|
|
2536
2552
|
declare const SOCIAL_PLATFORMS: readonly ["facebook", "instagram", "linkedin", "x", "youtube", "tiktok", "other"];
|
|
@@ -2538,6 +2554,7 @@ declare const siteSettingsSchema: z.ZodObject<{
|
|
|
2538
2554
|
navigation: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
2539
2555
|
label: z.ZodString;
|
|
2540
2556
|
href: z.ZodString;
|
|
2557
|
+
dropdown: z.ZodOptional<z.ZodString>;
|
|
2541
2558
|
}, z.core.$strip>>>;
|
|
2542
2559
|
navigationCta: z.ZodOptional<z.ZodObject<{
|
|
2543
2560
|
label: z.ZodString;
|
|
@@ -2602,6 +2619,30 @@ declare const siteSettingsSchema: z.ZodObject<{
|
|
|
2602
2619
|
GovernmentOrganization: "GovernmentOrganization";
|
|
2603
2620
|
MedicalOrganization: "MedicalOrganization";
|
|
2604
2621
|
SportsOrganization: "SportsOrganization";
|
|
2622
|
+
Hotel: "Hotel";
|
|
2623
|
+
BedAndBreakfast: "BedAndBreakfast";
|
|
2624
|
+
LodgingBusiness: "LodgingBusiness";
|
|
2625
|
+
Restaurant: "Restaurant";
|
|
2626
|
+
CafeOrCoffeeShop: "CafeOrCoffeeShop";
|
|
2627
|
+
BarOrPub: "BarOrPub";
|
|
2628
|
+
Store: "Store";
|
|
2629
|
+
ProfessionalService: "ProfessionalService";
|
|
2630
|
+
LegalService: "LegalService";
|
|
2631
|
+
AccountingService: "AccountingService";
|
|
2632
|
+
FinancialService: "FinancialService";
|
|
2633
|
+
RealEstateAgent: "RealEstateAgent";
|
|
2634
|
+
HomeAndConstructionBusiness: "HomeAndConstructionBusiness";
|
|
2635
|
+
AutomotiveBusiness: "AutomotiveBusiness";
|
|
2636
|
+
HealthAndBeautyBusiness: "HealthAndBeautyBusiness";
|
|
2637
|
+
MedicalClinic: "MedicalClinic";
|
|
2638
|
+
Dentist: "Dentist";
|
|
2639
|
+
ChildCare: "ChildCare";
|
|
2640
|
+
SportsActivityLocation: "SportsActivityLocation";
|
|
2641
|
+
EntertainmentBusiness: "EntertainmentBusiness";
|
|
2642
|
+
TouristAttraction: "TouristAttraction";
|
|
2643
|
+
Museum: "Museum";
|
|
2644
|
+
Church: "Church";
|
|
2645
|
+
School: "School";
|
|
2605
2646
|
}>>;
|
|
2606
2647
|
logo: z.ZodOptional<z.ZodObject<{
|
|
2607
2648
|
src: z.ZodString;
|
|
@@ -2629,6 +2670,35 @@ declare const siteSettingsSchema: z.ZodObject<{
|
|
|
2629
2670
|
google: z.ZodOptional<z.ZodString>;
|
|
2630
2671
|
bing: z.ZodOptional<z.ZodString>;
|
|
2631
2672
|
}, z.core.$strip>>;
|
|
2673
|
+
business: z.ZodDefault<z.ZodObject<{
|
|
2674
|
+
address: z.ZodDefault<z.ZodObject<{
|
|
2675
|
+
street: z.ZodOptional<z.ZodString>;
|
|
2676
|
+
city: z.ZodOptional<z.ZodString>;
|
|
2677
|
+
region: z.ZodOptional<z.ZodString>;
|
|
2678
|
+
postalCode: z.ZodOptional<z.ZodString>;
|
|
2679
|
+
country: z.ZodOptional<z.ZodString>;
|
|
2680
|
+
}, z.core.$strip>>;
|
|
2681
|
+
position: z.ZodOptional<z.ZodObject<{
|
|
2682
|
+
lat: z.ZodNumber;
|
|
2683
|
+
lng: z.ZodNumber;
|
|
2684
|
+
}, z.core.$strip>>;
|
|
2685
|
+
hours: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
2686
|
+
days: z.ZodArray<z.ZodEnum<{
|
|
2687
|
+
Monday: "Monday";
|
|
2688
|
+
Tuesday: "Tuesday";
|
|
2689
|
+
Wednesday: "Wednesday";
|
|
2690
|
+
Thursday: "Thursday";
|
|
2691
|
+
Friday: "Friday";
|
|
2692
|
+
Saturday: "Saturday";
|
|
2693
|
+
Sunday: "Sunday";
|
|
2694
|
+
}>>;
|
|
2695
|
+
opens: z.ZodString;
|
|
2696
|
+
closes: z.ZodString;
|
|
2697
|
+
}, z.core.$strip>>>;
|
|
2698
|
+
priceRange: z.ZodOptional<z.ZodString>;
|
|
2699
|
+
checkinTime: z.ZodOptional<z.ZodString>;
|
|
2700
|
+
checkoutTime: z.ZodOptional<z.ZodString>;
|
|
2701
|
+
}, z.core.$strip>>;
|
|
2632
2702
|
}, z.core.$strip>>;
|
|
2633
2703
|
analytics: z.ZodDefault<z.ZodObject<{
|
|
2634
2704
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -2637,6 +2707,25 @@ declare const siteSettingsSchema: z.ZodObject<{
|
|
|
2637
2707
|
type SiteSettings = z.infer<typeof siteSettingsSchema>;
|
|
2638
2708
|
declare function parseSiteSettings(input: unknown): SiteSettings;
|
|
2639
2709
|
|
|
2710
|
+
/**
|
|
2711
|
+
* The schema.org types Hearth describes sites and their content with, for search engines and AI. Additive changes
|
|
2712
|
+
* only: sites store these names.
|
|
2713
|
+
*/
|
|
2714
|
+
/** What kind of organization a site is (Settings → Search & sharing). */
|
|
2715
|
+
declare const ORGANIZATION_TYPES: readonly ["Organization", "LocalBusiness", "NGO", "Corporation", "EducationalOrganization", "GovernmentOrganization", "MedicalOrganization", "SportsOrganization", "Hotel", "BedAndBreakfast", "LodgingBusiness", "Restaurant", "CafeOrCoffeeShop", "BarOrPub", "Store", "ProfessionalService", "LegalService", "AccountingService", "FinancialService", "RealEstateAgent", "HomeAndConstructionBusiness", "AutomotiveBusiness", "HealthAndBeautyBusiness", "MedicalClinic", "Dentist", "ChildCare", "SportsActivityLocation", "EntertainmentBusiness", "TouristAttraction", "Museum", "Church", "School"];
|
|
2716
|
+
type OrganizationType = (typeof ORGANIZATION_TYPES)[number];
|
|
2717
|
+
/** Types that are a place people visit, so opening hours, a map position and a price range apply. */
|
|
2718
|
+
declare const PLACE_TYPES: readonly OrganizationType[];
|
|
2719
|
+
/** Places to stay: these also get check-in and check-out times. */
|
|
2720
|
+
declare const LODGING_TYPES: readonly OrganizationType[];
|
|
2721
|
+
declare const DAYS_OF_WEEK: readonly ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"];
|
|
2722
|
+
/**
|
|
2723
|
+
* What a page collection's entries are, for search engines: articles (the default), or rooms, services, people or
|
|
2724
|
+
* plain pages. Event collections' entries are always events.
|
|
2725
|
+
*/
|
|
2726
|
+
declare const COLLECTION_SCHEMA_TYPES: readonly ["BlogPosting", "NewsArticle", "Article", "Service", "HotelRoom", "Person", "WebPage"];
|
|
2727
|
+
type CollectionSchemaType = (typeof COLLECTION_SCHEMA_TYPES)[number];
|
|
2728
|
+
|
|
2640
2729
|
/**
|
|
2641
2730
|
* A way to register for an event (sites with the Tickets feature), e.g. "Foursome · $500 · 4 golfers" or a free
|
|
2642
2731
|
* "RSVP". Stored on the event; each registration keeps a snapshot of the ticket's name and price.
|
|
@@ -2922,6 +3011,8 @@ type Collection = CollectionRef & {
|
|
|
2922
3011
|
/** The collection's own address, e.g. "/blog". */
|
|
2923
3012
|
path: string;
|
|
2924
3013
|
sort: "newest" | "oldest" | "title";
|
|
3014
|
+
/** What a page collection's entries are for search engines (BlogPosting, HotelRoom…). Missing from older Hearth versions. */
|
|
3015
|
+
schemaType?: CollectionSchemaType;
|
|
2925
3016
|
};
|
|
2926
3017
|
/** One page in a page collection, as listed (the full page comes from pages.get with its path). */
|
|
2927
3018
|
type CollectionEntry = {
|
|
@@ -2988,7 +3079,7 @@ type HearthForm = {
|
|
|
2988
3079
|
submitLabel: string;
|
|
2989
3080
|
successMessage: string;
|
|
2990
3081
|
};
|
|
2991
|
-
/** Blocks as the API returns them: event blocks carry their events,
|
|
3082
|
+
/** Blocks as the API returns them: event blocks carry their events, global blocks say where they came from. */
|
|
2992
3083
|
type Resolved<T extends BlockType> = T extends "hero" ? {
|
|
2993
3084
|
id: string;
|
|
2994
3085
|
type: T;
|
|
@@ -3061,12 +3152,15 @@ type Resolved<T extends BlockType> = T extends "hero" ? {
|
|
|
3061
3152
|
type: T;
|
|
3062
3153
|
data: BlockData<T>;
|
|
3063
3154
|
};
|
|
3155
|
+
/** On a block that came from one of the site's global blocks: which one (`key` from Hearth versions with global blocks). */
|
|
3156
|
+
type SharedFrom = {
|
|
3157
|
+
id: string;
|
|
3158
|
+
name: string;
|
|
3159
|
+
key?: string;
|
|
3160
|
+
};
|
|
3064
3161
|
type KnownBlock = {
|
|
3065
3162
|
[T in Exclude<BlockType, "sharedBlock">]: Resolved<T> & {
|
|
3066
|
-
shared?:
|
|
3067
|
-
id: string;
|
|
3068
|
-
name: string;
|
|
3069
|
-
};
|
|
3163
|
+
shared?: SharedFrom;
|
|
3070
3164
|
};
|
|
3071
3165
|
}[Exclude<BlockType, "sharedBlock">];
|
|
3072
3166
|
/** A block type added to the library after this package version: render it if you can, skip it if not. */
|
|
@@ -3074,16 +3168,24 @@ type UnknownBlock = {
|
|
|
3074
3168
|
id: string;
|
|
3075
3169
|
type: string & {};
|
|
3076
3170
|
data: unknown;
|
|
3077
|
-
shared?:
|
|
3078
|
-
id: string;
|
|
3079
|
-
name: string;
|
|
3080
|
-
};
|
|
3171
|
+
shared?: SharedFrom;
|
|
3081
3172
|
};
|
|
3082
3173
|
type ResolvedBlock = KnownBlock | UnknownBlock;
|
|
3083
3174
|
/** One block type, narrowed: BlockOf<"hero">. */
|
|
3084
3175
|
type BlockOf<T extends Exclude<BlockType, "sharedBlock">> = Extract<KnownBlock, {
|
|
3085
3176
|
type: T;
|
|
3086
3177
|
}>;
|
|
3178
|
+
/**
|
|
3179
|
+
* One of the site's global blocks (GET /global-blocks): edited once in Hearth and shown anywhere. `popup` is set when
|
|
3180
|
+
* editors made it a pop-up: render it in a dialog that links to `#popup-<key>` open (and a floating button when
|
|
3181
|
+
* `popup.button` is set). Menu items name one in `dropdown`. Frontends can also place any by key.
|
|
3182
|
+
*/
|
|
3183
|
+
type GlobalBlock = {
|
|
3184
|
+
key: string;
|
|
3185
|
+
name: string;
|
|
3186
|
+
popup: GlobalPopup | null;
|
|
3187
|
+
block: ResolvedBlock;
|
|
3188
|
+
};
|
|
3087
3189
|
/** Where a site's tracker sends page views (<HearthAnalytics /> from `@the-smithy/hearth/analytics`). */
|
|
3088
3190
|
type SiteAnalytics = {
|
|
3089
3191
|
/** The collector's address. */
|
|
@@ -3179,4 +3281,4 @@ type ApiErrorBody = {
|
|
|
3179
3281
|
};
|
|
3180
3282
|
};
|
|
3181
3283
|
|
|
3182
|
-
export { type AnalyticsReport, type AnalyticsRow, type ApiErrorBody, BLOCK_SCHEMA_VERSION, type Block, type BlockData, type BlockOf, type BlockType, type CategoryGroup, type CategoryRef, type Collection, type CollectionEntry, type CollectionRef, type CustomBlockDefinition, type CustomField, type CustomFieldKind, 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 HearthEvent, type HearthEventDetail, type HearthForm, type ImageRef, type KnownBlock, type LinkRef, ORGANIZATION_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 Site, type SiteAnalytics, type SiteSettings, type SitemapEntry, type TicketType, type UnknownBlock, VOLUNTEER_RESERVED_KEYS, type VolunteerForm, type VolunteerInput, type VolunteerResult, type VolunteerShift, type WebhookPayload, blockDataSchemas, blockFeature, blockSchema, blockTypes, customBlockDefinitionSchema, customBlockKey, customFieldSchema, customValuesSchema, directionsUrl, embedDocument, focalPosition, formDefinitionSchema, formFieldSchema, pageContentSchema, parseBlocks, parsePageContent, parseSiteSettings, parseTicketTypes, parseVolunteerForm, parseVolunteerShifts, pinned, seoSchema, siteSettingsSchema, ticketTypeSchema, ticketTypesSchema, videoEmbedUrl, volunteerFormSchema, volunteerShiftSchema, volunteerShiftsSchema };
|
|
3284
|
+
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, type UnknownBlock, VOLUNTEER_RESERVED_KEYS, type VolunteerForm, type VolunteerInput, type VolunteerResult, type VolunteerShift, type WebhookPayload, blockDataSchemas, blockFeature, blockSchema, blockTypes, customBlockDefinitionSchema, customBlockKey, customFieldSchema, customValuesSchema, directionsUrl, embedDocument, focalPosition, formDefinitionSchema, formFieldSchema, globalBlockKey, globalPopupSchema, pageContentSchema, parseBlocks, parsePageContent, parseSiteSettings, parseTicketTypes, parseVolunteerForm, parseVolunteerShifts, pinned, popupHref, popupKey, seoSchema, siteSettingsSchema, ticketTypeSchema, ticketTypesSchema, videoEmbedUrl, volunteerFormSchema, volunteerShiftSchema, volunteerShiftsSchema };
|
package/dist/index.js
CHANGED
|
@@ -72,6 +72,18 @@ var customBlockDefinitionSchema = z.object({
|
|
|
72
72
|
description: z.string().trim().max(200).default(""),
|
|
73
73
|
fields: z.array(customFieldSchema).min(1, "Add at least one field.").max(30).refine(uniqueNames, "Two fields share a name.").refine((fs) => fs.every((f) => f.kind !== "list" || uniqueNames(f.fields)), "Two fields in a list share a name.")
|
|
74
74
|
});
|
|
75
|
+
var globalBlockKey = customBlockKey;
|
|
76
|
+
var globalPopupSchema = z.object({
|
|
77
|
+
/** The pop-up's heading; without one, its name is read out to screen readers. */
|
|
78
|
+
title: z.string().trim().max(80).optional(),
|
|
79
|
+
/** Text of a button fixed to the corner of every page that opens the pop-up, e.g. "Contact us". */
|
|
80
|
+
button: z.string().trim().max(40).optional()
|
|
81
|
+
});
|
|
82
|
+
var popupHref = (key) => `#popup-${key}`;
|
|
83
|
+
function popupKey(href) {
|
|
84
|
+
const m = /^#popup-([a-z][a-z0-9]*(?:-[a-z0-9]+)*)$/.exec(href.trim());
|
|
85
|
+
return m ? m[1] : null;
|
|
86
|
+
}
|
|
75
87
|
function customValuesSchema(fields) {
|
|
76
88
|
const one = (f) => {
|
|
77
89
|
const required = !f.optional;
|
|
@@ -375,8 +387,9 @@ var blockDataSchemas = {
|
|
|
375
387
|
/** Only entries in this category (e.g. "Featured"). */
|
|
376
388
|
categoryId: z.string().uuid().optional()
|
|
377
389
|
}),
|
|
390
|
+
/** One of the site's global blocks, by id. The API inlines it (and adds `shared`); frontends never see this type. */
|
|
378
391
|
sharedBlock: z.object({
|
|
379
|
-
sharedBlockId: z.string().uuid("Choose a
|
|
392
|
+
sharedBlockId: z.string().uuid("Choose a global block")
|
|
380
393
|
}),
|
|
381
394
|
/** One fundraiser with its progress (giving feature). The API adds `fundraiser`. */
|
|
382
395
|
fundraiserSpotlight: z.object({
|
|
@@ -566,12 +579,81 @@ function pinned(places) {
|
|
|
566
579
|
|
|
567
580
|
// src/site-settings.ts
|
|
568
581
|
import { z as z2 } from "zod";
|
|
582
|
+
|
|
583
|
+
// src/structured-data.ts
|
|
584
|
+
var ORGANIZATION_TYPES = [
|
|
585
|
+
"Organization",
|
|
586
|
+
"LocalBusiness",
|
|
587
|
+
"NGO",
|
|
588
|
+
"Corporation",
|
|
589
|
+
"EducationalOrganization",
|
|
590
|
+
"GovernmentOrganization",
|
|
591
|
+
"MedicalOrganization",
|
|
592
|
+
"SportsOrganization",
|
|
593
|
+
// Places people visit: these also get the address, map position, opening hours and price range.
|
|
594
|
+
"Hotel",
|
|
595
|
+
"BedAndBreakfast",
|
|
596
|
+
"LodgingBusiness",
|
|
597
|
+
"Restaurant",
|
|
598
|
+
"CafeOrCoffeeShop",
|
|
599
|
+
"BarOrPub",
|
|
600
|
+
"Store",
|
|
601
|
+
"ProfessionalService",
|
|
602
|
+
"LegalService",
|
|
603
|
+
"AccountingService",
|
|
604
|
+
"FinancialService",
|
|
605
|
+
"RealEstateAgent",
|
|
606
|
+
"HomeAndConstructionBusiness",
|
|
607
|
+
"AutomotiveBusiness",
|
|
608
|
+
"HealthAndBeautyBusiness",
|
|
609
|
+
"MedicalClinic",
|
|
610
|
+
"Dentist",
|
|
611
|
+
"ChildCare",
|
|
612
|
+
"SportsActivityLocation",
|
|
613
|
+
"EntertainmentBusiness",
|
|
614
|
+
"TouristAttraction",
|
|
615
|
+
"Museum",
|
|
616
|
+
"Church",
|
|
617
|
+
"School"
|
|
618
|
+
];
|
|
619
|
+
var PLACE_TYPES = [
|
|
620
|
+
"LocalBusiness",
|
|
621
|
+
"Hotel",
|
|
622
|
+
"BedAndBreakfast",
|
|
623
|
+
"LodgingBusiness",
|
|
624
|
+
"Restaurant",
|
|
625
|
+
"CafeOrCoffeeShop",
|
|
626
|
+
"BarOrPub",
|
|
627
|
+
"Store",
|
|
628
|
+
"ProfessionalService",
|
|
629
|
+
"LegalService",
|
|
630
|
+
"AccountingService",
|
|
631
|
+
"FinancialService",
|
|
632
|
+
"RealEstateAgent",
|
|
633
|
+
"HomeAndConstructionBusiness",
|
|
634
|
+
"AutomotiveBusiness",
|
|
635
|
+
"HealthAndBeautyBusiness",
|
|
636
|
+
"MedicalClinic",
|
|
637
|
+
"Dentist",
|
|
638
|
+
"ChildCare",
|
|
639
|
+
"SportsActivityLocation",
|
|
640
|
+
"EntertainmentBusiness",
|
|
641
|
+
"TouristAttraction",
|
|
642
|
+
"Museum",
|
|
643
|
+
"Church"
|
|
644
|
+
];
|
|
645
|
+
var LODGING_TYPES = ["Hotel", "BedAndBreakfast", "LodgingBusiness"];
|
|
646
|
+
var DAYS_OF_WEEK = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"];
|
|
647
|
+
var COLLECTION_SCHEMA_TYPES = ["BlogPosting", "NewsArticle", "Article", "Service", "HotelRoom", "Person", "WebPage"];
|
|
648
|
+
|
|
649
|
+
// src/site-settings.ts
|
|
650
|
+
var time = z2.string().regex(/^([01]\d|2[0-3]):[0-5]\d$/, "Use 24-hour time like 09:00 or 17:30.");
|
|
569
651
|
var link2 = z2.object({ label: z2.string().trim().min(1, "Add link text."), href: z2.string().trim().min(1, "Add where it goes.") });
|
|
570
|
-
var ORGANIZATION_TYPES = ["Organization", "LocalBusiness", "NGO", "Corporation", "EducationalOrganization", "GovernmentOrganization", "MedicalOrganization", "SportsOrganization"];
|
|
571
652
|
var SITE_LOCALES = ["en_US", "en_GB", "en_CA", "en_AU", "es_US", "es_ES", "es_MX", "fr_CA", "fr_FR", "de_DE", "pt_BR"];
|
|
572
653
|
var SOCIAL_PLATFORMS = ["facebook", "instagram", "linkedin", "x", "youtube", "tiktok", "other"];
|
|
654
|
+
var navItem = link2.extend({ dropdown: z2.string().regex(globalBlockKey).optional() });
|
|
573
655
|
var siteSettingsSchema = z2.object({
|
|
574
|
-
navigation: z2.array(
|
|
656
|
+
navigation: z2.array(navItem).default([]),
|
|
575
657
|
/** An optional button at the end of the main menu, e.g. "Book now" or "Donate". Frontends style it as a button. */
|
|
576
658
|
navigationCta: link2.optional(),
|
|
577
659
|
footerLinks: z2.array(link2).default([]),
|
|
@@ -652,8 +734,32 @@ var siteSettingsSchema = z2.object({
|
|
|
652
734
|
verification: z2.object({
|
|
653
735
|
google: z2.string().trim().max(120).regex(/^[A-Za-z0-9_-]*$/, `Paste only the code from the tag's content="\u2026".`).optional(),
|
|
654
736
|
bing: z2.string().trim().max(120).regex(/^[A-Za-z0-9_-]*$/, `Paste only the code from the tag's content="\u2026".`).optional()
|
|
655
|
-
}).default({})
|
|
656
|
-
|
|
737
|
+
}).default({}),
|
|
738
|
+
/**
|
|
739
|
+
* The business as search engines and AI answers describe it: the address in parts (the contact address is
|
|
740
|
+
* free text, as the design shows it), its map pin, opening hours, price range and, for places to stay,
|
|
741
|
+
* check-in and check-out times. Pin, hours and price apply to places people visit (PLACE_TYPES).
|
|
742
|
+
*/
|
|
743
|
+
business: z2.object({
|
|
744
|
+
address: z2.object({
|
|
745
|
+
street: z2.string().trim().max(200).optional(),
|
|
746
|
+
city: z2.string().trim().max(100).optional(),
|
|
747
|
+
/** State, province or county, e.g. NH. */
|
|
748
|
+
region: z2.string().trim().max(100).optional(),
|
|
749
|
+
postalCode: z2.string().trim().max(20).optional(),
|
|
750
|
+
/** Two-letter country code, e.g. US. */
|
|
751
|
+
country: z2.string().trim().regex(/^[A-Za-z]{2}$/, "Use the two-letter country code, e.g. US.").optional()
|
|
752
|
+
}).default({}),
|
|
753
|
+
/** Its map pin, like a Location block's: found from the address, then adjusted. */
|
|
754
|
+
position: z2.object({ lat: z2.number().min(-90).max(90), lng: z2.number().min(-180).max(180) }).optional(),
|
|
755
|
+
/** Opening hours: each row is some days with the same hours. Days not listed are closed. */
|
|
756
|
+
hours: z2.array(z2.object({ days: z2.array(z2.enum(DAYS_OF_WEEK)).min(1, "Pick at least one day."), opens: time, closes: time })).max(14).default([]),
|
|
757
|
+
/** E.g. $$ or $120–$250. */
|
|
758
|
+
priceRange: z2.string().trim().max(40).optional(),
|
|
759
|
+
checkinTime: time.optional(),
|
|
760
|
+
checkoutTime: time.optional()
|
|
761
|
+
}).default({ address: {}, hours: [] })
|
|
762
|
+
}).default({ organizationType: "Organization", locale: "en_US", verification: {}, business: { address: {}, hours: [] } }),
|
|
657
763
|
/** Built-in visitor analytics (cookieless; included in every plan). On unless the site turns it off. */
|
|
658
764
|
analytics: z2.object({ enabled: z2.boolean().default(true) }).default({ enabled: true })
|
|
659
765
|
});
|
|
@@ -737,9 +843,13 @@ function parseVolunteerForm(input) {
|
|
|
737
843
|
}
|
|
738
844
|
export {
|
|
739
845
|
BLOCK_SCHEMA_VERSION,
|
|
846
|
+
COLLECTION_SCHEMA_TYPES,
|
|
847
|
+
DAYS_OF_WEEK,
|
|
740
848
|
EMBED_ALLOW,
|
|
741
849
|
EMBED_SANDBOX,
|
|
850
|
+
LODGING_TYPES,
|
|
742
851
|
ORGANIZATION_TYPES,
|
|
852
|
+
PLACE_TYPES,
|
|
743
853
|
SITE_LOCALES,
|
|
744
854
|
SOCIAL_PLATFORMS,
|
|
745
855
|
VOLUNTEER_RESERVED_KEYS,
|
|
@@ -756,6 +866,8 @@ export {
|
|
|
756
866
|
focalPosition,
|
|
757
867
|
formDefinitionSchema,
|
|
758
868
|
formFieldSchema,
|
|
869
|
+
globalBlockKey,
|
|
870
|
+
globalPopupSchema,
|
|
759
871
|
pageContentSchema,
|
|
760
872
|
parseBlocks,
|
|
761
873
|
parsePageContent,
|
|
@@ -764,6 +876,8 @@ export {
|
|
|
764
876
|
parseVolunteerForm,
|
|
765
877
|
parseVolunteerShifts,
|
|
766
878
|
pinned,
|
|
879
|
+
popupHref,
|
|
880
|
+
popupKey,
|
|
767
881
|
seoSchema,
|
|
768
882
|
siteSettingsSchema,
|
|
769
883
|
ticketTypeSchema,
|