@mohasinac/appkit 2.6.3 → 2.6.5
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/server/features/account/data.js +2 -2
- package/dist/_internal/server/features/bundles/data.d.ts +26 -6
- package/dist/_internal/server/features/bundles/data.js +41 -6
- package/dist/_internal/server/features/bundles/index.d.ts +3 -2
- package/dist/_internal/server/features/bundles/index.js +4 -2
- package/dist/_internal/server/features/bundles/metadata.d.ts +20 -0
- package/dist/_internal/server/features/bundles/metadata.js +46 -0
- package/dist/_internal/server/features/bundles/og.d.ts +38 -0
- package/dist/_internal/server/features/bundles/og.js +122 -0
- package/dist/_internal/server/features/checkout/actions.js +192 -133
- package/dist/_internal/server/features/checkout/bundle-expansion.d.ts +57 -0
- package/dist/_internal/server/features/checkout/bundle-expansion.js +70 -0
- package/dist/_internal/server/features/checkout/prize-bundle-gates.d.ts +5 -15
- package/dist/_internal/server/features/checkout/prize-bundle-gates.js +5 -21
- package/dist/_internal/server/features/media/contextGuards.js +15 -1
- package/dist/_internal/server/features/payouts/actions.d.ts +19 -0
- package/dist/_internal/server/features/payouts/actions.js +38 -0
- package/dist/_internal/server/features/products/data.js +1 -2
- package/dist/_internal/server/features/raffle/actions.d.ts +11 -0
- package/dist/_internal/server/features/raffle/actions.js +31 -0
- package/dist/_internal/server/features/refunds/actions.d.ts +31 -0
- package/dist/_internal/server/features/refunds/actions.js +77 -0
- package/dist/_internal/server/jobs/core/adminAnalytics.d.ts +28 -0
- package/dist/_internal/server/jobs/core/adminAnalytics.js +98 -0
- package/dist/_internal/server/jobs/core/assignSpinPrize.d.ts +19 -0
- package/dist/_internal/server/jobs/core/assignSpinPrize.js +81 -0
- package/dist/_internal/server/jobs/core/auctionSettlement.d.ts +2 -0
- package/dist/_internal/server/jobs/core/auctionSettlement.js +70 -0
- package/dist/_internal/server/jobs/core/autoPayoutEligibility.d.ts +2 -0
- package/dist/_internal/server/jobs/core/autoPayoutEligibility.js +109 -0
- package/dist/_internal/server/jobs/core/bundleStockSync.d.ts +10 -0
- package/dist/_internal/server/jobs/core/bundleStockSync.js +71 -0
- package/dist/_internal/server/jobs/core/cartPrune.d.ts +2 -0
- package/dist/_internal/server/jobs/core/cartPrune.js +13 -0
- package/dist/_internal/server/jobs/core/cleanupRtdbEvents.d.ts +2 -0
- package/dist/_internal/server/jobs/core/cleanupRtdbEvents.js +45 -0
- package/dist/_internal/server/jobs/core/countersReconcile.d.ts +2 -0
- package/dist/_internal/server/jobs/core/countersReconcile.js +107 -0
- package/dist/_internal/server/jobs/core/couponExpiry.d.ts +2 -0
- package/dist/_internal/server/jobs/core/couponExpiry.js +13 -0
- package/dist/_internal/server/jobs/core/dailyDataCleanup.d.ts +2 -0
- package/dist/_internal/server/jobs/core/dailyDataCleanup.js +20 -0
- package/dist/_internal/server/jobs/core/index.d.ts +44 -0
- package/dist/_internal/server/jobs/core/index.js +47 -0
- package/dist/_internal/server/jobs/core/listingProcessor.d.ts +30 -0
- package/dist/_internal/server/jobs/core/listingProcessor.js +138 -0
- package/dist/_internal/server/jobs/core/mediaTmpCleanup.d.ts +14 -0
- package/dist/_internal/server/jobs/core/mediaTmpCleanup.js +68 -0
- package/dist/_internal/server/jobs/core/notificationPrune.d.ts +2 -0
- package/dist/_internal/server/jobs/core/notificationPrune.js +13 -0
- package/dist/_internal/server/jobs/core/offerExpiry.d.ts +2 -0
- package/dist/_internal/server/jobs/core/offerExpiry.js +50 -0
- package/dist/_internal/server/jobs/core/onBidPlaced.d.ts +15 -0
- package/dist/_internal/server/jobs/core/onBidPlaced.js +59 -0
- package/dist/_internal/server/jobs/core/onCategoryWrite.d.ts +14 -0
- package/dist/_internal/server/jobs/core/onCategoryWrite.js +134 -0
- package/dist/_internal/server/jobs/core/onOrderCreate.d.ts +18 -0
- package/dist/_internal/server/jobs/core/onOrderCreate.js +78 -0
- package/dist/_internal/server/jobs/core/onOrderStatusChange.d.ts +19 -0
- package/dist/_internal/server/jobs/core/onOrderStatusChange.js +139 -0
- package/dist/_internal/server/jobs/core/onProductStockChange.d.ts +23 -0
- package/dist/_internal/server/jobs/core/onProductStockChange.js +130 -0
- package/dist/_internal/server/jobs/core/onProductWrite.d.ts +12 -0
- package/dist/_internal/server/jobs/core/onProductWrite.js +94 -0
- package/dist/_internal/server/jobs/core/onReviewWrite.d.ts +7 -0
- package/dist/_internal/server/jobs/core/onReviewWrite.js +49 -0
- package/dist/_internal/server/jobs/core/onStoreWrite.d.ts +12 -0
- package/dist/_internal/server/jobs/core/onStoreWrite.js +7 -0
- package/dist/_internal/server/jobs/core/payoutBatch.d.ts +8 -0
- package/dist/_internal/server/jobs/core/payoutBatch.js +102 -0
- package/dist/_internal/server/jobs/core/pendingOrderTimeout.d.ts +2 -0
- package/dist/_internal/server/jobs/core/pendingOrderTimeout.js +27 -0
- package/dist/_internal/server/jobs/core/positionsReconcile.d.ts +7 -0
- package/dist/_internal/server/jobs/core/positionsReconcile.js +87 -0
- package/dist/_internal/server/jobs/core/prizeRevealClose.d.ts +2 -0
- package/dist/_internal/server/jobs/core/prizeRevealClose.js +22 -0
- package/dist/_internal/server/jobs/core/prizeRevealExpiry.d.ts +2 -0
- package/dist/_internal/server/jobs/core/prizeRevealExpiry.js +50 -0
- package/dist/_internal/server/jobs/core/prizeRevealOpen.d.ts +2 -0
- package/dist/_internal/server/jobs/core/prizeRevealOpen.js +56 -0
- package/dist/_internal/server/jobs/core/prizeRevealReminder.d.ts +2 -0
- package/dist/_internal/server/jobs/core/prizeRevealReminder.js +38 -0
- package/dist/_internal/server/jobs/core/productStatsSync.d.ts +8 -0
- package/dist/_internal/server/jobs/core/productStatsSync.js +36 -0
- package/dist/_internal/server/jobs/core/promotions.d.ts +12 -0
- package/dist/_internal/server/jobs/core/promotions.js +43 -0
- package/dist/_internal/server/jobs/core/storeAnalytics.d.ts +30 -0
- package/dist/_internal/server/jobs/core/storeAnalytics.js +109 -0
- package/dist/_internal/server/jobs/core/triggerEventRaffle.d.ts +19 -0
- package/dist/_internal/server/jobs/core/triggerEventRaffle.js +86 -0
- package/dist/_internal/server/jobs/core/weeklyPayoutEligibility.d.ts +6 -0
- package/dist/_internal/server/jobs/core/weeklyPayoutEligibility.js +85 -0
- package/dist/_internal/server/jobs/handlers/adminAnalytics.d.ts +2 -26
- package/dist/_internal/server/jobs/handlers/adminAnalytics.js +2 -98
- package/dist/_internal/server/jobs/handlers/assignSpinPrize.d.ts +1 -22
- package/dist/_internal/server/jobs/handlers/assignSpinPrize.js +2 -86
- package/dist/_internal/server/jobs/handlers/auctionSettlement.js +2 -70
- package/dist/_internal/server/jobs/handlers/autoPayoutEligibility.js +2 -110
- package/dist/_internal/server/jobs/handlers/bundleStockSync.d.ts +0 -16
- package/dist/_internal/server/jobs/handlers/bundleStockSync.js +2 -80
- package/dist/_internal/server/jobs/handlers/cartPrune.js +2 -13
- package/dist/_internal/server/jobs/handlers/cleanupRtdbEvents.js +2 -45
- package/dist/_internal/server/jobs/handlers/countersReconcile.js +2 -109
- package/dist/_internal/server/jobs/handlers/couponExpiry.js +2 -13
- package/dist/_internal/server/jobs/handlers/dailyDataCleanup.js +2 -20
- package/dist/_internal/server/jobs/handlers/listingProcessor.d.ts +3 -28
- package/dist/_internal/server/jobs/handlers/listingProcessor.js +3 -138
- package/dist/_internal/server/jobs/handlers/mediaTmpCleanup.d.ts +0 -12
- package/dist/_internal/server/jobs/handlers/mediaTmpCleanup.js +2 -69
- package/dist/_internal/server/jobs/handlers/notificationPrune.js +2 -13
- package/dist/_internal/server/jobs/handlers/offerExpiry.js +2 -50
- package/dist/_internal/server/jobs/handlers/onBidPlaced.d.ts +1 -10
- package/dist/_internal/server/jobs/handlers/onBidPlaced.js +2 -56
- package/dist/_internal/server/jobs/handlers/onCategoryWrite.d.ts +1 -8
- package/dist/_internal/server/jobs/handlers/onCategoryWrite.js +6 -134
- package/dist/_internal/server/jobs/handlers/onOrderCreate.d.ts +1 -12
- package/dist/_internal/server/jobs/handlers/onOrderCreate.js +2 -76
- package/dist/_internal/server/jobs/handlers/onOrderStatusChange.d.ts +1 -12
- package/dist/_internal/server/jobs/handlers/onOrderStatusChange.js +2 -139
- package/dist/_internal/server/jobs/handlers/onProductStockChange.d.ts +0 -13
- package/dist/_internal/server/jobs/handlers/onProductStockChange.js +7 -134
- package/dist/_internal/server/jobs/handlers/onProductWrite.d.ts +1 -6
- package/dist/_internal/server/jobs/handlers/onProductWrite.js +6 -106
- package/dist/_internal/server/jobs/handlers/onReviewWrite.js +2 -49
- package/dist/_internal/server/jobs/handlers/onStoreWrite.d.ts +1 -8
- package/dist/_internal/server/jobs/handlers/onStoreWrite.js +7 -8
- package/dist/_internal/server/jobs/handlers/payoutBatch.d.ts +0 -9
- package/dist/_internal/server/jobs/handlers/payoutBatch.js +2 -104
- package/dist/_internal/server/jobs/handlers/pendingOrderTimeout.d.ts +0 -6
- package/dist/_internal/server/jobs/handlers/pendingOrderTimeout.js +2 -33
- package/dist/_internal/server/jobs/handlers/positionsReconcile.d.ts +0 -5
- package/dist/_internal/server/jobs/handlers/positionsReconcile.js +2 -87
- package/dist/_internal/server/jobs/handlers/prizeRevealClose.d.ts +0 -7
- package/dist/_internal/server/jobs/handlers/prizeRevealClose.js +2 -29
- package/dist/_internal/server/jobs/handlers/prizeRevealExpiry.d.ts +0 -8
- package/dist/_internal/server/jobs/handlers/prizeRevealExpiry.js +2 -58
- package/dist/_internal/server/jobs/handlers/prizeRevealOpen.d.ts +0 -8
- package/dist/_internal/server/jobs/handlers/prizeRevealOpen.js +2 -65
- package/dist/_internal/server/jobs/handlers/prizeRevealReminder.d.ts +0 -7
- package/dist/_internal/server/jobs/handlers/prizeRevealReminder.js +2 -45
- package/dist/_internal/server/jobs/handlers/productStatsSync.d.ts +0 -6
- package/dist/_internal/server/jobs/handlers/productStatsSync.js +2 -36
- package/dist/_internal/server/jobs/handlers/promotions.d.ts +2 -10
- package/dist/_internal/server/jobs/handlers/promotions.js +2 -43
- package/dist/_internal/server/jobs/handlers/storeAnalytics.d.ts +2 -28
- package/dist/_internal/server/jobs/handlers/storeAnalytics.js +2 -109
- package/dist/_internal/server/jobs/handlers/triggerEventRaffle.d.ts +1 -28
- package/dist/_internal/server/jobs/handlers/triggerEventRaffle.js +2 -94
- package/dist/_internal/server/jobs/handlers/weeklyPayoutEligibility.d.ts +0 -6
- package/dist/_internal/server/jobs/handlers/weeklyPayoutEligibility.js +2 -87
- package/dist/_internal/server/jobs/index.d.ts +1 -0
- package/dist/_internal/server/jobs/index.js +1 -0
- package/dist/_internal/server/jobs/runtime/adapters/firebase.js +21 -0
- package/dist/_internal/shared/actions/action-registry.d.ts +84 -0
- package/dist/_internal/shared/actions/action-registry.js +160 -0
- package/dist/_internal/shared/checkout/rules/_defaults.d.ts +3 -0
- package/dist/_internal/shared/checkout/rules/_defaults.js +22 -0
- package/dist/_internal/shared/checkout/rules/_limits.d.ts +19 -0
- package/dist/_internal/shared/checkout/rules/_limits.js +19 -0
- package/dist/_internal/shared/checkout/rules/_registry.d.ts +44 -0
- package/dist/_internal/shared/checkout/rules/_registry.js +87 -0
- package/dist/_internal/shared/checkout/rules/auction.rule.d.ts +2 -0
- package/dist/_internal/shared/checkout/rules/auction.rule.js +10 -0
- package/dist/_internal/shared/checkout/rules/bundle.rule.d.ts +11 -0
- package/dist/_internal/shared/checkout/rules/bundle.rule.js +6 -0
- package/dist/_internal/shared/checkout/rules/classified.rule.d.ts +9 -0
- package/dist/_internal/shared/checkout/rules/classified.rule.js +9 -0
- package/dist/_internal/shared/checkout/rules/digital-code.rule.d.ts +8 -0
- package/dist/_internal/shared/checkout/rules/digital-code.rule.js +6 -0
- package/dist/_internal/shared/checkout/rules/index.d.ts +12 -0
- package/dist/_internal/shared/checkout/rules/index.js +12 -0
- package/dist/_internal/shared/checkout/rules/live.rule.d.ts +10 -0
- package/dist/_internal/shared/checkout/rules/live.rule.js +6 -0
- package/dist/_internal/shared/checkout/rules/offer.rule.d.ts +2 -0
- package/dist/_internal/shared/checkout/rules/offer.rule.js +9 -0
- package/dist/_internal/shared/checkout/rules/preorder.rule.d.ts +2 -0
- package/dist/_internal/shared/checkout/rules/preorder.rule.js +28 -0
- package/dist/_internal/shared/checkout/rules/prize-draw.rule.d.ts +2 -0
- package/dist/_internal/shared/checkout/rules/prize-draw.rule.js +65 -0
- package/dist/_internal/shared/checkout/rules/standard.rule.d.ts +2 -0
- package/dist/_internal/shared/checkout/rules/standard.rule.js +5 -0
- package/dist/_internal/shared/checkout/rules/types.d.ts +125 -0
- package/dist/_internal/shared/checkout/rules/types.js +13 -0
- package/dist/_internal/shared/features/cart/schema.d.ts +6 -6
- package/dist/_internal/shared/features/categories/bundle-copy.d.ts +123 -0
- package/dist/_internal/shared/features/categories/bundle-copy.js +134 -0
- package/dist/_internal/shared/features/categories/bundle-schemas.d.ts +318 -0
- package/dist/_internal/shared/features/categories/bundle-schemas.js +55 -0
- package/dist/_internal/shared/features/events/schema.d.ts +4 -4
- package/dist/_internal/shared/features/orders/refund-copy.d.ts +36 -0
- package/dist/_internal/shared/features/orders/refund-copy.js +40 -0
- package/dist/_internal/shared/features/orders/schema.d.ts +4 -4
- package/dist/_internal/shared/features/products/schema.d.ts +8 -8
- package/dist/_internal/shared/listing-types/_registry.d.ts +27 -0
- package/dist/_internal/shared/listing-types/_registry.js +8 -0
- package/dist/_internal/shared/listing-types/action-tracker.d.ts +41 -0
- package/dist/_internal/shared/listing-types/action-tracker.js +70 -0
- package/dist/_internal/shared/listing-types/capabilities.js +25 -0
- package/dist/_internal/shared/listing-types/cart-shipping.d.ts +37 -0
- package/dist/_internal/shared/listing-types/cart-shipping.js +46 -0
- package/dist/_internal/shared/listing-types/classified/config.d.ts +7 -0
- package/dist/_internal/shared/listing-types/classified/config.js +8 -0
- package/dist/_internal/shared/listing-types/classified/ctas.d.ts +1 -0
- package/dist/_internal/shared/listing-types/classified/ctas.js +3 -0
- package/dist/_internal/shared/listing-types/classified/og.d.ts +1 -0
- package/dist/_internal/shared/listing-types/classified/og.js +1 -0
- package/dist/_internal/shared/listing-types/classified/schema.d.ts +1 -0
- package/dist/_internal/shared/listing-types/classified/schema.js +1 -0
- package/dist/_internal/shared/listing-types/classified/seed-factory.d.ts +1 -0
- package/dist/_internal/shared/listing-types/classified/seed-factory.js +1 -0
- package/dist/_internal/shared/listing-types/digital-code/config.d.ts +7 -0
- package/dist/_internal/shared/listing-types/digital-code/config.js +8 -0
- package/dist/_internal/shared/listing-types/digital-code/ctas.d.ts +1 -0
- package/dist/_internal/shared/listing-types/digital-code/ctas.js +3 -0
- package/dist/_internal/shared/listing-types/digital-code/og.d.ts +1 -0
- package/dist/_internal/shared/listing-types/digital-code/og.js +1 -0
- package/dist/_internal/shared/listing-types/digital-code/schema.d.ts +1 -0
- package/dist/_internal/shared/listing-types/digital-code/schema.js +1 -0
- package/dist/_internal/shared/listing-types/digital-code/seed-factory.d.ts +1 -0
- package/dist/_internal/shared/listing-types/digital-code/seed-factory.js +1 -0
- package/dist/_internal/shared/listing-types/feature-flags.d.ts +34 -0
- package/dist/_internal/shared/listing-types/feature-flags.js +45 -0
- package/dist/_internal/shared/listing-types/live/config.d.ts +7 -0
- package/dist/_internal/shared/listing-types/live/config.js +8 -0
- package/dist/_internal/shared/listing-types/live/ctas.d.ts +1 -0
- package/dist/_internal/shared/listing-types/live/ctas.js +3 -0
- package/dist/_internal/shared/listing-types/live/og.d.ts +1 -0
- package/dist/_internal/shared/listing-types/live/og.js +1 -0
- package/dist/_internal/shared/listing-types/live/schema.d.ts +1 -0
- package/dist/_internal/shared/listing-types/live/schema.js +1 -0
- package/dist/_internal/shared/listing-types/live/seed-factory.d.ts +1 -0
- package/dist/_internal/shared/listing-types/live/seed-factory.js +1 -0
- package/dist/_internal/shared/media/limits.js +8 -0
- package/dist/client.d.ts +10 -5
- package/dist/client.js +16 -3
- package/dist/configs/next.js +7 -0
- package/dist/constants/api-endpoints.d.ts +6 -0
- package/dist/constants/api-endpoints.js +4 -0
- package/dist/core/hooks/useSyncManager.js +13 -1
- package/dist/core/unit-of-work.d.ts +1 -1
- package/dist/core/unit-of-work.js +2 -2
- package/dist/features/account/actions/address-actions.d.ts +1 -1
- package/dist/features/account/actions/address-actions.js +15 -7
- package/dist/features/account/schemas/firestore.d.ts +8 -43
- package/dist/features/account/schemas/firestore.js +8 -54
- package/dist/features/account/schemas/index.d.ts +6 -6
- package/dist/features/account/server.d.ts +1 -1
- package/dist/features/account/server.js +3 -1
- package/dist/features/addresses/index.d.ts +2 -0
- package/dist/features/addresses/index.js +2 -0
- package/dist/features/addresses/repository/addresses.repository.d.ts +29 -0
- package/dist/features/addresses/repository/addresses.repository.js +157 -0
- package/dist/features/addresses/schemas/firestore.d.ts +53 -0
- package/dist/features/addresses/schemas/firestore.js +68 -0
- package/dist/features/{bundles → addresses}/schemas/index.d.ts +0 -1
- package/dist/features/{bundles → addresses}/schemas/index.js +0 -1
- package/dist/features/addresses/server.d.ts +2 -0
- package/dist/features/addresses/server.js +2 -0
- package/dist/features/admin/components/AdminAllEventEntriesView.js +4 -3
- package/dist/features/admin/components/AdminBidsView.js +4 -3
- package/dist/features/admin/components/AdminBlogView.js +8 -3
- package/dist/features/admin/components/AdminBundleEditorView.d.ts +9 -0
- package/dist/features/admin/components/AdminBundleEditorView.js +209 -0
- package/dist/features/admin/components/AdminBundlesView.d.ts +9 -0
- package/dist/features/admin/components/AdminBundlesView.js +59 -0
- package/dist/features/admin/components/AdminCartsView.js +13 -3
- package/dist/features/admin/components/AdminContactView.js +4 -3
- package/dist/features/admin/components/AdminCouponsView.js +32 -13
- package/dist/features/admin/components/AdminNewsletterView.js +4 -3
- package/dist/features/admin/components/AdminOrdersView.js +15 -7
- package/dist/features/admin/components/AdminPayoutsView.js +4 -3
- package/dist/features/admin/components/AdminPrizeDrawsView.d.ts +4 -0
- package/dist/features/admin/components/AdminPrizeDrawsView.js +135 -0
- package/dist/features/admin/components/AdminProductsView.js +6 -5
- package/dist/features/admin/components/AdminReviewsView.js +5 -4
- package/dist/features/admin/components/AdminStoresView.js +4 -3
- package/dist/features/admin/components/AdminUsersView.js +15 -5
- package/dist/features/admin/components/AdminWishlistsView.js +10 -1
- package/dist/features/admin/components/DataTable.d.ts +5 -1
- package/dist/features/admin/components/DataTable.js +24 -20
- package/dist/features/admin/components/index.d.ts +6 -0
- package/dist/features/admin/components/index.js +5 -0
- package/dist/features/admin/constants/filter-tabs.d.ts +435 -0
- package/dist/features/admin/constants/filter-tabs.js +216 -0
- package/dist/features/admin/hooks/useAdminListingData.d.ts +1 -0
- package/dist/features/admin/hooks/useAdminListingData.js +1 -0
- package/dist/features/admin/schemas/firestore.d.ts +15 -0
- package/dist/features/admin/schemas/firestore.js +18 -0
- package/dist/features/admin/types/product.types.d.ts +2 -2
- package/dist/features/auctions/components/AuctionCard.d.ts +4 -1
- package/dist/features/auctions/components/AuctionCard.js +5 -3
- package/dist/features/auctions/components/AuctionDetailPageView.js +1 -1
- package/dist/features/auctions/components/MarketplaceAuctionCard.d.ts +2 -2
- package/dist/features/auctions/components/PlaceBidFormClient.js +12 -2
- package/dist/features/auctions/schemas/index.d.ts +2 -2
- package/dist/features/auth/index.d.ts +1 -0
- package/dist/features/auth/index.js +1 -0
- package/dist/features/auth/role-predicates.d.ts +16 -0
- package/dist/features/auth/role-predicates.js +15 -0
- package/dist/features/blog/components/BlogFeaturedCard.d.ts +4 -1
- package/dist/features/blog/components/BlogFeaturedCard.js +5 -3
- package/dist/features/cart/actions/cart-actions.d.ts +1 -0
- package/dist/features/cart/actions/cart-actions.js +16 -0
- package/dist/features/cart/components/CartView.d.ts +19 -1
- package/dist/features/cart/components/CartView.js +2 -2
- package/dist/features/cart/components/ShippingPicker.d.ts +13 -0
- package/dist/features/cart/components/ShippingPicker.js +48 -0
- package/dist/features/cart/components/index.d.ts +3 -1
- package/dist/features/cart/components/index.js +1 -0
- package/dist/features/cart/hooks/useCartCount.js +7 -1
- package/dist/features/cart/repository/cart.repository.d.ts +1 -0
- package/dist/features/cart/repository/cart.repository.js +35 -0
- package/dist/features/cart/schemas/firestore.d.ts +27 -2
- package/dist/features/categories/components/BundleAddToCartCta.d.ts +16 -0
- package/dist/features/categories/components/BundleAddToCartCta.js +54 -0
- package/dist/features/categories/components/BundleBuyNowCta.d.ts +8 -0
- package/dist/features/categories/components/BundleBuyNowCta.js +37 -0
- package/dist/features/categories/components/BundleDetailView.d.ts +22 -0
- package/dist/features/categories/components/BundleDetailView.js +31 -0
- package/dist/features/categories/components/BundleDynamicRuleEditor.d.ts +18 -0
- package/dist/features/categories/components/BundleDynamicRuleEditor.js +60 -0
- package/dist/features/categories/components/BundleItemsPicker.d.ts +26 -0
- package/dist/features/categories/components/BundleItemsPicker.js +135 -0
- package/dist/features/categories/components/BundlesListView.d.ts +13 -0
- package/dist/features/categories/components/BundlesListView.js +27 -0
- package/dist/features/categories/components/index.d.ts +12 -0
- package/dist/features/categories/components/index.js +9 -0
- package/dist/features/checkout/actions/checkout-actions.js +10 -3
- package/dist/features/events/components/AdminEventEditorView.js +108 -2
- package/dist/features/events/components/AdminEventsView.js +16 -4
- package/dist/features/events/components/EventCard.d.ts +4 -1
- package/dist/features/events/components/EventCard.js +7 -3
- package/dist/features/events/components/EventRaffleWinnerView.d.ts +21 -0
- package/dist/features/events/components/EventRaffleWinnerView.js +18 -0
- package/dist/features/events/components/SpinWheelView.d.ts +27 -0
- package/dist/features/events/components/SpinWheelView.js +64 -0
- package/dist/features/events/components/index.d.ts +4 -0
- package/dist/features/events/components/index.js +2 -0
- package/dist/features/events/schemas/firestore.d.ts +27 -1
- package/dist/features/events/schemas/firestore.js +7 -0
- package/dist/features/events/types/index.d.ts +27 -1
- package/dist/features/homepage/components/FeaturedBundlesSection.d.ts +16 -0
- package/dist/features/homepage/components/FeaturedBundlesSection.js +24 -0
- package/dist/features/homepage/components/MarketplaceHomepageView.js +4 -1
- package/dist/features/homepage/components/WhatsAppCommunitySection.js +2 -2
- package/dist/features/homepage/lib/section-renderer.d.ts +2 -0
- package/dist/features/homepage/lib/section-renderer.js +5 -5
- package/dist/features/layout/NavbarLayout.d.ts +3 -1
- package/dist/features/layout/NavbarLayout.js +32 -3
- package/dist/features/layout/TitleBarLayout.d.ts +6 -3
- package/dist/features/layout/TitleBarLayout.js +22 -7
- package/dist/features/media/upload/MediaUploadField.d.ts +15 -1
- package/dist/features/media/upload/MediaUploadField.js +22 -1
- package/dist/features/orders/components/MarketplaceOrderCard.js +4 -2
- package/dist/features/orders/components/OrderSiblingPayments.d.ts +8 -0
- package/dist/features/orders/components/OrderSiblingPayments.js +16 -0
- package/dist/features/orders/components/RefundHistoryTable.d.ts +6 -0
- package/dist/features/orders/components/RefundHistoryTable.js +23 -0
- package/dist/features/orders/components/RefundRequestView.d.ts +8 -0
- package/dist/features/orders/components/RefundRequestView.js +42 -0
- package/dist/features/orders/components/index.d.ts +6 -0
- package/dist/features/orders/components/index.js +3 -0
- package/dist/features/orders/index.d.ts +1 -0
- package/dist/features/orders/index.js +2 -0
- package/dist/features/orders/repository/orders.repository.d.ts +20 -1
- package/dist/features/orders/repository/orders.repository.js +30 -1
- package/dist/features/orders/schemas/firestore.d.ts +63 -13
- package/dist/features/orders/schemas/firestore.js +5 -5
- package/dist/features/orders/schemas/index.d.ts +4 -4
- package/dist/features/orders/types/index.d.ts +12 -2
- package/dist/features/orders/utils/bundle-grouping.d.ts +48 -0
- package/dist/features/orders/utils/bundle-grouping.js +54 -0
- package/dist/features/orders/utils/order-splitter.d.ts +9 -10
- package/dist/features/orders/utils/order-splitter.js +24 -30
- package/dist/features/payments/repository/payout.repository.d.ts +17 -1
- package/dist/features/payments/repository/payout.repository.js +47 -0
- package/dist/features/payments/schemas/firestore.d.ts +26 -0
- package/dist/features/pre-orders/components/PreorderCard.d.ts +4 -1
- package/dist/features/pre-orders/components/PreorderCard.js +8 -6
- package/dist/features/products/actions/product-actions.d.ts +1 -1
- package/dist/features/products/actions/product-actions.js +1 -1
- package/dist/features/products/components/CompareOverlay.d.ts +2 -2
- package/dist/features/products/components/CompareOverlay.js +4 -4
- package/dist/features/products/components/InteractiveProductCard.js +7 -12
- package/dist/features/products/components/NonRefundableConsentModal.d.ts +1 -1
- package/dist/features/products/components/NonRefundableConsentModal.js +0 -10
- package/dist/features/products/components/ProductGrid.js +28 -12
- package/dist/features/products/components/ShowGroupSection.js +3 -3
- package/dist/features/products/components/SublistingCarouselSection.js +2 -2
- package/dist/features/products/components/index.d.ts +0 -4
- package/dist/features/products/components/index.js +5 -2
- package/dist/features/products/index.d.ts +1 -1
- package/dist/features/products/index.js +3 -1
- package/dist/features/products/repository/products.repository.js +4 -0
- package/dist/features/products/schemas/catalog-product.d.ts +70 -0
- package/dist/features/products/schemas/catalog-product.js +50 -0
- package/dist/features/products/schemas/firestore.d.ts +110 -2
- package/dist/features/products/schemas/firestore.js +30 -0
- package/dist/features/products/schemas/index.d.ts +8 -8
- package/dist/features/products/types/index.d.ts +1 -1
- package/dist/features/products/utils/listing-type.d.ts +9 -0
- package/dist/features/products/utils/listing-type.js +4 -0
- package/dist/features/promotions/actions/coupon-actions.d.ts +2 -2
- package/dist/features/promotions/actions/coupon-actions.js +1 -1
- package/dist/features/promotions/components/CouponCard.d.ts +28 -10
- package/dist/features/promotions/components/CouponCard.js +116 -14
- package/dist/features/promotions/hooks/useCouponValidate.d.ts +1 -1
- package/dist/features/promotions/repository/coupons.repository.d.ts +1 -1
- package/dist/features/reviews/schemas/index.d.ts +2 -2
- package/dist/features/search/schemas/index.d.ts +2 -2
- package/dist/features/search/types/index.d.ts +2 -2
- package/dist/features/seller/components/SellerAuctionsView.js +4 -5
- package/dist/features/seller/components/SellerBidsView.js +5 -13
- package/dist/features/seller/components/SellerCouponsView.js +31 -67
- package/dist/features/seller/components/SellerOffersView.js +4 -5
- package/dist/features/seller/components/SellerOrdersView.js +4 -5
- package/dist/features/seller/components/SellerPayoutsView.js +4 -5
- package/dist/features/seller/components/SellerPreOrdersView.d.ts +4 -0
- package/dist/features/seller/components/SellerPreOrdersView.js +141 -0
- package/dist/features/seller/components/SellerPrizeDrawsView.d.ts +4 -0
- package/dist/features/seller/components/SellerPrizeDrawsView.js +138 -0
- package/dist/features/seller/components/SellerProductsView.js +4 -8
- package/dist/features/seller/components/index.d.ts +4 -0
- package/dist/features/seller/components/index.js +2 -0
- package/dist/features/seller/schemas/index.d.ts +2 -2
- package/dist/features/stores/actions/store-address-actions.d.ts +10 -6
- package/dist/features/stores/actions/store-address-actions.js +8 -7
- package/dist/features/stores/components/InteractiveStoreCard.js +3 -10
- package/dist/features/stores/components/StoreDetailLayoutView.js +20 -5
- package/dist/features/stores/schemas/firestore.d.ts +45 -38
- package/dist/features/stores/schemas/firestore.js +2 -49
- package/dist/features/stores/server.d.ts +0 -1
- package/dist/features/stores/server.js +2 -1
- package/dist/features/wishlist/hooks/useWishlistCount.d.ts +7 -9
- package/dist/features/wishlist/hooks/useWishlistCount.js +67 -86
- package/dist/features/wishlist/types/index.d.ts +1 -1
- package/dist/index.d.ts +56 -9
- package/dist/index.js +66 -11
- package/dist/next/routing/route-map.d.ts +6 -0
- package/dist/next/routing/route-map.js +4 -0
- package/dist/providers/db-firebase/admin.d.ts +6 -2
- package/dist/providers/db-firebase/admin.js +23 -0
- package/dist/repositories/index.d.ts +1 -2
- package/dist/repositories/index.js +5 -2
- package/dist/security/authorization.d.ts +2 -1
- package/dist/security/authorization.js +3 -2
- package/dist/seed/actions/demo-seed-actions.d.ts +1 -1
- package/dist/seed/bids-seed-data.d.ts +2 -2
- package/dist/seed/bids-seed-data.js +77 -2
- package/dist/seed/cart-seed-data.d.ts +10 -10
- package/dist/seed/cart-seed-data.js +15 -15
- package/dist/seed/events-seed-data.js +77 -0
- package/dist/seed/manifest.js +16 -8
- package/dist/seed/orders-seed-data.js +41 -2
- package/dist/seed/payouts-seed-data.js +18 -2
- package/dist/seed/stores-seed-data.js +55 -0
- package/dist/server-entry.d.ts +1 -0
- package/dist/server-entry.js +2 -0
- package/dist/server.d.ts +4 -0
- package/dist/server.js +8 -0
- package/dist/tailwind-utilities.css +1 -1
- package/dist/ui/components/FilterChipGroup.d.ts +39 -0
- package/dist/ui/components/FilterChipGroup.js +15 -0
- package/dist/ui/components/HorizontalScroller.js +32 -7
- package/dist/ui/components/HorizontalScroller.style.css +6 -0
- package/dist/ui/components/SiteLogo.js +1 -1
- package/dist/ui/index.d.ts +2 -0
- package/dist/ui/index.js +2 -0
- package/dist/utils/id-generators.d.ts +11 -0
- package/dist/utils/id-generators.js +16 -0
- package/package.json +1 -1
- package/dist/_internal/shared/features/bundles/config.d.ts +0 -6
- package/dist/_internal/shared/features/bundles/config.js +0 -6
- package/dist/_internal/shared/schema-versions.d.ts +0 -76
- package/dist/_internal/shared/schema-versions.js +0 -82
- package/dist/features/account/migrations.d.ts +0 -2
- package/dist/features/account/migrations.js +0 -10
- package/dist/features/admin/migrations.d.ts +0 -2
- package/dist/features/admin/migrations.js +0 -10
- package/dist/features/auctions/migrations.d.ts +0 -2
- package/dist/features/auctions/migrations.js +0 -10
- package/dist/features/auth/migrations.d.ts +0 -2
- package/dist/features/auth/migrations.js +0 -10
- package/dist/features/blog/migrations.d.ts +0 -2
- package/dist/features/blog/migrations.js +0 -10
- package/dist/features/brands/actions/brand-actions.d.ts +0 -2
- package/dist/features/brands/actions/brand-actions.js +0 -5
- package/dist/features/brands/index.d.ts +0 -3
- package/dist/features/brands/index.js +0 -3
- package/dist/features/brands/migrations.d.ts +0 -2
- package/dist/features/brands/migrations.js +0 -10
- package/dist/features/brands/repository/brands.repository.d.ts +0 -13
- package/dist/features/brands/repository/brands.repository.js +0 -60
- package/dist/features/brands/schemas/index.d.ts +0 -33
- package/dist/features/brands/schemas/index.js +0 -15
- package/dist/features/brands/server.d.ts +0 -7
- package/dist/features/brands/server.js +0 -7
- package/dist/features/bundles/components/AdminBundleEditorView.d.ts +0 -8
- package/dist/features/bundles/components/AdminBundleEditorView.js +0 -7
- package/dist/features/bundles/components/BundleDetailPageView.d.ts +0 -9
- package/dist/features/bundles/components/BundleDetailPageView.js +0 -45
- package/dist/features/bundles/components/BundleForm.d.ts +0 -12
- package/dist/features/bundles/components/BundleForm.js +0 -126
- package/dist/features/bundles/components/BundleItemsPicker.d.ts +0 -9
- package/dist/features/bundles/components/BundleItemsPicker.js +0 -77
- package/dist/features/bundles/components/BundlesByCategoryListing.d.ts +0 -6
- package/dist/features/bundles/components/BundlesByCategoryListing.js +0 -50
- package/dist/features/bundles/components/BundlesListingView.d.ts +0 -17
- package/dist/features/bundles/components/BundlesListingView.js +0 -50
- package/dist/features/bundles/components/FeaturedBundlesSection.d.ts +0 -5
- package/dist/features/bundles/components/FeaturedBundlesSection.js +0 -55
- package/dist/features/bundles/components/SellerBundleCreateView.d.ts +0 -8
- package/dist/features/bundles/components/SellerBundleCreateView.js +0 -7
- package/dist/features/bundles/components/SellerBundleEditView.d.ts +0 -9
- package/dist/features/bundles/components/SellerBundleEditView.js +0 -7
- package/dist/features/bundles/components/index.d.ts +0 -18
- package/dist/features/bundles/components/index.js +0 -9
- package/dist/features/bundles/constants/index.d.ts +0 -32
- package/dist/features/bundles/constants/index.js +0 -35
- package/dist/features/bundles/index.d.ts +0 -2
- package/dist/features/bundles/index.js +0 -2
- package/dist/features/bundles/migrations.d.ts +0 -2
- package/dist/features/bundles/migrations.js +0 -10
- package/dist/features/bundles/repository/bundles.repository.d.ts +0 -36
- package/dist/features/bundles/repository/bundles.repository.js +0 -148
- package/dist/features/bundles/repository/index.d.ts +0 -1
- package/dist/features/bundles/repository/index.js +0 -1
- package/dist/features/bundles/schemas/firestore.d.ts +0 -88
- package/dist/features/bundles/schemas/firestore.js +0 -29
- package/dist/features/bundles/schemas/zod.d.ts +0 -377
- package/dist/features/bundles/schemas/zod.js +0 -71
- package/dist/features/cart/migrations.d.ts +0 -2
- package/dist/features/cart/migrations.js +0 -10
- package/dist/features/categories/migrations.d.ts +0 -2
- package/dist/features/categories/migrations.js +0 -10
- package/dist/features/events/migrations.d.ts +0 -2
- package/dist/features/events/migrations.js +0 -10
- package/dist/features/faq/migrations.d.ts +0 -2
- package/dist/features/faq/migrations.js +0 -10
- package/dist/features/grouped/migrations.d.ts +0 -2
- package/dist/features/grouped/migrations.js +0 -10
- package/dist/features/history/migrations.d.ts +0 -2
- package/dist/features/history/migrations.js +0 -10
- package/dist/features/messages/migrations.d.ts +0 -2
- package/dist/features/messages/migrations.js +0 -10
- package/dist/features/orders/migrations.d.ts +0 -2
- package/dist/features/orders/migrations.js +0 -10
- package/dist/features/payments/migrations.d.ts +0 -2
- package/dist/features/payments/migrations.js +0 -10
- package/dist/features/products/migrations.d.ts +0 -2
- package/dist/features/products/migrations.js +0 -10
- package/dist/features/products/repository/sublisting-categories.repository.d.ts +0 -16
- package/dist/features/products/repository/sublisting-categories.repository.js +0 -126
- package/dist/features/products/schemas/sublisting-categories.d.ts +0 -45
- package/dist/features/products/schemas/sublisting-categories.js +0 -16
- package/dist/features/promotions/migrations.d.ts +0 -2
- package/dist/features/promotions/migrations.js +0 -10
- package/dist/features/reviews/migrations.d.ts +0 -2
- package/dist/features/reviews/migrations.js +0 -10
- package/dist/features/scams/migrations.d.ts +0 -2
- package/dist/features/scams/migrations.js +0 -10
- package/dist/features/seller/migrations.d.ts +0 -2
- package/dist/features/seller/migrations.js +0 -10
- package/dist/features/stores/migrations.d.ts +0 -2
- package/dist/features/stores/migrations.js +0 -10
- package/dist/features/sublisting/migrations.d.ts +0 -2
- package/dist/features/sublisting/migrations.js +0 -10
- package/dist/features/sublisting/schemas/firestore.d.ts +0 -32
- package/dist/features/sublisting/schemas/firestore.js +0 -19
- package/dist/features/support/migrations.d.ts +0 -2
- package/dist/features/support/migrations.js +0 -10
- package/dist/features/wishlist/migrations.d.ts +0 -2
- package/dist/features/wishlist/migrations.js +0 -10
- package/dist/seed/_bundle-constants.d.ts +0 -14
- package/dist/seed/_bundle-constants.js +0 -14
- package/dist/seed/anime-figures-seed-data.d.ts +0 -8
- package/dist/seed/anime-figures-seed-data.js +0 -1033
- package/dist/seed/beyblade-seed-data.d.ts +0 -7
- package/dist/seed/beyblade-seed-data.js +0 -1129
- package/dist/seed/brands-seed-data.d.ts +0 -7
- package/dist/seed/brands-seed-data.js +0 -410
- package/dist/seed/bundles-seed-data.d.ts +0 -13
- package/dist/seed/bundles-seed-data.js +0 -229
- package/dist/seed/cosplay-accessories-seed-data.d.ts +0 -8
- package/dist/seed/cosplay-accessories-seed-data.js +0 -647
- package/dist/seed/hot-wheels-seed-data.d.ts +0 -7
- package/dist/seed/hot-wheels-seed-data.js +0 -1612
- package/dist/seed/letitrip-official-seed-data.d.ts +0 -8
- package/dist/seed/letitrip-official-seed-data.js +0 -399
- package/dist/seed/pokemon-carousel-slides-seed-data.d.ts +0 -8
- package/dist/seed/pokemon-carousel-slides-seed-data.js +0 -322
- package/dist/seed/pokemon-categories-seed-data.d.ts +0 -24
- package/dist/seed/pokemon-categories-seed-data.js +0 -547
- package/dist/seed/pokemon-coupons-seed-data.d.ts +0 -6
- package/dist/seed/pokemon-coupons-seed-data.js +0 -465
- package/dist/seed/pokemon-homepage-sections-seed-data.d.ts +0 -7
- package/dist/seed/pokemon-homepage-sections-seed-data.js +0 -241
- package/dist/seed/pokemon-products-seed-data.d.ts +0 -9
- package/dist/seed/pokemon-products-seed-data.js +0 -1791
- package/dist/seed/pokemon-seed-bundle.d.ts +0 -47
- package/dist/seed/pokemon-seed-bundle.js +0 -71
- package/dist/seed/pokemon-stores-seed-data.d.ts +0 -6
- package/dist/seed/pokemon-stores-seed-data.js +0 -179
- package/dist/seed/pokemon-users-seed-data.d.ts +0 -6
- package/dist/seed/pokemon-users-seed-data.js +0 -521
- package/dist/seed/products-seed-data.d.ts +0 -6
- package/dist/seed/products-seed-data.js +0 -2530
- package/dist/seed/retro-gaming-seed-data.d.ts +0 -8
- package/dist/seed/retro-gaming-seed-data.js +0 -801
- package/dist/seed/server.d.ts +0 -2
- package/dist/seed/server.js +0 -7
- package/dist/seed/sublisting-categories-seed-data.d.ts +0 -7
- package/dist/seed/sublisting-categories-seed-data.js +0 -159
- package/dist/seed/transformers-seed-data.d.ts +0 -7
- package/dist/seed/transformers-seed-data.js +0 -530
|
@@ -3,8 +3,9 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
3
3
|
import React, { useState, useCallback } from "react";
|
|
4
4
|
import { X } from "lucide-react";
|
|
5
5
|
import { useUrlTable } from "../../../react/hooks/useUrlTable";
|
|
6
|
-
import { ListingToolbar, Pagination, ListingViewShell } from "../../../ui";
|
|
6
|
+
import { FilterChipGroup, ListingToolbar, Pagination, ListingViewShell } from "../../../ui";
|
|
7
7
|
import { SELLER_ENDPOINTS } from "../../../constants/api-endpoints";
|
|
8
|
+
import { ADMIN_PAYOUT_STATUS_TABS } from "../../admin/constants/filter-tabs";
|
|
8
9
|
import { toRecordArray, toRelativeDate, toRupees, toStringValue, useSellerListingData, } from "../hooks/useSellerListingData";
|
|
9
10
|
import { DataTable } from "../../admin/components/DataTable";
|
|
10
11
|
const PAGE_SIZE = 25;
|
|
@@ -14,7 +15,7 @@ const SORT_OPTIONS = [
|
|
|
14
15
|
{ value: "-createdAt", label: "Newest" },
|
|
15
16
|
{ value: "createdAt", label: "Oldest" },
|
|
16
17
|
];
|
|
17
|
-
const STATUS_OPTIONS =
|
|
18
|
+
const STATUS_OPTIONS = ADMIN_PAYOUT_STATUS_TABS;
|
|
18
19
|
export function SellerPayoutsView({ children, ...props }) {
|
|
19
20
|
const hasChildren = React.Children.count(children) > 0;
|
|
20
21
|
const table = useUrlTable({ defaults: { pageSize: String(PAGE_SIZE), sort: DEFAULT_SORT } });
|
|
@@ -74,7 +75,5 @@ export function SellerPayoutsView({ children, ...props }) {
|
|
|
74
75
|
if (hasChildren) {
|
|
75
76
|
return _jsx(ListingViewShell, { portal: "seller", ...props, children: children });
|
|
76
77
|
}
|
|
77
|
-
return (_jsxs("div", { className: "min-h-screen", children: [_jsx(ListingToolbar, { filterCount: activeFilterCount, onFiltersClick: openFilters, searchValue: searchInput, searchPlaceholder: "Search payouts by payout # or amount", onSearchChange: setSearchInput, onSearchCommit: commitSearch, sortValue: table.get("sort") || DEFAULT_SORT, sortOptions: SORT_OPTIONS, onSortChange: (v) => { table.set("sort", v); table.setPage(1); }, hideViewToggle: true, onResetAll: resetAll, hasActiveState: hasActiveState }), totalPages > 1 && (_jsx("div", { className: "sticky top-[calc(var(--header-height,0px)+44px)] z-10 flex justify-center bg-white/95 dark:bg-slate-900/95 backdrop-blur-sm border-b border-zinc-200 dark:border-slate-700 px-3 py-1.5", children: _jsx(Pagination, { currentPage: currentPage, totalPages: totalPages, onPageChange: (p) => table.setPage(p) }) })), _jsxs("div", { className: "py-4 px-3 sm:px-4", children: [errorMessage && (_jsx("div", { className: "mb-4 rounded-xl border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-700 dark:border-red-900/60 dark:bg-red-950/40 dark:text-red-200", children: errorMessage })), _jsx(DataTable, { rows: rows, isLoading: isLoading, emptyLabel: "No payouts found" })] }), filterOpen && (_jsxs(_Fragment, { children: [_jsx("div", { className: "fixed inset-0 z-40 bg-black/40", "aria-hidden": "true", onClick: () => setFilterOpen(false) }), _jsxs("div", { className: "fixed inset-y-0 left-0 z-50 flex w-80 flex-col bg-white dark:bg-slate-900 shadow-2xl", children: [_jsxs("div", { className: "flex items-center justify-between border-b border-zinc-200 dark:border-slate-700 px-4 py-3.5", children: [_jsx("span", { className: "text-base font-semibold text-zinc-900 dark:text-zinc-100", children: "Filters" }), _jsxs("div", { className: "flex items-center gap-2", children: [activeFilterCount > 0 && (_jsx("button", { type: "button", onClick: clearFilters, className: "text-xs text-zinc-500 hover:text-rose-500 dark:text-zinc-400 transition-colors", children: "Clear all" })), _jsx("button", { type: "button", onClick: () => setFilterOpen(false), "aria-label": "Close", className: "rounded-lg p-1.5 text-zinc-500 hover:bg-zinc-100 dark:hover:bg-slate-800 transition-colors", children: _jsx(X, { className: "h-5 w-5" }) })] })] }), _jsx("div", { className: "flex-1 overflow-y-auto px-4 py-4 space-y-5", children:
|
|
78
|
-
? "bg-primary text-white border-primary"
|
|
79
|
-
: "border-zinc-300 dark:border-slate-600 text-zinc-700 dark:text-zinc-300 hover:bg-zinc-50 dark:hover:bg-slate-800"}`, children: opt }, opt))) })] }) }), _jsx("div", { className: "border-t border-zinc-200 dark:border-slate-700 px-4 py-3.5", children: _jsxs("button", { type: "button", onClick: applyFilters, className: "w-full rounded-lg bg-primary py-2.5 text-sm font-semibold text-white hover:bg-primary-600 transition-colors active:scale-[0.98]", children: ["Apply Filters", activeFilterCount > 0 ? ` (${activeFilterCount})` : ""] }) })] })] }))] }));
|
|
78
|
+
return (_jsxs("div", { className: "min-h-screen", children: [_jsx(ListingToolbar, { filterCount: activeFilterCount, onFiltersClick: openFilters, searchValue: searchInput, searchPlaceholder: "Search payouts by payout # or amount", onSearchChange: setSearchInput, onSearchCommit: commitSearch, sortValue: table.get("sort") || DEFAULT_SORT, sortOptions: SORT_OPTIONS, onSortChange: (v) => { table.set("sort", v); table.setPage(1); }, hideViewToggle: true, onResetAll: resetAll, hasActiveState: hasActiveState }), totalPages > 1 && (_jsx("div", { className: "sticky top-[calc(var(--header-height,0px)+44px)] z-10 flex justify-center bg-white/95 dark:bg-slate-900/95 backdrop-blur-sm border-b border-zinc-200 dark:border-slate-700 px-3 py-1.5", children: _jsx(Pagination, { currentPage: currentPage, totalPages: totalPages, onPageChange: (p) => table.setPage(p) }) })), _jsxs("div", { className: "py-4 px-3 sm:px-4", children: [errorMessage && (_jsx("div", { className: "mb-4 rounded-xl border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-700 dark:border-red-900/60 dark:bg-red-950/40 dark:text-red-200", children: errorMessage })), _jsx(DataTable, { rows: rows, isLoading: isLoading, emptyLabel: "No payouts found" })] }), filterOpen && (_jsxs(_Fragment, { children: [_jsx("div", { className: "fixed inset-0 z-40 bg-black/40", "aria-hidden": "true", onClick: () => setFilterOpen(false) }), _jsxs("div", { className: "fixed inset-y-0 left-0 z-50 flex w-80 flex-col bg-white dark:bg-slate-900 shadow-2xl", children: [_jsxs("div", { className: "flex items-center justify-between border-b border-zinc-200 dark:border-slate-700 px-4 py-3.5", children: [_jsx("span", { className: "text-base font-semibold text-zinc-900 dark:text-zinc-100", children: "Filters" }), _jsxs("div", { className: "flex items-center gap-2", children: [activeFilterCount > 0 && (_jsx("button", { type: "button", onClick: clearFilters, className: "text-xs text-zinc-500 hover:text-rose-500 dark:text-zinc-400 transition-colors", children: "Clear all" })), _jsx("button", { type: "button", onClick: () => setFilterOpen(false), "aria-label": "Close", className: "rounded-lg p-1.5 text-zinc-500 hover:bg-zinc-100 dark:hover:bg-slate-800 transition-colors", children: _jsx(X, { className: "h-5 w-5" }) })] })] }), _jsx("div", { className: "flex-1 overflow-y-auto px-4 py-4 space-y-5", children: _jsx(FilterChipGroup, { label: "Status", tabs: STATUS_OPTIONS, value: pendingFilters.status ?? "", onChange: (id) => setPendingFilters((p) => ({ ...p, status: id })) }) }), _jsx("div", { className: "border-t border-zinc-200 dark:border-slate-700 px-4 py-3.5", children: _jsxs("button", { type: "button", onClick: applyFilters, className: "w-full rounded-lg bg-primary py-2.5 text-sm font-semibold text-white hover:bg-primary-600 transition-colors active:scale-[0.98]", children: ["Apply Filters", activeFilterCount > 0 ? ` (${activeFilterCount})` : ""] }) })] })] }))] }));
|
|
80
79
|
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ListingViewShellProps } from "../../../ui";
|
|
2
|
+
export interface SellerPreOrdersViewProps extends ListingViewShellProps {
|
|
3
|
+
}
|
|
4
|
+
export declare function SellerPreOrdersView({ children, ...props }: SellerPreOrdersViewProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import React, { useState, useCallback } from "react";
|
|
4
|
+
import { Pencil, X } from "lucide-react";
|
|
5
|
+
import { useUrlTable } from "../../../react/hooks/useUrlTable";
|
|
6
|
+
import { Alert, Badge, Button, FilterChipGroup, ListingToolbar, Pagination, ListingViewShell } from "../../../ui";
|
|
7
|
+
import { SELLER_ENDPOINTS } from "../../../constants/api-endpoints";
|
|
8
|
+
import { SELLER_PRE_ORDER_STATUS_TABS } from "../../admin/constants/filter-tabs";
|
|
9
|
+
import { ROUTES } from "../../../constants";
|
|
10
|
+
import { toRecordArray, toRelativeDate, toRupees, toStringValue, useSellerListingData, } from "../hooks/useSellerListingData";
|
|
11
|
+
import { DataTable } from "../../admin/components/DataTable";
|
|
12
|
+
import { useActionDispatch } from "../../../react/hooks/use-action-dispatch";
|
|
13
|
+
const PAGE_SIZE = 25;
|
|
14
|
+
const FILTER_KEYS = ["status"];
|
|
15
|
+
const DEFAULT_SORT = "-createdAt";
|
|
16
|
+
// Hardcoded sieve clause — this view only ever shows pre-orders.
|
|
17
|
+
const LISTING_TYPE_FILTER = "listingType==pre-order";
|
|
18
|
+
const SORT_OPTIONS = [
|
|
19
|
+
{ value: "-createdAt", label: "Newest" },
|
|
20
|
+
{ value: "createdAt", label: "Oldest" },
|
|
21
|
+
{ value: "title", label: "Title A–Z" },
|
|
22
|
+
{ value: "preorderAvailableDate", label: "Delivery Soon" },
|
|
23
|
+
];
|
|
24
|
+
const STATUS_OPTIONS = SELLER_PRE_ORDER_STATUS_TABS;
|
|
25
|
+
const PRE_ORDER_COLUMNS = [
|
|
26
|
+
{
|
|
27
|
+
key: "thumbnail",
|
|
28
|
+
header: "",
|
|
29
|
+
className: "w-12",
|
|
30
|
+
render: (row) => row.imageUrl ? (_jsx("img", { src: row.imageUrl, alt: "", className: "w-10 h-10 rounded-lg object-cover border border-[var(--appkit-color-border)]" })) : (_jsx("div", { className: "w-10 h-10 rounded-lg bg-[var(--appkit-color-surface-raised)] border border-[var(--appkit-color-border)] flex items-center justify-center", children: _jsx("span", { className: "text-xs text-[var(--appkit-color-text-faint)]", children: "\u2013" }) })),
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
key: "primary",
|
|
34
|
+
header: "Pre-order",
|
|
35
|
+
render: (row) => (_jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "font-medium text-[var(--appkit-color-text)] line-clamp-1", children: row.primary }), _jsx("span", { className: "text-xs text-[var(--appkit-color-text-muted)]", children: row.secondary })] })),
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
key: "price",
|
|
39
|
+
header: "Price",
|
|
40
|
+
className: "w-28 text-right",
|
|
41
|
+
render: (row) => (_jsx("span", { className: "text-sm font-medium text-[var(--appkit-color-text)]", children: row.price })),
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
key: "status",
|
|
45
|
+
header: "Status",
|
|
46
|
+
className: "w-28",
|
|
47
|
+
render: (row) => {
|
|
48
|
+
const variant = row.status === "active"
|
|
49
|
+
? "success"
|
|
50
|
+
: row.status === "draft"
|
|
51
|
+
? "default"
|
|
52
|
+
: row.status === "cancelled"
|
|
53
|
+
? "danger"
|
|
54
|
+
: "warning";
|
|
55
|
+
return _jsx(Badge, { variant: variant, children: row.status });
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
key: "deliveryDate",
|
|
60
|
+
header: "Est. Delivery",
|
|
61
|
+
className: "w-36",
|
|
62
|
+
render: (row) => (_jsx("span", { className: "text-xs text-[var(--appkit-color-text-muted)]", children: row.deliveryDate })),
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
key: "updatedAt",
|
|
66
|
+
header: "Updated",
|
|
67
|
+
className: "w-28",
|
|
68
|
+
render: (row) => (_jsx("span", { className: "text-xs text-[var(--appkit-color-text-muted)]", children: row.updatedAt })),
|
|
69
|
+
},
|
|
70
|
+
];
|
|
71
|
+
export function SellerPreOrdersView({ children, ...props }) {
|
|
72
|
+
const hasChildren = React.Children.count(children) > 0;
|
|
73
|
+
const dispatch = useActionDispatch();
|
|
74
|
+
const table = useUrlTable({ defaults: { pageSize: String(PAGE_SIZE), sort: DEFAULT_SORT } });
|
|
75
|
+
const [searchInput, setSearchInput] = useState(table.get("q") || "");
|
|
76
|
+
const [filterOpen, setFilterOpen] = useState(false);
|
|
77
|
+
const [pendingFilters, setPendingFilters] = useState(() => Object.fromEntries(FILTER_KEYS.map((k) => [k, table.get(k)])));
|
|
78
|
+
const openFilters = useCallback(() => {
|
|
79
|
+
setPendingFilters(Object.fromEntries(FILTER_KEYS.map((k) => [k, table.get(k)])));
|
|
80
|
+
setFilterOpen(true);
|
|
81
|
+
}, [table]);
|
|
82
|
+
const applyFilters = useCallback(() => {
|
|
83
|
+
const updates = { page: "1" };
|
|
84
|
+
for (const k of FILTER_KEYS)
|
|
85
|
+
updates[k] = pendingFilters[k] ?? "";
|
|
86
|
+
table.setMany(updates);
|
|
87
|
+
setFilterOpen(false);
|
|
88
|
+
}, [pendingFilters, table]);
|
|
89
|
+
const clearFilters = useCallback(() => {
|
|
90
|
+
setPendingFilters(Object.fromEntries(FILTER_KEYS.map((k) => [k, ""])));
|
|
91
|
+
}, []);
|
|
92
|
+
const resetAll = useCallback(() => {
|
|
93
|
+
const updates = { q: "", sort: "" };
|
|
94
|
+
for (const k of FILTER_KEYS)
|
|
95
|
+
updates[k] = "";
|
|
96
|
+
table.setMany(updates);
|
|
97
|
+
setSearchInput("");
|
|
98
|
+
}, [table]);
|
|
99
|
+
const commitSearch = useCallback(() => {
|
|
100
|
+
table.set("q", searchInput.trim());
|
|
101
|
+
}, [searchInput, table]);
|
|
102
|
+
const activeFilterCount = FILTER_KEYS.filter((k) => !!table.get(k)).length;
|
|
103
|
+
const hasActiveState = !!table.get("q") || table.get("sort") !== DEFAULT_SORT || activeFilterCount > 0;
|
|
104
|
+
const statusRaw = table.get("status");
|
|
105
|
+
const statusFilter = statusRaw && statusRaw !== "All" ? `status==${statusRaw}` : undefined;
|
|
106
|
+
const filters = [LISTING_TYPE_FILTER, statusFilter].filter(Boolean).join(",");
|
|
107
|
+
const { rows, total, isLoading, errorMessage } = useSellerListingData({
|
|
108
|
+
queryKey: ["seller", "pre-orders", "listing"],
|
|
109
|
+
endpoint: SELLER_ENDPOINTS.PRODUCTS,
|
|
110
|
+
page: table.getNumber("page", 1),
|
|
111
|
+
pageSize: PAGE_SIZE,
|
|
112
|
+
sorts: table.get("sort") || DEFAULT_SORT,
|
|
113
|
+
filters,
|
|
114
|
+
q: table.get("q") || undefined,
|
|
115
|
+
mapRows: (response) => toRecordArray(response.products).map((item, index) => {
|
|
116
|
+
const priceRaw = typeof item.price === "number" ? item.price : 0;
|
|
117
|
+
return {
|
|
118
|
+
id: toStringValue(item.id, `preorder-${index}`),
|
|
119
|
+
primary: toStringValue(item.title ?? item.name, "Untitled pre-order"),
|
|
120
|
+
secondary: toStringValue(item.condition, ""),
|
|
121
|
+
status: toStringValue(item.status, "draft"),
|
|
122
|
+
price: priceRaw ? toRupees(priceRaw) : "—",
|
|
123
|
+
deliveryDate: item.preorderAvailableDate
|
|
124
|
+
? toRelativeDate(item.preorderAvailableDate)
|
|
125
|
+
: "TBA",
|
|
126
|
+
updatedAt: toRelativeDate(item.updatedAt ?? item.createdAt),
|
|
127
|
+
imageUrl: toStringValue(item.mainImage ?? item.images?.[0], undefined),
|
|
128
|
+
};
|
|
129
|
+
}),
|
|
130
|
+
getTotal: (response, mappedRows) => typeof response.meta?.total === "number" ? response.meta.total : mappedRows.length,
|
|
131
|
+
});
|
|
132
|
+
const currentPage = table.getNumber("page", 1);
|
|
133
|
+
const totalPages = Math.ceil(total / PAGE_SIZE);
|
|
134
|
+
if (hasChildren) {
|
|
135
|
+
return (_jsx(ListingViewShell, { portal: "seller", ...props, children: children }));
|
|
136
|
+
}
|
|
137
|
+
return (_jsxs("div", { className: "min-h-screen", children: [_jsx(ListingToolbar, { filterCount: activeFilterCount, onFiltersClick: openFilters, searchValue: searchInput, searchPlaceholder: "Search pre-orders by name\u2026", onSearchChange: setSearchInput, onSearchCommit: commitSearch, sortValue: table.get("sort") || DEFAULT_SORT, sortOptions: SORT_OPTIONS, onSortChange: (v) => { table.set("sort", v); table.setPage(1); }, hideViewToggle: true, onResetAll: resetAll, hasActiveState: hasActiveState }), totalPages > 1 && (_jsx("div", { className: "sticky z-10 flex justify-center bg-[var(--appkit-color-surface)]/95 backdrop-blur-sm border-b border-[var(--appkit-color-border)] px-3 py-1.5", style: { top: "calc(var(--header-height, 0px) + 44px)" }, children: _jsx(Pagination, { currentPage: currentPage, totalPages: totalPages, onPageChange: (p) => table.setPage(p) }) })), _jsxs("div", { className: "py-4 px-3 sm:px-4", children: [errorMessage && (_jsx(Alert, { variant: "error", className: "mb-4", children: errorMessage })), _jsx(DataTable, { columns: PRE_ORDER_COLUMNS, rows: rows, isLoading: isLoading, emptyLabel: "No pre-orders listed yet", getRowHref: (row) => String(ROUTES.STORE.PRE_ORDERS_EDIT(row.id)), renderRowActions: (row) => (_jsx(Button, { variant: "ghost", size: "sm", onClick: (e) => {
|
|
138
|
+
e.stopPropagation();
|
|
139
|
+
void dispatch({ type: "NAVIGATE", href: String(ROUTES.STORE.PRE_ORDERS_EDIT(row.id)) });
|
|
140
|
+
}, "aria-label": "Edit", children: _jsx(Pencil, { className: "w-4 h-4" }) })) })] }), filterOpen && (_jsxs(_Fragment, { children: [_jsx("div", { className: "fixed inset-0 z-40 bg-black/40", "aria-hidden": "true", onClick: () => setFilterOpen(false) }), _jsxs("div", { className: "fixed inset-y-0 left-0 z-50 flex w-80 flex-col bg-[var(--appkit-color-surface)] shadow-2xl", children: [_jsxs("div", { className: "flex items-center justify-between border-b border-[var(--appkit-color-border)] px-4 py-3.5", children: [_jsx("span", { className: "text-base font-semibold text-[var(--appkit-color-text)]", children: "Filters" }), _jsxs("div", { className: "flex items-center gap-2", children: [activeFilterCount > 0 && (_jsx("button", { type: "button", onClick: clearFilters, className: "text-xs text-[var(--appkit-color-text-muted)] hover:text-[var(--appkit-color-error)] transition-colors", children: "Clear all" })), _jsx("button", { type: "button", onClick: () => setFilterOpen(false), "aria-label": "Close", className: "rounded-lg p-1.5 text-[var(--appkit-color-text-muted)] hover:bg-[var(--appkit-color-border-subtle)] transition-colors", children: _jsx(X, { className: "h-5 w-5" }) })] })] }), _jsx("div", { className: "flex-1 overflow-y-auto px-4 py-4 space-y-5", children: _jsx(FilterChipGroup, { label: "Status", tabs: STATUS_OPTIONS, value: pendingFilters.status ?? "", onChange: (id) => setPendingFilters((p) => ({ ...p, status: id })) }) }), _jsx("div", { className: "border-t border-[var(--appkit-color-border)] px-4 py-3.5", children: _jsxs("button", { type: "button", onClick: applyFilters, className: "w-full rounded-lg bg-[var(--appkit-color-primary)] py-2.5 text-sm font-semibold text-white hover:opacity-90 transition-opacity active:scale-[0.98]", children: ["Apply Filters", activeFilterCount > 0 ? ` (${activeFilterCount})` : ""] }) })] })] }))] }));
|
|
141
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ListingViewShellProps } from "../../../ui";
|
|
2
|
+
export interface SellerPrizeDrawsViewProps extends ListingViewShellProps {
|
|
3
|
+
}
|
|
4
|
+
export declare function SellerPrizeDrawsView({ children, ...props }: SellerPrizeDrawsViewProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import React, { useState, useCallback } from "react";
|
|
4
|
+
import { Pencil, X } from "lucide-react";
|
|
5
|
+
import { useUrlTable } from "../../../react/hooks/useUrlTable";
|
|
6
|
+
import { Alert, Badge, Button, FilterChipGroup, ListingToolbar, Pagination, ListingViewShell } from "../../../ui";
|
|
7
|
+
import { SELLER_ENDPOINTS } from "../../../constants/api-endpoints";
|
|
8
|
+
import { SELLER_PRIZE_DRAW_STATUS_TABS } from "../../admin/constants/filter-tabs";
|
|
9
|
+
import { ROUTES } from "../../../constants";
|
|
10
|
+
import { toRecordArray, toRelativeDate, toRupees, toStringValue, useSellerListingData, } from "../hooks/useSellerListingData";
|
|
11
|
+
import { DataTable } from "../../admin/components/DataTable";
|
|
12
|
+
import { useActionDispatch } from "../../../react/hooks/use-action-dispatch";
|
|
13
|
+
const PAGE_SIZE = 25;
|
|
14
|
+
const FILTER_KEYS = ["status"];
|
|
15
|
+
const DEFAULT_SORT = "-createdAt";
|
|
16
|
+
// Hardcoded sieve clause — this view only ever shows prize draws.
|
|
17
|
+
const LISTING_TYPE_FILTER = "listingType==prize-draw";
|
|
18
|
+
const SORT_OPTIONS = [
|
|
19
|
+
{ value: "-createdAt", label: "Newest" },
|
|
20
|
+
{ value: "createdAt", label: "Oldest" },
|
|
21
|
+
{ value: "title", label: "Title A–Z" },
|
|
22
|
+
{ value: "prizeDrawEndDate", label: "Draw Date Soon" },
|
|
23
|
+
];
|
|
24
|
+
const STATUS_OPTIONS = SELLER_PRIZE_DRAW_STATUS_TABS;
|
|
25
|
+
const STATUS_VARIANT = {
|
|
26
|
+
active: "success",
|
|
27
|
+
draft: "default",
|
|
28
|
+
ended: "secondary",
|
|
29
|
+
cancelled: "danger",
|
|
30
|
+
};
|
|
31
|
+
const PRIZE_DRAW_COLUMNS = [
|
|
32
|
+
{
|
|
33
|
+
key: "thumbnail",
|
|
34
|
+
header: "",
|
|
35
|
+
className: "w-12",
|
|
36
|
+
render: (row) => row.imageUrl ? (_jsx("img", { src: row.imageUrl, alt: "", className: "w-10 h-10 rounded-lg object-cover border border-[var(--appkit-color-border)]" })) : (_jsx("div", { className: "w-10 h-10 rounded-lg bg-[var(--appkit-color-surface-raised)] border border-[var(--appkit-color-border)] flex items-center justify-center", children: _jsx("span", { className: "text-xs text-[var(--appkit-color-text-faint)]", children: "\u2013" }) })),
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
key: "primary",
|
|
40
|
+
header: "Prize Draw",
|
|
41
|
+
render: (row) => (_jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "font-medium text-[var(--appkit-color-text)] line-clamp-1", children: row.primary }), _jsx("span", { className: "text-xs text-[var(--appkit-color-text-muted)]", children: row.secondary })] })),
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
key: "entryFee",
|
|
45
|
+
header: "Entry Fee",
|
|
46
|
+
className: "w-28 text-right",
|
|
47
|
+
render: (row) => (_jsx("span", { className: "text-sm font-medium text-[var(--appkit-color-text)]", children: row.entryFee })),
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
key: "status",
|
|
51
|
+
header: "Status",
|
|
52
|
+
className: "w-28",
|
|
53
|
+
render: (row) => (_jsx(Badge, { variant: STATUS_VARIANT[row.status] ?? "default", children: row.status })),
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
key: "drawDate",
|
|
57
|
+
header: "Draw Date",
|
|
58
|
+
className: "w-32",
|
|
59
|
+
render: (row) => (_jsx("span", { className: "text-xs text-[var(--appkit-color-text-muted)]", children: row.drawDate })),
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
key: "updatedAt",
|
|
63
|
+
header: "Updated",
|
|
64
|
+
className: "w-28",
|
|
65
|
+
render: (row) => (_jsx("span", { className: "text-xs text-[var(--appkit-color-text-muted)]", children: row.updatedAt })),
|
|
66
|
+
},
|
|
67
|
+
];
|
|
68
|
+
export function SellerPrizeDrawsView({ children, ...props }) {
|
|
69
|
+
const hasChildren = React.Children.count(children) > 0;
|
|
70
|
+
const dispatch = useActionDispatch();
|
|
71
|
+
const table = useUrlTable({ defaults: { pageSize: String(PAGE_SIZE), sort: DEFAULT_SORT } });
|
|
72
|
+
const [searchInput, setSearchInput] = useState(table.get("q") || "");
|
|
73
|
+
const [filterOpen, setFilterOpen] = useState(false);
|
|
74
|
+
const [pendingFilters, setPendingFilters] = useState(() => Object.fromEntries(FILTER_KEYS.map((k) => [k, table.get(k)])));
|
|
75
|
+
const openFilters = useCallback(() => {
|
|
76
|
+
setPendingFilters(Object.fromEntries(FILTER_KEYS.map((k) => [k, table.get(k)])));
|
|
77
|
+
setFilterOpen(true);
|
|
78
|
+
}, [table]);
|
|
79
|
+
const applyFilters = useCallback(() => {
|
|
80
|
+
const updates = { page: "1" };
|
|
81
|
+
for (const k of FILTER_KEYS)
|
|
82
|
+
updates[k] = pendingFilters[k] ?? "";
|
|
83
|
+
table.setMany(updates);
|
|
84
|
+
setFilterOpen(false);
|
|
85
|
+
}, [pendingFilters, table]);
|
|
86
|
+
const clearFilters = useCallback(() => {
|
|
87
|
+
setPendingFilters(Object.fromEntries(FILTER_KEYS.map((k) => [k, ""])));
|
|
88
|
+
}, []);
|
|
89
|
+
const resetAll = useCallback(() => {
|
|
90
|
+
const updates = { q: "", sort: "" };
|
|
91
|
+
for (const k of FILTER_KEYS)
|
|
92
|
+
updates[k] = "";
|
|
93
|
+
table.setMany(updates);
|
|
94
|
+
setSearchInput("");
|
|
95
|
+
}, [table]);
|
|
96
|
+
const commitSearch = useCallback(() => {
|
|
97
|
+
table.set("q", searchInput.trim());
|
|
98
|
+
}, [searchInput, table]);
|
|
99
|
+
const activeFilterCount = FILTER_KEYS.filter((k) => !!table.get(k)).length;
|
|
100
|
+
const hasActiveState = !!table.get("q") || table.get("sort") !== DEFAULT_SORT || activeFilterCount > 0;
|
|
101
|
+
const statusRaw = table.get("status");
|
|
102
|
+
const statusFilter = statusRaw && statusRaw !== "All" ? `status==${statusRaw}` : undefined;
|
|
103
|
+
const filters = [LISTING_TYPE_FILTER, statusFilter].filter(Boolean).join(",");
|
|
104
|
+
const { rows, total, isLoading, errorMessage } = useSellerListingData({
|
|
105
|
+
queryKey: ["seller", "prize-draws", "listing"],
|
|
106
|
+
endpoint: SELLER_ENDPOINTS.PRODUCTS,
|
|
107
|
+
page: table.getNumber("page", 1),
|
|
108
|
+
pageSize: PAGE_SIZE,
|
|
109
|
+
sorts: table.get("sort") || DEFAULT_SORT,
|
|
110
|
+
filters,
|
|
111
|
+
q: table.get("q") || undefined,
|
|
112
|
+
mapRows: (response) => toRecordArray(response.products).map((item, index) => {
|
|
113
|
+
const priceRaw = typeof item.price === "number" ? item.price : 0;
|
|
114
|
+
return {
|
|
115
|
+
id: toStringValue(item.id, `prize-draw-${index}`),
|
|
116
|
+
primary: toStringValue(item.title ?? item.name, "Untitled prize draw"),
|
|
117
|
+
secondary: toStringValue(item.condition, ""),
|
|
118
|
+
status: toStringValue(item.status, "draft"),
|
|
119
|
+
entryFee: priceRaw ? toRupees(priceRaw) : "Free",
|
|
120
|
+
drawDate: item.prizeDrawEndDate
|
|
121
|
+
? toRelativeDate(item.prizeDrawEndDate)
|
|
122
|
+
: "TBA",
|
|
123
|
+
updatedAt: toRelativeDate(item.updatedAt ?? item.createdAt),
|
|
124
|
+
imageUrl: toStringValue(item.mainImage ?? item.images?.[0], undefined),
|
|
125
|
+
};
|
|
126
|
+
}),
|
|
127
|
+
getTotal: (response, mappedRows) => typeof response.meta?.total === "number" ? response.meta.total : mappedRows.length,
|
|
128
|
+
});
|
|
129
|
+
const currentPage = table.getNumber("page", 1);
|
|
130
|
+
const totalPages = Math.ceil(total / PAGE_SIZE);
|
|
131
|
+
if (hasChildren) {
|
|
132
|
+
return (_jsx(ListingViewShell, { portal: "seller", ...props, children: children }));
|
|
133
|
+
}
|
|
134
|
+
return (_jsxs("div", { className: "min-h-screen", children: [_jsx(ListingToolbar, { filterCount: activeFilterCount, onFiltersClick: openFilters, searchValue: searchInput, searchPlaceholder: "Search prize draws by name\u2026", onSearchChange: setSearchInput, onSearchCommit: commitSearch, sortValue: table.get("sort") || DEFAULT_SORT, sortOptions: SORT_OPTIONS, onSortChange: (v) => { table.set("sort", v); table.setPage(1); }, hideViewToggle: true, onResetAll: resetAll, hasActiveState: hasActiveState }), totalPages > 1 && (_jsx("div", { className: "sticky z-10 flex justify-center bg-[var(--appkit-color-surface)]/95 backdrop-blur-sm border-b border-[var(--appkit-color-border)] px-3 py-1.5", style: { top: "calc(var(--header-height, 0px) + 44px)" }, children: _jsx(Pagination, { currentPage: currentPage, totalPages: totalPages, onPageChange: (p) => table.setPage(p) }) })), _jsxs("div", { className: "py-4 px-3 sm:px-4", children: [errorMessage && (_jsx(Alert, { variant: "error", className: "mb-4", children: errorMessage })), _jsx(DataTable, { columns: PRIZE_DRAW_COLUMNS, rows: rows, isLoading: isLoading, emptyLabel: "No prize draws listed yet", getRowHref: (row) => String(ROUTES.STORE.PRIZE_DRAWS_EDIT(row.id)), renderRowActions: (row) => (_jsx(Button, { variant: "ghost", size: "sm", onClick: (e) => {
|
|
135
|
+
e.stopPropagation();
|
|
136
|
+
void dispatch({ type: "NAVIGATE", href: String(ROUTES.STORE.PRIZE_DRAWS_EDIT(row.id)) });
|
|
137
|
+
}, "aria-label": "Edit", children: _jsx(Pencil, { className: "w-4 h-4" }) })) })] }), filterOpen && (_jsxs(_Fragment, { children: [_jsx("div", { className: "fixed inset-0 z-40 bg-black/40", "aria-hidden": "true", onClick: () => setFilterOpen(false) }), _jsxs("div", { className: "fixed inset-y-0 left-0 z-50 flex w-80 flex-col bg-[var(--appkit-color-surface)] shadow-2xl", children: [_jsxs("div", { className: "flex items-center justify-between border-b border-[var(--appkit-color-border)] px-4 py-3.5", children: [_jsx("span", { className: "text-base font-semibold text-[var(--appkit-color-text)]", children: "Filters" }), _jsxs("div", { className: "flex items-center gap-2", children: [activeFilterCount > 0 && (_jsx("button", { type: "button", onClick: clearFilters, className: "text-xs text-[var(--appkit-color-text-muted)] hover:text-[var(--appkit-color-error)] transition-colors", children: "Clear all" })), _jsx("button", { type: "button", onClick: () => setFilterOpen(false), "aria-label": "Close", className: "rounded-lg p-1.5 text-[var(--appkit-color-text-muted)] hover:bg-[var(--appkit-color-border-subtle)] transition-colors", children: _jsx(X, { className: "h-5 w-5" }) })] })] }), _jsx("div", { className: "flex-1 overflow-y-auto px-4 py-4 space-y-5", children: _jsx(FilterChipGroup, { label: "Status", tabs: STATUS_OPTIONS, value: pendingFilters.status ?? "", onChange: (id) => setPendingFilters((p) => ({ ...p, status: id })) }) }), _jsx("div", { className: "border-t border-[var(--appkit-color-border)] px-4 py-3.5", children: _jsxs("button", { type: "button", onClick: applyFilters, className: "w-full rounded-lg bg-[var(--appkit-color-primary)] py-2.5 text-sm font-semibold text-white hover:opacity-90 transition-opacity active:scale-[0.98]", children: ["Apply Filters", activeFilterCount > 0 ? ` (${activeFilterCount})` : ""] }) })] })] }))] }));
|
|
138
|
+
}
|
|
@@ -4,8 +4,9 @@ import React, { useState, useCallback } from "react";
|
|
|
4
4
|
import { useActionDispatch } from "../../../react/hooks/use-action-dispatch";
|
|
5
5
|
import { X, Pencil, Trash2 } from "lucide-react";
|
|
6
6
|
import { useUrlTable } from "../../../react/hooks/useUrlTable";
|
|
7
|
-
import { Alert, ListingToolbar, Pagination, ListingViewShell, Badge, Button } from "../../../ui";
|
|
7
|
+
import { Alert, FilterChipGroup, ListingToolbar, Pagination, ListingViewShell, Badge, Button } from "../../../ui";
|
|
8
8
|
import { SELLER_ENDPOINTS } from "../../../constants/api-endpoints";
|
|
9
|
+
import { SELLER_PRODUCT_STATUS_TABS } from "../../admin/constants/filter-tabs";
|
|
9
10
|
import { ROUTES } from "../../../constants";
|
|
10
11
|
import { normalizeListingType } from "../../products/utils/listing-type";
|
|
11
12
|
import { toRecordArray, toRelativeDate, toStringValue, useSellerListingData, } from "../hooks/useSellerListingData";
|
|
@@ -21,7 +22,7 @@ const SORT_OPTIONS = [
|
|
|
21
22
|
{ value: "-price", label: "Price High" },
|
|
22
23
|
{ value: "price", label: "Price Low" },
|
|
23
24
|
];
|
|
24
|
-
const STATUS_OPTIONS =
|
|
25
|
+
const STATUS_OPTIONS = SELLER_PRODUCT_STATUS_TABS;
|
|
25
26
|
function TypeChips({ active, onChange, }) {
|
|
26
27
|
const chips = [
|
|
27
28
|
{ kind: "all", label: "All" },
|
|
@@ -210,10 +211,5 @@ export function SellerProductsView({ onDeleteProduct, children, ...props }) {
|
|
|
210
211
|
? String(ROUTES.STORE.PRIZE_DRAWS_EDIT(row.id))
|
|
211
212
|
: String(ROUTES.STORE.PRODUCTS_EDIT(row.id)), renderRowActions: onDeleteProduct
|
|
212
213
|
? (row) => (_jsxs("div", { className: "flex items-center gap-1", children: [_jsx(Button, { variant: "ghost", size: "sm", onClick: (e) => { e.stopPropagation(); handleEdit(row); }, "aria-label": "Edit", children: _jsx(Pencil, { className: "w-4 h-4" }) }), _jsx(Button, { variant: "ghost", size: "sm", onClick: (e) => { e.stopPropagation(); void handleDelete(row); }, disabled: deletingId === row.id, "aria-label": "Delete", className: "text-[var(--appkit-color-error)] hover:bg-[var(--appkit-color-border-subtle)]", children: _jsx(Trash2, { className: "w-4 h-4" }) })] }))
|
|
213
|
-
: undefined })] }), filterOpen && (_jsxs(_Fragment, { children: [_jsx("div", { className: "fixed inset-0 z-40 bg-black/40", "aria-hidden": "true", onClick: () => setFilterOpen(false) }), _jsxs("div", { className: "fixed inset-y-0 left-0 z-50 flex w-80 flex-col bg-[var(--appkit-color-surface)] shadow-2xl", children: [_jsxs("div", { className: "flex items-center justify-between border-b border-[var(--appkit-color-border)] px-4 py-3.5", children: [_jsx("span", { className: "text-base font-semibold text-[var(--appkit-color-text)]", children: "Filters" }), _jsxs("div", { className: "flex items-center gap-2", children: [activeFilterCount > 0 && (_jsx("button", { type: "button", onClick: clearFilters, className: "text-xs text-[var(--appkit-color-text-muted)] hover:text-[var(--appkit-color-error)] transition-colors", children: "Clear all" })), _jsx("button", { type: "button", onClick: () => setFilterOpen(false), "aria-label": "Close", className: "rounded-lg p-1.5 text-[var(--appkit-color-text-muted)] hover:bg-[var(--appkit-color-border-subtle)] transition-colors", children: _jsx(X, { className: "h-5 w-5" }) })] })] }), _jsx("div", { className: "flex-1 overflow-y-auto px-4 py-4 space-y-5", children:
|
|
214
|
-
"rounded-full px-3 py-1 text-xs font-medium border transition-colors",
|
|
215
|
-
(pendingFilters.status || "All") === opt
|
|
216
|
-
? "bg-[var(--appkit-color-primary)] text-white border-[var(--appkit-color-primary)]"
|
|
217
|
-
: "border-[var(--appkit-color-border)] text-[var(--appkit-color-text-muted)] hover:bg-[var(--appkit-color-border-subtle)]",
|
|
218
|
-
].join(" "), children: opt }, opt))) })] }) }), _jsx("div", { className: "border-t border-[var(--appkit-color-border)] px-4 py-3.5", children: _jsxs("button", { type: "button", onClick: applyFilters, className: "w-full rounded-lg bg-[var(--appkit-color-primary)] py-2.5 text-sm font-semibold text-white hover:opacity-90 transition-opacity active:scale-[0.98]", children: ["Apply Filters", activeFilterCount > 0 ? ` (${activeFilterCount})` : ""] }) })] })] }))] }) }));
|
|
214
|
+
: undefined })] }), filterOpen && (_jsxs(_Fragment, { children: [_jsx("div", { className: "fixed inset-0 z-40 bg-black/40", "aria-hidden": "true", onClick: () => setFilterOpen(false) }), _jsxs("div", { className: "fixed inset-y-0 left-0 z-50 flex w-80 flex-col bg-[var(--appkit-color-surface)] shadow-2xl", children: [_jsxs("div", { className: "flex items-center justify-between border-b border-[var(--appkit-color-border)] px-4 py-3.5", children: [_jsx("span", { className: "text-base font-semibold text-[var(--appkit-color-text)]", children: "Filters" }), _jsxs("div", { className: "flex items-center gap-2", children: [activeFilterCount > 0 && (_jsx("button", { type: "button", onClick: clearFilters, className: "text-xs text-[var(--appkit-color-text-muted)] hover:text-[var(--appkit-color-error)] transition-colors", children: "Clear all" })), _jsx("button", { type: "button", onClick: () => setFilterOpen(false), "aria-label": "Close", className: "rounded-lg p-1.5 text-[var(--appkit-color-text-muted)] hover:bg-[var(--appkit-color-border-subtle)] transition-colors", children: _jsx(X, { className: "h-5 w-5" }) })] })] }), _jsx("div", { className: "flex-1 overflow-y-auto px-4 py-4 space-y-5", children: _jsx(FilterChipGroup, { label: "Status", tabs: STATUS_OPTIONS, value: pendingFilters.status ?? "", onChange: (id) => setPendingFilters((p) => ({ ...p, status: id })) }) }), _jsx("div", { className: "border-t border-[var(--appkit-color-border)] px-4 py-3.5", children: _jsxs("button", { type: "button", onClick: applyFilters, className: "w-full rounded-lg bg-[var(--appkit-color-primary)] py-2.5 text-sm font-semibold text-white hover:opacity-90 transition-opacity active:scale-[0.98]", children: ["Apply Filters", activeFilterCount > 0 ? ` (${activeFilterCount})` : ""] }) })] })] }))] }) }));
|
|
219
215
|
}
|
|
@@ -7,6 +7,10 @@ export { SellerProductsView } from "./SellerProductsView";
|
|
|
7
7
|
export type { SellerProductsViewProps } from "./SellerProductsView";
|
|
8
8
|
export { SellerAuctionsView } from "./SellerAuctionsView";
|
|
9
9
|
export type { SellerAuctionsViewProps } from "./SellerAuctionsView";
|
|
10
|
+
export { SellerPreOrdersView } from "./SellerPreOrdersView";
|
|
11
|
+
export type { SellerPreOrdersViewProps } from "./SellerPreOrdersView";
|
|
12
|
+
export { SellerPrizeDrawsView } from "./SellerPrizeDrawsView";
|
|
13
|
+
export type { SellerPrizeDrawsViewProps } from "./SellerPrizeDrawsView";
|
|
10
14
|
export { SellerOrdersView } from "./SellerOrdersView";
|
|
11
15
|
export type { SellerOrdersViewProps } from "./SellerOrdersView";
|
|
12
16
|
export { SellerOffersView } from "./SellerOffersView";
|
|
@@ -3,6 +3,8 @@ export { SellerSidebar } from "./SellerSidebar";
|
|
|
3
3
|
export { SellerDashboardView } from "./SellerDashboardView";
|
|
4
4
|
export { SellerProductsView } from "./SellerProductsView";
|
|
5
5
|
export { SellerAuctionsView } from "./SellerAuctionsView";
|
|
6
|
+
export { SellerPreOrdersView } from "./SellerPreOrdersView";
|
|
7
|
+
export { SellerPrizeDrawsView } from "./SellerPrizeDrawsView";
|
|
6
8
|
export { SellerOrdersView } from "./SellerOrdersView";
|
|
7
9
|
export { SellerOffersView } from "./SellerOffersView";
|
|
8
10
|
export { SellerOffersPanel } from "./SellerOffersPanel";
|
|
@@ -102,7 +102,6 @@ export declare const sellerStoreSchema: z.ZodObject<{
|
|
|
102
102
|
} | undefined;
|
|
103
103
|
returnPolicy?: string | undefined;
|
|
104
104
|
website?: string | undefined;
|
|
105
|
-
bio?: string | undefined;
|
|
106
105
|
socialLinks?: {
|
|
107
106
|
instagram?: string | undefined;
|
|
108
107
|
facebook?: string | undefined;
|
|
@@ -113,6 +112,7 @@ export declare const sellerStoreSchema: z.ZodObject<{
|
|
|
113
112
|
storeCategory?: string | undefined;
|
|
114
113
|
storeLogoURL?: string | undefined;
|
|
115
114
|
storeBannerURL?: string | undefined;
|
|
115
|
+
bio?: string | undefined;
|
|
116
116
|
shippingPolicy?: string | undefined;
|
|
117
117
|
isVacationMode?: boolean | undefined;
|
|
118
118
|
vacationMessage?: string | undefined;
|
|
@@ -134,7 +134,6 @@ export declare const sellerStoreSchema: z.ZodObject<{
|
|
|
134
134
|
} | undefined;
|
|
135
135
|
returnPolicy?: string | undefined;
|
|
136
136
|
website?: string | undefined;
|
|
137
|
-
bio?: string | undefined;
|
|
138
137
|
socialLinks?: {
|
|
139
138
|
instagram?: string | undefined;
|
|
140
139
|
facebook?: string | undefined;
|
|
@@ -145,6 +144,7 @@ export declare const sellerStoreSchema: z.ZodObject<{
|
|
|
145
144
|
storeCategory?: string | undefined;
|
|
146
145
|
storeLogoURL?: string | undefined;
|
|
147
146
|
storeBannerURL?: string | undefined;
|
|
147
|
+
bio?: string | undefined;
|
|
148
148
|
shippingPolicy?: string | undefined;
|
|
149
149
|
isVacationMode?: boolean | undefined;
|
|
150
150
|
vacationMessage?: string | undefined;
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Store Address Domain Actions (appkit)
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* SB-UNI-A 2026-05-13 — re-pointed at the unified `addressesRepository`
|
|
5
|
+
* (ownerType:"store"). The seller's store is resolved off their UID first;
|
|
6
|
+
* `store.storeSlug` is the ownerId for the address row.
|
|
6
7
|
*/
|
|
7
|
-
import type {
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
8
|
+
import type { AddressDocument, AddressCreateInput, AddressUpdateInput } from "../../addresses/schemas";
|
|
9
|
+
export type StoreAddressDocument = AddressDocument;
|
|
10
|
+
export type StoreAddressCreateInput = AddressCreateInput;
|
|
11
|
+
export type StoreAddressUpdateInput = AddressUpdateInput;
|
|
12
|
+
export declare function listStoreAddressesForSeller(userId: string): Promise<AddressDocument[]>;
|
|
13
|
+
export declare function createStoreAddressForSeller(userId: string, input: AddressCreateInput): Promise<AddressDocument>;
|
|
14
|
+
export declare function updateStoreAddressForSeller(userId: string, addressId: string, input: AddressUpdateInput): Promise<AddressDocument>;
|
|
11
15
|
export declare function deleteStoreAddressForSeller(userId: string, addressId: string): Promise<void>;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Store Address Domain Actions (appkit)
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* SB-UNI-A 2026-05-13 — re-pointed at the unified `addressesRepository`
|
|
5
|
+
* (ownerType:"store"). The seller's store is resolved off their UID first;
|
|
6
|
+
* `store.storeSlug` is the ownerId for the address row.
|
|
6
7
|
*/
|
|
7
8
|
import { NotFoundError, ValidationError } from "../../../errors";
|
|
8
9
|
import { serverLogger } from "../../../monitoring";
|
|
9
|
-
import {
|
|
10
|
+
import { addressesRepository } from "../../addresses/repository/addresses.repository";
|
|
10
11
|
import { storeRepository } from "../repository/store.repository";
|
|
11
12
|
async function resolveSellerStore(uid) {
|
|
12
13
|
const store = await storeRepository.findByOwnerId(uid);
|
|
@@ -20,7 +21,7 @@ export async function listStoreAddressesForSeller(userId) {
|
|
|
20
21
|
userId,
|
|
21
22
|
storeSlug: store.storeSlug,
|
|
22
23
|
});
|
|
23
|
-
return
|
|
24
|
+
return addressesRepository.listByOwner("store", store.storeSlug);
|
|
24
25
|
}
|
|
25
26
|
export async function createStoreAddressForSeller(userId, input) {
|
|
26
27
|
const store = await resolveSellerStore(userId);
|
|
@@ -28,7 +29,7 @@ export async function createStoreAddressForSeller(userId, input) {
|
|
|
28
29
|
userId,
|
|
29
30
|
storeSlug: store.storeSlug,
|
|
30
31
|
});
|
|
31
|
-
return
|
|
32
|
+
return addressesRepository.createForOwner("store", store.storeSlug, input);
|
|
32
33
|
}
|
|
33
34
|
export async function updateStoreAddressForSeller(userId, addressId, input) {
|
|
34
35
|
if (!addressId?.trim())
|
|
@@ -39,7 +40,7 @@ export async function updateStoreAddressForSeller(userId, addressId, input) {
|
|
|
39
40
|
storeSlug: store.storeSlug,
|
|
40
41
|
addressId,
|
|
41
42
|
});
|
|
42
|
-
return
|
|
43
|
+
return addressesRepository.updateForOwner("store", store.storeSlug, addressId, input);
|
|
43
44
|
}
|
|
44
45
|
export async function deleteStoreAddressForSeller(userId, addressId) {
|
|
45
46
|
if (!addressId?.trim())
|
|
@@ -50,5 +51,5 @@ export async function deleteStoreAddressForSeller(userId, addressId) {
|
|
|
50
51
|
storeSlug: store.storeSlug,
|
|
51
52
|
addressId,
|
|
52
53
|
});
|
|
53
|
-
return
|
|
54
|
+
return addressesRepository.deleteForOwner("store", store.storeSlug, addressId);
|
|
54
55
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import Link from "next/link";
|
|
3
|
-
import { Heading, Span, Row,
|
|
3
|
+
import { BaseListingCard, Heading, Span, Row, RichText, Div } from "../../../ui";
|
|
4
4
|
import { MediaImage } from "../../media/MediaImage";
|
|
5
5
|
import { THEME_CONSTANTS } from "../../../tokens";
|
|
6
6
|
import { normalizeRichTextHtml } from "../../../utils";
|
|
@@ -16,15 +16,8 @@ export function InteractiveStoreCard({ store, href, selectable, isSelected = fal
|
|
|
16
16
|
? "border-[var(--appkit-color-primary,theme(colors.violet.600))] outline outline-2 outline-[var(--appkit-color-primary,theme(colors.violet.600))]"
|
|
17
17
|
: "border-zinc-200 dark:border-zinc-700",
|
|
18
18
|
className,
|
|
19
|
-
].join(" "), onMouseDown: !isSelected ? longPress.onMouseDown : undefined, onMouseUp: !isSelected ? longPress.onMouseUp : undefined, onMouseLeave: !isSelected ? longPress.onMouseLeave : undefined, onTouchStart: !isSelected ? longPress.onTouchStart : undefined, onTouchEnd: !isSelected ? longPress.onTouchEnd : undefined, children: [onSelect && (_jsx(
|
|
19
|
+
].join(" "), onMouseDown: !isSelected ? longPress.onMouseDown : undefined, onMouseUp: !isSelected ? longPress.onMouseUp : undefined, onMouseLeave: !isSelected ? longPress.onMouseLeave : undefined, onTouchStart: !isSelected ? longPress.onTouchStart : undefined, onTouchEnd: !isSelected ? longPress.onTouchEnd : undefined, children: [onSelect && (_jsx(BaseListingCard.Checkbox, { selected: isSelected, onSelect: (e) => {
|
|
20
20
|
e.preventDefault();
|
|
21
|
-
e.stopPropagation();
|
|
22
21
|
onSelect(store.id, !isSelected);
|
|
23
|
-
}, className: [
|
|
24
|
-
"absolute top-2.5 left-2.5 z-10 h-6 w-6 rounded-md border-2 flex items-center justify-center bg-white/90 dark:bg-zinc-800/90 shadow-sm transition-all duration-150",
|
|
25
|
-
isSelected
|
|
26
|
-
? "bg-[var(--appkit-color-primary,theme(colors.violet.600))] border-[var(--appkit-color-primary,theme(colors.violet.600))] text-white opacity-100"
|
|
27
|
-
: "border-zinc-300 dark:border-zinc-600",
|
|
28
|
-
selectable || isSelected ? "opacity-100" : "opacity-0 group-hover:opacity-100",
|
|
29
|
-
].join(" "), children: isSelected && (_jsx("svg", { className: "h-3.5 w-3.5", viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: 2.5, "aria-hidden": "true", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M2 6l3 3 5-5" }) })) })), _jsxs(Link, { href: href, className: "flex flex-col flex-1 min-h-0", children: [_jsxs(Div, { className: "relative aspect-video w-full overflow-hidden bg-gradient-to-br from-zinc-100 via-zinc-200 to-zinc-300 dark:from-zinc-800 dark:via-zinc-700 dark:to-zinc-900 flex-shrink-0", children: [hasBanner ? (_jsx(MediaImage, { src: store.storeBannerURL, alt: `${store.storeName} banner`, size: "banner", className: "absolute inset-0 h-full w-full object-cover transition-transform duration-500 group-hover:scale-105" })) : (_jsx(Div, { className: "absolute inset-0 flex items-center justify-center", children: _jsx(Span, { className: "text-5xl opacity-20 select-none", "aria-hidden": "true", children: "\uD83C\uDFEA" }) })), _jsx(Div, { className: "absolute inset-x-0 bottom-0 h-12 bg-gradient-to-t from-black/40 to-transparent pointer-events-none" }), store.averageRating != null && store.averageRating > 0 && (_jsxs(Div, { className: "absolute top-2 right-2 flex items-center gap-1 rounded-full bg-black/50 backdrop-blur-sm px-2 py-0.5 text-xs font-semibold text-yellow-300", children: ["\u2605 ", store.averageRating.toFixed(1)] }))] }), _jsxs(Div, { className: "flex flex-col flex-1 px-4 pb-4", children: [_jsx(Div, { className: "-mt-5 mb-2 flex items-end justify-between", children: _jsx(Div, { className: "flex-shrink-0", children: hasLogo ? (_jsx(MediaImage, { src: store.storeLogoURL, alt: store.storeName, size: "avatar", className: "h-10 w-10 rounded-lg border-2 border-white dark:border-zinc-800 shadow-md object-cover" })) : (_jsx(Div, { className: "flex h-10 w-10 items-center justify-center rounded-lg border-2 border-white dark:border-zinc-800 bg-primary/10 dark:bg-primary/20 text-base font-bold text-primary shadow-md", children: initial })) }) }), _jsx(Heading, { level: 3, className: `${THEME_CONSTANTS.utilities.textClamp1} text-sm font-bold text-zinc-900 dark:text-zinc-100 group-hover:text-primary transition-colors`, children: store.storeName }), store.storeDescription ? (_jsx(RichText, { html: normalizeRichTextHtml(store.storeDescription), proseClass: "prose prose-sm max-w-none dark:prose-invert prose-p:my-0", className: `mt-1 ${THEME_CONSTANTS.utilities.textClamp2} text-xs text-zinc-500 dark:text-zinc-400 flex-1` })) : (_jsx(Div, { className: "flex-1" })), _jsxs(Row, { gap: "sm", className: "mt-2.5 flex-wrap text-xs text-zinc-500 dark:text-zinc-400", children: [store.totalProducts != null && store.totalProducts > 0 && (_jsxs(Span, { className: "flex items-center gap-0.5", children: [_jsx(Span, { "aria-hidden": "true", children: "\uD83D\uDCE6" }), " ", store.totalProducts, " ", labels.products ?? "products"] })), store.itemsSold != null && store.itemsSold > 0 && (_jsxs(Span, { className: "flex items-center gap-0.5", children: [_jsx(Span, { "aria-hidden": "true", children: "\uD83D\uDECD\uFE0F" }), " ", store.itemsSold, " ", labels.sold ?? "sold"] }))] }), _jsxs(Div, { className: "mt-3 pt-2.5 border-t border-zinc-100 dark:border-zinc-800 flex items-center justify-between", children: [_jsxs(Span, { className: "text-xs font-semibold text-primary group-hover:underline transition-colors", children: [labels.visitStore ?? "Visit store", " \u2192"] }), store.totalReviews != null && store.totalReviews > 0 && (_jsxs(Span, { className: "text-xs text-zinc-400 dark:text-zinc-500", children: [store.totalReviews, " ", labels.reviews ?? "reviews"] }))] })] })] })] }));
|
|
22
|
+
}, label: isSelected ? "Deselect store" : "Select store", position: "top-2 left-2", className: selectable || isSelected ? "opacity-100" : "opacity-0 group-hover:opacity-100 transition-opacity" })), _jsxs(Link, { href: href, className: "flex flex-col flex-1 min-h-0", children: [_jsxs(Div, { className: "relative aspect-video w-full overflow-hidden bg-gradient-to-br from-zinc-100 via-zinc-200 to-zinc-300 dark:from-zinc-800 dark:via-zinc-700 dark:to-zinc-900 flex-shrink-0", children: [hasBanner ? (_jsx(MediaImage, { src: store.storeBannerURL, alt: `${store.storeName} banner`, size: "banner", className: "absolute inset-0 h-full w-full object-cover transition-transform duration-500 group-hover:scale-105" })) : (_jsx(Div, { className: "absolute inset-0 flex items-center justify-center", children: _jsx(Span, { className: "text-5xl opacity-20 select-none", "aria-hidden": "true", children: "\uD83C\uDFEA" }) })), _jsx(Div, { className: "absolute inset-x-0 bottom-0 h-12 bg-gradient-to-t from-black/40 to-transparent pointer-events-none" }), store.averageRating != null && store.averageRating > 0 && (_jsxs(Div, { className: "absolute top-2 right-2 flex items-center gap-1 rounded-full bg-black/50 backdrop-blur-sm px-2 py-0.5 text-xs font-semibold text-yellow-300", children: ["\u2605 ", store.averageRating.toFixed(1)] }))] }), _jsxs(Div, { className: "flex flex-col flex-1 px-4 pb-4", children: [_jsx(Div, { className: "-mt-5 mb-2 flex items-end justify-between", children: _jsx(Div, { className: "flex-shrink-0", children: hasLogo ? (_jsx(MediaImage, { src: store.storeLogoURL, alt: store.storeName, size: "avatar", className: "h-10 w-10 rounded-lg border-2 border-white dark:border-zinc-800 shadow-md object-cover" })) : (_jsx(Div, { className: "flex h-10 w-10 items-center justify-center rounded-lg border-2 border-white dark:border-zinc-800 bg-primary/10 dark:bg-primary/20 text-base font-bold text-primary shadow-md", children: initial })) }) }), _jsx(Heading, { level: 3, className: `${THEME_CONSTANTS.utilities.textClamp1} text-sm font-bold text-zinc-900 dark:text-zinc-100 group-hover:text-primary transition-colors`, children: store.storeName }), store.storeDescription ? (_jsx(RichText, { html: normalizeRichTextHtml(store.storeDescription), proseClass: "prose prose-sm max-w-none dark:prose-invert prose-p:my-0", className: `mt-1 ${THEME_CONSTANTS.utilities.textClamp2} text-xs text-zinc-500 dark:text-zinc-400 flex-1` })) : (_jsx(Div, { className: "flex-1" })), _jsxs(Row, { gap: "sm", className: "mt-2.5 flex-wrap text-xs text-zinc-500 dark:text-zinc-400", children: [store.totalProducts != null && store.totalProducts > 0 && (_jsxs(Span, { className: "flex items-center gap-0.5", children: [_jsx(Span, { "aria-hidden": "true", children: "\uD83D\uDCE6" }), " ", store.totalProducts, " ", labels.products ?? "products"] })), store.itemsSold != null && store.itemsSold > 0 && (_jsxs(Span, { className: "flex items-center gap-0.5", children: [_jsx(Span, { "aria-hidden": "true", children: "\uD83D\uDECD\uFE0F" }), " ", store.itemsSold, " ", labels.sold ?? "sold"] }))] }), _jsxs(Div, { className: "mt-3 pt-2.5 border-t border-zinc-100 dark:border-zinc-800 flex items-center justify-between", children: [_jsxs(Span, { className: "text-xs font-semibold text-primary group-hover:underline transition-colors", children: [labels.visitStore ?? "Visit store", " \u2192"] }), store.totalReviews != null && store.totalReviews > 0 && (_jsxs(Span, { className: "text-xs text-zinc-400 dark:text-zinc-500", children: [store.totalReviews, " ", labels.reviews ?? "reviews"] }))] })] })] })] }));
|
|
30
23
|
}
|
|
@@ -3,8 +3,16 @@ import { cache } from "react";
|
|
|
3
3
|
import { storeRepository, productRepository, categoriesRepository } from "../../../repositories";
|
|
4
4
|
import { ROUTES } from "../../../next";
|
|
5
5
|
import { Container, Main, Section } from "../../../ui";
|
|
6
|
+
import { STORE_PAGE_TABS } from "../../products/constants/listing-tabs";
|
|
6
7
|
import { StoreHeader } from "./StoreHeader";
|
|
7
8
|
import { StoreNavTabs } from "./StoreNavTabs";
|
|
9
|
+
const STORE_LISTING_HREF = {
|
|
10
|
+
products: (slug) => String(ROUTES.PUBLIC.STORE_PRODUCTS(slug)),
|
|
11
|
+
auctions: (slug) => String(ROUTES.PUBLIC.STORE_AUCTIONS(slug)),
|
|
12
|
+
"pre-orders": (slug) => String(ROUTES.PUBLIC.STORE_PRE_ORDERS(slug)),
|
|
13
|
+
"prize-draws": (slug) => String(ROUTES.PUBLIC.STORE_PRIZE_DRAWS(slug)),
|
|
14
|
+
bundles: (slug) => String(ROUTES.PUBLIC.STORE_BUNDLES(slug)),
|
|
15
|
+
};
|
|
8
16
|
export const getStoreBySlug = cache((slug) => storeRepository.findBySlug(slug).catch(() => undefined));
|
|
9
17
|
function tabLabel(base, count) {
|
|
10
18
|
if (!count)
|
|
@@ -43,12 +51,19 @@ export async function StoreDetailLayoutView({ storeSlug, activeTab, children, })
|
|
|
43
51
|
.catch(() => 0),
|
|
44
52
|
])
|
|
45
53
|
: [0, 0, 0, 0, 0];
|
|
54
|
+
const listingCounts = {
|
|
55
|
+
products: productsCount,
|
|
56
|
+
auctions: auctionsCount,
|
|
57
|
+
"pre-orders": preOrdersCount,
|
|
58
|
+
"prize-draws": prizeDrawsCount,
|
|
59
|
+
bundles: bundlesCount,
|
|
60
|
+
};
|
|
46
61
|
const tabs = [
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
62
|
+
...STORE_PAGE_TABS.map((tab) => ({
|
|
63
|
+
value: tab.id,
|
|
64
|
+
label: tabLabel(tab.label, listingCounts[tab.id]),
|
|
65
|
+
href: STORE_LISTING_HREF[tab.id](storeSlug),
|
|
66
|
+
})),
|
|
52
67
|
{ value: "coupons", label: "Coupons", href: String(ROUTES.PUBLIC.STORE_COUPONS(storeSlug)) },
|
|
53
68
|
{ value: "reviews", label: "Reviews", href: String(ROUTES.PUBLIC.STORE_REVIEWS(storeSlug)) },
|
|
54
69
|
{ value: "about", label: "About", href: String(ROUTES.PUBLIC.STORE_ABOUT(storeSlug)) },
|