@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
|
@@ -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, { useCallback, useState } from "react";
|
|
4
6
|
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
5
7
|
import { Button, ConfirmDeleteModal, FilterChipGroup, ListingLayout, RowActionMenu, useToast } from "../../../ui";
|
|
@@ -55,11 +57,11 @@ export function AdminNewsletterView({ children, onBulkUnsubscribe, ...props }) {
|
|
|
55
57
|
searchPlaceholder: "Search by email or source",
|
|
56
58
|
emptyLabel: "No subscribers found",
|
|
57
59
|
filterKeys: ["status"],
|
|
58
|
-
defaultSort: "
|
|
60
|
+
defaultSort: sortBy("subscribedAt", "DESC"),
|
|
59
61
|
queryKey: ["admin", "newsletter", "listing"],
|
|
60
62
|
endpoint: ADMIN_ENDPOINTS.NEWSLETTER,
|
|
61
63
|
sortOptions: [
|
|
62
|
-
{ value: "
|
|
64
|
+
{ value: sortBy("subscribedAt", "DESC"), label: "Newest" },
|
|
63
65
|
{ value: "subscribedAt", label: "Oldest" },
|
|
64
66
|
],
|
|
65
67
|
mapRows: (response) => toRecordArray(response.subscribers).map((item, index) => ({
|
|
@@ -79,7 +81,7 @@ export function AdminNewsletterView({ children, onBulkUnsubscribe, ...props }) {
|
|
|
79
81
|
return response.meta.total;
|
|
80
82
|
return mappedRows.length;
|
|
81
83
|
},
|
|
82
|
-
buildFilters: (state) => state.status && state.status !== "All" ?
|
|
84
|
+
buildFilters: (state) => state.status && state.status !== "All" ? sieveFilter("status", SIEVE_OP.EQ, state.status) : undefined,
|
|
83
85
|
toolbarExtra: (_jsx(Button, { type: "button", variant: "outline", size: "sm", onClick: handleExportCsv, children: ACTIONS.ADMIN["export-csv"].label })),
|
|
84
86
|
buildBulkActions: onBulkUnsubscribe
|
|
85
87
|
? (selection) => [
|
|
@@ -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, { useState } from "react";
|
|
4
6
|
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
5
7
|
import { ConfirmDeleteModal, Div, ListingLayout, RowActionMenu, Text, useToast } from "../../../ui";
|
|
@@ -50,12 +52,12 @@ export function AdminNotificationsView({ children, ...props }) {
|
|
|
50
52
|
searchPlaceholder: "Search by title or user ID",
|
|
51
53
|
emptyLabel: "No notifications found",
|
|
52
54
|
filterKeys: ["type"],
|
|
53
|
-
defaultSort: "
|
|
55
|
+
defaultSort: sortBy("createdAt", "DESC"),
|
|
54
56
|
queryKey: ["admin", "notifications", "listing"],
|
|
55
57
|
endpoint: ADMIN_ENDPOINTS.ADMIN_NOTIFICATIONS,
|
|
56
58
|
sortOptions: [
|
|
57
|
-
{ value: "
|
|
58
|
-
{ value: "createdAt", label: "Oldest" },
|
|
59
|
+
{ value: sortBy("createdAt", "DESC"), label: "Newest" },
|
|
60
|
+
{ value: sortBy("createdAt", "ASC"), label: "Oldest" },
|
|
59
61
|
],
|
|
60
62
|
mapRows: (response) => toRecordArray(response.items).map((item, index) => ({
|
|
61
63
|
id: toStringValue(item.id, `notif-${index}`),
|
|
@@ -68,7 +70,7 @@ export function AdminNotificationsView({ children, ...props }) {
|
|
|
68
70
|
type: toStringValue(item.type, ""),
|
|
69
71
|
})),
|
|
70
72
|
getTotal: (response, mappedRows) => typeof response.total === "number" ? response.total : mappedRows.length,
|
|
71
|
-
buildFilters: (state) => state.type && state.type !== "All" ?
|
|
73
|
+
buildFilters: (state) => state.type && state.type !== "All" ? sieveFilter("type", SIEVE_OP.EQ, state.type) : undefined,
|
|
72
74
|
buildBulkActions: (selection) => [
|
|
73
75
|
{
|
|
74
76
|
id: ROW_ACTION_ID.MARK_READ,
|
|
@@ -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, useCallback } from "react";
|
|
4
6
|
import { FilterChipGroup, ListingLayout, useToast } from "../../../ui";
|
|
5
7
|
import { apiClient } from "../../../http";
|
|
@@ -33,12 +35,12 @@ export function AdminOrdersView({ children, ...props }) {
|
|
|
33
35
|
searchPlaceholder: "Search orders, buyers, or tracking IDs",
|
|
34
36
|
emptyLabel: "No orders found",
|
|
35
37
|
filterKeys: ["status"],
|
|
36
|
-
defaultSort: "
|
|
38
|
+
defaultSort: sortBy("createdAt", "DESC"),
|
|
37
39
|
queryKey: ["admin", "orders", "listing"],
|
|
38
40
|
endpoint: ADMIN_ENDPOINTS.ORDERS,
|
|
39
41
|
sortOptions: [
|
|
40
|
-
{ value: "
|
|
41
|
-
{ value: "createdAt", label: "Oldest" },
|
|
42
|
+
{ value: sortBy("createdAt", "DESC"), label: "Newest" },
|
|
43
|
+
{ value: sortBy("createdAt", "ASC"), label: "Oldest" },
|
|
42
44
|
],
|
|
43
45
|
mapRows: (response) => toRecordArray(response.orders).map((item, index) => ({
|
|
44
46
|
id: toStringValue(item.id, `order-${index}`),
|
|
@@ -51,7 +53,7 @@ export function AdminOrdersView({ children, ...props }) {
|
|
|
51
53
|
updatedAt: toRelativeDate(item.updatedAt ?? item.createdAt),
|
|
52
54
|
})),
|
|
53
55
|
getTotal: (response, mappedRows) => typeof response.meta?.total === "number" ? response.meta.total : mappedRows.length,
|
|
54
|
-
buildFilters: (f) => (f.status && f.status !== "All" ?
|
|
56
|
+
buildFilters: (f) => (f.status && f.status !== "All" ? sieveFilter("status", SIEVE_OP.EQ, f.status) : undefined),
|
|
55
57
|
buildBulkActions: (selection) => [
|
|
56
58
|
{
|
|
57
59
|
id: "mark-shipped",
|
|
@@ -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, { useState } from "react";
|
|
4
6
|
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
5
7
|
import { Button, FilterChipGroup, Form, FormActions, Input, ListingLayout, Modal, RowActionMenu, useToast, } from "../../../ui";
|
|
@@ -65,13 +67,13 @@ export function AdminPayoutsView({ children, ...props }) {
|
|
|
65
67
|
searchPlaceholder: "Search stores, payout IDs, or order groups",
|
|
66
68
|
emptyLabel: "No payouts found",
|
|
67
69
|
filterKeys: ["status"],
|
|
68
|
-
defaultSort: "
|
|
70
|
+
defaultSort: sortBy("createdAt", "DESC"),
|
|
69
71
|
queryKey: ["admin", "payouts", "listing"],
|
|
70
72
|
endpoint: ADMIN_ENDPOINTS.PAYOUTS,
|
|
71
73
|
sortOptions: [
|
|
72
|
-
{ value: "
|
|
73
|
-
{ value: "createdAt", label: "Oldest" },
|
|
74
|
-
{ value: "
|
|
74
|
+
{ value: sortBy("createdAt", "DESC"), label: "Newest" },
|
|
75
|
+
{ value: sortBy("createdAt", "ASC"), label: "Oldest" },
|
|
76
|
+
{ value: sortBy("amount", "DESC"), label: "Highest amount" },
|
|
75
77
|
],
|
|
76
78
|
mapRows: (response) => toRecordArray(response.payouts).map((item, index) => ({
|
|
77
79
|
id: toStringValue(item.id, `payout-${index}`),
|
|
@@ -81,7 +83,7 @@ export function AdminPayoutsView({ children, ...props }) {
|
|
|
81
83
|
updatedAt: toRelativeDate(item.updatedAt ?? item.createdAt),
|
|
82
84
|
})),
|
|
83
85
|
getTotal: (response, mappedRows) => typeof response.meta?.total === "number" ? response.meta.total : mappedRows.length,
|
|
84
|
-
buildFilters: (state) => state.status && state.status !== "All" ?
|
|
86
|
+
buildFilters: (state) => state.status && state.status !== "All" ? sieveFilter("status", SIEVE_OP.EQ, state.status) : undefined,
|
|
85
87
|
toolbarExtra: (_jsx(Button, { type: "button", variant: "outline", size: "sm", onClick: handleExportCsv, children: ACTIONS.ADMIN["export-csv"].label })),
|
|
86
88
|
buildBulkActions: (selection) => [
|
|
87
89
|
{
|
|
@@ -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 { Pencil } from "lucide-react";
|
|
5
7
|
import { Badge, Button, Div, FilterChipGroup, ListingLayout, Span, Text } from "../../../ui";
|
|
@@ -61,12 +63,12 @@ export function AdminPrizeDrawsView({ children, ...props }) {
|
|
|
61
63
|
searchPlaceholder: "Search prize draws by name or store…",
|
|
62
64
|
emptyLabel: "No prize draws found",
|
|
63
65
|
filterKeys: ["status"],
|
|
64
|
-
defaultSort: "
|
|
66
|
+
defaultSort: sortBy("createdAt", "DESC"),
|
|
65
67
|
queryKey: ["admin", "prize-draws", "listing"],
|
|
66
68
|
endpoint: ADMIN_ENDPOINTS.PRODUCTS,
|
|
67
69
|
sortOptions: [
|
|
68
|
-
{ value: "
|
|
69
|
-
{ value: "createdAt", label: "Oldest" },
|
|
70
|
+
{ value: sortBy("createdAt", "DESC"), label: "Newest" },
|
|
71
|
+
{ value: sortBy("createdAt", "ASC"), label: "Oldest" },
|
|
70
72
|
{ value: "title", label: "Title A–Z" },
|
|
71
73
|
{ value: "prizeDrawEndDate", label: "Draw Date Soon" },
|
|
72
74
|
],
|
|
@@ -88,7 +90,7 @@ export function AdminPrizeDrawsView({ children, ...props }) {
|
|
|
88
90
|
}),
|
|
89
91
|
getTotal: (response, mappedRows) => typeof response.total === "number" ? response.total : mappedRows.length,
|
|
90
92
|
buildFilters: (state) => {
|
|
91
|
-
const status = state.status && state.status !== "All" ?
|
|
93
|
+
const status = state.status && state.status !== "All" ? sieveFilter("status", SIEVE_OP.EQ, state.status) : null;
|
|
92
94
|
return ["listingType==prize-draw", status].filter(Boolean).join(",");
|
|
93
95
|
},
|
|
94
96
|
getRowHref: (row) => String(ROUTES.ADMIN.PRIZE_DRAWS_EDIT(row.id)),
|
|
@@ -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, { useState, useCallback } from "react";
|
|
4
6
|
import { Div, ListingLayout, Span, Text, Toggle, useToast } from "../../../ui";
|
|
5
7
|
import { ADMIN_ENDPOINTS } from "../../../constants/api-endpoints";
|
|
@@ -99,14 +101,14 @@ export function AdminProductsView({ children, ...props }) {
|
|
|
99
101
|
searchPlaceholder: "Search products, SKUs, or seller names",
|
|
100
102
|
emptyLabel: "No products found",
|
|
101
103
|
filterKeys: ["status", "type", "showSold"],
|
|
102
|
-
defaultSort: "
|
|
104
|
+
defaultSort: sortBy("createdAt", "DESC"),
|
|
103
105
|
queryKey: ["admin", "products", "listing"],
|
|
104
106
|
endpoint: ADMIN_ENDPOINTS.PRODUCTS,
|
|
105
107
|
sortOptions: [
|
|
106
|
-
{ value: "
|
|
107
|
-
{ value: "createdAt", label: "Oldest" },
|
|
108
|
+
{ value: sortBy("createdAt", "DESC"), label: "Newest" },
|
|
109
|
+
{ value: sortBy("createdAt", "ASC"), label: "Oldest" },
|
|
108
110
|
{ value: "title", label: "Title A–Z" },
|
|
109
|
-
{ value: "
|
|
111
|
+
{ value: sortBy("price", "DESC"), label: "Highest price" },
|
|
110
112
|
],
|
|
111
113
|
columns: [...buildBaseColumns(), flagColumn],
|
|
112
114
|
mapRows: (response) => toRecordArray(response.items).map((item, index) => {
|
|
@@ -133,7 +135,7 @@ export function AdminProductsView({ children, ...props }) {
|
|
|
133
135
|
if (state.showSold !== "true")
|
|
134
136
|
parts.push("isSold==false");
|
|
135
137
|
if (state.status && state.status !== "All")
|
|
136
|
-
parts.push(
|
|
138
|
+
parts.push(sieveFilter("status", SIEVE_OP.EQ, state.status));
|
|
137
139
|
const typeFilter = TYPE_FILTER_MAP[state.type];
|
|
138
140
|
if (typeFilter)
|
|
139
141
|
parts.push(typeFilter);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { sortBy } from "@mohasinac/appkit";
|
|
3
4
|
import { useState } from "react";
|
|
4
5
|
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
5
6
|
import { ConfirmDeleteModal, RowActionMenu, useToast } from "../../../ui";
|
|
@@ -50,12 +51,12 @@ export function AdminReturnRequestsView(_props) {
|
|
|
50
51
|
searchPlaceholder: "Search by order ID or buyer",
|
|
51
52
|
emptyLabel: "No return requests",
|
|
52
53
|
filterKeys: [],
|
|
53
|
-
defaultSort: "
|
|
54
|
+
defaultSort: sortBy("createdAt", "DESC"),
|
|
54
55
|
queryKey: ["admin", "return-requests", "listing"],
|
|
55
56
|
endpoint: `${ADMIN_ENDPOINTS.ORDERS}?status=return_requested`,
|
|
56
57
|
sortOptions: [
|
|
57
|
-
{ value: "
|
|
58
|
-
{ value: "createdAt", label: "Oldest" },
|
|
58
|
+
{ value: sortBy("createdAt", "DESC"), label: "Newest" },
|
|
59
|
+
{ value: sortBy("createdAt", "ASC"), label: "Oldest" },
|
|
59
60
|
],
|
|
60
61
|
mapRows: (response) => toRecordArray(response.items).map((item, index) => ({
|
|
61
62
|
id: toStringValue(item.id, `order-${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, useCallback } from "react";
|
|
4
6
|
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
5
7
|
import { Button, Div, FilterChipGroup, Label, ListingLayout, Modal, RowActionMenu, useToast } from "../../../ui";
|
|
@@ -75,14 +77,14 @@ export function AdminReviewsView({ children, ...props }) {
|
|
|
75
77
|
searchPlaceholder: "Search reviews, products, or seller names",
|
|
76
78
|
emptyLabel: "No reviews found",
|
|
77
79
|
filterKeys: ["status", "rating"],
|
|
78
|
-
defaultSort: "
|
|
80
|
+
defaultSort: sortBy("publishedAt", "DESC"),
|
|
79
81
|
queryKey: ["admin", "reviews", "listing"],
|
|
80
82
|
endpoint: ADMIN_ENDPOINTS.REVIEWS,
|
|
81
83
|
sortOptions: [
|
|
82
|
-
{ value: "
|
|
84
|
+
{ value: sortBy("publishedAt", "DESC"), label: "Newest" },
|
|
83
85
|
{ value: "publishedAt", label: "Oldest" },
|
|
84
|
-
{ value: "
|
|
85
|
-
{ value: "rating", label: "Lowest rating" },
|
|
86
|
+
{ value: sortBy("rating", "DESC"), label: "Highest rating" },
|
|
87
|
+
{ value: sortBy("rating", "ASC"), label: "Lowest rating" },
|
|
86
88
|
],
|
|
87
89
|
mapRows: (response) => toRecordArray(response.items).map((item, index) => ({
|
|
88
90
|
id: toStringValue(item.id, `review-${index}`),
|
|
@@ -97,9 +99,9 @@ export function AdminReviewsView({ children, ...props }) {
|
|
|
97
99
|
buildFilters: (f) => {
|
|
98
100
|
const parts = [];
|
|
99
101
|
if (f.status && f.status !== "All")
|
|
100
|
-
parts.push(
|
|
102
|
+
parts.push(sieveFilter("status", SIEVE_OP.EQ, f.status));
|
|
101
103
|
if (f.rating && f.rating !== "All")
|
|
102
|
-
parts.push(
|
|
104
|
+
parts.push(sieveFilter("rating", SIEVE_OP.EQ, f.rating));
|
|
103
105
|
return parts.join(",") || undefined;
|
|
104
106
|
},
|
|
105
107
|
buildBulkActions: (selection) => [
|
|
@@ -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, { useState } from "react";
|
|
4
6
|
import { Div, FilterChipGroup, ListingLayout, RowActionMenu, Span, Text } from "../../../ui";
|
|
5
7
|
import { ADMIN_ENDPOINTS } from "../../../constants/api-endpoints";
|
|
@@ -45,14 +47,14 @@ export function AdminScammersView({ children, ...props }) {
|
|
|
45
47
|
searchPlaceholder: "Search by name, phone, UPI ID",
|
|
46
48
|
emptyLabel: "No scammer profiles found",
|
|
47
49
|
filterKeys: ["status"],
|
|
48
|
-
defaultSort: "
|
|
50
|
+
defaultSort: sortBy("createdAt", "DESC"),
|
|
49
51
|
queryKey: ["admin", "scammers", "listing"],
|
|
50
52
|
endpoint: ADMIN_ENDPOINTS.SCAMMERS,
|
|
51
53
|
sortOptions: [
|
|
52
|
-
{ value: "
|
|
53
|
-
{ value: "createdAt", label: "Oldest" },
|
|
54
|
-
{ value: "
|
|
55
|
-
{ value: "
|
|
54
|
+
{ value: sortBy("createdAt", "DESC"), label: "Newest" },
|
|
55
|
+
{ value: sortBy("createdAt", "ASC"), label: "Oldest" },
|
|
56
|
+
{ value: sortBy("views", "DESC"), label: "Most viewed" },
|
|
57
|
+
{ value: sortBy("incidentCount", "DESC"), label: "Most incidents" },
|
|
56
58
|
],
|
|
57
59
|
columns: SCAMMER_COLUMNS,
|
|
58
60
|
mapRows: (response) => toRecordArray(response.scammers).map((item, index) => ({
|
|
@@ -80,7 +82,7 @@ export function AdminScammersView({ children, ...props }) {
|
|
|
80
82
|
return response.total;
|
|
81
83
|
return mappedRows.length;
|
|
82
84
|
},
|
|
83
|
-
buildFilters: (f) => (f.status && f.status !== "All" ?
|
|
85
|
+
buildFilters: (f) => (f.status && f.status !== "All" ? sieveFilter("status", SIEVE_OP.EQ, f.status) : undefined),
|
|
84
86
|
renderRowActions: (row) => (_jsx(RowActionMenu, { actions: [
|
|
85
87
|
{
|
|
86
88
|
label: ACTIONS.ADMIN["review-scammer"].label,
|
|
@@ -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, { useState } from "react";
|
|
4
6
|
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
5
7
|
import { ConfirmDeleteModal, Div, ListingLayout, RowActionMenu, Text, useToast } from "../../../ui";
|
|
@@ -43,13 +45,13 @@ export function AdminSessionsView({ children, ...props }) {
|
|
|
43
45
|
searchPlaceholder: "Search by user or device",
|
|
44
46
|
emptyLabel: "No sessions found",
|
|
45
47
|
filterKeys: ["isActive"],
|
|
46
|
-
defaultSort: "
|
|
48
|
+
defaultSort: sortBy("lastActivity", "DESC"),
|
|
47
49
|
queryKey: ["admin", "sessions", "listing"],
|
|
48
50
|
endpoint: ADMIN_ENDPOINTS.SESSIONS,
|
|
49
51
|
sortOptions: [
|
|
50
|
-
{ value: "
|
|
52
|
+
{ value: sortBy("lastActivity", "DESC"), label: "Most recent" },
|
|
51
53
|
{ value: "lastActivity", label: "Least recent" },
|
|
52
|
-
{ value: "
|
|
54
|
+
{ value: sortBy("createdAt", "DESC"), label: "Newest" },
|
|
53
55
|
],
|
|
54
56
|
mapRows: (response) => toRecordArray(response.sessions).map((item, index) => {
|
|
55
57
|
const deviceInfo = (item.deviceInfo ?? {});
|
|
@@ -72,7 +74,7 @@ export function AdminSessionsView({ children, ...props }) {
|
|
|
72
74
|
};
|
|
73
75
|
}),
|
|
74
76
|
getTotal: (response, mappedRows) => typeof response.count === "number" ? response.count : mappedRows.length,
|
|
75
|
-
buildFilters: (state) => (state.isActive ?
|
|
77
|
+
buildFilters: (state) => (state.isActive ? sieveFilter("isActive", SIEVE_OP.EQ, state.isActive) : undefined),
|
|
76
78
|
buildBulkActions: (selection) => [
|
|
77
79
|
{
|
|
78
80
|
id: ROW_ACTION_ID.REVOKE,
|
|
@@ -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 { toRecordArray, toStringValue, } from "../hooks/useAdminListingData";
|
|
4
5
|
import { DataListingView } from "./DataListingView";
|
|
5
6
|
import { ADMIN_ENDPOINTS } from "../../../constants/api-endpoints";
|
|
@@ -9,7 +10,7 @@ const ADMIN_STORE_ADDRESSES_CONFIG = {
|
|
|
9
10
|
searchPlaceholder: "Search by label, city, or store ID",
|
|
10
11
|
emptyLabel: "No store addresses found",
|
|
11
12
|
filterKeys: [],
|
|
12
|
-
defaultSort: "storeId",
|
|
13
|
+
defaultSort: sortBy("storeId", "ASC"),
|
|
13
14
|
queryKey: ["admin", "store-addresses", "listing"],
|
|
14
15
|
endpoint: ADMIN_ENDPOINTS.STORE_ADDRESSES,
|
|
15
16
|
sortOptions: [
|
|
@@ -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 { FilterChipGroup, ListingLayout, RowActionMenu, useToast } from "../../../ui";
|
|
@@ -43,12 +45,12 @@ export function AdminStoresView({ children, ...props }) {
|
|
|
43
45
|
searchPlaceholder: "Search stores, slugs, or owner names",
|
|
44
46
|
emptyLabel: "No stores found",
|
|
45
47
|
filterKeys: ["status"],
|
|
46
|
-
defaultSort: "
|
|
48
|
+
defaultSort: sortBy("createdAt", "DESC"),
|
|
47
49
|
queryKey: ["admin", "stores", "listing"],
|
|
48
50
|
endpoint: ADMIN_ENDPOINTS.STORES,
|
|
49
51
|
sortOptions: [
|
|
50
|
-
{ value: "
|
|
51
|
-
{ value: "createdAt", label: "Oldest" },
|
|
52
|
+
{ value: sortBy("createdAt", "DESC"), label: "Newest" },
|
|
53
|
+
{ value: sortBy("createdAt", "ASC"), label: "Oldest" },
|
|
52
54
|
{ value: "storeName", label: "Name A–Z" },
|
|
53
55
|
],
|
|
54
56
|
mapRows: (response) => toRecordArray(response.items).map((item, index) => ({
|
|
@@ -63,7 +65,7 @@ export function AdminStoresView({ children, ...props }) {
|
|
|
63
65
|
_raw: item,
|
|
64
66
|
})),
|
|
65
67
|
getTotal: (response, mappedRows) => typeof response.total === "number" ? response.total : mappedRows.length,
|
|
66
|
-
buildFilters: (state) => state.status && state.status !== "All" ?
|
|
68
|
+
buildFilters: (state) => state.status && state.status !== "All" ? sieveFilter("status", SIEVE_OP.EQ, state.status) : undefined,
|
|
67
69
|
onRowClick: (row) => setEditorRow(row),
|
|
68
70
|
buildBulkActions: (selection) => [
|
|
69
71
|
{
|
|
@@ -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 { ADMIN_ENDPOINTS } from "../../../constants/api-endpoints";
|
|
4
5
|
import { ACTIONS } from "../../../_internal/shared/actions/action-registry";
|
|
5
6
|
import { buildBulkAction } from "../../../_internal/shared/actions/bulk-helpers";
|
|
@@ -12,14 +13,14 @@ export function AdminSublistingCategoriesView({ onBulkDelete, }) {
|
|
|
12
13
|
searchPlaceholder: "Search sub-listing categories…",
|
|
13
14
|
emptyLabel: "No sub-listing categories found",
|
|
14
15
|
filterKeys: [],
|
|
15
|
-
defaultSort: "name",
|
|
16
|
+
defaultSort: sortBy("name", "ASC"),
|
|
16
17
|
queryKey: ["admin", "sublisting-categories", "listing"],
|
|
17
18
|
endpoint: ADMIN_ENDPOINTS.SUBLISTING_CATEGORIES,
|
|
18
19
|
sortOptions: [
|
|
19
|
-
{ value: "name", label: "Name A–Z" },
|
|
20
|
-
{ value: "
|
|
21
|
-
{ value: "
|
|
22
|
-
{ value: "
|
|
20
|
+
{ value: sortBy("name", "ASC"), label: "Name A–Z" },
|
|
21
|
+
{ value: sortBy("name", "DESC"), label: "Name Z–A" },
|
|
22
|
+
{ value: sortBy("productCount", "DESC"), label: "Most listings" },
|
|
23
|
+
{ value: sortBy("createdAt", "DESC"), label: "Newest" },
|
|
23
24
|
],
|
|
24
25
|
mapRows: (response) => toRecordArray(response.items).map((item, index) => ({
|
|
25
26
|
id: toStringValue(item.id, `sc-${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, { useState } from "react";
|
|
4
6
|
import { Div, FilterChipGroup, ListingLayout, RowActionMenu, Span, Text } from "../../../ui";
|
|
5
7
|
import { ADMIN_ENDPOINTS } from "../../../constants/api-endpoints";
|
|
@@ -55,13 +57,13 @@ export function AdminSupportTicketsView({ children, ...props }) {
|
|
|
55
57
|
searchPlaceholder: "Search by subject",
|
|
56
58
|
emptyLabel: "No support tickets found",
|
|
57
59
|
filterKeys: ["status", "priority"],
|
|
58
|
-
defaultSort: "
|
|
60
|
+
defaultSort: sortBy("createdAt", "DESC"),
|
|
59
61
|
queryKey: ["admin", "support-tickets", "listing"],
|
|
60
62
|
endpoint: ADMIN_ENDPOINTS.SUPPORT_TICKETS,
|
|
61
63
|
sortOptions: [
|
|
62
|
-
{ value: "
|
|
63
|
-
{ value: "createdAt", label: "Oldest" },
|
|
64
|
-
{ value: "
|
|
64
|
+
{ value: sortBy("createdAt", "DESC"), label: "Newest" },
|
|
65
|
+
{ value: sortBy("createdAt", "ASC"), label: "Oldest" },
|
|
66
|
+
{ value: sortBy("updatedAt", "DESC"), label: "Recently updated" },
|
|
65
67
|
],
|
|
66
68
|
columns: TICKET_COLUMNS,
|
|
67
69
|
mapRows: (response) => toRecordArray(response.tickets).map((item, index) => ({
|
|
@@ -90,9 +92,9 @@ export function AdminSupportTicketsView({ children, ...props }) {
|
|
|
90
92
|
buildFilters: (f) => {
|
|
91
93
|
const parts = [];
|
|
92
94
|
if (f.status && f.status !== "All")
|
|
93
|
-
parts.push(
|
|
95
|
+
parts.push(sieveFilter("status", SIEVE_OP.EQ, f.status));
|
|
94
96
|
if (f.priority && f.priority !== "All")
|
|
95
|
-
parts.push(
|
|
97
|
+
parts.push(sieveFilter("priority", SIEVE_OP.EQ, f.priority));
|
|
96
98
|
return parts.join(",") || undefined;
|
|
97
99
|
},
|
|
98
100
|
renderRowActions: (row) => (_jsx(RowActionMenu, { actions: [
|
|
@@ -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, { useState, useCallback } from "react";
|
|
4
6
|
import { UserPlus } from "lucide-react";
|
|
5
7
|
import { Button, FilterChipGroup, ListingLayout, RowActionMenu } from "../../../ui";
|
|
@@ -58,12 +60,12 @@ export function AdminTeamView({ children, onBulkRemove, ...props }) {
|
|
|
58
60
|
searchPlaceholder: "Search by name or email",
|
|
59
61
|
emptyLabel: "No employees found",
|
|
60
62
|
filterKeys: ["group"],
|
|
61
|
-
defaultSort: "
|
|
63
|
+
defaultSort: sortBy("createdAt", "DESC"),
|
|
62
64
|
queryKey: ["admin", "team", "listing"],
|
|
63
65
|
endpoint: ADMIN_ENDPOINTS.TEAM,
|
|
64
66
|
sortOptions: [
|
|
65
|
-
{ value: "
|
|
66
|
-
{ value: "createdAt", label: "Oldest" },
|
|
67
|
+
{ value: sortBy("createdAt", "DESC"), label: "Newest" },
|
|
68
|
+
{ value: sortBy("createdAt", "ASC"), label: "Oldest" },
|
|
67
69
|
{ value: "displayName", label: "Name A–Z" },
|
|
68
70
|
],
|
|
69
71
|
mapRows: (response) => toRecordArray(response.users).map((item, index) => ({
|
|
@@ -90,7 +92,7 @@ export function AdminTeamView({ children, onBulkRemove, ...props }) {
|
|
|
90
92
|
return response.total;
|
|
91
93
|
return mappedRows.length;
|
|
92
94
|
},
|
|
93
|
-
buildFilters: (state) => state.group && state.group !== "All" ?
|
|
95
|
+
buildFilters: (state) => state.group && state.group !== "All" ? sieveFilter("permissionGroup", SIEVE_OP.EQ, state.group) : undefined,
|
|
94
96
|
toolbarExtra: (_jsxs(Button, { type: "button", variant: "primary", onClick: openInvite, className: "flex items-center gap-1.5 whitespace-nowrap", children: [_jsx(UserPlus, { className: "h-4 w-4" }), "Invite Employee"] })),
|
|
95
97
|
buildBulkActions: onBulkRemove
|
|
96
98
|
? (selection) => [
|
|
@@ -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 { Button, FilterChipGroup, Form, FormActions, Input, ListingLayout, Modal, RowActionMenu, Text as AppText, useToast, } from "../../../ui";
|
|
@@ -54,12 +56,12 @@ export function AdminUsersView({ children, ...props }) {
|
|
|
54
56
|
searchPlaceholder: "Search users, email, or seller handles",
|
|
55
57
|
emptyLabel: "No users found",
|
|
56
58
|
filterKeys: ["status", "role"],
|
|
57
|
-
defaultSort: "
|
|
59
|
+
defaultSort: sortBy("createdAt", "DESC"),
|
|
58
60
|
queryKey: ["admin", "users", "listing"],
|
|
59
61
|
endpoint: ADMIN_ENDPOINTS.USERS,
|
|
60
62
|
sortOptions: [
|
|
61
|
-
{ value: "
|
|
62
|
-
{ value: "createdAt", label: "Oldest" },
|
|
63
|
+
{ value: sortBy("createdAt", "DESC"), label: "Newest" },
|
|
64
|
+
{ value: sortBy("createdAt", "ASC"), label: "Oldest" },
|
|
63
65
|
{ value: "displayName", label: "Name A–Z" },
|
|
64
66
|
],
|
|
65
67
|
mapRows: (response) => toRecordArray(response.users).map((item, index) => {
|
|
@@ -98,7 +100,7 @@ export function AdminUsersView({ children, ...props }) {
|
|
|
98
100
|
parts.push(f.status === "Active" ? "disabled==false" : "disabled==true");
|
|
99
101
|
}
|
|
100
102
|
if (f.role && f.role !== "All")
|
|
101
|
-
parts.push(
|
|
103
|
+
parts.push(sieveFilter("role", SIEVE_OP.EQ, f.role));
|
|
102
104
|
return parts.join(",") || undefined;
|
|
103
105
|
},
|
|
104
106
|
onRowClick: (row) => {
|
|
@@ -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 { ListingLayout } from "../../../ui";
|
|
5
6
|
import { ADMIN_ENDPOINTS } from "../../../constants/api-endpoints";
|
|
@@ -11,12 +12,12 @@ const ADMIN_WISHLISTS_CONFIG = {
|
|
|
11
12
|
searchPlaceholder: "Search by user ID",
|
|
12
13
|
emptyLabel: "No user wishlists found",
|
|
13
14
|
filterKeys: [],
|
|
14
|
-
defaultSort: "
|
|
15
|
+
defaultSort: sortBy("updatedAt", "DESC"),
|
|
15
16
|
queryKey: ["admin", "wishlists", "listing"],
|
|
16
17
|
endpoint: ADMIN_ENDPOINTS.ADMIN_WISHLISTS,
|
|
17
18
|
sortOptions: [
|
|
18
|
-
{ value: "
|
|
19
|
-
{ value: "
|
|
19
|
+
{ value: sortBy("updatedAt", "DESC"), label: "Recently updated" },
|
|
20
|
+
{ value: sortBy("itemCount", "DESC"), label: "Largest first" },
|
|
20
21
|
],
|
|
21
22
|
mapRows: (response) => toRecordArray(response.items).map((item, index) => {
|
|
22
23
|
const itemCount = typeof item.itemCount === "number" ? item.itemCount : 0;
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* primitive and stay in sync when statuses are added.
|
|
11
11
|
*/
|
|
12
12
|
export interface AdminFilterTab {
|
|
13
|
-
/** Filter value — empty when
|
|
13
|
+
/** Filter value — empty when sieveFilter("id", SIEVE_OP.EQ, "= "All""). */
|
|
14
14
|
id: string;
|
|
15
15
|
/** Display text. */
|
|
16
16
|
label: string;
|
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Admin filter-chip tab sets (SB10-C completion, S8 2026-05-13).
|
|
3
|
-
*
|
|
4
|
-
* Match current view-filter values exactly so migrating an inline
|
|
5
|
-
* `STATUS_OPTIONS` array to one of these constants is a behaviour-preserving
|
|
6
|
-
* rename. The `ALL_TAB` sentinel collapses to an empty filter string when
|
|
7
|
-
* clicked.
|
|
8
|
-
*
|
|
9
|
-
* Each entry is a typed `{ id, label }` row so views render with one
|
|
10
|
-
* primitive and stay in sync when statuses are added.
|
|
11
|
-
*/
|
|
12
1
|
export const ALL_TAB = { id: "All", label: "All" };
|
|
13
2
|
/** Admin > Products — listing status filter chip set. */
|
|
14
3
|
export const ADMIN_PRODUCT_STATUS_TABS = [
|
|
@@ -23,6 +23,6 @@ export declare function useAdminSectionsListing({ page, pageSize, sorts, filters
|
|
|
23
23
|
hasMore: boolean;
|
|
24
24
|
isLoading: boolean;
|
|
25
25
|
errorMessage: string | undefined;
|
|
26
|
-
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<
|
|
26
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<AdminSectionsListingResponse, ApiClientError>>;
|
|
27
27
|
};
|
|
28
28
|
export {};
|
|
@@ -16,7 +16,7 @@ export interface UseChatReturn {
|
|
|
16
16
|
export declare function useChat(chatId: string | null, options?: {
|
|
17
17
|
realtimeProvider?: IClientRealtimeProvider;
|
|
18
18
|
}): UseChatReturn;
|
|
19
|
-
export declare function useChatRooms(): import("@tanstack/react-query").UseQueryResult<
|
|
19
|
+
export declare function useChatRooms(): import("@tanstack/react-query").UseQueryResult<unknown[], Error>;
|
|
20
20
|
export declare function useCreateChatRoom(): import("@tanstack/react-query").UseMutationResult<unknown, Error, {
|
|
21
21
|
orderId: string;
|
|
22
22
|
ownerId: string;
|
|
@@ -4,7 +4,7 @@ export type { AdminProduct, AdminProductStatus, AdminProductDrawerMode, } from "
|
|
|
4
4
|
export { ADMIN_PRODUCT_STATUS_OPTIONS } from "./product.types";
|
|
5
5
|
/**
|
|
6
6
|
* Admin-specific column definition that narrows `render` to `React.ReactNode`.
|
|
7
|
-
* Extends
|
|
7
|
+
* Extends sieveFilter("TableColumn", SIEVE_OP.LT, "T>") from `@mohasinac/contracts` so it is compatible
|
|
8
8
|
* with column arrays built from the base type.
|
|
9
9
|
*/
|
|
10
10
|
export interface AdminTableColumn<T = Record<string, unknown>> extends Omit<TableColumn<T>, "render"> {
|