@the-smithy/hearth-schema 0.16.0 → 0.18.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
@@ -613,6 +613,15 @@ declare const blockDataSchemas: {
613
613
  collectionId: z.ZodOptional<z.ZodString>;
614
614
  categoryId: z.ZodOptional<z.ZodString>;
615
615
  }, z.core.$strip>;
616
+ /** Events that have ended, most recent first: a talk archive, past events. */
617
+ readonly pastEvents: z.ZodObject<{
618
+ eyebrow: z.ZodOptional<z.ZodString>;
619
+ heading: z.ZodOptional<z.ZodString>;
620
+ intro: z.ZodOptional<z.ZodString>;
621
+ limit: z.ZodDefault<z.ZodNumber>;
622
+ collectionId: z.ZodOptional<z.ZodString>;
623
+ categoryId: z.ZodOptional<z.ZodString>;
624
+ }, z.core.$strip>;
616
625
  readonly eventSpotlight: z.ZodObject<{
617
626
  eventSlug: z.ZodOptional<z.ZodString>;
618
627
  categoryId: z.ZodOptional<z.ZodString>;
@@ -680,7 +689,7 @@ declare const blockTypes: BlockType[];
680
689
  declare const blockFeature: Partial<Record<BlockType, "events" | "giving">>;
681
690
  declare const blockSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
682
691
  id: z.ZodString;
683
- type: z.ZodLiteral<"custom" | "cta" | "quote" | "people" | "logos" | "hero" | "richText" | "mediaText" | "stats" | "cardGrid" | "faq" | "pricing" | "projects" | "location" | "schedule" | "gallery" | "video" | "embed" | "form" | "upcomingEvents" | "eventSpotlight" | "collectionList" | "sharedBlock" | "fundraiserSpotlight" | "fundraiserGrid" | "donate">;
692
+ type: z.ZodLiteral<"custom" | "cta" | "quote" | "people" | "logos" | "hero" | "richText" | "mediaText" | "stats" | "cardGrid" | "faq" | "pricing" | "projects" | "location" | "schedule" | "gallery" | "video" | "embed" | "form" | "upcomingEvents" | "pastEvents" | "eventSpotlight" | "collectionList" | "sharedBlock" | "fundraiserSpotlight" | "fundraiserGrid" | "donate">;
684
693
  data: z.ZodObject<{
685
694
  eyebrow: z.ZodOptional<z.ZodString>;
686
695
  heading: z.ZodString;
@@ -966,6 +975,13 @@ declare const blockSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
966
975
  limit: z.ZodDefault<z.ZodNumber>;
967
976
  collectionId: z.ZodOptional<z.ZodString>;
968
977
  categoryId: z.ZodOptional<z.ZodString>;
978
+ }, z.core.$strip> | z.ZodObject<{
979
+ eyebrow: z.ZodOptional<z.ZodString>;
980
+ heading: z.ZodOptional<z.ZodString>;
981
+ intro: z.ZodOptional<z.ZodString>;
982
+ limit: z.ZodDefault<z.ZodNumber>;
983
+ collectionId: z.ZodOptional<z.ZodString>;
984
+ categoryId: z.ZodOptional<z.ZodString>;
969
985
  }, z.core.$strip> | z.ZodObject<{
970
986
  eventSlug: z.ZodOptional<z.ZodString>;
971
987
  categoryId: z.ZodOptional<z.ZodString>;
@@ -1010,7 +1026,7 @@ declare const blockSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1010
1026
  }, z.core.$strip>;
1011
1027
  }, z.core.$strip>, ...z.ZodObject<{
1012
1028
  id: z.ZodString;
1013
- type: z.ZodLiteral<"custom" | "cta" | "quote" | "people" | "logos" | "hero" | "richText" | "mediaText" | "stats" | "cardGrid" | "faq" | "pricing" | "projects" | "location" | "schedule" | "gallery" | "video" | "embed" | "form" | "upcomingEvents" | "eventSpotlight" | "collectionList" | "sharedBlock" | "fundraiserSpotlight" | "fundraiserGrid" | "donate">;
1029
+ type: z.ZodLiteral<"custom" | "cta" | "quote" | "people" | "logos" | "hero" | "richText" | "mediaText" | "stats" | "cardGrid" | "faq" | "pricing" | "projects" | "location" | "schedule" | "gallery" | "video" | "embed" | "form" | "upcomingEvents" | "pastEvents" | "eventSpotlight" | "collectionList" | "sharedBlock" | "fundraiserSpotlight" | "fundraiserGrid" | "donate">;
1014
1030
  data: z.ZodObject<{
1015
1031
  eyebrow: z.ZodOptional<z.ZodString>;
1016
1032
  heading: z.ZodString;
@@ -1296,6 +1312,13 @@ declare const blockSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1296
1312
  limit: z.ZodDefault<z.ZodNumber>;
1297
1313
  collectionId: z.ZodOptional<z.ZodString>;
1298
1314
  categoryId: z.ZodOptional<z.ZodString>;
1315
+ }, z.core.$strip> | z.ZodObject<{
1316
+ eyebrow: z.ZodOptional<z.ZodString>;
1317
+ heading: z.ZodOptional<z.ZodString>;
1318
+ intro: z.ZodOptional<z.ZodString>;
1319
+ limit: z.ZodDefault<z.ZodNumber>;
1320
+ collectionId: z.ZodOptional<z.ZodString>;
1321
+ categoryId: z.ZodOptional<z.ZodString>;
1299
1322
  }, z.core.$strip> | z.ZodObject<{
1300
1323
  eventSlug: z.ZodOptional<z.ZodString>;
1301
1324
  categoryId: z.ZodOptional<z.ZodString>;
@@ -1383,7 +1406,7 @@ declare const pageContentSchema: z.ZodObject<{
1383
1406
  }, z.core.$strip>>;
1384
1407
  blocks: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
1385
1408
  id: z.ZodString;
1386
- type: z.ZodLiteral<"custom" | "cta" | "quote" | "people" | "logos" | "hero" | "richText" | "mediaText" | "stats" | "cardGrid" | "faq" | "pricing" | "projects" | "location" | "schedule" | "gallery" | "video" | "embed" | "form" | "upcomingEvents" | "eventSpotlight" | "collectionList" | "sharedBlock" | "fundraiserSpotlight" | "fundraiserGrid" | "donate">;
1409
+ type: z.ZodLiteral<"custom" | "cta" | "quote" | "people" | "logos" | "hero" | "richText" | "mediaText" | "stats" | "cardGrid" | "faq" | "pricing" | "projects" | "location" | "schedule" | "gallery" | "video" | "embed" | "form" | "upcomingEvents" | "pastEvents" | "eventSpotlight" | "collectionList" | "sharedBlock" | "fundraiserSpotlight" | "fundraiserGrid" | "donate">;
1387
1410
  data: z.ZodObject<{
1388
1411
  eyebrow: z.ZodOptional<z.ZodString>;
1389
1412
  heading: z.ZodString;
@@ -1669,6 +1692,13 @@ declare const pageContentSchema: z.ZodObject<{
1669
1692
  limit: z.ZodDefault<z.ZodNumber>;
1670
1693
  collectionId: z.ZodOptional<z.ZodString>;
1671
1694
  categoryId: z.ZodOptional<z.ZodString>;
1695
+ }, z.core.$strip> | z.ZodObject<{
1696
+ eyebrow: z.ZodOptional<z.ZodString>;
1697
+ heading: z.ZodOptional<z.ZodString>;
1698
+ intro: z.ZodOptional<z.ZodString>;
1699
+ limit: z.ZodDefault<z.ZodNumber>;
1700
+ collectionId: z.ZodOptional<z.ZodString>;
1701
+ categoryId: z.ZodOptional<z.ZodString>;
1672
1702
  }, z.core.$strip> | z.ZodObject<{
1673
1703
  eventSlug: z.ZodOptional<z.ZodString>;
1674
1704
  categoryId: z.ZodOptional<z.ZodString>;
@@ -1713,7 +1743,7 @@ declare const pageContentSchema: z.ZodObject<{
1713
1743
  }, z.core.$strip>;
1714
1744
  }, z.core.$strip>, ...z.ZodObject<{
1715
1745
  id: z.ZodString;
1716
- type: z.ZodLiteral<"custom" | "cta" | "quote" | "people" | "logos" | "hero" | "richText" | "mediaText" | "stats" | "cardGrid" | "faq" | "pricing" | "projects" | "location" | "schedule" | "gallery" | "video" | "embed" | "form" | "upcomingEvents" | "eventSpotlight" | "collectionList" | "sharedBlock" | "fundraiserSpotlight" | "fundraiserGrid" | "donate">;
1746
+ type: z.ZodLiteral<"custom" | "cta" | "quote" | "people" | "logos" | "hero" | "richText" | "mediaText" | "stats" | "cardGrid" | "faq" | "pricing" | "projects" | "location" | "schedule" | "gallery" | "video" | "embed" | "form" | "upcomingEvents" | "pastEvents" | "eventSpotlight" | "collectionList" | "sharedBlock" | "fundraiserSpotlight" | "fundraiserGrid" | "donate">;
1717
1747
  data: z.ZodObject<{
1718
1748
  eyebrow: z.ZodOptional<z.ZodString>;
1719
1749
  heading: z.ZodString;
@@ -1999,6 +2029,13 @@ declare const pageContentSchema: z.ZodObject<{
1999
2029
  limit: z.ZodDefault<z.ZodNumber>;
2000
2030
  collectionId: z.ZodOptional<z.ZodString>;
2001
2031
  categoryId: z.ZodOptional<z.ZodString>;
2032
+ }, z.core.$strip> | z.ZodObject<{
2033
+ eyebrow: z.ZodOptional<z.ZodString>;
2034
+ heading: z.ZodOptional<z.ZodString>;
2035
+ intro: z.ZodOptional<z.ZodString>;
2036
+ limit: z.ZodDefault<z.ZodNumber>;
2037
+ collectionId: z.ZodOptional<z.ZodString>;
2038
+ categoryId: z.ZodOptional<z.ZodString>;
2002
2039
  }, z.core.$strip> | z.ZodObject<{
2003
2040
  eventSlug: z.ZodOptional<z.ZodString>;
2004
2041
  categoryId: z.ZodOptional<z.ZodString>;
@@ -2208,6 +2245,9 @@ declare const siteSettingsSchema: z.ZodObject<{
2208
2245
  bing: z.ZodOptional<z.ZodString>;
2209
2246
  }, z.core.$strip>>;
2210
2247
  }, z.core.$strip>>;
2248
+ analytics: z.ZodDefault<z.ZodObject<{
2249
+ enabled: z.ZodDefault<z.ZodBoolean>;
2250
+ }, z.core.$strip>>;
2211
2251
  }, z.core.$strip>;
2212
2252
  type SiteSettings = z.infer<typeof siteSettingsSchema>;
2213
2253
  declare function parseSiteSettings(input: unknown): SiteSettings;
@@ -2479,7 +2519,7 @@ type Resolved<T extends BlockType> = T extends "hero" ? {
2479
2519
  alt: string;
2480
2520
  } | null;
2481
2521
  };
2482
- } : T extends "upcomingEvents" ? {
2522
+ } : T extends "upcomingEvents" | "pastEvents" ? {
2483
2523
  id: string;
2484
2524
  type: T;
2485
2525
  data: BlockData<T> & {
@@ -2560,12 +2600,46 @@ type ResolvedBlock = KnownBlock | UnknownBlock;
2560
2600
  type BlockOf<T extends Exclude<BlockType, "sharedBlock">> = Extract<KnownBlock, {
2561
2601
  type: T;
2562
2602
  }>;
2603
+ /** Where a site's tracker sends page views (<HearthAnalytics /> from `@the-smithy/hearth/analytics`). */
2604
+ type SiteAnalytics = {
2605
+ /** The collector's address. */
2606
+ endpoint: string;
2607
+ /** Which property the page views count for (the site's own). Public. */
2608
+ key: string;
2609
+ };
2610
+ /** One row of a top list: a page, source, country… with its numbers. */
2611
+ type AnalyticsRow = {
2612
+ value: string;
2613
+ visitors: number;
2614
+ pageviews: number;
2615
+ events: number;
2616
+ };
2617
+ /** `GET /analytics`: visitor analytics from the daily totals (updated hourly). */
2618
+ type AnalyticsReport = {
2619
+ from: string;
2620
+ to: string;
2621
+ totals: {
2622
+ visitors: number;
2623
+ pageviews: number;
2624
+ events: number;
2625
+ };
2626
+ days: {
2627
+ day: string;
2628
+ visitors: number;
2629
+ pageviews: number;
2630
+ events: number;
2631
+ }[];
2632
+ /** Top values by visitors. `channel` is Direct, Search, Social, Email, Paid or Referral. */
2633
+ top: Partial<Record<"path" | "channel" | "referrer" | "utm_source" | "utm_campaign" | "device" | "country" | "browser" | "event", AnalyticsRow[]>>;
2634
+ };
2563
2635
  type Site = {
2564
2636
  slug: string;
2565
2637
  name: string;
2566
2638
  domain: string | null;
2567
2639
  features: string[];
2568
2640
  settings: SiteSettings;
2641
+ /** Built-in visitor analytics; null when the site has it off. Missing from Hearth versions before analytics. */
2642
+ analytics?: SiteAnalytics | null;
2569
2643
  };
2570
2644
  type PageSummary = {
2571
2645
  slug: string;
@@ -2621,4 +2695,4 @@ type ApiErrorBody = {
2621
2695
  };
2622
2696
  };
2623
2697
 
2624
- export { 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 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 Redirect, type RegistrationInput, type RegistrationResult, type ResolvedBlock, SITE_LOCALES, SOCIAL_PLATFORMS, type Seo, type Site, type SiteSettings, type SitemapEntry, type TicketType, type UnknownBlock, type WebhookPayload, blockDataSchemas, blockFeature, blockSchema, blockTypes, customBlockDefinitionSchema, customBlockKey, customFieldSchema, customValuesSchema, embedDocument, formDefinitionSchema, formFieldSchema, pageContentSchema, parseBlocks, parsePageContent, parseSiteSettings, parseTicketTypes, seoSchema, siteSettingsSchema, ticketTypeSchema, ticketTypesSchema, videoEmbedUrl };
2698
+ 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 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 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, type WebhookPayload, blockDataSchemas, blockFeature, blockSchema, blockTypes, customBlockDefinitionSchema, customBlockKey, customFieldSchema, customValuesSchema, embedDocument, formDefinitionSchema, formFieldSchema, pageContentSchema, parseBlocks, parsePageContent, parseSiteSettings, parseTicketTypes, seoSchema, siteSettingsSchema, ticketTypeSchema, ticketTypesSchema, videoEmbedUrl };
package/dist/index.js CHANGED
@@ -306,6 +306,17 @@ var blockDataSchemas = {
306
306
  /** Only events in this category (e.g. "Featured"). */
307
307
  categoryId: z.string().uuid().optional()
308
308
  }),
309
+ /** Events that have ended, most recent first: a talk archive, past events. */
310
+ pastEvents: z.object({
311
+ eyebrow: z.string().optional(),
312
+ heading: z.string().optional(),
313
+ intro: z.string().optional(),
314
+ limit: z.number().int().min(1).max(24).default(6),
315
+ /** Only events in this event collection (e.g. "Talks"); omit for every event. */
316
+ collectionId: z.string().uuid().optional(),
317
+ /** Only events in this category. */
318
+ categoryId: z.string().uuid().optional()
319
+ }),
309
320
  eventSpotlight: z.object({
310
321
  /** Event slug; omit to show the next upcoming event. */
311
322
  eventSlug: z.string().optional(),
@@ -368,6 +379,7 @@ var blockDataSchemas = {
368
379
  var blockTypes = Object.keys(blockDataSchemas);
369
380
  var blockFeature = {
370
381
  upcomingEvents: "events",
382
+ pastEvents: "events",
371
383
  eventSpotlight: "events",
372
384
  fundraiserSpotlight: "giving",
373
385
  fundraiserGrid: "giving",
@@ -580,7 +592,9 @@ var siteSettingsSchema = z2.object({
580
592
  google: z2.string().trim().max(120).regex(/^[A-Za-z0-9_-]*$/, `Paste only the code from the tag's content="\u2026".`).optional(),
581
593
  bing: z2.string().trim().max(120).regex(/^[A-Za-z0-9_-]*$/, `Paste only the code from the tag's content="\u2026".`).optional()
582
594
  }).default({})
583
- }).default({ organizationType: "Organization", locale: "en_US", verification: {} })
595
+ }).default({ organizationType: "Organization", locale: "en_US", verification: {} }),
596
+ /** Built-in visitor analytics (cookieless; included in every plan). On unless the site turns it off. */
597
+ analytics: z2.object({ enabled: z2.boolean().default(true) }).default({ enabled: true })
584
598
  });
585
599
  function parseSiteSettings(input) {
586
600
  const parsed = siteSettingsSchema.safeParse(input ?? {});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@the-smithy/hearth-schema",
3
- "version": "0.16.0",
3
+ "version": "0.18.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",