@artisanpack-ui/ecommerce-storefront-react 0.0.0-stage → 1.0.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.
Files changed (98) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +67 -2
  3. package/dist/Addresses-D3ESHG3L.mjs +27 -0
  4. package/dist/Addresses-D3ESHG3L.mjs.map +1 -0
  5. package/dist/CategoryShow-OAGROEMA.mjs +12 -0
  6. package/dist/CategoryShow-OAGROEMA.mjs.map +1 -0
  7. package/dist/Claim-CJ4UOAUD.mjs +22 -0
  8. package/dist/Claim-CJ4UOAUD.mjs.map +1 -0
  9. package/dist/Confirmation-TLMMBPWS.mjs +20 -0
  10. package/dist/Confirmation-TLMMBPWS.mjs.map +1 -0
  11. package/dist/Dashboard-ARXORMTL.mjs +24 -0
  12. package/dist/Dashboard-ARXORMTL.mjs.map +1 -0
  13. package/dist/Downloads-CEQBY7JO.mjs +25 -0
  14. package/dist/Downloads-CEQBY7JO.mjs.map +1 -0
  15. package/dist/Index-KRR3Q7EJ.mjs +12 -0
  16. package/dist/Index-KRR3Q7EJ.mjs.map +1 -0
  17. package/dist/Index-RLQFEBTX.mjs +22 -0
  18. package/dist/Index-RLQFEBTX.mjs.map +1 -0
  19. package/dist/Index-WDJYGR5Q.mjs +12 -0
  20. package/dist/Index-WDJYGR5Q.mjs.map +1 -0
  21. package/dist/Index-XYU5QLUT.mjs +23 -0
  22. package/dist/Index-XYU5QLUT.mjs.map +1 -0
  23. package/dist/Lookup-QNUQKUID.mjs +19 -0
  24. package/dist/Lookup-QNUQKUID.mjs.map +1 -0
  25. package/dist/OrderShow-RYTP62YA.mjs +27 -0
  26. package/dist/OrderShow-RYTP62YA.mjs.map +1 -0
  27. package/dist/Orders-LZW57GE6.mjs +25 -0
  28. package/dist/Orders-LZW57GE6.mjs.map +1 -0
  29. package/dist/Profile-ZAAWFCAL.mjs +25 -0
  30. package/dist/Profile-ZAAWFCAL.mjs.map +1 -0
  31. package/dist/Show-LFWUO3KR.mjs +14 -0
  32. package/dist/Show-LFWUO3KR.mjs.map +1 -0
  33. package/dist/TagShow-FXKXRGY2.mjs +12 -0
  34. package/dist/TagShow-FXKXRGY2.mjs.map +1 -0
  35. package/dist/chunk-5UUNH3EH.mjs +1888 -0
  36. package/dist/chunk-5UUNH3EH.mjs.map +1 -0
  37. package/dist/chunk-A3MMQ2RY.mjs +183 -0
  38. package/dist/chunk-A3MMQ2RY.mjs.map +1 -0
  39. package/dist/chunk-ABGPTZ3Q.mjs +198 -0
  40. package/dist/chunk-ABGPTZ3Q.mjs.map +1 -0
  41. package/dist/chunk-BJ3FJFZQ.mjs +32 -0
  42. package/dist/chunk-BJ3FJFZQ.mjs.map +1 -0
  43. package/dist/chunk-BSASRFQ7.mjs +89 -0
  44. package/dist/chunk-BSASRFQ7.mjs.map +1 -0
  45. package/dist/chunk-CGCW3555.mjs +148 -0
  46. package/dist/chunk-CGCW3555.mjs.map +1 -0
  47. package/dist/chunk-DWR23FJD.mjs +643 -0
  48. package/dist/chunk-DWR23FJD.mjs.map +1 -0
  49. package/dist/chunk-ENY3MH2W.mjs +148 -0
  50. package/dist/chunk-ENY3MH2W.mjs.map +1 -0
  51. package/dist/chunk-EWJLRWPO.mjs +280 -0
  52. package/dist/chunk-EWJLRWPO.mjs.map +1 -0
  53. package/dist/chunk-FL5XL3ET.mjs +212 -0
  54. package/dist/chunk-FL5XL3ET.mjs.map +1 -0
  55. package/dist/chunk-FOOP6UK3.mjs +218 -0
  56. package/dist/chunk-FOOP6UK3.mjs.map +1 -0
  57. package/dist/chunk-HCC7GTVO.mjs +115 -0
  58. package/dist/chunk-HCC7GTVO.mjs.map +1 -0
  59. package/dist/chunk-HXZMY3GE.mjs +2331 -0
  60. package/dist/chunk-HXZMY3GE.mjs.map +1 -0
  61. package/dist/chunk-IOL2YQ62.mjs +109 -0
  62. package/dist/chunk-IOL2YQ62.mjs.map +1 -0
  63. package/dist/chunk-JH7SFSZA.mjs +104 -0
  64. package/dist/chunk-JH7SFSZA.mjs.map +1 -0
  65. package/dist/chunk-JJOPX4PI.mjs +205 -0
  66. package/dist/chunk-JJOPX4PI.mjs.map +1 -0
  67. package/dist/chunk-LT3GG7YQ.mjs +32 -0
  68. package/dist/chunk-LT3GG7YQ.mjs.map +1 -0
  69. package/dist/chunk-MZFULGDI.mjs +267 -0
  70. package/dist/chunk-MZFULGDI.mjs.map +1 -0
  71. package/dist/chunk-O4WPMMSH.mjs +58 -0
  72. package/dist/chunk-O4WPMMSH.mjs.map +1 -0
  73. package/dist/chunk-OU3WYFIH.mjs +397 -0
  74. package/dist/chunk-OU3WYFIH.mjs.map +1 -0
  75. package/dist/chunk-P3NIV4YG.mjs +998 -0
  76. package/dist/chunk-P3NIV4YG.mjs.map +1 -0
  77. package/dist/chunk-PEBBSZ5R.mjs +201 -0
  78. package/dist/chunk-PEBBSZ5R.mjs.map +1 -0
  79. package/dist/chunk-T5OWL6EG.mjs +73 -0
  80. package/dist/chunk-T5OWL6EG.mjs.map +1 -0
  81. package/dist/chunk-THPUK35U.mjs +132 -0
  82. package/dist/chunk-THPUK35U.mjs.map +1 -0
  83. package/dist/chunk-TPOKMH5E.mjs +142 -0
  84. package/dist/chunk-TPOKMH5E.mjs.map +1 -0
  85. package/dist/chunk-VX5TEJNU.mjs +1898 -0
  86. package/dist/chunk-VX5TEJNU.mjs.map +1 -0
  87. package/dist/chunk-WUL34MB2.mjs +268 -0
  88. package/dist/chunk-WUL34MB2.mjs.map +1 -0
  89. package/dist/chunk-WYGOMIZK.mjs +140 -0
  90. package/dist/chunk-WYGOMIZK.mjs.map +1 -0
  91. package/dist/chunk-Y2IOBBN7.mjs +127 -0
  92. package/dist/chunk-Y2IOBBN7.mjs.map +1 -0
  93. package/dist/chunk-Y5BRPEHA.mjs +54 -0
  94. package/dist/chunk-Y5BRPEHA.mjs.map +1 -0
  95. package/dist/index.d.ts +4607 -0
  96. package/dist/index.mjs +1515 -0
  97. package/dist/index.mjs.map +1 -0
  98. package/package.json +112 -4
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/resolver.ts","../src/page.tsx","../src/blocks/templates.tsx","../src/builtIns.ts","../src/pages.ts","../src/components/CategoryGrid.tsx","../src/components/Skeleton.tsx","../src/catalog/ProductGrid.tsx","../src/order/OrderLookupLink.tsx","../src/blocks/StorefrontBlock.tsx","../src/blocks/cartBlocks.tsx","../src/blocks/catalogBlocks.tsx","../src/blocks/productBlocks.tsx","../src/blocks/BlockPage.tsx","../src/blocks/blockRoot.tsx","../src/blocks/renderers.tsx","../src/blocks/blockHost.tsx","../src/blocks/islands.tsx"],"sourcesContent":["/**\n * The storefront's Inertia page resolver.\n *\n * @since 1.0.0\n */\n\nimport {\n EcommerceStorefrontPageNotFoundError,\n createPageResolver,\n} from '@artisanpack-ui/ecommerce-storefront-core';\n\nimport { withStorefrontPage, type StorefrontPageComponent } from './page';\nimport { PAGES } from './pages';\n\n/**\n * Options for {@link createEcommerceStorefrontResolver}.\n *\n * @since 1.0.0\n */\nexport interface EcommerceStorefrontResolverOptions {\n /**\n * Draws a storefront page name this package has no page for, instead of\n * rejecting. Useful while a host replaces or adds storefront pages.\n */\n fallback?: (name: string) => StorefrontPageComponent | Promise<StorefrontPageComponent>;\n}\n\n/**\n * Builds a page resolver.\n *\n * @since 1.0.0\n *\n * @param options - The resolver options.\n * @returns `(name) => Promise<page>`, rejecting with `EcommerceStorefrontPageNotFoundError` for an unknown name when there is no fallback.\n */\nexport function createEcommerceStorefrontResolver(\n options: EcommerceStorefrontResolverOptions = {},\n): (name: string) => Promise<StorefrontPageComponent> {\n const resolve = createPageResolver(PAGES);\n const wrapped = new Map<string, StorefrontPageComponent>();\n\n return async (name: string): Promise<StorefrontPageComponent> => {\n const cached = wrapped.get(name);\n\n if (undefined !== cached) {\n return cached;\n }\n\n let page: StorefrontPageComponent;\n\n try {\n page = await resolve(name);\n } catch (error) {\n if (\n !(error instanceof EcommerceStorefrontPageNotFoundError) ||\n undefined === options.fallback\n ) {\n throw error;\n }\n\n page = await options.fallback(name);\n }\n\n const storefrontPage = withStorefrontPage(name, page);\n\n wrapped.set(name, storefrontPage);\n\n return storefrontPage;\n };\n}\n\n/**\n * Resolves an `EcommerceStorefront/…` page name to its page component.\n *\n * Hand it to `createInertiaApp({ resolve })`. Unknown names reject with\n * `EcommerceStorefrontPageNotFoundError`.\n *\n * @since 1.0.0\n */\nexport const resolveEcommerceStorefrontPage = createEcommerceStorefrontResolver();\n","/**\n * Wraps a storefront page for Inertia.\n *\n * The wrapper makes sure the client registries exist (firing\n * `ap.ecommerceStorefront.register` once) and passes the page's props\n * through the `ap.ecommerceStorefront.pageProps` filter before the page\n * renders. A page rendered through a visual-editor template draws the\n * template's block tree in place of its own content, once a template\n * renderer is set (`setStorefrontTemplateRenderer()`).\n *\n * @since 1.0.0\n */\n\nimport { applyFilters } from '@artisanpack-ui/hooks-js';\nimport { HOOKS } from '@artisanpack-ui/ecommerce-storefront-core';\nimport { useMemo, type ComponentType, type ReactElement, type ReactNode } from 'react';\n\nimport { getStorefrontTemplateRenderer, StorefrontTemplateContent } from './blocks/templates';\nimport { registerBuiltIns } from './builtIns';\nimport { getRegistries } from './registries';\nimport { useStorefrontTemplate } from './useStorefront';\n\n/**\n * A page component, with Inertia's optional persistent `layout`: a\n * function that wraps the page element (`storefrontLayout`,\n * `checkoutLayout`). Typed so a resolver returning these pages is accepted\n * by `createInertiaApp({ resolve })` in Inertia 2 and 3.\n *\n * @since 1.0.0\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type StorefrontPageComponent<TProps = any> = ComponentType<TProps> & {\n layout?: (page: ReactNode) => ReactNode;\n};\n\n/**\n * Applies the `pageProps` filter to a page's props.\n *\n * A filter that returns something other than an object is ignored, so a\n * broken callback can't blank the page.\n *\n * @since 1.0.0\n *\n * @param props - The page's props.\n * @param pageName - The page name, such as `EcommerceStorefront/Product/Show`.\n * @returns The filtered props.\n */\nexport function filterPageProps<TProps extends object>(props: TProps, pageName: string): TProps {\n const filtered: unknown = applyFilters(HOOKS.pageProps, props, pageName);\n\n return null !== filtered && 'object' === typeof filtered && !Array.isArray(filtered)\n ? (filtered as TProps)\n : props;\n}\n\n/**\n * Wraps a page so it registers the client components and filters its props.\n *\n * The wrapper keeps the page's `layout`, so a persistent layout still works.\n *\n * @since 1.0.0\n *\n * @param pageName - The page name the wrapper serves.\n * @param Page - The page component.\n * @returns The wrapped page.\n */\nexport function withStorefrontPage<TProps extends object>(\n pageName: string,\n Page: StorefrontPageComponent<TProps>,\n): StorefrontPageComponent<TProps> {\n function StorefrontPage(props: TProps): ReactElement {\n registerBuiltIns();\n getRegistries();\n\n const filtered = useMemo(() => filterPageProps(props, pageName), [props]);\n const template = useStorefrontTemplate();\n const renderTemplate = getStorefrontTemplateRenderer();\n\n if (null !== template && null !== renderTemplate) {\n return <StorefrontTemplateContent template={template} render={renderTemplate} />;\n }\n\n return <Page {...filtered} />;\n }\n\n StorefrontPage.displayName = `StorefrontPage(${pageName})`;\n\n const wrapped = StorefrontPage as StorefrontPageComponent<TProps>;\n\n if (undefined !== Page.layout) {\n wrapped.layout = Page.layout;\n }\n\n return wrapped;\n}\n","/**\n * Storefront pages rendered through a visual-editor template.\n *\n * When a page renders through a saved template, its shared props carry the\n * template's block tree (`ecommerceStorefrontTemplate`), and the page draws\n * that tree with visual-editor's React renderer in place of its own\n * content. The renderer isn't a dependency of this package: the host hands\n * it over with {@link setStorefrontTemplateRenderer}, usually\n * `(tree) => <BlockTree tree={tree} />`. Without one, pages draw their own\n * content as they do without templates.\n *\n * This module stays small, since every page loads it.\n *\n * @since 1.0.0\n */\n\nimport type {\n StorefrontTemplate,\n StorefrontTemplateBlock,\n} from '@artisanpack-ui/ecommerce-storefront-core';\nimport { useMemo, type ReactElement, type ReactNode } from 'react';\n\n/**\n * The attribute a commerce block in a template tree carries its `clientId`\n * in, since visual-editor's renderer hands a block renderer its attributes\n * but not its `clientId`.\n *\n * @since 1.0.0\n */\nexport const BLOCK_CLIENT_ID_ATTRIBUTE = '_ecClientId';\n\n/**\n * Draws a template's block tree: visual-editor's renderer.\n *\n * @since 1.0.0\n */\nexport type StorefrontTemplateRenderer = (\n tree: StorefrontTemplateBlock[],\n template: StorefrontTemplate,\n) => ReactNode;\n\nlet renderer: StorefrontTemplateRenderer | null = null;\n\n/**\n * Sets what draws a templated page's block tree, or `null` to draw pages'\n * own content again.\n *\n * ```tsx\n * import { BlockTree, registerBlockRenderer } from '@artisanpack-ui/visual-editor-renderer-react';\n *\n * registerStorefrontBlockRenderers(registerBlockRenderer);\n * setStorefrontTemplateRenderer((tree) => <BlockTree tree={tree} />);\n * ```\n *\n * @since 1.0.0\n *\n * @param next - The renderer.\n */\nexport function setStorefrontTemplateRenderer(next: StorefrontTemplateRenderer | null): void {\n renderer = next;\n}\n\n/**\n * The template renderer, or null when none is set.\n *\n * @since 1.0.0\n *\n * @returns The renderer.\n */\nexport function getStorefrontTemplateRenderer(): StorefrontTemplateRenderer | null {\n return renderer;\n}\n\n/**\n * A template's block tree with each commerce block's `clientId` copied\n * into its {@link BLOCK_CLIENT_ID_ATTRIBUTE} attribute, so its renderer can\n * find its props in the template's `blockProps`.\n *\n * @since 1.0.0\n *\n * @param blocks - The template's blocks.\n * @returns The stamped blocks.\n */\nexport function storefrontTemplateTree(\n blocks: StorefrontTemplateBlock[],\n): StorefrontTemplateBlock[] {\n return blocks.map((block) => ({\n ...block,\n ...('string' === typeof block.clientId && '' !== block.clientId\n ? { attributes: { ...(block.attributes ?? {}), [BLOCK_CLIENT_ID_ATTRIBUTE]: block.clientId } }\n : {}),\n ...(undefined !== block.innerBlocks\n ? { innerBlocks: storefrontTemplateTree(block.innerBlocks) }\n : {}),\n }));\n}\n\n/**\n * Props for {@link StorefrontTemplateContent}.\n *\n * @since 1.0.0\n */\nexport interface StorefrontTemplateContentProps {\n /** The page's template. */\n template: StorefrontTemplate;\n /** What draws the tree. */\n render: StorefrontTemplateRenderer;\n}\n\n/**\n * A templated page's content: the template's block tree, drawn by the\n * template renderer. The template's own group block (`.ec-template`) lays\n * it out.\n *\n * @since 1.0.0\n *\n * @param props - The template and its renderer.\n * @returns The content.\n */\nexport function StorefrontTemplateContent({\n template,\n render,\n}: StorefrontTemplateContentProps): ReactElement {\n const tree = useMemo(() => storefrontTemplateTree(template.blocks), [template.blocks]);\n\n return <div data-storefront-template={template.slug}>{render(tree, template)}</div>;\n}\n","/**\n * Every built-in client registration, added before the first page renders.\n *\n * `ap.ecommerceStorefront.register` fires once, when the first storefront\n * page renders, and satellites replace, wrap or remove built-ins there. Pages\n * load on demand, so built-ins added by a page's own chunk would arrive after\n * the hook when the shopper starts on another page: a satellite's\n * `unregister('reviews')` would be undone and `get('simple')` would find\n * nothing. So the page wrapper ({@link withStorefrontPage}) adds them all\n * first, at the cost of a bigger main chunk. The modules that draw the\n * registries still register themselves too (once), for stories, tests and\n * blocks that render them outside a page.\n *\n * @since 1.0.0\n */\n\nimport { registerCartBuiltIns } from './cart/builtIns';\n// Checkout (#6)\nimport { registerPaymentDrivers } from './checkout/payment/registerPaymentDrivers';\nimport { registerHeaderActionBuiltIns } from './layout/headerActions';\nimport { registerProductBuiltIns } from './product/builtIns';\n\n/**\n * Adds every built-in registration (once each).\n *\n * @since 1.0.0\n */\nexport function registerBuiltIns(): void {\n registerHeaderActionBuiltIns();\n registerProductBuiltIns();\n registerCartBuiltIns();\n // Checkout (#6)\n registerPaymentDrivers();\n}\n","/**\n * The storefront's pages, by page path.\n *\n * Each key is a page name without the `EcommerceStorefront/` prefix, and\n * each page module default-exports its component. Pages load on demand,\n * so a host only downloads the screens a shopper visits.\n *\n * @since 1.0.0\n */\n\nimport type { PageLoader } from '@artisanpack-ui/ecommerce-storefront-core';\n\nimport type { StorefrontPageComponent } from './page';\n\n/**\n * Every page this package draws.\n *\n * @since 1.0.0\n */\nexport const PAGES: Record<string, PageLoader<StorefrontPageComponent>> = {\n 'Catalog/Index': () => import('./pages/Catalog/Index'),\n 'Catalog/CategoryShow': () => import('./pages/Catalog/CategoryShow'),\n 'Catalog/TagShow': () => import('./pages/Catalog/TagShow'),\n 'Search/Index': () => import('./pages/Search/Index'),\n 'Product/Show': () => import('./pages/Product/Show'),\n 'Cart/Index': () => import('./pages/Cart/Index'),\n // Checkout (#6)\n 'Checkout/Index': () => import('./pages/Checkout/Index'),\n // Orders and account (#7, #8)\n 'Order/Confirmation': () => import('./pages/Order/Confirmation'),\n 'Order/Lookup': () => import('./pages/Order/Lookup'),\n 'Account/OrderShow': () => import('./pages/Account/OrderShow'),\n 'Account/Dashboard': () => import('./pages/Account/Dashboard'),\n 'Account/Orders': () => import('./pages/Account/Orders'),\n 'Account/Addresses': () => import('./pages/Account/Addresses'),\n 'Account/Downloads': () => import('./pages/Account/Downloads'),\n 'Account/Profile': () => import('./pages/Account/Profile'),\n 'Account/Claim': () => import('./pages/Account/Claim'),\n};\n","/**\n * `ec-category-grid`: category tiles with images and product counts.\n *\n * Mirrors ecommerce-storefront-livewire's `<x-artisanpack-ec-category-grid>`.\n * Draws nothing without tiles.\n *\n * @since 1.0.0\n */\n\nimport {\n __,\n trans_choice,\n type StorefrontCategoryGrid,\n} from '@artisanpack-ui/ecommerce-storefront-core';\nimport { Icon } from '@artisanpack-ui/react';\nimport { useId, type ReactElement } from 'react';\n\nimport { cx } from '../internal/classes';\n\n/**\n * Props for {@link CategoryGrid}.\n *\n * @since 1.0.0\n */\nexport interface CategoryGridProps {\n /** The grid, as the presenter sends it. */\n grid: StorefrontCategoryGrid;\n className?: string;\n}\n\n/**\n * A grid of category tiles.\n *\n * @since 1.0.0\n *\n * @param props - The grid.\n * @returns The grid, or nothing without tiles.\n */\nexport function CategoryGrid({ grid, className }: CategoryGridProps): ReactElement | null {\n const headingId = `ec-category-grid-${useId().replace(/[^A-Za-z0-9_-]/g, '')}`;\n\n if (0 === grid.tiles.length) {\n return null;\n }\n\n const columns = Math.max(1, grid.columns);\n\n return (\n <section\n className={cx('ec-category-grid', className)}\n aria-labelledby={null !== grid.heading ? headingId : undefined}\n aria-label={null === grid.heading ? __('Categories') : undefined}\n data-category-grid=\"\"\n >\n {null !== grid.heading ? (\n <h2 id={headingId} className=\"ec-category-grid__title\">\n {grid.heading}\n </h2>\n ) : null}\n\n <ul role=\"list\" className=\"ec-category-grid__list\" data-columns={columns}>\n {grid.tiles.map((tile) => (\n <li key={tile.id} className=\"ec-category-grid__item\" data-category-tile={tile.id}>\n <article\n className=\"apui-card ec-category-tile\"\n data-surface=\"default\"\n data-interactive={null !== tile.url ? '' : undefined}\n >\n {grid.showImages ? (\n <div\n className=\"ec-category-tile__media\"\n data-scope=\"card\"\n data-part=\"media\"\n aria-hidden=\"true\"\n >\n {null !== tile.image ? (\n <img\n src={tile.image.url}\n srcSet={tile.image.srcset ?? undefined}\n sizes={\n null !== tile.image.srcset\n ? `(min-width: 1024px) ${Math.ceil(100 / columns)}vw, (min-width: 640px) 33vw, 50vw`\n : undefined\n }\n width={tile.image.width ?? 800}\n height={tile.image.height ?? 600}\n alt=\"\"\n loading=\"lazy\"\n decoding=\"async\"\n />\n ) : (\n <Icon name=\"layout-grid\" className=\"ec-category-tile__placeholder\" />\n )}\n </div>\n ) : null}\n\n <div className=\"ec-category-tile__body\">\n <div className=\"ec-category-tile__text\">\n <h3 className=\"ec-category-tile__name\">\n {null !== tile.url ? <a href={tile.url}>{tile.name}</a> : tile.name}\n </h3>\n {grid.showCounts ? (\n <p className=\"ec-category-tile__count\" data-category-count=\"\">\n {trans_choice(':count product|:count products', tile.count, {\n count: tile.count,\n })}\n </p>\n ) : null}\n </div>\n {null !== tile.url ? (\n <Icon name=\"arrow-right\" className=\"ec-category-tile__arrow\" />\n ) : null}\n </div>\n </article>\n </li>\n ))}\n </ul>\n </section>\n );\n}\n","/**\n * `ec-skeleton`: a loading placeholder with a polite \"Loading…\" status.\n *\n * Mirrors ecommerce-storefront-livewire's `<x-artisanpack-ec-skeleton>`:\n * text lines, product-card shapes or one image.\n *\n * @since 1.0.0\n */\n\nimport { __ } from '@artisanpack-ui/ecommerce-storefront-core';\nimport { Card, Skeleton as ApuiSkeleton } from '@artisanpack-ui/react';\nimport type { HTMLAttributes, ReactElement } from 'react';\n\nimport { cx } from '../internal/classes';\n\n/**\n * Props for {@link Skeleton}.\n *\n * @since 1.0.0\n */\nexport interface SkeletonProps extends HTMLAttributes<HTMLDivElement> {\n /** `text`, `card` or `image`. Default `text`. */\n variant?: 'text' | 'card' | 'image';\n /** How many lines or cards, 1–24. Default 3. */\n count?: number;\n /** The status text. Default \"Loading…\". */\n label?: string;\n}\n\n/**\n * A loading placeholder.\n *\n * @since 1.0.0\n *\n * @param props - The variant, count and label.\n * @returns The placeholder.\n */\nexport function Skeleton({\n variant = 'text',\n count = 3,\n label,\n className,\n ...rest\n}: SkeletonProps): ReactElement {\n const kind = ['text', 'card', 'image'].includes(variant) ? variant : 'text';\n const total = Math.max(1, Math.min(24, Math.trunc(count)));\n const items = Array.from({ length: total }, (_, index) => index);\n\n return (\n <div {...rest} className={cx('ec-skeleton', className)} data-skeleton={kind}>\n <span className=\"apui-sr-only\" role=\"status\">\n {label ?? __('Loading…')}\n </span>\n <div className=\"ec-skeleton__shapes\" data-variant={kind} aria-busy=\"true\" aria-hidden=\"true\">\n {'image' === kind ? (\n <ApuiSkeleton className=\"ec-skeleton__image\" />\n ) : (\n items.map((index) =>\n 'card' === kind ? (\n <Card\n key={index}\n className=\"ec-skeleton-card\"\n media={<ApuiSkeleton className=\"ec-skeleton-card__media\" />}\n >\n <ApuiSkeleton\n shape=\"text\"\n className=\"ec-skeleton-card__line\"\n data-length=\"medium\"\n />\n <ApuiSkeleton shape=\"text\" className=\"ec-skeleton-card__line\" data-length=\"long\" />\n <ApuiSkeleton shape=\"text\" className=\"ec-skeleton-card__line\" data-length=\"short\" />\n <ApuiSkeleton className=\"ec-skeleton-card__button\" />\n </Card>\n ) : (\n <ApuiSkeleton\n key={index}\n shape=\"text\"\n className=\"ec-skeleton__line\"\n data-last={index === total - 1 ? '' : undefined}\n />\n ),\n )\n )}\n </div>\n </div>\n );\n}\n","/**\n * `ec-product-grid`: a fixed grid of products, without filters or paging.\n *\n * Mirrors ecommerce-storefront-livewire's `Catalog/ProductGrid` (the product\n * grid block): the optional heading, then the product cards laid out by\n * `data-columns`. With no products it draws only its wrapper.\n *\n * @since 1.0.0\n */\n\nimport { __, type StorefrontProductGrid } from '@artisanpack-ui/ecommerce-storefront-core';\nimport { useId, type ReactElement } from 'react';\n\nimport { ProductCard } from '../components/ProductCard';\nimport { useQuickAdd } from './useQuickAdd';\n\n/**\n * Props for {@link ProductGrid}.\n *\n * @since 1.0.0\n */\nexport interface ProductGridProps {\n grid: StorefrontProductGrid;\n /** What the grid shows (`featured`, `category`, …), for `data-product-grid`. */\n source?: string;\n /** The heading's id. Generated when omitted. */\n headingId?: string;\n}\n\n/**\n * A product grid.\n *\n * @since 1.0.0\n *\n * @param props - The grid.\n * @returns The grid.\n */\nexport function ProductGrid({ grid, source = '', headingId }: ProductGridProps): ReactElement {\n const generatedId = useId();\n const titleId =\n headingId ?? `ecommerce-product-grid-${generatedId.replace(/[^A-Za-z0-9_-]/g, '')}`;\n const quickAdd = useQuickAdd(grid.showAddToCart ? grid.addToCartUrl : null);\n const headingLevel = null !== grid.heading ? 3 : 2;\n\n return (\n <div data-product-grid={source}>\n {grid.products.length > 0 ? (\n <section\n className=\"ec-product-grid\"\n aria-labelledby={null !== grid.heading ? titleId : undefined}\n aria-label={null === grid.heading ? __('Products') : undefined}\n >\n {null !== grid.heading ? (\n <h2 id={titleId} className=\"ec-product-grid__title\">\n {grid.heading}\n </h2>\n ) : null}\n\n <ul\n role=\"list\"\n className=\"ec-product-grid__list\"\n data-columns={grid.columns}\n data-product-grid-list=\"\"\n >\n {grid.products.map((product) => (\n <li key={product.id} className=\"ec-product-grid__item\">\n <ProductCard\n card={{ ...product, headingLevel }}\n showPrice={grid.showPrice}\n showRating={grid.showRating}\n onQuickAdd={quickAdd.add}\n quickAddPending={quickAdd.pending === product.id}\n />\n </li>\n ))}\n </ul>\n </section>\n ) : null}\n </div>\n );\n}\n","/**\n * \"Ordered as a guest? Find your order\", for the host's sign-in screen,\n * which the storefront doesn't own.\n *\n * Mirrors ecommerce-storefront-livewire's `partials/order-lookup-link`:\n * muted body-small text with the design-system Link in its muted tone, a\n * full page load (the lookup page uses the storefront layout, not the\n * host's).\n *\n * @since 1.0.0\n */\n\nimport { __ } from '@artisanpack-ui/ecommerce-storefront-core';\nimport { Link } from '@artisanpack-ui/react';\nimport type { ReactElement } from 'react';\n\n/**\n * Props for {@link OrderLookupLink}.\n *\n * @since 1.0.0\n */\nexport interface OrderLookupLinkProps {\n /** The lookup page's URL; null draws nothing. */\n href: string | null;\n}\n\n/**\n * The link.\n *\n * @since 1.0.0\n *\n * @param props - The lookup page's URL.\n * @returns The link, or nothing without a URL.\n */\nexport function OrderLookupLink({ href }: OrderLookupLinkProps): ReactElement | null {\n if (null === href || '' === href) {\n return null;\n }\n\n return (\n <p className=\"ec-order-lookup-link\" data-order-lookup-link=\"\">\n {__('Ordered as a guest?')}{' '}\n <Link href={href} tone=\"muted\">\n {__('Find your order')}\n </Link>\n </p>\n );\n}\n","/**\n * Draws a commerce block from its presentation, and keeps the component\n * each block name draws with.\n *\n * Mirrors ecommerce-storefront-livewire's `blocks/block` wrapper: a\n * `.ec-commerce-block` carrying `data-commerce-block`, with the dashed\n * \"Sample product\" notice above the block when an editor preview fell back\n * to the newest product.\n *\n * @since 1.0.0\n */\n\nimport {\n __,\n type StorefrontBlockName,\n type StorefrontBlockPresentation,\n} from '@artisanpack-ui/ecommerce-storefront-core';\nimport { Badge } from '@artisanpack-ui/react';\nimport { createElement, type ReactElement } from 'react';\n\nimport { registerBuiltIns } from '../builtIns';\nimport { cx } from '../internal/classes';\nimport { CartContentsBlock, CheckoutStepsBlock } from './cartBlocks';\nimport { CategoryGridBlock, ProductCatalogBlock, ProductGridBlock } from './catalogBlocks';\nimport {\n AddToCartBlock,\n ProductGalleryBlock,\n ProductPriceBlock,\n ProductReviewsBlock,\n RecentlyViewedBlock,\n RelatedProductsBlock,\n SingleProductBlock,\n} from './productBlocks';\nimport type { StorefrontBlockComponent } from './types';\n\n/**\n * The prefix every commerce block name starts with.\n *\n * @since 1.0.0\n */\nexport const STOREFRONT_BLOCK_PREFIX = 'artisanpack-commerce/';\n\n/**\n * The storefront's own blocks, by name.\n *\n * @since 1.0.0\n */\nexport const STOREFRONT_BLOCKS: Readonly<Record<StorefrontBlockName, StorefrontBlockComponent>> = {\n 'artisanpack-commerce/product-grid': ProductGridBlock,\n 'artisanpack-commerce/category-grid': CategoryGridBlock,\n 'artisanpack-commerce/related-products': RelatedProductsBlock,\n 'artisanpack-commerce/recently-viewed': RecentlyViewedBlock,\n 'artisanpack-commerce/single-product': SingleProductBlock,\n 'artisanpack-commerce/product-gallery': ProductGalleryBlock,\n 'artisanpack-commerce/product-price': ProductPriceBlock,\n 'artisanpack-commerce/add-to-cart': AddToCartBlock,\n 'artisanpack-commerce/product-reviews': ProductReviewsBlock,\n 'artisanpack-commerce/product-catalog': ProductCatalogBlock,\n 'artisanpack-commerce/cart-contents': CartContentsBlock,\n 'artisanpack-commerce/checkout-steps': CheckoutStepsBlock,\n};\n\nconst added = new Map<string, StorefrontBlockComponent>();\n\n/**\n * Draws a commerce block of your own (a `StorefrontBlock` subclass added\n * with the `ap.ecommerceStorefrontInertia.blocks` filter), or replaces a\n * built-in block's component.\n *\n * @since 1.0.0\n *\n * @param name - The block's full name (`artisanpack-commerce/{slug}`).\n * @param component - The component, which gets `{ props, attributes }`.\n */\nexport function registerStorefrontBlock(name: string, component: StorefrontBlockComponent): void {\n added.set(name.trim(), component);\n}\n\n/**\n * The component a block name draws with: one you registered, else the\n * built-in one.\n *\n * @since 1.0.0\n *\n * @param name - The block's full name.\n * @returns The component, or undefined for a name nothing draws.\n */\nexport function getStorefrontBlock(name: string): StorefrontBlockComponent | undefined {\n const key = name.trim();\n\n return added.get(key) ?? (STOREFRONT_BLOCKS as Record<string, StorefrontBlockComponent>)[key];\n}\n\n/**\n * Every commerce block name a component is known for, built-in ones first.\n *\n * @since 1.0.0\n *\n * @returns The names.\n */\nexport function storefrontBlockNames(): string[] {\n return [...new Set([...Object.keys(STOREFRONT_BLOCKS), ...added.keys()])];\n}\n\n/**\n * Forgets the blocks registered with {@link registerStorefrontBlock}\n * (tests).\n *\n * @since 1.0.0\n */\nexport function resetStorefrontBlocks(): void {\n added.clear();\n}\n\n/**\n * A block name's slug: `artisanpack-commerce/product-grid` → `product-grid`.\n *\n * @since 1.0.0\n *\n * @param name - The block's full name.\n * @returns The slug.\n */\nexport function storefrontBlockSlug(name: string): string {\n return name.startsWith(STOREFRONT_BLOCK_PREFIX)\n ? name.slice(STOREFRONT_BLOCK_PREFIX.length)\n : name;\n}\n\n/**\n * The dashed notice over a block whose editor preview fell back to the\n * newest product.\n *\n * @since 1.0.0\n *\n * @returns The notice.\n */\nexport function BlockSampleNotice(): ReactElement {\n return (\n <div className=\"ec-block-notice ec-block-notice--sample\" data-commerce-sample=\"\">\n <Badge color=\"info\" leadingIcon=\"info\">\n {__('Sample product')}\n </Badge>\n <p className=\"ec-block-notice__message\">\n {__(\n \"Showing the newest product as a sample. On a product page this block shows that page's product; set a product ID in the block settings to always show one product.\",\n )}\n </p>\n </div>\n );\n}\n\n/**\n * Props for {@link StorefrontBlockBody} and {@link StorefrontBlock}.\n *\n * @since 1.0.0\n */\nexport interface StorefrontBlockProps {\n /** The block's presentation; null when it has nothing to show. */\n presentation: StorefrontBlockPresentation | null;\n /** Extra classes for the wrapper ({@link StorefrontBlock} only). */\n className?: string;\n}\n\n/**\n * A block's content without the wrapper: the sample notice, if any, then\n * the block's component. An island draws this inside its own\n * `[data-ec-block]` element, which is already the wrapper.\n *\n * @since 1.0.0\n *\n * @param props - The presentation.\n * @returns The content, or nothing for a block with nothing to show or no component.\n */\nexport function StorefrontBlockBody({ presentation }: StorefrontBlockProps): ReactElement | null {\n registerBuiltIns();\n\n if (null === presentation) {\n return null;\n }\n\n const Component = getStorefrontBlock(presentation.name);\n\n if (undefined === Component) {\n return null;\n }\n\n return (\n <>\n {presentation.sample ? <BlockSampleNotice /> : null}\n {createElement(Component, {\n props: presentation.props,\n attributes: presentation.attributes,\n })}\n </>\n );\n}\n\n/**\n * A commerce block in its `.ec-commerce-block` wrapper.\n *\n * @since 1.0.0\n *\n * @param props - The presentation and extra wrapper classes.\n * @returns The block, or nothing when it has nothing to show.\n */\nexport function StorefrontBlock({\n presentation,\n className,\n}: StorefrontBlockProps): ReactElement | null {\n if (null === presentation || undefined === getStorefrontBlock(presentation.name)) {\n return null;\n }\n\n return (\n <div\n className={cx('ec-commerce-block', className)}\n data-commerce-block={storefrontBlockSlug(presentation.name)}\n >\n <StorefrontBlockBody presentation={presentation} />\n </div>\n );\n}\n","/**\n * The cart and checkout commerce blocks: Cart Contents and Checkout Steps,\n * with the editor previews the Livewire blocks draw\n * (`blocks/cart-preview` and `blocks/checkout-preview`).\n *\n * @since 1.0.0\n */\n\nimport {\n __,\n type CheckoutIndexProps,\n type StorefrontCartContentsBlockProps,\n type StorefrontCartPreviewLine,\n type StorefrontCheckoutStepsBlockProps,\n type StorefrontMoney,\n} from '@artisanpack-ui/ecommerce-storefront-core';\nimport { Badge, Button, Card, Icon, Input, Skeleton, Step, Steps } from '@artisanpack-ui/react';\nimport type { ReactElement } from 'react';\n\nimport { Cart } from '../cart/Cart';\nimport { Checkout } from '../checkout/Checkout';\nimport { registerPaymentDrivers } from '../checkout/payment/registerPaymentDrivers';\nimport { Money } from '../components/Money';\nimport { useStorefrontPage } from '../useStorefront';\nimport type { StorefrontBlockComponentProps } from './types';\n\nregisterPaymentDrivers();\n\n/**\n * The checkout page's name.\n *\n * @since 1.0.0\n */\nexport const CHECKOUT_PAGE = 'EcommerceStorefront/Checkout/Index';\n\n/**\n * Props for {@link CartPreview}.\n *\n * @since 1.0.0\n */\nexport interface CartPreviewProps {\n lines: StorefrontCartPreviewLine[];\n subtotal: StorefrontMoney;\n showCrossSells: boolean;\n showCoupon: boolean;\n}\n\n/**\n * The Cart Contents block's editor preview: a sample cart, never saved.\n *\n * @since 1.0.0\n *\n * @param props - The sample lines, their subtotal and the block's options.\n * @returns The preview.\n */\nexport function CartPreview({\n lines,\n subtotal,\n showCrossSells,\n showCoupon,\n}: CartPreviewProps): ReactElement {\n return (\n <div className=\"ec-cart-preview\" data-cart-preview=\"\">\n <div className=\"ec-block-notice ec-block-notice--sample\" data-commerce-sample=\"\">\n <Badge color=\"info\" leadingIcon=\"info\">\n {__('Sample cart')}\n </Badge>\n <p className=\"ec-block-notice__message\">\n {__(\n \"Shoppers see their own cart here. This preview uses your newest products and isn't saved.\",\n )}\n </p>\n </div>\n\n <div className=\"ec-cart-preview__layout\">\n <Card className=\"ec-cart-preview__lines\">\n <ul role=\"list\" className=\"ec-cart-preview__list\" aria-label={__('Items in your cart')}>\n {lines.map((line, index) => (\n <li key={index} className=\"ec-cart-preview__line\" data-cart-preview-line=\"\">\n <div className=\"ec-cart-preview__media\" aria-hidden=\"true\">\n {null !== line.image ? (\n <img\n src={line.image.url}\n srcSet={line.image.srcset ?? undefined}\n sizes={null !== line.image.srcset ? '96px' : undefined}\n width={96}\n height={96}\n alt=\"\"\n loading=\"lazy\"\n decoding=\"async\"\n />\n ) : (\n <Icon name=\"image\" />\n )}\n </div>\n\n <div className=\"ec-cart-preview__details\">\n <p className=\"ec-cart-preview__name\">{line.name}</p>\n <p className=\"ec-cart-preview__quantity\">\n {__('Quantity: :count', { count: 1 })}\n </p>\n </div>\n\n <p className=\"ec-cart-preview__amount\">\n <Money money={line.total} />\n </p>\n </li>\n ))}\n </ul>\n </Card>\n\n <Card className=\"ec-cart-preview__summary\" title={__('Order summary')}>\n {showCoupon ? (\n <Input\n id=\"ec-cart-preview-coupon\"\n label={__('Coupon code')}\n disabled\n data-cart-preview-coupon=\"\"\n />\n ) : null}\n\n <dl className=\"ec-cart-preview__totals\">\n <div className=\"ec-cart-preview__total\">\n <dt>{__('Subtotal')}</dt>\n <dd>\n <Money money={subtotal} />\n </dd>\n </div>\n\n <div className=\"ec-cart-preview__total\">\n <dt>{__('Shipping')}</dt>\n <dd>{__('Calculated at checkout')}</dd>\n </div>\n </dl>\n\n <Button color=\"primary\" className=\"ec-cart-preview__checkout\" disabled>\n {__('Checkout')}\n </Button>\n </Card>\n </div>\n\n {showCrossSells ? (\n <p\n className=\"ec-block-notice ec-block-notice__message ec-cart-preview__cross-sells\"\n data-cart-preview-cross-sells=\"\"\n >\n {__(\"Cross-sells for the shopper's cart appear here.\")}\n </p>\n ) : null}\n </div>\n );\n}\n\n/**\n * The Cart Contents block: the cart page's cart without its title, or the\n * sample cart in an editor preview.\n *\n * @since 1.0.0\n *\n * @param props - The cart page's props, or the preview.\n * @returns The cart.\n */\nexport function CartContentsBlock({\n props,\n}: StorefrontBlockComponentProps<StorefrontCartContentsBlockProps>): ReactElement {\n if (null !== props.preview) {\n return (\n <CartPreview\n lines={props.preview.lines}\n subtotal={props.preview.subtotal}\n showCrossSells={props.preview.showCrossSells}\n showCoupon={props.showCoupon}\n />\n );\n }\n\n const { preview: _preview, ...cart } = props;\n\n return <Cart {...cart} />;\n}\n\n/**\n * Props for {@link CheckoutPreview}.\n *\n * @since 1.0.0\n */\nexport interface CheckoutPreviewProps {\n layout: StorefrontCheckoutStepsBlockProps['layout'];\n steps: StorefrontCheckoutStepsBlockProps['steps'];\n}\n\n/**\n * The Checkout Steps block's preview: the steps in the chosen layout,\n * without a cart.\n *\n * @since 1.0.0\n *\n * @param props - The layout and the core steps.\n * @returns The preview.\n */\nexport function CheckoutPreview({ layout, steps }: CheckoutPreviewProps): ReactElement {\n const singlePage = 'single_page' === layout;\n const first = steps[0];\n\n return (\n <div className=\"ec-checkout-preview\" data-checkout-preview={layout}>\n <div className=\"ec-block-notice ec-block-notice--sample\" data-commerce-sample=\"\">\n <Badge color=\"info\">{singlePage ? __('Single page') : __('Multi-step')}</Badge>\n <p className=\"ec-block-notice__message\">{__('Shoppers check out their own cart here.')}</p>\n </div>\n\n {singlePage ? (\n <ol role=\"list\" className=\"ec-checkout-preview__sections\" aria-label={__('Checkout steps')}>\n {steps.map((step, index) => (\n <li\n key={step.key}\n data-checkout-preview-step={step.key}\n aria-current={0 === index ? 'step' : undefined}\n >\n <Card\n surface={0 === index ? 'default' : 'sunken'}\n className=\"ec-checkout-preview__section\"\n data-upcoming={0 !== index ? '' : undefined}\n >\n <p className=\"ec-checkout-preview__section-title\">\n <span className=\"ec-checkout-preview__marker\" aria-hidden=\"true\">\n {index + 1}\n </span>\n <span>{step.label}</span>\n </p>\n </Card>\n </li>\n ))}\n </ol>\n ) : (\n <>\n <Steps value={1} label={__('Checkout steps')} className=\"ec-checkout-preview__steps\">\n {steps.map((step) => (\n <Step key={step.key} title={step.label} data-checkout-preview-step={step.key} />\n ))}\n </Steps>\n\n {undefined !== first ? (\n <Card className=\"ec-checkout-preview__current\" title={first.label}>\n <div className=\"ec-checkout-preview__placeholder\" aria-hidden=\"true\">\n <Skeleton className=\"ec-checkout-preview__field\" />\n <Skeleton className=\"ec-checkout-preview__button\" />\n </div>\n </Card>\n ) : null}\n </>\n )}\n </div>\n );\n}\n\n/**\n * The Checkout Steps block. On the checkout page it draws the checkout from\n * the page's props in the block's layout; elsewhere (an editor preview, a\n * page with no cart to check out) it draws the preview of the steps.\n *\n * @since 1.0.0\n *\n * @param props - The layout and the core steps.\n * @returns The checkout, or its preview.\n */\nexport function CheckoutStepsBlock({\n props,\n}: StorefrontBlockComponentProps<StorefrontCheckoutStepsBlockProps>): ReactElement {\n const page = useStorefrontPage();\n\n if (CHECKOUT_PAGE === page.component && undefined !== page.props.steps) {\n const checkout = page.props as unknown as CheckoutIndexProps;\n\n return <Checkout {...checkout} layout={props.layout} />;\n }\n\n return <CheckoutPreview layout={props.layout} steps={props.steps} />;\n}\n","/**\n * The catalog commerce blocks: Product Grid, Category Grid and Product\n * Catalog.\n *\n * Each draws the component the matching storefront page draws, as the\n * Livewire blocks mount the same Livewire components.\n *\n * @since 1.0.0\n */\n\nimport type {\n CatalogCategoryShowPageProps,\n CatalogTagShowPageProps,\n SearchIndexPageProps,\n StorefrontCatalogHeader,\n StorefrontCatalogListing,\n StorefrontCategoryGrid,\n StorefrontProductCatalogBlockProps,\n StorefrontProductGrid,\n} from '@artisanpack-ui/ecommerce-storefront-core';\nimport type { ComponentType, ReactElement } from 'react';\n\nimport { ProductGrid } from '../catalog/ProductGrid';\nimport { CategoryGrid } from '../components/CategoryGrid';\nimport CatalogCategoryShow from '../pages/Catalog/CategoryShow';\nimport CatalogIndex from '../pages/Catalog/Index';\nimport CatalogTagShow from '../pages/Catalog/TagShow';\nimport SearchIndex from '../pages/Search/Index';\nimport { useStorefrontPage } from '../useStorefront';\nimport type { StorefrontBlockComponentProps } from './types';\n\n/** The catalog page, which reads only its header and listing. */\nconst CatalogPage = CatalogIndex as unknown as ComponentType<{\n header: StorefrontCatalogHeader;\n listing: StorefrontCatalogListing;\n}>;\n\n/**\n * The Product Grid block: the catalog's product grid, with quick add.\n *\n * @since 1.0.0\n *\n * @param props - The block's props and attributes.\n * @returns The grid.\n */\nexport function ProductGridBlock({\n props,\n attributes,\n}: StorefrontBlockComponentProps<StorefrontProductGrid>): ReactElement {\n const source = 'string' === typeof attributes.source ? attributes.source : '';\n\n return <ProductGrid grid={props} source={source} />;\n}\n\n/**\n * The Category Grid block: category tiles.\n *\n * @since 1.0.0\n *\n * @param props - The block's props.\n * @returns The grid, or nothing without tiles.\n */\nexport function CategoryGridBlock({\n props,\n}: StorefrontBlockComponentProps<StorefrontCategoryGrid>): ReactElement | null {\n return <CategoryGrid grid={props} />;\n}\n\n/**\n * The Product Catalog block: the listing of the page it's on.\n *\n * On the catalog, a category, a tag or the search page its `header` and\n * `listing` are null and it draws that page from the page's own props (a\n * category or tag hero drops to `<h2>` under a template's heading). Anywhere\n * else it carries the whole catalog and draws the catalog page.\n *\n * @since 1.0.0\n *\n * @param props - The block's props.\n * @returns The listing.\n */\nexport function ProductCatalogBlock({\n props,\n}: StorefrontBlockComponentProps<StorefrontProductCatalogBlockProps>): ReactElement | null {\n const page = useStorefrontPage().props;\n\n if (null !== props.header && null !== props.listing) {\n return <CatalogPage header={props.header} listing={props.listing} />;\n }\n\n if ('category' === props.page && undefined !== page.category) {\n return (\n <CatalogCategoryShow\n {...(page as unknown as CatalogCategoryShowPageProps)}\n headingLevel={props.headingLevel}\n />\n );\n }\n\n if ('tag' === props.page && undefined !== page.tag) {\n return (\n <CatalogTagShow\n {...(page as unknown as CatalogTagShowPageProps)}\n headingLevel={props.headingLevel}\n />\n );\n }\n\n if ('search' === props.page && undefined !== page.listing) {\n return <SearchIndex {...(page as unknown as SearchIndexPageProps)} />;\n }\n\n if (undefined !== page.header && undefined !== page.listing) {\n return (\n <CatalogPage\n header={page.header as StorefrontCatalogHeader}\n listing={page.listing as StorefrontCatalogListing}\n />\n );\n }\n\n return null;\n}\n","/**\n * The product commerce blocks: Single Product, Product Gallery, Price,\n * Add-to-Cart Button, Reviews, Related Products and Recently Viewed.\n *\n * Each draws the product page's own component, as the Livewire blocks do.\n *\n * @since 1.0.0\n */\n\nimport {\n __,\n type ProductShowProps,\n type StorefrontAddToCartBlockProps,\n type StorefrontGallery,\n type StorefrontProductPriceBlockProps,\n type StorefrontProductReviewsBlockProps,\n type StorefrontRecentlyViewed,\n type StorefrontRelatedProducts,\n} from '@artisanpack-ui/ecommerce-storefront-core';\nimport { Alert } from '@artisanpack-ui/react';\nimport { useMemo, type ReactElement } from 'react';\n\nimport { Gallery } from '../components/Gallery';\nimport { Price } from '../components/Price';\nimport ProductShow from '../pages/Product/Show';\nimport { registerProductBuiltIns } from '../product/builtIns';\nimport { PurchaseFormContext } from '../product/PurchaseFormContext';\nimport { RecentlyViewed } from '../product/sections/RecentlyViewed';\nimport { RelatedProductsRow } from '../product/sections/RelatedProducts';\nimport { Reviews } from '../product/sections/Reviews';\nimport { getRegistries } from '../registries';\nimport { useStorefrontPage } from '../useStorefront';\nimport { BlockPage } from './BlockPage';\nimport type { StorefrontBlockComponentProps } from './types';\n\nregisterProductBuiltIns();\n\n/**\n * The Single Product block: the whole product page. Its sections read the\n * block's props as the page's, so the related products show at once.\n *\n * @since 1.0.0\n *\n * @param props - The product page's props.\n * @returns The product.\n */\nexport function SingleProductBlock({\n props,\n}: StorefrontBlockComponentProps<ProductShowProps>): ReactElement {\n return (\n <BlockPage props={props as unknown as Record<string, unknown>}>\n <ProductShow {...props} />\n </BlockPage>\n );\n}\n\n/**\n * The Product Gallery block: the product's images.\n *\n * @since 1.0.0\n *\n * @param props - The gallery.\n * @returns The gallery.\n */\nexport function ProductGalleryBlock({\n props,\n}: StorefrontBlockComponentProps<StorefrontGallery>): ReactElement {\n return (\n <Gallery\n items={props.items}\n name={props.name}\n active={props.active}\n thumbnails={props.thumbnails}\n zoom={props.zoom}\n />\n );\n}\n\n/**\n * The Price block: the product's price at the product page's size.\n *\n * @since 1.0.0\n *\n * @param props - The price.\n * @returns The price.\n */\nexport function ProductPriceBlock({\n props,\n}: StorefrontBlockComponentProps<StorefrontProductPriceBlockProps>): ReactElement {\n return <Price price={props.price} size={props.size} data-product-price=\"\" />;\n}\n\n/**\n * The Add-to-Cart Button block: the product's purchase form from the\n * `productForms` registry, or a neutral notice when its type has none. The\n * block's `showQuantity` can hide the form's stepper, never bring back one\n * the form leaves out.\n *\n * @since 1.0.0\n *\n * @param props - The form, the product and the button text.\n * @returns The form.\n */\nexport function AddToCartBlock({\n props,\n}: StorefrontBlockComponentProps<StorefrontAddToCartBlockProps>): ReactElement | null {\n const { product, form, showQuantity, buttonText, unavailable } = props;\n const context = useMemo(\n () => ({\n productName: product.name,\n productUrl: product.url,\n variantId: null,\n announcement: null,\n notifySubscribed: false,\n buttonText,\n }),\n [product.name, product.url, buttonText],\n );\n\n if (null === form) {\n return (\n <Alert\n color=\"neutral\"\n icon=\"info\"\n title={unavailable ?? __(\"This product can't be purchased online\")}\n data-product-unavailable=\"\"\n />\n );\n }\n\n const Form = getRegistries().productForms.get(form.component)?.component;\n\n return undefined === Form ? null : (\n <PurchaseFormContext.Provider value={context}>\n <Form\n key={`${form.component}-${product.id}`}\n {...form.props}\n showQuantity={showQuantity && false !== form.props.showQuantity}\n />\n </PurchaseFormContext.Provider>\n );\n}\n\n/**\n * The Reviews block: the product's reviews, with or without the form.\n *\n * @since 1.0.0\n *\n * @param props - The product, its reviews and whether to offer the form.\n * @returns The reviews.\n */\nexport function ProductReviewsBlock({\n props,\n}: StorefrontBlockComponentProps<StorefrontProductReviewsBlockProps>): ReactElement {\n return <Reviews {...props.reviews} productId={props.product.id} allowForm={props.showForm} />;\n}\n\n/**\n * The Related Products block: related products, upsells or cross-sells.\n *\n * @since 1.0.0\n *\n * @param props - The suggestions.\n * @returns The row.\n */\nexport function RelatedProductsBlock({\n props,\n}: StorefrontBlockComponentProps<StorefrontRelatedProducts>): ReactElement {\n return <RelatedProductsRow related={props} />;\n}\n\n/**\n * A whole-number attribute, or null.\n *\n * @param value - The attribute.\n * @returns The number.\n */\nfunction numberAttribute(value: unknown): number | null {\n return 'number' === typeof value && Number.isInteger(value) && value > 0 ? value : null;\n}\n\n/**\n * The Recently Viewed block: the shopper's recently viewed products. It\n * shows the row its props carry, then loads it again from the\n * `recently-viewed` route with the block's settings, as the product page's\n * section does, so a page restored from history (or a cached page) shows\n * the shopper's history as it is now.\n *\n * @since 1.0.0\n *\n * @param props - The row, and the block's limit, columns and heading.\n * @returns The row.\n */\nexport function RecentlyViewedBlock({\n props,\n attributes,\n}: StorefrontBlockComponentProps<StorefrontRecentlyViewed>): ReactElement {\n const product = useStorefrontPage().props.product as { id?: unknown } | null | undefined;\n const heading = attributes.heading;\n\n return (\n <RecentlyViewed\n data={props}\n refresh\n productId={'number' === typeof product?.id ? product.id : null}\n limit={numberAttribute(attributes.limit)}\n columns={numberAttribute(attributes.columns)}\n heading={'string' === typeof heading && '' !== heading.trim() ? heading : null}\n />\n );\n}\n","/**\n * Gives a commerce block's components a page whose props include the\n * block's own.\n *\n * @since 1.0.0\n */\n\nimport { useMemo, type ReactElement, type ReactNode } from 'react';\n\nimport { StorefrontPageContext } from '../internal/pageContext';\nimport { useStorefrontPage } from '../useStorefront';\n\n/**\n * Props for {@link BlockPage}.\n *\n * @since 1.0.0\n */\nexport interface BlockPageProps {\n /** Props laid over the current page's (a Single Product block's product page props). */\n props: Record<string, unknown>;\n children: ReactNode;\n}\n\n/**\n * Lays `props` over the current page's props for the children, so the\n * product page's sections (reviews, related products) read a Single Product\n * block's props as they read the product page's.\n *\n * @since 1.0.0\n *\n * @param props - The props to lay over the page's, and the children.\n * @returns The children, inside the page.\n */\nexport function BlockPage({ props, children }: BlockPageProps): ReactElement {\n const page = useStorefrontPage();\n const value = useMemo(() => ({ ...page, props: { ...page.props, ...props } }), [page, props]);\n\n return <StorefrontPageContext.Provider value={value}>{children}</StorefrontPageContext.Provider>;\n}\n","/**\n * The page commerce blocks read where no storefront page is in effect.\n *\n * Storefront pages share the `ecommerceStorefront` prop, which the block\n * components read (the locale, the storefront's routes, the cart's URL). A\n * block can also sit on a page the storefront didn't render: a CMS page\n * drawn by visual-editor's renderer, or an island hydrated in a Blade page,\n * outside Inertia. There the block gets stand-in shared props built from\n * {@link configureStorefrontBlocks} and the document.\n *\n * @since 1.0.0\n */\n\nimport type { EcommerceStorefrontSharedProps } from '@artisanpack-ui/ecommerce-storefront-core';\nimport { useMemo, type ReactElement, type ReactNode } from 'react';\n\nimport { StorefrontPageContext, type StorefrontPageSnapshot } from '../internal/pageContext';\n\n/**\n * Settings for commerce blocks drawn outside the storefront's pages.\n *\n * @since 1.0.0\n */\nexport interface StorefrontBlockSettings {\n /**\n * The storefront's home URL (the catalog, `/shop` by default), which the\n * blocks build the storefront's routes from: the `blocks.props` route, the\n * cart and quick add. Storefront pages send it themselves.\n */\n storefrontUrl?: string | null;\n /** The `blocks.props` route's URL, when it isn't `{storefrontUrl}/blocks/props`. */\n propsUrl?: string | null;\n /** The locale, when the document's `lang` isn't it (`pt_BR`). */\n locale?: string;\n}\n\nlet settings: StorefrontBlockSettings = {};\n\n/**\n * Sets how commerce blocks reach the storefront from pages it didn't render.\n *\n * @since 1.0.0\n *\n * @param next - The settings; omitted keys keep their values.\n */\nexport function configureStorefrontBlocks(next: StorefrontBlockSettings): void {\n settings = { ...settings, ...next };\n}\n\n/**\n * The current block settings.\n *\n * @since 1.0.0\n *\n * @returns The settings.\n */\nexport function storefrontBlockSettings(): StorefrontBlockSettings {\n return settings;\n}\n\n/**\n * Forgets the block settings (tests).\n *\n * @since 1.0.0\n */\nexport function resetStorefrontBlockSettings(): void {\n settings = {};\n}\n\n/**\n * Stand-in `ecommerceStorefront` props for a page the storefront didn't\n * render: the locale and direction from the document, and the storefront's\n * routes from {@link configureStorefrontBlocks}. Nothing in it is the\n * shopper's (an empty cart count, no account), so the blocks only read\n * their own props for that.\n *\n * @since 1.0.0\n *\n * @returns The shared props.\n */\nexport function fallbackSharedProps(): EcommerceStorefrontSharedProps {\n const element = 'undefined' === typeof document ? null : document.documentElement;\n const base = settings.storefrontUrl?.replace(/\\/$/, '') ?? null;\n const name = 'undefined' === typeof document ? '' : document.title;\n\n return {\n locale: settings.locale ?? (element?.lang || 'en').replace('-', '_'),\n direction: 'rtl' === element?.dir ? 'rtl' : 'ltr',\n routes: {\n storefront: { namePrefix: 'artisanpack.ecommerce.storefront.', base },\n account: { namePrefix: 'artisanpack.ecommerce.account.', base: null },\n },\n toasts: [],\n seo: {\n title: null,\n description: null,\n canonical: null,\n robots: null,\n image: null,\n type: 'website',\n siteName: name,\n openGraph: false,\n schemas: [],\n },\n store: { name, mark: '', url: base ?? '/', tagline: null },\n navigation: [],\n footer: [],\n headerActions: [],\n account: null,\n auth: { login: null, register: null, logout: null, profile: null, password: null },\n search: { url: null === base ? null : `${base}/search`, shortcut: false },\n cart: { url: null === base ? null : `${base}/cart`, count: 0 },\n } as unknown as EcommerceStorefrontSharedProps;\n}\n\n/**\n * Props for {@link StorefrontBlockRoot}.\n *\n * @since 1.0.0\n */\nexport interface StorefrontBlockRootProps {\n /**\n * The page the block sits on. Leave it out on a page Inertia renders\n * (the block reads Inertia's page); give it in a React root of its own.\n */\n page?: StorefrontPageSnapshot | null;\n children: ReactNode;\n}\n\n/**\n * Gives a block the page it sits on, with stand-in shared props when that\n * page has no `ecommerceStorefront` prop.\n *\n * @since 1.0.0\n *\n * @param props - The page, and the block.\n * @returns The block, inside the page.\n */\nexport function StorefrontBlockRoot({ page, children }: StorefrontBlockRootProps): ReactElement {\n const value = useMemo((): StorefrontPageSnapshot => {\n const current = page ?? {\n component: '',\n props: {},\n url: 'undefined' === typeof window ? '/' : window.location.href,\n };\n\n return {\n ...current,\n props: {\n errors: {},\n ...current.props,\n ecommerceStorefront: current.props.ecommerceStorefront ?? fallbackSharedProps(),\n },\n };\n }, [page]);\n\n return <StorefrontPageContext.Provider value={value}>{children}</StorefrontPageContext.Provider>;\n}\n","/**\n * Commerce blocks inside a visual-editor block tree.\n *\n * visual-editor's React renderer (`@artisanpack-ui/visual-editor-renderer-react`)\n * draws a block tree by asking a registry for each block name's renderer, a\n * component that gets the block's `name` and `attributes`. Hand its\n * `registerBlockRenderer` to {@link registerStorefrontBlockRenderers} and\n * every commerce block in a tree draws with the storefront's components:\n *\n * ```tsx\n * import { registerBlockRenderer } from '@artisanpack-ui/visual-editor-renderer-react';\n * import { registerStorefrontBlockRenderers } from '@artisanpack-ui/ecommerce-storefront-react';\n *\n * registerStorefrontBlockRenderers(registerBlockRenderer);\n * ```\n *\n * A block finds its props in the templated page's `blockProps` (by the\n * `clientId` {@link storefrontTemplateTree} copied into its attributes), and\n * otherwise fetches them from the storefront's `blocks.props` route.\n *\n * @since 1.0.0\n */\n\nimport type {\n StorefrontBlockPresentation,\n StorefrontBlockPropsResponse,\n} from '@artisanpack-ui/ecommerce-storefront-core';\nimport { useEffect, useState, type ComponentType, type ReactElement } from 'react';\n\nimport { isSameOrigin } from '../internal/sameOrigin';\nimport { useStorefrontPage, useStorefrontTemplate } from '../useStorefront';\nimport { StorefrontBlockHost } from './blockHost';\nimport { StorefrontBlockRoot, storefrontBlockSettings } from './blockRoot';\nimport { StorefrontBlock, storefrontBlockNames, storefrontBlockSlug } from './StorefrontBlock';\nimport { BLOCK_CLIENT_ID_ATTRIBUTE } from './templates';\n\n/**\n * The longest attributes JSON the `blocks.props` route reads, in bytes.\n *\n * @since 1.0.0\n */\nexport const BLOCK_ATTRIBUTES_MAX_BYTES = 4096;\n\n/**\n * What a visual-editor block renderer gets (the parts the storefront reads).\n *\n * @since 1.0.0\n */\nexport interface StorefrontBlockRendererProps {\n /** The block's name. */\n name: string;\n /** The block's saved attributes. */\n attributes: Record<string, unknown>;\n}\n\n/**\n * A block's saved attributes without the private keys renderers stamp on\n * them (`_ecClientId`, visual-editor's `_ve…`).\n *\n * @since 1.0.0\n *\n * @param attributes - The attributes.\n * @returns The block's own attributes.\n */\nexport function publicBlockAttributes(\n attributes: Record<string, unknown>,\n): Record<string, unknown> {\n return Object.fromEntries(Object.entries(attributes).filter(([key]) => !key.startsWith('_')));\n}\n\n/**\n * The `blocks.props` URL for a block, or null without a storefront URL or\n * when the attributes are too long for the route.\n *\n * @since 1.0.0\n *\n * @param endpoint - The route's URL (`{storefront}/blocks/props`).\n * @param name - The block's name.\n * @param attributes - The block's attributes.\n * @param productId - The page's product, for product blocks that follow the page.\n * @param query - More query parameters the block reads (a listing's filters, a review page).\n * @returns The URL.\n */\nexport function blockPropsUrl(\n endpoint: string | null,\n name: string,\n attributes: Record<string, unknown>,\n productId: number | null = null,\n query: Record<string, string> = {},\n): string | null {\n if (null === endpoint) {\n return null;\n }\n\n const json = JSON.stringify(publicBlockAttributes(attributes));\n\n if (new TextEncoder().encode(json).length > BLOCK_ATTRIBUTES_MAX_BYTES) {\n return null;\n }\n\n const params = new URLSearchParams({ ...query, name, attributes: json });\n\n if (null !== productId && productId > 0) {\n params.set('product', String(productId));\n }\n\n return `${endpoint}${endpoint.includes('?') ? '&' : '?'}${params.toString()}`;\n}\n\n/**\n * The `blocks.props` route's URL for the current page: the configured one,\n * else the storefront's home URL followed by `/blocks/props`.\n *\n * @since 1.0.0\n *\n * @param storefrontBase - The storefront's home URL from the shared props.\n * @returns The URL, or null when it can't be built.\n */\nexport function blockPropsEndpoint(storefrontBase: string | null | undefined): string | null {\n const settings = storefrontBlockSettings();\n\n if (undefined !== settings.propsUrl && null !== settings.propsUrl) {\n return settings.propsUrl;\n }\n\n const base = storefrontBase ?? settings.storefrontUrl ?? null;\n\n return null === base ? null : `${base.replace(/\\/$/, '')}/blocks/props`;\n}\n\n/**\n * A block's presentation, as it loads.\n *\n * @since 1.0.0\n */\nexport type BlockPresentationState =\n | { status: 'loading' }\n | { status: 'ready'; presentation: StorefrontBlockPresentation | null }\n | { status: 'error' };\n\n/**\n * Fetches a block's presentation from the `blocks.props` route.\n *\n * @since 1.0.0\n *\n * @param url - The route's URL for the block ({@link blockPropsUrl}).\n * @param signal - Aborts the request.\n * @returns The presentation, or null when the block has nothing to show.\n * @throws When the request fails or the answer isn't the route's.\n */\nexport async function fetchBlockPresentation(\n url: string,\n signal?: AbortSignal,\n): Promise<StorefrontBlockPresentation | null> {\n if (!isSameOrigin(url)) {\n throw new Error('The blocks.props route must be on the same origin.');\n }\n\n const response = await fetch(url, {\n credentials: 'same-origin',\n headers: { Accept: 'application/json', 'X-Requested-With': 'XMLHttpRequest' },\n signal,\n });\n\n if (!response.ok) {\n throw new Error(`blocks.props answered ${response.status}.`);\n }\n\n const body = (await response.json()) as Partial<StorefrontBlockPropsResponse> | null;\n\n if (null === body || 'object' !== typeof body || !('block' in body)) {\n throw new Error('blocks.props answered something else.');\n }\n\n return body.block ?? null;\n}\n\n/**\n * A block's presentation: from the templated page's `blockProps` when the\n * block is in the template, else fetched from the `blocks.props` route.\n *\n * @since 1.0.0\n *\n * @param name - The block's name.\n * @param attributes - The block's attributes, as the renderer gives them.\n * @returns The presentation's state.\n */\nexport function useBlockPresentation(\n name: string,\n attributes: Record<string, unknown>,\n): BlockPresentationState {\n const page = useStorefrontPage();\n const template = useStorefrontTemplate();\n const clientId = attributes[BLOCK_CLIENT_ID_ATTRIBUTE];\n const fromTemplate =\n null !== template &&\n 'string' === typeof clientId &&\n Object.prototype.hasOwnProperty.call(template.blockProps, clientId)\n ? (template.blockProps[clientId] ?? null)\n : undefined;\n const shared = page.props.ecommerceStorefront as\n { routes?: { storefront?: { base?: string | null } } } | undefined;\n const product = page.props.product as { id?: unknown } | null | undefined;\n const productId = 'number' === typeof product?.id ? product.id : null;\n const url = blockPropsUrl(\n blockPropsEndpoint(shared?.routes?.storefront?.base),\n name,\n attributes,\n productId,\n );\n const [fetched, setFetched] = useState<{ url: string; state: BlockPresentationState } | null>(\n null,\n );\n\n useEffect(() => {\n if (undefined !== fromTemplate || null === url) {\n return;\n }\n\n const controller = new AbortController();\n\n fetchBlockPresentation(url, controller.signal).then(\n (presentation) => setFetched({ url, state: { status: 'ready', presentation } }),\n () => {\n if (!controller.signal.aborted) {\n setFetched({ url, state: { status: 'error' } });\n }\n },\n );\n\n return () => controller.abort();\n }, [fromTemplate, url]);\n\n if (undefined !== fromTemplate) {\n return { status: 'ready', presentation: fromTemplate };\n }\n\n if (null === url) {\n return { status: 'error' };\n }\n\n return null !== fetched && fetched.url === url ? fetched.state : { status: 'loading' };\n}\n\n/**\n * Draws a commerce block inside a visual-editor block tree. While its props\n * load it keeps an empty, busy wrapper; a block with nothing to show, or\n * whose props failed to load, draws nothing, as the server-rendered block\n * does on the site.\n *\n * @since 1.0.0\n *\n * @param props - The block's name and attributes.\n * @returns The block.\n */\nexport function StorefrontBlockRenderer({\n name,\n attributes,\n}: StorefrontBlockRendererProps): ReactElement | null {\n const page = useStorefrontPage();\n\n // A CMS page has no storefront props: give the block stand-ins, and a\n // host that fetches its props again after its requests.\n return undefined === page.props.ecommerceStorefront ? (\n <StorefrontBlockRoot page={page}>\n <RenderedBlock name={name} attributes={attributes} hosted />\n </StorefrontBlockRoot>\n ) : (\n <RenderedBlock name={name} attributes={attributes} />\n );\n}\n\n/**\n * The block, once the storefront props are in place.\n *\n * @param props - The block's name and attributes, and whether it needs a host.\n * @returns The block.\n */\nfunction RenderedBlock({\n name,\n attributes,\n hosted = false,\n}: StorefrontBlockRendererProps & { hosted?: boolean }): ReactElement | null {\n const state = useBlockPresentation(name, attributes);\n const [refreshed, setRefreshed] = useState<StorefrontBlockPresentation | null | undefined>(\n undefined,\n );\n\n if ('loading' === state.status && undefined === refreshed) {\n return (\n <div\n className=\"ec-commerce-block\"\n data-commerce-block={storefrontBlockSlug(name)}\n aria-busy=\"true\"\n />\n );\n }\n\n const presentation =\n undefined !== refreshed ? refreshed : 'ready' === state.status ? state.presentation : null;\n\n if (!hosted) {\n return 'error' === state.status ? null : <StorefrontBlock presentation={presentation} />;\n }\n\n return (\n <StorefrontBlockHost name={name} attributes={attributes} inertia onPresentation={setRefreshed}>\n <StorefrontBlock presentation={presentation} />\n </StorefrontBlockHost>\n );\n}\n\n/**\n * Registers {@link StorefrontBlockRenderer} for every commerce block with a\n * renderer registry, such as visual-editor's `registerBlockRenderer`.\n *\n * @since 1.0.0\n *\n * @param register - The registry's register function.\n * @param names - The block names; every built-in and registered block by default.\n */\nexport function registerStorefrontBlockRenderers(\n register: (name: string, renderer: ComponentType<StorefrontBlockRendererProps>) => void,\n names: string[] = storefrontBlockNames(),\n): void {\n for (const name of names) {\n register(name, StorefrontBlockRenderer);\n }\n}\n","/**\n * Keeps a commerce block working on a page the storefront didn't render.\n *\n * There a block's requests can't reload the storefront page's props (the\n * page has none), so {@link StorefrontBlockHost} fetches the block's props\n * again from the `blocks.props` route after each write, carries a GET's\n * query (a filter, a review page) along, and holds the validation errors\n * a write outside Inertia got back. Storefront components send their\n * requests through the router this sets up.\n *\n * @since 1.0.0\n */\n\nimport type { StorefrontBlockPresentation } from '@artisanpack-ui/ecommerce-storefront-core';\nimport {\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n type ReactElement,\n type ReactNode,\n} from 'react';\n\nimport {\n StorefrontBlockHostContext,\n StorefrontPageContext,\n type StorefrontBlockHost as BlockHost,\n type StorefrontPageSnapshot,\n} from '../internal/pageContext';\nimport { useStorefront, useStorefrontPage } from '../useStorefront';\nimport { blockPropsEndpoint, blockPropsUrl, fetchBlockPresentation } from './renderers';\n\n/**\n * The `blocks.props` route's own query keys, which a block's query leaves out.\n *\n * @since 1.0.0\n */\nexport const BLOCK_PROPS_QUERY_KEYS = ['name', 'attributes', 'product'];\n\n/**\n * A URL's query, without the `blocks.props` route's own keys.\n *\n * @since 1.0.0\n *\n * @param url - The URL.\n * @returns The query.\n */\nexport function blockQuery(url: string): Record<string, string> {\n const base = 'undefined' !== typeof window ? window.location.href : 'http://localhost';\n const query: Record<string, string> = {};\n\n new URL(url, base).searchParams.forEach((value, key) => {\n if (!BLOCK_PROPS_QUERY_KEYS.includes(key)) {\n query[key] = value;\n }\n });\n\n return query;\n}\n\n/**\n * Props for {@link StorefrontBlockHost}.\n *\n * @since 1.0.0\n */\nexport interface StorefrontBlockHostProps {\n /** The block's name. */\n name: string;\n /** The block's attributes. */\n attributes: Record<string, unknown>;\n /** The page's product, for product blocks that follow the page. */\n productId?: number | null;\n /** Inertia drew the page (a CMS page); false for an island in a plain page. */\n inertia: boolean;\n /** Takes the block's props fetched again (null when it has nothing to show). */\n onPresentation: (presentation: StorefrontBlockPresentation | null) => void;\n children: ReactNode;\n}\n\n/**\n * Hosts a commerce block on a page the storefront didn't render. Use it\n * inside {@link StorefrontBlockRoot}, which gives the stand-in shared props.\n *\n * @since 1.0.0\n *\n * @param props - The block, where it is drawn, and where its new props go.\n * @returns The block, with its host.\n */\nexport function StorefrontBlockHost({\n name,\n attributes,\n productId = null,\n inertia,\n onPresentation,\n children,\n}: StorefrontBlockHostProps): ReactElement {\n const page = useStorefrontPage();\n const base = useStorefront().routes?.storefront?.base ?? null;\n const [url, setUrl] = useState<string | null>(null);\n const [plainErrors, setPlainErrors] = useState<Record<string, string>>({});\n const [bagged, setBagged] = useState<Record<string, Record<string, string>>>({});\n const latest = useRef({ name, attributes, productId, base, url, onPresentation });\n\n useEffect(() => {\n latest.current = { name, attributes, productId, base, url, onPresentation };\n });\n\n const pending = useRef<AbortController | null>(null);\n\n useEffect(() => () => pending.current?.abort(), []);\n\n // Only the newest refresh lands: a newer one aborts the one before, so\n // an older answer can't overwrite a newer query's. Resolves false for a\n // refresh a newer one superseded.\n const refresh = useCallback(async (next?: string | null): Promise<boolean> => {\n const current = latest.current;\n const target = next ?? current.url;\n const propsUrl = blockPropsUrl(\n blockPropsEndpoint(current.base),\n current.name,\n current.attributes,\n current.productId,\n null === target ? {} : blockQuery(target),\n );\n\n if (null === propsUrl) {\n return true;\n }\n\n if (null !== target) {\n setUrl(target);\n }\n\n pending.current?.abort();\n\n const controller = new AbortController();\n\n pending.current = controller;\n\n let presentation: StorefrontBlockPresentation | null;\n\n try {\n presentation = await fetchBlockPresentation(propsUrl, controller.signal);\n } catch (error) {\n if (controller.signal.aborted) {\n return false;\n }\n\n throw error;\n }\n\n if (controller.signal.aborted) {\n return false;\n }\n\n current.onPresentation(presentation);\n\n return true;\n }, []);\n\n const setErrors = useCallback((bag: string | null, errors: Record<string, string>) => {\n if (null === bag) {\n setPlainErrors(errors);\n } else {\n setBagged((previous) => ({ ...previous, [bag]: errors }));\n }\n }, []);\n\n const host = useMemo<BlockHost>(\n () => ({ inertia, refresh, setErrors }),\n [inertia, refresh, setErrors],\n );\n\n const snapshot = useMemo((): StorefrontPageSnapshot => {\n const errors = page.props.errors;\n\n return {\n ...page,\n url: url ?? page.url,\n props: {\n ...page.props,\n errors: {\n ...(null !== errors && 'object' === typeof errors ? errors : {}),\n ...plainErrors,\n ...bagged,\n },\n },\n };\n }, [page, url, plainErrors, bagged]);\n\n return (\n <StorefrontBlockHostContext.Provider value={host}>\n <StorefrontPageContext.Provider value={snapshot}>{children}</StorefrontPageContext.Provider>\n </StorefrontBlockHostContext.Provider>\n );\n}\n","/**\n * Hydrates the commerce block islands the server printed.\n *\n * When visual-editor renders a commerce block on the server (its block\n * preview, or a renderer's dynamic-block fallback), the block prints an\n * island: a `[data-ec-block]` element carrying its name, clamped attributes\n * and props as JSON around a plain-HTML fallback. {@link hydrateStorefrontBlocks}\n * finds the islands under a root, fetches each one's props from the\n * `blocks.props` route, and draws it with its block's component in a React\n * root of its own, replacing the fallback.\n *\n * @since 1.0.0\n */\n\nimport type {\n StorefrontBlockName,\n StorefrontBlockPresentation,\n} from '@artisanpack-ui/ecommerce-storefront-core';\nimport { createRoot, type Root } from 'react-dom/client';\n\nimport { useState, type ReactElement } from 'react';\n\nimport type { StorefrontPageSnapshot } from '../internal/pageContext';\nimport { StorefrontBlockHost } from './blockHost';\nimport { StorefrontBlockRoot } from './blockRoot';\nimport { blockPropsEndpoint, blockPropsUrl, fetchBlockPresentation } from './renderers';\nimport { getStorefrontBlock, StorefrontBlockBody } from './StorefrontBlock';\n\n/**\n * The selector for an island.\n *\n * @since 1.0.0\n */\nexport const BLOCK_ISLAND_SELECTOR = '[data-ec-block]';\n\n/**\n * The attribute a hydrated island carries, so it isn't hydrated twice.\n *\n * @since 1.0.0\n */\nexport const BLOCK_ISLAND_HYDRATED = 'data-ec-block-hydrated';\n\n/**\n * Options for {@link hydrateStorefrontBlocks}.\n *\n * @since 1.0.0\n */\nexport interface HydrateStorefrontBlocksOptions {\n /**\n * The page the islands sit on: an Inertia page's component, props and URL\n * (pass `usePage()`'s, or the page object from `createInertiaApp()`), so\n * a block reads the page's `ecommerceStorefront` props. Leave it out on a\n * page Inertia didn't render: the blocks get stand-in shared props (see\n * `configureStorefrontBlocks()`).\n */\n page?: StorefrontPageSnapshot | null;\n /** Hydrate only the islands marked `data-ec-block-interactive`. */\n interactiveOnly?: boolean;\n}\n\n/**\n * What an island's markup is trusted to say: which block it is, its\n * attributes and whether it takes input. Its props are not read from the\n * markup (see {@link hydrateStorefrontBlocks}).\n *\n * @since 1.0.0\n */\nexport interface StorefrontBlockIsland {\n /** The block's name, one this package draws. */\n name: StorefrontBlockName;\n /** The block's attributes, which the `blocks.props` route clamps again. */\n attributes: Record<string, unknown>;\n /** Marked `data-ec-block-interactive`. */\n interactive: boolean;\n}\n\n/**\n * The name an island must carry: `artisanpack-commerce/` and a slug.\n *\n * @since 1.0.0\n */\nexport const BLOCK_ISLAND_NAME = /^artisanpack-commerce\\/[a-z0-9-]{1,64}$/;\n\n/**\n * Reads an island's name, attributes and interactive flag from its data\n * attributes, or null when the element isn't a commerce block island this\n * package draws. `data-ec-block-props` is ignored.\n *\n * @since 1.0.0\n *\n * @param element - The `[data-ec-block]` element.\n * @returns The island.\n */\nexport function readBlockIsland(element: HTMLElement): StorefrontBlockIsland | null {\n const name = element.dataset.ecBlock ?? '';\n\n if (!BLOCK_ISLAND_NAME.test(name) || undefined === getStorefrontBlock(name)) {\n return null;\n }\n\n let attributes: Record<string, unknown> = {};\n\n try {\n const parsed: unknown = JSON.parse(element.dataset.ecBlockAttributes ?? '{}');\n\n if (null !== parsed && 'object' === typeof parsed && !Array.isArray(parsed)) {\n attributes = parsed as Record<string, unknown>;\n }\n } catch {\n attributes = {};\n }\n\n return {\n name: name as StorefrontBlockName,\n attributes,\n interactive: undefined !== element.dataset.ecBlockInteractive,\n };\n}\n\n/**\n * An island's block. On a storefront page it is the block itself; on a page\n * the storefront didn't render it gets a host, which fetches its props\n * again after its requests (Inertia's when the page has an Inertia page,\n * else JSON requests).\n *\n * @param props - The island's presentation, whether it needs a host and whether Inertia drew the page.\n * @returns The block.\n */\nfunction IslandBlock({\n presentation: initial,\n hosted,\n inertia,\n}: {\n presentation: StorefrontBlockPresentation;\n hosted: boolean;\n inertia: boolean;\n}): ReactElement {\n const [presentation, setPresentation] = useState<StorefrontBlockPresentation | null>(initial);\n\n if (!hosted) {\n return <StorefrontBlockBody presentation={presentation} />;\n }\n\n return (\n <StorefrontBlockHost\n name={initial.name}\n attributes={initial.attributes}\n inertia={inertia}\n onPresentation={setPresentation}\n >\n <StorefrontBlockBody presentation={presentation} />\n </StorefrontBlockHost>\n );\n}\n\n/**\n * The `blocks.props` URL for an island on a page.\n *\n * @param island - The island.\n * @param page - The page it sits on.\n * @returns The URL, or null when the storefront's URL isn't known.\n */\nfunction islandPropsUrl(\n island: StorefrontBlockIsland,\n page: StorefrontPageSnapshot | null,\n): string | null {\n const shared = page?.props.ecommerceStorefront as\n { routes?: { storefront?: { base?: string | null } } } | undefined;\n const product = page?.props.product as { id?: unknown } | null | undefined;\n\n return blockPropsUrl(\n blockPropsEndpoint(shared?.routes?.storefront?.base),\n island.name,\n island.attributes,\n 'number' === typeof product?.id ? product.id : null,\n );\n}\n\n/**\n * Hydrates the commerce block islands under `root` that aren't hydrated\n * yet.\n *\n * Each island's props come from the `blocks.props` route, not from its\n * `data-ec-block-props`. Anything that can put markup on the page (a\n * content author's rich text, a sanitizer that keeps `data-*` attributes)\n * could print an island of its own, and the props of several blocks hold\n * HTML (product descriptions) and URLs the block posts to. From the markup\n * only the block's name, its attributes, which the server clamps to the\n * block's schema, and the interactive flag are read; the server answers\n * with the props for those, as it would for its own island. The fallback\n * stays until they arrive, and stays for good when the request fails, the\n * block has nothing to show, or the storefront's URL isn't known (call\n * `configureStorefrontBlocks()` on a page Inertia didn't render).\n *\n * @since 1.0.0\n *\n * @param root - Where to look; the document by default.\n * @param options - The page the islands sit on, and whether to skip display blocks.\n * @returns Stops pending requests and unmounts the islands this call hydrated (their elements are left empty).\n */\nexport function hydrateStorefrontBlocks(\n root: ParentNode = document,\n options: HydrateStorefrontBlocksOptions = {},\n): () => void {\n const page = options.page ?? null;\n const roots: Array<{ element: HTMLElement; root: Root }> = [];\n const pending: Array<{ element: HTMLElement; controller: AbortController }> = [];\n let disposed = false;\n\n const mount = (element: HTMLElement, presentation: StorefrontBlockPresentation): void => {\n // The fallback (and the server's sample notice) gives way to the\n // component, which draws its own sample notice.\n element.replaceChildren();\n\n const island = createRoot(element);\n\n island.render(\n <StorefrontBlockRoot page={page}>\n <IslandBlock\n presentation={presentation}\n hosted={undefined === page?.props.ecommerceStorefront}\n inertia={null !== page}\n />\n </StorefrontBlockRoot>,\n );\n roots.push({ element, root: island });\n };\n\n for (const element of Array.from(root.querySelectorAll<HTMLElement>(BLOCK_ISLAND_SELECTOR))) {\n if (element.hasAttribute(BLOCK_ISLAND_HYDRATED)) {\n continue;\n }\n\n const island = readBlockIsland(element);\n\n if (null === island || (options.interactiveOnly && !island.interactive)) {\n continue;\n }\n\n const url = islandPropsUrl(island, page);\n\n if (null === url) {\n continue;\n }\n\n const controller = new AbortController();\n\n element.setAttribute(BLOCK_ISLAND_HYDRATED, '');\n pending.push({ element, controller });\n\n fetchBlockPresentation(url, controller.signal).then(\n (presentation) => {\n if (disposed) {\n return;\n }\n\n // The server answers for the name the island asked for; anything\n // else, or nothing to show, keeps the fallback.\n if (null === presentation || presentation.name !== island.name) {\n return;\n }\n\n mount(element, presentation);\n },\n () => undefined,\n );\n }\n\n return () => {\n disposed = true;\n\n for (const { controller } of pending) {\n controller.abort();\n }\n\n for (const { element } of pending) {\n element.removeAttribute(BLOCK_ISLAND_HYDRATED);\n }\n\n for (const { root: island } of roots) {\n island.unmount();\n }\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA;AAAA,EACE;AAAA,EACA;AAAA,OACK;;;ACIP,SAAS,oBAAoB;AAC7B,SAAS,aAAa;AACtB,SAAS,WAAAA,gBAAsE;;;ACK/E,SAAS,eAAkD;AAyGlD;AAhGF,IAAM,4BAA4B;AAYzC,IAAI,WAA8C;AAiB3C,SAAS,8BAA8B,MAA+C;AAC3F,aAAW;AACb;AASO,SAAS,gCAAmE;AACjF,SAAO;AACT;AAY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W;AAEX,eAAW,EAAE,WAAW,KAAK,SAAS;AACpC,iBAAW,MAAM;AAAA,IACnB;AAEA,eAAW,EAAE,QAAQ,KAAK,SAAS;AACjC,cAAQ,gBAAgB,qBAAqB;AAAA,IAC/C;AAEA,eAAW,EAAE,MAAM,OAAO,KAAK,OAAO;AACpC,aAAO,QAAQ;AAAA,IACjB;AAAA,EACF;AACF;","names":["useMemo","jsx","useMemo","jsx","__","jsx","jsxs","__","__","useId","jsx","jsxs","useId","__","__","jsx","jsxs","__","Badge","__","Card","Icon","Skeleton","jsx","jsxs","__","Card","Icon","Skeleton","jsx","__","useMemo","useMemo","jsx","useMemo","jsx","useMemo","__","Fragment","jsx","jsxs","Badge","__","useMemo","jsx","useMemo","useEffect","useState","useMemo","jsx","useMemo","jsx","settings","useState","useEffect","useState","jsx","useState"]}
package/package.json CHANGED
@@ -1,6 +1,114 @@
1
1
  {
2
2
  "name": "@artisanpack-ui/ecommerce-storefront-react",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.0.0",
4
+ "description": "React pages and components for the ArtisanPack UI ecommerce storefront on Inertia, matching ecommerce-storefront-livewire element for element.",
5
+ "license": "MIT",
6
+ "author": "Jacob Martella <me@jacobmartella.com>",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/ArtisanPack-UI/ecommerce-storefront-react.git"
10
+ },
11
+ "bugs": {
12
+ "url": "https://github.com/ArtisanPack-UI/ecommerce-storefront-react/issues"
13
+ },
14
+ "homepage": "https://github.com/ArtisanPack-UI/ecommerce-storefront-react#readme",
15
+ "keywords": [
16
+ "artisanpack-ui",
17
+ "ecommerce",
18
+ "storefront",
19
+ "inertia",
20
+ "react"
21
+ ],
22
+ "type": "module",
23
+ "sideEffects": false,
24
+ "main": "./dist/index.mjs",
25
+ "module": "./dist/index.mjs",
26
+ "types": "./dist/index.d.ts",
27
+ "exports": {
28
+ ".": {
29
+ "types": "./dist/index.d.ts",
30
+ "import": "./dist/index.mjs"
31
+ },
32
+ "./package.json": "./package.json"
33
+ },
34
+ "files": [
35
+ "dist",
36
+ "README.md",
37
+ "LICENSE"
38
+ ],
39
+ "engines": {
40
+ "node": ">=20.0.0"
41
+ },
42
+ "scripts": {
43
+ "build": "tsup",
44
+ "clean": "rm -rf dist",
45
+ "type-check": "tsc --noEmit",
46
+ "lint": "eslint src tests .storybook gates fixtures",
47
+ "format": "prettier --write \"{src,tests,.storybook,gates,fixtures}/**/*.{ts,tsx}\"",
48
+ "format:check": "prettier --check \"{src,tests,.storybook,gates,fixtures}/**/*.{ts,tsx}\"",
49
+ "test": "vitest run",
50
+ "test:watch": "vitest",
51
+ "test:coverage": "vitest run --coverage",
52
+ "version:check": "node scripts/check-versions.mjs",
53
+ "i18n:check": "node scripts/i18n.mjs",
54
+ "storybook": "storybook dev -p 6007",
55
+ "build-storybook": "storybook build",
56
+ "prepublishOnly": "npm run clean && npm run build"
57
+ },
58
+ "dependencies": {
59
+ "@artisanpack-ui/hooks-js": "^1.0.0"
60
+ },
61
+ "peerDependencies": {
62
+ "@artisanpack-ui/behavior": "^1.0.0",
63
+ "@artisanpack-ui/css": "^1.0.0",
64
+ "@artisanpack-ui/ecommerce-storefront-core": "^1.0.0",
65
+ "@artisanpack-ui/react": "^2.1.0",
66
+ "@inertiajs/react": "^2.0.0 || ^3.0.0",
67
+ "@stripe/stripe-js": "^10.0.0",
68
+ "react": "^18.0.0 || ^19.0.0",
69
+ "react-dom": "^18.0.0 || ^19.0.0"
70
+ },
71
+ "peerDependenciesMeta": {
72
+ "@stripe/stripe-js": {
73
+ "optional": true
74
+ }
75
+ },
76
+ "publishConfig": {
77
+ "access": "public"
78
+ },
79
+ "devDependencies": {
80
+ "@artisanpack-ui/behavior": "^1.0.0",
81
+ "@artisanpack-ui/css": "^1.0.0",
82
+ "@artisanpack-ui/ecommerce-storefront-core": "^1.0.0",
83
+ "@artisanpack-ui/manifest": "^1.0.0",
84
+ "@artisanpack-ui/react": "^2.1.0",
85
+ "@artisanpack-ui/testing": "^1.0.0",
86
+ "@eslint/js": "^9.39.5",
87
+ "@inertiajs/react": "^3.11.0",
88
+ "@storybook/addon-a11y": "^10.6.10",
89
+ "@storybook/addon-docs": "^10.6.10",
90
+ "@storybook/react-vite": "^10.6.10",
91
+ "@stripe/stripe-js": "^10.5.0",
92
+ "@testing-library/jest-dom": "^6.9.1",
93
+ "@testing-library/react": "^16.3.3",
94
+ "@testing-library/user-event": "^14.6.14",
95
+ "@types/react": "^19.3.3",
96
+ "@types/react-dom": "^19.3.0",
97
+ "@vitejs/plugin-react": "^5.2.0",
98
+ "@vitest/coverage-v8": "^4.1.12",
99
+ "eslint": "^9.39.5",
100
+ "eslint-plugin-react": "^7.37.5",
101
+ "eslint-plugin-react-hooks": "^7.1.1",
102
+ "eslint-plugin-storybook": "^10.6.10",
103
+ "jsdom": "^29.1.1",
104
+ "prettier": "^3.10.2",
105
+ "react": "^19.3.1",
106
+ "react-dom": "^19.3.1",
107
+ "storybook": "^10.6.10",
108
+ "tsup": "^8.5.1",
109
+ "typescript": "^5.9.3",
110
+ "typescript-eslint": "^8.74.0",
111
+ "vite": "^7.3.8",
112
+ "vitest": "^4.1.12"
113
+ }
114
+ }