@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,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { sieveFilter, sieveAnd, SIEVE_OP } from "@mohasinac/appkit";
|
|
2
3
|
import { cache } from "react";
|
|
3
4
|
import { storeRepository, productRepository, categoriesRepository, siteSettingsRepository, reviewRepository, couponsRepository } from "../../../repositories";
|
|
4
5
|
import { ROUTES } from "../../../next";
|
|
@@ -30,19 +31,19 @@ export async function StoreDetailLayoutView({ storeSlug, activeTab, children, })
|
|
|
30
31
|
const [productsCount, auctionsCount, preOrdersCount, prizeDrawsCount, bundlesCount, couponsCount, reviewsCount] = storeId
|
|
31
32
|
? await Promise.all([
|
|
32
33
|
productRepository
|
|
33
|
-
.list({ filters:
|
|
34
|
+
.list({ filters: sieveAnd(sieveFilter("storeId", SIEVE_OP.EQ, storeId), sieveFilter("status", SIEVE_OP.EQ, "published"), sieveFilter("listingType", SIEVE_OP.EQ, "standard")), page: 1, pageSize: 1 })
|
|
34
35
|
.then((r) => r.total)
|
|
35
36
|
.catch(() => 0),
|
|
36
37
|
productRepository
|
|
37
|
-
.list({ filters:
|
|
38
|
+
.list({ filters: sieveAnd(sieveFilter("storeId", SIEVE_OP.EQ, storeId), sieveFilter("status", SIEVE_OP.EQ, "published"), sieveFilter("listingType", SIEVE_OP.EQ, "auction")), page: 1, pageSize: 1 })
|
|
38
39
|
.then((r) => r.total)
|
|
39
40
|
.catch(() => 0),
|
|
40
41
|
productRepository
|
|
41
|
-
.list({ filters:
|
|
42
|
+
.list({ filters: sieveAnd(sieveFilter("storeId", SIEVE_OP.EQ, storeId), sieveFilter("status", SIEVE_OP.EQ, "published"), sieveFilter("listingType", SIEVE_OP.EQ, "pre-order")), page: 1, pageSize: 1 })
|
|
42
43
|
.then((r) => r.total)
|
|
43
44
|
.catch(() => 0),
|
|
44
45
|
productRepository
|
|
45
|
-
.list({ filters:
|
|
46
|
+
.list({ filters: sieveAnd(sieveFilter("storeId", SIEVE_OP.EQ, storeId), sieveFilter("status", SIEVE_OP.EQ, "published"), sieveFilter("listingType", SIEVE_OP.EQ, "prize-draw")), page: 1, pageSize: 1 })
|
|
46
47
|
.then((r) => r.total)
|
|
47
48
|
.catch(() => 0),
|
|
48
49
|
// SB-UNI-D — bundles live on categories with categoryType:"bundle"
|
|
@@ -52,11 +53,11 @@ export async function StoreDetailLayoutView({ storeSlug, activeTab, children, })
|
|
|
52
53
|
.then((rows) => rows.filter((c) => c.createdByStoreId === storeId).length)
|
|
53
54
|
.catch(() => 0),
|
|
54
55
|
couponsRepository
|
|
55
|
-
.list({ filters:
|
|
56
|
+
.list({ filters: sieveAnd(sieveFilter("sellerId", SIEVE_OP.EQ, storeId), sieveFilter("validity.isActive", SIEVE_OP.EQ, "true")), page: 1, pageSize: 1 })
|
|
56
57
|
.then((r) => r.total)
|
|
57
58
|
.catch(() => 0),
|
|
58
59
|
reviewRepository
|
|
59
|
-
.listAll({ filters:
|
|
60
|
+
.listAll({ filters: sieveAnd(sieveFilter("storeId", SIEVE_OP.EQ, storeId), sieveFilter("status", SIEVE_OP.EQ, "approved")), page: 1, pageSize: 1 })
|
|
60
61
|
.then((r) => r.total)
|
|
61
62
|
.catch(() => 0),
|
|
62
63
|
])
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { sieveFilter, sieveAnd, SIEVE_OP } from "@mohasinac/appkit";
|
|
3
|
+
import { sortBy } from "@mohasinac/appkit";
|
|
2
4
|
import { productRepository } from "../../../repositories";
|
|
3
5
|
import { getStoreBySlug } from "./StoreDetailLayoutView";
|
|
4
6
|
import { StorePreOrdersListing } from "./StorePreOrdersListing";
|
|
@@ -8,8 +10,8 @@ export async function StorePreOrdersPageView({ storeSlug }) {
|
|
|
8
10
|
const result = storeId
|
|
9
11
|
? await productRepository
|
|
10
12
|
.list({
|
|
11
|
-
filters:
|
|
12
|
-
sorts: "
|
|
13
|
+
filters: sieveAnd(sieveFilter("storeId", SIEVE_OP.EQ, storeId), sieveFilter("status", SIEVE_OP.EQ, "published"), sieveFilter("listingType", SIEVE_OP.EQ, "pre-order")),
|
|
14
|
+
sorts: sortBy("createdAt", "DESC"),
|
|
13
15
|
page: 1,
|
|
14
16
|
pageSize: 24,
|
|
15
17
|
})
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { sieveFilter, sieveAnd, SIEVE_OP } from "@mohasinac/appkit";
|
|
3
|
+
import { sortBy } from "@mohasinac/appkit";
|
|
2
4
|
import { productRepository } from "../../../repositories";
|
|
3
5
|
import { getStoreBySlug } from "./StoreDetailLayoutView";
|
|
4
6
|
import { PrizeDrawsIndexListing } from "../../products/components/PrizeDrawsIndexListing";
|
|
@@ -17,8 +19,8 @@ export async function StorePrizeDrawsPageView({ storeSlug, }) {
|
|
|
17
19
|
}
|
|
18
20
|
const result = await productRepository
|
|
19
21
|
.list({
|
|
20
|
-
filters:
|
|
21
|
-
sorts: "
|
|
22
|
+
filters: sieveAnd(sieveFilter("storeId", SIEVE_OP.EQ, storeId), sieveFilter("status", SIEVE_OP.EQ, "published"), sieveFilter("listingType", SIEVE_OP.EQ, "prize-draw")),
|
|
23
|
+
sorts: sortBy("createdAt", "DESC"),
|
|
22
24
|
page: 1,
|
|
23
25
|
pageSize: 24,
|
|
24
26
|
})
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { sieveFilter, sieveAnd, SIEVE_OP } from "@mohasinac/appkit";
|
|
2
3
|
import { productRepository } from "../../../repositories";
|
|
3
4
|
import { parseListingSearchParams } from "../../../utils/listing-params";
|
|
4
5
|
import { getStoreBySlug } from "./StoreDetailLayoutView";
|
|
@@ -18,7 +19,7 @@ export async function StoreProductsPageView({ storeSlug, searchParams, }) {
|
|
|
18
19
|
const pageSize = std.pageSize ?? DEFAULT_PAGE_SIZE;
|
|
19
20
|
const result = await productRepository
|
|
20
21
|
.list({
|
|
21
|
-
filters:
|
|
22
|
+
filters: sieveAnd(sieveFilter("storeId", SIEVE_OP.EQ, storeId), sieveFilter("status", SIEVE_OP.EQ, "published"), sieveFilter("listingType", SIEVE_OP.EQ, "standard")),
|
|
22
23
|
sorts,
|
|
23
24
|
page,
|
|
24
25
|
pageSize,
|
|
@@ -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 { useState } from "react";
|
|
4
5
|
import { Div, Heading, Input, Select, SlottedListingView } from "../../../ui";
|
|
5
6
|
export function StoreProductsView({ storeSlug, labels = {}, renderProducts, renderSearch, renderSort, renderFilters, renderActiveFilters, renderViewToggle, renderPagination, items = [], total = 0, isLoading = false, className = "", }) {
|
|
@@ -8,9 +9,9 @@ export function StoreProductsView({ storeSlug, labels = {}, renderProducts, rend
|
|
|
8
9
|
const [viewMode, setViewMode] = useState("grid");
|
|
9
10
|
void storeSlug;
|
|
10
11
|
return (_jsx(Div, { className: `py-4 ${className}`, children: _jsx(SlottedListingView, { portal: "public", inlineToolbar: true, className: "space-y-4", renderHeader: () => labels.title ? (_jsx(Heading, { level: 2, className: "mb-1 text-xl font-semibold", children: labels.title })) : null, renderSearch: () => renderSearch?.(search, setSearch) ?? (_jsx(Input, { value: search, onChange: (event) => setSearch(event.target.value), placeholder: "Search store products", className: "max-w-sm" })), renderSort: () => renderSort?.(sort, setSort) ?? (_jsx(Select, { value: sort, onValueChange: setSort, options: [
|
|
11
|
-
{ value: "
|
|
12
|
-
{ value: "createdAt", label: "Oldest" },
|
|
13
|
-
{ value: "price", label: "Price: Low to High" },
|
|
14
|
-
{ value: "
|
|
12
|
+
{ value: sortBy("createdAt", "DESC"), label: "Newest" },
|
|
13
|
+
{ value: sortBy("createdAt", "ASC"), label: "Oldest" },
|
|
14
|
+
{ value: sortBy("price", "ASC"), label: "Price: Low to High" },
|
|
15
|
+
{ value: sortBy("price", "DESC"), label: "Price: High to Low" },
|
|
15
16
|
], className: "min-w-44" })), renderFilters: renderFilters, renderActiveFilters: renderActiveFilters, renderBulkActions: () => renderViewToggle?.(viewMode, setViewMode) ?? null, renderTable: () => renderProducts(items, isLoading), renderPagination: () => renderPagination?.(total) ?? null, total: total, isLoading: isLoading }) }));
|
|
16
17
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
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";
|
|
3
4
|
import { useState, useCallback, useMemo } from "react";
|
|
4
5
|
import { useUrlTable } from "../../../react/hooks/useUrlTable";
|
|
5
6
|
import { useStores } from "../hooks/useStores";
|
|
@@ -103,12 +104,12 @@ export function StoresIndexListing({ initialData }) {
|
|
|
103
104
|
if (ratingRaw) {
|
|
104
105
|
const ratings = ratingRaw.split("|").filter(Boolean);
|
|
105
106
|
if (ratings.length === 1)
|
|
106
|
-
filterParts.push(
|
|
107
|
+
filterParts.push(sieveFilter("averageRating", SIEVE_OP.GTE, ratings[0]));
|
|
107
108
|
}
|
|
108
109
|
if (minProductCount)
|
|
109
|
-
filterParts.push(
|
|
110
|
+
filterParts.push(sieveFilter("stats.totalProducts", SIEVE_OP.GTE, minProductCount));
|
|
110
111
|
if (maxProductCount)
|
|
111
|
-
filterParts.push(
|
|
112
|
+
filterParts.push(sieveFilter("stats.totalProducts", SIEVE_OP.LTE, maxProductCount));
|
|
112
113
|
if (featured === "true")
|
|
113
114
|
filterParts.push("isFeatured==true");
|
|
114
115
|
const { stores, totalPages, isLoading } = useStores({
|
|
@@ -16,7 +16,7 @@ export declare function useStoreAddressSelector(options?: {
|
|
|
16
16
|
}): {
|
|
17
17
|
addresses: SavedAddress[];
|
|
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<SavedAddress[], Error>>;
|
|
20
20
|
createAddress: import("@tanstack/react-query").UseMutateFunction<CreateAddressApiResponse, Error, AddressFormData, unknown>;
|
|
21
21
|
isSaving: boolean;
|
|
22
22
|
};
|
|
@@ -12,16 +12,16 @@ export declare function useStores(params?: StoreListParams, opts?: UseStoresOpti
|
|
|
12
12
|
hasMore: boolean;
|
|
13
13
|
isLoading: false;
|
|
14
14
|
error: string | null;
|
|
15
|
-
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<
|
|
15
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<StoreListResponse, Error>>;
|
|
16
16
|
};
|
|
17
17
|
export declare function useStoreBySlug(storeSlug: string, opts?: {
|
|
18
18
|
enabled?: boolean;
|
|
19
19
|
endpoint?: string;
|
|
20
20
|
}): {
|
|
21
|
-
store:
|
|
21
|
+
store: StoreDetail | null;
|
|
22
22
|
isLoading: boolean;
|
|
23
23
|
error: string | null;
|
|
24
|
-
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<
|
|
24
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<StoreDetail | null, Error>>;
|
|
25
25
|
};
|
|
26
26
|
export declare function useStoreProducts(storeSlug: string, params?: string, opts?: {
|
|
27
27
|
enabled?: boolean;
|
|
@@ -32,7 +32,7 @@ export declare function useStoreProducts(storeSlug: string, params?: string, opt
|
|
|
32
32
|
totalPages: number;
|
|
33
33
|
isLoading: boolean;
|
|
34
34
|
error: string | null;
|
|
35
|
-
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<
|
|
35
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<StoreProductsResponse, Error>>;
|
|
36
36
|
};
|
|
37
37
|
export declare function useStoreAuctions(storeSlug: string, params?: string, opts?: {
|
|
38
38
|
enabled?: boolean;
|
|
@@ -43,7 +43,7 @@ export declare function useStoreAuctions(storeSlug: string, params?: string, opt
|
|
|
43
43
|
totalPages: number;
|
|
44
44
|
isLoading: boolean;
|
|
45
45
|
error: string | null;
|
|
46
|
-
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<
|
|
46
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<StoreAuctionsResponse, Error>>;
|
|
47
47
|
};
|
|
48
48
|
export declare function useStoreReviews(storeSlug: string, params?: {
|
|
49
49
|
rating?: number;
|
|
@@ -66,6 +66,6 @@ export declare function useStoreReviews(storeSlug: string, params?: {
|
|
|
66
66
|
ratingDistribution: Record<number, number>;
|
|
67
67
|
isLoading: boolean;
|
|
68
68
|
error: string | null;
|
|
69
|
-
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<
|
|
69
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<StoreReviewsData, Error>>;
|
|
70
70
|
};
|
|
71
71
|
export {};
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { sortBy } from "@mohasinac/appkit";
|
|
3
4
|
import React from "react";
|
|
4
5
|
import { Div, Heading, Row, Text } from "../../../ui";
|
|
5
6
|
import { useUrlTable } from "../../../react/hooks/useUrlTable";
|
|
6
7
|
import { useWishlist } from "../hooks/useWishlist";
|
|
7
8
|
const WISHLIST_SORT_OPTIONS = [
|
|
8
|
-
{ value: "
|
|
9
|
+
{ value: sortBy("addedAt", "DESC"), label: "Newest first" },
|
|
9
10
|
{ value: "addedAt", label: "Oldest first" },
|
|
10
|
-
{ value: "
|
|
11
|
-
{ value: "price", label: "Price: low → high" },
|
|
11
|
+
{ value: sortBy("price", "DESC"), label: "Price: high → low" },
|
|
12
|
+
{ value: sortBy("price", "ASC"), label: "Price: low → high" },
|
|
12
13
|
];
|
|
13
14
|
export function WishlistView({ userId, initialData, labels = {}, renderTabs, renderSearch, renderSort, renderViewToggle, renderProducts, renderTabPlaceholder, renderBulkActions, renderPagination, className = "", }) {
|
|
14
15
|
const table = useUrlTable({ defaults: { sort: "-addedAt", view: "card" } });
|
|
@@ -17,7 +17,7 @@ interface UseUserWishlistOptions<TProduct> {
|
|
|
17
17
|
}
|
|
18
18
|
export declare function useUserWishlist<TProduct = unknown>(options?: UseUserWishlistOptions<TProduct>): {
|
|
19
19
|
total: number;
|
|
20
|
-
data:
|
|
20
|
+
data: UserWishlistResponse<TProduct>;
|
|
21
21
|
error: Error;
|
|
22
22
|
isError: true;
|
|
23
23
|
isPending: false;
|
|
@@ -40,12 +40,12 @@ export declare function useUserWishlist<TProduct = unknown>(options?: UseUserWis
|
|
|
40
40
|
isRefetching: boolean;
|
|
41
41
|
isStale: boolean;
|
|
42
42
|
isEnabled: boolean;
|
|
43
|
-
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<
|
|
43
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<UserWishlistResponse<TProduct>, Error>>;
|
|
44
44
|
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
45
|
-
promise: Promise<
|
|
45
|
+
promise: Promise<UserWishlistResponse<TProduct>>;
|
|
46
46
|
} | {
|
|
47
47
|
total: number;
|
|
48
|
-
data:
|
|
48
|
+
data: UserWishlistResponse<TProduct>;
|
|
49
49
|
error: null;
|
|
50
50
|
isError: false;
|
|
51
51
|
isPending: false;
|
|
@@ -68,9 +68,9 @@ export declare function useUserWishlist<TProduct = unknown>(options?: UseUserWis
|
|
|
68
68
|
isRefetching: boolean;
|
|
69
69
|
isStale: boolean;
|
|
70
70
|
isEnabled: boolean;
|
|
71
|
-
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<
|
|
71
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<UserWishlistResponse<TProduct>, Error>>;
|
|
72
72
|
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
73
|
-
promise: Promise<
|
|
73
|
+
promise: Promise<UserWishlistResponse<TProduct>>;
|
|
74
74
|
} | {
|
|
75
75
|
total: number;
|
|
76
76
|
data: undefined;
|
|
@@ -96,9 +96,9 @@ export declare function useUserWishlist<TProduct = unknown>(options?: UseUserWis
|
|
|
96
96
|
isRefetching: boolean;
|
|
97
97
|
isStale: boolean;
|
|
98
98
|
isEnabled: boolean;
|
|
99
|
-
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<
|
|
99
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<UserWishlistResponse<TProduct>, Error>>;
|
|
100
100
|
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
101
|
-
promise: Promise<
|
|
101
|
+
promise: Promise<UserWishlistResponse<TProduct>>;
|
|
102
102
|
} | {
|
|
103
103
|
total: number;
|
|
104
104
|
data: undefined;
|
|
@@ -124,9 +124,9 @@ export declare function useUserWishlist<TProduct = unknown>(options?: UseUserWis
|
|
|
124
124
|
isRefetching: boolean;
|
|
125
125
|
isStale: boolean;
|
|
126
126
|
isEnabled: boolean;
|
|
127
|
-
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<
|
|
127
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<UserWishlistResponse<TProduct>, Error>>;
|
|
128
128
|
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
129
|
-
promise: Promise<
|
|
129
|
+
promise: Promise<UserWishlistResponse<TProduct>>;
|
|
130
130
|
} | {
|
|
131
131
|
total: number;
|
|
132
132
|
data: undefined;
|
|
@@ -152,12 +152,12 @@ export declare function useUserWishlist<TProduct = unknown>(options?: UseUserWis
|
|
|
152
152
|
isRefetching: boolean;
|
|
153
153
|
isStale: boolean;
|
|
154
154
|
isEnabled: boolean;
|
|
155
|
-
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<
|
|
155
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<UserWishlistResponse<TProduct>, Error>>;
|
|
156
156
|
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
157
|
-
promise: Promise<
|
|
157
|
+
promise: Promise<UserWishlistResponse<TProduct>>;
|
|
158
158
|
} | {
|
|
159
159
|
total: number;
|
|
160
|
-
data:
|
|
160
|
+
data: UserWishlistResponse<TProduct>;
|
|
161
161
|
isError: false;
|
|
162
162
|
error: null;
|
|
163
163
|
isPending: false;
|
|
@@ -180,8 +180,8 @@ export declare function useUserWishlist<TProduct = unknown>(options?: UseUserWis
|
|
|
180
180
|
isRefetching: boolean;
|
|
181
181
|
isStale: boolean;
|
|
182
182
|
isEnabled: boolean;
|
|
183
|
-
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<
|
|
183
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<UserWishlistResponse<TProduct>, Error>>;
|
|
184
184
|
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
185
|
-
promise: Promise<
|
|
185
|
+
promise: Promise<UserWishlistResponse<TProduct>>;
|
|
186
186
|
};
|
|
187
187
|
export {};
|
|
@@ -11,6 +11,6 @@ export declare function useWishlist(userId: string, opts?: UseWishlistOptions):
|
|
|
11
11
|
isWishlisted: (productId: string) => boolean;
|
|
12
12
|
isLoading: boolean;
|
|
13
13
|
error: Error | null;
|
|
14
|
-
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<
|
|
14
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<WishlistResponse, Error>>;
|
|
15
15
|
};
|
|
16
16
|
export {};
|
|
@@ -17,7 +17,7 @@ export declare function useWishlistWithGuest(userId: string | null | undefined,
|
|
|
17
17
|
isWishlisted: (productId: string) => boolean;
|
|
18
18
|
isLoading: boolean;
|
|
19
19
|
error: Error | null;
|
|
20
|
-
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<
|
|
20
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<WishlistResponse, Error>>;
|
|
21
21
|
isGuest: boolean;
|
|
22
22
|
guestWishlist?: undefined;
|
|
23
23
|
} | {
|