@mohasinac/appkit 2.7.26 → 2.7.30
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/classified/ClassifiedDetailView.js +2 -2
- package/dist/_internal/client/features/digital-code/CodeRevealPanel.js +2 -2
- 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 +310 -8
- 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 +2 -0
- package/dist/client.js +1 -0
- package/dist/configs/next.js +4 -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 +44 -14
- 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/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 +2 -2
- 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/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/AdminProductsView.js +18 -12
- package/dist/features/admin/components/AdminReviewsView.js +33 -24
- 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/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/AuctionDetailPageView.js +13 -19
- 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 +0 -1
- package/dist/features/auctions/components/index.js +0 -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/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.js +2 -2
- 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.js +2 -2
- 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 +8 -0
- package/dist/features/classified/components/ClassifiedFilters.js +19 -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 +8 -0
- package/dist/features/digital-codes/components/DigitalCodeFilters.js +16 -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/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/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 +55 -84
- package/dist/features/layout/BottomActions.js +43 -48
- package/dist/features/layout/NavbarWithSettings.d.ts +6 -0
- package/dist/features/layout/NavbarWithSettings.js +11 -0
- package/dist/features/live/components/LiveItemFilters.d.ts +8 -0
- package/dist/features/live/components/LiveItemFilters.js +23 -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 +27 -20
- 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 +2 -2
- package/dist/features/products/components/AuctionsIndexListing.js +15 -51
- package/dist/features/products/components/BidHistory.js +2 -2
- 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.js +8 -6
- package/dist/features/products/components/ProductForm.js +12 -10
- package/dist/features/products/components/ProductGalleryClient.js +2 -1
- package/dist/features/products/components/ProductGrid.js +11 -14
- package/dist/features/products/components/ProductsIndexListing.js +16 -52
- package/dist/features/products/components/ProductsIndexPageView.js +2 -2
- 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/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 +2 -2
- 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 +21 -3
- package/dist/index.js +1737 -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 +27 -0
- package/dist/next/routing/route-map.js +10 -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/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 +2 -2
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useState } from "react";
|
|
4
4
|
import Link from "next/link";
|
|
5
|
-
import { Badge, Container, Div, Heading, Row, Section, Stack, Text, } from "../../../../ui";
|
|
5
|
+
import { Badge, Button, Container, Div, Heading, Row, Section, Stack, Text, } from "../../../../ui";
|
|
6
6
|
import { ROUTES } from "../../../../next/routing/route-map";
|
|
7
7
|
import { formatCurrency } from "../../../../utils/number.formatter";
|
|
8
8
|
export function ClassifiedDetailView({ product, isLoading = false, onContactSeller, }) {
|
|
@@ -31,5 +31,5 @@ export function ClassifiedDetailView({ product, isLoading = false, onContactSell
|
|
|
31
31
|
setPending(false);
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
return (_jsx(Container, { children: _jsx(Section, { className: "py-8", children: _jsxs(Stack, { gap: "lg", children: [product.images.length > 0 && (_jsx(Div, { className: "overflow-hidden rounded-lg bg-muted", children: _jsx("img", { src: product.mainImage || product.images[0], alt: product.title, className: "h-80 w-full object-contain" }) })), _jsxs(Stack, { gap: "sm", children: [_jsxs(Row, { className: "flex-wrap gap-2", children: [_jsx(Badge, { variant: "secondary", children: "Classified" }), meta?.negotiable && _jsx(Badge, { variant: "secondary", children: "Negotiable" }), meta?.acceptsShipping && _jsx(Badge, { variant: "secondary", children: "Shipping available" })] }), _jsx(Heading, { level: 1, className: "text-2xl font-bold", children: product.title }), _jsx(Text, { className: "text-2xl font-semibold text-primary", children: price }), location && (_jsx(Text, { className: "text-sm text-muted-foreground", children: location })), _jsx(Text, { className: "text-muted-foreground", children: product.description })] }), conversation ? (_jsxs(Div, { className: "rounded-lg border border-border bg-muted/40 p-4", children: [_jsx(Text, { className: "mb-2 font-medium", children: "Conversation started!" }), _jsx(Link, { href: ROUTES.USER.MESSAGES, className: "text-primary underline underline-offset-2", children: "Go to your messages \u2192" })] })) : (_jsxs(Stack, { gap: "sm", children: [error && (_jsx(Text, { className: "text-sm text-destructive", children: error })), _jsx(
|
|
34
|
+
return (_jsx(Container, { children: _jsx(Section, { className: "py-8", children: _jsxs(Stack, { gap: "lg", children: [product.images.length > 0 && (_jsx(Div, { className: "overflow-hidden rounded-lg bg-muted", children: _jsx("img", { src: product.mainImage || product.images[0], alt: product.title, className: "h-80 w-full object-contain" }) })), _jsxs(Stack, { gap: "sm", children: [_jsxs(Row, { className: "flex-wrap gap-2", children: [_jsx(Badge, { variant: "secondary", children: "Classified" }), meta?.negotiable && _jsx(Badge, { variant: "secondary", children: "Negotiable" }), meta?.acceptsShipping && _jsx(Badge, { variant: "secondary", children: "Shipping available" })] }), _jsx(Heading, { level: 1, className: "text-2xl font-bold", children: product.title }), _jsx(Text, { className: "text-2xl font-semibold text-primary", children: price }), location && (_jsx(Text, { className: "text-sm text-muted-foreground", children: location })), _jsx(Text, { className: "text-muted-foreground", children: product.description })] }), conversation ? (_jsxs(Div, { className: "rounded-lg border border-border bg-muted/40 p-4", children: [_jsx(Text, { className: "mb-2 font-medium", children: "Conversation started!" }), _jsx(Link, { href: ROUTES.USER.MESSAGES, className: "text-primary underline underline-offset-2", children: "Go to your messages \u2192" })] })) : (_jsxs(Stack, { gap: "sm", children: [error && (_jsx(Text, { className: "text-sm text-destructive", children: error })), _jsx(Button, { type: "button", variant: "primary", size: "lg", isLoading: pending, disabled: pending, onClick: handleContactSeller, className: "w-full", children: "Contact Seller" })] }))] }) }) }));
|
|
35
35
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useState } from "react";
|
|
4
|
-
import { Div, Stack, Text } from "../../../../ui";
|
|
4
|
+
import { Button, Div, Span, Stack, Text } from "../../../../ui";
|
|
5
5
|
export function CodeRevealPanel({ orderId, redemptionInstructions, fetchCode, }) {
|
|
6
6
|
const [pending, setPending] = useState(false);
|
|
7
7
|
const [revealed, setRevealed] = useState(null);
|
|
@@ -28,5 +28,5 @@ export function CodeRevealPanel({ orderId, redemptionInstructions, fetchCode, })
|
|
|
28
28
|
setCopied(true);
|
|
29
29
|
setTimeout(() => setCopied(false), 2000);
|
|
30
30
|
}
|
|
31
|
-
return (_jsx(Div, { className: "rounded-lg border border-border bg-muted/40 p-4", children: _jsxs(Stack, { gap: "sm", children: [_jsx(Text, { className: "font-medium", children: "Your Digital Code" }), !revealed ? (_jsxs(Stack, { gap: "sm", children: [error && _jsx(Text, { className: "text-sm text-destructive", children: error }), _jsx(
|
|
31
|
+
return (_jsx(Div, { className: "rounded-lg border border-border bg-muted/40 p-4", children: _jsxs(Stack, { gap: "sm", children: [_jsx(Text, { className: "font-medium", children: "Your Digital Code" }), !revealed ? (_jsxs(Stack, { gap: "sm", children: [error && _jsx(Text, { className: "text-sm text-destructive", children: error }), _jsx(Button, { type: "button", variant: "primary", size: "lg", isLoading: pending, disabled: pending, onClick: handleReveal, className: "w-full", children: "Reveal Code" })] })) : (_jsxs(Stack, { gap: "sm", children: [_jsxs(Div, { className: "flex items-center gap-2 rounded-md border border-border bg-background px-3 py-2 font-mono text-lg", children: [_jsx(Span, { className: "flex-1 select-all", children: revealed.code }), _jsx(Button, { type: "button", variant: "ghost", size: "sm", onClick: handleCopy, className: "shrink-0", children: copied ? "Copied!" : "Copy" })] }), redemptionInstructions && (_jsx(Text, { className: "text-sm text-muted-foreground", children: redemptionInstructions }))] }))] }) }));
|
|
32
32
|
}
|
|
@@ -91,5 +91,5 @@ export function DashboardLayoutClient({ variant, groups, permissions, activeHref
|
|
|
91
91
|
const adminGroups = variant === "admin"
|
|
92
92
|
? filteredGroups
|
|
93
93
|
: groups;
|
|
94
|
-
return (_jsxs(_Fragment, { children: [variant === "admin" && (_jsx(AdminSidebar, { variant: "sidebar", desktopOpen: desktopOpen, mobileOpen: mobileOpen, activePath: activeHref, groups: adminGroups, onCloseMobile: close, onToggle: toggle, className: className })), variant === "store" && (_jsx(StoreSidebar, { variant: "sidebar", desktopOpen: desktopOpen, mobileOpen: mobileOpen, activeHref: activeHref, items: [], groups: filteredGroups, onCloseMobile: close, onToggle: toggle, className: className })), variant === "user" && (_jsx(UserSidebar, { variant: "sidebar", desktopOpen: desktopOpen, mobileOpen: mobileOpen, items: filteredGroups.flatMap((g) => g.items), groups: filteredGroups, onCloseMobile: close, onToggle: toggle, className: className })), children] }));
|
|
94
|
+
return (_jsxs(_Fragment, { children: [variant === "admin" && (_jsx(AdminSidebar, { variant: "sidebar", desktopOpen: desktopOpen, mobileOpen: mobileOpen, activePath: activeHref, groups: adminGroups, onCloseMobile: close, onToggle: toggle, className: className })), variant === "store" && (_jsx(StoreSidebar, { variant: "sidebar", desktopOpen: desktopOpen, mobileOpen: mobileOpen, activeHref: activeHref, items: [], groups: filteredGroups, onCloseMobile: close, onToggle: toggle, className: className })), variant === "user" && (_jsx(UserSidebar, { variant: "sidebar", desktopOpen: desktopOpen, mobileOpen: mobileOpen, items: filteredGroups.flatMap((g) => g.items), groups: filteredGroups, onCloseMobile: close, onToggle: toggle, className: className })), _jsx("div", { className: "w-full px-4 py-6 md:pl-5 md:pr-6 lg:pr-8 min-h-[calc(100dvh-var(--header-height,3.5rem))]", children: children })] }));
|
|
95
95
|
}
|
|
@@ -92,6 +92,45 @@ function emitOrderPlacedNotifications(args) {
|
|
|
92
92
|
: Promise.resolve();
|
|
93
93
|
void Promise.all([buyerNotif, sellerNotif]);
|
|
94
94
|
}
|
|
95
|
+
function accumulateCouponUsage(accumulator, couponCode, couponId, discountAmount) {
|
|
96
|
+
const entry = accumulator.get(couponCode) ?? {
|
|
97
|
+
couponId,
|
|
98
|
+
code: couponCode,
|
|
99
|
+
orderIds: [],
|
|
100
|
+
totalDiscount: 0,
|
|
101
|
+
};
|
|
102
|
+
entry.totalDiscount += discountAmount;
|
|
103
|
+
accumulator.set(couponCode, entry);
|
|
104
|
+
}
|
|
105
|
+
async function resolveShippingCost(storeId, groupTotal, commissions) {
|
|
106
|
+
if (!storeId)
|
|
107
|
+
return { shippingFee: 0, storeOwnerId: undefined };
|
|
108
|
+
const store = await storeRepository.findById(storeId);
|
|
109
|
+
const storeOwnerId = store?.ownerId;
|
|
110
|
+
if (!storeOwnerId)
|
|
111
|
+
return { shippingFee: 0, storeOwnerId: undefined };
|
|
112
|
+
const sellerUser = await userRepository.findById(storeOwnerId);
|
|
113
|
+
const shippingConfig = sellerUser?.shippingConfig;
|
|
114
|
+
if (!shippingConfig?.isConfigured)
|
|
115
|
+
return { shippingFee: 0, storeOwnerId };
|
|
116
|
+
if (shippingConfig.method === "custom") {
|
|
117
|
+
return { shippingFee: shippingConfig.customShippingPrice ?? 0, storeOwnerId };
|
|
118
|
+
}
|
|
119
|
+
if (shippingConfig.method === "shiprocket") {
|
|
120
|
+
const percentFee = groupTotal * (commissions.platformShippingPercent / 100);
|
|
121
|
+
return { shippingFee: Math.max(percentFee, commissions.platformShippingFixedMin), storeOwnerId };
|
|
122
|
+
}
|
|
123
|
+
return { shippingFee: 0, storeOwnerId };
|
|
124
|
+
}
|
|
125
|
+
function buildStockUpdatePayload(product, qtyDelta) {
|
|
126
|
+
const lt = (product.listingType ?? "standard");
|
|
127
|
+
const rule = getListingRule(lt);
|
|
128
|
+
return {
|
|
129
|
+
availableQuantity: product.availableQuantity - qtyDelta,
|
|
130
|
+
updatedAt: new Date(),
|
|
131
|
+
...rule.stockDecrementExtras(product, qtyDelta),
|
|
132
|
+
};
|
|
133
|
+
}
|
|
95
134
|
/**
|
|
96
135
|
* Place order(s) from the user's cart in a single Firestore transaction.
|
|
97
136
|
*
|
|
@@ -239,13 +278,7 @@ export async function createCheckoutOrderAction(input) {
|
|
|
239
278
|
const product = productById.get(pid);
|
|
240
279
|
if (!product)
|
|
241
280
|
continue;
|
|
242
|
-
const
|
|
243
|
-
const rule = getListingRule(lt);
|
|
244
|
-
const update = {
|
|
245
|
-
availableQuantity: product.availableQuantity - qtyDelta,
|
|
246
|
-
updatedAt: new Date(),
|
|
247
|
-
...rule.stockDecrementExtras(product, qtyDelta),
|
|
248
|
-
};
|
|
281
|
+
const update = buildStockUpdatePayload(product, qtyDelta);
|
|
249
282
|
tx.update(productRefById.get(pid), update);
|
|
250
283
|
}
|
|
251
284
|
}
|
|
@@ -330,26 +363,7 @@ export async function createCheckoutOrderAction(input) {
|
|
|
330
363
|
return itemRule.decorateOrderItem(baseLine, product);
|
|
331
364
|
});
|
|
332
365
|
const totalQuantity = group.reduce((sum, { item }) => sum + item.quantity, 0);
|
|
333
|
-
|
|
334
|
-
let storeOwnerId;
|
|
335
|
-
const storeId = firstItem.storeId;
|
|
336
|
-
if (storeId) {
|
|
337
|
-
const store = await storeRepository.findById(storeId);
|
|
338
|
-
storeOwnerId = store?.ownerId;
|
|
339
|
-
if (storeOwnerId) {
|
|
340
|
-
const sellerUser = await userRepository.findById(storeOwnerId);
|
|
341
|
-
const shippingConfig = sellerUser?.shippingConfig;
|
|
342
|
-
if (shippingConfig?.isConfigured) {
|
|
343
|
-
if (shippingConfig.method === "custom") {
|
|
344
|
-
shippingFee = shippingConfig.customShippingPrice ?? 0;
|
|
345
|
-
}
|
|
346
|
-
else if (shippingConfig.method === "shiprocket") {
|
|
347
|
-
const percentFee = groupTotal * (commissions.platformShippingPercent / 100);
|
|
348
|
-
shippingFee = Math.max(percentFee, commissions.platformShippingFixedMin);
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
}
|
|
366
|
+
const { shippingFee, storeOwnerId } = await resolveShippingCost(firstItem.storeId, groupTotal, commissions);
|
|
353
367
|
const isCodLike = paymentMethod === "cod" || paymentMethod === "upi_manual";
|
|
354
368
|
const depositAmount = isCodLike
|
|
355
369
|
? Math.round(groupTotal * (commissions.codDepositPercent / 100) * 100) / 100
|
|
@@ -395,14 +409,7 @@ export async function createCheckoutOrderAction(input) {
|
|
|
395
409
|
storeId: coupon.storeId,
|
|
396
410
|
});
|
|
397
411
|
if (coupon.couponId) {
|
|
398
|
-
|
|
399
|
-
couponId: coupon.couponId,
|
|
400
|
-
code: coupon.code,
|
|
401
|
-
orderIds: [],
|
|
402
|
-
totalDiscount: 0,
|
|
403
|
-
};
|
|
404
|
-
entry.totalDiscount += couponGroupDiscount;
|
|
405
|
-
couponUsageAccumulator.set(coupon.code, entry);
|
|
412
|
+
accumulateCouponUsage(couponUsageAccumulator, coupon.code, coupon.couponId, couponGroupDiscount);
|
|
406
413
|
groupCouponCodes.add(coupon.code);
|
|
407
414
|
}
|
|
408
415
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ProductDocument, ProductClassifiedMeta } from "../../../../features/products/schemas/firestore";
|
|
2
|
+
export interface ClassifiedClientShape {
|
|
3
|
+
id: string;
|
|
4
|
+
title: string;
|
|
5
|
+
description: string;
|
|
6
|
+
price: number;
|
|
7
|
+
priceLabel: string;
|
|
8
|
+
currency: string;
|
|
9
|
+
mainImage: string | null;
|
|
10
|
+
images: string[];
|
|
11
|
+
storeId: string;
|
|
12
|
+
storeName: string | null;
|
|
13
|
+
category: string;
|
|
14
|
+
condition: ProductDocument["condition"] | null;
|
|
15
|
+
tags: string[];
|
|
16
|
+
classified: ProductClassifiedMeta | null;
|
|
17
|
+
status: ProductDocument["status"];
|
|
18
|
+
createdAt: string;
|
|
19
|
+
}
|
|
20
|
+
/** Maps a raw `ProductDocument` to the client-safe classified shape. */
|
|
21
|
+
export declare function toClientClassified(doc: ProductDocument): ClassifiedClientShape;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { formatCurrency } from "../../../../utils/number.formatter";
|
|
2
|
+
/** Maps a raw `ProductDocument` to the client-safe classified shape. */
|
|
3
|
+
export function toClientClassified(doc) {
|
|
4
|
+
return {
|
|
5
|
+
id: doc.id,
|
|
6
|
+
title: doc.title,
|
|
7
|
+
description: doc.description,
|
|
8
|
+
price: doc.price,
|
|
9
|
+
priceLabel: formatCurrency(doc.price, doc.currency ?? "INR"),
|
|
10
|
+
currency: doc.currency ?? "INR",
|
|
11
|
+
mainImage: doc.mainImage || doc.images?.[0] || null,
|
|
12
|
+
images: doc.images ?? [],
|
|
13
|
+
storeId: doc.storeId,
|
|
14
|
+
storeName: doc.storeName ?? null,
|
|
15
|
+
category: doc.category,
|
|
16
|
+
condition: doc.condition ?? null,
|
|
17
|
+
tags: doc.tags ?? [],
|
|
18
|
+
classified: doc.classified ?? null,
|
|
19
|
+
status: doc.status,
|
|
20
|
+
createdAt: doc.createdAt instanceof Date
|
|
21
|
+
? doc.createdAt.toISOString()
|
|
22
|
+
: String(doc.createdAt),
|
|
23
|
+
};
|
|
24
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Metadata } from "next";
|
|
2
|
+
import type { ProductDocument } from "../../../../features/products/schemas/firestore";
|
|
3
|
+
export interface ClassifiedMetadataOptions {
|
|
4
|
+
siteName?: string;
|
|
5
|
+
siteUrl?: string;
|
|
6
|
+
ogImageUrl?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function buildClassifiedMetadata(product: ProductDocument | null, opts?: ClassifiedMetadataOptions): Metadata;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export function buildClassifiedMetadata(product, opts) {
|
|
2
|
+
const siteName = opts?.siteName?.trim() || "";
|
|
3
|
+
const suffix = siteName ? ` — ${siteName}` : "";
|
|
4
|
+
if (!product) {
|
|
5
|
+
return {
|
|
6
|
+
title: `Listing not found${suffix}`,
|
|
7
|
+
description: "This classified listing is unavailable or has been removed.",
|
|
8
|
+
robots: { index: false },
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
const location = product.classified?.meetupArea
|
|
12
|
+
? [product.classified.meetupArea.locality, product.classified.meetupArea.city]
|
|
13
|
+
.filter(Boolean)
|
|
14
|
+
.join(", ")
|
|
15
|
+
: null;
|
|
16
|
+
const title = `${product.title}${suffix}`;
|
|
17
|
+
const description = product.seoDescription?.trim()
|
|
18
|
+
? product.seoDescription.trim()
|
|
19
|
+
: location
|
|
20
|
+
? `${product.description?.slice(0, 120) ?? ""} — Available in ${location}.`
|
|
21
|
+
: product.description?.slice(0, 160) ?? "";
|
|
22
|
+
const image = opts?.ogImageUrl ?? (product.mainImage || product.images?.[0] || null);
|
|
23
|
+
const siteUrl = opts?.siteUrl?.replace(/\/+$/, "");
|
|
24
|
+
const canonical = siteUrl ? `${siteUrl}/classified/${product.id}` : undefined;
|
|
25
|
+
return {
|
|
26
|
+
title,
|
|
27
|
+
description,
|
|
28
|
+
alternates: canonical ? { canonical } : undefined,
|
|
29
|
+
openGraph: {
|
|
30
|
+
title,
|
|
31
|
+
description,
|
|
32
|
+
url: canonical,
|
|
33
|
+
type: "website",
|
|
34
|
+
images: image ? [{ url: image }] : undefined,
|
|
35
|
+
},
|
|
36
|
+
twitter: {
|
|
37
|
+
card: image ? "summary_large_image" : "summary",
|
|
38
|
+
title,
|
|
39
|
+
description,
|
|
40
|
+
images: image ? [image] : undefined,
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { ReactElement } from "react";
|
|
2
|
+
import type { ProductDocument } from "../../../../features/products/schemas/firestore";
|
|
3
|
+
export interface ClassifiedOgData {
|
|
4
|
+
title: string;
|
|
5
|
+
priceLabel?: string | null;
|
|
6
|
+
location?: string | null;
|
|
7
|
+
imageUrl?: string | null;
|
|
8
|
+
}
|
|
9
|
+
interface ClassifiedDocLike {
|
|
10
|
+
title?: string | null;
|
|
11
|
+
price?: number | null;
|
|
12
|
+
currency?: string | null;
|
|
13
|
+
mainImage?: string | null;
|
|
14
|
+
images?: (string | null | undefined)[] | null;
|
|
15
|
+
classified?: {
|
|
16
|
+
meetupArea?: {
|
|
17
|
+
city?: string;
|
|
18
|
+
locality?: string;
|
|
19
|
+
};
|
|
20
|
+
} | null;
|
|
21
|
+
}
|
|
22
|
+
export declare function renderClassifiedOg(doc: ClassifiedDocLike | null | undefined, opts: {
|
|
23
|
+
siteName: string;
|
|
24
|
+
}): ReactElement;
|
|
25
|
+
export declare function renderClassifiedOgImage(data: ClassifiedOgData, siteName: string): ReactElement;
|
|
26
|
+
/** Type-safe overload that accepts the full ProductDocument. */
|
|
27
|
+
export declare function renderClassifiedOgFromDoc(doc: ProductDocument | null | undefined, opts: {
|
|
28
|
+
siteName: string;
|
|
29
|
+
}): ReactElement;
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
export function renderClassifiedOg(doc, opts) {
|
|
3
|
+
const meta = doc?.classified;
|
|
4
|
+
const location = meta?.meetupArea
|
|
5
|
+
? [meta.meetupArea.locality, meta.meetupArea.city].filter(Boolean).join(", ")
|
|
6
|
+
: null;
|
|
7
|
+
const priceLabel = doc?.price != null
|
|
8
|
+
? new Intl.NumberFormat("en-IN", {
|
|
9
|
+
style: "currency",
|
|
10
|
+
currency: doc.currency ?? "INR",
|
|
11
|
+
maximumFractionDigits: 0,
|
|
12
|
+
}).format(doc.price / 100)
|
|
13
|
+
: null;
|
|
14
|
+
return renderClassifiedOgImage({
|
|
15
|
+
title: doc?.title ?? "Classified Listing",
|
|
16
|
+
priceLabel,
|
|
17
|
+
location,
|
|
18
|
+
imageUrl: doc?.mainImage || doc?.images?.[0] || null,
|
|
19
|
+
}, opts.siteName);
|
|
20
|
+
}
|
|
21
|
+
export function renderClassifiedOgImage(data, siteName) {
|
|
22
|
+
const { title, priceLabel, location, imageUrl } = data;
|
|
23
|
+
return (_jsxs("div", { style: {
|
|
24
|
+
display: "flex",
|
|
25
|
+
width: "100%",
|
|
26
|
+
height: "100%",
|
|
27
|
+
background: "#0f172a",
|
|
28
|
+
fontFamily: "sans-serif",
|
|
29
|
+
position: "relative",
|
|
30
|
+
overflow: "hidden",
|
|
31
|
+
}, children: [imageUrl && (_jsx("img", { src: imageUrl, alt: "", style: {
|
|
32
|
+
position: "absolute",
|
|
33
|
+
inset: 0,
|
|
34
|
+
width: "100%",
|
|
35
|
+
height: "100%",
|
|
36
|
+
objectFit: "cover",
|
|
37
|
+
opacity: 0.12,
|
|
38
|
+
} })), _jsx("div", { style: {
|
|
39
|
+
position: "absolute",
|
|
40
|
+
inset: 0,
|
|
41
|
+
background: "linear-gradient(135deg, rgba(15,23,42,0.96) 0%, rgba(15,23,42,0.82) 100%)",
|
|
42
|
+
} }), _jsxs("div", { style: {
|
|
43
|
+
position: "relative",
|
|
44
|
+
display: "flex",
|
|
45
|
+
width: "100%",
|
|
46
|
+
height: "100%",
|
|
47
|
+
padding: "60px",
|
|
48
|
+
gap: "48px",
|
|
49
|
+
alignItems: "center",
|
|
50
|
+
}, children: [imageUrl && (_jsx("img", { src: imageUrl, alt: title, style: {
|
|
51
|
+
width: 400,
|
|
52
|
+
height: 400,
|
|
53
|
+
objectFit: "contain",
|
|
54
|
+
borderRadius: 16,
|
|
55
|
+
flexShrink: 0,
|
|
56
|
+
} })), _jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 20, flex: 1 }, children: [_jsxs("div", { style: {
|
|
57
|
+
fontSize: 18,
|
|
58
|
+
color: "#38bdf8",
|
|
59
|
+
fontWeight: 600,
|
|
60
|
+
letterSpacing: 2,
|
|
61
|
+
textTransform: "uppercase",
|
|
62
|
+
}, children: [siteName, " \u00B7 Classified"] }), _jsx("div", { style: {
|
|
63
|
+
fontSize: imageUrl ? 44 : 56,
|
|
64
|
+
fontWeight: 700,
|
|
65
|
+
color: "#f1f5f9",
|
|
66
|
+
lineHeight: 1.2,
|
|
67
|
+
display: "-webkit-box",
|
|
68
|
+
WebkitLineClamp: 3,
|
|
69
|
+
WebkitBoxOrient: "vertical",
|
|
70
|
+
overflow: "hidden",
|
|
71
|
+
}, children: title }), priceLabel && (_jsx("div", { style: { fontSize: 32, fontWeight: 700, color: "#4ade80" }, children: priceLabel })), location && (_jsx("div", { style: { fontSize: 22, color: "#94a3b8" }, children: location }))] })] })] }));
|
|
72
|
+
}
|
|
73
|
+
/** Type-safe overload that accepts the full ProductDocument. */
|
|
74
|
+
export function renderClassifiedOgFromDoc(doc, opts) {
|
|
75
|
+
return renderClassifiedOg(doc, opts);
|
|
76
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ProductDocument, ProductDigitalCodeMeta } from "../../../../features/products/schemas/firestore";
|
|
2
|
+
export interface DigitalCodeClientShape {
|
|
3
|
+
id: string;
|
|
4
|
+
title: string;
|
|
5
|
+
description: string;
|
|
6
|
+
price: number;
|
|
7
|
+
priceLabel: string;
|
|
8
|
+
currency: string;
|
|
9
|
+
mainImage: string | null;
|
|
10
|
+
images: string[];
|
|
11
|
+
storeId: string;
|
|
12
|
+
storeName: string | null;
|
|
13
|
+
category: string;
|
|
14
|
+
tags: string[];
|
|
15
|
+
/** Delivery method and redemption instructions — codesAvailable intentionally omitted (operational). */
|
|
16
|
+
digitalCode: Pick<ProductDigitalCodeMeta, "codeDeliveryMethod" | "redemptionInstructions"> | null;
|
|
17
|
+
status: ProductDocument["status"];
|
|
18
|
+
createdAt: string;
|
|
19
|
+
}
|
|
20
|
+
/** Maps a raw `ProductDocument` to the client-safe digital-code shape. Strips codesAvailable/codePoolSize (operational counters). */
|
|
21
|
+
export declare function toClientDigitalCode(doc: ProductDocument): DigitalCodeClientShape;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { formatCurrency } from "../../../../utils/number.formatter";
|
|
2
|
+
/** Maps a raw `ProductDocument` to the client-safe digital-code shape. Strips codesAvailable/codePoolSize (operational counters). */
|
|
3
|
+
export function toClientDigitalCode(doc) {
|
|
4
|
+
const dc = doc.digitalCode ?? null;
|
|
5
|
+
return {
|
|
6
|
+
id: doc.id,
|
|
7
|
+
title: doc.title,
|
|
8
|
+
description: doc.description,
|
|
9
|
+
price: doc.price,
|
|
10
|
+
priceLabel: formatCurrency(doc.price, doc.currency ?? "INR"),
|
|
11
|
+
currency: doc.currency ?? "INR",
|
|
12
|
+
mainImage: doc.mainImage || doc.images?.[0] || null,
|
|
13
|
+
images: doc.images ?? [],
|
|
14
|
+
storeId: doc.storeId,
|
|
15
|
+
storeName: doc.storeName ?? null,
|
|
16
|
+
category: doc.category,
|
|
17
|
+
tags: doc.tags ?? [],
|
|
18
|
+
digitalCode: dc
|
|
19
|
+
? {
|
|
20
|
+
codeDeliveryMethod: dc.codeDeliveryMethod,
|
|
21
|
+
redemptionInstructions: dc.redemptionInstructions,
|
|
22
|
+
}
|
|
23
|
+
: null,
|
|
24
|
+
status: doc.status,
|
|
25
|
+
createdAt: doc.createdAt instanceof Date
|
|
26
|
+
? doc.createdAt.toISOString()
|
|
27
|
+
: String(doc.createdAt),
|
|
28
|
+
};
|
|
29
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Metadata } from "next";
|
|
2
|
+
import type { ProductDocument } from "../../../../features/products/schemas/firestore";
|
|
3
|
+
export interface DigitalCodeMetadataOptions {
|
|
4
|
+
siteName?: string;
|
|
5
|
+
siteUrl?: string;
|
|
6
|
+
ogImageUrl?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function buildDigitalCodeMetadata(product: ProductDocument | null, opts?: DigitalCodeMetadataOptions): Metadata;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export function buildDigitalCodeMetadata(product, opts) {
|
|
2
|
+
const siteName = opts?.siteName?.trim() || "";
|
|
3
|
+
const suffix = siteName ? ` — ${siteName}` : "";
|
|
4
|
+
if (!product) {
|
|
5
|
+
return {
|
|
6
|
+
title: `Digital code not found${suffix}`,
|
|
7
|
+
description: "This digital code listing is unavailable or has been removed.",
|
|
8
|
+
robots: { index: false },
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
const title = `${product.title}${suffix}`;
|
|
12
|
+
const description = product.seoDescription?.trim()
|
|
13
|
+
? product.seoDescription.trim()
|
|
14
|
+
: product.description?.slice(0, 160) ?? "";
|
|
15
|
+
const image = opts?.ogImageUrl ?? (product.mainImage || product.images?.[0] || null);
|
|
16
|
+
const siteUrl = opts?.siteUrl?.replace(/\/+$/, "");
|
|
17
|
+
const canonical = siteUrl ? `${siteUrl}/digital-codes/${product.id}` : undefined;
|
|
18
|
+
return {
|
|
19
|
+
title,
|
|
20
|
+
description,
|
|
21
|
+
alternates: canonical ? { canonical } : undefined,
|
|
22
|
+
openGraph: {
|
|
23
|
+
title,
|
|
24
|
+
description,
|
|
25
|
+
url: canonical,
|
|
26
|
+
type: "website",
|
|
27
|
+
images: image ? [{ url: image }] : undefined,
|
|
28
|
+
},
|
|
29
|
+
twitter: {
|
|
30
|
+
card: image ? "summary_large_image" : "summary",
|
|
31
|
+
title,
|
|
32
|
+
description,
|
|
33
|
+
images: image ? [image] : undefined,
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ReactElement } from "react";
|
|
2
|
+
import type { ProductDocument } from "../../../../features/products/schemas/firestore";
|
|
3
|
+
export interface DigitalCodeOgData {
|
|
4
|
+
title: string;
|
|
5
|
+
priceLabel?: string | null;
|
|
6
|
+
deliveryMethod?: string | null;
|
|
7
|
+
imageUrl?: string | null;
|
|
8
|
+
}
|
|
9
|
+
interface DigitalCodeDocLike {
|
|
10
|
+
title?: string | null;
|
|
11
|
+
price?: number | null;
|
|
12
|
+
currency?: string | null;
|
|
13
|
+
mainImage?: string | null;
|
|
14
|
+
images?: (string | null | undefined)[] | null;
|
|
15
|
+
digitalCode?: {
|
|
16
|
+
codeDeliveryMethod?: string;
|
|
17
|
+
} | null;
|
|
18
|
+
}
|
|
19
|
+
export declare function renderDigitalCodeOg(doc: DigitalCodeDocLike | null | undefined, opts: {
|
|
20
|
+
siteName: string;
|
|
21
|
+
}): ReactElement;
|
|
22
|
+
export declare function renderDigitalCodeOgImage(data: DigitalCodeOgData, siteName: string): ReactElement;
|
|
23
|
+
/** Type-safe overload that accepts the full ProductDocument. */
|
|
24
|
+
export declare function renderDigitalCodeOgFromDoc(doc: ProductDocument | null | undefined, opts: {
|
|
25
|
+
siteName: string;
|
|
26
|
+
}): ReactElement;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
export function renderDigitalCodeOg(doc, opts) {
|
|
3
|
+
const priceLabel = doc?.price != null
|
|
4
|
+
? new Intl.NumberFormat("en-IN", {
|
|
5
|
+
style: "currency",
|
|
6
|
+
currency: doc.currency ?? "INR",
|
|
7
|
+
maximumFractionDigits: 0,
|
|
8
|
+
}).format(doc.price / 100)
|
|
9
|
+
: null;
|
|
10
|
+
const deliveryMethod = doc?.digitalCode?.codeDeliveryMethod === "auto-claim"
|
|
11
|
+
? "Instant delivery"
|
|
12
|
+
: doc?.digitalCode?.codeDeliveryMethod === "manual-email"
|
|
13
|
+
? "Delivered via email"
|
|
14
|
+
: null;
|
|
15
|
+
return renderDigitalCodeOgImage({
|
|
16
|
+
title: doc?.title ?? "Digital Code",
|
|
17
|
+
priceLabel,
|
|
18
|
+
deliveryMethod,
|
|
19
|
+
imageUrl: doc?.mainImage || doc?.images?.[0] || null,
|
|
20
|
+
}, opts.siteName);
|
|
21
|
+
}
|
|
22
|
+
export function renderDigitalCodeOgImage(data, siteName) {
|
|
23
|
+
const { title, priceLabel, deliveryMethod, imageUrl } = data;
|
|
24
|
+
return (_jsxs("div", { style: {
|
|
25
|
+
display: "flex",
|
|
26
|
+
width: "100%",
|
|
27
|
+
height: "100%",
|
|
28
|
+
background: "#0c0a1e",
|
|
29
|
+
fontFamily: "sans-serif",
|
|
30
|
+
position: "relative",
|
|
31
|
+
overflow: "hidden",
|
|
32
|
+
}, children: [imageUrl && (_jsx("img", { src: imageUrl, alt: "", style: {
|
|
33
|
+
position: "absolute",
|
|
34
|
+
inset: 0,
|
|
35
|
+
width: "100%",
|
|
36
|
+
height: "100%",
|
|
37
|
+
objectFit: "cover",
|
|
38
|
+
opacity: 0.1,
|
|
39
|
+
} })), _jsx("div", { style: {
|
|
40
|
+
position: "absolute",
|
|
41
|
+
inset: 0,
|
|
42
|
+
background: "linear-gradient(135deg, rgba(12,10,30,0.97) 0%, rgba(12,10,30,0.83) 100%)",
|
|
43
|
+
} }), _jsxs("div", { style: {
|
|
44
|
+
position: "relative",
|
|
45
|
+
display: "flex",
|
|
46
|
+
width: "100%",
|
|
47
|
+
height: "100%",
|
|
48
|
+
padding: "60px",
|
|
49
|
+
gap: "48px",
|
|
50
|
+
alignItems: "center",
|
|
51
|
+
}, children: [imageUrl && (_jsx("img", { src: imageUrl, alt: title, style: {
|
|
52
|
+
width: 400,
|
|
53
|
+
height: 400,
|
|
54
|
+
objectFit: "contain",
|
|
55
|
+
borderRadius: 16,
|
|
56
|
+
flexShrink: 0,
|
|
57
|
+
} })), _jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 20, flex: 1 }, children: [_jsxs("div", { style: {
|
|
58
|
+
fontSize: 18,
|
|
59
|
+
color: "#a78bfa",
|
|
60
|
+
fontWeight: 600,
|
|
61
|
+
letterSpacing: 2,
|
|
62
|
+
textTransform: "uppercase",
|
|
63
|
+
}, children: [siteName, " \u00B7 Digital Code"] }), _jsx("div", { style: {
|
|
64
|
+
fontSize: imageUrl ? 44 : 56,
|
|
65
|
+
fontWeight: 700,
|
|
66
|
+
color: "#f1f5f9",
|
|
67
|
+
lineHeight: 1.2,
|
|
68
|
+
display: "-webkit-box",
|
|
69
|
+
WebkitLineClamp: 3,
|
|
70
|
+
WebkitBoxOrient: "vertical",
|
|
71
|
+
overflow: "hidden",
|
|
72
|
+
}, children: title }), priceLabel && (_jsx("div", { style: { fontSize: 32, fontWeight: 700, color: "#4ade80" }, children: priceLabel })), deliveryMethod && (_jsx("div", { style: { fontSize: 22, color: "#94a3b8" }, children: deliveryMethod }))] })] })] }));
|
|
73
|
+
}
|
|
74
|
+
/** Type-safe overload that accepts the full ProductDocument. */
|
|
75
|
+
export function renderDigitalCodeOgFromDoc(doc, opts) {
|
|
76
|
+
return renderDigitalCodeOg(doc, opts);
|
|
77
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ProductDocument, ProductLiveItemMeta } from "../../../../features/products/schemas/firestore";
|
|
2
|
+
export interface LiveItemClientShape {
|
|
3
|
+
id: string;
|
|
4
|
+
title: string;
|
|
5
|
+
description: string;
|
|
6
|
+
price: number;
|
|
7
|
+
priceLabel: string;
|
|
8
|
+
currency: string;
|
|
9
|
+
mainImage: string | null;
|
|
10
|
+
images: string[];
|
|
11
|
+
storeId: string;
|
|
12
|
+
storeName: string | null;
|
|
13
|
+
category: string;
|
|
14
|
+
tags: string[];
|
|
15
|
+
/** Live-item meta — vendorVerified is intentionally omitted (admin-only). */
|
|
16
|
+
liveItem: Omit<ProductLiveItemMeta, "vendorVerified"> | null;
|
|
17
|
+
status: ProductDocument["status"];
|
|
18
|
+
createdAt: string;
|
|
19
|
+
}
|
|
20
|
+
/** Maps a raw `ProductDocument` to the client-safe live-item shape. Strips vendorVerified (admin-only). */
|
|
21
|
+
export declare function toClientLiveItem(doc: ProductDocument): LiveItemClientShape;
|