@reblu/site-blocks 0.8.0 → 0.10.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/CHANGELOG.md +32 -0
- package/README.md +147 -1
- package/dist/index.cjs +490 -150
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +138 -12
- package/dist/index.d.ts +138 -12
- package/dist/index.js +486 -151
- package/dist/index.js.map +1 -1
- package/dist/seo.cjs +59 -0
- package/dist/seo.cjs.map +1 -0
- package/dist/seo.d.cts +47 -0
- package/dist/seo.d.ts +47 -0
- package/dist/seo.js +31 -0
- package/dist/seo.js.map +1 -0
- package/package.json +14 -4
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { ShopErrorCode, PageDetail, PageListItem, ShopProductListItem, ShopFacets, ShopOrder } from '@reblu/site-contracts';
|
|
1
|
+
import { ShopErrorCode, PageDetail, PageListItem, ShopProductListItem, BlockType, PageBlock, ResolvedEmbed, ShopFacets, ShopOrder } from '@reblu/site-contracts';
|
|
2
|
+
import { FaqItem } from './seo.cjs';
|
|
3
|
+
export { FaqPageJsonLd, buildFaqPageJsonLd, collectFaqItems } from './seo.cjs';
|
|
2
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
-
import { ReactNode, FormEvent } from 'react';
|
|
5
|
+
import { ComponentType, ReactNode, FormEvent } from 'react';
|
|
4
6
|
|
|
5
7
|
declare function readingTime(content: string | null | undefined): number | null;
|
|
6
8
|
|
|
@@ -250,22 +252,50 @@ interface TreatmentProps {
|
|
|
250
252
|
declare function Treatment({ page, className }: TreatmentProps): react_jsx_runtime.JSX.Element;
|
|
251
253
|
|
|
252
254
|
/**
|
|
253
|
-
* `
|
|
254
|
-
* renders a hero and content sections,
|
|
255
|
-
*
|
|
256
|
-
*
|
|
255
|
+
* `ParentPage` — page organism over a `PageDetail` that groups other pages. Like
|
|
256
|
+
* `Treatment` it renders a hero and content sections, then an optional linked
|
|
257
|
+
* grid of its child pages (cover image, title, excerpt). Token-driven, RSC-safe.
|
|
258
|
+
*
|
|
259
|
+
* REB-853: formerly `Specialty`, which remains a deprecated alias.
|
|
257
260
|
*/
|
|
258
|
-
interface
|
|
261
|
+
interface ParentPageProps {
|
|
259
262
|
page: PageDetail;
|
|
260
|
-
/**
|
|
263
|
+
/** Child pages under this page. Rendered as a linked grid when present. */
|
|
264
|
+
childPages?: PageListItem[];
|
|
265
|
+
/** Builds the href for a child page from its slug. Defaults to `/{slug}`. */
|
|
266
|
+
childPageHref?: (slug: string) => string;
|
|
267
|
+
/** Heading for the child-pages grid. Defaults to "Treatments" (unchanged from `Specialty`). */
|
|
268
|
+
childPagesLabel?: string;
|
|
269
|
+
/**
|
|
270
|
+
* @deprecated Use `childPages`. Removed in the next major, not before 2027-03-31.
|
|
271
|
+
* Ignored when `childPages` is passed.
|
|
272
|
+
*/
|
|
261
273
|
treatments?: PageListItem[];
|
|
262
|
-
/**
|
|
274
|
+
/**
|
|
275
|
+
* @deprecated Use `childPageHref`. Removed in the next major, not before 2027-03-31.
|
|
276
|
+
* Ignored when `childPageHref` is passed.
|
|
277
|
+
*/
|
|
263
278
|
treatmentHref?: (slug: string) => string;
|
|
264
|
-
/**
|
|
279
|
+
/**
|
|
280
|
+
* @deprecated Use `childPagesLabel`. Removed in the next major, not before 2027-03-31.
|
|
281
|
+
* Ignored when `childPagesLabel` is passed.
|
|
282
|
+
*/
|
|
265
283
|
treatmentsLabel?: string;
|
|
266
284
|
className?: string;
|
|
267
285
|
}
|
|
268
|
-
declare function
|
|
286
|
+
declare function ParentPage({ page, childPages, childPageHref, childPagesLabel, treatments, treatmentHref, treatmentsLabel, className, }: ParentPageProps): react_jsx_runtime.JSX.Element;
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* @deprecated Renamed to `ParentPage` (REB-853) — the SDK is niche-agnostic.
|
|
290
|
+
* Removed in the next major, not before 2027-03-31.
|
|
291
|
+
* Same reference as `ParentPage`, not a copy.
|
|
292
|
+
*/
|
|
293
|
+
declare const Specialty: typeof ParentPage;
|
|
294
|
+
/**
|
|
295
|
+
* @deprecated Renamed to `ParentPageProps` (REB-853).
|
|
296
|
+
* Removed in the next major, not before 2027-03-31.
|
|
297
|
+
*/
|
|
298
|
+
type SpecialtyProps = ParentPageProps;
|
|
269
299
|
|
|
270
300
|
/**
|
|
271
301
|
* `ProfileCard` — presentational professional/team-member card (the clinic
|
|
@@ -302,6 +332,102 @@ interface ProductCardProps {
|
|
|
302
332
|
}
|
|
303
333
|
declare function ProductCard({ product, href, currencyCode, locale, className }: ProductCardProps): react_jsx_runtime.JSX.Element;
|
|
304
334
|
|
|
335
|
+
/** A heading level a caller can configure — `h1`…`h6`. */
|
|
336
|
+
type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* REB-850 — accessible FAQ list on native `<details>`/`<summary>`.
|
|
340
|
+
*
|
|
341
|
+
* A Server Component: no hooks, no `'use client'`, no JavaScript needed to
|
|
342
|
+
* open or close an item — the browser owns the disclosure state, keyboard
|
|
343
|
+
* support and the expanded/collapsed semantics. Answers render as TEXT (React
|
|
344
|
+
* escapes them; line breaks are preserved), never as markup.
|
|
345
|
+
*
|
|
346
|
+
* Pair it with `buildFaqPageJsonLd` (`@reblu/site-blocks/seo`) for the
|
|
347
|
+
* matching schema.org `FAQPage` structured data.
|
|
348
|
+
*/
|
|
349
|
+
interface FaqAccordionProps {
|
|
350
|
+
items: readonly FaqItem[];
|
|
351
|
+
/** Optional heading above the list. */
|
|
352
|
+
heading?: string | null;
|
|
353
|
+
/** Level of `heading`. Default `2`. */
|
|
354
|
+
headingLevel?: HeadingLevel;
|
|
355
|
+
/**
|
|
356
|
+
* When set, each question is wrapped in `<h{level}>` inside its `<summary>`
|
|
357
|
+
* so it appears in the document outline. Default: plain summary text.
|
|
358
|
+
*/
|
|
359
|
+
questionHeadingLevel?: HeadingLevel;
|
|
360
|
+
/** Indexes of the items rendered open initially. */
|
|
361
|
+
defaultOpen?: readonly number[];
|
|
362
|
+
className?: string;
|
|
363
|
+
}
|
|
364
|
+
declare function FaqAccordion({ items, heading, headingLevel, questionHeadingLevel, defaultOpen, className, }: FaqAccordionProps): react_jsx_runtime.JSX.Element | null;
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* REB-850 — `PageBlocks`: the shared renderer for a page's registry blocks
|
|
368
|
+
* (`PageDetail.blocks`, REB-75), so a SITE stops hand-writing its own.
|
|
369
|
+
*
|
|
370
|
+
* A SERVER COMPONENT by default: no hooks, no `'use client'`, reachable from the
|
|
371
|
+
* RSC-safe root entry (`test/rsc-safety.test.ts` renders it under
|
|
372
|
+
* `--conditions=react-server`).
|
|
373
|
+
*
|
|
374
|
+
* Each block is wrapped in a `<section>` carrying the parent section's
|
|
375
|
+
* mirrored fields (REB-849): `heading`, `backgroundColor` and `cta`. The body
|
|
376
|
+
* comes from a per-type renderer that the `components` map can replace.
|
|
377
|
+
*
|
|
378
|
+
* Fail-closed rules:
|
|
379
|
+
* • an unknown `blockType` renders nothing (the whole section) and never throws;
|
|
380
|
+
* • an embed whose `resolved` is `null`/absent renders nothing — no heading,
|
|
381
|
+
* no dead link;
|
|
382
|
+
* • deprecated alias types (`doctor_embed`, `specialty_embed` — REB-852)
|
|
383
|
+
* render through their generic type's renderer (`profile_embed`, `page_embed`).
|
|
384
|
+
*/
|
|
385
|
+
type DeprecatedAlias = 'doctor_embed' | 'specialty_embed';
|
|
386
|
+
/** Block types a renderer is registered under — deprecated aliases resolve to these. */
|
|
387
|
+
type CanonicalBlockType = Exclude<BlockType, DeprecatedAlias>;
|
|
388
|
+
type EmbedType = 'page_embed' | 'profile_embed';
|
|
389
|
+
type WireTypesOf<T extends CanonicalBlockType> = T extends 'profile_embed' ? 'profile_embed' | 'doctor_embed' : T extends 'page_embed' ? 'page_embed' | 'specialty_embed' : T;
|
|
390
|
+
/**
|
|
391
|
+
* The block a renderer for `T` receives — including its deprecated alias, and
|
|
392
|
+
* with `resolved` guaranteed non-null for embeds (unresolved ones never render).
|
|
393
|
+
*/
|
|
394
|
+
type RenderableBlock<T extends CanonicalBlockType> = T extends EmbedType ? Extract<PageBlock, {
|
|
395
|
+
blockType: WireTypesOf<T>;
|
|
396
|
+
}> & {
|
|
397
|
+
resolved: ResolvedEmbed;
|
|
398
|
+
} : Extract<PageBlock, {
|
|
399
|
+
blockType: WireTypesOf<T>;
|
|
400
|
+
}>;
|
|
401
|
+
interface BlockRendererProps<T extends CanonicalBlockType> {
|
|
402
|
+
block: RenderableBlock<T>;
|
|
403
|
+
/** Level for headings INSIDE the block — one below the section heading when there is one. */
|
|
404
|
+
headingLevel: HeadingLevel;
|
|
405
|
+
/** Builds an embed's href (the `embedHref` prop, or the default `/${slug}`). */
|
|
406
|
+
embedHref: (resolved: ResolvedEmbed) => string;
|
|
407
|
+
}
|
|
408
|
+
/** Per-block-type renderer overrides, keyed by canonical type. */
|
|
409
|
+
type PageBlocksComponents = Partial<{
|
|
410
|
+
[T in CanonicalBlockType]: ComponentType<BlockRendererProps<T>>;
|
|
411
|
+
}>;
|
|
412
|
+
interface PageBlocksProps {
|
|
413
|
+
blocks: readonly PageBlock[] | null | undefined;
|
|
414
|
+
/** Replace the body renderer of any block type. */
|
|
415
|
+
components?: PageBlocksComponents;
|
|
416
|
+
/** Level of each section heading. Default `2` (the page title is the `h1`). */
|
|
417
|
+
headingLevel?: HeadingLevel;
|
|
418
|
+
/** Href for an embedded page. Default `/${resolved.slug}`. */
|
|
419
|
+
embedHref?: (resolved: ResolvedEmbed) => string;
|
|
420
|
+
/**
|
|
421
|
+
* Namespace for the section heading ids (`aria-labelledby` targets). Pass a
|
|
422
|
+
* distinct value when one document renders `PageBlocks` more than once with
|
|
423
|
+
* overlapping blocks. Sanitised to a valid IDREF. Default `'page-block'`.
|
|
424
|
+
*/
|
|
425
|
+
idPrefix?: string;
|
|
426
|
+
className?: string;
|
|
427
|
+
sectionClassName?: string;
|
|
428
|
+
}
|
|
429
|
+
declare function PageBlocks({ blocks, components, headingLevel, embedHref, idPrefix, className, sectionClassName, }: PageBlocksProps): react_jsx_runtime.JSX.Element | null;
|
|
430
|
+
|
|
305
431
|
/**
|
|
306
432
|
* `ShopFilters` — plug-and-play SITE filter chrome over `GET /api/site/shop/facets`
|
|
307
433
|
* (REB-809). Which axes appear, their order and labels come entirely from
|
|
@@ -740,4 +866,4 @@ interface OrderConfirmationProps {
|
|
|
740
866
|
}
|
|
741
867
|
declare function OrderConfirmation({ status, order, sessionId, cartHref, onRecheck, labels, currencyCode, locale, className, }: OrderConfirmationProps): react_jsx_runtime.JSX.Element;
|
|
742
868
|
|
|
743
|
-
export { ALLOWED_YOUTUBE_HOSTS, AddedToCartToast, type AddedToCartToastLabels, type AddedToCartToastProps, type AddedToCartToastStatus, type CartLineItemView, CartLineList, type CartLineListLabels, type CartLineListProps, CartSummary, type CartSummaryLabels, type CartSummaryProps, type CheckoutAppliedDiscount, type CheckoutContactErrors, type CheckoutContactValues, CheckoutForm, type CheckoutFormLabels, type CheckoutFormProps, CheckoutLoginPrompt, type CheckoutLoginPromptLabels, type CheckoutLoginPromptProps, DEFAULT_SHOP_ERROR_FALLBACK_MESSAGE, DEFAULT_SHOP_ERROR_MESSAGES, DEFAULT_SHOP_PRICE_BANDS, MarkdownRenderer, type MarkdownRendererProps, OrderConfirmation, type OrderConfirmationLabels, type OrderConfirmationOrder, type OrderConfirmationProps, type OrderConfirmationStatus, ProductCard, type ProductCardProps, ProfileCard, type ProfileCardProps, SafeHtml, type SafeHtmlProps, type ShareUrls, type ShopFilterPriceBand, ShopFilters, type ShopFiltersActive, type ShopFiltersHrefs, type ShopFiltersLabels, type ShopFiltersProps, Specialty, type SpecialtyProps, Treatment, type TreatmentProps, buildShareUrls, formatPrice, getShopErrorMessage, isAllowedYouTubeHost, markdownToSafeHtml, readingTime, sanitizeHtml, shouldRenderShopFilters };
|
|
869
|
+
export { ALLOWED_YOUTUBE_HOSTS, AddedToCartToast, type AddedToCartToastLabels, type AddedToCartToastProps, type AddedToCartToastStatus, type BlockRendererProps, type CanonicalBlockType, type CartLineItemView, CartLineList, type CartLineListLabels, type CartLineListProps, CartSummary, type CartSummaryLabels, type CartSummaryProps, type CheckoutAppliedDiscount, type CheckoutContactErrors, type CheckoutContactValues, CheckoutForm, type CheckoutFormLabels, type CheckoutFormProps, CheckoutLoginPrompt, type CheckoutLoginPromptLabels, type CheckoutLoginPromptProps, DEFAULT_SHOP_ERROR_FALLBACK_MESSAGE, DEFAULT_SHOP_ERROR_MESSAGES, DEFAULT_SHOP_PRICE_BANDS, FaqAccordion, type FaqAccordionProps, FaqItem, type HeadingLevel, MarkdownRenderer, type MarkdownRendererProps, OrderConfirmation, type OrderConfirmationLabels, type OrderConfirmationOrder, type OrderConfirmationProps, type OrderConfirmationStatus, PageBlocks, type PageBlocksComponents, type PageBlocksProps, ParentPage, type ParentPageProps, ProductCard, type ProductCardProps, ProfileCard, type ProfileCardProps, type RenderableBlock, SafeHtml, type SafeHtmlProps, type ShareUrls, type ShopFilterPriceBand, ShopFilters, type ShopFiltersActive, type ShopFiltersHrefs, type ShopFiltersLabels, type ShopFiltersProps, Specialty, type SpecialtyProps, Treatment, type TreatmentProps, buildShareUrls, formatPrice, getShopErrorMessage, isAllowedYouTubeHost, markdownToSafeHtml, readingTime, sanitizeHtml, shouldRenderShopFilters };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { ShopErrorCode, PageDetail, PageListItem, ShopProductListItem, ShopFacets, ShopOrder } from '@reblu/site-contracts';
|
|
1
|
+
import { ShopErrorCode, PageDetail, PageListItem, ShopProductListItem, BlockType, PageBlock, ResolvedEmbed, ShopFacets, ShopOrder } from '@reblu/site-contracts';
|
|
2
|
+
import { FaqItem } from './seo.js';
|
|
3
|
+
export { FaqPageJsonLd, buildFaqPageJsonLd, collectFaqItems } from './seo.js';
|
|
2
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
-
import { ReactNode, FormEvent } from 'react';
|
|
5
|
+
import { ComponentType, ReactNode, FormEvent } from 'react';
|
|
4
6
|
|
|
5
7
|
declare function readingTime(content: string | null | undefined): number | null;
|
|
6
8
|
|
|
@@ -250,22 +252,50 @@ interface TreatmentProps {
|
|
|
250
252
|
declare function Treatment({ page, className }: TreatmentProps): react_jsx_runtime.JSX.Element;
|
|
251
253
|
|
|
252
254
|
/**
|
|
253
|
-
* `
|
|
254
|
-
* renders a hero and content sections,
|
|
255
|
-
*
|
|
256
|
-
*
|
|
255
|
+
* `ParentPage` — page organism over a `PageDetail` that groups other pages. Like
|
|
256
|
+
* `Treatment` it renders a hero and content sections, then an optional linked
|
|
257
|
+
* grid of its child pages (cover image, title, excerpt). Token-driven, RSC-safe.
|
|
258
|
+
*
|
|
259
|
+
* REB-853: formerly `Specialty`, which remains a deprecated alias.
|
|
257
260
|
*/
|
|
258
|
-
interface
|
|
261
|
+
interface ParentPageProps {
|
|
259
262
|
page: PageDetail;
|
|
260
|
-
/**
|
|
263
|
+
/** Child pages under this page. Rendered as a linked grid when present. */
|
|
264
|
+
childPages?: PageListItem[];
|
|
265
|
+
/** Builds the href for a child page from its slug. Defaults to `/{slug}`. */
|
|
266
|
+
childPageHref?: (slug: string) => string;
|
|
267
|
+
/** Heading for the child-pages grid. Defaults to "Treatments" (unchanged from `Specialty`). */
|
|
268
|
+
childPagesLabel?: string;
|
|
269
|
+
/**
|
|
270
|
+
* @deprecated Use `childPages`. Removed in the next major, not before 2027-03-31.
|
|
271
|
+
* Ignored when `childPages` is passed.
|
|
272
|
+
*/
|
|
261
273
|
treatments?: PageListItem[];
|
|
262
|
-
/**
|
|
274
|
+
/**
|
|
275
|
+
* @deprecated Use `childPageHref`. Removed in the next major, not before 2027-03-31.
|
|
276
|
+
* Ignored when `childPageHref` is passed.
|
|
277
|
+
*/
|
|
263
278
|
treatmentHref?: (slug: string) => string;
|
|
264
|
-
/**
|
|
279
|
+
/**
|
|
280
|
+
* @deprecated Use `childPagesLabel`. Removed in the next major, not before 2027-03-31.
|
|
281
|
+
* Ignored when `childPagesLabel` is passed.
|
|
282
|
+
*/
|
|
265
283
|
treatmentsLabel?: string;
|
|
266
284
|
className?: string;
|
|
267
285
|
}
|
|
268
|
-
declare function
|
|
286
|
+
declare function ParentPage({ page, childPages, childPageHref, childPagesLabel, treatments, treatmentHref, treatmentsLabel, className, }: ParentPageProps): react_jsx_runtime.JSX.Element;
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* @deprecated Renamed to `ParentPage` (REB-853) — the SDK is niche-agnostic.
|
|
290
|
+
* Removed in the next major, not before 2027-03-31.
|
|
291
|
+
* Same reference as `ParentPage`, not a copy.
|
|
292
|
+
*/
|
|
293
|
+
declare const Specialty: typeof ParentPage;
|
|
294
|
+
/**
|
|
295
|
+
* @deprecated Renamed to `ParentPageProps` (REB-853).
|
|
296
|
+
* Removed in the next major, not before 2027-03-31.
|
|
297
|
+
*/
|
|
298
|
+
type SpecialtyProps = ParentPageProps;
|
|
269
299
|
|
|
270
300
|
/**
|
|
271
301
|
* `ProfileCard` — presentational professional/team-member card (the clinic
|
|
@@ -302,6 +332,102 @@ interface ProductCardProps {
|
|
|
302
332
|
}
|
|
303
333
|
declare function ProductCard({ product, href, currencyCode, locale, className }: ProductCardProps): react_jsx_runtime.JSX.Element;
|
|
304
334
|
|
|
335
|
+
/** A heading level a caller can configure — `h1`…`h6`. */
|
|
336
|
+
type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* REB-850 — accessible FAQ list on native `<details>`/`<summary>`.
|
|
340
|
+
*
|
|
341
|
+
* A Server Component: no hooks, no `'use client'`, no JavaScript needed to
|
|
342
|
+
* open or close an item — the browser owns the disclosure state, keyboard
|
|
343
|
+
* support and the expanded/collapsed semantics. Answers render as TEXT (React
|
|
344
|
+
* escapes them; line breaks are preserved), never as markup.
|
|
345
|
+
*
|
|
346
|
+
* Pair it with `buildFaqPageJsonLd` (`@reblu/site-blocks/seo`) for the
|
|
347
|
+
* matching schema.org `FAQPage` structured data.
|
|
348
|
+
*/
|
|
349
|
+
interface FaqAccordionProps {
|
|
350
|
+
items: readonly FaqItem[];
|
|
351
|
+
/** Optional heading above the list. */
|
|
352
|
+
heading?: string | null;
|
|
353
|
+
/** Level of `heading`. Default `2`. */
|
|
354
|
+
headingLevel?: HeadingLevel;
|
|
355
|
+
/**
|
|
356
|
+
* When set, each question is wrapped in `<h{level}>` inside its `<summary>`
|
|
357
|
+
* so it appears in the document outline. Default: plain summary text.
|
|
358
|
+
*/
|
|
359
|
+
questionHeadingLevel?: HeadingLevel;
|
|
360
|
+
/** Indexes of the items rendered open initially. */
|
|
361
|
+
defaultOpen?: readonly number[];
|
|
362
|
+
className?: string;
|
|
363
|
+
}
|
|
364
|
+
declare function FaqAccordion({ items, heading, headingLevel, questionHeadingLevel, defaultOpen, className, }: FaqAccordionProps): react_jsx_runtime.JSX.Element | null;
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* REB-850 — `PageBlocks`: the shared renderer for a page's registry blocks
|
|
368
|
+
* (`PageDetail.blocks`, REB-75), so a SITE stops hand-writing its own.
|
|
369
|
+
*
|
|
370
|
+
* A SERVER COMPONENT by default: no hooks, no `'use client'`, reachable from the
|
|
371
|
+
* RSC-safe root entry (`test/rsc-safety.test.ts` renders it under
|
|
372
|
+
* `--conditions=react-server`).
|
|
373
|
+
*
|
|
374
|
+
* Each block is wrapped in a `<section>` carrying the parent section's
|
|
375
|
+
* mirrored fields (REB-849): `heading`, `backgroundColor` and `cta`. The body
|
|
376
|
+
* comes from a per-type renderer that the `components` map can replace.
|
|
377
|
+
*
|
|
378
|
+
* Fail-closed rules:
|
|
379
|
+
* • an unknown `blockType` renders nothing (the whole section) and never throws;
|
|
380
|
+
* • an embed whose `resolved` is `null`/absent renders nothing — no heading,
|
|
381
|
+
* no dead link;
|
|
382
|
+
* • deprecated alias types (`doctor_embed`, `specialty_embed` — REB-852)
|
|
383
|
+
* render through their generic type's renderer (`profile_embed`, `page_embed`).
|
|
384
|
+
*/
|
|
385
|
+
type DeprecatedAlias = 'doctor_embed' | 'specialty_embed';
|
|
386
|
+
/** Block types a renderer is registered under — deprecated aliases resolve to these. */
|
|
387
|
+
type CanonicalBlockType = Exclude<BlockType, DeprecatedAlias>;
|
|
388
|
+
type EmbedType = 'page_embed' | 'profile_embed';
|
|
389
|
+
type WireTypesOf<T extends CanonicalBlockType> = T extends 'profile_embed' ? 'profile_embed' | 'doctor_embed' : T extends 'page_embed' ? 'page_embed' | 'specialty_embed' : T;
|
|
390
|
+
/**
|
|
391
|
+
* The block a renderer for `T` receives — including its deprecated alias, and
|
|
392
|
+
* with `resolved` guaranteed non-null for embeds (unresolved ones never render).
|
|
393
|
+
*/
|
|
394
|
+
type RenderableBlock<T extends CanonicalBlockType> = T extends EmbedType ? Extract<PageBlock, {
|
|
395
|
+
blockType: WireTypesOf<T>;
|
|
396
|
+
}> & {
|
|
397
|
+
resolved: ResolvedEmbed;
|
|
398
|
+
} : Extract<PageBlock, {
|
|
399
|
+
blockType: WireTypesOf<T>;
|
|
400
|
+
}>;
|
|
401
|
+
interface BlockRendererProps<T extends CanonicalBlockType> {
|
|
402
|
+
block: RenderableBlock<T>;
|
|
403
|
+
/** Level for headings INSIDE the block — one below the section heading when there is one. */
|
|
404
|
+
headingLevel: HeadingLevel;
|
|
405
|
+
/** Builds an embed's href (the `embedHref` prop, or the default `/${slug}`). */
|
|
406
|
+
embedHref: (resolved: ResolvedEmbed) => string;
|
|
407
|
+
}
|
|
408
|
+
/** Per-block-type renderer overrides, keyed by canonical type. */
|
|
409
|
+
type PageBlocksComponents = Partial<{
|
|
410
|
+
[T in CanonicalBlockType]: ComponentType<BlockRendererProps<T>>;
|
|
411
|
+
}>;
|
|
412
|
+
interface PageBlocksProps {
|
|
413
|
+
blocks: readonly PageBlock[] | null | undefined;
|
|
414
|
+
/** Replace the body renderer of any block type. */
|
|
415
|
+
components?: PageBlocksComponents;
|
|
416
|
+
/** Level of each section heading. Default `2` (the page title is the `h1`). */
|
|
417
|
+
headingLevel?: HeadingLevel;
|
|
418
|
+
/** Href for an embedded page. Default `/${resolved.slug}`. */
|
|
419
|
+
embedHref?: (resolved: ResolvedEmbed) => string;
|
|
420
|
+
/**
|
|
421
|
+
* Namespace for the section heading ids (`aria-labelledby` targets). Pass a
|
|
422
|
+
* distinct value when one document renders `PageBlocks` more than once with
|
|
423
|
+
* overlapping blocks. Sanitised to a valid IDREF. Default `'page-block'`.
|
|
424
|
+
*/
|
|
425
|
+
idPrefix?: string;
|
|
426
|
+
className?: string;
|
|
427
|
+
sectionClassName?: string;
|
|
428
|
+
}
|
|
429
|
+
declare function PageBlocks({ blocks, components, headingLevel, embedHref, idPrefix, className, sectionClassName, }: PageBlocksProps): react_jsx_runtime.JSX.Element | null;
|
|
430
|
+
|
|
305
431
|
/**
|
|
306
432
|
* `ShopFilters` — plug-and-play SITE filter chrome over `GET /api/site/shop/facets`
|
|
307
433
|
* (REB-809). Which axes appear, their order and labels come entirely from
|
|
@@ -740,4 +866,4 @@ interface OrderConfirmationProps {
|
|
|
740
866
|
}
|
|
741
867
|
declare function OrderConfirmation({ status, order, sessionId, cartHref, onRecheck, labels, currencyCode, locale, className, }: OrderConfirmationProps): react_jsx_runtime.JSX.Element;
|
|
742
868
|
|
|
743
|
-
export { ALLOWED_YOUTUBE_HOSTS, AddedToCartToast, type AddedToCartToastLabels, type AddedToCartToastProps, type AddedToCartToastStatus, type CartLineItemView, CartLineList, type CartLineListLabels, type CartLineListProps, CartSummary, type CartSummaryLabels, type CartSummaryProps, type CheckoutAppliedDiscount, type CheckoutContactErrors, type CheckoutContactValues, CheckoutForm, type CheckoutFormLabels, type CheckoutFormProps, CheckoutLoginPrompt, type CheckoutLoginPromptLabels, type CheckoutLoginPromptProps, DEFAULT_SHOP_ERROR_FALLBACK_MESSAGE, DEFAULT_SHOP_ERROR_MESSAGES, DEFAULT_SHOP_PRICE_BANDS, MarkdownRenderer, type MarkdownRendererProps, OrderConfirmation, type OrderConfirmationLabels, type OrderConfirmationOrder, type OrderConfirmationProps, type OrderConfirmationStatus, ProductCard, type ProductCardProps, ProfileCard, type ProfileCardProps, SafeHtml, type SafeHtmlProps, type ShareUrls, type ShopFilterPriceBand, ShopFilters, type ShopFiltersActive, type ShopFiltersHrefs, type ShopFiltersLabels, type ShopFiltersProps, Specialty, type SpecialtyProps, Treatment, type TreatmentProps, buildShareUrls, formatPrice, getShopErrorMessage, isAllowedYouTubeHost, markdownToSafeHtml, readingTime, sanitizeHtml, shouldRenderShopFilters };
|
|
869
|
+
export { ALLOWED_YOUTUBE_HOSTS, AddedToCartToast, type AddedToCartToastLabels, type AddedToCartToastProps, type AddedToCartToastStatus, type BlockRendererProps, type CanonicalBlockType, type CartLineItemView, CartLineList, type CartLineListLabels, type CartLineListProps, CartSummary, type CartSummaryLabels, type CartSummaryProps, type CheckoutAppliedDiscount, type CheckoutContactErrors, type CheckoutContactValues, CheckoutForm, type CheckoutFormLabels, type CheckoutFormProps, CheckoutLoginPrompt, type CheckoutLoginPromptLabels, type CheckoutLoginPromptProps, DEFAULT_SHOP_ERROR_FALLBACK_MESSAGE, DEFAULT_SHOP_ERROR_MESSAGES, DEFAULT_SHOP_PRICE_BANDS, FaqAccordion, type FaqAccordionProps, FaqItem, type HeadingLevel, MarkdownRenderer, type MarkdownRendererProps, OrderConfirmation, type OrderConfirmationLabels, type OrderConfirmationOrder, type OrderConfirmationProps, type OrderConfirmationStatus, PageBlocks, type PageBlocksComponents, type PageBlocksProps, ParentPage, type ParentPageProps, ProductCard, type ProductCardProps, ProfileCard, type ProfileCardProps, type RenderableBlock, SafeHtml, type SafeHtmlProps, type ShareUrls, type ShopFilterPriceBand, ShopFilters, type ShopFiltersActive, type ShopFiltersHrefs, type ShopFiltersLabels, type ShopFiltersProps, Specialty, type SpecialtyProps, Treatment, type TreatmentProps, buildShareUrls, formatPrice, getShopErrorMessage, isAllowedYouTubeHost, markdownToSafeHtml, readingTime, sanitizeHtml, shouldRenderShopFilters };
|