@mohasinac/appkit 2.1.1 → 2.2.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/README.md +36 -65
- package/dist/cli/index.d.ts +6 -9
- package/dist/cli/index.js +167 -141
- package/dist/client.d.ts +15 -0
- package/dist/client.js +15 -0
- package/dist/constants/api-endpoint-resolver.d.ts +34 -0
- package/dist/constants/api-endpoint-resolver.js +38 -0
- package/dist/constants/api-endpoints.d.ts +388 -0
- package/dist/constants/api-endpoints.js +342 -0
- package/dist/constants/cache-invalidation.d.ts +18 -0
- package/dist/constants/cache-invalidation.js +33 -0
- package/dist/constants/index.d.ts +14 -0
- package/dist/constants/index.js +14 -0
- package/dist/contracts/auth.d.ts +58 -0
- package/dist/contracts/auth.js +2 -0
- package/dist/contracts/client-auth.d.ts +22 -0
- package/dist/contracts/client-auth.js +17 -0
- package/dist/contracts/client-payment-gateway.d.ts +65 -0
- package/dist/contracts/client-payment-gateway.js +25 -0
- package/dist/contracts/client-realtime.d.ts +24 -0
- package/dist/contracts/client-realtime.js +18 -0
- package/dist/contracts/client-session.d.ts +37 -0
- package/dist/contracts/client-session.js +22 -0
- package/dist/contracts/config.d.ts +53 -0
- package/dist/contracts/config.js +2 -0
- package/dist/contracts/email.d.ts +30 -0
- package/dist/contracts/email.js +2 -0
- package/dist/contracts/extend.d.ts +270 -0
- package/dist/contracts/extend.js +75 -0
- package/dist/contracts/feature.d.ts +53 -0
- package/dist/contracts/feature.js +2 -0
- package/dist/contracts/field-ops.d.ts +31 -0
- package/dist/contracts/field-ops.js +35 -0
- package/dist/contracts/form.d.ts +89 -0
- package/dist/contracts/form.js +80 -0
- package/dist/contracts/index.d.ts +32 -728
- package/dist/contracts/index.js +13 -4
- package/dist/contracts/infra.d.ts +43 -0
- package/dist/contracts/infra.js +2 -0
- package/dist/contracts/payment.d.ts +39 -0
- package/dist/contracts/payment.js +2 -0
- package/dist/contracts/registry.d.ts +26 -0
- package/dist/contracts/registry.js +14 -0
- package/dist/contracts/repository.d.ts +127 -0
- package/dist/contracts/repository.js +28 -0
- package/dist/contracts/search.d.ts +44 -0
- package/dist/contracts/search.js +2 -0
- package/dist/contracts/shipping.d.ts +64 -0
- package/dist/contracts/shipping.js +2 -0
- package/dist/contracts/storage.d.ts +27 -0
- package/dist/contracts/storage.js +2 -0
- package/dist/contracts/style.d.ts +23 -0
- package/dist/contracts/style.js +2 -0
- package/dist/contracts/table.d.ts +104 -0
- package/dist/contracts/table.js +68 -0
- package/dist/core/CacheManager.d.ts +31 -0
- package/dist/core/CacheManager.js +63 -0
- package/dist/core/EventBus.d.ts +27 -0
- package/dist/core/EventBus.js +75 -0
- package/dist/core/Logger.d.ts +60 -0
- package/dist/core/Logger.js +153 -0
- package/dist/core/Queue.d.ts +43 -0
- package/dist/core/Queue.js +92 -0
- package/dist/core/StorageManager.d.ts +36 -0
- package/dist/core/StorageManager.js +159 -0
- package/dist/core/baseline-resolver.d.ts +52 -0
- package/dist/core/baseline-resolver.js +74 -0
- package/dist/core/browser.d.ts +18 -0
- package/dist/core/browser.js +9 -0
- package/dist/core/copilot-log.repository.d.ts +44 -0
- package/dist/core/copilot-log.repository.js +61 -0
- package/dist/core/hooks/useSiteSettings.d.ts +1 -0
- package/dist/core/hooks/useSiteSettings.js +11 -0
- package/dist/core/index.d.ts +31 -326
- package/dist/core/index.js +21 -7
- package/dist/core/integration-keys.d.ts +30 -0
- package/dist/core/integration-keys.js +55 -0
- package/dist/core/mutation-events.d.ts +147 -0
- package/dist/core/mutation-events.js +193 -0
- package/dist/core/newsletter-actions.d.ts +20 -0
- package/dist/core/newsletter-actions.js +28 -0
- package/dist/core/newsletter.repository.d.ts +55 -0
- package/dist/core/newsletter.repository.js +109 -0
- package/dist/core/server-action.d.ts +114 -0
- package/dist/core/server-action.js +119 -0
- package/dist/core/site-config.d.ts +33 -0
- package/dist/core/site-config.js +74 -0
- package/dist/core/unit-of-work.d.ts +32 -0
- package/dist/core/unit-of-work.js +114 -0
- package/dist/errors/api-error.d.ts +4 -0
- package/dist/errors/api-error.js +6 -0
- package/dist/errors/authentication-error.d.ts +4 -0
- package/dist/errors/authentication-error.js +6 -0
- package/dist/errors/authorization-error.d.ts +4 -0
- package/dist/errors/authorization-error.js +6 -0
- package/dist/errors/base-error.d.ts +14 -0
- package/dist/errors/base-error.js +22 -0
- package/dist/errors/database-error.d.ts +4 -0
- package/dist/errors/database-error.js +6 -0
- package/dist/errors/error-codes.d.ts +43 -0
- package/dist/errors/error-codes.js +93 -0
- package/dist/errors/error-handler.d.ts +16 -0
- package/dist/errors/error-handler.js +57 -0
- package/dist/errors/index.d.ts +11 -96
- package/dist/errors/index.js +15 -4
- package/dist/errors/messages.d.ts +469 -0
- package/dist/errors/messages.js +503 -0
- package/dist/errors/not-found-error.d.ts +4 -0
- package/dist/errors/not-found-error.js +6 -0
- package/dist/errors/validation-error.d.ts +4 -0
- package/dist/errors/validation-error.js +6 -0
- package/dist/features/about/components/AboutView.d.ts +38 -0
- package/dist/features/about/components/AboutView.js +5 -0
- package/dist/features/about/index.d.ts +2 -42
- package/dist/features/about/index.js +1 -280
- package/dist/features/account/actions/address-actions.d.ts +7 -0
- package/dist/features/account/actions/address-actions.js +24 -0
- package/dist/features/account/actions/index.d.ts +1 -0
- package/dist/features/account/actions/index.js +1 -0
- package/dist/features/account/address-validation.d.ts +20 -0
- package/dist/features/account/address-validation.js +35 -0
- package/dist/features/account/api/[userId]/addresses/route.d.ts +21 -0
- package/dist/features/account/api/[userId]/addresses/route.js +91 -0
- package/dist/features/account/api/[userId]/route.d.ts +23 -0
- package/dist/features/account/api/[userId]/route.js +67 -0
- package/dist/features/account/columns/index.d.ts +17 -0
- package/dist/features/account/columns/index.js +39 -0
- package/dist/features/account/components/AddressBook.d.ts +39 -0
- package/dist/features/account/components/AddressBook.js +14 -0
- package/dist/features/account/components/AddressForm.d.ts +39 -0
- package/dist/features/account/components/AddressForm.js +55 -0
- package/dist/features/account/components/AddressSelectorCreate.d.ts +16 -0
- package/dist/features/account/components/AddressSelectorCreate.js +40 -0
- package/dist/features/account/components/BecomeSellerView.d.ts +17 -0
- package/dist/features/account/components/BecomeSellerView.js +5 -0
- package/dist/features/account/components/ChatList.d.ts +14 -0
- package/dist/features/account/components/ChatList.js +10 -0
- package/dist/features/account/components/ChatWindow.d.ts +17 -0
- package/dist/features/account/components/ChatWindow.js +6 -0
- package/dist/features/account/components/MessagesView.d.ts +16 -0
- package/dist/features/account/components/MessagesView.js +5 -0
- package/dist/features/account/components/NotificationBell.d.ts +32 -0
- package/dist/features/account/components/NotificationBell.js +80 -0
- package/dist/features/account/components/OrderDetailView.d.ts +18 -0
- package/dist/features/account/components/OrderDetailView.js +12 -0
- package/dist/features/account/components/ProfileView.d.ts +12 -0
- package/dist/features/account/components/ProfileView.js +5 -0
- package/dist/features/account/components/UserAccountHubView.d.ts +13 -0
- package/dist/features/account/components/UserAccountHubView.js +5 -0
- package/dist/features/account/components/UserAddressesView.d.ts +13 -0
- package/dist/features/account/components/UserAddressesView.js +5 -0
- package/dist/features/account/components/UserNotificationsView.d.ts +15 -0
- package/dist/features/account/components/UserNotificationsView.js +12 -0
- package/dist/features/account/components/UserOffersView.d.ts +10 -0
- package/dist/features/account/components/UserOffersView.js +5 -0
- package/dist/features/account/components/UserOrderTrackView.d.ts +16 -0
- package/dist/features/account/components/UserOrderTrackView.js +8 -0
- package/dist/features/account/components/UserOrdersView.d.ts +12 -0
- package/dist/features/account/components/UserOrdersView.js +5 -0
- package/dist/features/account/components/UserSettingsView.d.ts +15 -0
- package/dist/features/account/components/UserSettingsView.js +12 -0
- package/dist/features/account/components/index.d.ts +34 -0
- package/dist/features/account/components/index.js +17 -0
- package/dist/features/account/constants/addresses.d.ts +13 -0
- package/dist/features/account/constants/addresses.js +43 -0
- package/dist/features/account/hooks/useAccount.d.ts +13 -0
- package/dist/features/account/hooks/useAccount.js +19 -0
- package/dist/features/account/hooks/useAddressForm.d.ts +24 -0
- package/dist/features/account/hooks/useAddressForm.js +58 -0
- package/dist/features/account/hooks/useAddressSelector.d.ts +25 -0
- package/dist/features/account/hooks/useAddressSelector.js +30 -0
- package/dist/features/account/hooks/useAddresses.d.ts +59 -0
- package/dist/features/account/hooks/useAddresses.js +73 -0
- package/dist/features/account/hooks/useNotifications.d.ts +23 -0
- package/dist/features/account/hooks/useNotifications.js +31 -0
- package/dist/features/account/hooks/useProfile.d.ts +25 -0
- package/dist/features/account/hooks/useProfile.js +24 -0
- package/dist/features/account/hooks/useProfileStats.d.ts +6 -0
- package/dist/features/account/hooks/useProfileStats.js +21 -0
- package/dist/features/account/hooks/usePublicProfile.d.ts +78 -0
- package/dist/features/account/hooks/usePublicProfile.js +51 -0
- package/dist/features/account/index.d.ts +15 -555
- package/dist/features/account/index.js +15 -1003
- package/dist/features/account/manifest.d.ts +2 -0
- package/dist/features/account/manifest.js +27 -0
- package/dist/features/account/messages/en.json +12 -0
- package/dist/features/account/repository/account.repository.d.ts +11 -0
- package/dist/features/account/repository/account.repository.js +20 -0
- package/dist/features/account/repository/address.repository.d.ts +17 -0
- package/dist/features/account/repository/address.repository.js +185 -0
- package/dist/features/account/schemas/firestore.d.ts +48 -0
- package/dist/features/account/schemas/firestore.js +59 -0
- package/dist/features/account/schemas/index.d.ts +198 -0
- package/dist/features/account/schemas/index.js +51 -0
- package/dist/features/account/server.d.ts +9 -0
- package/dist/features/account/server.js +9 -0
- package/dist/features/account/types/index.d.ts +83 -0
- package/dist/features/account/types/index.js +2 -0
- package/dist/features/admin/actions/admin-actions.d.ts +35 -0
- package/dist/features/admin/actions/admin-actions.js +174 -0
- package/dist/features/admin/actions/admin-coupon-actions.d.ts +17 -0
- package/dist/features/admin/actions/admin-coupon-actions.js +87 -0
- package/dist/features/admin/actions/admin-read-actions.d.ts +105 -0
- package/dist/features/admin/actions/admin-read-actions.js +172 -0
- package/dist/features/admin/actions/chat-actions.d.ts +29 -0
- package/dist/features/admin/actions/chat-actions.js +97 -0
- package/dist/features/admin/actions/index.d.ts +6 -0
- package/dist/features/admin/actions/index.js +6 -0
- package/dist/features/admin/actions/notification-actions.d.ts +31 -0
- package/dist/features/admin/actions/notification-actions.js +42 -0
- package/dist/features/admin/actions/site-settings-actions.d.ts +8 -0
- package/dist/features/admin/actions/site-settings-actions.js +16 -0
- package/dist/features/admin/api/bids/route.d.ts +14 -0
- package/dist/features/admin/api/bids/route.js +53 -0
- package/dist/features/admin/api/coupons/route.d.ts +14 -0
- package/dist/features/admin/api/coupons/route.js +53 -0
- package/dist/features/admin/api/products/route.d.ts +14 -0
- package/dist/features/admin/api/products/route.js +54 -0
- package/dist/features/admin/api/reviews/route.d.ts +14 -0
- package/dist/features/admin/api/reviews/route.js +53 -0
- package/dist/features/admin/components/AdminAnalyticsView.d.ts +29 -0
- package/dist/features/admin/components/AdminAnalyticsView.js +15 -0
- package/dist/features/admin/components/AdminBidsView.d.ts +4 -0
- package/dist/features/admin/components/AdminBidsView.js +5 -0
- package/dist/features/admin/components/AdminBlogView.d.ts +4 -0
- package/dist/features/admin/components/AdminBlogView.js +5 -0
- package/dist/features/admin/components/AdminCarouselView.d.ts +9 -0
- package/dist/features/admin/components/AdminCarouselView.js +5 -0
- package/dist/features/admin/components/AdminCategoriesView.d.ts +9 -0
- package/dist/features/admin/components/AdminCategoriesView.js +5 -0
- package/dist/features/admin/components/AdminCouponsView.d.ts +4 -0
- package/dist/features/admin/components/AdminCouponsView.js +5 -0
- package/dist/features/admin/components/AdminDashboardView.d.ts +16 -0
- package/dist/features/admin/components/AdminDashboardView.js +11 -0
- package/dist/features/admin/components/AdminFaqsView.d.ts +4 -0
- package/dist/features/admin/components/AdminFaqsView.js +5 -0
- package/dist/features/admin/components/AdminFeatureFlagsView.d.ts +9 -0
- package/dist/features/admin/components/AdminFeatureFlagsView.js +5 -0
- package/dist/features/admin/components/AdminFilterBar.d.ts +65 -0
- package/dist/features/admin/components/AdminFilterBar.js +22 -0
- package/dist/features/admin/components/AdminMediaView.d.ts +9 -0
- package/dist/features/admin/components/AdminMediaView.js +5 -0
- package/dist/features/admin/components/AdminNavigationView.d.ts +9 -0
- package/dist/features/admin/components/AdminNavigationView.js +5 -0
- package/dist/features/admin/components/AdminOrdersView.d.ts +4 -0
- package/dist/features/admin/components/AdminOrdersView.js +5 -0
- package/dist/features/admin/components/AdminPageHeader.d.ts +53 -0
- package/dist/features/admin/components/AdminPageHeader.js +12 -0
- package/dist/features/admin/components/AdminPayoutsView.d.ts +4 -0
- package/dist/features/admin/components/AdminPayoutsView.js +5 -0
- package/dist/features/admin/components/AdminProductsView.d.ts +4 -0
- package/dist/features/admin/components/AdminProductsView.js +5 -0
- package/dist/features/admin/components/AdminReviewsView.d.ts +7 -0
- package/dist/features/admin/components/AdminReviewsView.js +5 -0
- package/dist/features/admin/components/AdminSectionsView.d.ts +9 -0
- package/dist/features/admin/components/AdminSectionsView.js +5 -0
- package/dist/features/admin/components/AdminSessionsManager.d.ts +9 -0
- package/dist/features/admin/components/AdminSessionsManager.js +5 -0
- package/dist/features/admin/components/AdminSidebar.d.ts +9 -0
- package/dist/features/admin/components/AdminSidebar.js +6 -0
- package/dist/features/admin/components/AdminSiteView.d.ts +10 -0
- package/dist/features/admin/components/AdminSiteView.js +5 -0
- package/dist/features/admin/components/AdminStoresView.d.ts +4 -0
- package/dist/features/admin/components/AdminStoresView.js +5 -0
- package/dist/features/admin/components/AdminTopBar.d.ts +8 -0
- package/dist/features/admin/components/AdminTopBar.js +8 -0
- package/dist/features/admin/components/AdminUsersView.d.ts +4 -0
- package/dist/features/admin/components/AdminUsersView.js +5 -0
- package/dist/features/admin/components/DashboardStats.d.ts +8 -0
- package/dist/features/admin/components/DashboardStats.js +21 -0
- package/dist/features/admin/components/DataTable.d.ts +19 -0
- package/dist/features/admin/components/DataTable.js +7 -0
- package/dist/features/admin/components/DemoSeedView.d.ts +11 -0
- package/dist/features/admin/components/DemoSeedView.js +5 -0
- package/dist/features/admin/components/DrawerFormFooter.d.ts +54 -0
- package/dist/features/admin/components/DrawerFormFooter.js +6 -0
- package/dist/features/admin/components/QuickActionsPanel.d.ts +15 -0
- package/dist/features/admin/components/QuickActionsPanel.js +6 -0
- package/dist/features/admin/components/analytics/AdminAnalyticsCharts.d.ts +17 -0
- package/dist/features/admin/components/analytics/AdminAnalyticsCharts.js +33 -0
- package/dist/features/admin/components/analytics/AdminStatCard.d.ts +8 -0
- package/dist/features/admin/components/analytics/AdminStatCard.js +6 -0
- package/dist/features/admin/components/analytics/AdminTopProductsTable.d.ts +16 -0
- package/dist/features/admin/components/analytics/AdminTopProductsTable.js +6 -0
- package/dist/features/admin/components/analytics/index.d.ts +3 -0
- package/dist/features/admin/components/analytics/index.js +3 -0
- package/dist/features/admin/components/index.d.ts +62 -0
- package/dist/features/admin/components/index.js +32 -0
- package/dist/features/admin/hooks/useAdmin.d.ts +9 -0
- package/dist/features/admin/hooks/useAdmin.js +14 -0
- package/dist/features/admin/hooks/useChat.d.ts +24 -0
- package/dist/features/admin/hooks/useChat.js +97 -0
- package/dist/features/admin/index.d.ts +8 -554
- package/dist/features/admin/index.js +7 -2703
- package/dist/features/admin/manifest.d.ts +2 -0
- package/dist/features/admin/manifest.js +13 -0
- package/dist/features/admin/messages/en.json +13 -0
- package/dist/features/admin/permission-map.d.ts +3 -0
- package/dist/features/admin/permission-map.js +24 -0
- package/dist/features/admin/repository/chat.repository.d.ts +70 -0
- package/dist/features/admin/repository/chat.repository.js +216 -0
- package/dist/features/admin/repository/notification.repository.d.ts +64 -0
- package/dist/features/admin/repository/notification.repository.js +225 -0
- package/dist/features/admin/repository/site-settings.repository.d.ts +118 -0
- package/dist/features/admin/repository/site-settings.repository.js +214 -0
- package/dist/features/admin/schemas/firestore.d.ts +311 -0
- package/dist/features/admin/schemas/firestore.js +246 -0
- package/dist/features/admin/schemas/index.d.ts +1 -0
- package/dist/features/admin/schemas/index.js +1 -0
- package/dist/features/admin/server.d.ts +15 -0
- package/dist/features/admin/server.js +14 -0
- package/dist/features/admin/types/index.d.ts +61 -0
- package/dist/features/admin/types/index.js +1 -0
- package/dist/features/admin/types/product.types.d.ts +78 -0
- package/dist/features/admin/types/product.types.js +13 -0
- package/dist/features/auctions/actions/bid-actions.d.ts +22 -0
- package/dist/features/auctions/actions/bid-actions.js +106 -0
- package/dist/features/auctions/actions/index.d.ts +1 -0
- package/dist/features/auctions/actions/index.js +1 -0
- package/dist/features/auctions/api/route.d.ts +14 -0
- package/dist/features/auctions/api/route.js +67 -0
- package/dist/features/auctions/columns/index.d.ts +14 -0
- package/dist/features/auctions/columns/index.js +63 -0
- package/dist/features/auctions/components/AuctionCard.d.ts +26 -0
- package/dist/features/auctions/components/AuctionCard.js +35 -0
- package/dist/features/auctions/components/MarketplaceAuctionCard.d.ts +56 -0
- package/dist/features/auctions/components/MarketplaceAuctionCard.js +112 -0
- package/dist/features/auctions/components/MarketplaceAuctionGrid.d.ts +22 -0
- package/dist/features/auctions/components/MarketplaceAuctionGrid.js +37 -0
- package/dist/features/auctions/components/index.d.ts +3 -0
- package/dist/features/auctions/components/index.js +3 -0
- package/dist/features/auctions/hooks/useAuctions.d.ts +50 -0
- package/dist/features/auctions/hooks/useAuctions.js +93 -0
- package/dist/features/auctions/hooks/usePlaceBid.d.ts +24 -0
- package/dist/features/auctions/hooks/usePlaceBid.js +29 -0
- package/dist/features/auctions/hooks/useRealtimeBids.d.ts +38 -0
- package/dist/features/auctions/hooks/useRealtimeBids.js +66 -0
- package/dist/features/auctions/index.d.ts +8 -513
- package/dist/features/auctions/index.js +8 -1194
- package/dist/features/auctions/manifest.d.ts +2 -0
- package/dist/features/auctions/manifest.js +17 -0
- package/dist/features/auctions/messages/en.json +18 -0
- package/dist/features/auctions/repository/auctions.repository.d.ts +12 -0
- package/dist/features/auctions/repository/auctions.repository.js +42 -0
- package/dist/features/auctions/repository/bid.repository.d.ts +145 -0
- package/dist/features/auctions/repository/bid.repository.js +370 -0
- package/dist/features/auctions/schemas/firestore.d.ts +48 -0
- package/dist/features/auctions/schemas/firestore.js +50 -0
- package/dist/features/auctions/schemas/index.d.ts +155 -0
- package/dist/features/auctions/schemas/index.js +64 -0
- package/dist/features/auctions/server.d.ts +10 -0
- package/dist/features/auctions/server.js +10 -0
- package/dist/features/auctions/types/index.d.ts +73 -0
- package/dist/features/auctions/types/index.js +1 -0
- package/dist/features/auth/actions/index.d.ts +2 -0
- package/dist/features/auth/actions/index.js +2 -0
- package/dist/features/auth/actions/profile-actions.d.ts +27 -0
- package/dist/features/auth/actions/profile-actions.js +50 -0
- package/dist/features/auth/actions/realtime-token-actions.d.ts +11 -0
- package/dist/features/auth/actions/realtime-token-actions.js +31 -0
- package/dist/features/auth/api/route.d.ts +22 -0
- package/dist/features/auth/api/route.js +48 -0
- package/dist/features/auth/auth-helpers.d.ts +14 -0
- package/dist/features/auth/auth-helpers.js +68 -0
- package/dist/features/auth/components/AuthStatusPanel.d.ts +10 -0
- package/dist/features/auth/components/AuthStatusPanel.js +22 -0
- package/dist/features/auth/components/ForgotPasswordView.d.ts +18 -0
- package/dist/features/auth/components/ForgotPasswordView.js +15 -0
- package/dist/features/auth/components/Guards.d.ts +86 -0
- package/dist/features/auth/components/Guards.js +91 -0
- package/dist/features/auth/components/LoginForm.d.ts +36 -0
- package/dist/features/auth/components/LoginForm.js +18 -0
- package/dist/features/auth/components/RegisterForm.d.ts +36 -0
- package/dist/features/auth/components/RegisterForm.js +27 -0
- package/dist/features/auth/components/ResetPasswordView.d.ts +23 -0
- package/dist/features/auth/components/ResetPasswordView.js +22 -0
- package/dist/features/auth/components/SocialAuthButtons.d.ts +8 -0
- package/dist/features/auth/components/SocialAuthButtons.js +6 -0
- package/dist/features/auth/components/VerifyEmailView.d.ts +20 -0
- package/dist/features/auth/components/VerifyEmailView.js +8 -0
- package/dist/features/auth/components/index.d.ts +14 -0
- package/dist/features/auth/components/index.js +8 -0
- package/dist/features/auth/consent-otp.d.ts +52 -0
- package/dist/features/auth/consent-otp.js +120 -0
- package/dist/features/auth/hooks/useAuth.d.ts +81 -0
- package/dist/features/auth/hooks/useAuth.js +164 -0
- package/dist/features/auth/hooks/useAuthEvent.d.ts +22 -0
- package/dist/features/auth/hooks/useAuthEvent.js +31 -0
- package/dist/features/auth/hooks/useLogout.d.ts +16 -0
- package/dist/features/auth/hooks/useLogout.js +22 -0
- package/dist/features/auth/hooks/useRBAC.d.ts +38 -0
- package/dist/features/auth/hooks/useRBAC.js +80 -0
- package/dist/features/auth/index.d.ts +10 -315
- package/dist/features/auth/index.js +10 -1874
- package/dist/features/auth/manifest.d.ts +2 -0
- package/dist/features/auth/manifest.js +21 -0
- package/dist/features/auth/messages/en.json +13 -0
- package/dist/features/auth/repository/index.d.ts +4 -0
- package/dist/features/auth/repository/index.js +4 -0
- package/dist/features/auth/repository/session.repository.d.ts +44 -0
- package/dist/features/auth/repository/session.repository.js +246 -0
- package/dist/features/auth/repository/sms-counter.repository.d.ts +15 -0
- package/dist/features/auth/repository/sms-counter.repository.js +54 -0
- package/dist/features/auth/repository/token.repository.d.ts +38 -0
- package/dist/features/auth/repository/token.repository.js +186 -0
- package/dist/features/auth/repository/user.repository.d.ts +46 -0
- package/dist/features/auth/repository/user.repository.js +233 -0
- package/dist/features/auth/schemas/firestore.d.ts +351 -0
- package/dist/features/auth/schemas/firestore.js +272 -0
- package/dist/features/auth/schemas/index.d.ts +72 -0
- package/dist/features/auth/schemas/index.js +41 -0
- package/dist/features/auth/server.d.ts +15 -18
- package/dist/features/auth/server.js +21 -529
- package/dist/features/auth/token-helpers.d.ts +7 -0
- package/dist/features/auth/token-helpers.js +37 -0
- package/dist/features/auth/token-store.d.ts +39 -0
- package/dist/features/auth/token-store.js +120 -0
- package/dist/features/auth/types/index.d.ts +30 -0
- package/dist/features/auth/types/index.js +1 -0
- package/dist/features/before-after/api/[id]/route.d.ts +26 -0
- package/dist/features/before-after/api/[id]/route.js +88 -0
- package/dist/features/before-after/api/route.d.ts +13 -0
- package/dist/features/before-after/api/route.js +79 -0
- package/dist/features/before-after/columns/index.d.ts +17 -0
- package/dist/features/before-after/columns/index.js +50 -0
- package/dist/features/before-after/components/BeforeAfterGallery.d.ts +7 -0
- package/dist/features/before-after/components/BeforeAfterGallery.js +8 -0
- package/dist/features/before-after/components/BeforeAfterSlider.d.ts +7 -0
- package/dist/features/before-after/components/BeforeAfterSlider.js +27 -0
- package/dist/features/before-after/components/index.d.ts +2 -0
- package/dist/features/before-after/components/index.js +2 -0
- package/dist/features/before-after/hooks/useBeforeAfter.d.ts +15 -0
- package/dist/features/before-after/hooks/useBeforeAfter.js +25 -0
- package/dist/features/before-after/index.d.ts +6 -128
- package/dist/features/before-after/index.js +6 -546
- package/dist/features/before-after/manifest.d.ts +2 -0
- package/dist/features/before-after/manifest.js +10 -0
- package/dist/features/before-after/messages/en.json +8 -0
- package/dist/features/before-after/repository/before-after.repository.d.ts +13 -0
- package/dist/features/before-after/repository/before-after.repository.js +36 -0
- package/dist/features/before-after/schemas/index.d.ts +48 -0
- package/dist/features/before-after/schemas/index.js +24 -0
- package/dist/features/before-after/server.d.ts +7 -0
- package/dist/features/before-after/server.js +7 -0
- package/dist/features/before-after/types/index.d.ts +18 -0
- package/dist/features/before-after/types/index.js +1 -0
- package/dist/features/blog/actions/blog-actions.d.ts +302 -0
- package/dist/features/blog/actions/blog-actions.js +119 -0
- package/dist/features/blog/actions/index.d.ts +1 -0
- package/dist/features/blog/actions/index.js +1 -0
- package/dist/features/blog/api/[slug]/route.d.ts +23 -0
- package/dist/features/blog/api/[slug]/route.js +40 -0
- package/dist/features/blog/api/route.d.ts +12 -0
- package/dist/features/blog/api/route.js +64 -0
- package/dist/features/blog/columns/index.d.ts +27 -0
- package/dist/features/blog/columns/index.js +54 -0
- package/dist/features/blog/components/BlogFeaturedCard.d.ts +17 -0
- package/dist/features/blog/components/BlogFeaturedCard.js +24 -0
- package/dist/features/blog/components/BlogFilters.d.ts +106 -0
- package/dist/features/blog/components/BlogFilters.js +67 -0
- package/dist/features/blog/components/BlogListView.d.ts +29 -0
- package/dist/features/blog/components/BlogListView.js +38 -0
- package/dist/features/blog/components/BlogPostForm.d.ts +56 -0
- package/dist/features/blog/components/BlogPostForm.js +24 -0
- package/dist/features/blog/components/BlogPostView.d.ts +32 -0
- package/dist/features/blog/components/BlogPostView.js +39 -0
- package/dist/features/blog/components/index.d.ts +9 -0
- package/dist/features/blog/components/index.js +5 -0
- package/dist/features/blog/hooks/useBlog.d.ts +27 -0
- package/dist/features/blog/hooks/useBlog.js +51 -0
- package/dist/features/blog/index.d.ts +6 -492
- package/dist/features/blog/index.js +6 -4062
- package/dist/features/blog/manifest.d.ts +2 -0
- package/dist/features/blog/manifest.js +14 -0
- package/dist/features/blog/messages/en.json +14 -0
- package/dist/features/blog/repository/blog.repository.d.ts +79 -0
- package/dist/features/blog/repository/blog.repository.js +130 -0
- package/dist/features/blog/schemas/firestore.d.ts +87 -0
- package/dist/features/blog/schemas/firestore.js +99 -0
- package/dist/features/blog/schemas/index.d.ts +207 -0
- package/dist/features/blog/schemas/index.js +71 -0
- package/dist/features/blog/server.d.ts +8 -71
- package/dist/features/blog/server.js +10 -180
- package/dist/features/blog/types/index.d.ts +47 -0
- package/dist/features/blog/types/index.js +1 -0
- package/dist/features/cart/actions/cart-actions.d.ts +16 -0
- package/dist/features/cart/actions/cart-actions.js +52 -0
- package/dist/features/cart/actions/index.d.ts +1 -0
- package/dist/features/cart/actions/index.js +1 -0
- package/dist/features/cart/api/[id]/route.d.ts +21 -0
- package/dist/features/cart/api/[id]/route.js +62 -0
- package/dist/features/cart/api/route.d.ts +13 -0
- package/dist/features/cart/api/route.js +79 -0
- package/dist/features/cart/columns/index.d.ts +17 -0
- package/dist/features/cart/columns/index.js +53 -0
- package/dist/features/cart/components/CartDrawer.d.ts +27 -0
- package/dist/features/cart/components/CartDrawer.js +14 -0
- package/dist/features/cart/components/CartSummary.d.ts +19 -0
- package/dist/features/cart/components/CartSummary.js +5 -0
- package/dist/features/cart/components/CartView.d.ts +17 -0
- package/dist/features/cart/components/CartView.js +7 -0
- package/dist/features/cart/components/CheckoutAddressStep.d.ts +20 -0
- package/dist/features/cart/components/CheckoutAddressStep.js +12 -0
- package/dist/features/cart/components/CheckoutOtpModal.d.ts +15 -0
- package/dist/features/cart/components/CheckoutOtpModal.js +12 -0
- package/dist/features/cart/components/CheckoutSuccessView.d.ts +12 -0
- package/dist/features/cart/components/CheckoutSuccessView.js +9 -0
- package/dist/features/cart/components/CheckoutView.d.ts +15 -0
- package/dist/features/cart/components/CheckoutView.js +18 -0
- package/dist/features/cart/components/index.d.ts +13 -0
- package/dist/features/cart/components/index.js +7 -0
- package/dist/features/cart/hooks/useAddToCart.d.ts +27 -0
- package/dist/features/cart/hooks/useAddToCart.js +52 -0
- package/dist/features/cart/hooks/useCart.d.ts +17 -0
- package/dist/features/cart/hooks/useCart.js +24 -0
- package/dist/features/cart/hooks/useCartCount.d.ts +7 -0
- package/dist/features/cart/hooks/useCartCount.js +19 -0
- package/dist/features/cart/hooks/useCartQuery.d.ts +8 -0
- package/dist/features/cart/hooks/useCartQuery.js +11 -0
- package/dist/features/cart/hooks/useCheckoutReadQueries.d.ts +14 -0
- package/dist/features/cart/hooks/useCheckoutReadQueries.js +18 -0
- package/dist/features/cart/hooks/useGuestCart.d.ts +18 -0
- package/dist/features/cart/hooks/useGuestCart.js +32 -0
- package/dist/features/cart/hooks/useGuestCartMerge.d.ts +15 -0
- package/dist/features/cart/hooks/useGuestCartMerge.js +50 -0
- package/dist/features/cart/hooks/useOrder.d.ts +13 -0
- package/dist/features/cart/hooks/useOrder.js +24 -0
- package/dist/features/cart/index.d.ts +14 -451
- package/dist/features/cart/index.js +14 -1064
- package/dist/features/cart/manifest.d.ts +2 -0
- package/dist/features/cart/manifest.js +10 -0
- package/dist/features/cart/messages/en.json +10 -0
- package/dist/features/cart/repository/cart.repository.d.ts +23 -0
- package/dist/features/cart/repository/cart.repository.js +210 -0
- package/dist/features/cart/schemas/firestore.d.ts +83 -0
- package/dist/features/cart/schemas/firestore.js +36 -0
- package/dist/features/cart/schemas/index.d.ts +184 -0
- package/dist/features/cart/schemas/index.js +35 -0
- package/dist/features/cart/server.d.ts +8 -0
- package/dist/features/cart/server.js +8 -0
- package/dist/features/cart/types/index.d.ts +27 -0
- package/dist/features/cart/types/index.js +1 -0
- package/dist/features/cart/utils/guest-cart.d.ts +26 -0
- package/dist/features/cart/utils/guest-cart.js +83 -0
- package/dist/features/categories/actions/category-actions.d.ts +17 -0
- package/dist/features/categories/actions/category-actions.js +63 -0
- package/dist/features/categories/actions/index.d.ts +1 -0
- package/dist/features/categories/actions/index.js +1 -0
- package/dist/features/categories/api/[id]/route.d.ts +23 -0
- package/dist/features/categories/api/[id]/route.js +98 -0
- package/dist/features/categories/api/route.d.ts +19 -0
- package/dist/features/categories/api/route.js +200 -0
- package/dist/features/categories/columns/index.d.ts +15 -0
- package/dist/features/categories/columns/index.js +38 -0
- package/dist/features/categories/components/BreadcrumbTrail.d.ts +47 -0
- package/dist/features/categories/components/BreadcrumbTrail.js +36 -0
- package/dist/features/categories/components/CategoriesListView.d.ts +31 -0
- package/dist/features/categories/components/CategoriesListView.js +27 -0
- package/dist/features/categories/components/CategoryFilters.d.ts +68 -0
- package/dist/features/categories/components/CategoryFilters.js +75 -0
- package/dist/features/categories/components/CategoryForm.d.ts +24 -0
- package/dist/features/categories/components/CategoryForm.js +42 -0
- package/dist/features/categories/components/CategoryGrid.d.ts +14 -0
- package/dist/features/categories/components/CategoryGrid.js +14 -0
- package/dist/features/categories/components/CategoryProductsView.d.ts +49 -0
- package/dist/features/categories/components/CategoryProductsView.js +21 -0
- package/dist/features/categories/components/CategorySelectorCreate.d.ts +17 -0
- package/dist/features/categories/components/CategorySelectorCreate.js +57 -0
- package/dist/features/categories/components/CategorySortSelect.d.ts +9 -0
- package/dist/features/categories/components/CategorySortSelect.js +8 -0
- package/dist/features/categories/components/CategoryTableColumns.d.ts +30 -0
- package/dist/features/categories/components/CategoryTableColumns.js +54 -0
- package/dist/features/categories/components/CategoryTree.d.ts +15 -0
- package/dist/features/categories/components/CategoryTree.js +49 -0
- package/dist/features/categories/components/ConcernCard.d.ts +8 -0
- package/dist/features/categories/components/ConcernCard.js +5 -0
- package/dist/features/categories/components/ConcernGrid.d.ts +8 -0
- package/dist/features/categories/components/ConcernGrid.js +8 -0
- package/dist/features/categories/components/index.d.ts +22 -0
- package/dist/features/categories/components/index.js +12 -0
- package/dist/features/categories/hooks/useCategories.d.ts +26 -0
- package/dist/features/categories/hooks/useCategories.js +50 -0
- package/dist/features/categories/hooks/useCategorySelector.d.ts +26 -0
- package/dist/features/categories/hooks/useCategorySelector.js +42 -0
- package/dist/features/categories/index.d.ts +7 -461
- package/dist/features/categories/index.js +7 -2031
- package/dist/features/categories/manifest.d.ts +2 -0
- package/dist/features/categories/manifest.js +20 -0
- package/dist/features/categories/messages/en.json +14 -0
- package/dist/features/categories/repository/categories.repository.d.ts +31 -0
- package/dist/features/categories/repository/categories.repository.js +399 -0
- package/dist/features/categories/schemas/firestore.d.ts +140 -0
- package/dist/features/categories/schemas/firestore.js +189 -0
- package/dist/features/categories/schemas/index.d.ts +207 -0
- package/dist/features/categories/schemas/index.js +67 -0
- package/dist/features/categories/server.d.ts +7 -44
- package/dist/features/categories/server.js +10 -789
- package/dist/features/categories/types/index.d.ts +80 -0
- package/dist/features/categories/types/index.js +13 -0
- package/dist/features/checkout/actions/checkout-actions.d.ts +14 -0
- package/dist/features/checkout/actions/checkout-actions.js +91 -0
- package/dist/features/checkout/actions/index.d.ts +1 -0
- package/dist/features/checkout/actions/index.js +1 -0
- package/dist/features/checkout/components/CheckoutStepper.d.ts +10 -0
- package/dist/features/checkout/components/CheckoutStepper.js +15 -0
- package/dist/features/checkout/components/index.d.ts +1 -0
- package/dist/features/checkout/components/index.js +1 -0
- package/dist/features/checkout/hooks/useCheckout.d.ts +9 -0
- package/dist/features/checkout/hooks/useCheckout.js +24 -0
- package/dist/features/checkout/hooks/useCheckoutApi.d.ts +74 -0
- package/dist/features/checkout/hooks/useCheckoutApi.js +48 -0
- package/dist/features/checkout/hooks/usePaymentCheckout.d.ts +78 -0
- package/dist/features/checkout/hooks/usePaymentCheckout.js +178 -0
- package/dist/features/checkout/index.d.ts +8 -70
- package/dist/features/checkout/index.js +7 -192
- package/dist/features/checkout/manifest.d.ts +2 -0
- package/dist/features/checkout/manifest.js +17 -0
- package/dist/features/checkout/messages/en.json +10 -0
- package/dist/features/checkout/repository/failed-checkout.repository.d.ts +18 -0
- package/dist/features/checkout/repository/failed-checkout.repository.js +29 -0
- package/dist/features/checkout/schemas/firestore.d.ts +33 -0
- package/dist/features/checkout/schemas/firestore.js +6 -0
- package/dist/features/checkout/schemas/index.d.ts +1 -0
- package/dist/features/checkout/schemas/index.js +1 -0
- package/dist/features/checkout/server.d.ts +8 -0
- package/dist/features/checkout/server.js +8 -0
- package/dist/features/checkout/types/index.d.ts +46 -0
- package/dist/features/checkout/types/index.js +2 -0
- package/dist/features/cms/index.d.ts +1 -2
- package/dist/features/cms/index.js +5 -4
- package/dist/features/collections/api/[slug]/route.d.ts +26 -0
- package/dist/features/collections/api/[slug]/route.js +102 -0
- package/dist/features/collections/api/route.d.ts +13 -0
- package/dist/features/collections/api/route.js +79 -0
- package/dist/features/collections/columns/index.d.ts +17 -0
- package/dist/features/collections/columns/index.js +55 -0
- package/dist/features/collections/components/CollectionCard.d.ts +12 -0
- package/dist/features/collections/components/CollectionCard.js +9 -0
- package/dist/features/collections/components/index.d.ts +1 -0
- package/dist/features/collections/components/index.js +1 -0
- package/dist/features/collections/hooks/useCollections.d.ts +7 -0
- package/dist/features/collections/hooks/useCollections.js +34 -0
- package/dist/features/collections/index.d.ts +6 -148
- package/dist/features/collections/index.js +6 -378
- package/dist/features/collections/manifest.d.ts +2 -0
- package/dist/features/collections/manifest.js +16 -0
- package/dist/features/collections/messages/en.json +10 -0
- package/dist/features/collections/repository/collections.repository.d.ts +8 -0
- package/dist/features/collections/repository/collections.repository.js +16 -0
- package/dist/features/collections/schemas/index.d.ts +76 -0
- package/dist/features/collections/schemas/index.js +34 -0
- package/dist/features/collections/server.d.ts +7 -0
- package/dist/features/collections/server.js +7 -0
- package/dist/features/collections/types/index.d.ts +25 -0
- package/dist/features/collections/types/index.js +1 -0
- package/dist/features/consultation/api/[id]/route.d.ts +26 -0
- package/dist/features/consultation/api/[id]/route.js +88 -0
- package/dist/features/consultation/api/route.d.ts +13 -0
- package/dist/features/consultation/api/route.js +79 -0
- package/dist/features/consultation/columns/index.d.ts +17 -0
- package/dist/features/consultation/columns/index.js +54 -0
- package/dist/features/consultation/components/ConsultationForm.d.ts +8 -0
- package/dist/features/consultation/components/ConsultationForm.js +51 -0
- package/dist/features/consultation/components/index.d.ts +1 -0
- package/dist/features/consultation/components/index.js +1 -0
- package/dist/features/consultation/hooks/useBookConsultation.d.ts +8 -0
- package/dist/features/consultation/hooks/useBookConsultation.js +16 -0
- package/dist/features/consultation/index.d.ts +6 -172
- package/dist/features/consultation/index.js +6 -1084
- package/dist/features/consultation/manifest.d.ts +2 -0
- package/dist/features/consultation/manifest.js +12 -0
- package/dist/features/consultation/messages/en.json +25 -0
- package/dist/features/consultation/repository/consultations.repository.d.ts +12 -0
- package/dist/features/consultation/repository/consultations.repository.js +28 -0
- package/dist/features/consultation/schemas/index.d.ts +87 -0
- package/dist/features/consultation/schemas/index.js +47 -0
- package/dist/features/consultation/server.d.ts +7 -0
- package/dist/features/consultation/server.js +7 -0
- package/dist/features/consultation/types/index.d.ts +33 -0
- package/dist/features/consultation/types/index.js +1 -0
- package/dist/features/contact/components/ContactForm.d.ts +32 -0
- package/dist/features/contact/components/ContactForm.js +58 -0
- package/dist/features/contact/components/ContactInfoSidebar.d.ts +20 -0
- package/dist/features/contact/components/ContactInfoSidebar.js +6 -0
- package/dist/features/contact/components/index.d.ts +4 -0
- package/dist/features/contact/components/index.js +2 -0
- package/dist/features/contact/email.d.ts +61 -0
- package/dist/features/contact/email.js +345 -0
- package/dist/features/contact/hooks/useContactSubmit.d.ts +4 -0
- package/dist/features/contact/hooks/useContactSubmit.js +7 -0
- package/dist/features/contact/index.d.ts +2 -56
- package/dist/features/contact/index.js +2 -586
- package/dist/features/contact/server.d.ts +7 -0
- package/dist/features/contact/server.js +7 -0
- package/dist/features/copilot/components/AdminCopilotView.d.ts +21 -0
- package/dist/features/copilot/components/AdminCopilotView.js +29 -0
- package/dist/features/copilot/components/index.d.ts +2 -0
- package/dist/features/copilot/components/index.js +1 -0
- package/dist/features/copilot/hooks/useCopilotChat.d.ts +22 -0
- package/dist/features/copilot/hooks/useCopilotChat.js +57 -0
- package/dist/features/copilot/hooks/useCopilotFeedback.d.ts +15 -0
- package/dist/features/copilot/hooks/useCopilotFeedback.js +16 -0
- package/dist/features/copilot/index.d.ts +3 -47
- package/dist/features/copilot/index.js +3 -681
- package/dist/features/corporate/api/[id]/route.d.ts +26 -0
- package/dist/features/corporate/api/[id]/route.js +88 -0
- package/dist/features/corporate/api/route.d.ts +13 -0
- package/dist/features/corporate/api/route.js +79 -0
- package/dist/features/corporate/columns/index.d.ts +17 -0
- package/dist/features/corporate/columns/index.js +54 -0
- package/dist/features/corporate/components/CorporateInquiryForm.d.ts +7 -0
- package/dist/features/corporate/components/CorporateInquiryForm.js +36 -0
- package/dist/features/corporate/components/index.d.ts +1 -0
- package/dist/features/corporate/components/index.js +1 -0
- package/dist/features/corporate/hooks/useSubmitCorporateInquiry.d.ts +8 -0
- package/dist/features/corporate/hooks/useSubmitCorporateInquiry.js +16 -0
- package/dist/features/corporate/index.d.ts +6 -183
- package/dist/features/corporate/index.js +6 -782
- package/dist/features/corporate/manifest.d.ts +2 -0
- package/dist/features/corporate/manifest.js +12 -0
- package/dist/features/corporate/messages/en.json +26 -0
- package/dist/features/corporate/repository/corporate.repository.d.ts +12 -0
- package/dist/features/corporate/repository/corporate.repository.js +28 -0
- package/dist/features/corporate/schemas/index.d.ts +95 -0
- package/dist/features/corporate/schemas/index.js +50 -0
- package/dist/features/corporate/server.d.ts +7 -0
- package/dist/features/corporate/server.js +7 -0
- package/dist/features/corporate/types/index.d.ts +37 -0
- package/dist/features/corporate/types/index.js +1 -0
- package/dist/features/cron/firebase-adapters.d.ts +70 -0
- package/dist/features/cron/firebase-adapters.js +68 -0
- package/dist/features/cron/index.d.ts +5 -0
- package/dist/features/cron/index.js +7 -0
- package/dist/features/cron/jobs/auction-expiry.job.d.ts +27 -0
- package/dist/features/cron/jobs/auction-expiry.job.js +38 -0
- package/dist/features/cron/jobs/preorder-reminder.job.d.ts +14 -0
- package/dist/features/cron/jobs/preorder-reminder.job.js +40 -0
- package/dist/features/cron/registry.d.ts +45 -0
- package/dist/features/cron/registry.js +86 -0
- package/dist/features/cron/types.d.ts +66 -0
- package/dist/features/cron/types.js +9 -0
- package/dist/features/events/actions/event-actions.d.ts +92 -0
- package/dist/features/events/actions/event-actions.js +253 -0
- package/dist/features/events/actions/index.d.ts +1 -0
- package/dist/features/events/actions/index.js +1 -0
- package/dist/features/events/api/[id]/route.d.ts +24 -0
- package/dist/features/events/api/[id]/route.js +83 -0
- package/dist/features/events/api/route.d.ts +12 -0
- package/dist/features/events/api/route.js +88 -0
- package/dist/features/events/columns/index.d.ts +22 -0
- package/dist/features/events/columns/index.js +41 -0
- package/dist/features/events/components/AdminEventEntriesView.d.ts +17 -0
- package/dist/features/events/components/AdminEventEntriesView.js +10 -0
- package/dist/features/events/components/AdminEventsView.d.ts +11 -0
- package/dist/features/events/components/AdminEventsView.js +5 -0
- package/dist/features/events/components/EventBanner.d.ts +13 -0
- package/dist/features/events/components/EventBanner.js +48 -0
- package/dist/features/events/components/EventCard.d.ts +13 -0
- package/dist/features/events/components/EventCard.js +21 -0
- package/dist/features/events/components/EventDetailView.d.ts +15 -0
- package/dist/features/events/components/EventDetailView.js +11 -0
- package/dist/features/events/components/EventFilters.d.ts +105 -0
- package/dist/features/events/components/EventFilters.js +73 -0
- package/dist/features/events/components/EventFormDrawer.d.ts +22 -0
- package/dist/features/events/components/EventFormDrawer.js +6 -0
- package/dist/features/events/components/EventLeaderboard.d.ts +23 -0
- package/dist/features/events/components/EventLeaderboard.js +18 -0
- package/dist/features/events/components/EventParticipateView.d.ts +19 -0
- package/dist/features/events/components/EventParticipateView.js +13 -0
- package/dist/features/events/components/EventStatusBadge.d.ts +7 -0
- package/dist/features/events/components/EventStatusBadge.js +12 -0
- package/dist/features/events/components/EventsListView.d.ts +16 -0
- package/dist/features/events/components/EventsListView.js +21 -0
- package/dist/features/events/components/index.d.ts +19 -0
- package/dist/features/events/components/index.js +11 -0
- package/dist/features/events/hooks/useBulkEvent.d.ts +19 -0
- package/dist/features/events/hooks/useBulkEvent.js +36 -0
- package/dist/features/events/hooks/useEvent.d.ts +43 -0
- package/dist/features/events/hooks/useEvent.js +55 -0
- package/dist/features/events/hooks/useEvents.d.ts +27 -0
- package/dist/features/events/hooks/useEvents.js +38 -0
- package/dist/features/events/index.d.ts +8 -841
- package/dist/features/events/index.js +8 -1453
- package/dist/features/events/manifest.d.ts +2 -0
- package/dist/features/events/manifest.js +24 -0
- package/dist/features/events/messages/en.json +28 -0
- package/dist/features/events/repository/event-entry.repository.d.ts +17 -0
- package/dist/features/events/repository/event-entry.repository.js +115 -0
- package/dist/features/events/repository/events.repository.d.ts +18 -0
- package/dist/features/events/repository/events.repository.js +128 -0
- package/dist/features/events/schemas/firestore.d.ts +115 -0
- package/dist/features/events/schemas/firestore.js +77 -0
- package/dist/features/events/schemas/index.d.ts +383 -0
- package/dist/features/events/schemas/index.js +87 -0
- package/dist/features/events/server.d.ts +8 -37
- package/dist/features/events/server.js +11 -195
- package/dist/features/events/types/index.d.ts +133 -0
- package/dist/features/events/types/index.js +1 -0
- package/dist/features/faq/actions/faq-actions.d.ts +191 -0
- package/dist/features/faq/actions/faq-actions.js +103 -0
- package/dist/features/faq/actions/index.d.ts +1 -0
- package/dist/features/faq/actions/index.js +1 -0
- package/dist/features/faq/api/route.d.ts +11 -0
- package/dist/features/faq/api/route.js +50 -0
- package/dist/features/faq/columns/index.d.ts +15 -0
- package/dist/features/faq/columns/index.js +47 -0
- package/dist/features/faq/components/ContactCTA.d.ts +16 -0
- package/dist/features/faq/components/ContactCTA.js +6 -0
- package/dist/features/faq/components/FAQAccordion.d.ts +20 -0
- package/dist/features/faq/components/FAQAccordion.js +17 -0
- package/dist/features/faq/components/FAQCategorySidebar.d.ts +24 -0
- package/dist/features/faq/components/FAQCategorySidebar.js +15 -0
- package/dist/features/faq/components/FAQHelpfulButtons.d.ts +19 -0
- package/dist/features/faq/components/FAQHelpfulButtons.js +46 -0
- package/dist/features/faq/components/FAQPageContent.d.ts +54 -0
- package/dist/features/faq/components/FAQPageContent.js +67 -0
- package/dist/features/faq/components/FAQSortDropdown.d.ts +13 -0
- package/dist/features/faq/components/FAQSortDropdown.js +11 -0
- package/dist/features/faq/components/RelatedFAQs.d.ts +10 -0
- package/dist/features/faq/components/RelatedFAQs.js +9 -0
- package/dist/features/faq/components/index.d.ts +9 -0
- package/dist/features/faq/components/index.js +7 -0
- package/dist/features/faq/hooks/useFAQs.d.ts +22 -0
- package/dist/features/faq/hooks/useFAQs.js +42 -0
- package/dist/features/faq/hooks/useFaqList.d.ts +194 -0
- package/dist/features/faq/hooks/useFaqList.js +35 -0
- package/dist/features/faq/hooks/useFaqVote.d.ts +14 -0
- package/dist/features/faq/hooks/useFaqVote.js +10 -0
- package/dist/features/faq/index.d.ts +8 -619
- package/dist/features/faq/index.js +8 -1685
- package/dist/features/faq/manifest.d.ts +2 -0
- package/dist/features/faq/manifest.js +10 -0
- package/dist/features/faq/messages/en.json +14 -0
- package/dist/features/faq/repository/faqs.repository.d.ts +43 -0
- package/dist/features/faq/repository/faqs.repository.js +300 -0
- package/dist/features/faq/schemas/firestore.d.ts +63 -0
- package/dist/features/faq/schemas/firestore.js +115 -0
- package/dist/features/faq/schemas/index.d.ts +157 -0
- package/dist/features/faq/schemas/index.js +62 -0
- package/dist/features/faq/server.d.ts +9 -0
- package/dist/features/faq/server.js +9 -0
- package/dist/features/faq/types/index.d.ts +52 -0
- package/dist/features/faq/types/index.js +1 -0
- package/dist/features/filters/FilterFacetSection.d.ts +23 -0
- package/dist/features/filters/FilterFacetSection.js +39 -0
- package/dist/features/filters/FilterPanel.d.ts +61 -0
- package/dist/features/filters/FilterPanel.js +40 -0
- package/dist/features/filters/RangeFilter.d.ts +23 -0
- package/dist/features/filters/RangeFilter.js +28 -0
- package/dist/features/filters/SwitchFilter.d.ts +12 -0
- package/dist/features/filters/SwitchFilter.js +19 -0
- package/dist/features/filters/filterUtils.d.ts +11 -0
- package/dist/features/filters/filterUtils.js +13 -0
- package/dist/features/filters/index.d.ts +10 -136
- package/dist/features/filters/index.js +6 -1061
- package/dist/features/forms/Checkbox.d.ts +8 -0
- package/dist/features/forms/Checkbox.js +15 -0
- package/dist/features/forms/Form.d.ts +25 -0
- package/dist/features/forms/Form.js +38 -0
- package/dist/features/forms/Input.d.ts +10 -0
- package/dist/features/forms/Input.js +23 -0
- package/dist/features/forms/Radio.d.ts +17 -0
- package/dist/features/forms/Radio.js +19 -0
- package/dist/features/forms/Select.d.ts +13 -0
- package/dist/features/forms/Select.js +8 -0
- package/dist/features/forms/Slider.d.ts +20 -0
- package/dist/features/forms/Slider.js +22 -0
- package/dist/features/forms/Textarea.d.ts +8 -0
- package/dist/features/forms/Textarea.js +15 -0
- package/dist/features/forms/Toggle.d.ts +15 -0
- package/dist/features/forms/Toggle.js +48 -0
- package/dist/features/forms/index.d.ts +17 -129
- package/dist/features/forms/index.js +11 -915
- package/dist/features/forms/utils.d.ts +10 -0
- package/dist/features/forms/utils.js +13 -0
- package/dist/features/homepage/actions/carousel-actions.d.ts +37 -0
- package/dist/features/homepage/actions/carousel-actions.js +54 -0
- package/dist/features/homepage/actions/homepage-section-actions.d.ts +46 -0
- package/dist/features/homepage/actions/homepage-section-actions.js +55 -0
- package/dist/features/homepage/actions/index.d.ts +2 -0
- package/dist/features/homepage/actions/index.js +2 -0
- package/dist/features/homepage/api/[id]/route.d.ts +23 -0
- package/dist/features/homepage/api/[id]/route.js +100 -0
- package/dist/features/homepage/api/carousel/[id]/route.d.ts +23 -0
- package/dist/features/homepage/api/carousel/[id]/route.js +122 -0
- package/dist/features/homepage/api/carousel/route.d.ts +15 -0
- package/dist/features/homepage/api/carousel/route.js +154 -0
- package/dist/features/homepage/api/route.d.ts +14 -0
- package/dist/features/homepage/api/route.js +136 -0
- package/dist/features/homepage/api/sections/[id]/route.d.ts +26 -0
- package/dist/features/homepage/api/sections/[id]/route.js +88 -0
- package/dist/features/homepage/api/sections/route.d.ts +13 -0
- package/dist/features/homepage/api/sections/route.js +79 -0
- package/dist/features/homepage/components/AdvertisementBanner.d.ts +13 -0
- package/dist/features/homepage/components/AdvertisementBanner.js +23 -0
- package/dist/features/homepage/components/BeforeAfterCard.d.ts +10 -0
- package/dist/features/homepage/components/BeforeAfterCard.js +54 -0
- package/dist/features/homepage/components/CharacterHotspot.d.ts +24 -0
- package/dist/features/homepage/components/CharacterHotspot.js +373 -0
- package/dist/features/homepage/components/CharacterHotspotForm.d.ts +26 -0
- package/dist/features/homepage/components/CharacterHotspotForm.js +309 -0
- package/dist/features/homepage/components/CustomerReviewsSection.d.ts +13 -0
- package/dist/features/homepage/components/CustomerReviewsSection.js +14 -0
- package/dist/features/homepage/components/FAQSection.d.ts +26 -0
- package/dist/features/homepage/components/FAQSection.js +20 -0
- package/dist/features/homepage/components/FeaturedResultsSection.d.ts +17 -0
- package/dist/features/homepage/components/FeaturedResultsSection.js +18 -0
- package/dist/features/homepage/components/HeroBanner.d.ts +7 -0
- package/dist/features/homepage/components/HeroBanner.js +93 -0
- package/dist/features/homepage/components/HeroCarousel.d.ts +12 -0
- package/dist/features/homepage/components/HeroCarousel.js +157 -0
- package/dist/features/homepage/components/HeroSection.d.ts +7 -0
- package/dist/features/homepage/components/HeroSection.js +12 -0
- package/dist/features/homepage/components/HomepageSkeleton.d.ts +2 -0
- package/dist/features/homepage/components/HomepageSkeleton.js +14 -0
- package/dist/features/homepage/components/HomepageView.d.ts +25 -0
- package/dist/features/homepage/components/HomepageView.js +5 -0
- package/dist/features/homepage/components/HowItWorksInfoView.d.ts +36 -0
- package/dist/features/homepage/components/HowItWorksInfoView.js +8 -0
- package/dist/features/homepage/components/HowItWorksSection.d.ts +23 -0
- package/dist/features/homepage/components/HowItWorksSection.js +36 -0
- package/dist/features/homepage/components/NewsletterBanner.d.ts +22 -0
- package/dist/features/homepage/components/NewsletterBanner.js +34 -0
- package/dist/features/homepage/components/NewsletterSection.d.ts +10 -0
- package/dist/features/homepage/components/NewsletterSection.js +8 -0
- package/dist/features/homepage/components/PromoGrid.d.ts +9 -0
- package/dist/features/homepage/components/PromoGrid.js +35 -0
- package/dist/features/homepage/components/SectionCarousel.d.ts +75 -0
- package/dist/features/homepage/components/SectionCarousel.js +39 -0
- package/dist/features/homepage/components/SecurityHighlightsSection.d.ts +21 -0
- package/dist/features/homepage/components/SecurityHighlightsSection.js +36 -0
- package/dist/features/homepage/components/SiteFeaturesSection.d.ts +13 -0
- package/dist/features/homepage/components/SiteFeaturesSection.js +9 -0
- package/dist/features/homepage/components/StatsCounterSection.d.ts +14 -0
- package/dist/features/homepage/components/StatsCounterSection.js +32 -0
- package/dist/features/homepage/components/TestimonialsCarousel.d.ts +9 -0
- package/dist/features/homepage/components/TestimonialsCarousel.js +30 -0
- package/dist/features/homepage/components/TrustBadges.d.ts +5 -0
- package/dist/features/homepage/components/TrustBadges.js +54 -0
- package/dist/features/homepage/components/TrustFeaturesSection.d.ts +16 -0
- package/dist/features/homepage/components/TrustFeaturesSection.js +41 -0
- package/dist/features/homepage/components/TrustIndicatorsSection.d.ts +11 -0
- package/dist/features/homepage/components/TrustIndicatorsSection.js +9 -0
- package/dist/features/homepage/components/WelcomeSection.d.ts +20 -0
- package/dist/features/homepage/components/WelcomeSection.js +12 -0
- package/dist/features/homepage/components/WhatsAppCommunitySection.d.ts +15 -0
- package/dist/features/homepage/components/WhatsAppCommunitySection.js +21 -0
- package/dist/features/homepage/components/index.d.ts +52 -0
- package/dist/features/homepage/components/index.js +27 -0
- package/dist/features/homepage/hooks/useBlogArticles.d.ts +12 -0
- package/dist/features/homepage/hooks/useBlogArticles.js +31 -0
- package/dist/features/homepage/hooks/useFeaturedAuctions.d.ts +2 -0
- package/dist/features/homepage/hooks/useFeaturedAuctions.js +26 -0
- package/dist/features/homepage/hooks/useFeaturedPreOrders.d.ts +2 -0
- package/dist/features/homepage/hooks/useFeaturedPreOrders.js +26 -0
- package/dist/features/homepage/hooks/useFeaturedProducts.d.ts +4 -0
- package/dist/features/homepage/hooks/useFeaturedProducts.js +32 -0
- package/dist/features/homepage/hooks/useHeroCarousel.d.ts +9 -0
- package/dist/features/homepage/hooks/useHeroCarousel.js +17 -0
- package/dist/features/homepage/hooks/useHomepage.d.ts +11 -0
- package/dist/features/homepage/hooks/useHomepage.js +18 -0
- package/dist/features/homepage/hooks/useHomepageReviews.d.ts +7 -0
- package/dist/features/homepage/hooks/useHomepageReviews.js +16 -0
- package/dist/features/homepage/hooks/useHomepageSections.d.ts +2 -0
- package/dist/features/homepage/hooks/useHomepageSections.js +11 -0
- package/dist/features/homepage/hooks/useNewsletter.d.ts +14 -0
- package/dist/features/homepage/hooks/useNewsletter.js +10 -0
- package/dist/features/homepage/hooks/useTopBrands.d.ts +2 -0
- package/dist/features/homepage/hooks/useTopBrands.js +12 -0
- package/dist/features/homepage/hooks/useTopCategories.d.ts +4 -0
- package/dist/features/homepage/hooks/useTopCategories.js +13 -0
- package/dist/features/homepage/index.d.ts +13 -846
- package/dist/features/homepage/index.js +13 -6279
- package/dist/features/homepage/manifest.d.ts +2 -0
- package/dist/features/homepage/manifest.js +14 -0
- package/dist/features/homepage/messages/en.json +6 -0
- package/dist/features/homepage/repository/carousel.repository.d.ts +101 -0
- package/dist/features/homepage/repository/carousel.repository.js +252 -0
- package/dist/features/homepage/repository/homepage-sections.repository.d.ts +27 -0
- package/dist/features/homepage/repository/homepage-sections.repository.js +174 -0
- package/dist/features/homepage/repository/homepage.repository.d.ts +11 -0
- package/dist/features/homepage/repository/homepage.repository.js +25 -0
- package/dist/features/homepage/schemas/firestore.d.ts +251 -0
- package/dist/features/homepage/schemas/firestore.js +83 -0
- package/dist/features/homepage/schemas/index.d.ts +1 -0
- package/dist/features/homepage/schemas/index.js +1 -0
- package/dist/features/homepage/server.d.ts +10 -121
- package/dist/features/homepage/server.js +10 -1024
- package/dist/features/homepage/types/index.d.ts +163 -0
- package/dist/features/homepage/types/index.js +1 -0
- package/dist/features/layout/AutoBreadcrumbs.d.ts +15 -0
- package/dist/features/layout/AutoBreadcrumbs.js +84 -0
- package/dist/features/layout/BackToTop.d.ts +16 -0
- package/dist/features/layout/BackToTop.js +26 -0
- package/dist/features/layout/BottomActions.d.ts +1 -0
- package/dist/features/layout/BottomActions.js +153 -0
- package/dist/features/layout/BottomActionsContext.d.ts +107 -0
- package/dist/features/layout/BottomActionsContext.js +114 -0
- package/dist/features/layout/BottomNavItem.d.ts +28 -0
- package/dist/features/layout/BottomNavItem.js +28 -0
- package/dist/features/layout/BottomNavLayout.d.ts +14 -0
- package/dist/features/layout/BottomNavLayout.js +12 -0
- package/dist/features/layout/BottomNavbar.d.ts +46 -0
- package/dist/features/layout/BottomNavbar.js +19 -0
- package/dist/features/layout/BottomSheet.d.ts +29 -0
- package/dist/features/layout/BottomSheet.js +40 -0
- package/dist/features/layout/Breadcrumbs.d.ts +26 -0
- package/dist/features/layout/Breadcrumbs.js +25 -0
- package/dist/features/layout/DashboardNavContext.d.ts +19 -0
- package/dist/features/layout/DashboardNavContext.js +36 -0
- package/dist/features/layout/FooterLayout.d.ts +39 -0
- package/dist/features/layout/FooterLayout.js +12 -0
- package/dist/features/layout/LayoutClient.d.ts +11 -0
- package/dist/features/layout/LayoutClient.js +7 -0
- package/dist/features/layout/ListingLayout.d.ts +35 -0
- package/dist/features/layout/ListingLayout.js +104 -0
- package/dist/features/layout/LocaleSwitcher.d.ts +22 -0
- package/dist/features/layout/LocaleSwitcher.js +12 -0
- package/dist/features/layout/MainNavbar.d.ts +32 -0
- package/dist/features/layout/MainNavbar.js +29 -0
- package/dist/features/layout/NavItem.d.ts +19 -0
- package/dist/features/layout/NavItem.js +35 -0
- package/dist/features/layout/NavbarLayout.d.ts +27 -0
- package/dist/features/layout/NavbarLayout.js +23 -0
- package/dist/features/layout/SidebarLayout.d.ts +24 -0
- package/dist/features/layout/SidebarLayout.js +29 -0
- package/dist/features/layout/TitleBar.d.ts +18 -0
- package/dist/features/layout/TitleBar.js +19 -0
- package/dist/features/layout/TitleBarLayout.d.ts +48 -0
- package/dist/features/layout/TitleBarLayout.js +17 -0
- package/dist/features/layout/hooks/useBottomActions.d.ts +7 -0
- package/dist/features/layout/hooks/useBottomActions.js +28 -0
- package/dist/features/layout/index.d.ts +41 -315
- package/dist/features/layout/index.js +23 -1745
- package/dist/features/loyalty/api/admin/loyalty/grant/route.d.ts +12 -0
- package/dist/features/loyalty/api/admin/loyalty/grant/route.js +36 -0
- package/dist/features/loyalty/api/balance/route.d.ts +12 -0
- package/dist/features/loyalty/api/balance/route.js +39 -0
- package/dist/features/loyalty/api/earn/route.d.ts +12 -0
- package/dist/features/loyalty/api/earn/route.js +36 -0
- package/dist/features/loyalty/api/history/route.d.ts +12 -0
- package/dist/features/loyalty/api/history/route.js +56 -0
- package/dist/features/loyalty/api/redeem/route.d.ts +12 -0
- package/dist/features/loyalty/api/redeem/route.js +36 -0
- package/dist/features/loyalty/columns/index.d.ts +17 -0
- package/dist/features/loyalty/columns/index.js +40 -0
- package/dist/features/loyalty/components/CoinsDisplay.d.ts +11 -0
- package/dist/features/loyalty/components/CoinsDisplay.js +9 -0
- package/dist/features/loyalty/components/index.d.ts +1 -0
- package/dist/features/loyalty/components/index.js +1 -0
- package/dist/features/loyalty/hooks/useLoyaltyBalance.d.ts +4 -0
- package/dist/features/loyalty/hooks/useLoyaltyBalance.js +18 -0
- package/dist/features/loyalty/index.d.ts +6 -174
- package/dist/features/loyalty/index.js +6 -332
- package/dist/features/loyalty/manifest.d.ts +2 -0
- package/dist/features/loyalty/manifest.js +16 -0
- package/dist/features/loyalty/messages/en.json +19 -0
- package/dist/features/loyalty/repository/loyalty.repository.d.ts +8 -0
- package/dist/features/loyalty/repository/loyalty.repository.js +22 -0
- package/dist/features/loyalty/schemas/index.d.ts +85 -0
- package/dist/features/loyalty/schemas/index.js +40 -0
- package/dist/features/loyalty/server.d.ts +7 -0
- package/dist/features/loyalty/server.js +7 -0
- package/dist/features/loyalty/types/index.d.ts +31 -0
- package/dist/features/loyalty/types/index.js +1 -0
- package/dist/features/loyalty/types/loyalty-config.d.ts +7 -0
- package/dist/features/loyalty/types/loyalty-config.js +1 -0
- package/dist/features/loyalty/types/loyalty-math.d.ts +9 -0
- package/dist/features/loyalty/types/loyalty-math.js +27 -0
- package/dist/features/media/AvatarUpload.d.ts +22 -0
- package/dist/features/media/AvatarUpload.js +133 -0
- package/dist/features/media/MediaAvatar.d.ts +12 -0
- package/dist/features/media/MediaAvatar.js +13 -0
- package/dist/features/media/MediaImage.d.ts +28 -0
- package/dist/features/media/MediaImage.js +35 -0
- package/dist/features/media/MediaLightbox.d.ts +32 -0
- package/dist/features/media/MediaLightbox.js +245 -0
- package/dist/features/media/MediaVideo.d.ts +22 -0
- package/dist/features/media/MediaVideo.js +38 -0
- package/dist/features/media/components/MediaSlider.d.ts +10 -0
- package/dist/features/media/components/MediaSlider.js +12 -0
- package/dist/features/media/finalize.d.ts +11 -0
- package/dist/features/media/finalize.js +70 -0
- package/dist/features/media/hooks/useMedia.d.ts +198 -0
- package/dist/features/media/hooks/useMedia.js +78 -0
- package/dist/features/media/index.d.ts +30 -425
- package/dist/features/media/index.js +21 -3593
- package/dist/features/media/messages/en.json +63 -0
- package/dist/features/media/modals/ImageCropModal.d.ts +16 -0
- package/dist/features/media/modals/ImageCropModal.js +99 -0
- package/dist/features/media/modals/VideoThumbnailSelector.d.ts +10 -0
- package/dist/features/media/modals/VideoThumbnailSelector.js +51 -0
- package/dist/features/media/modals/VideoTrimModal.d.ts +11 -0
- package/dist/features/media/modals/VideoTrimModal.js +73 -0
- package/dist/features/media/server.d.ts +2 -0
- package/dist/features/media/server.js +2 -0
- package/dist/features/media/types/index.d.ts +29 -0
- package/dist/features/media/types/index.js +43 -0
- package/dist/features/media/upload/CameraCapture.d.ts +8 -0
- package/dist/features/media/upload/CameraCapture.js +59 -0
- package/dist/features/media/upload/ImageUpload.d.ts +14 -0
- package/dist/features/media/upload/ImageUpload.js +132 -0
- package/dist/features/media/upload/MediaUploadField.d.ts +31 -0
- package/dist/features/media/upload/MediaUploadField.js +204 -0
- package/dist/features/media/upload/MediaUploadList.d.ts +26 -0
- package/dist/features/media/upload/MediaUploadList.js +104 -0
- package/dist/features/orders/actions/index.d.ts +2 -0
- package/dist/features/orders/actions/index.js +2 -0
- package/dist/features/orders/actions/order-actions.d.ts +16 -0
- package/dist/features/orders/actions/order-actions.js +46 -0
- package/dist/features/orders/actions/refund-actions.d.ts +16 -0
- package/dist/features/orders/actions/refund-actions.js +88 -0
- package/dist/features/orders/api/track/[trackingId]/route.d.ts +17 -0
- package/dist/features/orders/api/track/[trackingId]/route.js +30 -0
- package/dist/features/orders/columns/index.d.ts +15 -0
- package/dist/features/orders/columns/index.js +34 -0
- package/dist/features/orders/components/MarketplaceOrderCard.d.ts +37 -0
- package/dist/features/orders/components/MarketplaceOrderCard.js +52 -0
- package/dist/features/orders/components/OrderFilters.d.ts +82 -0
- package/dist/features/orders/components/OrderFilters.js +106 -0
- package/dist/features/orders/components/OrdersList.d.ts +18 -0
- package/dist/features/orders/components/OrdersList.js +37 -0
- package/dist/features/orders/components/index.d.ts +4 -0
- package/dist/features/orders/components/index.js +3 -0
- package/dist/features/orders/hooks/useOrders.d.ts +32 -0
- package/dist/features/orders/hooks/useOrders.js +57 -0
- package/dist/features/orders/index.d.ts +7 -370
- package/dist/features/orders/index.js +7 -863
- package/dist/features/orders/manifest.d.ts +2 -0
- package/dist/features/orders/manifest.js +18 -0
- package/dist/features/orders/messages/en.json +15 -0
- package/dist/features/orders/repository/orders.repository.d.ts +188 -0
- package/dist/features/orders/repository/orders.repository.js +300 -0
- package/dist/features/orders/schemas/firestore.d.ts +129 -0
- package/dist/features/orders/schemas/firestore.js +96 -0
- package/dist/features/orders/schemas/index.d.ts +217 -0
- package/dist/features/orders/schemas/index.js +76 -0
- package/dist/features/orders/server.d.ts +9 -0
- package/dist/features/orders/server.js +10 -0
- package/dist/features/orders/types/index.d.ts +69 -0
- package/dist/features/orders/types/index.js +2 -0
- package/dist/features/orders/utils/order-splitter.d.ts +14 -0
- package/dist/features/orders/utils/order-splitter.js +29 -0
- package/dist/features/payments/columns/index.d.ts +17 -0
- package/dist/features/payments/columns/index.js +45 -0
- package/dist/features/payments/hooks/usePaymentEvent.d.ts +17 -0
- package/dist/features/payments/hooks/usePaymentEvent.js +26 -0
- package/dist/features/payments/hooks/usePayments.d.ts +10 -0
- package/dist/features/payments/hooks/usePayments.js +19 -0
- package/dist/features/payments/index.d.ts +6 -141
- package/dist/features/payments/index.js +6 -331
- package/dist/features/payments/manifest.d.ts +2 -0
- package/dist/features/payments/manifest.js +12 -0
- package/dist/features/payments/messages/en.json +11 -0
- package/dist/features/payments/repository/payments.repository.d.ts +15 -0
- package/dist/features/payments/repository/payments.repository.js +36 -0
- package/dist/features/payments/repository/payout.repository.d.ts +111 -0
- package/dist/features/payments/repository/payout.repository.js +202 -0
- package/dist/features/payments/schemas/firestore.d.ts +74 -0
- package/dist/features/payments/schemas/firestore.js +65 -0
- package/dist/features/payments/schemas/index.d.ts +77 -0
- package/dist/features/payments/schemas/index.js +67 -0
- package/dist/features/payments/server.d.ts +8 -0
- package/dist/features/payments/server.js +8 -0
- package/dist/features/payments/types/index.d.ts +36 -0
- package/dist/features/payments/types/index.js +2 -0
- package/dist/features/pre-orders/api/[id]/route.d.ts +26 -0
- package/dist/features/pre-orders/api/[id]/route.js +88 -0
- package/dist/features/pre-orders/api/[slug]/route.d.ts +16 -0
- package/dist/features/pre-orders/api/[slug]/route.js +41 -0
- package/dist/features/pre-orders/api/admin/[id]/route.d.ts +21 -0
- package/dist/features/pre-orders/api/admin/[id]/route.js +65 -0
- package/dist/features/pre-orders/api/admin/route.d.ts +12 -0
- package/dist/features/pre-orders/api/admin/route.js +56 -0
- package/dist/features/pre-orders/api/route.d.ts +13 -0
- package/dist/features/pre-orders/api/route.js +77 -0
- package/dist/features/pre-orders/columns/index.d.ts +17 -0
- package/dist/features/pre-orders/columns/index.js +68 -0
- package/dist/features/pre-orders/components/MarketplacePreorderCard.d.ts +24 -0
- package/dist/features/pre-orders/components/MarketplacePreorderCard.js +53 -0
- package/dist/features/pre-orders/components/PreOrderBadge.d.ts +14 -0
- package/dist/features/pre-orders/components/PreOrderBadge.js +17 -0
- package/dist/features/pre-orders/components/PreorderCard.d.ts +12 -0
- package/dist/features/pre-orders/components/PreorderCard.js +27 -0
- package/dist/features/pre-orders/components/index.d.ts +2 -0
- package/dist/features/pre-orders/components/index.js +2 -0
- package/dist/features/pre-orders/hooks/usePreOrders.d.ts +7 -0
- package/dist/features/pre-orders/hooks/usePreOrders.js +34 -0
- package/dist/features/pre-orders/index.d.ts +6 -170
- package/dist/features/pre-orders/index.js +6 -538
- package/dist/features/pre-orders/manifest.d.ts +2 -0
- package/dist/features/pre-orders/manifest.js +17 -0
- package/dist/features/pre-orders/messages/en.json +13 -0
- package/dist/features/pre-orders/repository/pre-orders.repository.d.ts +14 -0
- package/dist/features/pre-orders/repository/pre-orders.repository.js +44 -0
- package/dist/features/pre-orders/repository/preorders.repository.d.ts +8 -0
- package/dist/features/pre-orders/repository/preorders.repository.js +21 -0
- package/dist/features/pre-orders/schemas/index.d.ts +79 -0
- package/dist/features/pre-orders/schemas/index.js +27 -0
- package/dist/features/pre-orders/server.d.ts +5 -14
- package/dist/features/pre-orders/server.js +8 -106
- package/dist/features/pre-orders/types/index.d.ts +29 -0
- package/dist/features/pre-orders/types/index.js +12 -0
- package/dist/features/products/actions/index.d.ts +1 -0
- package/dist/features/products/actions/index.js +1 -0
- package/dist/features/products/actions/product-actions.d.ts +26 -0
- package/dist/features/products/actions/product-actions.js +111 -0
- package/dist/features/products/api/[id]/route.d.ts +29 -0
- package/dist/features/products/api/[id]/route.js +137 -0
- package/dist/features/products/api/route.d.ts +19 -0
- package/dist/features/products/api/route.js +214 -0
- package/dist/features/products/columns/index.d.ts +64 -0
- package/dist/features/products/columns/index.js +85 -0
- package/dist/features/products/columns/productTableColumns.d.ts +27 -0
- package/dist/features/products/columns/productTableColumns.js +88 -0
- package/dist/features/products/components/AuctionDetailView.d.ts +13 -0
- package/dist/features/products/components/AuctionDetailView.js +9 -0
- package/dist/features/products/components/AuctionsView.d.ts +6 -0
- package/dist/features/products/components/AuctionsView.js +5 -0
- package/dist/features/products/components/BidHistory.d.ts +28 -0
- package/dist/features/products/components/BidHistory.js +18 -0
- package/dist/features/products/components/BuyBar.d.ts +21 -0
- package/dist/features/products/components/BuyBar.js +20 -0
- package/dist/features/products/components/InteractiveProductCard.d.ts +19 -0
- package/dist/features/products/components/InteractiveProductCard.js +18 -0
- package/dist/features/products/components/MakeOfferForm.d.ts +20 -0
- package/dist/features/products/components/MakeOfferForm.js +8 -0
- package/dist/features/products/components/PlaceBidForm.d.ts +20 -0
- package/dist/features/products/components/PlaceBidForm.js +6 -0
- package/dist/features/products/components/PreOrderDetailView.d.ts +14 -0
- package/dist/features/products/components/PreOrderDetailView.js +9 -0
- package/dist/features/products/components/PreOrdersView.d.ts +6 -0
- package/dist/features/products/components/PreOrdersView.js +5 -0
- package/dist/features/products/components/ProductDetailView.d.ts +11 -0
- package/dist/features/products/components/ProductDetailView.js +9 -0
- package/dist/features/products/components/ProductFeatureBadges.d.ts +32 -0
- package/dist/features/products/components/ProductFeatureBadges.js +103 -0
- package/dist/features/products/components/ProductFilters.d.ts +90 -0
- package/dist/features/products/components/ProductFilters.js +105 -0
- package/dist/features/products/components/ProductForm.d.ts +47 -0
- package/dist/features/products/components/ProductForm.js +120 -0
- package/dist/features/products/components/ProductGrid.d.ts +69 -0
- package/dist/features/products/components/ProductGrid.js +92 -0
- package/dist/features/products/components/ProductInfo.d.ts +20 -0
- package/dist/features/products/components/ProductInfo.js +4 -0
- package/dist/features/products/components/ProductTabs.d.ts +21 -0
- package/dist/features/products/components/ProductTabs.js +22 -0
- package/dist/features/products/components/ProductsView.d.ts +6 -0
- package/dist/features/products/components/ProductsView.js +5 -0
- package/dist/features/products/components/RelatedProducts.d.ts +16 -0
- package/dist/features/products/components/RelatedProducts.js +12 -0
- package/dist/features/products/components/index.d.ts +34 -0
- package/dist/features/products/components/index.js +18 -0
- package/dist/features/products/hooks/useBrands.d.ts +9 -0
- package/dist/features/products/hooks/useBrands.js +15 -0
- package/dist/features/products/hooks/useProductDetail.d.ts +15 -0
- package/dist/features/products/hooks/useProductDetail.js +29 -0
- package/dist/features/products/hooks/useProducts.d.ts +43 -0
- package/dist/features/products/hooks/useProducts.js +67 -0
- package/dist/features/products/hooks/useRelatedProducts.d.ts +2 -0
- package/dist/features/products/hooks/useRelatedProducts.js +17 -0
- package/dist/features/products/index.d.ts +10 -1066
- package/dist/features/products/index.js +10 -2475
- package/dist/features/products/manifest.d.ts +2 -0
- package/dist/features/products/manifest.js +16 -0
- package/dist/features/products/messages/en.json +11 -0
- package/dist/features/products/repository/products.repository.d.ts +213 -0
- package/dist/features/products/repository/products.repository.js +300 -0
- package/dist/features/products/schemas/firestore.d.ts +125 -0
- package/dist/features/products/schemas/firestore.js +149 -0
- package/dist/features/products/schemas/index.d.ts +400 -0
- package/dist/features/products/schemas/index.js +173 -0
- package/dist/features/products/server.d.ts +7 -49
- package/dist/features/products/server.js +10 -803
- package/dist/features/products/types/index.d.ts +122 -0
- package/dist/features/products/types/index.js +1 -0
- package/dist/features/products/utils/listing-type.d.ts +2 -0
- package/dist/features/products/utils/listing-type.js +9 -0
- package/dist/features/promotions/actions/coupon-actions.d.ts +28 -0
- package/dist/features/promotions/actions/coupon-actions.js +23 -0
- package/dist/features/promotions/actions/index.d.ts +3 -0
- package/dist/features/promotions/actions/index.js +3 -0
- package/dist/features/promotions/actions/promotions-actions.d.ts +18 -0
- package/dist/features/promotions/actions/promotions-actions.js +37 -0
- package/dist/features/promotions/actions/seller-coupon-actions.d.ts +41 -0
- package/dist/features/promotions/actions/seller-coupon-actions.js +92 -0
- package/dist/features/promotions/api/route.d.ts +21 -0
- package/dist/features/promotions/api/route.js +85 -0
- package/dist/features/promotions/columns/index.d.ts +12 -0
- package/dist/features/promotions/columns/index.js +45 -0
- package/dist/features/promotions/components/CouponCard.d.ts +16 -0
- package/dist/features/promotions/components/CouponCard.js +20 -0
- package/dist/features/promotions/components/PromotionsView.d.ts +43 -0
- package/dist/features/promotions/components/PromotionsView.js +10 -0
- package/dist/features/promotions/components/index.d.ts +3 -0
- package/dist/features/promotions/components/index.js +2 -0
- package/dist/features/promotions/hooks/useCouponValidate.d.ts +22 -0
- package/dist/features/promotions/hooks/useCouponValidate.js +10 -0
- package/dist/features/promotions/hooks/usePromotions.d.ts +21 -0
- package/dist/features/promotions/hooks/usePromotions.js +49 -0
- package/dist/features/promotions/index.d.ts +7 -301
- package/dist/features/promotions/index.js +7 -957
- package/dist/features/promotions/manifest.d.ts +2 -0
- package/dist/features/promotions/manifest.js +14 -0
- package/dist/features/promotions/messages/en.json +20 -0
- package/dist/features/promotions/repository/coupons.repository.d.ts +224 -0
- package/dist/features/promotions/repository/coupons.repository.js +539 -0
- package/dist/features/promotions/repository/promotions.repository.d.ts +14 -0
- package/dist/features/promotions/repository/promotions.repository.js +43 -0
- package/dist/features/promotions/schemas/firestore.d.ts +105 -0
- package/dist/features/promotions/schemas/firestore.js +124 -0
- package/dist/features/promotions/schemas/index.d.ts +117 -0
- package/dist/features/promotions/schemas/index.js +58 -0
- package/dist/features/promotions/server.d.ts +10 -0
- package/dist/features/promotions/server.js +10 -0
- package/dist/features/promotions/types/index.d.ts +51 -0
- package/dist/features/promotions/types/index.js +2 -0
- package/dist/features/reviews/actions/index.d.ts +1 -0
- package/dist/features/reviews/actions/index.js +1 -0
- package/dist/features/reviews/actions/review-actions.d.ts +40 -0
- package/dist/features/reviews/actions/review-actions.js +182 -0
- package/dist/features/reviews/api/[id]/route.d.ts +23 -0
- package/dist/features/reviews/api/[id]/route.js +109 -0
- package/dist/features/reviews/api/route.d.ts +21 -0
- package/dist/features/reviews/api/route.js +171 -0
- package/dist/features/reviews/columns/index.d.ts +15 -0
- package/dist/features/reviews/columns/index.js +44 -0
- package/dist/features/reviews/components/ReviewFilters.d.ts +74 -0
- package/dist/features/reviews/components/ReviewFilters.js +60 -0
- package/dist/features/reviews/components/ReviewModal.d.ts +11 -0
- package/dist/features/reviews/components/ReviewModal.js +25 -0
- package/dist/features/reviews/components/ReviewSummary.d.ts +16 -0
- package/dist/features/reviews/components/ReviewSummary.js +20 -0
- package/dist/features/reviews/components/ReviewsList.d.ts +15 -0
- package/dist/features/reviews/components/ReviewsList.js +25 -0
- package/dist/features/reviews/components/ReviewsListView.d.ts +31 -0
- package/dist/features/reviews/components/ReviewsListView.js +16 -0
- package/dist/features/reviews/components/index.d.ts +10 -0
- package/dist/features/reviews/components/index.js +5 -0
- package/dist/features/reviews/hooks/useCreateReview.d.ts +12 -0
- package/dist/features/reviews/hooks/useCreateReview.js +20 -0
- package/dist/features/reviews/hooks/useReviews.d.ts +34 -0
- package/dist/features/reviews/hooks/useReviews.js +49 -0
- package/dist/features/reviews/index.d.ts +7 -434
- package/dist/features/reviews/index.js +7 -2297
- package/dist/features/reviews/manifest.d.ts +2 -0
- package/dist/features/reviews/manifest.js +10 -0
- package/dist/features/reviews/messages/en.json +10 -0
- package/dist/features/reviews/repository/reviews.repository.d.ts +103 -0
- package/dist/features/reviews/repository/reviews.repository.js +214 -0
- package/dist/features/reviews/schemas/firestore.d.ts +67 -0
- package/dist/features/reviews/schemas/firestore.js +59 -0
- package/dist/features/reviews/schemas/index.d.ts +183 -0
- package/dist/features/reviews/schemas/index.js +68 -0
- package/dist/features/reviews/server.d.ts +7 -46
- package/dist/features/reviews/server.js +10 -769
- package/dist/features/reviews/types/index.d.ts +62 -0
- package/dist/features/reviews/types/index.js +1 -0
- package/dist/features/search/actions/index.d.ts +1 -0
- package/dist/features/search/actions/index.js +1 -0
- package/dist/features/search/actions/search-actions.d.ts +18 -0
- package/dist/features/search/actions/search-actions.js +43 -0
- package/dist/features/search/api/route.d.ts +22 -0
- package/dist/features/search/api/route.js +79 -0
- package/dist/features/search/columns/index.d.ts +17 -0
- package/dist/features/search/columns/index.js +49 -0
- package/dist/features/search/components/Search.d.ts +41 -0
- package/dist/features/search/components/Search.js +263 -0
- package/dist/features/search/components/SearchFiltersRow.d.ts +22 -0
- package/dist/features/search/components/SearchFiltersRow.js +21 -0
- package/dist/features/search/components/SearchResultsSection.d.ts +53 -0
- package/dist/features/search/components/SearchResultsSection.js +36 -0
- package/dist/features/search/components/SearchView.d.ts +29 -0
- package/dist/features/search/components/SearchView.js +8 -0
- package/dist/features/search/components/index.d.ts +8 -0
- package/dist/features/search/components/index.js +4 -0
- package/dist/features/search/hooks/useNavSuggestions.d.ts +11 -0
- package/dist/features/search/hooks/useNavSuggestions.js +32 -0
- package/dist/features/search/hooks/useSearch.d.ts +21 -0
- package/dist/features/search/hooks/useSearch.js +34 -0
- package/dist/features/search/index.d.ts +7 -298
- package/dist/features/search/index.js +7 -1351
- package/dist/features/search/manifest.d.ts +2 -0
- package/dist/features/search/manifest.js +10 -0
- package/dist/features/search/messages/en.json +15 -0
- package/dist/features/search/repository/search.repository.d.ts +14 -0
- package/dist/features/search/repository/search.repository.js +59 -0
- package/dist/features/search/schemas/index.d.ts +70 -0
- package/dist/features/search/schemas/index.js +34 -0
- package/dist/features/search/server.d.ts +5 -83
- package/dist/features/search/server.js +5 -149
- package/dist/features/search/types/index.d.ts +46 -0
- package/dist/features/search/types/index.js +2 -0
- package/dist/features/seller/actions/index.d.ts +2 -0
- package/dist/features/seller/actions/index.js +2 -0
- package/dist/features/seller/actions/offer-actions.d.ts +32 -0
- package/dist/features/seller/actions/offer-actions.js +266 -0
- package/dist/features/seller/actions/seller-actions.d.ts +172 -0
- package/dist/features/seller/actions/seller-actions.js +480 -0
- package/dist/features/seller/api/coupons/route.d.ts +17 -0
- package/dist/features/seller/api/coupons/route.js +47 -0
- package/dist/features/seller/api/offers/route.d.ts +17 -0
- package/dist/features/seller/api/offers/route.js +63 -0
- package/dist/features/seller/api/products/route.d.ts +17 -0
- package/dist/features/seller/api/products/route.js +64 -0
- package/dist/features/seller/api/store/route.d.ts +17 -0
- package/dist/features/seller/api/store/route.js +34 -0
- package/dist/features/seller/columns/index.d.ts +22 -0
- package/dist/features/seller/columns/index.js +73 -0
- package/dist/features/seller/components/SellerAddressesView.d.ts +13 -0
- package/dist/features/seller/components/SellerAddressesView.js +5 -0
- package/dist/features/seller/components/SellerAnalyticsView.d.ts +13 -0
- package/dist/features/seller/components/SellerAnalyticsView.js +17 -0
- package/dist/features/seller/components/SellerAuctionsView.d.ts +6 -0
- package/dist/features/seller/components/SellerAuctionsView.js +5 -0
- package/dist/features/seller/components/SellerCouponsView.d.ts +6 -0
- package/dist/features/seller/components/SellerCouponsView.js +5 -0
- package/dist/features/seller/components/SellerCreateProductView.d.ts +11 -0
- package/dist/features/seller/components/SellerCreateProductView.js +5 -0
- package/dist/features/seller/components/SellerDashboardView.d.ts +14 -0
- package/dist/features/seller/components/SellerDashboardView.js +11 -0
- package/dist/features/seller/components/SellerEditProductView.d.ts +11 -0
- package/dist/features/seller/components/SellerEditProductView.js +5 -0
- package/dist/features/seller/components/SellerGuideView.d.ts +12 -0
- package/dist/features/seller/components/SellerGuideView.js +5 -0
- package/dist/features/seller/components/SellerOffersView.d.ts +4 -0
- package/dist/features/seller/components/SellerOffersView.js +5 -0
- package/dist/features/seller/components/SellerOrdersView.d.ts +4 -0
- package/dist/features/seller/components/SellerOrdersView.js +5 -0
- package/dist/features/seller/components/SellerPayoutHistoryTable.d.ts +14 -0
- package/dist/features/seller/components/SellerPayoutHistoryTable.js +10 -0
- package/dist/features/seller/components/SellerPayoutSettingsView.d.ts +11 -0
- package/dist/features/seller/components/SellerPayoutSettingsView.js +5 -0
- package/dist/features/seller/components/SellerPayoutStats.d.ts +8 -0
- package/dist/features/seller/components/SellerPayoutStats.js +9 -0
- package/dist/features/seller/components/SellerPayoutsView.d.ts +18 -0
- package/dist/features/seller/components/SellerPayoutsView.js +11 -0
- package/dist/features/seller/components/SellerProductsView.d.ts +6 -0
- package/dist/features/seller/components/SellerProductsView.js +5 -0
- package/dist/features/seller/components/SellerShippingView.d.ts +12 -0
- package/dist/features/seller/components/SellerShippingView.js +5 -0
- package/dist/features/seller/components/SellerSidebar.d.ts +16 -0
- package/dist/features/seller/components/SellerSidebar.js +11 -0
- package/dist/features/seller/components/SellerStatCard.d.ts +14 -0
- package/dist/features/seller/components/SellerStatCard.js +5 -0
- package/dist/features/seller/components/SellerStoreSetupView.d.ts +12 -0
- package/dist/features/seller/components/SellerStoreSetupView.js +8 -0
- package/dist/features/seller/components/SellerStoreView.d.ts +8 -0
- package/dist/features/seller/components/SellerStoreView.js +8 -0
- package/dist/features/seller/components/SellerStorefrontView.d.ts +13 -0
- package/dist/features/seller/components/SellerStorefrontView.js +10 -0
- package/dist/features/seller/components/SellersListView.d.ts +4 -0
- package/dist/features/seller/components/SellersListView.js +5 -0
- package/dist/features/seller/components/analytics/SellerAnalyticsStats.d.ts +14 -0
- package/dist/features/seller/components/analytics/SellerAnalyticsStats.js +9 -0
- package/dist/features/seller/components/analytics/SellerRevenueChart.d.ts +13 -0
- package/dist/features/seller/components/analytics/SellerRevenueChart.js +28 -0
- package/dist/features/seller/components/analytics/SellerTopProducts.d.ts +17 -0
- package/dist/features/seller/components/analytics/SellerTopProducts.js +6 -0
- package/dist/features/seller/components/analytics/index.d.ts +3 -0
- package/dist/features/seller/components/analytics/index.js +3 -0
- package/dist/features/seller/components/index.d.ts +44 -0
- package/dist/features/seller/components/index.js +23 -0
- package/dist/features/seller/hooks/useBecomeSeller.d.ts +12 -0
- package/dist/features/seller/hooks/useBecomeSeller.js +26 -0
- package/dist/features/seller/hooks/useSellerPayouts.d.ts +25 -0
- package/dist/features/seller/hooks/useSellerPayouts.js +42 -0
- package/dist/features/seller/hooks/useSellerStore.d.ts +28 -0
- package/dist/features/seller/hooks/useSellerStore.js +48 -0
- package/dist/features/seller/hooks/useSellerStorefront.d.ts +16 -0
- package/dist/features/seller/hooks/useSellerStorefront.js +57 -0
- package/dist/features/seller/index.d.ts +10 -926
- package/dist/features/seller/index.js +10 -2029
- package/dist/features/seller/manifest.d.ts +2 -0
- package/dist/features/seller/manifest.js +74 -0
- package/dist/features/seller/messages/en.json +32 -0
- package/dist/features/seller/permission-map.d.ts +3 -0
- package/dist/features/seller/permission-map.js +15 -0
- package/dist/features/seller/repository/offer.repository.d.ts +66 -0
- package/dist/features/seller/repository/offer.repository.js +210 -0
- package/dist/features/seller/repository/seller.repository.d.ts +22 -0
- package/dist/features/seller/repository/seller.repository.js +72 -0
- package/dist/features/seller/schemas/firestore.d.ts +76 -0
- package/dist/features/seller/schemas/firestore.js +57 -0
- package/dist/features/seller/schemas/index.d.ts +244 -0
- package/dist/features/seller/schemas/index.js +100 -0
- package/dist/features/seller/server.d.ts +13 -0
- package/dist/features/seller/server.js +13 -0
- package/dist/features/seller/types/index.d.ts +147 -0
- package/dist/features/seller/types/index.js +2 -0
- package/dist/features/stores/actions/index.d.ts +2 -0
- package/dist/features/stores/actions/index.js +2 -0
- package/dist/features/stores/actions/store-address-actions.d.ts +11 -0
- package/dist/features/stores/actions/store-address-actions.js +54 -0
- package/dist/features/stores/actions/store-query-actions.d.ts +34 -0
- package/dist/features/stores/actions/store-query-actions.js +113 -0
- package/dist/features/stores/api/[storeSlug]/auctions/route.d.ts +23 -0
- package/dist/features/stores/api/[storeSlug]/auctions/route.js +92 -0
- package/dist/features/stores/api/[storeSlug]/products/route.d.ts +23 -0
- package/dist/features/stores/api/[storeSlug]/products/route.js +97 -0
- package/dist/features/stores/api/[storeSlug]/reviews/route.d.ts +23 -0
- package/dist/features/stores/api/[storeSlug]/reviews/route.js +101 -0
- package/dist/features/stores/api/[storeSlug]/route.d.ts +21 -0
- package/dist/features/stores/api/[storeSlug]/route.js +66 -0
- package/dist/features/stores/api/route.d.ts +12 -0
- package/dist/features/stores/api/route.js +101 -0
- package/dist/features/stores/columns/index.d.ts +16 -0
- package/dist/features/stores/columns/index.js +45 -0
- package/dist/features/stores/components/InteractiveStoreCard.d.ts +20 -0
- package/dist/features/stores/components/InteractiveStoreCard.js +16 -0
- package/dist/features/stores/components/StoreAboutView.d.ts +21 -0
- package/dist/features/stores/components/StoreAboutView.js +12 -0
- package/dist/features/stores/components/StoreAddressSelectorCreate.d.ts +16 -0
- package/dist/features/stores/components/StoreAddressSelectorCreate.js +40 -0
- package/dist/features/stores/components/StoreAuctionsView.d.ts +17 -0
- package/dist/features/stores/components/StoreAuctionsView.js +5 -0
- package/dist/features/stores/components/StoreHeader.d.ts +15 -0
- package/dist/features/stores/components/StoreHeader.js +8 -0
- package/dist/features/stores/components/StoreNavTabs.d.ts +15 -0
- package/dist/features/stores/components/StoreNavTabs.js +14 -0
- package/dist/features/stores/components/StoreProductsView.d.ts +30 -0
- package/dist/features/stores/components/StoreProductsView.js +11 -0
- package/dist/features/stores/components/StoreReviewsView.d.ts +17 -0
- package/dist/features/stores/components/StoreReviewsView.js +9 -0
- package/dist/features/stores/components/StoresListView.d.ts +19 -0
- package/dist/features/stores/components/StoresListView.js +24 -0
- package/dist/features/stores/components/index.d.ts +16 -0
- package/dist/features/stores/components/index.js +9 -0
- package/dist/features/stores/hooks/useStoreAddressSelector.d.ts +23 -0
- package/dist/features/stores/hooks/useStoreAddressSelector.js +30 -0
- package/dist/features/stores/hooks/useStores.d.ts +58 -0
- package/dist/features/stores/hooks/useStores.js +96 -0
- package/dist/features/stores/index.d.ts +7 -536
- package/dist/features/stores/index.js +7 -1911
- package/dist/features/stores/manifest.d.ts +2 -0
- package/dist/features/stores/manifest.js +35 -0
- package/dist/features/stores/messages/en.json +21 -0
- package/dist/features/stores/repository/store-address.repository.d.ts +55 -0
- package/dist/features/stores/repository/store-address.repository.js +188 -0
- package/dist/features/stores/repository/store.repository.d.ts +67 -0
- package/dist/features/stores/repository/store.repository.js +181 -0
- package/dist/features/stores/repository/stores.repository.d.ts +11 -0
- package/dist/features/stores/repository/stores.repository.js +34 -0
- package/dist/features/stores/schemas/firestore.d.ts +117 -0
- package/dist/features/stores/schemas/firestore.js +109 -0
- package/dist/features/stores/schemas/index.d.ts +85 -0
- package/dist/features/stores/schemas/index.js +48 -0
- package/dist/features/stores/server.d.ts +12 -103
- package/dist/features/stores/server.js +15 -444
- package/dist/features/stores/types/index.d.ts +102 -0
- package/dist/features/stores/types/index.js +2 -0
- package/dist/features/whatsapp-bot/api/send-status/route.d.ts +12 -0
- package/dist/features/whatsapp-bot/api/send-status/route.js +36 -0
- package/dist/features/whatsapp-bot/api/webhook/route.d.ts +12 -0
- package/dist/features/whatsapp-bot/api/webhook/route.js +41 -0
- package/dist/features/whatsapp-bot/components/WhatsAppChatButton.d.ts +8 -0
- package/dist/features/whatsapp-bot/components/WhatsAppChatButton.js +7 -0
- package/dist/features/whatsapp-bot/components/index.d.ts +1 -0
- package/dist/features/whatsapp-bot/components/index.js +1 -0
- package/dist/features/whatsapp-bot/helpers/whatsapp.d.ts +21 -0
- package/dist/features/whatsapp-bot/helpers/whatsapp.js +125 -0
- package/dist/features/whatsapp-bot/index.d.ts +3 -85
- package/dist/features/whatsapp-bot/index.js +3 -154
- package/dist/features/whatsapp-bot/manifest.d.ts +2 -0
- package/dist/features/whatsapp-bot/manifest.js +13 -0
- package/dist/features/whatsapp-bot/messages/en.json +7 -0
- package/dist/features/whatsapp-bot/server.d.ts +7 -0
- package/dist/features/whatsapp-bot/server.js +7 -0
- package/dist/features/whatsapp-bot/types/index.d.ts +50 -0
- package/dist/features/whatsapp-bot/types/index.js +1 -0
- package/dist/features/wishlist/actions/index.d.ts +1 -0
- package/dist/features/wishlist/actions/index.js +1 -0
- package/dist/features/wishlist/actions/wishlist-actions.d.ts +20 -0
- package/dist/features/wishlist/actions/wishlist-actions.js +29 -0
- package/dist/features/wishlist/columns/index.d.ts +17 -0
- package/dist/features/wishlist/columns/index.js +42 -0
- package/dist/features/wishlist/components/WishlistPage.d.ts +16 -0
- package/dist/features/wishlist/components/WishlistPage.js +17 -0
- package/dist/features/wishlist/components/WishlistToggleButton.d.ts +12 -0
- package/dist/features/wishlist/components/WishlistToggleButton.js +21 -0
- package/dist/features/wishlist/components/WishlistView.d.ts +33 -0
- package/dist/features/wishlist/components/WishlistView.js +41 -0
- package/dist/features/wishlist/components/index.d.ts +4 -0
- package/dist/features/wishlist/components/index.js +3 -0
- package/dist/features/wishlist/hooks/useUserWishlist.d.ts +187 -0
- package/dist/features/wishlist/hooks/useUserWishlist.js +17 -0
- package/dist/features/wishlist/hooks/useWishlist.d.ts +16 -0
- package/dist/features/wishlist/hooks/useWishlist.js +23 -0
- package/dist/features/wishlist/hooks/useWishlistToggle.d.ts +10 -0
- package/dist/features/wishlist/hooks/useWishlistToggle.js +32 -0
- package/dist/features/wishlist/index.d.ts +9 -360
- package/dist/features/wishlist/index.js +8 -888
- package/dist/features/wishlist/manifest.d.ts +2 -0
- package/dist/features/wishlist/manifest.js +12 -0
- package/dist/features/wishlist/messages/en.json +7 -0
- package/dist/features/wishlist/repository/user-wishlist.repository.d.ts +14 -0
- package/dist/features/wishlist/repository/user-wishlist.repository.js +91 -0
- package/dist/features/wishlist/repository/wishlist.repository.d.ts +13 -0
- package/dist/features/wishlist/repository/wishlist.repository.js +31 -0
- package/dist/features/wishlist/schemas/index.d.ts +46 -0
- package/dist/features/wishlist/schemas/index.js +24 -0
- package/dist/features/wishlist/server.d.ts +9 -0
- package/dist/features/wishlist/server.js +9 -0
- package/dist/features/wishlist/types/index.d.ts +16 -0
- package/dist/features/wishlist/types/index.js +1 -0
- package/dist/http/ApiClient.d.ts +59 -0
- package/dist/http/ApiClient.js +149 -0
- package/dist/http/api-handler.d.ts +33 -0
- package/dist/http/api-handler.js +89 -0
- package/dist/http/index.d.ts +6 -58
- package/dist/http/index.js +8 -4
- package/dist/index.d.ts +1 -17
- package/dist/index.js +1 -13
- package/dist/instrumentation/index.d.ts +4 -6
- package/dist/instrumentation/index.js +54 -14
- package/dist/monitoring/analytics.d.ts +79 -0
- package/dist/monitoring/analytics.js +171 -0
- package/dist/monitoring/browser.d.ts +10 -0
- package/dist/monitoring/browser.js +6 -0
- package/dist/monitoring/cache-metrics.d.ts +24 -0
- package/dist/monitoring/cache-metrics.js +83 -0
- package/dist/monitoring/client-logger.d.ts +29 -0
- package/dist/monitoring/client-logger.js +127 -0
- package/dist/monitoring/error-tracking.d.ts +50 -0
- package/dist/monitoring/error-tracking.js +54 -0
- package/dist/monitoring/index.d.ts +12 -181
- package/dist/monitoring/index.js +7 -8
- package/dist/monitoring/performance.d.ts +31 -0
- package/dist/monitoring/performance.js +34 -0
- package/dist/monitoring/runtime.d.ts +17 -0
- package/dist/monitoring/runtime.js +28 -0
- package/dist/monitoring/server-logger.d.ts +37 -0
- package/dist/monitoring/server-logger.js +289 -0
- package/dist/next/ErrorBoundary.d.ts +19 -0
- package/dist/next/ErrorBoundary.js +35 -0
- package/dist/next/IAuthVerifier.d.ts +54 -0
- package/dist/next/IAuthVerifier.js +23 -0
- package/dist/next/api/api-response.d.ts +29 -0
- package/dist/next/api/api-response.js +31 -0
- package/dist/next/api/apiHandler.d.ts +48 -0
- package/dist/next/api/apiHandler.js +87 -0
- package/dist/next/api/errorHandler.d.ts +57 -0
- package/dist/next/api/errorHandler.js +72 -0
- package/dist/next/api/routeHandler.d.ts +60 -0
- package/dist/next/api/routeHandler.js +113 -0
- package/dist/next/cache-middleware.d.ts +35 -0
- package/dist/next/cache-middleware.js +77 -0
- package/dist/next/components/ErrorView.d.ts +13 -0
- package/dist/next/components/ErrorView.js +32 -0
- package/dist/next/components/GlobalError.d.ts +7 -0
- package/dist/next/components/GlobalError.js +43 -0
- package/dist/next/components/NotFoundView.d.ts +28 -0
- package/dist/next/components/NotFoundView.js +25 -0
- package/dist/next/components/UnauthorizedView.d.ts +28 -0
- package/dist/next/components/UnauthorizedView.js +22 -0
- package/dist/next/index.d.ts +34 -776
- package/dist/next/index.js +30 -646
- package/dist/next/middleware/chain.d.ts +47 -0
- package/dist/next/middleware/chain.js +80 -0
- package/dist/next/middleware/index.d.ts +6 -0
- package/dist/next/middleware/index.js +3 -0
- package/dist/next/middleware/pii-redactor.d.ts +32 -0
- package/dist/next/middleware/pii-redactor.js +82 -0
- package/dist/next/middleware/pii-scrubber.d.ts +11 -0
- package/dist/next/middleware/pii-scrubber.js +43 -0
- package/dist/next/middleware/types.d.ts +18 -0
- package/dist/next/middleware/types.js +1 -0
- package/dist/next/request-helpers.d.ts +25 -0
- package/dist/next/request-helpers.js +52 -0
- package/dist/next/routing/route-map.d.ts +272 -0
- package/dist/next/routing/route-map.js +202 -0
- package/dist/providers/auth-firebase/browser-stub.d.ts +24 -0
- package/dist/providers/auth-firebase/browser-stub.js +28 -0
- package/dist/providers/auth-firebase/helpers.d.ts +83 -0
- package/dist/providers/auth-firebase/helpers.js +205 -0
- package/dist/providers/auth-firebase/index.d.ts +7 -133
- package/dist/providers/auth-firebase/index.js +16 -370
- package/dist/providers/auth-firebase/provider.d.ts +8 -0
- package/dist/providers/auth-firebase/provider.js +118 -0
- package/dist/providers/auth-firebase/session.d.ts +19 -0
- package/dist/providers/auth-firebase/session.js +86 -0
- package/dist/providers/db-firebase/admin-app-lite.d.ts +6 -0
- package/dist/providers/db-firebase/admin-app-lite.js +50 -0
- package/dist/providers/db-firebase/admin-auth-lite.d.ts +5 -0
- package/dist/providers/db-firebase/admin-auth-lite.js +10 -0
- package/dist/providers/db-firebase/admin-storage-lite.d.ts +6 -0
- package/dist/providers/db-firebase/admin-storage-lite.js +11 -0
- package/dist/providers/db-firebase/admin.d.ts +29 -0
- package/dist/providers/db-firebase/admin.js +163 -0
- package/dist/providers/db-firebase/base.d.ts +44 -0
- package/dist/providers/db-firebase/base.js +180 -0
- package/dist/providers/db-firebase/base.repository.d.ts +34 -0
- package/dist/providers/db-firebase/base.repository.js +235 -0
- package/dist/providers/db-firebase/browser-stub.d.ts +37 -0
- package/dist/providers/db-firebase/browser-stub.js +56 -0
- package/dist/providers/db-firebase/client-config.d.ts +22 -0
- package/dist/providers/db-firebase/client-config.js +30 -0
- package/dist/providers/db-firebase/field-ops.d.ts +7 -0
- package/dist/providers/db-firebase/field-ops.js +13 -0
- package/dist/providers/db-firebase/helpers.d.ts +23 -0
- package/dist/providers/db-firebase/helpers.js +67 -0
- package/dist/providers/db-firebase/index.d.ts +16 -250
- package/dist/providers/db-firebase/index.js +42 -498
- package/dist/providers/db-firebase/realtime.d.ts +43 -0
- package/dist/providers/db-firebase/realtime.js +122 -0
- package/dist/providers/db-firebase/rtdb-paths.d.ts +12 -0
- package/dist/providers/db-firebase/rtdb-paths.js +12 -0
- package/dist/providers/db-firebase/sieve.d.ts +76 -0
- package/dist/providers/db-firebase/sieve.js +83 -0
- package/dist/providers/email-resend/index.d.ts +6 -64
- package/dist/providers/email-resend/index.js +14 -56
- package/dist/providers/email-resend/provider.d.ts +43 -0
- package/dist/providers/email-resend/provider.js +75 -0
- package/dist/providers/firebase-client/auth.d.ts +12 -0
- package/dist/providers/firebase-client/auth.js +30 -0
- package/dist/providers/firebase-client/index.d.ts +9 -0
- package/dist/providers/firebase-client/index.js +9 -0
- package/dist/providers/firebase-client/realtime.d.ts +18 -0
- package/dist/providers/firebase-client/realtime.js +39 -0
- package/dist/providers/payment-razorpay/index.d.ts +66 -69
- package/dist/providers/payment-razorpay/index.js +201 -97
- package/dist/providers/shipping-shiprocket/index.d.ts +69 -33
- package/dist/providers/shipping-shiprocket/index.js +135 -122
- package/dist/providers/shipping-shiprocket/shiprocket-provider.d.ts +46 -0
- package/dist/providers/shipping-shiprocket/shiprocket-provider.js +152 -0
- package/dist/providers/storage-firebase/client.d.ts +56 -0
- package/dist/providers/storage-firebase/client.js +141 -0
- package/dist/providers/storage-firebase/index.d.ts +6 -43
- package/dist/providers/storage-firebase/index.js +16 -153
- package/dist/providers/storage-firebase/provider.d.ts +23 -0
- package/dist/providers/storage-firebase/provider.js +103 -0
- package/dist/react/ErrorBoundary.d.ts +31 -0
- package/dist/react/ErrorBoundary.js +68 -0
- package/dist/react/contexts/SessionContext.d.ts +80 -0
- package/dist/react/contexts/SessionContext.js +350 -0
- package/dist/react/contexts/ThemeContext.d.ts +14 -0
- package/dist/react/contexts/ThemeContext.js +65 -0
- package/dist/react/contexts/index.d.ts +4 -0
- package/dist/react/contexts/index.js +2 -0
- package/dist/react/hooks/useBreakpoint.d.ts +29 -0
- package/dist/react/hooks/useBreakpoint.js +37 -0
- package/dist/react/hooks/useBulkAction.d.ts +65 -0
- package/dist/react/hooks/useBulkAction.js +69 -0
- package/dist/react/hooks/useBulkSelection.d.ts +40 -0
- package/dist/react/hooks/useBulkSelection.js +58 -0
- package/dist/react/hooks/useCamera.d.ts +34 -0
- package/dist/react/hooks/useCamera.js +147 -0
- package/dist/react/hooks/useClickOutside.d.ts +37 -0
- package/dist/react/hooks/useClickOutside.js +57 -0
- package/dist/react/hooks/useContainerGrid.d.ts +39 -0
- package/dist/react/hooks/useContainerGrid.js +47 -0
- package/dist/react/hooks/useCountdown.d.ts +26 -0
- package/dist/react/hooks/useCountdown.js +49 -0
- package/dist/react/hooks/useGesture.d.ts +51 -0
- package/dist/react/hooks/useGesture.js +181 -0
- package/dist/react/hooks/useKeyPress.d.ts +48 -0
- package/dist/react/hooks/useKeyPress.js +62 -0
- package/dist/react/hooks/useLongPress.d.ts +26 -0
- package/dist/react/hooks/useLongPress.js +55 -0
- package/dist/react/hooks/useMediaQuery.d.ts +17 -0
- package/dist/react/hooks/useMediaQuery.js +34 -0
- package/dist/react/hooks/useMessage.d.ts +11 -0
- package/dist/react/hooks/useMessage.js +45 -0
- package/dist/react/hooks/usePendingFilters.d.ts +58 -0
- package/dist/react/hooks/usePendingFilters.js +79 -0
- package/dist/react/hooks/usePendingTable.d.ts +49 -0
- package/dist/react/hooks/usePendingTable.js +45 -0
- package/dist/react/hooks/usePullToRefresh.d.ts +38 -0
- package/dist/react/hooks/usePullToRefresh.js +82 -0
- package/dist/react/hooks/useRealtimeEvent.d.ts +53 -0
- package/dist/react/hooks/useRealtimeEvent.js +124 -0
- package/dist/react/hooks/useSwipe.d.ts +55 -0
- package/dist/react/hooks/useSwipe.js +165 -0
- package/dist/react/hooks/useUnsavedChanges.d.ts +44 -0
- package/dist/react/hooks/useUnsavedChanges.js +55 -0
- package/dist/react/hooks/useUrlTable.d.ts +31 -0
- package/dist/react/hooks/useUrlTable.js +137 -0
- package/dist/react/hooks/useVisibleItems.d.ts +37 -0
- package/dist/react/hooks/useVisibleItems.js +59 -0
- package/dist/react/index.d.ts +49 -787
- package/dist/react/index.js +47 -1665
- package/dist/react/useModalStack.d.ts +33 -0
- package/dist/react/useModalStack.js +61 -0
- package/dist/repositories/index.d.ts +38 -0
- package/dist/repositories/index.js +40 -0
- package/dist/security/authorization.d.ts +24 -0
- package/dist/security/authorization.js +73 -0
- package/dist/security/browser.d.ts +7 -0
- package/dist/security/browser.js +5 -0
- package/dist/security/csp.d.ts +16 -0
- package/dist/security/csp.js +44 -0
- package/dist/security/index.d.ts +11 -309
- package/dist/security/index.js +8 -5
- package/dist/security/pii-encrypt.d.ts +121 -0
- package/dist/security/pii-encrypt.js +351 -0
- package/dist/security/pii-redact.d.ts +20 -0
- package/dist/security/pii-redact.js +129 -0
- package/dist/security/pii-schemas.d.ts +38 -0
- package/dist/security/pii-schemas.js +62 -0
- package/dist/security/rate-limit.d.ts +70 -0
- package/dist/security/rate-limit.js +107 -0
- package/dist/security/rbac/Can.d.ts +31 -0
- package/dist/security/rbac/Can.js +24 -0
- package/dist/security/rbac/default-roles.d.ts +2 -0
- package/dist/security/rbac/default-roles.js +83 -0
- package/dist/security/rbac/hook.d.ts +20 -0
- package/dist/security/rbac/hook.js +30 -0
- package/dist/security/rbac/index.d.ts +8 -0
- package/dist/security/rbac/index.js +6 -0
- package/dist/security/rbac/middleware.d.ts +51 -0
- package/dist/security/rbac/middleware.js +51 -0
- package/dist/security/rbac/resolver.d.ts +5 -0
- package/dist/security/rbac/resolver.js +38 -0
- package/dist/security/rbac/server.d.ts +24 -0
- package/dist/security/rbac/server.js +42 -0
- package/dist/security/rbac/types.d.ts +22 -0
- package/dist/security/rbac/types.js +2 -0
- package/dist/security/settings-encryption.d.ts +5 -0
- package/dist/security/settings-encryption.js +48 -0
- package/dist/seed/actions/demo-seed-actions.d.ts +31 -0
- package/dist/seed/actions/demo-seed-actions.js +36 -0
- package/dist/seed/actions/index.d.ts +1 -0
- package/dist/seed/actions/index.js +1 -0
- package/dist/seed/addresses-seed-data.d.ts +19 -0
- package/dist/seed/addresses-seed-data.js +418 -0
- package/dist/seed/bids-seed-data.d.ts +7 -0
- package/dist/seed/bids-seed-data.js +1168 -0
- package/dist/seed/blog-posts-seed-data.d.ts +7 -0
- package/dist/seed/blog-posts-seed-data.js +215 -0
- package/dist/seed/carousel-slides-seed-data.d.ts +7 -0
- package/dist/seed/carousel-slides-seed-data.js +283 -0
- package/dist/seed/cart-seed-data.d.ts +20 -0
- package/dist/seed/cart-seed-data.js +179 -0
- package/dist/seed/categories-seed-data.d.ts +7 -0
- package/dist/seed/categories-seed-data.js +1220 -0
- package/dist/seed/coupons-seed-data.d.ts +7 -0
- package/dist/seed/coupons-seed-data.js +508 -0
- package/dist/seed/defaults/categories.d.ts +2 -0
- package/dist/seed/defaults/categories.js +12 -0
- package/dist/seed/defaults/faqs.d.ts +2 -0
- package/dist/seed/defaults/faqs.js +40 -0
- package/dist/seed/defaults/homepage-sections.d.ts +2 -0
- package/dist/seed/defaults/homepage-sections.js +59 -0
- package/dist/seed/events-seed-data.d.ts +8 -0
- package/dist/seed/events-seed-data.js +662 -0
- package/dist/seed/factories/address.factory.d.ts +21 -0
- package/dist/seed/factories/address.factory.js +44 -0
- package/dist/seed/factories/bid.factory.d.ts +15 -0
- package/dist/seed/factories/bid.factory.js +33 -0
- package/dist/seed/factories/blog-post.factory.d.ts +15 -0
- package/dist/seed/factories/blog-post.factory.js +22 -0
- package/dist/seed/factories/carousel.factory.d.ts +11 -0
- package/dist/seed/factories/carousel.factory.js +16 -0
- package/dist/seed/factories/cart.factory.d.ts +26 -0
- package/dist/seed/factories/cart.factory.js +35 -0
- package/dist/seed/factories/category.factory.d.ts +11 -0
- package/dist/seed/factories/category.factory.js +16 -0
- package/dist/seed/factories/coupon.factory.d.ts +21 -0
- package/dist/seed/factories/coupon.factory.js +43 -0
- package/dist/seed/factories/faq.factory.d.ts +10 -0
- package/dist/seed/factories/faq.factory.js +15 -0
- package/dist/seed/factories/homepage-section.factory.d.ts +9 -0
- package/dist/seed/factories/homepage-section.factory.js +13 -0
- package/dist/seed/factories/notification.factory.d.ts +17 -0
- package/dist/seed/factories/notification.factory.js +39 -0
- package/dist/seed/factories/order.factory.d.ts +20 -0
- package/dist/seed/factories/order.factory.js +20 -0
- package/dist/seed/factories/payout.factory.d.ts +21 -0
- package/dist/seed/factories/payout.factory.js +38 -0
- package/dist/seed/factories/product.factory.d.ts +27 -0
- package/dist/seed/factories/product.factory.js +111 -0
- package/dist/seed/factories/review.factory.d.ts +14 -0
- package/dist/seed/factories/review.factory.js +52 -0
- package/dist/seed/factories/session.factory.d.ts +15 -0
- package/dist/seed/factories/session.factory.js +31 -0
- package/dist/seed/factories/store.factory.d.ts +23 -0
- package/dist/seed/factories/store.factory.js +46 -0
- package/dist/seed/factories/user.factory.d.ts +19 -0
- package/dist/seed/factories/user.factory.js +55 -0
- package/dist/seed/faq-seed-data.d.ts +47 -0
- package/dist/seed/faq-seed-data.js +2320 -0
- package/dist/seed/firestore-indexes.d.ts +13 -0
- package/dist/seed/firestore-indexes.js +32 -0
- package/dist/seed/homepage-sections-seed-data.d.ts +18 -0
- package/dist/seed/homepage-sections-seed-data.js +339 -0
- package/dist/seed/index.d.ts +68 -397
- package/dist/seed/index.js +49 -1040
- package/dist/seed/notifications-seed-data.d.ts +7 -0
- package/dist/seed/notifications-seed-data.js +494 -0
- package/dist/seed/orders-seed-data.d.ts +7 -0
- package/dist/seed/orders-seed-data.js +578 -0
- package/dist/seed/payouts-seed-data.d.ts +7 -0
- package/dist/seed/payouts-seed-data.js +202 -0
- package/dist/seed/products-seed-data.d.ts +7 -0
- package/dist/seed/products-seed-data.js +2477 -0
- package/dist/seed/reviews-seed-data.d.ts +7 -0
- package/dist/seed/reviews-seed-data.js +618 -0
- package/dist/seed/runner.d.ts +3 -0
- package/dist/seed/runner.js +38 -0
- package/dist/seed/seed-market-config.d.ts +49 -0
- package/dist/seed/seed-market-config.js +198 -0
- package/dist/seed/sessions-seed-data.d.ts +17 -0
- package/dist/seed/sessions-seed-data.js +355 -0
- package/dist/seed/site-settings-seed-data.d.ts +7 -0
- package/dist/seed/site-settings-seed-data.js +236 -0
- package/dist/seed/store-addresses-seed-data.d.ts +19 -0
- package/dist/seed/store-addresses-seed-data.js +106 -0
- package/dist/seed/stores-seed-data.d.ts +14 -0
- package/dist/seed/stores-seed-data.js +127 -0
- package/dist/seed/test-utils.d.ts +49 -0
- package/dist/seed/test-utils.js +107 -0
- package/dist/seed/types.d.ts +33 -0
- package/dist/seed/types.js +1 -0
- package/dist/seed/users-seed-data.d.ts +7 -0
- package/dist/seed/users-seed-data.js +727 -0
- package/dist/seo/index.d.ts +2 -150
- package/dist/seo/index.js +2 -4
- package/dist/seo/json-ld.d.ts +69 -0
- package/dist/seo/json-ld.js +166 -0
- package/dist/seo/metadata.d.ts +77 -0
- package/dist/seo/metadata.js +157 -0
- package/dist/server.d.ts +109 -0
- package/dist/server.js +110 -0
- package/dist/style/tailwind/index.d.ts +5 -7
- package/dist/style/tailwind/index.js +54 -33
- package/dist/style/vanilla/index.d.ts +5 -7
- package/dist/style/vanilla/index.js +45 -33
- package/dist/tokens/index.d.ts +23 -24
- package/dist/tokens/index.js +786 -4
- package/dist/tokens/tokens.css +221 -0
- package/dist/ui/DataTable.d.ts +78 -0
- package/dist/ui/DataTable.js +157 -0
- package/dist/ui/DataTable.style.css +190 -0
- package/dist/ui/animation.helper.d.ts +17 -0
- package/dist/ui/animation.helper.js +17 -0
- package/dist/ui/color.helper.d.ts +12 -0
- package/dist/ui/color.helper.js +31 -0
- package/dist/ui/columns/build-columns.d.ts +21 -0
- package/dist/ui/columns/build-columns.js +33 -0
- package/dist/ui/columns/column-renderers.d.ts +33 -0
- package/dist/ui/columns/column-renderers.js +64 -0
- package/dist/ui/columns/index.d.ts +6 -0
- package/dist/ui/columns/index.js +5 -0
- package/dist/ui/components/Accordion.d.ts +27 -0
- package/dist/ui/components/Accordion.js +57 -0
- package/dist/ui/components/Accordion.style.css +82 -0
- package/dist/ui/components/ActiveFilterChips.d.ts +13 -0
- package/dist/ui/components/ActiveFilterChips.js +9 -0
- package/dist/ui/components/ActiveFilterChips.style.css +66 -0
- package/dist/ui/components/Alert.d.ts +43 -0
- package/dist/ui/components/Alert.js +47 -0
- package/dist/ui/components/Alert.style.css +187 -0
- package/dist/ui/components/Avatar.d.ts +18 -0
- package/dist/ui/components/Avatar.js +42 -0
- package/dist/ui/components/Avatar.style.css +73 -0
- package/dist/ui/components/AvatarDisplay.d.ts +10 -0
- package/dist/ui/components/AvatarDisplay.js +56 -0
- package/dist/ui/components/AvatarDisplay.style.css +46 -0
- package/dist/ui/components/BackgroundRenderer.d.ts +15 -0
- package/dist/ui/components/BackgroundRenderer.js +42 -0
- package/dist/ui/components/BackgroundRenderer.style.css +31 -0
- package/dist/ui/components/Badge.d.ts +33 -0
- package/dist/ui/components/Badge.js +34 -0
- package/dist/ui/components/Badge.style.css +114 -0
- package/dist/ui/components/BaseListingCard.d.ts +39 -0
- package/dist/ui/components/BaseListingCard.js +56 -0
- package/dist/ui/components/BaseListingCard.style.css +84 -0
- package/dist/ui/components/Breadcrumb.d.ts +15 -0
- package/dist/ui/components/Breadcrumb.js +12 -0
- package/dist/ui/components/Breadcrumb.style.css +60 -0
- package/dist/ui/components/BulkActionBar.d.ts +34 -0
- package/dist/ui/components/BulkActionBar.js +86 -0
- package/dist/ui/components/BulkActionBar.style.css +196 -0
- package/dist/ui/components/Button.d.ts +31 -0
- package/dist/ui/components/Button.js +29 -0
- package/dist/ui/components/Button.style.css +160 -0
- package/dist/ui/components/Card.d.ts +21 -0
- package/dist/ui/components/Card.js +51 -0
- package/dist/ui/components/Card.style.css +192 -0
- package/dist/ui/components/Checkbox.d.ts +8 -0
- package/dist/ui/components/Checkbox.js +38 -0
- package/dist/ui/components/Checkbox.style.css +113 -0
- package/dist/ui/components/ConfirmDeleteModal.d.ts +33 -0
- package/dist/ui/components/ConfirmDeleteModal.js +74 -0
- package/dist/ui/components/ConfirmDeleteModal.style.css +89 -0
- package/dist/ui/components/CountdownDisplay.d.ts +14 -0
- package/dist/ui/components/CountdownDisplay.js +50 -0
- package/dist/ui/components/CountdownDisplay.style.css +4 -0
- package/dist/ui/components/DashboardStatsCard.d.ts +15 -0
- package/dist/ui/components/DashboardStatsCard.js +28 -0
- package/dist/ui/components/DashboardStatsCard.style.css +70 -0
- package/dist/ui/components/DescriptionField.d.ts +23 -0
- package/dist/ui/components/DescriptionField.js +28 -0
- package/dist/ui/components/DescriptionField.style.css +36 -0
- package/dist/ui/components/DetailViewShell.d.ts +51 -0
- package/dist/ui/components/DetailViewShell.js +50 -0
- package/dist/ui/components/Div.d.ts +20 -0
- package/dist/ui/components/Div.js +19 -0
- package/dist/ui/components/Div.style.css +6 -0
- package/dist/ui/components/Divider.d.ts +12 -0
- package/dist/ui/components/Divider.js +11 -0
- package/dist/ui/components/Divider.style.css +39 -0
- package/dist/ui/components/Drawer.d.ts +21 -0
- package/dist/ui/components/Drawer.js +72 -0
- package/dist/ui/components/Drawer.style.css +146 -0
- package/dist/ui/components/Dropdown.d.ts +36 -0
- package/dist/ui/components/Dropdown.js +142 -0
- package/dist/ui/components/Dropdown.style.css +112 -0
- package/dist/ui/components/DynamicSelect.d.ts +24 -0
- package/dist/ui/components/DynamicSelect.js +78 -0
- package/dist/ui/components/DynamicSelect.style.css +101 -0
- package/dist/ui/components/EmptyState.d.ts +12 -0
- package/dist/ui/components/EmptyState.js +17 -0
- package/dist/ui/components/EmptyState.style.css +30 -0
- package/dist/ui/components/FilterDrawer.d.ts +16 -0
- package/dist/ui/components/FilterDrawer.js +39 -0
- package/dist/ui/components/FilterDrawer.style.css +61 -0
- package/dist/ui/components/FlowDiagram.d.ts +33 -0
- package/dist/ui/components/FlowDiagram.js +15 -0
- package/dist/ui/components/FlowDiagram.style.css +77 -0
- package/dist/ui/components/Form.d.ts +27 -0
- package/dist/ui/components/Form.js +48 -0
- package/dist/ui/components/Form.style.css +27 -0
- package/dist/ui/components/FormField.d.ts +26 -0
- package/dist/ui/components/FormField.js +25 -0
- package/dist/ui/components/FormField.style.css +30 -0
- package/dist/ui/components/FormGrid.d.ts +46 -0
- package/dist/ui/components/FormGrid.js +42 -0
- package/dist/ui/components/FormGrid.style.css +32 -0
- package/dist/ui/components/HorizontalScroller.d.ts +33 -0
- package/dist/ui/components/HorizontalScroller.js +47 -0
- package/dist/ui/components/HorizontalScroller.style.css +109 -0
- package/dist/ui/components/IconButton.d.ts +32 -0
- package/dist/ui/components/IconButton.js +31 -0
- package/dist/ui/components/IconButton.style.css +103 -0
- package/dist/ui/components/ImageGallery.d.ts +17 -0
- package/dist/ui/components/ImageGallery.js +108 -0
- package/dist/ui/components/ImageGallery.style.css +163 -0
- package/dist/ui/components/ImageLightbox.d.ts +24 -0
- package/dist/ui/components/ImageLightbox.js +61 -0
- package/dist/ui/components/ImageLightbox.style.css +58 -0
- package/dist/ui/components/Input.d.ts +12 -0
- package/dist/ui/components/Input.js +29 -0
- package/dist/ui/components/Input.style.css +28 -0
- package/dist/ui/components/ItemRow.d.ts +10 -0
- package/dist/ui/components/ItemRow.js +7 -0
- package/dist/ui/components/ItemRow.style.css +33 -0
- package/dist/ui/components/Layout.d.ts +282 -0
- package/dist/ui/components/Layout.js +184 -0
- package/dist/ui/components/Layout.style.css +212 -0
- package/dist/ui/components/ListingLayout.d.ts +60 -0
- package/dist/ui/components/ListingLayout.js +121 -0
- package/dist/ui/components/ListingLayout.style.css +527 -0
- package/dist/ui/components/ListingViewShell.d.ts +38 -0
- package/dist/ui/components/ListingViewShell.js +11 -0
- package/dist/ui/components/Menu.d.ts +29 -0
- package/dist/ui/components/Menu.js +19 -0
- package/dist/ui/components/Menu.style.css +6 -0
- package/dist/ui/components/Modal.d.ts +18 -0
- package/dist/ui/components/Modal.js +79 -0
- package/dist/ui/components/Modal.style.css +102 -0
- package/dist/ui/components/Pagination.d.ts +25 -0
- package/dist/ui/components/Pagination.js +56 -0
- package/dist/ui/components/Pagination.style.css +76 -0
- package/dist/ui/components/PasswordStrengthIndicator.d.ts +12 -0
- package/dist/ui/components/PasswordStrengthIndicator.js +35 -0
- package/dist/ui/components/PasswordStrengthIndicator.style.css +56 -0
- package/dist/ui/components/PriceDisplay.d.ts +8 -0
- package/dist/ui/components/PriceDisplay.js +28 -0
- package/dist/ui/components/PriceDisplay.style.css +47 -0
- package/dist/ui/components/Progress.d.ts +23 -0
- package/dist/ui/components/Progress.js +32 -0
- package/dist/ui/components/Progress.style.css +81 -0
- package/dist/ui/components/Radio.d.ts +18 -0
- package/dist/ui/components/Radio.js +64 -0
- package/dist/ui/components/Radio.style.css +155 -0
- package/dist/ui/components/RatingDisplay.d.ts +8 -0
- package/dist/ui/components/RatingDisplay.js +15 -0
- package/dist/ui/components/RatingDisplay.style.css +50 -0
- package/dist/ui/components/ResponsiveView.d.ts +12 -0
- package/dist/ui/components/ResponsiveView.js +9 -0
- package/dist/ui/components/ResponsiveView.style.css +69 -0
- package/dist/ui/components/RoleBadge.d.ts +7 -0
- package/dist/ui/components/RoleBadge.js +21 -0
- package/dist/ui/components/RoleBadge.style.css +7 -0
- package/dist/ui/components/RowActionMenu.d.ts +13 -0
- package/dist/ui/components/RowActionMenu.js +17 -0
- package/dist/ui/components/RowActionMenu.style.css +91 -0
- package/dist/ui/components/SectionTabs.d.ts +19 -0
- package/dist/ui/components/SectionTabs.js +66 -0
- package/dist/ui/components/SectionTabs.style.css +163 -0
- package/dist/ui/components/Select.d.ts +19 -0
- package/dist/ui/components/Select.js +27 -0
- package/dist/ui/components/Select.style.css +177 -0
- package/dist/ui/components/Semantic.d.ts +154 -0
- package/dist/ui/components/Semantic.js +32 -0
- package/dist/ui/components/Semantic.style.css +14 -0
- package/dist/ui/components/SideDrawer.d.ts +28 -0
- package/dist/ui/components/SideDrawer.js +151 -0
- package/dist/ui/components/SideDrawer.style.css +214 -0
- package/dist/ui/components/SideModal.d.ts +25 -0
- package/dist/ui/components/SideModal.js +61 -0
- package/dist/ui/components/SideModal.style.css +77 -0
- package/dist/ui/components/Skeleton.d.ts +14 -0
- package/dist/ui/components/Skeleton.js +22 -0
- package/dist/ui/components/Skeleton.style.css +55 -0
- package/dist/ui/components/SkipToMain.d.ts +6 -0
- package/dist/ui/components/SkipToMain.js +6 -0
- package/dist/ui/components/SkipToMain.style.css +34 -0
- package/dist/ui/components/Slider.d.ts +17 -0
- package/dist/ui/components/Slider.js +38 -0
- package/dist/ui/components/Slider.style.css +17 -0
- package/dist/ui/components/SlottedListingView.d.ts +62 -0
- package/dist/ui/components/SlottedListingView.js +41 -0
- package/dist/ui/components/SortDropdown.d.ts +15 -0
- package/dist/ui/components/SortDropdown.js +8 -0
- package/dist/ui/components/SortDropdown.style.css +12 -0
- package/dist/ui/components/Spinner.d.ts +13 -0
- package/dist/ui/components/Spinner.js +15 -0
- package/dist/ui/components/Spinner.style.css +76 -0
- package/dist/ui/components/StackedViewShell.d.ts +50 -0
- package/dist/ui/components/StackedViewShell.js +39 -0
- package/dist/ui/components/StarRating.d.ts +17 -0
- package/dist/ui/components/StarRating.js +29 -0
- package/dist/ui/components/StarRating.style.css +44 -0
- package/dist/ui/components/StatsGrid.d.ts +18 -0
- package/dist/ui/components/StatsGrid.js +17 -0
- package/dist/ui/components/StatsGrid.style.css +96 -0
- package/dist/ui/components/StatusBadge.d.ts +18 -0
- package/dist/ui/components/StatusBadge.js +60 -0
- package/dist/ui/components/StatusBadge.style.css +5 -0
- package/dist/ui/components/StepperNav.d.ts +10 -0
- package/dist/ui/components/StepperNav.js +23 -0
- package/dist/ui/components/StepperNav.style.css +110 -0
- package/dist/ui/components/SummaryCard.d.ts +21 -0
- package/dist/ui/components/SummaryCard.js +15 -0
- package/dist/ui/components/SummaryCard.style.css +82 -0
- package/dist/ui/components/TabStrip.d.ts +34 -0
- package/dist/ui/components/TabStrip.js +57 -0
- package/dist/ui/components/TabStrip.style.css +97 -0
- package/dist/ui/components/TablePagination.d.ts +21 -0
- package/dist/ui/components/TablePagination.js +32 -0
- package/dist/ui/components/TablePagination.style.css +89 -0
- package/dist/ui/components/Tabs.d.ts +28 -0
- package/dist/ui/components/Tabs.js +41 -0
- package/dist/ui/components/Tabs.style.css +46 -0
- package/dist/ui/components/TagInput.d.ts +10 -0
- package/dist/ui/components/TagInput.js +60 -0
- package/dist/ui/components/TagInput.style.css +121 -0
- package/dist/ui/components/TextLink.d.ts +42 -0
- package/dist/ui/components/TextLink.js +48 -0
- package/dist/ui/components/TextLink.style.css +94 -0
- package/dist/ui/components/Textarea.d.ts +9 -0
- package/dist/ui/components/Textarea.js +21 -0
- package/dist/ui/components/Textarea.style.css +30 -0
- package/dist/ui/components/Toast.d.ts +15 -0
- package/dist/ui/components/Toast.js +61 -0
- package/dist/ui/components/Toast.style.css +114 -0
- package/dist/ui/components/Toggle.d.ts +12 -0
- package/dist/ui/components/Toggle.js +47 -0
- package/dist/ui/components/Toggle.style.css +107 -0
- package/dist/ui/components/Tooltip.d.ts +34 -0
- package/dist/ui/components/Tooltip.js +110 -0
- package/dist/ui/components/Tooltip.style.css +114 -0
- package/dist/ui/components/Typography.d.ts +50 -0
- package/dist/ui/components/Typography.js +103 -0
- package/dist/ui/components/Typography.style.css +178 -0
- package/dist/ui/components/UnsavedChangesModal.d.ts +17 -0
- package/dist/ui/components/UnsavedChangesModal.js +52 -0
- package/dist/ui/components/UnsavedChangesModal.style.css +33 -0
- package/dist/ui/components/ViewToggle.d.ts +15 -0
- package/dist/ui/components/ViewToggle.js +29 -0
- package/dist/ui/components/ViewToggle.style.css +50 -0
- package/dist/ui/components/index.style.css +76 -0
- package/dist/ui/index.d.ts +165 -1644
- package/dist/ui/index.js +87 -4784
- package/dist/ui/rich-text/RichText.d.ts +46 -0
- package/dist/ui/rich-text/RichText.js +172 -0
- package/dist/ui/rich-text/RichText.style.css +5 -0
- package/dist/ui/rich-text/index.d.ts +2 -0
- package/dist/ui/rich-text/index.js +1 -0
- package/dist/ui/style.helper.d.ts +7 -0
- package/dist/ui/style.helper.js +12 -0
- package/dist/utils/animation.helper.d.ts +19 -0
- package/dist/utils/animation.helper.js +19 -0
- package/dist/utils/array.helper.d.ts +17 -0
- package/dist/utils/array.helper.js +53 -0
- package/dist/utils/business-day.d.ts +47 -0
- package/dist/utils/business-day.js +68 -0
- package/dist/utils/client.d.ts +1 -0
- package/dist/utils/client.js +1 -0
- package/dist/utils/color.helper.d.ts +32 -0
- package/dist/utils/color.helper.js +51 -0
- package/dist/utils/cookie.converter.d.ts +7 -0
- package/dist/utils/cookie.converter.js +32 -0
- package/dist/utils/date.formatter.d.ts +22 -0
- package/dist/utils/date.formatter.js +194 -0
- package/dist/utils/event-manager.d.ts +45 -0
- package/dist/utils/event-manager.js +185 -0
- package/dist/utils/filter.helper.d.ts +18 -0
- package/dist/utils/filter.helper.js +21 -0
- package/dist/utils/id-generators.d.ts +243 -0
- package/dist/utils/id-generators.js +360 -0
- package/dist/utils/index.d.ts +17 -545
- package/dist/utils/index.js +18 -4
- package/dist/utils/media-field.d.ts +2 -0
- package/dist/utils/media-field.js +1 -0
- package/dist/utils/number.formatter.d.ts +13 -0
- package/dist/utils/number.formatter.js +100 -0
- package/dist/utils/object.helper.d.ts +16 -0
- package/dist/utils/object.helper.js +82 -0
- package/dist/utils/pagination.helper.d.ts +23 -0
- package/dist/utils/pagination.helper.js +24 -0
- package/dist/utils/schema-ui.d.ts +83 -0
- package/dist/utils/schema-ui.js +185 -0
- package/dist/utils/sorting.helper.d.ts +7 -0
- package/dist/utils/sorting.helper.js +16 -0
- package/dist/utils/string.formatter.d.ts +19 -0
- package/dist/utils/string.formatter.js +140 -0
- package/dist/utils/type.converter.d.ts +14 -0
- package/dist/utils/type.converter.js +61 -0
- package/dist/validation/ZodSetup.d.ts +5 -0
- package/dist/validation/ZodSetup.js +11 -0
- package/dist/validation/email.validator.d.ts +7 -0
- package/dist/validation/email.validator.js +33 -0
- package/dist/validation/index.d.ts +9 -126
- package/dist/validation/index.js +8 -4
- package/dist/validation/input.validator.d.ts +11 -0
- package/dist/validation/input.validator.js +33 -0
- package/dist/validation/password.validator.d.ts +21 -0
- package/dist/validation/password.validator.js +77 -0
- package/dist/validation/phone.validator.d.ts +9 -0
- package/dist/validation/phone.validator.js +41 -0
- package/dist/validation/schemas.d.ts +267 -0
- package/dist/validation/schemas.js +176 -0
- package/dist/validation/url.validator.d.ts +7 -0
- package/dist/validation/url.validator.js +44 -0
- package/dist/validation/zod-error-map.d.ts +17 -0
- package/dist/validation/zod-error-map.js +85 -0
- package/dist/values/index.d.ts +6 -0
- package/dist/values/index.js +6 -0
- package/dist/values/success-messages.d.ts +242 -0
- package/dist/values/success-messages.js +272 -0
- package/package.json +87 -445
- package/dist/chunk-2NMEKWO5.js +0 -35
- package/dist/chunk-2NMEKWO5.js.map +0 -1
- package/dist/chunk-6344OTT4.js +0 -329
- package/dist/chunk-6344OTT4.js.map +0 -1
- package/dist/chunk-7HUFI4MW.cjs +0 -941
- package/dist/chunk-7HUFI4MW.cjs.map +0 -1
- package/dist/chunk-AZ2XDBYA.cjs +0 -150
- package/dist/chunk-AZ2XDBYA.cjs.map +0 -1
- package/dist/chunk-CI4ZFLS7.js +0 -1162
- package/dist/chunk-CI4ZFLS7.js.map +0 -1
- package/dist/chunk-DSCHV5OD.js +0 -620
- package/dist/chunk-DSCHV5OD.js.map +0 -1
- package/dist/chunk-EEMSMWIZ.js +0 -566
- package/dist/chunk-EEMSMWIZ.js.map +0 -1
- package/dist/chunk-EPJNBIKL.js +0 -916
- package/dist/chunk-EPJNBIKL.js.map +0 -1
- package/dist/chunk-FJEY6LN2.cjs +0 -64
- package/dist/chunk-FJEY6LN2.cjs.map +0 -1
- package/dist/chunk-GZXXRVTM.cjs +0 -343
- package/dist/chunk-GZXXRVTM.cjs.map +0 -1
- package/dist/chunk-IE5L2QHV.js +0 -204
- package/dist/chunk-IE5L2QHV.js.map +0 -1
- package/dist/chunk-JPHORBTI.cjs +0 -366
- package/dist/chunk-JPHORBTI.cjs.map +0 -1
- package/dist/chunk-K4C5Z22R.js +0 -146
- package/dist/chunk-K4C5Z22R.js.map +0 -1
- package/dist/chunk-PAHR3D5L.js +0 -56
- package/dist/chunk-PAHR3D5L.js.map +0 -1
- package/dist/chunk-PE44UBFV.js +0 -324
- package/dist/chunk-PE44UBFV.js.map +0 -1
- package/dist/chunk-RNELVIKK.cjs +0 -1287
- package/dist/chunk-RNELVIKK.cjs.map +0 -1
- package/dist/chunk-S367Y35J.cjs +0 -39
- package/dist/chunk-S367Y35J.cjs.map +0 -1
- package/dist/chunk-ULLW73KN.cjs +0 -217
- package/dist/chunk-ULLW73KN.cjs.map +0 -1
- package/dist/chunk-UNYFAUWW.cjs +0 -630
- package/dist/chunk-UNYFAUWW.cjs.map +0 -1
- package/dist/chunk-V55QYTXF.js +0 -259
- package/dist/chunk-V55QYTXF.js.map +0 -1
- package/dist/chunk-WKVCFDEA.cjs +0 -599
- package/dist/chunk-WKVCFDEA.cjs.map +0 -1
- package/dist/chunk-YT4QVIBP.cjs +0 -292
- package/dist/chunk-YT4QVIBP.cjs.map +0 -1
- package/dist/cli/index.cjs +0 -155
- package/dist/cli/index.cjs.map +0 -1
- package/dist/cli/index.d.cts +0 -41
- package/dist/cli/index.js.map +0 -1
- package/dist/contracts/index.cjs +0 -37
- package/dist/contracts/index.cjs.map +0 -1
- package/dist/contracts/index.d.cts +0 -728
- package/dist/contracts/index.js.map +0 -1
- package/dist/core/index.cjs +0 -84
- package/dist/core/index.cjs.map +0 -1
- package/dist/core/index.d.cts +0 -329
- package/dist/core/index.js.map +0 -1
- package/dist/errors/index.cjs +0 -57
- package/dist/errors/index.cjs.map +0 -1
- package/dist/errors/index.d.cts +0 -96
- package/dist/errors/index.js.map +0 -1
- package/dist/extend-D57fwPSu.d.cts +0 -122
- package/dist/extend-D57fwPSu.d.ts +0 -122
- package/dist/extend-D_0wzsse.d.cts +0 -79
- package/dist/extend-D_0wzsse.d.ts +0 -79
- package/dist/extend-jcOQfU2G.d.cts +0 -162
- package/dist/extend-jcOQfU2G.d.ts +0 -162
- package/dist/feature-C8mVv66I.d.cts +0 -84
- package/dist/feature-C8mVv66I.d.ts +0 -84
- package/dist/feature-DENiK3vd.d.cts +0 -55
- package/dist/feature-DENiK3vd.d.ts +0 -55
- package/dist/feature-RWXQ_lnf.d.cts +0 -41
- package/dist/feature-RWXQ_lnf.d.ts +0 -41
- package/dist/features/about/index.cjs +0 -286
- package/dist/features/about/index.cjs.map +0 -1
- package/dist/features/about/index.d.cts +0 -42
- package/dist/features/about/index.js.map +0 -1
- package/dist/features/account/index.cjs +0 -1032
- package/dist/features/account/index.cjs.map +0 -1
- package/dist/features/account/index.d.cts +0 -555
- package/dist/features/account/index.js.map +0 -1
- package/dist/features/admin/index.cjs +0 -2747
- package/dist/features/admin/index.cjs.map +0 -1
- package/dist/features/admin/index.d.cts +0 -554
- package/dist/features/admin/index.js.map +0 -1
- package/dist/features/auctions/index.cjs +0 -1219
- package/dist/features/auctions/index.cjs.map +0 -1
- package/dist/features/auctions/index.d.cts +0 -513
- package/dist/features/auctions/index.js.map +0 -1
- package/dist/features/auth/index.cjs +0 -1897
- package/dist/features/auth/index.cjs.map +0 -1
- package/dist/features/auth/index.d.cts +0 -315
- package/dist/features/auth/index.js.map +0 -1
- package/dist/features/auth/server.cjs +0 -531
- package/dist/features/auth/server.cjs.map +0 -1
- package/dist/features/auth/server.d.cts +0 -24
- package/dist/features/auth/server.js.map +0 -1
- package/dist/features/before-after/index.cjs +0 -559
- package/dist/features/before-after/index.cjs.map +0 -1
- package/dist/features/before-after/index.d.cts +0 -128
- package/dist/features/before-after/index.js.map +0 -1
- package/dist/features/blog/index.cjs +0 -4088
- package/dist/features/blog/index.cjs.map +0 -1
- package/dist/features/blog/index.d.cts +0 -492
- package/dist/features/blog/index.js.map +0 -1
- package/dist/features/blog/server.cjs +0 -184
- package/dist/features/blog/server.cjs.map +0 -1
- package/dist/features/blog/server.d.cts +0 -74
- package/dist/features/blog/server.js.map +0 -1
- package/dist/features/cart/index.cjs +0 -1097
- package/dist/features/cart/index.cjs.map +0 -1
- package/dist/features/cart/index.d.cts +0 -451
- package/dist/features/cart/index.js.map +0 -1
- package/dist/features/categories/index.cjs +0 -2062
- package/dist/features/categories/index.cjs.map +0 -1
- package/dist/features/categories/index.d.cts +0 -461
- package/dist/features/categories/index.js.map +0 -1
- package/dist/features/categories/server.cjs +0 -796
- package/dist/features/categories/server.cjs.map +0 -1
- package/dist/features/categories/server.d.cts +0 -47
- package/dist/features/categories/server.js.map +0 -1
- package/dist/features/checkout/index.cjs +0 -200
- package/dist/features/checkout/index.cjs.map +0 -1
- package/dist/features/checkout/index.d.cts +0 -70
- package/dist/features/checkout/index.js.map +0 -1
- package/dist/features/cms/index.cjs +0 -5
- package/dist/features/cms/index.cjs.map +0 -1
- package/dist/features/cms/index.d.cts +0 -2
- package/dist/features/cms/index.js.map +0 -1
- package/dist/features/collections/index.cjs +0 -394
- package/dist/features/collections/index.cjs.map +0 -1
- package/dist/features/collections/index.d.cts +0 -148
- package/dist/features/collections/index.js.map +0 -1
- package/dist/features/consultation/index.cjs +0 -1099
- package/dist/features/consultation/index.cjs.map +0 -1
- package/dist/features/consultation/index.d.cts +0 -172
- package/dist/features/consultation/index.js.map +0 -1
- package/dist/features/contact/index.cjs +0 -593
- package/dist/features/contact/index.cjs.map +0 -1
- package/dist/features/contact/index.d.cts +0 -56
- package/dist/features/contact/index.js.map +0 -1
- package/dist/features/copilot/index.cjs +0 -688
- package/dist/features/copilot/index.cjs.map +0 -1
- package/dist/features/copilot/index.d.cts +0 -47
- package/dist/features/copilot/index.js.map +0 -1
- package/dist/features/corporate/index.cjs +0 -796
- package/dist/features/corporate/index.cjs.map +0 -1
- package/dist/features/corporate/index.d.cts +0 -183
- package/dist/features/corporate/index.js.map +0 -1
- package/dist/features/events/index.cjs +0 -1486
- package/dist/features/events/index.cjs.map +0 -1
- package/dist/features/events/index.d.cts +0 -841
- package/dist/features/events/index.js.map +0 -1
- package/dist/features/events/server.cjs +0 -199
- package/dist/features/events/server.cjs.map +0 -1
- package/dist/features/events/server.d.cts +0 -40
- package/dist/features/events/server.js.map +0 -1
- package/dist/features/faq/index.cjs +0 -1714
- package/dist/features/faq/index.cjs.map +0 -1
- package/dist/features/faq/index.d.cts +0 -619
- package/dist/features/faq/index.js.map +0 -1
- package/dist/features/filters/index.cjs +0 -1073
- package/dist/features/filters/index.cjs.map +0 -1
- package/dist/features/filters/index.d.cts +0 -136
- package/dist/features/filters/index.js.map +0 -1
- package/dist/features/forms/index.cjs +0 -936
- package/dist/features/forms/index.cjs.map +0 -1
- package/dist/features/forms/index.d.cts +0 -129
- package/dist/features/forms/index.js.map +0 -1
- package/dist/features/homepage/index.cjs +0 -6321
- package/dist/features/homepage/index.cjs.map +0 -1
- package/dist/features/homepage/index.d.cts +0 -846
- package/dist/features/homepage/index.js.map +0 -1
- package/dist/features/homepage/server.cjs +0 -1038
- package/dist/features/homepage/server.cjs.map +0 -1
- package/dist/features/homepage/server.d.cts +0 -121
- package/dist/features/homepage/server.js.map +0 -1
- package/dist/features/layout/index.cjs +0 -1766
- package/dist/features/layout/index.cjs.map +0 -1
- package/dist/features/layout/index.d.cts +0 -315
- package/dist/features/layout/index.js.map +0 -1
- package/dist/features/loyalty/index.cjs +0 -352
- package/dist/features/loyalty/index.cjs.map +0 -1
- package/dist/features/loyalty/index.d.cts +0 -174
- package/dist/features/loyalty/index.js.map +0 -1
- package/dist/features/media/index.cjs +0 -3620
- package/dist/features/media/index.cjs.map +0 -1
- package/dist/features/media/index.d.cts +0 -425
- package/dist/features/media/index.js.map +0 -1
- package/dist/features/orders/index.cjs +0 -882
- package/dist/features/orders/index.cjs.map +0 -1
- package/dist/features/orders/index.d.cts +0 -370
- package/dist/features/orders/index.js.map +0 -1
- package/dist/features/payments/index.cjs +0 -341
- package/dist/features/payments/index.cjs.map +0 -1
- package/dist/features/payments/index.d.cts +0 -141
- package/dist/features/payments/index.js.map +0 -1
- package/dist/features/pre-orders/index.cjs +0 -558
- package/dist/features/pre-orders/index.cjs.map +0 -1
- package/dist/features/pre-orders/index.d.cts +0 -170
- package/dist/features/pre-orders/index.js.map +0 -1
- package/dist/features/pre-orders/server.cjs +0 -111
- package/dist/features/pre-orders/server.cjs.map +0 -1
- package/dist/features/pre-orders/server.d.cts +0 -17
- package/dist/features/pre-orders/server.js.map +0 -1
- package/dist/features/products/index.cjs +0 -2513
- package/dist/features/products/index.cjs.map +0 -1
- package/dist/features/products/index.d.cts +0 -1066
- package/dist/features/products/index.js.map +0 -1
- package/dist/features/products/server.cjs +0 -809
- package/dist/features/products/server.cjs.map +0 -1
- package/dist/features/products/server.d.cts +0 -52
- package/dist/features/products/server.js.map +0 -1
- package/dist/features/promotions/index.cjs +0 -977
- package/dist/features/promotions/index.cjs.map +0 -1
- package/dist/features/promotions/index.d.cts +0 -301
- package/dist/features/promotions/index.js.map +0 -1
- package/dist/features/reviews/index.cjs +0 -2324
- package/dist/features/reviews/index.cjs.map +0 -1
- package/dist/features/reviews/index.d.cts +0 -434
- package/dist/features/reviews/index.js.map +0 -1
- package/dist/features/reviews/server.cjs +0 -776
- package/dist/features/reviews/server.cjs.map +0 -1
- package/dist/features/reviews/server.d.cts +0 -49
- package/dist/features/reviews/server.js.map +0 -1
- package/dist/features/search/index.cjs +0 -1368
- package/dist/features/search/index.cjs.map +0 -1
- package/dist/features/search/index.d.cts +0 -298
- package/dist/features/search/index.js.map +0 -1
- package/dist/features/search/server.cjs +0 -154
- package/dist/features/search/server.cjs.map +0 -1
- package/dist/features/search/server.d.cts +0 -83
- package/dist/features/search/server.js.map +0 -1
- package/dist/features/seller/index.cjs +0 -2086
- package/dist/features/seller/index.cjs.map +0 -1
- package/dist/features/seller/index.d.cts +0 -926
- package/dist/features/seller/index.js.map +0 -1
- package/dist/features/stores/index.cjs +0 -1942
- package/dist/features/stores/index.cjs.map +0 -1
- package/dist/features/stores/index.d.cts +0 -536
- package/dist/features/stores/index.js.map +0 -1
- package/dist/features/stores/server.cjs +0 -451
- package/dist/features/stores/server.cjs.map +0 -1
- package/dist/features/stores/server.d.cts +0 -106
- package/dist/features/stores/server.js.map +0 -1
- package/dist/features/whatsapp-bot/index.cjs +0 -168
- package/dist/features/whatsapp-bot/index.cjs.map +0 -1
- package/dist/features/whatsapp-bot/index.d.cts +0 -85
- package/dist/features/whatsapp-bot/index.js.map +0 -1
- package/dist/features/wishlist/index.cjs +0 -904
- package/dist/features/wishlist/index.cjs.map +0 -1
- package/dist/features/wishlist/index.d.cts +0 -360
- package/dist/features/wishlist/index.js.map +0 -1
- package/dist/http/index.cjs +0 -21
- package/dist/http/index.cjs.map +0 -1
- package/dist/http/index.d.cts +0 -61
- package/dist/http/index.js.map +0 -1
- package/dist/index-B6T9NNcG.d.cts +0 -9
- package/dist/index-B6T9NNcG.d.ts +0 -9
- package/dist/index-CakUKzrE.d.cts +0 -10
- package/dist/index-CakUKzrE.d.ts +0 -10
- package/dist/index-D0Fxv9Z8.d.cts +0 -32
- package/dist/index-D0Fxv9Z8.d.ts +0 -32
- package/dist/index-Dh42RtMY.d.cts +0 -54
- package/dist/index-Dh42RtMY.d.ts +0 -54
- package/dist/index.cjs +0 -1182
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -17
- package/dist/index.js.map +0 -1
- package/dist/instrumentation/index.cjs +0 -17
- package/dist/instrumentation/index.cjs.map +0 -1
- package/dist/instrumentation/index.d.cts +0 -66
- package/dist/instrumentation/index.js.map +0 -1
- package/dist/monitoring/index.cjs +0 -141
- package/dist/monitoring/index.cjs.map +0 -1
- package/dist/monitoring/index.d.cts +0 -181
- package/dist/monitoring/index.js.map +0 -1
- package/dist/next/index.cjs +0 -693
- package/dist/next/index.cjs.map +0 -1
- package/dist/next/index.d.cts +0 -777
- package/dist/next/index.js.map +0 -1
- package/dist/providers/auth-firebase/index.cjs +0 -400
- package/dist/providers/auth-firebase/index.cjs.map +0 -1
- package/dist/providers/auth-firebase/index.d.cts +0 -137
- package/dist/providers/auth-firebase/index.js.map +0 -1
- package/dist/providers/db-firebase/index.cjs +0 -533
- package/dist/providers/db-firebase/index.cjs.map +0 -1
- package/dist/providers/db-firebase/index.d.cts +0 -265
- package/dist/providers/db-firebase/index.js.map +0 -1
- package/dist/providers/email-resend/index.cjs +0 -58
- package/dist/providers/email-resend/index.cjs.map +0 -1
- package/dist/providers/email-resend/index.d.cts +0 -73
- package/dist/providers/email-resend/index.js.map +0 -1
- package/dist/providers/payment-razorpay/index.cjs +0 -111
- package/dist/providers/payment-razorpay/index.cjs.map +0 -1
- package/dist/providers/payment-razorpay/index.d.cts +0 -96
- package/dist/providers/payment-razorpay/index.js.map +0 -1
- package/dist/providers/search-algolia/index.cjs +0 -301
- package/dist/providers/search-algolia/index.cjs.map +0 -1
- package/dist/providers/search-algolia/index.d.cts +0 -251
- package/dist/providers/search-algolia/index.d.ts +0 -251
- package/dist/providers/search-algolia/index.js +0 -280
- package/dist/providers/search-algolia/index.js.map +0 -1
- package/dist/providers/shipping-shiprocket/index.cjs +0 -147
- package/dist/providers/shipping-shiprocket/index.cjs.map +0 -1
- package/dist/providers/shipping-shiprocket/index.d.cts +0 -236
- package/dist/providers/shipping-shiprocket/index.js.map +0 -1
- package/dist/providers/storage-firebase/index.cjs +0 -176
- package/dist/providers/storage-firebase/index.cjs.map +0 -1
- package/dist/providers/storage-firebase/index.d.cts +0 -53
- package/dist/providers/storage-firebase/index.js.map +0 -1
- package/dist/react/index.cjs +0 -1687
- package/dist/react/index.cjs.map +0 -1
- package/dist/react/index.d.cts +0 -788
- package/dist/react/index.js.map +0 -1
- package/dist/repository-BO60jtdT.d.cts +0 -61
- package/dist/repository-BO60jtdT.d.ts +0 -61
- package/dist/repository-jKU_Ji1P.d.cts +0 -44
- package/dist/repository-jKU_Ji1P.d.ts +0 -44
- package/dist/security/index.cjs +0 -138
- package/dist/security/index.cjs.map +0 -1
- package/dist/security/index.d.cts +0 -309
- package/dist/security/index.js.map +0 -1
- package/dist/seed/index.cjs +0 -1085
- package/dist/seed/index.cjs.map +0 -1
- package/dist/seed/index.d.cts +0 -397
- package/dist/seed/index.js.map +0 -1
- package/dist/seo/index.cjs +0 -81
- package/dist/seo/index.cjs.map +0 -1
- package/dist/seo/index.d.cts +0 -150
- package/dist/seo/index.js.map +0 -1
- package/dist/style/tailwind/index.cjs +0 -40
- package/dist/style/tailwind/index.cjs.map +0 -1
- package/dist/style/tailwind/index.d.cts +0 -34
- package/dist/style/tailwind/index.js.map +0 -1
- package/dist/style/vanilla/index.cjs +0 -40
- package/dist/style/vanilla/index.cjs.map +0 -1
- package/dist/style/vanilla/index.d.cts +0 -26
- package/dist/style/vanilla/index.js.map +0 -1
- package/dist/style-BSlM-eWG.d.cts +0 -25
- package/dist/style-BSlM-eWG.d.ts +0 -25
- package/dist/tokens/index.cjs +0 -45
- package/dist/tokens/index.cjs.map +0 -1
- package/dist/tokens/index.d.cts +0 -734
- package/dist/tokens/index.js.map +0 -1
- package/dist/ui/index.cjs +0 -4870
- package/dist/ui/index.cjs.map +0 -1
- package/dist/ui/index.d.cts +0 -1644
- package/dist/ui/index.js.map +0 -1
- package/dist/utils/index.cjs +0 -505
- package/dist/utils/index.cjs.map +0 -1
- package/dist/utils/index.d.cts +0 -545
- package/dist/utils/index.js.map +0 -1
- package/dist/validation/index.cjs +0 -153
- package/dist/validation/index.cjs.map +0 -1
- package/dist/validation/index.d.cts +0 -126
- package/dist/validation/index.js.map +0 -1
package/dist/next/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/next/api/errorHandler.ts","../../src/next/api/routeHandler.ts","../../src/next/api/apiHandler.ts","../../src/next/request-helpers.ts","../../src/next/cache-middleware.ts","../../src/next/middleware/pii-scrubber.ts","../../src/next/middleware/chain.ts","../../src/next/middleware/pii-redactor.ts","../../src/next/api/api-response.ts","../../src/next/components/GlobalError.tsx","../../src/next/components/ErrorView.tsx","../../src/next/components/NotFoundView.tsx","../../src/next/components/UnauthorizedView.tsx"],"names":["NextResponse","key","useEffect","jsxs","jsx"],"mappings":";;;;;;;;;;;;AAiEO,SAAS,sBACd,OAAA,EACA;AACA,EAAA,MAAM;AAAA,IACJ,UAAA;AAAA,IACA,aAAA;AAAA,IACA,MAAA;AAAA,IACA,MAAA;AAAA,IACA,iBAAA,GAAoB,gBAAA;AAAA,IACpB,oBAAA,GAAuB;AAAA,GACzB,GAAI,OAAA;AAEJ,EAAA,OAAO,SAAS,eAAe,KAAA,EAA8B;AAE3D,IAAA,IAAI,UAAA,CAAW,KAAK,CAAA,EAAG;AACrB,MAAA,MAAM,MAAA,GAAS,cAAc,KAAK,CAAA;AAClC,MAAA,IAAI,UAAU,GAAA,EAAK;AACjB,QAAA,MAAA,CAAO,MAAM,WAAA,EAAa;AAAA,UACxB,IAAA,EAAM,OAAO,KAAK;AAAA,SACnB,CAAA;AAAA,MACH;AACA,MAAA,OAAO,aAAa,IAAA,CAAK,MAAA,CAAO,KAAK,CAAA,EAAG,EAAE,QAAQ,CAAA;AAAA,IACpD;AAGA,IAAA,IACE,KAAA,KAAU,IAAA,IACV,OAAO,KAAA,KAAU,QAAA,IACjB,QAAA,IAAY,KAAA,IACZ,KAAA,CAAM,OAAA,CAAS,KAAA,CAAkC,MAAM,CAAA,EACvD;AACA,MAAA,OAAO,YAAA,CAAa,IAAA;AAAA,QAClB;AAAA,UACE,OAAA,EA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AA,EAAQ,GAAA,EAAK,MAAA,EAAO,EACzC,QAAA,EAAA;AAAA,0BAAAC,GAAAA,CAAC,GAAA,EAAA,EAAE,IAAA,EAAM,SAAA,EAAY,QAAA,EAAA,UAAA,EAAW,CAAA;AAAA,0BAChCA,GAAAA,CAAC,GAAA,EAAA,EAAE,IAAA,EAAM,UAAW,QAAA,EAAA,SAAA,EAAU;AAAA,SAAA,EAChC;AAAA;AAAA;AAAA,GACF;AAEJ","file":"index.js","sourcesContent":["/**\n * Generic API error handler for Next.js API routes.\n *\n * Framework-agnostic version of the app's handleApiError. Business-specific\n * error classes and loggers are injected via factory options so this module\n * has zero knowledge of Firebase, Resend, or letitrip.in domain logic.\n *\n * @example\n * ```ts\n * // apps/web/src/lib/api/error-handler.ts\n * import { createApiErrorHandler } from '@mohasinac/next';\n * import { AppError } from '@/lib/errors';\n * import { serverLogger } from '@/lib/server-logger';\n *\n * export const handleApiError = createApiErrorHandler({\n * isAppError: (e): e is AppError => e instanceof AppError,\n * getStatusCode: (e) => e.statusCode,\n * toJSON: (e) => e.toJSON(),\n * logger: serverLogger,\n * internalErrorCode: 'GEN_INTERNAL_ERROR',\n * internalErrorMessage: 'An internal server error occurred',\n * });\n * ```\n */\n\nimport { NextResponse } from \"next/server.js\";\n\n/** Minimal logger interface — satisfied by Winston, Pino, or console. */\nexport interface IApiErrorLogger {\n error(message: string, meta?: Record<string, unknown>): void;\n}\n\n/** Options for createApiErrorHandler factory. */\nexport interface ApiErrorHandlerOptions<TAppError> {\n /**\n * Type guard — returns true when the thrown value is your app's AppError\n * (or any subclass) that has statusCode / toJSON methods.\n */\n isAppError(err: unknown): err is TAppError;\n\n /** Extract the HTTP status code from your AppError. */\n getStatusCode(err: TAppError): number;\n\n /** Serialise the error to a JSON-safe shape for the response body. */\n toJSON(err: TAppError): unknown;\n\n /** Logger used for 5xx and unexpected errors. */\n logger: IApiErrorLogger;\n\n /** Error code included in the 500 response body. */\n internalErrorCode?: string;\n\n /** Error message included in the 500 response body. */\n internalErrorMessage?: string;\n}\n\n/**\n * Build a typed handleApiError function bound to your app's error hierarchy.\n *\n * The returned function:\n * - Returns a typed NextResponse for known AppError subclasses.\n * - Returns a 400 with validation details for Zod-like error shapes.\n * - Logs unexpected errors server-side; returns a generic 500 (no stack trace\n * leaks to the client).\n */\nexport function createApiErrorHandler<TAppError>(\n options: ApiErrorHandlerOptions<TAppError>,\n) {\n const {\n isAppError,\n getStatusCode,\n toJSON,\n logger,\n internalErrorCode = \"INTERNAL_ERROR\",\n internalErrorMessage = \"An internal server error occurred\",\n } = options;\n\n return function handleApiError(error: unknown): NextResponse {\n // Known AppError subclass — structured response\n if (isAppError(error)) {\n const status = getStatusCode(error);\n if (status >= 500) {\n logger.error(\"API Error\", {\n body: toJSON(error) as Record<string, unknown>,\n });\n }\n return NextResponse.json(toJSON(error), { status });\n }\n\n // Zod / similar validation error shape: { issues: [...] }\n if (\n error !== null &&\n typeof error === \"object\" &&\n \"issues\" in error &&\n Array.isArray((error as Record<string, unknown>).issues)\n ) {\n return NextResponse.json(\n {\n success: false,\n error: \"Validation failed\",\n code: \"VALIDATION_ERROR\",\n data: error,\n },\n { status: 400 },\n );\n }\n\n // Unknown / unexpected error — log full details, return generic 500\n logger.error(\"Unexpected API error\", {\n error:\n error instanceof Error\n ? { name: error.name, message: error.message, stack: error.stack }\n : error,\n });\n\n return NextResponse.json(\n {\n success: false,\n error: internalErrorMessage,\n code: internalErrorCode,\n },\n { status: 500 },\n );\n };\n}\n","/**\r\n * createRouteHandler — provider-aware API route handler factory for feat-* packages.\r\n *\r\n * Works like letitrip.in's local `createApiHandler` but uses `getProviders().session`\r\n * for auth instead of a hardwired Firebase Admin call. This makes it portable across\r\n * all consumer projects that register an `ISessionProvider`.\r\n *\r\n * @example\r\n * ```ts\r\n * export const POST = createRouteHandler({\r\n * auth: true,\r\n * roles: [\"admin\"],\r\n * schema: mySchema,\r\n * handler: async ({ user, body }) => { ... },\r\n * });\r\n * ```\r\n */\r\n\r\nimport { NextResponse } from \"next/server.js\";\r\nimport { getProviders } from \"@mohasinac/contracts\";\r\n\r\n/** Minimal schema interface compatible with Zod v3 and v4. */\r\ninterface ParseableSchema<TOutput> {\r\n safeParse(\r\n data: unknown,\r\n ):\r\n | { success: true; data: TOutput }\r\n | { success: false; error: { issues?: unknown[] } };\r\n}\r\n\r\nexport interface RouteUser {\r\n uid: string;\r\n email?: string | null;\r\n role?: string;\r\n [key: string]: unknown;\r\n}\r\n\r\ninterface RouteHandlerOptions<\r\n TInput = unknown,\r\n TParams = Record<string, string>,\r\n> {\r\n /** Require a valid session cookie. Implied when `roles` is set. */\r\n auth?: boolean;\r\n /**\r\n * If provided, the verified user's `role` must be in this list.\r\n * Implies `auth: true`.\r\n */\r\n roles?: string[];\r\n /** Zod schema to validate + parse the JSON request body. */\r\n schema?: ParseableSchema<TInput>;\r\n /** Route handler. `user` is present when `auth: true`. */\r\n handler: (ctx: {\r\n request: Request;\r\n user?: RouteUser;\r\n body?: TInput;\r\n params?: TParams;\r\n }) => Promise<Response>;\r\n}\r\n\r\n/** Read the `__session` HTTP-only cookie from request headers. */\r\nfunction readSessionCookie(request: Request): string | null {\r\n const cookieHeader = request.headers.get(\"cookie\") ?? \"\";\r\n const match = cookieHeader.match(/(?:^|;\\s*)__session=([^;]+)/);\r\n return match ? decodeURIComponent(match[1]) : null;\r\n}\r\n\r\n/**\r\n * Verify the session cookie using `getProviders().session`.\r\n * Returns a `RouteUser` on success, or throws for invalid credentials.\r\n */\r\nasync function verifySession(request: Request): Promise<RouteUser> {\r\n const { session } = getProviders();\r\n if (!session) {\r\n throw Object.assign(new Error(\"Session provider not configured\"), {\r\n status: 503,\r\n });\r\n }\r\n const cookie = readSessionCookie(request);\r\n if (!cookie) {\r\n throw Object.assign(new Error(\"Authentication required\"), { status: 401 });\r\n }\r\n try {\r\n const payload = await session.verifySession(cookie);\r\n return {\r\n uid: payload.uid,\r\n email: payload.email,\r\n role: payload.role,\r\n emailVerified: payload.emailVerified,\r\n ...payload.claims,\r\n };\r\n } catch {\r\n throw Object.assign(new Error(\"Invalid or expired session\"), {\r\n status: 401,\r\n });\r\n }\r\n}\r\n\r\n/**\r\n * Create a typed Next.js App Router handler with built-in auth + Zod validation.\r\n */\r\nexport function createRouteHandler<\r\n TInput = unknown,\r\n TParams = Record<string, string>,\r\n>(options: RouteHandlerOptions<TInput, TParams>) {\r\n return async (\r\n request: Request,\r\n context: { params: Promise<TParams> },\r\n ): Promise<Response> => {\r\n try {\r\n // ── Auth ──────────────────────────────────────────────────────────────\r\n let user: RouteUser | undefined;\r\n const needsAuth =\r\n options.auth || (options.roles && options.roles.length > 0);\r\n\r\n if (needsAuth) {\r\n user = await verifySession(request);\r\n }\r\n\r\n if (options.roles && options.roles.length > 0) {\r\n if (!user || !options.roles.includes(user.role ?? \"\")) {\r\n return NextResponse.json(\r\n { success: false, error: \"Insufficient permissions\" },\r\n { status: 403 },\r\n );\r\n }\r\n }\r\n\r\n // ── Body validation ───────────────────────────────────────────────────\r\n let body: TInput | undefined;\r\n if (options.schema) {\r\n let raw: unknown;\r\n try {\r\n raw = await request.json();\r\n } catch {\r\n return NextResponse.json(\r\n { success: false, error: \"Invalid JSON body\" },\r\n { status: 400 },\r\n );\r\n }\r\n const result = options.schema.safeParse(raw);\r\n if (!result.success) {\r\n return NextResponse.json(\r\n {\r\n success: false,\r\n error: \"Validation failed\",\r\n issues: result.error.issues ?? [],\r\n },\r\n { status: 400 },\r\n );\r\n }\r\n body = result.data;\r\n }\r\n\r\n // ── Params ────────────────────────────────────────────────────────────\r\n const params = context?.params ? await context.params : undefined;\r\n\r\n return await options.handler({\r\n request,\r\n user,\r\n body,\r\n params: params as TParams | undefined,\r\n });\r\n } catch (err: unknown) {\r\n // Structured errors thrown with .status\r\n const status =\r\n typeof (err as { status?: unknown })?.status === \"number\"\r\n ? (err as { status: number }).status\r\n : 500;\r\n const message =\r\n err instanceof Error ? err.message : \"Internal server error\";\r\n console.error(`[createRouteHandler] ${request.method} failed`, err);\r\n return NextResponse.json({ success: false, error: message }, { status });\r\n }\r\n };\r\n}\r\n","interface SafeParseSchema<TInput> {\r\n safeParse: (input: unknown) =>\r\n | { success: true; data: TInput }\r\n | { success: false; error: { issues?: unknown[] } };\r\n}\r\n\r\nexport interface ApiRateLimitResult {\r\n success: boolean;\r\n limit: number;\r\n remaining: number;\r\n reset: number;\r\n}\r\n\r\nexport interface ApiHandlerOptions<\r\n TInput,\r\n TParams extends Record<string, string>,\r\n TRole,\r\n TRateLimitConfig,\r\n TUser,\r\n> {\r\n auth?: boolean;\r\n roles?: TRole[];\r\n rateLimit?: TRateLimitConfig;\r\n schema?: SafeParseSchema<TInput>;\r\n handler: (ctx: {\r\n request: Request;\r\n user?: TUser;\r\n body?: TInput;\r\n params?: TParams;\r\n }) => Promise<Response>;\r\n}\r\n\r\nexport interface ApiHandlerFactoryDeps<TRole, TRateLimitConfig, TUser> {\r\n applyRateLimit: (\r\n request: Request,\r\n config: TRateLimitConfig,\r\n ) => Promise<ApiRateLimitResult>;\r\n requireAuthFromRequest: (request: Request) => Promise<TUser>;\r\n requireRoleFromRequest: (\r\n request: Request,\r\n roles: TRole[],\r\n ) => Promise<TUser>;\r\n errorResponse: (\r\n message: string,\r\n status: number,\r\n issues?: unknown,\r\n ) => Response;\r\n handleApiError: (error: unknown) => Response;\r\n getRateLimitExceededMessage: () => string;\r\n logTiming: (entry: {\r\n method: string;\r\n path: string;\r\n status?: number;\r\n durationMs: number;\r\n error?: string;\r\n }) => void;\r\n}\r\n\r\nexport function createApiHandlerFactory<TRole, TRateLimitConfig, TUser>(\r\n deps: ApiHandlerFactoryDeps<TRole, TRateLimitConfig, TUser>,\r\n) {\r\n return function createApiHandler<\r\n TInput = unknown,\r\n TParams extends Record<string, string> = Record<string, string>,\r\n >(\r\n options: ApiHandlerOptions<\r\n TInput,\r\n TParams,\r\n TRole,\r\n TRateLimitConfig,\r\n TUser\r\n >,\r\n ) {\r\n return async (\r\n request: Request,\r\n context: { params: Promise<TParams> },\r\n ): Promise<Response> => {\r\n const startMs = performance.now();\r\n try {\r\n let rateLimitHeaders: Record<string, string> | undefined;\r\n if (options.rateLimit) {\r\n const rateLimitResult = await deps.applyRateLimit(\r\n request,\r\n options.rateLimit,\r\n );\r\n\r\n rateLimitHeaders = {\r\n \"RateLimit-Limit\": String(rateLimitResult.limit),\r\n \"RateLimit-Remaining\": String(rateLimitResult.remaining),\r\n \"RateLimit-Reset\": String(rateLimitResult.reset),\r\n };\r\n\r\n if (!rateLimitResult.success) {\r\n return new Response(\r\n JSON.stringify({\r\n success: false,\r\n error: deps.getRateLimitExceededMessage(),\r\n }),\r\n {\r\n status: 429,\r\n headers: {\r\n \"Content-Type\": \"application/json\",\r\n ...rateLimitHeaders,\r\n },\r\n },\r\n );\r\n }\r\n }\r\n\r\n let user: TUser | undefined;\r\n if (options.roles && options.roles.length > 0) {\r\n user = await deps.requireRoleFromRequest(request, options.roles);\r\n } else if (options.auth) {\r\n user = await deps.requireAuthFromRequest(request);\r\n }\r\n\r\n let validatedBody: TInput | undefined;\r\n if (options.schema) {\r\n if (typeof (options.schema as { safeParse?: unknown }).safeParse === \"function\") {\r\n const body = await request.json();\r\n const result = options.schema.safeParse(body);\r\n if (!result.success) {\r\n return deps.errorResponse(\r\n \"Validation failed\",\r\n 400,\r\n result.error.issues,\r\n );\r\n }\r\n validatedBody = result.data;\r\n } else {\r\n try {\r\n validatedBody = (await request.json()) as TInput;\r\n } catch {\r\n validatedBody = undefined;\r\n }\r\n }\r\n }\r\n\r\n const resolvedParams = (context as { params?: Promise<TParams> })?.params\r\n ? await context.params\r\n : undefined;\r\n\r\n const response = await options.handler({\r\n request,\r\n user,\r\n body: validatedBody,\r\n params: resolvedParams,\r\n });\r\n\r\n response.headers.set(\"Access-Control-Max-Age\", \"86400\");\r\n\r\n if (rateLimitHeaders) {\r\n for (const [key, value] of Object.entries(rateLimitHeaders)) {\r\n response.headers.set(key, value);\r\n }\r\n }\r\n\r\n deps.logTiming({\r\n method: request.method,\r\n path: new URL(request.url).pathname,\r\n status: response.status,\r\n durationMs: Math.round(performance.now() - startMs),\r\n });\r\n\r\n return response;\r\n } catch (error) {\r\n deps.logTiming({\r\n method: request.method,\r\n path: new URL(request.url).pathname,\r\n durationMs: Math.round(performance.now() - startMs),\r\n error: error instanceof Error ? error.message : String(error),\r\n });\r\n\r\n return deps.handleApiError(error);\r\n }\r\n };\r\n };\r\n}","/**\r\n * API Request Helpers\r\n *\r\n * Generic utilities for API route request parsing and session extraction.\r\n * Uses structural request types (not NextRequest) to avoid cross-package\r\n * type identity issues when multiple Next.js installs exist in a monorepo.\r\n */\r\n\r\nimport { AuthenticationError } from \"@mohasinac/errors\";\r\n\r\ninterface CookieStoreLike {\r\n get(name: string): { value?: string } | string | undefined;\r\n}\r\n\r\ntype CookieCapableRequest = Request & { cookies?: CookieStoreLike };\r\n\r\nfunction readCookieFromHeader(request: Request, name: string): string | undefined {\r\n const cookieHeader = request.headers.get(\"cookie\") ?? \"\";\r\n const match = cookieHeader.match(\r\n new RegExp(`(?:^|;\\\\s*)${name}=([^;]+)`),\r\n );\r\n return match ? decodeURIComponent(match[1]) : undefined;\r\n}\r\n\r\nexport function getSearchParams(request: Request): URLSearchParams {\r\n return new URL(request.url).searchParams;\r\n}\r\n\r\nexport function getOptionalSessionCookie(\r\n request: CookieCapableRequest,\r\n): string | undefined {\r\n const cookieValue = request.cookies?.get(\"__session\");\r\n if (typeof cookieValue === \"string\") return cookieValue;\r\n if (cookieValue && typeof cookieValue === \"object\") return cookieValue.value;\r\n return readCookieFromHeader(request, \"__session\");\r\n}\r\n\r\nexport function getRequiredSessionCookie(request: CookieCapableRequest): string {\r\n const cookie = getOptionalSessionCookie(request);\r\n if (!cookie) throw new AuthenticationError(\"Unauthorized\");\r\n return cookie;\r\n}\r\n\r\nexport function getBooleanParam(\r\n searchParams: URLSearchParams,\r\n key: string,\r\n): boolean | undefined {\r\n const value = searchParams.get(key);\r\n if (value === null) return undefined;\r\n return value === \"true\";\r\n}\r\n\r\nexport function getStringParam(\r\n searchParams: URLSearchParams,\r\n key: string,\r\n): string | undefined {\r\n const value = searchParams.get(key);\r\n if (!value) return undefined;\r\n return value;\r\n}\r\n\r\nexport function getNumberParam(\r\n searchParams: URLSearchParams,\r\n key: string,\r\n fallback: number,\r\n options?: { min?: number; max?: number },\r\n): number {\r\n const rawValue = searchParams.get(key);\r\n const parsed = rawValue ? Number.parseInt(rawValue, 10) : fallback;\r\n const safeValue = Number.isNaN(parsed) ? fallback : parsed;\r\n if (typeof options?.min === \"number\" && safeValue < options.min)\r\n return options.min;\r\n if (typeof options?.max === \"number\" && safeValue > options.max)\r\n return options.max;\r\n return safeValue;\r\n}\r\n","/**\r\n * API Response Cache Middleware\r\n *\r\n * Wraps a Next.js API handler with in-memory response caching via CacheManager.\r\n *\r\n * @example\r\n * ```ts\r\n * export const GET = withCache(\r\n * async (request) => { ... return NextResponse.json(data); },\r\n * { ttl: 5 * 60 * 1000 }\r\n * );\r\n * ```\r\n */\r\n\r\nimport type { NextRequest } from \"next/server.js\";\r\nimport { NextResponse } from \"next/server.js\";\r\nimport { CacheManager } from \"@mohasinac/core\";\r\n\r\nexport interface CacheConfig {\r\n /** Time to live in milliseconds. Default: 5 minutes. */\r\n ttl?: number;\r\n /** Include query string in cache key. Default: true. */\r\n includeQuery?: boolean;\r\n /** Custom cache key generator. */\r\n keyGenerator?: (request: NextRequest) => string;\r\n /** Bypass caching entirely. Default: false. */\r\n bypassCache?: boolean;\r\n /** Only cache for these HTTP methods. Default: ['GET']. */\r\n methods?: string[];\r\n}\r\n\r\nconst DEFAULT_TTL = 5 * 60 * 1000;\r\nconst cache = CacheManager.getInstance(500);\r\n\r\nfunction buildCacheKey(request: NextRequest, config: CacheConfig): string {\r\n if (config.keyGenerator) return config.keyGenerator(request);\r\n const url = new URL(request.url);\r\n if (config.includeQuery !== false && url.search)\r\n return `${url.pathname}${url.search}`;\r\n return url.pathname;\r\n}\r\n\r\nfunction isCacheable(request: NextRequest, config: CacheConfig): boolean {\r\n if (config.bypassCache) return false;\r\n const methods = config.methods ?? [\"GET\"];\r\n return methods.includes(request.method);\r\n}\r\n\r\ntype Handler = (\r\n request: NextRequest,\r\n ...args: unknown[]\r\n) => Promise<NextResponse>;\r\n\r\nexport function withCache(handler: Handler, config: CacheConfig = {}): Handler {\r\n return async (\r\n request: NextRequest,\r\n ...args: unknown[]\r\n ): Promise<NextResponse> => {\r\n if (!isCacheable(request, config)) {\r\n return handler(request, ...args);\r\n }\r\n\r\n const key = buildCacheKey(request, config);\r\n const cached = cache.get<{\r\n body: string;\r\n status: number;\r\n headers: Record<string, string>;\r\n }>(key);\r\n if (cached) {\r\n return new NextResponse(cached.body, {\r\n status: cached.status,\r\n headers: cached.headers,\r\n });\r\n }\r\n\r\n const response = await handler(request, ...args);\r\n const body = await response.text();\r\n const headers: Record<string, string> = {};\r\n response.headers.forEach((value, key) => {\r\n headers[key] = value;\r\n });\r\n\r\n cache.set(\r\n key,\r\n { body, status: response.status, headers },\r\n { ttl: config.ttl ?? DEFAULT_TTL },\r\n );\r\n\r\n return new NextResponse(body, { status: response.status, headers });\r\n };\r\n}\r\n\r\n/**\r\n * Invalidate cache entries by key prefix or regex pattern.\r\n * Pass no argument to clear the entire cache.\r\n */\r\nexport function invalidateCache(pattern?: string | RegExp): void {\r\n if (!pattern) {\r\n cache.clear();\r\n return;\r\n }\r\n const keys = cache.keys();\r\n if (typeof pattern === \"string\") {\r\n for (const key of keys) {\r\n if (key.startsWith(pattern)) cache.delete(key);\r\n }\r\n } else {\r\n for (const key of keys) {\r\n if (pattern.test(key)) cache.delete(key);\r\n }\r\n }\r\n}\r\n","// appkit/src/next/middleware/pii-scrubber.ts\r\nimport type { NextRequest, NextResponse as NR } from \"next/server\";\r\nimport { NextResponse } from \"next/server\";\r\nimport type { BaseRequestContext, Middleware } from \"./types\";\r\n\r\nconst ENC_PREFIX = \"enc:v1:\";\r\n\r\nfunction scrubValue(value: unknown): unknown {\r\n if (typeof value === \"string\" && value.startsWith(ENC_PREFIX)) {\r\n return \"[encrypted]\";\r\n }\r\n if (Array.isArray(value)) return value.map(scrubValue);\r\n if (value !== null && typeof value === \"object\") {\r\n return Object.fromEntries(\r\n Object.entries(value as Record<string, unknown>).map(([k, v]) => [\r\n k,\r\n scrubValue(v),\r\n ]),\r\n );\r\n }\r\n return value;\r\n}\r\n\r\n/**\r\n * PiiScrubberMiddleware — safety net.\r\n *\r\n * Walks the entire JSON response body and replaces any string that starts with\r\n * the `enc:v1:` prefix (AES-256-GCM ciphertext) with the literal `\"[encrypted]\"`.\r\n *\r\n * This prevents raw Firestore ciphertext from leaking to the client when a\r\n * repository path forgets to call `decryptPiiFields()`.\r\n */\r\nexport const piiScrubberMiddleware: Middleware<BaseRequestContext> = async (\r\n _request: NextRequest,\r\n _ctx: BaseRequestContext,\r\n next: () => Promise<NR>,\r\n): Promise<NR> => {\r\n const response = await next();\r\n\r\n const contentType = response.headers.get(\"content-type\") ?? \"\";\r\n if (!contentType.includes(\"application/json\")) return response;\r\n\r\n let body: unknown;\r\n try {\r\n body = await response.json();\r\n } catch {\r\n return response;\r\n }\r\n\r\n const scrubbed = scrubValue(body);\r\n\r\n return NextResponse.json(scrubbed, {\r\n status: response.status,\r\n headers: response.headers,\r\n });\r\n};\r\n","// appkit/src/next/middleware/chain.ts\r\nimport type { NextRequest, NextResponse as NR } from \"next/server\";\r\nimport { NextResponse } from \"next/server\";\r\nimport type {\r\n BaseRequestContext,\r\n AuthRequestContext,\r\n Middleware,\r\n} from \"./types\";\r\nimport { piiScrubberMiddleware } from \"./pii-scrubber\";\r\n\r\n/**\r\n * runChain — sequential middleware runner.\r\n *\r\n * Each middleware calls `next()` to pass control to the subsequent one.\r\n * The final `next()` invokes the `handler` function.\r\n */\r\nexport async function runChain<Ctx extends BaseRequestContext>(\r\n middlewares: Middleware<Ctx>[],\r\n ctx: Ctx,\r\n request: NextRequest,\r\n handler: () => Promise<NR>,\r\n): Promise<NR> {\r\n let index = 0;\r\n\r\n async function next(): Promise<NR> {\r\n if (index < middlewares.length) {\r\n const mw = middlewares[index++]!;\r\n return mw(request, ctx, next);\r\n }\r\n return handler();\r\n }\r\n\r\n return next();\r\n}\r\n\r\n/**\r\n * buildBaseContext — initialises request context from the incoming NextRequest.\r\n */\r\nexport function buildBaseContext(request: NextRequest): BaseRequestContext {\r\n return {\r\n traceId: crypto.randomUUID(),\r\n ip:\r\n request.headers.get(\"x-forwarded-for\")?.split(\",\")[0]?.trim() ??\r\n \"unknown\",\r\n locale:\r\n request.headers.get(\"accept-language\")?.split(\",\")[0]?.split(\"-\")[0] ??\r\n \"en\",\r\n startedAt: Date.now(),\r\n };\r\n}\r\n\r\nexport interface CreateApiMiddlewareConfig<TCtx extends BaseRequestContext> {\r\n /** Additional domain-specific middlewares to run before the handler */\r\n middlewares?: Middleware<TCtx>[];\r\n /**\r\n * Whether to apply the PII scrubber to the response.\r\n * Default: `true`.\r\n */\r\n scrubPii?: boolean;\r\n}\r\n\r\n/**\r\n * createApiMiddleware — lightweight middleware chain builder for Next.js API routes.\r\n *\r\n * Composes the provided middlewares with the PII scrubber by default.\r\n * Returns an HOF: pass the route handler function to get a `NextRequest → NextResponse`\r\n * handler suitable for use as a Next.js App Router route export.\r\n *\r\n * @example\r\n * ```ts\r\n * // Simple route with scrubber only\r\n * export const GET = createApiMiddleware({})(async (_input, _ctx, req) => {\r\n * const data = await getProducts();\r\n * return NextResponse.json({ data });\r\n * });\r\n *\r\n * // Route with auth context + custom middleware\r\n * export const GET = createApiMiddleware({\r\n * middlewares: [myCustomMiddleware],\r\n * })(async (_input, ctx, _req) => {\r\n * // ctx is AuthRequestContext\r\n * return NextResponse.json({ uid: ctx.user.uid });\r\n * });\r\n * ```\r\n */\r\nexport function createApiMiddleware<\r\n TInput = unknown,\r\n TCtx extends BaseRequestContext = AuthRequestContext,\r\n>(config: CreateApiMiddlewareConfig<TCtx> = {}) {\r\n const { middlewares = [], scrubPii = true } = config;\r\n\r\n return function withHandler(\r\n routeFn: (input: TInput, ctx: TCtx, req: NextRequest) => Promise<NR>,\r\n ) {\r\n return async function handler(request: NextRequest): Promise<NR> {\r\n const ctx = buildBaseContext(request) as TCtx;\r\n\r\n const chain: Middleware<TCtx>[] = [\r\n ...middlewares,\r\n // Apply PII scrubber last (wraps all other middleware output)\r\n ...(scrubPii\r\n ? [piiScrubberMiddleware as unknown as Middleware<TCtx>]\r\n : []),\r\n ];\r\n\r\n return runChain(chain, ctx, request, async () => {\r\n try {\r\n return await routeFn({} as TInput, ctx, request);\r\n } catch (err) {\r\n const message =\r\n err instanceof Error ? err.message : \"Internal server error\";\r\n return NextResponse.json({ error: message }, { status: 500 });\r\n }\r\n });\r\n };\r\n };\r\n}\r\n","// appkit/src/next/middleware/pii-redactor.ts\r\nimport type { NextRequest, NextResponse as NR } from \"next/server\";\r\nimport { NextResponse } from \"next/server\";\r\nimport type { AuthRequestContext, Middleware } from \"./types\";\r\n\r\nexport interface PiiRedactionRule {\r\n /** Fields to redact from the top-level object or items[] */\r\n fields: string[];\r\n /**\r\n * If `true` (default), replace the value with a masked string like `a***@domain.com`.\r\n * If `false`, remove the field entirely.\r\n */\r\n mask?: boolean;\r\n /** Only redact if the caller does NOT have this permission string */\r\n unless?: string;\r\n}\r\n\r\nfunction maskPii(value: string): string {\r\n if (value.includes(\"@\")) {\r\n const [local, domain] = value.split(\"@\");\r\n return `${local?.[0] ?? \"\"}***@${domain}`;\r\n }\r\n if (/^\\+?\\d{7,}$/.test(value)) {\r\n return value.slice(0, 3) + \"***\" + value.slice(-2);\r\n }\r\n return \"***\";\r\n}\r\n\r\nfunction hasPermission(permissions: Set<string>, required: string): boolean {\r\n return permissions.has(\"*\") || permissions.has(required);\r\n}\r\n\r\nfunction redactObject(\r\n obj: Record<string, unknown>,\r\n fields: string[],\r\n mask: boolean,\r\n): Record<string, unknown> {\r\n return fields.reduce((acc, field) => {\r\n if (!(field in acc)) return acc;\r\n const current = acc[field];\r\n const redacted: Record<string, unknown> = { ...acc };\r\n if (mask && typeof current === \"string\") {\r\n redacted[field] = maskPii(current);\r\n } else {\r\n delete redacted[field];\r\n }\r\n return redacted;\r\n }, obj);\r\n}\r\n\r\n/**\r\n * createPiiRedactorMiddleware — field-level PII redaction for non-owners.\r\n *\r\n * Removes or masks declared PII fields from the response body unless the\r\n * calling user holds the specified permission.\r\n *\r\n * @example\r\n * ```ts\r\n * const userListRedactor = createPiiRedactorMiddleware([\r\n * { fields: [\"email\", \"phone\"], mask: true, unless: \"admin:users:pii\" },\r\n * { fields: [\"bankAccount\"], mask: false, unless: \"admin:payouts\" },\r\n * ]);\r\n *\r\n * export const GET = createApiMiddleware({\r\n * permission: \"admin:users\",\r\n * middlewares: [userListRedactor],\r\n * })(async (input, ctx) => { ... });\r\n * ```\r\n */\r\nexport function createPiiRedactorMiddleware(\r\n rules: PiiRedactionRule[],\r\n): Middleware<AuthRequestContext> {\r\n return async (\r\n _req: NextRequest,\r\n ctx: AuthRequestContext,\r\n next: () => Promise<NR>,\r\n ): Promise<NR> => {\r\n const response = await next();\r\n\r\n const contentType = response.headers.get(\"content-type\") ?? \"\";\r\n if (!contentType.includes(\"application/json\")) return response;\r\n\r\n let body: Record<string, unknown>;\r\n try {\r\n body = (await response.json()) as Record<string, unknown>;\r\n } catch {\r\n return response;\r\n }\r\n\r\n for (const { fields, mask = true, unless } of rules) {\r\n // Skip redaction if caller has the authorising permission\r\n if (unless && hasPermission(ctx.user.permissions, unless)) continue;\r\n\r\n // Handle both paginated { data: [] } and single-object responses\r\n if (Array.isArray(body.data)) {\r\n body = {\r\n ...body,\r\n data: (body.data as Record<string, unknown>[]).map((item) =>\r\n redactObject(item, fields, mask),\r\n ),\r\n };\r\n } else {\r\n body = redactObject(body, fields, mask);\r\n }\r\n }\r\n\r\n return NextResponse.json(body, {\r\n status: response.status,\r\n headers: response.headers,\r\n });\r\n };\r\n}\r\n","/**\r\n * Standardized API Response Utilities\r\n *\r\n * Provides consistent response formatting across all Next.js API routes.\r\n * No app-specific dependencies — safe to use in any project.\r\n */\r\n\r\nimport { NextResponse } from \"next/server\";\r\n\r\nexport interface ApiSuccessResponse<T = unknown> {\r\n success: true;\r\n data?: T;\r\n message?: string;\r\n meta?: Record<string, unknown>;\r\n}\r\n\r\nexport interface ApiErrorResponse {\r\n success: false;\r\n error: string;\r\n details?: unknown;\r\n}\r\n\r\nexport function successResponse<T>(\r\n data?: T,\r\n message?: string,\r\n status: number = 200,\r\n meta?: Record<string, unknown>,\r\n): NextResponse<ApiSuccessResponse<T>> {\r\n return NextResponse.json(\r\n {\r\n success: true,\r\n ...(data !== undefined && { data }),\r\n ...(message && { message }),\r\n ...(meta && { meta }),\r\n },\r\n { status },\r\n );\r\n}\r\n\r\nexport function errorResponse(\r\n error: string,\r\n status: number = 400,\r\n details?: unknown,\r\n): NextResponse<ApiErrorResponse> {\r\n return NextResponse.json(\r\n {\r\n success: false,\r\n error,\r\n ...(details !== undefined && { details }),\r\n },\r\n { status },\r\n );\r\n}\r\n\r\n/** Pre-built shorthand factories for common HTTP error responses. */\r\nexport const ApiErrors = {\r\n unauthorized: (message = \"Unauthorized\") => errorResponse(message, 401),\r\n\r\n forbidden: (message = \"Forbidden\") => errorResponse(message, 403),\r\n\r\n notFound: (resource = \"Resource\") =>\r\n errorResponse(`${resource} not found`, 404),\r\n\r\n badRequest: (message = \"Bad request\", details?: unknown) =>\r\n errorResponse(message, 400, details),\r\n\r\n internalError: (message = \"Internal server error\") =>\r\n errorResponse(message, 500),\r\n\r\n validationError: (details: unknown) =>\r\n errorResponse(\"Validation failed\", 422, details),\r\n};\r\n","\"use client\";\r\n\r\n/**\r\n * GlobalError — Next.js global-error.tsx template.\r\n *\r\n * Catches errors in the root layout (above all per-route error.tsx).\r\n * Must be a Client Component and must render <html> + <body>.\r\n * @see https://nextjs.org/docs/app/api-reference/file-conventions/error#global-errorjs\r\n *\r\n * Usage in your app:\r\n * // app/global-error.tsx\r\n * export { GlobalError as default } from \"@mohasinac/appkit/next\";\r\n */\r\n\r\nimport { useEffect } from \"react\";\r\nimport { trackError, ErrorCategory, ErrorSeverity } from \"../../monitoring\";\r\n\r\nexport interface GlobalErrorProps {\r\n error: Error & { digest?: string };\r\n reset: () => void;\r\n}\r\n\r\nexport function GlobalError({ error, reset }: GlobalErrorProps) {\r\n useEffect(() => {\r\n trackError(error, ErrorCategory.UNKNOWN, ErrorSeverity.CRITICAL, {\r\n component: \"GlobalError\",\r\n metadata: { digest: error.digest },\r\n });\r\n }, [error]);\r\n\r\n return (\r\n <html>\r\n <body\r\n style={{\r\n display: \"flex\",\r\n flexDirection: \"column\",\r\n alignItems: \"center\",\r\n justifyContent: \"center\",\r\n minHeight: \"100vh\",\r\n margin: 0,\r\n fontFamily: \"system-ui, sans-serif\",\r\n padding: \"2rem\",\r\n textAlign: \"center\",\r\n }}\r\n >\r\n <h1 style={{ fontSize: \"2rem\", marginBottom: \"0.5rem\" }}>\r\n Something went wrong\r\n </h1>\r\n <p style={{ opacity: 0.7, marginBottom: \"1.5rem\" }}>\r\n A critical error occurred. We're working on it.\r\n </p>\r\n {process.env.NODE_ENV === \"development\" && (\r\n <pre\r\n style={{\r\n fontSize: \"0.75rem\",\r\n padding: \"1rem\",\r\n background: \"#f3f4f6\",\r\n borderRadius: \"0.5rem\",\r\n textAlign: \"left\",\r\n maxWidth: \"40rem\",\r\n overflow: \"auto\",\r\n marginBottom: \"1.5rem\",\r\n }}\r\n >\r\n {error.message}\r\n {error.digest ? `\\n(digest: ${error.digest})` : \"\"}\r\n </pre>\r\n )}\r\n <button onClick={reset} type=\"button\">\r\n Try again\r\n </button>\r\n </body>\r\n </html>\r\n );\r\n}\r\n","\"use client\";\r\n\r\n/**\r\n * ErrorView — Next.js per-route error.tsx template.\r\n *\r\n * Renders when an unexpected error is thrown inside a route segment.\r\n * @see https://nextjs.org/docs/app/api-reference/file-conventions/error\r\n *\r\n * Usage in your app:\r\n * // app/[locale]/error.tsx\r\n * export { ErrorView as default } from \"@mohasinac/appkit/next\";\r\n *\r\n * // Or with customisation:\r\n * import { ErrorView } from \"@mohasinac/appkit/next\";\r\n * export default function Error(props) {\r\n * return <ErrorView {...props} heading=\"Oops!\" />;\r\n * }\r\n */\r\n\r\nimport { useEffect } from \"react\";\r\nimport { trackError, ErrorCategory, ErrorSeverity } from \"../../monitoring\";\r\n\r\nexport interface ErrorViewProps {\r\n error: Error & { digest?: string };\r\n reset: () => void;\r\n /** Override the heading text. */\r\n heading?: string;\r\n /** Override the body text. */\r\n description?: string;\r\n /** Override the retry button label. */\r\n retryLabel?: string;\r\n}\r\n\r\nexport function ErrorView({\r\n error,\r\n reset,\r\n heading = \"Something went wrong\",\r\n description = \"An unexpected error occurred. Please try again.\",\r\n retryLabel = \"Try again\",\r\n}: ErrorViewProps) {\r\n useEffect(() => {\r\n trackError(error, ErrorCategory.UNKNOWN, ErrorSeverity.HIGH, {\r\n component: \"ErrorView\",\r\n metadata: { digest: error.digest },\r\n });\r\n }, [error]);\r\n\r\n return (\r\n <div\r\n role=\"alert\"\r\n style={{\r\n display: \"flex\",\r\n flexDirection: \"column\",\r\n alignItems: \"center\",\r\n justifyContent: \"center\",\r\n minHeight: \"50vh\",\r\n padding: \"2rem\",\r\n textAlign: \"center\",\r\n }}\r\n >\r\n <h2 style={{ fontSize: \"1.5rem\", marginBottom: \"0.5rem\" }}>{heading}</h2>\r\n <p style={{ opacity: 0.7, marginBottom: \"1.5rem\" }}>{description}</p>\r\n {process.env.NODE_ENV === \"development\" && error.digest && (\r\n <p style={{ fontSize: \"0.75rem\", opacity: 0.5, marginBottom: \"1rem\" }}>\r\n digest: {error.digest}\r\n </p>\r\n )}\r\n <button onClick={reset} type=\"button\">\r\n {retryLabel}\r\n </button>\r\n </div>\r\n );\r\n}\r\n","/**\r\n * NotFoundView — Next.js not-found.tsx template.\r\n *\r\n * Rendered when `notFound()` is called inside a route segment, or when a\r\n * route is not matched.\r\n * @see https://nextjs.org/docs/app/api-reference/file-conventions/not-found\r\n *\r\n * Usage in your app:\r\n * // app/[locale]/not-found.tsx\r\n * export { NotFoundView as default } from \"@mohasinac/appkit/next\";\r\n *\r\n * // Or with customisation:\r\n * import { NotFoundView } from \"@mohasinac/appkit/next\";\r\n * export default function NotFound() {\r\n * return <NotFoundView heading=\"Page not found\" homeHref=\"/en\" />;\r\n * }\r\n */\r\n\r\nexport interface NotFoundViewProps {\r\n /** Override the heading text. */\r\n heading?: string;\r\n /** Override the body text. */\r\n description?: string;\r\n /** Override the \"Go home\" label. */\r\n homeLabel?: string;\r\n /** Override the home link href. */\r\n homeHref?: string;\r\n}\r\n\r\nexport function NotFoundView({\r\n heading = \"404 — Page not found\",\r\n description = \"The page you are looking for does not exist.\",\r\n homeLabel = \"Go home\",\r\n homeHref = \"/\",\r\n}: NotFoundViewProps) {\r\n return (\r\n <div\r\n style={{\r\n display: \"flex\",\r\n flexDirection: \"column\",\r\n alignItems: \"center\",\r\n justifyContent: \"center\",\r\n minHeight: \"60vh\",\r\n padding: \"2rem\",\r\n textAlign: \"center\",\r\n }}\r\n >\r\n <h1 style={{ fontSize: \"4rem\", fontWeight: 700, marginBottom: \"0.5rem\" }}>\r\n 404\r\n </h1>\r\n <h2 style={{ fontSize: \"1.5rem\", marginBottom: \"0.75rem\" }}>{heading}</h2>\r\n <p style={{ opacity: 0.7, marginBottom: \"2rem\" }}>{description}</p>\r\n <a href={homeHref}>{homeLabel}</a>\r\n </div>\r\n );\r\n}\r\n","/**\r\n * UnauthorizedView — 401 page template.\r\n *\r\n * Render this when a user tries to access a resource they are not\r\n * authenticated for. Wire up the `loginHref` prop to your sign-in route.\r\n *\r\n * Usage in your app:\r\n * // app/[locale]/unauthorized/page.tsx\r\n * import { UnauthorizedView } from \"@mohasinac/appkit/next\";\r\n * export default function UnauthorizedPage() {\r\n * return <UnauthorizedView loginHref=\"/en/auth/login\" />;\r\n * }\r\n */\r\n\r\nexport interface UnauthorizedViewProps {\r\n /** Override the heading text. */\r\n heading?: string;\r\n /** Override the body text. */\r\n description?: string;\r\n /** Label for the sign-in link. */\r\n loginLabel?: string;\r\n /** href for the sign-in link. */\r\n loginHref?: string;\r\n /** Label for the home link. */\r\n homeLabel?: string;\r\n /** href for the home link. */\r\n homeHref?: string;\r\n}\r\n\r\nexport function UnauthorizedView({\r\n heading = \"401 — Unauthorized\",\r\n description = \"You need to be signed in to view this page.\",\r\n loginLabel = \"Sign in\",\r\n loginHref = \"/auth/login\",\r\n homeLabel = \"Go home\",\r\n homeHref = \"/\",\r\n}: UnauthorizedViewProps) {\r\n return (\r\n <div\r\n style={{\r\n display: \"flex\",\r\n flexDirection: \"column\",\r\n alignItems: \"center\",\r\n justifyContent: \"center\",\r\n minHeight: \"60vh\",\r\n padding: \"2rem\",\r\n textAlign: \"center\",\r\n }}\r\n >\r\n <h1 style={{ fontSize: \"4rem\", fontWeight: 700, marginBottom: \"0.5rem\" }}>\r\n 401\r\n </h1>\r\n <h2 style={{ fontSize: \"1.5rem\", marginBottom: \"0.75rem\" }}>{heading}</h2>\r\n <p style={{ opacity: 0.7, marginBottom: \"2rem\" }}>{description}</p>\r\n <div style={{ display: \"flex\", gap: \"1rem\" }}>\r\n <a href={loginHref}>{loginLabel}</a>\r\n <a href={homeHref}>{homeLabel}</a>\r\n </div>\r\n </div>\r\n );\r\n}\r\n"]}
|
|
@@ -1,400 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var app = require('firebase-admin/app');
|
|
4
|
-
var auth = require('firebase-admin/auth');
|
|
5
|
-
require('firebase-admin/firestore');
|
|
6
|
-
require('firebase-admin/storage');
|
|
7
|
-
require('firebase-admin/database');
|
|
8
|
-
var path = require('path');
|
|
9
|
-
var fs = require('fs');
|
|
10
|
-
require('@mohasinac/sievejs/services');
|
|
11
|
-
require('@mohasinac/sievejs/adapters/firebase');
|
|
12
|
-
|
|
13
|
-
function _interopNamespace(e) {
|
|
14
|
-
if (e && e.__esModule) return e;
|
|
15
|
-
var n = Object.create(null);
|
|
16
|
-
if (e) {
|
|
17
|
-
Object.keys(e).forEach(function (k) {
|
|
18
|
-
if (k !== 'default') {
|
|
19
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
20
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
21
|
-
enumerable: true,
|
|
22
|
-
get: function () { return e[k]; }
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
n.default = e;
|
|
28
|
-
return Object.freeze(n);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
var path__namespace = /*#__PURE__*/_interopNamespace(path);
|
|
32
|
-
var fs__namespace = /*#__PURE__*/_interopNamespace(fs);
|
|
33
|
-
|
|
34
|
-
var __defProp = Object.defineProperty;
|
|
35
|
-
var __defProps = Object.defineProperties;
|
|
36
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
37
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
38
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
39
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
40
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
41
|
-
var __spreadValues = (a, b) => {
|
|
42
|
-
for (var prop in b || (b = {}))
|
|
43
|
-
if (__hasOwnProp.call(b, prop))
|
|
44
|
-
__defNormalProp(a, prop, b[prop]);
|
|
45
|
-
if (__getOwnPropSymbols)
|
|
46
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
47
|
-
if (__propIsEnum.call(b, prop))
|
|
48
|
-
__defNormalProp(a, prop, b[prop]);
|
|
49
|
-
}
|
|
50
|
-
return a;
|
|
51
|
-
};
|
|
52
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
53
|
-
function parsePrivateKey(raw) {
|
|
54
|
-
return raw.replace(/^["']|["']$/g, "").replace(/\\n/g, "\n").replace(/\r\n/g, "\n").trim();
|
|
55
|
-
}
|
|
56
|
-
function get(key) {
|
|
57
|
-
var _a;
|
|
58
|
-
return (_a = globalThis[key]) != null ? _a : null;
|
|
59
|
-
}
|
|
60
|
-
function set(key, value) {
|
|
61
|
-
globalThis[key] = value;
|
|
62
|
-
}
|
|
63
|
-
function getAdminApp() {
|
|
64
|
-
var _a, _b, _c, _d, _e;
|
|
65
|
-
const cached = get("__mohasinac_firebase_admin_app__");
|
|
66
|
-
if (cached) return cached;
|
|
67
|
-
if (app.getApps().length) {
|
|
68
|
-
const existing = app.getApps()[0];
|
|
69
|
-
set("__mohasinac_firebase_admin_app__", existing);
|
|
70
|
-
return existing;
|
|
71
|
-
}
|
|
72
|
-
const keyPath = path__namespace.join(process.cwd(), "firebase-admin-key.json");
|
|
73
|
-
let app$1;
|
|
74
|
-
try {
|
|
75
|
-
if (fs__namespace.existsSync(keyPath)) {
|
|
76
|
-
const sa = JSON.parse(fs__namespace.readFileSync(keyPath, "utf8"));
|
|
77
|
-
const dbUrl = (_a = process.env.NEXT_PUBLIC_FIREBASE_DATABASE_URL) != null ? _a : `https://${sa.project_id}-default-rtdb.firebaseio.com`;
|
|
78
|
-
app$1 = app.initializeApp({ credential: app.cert(keyPath), databaseURL: dbUrl });
|
|
79
|
-
} else if (process.env.FIREBASE_ADMIN_PROJECT_ID && process.env.FIREBASE_ADMIN_CLIENT_EMAIL && process.env.FIREBASE_ADMIN_PRIVATE_KEY) {
|
|
80
|
-
const projectId = process.env.FIREBASE_ADMIN_PROJECT_ID.trim();
|
|
81
|
-
const dbUrl = (_e = (_d = (_b = process.env.FIREBASE_ADMIN_DATABASE_URL) == null ? void 0 : _b.trim()) != null ? _d : (_c = process.env.NEXT_PUBLIC_FIREBASE_DATABASE_URL) == null ? void 0 : _c.trim()) != null ? _e : `https://${projectId}-default-rtdb.firebaseio.com`;
|
|
82
|
-
app$1 = app.initializeApp({
|
|
83
|
-
credential: app.cert({
|
|
84
|
-
projectId,
|
|
85
|
-
clientEmail: process.env.FIREBASE_ADMIN_CLIENT_EMAIL.trim(),
|
|
86
|
-
privateKey: parsePrivateKey(process.env.FIREBASE_ADMIN_PRIVATE_KEY)
|
|
87
|
-
}),
|
|
88
|
-
databaseURL: dbUrl
|
|
89
|
-
});
|
|
90
|
-
} else {
|
|
91
|
-
throw new Error(
|
|
92
|
-
"@mohasinac/db-firebase: Firebase Admin credentials not found.\nAdd firebase-admin-key.json to project root, or set FIREBASE_ADMIN_PROJECT_ID, FIREBASE_ADMIN_CLIENT_EMAIL, FIREBASE_ADMIN_PRIVATE_KEY environment variables."
|
|
93
|
-
);
|
|
94
|
-
}
|
|
95
|
-
} catch (err) {
|
|
96
|
-
console.error(
|
|
97
|
-
"[@mohasinac/db-firebase] Failed to initialise Admin SDK:",
|
|
98
|
-
err
|
|
99
|
-
);
|
|
100
|
-
throw err;
|
|
101
|
-
}
|
|
102
|
-
set("__mohasinac_firebase_admin_app__", app$1);
|
|
103
|
-
return app$1;
|
|
104
|
-
}
|
|
105
|
-
function getAdminAuth() {
|
|
106
|
-
const cached = get("__mohasinac_firebase_admin_auth__");
|
|
107
|
-
if (cached) return cached;
|
|
108
|
-
const auth$1 = auth.getAuth(getAdminApp());
|
|
109
|
-
set("__mohasinac_firebase_admin_auth__", auth$1);
|
|
110
|
-
return auth$1;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
// src/providers/auth-firebase/provider.ts
|
|
114
|
-
var EXPECTED_AUTH_CODES = /* @__PURE__ */ new Set([
|
|
115
|
-
"auth/argument-error",
|
|
116
|
-
"auth/id-token-expired",
|
|
117
|
-
"auth/id-token-revoked",
|
|
118
|
-
"auth/session-cookie-expired",
|
|
119
|
-
"auth/session-cookie-revoked",
|
|
120
|
-
"auth/user-disabled",
|
|
121
|
-
"auth/user-not-found"
|
|
122
|
-
]);
|
|
123
|
-
function isExpectedAuthError(err) {
|
|
124
|
-
var _a;
|
|
125
|
-
return EXPECTED_AUTH_CODES.has((_a = err.code) != null ? _a : "");
|
|
126
|
-
}
|
|
127
|
-
function toAuthPayload(decoded) {
|
|
128
|
-
var _a, _b, _c;
|
|
129
|
-
return {
|
|
130
|
-
uid: decoded.uid,
|
|
131
|
-
email: (_a = decoded.email) != null ? _a : null,
|
|
132
|
-
role: (_b = decoded.role) != null ? _b : "user",
|
|
133
|
-
emailVerified: (_c = decoded.email_verified) != null ? _c : false,
|
|
134
|
-
claims: Object.fromEntries(
|
|
135
|
-
Object.entries(decoded).filter(
|
|
136
|
-
([k]) => ![
|
|
137
|
-
"uid",
|
|
138
|
-
"email",
|
|
139
|
-
"email_verified",
|
|
140
|
-
"iat",
|
|
141
|
-
"exp",
|
|
142
|
-
"aud",
|
|
143
|
-
"iss",
|
|
144
|
-
"sub",
|
|
145
|
-
"auth_time",
|
|
146
|
-
"firebase"
|
|
147
|
-
].includes(k)
|
|
148
|
-
)
|
|
149
|
-
)
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
function toAuthUser(record) {
|
|
153
|
-
var _a, _b, _c, _d, _e, _f;
|
|
154
|
-
return {
|
|
155
|
-
uid: record.uid,
|
|
156
|
-
email: (_a = record.email) != null ? _a : null,
|
|
157
|
-
displayName: (_b = record.displayName) != null ? _b : null,
|
|
158
|
-
photoURL: (_c = record.photoURL) != null ? _c : null,
|
|
159
|
-
role: (_e = (_d = record.customClaims) == null ? void 0 : _d["role"]) != null ? _e : "user",
|
|
160
|
-
emailVerified: record.emailVerified,
|
|
161
|
-
disabled: record.disabled,
|
|
162
|
-
createdAt: (_f = record.metadata.creationTime) != null ? _f : (/* @__PURE__ */ new Date(0)).toISOString()
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
var firebaseAuthProvider = {
|
|
166
|
-
async verifyToken(token) {
|
|
167
|
-
try {
|
|
168
|
-
const decoded = await getAdminAuth().verifyIdToken(token);
|
|
169
|
-
return toAuthPayload(decoded);
|
|
170
|
-
} catch (err) {
|
|
171
|
-
if (!isExpectedAuthError(err)) {
|
|
172
|
-
console.error(
|
|
173
|
-
"[@mohasinac/auth-firebase] Token verification failed:",
|
|
174
|
-
err
|
|
175
|
-
);
|
|
176
|
-
}
|
|
177
|
-
throw err;
|
|
178
|
-
}
|
|
179
|
-
},
|
|
180
|
-
async createCustomToken(uid, claims) {
|
|
181
|
-
return getAdminAuth().createCustomToken(uid, claims);
|
|
182
|
-
},
|
|
183
|
-
async getUser(uid) {
|
|
184
|
-
try {
|
|
185
|
-
const record = await getAdminAuth().getUser(uid);
|
|
186
|
-
return toAuthUser(record);
|
|
187
|
-
} catch (err) {
|
|
188
|
-
if (err.code === "auth/user-not-found")
|
|
189
|
-
return null;
|
|
190
|
-
throw err;
|
|
191
|
-
}
|
|
192
|
-
},
|
|
193
|
-
async createUser(data) {
|
|
194
|
-
var _a;
|
|
195
|
-
const record = await getAdminAuth().createUser({
|
|
196
|
-
email: data.email,
|
|
197
|
-
password: data.password,
|
|
198
|
-
displayName: data.displayName,
|
|
199
|
-
photoURL: data.photoURL,
|
|
200
|
-
emailVerified: (_a = data.emailVerified) != null ? _a : false
|
|
201
|
-
});
|
|
202
|
-
if (data.role) {
|
|
203
|
-
await getAdminAuth().setCustomUserClaims(record.uid, { role: data.role });
|
|
204
|
-
const updated = await getAdminAuth().getUser(record.uid);
|
|
205
|
-
return toAuthUser(updated);
|
|
206
|
-
}
|
|
207
|
-
return toAuthUser(record);
|
|
208
|
-
},
|
|
209
|
-
async updateUser(uid, data) {
|
|
210
|
-
const record = await getAdminAuth().updateUser(uid, {
|
|
211
|
-
email: data.email,
|
|
212
|
-
password: data.password,
|
|
213
|
-
displayName: data.displayName,
|
|
214
|
-
photoURL: data.photoURL,
|
|
215
|
-
emailVerified: data.emailVerified
|
|
216
|
-
});
|
|
217
|
-
if (data.role !== void 0) {
|
|
218
|
-
await getAdminAuth().setCustomUserClaims(uid, { role: data.role });
|
|
219
|
-
}
|
|
220
|
-
const updated = await getAdminAuth().getUser(record.uid);
|
|
221
|
-
return toAuthUser(updated);
|
|
222
|
-
},
|
|
223
|
-
async deleteUser(uid) {
|
|
224
|
-
await getAdminAuth().deleteUser(uid);
|
|
225
|
-
},
|
|
226
|
-
async revokeTokens(uid) {
|
|
227
|
-
await getAdminAuth().revokeRefreshTokens(uid);
|
|
228
|
-
}
|
|
229
|
-
};
|
|
230
|
-
|
|
231
|
-
// src/providers/auth-firebase/session.ts
|
|
232
|
-
var DEFAULT_EXPIRES_IN_MS = 60 * 60 * 24 * 5 * 1e3;
|
|
233
|
-
var EXPECTED_SESSION_CODES = /* @__PURE__ */ new Set([
|
|
234
|
-
"auth/session-cookie-expired",
|
|
235
|
-
"auth/session-cookie-revoked",
|
|
236
|
-
"auth/user-disabled",
|
|
237
|
-
"auth/user-not-found",
|
|
238
|
-
"auth/argument-error"
|
|
239
|
-
]);
|
|
240
|
-
var firebaseSessionProvider = {
|
|
241
|
-
/**
|
|
242
|
-
* `payload` must be an `AuthPayload` from a freshly verified ID token.
|
|
243
|
-
* The underlying Firebase API expects an ID token string, not just a UID.
|
|
244
|
-
* If you have the raw ID token, use `createSessionCookieFromToken()` instead.
|
|
245
|
-
*
|
|
246
|
-
* Here we create a custom token → exchange for an effective session.
|
|
247
|
-
* In practice, callers should use `createSessionCookieFromToken()`.
|
|
248
|
-
*/
|
|
249
|
-
async createSession(payload) {
|
|
250
|
-
throw new Error(
|
|
251
|
-
"Use createSessionCookieFromToken(idToken) instead of createSession(payload). Firebase session cookies must be created from a raw ID token string."
|
|
252
|
-
);
|
|
253
|
-
},
|
|
254
|
-
async verifySession(cookie) {
|
|
255
|
-
var _a, _b, _c, _d;
|
|
256
|
-
try {
|
|
257
|
-
const decoded = await getAdminAuth().verifySessionCookie(cookie, true);
|
|
258
|
-
return {
|
|
259
|
-
uid: decoded.uid,
|
|
260
|
-
email: (_a = decoded.email) != null ? _a : null,
|
|
261
|
-
role: (_b = decoded.role) != null ? _b : "user",
|
|
262
|
-
emailVerified: (_c = decoded.email_verified) != null ? _c : false,
|
|
263
|
-
claims: Object.fromEntries(
|
|
264
|
-
Object.entries(decoded).filter(
|
|
265
|
-
([k]) => ![
|
|
266
|
-
"uid",
|
|
267
|
-
"email",
|
|
268
|
-
"email_verified",
|
|
269
|
-
"iat",
|
|
270
|
-
"exp",
|
|
271
|
-
"aud",
|
|
272
|
-
"iss",
|
|
273
|
-
"sub",
|
|
274
|
-
"auth_time",
|
|
275
|
-
"firebase"
|
|
276
|
-
].includes(k)
|
|
277
|
-
)
|
|
278
|
-
)
|
|
279
|
-
};
|
|
280
|
-
} catch (err) {
|
|
281
|
-
if (!EXPECTED_SESSION_CODES.has((_d = err.code) != null ? _d : "")) {
|
|
282
|
-
console.error(
|
|
283
|
-
"[@mohasinac/auth-firebase] Session cookie verification failed:",
|
|
284
|
-
err
|
|
285
|
-
);
|
|
286
|
-
}
|
|
287
|
-
throw err;
|
|
288
|
-
}
|
|
289
|
-
},
|
|
290
|
-
async destroySession(cookie) {
|
|
291
|
-
try {
|
|
292
|
-
const decoded = await getAdminAuth().verifySessionCookie(cookie, false);
|
|
293
|
-
await getAdminAuth().revokeRefreshTokens(decoded.uid);
|
|
294
|
-
} catch (e) {
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
};
|
|
298
|
-
async function createSessionCookieFromToken(idToken, expiresIn = DEFAULT_EXPIRES_IN_MS) {
|
|
299
|
-
return getAdminAuth().createSessionCookie(idToken, { expiresIn });
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
// src/providers/auth-firebase/helpers.ts
|
|
303
|
-
var EXPECTED_AUTH_CODES2 = /* @__PURE__ */ new Set([
|
|
304
|
-
"auth/argument-error",
|
|
305
|
-
"auth/id-token-expired",
|
|
306
|
-
"auth/id-token-revoked",
|
|
307
|
-
"auth/session-cookie-expired",
|
|
308
|
-
"auth/session-cookie-revoked",
|
|
309
|
-
"auth/user-disabled",
|
|
310
|
-
"auth/user-not-found"
|
|
311
|
-
]);
|
|
312
|
-
async function verifyIdToken(token) {
|
|
313
|
-
var _a, _b, _c, _d;
|
|
314
|
-
try {
|
|
315
|
-
const decoded = await getAdminAuth().verifyIdToken(token);
|
|
316
|
-
return {
|
|
317
|
-
uid: decoded.uid,
|
|
318
|
-
email: (_a = decoded.email) != null ? _a : null,
|
|
319
|
-
role: (_b = decoded.role) != null ? _b : "user",
|
|
320
|
-
emailVerified: (_c = decoded.email_verified) != null ? _c : false
|
|
321
|
-
};
|
|
322
|
-
} catch (err) {
|
|
323
|
-
if (!EXPECTED_AUTH_CODES2.has((_d = err.code) != null ? _d : "")) {
|
|
324
|
-
console.error(
|
|
325
|
-
"[@mohasinac/auth-firebase] Token verification failed:",
|
|
326
|
-
err
|
|
327
|
-
);
|
|
328
|
-
}
|
|
329
|
-
return null;
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
async function verifySessionCookie(cookie) {
|
|
333
|
-
var _a, _b, _c, _d;
|
|
334
|
-
try {
|
|
335
|
-
const decoded = await getAdminAuth().verifySessionCookie(cookie, true);
|
|
336
|
-
return {
|
|
337
|
-
uid: decoded.uid,
|
|
338
|
-
email: (_a = decoded.email) != null ? _a : null,
|
|
339
|
-
role: (_b = decoded.role) != null ? _b : "user",
|
|
340
|
-
emailVerified: (_c = decoded.email_verified) != null ? _c : false
|
|
341
|
-
};
|
|
342
|
-
} catch (err) {
|
|
343
|
-
if (!EXPECTED_AUTH_CODES2.has((_d = err.code) != null ? _d : "")) {
|
|
344
|
-
console.error(
|
|
345
|
-
"[@mohasinac/auth-firebase] Session cookie verification failed:",
|
|
346
|
-
err
|
|
347
|
-
);
|
|
348
|
-
}
|
|
349
|
-
return null;
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
function createMiddlewareAuthChain() {
|
|
353
|
-
return async function getUser(cookies) {
|
|
354
|
-
var _a, _b;
|
|
355
|
-
const session = (_a = cookies.get("__session")) == null ? void 0 : _a.value;
|
|
356
|
-
if (session) {
|
|
357
|
-
const user = await verifySessionCookie(session);
|
|
358
|
-
if (user) return user;
|
|
359
|
-
}
|
|
360
|
-
const idToken = (_b = cookies.get("idToken")) == null ? void 0 : _b.value;
|
|
361
|
-
if (idToken) {
|
|
362
|
-
return verifyIdToken(idToken);
|
|
363
|
-
}
|
|
364
|
-
return null;
|
|
365
|
-
};
|
|
366
|
-
}
|
|
367
|
-
async function requireAuth(cookies) {
|
|
368
|
-
const chain = createMiddlewareAuthChain();
|
|
369
|
-
const user = await chain(cookies);
|
|
370
|
-
if (!user) {
|
|
371
|
-
throw Object.assign(new Error("Unauthorized"), { statusCode: 401 });
|
|
372
|
-
}
|
|
373
|
-
return user;
|
|
374
|
-
}
|
|
375
|
-
async function requireRole(cookies, role, resolveRole) {
|
|
376
|
-
const user = await requireAuth(cookies);
|
|
377
|
-
const allowed = Array.isArray(role) ? role : [role];
|
|
378
|
-
let userRole = user.role;
|
|
379
|
-
if (resolveRole) {
|
|
380
|
-
userRole = await resolveRole(user.uid);
|
|
381
|
-
}
|
|
382
|
-
if (!allowed.includes(userRole)) {
|
|
383
|
-
throw Object.assign(
|
|
384
|
-
new Error(`Forbidden \u2014 requires role: ${allowed.join(" | ")}`),
|
|
385
|
-
{ statusCode: 403 }
|
|
386
|
-
);
|
|
387
|
-
}
|
|
388
|
-
return __spreadProps(__spreadValues({}, user), { role: userRole });
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
exports.createMiddlewareAuthChain = createMiddlewareAuthChain;
|
|
392
|
-
exports.createSessionCookieFromToken = createSessionCookieFromToken;
|
|
393
|
-
exports.firebaseAuthProvider = firebaseAuthProvider;
|
|
394
|
-
exports.firebaseSessionProvider = firebaseSessionProvider;
|
|
395
|
-
exports.requireAuth = requireAuth;
|
|
396
|
-
exports.requireRole = requireRole;
|
|
397
|
-
exports.verifyIdToken = verifyIdToken;
|
|
398
|
-
exports.verifySessionCookie = verifySessionCookie;
|
|
399
|
-
//# sourceMappingURL=index.cjs.map
|
|
400
|
-
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/providers/db-firebase/admin.ts","../../../src/providers/auth-firebase/provider.ts","../../../src/providers/auth-firebase/session.ts","../../../src/providers/auth-firebase/helpers.ts"],"names":["getApps","path","app","fs","initializeApp","cert","auth","getAuth","EXPECTED_AUTH_CODES"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCA,SAAS,gBAAgB,GAAA,EAAqB;AAC5C,EAAA,OAAO,GAAA,CACJ,OAAA,CAAQ,cAAA,EAAgB,EAAE,CAAA,CAC1B,OAAA,CAAQ,MAAA,EAAQ,IAAI,CAAA,CACpB,OAAA,CAAQ,OAAA,EAAS,IAAI,EACrB,IAAA,EAAK;AACV;AAmBA,SAAS,IAAO,GAAA,EAAwC;AAzDxD,EAAA,IAAA,EAAA;AA0DE,EAAA,OAAA,CAAQ,EAAA,GAAA,UAAA,CAAW,GAAG,CAAA,KAAd,IAAA,GAAA,EAAA,GAA4C,IAAA;AACtD;AACA,SAAS,GAAA,CAAO,KAA8B,KAAA,EAAgB;AAC5D,EAAC,UAAA,CAAuC,GAAG,CAAA,GAAI,KAAA;AACjD;AAIO,SAAS,WAAA,GAAmB;AAlEnC,EAAA,IAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA;AAmEE,EAAA,MAAM,MAAA,GAAS,IAAS,kCAAkC,CAAA;AAC1D,EAAA,IAAI,QAAQ,OAAO,MAAA;AAEnB,EAAA,IAAIA,WAAA,GAAU,MAAA,EAAQ;AACpB,IAAA,MAAM,QAAA,GAAWA,WAAA,EAAQ,CAAE,CAAC,CAAA;AAC5B,IAAA,GAAA,CAAI,oCAAoC,QAAQ,CAAA;AAChD,IAAA,OAAO,QAAA;AAAA,EACT;AAEA,EAAA,MAAM,OAAA,GAAeC,eAAA,CAAA,IAAA,CAAK,OAAA,CAAQ,GAAA,IAAO,yBAAyB,CAAA;AAClE,EAAA,IAAIC,KAAA;AAEJ,EAAA,IAAI;AACF,IAAA,IAA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AO,MAAM,WAAA,CAAY,OAAO,CAAA;AACtC,EAAA,MAAM,UAAU,KAAA,CAAM,OAAA,CAAQ,IAAI,CAAA,GAAI,IAAA,GAAO,CAAC,IAAI,CAAA;AAElD,EAAA,IAAI,WAAW,IAAA,CAAK,IAAA;AACpB,EAAA,IAAI,WAAA,EAAa;AACf,IAAA,QAAA,GAAW,MAAM,WAAA,CAAY,IAAA,CAAK,GAAG,CAAA;AAAA,EACvC;AAEA,EAAA,IAAI,CAAC,OAAA,CAAQ,QAAA,CAAS,QAAQ,CAAA,EAAG;AAC/B,IAAA,MAAM,MAAA,CAAO,MAAA;AAAA,MACX,IAAI,KAAA,CAAM,CAAA,gCAAA,EAA8B,QAAQ,IAAA,CAAK,KAAK,CAAC,CAAA,CAAE,CAAA;AAAA,MAC7D,EAAE,YAAY,GAAA;AAAI,KACpB;AAAA,EACF;AAEA,EAAA,OAAO,aAAA,CAAA,cAAA,CAAA,EAAA,EAAK,IAAA,CAAA,EAAL,EAAW,IAAA,EAAM,QAAA,EAAS,CAAA;AACnC","file":"index.cjs","sourcesContent":["/**\n * Firebase Admin SDK singletons.\n *\n * Supports two init methods (checked in order):\n * 1. `firebase-admin-key.json` in process.cwd() — development\n * 2. FIREBASE_ADMIN_PROJECT_ID / CLIENT_EMAIL / PRIVATE_KEY env vars — production\n *\n * All getters are lazy — the SDK is not touched until first use.\n */\n\nimport { initializeApp, getApps, cert, type App } from \"firebase-admin/app\";\nimport { getAuth, type Auth } from \"firebase-admin/auth\";\nimport { getFirestore, type Firestore } from \"firebase-admin/firestore\";\nimport {\n getStorage as getFirebaseStorage,\n type Storage,\n} from \"firebase-admin/storage\";\nimport { getDatabase, type Database } from \"firebase-admin/database\";\nimport * as path from \"path\";\nimport * as fs from \"fs\";\n\n// ─── Private key normalisation ────────────────────────────────────────────────\n//\n// Vercel (and other platforms) can store the private key in several formats:\n// 1. Literal \\n sequences (common — copied from JSON value)\n// 2. Real newlines (set via CLI / multiline input)\n// 3. Windows \\r\\n endings (copied on Windows)\n// 4. Wrapped in double-quotes (pasted with JSON quotes intact)\n//\n// OpenSSL 3 (Node 18+) rejects malformed PEM — ensure the key is normalised\n// before passing it to `cert()`.\n//\nfunction parsePrivateKey(raw: string): string {\n return raw\n .replace(/^[\"']|[\"']$/g, \"\") // strip optional surrounding quotes\n .replace(/\\\\n/g, \"\\n\") // literal \\n → real newline\n .replace(/\\r\\n/g, \"\\n\") // Windows CRLF → LF\n .trim();\n}\n\n// ─── Global singletons ────────────────────────────────────────────────────────\n// Stored on globalThis so all module instances (pnpm deduplication may create\n// multiple copies of this package in the same process) share one SDK instance.\n\ndeclare global {\n // eslint-disable-next-line no-var\n var __mohasinac_firebase_admin_app__: App | null | undefined;\n // eslint-disable-next-line no-var\n var __mohasinac_firebase_admin_auth__: Auth | null | undefined;\n // eslint-disable-next-line no-var\n var __mohasinac_firebase_admin_db__: Firestore | null | undefined;\n // eslint-disable-next-line no-var\n var __mohasinac_firebase_admin_storage__: Storage | null | undefined;\n // eslint-disable-next-line no-var\n var __mohasinac_firebase_admin_rtdb__: Database | null | undefined;\n}\n\nfunction get<T>(key: keyof typeof globalThis): T | null {\n return (globalThis[key] as T | null | undefined) ?? null;\n}\nfunction set<T>(key: keyof typeof globalThis, value: T): void {\n (globalThis as Record<string, unknown>)[key] = value;\n}\n\n// ─── App ──────────────────────────────────────────────────────────────────────\n\nexport function getAdminApp(): App {\n const cached = get<App>(\"__mohasinac_firebase_admin_app__\");\n if (cached) return cached;\n\n if (getApps().length) {\n const existing = getApps()[0];\n set(\"__mohasinac_firebase_admin_app__\", existing);\n return existing;\n }\n\n const keyPath = path.join(process.cwd(), \"firebase-admin-key.json\");\n let app: App;\n\n try {\n if (fs.existsSync(keyPath)) {\n const sa = JSON.parse(fs.readFileSync(keyPath, \"utf8\"));\n const dbUrl =\n process.env.NEXT_PUBLIC_FIREBASE_DATABASE_URL ??\n `https://${sa.project_id}-default-rtdb.firebaseio.com`;\n\n app = initializeApp({ credential: cert(keyPath), databaseURL: dbUrl });\n } else if (\n process.env.FIREBASE_ADMIN_PROJECT_ID &&\n process.env.FIREBASE_ADMIN_CLIENT_EMAIL &&\n process.env.FIREBASE_ADMIN_PRIVATE_KEY\n ) {\n const projectId = process.env.FIREBASE_ADMIN_PROJECT_ID.trim();\n const dbUrl =\n process.env.FIREBASE_ADMIN_DATABASE_URL?.trim() ??\n process.env.NEXT_PUBLIC_FIREBASE_DATABASE_URL?.trim() ??\n `https://${projectId}-default-rtdb.firebaseio.com`;\n\n app = initializeApp({\n credential: cert({\n projectId,\n clientEmail: process.env.FIREBASE_ADMIN_CLIENT_EMAIL.trim(),\n privateKey: parsePrivateKey(process.env.FIREBASE_ADMIN_PRIVATE_KEY),\n }),\n databaseURL: dbUrl,\n });\n } else {\n throw new Error(\n \"@mohasinac/db-firebase: Firebase Admin credentials not found.\\n\" +\n \"Add firebase-admin-key.json to project root, or set \" +\n \"FIREBASE_ADMIN_PROJECT_ID, FIREBASE_ADMIN_CLIENT_EMAIL, \" +\n \"FIREBASE_ADMIN_PRIVATE_KEY environment variables.\",\n );\n }\n } catch (err) {\n console.error(\n \"[@mohasinac/db-firebase] Failed to initialise Admin SDK:\",\n err,\n );\n throw err;\n }\n\n set(\"__mohasinac_firebase_admin_app__\", app);\n return app;\n}\n\n// ─── Auth ─────────────────────────────────────────────────────────────────────\n\nexport function getAdminAuth(): Auth {\n const cached = get<Auth>(\"__mohasinac_firebase_admin_auth__\");\n if (cached) return cached;\n const auth = getAuth(getAdminApp());\n set(\"__mohasinac_firebase_admin_auth__\", auth);\n return auth;\n}\n\n// ─── Firestore ────────────────────────────────────────────────────────────────\n\nexport function getAdminDb(): Firestore {\n const cached = get<Firestore>(\"__mohasinac_firebase_admin_db__\");\n if (cached) return cached;\n const db = getFirestore(getAdminApp());\n try {\n // settings() can only be called once per Firestore instance — guard for\n // HMR reloads and duplicate module instances.\n db.settings({ ignoreUndefinedProperties: true });\n } catch {\n // Already configured — safe to ignore.\n }\n set(\"__mohasinac_firebase_admin_db__\", db);\n return db;\n}\n\n// ─── Cloud Storage ────────────────────────────────────────────────────────────\n\nexport function getAdminStorage(): Storage {\n const cached = get<Storage>(\"__mohasinac_firebase_admin_storage__\");\n if (cached) return cached;\n const storage = getFirebaseStorage(getAdminApp());\n set(\"__mohasinac_firebase_admin_storage__\", storage);\n return storage;\n}\n\n// ─── Realtime DB ──────────────────────────────────────────────────────────────\n\nexport function getAdminRealtimeDb(): Database {\n const cached = get<Database>(\"__mohasinac_firebase_admin_rtdb__\");\n if (cached) return cached;\n const rtdb = getDatabase(getAdminApp());\n set(\"__mohasinac_firebase_admin_rtdb__\", rtdb);\n return rtdb;\n}\n\n/** Reset all singletons — useful in tests. */\nexport function _resetAdminSingletons(): void {\n set(\"__mohasinac_firebase_admin_app__\", null);\n set(\"__mohasinac_firebase_admin_auth__\", null);\n set(\"__mohasinac_firebase_admin_db__\", null);\n set(\"__mohasinac_firebase_admin_storage__\", null);\n set(\"__mohasinac_firebase_admin_rtdb__\", null);\n}\n","/**\n * firebaseAuthProvider — IAuthProvider\n *\n * Implements `@mohasinac/contracts` `IAuthProvider` using the Firebase Admin SDK.\n * Server-side only. Never import this in browser/client-component code.\n */\n\nimport type {\n IAuthProvider,\n AuthPayload,\n AuthUser,\n CreateUserInput,\n} from \"@mohasinac/contracts\";\nimport { getAdminAuth } from \"@mohasinac/db-firebase\";\n\n/** Firebase error codes that represent a normal \"not authenticated\" state. */\nconst EXPECTED_AUTH_CODES = new Set([\n \"auth/argument-error\",\n \"auth/id-token-expired\",\n \"auth/id-token-revoked\",\n \"auth/session-cookie-expired\",\n \"auth/session-cookie-revoked\",\n \"auth/user-disabled\",\n \"auth/user-not-found\",\n]);\n\nfunction isExpectedAuthError(err: unknown): boolean {\n return EXPECTED_AUTH_CODES.has((err as { code?: string }).code ?? \"\");\n}\n\nfunction toAuthPayload(decoded: {\n uid: string;\n email?: string | null;\n role?: string;\n email_verified?: boolean;\n [k: string]: unknown;\n}): AuthPayload {\n return {\n uid: decoded.uid,\n email: decoded.email ?? null,\n role: (decoded.role as string | undefined) ?? \"user\",\n emailVerified: decoded.email_verified ?? false,\n claims: Object.fromEntries(\n Object.entries(decoded).filter(\n ([k]) =>\n ![\n \"uid\",\n \"email\",\n \"email_verified\",\n \"iat\",\n \"exp\",\n \"aud\",\n \"iss\",\n \"sub\",\n \"auth_time\",\n \"firebase\",\n ].includes(k),\n ),\n ),\n };\n}\n\nfunction toAuthUser(record: {\n uid: string;\n email?: string;\n displayName?: string;\n photoURL?: string;\n emailVerified: boolean;\n disabled: boolean;\n metadata: { creationTime?: string };\n customClaims?: Record<string, unknown>;\n}): AuthUser {\n return {\n uid: record.uid,\n email: record.email ?? null,\n displayName: record.displayName ?? null,\n photoURL: record.photoURL ?? null,\n role: (record.customClaims?.[\"role\"] as string | undefined) ?? \"user\",\n emailVerified: record.emailVerified,\n disabled: record.disabled,\n createdAt: record.metadata.creationTime ?? new Date(0).toISOString(),\n };\n}\n\nexport const firebaseAuthProvider: IAuthProvider = {\n async verifyToken(token: string): Promise<AuthPayload> {\n try {\n const decoded = await getAdminAuth().verifyIdToken(token);\n return toAuthPayload(decoded);\n } catch (err) {\n if (!isExpectedAuthError(err)) {\n console.error(\n \"[@mohasinac/auth-firebase] Token verification failed:\",\n err,\n );\n }\n throw err;\n }\n },\n\n async createCustomToken(\n uid: string,\n claims?: Record<string, unknown>,\n ): Promise<string> {\n return getAdminAuth().createCustomToken(uid, claims);\n },\n\n async getUser(uid: string): Promise<AuthUser | null> {\n try {\n const record = await getAdminAuth().getUser(uid);\n return toAuthUser(record);\n } catch (err) {\n if ((err as { code?: string }).code === \"auth/user-not-found\")\n return null;\n throw err;\n }\n },\n\n async createUser(data: CreateUserInput): Promise<AuthUser> {\n const record = await getAdminAuth().createUser({\n email: data.email,\n password: data.password,\n displayName: data.displayName,\n photoURL: data.photoURL,\n emailVerified: data.emailVerified ?? false,\n });\n if (data.role) {\n await getAdminAuth().setCustomUserClaims(record.uid, { role: data.role });\n // Re-fetch to get updated claims\n const updated = await getAdminAuth().getUser(record.uid);\n return toAuthUser(updated);\n }\n return toAuthUser(record);\n },\n\n async updateUser(\n uid: string,\n data: Partial<CreateUserInput>,\n ): Promise<AuthUser> {\n const record = await getAdminAuth().updateUser(uid, {\n email: data.email,\n password: data.password,\n displayName: data.displayName,\n photoURL: data.photoURL,\n emailVerified: data.emailVerified,\n });\n if (data.role !== undefined) {\n await getAdminAuth().setCustomUserClaims(uid, { role: data.role });\n }\n const updated = await getAdminAuth().getUser(record.uid);\n return toAuthUser(updated);\n },\n\n async deleteUser(uid: string): Promise<void> {\n await getAdminAuth().deleteUser(uid);\n },\n\n async revokeTokens(uid: string): Promise<void> {\n await getAdminAuth().revokeRefreshTokens(uid);\n },\n};\n","/**\n * firebaseSessionProvider — ISessionProvider\n *\n * Implements `@mohasinac/contracts` `ISessionProvider` using Firebase Admin SDK\n * session cookies (HTTP-only, 5-day TTL by default).\n *\n * Server-side only.\n */\n\nimport type { ISessionProvider, AuthPayload } from \"@mohasinac/contracts\";\nimport { getAdminAuth } from \"@mohasinac/db-firebase\";\n\n/** Default session duration: 5 days (in milliseconds). */\nconst DEFAULT_EXPIRES_IN_MS = 60 * 60 * 24 * 5 * 1000;\n\nconst EXPECTED_SESSION_CODES = new Set([\n \"auth/session-cookie-expired\",\n \"auth/session-cookie-revoked\",\n \"auth/user-disabled\",\n \"auth/user-not-found\",\n \"auth/argument-error\",\n]);\n\nexport const firebaseSessionProvider: ISessionProvider = {\n /**\n * `payload` must be an `AuthPayload` from a freshly verified ID token.\n * The underlying Firebase API expects an ID token string, not just a UID.\n * If you have the raw ID token, use `createSessionCookieFromToken()` instead.\n *\n * Here we create a custom token → exchange for an effective session.\n * In practice, callers should use `createSessionCookieFromToken()`.\n */\n async createSession(payload: AuthPayload): Promise<string> {\n void payload;\n // Custom tokens cannot be used to mint a session cookie directly —\n // createSession via ISessionProvider is called at the point where\n // the caller already has a verified payload. We delegate to a helper\n // that is invoked in the auth API route where the raw ID token is available.\n throw new Error(\n \"Use createSessionCookieFromToken(idToken) instead of createSession(payload). \" +\n \"Firebase session cookies must be created from a raw ID token string.\",\n );\n },\n\n async verifySession(cookie: string): Promise<AuthPayload> {\n try {\n const decoded = await getAdminAuth().verifySessionCookie(cookie, true);\n return {\n uid: decoded.uid,\n email: decoded.email ?? null,\n role: (decoded.role as string | undefined) ?? \"user\",\n emailVerified: decoded.email_verified ?? false,\n claims: Object.fromEntries(\n Object.entries(decoded).filter(\n ([k]) =>\n ![\n \"uid\",\n \"email\",\n \"email_verified\",\n \"iat\",\n \"exp\",\n \"aud\",\n \"iss\",\n \"sub\",\n \"auth_time\",\n \"firebase\",\n ].includes(k),\n ),\n ),\n };\n } catch (err) {\n if (!EXPECTED_SESSION_CODES.has((err as { code?: string }).code ?? \"\")) {\n console.error(\n \"[@mohasinac/auth-firebase] Session cookie verification failed:\",\n err,\n );\n }\n throw err;\n }\n },\n\n async destroySession(cookie: string): Promise<void> {\n try {\n const decoded = await getAdminAuth().verifySessionCookie(cookie, false);\n await getAdminAuth().revokeRefreshTokens(decoded.uid);\n } catch {\n // Best-effort: if cookie is already invalid, treat as already destroyed\n }\n },\n};\n\n/**\n * Mint a Firebase session cookie from a raw Firebase ID token string.\n *\n * Use this in your `POST /api/auth/session` route handler.\n *\n * @param idToken The ID token from `firebase.auth().currentUser.getIdToken()`.\n * @param expiresIn Cookie duration in milliseconds (default: 5 days).\n */\nexport async function createSessionCookieFromToken(\n idToken: string,\n expiresIn: number = DEFAULT_EXPIRES_IN_MS,\n): Promise<string> {\n return getAdminAuth().createSessionCookie(idToken, { expiresIn });\n}\n","/**\n * Server-side Firebase Auth helper functions.\n *\n * Drop-in replacements for the functions in `src/lib/firebase/auth-server.ts`.\n * All functions use the shared `getAdminAuth()` singleton from `@mohasinac/db-firebase`.\n */\n\nimport type { AuthPayload } from \"@mohasinac/contracts\";\nimport { getAdminAuth } from \"@mohasinac/db-firebase\";\nimport { createSessionCookieFromToken } from \"./session.js\";\n\nexport { createSessionCookieFromToken };\n\nconst EXPECTED_AUTH_CODES = new Set([\n \"auth/argument-error\",\n \"auth/id-token-expired\",\n \"auth/id-token-revoked\",\n \"auth/session-cookie-expired\",\n \"auth/session-cookie-revoked\",\n \"auth/user-disabled\",\n \"auth/user-not-found\",\n]);\n\n// ─── Token helpers ────────────────────────────────────────────────────────────\n\n/** Verify a Firebase ID token. Returns null for expected auth failures. */\nexport async function verifyIdToken(\n token: string,\n): Promise<AuthPayload | null> {\n try {\n const decoded = await getAdminAuth().verifyIdToken(token);\n return {\n uid: decoded.uid,\n email: decoded.email ?? null,\n role: (decoded.role as string | undefined) ?? \"user\",\n emailVerified: decoded.email_verified ?? false,\n };\n } catch (err) {\n if (!EXPECTED_AUTH_CODES.has((err as { code?: string }).code ?? \"\")) {\n console.error(\n \"[@mohasinac/auth-firebase] Token verification failed:\",\n err,\n );\n }\n return null;\n }\n}\n\n/** Verify a Firebase session cookie. Returns null for expected auth failures. */\nexport async function verifySessionCookie(\n cookie: string,\n): Promise<AuthPayload | null> {\n try {\n const decoded = await getAdminAuth().verifySessionCookie(cookie, true);\n return {\n uid: decoded.uid,\n email: decoded.email ?? null,\n role: (decoded.role as string | undefined) ?? \"user\",\n emailVerified: decoded.email_verified ?? false,\n };\n } catch (err) {\n if (!EXPECTED_AUTH_CODES.has((err as { code?: string }).code ?? \"\")) {\n console.error(\n \"[@mohasinac/auth-firebase] Session cookie verification failed:\",\n err,\n );\n }\n return null;\n }\n}\n\n/**\n * Create a middleware auth chain function.\n *\n * Returns an async function that reads the `__session` (or `idToken`) cookie\n * from a `RequestCookies`-like object and returns the decoded `AuthPayload`.\n *\n * @example\n * ```ts\n * import { createMiddlewareAuthChain } from \"@mohasinac/auth-firebase\";\n *\n * const getUser = createMiddlewareAuthChain();\n * const user = await getUser(request.cookies);\n * ```\n */\nexport function createMiddlewareAuthChain() {\n return async function getUser(cookies: {\n get(name: string): { value: string } | undefined;\n }): Promise<AuthPayload | null> {\n const session = cookies.get(\"__session\")?.value;\n if (session) {\n const user = await verifySessionCookie(session);\n if (user) return user;\n }\n\n const idToken = cookies.get(\"idToken\")?.value;\n if (idToken) {\n return verifyIdToken(idToken);\n }\n\n return null;\n };\n}\n\n/**\n * Require a valid session — throws if not authenticated.\n *\n * @param cookies `RequestCookies` from `request.cookies` (middleware) or\n * `await cookies()` from `next/headers` (RSC / API route).\n */\nexport async function requireAuth(cookies: {\n get(name: string): { value: string } | undefined;\n}): Promise<AuthPayload> {\n const chain = createMiddlewareAuthChain();\n const user = await chain(cookies);\n if (!user) {\n throw Object.assign(new Error(\"Unauthorized\"), { statusCode: 401 });\n }\n return user;\n}\n\n/**\n * Require a specific role — throws 401/403 if not authenticated or wrong role.\n *\n * @param cookies Cookie store (same as `requireAuth`).\n * @param role A single role string or an array of allowed roles.\n * @param resolveRole Optional async function to resolve the role from the DB.\n */\nexport async function requireRole(\n cookies: { get(name: string): { value: string } | undefined },\n role: string | string[],\n resolveRole?: (uid: string) => Promise<string>,\n): Promise<AuthPayload> {\n const user = await requireAuth(cookies);\n const allowed = Array.isArray(role) ? role : [role];\n\n let userRole = user.role;\n if (resolveRole) {\n userRole = await resolveRole(user.uid);\n }\n\n if (!allowed.includes(userRole)) {\n throw Object.assign(\n new Error(`Forbidden — requires role: ${allowed.join(\" | \")}`),\n { statusCode: 403 },\n );\n }\n\n return { ...user, role: userRole };\n}\n"]}
|