@mohasinac/appkit 3.0.4 → 3.1.0
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/lottery/LotteryAdminEditView.d.ts +42 -0
- package/dist/_internal/client/features/lottery/LotteryAdminEditView.js +86 -0
- package/dist/_internal/client/features/lottery/LotteryAdminSlotView.d.ts +14 -0
- package/dist/_internal/client/features/lottery/LotteryAdminSlotView.js +46 -0
- package/dist/_internal/client/features/lottery/LotteryDetailView.d.ts +28 -0
- package/dist/_internal/client/features/lottery/LotteryDetailView.js +17 -0
- package/dist/_internal/client/features/lottery/LotteryEntriesView.d.ts +23 -0
- package/dist/_internal/client/features/lottery/LotteryEntriesView.js +58 -0
- package/dist/_internal/client/features/lottery/LotteryListView.d.ts +21 -0
- package/dist/_internal/client/features/lottery/LotteryListView.js +25 -0
- package/dist/_internal/client/features/lottery/LotteryPullForm.d.ts +19 -0
- package/dist/_internal/client/features/lottery/LotteryPullForm.js +65 -0
- package/dist/_internal/client/features/lottery/LotterySlotGrid.d.ts +13 -0
- package/dist/_internal/client/features/lottery/LotterySlotGrid.js +21 -0
- package/dist/_internal/client/features/lottery/PrizeDrawLotteryDetailView.d.ts +28 -0
- package/dist/_internal/client/features/lottery/PrizeDrawLotteryDetailView.js +18 -0
- package/dist/_internal/server/features/auctions/__tests__/service.test.d.ts +1 -0
- package/dist/_internal/server/features/auctions/__tests__/service.test.js +140 -0
- package/dist/_internal/server/features/auctions/data.d.ts +2 -4
- package/dist/_internal/server/features/auctions/data.js +3 -9
- package/dist/_internal/server/features/checkout/__tests__/actions.test.d.ts +1 -0
- package/dist/_internal/server/features/checkout/__tests__/actions.test.js +600 -0
- package/dist/_internal/server/features/classified/adapters.d.ts +2 -15
- package/dist/_internal/server/features/classified/adapters.js +2 -17
- package/dist/_internal/server/features/classified/data.d.ts +1 -6
- package/dist/_internal/server/features/classified/data.js +2 -10
- package/dist/_internal/server/features/digital-code/adapters.d.ts +2 -15
- package/dist/_internal/server/features/digital-code/adapters.js +2 -17
- package/dist/_internal/server/features/digital-code/data.d.ts +1 -6
- package/dist/_internal/server/features/digital-code/data.js +2 -10
- package/dist/_internal/server/features/live/adapters.d.ts +2 -15
- package/dist/_internal/server/features/live/adapters.js +2 -17
- package/dist/_internal/server/features/live/data.d.ts +1 -6
- package/dist/_internal/server/features/live/data.js +2 -10
- package/dist/_internal/server/features/lottery/actions.d.ts +43 -0
- package/dist/_internal/server/features/lottery/actions.js +243 -0
- package/dist/_internal/server/features/lottery/adapters.d.ts +9 -0
- package/dist/_internal/server/features/lottery/adapters.js +21 -0
- package/dist/_internal/server/features/lottery/data.d.ts +20 -0
- package/dist/_internal/server/features/lottery/data.js +41 -0
- package/dist/_internal/server/features/lottery/metadata.d.ts +6 -0
- package/dist/_internal/server/features/lottery/metadata.js +31 -0
- package/dist/_internal/server/features/pre-orders/data.d.ts +2 -4
- package/dist/_internal/server/features/pre-orders/data.js +3 -9
- package/dist/_internal/server/features/prize-draws/actions.d.ts +2 -0
- package/dist/_internal/server/features/prize-draws/actions.js +22 -0
- package/dist/_internal/server/features/prize-draws/data.d.ts +1 -17
- package/dist/_internal/server/features/prize-draws/data.js +2 -20
- package/dist/_internal/server/features/prize-draws/index.d.ts +3 -1
- package/dist/_internal/server/features/prize-draws/index.js +2 -0
- package/dist/_internal/server/features/prize-draws/service.d.ts +3 -0
- package/dist/_internal/server/features/prize-draws/service.js +19 -0
- package/dist/_internal/server/features/refunds/__tests__/actions.test.d.ts +1 -0
- package/dist/_internal/server/features/refunds/__tests__/actions.test.js +263 -0
- package/dist/_internal/server/features/shared/listing-adapters.d.ts +19 -0
- package/dist/_internal/server/features/shared/listing-adapters.js +20 -0
- package/dist/_internal/server/features/shared/listing-data-factory.d.ts +9 -0
- package/dist/_internal/server/features/shared/listing-data-factory.js +33 -0
- package/dist/_internal/server/features/stores/data.d.ts +3 -14
- package/dist/_internal/server/features/stores/data.js +6 -44
- package/dist/_internal/server/jobs/core/__tests__/auctionSettlement.test.d.ts +1 -0
- package/dist/_internal/server/jobs/core/__tests__/auctionSettlement.test.js +249 -0
- package/dist/_internal/server/jobs/core/__tests__/onBidPlaced.test.d.ts +1 -0
- package/dist/_internal/server/jobs/core/__tests__/onBidPlaced.test.js +201 -0
- package/dist/_internal/server/jobs/core/__tests__/onOrderCreate.test.d.ts +1 -0
- package/dist/_internal/server/jobs/core/__tests__/onOrderCreate.test.js +169 -0
- package/dist/_internal/server/jobs/core/__tests__/onOrderStatusChange.test.d.ts +1 -0
- package/dist/_internal/server/jobs/core/__tests__/onOrderStatusChange.test.js +148 -0
- package/dist/_internal/server/jobs/core/__tests__/onProductStockChange.test.d.ts +1 -0
- package/dist/_internal/server/jobs/core/__tests__/onProductStockChange.test.js +210 -0
- package/dist/_internal/server/jobs/core/__tests__/onReviewWrite.test.d.ts +1 -0
- package/dist/_internal/server/jobs/core/__tests__/onReviewWrite.test.js +190 -0
- package/dist/_internal/server/jobs/core/__tests__/onUserBanChange.test.d.ts +1 -0
- package/dist/_internal/server/jobs/core/__tests__/onUserBanChange.test.js +161 -0
- package/dist/_internal/server/jobs/core/__tests__/payoutBatch.test.d.ts +1 -0
- package/dist/_internal/server/jobs/core/__tests__/payoutBatch.test.js +302 -0
- package/dist/_internal/server/jobs/core/__tests__/triggerEventRaffle.test.d.ts +1 -0
- package/dist/_internal/server/jobs/core/__tests__/triggerEventRaffle.test.js +252 -0
- package/dist/_internal/server/jobs/core/__tests__/wrapJobHandler.test.d.ts +1 -0
- package/dist/_internal/server/jobs/core/__tests__/wrapJobHandler.test.js +129 -0
- package/dist/_internal/shared/actions/action-registry.d.ts +1 -1
- package/dist/_internal/shared/actions/action-registry.js +46 -0
- package/dist/_internal/shared/features/cart/schema.d.ts +8 -8
- package/dist/_internal/shared/features/cart/schema.js +3 -0
- package/dist/_internal/shared/features/products/schema.d.ts +8 -8
- package/dist/_internal/shared/listing-types/_registry.js +2 -0
- package/dist/_internal/shared/listing-types/auction/schema.d.ts +3 -1
- package/dist/_internal/shared/listing-types/auction/schema.js +7 -1
- package/dist/_internal/shared/listing-types/classified/schema.d.ts +2 -1
- package/dist/_internal/shared/listing-types/classified/schema.js +3 -1
- package/dist/_internal/shared/listing-types/digital-code/schema.d.ts +3 -1
- package/dist/_internal/shared/listing-types/digital-code/schema.js +7 -1
- package/dist/_internal/shared/listing-types/live/schema.d.ts +2 -1
- package/dist/_internal/shared/listing-types/live/schema.js +3 -1
- package/dist/_internal/shared/listing-types/pre-order/schema.d.ts +3 -1
- package/dist/_internal/shared/listing-types/pre-order/schema.js +7 -1
- package/dist/_internal/shared/listing-types/prize-draw/schema.d.ts +3 -1
- package/dist/_internal/shared/listing-types/prize-draw/schema.js +13 -1
- package/dist/_internal/shared/listing-types/standard/schema.d.ts +2 -1
- package/dist/_internal/shared/listing-types/standard/schema.js +4 -1
- package/dist/_internal/shared/types/base-document.d.ts +15 -0
- package/dist/_internal/shared/types/base-document.js +1 -0
- package/dist/_internal/shared/types/index.d.ts +2 -0
- package/dist/_internal/shared/types/index.js +1 -0
- package/dist/client.d.ts +13 -4
- package/dist/client.js +11 -2
- package/dist/constants/api-endpoints.d.ts +12 -0
- package/dist/constants/api-endpoints.js +4 -0
- package/dist/constants/field-names.d.ts +5 -1
- package/dist/constants/field-names.js +5 -1
- package/dist/features/addresses/repository/__tests__/addresses.repository.test.d.ts +1 -0
- package/dist/features/addresses/repository/__tests__/addresses.repository.test.js +386 -0
- package/dist/features/addresses/schemas/firestore.d.ts +2 -4
- package/dist/features/admin/api/bids/route.d.ts +2 -2
- package/dist/features/admin/api/coupons/route.d.ts +2 -2
- package/dist/features/admin/api/products/route.d.ts +2 -2
- package/dist/features/admin/api/reviews/route.d.ts +2 -2
- package/dist/features/admin/components/AdminFulfillmentView.d.ts +6 -0
- package/dist/features/admin/components/AdminFulfillmentView.js +107 -0
- package/dist/features/admin/components/AdminProductEditorView.js +21 -9
- package/dist/features/admin/components/AdminProductsView.js +3 -0
- package/dist/features/admin/components/DataListingView.d.ts +1 -0
- package/dist/features/admin/components/index.d.ts +2 -0
- package/dist/features/admin/components/index.js +1 -0
- package/dist/features/admin/repository/__tests__/notification.repository.test.d.ts +1 -0
- package/dist/features/admin/repository/__tests__/notification.repository.test.js +356 -0
- package/dist/features/admin/repository/__tests__/site-settings.repository.test.d.ts +1 -0
- package/dist/features/admin/repository/__tests__/site-settings.repository.test.js +298 -0
- package/dist/features/admin/schemas/firestore.d.ts +3 -8
- package/dist/features/auctions/repository/__tests__/bid.repository.test.d.ts +1 -0
- package/dist/features/auctions/repository/__tests__/bid.repository.test.js +290 -0
- package/dist/features/auctions/schemas/firestore.d.ts +2 -4
- package/dist/features/auctions/schemas/index.d.ts +2 -2
- package/dist/features/auth/api/route.d.ts +2 -2
- package/dist/features/auth/repository/__tests__/session.repository.test.d.ts +1 -0
- package/dist/features/auth/repository/__tests__/session.repository.test.js +310 -0
- package/dist/features/auth/repository/__tests__/session.test.d.ts +1 -0
- package/dist/features/auth/repository/__tests__/session.test.js +146 -0
- package/dist/features/auth/repository/__tests__/sms-counter.repository.test.d.ts +1 -0
- package/dist/features/auth/repository/__tests__/sms-counter.repository.test.js +171 -0
- package/dist/features/auth/repository/__tests__/sms-counter.test.d.ts +1 -0
- package/dist/features/auth/repository/__tests__/sms-counter.test.js +88 -0
- package/dist/features/auth/repository/__tests__/token.repository.test.d.ts +1 -0
- package/dist/features/auth/repository/__tests__/token.repository.test.js +260 -0
- package/dist/features/auth/repository/__tests__/token.test.d.ts +1 -0
- package/dist/features/auth/repository/__tests__/token.test.js +140 -0
- package/dist/features/auth/repository/__tests__/user.repository.test.d.ts +1 -0
- package/dist/features/auth/repository/__tests__/user.repository.test.js +352 -0
- package/dist/features/auth/repository/__tests__/user.test.d.ts +1 -0
- package/dist/features/auth/repository/__tests__/user.test.js +226 -0
- package/dist/features/auth/repository/session.repository.js +10 -1
- package/dist/features/before-after/schemas/index.d.ts +2 -2
- package/dist/features/blog/schemas/firestore.d.ts +2 -4
- package/dist/features/blog/schemas/index.d.ts +4 -4
- package/dist/features/cart/repository/__tests__/cart.repository.test.d.ts +1 -0
- package/dist/features/cart/repository/__tests__/cart.repository.test.js +371 -0
- package/dist/features/cart/repository/cart.repository.js +2 -2
- package/dist/features/cart/schemas/firestore.d.ts +2 -4
- package/dist/features/categories/api/[id]/route.d.ts +4 -4
- package/dist/features/categories/api/route.d.ts +2 -2
- package/dist/features/categories/repository/__tests__/categories.repository.test.d.ts +1 -0
- package/dist/features/categories/repository/__tests__/categories.repository.test.js +813 -0
- package/dist/features/categories/schemas/firestore.d.ts +2 -4
- package/dist/features/categories/schemas/index.d.ts +4 -4
- package/dist/features/events/components/EventCard.js +1 -0
- package/dist/features/events/repository/__tests__/event.repository.test.d.ts +1 -0
- package/dist/features/events/repository/__tests__/event.repository.test.js +299 -0
- package/dist/features/events/schemas/firestore.d.ts +5 -4
- package/dist/features/events/schemas/index.d.ts +836 -16
- package/dist/features/events/schemas/index.js +80 -1
- package/dist/features/events/types/index.d.ts +4 -1
- package/dist/features/faq/repository/__tests__/faqs.repository.test.d.ts +1 -0
- package/dist/features/faq/repository/__tests__/faqs.repository.test.js +311 -0
- package/dist/features/faq/schemas/firestore.d.ts +2 -4
- package/dist/features/faq/schemas/index.d.ts +2 -2
- package/dist/features/grouped/schemas/index.d.ts +2 -2
- package/dist/features/history/repository/__tests__/user-history.repository.test.d.ts +1 -0
- package/dist/features/history/repository/__tests__/user-history.repository.test.js +180 -0
- package/dist/features/homepage/api/[id]/route.d.ts +4 -4
- package/dist/features/homepage/api/carousel/[id]/route.d.ts +4 -4
- package/dist/features/homepage/api/carousel/route.d.ts +2 -2
- package/dist/features/homepage/api/route.d.ts +2 -2
- package/dist/features/homepage/repository/__tests__/carousel.repository.test.d.ts +1 -0
- package/dist/features/homepage/repository/__tests__/carousel.repository.test.js +182 -0
- package/dist/features/homepage/repository/__tests__/homepage-sections.repository.test.d.ts +1 -0
- package/dist/features/homepage/repository/__tests__/homepage-sections.repository.test.js +185 -0
- package/dist/features/homepage/schemas/firestore.d.ts +4 -12
- package/dist/features/homepage/schemas/index.d.ts +2 -2
- package/dist/features/lottery/repository/lottery-entry.repository.d.ts +33 -0
- package/dist/features/lottery/repository/lottery-entry.repository.js +130 -0
- package/dist/features/lottery/schemas/firestore.d.ts +49 -0
- package/dist/features/lottery/schemas/firestore.js +25 -0
- package/dist/features/lottery/schemas/zod.d.ts +113 -0
- package/dist/features/lottery/schemas/zod.js +39 -0
- package/dist/features/lottery/types/index.d.ts +67 -0
- package/dist/features/lottery/types/index.js +55 -0
- package/dist/features/messages/repository/__tests__/conversations.repository.test.d.ts +1 -0
- package/dist/features/messages/repository/__tests__/conversations.repository.test.js +257 -0
- package/dist/features/messages/schemas/firestore.d.ts +2 -4
- package/dist/features/messages/schemas/index.d.ts +2 -2
- package/dist/features/orders/repository/__tests__/orders.repository.test.d.ts +1 -0
- package/dist/features/orders/repository/__tests__/orders.repository.test.js +211 -0
- package/dist/features/orders/repository/orders.repository.d.ts +5 -0
- package/dist/features/orders/repository/orders.repository.js +26 -0
- package/dist/features/orders/schemas/firestore.d.ts +9 -5
- package/dist/features/orders/schemas/firestore.js +3 -0
- package/dist/features/payments/repository/__tests__/payout.repository.test.d.ts +1 -0
- package/dist/features/payments/repository/__tests__/payout.repository.test.js +292 -0
- package/dist/features/payments/schemas/firestore.d.ts +2 -4
- package/dist/features/pre-orders/schemas/index.d.ts +2 -2
- package/dist/features/products/api/[id]/route.d.ts +4 -4
- package/dist/features/products/api/route.d.ts +2 -2
- package/dist/features/products/constants/action-defs.d.ts +16 -0
- package/dist/features/products/constants/action-defs.js +16 -0
- package/dist/features/products/constants/listing-tabs.d.ts +48 -0
- package/dist/features/products/constants/listing-tabs.js +12 -0
- package/dist/features/products/repository/__tests__/product-features.repository.test.d.ts +1 -0
- package/dist/features/products/repository/__tests__/product-features.repository.test.js +329 -0
- package/dist/features/products/repository/__tests__/products.repository.test.d.ts +1 -0
- package/dist/features/products/repository/__tests__/products.repository.test.js +607 -0
- package/dist/features/products/repository/products.repository.d.ts +37 -0
- package/dist/features/products/repository/products.repository.js +28 -1
- package/dist/features/products/schemas/firestore.d.ts +23 -7
- package/dist/features/products/schemas/firestore.js +2 -0
- package/dist/features/products/schemas/index.d.ts +18 -18
- package/dist/features/products/schemas/index.js +4 -2
- package/dist/features/products/types/index.d.ts +3 -1
- package/dist/features/promotions/repository/__tests__/claimed-coupons.repository.test.d.ts +1 -0
- package/dist/features/promotions/repository/__tests__/claimed-coupons.repository.test.js +219 -0
- package/dist/features/promotions/repository/__tests__/coupons.repository.test.d.ts +1 -0
- package/dist/features/promotions/repository/__tests__/coupons.repository.test.js +480 -0
- package/dist/features/promotions/schemas/firestore.d.ts +2 -4
- package/dist/features/promotions/schemas/index.d.ts +4 -4
- package/dist/features/reviews/api/[id]/route.d.ts +4 -4
- package/dist/features/reviews/api/route.d.ts +2 -2
- package/dist/features/reviews/repository/__tests__/reviews.repository.test.d.ts +1 -0
- package/dist/features/reviews/repository/__tests__/reviews.repository.test.js +327 -0
- package/dist/features/reviews/schemas/firestore.d.ts +2 -4
- package/dist/features/reviews/schemas/index.d.ts +2 -2
- package/dist/features/scams/repository/__tests__/scammer.repository.test.d.ts +1 -0
- package/dist/features/scams/repository/__tests__/scammer.repository.test.js +385 -0
- package/dist/features/scams/schemas/firestore.d.ts +2 -4
- package/dist/features/scams/schemas/index.d.ts +4 -4
- package/dist/features/search/repository/__tests__/search.repository.test.d.ts +1 -0
- package/dist/features/search/repository/__tests__/search.repository.test.js +369 -0
- package/dist/features/search/schemas/index.d.ts +2 -2
- package/dist/features/seller/api/coupons/route.d.ts +2 -2
- package/dist/features/seller/api/offers/route.d.ts +2 -2
- package/dist/features/seller/api/products/route.d.ts +2 -2
- package/dist/features/seller/api/store/route.d.ts +2 -2
- package/dist/features/seller/components/BarcodeField.d.ts +17 -0
- package/dist/features/seller/components/BarcodeField.js +30 -0
- package/dist/features/seller/components/FulfillmentView.d.ts +5 -0
- package/dist/features/seller/components/FulfillmentView.js +120 -0
- package/dist/features/seller/components/PrintCenterView.d.ts +3 -1
- package/dist/features/seller/components/PrintCenterView.js +52 -4
- package/dist/features/seller/components/SellerProductShell.d.ts +2 -0
- package/dist/features/seller/components/SellerProductShell.js +2 -1
- package/dist/features/seller/components/index.d.ts +4 -0
- package/dist/features/seller/components/index.js +2 -0
- package/dist/features/seller/repository/__tests__/offer.repository.test.d.ts +1 -0
- package/dist/features/seller/repository/__tests__/offer.repository.test.js +458 -0
- package/dist/features/seller/schemas/index.d.ts +2 -2
- package/dist/features/store-extensions/schemas/firestore.d.ts +12 -44
- package/dist/features/stores/components/StoreClassifiedsListing.d.ts +5 -0
- package/dist/features/stores/components/StoreClassifiedsListing.js +48 -0
- package/dist/features/stores/components/StoreClassifiedsPageView.d.ts +4 -0
- package/dist/features/stores/components/StoreClassifiedsPageView.js +20 -0
- package/dist/features/stores/components/StoreDetailLayoutView.js +23 -2
- package/dist/features/stores/components/StoreDigitalCodesListing.d.ts +5 -0
- package/dist/features/stores/components/StoreDigitalCodesListing.js +48 -0
- package/dist/features/stores/components/StoreDigitalCodesPageView.d.ts +4 -0
- package/dist/features/stores/components/StoreDigitalCodesPageView.js +20 -0
- package/dist/features/stores/components/StoreLiveItemsListing.d.ts +5 -0
- package/dist/features/stores/components/StoreLiveItemsListing.js +48 -0
- package/dist/features/stores/components/StoreLiveItemsPageView.d.ts +4 -0
- package/dist/features/stores/components/StoreLiveItemsPageView.js +20 -0
- package/dist/features/stores/components/index.d.ts +9 -0
- package/dist/features/stores/components/index.js +3 -0
- package/dist/features/stores/repository/__tests__/store.repository.test.d.ts +1 -0
- package/dist/features/stores/repository/__tests__/store.repository.test.js +261 -0
- package/dist/features/stores/schemas/firestore.d.ts +2 -4
- package/dist/features/stores/schemas/index.d.ts +4 -4
- package/dist/features/support/repository/__tests__/support.repository.test.d.ts +1 -0
- package/dist/features/support/repository/__tests__/support.repository.test.js +312 -0
- package/dist/features/support/schemas/firestore.d.ts +2 -4
- package/dist/features/support/schemas/index.d.ts +2 -2
- package/dist/features/wishlist/repository/__tests__/user-wishlist.repository.test.d.ts +1 -0
- package/dist/features/wishlist/repository/__tests__/user-wishlist.repository.test.js +139 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +17 -0
- package/dist/next/api/routeHandler.d.ts +1 -1
- package/dist/next/routing/route-map.d.ts +24 -0
- package/dist/next/routing/route-map.js +11 -0
- package/dist/repositories/index.d.ts +1 -0
- package/dist/repositories/index.js +2 -0
- package/dist/schemas/registry.d.ts +24 -24
- package/dist/security/index.d.ts +1 -1
- package/dist/security/index.js +1 -1
- package/dist/security/pii-schemas.d.ts +2 -0
- package/dist/security/pii-schemas.js +6 -0
- package/dist/seed/actions/demo-seed-actions.d.ts +1 -1
- package/dist/seed/events-seed-data.js +85 -2
- package/dist/seed/grouped-listings-seed-data.d.ts +5 -2
- package/dist/seed/index.d.ts +1 -0
- package/dist/seed/index.js +1 -0
- package/dist/seed/lottery-entries-seed-data.d.ts +2 -0
- package/dist/seed/lottery-entries-seed-data.js +108 -0
- package/dist/seed/manifest.js +1 -0
- package/dist/seed/products-preorders-seed-data.d.ts +5 -2
- package/dist/seed/products-standard-seed-data.js +8 -0
- package/dist/server-entry.d.ts +3 -0
- package/dist/server-entry.js +3 -0
- package/dist/server.d.ts +10 -4
- package/dist/server.js +6 -0
- package/dist/styles.css +1 -1
- package/dist/tailwind-utilities.css +1 -1
- package/dist/utils/id-generators.d.ts +8 -0
- package/dist/utils/id-generators.js +14 -0
- package/package.json +2 -1
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
import { describe, it, expect, vi, beforeEach } from "vitest";
|
|
2
|
+
import { makeMockDb, makeSnap } from "../../../../../tests/helpers/mock-firestore";
|
|
3
|
+
const { db, mockDocRef, mockCollection, mockQuery, mockTxn } = makeMockDb();
|
|
4
|
+
vi.mock("../../../../providers/db-firebase/admin", () => ({
|
|
5
|
+
getAdminDb: () => db,
|
|
6
|
+
}));
|
|
7
|
+
vi.mock("../../../../providers/db-firebase", async (importOriginal) => {
|
|
8
|
+
const actual = await importOriginal();
|
|
9
|
+
return {
|
|
10
|
+
...actual,
|
|
11
|
+
prepareForFirestore: (d) => d,
|
|
12
|
+
};
|
|
13
|
+
});
|
|
14
|
+
vi.mock("../../../../security", () => ({
|
|
15
|
+
encryptPiiFields: (d) => d,
|
|
16
|
+
decryptPiiFields: (d) => d,
|
|
17
|
+
addPiiIndices: (d) => d,
|
|
18
|
+
encryptPayoutBankAccount: (d) => d,
|
|
19
|
+
decryptPayoutBankAccount: (d) => d,
|
|
20
|
+
PAYOUT_PII_FIELDS: ["sellerName", "sellerEmail"],
|
|
21
|
+
PAYOUT_PII_INDEX_MAP: {},
|
|
22
|
+
}));
|
|
23
|
+
vi.mock("../../../../errors/normalize", () => ({
|
|
24
|
+
normalizeError: vi.fn(),
|
|
25
|
+
}));
|
|
26
|
+
import { PayoutRepository } from "../payout.repository";
|
|
27
|
+
const repo = new PayoutRepository();
|
|
28
|
+
function makePayoutDoc(overrides = {}) {
|
|
29
|
+
return {
|
|
30
|
+
id: "payout-misty-20260101-a1b2c3",
|
|
31
|
+
storeId: "store-pokemon-palace",
|
|
32
|
+
sellerName: "Misty Singh",
|
|
33
|
+
sellerEmail: "misty@pokemon.com",
|
|
34
|
+
amount: 50000, // paise
|
|
35
|
+
netAmount: 50000,
|
|
36
|
+
status: "pending",
|
|
37
|
+
orderIds: ["order-1-20260101-abc", "order-2-20260101-def"],
|
|
38
|
+
requestedAt: new Date(),
|
|
39
|
+
createdAt: new Date(),
|
|
40
|
+
updatedAt: new Date(),
|
|
41
|
+
refundDeductions: [],
|
|
42
|
+
...overrides,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
beforeEach(() => {
|
|
46
|
+
vi.clearAllMocks();
|
|
47
|
+
db.collection.mockReturnValue(mockCollection);
|
|
48
|
+
mockCollection.doc.mockReturnValue(mockDocRef);
|
|
49
|
+
mockCollection.where.mockReturnValue(mockQuery);
|
|
50
|
+
mockQuery.where.mockReturnValue(mockQuery);
|
|
51
|
+
mockQuery.orderBy.mockReturnValue(mockQuery);
|
|
52
|
+
mockQuery.limit.mockReturnValue(mockQuery);
|
|
53
|
+
mockQuery.get.mockResolvedValue({ docs: [], empty: true, size: 0 });
|
|
54
|
+
mockDocRef.get.mockResolvedValue(makeSnap(null));
|
|
55
|
+
mockDocRef.set.mockResolvedValue(undefined);
|
|
56
|
+
mockDocRef.update.mockResolvedValue(undefined);
|
|
57
|
+
db.runTransaction.mockImplementation(async (fn) => fn(mockTxn));
|
|
58
|
+
mockTxn.get.mockResolvedValue(makeSnap(null));
|
|
59
|
+
mockTxn.update.mockReturnValue(undefined);
|
|
60
|
+
});
|
|
61
|
+
// ---------------------------------------------------------------------------
|
|
62
|
+
// create
|
|
63
|
+
// ---------------------------------------------------------------------------
|
|
64
|
+
describe("PayoutRepository.create", () => {
|
|
65
|
+
it("creates payout with status: pending", async () => {
|
|
66
|
+
const result = await repo.create({
|
|
67
|
+
storeId: "store-1",
|
|
68
|
+
sellerName: "Arun",
|
|
69
|
+
sellerEmail: "arun@test.com",
|
|
70
|
+
amount: 10000,
|
|
71
|
+
orderIds: [],
|
|
72
|
+
paymentMethod: "upi",
|
|
73
|
+
});
|
|
74
|
+
expect(result.status).toBe("pending");
|
|
75
|
+
});
|
|
76
|
+
it("persists the payout to Firestore", async () => {
|
|
77
|
+
await repo.create({
|
|
78
|
+
storeId: "store-1",
|
|
79
|
+
sellerName: "Arun",
|
|
80
|
+
sellerEmail: "arun@test.com",
|
|
81
|
+
amount: 10000,
|
|
82
|
+
orderIds: [],
|
|
83
|
+
paymentMethod: "upi",
|
|
84
|
+
});
|
|
85
|
+
expect(mockDocRef.set).toHaveBeenCalledOnce();
|
|
86
|
+
});
|
|
87
|
+
it("sets requestedAt timestamp", async () => {
|
|
88
|
+
const result = await repo.create({
|
|
89
|
+
storeId: "store-1",
|
|
90
|
+
sellerName: "Arun",
|
|
91
|
+
sellerEmail: "arun@test.com",
|
|
92
|
+
amount: 10000,
|
|
93
|
+
orderIds: [],
|
|
94
|
+
paymentMethod: "upi",
|
|
95
|
+
});
|
|
96
|
+
expect(result.requestedAt).toBeInstanceOf(Date);
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
// ---------------------------------------------------------------------------
|
|
100
|
+
// markProcessing
|
|
101
|
+
// ---------------------------------------------------------------------------
|
|
102
|
+
describe("PayoutRepository.markProcessing", () => {
|
|
103
|
+
it("sets status: processing on the provided ref", async () => {
|
|
104
|
+
await repo.markProcessing(mockDocRef);
|
|
105
|
+
expect(mockDocRef.update).toHaveBeenCalledWith(expect.objectContaining({ status: "processing" }));
|
|
106
|
+
});
|
|
107
|
+
it("sets processedAt timestamp", async () => {
|
|
108
|
+
await repo.markProcessing(mockDocRef);
|
|
109
|
+
expect(mockDocRef.update).toHaveBeenCalledWith(expect.objectContaining({ processedAt: expect.any(Date) }));
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
// ---------------------------------------------------------------------------
|
|
113
|
+
// recordSuccess
|
|
114
|
+
// ---------------------------------------------------------------------------
|
|
115
|
+
describe("PayoutRepository.recordSuccess", () => {
|
|
116
|
+
it("stores razorpayPayoutId on the payout", async () => {
|
|
117
|
+
await repo.recordSuccess(mockDocRef, "razorpay-payout-123", "processed");
|
|
118
|
+
expect(mockDocRef.update).toHaveBeenCalledWith(expect.objectContaining({ razorpayPayoutId: "razorpay-payout-123" }));
|
|
119
|
+
});
|
|
120
|
+
it("stores razorpayStatus on the payout", async () => {
|
|
121
|
+
await repo.recordSuccess(mockDocRef, "payout-abc", "processed");
|
|
122
|
+
expect(mockDocRef.update).toHaveBeenCalledWith(expect.objectContaining({ razorpayStatus: "processed" }));
|
|
123
|
+
});
|
|
124
|
+
it("sets updatedAt timestamp", async () => {
|
|
125
|
+
await repo.recordSuccess(mockDocRef, "payout-abc", "processed");
|
|
126
|
+
expect(mockDocRef.update).toHaveBeenCalledWith(expect.objectContaining({ updatedAt: expect.any(Date) }));
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
// ---------------------------------------------------------------------------
|
|
130
|
+
// recordFailure
|
|
131
|
+
// ---------------------------------------------------------------------------
|
|
132
|
+
describe("PayoutRepository.recordFailure", () => {
|
|
133
|
+
it("isFinal=true → sets status: failed", async () => {
|
|
134
|
+
await repo.recordFailure(mockDocRef, 3, "Insufficient funds", true);
|
|
135
|
+
expect(mockDocRef.update).toHaveBeenCalledWith(expect.objectContaining({ status: "failed" }));
|
|
136
|
+
});
|
|
137
|
+
it("isFinal=false → keeps status: pending (retry)", async () => {
|
|
138
|
+
await repo.recordFailure(mockDocRef, 1, "Timeout", false);
|
|
139
|
+
expect(mockDocRef.update).toHaveBeenCalledWith(expect.objectContaining({ status: "pending" }));
|
|
140
|
+
});
|
|
141
|
+
it("stores failureCount", async () => {
|
|
142
|
+
await repo.recordFailure(mockDocRef, 2, "Network error", false);
|
|
143
|
+
expect(mockDocRef.update).toHaveBeenCalledWith(expect.objectContaining({ failureCount: 2 }));
|
|
144
|
+
});
|
|
145
|
+
it("stores lastFailureReason", async () => {
|
|
146
|
+
await repo.recordFailure(mockDocRef, 1, "Account blocked", false);
|
|
147
|
+
expect(mockDocRef.update).toHaveBeenCalledWith(expect.objectContaining({ lastFailureReason: "Account blocked" }));
|
|
148
|
+
});
|
|
149
|
+
});
|
|
150
|
+
// ---------------------------------------------------------------------------
|
|
151
|
+
// applyRefundDeduction
|
|
152
|
+
// ---------------------------------------------------------------------------
|
|
153
|
+
describe("PayoutRepository.applyRefundDeduction", () => {
|
|
154
|
+
it("throws when payout not found in transaction", async () => {
|
|
155
|
+
mockTxn.get.mockResolvedValue(makeSnap(null));
|
|
156
|
+
await expect(repo.applyRefundDeduction("payout-ghost", {
|
|
157
|
+
orderId: "order-1",
|
|
158
|
+
deductedAmount: 100,
|
|
159
|
+
})).rejects.toThrow(/not found/i);
|
|
160
|
+
});
|
|
161
|
+
it("throws when payout status is not pending", async () => {
|
|
162
|
+
const payout = makePayoutDoc({ status: "completed" });
|
|
163
|
+
mockTxn.get.mockResolvedValue({ exists: true, id: payout.id, data: () => payout });
|
|
164
|
+
await expect(repo.applyRefundDeduction("payout-1", {
|
|
165
|
+
orderId: "order-1",
|
|
166
|
+
deductedAmount: 100,
|
|
167
|
+
})).rejects.toThrow(/status/i);
|
|
168
|
+
});
|
|
169
|
+
it("computes netAmount = amount - totalDeducted", async () => {
|
|
170
|
+
const payout = makePayoutDoc({ amount: 50000, refundDeductions: [] });
|
|
171
|
+
mockTxn.get.mockResolvedValue({ exists: true, id: payout.id, data: () => payout });
|
|
172
|
+
const result = await repo.applyRefundDeduction("payout-1", {
|
|
173
|
+
orderId: "order-1",
|
|
174
|
+
deductedAmount: 10000,
|
|
175
|
+
});
|
|
176
|
+
expect(result.netAmount).toBe(40000);
|
|
177
|
+
});
|
|
178
|
+
it("netAmount is floored at 0 when deduction exceeds amount", async () => {
|
|
179
|
+
const payout = makePayoutDoc({ amount: 5000, refundDeductions: [] });
|
|
180
|
+
mockTxn.get.mockResolvedValue({ exists: true, id: payout.id, data: () => payout });
|
|
181
|
+
const result = await repo.applyRefundDeduction("payout-1", {
|
|
182
|
+
orderId: "order-1",
|
|
183
|
+
deductedAmount: 10000, // more than amount
|
|
184
|
+
});
|
|
185
|
+
expect(result.netAmount).toBe(0);
|
|
186
|
+
});
|
|
187
|
+
it("accumulates multiple deductions correctly", async () => {
|
|
188
|
+
const existing = [{ orderId: "order-old", deductedAmount: 5000, appliedAt: new Date() }];
|
|
189
|
+
const payout = makePayoutDoc({ amount: 50000, refundDeductions: existing });
|
|
190
|
+
mockTxn.get.mockResolvedValue({ exists: true, id: payout.id, data: () => payout });
|
|
191
|
+
const result = await repo.applyRefundDeduction("payout-1", {
|
|
192
|
+
orderId: "order-new",
|
|
193
|
+
deductedAmount: 10000,
|
|
194
|
+
});
|
|
195
|
+
// total deducted = 5000 + 10000 = 15000, net = 50000 - 15000 = 35000
|
|
196
|
+
expect(result.netAmount).toBe(35000);
|
|
197
|
+
});
|
|
198
|
+
it("sets appliedAt on the deduction entry", async () => {
|
|
199
|
+
const payout = makePayoutDoc({ amount: 50000, refundDeductions: [] });
|
|
200
|
+
mockTxn.get.mockResolvedValue({ exists: true, id: payout.id, data: () => payout });
|
|
201
|
+
const result = await repo.applyRefundDeduction("payout-1", {
|
|
202
|
+
orderId: "order-1",
|
|
203
|
+
deductedAmount: 100,
|
|
204
|
+
});
|
|
205
|
+
const lastDeduction = result.refundDeductions[result.refundDeductions.length - 1];
|
|
206
|
+
expect(lastDeduction.appliedAt).toBeInstanceOf(Date);
|
|
207
|
+
});
|
|
208
|
+
it("uses a Firestore transaction for atomic read-modify-write", async () => {
|
|
209
|
+
const payout = makePayoutDoc({ amount: 50000, refundDeductions: [] });
|
|
210
|
+
mockTxn.get.mockResolvedValue({ exists: true, id: payout.id, data: () => payout });
|
|
211
|
+
await repo.applyRefundDeduction("payout-1", {
|
|
212
|
+
orderId: "order-1",
|
|
213
|
+
deductedAmount: 100,
|
|
214
|
+
});
|
|
215
|
+
expect(db.runTransaction).toHaveBeenCalledOnce();
|
|
216
|
+
expect(mockTxn.get).toHaveBeenCalledOnce();
|
|
217
|
+
expect(mockTxn.update).toHaveBeenCalledOnce();
|
|
218
|
+
});
|
|
219
|
+
});
|
|
220
|
+
// ---------------------------------------------------------------------------
|
|
221
|
+
// findPendingByStore
|
|
222
|
+
// ---------------------------------------------------------------------------
|
|
223
|
+
describe("PayoutRepository.findPendingByStore", () => {
|
|
224
|
+
it("returns null when no pending payout found", async () => {
|
|
225
|
+
mockQuery.get.mockResolvedValue({ docs: [], empty: true, size: 0 });
|
|
226
|
+
const result = await repo.findPendingByStore("store-1");
|
|
227
|
+
expect(result).toBeNull();
|
|
228
|
+
});
|
|
229
|
+
it("queries storeId AND status=pending", async () => {
|
|
230
|
+
mockQuery.get.mockResolvedValue({ docs: [], empty: true, size: 0 });
|
|
231
|
+
await repo.findPendingByStore("store-abc");
|
|
232
|
+
expect(mockCollection.where).toHaveBeenCalledWith("storeId", "==", "store-abc");
|
|
233
|
+
expect(mockQuery.where).toHaveBeenCalledWith("status", "==", "pending");
|
|
234
|
+
});
|
|
235
|
+
it("applies limit of 1 (most recent only)", async () => {
|
|
236
|
+
mockQuery.get.mockResolvedValue({ docs: [], empty: true, size: 0 });
|
|
237
|
+
await repo.findPendingByStore("store-abc");
|
|
238
|
+
expect(mockQuery.limit).toHaveBeenCalledWith(1);
|
|
239
|
+
});
|
|
240
|
+
it("returns the payout when found", async () => {
|
|
241
|
+
const payout = makePayoutDoc({ status: "pending" });
|
|
242
|
+
mockQuery.get.mockResolvedValue({
|
|
243
|
+
docs: [{ id: payout.id, data: () => payout }],
|
|
244
|
+
empty: false,
|
|
245
|
+
size: 1,
|
|
246
|
+
});
|
|
247
|
+
const result = await repo.findPendingByStore("store-pokemon-palace");
|
|
248
|
+
expect(result).not.toBeNull();
|
|
249
|
+
});
|
|
250
|
+
});
|
|
251
|
+
// ---------------------------------------------------------------------------
|
|
252
|
+
// getPaidOutOrderIds
|
|
253
|
+
// ---------------------------------------------------------------------------
|
|
254
|
+
describe("PayoutRepository.getPaidOutOrderIds", () => {
|
|
255
|
+
it("returns empty Set when no matching payouts", async () => {
|
|
256
|
+
mockQuery.get.mockResolvedValue({ docs: [], empty: true, size: 0 });
|
|
257
|
+
const ids = await repo.getPaidOutOrderIds("store-1");
|
|
258
|
+
expect(ids.size).toBe(0);
|
|
259
|
+
});
|
|
260
|
+
it("collects all orderIds from matching payout documents", async () => {
|
|
261
|
+
const payout1 = makePayoutDoc({ orderIds: ["order-A", "order-B"] });
|
|
262
|
+
const payout2 = makePayoutDoc({ id: "payout-2", orderIds: ["order-C"] });
|
|
263
|
+
mockQuery.get.mockResolvedValue({
|
|
264
|
+
docs: [
|
|
265
|
+
{ id: payout1.id, data: () => payout1 },
|
|
266
|
+
{ id: payout2.id, data: () => payout2 },
|
|
267
|
+
],
|
|
268
|
+
empty: false,
|
|
269
|
+
size: 2,
|
|
270
|
+
});
|
|
271
|
+
const ids = await repo.getPaidOutOrderIds("store-pokemon-palace");
|
|
272
|
+
expect(ids.has("order-A")).toBe(true);
|
|
273
|
+
expect(ids.has("order-B")).toBe(true);
|
|
274
|
+
expect(ids.has("order-C")).toBe(true);
|
|
275
|
+
});
|
|
276
|
+
it("queries storeId AND status in [pending, processing, completed]", async () => {
|
|
277
|
+
mockQuery.get.mockResolvedValue({ docs: [], empty: true, size: 0 });
|
|
278
|
+
await repo.getPaidOutOrderIds("store-1");
|
|
279
|
+
expect(mockCollection.where).toHaveBeenCalledWith("storeId", "==", "store-1");
|
|
280
|
+
expect(mockQuery.where).toHaveBeenCalledWith("status", "in", expect.arrayContaining(["pending", "processing", "completed"]));
|
|
281
|
+
});
|
|
282
|
+
it("handles payout with no orderIds field gracefully", async () => {
|
|
283
|
+
const payout = { ...makePayoutDoc(), orderIds: undefined };
|
|
284
|
+
mockQuery.get.mockResolvedValue({
|
|
285
|
+
docs: [{ id: payout.id, data: () => payout }],
|
|
286
|
+
empty: false,
|
|
287
|
+
size: 1,
|
|
288
|
+
});
|
|
289
|
+
const ids = await repo.getPaidOutOrderIds("store-1");
|
|
290
|
+
expect(ids.size).toBe(0);
|
|
291
|
+
});
|
|
292
|
+
});
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Payouts Firestore Document Types & Constants
|
|
3
3
|
*/
|
|
4
4
|
import { type GeneratePayoutIdInput } from "../../../utils/id-generators";
|
|
5
|
+
import type { BaseDocument } from "../../../_internal/shared/types/base-document";
|
|
5
6
|
export interface PayoutBankAccount {
|
|
6
7
|
accountHolderName: string;
|
|
7
8
|
accountNumberMasked: string;
|
|
@@ -32,8 +33,7 @@ export declare const PayoutStatusValues: {
|
|
|
32
33
|
readonly FAILED: "failed";
|
|
33
34
|
};
|
|
34
35
|
export type PayoutPaymentMethod = "bank_transfer" | "upi";
|
|
35
|
-
export interface PayoutDocument {
|
|
36
|
-
id: string;
|
|
36
|
+
export interface PayoutDocument extends BaseDocument {
|
|
37
37
|
storeId: string;
|
|
38
38
|
sellerName: string;
|
|
39
39
|
sellerEmail: string;
|
|
@@ -66,8 +66,6 @@ export interface PayoutDocument {
|
|
|
66
66
|
netAmount?: number;
|
|
67
67
|
requestedAt: Date;
|
|
68
68
|
processedAt?: Date;
|
|
69
|
-
createdAt: Date;
|
|
70
|
-
updatedAt: Date;
|
|
71
69
|
}
|
|
72
70
|
export declare const PAYOUT_COLLECTION: "payouts";
|
|
73
71
|
export declare const PAYOUT_INDEXED_FIELDS: readonly ["storeId", "status", "requestedAt", "createdAt"];
|
|
@@ -45,8 +45,8 @@ export declare const preorderItemSchema: z.ZodObject<{
|
|
|
45
45
|
active: z.ZodDefault<z.ZodBoolean>;
|
|
46
46
|
createdAt: z.ZodOptional<z.ZodString>;
|
|
47
47
|
}, "strip", z.ZodTypeAny, {
|
|
48
|
-
id: string;
|
|
49
48
|
slug: string;
|
|
49
|
+
id: string;
|
|
50
50
|
name: string;
|
|
51
51
|
active: boolean;
|
|
52
52
|
isFeatured: boolean;
|
|
@@ -66,8 +66,8 @@ export declare const preorderItemSchema: z.ZodObject<{
|
|
|
66
66
|
franchise?: string | undefined;
|
|
67
67
|
preorderShipDate?: string | undefined;
|
|
68
68
|
}, {
|
|
69
|
-
id: string;
|
|
70
69
|
slug: string;
|
|
70
|
+
id: string;
|
|
71
71
|
name: string;
|
|
72
72
|
salePrice: number;
|
|
73
73
|
regularPrice: number;
|
|
@@ -16,14 +16,14 @@ type RouteContext = {
|
|
|
16
16
|
}>;
|
|
17
17
|
};
|
|
18
18
|
export declare function GET(_request: Request, context: RouteContext): Promise<NextResponse>;
|
|
19
|
-
export declare const PATCH: (request: Request, context
|
|
19
|
+
export declare const PATCH: (request: Request, context?: {
|
|
20
20
|
params: Promise<{
|
|
21
21
|
id: string;
|
|
22
22
|
}>;
|
|
23
|
-
}) => Promise<Response>;
|
|
24
|
-
export declare const DELETE: (request: Request, context
|
|
23
|
+
} | undefined) => Promise<Response>;
|
|
24
|
+
export declare const DELETE: (request: Request, context?: {
|
|
25
25
|
params: Promise<{
|
|
26
26
|
id: string;
|
|
27
27
|
}>;
|
|
28
|
-
}) => Promise<Response>;
|
|
28
|
+
} | undefined) => Promise<Response>;
|
|
29
29
|
export { GET as productItemGET, PATCH as productItemPATCH, DELETE as productItemDELETE, };
|
|
@@ -14,6 +14,6 @@
|
|
|
14
14
|
*/
|
|
15
15
|
import { NextResponse } from "next/server.js";
|
|
16
16
|
export declare function GET(request: Request): Promise<NextResponse>;
|
|
17
|
-
export declare const POST: (request: Request, context
|
|
17
|
+
export declare const POST: (request: Request, context?: {
|
|
18
18
|
params: Promise<Record<string, string>>;
|
|
19
|
-
}) => Promise<Response>;
|
|
19
|
+
} | undefined) => Promise<Response>;
|
|
@@ -96,16 +96,32 @@ export declare const DETAIL_ACTIONS: {
|
|
|
96
96
|
readonly auction: readonly ["place-bid", "buy-now-auction", "watch-auction", "share"];
|
|
97
97
|
/** Pre-order: reserve, wishlist, share */
|
|
98
98
|
readonly preorder: readonly ["reserve-now", "add-to-wishlist", "share"];
|
|
99
|
+
/** Prize draw: enter, wishlist, share */
|
|
100
|
+
readonly "prize-draw": readonly ["enter-prize-draw", "add-to-wishlist", "share"];
|
|
101
|
+
/** Classified: offer, share */
|
|
102
|
+
readonly classified: readonly ["make-offer", "share"];
|
|
103
|
+
/** Digital code: buy now, share */
|
|
104
|
+
readonly "digital-code": readonly ["buy-now", "share"];
|
|
105
|
+
/** Live item: buy now, wishlist, share */
|
|
106
|
+
readonly live: readonly ["buy-now", "add-to-wishlist", "share"];
|
|
99
107
|
};
|
|
100
108
|
export declare const MOBILE_PRIMARY_ACTIONS: {
|
|
101
109
|
readonly product: readonly ["buy-now", "add-to-cart"];
|
|
102
110
|
readonly auction: readonly ["place-bid", "buy-now-auction"];
|
|
103
111
|
readonly preorder: readonly ["reserve-now"];
|
|
112
|
+
readonly "prize-draw": readonly ["enter-prize-draw"];
|
|
113
|
+
readonly classified: readonly ["make-offer"];
|
|
114
|
+
readonly "digital-code": readonly ["buy-now"];
|
|
115
|
+
readonly live: readonly ["buy-now"];
|
|
104
116
|
};
|
|
105
117
|
export declare const LISTING_BULK_ACTIONS: {
|
|
106
118
|
readonly products: readonly ["add-to-cart", "add-to-wishlist", "compare"];
|
|
107
119
|
readonly auctions: readonly ["watch-auction", "unwatch-auction", "compare"];
|
|
108
120
|
readonly preorders: readonly ["add-to-cart", "add-to-wishlist", "compare"];
|
|
121
|
+
readonly prizeDraws: readonly ActionId[];
|
|
122
|
+
readonly classifieds: readonly ActionId[];
|
|
123
|
+
readonly digitalCodes: readonly ActionId[];
|
|
124
|
+
readonly live: readonly ActionId[];
|
|
109
125
|
readonly stores: ActionId[];
|
|
110
126
|
};
|
|
111
127
|
/** Maximum number of items the Compare overlay (BK3) supports at once. */
|
|
@@ -137,18 +137,34 @@ export const DETAIL_ACTIONS = {
|
|
|
137
137
|
auction: [ACTION_ID.PLACE_BID, ACTION_ID.BUY_NOW_AUCTION, ACTION_ID.WATCH_AUCTION, ACTION_ID.SHARE],
|
|
138
138
|
/** Pre-order: reserve, wishlist, share */
|
|
139
139
|
preorder: [ACTION_ID.RESERVE_NOW, ACTION_ID.ADD_TO_WISHLIST, ACTION_ID.SHARE],
|
|
140
|
+
/** Prize draw: enter, wishlist, share */
|
|
141
|
+
"prize-draw": [ACTION_ID.ENTER_PRIZE_DRAW, ACTION_ID.ADD_TO_WISHLIST, ACTION_ID.SHARE],
|
|
142
|
+
/** Classified: offer, share */
|
|
143
|
+
classified: [ACTION_ID.MAKE_OFFER, ACTION_ID.SHARE],
|
|
144
|
+
/** Digital code: buy now, share */
|
|
145
|
+
"digital-code": [ACTION_ID.BUY_NOW, ACTION_ID.SHARE],
|
|
146
|
+
/** Live item: buy now, wishlist, share */
|
|
147
|
+
live: [ACTION_ID.BUY_NOW, ACTION_ID.ADD_TO_WISHLIST, ACTION_ID.SHARE],
|
|
140
148
|
};
|
|
141
149
|
// Mobile bottom bar — 1–2 primary CTAs only (limited horizontal space)
|
|
142
150
|
export const MOBILE_PRIMARY_ACTIONS = {
|
|
143
151
|
product: [ACTION_ID.BUY_NOW, ACTION_ID.ADD_TO_CART],
|
|
144
152
|
auction: [ACTION_ID.PLACE_BID, ACTION_ID.BUY_NOW_AUCTION],
|
|
145
153
|
preorder: [ACTION_ID.RESERVE_NOW],
|
|
154
|
+
"prize-draw": [ACTION_ID.ENTER_PRIZE_DRAW],
|
|
155
|
+
classified: [ACTION_ID.MAKE_OFFER],
|
|
156
|
+
"digital-code": [ACTION_ID.BUY_NOW],
|
|
157
|
+
live: [ACTION_ID.BUY_NOW],
|
|
146
158
|
};
|
|
147
159
|
// Listing page bulk actions — shown in the bottom action bar when items are selected
|
|
148
160
|
export const LISTING_BULK_ACTIONS = {
|
|
149
161
|
products: [ACTION_ID.ADD_TO_CART, ACTION_ID.ADD_TO_WISHLIST, ACTION_ID.COMPARE],
|
|
150
162
|
auctions: [ACTION_ID.WATCH_AUCTION, ACTION_ID.UNWATCH_AUCTION, ACTION_ID.COMPARE],
|
|
151
163
|
preorders: [ACTION_ID.ADD_TO_CART, ACTION_ID.ADD_TO_WISHLIST, ACTION_ID.COMPARE],
|
|
164
|
+
prizeDraws: [ACTION_ID.ADD_TO_WISHLIST, ACTION_ID.COMPARE],
|
|
165
|
+
classifieds: [ACTION_ID.ADD_TO_WISHLIST, ACTION_ID.COMPARE],
|
|
166
|
+
digitalCodes: [ACTION_ID.ADD_TO_WISHLIST, ACTION_ID.COMPARE],
|
|
167
|
+
live: [ACTION_ID.ADD_TO_WISHLIST, ACTION_ID.COMPARE],
|
|
152
168
|
stores: [ACTION_ID.COMPARE],
|
|
153
169
|
};
|
|
154
170
|
/** Maximum number of items the Compare overlay (BK3) supports at once. */
|
|
@@ -40,6 +40,18 @@ export declare const CATEGORY_PAGE_TABS: readonly [{
|
|
|
40
40
|
readonly id: "bundles";
|
|
41
41
|
readonly label: "Bundles";
|
|
42
42
|
readonly collection: "bundles";
|
|
43
|
+
}, {
|
|
44
|
+
readonly id: "classifieds";
|
|
45
|
+
readonly label: "Classifieds";
|
|
46
|
+
readonly listingType: "classified";
|
|
47
|
+
}, {
|
|
48
|
+
readonly id: "digital-codes";
|
|
49
|
+
readonly label: "Digital Codes";
|
|
50
|
+
readonly listingType: "digital-code";
|
|
51
|
+
}, {
|
|
52
|
+
readonly id: "live";
|
|
53
|
+
readonly label: "Live Items";
|
|
54
|
+
readonly listingType: "live";
|
|
43
55
|
}, {
|
|
44
56
|
readonly id: "stores";
|
|
45
57
|
readonly label: "Stores";
|
|
@@ -67,6 +79,18 @@ export declare const STORE_PAGE_TABS: readonly [{
|
|
|
67
79
|
readonly id: "bundles";
|
|
68
80
|
readonly label: "Bundles";
|
|
69
81
|
readonly collection: "bundles";
|
|
82
|
+
}, {
|
|
83
|
+
readonly id: "classifieds";
|
|
84
|
+
readonly label: "Classifieds";
|
|
85
|
+
readonly listingType: "classified";
|
|
86
|
+
}, {
|
|
87
|
+
readonly id: "digital-codes";
|
|
88
|
+
readonly label: "Digital Codes";
|
|
89
|
+
readonly listingType: "digital-code";
|
|
90
|
+
}, {
|
|
91
|
+
readonly id: "live";
|
|
92
|
+
readonly label: "Live Items";
|
|
93
|
+
readonly listingType: "live";
|
|
70
94
|
}];
|
|
71
95
|
export type StoreTabId = (typeof STORE_PAGE_TABS)[number]["id"];
|
|
72
96
|
/** Tabs shown on the seller-dashboard listings view + admin products list. */
|
|
@@ -89,6 +113,18 @@ export declare const SELLER_LISTING_TABS: readonly [{
|
|
|
89
113
|
readonly id: "prize-draws";
|
|
90
114
|
readonly label: "Prize Draws";
|
|
91
115
|
readonly listingType: "prize-draw";
|
|
116
|
+
}, {
|
|
117
|
+
readonly id: "classifieds";
|
|
118
|
+
readonly label: "Classifieds";
|
|
119
|
+
readonly listingType: "classified";
|
|
120
|
+
}, {
|
|
121
|
+
readonly id: "digital-codes";
|
|
122
|
+
readonly label: "Digital Codes";
|
|
123
|
+
readonly listingType: "digital-code";
|
|
124
|
+
}, {
|
|
125
|
+
readonly id: "live";
|
|
126
|
+
readonly label: "Live Items";
|
|
127
|
+
readonly listingType: "live";
|
|
92
128
|
}];
|
|
93
129
|
export type SellerListingTabId = (typeof SELLER_LISTING_TABS)[number]["id"];
|
|
94
130
|
/** Tabs shown on `/search` results. */
|
|
@@ -115,5 +151,17 @@ export declare const SEARCH_RESULT_TABS: readonly [{
|
|
|
115
151
|
readonly id: "bundles";
|
|
116
152
|
readonly label: "Bundles";
|
|
117
153
|
readonly collection: "bundles";
|
|
154
|
+
}, {
|
|
155
|
+
readonly id: "classifieds";
|
|
156
|
+
readonly label: "Classifieds";
|
|
157
|
+
readonly listingType: "classified";
|
|
158
|
+
}, {
|
|
159
|
+
readonly id: "digital-codes";
|
|
160
|
+
readonly label: "Digital Codes";
|
|
161
|
+
readonly listingType: "digital-code";
|
|
162
|
+
}, {
|
|
163
|
+
readonly id: "live";
|
|
164
|
+
readonly label: "Live Items";
|
|
165
|
+
readonly listingType: "live";
|
|
118
166
|
}];
|
|
119
167
|
export type SearchTabId = (typeof SEARCH_RESULT_TABS)[number]["id"];
|
|
@@ -15,6 +15,9 @@ export const CATEGORY_PAGE_TABS = [
|
|
|
15
15
|
{ id: "pre-orders", label: "Pre-Orders", listingType: "pre-order" },
|
|
16
16
|
{ id: "prize-draws", label: "Prize Draws", listingType: "prize-draw" },
|
|
17
17
|
{ id: "bundles", label: "Bundles", collection: "bundles" },
|
|
18
|
+
{ id: "classifieds", label: "Classifieds", listingType: "classified" },
|
|
19
|
+
{ id: "digital-codes", label: "Digital Codes", listingType: "digital-code" },
|
|
20
|
+
{ id: "live", label: "Live Items", listingType: "live" },
|
|
18
21
|
{ id: "stores", label: "Stores", entity: "stores" },
|
|
19
22
|
];
|
|
20
23
|
/** Tabs shown on the public `/stores/[slug]` nav bar. */
|
|
@@ -24,6 +27,9 @@ export const STORE_PAGE_TABS = [
|
|
|
24
27
|
{ id: "pre-orders", label: "Pre-Orders", listingType: "pre-order" },
|
|
25
28
|
{ id: "prize-draws", label: "Prize Draws", listingType: "prize-draw" },
|
|
26
29
|
{ id: "bundles", label: "Bundles", collection: "bundles" },
|
|
30
|
+
{ id: "classifieds", label: "Classifieds", listingType: "classified" },
|
|
31
|
+
{ id: "digital-codes", label: "Digital Codes", listingType: "digital-code" },
|
|
32
|
+
{ id: "live", label: "Live Items", listingType: "live" },
|
|
27
33
|
];
|
|
28
34
|
/** Tabs shown on the seller-dashboard listings view + admin products list. */
|
|
29
35
|
export const SELLER_LISTING_TABS = [
|
|
@@ -32,6 +38,9 @@ export const SELLER_LISTING_TABS = [
|
|
|
32
38
|
{ id: "auctions", label: "Auctions", listingType: "auction" },
|
|
33
39
|
{ id: "pre-orders", label: "Pre-Orders", listingType: "pre-order" },
|
|
34
40
|
{ id: "prize-draws", label: "Prize Draws", listingType: "prize-draw" },
|
|
41
|
+
{ id: "classifieds", label: "Classifieds", listingType: "classified" },
|
|
42
|
+
{ id: "digital-codes", label: "Digital Codes", listingType: "digital-code" },
|
|
43
|
+
{ id: "live", label: "Live Items", listingType: "live" },
|
|
35
44
|
];
|
|
36
45
|
/** Tabs shown on `/search` results. */
|
|
37
46
|
export const SEARCH_RESULT_TABS = [
|
|
@@ -41,4 +50,7 @@ export const SEARCH_RESULT_TABS = [
|
|
|
41
50
|
{ id: "pre-orders", label: "Pre-Orders", listingType: "pre-order" },
|
|
42
51
|
{ id: "prize-draws", label: "Prize Draws", listingType: "prize-draw" },
|
|
43
52
|
{ id: "bundles", label: "Bundles", collection: "bundles" },
|
|
53
|
+
{ id: "classifieds", label: "Classifieds", listingType: "classified" },
|
|
54
|
+
{ id: "digital-codes", label: "Digital Codes", listingType: "digital-code" },
|
|
55
|
+
{ id: "live", label: "Live Items", listingType: "live" },
|
|
44
56
|
];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|