@mohasinac/appkit 4.13.0 → 4.14.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/layout/DashboardLayoutClient.js +14 -5
- package/dist/_internal/client/features/lottery/LotteryAdminEditView.d.ts +3 -0
- package/dist/_internal/client/features/lottery/LotteryAdminEditView.js +6 -0
- package/dist/_internal/client/features/lottery/LotteryDetailView.d.ts +8 -0
- package/dist/_internal/client/features/lottery/LotteryDetailView.js +4 -1
- package/dist/_internal/client/features/lottery/LotteryListView.d.ts +7 -0
- package/dist/_internal/client/features/lottery/LotteryListView.js +1 -1
- package/dist/_internal/client/features/lottery/PrizeDrawLotteryDetailView.js +4 -1
- package/dist/_internal/client/features/lottery/slot-collage-items.d.ts +15 -0
- package/dist/_internal/client/features/lottery/slot-collage-items.js +13 -0
- package/dist/_internal/server/features/auctions/actions.js +6 -0
- package/dist/_internal/server/features/bundles/data.d.ts +16 -0
- package/dist/_internal/server/features/bundles/data.js +26 -0
- package/dist/_internal/server/features/bundles/index.d.ts +1 -1
- package/dist/_internal/server/features/bundles/index.js +1 -1
- package/dist/_internal/server/features/checkout/actions.js +6 -0
- package/dist/_internal/server/features/checkout/locked-lines.d.ts +38 -0
- package/dist/_internal/server/features/checkout/locked-lines.js +171 -0
- package/dist/_internal/server/features/homepage/index.d.ts +0 -1
- package/dist/_internal/server/features/homepage/index.js +7 -1
- package/dist/_internal/server/features/lottery/adapters.js +4 -0
- package/dist/_internal/server/features/products/data.js +15 -37
- package/dist/_internal/server/features/products/index.d.ts +1 -1
- package/dist/_internal/server/features/products/index.js +1 -1
- package/dist/_internal/server/features/products/list-public.d.ts +46 -20
- package/dist/_internal/server/features/products/list-public.js +266 -90
- package/dist/_internal/server/features/products/listing-tab-counts.d.ts +44 -0
- package/dist/_internal/server/features/products/listing-tab-counts.js +97 -0
- package/dist/_internal/server/features/site-settings/adapters.d.ts +51 -0
- package/dist/_internal/server/features/site-settings/adapters.js +75 -0
- package/dist/_internal/server/features/site-settings/index.d.ts +1 -0
- package/dist/_internal/server/features/site-settings/index.js +1 -0
- package/dist/_internal/server/features/stores/adapters.d.ts +56 -0
- package/dist/_internal/server/features/stores/adapters.js +91 -0
- package/dist/_internal/server/features/stores/index.d.ts +1 -0
- package/dist/_internal/server/features/stores/index.js +1 -0
- package/dist/_internal/server/jobs/core/auctionSettlement.js +56 -2
- package/dist/_internal/server/jobs/core/offerExpiry.js +45 -9
- package/dist/_internal/server/jobs/core/paymentReviewAutoApprove.d.ts +5 -0
- package/dist/_internal/server/jobs/core/paymentReviewAutoApprove.js +33 -1
- package/dist/_internal/server/jobs/handlers/messages.d.ts +7 -0
- package/dist/_internal/server/jobs/handlers/messages.js +10 -0
- package/dist/_internal/shared/actions/action-registry.js +15 -1
- package/dist/_internal/shared/checkout/lanes.d.ts +25 -0
- package/dist/_internal/shared/checkout/lanes.js +26 -0
- package/dist/_internal/shared/features/auctions/config.d.ts +27 -0
- package/dist/_internal/shared/features/auctions/config.js +27 -0
- package/dist/_internal/shared/features/blog/schema.d.ts +2 -2
- package/dist/_internal/shared/features/cart/schema.d.ts +12 -12
- package/dist/_internal/shared/features/categories/bundle-schemas.d.ts +32 -32
- package/dist/_internal/shared/features/emi/schedule.d.ts +24 -3
- package/dist/_internal/shared/features/emi/schedule.js +20 -5
- package/dist/_internal/shared/features/events/schema.d.ts +2 -2
- package/dist/_internal/shared/features/homepage/section-gate.d.ts +14 -0
- package/dist/_internal/shared/features/homepage/section-gate.js +51 -0
- package/dist/_internal/shared/features/offers/config.d.ts +30 -0
- package/dist/_internal/shared/features/offers/config.js +59 -0
- package/dist/_internal/shared/features/orders/schema.d.ts +8 -8
- package/dist/_internal/shared/features/products/schema.d.ts +32 -32
- package/dist/_internal/shared/features/products/to-product-item.js +6 -0
- package/dist/_internal/shared/features/reviews/schema.d.ts +2 -2
- package/dist/_internal/shared/features/site-settings/fees.d.ts +60 -0
- package/dist/_internal/shared/features/site-settings/fees.js +39 -0
- package/dist/_internal/shared/features/site-settings/types.d.ts +40 -0
- package/dist/_internal/shared/features/site-settings/types.js +1 -0
- package/dist/_internal/shared/history/history.d.ts +66 -0
- package/dist/_internal/shared/history/history.js +158 -0
- package/dist/_internal/shared/history/index.d.ts +4 -0
- package/dist/_internal/shared/history/index.js +2 -0
- package/dist/_internal/shared/history/types.d.ts +61 -0
- package/dist/_internal/shared/history/types.js +6 -0
- package/dist/_internal/shared/listing-types/_registry.d.ts +54 -1
- package/dist/_internal/shared/listing-types/_registry.js +67 -0
- package/dist/_internal/shared/listing-types/art/config.d.ts +3 -0
- package/dist/_internal/shared/listing-types/art/config.js +5 -0
- package/dist/_internal/shared/listing-types/auction/config.d.ts +13 -0
- package/dist/_internal/shared/listing-types/auction/config.js +21 -0
- package/dist/_internal/shared/listing-types/availability.d.ts +79 -0
- package/dist/_internal/shared/listing-types/availability.js +104 -0
- package/dist/_internal/shared/listing-types/capabilities.d.ts +15 -0
- package/dist/_internal/shared/listing-types/capabilities.js +12 -0
- package/dist/_internal/shared/listing-types/classified/config.d.ts +3 -0
- package/dist/_internal/shared/listing-types/classified/config.js +5 -0
- package/dist/_internal/shared/listing-types/digital-code/config.d.ts +11 -0
- package/dist/_internal/shared/listing-types/digital-code/config.js +22 -2
- package/dist/_internal/shared/listing-types/live/config.d.ts +3 -0
- package/dist/_internal/shared/listing-types/live/config.js +5 -0
- package/dist/_internal/shared/listing-types/pre-order/config.d.ts +3 -0
- package/dist/_internal/shared/listing-types/pre-order/config.js +19 -0
- package/dist/_internal/shared/listing-types/prize-draw/config.d.ts +11 -0
- package/dist/_internal/shared/listing-types/prize-draw/config.js +15 -0
- package/dist/_internal/shared/listing-types/standard/config.d.ts +3 -0
- package/dist/_internal/shared/listing-types/standard/config.js +5 -0
- package/dist/_internal/shared/listing-types/stickers/config.d.ts +3 -0
- package/dist/_internal/shared/listing-types/stickers/config.js +5 -0
- package/dist/client.d.ts +7 -5
- package/dist/client.js +2 -2
- package/dist/constants/api-endpoints.d.ts +6 -0
- package/dist/constants/api-endpoints.js +2 -0
- package/dist/constants/field-names.d.ts +49 -2
- package/dist/constants/field-names.js +53 -2
- package/dist/constants/table-keys.d.ts +17 -0
- package/dist/constants/table-keys.js +17 -0
- package/dist/errors/error-codes.d.ts +13 -1
- package/dist/errors/error-codes.js +13 -1
- package/dist/errors/error-display-map.js +12 -3
- package/dist/errors/messages.d.ts +10 -2
- package/dist/errors/messages.js +10 -2
- package/dist/features/about/components/AboutView.d.ts +3 -0
- package/dist/features/about/components/AboutView.js +3 -2
- package/dist/features/about/components/PolicyPageView.d.ts +2 -1
- package/dist/features/about/components/PolicyPageView.js +61 -23
- package/dist/features/about/components/PublicProfileView.js +5 -0
- package/dist/features/about/schemas/firestore.d.ts +3 -0
- package/dist/features/account/components/UserOrdersView.js +7 -0
- package/dist/features/account/components/index.d.ts +0 -2
- package/dist/features/account/components/index.js +0 -1
- package/dist/features/account/schemas/index.d.ts +2 -2
- package/dist/features/account/types/index.d.ts +21 -2
- package/dist/features/addresses/schemas/index.d.ts +4 -4
- package/dist/features/admin/components/AdminArtView.js +8 -3
- package/dist/features/admin/components/AdminClassifiedView.js +8 -3
- package/dist/features/admin/components/AdminDigitalCodesView.js +8 -3
- package/dist/features/admin/components/AdminFeatureFlagsView.js +1 -0
- package/dist/features/admin/components/AdminLiveView.js +8 -3
- package/dist/features/admin/components/AdminOffersView.d.ts +4 -0
- package/dist/features/admin/components/AdminOffersView.js +186 -0
- package/dist/features/admin/components/AdminOrdersView.js +10 -1
- package/dist/features/admin/components/AdminPrizeDrawsView.js +5 -0
- package/dist/features/admin/components/AdminProductsView.js +16 -29
- package/dist/features/admin/components/AdminSiteSettingsView.js +31 -13
- package/dist/features/admin/components/AdminSiteView.js +6 -2
- package/dist/features/admin/components/AdminStickersView.js +8 -3
- package/dist/features/admin/components/index.d.ts +2 -0
- package/dist/features/admin/components/index.js +1 -0
- package/dist/features/admin/constants/filter-tabs.d.ts +86 -0
- package/dist/features/admin/constants/filter-tabs.js +55 -0
- package/dist/features/admin/schemas/firestore.d.ts +122 -3
- package/dist/features/admin/schemas/firestore.js +1 -0
- package/dist/features/auctions/actions/bid-actions.d.ts +20 -5
- package/dist/features/auctions/actions/bid-actions.js +93 -20
- package/dist/features/auctions/components/AuctionDetailPageView.js +11 -6
- package/dist/features/auctions/components/AuctionsListView.js +5 -6
- package/dist/features/auctions/components/MarketplaceAuctionCard.d.ts +7 -0
- package/dist/features/auctions/components/MarketplaceAuctionCard.js +19 -2
- package/dist/features/auctions/components/PlaceBidFormClient.d.ts +1 -2
- package/dist/features/auctions/components/PlaceBidFormClient.js +8 -4
- package/dist/features/auctions/repository/bid.repository.d.ts +13 -0
- package/dist/features/auctions/repository/bid.repository.js +23 -0
- package/dist/features/auctions/schemas/firestore.d.ts +17 -0
- package/dist/features/auctions/schemas/index.d.ts +12 -12
- package/dist/features/auth/permissions/constants.d.ts +1 -1
- package/dist/features/auth/permissions/constants.js +10 -1
- package/dist/features/blog/actions/blog-actions.d.ts +7 -7
- package/dist/features/blog/schemas/index.d.ts +6 -6
- package/dist/features/cart/repository/cart.repository.js +1 -0
- package/dist/features/cart/schemas/firestore.d.ts +15 -0
- package/dist/features/catalogue/schemas/validation.d.ts +4 -4
- package/dist/features/categories/components/BrandDetailPageView.js +23 -40
- package/dist/features/categories/components/BrandDetailTabs.d.ts +7 -7
- package/dist/features/categories/components/BrandDetailTabs.js +8 -12
- package/dist/features/categories/components/BundleCollage.js +1 -1
- package/dist/features/categories/components/CategoryDetailPageView.js +53 -57
- package/dist/features/categories/components/CategoryDetailTabs.d.ts +10 -8
- package/dist/features/categories/components/CategoryDetailTabs.js +11 -16
- package/dist/features/categories/components/CategoryProductsListing.js +11 -1
- package/dist/features/categories/components/ConcernCard.js +7 -1
- package/dist/features/categories/schemas/firestore.d.ts +13 -0
- package/dist/features/categories/schemas/index.d.ts +26 -26
- package/dist/features/classified/components/ClassifiedDetailPageView.d.ts +16 -1
- package/dist/features/classified/components/ClassifiedDetailPageView.js +23 -3
- package/dist/features/events/components/AdminEventsView.js +15 -11
- package/dist/features/events/components/EventFilters.d.ts +9 -1
- package/dist/features/events/components/EventFilters.js +45 -21
- package/dist/features/events/components/EventsIndexListing.d.ts +6 -1
- package/dist/features/events/components/EventsIndexListing.js +2 -2
- package/dist/features/events/components/EventsListPageView.js +13 -4
- package/dist/features/events/repository/events.repository.d.ts +17 -0
- package/dist/features/events/repository/events.repository.js +27 -0
- package/dist/features/events/schemas/firestore.d.ts +12 -0
- package/dist/features/events/schemas/firestore.js +12 -0
- package/dist/features/events/schemas/index.d.ts +50 -50
- package/dist/features/events/types/index.d.ts +11 -0
- package/dist/features/events/types/index.js +57 -1
- package/dist/features/faq/actions/faq-actions.d.ts +12 -12
- package/dist/features/faq/schemas/index.d.ts +8 -8
- package/dist/features/filters/FilterFacetSection.d.ts +7 -1
- package/dist/features/filters/FilterFacetSection.js +11 -3
- package/dist/features/grouped/schemas/index.d.ts +4 -4
- package/dist/features/homepage/components/AnnouncementBar.d.ts +7 -1
- package/dist/features/homepage/components/AnnouncementBar.js +3 -3
- package/dist/features/homepage/components/MarketplaceHomepageView.js +20 -6
- package/dist/features/homepage/hooks/homepage-query.d.ts +16 -0
- package/dist/features/homepage/hooks/homepage-query.js +45 -0
- package/dist/features/homepage/hooks/useFeaturedAuctions.d.ts +10 -0
- package/dist/features/homepage/hooks/useFeaturedAuctions.js +28 -8
- package/dist/features/homepage/hooks/useFeaturedPreOrders.js +17 -8
- package/dist/features/homepage/hooks/useFeaturedProducts.js +15 -8
- package/dist/features/homepage/schemas/index.d.ts +2 -2
- package/dist/features/layout/AppLayoutShell.d.ts +11 -1
- package/dist/features/layout/AppLayoutShell.js +15 -14
- package/dist/features/layout/BackToTop.d.ts +9 -0
- package/dist/features/layout/BackToTop.js +10 -1
- package/dist/features/layout/BottomActions.js +28 -25
- package/dist/features/layout/BottomChrome.d.ts +34 -0
- package/dist/features/layout/BottomChrome.js +55 -0
- package/dist/features/layout/BottomNavLayout.d.ts +6 -0
- package/dist/features/layout/BottomNavLayout.js +7 -1
- package/dist/features/layout/BottomNavbar.js +15 -2
- package/dist/features/layout/FooterLayout.js +11 -1
- package/dist/features/layout/NavbarLayout.js +1 -1
- package/dist/features/layout/TitleBarLayout.d.ts +7 -0
- package/dist/features/layout/TitleBarLayout.js +28 -5
- package/dist/features/layout/index.d.ts +2 -0
- package/dist/features/layout/index.js +1 -0
- package/dist/features/lottery/types/index.d.ts +3 -0
- package/dist/features/media/MediaPickerModal.js +5 -1
- package/dist/features/messages/schemas/index.d.ts +2 -2
- package/dist/features/orders/components/OrderScopeTabs.d.ts +20 -0
- package/dist/features/orders/components/OrderScopeTabs.js +31 -0
- package/dist/features/orders/constants/order-scope.d.ts +48 -0
- package/dist/features/orders/constants/order-scope.js +111 -0
- package/dist/features/orders/repository/orders.repository.d.ts +54 -7
- package/dist/features/orders/repository/orders.repository.js +116 -22
- package/dist/features/orders/schemas/firestore.d.ts +117 -0
- package/dist/features/orders/schemas/firestore.js +30 -0
- package/dist/features/orders/schemas/index.d.ts +18 -18
- package/dist/features/pre-orders/components/PreOrdersIndexListing.js +14 -9
- package/dist/features/pre-orders/components/PreOrdersListView.js +6 -5
- package/dist/features/pre-orders/schemas/index.d.ts +1 -1
- package/dist/features/products/actions/product-actions.d.ts +14 -0
- package/dist/features/products/actions/product-actions.js +49 -11
- package/dist/features/products/api/route.d.ts +12 -0
- package/dist/features/products/api/route.js +42 -100
- package/dist/features/products/components/ArtStickersListView.js +2 -2
- package/dist/features/products/components/AuctionsIndexListing.js +13 -11
- package/dist/features/products/components/AvailabilityTabs.d.ts +11 -0
- package/dist/features/products/components/AvailabilityTabs.js +47 -0
- package/dist/features/products/components/MakeOfferButton.js +48 -49
- package/dist/features/products/components/PrizeDrawCollage.d.ts +20 -4
- package/dist/features/products/components/PrizeDrawCollage.js +9 -1
- package/dist/features/products/components/PrizeDrawsIndexListing.js +14 -12
- package/dist/features/products/components/PrizeDrawsListingView.js +2 -2
- package/dist/features/products/components/PrizeDrawsSection.d.ts +7 -1
- package/dist/features/products/components/PrizeDrawsSection.js +23 -18
- package/dist/features/products/components/ProductDetailPageView.d.ts +4 -1
- package/dist/features/products/components/ProductDetailPageView.js +18 -4
- package/dist/features/products/components/ProductForm.js +5 -2
- package/dist/features/products/components/ProductGrid.js +6 -1
- package/dist/features/products/components/ProductsIndexListing.js +22 -32
- package/dist/features/products/components/ProductsIndexPageView.js +6 -9
- package/dist/features/products/components/index.d.ts +2 -2
- package/dist/features/products/components/index.js +1 -1
- package/dist/features/products/config/listing-type-listing-config.d.ts +20 -0
- package/dist/features/products/config/listing-type-listing-config.js +22 -10
- package/dist/features/products/constants/action-defs.d.ts +2 -0
- package/dist/features/products/constants/action-defs.js +6 -0
- package/dist/features/products/hooks/useAvailabilityScope.d.ts +13 -0
- package/dist/features/products/hooks/useAvailabilityScope.js +19 -0
- package/dist/features/products/hooks/useProducts.d.ts +5 -0
- package/dist/features/products/hooks/useProducts.js +13 -2
- package/dist/features/products/repository/products.repository.d.ts +31 -2
- package/dist/features/products/repository/products.repository.js +53 -21
- package/dist/features/products/schemas/firestore.d.ts +17 -3
- package/dist/features/products/schemas/firestore.js +7 -2
- package/dist/features/products/schemas/index.d.ts +66 -66
- package/dist/features/products/schemas/product-features.validators.d.ts +6 -6
- package/dist/features/products/types/index.d.ts +16 -1
- package/dist/features/promotions/schemas/index.d.ts +2 -2
- package/dist/features/reviews/schemas/index.d.ts +16 -16
- package/dist/features/search/schemas/index.d.ts +4 -4
- package/dist/features/seller/actions/offer-actions.js +25 -2
- package/dist/features/seller/components/SellerArtView.js +5 -0
- package/dist/features/seller/components/SellerAuctionsView.js +13 -15
- package/dist/features/seller/components/SellerClassifiedView.js +5 -0
- package/dist/features/seller/components/SellerDigitalCodesView.js +5 -0
- package/dist/features/seller/components/SellerLiveView.js +5 -0
- package/dist/features/seller/components/SellerOrdersView.js +31 -9
- package/dist/features/seller/components/SellerPayoutSettingsView.js +19 -18
- package/dist/features/seller/components/SellerPreOrdersView.js +5 -0
- package/dist/features/seller/components/SellerPrizeDrawsView.js +14 -16
- package/dist/features/seller/components/SellerProductShell.js +7 -1
- package/dist/features/seller/components/SellerProductsView.js +11 -8
- package/dist/features/seller/components/SellerStickersView.js +5 -0
- package/dist/features/seller/components/index.d.ts +0 -2
- package/dist/features/seller/components/index.js +0 -1
- package/dist/features/seller/repository/offer.repository.d.ts +73 -16
- package/dist/features/seller/repository/offer.repository.js +38 -3
- package/dist/features/seller/schemas/index.d.ts +2 -2
- package/dist/features/seller/schemas/offer-forms.d.ts +25 -0
- package/dist/features/seller/schemas/offer-forms.js +21 -0
- package/dist/features/seller/server.d.ts +0 -1
- package/dist/features/seller/server.js +0 -1
- package/dist/features/shell/SectionForm.d.ts +99 -0
- package/dist/features/shell/SectionForm.js +128 -0
- package/dist/features/shell/entity-form.d.ts +109 -0
- package/dist/features/shell/entity-form.js +96 -0
- package/dist/features/shell/index.d.ts +4 -0
- package/dist/features/shell/index.js +2 -0
- package/dist/features/stores/api/[storeSlug]/route.js +2 -25
- package/dist/features/stores/components/StoreAuctionsListing.js +15 -1
- package/dist/features/stores/components/StoreClassifiedsListing.js +12 -2
- package/dist/features/stores/components/StoreDetailLayoutView.js +24 -71
- package/dist/features/stores/components/StoreDigitalCodesListing.js +12 -2
- package/dist/features/stores/components/StoreLiveItemsListing.js +12 -2
- package/dist/features/stores/components/StorePreOrdersListing.js +12 -1
- package/dist/features/stores/components/StoreProductsListing.js +11 -1
- package/dist/features/stores/repository/store.repository.js +6 -0
- package/dist/features/stores/schemas/index.d.ts +6 -6
- package/dist/features/support/schemas/index.d.ts +4 -4
- package/dist/features/tester/actions/checklist-item-actions.d.ts +4 -4
- package/dist/features/tester/seed-data/offers-tester-seed-data.js +119 -3
- package/dist/features/tester/seed-data/products-tester-seed-data.js +131 -1
- package/dist/features/tester/seed-data/tester-checklist-seed-data.js +105 -1
- package/dist/features/wishlist/hooks/useWishlistWithGuest.d.ts +1 -1
- package/dist/index.d.ts +13 -10
- package/dist/index.js +14 -9
- package/dist/next/routing/route-map.d.ts +7 -1
- package/dist/next/routing/route-map.js +5 -0
- package/dist/providers/db-firebase/base.repository.d.ts +30 -0
- package/dist/providers/db-firebase/base.repository.js +50 -1
- package/dist/providers/db-firebase/index.d.ts +1 -1
- package/dist/providers/db-firebase/index.js +1 -1
- package/dist/providers/db-firebase/sieve.d.ts +25 -0
- package/dist/providers/db-firebase/sieve.js +52 -18
- package/dist/react/hooks/useUrlTable.js +10 -1
- package/dist/schemas/registry.d.ts +68 -68
- package/dist/seed/_helpers/category-forest.d.ts +2 -0
- package/dist/seed/_helpers/category-forest.js +309 -0
- package/dist/seed/_helpers/category-tree.d.ts +27 -0
- package/dist/seed/_helpers/category-tree.js +103 -0
- package/dist/seed/catalogue-seed-data.js +12 -12
- package/dist/seed/categories-seed-data.js +177 -162
- package/dist/seed/events-seed-data.js +61 -10
- package/dist/seed/homepage-sections-seed-data.js +5 -1
- package/dist/seed/offers-seed-data.js +32 -27
- package/dist/seed/products-art-seed-data.js +50 -12
- package/dist/seed/products-auctions-seed-data.js +97 -18
- package/dist/seed/products-classifieds-seed-data.js +80 -16
- package/dist/seed/products-digital-codes-seed-data.js +66 -18
- package/dist/seed/products-live-items-seed-data.js +64 -13
- package/dist/seed/products-preorders-seed-data.d.ts +0 -1
- package/dist/seed/products-preorders-seed-data.js +52 -13
- package/dist/seed/products-prize-draws-seed-data.js +63 -14
- package/dist/seed/products-standard-seed-data.js +99 -26
- package/dist/seed/products-stickers-seed-data.js +47 -12
- package/dist/seed/reviews-seed-data.js +6 -1
- package/dist/seed/site-settings-seed-data.d.ts +1 -38
- package/dist/seed/site-settings-seed-data.js +38 -76
- package/dist/seed/stores-seed-data.js +71 -1
- package/dist/seed/users-seed-data.js +15 -5
- package/dist/server-entry.d.ts +1 -2
- package/dist/server-entry.js +4 -3
- package/dist/server.d.ts +4 -3
- package/dist/server.js +8 -4
- package/dist/styles.css +78 -12
- package/dist/tailwind-utilities.css +1 -1
- package/dist/ui/components/Button.style.css +19 -4
- package/dist/ui/components/CollapsibleSection.d.ts +17 -1
- package/dist/ui/components/CollapsibleSection.js +6 -2
- package/dist/ui/components/FilterChipGroup.d.ts +25 -1
- package/dist/ui/components/FilterChipGroup.js +21 -4
- package/dist/ui/components/HandMode.style.css +47 -0
- package/dist/ui/components/Layout.d.ts +9 -2
- package/dist/ui/components/Layout.js +1 -1
- package/dist/ui/components/ListingLayout.js +8 -8
- package/dist/ui/components/ListingLayout.style.css +8 -7
- package/dist/ui/components/StickyToolbar.d.ts +3 -1
- package/dist/ui/components/StickyToolbar.js +62 -20
- package/dist/ui/components/bottom-chrome-slot.d.ts +21 -0
- package/dist/ui/components/bottom-chrome-slot.js +29 -0
- package/dist/ui/components/index.style.css +3 -0
- package/dist/ui/forms/FormShell.d.ts +43 -13
- package/dist/ui/forms/FormShell.js +22 -11
- package/dist/ui/forms/index.d.ts +1 -1
- package/dist/ui/index.d.ts +1 -1
- package/package.json +2 -2
|
@@ -2,8 +2,27 @@ import type { DocumentReference, WriteBatch } from "firebase-admin/firestore";
|
|
|
2
2
|
import type { FirebaseSieveResult, SieveModel } from "../../../providers/db-firebase";
|
|
3
3
|
import { BaseRepository, parseSieveDateValue } from "../../../providers/db-firebase";
|
|
4
4
|
import { type OrderCreateInput, type OrderDocument, type OrderRefundEvent } from "../schemas";
|
|
5
|
+
import { type HistoryActor, type FieldChange } from "../../../_internal/shared/history/index";
|
|
5
6
|
import type { OrderStatus, PaymentStatus } from "../types";
|
|
6
7
|
import { type PaymentReviewQueueMode } from "../constants/payment-window";
|
|
8
|
+
/**
|
|
9
|
+
* Who/why for a write that lands in `statusHistory`.
|
|
10
|
+
*
|
|
11
|
+
* Optional everywhere so existing callers keep compiling and record
|
|
12
|
+
* `system`; pass it wherever the acting user is known.
|
|
13
|
+
*/
|
|
14
|
+
export interface OrderWriteContext {
|
|
15
|
+
actor?: HistoryActor;
|
|
16
|
+
/** Overrides the default trigger label with the calling function's name. */
|
|
17
|
+
trigger?: string;
|
|
18
|
+
reason?: string;
|
|
19
|
+
note?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Changes the field diff cannot express — used by `postRefundEvent` to put
|
|
22
|
+
* the refund itself on the timeline rather than an array-length delta.
|
|
23
|
+
*/
|
|
24
|
+
extraChanges?: Record<string, FieldChange>;
|
|
25
|
+
}
|
|
7
26
|
declare class OrderRepository extends BaseRepository<OrderDocument> {
|
|
8
27
|
constructor();
|
|
9
28
|
private decryptOrder;
|
|
@@ -15,10 +34,23 @@ declare class OrderRepository extends BaseRepository<OrderDocument> {
|
|
|
15
34
|
findByStatus(status: OrderStatus): Promise<OrderDocument[]>;
|
|
16
35
|
findConfirmed(): Promise<OrderDocument[]>;
|
|
17
36
|
findPending(): Promise<OrderDocument[]>;
|
|
18
|
-
|
|
37
|
+
/**
|
|
38
|
+
* Every write primitive below routes through this so `statusHistory` is
|
|
39
|
+
* appended at the SEVEN places a tracked field can change, rather than at
|
|
40
|
+
* the ~32 call sites above them. That is what makes order history a
|
|
41
|
+
* contained change instead of a codebase-wide sweep — and it follows the
|
|
42
|
+
* precedent `postRefundEvent` already set for append-only order data.
|
|
43
|
+
*
|
|
44
|
+
* `ctx` is optional throughout: a caller that has not been updated yet
|
|
45
|
+
* records `system` rather than failing, so this rolls out incrementally.
|
|
46
|
+
* The actor is worth passing wherever it is known — a history entry that
|
|
47
|
+
* cannot say who cancelled an order is a much weaker record.
|
|
48
|
+
*/
|
|
49
|
+
private updateWithHistory;
|
|
50
|
+
updateStatus(orderId: string, status: OrderStatus, additionalData?: Partial<OrderDocument>, ctx?: OrderWriteContext): Promise<OrderDocument>;
|
|
19
51
|
assignWorker(orderId: string, workerId: string): Promise<OrderDocument>;
|
|
20
52
|
unassignWorker(orderId: string): Promise<OrderDocument>;
|
|
21
|
-
markPicked(orderId: string): Promise<OrderDocument>;
|
|
53
|
+
markPicked(orderId: string, ctx?: OrderWriteContext): Promise<OrderDocument>;
|
|
22
54
|
markPacked(orderId: string): Promise<OrderDocument>;
|
|
23
55
|
/**
|
|
24
56
|
* Payment Detail Parity (Feature C) — the COD counterpart to the manual
|
|
@@ -27,10 +59,10 @@ declare class OrderRepository extends BaseRepository<OrderDocument> {
|
|
|
27
59
|
* verify against, so `verifiedBy` is the acting user's uid and
|
|
28
60
|
* `verificationMethod` is always "cod_collection".
|
|
29
61
|
*/
|
|
30
|
-
markCodCollected(orderId: string, verifiedBy: string, note?: string): Promise<OrderDocument>;
|
|
62
|
+
markCodCollected(orderId: string, verifiedBy: string, note?: string, ctx?: OrderWriteContext): Promise<OrderDocument>;
|
|
31
63
|
findFulfillmentQueue(storeId: string): Promise<OrderDocument[]>;
|
|
32
|
-
updatePaymentStatus(orderId: string, paymentStatus: PaymentStatus, paymentId?: string): Promise<OrderDocument>;
|
|
33
|
-
cancelOrder(orderId: string, reason: string, refundAmount?: number): Promise<OrderDocument>;
|
|
64
|
+
updatePaymentStatus(orderId: string, paymentStatus: PaymentStatus, paymentId?: string, ctx?: OrderWriteContext): Promise<OrderDocument>;
|
|
65
|
+
cancelOrder(orderId: string, reason: string, refundAmount?: number, ctx?: OrderWriteContext): Promise<OrderDocument>;
|
|
34
66
|
findRecentByUser(userId: string): Promise<OrderDocument[]>;
|
|
35
67
|
hasUserPurchased(userId: string, productId: string): Promise<boolean>;
|
|
36
68
|
/**
|
|
@@ -217,7 +249,7 @@ declare class OrderRepository extends BaseRepository<OrderDocument> {
|
|
|
217
249
|
* Append one refund event to the order and mark it non-contestable.
|
|
218
250
|
* If `becomeRefunded` is true, also transitions the order status to "refunded".
|
|
219
251
|
*/
|
|
220
|
-
postRefundEvent(orderId: string, event: OrderRefundEvent, becomeRefunded?: boolean): Promise<OrderDocument>;
|
|
252
|
+
postRefundEvent(orderId: string, event: OrderRefundEvent, becomeRefunded?: boolean, ctx?: OrderWriteContext): Promise<OrderDocument>;
|
|
221
253
|
/** Fetch all orders sharing a paymentBatchId (for sibling-orders display). */
|
|
222
254
|
findByPaymentBatchId(batchId: string): Promise<OrderDocument[]>;
|
|
223
255
|
/**
|
|
@@ -327,8 +359,23 @@ declare class OrderRepository extends BaseRepository<OrderDocument> {
|
|
|
327
359
|
markPayoutRequested(batch: WriteBatch, ref: DocumentReference, payoutId: string): void;
|
|
328
360
|
/**
|
|
329
361
|
* Cloud Functions: stage a cancellation update into a caller-owned WriteBatch.
|
|
362
|
+
*
|
|
363
|
+
* `fromStatus` is supplied by the caller because a batch write does no read
|
|
364
|
+
* — but the sweep that calls this already filtered on a status, so it knows
|
|
365
|
+
* the value. Passing it beats recording `null` for something that is
|
|
366
|
+
* genuinely known one stack frame up.
|
|
367
|
+
*/
|
|
368
|
+
cancelInBatch(batch: WriteBatch, ref: DocumentReference, fromStatus?: OrderStatus | null): void;
|
|
369
|
+
/**
|
|
370
|
+
* History append for the two WriteBatch paths, which cannot read-then-diff.
|
|
371
|
+
*
|
|
372
|
+
* Uses `arrayUnion` so the entry lands without a prior read. The FIFO cap
|
|
373
|
+
* therefore is NOT applied here — it is enforced on the next ordinary
|
|
374
|
+
* write. That is an acceptable trade: both batch paths are terminal
|
|
375
|
+
* transitions (cancelled, payout-requested) that fire at most once per
|
|
376
|
+
* order, so they cannot be what overflows the array.
|
|
330
377
|
*/
|
|
331
|
-
|
|
378
|
+
private batchHistoryPatch;
|
|
332
379
|
}
|
|
333
380
|
declare const orderRepository: OrderRepository;
|
|
334
381
|
export { OrderRepository, orderRepository };
|
|
@@ -2,8 +2,9 @@ import { normalizeError } from "../../../errors/normalize";
|
|
|
2
2
|
import { DatabaseError, NotFoundError } from "../../../errors";
|
|
3
3
|
import { BaseRepository, prepareForFirestore, parseSieveDateValue, } from "../../../providers/db-firebase";
|
|
4
4
|
import { decryptPiiFields, encryptPiiFields, ORDER_PII_FIELDS, } from "../../../security";
|
|
5
|
-
import { serverTimestamp } from "../../../contracts/field-ops";
|
|
6
|
-
import { createOrderId, ORDER_COLLECTION, OrderStatusValues, } from "../schemas";
|
|
5
|
+
import { serverTimestamp, arrayUnion } from "../../../contracts/field-ops";
|
|
6
|
+
import { createOrderId, ORDER_COLLECTION, ORDER_TRACKED_FIELDS, OrderStatusValues, } from "../schemas";
|
|
7
|
+
import { withHistory } from "../../../_internal/shared/history/index";
|
|
7
8
|
import { MANUAL_PAYMENT_METHODS, PAYMENT_REVIEW_QUEUE_SCAN_LIMIT, } from "../constants/payment-window";
|
|
8
9
|
import { ORDER_FIELDS } from "../../../constants/field-names";
|
|
9
10
|
/**
|
|
@@ -65,12 +66,44 @@ class OrderRepository extends BaseRepository {
|
|
|
65
66
|
async findPending() {
|
|
66
67
|
return this.findBy(ORDER_FIELDS.STATUS, "pending");
|
|
67
68
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
69
|
+
/**
|
|
70
|
+
* Every write primitive below routes through this so `statusHistory` is
|
|
71
|
+
* appended at the SEVEN places a tracked field can change, rather than at
|
|
72
|
+
* the ~32 call sites above them. That is what makes order history a
|
|
73
|
+
* contained change instead of a codebase-wide sweep — and it follows the
|
|
74
|
+
* precedent `postRefundEvent` already set for append-only order data.
|
|
75
|
+
*
|
|
76
|
+
* `ctx` is optional throughout: a caller that has not been updated yet
|
|
77
|
+
* records `system` rather than failing, so this rolls out incrementally.
|
|
78
|
+
* The actor is worth passing wherever it is known — a history entry that
|
|
79
|
+
* cannot say who cancelled an order is a much weaker record.
|
|
80
|
+
*/
|
|
81
|
+
async updateWithHistory(orderId, patch, ctx, defaultTrigger,
|
|
82
|
+
/**
|
|
83
|
+
* The already-fetched document, when the caller has one. Three of the six
|
|
84
|
+
* write primitives (`markPicked`, `markCodCollected`, `postRefundEvent`)
|
|
85
|
+
* read the order before patching it — passing it through avoids a second
|
|
86
|
+
* read of the same document on every one of those writes, which matters
|
|
87
|
+
* against the Firestore daily read budget (Rule #6).
|
|
88
|
+
*/
|
|
89
|
+
known) {
|
|
90
|
+
const current = known !== undefined ? known : await this.findById(orderId);
|
|
91
|
+
const withEntry = withHistory(current, patch, {
|
|
92
|
+
tracked: ORDER_TRACKED_FIELDS,
|
|
93
|
+
actor: ctx?.actor ?? { role: "system" },
|
|
94
|
+
trigger: ctx?.trigger ?? defaultTrigger,
|
|
95
|
+
reason: ctx?.reason,
|
|
96
|
+
note: ctx?.note,
|
|
97
|
+
extraChanges: ctx?.extraChanges,
|
|
98
|
+
historyField: "statusHistory",
|
|
99
|
+
truncatedField: "statusHistoryTruncated",
|
|
73
100
|
});
|
|
101
|
+
// `null` means no tracked field actually changed — write the patch as-is
|
|
102
|
+
// so an untracked update never grows the array.
|
|
103
|
+
return this.update(orderId, (withEntry ?? patch));
|
|
104
|
+
}
|
|
105
|
+
async updateStatus(orderId, status, additionalData, ctx) {
|
|
106
|
+
return this.updateWithHistory(orderId, { status, ...additionalData, updatedAt: new Date() }, ctx, "orderRepository.updateStatus");
|
|
74
107
|
}
|
|
75
108
|
async assignWorker(orderId, workerId) {
|
|
76
109
|
return this.update(orderId, { assignedWorkerId: workerId, updatedAt: new Date() });
|
|
@@ -78,12 +111,12 @@ class OrderRepository extends BaseRepository {
|
|
|
78
111
|
async unassignWorker(orderId) {
|
|
79
112
|
return this.update(orderId, { assignedWorkerId: undefined, updatedAt: new Date() });
|
|
80
113
|
}
|
|
81
|
-
async markPicked(orderId) {
|
|
114
|
+
async markPicked(orderId, ctx) {
|
|
82
115
|
const order = await this.findById(orderId);
|
|
83
116
|
if (!order)
|
|
84
117
|
throw new NotFoundError(`Order ${orderId} not found`);
|
|
85
118
|
const nextStatus = order.status === "confirmed" ? "processing" : order.status;
|
|
86
|
-
return this.
|
|
119
|
+
return this.updateWithHistory(orderId, { pickedAt: new Date(), status: nextStatus, updatedAt: new Date() }, ctx, "orderRepository.markPicked", order);
|
|
87
120
|
}
|
|
88
121
|
async markPacked(orderId) {
|
|
89
122
|
return this.update(orderId, { packedAt: new Date(), updatedAt: new Date() });
|
|
@@ -95,11 +128,11 @@ class OrderRepository extends BaseRepository {
|
|
|
95
128
|
* verify against, so `verifiedBy` is the acting user's uid and
|
|
96
129
|
* `verificationMethod` is always "cod_collection".
|
|
97
130
|
*/
|
|
98
|
-
async markCodCollected(orderId, verifiedBy, note) {
|
|
131
|
+
async markCodCollected(orderId, verifiedBy, note, ctx) {
|
|
99
132
|
const order = await this.findById(orderId);
|
|
100
133
|
if (!order)
|
|
101
134
|
throw new NotFoundError(`Order ${orderId} not found`);
|
|
102
|
-
return this.
|
|
135
|
+
return this.updateWithHistory(orderId, {
|
|
103
136
|
paymentStatus: "paid",
|
|
104
137
|
paymentRecord: {
|
|
105
138
|
method: "cod",
|
|
@@ -110,7 +143,10 @@ class OrderRepository extends BaseRepository {
|
|
|
110
143
|
verificationMethod: "cod_collection",
|
|
111
144
|
},
|
|
112
145
|
updatedAt: new Date(),
|
|
113
|
-
}
|
|
146
|
+
},
|
|
147
|
+
// `verifiedBy` is the acting user — use it unless the caller supplied a
|
|
148
|
+
// richer actor. Cash collection is always a person, never the system.
|
|
149
|
+
ctx ?? { actor: { uid: verifiedBy, role: "seller" }, note }, "orderRepository.markCodCollected", order);
|
|
114
150
|
}
|
|
115
151
|
async findFulfillmentQueue(storeId) {
|
|
116
152
|
const snap = await this.db
|
|
@@ -122,21 +158,25 @@ class OrderRepository extends BaseRepository {
|
|
|
122
158
|
.get();
|
|
123
159
|
return snap.docs.map((doc) => this.decryptOrder({ id: doc.id, ...doc.data() }));
|
|
124
160
|
}
|
|
125
|
-
async updatePaymentStatus(orderId, paymentStatus, paymentId) {
|
|
126
|
-
return this.
|
|
161
|
+
async updatePaymentStatus(orderId, paymentStatus, paymentId, ctx) {
|
|
162
|
+
return this.updateWithHistory(orderId, {
|
|
127
163
|
paymentStatus,
|
|
128
164
|
...(paymentId ? { paymentId } : {}),
|
|
129
165
|
updatedAt: new Date(),
|
|
130
|
-
});
|
|
166
|
+
}, ctx, "orderRepository.updatePaymentStatus");
|
|
131
167
|
}
|
|
132
|
-
async cancelOrder(orderId, reason, refundAmount) {
|
|
133
|
-
return this.
|
|
168
|
+
async cancelOrder(orderId, reason, refundAmount, ctx) {
|
|
169
|
+
return this.updateWithHistory(orderId, {
|
|
134
170
|
status: "cancelled",
|
|
135
171
|
cancellationDate: new Date(),
|
|
136
172
|
cancellationReason: reason,
|
|
137
173
|
...(refundAmount ? { refundAmount, refundStatus: "pending" } : {}),
|
|
138
174
|
updatedAt: new Date(),
|
|
139
|
-
}
|
|
175
|
+
},
|
|
176
|
+
// The cancellation reason is already a first-class argument here — carry
|
|
177
|
+
// it into the history entry so the timeline can say WHY, not just that
|
|
178
|
+
// it was cancelled.
|
|
179
|
+
{ ...ctx, reason: ctx?.reason ?? reason }, "orderRepository.cancelOrder");
|
|
140
180
|
}
|
|
141
181
|
async findRecentByUser(userId) {
|
|
142
182
|
const now = new Date();
|
|
@@ -251,17 +291,38 @@ class OrderRepository extends BaseRepository {
|
|
|
251
291
|
* Append one refund event to the order and mark it non-contestable.
|
|
252
292
|
* If `becomeRefunded` is true, also transitions the order status to "refunded".
|
|
253
293
|
*/
|
|
254
|
-
async postRefundEvent(orderId, event, becomeRefunded = false) {
|
|
294
|
+
async postRefundEvent(orderId, event, becomeRefunded = false, ctx) {
|
|
255
295
|
const order = await this.findById(orderId);
|
|
256
296
|
if (!order)
|
|
257
297
|
throw new NotFoundError(`Order ${orderId} not found`);
|
|
258
298
|
const existing = order.refunds ?? [];
|
|
259
|
-
return this.
|
|
299
|
+
return this.updateWithHistory(orderId, {
|
|
260
300
|
refunds: [...existing, event],
|
|
261
301
|
contestable: false,
|
|
262
302
|
...(becomeRefunded ? { status: "refunded" } : {}),
|
|
263
303
|
updatedAt: new Date(),
|
|
264
|
-
}
|
|
304
|
+
}, {
|
|
305
|
+
...ctx,
|
|
306
|
+
// The refund is contributed explicitly rather than diffed. A raw diff
|
|
307
|
+
// of `refunds[]` would say "an array of 1 became an array of 2" —
|
|
308
|
+
// true, and useless on a timeline. PARTIAL refunds matter as much as
|
|
309
|
+
// full ones here: a partial changes no tracked field at all, so
|
|
310
|
+
// without this it would leave no trace despite being exactly the kind
|
|
311
|
+
// of event a buyer later asks about.
|
|
312
|
+
extraChanges: {
|
|
313
|
+
refund: {
|
|
314
|
+
from: null,
|
|
315
|
+
to: {
|
|
316
|
+
refundId: event.refundId,
|
|
317
|
+
type: event.type,
|
|
318
|
+
amount: event.amount,
|
|
319
|
+
reason: event.reason,
|
|
320
|
+
},
|
|
321
|
+
},
|
|
322
|
+
},
|
|
323
|
+
actor: ctx?.actor ?? { uid: event.refundedBy, role: "admin" },
|
|
324
|
+
reason: ctx?.reason ?? event.reason,
|
|
325
|
+
}, "orderRepository.postRefundEvent", order);
|
|
265
326
|
}
|
|
266
327
|
/** Fetch all orders sharing a paymentBatchId (for sibling-orders display). */
|
|
267
328
|
async findByPaymentBatchId(batchId) {
|
|
@@ -469,19 +530,52 @@ class OrderRepository extends BaseRepository {
|
|
|
469
530
|
payoutStatus: "requested",
|
|
470
531
|
payoutId,
|
|
471
532
|
updatedAt: serverTimestamp(),
|
|
533
|
+
...this.batchHistoryPatch({
|
|
534
|
+
changes: { payoutStatus: { from: "eligible", to: "requested" } },
|
|
535
|
+
trigger: "orderRepository.markPayoutRequested",
|
|
536
|
+
}),
|
|
472
537
|
});
|
|
473
538
|
}
|
|
474
539
|
/**
|
|
475
540
|
* Cloud Functions: stage a cancellation update into a caller-owned WriteBatch.
|
|
541
|
+
*
|
|
542
|
+
* `fromStatus` is supplied by the caller because a batch write does no read
|
|
543
|
+
* — but the sweep that calls this already filtered on a status, so it knows
|
|
544
|
+
* the value. Passing it beats recording `null` for something that is
|
|
545
|
+
* genuinely known one stack frame up.
|
|
476
546
|
*/
|
|
477
|
-
cancelInBatch(batch, ref) {
|
|
547
|
+
cancelInBatch(batch, ref, fromStatus = null) {
|
|
478
548
|
batch.update(ref, {
|
|
479
549
|
status: OrderStatusValues.CANCELLED,
|
|
480
550
|
cancellationDate: new Date(),
|
|
481
551
|
cancellationReason: "payment_timeout",
|
|
482
552
|
updatedAt: serverTimestamp(),
|
|
553
|
+
...this.batchHistoryPatch({
|
|
554
|
+
changes: { status: { from: fromStatus, to: OrderStatusValues.CANCELLED } },
|
|
555
|
+
reason: "payment_timeout",
|
|
556
|
+
trigger: "orderRepository.cancelInBatch",
|
|
557
|
+
}),
|
|
483
558
|
});
|
|
484
559
|
}
|
|
560
|
+
/**
|
|
561
|
+
* History append for the two WriteBatch paths, which cannot read-then-diff.
|
|
562
|
+
*
|
|
563
|
+
* Uses `arrayUnion` so the entry lands without a prior read. The FIFO cap
|
|
564
|
+
* therefore is NOT applied here — it is enforced on the next ordinary
|
|
565
|
+
* write. That is an acceptable trade: both batch paths are terminal
|
|
566
|
+
* transitions (cancelled, payout-requested) that fire at most once per
|
|
567
|
+
* order, so they cannot be what overflows the array.
|
|
568
|
+
*/
|
|
569
|
+
batchHistoryPatch(input) {
|
|
570
|
+
const entry = {
|
|
571
|
+
at: new Date(),
|
|
572
|
+
actorRole: "system",
|
|
573
|
+
changes: input.changes,
|
|
574
|
+
trigger: input.trigger,
|
|
575
|
+
...(input.reason ? { reason: input.reason } : {}),
|
|
576
|
+
};
|
|
577
|
+
return { statusHistory: arrayUnion(entry) };
|
|
578
|
+
}
|
|
485
579
|
}
|
|
486
580
|
OrderRepository.SELLER_SIEVE_FIELDS = {
|
|
487
581
|
id: { canFilter: true, canSort: false },
|
|
@@ -5,6 +5,59 @@ import type { OrderStatus, PaymentStatus } from "../types";
|
|
|
5
5
|
import type { OrderType } from "../utils/order-splitter";
|
|
6
6
|
import type { BaseDocument } from "../../../_internal/shared/types/base-document";
|
|
7
7
|
import type { ListingType } from "../../products/types";
|
|
8
|
+
import type { StatusChangeEntry } from "../../../_internal/shared/history/index";
|
|
9
|
+
export interface OrderSourceStandard {
|
|
10
|
+
path: "standard";
|
|
11
|
+
listPrice: number;
|
|
12
|
+
}
|
|
13
|
+
export interface OrderSourceAuctionWon {
|
|
14
|
+
path: "auction-won";
|
|
15
|
+
auctionId: string;
|
|
16
|
+
bidId: string;
|
|
17
|
+
winningBidAmount: number;
|
|
18
|
+
/** Bids placed across the whole auction — the "against N bidders" figure. */
|
|
19
|
+
bidCount: number;
|
|
20
|
+
startingBid: number;
|
|
21
|
+
reservePrice?: number;
|
|
22
|
+
reserveMet: boolean;
|
|
23
|
+
auctionEndedAt: Date;
|
|
24
|
+
/** Second-highest bid, when there was one. */
|
|
25
|
+
runnerUpAmount?: number;
|
|
26
|
+
}
|
|
27
|
+
export interface OrderSourceAuctionBuyNow {
|
|
28
|
+
path: "auction-buy-now";
|
|
29
|
+
auctionId: string;
|
|
30
|
+
buyNowPrice: number;
|
|
31
|
+
listPrice: number;
|
|
32
|
+
boughtAt: Date;
|
|
33
|
+
}
|
|
34
|
+
export interface OrderSourceOfferAccepted {
|
|
35
|
+
path: "offer-accepted";
|
|
36
|
+
offerId: string;
|
|
37
|
+
offeredAmount: number;
|
|
38
|
+
/** The asking price at the moment the offer was made. */
|
|
39
|
+
listPriceAtOffer: number;
|
|
40
|
+
counterAmount?: number;
|
|
41
|
+
/** How many counter rounds before agreement. 0 = accepted outright. */
|
|
42
|
+
counterRounds: number;
|
|
43
|
+
acceptedBy: string;
|
|
44
|
+
acceptedAt: Date;
|
|
45
|
+
checkoutDeadline?: Date;
|
|
46
|
+
}
|
|
47
|
+
export interface OrderSourcePreOrder {
|
|
48
|
+
path: "pre-order";
|
|
49
|
+
depositAmount: number;
|
|
50
|
+
balanceDue: number;
|
|
51
|
+
expectedDeliveryDate?: Date;
|
|
52
|
+
}
|
|
53
|
+
export interface OrderSourcePrizeDraw {
|
|
54
|
+
path: "prize-draw";
|
|
55
|
+
prizeDrawProductId: string;
|
|
56
|
+
pricePerEntry: number;
|
|
57
|
+
entryCount: number;
|
|
58
|
+
revealMode: "instant" | "scheduled";
|
|
59
|
+
}
|
|
60
|
+
export type OrderSourceContext = OrderSourceStandard | OrderSourceAuctionWon | OrderSourceAuctionBuyNow | OrderSourceOfferAccepted | OrderSourcePreOrder | OrderSourcePrizeDraw;
|
|
8
61
|
/** Manual shipping is the only supported method — sellers enter carrier + tracking directly, no carrier API integration. */
|
|
9
62
|
export type ShippingMethod = "custom";
|
|
10
63
|
export type RefundType = "full" | "partial";
|
|
@@ -150,6 +203,18 @@ export interface OrderDocument extends BaseDocument {
|
|
|
150
203
|
storeName?: string;
|
|
151
204
|
items?: OrderDocumentItem[];
|
|
152
205
|
orderType?: OrderType;
|
|
206
|
+
/**
|
|
207
|
+
* True when this `orderType: "auction"` order came from Buy Now rather than
|
|
208
|
+
* from winning the bidding.
|
|
209
|
+
*
|
|
210
|
+
* Not a new `orderType` value on purpose — the /user/orders tabs key on
|
|
211
|
+
* `orderType`, and a buyout IS an auction order from the buyer's point of
|
|
212
|
+
* view. What it changes is the ADMIN review window: a buyout is settled in a
|
|
213
|
+
* one-hour scramble against a still-live auction, so `paymentReviewAutoApprove`
|
|
214
|
+
* gives an admin a full day to verify its proof instead of the usual couple of
|
|
215
|
+
* hours before auto-approving.
|
|
216
|
+
*/
|
|
217
|
+
isBuyout?: boolean;
|
|
153
218
|
imageUrls?: string[];
|
|
154
219
|
quantity: number;
|
|
155
220
|
unitPrice: number;
|
|
@@ -248,6 +313,37 @@ export interface OrderDocument extends BaseDocument {
|
|
|
248
313
|
* orders are the source of truth for invoicing, refunds, and disputes.
|
|
249
314
|
*/
|
|
250
315
|
paymentBatchId?: string;
|
|
316
|
+
/**
|
|
317
|
+
* Append-only delta log of every tracked-field change on this order —
|
|
318
|
+
* who, when, from what to what, and which function did it.
|
|
319
|
+
*
|
|
320
|
+
* DELTAS, never snapshots: only `statusHistory[0]` (the creation entry)
|
|
321
|
+
* carries a `snapshot`, holding the provenance that cannot be re-derived
|
|
322
|
+
* later because its sources move on — the discounts and add-ons actually
|
|
323
|
+
* applied and the fee breakdown at the moment of purchase.
|
|
324
|
+
*
|
|
325
|
+
* Capped at `STATUS_HISTORY_MAX` (FIFO). An unbounded array on a document
|
|
326
|
+
* this hot inflates every read of it (Rule #6).
|
|
327
|
+
*/
|
|
328
|
+
statusHistory?: StatusChangeEntry[];
|
|
329
|
+
/**
|
|
330
|
+
* Entries dropped off the front of `statusHistory` over this order's
|
|
331
|
+
* lifetime. Present so the UI can say "earlier history trimmed" instead
|
|
332
|
+
* of implying the order simply had no earlier history.
|
|
333
|
+
*/
|
|
334
|
+
statusHistoryTruncated?: number;
|
|
335
|
+
/**
|
|
336
|
+
* How the buyer acquired the right to buy, written ONCE at creation.
|
|
337
|
+
*
|
|
338
|
+
* A discriminated union rather than optional fields, because `orderType`
|
|
339
|
+
* cannot distinguish an auction that was WON from one that was BOUGHT OUT
|
|
340
|
+
* — both are `"auction"` — and `winningBidAmount`/`bidCount` are
|
|
341
|
+
* meaningless on a buy-now, where there are zero bids by definition.
|
|
342
|
+
*
|
|
343
|
+
* Never recomputed: a settled auction's numbers must not move when the
|
|
344
|
+
* auction document is later archived or the product is re-priced.
|
|
345
|
+
*/
|
|
346
|
+
sourceContext?: OrderSourceContext;
|
|
251
347
|
/**
|
|
252
348
|
* Append-only log of refund events on this order. Multiple partial refund
|
|
253
349
|
* events are allowed until the cumulative amount equals `totalPrice`.
|
|
@@ -384,6 +480,27 @@ export declare const ORDER_INDEXED_FIELDS: readonly ["userId", "productId", "sto
|
|
|
384
480
|
export declare const DEFAULT_ORDER_DATA: Partial<OrderDocument>;
|
|
385
481
|
export declare const ORDER_PUBLIC_FIELDS: readonly ["id", "productId", "productTitle", "quantity", "unitPrice", "totalPrice", "currency", "status", "paymentStatus", "shippingAddress", "trackingNumber", "notes", "orderDate", "shippingDate", "deliveryDate", "createdAt"];
|
|
386
482
|
export declare const ORDER_UPDATABLE_FIELDS: readonly ["notes", "shippingAddress"];
|
|
483
|
+
/**
|
|
484
|
+
* The fields whose changes are recorded in `statusHistory`.
|
|
485
|
+
*
|
|
486
|
+
* Deliberately minimal — the timeline answers "where is my order and what
|
|
487
|
+
* happened to it", nothing else.
|
|
488
|
+
*
|
|
489
|
+
* **Money is NOT tracked here.** `appliedDiscounts`, `storeAddons` and the
|
|
490
|
+
* fee fields hold the FINAL state on the order document, and that is the
|
|
491
|
+
* record. Logging every intermediate coupon/add-on change would bury the five
|
|
492
|
+
* transitions anyone actually reads under pricing churn, and a coupon that
|
|
493
|
+
* was dropped before the order existed is not part of the order's history.
|
|
494
|
+
*
|
|
495
|
+
* **Acquisition is NOT tracked here either** — how the buyer got the right to
|
|
496
|
+
* buy (auction won, offer accepted, bought out) is written once to
|
|
497
|
+
* `sourceContext` at creation. It never changes, so it is not a timeline
|
|
498
|
+
* event.
|
|
499
|
+
*
|
|
500
|
+
* A whole-document diff would append an entry for every `updatedAt` bump —
|
|
501
|
+
* which is every single write — and exhaust the FIFO cap within days.
|
|
502
|
+
*/
|
|
503
|
+
export declare const ORDER_TRACKED_FIELDS: readonly ["status", "paymentStatus", "paymentReviewOutcome", "trackingNumber", "cancellationReason"];
|
|
387
504
|
export type OrderCreateInput = Omit<OrderDocument, "id" | "createdAt" | "updatedAt" | "orderDate">;
|
|
388
505
|
export type OrderUpdateInput = Partial<Pick<OrderDocument, (typeof ORDER_UPDATABLE_FIELDS)[number]>>;
|
|
389
506
|
export type OrderAdminUpdateInput = Partial<Omit<OrderDocument, "id" | "createdAt">>;
|
|
@@ -88,6 +88,36 @@ export const ORDER_PUBLIC_FIELDS = [
|
|
|
88
88
|
"createdAt",
|
|
89
89
|
];
|
|
90
90
|
export const ORDER_UPDATABLE_FIELDS = ["notes", "shippingAddress"];
|
|
91
|
+
/**
|
|
92
|
+
* The fields whose changes are recorded in `statusHistory`.
|
|
93
|
+
*
|
|
94
|
+
* Deliberately minimal — the timeline answers "where is my order and what
|
|
95
|
+
* happened to it", nothing else.
|
|
96
|
+
*
|
|
97
|
+
* **Money is NOT tracked here.** `appliedDiscounts`, `storeAddons` and the
|
|
98
|
+
* fee fields hold the FINAL state on the order document, and that is the
|
|
99
|
+
* record. Logging every intermediate coupon/add-on change would bury the five
|
|
100
|
+
* transitions anyone actually reads under pricing churn, and a coupon that
|
|
101
|
+
* was dropped before the order existed is not part of the order's history.
|
|
102
|
+
*
|
|
103
|
+
* **Acquisition is NOT tracked here either** — how the buyer got the right to
|
|
104
|
+
* buy (auction won, offer accepted, bought out) is written once to
|
|
105
|
+
* `sourceContext` at creation. It never changes, so it is not a timeline
|
|
106
|
+
* event.
|
|
107
|
+
*
|
|
108
|
+
* A whole-document diff would append an entry for every `updatedAt` bump —
|
|
109
|
+
* which is every single write — and exhaust the FIFO cap within days.
|
|
110
|
+
*/
|
|
111
|
+
export const ORDER_TRACKED_FIELDS = [
|
|
112
|
+
"status",
|
|
113
|
+
"paymentStatus",
|
|
114
|
+
/** Manual-payment review: proof verified, re-upload requested, rejected. */
|
|
115
|
+
"paymentReviewOutcome",
|
|
116
|
+
/** The substance of the "shipped" transition. */
|
|
117
|
+
"trackingNumber",
|
|
118
|
+
/** Why it was cancelled — a bare "cancelled" is not a useful entry. */
|
|
119
|
+
"cancellationReason",
|
|
120
|
+
];
|
|
91
121
|
export const orderQueryHelpers = {
|
|
92
122
|
byUser: (userId) => ["userId", "==", userId],
|
|
93
123
|
byStore: (storeId) => ["storeId", "==", storeId],
|
|
@@ -562,14 +562,7 @@ export declare const orderFirestoreSchema: z.ZodObject<{
|
|
|
562
562
|
platformFee?: number | undefined;
|
|
563
563
|
paymentMethod?: string | undefined;
|
|
564
564
|
notes?: string | undefined;
|
|
565
|
-
storeName?: string | undefined;
|
|
566
565
|
prizeRevealMode?: "scheduled" | "instant" | undefined;
|
|
567
|
-
physicalLocation?: {
|
|
568
|
-
zone: string;
|
|
569
|
-
shelf: string;
|
|
570
|
-
bin: string;
|
|
571
|
-
} | undefined;
|
|
572
|
-
payoutStatus?: "paid" | "eligible" | "requested" | undefined;
|
|
573
566
|
paymentId?: string | undefined;
|
|
574
567
|
shippingAddress?: string | undefined;
|
|
575
568
|
trackingNumber?: string | undefined;
|
|
@@ -588,6 +581,7 @@ export declare const orderFirestoreSchema: z.ZodObject<{
|
|
|
588
581
|
depositAmount?: number | undefined;
|
|
589
582
|
codRemainingAmount?: number | undefined;
|
|
590
583
|
shippingFee?: number | undefined;
|
|
584
|
+
payoutStatus?: "paid" | "eligible" | "requested" | undefined;
|
|
591
585
|
payoutId?: string | undefined;
|
|
592
586
|
shippingMethod?: "custom" | undefined;
|
|
593
587
|
shippingCarrier?: string | undefined;
|
|
@@ -611,9 +605,13 @@ export declare const orderFirestoreSchema: z.ZodObject<{
|
|
|
611
605
|
}, z.ZodTypeAny, "passthrough">;
|
|
612
606
|
} | undefined;
|
|
613
607
|
prizeDrawProductId?: string | undefined;
|
|
608
|
+
storeName?: string | undefined;
|
|
614
609
|
couponCode?: string | undefined;
|
|
615
|
-
|
|
616
|
-
|
|
610
|
+
physicalLocation?: {
|
|
611
|
+
zone: string;
|
|
612
|
+
shelf: string;
|
|
613
|
+
bin: string;
|
|
614
|
+
} | undefined;
|
|
617
615
|
orderType?: string | undefined;
|
|
618
616
|
imageUrls?: string[] | undefined;
|
|
619
617
|
refundFeeDeducted?: number | undefined;
|
|
@@ -629,6 +627,8 @@ export declare const orderFirestoreSchema: z.ZodObject<{
|
|
|
629
627
|
couponId?: string | undefined;
|
|
630
628
|
}[] | undefined;
|
|
631
629
|
codHandlingFee?: number | undefined;
|
|
630
|
+
emiEnabled?: boolean | undefined;
|
|
631
|
+
emiTenureMonths?: number | undefined;
|
|
632
632
|
emiTokenAmount?: number | undefined;
|
|
633
633
|
emiSurchargeAmount?: number | undefined;
|
|
634
634
|
emiInstallments?: {
|
|
@@ -710,14 +710,7 @@ export declare const orderFirestoreSchema: z.ZodObject<{
|
|
|
710
710
|
platformFee?: number | undefined;
|
|
711
711
|
paymentMethod?: string | undefined;
|
|
712
712
|
notes?: string | undefined;
|
|
713
|
-
storeName?: string | undefined;
|
|
714
713
|
prizeRevealMode?: "scheduled" | "instant" | undefined;
|
|
715
|
-
physicalLocation?: {
|
|
716
|
-
zone: string;
|
|
717
|
-
shelf: string;
|
|
718
|
-
bin: string;
|
|
719
|
-
} | undefined;
|
|
720
|
-
payoutStatus?: "paid" | "eligible" | "requested" | undefined;
|
|
721
714
|
paymentId?: string | undefined;
|
|
722
715
|
shippingAddress?: string | undefined;
|
|
723
716
|
trackingNumber?: string | undefined;
|
|
@@ -736,6 +729,7 @@ export declare const orderFirestoreSchema: z.ZodObject<{
|
|
|
736
729
|
depositAmount?: number | undefined;
|
|
737
730
|
codRemainingAmount?: number | undefined;
|
|
738
731
|
shippingFee?: number | undefined;
|
|
732
|
+
payoutStatus?: "paid" | "eligible" | "requested" | undefined;
|
|
739
733
|
payoutId?: string | undefined;
|
|
740
734
|
shippingMethod?: "custom" | undefined;
|
|
741
735
|
shippingCarrier?: string | undefined;
|
|
@@ -759,9 +753,13 @@ export declare const orderFirestoreSchema: z.ZodObject<{
|
|
|
759
753
|
}, z.ZodTypeAny, "passthrough">;
|
|
760
754
|
} | undefined;
|
|
761
755
|
prizeDrawProductId?: string | undefined;
|
|
756
|
+
storeName?: string | undefined;
|
|
762
757
|
couponCode?: string | undefined;
|
|
763
|
-
|
|
764
|
-
|
|
758
|
+
physicalLocation?: {
|
|
759
|
+
zone: string;
|
|
760
|
+
shelf: string;
|
|
761
|
+
bin: string;
|
|
762
|
+
} | undefined;
|
|
765
763
|
orderType?: string | undefined;
|
|
766
764
|
imageUrls?: string[] | undefined;
|
|
767
765
|
refundFeeDeducted?: number | undefined;
|
|
@@ -777,6 +775,8 @@ export declare const orderFirestoreSchema: z.ZodObject<{
|
|
|
777
775
|
couponId?: string | undefined;
|
|
778
776
|
}[] | undefined;
|
|
779
777
|
codHandlingFee?: number | undefined;
|
|
778
|
+
emiEnabled?: boolean | undefined;
|
|
779
|
+
emiTenureMonths?: number | undefined;
|
|
780
780
|
emiTokenAmount?: number | undefined;
|
|
781
781
|
emiSurchargeAmount?: number | undefined;
|
|
782
782
|
emiInstallments?: {
|