@the-smithy/hearth 0.22.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/{chunk-RZNKY7HG.js → chunk-QDCU7YWV.js} +12 -0
- package/dist/{client-BXkB1aKA.d.ts → client-Deumm7No.d.ts} +10 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/next.d.ts +3 -1
- package/dist/next.js +3 -1
- package/dist/testing.d.ts +3 -1
- package/dist/testing.js +1 -0
- package/package.json +2 -2
|
@@ -297,6 +297,18 @@ function createCore(options) {
|
|
|
297
297
|
/** Check a preview token from a Hearth preview link. Throws (unauthorized) if it's expired or for another site. */
|
|
298
298
|
verify: (token, o = {}) => request("/preview", { ...o, preview: token, resource: "preview.verify" })
|
|
299
299
|
},
|
|
300
|
+
globalBlocks: {
|
|
301
|
+
/**
|
|
302
|
+
* The site's global blocks (Global blocks in Hearth), resolved: pop-ups (`popup` set), menu dropdowns (a menu
|
|
303
|
+
* item's `dropdown` names one) and any others the site's code places by key. Empty from Hearth versions without them.
|
|
304
|
+
*/
|
|
305
|
+
list: async (o = {}) => await maybe("/global-blocks", { ...o, resource: "globalBlocks.list" }) ?? [],
|
|
306
|
+
/** One global block by key, or null. */
|
|
307
|
+
get: async (key, o = {}) => {
|
|
308
|
+
const list = await maybe("/global-blocks", { ...o, resource: "globalBlocks.list" }) ?? [];
|
|
309
|
+
return list.find((g) => g.key === key) ?? null;
|
|
310
|
+
}
|
|
311
|
+
},
|
|
300
312
|
customBlocks: {
|
|
301
313
|
/** The site's own block types (Custom blocks in Hearth): each one's key, name and fields, for rendering `custom` blocks. */
|
|
302
314
|
list: (o = {}) => request("/custom-blocks", { ...o, resource: "customBlocks.list" })
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Collection, CollectionEntry, HearthEvent, Site, PageSummary, Page, HearthEventDetail, RegistrationInput, RegistrationResult, VolunteerInput, VolunteerResult, CategoryGroup, SitemapEntry, Redirect, AnalyticsReport, Fundraiser, FundraiserDetail, DonationInput, DonationCheckout, HearthForm } from '@the-smithy/hearth-schema';
|
|
1
|
+
import { Collection, CollectionEntry, HearthEvent, Site, PageSummary, Page, HearthEventDetail, RegistrationInput, RegistrationResult, VolunteerInput, VolunteerResult, CategoryGroup, SitemapEntry, Redirect, AnalyticsReport, Fundraiser, FundraiserDetail, DonationInput, DonationCheckout, GlobalBlock, HearthForm } from '@the-smithy/hearth-schema';
|
|
2
2
|
|
|
3
3
|
type HearthErrorCode = "unauthorized" | "not_found" | "bad_request" | "feature_disabled" | "rate_limited" | "server_error" | "network" | "timeout" | "invalid_response";
|
|
4
4
|
/** Any failure talking to Hearth. Messages never contain the API key. */
|
|
@@ -227,6 +227,15 @@ declare function createCore(options: HearthClientOptions): {
|
|
|
227
227
|
/** Check a preview token from a Hearth preview link. Throws (unauthorized) if it's expired or for another site. */
|
|
228
228
|
verify: (token: string, o?: Omit<CallOptions, "preview">) => Promise<PreviewSession>;
|
|
229
229
|
};
|
|
230
|
+
globalBlocks: {
|
|
231
|
+
/**
|
|
232
|
+
* The site's global blocks (Global blocks in Hearth), resolved: pop-ups (`popup` set), menu dropdowns (a menu
|
|
233
|
+
* item's `dropdown` names one) and any others the site's code places by key. Empty from Hearth versions without them.
|
|
234
|
+
*/
|
|
235
|
+
list: (o?: CallOptions) => Promise<GlobalBlock[]>;
|
|
236
|
+
/** One global block by key, or null. */
|
|
237
|
+
get: (key: string, o?: CallOptions) => Promise<GlobalBlock | null>;
|
|
238
|
+
};
|
|
230
239
|
customBlocks: {
|
|
231
240
|
/** The site's own block types (Custom blocks in Hearth): each one's key, name and fields, for rendering `custom` blocks. */
|
|
232
241
|
list: (o?: CallOptions) => Promise<{
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { H as HearthCore, a as HearthClientOptions } from './client-
|
|
2
|
-
export { C as CallOptions, b as CollectionPage, D as DEFAULT_BASE_URL, E as EventCollectionPage, F as FormResult, c as FormValues, d as HearthError, e as HearthErrorCode, f as HearthHooks, N as NextFetchOptions, P as PreviewSession, R as RequestContext, g as RequestOptions, h as findRedirect, i as isHearthError, n as normalizeSlug } from './client-
|
|
3
|
-
export { AnalyticsReport, AnalyticsRow, Block, BlockOf, CategoryGroup, CategoryRef, Collection, CollectionEntry, CollectionRef, DonationCheckout, DonationInput, EntryDetails, EventCustomFields, EventRegistration, EventTicket, EventVolunteerShift, EventVolunteering, Fundraiser, FundraiserDetail, HearthEvent, HearthEventDetail, ImageRef, KnownBlock, Page, PageMeta, PageSummary, Position, Redirect, RegistrationInput, RegistrationResult, ResolvedBlock, Site, SiteAnalytics, SiteSettings, SitemapEntry, UnknownBlock, VolunteerInput, VolunteerResult, WebhookPayload, directionsUrl, focalPosition, pinned, videoEmbedUrl } from '@the-smithy/hearth-schema';
|
|
1
|
+
import { H as HearthCore, a as HearthClientOptions } from './client-Deumm7No.js';
|
|
2
|
+
export { C as CallOptions, b as CollectionPage, D as DEFAULT_BASE_URL, E as EventCollectionPage, F as FormResult, c as FormValues, d as HearthError, e as HearthErrorCode, f as HearthHooks, N as NextFetchOptions, P as PreviewSession, R as RequestContext, g as RequestOptions, h as findRedirect, i as isHearthError, n as normalizeSlug } from './client-Deumm7No.js';
|
|
3
|
+
export { AnalyticsReport, AnalyticsRow, Block, BlockOf, CategoryGroup, CategoryRef, Collection, CollectionEntry, CollectionRef, DonationCheckout, DonationInput, EntryDetails, EventCustomFields, EventRegistration, EventTicket, EventVolunteerShift, EventVolunteering, Fundraiser, FundraiserDetail, GlobalBlock, GlobalPopup, HearthEvent, HearthEventDetail, ImageRef, KnownBlock, Page, PageMeta, PageSummary, Position, Redirect, RegistrationInput, RegistrationResult, ResolvedBlock, SharedFrom, Site, SiteAnalytics, SiteSettings, SitemapEntry, UnknownBlock, VolunteerInput, VolunteerResult, WebhookPayload, directionsUrl, focalPosition, pinned, videoEmbedUrl } from '@the-smithy/hearth-schema';
|
|
4
4
|
|
|
5
5
|
/** A plugin adds resources (and can use the core's `request`) under its own names. */
|
|
6
6
|
type HearthPlugin<T extends object = object> = {
|
package/dist/index.js
CHANGED
package/dist/next.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { H as HearthCore, b as CollectionPage, E as EventCollectionPage, F as FormResult, c as FormValues } from './client-
|
|
1
|
+
import { H as HearthCore, b as CollectionPage, E as EventCollectionPage, F as FormResult, c as FormValues } from './client-Deumm7No.js';
|
|
2
2
|
import * as _the_smithy_hearth_schema from '@the-smithy/hearth-schema';
|
|
3
3
|
import { Site, PageMeta } from '@the-smithy/hearth-schema';
|
|
4
4
|
import { Metadata, MetadataRoute } from 'next';
|
|
@@ -170,6 +170,8 @@ declare function createHearthNext(client: HearthCore, { tag, revalidate }?: Hear
|
|
|
170
170
|
optional?: boolean | undefined;
|
|
171
171
|
})[];
|
|
172
172
|
}[]>;
|
|
173
|
+
/** Global blocks (pop-ups, menu dropdowns, ones the site places by key); drafts while previewing. */
|
|
174
|
+
getGlobalBlocks: () => Promise<_the_smithy_hearth_schema.GlobalBlock[]>;
|
|
173
175
|
getCollections: () => Promise<_the_smithy_hearth_schema.Collection[]>;
|
|
174
176
|
getCollection: (slug: string, opts?: {
|
|
175
177
|
limit?: number;
|
package/dist/next.js
CHANGED
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
findRedirect,
|
|
3
3
|
isHearthError,
|
|
4
4
|
normalizeSlug
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-QDCU7YWV.js";
|
|
6
6
|
import {
|
|
7
7
|
parseWebhook,
|
|
8
8
|
tagsForWebhook
|
|
@@ -60,6 +60,8 @@ function createHearthNext(client, { tag = "hearth", revalidate = 3600 } = {}) {
|
|
|
60
60
|
getEvents: (opts) => client.events.list(opts, tags(`${tag}:events`)),
|
|
61
61
|
getCategories: () => client.categories.list(tags(`${tag}:site`)),
|
|
62
62
|
getCustomBlocks: () => client.customBlocks.list(tags(`${tag}:site`)),
|
|
63
|
+
/** Global blocks (pop-ups, menu dropdowns, ones the site places by key); drafts while previewing. */
|
|
64
|
+
getGlobalBlocks: async () => client.globalBlocks.list(await read(`${tag}:global`)),
|
|
63
65
|
getCollections: () => client.collections.list(tags(`${tag}:site`, `${tag}:pages`)),
|
|
64
66
|
getCollection: (slug, opts) => client.collections.get(slug, opts, tags(`${tag}:pages`, `${tag}:events`)),
|
|
65
67
|
getEvent: async (slug) => client.events.get(slug, await read(`${tag}:events`)),
|
package/dist/testing.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Site, Page, HearthEvent, HearthEventDetail, SitemapEntry, Redirect, Collection, CollectionEntry, CategoryGroup, Fundraiser, FundraiserDetail, HearthForm } from '@the-smithy/hearth-schema';
|
|
1
|
+
import { Site, Page, HearthEvent, HearthEventDetail, SitemapEntry, Redirect, GlobalBlock, Collection, CollectionEntry, CategoryGroup, Fundraiser, FundraiserDetail, HearthForm } from '@the-smithy/hearth-schema';
|
|
2
2
|
|
|
3
3
|
type MockHearthData = {
|
|
4
4
|
site?: Partial<Site>;
|
|
@@ -8,6 +8,8 @@ type MockHearthData = {
|
|
|
8
8
|
/** The site's llms.txt; null (the default) is a site without one. */
|
|
9
9
|
llmsTxt?: string | null;
|
|
10
10
|
redirects?: Redirect[];
|
|
11
|
+
/** The site's global blocks (pop-ups, menu dropdowns). */
|
|
12
|
+
globalBlocks?: GlobalBlock[];
|
|
11
13
|
/** Collections, with their entries (page collections) keyed by collection slug. */
|
|
12
14
|
collections?: Collection[];
|
|
13
15
|
entries?: Record<string, CollectionEntry[]>;
|
package/dist/testing.js
CHANGED
|
@@ -48,6 +48,7 @@ function createMockHearth(data = {}) {
|
|
|
48
48
|
if (rest === "/sitemap") return json({ data: data.sitemap ?? [] });
|
|
49
49
|
if (rest === "/llms") return json({ data: data.llmsTxt ?? null });
|
|
50
50
|
if (rest === "/redirects") return json({ data: data.redirects ?? [] });
|
|
51
|
+
if (rest === "/global-blocks") return json({ data: data.globalBlocks ?? [] });
|
|
51
52
|
if (rest === "/fundraisers" || rest.startsWith("/fundraisers?")) {
|
|
52
53
|
const status = url.searchParams.get("status") ?? "active";
|
|
53
54
|
return json({ data: (data.fundraisers ?? []).filter((f) => status === "all" || f.status === status) });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@the-smithy/hearth",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.23.0",
|
|
4
4
|
"description": "Typed client for the Hearth Delivery API: content, SEO, forms and publish webhooks.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"llms.md"
|
|
50
50
|
],
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@the-smithy/hearth-schema": "^0.
|
|
52
|
+
"@the-smithy/hearth-schema": "^0.23.0"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"next": ">=15",
|