@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
|
@@ -200,7 +200,7 @@ export function SellerProductsView({ onDeleteProduct, onCreateClick, children, .
|
|
|
200
200
|
updatedAt: toRelativeDate(item.updatedAt ?? item.createdAt),
|
|
201
201
|
imageUrl: toStringValue(item.mainImage ?? item.images?.[0], undefined),
|
|
202
202
|
listingKind: kind,
|
|
203
|
-
price: priceRaw ? `₹${
|
|
203
|
+
price: priceRaw ? `₹${priceRaw.toLocaleString("en-IN")}` : "—",
|
|
204
204
|
physicalLocation: item.physicalLocation &&
|
|
205
205
|
typeof item.physicalLocation.zone === "string"
|
|
206
206
|
? item.physicalLocation
|
|
@@ -30,13 +30,13 @@ export function SellerShippingView({ apiBase = SELLER_ENDPOINTS.SHIPPING }) {
|
|
|
30
30
|
setCurrent(cfg);
|
|
31
31
|
setDraft({
|
|
32
32
|
customCarrierName: cfg.customCarrierName ?? "",
|
|
33
|
-
customShippingPrice: cfg.customShippingPrice ? String(cfg.customShippingPrice
|
|
33
|
+
customShippingPrice: cfg.customShippingPrice ? String(cfg.customShippingPrice) : "",
|
|
34
34
|
pickupAddressId: "",
|
|
35
35
|
freeShippingThreshold: (res?.data?.freeShippingThreshold ?? 0)
|
|
36
|
-
? String(res.data.freeShippingThreshold
|
|
36
|
+
? String(res.data.freeShippingThreshold)
|
|
37
37
|
: "",
|
|
38
38
|
fragileSurcharge: (res?.data?.fragileSurcharge ?? 0)
|
|
39
|
-
? String(res.data.fragileSurcharge
|
|
39
|
+
? String(res.data.fragileSurcharge)
|
|
40
40
|
: "",
|
|
41
41
|
});
|
|
42
42
|
})
|
|
@@ -54,10 +54,10 @@ export function SellerShippingView({ apiBase = SELLER_ENDPOINTS.SHIPPING }) {
|
|
|
54
54
|
try {
|
|
55
55
|
const body = {
|
|
56
56
|
customCarrierName: draft.customCarrierName.trim(),
|
|
57
|
-
customShippingPrice: Math.round(parseFloat(draft.customShippingPrice || "0") * 100),
|
|
57
|
+
customShippingPrice: Math.round(parseFloat(draft.customShippingPrice || "0") * 100) / 100,
|
|
58
58
|
...(draft.pickupAddressId ? { pickupAddressId: draft.pickupAddressId } : {}),
|
|
59
|
-
freeShippingThreshold: Math.round(parseFloat(draft.freeShippingThreshold || "0") * 100),
|
|
60
|
-
fragileSurcharge: Math.round(parseFloat(draft.fragileSurcharge || "0") * 100),
|
|
59
|
+
freeShippingThreshold: Math.round(parseFloat(draft.freeShippingThreshold || "0") * 100) / 100,
|
|
60
|
+
fragileSurcharge: Math.round(parseFloat(draft.fragileSurcharge || "0") * 100) / 100,
|
|
61
61
|
};
|
|
62
62
|
const res = await fetch(apiBase, {
|
|
63
63
|
method: "PATCH",
|
|
@@ -11,7 +11,7 @@ import { ConfirmDeleteModal, RowActionMenu, Text } from "../../../ui";
|
|
|
11
11
|
import { SELLER_ENDPOINTS } from "../../../constants/api-endpoints";
|
|
12
12
|
import { ACTIONS } from "../../../_internal/shared/actions/action-registry";
|
|
13
13
|
import { ROUTES } from "../../..";
|
|
14
|
-
import { toRecordArray, toRelativeDate,
|
|
14
|
+
import { toRecordArray, toRelativeDate, toCurrency, toStringValue, } from "../../admin/hooks/useAdminListingData";
|
|
15
15
|
import { DataListingView } from "../../admin/components/DataListingView";
|
|
16
16
|
import { SELLER_BULK_ACTIONS, ROW_ACTION_META } from "../../products/constants/action-defs";
|
|
17
17
|
const COLUMNS = [
|
|
@@ -79,7 +79,7 @@ export function SellerStickersView({ onCreateClick, onEditClick, onDelete, onBul
|
|
|
79
79
|
return {
|
|
80
80
|
id: toStringValue(item.id, `stickers-${index}`),
|
|
81
81
|
title: toStringValue(item.productTitle ?? item.title, "Untitled"),
|
|
82
|
-
price:
|
|
82
|
+
price: toCurrency(item.price),
|
|
83
83
|
size: toStringValue(printMeta.size, ""),
|
|
84
84
|
status: toStringValue(item.status, "draft"),
|
|
85
85
|
createdAt: toRelativeDate(item.createdAt),
|
|
@@ -27,6 +27,6 @@ export declare function useSellerListingData<TResponse, TRow extends {
|
|
|
27
27
|
}>({ queryKey, endpoint, page, pageSize, sorts, filters, q, mapRows, getTotal, }: UseSellerListingDataOptions<TResponse, TRow>): UseSellerListingDataResult<TRow>;
|
|
28
28
|
export declare function toRecordArray(value: unknown): UnknownRecord[];
|
|
29
29
|
export declare function toStringValue(value: unknown, fallback?: string): string;
|
|
30
|
-
export declare function
|
|
30
|
+
export declare function toCurrency(value: unknown): string;
|
|
31
31
|
export declare function toRelativeDate(value: unknown): string;
|
|
32
32
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useQuery } from "@tanstack/react-query";
|
|
3
3
|
import { apiClient, ApiClientError } from "../../../http";
|
|
4
|
+
import { formatCurrency } from "../../../utils/number.formatter";
|
|
4
5
|
function withQueryParams(endpoint, params) {
|
|
5
6
|
const hasQuery = endpoint.includes("?");
|
|
6
7
|
const query = new URLSearchParams(params).toString();
|
|
@@ -49,11 +50,11 @@ export function toStringValue(value, fallback = "-") {
|
|
|
49
50
|
}
|
|
50
51
|
return fallback;
|
|
51
52
|
}
|
|
52
|
-
export function
|
|
53
|
+
export function toCurrency(value) {
|
|
53
54
|
if (typeof value !== "number" || Number.isNaN(value)) {
|
|
54
55
|
return "-";
|
|
55
56
|
}
|
|
56
|
-
return
|
|
57
|
+
return formatCurrency(value);
|
|
57
58
|
}
|
|
58
59
|
export function toRelativeDate(value) {
|
|
59
60
|
const date = parseDate(value);
|
|
@@ -10,7 +10,7 @@ import { ROUTES } from "../../../next/routing/route-map";
|
|
|
10
10
|
import { ACTIONS } from "../../../_internal/shared/actions/action-registry";
|
|
11
11
|
import { createShipmentSchema } from "../schemas/validation";
|
|
12
12
|
import { useShipment } from "../hooks/useShipments";
|
|
13
|
-
import {
|
|
13
|
+
import { formatCurrency } from "../../../utils/number.formatter";
|
|
14
14
|
const STATUS_OPTIONS = [
|
|
15
15
|
{ label: "Planning", value: "planning" },
|
|
16
16
|
{ label: "Ordered", value: "ordered" },
|
|
@@ -47,8 +47,8 @@ export function AdminShipmentEditorView({ shipmentId, onSaved }) {
|
|
|
47
47
|
setCarrier(shipment.carrier ?? "");
|
|
48
48
|
setEtaDate(shipment.etaDate ? new Date(shipment.etaDate).toISOString().slice(0, 10) : "");
|
|
49
49
|
setNotes(shipment.notes ?? "");
|
|
50
|
-
setCustomsTotalRupees(String(shipment.
|
|
51
|
-
setShippingTotalRupees(String(shipment.
|
|
50
|
+
setCustomsTotalRupees(String(shipment.customsTotal));
|
|
51
|
+
setShippingTotalRupees(String(shipment.shippingTotal));
|
|
52
52
|
setLaborHoursSpent(String(shipment.laborHoursSpent ?? 0));
|
|
53
53
|
}, [shipment]);
|
|
54
54
|
const saveMutation = useApiMutation({
|
|
@@ -63,8 +63,8 @@ export function AdminShipmentEditorView({ shipmentId, onSaved }) {
|
|
|
63
63
|
carrier: carrier || undefined,
|
|
64
64
|
etaDate: etaDate || undefined,
|
|
65
65
|
notes: notes || undefined,
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
customsTotal: Math.round(Number(customsTotalRupees) * 100) / 100,
|
|
67
|
+
shippingTotal: Math.round(Number(shippingTotalRupees) * 100) / 100,
|
|
68
68
|
laborHoursSpent: Number(laborHoursSpent),
|
|
69
69
|
};
|
|
70
70
|
if (isCreate) {
|
|
@@ -77,13 +77,13 @@ export function AdminShipmentEditorView({ shipmentId, onSaved }) {
|
|
|
77
77
|
onSaved?.(saved.id);
|
|
78
78
|
},
|
|
79
79
|
});
|
|
80
|
-
return (_jsx(Form, { schema: createShipmentSchema, spacing: "md", children: ({ setFieldError }) => (_jsxs(_Fragment, { children: [_jsxs(Grid, { cols: 2, gap: "md", children: [_jsx(FieldInput, { name: "shipmentNumber", label: "Shipment Number", required: true, value: shipmentNumber, onChange: setShipmentNumber, placeholder: "SH-2026-0001" }), _jsx(FieldInput, { name: "supplierName", label: "Supplier Name", required: true, value: supplierName, onChange: setSupplierName }), _jsx(FieldInput, { name: "originCountry", label: "Origin Country", value: originCountry, onChange: setOriginCountry }), _jsx(FieldSelect, { name: "status", label: "Status", required: true, value: status, onChange: setStatus, options: STATUS_OPTIONS }), _jsx(FieldInput, { name: "trackingNumber", label: "Tracking Number", value: trackingNumber, onChange: setTrackingNumber }), _jsx(FieldInput, { name: "carrier", label: "Carrier", value: carrier, onChange: setCarrier }), _jsx(FieldInput, { name: "etaDate", label: "ETA Date", type: "date", value: etaDate, onChange: setEtaDate }), _jsx(FieldInput, { name: "laborHoursSpent", label: "Labor Hours Spent", type: "number", min: "0", value: laborHoursSpent, onChange: setLaborHoursSpent }), _jsx(FieldInput, { name: "
|
|
80
|
+
return (_jsx(Form, { schema: createShipmentSchema, spacing: "md", children: ({ setFieldError }) => (_jsxs(_Fragment, { children: [_jsxs(Grid, { cols: 2, gap: "md", children: [_jsx(FieldInput, { name: "shipmentNumber", label: "Shipment Number", required: true, value: shipmentNumber, onChange: setShipmentNumber, placeholder: "SH-2026-0001" }), _jsx(FieldInput, { name: "supplierName", label: "Supplier Name", required: true, value: supplierName, onChange: setSupplierName }), _jsx(FieldInput, { name: "originCountry", label: "Origin Country", value: originCountry, onChange: setOriginCountry }), _jsx(FieldSelect, { name: "status", label: "Status", required: true, value: status, onChange: setStatus, options: STATUS_OPTIONS }), _jsx(FieldInput, { name: "trackingNumber", label: "Tracking Number", value: trackingNumber, onChange: setTrackingNumber }), _jsx(FieldInput, { name: "carrier", label: "Carrier", value: carrier, onChange: setCarrier }), _jsx(FieldInput, { name: "etaDate", label: "ETA Date", type: "date", value: etaDate, onChange: setEtaDate }), _jsx(FieldInput, { name: "laborHoursSpent", label: "Labor Hours Spent", type: "number", min: "0", value: laborHoursSpent, onChange: setLaborHoursSpent }), _jsx(FieldInput, { name: "customsTotal", label: "Customs Total (\u20B9)", type: "number", min: "0", value: customsTotalRupees, onChange: setCustomsTotalRupees, hint: "Split across lots by declared value" }), _jsx(FieldInput, { name: "shippingTotal", label: "Shipping Total (\u20B9)", type: "number", min: "0", value: shippingTotalRupees, onChange: setShippingTotalRupees, hint: "Split across lots by weight" })] }), _jsx(FieldTextarea, { name: "notes", label: "Notes", value: notes, onChange: setNotes, rows: 3 }), _jsx(Button, { type: "button", isLoading: saveMutation.isPending, onClick: () => {
|
|
81
81
|
const parsed = createShipmentSchema.safeParse({
|
|
82
82
|
shipmentNumber,
|
|
83
83
|
supplierName,
|
|
84
84
|
status,
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
customsTotal: Math.round(Number(customsTotalRupees) * 100) / 100,
|
|
86
|
+
shippingTotal: Math.round(Number(shippingTotalRupees) * 100) / 100,
|
|
87
87
|
laborHoursSpent: Number(laborHoursSpent),
|
|
88
88
|
});
|
|
89
89
|
if (!parsed.success) {
|
|
@@ -104,7 +104,7 @@ function ShipmentLotsSection({ shipmentId, lots, onLotsChanged, }) {
|
|
|
104
104
|
mutationFn: () => apiClient.post(ADMIN_ENDPOINTS.SHIPMENT_LOTS(shipmentId), {
|
|
105
105
|
lotName,
|
|
106
106
|
weightGrams: Number(weightGrams),
|
|
107
|
-
|
|
107
|
+
purchaseCost: Math.round(Number(purchaseCostRupees) * 100) / 100,
|
|
108
108
|
}),
|
|
109
109
|
onSuccess: () => {
|
|
110
110
|
setLotName("");
|
|
@@ -119,5 +119,5 @@ function ShipmentLotsSection({ shipmentId, lots, onLotsChanged, }) {
|
|
|
119
119
|
mutationFn: (lotId) => apiClient.delete(ADMIN_ENDPOINTS.SHIPMENT_LOT_BY_ID(shipmentId, lotId)),
|
|
120
120
|
onSuccess: () => onLotsChanged(),
|
|
121
121
|
});
|
|
122
|
-
return (_jsxs(Stack, { gap: "md", className: "border-t pt-[var(--appkit-space-4)]", children: [_jsxs(Div, { layout: "flex", align: "center", justify: "between", children: [_jsxs(Heading, { level: 4, children: ["Lots (", lots.length, "/10)"] }), lots.length < 10 && (_jsx(Button, { size: "sm", variant: "secondary", type: "button", onClick: () => setShowAddLot((v) => !v), children: showAddLot ? "Cancel" : "+ Add Lot" }))] }), showAddLot && (_jsxs(Grid, { cols: 3, gap: "sm", children: [_jsx(FieldInput, { name: "lotName", label: "Lot Name", value: lotName, onChange: setLotName }), _jsx(FieldInput, { name: "weightGrams", label: "Weight (g)", type: "number", min: "0", value: weightGrams, onChange: setWeightGrams }), _jsx(FieldInput, { name: "
|
|
122
|
+
return (_jsxs(Stack, { gap: "md", className: "border-t pt-[var(--appkit-space-4)]", children: [_jsxs(Div, { layout: "flex", align: "center", justify: "between", children: [_jsxs(Heading, { level: 4, children: ["Lots (", lots.length, "/10)"] }), lots.length < 10 && (_jsx(Button, { size: "sm", variant: "secondary", type: "button", onClick: () => setShowAddLot((v) => !v), children: showAddLot ? "Cancel" : "+ Add Lot" }))] }), showAddLot && (_jsxs(Grid, { cols: 3, gap: "sm", children: [_jsx(FieldInput, { name: "lotName", label: "Lot Name", value: lotName, onChange: setLotName }), _jsx(FieldInput, { name: "weightGrams", label: "Weight (g)", type: "number", min: "0", value: weightGrams, onChange: setWeightGrams }), _jsx(FieldInput, { name: "purchaseCost", label: "Purchase Cost (\u20B9)", type: "number", min: "0", value: purchaseCostRupees, onChange: setPurchaseCostRupees }), _jsx(Button, { type: "button", size: "sm", isLoading: addLotMutation.isPending, disabled: !lotName, onClick: () => addLotMutation.mutate(), children: "Save Lot" })] })), lots.length === 0 ? (_jsx(Text, { variant: "secondary", children: "No lots yet. Add a lot, then manage its items." })) : (_jsxs(Table, { children: [_jsx(Thead, { children: _jsxs(Tr, { children: [_jsx(Th, { children: "Lot" }), _jsx(Th, { children: "Weight (g)" }), _jsx(Th, { children: "Items" }), _jsx(Th, { children: "Projected Profit" }), _jsx(Th, {})] }) }), _jsx(Tbody, { children: lots.map((lot) => (_jsxs(Tr, { children: [_jsx(Td, { children: lot.lotName }), _jsx(Td, { children: lot.weightGrams }), _jsx(Td, { children: lot.itemCount }), _jsx(Td, { children: formatCurrency(lot.projectedProfit) }), _jsxs(Td, { className: "flex gap-[var(--appkit-space-2)]", children: [_jsx(TextLink, { href: ROUTES.ADMIN.SHIPMENT_LOT_ITEMS(shipmentId, lot.id), children: "Manage Items \u2192" }), _jsx(Button, { size: "sm", variant: "ghost", type: "button", action: ACTIONS.SHIPMENT["delete"], isLoading: deleteLotMutation.isPending, onClick: () => deleteLotMutation.mutate(lot.id), children: "Delete" })] })] }, lot.id))) })] })), lots.length > 0 && (_jsx(Alert, { variant: "info", children: "Customs/shipping allocation and profit totals recompute in the background a few seconds after any lot or item change \u2014 reload if a number looks stale." }))] }));
|
|
123
123
|
}
|
|
@@ -8,7 +8,7 @@ import { ADMIN_ENDPOINTS } from "../../../constants/api-endpoints";
|
|
|
8
8
|
import { ACTIONS } from "../../../_internal/shared/actions/action-registry";
|
|
9
9
|
import { useShipmentItems } from "../hooks/useShipments";
|
|
10
10
|
import { ShipmentItemLinkModal } from "./ShipmentItemLinkModal";
|
|
11
|
-
import {
|
|
11
|
+
import { formatCurrency } from "../../../utils/number.formatter";
|
|
12
12
|
function parseBulkText(text) {
|
|
13
13
|
return text
|
|
14
14
|
.split("\n")
|
|
@@ -21,7 +21,7 @@ function parseBulkText(text) {
|
|
|
21
21
|
return {
|
|
22
22
|
title: title ?? "",
|
|
23
23
|
quantity: Number(quantityStr) || 1,
|
|
24
|
-
price: isForSelfUse ? undefined : priceStr ? Math.round(Number(priceStr) * 100) : undefined,
|
|
24
|
+
price: isForSelfUse ? undefined : priceStr ? Math.round(Number(priceStr) * 100) / 100 : undefined,
|
|
25
25
|
isForSelfUse,
|
|
26
26
|
};
|
|
27
27
|
})
|
|
@@ -46,7 +46,7 @@ export function AdminShipmentLotItemsView({ shipmentId, lotId }) {
|
|
|
46
46
|
title,
|
|
47
47
|
quantity: Number(quantity),
|
|
48
48
|
isForSelfUse,
|
|
49
|
-
price: isForSelfUse ? undefined : Math.round(Number(priceRupees) * 100),
|
|
49
|
+
price: isForSelfUse ? undefined : Math.round(Number(priceRupees) * 100) / 100,
|
|
50
50
|
}),
|
|
51
51
|
onSuccess: () => {
|
|
52
52
|
setTitle("");
|
|
@@ -88,7 +88,7 @@ export function AdminShipmentLotItemsView({ shipmentId, lotId }) {
|
|
|
88
88
|
}),
|
|
89
89
|
onSuccess: () => refetch(),
|
|
90
90
|
});
|
|
91
|
-
return (_jsxs(Stack, { gap: "md", children: [_jsxs(Div, { layout: "flex", align: "center", justify: "between", children: [_jsxs(Heading, { level: 3, children: ["Lot Items (", meta?.total ?? items.length, "/500)"] }), _jsxs(Div, { className: "flex gap-[var(--appkit-space-2)]", children: [_jsx(Button, { size: "sm", variant: "secondary", onClick: () => setShowAddItem((v) => !v), children: showAddItem ? "Cancel" : "+ Add Item" }), _jsx(Button, { size: "sm", variant: "secondary", onClick: () => setShowBulkImport(true), children: "Bulk Import" })] })] }), _jsx(Alert, { variant: "info", children: "Only individually notable \"main\" items need a row here \u2014 everything else in the lot can be captured as a single remainder estimate on the lot itself. Linking an item to a product does not sync future edits either way." }), showAddItem && (_jsxs(Grid, { cols: 4, gap: "sm", children: [_jsx(FieldInput, { name: "title", label: "Title", required: true, value: title, onChange: setTitle }), _jsx(FieldInput, { name: "quantity", label: "Quantity", type: "number", min: "1", value: quantity, onChange: setQuantity }), _jsx(FieldInput, { name: "price", label: "Projected Sale Price (\u20B9)", type: "number", min: "0", value: priceRupees, onChange: setPriceRupees, disabled: isForSelfUse }), _jsx(FieldCheckbox, { name: "isForSelfUse", label: "For self use (no resale)", checked: isForSelfUse, onChange: setIsForSelfUse }), _jsx(Button, { size: "sm", isLoading: addItemMutation.isPending, disabled: !title || (!isForSelfUse && Number(priceRupees) <= 0), onClick: () => addItemMutation.mutate(), children: "Save Item" })] })), isLoading ? (_jsxs(Stack, { gap: "sm", children: [_jsx(Skeleton, { variant: "rectangular", height: "32px" }), _jsx(Skeleton, { variant: "rectangular", height: "32px" })] })) : items.length === 0 ? (_jsx(Text, { variant: "secondary", children: "No items tracked yet." })) : (_jsxs(Table, { children: [_jsx(Thead, { children: _jsxs(Tr, { children: [_jsx(Th, { children: "Title" }), _jsx(Th, { children: "Qty" }), _jsx(Th, { children: "Price" }), _jsx(Th, { children: "Status" }), _jsx(Th, {})] }) }), _jsx(Tbody, { children: items.map((item) => (_jsxs(Tr, { children: [_jsx(Td, { children: item.title }), _jsx(Td, { children: item.quantity }), _jsx(Td, { children: item.isForSelfUse ? "—" :
|
|
91
|
+
return (_jsxs(Stack, { gap: "md", children: [_jsxs(Div, { layout: "flex", align: "center", justify: "between", children: [_jsxs(Heading, { level: 3, children: ["Lot Items (", meta?.total ?? items.length, "/500)"] }), _jsxs(Div, { className: "flex gap-[var(--appkit-space-2)]", children: [_jsx(Button, { size: "sm", variant: "secondary", onClick: () => setShowAddItem((v) => !v), children: showAddItem ? "Cancel" : "+ Add Item" }), _jsx(Button, { size: "sm", variant: "secondary", onClick: () => setShowBulkImport(true), children: "Bulk Import" })] })] }), _jsx(Alert, { variant: "info", children: "Only individually notable \"main\" items need a row here \u2014 everything else in the lot can be captured as a single remainder estimate on the lot itself. Linking an item to a product does not sync future edits either way." }), showAddItem && (_jsxs(Grid, { cols: 4, gap: "sm", children: [_jsx(FieldInput, { name: "title", label: "Title", required: true, value: title, onChange: setTitle }), _jsx(FieldInput, { name: "quantity", label: "Quantity", type: "number", min: "1", value: quantity, onChange: setQuantity }), _jsx(FieldInput, { name: "price", label: "Projected Sale Price (\u20B9)", type: "number", min: "0", value: priceRupees, onChange: setPriceRupees, disabled: isForSelfUse }), _jsx(FieldCheckbox, { name: "isForSelfUse", label: "For self use (no resale)", checked: isForSelfUse, onChange: setIsForSelfUse }), _jsx(Button, { size: "sm", isLoading: addItemMutation.isPending, disabled: !title || (!isForSelfUse && Number(priceRupees) <= 0), onClick: () => addItemMutation.mutate(), children: "Save Item" })] })), isLoading ? (_jsxs(Stack, { gap: "sm", children: [_jsx(Skeleton, { variant: "rectangular", height: "32px" }), _jsx(Skeleton, { variant: "rectangular", height: "32px" })] })) : items.length === 0 ? (_jsx(Text, { variant: "secondary", children: "No items tracked yet." })) : (_jsxs(Table, { children: [_jsx(Thead, { children: _jsxs(Tr, { children: [_jsx(Th, { children: "Title" }), _jsx(Th, { children: "Qty" }), _jsx(Th, { children: "Price" }), _jsx(Th, { children: "Status" }), _jsx(Th, {})] }) }), _jsx(Tbody, { children: items.map((item) => (_jsxs(Tr, { children: [_jsx(Td, { children: item.title }), _jsx(Td, { children: item.quantity }), _jsx(Td, { children: item.isForSelfUse ? "—" : formatCurrency(item.price ?? 0) }), _jsx(Td, { children: item.isForSelfUse ? (_jsx(Badge, { variant: "secondary", children: "Self use" })) : item.linkedProductId ? (_jsx(Badge, { variant: "success", children: "Linked" })) : (_jsx(Badge, { variant: "default", children: "Unlinked" })) }), _jsxs(Td, { className: "flex gap-[var(--appkit-space-2)]", children: [!item.isForSelfUse &&
|
|
92
92
|
(item.linkedProductId ? (_jsx(Button, { size: "sm", variant: "ghost", isLoading: unlinkItemMutation.isPending, onClick: () => unlinkItemMutation.mutate(item.id), children: "Unlink" })) : (_jsx(Button, { size: "sm", variant: "ghost", onClick: () => setLinkTarget({ itemId: item.id, title: item.title }), children: "Create pre-order link" }))), _jsx(Button, { size: "sm", variant: "ghost", action: ACTIONS.SHIPMENT["delete"], isLoading: deleteItemMutation.isPending, onClick: () => deleteItemMutation.mutate(item.id), children: "Delete" })] })] }, item.id))) })] })), meta && meta.totalPages > 1 && (_jsx(Pagination, { currentPage: page, totalPages: meta.totalPages, onPageChange: setPage, pageSize: pageSize, onPageSizeChange: (size) => {
|
|
93
93
|
setPageSize(size);
|
|
94
94
|
setPage(1);
|
|
@@ -4,12 +4,12 @@ import React from "react";
|
|
|
4
4
|
import { Button, Div, Heading, Modal, Pagination, Select, Skeleton, Stack, Table, Thead, Tbody, Tr, Th, Td, Text } from "../../../ui";
|
|
5
5
|
import { useShipmentProjections, useShipmentItems } from "../hooks/useShipments";
|
|
6
6
|
import { ShipmentItemLinkModal } from "./ShipmentItemLinkModal";
|
|
7
|
-
import {
|
|
7
|
+
import { formatCurrency } from "../../../utils/number.formatter";
|
|
8
8
|
import { sortBy } from "../../../constants/sort";
|
|
9
9
|
const SORT_OPTIONS = [
|
|
10
|
-
{ value: sortBy("
|
|
11
|
-
{ value: sortBy("
|
|
12
|
-
{ value: sortBy("
|
|
10
|
+
{ value: sortBy("projectedProfit", "DESC"), label: "Highest projected profit" },
|
|
11
|
+
{ value: sortBy("projectedProfit", "ASC"), label: "Lowest projected profit" },
|
|
12
|
+
{ value: sortBy("projectedRevenue", "DESC"), label: "Highest projected revenue" },
|
|
13
13
|
{ value: sortBy("createdAt", "DESC"), label: "Newest" },
|
|
14
14
|
];
|
|
15
15
|
/**
|
|
@@ -25,7 +25,7 @@ export function AdminShipmentProjectionsView() {
|
|
|
25
25
|
const [sorts, setSorts] = React.useState(SORT_OPTIONS[0].value);
|
|
26
26
|
const { lots, meta, isLoading, refetch } = useShipmentProjections({ page, pageSize, sorts });
|
|
27
27
|
const [pickerLot, setPickerLot] = React.useState(null);
|
|
28
|
-
return (_jsxs(Stack, { gap: "md", children: [_jsxs(Div, { layout: "flex", align: "center", justify: "between", children: [_jsx(Heading, { level: 2, children: "Projections" }), _jsx(Select, { "aria-label": "Sort by", value: sorts, onValueChange: setSorts, options: SORT_OPTIONS })] }), isLoading ? (_jsxs(Stack, { gap: "sm", children: [_jsx(Skeleton, { variant: "rectangular", height: "32px" }), _jsx(Skeleton, { variant: "rectangular", height: "32px" }), _jsx(Skeleton, { variant: "rectangular", height: "32px" })] })) : lots.length === 0 ? (_jsx(Text, { variant: "secondary", children: "No lots to project yet." })) : (_jsxs(Table, { children: [_jsx(Thead, { children: _jsxs(Tr, { children: [_jsx(Th, { children: "Lot" }), _jsx(Th, { children: "Items" }), _jsx(Th, { children: "Landed Cost" }), _jsx(Th, { children: "Projected Revenue" }), _jsx(Th, { children: "Projected Profit" }), _jsx(Th, {})] }) }), _jsx(Tbody, { children: lots.map((lot) => (_jsxs(Tr, { children: [_jsx(Td, { children: lot.lotName }), _jsx(Td, { children: lot.itemCount }), _jsx(Td, { children:
|
|
28
|
+
return (_jsxs(Stack, { gap: "md", children: [_jsxs(Div, { layout: "flex", align: "center", justify: "between", children: [_jsx(Heading, { level: 2, children: "Projections" }), _jsx(Select, { "aria-label": "Sort by", value: sorts, onValueChange: setSorts, options: SORT_OPTIONS })] }), isLoading ? (_jsxs(Stack, { gap: "sm", children: [_jsx(Skeleton, { variant: "rectangular", height: "32px" }), _jsx(Skeleton, { variant: "rectangular", height: "32px" }), _jsx(Skeleton, { variant: "rectangular", height: "32px" })] })) : lots.length === 0 ? (_jsx(Text, { variant: "secondary", children: "No lots to project yet." })) : (_jsxs(Table, { children: [_jsx(Thead, { children: _jsxs(Tr, { children: [_jsx(Th, { children: "Lot" }), _jsx(Th, { children: "Items" }), _jsx(Th, { children: "Landed Cost" }), _jsx(Th, { children: "Projected Revenue" }), _jsx(Th, { children: "Projected Profit" }), _jsx(Th, {})] }) }), _jsx(Tbody, { children: lots.map((lot) => (_jsxs(Tr, { children: [_jsx(Td, { children: lot.lotName }), _jsx(Td, { children: lot.itemCount }), _jsx(Td, { children: formatCurrency(lot.totalLandedCost) }), _jsx(Td, { children: formatCurrency(lot.projectedRevenue) }), _jsx(Td, { className: lot.projectedProfit < 0 ? "text-error" : "text-success", children: formatCurrency(lot.projectedProfit) }), _jsx(Td, { children: _jsx(Button, { size: "sm", variant: "ghost", onClick: () => setPickerLot(lot), children: "Create pre-order link" }) })] }, lot.id))) })] })), meta && meta.totalPages > 1 && (_jsx(Pagination, { currentPage: page, totalPages: meta.totalPages, onPageChange: setPage, pageSize: pageSize, onPageSizeChange: (size) => {
|
|
29
29
|
setPageSize(size);
|
|
30
30
|
setPage(1);
|
|
31
31
|
} })), pickerLot && (_jsx(LotItemPickerModal, { lot: pickerLot, onClose: () => setPickerLot(null), onLinked: refetch }))] }));
|
|
@@ -9,7 +9,7 @@ import { toRecordArray, toRelativeDate, toStringValue, } from "../../admin/hooks
|
|
|
9
9
|
import { DataListingView } from "../../admin/components/DataListingView";
|
|
10
10
|
import { AdminShipmentEditorView } from "./AdminShipmentEditorView";
|
|
11
11
|
import { ADMIN_BULK_ACTIONS, ROW_ACTION_META } from "../../products/constants/action-defs";
|
|
12
|
-
import {
|
|
12
|
+
import { formatCurrency } from "../../../utils/number.formatter";
|
|
13
13
|
const STATUS_OPTIONS = [
|
|
14
14
|
{ id: "All", label: "All" },
|
|
15
15
|
{ id: "planning", label: "Planning" },
|
|
@@ -37,7 +37,7 @@ export function AdminShipmentsView({ children, ...props }) {
|
|
|
37
37
|
sortOptions: [
|
|
38
38
|
{ value: sortBy("createdAt", "DESC"), label: "Newest" },
|
|
39
39
|
{ value: sortBy("etaDate", "ASC"), label: "ETA soonest" },
|
|
40
|
-
{ value: sortBy("
|
|
40
|
+
{ value: sortBy("projectedProfit", "DESC"), label: "Highest projected profit" },
|
|
41
41
|
{ value: "shipmentNumber", label: "Shipment # A–Z" },
|
|
42
42
|
],
|
|
43
43
|
mapRows: (response) => toRecordArray(response.shipments).map((item, index) => {
|
|
@@ -52,8 +52,8 @@ export function AdminShipmentsView({ children, ...props }) {
|
|
|
52
52
|
.join(" · "),
|
|
53
53
|
status: toStringValue(item.status, "planning"),
|
|
54
54
|
updatedAt: toRelativeDate(updatedAt),
|
|
55
|
-
totalCost:
|
|
56
|
-
projectedProfit:
|
|
55
|
+
totalCost: formatCurrency(Number(totals.totalShipmentCost ?? 0)),
|
|
56
|
+
projectedProfit: formatCurrency(Number(totals.projectedProfit ?? 0)),
|
|
57
57
|
recalculating: !totalsComputedAt || (!!updatedAt && String(updatedAt) > String(totalsComputedAt)),
|
|
58
58
|
};
|
|
59
59
|
}),
|
|
@@ -31,11 +31,11 @@ export declare class ShipmentLotsRepository extends BaseRepository<ShipmentLot>
|
|
|
31
31
|
canFilter: boolean;
|
|
32
32
|
canSort: boolean;
|
|
33
33
|
};
|
|
34
|
-
|
|
34
|
+
projectedProfit: {
|
|
35
35
|
canFilter: boolean;
|
|
36
36
|
canSort: boolean;
|
|
37
37
|
};
|
|
38
|
-
|
|
38
|
+
projectedRevenue: {
|
|
39
39
|
canFilter: boolean;
|
|
40
40
|
canSort: boolean;
|
|
41
41
|
};
|
|
@@ -20,12 +20,12 @@ export class ShipmentLotsRepository extends BaseRepository {
|
|
|
20
20
|
shipmentId,
|
|
21
21
|
shipmentStatus,
|
|
22
22
|
itemCount: 0,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
mainItemsProjectedRevenue: 0,
|
|
24
|
+
customsAllocated: 0,
|
|
25
|
+
shippingAllocated: 0,
|
|
26
|
+
totalLandedCost: input.purchaseCost,
|
|
27
|
+
projectedRevenue: input.remainderEstimatedValue ?? 0,
|
|
28
|
+
projectedProfit: (input.remainderEstimatedValue ?? 0) - input.purchaseCost,
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
31
|
async updateLot(lotId, input) {
|
|
@@ -48,8 +48,8 @@ ShipmentLotsRepository.SIEVE_FIELDS = {
|
|
|
48
48
|
shipmentId: { canFilter: true, canSort: false },
|
|
49
49
|
shipmentStatus: { canFilter: true, canSort: false },
|
|
50
50
|
lotName: { canFilter: true, canSort: true },
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
projectedProfit: { canFilter: true, canSort: true },
|
|
52
|
+
projectedRevenue: { canFilter: true, canSort: true },
|
|
53
53
|
createdAt: { canFilter: true, canSort: true },
|
|
54
54
|
};
|
|
55
55
|
export const shipmentLotsRepository = new ShipmentLotsRepository();
|
|
@@ -24,14 +24,14 @@ export type ShipmentStatus = "planning" | "ordered" | "in_transit" | "customs" |
|
|
|
24
24
|
export declare const MAX_ITEMS_PER_LOT = 500;
|
|
25
25
|
export declare const MAX_LOTS_PER_SHIPMENT = 10;
|
|
26
26
|
export interface ShipmentTotals {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
27
|
+
lotsCost: number;
|
|
28
|
+
customsTotal: number;
|
|
29
|
+
shippingTotal: number;
|
|
30
|
+
laborCost: number;
|
|
31
|
+
totalShipmentCost: number;
|
|
32
|
+
totalProjectedRevenue: number;
|
|
33
|
+
projectedProfit: number;
|
|
34
|
+
projectedProfitAfterLabor: number;
|
|
35
35
|
projectedMarginPercent: number;
|
|
36
36
|
projectedRoiPercent: number;
|
|
37
37
|
totalWeightGrams: number;
|
|
@@ -50,10 +50,10 @@ export interface ShipmentDocument extends BaseDocument {
|
|
|
50
50
|
etaDate?: Date;
|
|
51
51
|
receivedDate?: Date;
|
|
52
52
|
notes?: string;
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
customsTotal: number;
|
|
54
|
+
shippingTotal: number;
|
|
55
55
|
laborHoursSpent?: number;
|
|
56
|
-
|
|
56
|
+
laborRatePerHour?: number;
|
|
57
57
|
totals: ShipmentTotals;
|
|
58
58
|
totalsComputedAt?: Date;
|
|
59
59
|
createdBy: string;
|
|
@@ -64,17 +64,17 @@ export interface ShipmentLot extends BaseDocument {
|
|
|
64
64
|
lotName: string;
|
|
65
65
|
supplierOrderRef?: string;
|
|
66
66
|
weightGrams: number;
|
|
67
|
-
|
|
67
|
+
purchaseCost: number;
|
|
68
68
|
images: MediaField[];
|
|
69
69
|
remainderItemCount?: number;
|
|
70
|
-
|
|
70
|
+
remainderEstimatedValue?: number;
|
|
71
71
|
itemCount: number;
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
72
|
+
mainItemsProjectedRevenue: number;
|
|
73
|
+
customsAllocated: number;
|
|
74
|
+
shippingAllocated: number;
|
|
75
|
+
totalLandedCost: number;
|
|
76
|
+
projectedRevenue: number;
|
|
77
|
+
projectedProfit: number;
|
|
78
78
|
}
|
|
79
79
|
/**
|
|
80
80
|
* Reused everywhere a "this will eventually become a real product" record is
|
|
@@ -127,7 +127,7 @@ export declare const SHIPMENT_LOT_FIELDS: {
|
|
|
127
127
|
readonly ID: "id";
|
|
128
128
|
readonly SHIPMENT_ID: "shipmentId";
|
|
129
129
|
readonly SHIPMENT_STATUS: "shipmentStatus";
|
|
130
|
-
readonly
|
|
130
|
+
readonly PROJECTED_PROFIT: "projectedProfit";
|
|
131
131
|
readonly CREATED_AT: "createdAt";
|
|
132
132
|
};
|
|
133
133
|
export declare const SHIPMENT_ITEM_FIELDS: {
|
|
@@ -139,7 +139,7 @@ export declare const SHIPMENT_ITEM_FIELDS: {
|
|
|
139
139
|
};
|
|
140
140
|
export type ShipmentCreateInput = Omit<ShipmentDocument, "id" | "createdAt" | "updatedAt" | "totals" | "totalsComputedAt">;
|
|
141
141
|
export type ShipmentUpdateInput = Partial<Omit<ShipmentDocument, "id" | "createdAt" | "createdBy" | "totals" | "totalsComputedAt">>;
|
|
142
|
-
export type ShipmentLotCreateInput = Omit<ShipmentLot, "id" | "createdAt" | "updatedAt" | "shipmentId" | "shipmentStatus" | "itemCount" | "
|
|
142
|
+
export type ShipmentLotCreateInput = Omit<ShipmentLot, "id" | "createdAt" | "updatedAt" | "shipmentId" | "shipmentStatus" | "itemCount" | "mainItemsProjectedRevenue" | "customsAllocated" | "shippingAllocated" | "totalLandedCost" | "projectedRevenue" | "projectedProfit">;
|
|
143
143
|
export type ShipmentLotUpdateInput = Partial<Omit<ShipmentLot, "id" | "createdAt" | "shipmentId">>;
|
|
144
144
|
export type ShipmentItemCreateInput = Omit<ShipmentItem, "id" | "createdAt" | "updatedAt" | "shipmentId" | "lotId">;
|
|
145
145
|
export type ShipmentItemUpdateInput = Partial<Omit<ShipmentItem, "id" | "createdAt" | "shipmentId" | "lotId">>;
|
|
@@ -20,14 +20,14 @@ export const SHIPMENT_ITEM_COLLECTION = "shipmentItems";
|
|
|
20
20
|
export const MAX_ITEMS_PER_LOT = 500;
|
|
21
21
|
export const MAX_LOTS_PER_SHIPMENT = 10;
|
|
22
22
|
export const DEFAULT_SHIPMENT_TOTALS = {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
23
|
+
lotsCost: 0,
|
|
24
|
+
customsTotal: 0,
|
|
25
|
+
shippingTotal: 0,
|
|
26
|
+
laborCost: 0,
|
|
27
|
+
totalShipmentCost: 0,
|
|
28
|
+
totalProjectedRevenue: 0,
|
|
29
|
+
projectedProfit: 0,
|
|
30
|
+
projectedProfitAfterLabor: 0,
|
|
31
31
|
projectedMarginPercent: 0,
|
|
32
32
|
projectedRoiPercent: 0,
|
|
33
33
|
totalWeightGrams: 0,
|
|
@@ -57,7 +57,7 @@ export const SHIPMENT_LOT_FIELDS = {
|
|
|
57
57
|
ID: "id",
|
|
58
58
|
SHIPMENT_ID: "shipmentId",
|
|
59
59
|
SHIPMENT_STATUS: "shipmentStatus",
|
|
60
|
-
|
|
60
|
+
PROJECTED_PROFIT: "projectedProfit",
|
|
61
61
|
CREATED_AT: "createdAt",
|
|
62
62
|
};
|
|
63
63
|
export const SHIPMENT_ITEM_FIELDS = {
|
|
@@ -10,16 +10,16 @@ export declare const createShipmentSchema: z.ZodObject<{
|
|
|
10
10
|
etaDate: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodDate]>>;
|
|
11
11
|
receivedDate: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodDate]>>;
|
|
12
12
|
notes: z.ZodOptional<z.ZodString>;
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
customsTotal: z.ZodNumber;
|
|
14
|
+
shippingTotal: z.ZodNumber;
|
|
15
15
|
laborHoursSpent: z.ZodOptional<z.ZodNumber>;
|
|
16
|
-
|
|
16
|
+
laborRatePerHour: z.ZodOptional<z.ZodNumber>;
|
|
17
17
|
}, "strip", z.ZodTypeAny, {
|
|
18
18
|
status: "received" | "cancelled" | "processing" | "ordered" | "completed" | "planning" | "in_transit" | "customs";
|
|
19
19
|
shipmentNumber: string;
|
|
20
20
|
supplierName: string;
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
customsTotal: number;
|
|
22
|
+
shippingTotal: number;
|
|
23
23
|
notes?: string | undefined;
|
|
24
24
|
trackingNumber?: string | undefined;
|
|
25
25
|
etaDate?: string | Date | undefined;
|
|
@@ -27,13 +27,13 @@ export declare const createShipmentSchema: z.ZodObject<{
|
|
|
27
27
|
carrier?: string | undefined;
|
|
28
28
|
receivedDate?: string | Date | undefined;
|
|
29
29
|
laborHoursSpent?: number | undefined;
|
|
30
|
-
|
|
30
|
+
laborRatePerHour?: number | undefined;
|
|
31
31
|
}, {
|
|
32
32
|
status: "received" | "cancelled" | "processing" | "ordered" | "completed" | "planning" | "in_transit" | "customs";
|
|
33
33
|
shipmentNumber: string;
|
|
34
34
|
supplierName: string;
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
customsTotal: number;
|
|
36
|
+
shippingTotal: number;
|
|
37
37
|
notes?: string | undefined;
|
|
38
38
|
trackingNumber?: string | undefined;
|
|
39
39
|
etaDate?: string | Date | undefined;
|
|
@@ -41,7 +41,7 @@ export declare const createShipmentSchema: z.ZodObject<{
|
|
|
41
41
|
carrier?: string | undefined;
|
|
42
42
|
receivedDate?: string | Date | undefined;
|
|
43
43
|
laborHoursSpent?: number | undefined;
|
|
44
|
-
|
|
44
|
+
laborRatePerHour?: number | undefined;
|
|
45
45
|
}>;
|
|
46
46
|
export declare const updateShipmentSchema: z.ZodObject<{
|
|
47
47
|
shipmentNumber: z.ZodOptional<z.ZodString>;
|
|
@@ -53,10 +53,10 @@ export declare const updateShipmentSchema: z.ZodObject<{
|
|
|
53
53
|
etaDate: z.ZodOptional<z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodDate]>>>;
|
|
54
54
|
receivedDate: z.ZodOptional<z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodDate]>>>;
|
|
55
55
|
notes: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
customsTotal: z.ZodOptional<z.ZodNumber>;
|
|
57
|
+
shippingTotal: z.ZodOptional<z.ZodNumber>;
|
|
58
58
|
laborHoursSpent: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
59
|
-
|
|
59
|
+
laborRatePerHour: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
60
60
|
}, "strip", z.ZodTypeAny, {
|
|
61
61
|
status?: "received" | "cancelled" | "processing" | "ordered" | "completed" | "planning" | "in_transit" | "customs" | undefined;
|
|
62
62
|
notes?: string | undefined;
|
|
@@ -67,10 +67,10 @@ export declare const updateShipmentSchema: z.ZodObject<{
|
|
|
67
67
|
originCountry?: string | undefined;
|
|
68
68
|
carrier?: string | undefined;
|
|
69
69
|
receivedDate?: string | Date | undefined;
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
customsTotal?: number | undefined;
|
|
71
|
+
shippingTotal?: number | undefined;
|
|
72
72
|
laborHoursSpent?: number | undefined;
|
|
73
|
-
|
|
73
|
+
laborRatePerHour?: number | undefined;
|
|
74
74
|
}, {
|
|
75
75
|
status?: "received" | "cancelled" | "processing" | "ordered" | "completed" | "planning" | "in_transit" | "customs" | undefined;
|
|
76
76
|
notes?: string | undefined;
|
|
@@ -81,16 +81,16 @@ export declare const updateShipmentSchema: z.ZodObject<{
|
|
|
81
81
|
originCountry?: string | undefined;
|
|
82
82
|
carrier?: string | undefined;
|
|
83
83
|
receivedDate?: string | Date | undefined;
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
customsTotal?: number | undefined;
|
|
85
|
+
shippingTotal?: number | undefined;
|
|
86
86
|
laborHoursSpent?: number | undefined;
|
|
87
|
-
|
|
87
|
+
laborRatePerHour?: number | undefined;
|
|
88
88
|
}>;
|
|
89
89
|
export declare const createShipmentLotSchema: z.ZodObject<{
|
|
90
90
|
lotName: z.ZodString;
|
|
91
91
|
supplierOrderRef: z.ZodOptional<z.ZodString>;
|
|
92
92
|
weightGrams: z.ZodNumber;
|
|
93
|
-
|
|
93
|
+
purchaseCost: z.ZodNumber;
|
|
94
94
|
images: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
95
95
|
url: z.ZodString;
|
|
96
96
|
type: z.ZodEnum<["image", "video", "file"]>;
|
|
@@ -114,7 +114,7 @@ export declare const createShipmentLotSchema: z.ZodObject<{
|
|
|
114
114
|
youtubeId?: string | undefined;
|
|
115
115
|
}>, "many">>>;
|
|
116
116
|
remainderItemCount: z.ZodOptional<z.ZodNumber>;
|
|
117
|
-
|
|
117
|
+
remainderEstimatedValue: z.ZodOptional<z.ZodNumber>;
|
|
118
118
|
}, "strip", z.ZodTypeAny, {
|
|
119
119
|
images: {
|
|
120
120
|
type: "video" | "image" | "file";
|
|
@@ -126,14 +126,14 @@ export declare const createShipmentLotSchema: z.ZodObject<{
|
|
|
126
126
|
}[];
|
|
127
127
|
lotName: string;
|
|
128
128
|
weightGrams: number;
|
|
129
|
-
|
|
129
|
+
purchaseCost: number;
|
|
130
130
|
supplierOrderRef?: string | undefined;
|
|
131
131
|
remainderItemCount?: number | undefined;
|
|
132
|
-
|
|
132
|
+
remainderEstimatedValue?: number | undefined;
|
|
133
133
|
}, {
|
|
134
134
|
lotName: string;
|
|
135
135
|
weightGrams: number;
|
|
136
|
-
|
|
136
|
+
purchaseCost: number;
|
|
137
137
|
images?: {
|
|
138
138
|
type: "video" | "image" | "file";
|
|
139
139
|
url: string;
|
|
@@ -144,13 +144,13 @@ export declare const createShipmentLotSchema: z.ZodObject<{
|
|
|
144
144
|
}[] | undefined;
|
|
145
145
|
supplierOrderRef?: string | undefined;
|
|
146
146
|
remainderItemCount?: number | undefined;
|
|
147
|
-
|
|
147
|
+
remainderEstimatedValue?: number | undefined;
|
|
148
148
|
}>;
|
|
149
149
|
export declare const updateShipmentLotSchema: z.ZodObject<{
|
|
150
150
|
lotName: z.ZodOptional<z.ZodString>;
|
|
151
151
|
supplierOrderRef: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
152
152
|
weightGrams: z.ZodOptional<z.ZodNumber>;
|
|
153
|
-
|
|
153
|
+
purchaseCost: z.ZodOptional<z.ZodNumber>;
|
|
154
154
|
images: z.ZodOptional<z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
155
155
|
url: z.ZodString;
|
|
156
156
|
type: z.ZodEnum<["image", "video", "file"]>;
|
|
@@ -174,7 +174,7 @@ export declare const updateShipmentLotSchema: z.ZodObject<{
|
|
|
174
174
|
youtubeId?: string | undefined;
|
|
175
175
|
}>, "many">>>>;
|
|
176
176
|
remainderItemCount: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
177
|
-
|
|
177
|
+
remainderEstimatedValue: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
178
178
|
}, "strip", z.ZodTypeAny, {
|
|
179
179
|
images?: {
|
|
180
180
|
type: "video" | "image" | "file";
|
|
@@ -187,9 +187,9 @@ export declare const updateShipmentLotSchema: z.ZodObject<{
|
|
|
187
187
|
lotName?: string | undefined;
|
|
188
188
|
supplierOrderRef?: string | undefined;
|
|
189
189
|
weightGrams?: number | undefined;
|
|
190
|
-
|
|
190
|
+
purchaseCost?: number | undefined;
|
|
191
191
|
remainderItemCount?: number | undefined;
|
|
192
|
-
|
|
192
|
+
remainderEstimatedValue?: number | undefined;
|
|
193
193
|
}, {
|
|
194
194
|
images?: {
|
|
195
195
|
type: "video" | "image" | "file";
|
|
@@ -202,9 +202,9 @@ export declare const updateShipmentLotSchema: z.ZodObject<{
|
|
|
202
202
|
lotName?: string | undefined;
|
|
203
203
|
supplierOrderRef?: string | undefined;
|
|
204
204
|
weightGrams?: number | undefined;
|
|
205
|
-
|
|
205
|
+
purchaseCost?: number | undefined;
|
|
206
206
|
remainderItemCount?: number | undefined;
|
|
207
|
-
|
|
207
|
+
remainderEstimatedValue?: number | undefined;
|
|
208
208
|
}>;
|
|
209
209
|
export declare const createShipmentItemSchema: z.ZodEffects<z.ZodObject<{
|
|
210
210
|
title: z.ZodString;
|