@the-smithy/hearth-schema 0.17.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 +38 -1
- package/dist/index.js +3 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -2245,6 +2245,9 @@ declare const siteSettingsSchema: z.ZodObject<{
|
|
|
2245
2245
|
bing: z.ZodOptional<z.ZodString>;
|
|
2246
2246
|
}, z.core.$strip>>;
|
|
2247
2247
|
}, z.core.$strip>>;
|
|
2248
|
+
analytics: z.ZodDefault<z.ZodObject<{
|
|
2249
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
2250
|
+
}, z.core.$strip>>;
|
|
2248
2251
|
}, z.core.$strip>;
|
|
2249
2252
|
type SiteSettings = z.infer<typeof siteSettingsSchema>;
|
|
2250
2253
|
declare function parseSiteSettings(input: unknown): SiteSettings;
|
|
@@ -2597,12 +2600,46 @@ type ResolvedBlock = KnownBlock | UnknownBlock;
|
|
|
2597
2600
|
type BlockOf<T extends Exclude<BlockType, "sharedBlock">> = Extract<KnownBlock, {
|
|
2598
2601
|
type: T;
|
|
2599
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
|
+
};
|
|
2600
2635
|
type Site = {
|
|
2601
2636
|
slug: string;
|
|
2602
2637
|
name: string;
|
|
2603
2638
|
domain: string | null;
|
|
2604
2639
|
features: string[];
|
|
2605
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;
|
|
2606
2643
|
};
|
|
2607
2644
|
type PageSummary = {
|
|
2608
2645
|
slug: string;
|
|
@@ -2658,4 +2695,4 @@ type ApiErrorBody = {
|
|
|
2658
2695
|
};
|
|
2659
2696
|
};
|
|
2660
2697
|
|
|
2661
|
-
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
|
@@ -592,7 +592,9 @@ var siteSettingsSchema = z2.object({
|
|
|
592
592
|
google: z2.string().trim().max(120).regex(/^[A-Za-z0-9_-]*$/, `Paste only the code from the tag's content="\u2026".`).optional(),
|
|
593
593
|
bing: z2.string().trim().max(120).regex(/^[A-Za-z0-9_-]*$/, `Paste only the code from the tag's content="\u2026".`).optional()
|
|
594
594
|
}).default({})
|
|
595
|
-
}).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 })
|
|
596
598
|
});
|
|
597
599
|
function parseSiteSettings(input) {
|
|
598
600
|
const parsed = siteSettingsSchema.safeParse(input ?? {});
|