@reblu/site-blocks 0.17.1 → 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.cts CHANGED
@@ -1,10 +1,11 @@
1
- import { ShopErrorCode, PageDetail, PageListItem, ShopProductListItem, ShopProductTrustIcon, ShopProductTrustItem, TrustBadgeType, TrustBadge, BlockType, PageBlock, ResolvedEmbed, ShopFacets, ShopOrder, ShopBillingInput, ShopCheckoutInput, ShopOrderInvoice } from '@reblu/site-contracts';
1
+ import { ShopErrorCode, PageDetail, PageListItem, ProfessionalField, ShopProductListItem, ShopProductTrustIcon, ShopProductTrustItem, TrustBadgeType, TrustBadge, BlockType, PageBlock, ResolvedEmbed, ShopFacets, ShopOrder, ShopBillingInput, ShopCheckoutInput, ShopOrderInvoice } from '@reblu/site-contracts';
2
2
  export { DATA_REQUEST_TYPES } from '@reblu/site-contracts';
3
3
  import { FaqItem } from './seo.cjs';
4
4
  export { FaqPageJsonLd, MarkdownToPlainTextOptions, buildFaqPageJsonLd, collectFaqItems, markdownToPlainText } from './seo.cjs';
5
5
  import * as react_jsx_runtime from 'react/jsx-runtime';
6
6
  import * as React$1 from 'react';
7
7
  import { ReactNode, ComponentType, FormEvent } from 'react';
8
+ import { H as HeadingLevel } from './_heading-BsNbc1wc.cjs';
8
9
 
9
10
  declare function readingTime(content: string | null | undefined): number | null;
10
11
 
@@ -227,6 +228,14 @@ interface MarkdownRendererProps {
227
228
  * the page keeps a single h1.
228
229
  */
229
230
  headingOffset?: number;
231
+ /**
232
+ * Land the body's SHALLOWEST heading at `1 + headingOffset` instead of shifting every
233
+ * heading by a fixed amount, so standard Markdown (`##` sections) renders `<h2>` under
234
+ * the page `<h1>` just like the convention (`#` sections) does. Relative depth is kept
235
+ * and levels clamp at h6. Use it where the body sits directly under the page `<h1>`;
236
+ * leave it off where the body sits under its own section heading. Default `false`.
237
+ */
238
+ normalizeHeadings?: boolean;
230
239
  /**
231
240
  * Restrict and render images (REB-1075). Absent: every image the sanitiser keeps is
232
241
  * rendered as a lazy `<img>` inside its paragraph (the historical behaviour).
@@ -247,7 +256,7 @@ interface MarkdownImageOptions {
247
256
  alt: string;
248
257
  }) => React$1.ReactNode;
249
258
  }
250
- declare function MarkdownRenderer({ content, className, headingOffset, images, }: MarkdownRendererProps): react_jsx_runtime.JSX.Element | null;
259
+ declare function MarkdownRenderer({ content, className, headingOffset, normalizeHeadings, images, }: MarkdownRendererProps): react_jsx_runtime.JSX.Element | null;
251
260
  /**
252
261
  * Render an **already-sanitised** HTML string through the same token-driven
253
262
  * component map as {@link MarkdownRenderer}. Consumers pass HTML that has been run
@@ -258,11 +267,10 @@ interface SafeHtmlProps {
258
267
  html: string | null | undefined;
259
268
  className?: string;
260
269
  headingOffset?: number;
270
+ /** See {@link MarkdownRendererProps.normalizeHeadings}. Default `false`. */
271
+ normalizeHeadings?: boolean;
261
272
  }
262
- declare function SafeHtml({ html, className, headingOffset }: SafeHtmlProps): react_jsx_runtime.JSX.Element | null;
263
-
264
- /** A heading level a caller can configure — `h1`…`h6`. */
265
- type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
273
+ declare function SafeHtml({ html, className, headingOffset, normalizeHeadings, }: SafeHtmlProps): react_jsx_runtime.JSX.Element | null;
266
274
 
267
275
  /**
268
276
  * `CourseDescription` — the drop-in for `AcademyCourseDetail.description`
@@ -400,11 +408,35 @@ interface ProfileCardProps {
400
408
  /** Short list of specialties / tags shown as chips. */
401
409
  specialties?: string[];
402
410
  bio?: string;
