@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
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { FirestoreDocument } from "@mohasinac/appkit";
|
|
2
|
+
import type { BaseDocument } from "../../../_internal/shared/types/base-document";
|
|
2
3
|
/**
|
|
3
4
|
* S-STORE Extensions — Firestore Document Types
|
|
4
5
|
*
|
|
@@ -20,8 +21,7 @@ import type { FirestoreDocument } from "@mohasinac/appkit";
|
|
|
20
21
|
* 11. storeGoogleConfig — per-store Google Business reviews integration
|
|
21
22
|
*/
|
|
22
23
|
export type PayoutMethodType = "upi" | "bank" | "card" | "other";
|
|
23
|
-
export interface PayoutMethodDocument {
|
|
24
|
-
id: string;
|
|
24
|
+
export interface PayoutMethodDocument extends BaseDocument {
|
|
25
25
|
sellerId: string;
|
|
26
26
|
storeId: string;
|
|
27
27
|
type: PayoutMethodType;
|
|
@@ -34,15 +34,12 @@ export interface PayoutMethodDocument {
|
|
|
34
34
|
accountHolderName?: string;
|
|
35
35
|
bankName?: string;
|
|
36
36
|
details?: Record<string, string>;
|
|
37
|
-
createdAt: Date;
|
|
38
|
-
updatedAt: Date;
|
|
39
37
|
}
|
|
40
38
|
export declare const PAYOUT_METHODS_COLLECTION: "payoutMethods";
|
|
41
39
|
export declare const PAYOUT_METHOD_INDEXED_FIELDS: readonly ["sellerId", "storeId", "type", "isDefault", "isActive", "createdAt"];
|
|
42
40
|
export declare const DEFAULT_PAYOUT_METHOD_DATA: Partial<PayoutMethodDocument>;
|
|
43
41
|
export type ShippingMethod = "free" | "flat" | "weight" | "express" | "pickup" | "custom";
|
|
44
|
-
export interface ShippingConfigDocument {
|
|
45
|
-
id: string;
|
|
42
|
+
export interface ShippingConfigDocument extends BaseDocument {
|
|
46
43
|
storeId: string;
|
|
47
44
|
label: string;
|
|
48
45
|
method: ShippingMethod;
|
|
@@ -54,16 +51,13 @@ export interface ShippingConfigDocument {
|
|
|
54
51
|
expressSurchargeInPaise?: number;
|
|
55
52
|
estimatedDays?: number;
|
|
56
53
|
zones?: string[];
|
|
57
|
-
createdAt: Date;
|
|
58
|
-
updatedAt: Date;
|
|
59
54
|
}
|
|
60
55
|
export declare const SHIPPING_CONFIGS_COLLECTION: "shippingConfigs";
|
|
61
56
|
export declare const SHIPPING_CONFIG_INDEXED_FIELDS: readonly ["storeId", "method", "isDefault", "isActive", "createdAt"];
|
|
62
57
|
export declare const DEFAULT_SHIPPING_CONFIG_DATA: Partial<ShippingConfigDocument>;
|
|
63
58
|
export type AnalyticsScope = "seller" | "admin";
|
|
64
59
|
export type AnalyticsCardType = "metric" | "line" | "bar" | "pie" | "table" | "custom";
|
|
65
|
-
export interface AnalyticsCardDocument {
|
|
66
|
-
id: string;
|
|
60
|
+
export interface AnalyticsCardDocument extends BaseDocument {
|
|
67
61
|
scope: AnalyticsScope;
|
|
68
62
|
ownerId: string;
|
|
69
63
|
title: string;
|
|
@@ -73,15 +67,12 @@ export interface AnalyticsCardDocument {
|
|
|
73
67
|
position: number;
|
|
74
68
|
isBuiltIn: boolean;
|
|
75
69
|
isVisible: boolean;
|
|
76
|
-
createdAt: Date;
|
|
77
|
-
updatedAt: Date;
|
|
78
70
|
}
|
|
79
71
|
export declare const ANALYTICS_CARDS_COLLECTION: "analyticsCards";
|
|
80
72
|
export declare const ANALYTICS_CARD_INDEXED_FIELDS: readonly ["scope", "ownerId", "isVisible", "position", "createdAt"];
|
|
81
73
|
export declare const DEFAULT_ANALYTICS_CARD_DATA: Partial<AnalyticsCardDocument>;
|
|
82
74
|
export type AlertOperator = ">" | "<" | ">=" | "<=" | "==" | "!=";
|
|
83
|
-
export interface AnalyticsAlertDocument {
|
|
84
|
-
id: string;
|
|
75
|
+
export interface AnalyticsAlertDocument extends BaseDocument {
|
|
85
76
|
scope: AnalyticsScope;
|
|
86
77
|
ownerId: string;
|
|
87
78
|
label: string;
|
|
@@ -92,14 +83,11 @@ export interface AnalyticsAlertDocument {
|
|
|
92
83
|
isActive: boolean;
|
|
93
84
|
notifyChannels: Array<"in-app" | "email" | "whatsapp">;
|
|
94
85
|
lastTriggeredAt?: Date;
|
|
95
|
-
createdAt: Date;
|
|
96
|
-
updatedAt: Date;
|
|
97
86
|
}
|
|
98
87
|
export declare const ANALYTICS_ALERTS_COLLECTION: "analyticsAlerts";
|
|
99
88
|
export declare const ANALYTICS_ALERT_INDEXED_FIELDS: readonly ["scope", "ownerId", "isActive", "metric", "createdAt"];
|
|
100
89
|
export declare const DEFAULT_ANALYTICS_ALERT_DATA: Partial<AnalyticsAlertDocument>;
|
|
101
|
-
export interface StoreCategoryDocument {
|
|
102
|
-
id: string;
|
|
90
|
+
export interface StoreCategoryDocument extends BaseDocument {
|
|
103
91
|
storeId: string;
|
|
104
92
|
label: string;
|
|
105
93
|
slug: string;
|
|
@@ -108,15 +96,12 @@ export interface StoreCategoryDocument {
|
|
|
108
96
|
isActive: boolean;
|
|
109
97
|
description?: string;
|
|
110
98
|
coverImageUrl?: string;
|
|
111
|
-
createdAt: Date;
|
|
112
|
-
updatedAt: Date;
|
|
113
99
|
}
|
|
114
100
|
export declare const STORE_CATEGORIES_COLLECTION: "storeCategories";
|
|
115
101
|
export declare const STORE_CATEGORY_INDEXED_FIELDS: readonly ["storeId", "slug", "isActive", "displayOrder", "createdAt"];
|
|
116
102
|
export declare const DEFAULT_STORE_CATEGORY_DATA: Partial<StoreCategoryDocument>;
|
|
117
103
|
export type ListingTemplateType = "standard" | "auction" | "pre-order" | "prize-draw" | "bundle" | "classified" | "digital-code" | "live";
|
|
118
|
-
export interface ListingTemplateDocument {
|
|
119
|
-
id: string;
|
|
104
|
+
export interface ListingTemplateDocument extends BaseDocument {
|
|
120
105
|
storeId: string;
|
|
121
106
|
ownerId: string;
|
|
122
107
|
name: string;
|
|
@@ -127,16 +112,13 @@ export interface ListingTemplateDocument {
|
|
|
127
112
|
isShared: boolean;
|
|
128
113
|
isActive: boolean;
|
|
129
114
|
usageCount: number;
|
|
130
|
-
createdAt: Date;
|
|
131
|
-
updatedAt: Date;
|
|
132
115
|
}
|
|
133
116
|
export declare const LISTING_TEMPLATES_COLLECTION: "listingTemplates";
|
|
134
117
|
export declare const LISTING_TEMPLATE_INDEXED_FIELDS: readonly ["storeId", "ownerId", "listingType", "isShared", "isActive", "createdAt"];
|
|
135
118
|
export declare const DEFAULT_LISTING_TEMPLATE_DATA: Partial<ListingTemplateDocument>;
|
|
136
119
|
export type ModerationStatus = "pending" | "approved" | "rejected" | "auto-approved";
|
|
137
120
|
export type ModerationMediaType = "video" | "image" | "rich-text";
|
|
138
|
-
export interface ModerationQueueDocument {
|
|
139
|
-
id: string;
|
|
121
|
+
export interface ModerationQueueDocument extends BaseDocument {
|
|
140
122
|
mediaType: ModerationMediaType;
|
|
141
123
|
mediaUrl?: string;
|
|
142
124
|
thumbnailUrl?: string;
|
|
@@ -149,8 +131,6 @@ export interface ModerationQueueDocument {
|
|
|
149
131
|
reviewerId?: string;
|
|
150
132
|
reviewedAt?: Date;
|
|
151
133
|
submittedAt: Date;
|
|
152
|
-
createdAt: Date;
|
|
153
|
-
updatedAt: Date;
|
|
154
134
|
}
|
|
155
135
|
export declare const MODERATION_QUEUE_COLLECTION: "moderationQueue";
|
|
156
136
|
export declare const MODERATION_QUEUE_INDEXED_FIELDS: readonly ["status", "mediaType", "entityType", "entityId", "storeId", "ownerId", "submittedAt", "createdAt"];
|
|
@@ -158,8 +138,7 @@ export declare const DEFAULT_MODERATION_QUEUE_DATA: Partial<ModerationQueueDocum
|
|
|
158
138
|
export type ReportEntityType = "product" | "store" | "review" | "event" | "user" | "blog" | "comment";
|
|
159
139
|
export type ReportStatus = "pending" | "under-review" | "actioned" | "dismissed";
|
|
160
140
|
export type ReportReason = "scam" | "counterfeit" | "prohibited" | "inappropriate" | "harassment" | "spam" | "ip-violation" | "other";
|
|
161
|
-
export interface ReportDocument {
|
|
162
|
-
id: string;
|
|
141
|
+
export interface ReportDocument extends BaseDocument {
|
|
163
142
|
entityType: ReportEntityType;
|
|
164
143
|
entityId: string;
|
|
165
144
|
reporterId: string;
|
|
@@ -171,8 +150,6 @@ export interface ReportDocument {
|
|
|
171
150
|
assignedTo?: string;
|
|
172
151
|
resolution?: string;
|
|
173
152
|
resolvedAt?: Date;
|
|
174
|
-
createdAt: Date;
|
|
175
|
-
updatedAt: Date;
|
|
176
153
|
}
|
|
177
154
|
export declare const REPORTS_COLLECTION: "reports";
|
|
178
155
|
export declare const REPORT_INDEXED_FIELDS: readonly ["entityType", "entityId", "reporterId", "reason", "status", "createdAt"];
|
|
@@ -186,8 +163,7 @@ export interface ItemRequestReply {
|
|
|
186
163
|
isOpInitiatedThread: boolean;
|
|
187
164
|
createdAt: Date;
|
|
188
165
|
}
|
|
189
|
-
export interface ItemRequestDocument {
|
|
190
|
-
id: string;
|
|
166
|
+
export interface ItemRequestDocument extends BaseDocument {
|
|
191
167
|
opUserId: string;
|
|
192
168
|
opDisplayName: string;
|
|
193
169
|
title: string;
|
|
@@ -203,14 +179,11 @@ export interface ItemRequestDocument {
|
|
|
203
179
|
approvedAt?: Date;
|
|
204
180
|
approvedBy?: string;
|
|
205
181
|
closedAt?: Date;
|
|
206
|
-
createdAt: Date;
|
|
207
|
-
updatedAt: Date;
|
|
208
182
|
}
|
|
209
183
|
export declare const ITEM_REQUESTS_COLLECTION: "itemRequests";
|
|
210
184
|
export declare const ITEM_REQUEST_INDEXED_FIELDS: readonly ["opUserId", "status", "category", "createdAt"];
|
|
211
185
|
export declare const DEFAULT_ITEM_REQUEST_DATA: Partial<ItemRequestDocument>;
|
|
212
|
-
export interface StoreWhatsAppConfigDocument {
|
|
213
|
-
id: string;
|
|
186
|
+
export interface StoreWhatsAppConfigDocument extends BaseDocument {
|
|
214
187
|
storeId: string;
|
|
215
188
|
isConnected: boolean;
|
|
216
189
|
isPaid: boolean;
|
|
@@ -221,14 +194,11 @@ export interface StoreWhatsAppConfigDocument {
|
|
|
221
194
|
welcomeMessage?: string;
|
|
222
195
|
/** Status of pending WhatsApp Business onboarding (Meta Cloud API). */
|
|
223
196
|
onboardingStatus?: "pending" | "approved" | "rejected";
|
|
224
|
-
createdAt: Date;
|
|
225
|
-
updatedAt: Date;
|
|
226
197
|
}
|
|
227
198
|
export declare const STORE_WHATSAPP_CONFIG_COLLECTION: "storeWhatsAppConfig";
|
|
228
199
|
export declare const STORE_WHATSAPP_CONFIG_INDEXED_FIELDS: readonly ["storeId", "isConnected", "isPaid"];
|
|
229
200
|
export declare const DEFAULT_STORE_WHATSAPP_CONFIG_DATA: Partial<StoreWhatsAppConfigDocument>;
|
|
230
|
-
export interface StoreGoogleConfigDocument {
|
|
231
|
-
id: string;
|
|
201
|
+
export interface StoreGoogleConfigDocument extends BaseDocument {
|
|
232
202
|
storeId: string;
|
|
233
203
|
isConnected: boolean;
|
|
234
204
|
placeId?: string;
|
|
@@ -237,8 +207,6 @@ export interface StoreGoogleConfigDocument {
|
|
|
237
207
|
totalReviews?: number;
|
|
238
208
|
lastSyncedAt?: Date;
|
|
239
209
|
oauthRefreshToken?: string;
|
|
240
|
-
createdAt: Date;
|
|
241
|
-
updatedAt: Date;
|
|
242
210
|
}
|
|
243
211
|
export declare const STORE_GOOGLE_CONFIG_COLLECTION: "storeGoogleConfig";
|
|
244
212
|
export declare const STORE_GOOGLE_CONFIG_INDEXED_FIELDS: readonly ["storeId", "isConnected"];
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState, useCallback } from "react";
|
|
4
|
+
import { useUrlTable } from "../../../react/hooks/useUrlTable";
|
|
5
|
+
import { usePendingTable } from "../../../react/hooks/usePendingTable";
|
|
6
|
+
import { useProducts } from "../../products/hooks/useProducts";
|
|
7
|
+
import { Div, FilterDrawer, ListingToolbar, Pagination, Row, Text } from "../../../ui";
|
|
8
|
+
import { ClassifiedFilters } from "../../classified/components/ClassifiedFilters";
|
|
9
|
+
import { InteractiveProductCard } from "../../products/components/InteractiveProductCard";
|
|
10
|
+
import { PRODUCT_FIELDS } from "../../../constants/field-names";
|
|
11
|
+
import { TABLE_KEYS } from "../../../constants/table-keys";
|
|
12
|
+
import { sortBy } from "../../../constants/sort";
|
|
13
|
+
import { ROUTES } from "../../../next";
|
|
14
|
+
const DEFAULT_SORT = sortBy(PRODUCT_FIELDS.CREATED_AT);
|
|
15
|
+
const SORT_OPTIONS = [
|
|
16
|
+
{ value: sortBy(PRODUCT_FIELDS.CREATED_AT), label: "Newest First" },
|
|
17
|
+
{ value: sortBy(PRODUCT_FIELDS.CREATED_AT, "ASC"), label: "Oldest First" },
|
|
18
|
+
{ value: sortBy(PRODUCT_FIELDS.PRICE, "ASC"), label: "Price: Low to High" },
|
|
19
|
+
{ value: sortBy(PRODUCT_FIELDS.PRICE), label: "Price: High to Low" },
|
|
20
|
+
];
|
|
21
|
+
const FILTER_KEYS = [TABLE_KEYS.MIN_PRICE, TABLE_KEYS.MAX_PRICE, TABLE_KEYS.NEGOTIABLE, TABLE_KEYS.ACCEPTS_SHIPPING];
|
|
22
|
+
export function StoreClassifiedsListing({ storeId, initialData }) {
|
|
23
|
+
const table = useUrlTable({ defaults: { pageSize: "24", sort: DEFAULT_SORT } });
|
|
24
|
+
const [searchInput, setSearchInput] = useState(table.get("q") || "");
|
|
25
|
+
const [filterOpen, setFilterOpen] = useState(false);
|
|
26
|
+
const { pendingTable, filterActiveCount, onFilterApply, onFilterClear, onResetAll, onFilterReset } = usePendingTable(table, FILTER_KEYS);
|
|
27
|
+
const openFilters = useCallback(() => { onFilterReset(); setFilterOpen(true); }, [onFilterReset]);
|
|
28
|
+
const applyFilters = useCallback(() => { onFilterApply(); setFilterOpen(false); }, [onFilterApply]);
|
|
29
|
+
const resetAll = useCallback(() => { onResetAll({ q: "", sort: "" }); setSearchInput(""); }, [onResetAll]);
|
|
30
|
+
const hasActiveState = !!table.get("q") || table.get("sort") !== DEFAULT_SORT || filterActiveCount > 0;
|
|
31
|
+
const params = {
|
|
32
|
+
q: table.get("q") || undefined,
|
|
33
|
+
minPrice: table.get(TABLE_KEYS.MIN_PRICE) ? Number(table.get(TABLE_KEYS.MIN_PRICE)) : undefined,
|
|
34
|
+
maxPrice: table.get(TABLE_KEYS.MAX_PRICE) ? Number(table.get(TABLE_KEYS.MAX_PRICE)) : undefined,
|
|
35
|
+
sort: table.get("sort") || DEFAULT_SORT,
|
|
36
|
+
page: table.getNumber("page", 1),
|
|
37
|
+
perPage: table.getNumber("pageSize", 24),
|
|
38
|
+
storeId: storeId || undefined,
|
|
39
|
+
listingType: "classified",
|
|
40
|
+
};
|
|
41
|
+
const { products, totalPages, page, isLoading } = useProducts(params, { initialData });
|
|
42
|
+
const gridClass = "grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-4";
|
|
43
|
+
return (_jsxs(Div, { className: "min-h-[200px]", children: [_jsx(ListingToolbar, { filterCount: filterActiveCount, onFiltersClick: openFilters, searchValue: searchInput, searchPlaceholder: "Search store classifieds\u2026", onSearchChange: setSearchInput, onSearchCommit: () => table.set("q", searchInput.trim()), sortValue: table.get("sort") || DEFAULT_SORT, sortOptions: SORT_OPTIONS, onSortChange: (v) => table.set("sort", v), onResetAll: resetAll, hasActiveState: hasActiveState }), totalPages > 1 && (_jsx(Row, { border: "bottom", className: "sticky top-[calc(var(--header-height,0px)+44px)] z-10 backdrop-blur-sm", surface: "default", padding: "toolbar", justify: "center", children: _jsx(Pagination, { currentPage: page, totalPages: totalPages, onPageChange: (p) => table.setPage(p) }) })), _jsx(Div, { padding: "y-lg", children: _jsx(Div, { className: gridClass, children: isLoading
|
|
44
|
+
? Array.from({ length: 8 }).map((_, i) => _jsx(Div, { surface: "muted", rounded: "xl", className: "aspect-square animate-pulse" }, i))
|
|
45
|
+
: products.length === 0
|
|
46
|
+
? _jsx(Div, { paddingY: "y-4xl", className: "col-span-full text-center", children: _jsx(Text, { color: "muted", children: "No classified listings in this store yet." }) })
|
|
47
|
+
: products.map((p) => (_jsx(InteractiveProductCard, { product: p, href: String(ROUTES.PUBLIC.CLASSIFIED_DETAIL(p.slug ?? p.id)) }, p.id))) }) }), _jsx(FilterDrawer, { open: filterOpen, onOpen: openFilters, onClose: () => setFilterOpen(false), onApply: applyFilters, onReset: onFilterClear, activeCount: filterActiveCount, hideTrigger: true, children: _jsx(ClassifiedFilters, { table: pendingTable, currencyPrefix: "\u20B9" }) })] }));
|
|
48
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { sieveFilter, sieveAnd, SIEVE_OP, sortBy, PRODUCT_FIELDS } from "@mohasinac/appkit";
|
|
3
|
+
import { productRepository } from "../../../repositories";
|
|
4
|
+
import { getStoreBySlug } from "./StoreDetailLayoutView";
|
|
5
|
+
import { StoreClassifiedsListing } from "./StoreClassifiedsListing";
|
|
6
|
+
export async function StoreClassifiedsPageView({ storeSlug }) {
|
|
7
|
+
const store = await getStoreBySlug(storeSlug);
|
|
8
|
+
const storeId = store?.id;
|
|
9
|
+
if (!storeId)
|
|
10
|
+
return null;
|
|
11
|
+
const result = await productRepository
|
|
12
|
+
.list({
|
|
13
|
+
filters: sieveAnd(sieveFilter("storeId", SIEVE_OP.EQ, storeId), sieveFilter("status", SIEVE_OP.EQ, "published"), sieveFilter("listingType", SIEVE_OP.EQ, "classified")),
|
|
14
|
+
sorts: sortBy(PRODUCT_FIELDS.CREATED_AT),
|
|
15
|
+
page: 1,
|
|
16
|
+
pageSize: 24,
|
|
17
|
+
})
|
|
18
|
+
.catch(() => null);
|
|
19
|
+
return _jsx(StoreClassifiedsListing, { storeId: storeId, initialData: result ?? undefined });
|
|
20
|
+
}
|
|
@@ -14,6 +14,9 @@ const STORE_LISTING_HREF = {
|
|
|
14
14
|
"pre-orders": (slug) => String(ROUTES.PUBLIC.STORE_PRE_ORDERS(slug)),
|
|
15
15
|
"prize-draws": (slug) => String(ROUTES.PUBLIC.STORE_PRIZE_DRAWS(slug)),
|
|
16
16
|
bundles: (slug) => String(ROUTES.PUBLIC.STORE_BUNDLES(slug)),
|
|
17
|
+
classifieds: (slug) => String(ROUTES.PUBLIC.STORE_CLASSIFIEDS(slug)),
|
|
18
|
+
"digital-codes": (slug) => String(ROUTES.PUBLIC.STORE_DIGITAL_CODES(slug)),
|
|
19
|
+
live: (slug) => String(ROUTES.PUBLIC.STORE_LIVE(slug)),
|
|
17
20
|
};
|
|
18
21
|
export const getStoreBySlug = cache((slug) => storeRepository.findBySlug(slug).catch(() => undefined));
|
|
19
22
|
function tabLabel(base, count) {
|
|
@@ -28,7 +31,7 @@ export async function StoreDetailLayoutView({ storeSlug, activeTab, children, })
|
|
|
28
31
|
}
|
|
29
32
|
const storeId = store?.id;
|
|
30
33
|
const settings = await siteSettingsRepository.findById("global").catch(() => null);
|
|
31
|
-
const [productsCount, auctionsCount, preOrdersCount, prizeDrawsCount, bundlesCount, couponsCount, reviewsCount] = storeId
|
|
34
|
+
const [productsCount, auctionsCount, preOrdersCount, prizeDrawsCount, bundlesCount, classifiedsCount, digitalCodesCount, liveCount, couponsCount, reviewsCount] = storeId
|
|
32
35
|
? await Promise.all([
|
|
33
36
|
productRepository
|
|
34
37
|
.list({ filters: sieveAnd(sieveFilter("storeId", SIEVE_OP.EQ, storeId), sieveFilter("status", SIEVE_OP.EQ, "published"), sieveFilter("listingType", SIEVE_OP.EQ, "standard")), page: 1, pageSize: 1 })
|
|
@@ -52,6 +55,18 @@ export async function StoreDetailLayoutView({ storeSlug, activeTab, children, })
|
|
|
52
55
|
.listByType("bundle", { activeOnly: true, limit: 100 })
|
|
53
56
|
.then((rows) => rows.filter((c) => c.createdByStoreId === storeId).length)
|
|
54
57
|
.catch(() => 0),
|
|
58
|
+
productRepository
|
|
59
|
+
.list({ filters: sieveAnd(sieveFilter("storeId", SIEVE_OP.EQ, storeId), sieveFilter("status", SIEVE_OP.EQ, "published"), sieveFilter("listingType", SIEVE_OP.EQ, "classified")), page: 1, pageSize: 1 })
|
|
60
|
+
.then((r) => r.total)
|
|
61
|
+
.catch(() => 0),
|
|
62
|
+
productRepository
|
|
63
|
+
.list({ filters: sieveAnd(sieveFilter("storeId", SIEVE_OP.EQ, storeId), sieveFilter("status", SIEVE_OP.EQ, "published"), sieveFilter("listingType", SIEVE_OP.EQ, "digital-code")), page: 1, pageSize: 1 })
|
|
64
|
+
.then((r) => r.total)
|
|
65
|
+
.catch(() => 0),
|
|
66
|
+
productRepository
|
|
67
|
+
.list({ filters: sieveAnd(sieveFilter("storeId", SIEVE_OP.EQ, storeId), sieveFilter("status", SIEVE_OP.EQ, "published"), sieveFilter("listingType", SIEVE_OP.EQ, "live")), page: 1, pageSize: 1 })
|
|
68
|
+
.then((r) => r.total)
|
|
69
|
+
.catch(() => 0),
|
|
55
70
|
couponsRepository
|
|
56
71
|
.list({ filters: sieveAnd(sieveFilter("sellerId", SIEVE_OP.EQ, storeId), sieveFilter("validity.isActive", SIEVE_OP.EQ, "true")), page: 1, pageSize: 1 })
|
|
57
72
|
.then((r) => r.total)
|
|
@@ -61,19 +76,25 @@ export async function StoreDetailLayoutView({ storeSlug, activeTab, children, })
|
|
|
61
76
|
.then((r) => r.total)
|
|
62
77
|
.catch(() => 0),
|
|
63
78
|
])
|
|
64
|
-
: [0, 0, 0, 0, 0, 0, 0];
|
|
79
|
+
: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
|
|
65
80
|
const listingCounts = {
|
|
66
81
|
products: productsCount,
|
|
67
82
|
auctions: auctionsCount,
|
|
68
83
|
"pre-orders": preOrdersCount,
|
|
69
84
|
"prize-draws": prizeDrawsCount,
|
|
70
85
|
bundles: bundlesCount,
|
|
86
|
+
classifieds: classifiedsCount,
|
|
87
|
+
"digital-codes": digitalCodesCount,
|
|
88
|
+
live: liveCount,
|
|
71
89
|
};
|
|
72
90
|
const TAB_LISTING_TYPE = {
|
|
73
91
|
products: "standard",
|
|
74
92
|
auctions: "auction",
|
|
75
93
|
"pre-orders": "pre-order",
|
|
76
94
|
"prize-draws": "prize-draw",
|
|
95
|
+
classifieds: "classified",
|
|
96
|
+
"digital-codes": "digital-code",
|
|
97
|
+
live: "live",
|
|
77
98
|
};
|
|
78
99
|
const visibleStoreTabs = STORE_PAGE_TABS.filter((tab) => {
|
|
79
100
|
if (tab.id === "bundles")
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState, useCallback } from "react";
|
|
4
|
+
import { useUrlTable } from "../../../react/hooks/useUrlTable";
|
|
5
|
+
import { usePendingTable } from "../../../react/hooks/usePendingTable";
|
|
6
|
+
import { useProducts } from "../../products/hooks/useProducts";
|
|
7
|
+
import { Div, FilterDrawer, ListingToolbar, Pagination, Row, Text } from "../../../ui";
|
|
8
|
+
import { DigitalCodeFilters } from "../../digital-codes/components/DigitalCodeFilters";
|
|
9
|
+
import { InteractiveProductCard } from "../../products/components/InteractiveProductCard";
|
|
10
|
+
import { PRODUCT_FIELDS } from "../../../constants/field-names";
|
|
11
|
+
import { TABLE_KEYS } from "../../../constants/table-keys";
|
|
12
|
+
import { sortBy } from "../../../constants/sort";
|
|
13
|
+
import { ROUTES } from "../../../next";
|
|
14
|
+
const DEFAULT_SORT = sortBy(PRODUCT_FIELDS.CREATED_AT);
|
|
15
|
+
const SORT_OPTIONS = [
|
|
16
|
+
{ value: sortBy(PRODUCT_FIELDS.CREATED_AT), label: "Newest First" },
|
|
17
|
+
{ value: sortBy(PRODUCT_FIELDS.CREATED_AT, "ASC"), label: "Oldest First" },
|
|
18
|
+
{ value: sortBy(PRODUCT_FIELDS.PRICE, "ASC"), label: "Price: Low to High" },
|
|
19
|
+
{ value: sortBy(PRODUCT_FIELDS.PRICE), label: "Price: High to Low" },
|
|
20
|
+
];
|
|
21
|
+
const FILTER_KEYS = [TABLE_KEYS.MIN_PRICE, TABLE_KEYS.MAX_PRICE];
|
|
22
|
+
export function StoreDigitalCodesListing({ storeId, initialData }) {
|
|
23
|
+
const table = useUrlTable({ defaults: { pageSize: "24", sort: DEFAULT_SORT } });
|
|
24
|
+
const [searchInput, setSearchInput] = useState(table.get("q") || "");
|
|
25
|
+
const [filterOpen, setFilterOpen] = useState(false);
|
|
26
|
+
const { pendingTable, filterActiveCount, onFilterApply, onFilterClear, onResetAll, onFilterReset } = usePendingTable(table, FILTER_KEYS);
|
|
27
|
+
const openFilters = useCallback(() => { onFilterReset(); setFilterOpen(true); }, [onFilterReset]);
|
|
28
|
+
const applyFilters = useCallback(() => { onFilterApply(); setFilterOpen(false); }, [onFilterApply]);
|
|
29
|
+
const resetAll = useCallback(() => { onResetAll({ q: "", sort: "" }); setSearchInput(""); }, [onResetAll]);
|
|
30
|
+
const hasActiveState = !!table.get("q") || table.get("sort") !== DEFAULT_SORT || filterActiveCount > 0;
|
|
31
|
+
const params = {
|
|
32
|
+
q: table.get("q") || undefined,
|
|
33
|
+
minPrice: table.get(TABLE_KEYS.MIN_PRICE) ? Number(table.get(TABLE_KEYS.MIN_PRICE)) : undefined,
|
|
34
|
+
maxPrice: table.get(TABLE_KEYS.MAX_PRICE) ? Number(table.get(TABLE_KEYS.MAX_PRICE)) : undefined,
|
|
35
|
+
sort: table.get("sort") || DEFAULT_SORT,
|
|
36
|
+
page: table.getNumber("page", 1),
|
|
37
|
+
perPage: table.getNumber("pageSize", 24),
|
|
38
|
+
storeId: storeId || undefined,
|
|
39
|
+
listingType: "digital-code",
|
|
40
|
+
};
|
|
41
|
+
const { products, totalPages, page, isLoading } = useProducts(params, { initialData });
|
|
42
|
+
const gridClass = "grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-4";
|
|
43
|
+
return (_jsxs(Div, { className: "min-h-[200px]", children: [_jsx(ListingToolbar, { filterCount: filterActiveCount, onFiltersClick: openFilters, searchValue: searchInput, searchPlaceholder: "Search digital codes\u2026", onSearchChange: setSearchInput, onSearchCommit: () => table.set("q", searchInput.trim()), sortValue: table.get("sort") || DEFAULT_SORT, sortOptions: SORT_OPTIONS, onSortChange: (v) => table.set("sort", v), onResetAll: resetAll, hasActiveState: hasActiveState }), totalPages > 1 && (_jsx(Row, { border: "bottom", className: "sticky top-[calc(var(--header-height,0px)+44px)] z-10 backdrop-blur-sm", surface: "default", padding: "toolbar", justify: "center", children: _jsx(Pagination, { currentPage: page, totalPages: totalPages, onPageChange: (p) => table.setPage(p) }) })), _jsx(Div, { padding: "y-lg", children: _jsx(Div, { className: gridClass, children: isLoading
|
|
44
|
+
? Array.from({ length: 8 }).map((_, i) => _jsx(Div, { surface: "muted", rounded: "xl", className: "aspect-square animate-pulse" }, i))
|
|
45
|
+
: products.length === 0
|
|
46
|
+
? _jsx(Div, { paddingY: "y-4xl", className: "col-span-full text-center", children: _jsx(Text, { color: "muted", children: "No digital codes in this store yet." }) })
|
|
47
|
+
: products.map((p) => (_jsx(InteractiveProductCard, { product: p, href: String(ROUTES.PUBLIC.DIGITAL_CODE_DETAIL(p.slug ?? p.id)) }, p.id))) }) }), _jsx(FilterDrawer, { open: filterOpen, onOpen: openFilters, onClose: () => setFilterOpen(false), onApply: applyFilters, onReset: onFilterClear, activeCount: filterActiveCount, hideTrigger: true, children: _jsx(DigitalCodeFilters, { table: pendingTable, currencyPrefix: "\u20B9" }) })] }));
|
|
48
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { sieveFilter, sieveAnd, SIEVE_OP, sortBy, PRODUCT_FIELDS } from "@mohasinac/appkit";
|
|
3
|
+
import { productRepository } from "../../../repositories";
|
|
4
|
+
import { getStoreBySlug } from "./StoreDetailLayoutView";
|
|
5
|
+
import { StoreDigitalCodesListing } from "./StoreDigitalCodesListing";
|
|
6
|
+
export async function StoreDigitalCodesPageView({ storeSlug }) {
|
|
7
|
+
const store = await getStoreBySlug(storeSlug);
|
|
8
|
+
const storeId = store?.id;
|
|
9
|
+
if (!storeId)
|
|
10
|
+
return null;
|
|
11
|
+
const result = await productRepository
|
|
12
|
+
.list({
|
|
13
|
+
filters: sieveAnd(sieveFilter("storeId", SIEVE_OP.EQ, storeId), sieveFilter("status", SIEVE_OP.EQ, "published"), sieveFilter("listingType", SIEVE_OP.EQ, "digital-code")),
|
|
14
|
+
sorts: sortBy(PRODUCT_FIELDS.CREATED_AT),
|
|
15
|
+
page: 1,
|
|
16
|
+
pageSize: 24,
|
|
17
|
+
})
|
|
18
|
+
.catch(() => null);
|
|
19
|
+
return _jsx(StoreDigitalCodesListing, { storeId: storeId, initialData: result ?? undefined });
|
|
20
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState, useCallback } from "react";
|
|
4
|
+
import { useUrlTable } from "../../../react/hooks/useUrlTable";
|
|
5
|
+
import { usePendingTable } from "../../../react/hooks/usePendingTable";
|
|
6
|
+
import { useProducts } from "../../products/hooks/useProducts";
|
|
7
|
+
import { Div, FilterDrawer, ListingToolbar, Pagination, Row, Text } from "../../../ui";
|
|
8
|
+
import { LiveItemFilters } from "../../live/components/LiveItemFilters";
|
|
9
|
+
import { InteractiveProductCard } from "../../products/components/InteractiveProductCard";
|
|
10
|
+
import { PRODUCT_FIELDS } from "../../../constants/field-names";
|
|
11
|
+
import { TABLE_KEYS } from "../../../constants/table-keys";
|
|
12
|
+
import { sortBy } from "../../../constants/sort";
|
|
13
|
+
import { ROUTES } from "../../../next";
|
|
14
|
+
const DEFAULT_SORT = sortBy(PRODUCT_FIELDS.CREATED_AT);
|
|
15
|
+
const SORT_OPTIONS = [
|
|
16
|
+
{ value: sortBy(PRODUCT_FIELDS.CREATED_AT), label: "Newest First" },
|
|
17
|
+
{ value: sortBy(PRODUCT_FIELDS.CREATED_AT, "ASC"), label: "Oldest First" },
|
|
18
|
+
{ value: sortBy(PRODUCT_FIELDS.PRICE, "ASC"), label: "Price: Low to High" },
|
|
19
|
+
{ value: sortBy(PRODUCT_FIELDS.PRICE), label: "Price: High to Low" },
|
|
20
|
+
];
|
|
21
|
+
const FILTER_KEYS = [TABLE_KEYS.MIN_PRICE, TABLE_KEYS.MAX_PRICE, TABLE_KEYS.SPECIES, "liveSex", "liveTransportMethod", "jurisdiction"];
|
|
22
|
+
export function StoreLiveItemsListing({ storeId, initialData }) {
|
|
23
|
+
const table = useUrlTable({ defaults: { pageSize: "24", sort: DEFAULT_SORT } });
|
|
24
|
+
const [searchInput, setSearchInput] = useState(table.get("q") || "");
|
|
25
|
+
const [filterOpen, setFilterOpen] = useState(false);
|
|
26
|
+
const { pendingTable, filterActiveCount, onFilterApply, onFilterClear, onResetAll, onFilterReset } = usePendingTable(table, FILTER_KEYS);
|
|
27
|
+
const openFilters = useCallback(() => { onFilterReset(); setFilterOpen(true); }, [onFilterReset]);
|
|
28
|
+
const applyFilters = useCallback(() => { onFilterApply(); setFilterOpen(false); }, [onFilterApply]);
|
|
29
|
+
const resetAll = useCallback(() => { onResetAll({ q: "", sort: "" }); setSearchInput(""); }, [onResetAll]);
|
|
30
|
+
const hasActiveState = !!table.get("q") || table.get("sort") !== DEFAULT_SORT || filterActiveCount > 0;
|
|
31
|
+
const params = {
|
|
32
|
+
q: table.get("q") || undefined,
|
|
33
|
+
minPrice: table.get(TABLE_KEYS.MIN_PRICE) ? Number(table.get(TABLE_KEYS.MIN_PRICE)) : undefined,
|
|
34
|
+
maxPrice: table.get(TABLE_KEYS.MAX_PRICE) ? Number(table.get(TABLE_KEYS.MAX_PRICE)) : undefined,
|
|
35
|
+
sort: table.get("sort") || DEFAULT_SORT,
|
|
36
|
+
page: table.getNumber("page", 1),
|
|
37
|
+
perPage: table.getNumber("pageSize", 24),
|
|
38
|
+
storeId: storeId || undefined,
|
|
39
|
+
listingType: "live",
|
|
40
|
+
};
|
|
41
|
+
const { products, totalPages, page, isLoading } = useProducts(params, { initialData });
|
|
42
|
+
const gridClass = "grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-4";
|
|
43
|
+
return (_jsxs(Div, { className: "min-h-[200px]", children: [_jsx(ListingToolbar, { filterCount: filterActiveCount, onFiltersClick: openFilters, searchValue: searchInput, searchPlaceholder: "Search live animals & plants\u2026", onSearchChange: setSearchInput, onSearchCommit: () => table.set("q", searchInput.trim()), sortValue: table.get("sort") || DEFAULT_SORT, sortOptions: SORT_OPTIONS, onSortChange: (v) => table.set("sort", v), onResetAll: resetAll, hasActiveState: hasActiveState }), totalPages > 1 && (_jsx(Row, { border: "bottom", className: "sticky top-[calc(var(--header-height,0px)+44px)] z-10 backdrop-blur-sm", surface: "default", padding: "toolbar", justify: "center", children: _jsx(Pagination, { currentPage: page, totalPages: totalPages, onPageChange: (p) => table.setPage(p) }) })), _jsx(Div, { padding: "y-lg", children: _jsx(Div, { className: gridClass, children: isLoading
|
|
44
|
+
? Array.from({ length: 8 }).map((_, i) => _jsx(Div, { surface: "muted", rounded: "xl", className: "aspect-square animate-pulse" }, i))
|
|
45
|
+
: products.length === 0
|
|
46
|
+
? _jsx(Div, { paddingY: "y-4xl", className: "col-span-full text-center", children: _jsx(Text, { color: "muted", children: "No live items in this store yet." }) })
|
|
47
|
+
: products.map((p) => (_jsx(InteractiveProductCard, { product: p, href: String(ROUTES.PUBLIC.LIVE_DETAIL(p.slug ?? p.id)) }, p.id))) }) }), _jsx(FilterDrawer, { open: filterOpen, onOpen: openFilters, onClose: () => setFilterOpen(false), onApply: applyFilters, onReset: onFilterClear, activeCount: filterActiveCount, hideTrigger: true, children: _jsx(LiveItemFilters, { table: pendingTable, currencyPrefix: "\u20B9" }) })] }));
|
|
48
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { sieveFilter, sieveAnd, SIEVE_OP, sortBy, PRODUCT_FIELDS } from "@mohasinac/appkit";
|
|
3
|
+
import { productRepository } from "../../../repositories";
|
|
4
|
+
import { getStoreBySlug } from "./StoreDetailLayoutView";
|
|
5
|
+
import { StoreLiveItemsListing } from "./StoreLiveItemsListing";
|
|
6
|
+
export async function StoreLiveItemsPageView({ storeSlug }) {
|
|
7
|
+
const store = await getStoreBySlug(storeSlug);
|
|
8
|
+
const storeId = store?.id;
|
|
9
|
+
if (!storeId)
|
|
10
|
+
return null;
|
|
11
|
+
const result = await productRepository
|
|
12
|
+
.list({
|
|
13
|
+
filters: sieveAnd(sieveFilter("storeId", SIEVE_OP.EQ, storeId), sieveFilter("status", SIEVE_OP.EQ, "published"), sieveFilter("listingType", SIEVE_OP.EQ, "live")),
|
|
14
|
+
sorts: sortBy(PRODUCT_FIELDS.CREATED_AT),
|
|
15
|
+
page: 1,
|
|
16
|
+
pageSize: 24,
|
|
17
|
+
})
|
|
18
|
+
.catch(() => null);
|
|
19
|
+
return _jsx(StoreLiveItemsListing, { storeId: storeId, initialData: result ?? undefined });
|
|
20
|
+
}
|
|
@@ -26,6 +26,15 @@ export type { StorePreOrdersListingProps } from "./StorePreOrdersListing";
|
|
|
26
26
|
export type { StorePreOrdersPageViewProps } from "./StorePreOrdersPageView";
|
|
27
27
|
export type { StorePrizeDrawsPageViewProps } from "./StorePrizeDrawsPageView";
|
|
28
28
|
export type { StoreBundlesPageViewProps } from "./StoreBundlesPageView";
|
|
29
|
+
export { StoreClassifiedsListing } from "./StoreClassifiedsListing";
|
|
30
|
+
export type { StoreClassifiedsListingProps } from "./StoreClassifiedsListing";
|
|
31
|
+
export type { StoreClassifiedsPageViewProps } from "./StoreClassifiedsPageView";
|
|
32
|
+
export { StoreDigitalCodesListing } from "./StoreDigitalCodesListing";
|
|
33
|
+
export type { StoreDigitalCodesListingProps } from "./StoreDigitalCodesListing";
|
|
34
|
+
export type { StoreDigitalCodesPageViewProps } from "./StoreDigitalCodesPageView";
|
|
35
|
+
export { StoreLiveItemsListing } from "./StoreLiveItemsListing";
|
|
36
|
+
export type { StoreLiveItemsListingProps } from "./StoreLiveItemsListing";
|
|
37
|
+
export type { StoreLiveItemsPageViewProps } from "./StoreLiveItemsPageView";
|
|
29
38
|
export { StoreGuideHubView } from "./StoreGuideHubView";
|
|
30
39
|
export type { StoreGuideHubViewProps } from "./StoreGuideHubView";
|
|
31
40
|
export { StoreListingsGuideView } from "./StoreListingsGuideView";
|
|
@@ -11,6 +11,9 @@ export { StoreProductsListing } from "./StoreProductsListing";
|
|
|
11
11
|
export { StoreAuctionsListing } from "./StoreAuctionsListing";
|
|
12
12
|
export { StoreReviewsListing } from "./StoreReviewsListing";
|
|
13
13
|
export { StorePreOrdersListing } from "./StorePreOrdersListing";
|
|
14
|
+
export { StoreClassifiedsListing } from "./StoreClassifiedsListing";
|
|
15
|
+
export { StoreDigitalCodesListing } from "./StoreDigitalCodesListing";
|
|
16
|
+
export { StoreLiveItemsListing } from "./StoreLiveItemsListing";
|
|
14
17
|
export { StoreGuideHubView } from "./StoreGuideHubView";
|
|
15
18
|
export { StoreListingsGuideView } from "./StoreListingsGuideView";
|
|
16
19
|
export { StoreOrdersGuideView } from "./StoreOrdersGuideView";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|