@mohasinac/appkit 2.6.1 → 2.6.3
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.d.ts +38 -0
- package/dist/_internal/client/features/layout/DashboardLayoutClient.js +75 -0
- package/dist/_internal/client/features/layout/RoleGuard.d.ts +15 -0
- package/dist/_internal/client/features/layout/RoleGuard.js +25 -0
- package/dist/_internal/client/features/layout/index.d.ts +5 -0
- package/dist/_internal/client/features/layout/index.js +4 -0
- package/dist/_internal/server/features/brands/actions.d.ts +3 -3
- package/dist/_internal/server/features/brands/actions.js +72 -5
- package/dist/_internal/server/features/brands/data.d.ts +8 -8
- package/dist/_internal/server/features/brands/data.js +10 -11
- package/dist/_internal/server/features/brands/service.d.ts +2 -2
- package/dist/_internal/server/features/brands/service.js +5 -5
- package/dist/_internal/server/features/categories/og.d.ts +33 -0
- package/dist/_internal/server/features/categories/og.js +75 -0
- package/dist/_internal/server/features/checkout/actions.d.ts +24 -0
- package/dist/_internal/server/features/checkout/actions.js +442 -13
- package/dist/_internal/server/features/checkout/index.d.ts +1 -1
- package/dist/_internal/server/features/checkout/index.js +1 -1
- package/dist/_internal/server/features/checkout/prize-bundle-gates.d.ts +59 -0
- package/dist/_internal/server/features/checkout/prize-bundle-gates.js +99 -0
- package/dist/_internal/server/features/grouped/data.js +12 -5
- package/dist/_internal/server/features/homepage/data.d.ts +1 -1
- package/dist/_internal/server/features/homepage/data.js +2 -2
- package/dist/_internal/server/features/media/contextGuards.d.ts +52 -0
- package/dist/_internal/server/features/media/contextGuards.js +198 -0
- package/dist/_internal/server/features/orders/adapters.js +12 -0
- package/dist/_internal/server/features/products/data.d.ts +1 -1
- package/dist/_internal/server/features/sublisting-categories/data.d.ts +1 -1
- package/dist/_internal/server/features/sublisting-categories/data.js +2 -2
- package/dist/_internal/server/jobs/handlers/assignSpinPrize.d.ts +24 -0
- package/dist/_internal/server/jobs/handlers/assignSpinPrize.js +86 -0
- package/dist/_internal/server/jobs/handlers/bundleStockSync.d.ts +18 -0
- package/dist/_internal/server/jobs/handlers/bundleStockSync.js +80 -0
- package/dist/_internal/server/jobs/handlers/index.d.ts +8 -0
- package/dist/_internal/server/jobs/handlers/index.js +13 -0
- package/dist/_internal/server/jobs/handlers/listingProcessor.js +13 -3
- package/dist/_internal/server/jobs/handlers/onProductStockChange.d.ts +17 -0
- package/dist/_internal/server/jobs/handlers/onProductStockChange.js +136 -0
- package/dist/_internal/server/jobs/handlers/onProductWrite.js +17 -1
- package/dist/_internal/server/jobs/handlers/prizeRevealClose.d.ts +9 -0
- package/dist/_internal/server/jobs/handlers/prizeRevealClose.js +29 -0
- package/dist/_internal/server/jobs/handlers/prizeRevealExpiry.d.ts +10 -0
- package/dist/_internal/server/jobs/handlers/prizeRevealExpiry.js +58 -0
- package/dist/_internal/server/jobs/handlers/prizeRevealOpen.d.ts +10 -0
- package/dist/_internal/server/jobs/handlers/prizeRevealOpen.js +65 -0
- package/dist/_internal/server/jobs/handlers/prizeRevealReminder.d.ts +9 -0
- package/dist/_internal/server/jobs/handlers/prizeRevealReminder.js +45 -0
- package/dist/_internal/server/jobs/handlers/triggerEventRaffle.d.ts +30 -0
- package/dist/_internal/server/jobs/handlers/triggerEventRaffle.js +94 -0
- package/dist/_internal/shared/features/brands/schema.d.ts +3 -3
- package/dist/_internal/shared/features/cart/schema.d.ts +8 -8
- package/dist/_internal/shared/features/cart/schema.js +1 -1
- package/dist/_internal/shared/features/categories/bundle-config.d.ts +17 -0
- package/dist/_internal/shared/features/categories/bundle-config.js +17 -0
- package/dist/_internal/shared/features/layout/config.d.ts +35 -0
- package/dist/_internal/shared/features/layout/config.js +58 -0
- package/dist/_internal/shared/features/layout/index.d.ts +3 -0
- package/dist/_internal/shared/features/layout/index.js +2 -0
- package/dist/_internal/shared/features/layout/types.d.ts +137 -0
- package/dist/_internal/shared/features/layout/types.js +13 -0
- package/dist/_internal/shared/features/products/types.d.ts +1 -1
- package/dist/_internal/shared/listing-types/_registry.d.ts +57 -0
- package/dist/_internal/shared/listing-types/_registry.js +28 -0
- package/dist/_internal/shared/listing-types/auction/config.d.ts +7 -0
- package/dist/_internal/shared/listing-types/auction/config.js +8 -0
- package/dist/_internal/shared/listing-types/auction/ctas.d.ts +1 -0
- package/dist/_internal/shared/listing-types/auction/ctas.js +2 -0
- package/dist/_internal/shared/listing-types/auction/og.d.ts +1 -0
- package/dist/_internal/shared/listing-types/auction/og.js +1 -0
- package/dist/_internal/shared/listing-types/auction/schema.d.ts +1 -0
- package/dist/_internal/shared/listing-types/auction/schema.js +1 -0
- package/dist/_internal/shared/listing-types/auction/seed-factory.d.ts +1 -0
- package/dist/_internal/shared/listing-types/auction/seed-factory.js +1 -0
- package/dist/_internal/shared/listing-types/capabilities.d.ts +41 -0
- package/dist/_internal/shared/listing-types/capabilities.js +75 -0
- package/dist/_internal/shared/listing-types/pre-order/config.d.ts +7 -0
- package/dist/_internal/shared/listing-types/pre-order/config.js +8 -0
- package/dist/_internal/shared/listing-types/pre-order/ctas.d.ts +1 -0
- package/dist/_internal/shared/listing-types/pre-order/ctas.js +2 -0
- package/dist/_internal/shared/listing-types/pre-order/og.d.ts +1 -0
- package/dist/_internal/shared/listing-types/pre-order/og.js +1 -0
- package/dist/_internal/shared/listing-types/pre-order/schema.d.ts +1 -0
- package/dist/_internal/shared/listing-types/pre-order/schema.js +1 -0
- package/dist/_internal/shared/listing-types/pre-order/seed-factory.d.ts +1 -0
- package/dist/_internal/shared/listing-types/pre-order/seed-factory.js +1 -0
- package/dist/_internal/shared/listing-types/prize-draw/config.d.ts +7 -0
- package/dist/_internal/shared/listing-types/prize-draw/config.js +8 -0
- package/dist/_internal/shared/listing-types/prize-draw/ctas.d.ts +1 -0
- package/dist/_internal/shared/listing-types/prize-draw/ctas.js +2 -0
- package/dist/_internal/shared/listing-types/prize-draw/og.d.ts +1 -0
- package/dist/_internal/shared/listing-types/prize-draw/og.js +1 -0
- package/dist/_internal/shared/listing-types/prize-draw/schema.d.ts +1 -0
- package/dist/_internal/shared/listing-types/prize-draw/schema.js +1 -0
- package/dist/_internal/shared/listing-types/prize-draw/seed-factory.d.ts +1 -0
- package/dist/_internal/shared/listing-types/prize-draw/seed-factory.js +1 -0
- package/dist/_internal/shared/listing-types/standard/config.d.ts +7 -0
- package/dist/_internal/shared/listing-types/standard/config.js +8 -0
- package/dist/_internal/shared/listing-types/standard/ctas.d.ts +1 -0
- package/dist/_internal/shared/listing-types/standard/ctas.js +3 -0
- package/dist/_internal/shared/listing-types/standard/og.d.ts +1 -0
- package/dist/_internal/shared/listing-types/standard/og.js +1 -0
- package/dist/_internal/shared/listing-types/standard/schema.d.ts +1 -0
- package/dist/_internal/shared/listing-types/standard/schema.js +1 -0
- package/dist/_internal/shared/listing-types/standard/seed-factory.d.ts +1 -0
- package/dist/_internal/shared/listing-types/standard/seed-factory.js +1 -0
- package/dist/_internal/shared/media/limits.d.ts +33 -0
- package/dist/_internal/shared/media/limits.js +97 -0
- package/dist/_internal/shared/schema-versions.d.ts +76 -0
- package/dist/_internal/shared/schema-versions.js +82 -0
- package/dist/client.d.ts +9 -0
- package/dist/client.js +7 -0
- package/dist/constants/api-endpoints.d.ts +6 -3
- package/dist/constants/api-endpoints.js +2 -1
- package/dist/errors/messages.d.ts +1 -1
- package/dist/errors/messages.js +1 -1
- package/dist/features/account/migrations.d.ts +2 -0
- package/dist/features/account/migrations.js +10 -0
- package/dist/features/admin/components/AdminMediaView.js +1 -1
- package/dist/features/admin/components/AdminProductsView.js +7 -3
- package/dist/features/admin/migrations.d.ts +2 -0
- package/dist/features/admin/migrations.js +10 -0
- package/dist/features/admin/types/product.types.d.ts +1 -1
- package/dist/features/auctions/components/MarketplaceAuctionCard.d.ts +1 -1
- package/dist/features/auctions/migrations.d.ts +2 -0
- package/dist/features/auctions/migrations.js +10 -0
- package/dist/features/auctions/schemas/index.d.ts +3 -3
- package/dist/features/auctions/schemas/index.js +1 -1
- package/dist/features/auth/migrations.d.ts +2 -0
- package/dist/features/auth/migrations.js +10 -0
- package/dist/features/blog/migrations.d.ts +2 -0
- package/dist/features/blog/migrations.js +10 -0
- package/dist/features/brands/migrations.d.ts +2 -0
- package/dist/features/brands/migrations.js +10 -0
- package/dist/features/bundles/components/BundlesByCategoryListing.d.ts +6 -0
- package/dist/features/bundles/components/BundlesByCategoryListing.js +50 -0
- package/dist/features/bundles/components/index.d.ts +2 -0
- package/dist/features/bundles/components/index.js +1 -0
- package/dist/features/bundles/migrations.d.ts +2 -0
- package/dist/features/bundles/migrations.js +10 -0
- package/dist/features/bundles/schemas/index.d.ts +1 -0
- package/dist/features/bundles/schemas/index.js +1 -0
- package/dist/features/bundles/schemas/zod.d.ts +377 -0
- package/dist/features/bundles/schemas/zod.js +71 -0
- package/dist/features/cart/migrations.d.ts +2 -0
- package/dist/features/cart/migrations.js +10 -0
- package/dist/features/cart/schemas/firestore.d.ts +2 -2
- package/dist/features/categories/components/BrandDetailPageView.js +35 -4
- package/dist/features/categories/components/BrandDetailTabs.d.ts +5 -1
- package/dist/features/categories/components/BrandDetailTabs.js +22 -8
- package/dist/features/categories/components/CategoryBundlesListing.d.ts +6 -0
- package/dist/features/categories/components/CategoryBundlesListing.js +74 -0
- package/dist/features/categories/components/CategoryDetailPageView.js +29 -4
- package/dist/features/categories/components/CategoryDetailTabs.d.ts +5 -1
- package/dist/features/categories/components/CategoryDetailTabs.js +22 -8
- package/dist/features/categories/migrations.d.ts +2 -0
- package/dist/features/categories/migrations.js +10 -0
- package/dist/features/categories/repository/categories.repository.d.ts +29 -0
- package/dist/features/categories/repository/categories.repository.js +83 -0
- package/dist/features/categories/schemas/firestore.d.ts +59 -2
- package/dist/features/categories/schemas/firestore.js +6 -0
- package/dist/features/categories/types/index.d.ts +11 -3
- package/dist/features/events/migrations.d.ts +2 -0
- package/dist/features/events/migrations.js +10 -0
- package/dist/features/faq/migrations.d.ts +2 -0
- package/dist/features/faq/migrations.js +10 -0
- package/dist/features/grouped/migrations.d.ts +2 -0
- package/dist/features/grouped/migrations.js +10 -0
- package/dist/features/grouped/schemas/firestore.d.ts +29 -10
- package/dist/features/grouped/schemas/firestore.js +10 -5
- package/dist/features/history/migrations.d.ts +2 -0
- package/dist/features/history/migrations.js +10 -0
- package/dist/features/homepage/hooks/useFeaturedAuctions.js +2 -2
- package/dist/features/homepage/hooks/useFeaturedPreOrders.js +2 -2
- package/dist/features/homepage/lib/section-renderer.js +5 -3
- package/dist/features/media/AvatarUpload.js +6 -28
- package/dist/features/media/hooks/useMedia.d.ts +31 -15
- package/dist/features/media/hooks/useMedia.js +48 -13
- package/dist/features/media/upload/ImageUpload.js +1 -1
- package/dist/features/media/upload/MediaUploadField.js +1 -1
- package/dist/features/messages/migrations.d.ts +2 -0
- package/dist/features/messages/migrations.js +10 -0
- package/dist/features/orders/components/OrdersList.js +10 -1
- package/dist/features/orders/migrations.d.ts +2 -0
- package/dist/features/orders/migrations.js +10 -0
- package/dist/features/orders/repository/orders.repository.d.ts +16 -0
- package/dist/features/orders/repository/orders.repository.js +49 -0
- package/dist/features/orders/schemas/firestore.d.ts +8 -0
- package/dist/features/orders/types/index.d.ts +12 -0
- package/dist/features/orders/utils/order-splitter.d.ts +2 -2
- package/dist/features/orders/utils/order-splitter.js +5 -0
- package/dist/features/payments/migrations.d.ts +2 -0
- package/dist/features/payments/migrations.js +10 -0
- package/dist/features/pre-orders/components/PreOrderDetailPageView.js +4 -1
- package/dist/features/products/actions/product-actions.d.ts +1 -1
- package/dist/features/products/api/[id]/route.js +34 -0
- package/dist/features/products/api/route.js +1 -19
- package/dist/features/products/components/CompareOverlay.d.ts +1 -1
- package/dist/features/products/components/MarketplacePrizeDrawCard.d.ts +24 -0
- package/dist/features/products/components/MarketplacePrizeDrawCard.js +102 -0
- package/dist/features/products/components/PrizeDrawCollage.d.ts +32 -0
- package/dist/features/products/components/PrizeDrawCollage.js +22 -0
- package/dist/features/products/components/PrizeDrawDetailPageView.d.ts +27 -0
- package/dist/features/products/components/PrizeDrawDetailPageView.js +118 -0
- package/dist/features/products/components/PrizeDrawEntryActions.d.ts +19 -0
- package/dist/features/products/components/PrizeDrawEntryActions.js +48 -0
- package/dist/features/products/components/PrizeDrawItemsEditor.d.ts +13 -0
- package/dist/features/products/components/PrizeDrawItemsEditor.js +97 -0
- package/dist/features/products/components/PrizeDrawsIndexListing.d.ts +8 -0
- package/dist/features/products/components/PrizeDrawsIndexListing.js +128 -0
- package/dist/features/products/components/PrizeDrawsListingView.d.ts +15 -0
- package/dist/features/products/components/PrizeDrawsListingView.js +49 -0
- package/dist/features/products/components/PrizeRevealModal.d.ts +34 -0
- package/dist/features/products/components/PrizeRevealModal.js +124 -0
- package/dist/features/products/components/ProductDetailPageView.js +13 -1
- package/dist/features/products/components/ProductForm.js +35 -2
- package/dist/features/products/components/ProductGrid.js +3 -1
- package/dist/features/products/components/index.d.ts +16 -0
- package/dist/features/products/components/index.js +8 -0
- package/dist/features/products/constants/listing-tabs.d.ts +113 -0
- package/dist/features/products/constants/listing-tabs.js +43 -0
- package/dist/features/products/index.d.ts +1 -0
- package/dist/features/products/index.js +1 -0
- package/dist/features/products/migrations.d.ts +2 -0
- package/dist/features/products/migrations.js +10 -0
- package/dist/features/products/repository/products.repository.d.ts +11 -7
- package/dist/features/products/repository/products.repository.js +49 -24
- package/dist/features/products/schemas/firestore.d.ts +3 -3
- package/dist/features/products/schemas/firestore.js +2 -2
- package/dist/features/products/schemas/index.d.ts +5 -5
- package/dist/features/products/schemas/index.js +3 -1
- package/dist/features/products/schemas/product-features.validators.d.ts +6 -6
- package/dist/features/products/types/index.d.ts +17 -1
- package/dist/features/products/utils/listing-type.d.ts +7 -4
- package/dist/features/products/utils/listing-type.js +8 -4
- package/dist/features/promotions/actions/coupon-actions.d.ts +1 -1
- package/dist/features/promotions/hooks/useCouponValidate.d.ts +1 -1
- package/dist/features/promotions/migrations.d.ts +2 -0
- package/dist/features/promotions/migrations.js +10 -0
- package/dist/features/promotions/repository/coupons.repository.d.ts +1 -1
- package/dist/features/promotions/schemas/index.d.ts +2 -2
- package/dist/features/reviews/migrations.d.ts +2 -0
- package/dist/features/reviews/migrations.js +10 -0
- package/dist/features/scams/migrations.d.ts +2 -0
- package/dist/features/scams/migrations.js +10 -0
- package/dist/features/search/api/route.d.ts +1 -1
- package/dist/features/search/api/route.js +3 -3
- package/dist/features/search/components/Search.d.ts +1 -1
- package/dist/features/search/schemas/index.d.ts +3 -3
- package/dist/features/search/schemas/index.js +3 -1
- package/dist/features/search/types/index.d.ts +2 -2
- package/dist/features/seller/components/SellerProductShell.d.ts +1 -1
- package/dist/features/seller/components/SellerProductsView.js +20 -6
- package/dist/features/seller/migrations.d.ts +2 -0
- package/dist/features/seller/migrations.js +10 -0
- package/dist/features/seller/schemas/index.d.ts +2 -2
- package/dist/features/stores/components/StoreBundlesPageView.d.ts +12 -0
- package/dist/features/stores/components/StoreBundlesPageView.js +24 -0
- package/dist/features/stores/components/StoreDetailLayoutView.js +15 -3
- package/dist/features/stores/components/StorePrizeDrawsPageView.d.ts +11 -0
- package/dist/features/stores/components/StorePrizeDrawsPageView.js +27 -0
- package/dist/features/stores/components/index.d.ts +2 -0
- package/dist/features/stores/migrations.d.ts +2 -0
- package/dist/features/stores/migrations.js +10 -0
- package/dist/features/stores/schemas/index.d.ts +2 -2
- package/dist/features/stores/types/index.d.ts +1 -1
- package/dist/features/sublisting/migrations.d.ts +2 -0
- package/dist/features/sublisting/migrations.js +10 -0
- package/dist/features/sublisting/schemas/firestore.d.ts +2 -0
- package/dist/features/support/migrations.d.ts +2 -0
- package/dist/features/support/migrations.js +10 -0
- package/dist/features/wishlist/migrations.d.ts +2 -0
- package/dist/features/wishlist/migrations.js +10 -0
- package/dist/features/wishlist/types/index.d.ts +1 -1
- package/dist/index.d.ts +26 -18
- package/dist/index.js +41 -24
- package/dist/jobs.d.ts +1 -1
- package/dist/jobs.js +4 -0
- package/dist/next/routing/route-map.d.ts +4 -0
- package/dist/next/routing/route-map.js +2 -0
- package/dist/providers/db-firebase/admin-app-lite.js +21 -0
- package/dist/providers/db-firebase/filter-aliases.d.ts +2 -2
- package/dist/repositories/index.d.ts +0 -5
- package/dist/repositories/index.js +5 -4
- package/dist/seed/actions/demo-seed-actions.d.ts +1 -1
- package/dist/seed/categories-seed-data.js +1105 -6
- package/dist/seed/faq-seed-data.js +160 -0
- package/dist/seed/grouped-listings-seed-data.js +32 -32
- package/dist/seed/homepage-sections-seed-data.js +52 -6
- package/dist/seed/index.d.ts +1 -3
- package/dist/seed/index.js +4 -3
- package/dist/seed/manifest.js +8 -13
- package/dist/seed/products-prize-draws-seed-data.d.ts +17 -0
- package/dist/seed/products-prize-draws-seed-data.js +313 -0
- package/dist/seo/json-ld.d.ts +1 -1
- package/dist/server-entry.d.ts +2 -2
- package/dist/server-entry.js +5 -3
- package/dist/server.d.ts +9 -2
- package/dist/server.js +11 -5
- package/dist/tailwind-utilities.css +1 -1
- package/dist/validation/schemas.d.ts +8 -8
- package/package.json +1 -1
- package/scripts/seed-cli.mjs +2 -4
|
@@ -10,11 +10,9 @@ const PRODUCT_FIELDS = {
|
|
|
10
10
|
FEATURED: "featured",
|
|
11
11
|
CATEGORY: "category",
|
|
12
12
|
SLUG: "slug",
|
|
13
|
-
// SB1-G (
|
|
14
|
-
//
|
|
13
|
+
// SB1-G (S3 2026-05-13) — canonical discriminator. Legacy `isAuction` /
|
|
14
|
+
// `isPreOrder` boolean fields were removed in this session.
|
|
15
15
|
LISTING_TYPE: "listingType",
|
|
16
|
-
IS_AUCTION: "isAuction",
|
|
17
|
-
IS_PRE_ORDER: "isPreOrder",
|
|
18
16
|
PRE_ORDER_DELIVERY_DATE: "preOrderDeliveryDate",
|
|
19
17
|
IS_PROMOTED: "isPromoted",
|
|
20
18
|
AUCTION_END_DATE: "auctionEndDate",
|
|
@@ -37,16 +35,23 @@ const LISTING_TYPE_VALUES = {
|
|
|
37
35
|
// clauses with single-field `listingType==X` clauses now that every doc
|
|
38
36
|
// carries the discriminator.
|
|
39
37
|
const SIEVE_CLAUSE_PUBLISHED = `${PRODUCT_FIELDS.STATUS}==${ProductStatusValues.PUBLISHED}`;
|
|
40
|
-
const
|
|
41
|
-
const
|
|
42
|
-
const
|
|
38
|
+
const SIEVE_CLAUSE_LT_AUCTION = `${PRODUCT_FIELDS.LISTING_TYPE}==${LISTING_TYPE_VALUES.AUCTION}`;
|
|
39
|
+
const SIEVE_CLAUSE_LT_PREORDER = `${PRODUCT_FIELDS.LISTING_TYPE}==${LISTING_TYPE_VALUES.PRE_ORDER}`;
|
|
40
|
+
const SIEVE_CLAUSE_LT_STANDARD = `${PRODUCT_FIELDS.LISTING_TYPE}==${LISTING_TYPE_VALUES.STANDARD}`;
|
|
41
|
+
const SIEVE_CLAUSE_LT_PRIZE_DRAW = `${PRODUCT_FIELDS.LISTING_TYPE}==${LISTING_TYPE_VALUES.PRIZE_DRAW}`;
|
|
42
|
+
const LISTING_KIND_ALIAS_MAP = {
|
|
43
|
+
standard: LISTING_TYPE_VALUES.STANDARD,
|
|
44
|
+
auction: LISTING_TYPE_VALUES.AUCTION,
|
|
45
|
+
"pre-order": LISTING_TYPE_VALUES.PRE_ORDER,
|
|
46
|
+
"prize-draw": LISTING_TYPE_VALUES.PRIZE_DRAW,
|
|
47
|
+
// Legacy → canonical.
|
|
48
|
+
product: LISTING_TYPE_VALUES.STANDARD,
|
|
49
|
+
preorder: LISTING_TYPE_VALUES.PRE_ORDER,
|
|
50
|
+
prizedraw: LISTING_TYPE_VALUES.PRIZE_DRAW,
|
|
51
|
+
};
|
|
52
|
+
const LISTING_KIND_ACCEPTED = new Set(Object.keys(LISTING_KIND_ALIAS_MAP));
|
|
43
53
|
function buildListingKindClause(kind, inverted) {
|
|
44
|
-
|
|
45
|
-
const canonical = kind === "auction"
|
|
46
|
-
? LISTING_TYPE_VALUES.AUCTION
|
|
47
|
-
: kind === "preorder"
|
|
48
|
-
? LISTING_TYPE_VALUES.PRE_ORDER
|
|
49
|
-
: LISTING_TYPE_VALUES.STANDARD;
|
|
54
|
+
const canonical = LISTING_KIND_ALIAS_MAP[kind];
|
|
50
55
|
const op = inverted ? "!=" : "==";
|
|
51
56
|
return `${PRODUCT_FIELDS.LISTING_TYPE}${op}${canonical}`;
|
|
52
57
|
}
|
|
@@ -399,6 +404,21 @@ export class ProductRepository extends BaseRepository {
|
|
|
399
404
|
updatedAt: serverTimestamp(),
|
|
400
405
|
});
|
|
401
406
|
}
|
|
407
|
+
/**
|
|
408
|
+
* SB6-C / SB4-H — atomically bump `prizeCurrentEntries` by `count`. The
|
|
409
|
+
* checkout transaction calls this after pool-cap validation; the reveal
|
|
410
|
+
* code-path uses it as a defence-in-depth check (already incremented at
|
|
411
|
+
* order create, so this is a no-op unless we shift accounting later).
|
|
412
|
+
*/
|
|
413
|
+
incrementPrizeEntriesInBatch(batch, productId, count) {
|
|
414
|
+
batch.update(this.db.collection(this.collection).doc(productId), {
|
|
415
|
+
prizeCurrentEntries: increment(count),
|
|
416
|
+
updatedAt: serverTimestamp(),
|
|
417
|
+
});
|
|
418
|
+
}
|
|
419
|
+
productRef(productId) {
|
|
420
|
+
return this.db.collection(this.collection).doc(productId);
|
|
421
|
+
}
|
|
402
422
|
}
|
|
403
423
|
ProductRepository.CACHE_TTL_MS = 30000;
|
|
404
424
|
ProductRepository.SIEVE_FIELDS = {
|
|
@@ -413,8 +433,7 @@ ProductRepository.SIEVE_FIELDS = {
|
|
|
413
433
|
storeId: { canFilter: true, canSort: false },
|
|
414
434
|
storeName: { canFilter: true, canSort: true },
|
|
415
435
|
featured: { canFilter: true, canSort: false },
|
|
416
|
-
|
|
417
|
-
isPreOrder: { canFilter: true, canSort: false },
|
|
436
|
+
listingType: { canFilter: true, canSort: false },
|
|
418
437
|
isPromoted: { canFilter: true, canSort: false },
|
|
419
438
|
price: { canFilter: true, canSort: true },
|
|
420
439
|
stockQuantity: { canFilter: true, canSort: true },
|
|
@@ -443,8 +462,8 @@ ProductRepository.SIEVE_FIELDS = {
|
|
|
443
462
|
freeShipping: { canFilter: true, canSort: false },
|
|
444
463
|
};
|
|
445
464
|
/**
|
|
446
|
-
* Virtual filter aliases — callers can pass `f=listingType==auction`
|
|
447
|
-
*
|
|
465
|
+
* Virtual filter aliases — callers can pass `f=listingType==auction` for
|
|
466
|
+
* the canonical listing-kind discriminator. The Sieve adapter expands the
|
|
448
467
|
* alias into real clauses before reaching Firestore.
|
|
449
468
|
*
|
|
450
469
|
* Adding a new alias here makes it usable everywhere `productRepository.list`
|
|
@@ -466,7 +485,11 @@ ProductRepository.FILTER_ALIASES = {
|
|
|
466
485
|
listingType: (value, operator) => {
|
|
467
486
|
if (operator !== "==" && operator !== "!=")
|
|
468
487
|
return "";
|
|
469
|
-
|
|
488
|
+
// Accept both canonical tokens (`standard`, `auction`, `pre-order`,
|
|
489
|
+
// `prize-draw`) and legacy aliases (`product`, `preorder`, `prizedraw`).
|
|
490
|
+
// `LISTING_KIND_ACCEPTED` is the single source of truth — keep it in
|
|
491
|
+
// sync with `LISTING_KIND_ALIAS_MAP`.
|
|
492
|
+
if (!LISTING_KIND_ACCEPTED.has(value))
|
|
470
493
|
return "";
|
|
471
494
|
return buildListingKindClause(value, operator === "!=");
|
|
472
495
|
},
|
|
@@ -474,9 +497,9 @@ ProductRepository.FILTER_ALIASES = {
|
|
|
474
497
|
* Public catalog scope shorthand. Maps a single token to the canonical
|
|
475
498
|
* combination most public pages use.
|
|
476
499
|
*
|
|
477
|
-
* scope==publicProducts → status==published,
|
|
478
|
-
* scope==publicAuctions → status==published,
|
|
479
|
-
* scope==publicPreorders → status==published,
|
|
500
|
+
* scope==publicProducts → status==published,listingType==standard
|
|
501
|
+
* scope==publicAuctions → status==published,listingType==auction
|
|
502
|
+
* scope==publicPreorders → status==published,listingType==pre-order
|
|
480
503
|
* scope==published → status==published
|
|
481
504
|
*/
|
|
482
505
|
scope: (value, operator) => {
|
|
@@ -484,11 +507,13 @@ ProductRepository.FILTER_ALIASES = {
|
|
|
484
507
|
return "";
|
|
485
508
|
switch (value) {
|
|
486
509
|
case "publicProducts":
|
|
487
|
-
return [SIEVE_CLAUSE_PUBLISHED,
|
|
510
|
+
return [SIEVE_CLAUSE_PUBLISHED, SIEVE_CLAUSE_LT_STANDARD].join(",");
|
|
488
511
|
case "publicAuctions":
|
|
489
|
-
return [SIEVE_CLAUSE_PUBLISHED,
|
|
512
|
+
return [SIEVE_CLAUSE_PUBLISHED, SIEVE_CLAUSE_LT_AUCTION].join(",");
|
|
490
513
|
case "publicPreorders":
|
|
491
|
-
return [SIEVE_CLAUSE_PUBLISHED,
|
|
514
|
+
return [SIEVE_CLAUSE_PUBLISHED, SIEVE_CLAUSE_LT_PREORDER].join(",");
|
|
515
|
+
case "publicPrizeDraws":
|
|
516
|
+
return [SIEVE_CLAUSE_PUBLISHED, SIEVE_CLAUSE_LT_PRIZE_DRAW].join(",");
|
|
492
517
|
case "published":
|
|
493
518
|
return SIEVE_CLAUSE_PUBLISHED;
|
|
494
519
|
default:
|
|
@@ -111,7 +111,7 @@ export interface ProductDocument {
|
|
|
111
111
|
* `where("listingType", "==", X)` against the `listingType+...` composite
|
|
112
112
|
* indexes in `appkit/firebase/base/firestore.indexes.json`.
|
|
113
113
|
*/
|
|
114
|
-
listingType: "standard" | "auction" | "pre-order" | "prize-draw"
|
|
114
|
+
listingType: "standard" | "auction" | "pre-order" | "prize-draw";
|
|
115
115
|
/** Hard cap on units a single user may purchase (SB1-B; bundle/prize-draw). */
|
|
116
116
|
maxPerUser?: number;
|
|
117
117
|
/** Reverse pointers — bundle ids that include this product. */
|
|
@@ -172,8 +172,8 @@ export declare const productQueryHelpers: {
|
|
|
172
172
|
readonly featured: () => readonly ["featured", "==", true];
|
|
173
173
|
readonly published: () => readonly ["status", "==", "published"];
|
|
174
174
|
readonly available: () => readonly ["availableQuantity", ">", 0];
|
|
175
|
-
readonly auctions: () => readonly ["
|
|
176
|
-
readonly preOrders: () => readonly ["
|
|
175
|
+
readonly auctions: () => readonly ["listingType", "==", "auction"];
|
|
176
|
+
readonly preOrders: () => readonly ["listingType", "==", "pre-order"];
|
|
177
177
|
readonly promoted: () => readonly ["isPromoted", "==", true];
|
|
178
178
|
readonly activeAuction: (date: Date) => readonly ["auctionEndDate", ">=", Date];
|
|
179
179
|
};
|
|
@@ -158,8 +158,8 @@ export const productQueryHelpers = {
|
|
|
158
158
|
featured: () => ["featured", "==", true],
|
|
159
159
|
published: () => ["status", "==", "published"],
|
|
160
160
|
available: () => ["availableQuantity", ">", 0],
|
|
161
|
-
auctions: () => ["
|
|
162
|
-
preOrders: () => ["
|
|
161
|
+
auctions: () => ["listingType", "==", "auction"],
|
|
162
|
+
preOrders: () => ["listingType", "==", "pre-order"],
|
|
163
163
|
promoted: () => ["isPromoted", "==", true],
|
|
164
164
|
activeAuction: (date) => ["auctionEndDate", ">=", date],
|
|
165
165
|
};
|
|
@@ -309,7 +309,7 @@ export declare const productItemSchema: z.ZodObject<{
|
|
|
309
309
|
rating?: number | undefined;
|
|
310
310
|
description?: string | undefined;
|
|
311
311
|
featured?: boolean | undefined;
|
|
312
|
-
listingType?: "auction" | "standard" | "
|
|
312
|
+
listingType?: "auction" | "standard" | "prize-draw" | "pre-order" | "bundle" | undefined;
|
|
313
313
|
isPromoted?: boolean | undefined;
|
|
314
314
|
slug?: string | undefined;
|
|
315
315
|
subcategory?: string | undefined;
|
|
@@ -438,7 +438,7 @@ export declare const productItemSchema: z.ZodObject<{
|
|
|
438
438
|
rating?: number | undefined;
|
|
439
439
|
description?: string | undefined;
|
|
440
440
|
featured?: boolean | undefined;
|
|
441
|
-
listingType?: "auction" | "standard" | "
|
|
441
|
+
listingType?: "auction" | "standard" | "prize-draw" | "pre-order" | "bundle" | undefined;
|
|
442
442
|
isPromoted?: boolean | undefined;
|
|
443
443
|
slug?: string | undefined;
|
|
444
444
|
subcategory?: string | undefined;
|
|
@@ -551,7 +551,7 @@ export declare const productListParamsSchema: z.ZodObject<{
|
|
|
551
551
|
minPrice: z.ZodOptional<z.ZodNumber>;
|
|
552
552
|
maxPrice: z.ZodOptional<z.ZodNumber>;
|
|
553
553
|
inStock: z.ZodOptional<z.ZodBoolean>;
|
|
554
|
-
|
|
554
|
+
listingType: z.ZodOptional<z.ZodEnum<["standard", "auction", "pre-order", "prize-draw", "bundle"]>>;
|
|
555
555
|
storeId: z.ZodOptional<z.ZodString>;
|
|
556
556
|
sort: z.ZodOptional<z.ZodString>;
|
|
557
557
|
page: z.ZodOptional<z.ZodNumber>;
|
|
@@ -568,8 +568,8 @@ export declare const productListParamsSchema: z.ZodObject<{
|
|
|
568
568
|
minPrice?: number | undefined;
|
|
569
569
|
maxPrice?: number | undefined;
|
|
570
570
|
featured?: boolean | undefined;
|
|
571
|
+
listingType?: "auction" | "standard" | "prize-draw" | "pre-order" | "bundle" | undefined;
|
|
571
572
|
condition?: "new" | "used" | "refurbished" | "fair" | "good" | "like_new" | "poor" | "broken" | undefined;
|
|
572
|
-
isAuction?: boolean | undefined;
|
|
573
573
|
inStock?: boolean | undefined;
|
|
574
574
|
}, {
|
|
575
575
|
sort?: string | undefined;
|
|
@@ -582,7 +582,7 @@ export declare const productListParamsSchema: z.ZodObject<{
|
|
|
582
582
|
minPrice?: number | undefined;
|
|
583
583
|
maxPrice?: number | undefined;
|
|
584
584
|
featured?: boolean | undefined;
|
|
585
|
+
listingType?: "auction" | "standard" | "prize-draw" | "pre-order" | "bundle" | undefined;
|
|
585
586
|
condition?: "new" | "used" | "refurbished" | "fair" | "good" | "like_new" | "poor" | "broken" | undefined;
|
|
586
|
-
isAuction?: boolean | undefined;
|
|
587
587
|
inStock?: boolean | undefined;
|
|
588
588
|
}>;
|
|
@@ -214,7 +214,9 @@ export const productListParamsSchema = z.object({
|
|
|
214
214
|
minPrice: z.coerce.number().optional(),
|
|
215
215
|
maxPrice: z.coerce.number().optional(),
|
|
216
216
|
inStock: z.coerce.boolean().optional(),
|
|
217
|
-
|
|
217
|
+
listingType: z
|
|
218
|
+
.enum(["standard", "auction", "pre-order", "prize-draw", "bundle"])
|
|
219
|
+
.optional(),
|
|
218
220
|
storeId: z.string().optional(),
|
|
219
221
|
sort: z.string().optional(),
|
|
220
222
|
page: z.coerce.number().optional(),
|
|
@@ -27,8 +27,8 @@ export declare const productFeatureAdminCreateSchema: z.ZodObject<{
|
|
|
27
27
|
icon: string;
|
|
28
28
|
isActive: boolean;
|
|
29
29
|
category: "seller" | "auction" | "preorder" | "shipping" | "custom" | "condition" | "platform";
|
|
30
|
-
displayOrder: number;
|
|
31
30
|
productTypes: ("all" | "product" | "auction" | "preorder")[];
|
|
31
|
+
displayOrder: number;
|
|
32
32
|
storeId?: string | undefined;
|
|
33
33
|
description?: string | undefined;
|
|
34
34
|
iconColor?: string | undefined;
|
|
@@ -38,8 +38,8 @@ export declare const productFeatureAdminCreateSchema: z.ZodObject<{
|
|
|
38
38
|
icon: string;
|
|
39
39
|
isActive: boolean;
|
|
40
40
|
category: "seller" | "auction" | "preorder" | "shipping" | "custom" | "condition" | "platform";
|
|
41
|
-
displayOrder: number;
|
|
42
41
|
productTypes: ("all" | "product" | "auction" | "preorder")[];
|
|
42
|
+
displayOrder: number;
|
|
43
43
|
storeId?: string | undefined;
|
|
44
44
|
description?: string | undefined;
|
|
45
45
|
iconColor?: string | undefined;
|
|
@@ -59,8 +59,8 @@ export declare const productFeatureStoreCreateSchema: z.ZodObject<{
|
|
|
59
59
|
icon: string;
|
|
60
60
|
isActive: boolean;
|
|
61
61
|
category: "seller" | "auction" | "preorder" | "shipping" | "custom" | "condition" | "platform";
|
|
62
|
-
displayOrder: number;
|
|
63
62
|
productTypes: ("all" | "product" | "auction" | "preorder")[];
|
|
63
|
+
displayOrder: number;
|
|
64
64
|
description?: string | undefined;
|
|
65
65
|
iconColor?: string | undefined;
|
|
66
66
|
}, {
|
|
@@ -68,8 +68,8 @@ export declare const productFeatureStoreCreateSchema: z.ZodObject<{
|
|
|
68
68
|
icon: string;
|
|
69
69
|
isActive: boolean;
|
|
70
70
|
category: "seller" | "auction" | "preorder" | "shipping" | "custom" | "condition" | "platform";
|
|
71
|
-
displayOrder: number;
|
|
72
71
|
productTypes: ("all" | "product" | "auction" | "preorder")[];
|
|
72
|
+
displayOrder: number;
|
|
73
73
|
description?: string | undefined;
|
|
74
74
|
iconColor?: string | undefined;
|
|
75
75
|
}>;
|
|
@@ -90,8 +90,8 @@ export declare const productFeatureUpdateSchema: z.ZodObject<{
|
|
|
90
90
|
category?: "seller" | "auction" | "preorder" | "shipping" | "custom" | "condition" | "platform" | undefined;
|
|
91
91
|
description?: string | undefined;
|
|
92
92
|
iconColor?: string | undefined;
|
|
93
|
-
displayOrder?: number | undefined;
|
|
94
93
|
productTypes?: ("all" | "product" | "auction" | "preorder")[] | undefined;
|
|
94
|
+
displayOrder?: number | undefined;
|
|
95
95
|
}, {
|
|
96
96
|
label?: string | undefined;
|
|
97
97
|
icon?: string | undefined;
|
|
@@ -99,8 +99,8 @@ export declare const productFeatureUpdateSchema: z.ZodObject<{
|
|
|
99
99
|
category?: "seller" | "auction" | "preorder" | "shipping" | "custom" | "condition" | "platform" | undefined;
|
|
100
100
|
description?: string | undefined;
|
|
101
101
|
iconColor?: string | undefined;
|
|
102
|
-
displayOrder?: number | undefined;
|
|
103
102
|
productTypes?: ("all" | "product" | "auction" | "preorder")[] | undefined;
|
|
103
|
+
displayOrder?: number | undefined;
|
|
104
104
|
}>;
|
|
105
105
|
export type ProductFeatureAdminCreatePayload = z.infer<typeof productFeatureAdminCreateSchema>;
|
|
106
106
|
export type ProductFeatureStoreCreatePayload = z.infer<typeof productFeatureStoreCreateSchema>;
|
|
@@ -10,7 +10,7 @@ export type ProductCondition = "new" | "like_new" | "good" | "fair" | "poor" | "
|
|
|
10
10
|
* accepts legacy alias tokens (`preorder` → `pre-order`, `product` → `standard`)
|
|
11
11
|
* but stored values are always one of these five.
|
|
12
12
|
*/
|
|
13
|
-
export type ListingType = "standard" | "auction" | "pre-order" | "prize-draw"
|
|
13
|
+
export type ListingType = "standard" | "auction" | "pre-order" | "prize-draw";
|
|
14
14
|
export interface ProductImage {
|
|
15
15
|
url: string;
|
|
16
16
|
thumbnailUrl?: string;
|
|
@@ -49,6 +49,12 @@ export interface ProductItem {
|
|
|
49
49
|
condition?: ProductCondition;
|
|
50
50
|
/** Canonical listing-kind discriminator (SB1-G Phase 4 — booleans removed). */
|
|
51
51
|
listingType?: ListingType;
|
|
52
|
+
/** Reverse refs maintained by the bundles repository (SB3) — IDs of every
|
|
53
|
+
* bundle whose `bundleItems[]` includes this product. Powers the "In bundle"
|
|
54
|
+
* badge on cards (SB7-A) + detail pages (SB7-B). */
|
|
55
|
+
partOfBundleIds?: string[];
|
|
56
|
+
/** Parallel array of titles — same length + index as `partOfBundleIds`. */
|
|
57
|
+
partOfBundleTitles?: string[];
|
|
52
58
|
sublistingCategoryId?: string;
|
|
53
59
|
groupId?: string;
|
|
54
60
|
isGroupParent?: boolean;
|
|
@@ -109,6 +115,16 @@ export interface ProductItem {
|
|
|
109
115
|
preOrderCurrentCount?: number;
|
|
110
116
|
preOrderProductionStatus?: "upcoming" | "in_production" | "ready_to_ship";
|
|
111
117
|
preOrderCancellable?: boolean;
|
|
118
|
+
prizeDrawItems?: import("../schemas/firestore").PrizeDrawItem[];
|
|
119
|
+
pricePerEntry?: number;
|
|
120
|
+
prizeMaxEntries?: number;
|
|
121
|
+
prizeCurrentEntries?: number;
|
|
122
|
+
prizeRevealWindowStart?: string | Date;
|
|
123
|
+
prizeRevealWindowEnd?: string | Date;
|
|
124
|
+
prizeRevealStatus?: "pending" | "open" | "closed";
|
|
125
|
+
prizeRevealDeadlineDays?: number;
|
|
126
|
+
prizeGithubFileUrl?: string;
|
|
127
|
+
maxPerUser?: number;
|
|
112
128
|
/** Winner's display name for ended auctions — shown masked in public UI */
|
|
113
129
|
winnerDisplayName?: string;
|
|
114
130
|
viewCount?: number;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { ListingType } from "../types/index";
|
|
2
2
|
/**
|
|
3
|
-
* Canonical accessor for the listing-kind discriminator.
|
|
4
|
-
*
|
|
5
|
-
* `
|
|
6
|
-
*
|
|
3
|
+
* Canonical accessor for the listing-kind discriminator. `listingType` is the
|
|
4
|
+
* single source of truth on every `ProductDocument` / `ProductItem` — the
|
|
5
|
+
* legacy `isAuction` / `isPreOrder` booleans were removed in S3 (SB1-G final,
|
|
6
|
+
* 2026-05-13).
|
|
7
7
|
*
|
|
8
8
|
* Returns `"standard"` when the input is undefined or missing the field, so
|
|
9
9
|
* legacy payloads still classify safely without a separate guard.
|
|
@@ -21,3 +21,6 @@ export declare const isPreOrderListing: (input?: {
|
|
|
21
21
|
export declare const isStandardListing: (input?: {
|
|
22
22
|
listingType?: ListingType;
|
|
23
23
|
}) => boolean;
|
|
24
|
+
export declare const isPrizeDrawListing: (input?: {
|
|
25
|
+
listingType?: ListingType;
|
|
26
|
+
}) => boolean;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Canonical accessor for the listing-kind discriminator.
|
|
3
|
-
*
|
|
4
|
-
* `
|
|
5
|
-
*
|
|
2
|
+
* Canonical accessor for the listing-kind discriminator. `listingType` is the
|
|
3
|
+
* single source of truth on every `ProductDocument` / `ProductItem` — the
|
|
4
|
+
* legacy `isAuction` / `isPreOrder` booleans were removed in S3 (SB1-G final,
|
|
5
|
+
* 2026-05-13).
|
|
6
6
|
*
|
|
7
7
|
* Returns `"standard"` when the input is undefined or missing the field, so
|
|
8
8
|
* legacy payloads still classify safely without a separate guard.
|
|
@@ -14,3 +14,7 @@ export function normalizeListingType(input) {
|
|
|
14
14
|
export const isAuctionListing = (input) => normalizeListingType(input) === "auction";
|
|
15
15
|
export const isPreOrderListing = (input) => normalizeListingType(input) === "pre-order";
|
|
16
16
|
export const isStandardListing = (input) => normalizeListingType(input) === "standard";
|
|
17
|
+
export const isPrizeDrawListing = (input) => normalizeListingType(input) === "prize-draw";
|
|
18
|
+
// SB-UNI-D — isBundleListing removed. Bundles are now a categoryType
|
|
19
|
+
// discriminator on CategoryDocument; consumers should query
|
|
20
|
+
// `categoriesRepository.findBySlugAndType(slug, "bundle")` instead.
|
|
@@ -22,7 +22,7 @@ export type CouponCartItem = {
|
|
|
22
22
|
price: number;
|
|
23
23
|
quantity: number;
|
|
24
24
|
/** Canonical listing-kind snapshot (SB1-G Phase 4). */
|
|
25
|
-
listingType: "standard" | "auction" | "pre-order" | "prize-draw"
|
|
25
|
+
listingType: "standard" | "auction" | "pre-order" | "prize-draw";
|
|
26
26
|
};
|
|
27
27
|
export declare function validateCoupon(userId: string, code: string, orderTotal: number): Promise<CouponValidationResult>;
|
|
28
28
|
export declare function validateCouponForCart(userId: string, code: string, cartItems: CouponCartItem[]): Promise<CouponCartValidationResult>;
|
|
@@ -7,7 +7,7 @@ interface ValidateCouponPayload {
|
|
|
7
7
|
price: number;
|
|
8
8
|
quantity: number;
|
|
9
9
|
/** Canonical listing-kind snapshot (SB1-G Phase 4). */
|
|
10
|
-
listingType?: "standard" | "auction" | "pre-order" | "prize-draw"
|
|
10
|
+
listingType?: "standard" | "auction" | "pre-order" | "prize-draw";
|
|
11
11
|
}>;
|
|
12
12
|
}
|
|
13
13
|
interface ValidateCouponResult {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// SB-UNI X3 — migrations shell for coupon/couponUsage.
|
|
2
|
+
// v1 schema is current; no migrations needed yet.
|
|
3
|
+
//
|
|
4
|
+
// To add a migration:
|
|
5
|
+
// 1. Bump the relevant SCHEMA_VERSIONS entry in
|
|
6
|
+
// `_internal/shared/schema-versions.ts` (e.g. `promotions: 2`)
|
|
7
|
+
// 2. Add a row below keyed by the FROM-version, returning the upgraded doc
|
|
8
|
+
// 3. Repository wraps reads with `migrateDocument(doc, current, migrations)`
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10
|
+
export const migrations = {};
|
|
@@ -140,7 +140,7 @@ export declare class CouponsRepository extends BaseRepository<CouponDocument> {
|
|
|
140
140
|
price: number;
|
|
141
141
|
quantity: number;
|
|
142
142
|
/** Canonical listing-kind snapshot (SB1-G Phase 4). */
|
|
143
|
-
listingType: "standard" | "auction" | "pre-order" | "prize-draw"
|
|
143
|
+
listingType: "standard" | "auction" | "pre-order" | "prize-draw";
|
|
144
144
|
}>): Promise<{
|
|
145
145
|
valid: boolean;
|
|
146
146
|
coupon?: CouponDocument;
|
|
@@ -47,8 +47,8 @@ export declare const couponItemSchema: z.ZodObject<{
|
|
|
47
47
|
scope: "admin" | "seller";
|
|
48
48
|
name: string;
|
|
49
49
|
isActive: boolean;
|
|
50
|
-
description: string;
|
|
51
50
|
isPublic: boolean;
|
|
51
|
+
description: string;
|
|
52
52
|
discountValue: number;
|
|
53
53
|
usageCount: number;
|
|
54
54
|
storeId?: string | undefined;
|
|
@@ -71,8 +71,8 @@ export declare const couponItemSchema: z.ZodObject<{
|
|
|
71
71
|
scope: "admin" | "seller";
|
|
72
72
|
name: string;
|
|
73
73
|
isActive: boolean;
|
|
74
|
-
description: string;
|
|
75
74
|
isPublic: boolean;
|
|
75
|
+
description: string;
|
|
76
76
|
discountValue: number;
|
|
77
77
|
usageCount: number;
|
|
78
78
|
storeId?: string | undefined;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// SB-UNI X3 — migrations shell for review.
|
|
2
|
+
// v1 schema is current; no migrations needed yet.
|
|
3
|
+
//
|
|
4
|
+
// To add a migration:
|
|
5
|
+
// 1. Bump the relevant SCHEMA_VERSIONS entry in
|
|
6
|
+
// `_internal/shared/schema-versions.ts` (e.g. `reviews: 2`)
|
|
7
|
+
// 2. Add a row below keyed by the FROM-version, returning the upgraded doc
|
|
8
|
+
// 3. Repository wraps reads with `migrateDocument(doc, current, migrations)`
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10
|
+
export const migrations = {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// SB-UNI X3 — migrations shell for scammer/incident/comment/contest.
|
|
2
|
+
// v1 schema is current; no migrations needed yet.
|
|
3
|
+
//
|
|
4
|
+
// To add a migration:
|
|
5
|
+
// 1. Bump the relevant SCHEMA_VERSIONS entry in
|
|
6
|
+
// `_internal/shared/schema-versions.ts` (e.g. `scams: 2`)
|
|
7
|
+
// 2. Add a row below keyed by the FROM-version, returning the upgraded doc
|
|
8
|
+
// 3. Repository wraps reads with `migrateDocument(doc, current, migrations)`
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10
|
+
export const migrations = {};
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*
|
|
10
10
|
* Performs Sieve-based product search via SearchRepository.
|
|
11
11
|
* Supports: q, category, subcategory, minPrice, maxPrice, condition,
|
|
12
|
-
*
|
|
12
|
+
* listingType, inStock, minRating, sort, page, pageSize.
|
|
13
13
|
*
|
|
14
14
|
* Note: external search providers are not built into this route. To enable one,
|
|
15
15
|
* register an ISearchProvider via registerProviders() and handle it at
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*
|
|
10
10
|
* Performs Sieve-based product search via SearchRepository.
|
|
11
11
|
* Supports: q, category, subcategory, minPrice, maxPrice, condition,
|
|
12
|
-
*
|
|
12
|
+
* listingType, inStock, minRating, sort, page, pageSize.
|
|
13
13
|
*
|
|
14
14
|
* Note: external search providers are not built into this route. To enable one,
|
|
15
15
|
* register an ISearchProvider via registerProviders() and handle it at
|
|
@@ -37,14 +37,14 @@ export async function GET(request) {
|
|
|
37
37
|
if (!db) {
|
|
38
38
|
return NextResponse.json({ success: false, error: "Database provider not registered" }, { status: 503 });
|
|
39
39
|
}
|
|
40
|
-
// SB1-G Phase 4 — canonical `?listingType=auction|pre-order|standard|prize-draw
|
|
40
|
+
// SB1-G Phase 4 — canonical `?listingType=auction|pre-order|standard|prize-draw`.
|
|
41
|
+
// SB-UNI-D — "bundle" removed; bundles are a categoryType, not a listingType.
|
|
41
42
|
const listingTypeRaw = param(url, "listingType");
|
|
42
43
|
const VALID_LISTING_TYPES = new Set([
|
|
43
44
|
"standard",
|
|
44
45
|
"auction",
|
|
45
46
|
"pre-order",
|
|
46
47
|
"prize-draw",
|
|
47
|
-
"bundle",
|
|
48
48
|
]);
|
|
49
49
|
const listingType = listingTypeRaw && VALID_LISTING_TYPES.has(listingTypeRaw)
|
|
50
50
|
? listingTypeRaw
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { LucideIcon } from "lucide-react";
|
|
2
2
|
import type { NavSuggestionRecord } from "../hooks/useNavSuggestions";
|
|
3
|
-
export type SearchResourceType = "products" | "auctions" | "pre-orders" | "stores" | "categories" | "brands" | "events" | "blog" | "faqs";
|
|
3
|
+
export type SearchResourceType = "products" | "auctions" | "pre-orders" | "prize-draws" | "bundles" | "stores" | "categories" | "brands" | "events" | "blog" | "faqs";
|
|
4
4
|
export interface SearchResourceTypeOption {
|
|
5
5
|
value: SearchResourceType;
|
|
6
6
|
label: string;
|
|
@@ -17,7 +17,7 @@ export declare const searchProductItemSchema: z.ZodObject<{
|
|
|
17
17
|
mainImage: z.ZodOptional<z.ZodString>;
|
|
18
18
|
status: z.ZodOptional<z.ZodString>;
|
|
19
19
|
featured: z.ZodOptional<z.ZodBoolean>;
|
|
20
|
-
|
|
20
|
+
listingType: z.ZodOptional<z.ZodEnum<["standard", "auction", "pre-order", "prize-draw", "bundle"]>>;
|
|
21
21
|
isPromoted: z.ZodOptional<z.ZodBoolean>;
|
|
22
22
|
slug: z.ZodString;
|
|
23
23
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -28,9 +28,9 @@ export declare const searchProductItemSchema: z.ZodObject<{
|
|
|
28
28
|
status?: string | undefined;
|
|
29
29
|
price?: number | undefined;
|
|
30
30
|
featured?: boolean | undefined;
|
|
31
|
+
listingType?: "auction" | "standard" | "prize-draw" | "pre-order" | "bundle" | undefined;
|
|
31
32
|
isPromoted?: boolean | undefined;
|
|
32
33
|
mainImage?: string | undefined;
|
|
33
|
-
isAuction?: boolean | undefined;
|
|
34
34
|
}, {
|
|
35
35
|
id: string;
|
|
36
36
|
title: string;
|
|
@@ -39,9 +39,9 @@ export declare const searchProductItemSchema: z.ZodObject<{
|
|
|
39
39
|
status?: string | undefined;
|
|
40
40
|
price?: number | undefined;
|
|
41
41
|
featured?: boolean | undefined;
|
|
42
|
+
listingType?: "auction" | "standard" | "prize-draw" | "pre-order" | "bundle" | undefined;
|
|
42
43
|
isPromoted?: boolean | undefined;
|
|
43
44
|
mainImage?: string | undefined;
|
|
44
|
-
isAuction?: boolean | undefined;
|
|
45
45
|
}>;
|
|
46
46
|
/**
|
|
47
47
|
* Form/query schema for a search request.
|
|
@@ -17,7 +17,9 @@ export const searchProductItemSchema = z.object({
|
|
|
17
17
|
mainImage: z.string().optional(),
|
|
18
18
|
status: z.string().optional(),
|
|
19
19
|
featured: z.boolean().optional(),
|
|
20
|
-
|
|
20
|
+
listingType: z
|
|
21
|
+
.enum(["standard", "auction", "pre-order", "prize-draw", "bundle"])
|
|
22
|
+
.optional(),
|
|
21
23
|
isPromoted: z.boolean().optional(),
|
|
22
24
|
slug: z.string(),
|
|
23
25
|
});
|
|
@@ -9,7 +9,7 @@ export interface SearchProductItem {
|
|
|
9
9
|
status: string;
|
|
10
10
|
featured?: boolean;
|
|
11
11
|
/** Canonical listing-kind discriminator (SB1-G Phase 4). */
|
|
12
|
-
listingType?: "standard" | "auction" | "pre-order" | "prize-draw"
|
|
12
|
+
listingType?: "standard" | "auction" | "pre-order" | "prize-draw";
|
|
13
13
|
currentBid?: number;
|
|
14
14
|
isPromoted?: boolean;
|
|
15
15
|
slug: string;
|
|
@@ -32,7 +32,7 @@ export interface SearchQuery {
|
|
|
32
32
|
maxPrice?: number;
|
|
33
33
|
condition?: string;
|
|
34
34
|
/** Canonical listing-kind discriminator (SB1-G Phase 4). */
|
|
35
|
-
listingType?: "standard" | "auction" | "pre-order" | "prize-draw"
|
|
35
|
+
listingType?: "standard" | "auction" | "pre-order" | "prize-draw";
|
|
36
36
|
inStock?: boolean;
|
|
37
37
|
minRating?: number;
|
|
38
38
|
sort?: string;
|