@mohasinac/appkit 2.8.2 → 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.
Files changed (430) hide show
  1. package/dist/_internal/client/features/classified/ClassifiedDetailView.js +7 -1
  2. package/dist/_internal/client/features/digital-code/CodeRevealPanel.js +4 -1
  3. package/dist/_internal/client/features/digital-code/DigitalCodeDetailView.js +7 -1
  4. package/dist/_internal/client/features/layout/DashboardLayoutClient.js +3 -2
  5. package/dist/_internal/client/features/live/LiveItemDetailView.js +11 -2
  6. package/dist/_internal/client/scaffolds/AppShell.js +2 -1
  7. package/dist/_internal/client/scaffolds/DashboardScaffold.js +2 -1
  8. package/dist/_internal/server/features/checkout/actions.js +40 -39
  9. package/dist/_internal/shared/actions/action-registry.js +6 -0
  10. package/dist/_internal/shared/config/index.d.ts +1 -1
  11. package/dist/_internal/shared/config/schema.d.ts +0 -8
  12. package/dist/client-entry.d.ts +1 -1
  13. package/dist/client.d.ts +1 -1
  14. package/dist/client.js +1 -1
  15. package/dist/configs/next.js +12 -22
  16. package/dist/constants/api-endpoints.d.ts +6 -0
  17. package/dist/constants/api-endpoints.js +2 -0
  18. package/dist/core/hooks/useSiteSettings.d.ts +1 -1
  19. package/dist/features/about/components/AboutView.js +5 -2
  20. package/dist/features/about/components/FAQPageView.js +3 -3
  21. package/dist/features/about/components/FeesView.js +13 -5
  22. package/dist/features/about/components/HelpPageView.js +9 -5
  23. package/dist/features/about/components/HowAuctionsWorkView.js +9 -5
  24. package/dist/features/about/components/HowCheckoutWorksView.js +9 -5
  25. package/dist/features/about/components/HowOffersWorkView.js +10 -5
  26. package/dist/features/about/components/HowOrdersWorkView.js +10 -5
  27. package/dist/features/about/components/HowPayoutsWorkView.js +9 -5
  28. package/dist/features/about/components/HowPreOrdersWorkView.js +9 -5
  29. package/dist/features/about/components/HowReviewsWorkView.js +9 -5
  30. package/dist/features/about/components/PolicyPageView.js +3 -3
  31. package/dist/features/about/components/PublicProfileView.js +11 -4
  32. package/dist/features/about/components/SecurityPrivacyView.js +8 -4
  33. package/dist/features/about/components/ShippingPolicyView.js +3 -2
  34. package/dist/features/about/components/TrackOrderView.js +2 -2
  35. package/dist/features/about/components/UnauthorizedView.js +3 -3
  36. package/dist/features/account/components/AddressBook.js +1 -1
  37. package/dist/features/account/components/AddressForm.js +2 -2
  38. package/dist/features/account/components/AddressInlineSelect.d.ts +24 -0
  39. package/dist/features/account/components/AddressInlineSelect.js +78 -0
  40. package/dist/features/account/components/AddressSelectorCreate.d.ts +2 -1
  41. package/dist/features/account/components/AddressSelectorCreate.js +5 -32
  42. package/dist/features/account/components/AddressesIndexListing.js +3 -3
  43. package/dist/features/account/components/ChatWindow.js +2 -1
  44. package/dist/features/account/components/NotificationBell.js +13 -7
  45. package/dist/features/account/components/NotificationPreferencesPanel.js +4 -1
  46. package/dist/features/account/components/UserOffersPanel.js +2 -1
  47. package/dist/features/account/components/UserSidebar.js +11 -7
  48. package/dist/features/account/components/UserSupportView.js +13 -4
  49. package/dist/features/account/components/index.d.ts +2 -0
  50. package/dist/features/account/components/index.js +1 -0
  51. package/dist/features/account/hooks/useAccount.d.ts +2 -2
  52. package/dist/features/account/hooks/useAddressSelector.d.ts +1 -1
  53. package/dist/features/account/hooks/useAddresses.d.ts +2 -2
  54. package/dist/features/account/hooks/useNotifications.d.ts +1 -1
  55. package/dist/features/account/hooks/useProfile.d.ts +1 -1
  56. package/dist/features/account/hooks/usePublicProfile.d.ts +2 -2
  57. package/dist/features/addresses/repository/addresses.repository.d.ts +1 -0
  58. package/dist/features/addresses/repository/addresses.repository.js +13 -0
  59. package/dist/features/admin/components/AdminAdEditorView.js +8 -5
  60. package/dist/features/admin/components/AdminAddressEditorView.js +5 -5
  61. package/dist/features/admin/components/AdminAdsView.js +10 -7
  62. package/dist/features/admin/components/AdminBlogEditorView.js +15 -9
  63. package/dist/features/admin/components/AdminBrandEditorView.js +10 -4
  64. package/dist/features/admin/components/AdminBrandsView.js +4 -4
  65. package/dist/features/admin/components/AdminBundleEditorView.js +4 -5
  66. package/dist/features/admin/components/AdminBundlesView.js +3 -3
  67. package/dist/features/admin/components/AdminCarouselEditorView.js +6 -3
  68. package/dist/features/admin/components/AdminCarouselView.js +6 -6
  69. package/dist/features/admin/components/AdminCatalogGuideView.js +2 -1
  70. package/dist/features/admin/components/AdminCategoriesView.js +5 -5
  71. package/dist/features/admin/components/AdminCategoryEditorView.js +11 -5
  72. package/dist/features/admin/components/AdminContactEditorView.js +8 -1
  73. package/dist/features/admin/components/AdminCouponEditorView.js +23 -5
  74. package/dist/features/admin/components/AdminEmployeeEditorView.js +7 -4
  75. package/dist/features/admin/components/AdminFaqEditorView.js +9 -3
  76. package/dist/features/admin/components/AdminFaqsView.js +4 -4
  77. package/dist/features/admin/components/AdminFeatureEditorView.js +7 -1
  78. package/dist/features/admin/components/AdminFeatureFlagsView.js +4 -1
  79. package/dist/features/admin/components/AdminFilterBar.js +4 -4
  80. package/dist/features/admin/components/AdminGroupedListingsView.js +65 -30
  81. package/dist/features/admin/components/AdminGuideHubView.js +4 -1
  82. package/dist/features/admin/components/AdminMediaView.js +4 -1
  83. package/dist/features/admin/components/AdminNavigationView.js +7 -4
  84. package/dist/features/admin/components/AdminNotificationsView.js +2 -2
  85. package/dist/features/admin/components/AdminOrderEditorView.js +2 -2
  86. package/dist/features/admin/components/AdminPageHeader.js +5 -2
  87. package/dist/features/admin/components/AdminPrizeDrawsView.js +5 -5
  88. package/dist/features/admin/components/AdminProductEditorView.js +12 -5
  89. package/dist/features/admin/components/AdminProductsView.js +4 -4
  90. package/dist/features/admin/components/AdminReviewsView.js +2 -2
  91. package/dist/features/admin/components/AdminScammerEditorView.js +6 -2
  92. package/dist/features/admin/components/AdminScammersView.js +3 -3
  93. package/dist/features/admin/components/AdminSectionsView.js +20 -22
  94. package/dist/features/admin/components/AdminSessionsManager.js +2 -1
  95. package/dist/features/admin/components/AdminSessionsView.js +2 -2
  96. package/dist/features/admin/components/AdminSidebar.js +11 -7
  97. package/dist/features/admin/components/AdminSiteConfigGuideView.js +2 -1
  98. package/dist/features/admin/components/AdminSiteSettingsView.js +5 -1
  99. package/dist/features/admin/components/AdminStoreAddressesView.js +2 -2
  100. package/dist/features/admin/components/AdminStoreEditorView.js +5 -5
  101. package/dist/features/admin/components/AdminSublistingCategoryEditorView.js +3 -3
  102. package/dist/features/admin/components/AdminSupportTicketDetailView.js +10 -3
  103. package/dist/features/admin/components/AdminSupportTicketsView.js +3 -3
  104. package/dist/features/admin/components/AdminTrustGuideView.js +3 -3
  105. package/dist/features/admin/components/AdminUsersGuideView.js +3 -3
  106. package/dist/features/admin/components/AdminViewCards.js +12 -6
  107. package/dist/features/admin/components/BrandQuickCreateForm.js +2 -2
  108. package/dist/features/admin/components/CategoryQuickCreateForm.js +2 -2
  109. package/dist/features/admin/components/DashboardStats.js +9 -3
  110. package/dist/features/admin/components/DataListingView.js +3 -3
  111. package/dist/features/admin/components/DataTable.js +11 -7
  112. package/dist/features/admin/components/DrawerFormFooter.js +2 -2
  113. package/dist/features/admin/components/QuickEditMenu.js +2 -1
  114. package/dist/features/admin/components/analytics/AdminAnalyticsCharts.js +5 -1
  115. package/dist/features/admin/hooks/useAdmin.d.ts +1 -1
  116. package/dist/features/admin/hooks/useAdminSectionsListing.d.ts +1 -1
  117. package/dist/features/admin/hooks/useChat.d.ts +1 -1
  118. package/dist/features/auctions/components/AuctionBidsTable.js +4 -1
  119. package/dist/features/auctions/components/AuctionDetailPageView.js +14 -6
  120. package/dist/features/auctions/components/CollapsibleBidHistory.js +5 -1
  121. package/dist/features/auctions/components/MarketplaceAuctionCard.js +9 -3
  122. package/dist/features/auctions/components/MarketplaceAuctionGrid.js +8 -2
  123. package/dist/features/auctions/components/PlaceBidFormClient.js +4 -1
  124. package/dist/features/auctions/hooks/useAuctions.d.ts +8 -8
  125. package/dist/features/auth/components/RegisterForm.js +2 -2
  126. package/dist/features/auth/components/VerifyEmailView.js +5 -2
  127. package/dist/features/auth/hooks/useAuth.d.ts +2 -2
  128. package/dist/features/before-after/components/BeforeAfterSlider.js +1 -1
  129. package/dist/features/blog/components/BlogFeaturedCard.js +8 -1
  130. package/dist/features/blog/components/BlogIndexListing.js +11 -5
  131. package/dist/features/blog/components/BlogListView.js +11 -3
  132. package/dist/features/blog/components/BlogPostView.js +10 -3
  133. package/dist/features/cart/components/CartDrawer.js +11 -3
  134. package/dist/features/cart/components/CartSummary.js +2 -2
  135. package/dist/features/cart/components/CheckoutOtpModal.js +2 -1
  136. package/dist/features/cart/hooks/useCart.d.ts +1 -1
  137. package/dist/features/cart/hooks/useCartQuery.d.ts +1 -1
  138. package/dist/features/cart/hooks/useCheckoutReadQueries.d.ts +2 -2
  139. package/dist/features/cart/hooks/useOrder.d.ts +2 -2
  140. package/dist/features/categories/components/BrandDetailPageView.js +5 -2
  141. package/dist/features/categories/components/BrandDetailTabs.js +5 -1
  142. package/dist/features/categories/components/BundleDetailView.js +6 -3
  143. package/dist/features/categories/components/BundleDynamicRuleEditor.js +3 -1
  144. package/dist/features/categories/components/BundleItemsPicker.js +10 -3
  145. package/dist/features/categories/components/CategoriesIndexListing.js +12 -6
  146. package/dist/features/categories/components/CategoryBundlesListing.js +5 -2
  147. package/dist/features/categories/components/CategoryDetailPageView.js +6 -2
  148. package/dist/features/categories/components/CategoryDetailTabs.js +5 -1
  149. package/dist/features/categories/components/CategoryForm.js +6 -3
  150. package/dist/features/categories/components/CategoryGrid.js +9 -2
  151. package/dist/features/categories/components/CategoryProductsListing.js +10 -4
  152. package/dist/features/categories/components/CategorySelectorCreate.js +3 -3
  153. package/dist/features/categories/components/CategorySortSelect.js +1 -1
  154. package/dist/features/categories/components/CategoryStoresListing.js +3 -3
  155. package/dist/features/categories/components/CategoryTableColumns.js +10 -6
  156. package/dist/features/categories/components/CategoryTree.js +1 -1
  157. package/dist/features/categories/hooks/useCategories.d.ts +3 -3
  158. package/dist/features/categories/hooks/useCategorySelector.d.ts +3 -3
  159. package/dist/features/categories/hooks/useCategoryTree.d.ts +1 -1
  160. package/dist/features/checkout/hooks/useCheckoutApi.d.ts +2 -2
  161. package/dist/features/classified/components/ClassifiedFilters.js +2 -2
  162. package/dist/features/classified/components/ClassifiedIndexListing.js +9 -3
  163. package/dist/features/collections/components/CollectionCard.js +2 -1
  164. package/dist/features/collections/hooks/useCollections.d.ts +2 -2
  165. package/dist/features/contact/components/ContactForm.js +4 -2
  166. package/dist/features/contact/components/ContactInfoSidebar.js +4 -1
  167. package/dist/features/copilot/components/AdminCopilotView.js +13 -5
  168. package/dist/features/digital-codes/components/DigitalCodesIndexListing.js +9 -3
  169. package/dist/features/events/components/AdminEventEditorView.js +62 -40
  170. package/dist/features/events/components/AdminEventEntriesView.js +9 -6
  171. package/dist/features/events/components/EventCard.js +7 -1
  172. package/dist/features/events/components/EventFormDrawer.js +2 -1
  173. package/dist/features/events/components/EventLeaderboard.js +4 -4
  174. package/dist/features/events/components/EventOfferCard.js +4 -1
  175. package/dist/features/events/components/EventParticipateView.js +3 -2
  176. package/dist/features/events/components/EventPollWidget.js +6 -5
  177. package/dist/features/events/components/EventRaffleEntryForm.js +5 -2
  178. package/dist/features/events/components/EventRaffleWinnerView.js +7 -1
  179. package/dist/features/events/components/EventRafflesSection.js +2 -2
  180. package/dist/features/events/components/EventSaleBanner.js +5 -2
  181. package/dist/features/events/components/EventsIndexListing.js +8 -2
  182. package/dist/features/events/components/EventsListView.js +4 -1
  183. package/dist/features/events/components/SpinWheelView.js +7 -2
  184. package/dist/features/events/hooks/useEvent.d.ts +3 -3
  185. package/dist/features/events/hooks/useEvents.d.ts +1 -1
  186. package/dist/features/events/schemas/firestore.d.ts +1 -0
  187. package/dist/features/events/types/index.d.ts +1 -0
  188. package/dist/features/faq/components/ContactCTA.js +4 -1
  189. package/dist/features/faq/components/FAQCategorySidebar.js +2 -2
  190. package/dist/features/faq/components/FAQHelpfulButtons.js +8 -5
  191. package/dist/features/faq/components/FAQPageContent.js +5 -5
  192. package/dist/features/faq/components/FAQSortDropdown.js +2 -2
  193. package/dist/features/faq/hooks/useFAQs.d.ts +1 -1
  194. package/dist/features/faq/hooks/useFaqList.d.ts +15 -15
  195. package/dist/features/filters/AsyncFacetSection.js +4 -2
  196. package/dist/features/filters/FilterFacetSection.js +14 -6
  197. package/dist/features/filters/RangeFilter.js +4 -2
  198. package/dist/features/filters/SwitchFilter.js +2 -1
  199. package/dist/features/forms/Checkbox.js +1 -1
  200. package/dist/features/forms/Radio.js +1 -1
  201. package/dist/features/forms/Slider.js +1 -1
  202. package/dist/features/homepage/components/AdSlot.js +4 -4
  203. package/dist/features/homepage/components/AdvertisementBanner.js +13 -4
  204. package/dist/features/homepage/components/AnnouncementBar.js +2 -1
  205. package/dist/features/homepage/components/BeforeAfterCard.js +8 -2
  206. package/dist/features/homepage/components/BrandsSection.js +6 -3
  207. package/dist/features/homepage/components/CTABannerSection.js +2 -2
  208. package/dist/features/homepage/components/CharacterHotspot.js +5 -2
  209. package/dist/features/homepage/components/CharacterHotspotForm.js +8 -4
  210. package/dist/features/homepage/components/CustomCardsSection.js +13 -7
  211. package/dist/features/homepage/components/CustomerReviewsSection.js +9 -3
  212. package/dist/features/homepage/components/FAQSection.js +7 -4
  213. package/dist/features/homepage/components/FeaturedBundlesSection.js +8 -2
  214. package/dist/features/homepage/components/FeaturedResultsSection.js +1 -1
  215. package/dist/features/homepage/components/GoogleReviewsSection.js +14 -8
  216. package/dist/features/homepage/components/HeroCarousel.js +1 -1
  217. package/dist/features/homepage/components/HomepageSkeleton.js +7 -1
  218. package/dist/features/homepage/components/HowItWorksInfoView.js +2 -2
  219. package/dist/features/homepage/components/HowItWorksSection.js +2 -2
  220. package/dist/features/homepage/components/NewsletterBanner.js +3 -2
  221. package/dist/features/homepage/components/NewsletterSection.js +5 -2
  222. package/dist/features/homepage/components/PromoGrid.js +4 -1
  223. package/dist/features/homepage/components/SectionCarousel.js +7 -4
  224. package/dist/features/homepage/components/SecurityHighlightsSection.js +3 -3
  225. package/dist/features/homepage/components/ShopByCategorySection.js +10 -4
  226. package/dist/features/homepage/components/SiteFeaturesSection.js +5 -2
  227. package/dist/features/homepage/components/SocialFeedSection.js +4 -4
  228. package/dist/features/homepage/components/SocialPostCard.js +6 -3
  229. package/dist/features/homepage/components/TrustFeaturesSection.js +5 -5
  230. package/dist/features/homepage/components/TrustIndicatorsSection.js +5 -2
  231. package/dist/features/homepage/components/WelcomeSection.js +1 -1
  232. package/dist/features/homepage/components/WhatsAppCommunitySection.js +3 -3
  233. package/dist/features/homepage/hooks/useBlogArticles.d.ts +1 -1
  234. package/dist/features/homepage/hooks/useFeaturedAuctions.d.ts +1 -1
  235. package/dist/features/homepage/hooks/useFeaturedPreOrders.d.ts +1 -1
  236. package/dist/features/homepage/hooks/useFeaturedProducts.d.ts +1 -1
  237. package/dist/features/homepage/hooks/useFeaturedStores.d.ts +1 -1
  238. package/dist/features/homepage/hooks/useHeroCarousel.d.ts +1 -1
  239. package/dist/features/homepage/hooks/useHomepageEvents.d.ts +1 -1
  240. package/dist/features/homepage/hooks/useHomepageReviews.d.ts +1 -1
  241. package/dist/features/homepage/hooks/useHomepageSections.d.ts +1 -1
  242. package/dist/features/homepage/hooks/useTopBrands.d.ts +1 -1
  243. package/dist/features/homepage/hooks/useTopCategories.d.ts +1 -1
  244. package/dist/features/layout/AppLayoutShell.js +2 -1
  245. package/dist/features/layout/BackToTop.js +1 -1
  246. package/dist/features/layout/BottomActions.js +4 -3
  247. package/dist/features/layout/BottomNavItem.js +1 -1
  248. package/dist/features/layout/BottomSheet.js +4 -1
  249. package/dist/features/layout/FooterLayout.js +1 -1
  250. package/dist/features/layout/NavbarLayout.js +4 -1
  251. package/dist/features/layout/SidebarLayout.js +5 -2
  252. package/dist/features/live/components/LiveItemFilters.js +2 -2
  253. package/dist/features/live/components/LiveItemsIndexListing.js +9 -3
  254. package/dist/features/loyalty/components/CoinsDisplay.js +4 -2
  255. package/dist/features/loyalty/hooks/useLoyaltyBalance.d.ts +1 -1
  256. package/dist/features/media/AvatarUpload.js +2 -2
  257. package/dist/features/media/MediaLightbox.js +3 -2
  258. package/dist/features/media/modals/VideoThumbnailSelector.js +4 -1
  259. package/dist/features/media/modals/VideoTrimModal.js +1 -1
  260. package/dist/features/media/upload/CameraCapture.js +1 -1
  261. package/dist/features/media/upload/ImageUpload.js +4 -1
  262. package/dist/features/media/upload/MediaUploadField.js +11 -2
  263. package/dist/features/media/upload/MediaUploadList.js +5 -1
  264. package/dist/features/orders/components/MarketplaceOrderCard.js +2 -2
  265. package/dist/features/orders/components/OrdersList.js +2 -1
  266. package/dist/features/orders/components/RefundHistoryTable.js +4 -1
  267. package/dist/features/orders/components/RefundRequestView.js +2 -1
  268. package/dist/features/orders/hooks/useOrders.d.ts +2 -2
  269. package/dist/features/payments/hooks/usePayments.d.ts +1 -1
  270. package/dist/features/pre-orders/components/MarketplacePreorderCard.js +5 -1
  271. package/dist/features/pre-orders/components/PreOrderActionsClient.js +3 -3
  272. package/dist/features/pre-orders/components/PreOrderBadge.js +2 -1
  273. package/dist/features/pre-orders/components/PreOrderDetailPageView.js +16 -7
  274. package/dist/features/pre-orders/components/PreOrdersIndexListing.js +32 -24
  275. package/dist/features/pre-orders/hooks/usePreOrders.d.ts +2 -2
  276. package/dist/features/products/columns/productTableColumns.js +9 -4
  277. package/dist/features/products/components/AuctionsIndexListing.js +9 -3
  278. package/dist/features/products/components/BidHistory.js +4 -4
  279. package/dist/features/products/components/CompareOverlay.js +10 -2
  280. package/dist/features/products/components/CustomFieldsEditor.js +2 -1
  281. package/dist/features/products/components/CustomSectionTabContent.js +2 -2
  282. package/dist/features/products/components/CustomSectionsEditor.js +3 -2
  283. package/dist/features/products/components/GroupSettingsPanel.js +34 -26
  284. package/dist/features/products/components/MakeOfferButton.js +6 -2
  285. package/dist/features/products/components/MakeOfferForm.js +2 -1
  286. package/dist/features/products/components/MarketplaceBundleCard.js +6 -3
  287. package/dist/features/products/components/MarketplacePrizeDrawCard.js +3 -2
  288. package/dist/features/products/components/PlaceBidForm.js +2 -1
  289. package/dist/features/products/components/PrizeDrawCollage.js +6 -2
  290. package/dist/features/products/components/PrizeDrawDetailPageView.js +6 -1
  291. package/dist/features/products/components/PrizeDrawItemsEditor.js +4 -2
  292. package/dist/features/products/components/PrizeDrawsIndexListing.js +6 -3
  293. package/dist/features/products/components/PrizeDrawsSection.js +2 -2
  294. package/dist/features/products/components/PrizeRevealModal.js +5 -1
  295. package/dist/features/products/components/ProductDetailPageView.js +32 -16
  296. package/dist/features/products/components/ProductFeatureBadges.js +9 -9
  297. package/dist/features/products/components/ProductForm.d.ts +11 -1
  298. package/dist/features/products/components/ProductForm.js +10 -5
  299. package/dist/features/products/components/ProductGalleryClient.js +8 -4
  300. package/dist/features/products/components/ProductGradingTab.js +4 -1
  301. package/dist/features/products/components/ProductGrid.js +35 -14
  302. package/dist/features/products/components/ProductInfo.js +2 -1
  303. package/dist/features/products/components/ProductTabs.js +2 -1
  304. package/dist/features/products/components/ProductTabsShell.js +5 -1
  305. package/dist/features/products/components/ProductsIndexListing.js +32 -24
  306. package/dist/features/products/components/ProductsIndexPageView.js +2 -2
  307. package/dist/features/products/components/RelatedProducts.js +3 -3
  308. package/dist/features/products/components/ShowGroupSection.js +10 -6
  309. package/dist/features/products/components/SublistingCarouselSection.js +7 -3
  310. package/dist/features/products/components/SublistingCategorySelect.d.ts +3 -1
  311. package/dist/features/products/components/SublistingCategorySelect.js +4 -37
  312. package/dist/features/products/constants/action-defs.js +3 -3
  313. package/dist/features/products/hooks/useProductDetail.d.ts +1 -1
  314. package/dist/features/products/hooks/useRelatedProducts.d.ts +1 -1
  315. package/dist/features/promotions/components/CouponCard.js +5 -3
  316. package/dist/features/promotions/components/CouponsIndexListing.js +7 -3
  317. package/dist/features/promotions/hooks/usePromotions.d.ts +2 -2
  318. package/dist/features/promotions/repository/coupons.repository.d.ts +8 -0
  319. package/dist/features/promotions/repository/coupons.repository.js +2 -0
  320. package/dist/features/reviews/components/ReviewDetailPageView.js +3 -3
  321. package/dist/features/reviews/components/ReviewDetailShell.js +15 -3
  322. package/dist/features/reviews/components/ReviewSummary.js +4 -2
  323. package/dist/features/reviews/components/ReviewsIndexListing.js +8 -2
  324. package/dist/features/reviews/components/ReviewsList.js +1 -1
  325. package/dist/features/reviews/hooks/useReviews.d.ts +2 -2
  326. package/dist/features/scams/components/ScamAwarenessModal.js +2 -2
  327. package/dist/features/scams/components/ScamProfileView.js +3 -3
  328. package/dist/features/scams/components/ScamRegistryView.js +6 -4
  329. package/dist/features/search/components/Search.js +9 -6
  330. package/dist/features/search/components/SearchFiltersRow.js +1 -1
  331. package/dist/features/search/components/SearchResultsSection.js +1 -1
  332. package/dist/features/search/hooks/useSearch.d.ts +2 -2
  333. package/dist/features/seller/components/CouponInlineSelect.d.ts +22 -0
  334. package/dist/features/seller/components/CouponInlineSelect.js +103 -0
  335. package/dist/features/seller/components/GroupInlineSelect.d.ts +23 -0
  336. package/dist/features/seller/components/GroupInlineSelect.js +80 -0
  337. package/dist/features/seller/components/PhysicalLocationModal.js +2 -1
  338. package/dist/features/seller/components/PrintCenterView.js +2 -1
  339. package/dist/features/seller/components/ProductInlineSelect.d.ts +24 -0
  340. package/dist/features/seller/components/ProductInlineSelect.js +42 -0
  341. package/dist/features/seller/components/QuickProductForm.js +4 -1
  342. package/dist/features/seller/components/SellerAddressesView.js +8 -3
  343. package/dist/features/seller/components/SellerAnalyticsAlertsView.js +6 -3
  344. package/dist/features/seller/components/SellerAnalyticsView.js +2 -2
  345. package/dist/features/seller/components/SellerBidsView.js +7 -7
  346. package/dist/features/seller/components/SellerBundlesView.js +2 -1
  347. package/dist/features/seller/components/SellerCouponEditorView.d.ts +2 -0
  348. package/dist/features/seller/components/SellerCouponEditorView.js +15 -3
  349. package/dist/features/seller/components/SellerCouponsView.js +1 -1
  350. package/dist/features/seller/components/SellerDashboardView.js +2 -2
  351. package/dist/features/seller/components/SellerDigitalCodesView.js +2 -2
  352. package/dist/features/seller/components/SellerGoogleReviewsView.js +2 -2
  353. package/dist/features/seller/components/SellerGroupedListingsView.js +5 -5
  354. package/dist/features/seller/components/SellerOrdersView.js +13 -10
  355. package/dist/features/seller/components/SellerPayoutMethodsView.js +5 -4
  356. package/dist/features/seller/components/SellerPayoutRequestView.js +5 -1
  357. package/dist/features/seller/components/SellerPayoutSettingsView.js +5 -2
  358. package/dist/features/seller/components/SellerPreOrdersView.js +6 -6
  359. package/dist/features/seller/components/SellerPrizeDrawsView.js +6 -6
  360. package/dist/features/seller/components/SellerProductShell.js +1 -1
  361. package/dist/features/seller/components/SellerProductsCards.js +4 -1
  362. package/dist/features/seller/components/SellerProductsView.js +5 -5
  363. package/dist/features/seller/components/SellerReviewsView.js +7 -3
  364. package/dist/features/seller/components/SellerShippingConfigsView.js +4 -4
  365. package/dist/features/seller/components/SellerShippingView.js +1 -1
  366. package/dist/features/seller/components/SellerSidebar.js +15 -8
  367. package/dist/features/seller/components/SellerStoreCategoriesView.js +1 -1
  368. package/dist/features/seller/components/SellerStorefrontView.js +2 -2
  369. package/dist/features/seller/components/SellerTemplatesView.js +7 -4
  370. package/dist/features/seller/components/SublistingInlineSelect.d.ts +19 -0
  371. package/dist/features/seller/components/SublistingInlineSelect.js +83 -0
  372. package/dist/features/seller/components/analytics/SellerTopProducts.js +1 -1
  373. package/dist/features/seller/components/index.d.ts +8 -0
  374. package/dist/features/seller/components/index.js +4 -0
  375. package/dist/features/seller/hooks/useSellerPayouts.d.ts +3 -3
  376. package/dist/features/seller/hooks/useSellerStore.d.ts +6 -6
  377. package/dist/features/seller/hooks/useSellerStorefront.d.ts +2 -2
  378. package/dist/features/shell/FormShell.js +10 -2
  379. package/dist/features/shell/QuickFormDrawer.js +5 -5
  380. package/dist/features/shell/StepForm.js +6 -6
  381. package/dist/features/site-settings/components/ActionPermissionsManager.js +8 -4
  382. package/dist/features/site-settings/components/NavPermissionsManager.js +7 -4
  383. package/dist/features/stores/components/InteractiveStoreCard.js +5 -1
  384. package/dist/features/stores/components/StoreAboutView.js +4 -1
  385. package/dist/features/stores/components/StoreAddressSelectorCreate.d.ts +2 -1
  386. package/dist/features/stores/components/StoreAddressSelectorCreate.js +5 -31
  387. package/dist/features/stores/components/StoreAuctionsListing.js +6 -3
  388. package/dist/features/stores/components/StoreGuideHubView.js +5 -2
  389. package/dist/features/stores/components/StoreHeader.js +8 -1
  390. package/dist/features/stores/components/StorePreOrdersListing.js +6 -3
  391. package/dist/features/stores/components/StoreProductsListing.js +6 -3
  392. package/dist/features/stores/components/StoreReviewsListing.js +8 -2
  393. package/dist/features/stores/components/StoresIndexListing.js +12 -6
  394. package/dist/features/stores/hooks/useStoreAddressSelector.d.ts +1 -1
  395. package/dist/features/stores/hooks/useStores.d.ts +6 -6
  396. package/dist/features/whatsapp-bot/components/SellerWhatsAppSettingsView.js +7 -1
  397. package/dist/features/whatsapp-bot/components/WhatsAppChatButton.js +2 -1
  398. package/dist/features/wishlist/components/WishlistPage.js +2 -1
  399. package/dist/features/wishlist/hooks/useUserWishlist.d.ts +15 -15
  400. package/dist/features/wishlist/hooks/useWishlist.d.ts +1 -1
  401. package/dist/features/wishlist/hooks/useWishlistWithGuest.d.ts +1 -1
  402. package/dist/index.d.ts +10 -0
  403. package/dist/index.js +13 -1
  404. package/dist/next/components/GlobalError.js +2 -2
  405. package/dist/next/routing/route-map.d.ts +2 -0
  406. package/dist/next/routing/route-map.js +1 -0
  407. package/dist/react/ErrorBoundary.js +2 -2
  408. package/dist/styles.css +2 -1
  409. package/dist/tailwind-utilities.css +1 -1
  410. package/dist/ui/DataTable.js +17 -16
  411. package/dist/ui/components/DateInput.js +2 -2
  412. package/dist/ui/components/DetailPageGallery.js +4 -1
  413. package/dist/ui/components/DetailPageTabs.js +6 -2
  414. package/dist/ui/components/ImageLightbox.js +5 -3
  415. package/dist/ui/components/Input.js +6 -3
  416. package/dist/ui/components/Layout.d.ts +4 -0
  417. package/dist/ui/components/Layout.js +1 -1
  418. package/dist/ui/components/Layout.style.css +1 -0
  419. package/dist/ui/components/ListingFilterDrawer.js +4 -1
  420. package/dist/ui/components/ListingLayout.js +9 -8
  421. package/dist/ui/components/ListingToolbar.js +5 -1
  422. package/dist/ui/components/PaginatedSelect.d.ts +1 -2
  423. package/dist/ui/components/PaginatedSelect.js +1 -2
  424. package/dist/ui/components/Radio.js +1 -1
  425. package/dist/ui/components/Select.js +2 -1
  426. package/dist/ui/components/Slider.js +1 -1
  427. package/dist/ui/components/VacationBanner.js +2 -1
  428. package/dist/ui/components/surface-tokens.d.ts +1 -0
  429. package/dist/ui/components/surface-tokens.js +1 -0
  430. package/package.json +11 -2
