@mohasinac/appkit 4.13.1 → 4.15.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/layout/DashboardLayoutClient.js +14 -5
- package/dist/_internal/client/features/lottery/LotteryAdminEditView.d.ts +3 -0
- package/dist/_internal/client/features/lottery/LotteryAdminEditView.js +6 -0
- package/dist/_internal/client/features/lottery/LotteryDetailView.d.ts +8 -0
- package/dist/_internal/client/features/lottery/LotteryDetailView.js +4 -1
- package/dist/_internal/client/features/lottery/LotteryListView.d.ts +7 -0
- package/dist/_internal/client/features/lottery/LotteryListView.js +1 -1
- package/dist/_internal/client/features/lottery/PrizeDrawLotteryDetailView.js +4 -1
- package/dist/_internal/client/features/lottery/slot-collage-items.d.ts +15 -0
- package/dist/_internal/client/features/lottery/slot-collage-items.js +13 -0
- package/dist/_internal/server/features/auctions/actions.js +8 -2
- package/dist/_internal/server/features/bundles/data.d.ts +16 -0
- package/dist/_internal/server/features/bundles/data.js +26 -0
- package/dist/_internal/server/features/bundles/index.d.ts +1 -1
- package/dist/_internal/server/features/bundles/index.js +1 -1
- package/dist/_internal/server/features/cart/service.d.ts +3 -3
- package/dist/_internal/server/features/checkout/actions.js +25 -0
- package/dist/_internal/server/features/checkout/locked-lines.d.ts +38 -0
- package/dist/_internal/server/features/checkout/locked-lines.js +171 -0
- package/dist/_internal/server/features/checkout/source-context.d.ts +5 -0
- package/dist/_internal/server/features/checkout/source-context.js +157 -0
- package/dist/_internal/server/features/homepage/index.d.ts +0 -1
- package/dist/_internal/server/features/homepage/index.js +7 -1
- package/dist/_internal/server/features/lottery/adapters.js +4 -0
- package/dist/_internal/server/features/offers/adapters.d.ts +103 -0
- package/dist/_internal/server/features/offers/adapters.js +88 -0
- package/dist/_internal/server/features/offers/index.d.ts +2 -0
- package/dist/_internal/server/features/offers/index.js +1 -0
- package/dist/_internal/server/features/orders/adapters.js +24 -0
- package/dist/_internal/server/features/products/data.js +15 -37
- package/dist/_internal/server/features/products/index.d.ts +1 -1
- package/dist/_internal/server/features/products/index.js +1 -1
- package/dist/_internal/server/features/products/list-public.d.ts +46 -20
- package/dist/_internal/server/features/products/list-public.js +266 -90
- package/dist/_internal/server/features/products/listing-tab-counts.d.ts +44 -0
- package/dist/_internal/server/features/products/listing-tab-counts.js +97 -0
- package/dist/_internal/server/features/site-settings/adapters.d.ts +51 -0
- package/dist/_internal/server/features/site-settings/adapters.js +75 -0
- package/dist/_internal/server/features/site-settings/index.d.ts +1 -0
- package/dist/_internal/server/features/site-settings/index.js +1 -0
- package/dist/_internal/server/features/stores/adapters.d.ts +56 -0
- package/dist/_internal/server/features/stores/adapters.js +91 -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/jobs/core/auctionSettlement.js +56 -2
- package/dist/_internal/server/jobs/core/offerExpiry.js +55 -19
- package/dist/_internal/server/jobs/core/paymentReviewAutoApprove.d.ts +5 -0
- package/dist/_internal/server/jobs/core/paymentReviewAutoApprove.js +33 -1
- package/dist/_internal/server/jobs/handlers/messages.d.ts +7 -0
- package/dist/_internal/server/jobs/handlers/messages.js +10 -0
- package/dist/_internal/shared/actions/action-registry.js +17 -1
- package/dist/_internal/shared/checkout/lanes.d.ts +25 -0
- package/dist/_internal/shared/checkout/lanes.js +26 -0
- package/dist/_internal/shared/features/auctions/config.d.ts +27 -0
- package/dist/_internal/shared/features/auctions/config.js +27 -0
- package/dist/_internal/shared/features/auctions/schema.d.ts +14 -2
- package/dist/_internal/shared/features/auctions/schema.js +13 -1
- package/dist/_internal/shared/features/blog/schema.d.ts +2 -2
- package/dist/_internal/shared/features/cart/schema.d.ts +20 -15
- package/dist/_internal/shared/features/cart/schema.js +15 -0
- package/dist/_internal/shared/features/categories/bundle-schemas.d.ts +32 -32
- package/dist/_internal/shared/features/emi/schedule.d.ts +24 -3
- package/dist/_internal/shared/features/emi/schedule.js +20 -5
- package/dist/_internal/shared/features/events/schema.d.ts +2 -2
- package/dist/_internal/shared/features/homepage/section-gate.d.ts +14 -0
- package/dist/_internal/shared/features/homepage/section-gate.js +51 -0
- package/dist/_internal/shared/features/offers/config.d.ts +30 -0
- package/dist/_internal/shared/features/offers/config.js +59 -0
- package/dist/_internal/shared/features/orders/schema.d.ts +8 -8
- package/dist/_internal/shared/features/products/schema.d.ts +30 -30
- package/dist/_internal/shared/features/products/to-product-item.js +6 -0
- package/dist/_internal/shared/features/reviews/schema.d.ts +2 -2
- package/dist/_internal/shared/features/site-settings/fees.d.ts +60 -0
- package/dist/_internal/shared/features/site-settings/fees.js +39 -0
- package/dist/_internal/shared/features/site-settings/types.d.ts +40 -0
- package/dist/_internal/shared/features/site-settings/types.js +1 -0
- package/dist/_internal/shared/history/history.d.ts +88 -0
- package/dist/_internal/shared/history/history.js +198 -0
- package/dist/_internal/shared/history/index.d.ts +4 -0
- package/dist/_internal/shared/history/index.js +2 -0
- package/dist/_internal/shared/history/types.d.ts +61 -0
- package/dist/_internal/shared/history/types.js +6 -0
- package/dist/_internal/shared/listing-types/_registry.d.ts +54 -1
- package/dist/_internal/shared/listing-types/_registry.js +67 -0
- package/dist/_internal/shared/listing-types/art/config.d.ts +3 -0
- package/dist/_internal/shared/listing-types/art/config.js +5 -0
- package/dist/_internal/shared/listing-types/auction/config.d.ts +13 -0
- package/dist/_internal/shared/listing-types/auction/config.js +21 -0
- package/dist/_internal/shared/listing-types/availability.d.ts +79 -0
- package/dist/_internal/shared/listing-types/availability.js +104 -0
- package/dist/_internal/shared/listing-types/capabilities.d.ts +15 -0
- package/dist/_internal/shared/listing-types/capabilities.js +12 -0
- package/dist/_internal/shared/listing-types/classified/config.d.ts +3 -0
- package/dist/_internal/shared/listing-types/classified/config.js +5 -0
- package/dist/_internal/shared/listing-types/digital-code/config.d.ts +11 -0
- package/dist/_internal/shared/listing-types/digital-code/config.js +22 -2
- package/dist/_internal/shared/listing-types/live/config.d.ts +3 -0
- package/dist/_internal/shared/listing-types/live/config.js +5 -0
- package/dist/_internal/shared/listing-types/pre-order/config.d.ts +3 -0
- package/dist/_internal/shared/listing-types/pre-order/config.js +19 -0
- package/dist/_internal/shared/listing-types/prize-draw/config.d.ts +11 -0
- package/dist/_internal/shared/listing-types/prize-draw/config.js +15 -0
- package/dist/_internal/shared/listing-types/standard/config.d.ts +3 -0
- package/dist/_internal/shared/listing-types/standard/config.js +5 -0
- package/dist/_internal/shared/listing-types/stickers/config.d.ts +3 -0
- package/dist/_internal/shared/listing-types/stickers/config.js +5 -0
- package/dist/client.d.ts +20 -7
- package/dist/client.js +22 -4
- package/dist/constants/api-endpoints.d.ts +6 -0
- package/dist/constants/api-endpoints.js +2 -0
- package/dist/constants/field-names.d.ts +57 -8
- package/dist/constants/field-names.js +101 -8
- package/dist/constants/table-keys.d.ts +17 -0
- package/dist/constants/table-keys.js +17 -0
- package/dist/errors/error-codes.d.ts +13 -1
- package/dist/errors/error-codes.js +13 -1
- package/dist/errors/error-display-map.js +12 -3
- package/dist/errors/messages.d.ts +10 -2
- package/dist/errors/messages.js +10 -2
- package/dist/features/about/components/AboutView.d.ts +3 -0
- package/dist/features/about/components/AboutView.js +3 -2
- package/dist/features/about/components/PolicyPageView.d.ts +2 -1
- package/dist/features/about/components/PolicyPageView.js +61 -23
- package/dist/features/about/components/PublicProfileView.js +5 -0
- package/dist/features/about/schemas/firestore.d.ts +3 -0
- package/dist/features/account/components/UserBidsView.js +12 -4
- package/dist/features/account/components/UserOrdersView.js +7 -0
- package/dist/features/account/components/UserReturnsView.d.ts +3 -0
- package/dist/features/account/components/UserReturnsView.js +17 -1
- package/dist/features/account/components/index.d.ts +0 -2
- package/dist/features/account/components/index.js +0 -1
- package/dist/features/account/schemas/index.d.ts +2 -2
- package/dist/features/account/types/index.d.ts +21 -2
- package/dist/features/addresses/schemas/index.d.ts +4 -4
- package/dist/features/admin/components/AdminArtView.js +8 -3
- package/dist/features/admin/components/AdminAuditLogView.js +1 -0
- package/dist/features/admin/components/AdminBidsView.js +15 -2
- package/dist/features/admin/components/AdminBlogEditorView.js +65 -33
- package/dist/features/admin/components/AdminClassifiedView.js +8 -3
- package/dist/features/admin/components/AdminDigitalCodesView.js +8 -3
- package/dist/features/admin/components/AdminFeatureEditorView.js +35 -6
- package/dist/features/admin/components/AdminFeatureFlagsView.js +1 -0
- package/dist/features/admin/components/AdminLiveView.js +8 -3
- package/dist/features/admin/components/AdminNavEditorView.js +15 -5
- package/dist/features/admin/components/AdminNewsletterView.js +18 -2
- package/dist/features/admin/components/AdminOffersView.d.ts +4 -0
- package/dist/features/admin/components/AdminOffersView.js +230 -0
- package/dist/features/admin/components/AdminOrdersView.js +10 -1
- package/dist/features/admin/components/AdminPaymentMethodsView.js +24 -4
- package/dist/features/admin/components/AdminPrizeDrawsView.js +5 -0
- package/dist/features/admin/components/AdminProductsView.js +16 -29
- package/dist/features/admin/components/AdminScammerEditorView.d.ts +2 -1
- package/dist/features/admin/components/AdminScammerEditorView.js +3 -13
- package/dist/features/admin/components/AdminScammersView.js +3 -8
- package/dist/features/admin/components/AdminSectionsView.js +32 -23
- package/dist/features/admin/components/AdminSessionsView.js +17 -2
- package/dist/features/admin/components/AdminSiteSettingsView.js +31 -13
- package/dist/features/admin/components/AdminSiteView.js +6 -2
- package/dist/features/admin/components/AdminStickersView.js +8 -3
- package/dist/features/admin/components/ViewAuditLogEntryModal.js +1 -0
- 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.d.ts +4 -2
- package/dist/features/admin/components/sections/adminSectionsTypes.js +45 -27
- package/dist/features/admin/constants/filter-tabs.d.ts +89 -0
- package/dist/features/admin/constants/filter-tabs.js +56 -0
- package/dist/features/admin/schemas/firestore.d.ts +122 -3
- package/dist/features/admin/schemas/firestore.js +1 -0
- package/dist/features/admin/schemas/homepage-section-form.d.ts +22 -0
- package/dist/features/admin/schemas/homepage-section-form.js +68 -0
- package/dist/features/admin/schemas/nav-item-form.d.ts +74 -0
- package/dist/features/admin/schemas/nav-item-form.js +72 -0
- package/dist/features/auctions/actions/bid-actions.d.ts +20 -5
- package/dist/features/auctions/actions/bid-actions.js +93 -20
- package/dist/features/auctions/components/AuctionBidsTable.d.ts +10 -1
- package/dist/features/auctions/components/AuctionBidsTable.js +22 -4
- package/dist/features/auctions/components/AuctionDetailPageView.js +11 -6
- package/dist/features/auctions/components/AuctionsListView.js +5 -6
- package/dist/features/auctions/components/MarketplaceAuctionCard.d.ts +7 -0
- package/dist/features/auctions/components/MarketplaceAuctionCard.js +19 -2
- package/dist/features/auctions/components/PlaceBidFormClient.d.ts +1 -2
- package/dist/features/auctions/components/PlaceBidFormClient.js +8 -4
- package/dist/features/auctions/components/bid-detail-fields.d.ts +29 -0
- package/dist/features/auctions/components/bid-detail-fields.js +103 -0
- package/dist/features/auctions/repository/bid.repository.d.ts +13 -0
- package/dist/features/auctions/repository/bid.repository.js +23 -0
- package/dist/features/auctions/schemas/firestore.d.ts +17 -0
- package/dist/features/auctions/schemas/index.d.ts +12 -12
- package/dist/features/audit-log/schemas/firestore.d.ts +14 -0
- package/dist/features/audit-log/schemas/firestore.js +7 -0
- package/dist/features/auth/permissions/constants.d.ts +1 -1
- package/dist/features/auth/permissions/constants.js +10 -1
- package/dist/features/blog/actions/blog-actions.d.ts +7 -7
- package/dist/features/blog/schemas/blog-form.d.ts +80 -0
- package/dist/features/blog/schemas/blog-form.js +100 -0
- package/dist/features/blog/schemas/index.d.ts +6 -6
- package/dist/features/cart/repository/cart.repository.js +1 -0
- package/dist/features/cart/schemas/firestore.d.ts +15 -0
- package/dist/features/catalogue/schemas/validation.d.ts +4 -4
- package/dist/features/categories/components/BrandDetailPageView.js +23 -40
- package/dist/features/categories/components/BrandDetailTabs.d.ts +7 -7
- package/dist/features/categories/components/BrandDetailTabs.js +8 -12
- package/dist/features/categories/components/BundleCollage.js +1 -1
- package/dist/features/categories/components/CategoryDetailPageView.js +53 -57
- package/dist/features/categories/components/CategoryDetailTabs.d.ts +10 -8
- package/dist/features/categories/components/CategoryDetailTabs.js +11 -16
- package/dist/features/categories/components/CategoryProductsListing.js +11 -1
- package/dist/features/categories/components/ConcernCard.js +7 -1
- package/dist/features/categories/schemas/firestore.d.ts +13 -0
- package/dist/features/categories/schemas/index.d.ts +26 -26
- package/dist/features/classified/components/ClassifiedDetailPageView.d.ts +16 -1
- package/dist/features/classified/components/ClassifiedDetailPageView.js +23 -3
- package/dist/features/events/components/AdminEventEditorView.js +32 -54
- package/dist/features/events/components/AdminEventEntriesView.js +22 -3
- package/dist/features/events/components/AdminEventsView.js +15 -11
- package/dist/features/events/components/EventFilters.d.ts +9 -1
- package/dist/features/events/components/EventFilters.js +45 -21
- package/dist/features/events/components/EventsIndexListing.d.ts +6 -1
- package/dist/features/events/components/EventsIndexListing.js +2 -2
- package/dist/features/events/components/EventsListPageView.js +13 -4
- package/dist/features/events/repository/events.repository.d.ts +17 -0
- package/dist/features/events/repository/events.repository.js +27 -0
- package/dist/features/events/schemas/event-form.d.ts +113 -0
- package/dist/features/events/schemas/event-form.js +82 -0
- package/dist/features/events/schemas/firestore.d.ts +12 -0
- package/dist/features/events/schemas/firestore.js +12 -0
- package/dist/features/events/schemas/index.d.ts +50 -50
- package/dist/features/events/types/index.d.ts +11 -0
- package/dist/features/events/types/index.js +57 -1
- package/dist/features/faq/actions/faq-actions.d.ts +12 -12
- package/dist/features/faq/schemas/index.d.ts +8 -8
- package/dist/features/filters/FilterFacetSection.d.ts +7 -1
- package/dist/features/filters/FilterFacetSection.js +11 -3
- package/dist/features/grouped/schemas/grouped-listing-form.d.ts +101 -0
- package/dist/features/grouped/schemas/grouped-listing-form.js +89 -0
- package/dist/features/grouped/schemas/index.d.ts +4 -4
- package/dist/features/homepage/actions/homepage-section-actions.d.ts +11 -3
- package/dist/features/homepage/actions/homepage-section-actions.js +33 -1
- package/dist/features/homepage/components/AnnouncementBar.d.ts +7 -1
- package/dist/features/homepage/components/AnnouncementBar.js +3 -3
- package/dist/features/homepage/components/MarketplaceHomepageView.js +20 -6
- package/dist/features/homepage/hooks/homepage-query.d.ts +16 -0
- package/dist/features/homepage/hooks/homepage-query.js +45 -0
- package/dist/features/homepage/hooks/useFeaturedAuctions.d.ts +10 -0
- package/dist/features/homepage/hooks/useFeaturedAuctions.js +28 -8
- package/dist/features/homepage/hooks/useFeaturedPreOrders.js +17 -8
- package/dist/features/homepage/hooks/useFeaturedProducts.js +15 -8
- package/dist/features/homepage/schemas/index.d.ts +33 -2
- package/dist/features/homepage/schemas/index.js +24 -0
- package/dist/features/layout/AppLayoutShell.d.ts +11 -1
- package/dist/features/layout/AppLayoutShell.js +15 -14
- package/dist/features/layout/BackToTop.d.ts +9 -0
- package/dist/features/layout/BackToTop.js +10 -1
- package/dist/features/layout/BottomActions.js +28 -25
- package/dist/features/layout/BottomChrome.d.ts +34 -0
- package/dist/features/layout/BottomChrome.js +55 -0
- package/dist/features/layout/BottomNavLayout.d.ts +6 -0
- package/dist/features/layout/BottomNavLayout.js +7 -1
- package/dist/features/layout/BottomNavbar.js +15 -2
- package/dist/features/layout/FooterLayout.js +11 -1
- package/dist/features/layout/NavbarLayout.js +1 -1
- package/dist/features/layout/TitleBarLayout.d.ts +7 -0
- package/dist/features/layout/TitleBarLayout.js +28 -5
- package/dist/features/layout/index.d.ts +2 -0
- package/dist/features/layout/index.js +1 -0
- package/dist/features/lottery/types/index.d.ts +3 -0
- package/dist/features/media/MediaPickerModal.js +5 -1
- package/dist/features/messages/schemas/index.d.ts +2 -2
- package/dist/features/orders/components/OrderScopeTabs.d.ts +20 -0
- package/dist/features/orders/components/OrderScopeTabs.js +31 -0
- package/dist/features/orders/components/OrderStatusTimeline.d.ts +5 -1
- package/dist/features/orders/components/OrderStatusTimeline.js +39 -20
- package/dist/features/orders/constants/order-scope.d.ts +48 -0
- package/dist/features/orders/constants/order-scope.js +111 -0
- package/dist/features/orders/repository/orders.repository.d.ts +54 -7
- package/dist/features/orders/repository/orders.repository.js +121 -22
- package/dist/features/orders/schemas/firestore.d.ts +152 -0
- package/dist/features/orders/schemas/firestore.js +30 -0
- package/dist/features/orders/schemas/index.d.ts +18 -18
- package/dist/features/orders/types/index.d.ts +35 -7
- package/dist/features/pre-orders/components/PreOrdersIndexListing.js +14 -9
- package/dist/features/pre-orders/components/PreOrdersListView.js +6 -5
- package/dist/features/pre-orders/schemas/index.d.ts +1 -1
- package/dist/features/products/actions/product-actions.d.ts +14 -0
- package/dist/features/products/actions/product-actions.js +49 -11
- package/dist/features/products/api/route.d.ts +12 -0
- package/dist/features/products/api/route.js +42 -100
- package/dist/features/products/components/ArtStickersListView.js +2 -2
- package/dist/features/products/components/AuctionsIndexListing.js +13 -11
- package/dist/features/products/components/AvailabilityTabs.d.ts +11 -0
- package/dist/features/products/components/AvailabilityTabs.js +47 -0
- package/dist/features/products/components/GroupSettingsPanel.js +5 -1
- package/dist/features/products/components/MakeOfferButton.js +48 -49
- package/dist/features/products/components/PrizeDrawCollage.d.ts +20 -4
- package/dist/features/products/components/PrizeDrawCollage.js +9 -1
- package/dist/features/products/components/PrizeDrawsIndexListing.js +14 -12
- package/dist/features/products/components/PrizeDrawsListingView.js +2 -2
- package/dist/features/products/components/PrizeDrawsSection.d.ts +7 -1
- package/dist/features/products/components/PrizeDrawsSection.js +23 -18
- package/dist/features/products/components/ProductDetailPageView.d.ts +4 -1
- package/dist/features/products/components/ProductDetailPageView.js +18 -4
- package/dist/features/products/components/ProductForm.js +5 -2
- package/dist/features/products/components/ProductGrid.js +6 -1
- package/dist/features/products/components/ProductsIndexListing.js +22 -32
- package/dist/features/products/components/ProductsIndexPageView.js +6 -9
- package/dist/features/products/components/index.d.ts +2 -2
- package/dist/features/products/components/index.js +1 -1
- package/dist/features/products/config/listing-type-listing-config.d.ts +20 -0
- package/dist/features/products/config/listing-type-listing-config.js +22 -10
- package/dist/features/products/constants/action-defs.d.ts +2 -0
- package/dist/features/products/constants/action-defs.js +6 -0
- package/dist/features/products/hooks/useAvailabilityScope.d.ts +13 -0
- package/dist/features/products/hooks/useAvailabilityScope.js +19 -0
- package/dist/features/products/hooks/useProducts.d.ts +5 -0
- package/dist/features/products/hooks/useProducts.js +13 -2
- package/dist/features/products/repository/products.repository.d.ts +31 -2
- package/dist/features/products/repository/products.repository.js +53 -21
- package/dist/features/products/schemas/firestore.d.ts +17 -3
- package/dist/features/products/schemas/firestore.js +7 -2
- package/dist/features/products/schemas/index.d.ts +64 -64
- package/dist/features/products/schemas/product-features.validators.d.ts +79 -6
- package/dist/features/products/schemas/product-features.validators.js +63 -0
- package/dist/features/products/types/index.d.ts +16 -1
- package/dist/features/promotions/schemas/index.d.ts +2 -2
- package/dist/features/reviews/schemas/index.d.ts +16 -16
- package/dist/features/scams/constants/scammer-status-display.d.ts +28 -0
- package/dist/features/scams/constants/scammer-status-display.js +79 -0
- package/dist/features/search/schemas/index.d.ts +4 -4
- package/dist/features/seller/actions/offer-actions.js +57 -4
- package/dist/features/seller/components/OfferPhaseTimeline.d.ts +59 -0
- package/dist/features/seller/components/OfferPhaseTimeline.js +107 -0
- package/dist/features/seller/components/SellerArtView.js +5 -0
- package/dist/features/seller/components/SellerAuctionsView.js +13 -15
- package/dist/features/seller/components/SellerBidsView.js +11 -4
- package/dist/features/seller/components/SellerClassifiedView.js +5 -0
- package/dist/features/seller/components/SellerCouponEditorView.js +17 -17
- package/dist/features/seller/components/SellerDigitalCodesView.js +5 -0
- package/dist/features/seller/components/SellerLiveView.js +5 -0
- package/dist/features/seller/components/SellerOffersView.js +2 -1
- package/dist/features/seller/components/SellerOrdersView.js +31 -9
- package/dist/features/seller/components/SellerPayoutSettingsView.js +56 -31
- package/dist/features/seller/components/SellerPreOrdersView.js +5 -0
- package/dist/features/seller/components/SellerPrizeDrawsView.js +14 -16
- package/dist/features/seller/components/SellerProductShell.js +7 -1
- package/dist/features/seller/components/SellerProductsView.js +11 -8
- package/dist/features/seller/components/SellerStickersView.js +5 -0
- package/dist/features/seller/components/index.d.ts +0 -2
- package/dist/features/seller/components/index.js +0 -1
- package/dist/features/seller/repository/offer.repository.d.ts +142 -24
- package/dist/features/seller/repository/offer.repository.js +165 -26
- package/dist/features/seller/schemas/coupon-form.d.ts +72 -0
- package/dist/features/seller/schemas/coupon-form.js +116 -0
- package/dist/features/seller/schemas/firestore.d.ts +56 -2
- package/dist/features/seller/schemas/firestore.js +27 -0
- package/dist/features/seller/schemas/index.d.ts +2 -2
- package/dist/features/seller/schemas/offer-forms.d.ts +46 -0
- package/dist/features/seller/schemas/offer-forms.js +42 -0
- package/dist/features/seller/server.d.ts +0 -1
- package/dist/features/seller/server.js +0 -1
- package/dist/features/shell/SectionForm.d.ts +99 -0
- package/dist/features/shell/SectionForm.js +128 -0
- package/dist/features/shell/build-sections.d.ts +63 -0
- package/dist/features/shell/build-sections.js +207 -0
- package/dist/features/shell/entity-form.d.ts +109 -0
- package/dist/features/shell/entity-form.js +96 -0
- package/dist/features/shell/field-ui-meta.d.ts +115 -0
- package/dist/features/shell/field-ui-meta.js +324 -0
- package/dist/features/shell/index.d.ts +8 -0
- package/dist/features/shell/index.js +4 -0
- package/dist/features/status-history/components/StatusTimeline.d.ts +74 -0
- package/dist/features/status-history/components/StatusTimeline.js +46 -0
- package/dist/features/status-history/index.d.ts +11 -0
- package/dist/features/status-history/index.js +10 -0
- package/dist/features/store-extensions/components/ReviewDecisionModal.d.ts +27 -0
- package/dist/features/store-extensions/components/ReviewDecisionModal.js +82 -0
- package/dist/features/store-extensions/index.d.ts +12 -0
- package/dist/features/store-extensions/index.js +12 -0
- package/dist/features/store-extensions/schemas/admin-notification-form.d.ts +36 -0
- package/dist/features/store-extensions/schemas/admin-notification-form.js +114 -0
- package/dist/features/store-extensions/schemas/analytics-forms.d.ts +57 -0
- package/dist/features/store-extensions/schemas/analytics-forms.js +158 -0
- package/dist/features/store-extensions/schemas/custom-role-form.d.ts +85 -0
- package/dist/features/store-extensions/schemas/custom-role-form.js +118 -0
- package/dist/features/store-extensions/schemas/firestore.d.ts +21 -1
- package/dist/features/store-extensions/schemas/firestore.js +60 -0
- package/dist/features/store-extensions/schemas/google-config-form.d.ts +53 -0
- package/dist/features/store-extensions/schemas/google-config-form.js +105 -0
- package/dist/features/store-extensions/schemas/item-request-create-form.d.ts +28 -0
- package/dist/features/store-extensions/schemas/item-request-create-form.js +80 -0
- package/dist/features/store-extensions/schemas/listing-template-form.d.ts +78 -0
- package/dist/features/store-extensions/schemas/listing-template-form.js +87 -0
- package/dist/features/store-extensions/schemas/moderation-review-form.d.ts +49 -0
- package/dist/features/store-extensions/schemas/moderation-review-form.js +101 -0
- package/dist/features/store-extensions/schemas/payout-method-form.d.ts +153 -0
- package/dist/features/store-extensions/schemas/payout-method-form.js +155 -0
- package/dist/features/store-extensions/schemas/report-create-form.d.ts +25 -0
- package/dist/features/store-extensions/schemas/report-create-form.js +79 -0
- package/dist/features/store-extensions/schemas/report-review-form.d.ts +47 -0
- package/dist/features/store-extensions/schemas/report-review-form.js +111 -0
- package/dist/features/store-extensions/schemas/shipping-config-form.d.ts +148 -0
- package/dist/features/store-extensions/schemas/shipping-config-form.js +104 -0
- package/dist/features/store-extensions/schemas/store-category-form.d.ts +54 -0
- package/dist/features/store-extensions/schemas/store-category-form.js +73 -0
- package/dist/features/stores/api/[storeSlug]/route.js +2 -25
- package/dist/features/stores/components/StoreAuctionsListing.js +15 -1
- package/dist/features/stores/components/StoreClassifiedsListing.js +12 -2
- package/dist/features/stores/components/StoreDetailLayoutView.js +24 -71
- package/dist/features/stores/components/StoreDigitalCodesListing.js +12 -2
- package/dist/features/stores/components/StoreLiveItemsListing.js +12 -2
- package/dist/features/stores/components/StorePreOrdersListing.js +12 -1
- package/dist/features/stores/components/StoreProductsListing.js +11 -1
- package/dist/features/stores/repository/store.repository.js +6 -0
- package/dist/features/stores/schemas/index.d.ts +6 -6
- package/dist/features/support/schemas/index.d.ts +4 -4
- package/dist/features/tester/actions/checklist-item-actions.d.ts +4 -4
- package/dist/features/tester/seed-data/offers-tester-seed-data.js +119 -3
- package/dist/features/tester/seed-data/products-tester-seed-data.js +131 -1
- package/dist/features/tester/seed-data/tester-checklist-seed-data.js +431 -1
- package/dist/features/wishlist/hooks/useWishlistWithGuest.d.ts +1 -1
- package/dist/index.d.ts +25 -12
- package/dist/index.js +26 -11
- package/dist/next/routing/route-map.d.ts +23 -3
- package/dist/next/routing/route-map.js +14 -2
- package/dist/providers/db-firebase/base.repository.d.ts +30 -0
- package/dist/providers/db-firebase/base.repository.js +50 -1
- package/dist/providers/db-firebase/index.d.ts +1 -1
- package/dist/providers/db-firebase/index.js +1 -1
- package/dist/providers/db-firebase/sieve.d.ts +25 -0
- package/dist/providers/db-firebase/sieve.js +52 -18
- package/dist/react/hooks/useUrlTable.js +10 -1
- package/dist/schemas/firestore-value.d.ts +8 -0
- package/dist/schemas/firestore-value.js +44 -0
- package/dist/schemas/index.d.ts +1 -1
- package/dist/schemas/index.js +1 -1
- package/dist/schemas/registry.d.ts +702 -69
- package/dist/schemas/registry.js +64 -1
- package/dist/seed/_helpers/category-forest.d.ts +2 -0
- package/dist/seed/_helpers/category-forest.js +309 -0
- package/dist/seed/_helpers/category-tree.d.ts +27 -0
- package/dist/seed/_helpers/category-tree.js +103 -0
- package/dist/seed/bids-seed-data.js +30 -0
- package/dist/seed/catalogue-seed-data.js +12 -12
- package/dist/seed/categories-seed-data.js +177 -162
- package/dist/seed/events-seed-data.js +61 -10
- package/dist/seed/homepage-sections-seed-data.js +5 -1
- package/dist/seed/offers-seed-data.js +244 -34
- package/dist/seed/orders-seed-data.js +336 -1
- package/dist/seed/products-art-seed-data.js +50 -12
- package/dist/seed/products-auctions-seed-data.js +138 -18
- package/dist/seed/products-classifieds-seed-data.js +80 -16
- package/dist/seed/products-digital-codes-seed-data.js +66 -18
- package/dist/seed/products-live-items-seed-data.js +64 -13
- package/dist/seed/products-preorders-seed-data.d.ts +0 -1
- package/dist/seed/products-preorders-seed-data.js +52 -13
- package/dist/seed/products-prize-draws-seed-data.js +63 -14
- package/dist/seed/products-standard-seed-data.js +99 -26
- package/dist/seed/products-stickers-seed-data.js +47 -12
- package/dist/seed/reviews-seed-data.js +6 -1
- package/dist/seed/site-settings-seed-data.d.ts +1 -38
- package/dist/seed/site-settings-seed-data.js +38 -76
- package/dist/seed/stores-seed-data.js +71 -1
- package/dist/seed/users-seed-data.js +15 -5
- package/dist/server-entry.d.ts +1 -2
- package/dist/server-entry.js +4 -3
- package/dist/server.d.ts +6 -3
- package/dist/server.js +13 -4
- package/dist/styles.css +78 -12
- package/dist/tailwind-utilities.css +1 -1
- package/dist/ui/components/Button.style.css +19 -4
- package/dist/ui/components/CollapsibleSection.d.ts +17 -1
- package/dist/ui/components/CollapsibleSection.js +6 -2
- package/dist/ui/components/FilterChipGroup.d.ts +25 -1
- package/dist/ui/components/FilterChipGroup.js +21 -4
- package/dist/ui/components/HandMode.style.css +47 -0
- package/dist/ui/components/Layout.d.ts +9 -2
- package/dist/ui/components/Layout.js +1 -1
- package/dist/ui/components/ListingLayout.js +8 -8
- package/dist/ui/components/ListingLayout.style.css +8 -7
- package/dist/ui/components/RecordDetailModal.d.ts +10 -1
- package/dist/ui/components/RecordDetailModal.js +2 -2
- package/dist/ui/components/StickyToolbar.d.ts +3 -1
- package/dist/ui/components/StickyToolbar.js +62 -20
- package/dist/ui/components/bottom-chrome-slot.d.ts +21 -0
- package/dist/ui/components/bottom-chrome-slot.js +29 -0
- package/dist/ui/components/index.style.css +3 -0
- package/dist/ui/forms/FormShell.d.ts +43 -13
- package/dist/ui/forms/FormShell.js +22 -11
- package/dist/ui/forms/index.d.ts +1 -1
- package/dist/ui/index.d.ts +1 -1
- package/package.json +2 -1
- package/scripts/node-esm-loader.mjs +65 -0
- package/scripts/seed-cli-loader.mjs +6 -49
- package/scripts/seed-cli.mjs +1 -1
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* WHY: Which section a field belongs to, and whether it shares a row with its
|
|
3
|
+
* neighbour, were conventions written in a table in a plan document. A
|
|
4
|
+
* convention drifts; 70 bare `grid-cols-2` in the tree — each one two
|
|
5
|
+
* columns wide at 320px — are what that drift looks like. Zod 4 lets the
|
|
6
|
+
* rule live on the field it describes, so the schema becomes the single
|
|
7
|
+
* source of validation, section membership AND layout.
|
|
8
|
+
* WHAT: `FieldUiMeta`, the typed `ui` registry, and `inferFieldUiMeta` — the
|
|
9
|
+
* heuristic that means only `section` has to be stated per field.
|
|
10
|
+
*
|
|
11
|
+
* ## 🛑 There are TWO zods in this repo, and that decided the design
|
|
12
|
+
*
|
|
13
|
+
* Measured 2026-08-24: the app depends on **zod 4.4.3**, but `appkit`'s own
|
|
14
|
+
* `package.json` declares `zod: ^3.24.0` and a v3 copy is nested at
|
|
15
|
+
* `node_modules/@mohasinac/appkit/node_modules/zod` (3.25.76). Verified with
|
|
16
|
+
* `createRequire`: appkit's shipped `dist` resolves `"zod"` to that nested v3,
|
|
17
|
+
* while consumer code resolves to root v4. Two instances, one bundle — the
|
|
18
|
+
* Root Cause #19 shape, on a package the dedupe script does not cover.
|
|
19
|
+
*
|
|
20
|
+
* So `z.registry<FieldUiMeta>()` is **not usable here**: it is a zod-4 API and
|
|
21
|
+
* appkit compiles against v3. Aligning the two is a dependency major across
|
|
22
|
+
* the 76 appkit files that import zod — its own wave, not a drive-by inside a
|
|
23
|
+
* spine wave.
|
|
24
|
+
*
|
|
25
|
+
* This registry is therefore a plain `WeakMap` keyed by schema instance, which
|
|
26
|
+
* is what `z.registry()` is internally. It behaves identically, works on both
|
|
27
|
+
* majors, and is strictly MORE robust to the split: object identity does not
|
|
28
|
+
* care which zod class produced the object. `annotate()` is typed, so a typo
|
|
29
|
+
* (`rows:` for `row:`) is a compile error — the property `.meta()` never had.
|
|
30
|
+
*
|
|
31
|
+
* Everything that introspects a schema below reads BOTH shapes for the same
|
|
32
|
+
* reason: zod 3 says `_def.typeName === "ZodOptional"`, zod 4 says
|
|
33
|
+
* `_def.type === "optional"`, and this file sees both at runtime.
|
|
34
|
+
*
|
|
35
|
+
* ## 🛑 The ordering trap — metadata MUST be the last call in the chain
|
|
36
|
+
*
|
|
37
|
+
* Verified at runtime:
|
|
38
|
+
*
|
|
39
|
+
* annotate(z.string(), {...}).optional() // ✗ meta LOST → lookup undefined
|
|
40
|
+
* annotate(z.string().optional(), {...}) // ✓ survives
|
|
41
|
+
*
|
|
42
|
+
* Every wrapper (`.optional()`, `.nullable()`, `.default()`, `.catch()`)
|
|
43
|
+
* returns a NEW schema instance, and the registry is keyed by instance. Most
|
|
44
|
+
* fields are optional, so getting this backwards silently drops layout for the
|
|
45
|
+
* majority of them. `audit-field-ui-meta` enforces the ordering.
|
|
46
|
+
*
|
|
47
|
+
* EXPORTS:
|
|
48
|
+
* FieldUiMeta, FieldRow, FieldKind, CalculatedTier, ui, annotate,
|
|
49
|
+
* inferFieldUiMeta, resolveFieldUiMeta, unwrapSchema, ROW_COLUMNS
|
|
50
|
+
*
|
|
51
|
+
* @tag domain:forms
|
|
52
|
+
* @tag layer:shared
|
|
53
|
+
* @tag pattern:registry
|
|
54
|
+
* @tag access:isomorphic
|
|
55
|
+
* @tag consumers:buildSectionsFromSchema,audit-field-ui-meta
|
|
56
|
+
* @tag sideEffects:none
|
|
57
|
+
*/
|
|
58
|
+
/**
|
|
59
|
+
* The registry. A module-level singleton, because the whole point is that
|
|
60
|
+
* every form schema in the app annotates into the same place and can be
|
|
61
|
+
* queried as one ("every media field", "every quick field", "every field with
|
|
62
|
+
* no section").
|
|
63
|
+
*
|
|
64
|
+
* `WeakMap` so annotating a schema never keeps it alive.
|
|
65
|
+
*/
|
|
66
|
+
const REGISTRY = new WeakMap();
|
|
67
|
+
export const ui = {
|
|
68
|
+
/** Attach metadata to a schema instance. Returns the SAME instance. */
|
|
69
|
+
add(schema, meta) {
|
|
70
|
+
REGISTRY.set(schema, meta);
|
|
71
|
+
return schema;
|
|
72
|
+
},
|
|
73
|
+
get(schema) {
|
|
74
|
+
return REGISTRY.get(schema);
|
|
75
|
+
},
|
|
76
|
+
has(schema) {
|
|
77
|
+
return REGISTRY.has(schema);
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Annotate a field. **Must be the outermost call in the chain** — see the
|
|
82
|
+
* ordering trap in the header.
|
|
83
|
+
*
|
|
84
|
+
* name: annotate(z.string().min(1), { section: "basics", quick: true }),
|
|
85
|
+
* photo: annotate(z.string().optional(), { section: "media" }),
|
|
86
|
+
*
|
|
87
|
+
* Wrapping the call rather than chaining off it (`.register()`-style) is
|
|
88
|
+
* deliberate: it puts the schema visually INSIDE the annotation, so appending
|
|
89
|
+
* `.optional()` afterwards looks as wrong as it is.
|
|
90
|
+
*/
|
|
91
|
+
export function annotate(schema, meta) {
|
|
92
|
+
return ui.add(schema, meta);
|
|
93
|
+
}
|
|
94
|
+
/** `row` → the `<FormGroup columns>` value it packs into. */
|
|
95
|
+
export const ROW_COLUMNS = {
|
|
96
|
+
full: 1,
|
|
97
|
+
pair: 2,
|
|
98
|
+
third: 3,
|
|
99
|
+
quarter: 4,
|
|
100
|
+
};
|
|
101
|
+
// ---------------------------------------------------------------------------
|
|
102
|
+
// Inference
|
|
103
|
+
// ---------------------------------------------------------------------------
|
|
104
|
+
/**
|
|
105
|
+
* Normalise a zod type discriminator across majors.
|
|
106
|
+
* zod 3: `_def.typeName === "ZodOptional"` · zod 4: `_def.type === "optional"`.
|
|
107
|
+
*/
|
|
108
|
+
function typeOf(schema) {
|
|
109
|
+
const def = schema._def;
|
|
110
|
+
if (def?.type)
|
|
111
|
+
return def.type; // v4, already lowercase
|
|
112
|
+
const name = def?.typeName; // v3, "ZodOptional"
|
|
113
|
+
return name ? name.replace(/^Zod/, "").toLowerCase() : "";
|
|
114
|
+
}
|
|
115
|
+
/** Wrappers that produce a new instance around an inner type. */
|
|
116
|
+
const WRAPPERS = new Set(["optional", "nullable", "default", "catch", "readonly", "nonoptional"]);
|
|
117
|
+
/**
|
|
118
|
+
* Strip `.optional()` / `.nullable()` / `.default()` / `.catch()` to reach the
|
|
119
|
+
* type that actually decides the control. Returns the innermost schema and its
|
|
120
|
+
* normalised type discriminator.
|
|
121
|
+
*
|
|
122
|
+
* Reads `_def` because zod exposes no public accessor for this, on either
|
|
123
|
+
* major. Depth-bounded rather than trusting the shape: `_def` is internal, and
|
|
124
|
+
* this must degrade to "text" rather than loop if a future zod reshapes it.
|
|
125
|
+
*/
|
|
126
|
+
export function unwrapSchema(schema) {
|
|
127
|
+
let current = schema;
|
|
128
|
+
for (let depth = 0; depth < 10; depth++) {
|
|
129
|
+
const def = current._def;
|
|
130
|
+
const type = typeOf(current);
|
|
131
|
+
if (!WRAPPERS.has(type) || !def?.innerType)
|
|
132
|
+
return { schema: current, type };
|
|
133
|
+
current = def.innerType;
|
|
134
|
+
}
|
|
135
|
+
return { schema: current, type: "" };
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* The `max()` bound on a string schema, when it declares one — the signal that
|
|
139
|
+
* separates a text input from a textarea.
|
|
140
|
+
*
|
|
141
|
+
* The two majors store checks completely differently:
|
|
142
|
+
* v3: `_def.checks = [{ kind: "max", value: 300 }]`
|
|
143
|
+
* v4: `_def.checks = [{ _zod: { def: { check: "max_length", maximum: 300 } } }]`
|
|
144
|
+
*/
|
|
145
|
+
function stringMaxLength(schema) {
|
|
146
|
+
const checks = schema._def?.checks;
|
|
147
|
+
if (!Array.isArray(checks))
|
|
148
|
+
return undefined;
|
|
149
|
+
for (const check of checks) {
|
|
150
|
+
const v4 = check?._zod?.def;
|
|
151
|
+
if (v4?.check === "max_length" && typeof v4.maximum === "number")
|
|
152
|
+
return v4.maximum;
|
|
153
|
+
const v3 = check;
|
|
154
|
+
if (v3?.kind === "max" && typeof v3.value === "number")
|
|
155
|
+
return v3.value;
|
|
156
|
+
}
|
|
157
|
+
return undefined;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Enum members. v4 exposes `.options`; v3 keeps them on `_def.values`, and for
|
|
161
|
+
* a native enum on `_def.values` as an object.
|
|
162
|
+
*/
|
|
163
|
+
function enumOptions(schema) {
|
|
164
|
+
const direct = schema.options;
|
|
165
|
+
if (Array.isArray(direct))
|
|
166
|
+
return direct.filter((o) => typeof o === "string");
|
|
167
|
+
const values = schema._def?.values;
|
|
168
|
+
if (Array.isArray(values))
|
|
169
|
+
return values.filter((o) => typeof o === "string");
|
|
170
|
+
if (values && typeof values === "object") {
|
|
171
|
+
return Object.values(values).filter((o) => typeof o === "string");
|
|
172
|
+
}
|
|
173
|
+
return undefined;
|
|
174
|
+
}
|
|
175
|
+
/** Public: the option list for a select-shaped field, or null. */
|
|
176
|
+
export function schemaEnumOptions(schema) {
|
|
177
|
+
const { schema: inner } = unwrapSchema(schema);
|
|
178
|
+
return enumOptions(inner) ?? null;
|
|
179
|
+
}
|
|
180
|
+
/** Public: whether a field's type is optional-wrapped (i.e. not required). */
|
|
181
|
+
export function schemaIsOptional(schema) {
|
|
182
|
+
const type = typeOf(schema);
|
|
183
|
+
return type === "optional" || type === "default" || type === "nullish";
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* The `.shape` of an object schema, seeing through effects wrappers.
|
|
187
|
+
*
|
|
188
|
+
* `.superRefine()` / `.refine()` / `.transform()` return a wrapper that does
|
|
189
|
+
* NOT expose `.shape` — verified: `z.object({...}).superRefine(fn)` has
|
|
190
|
+
* `_def.typeName === "ZodEffects"`, `.shape === undefined`, and the real object
|
|
191
|
+
* on `_def.schema`. Reading `.shape` directly therefore returns nothing for any
|
|
192
|
+
* schema with a cross-field rule, which is most of the interesting ones (the
|
|
193
|
+
* payout form's UPI-vs-bank branch is exactly this shape).
|
|
194
|
+
*
|
|
195
|
+
* Failing to unwrap would not error — it would silently derive a form with
|
|
196
|
+
* ZERO sections, which is the quiet-wrong-answer failure mode this whole wave
|
|
197
|
+
* exists to eliminate.
|
|
198
|
+
*/
|
|
199
|
+
export function objectShape(schema) {
|
|
200
|
+
let current = schema;
|
|
201
|
+
for (let depth = 0; depth < 10; depth++) {
|
|
202
|
+
const direct = current.shape;
|
|
203
|
+
if (direct)
|
|
204
|
+
return direct;
|
|
205
|
+
const def = current._def;
|
|
206
|
+
const next = def?.schema ?? def?.innerType ?? def?.in;
|
|
207
|
+
if (!next)
|
|
208
|
+
return null;
|
|
209
|
+
current = next;
|
|
210
|
+
}
|
|
211
|
+
return null;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Name patterns override the Zod type, because a name carries intent a type
|
|
215
|
+
* cannot. `images` is `ZodArray` but it is a media field, not a list editor;
|
|
216
|
+
* `description` is `ZodString` but it is a textarea.
|
|
217
|
+
*
|
|
218
|
+
* Ordered — the first match wins, so the media test runs before the long-text
|
|
219
|
+
* one (`coverImage` must not become a textarea).
|
|
220
|
+
*/
|
|
221
|
+
const NAME_RULES = [
|
|
222
|
+
{
|
|
223
|
+
// Media claims a full row ALWAYS, and forces its section to keepMounted:
|
|
224
|
+
// a MediaUploadField stacks a source-tab strip, a drop target, a progress
|
|
225
|
+
// bar and a preview, and collapsing it mid-upload discards the transfer.
|
|
226
|
+
test: /(^|[a-z])(image|images|photo|video|media|avatar|banner|logo|cover|thumbnail)([A-Z]|s?$)/i,
|
|
227
|
+
meta: { kind: "media", row: "full", sectionKeepMounted: true },
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
test: /^(description|body|content|notes?|bio|message|excerpt|answer|returnPolicy)$/i,
|
|
231
|
+
meta: { kind: "textarea", row: "full" },
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
// Long single inputs: truncating a URL or an address into half a row makes
|
|
235
|
+
// it unreadable, so they take the whole row even though they are short types.
|
|
236
|
+
test: /^(url|slug|email|title|name|displayName|headline|address|addressLine1|addressLine2|line1|line2)$/i,
|
|
237
|
+
meta: { row: "full" },
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
test: /^(firstName|lastName|city|state|postcode|pincode|postalCode|ifsc|gstin|pan|hsn|price|rate|percent|quantity|phone)$/i,
|
|
241
|
+
meta: { row: "pair" },
|
|
242
|
+
},
|
|
243
|
+
];
|
|
244
|
+
/**
|
|
245
|
+
* Fields nothing should ever render as an input — ids, audit stamps and
|
|
246
|
+
* counters. Marked `derived` so `audit-form-field-roundtrip` reads them as
|
|
247
|
+
* server-owned rather than as unreachable schema fields.
|
|
248
|
+
*/
|
|
249
|
+
const SERVER_OWNED = /^(id|createdAt|updatedAt|createdBy|updatedBy|ownerId|authorId|userId|views|viewCount|productCount|usageCount|helpfulCount|replyCount|reportCount)$/;
|
|
250
|
+
/** Zod type → its default control and row span. */
|
|
251
|
+
function fromZodType(type, inner) {
|
|
252
|
+
switch (type) {
|
|
253
|
+
case "boolean":
|
|
254
|
+
// Several per wrapping row — a switch plus label is short, and stacking
|
|
255
|
+
// them one-per-row makes a settings section endless.
|
|
256
|
+
return { kind: "toggle", row: "quarter" };
|
|
257
|
+
case "enum":
|
|
258
|
+
case "nativeEnum":
|
|
259
|
+
case "literal":
|
|
260
|
+
case "union":
|
|
261
|
+
return { kind: "select", row: "pair" };
|
|
262
|
+
case "date":
|
|
263
|
+
return { kind: "date", row: "pair" };
|
|
264
|
+
case "number":
|
|
265
|
+
case "bigint":
|
|
266
|
+
return { kind: "number", row: "pair" };
|
|
267
|
+
case "array":
|
|
268
|
+
return { kind: "list", row: "full" };
|
|
269
|
+
case "object":
|
|
270
|
+
case "record":
|
|
271
|
+
return { kind: "list", row: "full" };
|
|
272
|
+
case "string": {
|
|
273
|
+
const max = stringMaxLength(inner);
|
|
274
|
+
return max != null && max > 200
|
|
275
|
+
? { kind: "textarea", row: "full" }
|
|
276
|
+
: { kind: "text", row: "pair" };
|
|
277
|
+
}
|
|
278
|
+
default:
|
|
279
|
+
return { kind: "text", row: "pair" };
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Everything about a field's layout that can be derived from its name and its
|
|
284
|
+
* Zod type. `section` is never inferred, so the return type is a Partial —
|
|
285
|
+
* `resolveFieldUiMeta` is what merges it with the explicit registration.
|
|
286
|
+
*
|
|
287
|
+
* This is what makes annotation cheap: a 13-field form is 13 short
|
|
288
|
+
* `.register(ui, { section: "…" })` calls, not 13 full metadata objects.
|
|
289
|
+
*/
|
|
290
|
+
export function inferFieldUiMeta(name, schema) {
|
|
291
|
+
const { schema: inner, type } = unwrapSchema(schema);
|
|
292
|
+
const meta = { ...fromZodType(type, inner) };
|
|
293
|
+
for (const rule of NAME_RULES) {
|
|
294
|
+
if (rule.test.test(name)) {
|
|
295
|
+
Object.assign(meta, rule.meta);
|
|
296
|
+
break;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
if (SERVER_OWNED.test(name)) {
|
|
300
|
+
meta.derived = true;
|
|
301
|
+
meta.tier = meta.tier ?? "t2-server";
|
|
302
|
+
}
|
|
303
|
+
// >5 options is the standing PaginatedSelect threshold. Recorded as `help`
|
|
304
|
+
// rather than a separate flag so the renderer can decide without a second
|
|
305
|
+
// source of truth about what "many options" means.
|
|
306
|
+
const options = enumOptions(inner);
|
|
307
|
+
if (meta.kind === "select" && options != null && options.length > 5) {
|
|
308
|
+
meta.help = meta.help ?? "paginated";
|
|
309
|
+
}
|
|
310
|
+
return meta;
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* The field's final metadata: inference first, explicit registration on top.
|
|
314
|
+
*
|
|
315
|
+
* Returns `null` when the field has no registration at all — the caller
|
|
316
|
+
* decides whether that is a hard error (a registered form schema, where
|
|
317
|
+
* `section` is mandatory) or a fallback (an ad-hoc schema being previewed).
|
|
318
|
+
*/
|
|
319
|
+
export function resolveFieldUiMeta(name, schema) {
|
|
320
|
+
const explicit = ui.get(schema);
|
|
321
|
+
if (!explicit)
|
|
322
|
+
return null;
|
|
323
|
+
return { ...inferFieldUiMeta(name, schema), ...explicit };
|
|
324
|
+
}
|
|
@@ -6,5 +6,13 @@ export type { QuickFieldType, QuickFieldDef, QuickFormDrawerProps } from "./Quic
|
|
|
6
6
|
export { QuickFormDrawer } from "./QuickFormDrawer";
|
|
7
7
|
export type { StepDef, StepFormProps, StepFormActionsProps } from "./StepForm";
|
|
8
8
|
export { StepForm, StepFormActions, StepIndicator } from "./StepForm";
|
|
9
|
+
export type { SectionDef, SectionFormProps, UseSectionFormNavResult, } from "./SectionForm";
|
|
10
|
+
export { SectionForm, useSectionFormNav, orderSections, buildFieldToSectionIndex, sectionAnchorId, } from "./SectionForm";
|
|
11
|
+
export type { EntityFormDefinition } from "./entity-form";
|
|
12
|
+
export { deriveQuickFields, deriveQuickFieldNames, allDefinitionFields, applyDerive, assertNoDeriveCollision, humaniseFieldName, } from "./entity-form";
|
|
13
|
+
export type { FieldUiMeta, FieldRow, FieldKind, CalculatedTier, } from "./field-ui-meta";
|
|
14
|
+
export { ui, annotate, ROW_COLUMNS, inferFieldUiMeta, resolveFieldUiMeta, unwrapSchema, schemaEnumOptions, schemaIsOptional, objectShape, } from "./field-ui-meta";
|
|
15
|
+
export type { ResolvedField, FieldRenderer, BuildSectionsOptions, } from "./build-sections";
|
|
16
|
+
export { buildSectionsFromSchema, resolveFields, groupFieldsBySection, packRows, } from "./build-sections";
|
|
9
17
|
export type { TitleDescriptionGroupProps, ImageFieldGroupProps, SeoFieldGroupProps, StatusFieldGroupProps, StatusFieldGroupOption, } from "./field-groups";
|
|
10
18
|
export { TitleDescriptionGroup, ImageFieldGroup, SeoFieldGroup, StatusFieldGroup, } from "./field-groups";
|
|
@@ -2,4 +2,8 @@ export { FormShell, useFormShell, FormSchemaContext } from "./FormShell";
|
|
|
2
2
|
export { CommandPalette, useCommandPaletteHotkey } from "./CommandPalette";
|
|
3
3
|
export { QuickFormDrawer } from "./QuickFormDrawer";
|
|
4
4
|
export { StepForm, StepFormActions, StepIndicator } from "./StepForm";
|
|
5
|
+
export { SectionForm, useSectionFormNav, orderSections, buildFieldToSectionIndex, sectionAnchorId, } from "./SectionForm";
|
|
6
|
+
export { deriveQuickFields, deriveQuickFieldNames, allDefinitionFields, applyDerive, assertNoDeriveCollision, humaniseFieldName, } from "./entity-form";
|
|
7
|
+
export { ui, annotate, ROW_COLUMNS, inferFieldUiMeta, resolveFieldUiMeta, unwrapSchema, schemaEnumOptions, schemaIsOptional, objectShape, } from "./field-ui-meta";
|
|
8
|
+
export { buildSectionsFromSchema, resolveFields, groupFieldsBySection, packRows, } from "./build-sections";
|
|
5
9
|
export { TitleDescriptionGroup, ImageFieldGroup, SeoFieldGroup, StatusFieldGroup, } from "./field-groups";
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* StatusTimeline — the one rail that renders any entity's status history.
|
|
3
|
+
*
|
|
4
|
+
* Both the order timeline and the offer timeline were about to be written
|
|
5
|
+
* separately, against the same `StatusChangeEntry[]` shape, with the same
|
|
6
|
+
* dot-and-connector rail and the same two load-bearing rules. That is the
|
|
7
|
+
* duplication the Rule of Three exists to prevent, so this is the single
|
|
8
|
+
* implementation and each feature supplies only its own phase vocabulary.
|
|
9
|
+
*
|
|
10
|
+
* ## Two rules this component must never break
|
|
11
|
+
*
|
|
12
|
+
* **1. Never fabricate a timestamp.** A step with no recorded date renders an
|
|
13
|
+
* em-dash. Not `new Date()`, and not a proxy field: `updatedAt` means "last
|
|
14
|
+
* write of any kind" and `expiresAt` is a deadline, not an event. An offer
|
|
15
|
+
* that expired has no timestamp at all because `expireMany` never wrote one
|
|
16
|
+
* before this wave, and inventing one would make the record lie.
|
|
17
|
+
*
|
|
18
|
+
* **2. It never fetches.** A client component that loaded its own chain would
|
|
19
|
+
* fire one request per opened modal per portal. The API returns the chain;
|
|
20
|
+
* this renders it.
|
|
21
|
+
*/
|
|
22
|
+
import type { ReactNode } from "react";
|
|
23
|
+
import type { FieldChange } from "../../../_internal/shared/history/index";
|
|
24
|
+
/** The client-facing entry shape — dates already serialised to ISO. */
|
|
25
|
+
export interface TimelineEntry {
|
|
26
|
+
at: string;
|
|
27
|
+
actorUid?: string;
|
|
28
|
+
actorRole: "buyer" | "seller" | "admin" | "system";
|
|
29
|
+
changes: Record<string, FieldChange>;
|
|
30
|
+
reason?: string;
|
|
31
|
+
note?: string;
|
|
32
|
+
trigger: string;
|
|
33
|
+
}
|
|
34
|
+
export interface TimelineStep {
|
|
35
|
+
key: string;
|
|
36
|
+
label: string;
|
|
37
|
+
/** ISO string, or absent — absent renders an em-dash, never a guess. */
|
|
38
|
+
date?: string;
|
|
39
|
+
/** Terminal-negative: cancelled, declined, rejected. Renders in error tone. */
|
|
40
|
+
negative?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Neutral-but-ended, e.g. a superseded offer round. Deliberately distinct
|
|
43
|
+
* from `negative`: the buyer did not walk away, they countered, and the
|
|
44
|
+
* negotiation continued.
|
|
45
|
+
*/
|
|
46
|
+
muted?: boolean;
|
|
47
|
+
actorRole?: TimelineEntry["actorRole"];
|
|
48
|
+
reason?: string;
|
|
49
|
+
note?: string;
|
|
50
|
+
/** Round divider text for multi-round chains ("Round 2"). */
|
|
51
|
+
roundLabel?: string;
|
|
52
|
+
}
|
|
53
|
+
export interface StatusTimelineProps {
|
|
54
|
+
title?: string;
|
|
55
|
+
steps: TimelineStep[];
|
|
56
|
+
/** Entries trimmed off the front of the capped history, if any. */
|
|
57
|
+
truncatedCount?: number;
|
|
58
|
+
/** Rendered below the rail — tracking details, chain summary, etc. */
|
|
59
|
+
footer?: ReactNode;
|
|
60
|
+
/** Suppress `footer` when the last step is terminal-negative. */
|
|
61
|
+
hideFooterWhenNegative?: boolean;
|
|
62
|
+
emptyLabel?: string;
|
|
63
|
+
className?: string;
|
|
64
|
+
}
|
|
65
|
+
export declare function StatusTimeline({ title, steps, truncatedCount, footer, hideFooterWhenNegative, emptyLabel, className, }: StatusTimelineProps): import("react").JSX.Element;
|
|
66
|
+
/**
|
|
67
|
+
* Turn recorded history entries into steps.
|
|
68
|
+
*
|
|
69
|
+
* Only entries that actually changed `status` become steps — an entry
|
|
70
|
+
* recording a tracking number or a payment-review outcome is real history but
|
|
71
|
+
* is not a phase, and putting every entry on the rail would bury the five
|
|
72
|
+
* transitions anyone reads.
|
|
73
|
+
*/
|
|
74
|
+
export declare function stepsFromEntries(entries: TimelineEntry[] | undefined, labelFor: (status: string) => string, isNegative: (status: string) => boolean): TimelineStep[];
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Badge, Div, Heading, Row, Stack, Text } from "../../../ui";
|
|
4
|
+
const ACTOR_LABEL = {
|
|
5
|
+
buyer: "Buyer",
|
|
6
|
+
seller: "Store",
|
|
7
|
+
admin: "Admin",
|
|
8
|
+
system: "System",
|
|
9
|
+
};
|
|
10
|
+
export function StatusTimeline({ title = "Timeline", steps, truncatedCount, footer, hideFooterWhenNegative = true, emptyLabel = "No history yet", className = "", }) {
|
|
11
|
+
const isTerminalNegative = steps[steps.length - 1]?.negative === true;
|
|
12
|
+
const showFooter = footer && !(hideFooterWhenNegative && isTerminalNegative);
|
|
13
|
+
return (_jsxs(Div, { className: className, rounded: "xl", padding: "md", surface: "muted", border: "default", children: [_jsx(Heading, { level: 3, size: "sm", weight: "semibold", color: "muted", className: "mb-3", children: title }), truncatedCount && truncatedCount > 0 ? (
|
|
14
|
+
// Say what is not being shown. Silent truncation reads as "this is all
|
|
15
|
+
// of it", which is the same lie as a silently dropped field.
|
|
16
|
+
_jsxs(Text, { size: "xs", color: "muted", className: "mb-2", children: [truncatedCount, " earlier ", truncatedCount === 1 ? "entry" : "entries", " trimmed"] })) : null, steps.length === 0 ? (_jsx(Badge, { variant: "default", children: emptyLabel })) : (_jsx(Stack, { gap: "none", children: steps.map((step, i) => {
|
|
17
|
+
const isLast = i === steps.length - 1;
|
|
18
|
+
return (_jsxs(Stack, { gap: "none", children: [step.roundLabel && (_jsx(Text, { size: "xs", weight: "semibold", color: "muted", className: "mb-1 mt-2", children: step.roundLabel })), _jsxs(Row, { gap: "sm", padding: isLast ? "none" : "b-md", children: [_jsxs(Stack, { gap: "none", align: "center", className: "shrink-0", children: [_jsx(Div, { className: `h-2.5 w-2.5 ${step.negative || step.muted ? "" : "bg-[var(--appkit-color-primary)]"}`, rounded: "full", surface: step.negative ? "danger-surface" : step.muted ? "subtle" : "none" }), !isLast && _jsx(Div, { className: "w-px flex-1 min-h-[24px]", surface: "subtle" })] }), _jsxs(Stack, { gap: "none", className: "min-w-0 flex-1", children: [_jsxs(Row, { gap: "xs", align: "center", wrap: true, children: [_jsx(Text, { size: "sm", weight: "medium", className: step.negative ? "text-error" : undefined, color: step.muted ? "muted" : undefined, children: step.label }), step.actorRole && step.actorRole !== "system" && (_jsx(Badge, { variant: "default", size: "xs", children: ACTOR_LABEL[step.actorRole] }))] }), _jsx(Text, { size: "xs", color: "muted", children: step.date ? new Date(step.date).toLocaleString() : "—" }), step.reason && (_jsx(Text, { size: "xs", color: "muted", className: "mt-0.5", children: step.reason })), step.note && (_jsxs(Text, { size: "xs", color: "muted", italic: true, className: "mt-0.5", children: ["\u201C", step.note, "\u201D"] }))] })] })] }, `${step.key}-${i}`));
|
|
19
|
+
}) })), showFooter ? (_jsx(Div, { className: "mt-3 border-t border-[var(--appkit-color-border)]", padding: "t-sm", children: footer })) : null] }));
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Turn recorded history entries into steps.
|
|
23
|
+
*
|
|
24
|
+
* Only entries that actually changed `status` become steps — an entry
|
|
25
|
+
* recording a tracking number or a payment-review outcome is real history but
|
|
26
|
+
* is not a phase, and putting every entry on the rail would bury the five
|
|
27
|
+
* transitions anyone reads.
|
|
28
|
+
*/
|
|
29
|
+
export function stepsFromEntries(entries, labelFor, isNegative) {
|
|
30
|
+
if (!entries?.length)
|
|
31
|
+
return [];
|
|
32
|
+
return entries
|
|
33
|
+
.filter((e) => "status" in e.changes)
|
|
34
|
+
.map((e) => {
|
|
35
|
+
const to = String(e.changes.status?.to ?? "");
|
|
36
|
+
return {
|
|
37
|
+
key: to,
|
|
38
|
+
label: labelFor(to),
|
|
39
|
+
date: e.at,
|
|
40
|
+
negative: isNegative(to),
|
|
41
|
+
actorRole: e.actorRole,
|
|
42
|
+
reason: e.reason,
|
|
43
|
+
note: e.note,
|
|
44
|
+
};
|
|
45
|
+
});
|
|
46
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Status history — the shared timeline rail for any entity that records how
|
|
3
|
+
* it reached its current state (orders, offers, and the 8 more adopting the
|
|
4
|
+
* primitive in W15).
|
|
5
|
+
*
|
|
6
|
+
* Deliberately NOT `features/history/` — that name was already taken by the
|
|
7
|
+
* buyer's browsing-history feature (`useHistory`, guest-history utils), which
|
|
8
|
+
* is an entirely unrelated concept.
|
|
9
|
+
*/
|
|
10
|
+
export { StatusTimeline, stepsFromEntries } from "./components/StatusTimeline";
|
|
11
|
+
export type { StatusTimelineProps, TimelineEntry, TimelineStep } from "./components/StatusTimeline";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Status history — the shared timeline rail for any entity that records how
|
|
3
|
+
* it reached its current state (orders, offers, and the 8 more adopting the
|
|
4
|
+
* primitive in W15).
|
|
5
|
+
*
|
|
6
|
+
* Deliberately NOT `features/history/` — that name was already taken by the
|
|
7
|
+
* buyer's browsing-history feature (`useHistory`, guest-history utils), which
|
|
8
|
+
* is an entirely unrelated concept.
|
|
9
|
+
*/
|
|
10
|
+
export { StatusTimeline, stepsFromEntries } from "./components/StatusTimeline";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ZodType } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Generic over the schema's OUTPUT type, so a caller's `onConfirm` receives
|
|
4
|
+
* `ModerationReviewFormValues` / `ReportReviewFormValues` rather than an
|
|
5
|
+
* untyped bag. A `Record<string, unknown>` here would put the very seam this
|
|
6
|
+
* component exists to close straight back into the callback signature.
|
|
7
|
+
*/
|
|
8
|
+
export interface ReviewDecisionModalProps<TValues> {
|
|
9
|
+
isOpen: boolean;
|
|
10
|
+
onClose: () => void;
|
|
11
|
+
/** Modal heading, e.g. "Reject media". */
|
|
12
|
+
title: string;
|
|
13
|
+
/** The schema BOTH this modal and its route validate against. */
|
|
14
|
+
schema: ZodType<TValues>;
|
|
15
|
+
/** The status this decision sets — parsed as part of the payload. */
|
|
16
|
+
status: string;
|
|
17
|
+
/** Which key carries the note: `reason` for moderation, `resolution` for reports. */
|
|
18
|
+
noteField: string;
|
|
19
|
+
noteLabel: string;
|
|
20
|
+
noteHelp?: string;
|
|
21
|
+
notePlaceholder?: string;
|
|
22
|
+
confirmLabel: string;
|
|
23
|
+
confirmVariant?: "primary" | "danger";
|
|
24
|
+
/** Called only once the payload has parsed cleanly, with the PARSED value. */
|
|
25
|
+
onConfirm: (values: TValues) => Promise<void>;
|
|
26
|
+
}
|
|
27
|
+
export declare function ReviewDecisionModal<TValues>({ isOpen, onClose, title, schema, status, noteField, noteLabel, noteHelp, notePlaceholder, confirmLabel, confirmVariant, onConfirm, }: ReviewDecisionModalProps<TValues>): import("react").JSX.Element;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
/*
|
|
4
|
+
* WHY: Four surfaces asked a moderator to justify a decision, and not one of
|
|
5
|
+
* them checked that they had. `admin/moderation/page.tsx` and
|
|
6
|
+
* `ModerationDetailActions` each rendered their own reject-reason modal;
|
|
7
|
+
* `admin/reports/page.tsx` and `ReportDetailActions` each rendered their
|
|
8
|
+
* own resolution-note modal. All four submitted an empty string happily,
|
|
9
|
+
* so media could be blocked and a report closed with no record of why.
|
|
10
|
+
*
|
|
11
|
+
* WHAT: One modal for both decisions.
|
|
12
|
+
*
|
|
13
|
+
* ## Why one component and not two
|
|
14
|
+
*
|
|
15
|
+
* The two are the same observable thing — *a decision plus a note that is
|
|
16
|
+
* required before it can be made* — differing only in vocabulary. Per the
|
|
17
|
+
* Duplication Decision Framework this is a consolidate, on two counts: the
|
|
18
|
+
* copies have the same prop surface, and a single validation fix would
|
|
19
|
+
* otherwise have needed four commits. The differences are all DATA (labels,
|
|
20
|
+
* which field carries the note, which schema validates it), not branching, so
|
|
21
|
+
* there are no conditional props to trade away.
|
|
22
|
+
*
|
|
23
|
+
* ## The note field is named by the caller
|
|
24
|
+
*
|
|
25
|
+
* Moderation calls it `reason`, reports call it `resolution`. Naming it
|
|
26
|
+
* generically here would mean translating on the way out, and a schema issue
|
|
27
|
+
* on `resolution` would then have no field to land on — the error would fall
|
|
28
|
+
* back to a banner, which is the thing this replaces.
|
|
29
|
+
*
|
|
30
|
+
* EXPORTS: ReviewDecisionModal, type ReviewDecisionModalProps
|
|
31
|
+
*
|
|
32
|
+
* @tag domain:store-extensions,moderation,reports
|
|
33
|
+
* @tag layer:component
|
|
34
|
+
* @tag pattern:form
|
|
35
|
+
* @tag access:client
|
|
36
|
+
* @tag consumers:admin/moderation,admin/reports
|
|
37
|
+
* @tag sideEffects:none
|
|
38
|
+
*/
|
|
39
|
+
import { useState } from "react";
|
|
40
|
+
import { Modal } from "../../../ui/components/Modal";
|
|
41
|
+
import { Button } from "../../../ui/components/Button";
|
|
42
|
+
import { Row } from "../../../ui/components/Layout";
|
|
43
|
+
import { Stack } from "../../../ui/components/Layout";
|
|
44
|
+
import { Form } from "../../../ui/components/Form";
|
|
45
|
+
import { FieldTextarea } from "../../../ui/forms/FieldTextarea";
|
|
46
|
+
import { FormErrorSummary } from "../../../ui/forms/FormErrorSummary";
|
|
47
|
+
import { applyZodIssues } from "../../../ui/forms/FormShell";
|
|
48
|
+
import { useToast } from "../../../ui/components/Toast";
|
|
49
|
+
import { normalizeError } from "../../../errors/normalize";
|
|
50
|
+
export function ReviewDecisionModal({ isOpen, onClose, title, schema, status, noteField, noteLabel, noteHelp, notePlaceholder, confirmLabel, confirmVariant = "primary", onConfirm, }) {
|
|
51
|
+
const { showToast } = useToast();
|
|
52
|
+
const [note, setNote] = useState("");
|
|
53
|
+
const [submitting, setSubmitting] = useState(false);
|
|
54
|
+
const close = () => {
|
|
55
|
+
setNote("");
|
|
56
|
+
onClose();
|
|
57
|
+
};
|
|
58
|
+
return (_jsx(Modal, { isOpen: isOpen, onClose: close, title: title, size: "sm", children: _jsx(Form, { schema: schema, onSubmit: (e) => e.preventDefault(), children: ({ setFieldError, clearErrors }) => (_jsxs(Stack, { gap: "md", children: [_jsx(FormErrorSummary, {}), _jsx(FieldTextarea, { name: noteField, label: noteLabel, hint: noteHelp, rows: 4, required: true, value: note, onChange: setNote, placeholder: notePlaceholder }), _jsxs(Row, { justify: "end", gap: "sm", children: [_jsx(Button, { variant: "ghost", type: "button", onClick: close, disabled: submitting, children: "Cancel" }), _jsx(Button, { variant: confirmVariant, type: "submit", disabled: submitting, isLoading: submitting, onClick: async () => {
|
|
59
|
+
clearErrors();
|
|
60
|
+
const payload = { status, [noteField]: note };
|
|
61
|
+
const parsed = schema.safeParse(payload);
|
|
62
|
+
if (!parsed.success) {
|
|
63
|
+
applyZodIssues(parsed.error.issues, setFieldError);
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
setSubmitting(true);
|
|
67
|
+
try {
|
|
68
|
+
await onConfirm(parsed.data);
|
|
69
|
+
close();
|
|
70
|
+
}
|
|
71
|
+
catch (err) {
|
|
72
|
+
// Deliberately stays OPEN on failure. Closing would discard
|
|
73
|
+
// the note the reviewer just typed, and a decision that did
|
|
74
|
+
// not save must not look like one that did.
|
|
75
|
+
void normalizeError(err);
|
|
76
|
+
showToast("Couldn't save that decision. Try again.", "error");
|
|
77
|
+
}
|
|
78
|
+
finally {
|
|
79
|
+
setSubmitting(false);
|
|
80
|
+
}
|
|
81
|
+
}, children: confirmLabel })] })] })) }) }));
|
|
82
|
+
}
|
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
export * from "./schemas/firestore";
|
|
2
|
+
export * from "./schemas/store-category-form";
|
|
3
|
+
export * from "./schemas/listing-template-form";
|
|
4
|
+
export * from "./schemas/payout-method-form";
|
|
5
|
+
export * from "./schemas/shipping-config-form";
|
|
6
|
+
export * from "./schemas/custom-role-form";
|
|
7
|
+
export * from "./schemas/moderation-review-form";
|
|
8
|
+
export * from "./schemas/report-review-form";
|
|
9
|
+
export * from "./schemas/report-create-form";
|
|
10
|
+
export * from "./schemas/item-request-create-form";
|
|
11
|
+
export * from "./schemas/analytics-forms";
|
|
12
|
+
export * from "./schemas/google-config-form";
|
|
13
|
+
export * from "./schemas/admin-notification-form";
|
|
2
14
|
export * from "./schemas/rbac";
|
|
3
15
|
export * from "./repository/store-extensions.repositories";
|
|
4
16
|
export * from "./repository/rbac.repositories";
|
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
export * from "./schemas/firestore";
|
|
2
|
+
export * from "./schemas/store-category-form";
|
|
3
|
+
export * from "./schemas/listing-template-form";
|
|
4
|
+
export * from "./schemas/payout-method-form";
|
|
5
|
+
export * from "./schemas/shipping-config-form";
|
|
6
|
+
export * from "./schemas/custom-role-form";
|
|
7
|
+
export * from "./schemas/moderation-review-form";
|
|
8
|
+
export * from "./schemas/report-review-form";
|
|
9
|
+
export * from "./schemas/report-create-form";
|
|
10
|
+
export * from "./schemas/item-request-create-form";
|
|
11
|
+
export * from "./schemas/analytics-forms";
|
|
12
|
+
export * from "./schemas/google-config-form";
|
|
13
|
+
export * from "./schemas/admin-notification-form";
|
|
2
14
|
export * from "./schemas/rbac";
|
|
3
15
|
export * from "./repository/store-extensions.repositories";
|
|
4
16
|
export * from "./repository/rbac.repositories";
|