@mohasinac/appkit 2.2.0 → 2.3.1
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 +94 -31
- package/dist/client.d.ts +95 -15
- package/dist/client.js +143 -15
- package/dist/constants/api-endpoints.d.ts +46 -0
- package/dist/constants/api-endpoints.js +23 -0
- package/dist/constants/index.d.ts +1 -0
- package/dist/constants/index.js +1 -0
- package/dist/contracts/auth.js +1 -1
- package/dist/contracts/client-auth.js +1 -1
- package/dist/contracts/client-payment-gateway.js +1 -1
- package/dist/contracts/client-realtime.js +1 -1
- package/dist/contracts/client-session.js +17 -5
- package/dist/contracts/config.js +1 -1
- package/dist/contracts/email.js +1 -1
- package/dist/contracts/feature.js +1 -1
- package/dist/contracts/field-ops.js +2 -2
- package/dist/contracts/form.js +1 -1
- package/dist/contracts/infra.js +1 -1
- package/dist/contracts/payment.js +1 -1
- package/dist/contracts/repository.js +2 -2
- package/dist/contracts/search.js +1 -1
- package/dist/contracts/shipping.js +1 -1
- package/dist/contracts/storage.js +1 -1
- package/dist/contracts/style.js +1 -1
- package/dist/core/hooks/useSiteSettings.js +0 -1
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.js +1 -0
- package/dist/core/integration-keys.d.ts +0 -16
- package/dist/core/integration-keys.js +0 -1
- package/dist/core/mutation-events.js +2 -2
- package/dist/core/server-action.js +5 -5
- package/dist/core/unit-of-work.d.ts +13 -14
- package/dist/core/unit-of-work.js +0 -1
- package/dist/errors/messages.d.ts +1 -0
- package/dist/errors/messages.js +1 -0
- package/dist/features/about/components/AboutView.d.ts +14 -14
- package/dist/features/about/components/AboutView.js +2 -2
- package/dist/features/about/components/FAQPageView.d.ts +6 -0
- package/dist/features/about/components/FAQPageView.js +29 -0
- package/dist/features/about/components/FeesView.d.ts +4 -0
- package/dist/features/about/components/FeesView.js +63 -0
- package/dist/features/about/components/HelpPageView.d.ts +4 -0
- package/dist/features/about/components/HelpPageView.js +63 -0
- package/dist/features/about/components/HowAuctionsWorkView.d.ts +4 -0
- package/dist/features/about/components/HowAuctionsWorkView.js +87 -0
- package/dist/features/about/components/HowCheckoutWorksView.d.ts +4 -0
- package/dist/features/about/components/HowCheckoutWorksView.js +73 -0
- package/dist/features/about/components/HowOffersWorkView.d.ts +4 -0
- package/dist/features/about/components/HowOffersWorkView.js +58 -0
- package/dist/features/about/components/HowOrdersWorkView.d.ts +4 -0
- package/dist/features/about/components/HowOrdersWorkView.js +131 -0
- package/dist/features/about/components/HowPayoutsWorkView.d.ts +4 -0
- package/dist/features/about/components/HowPayoutsWorkView.js +87 -0
- package/dist/features/about/components/HowPreOrdersWorkView.d.ts +4 -0
- package/dist/features/about/components/HowPreOrdersWorkView.js +87 -0
- package/dist/features/about/components/HowReviewsWorkView.d.ts +4 -0
- package/dist/features/about/components/HowReviewsWorkView.js +72 -0
- package/dist/features/about/components/PolicyPageView.d.ts +6 -0
- package/dist/features/about/components/PolicyPageView.js +28 -0
- package/dist/features/about/components/PublicProfileView.d.ts +5 -0
- package/dist/features/about/components/PublicProfileView.js +21 -0
- package/dist/features/about/components/SecurityPrivacyView.d.ts +4 -0
- package/dist/features/about/components/SecurityPrivacyView.js +122 -0
- package/dist/features/about/components/ShippingPolicyView.d.ts +4 -0
- package/dist/features/about/components/ShippingPolicyView.js +59 -0
- package/dist/features/about/components/TrackOrderView.d.ts +4 -0
- package/dist/features/about/components/TrackOrderView.js +43 -0
- package/dist/features/about/components/UnauthorizedView.d.ts +4 -0
- package/dist/features/about/components/UnauthorizedView.js +29 -0
- package/dist/features/about/index.d.ts +32 -0
- package/dist/features/about/index.js +16 -0
- package/dist/features/account/components/AddressBook.js +3 -2
- package/dist/features/account/components/AddressForm.js +2 -1
- package/dist/features/account/components/AddressSelectorCreate.js +2 -1
- package/dist/features/account/components/ChatList.js +0 -1
- package/dist/features/account/components/ChatWindow.js +2 -2
- package/dist/features/account/components/MessagesView.js +2 -1
- package/dist/features/account/components/NotificationBell.js +3 -2
- package/dist/features/account/components/UserSidebar.d.ts +15 -0
- package/dist/features/account/components/UserSidebar.js +18 -0
- package/dist/features/account/components/index.d.ts +2 -0
- package/dist/features/account/components/index.js +1 -0
- package/dist/features/account/hooks/useAccount.js +0 -1
- package/dist/features/account/hooks/useAddressSelector.js +0 -1
- package/dist/features/account/hooks/useAddresses.js +0 -1
- package/dist/features/account/hooks/useNotifications.js +0 -1
- package/dist/features/account/hooks/useProfile.js +0 -1
- package/dist/features/account/hooks/useProfileStats.js +0 -1
- package/dist/features/account/hooks/usePublicProfile.js +0 -1
- package/dist/features/account/repository/address.repository.js +2 -3
- package/dist/features/account/schemas/index.d.ts +20 -20
- package/dist/features/account/schemas/index.js +2 -2
- package/dist/features/account/server.d.ts +0 -1
- package/dist/features/account/server.js +0 -1
- package/dist/features/account/types/index.js +1 -1
- package/dist/features/admin/components/AdminAdEditorView.d.ts +10 -0
- package/dist/features/admin/components/AdminAdEditorView.js +225 -0
- package/dist/features/admin/components/AdminAdsView.d.ts +25 -0
- package/dist/features/admin/components/AdminAdsView.js +165 -0
- package/dist/features/admin/components/AdminAnalyticsView.d.ts +2 -1
- package/dist/features/admin/components/AdminAnalyticsView.js +19 -5
- package/dist/features/admin/components/AdminBidsView.d.ts +1 -1
- package/dist/features/admin/components/AdminBidsView.js +26 -2
- package/dist/features/admin/components/AdminBlogView.d.ts +1 -1
- package/dist/features/admin/components/AdminBlogView.js +34 -2
- package/dist/features/admin/components/AdminCarouselView.d.ts +3 -8
- package/dist/features/admin/components/AdminCarouselView.js +39 -4
- package/dist/features/admin/components/AdminCategoriesView.d.ts +3 -8
- package/dist/features/admin/components/AdminCategoriesView.js +40 -4
- package/dist/features/admin/components/AdminCouponsView.d.ts +1 -1
- package/dist/features/admin/components/AdminCouponsView.js +28 -2
- package/dist/features/admin/components/AdminDashboardView.d.ts +2 -1
- package/dist/features/admin/components/AdminDashboardView.js +28 -3
- package/dist/features/admin/components/AdminFaqsView.d.ts +1 -1
- package/dist/features/admin/components/AdminFaqsView.js +23 -2
- package/dist/features/admin/components/AdminFeatureFlagsView.js +48 -3
- package/dist/features/admin/components/AdminFilterBar.js +3 -4
- package/dist/features/admin/components/AdminListingScaffold.d.ts +26 -0
- package/dist/features/admin/components/AdminListingScaffold.js +57 -0
- package/dist/features/admin/components/AdminMediaView.d.ts +7 -7
- package/dist/features/admin/components/AdminMediaView.js +50 -4
- package/dist/features/admin/components/AdminNavigationView.d.ts +7 -3
- package/dist/features/admin/components/AdminNavigationView.js +81 -4
- package/dist/features/admin/components/AdminOrdersView.d.ts +1 -1
- package/dist/features/admin/components/AdminOrdersView.js +28 -2
- package/dist/features/admin/components/AdminPageHeader.js +1 -2
- package/dist/features/admin/components/AdminPayoutsView.d.ts +1 -1
- package/dist/features/admin/components/AdminPayoutsView.js +28 -2
- package/dist/features/admin/components/AdminProductsView.d.ts +1 -1
- package/dist/features/admin/components/AdminProductsView.js +26 -2
- package/dist/features/admin/components/AdminReviewsView.d.ts +1 -1
- package/dist/features/admin/components/AdminReviewsView.js +24 -2
- package/dist/features/admin/components/AdminSectionsView.d.ts +3 -7
- package/dist/features/admin/components/AdminSectionsView.js +947 -4
- package/dist/features/admin/components/AdminSessionsManager.js +1 -2
- package/dist/features/admin/components/AdminSidebar.d.ts +5 -1
- package/dist/features/admin/components/AdminSidebar.js +5 -4
- package/dist/features/admin/components/AdminSiteView.js +43 -3
- package/dist/features/admin/components/AdminStoresView.d.ts +1 -1
- package/dist/features/admin/components/AdminStoresView.js +26 -2
- package/dist/features/admin/components/AdminUsersView.d.ts +1 -1
- package/dist/features/admin/components/AdminUsersView.js +38 -2
- package/dist/features/admin/components/DashboardStats.js +7 -7
- package/dist/features/admin/components/DataTable.js +2 -2
- package/dist/features/admin/components/DrawerFormFooter.js +1 -2
- package/dist/features/admin/components/QuickActionsPanel.js +1 -2
- package/dist/features/admin/components/analytics/AdminStatCard.js +0 -1
- package/dist/features/admin/components/analytics/AdminTopProductsTable.js +1 -2
- package/dist/features/admin/components/index.d.ts +4 -0
- package/dist/features/admin/components/index.js +2 -0
- package/dist/features/admin/hooks/useAdmin.js +0 -1
- package/dist/features/admin/hooks/useAdminListingData.d.ts +28 -0
- package/dist/features/admin/hooks/useAdminListingData.js +100 -0
- package/dist/features/admin/hooks/useAdminSectionsListing.d.ts +28 -0
- package/dist/features/admin/hooks/useAdminSectionsListing.js +34 -0
- package/dist/features/admin/index.d.ts +2 -0
- package/dist/features/admin/index.js +2 -0
- package/dist/features/admin/repository/chat.repository.d.ts +1 -1
- package/dist/features/admin/repository/chat.repository.js +1 -1
- package/dist/features/admin/repository/notification.repository.d.ts +0 -1
- package/dist/features/admin/repository/notification.repository.js +9 -7
- package/dist/features/admin/repository/site-settings.repository.d.ts +2 -0
- package/dist/features/admin/repository/site-settings.repository.js +25 -2
- package/dist/features/admin/schemas/firestore.d.ts +5 -1
- package/dist/features/admin/schemas/firestore.js +5 -0
- package/dist/features/admin/server.d.ts +0 -1
- package/dist/features/admin/server.js +0 -1
- package/dist/features/auctions/actions/bid-actions.js +1 -1
- package/dist/features/auctions/api/route.js +1 -1
- package/dist/features/auctions/columns/index.js +2 -2
- package/dist/features/auctions/components/AuctionCard.js +3 -2
- package/dist/features/auctions/components/AuctionDetailPageView.d.ts +4 -0
- package/dist/features/auctions/components/AuctionDetailPageView.js +71 -0
- package/dist/features/auctions/components/AuctionsListView.d.ts +1 -0
- package/dist/features/auctions/components/AuctionsListView.js +17 -0
- package/dist/features/auctions/components/MarketplaceAuctionCard.js +5 -2
- package/dist/features/auctions/components/MarketplaceAuctionGrid.js +0 -1
- package/dist/features/auctions/components/index.d.ts +3 -0
- package/dist/features/auctions/components/index.js +2 -0
- package/dist/features/auctions/hooks/useAuctions.js +0 -1
- package/dist/features/auctions/hooks/usePlaceBid.js +0 -1
- package/dist/features/auctions/repository/bid.repository.js +3 -13
- package/dist/features/auctions/schemas/index.d.ts +22 -22
- package/dist/features/auctions/schemas/index.js +2 -2
- package/dist/features/auctions/server.d.ts +0 -1
- package/dist/features/auctions/server.js +0 -1
- package/dist/features/auth/api/route.js +2 -2
- package/dist/features/auth/components/AuthStatusPanel.js +3 -3
- package/dist/features/auth/components/ForgotPasswordView.js +2 -2
- package/dist/features/auth/components/Guards.d.ts +2 -2
- package/dist/features/auth/components/Guards.js +2 -2
- package/dist/features/auth/components/LoginForm.js +1 -1
- package/dist/features/auth/components/OAuthLoadingView.d.ts +1 -0
- package/dist/features/auth/components/OAuthLoadingView.js +5 -0
- package/dist/features/auth/components/RegisterForm.js +1 -1
- package/dist/features/auth/components/ResetPasswordView.js +1 -1
- package/dist/features/auth/components/SocialAuthButtons.js +1 -2
- package/dist/features/auth/components/VerifyEmailView.js +4 -3
- package/dist/features/auth/components/index.d.ts +1 -0
- package/dist/features/auth/components/index.js +1 -0
- package/dist/features/auth/consent-otp.d.ts +5 -3
- package/dist/features/auth/consent-otp.js +0 -1
- package/dist/features/auth/hooks/useAuth.d.ts +0 -1
- package/dist/features/auth/hooks/useAuth.js +0 -1
- package/dist/features/auth/hooks/useAuthEvent.js +0 -1
- package/dist/features/auth/hooks/useLogout.js +0 -1
- package/dist/features/auth/repository/session.repository.d.ts +0 -1
- package/dist/features/auth/repository/session.repository.js +0 -1
- package/dist/features/auth/repository/token.repository.d.ts +0 -1
- package/dist/features/auth/repository/token.repository.js +0 -1
- package/dist/features/auth/repository/user.repository.d.ts +0 -1
- package/dist/features/auth/repository/user.repository.js +18 -29
- package/dist/features/auth/schemas/firestore.js +1 -1
- package/dist/features/auth/schemas/index.d.ts +4 -4
- package/dist/features/auth/schemas/index.js +2 -2
- package/dist/features/auth/server.d.ts +0 -1
- package/dist/features/auth/server.js +0 -1
- package/dist/features/auth/token-store.d.ts +0 -1
- package/dist/features/auth/token-store.js +0 -1
- package/dist/features/before-after/hooks/useBeforeAfter.js +0 -1
- package/dist/features/before-after/schemas/index.d.ts +2 -2
- package/dist/features/before-after/server.d.ts +0 -1
- package/dist/features/before-after/server.js +0 -1
- package/dist/features/blog/actions/blog-actions.d.ts +53 -53
- package/dist/features/blog/actions/blog-actions.js +2 -2
- package/dist/features/blog/api/[slug]/route.js +1 -1
- package/dist/features/blog/api/route.js +1 -1
- package/dist/features/blog/components/BlogFeaturedCard.js +9 -7
- package/dist/features/blog/components/BlogFilters.js +0 -1
- package/dist/features/blog/components/BlogIndexListing.d.ts +4 -0
- package/dist/features/blog/components/BlogIndexListing.js +26 -0
- package/dist/features/blog/components/BlogIndexPageView.d.ts +1 -0
- package/dist/features/blog/components/BlogIndexPageView.js +11 -0
- package/dist/features/blog/components/BlogListView.js +4 -3
- package/dist/features/blog/components/BlogPostForm.js +3 -3
- package/dist/features/blog/components/BlogPostView.js +3 -3
- package/dist/features/blog/components/index.d.ts +2 -0
- package/dist/features/blog/components/index.js +1 -0
- package/dist/features/blog/hooks/useBlog.js +0 -1
- package/dist/features/blog/repository/blog.repository.d.ts +0 -1
- package/dist/features/blog/repository/blog.repository.js +0 -1
- package/dist/features/blog/schemas/index.d.ts +35 -35
- package/dist/features/blog/schemas/index.js +2 -2
- package/dist/features/blog/server.d.ts +0 -1
- package/dist/features/blog/server.js +0 -1
- package/dist/features/cart/components/CartDrawer.js +5 -4
- package/dist/features/cart/components/CartSummary.js +1 -1
- package/dist/features/cart/components/CartView.js +1 -1
- package/dist/features/cart/components/CheckoutAddressStep.js +0 -1
- package/dist/features/cart/components/CheckoutOtpModal.js +1 -2
- package/dist/features/cart/components/CheckoutView.js +1 -1
- package/dist/features/cart/hooks/useCart.js +0 -1
- package/dist/features/cart/hooks/useCartCount.js +0 -1
- package/dist/features/cart/hooks/useCartQuery.js +0 -1
- package/dist/features/cart/hooks/useCheckoutReadQueries.js +0 -1
- package/dist/features/cart/hooks/useOrder.js +0 -1
- package/dist/features/cart/repository/cart.repository.d.ts +0 -1
- package/dist/features/cart/repository/cart.repository.js +0 -1
- package/dist/features/cart/schemas/index.d.ts +19 -19
- package/dist/features/cart/server.d.ts +0 -1
- package/dist/features/cart/server.js +0 -1
- package/dist/features/cart/utils/guest-cart.d.ts +0 -1
- package/dist/features/cart/utils/guest-cart.js +0 -1
- package/dist/features/categories/api/[id]/route.js +3 -3
- package/dist/features/categories/api/route.js +5 -5
- package/dist/features/categories/components/BreadcrumbTrail.js +0 -1
- package/dist/features/categories/components/CategoriesIndexListing.d.ts +5 -0
- package/dist/features/categories/components/CategoriesIndexListing.js +44 -0
- package/dist/features/categories/components/CategoriesIndexPageView.d.ts +1 -0
- package/dist/features/categories/components/CategoriesIndexPageView.js +12 -0
- package/dist/features/categories/components/CategoriesListView.js +3 -3
- package/dist/features/categories/components/CategoryDetailPageView.d.ts +4 -0
- package/dist/features/categories/components/CategoryDetailPageView.js +25 -0
- package/dist/features/categories/components/CategoryFilters.js +0 -1
- package/dist/features/categories/components/CategoryForm.js +4 -4
- package/dist/features/categories/components/CategoryGrid.d.ts +2 -1
- package/dist/features/categories/components/CategoryGrid.js +11 -5
- package/dist/features/categories/components/CategoryProductsListing.d.ts +5 -0
- package/dist/features/categories/components/CategoryProductsListing.js +29 -0
- package/dist/features/categories/components/CategoryProductsView.js +3 -3
- package/dist/features/categories/components/CategorySelectorCreate.js +2 -2
- package/dist/features/categories/components/CategorySortSelect.js +0 -1
- package/dist/features/categories/components/CategoryTableColumns.js +3 -3
- package/dist/features/categories/components/CategoryTree.js +1 -1
- package/dist/features/categories/components/ConcernCard.js +2 -1
- package/dist/features/categories/components/index.d.ts +4 -0
- package/dist/features/categories/components/index.js +2 -0
- package/dist/features/categories/hooks/useCategories.js +0 -1
- package/dist/features/categories/hooks/useCategorySelector.js +0 -1
- package/dist/features/categories/repository/categories.repository.d.ts +0 -1
- package/dist/features/categories/repository/categories.repository.js +0 -1
- package/dist/features/categories/schemas/index.d.ts +40 -40
- package/dist/features/categories/schemas/index.js +2 -2
- package/dist/features/categories/server.d.ts +0 -1
- package/dist/features/categories/server.js +0 -1
- package/dist/features/checkout/actions/checkout-actions.d.ts +7 -1
- package/dist/features/checkout/actions/checkout-actions.js +0 -1
- package/dist/features/checkout/components/CheckoutStepper.js +4 -3
- package/dist/features/checkout/hooks/useCheckoutApi.js +0 -1
- package/dist/features/checkout/hooks/usePaymentCheckout.d.ts +0 -1
- package/dist/features/checkout/hooks/usePaymentCheckout.js +1 -2
- package/dist/features/checkout/server.d.ts +0 -1
- package/dist/features/checkout/server.js +0 -1
- package/dist/features/collections/components/CollectionCard.js +2 -2
- package/dist/features/collections/hooks/useCollections.js +0 -1
- package/dist/features/collections/schemas/index.d.ts +5 -5
- package/dist/features/collections/server.d.ts +0 -1
- package/dist/features/collections/server.js +0 -1
- package/dist/features/consultation/hooks/useBookConsultation.js +0 -1
- package/dist/features/consultation/schemas/index.d.ts +7 -7
- package/dist/features/consultation/server.d.ts +0 -1
- package/dist/features/consultation/server.js +0 -1
- package/dist/features/contact/components/ContactInfoSidebar.js +1 -2
- package/dist/features/contact/components/ContactPageView.d.ts +1 -0
- package/dist/features/contact/components/ContactPageView.js +45 -0
- package/dist/features/contact/components/index.d.ts +1 -0
- package/dist/features/contact/components/index.js +1 -0
- package/dist/features/contact/email.d.ts +0 -1
- package/dist/features/contact/email.js +0 -1
- package/dist/features/contact/hooks/useContactSubmit.js +0 -1
- package/dist/features/contact/server.d.ts +0 -1
- package/dist/features/contact/server.js +0 -1
- package/dist/features/copilot/components/AdminCopilotView.d.ts +5 -5
- package/dist/features/copilot/components/AdminCopilotView.js +26 -11
- package/dist/features/copilot/hooks/useCopilotChat.d.ts +3 -0
- package/dist/features/copilot/hooks/useCopilotChat.js +9 -1
- package/dist/features/copilot/hooks/useCopilotFeedback.js +0 -1
- package/dist/features/corporate/hooks/useSubmitCorporateInquiry.js +0 -1
- package/dist/features/corporate/schemas/index.d.ts +1 -1
- package/dist/features/corporate/server.d.ts +0 -1
- package/dist/features/corporate/server.js +0 -1
- package/dist/features/cron/firebase-adapters.js +2 -2
- package/dist/features/cron/index.js +3 -3
- package/dist/features/cron/registry.js +4 -4
- package/dist/features/events/actions/event-actions.js +7 -7
- package/dist/features/events/api/[id]/route.js +1 -1
- package/dist/features/events/components/AdminEventEntriesView.d.ts +7 -2
- package/dist/features/events/components/AdminEventEntriesView.js +114 -7
- package/dist/features/events/components/AdminEventsView.d.ts +3 -10
- package/dist/features/events/components/AdminEventsView.js +34 -4
- package/dist/features/events/components/EventBanner.js +1 -1
- package/dist/features/events/components/EventCard.d.ts +1 -0
- package/dist/features/events/components/EventCard.js +7 -5
- package/dist/features/events/components/EventFilters.js +0 -1
- package/dist/features/events/components/EventFormDrawer.js +1 -1
- package/dist/features/events/components/EventLeaderboard.js +3 -3
- package/dist/features/events/components/EventParticipateView.js +2 -2
- package/dist/features/events/components/EventsIndexListing.d.ts +4 -0
- package/dist/features/events/components/EventsIndexListing.js +24 -0
- package/dist/features/events/components/EventsListPageView.d.ts +1 -0
- package/dist/features/events/components/EventsListPageView.js +16 -0
- package/dist/features/events/components/index.d.ts +2 -0
- package/dist/features/events/components/index.js +1 -0
- package/dist/features/events/hooks/useBulkEvent.js +0 -1
- package/dist/features/events/hooks/useEvent.js +0 -1
- package/dist/features/events/hooks/useEvents.js +0 -1
- package/dist/features/events/schemas/index.d.ts +45 -45
- package/dist/features/events/schemas/index.js +2 -2
- package/dist/features/events/server.d.ts +0 -1
- package/dist/features/events/server.js +0 -1
- package/dist/features/faq/actions/faq-actions.d.ts +20 -20
- package/dist/features/faq/actions/faq-actions.js +2 -2
- package/dist/features/faq/components/ContactCTA.js +0 -1
- package/dist/features/faq/components/FAQAccordion.js +5 -5
- package/dist/features/faq/components/FAQCategorySidebar.js +0 -1
- package/dist/features/faq/components/FAQHelpfulButtons.js +2 -2
- package/dist/features/faq/components/FAQPageContent.d.ts +4 -1
- package/dist/features/faq/components/FAQPageContent.js +14 -15
- package/dist/features/faq/components/FAQSortDropdown.js +1 -2
- package/dist/features/faq/components/RelatedFAQs.js +0 -1
- package/dist/features/faq/hooks/useFAQs.js +0 -1
- package/dist/features/faq/hooks/useFaqList.js +0 -1
- package/dist/features/faq/hooks/useFaqVote.js +0 -1
- package/dist/features/faq/repository/faqs.repository.d.ts +0 -1
- package/dist/features/faq/repository/faqs.repository.js +0 -1
- package/dist/features/faq/schemas/index.d.ts +18 -18
- package/dist/features/faq/schemas/index.js +2 -2
- package/dist/features/faq/server.d.ts +0 -1
- package/dist/features/faq/server.js +0 -1
- package/dist/features/filters/FilterFacetSection.js +1 -1
- package/dist/features/filters/index.d.ts +4 -0
- package/dist/features/filters/index.js +2 -0
- package/dist/features/filters/routeFilterState.d.ts +58 -0
- package/dist/features/filters/routeFilterState.js +97 -0
- package/dist/features/filters/usePendingFilters.d.ts +37 -0
- package/dist/features/filters/usePendingFilters.js +22 -0
- package/dist/features/forms/Checkbox.js +1 -0
- package/dist/features/forms/Form.js +1 -2
- package/dist/features/forms/Radio.js +0 -1
- package/dist/features/forms/utils.js +1 -1
- package/dist/features/homepage/actions/homepage-section-actions.js +2 -2
- package/dist/features/homepage/ad-registry.d.ts +96 -0
- package/dist/features/homepage/ad-registry.js +84 -0
- package/dist/features/homepage/api/[id]/route.js +3 -3
- package/dist/features/homepage/api/carousel/[id]/route.js +3 -3
- package/dist/features/homepage/api/carousel/route.js +1 -1
- package/dist/features/homepage/api/route.js +1 -1
- package/dist/features/homepage/components/AdSlot.d.ts +28 -0
- package/dist/features/homepage/components/AdSlot.js +85 -0
- package/dist/features/homepage/components/AdvertisementBanner.js +8 -8
- package/dist/features/homepage/components/AnnouncementBar.d.ts +5 -0
- package/dist/features/homepage/components/AnnouncementBar.js +10 -0
- package/dist/features/homepage/components/BeforeAfterCard.d.ts +0 -1
- package/dist/features/homepage/components/BeforeAfterCard.js +0 -1
- package/dist/features/homepage/components/BlogArticlesSection.d.ts +8 -0
- package/dist/features/homepage/components/BlogArticlesSection.js +12 -0
- package/dist/features/homepage/components/BrandsSection.d.ts +9 -0
- package/dist/features/homepage/components/BrandsSection.js +20 -0
- package/dist/features/homepage/components/CTABannerSection.d.ts +10 -0
- package/dist/features/homepage/components/CTABannerSection.js +6 -0
- package/dist/features/homepage/components/CharacterHotspot.d.ts +0 -1
- package/dist/features/homepage/components/CharacterHotspot.js +4 -4
- package/dist/features/homepage/components/CustomerReviewsSection.js +3 -4
- package/dist/features/homepage/components/EventsSection.d.ts +9 -0
- package/dist/features/homepage/components/EventsSection.js +10 -0
- package/dist/features/homepage/components/FAQSection.d.ts +0 -1
- package/dist/features/homepage/components/FAQSection.js +4 -4
- package/dist/features/homepage/components/FeaturedAuctionsSection.d.ts +8 -0
- package/dist/features/homepage/components/FeaturedAuctionsSection.js +10 -0
- package/dist/features/homepage/components/FeaturedPreOrdersSection.d.ts +8 -0
- package/dist/features/homepage/components/FeaturedPreOrdersSection.js +10 -0
- package/dist/features/homepage/components/FeaturedProductsSection.d.ts +8 -0
- package/dist/features/homepage/components/FeaturedProductsSection.js +11 -0
- package/dist/features/homepage/components/FeaturedResultsSection.js +9 -9
- package/dist/features/homepage/components/FeaturedStoresSection.d.ts +9 -0
- package/dist/features/homepage/components/FeaturedStoresSection.js +11 -0
- package/dist/features/homepage/components/HeroCarousel.d.ts +1 -2
- package/dist/features/homepage/components/HeroCarousel.js +5 -12
- package/dist/features/homepage/components/HomepageCustomerReviewsSection.d.ts +8 -0
- package/dist/features/homepage/components/HomepageCustomerReviewsSection.js +9 -0
- package/dist/features/homepage/components/HomepageSkeleton.js +1 -2
- package/dist/features/homepage/components/HowItWorksInfoView.js +2 -2
- package/dist/features/homepage/components/HowItWorksSection.js +4 -4
- package/dist/features/homepage/components/MarketplaceHomepageView.d.ts +25 -0
- package/dist/features/homepage/components/MarketplaceHomepageView.js +252 -0
- package/dist/features/homepage/components/NewsletterSection.js +2 -3
- package/dist/features/homepage/components/SectionCarousel.js +13 -7
- package/dist/features/homepage/components/SecurityHighlightsSection.js +4 -4
- package/dist/features/homepage/components/ShopByCategorySection.d.ts +9 -0
- package/dist/features/homepage/components/ShopByCategorySection.js +21 -0
- package/dist/features/homepage/components/SiteFeaturesSection.js +2 -3
- package/dist/features/homepage/components/StatsCounterSection.js +5 -5
- package/dist/features/homepage/components/TrustFeaturesSection.js +7 -7
- package/dist/features/homepage/components/TrustIndicatorsSection.js +2 -3
- package/dist/features/homepage/components/WelcomeSection.d.ts +3 -1
- package/dist/features/homepage/components/WelcomeSection.js +5 -5
- package/dist/features/homepage/components/WhatsAppCommunitySection.d.ts +0 -1
- package/dist/features/homepage/components/WhatsAppCommunitySection.js +4 -5
- package/dist/features/homepage/components/index.d.ts +24 -0
- package/dist/features/homepage/components/index.js +12 -0
- package/dist/features/homepage/hooks/useBlogArticles.js +0 -1
- package/dist/features/homepage/hooks/useFeaturedAuctions.js +0 -1
- package/dist/features/homepage/hooks/useFeaturedPreOrders.js +0 -1
- package/dist/features/homepage/hooks/useFeaturedProducts.js +0 -1
- package/dist/features/homepage/hooks/useFeaturedStores.d.ts +2 -0
- package/dist/features/homepage/hooks/useFeaturedStores.js +14 -0
- package/dist/features/homepage/hooks/useHeroCarousel.js +0 -1
- package/dist/features/homepage/hooks/useHomepage.js +0 -1
- package/dist/features/homepage/hooks/useHomepageEvents.d.ts +6 -0
- package/dist/features/homepage/hooks/useHomepageEvents.js +14 -0
- package/dist/features/homepage/hooks/useHomepageReviews.js +0 -1
- package/dist/features/homepage/hooks/useHomepageSections.js +0 -1
- package/dist/features/homepage/hooks/useNewsletter.js +0 -1
- package/dist/features/homepage/hooks/useTopBrands.js +0 -1
- package/dist/features/homepage/hooks/useTopCategories.js +0 -1
- package/dist/features/homepage/index.d.ts +4 -0
- package/dist/features/homepage/index.js +3 -0
- package/dist/features/homepage/repository/carousel.repository.d.ts +0 -1
- package/dist/features/homepage/repository/carousel.repository.js +2 -8
- package/dist/features/homepage/schemas/firestore.d.ts +20 -2
- package/dist/features/homepage/schemas/firestore.js +10 -8
- package/dist/features/homepage/server.d.ts +0 -1
- package/dist/features/homepage/server.js +0 -1
- package/dist/features/layout/AppLayoutShell.d.ts +98 -0
- package/dist/features/layout/AppLayoutShell.js +147 -0
- package/dist/features/layout/AutoBreadcrumbs.js +5 -5
- package/dist/features/layout/BackToTop.d.ts +0 -1
- package/dist/features/layout/BackToTop.js +0 -1
- package/dist/features/layout/BottomActions.js +8 -11
- package/dist/features/layout/BottomActionsContext.js +2 -2
- package/dist/features/layout/BottomNavItem.js +0 -1
- package/dist/features/layout/BottomNavLayout.js +1 -2
- package/dist/features/layout/BottomNavbar.d.ts +7 -0
- package/dist/features/layout/BottomNavbar.js +13 -6
- package/dist/features/layout/BottomSheet.d.ts +0 -1
- package/dist/features/layout/BottomSheet.js +0 -1
- package/dist/features/layout/Breadcrumbs.js +3 -3
- package/dist/features/layout/DashboardNavContext.d.ts +10 -2
- package/dist/features/layout/DashboardNavContext.js +35 -3
- package/dist/features/layout/FooterLayout.js +4 -2
- package/dist/features/layout/LayoutClient.js +0 -1
- package/dist/features/layout/ListingLayout.d.ts +0 -1
- package/dist/features/layout/ListingLayout.js +0 -1
- package/dist/features/layout/LocaleSwitcher.js +0 -1
- package/dist/features/layout/NavItem.js +2 -3
- package/dist/features/layout/NavbarLayout.js +4 -4
- package/dist/features/layout/SidebarLayout.js +0 -1
- package/dist/features/layout/TitleBar.d.ts +4 -2
- package/dist/features/layout/TitleBar.js +8 -4
- package/dist/features/layout/TitleBarLayout.d.ts +5 -3
- package/dist/features/layout/TitleBarLayout.js +3 -4
- package/dist/features/layout/index.d.ts +2 -0
- package/dist/features/layout/index.js +1 -0
- package/dist/features/loyalty/components/CoinsDisplay.js +0 -1
- package/dist/features/loyalty/hooks/useLoyaltyBalance.js +0 -1
- package/dist/features/loyalty/schemas/index.d.ts +6 -6
- package/dist/features/loyalty/server.d.ts +0 -1
- package/dist/features/loyalty/server.js +0 -1
- package/dist/features/media/AvatarUpload.js +1 -1
- package/dist/features/media/MediaImage.d.ts +3 -1
- package/dist/features/media/MediaImage.js +9 -5
- package/dist/features/media/MediaLightbox.d.ts +0 -1
- package/dist/features/media/MediaLightbox.js +1 -2
- package/dist/features/media/components/MediaSlider.d.ts +4 -0
- package/dist/features/media/components/MediaSlider.js +0 -1
- package/dist/features/media/hooks/useMedia.d.ts +6 -0
- package/dist/features/media/hooks/useMedia.js +1 -2
- package/dist/features/media/server.d.ts +0 -1
- package/dist/features/media/server.js +0 -1
- package/dist/features/media/types/index.d.ts +2 -2
- package/dist/features/orders/api/track/[trackingId]/route.d.ts +0 -1
- package/dist/features/orders/api/track/[trackingId]/route.js +0 -1
- package/dist/features/orders/components/MarketplaceOrderCard.d.ts +0 -1
- package/dist/features/orders/components/MarketplaceOrderCard.js +1 -2
- package/dist/features/orders/components/OrderFilters.js +0 -1
- package/dist/features/orders/components/OrdersList.js +3 -2
- package/dist/features/orders/hooks/useOrders.js +0 -1
- package/dist/features/orders/repository/orders.repository.d.ts +0 -1
- package/dist/features/orders/repository/orders.repository.js +0 -1
- package/dist/features/orders/schemas/index.d.ts +28 -28
- package/dist/features/orders/schemas/index.js +2 -2
- package/dist/features/orders/server.d.ts +0 -1
- package/dist/features/orders/server.js +0 -1
- package/dist/features/payments/hooks/usePaymentEvent.js +0 -1
- package/dist/features/payments/hooks/usePayments.js +0 -1
- package/dist/features/payments/schemas/index.d.ts +4 -4
- package/dist/features/payments/server.d.ts +0 -1
- package/dist/features/payments/server.js +0 -1
- package/dist/features/pre-orders/api/route.js +1 -1
- package/dist/features/pre-orders/components/MarketplacePreorderCard.d.ts +1 -0
- package/dist/features/pre-orders/components/MarketplacePreorderCard.js +7 -3
- package/dist/features/pre-orders/components/PreOrderDetailPageView.d.ts +4 -0
- package/dist/features/pre-orders/components/PreOrderDetailPageView.js +27 -0
- package/dist/features/pre-orders/components/PreOrdersIndexListing.d.ts +4 -0
- package/dist/features/pre-orders/components/PreOrdersIndexListing.js +25 -0
- package/dist/features/pre-orders/components/PreOrdersListView.d.ts +1 -0
- package/dist/features/pre-orders/components/PreOrdersListView.js +16 -0
- package/dist/features/pre-orders/components/PreorderCard.js +0 -1
- package/dist/features/pre-orders/components/index.d.ts +5 -0
- package/dist/features/pre-orders/components/index.js +3 -0
- package/dist/features/pre-orders/hooks/usePreOrders.js +0 -1
- package/dist/features/pre-orders/schemas/index.d.ts +8 -8
- package/dist/features/pre-orders/server.d.ts +0 -1
- package/dist/features/pre-orders/server.js +0 -1
- package/dist/features/products/api/[id]/route.js +3 -3
- package/dist/features/products/api/route.js +4 -4
- package/dist/features/products/columns/productTableColumns.js +0 -1
- package/dist/features/products/components/AuctionsIndexListing.d.ts +4 -0
- package/dist/features/products/components/AuctionsIndexListing.js +23 -0
- package/dist/features/products/components/BidHistory.js +3 -3
- package/dist/features/products/components/BuyBar.js +0 -1
- package/dist/features/products/components/InteractiveProductCard.js +0 -1
- package/dist/features/products/components/MakeOfferForm.js +1 -1
- package/dist/features/products/components/PlaceBidForm.js +1 -1
- package/dist/features/products/components/ProductDetailPageView.d.ts +4 -0
- package/dist/features/products/components/ProductDetailPageView.js +100 -0
- package/dist/features/products/components/ProductDetailView.d.ts +15 -2
- package/dist/features/products/components/ProductDetailView.js +2 -2
- package/dist/features/products/components/ProductFeatureBadges.js +0 -1
- package/dist/features/products/components/ProductFilters.js +0 -1
- package/dist/features/products/components/ProductForm.js +3 -2
- package/dist/features/products/components/ProductGalleryClient.d.ts +5 -0
- package/dist/features/products/components/ProductGalleryClient.js +23 -0
- package/dist/features/products/components/ProductGrid.d.ts +6 -2
- package/dist/features/products/components/ProductGrid.js +19 -11
- package/dist/features/products/components/ProductInfo.js +1 -1
- package/dist/features/products/components/ProductTabs.js +2 -1
- package/dist/features/products/components/ProductTabsShell.d.ts +18 -0
- package/dist/features/products/components/ProductTabsShell.js +26 -0
- package/dist/features/products/components/ProductsIndexListing.d.ts +4 -0
- package/dist/features/products/components/ProductsIndexListing.js +27 -0
- package/dist/features/products/components/ProductsIndexPageView.d.ts +1 -0
- package/dist/features/products/components/ProductsIndexPageView.js +17 -0
- package/dist/features/products/components/RelatedProducts.js +2 -2
- package/dist/features/products/components/index.d.ts +4 -0
- package/dist/features/products/components/index.js +2 -0
- package/dist/features/products/hooks/useProductDetail.js +0 -1
- package/dist/features/products/hooks/useProducts.js +2 -1
- package/dist/features/products/hooks/useRelatedProducts.js +0 -1
- package/dist/features/products/repository/products.repository.d.ts +7 -1
- package/dist/features/products/repository/products.repository.js +53 -4
- package/dist/features/products/schemas/index.d.ts +110 -110
- package/dist/features/products/schemas/index.js +2 -2
- package/dist/features/products/server.d.ts +0 -1
- package/dist/features/products/server.js +0 -1
- package/dist/features/products/types/index.d.ts +1 -0
- package/dist/features/promotions/actions/seller-coupon-actions.js +3 -3
- package/dist/features/promotions/api/route.js +1 -1
- package/dist/features/promotions/hooks/useCouponValidate.js +0 -1
- package/dist/features/promotions/hooks/usePromotions.js +0 -1
- package/dist/features/promotions/repository/coupons.repository.d.ts +0 -1
- package/dist/features/promotions/repository/coupons.repository.js +0 -1
- package/dist/features/promotions/schemas/index.d.ts +18 -18
- package/dist/features/promotions/schemas/index.js +2 -2
- package/dist/features/promotions/server.d.ts +0 -1
- package/dist/features/promotions/server.js +0 -1
- package/dist/features/promotions/types/index.js +1 -1
- package/dist/features/reviews/api/[id]/route.js +3 -3
- package/dist/features/reviews/api/route.js +3 -3
- package/dist/features/reviews/components/ReviewFilters.js +0 -1
- package/dist/features/reviews/components/ReviewModal.js +6 -2
- package/dist/features/reviews/components/ReviewSummary.js +0 -1
- package/dist/features/reviews/components/ReviewsIndexListing.d.ts +5 -0
- package/dist/features/reviews/components/ReviewsIndexListing.js +55 -0
- package/dist/features/reviews/components/ReviewsIndexPageView.d.ts +1 -0
- package/dist/features/reviews/components/ReviewsIndexPageView.js +9 -0
- package/dist/features/reviews/components/ReviewsList.js +6 -4
- package/dist/features/reviews/components/index.d.ts +2 -0
- package/dist/features/reviews/components/index.js +1 -0
- package/dist/features/reviews/hooks/useCreateReview.js +2 -1
- package/dist/features/reviews/hooks/useReviews.js +0 -1
- package/dist/features/reviews/schemas/index.d.ts +24 -24
- package/dist/features/reviews/schemas/index.js +2 -2
- package/dist/features/reviews/server.d.ts +0 -1
- package/dist/features/reviews/server.js +0 -1
- package/dist/features/search/api/route.js +1 -1
- package/dist/features/search/components/Search.d.ts +0 -1
- package/dist/features/search/components/Search.js +9 -10
- package/dist/features/search/components/SearchResultsSection.js +0 -1
- package/dist/features/search/hooks/useSearch.js +0 -1
- package/dist/features/search/schemas/index.d.ts +5 -5
- package/dist/features/search/server.d.ts +0 -1
- package/dist/features/search/server.js +0 -1
- package/dist/features/seller/actions/offer-actions.js +7 -7
- package/dist/features/seller/actions/seller-actions.js +9 -9
- package/dist/features/seller/columns/index.js +2 -2
- package/dist/features/seller/components/SellerAddressesView.d.ts +1 -1
- package/dist/features/seller/components/SellerAddressesView.js +1 -1
- package/dist/features/seller/components/SellerAuctionsView.d.ts +3 -3
- package/dist/features/seller/components/SellerAuctionsView.js +27 -3
- package/dist/features/seller/components/SellerCouponsView.d.ts +3 -3
- package/dist/features/seller/components/SellerCouponsView.js +27 -3
- package/dist/features/seller/components/SellerCreateProductView.d.ts +1 -1
- package/dist/features/seller/components/SellerCreateProductView.js +1 -1
- package/dist/features/seller/components/SellerEditProductView.d.ts +1 -1
- package/dist/features/seller/components/SellerEditProductView.js +1 -1
- package/dist/features/seller/components/SellerOffersView.d.ts +3 -3
- package/dist/features/seller/components/SellerOffersView.js +27 -3
- package/dist/features/seller/components/SellerOrdersView.d.ts +3 -3
- package/dist/features/seller/components/SellerOrdersView.js +27 -3
- package/dist/features/seller/components/SellerPayoutHistoryTable.js +0 -1
- package/dist/features/seller/components/SellerPayoutStats.js +0 -1
- package/dist/features/seller/components/SellerPayoutsView.d.ts +3 -17
- package/dist/features/seller/components/SellerPayoutsView.js +27 -9
- package/dist/features/seller/components/SellerProductsView.d.ts +3 -3
- package/dist/features/seller/components/SellerProductsView.js +27 -3
- package/dist/features/seller/components/SellerSidebar.d.ts +5 -1
- package/dist/features/seller/components/SellerSidebar.js +11 -6
- package/dist/features/seller/components/SellerStatCard.js +2 -1
- package/dist/features/seller/components/SellerStoreView.d.ts +1 -1
- package/dist/features/seller/components/SellerStoreView.js +1 -1
- package/dist/features/seller/components/analytics/SellerAnalyticsStats.js +0 -1
- package/dist/features/seller/components/analytics/SellerTopProducts.js +0 -1
- package/dist/features/seller/hooks/useBecomeSeller.js +0 -1
- package/dist/features/seller/hooks/useSellerListingData.d.ts +29 -0
- package/dist/features/seller/hooks/useSellerListingData.js +87 -0
- package/dist/features/seller/hooks/useSellerPayouts.js +0 -1
- package/dist/features/seller/hooks/useSellerStore.js +0 -1
- package/dist/features/seller/hooks/useSellerStorefront.js +0 -1
- package/dist/features/seller/index.d.ts +1 -0
- package/dist/features/seller/index.js +1 -0
- package/dist/features/seller/repository/offer.repository.js +3 -3
- package/dist/features/seller/schemas/index.d.ts +26 -26
- package/dist/features/seller/schemas/index.js +3 -3
- package/dist/features/seller/server.d.ts +0 -1
- package/dist/features/seller/server.js +0 -1
- package/dist/features/seller/types/index.js +1 -1
- package/dist/features/stores/api/[storeSlug]/auctions/route.js +1 -1
- package/dist/features/stores/api/[storeSlug]/products/route.js +1 -1
- package/dist/features/stores/api/[storeSlug]/reviews/route.js +1 -1
- package/dist/features/stores/api/[storeSlug]/route.js +1 -1
- package/dist/features/stores/api/route.js +1 -1
- package/dist/features/stores/components/InteractiveStoreCard.d.ts +1 -0
- package/dist/features/stores/components/InteractiveStoreCard.js +5 -5
- package/dist/features/stores/components/StoreAboutView.js +3 -2
- package/dist/features/stores/components/StoreAddressSelectorCreate.js +1 -1
- package/dist/features/stores/components/StoreAuctionsListing.d.ts +5 -0
- package/dist/features/stores/components/StoreAuctionsListing.js +41 -0
- package/dist/features/stores/components/StoreAuctionsPageView.d.ts +4 -0
- package/dist/features/stores/components/StoreAuctionsPageView.js +21 -0
- package/dist/features/stores/components/StoreAuctionsView.d.ts +2 -2
- package/dist/features/stores/components/StoreAuctionsView.js +2 -2
- package/dist/features/stores/components/StoreDetailLayoutView.d.ts +8 -0
- package/dist/features/stores/components/StoreDetailLayoutView.js +19 -0
- package/dist/features/stores/components/StoreHeader.js +3 -3
- package/dist/features/stores/components/StoreNavTabs.js +3 -4
- package/dist/features/stores/components/StoreProductsListing.d.ts +5 -0
- package/dist/features/stores/components/StoreProductsListing.js +29 -0
- package/dist/features/stores/components/StoreProductsPageView.d.ts +4 -0
- package/dist/features/stores/components/StoreProductsPageView.js +21 -0
- package/dist/features/stores/components/StoreProductsView.js +8 -3
- package/dist/features/stores/components/StoreReviewsListing.d.ts +4 -0
- package/dist/features/stores/components/StoreReviewsListing.js +34 -0
- package/dist/features/stores/components/StoreReviewsPageView.d.ts +4 -0
- package/dist/features/stores/components/StoreReviewsPageView.js +5 -0
- package/dist/features/stores/components/StoreReviewsView.d.ts +2 -2
- package/dist/features/stores/components/StoreReviewsView.js +2 -6
- package/dist/features/stores/components/StoresIndexListing.d.ts +4 -0
- package/dist/features/stores/components/StoresIndexListing.js +22 -0
- package/dist/features/stores/components/StoresIndexPageView.d.ts +1 -0
- package/dist/features/stores/components/StoresIndexPageView.js +11 -0
- package/dist/features/stores/components/StoresListView.js +5 -4
- package/dist/features/stores/components/index.d.ts +8 -0
- package/dist/features/stores/components/index.js +4 -0
- package/dist/features/stores/hooks/useStoreAddressSelector.js +0 -1
- package/dist/features/stores/hooks/useStores.d.ts +2 -1
- package/dist/features/stores/hooks/useStores.js +1 -1
- package/dist/features/stores/repository/store-address.repository.js +2 -3
- package/dist/features/stores/repository/store.repository.d.ts +0 -1
- package/dist/features/stores/repository/store.repository.js +0 -1
- package/dist/features/stores/schemas/firestore.js +1 -1
- package/dist/features/stores/schemas/index.d.ts +14 -14
- package/dist/features/stores/schemas/index.js +1 -1
- package/dist/features/stores/server.d.ts +0 -1
- package/dist/features/stores/server.js +0 -1
- package/dist/features/stores/types/index.js +1 -1
- package/dist/features/whatsapp-bot/components/WhatsAppChatButton.js +0 -1
- package/dist/features/whatsapp-bot/helpers/whatsapp.d.ts +0 -1
- package/dist/features/whatsapp-bot/helpers/whatsapp.js +0 -1
- package/dist/features/whatsapp-bot/server.d.ts +0 -1
- package/dist/features/whatsapp-bot/server.js +0 -1
- package/dist/features/wishlist/components/WishlistPage.js +4 -3
- package/dist/features/wishlist/components/WishlistToggleButton.js +0 -1
- package/dist/features/wishlist/components/WishlistView.d.ts +2 -2
- package/dist/features/wishlist/components/WishlistView.js +2 -2
- package/dist/features/wishlist/hooks/useUserWishlist.js +0 -1
- package/dist/features/wishlist/hooks/useWishlist.js +0 -1
- package/dist/features/wishlist/schemas/index.d.ts +2 -2
- package/dist/features/wishlist/server.d.ts +0 -1
- package/dist/features/wishlist/server.js +0 -1
- package/dist/index.d.ts +2766 -1
- package/dist/index.js +5177 -1
- package/dist/monitoring/server-logger.d.ts +10 -1
- package/dist/monitoring/server-logger.js +35 -14
- package/dist/next/ErrorBoundary.d.ts +1 -1
- package/dist/next/ErrorBoundary.js +2 -1
- package/dist/next/api/apiHandler.d.ts +9 -0
- package/dist/next/api/apiHandler.js +20 -0
- package/dist/next/api/routeHandler.d.ts +9 -0
- package/dist/next/api/routeHandler.js +30 -5
- package/dist/next/routing/route-map.d.ts +6 -2
- package/dist/next/routing/route-map.js +3 -1
- package/dist/providers/auth-firebase/helpers.js +3 -3
- package/dist/providers/db-firebase/admin-app-lite.d.ts +0 -1
- package/dist/providers/db-firebase/admin-app-lite.js +11 -6
- package/dist/providers/db-firebase/admin-storage-lite.d.ts +0 -1
- package/dist/providers/db-firebase/admin-storage-lite.js +0 -1
- package/dist/providers/db-firebase/admin.d.ts +0 -1
- package/dist/providers/db-firebase/admin.js +16 -21
- package/dist/providers/db-firebase/base.d.ts +0 -1
- package/dist/providers/db-firebase/base.js +42 -16
- package/dist/providers/db-firebase/base.repository.d.ts +1 -2
- package/dist/providers/db-firebase/base.repository.js +0 -1
- package/dist/providers/db-firebase/field-ops.d.ts +0 -1
- package/dist/providers/db-firebase/field-ops.js +0 -1
- package/dist/providers/db-firebase/helpers.d.ts +2 -0
- package/dist/providers/db-firebase/helpers.js +11 -2
- package/dist/providers/db-firebase/index.d.ts +1 -2
- package/dist/providers/db-firebase/index.js +1 -2
- package/dist/providers/db-firebase/realtime.d.ts +1 -2
- package/dist/providers/db-firebase/realtime.js +20 -4
- package/dist/providers/db-firebase/sieve.d.ts +0 -1
- package/dist/providers/db-firebase/sieve.js +23 -5
- package/dist/providers/firebase-client/auth.js +0 -1
- package/dist/providers/firebase-client/index.js +0 -1
- package/dist/providers/firebase-client/realtime.js +0 -1
- package/dist/providers/payment-razorpay/index.d.ts +20 -1
- package/dist/providers/payment-razorpay/index.js +3 -4
- package/dist/providers/shipping-shiprocket/index.d.ts +37 -0
- package/dist/providers/shipping-shiprocket/index.js +36 -3
- package/dist/providers/shipping-shiprocket/shiprocket-provider.d.ts +2 -3
- package/dist/providers/shipping-shiprocket/shiprocket-provider.js +28 -12
- package/dist/providers/storage-firebase/client.js +1 -2
- package/dist/providers.d.ts +25 -0
- package/dist/providers.js +31 -0
- package/dist/react/ErrorBoundary.d.ts +1 -1
- package/dist/react/ErrorBoundary.js +1 -1
- package/dist/react/contexts/SessionContext.d.ts +0 -1
- package/dist/react/contexts/SessionContext.js +0 -1
- package/dist/react/contexts/ThemeContext.d.ts +0 -1
- package/dist/react/contexts/ThemeContext.js +0 -1
- package/dist/react/hooks/useBreakpoint.js +0 -1
- package/dist/react/hooks/useCamera.d.ts +0 -1
- package/dist/react/hooks/useCamera.js +0 -1
- package/dist/react/hooks/useClickOutside.d.ts +0 -1
- package/dist/react/hooks/useClickOutside.js +0 -1
- package/dist/react/hooks/useContainerGrid.js +1 -1
- package/dist/react/hooks/useCountdown.js +1 -0
- package/dist/react/hooks/useMediaQuery.d.ts +0 -1
- package/dist/react/hooks/useMediaQuery.js +0 -1
- package/dist/react/hooks/useSwipe.d.ts +0 -1
- package/dist/react/hooks/useSwipe.js +0 -1
- package/dist/react/hooks/useUnsavedChanges.d.ts +0 -1
- package/dist/react/hooks/useUnsavedChanges.js +3 -3
- package/dist/react/hooks/useVisibleItems.js +1 -1
- package/dist/react/useModalStack.js +1 -1
- package/dist/repositories/index.d.ts +0 -1
- package/dist/repositories/index.js +0 -1
- package/dist/security/authorization.js +10 -15
- package/dist/security/index.d.ts +1 -1
- package/dist/security/index.js +1 -1
- package/dist/security/pii-encrypt.d.ts +11 -1
- package/dist/security/pii-encrypt.js +11 -5
- package/dist/security/pii-redact.d.ts +16 -0
- package/dist/security/pii-redact.js +32 -0
- package/dist/security/rate-limit.d.ts +0 -1
- package/dist/security/rate-limit.js +17 -5
- package/dist/security/rbac/Can.js +0 -2
- package/dist/security/rbac/hook.js +1 -1
- package/dist/security/settings-encryption.d.ts +0 -1
- package/dist/security/settings-encryption.js +7 -2
- package/dist/seed/actions/demo-seed-actions.d.ts +12 -1
- package/dist/seed/addresses-seed-data.d.ts +0 -1
- package/dist/seed/addresses-seed-data.js +1 -2
- package/dist/seed/bids-seed-data.d.ts +0 -1
- package/dist/seed/bids-seed-data.js +21 -22
- package/dist/seed/blog-posts-seed-data.d.ts +0 -1
- package/dist/seed/blog-posts-seed-data.js +8 -5
- package/dist/seed/carousel-slides-seed-data.d.ts +0 -1
- package/dist/seed/carousel-slides-seed-data.js +4 -1
- package/dist/seed/cart-seed-data.d.ts +0 -1
- package/dist/seed/cart-seed-data.js +5 -6
- package/dist/seed/categories-seed-data.d.ts +0 -1
- package/dist/seed/categories-seed-data.js +4 -1
- package/dist/seed/coupons-seed-data.d.ts +0 -1
- package/dist/seed/coupons-seed-data.js +4 -1
- package/dist/seed/events-seed-data.d.ts +0 -1
- package/dist/seed/events-seed-data.js +7 -4
- package/dist/seed/factories/product.factory.js +1 -1
- package/dist/seed/faq-seed-data.d.ts +0 -1
- package/dist/seed/faq-seed-data.js +15 -1
- package/dist/seed/firestore-indexes.d.ts +0 -1
- package/dist/seed/firestore-indexes.js +0 -1
- package/dist/seed/homepage-sections-seed-data.d.ts +4 -5
- package/dist/seed/homepage-sections-seed-data.js +84 -31
- package/dist/seed/index.d.ts +7 -1
- package/dist/seed/index.js +8 -1
- package/dist/seed/notifications-seed-data.d.ts +0 -1
- package/dist/seed/notifications-seed-data.js +15 -12
- package/dist/seed/orders-seed-data.d.ts +0 -1
- package/dist/seed/orders-seed-data.js +6 -7
- package/dist/seed/payouts-seed-data.d.ts +0 -1
- package/dist/seed/payouts-seed-data.js +4 -5
- package/dist/seed/pokemon-carousel-slides-seed-data.d.ts +6 -0
- package/dist/seed/pokemon-carousel-slides-seed-data.js +433 -0
- package/dist/seed/pokemon-categories-seed-data.d.ts +27 -0
- package/dist/seed/pokemon-categories-seed-data.js +1127 -0
- package/dist/seed/pokemon-homepage-sections-seed-data.d.ts +6 -0
- package/dist/seed/pokemon-homepage-sections-seed-data.js +370 -0
- package/dist/seed/pokemon-products-seed-data.d.ts +9 -0
- package/dist/seed/pokemon-products-seed-data.js +1119 -0
- package/dist/seed/pokemon-seed-bundle.d.ts +22 -0
- package/dist/seed/pokemon-seed-bundle.js +22 -0
- package/dist/seed/pokemon-stores-seed-data.d.ts +7 -0
- package/dist/seed/pokemon-stores-seed-data.js +78 -0
- package/dist/seed/pokemon-users-seed-data.d.ts +6 -0
- package/dist/seed/pokemon-users-seed-data.js +438 -0
- package/dist/seed/products-seed-data.d.ts +0 -1
- package/dist/seed/products-seed-data.js +34 -2
- package/dist/seed/reviews-seed-data.d.ts +0 -1
- package/dist/seed/reviews-seed-data.js +4 -1
- package/dist/seed/runner.d.ts +0 -1
- package/dist/seed/runner.js +10 -2
- package/dist/seed/seed-market-config.d.ts +0 -1
- package/dist/seed/seed-market-config.js +1 -2
- package/dist/seed/sessions-seed-data.d.ts +0 -1
- package/dist/seed/sessions-seed-data.js +19 -20
- package/dist/seed/site-settings-seed-data.d.ts +38 -2
- package/dist/seed/site-settings-seed-data.js +124 -1
- package/dist/seed/store-addresses-seed-data.d.ts +0 -1
- package/dist/seed/store-addresses-seed-data.js +1 -2
- package/dist/seed/stores-seed-data.d.ts +0 -1
- package/dist/seed/stores-seed-data.js +14 -4
- package/dist/seed/test-utils.d.ts +0 -1
- package/dist/seed/test-utils.js +0 -1
- package/dist/seed/types.d.ts +0 -1
- package/dist/seed/types.js +2 -1
- package/dist/seed/users-seed-data.d.ts +0 -1
- package/dist/seed/users-seed-data.js +7 -8
- package/dist/seed/wishlists-seed-data.d.ts +10 -0
- package/dist/seed/wishlists-seed-data.js +38 -0
- package/dist/seo/json-ld.js +1 -1
- package/dist/server.d.ts +437 -109
- package/dist/server.js +1296 -110
- package/dist/styles.css +20 -0
- package/dist/tokens/index.d.ts +131 -0
- package/dist/tokens/index.js +55 -11
- package/dist/tokens/tokens.css +9 -9
- package/dist/ui/DataTable.js +15 -15
- package/dist/ui/columns/column-renderers.js +3 -3
- package/dist/ui/components/Accordion.js +1 -1
- package/dist/ui/components/ActiveFilterChips.js +0 -1
- package/dist/ui/components/Alert.js +1 -1
- package/dist/ui/components/Avatar.js +1 -2
- package/dist/ui/components/AvatarDisplay.js +2 -3
- package/dist/ui/components/BackgroundRenderer.js +1 -1
- package/dist/ui/components/BaseListingCard.js +7 -5
- package/dist/ui/components/BulkActionBar.d.ts +0 -1
- package/dist/ui/components/BulkActionBar.js +2 -3
- package/dist/ui/components/Button.style.css +2 -2
- package/dist/ui/components/Card.js +4 -4
- package/dist/ui/components/Checkbox.js +1 -1
- package/dist/ui/components/ConfirmDeleteModal.d.ts +0 -1
- package/dist/ui/components/ConfirmDeleteModal.js +2 -3
- package/dist/ui/components/CountdownDisplay.d.ts +0 -1
- package/dist/ui/components/CountdownDisplay.js +0 -1
- package/dist/ui/components/DashboardStatsCard.js +1 -2
- package/dist/ui/components/DescriptionField.js +1 -1
- package/dist/ui/components/DetailViewShell.d.ts +16 -2
- package/dist/ui/components/DetailViewShell.js +9 -5
- package/dist/ui/components/Div.d.ts +1 -1
- package/dist/ui/components/Div.js +2 -2
- package/dist/ui/components/Divider.js +1 -1
- package/dist/ui/components/Drawer.d.ts +0 -1
- package/dist/ui/components/Drawer.js +2 -3
- package/dist/ui/components/Dropdown.d.ts +0 -1
- package/dist/ui/components/Dropdown.js +1 -2
- package/dist/ui/components/DynamicSelect.d.ts +0 -1
- package/dist/ui/components/DynamicSelect.js +2 -3
- package/dist/ui/components/EmptyState.js +1 -2
- package/dist/ui/components/FilterDrawer.d.ts +3 -1
- package/dist/ui/components/FilterDrawer.js +3 -3
- package/dist/ui/components/FlowDiagram.js +3 -3
- package/dist/ui/components/Form.js +2 -2
- package/dist/ui/components/FormField.js +3 -4
- package/dist/ui/components/FormGrid.js +2 -2
- package/dist/ui/components/FormGrid.style.css +1 -1
- package/dist/ui/components/HorizontalScroller.d.ts +1 -1
- package/dist/ui/components/HorizontalScroller.js +86 -15
- package/dist/ui/components/HorizontalScroller.style.css +105 -109
- package/dist/ui/components/ImageGallery.d.ts +0 -1
- package/dist/ui/components/ImageGallery.js +4 -5
- package/dist/ui/components/ImageLightbox.d.ts +0 -1
- package/dist/ui/components/ImageLightbox.js +1 -2
- package/dist/ui/components/ImageLightbox.style.css +3 -3
- package/dist/ui/components/Input.js +1 -1
- package/dist/ui/components/Layout.d.ts +7 -7
- package/dist/ui/components/Layout.js +5 -5
- package/dist/ui/components/ListingLayout.d.ts +11 -8
- package/dist/ui/components/ListingLayout.js +22 -44
- package/dist/ui/components/ListingLayout.style.css +15 -15
- package/dist/ui/components/ListingViewShell.d.ts +1 -2
- package/dist/ui/components/ListingViewShell.js +1 -3
- package/dist/ui/components/Menu.js +0 -1
- package/dist/ui/components/Modal.d.ts +0 -1
- package/dist/ui/components/Modal.js +3 -4
- package/dist/ui/components/NavigationLoader.d.ts +29 -0
- package/dist/ui/components/NavigationLoader.js +146 -0
- package/dist/ui/components/NavigationLoader.style.css +19 -0
- package/dist/ui/components/Pagination.js +0 -1
- package/dist/ui/components/PasswordStrengthIndicator.js +1 -2
- package/dist/ui/components/PriceDisplay.js +0 -1
- package/dist/ui/components/Progress.js +2 -3
- package/dist/ui/components/Radio.js +1 -2
- package/dist/ui/components/RatingDisplay.js +1 -2
- package/dist/ui/components/ResponsiveView.js +1 -2
- package/dist/ui/components/RichTextEditor.d.ts +9 -0
- package/dist/ui/components/RichTextEditor.js +59 -0
- package/dist/ui/components/RoleBadge.js +0 -1
- package/dist/ui/components/RowActionMenu.js +1 -1
- package/dist/ui/components/SectionTabs.js +4 -4
- package/dist/ui/components/Select.js +2 -2
- package/dist/ui/components/Semantic.d.ts +2 -2
- package/dist/ui/components/Semantic.js +1 -1
- package/dist/ui/components/SideDrawer.d.ts +0 -1
- package/dist/ui/components/SideDrawer.js +2 -3
- package/dist/ui/components/SideDrawer.style.css +2 -2
- package/dist/ui/components/SideModal.d.ts +0 -1
- package/dist/ui/components/SideModal.js +0 -1
- package/dist/ui/components/SideModal.style.css +4 -4
- package/dist/ui/components/Skeleton.js +1 -2
- package/dist/ui/components/SkipToMain.js +0 -1
- package/dist/ui/components/Slider.js +2 -2
- package/dist/ui/components/SlottedListingView.d.ts +1 -2
- package/dist/ui/components/SlottedListingView.js +2 -3
- package/dist/ui/components/SortDropdown.js +1 -2
- package/dist/ui/components/Spinner.d.ts +1 -1
- package/dist/ui/components/Spinner.js +2 -1
- package/dist/ui/components/Spinner.style.css +8 -0
- package/dist/ui/components/StackedViewShell.d.ts +0 -1
- package/dist/ui/components/StackedViewShell.js +0 -2
- package/dist/ui/components/StatsGrid.js +0 -1
- package/dist/ui/components/StatusBadge.d.ts +5 -5
- package/dist/ui/components/StepperNav.js +2 -3
- package/dist/ui/components/SummaryCard.js +0 -1
- package/dist/ui/components/TabStrip.d.ts +0 -1
- package/dist/ui/components/TabStrip.js +1 -2
- package/dist/ui/components/TablePagination.js +0 -1
- package/dist/ui/components/Tabs.js +3 -3
- package/dist/ui/components/TagInput.js +1 -1
- package/dist/ui/components/TextLink.js +0 -1
- package/dist/ui/components/Textarea.js +2 -2
- package/dist/ui/components/Toast.d.ts +0 -1
- package/dist/ui/components/Toast.js +2 -3
- package/dist/ui/components/Toggle.js +1 -1
- package/dist/ui/components/Tooltip.d.ts +0 -1
- package/dist/ui/components/Tooltip.js +1 -2
- package/dist/ui/components/UnsavedChangesModal.d.ts +0 -1
- package/dist/ui/components/UnsavedChangesModal.js +2 -3
- package/dist/ui/components/ViewToggle.js +0 -1
- package/dist/ui/components/index.style.css +1 -0
- package/dist/ui/index.d.ts +5 -1
- package/dist/ui/index.js +5 -3
- package/dist/ui/rich-text/RichText.d.ts +0 -1
- package/dist/ui/rich-text/RichText.js +3 -4
- package/dist/utils/event-manager.d.ts +6 -1
- package/dist/utils/event-manager.js +6 -1
- package/dist/utils/id-generators.js +3 -3
- package/dist/utils/string.formatter.d.ts +5 -0
- package/dist/utils/string.formatter.js +15 -0
- package/dist/validation/schemas.d.ts +20 -20
- package/package.json +86 -25
|
@@ -1,11 +1,29 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* FirebaseRepository<T>
|
|
3
|
+
*
|
|
4
|
+
* Generic abstract base class implementing `IRepository<T>` from
|
|
5
|
+
* `@mohasinac/contracts` against Firebase Firestore (Admin SDK).
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { FirebaseRepository } from "@mohasinac/db-firebase";
|
|
10
|
+
* import type { Product } from "@/types";
|
|
11
|
+
*
|
|
12
|
+
* export class ProductRepository extends FirebaseRepository<Product> {
|
|
13
|
+
* constructor() { super("products"); }
|
|
14
|
+
* }
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* `findAll(query?)` maps the provider-agnostic `SieveQuery` from
|
|
18
|
+
* `@mohasinac/contracts` to Firestore native queries (no in-memory fan-out).
|
|
19
|
+
*/
|
|
2
20
|
import { getAdminDb } from "./admin";
|
|
3
|
-
import { prepareForFirestore, deserializeTimestamps } from "./helpers";
|
|
21
|
+
import { prepareForFirestore, deserializeTimestamps, getFirestoreCount, } from "./helpers";
|
|
4
22
|
export class FirebaseRepository {
|
|
5
23
|
constructor(collectionName) {
|
|
6
24
|
this.collection = collectionName;
|
|
7
25
|
}
|
|
8
|
-
//
|
|
26
|
+
// -- Internals --------------------------------------------------------------
|
|
9
27
|
get db() {
|
|
10
28
|
return getAdminDb();
|
|
11
29
|
}
|
|
@@ -19,7 +37,7 @@ export class FirebaseRepository {
|
|
|
19
37
|
...(snap.data() ?? {}),
|
|
20
38
|
});
|
|
21
39
|
}
|
|
22
|
-
//
|
|
40
|
+
// -- IReadRepository --------------------------------------------------------
|
|
23
41
|
async findById(id) {
|
|
24
42
|
const snap = await this.getCollection().doc(id).get();
|
|
25
43
|
if (!snap.exists)
|
|
@@ -30,7 +48,7 @@ export class FirebaseRepository {
|
|
|
30
48
|
const page = Math.max(1, query?.page ?? 1);
|
|
31
49
|
const perPage = Math.max(1, Math.min(query?.perPage ?? 20, 500));
|
|
32
50
|
let q = this.getCollection();
|
|
33
|
-
//
|
|
51
|
+
// -- Sort ------------------------------------------------------------------
|
|
34
52
|
// SieveQuery.sort supports a leading "-" prefix for descending order
|
|
35
53
|
// (e.g. "-createdAt" means ORDER BY createdAt DESC).
|
|
36
54
|
if (query?.sort) {
|
|
@@ -44,14 +62,24 @@ export class FirebaseRepository {
|
|
|
44
62
|
: "asc";
|
|
45
63
|
q = q.orderBy(sortField, sortDir);
|
|
46
64
|
}
|
|
47
|
-
//
|
|
48
|
-
// Supports: ==, !=, <, <=, >, >=, @= (array-contains)
|
|
65
|
+
// -- Basic Sieve filter parsing --------------------------------------------
|
|
66
|
+
// Supports: ==, !=, <, <=, >, >=, @= (array-contains), @=* (prefix/starts-with)
|
|
49
67
|
if (query?.filters) {
|
|
50
68
|
const clauses = query.filters
|
|
51
69
|
.split(",")
|
|
52
70
|
.map((s) => s.trim())
|
|
53
71
|
.filter(Boolean);
|
|
54
72
|
for (const clause of clauses) {
|
|
73
|
+
// Try @=* (string prefix) before the generic @= match
|
|
74
|
+
const prefixMatch = clause.match(/^([^<>=!@]+)\s*@=\*\s*(.+)$/);
|
|
75
|
+
if (prefixMatch) {
|
|
76
|
+
const field = prefixMatch[1].trim();
|
|
77
|
+
const prefix = prefixMatch[2].trim();
|
|
78
|
+
q = q
|
|
79
|
+
.where(field, ">=", prefix)
|
|
80
|
+
.where(field, "<=", prefix + "");
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
55
83
|
const match = clause.match(/^([^<>=!@]+)\s*(==|!=|<=|>=|<|>|@=)\s*(.+)$/);
|
|
56
84
|
if (!match)
|
|
57
85
|
continue;
|
|
@@ -62,10 +90,9 @@ export class FirebaseRepository {
|
|
|
62
90
|
q = q.where(field, op, value);
|
|
63
91
|
}
|
|
64
92
|
}
|
|
65
|
-
//
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
// ── Paginate ──────────────────────────────────────────────────────────────
|
|
93
|
+
// -- Count -----------------------------------------------------------------
|
|
94
|
+
const total = await getFirestoreCount(q);
|
|
95
|
+
// -- Paginate --------------------------------------------------------------
|
|
69
96
|
const offset = (page - 1) * perPage;
|
|
70
97
|
const pagedSnap = await q.offset(offset).limit(perPage).get();
|
|
71
98
|
const data = pagedSnap.docs.map((d) => this.mapDoc(d));
|
|
@@ -78,7 +105,7 @@ export class FirebaseRepository {
|
|
|
78
105
|
.get();
|
|
79
106
|
return snap.docs.map((d) => this.mapDoc(d));
|
|
80
107
|
}
|
|
81
|
-
//
|
|
108
|
+
// -- IWriteRepository -------------------------------------------------------
|
|
82
109
|
async create(data) {
|
|
83
110
|
const now = new Date();
|
|
84
111
|
const payload = prepareForFirestore({
|
|
@@ -131,7 +158,7 @@ export class FirebaseRepository {
|
|
|
131
158
|
}
|
|
132
159
|
await batch.commit();
|
|
133
160
|
}
|
|
134
|
-
//
|
|
161
|
+
// -- Extended helpers (not in IRepository contract) ------------------------
|
|
135
162
|
/** Find by ID or throw `Error` with a descriptive message. */
|
|
136
163
|
async findByIdOrFail(id) {
|
|
137
164
|
const doc = await this.findById(id);
|
|
@@ -151,11 +178,10 @@ export class FirebaseRepository {
|
|
|
151
178
|
}
|
|
152
179
|
/** Count all documents in the collection. */
|
|
153
180
|
async count() {
|
|
154
|
-
|
|
155
|
-
return snap.data().count;
|
|
181
|
+
return getFirestoreCount(this.getCollection());
|
|
156
182
|
}
|
|
157
183
|
}
|
|
158
|
-
//
|
|
184
|
+
// --- Internal helpers ---------------------------------------------------------
|
|
159
185
|
const TOKEN_TO_OP = {
|
|
160
186
|
"==": "==",
|
|
161
187
|
"!=": "!=",
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import "server-only";
|
|
2
1
|
import type { CollectionReference, DocumentData, DocumentReference, DocumentSnapshot, Firestore, Query, Transaction, WriteBatch } from "firebase-admin/firestore";
|
|
3
2
|
import { type FirebaseSieveFields, type FirebaseSieveOptions, type FirebaseSieveResult, type SieveModel } from "./sieve";
|
|
4
3
|
export declare abstract class BaseRepository<T extends DocumentData> {
|
|
5
4
|
protected collection: string;
|
|
6
5
|
constructor(collectionName: string);
|
|
7
6
|
protected get db(): Firestore;
|
|
8
|
-
protected getCollection(): CollectionReference<DocumentData
|
|
7
|
+
protected getCollection(): CollectionReference<DocumentData>;
|
|
9
8
|
protected mapDoc<D = T>(snap: DocumentSnapshot): D;
|
|
10
9
|
findById(id: string): Promise<T | null>;
|
|
11
10
|
findByIdOrFail(id: string): Promise<T>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { CollectionReference, DocumentData, Query } from "firebase-admin/firestore";
|
|
1
2
|
/**
|
|
2
3
|
* Firestore serialisation helpers.
|
|
3
4
|
*
|
|
@@ -21,3 +22,4 @@ export declare function prepareForFirestore<T extends Record<string, unknown>>(d
|
|
|
21
22
|
* to Client Components. `Date` objects are serialised as ISO strings.
|
|
22
23
|
*/
|
|
23
24
|
export declare function deserializeTimestamps<T>(obj: T): T;
|
|
25
|
+
export declare function getFirestoreCount(query: Query<DocumentData> | CollectionReference<DocumentData>): Promise<number>;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* These utilities are the single adapter boundary between raw Firestore
|
|
5
5
|
* documents and application-level objects.
|
|
6
6
|
*/
|
|
7
|
-
//
|
|
7
|
+
// --- Undefined removal --------------------------------------------------------
|
|
8
8
|
/**
|
|
9
9
|
* Recursively remove `undefined` values from an object.
|
|
10
10
|
* Firestore rejects writes that contain `undefined` fields.
|
|
@@ -38,7 +38,7 @@ export function removeUndefined(obj) {
|
|
|
38
38
|
export function prepareForFirestore(data) {
|
|
39
39
|
return removeUndefined(data);
|
|
40
40
|
}
|
|
41
|
-
//
|
|
41
|
+
// --- Timestamp deserialisation ------------------------------------------------
|
|
42
42
|
/**
|
|
43
43
|
* Recursively convert Firestore `Timestamp` instances to plain `Date` objects.
|
|
44
44
|
*
|
|
@@ -65,3 +65,12 @@ export function deserializeTimestamps(obj) {
|
|
|
65
65
|
}
|
|
66
66
|
return obj;
|
|
67
67
|
}
|
|
68
|
+
export async function getFirestoreCount(query) {
|
|
69
|
+
const countQuery = query;
|
|
70
|
+
if (typeof countQuery.count === "function") {
|
|
71
|
+
const snapshot = await countQuery.count().get();
|
|
72
|
+
return snapshot.data().count;
|
|
73
|
+
}
|
|
74
|
+
const snapshot = await query.get();
|
|
75
|
+
return snapshot.size;
|
|
76
|
+
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import "server-only";
|
|
2
1
|
/**
|
|
3
2
|
* @mohasinac/db-firebase
|
|
4
3
|
*
|
|
@@ -15,7 +14,7 @@ import "server-only";
|
|
|
15
14
|
* ```
|
|
16
15
|
*/
|
|
17
16
|
export { getAdminApp, getAdminAuth, getAdminDb, getAdminStorage, getAdminRealtimeDb, _resetAdminSingletons, } from "./admin";
|
|
18
|
-
export { removeUndefined, prepareForFirestore, deserializeTimestamps, } from "./helpers";
|
|
17
|
+
export { removeUndefined, prepareForFirestore, deserializeTimestamps, getFirestoreCount, } from "./helpers";
|
|
19
18
|
export { firebaseFieldOps } from "./field-ops";
|
|
20
19
|
export type { DocumentSnapshot } from "firebase-admin/firestore";
|
|
21
20
|
export { FirebaseRepository } from "./base";
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import "server-only";
|
|
2
1
|
// Auto-register Firebase field operations on import
|
|
3
2
|
import { registerFieldOps } from "../../contracts/field-ops";
|
|
4
3
|
import { firebaseFieldOps } from "./field-ops";
|
|
@@ -21,7 +20,7 @@ registerFieldOps(firebaseFieldOps);
|
|
|
21
20
|
// Admin SDK singletons
|
|
22
21
|
export { getAdminApp, getAdminAuth, getAdminDb, getAdminStorage, getAdminRealtimeDb, _resetAdminSingletons, } from "./admin";
|
|
23
22
|
// Serialisation helpers
|
|
24
|
-
export { removeUndefined, prepareForFirestore, deserializeTimestamps, } from "./helpers";
|
|
23
|
+
export { removeUndefined, prepareForFirestore, deserializeTimestamps, getFirestoreCount, } from "./helpers";
|
|
25
24
|
// Firebase field ops implementation
|
|
26
25
|
export { firebaseFieldOps } from "./field-ops";
|
|
27
26
|
// Repository base classes
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import "server-only";
|
|
2
1
|
/**
|
|
3
2
|
* FirebaseRealtimeRepository<T>
|
|
4
3
|
*
|
|
@@ -22,7 +21,7 @@ export declare abstract class FirebaseRealtimeRepository<T extends DocumentData>
|
|
|
22
21
|
protected readonly path: string;
|
|
23
22
|
constructor(rtdbPath: string);
|
|
24
23
|
protected get rtdb(): import("firebase-admin/database").Database;
|
|
25
|
-
protected nodeRef(id?: string): import("
|
|
24
|
+
protected nodeRef(id?: string): import("firebase-admin/database").Reference;
|
|
26
25
|
findById(id: string): Promise<T | null>;
|
|
27
26
|
findAll(query?: SieveQuery): Promise<PagedResult<T>>;
|
|
28
27
|
findWhere(field: keyof T, _op: WhereOp, value: unknown): Promise<T[]>;
|
|
@@ -1,4 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* FirebaseRealtimeRepository<T>
|
|
3
|
+
*
|
|
4
|
+
* Abstract base implementing `IRealtimeRepository<T>` from `@mohasinac/contracts`
|
|
5
|
+
* against Firebase Realtime Database (Admin SDK).
|
|
6
|
+
*
|
|
7
|
+
* Realtime DB does not support Firestore-style queries; `findAll()` loads the
|
|
8
|
+
* entire collection node. Use this only for small, high-churn datasets (e.g.
|
|
9
|
+
* presence, chat, live-bid prices).
|
|
10
|
+
*
|
|
11
|
+
* Usage:
|
|
12
|
+
* ```ts
|
|
13
|
+
* class PresenceRepository extends FirebaseRealtimeRepository<PresenceEntry> {
|
|
14
|
+
* constructor() { super("presence"); }
|
|
15
|
+
* }
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
2
18
|
import { getAdminRealtimeDb } from "./admin";
|
|
3
19
|
export class FirebaseRealtimeRepository {
|
|
4
20
|
constructor(rtdbPath) {
|
|
@@ -10,7 +26,7 @@ export class FirebaseRealtimeRepository {
|
|
|
10
26
|
nodeRef(id) {
|
|
11
27
|
return id ? this.rtdb.ref(`${this.path}/${id}`) : this.rtdb.ref(this.path);
|
|
12
28
|
}
|
|
13
|
-
//
|
|
29
|
+
// -- IReadRepository --------------------------------------------------------
|
|
14
30
|
async findById(id) {
|
|
15
31
|
const snap = await this.nodeRef(id).get();
|
|
16
32
|
if (!snap.exists())
|
|
@@ -66,7 +82,7 @@ export class FirebaseRealtimeRepository {
|
|
|
66
82
|
const raw = snap.val();
|
|
67
83
|
return Object.entries(raw).map(([id, val]) => ({ id, ...val }));
|
|
68
84
|
}
|
|
69
|
-
//
|
|
85
|
+
// -- IWriteRepository -------------------------------------------------------
|
|
70
86
|
async create(data) {
|
|
71
87
|
const now = Date.now();
|
|
72
88
|
const payload = { ...data, createdAt: now, updatedAt: now };
|
|
@@ -88,7 +104,7 @@ export class FirebaseRealtimeRepository {
|
|
|
88
104
|
async batchDelete(ids) {
|
|
89
105
|
await Promise.all(ids.map((id) => this.delete(id)));
|
|
90
106
|
}
|
|
91
|
-
//
|
|
107
|
+
// -- IRealtimeRepository ---------------------------------------------------
|
|
92
108
|
/**
|
|
93
109
|
* Subscribe to a single RTDB node.
|
|
94
110
|
* Returns an unsubscribe function.
|
|
@@ -1,8 +1,26 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* FirebaseSieveRepository<T>
|
|
3
|
+
*
|
|
4
|
+
* Extends `FirebaseRepository<T>` with a full Sieve DSL query (filters, sorts,
|
|
5
|
+
* page, pageSize) pushed entirely to Firestore — no in-memory iteration.
|
|
6
|
+
*
|
|
7
|
+
* Uses `@mohasinac/sievejs` for parsing the Sieve filter / sort grammar.
|
|
8
|
+
*
|
|
9
|
+
* Usage in subclasses:
|
|
10
|
+
* ```ts
|
|
11
|
+
* async list(model: SieveModel, baseQuery?: CollectionReference | Query) {
|
|
12
|
+
* return this.sieveQuery<ProductDocument>(model, {
|
|
13
|
+
* title: { canFilter: true, canSort: true },
|
|
14
|
+
* price: { canFilter: true, canSort: true },
|
|
15
|
+
* createdAt: { canFilter: true, canSort: true },
|
|
16
|
+
* }, { baseQuery });
|
|
17
|
+
* }
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
2
20
|
import { SieveProcessorBase } from "@mohasinac/sievejs/services";
|
|
3
21
|
import { createFirebaseAdapter } from "@mohasinac/sievejs/adapters/firebase";
|
|
4
22
|
import { FirebaseRepository } from "./base";
|
|
5
|
-
import { deserializeTimestamps } from "./helpers";
|
|
23
|
+
import { deserializeTimestamps, getFirestoreCount } from "./helpers";
|
|
6
24
|
const SIEVE_DEFAULTS = {
|
|
7
25
|
caseSensitive: false,
|
|
8
26
|
defaultPageSize: 20,
|
|
@@ -24,7 +42,7 @@ export async function applySieveToFirestore(params) {
|
|
|
24
42
|
const filteredQ = processor.apply(model, baseQuery, {
|
|
25
43
|
applyPagination: false,
|
|
26
44
|
});
|
|
27
|
-
const total =
|
|
45
|
+
const total = await getFirestoreCount(filteredQ);
|
|
28
46
|
const pagedQ = processor.apply(model, baseQuery);
|
|
29
47
|
const snap = await pagedQ.get();
|
|
30
48
|
const items = snap.docs.map((d) => deserializeTimestamps({ id: d.id, ...d.data() }));
|
|
@@ -40,7 +58,7 @@ export async function applySieveToFirestore(params) {
|
|
|
40
58
|
hasMore: page < totalPages,
|
|
41
59
|
};
|
|
42
60
|
}
|
|
43
|
-
//
|
|
61
|
+
// --- Class --------------------------------------------------------------------
|
|
44
62
|
export class FirebaseSieveRepository extends FirebaseRepository {
|
|
45
63
|
/**
|
|
46
64
|
* Run a Sieve DSL query against Firestore at the DB layer.
|
|
@@ -63,7 +81,7 @@ export class FirebaseSieveRepository extends FirebaseRepository {
|
|
|
63
81
|
const filteredQ = processor.apply(model, base, {
|
|
64
82
|
applyPagination: false,
|
|
65
83
|
});
|
|
66
|
-
const total =
|
|
84
|
+
const total = await getFirestoreCount(filteredQ);
|
|
67
85
|
// Paginated result
|
|
68
86
|
const pagedQ = processor.apply(model, base);
|
|
69
87
|
const snap = await pagedQ.get();
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use client";
|
|
2
1
|
import { applyActionCode as fbApplyActionCode, confirmPasswordReset as fbConfirmPasswordReset, EmailAuthProvider, getAuth, reauthenticateWithCredential, sendPasswordResetEmail as fbSendPasswordResetEmail, signInWithEmailAndPassword as fbSignInWithEmailAndPassword, updatePassword, } from "firebase/auth";
|
|
3
2
|
/**
|
|
4
3
|
* Firebase Auth client SDK implementation of IClientAuthProvider.
|
|
@@ -1,4 +1,23 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @mohasinac/payment-razorpay — Razorpay IPaymentProvider implementation
|
|
3
|
+
*
|
|
4
|
+
* Implements the @mohasinac/contracts IPaymentProvider interface.
|
|
5
|
+
* Accepts credentials via constructor — no Firestore or DB dependency.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { RazorpayProvider } from "@mohasinac/payment-razorpay";
|
|
10
|
+
* import { registerProviders } from "../../contracts";
|
|
11
|
+
*
|
|
12
|
+
* registerProviders({
|
|
13
|
+
* payment: new RazorpayProvider({
|
|
14
|
+
* keyId: process.env.RAZORPAY_KEY_ID!,
|
|
15
|
+
* keySecret: process.env.RAZORPAY_KEY_SECRET!,
|
|
16
|
+
* webhookSecret: process.env.RAZORPAY_WEBHOOK_SECRET,
|
|
17
|
+
* }),
|
|
18
|
+
* });
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
2
21
|
import type { IPaymentProvider, PaymentOrder, PaymentCapture, Refund } from "../../contracts";
|
|
3
22
|
export interface RazorpayConfig {
|
|
4
23
|
keyId: string;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import "server-only";
|
|
2
1
|
/**
|
|
3
2
|
* @mohasinac/payment-razorpay — Razorpay IPaymentProvider implementation
|
|
4
3
|
*
|
|
@@ -22,7 +21,7 @@ import "server-only";
|
|
|
22
21
|
import Razorpay from "razorpay";
|
|
23
22
|
import { createHmac, timingSafeEqual } from "crypto";
|
|
24
23
|
import { getDefaultCurrency } from "../../core/baseline-resolver";
|
|
25
|
-
//
|
|
24
|
+
// --- IPaymentProvider implementation ------------------------------------------
|
|
26
25
|
export class RazorpayProvider {
|
|
27
26
|
constructor(config) {
|
|
28
27
|
this.razorpay = new Razorpay({
|
|
@@ -99,7 +98,7 @@ export class RazorpayProvider {
|
|
|
99
98
|
};
|
|
100
99
|
}
|
|
101
100
|
}
|
|
102
|
-
//
|
|
101
|
+
// --- Utility exports ----------------------------------------------------------
|
|
103
102
|
/** Convert rupees (float) → paise (integer) for Razorpay amount field */
|
|
104
103
|
export function rupeesToPaise(rupees) {
|
|
105
104
|
return Math.round(rupees * 100);
|
|
@@ -122,7 +121,7 @@ export function verifyPaymentSignature(params, keySecret) {
|
|
|
122
121
|
return false;
|
|
123
122
|
return timingSafeEqual(Buffer.from(expected, "hex"), Buffer.from(params.razorpay_signature, "hex"));
|
|
124
123
|
}
|
|
125
|
-
//
|
|
124
|
+
// --- Standalone API helpers (auto-credential resolution via resolveKeys) ------
|
|
126
125
|
// These resolve credentials from Firestore → env fallback so callers don't
|
|
127
126
|
// need to instantiate RazorpayProvider or pass credentials explicitly.
|
|
128
127
|
import { resolveKeys } from "../../core/integration-keys";
|
|
@@ -205,6 +205,24 @@ export interface ShiprocketCourierServiceabilityResponse {
|
|
|
205
205
|
status: number;
|
|
206
206
|
message?: string;
|
|
207
207
|
}
|
|
208
|
+
export interface ShiprocketCancelOrderResponse {
|
|
209
|
+
message: string;
|
|
210
|
+
status: number;
|
|
211
|
+
}
|
|
212
|
+
export interface ShiprocketOrderDetailResponse {
|
|
213
|
+
data?: {
|
|
214
|
+
shipments?: Array<{
|
|
215
|
+
id: number;
|
|
216
|
+
awb: string;
|
|
217
|
+
status: string;
|
|
218
|
+
}>;
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
export interface ShiprocketLabelResponse {
|
|
222
|
+
label_created: number;
|
|
223
|
+
label_url: string;
|
|
224
|
+
others?: string;
|
|
225
|
+
}
|
|
208
226
|
export interface ShiprocketWebhookPayload {
|
|
209
227
|
awb: string;
|
|
210
228
|
order_id: string;
|
|
@@ -267,6 +285,25 @@ export declare function shiprocketCheckServiceability(token: string, paramsOrPic
|
|
|
267
285
|
weight: number;
|
|
268
286
|
cod?: 0 | 1;
|
|
269
287
|
} | string, deliveryPostcode?: string, weight?: number, cod?: boolean): Promise<ShiprocketCourierServiceabilityResponse>;
|
|
288
|
+
/**
|
|
289
|
+
* Cancel one or more Shiprocket orders by their order IDs.
|
|
290
|
+
* @deprecated Use `ShiprocketProvider.cancelShipment()` instead.
|
|
291
|
+
* @internal
|
|
292
|
+
*/
|
|
293
|
+
export declare function shiprocketCancelOrder(token: string, orderIds: number[]): Promise<ShiprocketCancelOrderResponse>;
|
|
294
|
+
/**
|
|
295
|
+
* Fetch full order details (including nested shipment IDs) for a Shiprocket order.
|
|
296
|
+
* @deprecated Use `ShiprocketProvider.generateLabel()` instead (calls this internally).
|
|
297
|
+
* @internal
|
|
298
|
+
*/
|
|
299
|
+
export declare function shiprocketGetOrderDetail(token: string, orderId: number): Promise<ShiprocketOrderDetailResponse>;
|
|
300
|
+
/**
|
|
301
|
+
* Request a shipping label PDF for one or more Shiprocket shipment IDs.
|
|
302
|
+
* Returns a label URL — fetch that URL separately to get the raw PDF bytes.
|
|
303
|
+
* @deprecated Use `ShiprocketProvider.generateLabel()` instead.
|
|
304
|
+
* @internal
|
|
305
|
+
*/
|
|
306
|
+
export declare function shiprocketPrintLabel(token: string, shipmentIds: number[]): Promise<ShiprocketLabelResponse>;
|
|
270
307
|
/** Shiprocket tokens are valid for approx. 10 days */
|
|
271
308
|
export declare const SHIPROCKET_TOKEN_TTL_MS: number;
|
|
272
309
|
export declare function isShiprocketTokenExpired(expiry: Date | undefined): boolean;
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* ```
|
|
21
21
|
*/
|
|
22
22
|
const BASE_URL = "https://apiv2.shiprocket.in/v1/external";
|
|
23
|
-
//
|
|
23
|
+
// --- Internal fetch helper ----------------------------------------------------
|
|
24
24
|
async function shiprocketFetch(endpoint, options = {}) {
|
|
25
25
|
const { token, headers = {}, ...rest } = options;
|
|
26
26
|
const reqHeaders = {
|
|
@@ -48,9 +48,9 @@ async function shiprocketFetch(endpoint, options = {}) {
|
|
|
48
48
|
}
|
|
49
49
|
return json;
|
|
50
50
|
}
|
|
51
|
-
//
|
|
51
|
+
// --- Re-export Provider Class -------------------------------------------------
|
|
52
52
|
export { ShiprocketProvider } from "./shiprocket-provider";
|
|
53
|
-
//
|
|
53
|
+
// --- API Functions (prefer ShiprocketProvider class for new code) -------------
|
|
54
54
|
/**
|
|
55
55
|
* @deprecated Use `ShiprocketProvider.authenticate()` instead.
|
|
56
56
|
* @internal
|
|
@@ -139,6 +139,39 @@ export async function shiprocketCheckServiceability(token, paramsOrPickup, deliv
|
|
|
139
139
|
sp.set("cod", String(params.cod));
|
|
140
140
|
return shiprocketFetch(`/courier/serviceability/?${sp.toString()}`, { token });
|
|
141
141
|
}
|
|
142
|
+
/**
|
|
143
|
+
* Cancel one or more Shiprocket orders by their order IDs.
|
|
144
|
+
* @deprecated Use `ShiprocketProvider.cancelShipment()` instead.
|
|
145
|
+
* @internal
|
|
146
|
+
*/
|
|
147
|
+
export async function shiprocketCancelOrder(token, orderIds) {
|
|
148
|
+
return shiprocketFetch("/orders/cancel", {
|
|
149
|
+
method: "POST",
|
|
150
|
+
token,
|
|
151
|
+
body: JSON.stringify({ ids: orderIds }),
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Fetch full order details (including nested shipment IDs) for a Shiprocket order.
|
|
156
|
+
* @deprecated Use `ShiprocketProvider.generateLabel()` instead (calls this internally).
|
|
157
|
+
* @internal
|
|
158
|
+
*/
|
|
159
|
+
export async function shiprocketGetOrderDetail(token, orderId) {
|
|
160
|
+
return shiprocketFetch(`/orders/show/${orderId}`, { token });
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Request a shipping label PDF for one or more Shiprocket shipment IDs.
|
|
164
|
+
* Returns a label URL — fetch that URL separately to get the raw PDF bytes.
|
|
165
|
+
* @deprecated Use `ShiprocketProvider.generateLabel()` instead.
|
|
166
|
+
* @internal
|
|
167
|
+
*/
|
|
168
|
+
export async function shiprocketPrintLabel(token, shipmentIds) {
|
|
169
|
+
return shiprocketFetch("/orders/print/label", {
|
|
170
|
+
method: "POST",
|
|
171
|
+
token,
|
|
172
|
+
body: JSON.stringify({ shipment_id: shipmentIds }),
|
|
173
|
+
});
|
|
174
|
+
}
|
|
142
175
|
/** Shiprocket tokens are valid for approx. 10 days */
|
|
143
176
|
export const SHIPROCKET_TOKEN_TTL_MS = 9 * 24 * 60 * 60 * 1000;
|
|
144
177
|
export function isShiprocketTokenExpired(expiry) {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import "server-only";
|
|
2
1
|
import type { IShippingProvider, CreateShipmentInput, Shipment, TrackingInfo, ServiceabilityResult } from "../../contracts/shipping";
|
|
3
2
|
import { type ShiprocketAuthRequest, type ShiprocketAddPickupRequest, type ShiprocketVerifyPickupOTPRequest, type ShiprocketPickupLocation } from "./index";
|
|
4
3
|
export interface ShiprocketProviderConfig {
|
|
@@ -29,9 +28,9 @@ export declare class ShiprocketProvider implements IShippingProvider {
|
|
|
29
28
|
private ensureToken;
|
|
30
29
|
createShipment(data: CreateShipmentInput): Promise<Shipment>;
|
|
31
30
|
trackShipment(trackingId: string): Promise<TrackingInfo>;
|
|
32
|
-
cancelShipment(
|
|
31
|
+
cancelShipment(shipmentId: string): Promise<void>;
|
|
33
32
|
checkServiceability(pincode: string, weight: number): Promise<ServiceabilityResult>;
|
|
34
|
-
generateLabel(
|
|
33
|
+
generateLabel(shipmentId: string): Promise<ArrayBuffer>;
|
|
35
34
|
/** Authenticate and obtain a fresh token. */
|
|
36
35
|
authenticate(credentials?: ShiprocketAuthRequest): Promise<{
|
|
37
36
|
token: string;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import "
|
|
2
|
-
|
|
3
|
-
// ─── Shiprocket Provider Class ─────────────────────────────────────────────────
|
|
1
|
+
import { shiprocketAuthenticate, shiprocketCreateOrder, shiprocketGenerateAWB, shiprocketGeneratePickup, shiprocketTrackByAWB, shiprocketCheckServiceability, shiprocketGetPickupLocations, shiprocketAddPickupLocation, shiprocketVerifyPickupOTP, shiprocketCancelOrder, shiprocketGetOrderDetail, shiprocketPrintLabel, isShiprocketTokenExpired, SHIPROCKET_TOKEN_TTL_MS, } from "./index";
|
|
2
|
+
// --- Shiprocket Provider Class -------------------------------------------------
|
|
4
3
|
/**
|
|
5
4
|
* `IShippingProvider` implementation backed by the Shiprocket REST API.
|
|
6
5
|
*
|
|
@@ -18,7 +17,7 @@ export class ShiprocketProvider {
|
|
|
18
17
|
this.token = config.token;
|
|
19
18
|
this.tokenExpiry = config.tokenExpiry;
|
|
20
19
|
}
|
|
21
|
-
//
|
|
20
|
+
// --- Token Management ------------------------------------------------------
|
|
22
21
|
async ensureToken() {
|
|
23
22
|
if (this.token && !isShiprocketTokenExpired(this.tokenExpiry)) {
|
|
24
23
|
return this.token;
|
|
@@ -32,7 +31,7 @@ export class ShiprocketProvider {
|
|
|
32
31
|
await this.config.onTokenRefresh?.(this.token, this.tokenExpiry);
|
|
33
32
|
return this.token;
|
|
34
33
|
}
|
|
35
|
-
//
|
|
34
|
+
// --- IShippingProvider -----------------------------------------------------
|
|
36
35
|
async createShipment(data) {
|
|
37
36
|
const token = await this.ensureToken();
|
|
38
37
|
const orderReq = {
|
|
@@ -98,9 +97,10 @@ export class ShiprocketProvider {
|
|
|
98
97
|
events,
|
|
99
98
|
};
|
|
100
99
|
}
|
|
101
|
-
async cancelShipment(
|
|
102
|
-
|
|
103
|
-
|
|
100
|
+
async cancelShipment(shipmentId) {
|
|
101
|
+
const token = await this.ensureToken();
|
|
102
|
+
// shipmentId is Shipment.id = String(orderRes.order_id)
|
|
103
|
+
await shiprocketCancelOrder(token, [parseInt(shipmentId, 10)]);
|
|
104
104
|
}
|
|
105
105
|
async checkServiceability(pincode, weight) {
|
|
106
106
|
const token = await this.ensureToken();
|
|
@@ -116,11 +116,27 @@ export class ShiprocketProvider {
|
|
|
116
116
|
}));
|
|
117
117
|
return { isServiceable: couriers.length > 0, couriers };
|
|
118
118
|
}
|
|
119
|
-
async generateLabel(
|
|
120
|
-
|
|
121
|
-
|
|
119
|
+
async generateLabel(shipmentId) {
|
|
120
|
+
const token = await this.ensureToken();
|
|
121
|
+
// shipmentId is Shipment.id = String(orderRes.order_id); label API needs the
|
|
122
|
+
// Shiprocket shipment_id (different numeric field), so look it up first.
|
|
123
|
+
const orderId = parseInt(shipmentId, 10);
|
|
124
|
+
const detail = await shiprocketGetOrderDetail(token, orderId);
|
|
125
|
+
const srShipmentId = detail.data?.shipments?.[0]?.id;
|
|
126
|
+
if (!srShipmentId) {
|
|
127
|
+
throw new Error(`No shipment found for Shiprocket order ${orderId}`);
|
|
128
|
+
}
|
|
129
|
+
const labelRes = await shiprocketPrintLabel(token, [srShipmentId]);
|
|
130
|
+
if (!labelRes.label_url) {
|
|
131
|
+
throw new Error("Shiprocket did not return a label URL");
|
|
132
|
+
}
|
|
133
|
+
const pdfRes = await fetch(labelRes.label_url);
|
|
134
|
+
if (!pdfRes.ok) {
|
|
135
|
+
throw new Error(`Failed to download label PDF: ${pdfRes.status}`);
|
|
136
|
+
}
|
|
137
|
+
return pdfRes.arrayBuffer();
|
|
122
138
|
}
|
|
123
|
-
//
|
|
139
|
+
// --- Shiprocket-Specific Methods ------------------------------------------
|
|
124
140
|
/** Authenticate and obtain a fresh token. */
|
|
125
141
|
async authenticate(credentials) {
|
|
126
142
|
const creds = credentials ?? {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use client";
|
|
2
1
|
/**
|
|
3
2
|
* Firebase Client Storage Helpers
|
|
4
3
|
*
|
|
@@ -120,7 +119,7 @@ export function createStorageHelpers(storage) {
|
|
|
120
119
|
deleteFolder,
|
|
121
120
|
};
|
|
122
121
|
}
|
|
123
|
-
//
|
|
122
|
+
// --- File validation helpers (pure, no storage instance needed) ---------------
|
|
124
123
|
export function validateFileSize(file, maxSizeMB = 10) {
|
|
125
124
|
return file.size <= maxSizeMB * 1024 * 1024;
|
|
126
125
|
}
|