411
+ /**
412
+ * REB-1099 — the tenant's professional fields (`professional.fields` from
413
+ * `client.pages.list`). Only the `showOnCard` ones are shown.
414
+ */
415
+ fields?: ProfessionalField[] | null;
403
416
  /** Link target for the full profile. Omit to render non-linking. */
404
417
  href?: string;
405
418
  className?: string;
406
419
  }
407
- declare function ProfileCard({ name, role, imageUrl, specialties, bio, href, className }: ProfileCardProps): react_jsx_runtime.JSX.Element;
420
+ declare function ProfileCard({ name, role, imageUrl, specialties, bio, fields, href, className, }: ProfileCardProps): react_jsx_runtime.JSX.Element;
421
+
422
+ /**
423
+ * `ProfessionalFields` — the tenant-defined professional fields of a team
424
+ * profile (REB-1099), e.g. a registration number, as a `<dl>`.
425
+ *
426
+ * Feed it `professional.fields` from the SITE API as-is: the list card
427
+ * (`client.pages.list`) already carries only the card fields, the profile
428
+ * (`client.pages.bySlug`) carries every public one. `variant='card'` filters
429
+ * to `showOnCard` anyway, so one list can feed both places. The labels are the
430
+ * tenant's own; nothing here names a field. Renders nothing when there is
431
+ * nothing to show. RSC-safe.
432
+ */
433
+ interface ProfessionalFieldsProps {
434
+ fields: ProfessionalField[] | null | undefined;
435
+ /** `'card'` keeps only `showOnCard` fields. Default `'profile'`: every field. */
436
+ variant?: 'card' | 'profile';
437
+ className?: string;
438
+ }
439
+ declare function ProfessionalFields({ fields, variant, className, }: ProfessionalFieldsProps): react_jsx_runtime.JSX.Element | null;
408
440
 
