@mohasinac/appkit 2.6.3 → 2.6.4
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/server/features/account/data.js +2 -2
- package/dist/_internal/server/features/bundles/data.d.ts +26 -6
- package/dist/_internal/server/features/bundles/data.js +41 -6
- package/dist/_internal/server/features/bundles/index.d.ts +3 -2
- package/dist/_internal/server/features/bundles/index.js +4 -2
- package/dist/_internal/server/features/bundles/metadata.d.ts +20 -0
- package/dist/_internal/server/features/bundles/metadata.js +46 -0
- package/dist/_internal/server/features/bundles/og.d.ts +38 -0
- package/dist/_internal/server/features/bundles/og.js +122 -0
- package/dist/_internal/server/features/checkout/actions.js +192 -133
- package/dist/_internal/server/features/checkout/bundle-expansion.d.ts +57 -0
- package/dist/_internal/server/features/checkout/bundle-expansion.js +70 -0
- package/dist/_internal/server/features/checkout/prize-bundle-gates.d.ts +5 -15
- package/dist/_internal/server/features/checkout/prize-bundle-gates.js +5 -21
- package/dist/_internal/server/features/media/contextGuards.js +15 -1
- package/dist/_internal/server/features/payouts/actions.d.ts +19 -0
- package/dist/_internal/server/features/payouts/actions.js +38 -0
- package/dist/_internal/server/features/products/data.js +1 -2
- package/dist/_internal/server/features/raffle/actions.d.ts +11 -0
- package/dist/_internal/server/features/raffle/actions.js +31 -0
- package/dist/_internal/server/features/refunds/actions.d.ts +31 -0
- package/dist/_internal/server/features/refunds/actions.js +77 -0
- package/dist/_internal/server/jobs/core/adminAnalytics.d.ts +28 -0
- package/dist/_internal/server/jobs/core/adminAnalytics.js +98 -0
- package/dist/_internal/server/jobs/core/assignSpinPrize.d.ts +19 -0
- package/dist/_internal/server/jobs/core/assignSpinPrize.js +81 -0
- package/dist/_internal/server/jobs/core/auctionSettlement.d.ts +2 -0
- package/dist/_internal/server/jobs/core/auctionSettlement.js +70 -0
- package/dist/_internal/server/jobs/core/autoPayoutEligibility.d.ts +2 -0
- package/dist/_internal/server/jobs/core/autoPayoutEligibility.js +109 -0
- package/dist/_internal/server/jobs/core/bundleStockSync.d.ts +10 -0
- package/dist/_internal/server/jobs/core/bundleStockSync.js +71 -0
- package/dist/_internal/server/jobs/core/cartPrune.d.ts +2 -0
- package/dist/_internal/server/jobs/core/cartPrune.js +13 -0
- package/dist/_internal/server/jobs/core/cleanupRtdbEvents.d.ts +2 -0
- package/dist/_internal/server/jobs/core/cleanupRtdbEvents.js +45 -0
- package/dist/_internal/server/jobs/core/countersReconcile.d.ts +2 -0
- package/dist/_internal/server/jobs/core/countersReconcile.js +107 -0
- package/dist/_internal/server/jobs/core/couponExpiry.d.ts +2 -0
- package/dist/_internal/server/jobs/core/couponExpiry.js +13 -0
- package/dist/_internal/server/jobs/core/dailyDataCleanup.d.ts +2 -0
- package/dist/_internal/server/jobs/core/dailyDataCleanup.js +20 -0
- package/dist/_internal/server/jobs/core/index.d.ts +44 -0
- package/dist/_internal/server/jobs/core/index.js +47 -0
- package/dist/_internal/server/jobs/core/listingProcessor.d.ts +30 -0
- package/dist/_internal/server/jobs/core/listingProcessor.js +138 -0
- package/dist/_internal/server/jobs/core/mediaTmpCleanup.d.ts +14 -0
- package/dist/_internal/server/jobs/core/mediaTmpCleanup.js +68 -0
- package/dist/_internal/server/jobs/core/notificationPrune.d.ts +2 -0
- package/dist/_internal/server/jobs/core/notificationPrune.js +13 -0
- package/dist/_internal/server/jobs/core/offerExpiry.d.ts +2 -0
- package/dist/_internal/server/jobs/core/offerExpiry.js +50 -0
- package/dist/_internal/server/jobs/core/onBidPlaced.d.ts +15 -0
- package/dist/_internal/server/jobs/core/onBidPlaced.js +59 -0
- package/dist/_internal/server/jobs/core/onCategoryWrite.d.ts +14 -0
- package/dist/_internal/server/jobs/core/onCategoryWrite.js +134 -0
- package/dist/_internal/server/jobs/core/onOrderCreate.d.ts +18 -0
- package/dist/_internal/server/jobs/core/onOrderCreate.js +78 -0
- package/dist/_internal/server/jobs/core/onOrderStatusChange.d.ts +19 -0
- package/dist/_internal/server/jobs/core/onOrderStatusChange.js +139 -0
- package/dist/_internal/server/jobs/core/onProductStockChange.d.ts +23 -0
- package/dist/_internal/server/jobs/core/onProductStockChange.js +130 -0
- package/dist/_internal/server/jobs/core/onProductWrite.d.ts +12 -0
- package/dist/_internal/server/jobs/core/onProductWrite.js +94 -0
- package/dist/_internal/server/jobs/core/onReviewWrite.d.ts +7 -0
- package/dist/_internal/server/jobs/core/onReviewWrite.js +49 -0
- package/dist/_internal/server/jobs/core/onStoreWrite.d.ts +12 -0
- package/dist/_internal/server/jobs/core/onStoreWrite.js +7 -0
- package/dist/_internal/server/jobs/core/payoutBatch.d.ts +8 -0
- package/dist/_internal/server/jobs/core/payoutBatch.js +102 -0
- package/dist/_internal/server/jobs/core/pendingOrderTimeout.d.ts +2 -0
- package/dist/_internal/server/jobs/core/pendingOrderTimeout.js +27 -0
- package/dist/_internal/server/jobs/core/positionsReconcile.d.ts +7 -0
- package/dist/_internal/server/jobs/core/positionsReconcile.js +87 -0
- package/dist/_internal/server/jobs/core/prizeRevealClose.d.ts +2 -0
- package/dist/_internal/server/jobs/core/prizeRevealClose.js +22 -0
- package/dist/_internal/server/jobs/core/prizeRevealExpiry.d.ts +2 -0
- package/dist/_internal/server/jobs/core/prizeRevealExpiry.js +50 -0
- package/dist/_internal/server/jobs/core/prizeRevealOpen.d.ts +2 -0
- package/dist/_internal/server/jobs/core/prizeRevealOpen.js +56 -0
- package/dist/_internal/server/jobs/core/prizeRevealReminder.d.ts +2 -0
- package/dist/_internal/server/jobs/core/prizeRevealReminder.js +38 -0
- package/dist/_internal/server/jobs/core/productStatsSync.d.ts +8 -0
- package/dist/_internal/server/jobs/core/productStatsSync.js +36 -0
- package/dist/_internal/server/jobs/core/promotions.d.ts +12 -0
- package/dist/_internal/server/jobs/core/promotions.js +43 -0
- package/dist/_internal/server/jobs/core/storeAnalytics.d.ts +30 -0
- package/dist/_internal/server/jobs/core/storeAnalytics.js +109 -0
- package/dist/_internal/server/jobs/core/triggerEventRaffle.d.ts +19 -0
- package/dist/_internal/server/jobs/core/triggerEventRaffle.js +86 -0
- package/dist/_internal/server/jobs/core/weeklyPayoutEligibility.d.ts +6 -0
- package/dist/_internal/server/jobs/core/weeklyPayoutEligibility.js +85 -0
- package/dist/_internal/server/jobs/handlers/adminAnalytics.d.ts +2 -26
- package/dist/_internal/server/jobs/handlers/adminAnalytics.js +2 -98
- package/dist/_internal/server/jobs/handlers/assignSpinPrize.d.ts +1 -22
- package/dist/_internal/server/jobs/handlers/assignSpinPrize.js +2 -86
- package/dist/_internal/server/jobs/handlers/auctionSettlement.js +2 -70
- package/dist/_internal/server/jobs/handlers/autoPayoutEligibility.js +2 -110
- package/dist/_internal/server/jobs/handlers/bundleStockSync.d.ts +0 -16
- package/dist/_internal/server/jobs/handlers/bundleStockSync.js +2 -80
- package/dist/_internal/server/jobs/handlers/cartPrune.js +2 -13
- package/dist/_internal/server/jobs/handlers/cleanupRtdbEvents.js +2 -45
- package/dist/_internal/server/jobs/handlers/countersReconcile.js +2 -109
- package/dist/_internal/server/jobs/handlers/couponExpiry.js +2 -13
- package/dist/_internal/server/jobs/handlers/dailyDataCleanup.js +2 -20
- package/dist/_internal/server/jobs/handlers/listingProcessor.d.ts +3 -28
- package/dist/_internal/server/jobs/handlers/listingProcessor.js +3 -138
- package/dist/_internal/server/jobs/handlers/mediaTmpCleanup.d.ts +0 -12
- package/dist/_internal/server/jobs/handlers/mediaTmpCleanup.js +2 -69
- package/dist/_internal/server/jobs/handlers/notificationPrune.js +2 -13
- package/dist/_internal/server/jobs/handlers/offerExpiry.js +2 -50
- package/dist/_internal/server/jobs/handlers/onBidPlaced.d.ts +1 -10
- package/dist/_internal/server/jobs/handlers/onBidPlaced.js +2 -56
- package/dist/_internal/server/jobs/handlers/onCategoryWrite.d.ts +1 -8
- package/dist/_internal/server/jobs/handlers/onCategoryWrite.js +6 -134
- package/dist/_internal/server/jobs/handlers/onOrderCreate.d.ts +1 -12
- package/dist/_internal/server/jobs/handlers/onOrderCreate.js +2 -76
- package/dist/_internal/server/jobs/handlers/onOrderStatusChange.d.ts +1 -12
- package/dist/_internal/server/jobs/handlers/onOrderStatusChange.js +2 -139
- package/dist/_internal/server/jobs/handlers/onProductStockChange.d.ts +0 -13
- package/dist/_internal/server/jobs/handlers/onProductStockChange.js +7 -134
- package/dist/_internal/server/jobs/handlers/onProductWrite.d.ts +1 -6
- package/dist/_internal/server/jobs/handlers/onProductWrite.js +6 -106
- package/dist/_internal/server/jobs/handlers/onReviewWrite.js +2 -49
- package/dist/_internal/server/jobs/handlers/onStoreWrite.d.ts +1 -8
- package/dist/_internal/server/jobs/handlers/onStoreWrite.js +7 -8
- package/dist/_internal/server/jobs/handlers/payoutBatch.d.ts +0 -9
- package/dist/_internal/server/jobs/handlers/payoutBatch.js +2 -104
- package/dist/_internal/server/jobs/handlers/pendingOrderTimeout.d.ts +0 -6
- package/dist/_internal/server/jobs/handlers/pendingOrderTimeout.js +2 -33
- package/dist/_internal/server/jobs/handlers/positionsReconcile.d.ts +0 -5
- package/dist/_internal/server/jobs/handlers/positionsReconcile.js +2 -87
- package/dist/_internal/server/jobs/handlers/prizeRevealClose.d.ts +0 -7
- package/dist/_internal/server/jobs/handlers/prizeRevealClose.js +2 -29
- package/dist/_internal/server/jobs/handlers/prizeRevealExpiry.d.ts +0 -8
- package/dist/_internal/server/jobs/handlers/prizeRevealExpiry.js +2 -58
- package/dist/_internal/server/jobs/handlers/prizeRevealOpen.d.ts +0 -8
- package/dist/_internal/server/jobs/handlers/prizeRevealOpen.js +2 -65
- package/dist/_internal/server/jobs/handlers/prizeRevealReminder.d.ts +0 -7
- package/dist/_internal/server/jobs/handlers/prizeRevealReminder.js +2 -45
- package/dist/_internal/server/jobs/handlers/productStatsSync.d.ts +0 -6
- package/dist/_internal/server/jobs/handlers/productStatsSync.js +2 -36
- package/dist/_internal/server/jobs/handlers/promotions.d.ts +2 -10
- package/dist/_internal/server/jobs/handlers/promotions.js +2 -43
- package/dist/_internal/server/jobs/handlers/storeAnalytics.d.ts +2 -28
- package/dist/_internal/server/jobs/handlers/storeAnalytics.js +2 -109
- package/dist/_internal/server/jobs/handlers/triggerEventRaffle.d.ts +1 -28
- package/dist/_internal/server/jobs/handlers/triggerEventRaffle.js +2 -94
- package/dist/_internal/server/jobs/handlers/weeklyPayoutEligibility.d.ts +0 -6
- package/dist/_internal/server/jobs/handlers/weeklyPayoutEligibility.js +2 -87
- package/dist/_internal/server/jobs/index.d.ts +1 -0
- package/dist/_internal/server/jobs/index.js +1 -0
- package/dist/_internal/server/jobs/runtime/adapters/firebase.js +21 -0
- package/dist/_internal/shared/actions/action-registry.d.ts +84 -0
- package/dist/_internal/shared/actions/action-registry.js +160 -0
- package/dist/_internal/shared/checkout/rules/_defaults.d.ts +3 -0
- package/dist/_internal/shared/checkout/rules/_defaults.js +22 -0
- package/dist/_internal/shared/checkout/rules/_limits.d.ts +19 -0
- package/dist/_internal/shared/checkout/rules/_limits.js +19 -0
- package/dist/_internal/shared/checkout/rules/_registry.d.ts +44 -0
- package/dist/_internal/shared/checkout/rules/_registry.js +87 -0
- package/dist/_internal/shared/checkout/rules/auction.rule.d.ts +2 -0
- package/dist/_internal/shared/checkout/rules/auction.rule.js +10 -0
- package/dist/_internal/shared/checkout/rules/bundle.rule.d.ts +11 -0
- package/dist/_internal/shared/checkout/rules/bundle.rule.js +6 -0
- package/dist/_internal/shared/checkout/rules/classified.rule.d.ts +9 -0
- package/dist/_internal/shared/checkout/rules/classified.rule.js +9 -0
- package/dist/_internal/shared/checkout/rules/digital-code.rule.d.ts +8 -0
- package/dist/_internal/shared/checkout/rules/digital-code.rule.js +6 -0
- package/dist/_internal/shared/checkout/rules/index.d.ts +12 -0
- package/dist/_internal/shared/checkout/rules/index.js +12 -0
- package/dist/_internal/shared/checkout/rules/live.rule.d.ts +10 -0
- package/dist/_internal/shared/checkout/rules/live.rule.js +6 -0
- package/dist/_internal/shared/checkout/rules/offer.rule.d.ts +2 -0
- package/dist/_internal/shared/checkout/rules/offer.rule.js +9 -0
- package/dist/_internal/shared/checkout/rules/preorder.rule.d.ts +2 -0
- package/dist/_internal/shared/checkout/rules/preorder.rule.js +28 -0
- package/dist/_internal/shared/checkout/rules/prize-draw.rule.d.ts +2 -0
- package/dist/_internal/shared/checkout/rules/prize-draw.rule.js +65 -0
- package/dist/_internal/shared/checkout/rules/standard.rule.d.ts +2 -0
- package/dist/_internal/shared/checkout/rules/standard.rule.js +5 -0
- package/dist/_internal/shared/checkout/rules/types.d.ts +125 -0
- package/dist/_internal/shared/checkout/rules/types.js +13 -0
- package/dist/_internal/shared/features/cart/schema.d.ts +6 -6
- package/dist/_internal/shared/features/categories/bundle-copy.d.ts +123 -0
- package/dist/_internal/shared/features/categories/bundle-copy.js +134 -0
- package/dist/_internal/shared/features/categories/bundle-schemas.d.ts +318 -0
- package/dist/_internal/shared/features/categories/bundle-schemas.js +55 -0
- package/dist/_internal/shared/features/orders/refund-copy.d.ts +36 -0
- package/dist/_internal/shared/features/orders/refund-copy.js +40 -0
- package/dist/_internal/shared/features/orders/schema.d.ts +4 -4
- package/dist/_internal/shared/features/products/schema.d.ts +8 -8
- package/dist/_internal/shared/listing-types/_registry.d.ts +27 -0
- package/dist/_internal/shared/listing-types/_registry.js +8 -0
- package/dist/_internal/shared/listing-types/action-tracker.d.ts +41 -0
- package/dist/_internal/shared/listing-types/action-tracker.js +70 -0
- package/dist/_internal/shared/listing-types/capabilities.js +25 -0
- package/dist/_internal/shared/listing-types/cart-shipping.d.ts +37 -0
- package/dist/_internal/shared/listing-types/cart-shipping.js +46 -0
- package/dist/_internal/shared/listing-types/classified/config.d.ts +7 -0
- package/dist/_internal/shared/listing-types/classified/config.js +8 -0
- package/dist/_internal/shared/listing-types/classified/ctas.d.ts +1 -0
- package/dist/_internal/shared/listing-types/classified/ctas.js +3 -0
- package/dist/_internal/shared/listing-types/classified/og.d.ts +1 -0
- package/dist/_internal/shared/listing-types/classified/og.js +1 -0
- package/dist/_internal/shared/listing-types/classified/schema.d.ts +1 -0
- package/dist/_internal/shared/listing-types/classified/schema.js +1 -0
- package/dist/_internal/shared/listing-types/classified/seed-factory.d.ts +1 -0
- package/dist/_internal/shared/listing-types/classified/seed-factory.js +1 -0
- package/dist/_internal/shared/listing-types/digital-code/config.d.ts +7 -0
- package/dist/_internal/shared/listing-types/digital-code/config.js +8 -0
- package/dist/_internal/shared/listing-types/digital-code/ctas.d.ts +1 -0
- package/dist/_internal/shared/listing-types/digital-code/ctas.js +3 -0
- package/dist/_internal/shared/listing-types/digital-code/og.d.ts +1 -0
- package/dist/_internal/shared/listing-types/digital-code/og.js +1 -0
- package/dist/_internal/shared/listing-types/digital-code/schema.d.ts +1 -0
- package/dist/_internal/shared/listing-types/digital-code/schema.js +1 -0
- package/dist/_internal/shared/listing-types/digital-code/seed-factory.d.ts +1 -0
- package/dist/_internal/shared/listing-types/digital-code/seed-factory.js +1 -0
- package/dist/_internal/shared/listing-types/feature-flags.d.ts +34 -0
- package/dist/_internal/shared/listing-types/feature-flags.js +45 -0
- package/dist/_internal/shared/listing-types/live/config.d.ts +7 -0
- package/dist/_internal/shared/listing-types/live/config.js +8 -0
- package/dist/_internal/shared/listing-types/live/ctas.d.ts +1 -0
- package/dist/_internal/shared/listing-types/live/ctas.js +3 -0
- package/dist/_internal/shared/listing-types/live/og.d.ts +1 -0
- package/dist/_internal/shared/listing-types/live/og.js +1 -0
- package/dist/_internal/shared/listing-types/live/schema.d.ts +1 -0
- package/dist/_internal/shared/listing-types/live/schema.js +1 -0
- package/dist/_internal/shared/listing-types/live/seed-factory.d.ts +1 -0
- package/dist/_internal/shared/listing-types/live/seed-factory.js +1 -0
- package/dist/_internal/shared/media/limits.js +8 -0
- package/dist/client.d.ts +6 -1
- package/dist/client.js +14 -1
- package/dist/configs/next.js +7 -0
- package/dist/constants/api-endpoints.d.ts +6 -0
- package/dist/constants/api-endpoints.js +4 -0
- package/dist/core/hooks/useSyncManager.js +13 -1
- package/dist/core/unit-of-work.d.ts +1 -1
- package/dist/core/unit-of-work.js +2 -2
- package/dist/features/account/actions/address-actions.d.ts +1 -1
- package/dist/features/account/actions/address-actions.js +15 -7
- package/dist/features/account/schemas/firestore.d.ts +8 -43
- package/dist/features/account/schemas/firestore.js +8 -54
- package/dist/features/account/schemas/index.d.ts +6 -6
- package/dist/features/account/server.d.ts +1 -1
- package/dist/features/account/server.js +3 -1
- package/dist/features/addresses/index.d.ts +2 -0
- package/dist/features/addresses/index.js +2 -0
- package/dist/features/addresses/repository/addresses.repository.d.ts +29 -0
- package/dist/features/addresses/repository/addresses.repository.js +157 -0
- package/dist/features/addresses/schemas/firestore.d.ts +53 -0
- package/dist/features/addresses/schemas/firestore.js +68 -0
- package/dist/features/{bundles → addresses}/schemas/index.d.ts +0 -1
- package/dist/features/{bundles → addresses}/schemas/index.js +0 -1
- package/dist/features/addresses/server.d.ts +2 -0
- package/dist/features/addresses/server.js +2 -0
- package/dist/features/admin/components/AdminAllEventEntriesView.js +4 -3
- package/dist/features/admin/components/AdminBidsView.js +4 -3
- package/dist/features/admin/components/AdminBlogView.js +8 -3
- package/dist/features/admin/components/AdminBundleEditorView.d.ts +9 -0
- package/dist/features/admin/components/AdminBundleEditorView.js +209 -0
- package/dist/features/admin/components/AdminBundlesView.d.ts +9 -0
- package/dist/features/admin/components/AdminBundlesView.js +59 -0
- package/dist/features/admin/components/AdminCartsView.js +13 -3
- package/dist/features/admin/components/AdminContactView.js +4 -3
- package/dist/features/admin/components/AdminCouponsView.js +32 -13
- package/dist/features/admin/components/AdminNewsletterView.js +4 -3
- package/dist/features/admin/components/AdminOrdersView.js +15 -7
- package/dist/features/admin/components/AdminPayoutsView.js +4 -3
- package/dist/features/admin/components/AdminProductsView.js +6 -5
- package/dist/features/admin/components/AdminReviewsView.js +5 -4
- package/dist/features/admin/components/AdminStoresView.js +4 -3
- package/dist/features/admin/components/AdminUsersView.js +15 -5
- package/dist/features/admin/components/AdminWishlistsView.js +10 -1
- package/dist/features/admin/components/DataTable.d.ts +5 -1
- package/dist/features/admin/components/DataTable.js +24 -20
- package/dist/features/admin/components/index.d.ts +4 -0
- package/dist/features/admin/components/index.js +3 -0
- package/dist/features/admin/constants/filter-tabs.d.ts +401 -0
- package/dist/features/admin/constants/filter-tabs.js +200 -0
- package/dist/features/admin/hooks/useAdminListingData.d.ts +1 -0
- package/dist/features/admin/hooks/useAdminListingData.js +1 -0
- package/dist/features/admin/schemas/firestore.d.ts +15 -0
- package/dist/features/admin/schemas/firestore.js +18 -0
- package/dist/features/admin/types/product.types.d.ts +2 -2
- package/dist/features/auctions/components/AuctionCard.d.ts +4 -1
- package/dist/features/auctions/components/AuctionCard.js +5 -3
- package/dist/features/auctions/components/AuctionDetailPageView.js +1 -1
- package/dist/features/auctions/components/MarketplaceAuctionCard.d.ts +2 -2
- package/dist/features/auctions/components/PlaceBidFormClient.js +12 -2
- package/dist/features/auctions/schemas/index.d.ts +2 -2
- package/dist/features/auth/index.d.ts +1 -0
- package/dist/features/auth/index.js +1 -0
- package/dist/features/auth/role-predicates.d.ts +16 -0
- package/dist/features/auth/role-predicates.js +15 -0
- package/dist/features/blog/components/BlogFeaturedCard.d.ts +4 -1
- package/dist/features/blog/components/BlogFeaturedCard.js +5 -3
- package/dist/features/cart/actions/cart-actions.d.ts +1 -0
- package/dist/features/cart/actions/cart-actions.js +16 -0
- package/dist/features/cart/components/CartView.d.ts +19 -1
- package/dist/features/cart/components/CartView.js +2 -2
- package/dist/features/cart/components/ShippingPicker.d.ts +13 -0
- package/dist/features/cart/components/ShippingPicker.js +48 -0
- package/dist/features/cart/components/index.d.ts +3 -1
- package/dist/features/cart/components/index.js +1 -0
- package/dist/features/cart/hooks/useCartCount.js +7 -1
- package/dist/features/cart/repository/cart.repository.d.ts +1 -0
- package/dist/features/cart/repository/cart.repository.js +35 -0
- package/dist/features/cart/schemas/firestore.d.ts +27 -2
- package/dist/features/categories/components/BundleAddToCartCta.d.ts +16 -0
- package/dist/features/categories/components/BundleAddToCartCta.js +54 -0
- package/dist/features/categories/components/BundleBuyNowCta.d.ts +8 -0
- package/dist/features/categories/components/BundleBuyNowCta.js +37 -0
- package/dist/features/categories/components/BundleDetailView.d.ts +22 -0
- package/dist/features/categories/components/BundleDetailView.js +31 -0
- package/dist/features/categories/components/BundleDynamicRuleEditor.d.ts +18 -0
- package/dist/features/categories/components/BundleDynamicRuleEditor.js +60 -0
- package/dist/features/categories/components/BundleItemsPicker.d.ts +26 -0
- package/dist/features/categories/components/BundleItemsPicker.js +135 -0
- package/dist/features/categories/components/BundlesListView.d.ts +13 -0
- package/dist/features/categories/components/BundlesListView.js +27 -0
- package/dist/features/categories/components/index.d.ts +12 -0
- package/dist/features/categories/components/index.js +9 -0
- package/dist/features/checkout/actions/checkout-actions.js +10 -3
- package/dist/features/events/components/AdminEventEditorView.js +108 -2
- package/dist/features/events/components/AdminEventsView.js +16 -4
- package/dist/features/events/components/EventCard.d.ts +4 -1
- package/dist/features/events/components/EventCard.js +7 -3
- package/dist/features/events/components/EventRaffleWinnerView.d.ts +21 -0
- package/dist/features/events/components/EventRaffleWinnerView.js +18 -0
- package/dist/features/events/components/SpinWheelView.d.ts +27 -0
- package/dist/features/events/components/SpinWheelView.js +64 -0
- package/dist/features/events/components/index.d.ts +4 -0
- package/dist/features/events/components/index.js +2 -0
- package/dist/features/events/schemas/firestore.d.ts +27 -1
- package/dist/features/events/schemas/firestore.js +7 -0
- package/dist/features/events/types/index.d.ts +27 -1
- package/dist/features/homepage/components/FeaturedBundlesSection.d.ts +16 -0
- package/dist/features/homepage/components/FeaturedBundlesSection.js +24 -0
- package/dist/features/homepage/components/MarketplaceHomepageView.js +4 -1
- package/dist/features/homepage/components/WhatsAppCommunitySection.js +2 -2
- package/dist/features/homepage/lib/section-renderer.d.ts +2 -0
- package/dist/features/homepage/lib/section-renderer.js +5 -5
- package/dist/features/layout/NavbarLayout.d.ts +3 -1
- package/dist/features/layout/NavbarLayout.js +32 -3
- package/dist/features/layout/TitleBarLayout.d.ts +6 -3
- package/dist/features/layout/TitleBarLayout.js +22 -7
- package/dist/features/media/upload/MediaUploadField.d.ts +15 -1
- package/dist/features/media/upload/MediaUploadField.js +22 -1
- package/dist/features/orders/components/MarketplaceOrderCard.js +4 -2
- package/dist/features/orders/components/OrderSiblingPayments.d.ts +8 -0
- package/dist/features/orders/components/OrderSiblingPayments.js +16 -0
- package/dist/features/orders/components/RefundHistoryTable.d.ts +6 -0
- package/dist/features/orders/components/RefundHistoryTable.js +23 -0
- package/dist/features/orders/components/RefundRequestView.d.ts +8 -0
- package/dist/features/orders/components/RefundRequestView.js +42 -0
- package/dist/features/orders/components/index.d.ts +6 -0
- package/dist/features/orders/components/index.js +3 -0
- package/dist/features/orders/index.d.ts +1 -0
- package/dist/features/orders/index.js +2 -0
- package/dist/features/orders/repository/orders.repository.d.ts +20 -1
- package/dist/features/orders/repository/orders.repository.js +30 -1
- package/dist/features/orders/schemas/firestore.d.ts +63 -13
- package/dist/features/orders/schemas/firestore.js +5 -5
- package/dist/features/orders/schemas/index.d.ts +4 -4
- package/dist/features/orders/types/index.d.ts +12 -2
- package/dist/features/orders/utils/bundle-grouping.d.ts +48 -0
- package/dist/features/orders/utils/bundle-grouping.js +54 -0
- package/dist/features/orders/utils/order-splitter.d.ts +9 -10
- package/dist/features/orders/utils/order-splitter.js +24 -30
- package/dist/features/payments/repository/payout.repository.d.ts +17 -1
- package/dist/features/payments/repository/payout.repository.js +47 -0
- package/dist/features/payments/schemas/firestore.d.ts +26 -0
- package/dist/features/pre-orders/components/PreorderCard.d.ts +4 -1
- package/dist/features/pre-orders/components/PreorderCard.js +8 -6
- package/dist/features/products/actions/product-actions.d.ts +1 -1
- package/dist/features/products/actions/product-actions.js +1 -1
- package/dist/features/products/components/CompareOverlay.d.ts +2 -2
- package/dist/features/products/components/CompareOverlay.js +4 -4
- package/dist/features/products/components/InteractiveProductCard.js +7 -12
- package/dist/features/products/components/NonRefundableConsentModal.d.ts +1 -1
- package/dist/features/products/components/NonRefundableConsentModal.js +0 -10
- package/dist/features/products/components/ProductGrid.js +28 -12
- package/dist/features/products/components/ShowGroupSection.js +3 -3
- package/dist/features/products/components/SublistingCarouselSection.js +2 -2
- package/dist/features/products/components/index.d.ts +0 -4
- package/dist/features/products/components/index.js +5 -2
- package/dist/features/products/index.d.ts +1 -1
- package/dist/features/products/index.js +3 -1
- package/dist/features/products/repository/products.repository.js +4 -0
- package/dist/features/products/schemas/catalog-product.d.ts +70 -0
- package/dist/features/products/schemas/catalog-product.js +50 -0
- package/dist/features/products/schemas/firestore.d.ts +110 -2
- package/dist/features/products/schemas/firestore.js +30 -0
- package/dist/features/products/schemas/index.d.ts +8 -8
- package/dist/features/products/types/index.d.ts +1 -1
- package/dist/features/products/utils/listing-type.d.ts +9 -0
- package/dist/features/products/utils/listing-type.js +4 -0
- package/dist/features/promotions/actions/coupon-actions.d.ts +2 -2
- package/dist/features/promotions/actions/coupon-actions.js +1 -1
- package/dist/features/promotions/components/CouponCard.d.ts +28 -10
- package/dist/features/promotions/components/CouponCard.js +116 -14
- package/dist/features/promotions/hooks/useCouponValidate.d.ts +1 -1
- package/dist/features/promotions/repository/coupons.repository.d.ts +1 -1
- package/dist/features/reviews/schemas/index.d.ts +2 -2
- package/dist/features/search/schemas/index.d.ts +2 -2
- package/dist/features/search/types/index.d.ts +2 -2
- package/dist/features/seller/components/SellerAuctionsView.js +4 -5
- package/dist/features/seller/components/SellerBidsView.js +5 -13
- package/dist/features/seller/components/SellerCouponsView.js +31 -67
- package/dist/features/seller/components/SellerOffersView.js +4 -5
- package/dist/features/seller/components/SellerOrdersView.js +4 -5
- package/dist/features/seller/components/SellerPayoutsView.js +4 -5
- package/dist/features/seller/components/SellerProductsView.js +4 -8
- package/dist/features/seller/schemas/index.d.ts +2 -2
- package/dist/features/stores/actions/store-address-actions.d.ts +10 -6
- package/dist/features/stores/actions/store-address-actions.js +8 -7
- package/dist/features/stores/components/InteractiveStoreCard.js +3 -10
- package/dist/features/stores/components/StoreDetailLayoutView.js +20 -5
- package/dist/features/stores/schemas/firestore.d.ts +45 -38
- package/dist/features/stores/schemas/firestore.js +2 -49
- package/dist/features/stores/server.d.ts +0 -1
- package/dist/features/stores/server.js +2 -1
- package/dist/features/wishlist/hooks/useWishlistCount.d.ts +7 -9
- package/dist/features/wishlist/hooks/useWishlistCount.js +67 -86
- package/dist/features/wishlist/types/index.d.ts +1 -1
- package/dist/index.d.ts +50 -9
- package/dist/index.js +57 -11
- package/dist/next/routing/route-map.d.ts +6 -0
- package/dist/next/routing/route-map.js +4 -0
- package/dist/providers/db-firebase/admin.d.ts +6 -2
- package/dist/providers/db-firebase/admin.js +23 -0
- package/dist/repositories/index.d.ts +1 -2
- package/dist/repositories/index.js +5 -2
- package/dist/security/authorization.d.ts +2 -1
- package/dist/security/authorization.js +3 -2
- package/dist/seed/actions/demo-seed-actions.d.ts +1 -1
- package/dist/seed/bids-seed-data.d.ts +2 -2
- package/dist/seed/bids-seed-data.js +77 -2
- package/dist/seed/cart-seed-data.d.ts +10 -10
- package/dist/seed/cart-seed-data.js +15 -15
- package/dist/seed/events-seed-data.js +77 -0
- package/dist/seed/manifest.js +16 -8
- package/dist/seed/orders-seed-data.js +41 -2
- package/dist/seed/payouts-seed-data.js +18 -2
- package/dist/seed/stores-seed-data.js +55 -0
- package/dist/server-entry.d.ts +1 -0
- package/dist/server-entry.js +2 -0
- package/dist/server.d.ts +4 -0
- package/dist/server.js +8 -0
- package/dist/tailwind-utilities.css +1 -1
- package/dist/ui/components/FilterChipGroup.d.ts +39 -0
- package/dist/ui/components/FilterChipGroup.js +15 -0
- package/dist/ui/components/HorizontalScroller.js +32 -7
- package/dist/ui/components/HorizontalScroller.style.css +6 -0
- package/dist/ui/components/SiteLogo.js +1 -1
- package/dist/ui/index.d.ts +2 -0
- package/dist/ui/index.js +2 -0
- package/dist/utils/id-generators.d.ts +11 -0
- package/dist/utils/id-generators.js +16 -0
- package/package.json +1 -1
- package/dist/_internal/shared/features/bundles/config.d.ts +0 -6
- package/dist/_internal/shared/features/bundles/config.js +0 -6
- package/dist/_internal/shared/schema-versions.d.ts +0 -76
- package/dist/_internal/shared/schema-versions.js +0 -82
- package/dist/features/account/migrations.d.ts +0 -2
- package/dist/features/account/migrations.js +0 -10
- package/dist/features/admin/migrations.d.ts +0 -2
- package/dist/features/admin/migrations.js +0 -10
- package/dist/features/auctions/migrations.d.ts +0 -2
- package/dist/features/auctions/migrations.js +0 -10
- package/dist/features/auth/migrations.d.ts +0 -2
- package/dist/features/auth/migrations.js +0 -10
- package/dist/features/blog/migrations.d.ts +0 -2
- package/dist/features/blog/migrations.js +0 -10
- package/dist/features/brands/actions/brand-actions.d.ts +0 -2
- package/dist/features/brands/actions/brand-actions.js +0 -5
- package/dist/features/brands/index.d.ts +0 -3
- package/dist/features/brands/index.js +0 -3
- package/dist/features/brands/migrations.d.ts +0 -2
- package/dist/features/brands/migrations.js +0 -10
- package/dist/features/brands/repository/brands.repository.d.ts +0 -13
- package/dist/features/brands/repository/brands.repository.js +0 -60
- package/dist/features/brands/schemas/index.d.ts +0 -33
- package/dist/features/brands/schemas/index.js +0 -15
- package/dist/features/brands/server.d.ts +0 -7
- package/dist/features/brands/server.js +0 -7
- package/dist/features/bundles/components/AdminBundleEditorView.d.ts +0 -8
- package/dist/features/bundles/components/AdminBundleEditorView.js +0 -7
- package/dist/features/bundles/components/BundleDetailPageView.d.ts +0 -9
- package/dist/features/bundles/components/BundleDetailPageView.js +0 -45
- package/dist/features/bundles/components/BundleForm.d.ts +0 -12
- package/dist/features/bundles/components/BundleForm.js +0 -126
- package/dist/features/bundles/components/BundleItemsPicker.d.ts +0 -9
- package/dist/features/bundles/components/BundleItemsPicker.js +0 -77
- package/dist/features/bundles/components/BundlesByCategoryListing.d.ts +0 -6
- package/dist/features/bundles/components/BundlesByCategoryListing.js +0 -50
- package/dist/features/bundles/components/BundlesListingView.d.ts +0 -17
- package/dist/features/bundles/components/BundlesListingView.js +0 -50
- package/dist/features/bundles/components/FeaturedBundlesSection.d.ts +0 -5
- package/dist/features/bundles/components/FeaturedBundlesSection.js +0 -55
- package/dist/features/bundles/components/SellerBundleCreateView.d.ts +0 -8
- package/dist/features/bundles/components/SellerBundleCreateView.js +0 -7
- package/dist/features/bundles/components/SellerBundleEditView.d.ts +0 -9
- package/dist/features/bundles/components/SellerBundleEditView.js +0 -7
- package/dist/features/bundles/components/index.d.ts +0 -18
- package/dist/features/bundles/components/index.js +0 -9
- package/dist/features/bundles/constants/index.d.ts +0 -32
- package/dist/features/bundles/constants/index.js +0 -35
- package/dist/features/bundles/index.d.ts +0 -2
- package/dist/features/bundles/index.js +0 -2
- package/dist/features/bundles/migrations.d.ts +0 -2
- package/dist/features/bundles/migrations.js +0 -10
- package/dist/features/bundles/repository/bundles.repository.d.ts +0 -36
- package/dist/features/bundles/repository/bundles.repository.js +0 -148
- package/dist/features/bundles/repository/index.d.ts +0 -1
- package/dist/features/bundles/repository/index.js +0 -1
- package/dist/features/bundles/schemas/firestore.d.ts +0 -88
- package/dist/features/bundles/schemas/firestore.js +0 -29
- package/dist/features/bundles/schemas/zod.d.ts +0 -377
- package/dist/features/bundles/schemas/zod.js +0 -71
- package/dist/features/cart/migrations.d.ts +0 -2
- package/dist/features/cart/migrations.js +0 -10
- package/dist/features/categories/migrations.d.ts +0 -2
- package/dist/features/categories/migrations.js +0 -10
- package/dist/features/events/migrations.d.ts +0 -2
- package/dist/features/events/migrations.js +0 -10
- package/dist/features/faq/migrations.d.ts +0 -2
- package/dist/features/faq/migrations.js +0 -10
- package/dist/features/grouped/migrations.d.ts +0 -2
- package/dist/features/grouped/migrations.js +0 -10
- package/dist/features/history/migrations.d.ts +0 -2
- package/dist/features/history/migrations.js +0 -10
- package/dist/features/messages/migrations.d.ts +0 -2
- package/dist/features/messages/migrations.js +0 -10
- package/dist/features/orders/migrations.d.ts +0 -2
- package/dist/features/orders/migrations.js +0 -10
- package/dist/features/payments/migrations.d.ts +0 -2
- package/dist/features/payments/migrations.js +0 -10
- package/dist/features/products/migrations.d.ts +0 -2
- package/dist/features/products/migrations.js +0 -10
- package/dist/features/products/repository/sublisting-categories.repository.d.ts +0 -16
- package/dist/features/products/repository/sublisting-categories.repository.js +0 -126
- package/dist/features/products/schemas/sublisting-categories.d.ts +0 -45
- package/dist/features/products/schemas/sublisting-categories.js +0 -16
- package/dist/features/promotions/migrations.d.ts +0 -2
- package/dist/features/promotions/migrations.js +0 -10
- package/dist/features/reviews/migrations.d.ts +0 -2
- package/dist/features/reviews/migrations.js +0 -10
- package/dist/features/scams/migrations.d.ts +0 -2
- package/dist/features/scams/migrations.js +0 -10
- package/dist/features/seller/migrations.d.ts +0 -2
- package/dist/features/seller/migrations.js +0 -10
- package/dist/features/stores/migrations.d.ts +0 -2
- package/dist/features/stores/migrations.js +0 -10
- package/dist/features/sublisting/migrations.d.ts +0 -2
- package/dist/features/sublisting/migrations.js +0 -10
- package/dist/features/sublisting/schemas/firestore.d.ts +0 -32
- package/dist/features/sublisting/schemas/firestore.js +0 -19
- package/dist/features/support/migrations.d.ts +0 -2
- package/dist/features/support/migrations.js +0 -10
- package/dist/features/wishlist/migrations.d.ts +0 -2
- package/dist/features/wishlist/migrations.js +0 -10
- package/dist/seed/_bundle-constants.d.ts +0 -14
- package/dist/seed/_bundle-constants.js +0 -14
- package/dist/seed/anime-figures-seed-data.d.ts +0 -8
- package/dist/seed/anime-figures-seed-data.js +0 -1033
- package/dist/seed/beyblade-seed-data.d.ts +0 -7
- package/dist/seed/beyblade-seed-data.js +0 -1129
- package/dist/seed/brands-seed-data.d.ts +0 -7
- package/dist/seed/brands-seed-data.js +0 -410
- package/dist/seed/bundles-seed-data.d.ts +0 -13
- package/dist/seed/bundles-seed-data.js +0 -229
- package/dist/seed/cosplay-accessories-seed-data.d.ts +0 -8
- package/dist/seed/cosplay-accessories-seed-data.js +0 -647
- package/dist/seed/hot-wheels-seed-data.d.ts +0 -7
- package/dist/seed/hot-wheels-seed-data.js +0 -1612
- package/dist/seed/letitrip-official-seed-data.d.ts +0 -8
- package/dist/seed/letitrip-official-seed-data.js +0 -399
- package/dist/seed/pokemon-carousel-slides-seed-data.d.ts +0 -8
- package/dist/seed/pokemon-carousel-slides-seed-data.js +0 -322
- package/dist/seed/pokemon-categories-seed-data.d.ts +0 -24
- package/dist/seed/pokemon-categories-seed-data.js +0 -547
- package/dist/seed/pokemon-coupons-seed-data.d.ts +0 -6
- package/dist/seed/pokemon-coupons-seed-data.js +0 -465
- package/dist/seed/pokemon-homepage-sections-seed-data.d.ts +0 -7
- package/dist/seed/pokemon-homepage-sections-seed-data.js +0 -241
- package/dist/seed/pokemon-products-seed-data.d.ts +0 -9
- package/dist/seed/pokemon-products-seed-data.js +0 -1791
- package/dist/seed/pokemon-seed-bundle.d.ts +0 -47
- package/dist/seed/pokemon-seed-bundle.js +0 -71
- package/dist/seed/pokemon-stores-seed-data.d.ts +0 -6
- package/dist/seed/pokemon-stores-seed-data.js +0 -179
- package/dist/seed/pokemon-users-seed-data.d.ts +0 -6
- package/dist/seed/pokemon-users-seed-data.js +0 -521
- package/dist/seed/products-seed-data.d.ts +0 -6
- package/dist/seed/products-seed-data.js +0 -2530
- package/dist/seed/retro-gaming-seed-data.d.ts +0 -8
- package/dist/seed/retro-gaming-seed-data.js +0 -801
- package/dist/seed/server.d.ts +0 -2
- package/dist/seed/server.js +0 -7
- package/dist/seed/sublisting-categories-seed-data.d.ts +0 -7
- package/dist/seed/sublisting-categories-seed-data.js +0 -159
- package/dist/seed/transformers-seed-data.d.ts +0 -7
- package/dist/seed/transformers-seed-data.js +0 -530
|
@@ -1,24 +1,32 @@
|
|
|
1
|
+
// SB-UNI-A 2026-05-13 — thin shim re-pointing the legacy `*ForUser` action
|
|
2
|
+
// surface at the unified `addressesRepository` (ownerType:"user"). Kept so
|
|
3
|
+
// existing callers (src/actions/address.actions.ts, _internal data layer)
|
|
4
|
+
// don't need to update.
|
|
1
5
|
import { serverLogger } from "../../../monitoring";
|
|
2
|
-
import {
|
|
6
|
+
import { addressesRepository } from "../../addresses/repository/addresses.repository";
|
|
3
7
|
export async function createAddressForUser(userId, input) {
|
|
4
8
|
serverLogger.debug("createAddressForUser", { userId });
|
|
5
|
-
return
|
|
9
|
+
return addressesRepository.createForOwner("user", userId, input);
|
|
6
10
|
}
|
|
7
11
|
export async function updateAddressForUser(userId, addressId, input) {
|
|
8
12
|
serverLogger.debug("updateAddressForUser", { userId, addressId });
|
|
9
|
-
return
|
|
13
|
+
return addressesRepository.updateForOwner("user", userId, addressId, input);
|
|
10
14
|
}
|
|
11
15
|
export async function deleteAddressForUser(userId, addressId) {
|
|
12
16
|
serverLogger.debug("deleteAddressForUser", { userId, addressId });
|
|
13
|
-
return
|
|
17
|
+
return addressesRepository.deleteForOwner("user", userId, addressId);
|
|
14
18
|
}
|
|
15
19
|
export async function setDefaultAddressForUser(userId, addressId) {
|
|
16
20
|
serverLogger.debug("setDefaultAddressForUser", { userId, addressId });
|
|
17
|
-
return
|
|
21
|
+
return addressesRepository.setDefault("user", userId, addressId);
|
|
18
22
|
}
|
|
19
23
|
export async function listAddressesForUser(userId) {
|
|
20
|
-
return
|
|
24
|
+
return addressesRepository.listByOwner("user", userId);
|
|
21
25
|
}
|
|
22
26
|
export async function getAddressByIdForUser(userId, addressId) {
|
|
23
|
-
|
|
27
|
+
const address = await addressesRepository.findById(addressId);
|
|
28
|
+
if (!address || address.ownerType !== "user" || address.ownerId !== userId) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
return address;
|
|
24
32
|
}
|
|
@@ -1,48 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Account Firestore Document Types & Constants
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
label: string;
|
|
10
|
-
fullName: string;
|
|
11
|
-
phone: string;
|
|
12
|
-
addressLine1: string;
|
|
13
|
-
addressLine2?: string;
|
|
14
|
-
landmark?: string;
|
|
15
|
-
city: string;
|
|
16
|
-
state: string;
|
|
17
|
-
postalCode: string;
|
|
18
|
-
country: string;
|
|
19
|
-
isDefault: boolean;
|
|
20
|
-
createdAt: Date;
|
|
21
|
-
updatedAt: Date;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Subcollection path — users/{userId}/addresses/{addressId}
|
|
4
|
+
* SB-UNI-A 2026-05-13 — Address types relocated to features/addresses/.
|
|
5
|
+
* This file now re-exports the canonical shapes so existing consumers
|
|
6
|
+
* keep their imports stable. The legacy `ADDRESS_SUBCOLLECTION` constant
|
|
7
|
+
* stays as a backwards-compat literal until callers migrate to the
|
|
8
|
+
* top-level `ADDRESSES_COLLECTION`.
|
|
25
9
|
*/
|
|
10
|
+
export { ADDRESS_FIELDS, ADDRESS_INDEXED_FIELDS, ADDRESS_PUBLIC_FIELDS, ADDRESS_UPDATABLE_FIELDS, ADDRESSES_COLLECTION, DEFAULT_ADDRESS_DATA, type AddressCreateInput, type AddressDocument, type AddressOwnerType, type AddressUpdateInput, } from "../../addresses/schemas";
|
|
11
|
+
/** @deprecated SB-UNI-A — kept as a literal alias only. Top-level
|
|
12
|
+
* `addresses` collection is the new home (ADDRESSES_COLLECTION). */
|
|
26
13
|
export declare const ADDRESS_SUBCOLLECTION: "addresses";
|
|
27
|
-
export declare const ADDRESS_INDEXED_FIELDS: readonly ["isDefault", "createdAt"];
|
|
28
|
-
export declare const DEFAULT_ADDRESS_DATA: Partial<AddressDocument>;
|
|
29
|
-
export declare const ADDRESS_PUBLIC_FIELDS: readonly ["id", "label", "fullName", "phone", "addressLine1", "addressLine2", "landmark", "city", "state", "postalCode", "country", "isDefault", "createdAt", "updatedAt"];
|
|
30
|
-
export declare const ADDRESS_UPDATABLE_FIELDS: readonly ["label", "fullName", "phone", "addressLine1", "addressLine2", "landmark", "city", "state", "postalCode", "country", "isDefault"];
|
|
31
|
-
export type AddressCreateInput = Omit<AddressDocument, "id" | "createdAt" | "updatedAt">;
|
|
32
|
-
export type AddressUpdateInput = Partial<Pick<AddressDocument, (typeof ADDRESS_UPDATABLE_FIELDS)[number]>>;
|
|
33
|
-
export declare const ADDRESS_FIELDS: {
|
|
34
|
-
readonly ID: "id";
|
|
35
|
-
readonly LABEL: "label";
|
|
36
|
-
readonly FULL_NAME: "fullName";
|
|
37
|
-
readonly PHONE: "phone";
|
|
38
|
-
readonly ADDRESS_LINE_1: "addressLine1";
|
|
39
|
-
readonly ADDRESS_LINE_2: "addressLine2";
|
|
40
|
-
readonly LANDMARK: "landmark";
|
|
41
|
-
readonly CITY: "city";
|
|
42
|
-
readonly STATE: "state";
|
|
43
|
-
readonly POSTAL_CODE: "postalCode";
|
|
44
|
-
readonly COUNTRY: "country";
|
|
45
|
-
readonly IS_DEFAULT: "isDefault";
|
|
46
|
-
readonly CREATED_AT: "createdAt";
|
|
47
|
-
readonly UPDATED_AT: "updatedAt";
|
|
48
|
-
};
|
|
@@ -1,59 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Account Firestore Document Types & Constants
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
*
|
|
4
|
+
* SB-UNI-A 2026-05-13 — Address types relocated to features/addresses/.
|
|
5
|
+
* This file now re-exports the canonical shapes so existing consumers
|
|
6
|
+
* keep their imports stable. The legacy `ADDRESS_SUBCOLLECTION` constant
|
|
7
|
+
* stays as a backwards-compat literal until callers migrate to the
|
|
8
|
+
* top-level `ADDRESSES_COLLECTION`.
|
|
9
9
|
*/
|
|
10
|
+
export { ADDRESS_FIELDS, ADDRESS_INDEXED_FIELDS, ADDRESS_PUBLIC_FIELDS, ADDRESS_UPDATABLE_FIELDS, ADDRESSES_COLLECTION, DEFAULT_ADDRESS_DATA, } from "../../addresses/schemas";
|
|
11
|
+
/** @deprecated SB-UNI-A — kept as a literal alias only. Top-level
|
|
12
|
+
* `addresses` collection is the new home (ADDRESSES_COLLECTION). */
|
|
10
13
|
export const ADDRESS_SUBCOLLECTION = "addresses";
|
|
11
|
-
export const ADDRESS_INDEXED_FIELDS = ["isDefault", "createdAt"];
|
|
12
|
-
export const DEFAULT_ADDRESS_DATA = {
|
|
13
|
-
isDefault: false,
|
|
14
|
-
};
|
|
15
|
-
export const ADDRESS_PUBLIC_FIELDS = [
|
|
16
|
-
"id",
|
|
17
|
-
"label",
|
|
18
|
-
"fullName",
|
|
19
|
-
"phone",
|
|
20
|
-
"addressLine1",
|
|
21
|
-
"addressLine2",
|
|
22
|
-
"landmark",
|
|
23
|
-
"city",
|
|
24
|
-
"state",
|
|
25
|
-
"postalCode",
|
|
26
|
-
"country",
|
|
27
|
-
"isDefault",
|
|
28
|
-
"createdAt",
|
|
29
|
-
"updatedAt",
|
|
30
|
-
];
|
|
31
|
-
export const ADDRESS_UPDATABLE_FIELDS = [
|
|
32
|
-
"label",
|
|
33
|
-
"fullName",
|
|
34
|
-
"phone",
|
|
35
|
-
"addressLine1",
|
|
36
|
-
"addressLine2",
|
|
37
|
-
"landmark",
|
|
38
|
-
"city",
|
|
39
|
-
"state",
|
|
40
|
-
"postalCode",
|
|
41
|
-
"country",
|
|
42
|
-
"isDefault",
|
|
43
|
-
];
|
|
44
|
-
export const ADDRESS_FIELDS = {
|
|
45
|
-
ID: "id",
|
|
46
|
-
LABEL: "label",
|
|
47
|
-
FULL_NAME: "fullName",
|
|
48
|
-
PHONE: "phone",
|
|
49
|
-
ADDRESS_LINE_1: "addressLine1",
|
|
50
|
-
ADDRESS_LINE_2: "addressLine2",
|
|
51
|
-
LANDMARK: "landmark",
|
|
52
|
-
CITY: "city",
|
|
53
|
-
STATE: "state",
|
|
54
|
-
POSTAL_CODE: "postalCode",
|
|
55
|
-
COUNTRY: "country",
|
|
56
|
-
IS_DEFAULT: "isDefault",
|
|
57
|
-
CREATED_AT: "createdAt",
|
|
58
|
-
UPDATED_AT: "updatedAt",
|
|
59
|
-
};
|
|
@@ -43,14 +43,14 @@ export declare const notificationPreferencesSchema: z.ZodObject<{
|
|
|
43
43
|
}, "strip", z.ZodTypeAny, {
|
|
44
44
|
push?: boolean | undefined;
|
|
45
45
|
promotions?: boolean | undefined;
|
|
46
|
-
orderUpdates?: boolean | undefined;
|
|
47
46
|
newsletter?: boolean | undefined;
|
|
47
|
+
orderUpdates?: boolean | undefined;
|
|
48
48
|
sms?: boolean | undefined;
|
|
49
49
|
}, {
|
|
50
50
|
push?: boolean | undefined;
|
|
51
51
|
promotions?: boolean | undefined;
|
|
52
|
-
orderUpdates?: boolean | undefined;
|
|
53
52
|
newsletter?: boolean | undefined;
|
|
53
|
+
orderUpdates?: boolean | undefined;
|
|
54
54
|
sms?: boolean | undefined;
|
|
55
55
|
}>;
|
|
56
56
|
/**
|
|
@@ -114,14 +114,14 @@ export declare const userProfileSchema: z.ZodObject<{
|
|
|
114
114
|
}, "strip", z.ZodTypeAny, {
|
|
115
115
|
push?: boolean | undefined;
|
|
116
116
|
promotions?: boolean | undefined;
|
|
117
|
-
orderUpdates?: boolean | undefined;
|
|
118
117
|
newsletter?: boolean | undefined;
|
|
118
|
+
orderUpdates?: boolean | undefined;
|
|
119
119
|
sms?: boolean | undefined;
|
|
120
120
|
}, {
|
|
121
121
|
push?: boolean | undefined;
|
|
122
122
|
promotions?: boolean | undefined;
|
|
123
|
-
orderUpdates?: boolean | undefined;
|
|
124
123
|
newsletter?: boolean | undefined;
|
|
124
|
+
orderUpdates?: boolean | undefined;
|
|
125
125
|
sms?: boolean | undefined;
|
|
126
126
|
}>>;
|
|
127
127
|
createdAt: z.ZodOptional<z.ZodString>;
|
|
@@ -150,8 +150,8 @@ export declare const userProfileSchema: z.ZodObject<{
|
|
|
150
150
|
notificationPreferences?: {
|
|
151
151
|
push?: boolean | undefined;
|
|
152
152
|
promotions?: boolean | undefined;
|
|
153
|
-
orderUpdates?: boolean | undefined;
|
|
154
153
|
newsletter?: boolean | undefined;
|
|
154
|
+
orderUpdates?: boolean | undefined;
|
|
155
155
|
sms?: boolean | undefined;
|
|
156
156
|
} | undefined;
|
|
157
157
|
}, {
|
|
@@ -178,8 +178,8 @@ export declare const userProfileSchema: z.ZodObject<{
|
|
|
178
178
|
notificationPreferences?: {
|
|
179
179
|
push?: boolean | undefined;
|
|
180
180
|
promotions?: boolean | undefined;
|
|
181
|
-
orderUpdates?: boolean | undefined;
|
|
182
181
|
newsletter?: boolean | undefined;
|
|
182
|
+
orderUpdates?: boolean | undefined;
|
|
183
183
|
sms?: boolean | undefined;
|
|
184
184
|
} | undefined;
|
|
185
185
|
}>;
|
|
@@ -5,4 +5,6 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export * from "./actions";
|
|
7
7
|
export { AccountRepository } from "./repository/account.repository";
|
|
8
|
-
|
|
8
|
+
// SB-UNI-A 2026-05-13 — AddressRepository deleted. Use addressesRepository
|
|
9
|
+
// (top-level addresses collection with ownerType:"user").
|
|
10
|
+
export { AddressesRepository, addressesRepository, } from "../addresses";
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AddressesRepository — SB-UNI-A 2026-05-13
|
|
3
|
+
*
|
|
4
|
+
* Top-level `addresses` collection. Discriminator: `ownerType: "user"|"store"`.
|
|
5
|
+
* Replaces the two prior subcollection repositories.
|
|
6
|
+
*
|
|
7
|
+
* PII encryption: `fullName`, `phone`, `addressLine1` are routed through
|
|
8
|
+
* `encryptPiiFields` on every write path (createWithId, create, update) and
|
|
9
|
+
* decrypted in `mapDoc`. Pattern #9 (CLAUDE.md): never bypass repo hooks.
|
|
10
|
+
*/
|
|
11
|
+
import { BaseRepository, type DocumentSnapshot } from "../../../providers/db-firebase";
|
|
12
|
+
import { type AddressCreateInput, type AddressDocument, type AddressOwnerType, type AddressUpdateInput } from "../schemas";
|
|
13
|
+
export declare class AddressesRepository extends BaseRepository<AddressDocument> {
|
|
14
|
+
constructor();
|
|
15
|
+
private decryptAddress;
|
|
16
|
+
private encryptAddressData;
|
|
17
|
+
protected mapDoc<D = AddressDocument>(snap: DocumentSnapshot): D;
|
|
18
|
+
createWithId(id: string, data: Partial<AddressDocument>): Promise<AddressDocument>;
|
|
19
|
+
update(id: string, data: Partial<AddressDocument>): Promise<AddressDocument>;
|
|
20
|
+
listByOwner(ownerType: AddressOwnerType, ownerId: string): Promise<AddressDocument[]>;
|
|
21
|
+
countByOwner(ownerType: AddressOwnerType, ownerId: string): Promise<number>;
|
|
22
|
+
createForOwner(ownerType: AddressOwnerType, ownerId: string, input: AddressCreateInput): Promise<AddressDocument>;
|
|
23
|
+
updateForOwner(ownerType: AddressOwnerType, ownerId: string, addressId: string, input: AddressUpdateInput): Promise<AddressDocument>;
|
|
24
|
+
deleteForOwner(ownerType: AddressOwnerType, ownerId: string, addressId: string): Promise<void>;
|
|
25
|
+
setDefault(ownerType: AddressOwnerType, ownerId: string, addressId: string): Promise<AddressDocument>;
|
|
26
|
+
deleteAllForOwner(ownerType: AddressOwnerType, ownerId: string): Promise<number>;
|
|
27
|
+
private clearDefaultFlag;
|
|
28
|
+
}
|
|
29
|
+
export declare const addressesRepository: AddressesRepository;
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AddressesRepository — SB-UNI-A 2026-05-13
|
|
3
|
+
*
|
|
4
|
+
* Top-level `addresses` collection. Discriminator: `ownerType: "user"|"store"`.
|
|
5
|
+
* Replaces the two prior subcollection repositories.
|
|
6
|
+
*
|
|
7
|
+
* PII encryption: `fullName`, `phone`, `addressLine1` are routed through
|
|
8
|
+
* `encryptPiiFields` on every write path (createWithId, create, update) and
|
|
9
|
+
* decrypted in `mapDoc`. Pattern #9 (CLAUDE.md): never bypass repo hooks.
|
|
10
|
+
*/
|
|
11
|
+
import { DatabaseError } from "../../../errors";
|
|
12
|
+
import { serverLogger } from "../../../monitoring";
|
|
13
|
+
import { BaseRepository, getFirestoreCount, prepareForFirestore, } from "../../../providers/db-firebase";
|
|
14
|
+
import { ADDRESS_PII_FIELDS, decryptPiiFields, encryptPiiFields, } from "../../../security";
|
|
15
|
+
import { ADDRESS_FIELDS, ADDRESSES_COLLECTION, } from "../schemas";
|
|
16
|
+
export class AddressesRepository extends BaseRepository {
|
|
17
|
+
constructor() {
|
|
18
|
+
super(ADDRESSES_COLLECTION);
|
|
19
|
+
}
|
|
20
|
+
decryptAddress(doc) {
|
|
21
|
+
return decryptPiiFields(doc, [
|
|
22
|
+
...ADDRESS_PII_FIELDS,
|
|
23
|
+
]);
|
|
24
|
+
}
|
|
25
|
+
encryptAddressData(data) {
|
|
26
|
+
return encryptPiiFields(data, [...ADDRESS_PII_FIELDS]);
|
|
27
|
+
}
|
|
28
|
+
mapDoc(snap) {
|
|
29
|
+
const raw = super.mapDoc(snap);
|
|
30
|
+
return this.decryptAddress(raw);
|
|
31
|
+
}
|
|
32
|
+
async createWithId(id, data) {
|
|
33
|
+
const encrypted = this.encryptAddressData(data);
|
|
34
|
+
return super.createWithId(id, encrypted);
|
|
35
|
+
}
|
|
36
|
+
async update(id, data) {
|
|
37
|
+
const encrypted = this.encryptAddressData(data);
|
|
38
|
+
return super.update(id, encrypted);
|
|
39
|
+
}
|
|
40
|
+
async listByOwner(ownerType, ownerId) {
|
|
41
|
+
try {
|
|
42
|
+
const snapshot = await this.getCollection()
|
|
43
|
+
.where(ADDRESS_FIELDS.OWNER_TYPE, "==", ownerType)
|
|
44
|
+
.where(ADDRESS_FIELDS.OWNER_ID, "==", ownerId)
|
|
45
|
+
.orderBy(ADDRESS_FIELDS.CREATED_AT, "desc")
|
|
46
|
+
.get();
|
|
47
|
+
return snapshot.docs.map((doc) => this.mapDoc(doc));
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
throw new DatabaseError(`Failed to list addresses for ${ownerType}:${ownerId}`, error);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
async countByOwner(ownerType, ownerId) {
|
|
54
|
+
try {
|
|
55
|
+
return await getFirestoreCount(this.getCollection()
|
|
56
|
+
.where(ADDRESS_FIELDS.OWNER_TYPE, "==", ownerType)
|
|
57
|
+
.where(ADDRESS_FIELDS.OWNER_ID, "==", ownerId));
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
throw new DatabaseError(`Failed to count addresses for ${ownerType}:${ownerId}`, error);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
async createForOwner(ownerType, ownerId, input) {
|
|
64
|
+
try {
|
|
65
|
+
if (input.isDefault) {
|
|
66
|
+
await this.clearDefaultFlag(ownerType, ownerId);
|
|
67
|
+
}
|
|
68
|
+
const now = new Date();
|
|
69
|
+
const docRef = this.getCollection().doc();
|
|
70
|
+
const addressData = {
|
|
71
|
+
...input,
|
|
72
|
+
ownerType,
|
|
73
|
+
ownerId,
|
|
74
|
+
createdAt: now,
|
|
75
|
+
updatedAt: now,
|
|
76
|
+
};
|
|
77
|
+
const encrypted = this.encryptAddressData(addressData);
|
|
78
|
+
await docRef.set(prepareForFirestore(encrypted));
|
|
79
|
+
serverLogger.info("Address created", {
|
|
80
|
+
ownerType,
|
|
81
|
+
ownerId,
|
|
82
|
+
addressId: docRef.id,
|
|
83
|
+
label: input.label,
|
|
84
|
+
});
|
|
85
|
+
return { id: docRef.id, ...addressData };
|
|
86
|
+
}
|
|
87
|
+
catch (error) {
|
|
88
|
+
throw new DatabaseError(`Failed to create address for ${ownerType}:${ownerId}`, error);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
async updateForOwner(ownerType, ownerId, addressId, input) {
|
|
92
|
+
const existing = await this.findById(addressId);
|
|
93
|
+
if (!existing || existing.ownerType !== ownerType || existing.ownerId !== ownerId) {
|
|
94
|
+
throw new DatabaseError(`Address not found for ${ownerType}:${ownerId}: ${addressId}`);
|
|
95
|
+
}
|
|
96
|
+
if (input.isDefault) {
|
|
97
|
+
await this.clearDefaultFlag(ownerType, ownerId);
|
|
98
|
+
}
|
|
99
|
+
return this.update(addressId, input);
|
|
100
|
+
}
|
|
101
|
+
async deleteForOwner(ownerType, ownerId, addressId) {
|
|
102
|
+
const existing = await this.findById(addressId);
|
|
103
|
+
if (!existing || existing.ownerType !== ownerType || existing.ownerId !== ownerId) {
|
|
104
|
+
throw new DatabaseError(`Address not found for ${ownerType}:${ownerId}: ${addressId}`);
|
|
105
|
+
}
|
|
106
|
+
await this.delete(addressId);
|
|
107
|
+
serverLogger.info("Address deleted", { ownerType, ownerId, addressId });
|
|
108
|
+
}
|
|
109
|
+
async setDefault(ownerType, ownerId, addressId) {
|
|
110
|
+
const existing = await this.findById(addressId);
|
|
111
|
+
if (!existing || existing.ownerType !== ownerType || existing.ownerId !== ownerId) {
|
|
112
|
+
throw new DatabaseError(`Address not found for ${ownerType}:${ownerId}: ${addressId}`);
|
|
113
|
+
}
|
|
114
|
+
await this.clearDefaultFlag(ownerType, ownerId);
|
|
115
|
+
return this.update(addressId, { isDefault: true });
|
|
116
|
+
}
|
|
117
|
+
async deleteAllForOwner(ownerType, ownerId) {
|
|
118
|
+
try {
|
|
119
|
+
const snapshot = await this.getCollection()
|
|
120
|
+
.where(ADDRESS_FIELDS.OWNER_TYPE, "==", ownerType)
|
|
121
|
+
.where(ADDRESS_FIELDS.OWNER_ID, "==", ownerId)
|
|
122
|
+
.get();
|
|
123
|
+
if (snapshot.empty)
|
|
124
|
+
return 0;
|
|
125
|
+
const batch = this.db.batch();
|
|
126
|
+
snapshot.docs.forEach((doc) => batch.delete(doc.ref));
|
|
127
|
+
await batch.commit();
|
|
128
|
+
return snapshot.size;
|
|
129
|
+
}
|
|
130
|
+
catch (error) {
|
|
131
|
+
throw new DatabaseError(`Failed to delete all addresses for ${ownerType}:${ownerId}`, error);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
async clearDefaultFlag(ownerType, ownerId) {
|
|
135
|
+
try {
|
|
136
|
+
const snapshot = await this.getCollection()
|
|
137
|
+
.where(ADDRESS_FIELDS.OWNER_TYPE, "==", ownerType)
|
|
138
|
+
.where(ADDRESS_FIELDS.OWNER_ID, "==", ownerId)
|
|
139
|
+
.where(ADDRESS_FIELDS.IS_DEFAULT, "==", true)
|
|
140
|
+
.get();
|
|
141
|
+
if (snapshot.empty)
|
|
142
|
+
return;
|
|
143
|
+
const batch = this.db.batch();
|
|
144
|
+
snapshot.docs.forEach((doc) => {
|
|
145
|
+
batch.update(doc.ref, {
|
|
146
|
+
[ADDRESS_FIELDS.IS_DEFAULT]: false,
|
|
147
|
+
[ADDRESS_FIELDS.UPDATED_AT]: new Date(),
|
|
148
|
+
});
|
|
149
|
+
});
|
|
150
|
+
await batch.commit();
|
|
151
|
+
}
|
|
152
|
+
catch (error) {
|
|
153
|
+
throw new DatabaseError(`Failed to clear default flag for ${ownerType}:${ownerId}`, error);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
export const addressesRepository = new AddressesRepository();
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Addresses Firestore Document Types & Constants — SB-UNI-A 2026-05-13
|
|
3
|
+
*
|
|
4
|
+
* Unified top-level `addresses` collection replacing the two subcollections
|
|
5
|
+
* `users/{uid}/addresses` and `stores/{slug}/addresses`. Discriminated by
|
|
6
|
+
* `ownerType: "user" | "store"`. PII fields (fullName, phone, addressLine1)
|
|
7
|
+
* are encrypted at rest via the existing `encryptPiiFields` pipeline; the
|
|
8
|
+
* repository overrides `createWithId` and `create` to inject encryption.
|
|
9
|
+
*/
|
|
10
|
+
export type AddressOwnerType = "user" | "store";
|
|
11
|
+
export interface AddressDocument {
|
|
12
|
+
id: string;
|
|
13
|
+
ownerType: AddressOwnerType;
|
|
14
|
+
ownerId: string;
|
|
15
|
+
label: string;
|
|
16
|
+
fullName: string;
|
|
17
|
+
phone: string;
|
|
18
|
+
addressLine1: string;
|
|
19
|
+
addressLine2?: string;
|
|
20
|
+
landmark?: string;
|
|
21
|
+
city: string;
|
|
22
|
+
state: string;
|
|
23
|
+
postalCode: string;
|
|
24
|
+
country: string;
|
|
25
|
+
isDefault: boolean;
|
|
26
|
+
createdAt: Date;
|
|
27
|
+
updatedAt: Date;
|
|
28
|
+
}
|
|
29
|
+
export declare const ADDRESSES_COLLECTION: "addresses";
|
|
30
|
+
export declare const ADDRESS_INDEXED_FIELDS: readonly ["ownerType", "ownerId", "isDefault", "createdAt"];
|
|
31
|
+
export declare const DEFAULT_ADDRESS_DATA: Partial<AddressDocument>;
|
|
32
|
+
export declare const ADDRESS_PUBLIC_FIELDS: readonly ["id", "ownerType", "ownerId", "label", "fullName", "phone", "addressLine1", "addressLine2", "landmark", "city", "state", "postalCode", "country", "isDefault", "createdAt", "updatedAt"];
|
|
33
|
+
export declare const ADDRESS_UPDATABLE_FIELDS: readonly ["label", "fullName", "phone", "addressLine1", "addressLine2", "landmark", "city", "state", "postalCode", "country", "isDefault"];
|
|
34
|
+
export type AddressCreateInput = Omit<AddressDocument, "id" | "ownerType" | "ownerId" | "createdAt" | "updatedAt">;
|
|
35
|
+
export type AddressUpdateInput = Partial<Pick<AddressDocument, (typeof ADDRESS_UPDATABLE_FIELDS)[number]>>;
|
|
36
|
+
export declare const ADDRESS_FIELDS: {
|
|
37
|
+
readonly ID: "id";
|
|
38
|
+
readonly OWNER_TYPE: "ownerType";
|
|
39
|
+
readonly OWNER_ID: "ownerId";
|
|
40
|
+
readonly LABEL: "label";
|
|
41
|
+
readonly FULL_NAME: "fullName";
|
|
42
|
+
readonly PHONE: "phone";
|
|
43
|
+
readonly ADDRESS_LINE_1: "addressLine1";
|
|
44
|
+
readonly ADDRESS_LINE_2: "addressLine2";
|
|
45
|
+
readonly LANDMARK: "landmark";
|
|
46
|
+
readonly CITY: "city";
|
|
47
|
+
readonly STATE: "state";
|
|
48
|
+
readonly POSTAL_CODE: "postalCode";
|
|
49
|
+
readonly COUNTRY: "country";
|
|
50
|
+
readonly IS_DEFAULT: "isDefault";
|
|
51
|
+
readonly CREATED_AT: "createdAt";
|
|
52
|
+
readonly UPDATED_AT: "updatedAt";
|
|
53
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Addresses Firestore Document Types & Constants — SB-UNI-A 2026-05-13
|
|
3
|
+
*
|
|
4
|
+
* Unified top-level `addresses` collection replacing the two subcollections
|
|
5
|
+
* `users/{uid}/addresses` and `stores/{slug}/addresses`. Discriminated by
|
|
6
|
+
* `ownerType: "user" | "store"`. PII fields (fullName, phone, addressLine1)
|
|
7
|
+
* are encrypted at rest via the existing `encryptPiiFields` pipeline; the
|
|
8
|
+
* repository overrides `createWithId` and `create` to inject encryption.
|
|
9
|
+
*/
|
|
10
|
+
export const ADDRESSES_COLLECTION = "addresses";
|
|
11
|
+
export const ADDRESS_INDEXED_FIELDS = [
|
|
12
|
+
"ownerType",
|
|
13
|
+
"ownerId",
|
|
14
|
+
"isDefault",
|
|
15
|
+
"createdAt",
|
|
16
|
+
];
|
|
17
|
+
export const DEFAULT_ADDRESS_DATA = {
|
|
18
|
+
isDefault: false,
|
|
19
|
+
};
|
|
20
|
+
export const ADDRESS_PUBLIC_FIELDS = [
|
|
21
|
+
"id",
|
|
22
|
+
"ownerType",
|
|
23
|
+
"ownerId",
|
|
24
|
+
"label",
|
|
25
|
+
"fullName",
|
|
26
|
+
"phone",
|
|
27
|
+
"addressLine1",
|
|
28
|
+
"addressLine2",
|
|
29
|
+
"landmark",
|
|
30
|
+
"city",
|
|
31
|
+
"state",
|
|
32
|
+
"postalCode",
|
|
33
|
+
"country",
|
|
34
|
+
"isDefault",
|
|
35
|
+
"createdAt",
|
|
36
|
+
"updatedAt",
|
|
37
|
+
];
|
|
38
|
+
export const ADDRESS_UPDATABLE_FIELDS = [
|
|
39
|
+
"label",
|
|
40
|
+
"fullName",
|
|
41
|
+
"phone",
|
|
42
|
+
"addressLine1",
|
|
43
|
+
"addressLine2",
|
|
44
|
+
"landmark",
|
|
45
|
+
"city",
|
|
46
|
+
"state",
|
|
47
|
+
"postalCode",
|
|
48
|
+
"country",
|
|
49
|
+
"isDefault",
|
|
50
|
+
];
|
|
51
|
+
export const ADDRESS_FIELDS = {
|
|
52
|
+
ID: "id",
|
|
53
|
+
OWNER_TYPE: "ownerType",
|
|
54
|
+
OWNER_ID: "ownerId",
|
|
55
|
+
LABEL: "label",
|
|
56
|
+
FULL_NAME: "fullName",
|
|
57
|
+
PHONE: "phone",
|
|
58
|
+
ADDRESS_LINE_1: "addressLine1",
|
|
59
|
+
ADDRESS_LINE_2: "addressLine2",
|
|
60
|
+
LANDMARK: "landmark",
|
|
61
|
+
CITY: "city",
|
|
62
|
+
STATE: "state",
|
|
63
|
+
POSTAL_CODE: "postalCode",
|
|
64
|
+
COUNTRY: "country",
|
|
65
|
+
IS_DEFAULT: "isDefault",
|
|
66
|
+
CREATED_AT: "createdAt",
|
|
67
|
+
UPDATED_AT: "updatedAt",
|
|
68
|
+
};
|
|
@@ -4,8 +4,9 @@ import React, { useState, useCallback } from "react";
|
|
|
4
4
|
import { X } from "lucide-react";
|
|
5
5
|
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
6
6
|
import { useUrlTable } from "../../../react/hooks/useUrlTable";
|
|
7
|
-
import { ListingToolbar, Pagination, ListingViewShell, RowActionMenu, useToast } from "../../../ui";
|
|
7
|
+
import { FilterChipGroup, ListingToolbar, Pagination, ListingViewShell, RowActionMenu, useToast } from "../../../ui";
|
|
8
8
|
import { ADMIN_ENDPOINTS } from "../../../constants/api-endpoints";
|
|
9
|
+
import { ADMIN_EVENT_ENTRY_STATUS_TABS } from "../constants/filter-tabs";
|
|
9
10
|
import { toRecordArray, toRelativeDate, toStringValue, useAdminListingData, } from "../hooks/useAdminListingData";
|
|
10
11
|
import { DataTable } from "./DataTable";
|
|
11
12
|
import { apiClient } from "../../../http";
|
|
@@ -16,7 +17,7 @@ const SORT_OPTIONS = [
|
|
|
16
17
|
{ value: "-submittedAt", label: "Newest" },
|
|
17
18
|
{ value: "submittedAt", label: "Oldest" },
|
|
18
19
|
];
|
|
19
|
-
const STATUS_OPTIONS =
|
|
20
|
+
const STATUS_OPTIONS = ADMIN_EVENT_ENTRY_STATUS_TABS;
|
|
20
21
|
export function AdminAllEventEntriesView({ children, ...props }) {
|
|
21
22
|
const hasChildren = React.Children.count(children) > 0;
|
|
22
23
|
const queryClient = useQueryClient();
|
|
@@ -98,5 +99,5 @@ export function AdminAllEventEntriesView({ children, ...props }) {
|
|
|
98
99
|
{ label: "Waitlist", onClick: () => updateMutation.mutate({ id: er.id, status: "WAITLISTED" }) },
|
|
99
100
|
{ label: "Cancel", destructive: true, onClick: () => updateMutation.mutate({ id: er.id, status: "CANCELLED" }) },
|
|
100
101
|
] }));
|
|
101
|
-
} })] }), filterOpen && (_jsxs(_Fragment, { children: [_jsx("div", { className: "fixed inset-0 z-40 bg-black/40", "aria-hidden": "true", onClick: () => setFilterOpen(false) }), _jsxs("div", { className: "fixed inset-y-0 left-0 z-50 flex w-80 flex-col bg-white dark:bg-slate-900 shadow-2xl", children: [_jsxs("div", { className: "flex items-center justify-between border-b border-zinc-200 dark:border-slate-700 px-4 py-3.5", children: [_jsx("span", { className: "text-base font-semibold text-zinc-900 dark:text-zinc-100", children: "Filters" }), _jsxs("div", { className: "flex items-center gap-2", children: [activeFilterCount > 0 && (_jsx("button", { type: "button", onClick: clearFilters, className: "text-xs text-zinc-500 hover:text-rose-500 dark:text-zinc-400 transition-colors", children: "Clear all" })), _jsx("button", { type: "button", onClick: () => setFilterOpen(false), "aria-label": "Close", className: "rounded-lg p-1.5 text-zinc-500 hover:bg-zinc-100 dark:hover:bg-slate-800 transition-colors", children: _jsx(X, { className: "h-5 w-5" }) })] })] }), _jsx("div", { className: "flex-1 overflow-y-auto px-4 py-4 space-y-5", children:
|
|
102
|
+
} })] }), filterOpen && (_jsxs(_Fragment, { children: [_jsx("div", { className: "fixed inset-0 z-40 bg-black/40", "aria-hidden": "true", onClick: () => setFilterOpen(false) }), _jsxs("div", { className: "fixed inset-y-0 left-0 z-50 flex w-80 flex-col bg-white dark:bg-slate-900 shadow-2xl", children: [_jsxs("div", { className: "flex items-center justify-between border-b border-zinc-200 dark:border-slate-700 px-4 py-3.5", children: [_jsx("span", { className: "text-base font-semibold text-zinc-900 dark:text-zinc-100", children: "Filters" }), _jsxs("div", { className: "flex items-center gap-2", children: [activeFilterCount > 0 && (_jsx("button", { type: "button", onClick: clearFilters, className: "text-xs text-zinc-500 hover:text-rose-500 dark:text-zinc-400 transition-colors", children: "Clear all" })), _jsx("button", { type: "button", onClick: () => setFilterOpen(false), "aria-label": "Close", className: "rounded-lg p-1.5 text-zinc-500 hover:bg-zinc-100 dark:hover:bg-slate-800 transition-colors", children: _jsx(X, { className: "h-5 w-5" }) })] })] }), _jsx("div", { className: "flex-1 overflow-y-auto px-4 py-4 space-y-5", children: _jsx(FilterChipGroup, { label: "Status", tabs: STATUS_OPTIONS, value: pendingFilters.status ?? "", onChange: (id) => setPendingFilters((p) => ({ ...p, status: id })) }) }), _jsx("div", { className: "border-t border-zinc-200 dark:border-slate-700 px-4 py-3.5", children: _jsxs("button", { type: "button", onClick: applyFilters, className: "w-full rounded-lg bg-primary py-2.5 text-sm font-semibold text-white hover:bg-primary-600 transition-colors active:scale-[0.98]", children: ["Apply Filters", activeFilterCount > 0 ? ` (${activeFilterCount})` : ""] }) })] })] }))] }));
|
|
102
103
|
}
|
|
@@ -4,8 +4,9 @@ import React, { useState, useCallback } from "react";
|
|
|
4
4
|
import { X } from "lucide-react";
|
|
5
5
|
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
6
6
|
import { useUrlTable } from "../../../react/hooks/useUrlTable";
|
|
7
|
-
import { ListingToolbar, Pagination, ListingViewShell, ConfirmDeleteModal, RowActionMenu, useToast } from "../../../ui";
|
|
7
|
+
import { FilterChipGroup, ListingToolbar, Pagination, ListingViewShell, ConfirmDeleteModal, RowActionMenu, useToast } from "../../../ui";
|
|
8
8
|
import { ADMIN_ENDPOINTS } from "../../../constants/api-endpoints";
|
|
9
|
+
import { ADMIN_BID_STATUS_TABS } from "../constants/filter-tabs";
|
|
9
10
|
import { toRecordArray, toRelativeDate, toRupees, toStringValue, useAdminListingData, } from "../hooks/useAdminListingData";
|
|
10
11
|
import { DataTable } from "./DataTable";
|
|
11
12
|
import { apiClient } from "../../../http";
|
|
@@ -17,7 +18,7 @@ const SORT_OPTIONS = [
|
|
|
17
18
|
{ value: "bidTime", label: "Oldest" },
|
|
18
19
|
{ value: "-amount", label: "Highest amount" },
|
|
19
20
|
];
|
|
20
|
-
const STATUS_OPTIONS =
|
|
21
|
+
const STATUS_OPTIONS = ADMIN_BID_STATUS_TABS;
|
|
21
22
|
export function AdminBidsView({ children, ...props }) {
|
|
22
23
|
const hasChildren = React.Children.count(children) > 0;
|
|
23
24
|
const queryClient = useQueryClient();
|
|
@@ -110,6 +111,6 @@ export function AdminBidsView({ children, ...props }) {
|
|
|
110
111
|
},
|
|
111
112
|
},
|
|
112
113
|
] }));
|
|
113
|
-
} })] }), filterOpen && (_jsxs(_Fragment, { children: [_jsx("div", { className: "fixed inset-0 z-40 bg-black/40", "aria-hidden": "true", onClick: () => setFilterOpen(false) }), _jsxs("div", { className: "fixed inset-y-0 left-0 z-50 flex w-80 flex-col bg-white dark:bg-slate-900 shadow-2xl", children: [_jsxs("div", { className: "flex items-center justify-between border-b border-zinc-200 dark:border-slate-700 px-4 py-3.5", children: [_jsx("span", { className: "text-base font-semibold text-zinc-900 dark:text-zinc-100", children: "Filters" }), _jsxs("div", { className: "flex items-center gap-2", children: [activeFilterCount > 0 && (_jsx("button", { type: "button", onClick: clearFilters, className: "text-xs text-zinc-500 hover:text-rose-500 dark:text-zinc-400 transition-colors", children: "Clear all" })), _jsx("button", { type: "button", onClick: () => setFilterOpen(false), "aria-label": "Close", className: "rounded-lg p-1.5 text-zinc-500 hover:bg-zinc-100 dark:hover:bg-slate-800 transition-colors", children: _jsx(X, { className: "h-5 w-5" }) })] })] }), _jsx("div", { className: "flex-1 overflow-y-auto px-4 py-4 space-y-5", children:
|
|
114
|
+
} })] }), filterOpen && (_jsxs(_Fragment, { children: [_jsx("div", { className: "fixed inset-0 z-40 bg-black/40", "aria-hidden": "true", onClick: () => setFilterOpen(false) }), _jsxs("div", { className: "fixed inset-y-0 left-0 z-50 flex w-80 flex-col bg-white dark:bg-slate-900 shadow-2xl", children: [_jsxs("div", { className: "flex items-center justify-between border-b border-zinc-200 dark:border-slate-700 px-4 py-3.5", children: [_jsx("span", { className: "text-base font-semibold text-zinc-900 dark:text-zinc-100", children: "Filters" }), _jsxs("div", { className: "flex items-center gap-2", children: [activeFilterCount > 0 && (_jsx("button", { type: "button", onClick: clearFilters, className: "text-xs text-zinc-500 hover:text-rose-500 dark:text-zinc-400 transition-colors", children: "Clear all" })), _jsx("button", { type: "button", onClick: () => setFilterOpen(false), "aria-label": "Close", className: "rounded-lg p-1.5 text-zinc-500 hover:bg-zinc-100 dark:hover:bg-slate-800 transition-colors", children: _jsx(X, { className: "h-5 w-5" }) })] })] }), _jsx("div", { className: "flex-1 overflow-y-auto px-4 py-4 space-y-5", children: _jsx(FilterChipGroup, { label: "Status", tabs: STATUS_OPTIONS, value: pendingFilters.status ?? "", onChange: (id) => setPendingFilters((p) => ({ ...p, status: id })) }) }), _jsx("div", { className: "border-t border-zinc-200 dark:border-slate-700 px-4 py-3.5", children: _jsxs("button", { type: "button", onClick: applyFilters, className: "w-full rounded-lg bg-primary py-2.5 text-sm font-semibold text-white hover:bg-primary-600 transition-colors active:scale-[0.98]", children: ["Apply Filters", activeFilterCount > 0 ? ` (${activeFilterCount})` : ""] }) })] })] }))] }), _jsx(ConfirmDeleteModal, { isOpen: cancelOpen, onClose: () => { setCancelOpen(false); setSelectedRow(null); }, onConfirm: () => { if (selectedRow)
|
|
114
115
|
cancelMutation.mutate(selectedRow.id); }, isDeleting: cancelMutation.isPending, title: "Cancel this bid?", message: "This will mark the bid as cancelled and notify the bidder. The auction will continue with remaining active bids.", confirmText: "Cancel bid", variant: "warning" })] }));
|
|
115
116
|
}
|