@the-smithy/hearth-schema 0.17.0 → 0.19.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 +40 -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;
|
|
@@ -2491,6 +2494,8 @@ type DonationInput = {
|
|
|
2491
2494
|
/** Hide the donor's name from public lists. */
|
|
2492
2495
|
anonymous?: boolean;
|
|
2493
2496
|
message?: string;
|
|
2497
|
+
/** The donor ticked "Send me updates about this fundraiser" (off by default; needs `email` and `fundraiser`). */
|
|
2498
|
+
updates?: boolean;
|
|
2494
2499
|
/** Where the payment page sends the donor afterwards (on the site's domain), e.g. https://example.org/donate/thank-you. */
|
|
2495
2500
|
returnUrl: string;
|
|
2496
2501
|
};
|
|
@@ -2597,12 +2602,46 @@ type ResolvedBlock = KnownBlock | UnknownBlock;
|
|
|
2597
2602
|
type BlockOf<T extends Exclude<BlockType, "sharedBlock">> = Extract<KnownBlock, {
|
|
2598
2603
|
type: T;
|
|
2599
2604
|
}>;
|
|
2605
|
+
/** Where a site's tracker sends page views (<HearthAnalytics /> from `@the-smithy/hearth/analytics`). */
|
|
2606
|
+
type SiteAnalytics = {
|
|
2607
|
+
/** The collector's address. */
|
|
2608
|
+
endpoint: string;
|
|
2609
|
+
/** Which property the page views count for (the site's own). Public. */
|
|
2610
|
+
key: string;
|
|
2611
|
+
};
|
|
2612
|
+
/** One row of a top list: a page, source, country… with its numbers. */
|
|
2613
|
+
type AnalyticsRow = {
|
|
2614
|
+
value: string;
|
|
2615
|
+
visitors: number;
|
|
2616
|
+
pageviews: number;
|
|
2617
|
+
events: number;
|
|
2618
|
+
};
|
|
2619
|
+
/** `GET /analytics`: visitor analytics from the daily totals (updated hourly). */
|
|
2620
|
+
type AnalyticsReport = {
|
|
2621
|
+
from: string;
|
|
2622
|
+
to: string;
|
|
2623
|
+
totals: {
|
|
2624
|
+
visitors: number;
|
|
2625
|
+
pageviews: number;
|
|
2626
|
+
events: number;
|
|
2627
|
+
};
|
|
2628
|
+
days: {
|
|
2629
|
+
day: string;
|
|
2630
|
+
visitors: number;
|
|
2631
|
+
pageviews: number;
|
|
2632
|
+
events: number;
|
|
2633
|
+
}[];
|
|
2634
|
+
/** Top values by visitors. `channel` is Direct, Search, Social, Email, Paid or Referral. */
|
|
2635
|
+
top: Partial<Record<"path" | "channel" | "referrer" | "utm_source" | "utm_campaign" | "device" | "country" | "browser" | "event", AnalyticsRow[]>>;
|
|
2636
|
+
};
|
|
2600
2637
|
type Site = {
|
|
2601
2638
|
slug: string;
|
|
2602
2639
|
name: string;
|
|
2603
2640
|
domain: string | null;
|
|
2604
2641
|
features: string[];
|
|
2605
2642
|
settings: SiteSettings;
|
|
2643
|
+
/** Built-in visitor analytics; null when the site has it off. Missing from Hearth versions before analytics. */
|
|
2644
|
+
analytics?: SiteAnalytics | null;
|
|
2606
2645
|
};
|
|
2607
2646
|
type PageSummary = {
|
|
2608
2647
|
slug: string;
|
|
@@ -2658,4 +2697,4 @@ type ApiErrorBody = {
|
|
|
2658
2697
|
};
|
|
2659
2698
|
};
|
|
2660
2699
|
|
|
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 };
|
|
2700
|
+
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 ?? {});
|