@mohasinac/appkit 3.8.2 → 3.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_internal/client/features/live/LiveItemDetailView.js +2 -2
- package/dist/_internal/client/features/lottery/LotteryAdminEditView.d.ts +4 -4
- package/dist/_internal/client/features/lottery/LotteryAdminEditView.js +8 -8
- package/dist/_internal/client/features/lottery/LotteryAdminSlotView.d.ts +1 -1
- package/dist/_internal/client/features/lottery/LotteryAdminSlotView.js +2 -2
- package/dist/_internal/server/features/bundles/actions.js +2 -2
- package/dist/_internal/server/features/bundles/og.d.ts +1 -1
- package/dist/_internal/server/features/bundles/og.js +4 -5
- package/dist/_internal/server/features/checkout/actions.js +57 -21
- package/dist/_internal/server/features/checkout/stock-restore.d.ts +19 -0
- package/dist/_internal/server/features/checkout/stock-restore.js +80 -0
- package/dist/_internal/server/features/checkout/upi-resolution.d.ts +11 -0
- package/dist/_internal/server/features/checkout/upi-resolution.js +28 -0
- package/dist/_internal/server/features/classified/og.js +1 -1
- package/dist/_internal/server/features/digital-code/og.js +1 -1
- package/dist/_internal/server/features/item-requests/og.d.ts +2 -2
- package/dist/_internal/server/features/item-requests/og.js +4 -5
- package/dist/_internal/server/features/live/og.js +1 -1
- package/dist/_internal/server/features/lottery/adapters.d.ts +2 -2
- package/dist/_internal/server/features/lottery/adapters.js +1 -1
- package/dist/_internal/server/features/orders/actions.d.ts +28 -0
- package/dist/_internal/server/features/orders/actions.js +239 -4
- package/dist/_internal/server/features/orders/adapters.js +3 -0
- package/dist/_internal/server/features/payments/data.js +3 -2
- package/dist/_internal/server/features/payouts/actions.d.ts +2 -2
- package/dist/_internal/server/features/payouts/actions.js +4 -3
- package/dist/_internal/server/features/pre-orders/service.d.ts +1 -1
- package/dist/_internal/server/features/pre-orders/service.js +3 -2
- package/dist/_internal/server/features/prize-draws/og.js +5 -5
- package/dist/_internal/server/features/products/og.js +1 -1
- package/dist/_internal/server/features/promotions/service.js +3 -1
- package/dist/_internal/server/features/refunds/actions.d.ts +2 -2
- package/dist/_internal/server/features/refunds/actions.js +7 -6
- package/dist/_internal/server/functions/firestore.js +1 -1
- package/dist/_internal/server/functions/scheduled.d.ts +4 -1
- package/dist/_internal/server/functions/scheduled.js +26 -2
- package/dist/_internal/server/jobs/core/emiInstallmentReminder.js +1 -1
- package/dist/_internal/server/jobs/core/hardBanCascade.d.ts +4 -0
- package/dist/_internal/server/jobs/core/hardBanCascade.js +15 -4
- package/dist/_internal/server/jobs/core/hardBanReinstatement.d.ts +16 -0
- package/dist/_internal/server/jobs/core/hardBanReinstatement.js +63 -0
- package/dist/_internal/server/jobs/core/jobRunners.js +3 -1
- package/dist/_internal/server/jobs/core/onScamReportCreate.js +1 -1
- package/dist/_internal/server/jobs/core/paymentReviewAutoApprove.d.ts +10 -0
- package/dist/_internal/server/jobs/core/paymentReviewAutoApprove.js +60 -0
- package/dist/_internal/server/jobs/core/paymentWindowTimeout.d.ts +15 -0
- package/dist/_internal/server/jobs/core/paymentWindowTimeout.js +59 -0
- package/dist/_internal/server/jobs/core/pendingOrderTimeout.d.ts +7 -0
- package/dist/_internal/server/jobs/core/pendingOrderTimeout.js +32 -6
- package/dist/_internal/server/jobs/handlers/hardBanReinstatement.d.ts +2 -0
- package/dist/_internal/server/jobs/handlers/hardBanReinstatement.js +2 -0
- package/dist/_internal/server/jobs/handlers/index.d.ts +3 -0
- package/dist/_internal/server/jobs/handlers/index.js +3 -0
- package/dist/_internal/server/jobs/handlers/messages.d.ts +4 -0
- package/dist/_internal/server/jobs/handlers/messages.js +4 -0
- package/dist/_internal/server/jobs/handlers/onShipmentAllocationSync.d.ts +3 -3
- package/dist/_internal/server/jobs/handlers/onShipmentAllocationSync.js +12 -12
- package/dist/_internal/server/jobs/handlers/onShipmentItemWrite.d.ts +1 -1
- package/dist/_internal/server/jobs/handlers/onShipmentItemWrite.js +5 -5
- package/dist/_internal/server/jobs/handlers/paymentReviewAutoApprove.d.ts +2 -0
- package/dist/_internal/server/jobs/handlers/paymentReviewAutoApprove.js +2 -0
- package/dist/_internal/server/jobs/handlers/paymentWindowTimeout.d.ts +2 -0
- package/dist/_internal/server/jobs/handlers/paymentWindowTimeout.js +2 -0
- package/dist/_internal/shared/actions/action-registry.js +27 -0
- package/dist/_internal/shared/checkout/order-math.js +3 -2
- package/dist/_internal/shared/checkout/rules/_defaults.js +1 -0
- package/dist/_internal/shared/checkout/rules/preorder.rule.js +7 -0
- package/dist/_internal/shared/checkout/rules/prize-draw.rule.js +7 -0
- package/dist/_internal/shared/checkout/rules/types.d.ts +11 -0
- package/dist/_internal/shared/features/auctions/errors.js +1 -1
- package/dist/_internal/shared/features/categories/bundle-copy.d.ts +0 -1
- package/dist/_internal/shared/features/categories/bundle-copy.js +0 -1
- package/dist/_internal/shared/features/categories/bundle-schemas.d.ts +6 -6
- package/dist/_internal/shared/features/categories/bundle-schemas.js +2 -2
- package/dist/_internal/shared/features/checkout/config.d.ts +3 -3
- package/dist/_internal/shared/features/checkout/config.js +3 -3
- package/dist/_internal/shared/features/emi/schedule.d.ts +6 -6
- package/dist/_internal/shared/features/emi/schedule.js +10 -9
- package/dist/_internal/shared/features/promotions/errors.js +1 -1
- package/dist/_internal/shared/fees/calculator.d.ts +5 -5
- package/dist/_internal/shared/fees/calculator.js +19 -19
- package/dist/client.d.ts +1 -1
- package/dist/client.js +1 -1
- package/dist/constants/api-endpoints.d.ts +9 -0
- package/dist/constants/api-endpoints.js +3 -0
- package/dist/constants/field-names.d.ts +4 -0
- package/dist/constants/field-names.js +4 -0
- package/dist/features/admin/components/AdminArtView.js +2 -2
- package/dist/features/admin/components/AdminBidsView.js +2 -2
- package/dist/features/admin/components/AdminBundleEditorView.d.ts +1 -1
- package/dist/features/admin/components/AdminBundleEditorView.js +8 -8
- package/dist/features/admin/components/AdminBundlesView.js +6 -6
- package/dist/features/admin/components/AdminClassifiedView.js +2 -2
- package/dist/features/admin/components/AdminDigitalCodesView.js +2 -2
- package/dist/features/admin/components/AdminLiveView.js +2 -2
- package/dist/features/admin/components/AdminOrderEditorView.d.ts +6 -1
- package/dist/features/admin/components/AdminOrderEditorView.js +45 -5
- package/dist/features/admin/components/AdminOrdersView.js +8 -3
- package/dist/features/admin/components/AdminPayoutsView.js +2 -2
- package/dist/features/admin/components/AdminPrizeDrawsView.js +2 -2
- package/dist/features/admin/components/AdminReturnRequestsView.js +2 -2
- package/dist/features/admin/components/AdminSectionsView.js +4 -4
- package/dist/features/admin/components/AdminSiteSettingsView.js +11 -11
- package/dist/features/admin/components/AdminStickersView.js +2 -2
- package/dist/features/admin/components/AdminSupportTicketDetailView.js +1 -1
- package/dist/features/admin/components/sections/adminSectionsBuildParse.js +13 -5
- package/dist/features/admin/components/sections/adminSectionsTypes.d.ts +4 -0
- package/dist/features/admin/components/sections/adminSectionsTypes.js +9 -5
- package/dist/features/admin/hooks/useAdminListingData.d.ts +1 -1
- package/dist/features/admin/hooks/useAdminListingData.js +3 -2
- package/dist/features/admin/schemas/firestore.d.ts +9 -7
- package/dist/features/admin/schemas/firestore.js +4 -3
- package/dist/features/auctions/components/AuctionBidsTable.js +3 -3
- package/dist/features/auth/checkout-value-otp.d.ts +46 -0
- package/dist/features/auth/checkout-value-otp.js +73 -0
- package/dist/features/auth/repository/user.repository.d.ts +6 -0
- package/dist/features/auth/repository/user.repository.js +19 -0
- package/dist/features/auth/schemas/firestore.d.ts +10 -0
- package/dist/features/auth/schemas/firestore.js +2 -0
- package/dist/features/cart/actions/cart-actions.d.ts +1 -1
- package/dist/features/cart/actions/cart-actions.js +4 -4
- package/dist/features/cart/components/CartView.d.ts +2 -2
- package/dist/features/cart/components/ShippingPicker.d.ts +4 -4
- package/dist/features/cart/components/ShippingPicker.js +11 -11
- package/dist/features/cart/repository/cart.repository.d.ts +1 -1
- package/dist/features/cart/repository/cart.repository.js +2 -2
- package/dist/features/cart/schemas/firestore.d.ts +2 -2
- package/dist/features/catalogue/components/CatalogueItemEditorView.js +3 -3
- package/dist/features/catalogue/components/PublicCatalogueView.js +2 -2
- package/dist/features/catalogue/schemas/validation.js +1 -1
- package/dist/features/categories/components/BundleCollage.js +2 -2
- package/dist/features/categories/components/BundleDetailView.js +2 -2
- package/dist/features/categories/components/BundleItemsPicker.d.ts +1 -1
- package/dist/features/categories/components/BundleItemsPicker.js +2 -2
- package/dist/features/categories/components/CategoryBundlesListing.js +2 -2
- package/dist/features/categories/schemas/firestore.d.ts +1 -1
- package/dist/features/categories/schemas/index.d.ts +3 -3
- package/dist/features/categories/schemas/index.js +2 -2
- package/dist/features/checkout/actions/checkout-value-otp-actions.d.ts +16 -0
- package/dist/features/checkout/actions/checkout-value-otp-actions.js +83 -0
- package/dist/features/checkout/actions/index.d.ts +1 -0
- package/dist/features/checkout/actions/index.js +1 -0
- package/dist/features/checkout/schemas/firestore.d.ts +1 -1
- package/dist/features/classified/components/index.d.ts +0 -4
- package/dist/features/classified/components/index.js +0 -2
- package/dist/features/digital-codes/components/index.d.ts +0 -4
- package/dist/features/digital-codes/components/index.js +0 -2
- package/dist/features/events/schemas/index.d.ts +1 -1
- package/dist/features/events/schemas/index.js +1 -1
- package/dist/features/homepage/components/BrandsSection.d.ts +4 -1
- package/dist/features/homepage/components/BrandsSection.js +2 -2
- package/dist/features/homepage/components/CustomCardsSection.js +3 -3
- package/dist/features/homepage/components/CustomerReviewsSection.d.ts +4 -1
- package/dist/features/homepage/components/CustomerReviewsSection.js +2 -2
- package/dist/features/homepage/components/EventsSection.d.ts +4 -1
- package/dist/features/homepage/components/EventsSection.js +2 -2
- package/dist/features/homepage/components/FeaturedAuctionsSection.d.ts +2 -1
- package/dist/features/homepage/components/FeaturedAuctionsSection.js +2 -2
- package/dist/features/homepage/components/FeaturedBundlesSection.js +2 -2
- package/dist/features/homepage/components/FeaturedPreOrdersSection.d.ts +2 -1
- package/dist/features/homepage/components/FeaturedPreOrdersSection.js +2 -2
- package/dist/features/homepage/components/FeaturedProductsSection.d.ts +2 -1
- package/dist/features/homepage/components/FeaturedProductsSection.js +2 -2
- package/dist/features/homepage/components/FeaturedStoresSection.d.ts +4 -1
- package/dist/features/homepage/components/FeaturedStoresSection.js +2 -2
- package/dist/features/homepage/components/HomepageCustomerReviewsSection.d.ts +4 -1
- package/dist/features/homepage/components/HomepageCustomerReviewsSection.js +2 -2
- package/dist/features/homepage/components/SectionCarousel.d.ts +3 -1
- package/dist/features/homepage/components/SectionCarousel.js +2 -2
- package/dist/features/homepage/components/ShopByCategorySection.d.ts +4 -1
- package/dist/features/homepage/components/ShopByCategorySection.js +2 -2
- package/dist/features/homepage/lib/section-renderer.js +9 -9
- package/dist/features/homepage/schemas/firestore.d.ts +8 -0
- package/dist/features/live/components/index.d.ts +0 -4
- package/dist/features/live/components/index.js +0 -2
- package/dist/features/lottery/types/index.d.ts +3 -3
- package/dist/features/lottery/types/index.js +5 -5
- package/dist/features/orders/components/OrderPaymentSummary.js +2 -2
- package/dist/features/orders/components/OrderSiblingPayments.js +1 -1
- package/dist/features/orders/components/RefundHistoryTable.js +1 -1
- package/dist/features/orders/components/RefundRequestView.js +1 -1
- package/dist/features/orders/constants/payment-window.d.ts +10 -0
- package/dist/features/orders/constants/payment-window.js +10 -0
- package/dist/features/orders/repository/orders.repository.d.ts +25 -0
- package/dist/features/orders/repository/orders.repository.js +50 -1
- package/dist/features/orders/schemas/firestore.d.ts +50 -2
- package/dist/features/orders/schemas/index.d.ts +24 -24
- package/dist/features/orders/schemas/index.js +20 -20
- package/dist/features/orders/types/index.d.ts +4 -0
- package/dist/features/orders/utils/bundle-grouping.d.ts +1 -1
- package/dist/features/orders/utils/bundle-grouping.js +1 -1
- package/dist/features/payments/schemas/index.d.ts +10 -10
- package/dist/features/payments/schemas/index.js +9 -9
- package/dist/features/pre-orders/components/PreOrderDetailPageView.js +2 -2
- package/dist/features/products/components/ArtStickersListView.d.ts +7 -0
- package/dist/features/products/components/ArtStickersListView.js +57 -0
- package/dist/features/products/components/GroupSettingsPanel.js +1 -1
- package/dist/features/products/components/MakeOfferButton.js +3 -3
- package/dist/features/products/components/MarketplaceBundleCard.d.ts +1 -1
- package/dist/features/products/components/MarketplaceBundleCard.js +2 -2
- package/dist/features/products/components/PrizeDrawCollage.js +2 -2
- package/dist/features/products/components/PrizeDrawItemsEditor.js +2 -2
- package/dist/features/products/components/PrizeRevealModal.js +1 -1
- package/dist/features/products/components/ProductDetailPageView.js +2 -9
- package/dist/features/products/components/ProductForm.js +2 -2
- package/dist/features/products/components/ProductGrid.js +2 -2
- package/dist/features/products/components/ProductsIndexListing.d.ts +13 -1
- package/dist/features/products/components/ProductsIndexListing.js +7 -5
- package/dist/features/products/components/ProductsIndexPageView.js +6 -1
- package/dist/features/products/constants/listing-tabs.d.ts +42 -17
- package/dist/features/products/constants/listing-tabs.js +25 -6
- package/dist/features/products/schemas/catalog-product.d.ts +5 -5
- package/dist/features/products/schemas/catalog-product.js +1 -1
- package/dist/features/products/schemas/firestore.d.ts +5 -5
- package/dist/features/products/schemas/firestore.js +2 -2
- package/dist/features/products/types/index.d.ts +5 -2
- package/dist/features/promotions/components/CouponCard.js +2 -2
- package/dist/features/promotions/schemas/firestore.d.ts +2 -0
- package/dist/features/promotions/schemas/firestore.js +1 -0
- package/dist/features/promotions/schemas/index.d.ts +14 -14
- package/dist/features/promotions/schemas/index.js +6 -6
- package/dist/features/scams/components/ScamProfileView.js +3 -7
- package/dist/features/scams/components/ScamRegistryView.js +2 -6
- package/dist/features/scams/schemas/firestore.d.ts +1 -1
- package/dist/features/search/components/Search.d.ts +1 -1
- package/dist/features/seller/actions/offer-actions.js +1 -1
- package/dist/features/seller/components/PrintCenterView.js +2 -2
- package/dist/features/seller/components/QuickProductForm.js +5 -5
- package/dist/features/seller/components/SellerArtView.js +2 -2
- package/dist/features/seller/components/SellerAuctionsView.js +2 -2
- package/dist/features/seller/components/SellerBidsView.js +2 -2
- package/dist/features/seller/components/SellerBundlesView.js +6 -6
- package/dist/features/seller/components/SellerClassifiedView.js +2 -2
- package/dist/features/seller/components/SellerDigitalCodesView.js +2 -2
- package/dist/features/seller/components/SellerLiveView.js +2 -2
- package/dist/features/seller/components/SellerOffersView.js +2 -2
- package/dist/features/seller/components/SellerOrdersView.js +3 -3
- package/dist/features/seller/components/SellerPayoutRequestView.js +2 -2
- package/dist/features/seller/components/SellerPayoutSettingsView.js +2 -2
- package/dist/features/seller/components/SellerPayoutsView.js +2 -2
- package/dist/features/seller/components/SellerPreOrdersView.js +2 -2
- package/dist/features/seller/components/SellerPrizeDrawsView.js +2 -2
- package/dist/features/seller/components/SellerProductShell.js +8 -8
- package/dist/features/seller/components/SellerProductsView.js +1 -1
- package/dist/features/seller/components/SellerShippingView.js +6 -6
- package/dist/features/seller/components/SellerStickersView.js +2 -2
- package/dist/features/seller/hooks/useSellerListingData.d.ts +1 -1
- package/dist/features/seller/hooks/useSellerListingData.js +3 -2
- package/dist/features/shipments/components/AdminShipmentEditorView.js +10 -10
- package/dist/features/shipments/components/AdminShipmentLotItemsView.js +4 -4
- package/dist/features/shipments/components/AdminShipmentProjectionsView.js +5 -5
- package/dist/features/shipments/components/AdminShipmentsView.js +4 -4
- package/dist/features/shipments/repository/shipment-lots.repository.d.ts +2 -2
- package/dist/features/shipments/repository/shipment-lots.repository.js +8 -8
- package/dist/features/shipments/schemas/firestore.d.ts +21 -21
- package/dist/features/shipments/schemas/firestore.js +9 -9
- package/dist/features/shipments/schemas/validation.d.ts +30 -30
- package/dist/features/shipments/schemas/validation.js +6 -6
- package/dist/features/shipments/utils/cost-allocation.d.ts +5 -5
- package/dist/features/shipments/utils/cost-allocation.js +39 -38
- package/dist/features/store-extensions/schemas/firestore.d.ts +5 -5
- package/dist/features/stores/components/StoreDetailLayoutView.js +9 -13
- package/dist/features/stores/schemas/firestore.d.ts +7 -7
- package/dist/features/stores/schemas/index.d.ts +84 -84
- package/dist/features/stores/schemas/index.js +5 -5
- package/dist/features/tester/seed-data/categories-tester-seed-data.js +1 -1
- package/dist/features/tester/seed-data/products-tester-seed-data.js +6 -6
- package/dist/features/tester/seed-data/tester-checklist-seed-data.js +9 -2
- package/dist/features/whatsapp-bot/helpers/whatsapp.d.ts +8 -1
- package/dist/features/whatsapp-bot/helpers/whatsapp.js +13 -2
- package/dist/features/whatsapp-bot/types/index.d.ts +9 -1
- package/dist/index.d.ts +3 -7
- package/dist/index.js +7 -5
- package/dist/next/routing/route-map.d.ts +2 -0
- package/dist/next/routing/route-map.js +6 -0
- package/dist/schemas/firestore-helpers.d.ts +2 -2
- package/dist/schemas/firestore-helpers.js +2 -2
- package/dist/schemas/registry.d.ts +73 -73
- package/dist/seed/bids-seed-data.js +6 -6
- package/dist/seed/blog-posts-seed-data.js +1 -0
- package/dist/seed/cart-seed-data.js +13 -13
- package/dist/seed/catalogue-seed-data.js +6 -6
- package/dist/seed/categories-seed-data.js +5 -5
- package/dist/seed/claimed-coupons-seed-data.js +3 -3
- package/dist/seed/coupons-seed-data.js +20 -20
- package/dist/seed/events-seed-data.js +27 -27
- package/dist/seed/factories/bid.factory.js +1 -1
- package/dist/seed/faq-seed-data.js +20 -1
- package/dist/seed/grouped-listings-seed-data.d.ts +2 -2
- package/dist/seed/grouped-listings-seed-data.js +3 -3
- package/dist/seed/homepage-sections-seed-data.js +10 -0
- package/dist/seed/offers-seed-data.js +19 -19
- package/dist/seed/orders-seed-data.js +29 -29
- package/dist/seed/payouts-seed-data.js +7 -7
- package/dist/seed/products-auctions-seed-data.js +6 -6
- package/dist/seed/products-preorders-seed-data.d.ts +2 -2
- package/dist/seed/products-preorders-seed-data.js +1 -1
- package/dist/seed/products-standard-seed-data.js +8 -8
- package/dist/seed/scammers-seed-data.js +2 -2
- package/dist/seed/shipments-seed-data.js +29 -29
- package/dist/seed/site-settings-seed-data.js +3 -2
- package/dist/seed/store-extensions-seed-data.js +8 -8
- package/dist/seed/stores-seed-data.js +37 -8
- package/dist/seed/users-seed-data.js +38 -1
- package/dist/server-entry.d.ts +1 -3
- package/dist/server-entry.js +1 -3
- package/dist/server.d.ts +2 -1
- package/dist/server.js +3 -1
- package/dist/ui/components/HorizontalScroller.js +3 -0
- package/dist/ui/components/PriceDisplay.js +3 -12
- package/dist/utils/number.formatter.d.ts +2 -7
- package/dist/utils/number.formatter.js +3 -8
- package/package.json +1 -1
- package/scripts/seed-cli.mjs +8 -3
- package/dist/_internal/client/scaffolds/DashboardScaffold.d.ts +0 -34
- package/dist/_internal/client/scaffolds/DashboardScaffold.js +0 -26
- package/dist/_internal/client/theme/__tests__/ThemeProvider.test.d.ts +0 -1
- package/dist/_internal/client/theme/__tests__/ThemeProvider.test.js +0 -109
- package/dist/_internal/server/features/auctions/__tests__/service.test.d.ts +0 -1
- package/dist/_internal/server/features/auctions/__tests__/service.test.js +0 -140
- package/dist/_internal/server/features/checkout/__tests__/actions.test.d.ts +0 -1
- package/dist/_internal/server/features/checkout/__tests__/actions.test.js +0 -600
- package/dist/_internal/server/features/refunds/__tests__/actions.test.d.ts +0 -1
- package/dist/_internal/server/features/refunds/__tests__/actions.test.js +0 -263
- package/dist/_internal/server/jobs/core/__tests__/auctionSettlement.test.d.ts +0 -1
- package/dist/_internal/server/jobs/core/__tests__/auctionSettlement.test.js +0 -249
- package/dist/_internal/server/jobs/core/__tests__/couponExpiry.test.d.ts +0 -1
- package/dist/_internal/server/jobs/core/__tests__/couponExpiry.test.js +0 -65
- package/dist/_internal/server/jobs/core/__tests__/listingProcessor.test.d.ts +0 -1
- package/dist/_internal/server/jobs/core/__tests__/listingProcessor.test.js +0 -163
- package/dist/_internal/server/jobs/core/__tests__/mediaTmpCleanup.test.d.ts +0 -1
- package/dist/_internal/server/jobs/core/__tests__/mediaTmpCleanup.test.js +0 -115
- package/dist/_internal/server/jobs/core/__tests__/onBidPlaced.test.d.ts +0 -1
- package/dist/_internal/server/jobs/core/__tests__/onBidPlaced.test.js +0 -201
- package/dist/_internal/server/jobs/core/__tests__/onOrderCreate.test.d.ts +0 -1
- package/dist/_internal/server/jobs/core/__tests__/onOrderCreate.test.js +0 -169
- package/dist/_internal/server/jobs/core/__tests__/onOrderStatusChange.test.d.ts +0 -1
- package/dist/_internal/server/jobs/core/__tests__/onOrderStatusChange.test.js +0 -148
- package/dist/_internal/server/jobs/core/__tests__/onProductStockChange.test.d.ts +0 -1
- package/dist/_internal/server/jobs/core/__tests__/onProductStockChange.test.js +0 -210
- package/dist/_internal/server/jobs/core/__tests__/onReviewWrite.test.d.ts +0 -1
- package/dist/_internal/server/jobs/core/__tests__/onReviewWrite.test.js +0 -190
- package/dist/_internal/server/jobs/core/__tests__/onUserBanChange.test.d.ts +0 -1
- package/dist/_internal/server/jobs/core/__tests__/onUserBanChange.test.js +0 -161
- package/dist/_internal/server/jobs/core/__tests__/payoutBatch.test.d.ts +0 -1
- package/dist/_internal/server/jobs/core/__tests__/payoutBatch.test.js +0 -302
- package/dist/_internal/server/jobs/core/__tests__/pendingOrderTimeout.test.d.ts +0 -1
- package/dist/_internal/server/jobs/core/__tests__/pendingOrderTimeout.test.js +0 -96
- package/dist/_internal/server/jobs/core/__tests__/triggerEventRaffle.test.d.ts +0 -1
- package/dist/_internal/server/jobs/core/__tests__/triggerEventRaffle.test.js +0 -252
- package/dist/_internal/server/jobs/core/__tests__/wrapJobHandler.test.d.ts +0 -1
- package/dist/_internal/server/jobs/core/__tests__/wrapJobHandler.test.js +0 -129
- package/dist/_internal/server/jobs/core/onCatalogueSubmittedForApproval.d.ts +0 -15
- package/dist/_internal/server/jobs/core/onCatalogueSubmittedForApproval.js +0 -38
- package/dist/_internal/server/providers/index.d.ts +0 -11
- package/dist/_internal/server/providers/index.js +0 -11
- package/dist/_internal/server/providers/payment/razorpay-mock.d.ts +0 -52
- package/dist/_internal/server/providers/payment/razorpay-mock.js +0 -118
- package/dist/_internal/server/providers/resolve.d.ts +0 -36
- package/dist/_internal/server/providers/resolve.js +0 -31
- package/dist/_internal/server/providers/shipping/shiprocket-mock.d.ts +0 -29
- package/dist/_internal/server/providers/shipping/shiprocket-mock.js +0 -152
- package/dist/_internal/shared/types/__tests__/action-result.test.d.ts +0 -1
- package/dist/_internal/shared/types/__tests__/action-result.test.js +0 -65
- package/dist/errors/__tests__/error-mapping.test.d.ts +0 -1
- package/dist/errors/__tests__/error-mapping.test.js +0 -122
- package/dist/errors/__tests__/safe-read.test.d.ts +0 -1
- package/dist/errors/__tests__/safe-read.test.js +0 -39
- package/dist/features/addresses/repository/__tests__/addresses.repository.test.d.ts +0 -1
- package/dist/features/addresses/repository/__tests__/addresses.repository.test.js +0 -386
- package/dist/features/admin/components/AdminListingScaffold.d.ts +0 -41
- package/dist/features/admin/components/AdminListingScaffold.js +0 -68
- package/dist/features/admin/components/QuickActionsPanel.d.ts +0 -15
- package/dist/features/admin/components/QuickActionsPanel.js +0 -5
- package/dist/features/admin/repository/__tests__/notification.repository.test.d.ts +0 -1
- package/dist/features/admin/repository/__tests__/notification.repository.test.js +0 -356
- package/dist/features/admin/repository/__tests__/site-settings.repository.test.d.ts +0 -1
- package/dist/features/admin/repository/__tests__/site-settings.repository.test.js +0 -298
- package/dist/features/auctions/repository/__tests__/bid.repository.test.d.ts +0 -1
- package/dist/features/auctions/repository/__tests__/bid.repository.test.js +0 -290
- package/dist/features/auctions/repository/auctions.repository.d.ts +0 -12
- package/dist/features/auctions/repository/auctions.repository.js +0 -42
- package/dist/features/auth/repository/__tests__/session.repository.test.d.ts +0 -1
- package/dist/features/auth/repository/__tests__/session.repository.test.js +0 -310
- package/dist/features/auth/repository/__tests__/session.test.d.ts +0 -1
- package/dist/features/auth/repository/__tests__/session.test.js +0 -146
- package/dist/features/auth/repository/__tests__/sms-counter.repository.test.d.ts +0 -1
- package/dist/features/auth/repository/__tests__/sms-counter.repository.test.js +0 -171
- package/dist/features/auth/repository/__tests__/sms-counter.test.d.ts +0 -1
- package/dist/features/auth/repository/__tests__/sms-counter.test.js +0 -88
- package/dist/features/auth/repository/__tests__/token.repository.test.d.ts +0 -1
- package/dist/features/auth/repository/__tests__/token.repository.test.js +0 -260
- package/dist/features/auth/repository/__tests__/token.test.d.ts +0 -1
- package/dist/features/auth/repository/__tests__/token.test.js +0 -140
- package/dist/features/auth/repository/__tests__/user.repository.test.d.ts +0 -1
- package/dist/features/auth/repository/__tests__/user.repository.test.js +0 -352
- package/dist/features/auth/repository/__tests__/user.test.d.ts +0 -1
- package/dist/features/auth/repository/__tests__/user.test.js +0 -226
- package/dist/features/before-after/repository/before-after.repository.d.ts +0 -13
- package/dist/features/before-after/repository/before-after.repository.js +0 -36
- package/dist/features/before-after/server.d.ts +0 -6
- package/dist/features/before-after/server.js +0 -6
- package/dist/features/cart/repository/__tests__/cart.repository.test.d.ts +0 -1
- package/dist/features/cart/repository/__tests__/cart.repository.test.js +0 -371
- package/dist/features/categories/repository/__tests__/categories.repository.test.d.ts +0 -1
- package/dist/features/categories/repository/__tests__/categories.repository.test.js +0 -813
- package/dist/features/collections/repository/collections.repository.d.ts +0 -8
- package/dist/features/collections/repository/collections.repository.js +0 -16
- package/dist/features/collections/server.d.ts +0 -6
- package/dist/features/collections/server.js +0 -6
- package/dist/features/events/repository/__tests__/event.repository.test.d.ts +0 -1
- package/dist/features/events/repository/__tests__/event.repository.test.js +0 -299
- package/dist/features/faq/repository/__tests__/faqs.repository.test.d.ts +0 -1
- package/dist/features/faq/repository/__tests__/faqs.repository.test.js +0 -311
- package/dist/features/forms/Form.d.ts +0 -25
- package/dist/features/forms/Form.js +0 -37
- package/dist/features/history/repository/__tests__/user-history.repository.test.d.ts +0 -1
- package/dist/features/history/repository/__tests__/user-history.repository.test.js +0 -180
- package/dist/features/homepage/repository/__tests__/carousel.repository.test.d.ts +0 -1
- package/dist/features/homepage/repository/__tests__/carousel.repository.test.js +0 -182
- package/dist/features/homepage/repository/__tests__/homepage-sections.repository.test.d.ts +0 -1
- package/dist/features/homepage/repository/__tests__/homepage-sections.repository.test.js +0 -185
- package/dist/features/layout/ListingLayout.d.ts +0 -34
- package/dist/features/layout/ListingLayout.js +0 -103
- package/dist/features/messages/repository/__tests__/conversations.repository.test.d.ts +0 -1
- package/dist/features/messages/repository/__tests__/conversations.repository.test.js +0 -257
- package/dist/features/orders/repository/__tests__/orders.repository.test.d.ts +0 -1
- package/dist/features/orders/repository/__tests__/orders.repository.test.js +0 -211
- package/dist/features/payments/repository/__tests__/payout.repository.test.d.ts +0 -1
- package/dist/features/payments/repository/__tests__/payout.repository.test.js +0 -292
- package/dist/features/pre-orders/repository/preorders.repository.d.ts +0 -8
- package/dist/features/pre-orders/repository/preorders.repository.js +0 -25
- package/dist/features/products/repository/__tests__/product-features.repository.test.d.ts +0 -1
- package/dist/features/products/repository/__tests__/product-features.repository.test.js +0 -329
- package/dist/features/products/repository/__tests__/products.repository.test.d.ts +0 -1
- package/dist/features/products/repository/__tests__/products.repository.test.js +0 -607
- package/dist/features/promotions/repository/__tests__/claimed-coupons.repository.test.d.ts +0 -1
- package/dist/features/promotions/repository/__tests__/claimed-coupons.repository.test.js +0 -219
- package/dist/features/promotions/repository/__tests__/coupons.repository.test.d.ts +0 -1
- package/dist/features/promotions/repository/__tests__/coupons.repository.test.js +0 -480
- package/dist/features/promotions/repository/promotions.repository.d.ts +0 -14
- package/dist/features/promotions/repository/promotions.repository.js +0 -43
- package/dist/features/reviews/repository/__tests__/reviews.repository.test.d.ts +0 -1
- package/dist/features/reviews/repository/__tests__/reviews.repository.test.js +0 -327
- package/dist/features/scams/repository/__tests__/scammer.repository.test.d.ts +0 -1
- package/dist/features/scams/repository/__tests__/scammer.repository.test.js +0 -385
- package/dist/features/search/repository/__tests__/search.repository.test.d.ts +0 -1
- package/dist/features/search/repository/__tests__/search.repository.test.js +0 -369
- package/dist/features/seller/components/SellerStatCard.d.ts +0 -14
- package/dist/features/seller/components/SellerStatCard.js +0 -6
- package/dist/features/seller/components/seller-products-styles.d.ts +0 -7
- package/dist/features/seller/components/seller-products-styles.js +0 -14
- package/dist/features/seller/repository/__tests__/offer.repository.test.d.ts +0 -1
- package/dist/features/seller/repository/__tests__/offer.repository.test.js +0 -458
- package/dist/features/seller/repository/seller.repository.d.ts +0 -22
- package/dist/features/seller/repository/seller.repository.js +0 -72
- package/dist/features/site-settings/components/__tests__/ThemeManagerView.test.d.ts +0 -1
- package/dist/features/site-settings/components/__tests__/ThemeManagerView.test.js +0 -37
- package/dist/features/stores/repository/__tests__/store.repository.test.d.ts +0 -1
- package/dist/features/stores/repository/__tests__/store.repository.test.js +0 -261
- package/dist/features/stores/repository/stores.repository.d.ts +0 -11
- package/dist/features/stores/repository/stores.repository.js +0 -37
- package/dist/features/support/repository/__tests__/support.repository.test.d.ts +0 -1
- package/dist/features/support/repository/__tests__/support.repository.test.js +0 -312
- package/dist/features/wishlist/repository/__tests__/user-wishlist.repository.test.d.ts +0 -1
- package/dist/features/wishlist/repository/__tests__/user-wishlist.repository.test.js +0 -139
- package/dist/features/wishlist/repository/wishlist.repository.d.ts +0 -13
- package/dist/features/wishlist/repository/wishlist.repository.js +0 -31
- package/dist/providers/db-firebase/__tests__/filter-aliases.test.d.ts +0 -1
- package/dist/providers/db-firebase/__tests__/filter-aliases.test.js +0 -93
- package/dist/providers/shipping-shiprocket/index.d.ts +0 -297
- package/dist/providers/shipping-shiprocket/index.js +0 -194
- package/dist/providers/shipping-shiprocket/shiprocket-provider.d.ts +0 -45
- package/dist/providers/shipping-shiprocket/shiprocket-provider.js +0 -168
- package/dist/react/contexts/ThemeContext.d.ts +0 -13
- package/dist/react/contexts/ThemeContext.js +0 -64
- package/dist/schemas/webhooks/shiprocket.d.ts +0 -30
- package/dist/schemas/webhooks/shiprocket.js +0 -22
- package/dist/seed/actions/demo-seed-actions.d.ts +0 -42
- package/dist/seed/actions/demo-seed-actions.js +0 -36
- package/dist/seed/actions/index.d.ts +0 -1
- package/dist/seed/actions/index.js +0 -1
- package/dist/seed/sub-listings-seed-data.d.ts +0 -123
- package/dist/seed/sub-listings-seed-data.js +0 -447
- package/dist/seed/tester-checklist-seed-data.d.ts +0 -2
- package/dist/seed/tester-checklist-seed-data.js +0 -248
- package/dist/ui/components/DashboardStatsCard.d.ts +0 -15
- package/dist/ui/components/DashboardStatsCard.js +0 -27
- package/dist/ui/components/DashboardStatsCard.style.css +0 -68
- package/dist/ui/components/DynamicSelect.d.ts +0 -23
- package/dist/ui/components/DynamicSelect.js +0 -77
- package/dist/ui/components/DynamicSelect.style.css +0 -101
- package/dist/ui/components/InlineCreateSelect.d.ts +0 -48
- package/dist/ui/components/InlineCreateSelect.js +0 -75
- package/dist/ui/components/ListingViewShell.d.ts +0 -37
- package/dist/ui/components/ListingViewShell.js +0 -9
- package/dist/ui/components/PaginatedMultiSelect.d.ts +0 -28
- package/dist/ui/components/PaginatedMultiSelect.js +0 -141
- package/dist/ui/components/PaginatedMultiSelect.style.css +0 -272
- package/dist/ui/components/SectionTabs.d.ts +0 -19
- package/dist/ui/components/SectionTabs.js +0 -66
- package/dist/ui/components/SectionTabs.style.css +0 -164
- package/dist/ui/components/__tests__/BulkActionBar.test.d.ts +0 -1
- package/dist/ui/components/__tests__/BulkActionBar.test.js +0 -96
- package/dist/ui/components/__tests__/ListingToolbar.test.d.ts +0 -1
- package/dist/ui/components/__tests__/ListingToolbar.test.js +0 -125
- package/dist/ui/components/__tests__/new-primitives.test.d.ts +0 -1
- package/dist/ui/components/__tests__/new-primitives.test.js +0 -187
|
@@ -53,6 +53,13 @@ export const prizeDrawRule = {
|
|
|
53
53
|
prizeCurrentEntries: (product.prizeCurrentEntries ?? 0) + quantity,
|
|
54
54
|
};
|
|
55
55
|
},
|
|
56
|
+
stockIncrementExtras: (product, quantity) => {
|
|
57
|
+
if (product.listingType !== "prize-draw")
|
|
58
|
+
return {};
|
|
59
|
+
return {
|
|
60
|
+
prizeCurrentEntries: Math.max(0, (product.prizeCurrentEntries ?? 0) - quantity),
|
|
61
|
+
};
|
|
62
|
+
},
|
|
56
63
|
decorateOrderItem: (line, product) => ({
|
|
57
64
|
...line,
|
|
58
65
|
listingType: "prize-draw",
|
|
@@ -107,6 +107,17 @@ export interface ListingCheckoutRule {
|
|
|
107
107
|
* Prize-draw bumps `prizeCurrentEntries`. Pre-order bumps `preOrderCurrentCount`.
|
|
108
108
|
*/
|
|
109
109
|
stockDecrementExtras(product: ProductDocument, quantity: number): Record<string, JsonValue>;
|
|
110
|
+
/**
|
|
111
|
+
* Return extra Firestore field updates to merge alongside the standard
|
|
112
|
+
* `availableQuantity` restore, when an order's payment window expires (or
|
|
113
|
+
* its proof is rejected as fraudulent) and its stock must be returned to
|
|
114
|
+
* the public pool. The symmetric inverse of `stockDecrementExtras` — NOT
|
|
115
|
+
* simply the same extras with a negated quantity, since decrement extras
|
|
116
|
+
* bump a counter UP as stock goes down (e.g. `prizeCurrentEntries`), so
|
|
117
|
+
* the restore side must bump that same counter back DOWN. Pure — works
|
|
118
|
+
* from product data already fetched by the calling job/action.
|
|
119
|
+
*/
|
|
120
|
+
stockIncrementExtras(product: ProductDocument, quantity: number): Record<string, JsonValue>;
|
|
110
121
|
/**
|
|
111
122
|
* Transform a raw order-line input (built from cart item data) before it
|
|
112
123
|
* is written to the OrderDocument. Adds type-specific fields such as
|
|
@@ -13,7 +13,7 @@ export class AuctionEndedError extends ExpiredError {
|
|
|
13
13
|
}
|
|
14
14
|
export class BidTooLowError extends ValidationError {
|
|
15
15
|
constructor(minBid) {
|
|
16
|
-
super(`Bid must be at least ₹${
|
|
16
|
+
super(`Bid must be at least ₹${minBid.toLocaleString("en-IN")}`, "amount");
|
|
17
17
|
this.name = "BidTooLowError";
|
|
18
18
|
}
|
|
19
19
|
}
|
|
@@ -79,7 +79,6 @@ export declare const BUNDLE_COPY: {
|
|
|
79
79
|
readonly descriptionPlaceholder: "One paragraph describing what's in the bundle and who it's for.";
|
|
80
80
|
readonly priceLabel: "Bundle price (₹) *";
|
|
81
81
|
readonly pricePlaceholder: "6499";
|
|
82
|
-
readonly pricePaiseHint: (paise: number | null) => string;
|
|
83
82
|
readonly coverImageLabel: "Cover image URL";
|
|
84
83
|
readonly activeLabel: "Bundle is active (visible to buyers)";
|
|
85
84
|
};
|
|
@@ -88,7 +88,6 @@ export const BUNDLE_COPY = {
|
|
|
88
88
|
descriptionPlaceholder: "One paragraph describing what's in the bundle and who it's for.",
|
|
89
89
|
priceLabel: "Bundle price (₹) *",
|
|
90
90
|
pricePlaceholder: "6499",
|
|
91
|
-
pricePaiseHint: (paise) => `Stored as paise: ${paise ?? "—"}`,
|
|
92
91
|
coverImageLabel: "Cover image URL",
|
|
93
92
|
activeLabel: "Bundle is active (visible to buyers)",
|
|
94
93
|
},
|
|
@@ -81,7 +81,7 @@ export declare const bundleCreateSchema: z.ZodObject<{
|
|
|
81
81
|
* "brand" — brand discovery collection; does not touch product reverse pointers.
|
|
82
82
|
*/
|
|
83
83
|
bundleKind: z.ZodEnum<["special", "brand"]>;
|
|
84
|
-
|
|
84
|
+
bundlePrice: z.ZodNumber;
|
|
85
85
|
bundleQueryRule: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
86
86
|
type: z.ZodLiteral<"static">;
|
|
87
87
|
productIds: z.ZodArray<z.ZodString, "many">;
|
|
@@ -163,7 +163,7 @@ export declare const bundleCreateSchema: z.ZodObject<{
|
|
|
163
163
|
name: string;
|
|
164
164
|
bundleProductIds: string[];
|
|
165
165
|
bundleKind: "brand" | "special";
|
|
166
|
-
|
|
166
|
+
bundlePrice: number;
|
|
167
167
|
bundleQueryRule: {
|
|
168
168
|
type: "static";
|
|
169
169
|
productIds: string[];
|
|
@@ -194,7 +194,7 @@ export declare const bundleCreateSchema: z.ZodObject<{
|
|
|
194
194
|
name: string;
|
|
195
195
|
bundleProductIds: string[];
|
|
196
196
|
bundleKind: "brand" | "special";
|
|
197
|
-
|
|
197
|
+
bundlePrice: number;
|
|
198
198
|
bundleQueryRule: {
|
|
199
199
|
type: "static";
|
|
200
200
|
productIds: string[];
|
|
@@ -226,7 +226,7 @@ export declare const bundleUpdateSchema: z.ZodObject<{
|
|
|
226
226
|
name: z.ZodOptional<z.ZodString>;
|
|
227
227
|
description: z.ZodOptional<z.ZodString>;
|
|
228
228
|
bundleKind: z.ZodOptional<z.ZodEnum<["special", "brand"]>>;
|
|
229
|
-
|
|
229
|
+
bundlePrice: z.ZodOptional<z.ZodNumber>;
|
|
230
230
|
bundleQueryRule: z.ZodOptional<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
231
231
|
type: z.ZodLiteral<"static">;
|
|
232
232
|
productIds: z.ZodArray<z.ZodString, "many">;
|
|
@@ -318,7 +318,7 @@ export declare const bundleUpdateSchema: z.ZodObject<{
|
|
|
318
318
|
productId: string;
|
|
319
319
|
drawCount?: number | undefined;
|
|
320
320
|
}[] | undefined;
|
|
321
|
-
|
|
321
|
+
bundlePrice?: number | undefined;
|
|
322
322
|
bundleQueryRule?: {
|
|
323
323
|
type: "static";
|
|
324
324
|
productIds: string[];
|
|
@@ -348,7 +348,7 @@ export declare const bundleUpdateSchema: z.ZodObject<{
|
|
|
348
348
|
productId: string;
|
|
349
349
|
drawCount?: number | undefined;
|
|
350
350
|
}[] | undefined;
|
|
351
|
-
|
|
351
|
+
bundlePrice?: number | undefined;
|
|
352
352
|
bundleQueryRule?: {
|
|
353
353
|
type: "static";
|
|
354
354
|
productIds: string[];
|
|
@@ -52,7 +52,7 @@ export const bundleCreateSchema = z.object({
|
|
|
52
52
|
* "brand" — brand discovery collection; does not touch product reverse pointers.
|
|
53
53
|
*/
|
|
54
54
|
bundleKind: z.enum([BUNDLE_KIND_SPECIAL, BUNDLE_KIND_BRAND]),
|
|
55
|
-
|
|
55
|
+
bundlePrice: z.number().min(1),
|
|
56
56
|
bundleQueryRule: bundleQueryRuleSchema,
|
|
57
57
|
bundleProductIds: productIdsSchema,
|
|
58
58
|
/** Richer per-member metadata (draw counts for prize-draws). */
|
|
@@ -64,7 +64,7 @@ export const bundleUpdateSchema = z.object({
|
|
|
64
64
|
name: z.string().min(2).max(120).optional(),
|
|
65
65
|
description: z.string().max(2000).optional(),
|
|
66
66
|
bundleKind: z.enum([BUNDLE_KIND_SPECIAL, BUNDLE_KIND_BRAND]).optional(),
|
|
67
|
-
|
|
67
|
+
bundlePrice: z.number().min(1).optional(),
|
|
68
68
|
bundleQueryRule: bundleQueryRuleSchema.optional(),
|
|
69
69
|
bundleProductIds: productIdsSchema.optional(),
|
|
70
70
|
bundleItemDetails: z.array(bundleItemDetailSchema).optional(),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const CHECKOUT_DEFAULT_COMMISSIONS: {
|
|
2
2
|
readonly codDepositPercent: 10;
|
|
3
|
-
readonly
|
|
3
|
+
readonly codHandlingFeeMin: 200;
|
|
4
4
|
readonly codHandlingFeePercent: 10;
|
|
5
5
|
readonly sellerShippingFixed: 50;
|
|
6
6
|
readonly platformShippingPercent: 10;
|
|
@@ -10,8 +10,8 @@ export declare const CHECKOUT_PAYMENT_METHODS: readonly ["cash", "cod", "online"
|
|
|
10
10
|
export type CheckoutPaymentMethod = (typeof CHECKOUT_PAYMENT_METHODS)[number];
|
|
11
11
|
export declare const CHECKOUT_DEFAULT_EMI_SETTINGS: {
|
|
12
12
|
readonly enabled: false;
|
|
13
|
-
/** ₹10,000
|
|
14
|
-
readonly
|
|
13
|
+
/** ₹10,000 — a seller's cart subtotal must exceed this for EMI to appear. */
|
|
14
|
+
readonly minOrderValue: 10000;
|
|
15
15
|
readonly tenureOptions: readonly [2, 3, 4, 5, 6];
|
|
16
16
|
readonly tokenPercent: 10;
|
|
17
17
|
/** Day of the month (1–10) the first (and every) installment is due. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export const CHECKOUT_DEFAULT_COMMISSIONS = {
|
|
2
2
|
codDepositPercent: 10,
|
|
3
|
-
|
|
3
|
+
codHandlingFeeMin: 200,
|
|
4
4
|
codHandlingFeePercent: 10,
|
|
5
5
|
sellerShippingFixed: 50,
|
|
6
6
|
platformShippingPercent: 10,
|
|
@@ -9,8 +9,8 @@ export const CHECKOUT_DEFAULT_COMMISSIONS = {
|
|
|
9
9
|
export const CHECKOUT_PAYMENT_METHODS = ["cash", "cod", "online", "upi_manual", "admin_bypass", "emi"];
|
|
10
10
|
export const CHECKOUT_DEFAULT_EMI_SETTINGS = {
|
|
11
11
|
enabled: false,
|
|
12
|
-
/** ₹10,000
|
|
13
|
-
|
|
12
|
+
/** ₹10,000 — a seller's cart subtotal must exceed this for EMI to appear. */
|
|
13
|
+
minOrderValue: 10000,
|
|
14
14
|
tenureOptions: [2, 3, 4, 5, 6],
|
|
15
15
|
tokenPercent: 10,
|
|
16
16
|
/** Day of the month (1–10) the first (and every) installment is due. */
|
|
@@ -13,11 +13,11 @@
|
|
|
13
13
|
* payment across `tenureMonths`, split between platform and seller per
|
|
14
14
|
* `surchargeSellerSharePercent`) across equal monthly installments, each
|
|
15
15
|
* due on `billingDay` (1–10) of the month, starting the month after
|
|
16
|
-
* purchase. All money amounts are in
|
|
16
|
+
* purchase. All money amounts are in decimal rupees.
|
|
17
17
|
*/
|
|
18
18
|
export interface EmiSettings {
|
|
19
19
|
enabled: boolean;
|
|
20
|
-
|
|
20
|
+
minOrderValue: number;
|
|
21
21
|
tenureOptions: readonly number[];
|
|
22
22
|
tokenPercent: number;
|
|
23
23
|
/** Day of month (1–10) each installment is due. */
|
|
@@ -37,17 +37,17 @@ export type EmiEligibility = {
|
|
|
37
37
|
* `sellerEmiEnabled` is the seller's own opt-in (`StoreDocument.emiEnabled`).
|
|
38
38
|
* Both must be true, in addition to the subtotal threshold.
|
|
39
39
|
*/
|
|
40
|
-
export declare function checkEmiEligibility(sellerSubtotal: number, sellerEmiEnabled: boolean, settings: Pick<EmiSettings, "enabled" | "
|
|
40
|
+
export declare function checkEmiEligibility(sellerSubtotal: number, sellerEmiEnabled: boolean, settings: Pick<EmiSettings, "enabled" | "minOrderValue">): EmiEligibility;
|
|
41
41
|
export interface EmiInstallmentPlan {
|
|
42
42
|
index: number;
|
|
43
43
|
dueDate: Date;
|
|
44
|
-
/**
|
|
44
|
+
/** Decimal rupees. */
|
|
45
45
|
amount: number;
|
|
46
46
|
}
|
|
47
47
|
export interface EmiScheduleResult {
|
|
48
|
-
/** Down payment collected at checkout,
|
|
48
|
+
/** Down payment collected at checkout, decimal rupees. */
|
|
49
49
|
tokenAmount: number;
|
|
50
|
-
/** Total surcharge across the whole tenure,
|
|
50
|
+
/** Total surcharge across the whole tenure, decimal rupees. */
|
|
51
51
|
surchargeAmount: number;
|
|
52
52
|
surchargeSellerShare: number;
|
|
53
53
|
surchargePlatformShare: number;
|
|
@@ -13,8 +13,9 @@
|
|
|
13
13
|
* payment across `tenureMonths`, split between platform and seller per
|
|
14
14
|
* `surchargeSellerSharePercent`) across equal monthly installments, each
|
|
15
15
|
* due on `billingDay` (1–10) of the month, starting the month after
|
|
16
|
-
* purchase. All money amounts are in
|
|
16
|
+
* purchase. All money amounts are in decimal rupees.
|
|
17
17
|
*/
|
|
18
|
+
import { roundRupees } from "../../../../utils/number.formatter";
|
|
18
19
|
/**
|
|
19
20
|
* `settings.enabled` is the site-wide toggle (`siteSettings.emi.enabled`).
|
|
20
21
|
* `sellerEmiEnabled` is the seller's own opt-in (`StoreDocument.emiEnabled`).
|
|
@@ -25,7 +26,7 @@ export function checkEmiEligibility(sellerSubtotal, sellerEmiEnabled, settings)
|
|
|
25
26
|
return { eligible: false, reason: "site_disabled" };
|
|
26
27
|
if (!sellerEmiEnabled)
|
|
27
28
|
return { eligible: false, reason: "seller_disabled" };
|
|
28
|
-
if (sellerSubtotal <= settings.
|
|
29
|
+
if (sellerSubtotal <= settings.minOrderValue)
|
|
29
30
|
return { eligible: false, reason: "below_minimum" };
|
|
30
31
|
return { eligible: true };
|
|
31
32
|
}
|
|
@@ -35,14 +36,14 @@ export function checkEmiEligibility(sellerSubtotal, sellerEmiEnabled, settings)
|
|
|
35
36
|
* month the purchase happens on.
|
|
36
37
|
*/
|
|
37
38
|
export function computeEmiSchedule(sellerSubtotal, tenureMonths, settings, purchaseDate = new Date()) {
|
|
38
|
-
const tokenAmount =
|
|
39
|
+
const tokenAmount = roundRupees(sellerSubtotal * (settings.tokenPercent / 100));
|
|
39
40
|
const principalRemaining = sellerSubtotal - tokenAmount;
|
|
40
|
-
const surchargeAmount =
|
|
41
|
-
const surchargeSellerShare =
|
|
42
|
-
const surchargePlatformShare = surchargeAmount - surchargeSellerShare;
|
|
43
|
-
const totalToInstall = principalRemaining + surchargeAmount;
|
|
44
|
-
const baseInstallment = Math.floor(totalToInstall / tenureMonths);
|
|
45
|
-
const remainder = totalToInstall - baseInstallment * tenureMonths;
|
|
41
|
+
const surchargeAmount = roundRupees(principalRemaining * (settings.surchargePercentPerMonth / 100) * tenureMonths);
|
|
42
|
+
const surchargeSellerShare = roundRupees(surchargeAmount * (settings.surchargeSellerSharePercent / 100));
|
|
43
|
+
const surchargePlatformShare = roundRupees(surchargeAmount - surchargeSellerShare);
|
|
44
|
+
const totalToInstall = roundRupees(principalRemaining + surchargeAmount);
|
|
45
|
+
const baseInstallment = roundRupees(Math.floor((totalToInstall / tenureMonths) * 100) / 100);
|
|
46
|
+
const remainder = roundRupees(totalToInstall - baseInstallment * tenureMonths);
|
|
46
47
|
const billingDay = Math.min(Math.max(settings.billingDay, 1), 10);
|
|
47
48
|
const installments = [];
|
|
48
49
|
for (let i = 1; i <= tenureMonths; i++) {
|
|
@@ -25,7 +25,7 @@ export class CouponPerUserLimitError extends ConflictError {
|
|
|
25
25
|
}
|
|
26
26
|
export class CouponMinPurchaseError extends ValidationError {
|
|
27
27
|
constructor(minAmount) {
|
|
28
|
-
super(`Minimum purchase of ₹${
|
|
28
|
+
super(`Minimum purchase of ₹${minAmount.toLocaleString("en-IN")} required for this coupon`, "total");
|
|
29
29
|
this.name = "CouponMinPurchaseError";
|
|
30
30
|
}
|
|
31
31
|
}
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* - `computePayoutDeduction` — what's deducted from the SELLER's payout
|
|
13
13
|
* (platform fee + gateway fee + GST on the platform fee).
|
|
14
14
|
*
|
|
15
|
-
* All money amounts are in
|
|
15
|
+
* All money amounts are in decimal rupees.
|
|
16
16
|
*/
|
|
17
17
|
export interface FeeCommissionRates {
|
|
18
18
|
platformFeePercent: number;
|
|
@@ -44,8 +44,8 @@ export interface PayoutDeduction {
|
|
|
44
44
|
}
|
|
45
45
|
export declare function computePayoutDeduction(grossAmount: number, commissions: FeeCommissionRates): PayoutDeduction;
|
|
46
46
|
export interface CodHandlingFeeRates {
|
|
47
|
-
/** Optional so existing `siteSettings` documents saved before this field existed don't produce NaN — falls back to ₹200
|
|
48
|
-
|
|
47
|
+
/** Optional so existing `siteSettings` documents saved before this field existed don't produce NaN — falls back to ₹200. */
|
|
48
|
+
codHandlingFeeMin?: number;
|
|
49
49
|
/** Optional for the same reason — falls back to 10%. */
|
|
50
50
|
codHandlingFeePercent?: number;
|
|
51
51
|
}
|
|
@@ -54,7 +54,7 @@ export declare function computeCodHandlingFee(subtotal: number, rates: CodHandli
|
|
|
54
54
|
/**
|
|
55
55
|
* P-8 GST — buyer-facing product tax, distinct from the platform-commission
|
|
56
56
|
* GST above. Intra-state orders split the rate evenly between CGST + SGST;
|
|
57
|
-
* inter-state orders charge the full rate as IGST. All amounts in
|
|
57
|
+
* inter-state orders charge the full rate as IGST. All amounts in decimal rupees.
|
|
58
58
|
*/
|
|
59
59
|
export interface GstBreakdown {
|
|
60
60
|
taxableAmount: number;
|
|
@@ -63,4 +63,4 @@ export interface GstBreakdown {
|
|
|
63
63
|
igst: number;
|
|
64
64
|
gstAmount: number;
|
|
65
65
|
}
|
|
66
|
-
export declare function calculateGst(rate: number, intraState: boolean,
|
|
66
|
+
export declare function calculateGst(rate: number, intraState: boolean, taxableAmount: number): GstBreakdown;
|
|
@@ -12,37 +12,37 @@
|
|
|
12
12
|
* - `computePayoutDeduction` — what's deducted from the SELLER's payout
|
|
13
13
|
* (platform fee + gateway fee + GST on the platform fee).
|
|
14
14
|
*
|
|
15
|
-
* All money amounts are in
|
|
15
|
+
* All money amounts are in decimal rupees.
|
|
16
16
|
*/
|
|
17
|
+
import { roundRupees } from "../../../utils/number.formatter";
|
|
17
18
|
export function computeCheckoutFees(subtotal, commissions) {
|
|
18
|
-
const platformFee =
|
|
19
|
-
const gstOnFee =
|
|
20
|
-
const
|
|
21
|
-
const totalFee = Math.max(platformFee + gstOnFee, minimumTransactionFeeInPaise);
|
|
19
|
+
const platformFee = roundRupees(subtotal * (commissions.platformFeePercent / 100));
|
|
20
|
+
const gstOnFee = roundRupees(platformFee * (commissions.gstPercent / 100));
|
|
21
|
+
const totalFee = Math.max(platformFee + gstOnFee, commissions.minimumTransactionFee ?? 0);
|
|
22
22
|
return { platformFee, gstOnFee, totalFee };
|
|
23
23
|
}
|
|
24
24
|
export function computePayoutDeduction(grossAmount, commissions) {
|
|
25
|
-
const platformFee =
|
|
26
|
-
const gatewayFee =
|
|
27
|
-
const gstOnFee =
|
|
28
|
-
const totalDeduction = platformFee + gatewayFee + gstOnFee;
|
|
29
|
-
const netAmount = Math.max(0, grossAmount - totalDeduction);
|
|
25
|
+
const platformFee = roundRupees(grossAmount * (commissions.platformFeePercent / 100));
|
|
26
|
+
const gatewayFee = roundRupees(grossAmount * ((commissions.gatewayFeePercent ?? 0) / 100));
|
|
27
|
+
const gstOnFee = roundRupees(platformFee * (commissions.gstPercent / 100));
|
|
28
|
+
const totalDeduction = roundRupees(platformFee + gatewayFee + gstOnFee);
|
|
29
|
+
const netAmount = Math.max(0, roundRupees(grossAmount - totalDeduction));
|
|
30
30
|
return { platformFee, gatewayFee, gstOnFee, totalDeduction, netAmount };
|
|
31
31
|
}
|
|
32
|
-
const
|
|
32
|
+
const DEFAULT_COD_HANDLING_FEE_MIN = 200;
|
|
33
33
|
const DEFAULT_COD_HANDLING_FEE_PERCENT = 10;
|
|
34
34
|
/** COD handling fee charged to the buyer: max(fixed floor, subtotal × percent). */
|
|
35
35
|
export function computeCodHandlingFee(subtotal, rates) {
|
|
36
|
-
const
|
|
36
|
+
const min = rates.codHandlingFeeMin ?? DEFAULT_COD_HANDLING_FEE_MIN;
|
|
37
37
|
const percent = rates.codHandlingFeePercent ?? DEFAULT_COD_HANDLING_FEE_PERCENT;
|
|
38
|
-
const percentFee =
|
|
39
|
-
return Math.max(
|
|
38
|
+
const percentFee = roundRupees(subtotal * (percent / 100));
|
|
39
|
+
return Math.max(min, percentFee);
|
|
40
40
|
}
|
|
41
|
-
export function calculateGst(rate, intraState,
|
|
42
|
-
const gstAmount =
|
|
41
|
+
export function calculateGst(rate, intraState, taxableAmount) {
|
|
42
|
+
const gstAmount = roundRupees(taxableAmount * (rate / 100));
|
|
43
43
|
if (intraState) {
|
|
44
|
-
const half =
|
|
45
|
-
return { taxableAmount
|
|
44
|
+
const half = roundRupees(gstAmount / 2);
|
|
45
|
+
return { taxableAmount, cgst: half, sgst: half, igst: 0, gstAmount: roundRupees(half * 2) };
|
|
46
46
|
}
|
|
47
|
-
return { taxableAmount
|
|
47
|
+
return { taxableAmount, cgst: 0, sgst: 0, igst: gstAmount, gstAmount };
|
|
48
48
|
}
|
package/dist/client.d.ts
CHANGED
|
@@ -160,7 +160,7 @@ export { ZodSetup } from "./validation/ZodSetup";
|
|
|
160
160
|
export type { ZodSetupProps } from "./validation/ZodSetup";
|
|
161
161
|
export { AdminSidebar } from "./features/admin/components/AdminSidebar";
|
|
162
162
|
export type { AdminSidebarProps, AdminNavItem, AdminNavGroup } from "./features/admin/components/AdminSidebar";
|
|
163
|
-
export { AdminDashboardView, AdminAnalyticsView, AdminPageViewsReportView, AdminPrizeDrawsView, AdminCarouselView, AdminSublistingCategoriesView, AdminFulfillmentView, DataTable, DataListingView, useAdminListingData, toRecordArray, toStringValue, toRelativeDate
|
|
163
|
+
export { AdminDashboardView, AdminAnalyticsView, AdminPageViewsReportView, AdminPrizeDrawsView, AdminCarouselView, AdminSublistingCategoriesView, AdminFulfillmentView, DataTable, DataListingView, useAdminListingData, toRecordArray, toStringValue, toRelativeDate } from "./features/admin/index";
|
|
164
164
|
export type { AdminDashboardViewProps, AdminAnalyticsViewProps, AdminAnalyticsViewLabels, AdminPageViewsReportViewProps, AdminPrizeDrawsViewProps, AdminCarouselViewProps, AdminFulfillmentViewProps, AdminListingScaffoldRow, ListingViewConfig } from "./features/admin/index";
|
|
165
165
|
export type { BulkActionItem } from "./ui/components/BulkActionBar";
|
|
166
166
|
export { ADMIN_ENDPOINTS } from "./constants/index";
|
package/dist/client.js
CHANGED
|
@@ -204,7 +204,7 @@ export { Search } from "./features/search/components";
|
|
|
204
204
|
export { ToastProvider, SkipToMain, NavigationLoader } from "./ui/index";
|
|
205
205
|
export { ZodSetup } from "./validation/ZodSetup";
|
|
206
206
|
export { AdminSidebar } from "./features/admin/components/AdminSidebar";
|
|
207
|
-
export { AdminDashboardView, AdminAnalyticsView, AdminPageViewsReportView, AdminPrizeDrawsView, AdminCarouselView, AdminSublistingCategoriesView, AdminFulfillmentView, DataTable, DataListingView, useAdminListingData, toRecordArray, toStringValue, toRelativeDate
|
|
207
|
+
export { AdminDashboardView, AdminAnalyticsView, AdminPageViewsReportView, AdminPrizeDrawsView, AdminCarouselView, AdminSublistingCategoriesView, AdminFulfillmentView, DataTable, DataListingView, useAdminListingData, toRecordArray, toStringValue, toRelativeDate } from "./features/admin/index";
|
|
208
208
|
export { ADMIN_ENDPOINTS } from "./constants/index";
|
|
209
209
|
export { SELLER_ENDPOINTS } from "./constants/index";
|
|
210
210
|
// P-16 — Tour system (driver.js-backed onboarding walkthrough).
|
|
@@ -96,6 +96,8 @@ export declare const ADMIN_ENDPOINTS: {
|
|
|
96
96
|
readonly ORDER_BY_ID: (id: string) => string;
|
|
97
97
|
readonly ORDER_REFUND: (id: string) => string;
|
|
98
98
|
readonly ORDER_PAYMENT_VERIFY: (id: string) => string;
|
|
99
|
+
readonly ORDER_PAYMENT_REUPLOAD: (id: string) => string;
|
|
100
|
+
readonly ORDER_PAYMENT_REJECT_FRAUD: (id: string) => string;
|
|
99
101
|
readonly USERS: "/api/admin/users";
|
|
100
102
|
readonly USERS_BULK: "/api/admin/users/bulk";
|
|
101
103
|
readonly USER_BY_ID: (uid: string) => string;
|
|
@@ -309,6 +311,7 @@ export declare const ORDER_ENDPOINTS: {
|
|
|
309
311
|
readonly BY_ID: (id: string) => string;
|
|
310
312
|
readonly TRACK: (trackingId: string) => string;
|
|
311
313
|
readonly PAYMENT_PROOF: (id: string) => string;
|
|
314
|
+
readonly DISPUTE: (id: string) => string;
|
|
312
315
|
};
|
|
313
316
|
export declare const PREORDER_ENDPOINTS: {
|
|
314
317
|
readonly LIST: "/api/pre-orders";
|
|
@@ -539,6 +542,8 @@ export declare const API_ENDPOINTS: {
|
|
|
539
542
|
readonly ORDER_BY_ID: (id: string) => string;
|
|
540
543
|
readonly ORDER_REFUND: (id: string) => string;
|
|
541
544
|
readonly ORDER_PAYMENT_VERIFY: (id: string) => string;
|
|
545
|
+
readonly ORDER_PAYMENT_REUPLOAD: (id: string) => string;
|
|
546
|
+
readonly ORDER_PAYMENT_REJECT_FRAUD: (id: string) => string;
|
|
542
547
|
readonly USERS: "/api/admin/users";
|
|
543
548
|
readonly USERS_BULK: "/api/admin/users/bulk";
|
|
544
549
|
readonly USER_BY_ID: (uid: string) => string;
|
|
@@ -755,6 +760,7 @@ export declare const API_ENDPOINTS: {
|
|
|
755
760
|
readonly BY_ID: (id: string) => string;
|
|
756
761
|
readonly TRACK: (trackingId: string) => string;
|
|
757
762
|
readonly PAYMENT_PROOF: (id: string) => string;
|
|
763
|
+
readonly DISPUTE: (id: string) => string;
|
|
758
764
|
};
|
|
759
765
|
readonly PREORDERS: {
|
|
760
766
|
readonly LIST: "/api/pre-orders";
|
|
@@ -984,6 +990,8 @@ export declare const API_ROUTES: {
|
|
|
984
990
|
readonly ORDER_BY_ID: (id: string) => string;
|
|
985
991
|
readonly ORDER_REFUND: (id: string) => string;
|
|
986
992
|
readonly ORDER_PAYMENT_VERIFY: (id: string) => string;
|
|
993
|
+
readonly ORDER_PAYMENT_REUPLOAD: (id: string) => string;
|
|
994
|
+
readonly ORDER_PAYMENT_REJECT_FRAUD: (id: string) => string;
|
|
987
995
|
readonly USERS: "/api/admin/users";
|
|
988
996
|
readonly USERS_BULK: "/api/admin/users/bulk";
|
|
989
997
|
readonly USER_BY_ID: (uid: string) => string;
|
|
@@ -1200,6 +1208,7 @@ export declare const API_ROUTES: {
|
|
|
1200
1208
|
readonly BY_ID: (id: string) => string;
|
|
1201
1209
|
readonly TRACK: (trackingId: string) => string;
|
|
1202
1210
|
readonly PAYMENT_PROOF: (id: string) => string;
|
|
1211
|
+
readonly DISPUTE: (id: string) => string;
|
|
1203
1212
|
};
|
|
1204
1213
|
readonly PREORDERS: {
|
|
1205
1214
|
readonly LIST: "/api/pre-orders";
|
|
@@ -123,6 +123,8 @@ export const ADMIN_ENDPOINTS = {
|
|
|
123
123
|
ORDER_BY_ID: (id) => `/api/admin/orders/${id}`,
|
|
124
124
|
ORDER_REFUND: (id) => `/api/admin/orders/${id}/refund`,
|
|
125
125
|
ORDER_PAYMENT_VERIFY: (id) => `/api/admin/orders/${id}/payment-verify`,
|
|
126
|
+
ORDER_PAYMENT_REUPLOAD: (id) => `/api/admin/orders/${id}/payment-reupload`,
|
|
127
|
+
ORDER_PAYMENT_REJECT_FRAUD: (id) => `/api/admin/orders/${id}/payment-reject-fraud`,
|
|
126
128
|
USERS: "/api/admin/users",
|
|
127
129
|
USERS_BULK: "/api/admin/users/bulk",
|
|
128
130
|
USER_BY_ID: (uid) => `/api/admin/users/${uid}`,
|
|
@@ -402,6 +404,7 @@ export const ORDER_ENDPOINTS = {
|
|
|
402
404
|
BY_ID: (id) => `/api/orders/${id}`,
|
|
403
405
|
TRACK: (trackingId) => `/api/orders/track/${trackingId}`,
|
|
404
406
|
PAYMENT_PROOF: (id) => `/api/orders/${id}/payment-proof`,
|
|
407
|
+
DISPUTE: (id) => `/api/orders/${id}/dispute`,
|
|
405
408
|
};
|
|
406
409
|
// ---------------------------------------------------------------------------
|
|
407
410
|
// Pre-orders
|
|
@@ -168,6 +168,10 @@ export declare const ORDER_FIELDS: {
|
|
|
168
168
|
readonly BUNDLE_ID: "bundleId";
|
|
169
169
|
readonly CREATED_AT: "createdAt";
|
|
170
170
|
readonly UPDATED_AT: "updatedAt";
|
|
171
|
+
readonly PAYMENT_DEADLINE: "paymentDeadline";
|
|
172
|
+
readonly PAYMENT_PROOF_URL: "paymentProofUrl";
|
|
173
|
+
readonly PAYMENT_PROOF_UPLOADED_AT: "paymentProofUploadedAt";
|
|
174
|
+
readonly PAYMENT_REVIEW_OUTCOME: "paymentReviewOutcome";
|
|
171
175
|
readonly STATUS_VALUES: {
|
|
172
176
|
readonly PENDING: "pending";
|
|
173
177
|
readonly CONFIRMED: "confirmed";
|
|
@@ -181,6 +181,10 @@ export const ORDER_FIELDS = {
|
|
|
181
181
|
BUNDLE_ID: "bundleId",
|
|
182
182
|
CREATED_AT: "createdAt",
|
|
183
183
|
UPDATED_AT: "updatedAt",
|
|
184
|
+
PAYMENT_DEADLINE: "paymentDeadline",
|
|
185
|
+
PAYMENT_PROOF_URL: "paymentProofUrl",
|
|
186
|
+
PAYMENT_PROOF_UPLOADED_AT: "paymentProofUploadedAt",
|
|
187
|
+
PAYMENT_REVIEW_OUTCOME: "paymentReviewOutcome",
|
|
184
188
|
STATUS_VALUES: {
|
|
185
189
|
PENDING: "pending",
|
|
186
190
|
CONFIRMED: "confirmed",
|
|
@@ -8,7 +8,7 @@ import { sortBy } from "@mohasinac/appkit";
|
|
|
8
8
|
import React from "react";
|
|
9
9
|
import { ListingLayout } from "../../../ui";
|
|
10
10
|
import { ADMIN_ENDPOINTS } from "../../../constants/api-endpoints";
|
|
11
|
-
import { toRecordArray, toRelativeDate,
|
|
11
|
+
import { toRecordArray, toRelativeDate, toCurrency, toStringValue, } from "../hooks/useAdminListingData";
|
|
12
12
|
import { DataListingView } from "./DataListingView";
|
|
13
13
|
const ADMIN_ART_CONFIG = {
|
|
14
14
|
portal: "admin",
|
|
@@ -29,7 +29,7 @@ const ADMIN_ART_CONFIG = {
|
|
|
29
29
|
primary: toStringValue(item.title ?? item.productTitle, "Untitled print"),
|
|
30
30
|
secondary: [
|
|
31
31
|
toStringValue(item.sellerName, "Unknown seller"),
|
|
32
|
-
|
|
32
|
+
toCurrency(item.price),
|
|
33
33
|
].join(" · "),
|
|
34
34
|
status: toStringValue(item.status, "draft"),
|
|
35
35
|
updatedAt: toRelativeDate(item.updatedAt ?? item.createdAt),
|
|
@@ -10,7 +10,7 @@ import { ADMIN_ENDPOINTS } from "../../../constants/api-endpoints";
|
|
|
10
10
|
import { ADMIN_BID_STATUS_TABS } from "../constants/filter-tabs";
|
|
11
11
|
import { ACTIONS } from "../../../_internal/shared/actions/action-registry";
|
|
12
12
|
import { ROW_ACTION_META, ROW_ACTION_ID } from "../../products/constants/action-defs";
|
|
13
|
-
import { toRecordArray, toRelativeDate,
|
|
13
|
+
import { toRecordArray, toRelativeDate, toCurrency, toStringValue, } from "../hooks/useAdminListingData";
|
|
14
14
|
import { DataListingView } from "./DataListingView";
|
|
15
15
|
import { apiClient } from "../../../http";
|
|
16
16
|
export function AdminBidsView({ children, ...props }) {
|
|
@@ -53,7 +53,7 @@ export function AdminBidsView({ children, ...props }) {
|
|
|
53
53
|
id: toStringValue(item.id, `bid-${index}`),
|
|
54
54
|
primary: [
|
|
55
55
|
toStringValue(item.productName ?? item.productTitle, "Unknown item"),
|
|
56
|
-
|
|
56
|
+
toCurrency(item.bidAmount ?? item.amount),
|
|
57
57
|
].join(" · "),
|
|
58
58
|
secondary: toStringValue(item.bidderId ?? item.bidderName ?? item.userId, "Unknown bidder"),
|
|
59
59
|
status: toStringValue(item.status, "active"),
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Unified create + edit view for categoryType:"bundle" rows. When `bundleId`
|
|
5
5
|
* is set, loads + edits; when omitted, runs as a "new" form. Delegates to
|
|
6
|
-
* /api/admin/bundles. Owns: name + description +
|
|
6
|
+
* /api/admin/bundles. Owns: name + description + bundlePrice +
|
|
7
7
|
* static-only product picker + isActive. Dynamic-rule editing is out of scope
|
|
8
8
|
* for this session (the API accepts dynamic rules but the form only writes
|
|
9
9
|
* static rules; admins editing a pre-existing dynamic bundle see its members
|
|
@@ -6,7 +6,7 @@ import { normalizeError } from "../../../errors/normalize";
|
|
|
6
6
|
*
|
|
7
7
|
* Unified create + edit view for categoryType:"bundle" rows. When `bundleId`
|
|
8
8
|
* is set, loads + edits; when omitted, runs as a "new" form. Delegates to
|
|
9
|
-
* /api/admin/bundles. Owns: name + description +
|
|
9
|
+
* /api/admin/bundles. Owns: name + description + bundlePrice +
|
|
10
10
|
* static-only product picker + isActive. Dynamic-rule editing is out of scope
|
|
11
11
|
* for this session (the API accepts dynamic rules but the form only writes
|
|
12
12
|
* static rules; admins editing a pre-existing dynamic bundle see its members
|
|
@@ -62,8 +62,8 @@ function bundleToForm(bundle) {
|
|
|
62
62
|
return {
|
|
63
63
|
name: bundle.name ?? "",
|
|
64
64
|
description: bundle.description ?? "",
|
|
65
|
-
priceRupees: typeof bundle.
|
|
66
|
-
? String(
|
|
65
|
+
priceRupees: typeof bundle.bundlePrice === "number"
|
|
66
|
+
? String(bundle.bundlePrice)
|
|
67
67
|
: "",
|
|
68
68
|
ruleType: isDynamic ? "dynamic" : "static",
|
|
69
69
|
productIds: fromRule.length ? fromRule : idsFromMirror,
|
|
@@ -79,7 +79,7 @@ function parsePriceRupees(input) {
|
|
|
79
79
|
const n = Number(trimmed);
|
|
80
80
|
if (!Number.isFinite(n) || n <= 0)
|
|
81
81
|
return null;
|
|
82
|
-
return Math.round(n * 100);
|
|
82
|
+
return Math.round(n * 100) / 100;
|
|
83
83
|
}
|
|
84
84
|
export function AdminBundleEditorView({ bundleId, onSaved, onDeleted, scope = "admin", }) {
|
|
85
85
|
const isEdit = Boolean(bundleId);
|
|
@@ -129,13 +129,13 @@ export function AdminBundleEditorView({ bundleId, onSaved, onDeleted, scope = "a
|
|
|
129
129
|
const handleSave = useCallback(async () => {
|
|
130
130
|
clearErrors();
|
|
131
131
|
setApiError(null);
|
|
132
|
-
const
|
|
132
|
+
const price = parsePriceRupees(form.priceRupees);
|
|
133
133
|
let hasError = false;
|
|
134
134
|
if (!form.name.trim()) {
|
|
135
135
|
setFieldError("name", BUNDLE_COPY.adminEditor.errors.nameRequired);
|
|
136
136
|
hasError = true;
|
|
137
137
|
}
|
|
138
|
-
if (
|
|
138
|
+
if (price === null) {
|
|
139
139
|
setFieldError("price", BUNDLE_COPY.adminEditor.errors.priceInvalid);
|
|
140
140
|
hasError = true;
|
|
141
141
|
}
|
|
@@ -159,7 +159,7 @@ export function AdminBundleEditorView({ bundleId, onSaved, onDeleted, scope = "a
|
|
|
159
159
|
name: form.name.trim(),
|
|
160
160
|
description: form.description.trim() || undefined,
|
|
161
161
|
bundleKind: BUNDLE_KIND_SPECIAL,
|
|
162
|
-
|
|
162
|
+
bundlePrice: price,
|
|
163
163
|
bundleQueryRule,
|
|
164
164
|
bundleProductIds,
|
|
165
165
|
display: form.coverImage.trim()
|
|
@@ -218,6 +218,6 @@ export function AdminBundleEditorView({ bundleId, onSaved, onDeleted, scope = "a
|
|
|
218
218
|
formHelpersRef.current = helpers;
|
|
219
219
|
return (_jsx(Section, { padding: "y-2xl", children: _jsx(Container, { size: "lg", children: _jsxs(Stack, { gap: "lg", children: [_jsxs(Row, { gap: "sm", align: "center", justify: "between", wrap: true, children: [_jsx(Heading, { level: 1, size: "2xl", weight: "semibold", color: "primary", children: isEdit
|
|
220
220
|
? BUNDLE_COPY.adminEditorTitleEdit
|
|
221
|
-
: BUNDLE_COPY.adminEditorTitleNew }), isEdit && (_jsx(Button, { variant: "danger", onClick: () => setDeleteConfirmOpen(true), disabled: deleting, children: BUNDLE_COPY.adminEditor.deleteButton(deleting) }))] }), _jsx(ConfirmDeleteModal, { isOpen: deleteConfirmOpen, onClose: () => setDeleteConfirmOpen(false), onConfirm: handleDelete, title: "Delete this bundle?", message: BUNDLE_COPY.adminEditor.deleteConfirm, isDeleting: deleting }), apiError && (_jsx(Text, { color: "danger", role: "alert", children: apiError })), _jsxs(Stack, { gap: "md", children: [_jsx(FieldInput, { name: "name", label: BUNDLE_COPY.adminEditor.fields.nameLabel, value: form.name, onChange: (v) => setForm((f) => ({ ...f, name: v })), placeholder: BUNDLE_COPY.adminEditor.fields.namePlaceholder, disabled: saving, required: true }), _jsxs(Stack, { gap: "xs", children: [_jsx(Text, { size: "sm", weight: "semibold", children: BUNDLE_COPY.adminEditor.fields.descriptionLabel }), _jsx(Textarea, { value: form.description, onChange: (e) => setForm((f) => ({ ...f, description: e.target.value })), placeholder: BUNDLE_COPY.adminEditor.fields.descriptionPlaceholder, rows: 4, disabled: saving })] }),
|
|
221
|
+
: BUNDLE_COPY.adminEditorTitleNew }), isEdit && (_jsx(Button, { variant: "danger", onClick: () => setDeleteConfirmOpen(true), disabled: deleting, children: BUNDLE_COPY.adminEditor.deleteButton(deleting) }))] }), _jsx(ConfirmDeleteModal, { isOpen: deleteConfirmOpen, onClose: () => setDeleteConfirmOpen(false), onConfirm: handleDelete, title: "Delete this bundle?", message: BUNDLE_COPY.adminEditor.deleteConfirm, isDeleting: deleting }), apiError && (_jsx(Text, { color: "danger", role: "alert", children: apiError })), _jsxs(Stack, { gap: "md", children: [_jsx(FieldInput, { name: "name", label: BUNDLE_COPY.adminEditor.fields.nameLabel, value: form.name, onChange: (v) => setForm((f) => ({ ...f, name: v })), placeholder: BUNDLE_COPY.adminEditor.fields.namePlaceholder, disabled: saving, required: true }), _jsxs(Stack, { gap: "xs", children: [_jsx(Text, { size: "sm", weight: "semibold", children: BUNDLE_COPY.adminEditor.fields.descriptionLabel }), _jsx(Textarea, { value: form.description, onChange: (e) => setForm((f) => ({ ...f, description: e.target.value })), placeholder: BUNDLE_COPY.adminEditor.fields.descriptionPlaceholder, rows: 4, disabled: saving })] }), _jsx(Stack, { gap: "xs", children: _jsx(FieldInput, { name: "price", label: BUNDLE_COPY.adminEditor.fields.priceLabel, type: "number", inputMode: "decimal", min: 1, step: 1, value: form.priceRupees, onChange: (v) => setForm((f) => ({ ...f, priceRupees: v })), placeholder: BUNDLE_COPY.adminEditor.fields.pricePlaceholder, disabled: saving, required: true }) }), _jsxs(Stack, { gap: "xs", children: [_jsx(Text, { size: "sm", weight: "semibold", children: BUNDLE_COPY.adminEditor.fields.coverImageLabel }), _jsx(Input, { type: "url", value: form.coverImage, onChange: (e) => setForm((f) => ({ ...f, coverImage: e.target.value })), placeholder: "https://\u2026", disabled: saving })] }), _jsx(Checkbox, { checked: form.isActive, onChange: (e) => setForm((f) => ({ ...f, isActive: e.target.checked })), disabled: saving, label: BUNDLE_COPY.adminEditor.fields.activeLabel }), _jsxs(Stack, { gap: "xs", children: [_jsx(Text, { size: "sm", weight: "semibold", children: BUNDLE_COPY.adminEditor.ruleTypeLabel }), _jsx(Select, { options: RULE_TYPE_OPTIONS, value: form.ruleType, onValueChange: (next) => setForm((f) => ({ ...f, ruleType: next })), disabled: saving, "aria-label": BUNDLE_COPY.adminEditor.ruleTypeLabel })] }), form.ruleType === "static" ? (_jsxs(Stack, { gap: "xs", children: [_jsxs(Text, { size: "sm", weight: "semibold", children: [BUNDLE_COPY.adminEditor.ruleTypeStatic, " products (", BUNDLE_MIN_ITEMS, "\u2013", BUNDLE_MAX_ITEMS, ")"] }), _jsx(ProductInlineSelect, { scope: scope, multiple: true, value: form.productIds, onChange: (ids) => setForm((f) => ({ ...f, productIds: ids })), disabled: saving, placeholder: "Search and select products\u2026" }), form.productIds.length > 0 && form.productIds.length < BUNDLE_MIN_ITEMS && (_jsxs(Text, { size: "xs", color: "danger", children: ["Select at least ", BUNDLE_MIN_ITEMS, " products (currently ", form.productIds.length, ")."] })), form.productIds.length > BUNDLE_MAX_ITEMS && (_jsxs(Text, { size: "xs", color: "danger", children: ["Maximum ", BUNDLE_MAX_ITEMS, " products allowed (currently ", form.productIds.length, ")."] }))] })) : (_jsx(BundleDynamicRuleEditor, { value: form.dynamicRule, onChange: (next) => setForm((f) => ({ ...f, dynamicRule: next })), disabled: saving }))] }), _jsx(Row, { gap: "sm", align: "center", justify: "end", children: _jsx(Button, { variant: "primary", onClick: handleSave, disabled: saving, "aria-busy": saving, children: BUNDLE_COPY.adminEditor.saveButton(saving, isEdit) }) })] }) }) }));
|
|
222
222
|
} }));
|
|
223
223
|
}
|