@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
|
@@ -1,44 +1,18 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as _jsx,
|
|
3
|
-
import React, { useState
|
|
4
|
-
import { X } from "lucide-react";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import React, { useState } from "react";
|
|
5
4
|
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
6
|
-
import {
|
|
7
|
-
import { useBulkSelection } from "../../../react/hooks/useBulkSelection";
|
|
8
|
-
import { BulkActionBar, Button, FilterChipGroup, Form, FormActions, Input, ListingToolbar, Modal, Pagination, ListingViewShell, RowActionMenu, Text as AppText, useToast } from "../../../ui";
|
|
9
|
-
import { AdminViewCards } from "./AdminViewCards";
|
|
5
|
+
import { Button, FilterChipGroup, Form, FormActions, Input, ListingLayout, Modal, RowActionMenu, Text as AppText, useToast, } from "../../../ui";
|
|
10
6
|
import { ADMIN_ENDPOINTS } from "../../../constants/api-endpoints";
|
|
11
7
|
import { ACTIONS } from "../../../_internal/shared/actions/action-registry";
|
|
12
8
|
import { ADMIN_USER_STATUS_TABS, ADMIN_USER_ROLE_TABS } from "../constants/filter-tabs";
|
|
13
|
-
import { toRecordArray, toRelativeDate, toStringValue,
|
|
9
|
+
import { toRecordArray, toRelativeDate, toStringValue, } from "../hooks/useAdminListingData";
|
|
10
|
+
import { DataListingView } from "./DataListingView";
|
|
14
11
|
import { apiClient } from "../../../http";
|
|
15
|
-
import { DataTable } from "./DataTable";
|
|
16
12
|
import { AdminUserEditorView } from "./AdminUserEditorView";
|
|
17
|
-
import { useBottomActions } from "../../layout";
|
|
18
|
-
const PAGE_SIZE = 25;
|
|
19
|
-
const FILTER_KEYS = ["status", "role"];
|
|
20
|
-
const DEFAULT_SORT = "-createdAt";
|
|
21
|
-
const SORT_OPTIONS = [
|
|
22
|
-
{ value: "-createdAt", label: "Newest" },
|
|
23
|
-
{ value: "createdAt", label: "Oldest" },
|
|
24
|
-
{ value: "displayName", label: "Name A–Z" },
|
|
25
|
-
];
|
|
26
|
-
const STATUS_OPTIONS = ADMIN_USER_STATUS_TABS;
|
|
27
|
-
const ROLE_OPTIONS = ADMIN_USER_ROLE_TABS;
|
|
28
|
-
function UsersFilterDrawer({ filterOpen, setFilterOpen, activeFilterCount, clearFilters, pendingFilters, setPendingFilters, applyFilters, }) {
|
|
29
|
-
if (!filterOpen)
|
|
30
|
-
return null;
|
|
31
|
-
return (_jsxs(_Fragment, { children: [_jsx("div", { className: "fixed inset-0 z-40 bg-black/40", "aria-hidden": "true", onClick: () => setFilterOpen(false) }), _jsxs("div", { className: "fixed inset-y-0 left-0 z-50 flex w-80 flex-col bg-white dark:bg-slate-900 shadow-2xl", children: [_jsxs("div", { className: "flex items-center justify-between border-b border-zinc-200 dark:border-slate-700 px-4 py-3.5", children: [_jsx("span", { className: "text-base font-semibold text-zinc-900 dark:text-zinc-100", children: "Filters" }), _jsxs("div", { className: "flex items-center gap-2", children: [activeFilterCount > 0 && (_jsx("button", { type: "button", onClick: clearFilters, className: "text-xs text-zinc-500 hover:text-rose-500 dark:text-zinc-400 transition-colors", children: "Clear all" })), _jsx("button", { type: "button", onClick: () => setFilterOpen(false), "aria-label": "Close", className: "rounded-lg p-1.5 text-zinc-500 dark:text-zinc-400 hover:bg-zinc-100 dark:hover:bg-zinc-800 transition-colors", children: _jsx(X, { className: "h-5 w-5" }) })] })] }), _jsxs("div", { className: "flex-1 overflow-y-auto px-4 py-4 space-y-5", children: [_jsx(FilterChipGroup, { label: "Status", tabs: STATUS_OPTIONS, value: pendingFilters.status ?? "", onChange: (id) => setPendingFilters((p) => ({ ...p, status: id })) }), _jsx(FilterChipGroup, { label: "Role", tabs: ROLE_OPTIONS, value: pendingFilters.role ?? "", onChange: (id) => setPendingFilters((p) => ({ ...p, role: id })) })] }), _jsx("div", { className: "border-t border-zinc-200 dark:border-slate-700 px-4 py-3.5", children: _jsxs("button", { type: "button", onClick: applyFilters, className: "w-full rounded-lg bg-primary py-2.5 text-sm font-semibold text-white hover:bg-primary-600 transition-colors active:scale-[0.98]", children: ["Apply Filters", activeFilterCount > 0 ? ` (${activeFilterCount})` : ""] }) })] })] }));
|
|
32
|
-
}
|
|
33
13
|
export function AdminUsersView({ children, ...props }) {
|
|
34
|
-
const hasChildren = React.Children.count(children) > 0;
|
|
35
|
-
const [view, setView] = useState("table");
|
|
36
14
|
const toast = useToast();
|
|
37
15
|
const queryClient = useQueryClient();
|
|
38
|
-
const table = useUrlTable({ defaults: { pageSize: String(PAGE_SIZE), sort: DEFAULT_SORT } });
|
|
39
|
-
const [searchInput, setSearchInput] = useState(table.get("q") || "");
|
|
40
|
-
const [filterOpen, setFilterOpen] = useState(false);
|
|
41
|
-
const [pendingFilters, setPendingFilters] = useState(() => Object.fromEntries(FILTER_KEYS.map((k) => [k, table.get(k)])));
|
|
42
16
|
const [drawerOpen, setDrawerOpen] = useState(false);
|
|
43
17
|
const [selectedRow, setSelectedRow] = useState(null);
|
|
44
18
|
const [banModalOpen, setBanModalOpen] = useState(false);
|
|
@@ -57,7 +31,9 @@ export function AdminUsersView({ children, ...props }) {
|
|
|
57
31
|
setBanReason("");
|
|
58
32
|
void queryClient.invalidateQueries({ queryKey: ["admin", "users", "listing"] });
|
|
59
33
|
},
|
|
60
|
-
onError: () => {
|
|
34
|
+
onError: () => {
|
|
35
|
+
toast.showToast("Failed to ban user.", "error");
|
|
36
|
+
},
|
|
61
37
|
});
|
|
62
38
|
const unbanUser = useMutation({
|
|
63
39
|
mutationFn: (uid) => apiClient.post(ADMIN_ENDPOINTS.USER_UNBAN(uid), {}),
|
|
@@ -65,51 +41,27 @@ export function AdminUsersView({ children, ...props }) {
|
|
|
65
41
|
toast.showToast("Ban lifted.", "success");
|
|
66
42
|
void queryClient.invalidateQueries({ queryKey: ["admin", "users", "listing"] });
|
|
67
43
|
},
|
|
68
|
-
onError: () => {
|
|
44
|
+
onError: () => {
|
|
45
|
+
toast.showToast("Failed to lift ban.", "error");
|
|
46
|
+
},
|
|
69
47
|
});
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
setFilterOpen(true);
|
|
73
|
-
}, [table]);
|
|
74
|
-
const applyFilters = useCallback(() => {
|
|
75
|
-
const updates = { page: "1" };
|
|
76
|
-
for (const k of FILTER_KEYS)
|
|
77
|
-
updates[k] = pendingFilters[k] ?? "";
|
|
78
|
-
table.setMany(updates);
|
|
79
|
-
setFilterOpen(false);
|
|
80
|
-
}, [pendingFilters, table]);
|
|
81
|
-
const clearFilters = useCallback(() => {
|
|
82
|
-
setPendingFilters(Object.fromEntries(FILTER_KEYS.map((k) => [k, ""])));
|
|
83
|
-
}, []);
|
|
84
|
-
const resetAll = useCallback(() => {
|
|
85
|
-
const updates = { q: "", sort: "" };
|
|
86
|
-
for (const k of FILTER_KEYS)
|
|
87
|
-
updates[k] = "";
|
|
88
|
-
table.setMany(updates);
|
|
89
|
-
setSearchInput("");
|
|
90
|
-
}, [table]);
|
|
91
|
-
const commitSearch = useCallback(() => {
|
|
92
|
-
table.set("q", searchInput.trim());
|
|
93
|
-
}, [searchInput, table]);
|
|
94
|
-
const activeFilterCount = FILTER_KEYS.filter((k) => !!table.get(k)).length;
|
|
95
|
-
const hasActiveState = !!table.get("q") || table.get("sort") !== DEFAULT_SORT || activeFilterCount > 0;
|
|
96
|
-
const filterParts = [];
|
|
97
|
-
const statusRaw = table.get("status");
|
|
98
|
-
if (statusRaw && statusRaw !== "All") {
|
|
99
|
-
filterParts.push(statusRaw === "Active" ? "disabled==false" : "disabled==true");
|
|
48
|
+
if (React.Children.count(children) > 0) {
|
|
49
|
+
return (_jsx(ListingLayout, { portal: "admin", ...props, children: children }));
|
|
100
50
|
}
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
51
|
+
const config = {
|
|
52
|
+
portal: "admin",
|
|
53
|
+
title: "Users",
|
|
54
|
+
searchPlaceholder: "Search users, email, or seller handles",
|
|
55
|
+
emptyLabel: "No users found",
|
|
56
|
+
filterKeys: ["status", "role"],
|
|
57
|
+
defaultSort: "-createdAt",
|
|
106
58
|
queryKey: ["admin", "users", "listing"],
|
|
107
59
|
endpoint: ADMIN_ENDPOINTS.USERS,
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
60
|
+
sortOptions: [
|
|
61
|
+
{ value: "-createdAt", label: "Newest" },
|
|
62
|
+
{ value: "createdAt", label: "Oldest" },
|
|
63
|
+
{ value: "displayName", label: "Name A–Z" },
|
|
64
|
+
],
|
|
113
65
|
mapRows: (response) => toRecordArray(response.users).map((item, index) => {
|
|
114
66
|
const isDisabled = Boolean(item.isDisabled ?? item.disabled);
|
|
115
67
|
const isHardBanned = isDisabled && Boolean(item.hardBanReason);
|
|
@@ -140,38 +92,64 @@ export function AdminUsersView({ children, ...props }) {
|
|
|
140
92
|
return response.total;
|
|
141
93
|
return mappedRows.length;
|
|
142
94
|
},
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
95
|
+
buildFilters: (f) => {
|
|
96
|
+
const parts = [];
|
|
97
|
+
if (f.status && f.status !== "All") {
|
|
98
|
+
parts.push(f.status === "Active" ? "disabled==false" : "disabled==true");
|
|
99
|
+
}
|
|
100
|
+
if (f.role && f.role !== "All")
|
|
101
|
+
parts.push(`role==${f.role}`);
|
|
102
|
+
return parts.join(",") || undefined;
|
|
103
|
+
},
|
|
104
|
+
onRowClick: (row) => {
|
|
105
|
+
setSelectedRow(row);
|
|
106
|
+
setDrawerOpen(true);
|
|
107
|
+
},
|
|
108
|
+
buildBulkActions: (selection) => [
|
|
109
|
+
{
|
|
110
|
+
id: "manage",
|
|
111
|
+
label: ACTIONS.ADMIN["manage-user"].label,
|
|
112
|
+
variant: "primary",
|
|
113
|
+
onClick: () => {
|
|
114
|
+
const id = selection.selectedIds[0];
|
|
115
|
+
const row = selection.rows.find((r) => r.id === id) ?? null;
|
|
116
|
+
if (row) {
|
|
117
|
+
setSelectedRow(row);
|
|
118
|
+
setDrawerOpen(true);
|
|
119
|
+
}
|
|
120
|
+
selection.clearSelection();
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
],
|
|
124
|
+
renderRowActions: (row) => {
|
|
125
|
+
const isBanned = row.status === "Hard banned";
|
|
126
|
+
return (_jsx(RowActionMenu, { actions: [
|
|
127
|
+
{
|
|
128
|
+
label: ACTIONS.ADMIN["manage-user"].label,
|
|
129
|
+
onClick: () => {
|
|
130
|
+
setSelectedRow(row);
|
|
131
|
+
setDrawerOpen(true);
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
label: ACTIONS.ADMIN["ban-user"].label,
|
|
136
|
+
onClick: () => {
|
|
137
|
+
setBanTargetId(row.id);
|
|
138
|
+
setBanReason("");
|
|
139
|
+
setBanModalOpen(true);
|
|
140
|
+
},
|
|
141
|
+
disabled: isBanned,
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
label: ACTIONS.ADMIN["unban-user"].label,
|
|
145
|
+
onClick: () => unbanUser.mutate(row.id),
|
|
146
|
+
disabled: !isBanned || unbanUser.isPending,
|
|
147
|
+
},
|
|
148
|
+
] }));
|
|
149
|
+
},
|
|
150
|
+
renderFilterPanel: ({ pendingFilters, setPendingFilters }) => (_jsxs(_Fragment, { children: [_jsx(FilterChipGroup, { label: "Status", tabs: ADMIN_USER_STATUS_TABS, value: pendingFilters.status ?? "", onChange: (id) => setPendingFilters((p) => ({ ...p, status: id })) }), _jsx(FilterChipGroup, { label: "Role", tabs: ADMIN_USER_ROLE_TABS, value: pendingFilters.role ?? "", onChange: (id) => setPendingFilters((p) => ({ ...p, role: id })) })] })),
|
|
151
|
+
};
|
|
152
|
+
return (_jsxs(_Fragment, { children: [_jsx(DataListingView, { config: config }), _jsx(AdminUserEditorView, { open: drawerOpen, onClose: () => setDrawerOpen(false), userId: selectedRow?.id, displayName: selectedRow?.primary, currentRole: toStringValue(selectedRow?._raw?.role, "user"), currentEmailVerified: Boolean(selectedRow?._raw?.emailVerified), ownedStoreId: toStringValue(selectedRow?._raw?.storeId, "") || undefined, ownedStoreName: toStringValue(selectedRow?._raw?.storeName, "") || undefined, currentIsHardBanned: Boolean((selectedRow?._raw?.isDisabled ?? selectedRow?._raw?.disabled) &&
|
|
175
153
|
selectedRow?._raw?.hardBanReason), currentHardBanReason: toStringValue(selectedRow?._raw?.hardBanReason, "") || undefined, currentSoftBans: Array.isArray(selectedRow?._raw?.softBans)
|
|
176
154
|
? selectedRow._raw.softBans.map((b) => ({
|
|
177
155
|
action: toStringValue(b.action, ""),
|
|
@@ -186,5 +164,29 @@ export function AdminUsersView({ children, ...props }) {
|
|
|
186
164
|
: null,
|
|
187
165
|
bannedBy: toStringValue(b.bannedBy, ""),
|
|
188
166
|
}))
|
|
189
|
-
: undefined
|
|
167
|
+
: undefined,
|
|
168
|
+
// ST-2 — extended profile fields
|
|
169
|
+
currentPhoneNumber: toStringValue(selectedRow?._raw?.phoneNumber, "") || undefined, currentBio: toStringValue(selectedRow?._raw?.publicProfile?.bio, "") || undefined, currentLocation: toStringValue(selectedRow?._raw?.publicProfile?.location, "") || undefined, currentWebsite: toStringValue(selectedRow?._raw?.publicProfile?.website, "") || undefined, currentSocialLinks: (() => {
|
|
170
|
+
const pp = selectedRow?._raw?.publicProfile;
|
|
171
|
+
const sl = pp?.socialLinks;
|
|
172
|
+
if (!sl)
|
|
173
|
+
return undefined;
|
|
174
|
+
return {
|
|
175
|
+
twitter: toStringValue(sl.twitter, "") || undefined,
|
|
176
|
+
instagram: toStringValue(sl.instagram, "") || undefined,
|
|
177
|
+
facebook: toStringValue(sl.facebook, "") || undefined,
|
|
178
|
+
linkedin: toStringValue(sl.linkedin, "") || undefined,
|
|
179
|
+
};
|
|
180
|
+
})() }), _jsxs(Modal, { isOpen: banModalOpen, onClose: () => {
|
|
181
|
+
setBanModalOpen(false);
|
|
182
|
+
setBanTargetId(null);
|
|
183
|
+
setBanReason("");
|
|
184
|
+
}, title: ACTIONS.ADMIN["ban-user"].confirmation.title, children: [_jsx(AppText, { size: "sm", color: "muted", className: "mb-4", children: ACTIONS.ADMIN["ban-user"].confirmation.body }), _jsxs(Form, { onSubmit: (e) => {
|
|
185
|
+
e.preventDefault();
|
|
186
|
+
banUser.mutate();
|
|
187
|
+
}, children: [_jsx(Input, { label: "Reason", value: banReason, onChange: (e) => setBanReason(e.target.value), placeholder: "e.g. Repeated fraud, scam activity\u2026", required: true }), _jsxs(FormActions, { children: [_jsx(Button, { type: "button", variant: "secondary", onClick: () => {
|
|
188
|
+
setBanModalOpen(false);
|
|
189
|
+
setBanTargetId(null);
|
|
190
|
+
setBanReason("");
|
|
191
|
+
}, children: "Cancel" }), _jsx(Button, { type: "submit", variant: "danger", isLoading: banUser.isPending, disabled: !banReason.trim() || banUser.isPending, children: ACTIONS.ADMIN["ban-user"].confirmation.confirmLabel })] })] })] })] }));
|
|
190
192
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export
|
|
3
|
-
}
|
|
1
|
+
import type { ListingLayoutProps } from "../../../ui";
|
|
2
|
+
export type AdminWishlistsViewProps = ListingLayoutProps;
|
|
4
3
|
export declare function AdminWishlistsView({ children, ...props }: AdminWishlistsViewProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,67 +1,41 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as _jsx
|
|
3
|
-
import React
|
|
4
|
-
import {
|
|
5
|
-
import { useBulkSelection } from "../../../react/hooks/useBulkSelection";
|
|
6
|
-
import { ListingToolbar, Pagination, ListingViewShell } from "../../../ui";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { ListingLayout } from "../../../ui";
|
|
7
5
|
import { ADMIN_ENDPOINTS } from "../../../constants/api-endpoints";
|
|
8
|
-
import { toRecordArray, toRelativeDate, toStringValue,
|
|
9
|
-
import {
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
6
|
+
import { toRecordArray, toRelativeDate, toStringValue, } from "../hooks/useAdminListingData";
|
|
7
|
+
import { DataListingView } from "./DataListingView";
|
|
8
|
+
const ADMIN_WISHLISTS_CONFIG = {
|
|
9
|
+
portal: "admin",
|
|
10
|
+
title: "Wishlists",
|
|
11
|
+
searchPlaceholder: "Search by user ID",
|
|
12
|
+
emptyLabel: "No user wishlists found",
|
|
13
|
+
filterKeys: [],
|
|
14
|
+
defaultSort: "-updatedAt",
|
|
15
|
+
queryKey: ["admin", "wishlists", "listing"],
|
|
16
|
+
endpoint: ADMIN_ENDPOINTS.ADMIN_WISHLISTS,
|
|
17
|
+
sortOptions: [
|
|
18
|
+
{ value: "-updatedAt", label: "Recently updated" },
|
|
19
|
+
{ value: "-itemCount", label: "Largest first" },
|
|
20
|
+
],
|
|
21
|
+
mapRows: (response) => toRecordArray(response.items).map((item, index) => {
|
|
22
|
+
const itemCount = typeof item.itemCount === "number" ? item.itemCount : 0;
|
|
23
|
+
const limit = typeof item.limit === "number" ? item.limit : 20;
|
|
24
|
+
const isFull = item.isFull === true;
|
|
25
|
+
return {
|
|
26
|
+
id: toStringValue(item.id, `wish-${index}`),
|
|
27
|
+
primary: toStringValue(item.userId, "Unknown user"),
|
|
28
|
+
secondary: `${itemCount} item${itemCount === 1 ? "" : "s"} of ${limit}`,
|
|
29
|
+
status: isFull ? "Full" : itemCount >= limit - 2 ? "Near cap" : "OK",
|
|
30
|
+
updatedAt: toRelativeDate(item.updatedAt),
|
|
31
|
+
};
|
|
32
|
+
}),
|
|
33
|
+
getTotal: (response, mappedRows) => typeof response.total === "number" ? response.total : mappedRows.length,
|
|
34
|
+
buildFilters: () => undefined,
|
|
35
|
+
};
|
|
17
36
|
export function AdminWishlistsView({ children, ...props }) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const table = useUrlTable({ defaults: { pageSize: String(PAGE_SIZE), sort: DEFAULT_SORT } });
|
|
21
|
-
const [searchInput, setSearchInput] = useState(table.get("q") || "");
|
|
22
|
-
const [selectedIds, setSelectedIds] = useState(new Set());
|
|
23
|
-
const toggleSelect = (id, next) => setSelectedIds((prev) => {
|
|
24
|
-
const s = new Set(prev);
|
|
25
|
-
if (next)
|
|
26
|
-
s.add(id);
|
|
27
|
-
else
|
|
28
|
-
s.delete(id);
|
|
29
|
-
return s;
|
|
30
|
-
});
|
|
31
|
-
const resetAll = useCallback(() => {
|
|
32
|
-
table.setMany({ q: "", sort: "" });
|
|
33
|
-
setSearchInput("");
|
|
34
|
-
}, [table]);
|
|
35
|
-
const commitSearch = useCallback(() => {
|
|
36
|
-
table.set("q", searchInput.trim());
|
|
37
|
-
}, [searchInput, table]);
|
|
38
|
-
const hasActiveState = !!table.get("q") || table.get("sort") !== DEFAULT_SORT;
|
|
39
|
-
const { rows, total, isLoading, errorMessage } = useAdminListingData({
|
|
40
|
-
queryKey: ["admin", "wishlists", "listing"],
|
|
41
|
-
endpoint: ADMIN_ENDPOINTS.ADMIN_WISHLISTS,
|
|
42
|
-
page: table.getNumber("page", 1),
|
|
43
|
-
pageSize: PAGE_SIZE,
|
|
44
|
-
sorts: table.get("sort") || DEFAULT_SORT,
|
|
45
|
-
q: table.get("q") || undefined,
|
|
46
|
-
mapRows: (response) => toRecordArray(response.items).map((item, index) => {
|
|
47
|
-
const itemCount = typeof item.itemCount === "number" ? item.itemCount : 0;
|
|
48
|
-
const limit = typeof item.limit === "number" ? item.limit : 20;
|
|
49
|
-
const isFull = item.isFull === true;
|
|
50
|
-
return {
|
|
51
|
-
id: toStringValue(item.id, `wish-${index}`),
|
|
52
|
-
primary: toStringValue(item.userId, "Unknown user"),
|
|
53
|
-
secondary: `${itemCount} item${itemCount === 1 ? "" : "s"} of ${limit}`,
|
|
54
|
-
status: isFull ? "Full" : itemCount >= limit - 2 ? "Near cap" : "OK",
|
|
55
|
-
updatedAt: toRelativeDate(item.updatedAt),
|
|
56
|
-
};
|
|
57
|
-
}),
|
|
58
|
-
getTotal: (response, mappedRows) => typeof response.total === "number" ? response.total : mappedRows.length,
|
|
59
|
-
});
|
|
60
|
-
const currentPage = table.getNumber("page", 1);
|
|
61
|
-
const totalPages = Math.ceil(total / PAGE_SIZE);
|
|
62
|
-
const selection = useBulkSelection({ items: rows, keyExtractor: (r) => r.id });
|
|
63
|
-
if (hasChildren) {
|
|
64
|
-
return _jsx(ListingViewShell, { portal: "admin", ...props, children: children });
|
|
37
|
+
if (React.Children.count(children) > 0) {
|
|
38
|
+
return (_jsx(ListingLayout, { portal: "admin", ...props, children: children }));
|
|
65
39
|
}
|
|
66
|
-
return
|
|
40
|
+
return _jsx(DataListingView, { config: ADMIN_WISHLISTS_CONFIG });
|
|
67
41
|
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DataListingView — config-driven listing scaffold for admin + seller dashboards.
|
|
3
|
+
*
|
|
4
|
+
* Replaces ~30 hand-wired admin/seller view components (AdminBrandsView, AdminCategoriesView,
|
|
5
|
+
* SellerCouponsView, etc.) by accepting a single `config` object describing:
|
|
6
|
+
* - data layer (endpoint, queryKey, mapRows, buildFilters, sortOptions)
|
|
7
|
+
* - presentation (title, subtitle, columns, searchPlaceholder, emptyLabel)
|
|
8
|
+
* - actions (bulkActions, primaryAction, renderRowActions)
|
|
9
|
+
* - filter panel (renderFilterPanel)
|
|
10
|
+
* - editor side-drawer (renderEditor)
|
|
11
|
+
*
|
|
12
|
+
* Composes: useAdminListing (data + state) + ListingToolbar + BulkActionBar + Pagination
|
|
13
|
+
* + DataTable | AdminViewCards + ListingFilterDrawer + SideDrawer
|
|
14
|
+
* + useBottomActions (mobile bulk bar)
|
|
15
|
+
*
|
|
16
|
+
* Usage:
|
|
17
|
+
* const ADMIN_BRANDS_CONFIG: ListingViewConfig<BrandsResponse, BrandRow> = { ... };
|
|
18
|
+
* <DataListingView config={ADMIN_BRANDS_CONFIG} />
|
|
19
|
+
*
|
|
20
|
+
* Created 2026-05-23 as part of W6-12 (plan: read-this-files-and-modular-storm.md).
|
|
21
|
+
*/
|
|
22
|
+
import React from "react";
|
|
23
|
+
import type { BulkActionItem } from "../../../ui";
|
|
24
|
+
import type { AdminListingConfig } from "../hooks/useAdminListing";
|
|
25
|
+
import type { AdminTableColumn } from "../types";
|
|
26
|
+
/**
|
|
27
|
+
* Generic admin data row shape used by DataListingView and AdminViewCards.
|
|
28
|
+
* Moved here from AdminListingScaffold (which is now deleted) so views that
|
|
29
|
+
* need the base row type can import from this module instead.
|
|
30
|
+
*/
|
|
31
|
+
export interface AdminListingScaffoldRow {
|
|
32
|
+
id: string;
|
|
33
|
+
primary: string;
|
|
34
|
+
secondary: string;
|
|
35
|
+
status: string;
|
|
36
|
+
updatedAt: string;
|
|
37
|
+
featured?: boolean;
|
|
38
|
+
isPromoted?: boolean;
|
|
39
|
+
isOnSale?: boolean;
|
|
40
|
+
isSold?: boolean;
|
|
41
|
+
}
|
|
42
|
+
export interface ListingSortOption {
|
|
43
|
+
value: string;
|
|
44
|
+
label: string;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Render context passed to filter panel + editor render-props.
|
|
48
|
+
* Mirrors the shape returned by `useAdminListing`.
|
|
49
|
+
*/
|
|
50
|
+
export interface ListingPanelContext {
|
|
51
|
+
pendingFilters: Record<string, string>;
|
|
52
|
+
setPendingFilters: React.Dispatch<React.SetStateAction<Record<string, string>>>;
|
|
53
|
+
applyFilters: () => void;
|
|
54
|
+
clearFilters: () => void;
|
|
55
|
+
}
|
|
56
|
+
export interface ListingEditorContext {
|
|
57
|
+
isCreate: boolean;
|
|
58
|
+
editId: string | null;
|
|
59
|
+
closePanel: () => void;
|
|
60
|
+
}
|
|
61
|
+
export interface ListingSelectionContext<TRow extends {
|
|
62
|
+
id: string;
|
|
63
|
+
}> {
|
|
64
|
+
selectedIds: string[];
|
|
65
|
+
selectedCount: number;
|
|
66
|
+
clearSelection: () => void;
|
|
67
|
+
toggleSelect: (id: string) => void;
|
|
68
|
+
rows: TRow[];
|
|
69
|
+
openEditPanel: (id: string) => void;
|
|
70
|
+
}
|
|
71
|
+
export interface ListingViewConfig<TResponse, TRow extends {
|
|
72
|
+
id: string;
|
|
73
|
+
}> extends AdminListingConfig<TResponse, TRow> {
|
|
74
|
+
/** Portal context — currently admin/seller share the same chrome. */
|
|
75
|
+
portal: "admin" | "seller";
|
|
76
|
+
title: string;
|
|
77
|
+
subtitle?: string;
|
|
78
|
+
searchPlaceholder: string;
|
|
79
|
+
emptyLabel?: string;
|
|
80
|
+
sortOptions: ListingSortOption[];
|
|
81
|
+
columns?: AdminTableColumn<TRow>[];
|
|
82
|
+
/** Optional alt-view (grid/list) renderer. When omitted, AdminViewCards is used. */
|
|
83
|
+
renderCards?: (rows: TRow[], view: "grid" | "list", selection: ListingSelectionContext<TRow>, isLoading: boolean) => React.ReactNode;
|
|
84
|
+
primaryAction?: {
|
|
85
|
+
label: string;
|
|
86
|
+
onClick: (panel: {
|
|
87
|
+
openCreatePanel: () => void;
|
|
88
|
+
}) => void;
|
|
89
|
+
icon?: React.ReactNode;
|
|
90
|
+
};
|
|
91
|
+
/** Extra arbitrary content in the toolbar (e.g. export buttons). Rendered alongside primaryAction. */
|
|
92
|
+
toolbarExtra?: React.ReactNode;
|
|
93
|
+
/** Slot rendered between the toolbar and the table content (e.g. URL-driven scope tabs). */
|
|
94
|
+
renderAboveContent?: () => React.ReactNode;
|
|
95
|
+
/** Pill toggles displayed alongside the search/sort/filter row in ListingToolbar. */
|
|
96
|
+
toggles?: Array<{
|
|
97
|
+
label: string;
|
|
98
|
+
active: boolean;
|
|
99
|
+
onChange: (next: boolean) => void;
|
|
100
|
+
}>;
|
|
101
|
+
renderRowActions?: (row: TRow) => React.ReactNode;
|
|
102
|
+
buildBulkActions?: (selection: ListingSelectionContext<TRow>) => BulkActionItem[];
|
|
103
|
+
renderFilterPanel?: (ctx: ListingPanelContext) => React.ReactNode;
|
|
104
|
+
renderEditor?: (ctx: ListingEditorContext) => React.ReactNode;
|
|
105
|
+
/** Drawer title resolver — defaults to "Add X" / "Edit X" using `title`. */
|
|
106
|
+
resolveEditorTitle?: (ctx: ListingEditorContext) => string;
|
|
107
|
+
onRowClick?: (row: TRow, panel: {
|
|
108
|
+
openEditPanel: (id: string) => void;
|
|
109
|
+
}) => void;
|
|
110
|
+
/** When set, the table renders rows as anchor links to this href. */
|
|
111
|
+
getRowHref?: (row: TRow) => string;
|
|
112
|
+
/** Hide the table toggle in the toolbar; views with no table column set should use this. */
|
|
113
|
+
hideTableView?: boolean;
|
|
114
|
+
/** Initial view mode (defaults to "table" when not hidden, "grid" when hidden). */
|
|
115
|
+
initialView?: "grid" | "list" | "table";
|
|
116
|
+
className?: string;
|
|
117
|
+
}
|
|
118
|
+
export declare function DataListingView<TResponse, TRow extends {
|
|
119
|
+
id: string;
|
|
120
|
+
}>({ config, }: {
|
|
121
|
+
config: ListingViewConfig<TResponse, TRow>;
|
|
122
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Plus } from "lucide-react";
|
|
4
|
+
import { BulkActionBar, Button, ListingFilterDrawer, ListingToolbar, Pagination, SideDrawer, } from "../../../ui";
|
|
5
|
+
import { useBottomActions } from "../../layout";
|
|
6
|
+
import { useAdminListing } from "../hooks/useAdminListing";
|
|
7
|
+
import { AdminViewCards } from "./AdminViewCards";
|
|
8
|
+
import { DataTable } from "./DataTable";
|
|
9
|
+
export function DataListingView({ config, }) {
|
|
10
|
+
const effectiveInitialView = config.initialView ?? (config.hideTableView ? "grid" : "table");
|
|
11
|
+
const listing = useAdminListing({
|
|
12
|
+
...config,
|
|
13
|
+
initialView: effectiveInitialView,
|
|
14
|
+
});
|
|
15
|
+
const { view, setView, table, panel, searchInput, setSearchInput, commitSearch, filterOpen, setFilterOpen, openFilters, applyFilters, clearFilters, pendingFilters, setPendingFilters, activeFilterCount, hasActiveState, resetAll, rows, isLoading, errorMessage, currentPage, totalPages, selection, } = listing;
|
|
16
|
+
const selectionContext = {
|
|
17
|
+
selectedIds: selection.selectedIds,
|
|
18
|
+
selectedCount: selection.selectedCount,
|
|
19
|
+
clearSelection: selection.clearSelection,
|
|
20
|
+
toggleSelect: selection.toggle,
|
|
21
|
+
rows,
|
|
22
|
+
openEditPanel: panel.openEditPanel,
|
|
23
|
+
};
|
|
24
|
+
const bulkActionItems = config.buildBulkActions?.(selectionContext);
|
|
25
|
+
// Mobile bulk bar
|
|
26
|
+
useBottomActions(selection.selectedCount > 0 && bulkActionItems
|
|
27
|
+
? {
|
|
28
|
+
bulk: {
|
|
29
|
+
selectedCount: selection.selectedCount,
|
|
30
|
+
onClearSelection: selection.clearSelection,
|
|
31
|
+
actions: bulkActionItems,
|
|
32
|
+
},
|
|
33
|
+
}
|
|
34
|
+
: {});
|
|
35
|
+
const editorTitle = config.resolveEditorTitle
|
|
36
|
+
? config.resolveEditorTitle({
|
|
37
|
+
isCreate: panel.isCreateOpen,
|
|
38
|
+
editId: panel.editId,
|
|
39
|
+
closePanel: panel.closePanel,
|
|
40
|
+
})
|
|
41
|
+
: panel.isCreateOpen
|
|
42
|
+
? `Add ${config.title.replace(/s$/, "")}`
|
|
43
|
+
: `Edit ${config.title.replace(/s$/, "")}`;
|
|
44
|
+
const isEditorOpen = panel.isCreateOpen || panel.isEditOpen;
|
|
45
|
+
return (_jsxs("div", { className: config.className ?? "min-h-screen", children: [_jsx(ListingToolbar, { filterCount: activeFilterCount, onFiltersClick: openFilters, searchValue: searchInput, searchPlaceholder: config.searchPlaceholder, onSearchChange: setSearchInput, onSearchCommit: commitSearch, sortValue: table.get("sort") || config.defaultSort, sortOptions: config.sortOptions, onSortChange: (v) => table.set("sort", v), showTableView: !config.hideTableView, toggles: config.toggles, view: view, onViewChange: (v) => setView(v), onResetAll: resetAll, hasActiveState: hasActiveState, extra: config.primaryAction || config.toolbarExtra ? (_jsxs("div", { className: "flex items-center gap-2", children: [config.toolbarExtra, config.primaryAction && (_jsxs(Button, { size: "sm", onClick: () => config.primaryAction.onClick({
|
|
46
|
+
openCreatePanel: panel.openCreatePanel,
|
|
47
|
+
}), className: "flex items-center gap-1.5", children: [config.primaryAction.icon ?? _jsx(Plus, { className: "h-4 w-4" }), config.primaryAction.label] }))] })) : undefined }), config.renderAboveContent?.(), bulkActionItems && (_jsx(BulkActionBar, { selectedCount: selection.selectedCount, onClearSelection: selection.clearSelection, actions: bulkActionItems })), totalPages > 1 && (_jsx("div", { className: "sticky top-[calc(var(--header-height,0px)+44px)] z-10 flex justify-center bg-white/95 dark:bg-slate-900/95 backdrop-blur-sm border-b border-zinc-200 dark:border-slate-700 px-3 py-1.5", children: _jsx(Pagination, { currentPage: currentPage, totalPages: totalPages, onPageChange: (p) => table.setPage(p) }) })), _jsxs("div", { className: "py-4 px-3 sm:px-4", children: [errorMessage && (_jsx("div", { className: "mb-4 rounded-xl border border-error/20 bg-error-surface px-4 py-3 text-sm text-error", children: errorMessage })), view === "table" ? (_jsx(DataTable, { columns: config.columns, rows: rows, isLoading: isLoading, emptyLabel: config.emptyLabel ?? `No ${config.title.toLowerCase()} found`, selectedIds: selection.selectedIdSet, onToggleSelect: selection.toggle, onToggleSelectAll: (next) => next
|
|
48
|
+
? selection.setSelectedIds(rows.map((r) => r.id))
|
|
49
|
+
: selection.clearSelection(), getRowHref: config.getRowHref, onRowClick: config.onRowClick
|
|
50
|
+
? (row) => config.onRowClick(row, {
|
|
51
|
+
openEditPanel: panel.openEditPanel,
|
|
52
|
+
})
|
|
53
|
+
: config.renderEditor
|
|
54
|
+
? (row) => panel.openEditPanel(row.id)
|
|
55
|
+
: undefined, renderRowActions: config.renderRowActions })) : config.renderCards ? (config.renderCards(rows, view, selectionContext, isLoading)) : (_jsx(AdminViewCards, { rows: rows, view: view, isLoading: isLoading, emptyLabel: config.emptyLabel ?? `No ${config.title.toLowerCase()} found`, onRowClick: (row) => panel.openEditPanel(row.id), selectedIdSet: selection.selectedIdSet, onToggleSelect: selection.toggle }))] }), config.renderFilterPanel && (_jsx(ListingFilterDrawer, { open: filterOpen, onClose: () => setFilterOpen(false), onApply: applyFilters, onClear: clearFilters, activeCount: activeFilterCount, children: config.renderFilterPanel({
|
|
56
|
+
pendingFilters,
|
|
57
|
+
setPendingFilters,
|
|
58
|
+
applyFilters,
|
|
59
|
+
clearFilters,
|
|
60
|
+
}) })), config.renderEditor && (_jsx(SideDrawer, { isOpen: isEditorOpen, onClose: panel.closePanel, title: editorTitle, mode: panel.isCreateOpen ? "create" : "edit", children: isEditorOpen &&
|
|
61
|
+
config.renderEditor({
|
|
62
|
+
isCreate: panel.isCreateOpen,
|
|
63
|
+
editId: panel.editId,
|
|
64
|
+
closePanel: panel.closePanel,
|
|
65
|
+
}) }))] }));
|
|
66
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export { DataTable } from "./DataTable";
|
|
2
2
|
export { QuickEditMenu } from "./QuickEditMenu";
|
|
3
3
|
export type { QuickEditAction, QuickEditMenuProps } from "./QuickEditMenu";
|
|
4
|
-
export {
|
|
5
|
-
export type { AdminListingScaffoldRow } from "./
|
|
4
|
+
export { DataListingView } from "./DataListingView";
|
|
5
|
+
export type { AdminListingScaffoldRow, ListingViewConfig, ListingSortOption, ListingPanelContext, ListingEditorContext, ListingSelectionContext, } from "./DataListingView";
|
|
6
6
|
export { DashboardStatsGrid } from "./DashboardStats";
|
|
7
7
|
export { AdminUsersView } from "./AdminUsersView";
|
|
8
8
|
export type { AdminUsersViewProps } from "./AdminUsersView";
|
|
@@ -34,6 +34,14 @@ export { AdminAddressEditorView } from "./AdminAddressEditorView";
|
|
|
34
34
|
export type { AdminAddressEditorViewProps } from "./AdminAddressEditorView";
|
|
35
35
|
export { AdminPrizeDrawsView } from "./AdminPrizeDrawsView";
|
|
36
36
|
export type { AdminPrizeDrawsViewProps } from "./AdminPrizeDrawsView";
|
|
37
|
+
export { AdminClassifiedView } from "./AdminClassifiedView";
|
|
38
|
+
export type { AdminClassifiedViewProps } from "./AdminClassifiedView";
|
|
39
|
+
export { AdminDigitalCodesView } from "./AdminDigitalCodesView";
|
|
40
|
+
export type { AdminDigitalCodesViewProps } from "./AdminDigitalCodesView";
|
|
41
|
+
export { AdminLiveView } from "./AdminLiveView";
|
|
42
|
+
export type { AdminLiveViewProps } from "./AdminLiveView";
|
|
43
|
+
export { AdminGroupedListingsView } from "./AdminGroupedListingsView";
|
|
44
|
+
export type { AdminGroupedListingsViewProps } from "./AdminGroupedListingsView";
|
|
37
45
|
export { AdminBundlesView } from "./AdminBundlesView";
|
|
38
46
|
export type { AdminBundlesViewProps } from "./AdminBundlesView";
|
|
39
47
|
export { AdminBundleEditorView } from "./AdminBundleEditorView";
|
|
@@ -133,8 +141,6 @@ export { AdminSidebar } from "./AdminSidebar";
|
|
|
133
141
|
export type { AdminSidebarProps, AdminNavItem, AdminNavGroup } from "./AdminSidebar";
|
|
134
142
|
export { AdminTopBar } from "./AdminTopBar";
|
|
135
143
|
export type { AdminTopBarProps } from "./AdminTopBar";
|
|
136
|
-
export { DemoSeedView } from "./DemoSeedView";
|
|
137
|
-
export type { DemoSeedViewProps } from "./DemoSeedView";
|
|
138
144
|
export { AdminTeamView } from "./AdminTeamView";
|
|
139
145
|
export type { AdminTeamViewProps } from "./AdminTeamView";
|
|
140
146
|
export { AdminEmployeeEditorView } from "./AdminEmployeeEditorView";
|