@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
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { OrderDocument } from "../schemas";
|
|
2
|
+
export interface RefundHistoryTableProps {
|
|
3
|
+
order: Pick<OrderDocument, "refunds" | "contestable" | "totalPrice" | "currency">;
|
|
4
|
+
className?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function RefundHistoryTable({ order, className }: RefundHistoryTableProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Badge, Div, Heading, Row, Stack, Text } from "../../../ui";
|
|
4
|
+
import { formatCurrency } from "../../../utils/number.formatter";
|
|
5
|
+
import { REFUND_COPY } from "../../../_internal/shared/features/orders/refund-copy";
|
|
6
|
+
function formatDate(d) {
|
|
7
|
+
const dt = d instanceof Date ? d : new Date(d);
|
|
8
|
+
return dt.toLocaleDateString("en-IN", { day: "numeric", month: "short", year: "numeric" });
|
|
9
|
+
}
|
|
10
|
+
function RefundRow({ event, currency }) {
|
|
11
|
+
return (_jsxs(Row, { justify: "between", align: "start", gap: "sm", className: "border-b border-zinc-100 py-3 last:border-0 dark:border-zinc-800", children: [_jsxs(Stack, { gap: "xs", className: "flex-1", children: [_jsxs(Row, { gap: "sm", align: "center", children: [_jsx(Badge, { variant: event.type === "full" ? "danger" : "warning", children: event.type === "full" ? REFUND_COPY.history.badgeFull : REFUND_COPY.history.badgePartial }), _jsx(Text, { size: "xs", color: "muted", children: formatDate(event.refundedAt) })] }), _jsx(Text, { size: "sm", children: event.reason }), event.manualTransactionId && (_jsxs(Text, { size: "xs", color: "muted", children: [REFUND_COPY.history.labelTxn, " ", event.manualTransactionId] })), event.razorpayRefundId && (_jsxs(Text, { size: "xs", color: "muted", children: [REFUND_COPY.history.labelRazorpay, " ", event.razorpayRefundId] }))] }), _jsx(Text, { size: "sm", weight: "semibold", className: "shrink-0", children: formatCurrency(event.amount / 100, currency) })] }));
|
|
12
|
+
}
|
|
13
|
+
/** Warning triangle icon — inline SVG kept here since it's a single-use decorative element. */
|
|
14
|
+
function WarningIcon() {
|
|
15
|
+
return (_jsx("svg", { className: "h-4 w-4 shrink-0 text-amber-600 dark:text-amber-400", fill: "currentColor", viewBox: "0 0 20 20", "aria-hidden": "true", children: _jsx("path", { fillRule: "evenodd", d: "M8.485 2.495c.673-1.167 2.357-1.167 3.03 0l6.28 10.875c.673 1.167-.17 2.625-1.516 2.625H3.72c-1.347 0-2.189-1.458-1.515-2.625L8.485 2.495zM10 5a.75.75 0 01.75.75v3.5a.75.75 0 01-1.5 0v-3.5A.75.75 0 0110 5zm0 9a1 1 0 100-2 1 1 0 000 2z", clipRule: "evenodd" }) }));
|
|
16
|
+
}
|
|
17
|
+
export function RefundHistoryTable({ order, className = "" }) {
|
|
18
|
+
const events = order.refunds ?? [];
|
|
19
|
+
const currency = order.currency ?? "INR";
|
|
20
|
+
if (events.length === 0 && order.contestable !== false)
|
|
21
|
+
return null;
|
|
22
|
+
return (_jsxs(Div, { className: `rounded-xl border border-zinc-200 bg-white dark:border-zinc-800 dark:bg-zinc-900 ${className}`, children: [order.contestable === false && (_jsx(Div, { className: "rounded-t-xl bg-amber-50 px-4 py-3 dark:bg-amber-950/30", children: _jsxs(Row, { gap: "sm", align: "center", children: [_jsx(WarningIcon, {}), _jsx(Text, { size: "sm", weight: "semibold", className: "text-amber-700 dark:text-amber-400", children: REFUND_COPY.history.nonContestableBanner })] }) })), events.length > 0 && (_jsxs(Div, { className: "p-4", children: [_jsx(Heading, { level: 4, className: "mb-3 text-sm font-semibold text-zinc-700 dark:text-zinc-300", children: REFUND_COPY.history.heading }), _jsx(Stack, { gap: "none", children: events.map((e) => (_jsx(RefundRow, { event: e, currency: currency }, e.refundId))) })] }))] }));
|
|
23
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { OrderDocument } from "../schemas";
|
|
2
|
+
export interface RefundRequestViewProps {
|
|
3
|
+
order: Pick<OrderDocument, "id" | "totalPrice" | "currency" | "isNonRefundable" | "refunds" | "contestable">;
|
|
4
|
+
onSubmitRequest: (reason: string) => Promise<void>;
|
|
5
|
+
isLoading?: boolean;
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function RefundRequestView({ order, onSubmitRequest, isLoading, className, }: RefundRequestViewProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* RefundRequestView — buyer-facing refund submission form.
|
|
5
|
+
*
|
|
6
|
+
* Shows 3 acknowledgment checkboxes (via the appkit Checkbox primitive) that
|
|
7
|
+
* the buyer must tick before the submit button becomes active. On submit the
|
|
8
|
+
* parent's `onSubmitRequest` is called with the reason string; the parent
|
|
9
|
+
* (page or modal) is responsible for calling the API.
|
|
10
|
+
*
|
|
11
|
+
* This component is presentational: it has no server-action imports and
|
|
12
|
+
* does not talk to the API directly.
|
|
13
|
+
*/
|
|
14
|
+
import { useState } from "react";
|
|
15
|
+
import { Button, Checkbox, Div, Stack, Text, Textarea } from "../../../ui";
|
|
16
|
+
import { REFUND_COPY } from "../../../_internal/shared/features/orders/refund-copy";
|
|
17
|
+
import { formatCurrency } from "../../../utils/number.formatter";
|
|
18
|
+
const ACK_COUNT = REFUND_COPY.request.acknowledgments.length;
|
|
19
|
+
export function RefundRequestView({ order, onSubmitRequest, isLoading = false, className = "", }) {
|
|
20
|
+
const [acknowledged, setAcknowledged] = useState(Array(ACK_COUNT).fill(false));
|
|
21
|
+
const [reason, setReason] = useState("");
|
|
22
|
+
const [error, setError] = useState(null);
|
|
23
|
+
const allChecked = acknowledged.every(Boolean);
|
|
24
|
+
const canSubmit = allChecked && reason.trim().length >= 10 && !isLoading;
|
|
25
|
+
if (order.isNonRefundable) {
|
|
26
|
+
return (_jsx(Div, { className: `rounded-xl border border-zinc-200 bg-zinc-50 p-4 dark:border-zinc-800 dark:bg-zinc-900 ${className}`, children: _jsx(Text, { size: "sm", color: "muted", children: REFUND_COPY.request.nonRefundableMessage }) }));
|
|
27
|
+
}
|
|
28
|
+
if (order.contestable === false) {
|
|
29
|
+
return (_jsx(Div, { className: `rounded-xl border border-amber-200 bg-amber-50 p-4 dark:border-amber-800 dark:bg-amber-950/30 ${className}`, children: _jsx(Text, { size: "sm", className: "text-amber-700 dark:text-amber-400", children: REFUND_COPY.request.alreadyRefundedMessage }) }));
|
|
30
|
+
}
|
|
31
|
+
const handleToggle = (i) => setAcknowledged((prev) => prev.map((v, idx) => (idx === i ? !v : v)));
|
|
32
|
+
const handleSubmit = async () => {
|
|
33
|
+
setError(null);
|
|
34
|
+
try {
|
|
35
|
+
await onSubmitRequest(reason.trim());
|
|
36
|
+
}
|
|
37
|
+
catch (err) {
|
|
38
|
+
setError(err instanceof Error ? err.message : REFUND_COPY.request.errorFallback);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
return (_jsxs(Stack, { gap: "md", className: className, children: [_jsxs(Text, { size: "sm", color: "muted", children: [REFUND_COPY.request.orderTotalLabel, " ", _jsx("strong", { children: formatCurrency(order.totalPrice / 100, order.currency ?? "INR") })] }), _jsxs(Stack, { gap: "xs", children: [_jsxs(Text, { size: "sm", weight: "semibold", children: [REFUND_COPY.request.reasonLabel, " ", _jsx("span", { "aria-hidden": true, children: "*" })] }), _jsx(Textarea, { value: reason, onChange: (e) => setReason(e.target.value), placeholder: REFUND_COPY.request.reasonPlaceholder, rows: 3, "aria-required": "true", "aria-label": REFUND_COPY.request.reasonLabel })] }), _jsxs(Stack, { gap: "sm", children: [_jsx(Text, { size: "sm", weight: "semibold", children: REFUND_COPY.request.acknowledgeHeading }), REFUND_COPY.request.acknowledgments.map((text, i) => (_jsx(Checkbox, { checked: acknowledged[i], onChange: () => handleToggle(i), label: _jsx(Text, { size: "sm", className: "leading-snug", children: text }), "aria-label": `Acknowledgment ${i + 1}` }, i)))] }), error && (_jsx(Text, { size: "sm", color: "danger", role: "alert", children: error })), _jsx(Button, { variant: "danger", onClick: handleSubmit, disabled: !canSubmit, "aria-busy": isLoading, children: isLoading ? REFUND_COPY.request.submittingLabel : REFUND_COPY.request.submitLabel })] }));
|
|
42
|
+
}
|
|
@@ -2,3 +2,9 @@ export { OrderCard, OrdersList } from "./OrdersList";
|
|
|
2
2
|
export { MarketplaceOrderCard, type MarketplaceOrderCardLabels, type MarketplaceOrderCardLinks, type MarketplaceOrderCardOrder, type MarketplaceOrderCardProps, } from "./MarketplaceOrderCard";
|
|
3
3
|
export { OrderFilters, ORDER_FILTER_KEYS, ORDER_ADMIN_SORT_OPTIONS, ORDER_SELLER_SORT_OPTIONS, ORDER_USER_SORT_OPTIONS, getOrderFilterKeys, getOrderSortOptions, } from "./OrderFilters";
|
|
4
4
|
export type { OrderFiltersProps, OrderFilterVariant } from "./OrderFilters";
|
|
5
|
+
export { OrderSiblingPayments } from "./OrderSiblingPayments";
|
|
6
|
+
export type { OrderSiblingPaymentsProps } from "./OrderSiblingPayments";
|
|
7
|
+
export { RefundHistoryTable } from "./RefundHistoryTable";
|
|
8
|
+
export type { RefundHistoryTableProps } from "./RefundHistoryTable";
|
|
9
|
+
export { RefundRequestView } from "./RefundRequestView";
|
|
10
|
+
export type { RefundRequestViewProps } from "./RefundRequestView";
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
export { OrderCard, OrdersList } from "./OrdersList";
|
|
2
2
|
export { MarketplaceOrderCard, } from "./MarketplaceOrderCard";
|
|
3
3
|
export { OrderFilters, ORDER_FILTER_KEYS, ORDER_ADMIN_SORT_OPTIONS, ORDER_SELLER_SORT_OPTIONS, ORDER_USER_SORT_OPTIONS, getOrderFilterKeys, getOrderSortOptions, } from "./OrderFilters";
|
|
4
|
+
export { OrderSiblingPayments } from "./OrderSiblingPayments";
|
|
5
|
+
export { RefundHistoryTable } from "./RefundHistoryTable";
|
|
6
|
+
export { RefundRequestView } from "./RefundRequestView";
|
|
@@ -4,4 +4,5 @@ export * from "./components";
|
|
|
4
4
|
export * from "./schemas";
|
|
5
5
|
export * from "./columns";
|
|
6
6
|
export * from "./utils/order-splitter";
|
|
7
|
+
export { groupOrderItemsByBundle, type BundleOrderGroup, type OrderItemForBundleGrouping, } from "./utils/bundle-grouping";
|
|
7
8
|
export { manifest } from "./manifest";
|
|
@@ -4,4 +4,6 @@ export * from "./components";
|
|
|
4
4
|
export * from "./schemas";
|
|
5
5
|
export * from "./columns";
|
|
6
6
|
export * from "./utils/order-splitter";
|
|
7
|
+
// S-SBUNI-5 2026-05-13 — bundle-aware order item grouping.
|
|
8
|
+
export { groupOrderItemsByBundle, } from "./utils/bundle-grouping";
|
|
7
9
|
export { manifest } from "./manifest";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { DocumentReference, WriteBatch } from "firebase-admin/firestore";
|
|
2
2
|
import type { FirebaseSieveResult, SieveModel } from "../../../providers/db-firebase";
|
|
3
3
|
import { BaseRepository } from "../../../providers/db-firebase";
|
|
4
|
-
import { type OrderCreateInput, type OrderDocument } from "../schemas";
|
|
4
|
+
import { type OrderCreateInput, type OrderDocument, type OrderRefundEvent } from "../schemas";
|
|
5
5
|
import type { OrderStatus, PaymentStatus } from "../types";
|
|
6
6
|
declare class OrderRepository extends BaseRepository<OrderDocument> {
|
|
7
7
|
constructor();
|
|
@@ -81,6 +81,10 @@ declare class OrderRepository extends BaseRepository<OrderDocument> {
|
|
|
81
81
|
canFilter: boolean;
|
|
82
82
|
canSort: boolean;
|
|
83
83
|
};
|
|
84
|
+
contestable: {
|
|
85
|
+
canFilter: boolean;
|
|
86
|
+
canSort: boolean;
|
|
87
|
+
};
|
|
84
88
|
};
|
|
85
89
|
listForSeller(productIds: string[], model: SieveModel): Promise<FirebaseSieveResult<OrderDocument>>;
|
|
86
90
|
listForUser(userId: string, model: SieveModel): Promise<FirebaseSieveResult<OrderDocument>>;
|
|
@@ -145,8 +149,23 @@ declare class OrderRepository extends BaseRepository<OrderDocument> {
|
|
|
145
149
|
canFilter: boolean;
|
|
146
150
|
canSort: boolean;
|
|
147
151
|
};
|
|
152
|
+
paymentBatchId: {
|
|
153
|
+
canFilter: boolean;
|
|
154
|
+
canSort: boolean;
|
|
155
|
+
};
|
|
156
|
+
contestable: {
|
|
157
|
+
canFilter: boolean;
|
|
158
|
+
canSort: boolean;
|
|
159
|
+
};
|
|
148
160
|
};
|
|
149
161
|
listAll(model: SieveModel): Promise<FirebaseSieveResult<OrderDocument>>;
|
|
162
|
+
/**
|
|
163
|
+
* Append one refund event to the order and mark it non-contestable.
|
|
164
|
+
* If `becomeRefunded` is true, also transitions the order status to "refunded".
|
|
165
|
+
*/
|
|
166
|
+
postRefundEvent(orderId: string, event: OrderRefundEvent, becomeRefunded?: boolean): Promise<OrderDocument>;
|
|
167
|
+
/** Fetch all orders sharing a paymentBatchId (for sibling-orders display). */
|
|
168
|
+
findByPaymentBatchId(batchId: string): Promise<OrderDocument[]>;
|
|
150
169
|
/**
|
|
151
170
|
* Cloud Functions: find pending orders created before a timeout threshold.
|
|
152
171
|
* Used by the payment-timeout cleanup job to cancel stale unconfirmed orders.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DatabaseError } from "../../../errors";
|
|
1
|
+
import { DatabaseError, NotFoundError } from "../../../errors";
|
|
2
2
|
import { BaseRepository, prepareForFirestore, } from "../../../providers/db-firebase";
|
|
3
3
|
import { decryptPiiFields, encryptPiiFields, ORDER_PII_FIELDS, } from "../../../security";
|
|
4
4
|
import { serverTimestamp } from "../../../contracts/field-ops";
|
|
@@ -208,6 +208,31 @@ class OrderRepository extends BaseRepository {
|
|
|
208
208
|
maxPageSize: 200,
|
|
209
209
|
});
|
|
210
210
|
}
|
|
211
|
+
/**
|
|
212
|
+
* Append one refund event to the order and mark it non-contestable.
|
|
213
|
+
* If `becomeRefunded` is true, also transitions the order status to "refunded".
|
|
214
|
+
*/
|
|
215
|
+
async postRefundEvent(orderId, event, becomeRefunded = false) {
|
|
216
|
+
const order = await this.findById(orderId);
|
|
217
|
+
if (!order)
|
|
218
|
+
throw new NotFoundError(`Order ${orderId} not found`);
|
|
219
|
+
const existing = order.refunds ?? [];
|
|
220
|
+
return this.update(orderId, {
|
|
221
|
+
refunds: [...existing, event],
|
|
222
|
+
contestable: false,
|
|
223
|
+
...(becomeRefunded ? { status: "refunded" } : {}),
|
|
224
|
+
updatedAt: new Date(),
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
/** Fetch all orders sharing a paymentBatchId (for sibling-orders display). */
|
|
228
|
+
async findByPaymentBatchId(batchId) {
|
|
229
|
+
const snap = await this.db
|
|
230
|
+
.collection(this.collection)
|
|
231
|
+
.where("paymentBatchId", "==", batchId)
|
|
232
|
+
.limit(20)
|
|
233
|
+
.get();
|
|
234
|
+
return snap.docs.map((d) => this.decryptOrder({ id: d.id, ...d.data() }));
|
|
235
|
+
}
|
|
211
236
|
/**
|
|
212
237
|
* Cloud Functions: find pending orders created before a timeout threshold.
|
|
213
238
|
* Used by the payment-timeout cleanup job to cancel stale unconfirmed orders.
|
|
@@ -325,6 +350,7 @@ OrderRepository.SELLER_SIEVE_FIELDS = {
|
|
|
325
350
|
totalPrice: { canFilter: true, canSort: true },
|
|
326
351
|
orderDate: { canFilter: true, canSort: true },
|
|
327
352
|
createdAt: { canFilter: true, canSort: true },
|
|
353
|
+
contestable: { canFilter: true, canSort: false },
|
|
328
354
|
};
|
|
329
355
|
OrderRepository.ADMIN_SIEVE_FIELDS = {
|
|
330
356
|
id: { canFilter: true, canSort: false },
|
|
@@ -342,6 +368,9 @@ OrderRepository.ADMIN_SIEVE_FIELDS = {
|
|
|
342
368
|
totalPrice: { canFilter: true, canSort: true },
|
|
343
369
|
orderDate: { canFilter: true, canSort: true },
|
|
344
370
|
createdAt: { canFilter: true, canSort: true },
|
|
371
|
+
// S-SBUNI-RULES 2026-05-13 — refund + batch fields
|
|
372
|
+
paymentBatchId: { canFilter: true, canSort: false },
|
|
373
|
+
contestable: { canFilter: true, canSort: false },
|
|
345
374
|
};
|
|
346
375
|
const orderRepository = new OrderRepository();
|
|
347
376
|
export { OrderRepository, orderRepository };
|
|
@@ -4,14 +4,15 @@
|
|
|
4
4
|
import type { OrderStatus, PaymentStatus } from "../types";
|
|
5
5
|
import type { OrderType } from "../utils/order-splitter";
|
|
6
6
|
export type ShippingMethod = "custom" | "shiprocket";
|
|
7
|
+
export type RefundType = "full" | "partial";
|
|
7
8
|
export type OrderPayoutStatus = "eligible" | "requested" | "paid";
|
|
8
9
|
export type RefundStatus = "pending" | "processing" | "completed" | "rejected";
|
|
9
|
-
/** Runtime-accessible shipping method values
|
|
10
|
+
/** Runtime-accessible shipping method values — use instead of bare string literals. */
|
|
10
11
|
export declare const ShippingMethodValues: {
|
|
11
12
|
readonly CUSTOM: "custom";
|
|
12
13
|
readonly SHIPROCKET: "shiprocket";
|
|
13
14
|
};
|
|
14
|
-
/** Runtime-accessible order status values
|
|
15
|
+
/** Runtime-accessible order status values — use instead of bare string literals. */
|
|
15
16
|
export declare const OrderStatusValues: {
|
|
16
17
|
readonly PENDING: "pending";
|
|
17
18
|
readonly CONFIRMED: "confirmed";
|
|
@@ -23,7 +24,7 @@ export declare const OrderStatusValues: {
|
|
|
23
24
|
readonly RETURN_REQUESTED: "return_requested";
|
|
24
25
|
readonly RETURNED: "returned";
|
|
25
26
|
};
|
|
26
|
-
/** Runtime-accessible payment status values
|
|
27
|
+
/** Runtime-accessible payment status values — use instead of bare string literals. */
|
|
27
28
|
export declare const PaymentStatusValues: {
|
|
28
29
|
readonly PENDING: "pending";
|
|
29
30
|
readonly PROCESSING: "processing";
|
|
@@ -32,36 +33,62 @@ export declare const PaymentStatusValues: {
|
|
|
32
33
|
readonly REFUNDED: "refunded";
|
|
33
34
|
readonly PARTIAL_REFUND: "partial_refund";
|
|
34
35
|
};
|
|
35
|
-
/** Runtime-accessible payment method values
|
|
36
|
+
/** Runtime-accessible payment method values — use instead of bare string literals. */
|
|
36
37
|
export declare const PaymentMethodValues: {
|
|
37
38
|
readonly COD: "cod";
|
|
38
39
|
readonly ONLINE: "online";
|
|
39
40
|
readonly UPI_MANUAL: "upi_manual";
|
|
40
41
|
readonly RAZORPAY: "razorpay";
|
|
41
42
|
};
|
|
42
|
-
/** Runtime-accessible refund status values
|
|
43
|
+
/** Runtime-accessible refund status values — use instead of bare string literals. */
|
|
43
44
|
export declare const RefundStatusValues: {
|
|
44
45
|
readonly PENDING: "pending";
|
|
45
46
|
readonly PROCESSING: "processing";
|
|
46
47
|
readonly COMPLETED: "completed";
|
|
47
48
|
readonly REJECTED: "rejected";
|
|
48
49
|
};
|
|
49
|
-
/** Firestore storage shape for an order line item
|
|
50
|
+
/** Firestore storage shape for an order line item — distinct from the API display model OrderItem */
|
|
50
51
|
export interface OrderDocumentItem {
|
|
51
52
|
productId: string;
|
|
52
53
|
productTitle: string;
|
|
53
54
|
quantity: number;
|
|
54
55
|
unitPrice: number;
|
|
55
56
|
totalPrice: number;
|
|
56
|
-
/** SB8-F
|
|
57
|
-
listingType?: "standard" | "auction" | "pre-order" | "prize-draw";
|
|
58
|
-
/** SB8-F
|
|
57
|
+
/** SB8-F — set when the item is a prize-draw entry; drives the reveals badge. */
|
|
58
|
+
listingType?: "standard" | "auction" | "pre-order" | "prize-draw" | "classified" | "digital-code" | "live";
|
|
59
|
+
/** SB8-F — per-item reveal status; flips through pending → open → revealed/closed. */
|
|
59
60
|
prizeRevealStatus?: "pending" | "open" | "closed" | "revealed";
|
|
60
|
-
/** SB8-F
|
|
61
|
+
/** SB8-F — ISO timestamp; deadline by which the buyer must claim the prize. */
|
|
61
62
|
prizeRevealDeadline?: string;
|
|
62
|
-
/** SB8-F
|
|
63
|
+
/** SB8-F — set after the reveal API picks a winner. */
|
|
63
64
|
revealedItemNumber?: number;
|
|
64
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* One refund event on an order. Multiple partial refund events are allowed
|
|
68
|
+
* until the cumulative amount equals the order total, at which point the order
|
|
69
|
+
* transitions to full-refund terminal state. Once any refund is posted the
|
|
70
|
+
* order's `contestable` flag becomes false permanently.
|
|
71
|
+
*/
|
|
72
|
+
export interface OrderRefundEvent {
|
|
73
|
+
refundId: string;
|
|
74
|
+
type: RefundType;
|
|
75
|
+
/** Amount in paise. */
|
|
76
|
+
amount: number;
|
|
77
|
+
/** ProductIds / itemIds that were refunded (for partial refunds). */
|
|
78
|
+
itemIds?: string[];
|
|
79
|
+
reason: string;
|
|
80
|
+
refundedAt: Date;
|
|
81
|
+
refundedBy: string;
|
|
82
|
+
/** Set when Razorpay processed the refund. */
|
|
83
|
+
razorpayRefundId?: string;
|
|
84
|
+
/** Set when refund was processed manually (offline). */
|
|
85
|
+
manualTransactionId?: string;
|
|
86
|
+
/** Proof document URL (via /api/media signed-URL flow). */
|
|
87
|
+
proofDocumentUrl?: string;
|
|
88
|
+
proofDocumentMimeType?: string;
|
|
89
|
+
/** Required for Razorpay-override path ("failed auto-refund, settled manually"). */
|
|
90
|
+
overrideReason?: string;
|
|
91
|
+
}
|
|
65
92
|
/** One applied discount/coupon saved on the order for accounting and display */
|
|
66
93
|
export interface AppliedOrderDiscount {
|
|
67
94
|
code: string;
|
|
@@ -136,14 +163,37 @@ export interface OrderDocument {
|
|
|
136
163
|
};
|
|
137
164
|
/** Deadline for the buyer to claim the won prize (typically 7 days). */
|
|
138
165
|
prizeRevealDeadline?: Date;
|
|
139
|
-
/** True once `prizeRevealDeadline` passes without a claim
|
|
166
|
+
/** True once `prizeRevealDeadline` passes without a claim — auto-forfeit. */
|
|
140
167
|
prizeRevealExpired?: boolean;
|
|
141
168
|
/** Source product id when the order came from a prize-draw entry. */
|
|
142
169
|
prizeDrawProductId?: string;
|
|
143
170
|
/** True for prize-draw entries and bundle purchases that bypass refund. */
|
|
144
171
|
isNonRefundable?: boolean;
|
|
145
|
-
/** Set when the order came from a bundle
|
|
172
|
+
/** Set when the order came from a bundle — points back to `bundles/{id}`. */
|
|
146
173
|
bundleId?: string;
|
|
174
|
+
/**
|
|
175
|
+
* Internal reference linking sibling orders created from the same checkout
|
|
176
|
+
* transaction (one Razorpay payment, N orders). Not a contractual record —
|
|
177
|
+
* orders are the source of truth for invoicing, refunds, and disputes.
|
|
178
|
+
*/
|
|
179
|
+
paymentBatchId?: string;
|
|
180
|
+
/**
|
|
181
|
+
* Append-only log of refund events on this order. Multiple partial refund
|
|
182
|
+
* events are allowed until the cumulative amount equals `totalPrice`.
|
|
183
|
+
*/
|
|
184
|
+
refunds?: OrderRefundEvent[];
|
|
185
|
+
/**
|
|
186
|
+
* False once ANY refund (full or partial) has been posted. Once false it
|
|
187
|
+
* stays false — no dispute, RMA request, or “Item Not Received” claim may
|
|
188
|
+
* be filed. Both buyer and seller must acknowledge this in the refund UI
|
|
189
|
+
* via `confirmIrrevocable: true` before the refund is posted.
|
|
190
|
+
*/
|
|
191
|
+
contestable?: boolean;
|
|
192
|
+
/** Signed-URL media slug for a shipping-proof document (label, AWB scan). */
|
|
193
|
+
shippingProofUrl?: string;
|
|
194
|
+
shippingProofMimeType?: string;
|
|
195
|
+
shippingProofUploadedAt?: Date;
|
|
196
|
+
shippingProofUploadedBy?: string;
|
|
147
197
|
createdAt: Date;
|
|
148
198
|
updatedAt: Date;
|
|
149
199
|
}
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
* Orders Firestore Document Types & Constants
|
|
3
3
|
*/
|
|
4
4
|
import { generateOrderId } from "../../../utils/id-generators";
|
|
5
|
-
/** Runtime-accessible shipping method values
|
|
5
|
+
/** Runtime-accessible shipping method values — use instead of bare string literals. */
|
|
6
6
|
export const ShippingMethodValues = {
|
|
7
7
|
CUSTOM: "custom",
|
|
8
8
|
SHIPROCKET: "shiprocket",
|
|
9
9
|
};
|
|
10
|
-
/** Runtime-accessible order status values
|
|
10
|
+
/** Runtime-accessible order status values — use instead of bare string literals. */
|
|
11
11
|
export const OrderStatusValues = {
|
|
12
12
|
PENDING: "pending",
|
|
13
13
|
CONFIRMED: "confirmed",
|
|
@@ -19,7 +19,7 @@ export const OrderStatusValues = {
|
|
|
19
19
|
RETURN_REQUESTED: "return_requested",
|
|
20
20
|
RETURNED: "returned",
|
|
21
21
|
};
|
|
22
|
-
/** Runtime-accessible payment status values
|
|
22
|
+
/** Runtime-accessible payment status values — use instead of bare string literals. */
|
|
23
23
|
export const PaymentStatusValues = {
|
|
24
24
|
PENDING: "pending",
|
|
25
25
|
PROCESSING: "processing",
|
|
@@ -28,14 +28,14 @@ export const PaymentStatusValues = {
|
|
|
28
28
|
REFUNDED: "refunded",
|
|
29
29
|
PARTIAL_REFUND: "partial_refund",
|
|
30
30
|
};
|
|
31
|
-
/** Runtime-accessible payment method values
|
|
31
|
+
/** Runtime-accessible payment method values — use instead of bare string literals. */
|
|
32
32
|
export const PaymentMethodValues = {
|
|
33
33
|
COD: "cod",
|
|
34
34
|
ONLINE: "online",
|
|
35
35
|
UPI_MANUAL: "upi_manual",
|
|
36
36
|
RAZORPAY: "razorpay",
|
|
37
37
|
};
|
|
38
|
-
/** Runtime-accessible refund status values
|
|
38
|
+
/** Runtime-accessible refund status values — use instead of bare string literals. */
|
|
39
39
|
export const RefundStatusValues = {
|
|
40
40
|
PENDING: "pending",
|
|
41
41
|
PROCESSING: "processing",
|
|
@@ -137,16 +137,16 @@ export declare const orderSchema: z.ZodObject<{
|
|
|
137
137
|
}[];
|
|
138
138
|
total: number;
|
|
139
139
|
userId: string;
|
|
140
|
-
subtotal: number;
|
|
141
140
|
paymentStatus: string;
|
|
141
|
+
subtotal: number;
|
|
142
142
|
orderStatus: "pending" | "processing" | "refunded" | "confirmed" | "shipped" | "delivered" | "cancelled" | "return_requested" | "returned";
|
|
143
143
|
createdAt?: string | undefined;
|
|
144
144
|
updatedAt?: string | undefined;
|
|
145
145
|
notes?: string | undefined;
|
|
146
|
-
tax?: number | undefined;
|
|
147
146
|
trackingNumber?: string | undefined;
|
|
148
147
|
couponCode?: string | undefined;
|
|
149
148
|
shippingCarrier?: string | undefined;
|
|
149
|
+
tax?: number | undefined;
|
|
150
150
|
paymentGateway?: string | undefined;
|
|
151
151
|
shippingCost?: number | undefined;
|
|
152
152
|
discount?: number | undefined;
|
|
@@ -172,16 +172,16 @@ export declare const orderSchema: z.ZodObject<{
|
|
|
172
172
|
}[];
|
|
173
173
|
total: number;
|
|
174
174
|
userId: string;
|
|
175
|
-
subtotal: number;
|
|
176
175
|
paymentStatus: string;
|
|
176
|
+
subtotal: number;
|
|
177
177
|
orderStatus: "pending" | "processing" | "refunded" | "confirmed" | "shipped" | "delivered" | "cancelled" | "return_requested" | "returned";
|
|
178
178
|
createdAt?: string | undefined;
|
|
179
179
|
updatedAt?: string | undefined;
|
|
180
180
|
notes?: string | undefined;
|
|
181
|
-
tax?: number | undefined;
|
|
182
181
|
trackingNumber?: string | undefined;
|
|
183
182
|
couponCode?: string | undefined;
|
|
184
183
|
shippingCarrier?: string | undefined;
|
|
184
|
+
tax?: number | undefined;
|
|
185
185
|
paymentGateway?: string | undefined;
|
|
186
186
|
shippingCost?: number | undefined;
|
|
187
187
|
discount?: number | undefined;
|
|
@@ -23,8 +23,9 @@ export interface OrderItem {
|
|
|
23
23
|
currency?: string;
|
|
24
24
|
storeId?: string;
|
|
25
25
|
attributes?: Record<string, string>;
|
|
26
|
-
/** Listing kind at the time of order — needed for prize-draw UI hints (SB8-F).
|
|
27
|
-
|
|
26
|
+
/** Listing kind at the time of order — needed for prize-draw UI hints (SB8-F).
|
|
27
|
+
* SB-UNI-F 2026-05-13 — Phase 2 union extension. */
|
|
28
|
+
listingType?: "standard" | "auction" | "pre-order" | "prize-draw" | "classified" | "digital-code" | "live";
|
|
28
29
|
/**
|
|
29
30
|
* Per-item prize-draw reveal status (SB8-F). Populated by the checkout
|
|
30
31
|
* actions when listingType === "prize-draw". Used to render the
|
|
@@ -35,6 +36,15 @@ export interface OrderItem {
|
|
|
35
36
|
prizeRevealDeadline?: string;
|
|
36
37
|
/** Set after the reveal endpoint picks a winner — the prize item index. */
|
|
37
38
|
revealedItemNumber?: number;
|
|
39
|
+
/**
|
|
40
|
+
* SB-UNI-4 2026-05-13 — bundle identifier when this order line represents a
|
|
41
|
+
* bundle purchase. `productId` then points at the bundle category id and
|
|
42
|
+
* `bundleProductIds` snapshots the included member product ids. Per-member
|
|
43
|
+
* stock decrement + order fan-out lands in S-SBUNI-5.
|
|
44
|
+
*/
|
|
45
|
+
bundleCategorySlug?: string;
|
|
46
|
+
/** Snapshot of bundle.bundleProductIds at order-creation time. */
|
|
47
|
+
bundleProductIds?: string[];
|
|
38
48
|
}
|
|
39
49
|
export interface OrderTimeline {
|
|
40
50
|
status: OrderStatus;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Order-item bundle grouping — S-SBUNI-5 2026-05-13.
|
|
3
|
+
*
|
|
4
|
+
* Orders carry bundle members as individual `OrderItem` rows (per S-SBUNI-4
|
|
5
|
+
* schema) when the buyer's cart line was a bundle. The order-detail UI
|
|
6
|
+
* collapses those rows back under a single "Bundle: <name>" header so the
|
|
7
|
+
* checkout receipt mirrors the buyer's intent. This helper is the pure
|
|
8
|
+
* grouping logic — the UI primitive lives next to the consumer view.
|
|
9
|
+
*
|
|
10
|
+
* Two flavours of "bundle row" can appear on an order:
|
|
11
|
+
* 1. ONE order row whose `bundleCategorySlug` + `bundleProductIds[]` set
|
|
12
|
+
* describe the bundle (this is what S-SBUNI-4's checkout writes — the
|
|
13
|
+
* bundle stays a single row in the order with the locked
|
|
14
|
+
* bundlePriceInPaise as its line total).
|
|
15
|
+
* 2. (Future) Expanded N rows, each tagged with the same
|
|
16
|
+
* `bundleCategorySlug`. The grouping handles this too in case a future
|
|
17
|
+
* session pivots to row expansion.
|
|
18
|
+
*
|
|
19
|
+
* Either way, `groupOrderItemsByBundle` returns a stable, ordered list of
|
|
20
|
+
* "groups" so the renderer can iterate once.
|
|
21
|
+
*/
|
|
22
|
+
/** Minimal shape consumed from an order item (Firestore wire format). */
|
|
23
|
+
export interface OrderItemForBundleGrouping {
|
|
24
|
+
/** Bundle discriminator — set when this row is part of a bundle. */
|
|
25
|
+
bundleCategorySlug?: string;
|
|
26
|
+
/** Snapshot of bundle members at order-creation time. */
|
|
27
|
+
bundleProductIds?: string[];
|
|
28
|
+
}
|
|
29
|
+
export type BundleOrderGroup<T extends OrderItemForBundleGrouping> = {
|
|
30
|
+
kind: "single";
|
|
31
|
+
item: T;
|
|
32
|
+
index: number;
|
|
33
|
+
} | {
|
|
34
|
+
kind: "bundle";
|
|
35
|
+
bundleCategorySlug: string;
|
|
36
|
+
items: Array<{
|
|
37
|
+
item: T;
|
|
38
|
+
index: number;
|
|
39
|
+
}>;
|
|
40
|
+
/** Pulled from the first row in the group; reflects what checkout snapshotted. */
|
|
41
|
+
memberCount: number;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Walk the items array preserving original order; collapse contiguous (or
|
|
45
|
+
* non-contiguous) bundle rows sharing the same `bundleCategorySlug` into a
|
|
46
|
+
* single group. Single rows pass through unchanged.
|
|
47
|
+
*/
|
|
48
|
+
export declare function groupOrderItemsByBundle<T extends OrderItemForBundleGrouping>(items: T[]): Array<BundleOrderGroup<T>>;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Order-item bundle grouping — S-SBUNI-5 2026-05-13.
|
|
3
|
+
*
|
|
4
|
+
* Orders carry bundle members as individual `OrderItem` rows (per S-SBUNI-4
|
|
5
|
+
* schema) when the buyer's cart line was a bundle. The order-detail UI
|
|
6
|
+
* collapses those rows back under a single "Bundle: <name>" header so the
|
|
7
|
+
* checkout receipt mirrors the buyer's intent. This helper is the pure
|
|
8
|
+
* grouping logic — the UI primitive lives next to the consumer view.
|
|
9
|
+
*
|
|
10
|
+
* Two flavours of "bundle row" can appear on an order:
|
|
11
|
+
* 1. ONE order row whose `bundleCategorySlug` + `bundleProductIds[]` set
|
|
12
|
+
* describe the bundle (this is what S-SBUNI-4's checkout writes — the
|
|
13
|
+
* bundle stays a single row in the order with the locked
|
|
14
|
+
* bundlePriceInPaise as its line total).
|
|
15
|
+
* 2. (Future) Expanded N rows, each tagged with the same
|
|
16
|
+
* `bundleCategorySlug`. The grouping handles this too in case a future
|
|
17
|
+
* session pivots to row expansion.
|
|
18
|
+
*
|
|
19
|
+
* Either way, `groupOrderItemsByBundle` returns a stable, ordered list of
|
|
20
|
+
* "groups" so the renderer can iterate once.
|
|
21
|
+
*/
|
|
22
|
+
/**
|
|
23
|
+
* Walk the items array preserving original order; collapse contiguous (or
|
|
24
|
+
* non-contiguous) bundle rows sharing the same `bundleCategorySlug` into a
|
|
25
|
+
* single group. Single rows pass through unchanged.
|
|
26
|
+
*/
|
|
27
|
+
export function groupOrderItemsByBundle(items) {
|
|
28
|
+
const groups = [];
|
|
29
|
+
const bundleIndexBySlug = new Map();
|
|
30
|
+
items.forEach((item, index) => {
|
|
31
|
+
const slug = item.bundleCategorySlug;
|
|
32
|
+
if (!slug) {
|
|
33
|
+
groups.push({ kind: "single", item, index });
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const existingIdx = bundleIndexBySlug.get(slug);
|
|
37
|
+
if (existingIdx === undefined) {
|
|
38
|
+
const memberCount = item.bundleProductIds?.length ?? 1;
|
|
39
|
+
groups.push({
|
|
40
|
+
kind: "bundle",
|
|
41
|
+
bundleCategorySlug: slug,
|
|
42
|
+
items: [{ item, index }],
|
|
43
|
+
memberCount,
|
|
44
|
+
});
|
|
45
|
+
bundleIndexBySlug.set(slug, groups.length - 1);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const existing = groups[existingIdx];
|
|
49
|
+
if (existing.kind === "bundle") {
|
|
50
|
+
existing.items.push({ item, index });
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
return groups;
|
|
54
|
+
}
|
|
@@ -3,22 +3,21 @@ export interface OrderGroup<T> {
|
|
|
3
3
|
items: T[];
|
|
4
4
|
orderType: OrderType;
|
|
5
5
|
}
|
|
6
|
+
import type { CartItemDocument } from "../../cart/schemas/firestore";
|
|
6
7
|
/**
|
|
7
8
|
* Split a sequence of cart-items into order groups by `OrderType`.
|
|
8
9
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
10
|
+
* The split key and order type are both derived from the checkout rule
|
|
11
|
+
* registry so new listing types need no changes here.
|
|
12
|
+
*
|
|
13
|
+
* Prize-draw items with qty > PRIZE_DRAW_MAX_REVEALS_PER_ORDER are first
|
|
14
|
+
* expanded into virtual single-batch items (via `rule.splitMultipleOrders`),
|
|
15
|
+
* then each batch lands in its own order group.
|
|
13
16
|
*
|
|
14
17
|
* SB1-G Phase 4 — keys off the canonical `CartItem.listingType` discriminator
|
|
15
18
|
* instead of the legacy `isAuction` / `isPreOrder` booleans.
|
|
19
|
+
* S-SBUNI-RULES 2026-05-13 — rule-registry dispatch replaces if/else chain.
|
|
16
20
|
*/
|
|
17
21
|
export declare function splitCartIntoOrderGroups<T extends {
|
|
18
|
-
item:
|
|
19
|
-
itemId: string;
|
|
20
|
-
storeId?: string;
|
|
21
|
-
listingType?: "standard" | "auction" | "pre-order" | "prize-draw";
|
|
22
|
-
isOffer?: boolean;
|
|
23
|
-
};
|
|
22
|
+
item: CartItemDocument;
|
|
24
23
|
}>(checks: T[]): OrderGroup<T>[];
|