@fayz-ai/storefront 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/app/createStorefrontApp.d.ts +65 -0
- package/dist/app/createStorefrontApp.d.ts.map +1 -0
- package/dist/{define.d.ts → app/define.d.ts} +3 -3
- package/dist/app/define.d.ts.map +1 -0
- package/dist/app/hydration.d.ts +37 -0
- package/dist/app/hydration.d.ts.map +1 -0
- package/dist/app/prerender.d.ts +57 -0
- package/dist/app/prerender.d.ts.map +1 -0
- package/dist/{router.d.ts → app/router.d.ts} +140 -113
- package/dist/app/router.d.ts.map +1 -0
- package/dist/{scaffold.d.ts → app/scaffold.d.ts} +2 -2
- package/dist/app/scaffold.d.ts.map +1 -0
- package/dist/app/serving.d.ts +70 -0
- package/dist/app/serving.d.ts.map +1 -0
- package/dist/app/static-render.d.ts +46 -0
- package/dist/app/static-render.d.ts.map +1 -0
- package/dist/blocks/block-at-path.d.ts +59 -0
- package/dist/blocks/block-at-path.d.ts.map +1 -0
- package/dist/blocks/page-blocks.d.ts +163 -0
- package/dist/blocks/page-blocks.d.ts.map +1 -0
- package/dist/blocks/page-data.d.ts +105 -0
- package/dist/blocks/page-data.d.ts.map +1 -0
- package/dist/{blocks.d.ts → blocks/registry.d.ts} +1 -1
- package/dist/blocks/registry.d.ts.map +1 -0
- package/dist/{sections.d.ts → blocks/sections.d.ts} +40 -2
- package/dist/blocks/sections.d.ts.map +1 -0
- package/dist/chunk-6B7H3IZ6.js +10232 -0
- package/dist/chunk-6B7H3IZ6.js.map +1 -0
- package/dist/chunk-6IXTENLB.js +162 -0
- package/dist/chunk-6IXTENLB.js.map +1 -0
- package/dist/components/PaymentTerms.d.ts +34 -0
- package/dist/components/PaymentTerms.d.ts.map +1 -0
- package/dist/components/SmoothImage.d.ts +1 -1
- package/dist/components/SmoothImage.d.ts.map +1 -1
- package/dist/components/account/CustomerAccountShell.d.ts.map +1 -0
- package/dist/components/account/SignInModal.d.ts.map +1 -0
- package/dist/components/cart/CartDrawer.d.ts.map +1 -0
- package/dist/components/cart/QuantityInput.d.ts.map +1 -0
- package/dist/components/checkout/DeliveryEstimator.d.ts.map +1 -0
- package/dist/components/collection/CategoryShowcase.d.ts +44 -0
- package/dist/components/collection/CategoryShowcase.d.ts.map +1 -0
- package/dist/components/collection/FiltersPanel.d.ts +19 -0
- package/dist/components/collection/FiltersPanel.d.ts.map +1 -0
- package/dist/components/collection/ProductGrid.d.ts.map +1 -0
- package/dist/components/layout/PageBodyBlocks.d.ts +40 -0
- package/dist/components/layout/PageBodyBlocks.d.ts.map +1 -0
- package/dist/components/layout/SearchOverlay.d.ts +13 -0
- package/dist/components/layout/SearchOverlay.d.ts.map +1 -0
- package/dist/components/layout/StorefrontErrorBoundary.d.ts.map +1 -0
- package/dist/components/layout/StorefrontFooter.d.ts.map +1 -0
- package/dist/components/layout/StorefrontHeader.d.ts.map +1 -0
- package/dist/components/layout/Toaster.d.ts.map +1 -0
- package/dist/components/marketing/CollectionSections.d.ts +463 -0
- package/dist/components/marketing/CollectionSections.d.ts.map +1 -0
- package/dist/components/marketing/ConversionSections.d.ts +221 -0
- package/dist/components/marketing/ConversionSections.d.ts.map +1 -0
- package/dist/components/marketing/EditorialSections.d.ts +248 -0
- package/dist/components/marketing/EditorialSections.d.ts.map +1 -0
- package/dist/components/marketing/EntityList.d.ts +97 -0
- package/dist/components/marketing/EntityList.d.ts.map +1 -0
- package/dist/components/marketing/FormBlock.d.ts +167 -0
- package/dist/components/marketing/FormBlock.d.ts.map +1 -0
- package/dist/components/marketing/HeroSection.d.ts +125 -0
- package/dist/components/marketing/HeroSection.d.ts.map +1 -0
- package/dist/components/marketing/MediaCarousel.d.ts +135 -0
- package/dist/components/marketing/MediaCarousel.d.ts.map +1 -0
- package/dist/components/marketing/MiscSections.d.ts +252 -0
- package/dist/components/marketing/MiscSections.d.ts.map +1 -0
- package/dist/components/order/OrderTrackingTimeline.d.ts.map +1 -0
- package/dist/components/product/ProductCard.d.ts +14 -0
- package/dist/components/product/ProductCard.d.ts.map +1 -0
- package/dist/components/product/ProductEnquiryForm.d.ts.map +1 -0
- package/dist/components/product/ProductGallery.d.ts +36 -0
- package/dist/components/product/ProductGallery.d.ts.map +1 -0
- package/dist/components/{ProductOptionSelector.d.ts → product/ProductOptionSelector.d.ts} +1 -1
- package/dist/components/product/ProductOptionSelector.d.ts.map +1 -0
- package/dist/components/product/ProductRail.d.ts +93 -0
- package/dist/components/product/ProductRail.d.ts.map +1 -0
- package/dist/components/product/ProductReviews.d.ts +39 -0
- package/dist/components/product/ProductReviews.d.ts.map +1 -0
- package/dist/components/product/ProductSlider.d.ts +169 -0
- package/dist/components/product/ProductSlider.d.ts.map +1 -0
- package/dist/components/product/ProductSpecs.d.ts.map +1 -0
- package/dist/components/product/RelatedProducts.d.ts.map +1 -0
- package/dist/{auth.d.ts → data/auth.d.ts} +9 -0
- package/dist/data/auth.d.ts.map +1 -0
- package/dist/data/facets.d.ts +39 -0
- package/dist/data/facets.d.ts.map +1 -0
- package/dist/data/loaders.d.ts +56 -0
- package/dist/data/loaders.d.ts.map +1 -0
- package/dist/data/order-status.d.ts.map +1 -0
- package/dist/data/product-options.d.ts +36 -0
- package/dist/data/product-options.d.ts.map +1 -0
- package/dist/diagnostics/seo-audit.d.ts +54 -0
- package/dist/diagnostics/seo-audit.d.ts.map +1 -0
- package/dist/diagnostics/seo-audit.js +3 -0
- package/dist/diagnostics/seo-audit.js.map +1 -0
- package/dist/document/change.d.ts +100 -0
- package/dist/document/change.d.ts.map +1 -0
- package/dist/{config.d.ts → document/config.d.ts} +126 -7
- package/dist/document/config.d.ts.map +1 -0
- package/dist/document/describe.d.ts +135 -0
- package/dist/document/describe.d.ts.map +1 -0
- package/dist/document/overlay.d.ts +58 -0
- package/dist/document/overlay.d.ts.map +1 -0
- package/dist/{presets.d.ts → document/presets.d.ts} +2 -2
- package/dist/document/presets.d.ts.map +1 -0
- package/dist/document/render.d.ts +171 -0
- package/dist/document/render.d.ts.map +1 -0
- package/dist/document/round-trip.d.ts +46 -0
- package/dist/document/round-trip.d.ts.map +1 -0
- package/dist/document/sections.d.ts +194 -0
- package/dist/document/sections.d.ts.map +1 -0
- package/dist/document/upgrade.d.ts +112 -0
- package/dist/document/upgrade.d.ts.map +1 -0
- package/dist/document/validate.d.ts +24 -0
- package/dist/document/validate.d.ts.map +1 -0
- package/dist/{component-contracts.d.ts → extend/component-contracts.d.ts} +74 -22
- package/dist/extend/component-contracts.d.ts.map +1 -0
- package/dist/extend/component-override.d.ts +38 -0
- package/dist/extend/component-override.d.ts.map +1 -0
- package/dist/extend/component-selectors.d.ts.map +1 -0
- package/dist/extend/editor-bridge.d.ts +59 -0
- package/dist/extend/editor-bridge.d.ts.map +1 -0
- package/dist/extend/extension-points.d.ts +103 -0
- package/dist/extend/extension-points.d.ts.map +1 -0
- package/dist/extend/slots.d.ts +216 -0
- package/dist/extend/slots.d.ts.map +1 -0
- package/dist/hooks/index.d.ts +25 -6
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/use-address.d.ts +26 -0
- package/dist/hooks/use-address.d.ts.map +1 -0
- package/dist/hooks/use-cart.d.ts +3 -0
- package/dist/hooks/use-cart.d.ts.map +1 -0
- package/dist/hooks/use-catalog.d.ts +24 -0
- package/dist/hooks/use-catalog.d.ts.map +1 -0
- package/dist/hooks/use-categories.d.ts +19 -0
- package/dist/hooks/use-categories.d.ts.map +1 -0
- package/dist/hooks/use-checkout.d.ts +41 -0
- package/dist/hooks/use-checkout.d.ts.map +1 -0
- package/dist/hooks/use-discount-validator.d.ts +20 -0
- package/dist/hooks/use-discount-validator.d.ts.map +1 -0
- package/dist/hooks/use-enquiry.d.ts +7 -0
- package/dist/hooks/use-enquiry.d.ts.map +1 -0
- package/dist/hooks/{useMyOrders.d.ts → use-my-orders.d.ts} +1 -1
- package/dist/hooks/use-my-orders.d.ts.map +1 -0
- package/dist/hooks/use-order.d.ts +17 -0
- package/dist/hooks/use-order.d.ts.map +1 -0
- package/dist/hooks/use-payment-methods.d.ts +19 -0
- package/dist/hooks/use-payment-methods.d.ts.map +1 -0
- package/dist/hooks/use-policies.d.ts +25 -0
- package/dist/hooks/use-policies.d.ts.map +1 -0
- package/dist/hooks/use-product.d.ts +15 -0
- package/dist/hooks/use-product.d.ts.map +1 -0
- package/dist/hooks/{useProducts.d.ts → use-products.d.ts} +1 -1
- package/dist/hooks/use-products.d.ts.map +1 -0
- package/dist/hooks/use-region.d.ts +15 -0
- package/dist/hooks/use-region.d.ts.map +1 -0
- package/dist/hooks/use-shipping.d.ts +29 -0
- package/dist/hooks/use-shipping.d.ts.map +1 -0
- package/dist/hooks/use-storefront-actions.d.ts +12 -0
- package/dist/hooks/use-storefront-actions.d.ts.map +1 -0
- package/dist/hooks/use-storefront-head.d.ts +19 -0
- package/dist/hooks/use-storefront-head.d.ts.map +1 -0
- package/dist/hooks/use-storefront.d.ts +3 -0
- package/dist/hooks/use-storefront.d.ts.map +1 -0
- package/dist/index.d.ts +123 -54
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1311 -5012
- package/dist/index.js.map +1 -1
- package/dist/lib/format.d.ts.map +1 -0
- package/dist/lib/motion.d.ts.map +1 -0
- package/dist/lib/seo.d.ts +26 -0
- package/dist/lib/seo.d.ts.map +1 -0
- package/dist/{testids.d.ts → lib/testids.d.ts} +21 -0
- package/dist/lib/testids.d.ts.map +1 -0
- package/dist/{theme.d.ts → lib/theme.d.ts} +41 -3
- package/dist/lib/theme.d.ts.map +1 -0
- package/dist/render.d.ts +5 -0
- package/dist/render.d.ts.map +1 -0
- package/dist/render.js +359 -0
- package/dist/render.js.map +1 -0
- package/dist/stores/cart.store.d.ts +6 -2
- package/dist/stores/cart.store.d.ts.map +1 -1
- package/dist/stores/catalog.store.d.ts +11 -0
- package/dist/stores/catalog.store.d.ts.map +1 -1
- package/dist/views/CatalogPage.d.ts.map +1 -0
- package/dist/views/CheckoutPage.d.ts.map +1 -0
- package/dist/views/ContentPage.d.ts +11 -0
- package/dist/views/ContentPage.d.ts.map +1 -0
- package/dist/views/HomePage.d.ts +9 -0
- package/dist/views/HomePage.d.ts.map +1 -0
- package/dist/views/MyPurchasesPage.d.ts.map +1 -0
- package/dist/views/NotFoundPage.d.ts.map +1 -0
- package/dist/{pages → views}/OrderConfirmationPage.d.ts.map +1 -1
- package/dist/{pages → views}/PolicyPage.d.ts.map +1 -1
- package/dist/views/ProductDetailPage.d.ts.map +1 -0
- package/dist/views/StorefrontPage.d.ts +35 -0
- package/dist/views/StorefrontPage.d.ts.map +1 -0
- package/dist/workflows/checkout.d.ts +1 -1
- package/dist/workflows/checkout.d.ts.map +1 -1
- package/package.json +21 -14
- package/dist/auth.d.ts.map +0 -1
- package/dist/blocks.d.ts.map +0 -1
- package/dist/component-contracts.d.ts.map +0 -1
- package/dist/component-selectors.d.ts.map +0 -1
- package/dist/components/CartDrawer.d.ts.map +0 -1
- package/dist/components/CustomerAccountShell.d.ts.map +0 -1
- package/dist/components/DeliveryEstimator.d.ts.map +0 -1
- package/dist/components/FiltersPanel.d.ts +0 -3
- package/dist/components/FiltersPanel.d.ts.map +0 -1
- package/dist/components/OrderTrackingTimeline.d.ts.map +0 -1
- package/dist/components/ProductCard.d.ts +0 -4
- package/dist/components/ProductCard.d.ts.map +0 -1
- package/dist/components/ProductEnquiryForm.d.ts.map +0 -1
- package/dist/components/ProductGallery.d.ts +0 -22
- package/dist/components/ProductGallery.d.ts.map +0 -1
- package/dist/components/ProductGrid.d.ts.map +0 -1
- package/dist/components/ProductOptionSelector.d.ts.map +0 -1
- package/dist/components/ProductSpecs.d.ts.map +0 -1
- package/dist/components/QuantityInput.d.ts.map +0 -1
- package/dist/components/RelatedProducts.d.ts.map +0 -1
- package/dist/components/SignInModal.d.ts.map +0 -1
- package/dist/components/StorefrontErrorBoundary.d.ts.map +0 -1
- package/dist/components/StorefrontFooter.d.ts.map +0 -1
- package/dist/components/StorefrontHeader.d.ts.map +0 -1
- package/dist/components/Toaster.d.ts.map +0 -1
- package/dist/components/sections/CategoryShowcase.d.ts +0 -6
- package/dist/components/sections/CategoryShowcase.d.ts.map +0 -1
- package/dist/components/sections/HeroSection.d.ts +0 -9
- package/dist/components/sections/HeroSection.d.ts.map +0 -1
- package/dist/components/sections/MediaCarousel.d.ts +0 -11
- package/dist/components/sections/MediaCarousel.d.ts.map +0 -1
- package/dist/components/sections/MiscSections.d.ts +0 -33
- package/dist/components/sections/MiscSections.d.ts.map +0 -1
- package/dist/components/sections/ProductRail.d.ts +0 -9
- package/dist/components/sections/ProductRail.d.ts.map +0 -1
- package/dist/components/sections/ProductSlider.d.ts +0 -15
- package/dist/components/sections/ProductSlider.d.ts.map +0 -1
- package/dist/config.d.ts.map +0 -1
- package/dist/createStorefrontApp.d.ts +0 -28
- package/dist/createStorefrontApp.d.ts.map +0 -1
- package/dist/define.d.ts.map +0 -1
- package/dist/format.d.ts.map +0 -1
- package/dist/hooks/useCategories.d.ts +0 -6
- package/dist/hooks/useCategories.d.ts.map +0 -1
- package/dist/hooks/useDiscountValidator.d.ts +0 -14
- package/dist/hooks/useDiscountValidator.d.ts.map +0 -1
- package/dist/hooks/useMyOrders.d.ts.map +0 -1
- package/dist/hooks/useProduct.d.ts +0 -7
- package/dist/hooks/useProduct.d.ts.map +0 -1
- package/dist/hooks/useProducts.d.ts.map +0 -1
- package/dist/hooks/useStorefront.d.ts +0 -35
- package/dist/hooks/useStorefront.d.ts.map +0 -1
- package/dist/hooks/useStorefrontHead.d.ts +0 -11
- package/dist/hooks/useStorefrontHead.d.ts.map +0 -1
- package/dist/motion.d.ts.map +0 -1
- package/dist/order-status.d.ts.map +0 -1
- package/dist/pages/CatalogPage.d.ts.map +0 -1
- package/dist/pages/CheckoutPage.d.ts.map +0 -1
- package/dist/pages/HomePage.d.ts +0 -9
- package/dist/pages/HomePage.d.ts.map +0 -1
- package/dist/pages/MyPurchasesPage.d.ts.map +0 -1
- package/dist/pages/NotFoundPage.d.ts.map +0 -1
- package/dist/pages/ProductDetailPage.d.ts.map +0 -1
- package/dist/presets.d.ts.map +0 -1
- package/dist/product-options.d.ts +0 -12
- package/dist/product-options.d.ts.map +0 -1
- package/dist/router.d.ts.map +0 -1
- package/dist/scaffold.d.ts.map +0 -1
- package/dist/sections.d.ts.map +0 -1
- package/dist/testids.d.ts.map +0 -1
- package/dist/theme.d.ts.map +0 -1
- package/src/auth.ts +0 -227
- package/src/blocks.tsx +0 -51
- package/src/catalog.ts +0 -3
- package/src/component-contracts.ts +0 -154
- package/src/component-selectors.ts +0 -31
- package/src/components/CartDrawer.tsx +0 -279
- package/src/components/CustomerAccountShell.tsx +0 -102
- package/src/components/DeliveryEstimator.tsx +0 -157
- package/src/components/FiltersPanel.tsx +0 -109
- package/src/components/OrderTrackingTimeline.tsx +0 -135
- package/src/components/Price.tsx +0 -32
- package/src/components/ProductCard.tsx +0 -120
- package/src/components/ProductEnquiryForm.tsx +0 -175
- package/src/components/ProductGallery.tsx +0 -174
- package/src/components/ProductGrid.tsx +0 -43
- package/src/components/ProductOptionSelector.tsx +0 -50
- package/src/components/ProductSpecs.tsx +0 -75
- package/src/components/QuantityInput.tsx +0 -52
- package/src/components/RelatedProducts.tsx +0 -40
- package/src/components/SignInModal.tsx +0 -120
- package/src/components/SmoothImage.tsx +0 -59
- package/src/components/StorefrontErrorBoundary.tsx +0 -51
- package/src/components/StorefrontFooter.tsx +0 -110
- package/src/components/StorefrontHeader.tsx +0 -477
- package/src/components/Toaster.tsx +0 -60
- package/src/components/sections/CategoryShowcase.tsx +0 -80
- package/src/components/sections/HeroSection.tsx +0 -193
- package/src/components/sections/MediaCarousel.tsx +0 -141
- package/src/components/sections/MiscSections.tsx +0 -158
- package/src/components/sections/ProductRail.tsx +0 -81
- package/src/components/sections/ProductSlider.tsx +0 -119
- package/src/config.ts +0 -229
- package/src/createStorefrontApp.tsx +0 -247
- package/src/define.ts +0 -34
- package/src/format.ts +0 -7
- package/src/hooks/index.ts +0 -6
- package/src/hooks/useCategories.ts +0 -26
- package/src/hooks/useDiscountValidator.ts +0 -43
- package/src/hooks/useMyOrders.ts +0 -41
- package/src/hooks/useProduct.ts +0 -36
- package/src/hooks/useProducts.ts +0 -39
- package/src/hooks/useStorefront.ts +0 -58
- package/src/hooks/useStorefrontHead.ts +0 -25
- package/src/index.ts +0 -202
- package/src/motion.tsx +0 -94
- package/src/order-status.ts +0 -33
- package/src/pages/CatalogPage.tsx +0 -118
- package/src/pages/CheckoutPage.tsx +0 -689
- package/src/pages/HomePage.tsx +0 -16
- package/src/pages/MyPurchasesPage.tsx +0 -311
- package/src/pages/NotFoundPage.tsx +0 -25
- package/src/pages/OrderConfirmationPage.tsx +0 -190
- package/src/pages/PolicyPage.tsx +0 -47
- package/src/pages/ProductDetailPage.tsx +0 -264
- package/src/presets.ts +0 -324
- package/src/product-options.ts +0 -63
- package/src/router.ts +0 -49
- package/src/scaffold.tsx +0 -115
- package/src/sections.ts +0 -116
- package/src/shop.ts +0 -4
- package/src/stores/cart.store.ts +0 -185
- package/src/stores/catalog.store.ts +0 -39
- package/src/stores/delivery.store.ts +0 -152
- package/src/stores/session.store.ts +0 -28
- package/src/stores/toast.store.ts +0 -43
- package/src/testids.ts +0 -136
- package/src/theme.ts +0 -194
- package/src/ui.ts +0 -5
- package/src/workflows/checkout.ts +0 -119
- /package/dist/components/{CustomerAccountShell.d.ts → account/CustomerAccountShell.d.ts} +0 -0
- /package/dist/components/{SignInModal.d.ts → account/SignInModal.d.ts} +0 -0
- /package/dist/components/{CartDrawer.d.ts → cart/CartDrawer.d.ts} +0 -0
- /package/dist/components/{QuantityInput.d.ts → cart/QuantityInput.d.ts} +0 -0
- /package/dist/components/{DeliveryEstimator.d.ts → checkout/DeliveryEstimator.d.ts} +0 -0
- /package/dist/components/{ProductGrid.d.ts → collection/ProductGrid.d.ts} +0 -0
- /package/dist/components/{StorefrontErrorBoundary.d.ts → layout/StorefrontErrorBoundary.d.ts} +0 -0
- /package/dist/components/{StorefrontFooter.d.ts → layout/StorefrontFooter.d.ts} +0 -0
- /package/dist/components/{StorefrontHeader.d.ts → layout/StorefrontHeader.d.ts} +0 -0
- /package/dist/components/{Toaster.d.ts → layout/Toaster.d.ts} +0 -0
- /package/dist/components/{OrderTrackingTimeline.d.ts → order/OrderTrackingTimeline.d.ts} +0 -0
- /package/dist/components/{ProductEnquiryForm.d.ts → product/ProductEnquiryForm.d.ts} +0 -0
- /package/dist/components/{ProductSpecs.d.ts → product/ProductSpecs.d.ts} +0 -0
- /package/dist/components/{RelatedProducts.d.ts → product/RelatedProducts.d.ts} +0 -0
- /package/dist/{order-status.d.ts → data/order-status.d.ts} +0 -0
- /package/dist/{component-selectors.d.ts → extend/component-selectors.d.ts} +0 -0
- /package/dist/{format.d.ts → lib/format.d.ts} +0 -0
- /package/dist/{motion.d.ts → lib/motion.d.ts} +0 -0
- /package/dist/{pages → views}/CatalogPage.d.ts +0 -0
- /package/dist/{pages → views}/CheckoutPage.d.ts +0 -0
- /package/dist/{pages → views}/MyPurchasesPage.d.ts +0 -0
- /package/dist/{pages → views}/NotFoundPage.d.ts +0 -0
- /package/dist/{pages → views}/OrderConfirmationPage.d.ts +0 -0
- /package/dist/{pages → views}/PolicyPage.d.ts +0 -0
- /package/dist/{pages → views}/ProductDetailPage.d.ts +0 -0
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { type ReactNode } from 'react';
|
|
2
|
+
import type { EntityDeclarationInput } from '@fayz-ai/core';
|
|
2
3
|
import type { ShopProvider } from '@fayz-ai/shop/provider';
|
|
3
4
|
import type { MockShopSeed } from '@fayz-ai/shop/mock';
|
|
4
|
-
import type { PaymentMethodKind } from '@fayz-ai/shop/types';
|
|
5
|
-
import type {
|
|
6
|
-
import type {
|
|
7
|
-
import type {
|
|
8
|
-
import type {
|
|
5
|
+
import type { PaymentMethodKind, Product } from '@fayz-ai/shop/types';
|
|
6
|
+
import type { Promotion } from '@fayz-ai/shop/rules';
|
|
7
|
+
import type { StorefrontTheme } from '../lib/theme';
|
|
8
|
+
import type { HomeConfig, NavLink, FooterConfig } from '../blocks/sections';
|
|
9
|
+
import type { StorefrontPagesConfig } from '../blocks/page-blocks';
|
|
10
|
+
import type { StorefrontSlots } from '../extend/slots';
|
|
11
|
+
import type { StorefrontAuthConfig } from '../data/auth';
|
|
12
|
+
import type { StorefrontComponents } from '../extend/component-contracts';
|
|
13
|
+
import type { StorefrontReviewsConfig } from '../components/product/ProductReviews';
|
|
14
|
+
import type { CatalogFacetConfig } from '../components/collection/FiltersPanel';
|
|
9
15
|
export type StorefrontRouteKind = 'home' | 'catalog' | 'product' | 'checkout' | 'account' | 'order' | 'custom';
|
|
10
16
|
export type StorefrontRouteParams = Record<string, string>;
|
|
11
17
|
export interface StorefrontRouteComponentProps {
|
|
@@ -74,8 +80,41 @@ export interface StorefrontConfig {
|
|
|
74
80
|
commerceMode?: StorefrontCommerceMode;
|
|
75
81
|
/** Promo message above the header (e.g. 'FRETE GRÁTIS ACIMA DE R$ 300') */
|
|
76
82
|
announcement?: string;
|
|
77
|
-
/**
|
|
83
|
+
/**
|
|
84
|
+
* How pages are addressed when this store is served.
|
|
85
|
+
*
|
|
86
|
+
* `'hash'` (the default) needs no server configuration and is how every
|
|
87
|
+
* shipped store works today. `'history'` gives each page a real URL, which is
|
|
88
|
+
* what makes it indexable, shareable with its own link preview, and
|
|
89
|
+
* prerenderable — and requires the host to serve the app shell for unknown
|
|
90
|
+
* paths, or a deep link 404s before the app ever runs.
|
|
91
|
+
*/
|
|
92
|
+
routing?: 'hash' | 'history';
|
|
93
|
+
/**
|
|
94
|
+
* Home page blueprint. When set, `/` renders it and the catalog moves to /catalog.
|
|
95
|
+
*
|
|
96
|
+
* Still fully supported — five of seven live stores write it. `pages.home` is
|
|
97
|
+
* the same thing with room for the other routes; this stays as the short form.
|
|
98
|
+
*/
|
|
78
99
|
home?: HomeConfig;
|
|
100
|
+
/**
|
|
101
|
+
* Pages composed from blocks.
|
|
102
|
+
*
|
|
103
|
+
* `catalog` and `product` compose AROUND the native body block rather than
|
|
104
|
+
* replacing it, so a store adds content to those pages without taking over
|
|
105
|
+
* their maintenance. Omitting a page renders the SDK default — adopting this
|
|
106
|
+
* field changes nothing until something is added.
|
|
107
|
+
*/
|
|
108
|
+
pages?: StorefrontPagesConfig;
|
|
109
|
+
/**
|
|
110
|
+
* Blocks grafted into named positions inside SDK pages.
|
|
111
|
+
*
|
|
112
|
+
* This is the rung between "configure a section" and "rewrite the page". If
|
|
113
|
+
* you are about to reimplement an SDK page to add one thing to it, look for
|
|
114
|
+
* the slot first — and if the position you need is missing, that is a gap in
|
|
115
|
+
* this list rather than a reason to fork. `listSlots()` enumerates them.
|
|
116
|
+
*/
|
|
117
|
+
slots?: StorefrontSlots;
|
|
79
118
|
/** Header nav links — defaults derived from home/catalog routing */
|
|
80
119
|
nav?: NavLink[];
|
|
81
120
|
/** Footer content (about text, contact, social) */
|
|
@@ -93,8 +132,23 @@ export interface StorefrontConfig {
|
|
|
93
132
|
provider?: ShopProvider;
|
|
94
133
|
/** Per-store mock catalog (products/categories/discounts) for mock mode */
|
|
95
134
|
catalog?: MockShopSeed;
|
|
135
|
+
/**
|
|
136
|
+
* Custom entity declarations (spine M4), keyed by entity key. Registered
|
|
137
|
+
* through defineEntity at runtime init, so one config field yields the
|
|
138
|
+
* record schema, the storage descriptor, the generated RLS, the entity.*
|
|
139
|
+
* loaders and the admin form.
|
|
140
|
+
*/
|
|
141
|
+
entities?: Record<string, EntityDeclarationInput>;
|
|
96
142
|
/** Store-level discount codes available regardless of provider backend. */
|
|
97
143
|
discounts?: StorefrontDiscountConfig[];
|
|
144
|
+
/**
|
|
145
|
+
* Rule-engine promotions (spine M6) — the serializable Promotion shape:
|
|
146
|
+
* eligibility rules + application method, pure data. Rides in the Store
|
|
147
|
+
* Document's `promotions` section; the mock provider evaluates them with
|
|
148
|
+
* the reference evaluator, a live backend re-evaluates server-side. A
|
|
149
|
+
* `{code, percent}` entry in `discounts` is the same thing in shorthand.
|
|
150
|
+
*/
|
|
151
|
+
promotions?: Promotion[];
|
|
98
152
|
/**
|
|
99
153
|
* Institutional/legal page content (privacy, terms, returns). Plain text —
|
|
100
154
|
* blank lines separate paragraphs. Unset pages render a placeholder so the
|
|
@@ -125,7 +179,42 @@ export interface StorefrontConfig {
|
|
|
125
179
|
* which is what it did while the card form was a simulation.
|
|
126
180
|
*/
|
|
127
181
|
methods?: readonly PaymentMethodKind[];
|
|
182
|
+
/**
|
|
183
|
+
* Published payment terms, shown on the card and the PDP. These are the two
|
|
184
|
+
* lines every Brazilian storefront carries and the SDK had no model for:
|
|
185
|
+
* the Pix discount and the interest-free instalment.
|
|
186
|
+
*
|
|
187
|
+
* Display only — they describe what the merchant advertises, not a charge
|
|
188
|
+
* the checkout computes. A product may override the Pix price per SKU via
|
|
189
|
+
* `metadata.pixPrice`.
|
|
190
|
+
*/
|
|
191
|
+
terms?: {
|
|
192
|
+
/** e.g. 5 → "5% de desconto no Pix". */
|
|
193
|
+
pixDiscountPercent?: number;
|
|
194
|
+
/** Longest interest-free plan offered. */
|
|
195
|
+
maxInstallments?: number;
|
|
196
|
+
/** Don't split below this per-instalment value. Default 10. */
|
|
197
|
+
minInstallmentValue?: number;
|
|
198
|
+
};
|
|
199
|
+
};
|
|
200
|
+
/**
|
|
201
|
+
* The PDP specification table renders scalar `product.metadata` alongside
|
|
202
|
+
* SKU/category/weight. Stores also keep bookkeeping in metadata; `exclude`
|
|
203
|
+
* hides those keys and `labels` names the rest, so a store doesn't have to
|
|
204
|
+
* fork ProductSpecs to stop showing an internal field.
|
|
205
|
+
*/
|
|
206
|
+
productSpecs?: {
|
|
207
|
+
exclude?: readonly string[];
|
|
208
|
+
labels?: Readonly<Record<string, string>>;
|
|
128
209
|
};
|
|
210
|
+
/** Product reviews shown on the PDP. See ./components/product/ProductReviews. */
|
|
211
|
+
reviews?: StorefrontReviewsConfig;
|
|
212
|
+
/**
|
|
213
|
+
* Extra catalog refinements over `product.metadata`, rendered in the filters
|
|
214
|
+
* panel and reflected in `?<key>=<value>`. This is how a store adds its own
|
|
215
|
+
* discovery axis — colour, purpose, brand — without forking FiltersPanel.
|
|
216
|
+
*/
|
|
217
|
+
catalogFacets?: readonly CatalogFacetConfig[];
|
|
129
218
|
/** Product enquiry behavior for catalog/enquiry stores. */
|
|
130
219
|
enquiry?: StorefrontEnquiryConfig;
|
|
131
220
|
/** Feature toggles — defaults depend on commerceMode. */
|
|
@@ -137,6 +226,8 @@ export interface StorefrontConfig {
|
|
|
137
226
|
};
|
|
138
227
|
/** Global storefront image reveal behavior. Default is a soft fade. */
|
|
139
228
|
imageLoading?: StorefrontImageLoadingConfig;
|
|
229
|
+
/** Header search behaviour. Omit for the inline live-filter. */
|
|
230
|
+
search?: StorefrontSearchConfig;
|
|
140
231
|
/** Code-level component replacements. Kept out of serialized manifests. */
|
|
141
232
|
components?: StorefrontComponents;
|
|
142
233
|
/** Code-level route overrides/custom routes. Kept out of serialized manifests. */
|
|
@@ -152,6 +243,7 @@ export interface ResolvedStorefrontConfig extends StorefrontConfig {
|
|
|
152
243
|
payments: {
|
|
153
244
|
mode: 'mock' | 'pix-mercadopago';
|
|
154
245
|
methods: readonly PaymentMethodKind[];
|
|
246
|
+
terms?: NonNullable<StorefrontConfig['payments']>['terms'];
|
|
155
247
|
};
|
|
156
248
|
commerceMode: StorefrontCommerceMode;
|
|
157
249
|
enquiry: Required<Pick<StorefrontEnquiryConfig, 'label' | 'successMessage' | 'subjectPrefix'>> & Omit<StorefrontEnquiryConfig, 'label' | 'successMessage' | 'subjectPrefix'>;
|
|
@@ -165,6 +257,33 @@ export interface ResolvedStorefrontConfig extends StorefrontConfig {
|
|
|
165
257
|
/** Where the full product list lives ('/' without a home page, '/catalog' with one) */
|
|
166
258
|
catalogPath: string;
|
|
167
259
|
nav: NavLink[];
|
|
260
|
+
/** `pages` with the legacy `home` short form folded in — always read this one. */
|
|
261
|
+
pages: StorefrontPagesConfig;
|
|
262
|
+
search: Required<Omit<StorefrontSearchConfig, 'renderSuggestion'>> & Pick<StorefrontSearchConfig, 'renderSuggestion'>;
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Header search. Defaults reproduce the inline live-filter the storefront has
|
|
266
|
+
* always had, so turning this on is opt-in; every label and limit is a knob
|
|
267
|
+
* because "what a search feels like" is a per-store decision, not the SDK's.
|
|
268
|
+
*/
|
|
269
|
+
export interface StorefrontSearchConfig {
|
|
270
|
+
/**
|
|
271
|
+
* 'inline' filters the catalogue as you type (the original behaviour).
|
|
272
|
+
* 'overlay' dims the page and shows suggestions under the field, with a
|
|
273
|
+
* link through to the full result page.
|
|
274
|
+
*/
|
|
275
|
+
mode?: 'inline' | 'overlay';
|
|
276
|
+
placeholder?: string;
|
|
277
|
+
/** Where "see all results" lands, carrying `?q=`. */
|
|
278
|
+
resultsPath?: string;
|
|
279
|
+
/** Suggestions shown under the field before the shopper commits. */
|
|
280
|
+
suggestionsLimit?: number;
|
|
281
|
+
/** Characters before anything is queried — 1 matches everything, which is noise. */
|
|
282
|
+
minChars?: number;
|
|
283
|
+
ctaLabel?: string;
|
|
284
|
+
emptyLabel?: string;
|
|
285
|
+
/** Full control of a suggestion row when the default card is wrong for the store. */
|
|
286
|
+
renderSuggestion?: (product: Product) => ReactNode;
|
|
168
287
|
}
|
|
169
288
|
export declare function resolveConfig(config: StorefrontConfig): ResolvedStorefrontConfig;
|
|
170
289
|
export declare const StorefrontConfigProvider: React.Provider<ResolvedStorefrontConfig | null>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/document/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAA6B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AACxE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AA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AM,CAAA;IACzB,oFAAoF;IACpF,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,qFAAqF;IACrF,gBAAgB,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,SAAS,CAAA;CACnD;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,gBAAgB,GAAG,wBAAwB,CA2EhF;AAID,eAAO,MAAM,wBAAwB,iDAAmC,CAAA;AAExE,wBAAgB,mBAAmB,IAAI,wBAAwB,CAI9D;AAED,wBAAgB,2BAA2B,IAAI,wBAAwB,GAAG,IAAI,CAE7E;AAED,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,wBAAwB,GAAG,oBAAoB,CAE9F"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import type { BlockDescriptor, EntityDescriptor, ExtensionPointDescriptor, JsonSchema, LoaderDescriptor, RegistryEntryDescriptor } from '@fayz-ai/core';
|
|
2
|
+
import type { RuleAttribute } from '@fayz-ai/shop/rules';
|
|
3
|
+
import type { FayzDeprecation, FayzDeprecationPolicy } from '@fayz-ai/sdk/deprecations';
|
|
4
|
+
import type { StoreCodemodDescriptor, StoreDeprecationFinding } from './upgrade';
|
|
5
|
+
import type { SlotDescriptor } from '../extend/slots';
|
|
6
|
+
import type { StoreDocument, StoreSectionName } from './sections';
|
|
7
|
+
import type { StoreValidationReport } from './validate';
|
|
8
|
+
/**
|
|
9
|
+
* What this store's backend can do.
|
|
10
|
+
*
|
|
11
|
+
* Designed to become backend-aware: today every store is Fayz-backed, so the
|
|
12
|
+
* values are constants. When a second backend lands (spine I11 — e.g. a
|
|
13
|
+
* Shopify-backed store whose catalog is mirrored into canonical tables), this
|
|
14
|
+
* shape is derived from the backend provider instead: a Shopify-backed store
|
|
15
|
+
* keeps `catalogMirror` but cannot run our rule engine, so `ruleEngine`
|
|
16
|
+
* flips false while the document stays identical. Consumers must branch on
|
|
17
|
+
* these flags, never on the provider name.
|
|
18
|
+
*/
|
|
19
|
+
export interface StoreCapabilities {
|
|
20
|
+
/** Backend family serving the store. */
|
|
21
|
+
backend: string;
|
|
22
|
+
/** Commerce modes the storefront shell can run. */
|
|
23
|
+
commerceModes: readonly string[];
|
|
24
|
+
/** Reads come from the canonical Fayz catalog (mirrored for ERP-backed stores). */
|
|
25
|
+
catalogMirror: boolean;
|
|
26
|
+
/** Cart + checkout run against the Fayz order path. */
|
|
27
|
+
checkout: boolean;
|
|
28
|
+
/** Declared data loaders resolved once per page (spine M3). */
|
|
29
|
+
loaders: boolean;
|
|
30
|
+
/** Rule engine (spine M6): promotions as data, evaluated by the reference
|
|
31
|
+
* evaluator (mock) or shop_compute_promotion_actions (Supabase). True for
|
|
32
|
+
* Fayz-backed stores; a backend that cannot run our rules (e.g. a
|
|
33
|
+
* Shopify-mirrored store) flips this false and consumers must branch on
|
|
34
|
+
* the flag, never the provider name. */
|
|
35
|
+
ruleEngine: boolean;
|
|
36
|
+
/** Custom entity declarations (spine M4): defineEntity + entity.* loaders +
|
|
37
|
+
* generic storage. True for Fayz-backed stores (both providers implement
|
|
38
|
+
* the entity surface); a future backend without it flips this false and
|
|
39
|
+
* consumers must branch on the flag, never the provider name. */
|
|
40
|
+
customEntities: boolean;
|
|
41
|
+
/** Extension point registry (spine M7): declared seams with enforced
|
|
42
|
+
* input+output schemas, many dependency-ordered handlers, and exactly one
|
|
43
|
+
* nullable beforePlaceOrder escape valve. */
|
|
44
|
+
extensionPoints: boolean;
|
|
45
|
+
}
|
|
46
|
+
export interface StoreSectionDescription {
|
|
47
|
+
description: string;
|
|
48
|
+
/** Section versions this SDK understands, ascending. */
|
|
49
|
+
versions: readonly number[];
|
|
50
|
+
/** JSON Schema for the section, compiled from the same spec the validator runs. */
|
|
51
|
+
schema: JsonSchema;
|
|
52
|
+
}
|
|
53
|
+
/** Summary of one concrete document, when one is passed in. */
|
|
54
|
+
/** The I10 contract, as data the agent reads before authoring (spine M10):
|
|
55
|
+
* the policy, every deprecation, and the codemod that answers each one. */
|
|
56
|
+
export interface StoreContractDescription {
|
|
57
|
+
policy: FayzDeprecationPolicy;
|
|
58
|
+
deprecations: FayzDeprecation[];
|
|
59
|
+
codemods: StoreCodemodDescriptor[];
|
|
60
|
+
}
|
|
61
|
+
export interface StoreDocumentSummary {
|
|
62
|
+
name?: string;
|
|
63
|
+
/** Sections present in the document. */
|
|
64
|
+
sections: string[];
|
|
65
|
+
/** Block types the document places (pages, home, slots), sorted, deduped. */
|
|
66
|
+
blocksUsed: string[];
|
|
67
|
+
/** Loader ids the document's data declarations reference, sorted, deduped.
|
|
68
|
+
* Meta-level needs of placed blocks are not repeated here — they are the
|
|
69
|
+
* block's own contract, readable from the blocks registry. */
|
|
70
|
+
loadersUsed: string[];
|
|
71
|
+
/** Handle names the document references, sorted, deduped. */
|
|
72
|
+
handlesUsed: string[];
|
|
73
|
+
/** What in THIS store is deprecated, and what replaces it (I10 + I2). */
|
|
74
|
+
deprecations: StoreDeprecationFinding[];
|
|
75
|
+
validation: StoreValidationReport;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* One of the author-facing abilities (spine §3 L5).
|
|
79
|
+
*
|
|
80
|
+
* Enumerating them is the point. WooCommerce's own conclusion about agent
|
|
81
|
+
* surfaces — quoted in the spine — is that the surface must be "purpose-built
|
|
82
|
+
* domain abilities … instead of automatically projecting every REST-shaped
|
|
83
|
+
* operation", and an ability an agent cannot discover is an ability it will not
|
|
84
|
+
* use. There are four, they are listed here with their input schemas, and the
|
|
85
|
+
* list is derived from nothing: if a fifth is added it must be added here.
|
|
86
|
+
*/
|
|
87
|
+
export interface StoreAbilityDescriptor {
|
|
88
|
+
name: 'describeStore' | 'validateStore' | 'renderStore' | 'applyChange';
|
|
89
|
+
/** Where it is imported from. */
|
|
90
|
+
module: string;
|
|
91
|
+
/** Does it change the document? */
|
|
92
|
+
writes: boolean;
|
|
93
|
+
description: string;
|
|
94
|
+
/** JSON Schema of the options/arguments beyond the document itself. */
|
|
95
|
+
input: JsonSchema;
|
|
96
|
+
/** What the caller gets back, in prose — the shapes are exported types. */
|
|
97
|
+
output: string;
|
|
98
|
+
}
|
|
99
|
+
export interface StoreDescription {
|
|
100
|
+
version: 1;
|
|
101
|
+
capabilities: StoreCapabilities;
|
|
102
|
+
/** The four abilities, with their input schemas (spine L5). */
|
|
103
|
+
abilities: readonly StoreAbilityDescriptor[];
|
|
104
|
+
sections: Record<StoreSectionName, StoreSectionDescription>;
|
|
105
|
+
/** The deprecation contract (spine M10, I10). Enumerable on purpose: an
|
|
106
|
+
* agent that cannot read what is going away will keep generating it. */
|
|
107
|
+
contract: StoreContractDescription;
|
|
108
|
+
registries: {
|
|
109
|
+
blocks: BlockDescriptor[];
|
|
110
|
+
loaders: LoaderDescriptor[];
|
|
111
|
+
entities: EntityDescriptor[];
|
|
112
|
+
handles: RegistryEntryDescriptor[];
|
|
113
|
+
/** The rule attribute vocabulary AS ROWS (I9) — the same rows the admin
|
|
114
|
+
* promotion form renders from and validateStore checks against. */
|
|
115
|
+
ruleAttributes: RuleAttribute[];
|
|
116
|
+
/** Every extension point with its input/output schemas AND registered
|
|
117
|
+
* handlers (spine M7) — the enumerable behaviour surface. */
|
|
118
|
+
extensionPoints: ExtensionPointDescriptor[];
|
|
119
|
+
};
|
|
120
|
+
/** The closed operator set rules may use. */
|
|
121
|
+
ruleOperators: readonly string[];
|
|
122
|
+
pageKinds: readonly string[];
|
|
123
|
+
slots: readonly SlotDescriptor[];
|
|
124
|
+
componentSlots: readonly string[];
|
|
125
|
+
settingTypes: readonly string[];
|
|
126
|
+
/** The field-type vocabulary defineEntity accepts (spine M4). */
|
|
127
|
+
entityFieldTypes: readonly string[];
|
|
128
|
+
document?: StoreDocumentSummary;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* The machine-readable description of the storefront authoring surface, plus —
|
|
132
|
+
* when a document is passed — a summary of that document against it.
|
|
133
|
+
*/
|
|
134
|
+
export declare function describeStore(doc?: StoreDocument | Record<string, unknown>): StoreDescription;
|
|
135
|
+
//# sourceMappingURL=describe.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"describe.d.ts","sourceRoot":"","sources":["../../src/document/describe.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EACV,eAAe,EACf,gBAAgB,EAChB,wBAAwB,EACxB,UAAU,EACV,gBAAgB,EAChB,uBAAuB,EACxB,MAAM,eAAe,CAAA;AAEtB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAExD,OAAO,KAAK,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAA;AAEvF,OAAO,KAAK,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAA;AAKhF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAGrD,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAEjE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAA;AAUvD;;;;;;;;;;GAUG;AACH,MAAM,WAAW,iBAAiB;IAChC,wCAAwC;IACxC,OAAO,EAAE,MAAM,CAAA;IACf,mDAAmD;IACnD,aAAa,EAAE,SAAS,MAAM,EAAE,CAAA;IAChC,mFAAmF;IACnF,aAAa,EAAE,OAAO,CAAA;IACtB,uDAAuD;IACvD,QAAQ,EAAE,OAAO,CAAA;IACjB,+DAA+D;IAC/D,OAAO,EAAE,OAAO,CAAA;IAChB;;;;6CAIyC;IACzC,UAAU,EAAE,OAAO,CAAA;IACnB;;;sEAGkE;IAClE,cAAc,EAAE,OAAO,CAAA;IACvB;;kDAE8C;IAC9C,eAAe,EAAE,OAAO,CAAA;CACzB;AAED,MAAM,WAAW,uBAAuB;IACtC,WAAW,EAAE,MAAM,CAAA;IACnB,wDAAwD;IACxD,QAAQ,EAAE,SAAS,MAA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,CAAA;QACzB,OAAO,EAAE,gBAAgB,EAAE,CAAA;QAC3B,QAAQ,EAAE,gBAAgB,EAAE,CAAA;QAC5B,OAAO,EAAE,uBAAuB,EAAE,CAAA;QAClC;4EACoE;QACpE,cAAc,EAAE,aAAa,EAAE,CAAA;QAC/B;sEAC8D;QAC9D,eAAe,EAAE,wBAAwB,EAAE,CAAA;KAC5C,CAAA;IACD,6CAA6C;IAC7C,aAAa,EAAE,SAAS,MAAM,EAAE,CAAA;IAChC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAA;IAC5B,KAAK,EAAE,SAAS,cAAc,EAAE,CAAA;IAChC,cAAc,EAAE,SAAS,MAAM,EAAE,CAAA;IACjC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAA;IAC/B,iEAAiE;IACjE,gBAAgB,EAAE,SAAS,MAAM,EAAE,CAAA;IACnC,QAAQ,CAAC,EAAE,oBAAoB,CAAA;CAChC;AAmKD;;;GAGG;AACH,wBAAgB,aAAa,CAAC,GAAG,CAAC,EAAE,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,gBAAgB,CAkD7F"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { StoreDocument } from './sections';
|
|
2
|
+
import type { StoreValidationReport } from './validate';
|
|
3
|
+
/** Sparse map of document path -> value. Absent means "use the document's". */
|
|
4
|
+
export type StoreOverlay = Record<string, unknown>;
|
|
5
|
+
export interface OverlayRejection {
|
|
6
|
+
path: string;
|
|
7
|
+
code: 'unparseable-path' | 'not-a-setting' | 'section-not-overlayable' | 'no-block-at-path';
|
|
8
|
+
message: string;
|
|
9
|
+
}
|
|
10
|
+
export interface ApplyOverlayResult {
|
|
11
|
+
/** The document a shopper is served: base with the accepted settings applied. */
|
|
12
|
+
document: Record<string, unknown>;
|
|
13
|
+
/** Paths that were applied, in the order they were. */
|
|
14
|
+
applied: string[];
|
|
15
|
+
/** Paths the rule refused, each saying why. */
|
|
16
|
+
rejected: OverlayRejection[];
|
|
17
|
+
/** Validation of the MERGED document — the only one that matters. */
|
|
18
|
+
validation: StoreValidationReport;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Sections an overlay may reach into at all. Everything else is mirrored from
|
|
22
|
+
* the backend (catalog), money (commerce), infrastructure (backend, auth) or
|
|
23
|
+
* code — none of which is a settings-panel change.
|
|
24
|
+
*/
|
|
25
|
+
export declare const OVERLAYABLE_SECTIONS: readonly ["presentation", "theme"];
|
|
26
|
+
/**
|
|
27
|
+
* Is this path a setting? Needs the document, and cannot work without it —
|
|
28
|
+
* a path-only rule ("settings live under `props`") failed the fleet twice:
|
|
29
|
+
*
|
|
30
|
+
* - the two block forms MIX inside one array (artorious's home page is 3
|
|
31
|
+
* nested and 5 flat), so requiring `props` made the flat ones uneditable;
|
|
32
|
+
* - a setting VALUE can look exactly like a block — a form field is
|
|
33
|
+
* `{id, label, type, required}` — so keying on `type` would refuse a
|
|
34
|
+
* legitimate edit.
|
|
35
|
+
*
|
|
36
|
+
* The walk resolves against the real document and asks the renderer's own
|
|
37
|
+
* `isNestedBlockRef` which form each block took. It stops the moment it enters
|
|
38
|
+
* a setting, which is what makes the form-field case need no exception.
|
|
39
|
+
*
|
|
40
|
+
* `theme` is settings throughout — it is nothing but tokens.
|
|
41
|
+
*/
|
|
42
|
+
export declare function isSettingPath(document: StoreDocument | Record<string, unknown>, path: string): OverlayRejection | null;
|
|
43
|
+
/**
|
|
44
|
+
* Merge an overlay onto a document. Never mutates the input. Rejections are
|
|
45
|
+
* reported rather than thrown: an overlay with one bad entry must still deliver
|
|
46
|
+
* the other forty, or a store stops updating and nobody knows why.
|
|
47
|
+
*/
|
|
48
|
+
export declare function applyOverlay(document: StoreDocument | Record<string, unknown>, overlay: StoreOverlay): ApplyOverlayResult;
|
|
49
|
+
/**
|
|
50
|
+
* Drop overlay entries the document can no longer accept. Orphans are harmless
|
|
51
|
+
* on their own — applyOverlay refuses them — but they accumulate, and an
|
|
52
|
+
* overlay nobody prunes hides a real mistake among a hundred dead ones.
|
|
53
|
+
*/
|
|
54
|
+
export declare function pruneOverlay(document: StoreDocument | Record<string, unknown>, overlay: StoreOverlay): {
|
|
55
|
+
overlay: StoreOverlay;
|
|
56
|
+
dropped: string[];
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL=overlay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"overlay.d.ts","sourceRoot":"","sources":["../../src/document/overlay.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAG/C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAA;AAavD,+EAA+E;AAC/E,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;AAElD,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,kBAAkB,GAAG,eAAe,GAAG,yBAAyB,GAAG,kBAAkB,CAAA;IAC3F,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,kBAAkB;IACjC,iFAAiF;IACjF,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACjC,uDAAuD;IACvD,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,+CAA+C;IAC/C,QAAQ,EAAE,gBAAgB,EAAE,CAAA;IAC5B,qEAAqE;IACrE,UAAU,EAAE,qBAAqB,CAAA;CAClC;AAED;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,oCAAqC,CAAA;AAMtE;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACjD,IAAI,EAAE,MAAM,GACX,gBAAgB,GAAG,IAAI,CAsFzB;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACjD,OAAO,EAAE,YAAY,GACpB,kBAAkB,CA2DpB;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACjD,OAAO,EAAE,YAAY,GACpB;IAAE,OAAO,EAAE,YAAY,CAAC;IAAC,OAAO,EAAE,MAAM,EAAE,CAAA;CAAE,CAQ9C"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { StorefrontTheme } from '
|
|
2
|
-
import type { HomeConfig } from '
|
|
1
|
+
import type { StorefrontTheme } from '../lib/theme';
|
|
2
|
+
import type { HomeConfig } from '../blocks/sections';
|
|
3
3
|
/** Real imagery for a template home — resolved at build time (e.g. via
|
|
4
4
|
* scripts/fetch-unsplash.mjs); falls back to gradient placeholders when omitted. */
|
|
5
5
|
export interface TemplateImages {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presets.d.ts","sourceRoot":"","sources":["../../src/document/presets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AASpD;qFACqF;AACrF,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC,CAAA;IAChC,OAAO,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC,CAAA;CACpC;AAED,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAA;IACV,2CAA2C;IAC3C,WAAW,EAAE,MAAM,CAAA;IACnB,KAAK,EAAE,eAAe,CAAA;IACtB,0EAA0E;IAC1E,IAAI,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,cAAc,KAAK,UAAU,CAAA;IAChE,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAED,yFAAyF;AACzF,eAAO,MAAM,YAAY,EAAE,kBA0C1B,CAAA;AAED,gGAAgG;AAChG,eAAO,MAAM,cAAc,EAAE,kBA2D5B,CAAA;AAED,kHAAkH;AAClH,eAAO,MAAM,YAAY,EAAE,kBAkD1B,CAAA;AAED,0GAA0G;AAC1G,eAAO,MAAM,eAAe,EAAE,kBA4D7B,CAAA;AAED;;2FAE2F;AAC3F,eAAO,MAAM,YAAY,EAAE,kBA4D1B,CAAA;AAED,eAAO,MAAM,mBAAmB;;;;;;CAMtB,CAAA;AAEV,MAAM,MAAM,oBAAoB,GAAG,MAAM,OAAO,mBAAmB,CAAA"}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import type { RouterAdapter } from '@fayz-ai/core';
|
|
2
|
+
import type { ShopProvider } from '@fayz-ai/shop/provider';
|
|
3
|
+
import type { StaticHeadInput } from '../app/static-render';
|
|
4
|
+
import type { StoreDocument } from './sections';
|
|
5
|
+
import type { StoreValidationReport } from './validate';
|
|
6
|
+
export interface StoreRenderDataEntry {
|
|
7
|
+
/** Canonical `dataNeedKey` — the same key the browser would dedupe on. */
|
|
8
|
+
key: string;
|
|
9
|
+
loader: string;
|
|
10
|
+
params: Record<string, unknown>;
|
|
11
|
+
status: 'ready' | 'error' | 'unresolved';
|
|
12
|
+
/** Item count for an array result, so "the rail is empty" is one field. */
|
|
13
|
+
count?: number;
|
|
14
|
+
error?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface StoreRenderDiagnostic {
|
|
17
|
+
level: 'error' | 'warn';
|
|
18
|
+
/** Where it came from: 'blocks' (core), 'storefront', or 'render'. */
|
|
19
|
+
source: string;
|
|
20
|
+
message: string;
|
|
21
|
+
}
|
|
22
|
+
export interface StoreRenderHeading {
|
|
23
|
+
level: number;
|
|
24
|
+
text: string;
|
|
25
|
+
}
|
|
26
|
+
export interface StoreRenderBlock {
|
|
27
|
+
type: string;
|
|
28
|
+
id?: string;
|
|
29
|
+
/** Ancestor block types, outermost first — empty for a top-level block. */
|
|
30
|
+
within?: string[];
|
|
31
|
+
}
|
|
32
|
+
export interface RenderStoreOptions {
|
|
33
|
+
/** Route to render, in the storefront's own path space ('/', '/catalog',
|
|
34
|
+
* '/product/anel-de-ouro', '/biography'). Default '/'. */
|
|
35
|
+
path?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Where catalog data comes from.
|
|
38
|
+
*
|
|
39
|
+
* - `'config'` (default): the provider the config implies — its explicit
|
|
40
|
+
* provider, or a mock seeded from its catalog. What the shopper sees.
|
|
41
|
+
* - `'document'`: a mock seeded from the document's own `catalog` section.
|
|
42
|
+
* Deterministic and network-free, which is what you want while iterating
|
|
43
|
+
* on a document whose store is backed by a live database.
|
|
44
|
+
* - a `ShopProvider`: bring your own.
|
|
45
|
+
*/
|
|
46
|
+
provider?: ShopProvider | 'config' | 'document';
|
|
47
|
+
/**
|
|
48
|
+
* 'report' (default) renders an invalid document anyway and returns the
|
|
49
|
+
* findings — an agent fixing a broken store needs to see the broken store.
|
|
50
|
+
* 'throw' refuses, for a caller using this as a gate.
|
|
51
|
+
*/
|
|
52
|
+
onError?: 'throw' | 'report';
|
|
53
|
+
/** 'document' (default) wraps the markup in a full HTML document with the
|
|
54
|
+
* theme CSS and the route's title; 'fragment' returns the shell markup. */
|
|
55
|
+
html?: 'document' | 'fragment';
|
|
56
|
+
/**
|
|
57
|
+
* How many render/resolve rounds to run. One page's data can reveal the
|
|
58
|
+
* next need (a route param feeding a rail), so the loop repeats until no new
|
|
59
|
+
* need appears. Reaching the cap is reported as a diagnostic rather than
|
|
60
|
+
* silently truncating the page. Default 4.
|
|
61
|
+
*/
|
|
62
|
+
maxPasses?: number;
|
|
63
|
+
/**
|
|
64
|
+
* Which frame of an image's reveal animation to render.
|
|
65
|
+
*
|
|
66
|
+
* `'settled'` (default) renders images at their loaded state. A store with
|
|
67
|
+
* `imageLoading.mode: 'fade'` paints every image at `opacity: 0` until its
|
|
68
|
+
* load event fires — an event a static render never has — so the honest
|
|
69
|
+
* frame to show is the one every shopper's browser reaches milliseconds
|
|
70
|
+
* later, not a blank page. `'initial'` renders the pre-load frame verbatim,
|
|
71
|
+
* for a caller specifically inspecting first paint.
|
|
72
|
+
*/
|
|
73
|
+
imageReveal?: 'settled' | 'initial';
|
|
74
|
+
/** Stylesheet URLs to link from the emitted document — how a preview server
|
|
75
|
+
* hands in the app's real (Tailwind) CSS. */
|
|
76
|
+
stylesheets?: readonly string[];
|
|
77
|
+
/** Extra markup for the emitted `<head>`. */
|
|
78
|
+
head?: string;
|
|
79
|
+
/**
|
|
80
|
+
* How the rendered store is ADDRESSED when served.
|
|
81
|
+
*
|
|
82
|
+
* Defaults to hash, matching how storefronts ship today, so a headless render
|
|
83
|
+
* describes links that actually resolve. Pass `historyRouterAdapter()` (or any
|
|
84
|
+
* adapter) for a store served at real URLs — that is what makes each page
|
|
85
|
+
* come out with a crawlable href of its own, which is the difference between
|
|
86
|
+
* prerendered HTML that can be indexed and prerendered HTML that cannot.
|
|
87
|
+
*/
|
|
88
|
+
router?: RouterAdapter;
|
|
89
|
+
/**
|
|
90
|
+
* Absolute origin, e.g. 'https://loja.example.com'. Required for canonical
|
|
91
|
+
* and OpenGraph URLs — without it they are omitted rather than emitted
|
|
92
|
+
* relative, because a relative canonical is ignored.
|
|
93
|
+
*/
|
|
94
|
+
origin?: string;
|
|
95
|
+
/** `<html lang>`. Defaults to the document's locale, then 'pt-BR'. */
|
|
96
|
+
lang?: string;
|
|
97
|
+
/**
|
|
98
|
+
* Stamp every block with its document path (`data-fayz-block`).
|
|
99
|
+
*
|
|
100
|
+
* Off by default, because a shopper's page must not carry it. On, the emitted
|
|
101
|
+
* HTML says which document node produced which part of the page — which lets
|
|
102
|
+
* an editor resolve a click to a path, and lets a test assert the identity
|
|
103
|
+
* seam without a browser.
|
|
104
|
+
*/
|
|
105
|
+
editor?: boolean;
|
|
106
|
+
}
|
|
107
|
+
export interface StoreRenderResult {
|
|
108
|
+
/** True when the document validates, the path resolved, and nothing on the
|
|
109
|
+
* page reported an error. The one field a gate should read. */
|
|
110
|
+
ok: boolean;
|
|
111
|
+
path: string;
|
|
112
|
+
/** The title this route declared through `useStorefrontHead`. */
|
|
113
|
+
title: string;
|
|
114
|
+
description?: string;
|
|
115
|
+
/** The path resolved to a real page (false = the 404 page rendered). */
|
|
116
|
+
found: boolean;
|
|
117
|
+
html: string;
|
|
118
|
+
/** Visible text, tags stripped and whitespace collapsed — what a reader sees. */
|
|
119
|
+
text: string;
|
|
120
|
+
/** h1–h6 in document order: the page's shape in one glance. */
|
|
121
|
+
outline: StoreRenderHeading[];
|
|
122
|
+
/** Every block that rendered, in order, including forced-layout repairs. */
|
|
123
|
+
blocks: StoreRenderBlock[];
|
|
124
|
+
/** Outbound hrefs, deduped — how an agent checks its nav actually links. */
|
|
125
|
+
links: string[];
|
|
126
|
+
images: number;
|
|
127
|
+
data: StoreRenderDataEntry[];
|
|
128
|
+
diagnostics: StoreRenderDiagnostic[];
|
|
129
|
+
validation: StoreValidationReport;
|
|
130
|
+
/** Render/resolve rounds actually run. */
|
|
131
|
+
passes: number;
|
|
132
|
+
bytes: number;
|
|
133
|
+
}
|
|
134
|
+
/** Visible text of a markup string. Regex rather than a DOM because the
|
|
135
|
+
* workspace has no jsdom and the question — "what words are on this page" —
|
|
136
|
+
* does not need one. */
|
|
137
|
+
export declare function htmlToText(html: string): string;
|
|
138
|
+
/**
|
|
139
|
+
* Render a Store Document to HTML, headless, plus everything an agent needs to
|
|
140
|
+
* understand the result.
|
|
141
|
+
*
|
|
142
|
+
* const result = await renderStore(doc, { path: '/biography' })
|
|
143
|
+
* result.ok // did anything on the page go wrong
|
|
144
|
+
* result.outline // [{ level: 1, text: 'Biography' }, …]
|
|
145
|
+
* result.data // [{ loader: 'products.list', status: 'ready', count: 12 }]
|
|
146
|
+
* result.diagnostics
|
|
147
|
+
*/
|
|
148
|
+
export declare function renderStore(input: StoreDocument | Record<string, unknown>, options?: RenderStoreOptions): Promise<StoreRenderResult>;
|
|
149
|
+
interface WrapOptions {
|
|
150
|
+
title: string;
|
|
151
|
+
description?: string;
|
|
152
|
+
lang: string;
|
|
153
|
+
themeCss: string;
|
|
154
|
+
stylesheets: readonly string[];
|
|
155
|
+
head: string;
|
|
156
|
+
/** Canonical / OpenGraph / JSON-LD declared by the route being rendered. */
|
|
157
|
+
seo?: Pick<StaticHeadInput, 'canonical' | 'image' | 'type' | 'jsonLd'>;
|
|
158
|
+
siteName?: string;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* The HTML document around the shell markup.
|
|
162
|
+
*
|
|
163
|
+
* Deliberately minimal and self-contained: the theme's CSS variables ride
|
|
164
|
+
* inline (they are already data — M2's brand tokens), and any real stylesheet
|
|
165
|
+
* is LINKED rather than inlined, because the only thing that can produce the
|
|
166
|
+
* app's utility CSS is the app's own build. A caller with no stylesheet gets
|
|
167
|
+
* honest unstyled markup instead of a page that pretends to be styled.
|
|
168
|
+
*/
|
|
169
|
+
export declare function wrapDocument(markup: string, options: WrapOptions): string;
|
|
170
|
+
export {};
|
|
171
|
+
//# sourceMappingURL=render.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/document/render.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAIlD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAa1D,OAAO,KAAK,EAAE,eAAe,EAAoB,MAAM,sBAAsB,CAAA;AAE7E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAG/C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAA;AAoCvD,MAAM,WAAW,oBAAoB;IACnC,0EAA0E;IAC1E,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAA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,4EAA4E;IAC5E,GAAG,CAAC,EAAE,IAAI,CAAC,eAAe,EAAE,WAAW,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC,CAAA;IACtE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,GAAG,MAAM,CAwCzE"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { StorefrontConfig } from './config';
|
|
2
|
+
import { STORE_DOCUMENT_KIND } from './sections';
|
|
3
|
+
import type { StoreDocument } from './sections';
|
|
4
|
+
export declare function slugifyStoreName(name: string): string;
|
|
5
|
+
export interface ExportStoreOptions {
|
|
6
|
+
/** Namespace for auto-registered handles. Default: slug of the store name. */
|
|
7
|
+
appId?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Register a deterministic handle (`<appId>.<config-path>`) for any code
|
|
10
|
+
* value that has none, instead of failing. `defineStorefront` turns this on
|
|
11
|
+
* so a store written today keeps working; a store that names its own handles
|
|
12
|
+
* (registerHandle) keeps its names — explicit registration always wins the
|
|
13
|
+
* reverse lookup.
|
|
14
|
+
*/
|
|
15
|
+
registerMissingHandles?: boolean;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Serialize a defined/live store to Store Document v1.
|
|
19
|
+
*
|
|
20
|
+
* Data fields map to sections verbatim (the authored block form is preserved,
|
|
21
|
+
* flat or nested — both are data). Code fields become handle names in the
|
|
22
|
+
* `code` section. A data field smuggling code (JSX inside a page tree) is a
|
|
23
|
+
* hard error naming the offending path rather than a document that lies.
|
|
24
|
+
*/
|
|
25
|
+
export declare function exportStore(config: StorefrontConfig, options?: ExportStoreOptions): StoreDocument;
|
|
26
|
+
export interface HydrateStoreOptions {
|
|
27
|
+
/**
|
|
28
|
+
* 'throw' (default): a document that fails validation aborts hydration with
|
|
29
|
+
* an error listing every finding — the authoring-loop contract (I2).
|
|
30
|
+
* 'report': log the findings and hydrate best-effort, dropping unresolvable
|
|
31
|
+
* code refs — the shopper-facing contract (I7: a broken document degrades
|
|
32
|
+
* instead of white-screening the store). The scaffold uses 'report'.
|
|
33
|
+
*/
|
|
34
|
+
onError?: 'throw' | 'report';
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Reconstitute a StorefrontConfig from a Store Document.
|
|
38
|
+
*
|
|
39
|
+
* Every code reference resolves through the handle registry by NAME — the
|
|
40
|
+
* document alone plus the app's registered handles is the whole story; there
|
|
41
|
+
* is no in-memory side channel keyed by app id anymore.
|
|
42
|
+
*/
|
|
43
|
+
export declare function hydrateStoreDocument(input: StoreDocument | Record<string, unknown>, options?: HydrateStoreOptions): StorefrontConfig;
|
|
44
|
+
/** Re-export so document consumers need one import. */
|
|
45
|
+
export { STORE_DOCUMENT_KIND };
|
|
46
|
+
//# sourceMappingURL=round-trip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"round-trip.d.ts","sourceRoot":"","sources":["../../src/document/round-trip.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,gBAAgB,EAIjB,MAAM,UAAU,CAAA;AAKjB,OAAO,EAAE,mBAAmB,EAAwB,MAAM,YAAY,CAAA;AACtE,OAAO,KAAK,EAAuC,aAAa,EAAE,MAAM,YAAY,CAAA;AAoBpF,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAErD;AAED,MAAM,WAAW,kBAAkB;IACjC,8EAA8E;IAC9E,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;;;;;OAMG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAA;CACjC;AA4DD;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,gBAAgB,EAAE,OAAO,GAAE,kBAAuB,GAAG,aAAa,CAgKrG;AAED,MAAM,WAAW,mBAAmB;IAClC;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAA;CAC7B;AAQD;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9C,OAAO,GAAE,mBAAwB,GAChC,gBAAgB,CAuIlB;AAED,uDAAuD;AACvD,OAAO,EAAE,mBAAmB,EAAE,CAAA"}
|