@@ -0,0 +1,23 @@
1
+ interface BaseProps {
2
+ placeholder?: string;
3
+ disabled?: boolean;
4
+ /** Show the "+ Create new group" quick-create. Defaults to true. */
5
+ allowCreate?: boolean;
6
+ /** "store" hits /api/store/grouped-listings; "admin" hits /api/admin/grouped-listings. Defaults to "store". */
7
+ scope?: "store" | "admin";
8
+ /** Optional label rendered above the selector. */
9
+ label?: string;
10
+ }
11
+ interface SingleProps extends BaseProps {
12
+ multiple?: false;
13
+ value: string;
14
+ onChange: (v: string) => void;
15
+ }
16
+ interface MultiProps extends BaseProps {
17
+ multiple: true;
18
+ value: string[];
19
+ onChange: (v: string[]) => void;
20
+ }
21
+ export type GroupInlineSelectProps = SingleProps | MultiProps;
22
+ export declare function GroupInlineSelect(props: GroupInlineSelectProps): import("react/jsx-runtime").JSX.Element;
23
+ export {};
@@ -0,0 +1,80 @@
1
+ "use client";
2
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import React from "react";
4
+ import { PaginatedSelect } from "../../../ui/components/PaginatedSelect";
5
+ import { apiClient } from "../../../http";
6
+ import { ADMIN_ENDPOINTS, SELLER_ENDPOINTS } from "../../../constants/api-endpoints";
7
+ import { Text } from "../../../ui";
8
+ function makeLoadOptions(scope) {
9
+ const endpoint = scope === "admin"
10
+ ? ADMIN_ENDPOINTS.GROUPED_LISTINGS
11
+ : SELLER_ENDPOINTS.GROUPED_LISTINGS;
12
+ return async function loadGroupOptions(query, _page) {
13
+ const res = await apiClient.get(endpoint);
14
+ const raw = res.data?.items ?? res.items ?? [];
15
+ const all = raw.map((g) => {
16
+ const count = Array.isArray(g.productIds) ? g.productIds.length : 0;
17
+ const label = g.title ?? g.name ?? g.slug ?? String(g.id ?? "");
18
+ return {
19
+ value: String(g.id ?? ""),
20
+ label: count > 0 ? `${label} (${count})` : label,
21
+ };
22
+ });
23
+ const q = query.trim().toLowerCase();
24
+ const items = q ? all.filter((g) => g.label.toLowerCase().includes(q)) : all;
25
+ return { items, hasMore: false };
26
+ };
27
+ }
28
+ function toGroupSlug(name) {
29
+ const base = name
30
+ .toLowerCase()
31
+ .trim()
32
+ .replace(/[^a-z0-9]+/g, "-")
33
+ .replace(/^-+|-+$/g, "");
34
+ return base.startsWith("group-") ? base : `group-${base}`;
35
+ }
36
+ async function quickCreateGroup(values, scope) {
37
+ const title = String(values.title ?? "").trim();
38
+ if (!title)
39
+ throw new Error("Title is required");
40
+ const endpoint = scope === "admin"
41
+ ? ADMIN_ENDPOINTS.GROUPED_LISTINGS
42
+ : SELLER_ENDPOINTS.GROUPED_LISTINGS;
43
+ const res = await apiClient.post(endpoint, {
44
+ title,
45
+ slug: toGroupSlug(title),
46
+ productIds: [],
47
+ isActive: true,
48
+ groupTheme: "generic",
49
+ });
50
+ const id = String(res.data?.id ?? res.id ?? "");
51
+ if (!id)
52
+ throw new Error("Created group returned no id");
53
+ return { value: id, label: title };
54
+ }
55
+ export function GroupInlineSelect(props) {
56
+ const { placeholder = "Search groups…", disabled, allowCreate = true, scope = "store", label, } = props;
57
+ const loadOptions = React.useMemo(() => makeLoadOptions(scope), [scope]);
58
+ const sharedCreate = allowCreate
59
+ ? {
60
+ createLabel: "group",
61
+ drawerTitle: "Create group",
62
+ createFields: [
63
+ {
64
+ name: "title",
65
+ label: "Group title",
66
+ type: "text",
67
+ required: true,
68
+ placeholder: "e.g. Pokémon Starter Bundle",
69
+ },
70
+ ],
71
+ onCreateSubmit: (values) => quickCreateGroup(values, scope),
72
+ createSubmitLabel: "Create group",
73
+ }
74
+ : {};
75
+ const labelEl = label ? (_jsx(Text, { size: "sm", weight: "medium", className: "mb-1", children: label })) : null;
76
+ if (props.multiple) {
77
+ return (_jsxs(_Fragment, { children: [labelEl, _jsx(PaginatedSelect, { multiple: true, value: props.value, onChange: (v) => props.onChange(v), loadOptions: loadOptions, placeholder: placeholder, disabled: disabled, ...sharedCreate })] }));
78
+ }
79
+ return (_jsxs(_Fragment, { children: [labelEl, _jsx(PaginatedSelect, { value: props.value || null, onChange: (v) => props.onChange(v ?? ""), loadOptions: loadOptions, placeholder: placeholder, disabled: disabled, ...sharedCreate })] }));
80
+ }
@@ -5,6 +5,7 @@ import { Modal } from "../../../ui/components/Modal";
5
5
  import { Input } from "../../../ui/components/Input";
