@reblu/site-blocks 0.10.0 → 0.12.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,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';
@@ -285,6 +285,26 @@ interface ParentPageProps {
285
285
  }
286
286
  declare function ParentPage({ page, childPages, childPageHref, childPagesLabel, treatments, treatmentHref, treatmentsLabel, className, }: ParentPageProps): react_jsx_runtime.JSX.Element;
287
287
 
288
+ /**
289
+ * `PageCardGrid` — a linked grid of page cards (cover image, title, excerpt)
290
+ * over any `PageListItem[]`, in the order given. Token-driven, RSC-safe.
291
+ *
292
+ * REB-869: extracted from `ParentPage`'s child-pages grid (same markup) so a
293
+ * SITE can drop it in anywhere — typically a landing teaser over
294
+ * `client.pages.featured(category)`, which returns the category's featured
295
+ * pages in the tenant's order, or its first pages when none are featured.
296
+ * Renders nothing for an empty list.
297
+ */
298
+ interface PageCardGridProps {
299
+ pages: PageListItem[];
300
+ /** Builds a card's href from its page. Defaults to `/{slug}`. */
301
+ pageHref?: (page: PageListItem) => string;
302
+ /** Optional `<h2>` above the grid. */
303
+ heading?: string;
304
+ className?: string;
305
+ }
306
+ declare function PageCardGrid(props: PageCardGridProps): react_jsx_runtime.JSX.Element;
307
+
288
308
  /**
289
309
  * @deprecated Renamed to `ParentPage` (REB-853) — the SDK is niche-agnostic.
290
310
  * Removed in the next major, not before 2027-03-31.
@@ -332,6 +352,45 @@ interface ProductCardProps {
332
352
  }
333
353
  declare function ProductCard({ product, href, currencyCode, locale, className }: ProductCardProps): react_jsx_runtime.JSX.Element;
334
354
 
355
+ /**
356
+ * `ProductTrustItems` — the store-wide trust messages (shipping, returns, secure
357
+ * payment…) configured in nexus and served as `ShopConfig.productTrustItems`
358
+ * (REB-858). Drop it under the add-to-cart button of a product page (REB-862).
359
+ *
360
+ * Server Component, RSC-safe: no hooks, no state, no `'use client'`. The default
361
+ * icons are Lucide icons bundled into this package's artifact, so their
362
+ * server-evaluability does not depend on the consumer's `lucide-react` version.
363
+ *
364
+ * Semantics — the API is the only source of claims:
365
+ * - `null`, `undefined` or `[]` render NOTHING. No default items are ever invented.
366
+ * - An item whose `icon` is not one this version knows is SKIPPED (no fallback
367
+ * icon): the contract is forward-compatible and a newer API may add icons.
368
+ * - An item with empty / whitespace-only `text` is skipped.
369
+ * - If no item survives, nothing is rendered — never an empty `<ul>`.
370
+ * - Unknown item keys are ignored.
371
+ */
372
+ /** Props an icon component receives. Lucide icons and plain `<svg>` components both fit. */
373
+ interface TrustIconProps {
374
+ className?: string;
375
+ 'aria-hidden'?: boolean | 'true' | 'false';
376
+ }
377
+ type TrustIconComponent = ComponentType<TrustIconProps>;
378
+ /** The default icon for every `ShopProductTrustIcon` of the current contract. */
379
+ declare const DEFAULT_TRUST_ICONS: Readonly<Record<ShopProductTrustIcon, TrustIconComponent>>;
380
+ interface ProductTrustItemsProps {
381
+ /** `ShopConfig.productTrustItems` as served — may be `null` / `undefined`. */
382
+ items: readonly ShopProductTrustItem[] | null | undefined;
383
+ /** Per-icon overrides merged over {@link DEFAULT_TRUST_ICONS}. Cannot add new icon keys. */
384
+ icons?: Partial<Record<ShopProductTrustIcon, TrustIconComponent>>;
385
+ /** List element. Defaults to `ul`. */
386
+ as?: 'ul' | 'ol';
387
+ /** Classes for the list element. */
388
+ className?: string;
389
+ /** Classes for each `<li>` row. */
390
+ itemClassName?: string;
391
+ }
392
+ declare function ProductTrustItems({ items, icons, as: List, className, itemClassName, }: ProductTrustItemsProps): react_jsx_runtime.JSX.Element | null;
393
+
335
394
  /** A heading level a caller can configure — `h1`…`h6`. */
336
395
  type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
337
396
 
@@ -866,4 +925,4 @@ interface OrderConfirmationProps {
866
925
  }
867
926
  declare function OrderConfirmation({ status, order, sessionId, cartHref, onRecheck, labels, currencyCode, locale, className, }: OrderConfirmationProps): react_jsx_runtime.JSX.Element;
868
927
 
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 };
928
+ 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, 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, 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';
@@ -285,6 +285,26 @@ interface ParentPageProps {
285
285
  }
