@mohasinac/appkit 3.8.2 → 3.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_internal/client/features/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/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/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/FeaturedBundlesSection.js +2 -2
- 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/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/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
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Covers: notifications, chat rooms, site settings
|
|
4
4
|
*/
|
|
5
5
|
export declare const ADMIN_CHECKOUT_BYPASS_FLAG_KEY: "adminCheckoutBypass";
|
|
6
|
-
export type NotificationType = "order_placed" | "order_confirmed" | "order_shipped" | "order_delivered" | "order_cancelled" | "bid_placed" | "bid_outbid" | "bid_won" | "bid_lost" | "review_approved" | "review_replied" | "product_available" | "promotion" | "system" | "welcome" | "account_action" | "offer_received" | "offer_responded" | "offer_expired" | "offer_counter_accepted" | "refund_initiated" | "prize_reveal_ready" | "prize_reveal_expired" | "prize_reveal_reminder" | "emi_installment_due_soon" | "emi_installment_overdue";
|
|
6
|
+
export type NotificationType = "order_placed" | "order_confirmed" | "order_shipped" | "order_delivered" | "order_cancelled" | "bid_placed" | "bid_outbid" | "bid_won" | "bid_lost" | "review_approved" | "review_replied" | "product_available" | "promotion" | "system" | "welcome" | "account_action" | "offer_received" | "offer_responded" | "offer_expired" | "offer_counter_accepted" | "refund_initiated" | "prize_reveal_ready" | "prize_reveal_expired" | "prize_reveal_reminder" | "emi_installment_due_soon" | "emi_installment_overdue" | "payment_review";
|
|
7
7
|
import type { BaseDocument } from "../../../_internal/shared/types/base-document";
|
|
8
8
|
export type NotificationPriority = "low" | "normal" | "high";
|
|
9
9
|
export interface NotificationDocument extends BaseDocument {
|
|
@@ -288,12 +288,14 @@ export interface SiteSettingsDocument extends BaseDocument {
|
|
|
288
288
|
razorpayEnabled: boolean;
|
|
289
289
|
upiManualEnabled: boolean;
|
|
290
290
|
codEnabled: boolean;
|
|
291
|
+
/** Tier PP — cart total (rupees) at/above which checkout requires OTP verification. Applies to all payment methods except COD. Optional — falls back to no OTP gate when unset. */
|
|
292
|
+
otpCheckoutThreshold?: number;
|
|
291
293
|
};
|
|
292
294
|
/** Site-wide EMI (installment) settings. A seller must ALSO have `StoreDocument.emiEnabled` on for EMI to appear at checkout for their items. */
|
|
293
295
|
emi: {
|
|
294
296
|
enabled: boolean;
|
|
295
|
-
/**
|
|
296
|
-
|
|
297
|
+
/** Decimal rupees — a seller's cart subtotal must exceed this for EMI to appear as an option. */
|
|
298
|
+
minOrderValue: number;
|
|
297
299
|
tenureOptions: number[];
|
|
298
300
|
/** Down payment % collected at checkout. */
|
|
299
301
|
tokenPercent: number;
|
|
@@ -314,8 +316,8 @@ export interface SiteSettingsDocument extends BaseDocument {
|
|
|
314
316
|
/** Razorpay gateway cost % (absorbed by platform, not passed through separately). */
|
|
315
317
|
gatewayFeePercent: number;
|
|
316
318
|
codDepositPercent: number;
|
|
317
|
-
/** COD handling fee charged to the buyer: max(
|
|
318
|
-
|
|
319
|
+
/** COD handling fee charged to the buyer: max(codHandlingFeeMin, subtotal × codHandlingFeePercent / 100). */
|
|
320
|
+
codHandlingFeeMin: number;
|
|
319
321
|
codHandlingFeePercent: number;
|
|
320
322
|
sellerShippingFixed: number;
|
|
321
323
|
platformShippingPercent: number;
|
|
@@ -331,10 +333,10 @@ export interface SiteSettingsDocument extends BaseDocument {
|
|
|
331
333
|
promotedSlotFee?: number;
|
|
332
334
|
};
|
|
333
335
|
/** Procurement Shipments (Feature A) — the hourly rate used to compute a
|
|
334
|
-
* shipment's
|
|
336
|
+
* shipment's laborCost, and the daily-hour cap used to project
|
|
335
337
|
* estimatedProcessingDays. */
|
|
336
338
|
laborRate: {
|
|
337
|
-
|
|
339
|
+
hourlyRate: number;
|
|
338
340
|
maxHoursPerDay: number;
|
|
339
341
|
};
|
|
340
342
|
/** P-8 GST — Indian tax compliance. Distinct from commissions.gstPercent
|
|
@@ -170,10 +170,11 @@ export const DEFAULT_SITE_SETTINGS_DATA = {
|
|
|
170
170
|
razorpayEnabled: false,
|
|
171
171
|
upiManualEnabled: true,
|
|
172
172
|
codEnabled: true,
|
|
173
|
+
otpCheckoutThreshold: 5000,
|
|
173
174
|
},
|
|
174
175
|
emi: {
|
|
175
176
|
enabled: false,
|
|
176
|
-
|
|
177
|
+
minOrderValue: 10000,
|
|
177
178
|
tenureOptions: [2, 3, 4, 5, 6],
|
|
178
179
|
tokenPercent: 10,
|
|
179
180
|
billingDay: 5,
|
|
@@ -186,7 +187,7 @@ export const DEFAULT_SITE_SETTINGS_DATA = {
|
|
|
186
187
|
minimumTransactionFee: 0,
|
|
187
188
|
gatewayFeePercent: 2,
|
|
188
189
|
codDepositPercent: 10,
|
|
189
|
-
|
|
190
|
+
codHandlingFeeMin: 200,
|
|
190
191
|
codHandlingFeePercent: 10,
|
|
191
192
|
sellerShippingFixed: 0,
|
|
192
193
|
platformShippingPercent: 10,
|
|
@@ -200,7 +201,7 @@ export const DEFAULT_SITE_SETTINGS_DATA = {
|
|
|
200
201
|
promotedSlotFee: 499,
|
|
201
202
|
},
|
|
202
203
|
laborRate: {
|
|
203
|
-
|
|
204
|
+
hourlyRate: 200,
|
|
204
205
|
maxHoursPerDay: 6,
|
|
205
206
|
},
|
|
206
207
|
gst: {
|
|
@@ -6,12 +6,12 @@ import { Badge, Button, Div, Row, Span, Stack, Text } from "../../../ui";
|
|
|
6
6
|
const __O = {
|
|
7
7
|
hidden: "overflow-hidden",
|
|
8
8
|
};
|
|
9
|
-
function
|
|
9
|
+
function formatBidAmount(amount) {
|
|
10
10
|
return new Intl.NumberFormat("en-IN", {
|
|
11
11
|
style: "currency",
|
|
12
12
|
currency: "INR",
|
|
13
13
|
maximumFractionDigits: 0,
|
|
14
|
-
}).format(amount
|
|
14
|
+
}).format(amount);
|
|
15
15
|
}
|
|
16
16
|
function relDate(d) {
|
|
17
17
|
const ms = new Date(d).getTime();
|
|
@@ -54,7 +54,7 @@ function AuctionRow({ auction, portal, }) {
|
|
|
54
54
|
const sorted = useMemo(() => [...auction.bids].sort((a, b) => b.bidAmount - a.bidAmount), [auction.bids]);
|
|
55
55
|
const highest = sorted[0]?.bidAmount ?? 0;
|
|
56
56
|
const isWinning = auction.bids.some((b) => b.isWinning);
|
|
57
|
-
return (_jsxs(Div, { className: `border border-[var(--appkit-color-border)] ${__O.hidden} bg-[var(--appkit-color-surface)]`, rounded: "xl", shadow: "sm", children: [_jsxs(Button, { type: "button", variant: "ghost", onClick: () => setExpanded((v) => !v), gap: "lg", paddingX: "md", paddingY: "md", className: "w-full text-left", "aria-expanded": expanded, children: [_jsx(ChevronRight, { className: `shrink-0 text-[var(--appkit-color-text-muted)] transition-transform ${expanded ? "rotate-90" : ""}`, size: 16 }), _jsx(Div, { className: "flex-1 min-w-0", children: _jsx(Text, { className: "text-[var(--appkit-color-text)] line-clamp-1", size: "sm", weight: "semibold", children: auction.productTitle }) }), _jsxs(Row, { gap: "sm", className: "shrink-0", children: [isWinning && (_jsx(Badge, { variant: "active", children: "Winning" })), _jsxs(Text, { variant: "secondary", size: "xs", children: [auction.bids.length, " bid", auction.bids.length !== 1 ? "s" : ""] }), _jsx(Text, { className: "text-[var(--appkit-color-text)]", size: "sm", weight: "semibold", children:
|
|
57
|
+
return (_jsxs(Div, { className: `border border-[var(--appkit-color-border)] ${__O.hidden} bg-[var(--appkit-color-surface)]`, rounded: "xl", shadow: "sm", children: [_jsxs(Button, { type: "button", variant: "ghost", onClick: () => setExpanded((v) => !v), gap: "lg", paddingX: "md", paddingY: "md", className: "w-full text-left", "aria-expanded": expanded, children: [_jsx(ChevronRight, { className: `shrink-0 text-[var(--appkit-color-text-muted)] transition-transform ${expanded ? "rotate-90" : ""}`, size: 16 }), _jsx(Div, { className: "flex-1 min-w-0", children: _jsx(Text, { className: "text-[var(--appkit-color-text)] line-clamp-1", size: "sm", weight: "semibold", children: auction.productTitle }) }), _jsxs(Row, { gap: "sm", className: "shrink-0", children: [isWinning && (_jsx(Badge, { variant: "active", children: "Winning" })), _jsxs(Text, { variant: "secondary", size: "xs", children: [auction.bids.length, " bid", auction.bids.length !== 1 ? "s" : ""] }), _jsx(Text, { className: "text-[var(--appkit-color-text)]", size: "sm", weight: "semibold", children: formatBidAmount(highest) })] })] }), expanded && (_jsxs(Div, { className: "border-t border-[var(--appkit-color-border)]", children: [_jsxs(Div, { textSize: "xs", textWeight: "medium", paddingX: "x-md", paddingY: "y-xs", className: `grid text-[var(--appkit-color-text-muted)] uppercase tracking-wide border-b border-[var(--appkit-color-border-subtle)] ${portal === "buyer" ? "[grid-template-columns:1fr_auto_auto]" : "[grid-template-columns:1fr_1fr_auto_auto]"}`, children: [_jsx(Span, { children: portal === "buyer" ? "Amount" : "Bidder" }), portal !== "buyer" && _jsx(Span, { children: "Amount" }), _jsx(Span, { children: "Status" }), _jsx(Span, { className: "text-right", children: "Time" })] }), sorted.map((bid) => (_jsxs(Div, { layout: "grid", align: "center", paddingX: "x-md", paddingY: "y-xs-tall", className: `border-b border-[var(--appkit-color-border-subtle)] last:border-0 hover:bg-[var(--appkit-color-border-subtle)] transition-colors ${portal === "buyer" ? "[grid-template-columns:1fr_auto_auto]" : "[grid-template-columns:1fr_1fr_auto_auto]"}`, children: [portal !== "buyer" && (_jsx(Text, { className: "text-[var(--appkit-color-text)] truncate pr-[0.75rem]", size: "sm", children: bid.userName || bid.userId })), _jsx(Text, { className: "text-[var(--appkit-color-text)]", size: "sm", weight: "medium", children: formatBidAmount(bid.bidAmount) }), _jsx(Badge, { variant: STATUS_VARIANT[bid.status] ?? "pending", className: "capitalize", children: bid.status }), _jsx(Text, { variant: "secondary", size: "xs", align: "end", children: relDate(bid.bidDate) })] }, bid.id)))] }))] }));
|
|
58
58
|
}
|
|
59
59
|
export function AuctionBidsTable({ bids, portal = "buyer", emptyLabel = "No bids found.", }) {
|
|
60
60
|
const auctions = useMemo(() => groupByAuction(bids), [bids]);
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checkout Value OTP — Tier PP.
|
|
3
|
+
*
|
|
4
|
+
* A distinct OTP purpose from `consent-otp.ts` (which gates third-party
|
|
5
|
+
* shipping consent): this one gates placing a checkout ≥ the site's
|
|
6
|
+
* `payment.otpCheckoutThreshold` (skipped for COD — see
|
|
7
|
+
* `createCheckoutOrderAction`). Deliberately a SEPARATE Firestore namespace
|
|
8
|
+
* (`checkoutValueOtps` vs `consentOtps`) rather than reusing the shipping-
|
|
9
|
+
* consent one — different purpose, different copy, independently tunable
|
|
10
|
+
* rate limits. Reuses `generateOtpCode()`/`hashOtp()` from `consent-otp.ts`
|
|
11
|
+
* rather than duplicating the crypto.
|
|
12
|
+
*/
|
|
13
|
+
import { generateOtpCode, hashOtp } from "./consent-otp";
|
|
14
|
+
export { generateOtpCode, hashOtp };
|
|
15
|
+
/** OTP validity window (10 minutes) — matches consent-OTP's window; independently tunable if policy diverges later. */
|
|
16
|
+
export declare const CHECKOUT_VALUE_OTP_EXPIRY_MS: number;
|
|
17
|
+
export declare const CHECKOUT_VALUE_OTP_EXPIRY_MINUTES = 10;
|
|
18
|
+
/** Per-user send cooldown (15 minutes). */
|
|
19
|
+
export declare const CHECKOUT_VALUE_OTP_COOLDOWN_MS: number;
|
|
20
|
+
/** Maximum failed verification attempts before the OTP is locked. */
|
|
21
|
+
export declare const CHECKOUT_VALUE_OTP_MAX_ATTEMPTS = 5;
|
|
22
|
+
/** Rate-limit config for the verify endpoint / action (10 attempts per 5 min). */
|
|
23
|
+
export declare const CHECKOUT_VALUE_OTP_VERIFY_RATE_LIMIT: {
|
|
24
|
+
readonly limit: 10;
|
|
25
|
+
readonly window: 300;
|
|
26
|
+
};
|
|
27
|
+
type Db = FirebaseFirestore.Firestore;
|
|
28
|
+
/**
|
|
29
|
+
* Single-slot doc per user — unlike consent OTP (one per address), a buyer
|
|
30
|
+
* can only be mid-checkout once, so there's no per-context key needed.
|
|
31
|
+
*/
|
|
32
|
+
export declare function checkoutValueOtpRef(db: Db, uid: string): FirebaseFirestore.DocumentReference<FirebaseFirestore.DocumentData, FirebaseFirestore.DocumentData>;
|
|
33
|
+
export declare function checkoutValueOtpRateLimitRef(db: Db, uid: string): FirebaseFirestore.DocumentReference<FirebaseFirestore.DocumentData, FirebaseFirestore.DocumentData>;
|
|
34
|
+
export interface CheckoutValueOtpDoc {
|
|
35
|
+
codeHash: string;
|
|
36
|
+
expiresAt: FirebaseFirestore.Timestamp;
|
|
37
|
+
attempts: number;
|
|
38
|
+
verified: boolean;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Enforce the per-user send rate-limit.
|
|
42
|
+
* Throws AuthorizationError("checkoutValueOtpRateLimit") when throttled.
|
|
43
|
+
*/
|
|
44
|
+
export declare function enforceCheckoutValueOtpRateLimit(db: Db, uid: string): Promise<void>;
|
|
45
|
+
/** Build the checkout-value OTP WhatsApp/SMS message body. */
|
|
46
|
+
export declare function buildCheckoutValueOtpMessage(code: string, siteName: string): string;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checkout Value OTP — Tier PP.
|
|
3
|
+
*
|
|
4
|
+
* A distinct OTP purpose from `consent-otp.ts` (which gates third-party
|
|
5
|
+
* shipping consent): this one gates placing a checkout ≥ the site's
|
|
6
|
+
* `payment.otpCheckoutThreshold` (skipped for COD — see
|
|
7
|
+
* `createCheckoutOrderAction`). Deliberately a SEPARATE Firestore namespace
|
|
8
|
+
* (`checkoutValueOtps` vs `consentOtps`) rather than reusing the shipping-
|
|
9
|
+
* consent one — different purpose, different copy, independently tunable
|
|
10
|
+
* rate limits. Reuses `generateOtpCode()`/`hashOtp()` from `consent-otp.ts`
|
|
11
|
+
* rather than duplicating the crypto.
|
|
12
|
+
*/
|
|
13
|
+
import { AuthorizationError } from "../../errors";
|
|
14
|
+
import { resolveDate } from "../../utils";
|
|
15
|
+
import { USER_COLLECTION } from "./schemas";
|
|
16
|
+
import { generateOtpCode, hashOtp } from "./consent-otp";
|
|
17
|
+
export { generateOtpCode, hashOtp };
|
|
18
|
+
/** OTP validity window (10 minutes) — matches consent-OTP's window; independently tunable if policy diverges later. */
|
|
19
|
+
export const CHECKOUT_VALUE_OTP_EXPIRY_MS = 10 * 60 * 1000;
|
|
20
|
+
export const CHECKOUT_VALUE_OTP_EXPIRY_MINUTES = 10;
|
|
21
|
+
/** Per-user send cooldown (15 minutes). */
|
|
22
|
+
export const CHECKOUT_VALUE_OTP_COOLDOWN_MS = 15 * 60 * 1000;
|
|
23
|
+
/** Maximum failed verification attempts before the OTP is locked. */
|
|
24
|
+
export const CHECKOUT_VALUE_OTP_MAX_ATTEMPTS = 5;
|
|
25
|
+
/** Rate-limit config for the verify endpoint / action (10 attempts per 5 min). */
|
|
26
|
+
export const CHECKOUT_VALUE_OTP_VERIFY_RATE_LIMIT = {
|
|
27
|
+
limit: 10,
|
|
28
|
+
window: 300,
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Single-slot doc per user — unlike consent OTP (one per address), a buyer
|
|
32
|
+
* can only be mid-checkout once, so there's no per-context key needed.
|
|
33
|
+
*/
|
|
34
|
+
export function checkoutValueOtpRef(db, uid) {
|
|
35
|
+
return db
|
|
36
|
+
.collection(USER_COLLECTION)
|
|
37
|
+
.doc(uid)
|
|
38
|
+
.collection("checkoutValueOtps")
|
|
39
|
+
.doc("current");
|
|
40
|
+
}
|
|
41
|
+
export function checkoutValueOtpRateLimitRef(db, uid) {
|
|
42
|
+
return db
|
|
43
|
+
.collection(USER_COLLECTION)
|
|
44
|
+
.doc(uid)
|
|
45
|
+
.collection("checkoutValueOtpRateLimit")
|
|
46
|
+
.doc("meta");
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Enforce the per-user send rate-limit.
|
|
50
|
+
* Throws AuthorizationError("checkoutValueOtpRateLimit") when throttled.
|
|
51
|
+
*/
|
|
52
|
+
export async function enforceCheckoutValueOtpRateLimit(db, uid) {
|
|
53
|
+
const metaRef = checkoutValueOtpRateLimitRef(db, uid);
|
|
54
|
+
await db.runTransaction(async (tx) => {
|
|
55
|
+
const metaSnap = await tx.get(metaRef);
|
|
56
|
+
const meta = metaSnap.exists
|
|
57
|
+
? metaSnap.data()
|
|
58
|
+
: null;
|
|
59
|
+
const lastSentMs = resolveDate(meta?.lastSentAt)?.getTime() ?? 0;
|
|
60
|
+
const elapsed = Date.now() - lastSentMs;
|
|
61
|
+
if (elapsed < CHECKOUT_VALUE_OTP_COOLDOWN_MS) {
|
|
62
|
+
throw new AuthorizationError("checkoutValueOtpRateLimit");
|
|
63
|
+
}
|
|
64
|
+
tx.set(metaRef, { lastSentAt: new Date() }, { merge: true });
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
/** Build the checkout-value OTP WhatsApp/SMS message body. */
|
|
68
|
+
export function buildCheckoutValueOtpMessage(code, siteName) {
|
|
69
|
+
return (`*${siteName} — Order Verification*\n\n` +
|
|
70
|
+
`Your verification code for this high-value order is: *${code}*\n\n` +
|
|
71
|
+
`This code expires in ${CHECKOUT_VALUE_OTP_EXPIRY_MINUTES} minutes. ` +
|
|
72
|
+
`If you did not request this, please ignore this message.`);
|
|
73
|
+
}
|
|
@@ -16,6 +16,12 @@ export declare class UserRepository extends BaseRepository<UserDocument> {
|
|
|
16
16
|
findByRole(role: UserRole): Promise<UserDocument[]>;
|
|
17
17
|
findVerified(limit?: number): Promise<UserDocument[]>;
|
|
18
18
|
findActive(limit?: number): Promise<UserDocument[]>;
|
|
19
|
+
/**
|
|
20
|
+
* Cloud Functions: temporary hard-bans past their `hardBanExpiresAt` —
|
|
21
|
+
* the `hardBanReinstatement` sweep re-enables Auth login for these.
|
|
22
|
+
* Permanent bans (`hardBanExpiresAt` null/absent) never match this query.
|
|
23
|
+
*/
|
|
24
|
+
getExpiredHardBans(): Promise<UserDocument[]>;
|
|
19
25
|
update(uid: string, data: Partial<UserDocument>): Promise<UserDocument>;
|
|
20
26
|
markEmailAsVerified(uid: string): Promise<UserDocument>;
|
|
21
27
|
disable(uid: string): Promise<UserDocument>;
|
|
@@ -106,6 +106,25 @@ export class UserRepository extends BaseRepository {
|
|
|
106
106
|
throw new DatabaseError("Failed to fetch active users", error);
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
|
+
/**
|
|
110
|
+
* Cloud Functions: temporary hard-bans past their `hardBanExpiresAt` —
|
|
111
|
+
* the `hardBanReinstatement` sweep re-enables Auth login for these.
|
|
112
|
+
* Permanent bans (`hardBanExpiresAt` null/absent) never match this query.
|
|
113
|
+
*/
|
|
114
|
+
async getExpiredHardBans() {
|
|
115
|
+
try {
|
|
116
|
+
const snapshot = await this.getCollection()
|
|
117
|
+
.where(USER_FIELDS.IS_DISABLED, "==", true)
|
|
118
|
+
.where(USER_FIELDS.HARD_BAN_EXPIRES_AT, "<=", new Date())
|
|
119
|
+
.limit(500)
|
|
120
|
+
.get();
|
|
121
|
+
return snapshot.docs.map((doc) => this.mapDoc(doc));
|
|
122
|
+
}
|
|
123
|
+
catch (error) {
|
|
124
|
+
void normalizeError(error);
|
|
125
|
+
throw new DatabaseError("Failed to fetch expired hard bans", error);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
109
128
|
async update(uid, data) {
|
|
110
129
|
const encrypted = this.encryptUserData(data);
|
|
111
130
|
return super.update(uid, encrypted);
|
|
@@ -44,6 +44,8 @@ export interface UserDocument extends BaseDocument {
|
|
|
44
44
|
passwordHash?: string;
|
|
45
45
|
emailVerified: boolean;
|
|
46
46
|
disabled: boolean;
|
|
47
|
+
/** Hard-ban flag — disables Firebase Auth login. Distinct from `disabled` (used elsewhere); read alongside `hardBanReason`/`hardBannedAt`/`hardBannedBy`. Set by `hardBanCascade`, cleared by `hardBanReinstatement` for temporary bans. */
|
|
48
|
+
isDisabled?: boolean;
|
|
47
49
|
storeId?: string;
|
|
48
50
|
storeSlug?: string;
|
|
49
51
|
storeStatus?: "pending" | "approved" | "rejected";
|
|
@@ -95,6 +97,12 @@ export interface UserDocument extends BaseDocument {
|
|
|
95
97
|
hardBanReason?: string;
|
|
96
98
|
hardBannedAt?: Date;
|
|
97
99
|
hardBannedBy?: string;
|
|
100
|
+
/** Null/absent = permanent hard ban (the default). A future Date makes this a temporary ban, auto-reinstated by the `hardBanReinstatement` sweep — mirrors `UserSoftBan.expiresAt`'s null-vs-past-date convention. Set only by the payment-fraud-reject path today. */
|
|
101
|
+
hardBanExpiresAt?: Date | null;
|
|
102
|
+
/** Order that triggered a fraud-rejection ban, for traceability. */
|
|
103
|
+
hardBanFraudOrderId?: string;
|
|
104
|
+
/** Stamped by `hardBanReinstatement` when a temporary ban's `hardBanExpiresAt` passes and login is re-enabled. `hardBanReason`/`hardBannedAt`/`hardBannedBy`/`hardBanExpiresAt` are left in place as historical record — not cleared. */
|
|
105
|
+
hardBanReinstatedAt?: Date;
|
|
98
106
|
/** Timestamp when user confirmed they read the scam awareness guide. Required before full platform access. */
|
|
99
107
|
scamAwarenessAcknowledgedAt?: Date;
|
|
100
108
|
/** User-controlled notification channel and type preferences. */
|
|
@@ -206,6 +214,8 @@ export declare const USER_FIELDS: {
|
|
|
206
214
|
readonly PASSWORD_HASH: "passwordHash";
|
|
207
215
|
readonly EMAIL_VERIFIED: "emailVerified";
|
|
208
216
|
readonly DISABLED: "disabled";
|
|
217
|
+
readonly IS_DISABLED: "isDisabled";
|
|
218
|
+
readonly HARD_BAN_EXPIRES_AT: "hardBanExpiresAt";
|
|
209
219
|
readonly CREATED_AT: "createdAt";
|
|
210
220
|
readonly UPDATED_AT: "updatedAt";
|
|
211
221
|
readonly STORE_ID: "storeId";
|
|
@@ -102,6 +102,8 @@ export const USER_FIELDS = {
|
|
|
102
102
|
PASSWORD_HASH: "passwordHash",
|
|
103
103
|
EMAIL_VERIFIED: "emailVerified",
|
|
104
104
|
DISABLED: "disabled",
|
|
105
|
+
IS_DISABLED: "isDisabled",
|
|
106
|
+
HARD_BAN_EXPIRES_AT: "hardBanExpiresAt",
|
|
105
107
|
CREATED_AT: "createdAt",
|
|
106
108
|
UPDATED_AT: "updatedAt",
|
|
107
109
|
STORE_ID: "storeId",
|
|
@@ -14,4 +14,4 @@ export declare function mergeGuestCart(userId: string, items: Array<{
|
|
|
14
14
|
quantity: number;
|
|
15
15
|
}>): Promise<void>;
|
|
16
16
|
export declare function getCart(userId: string): Promise<CartDocument | null>;
|
|
17
|
-
export declare function updateCartItemShipping(userId: string, itemId: string, providerId: string,
|
|
17
|
+
export declare function updateCartItemShipping(userId: string, itemId: string, providerId: string, fee: number): Promise<CartDocument>;
|
|
@@ -77,11 +77,11 @@ export async function mergeGuestCart(userId, items) {
|
|
|
77
77
|
export async function getCart(userId) {
|
|
78
78
|
return cartRepository.findByUserId(userId);
|
|
79
79
|
}
|
|
80
|
-
export async function updateCartItemShipping(userId, itemId, providerId,
|
|
80
|
+
export async function updateCartItemShipping(userId, itemId, providerId, fee) {
|
|
81
81
|
if (!itemId || !providerId)
|
|
82
82
|
throw new ValidationError("itemId and providerId are required");
|
|
83
|
-
if (!Number.isFinite(
|
|
84
|
-
throw new ValidationError("
|
|
83
|
+
if (!Number.isFinite(fee) || fee < 0) {
|
|
84
|
+
throw new ValidationError("fee must be a non-negative number");
|
|
85
85
|
}
|
|
86
|
-
return cartRepository.updateItemShipping(userId, itemId, providerId,
|
|
86
|
+
return cartRepository.updateItemShipping(userId, itemId, providerId, fee);
|
|
87
87
|
}
|
|
@@ -11,11 +11,11 @@ export interface ShippingPickerProps {
|
|
|
11
11
|
providers: ShippingProviderConfig[];
|
|
12
12
|
/** Currently persisted provider id (from CartItemDocument.chosenShippingProviderId). */
|
|
13
13
|
selectedProviderId?: string;
|
|
14
|
-
/** Order subtotal
|
|
15
|
-
|
|
14
|
+
/** Order subtotal, decimal rupees — used to evaluate freeAbove + percentOfOrder rules. */
|
|
15
|
+
subtotal?: number;
|
|
16
16
|
/** Called when the buyer picks (or changes) a provider. */
|
|
17
|
-
onPickProvider: (providerId: string,
|
|
17
|
+
onPickProvider: (providerId: string, fee: number) => void | Promise<void>;
|
|
18
18
|
isLoading?: boolean;
|
|
19
19
|
className?: string;
|
|
20
20
|
}
|
|
21
|
-
export declare function ShippingPicker({ providers, selectedProviderId,
|
|
21
|
+
export declare function ShippingPicker({ providers, selectedProviderId, subtotal, onPickProvider, isLoading, className, }: ShippingPickerProps): React.JSX.Element;
|
|
@@ -9,28 +9,28 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
9
9
|
*/
|
|
10
10
|
import { useState } from "react";
|
|
11
11
|
import { Button, Div, Row, Stack, Text } from "../../../ui";
|
|
12
|
-
import { formatCurrency } from "../../../utils/number.formatter";
|
|
12
|
+
import { formatCurrency, roundRupees } from "../../../utils/number.formatter";
|
|
13
13
|
import { REFUND_COPY } from "../../../_internal/shared/features/orders/refund-copy";
|
|
14
14
|
/** Resolve the effective flat fee for a provider given the current subtotal. */
|
|
15
|
-
function resolveProviderFee(p,
|
|
15
|
+
function resolveProviderFee(p, subtotal) {
|
|
16
16
|
const { fee } = p;
|
|
17
|
-
if (fee.
|
|
17
|
+
if (fee.freeAbove !== undefined && subtotal >= fee.freeAbove)
|
|
18
18
|
return 0;
|
|
19
|
-
let total = fee.
|
|
19
|
+
let total = fee.flat ?? 0;
|
|
20
20
|
if (fee.percentOfOrder !== undefined) {
|
|
21
|
-
total +=
|
|
21
|
+
total += roundRupees((fee.percentOfOrder / 100) * subtotal);
|
|
22
22
|
}
|
|
23
|
-
if (fee.
|
|
24
|
-
total = Math.max(total, fee.
|
|
23
|
+
if (fee.min !== undefined)
|
|
24
|
+
total = Math.max(total, fee.min);
|
|
25
25
|
return total;
|
|
26
26
|
}
|
|
27
|
-
export function ShippingPicker({ providers, selectedProviderId,
|
|
27
|
+
export function ShippingPicker({ providers, selectedProviderId, subtotal = 0, onPickProvider, isLoading = false, className = "", }) {
|
|
28
28
|
const [pending, setPending] = useState(false);
|
|
29
29
|
if (providers.length === 0) {
|
|
30
30
|
return (_jsx(Text, { size: "sm", color: "muted", className: className, children: REFUND_COPY.shipping.noOptions }));
|
|
31
31
|
}
|
|
32
32
|
const handleSelect = async (p) => {
|
|
33
|
-
const fee = resolveProviderFee(p,
|
|
33
|
+
const fee = resolveProviderFee(p, subtotal);
|
|
34
34
|
setPending(true);
|
|
35
35
|
try {
|
|
36
36
|
await onPickProvider(p.providerId, fee);
|
|
@@ -40,9 +40,9 @@ export function ShippingPicker({ providers, selectedProviderId, subtotalInPaise
|
|
|
40
40
|
}
|
|
41
41
|
};
|
|
42
42
|
return (_jsx(Stack, { gap: "xs", className: className, role: "radiogroup", "aria-label": "Shipping options", children: providers.map((p) => {
|
|
43
|
-
const fee = resolveProviderFee(p,
|
|
43
|
+
const fee = resolveProviderFee(p, subtotal);
|
|
44
44
|
const selected = p.providerId === selectedProviderId;
|
|
45
45
|
const disabled = isLoading || pending;
|
|
46
|
-
return (_jsx(Button, { type: "button", variant: selected ? "primary" : "outline", size: "sm", disabled: disabled, onClick: () => handleSelect(p), "aria-checked": selected, role: "radio", className: "w-full justify-start text-left", children: _jsxs(Row, { gap: "sm", className: "w-full", wrap: true, align: "center", children: [_jsxs(Div, { className: "flex-1", children: [_jsx(Text, { size: "sm", weight: selected ? "semibold" : "normal", children: p.label }), _jsx(Text, { size: "xs", color: "muted", children: REFUND_COPY.shipping.etaFormat(p.etaDaysMin, p.etaDaysMax) })] }), _jsx(Text, { size: "sm", weight: "semibold", children: fee === 0 ? REFUND_COPY.shipping.freeLabel : formatCurrency(fee
|
|
46
|
+
return (_jsx(Button, { type: "button", variant: selected ? "primary" : "outline", size: "sm", disabled: disabled, onClick: () => handleSelect(p), "aria-checked": selected, role: "radio", className: "w-full justify-start text-left", children: _jsxs(Row, { gap: "sm", className: "w-full", wrap: true, align: "center", children: [_jsxs(Div, { className: "flex-1", children: [_jsx(Text, { size: "sm", weight: selected ? "semibold" : "normal", children: p.label }), _jsx(Text, { size: "xs", color: "muted", children: REFUND_COPY.shipping.etaFormat(p.etaDaysMin, p.etaDaysMax) })] }), _jsx(Text, { size: "sm", weight: "semibold", children: fee === 0 ? REFUND_COPY.shipping.freeLabel : formatCurrency(fee, "INR") })] }) }, p.providerId));
|
|
47
47
|
}) }));
|
|
48
48
|
}
|
|
@@ -19,7 +19,7 @@ export declare class CartRepository extends BaseRepository<CartDocument> {
|
|
|
19
19
|
getSubtotal(cart: CartDocument): number;
|
|
20
20
|
addCoupon(userId: string, coupon: CartAppliedCoupon): Promise<void>;
|
|
21
21
|
removeCoupon(userId: string, code: string): Promise<void>;
|
|
22
|
-
updateItemShipping(userId: string, itemId: string, providerId: string,
|
|
22
|
+
updateItemShipping(userId: string, itemId: string, providerId: string, fee: number): Promise<CartDocument>;
|
|
23
23
|
clearAllCoupons(userId: string): Promise<void>;
|
|
24
24
|
setSelectedItems(userId: string, itemIds: string[] | null): Promise<void>;
|
|
25
25
|
/**
|
|
@@ -231,7 +231,7 @@ export class CartRepository extends BaseRepository {
|
|
|
231
231
|
.doc(userId)
|
|
232
232
|
.set({ appliedCoupons: updated, updatedAt: new Date() }, { merge: true });
|
|
233
233
|
}
|
|
234
|
-
async updateItemShipping(userId, itemId, providerId,
|
|
234
|
+
async updateItemShipping(userId, itemId, providerId, fee) {
|
|
235
235
|
try {
|
|
236
236
|
const cart = await this.findByUserId(userId);
|
|
237
237
|
if (!cart)
|
|
@@ -243,7 +243,7 @@ export class CartRepository extends BaseRepository {
|
|
|
243
243
|
items[itemIndex] = {
|
|
244
244
|
...items[itemIndex],
|
|
245
245
|
chosenShippingProviderId: providerId,
|
|
246
|
-
|
|
246
|
+
chosenShippingFee: fee,
|
|
247
247
|
updatedAt: new Date(),
|
|
248
248
|
};
|
|
249
249
|
const updatedCart = { ...cart, items, updatedAt: new Date() };
|
|
@@ -35,7 +35,7 @@ export interface CartItemDocument {
|
|
|
35
35
|
* SB-UNI-4 2026-05-13 — bundle identifier when this cart line represents a
|
|
36
36
|
* bundle (categoryType:"bundle" row on the categories collection). When set,
|
|
37
37
|
* `productId` points at the bundle category's id, `price` is the locked
|
|
38
|
-
*
|
|
38
|
+
* bundlePrice, and `bundleProductIds` snapshots the member product
|
|
39
39
|
* ids at add-to-cart time. Order-side fan-out into per-product OrderItem
|
|
40
40
|
* entries lands in S-SBUNI-5 (checkout-side stock decrement + per-store
|
|
41
41
|
* grouping); until then the foundation is here but BundleDetailView keeps
|
|
@@ -51,7 +51,7 @@ export interface CartItemDocument {
|
|
|
51
51
|
*/
|
|
52
52
|
chosenShippingProviderId?: string;
|
|
53
53
|
/** Fee in paise for the chosen provider, snapshotted at cart time. */
|
|
54
|
-
|
|
54
|
+
chosenShippingFee?: number;
|
|
55
55
|
addedAt: Date;
|
|
56
56
|
updatedAt: Date;
|
|
57
57
|
}
|
|
@@ -26,7 +26,7 @@ export function CatalogueItemEditorView({ item, onSaved }) {
|
|
|
26
26
|
const [title, setTitle] = React.useState(item?.title ?? "");
|
|
27
27
|
const [description, setDescription] = React.useState(item?.description ?? "");
|
|
28
28
|
const [condition, setCondition] = React.useState(item?.condition ?? "");
|
|
29
|
-
const [price, setPrice] = React.useState(item?.price ? String(item.price
|
|
29
|
+
const [price, setPrice] = React.useState(item?.price ? String(item.price) : "0");
|
|
30
30
|
const [quantity, setQuantity] = React.useState(String(item?.quantity ?? 1));
|
|
31
31
|
const [visibility, setVisibility] = React.useState(item?.visibility ?? "public");
|
|
32
32
|
const [images, setImages] = React.useState(item?.images ?? []);
|
|
@@ -46,7 +46,7 @@ export function CatalogueItemEditorView({ item, onSaved }) {
|
|
|
46
46
|
title,
|
|
47
47
|
description: description || undefined,
|
|
48
48
|
condition: condition || undefined,
|
|
49
|
-
price: Math.round(Number(price) * 100),
|
|
49
|
+
price: Math.round(Number(price) * 100) / 100,
|
|
50
50
|
quantity: Number(quantity),
|
|
51
51
|
visibility,
|
|
52
52
|
images,
|
|
@@ -65,7 +65,7 @@ export function CatalogueItemEditorView({ item, onSaved }) {
|
|
|
65
65
|
const parsed = createCatalogueItemSchema.safeParse({
|
|
66
66
|
title,
|
|
67
67
|
images,
|
|
68
|
-
price: Math.round(Number(price) * 100),
|
|
68
|
+
price: Math.round(Number(price) * 100) / 100,
|
|
69
69
|
quantity: Number(quantity),
|
|
70
70
|
visibility,
|
|
71
71
|
});
|
|
@@ -5,7 +5,7 @@ import { Div, Grid, Heading, Skeleton, Text } from "../../../ui";
|
|
|
5
5
|
import { MediaImage } from "../../media/MediaImage";
|
|
6
6
|
import { apiClient } from "../../../http";
|
|
7
7
|
import { ACCOUNT_ENDPOINTS } from "../../../constants/api-endpoints";
|
|
8
|
-
import {
|
|
8
|
+
import { formatCurrency } from "../../../utils/number.formatter";
|
|
9
9
|
export function PublicCatalogueView({ ownerSlug }) {
|
|
10
10
|
const { data, isLoading } = useQuery({
|
|
11
11
|
queryKey: ["catalogue", "public", ownerSlug],
|
|
@@ -18,5 +18,5 @@ export function PublicCatalogueView({ ownerSlug }) {
|
|
|
18
18
|
if (items.length === 0) {
|
|
19
19
|
return _jsx(Text, { variant: "secondary", children: "Nothing public here yet." });
|
|
20
20
|
}
|
|
21
|
-
return (_jsx(Grid, { cols: 4, gap: "md", children: items.map((item) => (_jsxs(Div, { rounded: "xl", border: "default", padding: "md", surface: "card", children: [_jsx(MediaImage, { src: item.mainImage || item.images[0] || "", alt: item.title, size: "card" }), _jsx(Div, { padding: "t-sm", children: _jsx(Heading, { level: 4, size: "sm", children: item.title }) }), typeof item.price === "number" && item.price > 0 && (_jsx(Text, { size: "sm", color: "muted", children:
|
|
21
|
+
return (_jsx(Grid, { cols: 4, gap: "md", children: items.map((item) => (_jsxs(Div, { rounded: "xl", border: "default", padding: "md", surface: "card", children: [_jsx(MediaImage, { src: item.mainImage || item.images[0] || "", alt: item.title, size: "card" }), _jsx(Div, { padding: "t-sm", children: _jsx(Heading, { level: 4, size: "sm", children: item.title }) }), typeof item.price === "number" && item.price > 0 && (_jsx(Text, { size: "sm", color: "muted", children: formatCurrency(item.price) }))] }, item.id))) }));
|
|
22
22
|
}
|
|
@@ -18,7 +18,7 @@ export const createCatalogueItemSchema = z.object({
|
|
|
18
18
|
condition: productConditionSchema.optional(),
|
|
19
19
|
categorySlugs: z.array(z.string()).optional(),
|
|
20
20
|
brandSlug: z.string().optional(),
|
|
21
|
-
price: z.number().
|
|
21
|
+
price: z.number().min(0).optional(),
|
|
22
22
|
quantity: z.number().int().min(1).default(1),
|
|
23
23
|
visibility: z.enum(["public", "private"]).default("public"),
|
|
24
24
|
});
|
|
@@ -22,7 +22,7 @@ function toGalleryImages(members) {
|
|
|
22
22
|
alt: p.title,
|
|
23
23
|
badge: `#${i + 1}`,
|
|
24
24
|
caption: p.title,
|
|
25
|
-
sub: formatCurrency(
|
|
25
|
+
sub: formatCurrency(p.price ?? 0, p.currency ?? "INR"),
|
|
26
26
|
}));
|
|
27
27
|
}
|
|
28
28
|
function makeBundleItemClickHandler(p, idx, onItemClick, setLightboxIndex) {
|
|
@@ -43,7 +43,7 @@ export function BundleCollage({ members, onItemClick }) {
|
|
|
43
43
|
return (_jsxs(_Fragment, { children: [_jsx(Div, { layout: "grid", gap: "3", className: "grid-cols-2 sm:grid-cols-3 md:grid-cols-4", children: members.map((p, idx) => {
|
|
44
44
|
const cover = p.mainImage ?? p.images?.[0];
|
|
45
45
|
const href = String(ROUTES.PUBLIC.PRODUCT_DETAIL?.(p.slug ?? p.id) ?? "#");
|
|
46
|
-
return (_jsxs(Div, { className: "group relative overflow-hidden border border-[var(--appkit-color-border)] bg-[var(--appkit-color-surface)] transition-transform hover:scale-[1.01]", rounded: "lg", children: [_jsxs(Button, { variant: "ghost", type: "button", onClick: makeBundleItemClickHandler(p, idx, onItemClick, setLightboxIndex), paddingX: "none", paddingY: "none", rounded: "none", className: "relative block aspect-square w-full overflow-hidden focus-visible:ring-2 focus-visible:ring-[var(--appkit-color-primary)]", "aria-label": `View ${p.title} in lightbox`, children: [cover ? (_jsx(MediaImage, { src: cover, alt: p.title, size: "card", className: "transition-transform group-hover:scale-105" })) : (_jsx(Row, { textSize: "3xl", surface: "muted", className: "absolute inset-0", align: "center", justify: "center", children: PLACEHOLDER_EMOJI })), _jsxs(Div, { textWeight: "semibold", textSize: "xs", surface: "overlay-xl", padding: "chip-2xs", className: "absolute left-2 top-2 text-white", rounded: "default", children: ["#", idx + 1] })] }), _jsxs(Div, { padding: "xs", children: [_jsx(Link, { href: href, className: "line-clamp-2 text-[length:var(--appkit-text-sm)] font-medium hover:underline", children: p.title }), _jsx(Text, { className: "mt-0.5 text-[var(--appkit-color-text-muted)]", size: "xs", children: formatCurrency(
|
|
46
|
+
return (_jsxs(Div, { className: "group relative overflow-hidden border border-[var(--appkit-color-border)] bg-[var(--appkit-color-surface)] transition-transform hover:scale-[1.01]", rounded: "lg", children: [_jsxs(Button, { variant: "ghost", type: "button", onClick: makeBundleItemClickHandler(p, idx, onItemClick, setLightboxIndex), paddingX: "none", paddingY: "none", rounded: "none", className: "relative block aspect-square w-full overflow-hidden focus-visible:ring-2 focus-visible:ring-[var(--appkit-color-primary)]", "aria-label": `View ${p.title} in lightbox`, children: [cover ? (_jsx(MediaImage, { src: cover, alt: p.title, size: "card", className: "transition-transform group-hover:scale-105" })) : (_jsx(Row, { textSize: "3xl", surface: "muted", className: "absolute inset-0", align: "center", justify: "center", children: PLACEHOLDER_EMOJI })), _jsxs(Div, { textWeight: "semibold", textSize: "xs", surface: "overlay-xl", padding: "chip-2xs", className: "absolute left-2 top-2 text-white", rounded: "default", children: ["#", idx + 1] })] }), _jsxs(Div, { padding: "xs", children: [_jsx(Link, { href: href, className: "line-clamp-2 text-[length:var(--appkit-text-sm)] font-medium hover:underline", children: p.title }), _jsx(Text, { className: "mt-0.5 text-[var(--appkit-color-text-muted)]", size: "xs", children: formatCurrency(p.price ?? 0, p.currency ?? "INR") })] })] }, p.id));
|
|
47
47
|
}) }), _jsx(ImageLightbox, { images: galleryImages, activeIndex: lightboxIndex, onClose: () => setLightboxIndex(null), onNavigate: (i) => setLightboxIndex(i), showThumbnails: true })] }));
|
|
48
48
|
}
|
|
49
49
|
export default BundleCollage;
|
|
@@ -19,8 +19,8 @@ export function BundleDetailView({ bundle, members = [], onBuyNow, }) {
|
|
|
19
19
|
const memberCount = members.length || bundle.bundleProductIds?.length || 0;
|
|
20
20
|
const stock = bundle.bundleStockStatus ?? "in_stock";
|
|
21
21
|
const cover = bundle.display?.coverImage;
|
|
22
|
-
const priceLabel = bundle.
|
|
23
|
-
? formatCurrency(bundle.
|
|
22
|
+
const priceLabel = bundle.bundlePrice
|
|
23
|
+
? formatCurrency(bundle.bundlePrice, "INR")
|
|
24
24
|
: BUNDLE_COPY.detail.priceFallback;
|
|
25
25
|
return (_jsx(Main, { children: _jsx(Section, { padding: "y-2xl", children: _jsx(Container, { size: "xl", children: _jsxs(Stack, { gap: "lg", children: [_jsxs(Stack, { gap: "lg", direction: "md-row", align: "start", children: [_jsx(Div, { className: "w-full md:w-2/5", children: members.length > 0 ? (_jsx(BundleCollage, { members: members })) : (_jsx(Div, { className: `aspect-video w-full ${__O.hidden}`, rounded: "2xl", surface: "subtle", children: _jsx(Div, { className: "h-full w-full", children: _jsx(MediaImage, { src: cover, alt: bundle.name, size: "hero", fallback: PLACEHOLDER_EMOJI }) }) })) }), _jsxs(Stack, { gap: "md", className: "flex-1", children: [_jsx(Heading, { level: 1, size: "3xl", weight: "semibold", color: "primary", children: bundle.name }), _jsxs(Row, { gap: "sm", align: "center", children: [_jsx(Text, { size: "lg", weight: "bold", children: priceLabel }), _jsxs(Text, { size: "sm", color: "muted", children: ["\u00B7 ", BUNDLE_COPY.detail.itemCount(memberCount)] }), _jsx(Badge, { variant: BUNDLE_STOCK_VARIANT[stock], children: STOCK_BADGE_TEXT[stock] })] }), bundle.description && (_jsxs(Stack, { gap: "xs", children: [_jsx(Heading, { level: 2, className: "text-[var(--appkit-color-text-muted)]", size: "sm", weight: "semibold", children: BUNDLE_COPY.detailDescriptionHeading }), _jsx(Text, { className: "whitespace-pre-line", children: bundle.description })] })), onBuyNow ? (_jsx(BundleBuyNowCta, { bundleSlug: bundle.slug, outOfStock: stock === "out_of_stock", onBuyNow: onBuyNow })) : (_jsxs(Div, { textSize: "sm", className: "border-dashed", border: "strong", surface: "muted", rounded: "xl", padding: "md", "aria-live": "polite", children: [_jsx(Text, { weight: "semibold", className: "mb-1 block", children: BUNDLE_COPY.detail.ctaDisabled }), _jsx(Text, { size: "sm", color: "muted", children: BUNDLE_COPY.detail.ctaHint })] }))] })] }), _jsxs(Stack, { gap: "md", children: [_jsx(Heading, { level: 2, size: "xl", weight: "semibold", color: "primary", children: BUNDLE_COPY.detailItemsHeading }), members.length === 0 ? (_jsx(Text, { color: "muted", children: BUNDLE_COPY.detail.emptyMembers })) : (_jsx(Ul, { gap: "2", className: "grid grid-cols-1 sm:grid-cols-2", children: members.map((p, i) => (_jsxs(Li, { layout: "flex-center", gap: "2", rounded: "lg", border: "subtle", padding: "inlineSm", textSize: "sm", children: [_jsxs(Span, { size: "xs", weight: "semibold", className: "w-5", color: "faint", children: ["#", i + 1] }), _jsx(Link, { href: String(ROUTES.PUBLIC.PRODUCT_DETAIL?.(p.slug ?? p.id) ?? "#"), className: "flex-1 truncate font-medium hover:underline hover:text-primary", children: p.title })] }, p.id))) }))] })] }) }) }) }));
|
|
26
26
|
}
|
|
@@ -41,7 +41,7 @@ function renderBundleSearchResults(props) {
|
|
|
41
41
|
return (_jsxs(_Fragment, { children: [searchError && _jsx(Text, { size: "sm", color: "danger", children: searchError }), isSearching && _jsx(Text, { size: "sm", color: "muted", children: BUNDLE_COPY.picker.searchingHint }), !isSearching && debouncedQuery.length >= 2 && results.length === 0 && !searchError && (_jsx(Text, { size: "sm", color: "muted", children: BUNDLE_COPY.picker.noMatches(debouncedQuery) })), results.length > 0 && (_jsx(Div, { className: `max-h-72 ${__O.yAuto}`, rounded: "lg", border: "default", children: results.map((r) => {
|
|
42
42
|
const isSelected = selectedSet.has(r.id);
|
|
43
43
|
const atCap = !isSelected && value.length >= maxItems;
|
|
44
|
-
return (_jsxs(Row, { border: "subtle", gap: "sm", align: "center", className: `border-b last:border-b-0 ${isSelected ? CLS_ROW_SELECTED : ""} ${atCap ? "opacity-50" : ""}`, padding: "inlineSm", children: [_jsx(Checkbox, { checked: isSelected, disabled: atCap, onChange: () => toggle(r.id), "aria-label": BUNDLE_COPY.picker.toggleAria(r.title) }), _jsxs(Stack, { gap: "xs", className: "flex-1", children: [_jsx(Text, { size: "sm", weight: "medium", children: r.title }), _jsxs(Row, { gap: "sm", children: [_jsx(Text, { size: "xs", color: "muted", children: r.id }), typeof r.
|
|
44
|
+
return (_jsxs(Row, { border: "subtle", gap: "sm", align: "center", className: `border-b last:border-b-0 ${isSelected ? CLS_ROW_SELECTED : ""} ${atCap ? "opacity-50" : ""}`, padding: "inlineSm", children: [_jsx(Checkbox, { checked: isSelected, disabled: atCap, onChange: () => toggle(r.id), "aria-label": BUNDLE_COPY.picker.toggleAria(r.title) }), _jsxs(Stack, { gap: "xs", className: "flex-1", children: [_jsx(Text, { size: "sm", weight: "medium", children: r.title }), _jsxs(Row, { gap: "sm", children: [_jsx(Text, { size: "xs", color: "muted", children: r.id }), typeof r.price === "number" && _jsxs(Text, { size: "xs", color: "muted", children: ["\u00B7 \u20B9", r.price.toLocaleString("en-IN")] })] })] })] }, r.id));
|
|
45
45
|
}) }))] }));
|
|
46
46
|
}
|
|
47
47
|
export function BundleItemsPicker({ value, onChange, fetchProducts, minItems = BUNDLE_MIN_ITEMS, maxItems = BUNDLE_MAX_ITEMS, initialMetadata = {}, }) {
|
|
@@ -142,7 +142,7 @@ export async function defaultBundleItemsFetch(query) {
|
|
|
142
142
|
: Array.isArray(rec.images) && typeof rec.images[0] === "string"
|
|
143
143
|
? rec.images[0]
|
|
144
144
|
: undefined,
|
|
145
|
-
|
|
145
|
+
price: typeof rec.price === "number" ? rec.price : undefined,
|
|
146
146
|
storeId: typeof rec.storeId === "string" ? rec.storeId : undefined,
|
|
147
147
|
};
|
|
148
148
|
})
|
|
@@ -65,9 +65,9 @@ export function CategoryBundlesListing({ initialBundles, brandName, onBuyNow, })
|
|
|
65
65
|
}
|
|
66
66
|
list = [...list].sort((a, b) => {
|
|
67
67
|
if (sort === "price")
|
|
68
|
-
return (a.
|
|
68
|
+
return (a.bundlePrice ?? 0) - (b.bundlePrice ?? 0);
|
|
69
69
|
if (sort === "-price")
|
|
70
|
-
return (b.
|
|
70
|
+
return (b.bundlePrice ?? 0) - (a.bundlePrice ?? 0);
|
|
71
71
|
if (sort === "createdAt") {
|
|
72
72
|
const aT = a.createdAt instanceof Date ? a.createdAt.getTime() : 0;
|
|
73
73
|
const bT = b.createdAt instanceof Date ? b.createdAt.getTime() : 0;
|