@mohasinac/appkit 2.8.1 → 2.8.3
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 +7 -1
- package/dist/_internal/client/features/digital-code/CodeRevealPanel.js +4 -1
- package/dist/_internal/client/features/digital-code/DigitalCodeDetailView.js +7 -1
- package/dist/_internal/client/features/layout/DashboardLayoutClient.js +3 -2
- package/dist/_internal/client/features/live/LiveItemDetailView.js +11 -2
- package/dist/_internal/client/scaffolds/AppShell.js +2 -1
- package/dist/_internal/client/scaffolds/DashboardScaffold.js +2 -1
- package/dist/_internal/server/features/checkout/actions.js +40 -39
- package/dist/_internal/shared/actions/action-registry.js +6 -0
- package/dist/_internal/shared/config/index.d.ts +1 -1
- package/dist/_internal/shared/config/schema.d.ts +0 -8
- package/dist/client-entry.d.ts +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/client.js +1 -1
- package/dist/configs/next.js +12 -22
- package/dist/constants/api-endpoints.d.ts +6 -0
- package/dist/constants/api-endpoints.js +2 -0
- package/dist/core/hooks/useSiteSettings.d.ts +1 -1
- package/dist/features/about/components/AboutView.js +5 -2
- package/dist/features/about/components/FAQPageView.js +3 -3
- package/dist/features/about/components/FeesView.js +13 -5
- package/dist/features/about/components/HelpPageView.js +9 -5
- package/dist/features/about/components/HowAuctionsWorkView.js +9 -5
- package/dist/features/about/components/HowCheckoutWorksView.js +9 -5
- package/dist/features/about/components/HowOffersWorkView.js +10 -5
- package/dist/features/about/components/HowOrdersWorkView.js +10 -5
- package/dist/features/about/components/HowPayoutsWorkView.js +9 -5
- package/dist/features/about/components/HowPreOrdersWorkView.js +9 -5
- package/dist/features/about/components/HowReviewsWorkView.js +9 -5
- package/dist/features/about/components/PolicyPageView.js +3 -3
- package/dist/features/about/components/PublicProfileView.js +11 -4
- package/dist/features/about/components/SecurityPrivacyView.js +8 -4
- package/dist/features/about/components/ShippingPolicyView.js +3 -2
- package/dist/features/about/components/TrackOrderView.js +2 -2
- package/dist/features/about/components/UnauthorizedView.js +3 -3
- package/dist/features/account/components/AddressBook.js +1 -1
- package/dist/features/account/components/AddressForm.js +2 -2
- package/dist/features/account/components/AddressInlineSelect.d.ts +24 -0
- package/dist/features/account/components/AddressInlineSelect.js +78 -0
- package/dist/features/account/components/AddressSelectorCreate.d.ts +2 -1
- package/dist/features/account/components/AddressSelectorCreate.js +5 -32
- package/dist/features/account/components/AddressesIndexListing.js +3 -3
- package/dist/features/account/components/ChatWindow.js +2 -1
- package/dist/features/account/components/NotificationBell.js +13 -7
- package/dist/features/account/components/NotificationPreferencesPanel.js +4 -1
- package/dist/features/account/components/UserOffersPanel.js +2 -1
- package/dist/features/account/components/UserSidebar.js +11 -7
- package/dist/features/account/components/UserSupportView.js +13 -4
- package/dist/features/account/components/index.d.ts +2 -0
- package/dist/features/account/components/index.js +1 -0
- package/dist/features/account/hooks/useAccount.d.ts +2 -2
- package/dist/features/account/hooks/useAddressSelector.d.ts +1 -1
- package/dist/features/account/hooks/useAddresses.d.ts +2 -2
- package/dist/features/account/hooks/useNotifications.d.ts +1 -1
- package/dist/features/account/hooks/useProfile.d.ts +1 -1
- package/dist/features/account/hooks/usePublicProfile.d.ts +2 -2
- package/dist/features/addresses/repository/addresses.repository.d.ts +1 -0
- package/dist/features/addresses/repository/addresses.repository.js +13 -0
- package/dist/features/admin/components/AdminAdEditorView.js +8 -5
- package/dist/features/admin/components/AdminAddressEditorView.js +5 -5
- package/dist/features/admin/components/AdminAdsView.js +10 -7
- package/dist/features/admin/components/AdminBlogEditorView.js +15 -9
- package/dist/features/admin/components/AdminBrandEditorView.js +10 -4
- package/dist/features/admin/components/AdminBrandsView.js +4 -4
- package/dist/features/admin/components/AdminBundleEditorView.js +4 -5
- package/dist/features/admin/components/AdminBundlesView.js +3 -3
- package/dist/features/admin/components/AdminCarouselEditorView.js +6 -3
- package/dist/features/admin/components/AdminCarouselView.js +6 -6
- package/dist/features/admin/components/AdminCatalogGuideView.js +2 -1
- package/dist/features/admin/components/AdminCategoriesView.js +5 -5
- package/dist/features/admin/components/AdminCategoryEditorView.js +11 -5
- package/dist/features/admin/components/AdminContactEditorView.js +8 -1
- package/dist/features/admin/components/AdminCouponEditorView.js +23 -5
- package/dist/features/admin/components/AdminEmployeeEditorView.js +7 -4
- package/dist/features/admin/components/AdminFaqEditorView.js +9 -3
- package/dist/features/admin/components/AdminFaqsView.js +4 -4
- package/dist/features/admin/components/AdminFeatureEditorView.js +7 -1
- package/dist/features/admin/components/AdminFeatureFlagsView.js +4 -1
- package/dist/features/admin/components/AdminFilterBar.js +4 -4
- package/dist/features/admin/components/AdminGroupedListingsView.js +65 -30
- package/dist/features/admin/components/AdminGuideHubView.js +4 -1
- package/dist/features/admin/components/AdminMediaView.js +4 -1
- package/dist/features/admin/components/AdminNavigationView.js +7 -4
- package/dist/features/admin/components/AdminNotificationsView.js +2 -2
- package/dist/features/admin/components/AdminOrderEditorView.js +2 -2
- package/dist/features/admin/components/AdminPageHeader.js +5 -2
- package/dist/features/admin/components/AdminPrizeDrawsView.js +5 -5
- package/dist/features/admin/components/AdminProductEditorView.js +12 -5
- package/dist/features/admin/components/AdminProductsView.js +4 -4
- package/dist/features/admin/components/AdminReviewsView.js +2 -2
- package/dist/features/admin/components/AdminScammerEditorView.js +6 -2
- package/dist/features/admin/components/AdminScammersView.js +3 -3
- package/dist/features/admin/components/AdminSectionsView.js +20 -22
- package/dist/features/admin/components/AdminSessionsManager.js +2 -1
- package/dist/features/admin/components/AdminSessionsView.js +2 -2
- package/dist/features/admin/components/AdminSidebar.js +11 -7
- package/dist/features/admin/components/AdminSiteConfigGuideView.js +2 -1
- package/dist/features/admin/components/AdminSiteSettingsView.js +5 -1
- package/dist/features/admin/components/AdminStoreAddressesView.js +2 -2
- package/dist/features/admin/components/AdminStoreEditorView.js +5 -5
- package/dist/features/admin/components/AdminSublistingCategoryEditorView.js +3 -3
- package/dist/features/admin/components/AdminSupportTicketDetailView.js +10 -3
- package/dist/features/admin/components/AdminSupportTicketsView.js +3 -3
- package/dist/features/admin/components/AdminTrustGuideView.js +3 -3
- package/dist/features/admin/components/AdminUsersGuideView.js +3 -3
- package/dist/features/admin/components/AdminViewCards.js +12 -6
- package/dist/features/admin/components/BrandQuickCreateForm.js +2 -2
- package/dist/features/admin/components/CategoryQuickCreateForm.js +2 -2
- package/dist/features/admin/components/DashboardStats.js +9 -3
- package/dist/features/admin/components/DataListingView.js +3 -3
- package/dist/features/admin/components/DataTable.js +11 -7
- package/dist/features/admin/components/DrawerFormFooter.js +2 -2
- package/dist/features/admin/components/QuickEditMenu.js +2 -1
- package/dist/features/admin/components/analytics/AdminAnalyticsCharts.js +5 -1
- package/dist/features/admin/hooks/useAdmin.d.ts +1 -1
- package/dist/features/admin/hooks/useAdminSectionsListing.d.ts +1 -1
- package/dist/features/admin/hooks/useChat.d.ts +1 -1
- package/dist/features/auctions/components/AuctionBidsTable.js +4 -1
- package/dist/features/auctions/components/AuctionDetailPageView.js +14 -6
- package/dist/features/auctions/components/CollapsibleBidHistory.js +5 -1
- package/dist/features/auctions/components/MarketplaceAuctionCard.js +9 -3
- package/dist/features/auctions/components/MarketplaceAuctionGrid.js +8 -2
- package/dist/features/auctions/components/PlaceBidFormClient.js +4 -1
- package/dist/features/auctions/hooks/useAuctions.d.ts +8 -8
- package/dist/features/auth/components/RegisterForm.js +2 -2
- package/dist/features/auth/components/VerifyEmailView.js +5 -2
- package/dist/features/auth/consent-otp.d.ts +2 -2
- package/dist/features/auth/hooks/useAuth.d.ts +2 -2
- package/dist/features/before-after/components/BeforeAfterSlider.js +1 -1
- package/dist/features/blog/components/BlogFeaturedCard.js +8 -1
- package/dist/features/blog/components/BlogIndexListing.js +11 -5
- package/dist/features/blog/components/BlogListView.js +11 -3
- package/dist/features/blog/components/BlogPostView.js +10 -3
- package/dist/features/cart/components/CartDrawer.js +11 -3
- package/dist/features/cart/components/CartSummary.js +2 -2
- package/dist/features/cart/components/CheckoutOtpModal.js +2 -1
- package/dist/features/cart/hooks/useCart.d.ts +1 -1
- package/dist/features/cart/hooks/useCartQuery.d.ts +1 -1
- package/dist/features/cart/hooks/useCheckoutReadQueries.d.ts +2 -2
- package/dist/features/cart/hooks/useOrder.d.ts +2 -2
- package/dist/features/categories/components/BrandDetailPageView.js +5 -2
- package/dist/features/categories/components/BrandDetailTabs.js +5 -1
- package/dist/features/categories/components/BundleDetailView.js +6 -3
- package/dist/features/categories/components/BundleDynamicRuleEditor.js +3 -1
- package/dist/features/categories/components/BundleItemsPicker.js +10 -3
- package/dist/features/categories/components/CategoriesIndexListing.js +12 -6
- package/dist/features/categories/components/CategoryBundlesListing.js +5 -2
- package/dist/features/categories/components/CategoryDetailPageView.js +6 -2
- package/dist/features/categories/components/CategoryDetailTabs.js +5 -1
- package/dist/features/categories/components/CategoryForm.js +6 -3
- package/dist/features/categories/components/CategoryGrid.js +9 -2
- package/dist/features/categories/components/CategoryProductsListing.js +10 -4
- package/dist/features/categories/components/CategorySelectorCreate.js +3 -3
- package/dist/features/categories/components/CategorySortSelect.js +1 -1
- package/dist/features/categories/components/CategoryStoresListing.js +3 -3
- package/dist/features/categories/components/CategoryTableColumns.js +10 -6
- package/dist/features/categories/components/CategoryTree.js +1 -1
- package/dist/features/categories/hooks/useCategories.d.ts +3 -3
- package/dist/features/categories/hooks/useCategorySelector.d.ts +3 -3
- package/dist/features/categories/hooks/useCategoryTree.d.ts +1 -1
- package/dist/features/checkout/hooks/useCheckoutApi.d.ts +2 -2
- package/dist/features/classified/components/ClassifiedFilters.js +2 -2
- package/dist/features/classified/components/ClassifiedIndexListing.js +9 -3
- package/dist/features/collections/components/CollectionCard.js +2 -1
- package/dist/features/collections/hooks/useCollections.d.ts +2 -2
- package/dist/features/contact/components/ContactForm.js +4 -2
- package/dist/features/contact/components/ContactInfoSidebar.js +4 -1
- package/dist/features/copilot/components/AdminCopilotView.js +13 -5
- package/dist/features/digital-codes/components/DigitalCodesIndexListing.js +9 -3
- package/dist/features/events/components/AdminEventEditorView.js +62 -40
- package/dist/features/events/components/AdminEventEntriesView.js +9 -6
- package/dist/features/events/components/EventCard.js +7 -1
- package/dist/features/events/components/EventFormDrawer.js +2 -1
- package/dist/features/events/components/EventLeaderboard.js +4 -4
- package/dist/features/events/components/EventOfferCard.js +4 -1
- package/dist/features/events/components/EventParticipateView.js +3 -2
- package/dist/features/events/components/EventPollWidget.js +6 -5
- package/dist/features/events/components/EventRaffleEntryForm.js +5 -2
- package/dist/features/events/components/EventRaffleWinnerView.js +7 -1
- package/dist/features/events/components/EventRafflesSection.js +2 -2
- package/dist/features/events/components/EventSaleBanner.js +5 -2
- package/dist/features/events/components/EventsIndexListing.js +8 -2
- package/dist/features/events/components/EventsListView.js +4 -1
- package/dist/features/events/components/SpinWheelView.js +7 -2
- package/dist/features/events/hooks/useEvent.d.ts +3 -3
- package/dist/features/events/hooks/useEvents.d.ts +1 -1
- package/dist/features/events/schemas/firestore.d.ts +1 -0
- package/dist/features/events/types/index.d.ts +1 -0
- package/dist/features/faq/components/ContactCTA.js +4 -1
- package/dist/features/faq/components/FAQCategorySidebar.js +2 -2
- package/dist/features/faq/components/FAQHelpfulButtons.js +8 -5
- package/dist/features/faq/components/FAQPageContent.js +5 -5
- package/dist/features/faq/components/FAQSortDropdown.js +2 -2
- package/dist/features/faq/hooks/useFAQs.d.ts +1 -1
- package/dist/features/faq/hooks/useFaqList.d.ts +15 -15
- package/dist/features/filters/AsyncFacetSection.js +4 -2
- package/dist/features/filters/FilterFacetSection.js +14 -6
- package/dist/features/filters/RangeFilter.js +4 -2
- package/dist/features/filters/SwitchFilter.js +2 -1
- package/dist/features/forms/Checkbox.js +1 -1
- package/dist/features/forms/Radio.js +1 -1
- package/dist/features/forms/Slider.js +1 -1
- package/dist/features/homepage/components/AdSlot.js +4 -4
- package/dist/features/homepage/components/AdvertisementBanner.js +13 -4
- package/dist/features/homepage/components/AnnouncementBar.js +2 -1
- package/dist/features/homepage/components/BeforeAfterCard.js +8 -2
- package/dist/features/homepage/components/BrandsSection.js +6 -3
- package/dist/features/homepage/components/CTABannerSection.js +2 -2
- package/dist/features/homepage/components/CharacterHotspot.js +5 -2
- package/dist/features/homepage/components/CharacterHotspotForm.js +8 -4
- package/dist/features/homepage/components/CustomCardsSection.js +13 -7
- package/dist/features/homepage/components/CustomerReviewsSection.js +9 -3
- package/dist/features/homepage/components/FAQSection.js +7 -4
- package/dist/features/homepage/components/FeaturedBundlesSection.js +8 -2
- package/dist/features/homepage/components/FeaturedResultsSection.js +1 -1
- package/dist/features/homepage/components/GoogleReviewsSection.js +14 -8
- package/dist/features/homepage/components/HeroCarousel.js +1 -1
- package/dist/features/homepage/components/HomepageSkeleton.js +7 -1
- package/dist/features/homepage/components/HowItWorksInfoView.js +2 -2
- package/dist/features/homepage/components/HowItWorksSection.js +2 -2
- package/dist/features/homepage/components/NewsletterBanner.js +3 -2
- package/dist/features/homepage/components/NewsletterSection.js +5 -2
- package/dist/features/homepage/components/PromoGrid.js +4 -1
- package/dist/features/homepage/components/SectionCarousel.js +7 -4
- package/dist/features/homepage/components/SecurityHighlightsSection.js +3 -3
- package/dist/features/homepage/components/ShopByCategorySection.js +10 -4
- package/dist/features/homepage/components/SiteFeaturesSection.js +5 -2
- package/dist/features/homepage/components/SocialFeedSection.js +4 -4
- package/dist/features/homepage/components/SocialPostCard.js +6 -3
- package/dist/features/homepage/components/TrustFeaturesSection.js +5 -5
- package/dist/features/homepage/components/TrustIndicatorsSection.js +5 -2
- package/dist/features/homepage/components/WelcomeSection.js +1 -1
- package/dist/features/homepage/components/WhatsAppCommunitySection.js +3 -3
- package/dist/features/homepage/hooks/useBlogArticles.d.ts +1 -1
- package/dist/features/homepage/hooks/useFeaturedAuctions.d.ts +1 -1
- package/dist/features/homepage/hooks/useFeaturedPreOrders.d.ts +1 -1
- package/dist/features/homepage/hooks/useFeaturedProducts.d.ts +1 -1
- package/dist/features/homepage/hooks/useFeaturedStores.d.ts +1 -1
- package/dist/features/homepage/hooks/useHeroCarousel.d.ts +1 -1
- package/dist/features/homepage/hooks/useHomepageEvents.d.ts +1 -1
- package/dist/features/homepage/hooks/useHomepageReviews.d.ts +1 -1
- package/dist/features/homepage/hooks/useHomepageSections.d.ts +1 -1
- package/dist/features/homepage/hooks/useTopBrands.d.ts +1 -1
- package/dist/features/homepage/hooks/useTopCategories.d.ts +1 -1
- package/dist/features/layout/AppLayoutShell.js +2 -1
- package/dist/features/layout/BackToTop.js +1 -1
- package/dist/features/layout/BottomActions.js +4 -3
- package/dist/features/layout/BottomNavItem.js +1 -1
- package/dist/features/layout/BottomSheet.js +4 -1
- package/dist/features/layout/FooterLayout.js +1 -1
- package/dist/features/layout/NavbarLayout.js +4 -1
- package/dist/features/layout/SidebarLayout.js +5 -2
- package/dist/features/live/components/LiveItemFilters.js +2 -2
- package/dist/features/live/components/LiveItemsIndexListing.js +9 -3
- package/dist/features/loyalty/components/CoinsDisplay.js +4 -2
- package/dist/features/loyalty/hooks/useLoyaltyBalance.d.ts +1 -1
- package/dist/features/media/AvatarUpload.js +2 -2
- package/dist/features/media/MediaLightbox.js +3 -2
- package/dist/features/media/modals/VideoThumbnailSelector.js +4 -1
- package/dist/features/media/modals/VideoTrimModal.js +1 -1
- package/dist/features/media/upload/CameraCapture.js +1 -1
- package/dist/features/media/upload/ImageUpload.js +4 -1
- package/dist/features/media/upload/MediaUploadField.js +11 -2
- package/dist/features/media/upload/MediaUploadList.js +5 -1
- package/dist/features/orders/components/MarketplaceOrderCard.js +2 -2
- package/dist/features/orders/components/OrdersList.js +2 -1
- package/dist/features/orders/components/RefundHistoryTable.js +4 -1
- package/dist/features/orders/components/RefundRequestView.js +2 -1
- package/dist/features/orders/hooks/useOrders.d.ts +2 -2
- package/dist/features/payments/hooks/usePayments.d.ts +1 -1
- package/dist/features/pre-orders/components/MarketplacePreorderCard.js +5 -1
- package/dist/features/pre-orders/components/PreOrderActionsClient.js +3 -3
- package/dist/features/pre-orders/components/PreOrderBadge.js +2 -1
- package/dist/features/pre-orders/components/PreOrderDetailPageView.js +16 -7
- package/dist/features/pre-orders/components/PreOrdersIndexListing.js +32 -24
- package/dist/features/pre-orders/hooks/usePreOrders.d.ts +2 -2
- package/dist/features/products/columns/productTableColumns.js +9 -4
- package/dist/features/products/components/AuctionsIndexListing.js +9 -3
- package/dist/features/products/components/BidHistory.js +4 -4
- package/dist/features/products/components/CompareOverlay.js +10 -2
- package/dist/features/products/components/CustomFieldsEditor.js +2 -1
- package/dist/features/products/components/CustomSectionTabContent.js +2 -2
- package/dist/features/products/components/CustomSectionsEditor.js +3 -2
- package/dist/features/products/components/GroupSettingsPanel.js +34 -26
- package/dist/features/products/components/MakeOfferButton.js +6 -2
- package/dist/features/products/components/MakeOfferForm.js +2 -1
- package/dist/features/products/components/MarketplaceBundleCard.js +6 -3
- package/dist/features/products/components/MarketplacePrizeDrawCard.js +3 -2
- package/dist/features/products/components/PlaceBidForm.js +2 -1
- package/dist/features/products/components/PrizeDrawCollage.js +6 -2
- package/dist/features/products/components/PrizeDrawDetailPageView.js +6 -1
- package/dist/features/products/components/PrizeDrawItemsEditor.js +4 -2
- package/dist/features/products/components/PrizeDrawsIndexListing.js +6 -3
- package/dist/features/products/components/PrizeDrawsSection.js +2 -2
- package/dist/features/products/components/PrizeRevealModal.js +5 -1
- package/dist/features/products/components/ProductDetailPageView.js +32 -16
- package/dist/features/products/components/ProductFeatureBadges.js +9 -9
- package/dist/features/products/components/ProductForm.d.ts +11 -1
- package/dist/features/products/components/ProductForm.js +10 -5
- package/dist/features/products/components/ProductGalleryClient.js +8 -4
- package/dist/features/products/components/ProductGradingTab.js +4 -1
- package/dist/features/products/components/ProductGrid.js +35 -14
- package/dist/features/products/components/ProductInfo.js +2 -1
- package/dist/features/products/components/ProductTabs.js +2 -1
- package/dist/features/products/components/ProductTabsShell.js +5 -1
- package/dist/features/products/components/ProductsIndexListing.js +32 -24
- package/dist/features/products/components/ProductsIndexPageView.js +2 -2
- package/dist/features/products/components/RelatedProducts.js +3 -3
- package/dist/features/products/components/ShowGroupSection.js +10 -6
- package/dist/features/products/components/SublistingCarouselSection.js +7 -3
- package/dist/features/products/components/SublistingCategorySelect.d.ts +3 -1
- package/dist/features/products/components/SublistingCategorySelect.js +4 -37
- package/dist/features/products/constants/action-defs.js +3 -3
- package/dist/features/products/hooks/useProductDetail.d.ts +1 -1
- package/dist/features/products/hooks/useRelatedProducts.d.ts +1 -1
- package/dist/features/promotions/components/CouponCard.js +5 -3
- package/dist/features/promotions/components/CouponsIndexListing.js +7 -3
- package/dist/features/promotions/hooks/usePromotions.d.ts +2 -2
- package/dist/features/promotions/repository/coupons.repository.d.ts +8 -0
- package/dist/features/promotions/repository/coupons.repository.js +2 -0
- package/dist/features/reviews/components/ReviewDetailPageView.js +3 -3
- package/dist/features/reviews/components/ReviewDetailShell.js +15 -3
- package/dist/features/reviews/components/ReviewSummary.js +4 -2
- package/dist/features/reviews/components/ReviewsIndexListing.js +8 -2
- package/dist/features/reviews/components/ReviewsList.js +1 -1
- package/dist/features/reviews/hooks/useReviews.d.ts +2 -2
- package/dist/features/scams/components/ScamAwarenessModal.js +2 -2
- package/dist/features/scams/components/ScamProfileView.js +3 -3
- package/dist/features/scams/components/ScamRegistryView.js +6 -4
- package/dist/features/search/components/Search.js +9 -6
- package/dist/features/search/components/SearchFiltersRow.js +1 -1
- package/dist/features/search/components/SearchResultsSection.js +1 -1
- package/dist/features/search/hooks/useSearch.d.ts +2 -2
- package/dist/features/seller/components/CouponInlineSelect.d.ts +22 -0
- package/dist/features/seller/components/CouponInlineSelect.js +103 -0
- package/dist/features/seller/components/GroupInlineSelect.d.ts +23 -0
- package/dist/features/seller/components/GroupInlineSelect.js +80 -0
- package/dist/features/seller/components/PhysicalLocationModal.js +2 -1
- package/dist/features/seller/components/PrintCenterView.js +2 -1
- package/dist/features/seller/components/ProductInlineSelect.d.ts +24 -0
- package/dist/features/seller/components/ProductInlineSelect.js +42 -0
- package/dist/features/seller/components/QuickProductForm.js +4 -1
- package/dist/features/seller/components/SellerAddressesView.js +8 -3
- package/dist/features/seller/components/SellerAnalyticsAlertsView.js +6 -3
- package/dist/features/seller/components/SellerAnalyticsView.js +2 -2
- package/dist/features/seller/components/SellerBidsView.js +7 -7
- package/dist/features/seller/components/SellerBundlesView.js +2 -1
- package/dist/features/seller/components/SellerCouponEditorView.d.ts +2 -0
- package/dist/features/seller/components/SellerCouponEditorView.js +15 -3
- package/dist/features/seller/components/SellerCouponsView.js +1 -1
- package/dist/features/seller/components/SellerDashboardView.js +2 -2
- package/dist/features/seller/components/SellerDigitalCodesView.js +2 -2
- package/dist/features/seller/components/SellerGoogleReviewsView.js +2 -2
- package/dist/features/seller/components/SellerGroupedListingsView.js +5 -5
- package/dist/features/seller/components/SellerOrdersView.js +13 -10
- package/dist/features/seller/components/SellerPayoutMethodsView.js +5 -4
- package/dist/features/seller/components/SellerPayoutRequestView.js +5 -1
- package/dist/features/seller/components/SellerPayoutSettingsView.js +5 -2
- package/dist/features/seller/components/SellerPreOrdersView.js +6 -6
- package/dist/features/seller/components/SellerPrizeDrawsView.js +6 -6
- package/dist/features/seller/components/SellerProductShell.js +1 -1
- package/dist/features/seller/components/SellerProductsCards.js +4 -1
- package/dist/features/seller/components/SellerProductsView.js +5 -5
- package/dist/features/seller/components/SellerReviewsView.js +7 -3
- package/dist/features/seller/components/SellerShippingConfigsView.js +4 -4
- package/dist/features/seller/components/SellerShippingView.js +1 -1
- package/dist/features/seller/components/SellerSidebar.js +15 -8
- package/dist/features/seller/components/SellerStoreCategoriesView.js +1 -1
- package/dist/features/seller/components/SellerStorefrontView.js +2 -2
- package/dist/features/seller/components/SellerTemplatesView.js +7 -4
- package/dist/features/seller/components/SublistingInlineSelect.d.ts +19 -0
- package/dist/features/seller/components/SublistingInlineSelect.js +83 -0
- package/dist/features/seller/components/analytics/SellerTopProducts.js +1 -1
- package/dist/features/seller/components/index.d.ts +8 -0
- package/dist/features/seller/components/index.js +4 -0
- package/dist/features/seller/hooks/useSellerPayouts.d.ts +3 -3
- package/dist/features/seller/hooks/useSellerStore.d.ts +6 -6
- package/dist/features/seller/hooks/useSellerStorefront.d.ts +2 -2
- package/dist/features/shell/FormShell.js +10 -2
- package/dist/features/shell/QuickFormDrawer.js +5 -5
- package/dist/features/shell/StepForm.js +6 -6
- package/dist/features/site-settings/components/ActionPermissionsManager.js +8 -4
- package/dist/features/site-settings/components/NavPermissionsManager.js +7 -4
- package/dist/features/stores/components/InteractiveStoreCard.js +5 -1
- package/dist/features/stores/components/StoreAboutView.js +4 -1
- package/dist/features/stores/components/StoreAddressSelectorCreate.d.ts +2 -1
- package/dist/features/stores/components/StoreAddressSelectorCreate.js +5 -31
- package/dist/features/stores/components/StoreAuctionsListing.js +6 -3
- package/dist/features/stores/components/StoreGuideHubView.js +5 -2
- package/dist/features/stores/components/StoreHeader.js +8 -1
- package/dist/features/stores/components/StorePreOrdersListing.js +6 -3
- package/dist/features/stores/components/StoreProductsListing.js +6 -3
- package/dist/features/stores/components/StoreReviewsListing.js +8 -2
- package/dist/features/stores/components/StoresIndexListing.js +12 -6
- package/dist/features/stores/hooks/useStoreAddressSelector.d.ts +1 -1
- package/dist/features/stores/hooks/useStores.d.ts +6 -6
- package/dist/features/whatsapp-bot/components/SellerWhatsAppSettingsView.js +7 -1
- package/dist/features/whatsapp-bot/components/WhatsAppChatButton.js +2 -1
- package/dist/features/wishlist/components/WishlistPage.js +2 -1
- package/dist/features/wishlist/hooks/useUserWishlist.d.ts +15 -15
- package/dist/features/wishlist/hooks/useWishlist.d.ts +1 -1
- package/dist/features/wishlist/hooks/useWishlistWithGuest.d.ts +1 -1
- package/dist/index.d.ts +10 -0
- package/dist/index.js +13 -1
- package/dist/next/components/GlobalError.js +2 -2
- package/dist/next/routing/route-map.d.ts +2 -0
- package/dist/next/routing/route-map.js +1 -0
- package/dist/providers/db-firebase/base.repository.d.ts +1 -1
- package/dist/react/ErrorBoundary.js +2 -2
- package/dist/seed/actions/demo-seed-actions.d.ts +1 -1
- package/dist/seed/manifest.js +10 -0
- package/dist/styles.css +2 -1
- package/dist/tailwind-utilities.css +1 -1
- package/dist/ui/DataTable.js +17 -16
- package/dist/ui/components/DateInput.js +2 -2
- package/dist/ui/components/DetailPageGallery.js +4 -1
- package/dist/ui/components/DetailPageTabs.js +6 -2
- package/dist/ui/components/ImageLightbox.js +5 -3
- package/dist/ui/components/Input.js +6 -3
- package/dist/ui/components/Layout.d.ts +4 -0
- package/dist/ui/components/Layout.js +1 -1
- package/dist/ui/components/Layout.style.css +1 -0
- package/dist/ui/components/ListingFilterDrawer.js +4 -1
- package/dist/ui/components/ListingLayout.js +9 -8
- package/dist/ui/components/ListingToolbar.js +5 -1
- package/dist/ui/components/PaginatedSelect.d.ts +1 -2
- package/dist/ui/components/PaginatedSelect.js +1 -2
- package/dist/ui/components/Radio.js +1 -1
- package/dist/ui/components/Select.js +2 -1
- package/dist/ui/components/Slider.js +1 -1
- package/dist/ui/components/VacationBanner.js +2 -1
- package/dist/ui/components/surface-tokens.d.ts +1 -0
- package/dist/ui/components/surface-tokens.js +1 -0
- package/package.json +22 -4
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { ROUTES } from "../../../constants";
|
|
3
3
|
import { THEME_CONSTANTS } from "../../../tokens";
|
|
4
|
-
import { Heading, Text, Section, Stack } from "../../../ui";
|
|
4
|
+
import { Div, Heading, Text, Section, Stack } from "../../../ui";
|
|
5
5
|
import { TextLink } from "../../../ui";
|
|
6
6
|
import { ShieldAlert, Home, LogIn } from "lucide-react";
|
|
7
7
|
const DEFAULT_HERO_CLASS = "bg-gradient-to-br from-rose-600 to-red-700 dark:from-rose-700 dark:to-red-800";
|
|
@@ -23,7 +23,7 @@ export async function UnauthorizedView({ heroBannerClass = DEFAULT_HERO_CLASS, }
|
|
|
23
23
|
isPrimary: false,
|
|
24
24
|
},
|
|
25
25
|
];
|
|
26
|
-
return (_jsxs(
|
|
26
|
+
return (_jsxs(Div, { className: "-mx-4 md:-mx-6 lg:-mx-8 -mt-6 sm:-mt-8 lg:-mt-10", children: [_jsx(Section, { className: `${heroBannerClass} text-white min-h-[60vh] flex flex-col items-center justify-center py-20 text-center`, children: _jsxs(Div, { className: `${page.container.sm}`, children: [_jsx(Div, { className: `w-20 h-20 rounded-2xl bg-white/20 ${flex.center} mx-auto mb-6`, children: _jsx(ShieldAlert, { className: "w-10 h-10 text-white" }) }), _jsx(Heading, { level: 1, variant: "none", className: "mb-4 text-white text-4xl", children: t("title") }), _jsx(Text, { variant: "none", className: "text-white/80 max-w-lg mx-auto text-lg mb-8", children: t("subtitle") }), _jsx(Div, { className: `${flex.center} gap-4 flex-wrap`, children: LINKS.map(({ icon: Icon, label, href, isPrimary }) => (_jsx(TextLink, { href: href, className: isPrimary
|
|
27
27
|
? "bg-white text-rose-700 font-semibold px-6 py-2.5 rounded-xl hover:bg-white/90 transition-colors"
|
|
28
|
-
: "border border-white/40 text-white px-6 py-2.5 rounded-xl hover:bg-white/10 transition-colors", children: _jsxs("span", { className: "inline-flex items-center gap-2", children: [_jsx(Icon, { className: "w-4 h-4" }), label] }) }, href))) })] }) }), _jsx(
|
|
28
|
+
: "border border-white/40 text-white px-6 py-2.5 rounded-xl hover:bg-white/10 transition-colors", children: _jsxs("span", { className: "inline-flex items-center gap-2", children: [_jsx(Icon, { className: "w-4 h-4" }), label] }) }, href))) })] }) }), _jsx(Div, { className: `${page.container.sm} py-10`, children: _jsxs(Section, { className: `rounded-2xl p-6 text-center border ${themed.border} ${themed.bgSecondary}`, children: [_jsx(Heading, { level: 2, className: "mb-2 text-base", children: t("helpTitle") }), _jsx(Text, { variant: "secondary", className: "text-sm mb-3", children: t("helpText") }), _jsxs(Stack, { gap: "sm", className: "flex-row flex-wrap justify-center gap-4", children: [_jsx(TextLink, { href: String(ROUTES.PUBLIC.HELP), variant: "muted", className: "text-sm", children: t("helpCenter") }), _jsx(TextLink, { href: String(ROUTES.PUBLIC.CONTACT), variant: "muted", className: "text-sm", children: t("contact") })] })] }) })] }));
|
|
29
29
|
}
|
|
@@ -8,7 +8,7 @@ export function AddressCard({ address, onEdit, onDelete, onSetDefault, labels =
|
|
|
8
8
|
const line2 = "line2" in address && address.line2
|
|
9
9
|
? address.line2
|
|
10
10
|
: address.addressLine2;
|
|
11
|
-
return (_jsxs(Div, { surface: "card", padding: "sm", className: "relative", children: [address.isDefault && (_jsx(Span, { className: "absolute right-3 top-3 rounded-full bg-success-surface px-2 py-0.5 text-
|
|
11
|
+
return (_jsxs(Div, { surface: "card", padding: "sm", className: "relative", children: [address.isDefault && (_jsx(Span, { size: "xs", weight: "medium", className: "absolute right-3 top-3 rounded-full bg-success-surface px-2 py-0.5 text-success", children: labels.defaultBadge ?? "Default" })), address.label && (_jsx(Text, { className: "mb-1 text-xs font-semibold uppercase tracking-wide text-neutral-500 dark:text-zinc-400", children: address.label })), _jsx(Text, { className: "text-sm text-neutral-900 dark:text-zinc-100", children: line1 }), line2 && _jsx(Text, { className: "text-sm text-neutral-900 dark:text-zinc-100", children: line2 }), _jsxs(Text, { className: "text-sm text-neutral-900 dark:text-zinc-100", children: [address.city, ", ", address.state, " ", address.postalCode] }), _jsx(Text, { className: "text-sm text-neutral-900 dark:text-zinc-100", children: address.country }), address.phone && (_jsx(Text, { className: "mt-1 text-sm text-neutral-500 dark:text-zinc-400", children: address.phone })), _jsxs(Div, { className: `mt-3 flex ${THEME_CONSTANTS.spacing.gap.xs}`, children: [onEdit && (_jsx(Button, { onClick: () => onEdit(address), variant: "ghost", size: "sm", className: "text-xs font-medium text-primary hover:underline", children: labels.edit ?? "Edit" })), onDelete && (_jsx(Button, { onClick: () => onDelete(address.id), variant: "ghost", size: "sm", className: "text-xs font-medium text-error hover:underline", children: labels.delete ?? "Delete" })), !address.isDefault && onSetDefault && (_jsx(Button, { onClick: () => onSetDefault(address.id), variant: "outline", size: "sm", className: "ml-auto text-xs font-medium", children: labels.setDefault ?? "Set default" }))] })] }));
|
|
12
12
|
}
|
|
13
13
|
export function AddressBook({ addresses, onEdit, onDelete, onSetDefault, onAdd, emptyLabel = "No saved addresses", addLabel = "Add Address", }) {
|
|
14
14
|
return (_jsxs(Div, { className: "space-y-4", children: [addresses.length === 0 && (_jsx(Text, { className: "text-sm text-neutral-500 dark:text-zinc-400", children: emptyLabel })), _jsx(Div, { className: `grid ${THEME_CONSTANTS.spacing.gap.md} sm:grid-cols-2`, children: addresses.map((addr) => (_jsx(AddressCard, { address: addr, onEdit: onEdit, onDelete: onDelete, onSetDefault: onSetDefault }, addr.id))) }), onAdd && (_jsxs(Button, { onClick: onAdd, variant: "outline", className: "mt-2 rounded-lg border border-dashed border-neutral-300 dark:border-slate-600 px-4 py-3 text-sm font-medium text-neutral-500 dark:text-zinc-400 transition hover:border-neutral-400 dark:hover:border-slate-500 hover:text-neutral-700 dark:hover:text-zinc-200", children: ["+ ", addLabel] }))] }));
|
|
@@ -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 { Button, Checkbox, FormField, FormGroup } from "../../../ui";
|
|
4
|
+
import { Button, Checkbox, Div, FormField, FormGroup } from "../../../ui";
|
|
5
5
|
import { useFormShellState } from "../../../ui/forms";
|
|
6
6
|
import { THEME_CONSTANTS } from "../../../tokens";
|
|
7
7
|
const DEFAULT_LABELS = {
|
|
@@ -74,5 +74,5 @@ export function AddressForm({ initialData, onSubmit, onCancel, isLoading = false
|
|
|
74
74
|
}
|
|
75
75
|
await onSubmit(formData);
|
|
76
76
|
};
|
|
77
|
-
return (_jsxs("form", { onSubmit: handleSubmit, className: "space-y-4", children: [_jsx(FormField, { label: mergedLabels.label, name: "label", type: "text", value: formData.label, onChange: (value) => handleChange("label", value), placeholder: mergedPlaceholders.label, required: true }), _jsx(FormField, { label: mergedLabels.fullName, name: "fullName", type: "text", value: formData.fullName, onChange: (value) => handleChange("fullName", value), placeholder: mergedPlaceholders.fullName, required: true, error: shellCtx.errors["fullName"] }), _jsx(FormField, { label: mergedLabels.phone, name: "phone", type: "tel", value: formData.phone, onChange: (value) => handleChange("phone", value), placeholder: mergedPlaceholders.phone, required: true, error: shellCtx.errors["phone"] }), _jsx(FormField, { label: mergedLabels.addressLine1, name: "addressLine1", type: "text", value: formData.addressLine1, onChange: (value) => handleChange("addressLine1", value), placeholder: mergedPlaceholders.addressLine1, required: true, error: shellCtx.errors["addressLine1"] }), _jsx(FormField, { label: mergedLabels.addressLine2, name: "addressLine2", type: "text", value: formData.addressLine2, onChange: (value) => handleChange("addressLine2", value), placeholder: mergedPlaceholders.addressLine2 }), _jsxs(FormGroup, { columns: 3, children: [_jsx(FormField, { label: mergedLabels.city, name: "city", type: "text", value: formData.city, onChange: (value) => handleChange("city", value), placeholder: mergedPlaceholders.city, required: true, error: shellCtx.errors["city"] }), _jsx(FormField, { label: mergedLabels.state, name: "state", type: "text", value: formData.state, onChange: (value) => handleChange("state", value), placeholder: mergedPlaceholders.state, required: true, error: shellCtx.errors["state"] }), _jsx(FormField, { label: mergedLabels.postalCode, name: "postalCode", type: "text", value: formData.postalCode, onChange: (value) => handleChange("postalCode", value), placeholder: mergedPlaceholders.postalCode, required: true, error: shellCtx.errors["postalCode"] })] }), _jsx(FormField, { label: mergedLabels.country, name: "country", type: "text", value: formData.country, onChange: (value) => handleChange("country", value), placeholder: mergedPlaceholders.country, required: true }), _jsx(Checkbox, { checked: formData.isDefault, onChange: (e) => handleChange("isDefault", e.target.checked), label: mergedLabels.setDefault }), _jsxs(
|
|
77
|
+
return (_jsxs("form", { onSubmit: handleSubmit, className: "space-y-4", children: [_jsx(FormField, { label: mergedLabels.label, name: "label", type: "text", value: formData.label, onChange: (value) => handleChange("label", value), placeholder: mergedPlaceholders.label, required: true }), _jsx(FormField, { label: mergedLabels.fullName, name: "fullName", type: "text", value: formData.fullName, onChange: (value) => handleChange("fullName", value), placeholder: mergedPlaceholders.fullName, required: true, error: shellCtx.errors["fullName"] }), _jsx(FormField, { label: mergedLabels.phone, name: "phone", type: "tel", value: formData.phone, onChange: (value) => handleChange("phone", value), placeholder: mergedPlaceholders.phone, required: true, error: shellCtx.errors["phone"] }), _jsx(FormField, { label: mergedLabels.addressLine1, name: "addressLine1", type: "text", value: formData.addressLine1, onChange: (value) => handleChange("addressLine1", value), placeholder: mergedPlaceholders.addressLine1, required: true, error: shellCtx.errors["addressLine1"] }), _jsx(FormField, { label: mergedLabels.addressLine2, name: "addressLine2", type: "text", value: formData.addressLine2, onChange: (value) => handleChange("addressLine2", value), placeholder: mergedPlaceholders.addressLine2 }), _jsxs(FormGroup, { columns: 3, children: [_jsx(FormField, { label: mergedLabels.city, name: "city", type: "text", value: formData.city, onChange: (value) => handleChange("city", value), placeholder: mergedPlaceholders.city, required: true, error: shellCtx.errors["city"] }), _jsx(FormField, { label: mergedLabels.state, name: "state", type: "text", value: formData.state, onChange: (value) => handleChange("state", value), placeholder: mergedPlaceholders.state, required: true, error: shellCtx.errors["state"] }), _jsx(FormField, { label: mergedLabels.postalCode, name: "postalCode", type: "text", value: formData.postalCode, onChange: (value) => handleChange("postalCode", value), placeholder: mergedPlaceholders.postalCode, required: true, error: shellCtx.errors["postalCode"] })] }), _jsx(FormField, { label: mergedLabels.country, name: "country", type: "text", value: formData.country, onChange: (value) => handleChange("country", value), placeholder: mergedPlaceholders.country, required: true }), _jsx(Checkbox, { checked: formData.isDefault, onChange: (e) => handleChange("isDefault", e.target.checked), label: mergedLabels.setDefault }), _jsxs(Div, { className: `flex items-center justify-start ${THEME_CONSTANTS.spacing.gap.xs} pt-2`, children: [_jsx(Button, { type: "button", variant: "outline", onClick: onCancel, disabled: isLoading, children: mergedLabels.cancel }), _jsx(Button, { type: "submit", variant: "primary", disabled: isLoading, children: isLoading ? mergedLabels.loading : effectiveSubmitLabel })] })] }));
|
|
78
78
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
type OwnerType = "user" | "store";
|
|
2
|
+
interface BaseProps {
|
|
3
|
+
ownerType: OwnerType;
|
|
4
|
+
placeholder?: string;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
/** Show the "+ Create new address" drawer. Defaults to true. */
|
|
7
|
+
allowCreate?: boolean;
|
|
8
|
+
drawerTitle?: string;
|
|
9
|
+
/** Fires after a new address is created and auto-selected. */
|
|
10
|
+
onCreated?: (id: string) => void;
|
|
11
|
+
}
|
|
12
|
+
interface SingleProps extends BaseProps {
|
|
13
|
+
multiple?: false;
|
|
14
|
+
value: string;
|
|
15
|
+
onChange: (id: string) => void;
|
|
16
|
+
}
|
|
17
|
+
interface MultiProps extends BaseProps {
|
|
18
|
+
multiple: true;
|
|
19
|
+
value: string[];
|
|
20
|
+
onChange: (ids: string[]) => void;
|
|
21
|
+
}
|
|
22
|
+
export type AddressInlineSelectProps = SingleProps | MultiProps;
|
|
23
|
+
export declare function AddressInlineSelect(props: AddressInlineSelectProps): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useCallback, useMemo, useState } from "react";
|
|
4
|
+
import { PaginatedSelect } from "../../../ui/components/PaginatedSelect";
|
|
5
|
+
import { apiClient } from "../../../http";
|
|
6
|
+
import { ACCOUNT_ENDPOINTS, SELLER_ENDPOINTS, } from "../../../constants/api-endpoints";
|
|
7
|
+
import { AddressForm } from "./AddressForm";
|
|
8
|
+
function endpointFor(ownerType) {
|
|
9
|
+
return ownerType === "store"
|
|
10
|
+
? SELLER_ENDPOINTS.STORE_ADDRESSES
|
|
11
|
+
: ACCOUNT_ENDPOINTS.ADDRESSES;
|
|
12
|
+
}
|
|
13
|
+
function formatLabel(addr) {
|
|
14
|
+
const parts = [addr.label, addr.fullName, addr.city, addr.state].filter(Boolean);
|
|
15
|
+
return parts.length > 0 ? parts.join(" — ") : (addr.id ?? "Address");
|
|
16
|
+
}
|
|
17
|
+
function makeLoader(ownerType) {
|
|
18
|
+
return async (query, _page) => {
|
|
19
|
+
const raw = await apiClient.get(endpointFor(ownerType));
|
|
20
|
+
const list = Array.isArray(raw) ? raw : (raw?.data ?? []);
|
|
21
|
+
const all = list.map((addr) => ({
|
|
22
|
+
value: String(addr.id ?? ""),
|
|
23
|
+
label: formatLabel(addr),
|
|
24
|
+
}));
|
|
25
|
+
const q = query.trim().toLowerCase();
|
|
26
|
+
const items = q
|
|
27
|
+
? all.filter((a) => a.label.toLowerCase().includes(q))
|
|
28
|
+
: all;
|
|
29
|
+
return { items, hasMore: false };
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function CreateAddressForm({ ownerType, onCreated, onCancel, }) {
|
|
33
|
+
const [saving, setSaving] = useState(false);
|
|
34
|
+
const handleSubmit = useCallback(async (data) => {
|
|
35
|
+
setSaving(true);
|
|
36
|
+
try {
|
|
37
|
+
const result = await apiClient.post(endpointFor(ownerType), { ...data, isDefault: data.isDefault ?? false });
|
|
38
|
+
const id = String(result?.id ?? "");
|
|
39
|
+
if (!id)
|
|
40
|
+
return;
|
|
41
|
+
onCreated({
|
|
42
|
+
value: id,
|
|
43
|
+
label: formatLabel({
|
|
44
|
+
id,
|
|
45
|
+
label: data.label,
|
|
46
|
+
fullName: data.fullName,
|
|
47
|
+
city: data.city,
|
|
48
|
+
state: data.state,
|
|
49
|
+
}),
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
finally {
|
|
53
|
+
setSaving(false);
|
|
54
|
+
}
|
|
55
|
+
}, [ownerType, onCreated]);
|
|
56
|
+
return (_jsx(AddressForm, { onSubmit: handleSubmit, onCancel: onCancel, isLoading: saving, submitLabel: "Save" }));
|
|
57
|
+
}
|
|
58
|
+
export function AddressInlineSelect(props) {
|
|
59
|
+
const { ownerType, placeholder = "Select an address…", disabled, allowCreate = true, drawerTitle, onCreated, } = props;
|
|
60
|
+
const loader = useMemo(() => makeLoader(ownerType), [ownerType]);
|
|
61
|
+
const renderCreateForm = allowCreate
|
|
62
|
+
? ({ onCreated: optCreated, onCancel, }) => (_jsx(CreateAddressForm, { ownerType: ownerType, onCreated: (opt) => {
|
|
63
|
+
optCreated(opt);
|
|
64
|
+
onCreated?.(opt.value);
|
|
65
|
+
}, onCancel: onCancel }))
|
|
66
|
+
: undefined;
|
|
67
|
+
const sharedCreate = allowCreate
|
|
68
|
+
? {
|
|
69
|
+
createLabel: "address",
|
|
70
|
+
drawerTitle: drawerTitle ?? "Add address",
|
|
71
|
+
renderCreateForm,
|
|
72
|
+
}
|
|
73
|
+
: {};
|
|
74
|
+
if (props.multiple) {
|
|
75
|
+
return (_jsx(PaginatedSelect, { multiple: true, value: props.value, onChange: (v) => props.onChange(v), loadOptions: loader, placeholder: placeholder, disabled: disabled, ...sharedCreate }));
|
|
76
|
+
}
|
|
77
|
+
return (_jsx(PaginatedSelect, { value: props.value || null, onChange: (v) => props.onChange(v ?? ""), loadOptions: loader, placeholder: placeholder, disabled: disabled, ...sharedCreate }));
|
|
78
|
+
}
|
|
@@ -11,6 +11,7 @@ export interface AddressSelectorCreateProps {
|
|
|
11
11
|
label?: string;
|
|
12
12
|
labels?: Partial<AddressSelectorCreateLabels>;
|
|
13
13
|
onCreated?: (id: string) => void;
|
|
14
|
+
/** Retained for backward-compat; AddressInlineSelect surfaces errors internally. */
|
|
14
15
|
onCreateError?: () => void;
|
|
15
16
|
}
|
|
16
|
-
export declare function AddressSelectorCreate({ value, onChange, disabled, label, labels, onCreated,
|
|
17
|
+
export declare function AddressSelectorCreate({ value, onChange, disabled, label, labels, onCreated, }: AddressSelectorCreateProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,41 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { useAddressSelector } from "../hooks/useAddressSelector";
|
|
6
|
-
import { AddressForm } from "./AddressForm";
|
|
7
|
-
import { THEME_CONSTANTS } from "../../../tokens";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Div, Label } from "../../../ui";
|
|
4
|
+
import { AddressInlineSelect } from "./AddressInlineSelect";
|
|
8
5
|
const DEFAULT_LABELS = {
|
|
9
6
|
addAddress: "Add Address",
|
|
10
7
|
save: "Save",
|
|
11
8
|
pickupAddress: "Address",
|
|
12
9
|
selectAddress: "Select an address",
|
|
13
10
|
};
|
|
14
|
-
export function AddressSelectorCreate({ value, onChange, disabled = false, label, labels, onCreated,
|
|
11
|
+
export function AddressSelectorCreate({ value, onChange, disabled = false, label, labels, onCreated, }) {
|
|
15
12
|
const mergedLabels = { ...DEFAULT_LABELS, ...labels };
|
|
16
|
-
|
|
17
|
-
const { addresses, isLoading, createAddress: mutate, isSaving, } = useAddressSelector({
|
|
18
|
-
onCreated: (id) => {
|
|
19
|
-
setDrawerOpen(false);
|
|
20
|
-
onChange(id);
|
|
21
|
-
onCreated?.(id);
|
|
22
|
-
},
|
|
23
|
-
onCreateError,
|
|
24
|
-
});
|
|
25
|
-
const handleAddressSubmit = useCallback(async (data) => {
|
|
26
|
-
await mutate(data);
|
|
27
|
-
}, [mutate]);
|
|
28
|
-
const formatLabel = (addr) => {
|
|
29
|
-
const parts = [addr.label, addr.fullName, addr.city, addr.state].filter(Boolean);
|
|
30
|
-
return parts.join(" - ");
|
|
31
|
-
};
|
|
32
|
-
return (_jsxs(_Fragment, { children: [_jsxs("div", { "data-section": "addressselectorcreate-div-224", children: [label && _jsx(Label, { className: "mb-1.5", children: label }), _jsxs("div", { className: `flex items-center ${THEME_CONSTANTS.spacing.gap.xs}`, "data-section": "addressselectorcreate-div-225", children: [_jsx("div", { className: "flex-1", "data-section": "addressselectorcreate-div-226", children: _jsx(Select, { value: value, onChange: (e) => onChange(e.target.value), disabled: disabled || isLoading, "aria-label": label ?? mergedLabels.pickupAddress, options: [
|
|
33
|
-
{ value: "", label: mergedLabels.selectAddress },
|
|
34
|
-
...addresses.map((addr) => ({
|
|
35
|
-
value: addr.id,
|
|
36
|
-
label: formatLabel(addr),
|
|
37
|
-
})),
|
|
38
|
-
] }) }), !disabled && (_jsxs(Button, { variant: "outline", size: "sm", type: "button", onClick: () => setDrawerOpen(true), "aria-haspopup": "dialog", children: ["+ ", mergedLabels.addAddress] }))] })] }), _jsx(SideDrawer, { isOpen: drawerOpen, onClose: () => setDrawerOpen(false), title: mergedLabels.addAddress, mode: "create", children: _jsx(AddressForm, { onSubmit: handleAddressSubmit, onCancel: () => setDrawerOpen(false), isLoading: isSaving, submitLabel: mergedLabels.save, labels: {
|
|
39
|
-
save: mergedLabels.save,
|
|
40
|
-
} }) })] }));
|
|
13
|
+
return (_jsxs(Div, { children: [label && _jsx(Label, { className: "mb-1.5", children: label }), _jsx(AddressInlineSelect, { ownerType: "user", value: value, onChange: onChange, disabled: disabled, allowCreate: !disabled, placeholder: mergedLabels.selectAddress, drawerTitle: mergedLabels.addAddress, onCreated: onCreated })] }));
|
|
41
14
|
}
|
|
@@ -3,7 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { useState, useCallback, useMemo } from "react";
|
|
4
4
|
import { useUrlTable } from "../../../react/hooks/useUrlTable";
|
|
5
5
|
import { useAddresses } from "../hooks/useAddresses";
|
|
6
|
-
import { ListingFilterDrawer, ListingToolbar, Text } from "../../../ui";
|
|
6
|
+
import { Div, ListingFilterDrawer, ListingToolbar, Text } from "../../../ui";
|
|
7
7
|
import { AddressBook } from "./AddressBook";
|
|
8
8
|
import { AddressFilters } from "./AddressFilters";
|
|
9
9
|
import { TABLE_KEYS, VIEW_MODE } from "../../../constants/table-keys";
|
|
@@ -73,6 +73,6 @@ export function AddressesIndexListing({ onAdd, onEdit, onDelete, }) {
|
|
|
73
73
|
activeOnly: table.get("activeOnly") === "true" || undefined,
|
|
74
74
|
},
|
|
75
75
|
});
|
|
76
|
-
return (_jsxs(
|
|
77
|
-
return; setView(v); }, onResetAll: resetAll, hasActiveState: hasActiveState }), _jsx(
|
|
76
|
+
return (_jsxs(Div, { className: "space-y-4", children: [_jsx(ListingToolbar, { filterCount: activeFilterCount, onFiltersClick: openFilters, searchValue: searchInput, searchPlaceholder: "Search by address, postcode or label...", onSearchChange: setSearchInput, onSearchCommit: commitSearch, view: view, onViewChange: (v) => { if (v === "table")
|
|
77
|
+
return; setView(v); }, onResetAll: resetAll, hasActiveState: hasActiveState }), _jsx(Div, { className: "px-3 sm:px-4", children: isLoading ? (_jsx(Div, { className: "grid sm:grid-cols-2 gap-4", children: Array.from({ length: 4 }).map((_, i) => (_jsxs("div", { className: "rounded-xl border border-zinc-200 dark:border-slate-700 animate-pulse p-4 space-y-2", children: [_jsx(Div, { className: "h-4 bg-zinc-200 dark:bg-slate-700 rounded w-1/3" }), _jsx(Div, { className: "h-3 bg-zinc-200 dark:bg-slate-700 rounded w-3/4" }), _jsx(Div, { className: "h-3 bg-zinc-200 dark:bg-slate-700 rounded w-1/2" })] }, i))) })) : addresses.length === 0 ? (_jsx(Text, { className: "py-8 text-center text-sm text-zinc-500 dark:text-zinc-400", children: table.get(TABLE_KEYS.QUERY) ? `No addresses matching "${table.get(TABLE_KEYS.QUERY)}"` : "No saved addresses." })) : (_jsx(AddressBook, { addresses: addresses, onEdit: onEdit, onDelete: onDelete, onAdd: onAdd })) }), _jsx(ListingFilterDrawer, { open: filterOpen, onClose: () => setFilterOpen(false), onApply: applyFilters, onClear: clearFilters, activeCount: activeFilterCount, children: _jsx(AddressFilters, { table: pendingTable }) })] }));
|
|
78
78
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Div, Heading, Row, Span } from "../../../ui";
|
|
3
3
|
import { THEME_CONSTANTS } from "../../../tokens";
|
|
4
|
+
const CLS_DOT_ON = "bg-emerald-500";
|
|
4
5
|
export function ChatWindow({ labels = {}, isConnected = true, isLoading = false, error, renderLoadingIndicator, renderMessages, renderInput, className = "", }) {
|
|
5
|
-
return (_jsxs(Div, { className: className, children: [_jsxs(Row, { justify: "between", className: "pb-3 border-b border-neutral-200 dark:border-neutral-700 mb-3", children: [_jsxs(Row, { className: THEME_CONSTANTS.spacing.gap.xs, children: [labels.title && _jsx(Heading, { level: 4, children: labels.title }), _jsx(Span, { className: `w-2 h-2 rounded-full ${isConnected ?
|
|
6
|
+
return (_jsxs(Div, { className: className, children: [_jsxs(Row, { justify: "between", className: "pb-3 border-b border-neutral-200 dark:border-neutral-700 mb-3", children: [_jsxs(Row, { className: THEME_CONSTANTS.spacing.gap.xs, children: [labels.title && _jsx(Heading, { level: 4, children: labels.title }), _jsx(Span, { className: `w-2 h-2 rounded-full ${isConnected ? CLS_DOT_ON : "bg-zinc-400"}`, "aria-label": isConnected ? labels.connected : labels.disconnected })] }), isLoading && (renderLoadingIndicator?.() ?? null)] }), error ?? null, renderMessages(), renderInput()] }));
|
|
6
7
|
}
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useCallback, useRef, useState } from "react";
|
|
4
|
-
import { Button, Heading, Li, Row, Spinner, Span, Text, TextLink, Ul, } from "../../../ui";
|
|
4
|
+
import { Button, Heading, Li, Div, Row, Spinner, Span, Text, TextLink, Ul, } from "../../../ui";
|
|
5
5
|
import { useClickOutside, useMessage } from "../../../react";
|
|
6
6
|
import { formatRelativeTime } from "../../../utils";
|
|
7
7
|
import { THEME_CONSTANTS } from "../../../tokens";
|
|
8
8
|
import { useNotifications } from "../hooks/useNotifications";
|
|
9
|
+
const __O = {
|
|
10
|
+
hidden: "overflow-hidden",
|
|
11
|
+
yAuto: "overflow-y-auto",
|
|
12
|
+
};
|
|
13
|
+
const CLS_UNREAD_BADGE = "absolute -top-1 -right-1 bg-red-500 text-white min-w-[20px] h-5 px-1.5 flex items-center justify-center rounded-full shadow-md";
|
|
14
|
+
const CLS_UNREAD_PILL = "ml-2 bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400 px-2 py-0.5 rounded-full";
|
|
9
15
|
const DEFAULT_ICONS = {
|
|
10
16
|
order_placed: "🛍️",
|
|
11
17
|
order_confirmed: "✅",
|
|
@@ -67,7 +73,7 @@ export function NotificationBell({ limit = 10, viewAllHref, labels, icons, rende
|
|
|
67
73
|
}, [handleMarkRead, setIsOpen]);
|
|
68
74
|
const renderActionLink = renderLink ??
|
|
69
75
|
((props) => (_jsx(TextLink, { href: props.href, onClick: props.onClick, className: props.className, children: props.children })));
|
|
70
|
-
return (_jsxs(
|
|
76
|
+
return (_jsxs(Div, { className: "relative", ref: dropdownRef, children: [renderBellButton({ hideOnMobile, buttonClassName, labels, unreadCount, handleToggle, isOpen }), isOpen && renderNotificationDropdown({
|
|
71
77
|
dropdownClassName, labels, unreadCount, isMarkingAll, handleMarkAllRead,
|
|
72
78
|
isLoading, notifications: notifications, notificationIcons,
|
|
73
79
|
handleMarkRead, handleMarkReadAndClose, renderActionLink, viewAllHref,
|
|
@@ -76,17 +82,17 @@ export function NotificationBell({ limit = 10, viewAllHref, labels, icons, rende
|
|
|
76
82
|
}
|
|
77
83
|
function renderBellButton(props) {
|
|
78
84
|
const { hideOnMobile, buttonClassName, labels, unreadCount, handleToggle, isOpen } = props;
|
|
79
|
-
return (_jsxs(Button, { onClick: handleToggle, className: `${hideOnMobile ? "hidden md:flex" : "flex"} p-2.5 md:p-3 rounded-xl transition-colors relative text-zinc-600 hover:bg-zinc-100 hover:text-zinc-900 dark:text-zinc-300 dark:hover:bg-slate-800 dark:hover:text-white ${buttonClassName}`, "aria-label": labels.title, "aria-expanded": isOpen, children: [_jsx("svg", { className: "w-6 h-6 md:w-7 md:h-7", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", "aria-hidden": "true", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9" }) }), unreadCount > 0 && (_jsx(Span, {
|
|
85
|
+
return (_jsxs(Button, { onClick: handleToggle, className: `${hideOnMobile ? "hidden md:flex" : "flex"} p-2.5 md:p-3 rounded-xl transition-colors relative text-zinc-600 hover:bg-zinc-100 hover:text-zinc-900 dark:text-zinc-300 dark:hover:bg-slate-800 dark:hover:text-white ${buttonClassName}`, "aria-label": labels.title, "aria-expanded": isOpen, children: [_jsx("svg", { className: "w-6 h-6 md:w-7 md:h-7", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", "aria-hidden": "true", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9" }) }), unreadCount > 0 && (_jsx(Span, { size: "xs", weight: "semibold", className: CLS_UNREAD_BADGE, children: unreadCount > 99 ? "99+" : unreadCount }))] }));
|
|
80
86
|
}
|
|
81
87
|
function renderNotificationDropdown(props) {
|
|
82
88
|
const { dropdownClassName, labels, unreadCount, isMarkingAll, handleMarkAllRead, isLoading, notifications, notificationIcons, handleMarkRead, handleMarkReadAndClose, renderActionLink, viewAllHref, setIsOpen } = props;
|
|
83
|
-
return (_jsxs(
|
|
89
|
+
return (_jsxs(Div, { className: `absolute right-0 top-full mt-2 w-80 sm:w-96 rounded-xl shadow-2xl border border-zinc-200 bg-white dark:border-slate-800 dark:bg-slate-950 z-50 ${__O.hidden} ${dropdownClassName}`, children: [_jsxs(Row, { justify: "between", gap: "none", className: "px-4 py-3 border-b border-zinc-200 dark:border-slate-800", children: [_jsxs(Heading, { level: 3, className: "font-semibold text-zinc-900 dark:text-white", children: [labels.title, unreadCount > 0 && _jsxs(Span, { size: "xs", weight: "medium", className: CLS_UNREAD_PILL, children: [unreadCount, " ", labels.unread] })] }), unreadCount > 0 && (_jsx(Button, { onClick: handleMarkAllRead, disabled: isMarkingAll, className: "text-xs text-primary hover:underline font-medium disabled:opacity-50", children: isMarkingAll ? labels.loading : labels.markAllRead }))] }), _jsx(Div, { className: `max-h-96 ${__O.yAuto}`, children: renderNotificationListContent({ isLoading, notifications, notificationIcons, labels, handleMarkRead, handleMarkReadAndClose, renderActionLink }) }), viewAllHref && (_jsx(Div, { className: "px-4 py-3 border-t border-zinc-200 dark:border-slate-800 text-center", children: renderActionLink({ href: viewAllHref, onClick: () => setIsOpen(false), className: "text-sm text-primary hover:underline font-medium", children: labels.viewAll }) }))] }));
|
|
84
90
|
}
|
|
85
91
|
function renderNotificationListContent(props) {
|
|
86
92
|
const { isLoading, notifications, notificationIcons, labels, handleMarkRead, handleMarkReadAndClose, renderActionLink } = props;
|
|
87
93
|
if (isLoading)
|
|
88
|
-
return _jsx(
|
|
94
|
+
return _jsx(Div, { className: "flex items-center justify-center py-10", children: _jsx(Spinner, { size: "md" }) });
|
|
89
95
|
if (notifications.length === 0)
|
|
90
|
-
return (_jsxs(
|
|
91
|
-
return (_jsx(Ul, { children: notifications.map((notification) => (_jsxs(Li, { className: `group flex items-start gap-3 px-4 py-3 border-b border-zinc-200 dark:border-slate-800 last:border-0 transition-colors hover:bg-zinc-50 dark:hover:bg-slate-900 ${!notification.isRead ? "bg-primary/5 dark:bg-primary/10" : ""}`, children: [_jsx(Span, {
|
|
96
|
+
return (_jsxs(Div, { className: "flex flex-col items-center justify-center py-10 px-4 text-center", children: [_jsx("svg", { className: "w-12 h-12 text-zinc-300 dark:text-zinc-600 mb-3", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9" }) }), _jsx(Text, { className: "font-medium text-zinc-900 dark:text-white", children: labels.empty }), _jsx(Text, { size: "sm", className: "mt-1 text-zinc-500 dark:text-zinc-400", children: labels.emptyDesc })] }));
|
|
97
|
+
return (_jsx(Ul, { children: notifications.map((notification) => (_jsxs(Li, { className: `group flex items-start gap-3 px-4 py-3 border-b border-zinc-200 dark:border-slate-800 last:border-0 transition-colors hover:bg-zinc-50 dark:hover:bg-slate-900 ${!notification.isRead ? "bg-primary/5 dark:bg-primary/10" : ""}`, children: [_jsx(Span, { size: "xl", className: "flex-shrink-0 mt-0.5", children: notificationIcons[notification.type] ?? "🔔" }), _jsxs(Div, { className: "flex-1 min-w-0", children: [_jsxs(Div, { className: `flex items-start justify-between ${THEME_CONSTANTS.spacing.gap.xs}`, children: [_jsxs(Text, { size: "sm", className: "font-medium text-zinc-900 dark:text-white leading-tight", children: [notification.title, !notification.isRead && _jsx(Span, { className: "ml-1.5 inline-block w-2 h-2 rounded-full bg-primary flex-shrink-0 align-middle" })] }), _jsx(Span, { size: "xs", className: "text-zinc-500 dark:text-zinc-400 flex-shrink-0", children: formatRelativeTime(notification.createdAt) })] }), _jsx(Text, { size: "sm", className: `text-zinc-600 dark:text-zinc-300 mt-0.5 ${THEME_CONSTANTS.utilities.textClamp2}`, children: notification.message }), _jsxs(Row, { gap: "3", className: "mt-1.5", children: [notification.actionUrl && renderActionLink({ href: notification.actionUrl, onClick: () => { void handleMarkReadAndClose(notification); }, className: "text-xs text-primary hover:underline font-medium", children: notification.actionLabel ?? labels.viewAction }), !notification.isRead && _jsx(Button, { variant: "ghost", onClick: () => void handleMarkRead(notification.id), className: "text-xs text-zinc-500 dark:text-zinc-400 hover:text-zinc-700 dark:hover:text-zinc-200 hover:underline p-0 h-auto", children: labels.markRead })] })] })] }, notification.id))) }));
|
|
92
98
|
}
|
|
@@ -3,6 +3,9 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { useState, useEffect, useCallback } from "react";
|
|
4
4
|
import { Stack, Row, Text, Button, Div, useToast } from "../../../ui";
|
|
5
5
|
import { useSiteSettings } from "../../../core/hooks/useSiteSettings";
|
|
6
|
+
const __O = {
|
|
7
|
+
hidden: "overflow-hidden",
|
|
8
|
+
};
|
|
6
9
|
// ─── type-row config ────────────────────────────────────────────────────────
|
|
7
10
|
const TYPE_ROWS = [
|
|
8
11
|
{ key: "orderUpdates", label: "Order updates", description: "Placed, shipped, delivered, cancelled, refunded" },
|
|
@@ -28,7 +31,7 @@ function ToggleRow({ label, description, checked, onChange, disabled, }) {
|
|
|
28
31
|
}
|
|
29
32
|
// ─── Section card ───────────────────────────────────────────────────────────
|
|
30
33
|
function SectionCard({ title, children }) {
|
|
31
|
-
return (_jsxs(Div, { className:
|
|
34
|
+
return (_jsxs(Div, { className: `rounded-xl border border-[var(--appkit-color-border)] bg-[var(--appkit-color-surface)] ${__O.hidden}`, children: [_jsx(Div, { className: "px-4 py-3 border-b border-[var(--appkit-color-border)] bg-[var(--appkit-color-surface-alt,var(--appkit-color-surface))]", children: _jsx(Text, { className: "text-xs font-semibold uppercase tracking-widest text-[var(--appkit-color-text-muted)]", children: title }) }), _jsx(Div, { className: "px-4", children: children })] }));
|
|
32
35
|
}
|
|
33
36
|
export function NotificationPreferencesPanel({ fetchUrl = "/api/user/notification-preferences", saveUrl = "/api/user/notification-preferences", onSave, }) {
|
|
34
37
|
const { showToast } = useToast();
|
|
@@ -4,6 +4,7 @@ import { useCallback, useEffect, useState, useTransition } from "react";
|
|
|
4
4
|
import { Alert, Badge, Button, Div, Heading, LoginRequiredModal, Spinner, Text } from "../../../ui";
|
|
5
5
|
import { isAuthError } from "../../../utils/auth-error";
|
|
6
6
|
import { ACTIONS } from "../../../_internal/shared/actions/action-registry";
|
|
7
|
+
const CLS_COUNTER_AMOUNT = "text-sm font-semibold text-blue-600 dark:text-blue-400";
|
|
7
8
|
function formatRupees(amount) {
|
|
8
9
|
if (amount === undefined || amount === null)
|
|
9
10
|
return "—";
|
|
@@ -56,7 +57,7 @@ function BuyerOfferCard({ offer, onAcceptCounter, onWithdraw, onCheckout, onUpda
|
|
|
56
57
|
}
|
|
57
58
|
});
|
|
58
59
|
}
|
|
59
|
-
return (_jsxs(Div, { surface: "card", padding: "sm", className: "space-y-3", children: [_jsxs(Div, { className: "flex items-start justify-between gap-2 flex-wrap", children: [_jsxs(Div, { className: "min-w-0", children: [_jsx(Text, { className: "font-semibold text-sm text-zinc-900 dark:text-zinc-100 truncate", children: offer.productTitle ?? "Unknown Product" }), _jsx(Text, { className: "text-xs text-zinc-500 dark:text-zinc-400 mt-0.5", children: relativeTime(offer.createdAt) })] }), _jsx(Badge, { variant: statusVariant(offer.status), className: "shrink-0 capitalize text-xs", children: offer.status })] }), _jsxs(Div, { className: "flex gap-4 flex-wrap", children: [_jsxs(Div, { children: [_jsx(Text, { className: "text-xs text-zinc-400 dark:text-zinc-400 uppercase tracking-wide", children: "Listed" }), _jsx(Text, { className: "text-sm font-medium text-zinc-700 dark:text-zinc-300", children: formatRupees(offer.listedPrice) })] }), _jsxs(Div, { children: [_jsx(Text, { className: "text-xs text-zinc-400 dark:text-zinc-400 uppercase tracking-wide", children: "Your Offer" }), _jsx(Text, { className: "text-sm font-semibold text-zinc-900 dark:text-zinc-100", children: formatRupees(offer.offerAmount) })] }), offer.counterAmount != null && (_jsxs(Div, { children: [_jsx(Text, { className: "text-xs text-zinc-400 dark:text-zinc-400 uppercase tracking-wide", children: "Seller Counter" }), _jsx(Text, { className:
|
|
60
|
+
return (_jsxs(Div, { surface: "card", padding: "sm", className: "space-y-3", children: [_jsxs(Div, { className: "flex items-start justify-between gap-2 flex-wrap", children: [_jsxs(Div, { className: "min-w-0", children: [_jsx(Text, { className: "font-semibold text-sm text-zinc-900 dark:text-zinc-100 truncate", children: offer.productTitle ?? "Unknown Product" }), _jsx(Text, { className: "text-xs text-zinc-500 dark:text-zinc-400 mt-0.5", children: relativeTime(offer.createdAt) })] }), _jsx(Badge, { variant: statusVariant(offer.status), className: "shrink-0 capitalize text-xs", children: offer.status })] }), _jsxs(Div, { className: "flex gap-4 flex-wrap", children: [_jsxs(Div, { children: [_jsx(Text, { className: "text-xs text-zinc-400 dark:text-zinc-400 uppercase tracking-wide", children: "Listed" }), _jsx(Text, { className: "text-sm font-medium text-zinc-700 dark:text-zinc-300", children: formatRupees(offer.listedPrice) })] }), _jsxs(Div, { children: [_jsx(Text, { className: "text-xs text-zinc-400 dark:text-zinc-400 uppercase tracking-wide", children: "Your Offer" }), _jsx(Text, { className: "text-sm font-semibold text-zinc-900 dark:text-zinc-100", children: formatRupees(offer.offerAmount) })] }), offer.counterAmount != null && (_jsxs(Div, { children: [_jsx(Text, { className: "text-xs text-zinc-400 dark:text-zinc-400 uppercase tracking-wide", children: "Seller Counter" }), _jsx(Text, { className: CLS_COUNTER_AMOUNT, children: formatRupees(offer.counterAmount) })] })), offer.lockedPrice != null && (_jsxs(Div, { children: [_jsx(Text, { className: "text-xs text-zinc-400 dark:text-zinc-400 uppercase tracking-wide", children: "Agreed Price" }), _jsx(Text, { className: "text-sm font-semibold text-success", children: formatRupees(offer.lockedPrice) })] }))] }), offer.sellerNote && (_jsxs(Text, { className: "text-xs text-zinc-500 dark:text-zinc-400 italic", children: ["Seller note: \"", offer.sellerNote, "\""] })), offer.status === "countered" && (_jsxs(Div, { className: "space-y-2", children: [_jsxs(Text, { className: "text-xs text-info font-medium", children: ["Seller countered at ", formatRupees(offer.counterAmount), ". Accept or withdraw your offer."] }), _jsxs(Div, { className: "flex gap-2 flex-wrap", children: [_jsx(Button, { size: "sm", variant: "primary", onClick: () => act(() => onAcceptCounter(offer.id), { status: "accepted", lockedPrice: offer.counterAmount }), disabled: isPending, children: isPending ? "Accepting…" : `Accept ${formatRupees(offer.counterAmount)}` }), _jsx(Button, { size: "sm", variant: "ghost", onClick: () => setConfirming("withdraw"), disabled: isPending, className: "text-error border border-error/20", children: "Withdraw" })] })] })), offer.status === "accepted" && onCheckout && (_jsx(Button, { size: "sm", variant: "primary", onClick: () => act(() => onCheckout(offer.id), { status: "paid" }), disabled: isPending, children: isPending ? "Processing…" : "Checkout at Agreed Price" })), offer.status === "pending" && (_jsx(Button, { size: "sm", variant: "ghost", onClick: () => setConfirming("withdraw"), disabled: isPending, className: "text-error border border-error/20 text-xs", children: "Withdraw Offer" })), confirming === "withdraw" && (_jsxs(Div, { className: "flex gap-2", children: [_jsx(Button, { size: "sm", variant: "ghost", onClick: () => act(() => onWithdraw(offer.id), { status: "withdrawn" }), disabled: isPending, className: "text-error border border-error/20", children: isPending ? "Withdrawing…" : "Confirm Withdraw" }), _jsx(Button, { size: "sm", variant: "ghost", onClick: () => setConfirming(null), disabled: isPending, children: "Cancel" })] })), error && _jsx(Alert, { variant: "error", children: _jsx(Text, { className: "text-xs", children: error }) })] }));
|
|
60
61
|
}
|
|
61
62
|
export function UserOffersPanel({ fetchEndpoint = "/api/user/offers", onAcceptCounter, onWithdraw, onCheckout, className = "", }) {
|
|
62
63
|
const [offers, setOffers] = useState([]);
|
|
@@ -4,9 +4,13 @@ import { useState, useCallback, useEffect } from "react";
|
|
|
4
4
|
import { createPortal } from "react-dom";
|
|
5
5
|
import Link from "next/link";
|
|
6
6
|
import { usePathname } from "next/navigation";
|
|
7
|
-
import { ConfirmDeleteModal, Li, Nav, Span, Ul } from "../../../ui";
|
|
7
|
+
import { ConfirmDeleteModal, Div, Li, Nav, Span, Ul } from "../../../ui";
|
|
8
8
|
import { BottomSheet } from "../../layout/BottomSheet";
|
|
9
9
|
import { SidebarCollapseToggle } from "../../../_internal/client/features/layout/SidebarCollapseToggle";
|
|
10
|
+
const __O = {
|
|
11
|
+
hidden: "overflow-hidden",
|
|
12
|
+
yAuto: "overflow-y-auto",
|
|
13
|
+
};
|
|
10
14
|
function isNavItemActive(item, activeHref) {
|
|
11
15
|
return activeHref === item.href || activeHref.startsWith(item.href + "/");
|
|
12
16
|
}
|
|
@@ -23,7 +27,7 @@ function NavLink({ item, isActive, onClick }) {
|
|
|
23
27
|
const linkClass = `flex items-center gap-2.5 rounded-lg px-3 py-2 text-[0.8125rem] font-medium leading-tight transition-colors ${isActive
|
|
24
28
|
? "bg-primary-50 dark:bg-primary-900/25 text-primary-700 dark:text-primary-300"
|
|
25
29
|
: "text-zinc-500 dark:text-zinc-400 hover:bg-zinc-50 dark:hover:bg-slate-800 hover:text-zinc-900 dark:hover:text-zinc-100"}`;
|
|
26
|
-
return (_jsxs(_Fragment, { children: [_jsxs(Link, { href: item.href, onClick: handleClick, className: linkClass, children: [item.icon && _jsx(Span, { className: "shrink-0
|
|
30
|
+
return (_jsxs(_Fragment, { children: [_jsxs(Link, { href: item.href, onClick: handleClick, className: linkClass, children: [item.icon && _jsx(Span, { size: "base", className: "shrink-0 opacity-70", children: item.icon }), _jsx(Span, { className: "flex-1 truncate", children: item.label })] }), showConfirm && item.confirm && (_jsx(ConfirmDeleteModal, { isOpen: true, title: item.confirm.title ?? "Confirm", message: item.confirm.message, confirmText: "Continue", variant: "warning", onConfirm: () => {
|
|
27
31
|
setShowConfirm(false);
|
|
28
32
|
onClick?.();
|
|
29
33
|
window.location.href = item.href;
|
|
@@ -51,13 +55,13 @@ function DrawerContent({ groups, items, activeHref, onItemClick, }) {
|
|
|
51
55
|
return (_jsx(Nav, { "aria-label": "User navigation", className: "py-2", children: groups.map((group) => {
|
|
52
56
|
const isOpen = openGroups[group.title] ?? false;
|
|
53
57
|
const hasActive = group.items.some((i) => activeHref === i.href || activeHref.startsWith(i.href + "/"));
|
|
54
|
-
return (_jsxs(
|
|
58
|
+
return (_jsxs(Div, { className: "mb-0.5", children: [_jsxs("button", { type: "button", onClick: () => toggle(group.title), className: `flex w-full items-center justify-between px-4 py-2 text-[0.6875rem] font-semibold uppercase tracking-widest transition-colors ${hasActive && !isOpen
|
|
55
59
|
? "text-primary-600 dark:text-primary-400"
|
|
56
60
|
: "text-zinc-400 dark:text-zinc-400 hover:text-zinc-600 dark:hover:text-zinc-300"}`, children: [_jsx("span", { children: group.title }), _jsx("svg", { className: `w-3 h-3 transition-transform duration-150 ${isOpen ? "rotate-180" : ""}`, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", "aria-hidden": "true", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2.5, d: "M19 9l-7 7-7-7" }) })] }), isOpen && (_jsx(Ul, { className: "space-y-0.5 px-3 pb-1", children: group.items.map((item) => (_jsx(Li, { children: _jsx(NavLink, { item: item, isActive: isNavItemActive(item, activeHref), onClick: onItemClick }) }, item.href))) }))] }, group.title));
|
|
57
61
|
}) }));
|
|
58
62
|
}
|
|
59
63
|
function DrawerPanel({ title, onClose, children, }) {
|
|
60
|
-
return (_jsxs(
|
|
64
|
+
return (_jsxs(Div, { className: "hidden md:block", children: [_jsx(Div, { className: "fixed inset-0 z-40 bg-black/40 backdrop-blur-sm", onClick: onClose, "aria-hidden": "true" }), _jsxs(Div, { role: "dialog", "aria-modal": "true", "aria-label": title, className: "fixed top-0 right-0 z-50 h-full w-64 bg-white dark:bg-slate-900 border-l border-zinc-200 dark:border-slate-700 flex flex-col shadow-2xl", children: [_jsxs(Div, { className: "flex items-center justify-between px-4 py-3.5 border-b border-zinc-100 dark:border-slate-800 shrink-0", children: [_jsx(Span, { size: "xs", weight: "semibold", className: "uppercase tracking-widest text-zinc-400 dark:text-zinc-400", children: title }), _jsx("button", { type: "button", onClick: onClose, "aria-label": "Close", className: "flex items-center justify-center w-7 h-7 rounded-md text-zinc-400 hover:bg-zinc-100 dark:hover:bg-slate-800 hover:text-zinc-700 dark:hover:text-zinc-200 transition-colors", children: _jsx("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", "aria-hidden": "true", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) }) })] }), _jsx(Div, { className: `flex-1 ${__O.yAuto}`, children: children })] })] }));
|
|
61
65
|
}
|
|
62
66
|
export function UserSidebar({ items, groups, mobileOpen = false, onCloseMobile, desktopOpen = false, onToggle, variant = "overlay" }) {
|
|
63
67
|
const pathname = usePathname();
|
|
@@ -73,15 +77,15 @@ export function UserSidebar({ items, groups, mobileOpen = false, onCloseMobile,
|
|
|
73
77
|
// ── Persistent sidebar variant (desktop left slide-over, mobile bottom-sheet) ──────
|
|
74
78
|
if (variant === "sidebar") {
|
|
75
79
|
const handleToggle = onToggle ?? close;
|
|
76
|
-
return (_jsxs(_Fragment, { children: [desktopOpen && (_jsx(
|
|
80
|
+
return (_jsxs(_Fragment, { children: [desktopOpen && (_jsx(Div, { className: "hidden md:block fixed inset-0 bg-black/40 backdrop-blur-[2px] z-30", onClick: handleToggle, "aria-hidden": "true" })), _jsxs(Div, { className: "hidden md:flex fixed left-0 z-40 transition-transform duration-300", style: {
|
|
77
81
|
top: "var(--header-height, 3.5rem)",
|
|
78
82
|
height: "calc(100vh - var(--header-height, 3.5rem))",
|
|
79
83
|
width: "13rem",
|
|
80
84
|
transform: desktopOpen ? "translateX(0)" : "translateX(calc(-100% + 1.25rem))",
|
|
81
|
-
}, children: [_jsxs("
|
|
85
|
+
}, children: [_jsxs(Div, { surface: "default", className: `flex-1 border-r border-zinc-200 dark:border-slate-800 flex flex-col ${__O.hidden} shadow-xl`, children: [_jsx(Div, { className: "px-4 py-3.5 border-b border-zinc-100 dark:border-slate-800 shrink-0", children: _jsx(Span, { size: "xs", weight: "semibold", className: "uppercase tracking-widest text-zinc-400 dark:text-zinc-400", children: "My Account" }) }), _jsx(Div, { className: `flex-1 ${__O.yAuto}`, children: _jsx(DrawerContent, { groups: groups, items: items, activeHref: pathname }) })] }), _jsx(SidebarCollapseToggle, { expanded: desktopOpen, onToggle: handleToggle })] }), _jsx(Div, { className: "md:hidden", children: _jsx(BottomSheet, { open: mobileOpen, onClose: close, title: "My Account", children: _jsx(DrawerContent, { groups: groups, items: items, activeHref: pathname, onItemClick: close }) }) })] }));
|
|
82
86
|
}
|
|
83
87
|
// ── Overlay variant (default) — portal on desktop, bottom-sheet on mobile ─
|
|
84
88
|
const content = (_jsx(DrawerContent, { groups: groups, items: items, activeHref: pathname, onItemClick: close }));
|
|
85
89
|
return (_jsxs(_Fragment, { children: [mounted && mobileOpen &&
|
|
86
|
-
createPortal(_jsx(DrawerPanel, { title: "My Account", onClose: close, children: content }), document.body), _jsx(
|
|
90
|
+
createPortal(_jsx(DrawerPanel, { title: "My Account", onClose: close, children: content }), document.body), _jsx(Div, { className: "md:hidden", children: _jsx(BottomSheet, { open: mobileOpen, onClose: close, title: "My Account", children: _jsx(DrawerContent, { groups: groups, items: items, activeHref: pathname, onItemClick: close }) }) })] }));
|
|
87
91
|
}
|
|
@@ -2,9 +2,16 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { useState } from "react";
|
|
4
4
|
import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query";
|
|
5
|
-
import { Button, Div, FormActions, Select, SideDrawer, Text, useToast, } from "../../../ui";
|
|
5
|
+
import { Button, Div, FormActions, Label, Select, SideDrawer, Span, Text, Ul, useToast, } from "../../../ui";
|
|
6
6
|
import { apiClient } from "../../../http";
|
|
7
7
|
import { SUPPORT_ENDPOINTS } from "../../../constants/api-endpoints";
|
|
8
|
+
const __P = {
|
|
9
|
+
p3: "p-3",
|
|
10
|
+
p4: "p-4",
|
|
11
|
+
};
|
|
12
|
+
const __O = {
|
|
13
|
+
yAuto: "overflow-y-auto",
|
|
14
|
+
};
|
|
8
15
|
// --- Constants ---------------------------------------------------------------
|
|
9
16
|
const CLS_INPUT = "w-full rounded-lg border border-zinc-300 dark:border-zinc-700 bg-white dark:bg-zinc-800 px-3 py-2 text-sm text-zinc-900 dark:text-zinc-100 placeholder-zinc-400 focus:outline-none focus:ring-2 focus:ring-primary-500";
|
|
10
17
|
const CATEGORY_OPTIONS = [
|
|
@@ -24,6 +31,8 @@ const CATEGORY_OPTIONS = [
|
|
|
24
31
|
{ label: "Appeal a ban (unban request)", value: "unban_request" },
|
|
25
32
|
{ label: "General", value: "general" },
|
|
26
33
|
];
|
|
34
|
+
const CLS_MSG_USER = "bg-zinc-50 border border-zinc-200 dark:bg-zinc-900/40 dark:border-zinc-700";
|
|
35
|
+
const CLS_MSG_STAFF = "bg-blue-50 border border-blue-200 dark:bg-blue-900/20 dark:border-blue-800";
|
|
27
36
|
const STATUS_BADGE = {
|
|
28
37
|
open: "bg-info-surface text-info",
|
|
29
38
|
in_progress: "bg-warning-surface text-warning",
|
|
@@ -94,15 +103,15 @@ export function UserSupportView(_props) {
|
|
|
94
103
|
}
|
|
95
104
|
function renderTicketListArea(props) {
|
|
96
105
|
const { isLoading, error, tickets, setSelectedTicket, setDetailOpen } = props;
|
|
97
|
-
return (_jsxs(_Fragment, { children: [isLoading && (_jsx(Div, { className: "space-y-3", children: [1, 2, 3].map((i) => _jsx(
|
|
106
|
+
return (_jsxs(_Fragment, { children: [isLoading && (_jsx(Div, { className: "space-y-3", children: [1, 2, 3].map((i) => _jsx(Div, { className: "h-16 animate-pulse rounded-lg bg-zinc-100 dark:bg-zinc-800" }, i)) })), error && (_jsx(Div, { className: "rounded-xl border border-error/20 bg-error-surface px-4 py-3 text-sm text-error", children: "Failed to load support tickets." })), !isLoading && tickets.length === 0 && (_jsx(Div, { className: "rounded-xl border border-zinc-200 bg-zinc-50 px-6 py-10 text-center dark:border-zinc-700 dark:bg-zinc-900/40", children: _jsx(Text, { className: "text-sm text-zinc-500 dark:text-zinc-400", children: "You haven't opened any support tickets yet." }) })), _jsx(Ul, { className: "space-y-3", children: tickets.map((ticket) => (_jsx("li", { children: _jsx(Button, { variant: "ghost", type: "button", className: "w-full rounded-xl border border-zinc-200 bg-white p-4 text-left shadow-sm hover:border-primary-300 transition-colors dark:border-zinc-700 dark:bg-zinc-900", onClick: () => { setSelectedTicket(ticket); setDetailOpen(true); }, children: _jsxs(Div, { className: "flex items-start justify-between gap-2", children: [_jsxs(Div, { className: "min-w-0 flex-1", children: [_jsx(Text, { className: "font-medium text-zinc-900 dark:text-zinc-100 truncate", children: ticket.subject }), _jsxs(Text, { className: "text-xs text-zinc-500 dark:text-zinc-400", children: [ticket.category.replace(/_/g, " "), ticket.orderId ? ` · Order: ${ticket.orderId}` : ""] })] }), _jsx(Span, { size: "xs", weight: "medium", className: `shrink-0 inline-flex rounded-full px-2.5 py-0.5 ${STATUS_BADGE[ticket.status] ?? STATUS_BADGE.open}`, children: ticket.status.replace(/_/g, " ") })] }) }) }, ticket.id))) })] }));
|
|
98
107
|
}
|
|
99
108
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
100
109
|
function renderNewTicketDrawer(props) {
|
|
101
110
|
const { newTicketOpen, setNewTicketOpen, newCategory, setNewCategory, newSubject, setNewSubject, newOrderId, setNewOrderId, newDescription, setNewDescription, createMutation } = props;
|
|
102
|
-
return (_jsx(SideDrawer, { isOpen: newTicketOpen, onClose: () => setNewTicketOpen(false), title: "Open a support ticket", children: _jsxs(Div, { className:
|
|
111
|
+
return (_jsx(SideDrawer, { isOpen: newTicketOpen, onClose: () => setNewTicketOpen(false), title: "Open a support ticket", children: _jsxs(Div, { className: `flex flex-col gap-4 ${__P.p4}`, children: [_jsx(Select, { label: "Category", options: CATEGORY_OPTIONS, value: newCategory, onValueChange: setNewCategory }), _jsxs(Div, { className: "flex flex-col gap-1", children: [_jsx(Label, { className: "text-sm font-medium text-zinc-700 dark:text-zinc-300", children: "Subject" }), _jsx("input", { type: "text", value: newSubject, onChange: (e) => setNewSubject(e.target.value), placeholder: "Brief description of the issue", className: CLS_INPUT })] }), newCategory === "order_issue" && (_jsxs(Div, { className: "flex flex-col gap-1", children: [_jsx(Label, { className: "text-sm font-medium text-zinc-700 dark:text-zinc-300", children: "Order ID" }), _jsx("input", { type: "text", value: newOrderId, onChange: (e) => setNewOrderId(e.target.value), placeholder: "e.g. order-3-20260508-a1b2c3", className: CLS_INPUT })] })), _jsxs(Div, { className: "flex flex-col gap-1", children: [_jsx(Label, { className: "text-sm font-medium text-zinc-700 dark:text-zinc-300", children: "Description" }), _jsx("textarea", { value: newDescription, onChange: (e) => setNewDescription(e.target.value), rows: 4, placeholder: "Describe the issue in detail\u2026", className: CLS_INPUT })] }), _jsxs(FormActions, { align: "right", children: [_jsx(Button, { type: "button", variant: "secondary", onClick: () => setNewTicketOpen(false), children: "Cancel" }), _jsx(Button, { type: "button", isLoading: createMutation.isPending, disabled: !newSubject.trim() || !newDescription.trim() || createMutation.isPending, onClick: () => createMutation.mutate(), children: "Submit ticket" })] })] }) }));
|
|
103
112
|
}
|
|
104
113
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
105
114
|
function renderTicketDetailDrawer(props) {
|
|
106
115
|
const { detailOpen, setDetailOpen, selectedTicket, replyBody, setReplyBody, replyMutation } = props;
|
|
107
|
-
return (_jsx(SideDrawer, { isOpen: detailOpen, onClose: () => setDetailOpen(false), title: selectedTicket?.subject ?? "Ticket", children: selectedTicket && (_jsxs(Div, { className:
|
|
116
|
+
return (_jsx(SideDrawer, { isOpen: detailOpen, onClose: () => setDetailOpen(false), title: selectedTicket?.subject ?? "Ticket", children: selectedTicket && (_jsxs(Div, { className: `flex flex-col gap-4 ${__P.p4}`, children: [_jsxs(Div, { className: "flex flex-wrap gap-2", children: [_jsx(Span, { size: "xs", weight: "medium", className: `inline-flex rounded-full px-2.5 py-1 ${STATUS_BADGE[selectedTicket.status] ?? STATUS_BADGE.open}`, children: selectedTicket.status.replace(/_/g, " ") }), _jsx(Span, { size: "xs", className: "rounded-full bg-zinc-100 px-2.5 py-1 text-zinc-600 dark:bg-zinc-800 dark:text-zinc-300", children: selectedTicket.category.replace(/_/g, " ") }), selectedTicket.orderId && _jsxs(Span, { size: "xs", className: "rounded-full bg-zinc-100 px-2.5 py-1 text-zinc-600 dark:bg-zinc-800 dark:text-zinc-300", children: ["Order: ", selectedTicket.orderId] })] }), selectedTicket.description && (_jsxs(Div, { className: `rounded-lg border border-zinc-200 bg-zinc-50 ${__P.p3} dark:border-zinc-700 dark:bg-zinc-900/40`, children: [_jsx(Text, { className: "mb-1 text-xs font-semibold text-zinc-500 uppercase tracking-wide", children: "Your description" }), _jsx(Text, { className: "whitespace-pre-wrap text-sm text-zinc-700 dark:text-zinc-200", children: selectedTicket.description })] })), (selectedTicket.messages ?? []).length > 0 && (_jsxs(Div, { className: "space-y-2", children: [_jsx(Text, { className: "text-xs font-semibold text-zinc-500 dark:text-zinc-400 uppercase tracking-wide", children: "Messages" }), _jsx(Div, { className: `space-y-2 max-h-72 ${__O.yAuto}`, children: (selectedTicket.messages ?? []).map((msg, i) => (_jsxs(Div, { className: `rounded-lg ${__P.p3} text-sm ${msg.authorRole === "user" ? CLS_MSG_USER : CLS_MSG_STAFF}`, children: [_jsxs(Div, { className: "mb-1 flex items-center gap-2 text-xs text-zinc-400 dark:text-zinc-400", children: [_jsx(Span, { weight: "medium", className: "text-zinc-600 dark:text-zinc-300", children: ROLE_LABEL[msg.authorRole ?? "user"] ?? msg.authorRole }), msg.createdAt && _jsx(Span, { children: new Date(msg.createdAt).toLocaleString() })] }), _jsx(Text, { className: "whitespace-pre-wrap text-zinc-700 dark:text-zinc-200", children: msg.body })] }, msg.id ?? i))) })] })), selectedTicket.status !== "closed" && selectedTicket.status !== "resolved" && (_jsxs(Div, { className: "flex flex-col gap-1", children: [_jsx(Label, { className: "text-sm font-medium text-zinc-700 dark:text-zinc-300", children: "Reply" }), _jsx("textarea", { value: replyBody, onChange: (e) => setReplyBody(e.target.value), rows: 3, placeholder: "Add a message to your ticket\u2026", className: CLS_INPUT }), _jsx(Button, { type: "button", variant: "primary", size: "sm", isLoading: replyMutation.isPending, disabled: !replyBody.trim() || replyMutation.isPending, onClick: () => replyMutation.mutate(), children: "Send reply" })] }))] })) }));
|
|
108
117
|
}
|
|
@@ -8,6 +8,8 @@ export { AddressSelectorCreate } from "./AddressSelectorCreate";
|
|
|
8
8
|
export { NotificationBell } from "./NotificationBell";
|
|
9
9
|
export type { NotificationBellLabels, NotificationBellProps, NotificationBellRenderLinkProps, } from "./NotificationBell";
|
|
10
10
|
export type { AddressSelectorCreateProps, AddressSelectorCreateLabels, } from "./AddressSelectorCreate";
|
|
11
|
+
export { AddressInlineSelect } from "./AddressInlineSelect";
|
|
12
|
+
export type { AddressInlineSelectProps } from "./AddressInlineSelect";
|
|
11
13
|
export { UserAccountHubView } from "./UserAccountHubView";
|
|
12
14
|
export type { UserAccountHubViewProps, UserAccountHubViewLabels, } from "./UserAccountHubView";
|
|
13
15
|
export { ProfileView } from "./ProfileView";
|
|
@@ -3,6 +3,7 @@ export { AddressCard, AddressBook } from "./AddressBook";
|
|
|
3
3
|
export { AddressForm } from "./AddressForm";
|
|
4
4
|
export { AddressSelectorCreate } from "./AddressSelectorCreate";
|
|
5
5
|
export { NotificationBell } from "./NotificationBell";
|
|
6
|
+
export { AddressInlineSelect } from "./AddressInlineSelect";
|
|
6
7
|
export { UserAccountHubView } from "./UserAccountHubView";
|
|
7
8
|
export { ProfileView } from "./ProfileView";
|
|
8
9
|
export { UserSettingsView } from "./UserSettingsView";
|
|
@@ -5,9 +5,9 @@ interface UseProfileOptions {
|
|
|
5
5
|
endpoint?: string;
|
|
6
6
|
}
|
|
7
7
|
export declare function useProfile(userId: string, opts?: UseProfileOptions): {
|
|
8
|
-
profile: UserProfile | undefined;
|
|
8
|
+
profile: NoInfer<UserProfile> | undefined;
|
|
9
9
|
isLoading: boolean;
|
|
10
10
|
error: Error | null;
|
|
11
|
-
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<UserProfile
|
|
11
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<NoInfer<UserProfile>, Error>>;
|
|
12
12
|
};
|
|
13
13
|
export {};
|