@mohasinac/appkit 4.10.0 → 4.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (324) hide show
  1. package/dist/_internal/client/features/layout/DashboardLayoutClient.d.ts +6 -1
  2. package/dist/_internal/client/features/layout/DashboardLayoutClient.js +4 -1
  3. package/dist/_internal/client/features/lottery/LotteryPullForm.d.ts +1 -1
  4. package/dist/_internal/client/features/lottery/LotteryPullForm.js +2 -2
  5. package/dist/_internal/server/features/admin/daily-digest-actions.d.ts +18 -0
  6. package/dist/_internal/server/features/admin/daily-digest-actions.js +37 -0
  7. package/dist/_internal/server/features/audit-log/actions.d.ts +25 -0
  8. package/dist/_internal/server/features/audit-log/actions.js +38 -0
  9. package/dist/_internal/server/features/brands/actions.js +0 -2
  10. package/dist/_internal/server/features/brands/og.d.ts +4 -1
  11. package/dist/_internal/server/features/brands/og.js +1 -1
  12. package/dist/_internal/server/features/grouped/data.d.ts +4 -0
  13. package/dist/_internal/server/features/grouped/data.js +24 -0
  14. package/dist/_internal/server/features/grouped/index.d.ts +1 -1
  15. package/dist/_internal/server/features/grouped/index.js +1 -1
  16. package/dist/_internal/server/features/orders/actions.js +9 -0
  17. package/dist/_internal/server/features/orders/adapters.js +25 -0
  18. package/dist/_internal/server/features/products/data.d.ts +2 -2
  19. package/dist/_internal/server/features/products/data.js +5 -23
  20. package/dist/_internal/server/functions/scheduled.d.ts +3 -1
  21. package/dist/_internal/server/functions/scheduled.js +17 -1
  22. package/dist/_internal/server/jobs/core/dailyStatusDigest.d.ts +40 -0
  23. package/dist/_internal/server/jobs/core/dailyStatusDigest.js +164 -0
  24. package/dist/_internal/server/jobs/core/hardBanCascade.js +11 -0
  25. package/dist/_internal/server/jobs/core/testerSandboxCleanup.d.ts +1 -0
  26. package/dist/_internal/server/jobs/core/testerSandboxCleanup.js +4 -1
  27. package/dist/_internal/server/jobs/core/testerSandboxRefresh.d.ts +12 -0
  28. package/dist/_internal/server/jobs/core/testerSandboxRefresh.js +85 -0
  29. package/dist/_internal/server/jobs/core/whatsappNotify.js +16 -0
  30. package/dist/_internal/server/jobs/handlers/dailyStatusDigest.d.ts +2 -0
  31. package/dist/_internal/server/jobs/handlers/dailyStatusDigest.js +4 -0
  32. package/dist/_internal/server/jobs/handlers/index.d.ts +2 -0
  33. package/dist/_internal/server/jobs/handlers/index.js +3 -0
  34. package/dist/_internal/server/jobs/handlers/testerSandboxRefresh.d.ts +2 -0
  35. package/dist/_internal/server/jobs/handlers/testerSandboxRefresh.js +2 -0
  36. package/dist/_internal/server/notifications/channel-health.d.ts +27 -0
  37. package/dist/_internal/server/notifications/channel-health.js +101 -0
  38. package/dist/_internal/shared/features/brands/schema.d.ts +0 -6
  39. package/dist/_internal/shared/features/brands/schema.js +0 -1
  40. package/dist/_internal/shared/features/categories/bundle-schemas.d.ts +7 -0
  41. package/dist/_internal/shared/features/categories/bundle-schemas.js +3 -0
  42. package/dist/_internal/shared/features/orders/schema.d.ts +8 -8
  43. package/dist/_internal/shared/features/products/to-product-item.d.ts +25 -0
  44. package/dist/_internal/shared/features/products/to-product-item.js +45 -0
  45. package/dist/client.d.ts +21 -6
  46. package/dist/client.js +13 -3
  47. package/dist/constants/api-endpoints.d.ts +6 -9
  48. package/dist/constants/api-endpoints.js +2 -3
  49. package/dist/contracts/client-auth.d.ts +3 -7
  50. package/dist/contracts/email.d.ts +1 -0
  51. package/dist/features/account/components/AddressForm.js +24 -2
  52. package/dist/features/account/components/BecomeSellerView.d.ts +1 -2
  53. package/dist/features/account/components/BecomeSellerView.js +1 -1
  54. package/dist/features/account/components/NotificationBell.js +1 -1
  55. package/dist/features/account/components/UserBidsView.d.ts +1 -0
  56. package/dist/features/account/components/UserBidsView.js +47 -0
  57. package/dist/features/account/components/UserOrdersView.d.ts +4 -11
  58. package/dist/features/account/components/UserOrdersView.js +54 -4
  59. package/dist/features/account/components/UserReturnsView.d.ts +4 -9
  60. package/dist/features/account/components/UserReturnsView.js +37 -3
  61. package/dist/features/account/components/index.d.ts +3 -2
  62. package/dist/features/account/components/index.js +1 -0
  63. package/dist/features/admin/actions/admin-actions.js +22 -0
  64. package/dist/features/admin/actions/admin-coupon-actions.js +10 -0
  65. package/dist/features/admin/actions/notification-actions.js +4 -3
  66. package/dist/features/admin/components/AdminAdsView.d.ts +2 -3
  67. package/dist/features/admin/components/AdminAdsView.js +86 -89
  68. package/dist/features/admin/components/AdminAllEventEntriesView.js +18 -3
  69. package/dist/features/admin/components/AdminAuditLogView.d.ts +11 -0
  70. package/dist/features/admin/components/AdminAuditLogView.js +95 -0
  71. package/dist/features/admin/components/AdminBlogEditorView.js +37 -3
  72. package/dist/features/admin/components/AdminBrandEditorView.js +10 -6
  73. package/dist/features/admin/components/AdminBundleEditorView.js +18 -2
  74. package/dist/features/admin/components/AdminCarouselEditorView.js +2 -2
  75. package/dist/features/admin/components/AdminCarouselGroupEditorView.js +2 -2
  76. package/dist/features/admin/components/AdminCartsView.js +34 -4
  77. package/dist/features/admin/components/AdminCategoryEditorView.js +5 -4
  78. package/dist/features/admin/components/AdminCouponEditorView.js +2 -2
  79. package/dist/features/admin/components/AdminFaqEditorView.js +2 -2
  80. package/dist/features/admin/components/AdminHistoryView.js +11 -1
  81. package/dist/features/admin/components/AdminNotificationsView.js +27 -1
  82. package/dist/features/admin/components/AdminOrderEditorView.d.ts +10 -1
  83. package/dist/features/admin/components/AdminOrderEditorView.js +4 -3
  84. package/dist/features/admin/components/AdminOrdersView.js +92 -24
  85. package/dist/features/admin/components/AdminPayoutMarkPaidModal.d.ts +7 -0
  86. package/dist/features/admin/components/AdminPayoutMarkPaidModal.js +47 -0
  87. package/dist/features/admin/components/AdminPayoutsView.js +15 -31
  88. package/dist/features/admin/components/AdminProductEditorView.js +26 -3
  89. package/dist/features/admin/components/AdminSiteSettingsView.js +20 -1
  90. package/dist/features/admin/components/AdminStoreAddressesView.js +22 -2
  91. package/dist/features/admin/components/AdminStoresView.js +7 -0
  92. package/dist/features/admin/components/AdminSublistingCategoryEditorView.js +2 -2
  93. package/dist/features/admin/components/AdminTesterChecklistItemEditorView.js +2 -2
  94. package/dist/features/admin/components/AdminUserEditorView.d.ts +2 -2
  95. package/dist/features/admin/components/AdminUserEditorView.js +4 -2
  96. package/dist/features/admin/components/AdminUsersView.js +1 -1
  97. package/dist/features/admin/components/AdminWishlistsView.js +14 -1
  98. package/dist/features/admin/components/DataListingView.d.ts +2 -2
  99. package/dist/features/admin/components/ViewAuditLogEntryModal.d.ts +19 -0
  100. package/dist/features/admin/components/ViewAuditLogEntryModal.js +22 -0
  101. package/dist/features/admin/components/ViewNotificationModal.d.ts +21 -0
  102. package/dist/features/admin/components/ViewNotificationModal.js +15 -0
  103. package/dist/features/admin/components/analytics/AdminPageViewsReportView.d.ts +4 -7
  104. package/dist/features/admin/components/analytics/AdminPageViewsReportView.js +56 -36
  105. package/dist/features/admin/components/index.d.ts +8 -1
  106. package/dist/features/admin/components/index.js +4 -0
  107. package/dist/features/admin/constants/filter-tabs.d.ts +49 -0
  108. package/dist/features/admin/constants/filter-tabs.js +27 -0
  109. package/dist/features/admin/hooks/useAdminListing.d.ts +6 -0
  110. package/dist/features/admin/hooks/useAdminListing.js +3 -1
  111. package/dist/features/admin/hooks/useAdminListingData.d.ts +9 -1
  112. package/dist/features/admin/hooks/useAdminListingData.js +9 -2
  113. package/dist/features/admin/repository/site-settings.repository.d.ts +5 -0
  114. package/dist/features/admin/schemas/firestore.d.ts +12 -0
  115. package/dist/features/analytics/types.d.ts +1 -1
  116. package/dist/features/analytics/types.js +8 -0
  117. package/dist/features/auctions/schemas/index.d.ts +5 -0
  118. package/dist/features/audit-log/repository/audit-log.repository.d.ts +45 -0
  119. package/dist/features/audit-log/repository/audit-log.repository.js +30 -0
  120. package/dist/features/audit-log/schemas/firestore.d.ts +59 -0
  121. package/dist/features/audit-log/schemas/firestore.js +35 -0
  122. package/dist/features/auth/actions/index.d.ts +0 -1
  123. package/dist/features/auth/actions/index.js +0 -1
  124. package/dist/features/auth/hooks/useAuth.d.ts +8 -35
  125. package/dist/features/auth/hooks/useAuth.js +21 -37
  126. package/dist/features/auth/permissions/constants.d.ts +1 -1
  127. package/dist/features/auth/permissions/constants.js +2 -0
  128. package/dist/features/blog/schemas/index.d.ts +32 -0
  129. package/dist/features/catalogue/components/AdminCatalogueApprovalsView.js +31 -3
  130. package/dist/features/catalogue/components/CatalogueItemEditorView.js +2 -1
  131. package/dist/features/categories/components/BrandDetailPageView.js +14 -12
  132. package/dist/features/categories/components/CategoryDetailPageView.js +7 -3
  133. package/dist/features/categories/components/CategoryHighlightsAndFaqSection.d.ts +14 -0
  134. package/dist/features/categories/components/CategoryHighlightsAndFaqSection.js +22 -0
  135. package/dist/features/categories/components/CategoryProductsView.d.ts +1 -5
  136. package/dist/features/categories/components/CategoryProductsView.js +1 -1
  137. package/dist/features/categories/components/CategorySelectorCreate.js +16 -2
  138. package/dist/features/categories/schemas/firestore.d.ts +19 -2
  139. package/dist/features/categories/schemas/index.d.ts +24 -3
  140. package/dist/features/categories/schemas/index.js +3 -1
  141. package/dist/features/categories/types/index.d.ts +7 -0
  142. package/dist/features/checkout/actions/checkout-value-otp-actions.d.ts +17 -3
  143. package/dist/features/checkout/actions/checkout-value-otp-actions.js +101 -22
  144. package/dist/features/contact/components/ContactForm.js +17 -4
  145. package/dist/features/contact/email.d.ts +1 -0
  146. package/dist/features/contact/email.js +3 -0
  147. package/dist/features/events/components/AdminEventEditorView.js +54 -2
  148. package/dist/features/events/components/AdminEventEntriesView.d.ts +2 -16
  149. package/dist/features/events/components/AdminEventEntriesView.js +56 -89
  150. package/dist/features/events/components/EventFormDrawer.js +5 -1
  151. package/dist/features/events/components/EventRaffleEntryForm.d.ts +1 -3
  152. package/dist/features/events/components/EventRaffleEntryForm.js +1 -1
  153. package/dist/features/events/schemas/index.d.ts +22 -0
  154. package/dist/features/grouped/components/GroupedListingsCarousel.js +4 -1
  155. package/dist/features/grouped/repository/grouped-listings.repository.d.ts +4 -0
  156. package/dist/features/grouped/repository/grouped-listings.repository.js +18 -0
  157. package/dist/features/homepage/components/CharacterHotspotForm.js +202 -187
  158. package/dist/features/homepage/components/SectionCarousel.d.ts +1 -7
  159. package/dist/features/homepage/components/SectionCarousel.js +1 -1
  160. package/dist/features/layout/TitleBarLayout.d.ts +1 -1
  161. package/dist/features/layout/TitleBarLayout.js +3 -3
  162. package/dist/features/media/MediaImage.js +39 -3
  163. package/dist/features/media/types/index.d.ts +10 -0
  164. package/dist/features/media/types/index.js +1 -0
  165. package/dist/features/media/upload/MediaUploadField.d.ts +7 -1
  166. package/dist/features/media/upload/MediaUploadField.js +11 -7
  167. package/dist/features/media/upload/video-poster.d.ts +2 -0
  168. package/dist/features/media/upload/video-poster.js +16 -1
  169. package/dist/features/media/upload/video-poster.test.js +1 -1
  170. package/dist/features/orders/components/OrderStatusTimeline.d.ts +12 -0
  171. package/dist/features/orders/components/OrderStatusTimeline.js +55 -0
  172. package/dist/features/orders/components/index.d.ts +2 -0
  173. package/dist/features/orders/components/index.js +1 -0
  174. package/dist/features/orders/constants/payment-window.d.ts +25 -0
  175. package/dist/features/orders/constants/payment-window.js +25 -0
  176. package/dist/features/orders/repository/orders.repository.d.ts +32 -0
  177. package/dist/features/orders/repository/orders.repository.js +56 -0
  178. package/dist/features/orders/schemas/index.d.ts +24 -24
  179. package/dist/features/orders/types/index.d.ts +33 -0
  180. package/dist/features/pre-orders/schemas/index.d.ts +5 -0
  181. package/dist/features/products/components/BidHistory.js +9 -1
  182. package/dist/features/products/components/GroupSettingsPanel.js +25 -3
  183. package/dist/features/products/components/PrizeDrawDetailPageView.js +1 -1
  184. package/dist/features/products/components/PrizeDrawEntryActions.d.ts +1 -4
  185. package/dist/features/products/components/PrizeDrawEntryActions.js +1 -1
  186. package/dist/features/products/components/ProductDetailActions.d.ts +1 -2
  187. package/dist/features/products/components/ProductDetailActions.js +1 -1
  188. package/dist/features/products/components/ProductGrid.js +15 -1
  189. package/dist/features/products/constants/action-defs.d.ts +1 -0
  190. package/dist/features/products/constants/action-defs.js +1 -0
  191. package/dist/features/products/schemas/index.d.ts +5 -0
  192. package/dist/features/promotions/components/CouponsIndexListing.d.ts +1 -3
  193. package/dist/features/promotions/components/CouponsIndexListing.js +1 -1
  194. package/dist/features/search/components/SearchView.d.ts +1 -3
  195. package/dist/features/search/components/SearchView.js +1 -1
  196. package/dist/features/seller/components/QuickProductForm.js +2 -1
  197. package/dist/features/seller/components/SellerBidsView.js +66 -107
  198. package/dist/features/seller/components/SellerGoogleReviewsView.js +17 -1
  199. package/dist/features/seller/components/SellerOrdersView.d.ts +15 -3
  200. package/dist/features/seller/components/SellerOrdersView.js +134 -163
  201. package/dist/features/seller/components/SellerPayoutMethodsView.js +60 -48
  202. package/dist/features/seller/components/SellerPayoutSettingsView.js +69 -4
  203. package/dist/features/seller/components/SellerPayoutsView.d.ts +12 -0
  204. package/dist/features/seller/components/SellerPayoutsView.js +25 -5
  205. package/dist/features/seller/components/SellerProductShell.d.ts +10 -3
  206. package/dist/features/seller/components/SellerProductShell.js +89 -36
  207. package/dist/features/seller/components/SellerProductsFilterDrawer.d.ts +2 -7
  208. package/dist/features/seller/components/SellerProductsFilterDrawer.js +4 -4
  209. package/dist/features/seller/components/SellerProductsView.d.ts +2 -4
  210. package/dist/features/seller/components/SellerProductsView.js +131 -189
  211. package/dist/features/seller/components/SellerReviewsView.js +95 -133
  212. package/dist/features/seller/components/SellerShippingConfigsView.js +47 -67
  213. package/dist/features/seller/components/SellerShippingView.js +41 -4
  214. package/dist/features/seller/components/SellerStoreCategoriesView.js +51 -59
  215. package/dist/features/seller/components/SellerStorefrontView.d.ts +6 -1
  216. package/dist/features/seller/components/SellerStorefrontView.js +42 -5
  217. package/dist/features/seller/components/index.d.ts +2 -2
  218. package/dist/features/seller/components/index.js +2 -2
  219. package/dist/features/shell/FormShell.d.ts +24 -4
  220. package/dist/features/shell/FormShell.js +12 -6
  221. package/dist/features/shell/QuickFormDrawer.js +67 -12
  222. package/dist/features/shell/StepForm.d.ts +30 -1
  223. package/dist/features/shell/StepForm.js +47 -4
  224. package/dist/features/shell/index.d.ts +1 -1
  225. package/dist/features/shell/index.js +1 -1
  226. package/dist/features/shipments/components/AdminShipmentEditorView.js +2 -2
  227. package/dist/features/shipments/schemas/validation.d.ts +14 -4
  228. package/dist/features/tester/components/AdminTesterFeedbackListView.js +23 -2
  229. package/dist/features/tester/components/TesterChecklistStepRow.js +1 -1
  230. package/dist/features/tester/components/TesterHubView.js +3 -2
  231. package/dist/features/tester/seed-data/orders-tester-seed-data.js +9 -1
  232. package/dist/features/tester/seed-data/products-tester-seed-data.js +43 -32
  233. package/dist/features/tester/seed-data/tester-checklist-seed-data.js +404 -15
  234. package/dist/index.d.ts +15 -3
  235. package/dist/index.js +22 -5
  236. package/dist/next/routing/route-map.d.ts +11 -0
  237. package/dist/next/routing/route-map.js +5 -0
  238. package/dist/providers/email-resend/provider.js +1 -0
  239. package/dist/providers/firebase-client/auth.d.ts +1 -0
  240. package/dist/providers/firebase-client/auth.js +7 -1
  241. package/dist/repositories/index.d.ts +1 -0
  242. package/dist/repositories/index.js +1 -0
  243. package/dist/schemas/registry.d.ts +61 -25
  244. package/dist/security/pii-mask.js +1 -1
  245. package/dist/seed/categories-seed-data.js +69 -0
  246. package/dist/seed/products-auctions-seed-data.js +11 -0
  247. package/dist/seed/products-standard-seed-data.js +93 -4
  248. package/dist/seed/site-settings-seed-data.js +13 -1
  249. package/dist/seed/store-extensions-seed-data.js +1 -1
  250. package/dist/server-entry.d.ts +2 -1
  251. package/dist/server-entry.js +20 -2
  252. package/dist/server.d.ts +7 -2
  253. package/dist/server.js +8 -3
  254. package/dist/styles.css +1 -1
  255. package/dist/tailwind-utilities.css +1 -1
  256. package/dist/ui/components/Form.d.ts +11 -2
  257. package/dist/ui/components/Form.js +4 -3
  258. package/dist/ui/components/FormField.d.ts +3 -1
  259. package/dist/ui/components/FormField.js +22 -4
  260. package/dist/ui/components/ListingLayout.d.ts +1 -2
  261. package/dist/ui/components/ListingLayout.js +1 -1
  262. package/dist/ui/components/RecordDetailModal.d.ts +68 -0
  263. package/dist/ui/components/RecordDetailModal.js +8 -0
  264. package/dist/ui/components/SlottedListingView.js +9 -1
  265. package/dist/ui/forms/FormErrorSummary.d.ts +25 -0
  266. package/dist/ui/forms/FormErrorSummary.js +37 -0
  267. package/dist/ui/forms/FormShell.d.ts +37 -2
  268. package/dist/ui/forms/FormShell.js +37 -7
  269. package/dist/ui/forms/FormShell.style.css +17 -0
  270. package/dist/ui/forms/index.d.ts +2 -0
  271. package/dist/ui/forms/index.js +1 -0
  272. package/dist/ui/index.d.ts +4 -0
  273. package/dist/ui/index.js +5 -0
  274. package/dist/utils/media-url.d.ts +3 -1
  275. package/dist/utils/media-url.js +20 -1
  276. package/dist/validation/schemas.d.ts +4 -4
  277. package/package.json +1 -1
  278. package/dist/_internal/client/features/classified/ClassifiedDetailView.d.ts +0 -9
  279. package/dist/_internal/client/features/classified/ClassifiedDetailView.js +0 -55
  280. package/dist/_internal/client/features/digital-code/DigitalCodeDetailView.d.ts +0 -18
  281. package/dist/_internal/client/features/digital-code/DigitalCodeDetailView.js +0 -21
  282. package/dist/_internal/client/features/live/LiveItemDetailView.d.ts +0 -9
  283. package/dist/_internal/client/features/live/LiveItemDetailView.js +0 -25
  284. package/dist/_internal/server/jobs/core/prizeRevealClose.d.ts +0 -2
  285. package/dist/_internal/server/jobs/core/prizeRevealClose.js +0 -28
  286. package/dist/_internal/server/jobs/core/prizeRevealExpiry.d.ts +0 -2
  287. package/dist/_internal/server/jobs/core/prizeRevealExpiry.js +0 -61
  288. package/dist/_internal/server/jobs/core/prizeRevealOpen.d.ts +0 -2
  289. package/dist/_internal/server/jobs/core/prizeRevealOpen.js +0 -68
  290. package/dist/_internal/server/jobs/core/prizeRevealReminder.d.ts +0 -2
  291. package/dist/_internal/server/jobs/core/prizeRevealReminder.js +0 -49
  292. package/dist/_internal/server/jobs/handlers/prizeRevealClose.d.ts +0 -2
  293. package/dist/_internal/server/jobs/handlers/prizeRevealClose.js +0 -2
  294. package/dist/_internal/server/jobs/handlers/prizeRevealExpiry.d.ts +0 -2
  295. package/dist/_internal/server/jobs/handlers/prizeRevealExpiry.js +0 -2
  296. package/dist/_internal/server/jobs/handlers/prizeRevealOpen.d.ts +0 -2
  297. package/dist/_internal/server/jobs/handlers/prizeRevealOpen.js +0 -2
  298. package/dist/_internal/server/jobs/handlers/prizeRevealReminder.d.ts +0 -2
  299. package/dist/_internal/server/jobs/handlers/prizeRevealReminder.js +0 -2
  300. package/dist/features/auth/consent-otp.d.ts +0 -57
  301. package/dist/features/auth/consent-otp.js +0 -127
  302. package/dist/features/cart/components/CheckoutOtpModal.d.ts +0 -15
  303. package/dist/features/cart/components/CheckoutOtpModal.js +0 -12
  304. package/dist/features/checkout/actions/checkout-actions.d.ts +0 -31
  305. package/dist/features/checkout/actions/checkout-actions.js +0 -124
  306. package/dist/features/classified/components/ClassifiedIndexListing.d.ts +0 -5
  307. package/dist/features/classified/components/ClassifiedIndexListing.js +0 -123
  308. package/dist/features/classified/components/ClassifiedListView.d.ts +0 -6
  309. package/dist/features/classified/components/ClassifiedListView.js +0 -44
  310. package/dist/features/digital-codes/components/DigitalCodesIndexListing.d.ts +0 -5
  311. package/dist/features/digital-codes/components/DigitalCodesIndexListing.js +0 -114
  312. package/dist/features/digital-codes/components/DigitalCodesListView.d.ts +0 -6
  313. package/dist/features/digital-codes/components/DigitalCodesListView.js +0 -38
  314. package/dist/features/live/components/LiveItemsIndexListing.d.ts +0 -5
  315. package/dist/features/live/components/LiveItemsIndexListing.js +0 -115
  316. package/dist/features/live/components/LiveItemsListView.d.ts +0 -6
  317. package/dist/features/live/components/LiveItemsListView.js +0 -44
  318. package/dist/features/seller/components/SellerTemplatesView.d.ts +0 -12
  319. package/dist/features/seller/components/SellerTemplatesView.js +0 -276
  320. package/dist/react/hooks/useVisibleItems.d.ts +0 -37
  321. package/dist/react/hooks/useVisibleItems.js +0 -59
  322. package/dist/ui/components/TabStrip.d.ts +0 -34
  323. package/dist/ui/components/TabStrip.js +0 -56
  324. package/dist/ui/components/TabStrip.style.css +0 -97
