@mohasinac/appkit 4.62.0 → 4.63.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/.build-stamp.json +3 -3
- package/dist/_internal/client/features/layout/DashboardLayoutClient.js +8 -29
- package/dist/_internal/client/features/layout/filterNavItems.d.ts +28 -0
- package/dist/_internal/client/features/layout/filterNavItems.js +35 -0
- package/dist/_internal/server/features/ads/booking.d.ts +118 -0
- package/dist/_internal/server/features/ads/booking.js +326 -0
- package/dist/_internal/server/features/checkout/actions.d.ts +129 -9
- package/dist/_internal/server/features/checkout/actions.js +850 -79
- package/dist/_internal/server/features/checkout/expand-order-items.d.ts +1 -2
- package/dist/_internal/server/features/checkout/expand-order-items.js +32 -0
- package/dist/_internal/server/features/checkout/freeze-parts.d.ts +50 -0
- package/dist/_internal/server/features/checkout/freeze-parts.js +94 -0
- package/dist/_internal/server/features/checkout/value-otp-gate.d.ts +55 -0
- package/dist/_internal/server/features/checkout/value-otp-gate.js +60 -0
- package/dist/_internal/server/features/dashboard/attention.d.ts +128 -0
- package/dist/_internal/server/features/dashboard/attention.js +183 -0
- package/dist/_internal/server/features/dashboard/data.d.ts +47 -0
- package/dist/_internal/server/features/dashboard/data.js +82 -0
- package/dist/_internal/server/features/inventory/reservations.d.ts +99 -0
- package/dist/_internal/server/features/inventory/reservations.js +273 -0
- package/dist/_internal/server/features/invoicing/allocate.d.ts +63 -0
- package/dist/_internal/server/features/invoicing/allocate.js +162 -0
- package/dist/_internal/server/features/invoicing/credit-note.d.ts +57 -0
- package/dist/_internal/server/features/invoicing/credit-note.js +126 -0
- package/dist/_internal/server/features/invoicing/gstr1.d.ts +74 -0
- package/dist/_internal/server/features/invoicing/gstr1.js +251 -0
- package/dist/_internal/server/features/invoicing/issue.d.ts +96 -0
- package/dist/_internal/server/features/invoicing/issue.js +202 -0
- package/dist/_internal/server/features/offers/destinations.d.ts +40 -0
- package/dist/_internal/server/features/offers/destinations.js +65 -0
- package/dist/_internal/server/features/orders/actions.d.ts +8 -1
- package/dist/_internal/server/features/orders/actions.js +81 -8
- package/dist/_internal/server/features/orders/adapters.js +54 -0
- package/dist/_internal/server/features/orders/amend-delivery.d.ts +56 -0
- package/dist/_internal/server/features/orders/amend-delivery.js +124 -0
- package/dist/_internal/server/features/orders/balance.d.ts +89 -0
- package/dist/_internal/server/features/orders/balance.js +256 -0
- package/dist/_internal/server/features/orders/cancellation-refund.d.ts +15 -9
- package/dist/_internal/server/features/orders/cancellation-refund.js +15 -9
- package/dist/_internal/server/features/points/award.js +46 -4
- package/dist/_internal/server/features/pricing/actions.d.ts +58 -0
- package/dist/_internal/server/features/pricing/actions.js +144 -0
- package/dist/_internal/server/features/refunds/actions.js +26 -0
- package/dist/_internal/server/features/shipping/book-split.d.ts +86 -0
- package/dist/_internal/server/features/shipping/book-split.js +130 -0
- package/dist/_internal/server/features/shipping/book.d.ts +61 -0
- package/dist/_internal/server/features/shipping/book.js +176 -0
- package/dist/_internal/server/features/shipping/courier-block.d.ts +69 -0
- package/dist/_internal/server/features/shipping/courier-block.js +264 -0
- package/dist/_internal/server/features/site-settings/adapters.d.ts +2 -2
- package/dist/_internal/server/features/site-settings/adapters.js +29 -0
- package/dist/_internal/server/features/stores/adapters.d.ts +2 -2
- package/dist/_internal/server/features/stores/adapters.js +65 -0
- package/dist/_internal/server/functions/scheduled.d.ts +2 -1
- package/dist/_internal/server/functions/scheduled.js +95 -2
- package/dist/_internal/server/jobs/core/autoPayoutEligibility.js +11 -2
- package/dist/_internal/server/jobs/core/dailyStatusDigest.d.ts +4 -0
- package/dist/_internal/server/jobs/core/dailyStatusDigest.js +19 -2
- package/dist/_internal/server/jobs/core/index.d.ts +2 -1
- package/dist/_internal/server/jobs/core/index.js +2 -1
- package/dist/_internal/server/jobs/core/jobRunners.js +45 -0
- package/dist/_internal/server/jobs/core/onJobCreated.d.ts +30 -7
- package/dist/_internal/server/jobs/core/onJobCreated.js +78 -45
- package/dist/_internal/server/jobs/core/onOrderStatusChange.d.ts +7 -0
- package/dist/_internal/server/jobs/core/onOrderStatusChange.js +65 -0
- package/dist/_internal/server/jobs/core/paymentWindowTimeout.js +33 -0
- package/dist/_internal/server/jobs/core/reservationExpiry.d.ts +17 -0
- package/dist/_internal/server/jobs/core/reservationExpiry.js +40 -0
- package/dist/_internal/server/jobs/core/runJobOnce.d.ts +48 -0
- package/dist/_internal/server/jobs/core/runJobOnce.js +195 -0
- package/dist/_internal/server/jobs/core/weeklyPayoutEligibility.js +25 -2
- package/dist/_internal/server/jobs/handlers/index.d.ts +1 -0
- package/dist/_internal/server/jobs/handlers/index.js +1 -0
- package/dist/_internal/server/jobs/handlers/onOrderStatusChange.js +17 -0
- package/dist/_internal/server/jobs/handlers/reservationExpiry.d.ts +2 -0
- package/dist/_internal/server/jobs/handlers/reservationExpiry.js +2 -0
- package/dist/_internal/server/notifications/channel-health.d.ts +26 -3
- package/dist/_internal/shared/actions/action-registry.d.ts +1 -1
- package/dist/_internal/shared/actions/action-registry.js +296 -0
- package/dist/_internal/shared/checkout/coupon-discount.d.ts +43 -1
- package/dist/_internal/shared/checkout/coupon-discount.js +26 -1
- package/dist/_internal/shared/checkout/order-math.d.ts +174 -0
- package/dist/_internal/shared/checkout/order-math.js +159 -0
- package/dist/_internal/shared/checkout/refundable-base.d.ts +25 -0
- package/dist/_internal/shared/checkout/refundable-base.js +13 -1
- package/dist/_internal/shared/checkout/rules/index.d.ts +1 -1
- package/dist/_internal/shared/checkout/rules/index.js +1 -1
- package/dist/_internal/shared/checkout/rules/payment-gate.d.ts +18 -0
- package/dist/_internal/shared/checkout/rules/payment-gate.js +25 -0
- package/dist/_internal/shared/checkout/split.d.ts +75 -0
- package/dist/_internal/shared/checkout/split.js +120 -0
- package/dist/_internal/shared/content/disclaimers.d.ts +88 -0
- package/dist/_internal/shared/content/disclaimers.js +217 -0
- package/dist/_internal/shared/content/published-values.d.ts +93 -0
- package/dist/_internal/shared/content/published-values.js +206 -0
- package/dist/_internal/shared/features/admin/integrations.d.ts +139 -0
- package/dist/_internal/shared/features/admin/integrations.js +263 -0
- package/dist/_internal/shared/features/dashboard/hub-sections.d.ts +72 -0
- package/dist/_internal/shared/features/dashboard/hub-sections.js +75 -0
- package/dist/_internal/shared/features/emi/choice.d.ts +98 -0
- package/dist/_internal/shared/features/emi/choice.js +69 -0
- package/dist/_internal/shared/features/emi/group.d.ts +84 -0
- package/dist/_internal/shared/features/emi/group.js +126 -0
- package/dist/_internal/shared/features/ledger/posting.d.ts +107 -0
- package/dist/_internal/shared/features/ledger/posting.js +165 -0
- package/dist/_internal/shared/features/ledger/reports.d.ts +76 -0
- package/dist/_internal/shared/features/ledger/reports.js +127 -0
- package/dist/_internal/shared/features/ledger/rules.d.ts +170 -0
- package/dist/_internal/shared/features/ledger/rules.js +221 -0
- package/dist/_internal/shared/features/offers/coordination.d.ts +122 -0
- package/dist/_internal/shared/features/offers/coordination.js +80 -0
- package/dist/_internal/shared/features/orders/delivery-snapshot.d.ts +114 -0
- package/dist/_internal/shared/features/orders/delivery-snapshot.js +116 -0
- package/dist/_internal/shared/features/orders/dispute-reasons.d.ts +113 -0
- package/dist/_internal/shared/features/orders/dispute-reasons.js +181 -0
- package/dist/_internal/shared/features/orders/refund-copy.d.ts +1 -1
- package/dist/_internal/shared/features/orders/refund-copy.js +18 -1
- package/dist/_internal/shared/features/payouts/pay-period.d.ts +91 -0
- package/dist/_internal/shared/features/payouts/pay-period.js +104 -0
- package/dist/_internal/shared/features/points/accepts.d.ts +29 -0
- package/dist/_internal/shared/features/points/accepts.js +49 -0
- package/dist/_internal/shared/features/pricing/rate-registry.d.ts +150 -0
- package/dist/_internal/shared/features/pricing/rate-registry.js +246 -0
- package/dist/_internal/shared/features/shipping/parcel.d.ts +123 -0
- package/dist/_internal/shared/features/shipping/parcel.js +139 -0
- package/dist/_internal/shared/features/shipping/shared-purchase.d.ts +91 -0
- package/dist/_internal/shared/features/shipping/shared-purchase.js +108 -0
- package/dist/_internal/shared/features/site-settings/fees.d.ts +16 -8
- package/dist/_internal/shared/features/site-settings/fees.js +12 -8
- package/dist/_internal/shared/features/site-settings/types.d.ts +11 -0
- package/dist/_internal/shared/fees/calculator.d.ts +33 -1
- package/dist/_internal/shared/fees/calculator.js +32 -2
- package/dist/_internal/shared/fees/explain.d.ts +81 -0
- package/dist/_internal/shared/fees/explain.js +101 -0
- package/dist/_internal/shared/history/index.d.ts +1 -1
- package/dist/_internal/shared/history/index.js +1 -1
- package/dist/_internal/shared/history/types.d.ts +7 -1
- package/dist/_internal/shared/history/types.js +25 -0
- package/dist/client.d.ts +21 -0
- package/dist/client.js +43 -0
- package/dist/constants/api-endpoints.d.ts +114 -0
- package/dist/constants/api-endpoints.js +55 -0
- package/dist/constants/field-names.d.ts +42 -0
- package/dist/constants/field-names.js +52 -0
- package/dist/contracts/index.d.ts +1 -1
- package/dist/contracts/shipping.d.ts +45 -0
- package/dist/contracts/shipping.js +15 -0
- package/dist/features/about/components/AboutView.js +1 -1
- package/dist/features/account/components/BuyerAuctionsGuideView.js +4 -1
- package/dist/features/account/components/UserOrdersView.js +47 -35
- package/dist/features/admin/components/AdminCouponEditorView.js +17 -0
- package/dist/features/admin/components/AdminIntegrationsView.d.ts +55 -0
- package/dist/features/admin/components/AdminIntegrationsView.js +74 -0
- package/dist/features/admin/components/AdminInvoicingView.d.ts +2 -0
- package/dist/features/admin/components/AdminInvoicingView.js +65 -0
- package/dist/features/admin/components/AdminOrderEditorView.d.ts +33 -1
- package/dist/features/admin/components/AdminOrderEditorView.js +81 -3
- package/dist/features/admin/components/AdminOrdersGuideView.js +23 -2
- package/dist/features/admin/components/AdminOrdersView.js +86 -5
- package/dist/features/admin/components/OwnerQuickActions.js +24 -2
- package/dist/features/admin/constants/filter-tabs.d.ts +6 -0
- package/dist/features/admin/constants/filter-tabs.js +6 -0
- package/dist/features/admin/constants/site-settings-tabs.d.ts +1 -1
- package/dist/features/admin/hooks/useAdminListingData.js +16 -0
- package/dist/features/admin/schemas/admin-user-form.d.ts +2 -2
- package/dist/features/admin/schemas/firestore.d.ts +62 -0
- package/dist/features/admin/schemas/firestore.js +5 -0
- package/dist/features/ads/schemas/booking-write.d.ts +120 -0
- package/dist/features/ads/schemas/booking-write.js +75 -0
- package/dist/features/ads/schemas/creative-form.d.ts +18 -0
- package/dist/features/ads/schemas/creative-form.js +51 -0
- package/dist/features/ads/schemas/firestore.d.ts +140 -0
- package/dist/features/ads/schemas/firestore.js +109 -0
- package/dist/features/auctions/repository/bid.repository.js +3 -1
- package/dist/features/audit-log/schemas/firestore.d.ts +140 -0
- package/dist/features/audit-log/schemas/firestore.js +89 -0
- package/dist/features/auth/actions/profile-actions.d.ts +69 -1
- package/dist/features/auth/actions/profile-actions.js +62 -1
- package/dist/features/auth/permissions/constants.js +13 -0
- package/dist/features/auth/schemas/firestore.d.ts +16 -2
- package/dist/features/auth/schemas/firestore.js +2 -1
- package/dist/features/blog/actions/blog-actions.d.ts +6 -0
- package/dist/features/blog/actions/blog-actions.js +17 -2
- package/dist/features/blog/api/route.js +4 -1
- package/dist/features/blog/columns/index.js +5 -0
- package/dist/features/blog/components/BlogIndexPageView.js +2 -1
- package/dist/features/blog/repository/blog.repository.d.ts +4 -0
- package/dist/features/blog/repository/blog.repository.js +5 -0
- package/dist/features/blog/schemas/blog-form.d.ts +3 -0
- package/dist/features/blog/schemas/blog-form.js +1 -0
- package/dist/features/blog/schemas/firestore.d.ts +38 -1
- package/dist/features/blog/schemas/firestore.js +23 -0
- package/dist/features/blog/schemas/index.d.ts +6 -0
- package/dist/features/blog/schemas/index.js +2 -0
- package/dist/features/blog/types/index.d.ts +2 -0
- package/dist/features/cart/components/CartPriceBreakdown.d.ts +25 -1
- package/dist/features/cart/components/CartPriceBreakdown.js +29 -6
- package/dist/features/cart/components/PointsTenderPicker.d.ts +61 -0
- package/dist/features/cart/components/PointsTenderPicker.js +15 -0
- package/dist/features/cart/components/StoreAddonsPicker.js +2 -1
- package/dist/features/cart/components/index.d.ts +2 -0
- package/dist/features/cart/components/index.js +1 -0
- package/dist/features/cart/repository/cart.repository.d.ts +33 -0
- package/dist/features/cart/repository/cart.repository.js +47 -0
- package/dist/features/cart/schemas/firestore.d.ts +116 -0
- package/dist/features/contact/email.d.ts +27 -10
- package/dist/features/contact/email.js +20 -3
- package/dist/features/dashboard/components/DashboardHubView.d.ts +83 -0
- package/dist/features/dashboard/components/DashboardHubView.js +56 -0
- package/dist/features/dashboard/components/DashboardSectionsClient.d.ts +23 -0
- package/dist/features/dashboard/components/DashboardSectionsClient.js +66 -0
- package/dist/features/dispute-reasons/components/AdminDisputeReasonsView.d.ts +55 -0
- package/dist/features/dispute-reasons/components/AdminDisputeReasonsView.js +175 -0
- package/dist/features/dispute-reasons/repository/dispute-reasons.repository.d.ts +62 -0
- package/dist/features/dispute-reasons/repository/dispute-reasons.repository.js +108 -0
- package/dist/features/dispute-reasons/schemas/firestore.d.ts +62 -0
- package/dist/features/dispute-reasons/schemas/firestore.js +40 -0
- package/dist/features/events/components/EventSaleBanner.js +1 -1
- package/dist/features/faq/components/FAQAccordion.d.ts +13 -1
- package/dist/features/faq/components/FAQAccordion.js +29 -4
- package/dist/features/faq/components/FAQPageContent.js +2 -2
- package/dist/features/gateway-events/schemas/index.d.ts +2 -2
- package/dist/features/homepage/schemas/index.d.ts +8 -8
- package/dist/features/inventory/schemas/stock-reservation.d.ts +114 -0
- package/dist/features/inventory/schemas/stock-reservation.js +103 -0
- package/dist/features/invoicing/schemas/firestore.d.ts +112 -0
- package/dist/features/invoicing/schemas/firestore.js +45 -0
- package/dist/features/invoicing/utils/financial-year.d.ts +43 -0
- package/dist/features/invoicing/utils/financial-year.js +53 -0
- package/dist/features/jobs/actions/enqueue-job.js +18 -1
- package/dist/features/jobs/repository/jobs.repository.d.ts +62 -1
- package/dist/features/jobs/repository/jobs.repository.js +84 -1
- package/dist/features/jobs/schemas/firestore.d.ts +80 -0
- package/dist/features/jobs/schemas/firestore.js +37 -0
- package/dist/features/layout/AppLayoutShell.d.ts +9 -1
- package/dist/features/layout/AppLayoutShell.js +12 -4
- package/dist/features/layout/BottomActions.js +2 -1
- package/dist/features/layout/BottomNavbar.d.ts +10 -2
- package/dist/features/layout/SideActionDock.js +52 -2
- package/dist/features/layout/TitleBarLayout.js +13 -4
- package/dist/features/layout/TitleBarLayout.style.css +59 -0
- package/dist/features/layout/useCtaReveal.d.ts +16 -1
- package/dist/features/layout/useCtaReveal.js +17 -26
- package/dist/features/ledger/repository/journal.repository.d.ts +110 -0
- package/dist/features/ledger/repository/journal.repository.js +312 -0
- package/dist/features/ledger/schemas/expenses.d.ts +87 -0
- package/dist/features/ledger/schemas/expenses.js +27 -0
- package/dist/features/ledger/schemas/firestore.d.ts +183 -0
- package/dist/features/ledger/schemas/firestore.js +69 -0
- package/dist/features/lottery/schemas/zod.d.ts +6 -6
- package/dist/features/media/MediaImage.js +22 -1
- package/dist/features/media/upload/ImageUpload.js +1 -1
- package/dist/features/obligations/constants/policies.js +24 -1
- package/dist/features/orders/components/BalancePaymentPanel.d.ts +12 -0
- package/dist/features/orders/components/BalancePaymentPanel.js +94 -0
- package/dist/features/orders/components/OrderPaymentSummary.js +10 -1
- package/dist/features/orders/components/OrderProvenanceCard.d.ts +8 -0
- package/dist/features/orders/components/OrderProvenanceCard.js +185 -0
- package/dist/features/orders/components/RaiseDisputeForm.d.ts +14 -0
- package/dist/features/orders/components/RaiseDisputeForm.js +119 -0
- package/dist/features/orders/components/RefundRequestView.js +19 -1
- package/dist/features/orders/components/index.d.ts +4 -0
- package/dist/features/orders/components/index.js +2 -0
- package/dist/features/orders/constants/order-lane-tabs.d.ts +69 -0
- package/dist/features/orders/constants/order-lane-tabs.js +88 -0
- package/dist/features/orders/repository/orders.repository.d.ts +85 -1
- package/dist/features/orders/repository/orders.repository.js +205 -6
- package/dist/features/orders/schemas/balance.d.ts +40 -0
- package/dist/features/orders/schemas/balance.js +47 -0
- package/dist/features/orders/schemas/firestore.d.ts +398 -1
- package/dist/features/orders/schemas/firestore.js +43 -0
- package/dist/features/orders/schemas/index.d.ts +56 -8
- package/dist/features/orders/schemas/index.js +12 -0
- package/dist/features/orders/types/index.d.ts +47 -0
- package/dist/features/orders/utils/courier-block.d.ts +25 -0
- package/dist/features/orders/utils/courier-block.js +23 -0
- package/dist/features/payment-cases/schemas/firestore.d.ts +26 -1
- package/dist/features/payment-cases/schemas/firestore.js +1 -0
- package/dist/features/payments/repository/payout.repository.js +3 -2
- package/dist/features/payments/schemas/firestore.d.ts +92 -1
- package/dist/features/payments/schemas/firestore.js +23 -0
- package/dist/features/pricing/components/AdminPricingView.d.ts +13 -0
- package/dist/features/pricing/components/AdminPricingView.js +157 -0
- package/dist/features/products/components/PrizeDrawDetailPageView.js +2 -2
- package/dist/features/products/components/ProductDetailPageView.d.ts +17 -1
- package/dist/features/products/components/ProductDetailPageView.js +2 -2
- package/dist/features/products/schemas/firestore.d.ts +26 -1
- package/dist/features/products/schemas/firestore.js +2 -0
- package/dist/features/products/schemas/index.d.ts +2 -2
- package/dist/features/products/schemas/product-features.validators.d.ts +10 -10
- package/dist/features/promotions/actions/coupon-stacking.d.ts +30 -3
- package/dist/features/promotions/actions/coupon-stacking.js +21 -2
- package/dist/features/promotions/components/CouponCard.js +13 -0
- package/dist/features/promotions/constants/coupon-help.d.ts +2 -2
- package/dist/features/promotions/constants/coupon-help.js +9 -1
- package/dist/features/promotions/schemas/firestore.d.ts +24 -0
- package/dist/features/promotions/schemas/firestore.js +4 -0
- package/dist/features/promotions/types/index.d.ts +19 -1
- package/dist/features/reviews/repository/reviews.repository.d.ts +14 -0
- package/dist/features/reviews/repository/reviews.repository.js +16 -0
- package/dist/features/scams/components/ScamProfileView.js +2 -2
- package/dist/features/scams/components/ScamRegistryView.js +2 -2
- package/dist/features/scams/repository/scammer.repository.js +2 -1
- package/dist/features/scams/schemas/firestore.d.ts +2 -1
- package/dist/features/scams/schemas/firestore.js +2 -1
- package/dist/features/search/action-index/tab-entries.js +1 -1
- package/dist/features/seller/actions/offer-actions.js +56 -0
- package/dist/features/seller/actions/seller-actions.d.ts +1 -1
- package/dist/features/seller/actions/seller-actions.js +37 -3
- package/dist/features/seller/components/DispatchForm.d.ts +11 -0
- package/dist/features/seller/components/DispatchForm.js +190 -0
- package/dist/features/seller/components/SellerOrdersView.js +221 -27
- package/dist/features/seller/components/index.d.ts +1 -0
- package/dist/features/seller/components/index.js +1 -0
- package/dist/features/seller/hooks/useSellerListingData.js +25 -0
- package/dist/features/seller/repository/offer.repository.js +4 -3
- package/dist/features/seller/schemas/firestore.d.ts +23 -2
- package/dist/features/seller/schemas/firestore.js +3 -2
- package/dist/features/seller/schemas/index.d.ts +4 -4
- package/dist/features/seller/schemas/order-forms.d.ts +61 -4
- package/dist/features/seller/schemas/order-forms.js +41 -8
- package/dist/features/shipments/schemas/firestore.d.ts +25 -0
- package/dist/features/shipments/schemas/validation.d.ts +4 -4
- package/dist/features/shipping-boxes/repository/shipping-boxes.repository.d.ts +82 -0
- package/dist/features/shipping-boxes/repository/shipping-boxes.repository.js +145 -0
- package/dist/features/shipping-boxes/schemas/firestore.d.ts +80 -0
- package/dist/features/shipping-boxes/schemas/firestore.js +53 -0
- package/dist/features/store-extensions/schemas/report-create-form.d.ts +2 -2
- package/dist/features/store-extensions/schemas/shipping-config-form.d.ts +2 -2
- package/dist/features/stores/components/StoreOrdersGuideView.js +6 -1
- package/dist/features/stores/repository/store.repository.d.ts +18 -0
- package/dist/features/stores/repository/store.repository.js +27 -1
- package/dist/features/stores/schemas/firestore.d.ts +112 -0
- package/dist/features/stores/schemas/firestore.js +20 -0
- package/dist/features/stores/schemas/index.d.ts +6 -6
- package/dist/features/stores/types/index.d.ts +19 -0
- package/dist/features/support/repository/support.repository.js +72 -6
- package/dist/features/support/schemas/firestore.d.ts +17 -0
- package/dist/features/support/schemas/index.d.ts +8 -8
- package/dist/features/wishlist/hooks/useWishlistWithGuest.d.ts +1 -1
- package/dist/index.d.ts +11 -1
- package/dist/index.js +33 -1
- package/dist/next/routing/route-map.d.ts +112 -0
- package/dist/next/routing/route-map.js +63 -0
- package/dist/providers/shipping-shiprocket/index.d.ts +27 -1
- package/dist/providers/shipping-shiprocket/index.js +84 -1
- package/dist/react/contexts/SessionContext.d.ts +17 -1
- package/dist/schemas/registry.d.ts +69 -34
- package/dist/schemas/sieve.d.ts +2 -2
- package/dist/security/pii-schemas.d.ts +1 -1
- package/dist/security/pii-schemas.js +45 -0
- package/dist/server-entry.d.ts +2 -2
- package/dist/server-entry.js +8 -1
- package/dist/server.d.ts +36 -1
- package/dist/server.js +183 -1
- package/dist/styles.css +412 -80
- package/dist/tailwind-utilities.css +1 -1
- package/dist/tokens/themes/default-dark.js +1 -0
- package/dist/tokens/themes/default-light.js +1 -0
- package/dist/tokens/themes/required.d.ts +1 -1
- package/dist/tokens/themes/required.js +1 -0
- package/dist/tokens/tokens.css +15 -0
- package/dist/ui/components/Button.d.ts +10 -1
- package/dist/ui/components/Button.js +25 -3
- package/dist/ui/components/Chart.d.ts +63 -0
- package/dist/ui/components/Chart.js +169 -0
- package/dist/ui/components/Chart.style.css +214 -0
- package/dist/ui/components/Disclaimer.d.ts +19 -0
- package/dist/ui/components/Disclaimer.js +83 -0
- package/dist/ui/components/OverflowRow.js +54 -2
- package/dist/ui/components/OverflowRow.style.css +38 -0
- package/dist/ui/components/RichTextEditor.js +99 -8
- package/dist/ui/components/chart-spec.d.ts +68 -0
- package/dist/ui/components/chart-spec.js +140 -0
- package/dist/ui/components/index.style.css +1 -0
- package/dist/ui/components/surface-tokens.d.ts +1 -1
- package/dist/ui/components/surface-tokens.js +9 -0
- package/dist/ui/components/tabs-overflow.js +64 -11
- package/dist/ui/components/toolbar-collapse.d.ts +13 -0
- package/dist/ui/components/toolbar-collapse.js +10 -1
- package/dist/ui/index.d.ts +8 -0
- package/dist/ui/index.js +9 -0
- package/dist/ui/rich-text/RichText.d.ts +10 -1
- package/dist/ui/rich-text/RichText.js +33 -2
- package/dist/ui/rich-text/RichText.style.css +83 -79
- package/dist/ui/rich-text/RichTextRenderer.d.ts +30 -1
- package/dist/ui/rich-text/RichTextRenderer.js +34 -2
- package/dist/ui/rich-text/chart-blocks.d.ts +62 -0
- package/dist/ui/rich-text/chart-blocks.js +87 -0
- package/package.json +1 -1
- package/scripts/seed-cli.mjs +1834 -1822
|
@@ -92,15 +92,48 @@ export const sellerOrderUpdateSchema = z
|
|
|
92
92
|
* it is also called directly from a server action, where no route ran first.
|
|
93
93
|
*/
|
|
94
94
|
/**
|
|
95
|
-
*
|
|
96
|
-
*
|
|
95
|
+
* Shipment entry — manual, or booked through the platform.
|
|
96
|
+
*
|
|
97
|
+
* 🛑 **`method` was `z.literal("custom")`, and that literal WAS bug 0e.**
|
|
98
|
+
*
|
|
99
|
+
* Its comment said *"a literal rather than an enum because
|
|
100
|
+
* `ManualShippingProvider` is the only provider"* — no longer true:
|
|
101
|
+
* `providers/shipping-shiprocket/` is 570 lines with all six methods, and
|
|
102
|
+
* `providers.config.ts` already resolves it from
|
|
103
|
+
* `siteSettings.shipping.provider`. The seller simply could not EXPRESS
|
|
104
|
+
* "book this through us", so there was no option to offer, and
|
|
105
|
+
* `platformBookedShipment` — which `order-math.ts` gates reimbursement on —
|
|
106
|
+
* had zero writers.
|
|
107
|
+
*
|
|
108
|
+
* A DISCRIMINATED UNION rather than an enum plus optional fields, because
|
|
109
|
+
* the two branches need different things and an optional-everything shape
|
|
110
|
+
* cannot say so:
|
|
111
|
+
*
|
|
112
|
+
* · `custom` — the seller posted it and types the carrier and tracking id.
|
|
113
|
+
* Those are REQUIRED, which is the rule enforced in three places today.
|
|
114
|
+
* · `platform` — we book it, so there is no tracking id to type; it comes
|
|
115
|
+
* back from the carrier. Requiring one here would be asking the seller to
|
|
116
|
+
* invent the thing the booking produces.
|
|
97
117
|
*/
|
|
98
|
-
export const shipOrderSchema = z.
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
118
|
+
export const shipOrderSchema = z.discriminatedUnion("method", [
|
|
119
|
+
z.object({
|
|
120
|
+
method: z.literal("custom"),
|
|
121
|
+
shippingCarrier: z.string().min(1),
|
|
122
|
+
trackingNumber: z.string().min(1),
|
|
123
|
+
trackingUrl: z.string().url(),
|
|
124
|
+
}),
|
|
125
|
+
z.object({
|
|
126
|
+
method: z.literal("platform"),
|
|
127
|
+
/* The store address the courier collects from. */
|
|
128
|
+
pickupAddressId: z.string().min(1),
|
|
129
|
+
dimensions: z.object({
|
|
130
|
+
weight: z.number().positive().max(50),
|
|
131
|
+
length: z.number().positive().max(200),
|
|
132
|
+
width: z.number().positive().max(200),
|
|
133
|
+
height: z.number().positive().max(200),
|
|
134
|
+
}),
|
|
135
|
+
}),
|
|
136
|
+
]);
|
|
104
137
|
/**
|
|
105
138
|
* Marking one EMI installment paid. `installmentIndex` is 1-based, matching
|
|
106
139
|
* how the schedule is presented to the buyer.
|
|
@@ -43,7 +43,32 @@ export interface ShipmentTotals {
|
|
|
43
43
|
export declare const DEFAULT_SHIPMENT_TOTALS: ShipmentTotals;
|
|
44
44
|
export interface ShipmentDocument extends BaseDocument {
|
|
45
45
|
shipmentNumber: string;
|
|
46
|
+
/**
|
|
47
|
+
* The supplier as TYPED. Kept, and kept required, for display.
|
|
48
|
+
*
|
|
49
|
+
* 🛑 It is free text, so four shipments from one supplier are four
|
|
50
|
+
* unjoined strings — "Acme Toys", "acme toys", "Acme Toys Ltd", "ACME".
|
|
51
|
+
* Nothing can total what we have spent with anyone, which is the first
|
|
52
|
+
* question anybody asks of procurement data.
|
|
53
|
+
*/
|
|
46
54
|
supplierName: string;
|
|
55
|
+
/**
|
|
56
|
+
* The joinable identity — a `vendors` row.
|
|
57
|
+
*
|
|
58
|
+
* 🛑 OPTIONAL, and that is deliberate rather than a migration left half
|
|
59
|
+
* done. Every existing shipment has only the string, and backfilling by
|
|
60
|
+
* fuzzy-matching names is precisely how two real suppliers get merged into
|
|
61
|
+
* one spend figure that nobody can unpick afterwards. A shipment gains an
|
|
62
|
+
* id when a human links it; until then it is honestly unattributed, and
|
|
63
|
+
* the vendor report can say how many are.
|
|
64
|
+
*
|
|
65
|
+
* 🛑 The NAME is not derived from the vendor row on read. Two reasons: a
|
|
66
|
+
* vendor rename would retroactively rewrite what every past shipment says
|
|
67
|
+
* it was bought from, and the typed string is evidence of what the invoice
|
|
68
|
+
* actually said. Same stance the order item's frozen listing snapshot
|
|
69
|
+
* takes (Part 14).
|
|
70
|
+
*/
|
|
71
|
+
supplierId?: string;
|
|
47
72
|
originCountry?: string;
|
|
48
73
|
status: ShipmentStatus;
|
|
49
74
|
trackingNumber?: string;
|
|
@@ -15,7 +15,7 @@ export declare const createShipmentSchema: z.ZodObject<{
|
|
|
15
15
|
laborRatePerHour: z.ZodOptional<z.ZodNumber>;
|
|
16
16
|
notes: z.ZodOptional<z.ZodString>;
|
|
17
17
|
}, "strip", z.ZodTypeAny, {
|
|
18
|
-
status: "received" | "completed" | "processing" | "cancelled" | "
|
|
18
|
+
status: "received" | "completed" | "processing" | "cancelled" | "in_transit" | "ordered" | "planning" | "customs";
|
|
19
19
|
shipmentNumber: string;
|
|
20
20
|
supplierName: string;
|
|
21
21
|
customsTotal: number;
|
|
@@ -29,7 +29,7 @@ export declare const createShipmentSchema: z.ZodObject<{
|
|
|
29
29
|
laborHoursSpent?: number | undefined;
|
|
30
30
|
laborRatePerHour?: number | undefined;
|
|
31
31
|
}, {
|
|
32
|
-
status: "received" | "completed" | "processing" | "cancelled" | "
|
|
32
|
+
status: "received" | "completed" | "processing" | "cancelled" | "in_transit" | "ordered" | "planning" | "customs";
|
|
33
33
|
shipmentNumber: string;
|
|
34
34
|
supplierName: string;
|
|
35
35
|
customsTotal: number;
|
|
@@ -58,7 +58,7 @@ export declare const updateShipmentSchema: z.ZodObject<{
|
|
|
58
58
|
laborRatePerHour: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
59
59
|
notes: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
60
60
|
}, "strip", z.ZodTypeAny, {
|
|
61
|
-
status?: "received" | "completed" | "processing" | "cancelled" | "
|
|
61
|
+
status?: "received" | "completed" | "processing" | "cancelled" | "in_transit" | "ordered" | "planning" | "customs" | undefined;
|
|
62
62
|
trackingNumber?: string | undefined;
|
|
63
63
|
notes?: string | undefined;
|
|
64
64
|
carrier?: string | undefined;
|
|
@@ -72,7 +72,7 @@ export declare const updateShipmentSchema: z.ZodObject<{
|
|
|
72
72
|
laborHoursSpent?: number | undefined;
|
|
73
73
|
laborRatePerHour?: number | undefined;
|
|
74
74
|
}, {
|
|
75
|
-
status?: "received" | "completed" | "processing" | "cancelled" | "
|
|
75
|
+
status?: "received" | "completed" | "processing" | "cancelled" | "in_transit" | "ordered" | "planning" | "customs" | undefined;
|
|
76
76
|
trackingNumber?: string | undefined;
|
|
77
77
|
notes?: string | undefined;
|
|
78
78
|
carrier?: string | undefined;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { FirebaseSieveFields, FirebaseSieveResult, SieveModel } from "../../../providers/db-firebase";
|
|
2
|
+
import { BaseRepository } from "../../../providers/db-firebase";
|
|
3
|
+
import { type ShippingBoxDocument } from "../schemas/firestore";
|
|
4
|
+
/**
|
|
5
|
+
* The shared carton library. See the schema header for why it is global.
|
|
6
|
+
*/
|
|
7
|
+
export declare class ShippingBoxesRepository extends BaseRepository<ShippingBoxDocument> {
|
|
8
|
+
static readonly SIEVE_FIELDS: FirebaseSieveFields;
|
|
9
|
+
constructor();
|
|
10
|
+
/**
|
|
11
|
+
* The picker's list. Active only, by name.
|
|
12
|
+
*
|
|
13
|
+
* 🛑 Retired presets are excluded here and NOT deleted, so a draft shipment
|
|
14
|
+
* holding one does not lose it mid-dispatch.
|
|
15
|
+
*/
|
|
16
|
+
listActive(model: SieveModel): Promise<FirebaseSieveResult<ShippingBoxDocument>>;
|
|
17
|
+
/**
|
|
18
|
+
* Create a preset, keyed on a slug of its name.
|
|
19
|
+
*
|
|
20
|
+
* 🛑 `box-<slug>` as the document id, so the SAME carton name cannot be added
|
|
21
|
+
* twice by two sellers. That is the whole value of a shared library — two
|
|
22
|
+
* rows called "Standard carton" with different numbers is worse than one
|
|
23
|
+
* row, because the picker gives no way to tell them apart.
|
|
24
|
+
*
|
|
25
|
+
* A colliding create is reported to the caller rather than silently
|
|
26
|
+
* overwriting: the existing row has an author and may be in use, and the
|
|
27
|
+
* second seller's intent ("I want a preset for this") is already satisfied
|
|
28
|
+
* by the row that exists.
|
|
29
|
+
*/
|
|
30
|
+
createPreset(input: {
|
|
31
|
+
name: string;
|
|
32
|
+
length: number;
|
|
33
|
+
width: number;
|
|
34
|
+
height: number;
|
|
35
|
+
tareWeight?: number;
|
|
36
|
+
createdByUid: string;
|
|
37
|
+
createdByName: string;
|
|
38
|
+
}): Promise<{
|
|
39
|
+
box: ShippingBoxDocument;
|
|
40
|
+
created: boolean;
|
|
41
|
+
}>;
|
|
42
|
+
/**
|
|
43
|
+
* Every preset, retired included — the staff management list.
|
|
44
|
+
*
|
|
45
|
+
* Separate from `listActive` for the same reason the dispute reasons are: the
|
|
46
|
+
* picker must never offer a retired row, and a management view must be able
|
|
47
|
+
* to find one in order to put it back.
|
|
48
|
+
*/
|
|
49
|
+
listAll(model: SieveModel): Promise<FirebaseSieveResult<ShippingBoxDocument>>;
|
|
50
|
+
/**
|
|
51
|
+
* Correct a preset's dimensions. **Staff only** — enforced at the route.
|
|
52
|
+
*
|
|
53
|
+
* ## 🛑 This does NOT change any dispatched parcel, by construction
|
|
54
|
+
*
|
|
55
|
+
* The dimensions are COPIED onto the shipment at use time (the schema's own
|
|
56
|
+
* header: *"a preset is a DEFAULT, never a lock"*), so there is no stored
|
|
57
|
+
* reference for this to reach through. That is precisely why staff editing is
|
|
58
|
+
* safe to offer at all: a seller's past declaration is a snapshot, and the
|
|
59
|
+
* courier billed against the figures at dispatch.
|
|
60
|
+
*
|
|
61
|
+
* It is staff-only for the mirror reason — these numbers are what the NEXT
|
|
62
|
+
* seller's dispatch form defaults to, so a wrong edit misdeclares other
|
|
63
|
+
* people's parcels. A seller who finds a preset wrong adds a new one; staff
|
|
64
|
+
* decide whether the shared row changes.
|
|
65
|
+
*
|
|
66
|
+
* 🛑 The NAME is deliberately not editable. The id is `box-<slug of name>`,
|
|
67
|
+
* so renaming would either leave the id disagreeing with the name (the
|
|
68
|
+
* mirror-drift trap) or require a new document, which is just a create. Add
|
|
69
|
+
* the correctly-named preset and retire this one.
|
|
70
|
+
*/
|
|
71
|
+
updatePreset(id: string, input: {
|
|
72
|
+
length?: number;
|
|
73
|
+
width?: number;
|
|
74
|
+
height?: number;
|
|
75
|
+
tareWeight?: number;
|
|
76
|
+
}): Promise<void>;
|
|
77
|
+
/** Soft-retire. See the schema for why this is never a delete. */
|
|
78
|
+
retire(id: string): Promise<void>;
|
|
79
|
+
/** Put a retired preset back in the picker. */
|
|
80
|
+
reactivate(id: string): Promise<void>;
|
|
81
|
+
}
|
|
82
|
+
export declare const shippingBoxesRepository: ShippingBoxesRepository;
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { BaseRepository } from "../../../providers/db-firebase/index.js";
|
|
2
|
+
import { slugify } from "../../../utils/string.formatter.js";
|
|
3
|
+
import { SHIPPING_BOX_COLLECTION, SHIPPING_BOX_FIELDS, SHIPPING_BOX_LIMITS, } from "../schemas/firestore.js";
|
|
4
|
+
/**
|
|
5
|
+
* The shared carton library. See the schema header for why it is global.
|
|
6
|
+
*/
|
|
7
|
+
export class ShippingBoxesRepository extends BaseRepository {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(SHIPPING_BOX_COLLECTION);
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* The picker's list. Active only, by name.
|
|
13
|
+
*
|
|
14
|
+
* 🛑 Retired presets are excluded here and NOT deleted, so a draft shipment
|
|
15
|
+
* holding one does not lose it mid-dispatch.
|
|
16
|
+
*/
|
|
17
|
+
async listActive(model) {
|
|
18
|
+
const baseQuery = this.getCollection().where(SHIPPING_BOX_FIELDS.IS_ACTIVE, "==", true);
|
|
19
|
+
return this.sieveQuery(model, ShippingBoxesRepository.SIEVE_FIELDS, {
|
|
20
|
+
baseQuery,
|
|
21
|
+
defaultPageSize: 20,
|
|
22
|
+
maxPageSize: 50,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Create a preset, keyed on a slug of its name.
|
|
27
|
+
*
|
|
28
|
+
* 🛑 `box-<slug>` as the document id, so the SAME carton name cannot be added
|
|
29
|
+
* twice by two sellers. That is the whole value of a shared library — two
|
|
30
|
+
* rows called "Standard carton" with different numbers is worse than one
|
|
31
|
+
* row, because the picker gives no way to tell them apart.
|
|
32
|
+
*
|
|
33
|
+
* A colliding create is reported to the caller rather than silently
|
|
34
|
+
* overwriting: the existing row has an author and may be in use, and the
|
|
35
|
+
* second seller's intent ("I want a preset for this") is already satisfied
|
|
36
|
+
* by the row that exists.
|
|
37
|
+
*/
|
|
38
|
+
async createPreset(input) {
|
|
39
|
+
const name = input.name.trim();
|
|
40
|
+
const id = `box-${slugify(name)}`;
|
|
41
|
+
const existing = await this.findById(id);
|
|
42
|
+
if (existing)
|
|
43
|
+
return { box: existing, created: false };
|
|
44
|
+
const now = new Date();
|
|
45
|
+
const box = {
|
|
46
|
+
id,
|
|
47
|
+
name,
|
|
48
|
+
length: clampCm(input.length),
|
|
49
|
+
width: clampCm(input.width),
|
|
50
|
+
height: clampCm(input.height),
|
|
51
|
+
...(input.tareWeight === undefined ? {} : { tareWeight: clampKg(input.tareWeight) }),
|
|
52
|
+
createdByUid: input.createdByUid,
|
|
53
|
+
createdByName: input.createdByName,
|
|
54
|
+
isActive: true,
|
|
55
|
+
createdAt: now,
|
|
56
|
+
updatedAt: now,
|
|
57
|
+
};
|
|
58
|
+
await this.createWithId(id, box);
|
|
59
|
+
return { box, created: true };
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Every preset, retired included — the staff management list.
|
|
63
|
+
*
|
|
64
|
+
* Separate from `listActive` for the same reason the dispute reasons are: the
|
|
65
|
+
* picker must never offer a retired row, and a management view must be able
|
|
66
|
+
* to find one in order to put it back.
|
|
67
|
+
*/
|
|
68
|
+
async listAll(model) {
|
|
69
|
+
return this.sieveQuery(model, ShippingBoxesRepository.SIEVE_FIELDS, {
|
|
70
|
+
baseQuery: this.getCollection(),
|
|
71
|
+
defaultPageSize: 20,
|
|
72
|
+
maxPageSize: 50,
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Correct a preset's dimensions. **Staff only** — enforced at the route.
|
|
77
|
+
*
|
|
78
|
+
* ## 🛑 This does NOT change any dispatched parcel, by construction
|
|
79
|
+
*
|
|
80
|
+
* The dimensions are COPIED onto the shipment at use time (the schema's own
|
|
81
|
+
* header: *"a preset is a DEFAULT, never a lock"*), so there is no stored
|
|
82
|
+
* reference for this to reach through. That is precisely why staff editing is
|
|
83
|
+
* safe to offer at all: a seller's past declaration is a snapshot, and the
|
|
84
|
+
* courier billed against the figures at dispatch.
|
|
85
|
+
*
|
|
86
|
+
* It is staff-only for the mirror reason — these numbers are what the NEXT
|
|
87
|
+
* seller's dispatch form defaults to, so a wrong edit misdeclares other
|
|
88
|
+
* people's parcels. A seller who finds a preset wrong adds a new one; staff
|
|
89
|
+
* decide whether the shared row changes.
|
|
90
|
+
*
|
|
91
|
+
* 🛑 The NAME is deliberately not editable. The id is `box-<slug of name>`,
|
|
92
|
+
* so renaming would either leave the id disagreeing with the name (the
|
|
93
|
+
* mirror-drift trap) or require a new document, which is just a create. Add
|
|
94
|
+
* the correctly-named preset and retire this one.
|
|
95
|
+
*/
|
|
96
|
+
async updatePreset(id, input) {
|
|
97
|
+
const patch = { updatedAt: new Date() };
|
|
98
|
+
if (input.length !== undefined)
|
|
99
|
+
patch.length = clampCm(input.length);
|
|
100
|
+
if (input.width !== undefined)
|
|
101
|
+
patch.width = clampCm(input.width);
|
|
102
|
+
if (input.height !== undefined)
|
|
103
|
+
patch.height = clampCm(input.height);
|
|
104
|
+
if (input.tareWeight !== undefined)
|
|
105
|
+
patch.tareWeight = clampKg(input.tareWeight);
|
|
106
|
+
await this.update(id, patch);
|
|
107
|
+
}
|
|
108
|
+
/** Soft-retire. See the schema for why this is never a delete. */
|
|
109
|
+
async retire(id) {
|
|
110
|
+
await this.update(id, { isActive: false, updatedAt: new Date() });
|
|
111
|
+
}
|
|
112
|
+
/** Put a retired preset back in the picker. */
|
|
113
|
+
async reactivate(id) {
|
|
114
|
+
await this.update(id, { isActive: true, updatedAt: new Date() });
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
ShippingBoxesRepository.SIEVE_FIELDS = {
|
|
118
|
+
/*
|
|
119
|
+
* `name` is sortable AND filterable because this list is picked from by
|
|
120
|
+
* typing — `PaginatedSelect` searches it. A field the picker searches that
|
|
121
|
+
* is not allowlisted here would have its clause silently DROPPED and the
|
|
122
|
+
* search would return the whole library while looking like it filtered
|
|
123
|
+
* (Root Cause #62).
|
|
124
|
+
*/
|
|
125
|
+
name: { canFilter: true, canSort: true },
|
|
126
|
+
isActive: { canFilter: true, canSort: false },
|
|
127
|
+
createdByUid: { canFilter: true, canSort: false },
|
|
128
|
+
};
|
|
129
|
+
/*
|
|
130
|
+
* Clamped rather than rejected. These bounds exist so a typo cannot reach a
|
|
131
|
+
* courier API as a 4-metre parcel; they are not a tariff, and refusing a
|
|
132
|
+
* legitimate large parcel client-side is worse than letting it through to be
|
|
133
|
+
* priced by `checkServiceability` against the real figures.
|
|
134
|
+
*/
|
|
135
|
+
function clampCm(v) {
|
|
136
|
+
if (!Number.isFinite(v))
|
|
137
|
+
return SHIPPING_BOX_LIMITS.minCm;
|
|
138
|
+
return Math.min(SHIPPING_BOX_LIMITS.maxCm, Math.max(SHIPPING_BOX_LIMITS.minCm, v));
|
|
139
|
+
}
|
|
140
|
+
function clampKg(v) {
|
|
141
|
+
if (!Number.isFinite(v))
|
|
142
|
+
return SHIPPING_BOX_LIMITS.minKg;
|
|
143
|
+
return Math.min(SHIPPING_BOX_LIMITS.maxKg, Math.max(SHIPPING_BOX_LIMITS.minKg, v));
|
|
144
|
+
}
|
|
145
|
+
export const shippingBoxesRepository = new ShippingBoxesRepository();
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `shippingBoxes` — a GLOBAL library of named carton presets.
|
|
3
|
+
*
|
|
4
|
+
* ## Why global rather than per-store
|
|
5
|
+
*
|
|
6
|
+
* A box is a real physical carton size. Scoping presets per store would give
|
|
7
|
+
* every seller their own private copy of "Medium", each with slightly
|
|
8
|
+
* different numbers, and the second seller to ship a Beyblade in a standard
|
|
9
|
+
* carton would re-measure instead of picking what already exists.
|
|
10
|
+
*
|
|
11
|
+
* `createdByName` is what keeps a shared library accountable: a wrong preset
|
|
12
|
+
* has an author, and the next seller can see who added the one they are about
|
|
13
|
+
* to trust.
|
|
14
|
+
*
|
|
15
|
+
* ## 🛑 A preset is a DEFAULT, never a lock
|
|
16
|
+
*
|
|
17
|
+
* The dimensions are COPIED onto the shipment when a seller uses one. Editing
|
|
18
|
+
* a preset later must not retroactively change what an already-dispatched
|
|
19
|
+
* parcel was declared as — the courier billed against the figures at dispatch,
|
|
20
|
+
* and a stored reference would make a past declaration mutable. Same snapshot
|
|
21
|
+
* discipline as the checkout's fee terms (D61).
|
|
22
|
+
*
|
|
23
|
+
* ## 🛑 Weight is not a formality
|
|
24
|
+
*
|
|
25
|
+
* An understated weight is re-billed by the courier AFTER delivery as a
|
|
26
|
+
* weight-discrepancy adjustment — real money, arriving on a reconciliation we
|
|
27
|
+
* cannot dispute without the parcel. The form says so rather than treating it
|
|
28
|
+
* as a required field to get past.
|
|
29
|
+
*/
|
|
30
|
+
import type { BaseDocument } from "../../../_internal/shared/types/base-document";
|
|
31
|
+
/** `box-` prefixed slug, so the id reads as what it is. */
|
|
32
|
+
export declare const SHIPPING_BOX_COLLECTION = "shippingBoxes";
|
|
33
|
+
export interface ShippingBoxDocument extends BaseDocument {
|
|
34
|
+
/** What a seller picks it by: "Standard Beyblade carton", "Poly mailer S". */
|
|
35
|
+
name: string;
|
|
36
|
+
/** cm. */
|
|
37
|
+
length: number;
|
|
38
|
+
width: number;
|
|
39
|
+
height: number;
|
|
40
|
+
/**
|
|
41
|
+
* kg, the EMPTY box. The parcel's weight is this plus contents, entered on
|
|
42
|
+
* the dispatch form — a preset cannot know what went inside it.
|
|
43
|
+
*
|
|
44
|
+
* 🛑 Separate from the shipment's `weight` for exactly that reason. Storing
|
|
45
|
+
* one "weight" on a preset and reusing it as the parcel weight is how every
|
|
46
|
+
* parcel gets declared at the same figure regardless of contents.
|
|
47
|
+
*/
|
|
48
|
+
tareWeight?: number;
|
|
49
|
+
/** Who added it. Display name, so a seller can see whose preset this is. */
|
|
50
|
+
createdByName: string;
|
|
51
|
+
/** The uid, for moderation. Never rendered. */
|
|
52
|
+
createdByUid: string;
|
|
53
|
+
/**
|
|
54
|
+
* Soft-retire rather than delete. A preset in use by a draft shipment must
|
|
55
|
+
* not vanish mid-dispatch, and a deleted row takes its author with it.
|
|
56
|
+
*/
|
|
57
|
+
isActive: boolean;
|
|
58
|
+
}
|
|
59
|
+
export declare const SHIPPING_BOX_FIELDS: {
|
|
60
|
+
readonly ID: "id";
|
|
61
|
+
readonly NAME: "name";
|
|
62
|
+
readonly IS_ACTIVE: "isActive";
|
|
63
|
+
readonly CREATED_BY_UID: "createdByUid";
|
|
64
|
+
readonly CREATED_AT: "createdAt";
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Bounds, so a typo cannot reach a courier API as a 4-metre parcel.
|
|
68
|
+
*
|
|
69
|
+
* 🛑 Generous on purpose — these are a sanity check, not a tariff. India Post
|
|
70
|
+
* and most couriers cap a single parcel well below these, and the right place
|
|
71
|
+
* to learn a real limit is `checkServiceability`, which quotes against the
|
|
72
|
+
* actual weight. A client-side rule that refuses a legitimate large parcel is
|
|
73
|
+
* worse than one that lets it through to be priced.
|
|
74
|
+
*/
|
|
75
|
+
export declare const SHIPPING_BOX_LIMITS: {
|
|
76
|
+
readonly minCm: 1;
|
|
77
|
+
readonly maxCm: 200;
|
|
78
|
+
readonly minKg: 0;
|
|
79
|
+
readonly maxKg: 50;
|
|
80
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `shippingBoxes` — a GLOBAL library of named carton presets.
|
|
3
|
+
*
|
|
4
|
+
* ## Why global rather than per-store
|
|
5
|
+
*
|
|
6
|
+
* A box is a real physical carton size. Scoping presets per store would give
|
|
7
|
+
* every seller their own private copy of "Medium", each with slightly
|
|
8
|
+
* different numbers, and the second seller to ship a Beyblade in a standard
|
|
9
|
+
* carton would re-measure instead of picking what already exists.
|
|
10
|
+
*
|
|
11
|
+
* `createdByName` is what keeps a shared library accountable: a wrong preset
|
|
12
|
+
* has an author, and the next seller can see who added the one they are about
|
|
13
|
+
* to trust.
|
|
14
|
+
*
|
|
15
|
+
* ## 🛑 A preset is a DEFAULT, never a lock
|
|
16
|
+
*
|
|
17
|
+
* The dimensions are COPIED onto the shipment when a seller uses one. Editing
|
|
18
|
+
* a preset later must not retroactively change what an already-dispatched
|
|
19
|
+
* parcel was declared as — the courier billed against the figures at dispatch,
|
|
20
|
+
* and a stored reference would make a past declaration mutable. Same snapshot
|
|
21
|
+
* discipline as the checkout's fee terms (D61).
|
|
22
|
+
*
|
|
23
|
+
* ## 🛑 Weight is not a formality
|
|
24
|
+
*
|
|
25
|
+
* An understated weight is re-billed by the courier AFTER delivery as a
|
|
26
|
+
* weight-discrepancy adjustment — real money, arriving on a reconciliation we
|
|
27
|
+
* cannot dispute without the parcel. The form says so rather than treating it
|
|
28
|
+
* as a required field to get past.
|
|
29
|
+
*/
|
|
30
|
+
/** `box-` prefixed slug, so the id reads as what it is. */
|
|
31
|
+
export const SHIPPING_BOX_COLLECTION = "shippingBoxes";
|
|
32
|
+
export const SHIPPING_BOX_FIELDS = {
|
|
33
|
+
ID: "id",
|
|
34
|
+
NAME: "name",
|
|
35
|
+
IS_ACTIVE: "isActive",
|
|
36
|
+
CREATED_BY_UID: "createdByUid",
|
|
37
|
+
CREATED_AT: "createdAt",
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Bounds, so a typo cannot reach a courier API as a 4-metre parcel.
|
|
41
|
+
*
|
|
42
|
+
* 🛑 Generous on purpose — these are a sanity check, not a tariff. India Post
|
|
43
|
+
* and most couriers cap a single parcel well below these, and the right place
|
|
44
|
+
* to learn a real limit is `checkServiceability`, which quotes against the
|
|
45
|
+
* actual weight. A client-side rule that refuses a legitimate large parcel is
|
|
46
|
+
* worse than one that lets it through to be priced.
|
|
47
|
+
*/
|
|
48
|
+
export const SHIPPING_BOX_LIMITS = {
|
|
49
|
+
minCm: 1,
|
|
50
|
+
maxCm: 200,
|
|
51
|
+
minKg: 0,
|
|
52
|
+
maxKg: 50,
|
|
53
|
+
};
|
|
@@ -12,14 +12,14 @@ export declare const reportCreateSchema: z.ZodObject<{
|
|
|
12
12
|
}, "strict", z.ZodTypeAny, {
|
|
13
13
|
entityId: string;
|
|
14
14
|
entityType: import("./firestore").ReportEntityType;
|
|
15
|
-
detail: string;
|
|
16
15
|
reason: import("./firestore").ReportReason;
|
|
16
|
+
detail: string;
|
|
17
17
|
evidenceUrls?: string[] | undefined;
|
|
18
18
|
}, {
|
|
19
19
|
entityId: string;
|
|
20
20
|
entityType: import("./firestore").ReportEntityType;
|
|
21
|
-
detail: string;
|
|
22
21
|
reason: import("./firestore").ReportReason;
|
|
22
|
+
detail: string;
|
|
23
23
|
evidenceUrls?: string[] | undefined;
|
|
24
24
|
}>;
|
|
25
25
|
export type ReportCreateValues = z.infer<typeof reportCreateSchema>;
|
|
@@ -133,8 +133,8 @@ export declare const shippingConfigUpdateSchema: z.ZodObject<{
|
|
|
133
133
|
label?: string | undefined;
|
|
134
134
|
isActive?: boolean | undefined;
|
|
135
135
|
isDefault?: boolean | undefined;
|
|
136
|
-
method?: ShippingMethod | undefined;
|
|
137
136
|
estimatedDays?: number | undefined;
|
|
137
|
+
method?: ShippingMethod | undefined;
|
|
138
138
|
flatRate?: number | undefined;
|
|
139
139
|
pricePerKg?: number | undefined;
|
|
140
140
|
freeAbove?: number | undefined;
|
|
@@ -144,8 +144,8 @@ export declare const shippingConfigUpdateSchema: z.ZodObject<{
|
|
|
144
144
|
label?: string | undefined;
|
|
145
145
|
isActive?: boolean | undefined;
|
|
146
146
|
isDefault?: boolean | undefined;
|
|
147
|
-
method?: ShippingMethod | undefined;
|
|
148
147
|
estimatedDays?: number | undefined;
|
|
148
|
+
method?: ShippingMethod | undefined;
|
|
149
149
|
flatRate?: number | undefined;
|
|
150
150
|
pricePerKg?: number | undefined;
|
|
151
151
|
freeAbove?: number | undefined;
|
|
@@ -2,6 +2,9 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { ArrowLeft } from "lucide-react";
|
|
3
3
|
import { Accordion, Alert, Code, Div, Heading, Li, Ol, Row, Section, Span, Stack, Table, Tbody, Td, Text, TextLink, Th, Thead, Tr, Ul } from "../../../ui/index.js";
|
|
4
4
|
import { ROUTES } from "../../../next/routing/route-map.js";
|
|
5
|
+
import { resolvePublishedValues } from "../../../_internal/shared/content/published-values.js";
|
|
6
|
+
/* Phase 9 — one definition of the refund timeline. */
|
|
7
|
+
const { refundBusinessDaysMin: REFUND_DAYS_MIN, refundBusinessDaysMax: REFUND_DAYS_MAX } = resolvePublishedValues();
|
|
5
8
|
const SUBHEADING = "mb-1 font-semibold text-[var(--appkit-color-text)]";
|
|
6
9
|
const LIST_DISC = "list-disc leading-relaxed";
|
|
7
10
|
const SECTION_BODY = "space-y-4 text-[length:var(--appkit-text-sm)] text-[var(--appkit-color-text-muted)]";
|
|
@@ -41,7 +44,9 @@ const STATUS_ROWS = [
|
|
|
41
44
|
{
|
|
42
45
|
status: "CANCELLED",
|
|
43
46
|
meaning: "Order was cancelled before shipping (by buyer or seller).",
|
|
44
|
-
|
|
47
|
+
// Phase 9 — one definition, and no gateway name. See the identical note in
|
|
48
|
+
// AdminOrdersGuideView.
|
|
49
|
+
action: `Refund is automatic (${REFUND_DAYS_MIN}–${REFUND_DAYS_MAX} business days).`,
|
|
45
50
|
},
|
|
46
51
|
{
|
|
47
52
|
status: "RETURN_REQUESTED",
|
|
@@ -29,6 +29,24 @@ export declare class StoreRepository extends BaseRepository<StoreDocument> {
|
|
|
29
29
|
* Find a store by its URL slug (also the document ID).
|
|
30
30
|
*/
|
|
31
31
|
findBySlug(storeSlug: string): Promise<StoreDocument | null>;
|
|
32
|
+
/**
|
|
33
|
+
* The slugs of every store paid at shipping rather than at delivery.
|
|
34
|
+
*
|
|
35
|
+
* 🛑 A `Set` of IDS, not the documents. The payout sweep needs only
|
|
36
|
+
* membership, and loading full store documents for a question answered by a
|
|
37
|
+
* string would spend the ~3-round-trip budget (Rule #6) on data it discards.
|
|
38
|
+
*
|
|
39
|
+
* 🛑 An EQUALITY on `trustedSeller == true`, never `!= false`. A Firestore
|
|
40
|
+
* inequality excludes every document that LACKS the field — which is every
|
|
41
|
+
* store, since the flag is new and optional — so `!=` would return the
|
|
42
|
+
* trusted set and nothing else, or everything, depending on which way you
|
|
43
|
+
* wrote it. Both are wrong and neither raises.
|
|
44
|
+
*
|
|
45
|
+
* Bounded at 500: trust is granted by hand, one store at a time, on risk
|
|
46
|
+
* grounds. If this ever saturates, the grant has stopped being deliberate
|
|
47
|
+
* and that is the thing to fix rather than the limit.
|
|
48
|
+
*/
|
|
49
|
+
findTrustedStoreIds(): Promise<Set<string>>;
|
|
32
50
|
/**
|
|
33
51
|
* Find the store owned by a specific user UID.
|
|
34
52
|
*/
|
|
@@ -59,6 +59,32 @@ export class StoreRepository extends BaseRepository {
|
|
|
59
59
|
async findBySlug(storeSlug) {
|
|
60
60
|
return this.findById(storeSlug);
|
|
61
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* The slugs of every store paid at shipping rather than at delivery.
|
|
64
|
+
*
|
|
65
|
+
* 🛑 A `Set` of IDS, not the documents. The payout sweep needs only
|
|
66
|
+
* membership, and loading full store documents for a question answered by a
|
|
67
|
+
* string would spend the ~3-round-trip budget (Rule #6) on data it discards.
|
|
68
|
+
*
|
|
69
|
+
* 🛑 An EQUALITY on `trustedSeller == true`, never `!= false`. A Firestore
|
|
70
|
+
* inequality excludes every document that LACKS the field — which is every
|
|
71
|
+
* store, since the flag is new and optional — so `!=` would return the
|
|
72
|
+
* trusted set and nothing else, or everything, depending on which way you
|
|
73
|
+
* wrote it. Both are wrong and neither raises.
|
|
74
|
+
*
|
|
75
|
+
* Bounded at 500: trust is granted by hand, one store at a time, on risk
|
|
76
|
+
* grounds. If this ever saturates, the grant has stopped being deliberate
|
|
77
|
+
* and that is the thing to fix rather than the limit.
|
|
78
|
+
*/
|
|
79
|
+
async findTrustedStoreIds() {
|
|
80
|
+
const snap = await this.db
|
|
81
|
+
.collection(this.collection)
|
|
82
|
+
.where(STORE_FIELDS.TRUSTED_SELLER, "==", true)
|
|
83
|
+
.select()
|
|
84
|
+
.limit(500)
|
|
85
|
+
.get();
|
|
86
|
+
return new Set(snap.docs.map((d) => d.id));
|
|
87
|
+
}
|
|
62
88
|
/**
|
|
63
89
|
* Find the store owned by a specific user UID.
|
|
64
90
|
*/
|
|
@@ -117,7 +143,7 @@ export class StoreRepository extends BaseRepository {
|
|
|
117
143
|
trigger: ctx?.trigger ?? defaultTrigger,
|
|
118
144
|
reason: ctx?.reason,
|
|
119
145
|
note: ctx?.note,
|
|
120
|
-
// `encryptPiiFields`
|
|
146
|
+
// `encryptPiiFields` covers only NAMED paths, so an undeclared nested secret
|
|
121
147
|
// would be stored in plaintext — the list below is the scrub.
|
|
122
148
|
piiFields: STORE_HISTORY_PII_FIELDS,
|
|
123
149
|
});
|