409
441
  /**
410
442
  * `ProductCard` — presentational shop product tile over `ShopProductListItem`.
@@ -1249,4 +1281,4 @@ interface OrderInvoiceLinkProps {
1249
1281
  }
1250
1282
  declare function OrderInvoiceLink({ invoice, labels, className }: OrderInvoiceLinkProps): react_jsx_runtime.JSX.Element | null;
1251
1283
 
1252
- export { ALLOWED_YOUTUBE_HOSTS, AddedToCartToast, type AddedToCartToastLabels, type AddedToCartToastProps, type AddedToCartToastStatus, type BlockRendererProps, type CanonicalBlockType, type CartAdjustmentLine, CartAdjustmentsNotice, type CartAdjustmentsNoticeLabels, type CartAdjustmentsNoticeProps, 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, CourseDescription, type CourseDescriptionProps, DEFAULT_INVOICE_COUNTRIES, DEFAULT_SHOP_ERROR_FALLBACK_MESSAGE, DEFAULT_SHOP_ERROR_MESSAGES, DEFAULT_SHOP_PRICE_BANDS, DEFAULT_TRUST_BADGE_HEADINGS, DEFAULT_TRUST_BADGE_TYPE_ORDER, DEFAULT_TRUST_ICONS, EMPTY_FULL_INVOICE_VALUE, FaqAccordion, type FaqAccordionProps, FaqItem, type FullInvoiceErrors, FullInvoiceFields, type FullInvoiceFieldsLabels, type FullInvoiceFieldsProps, type FullInvoiceIdType, type FullInvoiceValue, type HeadingLevel, type MarkdownImageOptions, MarkdownRenderer, type MarkdownRendererProps, OrderConfirmation, type OrderConfirmationLabels, type OrderConfirmationOrder, type OrderConfirmationProps, type OrderConfirmationStatus, OrderInvoiceLink, type OrderInvoiceLinkLabels, type OrderInvoiceLinkProps, PageBlocks, type PageBlocksComponents, type PageBlocksProps, PageCardGrid, type PageCardGridProps, ParentPage, type ParentPageProps, ProductCard, type ProductCardProps, ProductTrustItems, type ProductTrustItemsProps, 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, TrustBadges, type TrustBadgesProps, type TrustIconComponent, type TrustIconProps, buildShareUrls, formatPrice, getShopErrorMessage, isAllowedYouTubeHost, isOverSimplifiedInvoiceCap, markdownToSafeHtml, readingTime, sanitizeHtml, shopIssuesInvoices, shouldRenderShopFilters, toCheckoutInvoiceFields };
1284
+ export { ALLOWED_YOUTUBE_HOSTS, AddedToCartToast, type AddedToCartToastLabels, type AddedToCartToastProps, type AddedToCartToastStatus, type BlockRendererProps, type CanonicalBlockType, type CartAdjustmentLine, CartAdjustmentsNotice, type CartAdjustmentsNoticeLabels, type CartAdjustmentsNoticeProps, 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, CourseDescription, type CourseDescriptionProps, DEFAULT_INVOICE_COUNTRIES, DEFAULT_SHOP_ERROR_FALLBACK_MESSAGE, DEFAULT_SHOP_ERROR_MESSAGES, DEFAULT_SHOP_PRICE_BANDS, DEFAULT_TRUST_BADGE_HEADINGS, DEFAULT_TRUST_BADGE_TYPE_ORDER, DEFAULT_TRUST_ICONS, EMPTY_FULL_INVOICE_VALUE, FaqAccordion, type FaqAccordionProps, FaqItem, type FullInvoiceErrors, FullInvoiceFields, type FullInvoiceFieldsLabels, type FullInvoiceFieldsProps, type FullInvoiceIdType, type FullInvoiceValue, HeadingLevel, type MarkdownImageOptions, MarkdownRenderer, type MarkdownRendererProps, OrderConfirmation, type OrderConfirmationLabels, type OrderConfirmationOrder, type OrderConfirmationProps, type OrderConfirmationStatus, OrderInvoiceLink, type OrderInvoiceLinkLabels, type OrderInvoiceLinkProps, PageBlocks, type PageBlocksComponents, type PageBlocksProps, PageCardGrid, type PageCardGridProps, ParentPage, type ParentPageProps, ProductCard, type ProductCardProps, ProductTrustItems, type ProductTrustItemsProps, ProfessionalFields, type ProfessionalFieldsProps, 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, TrustBadges, type TrustBadgesProps, type TrustIconComponent, type TrustIconProps, buildShareUrls, formatPrice, getShopErrorMessage, isAllowedYouTubeHost, isOverSimplifiedInvoiceCap, markdownToSafeHtml, readingTime, sanitizeHtml, shopIssuesInvoices, shouldRenderShopFilters, toCheckoutInvoiceFields };
package/dist/index.d.ts CHANGED
@@ -1,10 +1,11 @@
1
- import { ShopErrorCode, PageDetail, PageListItem, ShopProductListItem, ShopProductTrustIcon, ShopProductTrustItem, TrustBadgeType, TrustBadge, BlockType, PageBlock, ResolvedEmbed, ShopFacets, ShopOrder, ShopBillingInput, ShopCheckoutInput, ShopOrderInvoice } from '@reblu/site-contracts';
1
+ import { ShopErrorCode, PageDetail, PageListItem, ProfessionalField, ShopProductListItem, ShopProductTrustIcon, ShopProductTrustItem, TrustBadgeType, TrustBadge, BlockType, PageBlock, ResolvedEmbed, ShopFacets, ShopOrder, ShopBillingInput, ShopCheckoutInput, ShopOrderInvoice } from '@reblu/site-contracts';
2
2
  export { DATA_REQUEST_TYPES } from '@reblu/site-contracts';
3
3
  import { FaqItem } from './seo.js';
4
4
  export { FaqPageJsonLd, MarkdownToPlainTextOptions, buildFaqPageJsonLd, collectFaqItems, markdownToPlainText } from './seo.js';
5
5
  import * as react_jsx_runtime from 'react/jsx-runtime';
6
6
  import * as React$1 from 'react';
7
7
  import { ReactNode, ComponentType, FormEvent } from 'react';
8
+ import { H as HeadingLevel } from './_heading-BsNbc1wc.js';
8
9
 
9
10
  declare function readingTime(content: string | null | undefined): number | null;
10
11
 
@@ -227,6 +228,14 @@ interface MarkdownRendererProps {
227
228
  * the page keeps a single h1.
228
229
  */
229
230
  headingOffset?: number;
