@mohasinac/appkit 2.7.58 → 2.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_internal/client/features/filters/filter-load-options.d.ts +4 -5
- package/dist/_internal/server/features/auctions/og.js +8 -32
- package/dist/_internal/server/features/blog/og.js +10 -49
- package/dist/_internal/server/features/checkout/actions.js +6 -0
- package/dist/_internal/server/features/classified/og.js +9 -51
- package/dist/_internal/server/features/digital-code/actions.d.ts +11 -0
- package/dist/_internal/server/features/digital-code/actions.js +30 -0
- package/dist/_internal/server/features/digital-code/index.d.ts +1 -0
- package/dist/_internal/server/features/digital-code/index.js +1 -0
- package/dist/_internal/server/features/digital-code/og.js +9 -51
- package/dist/_internal/server/features/events/og.js +10 -49
- package/dist/_internal/server/features/item-requests/data.d.ts +17 -0
- package/dist/_internal/server/features/item-requests/data.js +20 -0
- package/dist/_internal/server/features/item-requests/index.d.ts +2 -0
- package/dist/_internal/server/features/item-requests/index.js +2 -0
- package/dist/_internal/server/features/item-requests/og.d.ts +40 -0
- package/dist/_internal/server/features/item-requests/og.js +136 -0
- package/dist/_internal/server/features/live/actions.d.ts +5 -0
- package/dist/_internal/server/features/live/actions.js +24 -0
- package/dist/_internal/server/features/live/index.d.ts +1 -0
- package/dist/_internal/server/features/live/index.js +1 -0
- package/dist/_internal/server/features/live/og.js +9 -51
- package/dist/_internal/server/features/media/contextGuards.js +19 -8
- package/dist/_internal/server/features/pre-orders/og.js +8 -32
- package/dist/_internal/server/features/prize-draws/data.d.ts +17 -0
- package/dist/_internal/server/features/prize-draws/data.js +20 -0
- package/dist/_internal/server/features/prize-draws/index.d.ts +2 -0
- package/dist/_internal/server/features/prize-draws/index.js +2 -0
- package/dist/_internal/server/features/prize-draws/og.d.ts +30 -0
- package/dist/_internal/server/features/prize-draws/og.js +50 -0
- package/dist/_internal/server/features/products/og.js +8 -33
- package/dist/_internal/server/features/scams/og.js +1 -1
- package/dist/_internal/server/features/seo/og-layout.d.ts +42 -0
- package/dist/_internal/server/features/seo/og-layout.js +69 -0
- package/dist/_internal/server/features/stores/og.js +8 -41
- package/dist/_internal/server/features/sublisting-categories/og.js +11 -42
- package/dist/_internal/shared/actions/bulk-helpers.d.ts +3 -0
- package/dist/_internal/shared/actions/bulk-helpers.js +19 -0
- package/dist/_internal/shared/config/schema.d.ts +4 -4
- package/dist/client.d.ts +13 -6
- package/dist/client.js +9 -3
- package/dist/configs/next.js +11 -0
- package/dist/constants/index.d.ts +4 -0
- package/dist/constants/index.js +2 -0
- package/dist/constants/notification-types.d.ts +20 -0
- package/dist/constants/notification-types.js +37 -0
- package/dist/constants/pagination-presets.d.ts +39 -0
- package/dist/constants/pagination-presets.js +38 -0
- package/dist/errors/messages.d.ts +0 -4
- package/dist/errors/messages.js +0 -4
- package/dist/features/account/components/AddressesIndexListing.js +3 -4
- package/dist/features/account/components/UserOffersPanel.js +1 -1
- package/dist/features/account/components/UserSidebar.js +14 -10
- package/dist/features/account/components/UserSupportView.d.ts +1 -2
- package/dist/features/account/components/UserSupportView.js +9 -1
- package/dist/features/admin/actions/admin-actions.js +16 -1
- package/dist/features/admin/components/AdminAllEventEntriesView.d.ts +2 -3
- package/dist/features/admin/components/AdminAllEventEntriesView.js +50 -89
- package/dist/features/admin/components/AdminBidsView.d.ts +2 -3
- package/dist/features/admin/components/AdminBidsView.js +64 -104
- package/dist/features/admin/components/AdminBlogView.d.ts +3 -7
- package/dist/features/admin/components/AdminBlogView.js +53 -88
- package/dist/features/admin/components/AdminBrandEditorView.js +14 -17
- package/dist/features/admin/components/AdminBrandsView.d.ts +2 -3
- package/dist/features/admin/components/AdminBrandsView.js +85 -89
- package/dist/features/admin/components/AdminBundlesView.js +68 -130
- package/dist/features/admin/components/AdminCarouselView.d.ts +2 -2
- package/dist/features/admin/components/AdminCarouselView.js +22 -70
- package/dist/features/admin/components/AdminCartsView.d.ts +2 -3
- package/dist/features/admin/components/AdminCartsView.js +39 -89
- package/dist/features/admin/components/AdminCategoriesView.d.ts +3 -3
- package/dist/features/admin/components/AdminCategoriesView.js +97 -96
- package/dist/features/admin/components/AdminCategoryEditorView.js +2 -6
- package/dist/features/admin/components/AdminClassifiedView.d.ts +3 -0
- package/dist/features/admin/components/AdminClassifiedView.js +44 -0
- package/dist/features/admin/components/AdminContactView.d.ts +2 -2
- package/dist/features/admin/components/AdminContactView.js +105 -130
- package/dist/features/admin/components/AdminCouponEditorView.js +14 -17
- package/dist/features/admin/components/AdminCouponsView.d.ts +3 -6
- package/dist/features/admin/components/AdminCouponsView.js +69 -97
- package/dist/features/admin/components/AdminDigitalCodesView.d.ts +3 -0
- package/dist/features/admin/components/AdminDigitalCodesView.js +51 -0
- package/dist/features/admin/components/AdminFaqEditorView.js +14 -17
- package/dist/features/admin/components/AdminFaqsView.d.ts +4 -4
- package/dist/features/admin/components/AdminFaqsView.js +79 -86
- package/dist/features/admin/components/AdminFeatureEditorView.js +7 -9
- package/dist/features/admin/components/AdminFeaturesView.d.ts +2 -3
- package/dist/features/admin/components/AdminFeaturesView.js +57 -70
- package/dist/features/admin/components/AdminGroupedListingsView.d.ts +3 -0
- package/dist/features/admin/components/AdminGroupedListingsView.js +43 -0
- package/dist/features/admin/components/AdminHistoryView.d.ts +2 -3
- package/dist/features/admin/components/AdminHistoryView.js +35 -52
- package/dist/features/admin/components/AdminListingScaffold.d.ts +2 -2
- package/dist/features/admin/components/AdminListingScaffold.js +3 -3
- package/dist/features/admin/components/AdminLiveView.d.ts +3 -0
- package/dist/features/admin/components/AdminLiveView.js +50 -0
- package/dist/features/admin/components/AdminNewsletterView.d.ts +2 -2
- package/dist/features/admin/components/AdminNewsletterView.js +68 -108
- package/dist/features/admin/components/AdminNotificationsView.d.ts +2 -3
- package/dist/features/admin/components/AdminNotificationsView.js +67 -99
- package/dist/features/admin/components/AdminOrderEditorView.js +10 -10
- package/dist/features/admin/components/AdminOrdersView.d.ts +2 -3
- package/dist/features/admin/components/AdminOrdersView.js +93 -113
- package/dist/features/admin/components/AdminPayoutsView.d.ts +2 -3
- package/dist/features/admin/components/AdminPayoutsView.js +51 -97
- package/dist/features/admin/components/AdminPrizeDrawsView.d.ts +2 -3
- package/dist/features/admin/components/AdminPrizeDrawsView.js +41 -83
- package/dist/features/admin/components/AdminProductEditorView.js +3 -7
- package/dist/features/admin/components/AdminProductsView.d.ts +4 -4
- package/dist/features/admin/components/AdminProductsView.js +166 -167
- package/dist/features/admin/components/AdminReturnRequestsView.d.ts +1 -1
- package/dist/features/admin/components/AdminReturnRequestsView.js +64 -66
- package/dist/features/admin/components/AdminReviewsView.d.ts +3 -7
- package/dist/features/admin/components/AdminReviewsView.js +94 -116
- package/dist/features/admin/components/AdminScammersView.d.ts +2 -3
- package/dist/features/admin/components/AdminScammersView.js +53 -103
- package/dist/features/admin/components/AdminSectionsView.js +1 -1
- package/dist/features/admin/components/AdminSessionsView.d.ts +2 -3
- package/dist/features/admin/components/AdminSessionsView.js +62 -95
- package/dist/features/admin/components/AdminStoreAddressesView.d.ts +1 -1
- package/dist/features/admin/components/AdminStoreAddressesView.js +39 -53
- package/dist/features/admin/components/AdminStoreEditorView.js +21 -8
- package/dist/features/admin/components/AdminStoresView.d.ts +2 -3
- package/dist/features/admin/components/AdminStoresView.js +67 -105
- package/dist/features/admin/components/AdminSublistingCategoriesView.d.ts +1 -1
- package/dist/features/admin/components/AdminSublistingCategoriesView.js +29 -49
- package/dist/features/admin/components/AdminSublistingCategoryEditorView.js +17 -20
- package/dist/features/admin/components/AdminSupportTicketDetailView.d.ts +10 -1
- package/dist/features/admin/components/AdminSupportTicketDetailView.js +191 -5
- package/dist/features/admin/components/AdminSupportTicketsView.d.ts +2 -3
- package/dist/features/admin/components/AdminSupportTicketsView.js +65 -102
- package/dist/features/admin/components/AdminTeamView.d.ts +2 -2
- package/dist/features/admin/components/AdminTeamView.js +42 -85
- package/dist/features/admin/components/AdminUserEditorView.d.ts +11 -1
- package/dist/features/admin/components/AdminUserEditorView.js +80 -6
- package/dist/features/admin/components/AdminUsersView.d.ts +2 -3
- package/dist/features/admin/components/AdminUsersView.js +108 -106
- package/dist/features/admin/components/AdminViewCards.d.ts +1 -1
- package/dist/features/admin/components/AdminWishlistsView.d.ts +2 -3
- package/dist/features/admin/components/AdminWishlistsView.js +36 -62
- package/dist/features/admin/components/DataListingView.d.ts +122 -0
- package/dist/features/admin/components/DataListingView.js +66 -0
- package/dist/features/admin/components/index.d.ts +10 -4
- package/dist/features/admin/components/index.js +6 -2
- package/dist/features/admin/constants/filter-tabs.d.ts +23 -17
- package/dist/features/admin/constants/filter-tabs.js +21 -17
- package/dist/features/admin/hooks/useAdminListing.d.ts +59 -0
- package/dist/features/admin/hooks/useAdminListing.js +71 -0
- package/dist/features/admin/schemas/firestore.js +6 -7
- package/dist/features/auctions/server.d.ts +0 -1
- package/dist/features/auctions/server.js +0 -1
- package/dist/features/auth/actions/realtime-token-actions.js +1 -1
- package/dist/features/auth/repository/user.repository.js +1 -1
- package/dist/features/auth/schemas/firestore.d.ts +1 -0
- package/dist/features/blog/components/BlogIndexListing.js +3 -6
- package/dist/features/cart/repository/cart.repository.d.ts +4 -1
- package/dist/features/cart/repository/cart.repository.js +12 -0
- package/dist/features/categories/components/CategoriesIndexListing.js +3 -6
- package/dist/features/checkout/hooks/useCheckoutApi.d.ts +0 -2
- package/dist/features/checkout/index.d.ts +1 -1
- package/dist/features/events/components/AdminEventsView.d.ts +3 -3
- package/dist/features/events/components/AdminEventsView.js +50 -86
- package/dist/features/events/components/EventOfferCard.d.ts +19 -0
- package/dist/features/events/components/EventOfferCard.js +29 -0
- package/dist/features/events/components/EventRaffleEntryForm.d.ts +25 -0
- package/dist/features/events/components/EventRaffleEntryForm.js +37 -0
- package/dist/features/events/components/EventRafflesSection.d.ts +1 -4
- package/dist/features/events/components/EventRafflesSection.js +17 -6
- package/dist/features/events/components/EventSaleBanner.d.ts +21 -0
- package/dist/features/events/components/EventSaleBanner.js +18 -0
- package/dist/features/events/components/EventsIndexListing.js +3 -4
- package/dist/features/events/components/index.d.ts +6 -0
- package/dist/features/events/components/index.js +4 -0
- package/dist/features/events/repository/event-entry.repository.d.ts +5 -0
- package/dist/features/events/repository/event-entry.repository.js +7 -0
- package/dist/features/filters/AsyncFacetSection.d.ts +1 -1
- package/dist/features/homepage/components/AnnouncementBar.d.ts +4 -1
- package/dist/features/homepage/components/AnnouncementBar.js +51 -4
- package/dist/features/homepage/components/FAQSection.d.ts +0 -5
- package/dist/features/homepage/components/MarketplaceHomepageView.d.ts +3 -1
- package/dist/features/homepage/components/MarketplaceHomepageView.js +2 -2
- package/dist/features/homepage/components/index.d.ts +1 -1
- package/dist/features/homepage/components/index.js +1 -1
- package/dist/features/homepage/lib/live-stats.js +1 -1
- package/dist/features/homepage/lib/section-renderer.d.ts +2 -2
- package/dist/features/homepage/lib/section-renderer.js +2 -2
- package/dist/features/homepage/schemas/firestore.d.ts +0 -2
- package/dist/features/layout/index.d.ts +0 -2
- package/dist/features/layout/index.js +0 -1
- package/dist/features/orders/repository/orders.repository.d.ts +0 -1
- package/dist/features/orders/repository/orders.repository.js +0 -1
- package/dist/features/orders/server.d.ts +1 -1
- package/dist/features/orders/server.js +1 -1
- package/dist/features/pre-orders/server.d.ts +0 -1
- package/dist/features/pre-orders/server.js +0 -1
- package/dist/features/products/components/GroupSettingsPanel.js +65 -49
- package/dist/features/products/components/PrizeDrawItemsEditor.js +2 -2
- package/dist/features/products/components/PrizeDrawsSection.d.ts +1 -4
- package/dist/features/products/components/PrizeDrawsSection.js +17 -6
- package/dist/features/products/components/PrizeRevealModal.js +1 -1
- package/dist/features/products/components/ProductCardMetadataSection.d.ts +11 -0
- package/dist/features/products/components/ProductCardMetadataSection.js +25 -0
- package/dist/features/products/components/ProductDetailPageView.js +3 -1
- package/dist/features/products/components/ProductFeaturesSelector.js +1 -1
- package/dist/features/products/components/ProductGradingTab.d.ts +13 -0
- package/dist/features/products/components/ProductGradingTab.js +25 -0
- package/dist/features/products/components/ProductGrid.js +14 -2
- package/dist/features/products/components/ProductTabsShell.d.ts +5 -1
- package/dist/features/products/components/ProductTabsShell.js +6 -1
- package/dist/features/products/components/index.d.ts +4 -0
- package/dist/features/products/components/index.js +3 -0
- package/dist/features/products/constants/action-defs.d.ts +5 -0
- package/dist/features/products/constants/action-defs.js +52 -32
- package/dist/features/products/constants/sieve.d.ts +24 -4
- package/dist/features/products/constants/sieve.js +20 -11
- package/dist/features/products/repository/products.repository.d.ts +0 -2
- package/dist/features/products/repository/products.repository.js +0 -2
- package/dist/features/products/schemas/firestore.d.ts +17 -0
- package/dist/features/products/schemas/product-features.validators.d.ts +2 -2
- package/dist/features/products/schemas/product-templates.d.ts +2 -4
- package/dist/features/products/server.d.ts +1 -1
- package/dist/features/products/server.js +1 -1
- package/dist/features/products/types/index.d.ts +4 -0
- package/dist/features/promotions/components/CouponCard.js +5 -5
- package/dist/features/promotions/components/CouponsIndexListing.js +3 -2
- package/dist/features/promotions/server.d.ts +0 -1
- package/dist/features/promotions/server.js +0 -1
- package/dist/features/reviews/components/ReviewsIndexListing.js +3 -4
- package/dist/features/reviews/repository/reviews.repository.d.ts +0 -1
- package/dist/features/reviews/repository/reviews.repository.js +0 -1
- package/dist/features/reviews/server.d.ts +1 -1
- package/dist/features/reviews/server.js +1 -1
- package/dist/features/search/api/route.js +44 -1
- package/dist/features/search/components/Search.js +2 -0
- package/dist/features/search/hooks/useNavSuggestions.d.ts +5 -1
- package/dist/features/search/hooks/useNavSuggestions.js +31 -4
- package/dist/features/seller/components/BrandInlineSelect.js +2 -2
- package/dist/features/seller/components/CategoryInlineSelect.js +2 -2
- package/dist/features/seller/components/SellerAddressesView.js +10 -20
- package/dist/features/seller/components/SellerAuctionsView.d.ts +3 -3
- package/dist/features/seller/components/SellerAuctionsView.js +67 -106
- package/dist/features/seller/components/SellerBidsView.js +6 -6
- package/dist/features/seller/components/SellerBundlesView.js +72 -105
- package/dist/features/seller/components/SellerClassifiedView.js +74 -105
- package/dist/features/seller/components/SellerCouponEditorView.js +1 -1
- package/dist/features/seller/components/SellerCouponsView.d.ts +2 -2
- package/dist/features/seller/components/SellerCouponsView.js +51 -96
- package/dist/features/seller/components/SellerDigitalCodesView.js +70 -103
- package/dist/features/seller/components/SellerGroupedListingsView.js +34 -54
- package/dist/features/seller/components/SellerLiveView.js +70 -99
- package/dist/features/seller/components/SellerOffersPanel.js +1 -1
- package/dist/features/seller/components/SellerOffersView.d.ts +2 -2
- package/dist/features/seller/components/SellerOffersView.js +37 -70
- package/dist/features/seller/components/SellerOrdersView.d.ts +2 -2
- package/dist/features/seller/components/SellerOrdersView.js +10 -24
- package/dist/features/seller/components/SellerPayoutMethodsView.js +12 -24
- package/dist/features/seller/components/SellerPayoutsView.d.ts +2 -2
- package/dist/features/seller/components/SellerPayoutsView.js +34 -69
- package/dist/features/seller/components/SellerPreOrdersView.d.ts +2 -2
- package/dist/features/seller/components/SellerPreOrdersView.js +55 -97
- package/dist/features/seller/components/SellerPrizeDrawsView.d.ts +2 -2
- package/dist/features/seller/components/SellerPrizeDrawsView.js +55 -97
- package/dist/features/seller/components/SellerProductShell.d.ts +1 -1
- package/dist/features/seller/components/SellerProductsFilterDrawer.d.ts +1 -1
- package/dist/features/seller/components/SellerProductsFilterDrawer.js +3 -6
- package/dist/features/seller/components/SellerProductsView.d.ts +2 -2
- package/dist/features/seller/components/SellerProductsView.js +24 -32
- package/dist/features/seller/components/SellerShippingConfigsView.js +12 -24
- package/dist/features/seller/components/SellerSidebar.d.ts +0 -4
- package/dist/features/seller/components/SellerSidebar.js +0 -2
- package/dist/features/seller/components/SellerStoreCategoriesView.js +15 -34
- package/dist/features/seller/components/SellerTemplatesView.js +27 -43
- package/dist/features/seller/components/SellersListView.d.ts +1 -2
- package/dist/features/seller/components/analytics/SellerAnalyticsStats.d.ts +5 -0
- package/dist/features/seller/components/analytics/SellerAnalyticsStats.js +2 -8
- package/dist/features/seller/components/index.d.ts +0 -3
- package/dist/features/seller/components/index.js +0 -2
- package/dist/features/seller/server.d.ts +0 -1
- package/dist/features/seller/server.js +0 -1
- package/dist/features/shell/FormShell.d.ts +1 -1
- package/dist/features/shell/FormShell.js +4 -1
- package/dist/features/shell/field-groups/ImageFieldGroup.d.ts +18 -0
- package/dist/features/shell/field-groups/ImageFieldGroup.js +15 -0
- package/dist/features/shell/field-groups/SeoFieldGroup.d.ts +22 -0
- package/dist/features/shell/field-groups/SeoFieldGroup.js +16 -0
- package/dist/features/shell/field-groups/StatusFieldGroup.d.ts +35 -0
- package/dist/features/shell/field-groups/StatusFieldGroup.js +16 -0
- package/dist/features/shell/field-groups/TitleDescriptionGroup.d.ts +40 -0
- package/dist/features/shell/field-groups/TitleDescriptionGroup.js +16 -0
- package/dist/features/shell/field-groups/index.d.ts +13 -0
- package/dist/features/shell/field-groups/index.js +9 -0
- package/dist/features/shell/index.d.ts +2 -0
- package/dist/features/shell/index.js +1 -0
- package/dist/features/stores/components/StoreCapabilitiesGuideView.d.ts +1 -2
- package/dist/features/stores/components/StoreFinanceGuideView.d.ts +1 -2
- package/dist/features/stores/components/StoreHeader.js +2 -1
- package/dist/features/stores/components/StoreListingsGuideView.d.ts +1 -2
- package/dist/features/stores/components/StoreOrdersGuideView.d.ts +1 -2
- package/dist/features/stores/components/StoreReviewsListing.js +3 -4
- package/dist/features/stores/components/StoreScopedSearch.d.ts +16 -0
- package/dist/features/stores/components/StoreScopedSearch.js +27 -0
- package/dist/features/stores/components/StoreSettingsGuideView.d.ts +1 -2
- package/dist/features/stores/components/StoresIndexListing.js +3 -4
- package/dist/features/stores/server.d.ts +0 -1
- package/dist/features/stores/server.js +0 -1
- package/dist/features/support/schemas/firestore.d.ts +22 -1
- package/dist/features/support/schemas/firestore.js +10 -0
- package/dist/features/wishlist/server.d.ts +0 -1
- package/dist/features/wishlist/server.js +0 -1
- package/dist/index.d.ts +11 -33
- package/dist/index.js +17 -62
- package/dist/next/routing/route-map.d.ts +8 -0
- package/dist/next/routing/route-map.js +4 -0
- package/dist/react/contexts/SessionContext.d.ts +2 -0
- package/dist/react/contexts/SessionContext.js +2 -0
- package/dist/react/hooks/useEntityDelete.d.ts +15 -0
- package/dist/react/hooks/useEntityDelete.js +39 -0
- package/dist/react/hooks/useListingTypeFlags.d.ts +32 -0
- package/dist/react/hooks/useListingTypeFlags.js +19 -0
- package/dist/react/index.d.ts +2 -0
- package/dist/react/index.js +2 -0
- package/dist/repositories/index.d.ts +3 -3
- package/dist/repositories/index.js +3 -3
- package/dist/security/index.d.ts +1 -1
- package/dist/security/index.js +1 -1
- package/dist/security/pii-redact.d.ts +8 -0
- package/dist/security/pii-redact.js +10 -1
- package/dist/seed/grouped-listings-seed-data.d.ts +4 -0
- package/dist/seed/products-preorders-seed-data.d.ts +4 -0
- package/dist/seed/products-prize-draws-seed-data.js +3 -0
- package/dist/seed/site-settings-seed-data.js +5 -5
- package/dist/seed/sub-listings-seed-data.d.ts +4 -0
- package/dist/server.d.ts +2 -0
- package/dist/server.js +4 -0
- package/dist/styles.css +54 -395
- package/dist/tailwind-utilities.css +1 -1
- package/dist/ui/components/BaseListingCard.d.ts +10 -0
- package/dist/ui/components/BaseListingCard.js +17 -1
- package/dist/ui/components/DetailPageGallery.d.ts +32 -0
- package/dist/ui/components/DetailPageGallery.js +47 -0
- package/dist/ui/components/DetailPageHero.d.ts +30 -0
- package/dist/ui/components/DetailPageHero.js +22 -0
- package/dist/ui/components/DetailPageTabs.d.ts +34 -0
- package/dist/ui/components/DetailPageTabs.js +38 -0
- package/dist/ui/components/HorizontalScroller.style.css +15 -2
- package/dist/ui/components/ListingFilterDrawer.d.ts +10 -0
- package/dist/ui/components/ListingFilterDrawer.js +8 -0
- package/dist/ui/components/ListingLayout.d.ts +11 -2
- package/dist/ui/components/ListingLayout.js +12 -6
- package/dist/ui/components/PaginatedSelect.d.ts +66 -0
- package/dist/ui/components/PaginatedSelect.js +201 -0
- package/dist/ui/components/PaginatedSelect.style.css +254 -0
- package/dist/ui/components/Semantic.d.ts +0 -4
- package/dist/ui/components/Semantic.js +0 -2
- package/dist/ui/components/SettingsSection.d.ts +47 -0
- package/dist/ui/components/SettingsSection.js +38 -0
- package/dist/ui/components/index.style.css +1 -4
- package/dist/ui/index.d.ts +14 -14
- package/dist/ui/index.js +7 -7
- package/dist/utils/id-generators.d.ts +1 -18
- package/dist/utils/id-generators.js +51 -18
- package/dist/validation/schemas.d.ts +25 -0
- package/dist/validation/schemas.js +28 -0
- package/package.json +1 -1
package/dist/ui/index.js
CHANGED
|
@@ -6,7 +6,7 @@ export { FieldSelect } from "./forms";
|
|
|
6
6
|
export { FieldCheckbox } from "./forms";
|
|
7
7
|
// --- Column utilities ---------------------------------------------------------
|
|
8
8
|
export { buildColumns, createColumnBuilder, renderBoolean, renderCurrency, renderCurrencyCompact, renderCount, renderNullable, renderRating, } from "./columns";
|
|
9
|
-
export { Section, Article, Main, Aside, Nav, BlockHeader, BlockFooter,
|
|
9
|
+
export { Section, Article, Main, Aside, Nav, BlockHeader, BlockFooter, Ul, Ol, Li, Table, Thead, Tbody, Tr, Th, Td, Code, Pre, Blockquote, Figure, Figcaption, Dl, Dt, Dd, } from "./components/Semantic";
|
|
10
10
|
export { Div } from "./components/Div";
|
|
11
11
|
export { Heading, Text, Label, Caption, Span } from "./components/Typography";
|
|
12
12
|
// --- Filter chip group (SB10-C completion, S8 2026-05-13) --------------------
|
|
@@ -58,9 +58,12 @@ export { SummaryCard } from "./components/SummaryCard";
|
|
|
58
58
|
export { CountdownDisplay } from "./components/CountdownDisplay";
|
|
59
59
|
export { ItemRow } from "./components/ItemRow";
|
|
60
60
|
export { HorizontalScroller } from "./components/HorizontalScroller";
|
|
61
|
-
export { SectionTabs } from "./components/SectionTabs";
|
|
62
61
|
export { TabStrip } from "./components/TabStrip";
|
|
63
62
|
export { FormGrid, FormField as FormGridField } from "./components/FormGrid";
|
|
63
|
+
export { SettingsSection, ToggleRow } from "./components/SettingsSection";
|
|
64
|
+
export { DetailPageHero } from "./components/DetailPageHero";
|
|
65
|
+
export { DetailPageGallery } from "./components/DetailPageGallery";
|
|
66
|
+
export { DetailPageTabs } from "./components/DetailPageTabs";
|
|
64
67
|
export { FormField } from "./components/FormField";
|
|
65
68
|
export { DescriptionField } from "./components/DescriptionField";
|
|
66
69
|
export { Card, CardHeader, CardBody, CardFooter } from "./components/Card";
|
|
@@ -68,9 +71,7 @@ export { EmptyState } from "./components/EmptyState";
|
|
|
68
71
|
export { Avatar, AvatarGroup } from "./components/Avatar";
|
|
69
72
|
export { Dropdown, DropdownTrigger, DropdownMenu, DropdownItem, DropdownSeparator, } from "./components/Dropdown";
|
|
70
73
|
export { Menu, MenuTrigger, MenuContent, MenuItem, MenuSeparator, } from "./components/Menu";
|
|
71
|
-
export {
|
|
72
|
-
export { InlineCreateSelect } from "./components/InlineCreateSelect";
|
|
73
|
-
export { PaginatedMultiSelect } from "./components/PaginatedMultiSelect";
|
|
74
|
+
export { PaginatedSelect } from "./components/PaginatedSelect";
|
|
74
75
|
export { RoleBadge } from "./components/RoleBadge";
|
|
75
76
|
export { SkipToMain } from "./components/SkipToMain";
|
|
76
77
|
export { NavigationLoader } from "./components/NavigationLoader";
|
|
@@ -79,9 +80,9 @@ export { FilterDrawer } from "./components/FilterDrawer";
|
|
|
79
80
|
export { RowActionMenu } from "./components/RowActionMenu";
|
|
80
81
|
export { PasswordStrengthIndicator } from "./components/PasswordStrengthIndicator";
|
|
81
82
|
export { AvatarDisplay } from "./components/AvatarDisplay";
|
|
82
|
-
export { DashboardStatsCard } from "./components/DashboardStatsCard";
|
|
83
83
|
export { ActiveFilterChips } from "./components/ActiveFilterChips";
|
|
84
84
|
export { SortDropdown } from "./components/SortDropdown";
|
|
85
|
+
export { ListingFilterDrawer } from "./components/ListingFilterDrawer";
|
|
85
86
|
export { ListingToolbar } from "./components/ListingToolbar";
|
|
86
87
|
export { TablePagination } from "./components/TablePagination";
|
|
87
88
|
export { DataTable } from "./DataTable";
|
|
@@ -95,7 +96,6 @@ export { RichText } from "./rich-text/RichText";
|
|
|
95
96
|
export { RichTextRenderer } from "./rich-text/RichTextRenderer";
|
|
96
97
|
export { RichTextEditor } from "./components/RichTextEditor";
|
|
97
98
|
export { ListingLayout } from "./components/ListingLayout";
|
|
98
|
-
export { ListingViewShell } from "./components/ListingViewShell";
|
|
99
99
|
export { SlottedListingView } from "./components/SlottedListingView";
|
|
100
100
|
export { DetailViewShell } from "./components/DetailViewShell";
|
|
101
101
|
export { StackedViewShell } from "./components/StackedViewShell";
|
|
@@ -115,7 +115,6 @@ export interface GenerateProductImageFilenameInput {
|
|
|
115
115
|
index?: number;
|
|
116
116
|
ext?: string;
|
|
117
117
|
}
|
|
118
|
-
export declare function generateProductImageFilename(input: GenerateProductImageFilenameInput): string;
|
|
119
118
|
export interface GenerateProductVideoFilenameInput {
|
|
120
119
|
name: string;
|
|
121
120
|
category: string;
|
|
@@ -123,7 +122,6 @@ export interface GenerateProductVideoFilenameInput {
|
|
|
123
122
|
index?: number;
|
|
124
123
|
ext?: string;
|
|
125
124
|
}
|
|
126
|
-
export declare function generateProductVideoFilename(input: GenerateProductVideoFilenameInput): string;
|
|
127
125
|
export interface GenerateAuctionImageFilenameInput {
|
|
128
126
|
name: string;
|
|
129
127
|
category: string;
|
|
@@ -131,7 +129,6 @@ export interface GenerateAuctionImageFilenameInput {
|
|
|
131
129
|
index?: number;
|
|
132
130
|
ext?: string;
|
|
133
131
|
}
|
|
134
|
-
export declare function generateAuctionImageFilename(input: GenerateAuctionImageFilenameInput): string;
|
|
135
132
|
export interface GeneratePreOrderImageFilenameInput {
|
|
136
133
|
name: string;
|
|
137
134
|
category: string;
|
|
@@ -139,49 +136,34 @@ export interface GeneratePreOrderImageFilenameInput {
|
|
|
139
136
|
index?: number;
|
|
140
137
|
ext?: string;
|
|
141
138
|
}
|
|
142
|
-
export declare function generatePreOrderImageFilename(input: GeneratePreOrderImageFilenameInput): string;
|
|
143
139
|
export interface GenerateReviewImageFilenameInput {
|
|
144
140
|
productId: string;
|
|
145
141
|
index?: number;
|
|
146
142
|
ext?: string;
|
|
147
143
|
}
|
|
148
|
-
export declare function generateReviewImageFilename(input: GenerateReviewImageFilenameInput): string;
|
|
149
144
|
export interface GenerateReviewVideoFilenameInput {
|
|
150
145
|
productId: string;
|
|
151
146
|
ext?: string;
|
|
152
147
|
}
|
|
153
|
-
export declare function generateReviewVideoFilename(input: GenerateReviewVideoFilenameInput): string;
|
|
154
|
-
export declare function generateStoreLogoFilename(storeName: string, ext?: string): string;
|
|
155
|
-
export declare function generateStoreBannerFilename(storeName: string, ext?: string): string;
|
|
156
|
-
export declare function generateBrandLogoFilename(brandName: string, ext?: string): string;
|
|
157
|
-
export declare function generateBrandBannerFilename(brandName: string, ext?: string): string;
|
|
158
148
|
export interface GenerateBlogImageFilenameInput {
|
|
159
149
|
title: string;
|
|
160
150
|
category: string;
|
|
161
151
|
index?: number;
|
|
162
152
|
ext?: string;
|
|
163
153
|
}
|
|
164
|
-
export declare function generateBlogImageFilename(input: GenerateBlogImageFilenameInput): string;
|
|
165
154
|
export interface GenerateEventImageFilenameInput {
|
|
166
155
|
title: string;
|
|
167
156
|
index?: number;
|
|
168
157
|
ext?: string;
|
|
169
158
|
}
|
|
170
|
-
export declare function generateEventImageFilename(input: GenerateEventImageFilenameInput): string;
|
|
171
159
|
export interface GenerateRichTextImageFilenameInput {
|
|
172
160
|
entity: string;
|
|
173
161
|
name: string;
|
|
174
162
|
index?: number;
|
|
175
163
|
ext?: string;
|
|
176
164
|
}
|
|
177
|
-
export declare function generateRichTextImageFilename(input: GenerateRichTextImageFilenameInput): string;
|
|
178
|
-
export declare function generateCategoryImageFilename(categoryName: string, ext?: string): string;
|
|
179
|
-
export declare function generateUserAvatarFilename(firstName: string, lastName: string, ext?: string): string;
|
|
180
|
-
export declare function generateCarouselImageFilename(title: string, ext?: string): string;
|
|
181
165
|
export declare function generateCroppedImageFilename(originalFilenameOrPath: string, ext?: string): string;
|
|
182
166
|
export declare function generateTrimmedVideoFilename(originalFilenameOrPath: string, ext?: string): string;
|
|
183
|
-
export declare function generateInvoiceFilename(orderId: string, date?: Date): string;
|
|
184
|
-
export declare function generatePayoutDocFilename(sellerName: string, date?: Date): string;
|
|
185
167
|
export type MediaFilenameContext = ({
|
|
186
168
|
type: "product-image";
|
|
187
169
|
} & GenerateProductImageFilenameInput) | ({
|
|
@@ -262,3 +244,4 @@ export type MediaFilenameContext = ({
|
|
|
262
244
|
date?: Date;
|
|
263
245
|
};
|
|
264
246
|
export declare function generateMediaFilename(ctx: MediaFilenameContext): string;
|
|
247
|
+
export declare function validateMediaFilename(filename: string): boolean;
|
|
@@ -199,7 +199,7 @@ function basenameStem(filenameOrPath) {
|
|
|
199
199
|
const dotIndex = filename.lastIndexOf(".");
|
|
200
200
|
return dotIndex > 0 ? filename.slice(0, dotIndex) : filename;
|
|
201
201
|
}
|
|
202
|
-
|
|
202
|
+
function generateProductImageFilename(input) {
|
|
203
203
|
const name = slugify(input.name).substring(0, 40).replace(/-+$/, "");
|
|
204
204
|
const category = slugify(input.category).substring(0, 20).replace(/-+$/, "");
|
|
205
205
|
const store = slugify(input.store).substring(0, 20).replace(/-+$/, "");
|
|
@@ -207,7 +207,7 @@ export function generateProductImageFilename(input) {
|
|
|
207
207
|
const ext = (input.ext ?? "webp").replace(/^\./, "");
|
|
208
208
|
return `product-${name}-${category}-${store}-image-${n}.${ext}`;
|
|
209
209
|
}
|
|
210
|
-
|
|
210
|
+
function generateProductVideoFilename(input) {
|
|
211
211
|
const name = slugify(input.name).substring(0, 40).replace(/-+$/, "");
|
|
212
212
|
const category = slugify(input.category).substring(0, 20).replace(/-+$/, "");
|
|
213
213
|
const store = slugify(input.store).substring(0, 20).replace(/-+$/, "");
|
|
@@ -215,7 +215,7 @@ export function generateProductVideoFilename(input) {
|
|
|
215
215
|
const ext = (input.ext ?? "mp4").replace(/^\./, "");
|
|
216
216
|
return `product-${name}-${category}-${store}-video-${n}.${ext}`;
|
|
217
217
|
}
|
|
218
|
-
|
|
218
|
+
function generateAuctionImageFilename(input) {
|
|
219
219
|
const name = slugify(input.name).substring(0, 40).replace(/-+$/, "");
|
|
220
220
|
const category = slugify(input.category).substring(0, 20).replace(/-+$/, "");
|
|
221
221
|
const store = slugify(input.store).substring(0, 20).replace(/-+$/, "");
|
|
@@ -223,7 +223,7 @@ export function generateAuctionImageFilename(input) {
|
|
|
223
223
|
const ext = (input.ext ?? "webp").replace(/^\./, "");
|
|
224
224
|
return `auction-${name}-${category}-${store}-image-${n}.${ext}`;
|
|
225
225
|
}
|
|
226
|
-
|
|
226
|
+
function generatePreOrderImageFilename(input) {
|
|
227
227
|
const name = slugify(input.name).substring(0, 40).replace(/-+$/, "");
|
|
228
228
|
const category = slugify(input.category).substring(0, 20).replace(/-+$/, "");
|
|
229
229
|
const store = slugify(input.store).substring(0, 20).replace(/-+$/, "");
|
|
@@ -231,63 +231,63 @@ export function generatePreOrderImageFilename(input) {
|
|
|
231
231
|
const ext = (input.ext ?? "webp").replace(/^\./, "");
|
|
232
232
|
return `preorder-${name}-${category}-${store}-image-${n}.${ext}`;
|
|
233
233
|
}
|
|
234
|
-
|
|
234
|
+
function generateReviewImageFilename(input) {
|
|
235
235
|
const product = slugify(input.productId).substring(0, 40).replace(/-+$/, "");
|
|
236
236
|
const n = input.index ?? 1;
|
|
237
237
|
const ext = (input.ext ?? "webp").replace(/^\./, "");
|
|
238
238
|
return `review-${product}-image-${n}.${ext}`;
|
|
239
239
|
}
|
|
240
|
-
|
|
240
|
+
function generateReviewVideoFilename(input) {
|
|
241
241
|
const product = slugify(input.productId).substring(0, 40).replace(/-+$/, "");
|
|
242
242
|
const ext = (input.ext ?? "mp4").replace(/^\./, "");
|
|
243
243
|
return `review-${product}-video-1.${ext}`;
|
|
244
244
|
}
|
|
245
|
-
|
|
245
|
+
function generateStoreLogoFilename(storeName, ext = "webp") {
|
|
246
246
|
const store = slugify(storeName).substring(0, 40).replace(/-+$/, "");
|
|
247
247
|
return `store-${store}-logo.${ext.replace(/^\./, "")}`;
|
|
248
248
|
}
|
|
249
|
-
|
|
249
|
+
function generateStoreBannerFilename(storeName, ext = "webp") {
|
|
250
250
|
const store = slugify(storeName).substring(0, 40).replace(/-+$/, "");
|
|
251
251
|
return `store-${store}-banner.${ext.replace(/^\./, "")}`;
|
|
252
252
|
}
|
|
253
|
-
|
|
253
|
+
function generateBrandLogoFilename(brandName, ext = "webp") {
|
|
254
254
|
const brand = slugify(brandName).substring(0, 40).replace(/-+$/, "");
|
|
255
255
|
return `brand-${brand}-logo.${ext.replace(/^\./, "")}`;
|
|
256
256
|
}
|
|
257
|
-
|
|
257
|
+
function generateBrandBannerFilename(brandName, ext = "webp") {
|
|
258
258
|
const brand = slugify(brandName).substring(0, 40).replace(/-+$/, "");
|
|
259
259
|
return `brand-${brand}-banner.${ext.replace(/^\./, "")}`;
|
|
260
260
|
}
|
|
261
|
-
|
|
261
|
+
function generateBlogImageFilename(input) {
|
|
262
262
|
const title = slugify(input.title).substring(0, 40).replace(/-+$/, "");
|
|
263
263
|
const category = slugify(input.category).substring(0, 20).replace(/-+$/, "");
|
|
264
264
|
const n = input.index ?? 1;
|
|
265
265
|
const ext = (input.ext ?? "webp").replace(/^\./, "");
|
|
266
266
|
return `blog-${title}-${category}-image-${n}.${ext}`;
|
|
267
267
|
}
|
|
268
|
-
|
|
268
|
+
function generateEventImageFilename(input) {
|
|
269
269
|
const title = slugify(input.title).substring(0, 50).replace(/-+$/, "");
|
|
270
270
|
const n = input.index ?? 1;
|
|
271
271
|
const ext = (input.ext ?? "webp").replace(/^\./, "");
|
|
272
272
|
return `event-${title}-image-${n}.${ext}`;
|
|
273
273
|
}
|
|
274
|
-
|
|
274
|
+
function generateRichTextImageFilename(input) {
|
|
275
275
|
const entity = slugify(input.entity).substring(0, 24).replace(/-+$/, "");
|
|
276
276
|
const name = slugify(input.name).substring(0, 40).replace(/-+$/, "");
|
|
277
277
|
const n = input.index ?? 1;
|
|
278
278
|
const ext = (input.ext ?? "webp").replace(/^\./, "");
|
|
279
279
|
return `rich-text-${entity}-${name}-image-${n}.${ext}`;
|
|
280
280
|
}
|
|
281
|
-
|
|
281
|
+
function generateCategoryImageFilename(categoryName, ext = "webp") {
|
|
282
282
|
const name = slugify(categoryName).substring(0, 40).replace(/-+$/, "");
|
|
283
283
|
return `category-${name}-image.${ext.replace(/^\./, "")}`;
|
|
284
284
|
}
|
|
285
|
-
|
|
285
|
+
function generateUserAvatarFilename(firstName, lastName, ext = "webp") {
|
|
286
286
|
const first = slugify(firstName).substring(0, 20).replace(/-+$/, "");
|
|
287
287
|
const last = slugify(lastName).substring(0, 20).replace(/-+$/, "");
|
|
288
288
|
return `user-${first}-${last}-avatar.${ext.replace(/^\./, "")}`;
|
|
289
289
|
}
|
|
290
|
-
|
|
290
|
+
function generateCarouselImageFilename(title, ext = "webp") {
|
|
291
291
|
const slug = slugify(title).substring(0, 40).replace(/-+$/, "");
|
|
292
292
|
return `carousel-${slug}-image.${ext.replace(/^\./, "")}`;
|
|
293
293
|
}
|
|
@@ -305,13 +305,13 @@ export function generateTrimmedVideoFilename(originalFilenameOrPath, ext) {
|
|
|
305
305
|
: "mp4";
|
|
306
306
|
return `${stem}-trimmed.${(ext ?? originalExt).replace(/^\./, "")}`;
|
|
307
307
|
}
|
|
308
|
-
|
|
308
|
+
function generateInvoiceFilename(orderId, date = new Date()) {
|
|
309
309
|
const y = date.getFullYear();
|
|
310
310
|
const m = String(date.getMonth() + 1).padStart(2, "0");
|
|
311
311
|
const d = String(date.getDate()).padStart(2, "0");
|
|
312
312
|
return `invoice-${orderId}-${y}${m}${d}.pdf`;
|
|
313
313
|
}
|
|
314
|
-
|
|
314
|
+
function generatePayoutDocFilename(sellerName, date = new Date()) {
|
|
315
315
|
const seller = slugify(sellerName).substring(0, 30).replace(/-+$/, "");
|
|
316
316
|
const y = date.getFullYear();
|
|
317
317
|
const m = String(date.getMonth() + 1).padStart(2, "0");
|
|
@@ -386,3 +386,36 @@ export function generateMediaFilename(ctx) {
|
|
|
386
386
|
}
|
|
387
387
|
}
|
|
388
388
|
}
|
|
389
|
+
/**
|
|
390
|
+
* W1-51 — validate that a filename matches the canonical pattern produced
|
|
391
|
+
* by {@link generateMediaFilename}. Called from /api/media/sign before a
|
|
392
|
+
* signed-URL is issued so malformed names can never enter storage.
|
|
393
|
+
*
|
|
394
|
+
* Pattern: `<prefix>-<slug parts>-<YYYYMMDD>(-<N>)?(-<rand>)?\.<ext>` where
|
|
395
|
+
* the prefix is one of the known media type tokens.
|
|
396
|
+
*
|
|
397
|
+
* Returns true when the filename is acceptable.
|
|
398
|
+
*/
|
|
399
|
+
const MEDIA_FILENAME_PREFIXES = [
|
|
400
|
+
"product-image", "product-video",
|
|
401
|
+
"review-image", "review-video",
|
|
402
|
+
"auction-image", "preorder-image",
|
|
403
|
+
"store-logo", "store-banner",
|
|
404
|
+
"brand-logo", "brand-banner",
|
|
405
|
+
"blog-image", "blog-cover", "blog-content-image", "blog-additional-image",
|
|
406
|
+
"event-image", "event-cover", "event-winner-image", "event-additional-image",
|
|
407
|
+
"rich-text-image",
|
|
408
|
+
"category-image",
|
|
409
|
+
"user-avatar",
|
|
410
|
+
"carousel-image",
|
|
411
|
+
"invoice", "payout-doc",
|
|
412
|
+
"shipping-proof", "refund-proof",
|
|
413
|
+
];
|
|
414
|
+
const MEDIA_FILENAME_REGEX = new RegExp(`^(?:${MEDIA_FILENAME_PREFIXES.join("|")})-[a-z0-9]([a-z0-9-]*[a-z0-9])?(?:-\\d+)?\\.[a-z0-9]+$`);
|
|
415
|
+
export function validateMediaFilename(filename) {
|
|
416
|
+
if (!filename || filename.length > 256)
|
|
417
|
+
return false;
|
|
418
|
+
if (filename.includes("..") || filename.includes("/") || filename.includes("\\"))
|
|
419
|
+
return false;
|
|
420
|
+
return MEDIA_FILENAME_REGEX.test(filename);
|
|
421
|
+
}
|
|
@@ -24,6 +24,31 @@ export declare const urlSchema: z.ZodString;
|
|
|
24
24
|
export declare const APPROVED_MEDIA_DOMAINS: string[];
|
|
25
25
|
export declare const mediaUrlSchema: z.ZodEffects<z.ZodString, string, string>;
|
|
26
26
|
export declare const dateStringSchema: z.ZodString;
|
|
27
|
+
/** Monetary value in paise — non-negative integer. Use for `price`, `mrp`, `discount`, etc. */
|
|
28
|
+
export declare const priceSchema: z.ZodNumber;
|
|
29
|
+
/** Discount percentage — 0–100. */
|
|
30
|
+
export declare const discountPercentSchema: z.ZodNumber;
|
|
31
|
+
/** Bounded image-array schema factory — caps gallery length. */
|
|
32
|
+
export declare const imageArraySchema: (max: number) => z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">;
|
|
33
|
+
/** Slug regex factory. Pass the `<prefix>-` token (e.g. `"product-"`) to enforce prefix discipline. */
|
|
34
|
+
export declare const createSlugValidator: (prefix?: string) => z.ZodString;
|
|
35
|
+
/** A Firestore Timestamp converted to JS Date — accepts string or Date instances. */
|
|
36
|
+
export declare const timestampSchema: z.ZodUnion<[z.ZodString, z.ZodDate]>;
|
|
37
|
+
/** Standard `createdAt`/`updatedAt` block — fold into doc schemas with `.merge(timestampsSchema)`. */
|
|
38
|
+
export declare const timestampsSchema: z.ZodObject<{
|
|
39
|
+
createdAt: z.ZodUnion<[z.ZodString, z.ZodDate]>;
|
|
40
|
+
updatedAt: z.ZodUnion<[z.ZodString, z.ZodDate]>;
|
|
41
|
+
}, "strip", z.ZodTypeAny, {
|
|
42
|
+
createdAt: string | Date;
|
|
43
|
+
updatedAt: string | Date;
|
|
44
|
+
}, {
|
|
45
|
+
createdAt: string | Date;
|
|
46
|
+
updatedAt: string | Date;
|
|
47
|
+
}>;
|
|
48
|
+
/** Non-empty trimmed string with a length cap. */
|
|
49
|
+
export declare const nonEmptyString: (max?: number) => z.ZodString;
|
|
50
|
+
/** Optional rich-text body — uses the HTML schema (plain length cap). */
|
|
51
|
+
export declare const richTextBodySchema: (max?: number) => z.ZodString;
|
|
27
52
|
export declare const passwordSchema: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
28
53
|
export declare const phoneSchema: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
29
54
|
export declare const emailSchema: z.ZodString;
|
|
@@ -34,6 +34,34 @@ export const mediaUrlSchema = z
|
|
|
34
34
|
}, { message: "Image or video URL must be hosted on an approved CDN domain" });
|
|
35
35
|
export const dateStringSchema = z.string().datetime();
|
|
36
36
|
// ============================================
|
|
37
|
+
// SHARED PRIMITIVES (W2-4 — 2026-05-23)
|
|
38
|
+
// Use these instead of redefining the same validators in feature schemas.
|
|
39
|
+
// ============================================
|
|
40
|
+
/** Monetary value in paise — non-negative integer. Use for `price`, `mrp`, `discount`, etc. */
|
|
41
|
+
export const priceSchema = z.number().int().min(0, "Price must be non-negative (paise)");
|
|
42
|
+
/** Discount percentage — 0–100. */
|
|
43
|
+
export const discountPercentSchema = z.number().min(0).max(100);
|
|
44
|
+
/** Bounded image-array schema factory — caps gallery length. */
|
|
45
|
+
export const imageArraySchema = (max) => z.array(mediaUrlSchema).max(max, `At most ${max} images allowed`);
|
|
46
|
+
/** Slug regex factory. Pass the `<prefix>-` token (e.g. `"product-"`) to enforce prefix discipline. */
|
|
47
|
+
export const createSlugValidator = (prefix) => prefix
|
|
48
|
+
? z
|
|
49
|
+
.string()
|
|
50
|
+
.min(prefix.length + 1)
|
|
51
|
+
.regex(new RegExp(`^${prefix}[a-z0-9-]+$`), `Slug must start with "${prefix}"`)
|
|
52
|
+
: z.string().min(1).regex(/^[a-z0-9-]+$/, "Slug may only contain lowercase letters, numbers and hyphens");
|
|
53
|
+
/** A Firestore Timestamp converted to JS Date — accepts string or Date instances. */
|
|
54
|
+
export const timestampSchema = z.union([z.string().datetime(), z.date()]);
|
|
55
|
+
/** Standard `createdAt`/`updatedAt` block — fold into doc schemas with `.merge(timestampsSchema)`. */
|
|
56
|
+
export const timestampsSchema = z.object({
|
|
57
|
+
createdAt: timestampSchema,
|
|
58
|
+
updatedAt: timestampSchema,
|
|
59
|
+
});
|
|
60
|
+
/** Non-empty trimmed string with a length cap. */
|
|
61
|
+
export const nonEmptyString = (max = 255) => z.string().trim().min(1, "Required").max(max, `Must be at most ${max} characters`);
|
|
62
|
+
/** Optional rich-text body — uses the HTML schema (plain length cap). */
|
|
63
|
+
export const richTextBodySchema = (max = 50000) => z.string().trim().max(max, `Body must be at most ${max} characters`);
|
|
64
|
+
// ============================================
|
|
37
65
|
// AUTH / USER SCHEMAS
|
|
38
66
|
// ============================================
|
|
39
67
|
export const passwordSchema = z
|