@mohasinac/appkit 2.8.3 → 2.8.4
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/client.d.ts +2 -0
- package/dist/client.js +2 -0
- package/dist/core/hooks/useSiteSettings.d.ts +1 -1
- package/dist/features/account/hooks/useAccount.d.ts +2 -2
- package/dist/features/account/hooks/useAddressSelector.d.ts +1 -1
- package/dist/features/account/hooks/useAddresses.d.ts +2 -2
- package/dist/features/account/hooks/useNotifications.d.ts +1 -1
- package/dist/features/account/hooks/useProfile.d.ts +1 -1
- package/dist/features/account/hooks/usePublicProfile.d.ts +2 -2
- package/dist/features/admin/components/AdminAllEventEntriesView.js +5 -3
- package/dist/features/admin/components/AdminBidsView.js +6 -4
- package/dist/features/admin/components/AdminBlogView.js +6 -4
- package/dist/features/admin/components/AdminBrandsView.js +8 -6
- package/dist/features/admin/components/AdminBundlesView.js +10 -8
- package/dist/features/admin/components/AdminCartsView.js +6 -4
- package/dist/features/admin/components/AdminCategoriesView.js +7 -5
- package/dist/features/admin/components/AdminClassifiedView.js +4 -3
- package/dist/features/admin/components/AdminContactView.js +6 -4
- package/dist/features/admin/components/AdminCouponsView.js +6 -4
- package/dist/features/admin/components/AdminDigitalCodesView.js +4 -3
- package/dist/features/admin/components/AdminFaqsView.js +5 -3
- package/dist/features/admin/components/AdminFeaturesView.js +5 -4
- package/dist/features/admin/components/AdminGroupedListingsView.js +4 -3
- package/dist/features/admin/components/AdminHistoryView.js +4 -3
- package/dist/features/admin/components/AdminLiveView.js +4 -3
- package/dist/features/admin/components/AdminNewsletterView.js +5 -3
- package/dist/features/admin/components/AdminNotificationsView.js +6 -4
- package/dist/features/admin/components/AdminOrdersView.js +6 -4
- package/dist/features/admin/components/AdminPayoutsView.js +7 -5
- package/dist/features/admin/components/AdminPrizeDrawsView.js +6 -4
- package/dist/features/admin/components/AdminProductsView.js +7 -5
- package/dist/features/admin/components/AdminReturnRequestsView.js +4 -3
- package/dist/features/admin/components/AdminReviewsView.js +8 -6
- package/dist/features/admin/components/AdminScammersView.js +8 -6
- package/dist/features/admin/components/AdminSessionsView.js +6 -4
- package/dist/features/admin/components/AdminStoreAddressesView.js +2 -1
- package/dist/features/admin/components/AdminStoresView.js +6 -4
- package/dist/features/admin/components/AdminSublistingCategoriesView.js +6 -5
- package/dist/features/admin/components/AdminSupportTicketsView.js +8 -6
- package/dist/features/admin/components/AdminTeamView.js +6 -4
- package/dist/features/admin/components/AdminUsersView.js +6 -4
- package/dist/features/admin/components/AdminWishlistsView.js +4 -3
- package/dist/features/admin/constants/filter-tabs.d.ts +1 -1
- package/dist/features/admin/constants/filter-tabs.js +0 -11
- package/dist/features/admin/hooks/useAdmin.d.ts +1 -1
- package/dist/features/admin/hooks/useAdminSectionsListing.d.ts +1 -1
- package/dist/features/admin/hooks/useChat.d.ts +1 -1
- package/dist/features/admin/types/index.d.ts +1 -1
- package/dist/features/auctions/actions/bid-actions.js +4 -2
- package/dist/features/auctions/components/AuctionsListView.js +7 -6
- package/dist/features/auctions/hooks/useAuctions.d.ts +8 -8
- package/dist/features/auth/hooks/useAuth.d.ts +2 -2
- package/dist/features/blog/actions/blog-actions.js +3 -2
- package/dist/features/cart/hooks/useCart.d.ts +1 -1
- package/dist/features/cart/hooks/useCartQuery.d.ts +1 -1
- package/dist/features/cart/hooks/useCheckoutReadQueries.d.ts +2 -2
- package/dist/features/cart/hooks/useOrder.d.ts +2 -2
- package/dist/features/categories/components/BrandDetailPageView.js +10 -8
- package/dist/features/categories/components/CategoriesIndexListing.js +1 -1
- package/dist/features/categories/components/CategoriesIndexPageView.js +5 -4
- package/dist/features/categories/components/CategoryBundlesListing.js +5 -4
- package/dist/features/categories/components/CategoryDetailPageView.js +12 -10
- package/dist/features/categories/components/CategoryFilters.d.ts +12 -12
- package/dist/features/categories/components/CategoryFilters.js +13 -12
- package/dist/features/categories/components/CategoryTree.d.ts +1 -1
- package/dist/features/categories/components/CategoryTree.js +1 -1
- package/dist/features/categories/hooks/useCategories.d.ts +3 -3
- package/dist/features/categories/hooks/useCategorySelector.d.ts +3 -3
- package/dist/features/categories/hooks/useCategoryTree.d.ts +1 -1
- package/dist/features/categories/schemas/firestore.d.ts +2 -2
- package/dist/features/checkout/actions/checkout-actions.d.ts +1 -1
- package/dist/features/checkout/actions/checkout-actions.js +1 -1
- package/dist/features/checkout/hooks/useCheckoutApi.d.ts +2 -2
- package/dist/features/classified/components/ClassifiedListView.js +6 -5
- package/dist/features/collections/hooks/useCollections.d.ts +2 -2
- package/dist/features/cron/jobs/auction-expiry.job.d.ts +2 -2
- package/dist/features/cron/jobs/auction-expiry.job.js +2 -1
- package/dist/features/cron/jobs/preorder-reminder.job.d.ts +1 -1
- package/dist/features/cron/jobs/preorder-reminder.job.js +2 -1
- package/dist/features/digital-codes/components/DigitalCodesListView.js +4 -3
- package/dist/features/events/actions/event-actions.js +6 -4
- package/dist/features/events/components/AdminEventEditorView.js +1 -1
- package/dist/features/events/components/AdminEventsView.js +7 -5
- package/dist/features/events/components/EventFilters.d.ts +4 -4
- package/dist/features/events/components/EventFilters.js +2 -2
- package/dist/features/events/components/EventRafflesSection.js +4 -2
- package/dist/features/events/hooks/useEvent.d.ts +3 -3
- package/dist/features/events/hooks/useEvents.d.ts +1 -1
- package/dist/features/faq/actions/faq-actions.js +4 -2
- package/dist/features/faq/components/FAQPageContent.js +2 -1
- package/dist/features/faq/hooks/useFAQs.d.ts +1 -1
- package/dist/features/faq/hooks/useFaqList.d.ts +15 -15
- package/dist/features/homepage/components/MarketplaceHomepageView.js +4 -2
- package/dist/features/homepage/hooks/useBlogArticles.d.ts +1 -1
- package/dist/features/homepage/hooks/useFeaturedAuctions.d.ts +1 -1
- package/dist/features/homepage/hooks/useFeaturedPreOrders.d.ts +1 -1
- package/dist/features/homepage/hooks/useFeaturedProducts.d.ts +1 -1
- package/dist/features/homepage/hooks/useFeaturedStores.d.ts +1 -1
- package/dist/features/homepage/hooks/useHeroCarousel.d.ts +1 -1
- package/dist/features/homepage/hooks/useHomepageEvents.d.ts +1 -1
- package/dist/features/homepage/hooks/useHomepageReviews.d.ts +1 -1
- package/dist/features/homepage/hooks/useHomepageSections.d.ts +1 -1
- package/dist/features/homepage/hooks/useTopBrands.d.ts +1 -1
- package/dist/features/homepage/hooks/useTopCategories.d.ts +1 -1
- package/dist/features/layout/BottomActions.js +0 -27
- package/dist/features/layout/BottomActionsContext.d.ts +0 -36
- package/dist/features/layout/BottomActionsContext.js +0 -36
- package/dist/features/live/components/LiveItemsListView.js +6 -5
- package/dist/features/loyalty/hooks/useLoyaltyBalance.d.ts +1 -1
- package/dist/features/orders/hooks/useOrders.d.ts +2 -2
- package/dist/features/payments/hooks/usePayments.d.ts +1 -1
- package/dist/features/pre-orders/components/PreOrdersListView.js +5 -4
- package/dist/features/pre-orders/hooks/usePreOrders.d.ts +2 -2
- package/dist/features/products/actions/product-actions.js +17 -15
- package/dist/features/products/columns/index.d.ts +1 -1
- package/dist/features/products/columns/index.js +1 -1
- package/dist/features/products/components/PrizeDrawCollage.js +0 -14
- package/dist/features/products/components/PrizeDrawsListingView.js +5 -4
- package/dist/features/products/components/PrizeDrawsSection.js +4 -2
- package/dist/features/products/constants/sieve.d.ts +2 -2
- package/dist/features/products/constants/sieve.js +2 -2
- package/dist/features/products/hooks/useProductDetail.d.ts +1 -1
- package/dist/features/products/hooks/useRelatedProducts.d.ts +1 -1
- package/dist/features/products/hooks/useRelatedProducts.js +5 -4
- package/dist/features/promotions/hooks/usePromotions.d.ts +2 -2
- package/dist/features/reviews/actions/review-actions.js +2 -1
- package/dist/features/reviews/components/ReviewsIndexPageView.js +7 -6
- package/dist/features/reviews/hooks/useReviews.d.ts +2 -2
- package/dist/features/scams/actions/scam-actions.js +3 -2
- package/dist/features/scams/components/ScamRegistryView.js +5 -4
- package/dist/features/search/actions/search-actions.js +7 -6
- package/dist/features/search/hooks/useSearch.d.ts +2 -2
- package/dist/features/seller/components/CouponInlineSelect.js +2 -1
- package/dist/features/seller/components/SellerAuctionsView.js +7 -5
- package/dist/features/seller/components/SellerBidsView.js +5 -3
- package/dist/features/seller/components/SellerBundlesView.js +7 -6
- package/dist/features/seller/components/SellerClassifiedView.js +6 -5
- package/dist/features/seller/components/SellerCouponsView.js +6 -4
- package/dist/features/seller/components/SellerDigitalCodesView.js +5 -4
- package/dist/features/seller/components/SellerGroupedListingsView.js +5 -4
- package/dist/features/seller/components/SellerLiveView.js +6 -5
- package/dist/features/seller/components/SellerOffersView.js +6 -4
- package/dist/features/seller/components/SellerOrdersView.js +5 -3
- package/dist/features/seller/components/SellerPayoutMethodsView.js +3 -2
- package/dist/features/seller/components/SellerPayoutsView.js +6 -4
- package/dist/features/seller/components/SellerPreOrdersView.js +6 -4
- package/dist/features/seller/components/SellerPrizeDrawsView.js +6 -4
- package/dist/features/seller/components/SellerProductsView.js +9 -7
- package/dist/features/seller/components/SellerShippingConfigsView.js +3 -2
- package/dist/features/seller/components/SellerStoreCategoriesView.js +4 -3
- package/dist/features/seller/components/SellerTemplatesView.js +4 -3
- package/dist/features/seller/components/SublistingInlineSelect.js +2 -1
- package/dist/features/seller/hooks/useSellerPayouts.d.ts +3 -3
- package/dist/features/seller/hooks/useSellerStore.d.ts +6 -6
- package/dist/features/seller/hooks/useSellerStorefront.d.ts +2 -2
- package/dist/features/stores/actions/store-query-actions.js +3 -2
- package/dist/features/stores/components/StoreAuctionsPageView.js +4 -2
- package/dist/features/stores/components/StoreDetailLayoutView.d.ts +1 -1
- package/dist/features/stores/components/StoreDetailLayoutView.js +7 -6
- package/dist/features/stores/components/StorePreOrdersPageView.js +4 -2
- package/dist/features/stores/components/StorePrizeDrawsPageView.js +4 -2
- package/dist/features/stores/components/StoreProductsPageView.js +2 -1
- package/dist/features/stores/components/StoreProductsView.js +5 -4
- package/dist/features/stores/components/StoresIndexListing.js +4 -3
- package/dist/features/stores/hooks/useStoreAddressSelector.d.ts +1 -1
- package/dist/features/stores/hooks/useStores.d.ts +6 -6
- package/dist/features/wishlist/components/WishlistView.js +4 -3
- package/dist/features/wishlist/hooks/useUserWishlist.d.ts +15 -15
- package/dist/features/wishlist/hooks/useWishlist.d.ts +1 -1
- package/dist/features/wishlist/hooks/useWishlistWithGuest.d.ts +1 -1
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -62,6 +62,8 @@ export type { UseBulkSelectionOptions, UseBulkSelectionReturn } from "./react/ho
|
|
|
62
62
|
export { useEntityDelete } from "./react/hooks/useEntityDelete";
|
|
63
63
|
export type { UseEntityDeleteOptions, UseEntityDeleteReturn } from "./react/hooks/useEntityDelete";
|
|
64
64
|
export { ROUTES, PUBLIC_ROUTES, PROTECTED_ROUTES, AUTH_ROUTES } from "./constants/index";
|
|
65
|
+
export { SORT_DIR, sortBy } from "./constants/sort";
|
|
66
|
+
export { SIEVE_OP, sieveFilter, sieveAnd, sieveMultiEq } from "./utils/sieve-builder";
|
|
65
67
|
export { Container, Grid, Row, Stack } from "./ui/components/Layout";
|
|
66
68
|
export { Div } from "./ui/components/Div";
|
|
67
69
|
export { Main, Section, Nav, Ul, Ol, Li, Table, Thead, Tbody, Tr, Th, Td } from "./ui/components/Semantic";
|
package/dist/client.js
CHANGED
|
@@ -125,6 +125,8 @@ export { useBulkSelection } from "./react/hooks/useBulkSelection";
|
|
|
125
125
|
export { useEntityDelete } from "./react/hooks/useEntityDelete";
|
|
126
126
|
// Client-safe constants, UI primitives, and views
|
|
127
127
|
export { ROUTES, PUBLIC_ROUTES, PROTECTED_ROUTES, AUTH_ROUTES } from "./constants/index";
|
|
128
|
+
export { SORT_DIR, sortBy } from "./constants/sort";
|
|
129
|
+
export { SIEVE_OP, sieveFilter, sieveAnd, sieveMultiEq } from "./utils/sieve-builder";
|
|
128
130
|
export { Container, Grid, Row, Stack } from "./ui/components/Layout";
|
|
129
131
|
export { Div } from "./ui/components/Div";
|
|
130
132
|
export { Main, Section, Nav, Ul, Ol, Li, Table, Thead, Tbody, Tr, Th, Td } from "./ui/components/Semantic";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function useSiteSettings<T = unknown>(endpoint?: "/api/site-settings", staleTime?: number): import("@tanstack/react-query").UseQueryResult<NoInfer<T>, Error>;
|
|
1
|
+
export declare function useSiteSettings<T = unknown>(endpoint?: "/api/site-settings", staleTime?: number): import("@tanstack/react-query").UseQueryResult<import("@tanstack/query-core").NoInfer<T>, Error>;
|
|
@@ -5,9 +5,9 @@ interface UseProfileOptions {
|
|
|
5
5
|
endpoint?: string;
|
|
6
6
|
}
|
|
7
7
|
export declare function useProfile(userId: string, opts?: UseProfileOptions): {
|
|
8
|
-
profile:
|
|
8
|
+
profile: UserProfile | undefined;
|
|
9
9
|
isLoading: boolean;
|
|
10
10
|
error: Error | null;
|
|
11
|
-
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<
|
|
11
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<UserProfile, Error>>;
|
|
12
12
|
};
|
|
13
13
|
export {};
|
|
@@ -18,7 +18,7 @@ export declare function useAddressSelector(options?: {
|
|
|
18
18
|
}): {
|
|
19
19
|
addresses: SavedAddress[];
|
|
20
20
|
isLoading: boolean;
|
|
21
|
-
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<
|
|
21
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<SavedAddress[], Error>>;
|
|
22
22
|
createAddress: import("@tanstack/react-query").UseMutateFunction<CreateAddressApiResponse, Error, AddressFormData, unknown>;
|
|
23
23
|
isSaving: boolean;
|
|
24
24
|
};
|
|
@@ -36,11 +36,11 @@ export declare function useAddresses(options?: {
|
|
|
36
36
|
enabled?: boolean;
|
|
37
37
|
listEndpoint?: string;
|
|
38
38
|
filters?: AddressFilterParams;
|
|
39
|
-
}): import("@tanstack/react-query").UseQueryResult<
|
|
39
|
+
}): import("@tanstack/react-query").UseQueryResult<Address[], Error>;
|
|
40
40
|
export declare function useAddress(id: string, options?: {
|
|
41
41
|
enabled?: boolean;
|
|
42
42
|
byIdEndpoint?: (id: string) => string;
|
|
43
|
-
}): import("@tanstack/react-query").UseQueryResult<
|
|
43
|
+
}): import("@tanstack/react-query").UseQueryResult<Address, Error>;
|
|
44
44
|
export declare function useCreateAddress(options?: {
|
|
45
45
|
listEndpoint?: string;
|
|
46
46
|
onSuccess?: (data: Address) => void;
|
|
@@ -16,7 +16,7 @@ export declare function useNotifications<TNotification = any>(limit?: number, op
|
|
|
16
16
|
notifications: TNotification[];
|
|
17
17
|
unreadCount: number;
|
|
18
18
|
isLoading: boolean;
|
|
19
|
-
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<
|
|
19
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<NotificationsResponse<TNotification>, Error>>;
|
|
20
20
|
markRead: import("@tanstack/react-query").UseMutateFunction<unknown, Error, string, unknown>;
|
|
21
21
|
markAllRead: import("@tanstack/react-query").UseMutateFunction<unknown, Error, void, unknown>;
|
|
22
22
|
isMarkingAll: boolean;
|
|
@@ -19,7 +19,7 @@ export interface UpdateCurrentProfileInput {
|
|
|
19
19
|
export declare function useCurrentProfile(options?: {
|
|
20
20
|
enabled?: boolean;
|
|
21
21
|
endpoint?: string;
|
|
22
|
-
}): import("@tanstack/react-query").UseQueryResult<
|
|
22
|
+
}): import("@tanstack/react-query").UseQueryResult<UserProfile, Error>;
|
|
23
23
|
export declare function useUpdateCurrentProfile(options?: {
|
|
24
24
|
onSuccess?: (data: unknown) => void;
|
|
25
25
|
onError?: (error: Error) => void;
|
|
@@ -71,8 +71,8 @@ export declare function usePublicProfile(userId: string, options?: PublicProfile
|
|
|
71
71
|
loading: boolean;
|
|
72
72
|
profileError: string;
|
|
73
73
|
isSeller: boolean;
|
|
74
|
-
productsData:
|
|
74
|
+
productsData: ProductsApiResponse | undefined;
|
|
75
75
|
productsLoading: boolean;
|
|
76
|
-
reviewsData:
|
|
76
|
+
reviewsData: SellerReviewsData | undefined;
|
|
77
77
|
reviewsLoading: boolean;
|
|
78
78
|
};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { sieveFilter, SIEVE_OP } from "@mohasinac/appkit";
|
|
4
|
+
import { sortBy } from "@mohasinac/appkit";
|
|
3
5
|
import React from "react";
|
|
4
6
|
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
5
7
|
import { FilterChipGroup, ListingLayout, RowActionMenu, useToast } from "../../../ui";
|
|
@@ -33,11 +35,11 @@ export function AdminAllEventEntriesView({ children, ...props }) {
|
|
|
33
35
|
searchPlaceholder: "Search by user name or event ID",
|
|
34
36
|
emptyLabel: "No entries found",
|
|
35
37
|
filterKeys: ["status"],
|
|
36
|
-
defaultSort: "
|
|
38
|
+
defaultSort: sortBy("submittedAt", "DESC"),
|
|
37
39
|
queryKey: ["admin", "event-entries", "listing"],
|
|
38
40
|
endpoint: ADMIN_ENDPOINTS.ADMIN_EVENT_ENTRIES,
|
|
39
41
|
sortOptions: [
|
|
40
|
-
{ value: "
|
|
42
|
+
{ value: sortBy("submittedAt", "DESC"), label: "Newest" },
|
|
41
43
|
{ value: "submittedAt", label: "Oldest" },
|
|
42
44
|
],
|
|
43
45
|
mapRows: (response) => toRecordArray(response.items).map((item, index) => ({
|
|
@@ -51,7 +53,7 @@ export function AdminAllEventEntriesView({ children, ...props }) {
|
|
|
51
53
|
eventId: toStringValue(item.eventId, ""),
|
|
52
54
|
})),
|
|
53
55
|
getTotal: (response, mappedRows) => typeof response.total === "number" ? response.total : mappedRows.length,
|
|
54
|
-
buildFilters: (state) => state.status && state.status !== "All" ?
|
|
56
|
+
buildFilters: (state) => state.status && state.status !== "All" ? sieveFilter("status", SIEVE_OP.EQ, state.status) : undefined,
|
|
55
57
|
renderRowActions: (row) => (_jsx(RowActionMenu, { actions: [
|
|
56
58
|
{
|
|
57
59
|
label: ACTIONS.ADMIN["confirm-entry"].label,
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { sieveFilter, SIEVE_OP } from "@mohasinac/appkit";
|
|
4
|
+
import { sortBy } from "@mohasinac/appkit";
|
|
3
5
|
import React, { useState } from "react";
|
|
4
6
|
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
5
7
|
import { ConfirmDeleteModal, FilterChipGroup, ListingLayout, RowActionMenu, useToast } from "../../../ui";
|
|
@@ -38,13 +40,13 @@ export function AdminBidsView({ children, ...props }) {
|
|
|
38
40
|
searchPlaceholder: "Search bids, products, or bidder IDs",
|
|
39
41
|
emptyLabel: "No bids found",
|
|
40
42
|
filterKeys: ["status"],
|
|
41
|
-
defaultSort: "
|
|
43
|
+
defaultSort: sortBy("bidTime", "DESC"),
|
|
42
44
|
queryKey: ["admin", "bids", "listing"],
|
|
43
45
|
endpoint: ADMIN_ENDPOINTS.BIDS,
|
|
44
46
|
sortOptions: [
|
|
45
|
-
{ value: "
|
|
47
|
+
{ value: sortBy("bidTime", "DESC"), label: "Newest" },
|
|
46
48
|
{ value: "bidTime", label: "Oldest" },
|
|
47
|
-
{ value: "
|
|
49
|
+
{ value: sortBy("amount", "DESC"), label: "Highest amount" },
|
|
48
50
|
],
|
|
49
51
|
mapRows: (response) => toRecordArray(response.items).map((item, index) => ({
|
|
50
52
|
id: toStringValue(item.id, `bid-${index}`),
|
|
@@ -57,7 +59,7 @@ export function AdminBidsView({ children, ...props }) {
|
|
|
57
59
|
updatedAt: toRelativeDate(item.bidTime ?? item.bidDate ?? item.updatedAt ?? item.createdAt),
|
|
58
60
|
})),
|
|
59
61
|
getTotal: (response, mappedRows) => typeof response.total === "number" ? response.total : mappedRows.length,
|
|
60
|
-
buildFilters: (state) => state.status && state.status !== "All" ?
|
|
62
|
+
buildFilters: (state) => state.status && state.status !== "All" ? sieveFilter("status", SIEVE_OP.EQ, state.status) : undefined,
|
|
61
63
|
buildBulkActions: (selection) => [
|
|
62
64
|
{
|
|
63
65
|
id: ROW_ACTION_ID.CANCEL,
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { sieveFilter, SIEVE_OP } from "@mohasinac/appkit";
|
|
4
|
+
import { sortBy } from "@mohasinac/appkit";
|
|
3
5
|
import React from "react";
|
|
4
6
|
import { FilterChipGroup, ListingLayout } from "../../../ui";
|
|
5
7
|
import { ADMIN_ENDPOINTS } from "../../../constants/api-endpoints";
|
|
@@ -22,13 +24,13 @@ export function AdminBlogView({ children, ...props }) {
|
|
|
22
24
|
searchPlaceholder: "Search articles, authors, or tags",
|
|
23
25
|
emptyLabel: "No blog posts found",
|
|
24
26
|
filterKeys: ["status", "isFeatured"],
|
|
25
|
-
defaultSort: "
|
|
27
|
+
defaultSort: sortBy("publishedAt", "DESC"),
|
|
26
28
|
queryKey: ["admin", "blog", "listing"],
|
|
27
29
|
endpoint: ADMIN_ENDPOINTS.BLOG,
|
|
28
30
|
sortOptions: [
|
|
29
|
-
{ value: "
|
|
31
|
+
{ value: sortBy("publishedAt", "DESC"), label: "Latest" },
|
|
30
32
|
{ value: "publishedAt", label: "Oldest" },
|
|
31
|
-
{ value: "
|
|
33
|
+
{ value: sortBy("createdAt", "DESC"), label: "Newest draft" },
|
|
32
34
|
{ value: "title", label: "Title A–Z" },
|
|
33
35
|
],
|
|
34
36
|
mapRows: (response) => toRecordArray(response.posts).map((item, index) => ({
|
|
@@ -51,7 +53,7 @@ export function AdminBlogView({ children, ...props }) {
|
|
|
51
53
|
buildFilters: (state) => {
|
|
52
54
|
const filterParts = [];
|
|
53
55
|
if (state.status && state.status !== "All")
|
|
54
|
-
filterParts.push(
|
|
56
|
+
filterParts.push(sieveFilter("status", SIEVE_OP.EQ, state.status));
|
|
55
57
|
if (state.isFeatured === "true")
|
|
56
58
|
filterParts.push("isFeatured==true");
|
|
57
59
|
return filterParts.join(",") || undefined;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { sieveFilter, SIEVE_OP } from "@mohasinac/appkit";
|
|
4
|
+
import { sortBy } from "@mohasinac/appkit";
|
|
3
5
|
import React from "react";
|
|
4
6
|
import { Div, ListingLayout, Text } from "../../../ui";
|
|
5
7
|
import { ADMIN_ENDPOINTS } from "../../../constants/api-endpoints";
|
|
@@ -34,14 +36,14 @@ const ADMIN_BRANDS_CONFIG = {
|
|
|
34
36
|
searchPlaceholder: "Search brands by name or slug",
|
|
35
37
|
emptyLabel: "No brands found",
|
|
36
38
|
filterKeys: ["isActive"],
|
|
37
|
-
defaultSort: "displayOrder",
|
|
39
|
+
defaultSort: sortBy("displayOrder", "ASC"),
|
|
38
40
|
queryKey: ["admin", "brands", "listing"],
|
|
39
41
|
endpoint: ADMIN_ENDPOINTS.BRANDS,
|
|
40
42
|
sortOptions: [
|
|
41
|
-
{ value: "displayOrder", label: "Display order" },
|
|
42
|
-
{ value: "name", label: "Name A–Z" },
|
|
43
|
-
{ value: "
|
|
44
|
-
{ value: "
|
|
43
|
+
{ value: sortBy("displayOrder", "ASC"), label: "Display order" },
|
|
44
|
+
{ value: sortBy("name", "ASC"), label: "Name A–Z" },
|
|
45
|
+
{ value: sortBy("name", "DESC"), label: "Name Z–A" },
|
|
46
|
+
{ value: sortBy("createdAt", "DESC"), label: "Newest" },
|
|
45
47
|
],
|
|
46
48
|
columns: COLUMNS,
|
|
47
49
|
mapRows: (response) => toRecordArray(response.items).map((item, index) => ({
|
|
@@ -56,7 +58,7 @@ const ADMIN_BRANDS_CONFIG = {
|
|
|
56
58
|
updatedAt: toRelativeDate(item.updatedAt ?? item.createdAt),
|
|
57
59
|
})),
|
|
58
60
|
getTotal: (response, mappedRows) => typeof response.total === "number" ? response.total : mappedRows.length,
|
|
59
|
-
buildFilters: (state) => state.isActive ?
|
|
61
|
+
buildFilters: (state) => state.isActive ? sieveFilter("isActive", SIEVE_OP.EQ, state.isActive) : undefined,
|
|
60
62
|
primaryAction: {
|
|
61
63
|
label: "Add Brand",
|
|
62
64
|
onClick: ({ openCreatePanel }) => openCreatePanel(),
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { sieveFilter, SIEVE_OP } from "@mohasinac/appkit";
|
|
4
|
+
import { sortBy } from "@mohasinac/appkit";
|
|
3
5
|
import { useState, useCallback } from "react";
|
|
4
6
|
import { Badge, Button, Div, Stack, Text, useToast } from "../../../ui";
|
|
5
7
|
import { ADMIN_ENDPOINTS } from "../../../constants/api-endpoints";
|
|
@@ -61,16 +63,16 @@ export function AdminBundlesView({ getEditHref, newHref }) {
|
|
|
61
63
|
searchPlaceholder: "Search bundles by name or slug…",
|
|
62
64
|
emptyLabel: BUNDLE_COPY.adminList.empty,
|
|
63
65
|
filterKeys: ["isActive", "bundleStockStatus"],
|
|
64
|
-
defaultSort: "name",
|
|
66
|
+
defaultSort: sortBy("name", "ASC"),
|
|
65
67
|
queryKey: ["admin", "bundles", "listing"],
|
|
66
68
|
endpoint: ADMIN_ENDPOINTS.BUNDLES,
|
|
67
69
|
sortOptions: [
|
|
68
|
-
{ value: "name", label: "Name A–Z" },
|
|
69
|
-
{ value: "
|
|
70
|
-
{ value: "
|
|
70
|
+
{ value: sortBy("name", "ASC"), label: "Name A–Z" },
|
|
71
|
+
{ value: sortBy("name", "DESC"), label: "Name Z–A" },
|
|
72
|
+
{ value: sortBy("bundlePriceInPaise", "DESC"), label: "Price high→low" },
|
|
71
73
|
{ value: "bundlePriceInPaise", label: "Price low→high" },
|
|
72
|
-
{ value: "
|
|
73
|
-
{ value: "createdAt", label: "Oldest" },
|
|
74
|
+
{ value: sortBy("createdAt", "DESC"), label: "Newest" },
|
|
75
|
+
{ value: sortBy("createdAt", "ASC"), label: "Oldest" },
|
|
74
76
|
],
|
|
75
77
|
columns: COLUMNS,
|
|
76
78
|
mapRows: (response) => toRecordArray(response.items).map((item, index) => ({
|
|
@@ -90,9 +92,9 @@ export function AdminBundlesView({ getEditHref, newHref }) {
|
|
|
90
92
|
buildFilters: (filterState) => {
|
|
91
93
|
const parts = [];
|
|
92
94
|
if (filterState.isActive)
|
|
93
|
-
parts.push(
|
|
95
|
+
parts.push(sieveFilter("isActive", SIEVE_OP.EQ, filterState.isActive));
|
|
94
96
|
if (filterState.bundleStockStatus)
|
|
95
|
-
parts.push(
|
|
97
|
+
parts.push(sieveFilter("bundleStockStatus", SIEVE_OP.EQ, filterState.bundleStockStatus));
|
|
96
98
|
return parts.join(",") || undefined;
|
|
97
99
|
},
|
|
98
100
|
getRowHref: getEditHref,
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { sieveFilter, SIEVE_OP } from "@mohasinac/appkit";
|
|
4
|
+
import { sortBy } from "@mohasinac/appkit";
|
|
3
5
|
import React from "react";
|
|
4
6
|
import { FilterChipGroup, ListingLayout } from "../../../ui";
|
|
5
7
|
import { ADMIN_ENDPOINTS } from "../../../constants/api-endpoints";
|
|
@@ -12,12 +14,12 @@ const ADMIN_CARTS_CONFIG = {
|
|
|
12
14
|
searchPlaceholder: "Search by user ID or session",
|
|
13
15
|
emptyLabel: "No carts found",
|
|
14
16
|
filterKeys: ["type"],
|
|
15
|
-
defaultSort: "
|
|
17
|
+
defaultSort: sortBy("updatedAt", "DESC"),
|
|
16
18
|
queryKey: ["admin", "carts", "listing"],
|
|
17
19
|
endpoint: ADMIN_ENDPOINTS.ADMIN_CARTS,
|
|
18
20
|
sortOptions: [
|
|
19
|
-
{ value: "
|
|
20
|
-
{ value: "updatedAt", label: "Oldest" },
|
|
21
|
+
{ value: sortBy("updatedAt", "DESC"), label: "Recently updated" },
|
|
22
|
+
{ value: sortBy("updatedAt", "ASC"), label: "Oldest" },
|
|
21
23
|
],
|
|
22
24
|
mapRows: (response) => toRecordArray(response.items).map((item, index) => {
|
|
23
25
|
const isGuest = !item.userId;
|
|
@@ -34,7 +36,7 @@ const ADMIN_CARTS_CONFIG = {
|
|
|
34
36
|
};
|
|
35
37
|
}),
|
|
36
38
|
getTotal: (response, mappedRows) => typeof response.total === "number" ? response.total : mappedRows.length,
|
|
37
|
-
buildFilters: (state) => state.type && state.type !== "All" ?
|
|
39
|
+
buildFilters: (state) => state.type && state.type !== "All" ? sieveFilter("type", SIEVE_OP.EQ, state.type) : undefined,
|
|
38
40
|
renderFilterPanel: ({ pendingFilters, setPendingFilters }) => (_jsx(FilterChipGroup, { label: "Type", tabs: ADMIN_CART_OWNERSHIP_TABS, value: pendingFilters.type ?? "", onChange: (id) => setPendingFilters((p) => ({ ...p, type: id })) })),
|
|
39
41
|
};
|
|
40
42
|
export function AdminCartsView({ children, ...props }) {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { sieveFilter, SIEVE_OP } from "@mohasinac/appkit";
|
|
4
|
+
import { sortBy } from "@mohasinac/appkit";
|
|
3
5
|
import React from "react";
|
|
4
6
|
import { Div, Heading, ListingLayout, Span, Text } from "../../../ui";
|
|
5
7
|
import { CATEGORY_ENDPOINTS } from "../../../constants/api-endpoints";
|
|
@@ -33,14 +35,14 @@ const ADMIN_CATEGORIES_CONFIG = {
|
|
|
33
35
|
searchPlaceholder: "Search categories, slugs, or parent category",
|
|
34
36
|
emptyLabel: "No categories found",
|
|
35
37
|
filterKeys: ["isActive", "isFeatured"],
|
|
36
|
-
defaultSort: "name",
|
|
38
|
+
defaultSort: sortBy("name", "ASC"),
|
|
37
39
|
pageSize: 50,
|
|
38
40
|
queryKey: ["admin", "categories", "listing"],
|
|
39
41
|
endpoint: `${CATEGORY_ENDPOINTS.LIST}?flat=true`,
|
|
40
42
|
sortOptions: [
|
|
41
|
-
{ value: "name", label: "Name A–Z" },
|
|
42
|
-
{ value: "
|
|
43
|
-
{ value: "
|
|
43
|
+
{ value: sortBy("name", "ASC"), label: "Name A–Z" },
|
|
44
|
+
{ value: sortBy("name", "DESC"), label: "Name Z–A" },
|
|
45
|
+
{ value: sortBy("createdAt", "DESC"), label: "Newest" },
|
|
44
46
|
],
|
|
45
47
|
columns: COLUMNS,
|
|
46
48
|
mapRows: (response) => {
|
|
@@ -61,7 +63,7 @@ const ADMIN_CATEGORIES_CONFIG = {
|
|
|
61
63
|
buildFilters: (state) => {
|
|
62
64
|
const parts = [];
|
|
63
65
|
if (state.isActive)
|
|
64
|
-
parts.push(
|
|
66
|
+
parts.push(sieveFilter("isActive", SIEVE_OP.EQ, state.isActive));
|
|
65
67
|
if (state.isFeatured === "true")
|
|
66
68
|
parts.push("isFeatured==true");
|
|
67
69
|
return parts.join(",") || undefined;
|
|
@@ -4,6 +4,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
4
4
|
* AdminClassifiedView — admin browse of classified listings (W1-29).
|
|
5
5
|
* Read-only summary with edit-handoff to the seller-portal edit route.
|
|
6
6
|
*/
|
|
7
|
+
import { sortBy } from "@mohasinac/appkit";
|
|
7
8
|
import React from "react";
|
|
8
9
|
import { ListingLayout } from "../../../ui";
|
|
9
10
|
import { ADMIN_ENDPOINTS } from "../../../constants/api-endpoints";
|
|
@@ -15,12 +16,12 @@ const ADMIN_CLASSIFIED_CONFIG = {
|
|
|
15
16
|
searchPlaceholder: "Search classified by name or seller",
|
|
16
17
|
emptyLabel: "No classified listings",
|
|
17
18
|
filterKeys: [],
|
|
18
|
-
defaultSort: "
|
|
19
|
+
defaultSort: sortBy("createdAt", "DESC"),
|
|
19
20
|
queryKey: ["admin", "classified", "listing"],
|
|
20
21
|
endpoint: ADMIN_ENDPOINTS.PRODUCTS,
|
|
21
22
|
sortOptions: [
|
|
22
|
-
{ value: "
|
|
23
|
-
{ value: "createdAt", label: "Oldest" },
|
|
23
|
+
{ value: sortBy("createdAt", "DESC"), label: "Newest" },
|
|
24
|
+
{ value: sortBy("createdAt", "ASC"), label: "Oldest" },
|
|
24
25
|
{ value: "title", label: "Title A–Z" },
|
|
25
26
|
],
|
|
26
27
|
mapRows: (response) => toRecordArray(response.items).map((item, index) => ({
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { sieveFilter, SIEVE_OP } from "@mohasinac/appkit";
|
|
4
|
+
import { sortBy } from "@mohasinac/appkit";
|
|
3
5
|
import React, { useState } from "react";
|
|
4
6
|
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
5
7
|
import { ConfirmDeleteModal, FilterChipGroup, ListingLayout, RowActionMenu, useToast } from "../../../ui";
|
|
@@ -53,12 +55,12 @@ export function AdminContactView({ children, onBulkMarkRead, onBulkArchive, onBu
|
|
|
53
55
|
searchPlaceholder: "Search by subject, name, or email",
|
|
54
56
|
emptyLabel: "No contact submissions found",
|
|
55
57
|
filterKeys: ["status"],
|
|
56
|
-
defaultSort: "
|
|
58
|
+
defaultSort: sortBy("createdAt", "DESC"),
|
|
57
59
|
queryKey: ["admin", "contact", "listing"],
|
|
58
60
|
endpoint: ADMIN_ENDPOINTS.CONTACT_SUBMISSIONS,
|
|
59
61
|
sortOptions: [
|
|
60
|
-
{ value: "
|
|
61
|
-
{ value: "createdAt", label: "Oldest" },
|
|
62
|
+
{ value: sortBy("createdAt", "DESC"), label: "Newest" },
|
|
63
|
+
{ value: sortBy("createdAt", "ASC"), label: "Oldest" },
|
|
62
64
|
],
|
|
63
65
|
mapRows: (response) => toRecordArray(response.submissions).map((item, index) => ({
|
|
64
66
|
id: toStringValue(item.id, `msg-${index}`),
|
|
@@ -77,7 +79,7 @@ export function AdminContactView({ children, onBulkMarkRead, onBulkArchive, onBu
|
|
|
77
79
|
return response.meta.total;
|
|
78
80
|
return mappedRows.length;
|
|
79
81
|
},
|
|
80
|
-
buildFilters: (f) => (f.status && f.status !== "All" ?
|
|
82
|
+
buildFilters: (f) => (f.status && f.status !== "All" ? sieveFilter("status", SIEVE_OP.EQ, f.status) : undefined),
|
|
81
83
|
buildBulkActions: (selection) => [
|
|
82
84
|
...(onBulkMarkRead
|
|
83
85
|
? [
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { sieveFilter, SIEVE_OP } from "@mohasinac/appkit";
|
|
4
|
+
import { sortBy } from "@mohasinac/appkit";
|
|
3
5
|
import React, { useCallback } from "react";
|
|
4
6
|
import { useQueryClient } from "@tanstack/react-query";
|
|
5
7
|
import { Div, FilterChipGroup, ListingLayout, Text, useToast } from "../../../ui";
|
|
@@ -47,12 +49,12 @@ export function AdminCouponsView({ children, onBulkArchive, onBulkDelete, ...pro
|
|
|
47
49
|
searchPlaceholder: "Search codes, campaigns, or seller scopes",
|
|
48
50
|
emptyLabel: "No coupons found",
|
|
49
51
|
filterKeys: ["type"],
|
|
50
|
-
defaultSort: "
|
|
52
|
+
defaultSort: sortBy("createdAt", "DESC"),
|
|
51
53
|
queryKey: ["admin", "coupons", "listing"],
|
|
52
54
|
endpoint: ADMIN_ENDPOINTS.COUPONS,
|
|
53
55
|
sortOptions: [
|
|
54
|
-
{ value: "
|
|
55
|
-
{ value: "createdAt", label: "Oldest" },
|
|
56
|
+
{ value: sortBy("createdAt", "DESC"), label: "Newest" },
|
|
57
|
+
{ value: sortBy("createdAt", "ASC"), label: "Oldest" },
|
|
56
58
|
{ value: "code", label: "Code A–Z" },
|
|
57
59
|
],
|
|
58
60
|
hideTableView: true,
|
|
@@ -61,7 +63,7 @@ export function AdminCouponsView({ children, onBulkArchive, onBulkDelete, ...pro
|
|
|
61
63
|
raw: item,
|
|
62
64
|
})),
|
|
63
65
|
getTotal: (response, mappedRows) => typeof response.total === "number" ? response.total : mappedRows.length,
|
|
64
|
-
buildFilters: (state) => state.type && state.type !== "All" ?
|
|
66
|
+
buildFilters: (state) => state.type && state.type !== "All" ? sieveFilter("type", SIEVE_OP.EQ, state.type) : undefined,
|
|
65
67
|
primaryAction: {
|
|
66
68
|
label: "Add Coupon",
|
|
67
69
|
onClick: ({ openCreatePanel }) => openCreatePanel(),
|
|
@@ -3,6 +3,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
/**
|
|
4
4
|
* AdminDigitalCodesView — admin browse of digital-code listings (W1-29).
|
|
5
5
|
*/
|
|
6
|
+
import { sortBy } from "@mohasinac/appkit";
|
|
6
7
|
import React from "react";
|
|
7
8
|
import { ListingLayout } from "../../../ui";
|
|
8
9
|
import { ADMIN_ENDPOINTS } from "../../../constants/api-endpoints";
|
|
@@ -14,12 +15,12 @@ const ADMIN_DIGITAL_CODES_CONFIG = {
|
|
|
14
15
|
searchPlaceholder: "Search digital code listings",
|
|
15
16
|
emptyLabel: "No digital code listings",
|
|
16
17
|
filterKeys: [],
|
|
17
|
-
defaultSort: "
|
|
18
|
+
defaultSort: sortBy("createdAt", "DESC"),
|
|
18
19
|
queryKey: ["admin", "digital-codes", "listing"],
|
|
19
20
|
endpoint: ADMIN_ENDPOINTS.PRODUCTS,
|
|
20
21
|
sortOptions: [
|
|
21
|
-
{ value: "
|
|
22
|
-
{ value: "createdAt", label: "Oldest" },
|
|
22
|
+
{ value: sortBy("createdAt", "DESC"), label: "Newest" },
|
|
23
|
+
{ value: sortBy("createdAt", "ASC"), label: "Oldest" },
|
|
23
24
|
{ value: "title", label: "Title A–Z" },
|
|
24
25
|
],
|
|
25
26
|
mapRows: (response) => toRecordArray(response.items).map((item, index) => {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { sieveFilter, SIEVE_OP } from "@mohasinac/appkit";
|
|
4
|
+
import { sortBy } from "@mohasinac/appkit";
|
|
3
5
|
import React, { useMemo } from "react";
|
|
4
6
|
import { Div, Heading, ListingLayout, Span, Text } from "../../../ui";
|
|
5
7
|
import { ADMIN_ENDPOINTS } from "../../../constants/api-endpoints";
|
|
@@ -35,12 +37,12 @@ export function AdminFaqsView({ children, onBulkArchive, onBulkDelete, ...props
|
|
|
35
37
|
searchPlaceholder: "Search questions, categories, or tokens",
|
|
36
38
|
emptyLabel: "No FAQs found",
|
|
37
39
|
filterKeys: ["isActive"],
|
|
38
|
-
defaultSort: "priority",
|
|
40
|
+
defaultSort: sortBy("priority", "ASC"),
|
|
39
41
|
queryKey: ["admin", "faqs", "listing"],
|
|
40
42
|
endpoint: ADMIN_ENDPOINTS.FAQS,
|
|
41
43
|
sortOptions: [
|
|
42
44
|
{ value: "priority", label: "Priority" },
|
|
43
|
-
{ value: "
|
|
45
|
+
{ value: sortBy("createdAt", "DESC"), label: "Newest" },
|
|
44
46
|
{ value: "question", label: "Question A–Z" },
|
|
45
47
|
],
|
|
46
48
|
columns: COLUMNS,
|
|
@@ -56,7 +58,7 @@ export function AdminFaqsView({ children, onBulkArchive, onBulkDelete, ...props
|
|
|
56
58
|
updatedAt: toRelativeDate(item.updatedAt ?? item.createdAt),
|
|
57
59
|
})),
|
|
58
60
|
getTotal: (response, mappedRows) => typeof response.total === "number" ? response.total : mappedRows.length,
|
|
59
|
-
buildFilters: (state) => state.isActive ?
|
|
61
|
+
buildFilters: (state) => state.isActive ? sieveFilter("isActive", SIEVE_OP.EQ, state.isActive) : undefined,
|
|
60
62
|
primaryAction: {
|
|
61
63
|
label: "Add FAQ",
|
|
62
64
|
onClick: ({ openCreatePanel }) => openCreatePanel(),
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { sortBy } from "@mohasinac/appkit";
|
|
3
4
|
import React from "react";
|
|
4
5
|
import { useRouter, useSearchParams, usePathname } from "next/navigation";
|
|
5
6
|
import { ListingLayout, Row } from "../../../ui";
|
|
@@ -44,15 +45,15 @@ export function AdminFeaturesView({ children, ...props }) {
|
|
|
44
45
|
searchPlaceholder: "Search features by label",
|
|
45
46
|
emptyLabel: "No features found",
|
|
46
47
|
filterKeys: [],
|
|
47
|
-
defaultSort: "displayOrder",
|
|
48
|
+
defaultSort: sortBy("displayOrder", "ASC"),
|
|
48
49
|
pageSize: PAGE_SIZE,
|
|
49
50
|
queryKey: ["admin", "features", "listing", scopeFilter],
|
|
50
51
|
endpoint: `${ADMIN_ENDPOINTS.PRODUCT_FEATURES}?scope=${scopeFilter}`,
|
|
51
52
|
sortOptions: [
|
|
52
|
-
{ value: "displayOrder", label: "Display order" },
|
|
53
|
+
{ value: sortBy("displayOrder", "ASC"), label: "Display order" },
|
|
53
54
|
{ value: "label", label: "Label A–Z" },
|
|
54
|
-
{ value: "
|
|
55
|
-
{ value: "
|
|
55
|
+
{ value: sortBy("label", "DESC"), label: "Label Z–A" },
|
|
56
|
+
{ value: sortBy("createdAt", "DESC"), label: "Newest" },
|
|
56
57
|
],
|
|
57
58
|
mapRows: (response) => toRecordArray(response.items).map(mapFeatureRow),
|
|
58
59
|
getTotal: (response, mappedRows) => typeof response.total === "number" ? response.total : mappedRows.length,
|
|
@@ -4,6 +4,7 @@ import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-run
|
|
|
4
4
|
* AdminGroupedListingsView — admin moderation view for grouped product listings.
|
|
5
5
|
* W1-29 — pairs with the new GET /api/admin/grouped-listings endpoint.
|
|
6
6
|
*/
|
|
7
|
+
import { sortBy } from "@mohasinac/appkit";
|
|
7
8
|
import React, { useState } from "react";
|
|
8
9
|
import { ListingLayout } from "../../../ui";
|
|
9
10
|
import { Button, Row, SideDrawer, Stack, Text, useToast, } from "../../../ui";
|
|
@@ -42,12 +43,12 @@ export function AdminGroupedListingsView({ children, ...props }) {
|
|
|
42
43
|
searchPlaceholder: "Search grouped listings by title or seller",
|
|
43
44
|
emptyLabel: "No grouped listings",
|
|
44
45
|
filterKeys: [],
|
|
45
|
-
defaultSort: "
|
|
46
|
+
defaultSort: sortBy("createdAt", "DESC"),
|
|
46
47
|
queryKey: ["admin", "grouped-listings", refreshKey],
|
|
47
48
|
endpoint: ADMIN_ENDPOINTS.GROUPED_LISTINGS,
|
|
48
49
|
sortOptions: [
|
|
49
|
-
{ value: "
|
|
50
|
-
{ value: "createdAt", label: "Oldest" },
|
|
50
|
+
{ value: sortBy("createdAt", "DESC"), label: "Newest" },
|
|
51
|
+
{ value: sortBy("createdAt", "ASC"), label: "Oldest" },
|
|
51
52
|
{ value: "title", label: "Title A–Z" },
|
|
52
53
|
],
|
|
53
54
|
mapRows: (response) => toRecordArray(response.items).map((item, index) => ({
|
|
@@ -4,6 +4,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
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 { sortBy } from "@mohasinac/appkit";
|
|
7
8
|
import React from "react";
|
|
8
9
|
import { ListingLayout } from "../../../ui";
|
|
9
10
|
import { ADMIN_ENDPOINTS } from "../../../constants/api-endpoints";
|
|
@@ -15,12 +16,12 @@ const ADMIN_HISTORY_CONFIG = {
|
|
|
15
16
|
searchPlaceholder: "Search by user ID",
|
|
16
17
|
emptyLabel: "No user history records found",
|
|
17
18
|
filterKeys: [],
|
|
18
|
-
defaultSort: "
|
|
19
|
+
defaultSort: sortBy("updatedAt", "DESC"),
|
|
19
20
|
queryKey: ["admin", "history", "listing"],
|
|
20
21
|
endpoint: ADMIN_ENDPOINTS.ADMIN_HISTORY,
|
|
21
22
|
sortOptions: [
|
|
22
|
-
{ value: "
|
|
23
|
-
{ value: "
|
|
23
|
+
{ value: sortBy("updatedAt", "DESC"), label: "Recently active" },
|
|
24
|
+
{ value: sortBy("itemCount", "DESC"), label: "Largest first" },
|
|
24
25
|
],
|
|
25
26
|
mapRows: (response) => toRecordArray(response.items).map((item, index) => {
|
|
26
27
|
const itemCount = typeof item.itemCount === "number" ? item.itemCount : 0;
|
|
@@ -3,6 +3,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
/**
|
|
4
4
|
* AdminLiveView — admin browse of live-item listings (W1-29).
|
|
5
5
|
*/
|
|
6
|
+
import { sortBy } from "@mohasinac/appkit";
|
|
6
7
|
import React from "react";
|
|
7
8
|
import { ListingLayout } from "../../../ui";
|
|
8
9
|
import { ADMIN_ENDPOINTS } from "../../../constants/api-endpoints";
|
|
@@ -14,12 +15,12 @@ const ADMIN_LIVE_CONFIG = {
|
|
|
14
15
|
searchPlaceholder: "Search live items",
|
|
15
16
|
emptyLabel: "No live item listings",
|
|
16
17
|
filterKeys: [],
|
|
17
|
-
defaultSort: "
|
|
18
|
+
defaultSort: sortBy("createdAt", "DESC"),
|
|
18
19
|
queryKey: ["admin", "live-items", "listing"],
|
|
19
20
|
endpoint: ADMIN_ENDPOINTS.PRODUCTS,
|
|
20
21
|
sortOptions: [
|
|
21
|
-
{ value: "
|
|
22
|
-
{ value: "createdAt", label: "Oldest" },
|
|
22
|
+
{ value: sortBy("createdAt", "DESC"), label: "Newest" },
|
|
23
|
+
{ value: sortBy("createdAt", "ASC"), label: "Oldest" },
|
|
23
24
|
{ value: "title", label: "Title A–Z" },
|
|
24
25
|
],
|
|
25
26
|
mapRows: (response) => toRecordArray(response.items).map((item, index) => {
|