6
6
  import { Button } from "../../../ui/components/Button";
7
7
  import { Row } from "../../../ui/components/Layout";
8
+ import { Div } from "../../../ui/components/Div";
8
9
  import { Text } from "../../../ui/components/Typography";
9
10
  export function PhysicalLocationModal({ count, onSave, onClose }) {
10
11
  const [zone, setZone] = useState("");
@@ -26,5 +27,5 @@ export function PhysicalLocationModal({ count, onSave, onClose }) {
26
27
  setSaving(false);
27
28
  }
28
29
  };
29
- return (_jsx(Modal, { isOpen: true, onClose: onClose, title: `Set Location — ${count} item${count !== 1 ? "s" : ""}`, size: "sm", actions: _jsxs(Row, { gap: "sm", justify: "end", children: [_jsx(Button, { variant: "ghost", onClick: onClose, disabled: saving, children: "Cancel" }), _jsx(Button, { variant: "primary", onClick: handleSave, disabled: saving, children: saving ? "Saving..." : "Save" })] }), children: _jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "12px" }, children: [_jsx(Text, { variant: "muted", children: "Assign a physical storage location to the selected items. All fields are optional." }), _jsx(Input, { label: "Zone (e.g. A, B, Storage-1)", value: zone, onChange: e => setZone(e.target.value), placeholder: "A" }), _jsx(Input, { label: "Shelf (e.g. 3, Top, Middle)", value: shelf, onChange: e => setShelf(e.target.value), placeholder: "3" }), _jsx(Input, { label: "Bin (e.g. Blue, Box-12)", value: bin, onChange: e => setBin(e.target.value), placeholder: "Blue" }), error && _jsx(Text, { variant: "error", children: error })] }) }));
30
+ return (_jsx(Modal, { isOpen: true, onClose: onClose, title: `Set Location — ${count} item${count !== 1 ? "s" : ""}`, size: "sm", actions: _jsxs(Row, { gap: "sm", justify: "end", children: [_jsx(Button, { variant: "ghost", onClick: onClose, disabled: saving, children: "Cancel" }), _jsx(Button, { variant: "primary", onClick: handleSave, disabled: saving, children: saving ? "Saving..." : "Save" })] }), children: _jsxs(Div, { style: { display: "flex", flexDirection: "column", gap: "12px" }, children: [_jsx(Text, { variant: "muted", children: "Assign a physical storage location to the selected items. All fields are optional." }), _jsx(Input, { label: "Zone (e.g. A, B, Storage-1)", value: zone, onChange: e => setZone(e.target.value), placeholder: "A" }), _jsx(Input, { label: "Shelf (e.g. 3, Top, Middle)", value: shelf, onChange: e => setShelf(e.target.value), placeholder: "3" }), _jsx(Input, { label: "Bin (e.g. Blue, Box-12)", value: bin, onChange: e => setBin(e.target.value), placeholder: "Blue" }), error && _jsx(Text, { variant: "error", children: error })] }) }));
30
31
  }
@@ -1,6 +1,7 @@
1
1
  "use client";
2
2
  import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
3
3
  import { Heading, Text } from "../../../ui/components/Typography";
4
+ import { Div } from "../../../ui/components/Div";
4
5
  export function PrintCenterView({ store, brandName = "LetItRip" }) {
5
- return (_jsxs("div", { className: "flex flex-col items-center justify-center py-24 text-center gap-4", children: [_jsxs(Heading, { level: 2, children: [brandName, " Print Center"] }), store && _jsx(Text, { size: "sm", variant: "muted", children: store.storeName }), _jsx(Text, { size: "sm", variant: "muted", children: "Print center features are coming soon." })] }));
6
+ return (_jsxs(Div, { className: "flex flex-col items-center justify-center py-24 text-center gap-4", children: [_jsxs(Heading, { level: 2, children: [brandName, " Print Center"] }), store && _jsx(Text, { size: "sm", variant: "muted", children: store.storeName }), _jsx(Text, { size: "sm", variant: "muted", children: "Print center features are coming soon." })] }));
6
7
  }
@@ -0,0 +1,24 @@
1
+ type Scope = "admin" | "store";
2
+ interface BaseProps {
3
+ /** Which API to query. "store" lists the seller's own products; "admin" lists all. */
4
+ scope: Scope;
5
+ placeholder?: string;
6
+ disabled?: boolean;
7
+ /** Filter expression appended to the request, e.g. "listingType==standard". */
8
+ filters?: string;
9
+ /** Override the endpoint (for store-products with a custom path, e.g. `/api/store/products`). */
10
+ endpoint?: string;
11
+ }
12
+ interface SingleProps extends BaseProps {
13
+ multiple?: false;
14
+ value: string | null;
15
+ onChange: (v: string | null) => void;
16
+ }
17
+ interface MultiProps extends BaseProps {
18
+ multiple: true;
19
+ value: string[];
20
+ onChange: (v: string[]) => void;
21
+ }
22
+ export type ProductInlineSelectProps = SingleProps | MultiProps;
23
+ export declare function ProductInlineSelect(props: ProductInlineSelectProps): import("react/jsx-runtime").JSX.Element;
24
+ export {};
@@ -0,0 +1,42 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import React from "react";
4
+ import { PaginatedSelect } from "../../../ui/components/PaginatedSelect";
5
+ import { apiClient } from "../../../http";
6
+ import { ADMIN_ENDPOINTS, SELLER_ENDPOINTS, } from "../../../constants/api-endpoints";
7
+ function endpointFor(scope, override) {
8
+ if (override)
9
+ return override;
10
+ return scope === "admin"
11
+ ? ADMIN_ENDPOINTS.PRODUCTS
12
+ : SELLER_ENDPOINTS.PRODUCTS;
13
+ }
14
+ function makeLoader(scope, filters, endpoint) {
15
+ const base = endpointFor(scope, endpoint);
16
+ return async (query, page) => {
17
+ const params = new URLSearchParams({
18
+ page: String(page),
19
+ pageSize: "25",
20
+ });
21
+ if (query.trim())
22
+ params.set("q", query.trim());
23
+ if (filters)
24
+ params.set("filters", filters);
25
+ const res = await apiClient.get(`${base}?${params.toString()}`);
26
+ const raw = res.data ?? res.products ?? res.items ?? [];
27
+ const items = raw.map((p) => ({
28
+ value: String(p.id ?? p.slug ?? ""),
29
+ label: String(p.title ?? p.name ?? p.slug ?? p.id ?? ""),
30
+ }));
31
+ const total = res.total ?? items.length;
32
+ return { items, hasMore: page * 25 < total, nextPage: page + 1 };
33
+ };
34
+ }
35
+ export function ProductInlineSelect(props) {
36
+ const { scope, placeholder = "Search products…", disabled, filters, endpoint, } = props;
37
+ const loader = React.useMemo(() => makeLoader(scope, filters, endpoint), [scope, filters, endpoint]);
38
+ if (props.multiple) {
39
+ return (_jsx(PaginatedSelect, { multiple: true, value: props.value, onChange: (v) => props.onChange(v), loadOptions: loader, placeholder: placeholder, disabled: disabled, searchPlaceholder: "Type title or slug\u2026" }));
40
+ }
41
+ return (_jsx(PaginatedSelect, { value: props.value, onChange: (v) => props.onChange(v), loadOptions: loader, placeholder: placeholder, disabled: disabled, searchPlaceholder: "Type title or slug\u2026" }));
42
+ }
@@ -2,6 +2,9 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useState } from "react";
4
4
  import { Alert, Button, Div, FormField, Stack, Text } from "../../../ui";