@@ -3,30 +3,26 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
3
3
  import { normalizeError } from "../../../errors/normalize";
4
4
  import { SIEVE_OP, Stack, sieveFilter } from "@mohasinac/appkit/client";
5
5
  import { sortBy } from "@mohasinac/appkit/client";
6
- import React, { useState, useCallback } from "react";
6
+ import { useState, useCallback } from "react";
7
7
  import { useEntityDelete } from "../../../react/hooks/useEntityDelete";
8
8
  import { useActionDispatch } from "../../../react/hooks/use-action-dispatch";
9
9
  import { Eye, EyeOff, Pencil, Trash2, Printer, MapPin } from "lucide-react";
10
10
  import { PhysicalLocationModal } from "./PhysicalLocationModal";
11
11
  import { useUrlTable } from "../../../react/hooks/useUrlTable";
12
- import { useBulkSelection } from "../../../react/hooks/useBulkSelection";
13
- import { Alert, Badge, BulkActionBar, Button, Div, ListingToolbar, ListingLayout, Pagination, Row, Select, Span, Text, useToast, StickyToolbar } from "../../../ui";
12
+ import { Badge, Button, Div, Row, Select, Span, Text, useToast } from "../../../ui";
14
13
  import { MediaImage } from "../../media/MediaImage";
