@mohasinac/appkit 2.7.27 → 2.7.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_internal/client/features/filters/filter-load-options.d.ts +29 -0
- package/dist/_internal/client/features/filters/filter-load-options.js +98 -0
- package/dist/_internal/client/features/layout/DashboardLayoutClient.js +1 -1
- package/dist/_internal/server/features/checkout/actions.js +42 -35
- package/dist/_internal/server/features/classified/adapters.d.ts +21 -0
- package/dist/_internal/server/features/classified/adapters.js +24 -0
- package/dist/_internal/server/features/classified/index.d.ts +3 -0
- package/dist/_internal/server/features/classified/index.js +3 -0
- package/dist/_internal/server/features/classified/metadata.d.ts +8 -0
- package/dist/_internal/server/features/classified/metadata.js +43 -0
- package/dist/_internal/server/features/classified/og.d.ts +30 -0
- package/dist/_internal/server/features/classified/og.js +76 -0
- package/dist/_internal/server/features/digital-code/adapters.d.ts +21 -0
- package/dist/_internal/server/features/digital-code/adapters.js +29 -0
- package/dist/_internal/server/features/digital-code/index.d.ts +3 -0
- package/dist/_internal/server/features/digital-code/index.js +3 -0
- package/dist/_internal/server/features/digital-code/metadata.d.ts +8 -0
- package/dist/_internal/server/features/digital-code/metadata.js +36 -0
- package/dist/_internal/server/features/digital-code/og.d.ts +27 -0
- package/dist/_internal/server/features/digital-code/og.js +77 -0
- package/dist/_internal/server/features/live/adapters.d.ts +21 -0
- package/dist/_internal/server/features/live/adapters.js +34 -0
- package/dist/_internal/server/features/live/index.d.ts +3 -0
- package/dist/_internal/server/features/live/index.js +3 -0
- package/dist/_internal/server/features/live/metadata.d.ts +8 -0
- package/dist/_internal/server/features/live/metadata.js +39 -0
- package/dist/_internal/server/features/live/og.d.ts +27 -0
- package/dist/_internal/server/features/live/og.js +72 -0
- package/dist/_internal/server/features/promotions/actions.js +4 -3
- package/dist/_internal/server/jobs/core/onOrderCreate.js +19 -16
- package/dist/_internal/server/jobs/core/onOrderStatusChange.js +25 -22
- package/dist/_internal/server/jobs/core/onProductWrite.js +48 -58
- package/dist/_internal/shared/actions/action-registry.js +504 -9
- package/dist/_internal/shared/features/blog/schema.d.ts +4 -4
- package/dist/_internal/shared/features/brands/schema.d.ts +5 -5
- package/dist/_internal/shared/features/cart/schema.d.ts +18 -18
- package/dist/_internal/shared/features/categories/bundle-copy.d.ts +1 -1
- package/dist/_internal/shared/features/categories/bundle-schemas.d.ts +38 -38
- package/dist/_internal/shared/features/events/schema.d.ts +8 -8
- package/dist/_internal/shared/features/orders/schema.d.ts +8 -8
- package/dist/_internal/shared/features/products/schema.d.ts +42 -42
- package/dist/_internal/shared/features/promotions/schema.d.ts +4 -4
- package/dist/_internal/shared/features/reviews/schema.d.ts +1 -1
- package/dist/_internal/shared/media/limits.js +4 -3
- package/dist/client.d.ts +4 -0
- package/dist/client.js +2 -0
- package/dist/configs/next.js +4 -0
- package/dist/constants/api-endpoints.d.ts +6 -0
- package/dist/constants/api-endpoints.js +2 -0
- package/dist/constants/field-names.d.ts +1 -0
- package/dist/constants/field-names.js +1 -0
- package/dist/constants/table-keys.d.ts +6 -0
- package/dist/constants/table-keys.js +9 -0
- package/dist/core/hooks/useSyncManager.js +9 -8
- package/dist/features/about/components/FeesView.js +10 -7
- package/dist/features/about/components/HelpPageView.js +10 -1
- package/dist/features/about/components/HowAuctionsWorkView.js +10 -1
- package/dist/features/about/components/HowCheckoutWorksView.js +10 -1
- package/dist/features/about/components/HowOffersWorkView.js +10 -1
- package/dist/features/about/components/HowOrdersWorkView.js +10 -1
- package/dist/features/about/components/HowPayoutsWorkView.js +10 -1
- package/dist/features/about/components/HowPreOrdersWorkView.js +10 -1
- package/dist/features/about/components/HowReviewsWorkView.js +10 -1
- package/dist/features/about/components/PublicProfileView.js +46 -16
- package/dist/features/about/components/SecurityPrivacyView.js +7 -1
- package/dist/features/account/components/AddressesIndexListing.js +2 -2
- package/dist/features/account/components/NotificationBell.js +27 -16
- package/dist/features/account/components/NotificationPreferencesPanel.d.ts +9 -0
- package/dist/features/account/components/NotificationPreferencesPanel.js +91 -0
- package/dist/features/account/components/UserSidebar.js +4 -4
- package/dist/features/account/components/UserSupportView.js +16 -6
- package/dist/features/account/components/index.d.ts +2 -0
- package/dist/features/account/components/index.js +1 -0
- package/dist/features/account/schemas/index.d.ts +4 -4
- package/dist/features/account/types/index.d.ts +34 -0
- package/dist/features/admin/actions/admin-actions.js +4 -3
- package/dist/features/admin/actions/notification-actions.d.ts +24 -22
- package/dist/features/admin/actions/notification-actions.js +122 -22
- package/dist/features/admin/components/AdminAdEditorView.js +29 -15
- package/dist/features/admin/components/AdminAddressEditorView.d.ts +7 -0
- package/dist/features/admin/components/AdminAddressEditorView.js +117 -0
- package/dist/features/admin/components/AdminAdsView.js +22 -28
- package/dist/features/admin/components/AdminAllEventEntriesView.js +6 -1
- package/dist/features/admin/components/AdminBidsView.js +10 -3
- package/dist/features/admin/components/AdminBlogEditorView.js +2 -2
- package/dist/features/admin/components/AdminBlogView.js +8 -3
- package/dist/features/admin/components/AdminBrandsView.js +7 -2
- package/dist/features/admin/components/AdminBundleEditorView.js +5 -2
- package/dist/features/admin/components/AdminCarouselEditorView.js +6 -3
- package/dist/features/admin/components/AdminCarouselView.js +13 -7
- package/dist/features/admin/components/AdminCategoriesView.js +8 -3
- package/dist/features/admin/components/AdminCategoryEditorView.js +12 -9
- package/dist/features/admin/components/AdminContactView.js +6 -1
- package/dist/features/admin/components/AdminCouponEditorView.js +8 -2
- package/dist/features/admin/components/AdminCouponsView.js +6 -1
- package/dist/features/admin/components/AdminEmployeeEditorView.js +12 -9
- package/dist/features/admin/components/AdminFaqEditorView.js +2 -2
- package/dist/features/admin/components/AdminFaqsView.js +7 -2
- package/dist/features/admin/components/AdminFeatureFlagsView.js +58 -13
- package/dist/features/admin/components/AdminFeaturesView.js +4 -3
- package/dist/features/admin/components/AdminMediaView.js +9 -8
- package/dist/features/admin/components/AdminNavigationView.js +10 -17
- package/dist/features/admin/components/AdminNewsletterView.js +6 -1
- package/dist/features/admin/components/AdminNotificationsView.js +11 -3
- package/dist/features/admin/components/AdminOrdersView.js +6 -1
- package/dist/features/admin/components/AdminPayoutsView.js +10 -3
- package/dist/features/admin/components/AdminPrizeDrawsView.js +10 -3
- package/dist/features/admin/components/AdminProductEditorView.d.ts +3 -1
- package/dist/features/admin/components/AdminProductEditorView.js +12 -9
- package/dist/features/admin/components/AdminProductsView.js +18 -12
- package/dist/features/admin/components/AdminReturnRequestsView.js +5 -4
- package/dist/features/admin/components/AdminReviewsView.js +36 -26
- package/dist/features/admin/components/AdminScammerEditorView.js +3 -2
- package/dist/features/admin/components/AdminScammersView.js +28 -26
- package/dist/features/admin/components/AdminSectionsView.js +112 -99
- package/dist/features/admin/components/AdminSessionsView.js +10 -3
- package/dist/features/admin/components/AdminSidebar.js +4 -4
- package/dist/features/admin/components/AdminSiteSettingsView.js +45 -4
- package/dist/features/admin/components/AdminStoresView.js +6 -1
- package/dist/features/admin/components/AdminSublistingCategoriesView.js +0 -1
- package/dist/features/admin/components/AdminSupportTicketDetailView.js +1 -1
- package/dist/features/admin/components/AdminSupportTicketsView.js +32 -34
- package/dist/features/admin/components/AdminTeamView.js +6 -1
- package/dist/features/admin/components/AdminUserEditorView.js +8 -15
- package/dist/features/admin/components/AdminUsersView.js +6 -1
- package/dist/features/admin/components/AdminViewCards.js +4 -3
- package/dist/features/admin/components/DashboardStats.js +2 -2
- package/dist/features/admin/components/DataTable.js +2 -2
- package/dist/features/admin/components/index.d.ts +2 -0
- package/dist/features/admin/components/index.js +1 -0
- package/dist/features/admin/components/sections/adminSectionsTypes.js +4 -3
- package/dist/features/admin/repository/chat.repository.js +8 -8
- package/dist/features/admin/repository/site-settings.repository.d.ts +1 -0
- package/dist/features/admin/repository/site-settings.repository.js +11 -9
- package/dist/features/admin/schemas/firestore.d.ts +38 -0
- package/dist/features/admin/schemas/firestore.js +15 -0
- package/dist/features/auctions/components/AuctionBidsTable.d.ts +13 -0
- package/dist/features/auctions/components/AuctionBidsTable.js +62 -0
- package/dist/features/auctions/components/AuctionDetailPageView.js +15 -21
- package/dist/features/auctions/components/AuctionFilters.d.ts +7 -1
- package/dist/features/auctions/components/AuctionFilters.js +3 -2
- package/dist/features/auctions/components/MarketplaceAuctionCard.js +18 -9
- package/dist/features/auctions/components/MarketplaceAuctionGrid.js +3 -2
- package/dist/features/auctions/components/index.d.ts +2 -1
- package/dist/features/auctions/components/index.js +1 -1
- package/dist/features/auctions/schemas/index.d.ts +14 -14
- package/dist/features/auth/actions/realtime-token-actions.js +19 -4
- package/dist/features/auth/components/RegisterForm.js +8 -4
- package/dist/features/auth/consent-otp.d.ts +2 -0
- package/dist/features/auth/consent-otp.js +8 -0
- package/dist/features/auth/schemas/firestore.d.ts +2 -0
- package/dist/features/auth/schemas/firestore.js +18 -25
- package/dist/features/auth/schemas/index.d.ts +2 -2
- package/dist/features/before-after/api/[id]/route.js +8 -6
- package/dist/features/before-after/schemas/index.d.ts +2 -2
- package/dist/features/blog/actions/blog-actions.d.ts +3 -3
- package/dist/features/blog/components/BlogIndexListing.js +21 -2
- package/dist/features/blog/components/BlogPostForm.js +11 -5
- package/dist/features/blog/components/BlogPostView.js +10 -2
- package/dist/features/blog/schemas/index.d.ts +18 -18
- package/dist/features/cart/components/CartDrawer.js +3 -2
- package/dist/features/cart/components/CartView.js +2 -1
- package/dist/features/cart/components/CheckoutView.js +2 -1
- package/dist/features/cart/repository/cart.repository.js +4 -3
- package/dist/features/cart/utils/pending-ops.d.ts +1 -1
- package/dist/features/categories/api/[id]/route.js +4 -3
- package/dist/features/categories/api/route.js +4 -3
- package/dist/features/categories/components/BrandDetailPageView.js +2 -2
- package/dist/features/categories/components/BrandDetailTabs.d.ts +5 -1
- package/dist/features/categories/components/BrandDetailTabs.js +30 -16
- package/dist/features/categories/components/BundleCollage.d.ts +8 -0
- package/dist/features/categories/components/BundleCollage.js +50 -0
- package/dist/features/categories/components/BundleDetailView.js +2 -10
- package/dist/features/categories/components/BundleItemsPicker.js +20 -13
- package/dist/features/categories/components/CategoriesIndexListing.js +28 -9
- package/dist/features/categories/components/CategoryDetailPageView.js +2 -2
- package/dist/features/categories/components/CategoryDetailTabs.d.ts +5 -1
- package/dist/features/categories/components/CategoryDetailTabs.js +31 -16
- package/dist/features/categories/components/CategoryProductsListing.js +52 -13
- package/dist/features/categories/components/index.d.ts +2 -0
- package/dist/features/categories/components/index.js +1 -0
- package/dist/features/categories/schemas/index.d.ts +6 -6
- package/dist/features/checkout/actions/checkout-actions.js +4 -3
- package/dist/features/checkout/hooks/usePaymentCheckout.js +31 -22
- package/dist/features/classified/components/ClassifiedFilters.d.ts +12 -0
- package/dist/features/classified/components/ClassifiedFilters.js +20 -0
- package/dist/features/classified/components/ClassifiedIndexListing.d.ts +4 -0
- package/dist/features/classified/components/ClassifiedIndexListing.js +110 -0
- package/dist/features/classified/components/ClassifiedListView.d.ts +6 -0
- package/dist/features/classified/components/ClassifiedListView.js +43 -0
- package/dist/features/classified/components/index.d.ts +6 -0
- package/dist/features/classified/components/index.js +3 -0
- package/dist/features/collections/api/[slug]/route.js +16 -12
- package/dist/features/collections/schemas/index.d.ts +5 -5
- package/dist/features/consultation/api/[id]/route.js +12 -9
- package/dist/features/consultation/components/ConsultationForm.js +3 -2
- package/dist/features/consultation/schemas/index.d.ts +6 -6
- package/dist/features/contact/email.js +77 -116
- package/dist/features/copilot/components/AdminCopilotView.js +12 -2
- package/dist/features/corporate/api/[id]/route.js +12 -9
- package/dist/features/corporate/components/CorporateInquiryForm.js +2 -1
- package/dist/features/digital-codes/components/DigitalCodeFilters.d.ts +12 -0
- package/dist/features/digital-codes/components/DigitalCodeFilters.js +17 -0
- package/dist/features/digital-codes/components/DigitalCodesIndexListing.d.ts +4 -0
- package/dist/features/digital-codes/components/DigitalCodesIndexListing.js +107 -0
- package/dist/features/digital-codes/components/DigitalCodesListView.d.ts +6 -0
- package/dist/features/digital-codes/components/DigitalCodesListView.js +37 -0
- package/dist/features/digital-codes/components/index.d.ts +6 -0
- package/dist/features/digital-codes/components/index.js +3 -0
- package/dist/features/events/actions/event-actions.js +4 -3
- package/dist/features/events/components/AdminEventEditorView.js +3 -2
- package/dist/features/events/components/AdminEventsView.js +4 -2
- package/dist/features/events/components/EventPollWidget.js +5 -5
- package/dist/features/events/components/EventsIndexListing.js +2 -2
- package/dist/features/events/repository/event-entry.repository.d.ts +1 -0
- package/dist/features/events/repository/event-entry.repository.js +5 -0
- package/dist/features/events/schemas/index.d.ts +20 -20
- package/dist/features/faq/actions/faq-actions.d.ts +8 -8
- package/dist/features/faq/components/ContactCTA.js +3 -1
- package/dist/features/faq/components/FAQAccordion.js +1 -1
- package/dist/features/faq/schemas/index.d.ts +4 -4
- package/dist/features/filters/AsyncFacetSection.d.ts +18 -0
- package/dist/features/filters/AsyncFacetSection.js +65 -0
- package/dist/features/filters/index.d.ts +2 -0
- package/dist/features/filters/index.js +1 -0
- package/dist/features/forms/Checkbox.js +2 -2
- package/dist/features/forms/Input.js +2 -2
- package/dist/features/forms/Radio.js +5 -5
- package/dist/features/forms/Select.js +2 -2
- package/dist/features/forms/Slider.js +2 -2
- package/dist/features/forms/Textarea.js +2 -2
- package/dist/features/homepage/api/[id]/route.js +4 -3
- package/dist/features/homepage/api/sections/[id]/route.js +12 -9
- package/dist/features/homepage/components/AdSlot.js +2 -1
- package/dist/features/homepage/components/AdvertisementBanner.js +5 -3
- package/dist/features/homepage/components/BrandsSection.js +2 -2
- package/dist/features/homepage/components/CTABannerSection.js +2 -2
- package/dist/features/homepage/components/CharacterHotspot.d.ts +2 -2
- package/dist/features/homepage/components/CharacterHotspot.js +119 -157
- package/dist/features/homepage/components/CharacterHotspotForm.js +25 -20
- package/dist/features/homepage/components/CustomCardsSection.js +8 -6
- package/dist/features/homepage/components/FeaturedProductsSection.js +2 -2
- package/dist/features/homepage/components/GoogleReviewsSection.js +3 -3
- package/dist/features/homepage/components/HeroBanner.js +5 -4
- package/dist/features/homepage/components/HeroCarousel.js +13 -26
- package/dist/features/homepage/components/HowItWorksSection.js +4 -2
- package/dist/features/homepage/components/SocialFeedSection.js +2 -2
- package/dist/features/homepage/components/SocialPostCard.js +3 -2
- package/dist/features/homepage/lib/social-feed-fetcher.js +6 -3
- package/dist/features/layout/AppLayoutShell.d.ts +8 -2
- package/dist/features/layout/AppLayoutShell.js +54 -78
- package/dist/features/layout/BottomActions.js +43 -48
- package/dist/features/live/components/LiveItemFilters.d.ts +12 -0
- package/dist/features/live/components/LiveItemFilters.js +24 -0
- package/dist/features/live/components/LiveItemsIndexListing.d.ts +4 -0
- package/dist/features/live/components/LiveItemsIndexListing.js +108 -0
- package/dist/features/live/components/LiveItemsListView.d.ts +6 -0
- package/dist/features/live/components/LiveItemsListView.js +43 -0
- package/dist/features/live/components/index.d.ts +6 -0
- package/dist/features/live/components/index.js +3 -0
- package/dist/features/media/MediaLightbox.js +8 -14
- package/dist/features/media/types/index.d.ts +2 -2
- package/dist/features/media/upload/CameraCapture.js +2 -2
- package/dist/features/media/upload/ImageUpload.js +4 -2
- package/dist/features/media/upload/MediaUploadField.js +24 -8
- package/dist/features/media/upload/MediaUploadList.js +1 -1
- package/dist/features/orders/actions/order-actions.js +4 -3
- package/dist/features/orders/components/MarketplaceOrderCard.js +2 -1
- package/dist/features/orders/components/OrderFilters.js +12 -9
- package/dist/features/orders/schemas/index.d.ts +6 -6
- package/dist/features/pre-orders/api/[id]/route.js +12 -9
- package/dist/features/pre-orders/components/MarketplacePreorderCard.js +5 -4
- package/dist/features/pre-orders/components/PreOrderDetailPageView.js +29 -22
- package/dist/features/pre-orders/components/PreOrderFilters.d.ts +7 -1
- package/dist/features/pre-orders/components/PreOrderFilters.js +3 -2
- package/dist/features/pre-orders/components/PreOrdersIndexListing.js +17 -52
- package/dist/features/pre-orders/components/PreorderCard.d.ts +0 -9
- package/dist/features/pre-orders/components/PreorderCard.js +2 -13
- package/dist/features/pre-orders/components/index.d.ts +1 -1
- package/dist/features/pre-orders/components/index.js +1 -1
- package/dist/features/pre-orders/schemas/index.d.ts +10 -10
- package/dist/features/products/api/[id]/route.js +9 -7
- package/dist/features/products/api/route.js +1 -1
- package/dist/features/products/columns/productTableColumns.js +3 -3
- package/dist/features/products/components/AuctionsIndexListing.js +15 -51
- package/dist/features/products/components/BidHistory.js +2 -2
- package/dist/features/products/components/CompareOverlay.d.ts +2 -0
- package/dist/features/products/components/CompareOverlay.js +3 -2
- package/dist/features/products/components/MakeOfferButton.js +20 -14
- package/dist/features/products/components/MarketplacePrizeDrawCard.js +2 -1
- package/dist/features/products/components/PrizeDrawCollage.d.ts +1 -15
- package/dist/features/products/components/PrizeDrawCollage.js +54 -14
- package/dist/features/products/components/PrizeDrawDetailPageView.js +2 -1
- package/dist/features/products/components/PrizeDrawEntryActions.js +2 -1
- package/dist/features/products/components/PrizeDrawItemsEditor.js +9 -7
- package/dist/features/products/components/PrizeDrawsIndexListing.js +18 -51
- package/dist/features/products/components/PrizeRevealModal.js +24 -14
- package/dist/features/products/components/ProductDetailPageView.js +2 -1
- package/dist/features/products/components/ProductFilters.d.ts +7 -1
- package/dist/features/products/components/ProductFilters.js +11 -8
- package/dist/features/products/components/ProductForm.js +18 -16
- package/dist/features/products/components/ProductGalleryClient.js +2 -1
- package/dist/features/products/components/ProductGrid.js +12 -15
- package/dist/features/products/components/ProductsIndexListing.js +16 -52
- package/dist/features/products/components/ProductsIndexPageView.js +2 -2
- package/dist/features/products/repository/products.repository.d.ts +4 -0
- package/dist/features/products/repository/products.repository.js +22 -3
- package/dist/features/products/schemas/firestore.d.ts +7 -1
- package/dist/features/products/schemas/index.d.ts +56 -56
- package/dist/features/products/schemas/product-features.validators.d.ts +14 -14
- package/dist/features/products/types/index.d.ts +4 -0
- package/dist/features/promotions/components/CouponsIndexListing.js +1 -1
- package/dist/features/promotions/schemas/index.d.ts +6 -6
- package/dist/features/reviews/actions/review-actions.js +6 -5
- package/dist/features/reviews/api/[id]/route.js +4 -3
- package/dist/features/reviews/components/ReviewDetailPageView.js +2 -2
- package/dist/features/reviews/components/ReviewDetailShell.js +6 -3
- package/dist/features/reviews/components/ReviewsIndexListing.js +2 -2
- package/dist/features/reviews/schemas/index.d.ts +6 -6
- package/dist/features/scams/components/ScamProfileView.js +19 -10
- package/dist/features/scams/components/ScamRegistryView.js +2 -1
- package/dist/features/search/components/Search.d.ts +1 -1
- package/dist/features/search/components/Search.js +56 -49
- package/dist/features/search/schemas/index.d.ts +5 -5
- package/dist/features/seller/actions/offer-actions.js +11 -9
- package/dist/features/seller/components/SellerAddressesView.js +6 -4
- package/dist/features/seller/components/SellerBidsView.js +2 -2
- package/dist/features/seller/components/SellerCouponsView.js +1 -1
- package/dist/features/seller/components/SellerOffersPanel.js +6 -1
- package/dist/features/seller/components/SellerOrdersView.js +1 -1
- package/dist/features/seller/components/SellerPayoutSettingsView.js +3 -3
- package/dist/features/seller/components/SellerPreOrdersView.js +5 -4
- package/dist/features/seller/components/SellerPrizeDrawsView.js +5 -4
- package/dist/features/seller/components/SellerProductShell.d.ts +19 -1
- package/dist/features/seller/components/SellerProductShell.js +75 -9
- package/dist/features/seller/components/SellerProductsView.js +10 -11
- package/dist/features/seller/components/SellerShippingView.js +3 -3
- package/dist/features/seller/components/SellerSidebar.js +10 -7
- package/dist/features/seller/components/SellerStorefrontView.js +3 -3
- package/dist/features/seller/schemas/index.d.ts +4 -4
- package/dist/features/shell/FormShell.js +2 -1
- package/dist/features/shell/QuickFormDrawer.js +4 -3
- package/dist/features/shell/StepForm.js +4 -3
- package/dist/features/stores/actions/store-query-actions.js +4 -3
- package/dist/features/stores/components/StoreAboutView.js +2 -1
- package/dist/features/stores/components/StoreAuctionsListing.js +43 -64
- package/dist/features/stores/components/StoreDetailLayoutView.js +18 -4
- package/dist/features/stores/components/StorePreOrdersListing.js +33 -57
- package/dist/features/stores/components/StoreProductsListing.js +16 -49
- package/dist/features/stores/components/StoresIndexListing.js +2 -2
- package/dist/features/stores/schemas/index.d.ts +2 -2
- package/dist/features/whatsapp-bot/components/SellerWhatsAppSettingsView.js +8 -7
- package/dist/features/wishlist/hooks/useGuestWishlist.d.ts +5 -5
- package/dist/features/wishlist/hooks/useWishlistWithGuest.d.ts +6 -6
- package/dist/features/wishlist/utils/guest-wishlist.d.ts +5 -5
- package/dist/index.d.ts +27 -3
- package/dist/index.js +1743 -1725
- package/dist/monitoring/server-logger.js +5 -9
- package/dist/next/api/apiHandler.js +56 -37
- package/dist/next/components/GlobalError.js +2 -1
- package/dist/next/routing/route-map.d.ts +41 -0
- package/dist/next/routing/route-map.js +17 -0
- package/dist/react/ErrorBoundary.js +2 -1
- package/dist/react/contexts/SessionContext.js +38 -28
- package/dist/react/hooks/useCamera.d.ts +1 -1
- package/dist/react/hooks/useCamera.js +8 -7
- package/dist/seed/products-auctions-seed-data.js +40 -40
- package/dist/seed/products-preorders-seed-data.js +16 -16
- package/dist/seed/products-prize-draws-seed-data.js +4 -4
- package/dist/seed/products-standard-seed-data.js +202 -202
- package/dist/seed/site-settings-seed-data.js +6 -0
- package/dist/server-entry.d.ts +3 -0
- package/dist/server-entry.js +3 -0
- package/dist/server.d.ts +12 -0
- package/dist/server.js +15 -0
- package/dist/tailwind-utilities.css +1 -1
- package/dist/ui/DataTable.js +28 -7
- package/dist/ui/components/Button.d.ts +8 -1
- package/dist/ui/components/Button.js +47 -8
- package/dist/ui/components/CollageLightbox.d.ts +18 -0
- package/dist/ui/components/CollageLightbox.js +41 -0
- package/dist/ui/components/Dropdown.js +7 -6
- package/dist/ui/components/ImageLightbox.d.ts +7 -1
- package/dist/ui/components/ImageLightbox.js +15 -5
- package/dist/ui/components/PageLoader.js +4 -3
- package/dist/ui/components/PaginatedMultiSelect.d.ts +28 -0
- package/dist/ui/components/PaginatedMultiSelect.js +141 -0
- package/dist/ui/components/PaginatedMultiSelect.style.css +272 -0
- package/dist/ui/components/Semantic.js +1 -1
- package/dist/ui/components/SideDrawer.js +17 -15
- package/dist/ui/components/index.style.css +1 -0
- package/dist/ui/index.d.ts +2 -0
- package/dist/ui/index.js +1 -0
- package/dist/utils/number.formatter.js +5 -13
- package/dist/utils/string.formatter.js +21 -18
- package/dist/validation/schemas.d.ts +2 -2
- package/package.json +1 -1
|
@@ -16,15 +16,11 @@ import { AppError } from "../errors";
|
|
|
16
16
|
// Using require() calls inside functions keeps the imports out of the static
|
|
17
17
|
// analysis graph and prevents Edge Runtime warnings.
|
|
18
18
|
/* eslint-disable @typescript-eslint/no-require-imports */
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
function nodeFs() {
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
function nodePath() {
|
|
26
|
-
return require("path");
|
|
27
|
-
}
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
20
|
+
function nodeRequire(id) { return require(id); }
|
|
21
|
+
function nodeFsPromises() { return nodeRequire("fs/promises"); }
|
|
22
|
+
function nodeFs() { return nodeRequire("fs"); }
|
|
23
|
+
function nodePath() { return nodeRequire("path"); }
|
|
28
24
|
// process.cwd() is a Node.js-only API. Access it through module.require so
|
|
29
25
|
// Next.js Edge static analysis does not flag this file.
|
|
30
26
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -1,9 +1,56 @@
|
|
|
1
|
+
async function validateSchema(request, schema) {
|
|
2
|
+
if (typeof schema.safeParse === "function") {
|
|
3
|
+
const body = await request.json();
|
|
4
|
+
const result = schema.safeParse(body);
|
|
5
|
+
if (!result.success) {
|
|
6
|
+
return { validationError: true, issues: result.error.issues };
|
|
7
|
+
}
|
|
8
|
+
return { validationError: false, data: result.data };
|
|
9
|
+
}
|
|
10
|
+
try {
|
|
11
|
+
const data = (await request.json());
|
|
12
|
+
return { validationError: false, data };
|
|
13
|
+
}
|
|
14
|
+
catch {
|
|
15
|
+
return { validationError: false, data: undefined };
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
function buildRateLimitHeaders(result) {
|
|
19
|
+
return {
|
|
20
|
+
"RateLimit-Limit": String(result.limit),
|
|
21
|
+
"RateLimit-Remaining": String(result.remaining),
|
|
22
|
+
"RateLimit-Reset": String(result.reset),
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function buildRateLimitExceededResponse(message, headers) {
|
|
26
|
+
return new Response(JSON.stringify({ success: false, error: message }), { status: 429, headers: { "Content-Type": "application/json", ...headers } });
|
|
27
|
+
}
|
|
28
|
+
function applyRateLimitHeaders(response, headers) {
|
|
29
|
+
for (const [key, value] of Object.entries(headers)) {
|
|
30
|
+
response.headers.set(key, value);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
1
33
|
function buildPublicCacheControl(policy) {
|
|
2
34
|
const maxAge = policy?.maxAge ?? 30;
|
|
3
35
|
const sMaxAge = policy?.sMaxAge ?? 300;
|
|
4
36
|
const staleWhileRevalidate = policy?.staleWhileRevalidate ?? 600;
|
|
5
37
|
return `public, max-age=${maxAge}, s-maxage=${sMaxAge}, stale-while-revalidate=${staleWhileRevalidate}`;
|
|
6
38
|
}
|
|
39
|
+
async function applyRateLimitCheck(request, config, applyRateLimit, getRateLimitExceededMessage) {
|
|
40
|
+
const result = await applyRateLimit(request, config);
|
|
41
|
+
const headers = buildRateLimitHeaders(result);
|
|
42
|
+
if (!result.success) {
|
|
43
|
+
return { blocked: true, response: buildRateLimitExceededResponse(getRateLimitExceededMessage(), headers) };
|
|
44
|
+
}
|
|
45
|
+
return { blocked: false, headers };
|
|
46
|
+
}
|
|
47
|
+
async function applySchemaValidation(request, schema, errorResponse) {
|
|
48
|
+
const schemaResult = await validateSchema(request, schema);
|
|
49
|
+
if (schemaResult.validationError) {
|
|
50
|
+
return { invalid: true, response: errorResponse("Validation failed", 400, schemaResult.issues) };
|
|
51
|
+
}
|
|
52
|
+
return { invalid: false, data: schemaResult.data };
|
|
53
|
+
}
|
|
7
54
|
export function createApiHandlerFactory(deps) {
|
|
8
55
|
return function createApiHandler(options) {
|
|
9
56
|
return async (request, context) => {
|
|
@@ -11,24 +58,10 @@ export function createApiHandlerFactory(deps) {
|
|
|
11
58
|
try {
|
|
12
59
|
let rateLimitHeaders;
|
|
13
60
|
if (options.rateLimit) {
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"RateLimit-Reset": String(rateLimitResult.reset),
|
|
19
|
-
};
|
|
20
|
-
if (!rateLimitResult.success) {
|
|
21
|
-
return new Response(JSON.stringify({
|
|
22
|
-
success: false,
|
|
23
|
-
error: deps.getRateLimitExceededMessage(),
|
|
24
|
-
}), {
|
|
25
|
-
status: 429,
|
|
26
|
-
headers: {
|
|
27
|
-
"Content-Type": "application/json",
|
|
28
|
-
...rateLimitHeaders,
|
|
29
|
-
},
|
|
30
|
-
});
|
|
31
|
-
}
|
|
61
|
+
const rlCheck = await applyRateLimitCheck(request, options.rateLimit, deps.applyRateLimit, deps.getRateLimitExceededMessage);
|
|
62
|
+
if (rlCheck.blocked)
|
|
63
|
+
return rlCheck.response;
|
|
64
|
+
rateLimitHeaders = rlCheck.headers;
|
|
32
65
|
}
|
|
33
66
|
let user;
|
|
34
67
|
if (options.roles && options.roles.length > 0) {
|
|
@@ -39,22 +72,10 @@ export function createApiHandlerFactory(deps) {
|
|
|
39
72
|
}
|
|
40
73
|
let validatedBody;
|
|
41
74
|
if (options.schema) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
return deps.errorResponse("Validation failed", 400, result.error.issues);
|
|
47
|
-
}
|
|
48
|
-
validatedBody = result.data;
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
try {
|
|
52
|
-
validatedBody = (await request.json());
|
|
53
|
-
}
|
|
54
|
-
catch {
|
|
55
|
-
validatedBody = undefined;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
75
|
+
const schemaCheck = await applySchemaValidation(request, options.schema, deps.errorResponse);
|
|
76
|
+
if (schemaCheck.invalid)
|
|
77
|
+
return schemaCheck.response;
|
|
78
|
+
validatedBody = schemaCheck.data;
|
|
58
79
|
}
|
|
59
80
|
const resolvedParams = context?.params
|
|
60
81
|
? await context.params
|
|
@@ -67,9 +88,7 @@ export function createApiHandlerFactory(deps) {
|
|
|
67
88
|
});
|
|
68
89
|
response.headers.set("Access-Control-Max-Age", "86400");
|
|
69
90
|
if (rateLimitHeaders) {
|
|
70
|
-
|
|
71
|
-
response.headers.set(key, value);
|
|
72
|
-
}
|
|
91
|
+
applyRateLimitHeaders(response, rateLimitHeaders);
|
|
73
92
|
}
|
|
74
93
|
const hasCredentialHeaders = !!request.headers.get("authorization") || !!request.headers.get("cookie");
|
|
75
94
|
const hasRoleGuards = !!options.roles && options.roles.length > 0;
|
|
@@ -12,6 +12,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
12
12
|
* export { GlobalError as default } from "@mohasinac/appkit/next";
|
|
13
13
|
*/
|
|
14
14
|
import { useEffect } from "react";
|
|
15
|
+
import { Heading, Text } from "../../ui";
|
|
15
16
|
import { trackError, ErrorCategory, ErrorSeverity, } from "../../monitoring/error-tracking";
|
|
16
17
|
export function GlobalError({ error, reset }) {
|
|
17
18
|
useEffect(() => {
|
|
@@ -30,7 +31,7 @@ export function GlobalError({ error, reset }) {
|
|
|
30
31
|
fontFamily: "system-ui, sans-serif",
|
|
31
32
|
padding: "2rem",
|
|
32
33
|
textAlign: "center",
|
|
33
|
-
}, children: [_jsx(
|
|
34
|
+
}, children: [_jsx(Heading, { level: 1, style: { fontSize: "2rem", marginBottom: "0.5rem" }, children: "Something went wrong" }), _jsx(Text, { style: { opacity: 0.7, marginBottom: "1.5rem" }, children: "A critical error occurred. We're working on it." }), process.env.NODE_ENV === "development" && (_jsxs("pre", { style: {
|
|
34
35
|
fontSize: "0.75rem",
|
|
35
36
|
padding: "1rem",
|
|
36
37
|
background: "#f3f4f6",
|
|
@@ -126,6 +126,10 @@ export declare const DEFAULT_ROUTE_MAP: {
|
|
|
126
126
|
readonly RETURNS: "/user/returns";
|
|
127
127
|
readonly SUPPORT: "/user/support";
|
|
128
128
|
readonly SUPPORT_TICKET: (id: string) => string;
|
|
129
|
+
readonly PRE_ORDERS: "/user/pre-orders";
|
|
130
|
+
readonly DIGITAL_CODES: "/user/digital-codes";
|
|
131
|
+
readonly PRIZE_DRAWS: "/user/prize-draws";
|
|
132
|
+
readonly EVENTS: "/user/events";
|
|
129
133
|
};
|
|
130
134
|
readonly STORE: {
|
|
131
135
|
readonly DASHBOARD: "/store";
|
|
@@ -170,6 +174,15 @@ export declare const DEFAULT_ROUTE_MAP: {
|
|
|
170
174
|
readonly PRIZE_DRAWS_NEW: "/store/prize-draws/new";
|
|
171
175
|
readonly PRIZE_DRAWS_EDIT: (id: string) => string;
|
|
172
176
|
readonly PRODUCT_CODES: (id: string) => string;
|
|
177
|
+
readonly CLASSIFIED: "/store/classified";
|
|
178
|
+
readonly CLASSIFIED_NEW: "/store/classified/new";
|
|
179
|
+
readonly CLASSIFIED_EDIT: (id: string) => string;
|
|
180
|
+
readonly DIGITAL_CODES: "/store/digital-codes";
|
|
181
|
+
readonly DIGITAL_CODES_NEW: "/store/digital-codes/new";
|
|
182
|
+
readonly DIGITAL_CODES_EDIT: (id: string) => string;
|
|
183
|
+
readonly LIVE_ITEMS: "/store/live";
|
|
184
|
+
readonly LIVE_ITEMS_NEW: "/store/live/new";
|
|
185
|
+
readonly LIVE_ITEMS_EDIT: (id: string) => string;
|
|
173
186
|
};
|
|
174
187
|
readonly ADMIN: {
|
|
175
188
|
readonly DASHBOARD: "/admin/dashboard";
|
|
@@ -229,6 +242,9 @@ export declare const DEFAULT_ROUTE_MAP: {
|
|
|
229
242
|
readonly HISTORY: "/admin/history";
|
|
230
243
|
readonly RETURN_REQUESTS: "/admin/return-requests";
|
|
231
244
|
readonly STORE_ADDRESSES: "/admin/store-addresses";
|
|
245
|
+
readonly ADDRESSES: "/admin/addresses";
|
|
246
|
+
readonly ADDRESSES_NEW: "/admin/addresses/new";
|
|
247
|
+
readonly ADDRESSES_EDIT: (id: string) => string;
|
|
232
248
|
readonly SUBLISTING_CATEGORIES: "/admin/sublisting-categories";
|
|
233
249
|
readonly SUBLISTING_CATEGORIES_NEW: "/admin/sublisting-categories/new";
|
|
234
250
|
readonly SUBLISTING_CATEGORIES_EDIT: (id: string) => string;
|
|
@@ -372,6 +388,10 @@ export declare const ROUTES: {
|
|
|
372
388
|
readonly RETURNS: "/user/returns";
|
|
373
389
|
readonly SUPPORT: "/user/support";
|
|
374
390
|
readonly SUPPORT_TICKET: (id: string) => string;
|
|
391
|
+
readonly PRE_ORDERS: "/user/pre-orders";
|
|
392
|
+
readonly DIGITAL_CODES: "/user/digital-codes";
|
|
393
|
+
readonly PRIZE_DRAWS: "/user/prize-draws";
|
|
394
|
+
readonly EVENTS: "/user/events";
|
|
375
395
|
};
|
|
376
396
|
readonly STORE: {
|
|
377
397
|
readonly DASHBOARD: "/store";
|
|
@@ -416,6 +436,15 @@ export declare const ROUTES: {
|
|
|
416
436
|
readonly PRIZE_DRAWS_NEW: "/store/prize-draws/new";
|
|
417
437
|
readonly PRIZE_DRAWS_EDIT: (id: string) => string;
|
|
418
438
|
readonly PRODUCT_CODES: (id: string) => string;
|
|
439
|
+
readonly CLASSIFIED: "/store/classified";
|
|
440
|
+
readonly CLASSIFIED_NEW: "/store/classified/new";
|
|
441
|
+
readonly CLASSIFIED_EDIT: (id: string) => string;
|
|
442
|
+
readonly DIGITAL_CODES: "/store/digital-codes";
|
|
443
|
+
readonly DIGITAL_CODES_NEW: "/store/digital-codes/new";
|
|
444
|
+
readonly DIGITAL_CODES_EDIT: (id: string) => string;
|
|
445
|
+
readonly LIVE_ITEMS: "/store/live";
|
|
446
|
+
readonly LIVE_ITEMS_NEW: "/store/live/new";
|
|
447
|
+
readonly LIVE_ITEMS_EDIT: (id: string) => string;
|
|
419
448
|
};
|
|
420
449
|
readonly ADMIN: {
|
|
421
450
|
readonly DASHBOARD: "/admin/dashboard";
|
|
@@ -475,6 +504,9 @@ export declare const ROUTES: {
|
|
|
475
504
|
readonly HISTORY: "/admin/history";
|
|
476
505
|
readonly RETURN_REQUESTS: "/admin/return-requests";
|
|
477
506
|
readonly STORE_ADDRESSES: "/admin/store-addresses";
|
|
507
|
+
readonly ADDRESSES: "/admin/addresses";
|
|
508
|
+
readonly ADDRESSES_NEW: "/admin/addresses/new";
|
|
509
|
+
readonly ADDRESSES_EDIT: (id: string) => string;
|
|
478
510
|
readonly SUBLISTING_CATEGORIES: "/admin/sublisting-categories";
|
|
479
511
|
readonly SUBLISTING_CATEGORIES_NEW: "/admin/sublisting-categories/new";
|
|
480
512
|
readonly SUBLISTING_CATEGORIES_EDIT: (id: string) => string;
|
|
@@ -546,6 +578,15 @@ export declare const SELLER_ROUTES: {
|
|
|
546
578
|
readonly PRIZE_DRAWS_NEW: "/store/prize-draws/new";
|
|
547
579
|
readonly PRIZE_DRAWS_EDIT: (id: string) => string;
|
|
548
580
|
readonly PRODUCT_CODES: (id: string) => string;
|
|
581
|
+
readonly CLASSIFIED: "/store/classified";
|
|
582
|
+
readonly CLASSIFIED_NEW: "/store/classified/new";
|
|
583
|
+
readonly CLASSIFIED_EDIT: (id: string) => string;
|
|
584
|
+
readonly DIGITAL_CODES: "/store/digital-codes";
|
|
585
|
+
readonly DIGITAL_CODES_NEW: "/store/digital-codes/new";
|
|
586
|
+
readonly DIGITAL_CODES_EDIT: (id: string) => string;
|
|
587
|
+
readonly LIVE_ITEMS: "/store/live";
|
|
588
|
+
readonly LIVE_ITEMS_NEW: "/store/live/new";
|
|
589
|
+
readonly LIVE_ITEMS_EDIT: (id: string) => string;
|
|
549
590
|
};
|
|
550
591
|
export declare const PUBLIC_ROUTES: readonly ["/", string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, "/unauthorized", "/auth/login", "/auth/register", "/auth/forgot-password", "/auth/reset-password", "/auth/verify-email"];
|
|
551
592
|
export declare const PROTECTED_ROUTES: readonly [string, string, string, string, string, string, string];
|
|
@@ -114,6 +114,10 @@ export const DEFAULT_ROUTE_MAP = {
|
|
|
114
114
|
RETURNS: "/user/returns",
|
|
115
115
|
SUPPORT: "/user/support",
|
|
116
116
|
SUPPORT_TICKET: (id) => `/user/support/${id}`,
|
|
117
|
+
PRE_ORDERS: "/user/pre-orders",
|
|
118
|
+
DIGITAL_CODES: "/user/digital-codes",
|
|
119
|
+
PRIZE_DRAWS: "/user/prize-draws",
|
|
120
|
+
EVENTS: "/user/events",
|
|
117
121
|
},
|
|
118
122
|
STORE: {
|
|
119
123
|
DASHBOARD: "/store",
|
|
@@ -159,6 +163,16 @@ export const DEFAULT_ROUTE_MAP = {
|
|
|
159
163
|
PRIZE_DRAWS_NEW: "/store/prize-draws/new",
|
|
160
164
|
PRIZE_DRAWS_EDIT: (id) => `/store/prize-draws/${id}/edit`,
|
|
161
165
|
PRODUCT_CODES: (id) => `/store/products/${id}/codes`,
|
|
166
|
+
// SB-UNI-R — classified / digital-code / live
|
|
167
|
+
CLASSIFIED: "/store/classified",
|
|
168
|
+
CLASSIFIED_NEW: "/store/classified/new",
|
|
169
|
+
CLASSIFIED_EDIT: (id) => `/store/classified/${id}/edit`,
|
|
170
|
+
DIGITAL_CODES: "/store/digital-codes",
|
|
171
|
+
DIGITAL_CODES_NEW: "/store/digital-codes/new",
|
|
172
|
+
DIGITAL_CODES_EDIT: (id) => `/store/digital-codes/${id}/edit`,
|
|
173
|
+
LIVE_ITEMS: "/store/live",
|
|
174
|
+
LIVE_ITEMS_NEW: "/store/live/new",
|
|
175
|
+
LIVE_ITEMS_EDIT: (id) => `/store/live/${id}/edit`,
|
|
162
176
|
},
|
|
163
177
|
ADMIN: {
|
|
164
178
|
DASHBOARD: "/admin/dashboard",
|
|
@@ -218,6 +232,9 @@ export const DEFAULT_ROUTE_MAP = {
|
|
|
218
232
|
HISTORY: "/admin/history",
|
|
219
233
|
RETURN_REQUESTS: "/admin/return-requests",
|
|
220
234
|
STORE_ADDRESSES: "/admin/store-addresses",
|
|
235
|
+
ADDRESSES: "/admin/addresses",
|
|
236
|
+
ADDRESSES_NEW: "/admin/addresses/new",
|
|
237
|
+
ADDRESSES_EDIT: (id) => `/admin/addresses/${id}/edit`,
|
|
221
238
|
SUBLISTING_CATEGORIES: "/admin/sublisting-categories",
|
|
222
239
|
SUBLISTING_CATEGORIES_NEW: "/admin/sublisting-categories/new",
|
|
223
240
|
SUBLISTING_CATEGORIES_EDIT: (id) => `/admin/sublisting-categories/${id}/edit`,
|
|
@@ -10,6 +10,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
10
10
|
*/
|
|
11
11
|
import { Component } from "react";
|
|
12
12
|
import { Logger } from "../core/Logger";
|
|
13
|
+
import { Heading, Text } from "../ui";
|
|
13
14
|
import { trackError, ErrorCategory, ErrorSeverity, } from "../monitoring/error-tracking";
|
|
14
15
|
function DefaultFallback({ error, onReset, }) {
|
|
15
16
|
return (_jsxs("div", { role: "alert", style: {
|
|
@@ -20,7 +21,7 @@ function DefaultFallback({ error, onReset, }) {
|
|
|
20
21
|
minHeight: "100vh",
|
|
21
22
|
padding: "2rem",
|
|
22
23
|
textAlign: "center",
|
|
23
|
-
}, "data-section": "errorboundary-div-446", children: [_jsx(
|
|
24
|
+
}, "data-section": "errorboundary-div-446", children: [_jsx(Heading, { level: 1, style: { fontSize: "1.5rem", marginBottom: "0.5rem" }, children: "Something went wrong" }), _jsx(Text, { style: { marginBottom: "1.5rem", opacity: 0.7 }, children: "An unexpected error occurred. Please try again." }), process.env.NODE_ENV === "development" && error && (_jsx("pre", { style: {
|
|
24
25
|
fontSize: "0.75rem",
|
|
25
26
|
padding: "1rem",
|
|
26
27
|
background: "#f3f4f6",
|
|
@@ -230,24 +230,46 @@ export function SessionProvider({ children, initialUser, endpoints: endpointOver
|
|
|
230
230
|
useEffect(() => {
|
|
231
231
|
const adapter = getClientSessionAdapter();
|
|
232
232
|
let authVersion = 0;
|
|
233
|
+
async function tryCreateSession(authUser, version, getVersion) {
|
|
234
|
+
try {
|
|
235
|
+
const idToken = await authUser.getIdToken(true);
|
|
236
|
+
if (version !== getVersion())
|
|
237
|
+
return;
|
|
238
|
+
const data = await apiClient.post(ep.createSession, { idToken });
|
|
239
|
+
if (version !== getVersion())
|
|
240
|
+
return;
|
|
241
|
+
if (data?.sessionId)
|
|
242
|
+
setSessionId(data.sessionId);
|
|
243
|
+
}
|
|
244
|
+
catch (error) {
|
|
245
|
+
logger.error("Session creation failed", { error });
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
async function handleNoAuthUser(version, getVersion) {
|
|
249
|
+
if (!hasSessionCookie())
|
|
250
|
+
return false;
|
|
251
|
+
const serverUser = await fetchUserProfileFromServer();
|
|
252
|
+
if (version !== getVersion())
|
|
253
|
+
return true;
|
|
254
|
+
if (serverUser) {
|
|
255
|
+
setUser(serverUser);
|
|
256
|
+
const sid = getSessionIdFromCookie();
|
|
257
|
+
if (sid)
|
|
258
|
+
setSessionId(sid);
|
|
259
|
+
setLoading(false);
|
|
260
|
+
return true;
|
|
261
|
+
}
|
|
262
|
+
deleteCookie(SESSION_COOKIE);
|
|
263
|
+
deleteCookie(SESSION_ID_COOKIE);
|
|
264
|
+
return false;
|
|
265
|
+
}
|
|
233
266
|
const unsubscribe = adapter.onAuthStateChanged(async (authUser) => {
|
|
234
267
|
const thisVersion = ++authVersion;
|
|
268
|
+
const getVersion = () => authVersion;
|
|
235
269
|
if (authUser) {
|
|
236
270
|
const hasSession = hasSessionCookie();
|
|
237
271
|
if (!hasSession) {
|
|
238
|
-
|
|
239
|
-
const idToken = await authUser.getIdToken(true);
|
|
240
|
-
if (thisVersion !== authVersion)
|
|
241
|
-
return;
|
|
242
|
-
const data = await apiClient.post(ep.createSession, { idToken });
|
|
243
|
-
if (thisVersion !== authVersion)
|
|
244
|
-
return;
|
|
245
|
-
if (data?.sessionId)
|
|
246
|
-
setSessionId(data.sessionId);
|
|
247
|
-
}
|
|
248
|
-
catch (error) {
|
|
249
|
-
logger.error("Session creation failed", { error });
|
|
250
|
-
}
|
|
272
|
+
await tryCreateSession(authUser, thisVersion, getVersion);
|
|
251
273
|
}
|
|
252
274
|
if (thisVersion !== authVersion)
|
|
253
275
|
return;
|
|
@@ -276,21 +298,9 @@ export function SessionProvider({ children, initialUser, endpoints: endpointOver
|
|
|
276
298
|
}
|
|
277
299
|
else {
|
|
278
300
|
// No auth user — try server-session fallback (OAuth flows)
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
return;
|
|
283
|
-
if (serverUser) {
|
|
284
|
-
setUser(serverUser);
|
|
285
|
-
const sid = getSessionIdFromCookie();
|
|
286
|
-
if (sid)
|
|
287
|
-
setSessionId(sid);
|
|
288
|
-
setLoading(false);
|
|
289
|
-
return;
|
|
290
|
-
}
|
|
291
|
-
deleteCookie(SESSION_COOKIE);
|
|
292
|
-
deleteCookie(SESSION_ID_COOKIE);
|
|
293
|
-
}
|
|
301
|
+
const handled = await handleNoAuthUser(thisVersion, getVersion);
|
|
302
|
+
if (handled)
|
|
303
|
+
return;
|
|
294
304
|
setUser(null);
|
|
295
305
|
setSessionId(null);
|
|
296
306
|
if (activityUpdateRef.current) {
|
|
@@ -12,7 +12,7 @@ export interface UseCameraReturn {
|
|
|
12
12
|
videoRef: React.RefObject<HTMLVideoElement | null>;
|
|
13
13
|
startCamera: (options?: UseCameraOptions) => Promise<void>;
|
|
14
14
|
stopCamera: () => void;
|
|
15
|
-
takePhoto: () => Blob | null
|
|
15
|
+
takePhoto: () => Promise<Blob | null>;
|
|
16
16
|
startRecording: () => void;
|
|
17
17
|
stopRecording: () => Promise<Blob>;
|
|
18
18
|
switchCamera: () => Promise<void>;
|
|
@@ -73,22 +73,23 @@ export function useCamera() {
|
|
|
73
73
|
setError(message);
|
|
74
74
|
}
|
|
75
75
|
}, [isSupported, stopCamera]);
|
|
76
|
+
// canvas.toBlob() is async — must return a Promise so the blob is available
|
|
77
|
+
// to the caller after the encoding completes (a synchronous return always
|
|
78
|
+
// gives null because the callback hasn't fired yet).
|
|
76
79
|
const takePhoto = useCallback(() => {
|
|
77
80
|
const video = videoRef.current;
|
|
78
81
|
if (!video || !isActive)
|
|
79
|
-
return null;
|
|
82
|
+
return Promise.resolve(null);
|
|
80
83
|
const canvas = document.createElement("canvas");
|
|
81
84
|
canvas.width = video.videoWidth;
|
|
82
85
|
canvas.height = video.videoHeight;
|
|
83
86
|
const ctx = canvas.getContext("2d");
|
|
84
87
|
if (!ctx)
|
|
85
|
-
return null;
|
|
88
|
+
return Promise.resolve(null);
|
|
86
89
|
ctx.drawImage(video, 0, 0);
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}, "image/webp", 0.92);
|
|
91
|
-
return result;
|
|
90
|
+
return new Promise((resolve) => {
|
|
91
|
+
canvas.toBlob((blob) => resolve(blob), "image/webp", 0.92);
|
|
92
|
+
});
|
|
92
93
|
}, [isActive]);
|
|
93
94
|
const startRecording = useCallback(() => {
|
|
94
95
|
if (!streamRef.current || !isActive)
|