@reblu/site-blocks 0.9.0 → 0.11.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 +14 -0
- package/README.md +104 -1
- package/dist/index.cjs +475 -202
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +78 -11
- package/dist/index.d.ts +78 -11
- package/dist/index.js +472 -202
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ShopErrorCode, PageDetail, PageListItem, ShopProductListItem, BlockType, PageBlock, ResolvedEmbed, ShopFacets, ShopOrder } from '@reblu/site-contracts';
|
|
1
|
+
import { ShopErrorCode, PageDetail, PageListItem, ShopProductListItem, ShopProductTrustIcon, ShopProductTrustItem, BlockType, PageBlock, ResolvedEmbed, ShopFacets, ShopOrder } from '@reblu/site-contracts';
|
|
2
2
|
import { FaqItem } from './seo.cjs';
|
|
3
3
|
export { FaqPageJsonLd, buildFaqPageJsonLd, collectFaqItems } from './seo.cjs';
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
@@ -252,22 +252,50 @@ interface TreatmentProps {
|
|
|
252
252
|
declare function Treatment({ page, className }: TreatmentProps): react_jsx_runtime.JSX.Element;
|
|
253
253
|
|
|
254
254
|
/**
|
|
255
|
-
* `
|
|
256
|
-
* renders a hero and content sections,
|
|
257
|
-
*
|
|
258
|
-
*
|
|
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.
|
|
259
260
|
*/
|
|
260
|
-
interface
|
|
261
|
+
interface ParentPageProps {
|
|
261
262
|
page: PageDetail;
|
|
262
|
-
/**
|
|
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
|
+
*/
|
|
263
273
|
treatments?: PageListItem[];
|
|
264
|
-
/**
|
|
274
|
+
/**
|
|
275
|
+
* @deprecated Use `childPageHref`. Removed in the next major, not before 2027-03-31.
|
|
276
|
+
* Ignored when `childPageHref` is passed.
|
|
277
|
+
*/
|
|
265
278
|
treatmentHref?: (slug: string) => string;
|
|
266
|
-
/**
|
|
279
|
+
/**
|
|
280
|
+
* @deprecated Use `childPagesLabel`. Removed in the next major, not before 2027-03-31.
|
|
281
|
+
* Ignored when `childPagesLabel` is passed.
|
|
282
|
+
*/
|
|
267
283
|
treatmentsLabel?: string;
|
|
268
284
|
className?: string;
|
|
269
285
|
}
|
|
270
|
-
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;
|
|
271
299
|
|
|
272
300
|
/**
|
|
273
301
|
* `ProfileCard` — presentational professional/team-member card (the clinic
|
|
@@ -304,6 +332,45 @@ interface ProductCardProps {
|
|
|
304
332
|
}
|
|
305
333
|
declare function ProductCard({ product, href, currencyCode, locale, className }: ProductCardProps): react_jsx_runtime.JSX.Element;
|
|
306
334
|
|
|
335
|
+
/**
|
|
336
|
+
* `ProductTrustItems` — the store-wide trust messages (shipping, returns, secure
|
|
337
|
+
* payment…) configured in nexus and served as `ShopConfig.productTrustItems`
|
|
338
|
+
* (REB-858). Drop it under the add-to-cart button of a product page (REB-862).
|
|
339
|
+
*
|
|
340
|
+
* Server Component, RSC-safe: no hooks, no state, no `'use client'`. The default
|
|
341
|
+
* icons are Lucide icons bundled into this package's artifact, so their
|
|
342
|
+
* server-evaluability does not depend on the consumer's `lucide-react` version.
|
|
343
|
+
*
|
|
344
|
+
* Semantics — the API is the only source of claims:
|
|
345
|
+
* - `null`, `undefined` or `[]` render NOTHING. No default items are ever invented.
|
|
346
|
+
* - An item whose `icon` is not one this version knows is SKIPPED (no fallback
|
|
347
|
+
* icon): the contract is forward-compatible and a newer API may add icons.
|
|
348
|
+
* - An item with empty / whitespace-only `text` is skipped.
|
|
349
|
+
* - If no item survives, nothing is rendered — never an empty `<ul>`.
|
|
350
|
+
* - Unknown item keys are ignored.
|
|
351
|
+
*/
|
|
352
|
+
/** Props an icon component receives. Lucide icons and plain `<svg>` components both fit. */
|
|
353
|
+
interface TrustIconProps {
|
|
354
|
+
className?: string;
|
|
355
|
+
'aria-hidden'?: boolean | 'true' | 'false';
|
|
356
|
+
}
|
|
357
|
+
type TrustIconComponent = ComponentType<TrustIconProps>;
|
|
358
|
+
/** The default icon for every `ShopProductTrustIcon` of the current contract. */
|
|
359
|
+
declare const DEFAULT_TRUST_ICONS: Readonly<Record<ShopProductTrustIcon, TrustIconComponent>>;
|
|
360
|
+
interface ProductTrustItemsProps {
|
|
361
|
+
/** `ShopConfig.productTrustItems` as served — may be `null` / `undefined`. */
|
|
362
|
+
items: readonly ShopProductTrustItem[] | null | undefined;
|
|
363
|
+
/** Per-icon overrides merged over {@link DEFAULT_TRUST_ICONS}. Cannot add new icon keys. */
|
|
364
|
+
icons?: Partial<Record<ShopProductTrustIcon, TrustIconComponent>>;
|
|
365
|
+
/** List element. Defaults to `ul`. */
|
|
366
|
+
as?: 'ul' | 'ol';
|
|
367
|
+
/** Classes for the list element. */
|
|
368
|
+
className?: string;
|
|
369
|
+
/** Classes for each `<li>` row. */
|
|
370
|
+
itemClassName?: string;
|
|
371
|
+
}
|
|
372
|
+
declare function ProductTrustItems({ items, icons, as: List, className, itemClassName, }: ProductTrustItemsProps): react_jsx_runtime.JSX.Element | null;
|
|
373
|
+
|
|
307
374
|
/** A heading level a caller can configure — `h1`…`h6`. */
|
|
308
375
|
type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
|
|
309
376
|
|
|
@@ -838,4 +905,4 @@ interface OrderConfirmationProps {
|
|
|
838
905
|
}
|
|
839
906
|
declare function OrderConfirmation({ status, order, sessionId, cartHref, onRecheck, labels, currencyCode, locale, className, }: OrderConfirmationProps): react_jsx_runtime.JSX.Element;
|
|
840
907
|
|
|
841
|
-
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, 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 };
|
|
908
|
+
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, DEFAULT_TRUST_ICONS, 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, 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, type TrustIconComponent, type TrustIconProps, buildShareUrls, formatPrice, getShopErrorMessage, isAllowedYouTubeHost, markdownToSafeHtml, readingTime, sanitizeHtml, shouldRenderShopFilters };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ShopErrorCode, PageDetail, PageListItem, ShopProductListItem, BlockType, PageBlock, ResolvedEmbed, ShopFacets, ShopOrder } from '@reblu/site-contracts';
|
|
1
|
+
import { ShopErrorCode, PageDetail, PageListItem, ShopProductListItem, ShopProductTrustIcon, ShopProductTrustItem, BlockType, PageBlock, ResolvedEmbed, ShopFacets, ShopOrder } from '@reblu/site-contracts';
|
|
2
2
|
import { FaqItem } from './seo.js';
|
|
3
3
|
export { FaqPageJsonLd, buildFaqPageJsonLd, collectFaqItems } from './seo.js';
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
@@ -252,22 +252,50 @@ interface TreatmentProps {
|
|
|
252
252
|
declare function Treatment({ page, className }: TreatmentProps): react_jsx_runtime.JSX.Element;
|
|
253
253
|
|
|
254
254
|
/**
|
|
255
|
-
* `
|
|
256
|
-
* renders a hero and content sections,
|
|
257
|
-
*
|
|
258
|
-
*
|
|
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.
|
|
259
260
|
*/
|
|
260
|
-
interface
|
|
261
|
+
interface ParentPageProps {
|
|
261
262
|
page: PageDetail;
|
|
262
|
-
/**
|
|
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
|
+
*/
|
|
263
273
|
treatments?: PageListItem[];
|
|
264
|
-
/**
|
|
274
|
+
/**
|
|
275
|
+
* @deprecated Use `childPageHref`. Removed in the next major, not before 2027-03-31.
|
|
276
|
+
* Ignored when `childPageHref` is passed.
|
|
277
|
+
*/
|
|
265
278
|
treatmentHref?: (slug: string) => string;
|
|
266
|
-
/**
|
|
279
|
+
/**
|
|
280
|
+
* @deprecated Use `childPagesLabel`. Removed in the next major, not before 2027-03-31.
|
|
281
|
+
* Ignored when `childPagesLabel` is passed.
|
|
282
|
+
*/
|
|
267
283
|
treatmentsLabel?: string;
|
|
268
284
|
className?: string;
|
|
269
285
|
}
|
|
270
|
-
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;
|
|
271
299
|
|
|
272
300
|
/**
|
|
273
301
|
* `ProfileCard` — presentational professional/team-member card (the clinic
|
|
@@ -304,6 +332,45 @@ interface ProductCardProps {
|
|
|
304
332
|
}
|
|
305
333
|
declare function ProductCard({ product, href, currencyCode, locale, className }: ProductCardProps): react_jsx_runtime.JSX.Element;
|
|
306
334
|
|
|
335
|
+
/**
|
|
336
|
+
* `ProductTrustItems` — the store-wide trust messages (shipping, returns, secure
|
|
337
|
+
* payment…) configured in nexus and served as `ShopConfig.productTrustItems`
|
|
338
|
+
* (REB-858). Drop it under the add-to-cart button of a product page (REB-862).
|
|
339
|
+
*
|
|
340
|
+
* Server Component, RSC-safe: no hooks, no state, no `'use client'`. The default
|
|
341
|
+
* icons are Lucide icons bundled into this package's artifact, so their
|
|
342
|
+
* server-evaluability does not depend on the consumer's `lucide-react` version.
|
|
343
|
+
*
|
|
344
|
+
* Semantics — the API is the only source of claims:
|
|
345
|
+
* - `null`, `undefined` or `[]` render NOTHING. No default items are ever invented.
|
|
346
|
+
* - An item whose `icon` is not one this version knows is SKIPPED (no fallback
|
|
347
|
+
* icon): the contract is forward-compatible and a newer API may add icons.
|
|
348
|
+
* - An item with empty / whitespace-only `text` is skipped.
|
|
349
|
+
* - If no item survives, nothing is rendered — never an empty `<ul>`.
|
|
350
|
+
* - Unknown item keys are ignored.
|
|
351
|
+
*/
|
|
352
|
+
/** Props an icon component receives. Lucide icons and plain `<svg>` components both fit. */
|
|
353
|
+
interface TrustIconProps {
|
|
354
|
+
className?: string;
|
|
355
|
+
'aria-hidden'?: boolean | 'true' | 'false';
|
|
356
|
+
}
|
|
357
|
+
type TrustIconComponent = ComponentType<TrustIconProps>;
|
|
358
|
+
/** The default icon for every `ShopProductTrustIcon` of the current contract. */
|
|
359
|
+
declare const DEFAULT_TRUST_ICONS: Readonly<Record<ShopProductTrustIcon, TrustIconComponent>>;
|
|
360
|
+
interface ProductTrustItemsProps {
|
|
361
|
+
/** `ShopConfig.productTrustItems` as served — may be `null` / `undefined`. */
|
|
362
|
+
items: readonly ShopProductTrustItem[] | null | undefined;
|
|
363
|
+
/** Per-icon overrides merged over {@link DEFAULT_TRUST_ICONS}. Cannot add new icon keys. */
|
|
364
|
+
icons?: Partial<Record<ShopProductTrustIcon, TrustIconComponent>>;
|
|
365
|
+
/** List element. Defaults to `ul`. */
|
|
366
|
+
as?: 'ul' | 'ol';
|
|
367
|
+
/** Classes for the list element. */
|
|
368
|
+
className?: string;
|
|
369
|
+
/** Classes for each `<li>` row. */
|
|
370
|
+
itemClassName?: string;
|
|
371
|
+
}
|
|
372
|
+
declare function ProductTrustItems({ items, icons, as: List, className, itemClassName, }: ProductTrustItemsProps): react_jsx_runtime.JSX.Element | null;
|
|
373
|
+
|
|
307
374
|
/** A heading level a caller can configure — `h1`…`h6`. */
|
|
308
375
|
type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
|
|
309
376
|
|
|
@@ -838,4 +905,4 @@ interface OrderConfirmationProps {
|
|
|
838
905
|
}
|
|
839
906
|
declare function OrderConfirmation({ status, order, sessionId, cartHref, onRecheck, labels, currencyCode, locale, className, }: OrderConfirmationProps): react_jsx_runtime.JSX.Element;
|
|
840
907
|
|
|
841
|
-
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, 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 };
|
|
908
|
+
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, DEFAULT_TRUST_ICONS, 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, 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, type TrustIconComponent, type TrustIconProps, buildShareUrls, formatPrice, getShopErrorMessage, isAllowedYouTubeHost, markdownToSafeHtml, readingTime, sanitizeHtml, shouldRenderShopFilters };
|