@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
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import type { EntityDeclarationInput, JsonSchema } from '@fayz-ai/core';
|
|
2
|
+
import type { MockShopSeed } from '@fayz-ai/shop/mock';
|
|
3
|
+
import type { Promotion } from '@fayz-ai/shop/rules';
|
|
4
|
+
import type { StorefrontCommerceMode, StorefrontConfig, StorefrontDiscountConfig, StorefrontEnquiryConfig, StorefrontImageLoadingConfig, StorefrontRouteChrome, StorefrontRouteKind, StorefrontSearchConfig } from './config';
|
|
5
|
+
import type { StorefrontTheme } from '../lib/theme';
|
|
6
|
+
import type { HomeConfig, NavLink, FooterConfig } from '../blocks/sections';
|
|
7
|
+
import type { StorefrontPagesConfig } from '../blocks/page-blocks';
|
|
8
|
+
import type { StorefrontSlots } from '../extend/slots';
|
|
9
|
+
import type { StorefrontAuthConfig } from '../data/auth';
|
|
10
|
+
export declare const STORE_DOCUMENT_KIND = "fayz.store";
|
|
11
|
+
export declare const STORE_COMMERCE_MODES: readonly ["checkout", "catalog", "enquiry"];
|
|
12
|
+
export declare const STORE_PAYMENT_MODES: readonly ["mock", "pix-mercadopago"];
|
|
13
|
+
export declare const STORE_PAYMENT_METHOD_KINDS: readonly ["pix", "credit_card", "debit_card", "boleto", "cash", "other"];
|
|
14
|
+
type ConfiguredBackendProvider = NonNullable<NonNullable<StorefrontConfig['backend']>['provider']>;
|
|
15
|
+
export declare const STORE_BACKEND_PROVIDERS: readonly ["mock", "fayz-api", "fayz-shop", "custom"];
|
|
16
|
+
export declare const STORE_ROUTE_KINDS: readonly ["home", "catalog", "product", "checkout", "account", "order", "custom"];
|
|
17
|
+
export declare const STORE_ROUTE_CHROMES: readonly ["default", "focused"];
|
|
18
|
+
export declare const STORE_THEME_RADII: readonly ["none", "soft", "round", "pill"];
|
|
19
|
+
interface StoreSectionBase {
|
|
20
|
+
/** This section's own schema version — sections evolve independently. */
|
|
21
|
+
version: number;
|
|
22
|
+
}
|
|
23
|
+
/** Identity: who the store is. The only mandatory section. */
|
|
24
|
+
export interface StoreIdentitySection extends StoreSectionBase {
|
|
25
|
+
name: string;
|
|
26
|
+
/** ISO 4217 — default 'BRL'. */
|
|
27
|
+
currency?: string;
|
|
28
|
+
/** Intl locale — default 'pt-BR'. */
|
|
29
|
+
locale?: string;
|
|
30
|
+
}
|
|
31
|
+
/** Visual identity — StorefrontTheme, spread into the section. */
|
|
32
|
+
export interface StoreThemeSection extends StoreSectionBase, StorefrontTheme {
|
|
33
|
+
}
|
|
34
|
+
/** Commercial behavior: mode, money, offers. */
|
|
35
|
+
export interface StoreCommerceSection extends StoreSectionBase {
|
|
36
|
+
commerceMode?: StorefrontCommerceMode;
|
|
37
|
+
shipping?: StorefrontConfig['shipping'];
|
|
38
|
+
payments?: StorefrontConfig['payments'];
|
|
39
|
+
discounts?: StorefrontDiscountConfig[];
|
|
40
|
+
enquiry?: StorefrontEnquiryConfig;
|
|
41
|
+
features?: StorefrontConfig['features'];
|
|
42
|
+
}
|
|
43
|
+
/** What the shopper sees: composed pages, slots, chrome. `footer` here holds
|
|
44
|
+
* only the serializable part — a non-string `credit` node moves to
|
|
45
|
+
* `code.footerCredit`. */
|
|
46
|
+
export interface StorePresentationSection extends StoreSectionBase {
|
|
47
|
+
announcement?: string;
|
|
48
|
+
/** Text logo. A JSX logo is code — it lives at `code.logo`. */
|
|
49
|
+
logo?: string;
|
|
50
|
+
home?: HomeConfig;
|
|
51
|
+
pages?: StorefrontPagesConfig;
|
|
52
|
+
slots?: StorefrontSlots;
|
|
53
|
+
nav?: NavLink[];
|
|
54
|
+
footer?: FooterConfig;
|
|
55
|
+
imageLoading?: StorefrontImageLoadingConfig;
|
|
56
|
+
catalogFacets?: StorefrontConfig['catalogFacets'];
|
|
57
|
+
productSpecs?: StorefrontConfig['productSpecs'];
|
|
58
|
+
/** Header search knobs. `renderSuggestion` is code — it lives at
|
|
59
|
+
* `code.searchRenderSuggestion`. */
|
|
60
|
+
search?: Omit<StorefrontSearchConfig, 'renderSuggestion'>;
|
|
61
|
+
}
|
|
62
|
+
/** Long-form content: legal/institutional pages and store-supplied reviews. */
|
|
63
|
+
export interface StoreContentSection extends StoreSectionBase {
|
|
64
|
+
legal?: StorefrontConfig['legal'];
|
|
65
|
+
reviews?: StorefrontConfig['reviews'];
|
|
66
|
+
}
|
|
67
|
+
/** The mock catalog seed (products/categories/discounts). */
|
|
68
|
+
export interface StoreCatalogSection extends StoreSectionBase, MockShopSeed {
|
|
69
|
+
}
|
|
70
|
+
/** Rule-engine promotions (spine M6): serializable Promotion values —
|
|
71
|
+
* eligibility rules + application method, attributes drawn from the
|
|
72
|
+
* rule_attribute vocabulary. "Buy 3 pay 2" and "REVENDA10 = 10% off" are
|
|
73
|
+
* both entries here, as pure data. */
|
|
74
|
+
export interface StorePromotionsSection extends StoreSectionBase {
|
|
75
|
+
promotions?: Promotion[];
|
|
76
|
+
}
|
|
77
|
+
/** Custom entity declarations (spine M4): the defineEntity inputs, keyed by
|
|
78
|
+
* entity key. Pure data — hydration re-declares them through defineEntity,
|
|
79
|
+
* which re-derives the schema, storage, RLS and loaders from the same input. */
|
|
80
|
+
export interface StoreEntitiesSection extends StoreSectionBase {
|
|
81
|
+
definitions?: Record<string, EntityDeclarationInput>;
|
|
82
|
+
}
|
|
83
|
+
/** Backend descriptor. The deprecated supabase fields ride along so a legacy
|
|
84
|
+
* config still round-trips losslessly; new stores use `auth.supabase`. */
|
|
85
|
+
export interface StoreBackendSection extends StoreSectionBase {
|
|
86
|
+
provider?: ConfiguredBackendProvider;
|
|
87
|
+
url?: string;
|
|
88
|
+
/** @deprecated legacy StorefrontConfig field, kept for lossless round-trip. */
|
|
89
|
+
supabaseUrl?: string;
|
|
90
|
+
/** @deprecated legacy StorefrontConfig field, kept for lossless round-trip. */
|
|
91
|
+
supabaseAnonKey?: string;
|
|
92
|
+
}
|
|
93
|
+
/** Customer auth, when it is expressible as data ('mock' / 'supabase' + urls).
|
|
94
|
+
* An auth config carrying code (an AuthAdapter object, a supabase client)
|
|
95
|
+
* moves whole to `code.auth`. */
|
|
96
|
+
export interface StoreAuthSection extends StoreSectionBase, StorefrontAuthConfig {
|
|
97
|
+
}
|
|
98
|
+
/** A custom route whose component is referenced by handle name. */
|
|
99
|
+
export interface StoreCodeRouteRef {
|
|
100
|
+
id: string;
|
|
101
|
+
path: string;
|
|
102
|
+
kind?: StorefrontRouteKind;
|
|
103
|
+
chrome?: StorefrontRouteChrome;
|
|
104
|
+
/** Handle name of the route component. */
|
|
105
|
+
component: string;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* The code sidecar: every config field that holds code, referenced by the
|
|
109
|
+
* handle NAME it was registered under. Hydration resolves these through the
|
|
110
|
+
* handle registry — an unknown name is a hard error naming the valid set (I2),
|
|
111
|
+
* never a silent drop.
|
|
112
|
+
*/
|
|
113
|
+
export interface StoreCodeSection extends StoreSectionBase {
|
|
114
|
+
/** Handle → React.ReactNode (JSX logo). */
|
|
115
|
+
logo?: string;
|
|
116
|
+
/** Handle → ShopProvider. */
|
|
117
|
+
provider?: string;
|
|
118
|
+
/** Handle → StorefrontAuthConfig carrying code. */
|
|
119
|
+
auth?: string;
|
|
120
|
+
/** Handle → React.ReactNode rendered as the footer credit line. */
|
|
121
|
+
footerCredit?: string;
|
|
122
|
+
/** Handle → the `(product) => ReactNode` renderer for a search suggestion. */
|
|
123
|
+
searchRenderSuggestion?: string;
|
|
124
|
+
/** Component-slot name → handle of its ComponentOverride. */
|
|
125
|
+
components?: Record<string, string>;
|
|
126
|
+
routes?: StoreCodeRouteRef[];
|
|
127
|
+
}
|
|
128
|
+
/** Store Document v1 — the serializable form of a whole storefront. */
|
|
129
|
+
export interface StoreDocument {
|
|
130
|
+
$kind: typeof STORE_DOCUMENT_KIND;
|
|
131
|
+
store: StoreIdentitySection;
|
|
132
|
+
theme?: StoreThemeSection;
|
|
133
|
+
commerce?: StoreCommerceSection;
|
|
134
|
+
presentation?: StorePresentationSection;
|
|
135
|
+
content?: StoreContentSection;
|
|
136
|
+
catalog?: StoreCatalogSection;
|
|
137
|
+
entities?: StoreEntitiesSection;
|
|
138
|
+
promotions?: StorePromotionsSection;
|
|
139
|
+
backend?: StoreBackendSection;
|
|
140
|
+
auth?: StoreAuthSection;
|
|
141
|
+
code?: StoreCodeSection;
|
|
142
|
+
}
|
|
143
|
+
export type StoreSectionName = Exclude<keyof StoreDocument, '$kind'>;
|
|
144
|
+
/**
|
|
145
|
+
* A field that is on its way out (spine I10).
|
|
146
|
+
*
|
|
147
|
+
* The section VERSION is what makes this mechanical rather than advisory:
|
|
148
|
+
* while the section is at a version below `removedAtVersion` the field is
|
|
149
|
+
* accepted and the store keeps working; a document that has been through the
|
|
150
|
+
* codemod carries the higher version, and at that version the field is a hard
|
|
151
|
+
* validation error naming `replacement` (I2). That is what lets one SDK serve
|
|
152
|
+
* both a migrated and an unmigrated fleet without a flag.
|
|
153
|
+
*/
|
|
154
|
+
export interface StoreFieldDeprecation {
|
|
155
|
+
/** Row id in @fayz-ai/sdk's deprecation registry — the single source of the
|
|
156
|
+
* version window, the shim prose and the codemod id. */
|
|
157
|
+
id: string;
|
|
158
|
+
/** Section version at which this field stops being accepted. */
|
|
159
|
+
removedAtVersion: number;
|
|
160
|
+
/** Document path to write instead. */
|
|
161
|
+
replacement: string;
|
|
162
|
+
}
|
|
163
|
+
export interface StoreFieldSpec {
|
|
164
|
+
type: 'string' | 'number' | 'boolean' | 'object' | 'array';
|
|
165
|
+
description: string;
|
|
166
|
+
required?: boolean;
|
|
167
|
+
enum?: readonly string[];
|
|
168
|
+
/** Present when the field is deprecated. See {@link StoreFieldDeprecation}. */
|
|
169
|
+
deprecated?: StoreFieldDeprecation;
|
|
170
|
+
}
|
|
171
|
+
export interface StoreSectionSpec {
|
|
172
|
+
description: string;
|
|
173
|
+
/** Versions of this section this SDK understands, ascending. */
|
|
174
|
+
versions: readonly number[];
|
|
175
|
+
fields: Record<string, StoreFieldSpec>;
|
|
176
|
+
}
|
|
177
|
+
export declare const STORE_SECTIONS: Record<StoreSectionName, StoreSectionSpec>;
|
|
178
|
+
export declare const STORE_SECTION_NAMES: StoreSectionName[];
|
|
179
|
+
/** Compile a section's field spec to JSON Schema — the same one-declaration
|
|
180
|
+
* principle as `settingsToJsonSchema` (I1). */
|
|
181
|
+
export declare function sectionToJsonSchema(name: StoreSectionName): JsonSchema;
|
|
182
|
+
/**
|
|
183
|
+
* True when a value survives JSON serialization unchanged: the test that
|
|
184
|
+
* routes a config field into a data section versus the code sidecar. React
|
|
185
|
+
* elements (`$$typeof`), functions, class instances (providers, adapters,
|
|
186
|
+
* supabase clients) all fail it.
|
|
187
|
+
*/
|
|
188
|
+
export declare function isJsonValue(value: unknown): boolean;
|
|
189
|
+
export declare function isRecord(value: unknown): value is Record<string, unknown>;
|
|
190
|
+
/** Copy of `obj` without `undefined`-valued keys, so a document holds exactly
|
|
191
|
+
* what JSON can carry and object equality means what it looks like. */
|
|
192
|
+
export declare function compact<T extends Record<string, unknown>>(obj: T): T;
|
|
193
|
+
export {};
|
|
194
|
+
//# sourceMappingURL=sections.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sections.d.ts","sourceRoot":"","sources":["../../src/document/sections.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAEvE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,KAAK,EACV,sBAAsB,EACtB,gBAAgB,EAChB,wBAAwB,EACxB,uBAAuB,EACvB,4BAA4B,EAC5B,qBAAqB,EACrB,mBAAmB,EACnB,sBAAsB,EACvB,MAAM,UAAU,CAAA;AACjB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAC3E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAA;AAClE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACtD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AAqBxD,eAAO,MAAM,mBAAmB,eAAe,CAAA;AAM/C,eAAO,MAAM,oBAAoB,6CAA0F,CAAA;AAK3H,eAAO,MAAM,mBAAmB,sCAAuC,CAAA;AACvE,eAAO,MAAM,0BAA0B,0EAOU,CAAA;AAKjD,KAAK,yBAAyB,GAAG,WAAW,CAAC,WAAW,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC,C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IACxB,sCAAsC;IACtC,WAAW,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAA;IAC1D,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACxB,+EAA+E;IAC/E,UAAU,CAAC,EAAE,qBAAqB,CAAA;CACnC;AAED,MAAM,WAAW,gBAAgB;IAC/B,WAAW,EAAE,MAAM,CAAA;IACnB,gEAAgE;IAChE,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAA;IAC3B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAA;CACvC;AAQD,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,gBAAgB,EAAE,gBAAgB,CA+JrE,CAAA;AAED,eAAO,MAAM,mBAAmB,EAAkC,gBAAgB,EAAE,CAAA;AAEpF;gDACgD;AAChD,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,gBAAgB,GAAG,UAAU,CA+BtE;AAID;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAenD;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEzE;AAED;wEACwE;AACxE,wBAAgB,OAAO,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAMpE"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import type { StoreDocument, StoreSectionName } from './sections';
|
|
2
|
+
import type { StoreValidationReport } from './validate';
|
|
3
|
+
/** One deprecated thing found in one store. */
|
|
4
|
+
export interface StoreDeprecationFinding {
|
|
5
|
+
/** Registry row id. */
|
|
6
|
+
id: string;
|
|
7
|
+
/** Dotted document path, when the deprecation is on the document surface. */
|
|
8
|
+
path?: string;
|
|
9
|
+
/** What exactly was found, in the author's words. */
|
|
10
|
+
detail: string;
|
|
11
|
+
deprecatedIn: string;
|
|
12
|
+
removeIn: string;
|
|
13
|
+
/** I2 — always present, always the thing to write instead. */
|
|
14
|
+
replacement: string;
|
|
15
|
+
/** The codemod that answers it. */
|
|
16
|
+
codemod: string;
|
|
17
|
+
/** False when only a human can retire it (pool state, code outside the document). */
|
|
18
|
+
automatable: boolean;
|
|
19
|
+
}
|
|
20
|
+
/** Why a codemod would not run, and what a human has to decide instead. */
|
|
21
|
+
export interface StoreCodemodRefusal {
|
|
22
|
+
reason: string;
|
|
23
|
+
/** The decisions, one per line. Never a suggestion the codemod could have
|
|
24
|
+
* taken itself — if it could, it would have. */
|
|
25
|
+
decide: string[];
|
|
26
|
+
}
|
|
27
|
+
export type StoreCodemodStatus =
|
|
28
|
+
/** The document changed (possibly only its section version). */
|
|
29
|
+
'applied'
|
|
30
|
+
/** Nothing here to migrate: the section is absent, or already past this version. */
|
|
31
|
+
| 'not-applicable'
|
|
32
|
+
/** Something is here, and moving it safely needs a human. */
|
|
33
|
+
| 'refused';
|
|
34
|
+
/** A section version move — the key the codemod is filed under. */
|
|
35
|
+
export interface StoreCodemodVersionKey {
|
|
36
|
+
section: StoreSectionName;
|
|
37
|
+
from: number;
|
|
38
|
+
to: number;
|
|
39
|
+
}
|
|
40
|
+
export interface StoreCodemodResult {
|
|
41
|
+
codemod: string;
|
|
42
|
+
status: StoreCodemodStatus;
|
|
43
|
+
/** Registry ids this codemod retires. */
|
|
44
|
+
deprecations: string[];
|
|
45
|
+
/** The version move, or null for a deprecation that is not on the document
|
|
46
|
+
* surface at all — which is itself why such a codemod always refuses. */
|
|
47
|
+
version: StoreCodemodVersionKey | null;
|
|
48
|
+
/** One line per document change, in the applyChange path vocabulary. */
|
|
49
|
+
changes: string[];
|
|
50
|
+
note: string;
|
|
51
|
+
refusal?: StoreCodemodRefusal;
|
|
52
|
+
}
|
|
53
|
+
export interface StoreUpgradeOptions {
|
|
54
|
+
/** Restrict the run to these codemod ids. Unknown ids are a hard error
|
|
55
|
+
* naming the valid set (I2). */
|
|
56
|
+
only?: readonly string[];
|
|
57
|
+
}
|
|
58
|
+
export interface StoreUpgradeResult {
|
|
59
|
+
/** False when a codemod refused or the result would not validate. */
|
|
60
|
+
ok: boolean;
|
|
61
|
+
/** The upgraded document. Deep-equal to the input when `changed` is false. */
|
|
62
|
+
doc: StoreDocument;
|
|
63
|
+
changed: boolean;
|
|
64
|
+
deprecations: StoreDeprecationFinding[];
|
|
65
|
+
codemods: StoreCodemodResult[];
|
|
66
|
+
/** The result validated. A codemod that would break the document is a bug
|
|
67
|
+
* in the codemod, and this is where it surfaces. */
|
|
68
|
+
validation: StoreValidationReport;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* What in THIS document is deprecated — the machine-readable answer to the
|
|
72
|
+
* question I10 exists to make askable.
|
|
73
|
+
*
|
|
74
|
+
* Only the document surface is visible from here. A deprecation living in the
|
|
75
|
+
* store's own code (the productMetadata overlay) or in a pool (the two SQL
|
|
76
|
+
* ones) is reported by its row as un-automatable rather than omitted: an
|
|
77
|
+
* enumerable deprecation that quietly drops the ones you cannot see from a
|
|
78
|
+
* JSON file would be the silent-failure mode the whole spine is against.
|
|
79
|
+
*/
|
|
80
|
+
export declare function scanStoreDeprecations(input: StoreDocument | Record<string, unknown>): StoreDeprecationFinding[];
|
|
81
|
+
/**
|
|
82
|
+
* The deprecations no document can answer for, with the reason.
|
|
83
|
+
*
|
|
84
|
+
* The CLI merges these into its report so `fayz upgrade` never implies a store
|
|
85
|
+
* is clean when the only reason it looks clean is that the evidence is not in
|
|
86
|
+
* the repo.
|
|
87
|
+
*/
|
|
88
|
+
export declare function unobservableDeprecations(): StoreDeprecationFinding[];
|
|
89
|
+
/** Every codemod id, in run order. */
|
|
90
|
+
export declare const STORE_CODEMOD_IDS: readonly string[];
|
|
91
|
+
/** What each codemod is, as data — describeStore publishes this. */
|
|
92
|
+
export interface StoreCodemodDescriptor {
|
|
93
|
+
id: string;
|
|
94
|
+
title: string;
|
|
95
|
+
/** Registry ids it retires. */
|
|
96
|
+
deprecations: string[];
|
|
97
|
+
/** The section version it is keyed to, or null when the deprecation is not
|
|
98
|
+
* on the document surface (such a codemod always refuses). */
|
|
99
|
+
version: StoreCodemodVersionKey | null;
|
|
100
|
+
/** Can it ever apply without a human? */
|
|
101
|
+
automatable: boolean;
|
|
102
|
+
}
|
|
103
|
+
export declare function describeCodemods(): StoreCodemodDescriptor[];
|
|
104
|
+
/**
|
|
105
|
+
* Run the codemods against a document and report exactly what would change.
|
|
106
|
+
*
|
|
107
|
+
* PURE: the input document is never mutated, and a refused codemod contributes
|
|
108
|
+
* nothing to the output — a refusal must leave the document byte-identical or
|
|
109
|
+
* the refusal was not a refusal.
|
|
110
|
+
*/
|
|
111
|
+
export declare function upgradeStore(input: StoreDocument | Record<string, unknown>, options?: StoreUpgradeOptions): StoreUpgradeResult;
|
|
112
|
+
//# sourceMappingURL=upgrade.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upgrade.d.ts","sourceRoot":"","sources":["../../src/document/upgrade.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAEjE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAA;AAyBvD,+CAA+C;AAC/C,MAAM,WAAW,uBAAuB;IACtC,uBAAuB;IACvB,EAAE,EAAE,MAAM,CAAA;IACV,6EAA6E;IAC7E,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,qDAAqD;IACrD,MAAM,EAAE,MAAM,CAAA;IACd,YAAY,EAAE,MAAM,CAAA;IACpB,QAAQ,EAAE,MAAM,CAAA;IAChB,8DAA8D;IAC9D,WAAW,EAAE,MAAM,CAA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Aa,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,uBAAuB,EAAE,CAgC/G;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,IAAI,uBAAuB,EAAE,CAIpE;AAsUD,sCAAsC;AACtC,eAAO,MAAM,iBAAiB,EAAE,SAAS,MAAM,EAAkC,CAAA;AAEjF,oEAAoE;AACpE,MAAM,WAAW,sBAAsB;IACrC,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,+BAA+B;IAC/B,YAAY,EAAE,MAAM,EAAE,CAAA;IACtB;mEAC+D;IAC/D,OAAO,EAAE,sBAAsB,GAAG,IAAI,CAAA;IACtC,yCAAyC;IACzC,WAAW,EAAE,OAAO,CAAA;CACrB;AAED,wBAAgB,gBAAgB,IAAI,sBAAsB,EAAE,CAQ3D;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9C,OAAO,GAAE,mBAAwB,GAChC,kBAAkB,CAqCpB"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface StoreValidationError {
|
|
2
|
+
/** Dotted path into the document ('presentation.pages.home.blocks[2].type'). */
|
|
3
|
+
path: string;
|
|
4
|
+
/** Stable machine-readable code ('unknown-block', 'unsupported-section-version', …). */
|
|
5
|
+
code: string;
|
|
6
|
+
message: string;
|
|
7
|
+
/** The valid set, present on every unknown-id error — what the AI corrects on. */
|
|
8
|
+
valid?: string[];
|
|
9
|
+
}
|
|
10
|
+
export interface StoreValidationReport {
|
|
11
|
+
ok: boolean;
|
|
12
|
+
errors: StoreValidationError[];
|
|
13
|
+
}
|
|
14
|
+
export declare const STOREFRONT_PAGE_KINDS: readonly ["home", "catalog", "product", "collection", "content"];
|
|
15
|
+
/**
|
|
16
|
+
* Validate a Store Document against the registries and section schemas.
|
|
17
|
+
*
|
|
18
|
+
* Self-sufficient: registers the SDK blocks before checking, so "unknown
|
|
19
|
+
* block" always names the true valid set. App-local blocks and handles must be
|
|
20
|
+
* registered by the app's own modules before this runs — which is the same
|
|
21
|
+
* precondition rendering has.
|
|
22
|
+
*/
|
|
23
|
+
export declare function validateStore(doc: unknown): StoreValidationReport;
|
|
24
|
+
//# sourceMappingURL=validate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/document/validate.ts"],"names":[],"mappings":"AA6DA,MAAM,WAAW,oBAAoB;IACnC,gFAAgF;IAChF,IAAI,EAAE,MAAM,CAAA;IACZ,wFAAwF;IACxF,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,kFAAkF;IAClF,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;CACjB;AAED,MAAM,WAAW,qBAAqB;IACpC,EAAE,EAAE,OAAO,CAAA;IACX,MAAM,EAAE,oBAAoB,EAAE,CAAA;CAC/B;AAED,eAAO,MAAM,qBAAqB,kEAAmE,CAAA;AAq4BrG;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,GAAG,qBAAqB,CA4DjE"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
import type { Category, CreateProductEnquiryInput, Product, ProductEnquiry, ProductImage } from '@fayz-ai/shop/types';
|
|
3
|
-
import type { ProductOptionGroup, ProductOptionSelection } from '
|
|
4
|
-
import type { ResolvedStorefrontConfig, StorefrontCommerceMode } from '
|
|
5
|
-
import type { MediaCarouselItem } from '
|
|
6
|
-
import type { CartState } from '
|
|
3
|
+
import type { ProductOptionGroup, ProductOptionSelection } from '../data/product-options';
|
|
4
|
+
import type { ResolvedStorefrontConfig, StorefrontCommerceMode } from '../document/config';
|
|
5
|
+
import type { MediaCarouselItem } from '../blocks/sections';
|
|
6
|
+
import type { CartState } from '../stores/cart.store';
|
|
7
|
+
import type { ComponentOverride } from './component-override';
|
|
7
8
|
export interface StorefrontComponentBaseProps {
|
|
8
9
|
config: ResolvedStorefrontConfig;
|
|
9
10
|
commerceMode: StorefrontCommerceMode;
|
|
@@ -17,9 +18,26 @@ export interface StorefrontActions {
|
|
|
17
18
|
closeCart: () => void;
|
|
18
19
|
createProductEnquiry: (input: CreateProductEnquiryInput) => Promise<ProductEnquiry>;
|
|
19
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* Which photo the CARD shows — the grid-side counterpart of
|
|
23
|
+
* {@link ProductGalleryOrder}.
|
|
24
|
+
*
|
|
25
|
+
* primary the first `is_primary` row, else the first row (the default;
|
|
26
|
+
* byte-identical to what the card has always done)
|
|
27
|
+
* position the lowest `sortOrder`, ties broken by image id
|
|
28
|
+
*
|
|
29
|
+
* `position` exists because `is_primary` is not a unique constraint: artorious
|
|
30
|
+
* carries products with TWO primary rows, which made the card's pick depend on
|
|
31
|
+
* PostgREST's tie order — the same card could show a different photo between
|
|
32
|
+
* two loads. The gallery got `order` in M2; the card had no equivalent and a
|
|
33
|
+
* store fork was the only way to sort by position.
|
|
34
|
+
*/
|
|
35
|
+
export type ProductCardImageOrder = 'primary' | 'position';
|
|
20
36
|
export interface ProductCardProps extends StorefrontComponentBaseProps {
|
|
21
37
|
product: Product;
|
|
22
38
|
actions: Pick<StorefrontActions, 'navigateTo' | 'addToCart' | 'openCart'>;
|
|
39
|
+
/** Defaults to 'primary' — see {@link ProductCardImageOrder}. */
|
|
40
|
+
imageOrder?: ProductCardImageOrder;
|
|
23
41
|
}
|
|
24
42
|
export interface ProductDetailProps extends StorefrontComponentBaseProps {
|
|
25
43
|
product: Product;
|
|
@@ -35,10 +53,24 @@ export interface ProductDetailProps extends StorefrontComponentBaseProps {
|
|
|
35
53
|
addToCart: () => void;
|
|
36
54
|
openEnquiry: () => void;
|
|
37
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* Which photo leads the gallery.
|
|
58
|
+
*
|
|
59
|
+
* primary the merchant's pick: isPrimary first, then sortOrder ascending (default)
|
|
60
|
+
* position sortOrder ascending, ignoring the primary flag
|
|
61
|
+
* newest sortOrder descending — the most recently added photo leads
|
|
62
|
+
*
|
|
63
|
+
* `newest` exists because of a real fork: artorious reimplemented the entire
|
|
64
|
+
* 158-line gallery to change ONLY this rule (its Supabase rows carried two
|
|
65
|
+
* conflicting is_primary flags, so sort_order was the only trustworthy signal).
|
|
66
|
+
* A props-only override (`components.ProductGallery.props.order`) now does it.
|
|
67
|
+
*/
|
|
68
|
+
export type ProductGalleryOrder = 'primary' | 'position' | 'newest';
|
|
38
69
|
export interface ProductGalleryProps extends StorefrontComponentBaseProps {
|
|
39
70
|
product: Product;
|
|
40
71
|
images: ProductImage[];
|
|
41
72
|
primaryImage?: ProductImage;
|
|
73
|
+
order?: ProductGalleryOrder;
|
|
42
74
|
}
|
|
43
75
|
export interface ProductPriceProps extends StorefrontComponentBaseProps {
|
|
44
76
|
product: Product;
|
|
@@ -115,24 +147,44 @@ export interface StorefrontStateProps extends StorefrontComponentBaseProps {
|
|
|
115
147
|
export interface CartDrawerFooterExtraProps extends StorefrontComponentBaseProps {
|
|
116
148
|
cart: CartState;
|
|
117
149
|
}
|
|
150
|
+
/**
|
|
151
|
+
* Code-level component replacements.
|
|
152
|
+
*
|
|
153
|
+
* Each entry accepts either the component (what stores write today) or
|
|
154
|
+
* `{ component?, props? }`. Passing only `props` keeps the SDK component and
|
|
155
|
+
* forces some of its props — which is what four of five customizing stores
|
|
156
|
+
* actually wanted when they replaced a whole card instead.
|
|
157
|
+
*
|
|
158
|
+
* Every field takes the union rather than only the two surfaces stores have
|
|
159
|
+
* overridden so far: "why can I pass props to ProductCard but not CategoryCard"
|
|
160
|
+
* is a worse surface than one extra type.
|
|
161
|
+
*/
|
|
118
162
|
export interface StorefrontComponents {
|
|
119
|
-
ProductCard?:
|
|
120
|
-
ProductDetail?:
|
|
121
|
-
ProductGallery?:
|
|
122
|
-
ProductPrice?:
|
|
123
|
-
ProductActions?:
|
|
124
|
-
ProductEnquiryForm?:
|
|
125
|
-
CategoryCard?:
|
|
126
|
-
CollectionSection?:
|
|
127
|
-
HeroSection?:
|
|
128
|
-
MediaCarousel?:
|
|
129
|
-
ProductSlider?:
|
|
130
|
-
Header?:
|
|
131
|
-
Footer?:
|
|
132
|
-
Shell?:
|
|
133
|
-
EmptyState?:
|
|
134
|
-
LoadingState?:
|
|
135
|
-
ErrorState?:
|
|
136
|
-
CartDrawerFooterExtra?:
|
|
163
|
+
ProductCard?: ComponentOverride<ProductCardProps>;
|
|
164
|
+
ProductDetail?: ComponentOverride<ProductDetailProps>;
|
|
165
|
+
ProductGallery?: ComponentOverride<ProductGalleryProps>;
|
|
166
|
+
ProductPrice?: ComponentOverride<ProductPriceProps>;
|
|
167
|
+
ProductActions?: ComponentOverride<ProductActionsProps>;
|
|
168
|
+
ProductEnquiryForm?: ComponentOverride<ProductEnquiryFormContractProps>;
|
|
169
|
+
CategoryCard?: ComponentOverride<CategoryCardProps>;
|
|
170
|
+
CollectionSection?: ComponentOverride<CollectionSectionProps>;
|
|
171
|
+
HeroSection?: ComponentOverride<HeroSectionContractProps>;
|
|
172
|
+
MediaCarousel?: ComponentOverride<MediaCarouselProps>;
|
|
173
|
+
ProductSlider?: ComponentOverride<ProductSliderProps>;
|
|
174
|
+
Header?: ComponentOverride<StorefrontChromeProps>;
|
|
175
|
+
Footer?: ComponentOverride<StorefrontChromeProps>;
|
|
176
|
+
Shell?: ComponentOverride<StorefrontChromeProps>;
|
|
177
|
+
EmptyState?: ComponentOverride<StorefrontStateProps>;
|
|
178
|
+
LoadingState?: ComponentOverride<StorefrontStateProps>;
|
|
179
|
+
ErrorState?: ComponentOverride<StorefrontStateProps>;
|
|
180
|
+
CartDrawerFooterExtra?: ComponentOverride<CartDrawerFooterExtraProps>;
|
|
137
181
|
}
|
|
182
|
+
/**
|
|
183
|
+
* The override surface as a runtime value, for validators and catalogs: a
|
|
184
|
+
* store document referencing an unknown component slot must be told the valid
|
|
185
|
+
* set (I2), and a type alone cannot say it at runtime. The `satisfies` +
|
|
186
|
+
* exhaustiveness pair keeps this list impossible to leave stale when a key is
|
|
187
|
+
* added to {@link StorefrontComponents}.
|
|
188
|
+
*/
|
|
189
|
+
export declare const STOREFRONT_COMPONENT_KEYS: readonly ["ProductCard", "ProductDetail", "ProductGallery", "ProductPrice", "ProductActions", "ProductEnquiryForm", "CategoryCard", "CollectionSection", "HeroSection", "MediaCarousel", "ProductSlider", "Header", "Footer", "Shell", "EmptyState", "LoadingState", "ErrorState", "CartDrawerFooterExtra"];
|
|
138
190
|
//# sourceMappingURL=component-contracts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-contracts.d.ts","sourceRoot":"","sources":["../../src/extend/component-contracts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,EAAE,QAAQ,EAAE,yBAAyB,EAAE,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AACrH,OAAO,KAAK,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAA;AACzF,OAAO,KAAK,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAA;AAC1F,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AAE7D,MAAM,WAAW,4BAA4B;IAC3C,MAAM,EAAE,wBAAwB,CAAA;IAChC,YAAY,EAAE,sBAAsB,CAAA;IACpC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAA;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EAAE,iBAAiB,CAAC,0BAA0B,CAAC,CAAA;CACtE;AAED;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,6SAmBsB,CAAA"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { ComponentType } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Either the whole component (what stores write today), or an adjustment.
|
|
4
|
+
*
|
|
5
|
+
* `{ props }` alone keeps the SDK component and forces some of its props.
|
|
6
|
+
* `{ component, props }` replaces it and pre-binds props — useful for a wrapper
|
|
7
|
+
* that needs a couple of fixed values.
|
|
8
|
+
*/
|
|
9
|
+
export type ComponentOverride<P> = ComponentType<P> | {
|
|
10
|
+
component?: ComponentType<P>;
|
|
11
|
+
/** Props forced on the component, overriding what the page passes. */
|
|
12
|
+
props?: Partial<P>;
|
|
13
|
+
};
|
|
14
|
+
export interface ResolvedOverride<P> {
|
|
15
|
+
Component: ComponentType<P>;
|
|
16
|
+
/** Props to apply last, so an override wins over what the page computed. */
|
|
17
|
+
props: Partial<P>;
|
|
18
|
+
/** True when the store replaced the component rather than adjusting it. */
|
|
19
|
+
replaced: boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Normalize both override forms against the SDK's own component.
|
|
23
|
+
*
|
|
24
|
+
* Override props are applied AFTER the page's, deliberately: an override that
|
|
25
|
+
* could not win over a computed prop would be unable to change the thing the
|
|
26
|
+
* store is overriding it for.
|
|
27
|
+
*/
|
|
28
|
+
export declare function resolveOverride<P>(override: ComponentOverride<P> | undefined, fallback: ComponentType<P>): ResolvedOverride<P>;
|
|
29
|
+
/**
|
|
30
|
+
* The component an override resolves to, or undefined when the store only
|
|
31
|
+
* adjusted props. Lets a page keep its existing `if (Override) …` branch, which
|
|
32
|
+
* exists because replacing a page body is structurally different from tweaking
|
|
33
|
+
* one of its props.
|
|
34
|
+
*/
|
|
35
|
+
export declare function overrideComponent<P>(override: ComponentOverride<P> | undefined): ComponentType<P> | undefined;
|
|
36
|
+
/** The props an override forces, whether or not it also replaces the component. */
|
|
37
|
+
export declare function overrideProps<P>(override: ComponentOverride<P> | undefined): Partial<P>;
|
|
38
|
+
//# sourceMappingURL=component-override.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-override.d.ts","sourceRoot":"","sources":["../../src/extend/component-override.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAiB1C;;;;;;GAMG;AACH,MAAM,MAAM,iBAAiB,CAAC,CAAC,IAC3B,aAAa,CAAC,CAAC,CAAC,GAChB;IACE,SAAS,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,CAAA;IAC5B,sEAAsE;IACtE,KAAK,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAA;CACnB,CAAA;AAgBL,MAAM,WAAW,gBAAgB,CAAC,CAAC;IACjC,SAAS,EAAE,aAAa,CAAC,CAAC,CAAC,CAAA;IAC3B,4EAA4E;IAC5E,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,CAAA;IACjB,2EAA2E;IAC3E,QAAQ,EAAE,OAAO,CAAA;CAClB;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAC/B,QAAQ,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAAG,SAAS,EAC1C,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,GACzB,gBAAgB,CAAC,CAAC,CAAC,CASrB;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,QAAQ,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAAG,SAAS,GAAG,aAAa,CAAC,CAAC,CAAC,GAAG,SAAS,CAI7G;AAED,mFAAmF;AACnF,wBAAgB,aAAa,CAAC,CAAC,EAAE,QAAQ,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAAG,SAAS,GAAG,OAAO,CAAC,CAAC,CAAC,CAGvF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-selectors.d.ts","sourceRoot":"","sources":["../../src/extend/component-selectors.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,eAAO,MAAM,4BAA4B;;;;;;;;;;;CAK/B,CAAA;AAEV,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAY/B,CAAA;AAEV,MAAM,MAAM,4BAA4B,GAAG,OAAO,4BAA4B,CAAA;AAC9E,MAAM,MAAM,8BAA8B,GAAG,OAAO,4BAA4B,CAAC,aAAa,CAAA"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export interface EditorBridgeOptions {
|
|
2
|
+
/**
|
|
3
|
+
* Origins allowed to drive the picker. An activation from anywhere else is
|
|
4
|
+
* ignored. Required: there is no safe default, because the parent of an
|
|
5
|
+
* iframe is chosen by whoever embedded it.
|
|
6
|
+
*/
|
|
7
|
+
allowedOrigins: readonly string[];
|
|
8
|
+
/** Test seam. Defaults to the ambient window. */
|
|
9
|
+
target?: Window;
|
|
10
|
+
}
|
|
11
|
+
export interface PickedBlock {
|
|
12
|
+
/** Dotted document path — what applyChange accepts and validateStore reports. */
|
|
13
|
+
path: string;
|
|
14
|
+
/** The block's registered type, so the parent can look up its schema. */
|
|
15
|
+
type: string;
|
|
16
|
+
/** Bounding rect of the block's first painted child, for the parent's overlay. */
|
|
17
|
+
rect?: {
|
|
18
|
+
top: number;
|
|
19
|
+
left: number;
|
|
20
|
+
width: number;
|
|
21
|
+
height: number;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export declare const EDITOR_MESSAGES: {
|
|
25
|
+
readonly activate: "ACTIVATE_ELEMENT_PICKER";
|
|
26
|
+
readonly deactivate: "DEACTIVATE_ELEMENT_PICKER";
|
|
27
|
+
readonly ready: "ELEMENT_PICKER_READY";
|
|
28
|
+
readonly picked: "ELEMENT_PICKED";
|
|
29
|
+
readonly cancelled: "ELEMENT_PICKER_CANCELLED";
|
|
30
|
+
readonly navigation: "NAVIGATION_CHANGE";
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* The nearest ancestor that is a block, and the element that actually paints.
|
|
34
|
+
*
|
|
35
|
+
* The stamp lives on a `display: contents` wrapper, which has no box of its
|
|
36
|
+
* own — `getBoundingClientRect()` on it returns zeros. So the rect comes from
|
|
37
|
+
* its first element child, which is the block's real root.
|
|
38
|
+
*/
|
|
39
|
+
export declare function blockAt(element: Element | null): {
|
|
40
|
+
path: string;
|
|
41
|
+
type: string;
|
|
42
|
+
node: Element;
|
|
43
|
+
} | null;
|
|
44
|
+
/**
|
|
45
|
+
* Wire the storefront to an editor parent. Returns a teardown.
|
|
46
|
+
*
|
|
47
|
+
* Inert when the page is not framed: a storefront served to a shopper has
|
|
48
|
+
* `window.parent === window`, nothing is registered, and editor mode stays off.
|
|
49
|
+
*/
|
|
50
|
+
export declare function connectEditorBridge(options: EditorBridgeOptions): () => void;
|
|
51
|
+
/**
|
|
52
|
+
* Tell the parent the route changed, so its URL bar follows the iframe.
|
|
53
|
+
*
|
|
54
|
+
* Silent until an allowed parent has activated the bridge — the path is not
|
|
55
|
+
* sensitive, but broadcasting to '*' from every storefront is a habit worth
|
|
56
|
+
* not forming.
|
|
57
|
+
*/
|
|
58
|
+
export declare function reportNavigation(path: string, parentOrigin: string | null, target?: Window): void;
|
|
59
|
+
//# sourceMappingURL=editor-bridge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editor-bridge.d.ts","sourceRoot":"","sources":["../../src/extend/editor-bridge.ts"],"names":[],"mappings":"AAeA,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,cAAc,EAAE,SAAS,MAAM,EAAE,CAAA;IACjC,iDAAiD;IACjD,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,WAAW;IAC1B,iFAAiF;IACjF,IAAI,EAAE,MAAM,CAAA;IACZ,yEAAyE;IACzE,IAAI,EAAE,MAAM,CAAA;IACZ,kFAAkF;IAClF,IAAI,CAAC,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAA;CACpE;AAED,eAAO,MAAM,eAAe;;;;;;;CAOlB,CAAA;AAEV;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,CAWrG;AAQD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,mBAAmB,GAAG,MAAM,IAAI,CA8E5E;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,IAAI,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAIjG"}
|