5
+ const __P = {
6
+ p5: "p-5",
7
+ };
5
8
  function toRupees(paise) {
6
9
  return paise != null && paise > 0 ? String(Math.round(paise / 100)) : "";
7
10
  }
@@ -43,7 +46,7 @@ export function QuickProductForm({ values, onChange, onPublish, onSave, onSwitch
43
46
  }
44
47
  onSave();
45
48
  };
46
- return (_jsxs(Stack, { gap: "lg", className: "p-5", children: [_jsx(Div, { children: _jsx(Text, { className: "text-sm text-zinc-500 dark:text-zinc-400", children: "Quick add \u2014 fill the essentials and publish. You can add more details later." }) }), touched && Object.keys(errors).length > 0 && (_jsx(Alert, { variant: "error", children: "Please fix the highlighted fields before publishing." })), _jsx(FormField, { name: "title", label: "Product Name", type: "text", value: values.title ?? "", onChange: (v) => onChange({ title: v }), placeholder: "e.g. Charizard Base Set PSA 9", required: true, error: touched ? errors.title : undefined }), renderCategorySelector ? (_jsxs(Div, { children: [_jsx(Text, { className: "text-sm font-medium text-zinc-700 dark:text-zinc-300 mb-1", children: "Category" }), renderCategorySelector({
49
+ return (_jsxs(Stack, { gap: "lg", className: `${__P.p5}`, children: [_jsx(Div, { children: _jsx(Text, { className: "text-sm text-zinc-500 dark:text-zinc-400", children: "Quick add \u2014 fill the essentials and publish. You can add more details later." }) }), touched && Object.keys(errors).length > 0 && (_jsx(Alert, { variant: "error", children: "Please fix the highlighted fields before publishing." })), _jsx(FormField, { name: "title", label: "Product Name", type: "text", value: values.title ?? "", onChange: (v) => onChange({ title: v }), placeholder: "e.g. Charizard Base Set PSA 9", required: true, error: touched ? errors.title : undefined }), renderCategorySelector ? (_jsxs(Div, { children: [_jsx(Text, { className: "text-sm font-medium text-zinc-700 dark:text-zinc-300 mb-1", children: "Category" }), renderCategorySelector({
47
50
  value: values.category ?? "",
48
51
  onChange: (v) => onChange({ category: v }),
49
52
  }), touched && errors.category && (_jsx(Text, { className: "text-xs text-[var(--appkit-color-error)] mt-1", children: errors.category }))] })) : (_jsx(FormField, { name: "category", label: "Category", type: "text", value: values.category ?? "", onChange: (v) => onChange({ category: v }), placeholder: "e.g. Trading Cards", error: touched ? errors.category : undefined })), _jsx(FormField, { name: "price", label: "Price (\u20B9)", type: "number", value: toRupees(values.price), onChange: (v) => onChange({ price: toPaise(v) }), placeholder: "e.g. 499", required: true, error: touched ? errors.price : undefined }), _jsx(FormField, { name: "mainImage", label: "Product Image", type: "image", value: values.mainImage ?? "", onChange: (v) => onChange({ mainImage: v }), onUpload: onUploadImage, required: true, error: touched ? errors.mainImage : undefined }), _jsx(FormField, { name: "description", label: "Description", type: "textarea", value: values.description ?? "", onChange: (v) => onChange({ description: v }), placeholder: "Brief description (optional)", rows: 3 }), _jsx(FormField, { name: "stockQuantity", label: "Stock Quantity", type: "number", value: String(values.stockQuantity ?? 1), onChange: (v) => onChange({ stockQuantity: Math.max(0, parseInt(v, 10) || 0) }), placeholder: "1", hint: "How many units are available" }), _jsxs(Div, { className: "flex flex-col gap-3 pt-2", children: [_jsxs(Div, { className: "flex gap-3", children: [_jsx(Button, { variant: "primary", onClick: handlePublish, disabled: isLoading, className: "flex-1", children: isLoading ? "Publishing..." : "Publish" }), _jsx(Button, { variant: "secondary", onClick: handleSave, disabled: isLoading, children: "Save Draft" })] }), _jsx(Button, { variant: "ghost", size: "sm", onClick: onSwitchToFull, className: "self-center text-xs", children: "Show all fields (advanced)" })] })] }));
@@ -2,11 +2,16 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import { useCallback, useEffect, useState } from "react";
4
4
  import { MapPin, Pencil, Plus, Trash2, Star } from "lucide-react";
5
- import { Button, ConfirmDeleteModal, Div, Grid, Heading, Label, Row, SideDrawer, Span, Stack, Text } from "../../../ui";
5
+ import { Button, ConfirmDeleteModal, Div, Grid, Heading, Label, Row, SideDrawer, Span, Stack, Table, Thead, Tbody, Tr, Th, Td, Text } from "../../../ui";
6
6
  import { ROW_ACTION_META, ROW_ACTION_ID } from "../../../features/products/constants/action-defs";
7
7
  import { SELLER_ENDPOINTS } from "../../../constants/api-endpoints";
8
8
  import { useEntityDelete } from "../../../react/hooks/useEntityDelete";
9
+ const __O = {
10
+ xAuto: "overflow-x-auto",
11
+ };
9
12
  const INPUT_CLS = "w-full rounded-lg border border-zinc-300 dark:border-slate-600 bg-white dark:bg-slate-800 px-3 py-2 text-sm text-zinc-900 dark:text-zinc-100 placeholder-zinc-400 dark:placeholder-zinc-500 focus:outline-none focus:ring-2 focus:ring-[var(--appkit-color-primary)]";
13
+ const CLS_DEFAULT_PILL = "inline-flex items-center gap-1 rounded-full bg-amber-50 dark:bg-amber-950/40 text-amber-700 dark:text-amber-300 border border-amber-200 dark:border-amber-800 px-2 py-0.5";
14
+ const CLS_DELETE_BTN = "rounded-lg p-1.5 text-zinc-500 dark:text-zinc-400 hover:bg-red-50 dark:hover:bg-red-950/40 hover:text-red-600 dark:hover:text-red-400 transition-colors";
10
15
  function Field({ label, hint, children }) {
11
16
  return (_jsxs(Stack, { gap: "xs", children: [_jsx(Label, { className: "block text-xs font-medium text-zinc-700 dark:text-zinc-300", children: label }), children, hint && _jsx(Text, { size: "xs", color: "muted", children: hint })] }));
12
17
  }
@@ -42,7 +47,7 @@ function fromDoc(doc) {
42
47
  };
43
48
  }
44
49
  function AddressCard({ address, onEdit, onDelete, }) {
45
- return (_jsxs(Div, { surface: "card", padding: "sm", className: "flex flex-col gap-2", children: [_jsxs(Row, { align: "start", justify: "between", gap: "xs", children: [_jsxs(Row, { gap: "xs", className: "min-w-0", children: [_jsx(MapPin, { className: "h-4 w-4 shrink-0 text-[var(--appkit-color-primary)]" }), _jsx(Span, { weight: "semibold", className: "text-sm text-zinc-900 dark:text-zinc-100 truncate", children: address.label }), address.isDefault && (_jsxs(Span, { className: "inline-flex items-center gap-1 rounded-full bg-amber-50 dark:bg-amber-950/40 text-amber-700 dark:text-amber-300 border border-amber-200 dark:border-amber-800 text-xs px-2 py-0.5 font-medium", children: [_jsx(Star, { className: "h-3 w-3" }), "Default"] }))] }), _jsxs(Row, { gap: "px", className: "shrink-0", children: [_jsx("button", { type: "button", onClick: onEdit, title: "Edit address", className: "rounded-lg p-1.5 text-zinc-500 dark:text-zinc-400 hover:bg-zinc-100 dark:hover:bg-zinc-800 hover:text-zinc-700 dark:hover:text-zinc-300 transition-colors", children: _jsx(Pencil, { className: "h-4 w-4" }) }), _jsx("button", { type: "button", onClick: onDelete, title: "Delete address", className: "rounded-lg p-1.5 text-zinc-500 dark:text-zinc-400 hover:bg-red-50 dark:hover:bg-red-950/40 hover:text-red-600 dark:hover:text-red-400 transition-colors", children: _jsx(Trash2, { className: "h-4 w-4" }) })] })] }), _jsxs(Text, { className: "text-sm text-zinc-700 dark:text-zinc-300", children: [address.fullName, " \u00B7 ", address.phone] }), _jsxs(Text, { className: "text-xs text-zinc-500 dark:text-zinc-400 leading-relaxed", children: [address.addressLine1, address.addressLine2 ? `, ${address.addressLine2}` : "", address.landmark ? ` (near ${address.landmark})` : "", _jsx("br", {}), address.city, ", ", address.state, " ", address.postalCode, ", ", address.country] })] }));
50
+ return (_jsxs(Div, { surface: "card", padding: "sm", className: "flex flex-col gap-2", children: [_jsxs(Row, { align: "start", justify: "between", gap: "xs", children: [_jsxs(Row, { gap: "xs", className: "min-w-0", children: [_jsx(MapPin, { className: "h-4 w-4 shrink-0 text-[var(--appkit-color-primary)]" }), _jsx(Span, { size: "sm", weight: "semibold", className: "text-zinc-900 dark:text-zinc-100 truncate", children: address.label }), address.isDefault && (_jsxs(Span, { size: "xs", weight: "medium", className: CLS_DEFAULT_PILL, children: [_jsx(Star, { className: "h-3 w-3" }), "Default"] }))] }), _jsxs(Row, { gap: "px", className: "shrink-0", children: [_jsx("button", { type: "button", onClick: onEdit, title: "Edit address", className: "rounded-lg p-1.5 text-zinc-500 dark:text-zinc-400 hover:bg-zinc-100 dark:hover:bg-zinc-800 hover:text-zinc-700 dark:hover:text-zinc-300 transition-colors", children: _jsx(Pencil, { className: "h-4 w-4" }) }), _jsx("button", { type: "button", onClick: onDelete, title: "Delete address", className: CLS_DELETE_BTN, children: _jsx(Trash2, { className: "h-4 w-4" }) })] })] }), _jsxs(Text, { className: "text-sm text-zinc-700 dark:text-zinc-300", children: [address.fullName, " \u00B7 ", address.phone] }), _jsxs(Text, { className: "text-xs text-zinc-500 dark:text-zinc-400 leading-relaxed", children: [address.addressLine1, address.addressLine2 ? `, ${address.addressLine2}` : "", address.landmark ? ` (near ${address.landmark})` : "", _jsx("br", {}), address.city, ", ", address.state, " ", address.postalCode, ", ", address.country] })] }));
46
51
  }
47
52
  // ---------------------------------------------------------------------------
48
53
  // Main Component
@@ -134,5 +139,5 @@ export function SellerAddressesView({ apiBase = SELLER_ENDPOINTS.STORE_ADDRESSES
134
139
  const handleDelete = (addr) => setDeleteTargetAddr(addr);
135
140
  const set = (key, value) => setDraft((p) => ({ ...p, [key]: value }));
136
141
  const handleTextField = (key) => (e) => set(key, e.target.value);
137
- return (_jsxs(Div, { className: "min-h-screen", children: [_jsxs(Row, { justify: "between", className: "sticky z-10 bg-white/95 dark:bg-slate-900/95 backdrop-blur-sm border-b border-zinc-200 dark:border-slate-700 px-4 py-3", style: { top: "var(--header-height, 0px)" }, children: [_jsxs(Stack, { gap: "none", children: [_jsx(Heading, { level: 2, className: "text-base font-semibold text-zinc-900 dark:text-zinc-100", children: "Pickup Addresses" }), _jsx(Text, { size: "xs", color: "muted", className: "mt-0.5", children: "Manage your store's pickup and return locations" })] }), _jsxs(Button, { size: "sm", onClick: openAdd, className: "flex items-center gap-1.5", children: [_jsx(Plus, { className: "h-4 w-4" }), _jsx(Span, { children: "Add Address" })] })] }), _jsxs(Div, { className: "py-6 px-4 sm:px-6 max-w-2xl", children: [errorMessage && (_jsx(Div, { className: "mb-4 rounded-xl border border-error/20 bg-error-surface px-4 py-3 text-sm text-error", children: errorMessage })), isLoading ? (_jsx(Row, { justify: "center", className: "py-16", children: _jsx(Div, { className: "h-6 w-6 animate-spin rounded-full border-2 border-[var(--appkit-color-primary)] border-t-transparent" }) })) : addresses.length === 0 ? (_jsxs(Div, { className: "rounded-xl border-2 border-dashed border-zinc-200 dark:border-slate-700 py-16 flex flex-col items-center gap-3", children: [_jsx(MapPin, { className: "h-8 w-8 text-zinc-300 dark:text-slate-600" }), _jsx(Text, { className: "text-sm text-zinc-500 dark:text-zinc-400", children: "No pickup addresses yet" }), _jsx(Button, { size: "sm", variant: "outline", onClick: openAdd, children: "Add your first address" })] })) : (_jsxs(_Fragment, { children: [_jsxs(Row, { justify: "end", className: "mb-2", children: [_jsx(Button, { size: "sm", variant: listView === "table" ? "primary" : "ghost", onClick: () => setListView("table"), children: "Table" }), _jsx(Button, { size: "sm", variant: listView === "cards" ? "primary" : "ghost", onClick: () => setListView("cards"), children: "Cards" })] }), listView === "cards" ? (_jsx(Grid, { gap: "sm", children: addresses.map((addr) => (_jsx(Div, { className: deletingId === addr.id ? "opacity-50 pointer-events-none" : "", children: _jsx(AddressCard, { address: addr, onEdit: () => openEdit(addr), onDelete: () => handleDelete(addr) }) }, addr.id))) })) : (_jsx(Div, { className: "overflow-x-auto rounded-lg border border-zinc-200 dark:border-slate-700", children: _jsxs("table", { className: "w-full text-sm", children: [_jsx("thead", { className: "bg-zinc-50 dark:bg-slate-800", children: _jsxs("tr", { children: [_jsx("th", { className: "text-left px-3 py-2 font-semibold", children: "Label" }), _jsx("th", { className: "text-left px-3 py-2 font-semibold", children: "Name" }), _jsx("th", { className: "text-left px-3 py-2 font-semibold", children: "City" }), _jsx("th", { className: "text-left px-3 py-2 font-semibold", children: "Phone" }), _jsx("th", { className: "text-right px-3 py-2 font-semibold", children: "Actions" })] }) }), _jsx("tbody", { children: addresses.map((addr) => (_jsxs("tr", { className: `border-t border-zinc-100 dark:border-slate-700 ${deletingId === addr.id ? "opacity-50" : ""}`, children: [_jsx("td", { className: "px-3 py-2", children: addr.label }), _jsx("td", { className: "px-3 py-2", children: addr.fullName }), _jsxs("td", { className: "px-3 py-2", children: [addr.city, ", ", addr.state] }), _jsx("td", { className: "px-3 py-2 tabular-nums", children: addr.phone }), _jsx("td", { className: "px-3 py-2 text-right", children: _jsxs(Row, { justify: "end", className: "gap-1", children: [_jsx(Button, { size: "sm", variant: "ghost", onClick: () => openEdit(addr), children: ROW_ACTION_META[ROW_ACTION_ID.EDIT].label }), _jsx(Button, { size: "sm", variant: "ghost", onClick: () => handleDelete(addr), children: ROW_ACTION_META[ROW_ACTION_ID.DELETE].label })] }) })] }, addr.id))) })] }) }))] }))] }), _jsx(SideDrawer, { isOpen: drawerOpen, onClose: closeDrawer, title: editingId ? "Edit Address" : "Add Address", footer: _jsxs(Row, { gap: "xs", children: [_jsx(Button, { variant: "outline", onClick: closeDrawer, className: "flex-1", children: "Cancel" }), _jsx(Button, { onClick: handleSave, disabled: saving, className: "flex-1", children: saving ? "Saving…" : editingId ? "Save Changes" : "Add Address" })] }), children: _jsxs(Stack, { gap: "md", className: "py-1", children: [saveError && (_jsx(Div, { className: "rounded-lg border border-error/20 bg-error-surface px-3 py-2 text-sm text-error", children: saveError })), _jsx(Field, { label: "Label *", hint: "e.g. Warehouse, Shop, Home", children: _jsx("input", { type: "text", value: draft.label, onChange: handleTextField("label"), placeholder: "Warehouse", maxLength: 60, className: INPUT_CLS }) }), _jsxs(Grid, { cols: 2, gap: "sm", children: [_jsx(Field, { label: "Full Name *", children: _jsx("input", { type: "text", value: draft.fullName, onChange: handleTextField("fullName"), placeholder: "Ravi Kumar", maxLength: 100, className: INPUT_CLS }) }), _jsx(Field, { label: "Phone *", children: _jsx("input", { type: "tel", value: draft.phone, onChange: handleTextField("phone"), placeholder: "+91 98765 43210", maxLength: 20, className: INPUT_CLS }) })] }), _jsx(Field, { label: "Address Line 1 *", children: _jsx("input", { type: "text", value: draft.addressLine1, onChange: handleTextField("addressLine1"), placeholder: "Shop 12, Main Market", maxLength: 200, className: INPUT_CLS }) }), _jsx(Field, { label: "Address Line 2", children: _jsx("input", { type: "text", value: draft.addressLine2, onChange: handleTextField("addressLine2"), placeholder: "Building / Floor (optional)", maxLength: 200, className: INPUT_CLS }) }), _jsx(Field, { label: "Landmark", children: _jsx("input", { type: "text", value: draft.landmark, onChange: handleTextField("landmark"), placeholder: "Near metro station (optional)", maxLength: 100, className: INPUT_CLS }) }), _jsxs(Grid, { cols: 2, gap: "sm", children: [_jsx(Field, { label: "City *", children: _jsx("input", { type: "text", value: draft.city, onChange: handleTextField("city"), placeholder: "Mumbai", maxLength: 100, className: INPUT_CLS }) }), _jsx(Field, { label: "State *", children: _jsx("input", { type: "text", value: draft.state, onChange: handleTextField("state"), placeholder: "Maharashtra", maxLength: 100, className: INPUT_CLS }) })] }), _jsxs(Grid, { cols: 2, gap: "sm", children: [_jsx(Field, { label: "Postal Code *", children: _jsx("input", { type: "text", value: draft.postalCode, onChange: handleTextField("postalCode"), placeholder: "400001", maxLength: 10, className: INPUT_CLS }) }), _jsx(Field, { label: "Country *", children: _jsx("input", { type: "text", value: draft.country, onChange: handleTextField("country"), placeholder: "India", maxLength: 60, className: INPUT_CLS }) })] }), _jsxs("label", { className: "flex items-center gap-3 cursor-pointer", children: [_jsx("input", { type: "checkbox", checked: draft.isDefault, onChange: (e) => set("isDefault", e.target.checked), className: "h-4 w-4 rounded border-zinc-300 dark:border-slate-600 text-[var(--appkit-color-primary)] focus:ring-[var(--appkit-color-primary)]" }), _jsx(Span, { className: "text-sm text-zinc-700 dark:text-zinc-300", children: "Set as default pickup address" })] })] }) }), deleteTargetAddr && (_jsx(ConfirmDeleteModal, { isOpen: true, title: "Delete Address", message: `Delete address "${deleteTargetAddr.label}"? This cannot be undone.`, onConfirm: () => { deleteById(deleteTargetAddr.id); setDeleteTargetAddr(null); }, onClose: () => setDeleteTargetAddr(null), isDeleting: deletingId === deleteTargetAddr.id }))] }));
142
+ return (_jsxs(Div, { className: "min-h-screen", children: [_jsxs(Row, { justify: "between", className: "sticky z-10 bg-white/95 dark:bg-slate-900/95 backdrop-blur-sm border-b border-zinc-200 dark:border-slate-700 px-4 py-3", style: { top: "var(--header-height, 0px)" }, children: [_jsxs(Stack, { gap: "none", children: [_jsx(Heading, { level: 2, className: "text-base font-semibold text-zinc-900 dark:text-zinc-100", children: "Pickup Addresses" }), _jsx(Text, { size: "xs", color: "muted", className: "mt-0.5", children: "Manage your store's pickup and return locations" })] }), _jsxs(Button, { size: "sm", onClick: openAdd, className: "flex items-center gap-1.5", children: [_jsx(Plus, { className: "h-4 w-4" }), _jsx(Span, { children: "Add Address" })] })] }), _jsxs(Div, { className: "py-6 px-4 sm:px-6 max-w-2xl", children: [errorMessage && (_jsx(Div, { className: "mb-4 rounded-xl border border-error/20 bg-error-surface px-4 py-3 text-sm text-error", children: errorMessage })), isLoading ? (_jsx(Row, { justify: "center", className: "py-16", children: _jsx(Div, { className: "h-6 w-6 animate-spin rounded-full border-2 border-[var(--appkit-color-primary)] border-t-transparent" }) })) : addresses.length === 0 ? (_jsxs(Div, { className: "rounded-xl border-2 border-dashed border-zinc-200 dark:border-slate-700 py-16 flex flex-col items-center gap-3", children: [_jsx(MapPin, { className: "h-8 w-8 text-zinc-300 dark:text-slate-600" }), _jsx(Text, { className: "text-sm text-zinc-500 dark:text-zinc-400", children: "No pickup addresses yet" }), _jsx(Button, { size: "sm", variant: "outline", onClick: openAdd, children: "Add your first address" })] })) : (_jsxs(_Fragment, { children: [_jsxs(Row, { justify: "end", className: "mb-2", children: [_jsx(Button, { size: "sm", variant: listView === "table" ? "primary" : "ghost", onClick: () => setListView("table"), children: "Table" }), _jsx(Button, { size: "sm", variant: listView === "cards" ? "primary" : "ghost", onClick: () => setListView("cards"), children: "Cards" })] }), listView === "cards" ? (_jsx(Grid, { gap: "sm", children: addresses.map((addr) => (_jsx(Div, { className: deletingId === addr.id ? "opacity-50 pointer-events-none" : "", children: _jsx(AddressCard, { address: addr, onEdit: () => openEdit(addr), onDelete: () => handleDelete(addr) }) }, addr.id))) })) : (_jsx(Div, { className: `${__O.xAuto} rounded-lg border border-zinc-200 dark:border-slate-700`, children: _jsxs(Table, { className: "w-full text-sm", children: [_jsx(Thead, { className: "bg-zinc-50 dark:bg-slate-800", children: _jsxs(Tr, { children: [_jsx(Th, { className: "text-left px-3 py-2 font-semibold", children: "Label" }), _jsx(Th, { className: "text-left px-3 py-2 font-semibold", children: "Name" }), _jsx(Th, { className: "text-left px-3 py-2 font-semibold", children: "City" }), _jsx(Th, { className: "text-left px-3 py-2 font-semibold", children: "Phone" }), _jsx(Th, { className: "text-right px-3 py-2 font-semibold", children: "Actions" })] }) }), _jsx(Tbody, { children: addresses.map((addr) => (_jsxs(Tr, { className: `border-t border-zinc-100 dark:border-slate-700 ${deletingId === addr.id ? "opacity-50" : ""}`, children: [_jsx(Td, { className: "px-3 py-2", children: addr.label }), _jsx(Td, { className: "px-3 py-2", children: addr.fullName }), _jsxs(Td, { className: "px-3 py-2", children: [addr.city, ", ", addr.state] }), _jsx(Td, { className: "px-3 py-2 tabular-nums", children: addr.phone }), _jsx(Td, { className: "px-3 py-2 text-right", children: _jsxs(Row, { justify: "end", className: "gap-1", children: [_jsx(Button, { size: "sm", variant: "ghost", onClick: () => openEdit(addr), children: ROW_ACTION_META[ROW_ACTION_ID.EDIT].label }), _jsx(Button, { size: "sm", variant: "ghost", onClick: () => handleDelete(addr), children: ROW_ACTION_META[ROW_ACTION_ID.DELETE].label })] }) })] }, addr.id))) })] }) }))] }))] }), _jsx(SideDrawer, { isOpen: drawerOpen, onClose: closeDrawer, title: editingId ? "Edit Address" : "Add Address", footer: _jsxs(Row, { gap: "xs", children: [_jsx(Button, { variant: "outline", onClick: closeDrawer, className: "flex-1", children: "Cancel" }), _jsx(Button, { onClick: handleSave, disabled: saving, className: "flex-1", children: saving ? "Saving…" : editingId ? "Save Changes" : "Add Address" })] }), children: _jsxs(Stack, { gap: "md", className: "py-1", children: [saveError && (_jsx(Div, { className: "rounded-lg border border-error/20 bg-error-surface px-3 py-2 text-sm text-error", children: saveError })), _jsx(Field, { label: "Label *", hint: "e.g. Warehouse, Shop, Home", children: _jsx("input", { type: "text", value: draft.label, onChange: handleTextField("label"), placeholder: "Warehouse", maxLength: 60, className: INPUT_CLS }) }), _jsxs(Grid, { cols: 2, gap: "sm", children: [_jsx(Field, { label: "Full Name *", children: _jsx("input", { type: "text", value: draft.fullName, onChange: handleTextField("fullName"), placeholder: "Ravi Kumar", maxLength: 100, className: INPUT_CLS }) }), _jsx(Field, { label: "Phone *", children: _jsx("input", { type: "tel", value: draft.phone, onChange: handleTextField("phone"), placeholder: "+91 98765 43210", maxLength: 20, className: INPUT_CLS }) })] }), _jsx(Field, { label: "Address Line 1 *", children: _jsx("input", { type: "text", value: draft.addressLine1, onChange: handleTextField("addressLine1"), placeholder: "Shop 12, Main Market", maxLength: 200, className: INPUT_CLS }) }), _jsx(Field, { label: "Address Line 2", children: _jsx("input", { type: "text", value: draft.addressLine2, onChange: handleTextField("addressLine2"), placeholder: "Building / Floor (optional)", maxLength: 200, className: INPUT_CLS }) }), _jsx(Field, { label: "Landmark", children: _jsx("input", { type: "text", value: draft.landmark, onChange: handleTextField("landmark"), placeholder: "Near metro station (optional)", maxLength: 100, className: INPUT_CLS }) }), _jsxs(Grid, { cols: 2, gap: "sm", children: [_jsx(Field, { label: "City *", children: _jsx("input", { type: "text", value: draft.city, onChange: handleTextField("city"), placeholder: "Mumbai", maxLength: 100, className: INPUT_CLS }) }), _jsx(Field, { label: "State *", children: _jsx("input", { type: "text", value: draft.state, onChange: handleTextField("state"), placeholder: "Maharashtra", maxLength: 100, className: INPUT_CLS }) })] }), _jsxs(Grid, { cols: 2, gap: "sm", children: [_jsx(Field, { label: "Postal Code *", children: _jsx("input", { type: "text", value: draft.postalCode, onChange: handleTextField("postalCode"), placeholder: "400001", maxLength: 10, className: INPUT_CLS }) }), _jsx(Field, { label: "Country *", children: _jsx("input", { type: "text", value: draft.country, onChange: handleTextField("country"), placeholder: "India", maxLength: 60, className: INPUT_CLS }) })] }), _jsxs("label", { className: "flex items-center gap-3 cursor-pointer", children: [_jsx("input", { type: "checkbox", checked: draft.isDefault, onChange: (e) => set("isDefault", e.target.checked), className: "h-4 w-4 rounded border-zinc-300 dark:border-slate-600 text-[var(--appkit-color-primary)] focus:ring-[var(--appkit-color-primary)]" }), _jsx(Span, { size: "sm", className: "text-zinc-700 dark:text-zinc-300", children: "Set as default pickup address" })] })] }) }), deleteTargetAddr && (_jsx(ConfirmDeleteModal, { isOpen: true, title: "Delete Address", message: `Delete address "${deleteTargetAddr.label}"? This cannot be undone.`, onConfirm: () => { deleteById(deleteTargetAddr.id); setDeleteTargetAddr(null); }, onClose: () => setDeleteTargetAddr(null), isDeleting: deletingId === deleteTargetAddr.id }))] }));
138
143
  }
@@ -5,6 +5,9 @@ import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
5
5
  import { Alert, Badge, Button, Div, Form, FormActions, Heading, Input, Row, Section, Select, Text, Toggle, useToast, } from "../../../ui";
6
6
  import { apiClient } from "../../../http";
7
7
  import { SELLER_ENDPOINTS } from "../../../constants/api-endpoints";
8
+ const __P = {
9
+ p5: "p-5",
10
+ };
8
11
  // ---------------------------------------------------------------------------
9
12
  // Config
10
13
  // ---------------------------------------------------------------------------
@@ -50,7 +53,7 @@ function AlertCard({ alert, onToggle, onDelete, }) {
50
53
  const metricLabel = METRIC_OPTIONS.find((m) => m.value === alert.metric)?.label ?? alert.metric;
51
54
  const opLabel = OPERATOR_OPTIONS.find((o) => o.value === alert.operator)?.label ?? alert.operator;
52
55
  const windowLabel = WINDOW_OPTIONS.find((w) => w.value === String(alert.windowHours))?.label ?? `${alert.windowHours}h`;
53
- return (_jsxs(Div, { surface: "card", padding: "sm", className: "flex items-start justify-between gap-4", children: [_jsxs("div", { className: "flex-1 min-w-0", children: [_jsxs(Row, { className: "gap-2 mb-1 flex-wrap", children: [_jsx(Text, { className: "font-medium text-zinc-900 dark:text-zinc-100 text-sm", children: alert.label }), _jsx(Badge, { variant: alert.isActive ? "success" : "default", children: alert.isActive ? "Active" : "Paused" })] }), _jsxs(Text, { className: "text-xs text-zinc-500 dark:text-zinc-400 mb-1", children: [metricLabel, " ", opLabel, " ", alert.threshold, " \u00B7 ", windowLabel] }), _jsx(Row, { className: "gap-1 flex-wrap", children: alert.notifyChannels.map((ch) => (_jsx(Badge, { variant: OPERATOR_BADGE[alert.operator] ?? "default", children: ch }, ch))) }), alert.lastTriggeredAt && (_jsxs(Text, { className: "text-xs text-zinc-400 dark:text-zinc-400 mt-1", children: ["Last triggered: ", new Date(alert.lastTriggeredAt).toLocaleString("en-IN")] }))] }), _jsxs("div", { className: "flex items-center gap-2 shrink-0", children: [_jsx(Toggle, { checked: alert.isActive, onChange: (v) => onToggle(alert.id, v), size: "sm" }), _jsx(Button, { variant: "ghost", size: "sm", onClick: () => onDelete(alert.id), className: "text-error hover:text-error", children: "Delete" })] })] }));
56
+ return (_jsxs(Div, { surface: "card", padding: "sm", className: "flex items-start justify-between gap-4", children: [_jsxs(Div, { className: "flex-1 min-w-0", children: [_jsxs(Row, { className: "gap-2 mb-1 flex-wrap", children: [_jsx(Text, { className: "font-medium text-zinc-900 dark:text-zinc-100 text-sm", children: alert.label }), _jsx(Badge, { variant: alert.isActive ? "success" : "default", children: alert.isActive ? "Active" : "Paused" })] }), _jsxs(Text, { className: "text-xs text-zinc-500 dark:text-zinc-400 mb-1", children: [metricLabel, " ", opLabel, " ", alert.threshold, " \u00B7 ", windowLabel] }), _jsx(Row, { className: "gap-1 flex-wrap", children: alert.notifyChannels.map((ch) => (_jsx(Badge, { variant: OPERATOR_BADGE[alert.operator] ?? "default", children: ch }, ch))) }), alert.lastTriggeredAt && (_jsxs(Text, { className: "text-xs text-zinc-400 dark:text-zinc-400 mt-1", children: ["Last triggered: ", new Date(alert.lastTriggeredAt).toLocaleString("en-IN")] }))] }), _jsxs(Div, { className: "flex items-center gap-2 shrink-0", children: [_jsx(Toggle, { checked: alert.isActive, onChange: (v) => onToggle(alert.id, v), size: "sm" }), _jsx(Button, { variant: "ghost", size: "sm", onClick: () => onDelete(alert.id), className: "text-error hover:text-error", children: "Delete" })] })] }));
54
57
  }
55
58
  const EMPTY_DRAFT = {
56
59
  label: "",
@@ -118,7 +121,7 @@ export function SellerAnalyticsAlertsView({ labels = {}, }) {
118
121
  : [...d.notifyChannels, ch],
119
122
  }));
120
123
  }, []);
121
- return (_jsxs("div", { className: "space-y-6", children: [_jsxs(Row, { justify: "between", children: [_jsx(Heading, { level: 2, className: "text-base font-semibold text-zinc-900 dark:text-zinc-100", children: labels.title ?? "Analytics Alerts" }), _jsx(Button, { size: "sm", onClick: () => setShowForm((v) => !v), children: showForm ? "Cancel" : "+ New Alert" })] }), _jsx(Text, { className: "text-sm text-zinc-500 dark:text-zinc-400", children: "Get notified when a key metric crosses a threshold. Alerts check the metric over the selected window and fire through your chosen channels." }), showForm && (_jsxs(Section, { className: "border border-zinc-200 dark:border-zinc-700 rounded-xl p-5 space-y-4", children: [_jsx(Heading, { level: 3, className: "text-sm font-semibold text-zinc-900 dark:text-zinc-100", children: "Create Alert" }), _jsxs(Form, { onSubmit: (e) => { e.preventDefault(); createMutation.mutate(); }, children: [_jsxs("div", { className: "grid sm:grid-cols-2 gap-4", children: [_jsx(Input, { label: "Alert label", value: draft.label, onChange: (e) => setDraft((d) => ({ ...d, label: e.target.value })), placeholder: "e.g. Low daily orders", required: true }), _jsx(Select, { label: "Metric", value: draft.metric, onValueChange: (v) => setDraft((d) => ({ ...d, metric: v })), options: METRIC_OPTIONS }), _jsx(Select, { label: "Operator", value: draft.operator, onValueChange: (v) => setDraft((d) => ({ ...d, operator: v })), options: OPERATOR_OPTIONS }), _jsx(Input, { label: "Threshold", type: "number", value: draft.threshold, onChange: (e) => setDraft((d) => ({ ...d, threshold: e.target.value })), placeholder: "e.g. 10", required: true }), _jsx(Select, { label: "Check window", value: draft.windowHours, onValueChange: (v) => setDraft((d) => ({ ...d, windowHours: v })), options: WINDOW_OPTIONS })] }), _jsxs("div", { className: "mt-3", children: [_jsx(Text, { className: "text-xs font-medium text-zinc-700 dark:text-zinc-300 mb-2", children: "Notify via" }), _jsx(Row, { className: "gap-2 flex-wrap", children: CHANNEL_OPTIONS.map((ch) => (_jsx("button", { type: "button", onClick: () => toggleChannel(ch.value), className: `px-3 py-1.5 rounded-full text-xs border transition-colors ${draft.notifyChannels.includes(ch.value)
124
+ return (_jsxs(Div, { className: "space-y-6", children: [_jsxs(Row, { justify: "between", children: [_jsx(Heading, { level: 2, className: "text-base font-semibold text-zinc-900 dark:text-zinc-100", children: labels.title ?? "Analytics Alerts" }), _jsx(Button, { size: "sm", onClick: () => setShowForm((v) => !v), children: showForm ? "Cancel" : "+ New Alert" })] }), _jsx(Text, { className: "text-sm text-zinc-500 dark:text-zinc-400", children: "Get notified when a key metric crosses a threshold. Alerts check the metric over the selected window and fire through your chosen channels." }), showForm && (_jsxs(Section, { className: `border border-zinc-200 dark:border-zinc-700 rounded-xl ${__P.p5} space-y-4`, children: [_jsx(Heading, { level: 3, className: "text-sm font-semibold text-zinc-900 dark:text-zinc-100", children: "Create Alert" }), _jsxs(Form, { onSubmit: (e) => { e.preventDefault(); createMutation.mutate(); }, children: [_jsxs(Div, { className: "grid sm:grid-cols-2 gap-4", children: [_jsx(Input, { label: "Alert label", value: draft.label, onChange: (e) => setDraft((d) => ({ ...d, label: e.target.value })), placeholder: "e.g. Low daily orders", required: true }), _jsx(Select, { label: "Metric", value: draft.metric, onValueChange: (v) => setDraft((d) => ({ ...d, metric: v })), options: METRIC_OPTIONS }), _jsx(Select, { label: "Operator", value: draft.operator, onValueChange: (v) => setDraft((d) => ({ ...d, operator: v })), options: OPERATOR_OPTIONS }), _jsx(Input, { label: "Threshold", type: "number", value: draft.threshold, onChange: (e) => setDraft((d) => ({ ...d, threshold: e.target.value })), placeholder: "e.g. 10", required: true }), _jsx(Select, { label: "Check window", value: draft.windowHours, onValueChange: (v) => setDraft((d) => ({ ...d, windowHours: v })), options: WINDOW_OPTIONS })] }), _jsxs(Div, { className: "mt-3", children: [_jsx(Text, { className: "text-xs font-medium text-zinc-700 dark:text-zinc-300 mb-2", children: "Notify via" }), _jsx(Row, { className: "gap-2 flex-wrap", children: CHANNEL_OPTIONS.map((ch) => (_jsx("button", { type: "button", onClick: () => toggleChannel(ch.value), className: `px-3 py-1.5 rounded-full text-xs border transition-colors ${draft.notifyChannels.includes(ch.value)
122
125
  ? "bg-[var(--appkit-color-primary)] text-white border-transparent"
123
- : "bg-white dark:bg-zinc-800 text-zinc-700 dark:text-zinc-300 border-zinc-200 dark:border-zinc-700"}`, children: ch.label }, ch.value))) })] }), _jsx(FormActions, { align: "right", className: "mt-4", children: _jsx(Button, { type: "submit", isLoading: createMutation.isPending, children: createMutation.isPending ? "Creating…" : "Create Alert" }) })] })] })), isLoading && (_jsx("div", { className: "space-y-2", children: [1, 2, 3].map((i) => (_jsx("div", { className: "h-16 rounded-lg bg-zinc-100 dark:bg-zinc-800 animate-pulse" }, i))) })), !isLoading && alerts.length === 0 && !showForm && (_jsx(Alert, { variant: "info", children: "No alerts configured. Create an alert to get notified when a key metric crosses a threshold." })), !isLoading && alerts.length > 0 && (_jsx("div", { className: "space-y-3", children: alerts.map((alert) => (_jsx(AlertCard, { alert: alert, onToggle: (id, isActive) => toggleMutation.mutate({ id, isActive }), onDelete: (id) => deleteMutation.mutate(id) }, alert.id))) }))] }));
126
+ : "bg-white dark:bg-zinc-800 text-zinc-700 dark:text-zinc-300 border-zinc-200 dark:border-zinc-700"}`, children: ch.label }, ch.value))) })] }), _jsx(FormActions, { align: "right", className: "mt-4", children: _jsx(Button, { type: "submit", isLoading: createMutation.isPending, children: createMutation.isPending ? "Creating…" : "Create Alert" }) })] })] })), isLoading && (_jsx(Div, { className: "space-y-2", children: [1, 2, 3].map((i) => (_jsx(Div, { className: "h-16 rounded-lg bg-zinc-100 dark:bg-zinc-800 animate-pulse" }, i))) })), !isLoading && alerts.length === 0 && !showForm && (_jsx(Alert, { variant: "info", children: "No alerts configured. Create an alert to get notified when a key metric crosses a threshold." })), !isLoading && alerts.length > 0 && (_jsx(Div, { className: "space-y-3", children: alerts.map((alert) => (_jsx(AlertCard, { alert: alert, onToggle: (id, isActive) => toggleMutation.mutate({ id, isActive }), onDelete: (id) => deleteMutation.mutate(id) }, alert.id))) }))] }));
124
127
  }
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import React from "react";
4
- import { StackedViewShell, Row, Text } from "../../../ui";
4
+ import { StackedViewShell, Label, Row, Text } from "../../../ui";
5
5
  function DefaultDateRange({ from, to, onChange, labels, }) {
6
- return (_jsxs(Row, { gap: "md", align: "center", wrap: true, className: "flex-wrap", children: [_jsxs("label", { className: "flex items-center gap-2 text-sm text-[var(--appkit-color-text-muted)]", children: [_jsx(Text, { size: "sm", variant: "secondary", children: labels.dateFrom ?? "From" }), _jsx("input", { type: "date", value: from, onChange: (e) => onChange(e.target.value, to), className: "appkit-input text-sm py-1.5 px-3" })] }), _jsxs("label", { className: "flex items-center gap-2 text-sm text-[var(--appkit-color-text-muted)]", children: [_jsx(Text, { size: "sm", variant: "secondary", children: labels.dateTo ?? "To" }), _jsx("input", { type: "date", value: to, onChange: (e) => onChange(from, e.target.value), className: "appkit-input text-sm py-1.5 px-3" })] })] }));
6
+ return (_jsxs(Row, { gap: "md", align: "center", wrap: true, className: "flex-wrap", children: [_jsxs(Label, { className: "flex items-center gap-2 text-sm text-[var(--appkit-color-text-muted)]", children: [_jsx(Text, { size: "sm", variant: "secondary", children: labels.dateFrom ?? "From" }), _jsx("input", { type: "date", value: from, onChange: (e) => onChange(e.target.value, to), className: "appkit-input text-sm py-1.5 px-3" })] }), _jsxs(Label, { className: "flex items-center gap-2 text-sm text-[var(--appkit-color-text-muted)]", children: [_jsx(Text, { size: "sm", variant: "secondary", children: labels.dateTo ?? "To" }), _jsx("input", { type: "date", value: to, onChange: (e) => onChange(from, e.target.value), className: "appkit-input text-sm py-1.5 px-3" })] })] }));
7
7
  }
8
8
  export function SellerAnalyticsView({ labels = {}, renderDateRange, renderStats, renderCharts, renderTopProducts, isLoading = false, ...rest }) {
9
9
  const [from, setFrom] = React.useState("");
@@ -3,7 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import React, { useState, useCallback } from "react";
4
4
  import { useUrlTable } from "../../../react/hooks/useUrlTable";
5
5
  import { useBulkSelection } from "../../../react/hooks/useBulkSelection";
6
- import { Badge, BulkActionBar, Div, FilterChipGroup, ListingFilterDrawer, ListingToolbar, Pagination, Text, useToast } from "../../../ui";
6
+ import { Badge, BulkActionBar, Div, FilterChipGroup, ListingFilterDrawer, ListingToolbar, Pagination, Span, Text, useToast } from "../../../ui";
7
7
  import { SELLER_ENDPOINTS } from "../../../constants/api-endpoints";
8
8
  import { ACTIONS } from "../../../_internal/shared/actions/action-registry";
9
9
  import { buildBulkAction } from "../../../_internal/shared/actions/bulk-helpers";
@@ -97,19 +97,19 @@ export function SellerBidsView({ endpoint = SELLER_ENDPOINTS.BIDS }) {
97
97
  {
98
98
  key: "productTitle",
99
99
  header: "Auction",
100
- render: (row) => (_jsxs("div", { className: "space-y-0.5", children: [_jsx(Text, { className: "font-medium text-sm text-zinc-900 dark:text-zinc-100 line-clamp-1", children: row.productTitle }), _jsx(Text, { className: "text-xs text-zinc-400 dark:text-zinc-400 font-mono", children: row.productId })] })),
100
+ render: (row) => (_jsxs(Div, { className: "space-y-0.5", children: [_jsx(Text, { className: "font-medium text-sm text-zinc-900 dark:text-zinc-100 line-clamp-1", children: row.productTitle }), _jsx(Text, { className: "text-xs text-zinc-400 dark:text-zinc-400 font-mono", children: row.productId })] })),
101
101
  },
102
102
  {
103
103
  key: "userName",
104
104
  header: "Bidder",
105
105
  className: "w-36",
106
- render: (row) => _jsx("span", { className: "text-sm text-zinc-700 dark:text-zinc-300", children: row.userName }),
106
+ render: (row) => _jsx(Span, { size: "sm", className: "text-zinc-700 dark:text-zinc-300", children: row.userName }),
107
107
  },
108
108
  {
109
109
  key: "bidAmount",
110
110
  header: "Bid",
111
111
  className: "w-28 text-right",
112
- render: (row) => (_jsx("span", { className: "font-semibold text-sm text-zinc-900 dark:text-zinc-100", children: toRupees(row.bidAmount) })),
112
+ render: (row) => (_jsx(Span, { size: "sm", weight: "semibold", className: "text-zinc-900 dark:text-zinc-100", children: toRupees(row.bidAmount) })),
113
113
  },
114
114
  {
115
115
  key: "status",
@@ -121,7 +121,7 @@ export function SellerBidsView({ endpoint = SELLER_ENDPOINTS.BIDS }) {
121
121
  key: "bidDate",
122
122
  header: "Date",
123
123
  className: "w-28",
124
- render: (row) => _jsx("span", { className: "text-xs text-zinc-500 dark:text-zinc-400", children: row.bidDate }),
124
+ render: (row) => _jsx(Span, { size: "xs", className: "text-zinc-500 dark:text-zinc-400", children: row.bidDate }),
125
125
  },
126
126
  ];
127
127
  const selection = useBulkSelection({ items: rows ?? [], keyExtractor: (r) => r.id });
@@ -165,8 +165,8 @@ export function SellerBidsView({ endpoint = SELLER_ENDPOINTS.BIDS }) {
165
165
  buildBulkAction(ACTIONS.SELLER["cancel-bid"], () => void bulkCancel()),
166
166
  ];
167
167
  useBottomActions(selection.selectedCount > 0 ? { bulk: { selectedCount: selection.selectedCount, onClearSelection: selection.clearSelection, actions: bulkActions } } : {});
168
- return (_jsxs("div", { className: "min-h-screen", children: [_jsx(ListingToolbar, { filterCount: activeFilterCount, onFiltersClick: openFilters, searchValue: searchInput, searchPlaceholder: "Search by bidder name", onSearchChange: setSearchInput, onSearchCommit: commitSearch, sortValue: table.get("sort") || DEFAULT_SORT, sortOptions: SORT_OPTIONS, onSortChange: (v) => { table.set("sort", v); }, showTableView: true, view: view, onViewChange: (v) => setView(v), onResetAll: resetAll, hasActiveState: hasActiveState }), totalPages > 1 && (_jsx("div", { className: "sticky top-[calc(var(--header-height,0px)+44px)] z-10 flex justify-center bg-white/95 dark:bg-slate-900/95 backdrop-blur-sm border-b border-zinc-200 dark:border-slate-700 px-3 py-1.5", children: _jsx(Pagination, { currentPage: currentPage, totalPages: totalPages, onPageChange: (p) => table.setPage(p) }) })), selection.selectedIds.length > 0 && (_jsx("div", { className: "sticky z-20 px-3 sm:px-4 py-2 bg-white/95 dark:bg-slate-900/95 backdrop-blur-sm border-b border-zinc-200 dark:border-slate-700", style: { top: "calc(var(--header-height, 0px) + 88px)" }, children: _jsx(BulkActionBar, { selectedCount: selection.selectedIds.length, onClearSelection: selection.clearSelection, actions: bulkActions }) })), _jsxs("div", { className: "py-4 px-3 sm:px-4", children: [errorMessage && (_jsx(Div, { className: "mb-4 rounded-xl border border-error/20 bg-error-surface px-4 py-3 text-sm text-error", children: errorMessage })), table.get("grouped") === "0" ? (_jsx(DataTable, { rows: rows, columns: columns, isLoading: isLoading, emptyLabel: "No bids found for your auctions", selectedIds: selection.selectedIdSet, onToggleSelect: selection.toggle, onToggleSelectAll: () => selection.toggleAll() })) : (_jsxs("div", { className: "space-y-3", children: [groupedRows.length === 0 && !isLoading && (_jsx(Text, { className: "text-sm text-zinc-500 dark:text-zinc-400", children: "No bids found for your auctions." })), groupedRows.map((group) => {
168
+ return (_jsxs(Div, { className: "min-h-screen", children: [_jsx(ListingToolbar, { filterCount: activeFilterCount, onFiltersClick: openFilters, searchValue: searchInput, searchPlaceholder: "Search by bidder name", onSearchChange: setSearchInput, onSearchCommit: commitSearch, sortValue: table.get("sort") || DEFAULT_SORT, sortOptions: SORT_OPTIONS, onSortChange: (v) => { table.set("sort", v); }, showTableView: true, view: view, onViewChange: (v) => setView(v), onResetAll: resetAll, hasActiveState: hasActiveState }), totalPages > 1 && (_jsx(Div, { className: "sticky top-[calc(var(--header-height,0px)+44px)] z-10 flex justify-center bg-white/95 dark:bg-slate-900/95 backdrop-blur-sm border-b border-zinc-200 dark:border-slate-700 px-3 py-1.5", children: _jsx(Pagination, { currentPage: currentPage, totalPages: totalPages, onPageChange: (p) => table.setPage(p) }) })), selection.selectedIds.length > 0 && (_jsx(Div, { className: "sticky z-20 px-3 sm:px-4 py-2 bg-white/95 dark:bg-slate-900/95 backdrop-blur-sm border-b border-zinc-200 dark:border-slate-700", style: { top: "calc(var(--header-height, 0px) + 88px)" }, children: _jsx(BulkActionBar, { selectedCount: selection.selectedIds.length, onClearSelection: selection.clearSelection, actions: bulkActions }) })), _jsxs(Div, { className: "py-4 px-3 sm:px-4", children: [errorMessage && (_jsx(Div, { className: "mb-4 rounded-xl border border-error/20 bg-error-surface px-4 py-3 text-sm text-error", children: errorMessage })), table.get("grouped") === "0" ? (_jsx(DataTable, { rows: rows, columns: columns, isLoading: isLoading, emptyLabel: "No bids found for your auctions", selectedIds: selection.selectedIdSet, onToggleSelect: selection.toggle, onToggleSelectAll: () => selection.toggleAll() })) : (_jsxs(Div, { className: "space-y-3", children: [groupedRows.length === 0 && !isLoading && (_jsx(Text, { className: "text-sm text-zinc-500 dark:text-zinc-400", children: "No bids found for your auctions." })), groupedRows.map((group) => {
169
169
  const collapsed = collapsedGroups.has(group.id);
170
- return (_jsxs(Div, { className: "rounded-lg border border-[var(--appkit-color-border)] bg-[var(--appkit-color-surface)]", children: [_jsxs("button", { type: "button", onClick: () => toggleGroup(group.id), className: "w-full flex items-center justify-between px-4 py-2.5 text-sm font-semibold text-[var(--appkit-color-text)] hover:bg-[var(--appkit-color-surface-raised)]", children: [_jsxs("span", { className: "truncate", children: [group.title, " ", _jsxs("span", { className: "text-xs text-[var(--appkit-color-text-muted)] font-normal", children: ["\u00B7 ", group.bids.length, " bid", group.bids.length === 1 ? "" : "s"] })] }), _jsx("span", { "aria-hidden": true, className: "text-[var(--appkit-color-text-muted)]", children: collapsed ? "▸" : "▾" })] }), !collapsed && (_jsx("div", { className: "border-t border-[var(--appkit-color-border)]", children: _jsx(DataTable, { rows: group.bids, columns: columns, isLoading: false, emptyLabel: "", selectedIds: selection.selectedIdSet, onToggleSelect: selection.toggle }) }))] }, group.id));
170
+ return (_jsxs(Div, { className: "rounded-lg border border-[var(--appkit-color-border)] bg-[var(--appkit-color-surface)]", children: [_jsxs("button", { type: "button", onClick: () => toggleGroup(group.id), className: "w-full flex items-center justify-between px-4 py-2.5 text-sm font-semibold text-[var(--appkit-color-text)] hover:bg-[var(--appkit-color-surface-raised)]", children: [_jsxs(Span, { className: "truncate", children: [group.title, " ", _jsxs(Span, { size: "xs", weight: "normal", className: "text-[var(--appkit-color-text-muted)]", children: ["\u00B7 ", group.bids.length, " bid", group.bids.length === 1 ? "" : "s"] })] }), _jsx(Span, { "aria-hidden": true, className: "text-[var(--appkit-color-text-muted)]", children: collapsed ? "▸" : "▾" })] }), !collapsed && (_jsx(Div, { className: "border-t border-[var(--appkit-color-border)]", children: _jsx(DataTable, { rows: group.bids, columns: columns, isLoading: false, emptyLabel: "", selectedIds: selection.selectedIdSet, onToggleSelect: selection.toggle }) }))] }, group.id));
171
171
  })] }))] }), _jsx(ListingFilterDrawer, { open: filterOpen, onClose: () => setFilterOpen(false), onApply: applyFilters, onClear: clearFilters, activeCount: activeFilterCount, children: _jsx(FilterChipGroup, { label: "Bid Status", tabs: STATUS_OPTIONS, value: pendingFilters.status ?? "", onChange: (id) => setPendingFilters((p) => ({ ...p, status: id })), allId: "" }) })] }));
172
172
  }
@@ -6,6 +6,7 @@ import { ConfirmDeleteModal, RowActionMenu, Text } from "../../../ui";
6
6
  import { SELLER_ENDPOINTS } from "../../../constants/api-endpoints";
7
7
  import { ACTIONS } from "../../../_internal/shared/actions/action-registry";
8
8
  import { ROUTES } from "../../..";
9
+ const CLS_ITEMS_PILL = "inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium bg-violet-100 text-violet-700 dark:bg-violet-900/40 dark:text-violet-300 tabular-nums";
9
10
  import { toRecordArray, toRelativeDate, toRupees, toStringValue, } from "../../admin/hooks/useAdminListingData";
10
11
  import { DataListingView } from "../../admin/components/DataListingView";
11
12
  const COLUMNS = [
@@ -14,7 +15,7 @@ const COLUMNS = [
14
15
  {
15
16
  key: "itemCount",
16
17
  header: "Items",
17
- render: (row) => (_jsx("span", { className: "inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium bg-violet-100 text-violet-700 dark:bg-violet-900/40 dark:text-violet-300 tabular-nums", children: row.itemCount })),
18
+ render: (row) => (_jsx("span", { className: CLS_ITEMS_PILL, children: row.itemCount })),
18
19
  },
19
20
  {
20
21
  key: "status",
@@ -9,6 +9,8 @@ export interface CouponEditorDraft {
9
9
  startDate: string;
10
10
  endDate: string;
11
11
  isActive: boolean;
12
+ applicableProducts: string[];
13
+ applicableCategories: string[];
12
14
  }
13
15
  export interface SellerCouponEditorViewProps {
14
16
  couponId?: string;
@@ -1,10 +1,16 @@
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 { Badge, Button, Div, Heading, Input, Row, Select, Stack, Text } from "../../../ui";
4
+ import { Badge, Button, Div, Heading, Input, Row, Select, Span, Stack, Text } from "../../../ui";
5
+ import { ProductInlineSelect } from "./ProductInlineSelect";
6
+ import { CategoryInlineSelect } from "./CategoryInlineSelect";
7
+ const __O = {
8
+ hidden: "overflow-hidden",
9
+ };
5
10
  // ---------------------------------------------------------------------------
6
11
  // Types
7
12
  // ---------------------------------------------------------------------------
13
+ const CLS_SECTION_LABEL = "font-medium text-[var(--appkit-color-text-secondary)] mb-3";
8
14
  const TYPE_OPTIONS = [
9
15
  { value: "percentage", label: "Percentage off (e.g. 10%)" },
10
16
  { value: "fixed", label: "Fixed amount off (e.g. ₹50)" },
@@ -21,6 +27,8 @@ const EMPTY_DRAFT = {
21
27
  startDate: "",
22
28
  endDate: "",
23
29
  isActive: true,
30
+ applicableProducts: [],
31
+ applicableCategories: [],
24
32
  };
25
33
  // ---------------------------------------------------------------------------
26
34
  // Component
@@ -61,7 +69,11 @@ export function SellerCouponEditorView({ couponId, initial, onSave, onCancel, })
61
69
  }
62
70
  };
63
71
  const isEdit = Boolean(couponId);
64
- return (_jsx("form", { onSubmit: handleSubmit, noValidate: true, children: _jsxs(Stack, { gap: "none", className: "max-w-lg mx-auto rounded-xl border border-[var(--appkit-color-border)] bg-[var(--appkit-color-surface)] shadow-sm overflow-hidden", children: [_jsx("div", { className: "h-[3px] w-full", style: { background: "linear-gradient(to right,var(--appkit-color-primary-700,#1343de) 0%,var(--appkit-color-cobalt,#3570fc) 55%,var(--appkit-color-secondary-400,#84e122) 100%)" }, "aria-hidden": "true" }), _jsx(Div, { className: "border-b border-[var(--appkit-color-border)] px-6 py-5", children: _jsxs(Row, { justify: "between", className: "gap-3", children: [_jsx(Heading, { level: 2, className: "text-lg font-semibold text-[var(--appkit-color-text)]", children: isEdit ? "Edit Coupon" : "Create Coupon" }), isEdit && (_jsx(Badge, { variant: draft.isActive ? "success" : "default", children: draft.isActive ? "Active" : "Inactive" }))] }) }), _jsxs(Stack, { gap: "5", className: "px-6 py-6", children: [error && (_jsx(Div, { className: "rounded-lg border border-error/20 bg-error-surface px-4 py-3 text-sm text-error", children: error })), _jsx(Input, { label: "Coupon Code", value: draft.code, onChange: (e) => set("code", e.target.value.toUpperCase().replace(/\s+/g, "")), placeholder: "e.g. WELCOME10", required: true, disabled: isEdit, helperText: isEdit ? "Code cannot be changed after creation" : "Customers enter this at checkout" }), _jsx(Select, { label: "Discount Type", value: draft.type, options: TYPE_OPTIONS, onChange: (e) => set("type", e.target.value) }), draft.type !== "free_shipping" && (_jsx(Input, { label: draft.type === "percentage" ? "Discount Percentage (%)" : "Discount Amount (₹)", type: "number", min: 1, max: draft.type === "percentage" ? 100 : undefined, value: draft.value, onChange: (e) => set("value", e.target.value), placeholder: draft.type === "percentage" ? "e.g. 10" : "e.g. 50", required: true, helperText: draft.type === "percentage"
72
+ return (_jsx("form", { onSubmit: handleSubmit, noValidate: true, children: _jsxs(Stack, { gap: "none", className: `max-w-lg mx-auto rounded-xl border border-[var(--appkit-color-border)] bg-[var(--appkit-color-surface)] shadow-sm ${__O.hidden}`, children: [_jsx("div", { className: "h-[3px] w-full", style: { background: "linear-gradient(to right,var(--appkit-color-primary-700,#1343de) 0%,var(--appkit-color-cobalt,#3570fc) 55%,var(--appkit-color-secondary-400,#84e122) 100%)" }, "aria-hidden": "true" }), _jsx(Div, { className: "border-b border-[var(--appkit-color-border)] px-6 py-5", children: _jsxs(Row, { justify: "between", className: "gap-3", children: [_jsx(Heading, { level: 2, className: "text-lg font-semibold text-[var(--appkit-color-text)]", children: isEdit ? "Edit Coupon" : "Create Coupon" }), isEdit && (_jsx(Badge, { variant: draft.isActive ? "success" : "default", children: draft.isActive ? "Active" : "Inactive" }))] }) }), _jsxs(Stack, { gap: "5", className: "px-6 py-6", children: [error && (_jsx(Div, { className: "rounded-lg border border-error/20 bg-error-surface px-4 py-3 text-sm text-error", children: error })), _jsx(Input, { label: "Coupon Code", value: draft.code, onChange: (e) => set("code", e.target.value.toUpperCase().replace(/\s+/g, "")), placeholder: "e.g. WELCOME10", required: true, disabled: isEdit, helperText: isEdit ? "Code cannot be changed after creation" : "Customers enter this at checkout" }), _jsx(Select, { label: "Discount Type", value: draft.type, options: TYPE_OPTIONS, onChange: (e) => set("type", e.target.value) }), draft.type !== "free_shipping" && (_jsx(Input, { label: draft.type === "percentage" ? "Discount Percentage (%)" : "Discount Amount (₹)", type: "number", min: 1, max: draft.type === "percentage" ? 100 : undefined, value: draft.value, onChange: (e) => set("value", e.target.value), placeholder: draft.type === "percentage" ? "e.g. 10" : "e.g. 50", required: true, helperText: draft.type === "percentage"
65
73
  ? "Enter a value between 1 and 100"
66
- : "Fixed rupee discount applied to the order" })), draft.type === "percentage" && (_jsx(Input, { label: "Max Discount Cap (\u20B9, optional)", type: "number", min: 0, value: draft.maxDiscount, onChange: (e) => set("maxDiscount", e.target.value), placeholder: "Leave blank for no cap", helperText: "Maximum rupee discount regardless of percentage" })), _jsx(Input, { label: "Minimum Order Amount (\u20B9, optional)", type: "number", min: 0, value: draft.minPurchase, onChange: (e) => set("minPurchase", e.target.value), placeholder: "Leave blank for no minimum" }), _jsxs(Div, { children: [_jsx(Text, { size: "sm", className: "font-medium text-[var(--appkit-color-text-secondary)] mb-3", children: "Usage Limits" }), _jsxs("div", { className: "grid grid-cols-2 gap-3", children: [_jsx(Input, { label: "Total Uses", type: "number", min: 0, value: draft.totalLimit, onChange: (e) => set("totalLimit", e.target.value), placeholder: "0 = unlimited" }), _jsx(Input, { label: "Per Customer", type: "number", min: 0, value: draft.perUserLimit, onChange: (e) => set("perUserLimit", e.target.value), placeholder: "0 = unlimited" })] })] }), _jsxs(Div, { children: [_jsx(Text, { size: "sm", className: "font-medium text-[var(--appkit-color-text-secondary)] mb-3", children: "Validity Period" }), _jsxs("div", { className: "grid grid-cols-2 gap-3", children: [_jsx(Input, { label: "Start Date", type: "date", value: draft.startDate, onChange: (e) => set("startDate", e.target.value), required: true }), _jsx(Input, { label: "End Date", type: "date", value: draft.endDate, onChange: (e) => set("endDate", e.target.value), required: true })] })] }), _jsx(Div, { className: "flex items-center gap-3 rounded-lg border border-[var(--appkit-color-border)] dark:border-[var(--appkit-color-border-dark)] px-4 py-3", children: _jsxs("label", { className: "flex items-center gap-3 cursor-pointer w-full", children: [_jsx("input", { type: "checkbox", checked: draft.isActive, onChange: (e) => set("isActive", e.target.checked), className: "h-4 w-4 rounded border-zinc-300 dark:border-slate-600 text-[var(--appkit-color-primary)] focus:ring-[var(--appkit-color-primary)]" }), _jsxs("div", { className: "flex-1 min-w-0", children: [_jsx(Text, { size: "sm", className: "font-medium text-[var(--appkit-color-text-primary)]", children: "Active" }), _jsx(Text, { size: "xs", className: "text-[var(--appkit-color-text-secondary)]", children: "Customers can apply this coupon at checkout" })] })] }) })] }), _jsx(Div, { className: "border-t border-[var(--appkit-color-border)] px-6 py-4", children: _jsxs(Row, { justify: "end", className: "gap-3", children: [onCancel && (_jsx(Button, { type: "button", variant: "outline", onClick: onCancel, disabled: saving, children: "Cancel" })), _jsx(Button, { type: "submit", isLoading: saving, disabled: saving, children: isEdit ? "Save Changes" : "Create Coupon" })] }) })] }) }));
74
+ : "Fixed rupee discount applied to the order" })), draft.type === "percentage" && (_jsx(Input, { label: "Max Discount Cap (\u20B9, optional)", type: "number", min: 0, value: draft.maxDiscount, onChange: (e) => set("maxDiscount", e.target.value), placeholder: "Leave blank for no cap", helperText: "Maximum rupee discount regardless of percentage" })), _jsx(Input, { label: "Minimum Order Amount (\u20B9, optional)", type: "number", min: 0, value: draft.minPurchase, onChange: (e) => set("minPurchase", e.target.value), placeholder: "Leave blank for no minimum" }), _jsxs(Div, { children: [_jsx(Text, { size: "sm", className: CLS_SECTION_LABEL, children: "Usage Limits" }), _jsxs(Div, { className: "grid grid-cols-2 gap-3", children: [_jsx(Input, { label: "Total Uses", type: "number", min: 0, value: draft.totalLimit, onChange: (e) => set("totalLimit", e.target.value), placeholder: "0 = unlimited" }), _jsx(Input, { label: "Per Customer", type: "number", min: 0, value: draft.perUserLimit, onChange: (e) => set("perUserLimit", e.target.value), placeholder: "0 = unlimited" })] })] }), _jsxs(Div, { children: [_jsx(Text, { size: "sm", className: CLS_SECTION_LABEL, children: "Validity Period" }), _jsxs(Div, { className: "grid grid-cols-2 gap-3", children: [_jsx(Input, { label: "Start Date", type: "date", value: draft.startDate, onChange: (e) => set("startDate", e.target.value), required: true }), _jsx(Input, { label: "End Date", type: "date", value: draft.endDate, onChange: (e) => set("endDate", e.target.value), required: true })] })] }), _jsxs(Div, { children: [_jsx(Text, { size: "sm", className: CLS_SECTION_LABEL, children: "Applicability (optional)" }), _jsxs(Stack, { gap: "sm", children: [_jsxs(Div, { children: [_jsx(Text, { size: "xs", className: "mb-1 text-[var(--appkit-color-text-secondary)]", children: "Applicable products" }), _jsx(ProductInlineSelect, { scope: "store", multiple: true, value: draft.applicableProducts, onChange: (v) => set("applicableProducts", v), placeholder: "Restrict to specific products\u2026" })] }), _jsxs(Div, { children: [_jsx(Text, { size: "xs", className: "mb-1 text-[var(--appkit-color-text-secondary)]", children: "Applicable categories" }), _jsx(CategoryInlineSelect, { value: "", onChange: (id) => {
75
+ if (!id || draft.applicableCategories.includes(id))
76
+ return;
77
+ set("applicableCategories", [...draft.applicableCategories, id]);
78
+ }, placeholder: "Add a category\u2026" }), draft.applicableCategories.length > 0 && (_jsx(Div, { className: "flex flex-wrap gap-2 pt-2", children: draft.applicableCategories.map((cid) => (_jsxs(Span, { className: "inline-flex items-center gap-1 rounded-full border border-zinc-300 bg-zinc-50 px-2.5 py-0.5 text-xs text-zinc-800 dark:border-zinc-600 dark:bg-zinc-800 dark:text-zinc-100", children: [cid, _jsx("button", { type: "button", "aria-label": `Remove ${cid}`, className: "text-zinc-500 hover:text-zinc-800 dark:text-zinc-400 dark:hover:text-zinc-100", onClick: () => set("applicableCategories", draft.applicableCategories.filter((c) => c !== cid)), children: "\u00D7" })] }, cid))) }))] }), _jsx(Text, { size: "xs", className: "text-[var(--appkit-color-text-secondary)]", children: "Leave both empty to apply the coupon to every product in your store." })] })] }), _jsx(Div, { className: "flex items-center gap-3 rounded-lg border border-[var(--appkit-color-border)] dark:border-[var(--appkit-color-border-dark)] px-4 py-3", children: _jsxs("label", { className: "flex items-center gap-3 cursor-pointer w-full", children: [_jsx("input", { type: "checkbox", checked: draft.isActive, onChange: (e) => set("isActive", e.target.checked), className: "h-4 w-4 rounded border-zinc-300 dark:border-slate-600 text-[var(--appkit-color-primary)] focus:ring-[var(--appkit-color-primary)]" }), _jsxs(Div, { className: "flex-1 min-w-0", children: [_jsx(Text, { size: "sm", className: "font-medium text-[var(--appkit-color-text-primary)]", children: "Active" }), _jsx(Text, { size: "xs", className: "text-[var(--appkit-color-text-secondary)]", children: "Customers can apply this coupon at checkout" })] })] }) })] }), _jsx(Div, { className: "border-t border-[var(--appkit-color-border)] px-6 py-4", children: _jsxs(Row, { justify: "end", className: "gap-3", children: [onCancel && (_jsx(Button, { type: "button", variant: "outline", onClick: onCancel, disabled: saving, children: "Cancel" })), _jsx(Button, { type: "submit", isLoading: saving, disabled: saving, children: isEdit ? "Save Changes" : "Create Coupon" })] }) })] }) }));
67
79
  }
@@ -67,7 +67,7 @@ export function SellerCouponsView({ onCreateClick, onEditClick, onToggle, onDele
67
67
  primaryAction: onCreateClick
68
68
  ? { label: "Add Coupon", onClick: () => onCreateClick() }
69
69
  : undefined,
70
- renderFilterPanel: ({ pendingFilters, setPendingFilters }) => (_jsxs(Div, { className: "space-y-2", children: [_jsx(Text, { className: "text-xs font-semibold uppercase tracking-widest text-zinc-500 dark:text-zinc-400", children: "Status" }), _jsx("div", { className: "flex flex-wrap gap-2", children: [
70
+ renderFilterPanel: ({ pendingFilters, setPendingFilters }) => (_jsxs(Div, { className: "space-y-2", children: [_jsx(Text, { className: "text-xs font-semibold uppercase tracking-widest text-zinc-500 dark:text-zinc-400", children: "Status" }), _jsx(Div, { className: "flex flex-wrap gap-2", children: [
71
71
  { label: "All", value: "" },
72
72
  { label: "Active", value: "true" },
73
73
  { label: "Inactive", value: "false" },
@@ -2,10 +2,10 @@
2
2
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { StackedViewShell, Div, Text } from "../../../ui";
4
4
  function DefaultStatsPlaceholder({ isLoading }) {
5
- return (_jsx("div", { className: "grid grid-cols-2 gap-4 sm:grid-cols-4", children: [1, 2, 3, 4].map((i) => (_jsx(Div, { className: "rounded-xl border border-[var(--appkit-color-border)] bg-[var(--appkit-color-surface)] p-5", children: isLoading ? (_jsxs(_Fragment, { children: [_jsx("div", { className: "h-3 w-16 animate-pulse rounded bg-[var(--appkit-color-border)]" }), _jsx("div", { className: "mt-3 h-6 w-20 animate-pulse rounded bg-[var(--appkit-color-border)]" })] })) : (_jsxs(_Fragment, { children: [_jsxs(Text, { size: "xs", variant: "secondary", className: "uppercase tracking-widest font-semibold", children: ["Stat ", i] }), _jsx(Text, { size: "xl", className: "mt-2 font-bold tabular-nums", children: "\u2014" })] })) }, i))) }));
5
+ return (_jsx(Div, { className: "grid grid-cols-2 gap-4 sm:grid-cols-4", children: [1, 2, 3, 4].map((i) => (_jsx(Div, { className: "rounded-xl border border-[var(--appkit-color-border)] bg-[var(--appkit-color-surface)] p-5", children: isLoading ? (_jsxs(_Fragment, { children: [_jsx(Div, { className: "h-3 w-16 animate-pulse rounded bg-[var(--appkit-color-border)]" }), _jsx(Div, { className: "mt-3 h-6 w-20 animate-pulse rounded bg-[var(--appkit-color-border)]" })] })) : (_jsxs(_Fragment, { children: [_jsxs(Text, { size: "xs", variant: "secondary", className: "uppercase tracking-widest font-semibold", children: ["Stat ", i] }), _jsx(Text, { size: "xl", className: "mt-2 font-bold tabular-nums", children: "\u2014" })] })) }, i))) }));
6
6
  }
7
7
  function DefaultQuickActionsPlaceholder() {
8
- return (_jsx("div", { className: "grid grid-cols-2 gap-3 sm:grid-cols-4", children: [1, 2, 3, 4].map((i) => (_jsx(Div, { className: "h-12 animate-pulse rounded-xl border border-[var(--appkit-color-border)] bg-[var(--appkit-color-border)]" }, i))) }));
8
+ return (_jsx(Div, { className: "grid grid-cols-2 gap-3 sm:grid-cols-4", children: [1, 2, 3, 4].map((i) => (_jsx(Div, { className: "h-12 animate-pulse rounded-xl border border-[var(--appkit-color-border)] bg-[var(--appkit-color-border)]" }, i))) }));
9
9
  }
10
10
  export function SellerDashboardView({ labels = {}, renderStats, renderQuickActions, renderRecentListings, renderRevenueChart, renderTopProducts, isLoading = false, ...rest }) {
11
11
  const stats = (renderStats ?? ((busy) => _jsx(DefaultStatsPlaceholder, { isLoading: busy })))(isLoading);
@@ -2,7 +2,7 @@
2
2
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useState, useCallback } from "react";
4
4
  import { useEntityDelete } from "../../../react/hooks/useEntityDelete";
5
- import { ConfirmDeleteModal, RowActionMenu, Text } from "../../../ui";
5
+ import { ConfirmDeleteModal, RowActionMenu, Span, Text } from "../../../ui";
6
6
  import { SELLER_ENDPOINTS } from "../../../constants/api-endpoints";
7
7
  import { ACTIONS } from "../../../_internal/shared/actions/action-registry";
8
8
  import { ROUTES } from "../../..";
@@ -24,7 +24,7 @@ const COLUMNS = [
24
24
  {
25
25
  key: "deliveryMethod",
26
26
  header: "Delivery",
27
- render: (row) => (_jsx("span", { className: "inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium bg-zinc-100 text-zinc-600 dark:bg-slate-800 dark:text-slate-400 capitalize", children: row.deliveryMethod.replace(/-/g, " ") })),
27
+ render: (row) => (_jsx(Span, { size: "xs", weight: "medium", className: "inline-flex items-center rounded-full px-2 py-0.5 bg-zinc-100 text-zinc-600 dark:bg-slate-800 dark:text-slate-400 capitalize", children: row.deliveryMethod.replace(/-/g, " ") })),
28
28
  },
29
29
  {
30
30
  key: "status",