231
+ /**
232
+ * Land the body's SHALLOWEST heading at `1 + headingOffset` instead of shifting every
233
+ * heading by a fixed amount, so standard Markdown (`##` sections) renders `<h2>` under
234
+ * the page `<h1>` just like the convention (`#` sections) does. Relative depth is kept
235
+ * and levels clamp at h6. Use it where the body sits directly under the page `<h1>`;
236
+ * leave it off where the body sits under its own section heading. Default `false`.
237
+ */
238
+ normalizeHeadings?: boolean;
230
239
  /**
231
240
  * Restrict and render images (REB-1075). Absent: every image the sanitiser keeps is
232
241
  * rendered as a lazy `<img>` inside its paragraph (the historical behaviour).
@@ -247,7 +256,7 @@ interface MarkdownImageOptions {
247
256
  alt: string;
248
257
  }) => React$1.ReactNode;
249
258
  }
250
- declare function MarkdownRenderer({ content, className, headingOffset, images, }: MarkdownRendererProps): react_jsx_runtime.JSX.Element | null;
259
+ declare function MarkdownRenderer({ content, className, headingOffset, normalizeHeadings, images, }: MarkdownRendererProps): react_jsx_runtime.JSX.Element | null;
251
260
  /**
252
261
  * Render an **already-sanitised** HTML string through the same token-driven
253
262
  * component map as {@link MarkdownRenderer}. Consumers pass HTML that has been run
@@ -258,11 +267,10 @@ interface SafeHtmlProps {
258
267
  html: string | null | undefined;
259
268
  className?: string;
260
269
  headingOffset?: number;
270
+ /** See {@link MarkdownRendererProps.normalizeHeadings}. Default `false`. */
271
+ normalizeHeadings?: boolean;
261
272
  }
262
- declare function SafeHtml({ html, className, headingOffset }: SafeHtmlProps): react_jsx_runtime.JSX.Element | null;
263
-
264
- /** A heading level a caller can configure — `h1`…`h6`. */
265
- type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
273
+ declare function SafeHtml({ html, className, headingOffset, normalizeHeadings, }: SafeHtmlProps): react_jsx_runtime.JSX.Element | null;
266
274
 
267
275
  /**
268
276
  * `CourseDescription` — the drop-in for `AcademyCourseDetail.description`
@@ -400,11 +408,35 @@ interface ProfileCardProps {
400
408
  /** Short list of specialties / tags shown as chips. */
401
409
  specialties?: string[];
402
410
  bio?: string;
411
+ /**
412
+ * REB-1099 — the tenant's professional fields (`professional.fields` from
413
+ * `client.pages.list`). Only the `showOnCard` ones are shown.
414
+ */
415
+ fields?: ProfessionalField[] | null;
403
416
  /** Link target for the full profile. Omit to render non-linking. */
404
417
  href?: string;
405
418
  className?: string;
406
419
  }
407
- declare function ProfileCard({ name, role, imageUrl, specialties, bio, href, className }: ProfileCardProps): react_jsx_runtime.JSX.Element;
420
+ declare function ProfileCard({ name, role, imageUrl, specialties, bio, fields, href, className, }: ProfileCardProps): react_jsx_runtime.JSX.Element;
421
+
422
+ /**
423
+ * `ProfessionalFields` — the tenant-defined professional fields of a team
424
+ * profile (REB-1099), e.g. a registration number, as a `<dl>`.
425
+ *
426
+ * Feed it `professional.fields` from the SITE API as-is: the list card
427
+ * (`client.pages.list`) already carries only the card fields, the profile
428
+ * (`client.pages.bySlug`) carries every public one. `variant='card'` filters
429
+ * to `showOnCard` anyway, so one list can feed both places. The labels are the
430
+ * tenant's own; nothing here names a field. Renders nothing when there is
431
+ * nothing to show. RSC-safe.
432
+ */
433
+ interface ProfessionalFieldsProps {
434
+ fields: ProfessionalField[] | null | undefined;
435
+ /** `'card'` keeps only `showOnCard` fields. Default `'profile'`: every field. */
436
+ variant?: 'card' | 'profile';
437
+ className?: string;
438
+ }
439
+ declare function ProfessionalFields({ fields, variant, className, }: ProfessionalFieldsProps): react_jsx_runtime.JSX.Element | null;
408
440
 
