@mohasinac/appkit 2.7.53 → 2.7.54
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_internal/client/features/layout/DashboardLayoutClient.js +1 -1
- package/dist/_internal/server/jobs/core/auctionSettlement.js +6 -3
- package/dist/_internal/server/jobs/core/bundleStockSync.js +9 -7
- package/dist/_internal/server/jobs/core/onProductStockChange.d.ts +12 -3
- package/dist/_internal/server/jobs/core/onProductStockChange.js +12 -13
- package/dist/_internal/server/jobs/core/onProductWrite.js +1 -3
- package/dist/_internal/server/jobs/handlers/onProductStockChange.js +11 -2
- package/dist/client.d.ts +2 -0
- package/dist/client.js +1 -0
- package/dist/constants/field-names.d.ts +4 -3
- package/dist/constants/field-names.js +8 -8
- package/dist/errors/error-codes.d.ts +3 -0
- package/dist/errors/error-codes.js +3 -0
- package/dist/errors/messages.d.ts +3 -0
- package/dist/errors/messages.js +3 -0
- package/dist/features/admin/types/product.types.d.ts +1 -1
- package/dist/features/admin/types/product.types.js +2 -3
- package/dist/features/auctions/actions/bid-actions.d.ts +9 -0
- package/dist/features/auctions/actions/bid-actions.js +61 -0
- package/dist/features/auctions/components/AuctionDetailPageView.d.ts +2 -1
- package/dist/features/auctions/components/AuctionDetailPageView.js +5 -4
- package/dist/features/auctions/components/PlaceBidFormClient.d.ts +3 -1
- package/dist/features/auctions/components/PlaceBidFormClient.js +32 -2
- package/dist/features/auctions/types/index.d.ts +1 -1
- package/dist/features/layout/AppLayoutShell.js +1 -1
- package/dist/features/pre-orders/components/PreOrdersIndexListing.js +2 -11
- package/dist/features/products/api/[id]/route.js +4 -8
- package/dist/features/products/api/route.js +1 -3
- package/dist/features/products/components/AuctionsIndexListing.js +3 -11
- package/dist/features/products/components/PrizeDrawsIndexListing.js +2 -10
- package/dist/features/products/components/ProductFilters.d.ts +33 -9
- package/dist/features/products/components/ProductFilters.js +6 -29
- package/dist/features/products/components/ProductForm.js +2 -3
- package/dist/features/products/constants/sieve.d.ts +162 -0
- package/dist/features/products/constants/sieve.js +95 -0
- package/dist/features/products/repository/products.repository.d.ts +5 -0
- package/dist/features/products/repository/products.repository.js +23 -3
- package/dist/features/products/schemas/firestore.d.ts +4 -4
- package/dist/features/products/schemas/firestore.js +2 -3
- package/dist/features/products/schemas/index.d.ts +6 -6
- package/dist/features/products/schemas/index.js +2 -6
- package/dist/features/products/types/index.d.ts +1 -1
- package/dist/features/seller/actions/offer-actions.js +2 -2
- package/dist/features/wishlist/types/index.d.ts +1 -1
- package/dist/index.d.ts +6 -3
- package/dist/index.js +6 -4
- package/dist/seed/addresses-seed-data.d.ts +2 -18
- package/dist/seed/addresses-seed-data.js +137 -203
- package/dist/seed/bids-seed-data.d.ts +2 -8
- package/dist/seed/bids-seed-data.js +172 -648
- package/dist/seed/blog-posts-seed-data.d.ts +0 -5
- package/dist/seed/blog-posts-seed-data.js +341 -596
- package/dist/seed/carousel-slides-seed-data.d.ts +0 -5
- package/dist/seed/carousel-slides-seed-data.js +61 -192
- package/dist/seed/carousels-seed-data.js +18 -1
- package/dist/seed/cart-seed-data.d.ts +1 -18
- package/dist/seed/cart-seed-data.js +116 -293
- package/dist/seed/categories-seed-data.d.ts +0 -6
- package/dist/seed/categories-seed-data.js +1409 -1537
- package/dist/seed/claimed-coupons-seed-data.d.ts +0 -11
- package/dist/seed/claimed-coupons-seed-data.js +32 -29
- package/dist/seed/conversations-seed-data.d.ts +0 -6
- package/dist/seed/conversations-seed-data.js +132 -280
- package/dist/seed/coupon-usage-seed-data.d.ts +0 -16
- package/dist/seed/coupon-usage-seed-data.js +30 -44
- package/dist/seed/coupons-seed-data.d.ts +0 -6
- package/dist/seed/coupons-seed-data.js +141 -489
- package/dist/seed/events-seed-data.d.ts +0 -6
- package/dist/seed/events-seed-data.js +201 -379
- package/dist/seed/faq-seed-data.d.ts +0 -14
- package/dist/seed/faq-seed-data.js +609 -1184
- package/dist/seed/grouped-listings-seed-data.d.ts +119 -8
- package/dist/seed/grouped-listings-seed-data.js +148 -233
- package/dist/seed/history-seed-data.d.ts +0 -7
- package/dist/seed/history-seed-data.js +50 -54
- package/dist/seed/homepage-sections-seed-data.d.ts +0 -5
- package/dist/seed/homepage-sections-seed-data.js +83 -175
- package/dist/seed/index.d.ts +1 -1
- package/dist/seed/index.js +1 -1
- package/dist/seed/manifest.js +2 -2
- package/dist/seed/notifications-seed-data.d.ts +0 -6
- package/dist/seed/notifications-seed-data.js +309 -196
- package/dist/seed/offers-seed-data.d.ts +0 -8
- package/dist/seed/offers-seed-data.js +118 -197
- package/dist/seed/orders-seed-data.d.ts +2 -8
- package/dist/seed/orders-seed-data.js +248 -1510
- package/dist/seed/payouts-seed-data.d.ts +0 -6
- package/dist/seed/payouts-seed-data.js +102 -441
- package/dist/seed/products-auctions-seed-data.d.ts +1 -14
- package/dist/seed/products-auctions-seed-data.js +612 -1084
- package/dist/seed/products-preorders-seed-data.d.ts +119 -14
- package/dist/seed/products-preorders-seed-data.js +154 -455
- package/dist/seed/products-standard-seed-data.d.ts +1 -15
- package/dist/seed/products-standard-seed-data.js +1355 -4128
- package/dist/seed/reviews-seed-data.d.ts +2 -8
- package/dist/seed/reviews-seed-data.js +99 -1182
- package/dist/seed/scammers-seed-data.d.ts +0 -15
- package/dist/seed/scammers-seed-data.js +36 -37
- package/dist/seed/sessions-seed-data.d.ts +0 -13
- package/dist/seed/sessions-seed-data.js +58 -335
- package/dist/seed/site-settings-seed-data.d.ts +0 -4
- package/dist/seed/site-settings-seed-data.js +61 -52
- package/dist/seed/store-addresses-seed-data.js +27 -151
- package/dist/seed/store-extensions-seed-data.d.ts +0 -7
- package/dist/seed/store-extensions-seed-data.js +147 -261
- package/dist/seed/stores-seed-data.d.ts +0 -5
- package/dist/seed/stores-seed-data.js +222 -184
- package/dist/seed/sub-listings-seed-data.d.ts +119 -0
- package/dist/seed/sub-listings-seed-data.js +447 -0
- package/dist/seed/support-tickets-seed-data.d.ts +0 -7
- package/dist/seed/support-tickets-seed-data.js +82 -75
- package/dist/seed/users-seed-data.d.ts +0 -5
- package/dist/seed/users-seed-data.js +279 -634
- package/dist/seed/wishlists-seed-data.d.ts +0 -9
- package/dist/seed/wishlists-seed-data.js +36 -52
- package/dist/seo/json-ld.js +6 -4
- package/dist/styles.css +8052 -3
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/dist/utils/search-tokens.d.ts +2 -0
- package/dist/utils/search-tokens.js +21 -0
- package/package.json +2 -2
- package/scripts/seed-cli.mjs +2 -2
|
@@ -19,17 +19,8 @@ import { useCategoryTree, categoriesToFacetOptions } from "../../categories/hook
|
|
|
19
19
|
import { useBrands } from "../../products/hooks/useBrands";
|
|
20
20
|
import { useBulkSelection } from "../../../react/hooks/useBulkSelection";
|
|
21
21
|
import { TABLE_KEYS, VIEW_MODE } from "../../../constants/table-keys";
|
|
22
|
-
import {
|
|
23
|
-
|
|
24
|
-
const DEFAULT_SORT = sortBy(PRODUCT_FIELDS.CREATED_AT);
|
|
25
|
-
const PREORDER_SORT_OPTIONS = [
|
|
26
|
-
{ value: sortBy(PRODUCT_FIELDS.CREATED_AT), label: "Newest First" },
|
|
27
|
-
{ value: sortBy(PRODUCT_FIELDS.CREATED_AT, "ASC"), label: "Oldest First" },
|
|
28
|
-
{ value: sortBy(PRODUCT_FIELDS.PRE_ORDER_DELIVERY_DATE, "ASC"), label: "Delivery: Soonest" },
|
|
29
|
-
{ value: sortBy(PRODUCT_FIELDS.PRE_ORDER_DELIVERY_DATE), label: "Delivery: Furthest" },
|
|
30
|
-
{ value: sortBy(PRODUCT_FIELDS.PRICE, "ASC"), label: "Price: Low to High" },
|
|
31
|
-
{ value: sortBy(PRODUCT_FIELDS.PRICE), label: "Price: High to Low" },
|
|
32
|
-
];
|
|
22
|
+
import { PREORDER_SORT_OPTIONS } from "../../products/constants/sieve";
|
|
23
|
+
const DEFAULT_SORT = PREORDER_SORT_OPTIONS[2].value;
|
|
33
24
|
const FILTER_KEYS = [TABLE_KEYS.CATEGORY, TABLE_KEYS.BRAND, TABLE_KEYS.MIN_PRICE, TABLE_KEYS.MAX_PRICE, TABLE_KEYS.STORE_ID, TABLE_KEYS.PREORDER_STATUS, TABLE_KEYS.DATE_FROM, TABLE_KEYS.DATE_TO];
|
|
34
25
|
export function PreOrdersIndexListing({ initialData, categorySlug, brandName }) {
|
|
35
26
|
const table = useUrlTable({ defaults: { pageSize: "24", sort: DEFAULT_SORT } });
|
|
@@ -21,9 +21,7 @@ import { sanitizeProductForPublic } from "../../utils/sanitize";
|
|
|
21
21
|
const ERR_DB_NOT_REGISTERED = "Database provider not registered";
|
|
22
22
|
const ERR_PRODUCT_NOT_FOUND = "Product not found";
|
|
23
23
|
const UNAVAILABLE_PRODUCT_STATUSES = new Set([
|
|
24
|
-
"
|
|
25
|
-
"out_of_stock",
|
|
26
|
-
"discontinued",
|
|
24
|
+
"archived",
|
|
27
25
|
]);
|
|
28
26
|
function getRepo() {
|
|
29
27
|
const { db } = getProviders();
|
|
@@ -43,10 +41,8 @@ const productUpdateSchema = z
|
|
|
43
41
|
.enum([
|
|
44
42
|
"draft",
|
|
45
43
|
"published",
|
|
44
|
+
"in_review",
|
|
46
45
|
"archived",
|
|
47
|
-
"sold",
|
|
48
|
-
"discontinued",
|
|
49
|
-
"out_of_stock",
|
|
50
46
|
])
|
|
51
47
|
.optional(),
|
|
52
48
|
mainImage: z.string().optional(),
|
|
@@ -145,7 +141,7 @@ export const PATCH = createRouteHandler({
|
|
|
145
141
|
},
|
|
146
142
|
});
|
|
147
143
|
// --- DELETE /api/products/[id] ------------------------------------------------
|
|
148
|
-
// Soft-delete (sets status to "
|
|
144
|
+
// Soft-delete (sets status to "archived"). Auth required.
|
|
149
145
|
export const DELETE = createRouteHandler({
|
|
150
146
|
auth: true,
|
|
151
147
|
handler: async ({ user, params }) => {
|
|
@@ -166,7 +162,7 @@ export const DELETE = createRouteHandler({
|
|
|
166
162
|
return NextResponse.json({ success: false, error: "Not authorized to delete this product" }, { status: 403 });
|
|
167
163
|
}
|
|
168
164
|
await repo.update(id, {
|
|
169
|
-
status: "
|
|
165
|
+
status: "archived",
|
|
170
166
|
updatedAt: new Date().toISOString(),
|
|
171
167
|
});
|
|
172
168
|
// SB-UNI-V — bundle stock-sync handled by onProductStockChange Function.
|
|
@@ -13,19 +13,11 @@ import { pushWishlistOp } from "../../cart/utils/pending-ops";
|
|
|
13
13
|
import { useCategoryTree, categoriesToFacetOptions } from "../../categories/hooks/useCategoryTree";
|
|
14
14
|
import { useBrands } from "../hooks/useBrands";
|
|
15
15
|
import { TABLE_KEYS, VIEW_MODE } from "../../../constants/table-keys";
|
|
16
|
-
import { sortBy } from "../../../constants/sort";
|
|
17
|
-
import { PRODUCT_FIELDS } from "../../../constants/field-names";
|
|
18
16
|
import { useAuthGate } from "../../../react/hooks/useAuthGate";
|
|
19
17
|
import { ACTION_ID } from "../constants/action-defs";
|
|
20
|
-
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
{ value: sortBy(PRODUCT_FIELDS.AUCTION_END_DATE), label: "Ending Latest" },
|
|
24
|
-
{ value: sortBy(PRODUCT_FIELDS.CURRENT_BID, "ASC"), label: "Bid: Low to High" },
|
|
25
|
-
{ value: sortBy(PRODUCT_FIELDS.CURRENT_BID), label: "Bid: High to Low" },
|
|
26
|
-
{ value: sortBy(PRODUCT_FIELDS.CREATED_AT), label: "Newly Listed" },
|
|
27
|
-
{ value: sortBy(PRODUCT_FIELDS.CREATED_AT, "ASC"), label: "Oldest Listed" },
|
|
28
|
-
];
|
|
18
|
+
import { AUCTION_PUBLIC_SORT_OPTIONS } from "../constants/sieve";
|
|
19
|
+
const DEFAULT_SORT = AUCTION_PUBLIC_SORT_OPTIONS[0].value;
|
|
20
|
+
const AUCTION_SORT_OPTIONS = AUCTION_PUBLIC_SORT_OPTIONS;
|
|
29
21
|
const FILTER_KEYS = [TABLE_KEYS.CATEGORY, TABLE_KEYS.BRAND, TABLE_KEYS.MIN_BID, TABLE_KEYS.MAX_BID, TABLE_KEYS.STORE_ID, TABLE_KEYS.DATE_FROM, TABLE_KEYS.DATE_TO];
|
|
30
22
|
export function AuctionsIndexListing({ initialData, categorySlug, brandName }) {
|
|
31
23
|
const table = useUrlTable({ defaults: { pageSize: "24", sort: DEFAULT_SORT } });
|
|
@@ -10,17 +10,9 @@ import { useBrands } from "../hooks/useBrands";
|
|
|
10
10
|
import { MarketplacePrizeDrawCard } from "./MarketplacePrizeDrawCard";
|
|
11
11
|
import { ProductFilters } from "./ProductFilters";
|
|
12
12
|
import { TABLE_KEYS, VIEW_MODE } from "../../../constants/table-keys";
|
|
13
|
-
import {
|
|
13
|
+
import { PRIZE_DRAW_SORT_OPTIONS } from "../constants/sieve";
|
|
14
14
|
import { PRODUCT_FIELDS } from "../../../constants/field-names";
|
|
15
|
-
const DEFAULT_SORT =
|
|
16
|
-
const PRIZE_DRAW_SORT_OPTIONS = [
|
|
17
|
-
{ value: sortBy(PRODUCT_FIELDS.CREATED_AT), label: "Newest First" },
|
|
18
|
-
{ value: sortBy(PRODUCT_FIELDS.CREATED_AT, "ASC"), label: "Oldest First" },
|
|
19
|
-
{ value: sortBy(PRODUCT_FIELDS.PRIZE_REVEAL_WINDOW_START, "ASC"), label: "Reveal: Soonest" },
|
|
20
|
-
{ value: sortBy(PRODUCT_FIELDS.PRIZE_REVEAL_WINDOW_START), label: "Reveal: Furthest" },
|
|
21
|
-
{ value: sortBy(PRODUCT_FIELDS.PRICE, "ASC"), label: "Entry: Low to High" },
|
|
22
|
-
{ value: sortBy(PRODUCT_FIELDS.PRICE), label: "Entry: High to Low" },
|
|
23
|
-
];
|
|
15
|
+
const DEFAULT_SORT = PRIZE_DRAW_SORT_OPTIONS[0].value;
|
|
24
16
|
const FILTER_KEYS = [
|
|
25
17
|
TABLE_KEYS.CATEGORY,
|
|
26
18
|
TABLE_KEYS.BRAND,
|
|
@@ -15,18 +15,27 @@ export declare const PRODUCT_ADMIN_SORT_OPTIONS: readonly [{
|
|
|
15
15
|
}, {
|
|
16
16
|
readonly value: string;
|
|
17
17
|
readonly label: "Oldest First";
|
|
18
|
+
}, {
|
|
19
|
+
readonly value: string;
|
|
20
|
+
readonly label: "Price: Low to High";
|
|
18
21
|
}, {
|
|
19
22
|
readonly value: string;
|
|
20
23
|
readonly label: "Price: High to Low";
|
|
21
24
|
}, {
|
|
22
25
|
readonly value: string;
|
|
23
|
-
readonly label: "
|
|
26
|
+
readonly label: "Name: A–Z";
|
|
24
27
|
}, {
|
|
25
28
|
readonly value: string;
|
|
26
|
-
readonly label: "
|
|
29
|
+
readonly label: "Name: Z–A";
|
|
27
30
|
}, {
|
|
28
31
|
readonly value: string;
|
|
29
|
-
readonly label: "
|
|
32
|
+
readonly label: "Featured First";
|
|
33
|
+
}, {
|
|
34
|
+
readonly value: string;
|
|
35
|
+
readonly label: "Promoted First";
|
|
36
|
+
}, {
|
|
37
|
+
readonly value: string;
|
|
38
|
+
readonly label: "Recently Updated";
|
|
30
39
|
}, {
|
|
31
40
|
readonly value: string;
|
|
32
41
|
readonly label: "Most Viewed";
|
|
@@ -37,15 +46,30 @@ export declare const PRODUCT_SELLER_SORT_OPTIONS: readonly [{
|
|
|
37
46
|
}, {
|
|
38
47
|
readonly value: string;
|
|
39
48
|
readonly label: "Oldest First";
|
|
49
|
+
}, {
|
|
50
|
+
readonly value: string;
|
|
51
|
+
readonly label: "Price: Low to High";
|
|
40
52
|
}, {
|
|
41
53
|
readonly value: string;
|
|
42
54
|
readonly label: "Price: High to Low";
|
|
43
55
|
}, {
|
|
44
56
|
readonly value: string;
|
|
45
|
-
readonly label: "
|
|
57
|
+
readonly label: "Name: A–Z";
|
|
46
58
|
}, {
|
|
47
59
|
readonly value: string;
|
|
48
|
-
readonly label: "
|
|
60
|
+
readonly label: "Name: Z–A";
|
|
61
|
+
}, {
|
|
62
|
+
readonly value: string;
|
|
63
|
+
readonly label: "Featured First";
|
|
64
|
+
}, {
|
|
65
|
+
readonly value: string;
|
|
66
|
+
readonly label: "Promoted First";
|
|
67
|
+
}, {
|
|
68
|
+
readonly value: string;
|
|
69
|
+
readonly label: "Recently Updated";
|
|
70
|
+
}, {
|
|
71
|
+
readonly value: string;
|
|
72
|
+
readonly label: "Most Viewed";
|
|
49
73
|
}];
|
|
50
74
|
export declare const PRODUCT_PUBLIC_SORT_OPTIONS: readonly [{
|
|
51
75
|
readonly value: string;
|
|
@@ -55,16 +79,16 @@ export declare const PRODUCT_PUBLIC_SORT_OPTIONS: readonly [{
|
|
|
55
79
|
readonly label: "Oldest First";
|
|
56
80
|
}, {
|
|
57
81
|
readonly value: string;
|
|
58
|
-
readonly label: "Price:
|
|
82
|
+
readonly label: "Price: Low to High";
|
|
59
83
|
}, {
|
|
60
84
|
readonly value: string;
|
|
61
|
-
readonly label: "Price:
|
|
85
|
+
readonly label: "Price: High to Low";
|
|
62
86
|
}, {
|
|
63
87
|
readonly value: string;
|
|
64
|
-
readonly label: "
|
|
88
|
+
readonly label: "Name: A–Z";
|
|
65
89
|
}, {
|
|
66
90
|
readonly value: string;
|
|
67
|
-
readonly label: "
|
|
91
|
+
readonly label: "Name: Z–A";
|
|
68
92
|
}, {
|
|
69
93
|
readonly value: string;
|
|
70
94
|
readonly label: "Most Viewed";
|
|
@@ -8,7 +8,7 @@ import { SwitchFilter } from "../../filters/SwitchFilter";
|
|
|
8
8
|
import { Div } from "../../../ui";
|
|
9
9
|
import { TABLE_KEYS } from "../../../constants/table-keys";
|
|
10
10
|
import { PRODUCT_FIELDS } from "../../../constants/field-names";
|
|
11
|
-
import {
|
|
11
|
+
import { STANDARD_SORT_OPTIONS, STANDARD_PUBLIC_SORT_OPTIONS, } from "../constants/sieve";
|
|
12
12
|
export const PRODUCT_FILTER_KEYS = {
|
|
13
13
|
admin: [
|
|
14
14
|
TABLE_KEYS.CATEGORY,
|
|
@@ -48,33 +48,9 @@ export const PRODUCT_FILTER_KEYS = {
|
|
|
48
48
|
TABLE_KEYS.FEATURES,
|
|
49
49
|
],
|
|
50
50
|
};
|
|
51
|
-
const
|
|
52
|
-
const
|
|
53
|
-
export const
|
|
54
|
-
{ value: sortBy(PRODUCT_FIELDS.CREATED_AT), label: "Newest First" },
|
|
55
|
-
{ value: sortBy(PRODUCT_FIELDS.CREATED_AT, "ASC"), label: "Oldest First" },
|
|
56
|
-
{ value: sortBy(PRODUCT_FIELDS.PRICE), label: LABEL_PRICE_HIGH_TO_LOW },
|
|
57
|
-
{ value: sortBy(PRODUCT_FIELDS.PRICE, "ASC"), label: LABEL_PRICE_LOW_TO_HIGH },
|
|
58
|
-
{ value: sortBy(PRODUCT_FIELDS.TITLE, "ASC"), label: "Title A-Z" },
|
|
59
|
-
{ value: sortBy(PRODUCT_FIELDS.TITLE), label: "Title Z-A" },
|
|
60
|
-
{ value: sortBy(PRODUCT_FIELDS.VIEW_COUNT), label: "Most Viewed" },
|
|
61
|
-
];
|
|
62
|
-
export const PRODUCT_SELLER_SORT_OPTIONS = [
|
|
63
|
-
{ value: sortBy(PRODUCT_FIELDS.CREATED_AT), label: "Newest First" },
|
|
64
|
-
{ value: sortBy(PRODUCT_FIELDS.CREATED_AT, "ASC"), label: "Oldest First" },
|
|
65
|
-
{ value: sortBy(PRODUCT_FIELDS.PRICE), label: LABEL_PRICE_HIGH_TO_LOW },
|
|
66
|
-
{ value: sortBy(PRODUCT_FIELDS.PRICE, "ASC"), label: LABEL_PRICE_LOW_TO_HIGH },
|
|
67
|
-
{ value: sortBy(PRODUCT_FIELDS.TITLE, "ASC"), label: "Title A-Z" },
|
|
68
|
-
];
|
|
69
|
-
export const PRODUCT_PUBLIC_SORT_OPTIONS = [
|
|
70
|
-
{ value: sortBy(PRODUCT_FIELDS.CREATED_AT), label: "Newest First" },
|
|
71
|
-
{ value: sortBy(PRODUCT_FIELDS.CREATED_AT, "ASC"), label: "Oldest First" },
|
|
72
|
-
{ value: sortBy(PRODUCT_FIELDS.PRICE), label: LABEL_PRICE_HIGH_TO_LOW },
|
|
73
|
-
{ value: sortBy(PRODUCT_FIELDS.PRICE, "ASC"), label: LABEL_PRICE_LOW_TO_HIGH },
|
|
74
|
-
{ value: sortBy(PRODUCT_FIELDS.TITLE, "ASC"), label: "Title A–Z" },
|
|
75
|
-
{ value: sortBy(PRODUCT_FIELDS.TITLE), label: "Title Z–A" },
|
|
76
|
-
{ value: sortBy(PRODUCT_FIELDS.VIEW_COUNT), label: "Most Viewed" },
|
|
77
|
-
];
|
|
51
|
+
export const PRODUCT_ADMIN_SORT_OPTIONS = STANDARD_SORT_OPTIONS;
|
|
52
|
+
export const PRODUCT_SELLER_SORT_OPTIONS = STANDARD_SORT_OPTIONS;
|
|
53
|
+
export const PRODUCT_PUBLIC_SORT_OPTIONS = STANDARD_PUBLIC_SORT_OPTIONS;
|
|
78
54
|
export function getProductFilterKeys(variant) {
|
|
79
55
|
return PRODUCT_FILTER_KEYS[variant];
|
|
80
56
|
}
|
|
@@ -102,7 +78,8 @@ export function ProductFilters({ table, categoryOptions = [], brandOptions = [],
|
|
|
102
78
|
const defaultStatusOptions = [
|
|
103
79
|
{ value: PRODUCT_FIELDS.STATUS_VALUES.PUBLISHED, label: t("statusPublished") },
|
|
104
80
|
{ value: PRODUCT_FIELDS.STATUS_VALUES.DRAFT, label: t("statusDraft") },
|
|
105
|
-
{ value: PRODUCT_FIELDS.STATUS_VALUES.
|
|
81
|
+
{ value: PRODUCT_FIELDS.STATUS_VALUES.IN_REVIEW, label: t("statusInReview") },
|
|
82
|
+
{ value: PRODUCT_FIELDS.STATUS_VALUES.ARCHIVED, label: t("statusArchived") },
|
|
106
83
|
];
|
|
107
84
|
const splitPipe = (key) => table.get(key) ? table.get(key).split("|").filter(Boolean) : [];
|
|
108
85
|
const selectedCategories = splitPipe(TABLE_KEYS.CATEGORY);
|
|
@@ -15,9 +15,8 @@ import { PrizeDrawItemsEditor } from "./PrizeDrawItemsEditor";
|
|
|
15
15
|
export const PRODUCT_STATUS_OPTIONS = [
|
|
16
16
|
{ value: "draft", label: "Draft" },
|
|
17
17
|
{ value: "published", label: "Published" },
|
|
18
|
-
{ value: "
|
|
19
|
-
{ value: "
|
|
20
|
-
{ value: "sold", label: "Sold" },
|
|
18
|
+
{ value: "in_review", label: "In Review" },
|
|
19
|
+
{ value: "archived", label: "Archived" },
|
|
21
20
|
];
|
|
22
21
|
function readFileAsDataUrl(file) {
|
|
23
22
|
return new Promise((resolve) => {
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
export type SortOption = {
|
|
2
|
+
readonly value: string;
|
|
3
|
+
readonly label: string;
|
|
4
|
+
};
|
|
5
|
+
export declare const STANDARD_SORT_OPTIONS: readonly [{
|
|
6
|
+
readonly value: string;
|
|
7
|
+
readonly label: "Newest First";
|
|
8
|
+
}, {
|
|
9
|
+
readonly value: string;
|
|
10
|
+
readonly label: "Oldest First";
|
|
11
|
+
}, {
|
|
12
|
+
readonly value: string;
|
|
13
|
+
readonly label: "Price: Low to High";
|
|
14
|
+
}, {
|
|
15
|
+
readonly value: string;
|
|
16
|
+
readonly label: "Price: High to Low";
|
|
17
|
+
}, {
|
|
18
|
+
readonly value: string;
|
|
19
|
+
readonly label: "Name: A–Z";
|
|
20
|
+
}, {
|
|
21
|
+
readonly value: string;
|
|
22
|
+
readonly label: "Name: Z–A";
|
|
23
|
+
}, {
|
|
24
|
+
readonly value: string;
|
|
25
|
+
readonly label: "Featured First";
|
|
26
|
+
}, {
|
|
27
|
+
readonly value: string;
|
|
28
|
+
readonly label: "Promoted First";
|
|
29
|
+
}, {
|
|
30
|
+
readonly value: string;
|
|
31
|
+
readonly label: "Recently Updated";
|
|
32
|
+
}, {
|
|
33
|
+
readonly value: string;
|
|
34
|
+
readonly label: "Most Viewed";
|
|
35
|
+
}];
|
|
36
|
+
export declare const STANDARD_PUBLIC_SORT_OPTIONS: readonly [{
|
|
37
|
+
readonly value: string;
|
|
38
|
+
readonly label: "Newest First";
|
|
39
|
+
}, {
|
|
40
|
+
readonly value: string;
|
|
41
|
+
readonly label: "Oldest First";
|
|
42
|
+
}, {
|
|
43
|
+
readonly value: string;
|
|
44
|
+
readonly label: "Price: Low to High";
|
|
45
|
+
}, {
|
|
46
|
+
readonly value: string;
|
|
47
|
+
readonly label: "Price: High to Low";
|
|
48
|
+
}, {
|
|
49
|
+
readonly value: string;
|
|
50
|
+
readonly label: "Name: A–Z";
|
|
51
|
+
}, {
|
|
52
|
+
readonly value: string;
|
|
53
|
+
readonly label: "Name: Z–A";
|
|
54
|
+
}, {
|
|
55
|
+
readonly value: string;
|
|
56
|
+
readonly label: "Most Viewed";
|
|
57
|
+
}];
|
|
58
|
+
export declare const AUCTION_SORT_OPTIONS: readonly [{
|
|
59
|
+
readonly value: string;
|
|
60
|
+
readonly label: "Ending Soon";
|
|
61
|
+
}, {
|
|
62
|
+
readonly value: string;
|
|
63
|
+
readonly label: "Just Started";
|
|
64
|
+
}, {
|
|
65
|
+
readonly value: string;
|
|
66
|
+
readonly label: "Lowest Current Bid";
|
|
67
|
+
}, {
|
|
68
|
+
readonly value: string;
|
|
69
|
+
readonly label: "Highest Current Bid";
|
|
70
|
+
}, {
|
|
71
|
+
readonly value: string;
|
|
72
|
+
readonly label: "Lowest Starting Bid";
|
|
73
|
+
}, {
|
|
74
|
+
readonly value: string;
|
|
75
|
+
readonly label: "Most Bids";
|
|
76
|
+
}, {
|
|
77
|
+
readonly value: string;
|
|
78
|
+
readonly label: "Fewest Bids";
|
|
79
|
+
}, {
|
|
80
|
+
readonly value: string;
|
|
81
|
+
readonly label: "Buy It Now: Low–High";
|
|
82
|
+
}, {
|
|
83
|
+
readonly value: string;
|
|
84
|
+
readonly label: "Oldest Listed";
|
|
85
|
+
}];
|
|
86
|
+
export declare const AUCTION_PUBLIC_SORT_OPTIONS: readonly [{
|
|
87
|
+
readonly value: string;
|
|
88
|
+
readonly label: "Ending Soon";
|
|
89
|
+
}, {
|
|
90
|
+
readonly value: string;
|
|
91
|
+
readonly label: "Just Started";
|
|
92
|
+
}, {
|
|
93
|
+
readonly value: string;
|
|
94
|
+
readonly label: "Lowest Current Bid";
|
|
95
|
+
}, {
|
|
96
|
+
readonly value: string;
|
|
97
|
+
readonly label: "Highest Current Bid";
|
|
98
|
+
}, {
|
|
99
|
+
readonly value: string;
|
|
100
|
+
readonly label: "Most Bids";
|
|
101
|
+
}, {
|
|
102
|
+
readonly value: string;
|
|
103
|
+
readonly label: "Buy It Now: Low–High";
|
|
104
|
+
}];
|
|
105
|
+
export declare const PREORDER_SORT_OPTIONS: readonly [{
|
|
106
|
+
readonly value: string;
|
|
107
|
+
readonly label: "Earliest Delivery";
|
|
108
|
+
}, {
|
|
109
|
+
readonly value: string;
|
|
110
|
+
readonly label: "Latest Delivery";
|
|
111
|
+
}, {
|
|
112
|
+
readonly value: string;
|
|
113
|
+
readonly label: "Newest First";
|
|
114
|
+
}, {
|
|
115
|
+
readonly value: string;
|
|
116
|
+
readonly label: "Price: Low to High";
|
|
117
|
+
}, {
|
|
118
|
+
readonly value: string;
|
|
119
|
+
readonly label: "Price: High to Low";
|
|
120
|
+
}, {
|
|
121
|
+
readonly value: string;
|
|
122
|
+
readonly label: "Fewest Slots Left";
|
|
123
|
+
}, {
|
|
124
|
+
readonly value: string;
|
|
125
|
+
readonly label: "Lowest Deposit First";
|
|
126
|
+
}];
|
|
127
|
+
export declare const BUNDLE_SORT_OPTIONS: readonly [{
|
|
128
|
+
readonly value: string;
|
|
129
|
+
readonly label: "Newest First";
|
|
130
|
+
}, {
|
|
131
|
+
readonly value: string;
|
|
132
|
+
readonly label: "Price: Low to High";
|
|
133
|
+
}, {
|
|
134
|
+
readonly value: string;
|
|
135
|
+
readonly label: "Price: High to Low";
|
|
136
|
+
}, {
|
|
137
|
+
readonly value: "-savingsAmount";
|
|
138
|
+
readonly label: "Most Savings";
|
|
139
|
+
}, {
|
|
140
|
+
readonly value: "-bundleItemCount";
|
|
141
|
+
readonly label: "Most Items";
|
|
142
|
+
}];
|
|
143
|
+
export declare const PRIZE_DRAW_SORT_OPTIONS: readonly [{
|
|
144
|
+
readonly value: string;
|
|
145
|
+
readonly label: "Newest First";
|
|
146
|
+
}, {
|
|
147
|
+
readonly value: string;
|
|
148
|
+
readonly label: "Oldest First";
|
|
149
|
+
}, {
|
|
150
|
+
readonly value: string;
|
|
151
|
+
readonly label: "Reveal: Soonest";
|
|
152
|
+
}, {
|
|
153
|
+
readonly value: string;
|
|
154
|
+
readonly label: "Reveal: Furthest";
|
|
155
|
+
}, {
|
|
156
|
+
readonly value: string;
|
|
157
|
+
readonly label: "Entry: Low to High";
|
|
158
|
+
}, {
|
|
159
|
+
readonly value: string;
|
|
160
|
+
readonly label: "Entry: High to Low";
|
|
161
|
+
}];
|
|
162
|
+
export declare const SORT_OPTIONS_BY_LISTING_TYPE: Record<string, readonly SortOption[]>;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { sortBy } from "../../../constants/sort";
|
|
2
|
+
import { PRODUCT_FIELDS } from "../../../constants/field-names";
|
|
3
|
+
const LABEL_PRICE_HIGH = "Price: High to Low";
|
|
4
|
+
const LABEL_PRICE_LOW = "Price: Low to High";
|
|
5
|
+
const LABEL_NEWEST = "Newest First";
|
|
6
|
+
const LABEL_OLDEST = "Oldest First";
|
|
7
|
+
// ---------------------------------------------------------------------------
|
|
8
|
+
// Standard Products
|
|
9
|
+
// ---------------------------------------------------------------------------
|
|
10
|
+
export const STANDARD_SORT_OPTIONS = [
|
|
11
|
+
{ value: sortBy(PRODUCT_FIELDS.CREATED_AT), label: LABEL_NEWEST },
|
|
12
|
+
{ value: sortBy(PRODUCT_FIELDS.CREATED_AT, "ASC"), label: LABEL_OLDEST },
|
|
13
|
+
{ value: sortBy(PRODUCT_FIELDS.PRICE, "ASC"), label: LABEL_PRICE_LOW },
|
|
14
|
+
{ value: sortBy(PRODUCT_FIELDS.PRICE), label: LABEL_PRICE_HIGH },
|
|
15
|
+
{ value: sortBy(PRODUCT_FIELDS.TITLE, "ASC"), label: "Name: A–Z" },
|
|
16
|
+
{ value: sortBy(PRODUCT_FIELDS.TITLE), label: "Name: Z–A" },
|
|
17
|
+
{ value: sortBy(PRODUCT_FIELDS.FEATURED), label: "Featured First" },
|
|
18
|
+
{ value: sortBy(PRODUCT_FIELDS.IS_PROMOTED), label: "Promoted First" },
|
|
19
|
+
{ value: sortBy(PRODUCT_FIELDS.UPDATED_AT), label: "Recently Updated" },
|
|
20
|
+
{ value: sortBy(PRODUCT_FIELDS.VIEW_COUNT), label: "Most Viewed" },
|
|
21
|
+
];
|
|
22
|
+
export const STANDARD_PUBLIC_SORT_OPTIONS = [
|
|
23
|
+
STANDARD_SORT_OPTIONS[0],
|
|
24
|
+
STANDARD_SORT_OPTIONS[1],
|
|
25
|
+
STANDARD_SORT_OPTIONS[2],
|
|
26
|
+
STANDARD_SORT_OPTIONS[3],
|
|
27
|
+
STANDARD_SORT_OPTIONS[4],
|
|
28
|
+
STANDARD_SORT_OPTIONS[5],
|
|
29
|
+
STANDARD_SORT_OPTIONS[9],
|
|
30
|
+
];
|
|
31
|
+
// ---------------------------------------------------------------------------
|
|
32
|
+
// Auctions
|
|
33
|
+
// ---------------------------------------------------------------------------
|
|
34
|
+
export const AUCTION_SORT_OPTIONS = [
|
|
35
|
+
{ value: sortBy(PRODUCT_FIELDS.AUCTION_END_DATE, "ASC"), label: "Ending Soon" },
|
|
36
|
+
{ value: sortBy(PRODUCT_FIELDS.CREATED_AT), label: "Just Started" },
|
|
37
|
+
{ value: sortBy(PRODUCT_FIELDS.CURRENT_BID, "ASC"), label: "Lowest Current Bid" },
|
|
38
|
+
{ value: sortBy(PRODUCT_FIELDS.CURRENT_BID), label: "Highest Current Bid" },
|
|
39
|
+
{ value: sortBy(PRODUCT_FIELDS.STARTING_BID, "ASC"), label: "Lowest Starting Bid" },
|
|
40
|
+
{ value: sortBy(PRODUCT_FIELDS.BID_COUNT), label: "Most Bids" },
|
|
41
|
+
{ value: sortBy(PRODUCT_FIELDS.BID_COUNT, "ASC"), label: "Fewest Bids" },
|
|
42
|
+
{ value: sortBy(PRODUCT_FIELDS.BUY_NOW_PRICE, "ASC"), label: "Buy It Now: Low–High" },
|
|
43
|
+
{ value: sortBy(PRODUCT_FIELDS.CREATED_AT, "ASC"), label: "Oldest Listed" },
|
|
44
|
+
];
|
|
45
|
+
export const AUCTION_PUBLIC_SORT_OPTIONS = [
|
|
46
|
+
AUCTION_SORT_OPTIONS[0],
|
|
47
|
+
AUCTION_SORT_OPTIONS[1],
|
|
48
|
+
AUCTION_SORT_OPTIONS[2],
|
|
49
|
+
AUCTION_SORT_OPTIONS[3],
|
|
50
|
+
AUCTION_SORT_OPTIONS[5],
|
|
51
|
+
AUCTION_SORT_OPTIONS[7],
|
|
52
|
+
];
|
|
53
|
+
// ---------------------------------------------------------------------------
|
|
54
|
+
// Pre-Orders
|
|
55
|
+
// ---------------------------------------------------------------------------
|
|
56
|
+
export const PREORDER_SORT_OPTIONS = [
|
|
57
|
+
{ value: sortBy(PRODUCT_FIELDS.PRE_ORDER_DELIVERY_DATE, "ASC"), label: "Earliest Delivery" },
|
|
58
|
+
{ value: sortBy(PRODUCT_FIELDS.PRE_ORDER_DELIVERY_DATE), label: "Latest Delivery" },
|
|
59
|
+
{ value: sortBy(PRODUCT_FIELDS.CREATED_AT), label: LABEL_NEWEST },
|
|
60
|
+
{ value: sortBy(PRODUCT_FIELDS.PRICE, "ASC"), label: LABEL_PRICE_LOW },
|
|
61
|
+
{ value: sortBy(PRODUCT_FIELDS.PRICE), label: LABEL_PRICE_HIGH },
|
|
62
|
+
{ value: sortBy(PRODUCT_FIELDS.PRE_ORDER_CURRENT_COUNT), label: "Fewest Slots Left" },
|
|
63
|
+
{ value: sortBy(PRODUCT_FIELDS.PRE_ORDER_DEPOSIT_AMOUNT, "ASC"), label: "Lowest Deposit First" },
|
|
64
|
+
];
|
|
65
|
+
// ---------------------------------------------------------------------------
|
|
66
|
+
// Bundles
|
|
67
|
+
// ---------------------------------------------------------------------------
|
|
68
|
+
export const BUNDLE_SORT_OPTIONS = [
|
|
69
|
+
{ value: sortBy(PRODUCT_FIELDS.CREATED_AT), label: LABEL_NEWEST },
|
|
70
|
+
{ value: sortBy(PRODUCT_FIELDS.PRICE, "ASC"), label: LABEL_PRICE_LOW },
|
|
71
|
+
{ value: sortBy(PRODUCT_FIELDS.PRICE), label: LABEL_PRICE_HIGH },
|
|
72
|
+
{ value: "-savingsAmount", label: "Most Savings" },
|
|
73
|
+
{ value: "-bundleItemCount", label: "Most Items" },
|
|
74
|
+
];
|
|
75
|
+
// ---------------------------------------------------------------------------
|
|
76
|
+
// Prize Draws
|
|
77
|
+
// ---------------------------------------------------------------------------
|
|
78
|
+
export const PRIZE_DRAW_SORT_OPTIONS = [
|
|
79
|
+
{ value: sortBy(PRODUCT_FIELDS.CREATED_AT), label: LABEL_NEWEST },
|
|
80
|
+
{ value: sortBy(PRODUCT_FIELDS.CREATED_AT, "ASC"), label: LABEL_OLDEST },
|
|
81
|
+
{ value: sortBy(PRODUCT_FIELDS.PRIZE_REVEAL_WINDOW_START, "ASC"), label: "Reveal: Soonest" },
|
|
82
|
+
{ value: sortBy(PRODUCT_FIELDS.PRIZE_REVEAL_WINDOW_START), label: "Reveal: Furthest" },
|
|
83
|
+
{ value: sortBy(PRODUCT_FIELDS.PRICE, "ASC"), label: "Entry: Low to High" },
|
|
84
|
+
{ value: sortBy(PRODUCT_FIELDS.PRICE), label: "Entry: High to Low" },
|
|
85
|
+
];
|
|
86
|
+
// ---------------------------------------------------------------------------
|
|
87
|
+
// Lookup by listing type
|
|
88
|
+
// ---------------------------------------------------------------------------
|
|
89
|
+
export const SORT_OPTIONS_BY_LISTING_TYPE = {
|
|
90
|
+
standard: STANDARD_SORT_OPTIONS,
|
|
91
|
+
auction: AUCTION_SORT_OPTIONS,
|
|
92
|
+
"pre-order": PREORDER_SORT_OPTIONS,
|
|
93
|
+
bundle: BUNDLE_SORT_OPTIONS,
|
|
94
|
+
"prize-draw": PRIZE_DRAW_SORT_OPTIONS,
|
|
95
|
+
};
|
|
@@ -202,6 +202,10 @@ export declare class ProductRepository extends BaseRepository<ProductDocument> {
|
|
|
202
202
|
canFilter: boolean;
|
|
203
203
|
canSort: boolean;
|
|
204
204
|
};
|
|
205
|
+
searchTokens: {
|
|
206
|
+
canFilter: boolean;
|
|
207
|
+
canSort: boolean;
|
|
208
|
+
};
|
|
205
209
|
};
|
|
206
210
|
/**
|
|
207
211
|
* Virtual filter aliases — callers can pass `f=listingType==auction` for
|
|
@@ -216,6 +220,7 @@ export declare class ProductRepository extends BaseRepository<ProductDocument> {
|
|
|
216
220
|
storeId?: string;
|
|
217
221
|
status?: string;
|
|
218
222
|
categoriesIn?: string[];
|
|
223
|
+
search?: string;
|
|
219
224
|
}): Promise<FirebaseSieveResult<ProductDocument>>;
|
|
220
225
|
incrementViewCount(productId: string): Promise<void>;
|
|
221
226
|
/**
|
|
@@ -2,7 +2,7 @@ import { increment, serverTimestamp } from "../../../contracts/field-ops";
|
|
|
2
2
|
import { DatabaseError } from "../../../errors";
|
|
3
3
|
import { BaseRepository, prepareForFirestore, } from "../../../providers/db-firebase";
|
|
4
4
|
import { cacheManager } from "../../../core";
|
|
5
|
-
import { generateUniqueId, slugify } from "../../../utils";
|
|
5
|
+
import { generateUniqueId, slugify, buildSearchTokens, tokenizeQuery } from "../../../utils";
|
|
6
6
|
import { PRODUCT_COLLECTION, ProductStatusValues, } from "../schemas";
|
|
7
7
|
import { PRODUCT_FIELDS } from "../../../constants/field-names";
|
|
8
8
|
/**
|
|
@@ -35,6 +35,9 @@ function buildListingKindClause(kind, inverted) {
|
|
|
35
35
|
const op = inverted ? "!=" : "==";
|
|
36
36
|
return `${PRODUCT_FIELDS.LISTING_TYPE}${op}${canonical}`;
|
|
37
37
|
}
|
|
38
|
+
function buildProductSearchTokens(p) {
|
|
39
|
+
return buildSearchTokens(p.title, p.description, p.brand, p.brandSlug, p.categoryNames, p.tags, p.features, p.condition, p.card?.setName, p.card?.cardNumber, p.grading?.service, p.specifications?.map((s) => `${s.name} ${s.value}`));
|
|
40
|
+
}
|
|
38
41
|
export class ProductRepository extends BaseRepository {
|
|
39
42
|
constructor() {
|
|
40
43
|
super(PRODUCT_COLLECTION);
|
|
@@ -80,7 +83,12 @@ export class ProductRepository extends BaseRepository {
|
|
|
80
83
|
}
|
|
81
84
|
async update(id, data) {
|
|
82
85
|
this.cacheInvalidateForId(id);
|
|
83
|
-
const
|
|
86
|
+
const current = await super.findById(id);
|
|
87
|
+
const merged = { ...current, ...data };
|
|
88
|
+
const updated = await super.update(id, {
|
|
89
|
+
...data,
|
|
90
|
+
searchTokens: buildProductSearchTokens(merged),
|
|
91
|
+
});
|
|
84
92
|
this.cacheSet(updated);
|
|
85
93
|
return updated;
|
|
86
94
|
}
|
|
@@ -100,6 +108,7 @@ export class ProductRepository extends BaseRepository {
|
|
|
100
108
|
...input,
|
|
101
109
|
slug: id,
|
|
102
110
|
availableQuantity: input.stockQuantity,
|
|
111
|
+
searchTokens: buildProductSearchTokens(input),
|
|
103
112
|
createdAt: new Date(),
|
|
104
113
|
updatedAt: new Date(),
|
|
105
114
|
};
|
|
@@ -320,7 +329,17 @@ export class ProductRepository extends BaseRepository {
|
|
|
320
329
|
if (opts?.storeId) {
|
|
321
330
|
baseQuery = baseQuery.where(PRODUCT_FIELDS.STORE_ID, "==", opts.storeId);
|
|
322
331
|
}
|
|
323
|
-
|
|
332
|
+
const searchTokens = tokenizeQuery(opts?.search ?? "");
|
|
333
|
+
if (searchTokens.length > 0 && opts?.categoriesIn && opts.categoriesIn.length > 0) {
|
|
334
|
+
// Firestore cannot combine two array operators in one query
|
|
335
|
+
}
|
|
336
|
+
else if (searchTokens.length === 1) {
|
|
337
|
+
baseQuery = baseQuery.where("searchTokens", "array-contains", searchTokens[0]);
|
|
338
|
+
}
|
|
339
|
+
else if (searchTokens.length > 1) {
|
|
340
|
+
baseQuery = baseQuery.where("searchTokens", "array-contains-any", searchTokens);
|
|
341
|
+
}
|
|
342
|
+
if (searchTokens.length === 0 && opts?.categoriesIn && opts.categoriesIn.length > 0) {
|
|
324
343
|
baseQuery = baseQuery.where(PRODUCT_FIELDS.CATEGORY_SLUGS, "array-contains-any", opts.categoriesIn);
|
|
325
344
|
}
|
|
326
345
|
return this.sieveQuery(model, ProductRepository.SIEVE_FIELDS, {
|
|
@@ -464,6 +483,7 @@ ProductRepository.SIEVE_FIELDS = {
|
|
|
464
483
|
insurance: { canFilter: true, canSort: false },
|
|
465
484
|
currency: { canFilter: true, canSort: false },
|
|
466
485
|
freeShipping: { canFilter: true, canSort: false },
|
|
486
|
+
searchTokens: { canFilter: true, canSort: false },
|
|
467
487
|
};
|
|
468
488
|
/**
|
|
469
489
|
* Virtual filter aliases — callers can pass `f=listingType==auction` for
|
|
@@ -169,6 +169,7 @@ export interface ProductDocument {
|
|
|
169
169
|
preOrderCurrentCount?: number;
|
|
170
170
|
preOrderProductionStatus?: "upcoming" | "in_production" | "ready_to_ship";
|
|
171
171
|
preOrderCancellable?: boolean;
|
|
172
|
+
preOrderClosed?: boolean;
|
|
172
173
|
isPromoted?: boolean;
|
|
173
174
|
isOnSale?: boolean;
|
|
174
175
|
isSold?: boolean;
|
|
@@ -246,6 +247,7 @@ export interface ProductDocument {
|
|
|
246
247
|
shelf: string;
|
|
247
248
|
bin: string;
|
|
248
249
|
};
|
|
250
|
+
searchTokens?: string[];
|
|
249
251
|
createdAt: Date;
|
|
250
252
|
updatedAt: Date;
|
|
251
253
|
}
|
|
@@ -271,13 +273,11 @@ export interface PrizeDrawItem {
|
|
|
271
273
|
export declare const ProductStatusValues: {
|
|
272
274
|
readonly DRAFT: "draft";
|
|
273
275
|
readonly PUBLISHED: "published";
|
|
276
|
+
readonly IN_REVIEW: "in_review";
|
|
274
277
|
readonly ARCHIVED: "archived";
|
|
275
|
-
readonly SOLD: "sold";
|
|
276
|
-
readonly OUT_OF_STOCK: "out_of_stock";
|
|
277
|
-
readonly DISCONTINUED: "discontinued";
|
|
278
278
|
};
|
|
279
279
|
export declare const PRODUCT_COLLECTION: "products";
|
|
280
|
-
export declare const PRODUCT_INDEXED_FIELDS: readonly ["storeId", "status", "category", "featured", "listingType", "isPromoted", "isOnSale", "isSold", "createdAt"];
|
|
280
|
+
export declare const PRODUCT_INDEXED_FIELDS: readonly ["storeId", "status", "category", "featured", "listingType", "isPromoted", "isOnSale", "isSold", "searchTokens", "createdAt"];
|
|
281
281
|
export declare const DEFAULT_PRODUCT_DATA: Partial<ProductDocument>;
|
|
282
282
|
export declare const PRODUCT_PUBLIC_FIELDS: readonly ["id", "title", "description", "category", "subcategory", "brand", "price", "currency", "stockQuantity", "availableQuantity", "images", "status", "storeName", "featured", "tags", "specifications", "features", "shippingInfo", "returnPolicy", "listingType", "auctionEndDate", "startingBid", "currentBid", "bidCount", "reservePrice", "buyNowPrice", "minBidIncrement", "autoExtendable", "auctionExtensionMinutes", "auctionShippingPaidBy", "buyItNowPriceInPaise", "bidsHaveStarted", "grading", "card", "classified", "digitalCode", "liveItem", "catalogProductId", "preOrderDeliveryDate", "preOrderDepositPercent", "preOrderDepositAmount", "preOrderMaxQuantity", "preOrderCurrentCount", "preOrderProductionStatus", "preOrderCancellable", "condition", "insurance", "insuranceCost", "shippingPaidBy", "isPromoted", "isOnSale", "isSold", "slug", "seoTitle", "seoDescription", "seoKeywords", "viewCount", "customFields", "customSections", "sublistingCategoryId", "groupId", "isGroupParent", "groupParentSlug", "groupChildSlugs", "groupTitle", "createdAt"];
|
|
283
283
|
export declare const PRODUCT_UPDATABLE_FIELDS: readonly ["title", "description", "category", "subcategory", "brand", "price", "stockQuantity", "images", "status", "tags", "specifications", "features", "shippingInfo", "returnPolicy", "pickupAddressId", "condition", "insurance", "shippingPaidBy", "autoExtendable", "auctionExtensionMinutes", "auctionShippingPaidBy", "reservePrice", "buyNowPrice", "minBidIncrement", "buyItNowPriceInPaise", "bidsHaveStarted", "grading", "card", "classified", "digitalCode", "liveItem", "catalogProductId", "listingType", "preOrderDeliveryDate", "preOrderDepositPercent", "preOrderDepositAmount", "preOrderMaxQuantity", "preOrderProductionStatus", "preOrderCancellable", "isOnSale", "isSold", "seoTitle", "seoDescription", "seoKeywords", "customFields", "customSections", "sublistingCategoryId", "groupId", "isGroupParent", "groupParentSlug", "groupChildSlugs", "groupTitle"];
|