@mohasinac/appkit 4.53.0 → 4.53.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.build-stamp.json +3 -3
- package/dist/_internal/client/scaffolds/AppShell.js +1 -1
- package/dist/_internal/server/features/auctions/og.d.ts +3 -1
- package/dist/_internal/server/features/auctions/og.js +3 -1
- package/dist/_internal/server/features/bundles/actions.js +1 -1
- package/dist/_internal/server/features/business-documents/download.d.ts +41 -0
- package/dist/_internal/server/features/business-documents/download.js +91 -0
- package/dist/_internal/server/features/categories/adapters.d.ts +1 -1
- package/dist/_internal/server/features/categories/adapters.js +10 -0
- package/dist/_internal/server/features/checkout/actions.d.ts +14 -0
- package/dist/_internal/server/features/checkout/actions.js +106 -12
- package/dist/_internal/server/features/checkout/bundle-expansion.js +17 -0
- package/dist/_internal/server/features/checkout/data.d.ts +22 -0
- package/dist/_internal/server/features/checkout/group-rule-revalidation.d.ts +34 -0
- package/dist/_internal/server/features/checkout/group-rule-revalidation.js +124 -0
- package/dist/_internal/server/features/checkout/supplier-identity.d.ts +55 -0
- package/dist/_internal/server/features/checkout/supplier-identity.js +81 -0
- package/dist/_internal/server/features/classified/metadata.js +1 -1
- package/dist/_internal/server/features/classified/og.d.ts +3 -1
- package/dist/_internal/server/features/classified/og.js +3 -1
- package/dist/_internal/server/features/digital-code/metadata.js +1 -1
- package/dist/_internal/server/features/digital-code/og.d.ts +3 -1
- package/dist/_internal/server/features/digital-code/og.js +3 -1
- package/dist/_internal/server/features/digital-code/pool.d.ts +19 -4
- package/dist/_internal/server/features/digital-code/pool.js +19 -4
- package/dist/_internal/server/features/live/metadata.js +1 -1
- package/dist/_internal/server/features/live/og.d.ts +3 -1
- package/dist/_internal/server/features/live/og.js +3 -1
- package/dist/_internal/server/features/messages/actions.js +1 -1
- package/dist/_internal/server/features/parts/og.js +1 -1
- package/dist/_internal/server/features/pre-orders/og.d.ts +3 -1
- package/dist/_internal/server/features/pre-orders/og.js +3 -1
- package/dist/_internal/server/features/price-index/search.d.ts +18 -0
- package/dist/_internal/server/features/price-index/search.js +47 -7
- package/dist/_internal/server/features/prize-draws/og.d.ts +3 -1
- package/dist/_internal/server/features/prize-draws/og.js +3 -1
- package/dist/_internal/server/features/products/group-members.d.ts +26 -0
- package/dist/_internal/server/features/products/group-members.js +7 -1
- package/dist/_internal/server/features/products/og.d.ts +3 -1
- package/dist/_internal/server/features/products/og.js +3 -1
- package/dist/_internal/server/features/search/scoped-sources.d.ts +26 -0
- package/dist/_internal/server/features/search/scoped-sources.js +252 -0
- package/dist/_internal/server/features/search/search-everything.d.ts +57 -0
- package/dist/_internal/server/features/search/search-everything.js +70 -20
- package/dist/_internal/server/features/seo/sitemap.js +6 -0
- package/dist/_internal/server/features/shared/listing-adapters.js +4 -2
- package/dist/_internal/server/features/sticker-trace/adapters.d.ts +11 -0
- package/dist/_internal/server/features/sticker-trace/adapters.js +1 -0
- package/dist/_internal/server/features/sticker-trace/promote-to-listings.d.ts +26 -0
- package/dist/_internal/server/features/sticker-trace/promote-to-listings.js +264 -0
- package/dist/_internal/server/features/sticker-trace/sheet-actions.d.ts +3 -1
- package/dist/_internal/server/features/sticker-trace/sheet-actions.js +32 -0
- package/dist/_internal/server/features/sticker-trace/storage.d.ts +20 -1
- package/dist/_internal/server/features/sticker-trace/storage.js +20 -1
- package/dist/_internal/server/features/stores/adapters.d.ts +1 -1
- package/dist/_internal/server/features/stores/adapters.js +16 -0
- package/dist/_internal/server/features/stores/index.d.ts +1 -0
- package/dist/_internal/server/features/stores/index.js +1 -0
- package/dist/_internal/server/features/stores/tabs.d.ts +25 -0
- package/dist/_internal/server/features/stores/tabs.js +122 -0
- package/dist/_internal/shared/checkout/rules/_defaults.js +0 -2
- package/dist/_internal/shared/checkout/rules/_limits.d.ts +14 -1
- package/dist/_internal/shared/checkout/rules/_limits.js +14 -1
- package/dist/_internal/shared/checkout/rules/_registry.js +2 -0
- package/dist/_internal/shared/checkout/rules/auction.rule.js +9 -1
- package/dist/_internal/shared/checkout/rules/bundle.rule.js +13 -0
- package/dist/_internal/shared/checkout/rules/index.d.ts +2 -0
- package/dist/_internal/shared/checkout/rules/index.js +9 -0
- package/dist/_internal/shared/checkout/rules/offer.rule.js +0 -1
- package/dist/_internal/shared/checkout/rules/payment-gate.d.ts +26 -0
- package/dist/_internal/shared/checkout/rules/payment-gate.js +133 -0
- package/dist/_internal/shared/checkout/rules/prize-draw.rule.js +29 -8
- package/dist/_internal/shared/checkout/rules/spares.rule.d.ts +16 -0
- package/dist/_internal/shared/checkout/rules/spares.rule.js +5 -0
- package/dist/_internal/shared/checkout/rules/types.d.ts +26 -2
- package/dist/_internal/shared/config/schema.d.ts +122 -0
- package/dist/_internal/shared/features/cart/schema.js +3 -2
- package/dist/_internal/shared/features/products/group-rules.d.ts +75 -0
- package/dist/_internal/shared/features/products/group-rules.js +142 -0
- package/dist/_internal/shared/listing-types/_registry.d.ts +24 -0
- package/dist/_internal/shared/listing-types/_registry.js +39 -1
- package/dist/_internal/shared/listing-types/art/config.d.ts +1 -0
- package/dist/_internal/shared/listing-types/art/config.js +2 -0
- package/dist/_internal/shared/listing-types/auction/config.d.ts +1 -0
- package/dist/_internal/shared/listing-types/auction/config.js +2 -0
- package/dist/_internal/shared/listing-types/availability.js +48 -0
- package/dist/_internal/shared/listing-types/capabilities.js +19 -0
- package/dist/_internal/shared/listing-types/classified/config.d.ts +1 -0
- package/dist/_internal/shared/listing-types/classified/config.js +2 -0
- package/dist/_internal/shared/listing-types/digital-code/config.d.ts +1 -0
- package/dist/_internal/shared/listing-types/digital-code/config.js +2 -0
- package/dist/_internal/shared/listing-types/feature-flags.js +1 -0
- package/dist/_internal/shared/listing-types/live/config.d.ts +1 -0
- package/dist/_internal/shared/listing-types/live/config.js +2 -0
- package/dist/_internal/shared/listing-types/pre-order/config.d.ts +1 -0
- package/dist/_internal/shared/listing-types/pre-order/config.js +2 -0
- package/dist/_internal/shared/listing-types/prize-draw/config.d.ts +1 -0
- package/dist/_internal/shared/listing-types/prize-draw/config.js +2 -0
- package/dist/_internal/shared/listing-types/spares/config.d.ts +74 -0
- package/dist/_internal/shared/listing-types/spares/config.js +60 -0
- package/dist/_internal/shared/listing-types/spares/ctas.d.ts +1 -0
- package/dist/_internal/shared/listing-types/spares/ctas.js +4 -0
- package/dist/_internal/shared/listing-types/spares/og.js +1 -0
- package/dist/_internal/shared/listing-types/spares/schema.d.ts +2 -0
- package/dist/_internal/shared/listing-types/spares/schema.js +3 -0
- package/dist/_internal/shared/listing-types/spares/seed-factory.d.ts +1 -0
- package/dist/_internal/shared/listing-types/spares/seed-factory.js +1 -0
- package/dist/_internal/shared/listing-types/standard/config.d.ts +1 -0
- package/dist/_internal/shared/listing-types/standard/config.js +2 -0
- package/dist/_internal/shared/listing-types/stickers/config.d.ts +1 -0
- package/dist/_internal/shared/listing-types/stickers/config.js +2 -0
- package/dist/_internal/shared/search/match.d.ts +11 -0
- package/dist/_internal/shared/search/match.js +2 -1
- package/dist/_internal/shared/search/to-groups.d.ts +52 -0
- package/dist/_internal/shared/search/to-groups.js +141 -0
- package/dist/client.d.ts +8 -2
- package/dist/client.js +4 -1
- package/dist/constants/api-endpoints.d.ts +39 -15
- package/dist/constants/api-endpoints.js +28 -5
- package/dist/constants/cache-invalidation.js +3 -1
- package/dist/constants/field-names.d.ts +6 -0
- package/dist/constants/field-names.js +6 -0
- package/dist/features/about/components/PolicyPageView.d.ts +22 -2
- package/dist/features/about/components/PolicyPageView.js +14 -2
- package/dist/features/about/components/PublicProfileView.js +2 -1
- package/dist/features/about/components/ShippingPolicyView.js +42 -2
- package/dist/features/account/components/NotificationBell.js +1 -1
- package/dist/features/account/hooks/useProfileStats.js +5 -1
- package/dist/features/addresses/repository/addresses.repository.d.ts +16 -0
- package/dist/features/addresses/repository/addresses.repository.js +21 -0
- package/dist/features/admin/actions/admin-actions.js +16 -1
- package/dist/features/admin/components/AdminCategoryEditorView.js +19 -2
- package/dist/features/admin/components/AdminNavigationView.js +1 -1
- package/dist/features/admin/components/AdminPageHeader.js +1 -1
- package/dist/features/admin/components/AdminProductEditorView.js +17 -2
- package/dist/features/admin/components/AdminSidebar.js +1 -1
- package/dist/features/admin/components/AdminSiteSettingsView.js +39 -8
- package/dist/features/admin/components/AdminSparesView.d.ts +12 -0
- package/dist/features/admin/components/AdminSparesView.js +30 -0
- package/dist/features/admin/components/AdminUsersView.js +9 -7
- package/dist/features/admin/components/index.d.ts +2 -0
- package/dist/features/admin/components/index.js +1 -0
- package/dist/features/admin/components/sections/adminSectionsTypes.js +7 -0
- package/dist/features/admin/constants/filter-tabs.d.ts +3 -0
- package/dist/features/admin/constants/filter-tabs.js +1 -0
- package/dist/features/admin/schemas/firestore.d.ts +26 -2
- package/dist/features/auctions/components/AuctionDetailPageView.js +4 -11
- package/dist/features/auth/repository/user.repository.d.ts +13 -0
- package/dist/features/auth/repository/user.repository.js +28 -0
- package/dist/features/auth/schemas/firestore.d.ts +2 -0
- package/dist/features/auth/schemas/firestore.js +2 -0
- package/dist/features/business-documents/repository/business-documents.repository.d.ts +58 -0
- package/dist/features/business-documents/repository/business-documents.repository.js +54 -0
- package/dist/features/business-documents/schemas/firestore.d.ts +105 -0
- package/dist/features/business-documents/schemas/firestore.js +75 -0
- package/dist/features/cart/actions/cart-actions.js +83 -6
- package/dist/features/cart/repository/cart.repository.js +32 -4
- package/dist/features/cart/schemas/firestore.d.ts +20 -0
- package/dist/features/cart/schemas/index.d.ts +2 -2
- package/dist/features/catalogue/components/PublicCatalogueItemDetailView.js +1 -1
- package/dist/features/categories/api/[id]/price-guidance/route.d.ts +42 -0
- package/dist/features/categories/api/[id]/price-guidance/route.js +113 -0
- package/dist/features/categories/components/BrandDetailPageView.js +19 -3
- package/dist/features/categories/components/BrandDetailTabs.js +10 -0
- package/dist/features/categories/components/CategoriesIndexListing.js +23 -8
- package/dist/features/categories/components/CategoryDetailPageView.js +141 -14
- package/dist/features/categories/components/CategoryDetailTabs.js +12 -0
- package/dist/features/categories/components/CategoryGrid.js +10 -1
- package/dist/features/categories/components/PriceGuidanceHint.d.ts +29 -0
- package/dist/features/categories/components/PriceGuidanceHint.js +61 -0
- package/dist/features/categories/components/SubcategoryCardRow.d.ts +27 -0
- package/dist/features/categories/components/SubcategoryCardRow.js +98 -0
- package/dist/features/categories/constants/category-tabs.d.ts +20 -25
- package/dist/features/categories/constants/category-tabs.js +22 -39
- package/dist/features/categories/repository/categories.repository.d.ts +12 -0
- package/dist/features/categories/repository/categories.repository.js +20 -0
- package/dist/features/categories/schemas/firestore.d.ts +22 -1
- package/dist/features/categories/schemas/firestore.js +10 -0
- package/dist/features/categories/schemas/index.d.ts +6 -0
- package/dist/features/categories/schemas/index.js +2 -0
- package/dist/features/categories/types/index.d.ts +8 -0
- package/dist/features/categories/utils/taxonomy-visual.d.ts +16 -3
- package/dist/features/categories/utils/taxonomy-visual.js +26 -10
- package/dist/features/classified/components/ClassifiedDetailPageView.js +4 -9
- package/dist/features/contact/components/ContactPageView.d.ts +33 -1
- package/dist/features/contact/components/ContactPageView.js +58 -28
- package/dist/features/digital-codes/components/DigitalCodeDetailPageView.js +4 -9
- package/dist/features/grouped/components/GroupedListingDetailView.js +9 -1
- package/dist/features/grouped/schemas/firestore.d.ts +5 -0
- package/dist/features/homepage/actions/homepage-section-actions.d.ts +3 -3
- package/dist/features/homepage/components/CollectionCardsSection.d.ts +28 -6
- package/dist/features/homepage/components/CollectionCardsSection.js +43 -8
- package/dist/features/homepage/components/HowItWorksSection.d.ts +23 -6
- package/dist/features/homepage/components/HowItWorksSection.js +4 -4
- package/dist/features/homepage/components/PromoGrid.d.ts +31 -2
- package/dist/features/homepage/components/PromoGrid.js +12 -3
- package/dist/features/homepage/components/TestimonialsCarousel.d.ts +34 -2
- package/dist/features/homepage/components/TestimonialsCarousel.js +1 -1
- package/dist/features/homepage/components/index.d.ts +0 -20
- package/dist/features/homepage/components/index.js +0 -11
- package/dist/features/homepage/index.d.ts +0 -2
- package/dist/features/homepage/index.js +0 -2
- package/dist/features/homepage/lib/section-renderer.d.ts +9 -0
- package/dist/features/homepage/lib/section-renderer.js +202 -58
- package/dist/features/homepage/repository/homepage-sections.repository.d.ts +35 -3
- package/dist/features/homepage/repository/homepage-sections.repository.js +58 -8
- package/dist/features/homepage/schemas/firestore.d.ts +106 -3
- package/dist/features/homepage/schemas/firestore.js +32 -2
- package/dist/features/homepage/schemas/index.d.ts +36 -7
- package/dist/features/homepage/schemas/index.js +39 -27
- package/dist/features/homepage/server.d.ts +0 -3
- package/dist/features/homepage/server.js +0 -3
- package/dist/features/homepage/types/index.d.ts +0 -47
- package/dist/features/homepage/types/index.js +49 -0
- package/dist/features/layout/AppLayoutShell.js +1 -1
- package/dist/features/layout/BottomNavItem.js +1 -1
- package/dist/features/layout/BottomSheet.js +1 -1
- package/dist/features/layout/TitleBarLayout.js +1 -1
- package/dist/features/live/components/LiveItemDetailPageView.js +4 -9
- package/dist/features/media/hooks/useMedia.js +17 -0
- package/dist/features/media/repository/media-assets.repository.d.ts +46 -0
- package/dist/features/media/repository/media-assets.repository.js +31 -0
- package/dist/features/media/trust-signals.d.ts +85 -0
- package/dist/features/media/trust-signals.js +126 -0
- package/dist/features/parts/components/PartDetailPageView.d.ts +14 -1
- package/dist/features/parts/components/PartDetailPageView.js +2 -2
- package/dist/features/parts/components/PartsIndexPageView.d.ts +11 -2
- package/dist/features/parts/components/PartsIndexPageView.js +2 -2
- package/dist/features/parts/components/PartsSearchBox.d.ts +9 -0
- package/dist/features/parts/components/PartsSearchBox.js +57 -0
- package/dist/features/parts/schemas/firestore.d.ts +149 -3
- package/dist/features/parts/schemas/firestore.js +184 -0
- package/dist/features/payments/repository/payout.repository.d.ts +15 -0
- package/dist/features/payments/repository/payout.repository.js +21 -0
- package/dist/features/pre-orders/components/PreOrderDetailPageView.js +4 -11
- package/dist/features/pre-orders/components/PreOrdersIndexListing.js +1 -1
- package/dist/features/price-index/components/PriceIndexToolView.d.ts +3 -1
- package/dist/features/price-index/components/PriceIndexToolView.js +92 -13
- package/dist/features/products/components/CompareOverlay.d.ts +18 -1
- package/dist/features/products/components/CompareOverlay.js +21 -2
- package/dist/features/products/components/CustomSectionTabContent.d.ts +31 -0
- package/dist/features/products/components/CustomSectionTabContent.js +29 -3
- package/dist/features/products/components/GroupMemberPicker.d.ts +19 -1
- package/dist/features/products/components/GroupMemberPicker.js +46 -8
- package/dist/features/products/components/GroupSettingsPanel.d.ts +11 -1
- package/dist/features/products/components/GroupSettingsPanel.js +91 -3
- package/dist/features/products/components/PrizeDrawDetailPageView.js +1 -1
- package/dist/features/products/components/PrizeDrawEntryActions.d.ts +15 -1
- package/dist/features/products/components/PrizeDrawEntryActions.js +70 -8
- package/dist/features/products/components/ProductDetailPageView.js +74 -15
- package/dist/features/products/components/ProductForm.d.ts +13 -1
- package/dist/features/products/components/ProductForm.js +16 -2
- package/dist/features/products/components/ProductsIndexListing.d.ts +16 -1
- package/dist/features/products/components/ProductsIndexListing.js +3 -3
- package/dist/features/products/components/ShowGroupSection.js +15 -2
- package/dist/features/products/components/SparesListView.d.ts +7 -0
- package/dist/features/products/components/SparesListView.js +39 -0
- package/dist/features/products/constants/action-defs.d.ts +1 -0
- package/dist/features/products/constants/action-defs.js +1 -0
- package/dist/features/products/repository/products.repository.d.ts +98 -0
- package/dist/features/products/repository/products.repository.js +235 -17
- package/dist/features/products/schemas/firestore.d.ts +97 -4
- package/dist/features/products/schemas/firestore.js +104 -0
- package/dist/features/products/schemas/index.d.ts +10 -19
- package/dist/features/products/schemas/index.js +23 -6
- package/dist/features/products/types/index.d.ts +45 -1
- package/dist/features/products/utils/group-member-image.d.ts +39 -0
- package/dist/features/products/utils/group-member-image.js +3 -0
- package/dist/features/products/utils/listing-badge-variant.js +4 -0
- package/dist/features/reviews/components/ReviewsList.js +1 -1
- package/dist/features/scams/components/ScamProfileView.js +1 -1
- package/dist/features/search/components/EntityTypeahead.d.ts +44 -0
- package/dist/features/search/components/EntityTypeahead.js +92 -0
- package/dist/features/search/components/Search.d.ts +12 -1
- package/dist/features/search/components/Search.js +47 -3
- package/dist/features/search/components/SearchFacetRail.d.ts +11 -0
- package/dist/features/search/components/SearchFacetRail.js +92 -0
- package/dist/features/search/components/SearchResultsClient.d.ts +33 -0
- package/dist/features/search/components/SearchResultsClient.js +103 -0
- package/dist/features/search/components/SearchResultsPageView.d.ts +15 -1
- package/dist/features/search/components/SearchResultsPageView.js +2 -2
- package/dist/features/search/components/index.d.ts +0 -6
- package/dist/features/search/components/index.js +0 -3
- package/dist/features/search/hooks/useNavSuggestions.d.ts +13 -0
- package/dist/features/search/hooks/useScopedSearch.d.ts +34 -0
- package/dist/features/search/hooks/useScopedSearch.js +114 -0
- package/dist/features/search/hooks/useSiteSearch.d.ts +26 -0
- package/dist/features/search/hooks/useSiteSearch.js +149 -0
- package/dist/features/search/index.d.ts +0 -4
- package/dist/features/search/index.js +0 -4
- package/dist/features/search/manifest.d.ts +12 -0
- package/dist/features/search/manifest.js +17 -2
- package/dist/features/search/server.d.ts +0 -3
- package/dist/features/search/server.js +0 -3
- package/dist/features/seller/components/SellerListingTypeView.d.ts +1 -1
- package/dist/features/seller/components/SellerListingTypeView.js +20 -0
- package/dist/features/seller/components/SellerPayoutSettingsView.js +35 -14
- package/dist/features/seller/components/SellerProductShell.d.ts +1 -1
- package/dist/features/seller/components/SellerProductShell.js +2 -1
- package/dist/features/seller/components/SellerSidebar.js +1 -1
- package/dist/features/seller/components/SellerSparesView.d.ts +17 -0
- package/dist/features/seller/components/SellerSparesView.js +6 -0
- package/dist/features/seller/components/index.d.ts +2 -0
- package/dist/features/seller/components/index.js +1 -0
- package/dist/features/shell/CommandPalette.js +1 -1
- package/dist/features/sticker-trace/schemas/firestore.d.ts +19 -0
- package/dist/features/stores/components/StoreDetailLayoutView.d.ts +1 -1
- package/dist/features/stores/components/StoreDetailLayoutView.js +7 -82
- package/dist/features/stores/components/StoreHeader.js +1 -2
- package/dist/features/stores/components/StoreSparesPageView.d.ts +27 -0
- package/dist/features/stores/components/StoreSparesPageView.js +48 -0
- package/dist/features/stores/schemas/firestore.d.ts +19 -0
- package/dist/features/tester/seed-data/authored/buying__spares-and-groups.d.ts +2 -0
- package/dist/features/tester/seed-data/authored/buying__spares-and-groups.js +96 -0
- package/dist/features/tester/seed-data/authored/content-discovery__authenticity-checker.d.ts +2 -0
- package/dist/features/tester/seed-data/authored/content-discovery__authenticity-checker.js +280 -45
- package/dist/features/tester/seed-data/authored/content-discovery__category-tabs-franchise-bundles.js +54 -32
- package/dist/features/tester/seed-data/authored/content-discovery__parts-database.js +3 -2
- package/dist/features/tester/seed-data/authored/content-discovery__price-index-and-compare.d.ts +2 -0
- package/dist/features/tester/seed-data/authored/content-discovery__price-index-and-compare.js +73 -0
- package/dist/features/tester/seed-data/authored/content-discovery__site-wide-index.d.ts +2 -0
- package/dist/features/tester/seed-data/authored/content-discovery__site-wide-index.js +340 -0
- package/dist/features/tester/seed-data/authored/index.js +16 -0
- package/dist/features/tester/seed-data/authored/search-and-nav__header-search.d.ts +1 -0
- package/dist/features/tester/seed-data/authored/search-and-nav__header-search.js +57 -0
- package/dist/features/tester/seed-data/authored/selling__spares-and-group-editing.d.ts +2 -0
- package/dist/features/tester/seed-data/authored/selling__spares-and-group-editing.js +77 -0
- package/dist/features/tester/seed-data/authored/tools__sticker-promote-to-listings.d.ts +2 -0
- package/dist/features/tester/seed-data/authored/tools__sticker-promote-to-listings.js +58 -0
- package/dist/features/tester/seed-data/authored/tools__sticker-tracer.js +5 -4
- package/dist/features/tester/seed-data/tester-checklist-seed-data.js +372 -18
- package/dist/index.d.ts +17 -57
- package/dist/index.js +35 -96
- package/dist/next/routing/route-map.d.ts +42 -1
- package/dist/next/routing/route-map.js +45 -0
- package/dist/providers/db-firebase/base.repository.d.ts +22 -0
- package/dist/providers/db-firebase/base.repository.js +36 -0
- package/dist/schemas/registry.d.ts +15 -6
- package/dist/security/blind-index-tokens.d.ts +54 -0
- package/dist/security/blind-index-tokens.js +152 -0
- package/dist/security/index.d.ts +1 -1
- package/dist/security/index.js +1 -1
- package/dist/security/settings-encryption.d.ts +35 -0
- package/dist/security/settings-encryption.js +91 -0
- package/dist/seed/_helpers/brand-rows.js +38 -14
- package/dist/seed/_helpers/category-forest.js +73 -7
- package/dist/seed/_helpers/category-images-generated.d.ts +25 -6
- package/dist/seed/_helpers/category-images-generated.js +81 -6
- package/dist/seed/_helpers/category-models.d.ts +1 -1
- package/dist/seed/_helpers/category-models.js +7 -1
- package/dist/seed/_helpers/category-parts-glossary-map.js +8 -0
- package/dist/seed/_helpers/category-parts.d.ts +1 -1
- package/dist/seed/_helpers/category-parts.js +50 -2
- package/dist/seed/_helpers/character-features.d.ts +1 -1
- package/dist/seed/_helpers/character-features.js +2 -1
- package/dist/seed/_helpers/franchise-rows.js +10 -2
- package/dist/seed/_helpers/media.d.ts +47 -0
- package/dist/seed/_helpers/media.js +34 -0
- package/dist/seed/authenticity-knowledge-seed-data.d.ts +49 -5
- package/dist/seed/authenticity-knowledge-seed-data.js +10001 -549
- package/dist/seed/categories-seed-data.js +124 -20
- package/dist/seed/grouped-listings-seed-data.js +16 -0
- package/dist/seed/homepage-sections-seed-data.js +94 -5
- package/dist/seed/index.d.ts +2 -3
- package/dist/seed/index.js +2 -2
- package/dist/seed/manifest.js +3 -0
- package/dist/seed/media-assets-seed-data.d.ts +1 -1
- package/dist/seed/media-assets-seed-data.js +746 -196
- package/dist/seed/model-composition-seed-data.js +122 -6
- package/dist/seed/part-glossary-seed-data.d.ts +1 -1
- package/dist/seed/part-glossary-seed-data.js +37219 -463
- package/dist/seed/products-art-seed-data.js +7 -18
- package/dist/seed/products-auctions-seed-data.js +56 -47
- package/dist/seed/products-beyblade-x-seed-data.d.ts +2 -0
- package/dist/seed/products-beyblade-x-seed-data.js +441 -0
- package/dist/seed/products-catalogue-seed-data.d.ts +5 -5
- package/dist/seed/products-catalogue-seed-data.js +1500 -1240
- package/dist/seed/products-classifieds-seed-data.js +9 -27
- package/dist/seed/products-digital-codes-seed-data.js +9 -18
- package/dist/seed/products-live-items-seed-data.js +5 -13
- package/dist/seed/products-preorders-seed-data.js +67 -33
- package/dist/seed/products-prize-draws-seed-data.js +8 -17
- package/dist/seed/products-spares-seed-data.d.ts +2 -0
- package/dist/seed/products-spares-seed-data.js +368 -0
- package/dist/seed/products-standard-seed-data.js +39 -126
- package/dist/seed/products-stickers-seed-data.js +59 -15
- package/dist/seed/site-settings-seed-data.js +8 -0
- package/dist/seo/json-ld.d.ts +25 -0
- package/dist/seo/json-ld.js +28 -0
- package/dist/server-entry.d.ts +3 -1
- package/dist/server-entry.js +2 -2
- package/dist/server.d.ts +9 -9
- package/dist/server.js +27 -25
- package/dist/styles.css +202 -1
- package/dist/tailwind-input.css +31 -17
- package/dist/tailwind-utilities.css +1 -1
- package/dist/ui/components/Accordion.js +1 -1
- package/dist/ui/components/Breadcrumb.js +1 -1
- package/dist/ui/components/DetailPageGallery.js +0 -2
- package/dist/ui/components/DetailPageHero.js +0 -1
- package/dist/ui/components/DetailPageTabs.js +1 -1
- package/dist/ui/components/Divider.js +3 -3
- package/dist/ui/components/GatedPrice.js +5 -1
- package/dist/ui/components/HorizontalScroller.js +1 -1
- package/dist/ui/components/ListingLayout.js +3 -3
- package/dist/ui/components/MediaTabs.style.css +81 -0
- package/dist/ui/components/Pagination.js +1 -1
- package/dist/ui/components/PendingValue.d.ts +45 -0
- package/dist/ui/components/PendingValue.js +7 -0
- package/dist/ui/components/Radio.style.css +119 -0
- package/dist/ui/components/RatingDisplay.js +2 -2
- package/dist/ui/components/SettingsSection.js +0 -2
- package/dist/ui/components/SiteLogo.js +3 -0
- package/dist/ui/components/SiteMark.js +3 -0
- package/dist/ui/components/SortDropdown.js +1 -1
- package/dist/ui/components/SpecTable.d.ts +58 -0
- package/dist/ui/components/SpecTable.js +8 -0
- package/dist/ui/components/StarRating.js +1 -3
- package/dist/ui/components/SummaryCard.js +1 -1
- package/dist/ui/components/index.style.css +1 -0
- package/dist/ui/icons/icon-registry.d.ts +1 -0
- package/dist/ui/icons/icon-registry.js +9 -1
- package/dist/ui/index.d.ts +4 -0
- package/dist/ui/index.js +2 -0
- package/dist/utils/search-txt-query.d.ts +12 -0
- package/dist/utils/search-txt-query.js +12 -0
- package/package.json +1 -1
- package/scripts/dedupe-peer-deps.mjs +18 -0
- package/scripts/seed-cli.mjs +135 -26
- package/scripts/verify-css-build.mjs +118 -37
- package/dist/_internal/server/features/search/actions.d.ts +0 -7
- package/dist/_internal/server/features/search/actions.js +0 -21
- package/dist/_internal/server/features/search/data.d.ts +0 -15
- package/dist/_internal/server/features/search/data.js +0 -18
- package/dist/_internal/server/features/search/index.d.ts +0 -3
- package/dist/_internal/server/features/search/index.js +0 -2
- package/dist/features/homepage/api/[id]/route.d.ts +0 -23
- package/dist/features/homepage/api/[id]/route.js +0 -103
- package/dist/features/homepage/api/route.d.ts +0 -14
- package/dist/features/homepage/api/route.js +0 -140
- package/dist/features/homepage/api/sections/[id]/route.d.ts +0 -26
- package/dist/features/homepage/api/sections/[id]/route.js +0 -95
- package/dist/features/homepage/api/sections/route.d.ts +0 -13
- package/dist/features/homepage/api/sections/route.js +0 -82
- package/dist/features/homepage/components/AdvertisementBanner.d.ts +0 -14
- package/dist/features/homepage/components/AdvertisementBanner.js +0 -35
- package/dist/features/homepage/components/BeforeAfterCard.d.ts +0 -9
- package/dist/features/homepage/components/BeforeAfterCard.js +0 -73
- package/dist/features/homepage/components/FeaturedResultsSection.d.ts +0 -17
- package/dist/features/homepage/components/FeaturedResultsSection.js +0 -17
- package/dist/features/homepage/components/HeroBanner.d.ts +0 -7
- package/dist/features/homepage/components/HeroBanner.js +0 -43
- package/dist/features/homepage/components/HeroSection.d.ts +0 -7
- package/dist/features/homepage/components/HeroSection.js +0 -6
- package/dist/features/homepage/components/HomepageSkeleton.d.ts +0 -2
- package/dist/features/homepage/components/HomepageSkeleton.js +0 -21
- package/dist/features/homepage/components/HomepageView.d.ts +0 -25
- package/dist/features/homepage/components/HomepageView.js +0 -5
- package/dist/features/homepage/components/NewsletterBanner.d.ts +0 -23
- package/dist/features/homepage/components/NewsletterBanner.js +0 -37
- package/dist/features/homepage/components/SiteFeaturesSection.d.ts +0 -14
- package/dist/features/homepage/components/SiteFeaturesSection.js +0 -11
- package/dist/features/homepage/components/TrustBadges.d.ts +0 -6
- package/dist/features/homepage/components/TrustBadges.js +0 -46
- package/dist/features/homepage/components/TrustIndicatorsSection.d.ts +0 -12
- package/dist/features/homepage/components/TrustIndicatorsSection.js +0 -11
- package/dist/features/homepage/hooks/useHomepage.d.ts +0 -11
- package/dist/features/homepage/hooks/useHomepage.js +0 -17
- package/dist/features/homepage/hooks/useHomepageSections.d.ts +0 -2
- package/dist/features/homepage/hooks/useHomepageSections.js +0 -10
- package/dist/features/homepage/repository/homepage.repository.d.ts +0 -11
- package/dist/features/homepage/repository/homepage.repository.js +0 -25
- package/dist/features/search/actions/index.d.ts +0 -1
- package/dist/features/search/actions/index.js +0 -1
- package/dist/features/search/actions/search-actions.d.ts +0 -18
- package/dist/features/search/actions/search-actions.js +0 -43
- package/dist/features/search/api/route.d.ts +0 -22
- package/dist/features/search/api/route.js +0 -128
- package/dist/features/search/columns/index.d.ts +0 -17
- package/dist/features/search/columns/index.js +0 -49
- package/dist/features/search/components/SearchFiltersRow.d.ts +0 -22
- package/dist/features/search/components/SearchFiltersRow.js +0 -21
- package/dist/features/search/components/SearchResultsSection.d.ts +0 -53
- package/dist/features/search/components/SearchResultsSection.js +0 -35
- package/dist/features/search/components/SearchView.d.ts +0 -27
- package/dist/features/search/components/SearchView.js +0 -8
- package/dist/features/search/hooks/useSearch.d.ts +0 -21
- package/dist/features/search/hooks/useSearch.js +0 -33
- package/dist/features/search/repository/search.repository.d.ts +0 -14
- package/dist/features/search/repository/search.repository.js +0 -59
- package/dist/features/search/schemas/index.d.ts +0 -70
- package/dist/features/search/schemas/index.js +0 -36
- package/dist/features/search/types/index.d.ts +0 -48
- package/dist/features/stores/components/StoreScopedSearch.d.ts +0 -17
- package/dist/features/stores/components/StoreScopedSearch.js +0 -27
- package/dist/seed/defaults/homepage-sections.d.ts +0 -2
- package/dist/seed/defaults/homepage-sections.js +0 -60
- package/dist/seed/factories/homepage-section.factory.d.ts +0 -10
- package/dist/seed/factories/homepage-section.factory.js +0 -13
- /package/dist/{features/search/types/index.js → _internal/shared/listing-types/spares/og.d.ts} +0 -0
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* feat-homepage — GET / PATCH / DELETE /api/homepage-sections/[id]
|
|
3
|
-
*
|
|
4
|
-
* Pure stub:
|
|
5
|
-
* ```ts
|
|
6
|
-
* // app/api/homepage-sections/[id]/route.ts
|
|
7
|
-
* export { homepageSectionItemGET as GET, homepageSectionItemPATCH as PATCH, homepageSectionItemDELETE as DELETE }
|
|
8
|
-
* from "@mohasinac/feat-homepage";
|
|
9
|
-
* ```
|
|
10
|
-
*/
|
|
11
|
-
import { NextResponse } from "next/server.js";
|
|
12
|
-
import { z } from "zod";
|
|
13
|
-
import { getProviders } from "../../../../contracts/index.js";
|
|
14
|
-
import { createRouteHandler } from "../../../../next/api/routeHandler.js";
|
|
15
|
-
import { normalizeError } from "../../../../errors/normalize.js";
|
|
16
|
-
const ERR_SECTION_NOT_FOUND = "Section not found";
|
|
17
|
-
// ---- GET /api/homepage-sections/[id] ----------------------------------------
|
|
18
|
-
export async function GET(_request, context) {
|
|
19
|
-
try {
|
|
20
|
-
const { id } = await context.params;
|
|
21
|
-
const { db } = getProviders();
|
|
22
|
-
if (!db) {
|
|
23
|
-
return NextResponse.json({ success: false, error: "Database provider not registered" }, { status: 503 });
|
|
24
|
-
}
|
|
25
|
-
const repo = db.getRepository("homepageSections");
|
|
26
|
-
const section = await repo.findById(id);
|
|
27
|
-
if (!section) {
|
|
28
|
-
return NextResponse.json({ success: false, error: ERR_SECTION_NOT_FOUND }, { status: 404 });
|
|
29
|
-
}
|
|
30
|
-
return NextResponse.json({ success: true, data: section });
|
|
31
|
-
}
|
|
32
|
-
catch (error) {
|
|
33
|
-
void normalizeError(error);
|
|
34
|
-
console.error("[feat-homepage] GET /api/homepage-sections/[id] failed", error);
|
|
35
|
-
return NextResponse.json({ success: false, error: "Failed to fetch homepage section" }, { status: 500 });
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
export { GET as homepageSectionItemGET };
|
|
39
|
-
// ---- PATCH /api/homepage-sections/[id] -----------------------------------
|
|
40
|
-
const homepageSectionUpdateSchema = z
|
|
41
|
-
.object({
|
|
42
|
-
type: z
|
|
43
|
-
.enum([
|
|
44
|
-
"hero",
|
|
45
|
-
"featured_categories",
|
|
46
|
-
"featured_products",
|
|
47
|
-
"banner",
|
|
48
|
-
"testimonials",
|
|
49
|
-
"promotions",
|
|
50
|
-
"blog_posts",
|
|
51
|
-
"sellers",
|
|
52
|
-
"custom",
|
|
53
|
-
])
|
|
54
|
-
.optional(),
|
|
55
|
-
title: z.string().optional(),
|
|
56
|
-
enabled: z.boolean().optional(),
|
|
57
|
-
isVisible: z.boolean().optional(),
|
|
58
|
-
order: z.number().int().min(0).optional(),
|
|
59
|
-
content: z.object({}).passthrough().optional(),
|
|
60
|
-
mobile: z.object({}).passthrough().optional(),
|
|
61
|
-
})
|
|
62
|
-
.passthrough();
|
|
63
|
-
export const homepageSectionItemPATCH = createRouteHandler({
|
|
64
|
-
auth: true,
|
|
65
|
-
roles: ["admin"],
|
|
66
|
-
schema: homepageSectionUpdateSchema,
|
|
67
|
-
handler: async ({ request, body }) => {
|
|
68
|
-
const url = new URL(request.url);
|
|
69
|
-
const segments = url.pathname.split("/");
|
|
70
|
-
const id = segments[segments.length - 1];
|
|
71
|
-
const { db } = getProviders();
|
|
72
|
-
if (!db)
|
|
73
|
-
return NextResponse.json({ success: false, error: "DB not configured" }, { status: 503 });
|
|
74
|
-
const repo = db.getRepository("homepageSections");
|
|
75
|
-
const section = await repo.findById(id);
|
|
76
|
-
if (!section)
|
|
77
|
-
return NextResponse.json({ success: false, error: ERR_SECTION_NOT_FOUND }, { status: 404 });
|
|
78
|
-
const updated = await repo.update(id, {
|
|
79
|
-
...body,
|
|
80
|
-
updatedAt: new Date().toISOString(),
|
|
81
|
-
});
|
|
82
|
-
return NextResponse.json({ success: true, data: updated });
|
|
83
|
-
},
|
|
84
|
-
});
|
|
85
|
-
// ---- DELETE /api/homepage-sections/[id] ---------------------------------
|
|
86
|
-
export const homepageSectionItemDELETE = createRouteHandler({
|
|
87
|
-
auth: true,
|
|
88
|
-
roles: ["admin"],
|
|
89
|
-
handler: async ({ request }) => {
|
|
90
|
-
const url = new URL(request.url);
|
|
91
|
-
const segments = url.pathname.split("/");
|
|
92
|
-
const id = segments[segments.length - 1];
|
|
93
|
-
const { db } = getProviders();
|
|
94
|
-
if (!db)
|
|
95
|
-
return NextResponse.json({ success: false, error: "DB not configured" }, { status: 503 });
|
|
96
|
-
const repo = db.getRepository("homepageSections");
|
|
97
|
-
const section = await repo.findById(id);
|
|
98
|
-
if (!section)
|
|
99
|
-
return NextResponse.json({ success: false, error: ERR_SECTION_NOT_FOUND }, { status: 404 });
|
|
100
|
-
await repo.delete(id);
|
|
101
|
-
return NextResponse.json({ success: true });
|
|
102
|
-
},
|
|
103
|
-
});
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* feat-homepage — Next.js App Router API handlers (GET/POST /api/homepage-sections)
|
|
3
|
-
*
|
|
4
|
-
* Pure stub:
|
|
5
|
-
* ```ts
|
|
6
|
-
* // app/api/homepage-sections/route.ts
|
|
7
|
-
* export { GET, POST } from "@mohasinac/feat-homepage";
|
|
8
|
-
* ```
|
|
9
|
-
*/
|
|
10
|
-
import { NextResponse } from "next/server.js";
|
|
11
|
-
export declare function GET(request: Request): Promise<NextResponse>;
|
|
12
|
-
export declare const POST: (request: Request, context?: {
|
|
13
|
-
params: Promise<Record<string, string>>;
|
|
14
|
-
} | undefined) => Promise<Response>;
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* feat-homepage — Next.js App Router API handlers (GET/POST /api/homepage-sections)
|
|
3
|
-
*
|
|
4
|
-
* Pure stub:
|
|
5
|
-
* ```ts
|
|
6
|
-
* // app/api/homepage-sections/route.ts
|
|
7
|
-
* export { GET, POST } from "@mohasinac/feat-homepage";
|
|
8
|
-
* ```
|
|
9
|
-
*/
|
|
10
|
-
import { NextResponse } from "next/server.js";
|
|
11
|
-
import { z } from "zod";
|
|
12
|
-
import { mediaUrlSchema } from "../../../validation/schemas.js";
|
|
13
|
-
import { getProviders } from "../../../contracts/index.js";
|
|
14
|
-
import { createRouteHandler } from "../../../next/api/routeHandler.js";
|
|
15
|
-
/** Read `__session` cookie from request headers (HTTP cookie string). */
|
|
16
|
-
import { normalizeError } from "../../../errors/normalize.js";
|
|
17
|
-
function getSessionCookie(request) {
|
|
18
|
-
const cookieHeader = request.headers.get("cookie") ?? "";
|
|
19
|
-
const match = cookieHeader.match(/(?:^|;\s*)__session=([^;]+)/);
|
|
20
|
-
return match ? match[1] : null;
|
|
21
|
-
}
|
|
22
|
-
/** Returns the role from the session cookie, or null if invalid / no session provider. */
|
|
23
|
-
async function getRoleFromSession(request) {
|
|
24
|
-
try {
|
|
25
|
-
const { session } = getProviders();
|
|
26
|
-
if (!session)
|
|
27
|
-
return null;
|
|
28
|
-
const cookie = getSessionCookie(request);
|
|
29
|
-
if (!cookie)
|
|
30
|
-
return null;
|
|
31
|
-
const payload = await session.verifySession(cookie);
|
|
32
|
-
return payload.role ?? null;
|
|
33
|
-
}
|
|
34
|
-
catch (_err) {
|
|
35
|
-
void normalizeError(_err);
|
|
36
|
-
return null;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
// --- GET /api/homepage-sections -----------------------------------------------
|
|
40
|
-
export async function GET(request) {
|
|
41
|
-
try {
|
|
42
|
-
const url = new URL(request.url);
|
|
43
|
-
const typeFilter = url.searchParams.get("type");
|
|
44
|
-
const includeDisabled = url.searchParams.get("includeDisabled") === "true";
|
|
45
|
-
// Admin auth guard for includeDisabled
|
|
46
|
-
if (includeDisabled) {
|
|
47
|
-
const role = await getRoleFromSession(request);
|
|
48
|
-
if (role !== "admin") {
|
|
49
|
-
return NextResponse.json({ success: false, error: "Admin access required" }, { status: 403 });
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
const filterParts = includeDisabled ? [] : ["enabled==true"];
|
|
53
|
-
if (typeFilter)
|
|
54
|
-
filterParts.push(`type==${typeFilter}`);
|
|
55
|
-
const { db } = getProviders();
|
|
56
|
-
if (!db) {
|
|
57
|
-
return NextResponse.json({ success: false, error: "Database provider not registered" }, { status: 503 });
|
|
58
|
-
}
|
|
59
|
-
const repo = db.getRepository("homepageSections");
|
|
60
|
-
const result = await repo.findAll({
|
|
61
|
-
filters: filterParts.join(",") || undefined,
|
|
62
|
-
sort: "order",
|
|
63
|
-
order: "asc",
|
|
64
|
-
pageSize: 50,
|
|
65
|
-
});
|
|
66
|
-
const sections = result.data.sort((a, b) => (a.order ?? 0) - (b.order ?? 0));
|
|
67
|
-
const res = NextResponse.json({ success: true, data: sections });
|
|
68
|
-
res.headers.set("Cache-Control", includeDisabled
|
|
69
|
-
? "private, no-cache"
|
|
70
|
-
: "public, max-age=300, s-maxage=600, stale-while-revalidate=120");
|
|
71
|
-
return res;
|
|
72
|
-
}
|
|
73
|
-
catch (error) {
|
|
74
|
-
void normalizeError(error);
|
|
75
|
-
console.error("[feat-homepage] GET /api/homepage-sections failed", error);
|
|
76
|
-
return NextResponse.json({ success: false, error: "Failed to fetch homepage sections" }, { status: 500 });
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
// ---------------------------------------------------------------------------
|
|
80
|
-
// POST /api/homepage-sections — create a new section (admin only)
|
|
81
|
-
// ---------------------------------------------------------------------------
|
|
82
|
-
const homepageSectionCreateSchema = z
|
|
83
|
-
.object({
|
|
84
|
-
type: z.enum([
|
|
85
|
-
"hero",
|
|
86
|
-
"featured_categories",
|
|
87
|
-
"featured_products",
|
|
88
|
-
"banner",
|
|
89
|
-
"testimonials",
|
|
90
|
-
"promotions",
|
|
91
|
-
"blog_posts",
|
|
92
|
-
"sellers",
|
|
93
|
-
"custom",
|
|
94
|
-
]),
|
|
95
|
-
title: z.string().optional(),
|
|
96
|
-
enabled: z.boolean().optional(),
|
|
97
|
-
order: z.number().int().min(0).optional(),
|
|
98
|
-
content: z
|
|
99
|
-
.object({
|
|
100
|
-
title: z.string().optional(),
|
|
101
|
-
subtitle: z.string().optional(),
|
|
102
|
-
ctaLabel: z.string().optional(),
|
|
103
|
-
ctaUrl: z.string().optional(),
|
|
104
|
-
imageUrl: mediaUrlSchema.optional(),
|
|
105
|
-
videoUrl: mediaUrlSchema.optional(),
|
|
106
|
-
itemIds: z.array(z.string()).optional(),
|
|
107
|
-
html: z.string().optional(),
|
|
108
|
-
})
|
|
109
|
-
.optional(),
|
|
110
|
-
mobile: z.object({}).passthrough().optional(),
|
|
111
|
-
})
|
|
112
|
-
.passthrough();
|
|
113
|
-
export const POST = createRouteHandler({
|
|
114
|
-
auth: true,
|
|
115
|
-
roles: ["admin"],
|
|
116
|
-
schema: homepageSectionCreateSchema,
|
|
117
|
-
handler: async ({ body }) => {
|
|
118
|
-
const { db } = getProviders();
|
|
119
|
-
if (!db) {
|
|
120
|
-
return NextResponse.json({ success: false, error: "DB not configured" }, { status: 503 });
|
|
121
|
-
}
|
|
122
|
-
const repo = db.getRepository("homepageSections");
|
|
123
|
-
// Auto-assign order: place at end of existing sections
|
|
124
|
-
const existing = await repo.findAll({
|
|
125
|
-
sort: "order",
|
|
126
|
-
order: "desc",
|
|
127
|
-
pageSize: 1,
|
|
128
|
-
});
|
|
129
|
-
const maxOrder = existing.data[0]?.order ?? -1;
|
|
130
|
-
const now = new Date().toISOString();
|
|
131
|
-
const created = await repo.create({
|
|
132
|
-
...body,
|
|
133
|
-
order: body.order ?? maxOrder + 1,
|
|
134
|
-
enabled: body.enabled ?? true,
|
|
135
|
-
createdAt: now,
|
|
136
|
-
updatedAt: now,
|
|
137
|
-
});
|
|
138
|
-
return NextResponse.json({ success: true, data: created }, { status: 201 });
|
|
139
|
-
},
|
|
140
|
-
});
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* feat-homepage — GET/PATCH/DELETE /api/homepage/sections/[id]
|
|
3
|
-
*
|
|
4
|
-
* Homepage section retrieval, updates, and deletion.
|
|
5
|
-
*
|
|
6
|
-
* Consumer stub:
|
|
7
|
-
* ```ts
|
|
8
|
-
* export { sectionDetailGET as GET, sectionDetailPATCH as PATCH, sectionDetailDELETE as DELETE } from "@mohasinac/feat-homepage";
|
|
9
|
-
* ```
|
|
10
|
-
*/
|
|
11
|
-
import { NextResponse } from "next/server.js";
|
|
12
|
-
export declare function GET(request: Request, { params }: {
|
|
13
|
-
params: {
|
|
14
|
-
id: string;
|
|
15
|
-
};
|
|
16
|
-
}): Promise<NextResponse>;
|
|
17
|
-
export declare function PATCH(request: Request, { params }: {
|
|
18
|
-
params: {
|
|
19
|
-
id: string;
|
|
20
|
-
};
|
|
21
|
-
}): Promise<NextResponse>;
|
|
22
|
-
export declare function DELETE(request: Request, { params }: {
|
|
23
|
-
params: {
|
|
24
|
-
id: string;
|
|
25
|
-
};
|
|
26
|
-
}): Promise<NextResponse>;
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* feat-homepage — GET/PATCH/DELETE /api/homepage/sections/[id]
|
|
3
|
-
*
|
|
4
|
-
* Homepage section retrieval, updates, and deletion.
|
|
5
|
-
*
|
|
6
|
-
* Consumer stub:
|
|
7
|
-
* ```ts
|
|
8
|
-
* export { sectionDetailGET as GET, sectionDetailPATCH as PATCH, sectionDetailDELETE as DELETE } from "@mohasinac/feat-homepage";
|
|
9
|
-
* ```
|
|
10
|
-
*/
|
|
11
|
-
import { NextResponse } from "next/server.js";
|
|
12
|
-
import { getProviders } from "../../../../../contracts/index.js";
|
|
13
|
-
import { normalizeError } from "../../../../../errors/normalize.js";
|
|
14
|
-
const ERR_SECTION_ID_REQUIRED = "Section ID is required";
|
|
15
|
-
const ERR_DB_NOT_CONFIGURED = "Database provider not configured";
|
|
16
|
-
const ERR_INTERNAL_SERVER_ERROR = "Internal server error";
|
|
17
|
-
export async function GET(request, { params }) {
|
|
18
|
-
try {
|
|
19
|
-
const { id } = await params;
|
|
20
|
-
if (!id) {
|
|
21
|
-
return NextResponse.json({ success: false, error: ERR_SECTION_ID_REQUIRED }, { status: 400 });
|
|
22
|
-
}
|
|
23
|
-
const { db } = getProviders();
|
|
24
|
-
if (!db)
|
|
25
|
-
return NextResponse.json({ success: false, error: ERR_DB_NOT_CONFIGURED }, { status: 503 });
|
|
26
|
-
const repo = db.getRepository("homepage_sections");
|
|
27
|
-
const section = await repo.findById(id);
|
|
28
|
-
if (!section) {
|
|
29
|
-
return NextResponse.json({ success: false, error: "Section not found" }, { status: 404 });
|
|
30
|
-
}
|
|
31
|
-
return NextResponse.json({
|
|
32
|
-
success: true,
|
|
33
|
-
data: section,
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
catch (error) {
|
|
37
|
-
void normalizeError(error);
|
|
38
|
-
return NextResponse.json({
|
|
39
|
-
success: false,
|
|
40
|
-
error: error instanceof Error ? error.message : ERR_INTERNAL_SERVER_ERROR,
|
|
41
|
-
}, { status: 500 });
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
export async function PATCH(request, { params }) {
|
|
45
|
-
try {
|
|
46
|
-
const { id } = await params;
|
|
47
|
-
if (!id) {
|
|
48
|
-
return NextResponse.json({ success: false, error: ERR_SECTION_ID_REQUIRED }, { status: 400 });
|
|
49
|
-
}
|
|
50
|
-
const body = await request.json();
|
|
51
|
-
const { db } = getProviders();
|
|
52
|
-
if (!db)
|
|
53
|
-
return NextResponse.json({ success: false, error: ERR_DB_NOT_CONFIGURED }, { status: 503 });
|
|
54
|
-
const repo = db.getRepository("homepage_sections");
|
|
55
|
-
const updated = await repo.update(id, body);
|
|
56
|
-
if (!updated) {
|
|
57
|
-
return NextResponse.json({ success: false, error: "Section not found" }, { status: 404 });
|
|
58
|
-
}
|
|
59
|
-
return NextResponse.json({
|
|
60
|
-
success: true,
|
|
61
|
-
data: updated,
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
catch (error) {
|
|
65
|
-
void normalizeError(error);
|
|
66
|
-
return NextResponse.json({
|
|
67
|
-
success: false,
|
|
68
|
-
error: error instanceof Error ? error.message : ERR_INTERNAL_SERVER_ERROR,
|
|
69
|
-
}, { status: 500 });
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
export async function DELETE(request, { params }) {
|
|
73
|
-
try {
|
|
74
|
-
const { id } = await params;
|
|
75
|
-
if (!id) {
|
|
76
|
-
return NextResponse.json({ success: false, error: ERR_SECTION_ID_REQUIRED }, { status: 400 });
|
|
77
|
-
}
|
|
78
|
-
const { db } = getProviders();
|
|
79
|
-
if (!db)
|
|
80
|
-
return NextResponse.json({ success: false, error: ERR_DB_NOT_CONFIGURED }, { status: 503 });
|
|
81
|
-
const repo = db.getRepository("homepage_sections");
|
|
82
|
-
await repo.delete(id);
|
|
83
|
-
return NextResponse.json({
|
|
84
|
-
success: true,
|
|
85
|
-
data: { id },
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
catch (error) {
|
|
89
|
-
void normalizeError(error);
|
|
90
|
-
return NextResponse.json({
|
|
91
|
-
success: false,
|
|
92
|
-
error: error instanceof Error ? error.message : ERR_INTERNAL_SERVER_ERROR,
|
|
93
|
-
}, { status: 500 });
|
|
94
|
-
}
|
|
95
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* feat-homepage — GET/POST /api/homepage/sections
|
|
3
|
-
*
|
|
4
|
-
* Homepage sections list with Sieve filtering and creation.
|
|
5
|
-
*
|
|
6
|
-
* Consumer stub:
|
|
7
|
-
* ```ts
|
|
8
|
-
* export { sectionsListGET as GET, sectionsListPOST as POST } from "@mohasinac/feat-homepage";
|
|
9
|
-
* ```
|
|
10
|
-
*/
|
|
11
|
-
import { NextResponse } from "next/server.js";
|
|
12
|
-
export declare function GET(request: Request): Promise<NextResponse>;
|
|
13
|
-
export declare function POST(request: Request): Promise<NextResponse>;
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* feat-homepage — GET/POST /api/homepage/sections
|
|
3
|
-
*
|
|
4
|
-
* Homepage sections list with Sieve filtering and creation.
|
|
5
|
-
*
|
|
6
|
-
* Consumer stub:
|
|
7
|
-
* ```ts
|
|
8
|
-
* export { sectionsListGET as GET, sectionsListPOST as POST } from "@mohasinac/feat-homepage";
|
|
9
|
-
* ```
|
|
10
|
-
*/
|
|
11
|
-
import { NextResponse } from "next/server.js";
|
|
12
|
-
import { getProviders } from "../../../../contracts/index.js";
|
|
13
|
-
import { normalizeError } from "../../../../errors/normalize.js";
|
|
14
|
-
function numParam(url, key, fallback) {
|
|
15
|
-
const v = url.searchParams.get(key);
|
|
16
|
-
const n = v !== null ? Number(v) : NaN;
|
|
17
|
-
return Number.isFinite(n) ? n : fallback;
|
|
18
|
-
}
|
|
19
|
-
export async function GET(request) {
|
|
20
|
-
try {
|
|
21
|
-
const url = new URL(request.url);
|
|
22
|
-
const page = Math.max(1, numParam(url, "page", 1));
|
|
23
|
-
const pageSize = Math.min(100, Math.max(1, numParam(url, "pageSize", 20)));
|
|
24
|
-
const filters = url.searchParams.get("filters") ?? undefined;
|
|
25
|
-
const sort = url.searchParams.get("sorts") ??
|
|
26
|
-
url.searchParams.get("sort") ??
|
|
27
|
-
"-createdAt";
|
|
28
|
-
const { db } = getProviders();
|
|
29
|
-
if (!db)
|
|
30
|
-
return NextResponse.json({ success: false, error: "DB not configured" }, { status: 503 });
|
|
31
|
-
const repo = db.getRepository("homepage_sections");
|
|
32
|
-
const result = await repo.findAll({
|
|
33
|
-
filters,
|
|
34
|
-
sort,
|
|
35
|
-
page,
|
|
36
|
-
pageSize: pageSize,
|
|
37
|
-
});
|
|
38
|
-
const totalPages = Math.max(1, Math.ceil(result.total / pageSize));
|
|
39
|
-
return NextResponse.json({
|
|
40
|
-
success: true,
|
|
41
|
-
data: {
|
|
42
|
-
items: result.data,
|
|
43
|
-
total: result.total,
|
|
44
|
-
page,
|
|
45
|
-
pageSize,
|
|
46
|
-
totalPages,
|
|
47
|
-
hasMore: page < totalPages,
|
|
48
|
-
},
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
catch (error) {
|
|
52
|
-
void normalizeError(error);
|
|
53
|
-
return NextResponse.json({
|
|
54
|
-
success: false,
|
|
55
|
-
error: error instanceof Error ? error.message : "Internal server error",
|
|
56
|
-
}, { status: 500 });
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
export async function POST(request) {
|
|
60
|
-
try {
|
|
61
|
-
const body = await request.json();
|
|
62
|
-
const { db } = getProviders();
|
|
63
|
-
if (!db)
|
|
64
|
-
return NextResponse.json({ success: false, error: "DB not configured" }, { status: 503 });
|
|
65
|
-
const repo = db.getRepository("homepage_sections");
|
|
66
|
-
const created = await repo.create({
|
|
67
|
-
...body,
|
|
68
|
-
createdAt: new Date(),
|
|
69
|
-
});
|
|
70
|
-
return NextResponse.json({
|
|
71
|
-
success: true,
|
|
72
|
-
data: created,
|
|
73
|
-
}, { status: 201 });
|
|
74
|
-
}
|
|
75
|
-
catch (error) {
|
|
76
|
-
void normalizeError(error);
|
|
77
|
-
return NextResponse.json({
|
|
78
|
-
success: false,
|
|
79
|
-
error: error instanceof Error ? error.message : "Internal server error",
|
|
80
|
-
}, { status: 500 });
|
|
81
|
-
}
|
|
82
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
export interface AdvertisementBannerProps {
|
|
3
|
-
title: string;
|
|
4
|
-
subtitle?: string;
|
|
5
|
-
ctaLabel?: string;
|
|
6
|
-
onCtaClick?: () => void;
|
|
7
|
-
backgroundImage?: string;
|
|
8
|
-
backgroundColor?: string;
|
|
9
|
-
tagLabel?: string;
|
|
10
|
-
isLoading?: boolean;
|
|
11
|
-
compact?: boolean;
|
|
12
|
-
className?: string;
|
|
13
|
-
}
|
|
14
|
-
export declare function AdvertisementBanner({ title, subtitle, ctaLabel, onCtaClick, backgroundImage, backgroundColor, tagLabel, isLoading, compact, className, }: AdvertisementBannerProps): React.JSX.Element;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { CARD_ASPECT_BANNER, GRID_COLS_2_MD } from "../../../_internal/shared/styles/grid.js";
|
|
3
|
-
import { Button, Div, Grid, Heading, Row, Scrim, Section, Span, Stack, Text } from "../../../ui/index.js";
|
|
4
|
-
import { DynamicBgDiv } from "../../../ui/components/DynamicBgDiv.js";
|
|
5
|
-
import { MediaImage } from "../../media/MediaImage.js";
|
|
6
|
-
import { ArrowRight, Sparkles } from "lucide-react";
|
|
7
|
-
const __P = {
|
|
8
|
-
p8: "p-[var(--appkit-space-8)]",
|
|
9
|
-
};
|
|
10
|
-
const __O = {
|
|
11
|
-
hidden: "overflow-hidden",
|
|
12
|
-
};
|
|
13
|
-
const CLS_GRADIENT_BG = "absolute inset-0 bg-[image:var(--appkit-gradient-promotion)]";
|
|
14
|
-
const CLS_CTA_BTN_SM = "bg-[var(--appkit-color-surface)] bg-[var(--appkit-color-surface)] text-indigo-700 hover:bg-surface-hover font-semibold gap-[var(--appkit-space-1-5)] flex-shrink-0";
|
|
15
|
-
const CLS_CTA_BTN_LG = "bg-[var(--appkit-color-surface)] bg-[var(--appkit-color-surface)] text-indigo-700 hover:bg-surface-hover font-semibold shadow-lg gap-[var(--appkit-space-2)]";
|
|
16
|
-
// --- Constants ---------------------------------------------------------------
|
|
17
|
-
const CLS_CONTAINER = "w-full max-w-7xl mx-auto";
|
|
18
|
-
// --- Component ---------------------------------------------------------------
|
|
19
|
-
export function AdvertisementBanner({ title, subtitle, ctaLabel = "Shop now", onCtaClick, backgroundImage, backgroundColor, tagLabel, isLoading = false, compact = false, className = "", }) {
|
|
20
|
-
const wrapClass = "bg-[image:var(--appkit-gradient-section-warm)]";
|
|
21
|
-
if (isLoading) {
|
|
22
|
-
return (_jsx(Section, { className: `${__P.p8} ${wrapClass} ${className}`, children: _jsx(Div, { className: CLS_CONTAINER, children: _jsx(Div, { className: "h-72 animate-pulse", surface: "subtle", rounded: "2xl" }) }) }));
|
|
23
|
-
}
|
|
24
|
-
// -- Split layout: when a backgroundImage is provided --
|
|
25
|
-
if (backgroundImage) {
|
|
26
|
-
return (_jsx(Section, { className: `${__P.p8} ${wrapClass} ${className}`, children: _jsx(Div, { className: CLS_CONTAINER, children: _jsx(Div, { className: `relative ${__O.hidden} bg-neutral-900`, rounded: "2xl", shadow: "xl", children: _jsxs(Grid, { className: `${GRID_COLS_2_MD} min-h-[clamp(300px,40vh,420px)]`, children: [_jsxs(Div, { className: `relative ${CARD_ASPECT_BANNER} order-last md:order-first min-h-0 min-h-[clamp(300px,40vh,420px)]`, children: [_jsx(MediaImage, { src: backgroundImage, alt: title, size: "banner", priority: true }), _jsx(Scrim, { direction: "right-to-left", intensity: "medium", className: "hidden md:block absolute inset-y-0 right-0 w-24" })] }), _jsxs(Stack, { justify: "center", className: "relative", paddingX: "x-xl", padding: "y-2xl", children: [_jsx(Div, { className: "absolute top-0 right-0 w-32 h-32 opacity-10 pointer-events-none bg-[radial-gradient(circle,_white_1px,_transparent_1px)] bg-[length:12px_12px]", "aria-hidden": true }), tagLabel && (_jsxs(Span, { layout: "inline-flex", gap: "xs", color: "inverse", size: "xs", weight: "semibold", className: "self-start bg-[rgba(255,255,255,0.1)] /80 tracking-widest mb-5 backdrop-blur-sm", rounded: "full", padding: "pill-md", transform: "uppercase", children: [_jsx(Sparkles, { className: "w-3.5 h-3.5" }), tagLabel] })), _jsx(Heading, { color: "inverse", level: 2, variant: "none", className: "font-extrabold mb-4 leading-tight", mdSize: "4xl", lgSize: "5xl", size: "3xl", children: title }), subtitle && (_jsx(Text, { color: "inverse", variant: "none", className: "/75 mb-8 leading-relaxed", mdSize: "lg", size: "base", children: subtitle })), ctaLabel && onCtaClick && (_jsxs(Button, { gap: "md", variant: "secondary", size: "lg", onClick: onCtaClick, className: "self-start bg-[var(--appkit-color-surface)] text-[var(--appkit-color-text)] hover:bg-[var(--appkit-color-surface)] dark:bg-[var(--appkit-color-surface)] dark:text-[var(--appkit-color-text)] dark:hover:bg-neutral-200 font-[600]", shadow: "lg", children: [ctaLabel, _jsx(ArrowRight, { className: "w-4 h-4" })] }))] })] }) }) }) }));
|
|
27
|
-
}
|
|
28
|
-
// -- Full-width gradient layout --
|
|
29
|
-
return (_jsx(Section, { className: `${__P.p8} ${wrapClass} ${className}`, children: _jsx(Div, { className: CLS_CONTAINER, children: _jsxs(DynamicBgDiv, { color: backgroundColor, className: [
|
|
30
|
-
"flex items-center relative overflow-hidden rounded-2xl",
|
|
31
|
-
compact
|
|
32
|
-
? "h-[clamp(112px,16vh,160px)]"
|
|
33
|
-
: "min-h-[clamp(240px,34vh,360px)]",
|
|
34
|
-
].join(" "), children: [!backgroundColor && (_jsx(Div, { className: CLS_GRADIENT_BG, "aria-hidden": true })), _jsxs(Div, { className: `absolute inset-0 ${__O.hidden}`, "aria-hidden": true, children: [_jsx(Div, { className: "absolute -top-16 -left-16 w-64 h-64 bg-primary/20 blur-3xl animate-pulse", rounded: "full" }), _jsx(Div, { className: "absolute -bottom-16 right-0 w-80 h-80 bg-cobalt/20 blur-3xl animate-pulse", rounded: "full" })] }), compact ? (_jsxs(Row, { justify: "between", className: "relative z-10 w-full", gap: "md", padding: "inlineLg", children: [_jsxs(Span, { layout: "inline-flex", gap: "md", children: [_jsx(Sparkles, { className: "w-4 h-4 text-white/80" }), _jsx(Span, { color: "inverse", size: "sm", weight: "semibold", children: title })] }), ctaLabel && onCtaClick && (_jsxs(Button, { variant: "secondary", size: "sm", onClick: onCtaClick, className: CLS_CTA_BTN_SM, children: [ctaLabel, _jsx(ArrowRight, { className: "w-3.5 h-3.5" })] }))] })) : (_jsxs(Div, { className: "relative z-10 w-full max-w-4xl mx-auto md:py-[4rem] text-left", paddingY: "y-3xl", paddingX: "x-lg", children: [tagLabel && (_jsxs(Span, { layout: "inline-flex", gap: "xs", color: "inverse", size: "xs", weight: "semibold", className: "bg-[rgba(255,255,255,0.15)] /90 tracking-widest mb-5 backdrop-blur-sm", shadow: "sm", rounded: "full", padding: "pill-lg", transform: "uppercase", children: [_jsx(Sparkles, { className: "w-3.5 h-3.5" }), tagLabel] })), _jsx(Heading, { color: "inverse", level: 2, variant: "none", className: "font-extrabold mb-4 leading-tight", mdSize: "5xl", lgSize: "6xl", size: "3xl", shadow: "lg", children: title }), subtitle && (_jsx(Text, { color: "inverse", variant: "none", className: "mb-10 max-w-2xl", mdSize: "xl", size: "base", children: subtitle })), ctaLabel && onCtaClick && (_jsxs(Button, { variant: "secondary", size: "lg", onClick: onCtaClick, className: CLS_CTA_BTN_LG, children: [ctaLabel, _jsx(ArrowRight, { className: "w-4 h-4" })] }))] }))] }) }) }));
|
|
35
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { BeforeAfterItem } from "../types";
|
|
2
|
-
export interface BeforeAfterCardProps {
|
|
3
|
-
item: BeforeAfterItem;
|
|
4
|
-
/** Label shown on the left (before) side. Default: "Before". */
|
|
5
|
-
beforeLabel?: string;
|
|
6
|
-
/** Label shown on the right (after) side. Default: "After". */
|
|
7
|
-
afterLabel?: string;
|
|
8
|
-
}
|
|
9
|
-
export declare function BeforeAfterCard({ item, beforeLabel, afterLabel, }: BeforeAfterCardProps): import("react").JSX.Element;
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useRef, useState, useCallback, useEffect } from "react";
|
|
4
|
-
import Image from "next/image.js";
|
|
5
|
-
import { Div, Row, Span, Text } from "../../../ui/index.js";
|
|
6
|
-
import { resolveMediaUrl } from "../../../utils/media-url.js";
|
|
7
|
-
const __P = {
|
|
8
|
-
p4: "p-[var(--appkit-space-4)]",
|
|
9
|
-
};
|
|
10
|
-
const __O = {
|
|
11
|
-
hidden: "overflow-hidden",
|
|
12
|
-
};
|
|
13
|
-
export function BeforeAfterCard({ item, beforeLabel = "Before", afterLabel = "After", }) {
|
|
14
|
-
const containerRef = useRef(null);
|
|
15
|
-
const beforeClipRef = useRef(null);
|
|
16
|
-
const dividerRef = useRef(null);
|
|
17
|
-
const [position, setPosition] = useState(50);
|
|
18
|
-
const [dragging, setDragging] = useState(false);
|
|
19
|
-
const updatePosition = useCallback((clientX) => {
|
|
20
|
-
const container = containerRef.current;
|
|
21
|
-
if (!container)
|
|
22
|
-
return;
|
|
23
|
-
const rect = container.getBoundingClientRect();
|
|
24
|
-
const x = clientX - rect.left;
|
|
25
|
-
const pct = Math.max(0, Math.min(100, (x / rect.width) * 100));
|
|
26
|
-
setPosition(pct);
|
|
27
|
-
}, []);
|
|
28
|
-
useEffect(() => {
|
|
29
|
-
if (beforeClipRef.current)
|
|
30
|
-
beforeClipRef.current.style.width = `${position}%`;
|
|
31
|
-
if (dividerRef.current)
|
|
32
|
-
dividerRef.current.style.left = `${position}%`;
|
|
33
|
-
}, [position]);
|
|
34
|
-
useEffect(() => {
|
|
35
|
-
if (!dragging)
|
|
36
|
-
return;
|
|
37
|
-
const onMove = (e) => {
|
|
38
|
-
e.preventDefault();
|
|
39
|
-
const clientX = "touches" in e
|
|
40
|
-
? e.touches[0].clientX
|
|
41
|
-
: e.clientX;
|
|
42
|
-
updatePosition(clientX);
|
|
43
|
-
};
|
|
44
|
-
const onUp = () => setDragging(false);
|
|
45
|
-
window.addEventListener("mousemove", onMove);
|
|
46
|
-
window.addEventListener("mouseup", onUp);
|
|
47
|
-
window.addEventListener("touchmove", onMove, { passive: false });
|
|
48
|
-
window.addEventListener("touchend", onUp);
|
|
49
|
-
// Without this, an interrupted touch (OS/browser gesture takeover)
|
|
50
|
-
// never fires touchend — `dragging` stays true forever, leaking these
|
|
51
|
-
// window-level listeners for the rest of the component's lifetime.
|
|
52
|
-
window.addEventListener("touchcancel", onUp);
|
|
53
|
-
return () => {
|
|
54
|
-
window.removeEventListener("mousemove", onMove);
|
|
55
|
-
window.removeEventListener("mouseup", onUp);
|
|
56
|
-
window.removeEventListener("touchmove", onMove);
|
|
57
|
-
window.removeEventListener("touchend", onUp);
|
|
58
|
-
window.removeEventListener("touchcancel", onUp);
|
|
59
|
-
};
|
|
60
|
-
}, [dragging, updatePosition]);
|
|
61
|
-
return (_jsxs(Div, { className: `border-[var(--appkit-color-border)] ${__O.hidden} border bg-[var(--appkit-color-surface)]`, rounded: "2xl", shadow: "sm", children: [_jsxs(Div, { ref: containerRef, className: "relative aspect-[4/3] cursor-col-resize overflow-hidden select-none", onMouseDown: (e) => {
|
|
62
|
-
setDragging(true);
|
|
63
|
-
updatePosition(e.clientX);
|
|
64
|
-
}, onTouchStart: (e) => {
|
|
65
|
-
setDragging(true);
|
|
66
|
-
updatePosition(e.touches[0].clientX);
|
|
67
|
-
}, role: "slider", "aria-label": `Before and after comparison: ${item.caption}`, "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuenow": Math.round(position), tabIndex: 0, onKeyDown: (e) => {
|
|
68
|
-
if (e.key === "ArrowLeft")
|
|
69
|
-
setPosition((p) => Math.max(0, p - 2));
|
|
70
|
-
if (e.key === "ArrowRight")
|
|
71
|
-
setPosition((p) => Math.min(100, p + 2));
|
|
72
|
-
}, children: [_jsx(Image, { src: resolveMediaUrl(item.afterImage), alt: afterLabel, fill: true, sizes: "(max-width: 640px) 100vw, 50vw", className: "object-cover" }), _jsx(Div, { ref: beforeClipRef, className: "absolute inset-0 overflow-hidden", children: _jsx(Image, { src: resolveMediaUrl(item.beforeImage), alt: beforeLabel, fill: true, sizes: "(max-width: 640px) 100vw, 50vw", className: "object-cover" }) }), _jsx(Div, { ref: dividerRef, shadow: "md", className: "absolute top-0 bottom-0 z-10 w-0.5 bg-[var(--appkit-color-surface)]", children: _jsx(Row, { className: "absolute top-1/2 left-1/2 h-8 w-8 -translate-x-1/2 -translate-y-1/2 bg-[var(--appkit-color-surface)]", align: "center", justify: "center", rounded: "full", shadow: "lg", children: _jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: _jsx("path", { d: "M4 8L1 5M4 8L1 11M4 8H12M12 8L15 5M12 8L15 11", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) }) }) }), _jsx(Span, { surface: "overlay-sm", color: "inverse", size: "xs", weight: "medium", className: "absolute top-3 left-3 z-10", padding: "pill-sm", rounded: "full", children: beforeLabel }), _jsx(Span, { surface: "overlay-sm", color: "inverse", size: "xs", weight: "medium", className: "absolute top-3 right-3 z-10", padding: "pill-sm", rounded: "full", children: afterLabel })] }), _jsx(Div, { className: `${__P.p4}`, children: _jsx(Text, { className: "text-[var(--appkit-color-text)]", size: "sm", weight: "medium", children: item.caption }) })] }));
|
|
73
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/** Minimal result item used by the featured results section. */
|
|
2
|
-
export interface FeaturedResultItem {
|
|
3
|
-
id?: string;
|
|
4
|
-
beforeImage: string;
|
|
5
|
-
afterImage: string;
|
|
6
|
-
caption?: string;
|
|
7
|
-
sortOrder?: number;
|
|
8
|
-
}
|
|
9
|
-
export interface FeaturedResultsSectionProps {
|
|
10
|
-
title: string;
|
|
11
|
-
subtitle?: string;
|
|
12
|
-
pillLabel?: string;
|
|
13
|
-
ornamentLabel?: string;
|
|
14
|
-
items: FeaturedResultItem[];
|
|
15
|
-
className?: string;
|
|
16
|
-
}
|
|
17
|
-
export declare function FeaturedResultsSection({ title, subtitle, pillLabel, ornamentLabel, items, className, }: FeaturedResultsSectionProps): import("react").JSX.Element | null;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Div, Heading, HorizontalScroller, Row, Section, Span, Text } from "../../../ui/index.js";
|
|
3
|
-
import { BeforeAfterCard } from "./BeforeAfterCard.js";
|
|
4
|
-
import { CAROUSEL_PER_VIEW } from "../constants/carousel-per-view.js";
|
|
5
|
-
// --- Sectmon -----------------------------------------------------------------
|
|
6
|
-
export function FeaturedResultsSection({ title, subtitle, pillLabel, ornamentLabel = "✶", items, className = "", }) {
|
|
7
|
-
const pillCls = "inline-flex items-center gap-[var(--appkit-space-2)] rounded-full border border-primary-500/30 bg-primary-500/10 px-[var(--appkit-space-5)] py-[var(--appkit-space-1-5)] text-[length:var(--appkit-text-xs)] font-medium uppercase tracking-[0.2em] text-primary-700 backdrop-blur-sm dark:text-primary-400";
|
|
8
|
-
if (!items.length)
|
|
9
|
-
return null;
|
|
10
|
-
return (_jsxs(Section, { className: className, paddingY: "y-5xl", paddingX: "x-md", children: [_jsxs(Div, { className: "mb-12 text-left", children: [pillLabel && (_jsxs(Span, { className: pillCls, children: [_jsx(Span, { className: "inline-block h-1.5 w-1.5 bg-primary-500", rounded: "full", "aria-hidden": "true" }), pillLabel] })), _jsx(Heading, { level: 2, className: "mt-3 font-display", color: "primary", size: "4xl", children: title }), _jsxs(Row, { align: "center", justify: "start", gap: "sm", color: "faint", className: "mt-3", "aria-hidden": "true", children: [_jsx(Span, { className: "h-px w-6 bg-current" }), _jsx(Span, { size: "xs", children: ornamentLabel }), _jsx(Span, { className: "h-px w-6 bg-current" })] }), subtitle && (_jsx(Text, { className: "mx-auto mt-4 max-w-md", color: "muted", size: "sm", children: subtitle }))] }), _jsx(Div, { className: "mx-auto max-w-7xl", children: _jsx(HorizontalScroller, { items: items, renderItem: (item, i) => (_jsx(Div, { className: "w-full sm:w-auto", children: _jsx(BeforeAfterCard, { item: {
|
|
11
|
-
id: item.id ?? `result-${i}`,
|
|
12
|
-
beforeImage: item.beforeImage,
|
|
13
|
-
afterImage: item.afterImage,
|
|
14
|
-
caption: item.caption ?? "",
|
|
15
|
-
sortOrder: item.sortOrder ?? i,
|
|
16
|
-
} }, item.id ?? `result-${i}`) })), keyExtractor: (item, i) => item.id ?? `result-${i}`, perView: CAROUSEL_PER_VIEW.cards, gap: 24, minItemWidth: 260, snapToItems: true, showArrows: true, loop: true }) })] }));
|
|
17
|
-
}
|