409
441
  /**
410
442
  * `ProductCard` — presentational shop product tile over `ShopProductListItem`.
@@ -1249,4 +1281,4 @@ interface OrderInvoiceLinkProps {
1249
1281
  }
1250
1282
  declare function OrderInvoiceLink({ invoice, labels, className }: OrderInvoiceLinkProps): react_jsx_runtime.JSX.Element | null;
1251
1283
 
1252
- export { ALLOWED_YOUTUBE_HOSTS, AddedToCartToast, type AddedToCartToastLabels, type AddedToCartToastProps, type AddedToCartToastStatus, type BlockRendererProps, type CanonicalBlockType, type CartAdjustmentLine, CartAdjustmentsNotice, type CartAdjustmentsNoticeLabels, type CartAdjustmentsNoticeProps, 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, CourseDescription, type CourseDescriptionProps, DEFAULT_INVOICE_COUNTRIES, DEFAULT_SHOP_ERROR_FALLBACK_MESSAGE, DEFAULT_SHOP_ERROR_MESSAGES, DEFAULT_SHOP_PRICE_BANDS, DEFAULT_TRUST_BADGE_HEADINGS, DEFAULT_TRUST_BADGE_TYPE_ORDER, DEFAULT_TRUST_ICONS, EMPTY_FULL_INVOICE_VALUE, FaqAccordion, type FaqAccordionProps, FaqItem, type FullInvoiceErrors, FullInvoiceFields, type FullInvoiceFieldsLabels, type FullInvoiceFieldsProps, type FullInvoiceIdType, type FullInvoiceValue, type HeadingLevel, type MarkdownImageOptions, MarkdownRenderer, type MarkdownRendererProps, OrderConfirmation, type OrderConfirmationLabels, type OrderConfirmationOrder, type OrderConfirmationProps, type OrderConfirmationStatus, OrderInvoiceLink, type OrderInvoiceLinkLabels, type OrderInvoiceLinkProps, PageBlocks, type PageBlocksComponents, type PageBlocksProps, PageCardGrid, type PageCardGridProps, ParentPage, type ParentPageProps, ProductCard, type ProductCardProps, ProductTrustItems, type ProductTrustItemsProps, 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, TrustBadges, type TrustBadgesProps, type TrustIconComponent, type TrustIconProps, buildShareUrls, formatPrice, getShopErrorMessage, isAllowedYouTubeHost, isOverSimplifiedInvoiceCap, markdownToSafeHtml, readingTime, sanitizeHtml, shopIssuesInvoices, shouldRenderShopFilters, toCheckoutInvoiceFields };
1284
+ export { ALLOWED_YOUTUBE_HOSTS, AddedToCartToast, type AddedToCartToastLabels, type AddedToCartToastProps, type AddedToCartToastStatus, type BlockRendererProps, type CanonicalBlockType, type CartAdjustmentLine, CartAdjustmentsNotice, type CartAdjustmentsNoticeLabels, type CartAdjustmentsNoticeProps, 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, CourseDescription, type CourseDescriptionProps, DEFAULT_INVOICE_COUNTRIES, DEFAULT_SHOP_ERROR_FALLBACK_MESSAGE, DEFAULT_SHOP_ERROR_MESSAGES, DEFAULT_SHOP_PRICE_BANDS, DEFAULT_TRUST_BADGE_HEADINGS, DEFAULT_TRUST_BADGE_TYPE_ORDER, DEFAULT_TRUST_ICONS, EMPTY_FULL_INVOICE_VALUE, FaqAccordion, type FaqAccordionProps, FaqItem, type FullInvoiceErrors, FullInvoiceFields, type FullInvoiceFieldsLabels, type FullInvoiceFieldsProps, type FullInvoiceIdType, type FullInvoiceValue, HeadingLevel, type MarkdownImageOptions, MarkdownRenderer, type MarkdownRendererProps, OrderConfirmation, type OrderConfirmationLabels, type OrderConfirmationOrder, type OrderConfirmationProps, type OrderConfirmationStatus, OrderInvoiceLink, type OrderInvoiceLinkLabels, type OrderInvoiceLinkProps, PageBlocks, type PageBlocksComponents, type PageBlocksProps, PageCardGrid, type PageCardGridProps, ParentPage, type ParentPageProps, ProductCard, type ProductCardProps, ProductTrustItems, type ProductTrustItemsProps, ProfessionalFields, type ProfessionalFieldsProps, 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, TrustBadges, type TrustBadgesProps, type TrustIconComponent, type TrustIconProps, buildShareUrls, formatPrice, getShopErrorMessage, isAllowedYouTubeHost, isOverSimplifiedInvoiceCap, markdownToSafeHtml, readingTime, sanitizeHtml, shopIssuesInvoices, shouldRenderShopFilters, toCheckoutInvoiceFields };