15
14
  import { SELLER_ENDPOINTS } from "../../../constants/api-endpoints";
16
15
  import { SELLER_PRODUCT_STATUS_TABS } from "../../admin/constants/filter-tabs";
17
16
  import { ROUTES } from "../../../constants";
18
17
  import { normalizeListingType } from "../../products/utils/listing-type";
19
- import { toRecordArray, toRelativeDate, toStringValue, useSellerListingData, } from "../hooks/useSellerListingData";
20
- import { DataTable } from "../../admin/components/DataTable";
21
- import { useDataViewMode } from "../../account/hooks/useDataViewMode";
22
- import { ACTIONS } from "../../../_internal/shared/actions/action-registry";
23
- import { buildBulkAction } from "../../../_internal/shared/actions/bulk-helpers";
18
+ import { toRecordArray, toRelativeDate, toStringValue } from "../hooks/useSellerListingData";
24
19
  import { useListingTypeFlags } from "../../../react/hooks/useListingTypeFlags";
25
20
  import { SellerProductsCards } from "./SellerProductsCards";
26
- import { SellerProductsFilterDrawer } from "./SellerProductsFilterDrawer";
21
+ import { SellerProductsFilterFields } from "./SellerProductsFilterDrawer";
27
22
  import { LISTING_BADGE_VARIANT } from "../../products/utils/listing-badge-variant";
