@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,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import React from "react";
|
|
4
4
|
import { useMutation, useQuery } from "@tanstack/react-query";
|
|
5
|
-
import { Button, Div, Form, Grid, Input, Select, Stack, StackedViewShell, Text, Toggle, useToast, } from "../../../ui";
|
|
5
|
+
import { Button, ConfirmDeleteModal, Div, Form, Grid, Input, Select, Stack, StackedViewShell, Text, Toggle, useToast, } from "../../../ui";
|
|
6
6
|
import { apiClient } from "../../../http";
|
|
7
7
|
import { ADMIN_ENDPOINTS } from "../../../constants/api-endpoints";
|
|
8
8
|
import { ERROR_MESSAGES } from "../../../errors/messages";
|
|
@@ -29,6 +29,7 @@ export function AdminFeatureEditorView({ featureId, fixedScope, fixedStoreId, em
|
|
|
29
29
|
const [productTypes, setProductTypes] = React.useState(["all"]);
|
|
30
30
|
const [storeId, setStoreId] = React.useState(fixedStoreId ?? "");
|
|
31
31
|
const [isActive, setIsActive] = React.useState(true);
|
|
32
|
+
const [deleteConfirmOpen, setDeleteConfirmOpen] = React.useState(false);
|
|
32
33
|
const [displayOrder, setDisplayOrder] = React.useState(String(PRODUCT_FEATURE_DEFAULT_DISPLAY_ORDER));
|
|
33
34
|
const createEndpoint = endpointOverride?.create ?? ADMIN_ENDPOINTS.PRODUCT_FEATURES;
|
|
34
35
|
const byIdEndpoint = endpointOverride?.byId ?? ADMIN_ENDPOINTS.PRODUCT_FEATURE_BY_ID;
|
|
@@ -138,13 +139,10 @@ export function AdminFeatureEditorView({ featureId, fixedScope, fixedStoreId, em
|
|
|
138
139
|
const checked = productTypes.includes(opt.value);
|
|
139
140
|
const pillClass = `${PILL_BASE_CLASS} ${checked ? PILL_CHECKED_CLASS : PILL_UNCHECKED_CLASS}`;
|
|
140
141
|
return (_jsxs("label", { className: pillClass, children: [_jsx("input", { type: "checkbox", className: "sr-only", checked: checked, onChange: () => toggleProductType(opt.value) }), opt.label] }, opt.value));
|
|
141
|
-
}) })] }), !fixedScope && (_jsx(Select, { label: "Scope", value: scope, onChange: (e) => setScope(e.target.value), options: PRODUCT_FEATURE_SCOPE_OPTIONS })), scope === "store" && !fixedStoreId && (_jsx(Select, { label: "Store", value: storeId, onChange: (e) => setStoreId(e.target.value), options: storeOptions, required: true, helperText: "Store-scope features are visible only on this store's listings." })), _jsx(Toggle, { label: "Active", checked: isActive, onChange: setIsActive }), _jsxs(Div, { className: "flex gap-3 pt-2", children: [_jsx(Button, { type: "submit", isLoading: isSubmitting, disabled: isDisabled, children: isEdit ? "Save changes" : "Create feature" }), isEdit && (_jsx(Button, { type: "button", variant: "danger", isLoading: deleteMutation.isPending, onClick: () =>
|
|
142
|
-
|
|
143
|
-
deleteMutation.mutate();
|
|
144
|
-
}
|
|
145
|
-
}, children: "Delete" }))] })] }) }, "feature-form"));
|
|
142
|
+
}) })] }), !fixedScope && (_jsx(Select, { label: "Scope", value: scope, onChange: (e) => setScope(e.target.value), options: PRODUCT_FEATURE_SCOPE_OPTIONS })), scope === "store" && !fixedStoreId && (_jsx(Select, { label: "Store", value: storeId, onChange: (e) => setStoreId(e.target.value), options: storeOptions, required: true, helperText: "Store-scope features are visible only on this store's listings." })), _jsx(Toggle, { label: "Active", checked: isActive, onChange: setIsActive }), _jsxs(Div, { className: "flex gap-3 pt-2", children: [_jsx(Button, { type: "submit", isLoading: isSubmitting, disabled: isDisabled, children: isEdit ? "Save changes" : "Create feature" }), isEdit && (_jsx(Button, { type: "button", variant: "danger", isLoading: deleteMutation.isPending, onClick: () => setDeleteConfirmOpen(true), children: "Delete" }))] })] }) }, "feature-form"));
|
|
143
|
+
const deleteModal = deleteConfirmOpen && (_jsx(ConfirmDeleteModal, { isOpen: true, title: "Delete Feature", message: DELETE_CONFIRM_TEXT, onConfirm: () => { deleteMutation.mutate(); setDeleteConfirmOpen(false); }, onClose: () => setDeleteConfirmOpen(false), isDeleting: deleteMutation.isPending }));
|
|
146
144
|
if (embedded) {
|
|
147
|
-
return
|
|
145
|
+
return _jsxs(Div, { className: "overflow-y-auto p-4", children: [formSection, deleteModal] });
|
|
148
146
|
}
|
|
149
|
-
return (_jsx(StackedViewShell, { portal: "admin", ...rest, title: isEdit ? "Edit Feature" : "New Feature", sections: [formSection] }));
|
|
147
|
+
return (_jsxs(_Fragment, { children: [_jsx(StackedViewShell, { portal: "admin", ...rest, title: isEdit ? "Edit Feature" : "New Feature", sections: [formSection] }), deleteModal] }));
|
|
150
148
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export
|
|
3
|
-
}
|
|
1
|
+
import type { ListingLayoutProps } from "../../../ui";
|
|
2
|
+
export type AdminFeaturesViewProps = ListingLayoutProps;
|
|
4
3
|
export declare function AdminFeaturesView({ children, ...props }: AdminFeaturesViewProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,37 +1,22 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as _jsx
|
|
3
|
-
import React
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { useBulkSelection } from "../../../react/hooks/useBulkSelection";
|
|
7
|
-
import { usePanelUrlSync } from "../../../react/hooks/use-panel-url-sync";
|
|
8
|
-
import { BulkActionBar, Button, Div, ListingToolbar, ListingViewShell, Pagination, Row, SideDrawer, Text, } from "../../../ui";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { useRouter, useSearchParams, usePathname } from "next/navigation";
|
|
5
|
+
import { ListingLayout, Row } from "../../../ui";
|
|
9
6
|
import { ADMIN_ENDPOINTS } from "../../../constants/api-endpoints";
|
|
10
7
|
import { ACTIONS } from "../../../_internal/shared/actions/action-registry";
|
|
11
|
-
import { toRecordArray, toRelativeDate, toStringValue,
|
|
12
|
-
import {
|
|
8
|
+
import { toRecordArray, toRelativeDate, toStringValue, } from "../hooks/useAdminListingData";
|
|
9
|
+
import { DataListingView } from "./DataListingView";
|
|
13
10
|
import { AdminFeatureEditorView } from "./AdminFeatureEditorView";
|
|
14
11
|
import { PRODUCT_FEATURE_SCOPE_TABS } from "../../products/constants/product-features.constants";
|
|
15
|
-
import { useBottomActions } from "../../layout";
|
|
16
12
|
const PAGE_SIZE = 50;
|
|
17
|
-
const DEFAULT_SORT = "displayOrder";
|
|
18
13
|
const DEFAULT_SCOPE = "platform";
|
|
19
|
-
const SORT_OPTIONS = [
|
|
20
|
-
{ value: "displayOrder", label: "Display order" },
|
|
21
|
-
{ value: "label", label: "Label A–Z" },
|
|
22
|
-
{ value: "-label", label: "Label Z–A" },
|
|
23
|
-
{ value: "-createdAt", label: "Newest" },
|
|
24
|
-
];
|
|
25
14
|
const STICKY_TABS_CLASS = "sticky top-[calc(var(--header-height,0px)+44px)] z-10 flex gap-2 bg-white/95 dark:bg-slate-900/95 backdrop-blur-sm border-b border-zinc-200 dark:border-slate-700 px-3 py-2";
|
|
26
15
|
const TAB_BASE_CLASS = "rounded-full px-3 py-1 text-xs font-medium border transition-colors";
|
|
27
16
|
const TAB_ACTIVE_CLASS = "bg-primary text-white border-primary";
|
|
28
17
|
const TAB_INACTIVE_CLASS = "border-zinc-300 dark:border-slate-600 text-zinc-700 dark:text-zinc-300 hover:bg-zinc-50 dark:hover:bg-slate-800";
|
|
29
|
-
const PAGINATION_BAR_CLASS = "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";
|
|
30
|
-
const ERROR_BANNER_CLASS = "mb-4 rounded-xl border border-red-200 bg-error-surface px-4 py-3 text-sm text-error dark:border-red-900/60";
|
|
31
18
|
function mapFeatureRow(item, index) {
|
|
32
|
-
const productTypes = Array.isArray(item.productTypes)
|
|
33
|
-
? item.productTypes
|
|
34
|
-
: [];
|
|
19
|
+
const productTypes = Array.isArray(item.productTypes) ? item.productTypes : [];
|
|
35
20
|
const isActive = typeof item.isActive === "boolean" ? item.isActive : true;
|
|
36
21
|
return {
|
|
37
22
|
id: toStringValue(item.id, `feature-${index}`),
|
|
@@ -39,9 +24,7 @@ function mapFeatureRow(item, index) {
|
|
|
39
24
|
secondary: [
|
|
40
25
|
toStringValue(item.category, ""),
|
|
41
26
|
productTypes.join(" · "),
|
|
42
|
-
item.scope === "store" && item.storeId
|
|
43
|
-
? `store: ${item.storeId}`
|
|
44
|
-
: "",
|
|
27
|
+
item.scope === "store" && item.storeId ? `store: ${item.storeId}` : "",
|
|
45
28
|
]
|
|
46
29
|
.filter(Boolean)
|
|
47
30
|
.join(" — "),
|
|
@@ -50,53 +33,57 @@ function mapFeatureRow(item, index) {
|
|
|
50
33
|
};
|
|
51
34
|
}
|
|
52
35
|
export function AdminFeaturesView({ children, ...props }) {
|
|
53
|
-
const
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}, [searchInput, table]);
|
|
67
|
-
const resetAll = React.useCallback(() => {
|
|
68
|
-
table.setMany({ q: "", sort: "", scope: DEFAULT_SCOPE });
|
|
69
|
-
setSearchInput("");
|
|
70
|
-
}, [table]);
|
|
71
|
-
const scopeFilter = table.get("scope") || DEFAULT_SCOPE;
|
|
72
|
-
const hasActiveState = !!table.get("q") ||
|
|
73
|
-
table.get("sort") !== DEFAULT_SORT ||
|
|
74
|
-
scopeFilter !== DEFAULT_SCOPE;
|
|
75
|
-
const { rows, total, isLoading, errorMessage } = useAdminListingData({
|
|
36
|
+
const searchParams = useSearchParams();
|
|
37
|
+
const scopeFilter = searchParams.get("scope") || DEFAULT_SCOPE;
|
|
38
|
+
if (React.Children.count(children) > 0) {
|
|
39
|
+
return (_jsx(ListingLayout, { portal: "admin", ...props, children: children }));
|
|
40
|
+
}
|
|
41
|
+
const config = {
|
|
42
|
+
portal: "admin",
|
|
43
|
+
title: "Features",
|
|
44
|
+
searchPlaceholder: "Search features by label",
|
|
45
|
+
emptyLabel: "No features found",
|
|
46
|
+
filterKeys: [],
|
|
47
|
+
defaultSort: "displayOrder",
|
|
48
|
+
pageSize: PAGE_SIZE,
|
|
76
49
|
queryKey: ["admin", "features", "listing", scopeFilter],
|
|
77
50
|
endpoint: `${ADMIN_ENDPOINTS.PRODUCT_FEATURES}?scope=${scopeFilter}`,
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
51
|
+
sortOptions: [
|
|
52
|
+
{ value: "displayOrder", label: "Display order" },
|
|
53
|
+
{ value: "label", label: "Label A–Z" },
|
|
54
|
+
{ value: "-label", label: "Label Z–A" },
|
|
55
|
+
{ value: "-createdAt", label: "Newest" },
|
|
56
|
+
],
|
|
82
57
|
mapRows: (response) => toRecordArray(response.items).map(mapFeatureRow),
|
|
83
58
|
getTotal: (response, mappedRows) => typeof response.total === "number" ? response.total : mappedRows.length,
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
59
|
+
buildFilters: () => undefined,
|
|
60
|
+
primaryAction: {
|
|
61
|
+
label: "Add Feature",
|
|
62
|
+
onClick: ({ openCreatePanel }) => openCreatePanel(),
|
|
63
|
+
},
|
|
64
|
+
buildBulkActions: (selection) => [
|
|
65
|
+
{
|
|
66
|
+
id: "delete",
|
|
67
|
+
label: ACTIONS.ADMIN["delete-feature"].label,
|
|
68
|
+
variant: "secondary",
|
|
69
|
+
onClick: () => selection.clearSelection(),
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
renderAboveContent: () => (_jsx(Row, { className: STICKY_TABS_CLASS, gap: "xs", children: PRODUCT_FEATURE_SCOPE_TABS.map((tab) => (_jsx(ScopeTabButton, { value: tab.value, label: tab.label, current: scopeFilter }, tab.value))) })),
|
|
73
|
+
renderEditor: ({ editId, closePanel }) => (_jsx(AdminFeatureEditorView, { featureId: editId ?? undefined, onSaved: closePanel, onDeleted: closePanel, embedded: true })),
|
|
74
|
+
resolveEditorTitle: ({ isCreate }) => (isCreate ? "Add Feature" : "Edit Feature"),
|
|
75
|
+
};
|
|
76
|
+
return _jsx(DataListingView, { config: config });
|
|
77
|
+
}
|
|
78
|
+
function ScopeTabButton({ value, label, current, }) {
|
|
79
|
+
const router = useRouter();
|
|
80
|
+
const pathname = usePathname();
|
|
81
|
+
const searchParams = useSearchParams();
|
|
82
|
+
const handleClick = () => {
|
|
83
|
+
const params = new URLSearchParams(searchParams.toString());
|
|
84
|
+
params.set("scope", value);
|
|
85
|
+
router.replace(`${pathname}?${params.toString()}`);
|
|
86
|
+
};
|
|
87
|
+
const isActive = current === value;
|
|
88
|
+
return (_jsx("button", { type: "button", onClick: handleClick, className: `${TAB_BASE_CLASS} ${isActive ? TAB_ACTIVE_CLASS : TAB_INACTIVE_CLASS}`, children: label }));
|
|
102
89
|
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* AdminGroupedListingsView — admin moderation view for grouped product listings.
|
|
5
|
+
* W1-29 — pairs with the new GET /api/admin/grouped-listings endpoint.
|
|
6
|
+
*/
|
|
7
|
+
import React from "react";
|
|
8
|
+
import { ListingLayout } from "../../../ui";
|
|
9
|
+
import { toRecordArray, toRelativeDate, toStringValue, } from "../hooks/useAdminListingData";
|
|
10
|
+
import { DataListingView } from "./DataListingView";
|
|
11
|
+
const ADMIN_GROUPED_LISTINGS_CONFIG = {
|
|
12
|
+
portal: "admin",
|
|
13
|
+
title: "Grouped Listings",
|
|
14
|
+
searchPlaceholder: "Search grouped listings by title or seller",
|
|
15
|
+
emptyLabel: "No grouped listings",
|
|
16
|
+
filterKeys: [],
|
|
17
|
+
defaultSort: "-createdAt",
|
|
18
|
+
queryKey: ["admin", "grouped-listings"],
|
|
19
|
+
endpoint: "/api/admin/grouped-listings",
|
|
20
|
+
sortOptions: [
|
|
21
|
+
{ value: "-createdAt", label: "Newest" },
|
|
22
|
+
{ value: "createdAt", label: "Oldest" },
|
|
23
|
+
{ value: "title", label: "Title A–Z" },
|
|
24
|
+
],
|
|
25
|
+
mapRows: (response) => toRecordArray(response.items).map((item, index) => ({
|
|
26
|
+
id: toStringValue(item.id, `grouped-listing-${index}`),
|
|
27
|
+
primary: toStringValue(item.title ?? item.name, "Untitled group"),
|
|
28
|
+
secondary: [
|
|
29
|
+
toStringValue(item.storeName ?? item.storeId, "Unknown store"),
|
|
30
|
+
`${Array.isArray(item.productIds) ? item.productIds.length : 0} items`,
|
|
31
|
+
].join(" · "),
|
|
32
|
+
status: toStringValue(item.isActive === false ? "inactive" : "active", "active"),
|
|
33
|
+
updatedAt: toRelativeDate(item.updatedAt ?? item.createdAt),
|
|
34
|
+
})),
|
|
35
|
+
getTotal: (response, mappedRows) => typeof response.total === "number" ? response.total : mappedRows.length,
|
|
36
|
+
buildFilters: () => "",
|
|
37
|
+
};
|
|
38
|
+
export function AdminGroupedListingsView({ children, ...props }) {
|
|
39
|
+
if (React.Children.count(children) > 0) {
|
|
40
|
+
return (_jsx(ListingLayout, { portal: "admin", ...props, children: children }));
|
|
41
|
+
}
|
|
42
|
+
return _jsx(DataListingView, { config: ADMIN_GROUPED_LISTINGS_CONFIG });
|
|
43
|
+
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export
|
|
3
|
-
}
|
|
1
|
+
import type { ListingLayoutProps } from "../../../ui";
|
|
2
|
+
export type AdminHistoryViewProps = ListingLayoutProps;
|
|
4
3
|
export declare function AdminHistoryView({ children, ...props }: AdminHistoryViewProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,61 +1,44 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as _jsx
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
/**
|
|
4
4
|
* AdminHistoryView — read-only admin insights for the top-level `history` collection.
|
|
5
5
|
* One row per user with item count + last visit. Mirrors AdminWishlistsView.
|
|
6
6
|
*/
|
|
7
|
-
import React
|
|
8
|
-
import {
|
|
9
|
-
import { useBulkSelection } from "../../../react/hooks/useBulkSelection";
|
|
10
|
-
import { ListingToolbar, Pagination, ListingViewShell } from "../../../ui";
|
|
7
|
+
import React from "react";
|
|
8
|
+
import { ListingLayout } from "../../../ui";
|
|
11
9
|
import { ADMIN_ENDPOINTS } from "../../../constants/api-endpoints";
|
|
12
|
-
import { toRecordArray, toRelativeDate, toStringValue,
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
10
|
+
import { toRecordArray, toRelativeDate, toStringValue, } from "../hooks/useAdminListingData";
|
|
11
|
+
import { DataListingView } from "./DataListingView";
|
|
12
|
+
const ADMIN_HISTORY_CONFIG = {
|
|
13
|
+
portal: "admin",
|
|
14
|
+
title: "History",
|
|
15
|
+
searchPlaceholder: "Search by user ID",
|
|
16
|
+
emptyLabel: "No user history records found",
|
|
17
|
+
filterKeys: [],
|
|
18
|
+
defaultSort: "-updatedAt",
|
|
19
|
+
queryKey: ["admin", "history", "listing"],
|
|
20
|
+
endpoint: ADMIN_ENDPOINTS.ADMIN_HISTORY,
|
|
21
|
+
sortOptions: [
|
|
22
|
+
{ value: "-updatedAt", label: "Recently active" },
|
|
23
|
+
{ value: "-itemCount", label: "Largest first" },
|
|
24
|
+
],
|
|
25
|
+
mapRows: (response) => toRecordArray(response.items).map((item, index) => {
|
|
26
|
+
const itemCount = typeof item.itemCount === "number" ? item.itemCount : 0;
|
|
27
|
+
const limit = typeof item.limit === "number" ? item.limit : 50;
|
|
28
|
+
return {
|
|
29
|
+
id: toStringValue(item.id, `hist-${index}`),
|
|
30
|
+
primary: toStringValue(item.userId, "Unknown user"),
|
|
31
|
+
secondary: `${itemCount} of ${limit} items`,
|
|
32
|
+
status: itemCount >= limit ? "At cap" : itemCount >= limit - 5 ? "Near cap" : "OK",
|
|
33
|
+
updatedAt: toRelativeDate(item.updatedAt),
|
|
34
|
+
};
|
|
35
|
+
}),
|
|
36
|
+
getTotal: (response, mappedRows) => typeof response.total === "number" ? response.total : mappedRows.length,
|
|
37
|
+
buildFilters: () => undefined,
|
|
38
|
+
};
|
|
21
39
|
export function AdminHistoryView({ children, ...props }) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const table = useUrlTable({ defaults: { pageSize: String(PAGE_SIZE), sort: DEFAULT_SORT } });
|
|
25
|
-
const [searchInput, setSearchInput] = useState(table.get("q") || "");
|
|
26
|
-
const resetAll = useCallback(() => {
|
|
27
|
-
table.setMany({ q: "", sort: "" });
|
|
28
|
-
setSearchInput("");
|
|
29
|
-
}, [table]);
|
|
30
|
-
const commitSearch = useCallback(() => {
|
|
31
|
-
table.set("q", searchInput.trim());
|
|
32
|
-
}, [searchInput, table]);
|
|
33
|
-
const hasActiveState = !!table.get("q") || table.get("sort") !== DEFAULT_SORT;
|
|
34
|
-
const { rows, total, isLoading, errorMessage } = useAdminListingData({
|
|
35
|
-
queryKey: ["admin", "history", "listing"],
|
|
36
|
-
endpoint: ADMIN_ENDPOINTS.ADMIN_HISTORY,
|
|
37
|
-
page: table.getNumber("page", 1),
|
|
38
|
-
pageSize: PAGE_SIZE,
|
|
39
|
-
sorts: table.get("sort") || DEFAULT_SORT,
|
|
40
|
-
q: table.get("q") || undefined,
|
|
41
|
-
mapRows: (response) => toRecordArray(response.items).map((item, index) => {
|
|
42
|
-
const itemCount = typeof item.itemCount === "number" ? item.itemCount : 0;
|
|
43
|
-
const limit = typeof item.limit === "number" ? item.limit : 50;
|
|
44
|
-
return {
|
|
45
|
-
id: toStringValue(item.id, `hist-${index}`),
|
|
46
|
-
primary: toStringValue(item.userId, "Unknown user"),
|
|
47
|
-
secondary: `${itemCount} of ${limit} items`,
|
|
48
|
-
status: itemCount >= limit ? "At cap" : itemCount >= limit - 5 ? "Near cap" : "OK",
|
|
49
|
-
updatedAt: toRelativeDate(item.updatedAt),
|
|
50
|
-
};
|
|
51
|
-
}),
|
|
52
|
-
getTotal: (response, mappedRows) => typeof response.total === "number" ? response.total : mappedRows.length,
|
|
53
|
-
});
|
|
54
|
-
const currentPage = table.getNumber("page", 1);
|
|
55
|
-
const totalPages = Math.ceil(total / PAGE_SIZE);
|
|
56
|
-
const selection = useBulkSelection({ items: rows, keyExtractor: (r) => r.id });
|
|
57
|
-
if (hasChildren) {
|
|
58
|
-
return _jsx(ListingViewShell, { portal: "admin", ...props, children: children });
|
|
40
|
+
if (React.Children.count(children) > 0) {
|
|
41
|
+
return (_jsx(ListingLayout, { portal: "admin", ...props, children: children }));
|
|
59
42
|
}
|
|
60
|
-
return
|
|
43
|
+
return _jsx(DataListingView, { config: ADMIN_HISTORY_CONFIG });
|
|
61
44
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { type
|
|
2
|
+
import { type ListingLayoutProps } from "../../../ui";
|
|
3
3
|
import type { AdminTableColumn } from "../types";
|
|
4
4
|
export interface AdminListingScaffoldRow {
|
|
5
5
|
id: string;
|
|
@@ -12,7 +12,7 @@ export interface AdminListingScaffoldRow {
|
|
|
12
12
|
isOnSale?: boolean;
|
|
13
13
|
isSold?: boolean;
|
|
14
14
|
}
|
|
15
|
-
interface AdminListingScaffoldProps extends
|
|
15
|
+
interface AdminListingScaffoldProps extends ListingLayoutProps {
|
|
16
16
|
title: string;
|
|
17
17
|
subtitle: string;
|
|
18
18
|
actionLabel?: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import React from "react";
|
|
4
|
-
import { Button, Div, Input,
|
|
4
|
+
import { Button, Div, Input, ListingLayout, Span, Text, } from "../../../ui";
|
|
5
5
|
import { AdminPageHeader } from "./AdminPageHeader";
|
|
6
6
|
import { DataTable } from "./DataTable";
|
|
7
7
|
const DEFAULT_FILTER_GROUPS = [
|
|
@@ -50,7 +50,7 @@ function renderActiveFilters(activeFilters) {
|
|
|
50
50
|
export function AdminListingScaffold({ title, subtitle, actionLabel, actionHref, columns, getRowHref, searchPlaceholder, rows, isLoading, errorMessage, emptyLabel, filterGroups, activeFilters, resultSummary, onSearch, searchValue, onClearFilters, renderRowActions, children, headerSlot, filterContent, activeFiltersSlot, resultCountSlot, searchSlot, sortSlot, actionsSlot, ...props }) {
|
|
51
51
|
const [localSearch, setLocalSearch] = React.useState(searchValue ?? "");
|
|
52
52
|
const hasChildren = React.Children.count(children) > 0;
|
|
53
|
-
return (_jsx(
|
|
53
|
+
return (_jsx(ListingLayout, { ...props, portal: "admin", headerSlot: headerSlot ?? (_jsx(AdminPageHeader, { title: title, subtitle: subtitle, actionLabel: actionLabel, onAction: () => undefined, themeConfig: {
|
|
54
54
|
gradient: "rounded-3xl border border-zinc-200 bg-gradient-to-r from-white to-zinc-50 dark:border-slate-800 dark:from-slate-950 dark:to-slate-900",
|
|
55
55
|
titleClass: "text-3xl font-bold text-zinc-950 dark:text-zinc-50",
|
|
56
56
|
subtitleClass: "text-sm text-zinc-600 dark:text-zinc-300",
|
|
@@ -64,5 +64,5 @@ export function AdminListingScaffold({ title, subtitle, actionLabel, actionHref,
|
|
|
64
64
|
} })), sortSlot: sortSlot ?? (_jsx(Button, { type: "button", variant: "outline", size: "sm", children: "Newest first" })), actionsSlot: actionsSlot ??
|
|
65
65
|
(actionLabel ? (actionHref ? (_jsx(Button, { type: "button", variant: "primary", size: "sm", onClick: () => {
|
|
66
66
|
window.location.href = actionHref;
|
|
67
|
-
}, children: actionLabel })) : (_jsx(Button, { type: "button", variant: "primary", size: "sm", children: actionLabel }))) : undefined), filterActiveCount: activeFilters?.length ?? 0, filterPendingCount: 0, errorSlot: errorMessage ? (_jsx(Div, { className: "rounded-xl border border-
|
|
67
|
+
}, children: actionLabel })) : (_jsx(Button, { type: "button", variant: "primary", size: "sm", children: actionLabel }))) : undefined), filterActiveCount: activeFilters?.length ?? 0, filterPendingCount: 0, errorSlot: errorMessage ? (_jsx(Div, { className: "rounded-xl border border-error/20 bg-error-surface px-4 py-3 text-sm text-error", children: errorMessage })) : undefined, children: hasChildren ? (children) : (_jsx(DataTable, { columns: columns ?? buildColumns(), rows: rows, isLoading: isLoading, emptyLabel: emptyLabel, getRowHref: getRowHref, renderRowActions: renderRowActions })) }));
|
|
68
68
|
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* AdminLiveView — admin browse of live-item listings (W1-29).
|
|
5
|
+
*/
|
|
6
|
+
import React from "react";
|
|
7
|
+
import { ListingLayout } from "../../../ui";
|
|
8
|
+
import { ADMIN_ENDPOINTS } from "../../../constants/api-endpoints";
|
|
9
|
+
import { toRecordArray, toRelativeDate, toRupees, toStringValue, } from "../hooks/useAdminListingData";
|
|
10
|
+
import { DataListingView } from "./DataListingView";
|
|
11
|
+
const ADMIN_LIVE_CONFIG = {
|
|
12
|
+
portal: "admin",
|
|
13
|
+
title: "Live Items",
|
|
14
|
+
searchPlaceholder: "Search live items",
|
|
15
|
+
emptyLabel: "No live item listings",
|
|
16
|
+
filterKeys: [],
|
|
17
|
+
defaultSort: "-createdAt",
|
|
18
|
+
queryKey: ["admin", "live-items", "listing"],
|
|
19
|
+
endpoint: ADMIN_ENDPOINTS.PRODUCTS,
|
|
20
|
+
sortOptions: [
|
|
21
|
+
{ value: "-createdAt", label: "Newest" },
|
|
22
|
+
{ value: "createdAt", label: "Oldest" },
|
|
23
|
+
{ value: "title", label: "Title A–Z" },
|
|
24
|
+
],
|
|
25
|
+
mapRows: (response) => toRecordArray(response.items).map((item, index) => {
|
|
26
|
+
const live = (item.liveItem ?? {});
|
|
27
|
+
return {
|
|
28
|
+
id: toStringValue(item.id, `live-${index}`),
|
|
29
|
+
primary: toStringValue(item.title ?? item.productTitle, "Untitled live item"),
|
|
30
|
+
secondary: [
|
|
31
|
+
toStringValue(item.sellerName, "Unknown seller"),
|
|
32
|
+
toRupees(item.price),
|
|
33
|
+
toStringValue(live.species, ""),
|
|
34
|
+
Boolean(live.vendorVerified) ? "verified" : "pending",
|
|
35
|
+
]
|
|
36
|
+
.filter(Boolean)
|
|
37
|
+
.join(" · "),
|
|
38
|
+
status: toStringValue(item.status, "draft"),
|
|
39
|
+
updatedAt: toRelativeDate(item.updatedAt ?? item.createdAt),
|
|
40
|
+
};
|
|
41
|
+
}),
|
|
42
|
+
getTotal: (response, mappedRows) => typeof response.total === "number" ? response.total : mappedRows.length,
|
|
43
|
+
buildFilters: () => "listingType==live",
|
|
44
|
+
};
|
|
45
|
+
export function AdminLiveView({ children, ...props }) {
|
|
46
|
+
if (React.Children.count(children) > 0) {
|
|
47
|
+
return (_jsx(ListingLayout, { portal: "admin", ...props, children: children }));
|
|
48
|
+
}
|
|
49
|
+
return _jsx(DataListingView, { config: ADMIN_LIVE_CONFIG });
|
|
50
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export interface AdminNewsletterViewProps extends
|
|
1
|
+
import type { ListingLayoutProps } from "../../../ui";
|
|
2
|
+
export interface AdminNewsletterViewProps extends ListingLayoutProps {
|
|
3
3
|
onBulkUnsubscribe?: (ids: string[]) => Promise<void>;
|
|
4
4
|
}
|
|
5
5
|
export declare function AdminNewsletterView({ children, onBulkUnsubscribe, ...props }: AdminNewsletterViewProps): import("react/jsx-runtime").JSX.Element;
|