286
286
  declare function ParentPage({ page, childPages, childPageHref, childPagesLabel, treatments, treatmentHref, treatmentsLabel, className, }: ParentPageProps): react_jsx_runtime.JSX.Element;
287
287
 
288
+ /**
289
+ * `PageCardGrid` — a linked grid of page cards (cover image, title, excerpt)
290
+ * over any `PageListItem[]`, in the order given. Token-driven, RSC-safe.
291
+ *
292
+ * REB-869: extracted from `ParentPage`'s child-pages grid (same markup) so a
293
+ * SITE can drop it in anywhere — typically a landing teaser over
294
+ * `client.pages.featured(category)`, which returns the category's featured
295
+ * pages in the tenant's order, or its first pages when none are featured.
296
+ * Renders nothing for an empty list.
297
+ */
298
+ interface PageCardGridProps {
299
+ pages: PageListItem[];
300
+ /** Builds a card's href from its page. Defaults to `/{slug}`. */
301
+ pageHref?: (page: PageListItem) => string;
302
+ /** Optional `<h2>` above the grid. */
303
+ heading?: string;
304
+ className?: string;
305
+ }
306
+ declare function PageCardGrid(props: PageCardGridProps): react_jsx_runtime.JSX.Element;
307
+
288
308
  /**
289
309
  * @deprecated Renamed to `ParentPage` (REB-853) — the SDK is niche-agnostic.
290
310
  * Removed in the next major, not before 2027-03-31.
@@ -332,6 +352,45 @@ interface ProductCardProps {
332
352
  }
333
353
  declare function ProductCard({ product, href, currencyCode, locale, className }: ProductCardProps): react_jsx_runtime.JSX.Element;
334
354
 
355
+ /**
356
+ * `ProductTrustItems` — the store-wide trust messages (shipping, returns, secure
357
+ * payment…) configured in nexus and served as `ShopConfig.productTrustItems`
358
+ * (REB-858). Drop it under the add-to-cart button of a product page (REB-862).
359
+ *
360
+ * Server Component, RSC-safe: no hooks, no state, no `'use client'`. The default
361
+ * icons are Lucide icons bundled into this package's artifact, so their
362
+ * server-evaluability does not depend on the consumer's `lucide-react` version.
363
+ *
364
+ * Semantics — the API is the only source of claims:
365
+ * - `null`, `undefined` or `[]` render NOTHING. No default items are ever invented.
366
+ * - An item whose `icon` is not one this version knows is SKIPPED (no fallback
367
+ * icon): the contract is forward-compatible and a newer API may add icons.
368
+ * - An item with empty / whitespace-only `text` is skipped.
369
+ * - If no item survives, nothing is rendered — never an empty `<ul>`.
370
+ * - Unknown item keys are ignored.
371
+ */
372
+ /** Props an icon component receives. Lucide icons and plain `<svg>` components both fit. */
373
+ interface TrustIconProps {
374
+ className?: string;
375
+ 'aria-hidden'?: boolean | 'true' | 'false';
376
+ }
377
+ type TrustIconComponent = ComponentType<TrustIconProps>;
378
+ /** The default icon for every `ShopProductTrustIcon` of the current contract. */
379
+ declare const DEFAULT_TRUST_ICONS: Readonly<Record<ShopProductTrustIcon, TrustIconComponent>>;
380
+ interface ProductTrustItemsProps {
381
+ /** `ShopConfig.productTrustItems` as served — may be `null` / `undefined`. */
382
+ items: readonly ShopProductTrustItem[] | null | undefined;
383
+ /** Per-icon overrides merged over {@link DEFAULT_TRUST_ICONS}. Cannot add new icon keys. */
384
+ icons?: Partial<Record<ShopProductTrustIcon, TrustIconComponent>>;
385
+ /** List element. Defaults to `ul`. */
386
+ as?: 'ul' | 'ol';
387
+ /** Classes for the list element. */
388
+ className?: string;
389
+ /** Classes for each `<li>` row. */
390
+ itemClassName?: string;
391
+ }
392
+ declare function ProductTrustItems({ items, icons, as: List, className, itemClassName, }: ProductTrustItemsProps): react_jsx_runtime.JSX.Element | null;
393
+
335
394
  /** A heading level a caller can configure — `h1`…`h6`. */
336
395
  type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
337
396
 
@@ -866,4 +925,4 @@ interface OrderConfirmationProps {
866
925
  }
867
926
  declare function OrderConfirmation({ status, order, sessionId, cartHref, onRecheck, labels, currencyCode, locale, className, }: OrderConfirmationProps): react_jsx_runtime.JSX.Element;
868
927
 
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 };
928
+ 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, 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, type TrustIconComponent, type TrustIconProps, buildShareUrls, formatPrice, getShopErrorMessage, isAllowedYouTubeHost, markdownToSafeHtml, readingTime, sanitizeHtml, shouldRenderShopFilters };