28
- import { useBottomActions } from "../../layout";
29
- const PAGE_SIZE = 25;
23
+ import { DataListingView } from "../../admin/components/DataListingView";
24
+ import { ACTIONS } from "../../../_internal/shared/actions/action-registry";
25
+ import { buildBulkAction } from "../../../_internal/shared/actions/bulk-helpers";
30
26
  const FILTER_KEYS = [
31
27
  "status",
32
28
  "category",
@@ -36,6 +32,8 @@ const FILTER_KEYS = [
36
32
  "maxPrice",
37
33
  "tags",
38
34
  "badges",
35
+ "listingType",
36
+ "showSold",
39
37
  ];
40
38
  const DEFAULT_SORT = "-createdAt";
41
39
  const SORT_OPTIONS = [
@@ -47,13 +45,8 @@ const SORT_OPTIONS = [
47
45
  { value: sortBy("price", "ASC"), label: "Price Low" },
48
46
  ];
49
47
  const STATUS_OPTIONS = SELLER_PRODUCT_STATUS_TABS;
50
- // S-STORE-2-A — `<TypeDropdown>` replaces the legacy chip strip. Same width on
51
- // mobile, narrower on desktop. Drives the `?listingType=` query param.
52
48
  function TypeDropdown({ active, onChange, }) {
53
49
  const flags = useListingTypeFlags();
54
- // W1-43 — hide disabled types so the seller can't filter for an
55
- // inactive listing surface. Bundle is a categoryType (not a listingType)
56
- // and stays unconditionally available.
57
50
  const options = [
58
51
  { value: "all", label: "All listings" },
59
52
  flags.standard && { value: "standard", label: "Standard" },
@@ -90,23 +83,19 @@ const PRODUCT_COLUMNS = [
90
83
  header: "Status",
91
84
  className: "w-28",
92
85
  render: (row) => {
93
- // Real ProductStatus is draft|published|in_review|archived — "active"
94
- // and "sold" are not stored status values (sold is tracked separately
95
- // via isSold, shown via the "Show sold" toolbar toggle, not this
96
- // column), so those two branches never matched and were dead code.
97
86
  const variant = row.status === "published"
98
87
  ? "success"
99
88
  : row.status === "draft"
100
89
  ? "default"
101
90
  : "danger";
102
- return (_jsx(Badge, { variant: variant, children: row.status }));
91
+ return _jsx(Badge, { variant: variant, children: row.status });
103
92
  },
104
93
  },
105
94
  {
106
95
  key: "updatedAt",
107
96
  header: "Updated",
108
97
  className: "w-28",
109
- render: (row) => (_jsx(Span, { size: "xs", color: "muted", children: row.updatedAt })),
98
+ render: (row) => _jsx(Span, { size: "xs", color: "muted", children: row.updatedAt }),
110
99
  },
111
100
  {
112
101
  key: "physicalLocation",
@@ -115,16 +104,15 @@ const PRODUCT_COLUMNS = [
115
104
  render: (row) => row.physicalLocation ? (_jsxs(Span, { size: "xs", className: "font-mono text-[var(--appkit-color-text-muted)]", children: [row.physicalLocation.zone, "/", row.physicalLocation.shelf, "/", row.physicalLocation.bin] })) : (_jsx(Span, { size: "xs", color: "faint", children: "\u2014" })),
116
105
  },
117
106
  ];
118
- export function SellerProductsView({ onDeleteProduct, onCreateClick, children, ...props }) {
119
- const hasChildren = React.Children.count(children) > 0;
120
- const { view, setView } = useDataViewMode("list");
107
+ export function SellerProductsView({ onDeleteProduct, onCreateClick, }) {
121
108
  const dispatch = useActionDispatch();
122
109
  const { showToast } = useToast();
123
- const table = useUrlTable({ defaults: { pageSize: String(PAGE_SIZE), sort: DEFAULT_SORT } });
124
- const [searchInput, setSearchInput] = useState(table.get("q") || "");
125
- const [filterOpen, setFilterOpen] = useState(false);
126
- // listingKind is URL-driven so it survives navigation and back/forward
127
- const listingKind = (table.get("listingType") || "all");
110
+ // Independent useUrlTable() instance for the type-dropdown + "Show sold"
111
+ // toggle (Root Cause #35) reads/writes the same URL params DataListingView's
112
+ // own internal table also reads via `filterKeys`, so both stay in sync.
113
+ const sideTable = useUrlTable({ defaults: { sort: DEFAULT_SORT } });
114
+ const listingKind = (sideTable.get("listingType") || "all");
115
+ const showSold = sideTable.get("showSold") === "true";
128
116
  const { deletingId, handleDelete: performDelete } = useEntityDelete({
129
117
  deleteFn: onDeleteProduct,
130
118
  onSuccess: (id) => { setDeletedIds((prev) => new Set([...prev, id])); },
@@ -133,148 +121,10 @@ export function SellerProductsView({ onDeleteProduct, onCreateClick, children, .
133
121
  const [publishingId, setPublishingId] = useState(null);
134
122
  const [statusOverrides, setStatusOverrides] = useState(new Map());
135
123
  const [setLocationOpen, setSetLocationOpen] = useState(false);
136
- const [pendingFilters, setPendingFilters] = useState(() => Object.fromEntries(FILTER_KEYS.map((k) => [k, table.get(k)])));
137
- const openFilters = useCallback(() => {
138
- setPendingFilters(Object.fromEntries(FILTER_KEYS.map((k) => [k, table.get(k)])));
139
- setFilterOpen(true);
140
- }, [table]);
141
- const applyFilters = useCallback(() => {
142
- const updates = { page: "1" };
143
- for (const k of FILTER_KEYS)
144
- updates[k] = pendingFilters[k] ?? "";
145
- table.setMany(updates);
146
- setFilterOpen(false);
147
- }, [pendingFilters, table]);
148
- const clearFilters = useCallback(() => {
149
- setPendingFilters(Object.fromEntries(FILTER_KEYS.map((k) => [k, ""])));
150
- }, []);
151
- const resetAll = useCallback(() => {
152
- const updates = { q: "", sort: "", listingType: "", showSold: "" };
153
- for (const k of FILTER_KEYS)
154
- updates[k] = "";
155
- table.setMany(updates);
156
- setSearchInput("");
157
- }, [table]);
158
- const commitSearch = useCallback(() => {
159
- table.set("q", searchInput.trim());
160
- }, [searchInput, table]);
124
+ const [selectedIdsForLocation, setSelectedIdsForLocation] = useState([]);
161
125
  const handleKindChange = useCallback((kind) => {
162
- // setMany prevents the double router.replace race condition (audit-double-navigation)
163
- table.setMany({ listingType: kind === "all" ? "" : kind, page: "1" });
164
- }, [table]);
165
- const showSold = table.get("showSold") === "true";
166
- const activeFilterCount = FILTER_KEYS.filter((k) => !!table.get(k)).length;
167
- const hasActiveState = !!table.get("q") ||
168
- table.get("sort") !== DEFAULT_SORT ||
169
- activeFilterCount > 0 ||
170
- listingKind !== "all" ||
171
- showSold;
172
- const statusRaw = table.get("status");
173
- const statusFilter = statusRaw && statusRaw !== "All" ? sieveFilter("status", SIEVE_OP.EQ, statusRaw) : undefined;
174
- // SB1-G — single-field listingType clause. The repository's Sieve aliases
175
- // accept both `==auction|preorder|standard` and `==pre-order` directly.
176
- const kindFilter = listingKind === "all" ? undefined : sieveFilter("listingType", SIEVE_OP.EQ, listingKind);
177
- const soldFilter = showSold ? undefined : "isSold==false";
178
- const filters = [statusFilter, kindFilter, soldFilter].filter(Boolean).join(",") || undefined;
179
- const { rows, total, isLoading, errorMessage } = useSellerListingData({
180
- queryKey: ["seller", "products", "listing", listingKind],
181
- endpoint: SELLER_ENDPOINTS.PRODUCTS,
182
- page: table.getNumber("page", 1),
183
- pageSize: PAGE_SIZE,
184
- sorts: table.get("sort") || DEFAULT_SORT,
185
- filters,
186
- q: table.get("q") || undefined,
187
- mapRows: (response) => toRecordArray(response.products).map((item, index) => {
188
- // SB1-G — derive kind from canonical listingType with legacy fallback.
189
- const lt = normalizeListingType(item);
190
- const kind = lt === "auction"
191
- ? "auction"
192
- : lt === "pre-order"
193
- ? "pre-order"
194
- : lt === "prize-draw"
195
- ? "prize-draw"
196
- : "standard";
197
- const priceRaw = typeof item.price === "number" ? item.price : 0;
198
- // Auction listings lost their reserve/bid/end-date summary when this
199
- // view was consolidated from the old dedicated SellerAuctionsView —
200
- // restore it into `secondary` (the one line every row/card renders)
201
- // instead of the generic condition string, which auction sellers
202
- // care about far less than bid activity.
203
- const auctionSecondary = kind === "auction"
204
- ? [
205
- typeof item.reservePrice === "number"
206
- ? `Reserve ₹${item.reservePrice.toLocaleString("en-IN")}`
207
- : null,
208
- `${typeof item.bidCount === "number" ? item.bidCount : 0} bids`,
209
- item.auctionEndDate
210
- ? `Ends ${new Date(item.auctionEndDate).toLocaleDateString("en-IN", { month: "short", day: "numeric" })}`
211
- : null,
212
- ]
213
- .filter(Boolean)
214
- .join(" · ")
215
- : "";
216
- return {
217
- id: toStringValue(item.id, `product-${index}`),
218
- primary: toStringValue(item.title ?? item.name, "Untitled product"),
219
- secondary: auctionSecondary || toStringValue(item.condition, ""),
220
- status: toStringValue(item.status, "draft"),
221
- updatedAt: toRelativeDate(item.updatedAt ?? item.createdAt),
222
- imageUrl: toStringValue(item.mainImage ?? item.images?.[0], undefined),
223
- image: toStringValue(item.mainImage ?? item.images?.[0], undefined),
224
- listingKind: kind,
225
- price: priceRaw ? `₹${priceRaw.toLocaleString("en-IN")}` : "—",
226
- physicalLocation: item.physicalLocation &&
227
- typeof item.physicalLocation.zone === "string"
228
- ? item.physicalLocation
229
- : undefined,
230
- };
231
- }),
232
- getTotal: (response, mappedRows) => typeof response.meta?.total === "number" ? response.meta.total : mappedRows.length,
233
- });
234
- const currentPage = table.getNumber("page", 1);
235
- const totalPages = Math.ceil(total / PAGE_SIZE);
236
- const visibleRows = rows
237
- .filter((r) => !deletedIds.has(r.id))
238
- .map((r) => statusOverrides.has(r.id) ? { ...r, status: statusOverrides.get(r.id) } : r);
239
- const selection = useBulkSelection({ items: visibleRows, keyExtractor: (r) => r.id });
240
- // handleBulkPrintLabels/handleSetLocation (useCallback) and useBottomActions
241
- // must run unconditionally on every render — they were previously declared
242
- // after the `hasChildren` early return below, which skips these hook calls
243
- // in passthrough mode, violating the Rules of Hooks.
244
- const handleBulkPrintLabels = useCallback(() => {
245
- const ids = selection.selectedIds.join(",");
246
- void dispatch({
247
- type: "NAVIGATE",
248
- href: `${String(ROUTES.STORE.PRINT_CENTER)}?type=product&ids=${ids}&autoprint=1`,
249
- });
250
- }, [selection.selectedIds, dispatch]);
251
- const handleSetLocation = useCallback(async (loc) => {
252
- try {
253
- const res = await fetch(SELLER_ENDPOINTS.PRODUCTS_BULK_LOCATION, {
254
- method: "PATCH",
255
- headers: { "Content-Type": "application/json" },
256
- body: JSON.stringify({ productIds: selection.selectedIds, physicalLocation: loc }),
257
- });
258
- if (!res.ok) {
259
- const body = await res.json().catch(() => null);
260
- throw new Error(body?.error ?? "Failed to update location");
261
- }
262
- showToast("Location updated.", "success");
263
- setSetLocationOpen(false);
264
- }
265
- catch (err) {
266
- void normalizeError(err);
267
- showToast(err instanceof Error ? err.message : "Failed to update location.", "error");
268
- }
269
- }, [selection.selectedIds, showToast]);
270
- const bulkActions = [
271
- buildBulkAction(ACTIONS.STORE["print-labels"], handleBulkPrintLabels, { icon: _jsx(Printer, { className: "w-4 h-4" }) }),
272
- buildBulkAction(ACTIONS.STORE["set-location"], () => setSetLocationOpen(true), { icon: _jsx(MapPin, { className: "w-4 h-4" }) }),
273
- ];
274
- useBottomActions(selection.selectedCount > 0 ? { bulk: { selectedCount: selection.selectedCount, onClearSelection: selection.clearSelection, actions: bulkActions } } : {});
275
- if (hasChildren) {
276
- return (_jsx(ListingLayout, { portal: "seller", ...props, children: children }));
277
- }
126
+ sideTable.setMany({ listingType: kind === "all" ? "" : kind, page: "1" });
127
+ }, [sideTable]);
278
128
  const handleEdit = (row) => {
279
129
  const href = row.listingKind === "auction"
280
130
  ? String(ROUTES.STORE.AUCTIONS_EDIT(row.id))
@@ -290,7 +140,6 @@ export function SellerProductsView({ onDeleteProduct, onCreateClick, children, .
290
140
  return;
291
141
  await performDelete(row.id);
292
142
  };
293
- // S-STORE-2-C — Duplicate verb. Server-side endpoint is /api/store/products/[id]/duplicate.
294
143
  const handleDuplicate = async (row) => {
295
144
  const res = await fetch(SELLER_ENDPOINTS.PRODUCT_DUPLICATE(row.id), {
296
145
  method: "POST",
@@ -320,21 +169,114 @@ export function SellerProductsView({ onDeleteProduct, onCreateClick, children, .
320
169
  setPublishingId(null);
321
170
  }
322
171
  };
323
- return (_jsxs(_Fragment, { children: [_jsxs(Div, { className: "min-h-screen", children: [_jsx(ListingToolbar, { filterCount: activeFilterCount, onFiltersClick: openFilters, searchValue: searchInput, searchPlaceholder: "Search products by name\u2026", 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, toggles: [
324
- { label: "Show sold", active: showSold, onChange: (next) => table.set("showSold", next ? "true" : "") },
325
- ], extra: onCreateClick ? (_jsx(Button, { variant: "primary", size: "sm", onClick: onCreateClick, children: "+ New Listing" })) : null }), _jsx(TypeDropdown, { active: listingKind, onChange: handleKindChange }), totalPages > 1 && (_jsx(StickyToolbar, { offset: "header+pagination", tone: "default", border: true, padding: "sm", children: _jsx(Row, { justify: "center", children: _jsx(Pagination, { currentPage: currentPage, totalPages: totalPages, onPageChange: (p) => table.setPage(p) }) }) })), selection.selectedIds.length > 0 && (_jsx(StickyToolbar, { offset: "header+bulk-actions", tone: "default", border: true, padding: "sm", z: "above-toolbar", children: _jsx(BulkActionBar, { selectedCount: selection.selectedIds.length, onClearSelection: selection.clearSelection, actions: bulkActions }) })), _jsxs(Div, { paddingX: "x-sm-lg-md", padding: "y-md", children: [errorMessage && (_jsx(Alert, { variant: "error", className: "mb-4", children: errorMessage })), view !== "table" && (_jsx(SellerProductsCards, { view: view, rows: visibleRows, isLoading: isLoading, listingKind: listingKind, selectedIds: selection.selectedIdSet, toggle: selection.toggle, onEdit: handleEdit, onDuplicate: (row) => void handleDuplicate(row), onDelete: onDeleteProduct ? (row) => void handleDelete(row) : undefined })), view === "table" && (_jsx(DataTable, { columns: PRODUCT_COLUMNS, rows: visibleRows, isLoading: isLoading, emptyLabel: listingKind !== "all"
326
- ? `No ${listingKind} listings found`
327
- : "No products listed yet", selectedIds: selection.selectedIdSet, onToggleSelect: selection.toggle, onToggleSelectAll: () => selection.toggleAll(), rowHrefTemplate: (row) =>
328
- // S-STORE-2-D row click public detail/preview, not edit.
329
- // A function is safe here: both this view and DataTable are
330
- // already client components, and the target varies per row
331
- // (not expressible as a single {id} template string).
332
- row.listingKind === "auction"
333
- ? `/auctions/${row.id}`
334
- : row.listingKind === "pre-order"
335
- ? `/pre-orders/${row.id}`
336
- : `/products/${row.id}`, renderRowActions: (row) => {
337
- const isPublished = (statusOverrides.get(row.id) ?? row.status) === "published";
338
- return (_jsxs(Row, { gap: "xs", children: [_jsx(Button, { variant: "ghost", size: "sm", onClick: (e) => { e.stopPropagation(); handleEdit(row); }, "aria-label": ACTIONS.STORE["edit-listing"].ariaLabel, children: _jsx(Pencil, { className: "w-4 h-4" }) }), _jsx(Button, { variant: "ghost", size: "sm", onClick: (e) => { e.stopPropagation(); void handleTogglePublish(row); }, "aria-label": isPublished ? "Unpublish" : "Publish", title: isPublished ? "Unpublish" : "Publish", disabled: publishingId === row.id, children: isPublished ? _jsx(EyeOff, { className: "w-4 h-4" }) : _jsx(Eye, { className: "w-4 h-4" }) }), _jsx(Button, { variant: "ghost", size: "sm", onClick: (e) => { e.stopPropagation(); void handleDuplicate(row); }, "aria-label": "Duplicate listing", title: "Duplicate", children: "\u29C9" }), onDeleteProduct && (_jsx(Button, { variant: "ghost", size: "sm", action: ACTIONS.STORE["delete-listing"], onClick: (e) => { e.stopPropagation(); void handleDelete(row); }, disabled: deletingId === row.id, className: "text-[var(--appkit-color-error)] hover:bg-[var(--appkit-color-border-subtle)]", children: _jsx(Trash2, { className: "w-4 h-4" }) }))] }));
339
- } }))] }), _jsx(SellerProductsFilterDrawer, { isOpen: filterOpen, pendingFilters: pendingFilters, statusOptions: STATUS_OPTIONS, activeFilterCount: activeFilterCount, onChange: setPendingFilters, onClear: clearFilters, onApply: applyFilters, onClose: () => setFilterOpen(false) })] }), setLocationOpen && (_jsx(PhysicalLocationModal, { count: selection.selectedIds.length, onSave: handleSetLocation, onClose: () => setSetLocationOpen(false) }))] }));
172
+ const handleSetLocation = useCallback(async (loc, ids) => {
173
+ try {
174
+ const res = await fetch(SELLER_ENDPOINTS.PRODUCTS_BULK_LOCATION, {
175
+ method: "PATCH",
176
+ headers: { "Content-Type": "application/json" },
177
+ body: JSON.stringify({ productIds: ids, physicalLocation: loc }),
178
+ });
179
+ if (!res.ok) {
180
+ const body = await res.json().catch(() => null);
181
+ throw new Error(body?.error ?? "Failed to update location");
182
+ }
183
+ showToast("Location updated.", "success");
184
+ setSetLocationOpen(false);
185
+ }
186
+ catch (err) {
187
+ void normalizeError(err);
188
+ showToast(err instanceof Error ? err.message : "Failed to update location.", "error");
189
+ }
190
+ }, [showToast]);
191
+ const config = {
192
+ portal: "seller",
193
+ title: "Products",
194
+ searchPlaceholder: "Search products by name…",
195
+ emptyLabel: listingKind !== "all" ? `No ${listingKind} listings found` : "No products listed yet",
196
+ filterKeys: FILTER_KEYS,
197
+ defaultSort: DEFAULT_SORT,
198
+ queryKey: ["seller", "products", "listing", listingKind],
199
+ endpoint: SELLER_ENDPOINTS.PRODUCTS,
200
+ sortOptions: SORT_OPTIONS,
201
+ columns: PRODUCT_COLUMNS,
202
+ toggles: [
203
+ { label: "Show sold", active: showSold, onChange: (next) => sideTable.set("showSold", next ? "true" : "") },
204
+ ],
205
+ primaryAction: onCreateClick ? { label: "New Listing", onClick: onCreateClick } : undefined,
206
+ mapRows: (response) => {
207
+ const rows = toRecordArray(response.products).map((item, index) => {
208
+ const lt = normalizeListingType(item);
209
+ const kind = lt === "auction"
210
+ ? "auction"
211
+ : lt === "pre-order"
212
+ ? "pre-order"
213
+ : lt === "prize-draw"
214
+ ? "prize-draw"
215
+ : "standard";
216
+ const priceRaw = typeof item.price === "number" ? item.price : 0;
217
+ const auctionSecondary = kind === "auction"
218
+ ? [
219
+ typeof item.reservePrice === "number"
220
+ ? `Reserve ₹${item.reservePrice.toLocaleString("en-IN")}`
221
+ : null,
222
+ `${typeof item.bidCount === "number" ? item.bidCount : 0} bids`,
223
+ item.auctionEndDate
224
+ ? `Ends ${new Date(item.auctionEndDate).toLocaleDateString("en-IN", { month: "short", day: "numeric" })}`
225
+ : null,
226
+ ]
227
+ .filter(Boolean)
228
+ .join(" · ")
229
+ : "";
230
+ return {
231
+ id: toStringValue(item.id, `product-${index}`),
232
+ primary: toStringValue(item.title ?? item.name, "Untitled product"),
233
+ secondary: auctionSecondary || toStringValue(item.condition, ""),
234
+ status: toStringValue(item.status, "draft"),
235
+ updatedAt: toRelativeDate(item.updatedAt ?? item.createdAt),
236
+ imageUrl: toStringValue(item.mainImage ?? item.images?.[0], undefined),
237
+ image: toStringValue(item.mainImage ?? item.images?.[0], undefined),
238
+ listingKind: kind,
239
+ price: priceRaw ? `₹${priceRaw.toLocaleString("en-IN")}` : "—",
240
+ physicalLocation: item.physicalLocation &&
241
+ typeof item.physicalLocation.zone === "string"
242
+ ? item.physicalLocation
243
+ : undefined,
244
+ };
245
+ });
246
+ return rows.filter((r) => !deletedIds.has(r.id)).map((r) => statusOverrides.has(r.id) ? { ...r, status: statusOverrides.get(r.id) } : r);
247
+ },
248
+ getTotal: (response, mappedRows) => typeof response.meta?.total === "number" ? response.meta.total : mappedRows.length,
249
+ buildFilters: (state) => {
250
+ const statusFilter = state.status && state.status !== "All" ? sieveFilter("status", SIEVE_OP.EQ, state.status) : undefined;
251
+ const kindFilter = !state.listingType || state.listingType === "all" ? undefined : sieveFilter("listingType", SIEVE_OP.EQ, state.listingType);
252
+ const soldFilter = state.showSold === "true" ? undefined : "isSold==false";
253
+ return [statusFilter, kindFilter, soldFilter].filter(Boolean).join(",") || undefined;
254
+ },
255
+ renderFilterPanel: ({ pendingFilters, setPendingFilters }) => (_jsx(SellerProductsFilterFields, { pendingFilters: pendingFilters, statusOptions: STATUS_OPTIONS, onChange: setPendingFilters })),
256
+ renderAboveContent: () => _jsx(TypeDropdown, { active: listingKind, onChange: handleKindChange }),
257
+ buildBulkActions: (selection) => {
258
+ const handleBulkPrintLabels = () => {
259
+ const ids = selection.selectedIds.join(",");
260
+ void dispatch({
261
+ type: "NAVIGATE",
262
+ href: `${String(ROUTES.STORE.PRINT_CENTER)}?type=product&ids=${ids}&autoprint=1`,
263
+ });
264
+ };
265
+ return [
266
+ buildBulkAction(ACTIONS.STORE["print-labels"], handleBulkPrintLabels, { icon: _jsx(Printer, { className: "w-4 h-4" }) }),
267
+ buildBulkAction(ACTIONS.STORE["set-location"], () => { setSelectedIdsForLocation(selection.selectedIds); setSetLocationOpen(true); }, { icon: _jsx(MapPin, { className: "w-4 h-4" }) }),
268
+ ];
269
+ },
270
+ renderCards: (rows, view, selection, isLoading) => (_jsx(SellerProductsCards, { view: view, rows: rows, isLoading: isLoading, listingKind: listingKind, selectedIds: new Set(selection.selectedIds), toggle: selection.toggleSelect, onEdit: handleEdit, onDuplicate: (row) => void handleDuplicate(row), onDelete: onDeleteProduct ? (row) => void handleDelete(row) : undefined })),
271
+ rowHrefTemplate: (row) => row.listingKind === "auction"
272
+ ? `/auctions/${row.id}`
273
+ : row.listingKind === "pre-order"
274
+ ? `/pre-orders/${row.id}`
275
+ : `/products/${row.id}`,
276
+ renderRowActions: (row) => {
277
+ const isPublished = (statusOverrides.get(row.id) ?? row.status) === "published";
278
+ return (_jsxs(Row, { gap: "xs", children: [_jsx(Button, { variant: "ghost", size: "sm", onClick: (e) => { e.stopPropagation(); handleEdit(row); }, "aria-label": ACTIONS.STORE["edit-listing"].ariaLabel, children: _jsx(Pencil, { className: "w-4 h-4" }) }), _jsx(Button, { variant: "ghost", size: "sm", onClick: (e) => { e.stopPropagation(); void handleTogglePublish(row); }, "aria-label": isPublished ? "Unpublish" : "Publish", title: isPublished ? "Unpublish" : "Publish", disabled: publishingId === row.id, children: isPublished ? _jsx(EyeOff, { className: "w-4 h-4" }) : _jsx(Eye, { className: "w-4 h-4" }) }), _jsx(Button, { variant: "ghost", size: "sm", onClick: (e) => { e.stopPropagation(); void handleDuplicate(row); }, "aria-label": "Duplicate listing", title: "Duplicate", children: "\u29C9" }), onDeleteProduct && (_jsx(Button, { variant: "ghost", size: "sm", action: ACTIONS.STORE["delete-listing"], onClick: (e) => { e.stopPropagation(); void handleDelete(row); }, disabled: deletingId === row.id, className: "text-[var(--appkit-color-error)] hover:bg-[var(--appkit-color-border-subtle)]", children: _jsx(Trash2, { className: "w-4 h-4" }) }))] }));
279
+ },
280
+ };
281
+ return (_jsxs(_Fragment, { children: [_jsx(DataListingView, { config: config }), setLocationOpen && (_jsx(PhysicalLocationModal, { count: selectedIdsForLocation.length, onSave: (loc) => handleSetLocation(loc, selectedIdsForLocation), onClose: () => setSetLocationOpen(false) }))] }));
340
282
  }